@synerise/ds-dropdown 1.3.1 → 1.3.3
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 +8 -0
- package/dist/Dropdown.const.d.ts +4 -4
- package/dist/Dropdown.const.js +31 -21
- package/dist/Dropdown.d.ts +3 -3
- package/dist/Dropdown.js +64 -81
- package/dist/Dropdown.styles.d.ts +1 -1
- package/dist/Dropdown.styles.js +7 -6
- package/dist/Dropdown.types.d.ts +4 -4
- package/dist/Dropdown.types.js +1 -1
- package/dist/components/BackAction/BackAction.d.ts +2 -2
- package/dist/components/BackAction/BackAction.js +20 -25
- package/dist/components/BackAction/BackAction.styles.d.ts +4 -4
- package/dist/components/BackAction/BackAction.styles.js +15 -17
- package/dist/components/BackAction/BackAction.types.d.ts +2 -2
- package/dist/components/BackAction/BackAction.types.js +1 -1
- package/dist/components/BottomAction/BottomAction.d.ts +2 -2
- package/dist/components/BottomAction/BottomAction.js +15 -17
- package/dist/components/BottomAction/BottomAction.styles.d.ts +3 -3
- package/dist/components/BottomAction/BottomAction.styles.js +11 -18
- package/dist/components/BottomAction/BottomAction.types.d.ts +2 -2
- package/dist/components/BottomAction/BottomAction.types.js +1 -1
- package/dist/components/DropdownFooter/DropdownFooter.d.ts +2 -2
- package/dist/components/DropdownFooter/DropdownFooter.js +15 -10
- package/dist/components/DropdownFooter/DropdownFooter.styles.d.ts +3 -3
- package/dist/components/DropdownFooter/DropdownFooter.styles.js +11 -10
- package/dist/components/DropdownFooter/DropdownFooter.types.d.ts +1 -1
- package/dist/components/DropdownFooter/DropdownFooter.types.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +3 -3
- package/dist/components/DropdownMenu/DropdownMenu.js +71 -118
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +3 -3
- package/dist/components/DropdownMenu/DropdownMenu.types.js +1 -1
- package/dist/components/DropdownMenuList/DropdownMenuList.d.ts +3 -3
- package/dist/components/DropdownMenuList/DropdownMenuList.js +62 -76
- package/dist/components/DropdownMenuList/DropdownMenuList.styles.d.ts +5 -5
- package/dist/components/DropdownMenuList/DropdownMenuList.styles.js +16 -9
- package/dist/components/DropdownMenuList/DropdownMenuList.types.d.ts +2 -2
- package/dist/components/DropdownMenuList/DropdownMenuList.types.js +1 -1
- package/dist/components/DropdownOverlay/DropdownOverlay.d.ts +2 -2
- package/dist/components/DropdownOverlay/DropdownOverlay.js +45 -53
- package/dist/components/DropdownOverlay/DropdownOverlay.styles.d.ts +1 -1
- package/dist/components/DropdownOverlay/DropdownOverlay.styles.js +7 -10
- package/dist/components/DropdownOverlay/DropdownOverlay.types.d.ts +2 -2
- package/dist/components/DropdownOverlay/DropdownOverlay.types.js +1 -1
- package/dist/components/DropdownPopover/DropdownPopover.d.ts +2 -2
- package/dist/components/DropdownPopover/DropdownPopover.js +44 -74
- package/dist/components/DropdownPopover/DropdownPopover.types.d.ts +1 -1
- package/dist/components/DropdownPopover/DropdownPopover.types.js +1 -1
- package/dist/components/TextTrigger/TextTrigger.d.ts +2 -2
- package/dist/components/TextTrigger/TextTrigger.js +24 -31
- package/dist/components/TextTrigger/TextTrigger.styles.d.ts +3 -3
- package/dist/components/TextTrigger/TextTrigger.styles.js +9 -23
- package/dist/components/TextTrigger/TextTrigger.types.d.ts +1 -1
- package/dist/components/TextTrigger/TextTrigger.types.js +1 -1
- package/dist/hooks/useDefaultTexts.d.ts +1 -1
- package/dist/hooks/useDefaultTexts.js +18 -20
- package/dist/hooks/useDropdownVisibility.js +19 -21
- package/dist/index.js +15 -6
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/utils/getDropdownWidth.d.ts +1 -1
- package/dist/utils/getDropdownWidth.js +12 -9
- package/dist/utils/getTransitionConfig.d.ts +1 -1
- package/dist/utils/getTransitionConfig.js +11 -7
- package/dist/utils/index.js +8 -3
- package/dist/utils/isSplitFooter.d.ts +1 -1
- package/dist/utils/isSplitFooter.js +6 -3
- package/package.json +14 -14
|
@@ -1,79 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { FloatingList } from
|
|
4
|
-
import { DropdownContextProvider } from
|
|
5
|
-
import {
|
|
6
|
-
import { POPOVER_FLIP_CONFIG, POPOVER_OFFSET_CONFIG,
|
|
7
|
-
import { getTransitionConfig } from
|
|
8
|
-
import { DropdownOverlay } from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { FloatingList } from "@floating-ui/react";
|
|
4
|
+
import { DropdownContextProvider } from "@synerise/ds-core";
|
|
5
|
+
import { getPlacement, Popover, PopoverTrigger, PopoverContent } from "@synerise/ds-popover";
|
|
6
|
+
import { POPOVER_SHIFT_CONFIG, POPOVER_FLIP_CONFIG, POPOVER_OFFSET_CONFIG, POPOVER_TRANSITION_DURATION } from "../../Dropdown.const.js";
|
|
7
|
+
import { getTransitionConfig } from "../../utils/getTransitionConfig.js";
|
|
8
|
+
import { DropdownOverlay } from "../DropdownOverlay/DropdownOverlay.js";
|
|
9
|
+
const DropdownPopover = ({
|
|
10
|
+
placement = "bottomLeft",
|
|
11
|
+
children,
|
|
12
|
+
popoverProps,
|
|
13
|
+
popoverTriggerProps,
|
|
14
|
+
getPopupContainer,
|
|
15
|
+
trigger,
|
|
16
|
+
open,
|
|
17
|
+
onDismiss,
|
|
18
|
+
overlay,
|
|
19
|
+
handleOpenChange,
|
|
20
|
+
size,
|
|
21
|
+
handleItemClick,
|
|
22
|
+
handleTriggerClick,
|
|
23
|
+
hideOnItemClick,
|
|
24
|
+
asChild,
|
|
25
|
+
overlayStyle,
|
|
26
|
+
overlayClassName,
|
|
27
|
+
overlayHTMLAttributes,
|
|
28
|
+
activeIndex,
|
|
29
|
+
setActiveIndex
|
|
30
|
+
}) => {
|
|
31
|
+
const floatingPlacement = getPlacement(placement);
|
|
32
|
+
const triggerRef = useRef(null);
|
|
33
|
+
const elementsRef = useRef([]);
|
|
34
|
+
const listNavigationConfig = {
|
|
35
35
|
enabled: true,
|
|
36
|
-
activeIndex
|
|
37
|
-
onNavigate:
|
|
36
|
+
activeIndex,
|
|
37
|
+
onNavigate: (newIndex) => {
|
|
38
38
|
setActiveIndex(newIndex);
|
|
39
39
|
},
|
|
40
40
|
listRef: elementsRef
|
|
41
41
|
};
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
autoUpdate: true,
|
|
51
|
-
offsetConfig: POPOVER_OFFSET_CONFIG,
|
|
52
|
-
flipConfig: POPOVER_FLIP_CONFIG,
|
|
53
|
-
shiftConfig: POPOVER_SHIFT_CONFIG,
|
|
54
|
-
getTransitionConfig: getTransitionConfig,
|
|
55
|
-
getPopupContainer: getPopupContainer,
|
|
56
|
-
listNavigationConfig: listNavigationConfig,
|
|
57
|
-
testId: "dropdown"
|
|
58
|
-
}, popoverProps), /*#__PURE__*/React.createElement(PopoverTrigger, _extends({
|
|
59
|
-
ref: triggerRef,
|
|
60
|
-
asChild: asChild,
|
|
61
|
-
onClick: handleTriggerClick
|
|
62
|
-
}, popoverTriggerProps), children), /*#__PURE__*/React.createElement(PopoverContent, null, /*#__PURE__*/React.createElement(DropdownContextProvider, {
|
|
63
|
-
hideOnItemClick: hideOnItemClick,
|
|
64
|
-
activeIndex: activeIndex,
|
|
65
|
-
setIsOpen: handleOpenChange,
|
|
66
|
-
isOpen: !!open
|
|
67
|
-
}, /*#__PURE__*/React.createElement(FloatingList, {
|
|
68
|
-
elementsRef: elementsRef
|
|
69
|
-
}, /*#__PURE__*/React.createElement(DropdownOverlay, {
|
|
70
|
-
size: size,
|
|
71
|
-
triggerRef: triggerRef,
|
|
72
|
-
htmlAttributes: overlayHTMLAttributes,
|
|
73
|
-
overlayStyle: overlayStyle,
|
|
74
|
-
overlayClassName: overlayClassName,
|
|
75
|
-
hideOnItemClick: hideOnItemClick,
|
|
76
|
-
content: overlay,
|
|
77
|
-
handleItemClick: handleItemClick
|
|
78
|
-
})))));
|
|
79
|
-
};
|
|
42
|
+
return /* @__PURE__ */ jsxs(Popover, { placement: floatingPlacement, trigger, modal: false, open, onOpenChange: handleOpenChange, onDismiss, transitionDuration: POPOVER_TRANSITION_DURATION, autoUpdate: true, offsetConfig: POPOVER_OFFSET_CONFIG, flipConfig: POPOVER_FLIP_CONFIG, shiftConfig: POPOVER_SHIFT_CONFIG, getTransitionConfig, getPopupContainer, listNavigationConfig, testId: "dropdown", ...popoverProps, children: [
|
|
43
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { ref: triggerRef, asChild, onClick: handleTriggerClick, ...popoverTriggerProps, children }),
|
|
44
|
+
/* @__PURE__ */ jsx(PopoverContent, { children: /* @__PURE__ */ jsx(DropdownContextProvider, { hideOnItemClick, activeIndex, setIsOpen: handleOpenChange, isOpen: !!open, children: /* @__PURE__ */ jsx(FloatingList, { elementsRef, children: /* @__PURE__ */ jsx(DropdownOverlay, { size, triggerRef, htmlAttributes: overlayHTMLAttributes, overlayStyle, overlayClassName, hideOnItemClick, content: overlay, handleItemClick }) }) }) })
|
|
45
|
+
] });
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
DropdownPopover
|
|
49
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DropdownProps } from '../../Dropdown.types';
|
|
2
2
|
export type DropdownPopoverProps = Pick<DropdownProps, 'asChild' | 'children' | 'onDismiss' | 'onOpenChange' | 'getPopupContainer' | 'placement' | 'popoverProps' | 'popoverTriggerProps' | 'overlay' | 'overlayClassName' | 'overlayHTMLAttributes' | 'overlayStyle' | 'open' | 'hideOnItemClick' | 'size' | 'trigger'> & {
|
|
3
3
|
handleOpenChange: (newVal: boolean) => void;
|
|
4
4
|
handleItemClick?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TextTriggerProps } from './TextTrigger.types';
|
|
3
3
|
export declare const TextTrigger: React.ForwardRefExoticComponent<TextTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
level: size
|
|
26
|
-
}, value), /*#__PURE__*/React.createElement(S.IconWrapper, {
|
|
27
|
-
expanded: expanded
|
|
28
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
29
|
-
component: /*#__PURE__*/React.createElement(AngleDownS, null)
|
|
30
|
-
})));
|
|
31
|
-
});
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useTheme } from "@synerise/ds-core";
|
|
4
|
+
import Icon, { AngleDownS } from "@synerise/ds-icon";
|
|
5
|
+
import { Title } from "@synerise/ds-typography";
|
|
6
|
+
import { TextTrigger as TextTrigger$1, IconWrapper } from "./TextTrigger.styles.js";
|
|
7
|
+
const TextTrigger = forwardRef(({
|
|
8
|
+
value,
|
|
9
|
+
expanded,
|
|
10
|
+
size,
|
|
11
|
+
inactiveColor = "grey-800",
|
|
12
|
+
onClick,
|
|
13
|
+
onFocus,
|
|
14
|
+
isDisabled = false
|
|
15
|
+
}, ref) => {
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
return /* @__PURE__ */ jsxs(TextTrigger$1, { onFocus: isDisabled ? void 0 : onFocus, inactiveColor: theme.palette[inactiveColor], tabIndex: 0, ref, onClick: isDisabled ? void 0 : onClick, isDisabled, children: [
|
|
18
|
+
/* @__PURE__ */ jsx(Title, { level: size, children: value }),
|
|
19
|
+
/* @__PURE__ */ jsx(IconWrapper, { expanded, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AngleDownS, {}) }) })
|
|
20
|
+
] });
|
|
21
|
+
});
|
|
22
|
+
export {
|
|
23
|
+
TextTrigger
|
|
24
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const TextTrigger: import(
|
|
1
|
+
import { ThemeProps } from '@synerise/ds-core';
|
|
2
|
+
export declare const TextTrigger: import('styled-components').StyledComponent<"div", any, {
|
|
3
3
|
inactiveColor: string;
|
|
4
4
|
onFocus?: () => void;
|
|
5
5
|
isDisabled?: boolean;
|
|
6
6
|
}, never>;
|
|
7
|
-
export declare const IconWrapper: import(
|
|
7
|
+
export declare const IconWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
8
8
|
expanded?: boolean;
|
|
9
9
|
} & ThemeProps, never>;
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
const TextTrigger = /* @__PURE__ */ styled.div.withConfig({
|
|
3
3
|
displayName: "TextTriggerstyles__TextTrigger",
|
|
4
4
|
componentId: "sc-xuqby2-0"
|
|
5
|
-
})(["display:flex;flex-direction:row;align-items:center;justify-content:center;cursor:", ";opacity:", ";.ds-title{margin:0;}.ds-title,svg{color:", ";fill:", ";}&&&:focus{.ds-title,svg{color:", ";fill:", ";}}}&:hover{.ds-title,svg{color:", ";fill:", ";}}"],
|
|
6
|
-
|
|
7
|
-
}, function (props) {
|
|
8
|
-
return props.isDisabled ? 0.4 : 1;
|
|
9
|
-
}, function (props) {
|
|
10
|
-
return props.inactiveColor;
|
|
11
|
-
}, function (props) {
|
|
12
|
-
return props.inactiveColor;
|
|
13
|
-
}, function (props) {
|
|
14
|
-
return props.theme.palette['blue-700'];
|
|
15
|
-
}, function (props) {
|
|
16
|
-
return props.theme.palette['blue-700'];
|
|
17
|
-
}, function (props) {
|
|
18
|
-
return props.theme.palette['blue-600'];
|
|
19
|
-
}, function (props) {
|
|
20
|
-
return props.theme.palette['blue-600'];
|
|
21
|
-
});
|
|
22
|
-
export var IconWrapper = styled.div.withConfig({
|
|
5
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:center;cursor:", ";opacity:", ";.ds-title{margin:0;}.ds-title,svg{color:", ";fill:", ";}&&&:focus{.ds-title,svg{color:", ";fill:", ";}}}&:hover{.ds-title,svg{color:", ";fill:", ";}}"], (props) => props.isDisabled ? "default" : "pointer", (props) => props.isDisabled ? 0.4 : 1, (props) => props.inactiveColor, (props) => props.inactiveColor, (props) => props.theme.palette["blue-700"], (props) => props.theme.palette["blue-700"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-600"]);
|
|
6
|
+
const IconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
23
7
|
displayName: "TextTriggerstyles__IconWrapper",
|
|
24
8
|
componentId: "sc-xuqby2-1"
|
|
25
|
-
})(["&&&{svg{transition:transform 0.1s linear;transform:rotateZ( ", " );}}"],
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
})(["&&&{svg{transition:transform 0.1s linear;transform:rotateZ( ", " );}}"], (props) => props.expanded ? "180deg" : "0deg");
|
|
10
|
+
export {
|
|
11
|
+
IconWrapper,
|
|
12
|
+
TextTrigger
|
|
13
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DropdownMenuTexts } from '../components/DropdownMenu/DropdownMenu.types';
|
|
2
2
|
export declare const useDefaultTexts: (customTexts?: Partial<DropdownMenuTexts>) => DropdownMenuTexts;
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return
|
|
8
|
-
noSearchResults:
|
|
9
|
-
|
|
10
|
-
defaultMessage: "No results"
|
|
11
|
-
}),
|
|
12
|
-
searchClearTooltip: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
13
|
-
id: "DS.CONFIRMATION.SEARCH-CLEAR-TOOLTIP",
|
|
14
|
-
defaultMessage: "Clear"
|
|
15
|
-
}),
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
3
|
+
const useDefaultTexts = (customTexts) => {
|
|
4
|
+
const {
|
|
5
|
+
formatMessage
|
|
6
|
+
} = useIntl();
|
|
7
|
+
return {
|
|
8
|
+
noSearchResults: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.DROPDOWN-MENU.NO-SEARCH-RESULTS", defaultMessage: "No results" }),
|
|
9
|
+
searchClearTooltip: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.CONFIRMATION.SEARCH-CLEAR-TOOLTIP", defaultMessage: "Clear" }),
|
|
16
10
|
searchPlaceholder: formatMessage({
|
|
17
|
-
id:
|
|
18
|
-
defaultMessage:
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
};
|
|
11
|
+
id: "DS.DROPDOWN-MENU.SEARCH-PLACEHOLDER",
|
|
12
|
+
defaultMessage: "Search"
|
|
13
|
+
}),
|
|
14
|
+
...customTexts || {}
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
useDefaultTexts
|
|
19
|
+
};
|
|
@@ -1,40 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
useEffect(function () {
|
|
1
|
+
import { useState, useRef, useEffect, useCallback } from "react";
|
|
2
|
+
const useDropdownVisibility = ({
|
|
3
|
+
open,
|
|
4
|
+
onOpenChange
|
|
5
|
+
}) => {
|
|
6
|
+
const [internalOpen, setInternalOpen] = useState(open);
|
|
7
|
+
const skipDuplicates = useRef(0);
|
|
8
|
+
const controlledComponent = open !== void 0;
|
|
9
|
+
const actualOpen = controlledComponent ? open : internalOpen;
|
|
10
|
+
useEffect(() => {
|
|
12
11
|
skipDuplicates.current = 0;
|
|
13
12
|
}, [internalOpen]);
|
|
14
|
-
useEffect(
|
|
13
|
+
useEffect(() => {
|
|
15
14
|
if (controlledComponent && open !== internalOpen) {
|
|
16
15
|
if (skipDuplicates.current === 0) {
|
|
17
16
|
skipDuplicates.current += 1;
|
|
18
|
-
onOpenChange
|
|
17
|
+
onOpenChange?.(open);
|
|
19
18
|
}
|
|
20
19
|
setInternalOpen(open);
|
|
21
20
|
}
|
|
22
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
21
|
}, [controlledComponent, open]);
|
|
24
|
-
|
|
22
|
+
const toggleOpen = useCallback((openState) => {
|
|
25
23
|
if (openState !== internalOpen) {
|
|
26
24
|
setInternalOpen(openState);
|
|
27
25
|
}
|
|
28
|
-
// PopupTrigger fires toggleOpen onClick
|
|
29
|
-
// the trigger in the implementation may or may not have an onClick that changes `open` state
|
|
30
|
-
// this prevents duplicated onOpenChange calls if both have onClicks defined
|
|
31
26
|
if (skipDuplicates.current === 0) {
|
|
32
27
|
skipDuplicates.current += 1;
|
|
33
|
-
onOpenChange
|
|
28
|
+
onOpenChange?.(openState);
|
|
34
29
|
}
|
|
35
30
|
}, [internalOpen, onOpenChange]);
|
|
36
31
|
return {
|
|
37
|
-
toggleOpen
|
|
32
|
+
toggleOpen,
|
|
38
33
|
open: actualOpen
|
|
39
34
|
};
|
|
40
|
-
};
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
useDropdownVisibility
|
|
38
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Dropdown, Dropdown as Dropdown2 } from "./Dropdown.js";
|
|
2
|
+
import { DropdownMenu } from "./components/DropdownMenu/DropdownMenu.js";
|
|
3
|
+
import { DropdownOverlay } from "./components/DropdownOverlay/DropdownOverlay.js";
|
|
4
|
+
import { TextTrigger } from "./components/TextTrigger/TextTrigger.js";
|
|
5
|
+
import { BackAction } from "./components/BackAction/BackAction.js";
|
|
6
|
+
import { BottomAction } from "./components/BottomAction/BottomAction.js";
|
|
7
|
+
export {
|
|
8
|
+
BackAction,
|
|
9
|
+
BottomAction,
|
|
10
|
+
Dropdown,
|
|
11
|
+
DropdownMenu,
|
|
12
|
+
DropdownOverlay,
|
|
13
|
+
TextTrigger,
|
|
14
|
+
Dropdown2 as default
|
|
15
|
+
};
|
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DropdownSize } from '../Dropdown.types';
|
|
2
2
|
export declare const getDropdownWidth: (size?: DropdownSize | number) => number | null;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
if (typeof size ===
|
|
1
|
+
const getDropdownWidth = (size) => {
|
|
2
|
+
if (typeof size === "number") {
|
|
3
3
|
return size;
|
|
4
4
|
}
|
|
5
5
|
switch (size) {
|
|
6
|
-
case
|
|
6
|
+
case "small":
|
|
7
7
|
return 216;
|
|
8
|
-
case
|
|
8
|
+
case "large":
|
|
9
9
|
return 588;
|
|
10
|
-
case
|
|
10
|
+
case "medium":
|
|
11
11
|
return 282;
|
|
12
|
-
case
|
|
13
|
-
case
|
|
14
|
-
case
|
|
12
|
+
case "auto":
|
|
13
|
+
case "match-trigger":
|
|
14
|
+
case "min-match-trigger":
|
|
15
15
|
default:
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
|
-
};
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
getDropdownWidth
|
|
21
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Placement, UseTransitionStylesProps } from '@floating-ui/react';
|
|
2
2
|
export declare const getTransitionConfig: ({ placement, }: {
|
|
3
3
|
placement: Placement;
|
|
4
4
|
}) => Partial<UseTransitionStylesProps>;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const getTransitionConfig = ({
|
|
2
|
+
placement
|
|
3
|
+
}) => {
|
|
4
|
+
const isTop = placement.indexOf("top");
|
|
4
5
|
return {
|
|
5
6
|
open: {
|
|
6
|
-
transform:
|
|
7
|
+
transform: "scaleY(1)"
|
|
7
8
|
},
|
|
8
9
|
initial: {
|
|
9
|
-
transform:
|
|
10
|
+
transform: "scaleY(0)"
|
|
10
11
|
},
|
|
11
12
|
common: {
|
|
12
|
-
transformOrigin: isTop ?
|
|
13
|
+
transformOrigin: isTop ? "top" : "bottom"
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
|
-
};
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
getTransitionConfig
|
|
19
|
+
};
|
package/dist/utils/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { getTransitionConfig } from "./getTransitionConfig.js";
|
|
2
|
+
import { isSplitFooter } from "./isSplitFooter.js";
|
|
3
|
+
import { getDropdownWidth } from "./getDropdownWidth.js";
|
|
4
|
+
export {
|
|
5
|
+
getDropdownWidth,
|
|
6
|
+
getTransitionConfig,
|
|
7
|
+
isSplitFooter
|
|
8
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DropdownFooterProps, DropdownFooterSplit } from '../components/DropdownFooter/DropdownFooter.types';
|
|
2
2
|
export declare const isSplitFooter: (footer: DropdownFooterProps["footer"]) => footer is DropdownFooterSplit;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
return !!(footer && typeof footer ===
|
|
3
|
-
};
|
|
1
|
+
const isSplitFooter = (footer) => {
|
|
2
|
+
return !!(footer && typeof footer === "object" && ("left" in footer || "right" in footer));
|
|
3
|
+
};
|
|
4
|
+
export {
|
|
5
|
+
isSplitFooter
|
|
6
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-dropdown",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Dropdown UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "vite build",
|
|
20
20
|
"build:css": "node ../../../scripts/style/less.js",
|
|
21
21
|
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
-
"build:watch": "
|
|
22
|
+
"build:watch": "vite build --watch",
|
|
23
23
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
24
|
"pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
|
|
25
25
|
"prepublish": "pnpm run build",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@floating-ui/react": "^0.27.16",
|
|
39
|
-
"@synerise/ds-divider": "^1.3.
|
|
40
|
-
"@synerise/ds-empty-states": "^1.0.
|
|
41
|
-
"@synerise/ds-icon": "^1.15.
|
|
42
|
-
"@synerise/ds-list-item": "^1.4.
|
|
43
|
-
"@synerise/ds-popover": "^1.5.
|
|
44
|
-
"@synerise/ds-scrollbar": "^1.2.
|
|
45
|
-
"@synerise/ds-search-bar": "^1.4.
|
|
46
|
-
"@synerise/ds-tooltip": "^1.4.
|
|
47
|
-
"@synerise/ds-typography": "^1.1.
|
|
48
|
-
"@synerise/ds-utils": "^1.7.
|
|
39
|
+
"@synerise/ds-divider": "^1.3.3",
|
|
40
|
+
"@synerise/ds-empty-states": "^1.0.37",
|
|
41
|
+
"@synerise/ds-icon": "^1.15.2",
|
|
42
|
+
"@synerise/ds-list-item": "^1.4.11",
|
|
43
|
+
"@synerise/ds-popover": "^1.5.3",
|
|
44
|
+
"@synerise/ds-scrollbar": "^1.2.18",
|
|
45
|
+
"@synerise/ds-search-bar": "^1.4.21",
|
|
46
|
+
"@synerise/ds-tooltip": "^1.4.11",
|
|
47
|
+
"@synerise/ds-typography": "^1.1.14",
|
|
48
|
+
"@synerise/ds-utils": "^1.7.1",
|
|
49
49
|
"classnames": "^2.5.1",
|
|
50
50
|
"react-window": "^1.8.11"
|
|
51
51
|
},
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"react-intl": "^6.8.7",
|
|
59
59
|
"styled-components": "^5.3.3"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "c2384982c3533a31eb5e5e0408f8dcecb2b0f399"
|
|
62
62
|
}
|