@livechat/design-system-react-components 1.31.0 → 1.32.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.
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ import { INavigationTopBarProps, ITopBarAlertProps, ITopBarTitleProps } from './types';
3
+ /**
4
+ * NavigationTopBar is used to display a top bar in the app frame - mostly to display alerts, but arbitrary content can be placed there too.
5
+ * @example
6
+ * <NavigationTopBar>
7
+ * <NavigationTopBar.Alert kind="error">
8
+ * Something went wrong
9
+ * </NavigationTopBar.Alert>
10
+ * </NavigationTopBar>
11
+ */
12
+ export declare const NavigationTopBar: {
13
+ ({ children, additionalNodes, }: INavigationTopBarProps): React.ReactElement;
14
+ Alert: React.FC<ITopBarAlertProps>;
15
+ Title: React.FC<ITopBarTitleProps>;
16
+ };
17
+ /**
18
+ * Title component for the NavigationTopBar. Supposed to be placed in the `additionalNodes` prop of the NavigationTopBar.
19
+ * @example
20
+ * <NavigationTopBar additionalNodes={<NavigationTopBar.Title>Example top bar content</NavigationTopBar.Title>}>
21
+ * </NavigationTopBar>
22
+ */
23
+ export declare const NavigationTopBarTitle: React.FC<ITopBarTitleProps>;
24
+ /**
25
+ * Alert component for the NavigationTopBar.
26
+ * @example
27
+ * <NavigationTopBar>
28
+ * <NavigationTopBar.Alert kind="error" show={!!error}>
29
+ * Something went wrong
30
+ * </NavigationTopBar.Alert>
31
+ * </NavigationTopBar>
32
+ * @example
33
+ * <NavigationTopBar>
34
+ * <NavigationTopBarAlert
35
+ * kind="warning"
36
+ * primaryCta={{ label: 'Save', onClick: () => console.log('Save clicked') }}
37
+ * secondaryCta={{ label: 'Discard', onClick: () => console.log('Discard clicked') }}
38
+ * closeButton={{ onClick: () => console.log('Close clicked') }}
39
+ * show={!hasUnsavedChanges && !hasClosedAlert}
40
+ * >
41
+ * You have unsaved changes
42
+ * </NavigationTopBarAlert>
43
+ * </NavigationTopBar>
44
+ **/
45
+ export declare const NavigationTopBarAlert: React.FC<ITopBarAlertProps>;
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ export declare const DisconnectedAlert: React.FC<{
3
+ show: boolean;
4
+ onClose: () => void;
5
+ }>;
6
+ export declare const ChameleonAlert: React.FC<{
7
+ show: boolean;
8
+ onClose: () => void;
9
+ kind: 'info' | 'success' | 'warning' | 'error';
10
+ changeKind: () => void;
11
+ }>;
12
+ export declare const CustomBackgroundAlert: React.FC<{
13
+ show: boolean;
14
+ onClose: () => void;
15
+ }>;
@@ -0,0 +1,59 @@
1
+ import * as React from 'react';
2
+ import { ComponentCoreProps } from 'utils/types';
3
+ export type NavigationTopBarKind = 'info' | 'success' | 'warning' | 'error';
4
+ export interface INavigationTopBarProps extends ComponentCoreProps {
5
+ /**
6
+ * Contents of the top bar. You can use the `NavigationTopBar.Alert` component to display alerts.
7
+ */
8
+ children?: React.ReactNode;
9
+ /**
10
+ * Ńodes placed under the children.
11
+ */
12
+ additionalNodes?: React.ReactNode;
13
+ }
14
+ export interface ITopBarTitleProps extends ComponentCoreProps {
15
+ /**
16
+ * Content of the title.
17
+ */
18
+ children: React.ReactNode;
19
+ }
20
+ export interface ITopBarAlertProps extends ComponentCoreProps {
21
+ /**
22
+ * Visual style of the alert. You can also use `className` to style the alert if you need to set a custom background color.
23
+ * Defaults to `info`.
24
+ * */
25
+ kind?: NavigationTopBarKind;
26
+ /**
27
+ * Properties of the close button. If defined, the alert will be closable and the close button will be rendered.
28
+ * aria-label is highly recommended for accessibility.
29
+ * */
30
+ closeButton?: {
31
+ onClick: () => void;
32
+ 'data-testid'?: string;
33
+ 'aria-label'?: string;
34
+ };
35
+ /**
36
+ * Content of the alert.
37
+ */
38
+ children: React.ReactNode;
39
+ /**
40
+ * Primary CTA button. The button will be rendered if defined.
41
+ * Simple on purpose - if you need more complex buttons, you can use the `children` prop.
42
+ * */
43
+ primaryCta?: {
44
+ label: string;
45
+ onClick: () => void;
46
+ };
47
+ /**
48
+ * Secondary CTA button. The button will be rendered if defined.
49
+ * Simple on purpose - if you need more complex buttons, you can use the `children` prop.
50
+ * */
51
+ secondaryCta?: {
52
+ label: string;
53
+ onClick: () => void;
54
+ };
55
+ /**
56
+ * Show or hide the alert, defaults to `true`. Changes to this prop are animated - the alert will enter and leave smoothly.
57
+ * */
58
+ isVisible?: boolean;
59
+ }
@@ -4,4 +4,5 @@ export { SideNavigationItem } from './SideNavigationItem/SideNavigationItem';
4
4
  export { NavigationGroup } from './NavigationGroup/NavigationGroup';
5
5
  export { NavigationItem } from './NavigationItem/NavigationItem';
6
6
  export { Navigation } from './Navigation/Navigation';
7
+ export { NavigationTopBar, NavigationTopBarAlert, NavigationTopBarTitle, } from './NavigationTopBar/NavigationTopBar';
7
8
  export { SIDE_NAVIGATION_ITEM_TEST_ID, SIDE_NAVIGATION_ACTIVE_ITEM_TEST_ID, SIDE_NAVIGATION_PARENT_ICON_TEST_ID, } from './SideNavigationItem/constants';
@@ -1,9 +1,14 @@
1
1
  import * as React from 'react';
2
2
  interface ExampleAppContentProps {
3
3
  showToggle: boolean;
4
+ alerts?: boolean[];
5
+ setAlerts?: (alerts: boolean[]) => void;
4
6
  }
5
7
  export declare const ExampleAppContent: React.FC<ExampleAppContentProps>;
6
- export declare const ExampleTopBar: React.FC;
8
+ export declare const ExampleTopBar: React.FC<{
9
+ visibleAlerts: boolean[];
10
+ setAlerts: (alerts: boolean[]) => void;
11
+ }>;
7
12
  export declare const getBadgeContent: (item: string) => "dot" | "alert" | 5 | undefined;
8
13
  export declare const getChatsMenu: (activeSubItem: number, handler: (o: number) => void) => React.JSX.Element;
9
14
  export declare const getEngageSubMenu: (activeSubItem: number, handler: (o: number) => void) => React.JSX.Element;