@digital-ai/dot-components 3.17.0 → 3.18.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.
package/index.esm.js CHANGED
@@ -3933,6 +3933,38 @@ const styledListItemElement = elementType => {
3933
3933
  .dot-icon i:before {
3934
3934
  color: ${theme.palette.figma.icon.black};
3935
3935
  }
3936
+
3937
+ .left-border-with-arrow {
3938
+ position: absolute;
3939
+ left: 0;
3940
+ top: 0;
3941
+ bottom: 0;
3942
+ display: flex;
3943
+ flex-direction: row;
3944
+ align-items: center;
3945
+ padding: 3px 0;
3946
+ gap: 0;
3947
+
3948
+ .left-border,
3949
+ .left-arrow {
3950
+ width: 3px;
3951
+ background-color: ${({
3952
+ leftBorderAndArrow: color
3953
+ }) => {
3954
+ return color && theme.palette.avatarColors[color] ? theme.palette.avatarColors[color].backgroundColor : theme.palette.figma.typography.disabled; // grey
3955
+ }};
3956
+ }
3957
+
3958
+ .left-border {
3959
+ height: 100%;
3960
+ border-radius: ${theme.spacing(0, 0.5, 0.5, 0)};
3961
+ }
3962
+
3963
+ .left-arrow {
3964
+ height: 6px;
3965
+ clip-path: polygon(0 0, 0 100%, 100% 50%);
3966
+ }
3967
+ }
3936
3968
  }
3937
3969
  `}
3938
3970
  `;
@@ -4059,6 +4091,7 @@ const DotListItem = ({
4059
4091
  onHrefClick,
4060
4092
  onMenuLeave,
4061
4093
  items = [],
4094
+ leftBorderAndArrow,
4062
4095
  menuPlacement,
4063
4096
  nestedDrawerLeftSpacing,
4064
4097
  nestedListType,
@@ -4125,7 +4158,7 @@ const DotListItem = ({
4125
4158
  });
4126
4159
  const ListItem = onClick || href ? StyledListItemButton : StyledListItem;
4127
4160
  return jsxs(Fragment, {
4128
- children: [jsx(ListItem, {
4161
+ children: [jsxs(ListItem, {
4129
4162
  "aria-label": ariaLabel || tooltip,
4130
4163
  autoFocus: autoFocus,
4131
4164
  classes: {
@@ -4136,13 +4169,21 @@ const DotListItem = ({
4136
4169
  "data-testid": dataTestId,
4137
4170
  divider: divider,
4138
4171
  href: onClick ? null : href,
4172
+ leftBorderAndArrow: leftBorderAndArrow,
4139
4173
  onClick: !isLink ? handleClick : null,
4140
4174
  onKeyDown: onKeyDown,
4141
4175
  role: ariaRole,
4142
4176
  selected: isFlyout ? false : selected,
4143
4177
  tabIndex: isLink ? -1 : 0,
4144
4178
  target: target,
4145
- children: jsx(DotTooltip, {
4179
+ children: [leftBorderAndArrow && jsxs("div", {
4180
+ className: "left-border-with-arrow",
4181
+ children: [jsx("div", {
4182
+ className: "left-border"
4183
+ }), jsx("div", {
4184
+ className: "left-arrow"
4185
+ })]
4186
+ }), jsx(DotTooltip, {
4146
4187
  "data-testid": `${dataTestId}-tooltip`,
4147
4188
  placement: tooltipPlacement,
4148
4189
  title: tooltip,
@@ -4151,7 +4192,7 @@ const DotListItem = ({
4151
4192
  children: startIcon
4152
4193
  }), renderListItemText(), showEndIcon && renderListItemEndIcon()]
4153
4194
  })
4154
- })
4195
+ })]
4155
4196
  }), hasChildren && jsx(NestedList, {
4156
4197
  anchorEl: anchorEl,
4157
4198
  ariaLabel: "nested list",
@@ -4280,7 +4321,8 @@ const DotList = ({
4280
4321
  target: item.target,
4281
4322
  text: item.text,
4282
4323
  tooltip: item.tooltip,
4283
- tooltipPlacement: item.tooltipPlacement || DEFAULT_TOOLTIP_PLACEMENT
4324
+ tooltipPlacement: item.tooltipPlacement || DEFAULT_TOOLTIP_PLACEMENT,
4325
+ leftBorderAndArrow: item.leftBorderAndArrow
4284
4326
  }, item.id || item.text);
4285
4327
  }), children]
4286
4328
  });
@@ -9715,7 +9757,9 @@ const DotMetadataApiProvider = ({
9715
9757
  setAccountIdHeader(accountId);
9716
9758
  return cancelablePromise(DashboardsService.deleteDashboardsService(dashboardId)).then(() => {
9717
9759
  setDashboardsError(null);
9718
- setDashboards(dashboards.filter(dashboard => dashboard.id !== dashboardId));
9760
+ if (dashboards) {
9761
+ setDashboards(dashboards.filter(dashboard => dashboard.id !== dashboardId));
9762
+ }
9719
9763
  return true;
9720
9764
  }).catch(error => {
9721
9765
  setDashboardsError(error);
@@ -10892,7 +10936,7 @@ function HighImpact({
10892
10936
  const defaultMessage = useMemo(() => jsxs(DotTypography, {
10893
10937
  className: "high-impact-default-content",
10894
10938
  variant: "body1",
10895
- children: ["This action cannot be undone. This will permanently", ' ', action.toUpperCase(), objectType && ' the ', jsx("span", {
10939
+ children: ["This action cannot be undone. This will permanently", ' ', action.toUpperCase(), objectType ? ' the ' : ' ', jsx("span", {
10896
10940
  className: "item-name",
10897
10941
  children: record
10898
10942
  }), objectType && ` ${objectType}`, ". Some data may be lost."]
@@ -11457,6 +11501,7 @@ const StyledDotMenu = styled(DotMenu)`
11457
11501
  function DotDashboardOptionsMenu({
11458
11502
  dashboard,
11459
11503
  isEdit = false,
11504
+ menuPlacement,
11460
11505
  onStartDelete,
11461
11506
  onStartDuplicate,
11462
11507
  onStartStatusChange,
@@ -11577,6 +11622,16 @@ function DotDashboardOptionsMenu({
11577
11622
  onClick: () => onDetails(dashboard)
11578
11623
  });
11579
11624
  }
11625
+ // useful since most of the screen is generally an iframe
11626
+ const blurHandler = useCallback(() => {
11627
+ setOpen(false);
11628
+ }, []);
11629
+ useEffect(() => {
11630
+ window.addEventListener('blur', blurHandler);
11631
+ return () => {
11632
+ window.removeEventListener('blur', blurHandler);
11633
+ };
11634
+ }, []);
11580
11635
  return menuItems.length > 0 ? jsxs(Fragment, {
11581
11636
  children: [jsx(DotIconButton, {
11582
11637
  className: "expand-button",
@@ -11591,6 +11646,7 @@ function DotDashboardOptionsMenu({
11591
11646
  id: "card-header-action-menu",
11592
11647
  menuItemHeight: "auto",
11593
11648
  menuItems: menuItems,
11649
+ menuPlacement: menuPlacement,
11594
11650
  open: open,
11595
11651
  onLeave: handleMenuClose
11596
11652
  })]
@@ -11777,7 +11833,8 @@ function DotDashboardActions({
11777
11833
  }), dashboardToDelete && jsx(DotImpactDialog, {
11778
11834
  onCancel: handleDeleteClose,
11779
11835
  onSubmit: handleDeleteSubmit,
11780
- record: dashboardToDelete === null || dashboardToDelete === void 0 ? void 0 : dashboardToDelete.name,
11836
+ record: dashboardToDelete.name,
11837
+ impact: dashboardToDelete.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED ? 'high' : 'medium',
11781
11838
  open: true
11782
11839
  }), jsx(HelpButton, {
11783
11840
  dashboard: dashboard
@@ -11787,6 +11844,7 @@ function DotDashboardActions({
11787
11844
  }), canEdit && jsx(DotDashboardOptionsMenu, {
11788
11845
  dashboard: dashboard,
11789
11846
  isEdit: isEdit,
11847
+ menuPlacement: "bottom-start",
11790
11848
  onViewMode: onViewMode,
11791
11849
  onStartStatusChange: handleStartStatusChangeIfConfig,
11792
11850
  onStartDuplicate: handleStartDuplicateIfConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "3.17.0",
3
+ "version": "3.18.0",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -1,12 +1,14 @@
1
+ import { PopperPlacement } from '../../menu/Menu';
1
2
  import { DashboardView } from '../metadata-api/openapi';
2
3
  interface DashboardOptionsMenuProps {
3
4
  dashboard: DashboardView;
4
5
  isEdit?: boolean;
6
+ menuPlacement?: PopperPlacement;
5
7
  onDetails?: (dashboard: DashboardView) => void;
6
8
  onStartDelete?: (dashboard: DashboardView) => void;
7
9
  onStartDuplicate?: (dashboard: DashboardView) => void;
8
10
  onStartStatusChange?: (dashboard: DashboardView, status: DashboardView.lifecycle_state) => void;
9
11
  onViewMode?: (dashboard: DashboardView, mode: string) => void;
10
12
  }
11
- export declare function DotDashboardOptionsMenu({ dashboard, isEdit, onStartDelete, onStartDuplicate, onStartStatusChange, onViewMode, onDetails, }: DashboardOptionsMenuProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function DotDashboardOptionsMenu({ dashboard, isEdit, menuPlacement, onStartDelete, onStartDuplicate, onStartStatusChange, onViewMode, onDetails, }: DashboardOptionsMenuProps): import("react/jsx-runtime").JSX.Element;
12
14
  export {};
@@ -15,7 +15,7 @@ export type { ConditionFunction, ControlClickHandler, DisabledConditionFunction,
15
15
  export type { InputTextProps } from './input-form-fields/InputText';
16
16
  export type { InputSelectProps, InputSelectOption, OptionType, } from './input-form-fields/InputSelect';
17
17
  export type { LinkUnderline } from './link/Link';
18
- export type { ListItemProps } from './list';
18
+ export type { LeftBorderAndArrowColor, ListItemProps } from './list';
19
19
  export type { MenuItemProps } from './menu/Menu';
20
20
  export type { RailItem, RailItemsPosition } from './navigation-rail';
21
21
  export type { RadioButtonProps } from './radio/RadioButton';
@@ -1,2 +1,2 @@
1
1
  import { ListItemProps } from './utils/models';
2
- export declare const DotListItem: ({ ariaLabel, ariaRole, autoFocus, className, component, "data-pendoid": dataPendoId, "data-testid": dataTestId, divider, endIcon, href, isOpened, onClick, onKeyDown, onHrefClick, onMenuLeave, items, menuPlacement, nestedDrawerLeftSpacing, nestedListType, primaryText, secondaryText, selected, startIcon, target, text, tooltip, tooltipPlacement, }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const DotListItem: ({ ariaLabel, ariaRole, autoFocus, className, component, "data-pendoid": dataPendoId, "data-testid": dataTestId, divider, endIcon, href, isOpened, onClick, onKeyDown, onHrefClick, onMenuLeave, items, leftBorderAndArrow, menuPlacement, nestedDrawerLeftSpacing, nestedListType, primaryText, secondaryText, selected, startIcon, target, text, tooltip, tooltipPlacement, }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,6 +5,7 @@ import { LinkTarget } from '../../link/Link';
5
5
  import { TooltipPlacement } from '../../tooltip';
6
6
  export declare const DEFAULT_TOOLTIP_PLACEMENT = "top-start";
7
7
  export type NestedListType = 'drawer' | 'expandable' | 'menu';
8
+ export type LeftBorderAndArrowColor = 'blue' | 'red' | 'orange' | 'green' | 'grey' | 'purple' | 'yellow';
8
9
  export interface ListProps extends CommonProps {
9
10
  /** string or JSX element that is displayed inside the list */
10
11
  children?: ReactNode;
@@ -44,6 +45,8 @@ export interface ListItemProps extends CommonProps {
44
45
  isOpened?: boolean;
45
46
  /** If provided, the menu item will display a nested list */
46
47
  items?: Array<ListItemProps>;
48
+ /** If defined, shows border with arrow on the left side of the list element */
49
+ leftBorderAndArrow?: LeftBorderAndArrowColor;
47
50
  /** If nested list type is 'menu', determines the placement of the menu */
48
51
  menuPlacement?: PopperPlacement;
49
52
  /** If nested type is 'drawer', determines the width of the left spacing */