@synerise/ds-menu 0.15.8 → 0.16.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.16.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-menu@0.15.8...@synerise/ds-menu@0.16.0) (2022-09-21)
7
+
8
+
9
+ ### Features
10
+
11
+ * **menu:** add information card tooltip ([ded0bf1](https://github.com/Synerise/synerise-design/commit/ded0bf1b58e68f7061630810925669cb0fdad560))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.15.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-menu@0.15.7...@synerise/ds-menu@0.15.8) (2022-08-31)
7
18
 
8
19
  **Note:** Version bump only for package @synerise/ds-menu
@@ -5,16 +5,17 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
5
5
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
6
 
7
7
  import * as React from 'react';
8
+ import "rc-trigger/assets/index.css";
8
9
  import classNames from 'classnames';
9
10
  import { useTheme } from 'styled-components';
10
- import theme from '@synerise/ds-core/dist/js/DSProvider/ThemeProvider/theme';
11
11
  import * as copy from 'copy-to-clipboard';
12
12
  import Trigger from 'rc-trigger';
13
13
  import Tooltip from '@synerise/ds-tooltip';
14
- import Icon, { CheckS, AngleRightS } from '@synerise/ds-icon';
15
14
  import { escapeRegEx } from '@synerise/ds-utils';
16
- import "rc-trigger/assets/index.css";
15
+ import Icon, { CheckS, AngleRightS } from '@synerise/ds-icon';
16
+ import theme from '@synerise/ds-core/dist/js/DSProvider/ThemeProvider/theme';
17
17
  import * as S from './Text.styles';
18
+ import { triggerPlacements } from '../../../utils';
18
19
  import { VisibilityTrigger } from '../../../Menu.types';
19
20
 
20
21
  var renderAddon = function renderAddon(addon) {
@@ -25,10 +26,6 @@ var renderAddon = function renderAddon(addon) {
25
26
  return addon instanceof Function ? addon.apply(void 0, params) : addon;
26
27
  };
27
28
 
28
- var placement = {
29
- right: ['cl', 'cr']
30
- };
31
-
32
29
  function WithHoverTooltip(_ref) {
33
30
  var _hoverTooltipProps$de;
34
31
 
@@ -51,12 +48,10 @@ function WithHoverTooltip(_ref) {
51
48
  onKeyDown: cancelBubblingEvent,
52
49
  onClick: cancelBubblingEvent
53
50
  }, /*#__PURE__*/React.createElement(Trigger, _extends({
51
+ builtinPlacements: triggerPlacements,
54
52
  defaultPopupVisible: (_hoverTooltipProps$de = hoverTooltipProps == null ? void 0 : hoverTooltipProps.defaultPopupVisible) != null ? _hoverTooltipProps$de : false,
55
- action: ['click', 'hover'],
56
- popupAlign: {
57
- points: placement.right,
58
- offset: [4, 0]
59
- },
53
+ action: (hoverTooltipProps == null ? void 0 : hoverTooltipProps.action) || ['click', 'hover'],
54
+ popupPlacement: (hoverTooltipProps == null ? void 0 : hoverTooltipProps.popupPlacement) || 'right',
60
55
  popup: renderHoverTooltip && renderHoverTooltip(),
61
56
  popupClassName: "ignore-click-outside ds-hide-arrow",
62
57
  mouseEnterDelay: 0.2,
@@ -23,11 +23,13 @@ export var MenuDivider = styled.div.withConfig({
23
23
  export var AntdMenu = styled(Menu).withConfig({
24
24
  displayName: "Menustyles__AntdMenu",
25
25
  componentId: "sc-10eu0qe-1"
26
- })(["", " ", " > li{> .ant-menu-submenu-title{padding-left:12px !important;}&:not(.ant-menu-submenu){padding-left:12px !important;}}.ant-menu-submenu-title{display:flex;", " .ds-submenu-title-wrapper{", " .ds-submenu-title{padding-top:5px;padding-bottom:5px;", "}}}&&{.ant-menu-inline,.ant-menu-vertical,.ant-menu-vertical-left{border-right-width:0px;margin:8px 0 8px 0;}}"], function (props) {
27
- return Boolean(props.asDropdownMenu) && css(["&&{padding:8px;width:194px;"]);
26
+ })(["", " ", " > li{> .ant-menu-submenu-title{padding-left:12px !important;}&:not(.ant-menu-submenu){padding-left:12px !important;}}.ant-menu-submenu-title{display:flex;", " .ds-submenu-title-wrapper{", " .ds-submenu-title{padding-top:5px;padding-bottom:5px;", "}}}&&{.ant-menu-inline,.ant-menu-vertical,.ant-menu-vertical-left{border-right-width:0px;margin:8px 0 8px 0;}}", ""], function (props) {
27
+ return Boolean(props.asDropdownMenu) && !props.asInfoCardContainer && css(["&&{padding:8px;width:194px;"]);
28
28
  }, function (props) {
29
29
  return !!props.ordered && css(["&,ul{counter-reset:custom-counter;li:not(.ds-submenu-title){counter-increment:custom-counter;&::before{content:'0' counter(custom-counter) '. \\a0';line-height:1.39;font-weight:normal;color:", ";}}li.ant-menu-submenu{&::before{content:'';}}}"], props.theme.palette['grey-500']);
30
- }, overflowStyles, overflowStyles, overflowStyles);
30
+ }, overflowStyles, overflowStyles, overflowStyles, function (props) {
31
+ return Boolean(props.asInfoCardContainer) && css(["&&& li.ds-menu-item{padding:0 !important;}"]);
32
+ });
31
33
  export var SubMenuItem = styled(Menu.SubMenu).withConfig({
32
34
  displayName: "Menustyles__SubMenuItem",
33
35
  componentId: "sc-10eu0qe-2"
@@ -5,6 +5,7 @@ export interface AntdMenuProps extends Omit<MenuProps, 'dataSource' | 'footer'>
5
5
  ordered?: boolean;
6
6
  asDropdownMenu?: boolean;
7
7
  showTextTooltip?: boolean;
8
+ asInfoCardContainer?: boolean;
8
9
  }
9
10
  export declare type MenuDividerProps = {
10
11
  higher?: boolean;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default } from './Menu';
2
2
  export * from './Menu.types';
3
3
  export * from './Elements/Item/MenuItem.types';
4
+ export * from './utils';
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default } from './Menu';
2
2
  export * from './Menu.types';
3
- export * from './Elements/Item/MenuItem.types';
3
+ export * from './Elements/Item/MenuItem.types';
4
+ export * from './utils';
@@ -0,0 +1,34 @@
1
+ export declare const triggerPlacements: {
2
+ left: {
3
+ points: string[];
4
+ offset: number[];
5
+ };
6
+ right: {
7
+ points: string[];
8
+ offset: number[];
9
+ };
10
+ top: {
11
+ points: string[];
12
+ offset: number[];
13
+ };
14
+ bottom: {
15
+ points: string[];
16
+ offset: number[];
17
+ };
18
+ topLeft: {
19
+ points: string[];
20
+ offset: number[];
21
+ };
22
+ topRight: {
23
+ points: string[];
24
+ offset: number[];
25
+ };
26
+ bottomRight: {
27
+ points: string[];
28
+ offset: number[];
29
+ };
30
+ bottomLeft: {
31
+ points: string[];
32
+ offset: number[];
33
+ };
34
+ };
package/dist/utils.js ADDED
@@ -0,0 +1,35 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+ export var triggerPlacements = {
3
+ left: {
4
+ points: ['cr', 'cl'],
5
+ offset: [-8, 0]
6
+ },
7
+ right: {
8
+ points: ['cl', 'cr'],
9
+ offset: [0, 0]
10
+ },
11
+ top: {
12
+ points: ['bc', 'tc'],
13
+ offset: [0, -8]
14
+ },
15
+ bottom: {
16
+ points: ['tc', 'bc'],
17
+ offset: [0, 8]
18
+ },
19
+ topLeft: {
20
+ points: ['bl', 'tl'],
21
+ offset: [0, -8]
22
+ },
23
+ topRight: {
24
+ points: ['br', 'tr'],
25
+ offset: [0, -8]
26
+ },
27
+ bottomRight: {
28
+ points: ['tr', 'br'],
29
+ offset: [0, 8]
30
+ },
31
+ bottomLeft: {
32
+ points: ['tl', 'bl'],
33
+ offset: [0, 8]
34
+ }
35
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-menu",
3
- "version": "0.15.8",
3
+ "version": "0.16.0",
4
4
  "description": "Menu UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -41,5 +41,5 @@
41
41
  "@synerise/ds-core": "*",
42
42
  "react": ">=16.9.0 < 17.0.0"
43
43
  },
44
- "gitHead": "ef480757296035e4ba2928cd169a98458477b8d1"
44
+ "gitHead": "aef9ed09c6b307baccd74eb6a15d3134a6c7defe"
45
45
  }