@wavv/ui 2.2.2-alpha.4 → 2.2.2-alpha.6
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.js +79 -12348
- 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/index.js +6 -0
- package/build/utils/numberWithCommas.js +3 -0
- package/build/utils/range.js +11 -0
- package/package.json +6 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { GridListSection } from "react-aria-components";
|
|
3
|
+
import GridListHeader from "./GridListHeader.js";
|
|
4
|
+
const GridSection = ({ id, title, children })=>/*#__PURE__*/ jsxs(GridListSection, {
|
|
5
|
+
id: id,
|
|
6
|
+
children: [
|
|
7
|
+
title && /*#__PURE__*/ jsx(GridListHeader, {
|
|
8
|
+
children: title
|
|
9
|
+
}),
|
|
10
|
+
children
|
|
11
|
+
]
|
|
12
|
+
});
|
|
13
|
+
const ListHelpers_GridListSection = GridSection;
|
|
14
|
+
export { ListHelpers_GridListSection as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { Text } from "react-aria-components";
|
|
4
|
+
const ItemHeaderBody_ItemHeaderBody = ({ header, body, inline, disabled, isGridItem })=>/*#__PURE__*/ jsxs(HeaderBodyContainer, {
|
|
5
|
+
inline: inline,
|
|
6
|
+
children: [
|
|
7
|
+
/*#__PURE__*/ jsx(ItemHeader, {
|
|
8
|
+
slot: isGridItem ? void 0 : 'label',
|
|
9
|
+
disabled: disabled,
|
|
10
|
+
children: header
|
|
11
|
+
}),
|
|
12
|
+
/*#__PURE__*/ jsx(ItemSubtext, {
|
|
13
|
+
slot: "description",
|
|
14
|
+
disabled: disabled,
|
|
15
|
+
children: body
|
|
16
|
+
})
|
|
17
|
+
]
|
|
18
|
+
});
|
|
19
|
+
const HeaderBodyContainer = styled.div(({ inline })=>({
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: inline ? 'row' : 'column',
|
|
22
|
+
alignItems: inline ? 'center' : void 0,
|
|
23
|
+
gap: inline ? 8 : void 0
|
|
24
|
+
}));
|
|
25
|
+
const ItemHeader = styled(Text)(({ theme, disabled })=>({
|
|
26
|
+
fontSize: theme.font.size.md,
|
|
27
|
+
color: disabled ? theme.scale4 : theme.scale10,
|
|
28
|
+
cursor: disabled ? 'inherit' : void 0
|
|
29
|
+
}));
|
|
30
|
+
const ItemSubtext = styled(Text)(({ theme, disabled })=>({
|
|
31
|
+
fontSize: theme.font.size.sm,
|
|
32
|
+
color: disabled ? theme.scale4 : theme.scale6,
|
|
33
|
+
cursor: disabled ? 'inherit' : void 0
|
|
34
|
+
}));
|
|
35
|
+
const ItemHeaderBody = ItemHeaderBody_ItemHeaderBody;
|
|
36
|
+
export { ItemHeaderBody as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { Header } from "react-aria-components";
|
|
3
|
+
const ListHeader = styled(Header)(({ theme })=>({
|
|
4
|
+
backgroundColor: theme.scale0,
|
|
5
|
+
padding: '0 16px',
|
|
6
|
+
color: theme.scale6,
|
|
7
|
+
fontWeight: theme.font.weight.medium,
|
|
8
|
+
pointerEvents: 'none',
|
|
9
|
+
'&:hover': {
|
|
10
|
+
backgroundColor: theme.scale0
|
|
11
|
+
}
|
|
12
|
+
}));
|
|
13
|
+
const ListHelpers_ListHeader = ListHeader;
|
|
14
|
+
export { ListHelpers_ListHeader as default };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import isPropAllowed from "../helpers/isPropAllowed.js";
|
|
2
|
+
const preventProps = {
|
|
3
|
+
shouldForwardProp: (prop)=>isPropAllowed(prop, [
|
|
4
|
+
'selected',
|
|
5
|
+
'noSelect',
|
|
6
|
+
'contentPosition',
|
|
7
|
+
'color',
|
|
8
|
+
'accented'
|
|
9
|
+
])
|
|
10
|
+
};
|
|
11
|
+
const baseStyles = ({ theme: { optionItem, scale4 }, color, accented, selected, disabled, noSelect = false })=>{
|
|
12
|
+
const textColor = accented ? optionItem.color.accent : optionItem.color.inactive;
|
|
13
|
+
return {
|
|
14
|
+
border: 'none',
|
|
15
|
+
padding: '4px 16px',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
userSelect: 'none',
|
|
19
|
+
position: 'relative',
|
|
20
|
+
color: disabled ? scale4 : color || textColor,
|
|
21
|
+
cursor: disabled || noSelect ? 'inherit' : 'pointer',
|
|
22
|
+
pointerEvents: disabled || noSelect ? 'none' : 'auto',
|
|
23
|
+
backgroundColor: !noSelect && selected ? optionItem.background.active : optionItem.background.inactive,
|
|
24
|
+
'&:hover, &[data-hovered], &[data-focused]': {
|
|
25
|
+
backgroundColor: disabled || noSelect ? optionItem.background.inactive : optionItem.background.hover
|
|
26
|
+
},
|
|
27
|
+
'&:focus': {
|
|
28
|
+
outline: 'none',
|
|
29
|
+
backgroundColor: optionItem.background.hover
|
|
30
|
+
},
|
|
31
|
+
'&[data-selected]': {
|
|
32
|
+
backgroundColor: optionItem.background.active
|
|
33
|
+
},
|
|
34
|
+
'&[data-disabled="true"], &[data-disabled="true"]:hover': {
|
|
35
|
+
color: scale4,
|
|
36
|
+
backgroundColor: optionItem.background.inactive,
|
|
37
|
+
cursor: 'inherit'
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const positionStyles = ({ contentPosition })=>{
|
|
42
|
+
const position = 'start' === contentPosition || 'end' === contentPosition ? `flex-${contentPosition}` : contentPosition;
|
|
43
|
+
return {
|
|
44
|
+
justifyContent: position
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const listItemStyles = [
|
|
48
|
+
baseStyles,
|
|
49
|
+
positionStyles
|
|
50
|
+
];
|
|
51
|
+
const ListItemStyles = listItemStyles;
|
|
52
|
+
export { ListItemStyles as default, preventProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import isPropAllowed from "../helpers/isPropAllowed.js";
|
|
2
|
+
const preventProps = {
|
|
3
|
+
shouldForwardProp: (prop)=>isPropAllowed(prop, [
|
|
4
|
+
'textOnly'
|
|
5
|
+
])
|
|
6
|
+
};
|
|
7
|
+
const baseStyles = ({ width, textOnly })=>({
|
|
8
|
+
width: textOnly ? 'max-content' : width || '100%'
|
|
9
|
+
});
|
|
10
|
+
const rootStyles = [
|
|
11
|
+
baseStyles
|
|
12
|
+
];
|
|
13
|
+
const ListRootStyles = rootStyles;
|
|
14
|
+
export { ListRootStyles as default, preventProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ListBoxSection } from "react-aria-components";
|
|
3
|
+
import ListHeader from "./ListHeader.js";
|
|
4
|
+
const ListSection_ListSection = ({ id, title, children })=>/*#__PURE__*/ jsxs(ListBoxSection, {
|
|
5
|
+
id: id,
|
|
6
|
+
children: [
|
|
7
|
+
title && /*#__PURE__*/ jsx(ListHeader, {
|
|
8
|
+
children: title
|
|
9
|
+
}),
|
|
10
|
+
children
|
|
11
|
+
]
|
|
12
|
+
});
|
|
13
|
+
const ListSection = ListSection_ListSection;
|
|
14
|
+
export { ListSection as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import isPropAllowed from "../helpers/isPropAllowed.js";
|
|
2
|
+
const preventProps = {
|
|
3
|
+
shouldForwardProp: (prop)=>isPropAllowed(prop, [
|
|
4
|
+
'zIndex',
|
|
5
|
+
'autoWidth'
|
|
6
|
+
])
|
|
7
|
+
};
|
|
8
|
+
const baseStyles = ({ theme, width, zIndex, autoWidth, readOnly, background })=>({
|
|
9
|
+
background: background || theme.options.background,
|
|
10
|
+
backdropFilter: theme.options.backdropFilter,
|
|
11
|
+
borderRadius: 4,
|
|
12
|
+
boxShadow: theme.elevation3,
|
|
13
|
+
boxSizing: 'border-box',
|
|
14
|
+
fontFamily: theme.font.family.default,
|
|
15
|
+
fontSize: theme.font.size.md,
|
|
16
|
+
overflowY: 'auto',
|
|
17
|
+
width: width || (autoWidth ? 'max-content' : 'var(--trigger-width)'),
|
|
18
|
+
maxHeight: 'inherit',
|
|
19
|
+
zIndex,
|
|
20
|
+
outline: 'none',
|
|
21
|
+
'& > div': {
|
|
22
|
+
pointerEvents: readOnly ? 'none' : void 0
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const listStyles = [
|
|
26
|
+
baseStyles
|
|
27
|
+
];
|
|
28
|
+
const ListStyles = listStyles;
|
|
29
|
+
export { ListStyles as default, preventProps };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import react, { cloneElement, useState } from "react";
|
|
4
|
+
import react_keyed_flatten_children from "react-keyed-flatten-children";
|
|
5
|
+
import { paddingProps } from "./helpers/styledProps.js";
|
|
6
|
+
import Icon from "./Icon/index.js";
|
|
7
|
+
const Menu = ({ vertical, backgroundColor, children, ...rest })=>{
|
|
8
|
+
const getChildren = ()=>{
|
|
9
|
+
if (children) return react_keyed_flatten_children(children).map((child)=>{
|
|
10
|
+
if (child) return /*#__PURE__*/ cloneElement(child, {
|
|
11
|
+
vertical,
|
|
12
|
+
backgroundColor
|
|
13
|
+
});
|
|
14
|
+
return null;
|
|
15
|
+
});
|
|
16
|
+
return null;
|
|
17
|
+
};
|
|
18
|
+
return /*#__PURE__*/ jsx(MenuComponent, {
|
|
19
|
+
vertical: vertical,
|
|
20
|
+
backgroundColor: backgroundColor,
|
|
21
|
+
role: "menu",
|
|
22
|
+
...rest,
|
|
23
|
+
children: getChildren()
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const Item = ({ vertical, selected, disabled, contentPosition, onClick, id, children, indent = 1, ...rest })=>/*#__PURE__*/ jsx(MenuItem, {
|
|
27
|
+
vertical: vertical,
|
|
28
|
+
selected: selected,
|
|
29
|
+
disabled: disabled,
|
|
30
|
+
contentPosition: contentPosition,
|
|
31
|
+
onClick: onClick,
|
|
32
|
+
id: id,
|
|
33
|
+
role: "menuitem",
|
|
34
|
+
indent: indent,
|
|
35
|
+
...rest,
|
|
36
|
+
children: children
|
|
37
|
+
});
|
|
38
|
+
Item.displayName = 'Menu.Item';
|
|
39
|
+
const Group = ({ label, defaultOpen, vertical, selected, disabled, contentPosition, onClick, id, children, indent = 1, backgroundColor, className })=>{
|
|
40
|
+
const [isOpen, setIsOpen] = useState(defaultOpen || selected);
|
|
41
|
+
const getChildren = (_children)=>{
|
|
42
|
+
const childItems = react_keyed_flatten_children(_children);
|
|
43
|
+
return childItems.map((child)=>{
|
|
44
|
+
if (/*#__PURE__*/ react.isValidElement(child)) {
|
|
45
|
+
const childEl = child;
|
|
46
|
+
if (childEl.props.selected && !isOpen) setIsOpen(true);
|
|
47
|
+
if (Array.isArray(childEl.props.children)) getChildren(childEl.props.children);
|
|
48
|
+
return /*#__PURE__*/ cloneElement(child, {
|
|
49
|
+
vertical,
|
|
50
|
+
indent: indent + 1,
|
|
51
|
+
backgroundColor
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const subMenuItems = getChildren(children);
|
|
58
|
+
const toggle = ()=>setIsOpen((prevOpen)=>!prevOpen);
|
|
59
|
+
const handleToggleClick = (event)=>{
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
toggle();
|
|
62
|
+
};
|
|
63
|
+
const handleClick = (event)=>{
|
|
64
|
+
if (onClick) {
|
|
65
|
+
onClick(event);
|
|
66
|
+
if (!isOpen) toggle();
|
|
67
|
+
} else toggle();
|
|
68
|
+
};
|
|
69
|
+
return /*#__PURE__*/ jsxs(MenuGroup, {
|
|
70
|
+
backgroundColor: backgroundColor,
|
|
71
|
+
className: className,
|
|
72
|
+
children: [
|
|
73
|
+
/*#__PURE__*/ jsxs(MenuItem, {
|
|
74
|
+
vertical: vertical,
|
|
75
|
+
selected: selected || false,
|
|
76
|
+
disabled: disabled,
|
|
77
|
+
contentPosition: contentPosition,
|
|
78
|
+
onClick: handleClick,
|
|
79
|
+
id: id,
|
|
80
|
+
role: "menuitem",
|
|
81
|
+
indent: indent,
|
|
82
|
+
children: [
|
|
83
|
+
label,
|
|
84
|
+
/*#__PURE__*/ jsx(ToggleContainer, {
|
|
85
|
+
onClick: handleToggleClick,
|
|
86
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
87
|
+
name: isOpen ? 'chevron-up' : 'chevron-down',
|
|
88
|
+
pointer: true
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}),
|
|
93
|
+
isOpen && subMenuItems
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
Group.displayName = 'Menu.Group';
|
|
98
|
+
const MenuComponent = styled.div(({ theme: { menu }, vertical, backgroundColor, width, height })=>({
|
|
99
|
+
display: 'flex',
|
|
100
|
+
flexFlow: vertical ? 'column' : 'row',
|
|
101
|
+
overflowY: vertical ? 'auto' : void 0,
|
|
102
|
+
backgroundColor: backgroundColor || menu.background,
|
|
103
|
+
padding: vertical ? '16px 0' : '0 16px',
|
|
104
|
+
width,
|
|
105
|
+
height
|
|
106
|
+
}), ({ theme: { defaultBorder }, border, borderTop, borderBottom, borderLeft, borderRight, borderTopLeftRadius, borderTopRightRadius, borderBottomLeftRadius, borderBottomRightRadius })=>({
|
|
107
|
+
border: border ? defaultBorder : void 0,
|
|
108
|
+
borderTop: borderTop ? defaultBorder : void 0,
|
|
109
|
+
borderBottom: borderBottom ? defaultBorder : void 0,
|
|
110
|
+
borderLeft: borderLeft ? defaultBorder : void 0,
|
|
111
|
+
borderRight: borderRight ? defaultBorder : void 0,
|
|
112
|
+
borderTopLeftRadius,
|
|
113
|
+
borderTopRightRadius,
|
|
114
|
+
borderBottomLeftRadius,
|
|
115
|
+
borderBottomRightRadius
|
|
116
|
+
}), paddingProps);
|
|
117
|
+
const MenuItem = styled.button({
|
|
118
|
+
userSelect: 'none',
|
|
119
|
+
border: 'none',
|
|
120
|
+
display: 'flex',
|
|
121
|
+
alignItems: 'center'
|
|
122
|
+
}, ({ theme: { accent, font, menuItem }, selected, vertical, disabled, indent = 1 })=>({
|
|
123
|
+
color: selected ? menuItem.color.active : menuItem.color.inactive,
|
|
124
|
+
backgroundColor: selected ? menuItem.background.active : menuItem.background.inactive,
|
|
125
|
+
borderLeft: vertical ? '4px solid transparent' : void 0,
|
|
126
|
+
borderLeftColor: vertical && selected ? menuItem.borderColor : void 0,
|
|
127
|
+
borderBottom: vertical ? void 0 : '4px solid transparent',
|
|
128
|
+
borderBottomColor: !vertical && selected ? menuItem.borderColor : void 0,
|
|
129
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
130
|
+
fontSize: font.size.lg,
|
|
131
|
+
padding: vertical ? `0 0 0 ${32 * indent}px` : '0 16px',
|
|
132
|
+
minHeight: 40,
|
|
133
|
+
'&:hover': {
|
|
134
|
+
backgroundColor: menuItem.background.hover,
|
|
135
|
+
color: menuItem.color.hover
|
|
136
|
+
},
|
|
137
|
+
'&:focus-visible': {
|
|
138
|
+
outline: `${accent} solid 1px`,
|
|
139
|
+
outlineOffset: -1
|
|
140
|
+
}
|
|
141
|
+
}), ({ contentPosition })=>{
|
|
142
|
+
const position = 'start' === contentPosition || 'end' === contentPosition ? `flex-${contentPosition}` : contentPosition;
|
|
143
|
+
return {
|
|
144
|
+
justifyContent: position
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
const MenuGroup = styled.div(({ theme, backgroundColor })=>({
|
|
148
|
+
display: 'flex',
|
|
149
|
+
flexDirection: 'column',
|
|
150
|
+
backgroundColor: backgroundColor || theme.menu.background
|
|
151
|
+
}));
|
|
152
|
+
const ToggleContainer = styled.div({
|
|
153
|
+
marginLeft: 'auto',
|
|
154
|
+
marginRight: 8
|
|
155
|
+
});
|
|
156
|
+
Menu.Item = Item;
|
|
157
|
+
Menu.Group = Group;
|
|
158
|
+
const components_Menu = Menu;
|
|
159
|
+
export { Group, Item, components_Menu as default };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from "@emotion/react";
|
|
3
|
+
import styled from "@emotion/styled";
|
|
4
|
+
import Button from "./Button/index.js";
|
|
5
|
+
import { marginProps } from "./helpers/styledProps.js";
|
|
6
|
+
import Icon from "./Icon/index.js";
|
|
7
|
+
const getByType = (type, theme, solid)=>{
|
|
8
|
+
const { color, toast } = theme;
|
|
9
|
+
switch(type){
|
|
10
|
+
case 'info':
|
|
11
|
+
return {
|
|
12
|
+
iconName: 'info',
|
|
13
|
+
borderColor: color.brand,
|
|
14
|
+
backgroundColor: solid ? toast.background.info : color.brandTint2
|
|
15
|
+
};
|
|
16
|
+
case 'error':
|
|
17
|
+
return {
|
|
18
|
+
iconName: 'warning',
|
|
19
|
+
borderColor: color.error,
|
|
20
|
+
backgroundColor: solid ? toast.background.error : color.errorTint2
|
|
21
|
+
};
|
|
22
|
+
case 'success':
|
|
23
|
+
return {
|
|
24
|
+
iconName: 'check-circle',
|
|
25
|
+
borderColor: color.success,
|
|
26
|
+
backgroundColor: solid ? toast.background.success : color.successTint2
|
|
27
|
+
};
|
|
28
|
+
case 'warning':
|
|
29
|
+
return {
|
|
30
|
+
iconName: 'warning',
|
|
31
|
+
borderColor: color.warning,
|
|
32
|
+
backgroundColor: solid ? toast.background.warning : color.warningTint2
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
return {
|
|
36
|
+
iconName: 'info',
|
|
37
|
+
borderColor: theme.scale8,
|
|
38
|
+
backgroundColor: solid ? toast.background.default : theme.scale0
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const Message = ({ type, content, closeIcon, onClose, width, children, solid, ...rest })=>{
|
|
43
|
+
const theme = useTheme();
|
|
44
|
+
const { iconName, borderColor, backgroundColor } = getByType(type || '', theme, solid);
|
|
45
|
+
return /*#__PURE__*/ jsxs(MessageContainer, {
|
|
46
|
+
borderColor: borderColor,
|
|
47
|
+
backgroundColor: backgroundColor,
|
|
48
|
+
width: width,
|
|
49
|
+
showingClose: closeIcon,
|
|
50
|
+
...rest,
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ jsx(Icon, {
|
|
53
|
+
name: iconName,
|
|
54
|
+
color: borderColor
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ jsx(Content, {
|
|
57
|
+
children: content || children
|
|
58
|
+
}),
|
|
59
|
+
closeIcon && /*#__PURE__*/ jsx(Button, {
|
|
60
|
+
small: true,
|
|
61
|
+
subtle: true,
|
|
62
|
+
secondary: true,
|
|
63
|
+
icon: "close",
|
|
64
|
+
onClick: onClose,
|
|
65
|
+
marginLeft: "auto"
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const MessageHeader = styled.div(({ theme })=>({
|
|
71
|
+
fontWeight: theme.font.weight.medium
|
|
72
|
+
}));
|
|
73
|
+
MessageHeader.displayName = 'Message.Header';
|
|
74
|
+
const MessageBody = styled.div(({ theme })=>({
|
|
75
|
+
fontWeight: theme.font.weight.default
|
|
76
|
+
}));
|
|
77
|
+
MessageBody.displayName = 'Message.Body';
|
|
78
|
+
Message.Header = MessageHeader;
|
|
79
|
+
Message.Body = MessageBody;
|
|
80
|
+
const MessageContainer = styled.div(({ theme, borderColor, backgroundColor, width })=>({
|
|
81
|
+
width,
|
|
82
|
+
display: 'flex',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
gap: theme.size.sm,
|
|
85
|
+
position: 'relative',
|
|
86
|
+
padding: `${theme.size.sm}px ${theme.size.md}px`,
|
|
87
|
+
border: '1px solid',
|
|
88
|
+
borderColor,
|
|
89
|
+
borderRadius: theme.size.xs,
|
|
90
|
+
backgroundColor,
|
|
91
|
+
color: theme.scale10,
|
|
92
|
+
fontSize: theme.font.size.sm,
|
|
93
|
+
'& a': {
|
|
94
|
+
textDecoration: 'none',
|
|
95
|
+
color: theme.accent,
|
|
96
|
+
'&:hover': {
|
|
97
|
+
textDecoration: 'underline'
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}), ({ theme, showingClose })=>({
|
|
101
|
+
paddingRight: showingClose ? theme.size.sm : void 0
|
|
102
|
+
}), marginProps);
|
|
103
|
+
const Content = styled.div({
|
|
104
|
+
width: '100%'
|
|
105
|
+
});
|
|
106
|
+
const components_Message = Message;
|
|
107
|
+
export { MessageBody, MessageHeader, components_Message as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
const MessageHr = ({ text, color, style, ...rest })=>/*#__PURE__*/ jsxs(HrContainer, {
|
|
4
|
+
...rest,
|
|
5
|
+
children: [
|
|
6
|
+
/*#__PURE__*/ jsx(Bar, {}),
|
|
7
|
+
/*#__PURE__*/ jsx(Text, {
|
|
8
|
+
color: color,
|
|
9
|
+
style: style,
|
|
10
|
+
children: text
|
|
11
|
+
}),
|
|
12
|
+
/*#__PURE__*/ jsx(Bar, {})
|
|
13
|
+
]
|
|
14
|
+
});
|
|
15
|
+
const Text = styled.div(({ color })=>({
|
|
16
|
+
fontSize: 12,
|
|
17
|
+
padding: '0 5px',
|
|
18
|
+
color
|
|
19
|
+
}));
|
|
20
|
+
const Bar = styled.div(({ theme })=>({
|
|
21
|
+
height: 1,
|
|
22
|
+
backgroundColor: theme.scale4,
|
|
23
|
+
width: '100%'
|
|
24
|
+
}));
|
|
25
|
+
const HrContainer = styled.div({
|
|
26
|
+
display: 'grid',
|
|
27
|
+
gridTemplateColumns: '1fr auto 1fr',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
padding: '10px 0'
|
|
30
|
+
});
|
|
31
|
+
const components_MessageHr = MessageHr;
|
|
32
|
+
export { components_MessageHr as default };
|