@wavv/ui 2.2.2-alpha.5 → 2.2.2-alpha.7
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/build/assets/icons/CaretDown.js +18 -0
- package/build/assets/icons/CaretUp.js +18 -0
- package/build/assets/icons/Checkbox.js +15 -0
- package/build/assets/icons/CheckboxOff.js +15 -0
- package/build/assets/icons/CheckboxPartial.js +15 -0
- package/build/assets/icons/Dialpad.js +18 -0
- package/build/assets/icons/Exclamation.js +25 -0
- package/build/assets/icons/Phone.js +13 -0
- package/build/assets/icons/PhoneAdd.js +21 -0
- package/build/assets/icons/PhoneBlocked.js +22 -0
- package/build/assets/icons/PhoneCallback.js +21 -0
- package/build/assets/icons/PhoneEnd.js +28 -0
- package/build/assets/icons/PhoneForward.js +22 -0
- package/build/assets/icons/PhoneHistory.js +21 -0
- package/build/assets/icons/PhoneHold.js +22 -0
- package/build/assets/icons/PhoneIncoming.js +22 -0
- package/build/assets/icons/PhoneMissed.js +22 -0
- package/build/assets/icons/PhoneTalk.js +22 -0
- package/build/assets/icons/PhoneTransfer.js +21 -0
- package/build/assets/icons/RadioButton.js +22 -0
- package/build/assets/icons/RadioButtonOff.js +15 -0
- package/build/assets/icons/Record.js +18 -0
- package/build/assets/icons/Screenshot.js +39 -0
- package/build/assets/icons/ShieldWavv.js +30 -0
- package/build/assets/icons/Spotify.js +15 -0
- package/build/assets/icons/SubArrow.js +16 -0
- package/build/assets/icons/ToggleOff.js +15 -0
- package/build/assets/icons/ToggleOn.js +15 -0
- package/build/assets/icons/TransferCancel.js +60 -0
- package/build/components/Accordion/Accordion.js +26 -0
- package/build/components/Accordion/Header.js +86 -0
- package/build/components/Accordion/Item.js +25 -0
- package/build/components/Accordion/Panel.js +64 -0
- package/build/components/Accordion/index.js +2 -0
- package/build/components/Audio.js +248 -0
- package/build/components/BarChart.js +123 -0
- package/build/components/Button/Button.js +258 -0
- package/build/components/Button/ButtonLoader.js +20 -0
- package/build/components/Button/ButtonTypes.js +0 -0
- package/build/components/Button/Group.js +58 -0
- package/build/components/Button/index.js +2 -0
- package/build/components/Calendar.js +49 -0
- package/build/components/CalendarParts/CalendarContainerStyles.js +15 -0
- package/build/components/CalendarParts/CalendarContent.js +138 -0
- package/build/components/CalendarParts/CalendarHeader.js +146 -0
- package/build/components/CalendarParts/useMinMax.js +23 -0
- package/build/components/CalendarParts/utils.js +6 -0
- package/build/components/ChartHelpers.js +121 -0
- package/build/components/Checkbox.js +85 -0
- package/build/components/Code/Code.js +117 -0
- package/build/components/Code/Copy.js +50 -0
- package/build/components/Code/Endpoint.js +82 -0
- package/build/components/Code/index.js +3 -0
- package/build/components/ComboBox.js +190 -0
- package/build/components/CommandMenu/CommandItem.js +32 -0
- package/build/components/CommandMenu/CommandMenu.js +136 -0
- package/build/components/CommandMenu/CommandOptions.js +24 -0
- package/build/components/CommandMenu/CommandSection.js +19 -0
- package/build/components/CommandMenu/index.js +2 -0
- package/build/components/DateRangeSelect.js +359 -0
- package/build/components/DocTable.js +32 -0
- package/build/components/Dot.js +60 -0
- package/build/components/DraftEditor.js +188 -0
- package/build/components/Dropdown.js +130 -0
- package/build/components/DropdownMenu.js +131 -0
- package/build/components/DropdownMenuParts/Menu.js +6 -0
- package/build/components/DropdownMenuParts/MenuItem.js +54 -0
- package/build/components/DropdownMenuParts/MenuOptions.js +47 -0
- package/build/components/DropdownMenuParts/MenuSection.js +14 -0
- package/build/components/DropdownSelect.js +171 -0
- package/build/components/DynamicIcon.js +49 -0
- package/build/components/Editor/Editor.js +356 -0
- package/build/components/Editor/EditorStyles.js +259 -0
- package/build/components/Editor/MergeFieldExtension.js +110 -0
- package/build/components/Editor/RichTextToolbar.js +515 -0
- package/build/components/Editor/editorUtils.js +213 -0
- package/build/components/Editor/index.js +3 -0
- package/build/components/Ellipsis.js +22 -0
- package/build/components/Focusable.js +20 -0
- package/build/components/Form.js +68 -0
- package/build/components/FormControl.js +72 -0
- package/build/components/Grid.js +53 -0
- package/build/components/Icon/Icon.js +89 -0
- package/build/components/Icon/customIcons.js +48 -0
- package/build/components/Icon/icons.js +145 -0
- package/build/components/Icon/index.js +3 -0
- package/build/components/ImageViewer.js +142 -0
- package/build/components/InlineCode.js +10 -0
- package/build/components/InputHelpers.js +106 -0
- package/build/components/Inputs/DatePicker.js +111 -0
- package/build/components/Inputs/DateRangePicker.js +166 -0
- package/build/components/Inputs/InlineInput.js +71 -0
- package/build/components/Inputs/NumberInput.js +117 -0
- package/build/components/Inputs/PhoneInput.js +96 -0
- package/build/components/Inputs/SearchInput.js +84 -0
- package/build/components/Inputs/TextArea.js +164 -0
- package/build/components/Inputs/TextInput.js +74 -0
- package/build/components/Inputs/TimeInput.js +74 -0
- package/build/components/Inputs/helpers/AriaButton.js +19 -0
- package/build/components/Inputs/helpers/DateSegment.js +22 -0
- package/build/components/Inputs/helpers/Description.js +11 -0
- package/build/components/Inputs/helpers/ErrorMessage.js +11 -0
- package/build/components/Inputs/helpers/Input.js +6 -0
- package/build/components/Inputs/helpers/InputContainerStyles.js +78 -0
- package/build/components/Inputs/helpers/InputMessage.js +30 -0
- package/build/components/Inputs/helpers/InputStyles.js +43 -0
- package/build/components/Inputs/helpers/Label.js +42 -0
- package/build/components/Inputs/helpers/LabelWrapper.js +14 -0
- package/build/components/Inputs/helpers/PickerToggle.js +7 -0
- package/build/components/Inputs/helpers/TextArea.js +8 -0
- package/build/components/Inputs/helpers/filterPastedText.js +9 -0
- package/build/components/Inputs/helpers/handlePaste.js +12 -0
- package/build/components/Inputs/helpers/isAcceptable.js +7 -0
- package/build/components/Inputs/helpers/useDynamicWidth.js +39 -0
- package/build/components/Inputs/helpers/useInputFocus.js +19 -0
- package/build/components/Label.js +42 -0
- package/build/components/LineChart.js +80 -0
- package/build/components/ListBoxParts/GridListItem.js +34 -0
- package/build/components/ListBoxParts/ListBoxItem.js +32 -0
- package/build/components/ListBoxParts/ListOptions.js +45 -0
- package/build/components/ListHelpers/GridListHeader.js +14 -0
- package/build/components/ListHelpers/GridListSection.js +14 -0
- package/build/components/ListHelpers/ItemHeaderBody.js +36 -0
- package/build/components/ListHelpers/ListHeader.js +14 -0
- package/build/components/ListHelpers/ListItemStyles.js +52 -0
- package/build/components/ListHelpers/ListRootStyles.js +14 -0
- package/build/components/ListHelpers/ListSection.js +14 -0
- package/build/components/ListHelpers/ListStyles.js +29 -0
- package/build/components/Menu.js +159 -0
- package/build/components/Message.js +107 -0
- package/build/components/MessageHr.js +32 -0
- package/build/components/Modal.js +212 -0
- package/build/components/MotionPopover.js +39 -0
- package/build/components/MultiSelect/MultiSelect.js +263 -0
- package/build/components/MultiSelect/SearchDropdown.js +155 -0
- package/build/components/MultiSelect/index.js +2 -0
- package/build/components/OptionHelpers/Container.js +34 -0
- package/build/components/OptionHelpers/Item.js +59 -0
- package/build/components/OptionHelpers/types.js +0 -0
- package/build/components/Pagination.js +121 -0
- package/build/components/PieChart.js +40 -0
- package/build/components/Popover.js +40 -0
- package/build/components/PortalScope.js +8 -0
- package/build/components/Progress/CirclePercent.js +56 -0
- package/build/components/Progress/Progress.js +59 -0
- package/build/components/Progress/index.js +3 -0
- package/build/components/Radio.js +45 -0
- package/build/components/RangeCalendar.js +60 -0
- package/build/components/Select.js +162 -0
- package/build/components/Slider.js +50 -0
- package/build/components/Spinner.js +70 -0
- package/build/components/Table/Body.js +49 -0
- package/build/components/Table/Cell.js +63 -0
- package/build/components/Table/Check.js +35 -0
- package/build/components/Table/Column.js +129 -0
- package/build/components/Table/ColumnSort.js +26 -0
- package/build/components/Table/Header.js +64 -0
- package/build/components/Table/Resizer.js +25 -0
- package/build/components/Table/Row.js +84 -0
- package/build/components/Table/SortCaret.js +24 -0
- package/build/components/Table/Table.js +88 -0
- package/build/components/Table/contentStyles.js +20 -0
- package/build/components/Table/context.js +4 -0
- package/build/components/Table/index.js +2 -0
- package/build/components/Table/types.js +0 -0
- package/build/components/Tabs.js +151 -0
- package/build/components/Tag.js +71 -0
- package/build/components/Toggle.js +59 -0
- package/build/components/ToggleButton/ToggleButton.js +104 -0
- package/build/components/ToggleButton/ToggleButtonGroup.js +36 -0
- package/build/components/ToggleButton/context.js +8 -0
- package/build/components/ToggleButton/index.js +3 -0
- package/build/components/Tooltip.js +136 -0
- package/build/components/TransferList.js +234 -0
- package/build/components/Tree/Tree.js +69 -0
- package/build/components/Tree/TreeContext.js +3 -0
- package/build/components/Tree/TreeItem.js +93 -0
- package/build/components/Tree/index.js +2 -0
- package/build/components/UnstyledButton.js +8 -0
- package/build/components/Waveform.js +243 -0
- package/build/components/draftUtils.js +193 -0
- package/build/components/helpers/getIcon.js +28 -0
- package/build/components/helpers/getPopPosition.js +20 -0
- package/build/components/helpers/isPropAllowed.js +3 -0
- package/build/components/helpers/mergePadding.js +47 -0
- package/build/components/helpers/styledProps.js +34 -0
- package/build/components/typeDefs/elementTypes.js +0 -0
- package/build/components/typeDefs/inputTypes.js +0 -0
- package/build/components/typeDefs/selectionTypes.js +0 -0
- package/build/components/typeDefs/tagTypes.js +0 -0
- package/build/components/types.js +0 -0
- package/build/global-styles/GlobalStorybookStyles.js +108 -0
- package/build/global-styles/ResetStyles.js +33 -0
- package/build/global-styles/ScrollbarStyles.js +26 -0
- package/build/global-styles/ToastStyles.js +66 -0
- package/build/global-styles/index.js +4 -0
- package/build/hooks/index.js +9 -0
- package/build/hooks/useConfirm.js +91 -0
- package/build/hooks/useControlledOpenState.js +22 -0
- package/build/hooks/useCopy.js +28 -0
- package/build/hooks/useElementObserver.js +6 -0
- package/build/hooks/useEventListener.js +19 -0
- package/build/hooks/useOnClickOutside.js +21 -0
- package/build/hooks/usePrevious.js +12 -0
- package/build/hooks/useSelectAll.js +60 -0
- package/build/hooks/useWindowSize.js +25 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +2 -1
- package/build/theme/ThemeTypes.js +0 -0
- package/build/theme/common/button.js +33 -0
- package/build/theme/common/common.js +38 -0
- package/build/theme/common/index.js +4 -0
- package/build/theme/core/colors.js +77 -0
- package/build/theme/core/dark/dark.js +457 -0
- package/build/theme/core/dark/darkScale.js +36 -0
- package/build/theme/core/light/light.js +456 -0
- package/build/theme/core/light/lightScale.js +35 -0
- package/build/theme/eighties/colors.js +78 -0
- package/build/theme/eighties/dark/dark.js +457 -0
- package/build/theme/eighties/dark/darkScale.js +36 -0
- package/build/theme/eighties/light/light.js +456 -0
- package/build/theme/eighties/light/lightScale.js +35 -0
- package/build/theme/index.js +28 -0
- package/build/utils/chunk.js +13 -0
- package/build/utils/copyToClipboard.js +29 -0
- package/build/utils/flattenListOptions.js +4 -0
- package/build/utils/formatDate.js +55 -0
- package/build/utils/formatNumber.d.ts +8 -0
- package/build/utils/formatNumber.js +32 -0
- package/build/utils/index.js +6 -0
- package/build/utils/numberWithCommas.js +3 -0
- package/build/utils/range.js +11 -0
- package/package.json +14 -15
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { keyframes } from "@emotion/react";
|
|
3
|
+
import styled from "@emotion/styled";
|
|
4
|
+
import { cloneElement } from "react";
|
|
5
|
+
import { Dialog, Heading, Modal, ModalOverlay } from "react-aria-components";
|
|
6
|
+
import react_keyed_flatten_children from "react-keyed-flatten-children";
|
|
7
|
+
import { marginProps, maxWidthHeightProps, minWidthHeightProps, paddingProps } from "./helpers/styledProps.js";
|
|
8
|
+
import Icon from "./Icon/index.js";
|
|
9
|
+
import PortalScope from "./PortalScope.js";
|
|
10
|
+
const Modal_Modal = ({ children, visible, width, height, onClose, closeIcon, preventOverlayClose, overlayBlur = true, overlayColor, backgroundColor, small, noOverlay, inert, drawer, drawerDirection = 'right', scopeRef, centerX, centerY, position, top, bottom, right, left, zIndex, ...props })=>{
|
|
11
|
+
const { 'aria-label': ariaLabel, ...rest } = props;
|
|
12
|
+
const modalContent = react_keyed_flatten_children(children).map((child)=>{
|
|
13
|
+
if (child) return /*#__PURE__*/ cloneElement(child, {
|
|
14
|
+
inline: small
|
|
15
|
+
});
|
|
16
|
+
return null;
|
|
17
|
+
});
|
|
18
|
+
const handleOpenChange = (open)=>{
|
|
19
|
+
if (!open) onClose();
|
|
20
|
+
};
|
|
21
|
+
const modal = /*#__PURE__*/ jsx(Overlay, {
|
|
22
|
+
isDismissable: !preventOverlayClose,
|
|
23
|
+
isOpen: visible,
|
|
24
|
+
onOpenChange: handleOpenChange,
|
|
25
|
+
color: overlayColor,
|
|
26
|
+
noOverlay: noOverlay,
|
|
27
|
+
centerX: centerX,
|
|
28
|
+
centerY: centerY,
|
|
29
|
+
position: scopeRef ? 'absolute' : position,
|
|
30
|
+
width: scopeRef ? '100%' : void 0,
|
|
31
|
+
height: scopeRef ? '100%' : void 0,
|
|
32
|
+
top: top,
|
|
33
|
+
bottom: bottom,
|
|
34
|
+
right: right,
|
|
35
|
+
left: left,
|
|
36
|
+
zIndex: zIndex,
|
|
37
|
+
blur: overlayBlur,
|
|
38
|
+
ref: (node)=>{
|
|
39
|
+
if (!node) return;
|
|
40
|
+
if (inert) node.setAttribute('inert', '');
|
|
41
|
+
else node.removeAttribute('inert');
|
|
42
|
+
},
|
|
43
|
+
children: /*#__PURE__*/ jsx(StyledModal, {
|
|
44
|
+
drawer: drawer,
|
|
45
|
+
direction: drawerDirection,
|
|
46
|
+
children: /*#__PURE__*/ jsx(StyledDialog, {
|
|
47
|
+
"aria-label": ariaLabel,
|
|
48
|
+
children: /*#__PURE__*/ jsxs(ModalContainer, {
|
|
49
|
+
width: width,
|
|
50
|
+
height: height,
|
|
51
|
+
backgroundColor: backgroundColor,
|
|
52
|
+
small: small,
|
|
53
|
+
noOverlay: noOverlay,
|
|
54
|
+
drawer: drawer,
|
|
55
|
+
drawerDirection: drawerDirection,
|
|
56
|
+
centerX: centerX,
|
|
57
|
+
centerY: centerY,
|
|
58
|
+
...rest,
|
|
59
|
+
children: [
|
|
60
|
+
modalContent,
|
|
61
|
+
closeIcon && /*#__PURE__*/ jsx(Close, {
|
|
62
|
+
inline: small,
|
|
63
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
64
|
+
name: "close",
|
|
65
|
+
onClick: onClose,
|
|
66
|
+
pointer: true
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
return scopeRef ? /*#__PURE__*/ jsx(PortalScope, {
|
|
75
|
+
containerRef: scopeRef,
|
|
76
|
+
children: modal
|
|
77
|
+
}) : modal;
|
|
78
|
+
};
|
|
79
|
+
const Header = ({ children, ...props })=>/*#__PURE__*/ jsx(ModalHeader, {
|
|
80
|
+
slot: "title",
|
|
81
|
+
...props,
|
|
82
|
+
children: children
|
|
83
|
+
});
|
|
84
|
+
const ModalHeader = styled(Heading)(({ theme })=>({
|
|
85
|
+
color: theme.modal.color.header,
|
|
86
|
+
fontWeight: theme.font.weight.default,
|
|
87
|
+
fontSize: theme.font.size.xl,
|
|
88
|
+
margin: 0,
|
|
89
|
+
marginBottom: 8
|
|
90
|
+
}));
|
|
91
|
+
const Text = styled.div(({ theme, primary, fontSize })=>({
|
|
92
|
+
color: primary ? theme.modal.color.header : theme.modal.color.body,
|
|
93
|
+
fontSize: fontSize || theme.font.size.lg
|
|
94
|
+
}));
|
|
95
|
+
const Body = styled.div(({ height })=>({
|
|
96
|
+
height,
|
|
97
|
+
overflow: height ? 'auto' : void 0
|
|
98
|
+
}), marginProps);
|
|
99
|
+
const Footer = styled.div(({ justify = 'end', inline, gap })=>{
|
|
100
|
+
const justifyOptions = {
|
|
101
|
+
start: 'flex-start',
|
|
102
|
+
end: 'flex-end',
|
|
103
|
+
center: 'center',
|
|
104
|
+
'space-around': 'space-around',
|
|
105
|
+
'space-between': 'space-between'
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
display: 'flex',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
justifyContent: justify ? justifyOptions[justify] : void 0,
|
|
111
|
+
marginTop: inline ? void 0 : 8,
|
|
112
|
+
gap
|
|
113
|
+
};
|
|
114
|
+
}, marginProps);
|
|
115
|
+
const ModalContainer = styled.div(({ theme, width, height, backgroundColor, small, borderRadius, overflow, drawer, drawerDirection })=>({
|
|
116
|
+
display: 'flex',
|
|
117
|
+
flexDirection: small ? 'row' : 'column',
|
|
118
|
+
alignItems: small ? 'center' : void 0,
|
|
119
|
+
backgroundColor: backgroundColor || theme.modal.background,
|
|
120
|
+
color: theme.scale10,
|
|
121
|
+
boxShadow: drawer ? 'left' === drawerDirection ? '8px 0 20px rgba(0, 0, 0, 0.2)' : '-8px 0 20px rgba(0, 0, 0, 0.2)' : theme.elevation3,
|
|
122
|
+
width: width || 'max-content',
|
|
123
|
+
height: drawer ? height || '100%' : height || 'max-content',
|
|
124
|
+
borderRadius: drawer ? 0 : borderRadius || theme.size.sm,
|
|
125
|
+
padding: small ? theme.size.md : theme.size.lg,
|
|
126
|
+
overflow: overflow || 'hidden'
|
|
127
|
+
}), ({ noOverlay, drawer })=>!noOverlay && !drawer && {
|
|
128
|
+
position: 'absolute',
|
|
129
|
+
top: '50%',
|
|
130
|
+
left: '50%',
|
|
131
|
+
transform: 'translate(-50%,-50%)'
|
|
132
|
+
}, ({ centerX, centerY, drawer })=>{
|
|
133
|
+
const left = centerX ? '50%' : void 0;
|
|
134
|
+
const top = centerY ? '50%' : void 0;
|
|
135
|
+
const xPos = centerX ? '-50%' : '0';
|
|
136
|
+
const yPos = centerY ? '-50%' : '0';
|
|
137
|
+
const translate = `translate(${xPos}, ${yPos})`;
|
|
138
|
+
return (centerX || centerY) && !drawer && {
|
|
139
|
+
position: 'absolute',
|
|
140
|
+
top,
|
|
141
|
+
left,
|
|
142
|
+
transform: translate
|
|
143
|
+
};
|
|
144
|
+
}, paddingProps, minWidthHeightProps, maxWidthHeightProps);
|
|
145
|
+
const Close = styled.div({
|
|
146
|
+
display: 'flex',
|
|
147
|
+
justifyContent: 'center',
|
|
148
|
+
alignItems: 'center'
|
|
149
|
+
}, ({ inline })=>inline ? {
|
|
150
|
+
marginLeft: 16
|
|
151
|
+
} : {
|
|
152
|
+
position: 'absolute',
|
|
153
|
+
top: 8,
|
|
154
|
+
right: 8
|
|
155
|
+
});
|
|
156
|
+
const Overlay = styled(ModalOverlay)(({ color, blur, noOverlay, centerX, centerY, position, top, bottom, right, left, zIndex, width, height })=>({
|
|
157
|
+
position: position || 'fixed',
|
|
158
|
+
top: top || (left || bottom || right ? void 0 : 0),
|
|
159
|
+
left: left || (top || bottom || right ? void 0 : 0),
|
|
160
|
+
bottom,
|
|
161
|
+
right,
|
|
162
|
+
width: noOverlay && !centerX ? void 0 : width || '100vw',
|
|
163
|
+
height: noOverlay && !centerY ? void 0 : height || 'var(--visual-viewport-height)',
|
|
164
|
+
zIndex: zIndex || 100,
|
|
165
|
+
backgroundColor: noOverlay ? void 0 : color || 'rgba(0, 0, 0, 0.2)',
|
|
166
|
+
backdropFilter: blur ? `blur(${'number' == typeof blur ? blur : 4}px)` : 'none'
|
|
167
|
+
}));
|
|
168
|
+
const slideRight = keyframes({
|
|
169
|
+
from: {
|
|
170
|
+
transform: 'translateX(100%)'
|
|
171
|
+
},
|
|
172
|
+
to: {
|
|
173
|
+
transform: 'translateX(0)'
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
const slideLeft = keyframes({
|
|
177
|
+
from: {
|
|
178
|
+
transform: 'translateX(-100%)'
|
|
179
|
+
},
|
|
180
|
+
to: {
|
|
181
|
+
transform: 'translateX(0)'
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
const StyledModal = styled(Modal)(({ drawer, direction })=>drawer ? {
|
|
185
|
+
position: 'fixed',
|
|
186
|
+
top: 0,
|
|
187
|
+
bottom: 0,
|
|
188
|
+
right: 'right' === direction ? 0 : void 0,
|
|
189
|
+
left: 'left' === direction ? 0 : void 0,
|
|
190
|
+
outline: 'none',
|
|
191
|
+
display: 'flex',
|
|
192
|
+
alignItems: 'stretch',
|
|
193
|
+
'&[data-entering]': {
|
|
194
|
+
animation: `${'left' === direction ? slideLeft : slideRight} 300ms`
|
|
195
|
+
},
|
|
196
|
+
'&[data-exiting]': {
|
|
197
|
+
animation: `${'left' === direction ? slideLeft : slideRight} 200ms reverse`
|
|
198
|
+
}
|
|
199
|
+
} : {});
|
|
200
|
+
const StyledDialog = styled(Dialog)({
|
|
201
|
+
outline: 'none'
|
|
202
|
+
});
|
|
203
|
+
Header.displayName = 'Modal.Header';
|
|
204
|
+
Text.displayName = 'Modal.Text';
|
|
205
|
+
Body.displayName = 'Modal.Body';
|
|
206
|
+
Footer.displayName = 'Modal.Footer';
|
|
207
|
+
Modal_Modal.Header = Header;
|
|
208
|
+
Modal_Modal.Text = Text;
|
|
209
|
+
Modal_Modal.Body = Body;
|
|
210
|
+
Modal_Modal.Footer = Footer;
|
|
211
|
+
const components_Modal = Modal_Modal;
|
|
212
|
+
export { components_Modal as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { keyframes } from "@emotion/react";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { Popover } from "react-aria-components";
|
|
4
|
+
const slide = keyframes({
|
|
5
|
+
from: {
|
|
6
|
+
transform: 'var(--origin)',
|
|
7
|
+
opacity: 0
|
|
8
|
+
},
|
|
9
|
+
to: {
|
|
10
|
+
transform: 'translateY(0)',
|
|
11
|
+
opacity: 1
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const time = '300ms cubic-bezier(0.860, 0.000, 0.070, 1.000)';
|
|
15
|
+
const MotionPopover = styled(Popover)({
|
|
16
|
+
'&[data-placement="bottom"]': {
|
|
17
|
+
'--origin': 'translateY(-4px)'
|
|
18
|
+
},
|
|
19
|
+
'&[data-placement="top"]': {
|
|
20
|
+
'--origin': 'translateY(4px)'
|
|
21
|
+
},
|
|
22
|
+
'&[data-placement="right"]': {
|
|
23
|
+
'--origin': 'translateX(-4px)'
|
|
24
|
+
},
|
|
25
|
+
'&[data-placement="left"]': {
|
|
26
|
+
'--origin': 'translateX(4px)'
|
|
27
|
+
},
|
|
28
|
+
'&[data-entering]': {
|
|
29
|
+
animation: `${slide} ${time}`,
|
|
30
|
+
pointerEvents: 'none'
|
|
31
|
+
},
|
|
32
|
+
'&[data-exiting]': {
|
|
33
|
+
animation: `${slide} ${time} reverse`,
|
|
34
|
+
pointerEvents: 'none'
|
|
35
|
+
},
|
|
36
|
+
outline: 'none'
|
|
37
|
+
});
|
|
38
|
+
const components_MotionPopover = MotionPopover;
|
|
39
|
+
export { components_MotionPopover as default };
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from "@emotion/react";
|
|
3
|
+
import styled from "@emotion/styled";
|
|
4
|
+
import { useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
5
|
+
import { useOnClickOutside } from "../../hooks/index.js";
|
|
6
|
+
import Checkbox from "../Checkbox.js";
|
|
7
|
+
import { marginProps, paddingProps as styledProps_js_paddingProps } from "../helpers/styledProps.js";
|
|
8
|
+
import Icon from "../Icon/index.js";
|
|
9
|
+
import Tag from "../Tag.js";
|
|
10
|
+
import SearchDropdown from "./SearchDropdown.js";
|
|
11
|
+
const MultiSelect = ({ options, items, listLabel, listText, itemsTitle, maxItems, placeholder, width, accepts, disabled, hideItemsInfo, compact, backgroundColor, borderless, autoFocus, embedded, invalid, maxListHeight, maxMenuHeight, onToggleAllItems, addItem, removeItem, onTextChange, ref, ...props })=>{
|
|
12
|
+
const [expanded, setExpanded] = useState(autoFocus || false);
|
|
13
|
+
const [error, setError] = useState(false);
|
|
14
|
+
const { color, font, input: inputColors } = useTheme();
|
|
15
|
+
const clickOutsideRef = useOnClickOutside(()=>setExpanded(false), expanded);
|
|
16
|
+
const dropdownTriggerRef = useRef(null);
|
|
17
|
+
const dropdownRef = useRef(null);
|
|
18
|
+
const listRef = useRef(null);
|
|
19
|
+
const collapse = compact && !!listLabel;
|
|
20
|
+
const { padding, paddingTop, paddingRight, paddingBottom, paddingLeft, ...rest } = props;
|
|
21
|
+
const paddingProps = {
|
|
22
|
+
padding,
|
|
23
|
+
paddingTop,
|
|
24
|
+
paddingRight,
|
|
25
|
+
paddingBottom,
|
|
26
|
+
paddingLeft
|
|
27
|
+
};
|
|
28
|
+
const scrollToInput = ()=>{
|
|
29
|
+
if (listRef.current && !expanded && maxListHeight) setTimeout(()=>{
|
|
30
|
+
listRef.current?.scrollTo({
|
|
31
|
+
top: listRef.current.scrollHeight,
|
|
32
|
+
behavior: 'smooth'
|
|
33
|
+
});
|
|
34
|
+
}, 10);
|
|
35
|
+
};
|
|
36
|
+
const focusInput = ()=>{
|
|
37
|
+
const { current: input } = dropdownRef;
|
|
38
|
+
if (!expanded && !listLabel) setExpanded(true);
|
|
39
|
+
input?.focus();
|
|
40
|
+
scrollToInput();
|
|
41
|
+
};
|
|
42
|
+
const blurInput = ()=>{
|
|
43
|
+
const { current: input } = dropdownRef;
|
|
44
|
+
if (input) input.blur();
|
|
45
|
+
};
|
|
46
|
+
useImperativeHandle(ref, ()=>({
|
|
47
|
+
focus: focusInput,
|
|
48
|
+
blur: blurInput
|
|
49
|
+
}));
|
|
50
|
+
const handleContainerClick = (event)=>{
|
|
51
|
+
event.stopPropagation();
|
|
52
|
+
focusInput();
|
|
53
|
+
};
|
|
54
|
+
const toggleExpand = (event)=>{
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
setExpanded(!expanded);
|
|
57
|
+
};
|
|
58
|
+
useEffect(()=>{
|
|
59
|
+
if (!expanded) blurInput();
|
|
60
|
+
setError(false);
|
|
61
|
+
}, [
|
|
62
|
+
expanded
|
|
63
|
+
]);
|
|
64
|
+
const maxItemsReached = maxItems ? items.length >= maxItems : void 0;
|
|
65
|
+
const disableInput = disabled || maxItemsReached;
|
|
66
|
+
const listComponent = ()=>{
|
|
67
|
+
const list = /*#__PURE__*/ jsxs(ItemList, {
|
|
68
|
+
expanded: expanded,
|
|
69
|
+
labeled: !!listLabel,
|
|
70
|
+
maxHeight: maxListHeight,
|
|
71
|
+
ref: listRef,
|
|
72
|
+
children: [
|
|
73
|
+
listText && /*#__PURE__*/ jsx(ListText, {
|
|
74
|
+
expanded: expanded,
|
|
75
|
+
labeled: !!listLabel,
|
|
76
|
+
children: listText
|
|
77
|
+
}),
|
|
78
|
+
items.map((item)=>/*#__PURE__*/ jsx(Tag, {
|
|
79
|
+
...item,
|
|
80
|
+
removable: expanded,
|
|
81
|
+
onRemove: ()=>removeItem(item),
|
|
82
|
+
disabled: disabled
|
|
83
|
+
}, item.id)),
|
|
84
|
+
/*#__PURE__*/ jsx(SearchDropdown, {
|
|
85
|
+
"aria-label": "MultiSelect search",
|
|
86
|
+
options: options,
|
|
87
|
+
items: items,
|
|
88
|
+
triggerRef: dropdownTriggerRef,
|
|
89
|
+
placeholder: disabled || items.length > 0 ? ' ' : placeholder || 'Search...',
|
|
90
|
+
placeholderColor: inputColors.color.placeholder,
|
|
91
|
+
fontSize: font.size.md,
|
|
92
|
+
addItem: addItem,
|
|
93
|
+
removeItem: removeItem,
|
|
94
|
+
onTextChange: onTextChange,
|
|
95
|
+
disabled: disableInput,
|
|
96
|
+
autoFocus: autoFocus,
|
|
97
|
+
ref: dropdownRef,
|
|
98
|
+
accepts: accepts,
|
|
99
|
+
maxHeight: maxMenuHeight,
|
|
100
|
+
onValidChange: (valid)=>setError(!valid)
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
return list;
|
|
105
|
+
};
|
|
106
|
+
return /*#__PURE__*/ jsxs(Container, {
|
|
107
|
+
width: width,
|
|
108
|
+
ref: clickOutsideRef,
|
|
109
|
+
labeled: !!listLabel,
|
|
110
|
+
disabled: disabled,
|
|
111
|
+
collapse: collapse,
|
|
112
|
+
onClick: handleContainerClick,
|
|
113
|
+
embedded: embedded,
|
|
114
|
+
...rest,
|
|
115
|
+
children: [
|
|
116
|
+
/*#__PURE__*/ jsxs(InnerContainer, {
|
|
117
|
+
collapse: collapse,
|
|
118
|
+
ref: dropdownTriggerRef,
|
|
119
|
+
expanded: expanded && items.length > 0,
|
|
120
|
+
error: invalid || error,
|
|
121
|
+
labeled: !!listLabel,
|
|
122
|
+
backgroundColor: backgroundColor,
|
|
123
|
+
borderless: borderless,
|
|
124
|
+
embedded: embedded,
|
|
125
|
+
disabled: disabled,
|
|
126
|
+
...paddingProps,
|
|
127
|
+
children: [
|
|
128
|
+
listLabel ? /*#__PURE__*/ jsx(ListLabel, {
|
|
129
|
+
collapse: collapse,
|
|
130
|
+
children: listLabel
|
|
131
|
+
}) : listComponent(),
|
|
132
|
+
/*#__PURE__*/ jsxs(Meta, {
|
|
133
|
+
children: [
|
|
134
|
+
onToggleAllItems && expanded && /*#__PURE__*/ jsx(Checkbox, {
|
|
135
|
+
label: "All",
|
|
136
|
+
labelPosition: "right",
|
|
137
|
+
gap: 4,
|
|
138
|
+
checked: items.length === options.length,
|
|
139
|
+
partial: items.length > 0 && items.length < options.length,
|
|
140
|
+
onChange: onToggleAllItems
|
|
141
|
+
}),
|
|
142
|
+
maxItems && !hideItemsInfo && /*#__PURE__*/ jsx(ItemCount, {
|
|
143
|
+
children: disabled && itemsTitle ? /*#__PURE__*/ jsxs(Fragment, {
|
|
144
|
+
children: [
|
|
145
|
+
items.length,
|
|
146
|
+
" ",
|
|
147
|
+
itemsTitle
|
|
148
|
+
]
|
|
149
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
150
|
+
children: [
|
|
151
|
+
/*#__PURE__*/ jsx(Count, {
|
|
152
|
+
error: items.length > maxItems,
|
|
153
|
+
children: items.length
|
|
154
|
+
}),
|
|
155
|
+
"/",
|
|
156
|
+
maxItems,
|
|
157
|
+
" ",
|
|
158
|
+
itemsTitle
|
|
159
|
+
]
|
|
160
|
+
})
|
|
161
|
+
}),
|
|
162
|
+
items.length > 0 && /*#__PURE__*/ jsx(Icon, {
|
|
163
|
+
name: expanded ? 'chevron-up' : 'chevron-down',
|
|
164
|
+
color: color.brand,
|
|
165
|
+
pointer: true,
|
|
166
|
+
onClick: toggleExpand
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
})
|
|
170
|
+
]
|
|
171
|
+
}),
|
|
172
|
+
listLabel && expanded && listComponent()
|
|
173
|
+
]
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
const Container = styled.div(({ width, disabled, labeled, collapse, embedded })=>{
|
|
177
|
+
const embeddedHeight = collapse ? 62 : 41;
|
|
178
|
+
return {
|
|
179
|
+
width,
|
|
180
|
+
minWidth: 200,
|
|
181
|
+
height: embedded ? embeddedHeight : void 0,
|
|
182
|
+
position: 'relative',
|
|
183
|
+
cursor: labeled || disabled ? 'default' : 'text'
|
|
184
|
+
};
|
|
185
|
+
}, marginProps);
|
|
186
|
+
const InnerContainer = styled.div(({ theme, expanded, error, labeled, collapse, backgroundColor, borderless, embedded, disabled })=>({
|
|
187
|
+
display: 'grid',
|
|
188
|
+
gridTemplateColumns: collapse ? void 0 : '1fr auto',
|
|
189
|
+
alignItems: expanded && !labeled ? 'flex-start' : 'center',
|
|
190
|
+
columnGap: 24,
|
|
191
|
+
width: '100%',
|
|
192
|
+
minHeight: 41,
|
|
193
|
+
position: embedded ? 'absolute' : 'relative',
|
|
194
|
+
top: embedded ? 0 : void 0,
|
|
195
|
+
left: embedded ? 0 : void 0,
|
|
196
|
+
backgroundColor: backgroundColor || embedded ? theme.background0 : theme.input.background.default,
|
|
197
|
+
zIndex: expanded && !embedded ? 1 : void 0,
|
|
198
|
+
borderBottom: error ? `1px solid ${theme.color.error}` : theme.defaultBorder,
|
|
199
|
+
border: borderless || !embedded ? 'none' : void 0,
|
|
200
|
+
borderRadius: embedded ? void 0 : 4,
|
|
201
|
+
padding: '8px 16px',
|
|
202
|
+
'&:focus-within': {
|
|
203
|
+
backgroundColor: backgroundColor || embedded || disabled || error ? void 0 : theme.input.background.focused
|
|
204
|
+
},
|
|
205
|
+
'&:hover:not(:focus-within)': {
|
|
206
|
+
backgroundColor: backgroundColor || embedded || disabled || error ? void 0 : theme.input.background.hover
|
|
207
|
+
}
|
|
208
|
+
}), ({ theme, error, embedded })=>({
|
|
209
|
+
backgroundColor: error && !embedded ? theme.input.background.invalid : void 0,
|
|
210
|
+
'&:hover:not(:focus-within)': {
|
|
211
|
+
backgroundColor: error && !embedded ? theme.input.background.invalidHover : void 0
|
|
212
|
+
}
|
|
213
|
+
}), styledProps_js_paddingProps);
|
|
214
|
+
const ListLabel = styled.div(({ theme, collapse })=>({
|
|
215
|
+
textAlign: collapse ? void 0 : 'center',
|
|
216
|
+
fontSize: theme.font.size.md,
|
|
217
|
+
overflow: 'hidden',
|
|
218
|
+
whiteSpace: 'nowrap',
|
|
219
|
+
textOverflow: 'ellipsis'
|
|
220
|
+
}));
|
|
221
|
+
const ItemList = styled.div(({ theme, expanded, maxHeight })=>({
|
|
222
|
+
display: 'flex',
|
|
223
|
+
alignItems: 'center',
|
|
224
|
+
justifyContent: 'flex-start',
|
|
225
|
+
width: '100%',
|
|
226
|
+
maxHeight,
|
|
227
|
+
overflow: maxHeight ? 'auto' : 'hidden',
|
|
228
|
+
pointerEvents: expanded ? void 0 : 'none',
|
|
229
|
+
flexWrap: expanded ? 'wrap' : void 0,
|
|
230
|
+
gap: theme.size.sm,
|
|
231
|
+
'& > *': {
|
|
232
|
+
flexShrink: 0
|
|
233
|
+
}
|
|
234
|
+
}), ({ theme, labeled, expanded })=>labeled && expanded ? {
|
|
235
|
+
backgroundColor: theme.background0,
|
|
236
|
+
position: 'absolute',
|
|
237
|
+
top: '100%',
|
|
238
|
+
zIndex: 1,
|
|
239
|
+
padding: '8px 0px',
|
|
240
|
+
borderBottom: theme.defaultBorder
|
|
241
|
+
} : {});
|
|
242
|
+
const ListText = styled.div(({ theme, expanded, labeled })=>({
|
|
243
|
+
fontSize: theme.font.size.sm,
|
|
244
|
+
fontWeight: theme.font.weight.medium,
|
|
245
|
+
color: theme.scale8,
|
|
246
|
+
paddingLeft: expanded && labeled ? 16 : void 0
|
|
247
|
+
}));
|
|
248
|
+
const Meta = styled.div(({ theme: { size } })=>({
|
|
249
|
+
display: 'flex',
|
|
250
|
+
alignItems: 'center',
|
|
251
|
+
columnGap: size.sm,
|
|
252
|
+
whiteSpace: 'nowrap'
|
|
253
|
+
}));
|
|
254
|
+
const Count = styled.div(({ theme, error })=>({
|
|
255
|
+
color: error ? theme.color.error : theme.scale8
|
|
256
|
+
}));
|
|
257
|
+
const ItemCount = styled.div(({ theme })=>({
|
|
258
|
+
display: 'flex',
|
|
259
|
+
color: theme.scale4,
|
|
260
|
+
fontSize: theme.font.size.sm
|
|
261
|
+
}));
|
|
262
|
+
const MultiSelect_MultiSelect = MultiSelect;
|
|
263
|
+
export { MultiSelect_MultiSelect as default };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { keyframes } from "@emotion/react";
|
|
3
|
+
import styled from "@emotion/styled";
|
|
4
|
+
import { useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { ComboBox } from "react-aria-components";
|
|
6
|
+
import flattenListOptions from "../../utils/flattenListOptions.js";
|
|
7
|
+
import Input from "../Inputs/helpers/Input.js";
|
|
8
|
+
import isAcceptable from "../Inputs/helpers/isAcceptable.js";
|
|
9
|
+
import useDynamicWidth from "../Inputs/helpers/useDynamicWidth.js";
|
|
10
|
+
import ListOptions from "../ListBoxParts/ListOptions.js";
|
|
11
|
+
import MotionPopover from "../MotionPopover.js";
|
|
12
|
+
const SearchDropdown_SearchDropdown = ({ options, items, triggerRef, placeholder, placeholderColor, fontSize, position, fixedPosition, maxHeight, disabled, accepts, addItem, removeItem, afterShow, afterHide, onTextChange, onValidChange, ref, ...props })=>{
|
|
13
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
14
|
+
const [filteredOptions, setFilteredOptions] = useState([]);
|
|
15
|
+
const [inputText, setInputText] = useState('');
|
|
16
|
+
const [invalidInput, setInvalidInput] = useState(false);
|
|
17
|
+
const [inputWidth, HiddenWidthEl] = useDynamicWidth({
|
|
18
|
+
value: inputText,
|
|
19
|
+
placeholder,
|
|
20
|
+
fontSize
|
|
21
|
+
});
|
|
22
|
+
const refObject = triggerRef && 'current' in triggerRef ? triggerRef : void 0;
|
|
23
|
+
useEffect(()=>{
|
|
24
|
+
if (items.length > 0) {
|
|
25
|
+
const filtered = options.filter((option)=>!items.some((item)=>item.id === option.id));
|
|
26
|
+
setFilteredOptions(filtered);
|
|
27
|
+
} else setFilteredOptions(options);
|
|
28
|
+
}, [
|
|
29
|
+
items
|
|
30
|
+
]);
|
|
31
|
+
const handleValidity = (valid)=>{
|
|
32
|
+
if (onValidChange) onValidChange(valid);
|
|
33
|
+
setInvalidInput(!valid);
|
|
34
|
+
};
|
|
35
|
+
const handleInputChange = (value)=>{
|
|
36
|
+
if (onTextChange) onTextChange(value);
|
|
37
|
+
setInputText(value);
|
|
38
|
+
handleValidity(true);
|
|
39
|
+
};
|
|
40
|
+
const flatOptions = useMemo(()=>flattenListOptions(options), [
|
|
41
|
+
options
|
|
42
|
+
]);
|
|
43
|
+
const handleSelect = (val)=>{
|
|
44
|
+
if (!val) return;
|
|
45
|
+
const item = flatOptions.find((option)=>option.id === val);
|
|
46
|
+
if (item) {
|
|
47
|
+
addItem(item);
|
|
48
|
+
setInputText('');
|
|
49
|
+
handleValidity(true);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const handleCustomValue = ()=>{
|
|
53
|
+
if (isOpen) return;
|
|
54
|
+
if (!accepts || !inputText) return void setInputText('');
|
|
55
|
+
const allowed = 'function' == typeof accepts ? accepts(inputText) : isAcceptable(inputText, accepts);
|
|
56
|
+
if (allowed) {
|
|
57
|
+
addItem({
|
|
58
|
+
id: inputText,
|
|
59
|
+
value: inputText
|
|
60
|
+
});
|
|
61
|
+
setInputText('');
|
|
62
|
+
handleValidity(true);
|
|
63
|
+
} else handleValidity(false);
|
|
64
|
+
};
|
|
65
|
+
const handleOpenChange = (show)=>{
|
|
66
|
+
setIsOpen(show);
|
|
67
|
+
if (afterShow && show) afterShow();
|
|
68
|
+
if (afterHide && !show) afterHide();
|
|
69
|
+
};
|
|
70
|
+
const handleKeyDown = (event)=>{
|
|
71
|
+
const { key, target, altKey, ctrlKey, metaKey } = event;
|
|
72
|
+
const { value: text } = target;
|
|
73
|
+
if (altKey || ctrlKey || metaKey || !key) return;
|
|
74
|
+
switch(key){
|
|
75
|
+
case 'Backspace':
|
|
76
|
+
if (!text && items.length > 0) {
|
|
77
|
+
const lastItem = items[items.length - 1];
|
|
78
|
+
removeItem(lastItem);
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
case 'Enter':
|
|
82
|
+
handleCustomValue();
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return /*#__PURE__*/ jsxs(ComboRoot, {
|
|
89
|
+
onOpenChange: handleOpenChange,
|
|
90
|
+
menuTrigger: "focus",
|
|
91
|
+
inputValue: inputText,
|
|
92
|
+
onInputChange: handleInputChange,
|
|
93
|
+
onSelectionChange: handleSelect,
|
|
94
|
+
onBlur: handleCustomValue,
|
|
95
|
+
isDisabled: disabled,
|
|
96
|
+
shouldFocusWrap: true,
|
|
97
|
+
selectedKey: "",
|
|
98
|
+
allowsCustomValue: !!accepts,
|
|
99
|
+
...props,
|
|
100
|
+
children: [
|
|
101
|
+
/*#__PURE__*/ jsx(InputShakeContainer, {
|
|
102
|
+
shake: invalidInput,
|
|
103
|
+
children: /*#__PURE__*/ jsx(Input, {
|
|
104
|
+
placeholder: placeholder,
|
|
105
|
+
placeholderColor: placeholderColor,
|
|
106
|
+
fontSize: fontSize,
|
|
107
|
+
isDisabled: disabled,
|
|
108
|
+
onKeyDown: handleKeyDown,
|
|
109
|
+
ref: ref,
|
|
110
|
+
width: inputWidth
|
|
111
|
+
})
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ jsx(HiddenWidthEl, {}),
|
|
114
|
+
/*#__PURE__*/ jsx(MotionPopover, {
|
|
115
|
+
triggerRef: refObject,
|
|
116
|
+
offset: 2,
|
|
117
|
+
placement: position,
|
|
118
|
+
shouldFlip: fixedPosition ? false : void 0,
|
|
119
|
+
maxHeight: maxHeight,
|
|
120
|
+
children: ({ isEntering, isExiting })=>/*#__PURE__*/ jsx(ListOptions, {
|
|
121
|
+
options: filteredOptions,
|
|
122
|
+
width: refObject?.current?.offsetWidth,
|
|
123
|
+
readOnly: isEntering || isExiting
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
const ComboRoot = styled(ComboBox)({
|
|
130
|
+
width: 'auto'
|
|
131
|
+
});
|
|
132
|
+
const shakeAnimation = keyframes({
|
|
133
|
+
'10%': {
|
|
134
|
+
transform: 'translate3d(-1px, 0, 0)'
|
|
135
|
+
},
|
|
136
|
+
'30%': {
|
|
137
|
+
transform: 'translate3d(2px, 0, 0)'
|
|
138
|
+
},
|
|
139
|
+
'50%': {
|
|
140
|
+
transform: 'translate3d(-2px, 0, 0)'
|
|
141
|
+
},
|
|
142
|
+
'70%': {
|
|
143
|
+
transform: 'translate3d(2px, 0, 0)'
|
|
144
|
+
},
|
|
145
|
+
'90%': {
|
|
146
|
+
transform: 'translate3d(-1px, 0, 0)'
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
const InputShakeContainer = styled.div(({ shake })=>({
|
|
150
|
+
'& input': {
|
|
151
|
+
animation: shake ? `${shakeAnimation} .5s linear` : void 0
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
const SearchDropdown = SearchDropdown_SearchDropdown;
|
|
155
|
+
export { SearchDropdown as default };
|