@wavv/ui 2.2.2-alpha.5 → 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/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 +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import isPropAllowed from "../helpers/isPropAllowed.js";
|
|
3
|
+
const contentPreventProps = {
|
|
4
|
+
shouldForwardProp: (prop)=>isPropAllowed(prop, [
|
|
5
|
+
'maxHeight',
|
|
6
|
+
'zIndex',
|
|
7
|
+
'offsetY',
|
|
8
|
+
'offsetX',
|
|
9
|
+
'centerY',
|
|
10
|
+
'centerX',
|
|
11
|
+
'optionsPosition'
|
|
12
|
+
])
|
|
13
|
+
};
|
|
14
|
+
const Container = styled('div', contentPreventProps)(({ theme, width, maxHeight, zIndex })=>({
|
|
15
|
+
backgroundColor: theme.options.background,
|
|
16
|
+
borderRadius: 4,
|
|
17
|
+
boxShadow: theme.elevation3,
|
|
18
|
+
boxSizing: 'border-box',
|
|
19
|
+
fontFamily: theme.font.family.default,
|
|
20
|
+
fontSize: theme.font.size.md,
|
|
21
|
+
maxHeight,
|
|
22
|
+
overflowY: 'auto',
|
|
23
|
+
width: width || 'max-content',
|
|
24
|
+
zIndex,
|
|
25
|
+
'& > span > .menu-arrow': {
|
|
26
|
+
fill: theme.options.background,
|
|
27
|
+
filter: 'drop-shadow(0px 4px 2px rgba(0, 0, 0, 0.1))'
|
|
28
|
+
},
|
|
29
|
+
'&[data-side="bottom"] > span > .menu-arrow': {
|
|
30
|
+
filter: 'drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.1))'
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
const OptionHelpers_Container = Container;
|
|
34
|
+
export { OptionHelpers_Container as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import isPropAllowed from "../helpers/isPropAllowed.js";
|
|
3
|
+
const contentPreventProps = {
|
|
4
|
+
shouldForwardProp: (prop)=>isPropAllowed(prop, [
|
|
5
|
+
'selected',
|
|
6
|
+
'noSelect',
|
|
7
|
+
'contentPosition',
|
|
8
|
+
'color',
|
|
9
|
+
'accented',
|
|
10
|
+
'section'
|
|
11
|
+
])
|
|
12
|
+
};
|
|
13
|
+
const Item = styled('div', contentPreventProps)({
|
|
14
|
+
border: 'none',
|
|
15
|
+
padding: '4px 16px',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
userSelect: 'none',
|
|
19
|
+
position: 'relative'
|
|
20
|
+
}, ({ theme: { optionItem, scale4 }, color, accented, selected, disabled, noSelect = false })=>{
|
|
21
|
+
const textColor = accented ? optionItem.color.accent : optionItem.color.inactive;
|
|
22
|
+
return {
|
|
23
|
+
color: disabled ? scale4 : color || textColor,
|
|
24
|
+
cursor: disabled || noSelect ? 'inherit' : 'pointer',
|
|
25
|
+
pointerEvents: disabled || noSelect ? 'none' : 'auto',
|
|
26
|
+
backgroundColor: !noSelect && selected ? optionItem.background.active : optionItem.background.inactive,
|
|
27
|
+
'&:hover': {
|
|
28
|
+
backgroundColor: disabled || noSelect ? optionItem.background.inactive : optionItem.background.active
|
|
29
|
+
},
|
|
30
|
+
'&:focus': {
|
|
31
|
+
outline: 'none',
|
|
32
|
+
backgroundColor: optionItem.background.active
|
|
33
|
+
},
|
|
34
|
+
'&[data-highlighted]': {
|
|
35
|
+
backgroundColor: optionItem.background.active
|
|
36
|
+
},
|
|
37
|
+
'&[data-disabled], &[data-disabled]:hover': {
|
|
38
|
+
color: scale4,
|
|
39
|
+
backgroundColor: optionItem.background.inactive,
|
|
40
|
+
cursor: 'inherit'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}, ({ contentPosition })=>{
|
|
44
|
+
const position = 'start' === contentPosition || 'end' === contentPosition ? `flex-${contentPosition}` : contentPosition;
|
|
45
|
+
return {
|
|
46
|
+
justifyContent: position
|
|
47
|
+
};
|
|
48
|
+
}, ({ theme, section })=>section && {
|
|
49
|
+
backgroundColor: theme.scale0,
|
|
50
|
+
padding: '0 16px',
|
|
51
|
+
color: theme.scale6,
|
|
52
|
+
fontWeight: theme.font.weight.medium,
|
|
53
|
+
pointerEvents: 'none',
|
|
54
|
+
'&:hover': {
|
|
55
|
+
backgroundColor: theme.scale0
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const OptionHelpers_Item = Item;
|
|
59
|
+
export { OptionHelpers_Item as default };
|
|
File without changes
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { Fragment, useState } from "react";
|
|
4
|
+
import { chunk, range } from "../utils/index.js";
|
|
5
|
+
import { marginProps } from "./helpers/styledProps.js";
|
|
6
|
+
import Icon from "./Icon/index.js";
|
|
7
|
+
const toNum = (val)=>val ? +val : 0;
|
|
8
|
+
const Pagination_Pagination = ({ onPageNav, page, totalPages, maxVisibleNumbers, width, ...props })=>{
|
|
9
|
+
const [currentPage, setCurrentPage] = useState(toNum(page) || 1);
|
|
10
|
+
const [currentChunk, setCurrentChunk] = useState(0);
|
|
11
|
+
const numbers = range(1, totalPages);
|
|
12
|
+
const max = toNum(maxVisibleNumbers) || numbers.length;
|
|
13
|
+
const pages = chunk(numbers, max);
|
|
14
|
+
const getChunkIndex = (index)=>{
|
|
15
|
+
for(let i = 0; i < pages.length; i++)if (pages[i].includes(index)) return i;
|
|
16
|
+
return -1;
|
|
17
|
+
};
|
|
18
|
+
const handlePageChange = (newPage)=>{
|
|
19
|
+
if (newPage >= 1 && newPage <= totalPages) {
|
|
20
|
+
const index = getChunkIndex(newPage);
|
|
21
|
+
setCurrentChunk(index);
|
|
22
|
+
setCurrentPage(newPage);
|
|
23
|
+
onPageNav(newPage);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const hasLeftOverflow = 0 !== currentChunk;
|
|
27
|
+
const hasRightOverflow = currentChunk !== pages.length - 1;
|
|
28
|
+
return /*#__PURE__*/ jsxs(Controls, {
|
|
29
|
+
width: width,
|
|
30
|
+
...props,
|
|
31
|
+
children: [
|
|
32
|
+
/*#__PURE__*/ jsx(NavControl, {
|
|
33
|
+
disabled: 1 === currentPage,
|
|
34
|
+
onClick: ()=>handlePageChange(1),
|
|
35
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
36
|
+
name: "double-arrow-left",
|
|
37
|
+
title: "first"
|
|
38
|
+
})
|
|
39
|
+
}),
|
|
40
|
+
/*#__PURE__*/ jsx(NavControl, {
|
|
41
|
+
disabled: 1 === currentPage,
|
|
42
|
+
onClick: ()=>handlePageChange(currentPage - 1),
|
|
43
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
44
|
+
name: "chevron-left",
|
|
45
|
+
title: "prev"
|
|
46
|
+
})
|
|
47
|
+
}),
|
|
48
|
+
pages[currentChunk].map((pageNumber, i, chunkArray)=>/*#__PURE__*/ jsxs(Fragment, {
|
|
49
|
+
children: [
|
|
50
|
+
0 === i && hasLeftOverflow ? /*#__PURE__*/ jsx(Ellipses, {
|
|
51
|
+
children: "... "
|
|
52
|
+
}) : '',
|
|
53
|
+
/*#__PURE__*/ jsx(Page, {
|
|
54
|
+
selected: pageNumber === currentPage,
|
|
55
|
+
onClick: ()=>handlePageChange(pageNumber),
|
|
56
|
+
children: pageNumber
|
|
57
|
+
}),
|
|
58
|
+
i === chunkArray.length - 1 && hasRightOverflow ? /*#__PURE__*/ jsx(Ellipses, {
|
|
59
|
+
children: " ..."
|
|
60
|
+
}) : ''
|
|
61
|
+
]
|
|
62
|
+
}, `pageIndex-${pageNumber}`)),
|
|
63
|
+
/*#__PURE__*/ jsx(NavControl, {
|
|
64
|
+
disabled: currentPage === totalPages,
|
|
65
|
+
onClick: ()=>handlePageChange(currentPage + 1),
|
|
66
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
67
|
+
name: "chevron-right",
|
|
68
|
+
title: "next"
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ jsx(NavControl, {
|
|
72
|
+
disabled: currentPage === totalPages,
|
|
73
|
+
onClick: ()=>handlePageChange(totalPages),
|
|
74
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
75
|
+
name: "double-arrow-right",
|
|
76
|
+
title: "last"
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const Controls = styled.nav({
|
|
83
|
+
display: 'flex',
|
|
84
|
+
justifyContent: 'space-between',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
columnGap: 4
|
|
87
|
+
}, ({ width })=>({
|
|
88
|
+
width: width || 'max-content'
|
|
89
|
+
}), marginProps);
|
|
90
|
+
const Control = styled.button(({ theme, disabled })=>({
|
|
91
|
+
border: 'none',
|
|
92
|
+
borderRadius: theme.size.xs,
|
|
93
|
+
backgroundColor: 'transparent',
|
|
94
|
+
'&:hover': {
|
|
95
|
+
backgroundColor: disabled ? void 0 : theme.scale1,
|
|
96
|
+
color: disabled ? void 0 : theme.scale10
|
|
97
|
+
},
|
|
98
|
+
'&:focus-visible': {
|
|
99
|
+
outline: `${theme.accent} solid 1px`,
|
|
100
|
+
outlineOffset: -1
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
103
|
+
const NavControl = styled(Control)(({ theme, disabled })=>({
|
|
104
|
+
color: disabled ? theme.scale4 : theme.scale8,
|
|
105
|
+
cursor: disabled ? 'default' : 'pointer'
|
|
106
|
+
}));
|
|
107
|
+
const Page = styled(Control)(({ theme, selected })=>({
|
|
108
|
+
color: selected ? theme.scale10 : theme.scale6,
|
|
109
|
+
backgroundColor: selected ? theme.scale0 : void 0,
|
|
110
|
+
fontSize: theme.font.size.sm,
|
|
111
|
+
cursor: 'pointer',
|
|
112
|
+
width: 'max-content',
|
|
113
|
+
minWidth: theme.size.lg,
|
|
114
|
+
height: theme.size.lg,
|
|
115
|
+
padding: 0
|
|
116
|
+
}));
|
|
117
|
+
const Ellipses = styled.span(({ theme })=>({
|
|
118
|
+
color: theme.scale6
|
|
119
|
+
}));
|
|
120
|
+
const Pagination = Pagination_Pagination;
|
|
121
|
+
export { Pagination as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Cell, Pie, PieChart } from "recharts";
|
|
3
|
+
import { ChartContainer, Tooltip } from "./ChartHelpers.js";
|
|
4
|
+
const PieChart_PieChart = ({ size = 200, data, innerRadius, showWhenEmpty, tooltipLegendPostfix, ...rest })=>{
|
|
5
|
+
const haveData = data?.length > 0;
|
|
6
|
+
const backupData = showWhenEmpty ? [
|
|
7
|
+
{
|
|
8
|
+
name: '1',
|
|
9
|
+
value: 1,
|
|
10
|
+
color: '#999'
|
|
11
|
+
}
|
|
12
|
+
] : void 0;
|
|
13
|
+
const dataToDisplay = haveData ? data : backupData;
|
|
14
|
+
const radius = size / 2 - 1;
|
|
15
|
+
return /*#__PURE__*/ jsx(ChartContainer, {
|
|
16
|
+
width: size,
|
|
17
|
+
height: size,
|
|
18
|
+
...rest,
|
|
19
|
+
children: /*#__PURE__*/ jsxs(PieChart, {
|
|
20
|
+
width: size,
|
|
21
|
+
height: size,
|
|
22
|
+
children: [
|
|
23
|
+
/*#__PURE__*/ jsx(Pie, {
|
|
24
|
+
dataKey: "value",
|
|
25
|
+
data: dataToDisplay,
|
|
26
|
+
innerRadius: innerRadius,
|
|
27
|
+
outerRadius: radius,
|
|
28
|
+
children: dataToDisplay?.map((entry)=>/*#__PURE__*/ jsx(Cell, {
|
|
29
|
+
fill: entry.color || '#999'
|
|
30
|
+
}, entry.name))
|
|
31
|
+
}),
|
|
32
|
+
haveData && Tooltip({
|
|
33
|
+
legendPostfix: tooltipLegendPostfix
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const components_PieChart = PieChart_PieChart;
|
|
40
|
+
export { components_PieChart as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { DialogTrigger } from "react-aria-components";
|
|
4
|
+
import { useControlledOpenState } from "../hooks/index.js";
|
|
5
|
+
import AriaButton from "./Inputs/helpers/AriaButton.js";
|
|
6
|
+
import MotionPopover from "./MotionPopover.js";
|
|
7
|
+
const Popover_Popover = ({ children, position = 'bottom', fixedPosition, trigger, isTriggerButton, triggerProps, offset = 4, afterShow, afterHide, open, onOpenChange, ...props })=>{
|
|
8
|
+
const [isOpen, handleOpenChange] = useControlledOpenState({
|
|
9
|
+
open,
|
|
10
|
+
onOpenChange,
|
|
11
|
+
afterShow,
|
|
12
|
+
afterHide
|
|
13
|
+
});
|
|
14
|
+
useEffect(()=>()=>{
|
|
15
|
+
handleOpenChange(false);
|
|
16
|
+
}, []);
|
|
17
|
+
const triggerEl = isTriggerButton ? trigger : /*#__PURE__*/ jsx(AriaButton, {
|
|
18
|
+
"aria-label": "Menu",
|
|
19
|
+
...triggerProps,
|
|
20
|
+
children: trigger
|
|
21
|
+
});
|
|
22
|
+
return /*#__PURE__*/ jsxs(DialogTrigger, {
|
|
23
|
+
onOpenChange: handleOpenChange,
|
|
24
|
+
isOpen: isOpen,
|
|
25
|
+
children: [
|
|
26
|
+
triggerEl,
|
|
27
|
+
/*#__PURE__*/ jsx(MotionPopover, {
|
|
28
|
+
placement: position,
|
|
29
|
+
offset: offset,
|
|
30
|
+
shouldFlip: fixedPosition ? false : void 0,
|
|
31
|
+
onClick: (event)=>event.stopPropagation(),
|
|
32
|
+
onMouseDown: (event)=>event.stopPropagation(),
|
|
33
|
+
...props,
|
|
34
|
+
children: children
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const Popover = Popover_Popover;
|
|
40
|
+
export { Popover as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { UNSAFE_PortalProvider } from "react-aria";
|
|
3
|
+
const PortalScope = ({ containerRef, children })=>/*#__PURE__*/ jsx(UNSAFE_PortalProvider, {
|
|
4
|
+
getContainer: ()=>containerRef.current,
|
|
5
|
+
children: children
|
|
6
|
+
});
|
|
7
|
+
const components_PortalScope = PortalScope;
|
|
8
|
+
export { components_PortalScope as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { marginProps } from "../helpers/styledProps.js";
|
|
4
|
+
const CirclePercent = ({ percent, size = 24, thickness = 2, color, margin, marginTop, marginBottom, marginRight, marginLeft })=>{
|
|
5
|
+
const rest = {
|
|
6
|
+
margin,
|
|
7
|
+
marginTop,
|
|
8
|
+
marginBottom,
|
|
9
|
+
marginRight,
|
|
10
|
+
marginLeft
|
|
11
|
+
};
|
|
12
|
+
const radius = (size - thickness) / 2;
|
|
13
|
+
const circumference = radius * Math.PI * 2;
|
|
14
|
+
const cirComplete = circumference - circumference * percent / 100;
|
|
15
|
+
const half = size / 2;
|
|
16
|
+
return /*#__PURE__*/ jsxs(ProgressCircle, {
|
|
17
|
+
size: size,
|
|
18
|
+
...rest,
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ jsx(Circle, {
|
|
21
|
+
cx: half,
|
|
22
|
+
cy: half,
|
|
23
|
+
r: radius,
|
|
24
|
+
thickness: thickness
|
|
25
|
+
}),
|
|
26
|
+
/*#__PURE__*/ jsx(CircleProgress, {
|
|
27
|
+
color: color,
|
|
28
|
+
cx: half,
|
|
29
|
+
cy: half,
|
|
30
|
+
r: radius,
|
|
31
|
+
thickness: thickness,
|
|
32
|
+
transform: `rotate(-90 ${half} ${half})`,
|
|
33
|
+
circ: circumference,
|
|
34
|
+
complete: cirComplete
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const ProgressCircle = styled.svg(({ size })=>({
|
|
40
|
+
display: 'block',
|
|
41
|
+
width: size,
|
|
42
|
+
height: size
|
|
43
|
+
}), marginProps);
|
|
44
|
+
const Circle = styled.circle(({ theme, thickness })=>({
|
|
45
|
+
fill: 'none',
|
|
46
|
+
stroke: theme.scale1,
|
|
47
|
+
strokeWidth: thickness
|
|
48
|
+
}));
|
|
49
|
+
const CircleProgress = styled(Circle)(({ theme, color, circ, complete })=>({
|
|
50
|
+
stroke: color || theme.color.brand,
|
|
51
|
+
strokeDasharray: circ,
|
|
52
|
+
strokeDashoffset: complete,
|
|
53
|
+
transition: 'stroke-dashoffset 0.5s'
|
|
54
|
+
}));
|
|
55
|
+
const Progress_CirclePercent = CirclePercent;
|
|
56
|
+
export { Progress_CirclePercent as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { marginProps } from "../helpers/styledProps.js";
|
|
4
|
+
import CirclePercent from "./CirclePercent.js";
|
|
5
|
+
const getSafePercent = (percent)=>{
|
|
6
|
+
if (percent > 100) return 100;
|
|
7
|
+
if (percent < 0) return 0;
|
|
8
|
+
return percent;
|
|
9
|
+
};
|
|
10
|
+
const Progress = ({ percent, color, circle, width, height, size, thickness = 8, borderRadius, goal, ...rest })=>{
|
|
11
|
+
const safePercent = getSafePercent(percent);
|
|
12
|
+
const safeGoal = goal ? getSafePercent(goal) : void 0;
|
|
13
|
+
return circle ? /*#__PURE__*/ jsx(CirclePercent, {
|
|
14
|
+
percent: safePercent,
|
|
15
|
+
size: size,
|
|
16
|
+
thickness: thickness,
|
|
17
|
+
color: color,
|
|
18
|
+
...rest
|
|
19
|
+
}) : /*#__PURE__*/ jsxs(ProgressBar, {
|
|
20
|
+
width: width,
|
|
21
|
+
height: height || thickness,
|
|
22
|
+
borderRadius: borderRadius,
|
|
23
|
+
...rest,
|
|
24
|
+
children: [
|
|
25
|
+
safeGoal && /*#__PURE__*/ jsx(GoalLine, {
|
|
26
|
+
percent: safeGoal
|
|
27
|
+
}),
|
|
28
|
+
/*#__PURE__*/ jsx(ProgressInner, {
|
|
29
|
+
color: color,
|
|
30
|
+
width: safePercent
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const ProgressBar = styled.div(({ theme, width, height, borderRadius = 24 })=>({
|
|
36
|
+
backgroundColor: theme.scale1,
|
|
37
|
+
borderRadius,
|
|
38
|
+
width: width || '100%',
|
|
39
|
+
height,
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
position: 'relative'
|
|
42
|
+
}), marginProps);
|
|
43
|
+
const ProgressInner = styled.div(({ theme, color, width })=>({
|
|
44
|
+
backgroundColor: color || theme.color.brand,
|
|
45
|
+
width: `${width}%`,
|
|
46
|
+
height: '100%',
|
|
47
|
+
transition: 'width 0.5s'
|
|
48
|
+
}));
|
|
49
|
+
const GoalLine = styled.div(({ theme, percent })=>({
|
|
50
|
+
backgroundColor: 'transparent',
|
|
51
|
+
width: 1,
|
|
52
|
+
height: '100%',
|
|
53
|
+
borderLeft: `1px dashed ${theme.scale4}`,
|
|
54
|
+
position: 'absolute',
|
|
55
|
+
left: `${percent}%`,
|
|
56
|
+
top: 0
|
|
57
|
+
}));
|
|
58
|
+
const Progress_Progress = Progress;
|
|
59
|
+
export { Progress_Progress as default };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import RadioButton from "../assets/icons/RadioButton.js";
|
|
3
|
+
import { ControlContainer, ControlInput, ControlLabel } from "./FormControl.js";
|
|
4
|
+
import Icon from "./Icon/index.js";
|
|
5
|
+
const Radio_Radio = ({ id, label, labelPosition, checked, disabled, margin, marginTop, marginBottom, marginRight, marginLeft, className, readOnly, iconColor, ...props })=>{
|
|
6
|
+
const labelRight = 'right' === labelPosition;
|
|
7
|
+
const marginProps = {
|
|
8
|
+
margin,
|
|
9
|
+
marginTop,
|
|
10
|
+
marginBottom,
|
|
11
|
+
marginRight,
|
|
12
|
+
marginLeft
|
|
13
|
+
};
|
|
14
|
+
return /*#__PURE__*/ jsxs(ControlContainer, {
|
|
15
|
+
htmlFor: id,
|
|
16
|
+
labelRight: labelRight,
|
|
17
|
+
disabled: disabled,
|
|
18
|
+
readOnly: readOnly,
|
|
19
|
+
className: className,
|
|
20
|
+
iconColor: iconColor,
|
|
21
|
+
...marginProps,
|
|
22
|
+
children: [
|
|
23
|
+
label && /*#__PURE__*/ jsx(ControlLabel, {
|
|
24
|
+
children: label
|
|
25
|
+
}),
|
|
26
|
+
/*#__PURE__*/ jsx(ControlInput, {
|
|
27
|
+
id: id,
|
|
28
|
+
type: "radio",
|
|
29
|
+
checked: checked,
|
|
30
|
+
disabled: disabled,
|
|
31
|
+
readOnly: readOnly,
|
|
32
|
+
iconColor: iconColor,
|
|
33
|
+
...props
|
|
34
|
+
}),
|
|
35
|
+
/*#__PURE__*/ jsx(Icon, {
|
|
36
|
+
svg: /*#__PURE__*/ jsx(RadioButton, {}),
|
|
37
|
+
marginLeft: label && !labelRight ? 8 : 0,
|
|
38
|
+
marginRight: label && labelRight ? 8 : 0,
|
|
39
|
+
pointer: !disabled
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const Radio = Radio_Radio;
|
|
45
|
+
export { Radio as default };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { CalendarDate } from "@internationalized/date";
|
|
4
|
+
import { useRef, useState } from "react";
|
|
5
|
+
import { RangeCalendar } from "react-aria-components";
|
|
6
|
+
import CalendarContainerStyles from "./CalendarParts/CalendarContainerStyles.js";
|
|
7
|
+
import CalendarContent from "./CalendarParts/CalendarContent.js";
|
|
8
|
+
import CalendarHeader from "./CalendarParts/CalendarHeader.js";
|
|
9
|
+
import useMinMax from "./CalendarParts/useMinMax.js";
|
|
10
|
+
import { getDateFromObj, getNow, getObjFromDate } from "./CalendarParts/utils.js";
|
|
11
|
+
const now = getNow();
|
|
12
|
+
const RangeCalendar_RangeCalendar = ({ startDate, endDate, onChange, preventPast, preventFuture, noShadow, ...props })=>{
|
|
13
|
+
const { current: initialStart } = useRef(startDate ? getObjFromDate(startDate) : now);
|
|
14
|
+
const { current: initialEnd } = useRef(endDate ? getObjFromDate(endDate) : initialStart);
|
|
15
|
+
const [selectedStart, setSelectedStart] = useState(initialStart);
|
|
16
|
+
const [selectedEnd, setSelectedEnd] = useState(initialEnd);
|
|
17
|
+
const [focusedDate, setFocusedDate] = useState(initialStart);
|
|
18
|
+
const { min, max } = useMinMax({
|
|
19
|
+
past: preventPast,
|
|
20
|
+
future: preventFuture
|
|
21
|
+
});
|
|
22
|
+
const handleDateChange = (val)=>{
|
|
23
|
+
if (!val) return;
|
|
24
|
+
const { start, end } = val;
|
|
25
|
+
const { year: sYear, month: sMonth, day: sDay } = start;
|
|
26
|
+
const { year: eYear, month: eMonth, day: eDay } = end;
|
|
27
|
+
const newStart = new CalendarDate(sYear, sMonth, sDay);
|
|
28
|
+
setSelectedStart(newStart);
|
|
29
|
+
const newEnd = new CalendarDate(eYear, eMonth, eDay);
|
|
30
|
+
setSelectedEnd(newEnd);
|
|
31
|
+
const newStartDate = getDateFromObj(start);
|
|
32
|
+
const newEndDate = getDateFromObj(end);
|
|
33
|
+
if (onChange) onChange(newStartDate, newEndDate);
|
|
34
|
+
};
|
|
35
|
+
return /*#__PURE__*/ jsxs(CalendarContainer, {
|
|
36
|
+
value: {
|
|
37
|
+
start: selectedStart,
|
|
38
|
+
end: selectedEnd
|
|
39
|
+
},
|
|
40
|
+
onChange: handleDateChange,
|
|
41
|
+
minValue: min,
|
|
42
|
+
maxValue: max,
|
|
43
|
+
noShadow: noShadow,
|
|
44
|
+
focusedValue: focusedDate,
|
|
45
|
+
onFocusChange: setFocusedDate,
|
|
46
|
+
...props,
|
|
47
|
+
children: [
|
|
48
|
+
/*#__PURE__*/ jsx(CalendarHeader, {
|
|
49
|
+
date: focusedDate,
|
|
50
|
+
setDate: setFocusedDate
|
|
51
|
+
}),
|
|
52
|
+
/*#__PURE__*/ jsx(CalendarContent, {
|
|
53
|
+
range: true
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const CalendarContainer = styled(RangeCalendar)(CalendarContainerStyles);
|
|
59
|
+
const components_RangeCalendar = RangeCalendar_RangeCalendar;
|
|
60
|
+
export { components_RangeCalendar as default };
|