@livechat/design-system-react-components 2.0.0-alpha.6 → 2.0.0-alpha.8

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.
Files changed (34) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +3 -0
  2. package/dist/components/Accordion/components/AccordionAnimatedLabel.d.ts +3 -0
  3. package/dist/components/Accordion/components/AccordionMultilineElement.d.ts +6 -0
  4. package/dist/components/Accordion/helpers.d.ts +10 -0
  5. package/dist/components/Accordion/index.d.ts +1 -0
  6. package/dist/components/Accordion/stories-helpers.d.ts +4 -0
  7. package/dist/components/Accordion/types.d.ts +45 -0
  8. package/dist/components/AppFrame/components/MobileNavigation/MobileNavigation.d.ts +3 -0
  9. package/dist/components/AppFrame/components/MobileNavigation/types.d.ts +8 -0
  10. package/dist/components/AppFrame/components/index.d.ts +1 -0
  11. package/dist/components/AppFrame/types.d.ts +9 -0
  12. package/dist/components/AutoComplete/AutoComplete.d.ts +13 -0
  13. package/dist/components/AutoComplete/helpers.d.ts +7 -0
  14. package/dist/components/AutoComplete/index.d.ts +5 -0
  15. package/dist/components/AutoComplete/types.d.ts +27 -0
  16. package/dist/components/Button/Button.d.ts +1 -1
  17. package/dist/components/Link/Link.d.ts +1 -1
  18. package/dist/components/Picker/components/PickerList.d.ts +4 -0
  19. package/dist/components/Picker/components/PickerTriggerBody.d.ts +1 -0
  20. package/dist/components/Picker/types.d.ts +7 -3
  21. package/dist/hooks/helpers.d.ts +3 -0
  22. package/dist/hooks/index.d.ts +3 -0
  23. package/dist/hooks/types.d.ts +13 -0
  24. package/dist/{components/AppFrame/hooks/useAppFrameAnimations.d.ts → hooks/useAnimations.d.ts} +3 -3
  25. package/dist/hooks/useHeightResizer.d.ts +3 -0
  26. package/dist/hooks/useMobileViewDetector.d.ts +3 -0
  27. package/dist/hooks/useSharedResizeObserver.d.ts +6 -0
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.js +5147 -4683
  31. package/dist/providers/AppFrameProvider.d.ts +3 -0
  32. package/dist/providers/ThemeProvider.d.ts +1 -0
  33. package/dist/style.css +1 -1
  34. package/package.json +3 -3
@@ -0,0 +1,3 @@
1
+ import { IAccordionProps } from './types';
2
+ import * as React from 'react';
3
+ export declare const Accordion: React.FC<IAccordionProps>;
@@ -0,0 +1,3 @@
1
+ import { IAccordionAnimatedLabelProps } from '../types';
2
+ import * as React from 'react';
3
+ export declare const AccordionAnimatedLabel: React.FC<IAccordionAnimatedLabelProps>;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ export interface IAccordionMultilineElementProps {
3
+ children: React.ReactNode;
4
+ isExpanded: boolean;
5
+ }
6
+ export declare const AccordionMultilineElement: React.FC<IAccordionMultilineElementProps>;
@@ -0,0 +1,10 @@
1
+ import { AccordionLabel } from './types';
2
+ import * as React from 'react';
3
+ export declare const isLabelObject: (label: React.ReactNode | {
4
+ open: React.ReactNode;
5
+ closed: React.ReactNode;
6
+ }) => label is {
7
+ open: React.ReactNode;
8
+ closed: React.ReactNode;
9
+ };
10
+ export declare const getLabel: (label: AccordionLabel, currentlyOpen: boolean) => React.ReactNode;
@@ -0,0 +1 @@
1
+ export { Accordion } from './Accordion';
@@ -0,0 +1,4 @@
1
+ import { IPickerListItem } from '../Picker';
2
+
3
+ export declare const RULE_PICKER_OPTIONS: IPickerListItem[];
4
+ export declare const TAGS_PICKER_OPTIONS: IPickerListItem[];
@@ -0,0 +1,45 @@
1
+ import { ComponentCoreProps } from '../../utils/types';
2
+ import * as React from 'react';
3
+ export type AccordionLabel = React.ReactNode | {
4
+ open: React.ReactNode;
5
+ closed: React.ReactNode;
6
+ };
7
+ export interface IAccordionProps extends ComponentCoreProps {
8
+ /**
9
+ * Specify the content of the accordion
10
+ */
11
+ children: React.ReactNode;
12
+ /**
13
+ * Specify the label of the accordion, single element or different for open and closed state
14
+ */
15
+ label: AccordionLabel;
16
+ /**
17
+ * Specify the multiline element, which will be displayed under the label
18
+ */
19
+ multilineElement?: React.ReactNode;
20
+ /**
21
+ * Specify the kind of the accordion
22
+ */
23
+ kind?: 'default' | 'warning' | 'error';
24
+ /**
25
+ * Specify if the accordion should be open on init
26
+ */
27
+ openOnInit?: boolean;
28
+ /**
29
+ * Set to control accordion state
30
+ */
31
+ isOpen?: boolean;
32
+ /**
33
+ * Optional handler called on accordion close
34
+ */
35
+ onClose?: () => void;
36
+ /**
37
+ * Optional handler called on accordion open
38
+ */
39
+ onOpen?: () => void;
40
+ }
41
+ export interface IAccordionAnimatedLabelProps {
42
+ open: React.ReactNode;
43
+ closed: React.ReactNode;
44
+ isOpen: boolean;
45
+ }
@@ -0,0 +1,3 @@
1
+ import { IMobileNavigationProps } from './types';
2
+ import * as React from 'react';
3
+ export declare const MobileNavigation: React.FC<IMobileNavigationProps>;
@@ -0,0 +1,8 @@
1
+ import { ComponentCoreProps } from '../../../../utils/types';
2
+ import * as React from 'react';
3
+ export interface IMobileNavigationProps extends ComponentCoreProps {
4
+ /**
5
+ * It will display your navigation elements
6
+ */
7
+ children: React.ReactNode;
8
+ }
@@ -7,3 +7,4 @@ export { Navigation } from './Navigation/Navigation';
7
7
  export { NavigationTopBar, NavigationTopBarAlert, NavigationTopBarTitle, } from './NavigationTopBar/NavigationTopBar';
8
8
  export { SIDE_NAVIGATION_ITEM_TEST_ID, SIDE_NAVIGATION_ACTIVE_ITEM_TEST_ID, SIDE_NAVIGATION_PARENT_ICON_TEST_ID, } from './SideNavigationItem/constants';
9
9
  export { ExpirationCounter } from './ExpirationCounter/ExpirationCounter';
10
+ export { MobileNavigation } from './MobileNavigation/MobileNavigation';
@@ -9,6 +9,10 @@ export interface IAppFrameProps extends ComponentCoreProps {
9
9
  * It will display navigation elements
10
10
  */
11
11
  navigation: React.ReactNode;
12
+ /**
13
+ * It will display mobile navigation elements
14
+ */
15
+ mobileNavigation: React.ReactNode;
12
16
  /**
13
17
  * It will display the side navigation bar
14
18
  */
@@ -29,6 +33,11 @@ export interface IAppFrameProps extends ComponentCoreProps {
29
33
  * The CSS class for the content container
30
34
  */
31
35
  contentClassName?: string;
36
+ /**
37
+ * The value that will determine on which resolution mobile view will be displayed
38
+ * @default 705
39
+ */
40
+ mobileViewBreakpoint?: number;
32
41
  }
33
42
  export type { INavigationProps } from './components/Navigation/types';
34
43
  export type { INavigationGroupProps } from './components/NavigationGroup/types';
@@ -0,0 +1,13 @@
1
+ import { AutoCompleteProps } from './types';
2
+ import * as React from 'react';
3
+ /**
4
+ * Text input with autocomplete functionality. The autocomplete list is displayed below the input and is accessible via the keyboard
5
+ * and mouse. The list is filtered based on the input value.
6
+ *
7
+ * @example
8
+ * <AutoComplete
9
+ * options={['Paul', 'Adam', 'John']}
10
+ * placeholder="Type a name"
11
+ * />
12
+ */
13
+ export declare const AutoComplete: React.ForwardRefExoticComponent<AutoCompleteProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,7 @@
1
+ import { IPickerListItem } from '../Picker';
2
+ import { AutoCompleteProps, IAutoCompleteListItem } from './types';
3
+
4
+ export declare const areAllOptionsStrings: (options: AutoCompleteProps['options']) => options is string[];
5
+ export declare const buildOptionsFromStrings: (options: string[]) => IPickerListItem[];
6
+ export declare const buildOptionsFromAutoCompleteListItems: (options: IAutoCompleteListItem[]) => IPickerListItem[];
7
+ export declare const getFilteredPickerItems: (items: IPickerListItem[], single: boolean, hideIfExactMatch: boolean, inputValue: string) => IPickerListItem[];
@@ -0,0 +1,5 @@
1
+ import { AutoComplete } from './AutoComplete';
2
+ import { AutoCompleteProps } from './types';
3
+
4
+ export { AutoComplete };
5
+ export type { AutoCompleteProps };
@@ -0,0 +1,27 @@
1
+ import { Placement, Strategy } from '@floating-ui/react';
2
+ import { InputProps } from '../Input';
3
+ import { IPickerListItem } from '../Picker';
4
+ import * as React from 'react';
5
+ export type IAutoCompleteListItem = Omit<IPickerListItem, 'key' | 'customElement'> & {
6
+ customElement?: React.ReactElement;
7
+ };
8
+ export interface AutoCompleteProps extends Omit<InputProps, 'type'> {
9
+ /** Options that will be displayed in the picker. If they are strings, they will be converted to `IPickerListItem[]`*/
10
+ options?: string[] | IAutoCompleteListItem[];
11
+ /** If true, disables filtering of the options. Useful for getting options from an external source.*/
12
+ alwaysShowAllOptions?: boolean;
13
+ /** If true, the autocomplete list will be open when the component mounts.*/
14
+ autocompleteOpenOnInit?: boolean;
15
+ /** Minimum height of the list */
16
+ minListHeight?: number;
17
+ /** Maximum height of the list */
18
+ maxListHeight?: number;
19
+ /** Placement of the list */
20
+ placement?: Placement;
21
+ /** Floating strategy */
22
+ floatingStrategy?: Strategy;
23
+ /** Type of the input. If true, only shows one matching item. */
24
+ single?: boolean;
25
+ /** If true, the option list will be hidden if there is only one option and it is an exact match to the input value. */
26
+ hideIfExactMatch?: boolean;
27
+ }
@@ -58,5 +58,5 @@ export declare const Button: React.ForwardRefExoticComponent<{
58
58
  /**
59
59
  * Specify the place to render element given in `icon` prop
60
60
  */
61
- iconPosition?: "right" | "left" | undefined;
61
+ iconPosition?: "left" | "right" | undefined;
62
62
  } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLButtonElement & HTMLAnchorElement>>;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
3
- bold: boolean;
3
+ bold?: boolean;
4
4
  }
5
5
  /**
6
6
  * Simple component which renders an `<a>` element.
@@ -12,11 +12,15 @@ export interface IPickerListProps {
12
12
  listElementsRef: React.MutableRefObject<(HTMLElement | null)[]>;
13
13
  activeIndex: number | null;
14
14
  selectedKeys: string[];
15
+ isPositioned: boolean;
16
+ searchDisabled: boolean;
17
+ onItemRemove: (key: string) => void;
15
18
  setPointer: (pointer: boolean) => void;
16
19
  onSelect: (key: string) => void;
17
20
  getFloatingProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
18
21
  getItemProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
19
22
  emptyStateText?: string;
23
+ hideWhenEmpty?: boolean;
20
24
  listClassName?: string;
21
25
  virtuosoProps?: VirtuosoProps<IPickerListItem, unknown>;
22
26
  }
@@ -18,5 +18,6 @@ export interface ITriggerBodyProps {
18
18
  virtualItemRef: React.MutableRefObject<HTMLElement | null>;
19
19
  isTriggerFocused: boolean;
20
20
  inputRef?: React.RefObject<HTMLInputElement>;
21
+ inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
21
22
  }
22
23
  export declare const PickerTriggerBody: React.FC<ITriggerBodyProps>;
@@ -1,4 +1,4 @@
1
- import { ReactElement } from 'react';
1
+ import { InputHTMLAttributes, ReactElement } from 'react';
2
2
  import { Placement, Strategy, UseClickProps, UseDismissProps } from '@floating-ui/react';
3
3
  import { VirtuosoProps } from 'react-virtuoso';
4
4
  import { Size } from '../../utils';
@@ -9,8 +9,8 @@ export interface IPickerListItem {
9
9
  key: string;
10
10
  name: string;
11
11
  customElement?: {
12
- listItemBody: ReactElement;
13
- selectedItemBody: ReactElement;
12
+ listItemBody?: ReactElement;
13
+ selectedItemBody?: ReactElement;
14
14
  };
15
15
  groupHeader?: boolean;
16
16
  disabled?: boolean;
@@ -136,4 +136,8 @@ export interface IPickerProps extends ComponentCoreProps {
136
136
  * https://virtuoso.dev/virtuoso-api-reference/
137
137
  */
138
138
  virtuosoProps?: VirtuosoProps<IPickerListItem, unknown>;
139
+ /**
140
+ * Additional props for the input element
141
+ */
142
+ inputProps?: InputHTMLAttributes<HTMLInputElement> | Record<string, unknown>;
139
143
  }
@@ -0,0 +1,3 @@
1
+ import { NODE } from './types';
2
+
3
+ export declare const resizeCallback: (node: NODE, handler: (newSize: DOMRectReadOnly) => void) => void;
@@ -0,0 +1,3 @@
1
+ export { useAnimations } from './useAnimations';
2
+ export { useHeightResizer } from './useHeightResizer';
3
+ export { useMobileViewDetector } from './useMobileViewDetector';
@@ -0,0 +1,13 @@
1
+ export type NODE = HTMLDivElement | null;
2
+ export type CALLBACK = (newSize: DOMRectReadOnly) => void;
3
+ export interface IUseHeightResizer {
4
+ size: number;
5
+ handleResizeRef: (node: NODE) => void;
6
+ }
7
+ export interface IUseMobileViewDetectorProps {
8
+ mobileBreakpoint: number;
9
+ }
10
+ export interface IUseMobileViewDetector {
11
+ isMobile: boolean;
12
+ handleResizeRef: (node: NODE) => void;
13
+ }
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react';
2
- interface UseAppFrameAnimationsProps {
2
+ interface UseAnimationsProps {
3
3
  isVisible: boolean;
4
4
  elementRef: React.RefObject<HTMLDivElement>;
5
5
  }
6
- interface IUseAppFrameAnimations {
6
+ interface IUseAnimations {
7
7
  isOpen: boolean;
8
8
  isMounted: boolean;
9
9
  setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
10
10
  }
11
- export declare const useAppFrameAnimations: ({ isVisible, elementRef, }: UseAppFrameAnimationsProps) => IUseAppFrameAnimations;
11
+ export declare const useAnimations: ({ isVisible, elementRef, }: UseAnimationsProps) => IUseAnimations;
12
12
  export {};
@@ -0,0 +1,3 @@
1
+ import { IUseHeightResizer } from './types';
2
+
3
+ export declare const useHeightResizer: () => IUseHeightResizer;
@@ -0,0 +1,3 @@
1
+ import { IUseMobileViewDetector, IUseMobileViewDetectorProps } from './types';
2
+
3
+ export declare const useMobileViewDetector: ({ mobileBreakpoint, }: IUseMobileViewDetectorProps) => IUseMobileViewDetector;
@@ -0,0 +1,6 @@
1
+ import { CALLBACK, NODE } from './types';
2
+
3
+ export declare const useSharedResizeObserver: {
4
+ observe: (node: NODE, callback: CALLBACK) => void;
5
+ unobserve: (node: NODE) => void;
6
+ };