@synerise/ds-dropdown 1.0.34 → 1.1.1
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 +19 -0
- package/README.md +1 -1
- package/dist/Dropdown.const.d.ts +14 -0
- package/dist/Dropdown.const.js +25 -0
- package/dist/Dropdown.d.ts +8 -14
- package/dist/Dropdown.js +72 -68
- package/dist/Dropdown.styles.d.ts +0 -1
- package/dist/Dropdown.styles.js +4 -5
- package/dist/Dropdown.types.d.ts +54 -0
- package/dist/components/BackAction/BackAction.d.ts +3 -0
- package/dist/{elements → components}/BackAction/BackAction.js +3 -6
- package/dist/{elements → components}/BackAction/BackAction.styles.js +7 -7
- package/dist/components/BottomAction/BottomAction.d.ts +3 -0
- package/dist/{elements → components}/BottomAction/BottomAction.js +2 -3
- package/dist/{elements → components}/BottomAction/BottomAction.styles.js +3 -3
- package/dist/components/DropdownFooter/DropdownFooter.d.ts +3 -0
- package/dist/components/DropdownFooter/DropdownFooter.js +10 -0
- package/dist/components/DropdownFooter/DropdownFooter.styles.d.ts +5 -0
- package/dist/components/DropdownFooter/DropdownFooter.styles.js +17 -0
- package/dist/components/DropdownFooter/DropdownFooter.types.d.ts +8 -0
- package/dist/components/DropdownFooter/DropdownFooter.types.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +4 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +132 -0
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +18 -0
- package/dist/components/DropdownMenu/DropdownMenu.types.js +1 -0
- package/dist/components/DropdownMenuList/DropdownMenuList.d.ts +4 -0
- package/dist/components/DropdownMenuList/DropdownMenuList.js +84 -0
- package/dist/components/DropdownMenuList/DropdownMenuList.styles.d.ts +40 -0
- package/dist/components/DropdownMenuList/DropdownMenuList.styles.js +23 -0
- package/dist/components/DropdownMenuList/DropdownMenuList.types.d.ts +7 -0
- package/dist/components/DropdownMenuList/DropdownMenuList.types.js +1 -0
- package/dist/components/DropdownOverlay/DropdownOverlay.d.ts +7 -0
- package/dist/components/DropdownOverlay/DropdownOverlay.js +73 -0
- package/dist/components/DropdownOverlay/DropdownOverlay.styles.d.ts +4 -0
- package/dist/components/DropdownOverlay/DropdownOverlay.styles.js +12 -0
- package/dist/components/DropdownOverlay/DropdownOverlay.types.d.ts +8 -0
- package/dist/components/DropdownOverlay/DropdownOverlay.types.js +1 -0
- package/dist/components/DropdownPopover/DropdownPopover.d.ts +3 -0
- package/dist/components/DropdownPopover/DropdownPopover.js +79 -0
- package/dist/components/DropdownPopover/DropdownPopover.types.d.ts +8 -0
- package/dist/components/DropdownPopover/DropdownPopover.types.js +1 -0
- package/dist/components/TextTrigger/TextTrigger.d.ts +3 -0
- package/dist/{elements → components}/TextTrigger/TextTrigger.js +6 -5
- package/dist/{elements → components}/TextTrigger/TextTrigger.styles.js +2 -2
- package/dist/{elements → components}/TextTrigger/TextTrigger.types.d.ts +1 -1
- package/dist/components/TextTrigger/TextTrigger.types.js +1 -0
- package/dist/hooks/useDefaultTexts.d.ts +2 -0
- package/dist/hooks/useDefaultTexts.js +21 -0
- package/dist/hooks/useDropdownVisibility.d.ts +10 -0
- package/dist/hooks/useDropdownVisibility.js +40 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +6 -1
- package/dist/utils/getDropdownWidth.d.ts +2 -0
- package/dist/utils/getDropdownWidth.js +18 -0
- package/dist/utils/getPlacement.d.ts +3 -0
- package/dist/utils/getPlacement.js +4 -0
- package/dist/utils/getTransitionConfig.d.ts +4 -0
- package/dist/utils/getTransitionConfig.js +15 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/isSplitFooter.d.ts +2 -0
- package/dist/utils/isSplitFooter.js +3 -0
- package/package.json +16 -8
- package/dist/elements/BackAction/BackAction.d.ts +0 -4
- package/dist/elements/BottomAction/BottomAction.d.ts +0 -4
- package/dist/elements/TextTrigger/TextTrigger.d.ts +0 -4
- package/dist/style/index.css +0 -1
- /package/dist/{elements/BackAction/BackAction.types.js → Dropdown.types.js} +0 -0
- /package/dist/{elements → components}/BackAction/BackAction.styles.d.ts +0 -0
- /package/dist/{elements → components}/BackAction/BackAction.types.d.ts +0 -0
- /package/dist/{elements/BottomAction/BottomAction.types.js → components/BackAction/BackAction.types.js} +0 -0
- /package/dist/{elements → components}/BottomAction/BottomAction.styles.d.ts +0 -0
- /package/dist/{elements → components}/BottomAction/BottomAction.types.d.ts +0 -0
- /package/dist/{elements/TextTrigger/TextTrigger.types.js → components/BottomAction/BottomAction.types.js} +0 -0
- /package/dist/{elements → components}/TextTrigger/TextTrigger.styles.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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
|
+
## [1.1.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-dropdown@1.1.0...@synerise/ds-dropdown@1.1.1) (2025-11-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-dropdown
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.1.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-dropdown@1.0.34...@synerise/ds-dropdown@1.1.0) (2025-11-06)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **dropdown:** dropdownMenu component ([f0ec827](https://github.com/synerise/synerise-design/commit/f0ec82792cdcb021fa9a454912f6e7a892e53895))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [1.0.34](https://github.com/synerise/synerise-design/compare/@synerise/ds-dropdown@1.0.33...@synerise/ds-dropdown@1.0.34) (2025-10-31)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-dropdown
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Dropdown UI Component
|
|
|
21
21
|
| overlayClassName | Class name of the dropdown root element | string | - |
|
|
22
22
|
| overlayStyle | Style of the dropdown root element | object | - |
|
|
23
23
|
| placement | Placement of pop menu. | `bottomLeft` / `bottomCenter` / `bottomRight` / `topLeft` / `topCenter` / `topRight` / `bottomLeft` | - |
|
|
24
|
-
| trigger | Trigger mode which executes the drop-down action (hover doesn't work on mobile device) | `['hover', 'click'
|
|
24
|
+
| trigger | Trigger mode which executes the drop-down action (hover doesn't work on mobile device) | `['hover', 'click']` | `['hover']` |
|
|
25
25
|
| visible | Whether the dropdown menu is visible | boolean | - |
|
|
26
26
|
| onVisibleChange | A callback executed on visibility changes. | (visible: boolean)=>void | - |
|
|
27
27
|
| hideOnItemClick | Will hide dropdown on click of an item inside the dropdown changes. Provide a CSS selector of element that should trigger dropdown closing or `true` to use `[role="menuitem"]` selector | boolean / string | - |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Placement } from '@floating-ui/react';
|
|
2
|
+
import { type ListItemProps } from '@synerise/ds-list-item';
|
|
3
|
+
import { type FlipConfig, type OffsetConfig, type ShiftConfig } from '@synerise/ds-popover';
|
|
4
|
+
import { type DropdownPlacement } from './Dropdown.types';
|
|
5
|
+
export declare const PLACEMENT_MAP: Record<DropdownPlacement, Placement>;
|
|
6
|
+
export declare const COPYABLE_CLOSE_DELAY = 500;
|
|
7
|
+
export declare const DEFAULT_MATCHING_FUNCTION: (item: ListItemProps, query: string) => boolean;
|
|
8
|
+
export declare const DROPDOWN_MAX_HEIGHT = 400;
|
|
9
|
+
export declare const MAX_VISIBLE_ITEMS = 7;
|
|
10
|
+
export declare const SCROLLBAR_OFFSET = 11;
|
|
11
|
+
export declare const POPOVER_TRANSITION_DURATION = 150;
|
|
12
|
+
export declare const POPOVER_OFFSET_CONFIG: OffsetConfig;
|
|
13
|
+
export declare const POPOVER_FLIP_CONFIG: FlipConfig;
|
|
14
|
+
export declare const POPOVER_SHIFT_CONFIG: ShiftConfig;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export var PLACEMENT_MAP = {
|
|
2
|
+
topRight: 'top-end',
|
|
3
|
+
topLeft: 'top-start',
|
|
4
|
+
top: 'top',
|
|
5
|
+
topCenter: 'top',
|
|
6
|
+
bottom: 'bottom',
|
|
7
|
+
bottomCenter: 'bottom',
|
|
8
|
+
bottomLeft: 'bottom-start',
|
|
9
|
+
bottomRight: 'bottom-end'
|
|
10
|
+
};
|
|
11
|
+
export var COPYABLE_CLOSE_DELAY = 500;
|
|
12
|
+
export var DEFAULT_MATCHING_FUNCTION = function DEFAULT_MATCHING_FUNCTION(item, query) {
|
|
13
|
+
return !!(item.text && item.text.toLocaleLowerCase().match(query.toLocaleLowerCase()));
|
|
14
|
+
};
|
|
15
|
+
export var DROPDOWN_MAX_HEIGHT = 400;
|
|
16
|
+
export var MAX_VISIBLE_ITEMS = 7;
|
|
17
|
+
export var SCROLLBAR_OFFSET = 11;
|
|
18
|
+
export var POPOVER_TRANSITION_DURATION = 150;
|
|
19
|
+
export var POPOVER_OFFSET_CONFIG = {
|
|
20
|
+
mainAxis: 8
|
|
21
|
+
};
|
|
22
|
+
export var POPOVER_FLIP_CONFIG = {};
|
|
23
|
+
export var POPOVER_SHIFT_CONFIG = {
|
|
24
|
+
crossAxis: true
|
|
25
|
+
};
|
package/dist/Dropdown.d.ts
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import { type DropDownProps as AntDropDownProps, type DropdownButtonProps } from 'antd/lib/dropdown';
|
|
2
1
|
import { type ComponentType } from 'react';
|
|
3
|
-
import '@synerise/ds-
|
|
4
|
-
import SearchBar from '@synerise/ds-search-bar/';
|
|
2
|
+
import SearchBar from '@synerise/ds-search-bar';
|
|
5
3
|
import { Wrapper } from './Dropdown.styles';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import './
|
|
10
|
-
|
|
11
|
-
destroyPopupOnHide?: boolean;
|
|
12
|
-
hideOnItemClick?: string | boolean;
|
|
13
|
-
};
|
|
14
|
-
type DropdownButtonType = ComponentType<DropdownButtonProps>;
|
|
4
|
+
import { type DropdownProps } from './Dropdown.types';
|
|
5
|
+
import { BackAction } from './components/BackAction/BackAction';
|
|
6
|
+
import { BottomAction } from './components/BottomAction/BottomAction';
|
|
7
|
+
import { MenuWrapper } from './components/DropdownMenuList/DropdownMenuList.styles';
|
|
8
|
+
import { TextTrigger } from './components/TextTrigger/TextTrigger';
|
|
15
9
|
type SubComponents = {
|
|
16
10
|
Wrapper: typeof Wrapper;
|
|
11
|
+
MenuWrapper: typeof MenuWrapper;
|
|
17
12
|
SearchInput: typeof SearchBar;
|
|
18
13
|
BottomAction: typeof BottomAction;
|
|
19
14
|
BackAction: typeof BackAction;
|
|
20
|
-
Button: DropdownButtonType;
|
|
21
15
|
TextTrigger: typeof TextTrigger;
|
|
22
16
|
};
|
|
23
|
-
declare const Dropdown: ComponentType<DropdownProps> & SubComponents;
|
|
17
|
+
export declare const Dropdown: ComponentType<DropdownProps> & SubComponents;
|
|
24
18
|
export default Dropdown;
|
package/dist/Dropdown.js
CHANGED
|
@@ -1,86 +1,90 @@
|
|
|
1
|
-
var _excluded = ["hideOnItemClick", "placement", "dropdownRender", "
|
|
1
|
+
var _excluded = ["hideOnItemClick", "placement", "dropdownRender", "open", "onOpenChange", "onDismiss", "overlay", "trigger", "size", "asChild", "children", "overlayStyle", "overlayClassName", "disabled", "destroyPopupOnHide", "align", "getPopupContainer", "popoverProps", "popoverTriggerProps", "footer"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import '@synerise/ds-
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
var Dropdown = function Dropdown(_ref) {
|
|
4
|
+
import React, { useMemo, useState } from 'react';
|
|
5
|
+
import SearchBar from '@synerise/ds-search-bar';
|
|
6
|
+
import { getPopupContainer as getPopupContainerDefault } from '@synerise/ds-utils';
|
|
7
|
+
import { Wrapper } from './Dropdown.styles';
|
|
8
|
+
import { BackAction } from './components/BackAction/BackAction';
|
|
9
|
+
import { BottomAction } from './components/BottomAction/BottomAction';
|
|
10
|
+
import { DropdownFooter } from './components/DropdownFooter/DropdownFooter';
|
|
11
|
+
import { MenuWrapper } from './components/DropdownMenuList/DropdownMenuList.styles';
|
|
12
|
+
import { DropdownPopover } from './components/DropdownPopover/DropdownPopover';
|
|
13
|
+
import { TextTrigger } from './components/TextTrigger/TextTrigger';
|
|
14
|
+
import { useDropdownVisibility } from './hooks/useDropdownVisibility';
|
|
15
|
+
export var Dropdown = function Dropdown(_ref) {
|
|
16
16
|
var hideOnItemClick = _ref.hideOnItemClick,
|
|
17
17
|
placement = _ref.placement,
|
|
18
18
|
dropdownRender = _ref.dropdownRender,
|
|
19
|
-
visible = _ref.visible,
|
|
20
19
|
open = _ref.open,
|
|
21
|
-
onVisibleChange = _ref.onVisibleChange,
|
|
22
20
|
onOpenChange = _ref.onOpenChange,
|
|
21
|
+
onDismiss = _ref.onDismiss,
|
|
23
22
|
overlay = _ref.overlay,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
_ref$trigger = _ref.trigger,
|
|
24
|
+
trigger = _ref$trigger === void 0 ? 'click' : _ref$trigger,
|
|
25
|
+
size = _ref.size,
|
|
26
|
+
asChild = _ref.asChild,
|
|
27
|
+
children = _ref.children,
|
|
28
|
+
overlayStyle = _ref.overlayStyle,
|
|
29
|
+
overlayClassName = _ref.overlayClassName,
|
|
30
|
+
disabled = _ref.disabled,
|
|
31
|
+
destroyPopupOnHide = _ref.destroyPopupOnHide,
|
|
32
|
+
align = _ref.align,
|
|
33
|
+
_ref$getPopupContaine = _ref.getPopupContainer,
|
|
34
|
+
getPopupContainer = _ref$getPopupContaine === void 0 ? getPopupContainerDefault : _ref$getPopupContaine,
|
|
35
|
+
popoverProps = _ref.popoverProps,
|
|
36
|
+
popoverTriggerProps = _ref.popoverTriggerProps,
|
|
37
|
+
footer = _ref.footer,
|
|
38
|
+
htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
39
|
+
var _useDropdownVisibilit = useDropdownVisibility({
|
|
40
|
+
open: open,
|
|
41
|
+
onOpenChange: onOpenChange
|
|
42
|
+
}),
|
|
43
|
+
isOpen = _useDropdownVisibilit.open,
|
|
44
|
+
toggleOpen = _useDropdownVisibilit.toggleOpen;
|
|
45
|
+
var _useState = useState(null),
|
|
46
|
+
activeIndex = _useState[0],
|
|
47
|
+
setActiveIndex = _useState[1];
|
|
48
|
+
var renderedOverlay = useMemo(function () {
|
|
49
|
+
return overlay ? overlay : dropdownRender && dropdownRender();
|
|
46
50
|
}, [dropdownRender, overlay]);
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
ref: overlayWrapperRef
|
|
50
|
-
}, renderContent(originNode));
|
|
51
|
-
}, [renderContent]);
|
|
52
|
-
useEffect(function () {
|
|
53
|
-
var handleOverlayClick = function handleOverlayClick(event) {
|
|
54
|
-
if (overlayWrapperRef.current && hideOnItemClick && event.target instanceof HTMLElement) {
|
|
55
|
-
var itemSelector = typeof hideOnItemClick === 'string' ? hideOnItemClick : '[role="menuitem"]';
|
|
56
|
-
var listItem = event.target.closest(itemSelector);
|
|
57
|
-
if (overlayWrapperRef.current.contains(listItem)) {
|
|
58
|
-
setIsOpen(false);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
var overlayNode = overlayWrapperRef.current;
|
|
63
|
-
overlayNode && overlayNode.addEventListener('click', handleOverlayClick);
|
|
64
|
-
return function () {
|
|
65
|
-
overlayNode && overlayNode.removeEventListener('click', handleOverlayClick);
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
return /*#__PURE__*/React.createElement(AntdDropdown, _extends({
|
|
51
|
+
var isTriggeredByClick = Array.isArray(trigger) ? trigger.includes('click') : trigger === 'click';
|
|
52
|
+
return disabled ? /*#__PURE__*/React.createElement(React.Fragment, null, children) : /*#__PURE__*/React.createElement(DropdownPopover, {
|
|
69
53
|
getPopupContainer: getPopupContainer,
|
|
70
|
-
|
|
71
|
-
offset: [0, offsetVertical]
|
|
72
|
-
},
|
|
73
|
-
trigger: ['click'],
|
|
54
|
+
overlayHTMLAttributes: htmlAttributes,
|
|
74
55
|
open: isOpen,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
56
|
+
placement: placement,
|
|
57
|
+
asChild: asChild,
|
|
58
|
+
overlay: /*#__PURE__*/React.createElement(React.Fragment, null, renderedOverlay, footer && /*#__PURE__*/React.createElement(DropdownFooter, {
|
|
59
|
+
footer: footer
|
|
60
|
+
})),
|
|
61
|
+
handleOpenChange: toggleOpen,
|
|
62
|
+
handleTriggerClick: function handleTriggerClick() {
|
|
63
|
+
isTriggeredByClick && toggleOpen(!isOpen);
|
|
64
|
+
},
|
|
65
|
+
hideOnItemClick: hideOnItemClick,
|
|
66
|
+
handleItemClick: function handleItemClick() {
|
|
67
|
+
if (hideOnItemClick) {
|
|
68
|
+
toggleOpen(false);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
onDismiss: onDismiss,
|
|
72
|
+
popoverProps: _extends({}, popoverProps, {
|
|
73
|
+
componentId: 'dropdown'
|
|
74
|
+
}),
|
|
75
|
+
popoverTriggerProps: popoverTriggerProps,
|
|
76
|
+
trigger: trigger,
|
|
77
|
+
size: size,
|
|
78
|
+
overlayStyle: overlayStyle,
|
|
79
|
+
overlayClassName: overlayClassName,
|
|
80
|
+
activeIndex: activeIndex,
|
|
81
|
+
setActiveIndex: setActiveIndex
|
|
82
|
+
}, children);
|
|
79
83
|
};
|
|
80
84
|
Dropdown.Wrapper = Wrapper;
|
|
85
|
+
Dropdown.MenuWrapper = MenuWrapper;
|
|
81
86
|
Dropdown.SearchInput = SearchBar;
|
|
82
87
|
Dropdown.BottomAction = BottomAction;
|
|
83
88
|
Dropdown.BackAction = BackAction;
|
|
84
|
-
Dropdown.Button = AntdDropdown.Button;
|
|
85
89
|
Dropdown.TextTrigger = TextTrigger;
|
|
86
90
|
export default Dropdown;
|
package/dist/Dropdown.styles.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
+
import { Wrapper as ListItemWrapper } from '@synerise/ds-list-item/dist/components/Text/Text.styles';
|
|
2
3
|
export var Wrapper = styled.div.withConfig({
|
|
3
4
|
displayName: "Dropdownstyles__Wrapper",
|
|
4
5
|
componentId: "sc-1onktq5-0"
|
|
5
|
-
})(["background
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
componentId: "sc-1onktq5-1"
|
|
9
|
-
})([""]);
|
|
6
|
+
})(["overflow:hidden;background:", ";", "{min-width:0;}"], function (props) {
|
|
7
|
+
return props.theme.palette.white;
|
|
8
|
+
}, ListItemWrapper);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type CSSProperties, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type OpenChangeReason } from '@floating-ui/react';
|
|
3
|
+
import { type PopoverOptions, type PopoverTriggerType } from '@synerise/ds-popover';
|
|
4
|
+
import { type WithHTMLAttributes } from '@synerise/ds-utils';
|
|
5
|
+
export type DropdownProps = Omit<WithHTMLAttributes<HTMLDivElement, DropdownSharedProps & {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated all dropdowns are destroyed when hidden
|
|
8
|
+
*/
|
|
9
|
+
destroyPopupOnHide?: boolean;
|
|
10
|
+
}>, 'style'>;
|
|
11
|
+
/**
|
|
12
|
+
* bottom and bottomCenter are the same - legacy types
|
|
13
|
+
* top and topCenter are the same - legacy types
|
|
14
|
+
*/
|
|
15
|
+
export type DropdownPlacement = 'topLeft' | 'top' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottom' | 'bottomCenter' | 'bottomRight';
|
|
16
|
+
export type DropdownSize = 'small' | 'medium' | 'large' | 'auto' | 'match-trigger' | 'min-match-trigger';
|
|
17
|
+
export type DropdownSharedProps = {
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
asChild?: boolean;
|
|
20
|
+
overlayStyle?: CSSProperties;
|
|
21
|
+
overlayClassName?: string;
|
|
22
|
+
overlayHTMLAttributes?: HTMLAttributes<HTMLDivElement>;
|
|
23
|
+
placement?: DropdownPlacement;
|
|
24
|
+
getPopupContainer?: (trigger: HTMLElement) => HTMLElement;
|
|
25
|
+
trigger?: PopoverTriggerType | PopoverTriggerType[];
|
|
26
|
+
size?: DropdownSize | number;
|
|
27
|
+
overlay?: ReactNode;
|
|
28
|
+
hideOnItemClick?: string | boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated use overlay prop
|
|
31
|
+
*/
|
|
32
|
+
dropdownRender?: () => ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* use this prop if you need a controlled component
|
|
35
|
+
*/
|
|
36
|
+
open?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* use this prop if you need a controlled component
|
|
39
|
+
*/
|
|
40
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
41
|
+
/** this callback fires if the dropdown is closed by clicking outside */
|
|
42
|
+
onDismiss?: (event?: Event, reason?: OpenChangeReason) => void;
|
|
43
|
+
footer?: ReactNode | {
|
|
44
|
+
left?: ReactNode;
|
|
45
|
+
right?: ReactNode;
|
|
46
|
+
};
|
|
47
|
+
children: ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated this should not be needed anymore
|
|
50
|
+
*/
|
|
51
|
+
align?: any;
|
|
52
|
+
popoverProps?: Partial<PopoverOptions>;
|
|
53
|
+
popoverTriggerProps?: Omit<HTMLAttributes<HTMLSpanElement>, 'onClick'>;
|
|
54
|
+
};
|
|
@@ -4,7 +4,7 @@ import Divider from '@synerise/ds-divider';
|
|
|
4
4
|
import Icon, { ArrowLeftM } from '@synerise/ds-icon';
|
|
5
5
|
import Tooltip from '@synerise/ds-tooltip';
|
|
6
6
|
import * as S from './BackAction.styles';
|
|
7
|
-
var BackAction = function BackAction(_ref) {
|
|
7
|
+
export var BackAction = function BackAction(_ref) {
|
|
8
8
|
var label = _ref.label,
|
|
9
9
|
onClick = _ref.onClick,
|
|
10
10
|
tooltip = _ref.tooltip,
|
|
@@ -20,9 +20,6 @@ var BackAction = function BackAction(_ref) {
|
|
|
20
20
|
"data-testid": "dropdown-back-action-label"
|
|
21
21
|
}, label)), /*#__PURE__*/React.createElement(Divider, {
|
|
22
22
|
dashed: true,
|
|
23
|
-
|
|
24
|
-
margin: '0'
|
|
25
|
-
}
|
|
23
|
+
withSideMargin: true
|
|
26
24
|
}));
|
|
27
|
-
};
|
|
28
|
-
export default BackAction;
|
|
25
|
+
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
export var Label = styled.div.withConfig({
|
|
3
3
|
displayName: "BackActionstyles__Label",
|
|
4
|
-
componentId: "sc-
|
|
4
|
+
componentId: "sc-1cwqmxm-0"
|
|
5
5
|
})(["font-weight:500;font-size:14px;transition:color 0.3s ease;color:", ";"], function (props) {
|
|
6
6
|
return props.theme.palette['grey-700'];
|
|
7
7
|
});
|
|
8
8
|
export var IconWrapper = styled.div.withConfig({
|
|
9
9
|
displayName: "BackActionstyles__IconWrapper",
|
|
10
|
-
componentId: "sc-
|
|
11
|
-
})(["margin-right:12px;
|
|
10
|
+
componentId: "sc-1cwqmxm-1"
|
|
11
|
+
})(["margin-right:12px;color:", ";transition:color 0.3s ease;"], function (props) {
|
|
12
12
|
return props.theme.palette['grey-700'];
|
|
13
13
|
});
|
|
14
14
|
export var BackActionWrapper = styled.div.withConfig({
|
|
15
15
|
displayName: "BackActionstyles__BackActionWrapper",
|
|
16
|
-
componentId: "sc-
|
|
17
|
-
})(["padding:0
|
|
16
|
+
componentId: "sc-1cwqmxm-2"
|
|
17
|
+
})(["padding:0 8px;&:hover{", "{color:", ";}", "{color:", ";}}"], Label, function (props) {
|
|
18
18
|
return props.theme.palette['grey-800'];
|
|
19
19
|
}, IconWrapper, function (props) {
|
|
20
20
|
return props.theme.palette['grey-800'];
|
|
21
21
|
});
|
|
22
22
|
export var ContentWrapper = styled.div.withConfig({
|
|
23
23
|
displayName: "BackActionstyles__ContentWrapper",
|
|
24
|
-
componentId: "sc-
|
|
25
|
-
})(["padding:14px
|
|
24
|
+
componentId: "sc-1cwqmxm-3"
|
|
25
|
+
})(["padding:14px 8px;display:flex;align-items:center;cursor:pointer;"]);
|
|
@@ -4,7 +4,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Icon from '@synerise/ds-icon';
|
|
6
6
|
import * as S from './BottomAction.styles';
|
|
7
|
-
var BottomAction = function BottomAction(_ref) {
|
|
7
|
+
export var BottomAction = function BottomAction(_ref) {
|
|
8
8
|
var onClickAction = _ref.onClickAction,
|
|
9
9
|
children = _ref.children,
|
|
10
10
|
icon = _ref.icon,
|
|
@@ -14,5 +14,4 @@ var BottomAction = function BottomAction(_ref) {
|
|
|
14
14
|
}, rest), icon && /*#__PURE__*/React.createElement(S.IconWrapper, null, /*#__PURE__*/React.createElement(Icon, {
|
|
15
15
|
component: icon
|
|
16
16
|
})), /*#__PURE__*/React.createElement(S.TextWrapper, null, children));
|
|
17
|
-
};
|
|
18
|
-
export default BottomAction;
|
|
17
|
+
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
export var IconWrapper = styled.div.withConfig({
|
|
3
3
|
displayName: "BottomActionstyles__IconWrapper",
|
|
4
|
-
componentId: "sc-
|
|
4
|
+
componentId: "sc-sbwluh-0"
|
|
5
5
|
})(["margin-right:4px;svg{fill:", ";}"], function (props) {
|
|
6
6
|
return props.theme.palette['grey-600'];
|
|
7
7
|
});
|
|
8
8
|
export var TextWrapper = styled.div.withConfig({
|
|
9
9
|
displayName: "BottomActionstyles__TextWrapper",
|
|
10
|
-
componentId: "sc-
|
|
10
|
+
componentId: "sc-sbwluh-1"
|
|
11
11
|
})(["line-height:12px;width:100%;"]);
|
|
12
12
|
export var BottomAction = styled.div.withConfig({
|
|
13
13
|
displayName: "BottomActionstyles__BottomAction",
|
|
14
|
-
componentId: "sc-
|
|
14
|
+
componentId: "sc-sbwluh-2"
|
|
15
15
|
})(["background-color:", ";padding:0 16px;height:52px;display:flex;align-items:center;color:", ";font-weight:500;border-width:1px 0 0 0;border-color:", ";border-style:solid;margin-top:8px;cursor:pointer;&:hover{color:", ";", "{svg{fill:", ";}}}"], function (props) {
|
|
16
16
|
return props.theme.palette['grey-050'];
|
|
17
17
|
}, function (props) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { isSplitFooter } from '../../utils';
|
|
3
|
+
import * as S from './DropdownFooter.styles';
|
|
4
|
+
export var DropdownFooter = function DropdownFooter(_ref) {
|
|
5
|
+
var footer = _ref.footer;
|
|
6
|
+
var split = isSplitFooter(footer);
|
|
7
|
+
return /*#__PURE__*/React.createElement(S.DropdownFooterWrapper, {
|
|
8
|
+
split: split
|
|
9
|
+
}, split ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.DropdownFooterLeft, null, footer.left), /*#__PURE__*/React.createElement(S.DropdownFooterLeft, null, footer.right)) : footer);
|
|
10
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const DropdownFooterWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
split?: boolean;
|
|
3
|
+
}, never>;
|
|
4
|
+
export declare const DropdownFooterLeft: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const DropdownFooterRight: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export var DropdownFooterWrapper = styled.div.withConfig({
|
|
3
|
+
displayName: "DropdownFooterstyles__DropdownFooterWrapper",
|
|
4
|
+
componentId: "sc-q7mkt3-0"
|
|
5
|
+
})(["background:", ";height:48px;padding:8px;display:flex;align-items:center;justify-content:", ";"], function (props) {
|
|
6
|
+
return props.theme.palette['grey-100'];
|
|
7
|
+
}, function (props) {
|
|
8
|
+
return props.split ? 'space-between' : 'flex-end';
|
|
9
|
+
});
|
|
10
|
+
export var DropdownFooterLeft = styled.div.withConfig({
|
|
11
|
+
displayName: "DropdownFooterstyles__DropdownFooterLeft",
|
|
12
|
+
componentId: "sc-q7mkt3-1"
|
|
13
|
+
})([""]);
|
|
14
|
+
export var DropdownFooterRight = styled.div.withConfig({
|
|
15
|
+
displayName: "DropdownFooterstyles__DropdownFooterRight",
|
|
16
|
+
componentId: "sc-q7mkt3-2"
|
|
17
|
+
})([""]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ListItemProps } from '@synerise/ds-list-item';
|
|
3
|
+
import { type DropdownMenuProps } from './DropdownMenu.types';
|
|
4
|
+
export declare const DropdownMenu: <ItemType extends ListItemProps>({ dataSource, withSearch, texts, children, trigger, placement, maxVisibleItems, size, open, onOpenChange, onDismiss, onSearchQueryChange, getPopupContainer, virtualised, disabled, asChild, hideOnItemClick, itemMatchesSearchQuery, footer, overlayStyle, overlayClassName, overlayHTMLAttributes, popoverProps, popoverTriggerProps, }: DropdownMenuProps<ItemType>) => React.JSX.Element;
|