@digital-ai/dot-components 2.2.0 → 2.3.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,24 +1,26 @@
1
- import { KeyboardEvent, MouseEvent } from 'react';
1
+ import { MouseEvent } from 'react';
2
+ import { ApplicationModel } from '../core-api/openapi';
2
3
  import { CommonProps } from '../CommonProps';
4
+ interface ActiveAppInfo {
5
+ name: string;
6
+ product?: 'Release' | 'Deploy' | 'Agility' | 'Continuous Testing' | 'Intelligence' | 'Application Protection';
7
+ }
3
8
  interface CommonAppSwitcherProps extends CommonProps {
4
- anchorEl: Element;
5
- onLeave?: (event: KeyboardEvent | MouseEvent) => void;
6
- onSelect?: (event: MouseEvent | KeyboardEvent, menuId: string, itemKey: string) => void;
7
- open: boolean;
8
- platformConsoleUrl?: string;
9
+ activeApp: ActiveAppInfo;
10
+ onClose?: (event: MouseEvent | KeyboardEvent) => void;
11
+ yOffset?: number;
12
+ zIndex?: number;
9
13
  }
10
14
  interface AppSwitcherViewProps extends CommonAppSwitcherProps {
11
- apps: {
12
- id: string;
13
- instance_state?: number;
14
- logo?: string;
15
- name: string;
16
- url: string;
17
- }[];
15
+ apps: Partial<ApplicationModel>[];
16
+ open: boolean;
17
+ platformConsoleUrl?: string;
18
+ selectedAppType: string;
18
19
  }
19
- export declare const DotAppSwitcherView: ({ apps, anchorEl, className, onLeave, onSelect, open, platformConsoleUrl, }: AppSwitcherViewProps) => JSX.Element;
20
+ export declare const DotAppSwitcherView: ({ activeApp, apps, className, platformConsoleUrl, onClose, open, selectedAppType, yOffset, zIndex, }: AppSwitcherViewProps) => JSX.Element;
20
21
  interface AppSwitcherProps extends CommonAppSwitcherProps {
21
22
  accountId?: string;
23
+ includePlatformConsole?: boolean;
22
24
  }
23
- export declare const DotAppSwitcher: ({ accountId, open, ...commonProps }: AppSwitcherProps) => JSX.Element;
25
+ export declare const DotAppSwitcher: ({ accountId, includePlatformConsole, onClose, ...commonProps }: AppSwitcherProps) => JSX.Element;
24
26
  export {};
@@ -1,2 +1,2 @@
1
1
  export declare const rootClassName = "dot-app-switcher";
2
- export declare const StyledAppSwitcher: import("styled-components").StyledComponent<({ anchorEl, ariaLabel, className, "data-testid": dataTestId, dense, disablePortal, id, loading, maxVisibleItems, menuItemHeight, menuItems, menuPlacement, onLeave, onSelect, open, selectedKey, }: import("../menu/Menu").MenuProps) => JSX.Element, any, {}, never>;
2
+ export declare const StyledAppSwitcher: import("styled-components").StyledComponent<({ anchor, ariaLabel, className, children, "data-testid": dataTestId, drawerBodyProps, drawerFooterProps, drawerHeaderProps, height, ModalProps, onClose, open, PaperProps, variant, width, }: import("../drawer/Drawer").DrawerProps) => JSX.Element, any, {}, never>;
@@ -0,0 +1,16 @@
1
+ import { ReactElement } from 'react';
2
+ import { MenuItemProps } from '../../menu/Menu';
3
+ export declare const getLogoForAppType: (appType: string) => string;
4
+ export declare const daiAppsHeaderMenuItem: {
5
+ children: JSX.Element;
6
+ key: string;
7
+ disabled: boolean;
8
+ divider: boolean;
9
+ height: number;
10
+ };
11
+ export declare const createMenuItem: (url: string, title: string, subtitle?: string) => ReactElement;
12
+ export declare const createTopLevelMenuItem: (url: string, logo: string, title: string, openNewTab?: boolean) => ReactElement;
13
+ export declare const createAppTypeLabel: (appTypeName: string, logo: string, appProps: MenuItemProps[]) => JSX.Element;
14
+ export declare const getInstanceStateText: (application: {
15
+ instance_state?: number;
16
+ }) => "Production instance" | "Non-production instance";
@@ -1,4 +1,4 @@
1
- import { ChangeEvent, FocusEvent, HTMLAttributes, ReactNode, Ref } from 'react';
1
+ import { ChangeEvent, FocusEvent, HTMLAttributes, ReactNode, Ref, JSXElementConstructor } from 'react';
2
2
  import { AutocompleteCloseReason, AutocompleteGetTagProps, AutocompleteRenderOptionState } from '@mui/material';
3
3
  import { CommonProps } from '../CommonProps';
4
4
  export declare const DEFAULT_ACTION_ITEM_TEXT = "Add new item";
@@ -24,6 +24,8 @@ export interface AutoCompleteOption {
24
24
  * autocomplete option rendering by using `renderOption` prop.
25
25
  */
26
26
  export interface AutoCompleteProps<T extends AutoCompleteOption = AutoCompleteOption> extends CommonProps {
27
+ /** The component used to render the listbox. **/
28
+ ListboxComponent?: JSXElementConstructor<HTMLAttributes<HTMLElement>>;
27
29
  /** Action button as the last element on the menu **/
28
30
  actionItem?: ActionItem;
29
31
  /** This prop helps users to fill forms faster */
@@ -92,4 +94,4 @@ export interface AutoCompleteProps<T extends AutoCompleteOption = AutoCompleteOp
92
94
  /** If true, the label will be displayed in a warning state. */
93
95
  warning?: boolean;
94
96
  }
95
- export declare const DotAutoComplete: <T extends AutoCompleteOption>({ actionItem, ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, dense, disabled, disablePortal, endAdornmentTooltip, error, filterSelectedOptions, freesolo, group, helperText, inputId, inputRef, label, loading, maxHeight, multiple, onBlur, onChange, onClose, onInputChange, onOpen, open, options, persistentLabel, placeholder, readOnly, renderOption, renderTags, required, size, value, warning, }: AutoCompleteProps<T>) => JSX.Element;
97
+ export declare const DotAutoComplete: <T extends AutoCompleteOption>({ ListboxComponent, actionItem, ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, dense, disabled, disablePortal, endAdornmentTooltip, error, filterSelectedOptions, freesolo, group, helperText, inputId, inputRef, label, loading, maxHeight, multiple, onBlur, onChange, onClose, onInputChange, onOpen, open, options, persistentLabel, placeholder, readOnly, renderOption, renderTags, required, size, value, warning, }: AutoCompleteProps<T>) => JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { CommonProps } from '../CommonProps';
2
+ export interface CopyButtonProps extends CommonProps {
3
+ copiedTooltip?: string;
4
+ copyTooltip?: string;
5
+ value: string;
6
+ }
7
+ export declare const DotCopyButton: ({ ariaLabel, copiedTooltip, copyTooltip, "data-testid": dataTestId, value, }: CopyButtonProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ export declare const rootClassName = "dot-copy-button";
2
+ export declare const StyledCopyButton: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,4 +1,6 @@
1
1
  export type { ButtonProps } from './Button';
2
+ export type { CopyButtonProps } from './CopyButton';
2
3
  export type { IconButtonProps, IconButtonColor, IconButtonSize, } from './IconButton';
3
4
  export { DotButton } from './Button';
5
+ export { DotCopyButton } from './CopyButton';
4
6
  export { DotIconButton } from './IconButton';
@@ -5,11 +5,17 @@ interface CoreApiProviderProps {
5
5
  children: ReactNode;
6
6
  token?: string;
7
7
  }
8
+ declare type booleanSetter = (b: boolean) => boolean;
8
9
  interface DotCoreApiContextProps {
9
10
  applications: ApplicationModel[];
10
11
  applicationsError: ApiError;
11
12
  applicationsLoading: boolean;
13
+ isAppSwitcherOpen: boolean;
12
14
  loadApplications: (accountId: string, force?: boolean) => void;
15
+ platformConsoleUrl: string;
16
+ selectedAppSwitcherAppType: string;
17
+ setIsAppSwitcherOpen: (open: boolean | booleanSetter) => void;
18
+ setSelectedAppSwitcherAppType: (appType: string) => void;
13
19
  setToken: (token: string) => void;
14
20
  }
15
21
  export declare const DotCoreApiProvider: ({ apiUrl, token, children, }: CoreApiProviderProps) => JSX.Element;
@@ -2,7 +2,7 @@ export type { AppToolbarProps } from './app-toolbar/AppToolbar';
2
2
  export type { AutoCompleteOption, AutoCompleteProps, AutoCompleteValue, AutocompleteRenderOptionState, } from './auto-complete';
3
3
  export type { AvatarProps } from './avatar/Avatar';
4
4
  export type { BreadcrumbItem } from './breadcrumbs/Breadcrumbs';
5
- export type { ButtonProps, IconButtonProps, IconButtonColor, IconButtonSize, } from './button';
5
+ export type { ButtonProps, CopyButtonProps, IconButtonProps, IconButtonColor, IconButtonSize, } from './button';
6
6
  export type { ButtonToggleProps, ButtonToggleValue, ButtonToggleOption, ButtonToggleOrientation, ButtonToggleSingleValue, ButtonToggleSize, } from './button-toggle';
7
7
  export type { CheckboxProps } from './checkbox/Checkbox';
8
8
  export type { CheckboxGroupProps } from './checkbox/CheckboxGroup';
@@ -44,7 +44,7 @@ export { DotAvatar } from './avatar/Avatar';
44
44
  export { DotAvatarGroup } from './avatar-group/AvatarGroup';
45
45
  export { DotBadge } from './badge';
46
46
  export { DotBreadcrumbs } from './breadcrumbs/Breadcrumbs';
47
- export { DotButton, DotIconButton } from './button';
47
+ export { DotButton, DotCopyButton, DotIconButton } from './button';
48
48
  export { DotButtonToggle } from './button-toggle';
49
49
  export { DotCard } from './card/Card';
50
50
  export { DotCardContent } from './card/CardContent';
@@ -1,2 +1,3 @@
1
1
  import { ReactNode } from 'react';
2
2
  export declare const getTruncatedLabel: (label: string, charactersLimit?: number) => ReactNode;
3
+ export declare const getTooltipLabel: (label: string, charactersLimit?: number) => ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^17.0.2 || ^18.0.0",
37
- "react-dom": "^17.0.2",
38
- "react-router-dom": "6.4.4"
37
+ "react-router-dom": "6.4.4",
38
+ "jwt-decode": "^3.1.2"
39
39
  }
40
40
  }