@superdispatch/ui-lab 0.18.0 → 0.20.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.
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { ReactNode, ForwardRefExoticComponent, RefAttributes, Ref, AriaAttributes, MouseEventHandler, FocusEventHandler, HTMLAttributes, ComponentType, ReactElement, MouseEvent, Key, CSSProperties, ReactChild } from 'react';
2
+ import { ReactNode, ForwardRefExoticComponent, RefAttributes, Ref, AriaAttributes, MouseEventHandler, FocusEventHandler, HTMLAttributes, AnchorHTMLAttributes, FunctionComponent, ReactElement, ComponentType, MouseEvent, Key, CSSProperties, ReactChild } from 'react';
3
3
  import { CSSTransition } from 'react-transition-group';
4
4
  import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
5
5
  import { SpaceProp, NegativeSpaceProp, ResponsiveProp, ColorProp } from '@superdispatch/ui';
6
6
  import { Property } from 'csstype';
7
- import { ButtonBaseProps, AvatarProps, TooltipProps } from '@material-ui/core';
7
+ import { ButtonBaseProps, AvatarProps, IconButtonProps, TooltipProps } from '@material-ui/core';
8
8
  import { FileRejection } from 'react-dropzone';
9
9
  import { StyledComponent, DefaultTheme } from 'styled-components';
10
10
 
@@ -163,6 +163,21 @@ interface FileListItemProps {
163
163
  }
164
164
  declare const FileListItem: ForwardRefExoticComponent<FileListItemProps & RefAttributes<HTMLDivElement>>;
165
165
 
166
+ declare type LinkComponentProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {
167
+ href: string;
168
+ truncate?: number;
169
+ };
170
+ interface LinkedTextProps extends Omit<LinkComponentProps, 'ref' | 'href'> {
171
+ children?: null | string;
172
+ linkComponent?: FunctionComponent<LinkComponentProps>;
173
+ }
174
+ declare function LinkedText({ children, linkComponent, ...props }: LinkedTextProps): ReactElement | null;
175
+
176
+ interface MultilineTextProps {
177
+ overflowWrap?: Extract<Property.OverflowWrap, 'anywhere' | 'break-word' | 'normal'>;
178
+ }
179
+ declare const MultilineText: StyledComponent<"span", DefaultTheme, MultilineTextProps, never>;
180
+
166
181
  interface NavbarBottomBarItem {
167
182
  active?: boolean;
168
183
  value: string;
@@ -178,6 +193,14 @@ interface NavbarBottomBarProps {
178
193
  }
179
194
  declare function NavbarBottomBar({ items, hasMenuBadge, }: NavbarBottomBarProps): ReactElement;
180
195
 
196
+ interface NavbarAccordionProps {
197
+ label: ReactNode;
198
+ icon?: ReactNode;
199
+ gutter?: boolean;
200
+ items: NavbarItemOptions[];
201
+ onClick: (event: MouseEvent<HTMLDivElement>) => void;
202
+ }
203
+
181
204
  declare const NavbarBadge: StyledComponent<"span", DefaultTheme, {}, never>;
182
205
  declare const NavbarLabel: StyledComponent<"span", DefaultTheme, {}, never>;
183
206
  interface NavbarItemProps {
@@ -189,8 +212,9 @@ interface NavbarItemProps {
189
212
  ident?: number;
190
213
  gutter?: boolean;
191
214
  variant?: 'danger' | 'primary';
215
+ active?: boolean;
192
216
  }
193
- declare function NavbarItem({ label, gutter, badge, icon, component, onClick, variant, ident, }: NavbarItemProps): ReactElement;
217
+ declare function NavbarItem({ label, gutter, badge, icon, component, onClick, variant, ident, active, }: NavbarItemProps): ReactElement;
194
218
 
195
219
  interface NavbarMenuItemProps {
196
220
  icon?: ReactNode;
@@ -199,6 +223,11 @@ interface NavbarMenuItemProps {
199
223
  component?: ComponentType<HTMLAttributes<HTMLElement>>;
200
224
  }
201
225
  declare function NavbarMenuItem({ label, icon, onClick, component, }: NavbarMenuItemProps): ReactElement;
226
+ interface NavbarAccordionOptions extends NavbarAccordionProps {
227
+ key: Key;
228
+ groupKey?: Key;
229
+ hide?: boolean;
230
+ }
202
231
  interface NavbarItemOptions extends NavbarItemProps {
203
232
  key: Key;
204
233
  groupKey?: Key;
@@ -206,7 +235,7 @@ interface NavbarItemOptions extends NavbarItemProps {
206
235
  }
207
236
  interface NavbarListProps {
208
237
  header: ReactNode;
209
- items: NavbarItemOptions[];
238
+ items: Array<NavbarItemOptions | NavbarAccordionOptions>;
210
239
  footer?: ReactNode;
211
240
  }
212
241
  declare function NavbarList({ header, items, footer, }: NavbarListProps): ReactElement;
@@ -260,12 +289,30 @@ interface SidebarProps {
260
289
  }
261
290
  declare const Sidebar: ForwardRefExoticComponent<SidebarProps & RefAttributes<HTMLDivElement>>;
262
291
 
292
+ declare function SidebarBackButton({ onClick, children, ...props }: IconButtonProps): ReactElement | null;
293
+
294
+ interface SidebarContext {
295
+ openSidebar: () => void;
296
+ openSidebarContent: () => void;
297
+ }
298
+ declare function useSidebarContext(): SidebarContext;
263
299
  interface SidebarContainerProps {
264
300
  sidebar: ReactChild;
265
301
  children?: ReactNode;
266
302
  }
267
303
  declare const SidebarContainer: ForwardRefExoticComponent<SidebarContainerProps & RefAttributes<HTMLDivElement>>;
268
304
 
305
+ interface SidebarContentProps {
306
+ dense?: boolean;
307
+ title: ReactNode;
308
+ children: ReactNode;
309
+ action?: ReactNode;
310
+ openOnMount?: boolean;
311
+ closeOnUnmount?: boolean;
312
+ onBack?: (event: MouseEvent<HTMLButtonElement>) => void;
313
+ }
314
+ declare function SidebarContent({ dense, action, title, children, onBack, openOnMount, closeOnUnmount, }: SidebarContentProps): ReactElement;
315
+
269
316
 
270
317
  declare const SidebarDivider: ForwardRefExoticComponent<RefAttributes<HTMLDivElement>>;
271
318
 
@@ -278,6 +325,7 @@ interface SidebarMenuItemProps {
278
325
  action?: ReactNode;
279
326
  avatar?: ReactNode;
280
327
  children?: ReactNode;
328
+ openContentOnClick?: boolean;
281
329
  secondaryActions?: ReactNode;
282
330
  }
283
331
  declare const SidebarMenuItem: ForwardRefExoticComponent<SidebarMenuItemProps & RefAttributes<HTMLDivElement>>;
@@ -322,4 +370,4 @@ interface TextBoxProps {
322
370
  }
323
371
  declare const TextBox: ForwardRefExoticComponent<TextBoxProps & RefAttributes<HTMLElement>>;
324
372
 
325
- export { Alert, AlertProps, AlertSeverityProp, AnchorButton, AnchorButtonProps, Banner, BorderRadiusProp, BorderWidthProp, Box, BoxProps, Button, ButtonArea, ButtonAreaProps, ButtonProps, ButtonSizeProp, ButtonVariantProp, Container, ContainerProps, DescriptionItem, DescriptionItemProps, FileDropZone, FileDropZoneProps, FileListItem, FileListItemProps, MarginProp, Navbar, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarBottomBarItem, NavbarItem, NavbarItemOptions, NavbarItemProps, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, NavbarMenuItemOption, Sidebar, SidebarContainer, SidebarContainerProps, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemActionProps, SidebarMenuItemAvatar, SidebarMenuItemAvatarProps, SidebarMenuItemProps, SidebarProps, SidebarSubheader, SidebarSubheaderProps, TextAlignProp, TextBox, TextBoxProps, TextColorProp, TextDisplayProp, TextVariantProp, formatBytes, toBytes, useNavbarContext };
373
+ export { Alert, AlertProps, AlertSeverityProp, AnchorButton, AnchorButtonProps, Banner, BorderRadiusProp, BorderWidthProp, Box, BoxProps, Button, ButtonArea, ButtonAreaProps, ButtonProps, ButtonSizeProp, ButtonVariantProp, Container, ContainerProps, DescriptionItem, DescriptionItemProps, FileDropZone, FileDropZoneProps, FileListItem, FileListItemProps, LinkComponentProps, LinkedText, LinkedTextProps, MarginProp, MultilineText, MultilineTextProps, Navbar, NavbarAccordionOptions, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarBottomBarItem, NavbarItem, NavbarItemOptions, NavbarItemProps, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, NavbarMenuItemOption, Sidebar, SidebarBackButton, SidebarContainer, SidebarContainerProps, SidebarContent, SidebarContentProps, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemActionProps, SidebarMenuItemAvatar, SidebarMenuItemAvatarProps, SidebarMenuItemProps, SidebarProps, SidebarSubheader, SidebarSubheaderProps, TextAlignProp, TextBox, TextBoxProps, TextColorProp, TextDisplayProp, TextVariantProp, formatBytes, toBytes, useNavbarContext, useSidebarContext };