@superdispatch/ui 0.17.1 → 0.19.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.
@@ -6,7 +6,6 @@ import { Button } from "../button/Button.js";
6
6
  import { mergeRefs } from "../utils/mergeRefs.js";
7
7
  import { useResizeObserver } from "../utils/ResizeObserver.js";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
- import { Fragment as _Fragment } from "react/jsx-runtime";
10
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
10
  var useStyles = /*#__PURE__*/makeStyles({
12
11
  root: {
@@ -97,19 +96,17 @@ export var AdaptiveVerticalToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
97
96
  onClose: () => {
98
97
  setMenuButtonRef(undefined);
99
98
  },
100
- children: menuItems.map((item, index, arr) => {
99
+ children: menuItems.flatMap((item, index, arr) => {
101
100
  var next = arr[index + 1];
102
- return /*#__PURE__*/_jsxs(_Fragment, {
103
- children: [/*#__PURE__*/_jsx(MenuItem, {
104
- onClick: event => {
105
- var _item$onClick;
101
+ return [/*#__PURE__*/_jsx(MenuItem, {
102
+ onClick: event => {
103
+ var _item$onClick;
106
104
 
107
- (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
108
- setMenuButtonRef(undefined);
109
- },
110
- children: renderMenuItem(item)
111
- }, item.key), next && next.menuGroupKey !== item.menuGroupKey && /*#__PURE__*/_jsx(Divider, {})]
112
- });
105
+ (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
106
+ setMenuButtonRef(undefined);
107
+ },
108
+ children: renderMenuItem(item)
109
+ }, item.key), next && next.menuGroupKey !== item.menuGroupKey && /*#__PURE__*/_jsx(Divider, {}, "".concat(item.key, "-divider"))];
113
110
  })
114
111
  })]
115
112
  })]
package/dist-src/index.js CHANGED
@@ -35,6 +35,7 @@ export * from "./theme/Color.js";
35
35
  export * from "./theme/SuperDispatchTheme.js";
36
36
  export * from "./theme/ThemeProvider.js";
37
37
  export * from "./tiles/Tiles.js";
38
+ export * from "./utils/ExitTransitionPlaceholder.js";
38
39
  export * from "./utils/isEmptyReactNode.js";
39
40
  export * from "./utils/mergeRefs.js";
40
41
  export * from "./utils/renderChildren.js";
@@ -0,0 +1,15 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { renderChildren } from "./renderChildren.js";
3
+ export function ExitTransitionPlaceholder(_ref) {
4
+ var {
5
+ in: inProp,
6
+ children: childrenProp
7
+ } = _ref;
8
+ var [children, setChildren] = useState(childrenProp);
9
+ useEffect(() => {
10
+ if (inProp) {
11
+ setChildren(childrenProp);
12
+ }
13
+ }, [inProp, childrenProp]);
14
+ return renderChildren(children);
15
+ }
@@ -412,6 +412,12 @@ interface TilesProps {
412
412
  }
413
413
  declare const Tiles: ForwardRefExoticComponent<TilesProps & RefAttributes<HTMLDivElement>>;
414
414
 
415
+ interface ExitTransitionPlaceholderProps {
416
+ in: boolean;
417
+ children: ReactNode;
418
+ }
419
+ declare function ExitTransitionPlaceholder({ in: inProp, children: childrenProp, }: ExitTransitionPlaceholderProps): null | ReactElement;
420
+
415
421
  declare function isEmptyReactNode(node: ReactNode): node is null | undefined | boolean | string;
416
422
 
417
423
  declare function mergeRefs<T>(...refs: Array<null | undefined | Ref<T>>): (node: T) => void;
@@ -442,4 +448,4 @@ interface VisibilityObserverProps extends VisibilityObserverOptions {
442
448
  }
443
449
  declare function VisibilityObserver({ render, onChange, ...options }: VisibilityObserverProps): null | ReactElement;
444
450
 
445
- export { AdaptiveToolbar, AdaptiveToolbarDropdownItem, AdaptiveToolbarItem, AdaptiveToolbarProps, AdaptiveVerticalToolbar, AdaptiveVerticalToolbarItem, AdaptiveVerticalToolbarProps, AvatarButton, AvatarButtonClassKey, AvatarButtonProps, Button, ButtonProps, CardButton, CardButtonClassKey, CardButtonProps, CheckboxField, CheckboxFieldProps, CheckboxGroupField, CheckboxGroupFieldProps, CollapseBreakpoint, CollapseProp, Color, ColorProp, ColorVariant, Column, ColumnProps, ColumnWidth, Columns, ColumnsProps, DescriptionList, DescriptionListItem, DescriptionListItemProps, DescriptionListProps, DrawerActions, DrawerActionsProps, DrawerContent, DrawerContentProps, DrawerList, DrawerListProps, DrawerTitle, DrawerTitleProps, DropdownButton, ElementVisibility, GridStack, GridStackProps, HorizontalAlign, InfoCard, InfoCardClassKey, InfoCardProps, Inline, InlineGrid, InlineGridProps, InlineProps, NegativeSpaceProp, OverflowText, OverflowTextProps, PartialResponsivePropRecord, RadioField, RadioFieldProps, RadioGroupField, RadioGroupFieldProps, ResponsiveContext, ResponsiveContextProvider, ResponsiveContextProviderProps, ResponsiveProp, ResponsivePropPrimitive, ResponsivePropRecord, ResponsivePropTuple, ResponsivePropTupleInit, Snackbar, SnackbarCloseReason, SnackbarContent, SnackbarContentProps, SnackbarProps, SnackbarStack, SnackbarStackConsumer, SnackbarStackOptions, SnackbarStackProvider, SnackbarStackProviderProps, SnackbarVariant, SpaceProp, Stack, StackProps, SuperDispatchTheme, Tag, TagClassKey, TagProps, ThemeProvider, ThemeProviderProps, Tiles, TilesColumns, TilesProps, TilesSpace, VerticalAlign, VisibilityObserver, VisibilityObserverOptions, VisibilityObserverProps, VisibilityObserverRenderProps, assignRef, isColorProp, isEmptyReactNode, mergeRefs, parseAlignProp, parseCollapsedBelow, parseResponsiveProp, parseSpaceProp, renderChildren, useCollapseBreakpoint, useResizeObserver, useResponsiveContext, useResponsiveProp, useResponsivePropRecord, useResponsiveValue, useSnackbarStack, useUID, useVisibilityObserver };
451
+ export { AdaptiveToolbar, AdaptiveToolbarDropdownItem, AdaptiveToolbarItem, AdaptiveToolbarProps, AdaptiveVerticalToolbar, AdaptiveVerticalToolbarItem, AdaptiveVerticalToolbarProps, AvatarButton, AvatarButtonClassKey, AvatarButtonProps, Button, ButtonProps, CardButton, CardButtonClassKey, CardButtonProps, CheckboxField, CheckboxFieldProps, CheckboxGroupField, CheckboxGroupFieldProps, CollapseBreakpoint, CollapseProp, Color, ColorProp, ColorVariant, Column, ColumnProps, ColumnWidth, Columns, ColumnsProps, DescriptionList, DescriptionListItem, DescriptionListItemProps, DescriptionListProps, DrawerActions, DrawerActionsProps, DrawerContent, DrawerContentProps, DrawerList, DrawerListProps, DrawerTitle, DrawerTitleProps, DropdownButton, ElementVisibility, ExitTransitionPlaceholder, GridStack, GridStackProps, HorizontalAlign, InfoCard, InfoCardClassKey, InfoCardProps, Inline, InlineGrid, InlineGridProps, InlineProps, NegativeSpaceProp, OverflowText, OverflowTextProps, PartialResponsivePropRecord, RadioField, RadioFieldProps, RadioGroupField, RadioGroupFieldProps, ResponsiveContext, ResponsiveContextProvider, ResponsiveContextProviderProps, ResponsiveProp, ResponsivePropPrimitive, ResponsivePropRecord, ResponsivePropTuple, ResponsivePropTupleInit, Snackbar, SnackbarCloseReason, SnackbarContent, SnackbarContentProps, SnackbarProps, SnackbarStack, SnackbarStackConsumer, SnackbarStackOptions, SnackbarStackProvider, SnackbarStackProviderProps, SnackbarVariant, SpaceProp, Stack, StackProps, SuperDispatchTheme, Tag, TagClassKey, TagProps, ThemeProvider, ThemeProviderProps, Tiles, TilesColumns, TilesProps, TilesSpace, VerticalAlign, VisibilityObserver, VisibilityObserverOptions, VisibilityObserverProps, VisibilityObserverRenderProps, assignRef, isColorProp, isEmptyReactNode, mergeRefs, parseAlignProp, parseCollapsedBelow, parseResponsiveProp, parseSpaceProp, renderChildren, useCollapseBreakpoint, useResizeObserver, useResponsiveContext, useResponsiveProp, useResponsivePropRecord, useResponsiveValue, useSnackbarStack, useUID, useVisibilityObserver };
package/dist-web/index.js CHANGED
@@ -3,7 +3,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
3
3
  import { Button as Button$1, CircularProgress, ButtonGroup, Popover, MenuList, Toolbar, Grid, MenuItem, Typography, Menu, Divider, ButtonBase, Avatar, FormControl, FormControlLabel, Checkbox, FormHelperText, FormLabel, FormGroup, useMediaQuery, Tooltip, SvgIcon, AppBar, List, Card, CardContent, Radio, RadioGroup, SnackbarContent as SnackbarContent$1, IconButton, Portal, Snackbar as Snackbar$1, Slide, CssBaseline, createTheme, createGenerateClassName } from '@material-ui/core';
4
4
  import { MoreHoriz, Close, Warning, CheckCircle } from '@material-ui/icons';
5
5
  import { makeStyles, StylesProvider, ThemeProvider as ThemeProvider$1 } from '@material-ui/styles';
6
- import { forwardRef, useState, useRef, useLayoutEffect, cloneElement, useMemo, useContext, createContext, Children, useCallback } from 'react';
6
+ import { forwardRef, useState, useRef, useLayoutEffect, cloneElement, useMemo, useContext, createContext, Children, useCallback, useEffect } from 'react';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import styled, { css, ThemeProvider as ThemeProvider$2 } from 'styled-components';
9
9
  import { ResizeObserver } from '@juggle/resize-observer';
@@ -413,19 +413,17 @@ var AdaptiveVerticalToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
413
413
  onClose: () => {
414
414
  setMenuButtonRef(undefined);
415
415
  },
416
- children: menuItems.map((item, index, arr) => {
416
+ children: menuItems.flatMap((item, index, arr) => {
417
417
  var next = arr[index + 1];
418
- return /*#__PURE__*/jsxs(Fragment, {
419
- children: [/*#__PURE__*/jsx(MenuItem, {
420
- onClick: event => {
421
- var _item$onClick;
422
-
423
- (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
424
- setMenuButtonRef(undefined);
425
- },
426
- children: renderMenuItem(item)
427
- }, item.key), next && next.menuGroupKey !== item.menuGroupKey && /*#__PURE__*/jsx(Divider, {})]
428
- });
418
+ return [/*#__PURE__*/jsx(MenuItem, {
419
+ onClick: event => {
420
+ var _item$onClick;
421
+
422
+ (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
423
+ setMenuButtonRef(undefined);
424
+ },
425
+ children: renderMenuItem(item)
426
+ }, item.key), next && next.menuGroupKey !== item.menuGroupKey && /*#__PURE__*/jsx(Divider, {}, "".concat(item.key, "-divider"))];
429
427
  })
430
428
  })]
431
429
  })]
@@ -3667,5 +3665,19 @@ var Tiles = /*#__PURE__*/forwardRef((_ref, ref) => {
3667
3665
  });
3668
3666
  if (process.env.NODE_ENV !== "production") Tiles.displayName = "Tiles";
3669
3667
 
3670
- export { AdaptiveToolbar, AdaptiveVerticalToolbar, AvatarButton, Button, CardButton, CheckboxField, CheckboxGroupField, Color, Column, Columns, DescriptionList, DescriptionListItem, DrawerActions, DrawerContent, DrawerList, DrawerTitle, DropdownButton, GridStack, InfoCard, Inline, InlineGrid, OverflowText, RadioField, RadioGroupField, ResponsiveContextProvider, Snackbar, SnackbarContent, SnackbarStackConsumer, SnackbarStackProvider, Stack, Tag, ThemeProvider, Tiles, VisibilityObserver, assignRef, isColorProp, isEmptyReactNode, mergeRefs, parseAlignProp, parseCollapsedBelow, parseResponsiveProp, parseSpaceProp, renderChildren, useCollapseBreakpoint, useResizeObserver, useResponsiveContext, useResponsiveProp, useResponsivePropRecord, useResponsiveValue, useSnackbarStack, useUID, useVisibilityObserver };
3668
+ function ExitTransitionPlaceholder(_ref) {
3669
+ var {
3670
+ in: inProp,
3671
+ children: childrenProp
3672
+ } = _ref;
3673
+ var [children, setChildren] = useState(childrenProp);
3674
+ useEffect(() => {
3675
+ if (inProp) {
3676
+ setChildren(childrenProp);
3677
+ }
3678
+ }, [inProp, childrenProp]);
3679
+ return renderChildren(children);
3680
+ }
3681
+
3682
+ export { AdaptiveToolbar, AdaptiveVerticalToolbar, AvatarButton, Button, CardButton, CheckboxField, CheckboxGroupField, Color, Column, Columns, DescriptionList, DescriptionListItem, DrawerActions, DrawerContent, DrawerList, DrawerTitle, DropdownButton, ExitTransitionPlaceholder, GridStack, InfoCard, Inline, InlineGrid, OverflowText, RadioField, RadioGroupField, ResponsiveContextProvider, Snackbar, SnackbarContent, SnackbarStackConsumer, SnackbarStackProvider, Stack, Tag, ThemeProvider, Tiles, VisibilityObserver, assignRef, isColorProp, isEmptyReactNode, mergeRefs, parseAlignProp, parseCollapsedBelow, parseResponsiveProp, parseSpaceProp, renderChildren, useCollapseBreakpoint, useResizeObserver, useResponsiveContext, useResponsiveProp, useResponsivePropRecord, useResponsiveValue, useSnackbarStack, useUID, useVisibilityObserver };
3671
3683
  //# sourceMappingURL=index.js.map