@cashub/ui-elv 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chart/BarChart.js +8 -2
- package/chart/DoughnutChart.js +2 -1
- package/chart/LineChart.js +2 -1
- package/chart/utils/customTooltip.js +3 -7
- package/chart/utils/customTooltipLifecyclePlugin.js +21 -0
- package/chart/utils/tooltipElement.js +25 -0
- package/chart/utils/xAxisLabelTooltipPlugin.js +107 -0
- package/datetimePicker/index.js +2 -37
- package/esm/Tab/Tab.js +21 -0
- package/esm/Tab/TabList.js +160 -0
- package/esm/Tab/TabPanel.js +42 -0
- package/esm/Tab/TabTab.js +98 -0
- package/esm/Tab/index.js +23 -0
- package/esm/Tab/subComponent/TabContext.js +3 -0
- package/esm/Tab/subComponent/TabListV2.js +18 -0
- package/esm/Tab/subComponent/TabPanelV2.js +45 -0
- package/esm/Tab/subComponent/TabTabV2.js +56 -0
- package/esm/VerticalTab/TabList.js +20 -0
- package/esm/VerticalTab/TabPanel.js +45 -0
- package/esm/VerticalTab/TabTab.js +63 -0
- package/esm/VerticalTab/VerticalTab.js +34 -0
- package/esm/VerticalTab/index.js +9 -0
- package/esm/VerticalTab/subComponent/TabContext.js +3 -0
- package/esm/alert/Alert.js +22 -0
- package/esm/alert/index.js +1 -0
- package/esm/animate/Collapse.js +65 -0
- package/esm/animate/Loader.js +51 -0
- package/esm/animate/NumberCounter.js +45 -0
- package/esm/animate/PulseRing.js +26 -0
- package/esm/animate/Spinner.js +11 -0
- package/esm/animate/index.js +5 -0
- package/esm/assets/css/autocomplete.css +16 -0
- package/esm/assets/css/font.css +4 -0
- package/esm/assets/css/global.css +2 -0
- package/esm/assets/font/helvetica/Helvetica.ttf +0 -0
- package/esm/assets/font/nanumGothic/NanumGothic-Bold.ttf +0 -0
- package/esm/assets/font/nanumGothic/NanumGothic-ExtraBold.ttf +0 -0
- package/esm/assets/font/nanumGothic/NanumGothic-Regular.ttf +0 -0
- package/esm/assets/icons/app-management.png +0 -0
- package/esm/assets/icons/burger-black.png +0 -0
- package/esm/assets/icons/burger-white.png +0 -0
- package/esm/assets/icons/burger.png +0 -0
- package/esm/assets/icons/file.svg +1 -0
- package/esm/assets/icons/map_icon1.png +0 -0
- package/esm/assets/icons/map_icon4.png +0 -0
- package/esm/assets/images/bg-aside.png +0 -0
- package/esm/assets/images/bg-chart-circle.png +0 -0
- package/esm/assets/images/bg-chart-triangle.png +0 -0
- package/esm/assets/images/cashub-logo-only.png +0 -0
- package/esm/assets/images/default-user.jpg +0 -0
- package/esm/assets/images/logo-cashub.png +0 -0
- package/esm/assets/images/map.png +0 -0
- package/esm/assets/images/qrcode.png +0 -0
- package/esm/backdrop/BaseBackdrop.js +11 -0
- package/esm/backdrop/LoadingBackdrop.js +10 -0
- package/esm/backdrop/ModalBackdrop.js +8 -0
- package/esm/backdrop/index.js +3 -0
- package/esm/badge/Badge.js +19 -0
- package/esm/badge/BadgeDot.js +11 -0
- package/esm/badge/BadgeFill.js +42 -0
- package/esm/badge/BadgeFillTriangle.js +138 -0
- package/esm/badge/BadgeWithText.js +24 -0
- package/esm/badge/index.js +5 -0
- package/esm/billing/BarChart.js +45 -0
- package/esm/billing/Grid.js +38 -0
- package/esm/billing/Header2.js +19 -0
- package/esm/billing/Header3.js +31 -0
- package/esm/billing/Paragraph.js +27 -0
- package/esm/billing/ParagraphGroup.js +16 -0
- package/esm/billing/ParagraphText.js +20 -0
- package/esm/billing/Section.js +44 -0
- package/esm/billing/SectionBody.js +11 -0
- package/esm/billing/SectionHeader.js +20 -0
- package/esm/billing/__stories__/BarChart.stories.js_bak +46 -0
- package/esm/billing/__stories__/Grid.stories.js_bak +57 -0
- package/esm/billing/__stories__/Header2.stories.js_bak +62 -0
- package/esm/billing/__stories__/Header3.stories.js_bak +69 -0
- package/esm/billing/__stories__/Paragraph.stories.js_bak +84 -0
- package/esm/billing/__stories__/ParagraphGroup.stories.js_bak +68 -0
- package/esm/billing/__stories__/ParagraphText.stories.js_bak +64 -0
- package/esm/billing/__stories__/Section.stories.js_bak +115 -0
- package/esm/billing/__stories__/SectionBody.stories.js_bak +62 -0
- package/esm/billing/__stories__/SectionHeader.stories.js-bak +68 -0
- package/esm/breadcrumb/Breadcrumb.js +71 -0
- package/esm/breadcrumb/index.js +1 -0
- package/esm/button/Button.js +145 -0
- package/esm/button/ButtonGroup.js +54 -0
- package/esm/button/IconButton.js +64 -0
- package/esm/button/ScrollToTopButton.js +47 -0
- package/esm/button/index.js +4 -0
- package/esm/callout/Callout.js +45 -0
- package/esm/callout/index.js +1 -0
- package/esm/chart/BarChart.js +147 -0
- package/esm/chart/DoughnutChart.js +110 -0
- package/esm/chart/LineChart.js +140 -0
- package/esm/chart/SingleBarChart.js +35 -0
- package/esm/chart/index.js +5 -0
- package/esm/chart/utils/centerTextPlugin.js +56 -0
- package/esm/chart/utils/customTooltip.js +84 -0
- package/esm/chart/utils/customTooltipLifecyclePlugin.js +16 -0
- package/esm/chart/utils/htmlLegendPlugin.js +83 -0
- package/esm/chart/utils/index.js +3 -0
- package/esm/chart/utils/padEmptyChartBar.js +47 -0
- package/esm/chart/utils/tooltipElement.js +17 -0
- package/esm/chart/utils/xAxisLabelTooltipPlugin.js +101 -0
- package/esm/chart/utils/yAxisTopTitlePlugin.js +43 -0
- package/esm/container/FlexContainer.js +33 -0
- package/esm/container/index.js +1 -0
- package/esm/cropper/Cropper.js +47 -0
- package/esm/cropper/CropperModalHandler.js +34 -0
- package/esm/cropper/index.js +2 -0
- package/esm/cropper/subComponent/CropImageModal.js +72 -0
- package/{datetimePicker/DatetimePicker.js → esm/datetimePicker/DatetimePickerV3.js} +63 -31
- package/esm/datetimePicker/TimeInput.js +49 -0
- package/esm/datetimePicker/TimePickerStyle.js +58 -0
- package/esm/datetimePicker/TimePickerV2.js +199 -0
- package/esm/datetimePicker/accordion/Month.js +245 -0
- package/esm/datetimePicker/accordion/Year.js +275 -0
- package/esm/datetimePicker/index.js +4 -0
- package/esm/datetimePicker/provider/constant.js +38 -0
- package/esm/datetimePicker/subComponent/DateTimePickerContext.js +3 -0
- package/esm/datetimePicker/utils/GMTDate.js +9 -0
- package/esm/datetimePicker/utils/pad.js +7 -0
- package/esm/datetimePicker/utils/toUTC0.js +7 -0
- package/esm/descriptionList/DescriptionDetail.js +21 -0
- package/esm/descriptionList/DescriptionList.js +18 -0
- package/esm/descriptionList/DescriptionTerm.js +7 -0
- package/esm/descriptionList/index.js +3 -0
- package/esm/divider/Divider.js +24 -0
- package/esm/divider/index.js +1 -0
- package/esm/dropdown/Dropdown.js +48 -0
- package/esm/dropdown/DropdownButtonOption.js +36 -0
- package/esm/dropdown/DropdownContent.js +83 -0
- package/esm/dropdown/DropdownDivOption.js +19 -0
- package/esm/dropdown/DropdownItem.js +19 -0
- package/esm/dropdown/DropdownLinkOption.js +17 -0
- package/esm/dropdown/DropdownToggle.js +31 -0
- package/esm/dropdown/index.js +11 -0
- package/esm/dropdown/subComponent/DropdownContext.js +3 -0
- package/esm/dropzone/FileDropzone.js +472 -0
- package/esm/dropzone/ImageDropzone.js +327 -0
- package/esm/dropzone/index.js +2 -0
- package/esm/dropzone/subComponent/Message.js +19 -0
- package/esm/figure/IconFigure.js +35 -0
- package/esm/figure/ImageFigure.js +31 -0
- package/esm/figure/index.js +2 -0
- package/esm/file/HiddenFileInput.js +8 -0
- package/esm/file/index.js +1 -0
- package/esm/form/Checkbox.js +157 -0
- package/esm/form/Fieldset.js +11 -0
- package/esm/form/FormItem.js +15 -0
- package/esm/form/Input.js +59 -0
- package/esm/form/Label.js +54 -0
- package/esm/form/MutedText.js +14 -0
- package/esm/form/PasswordInput.js +40 -0
- package/esm/form/RadioButton.js +94 -0
- package/esm/form/SearchSelect.js +174 -0
- package/esm/form/Searchbox.js +91 -0
- package/esm/form/Slider.js +39 -0
- package/esm/form/SwitchButton.js +97 -0
- package/esm/form/Textarea.js +34 -0
- package/esm/form/TreeView.js +66 -0
- package/esm/form/index.js +14 -0
- package/esm/grid/Column.js +39 -0
- package/esm/grid/Grid.js +28 -0
- package/esm/grid/index.js +2 -0
- package/esm/heading/Heading1.js +14 -0
- package/esm/heading/Heading2.js +21 -0
- package/esm/heading/Heading3.js +42 -0
- package/esm/heading/index.js +3 -0
- package/esm/helmet/Helmet.js +17 -0
- package/esm/helmet/index.js +2 -0
- package/esm/iconbox/ApplicationIconBox.js +74 -0
- package/esm/iconbox/IconBox.js +60 -0
- package/esm/iconbox/IconBoxV2.js +63 -0
- package/esm/iconbox/index.js +3 -0
- package/esm/iconbox/subComponent/IconBoxFigure.js +43 -0
- package/esm/iconbox/subComponent/IconBoxImage.js +35 -0
- package/esm/image/ImageFluid.js +10 -0
- package/esm/image/UploadImage.js +243 -0
- package/esm/image/index.js +2 -0
- package/esm/index.js +47 -0
- package/esm/keyframe/Pulse.js +15 -0
- package/esm/keyframe/Spin.js +7 -0
- package/esm/layout/Aside.js +39 -0
- package/esm/layout/AsideHeader.jsx +27 -0
- package/esm/layout/Backdrop.js +16 -0
- package/esm/layout/Container.js +30 -0
- package/esm/layout/Footer.js +36 -0
- package/esm/layout/Header.jsx +55 -0
- package/esm/layout/Layout.jsx +84 -0
- package/esm/layout/Logo.jsx +17 -0
- package/esm/layout/MenuIcon.jsx +27 -0
- package/esm/layout/Sidebar.jsx +271 -0
- package/esm/layout/index.js +1 -0
- package/esm/link/LinkSpan.js +62 -0
- package/esm/link/index.js +1 -0
- package/esm/map/GoogleMap.js +439 -0
- package/esm/map/GoogleReverseGeolocation.js +193 -0
- package/esm/map/LeafletMap.js +224 -0
- package/esm/map/LeafletReverseGeolocation.js +94 -0
- package/esm/map/index.js +4 -0
- package/esm/map/subComponent/BasicLeafletMap.js +27 -0
- package/esm/map/subComponent/GoogleMapContainer.js +22 -0
- package/esm/map/subComponent/GoogleMapPopup.js +103 -0
- package/esm/map/subComponent/GoogleMapWrapper.js +34 -0
- package/esm/map/subComponent/LeafletDrawControl.js +116 -0
- package/esm/map/subComponent/LeafletMapContainer.js +166 -0
- package/esm/map/subComponent/MapSearchBoxControl.js +47 -0
- package/esm/modal/StateModal.js +169 -0
- package/esm/modal/TitleModal.js +241 -0
- package/esm/modal/index.js +2 -0
- package/esm/page/Disclaimer.js +121 -0
- package/esm/page/index.js +1 -0
- package/esm/paginate/Paginate.js +129 -0
- package/esm/paginate/index.js +1 -0
- package/esm/popover/Popover.js +82 -0
- package/esm/popover/index.js +1 -0
- package/esm/qrcode/QRCode.js +51 -0
- package/esm/qrcode/QRCodeContainter.js +27 -0
- package/esm/qrcode/index.js +2 -0
- package/esm/ribbon/Ribbon.js +35 -0
- package/esm/ribbon/index.js +1 -0
- package/esm/section/Section.js +126 -0
- package/esm/section/SectionBody.js +43 -0
- package/esm/section/SectionHeader.js +61 -0
- package/esm/section/SectionToolbar.js +11 -0
- package/esm/section/SectionToolbarItem.js +10 -0
- package/esm/section/index.js +5 -0
- package/esm/select/InputSelect.js +263 -0
- package/esm/select/Select.js +811 -0
- package/esm/select/index.js +2 -0
- package/esm/select/subComponent/Checkbox.js +40 -0
- package/esm/select/subComponent/Footer.js +6 -0
- package/esm/select/subComponent/ListBox.js +23 -0
- package/esm/select/subComponent/Option.js +37 -0
- package/esm/select/subComponent/OptionGroup.js +16 -0
- package/esm/select/subComponent/Options.js +25 -0
- package/esm/select/subComponent/SearchBox.js +51 -0
- package/esm/select/subComponent/SelectedMultipleCount.js +32 -0
- package/esm/select/subComponent/SelectedMultipleTags.js +47 -0
- package/esm/select/subComponent/SelectedMultipleText.js +63 -0
- package/esm/select/subComponent/SelectedSingle.js +10 -0
- package/esm/styles/GlobalStyle.js +328 -0
- package/esm/styles/config/breakpoint.style.js +7 -0
- package/esm/styles/config/header.style.js +4 -0
- package/esm/styles/config/sidebar.style.js +11 -0
- package/esm/styles/index.js +2 -0
- package/esm/styles/mixin/backgroundColor.js +38 -0
- package/esm/styles/mixin/borderColor.js +31 -0
- package/esm/styles/mixin/color.js +31 -0
- package/esm/styles/mixin/colorOnBackground.js +31 -0
- package/esm/styles/mixin/inputPlaceholder.js +24 -0
- package/esm/styles/mixin/media.js +15 -0
- package/esm/styles/mixin/rounded.js +24 -0
- package/esm/styles/mixin/scrollbar.js +26 -0
- package/esm/styles/theme/dark.theme.js +91 -0
- package/esm/styles/theme/light.theme.js +91 -0
- package/esm/styles/theme/white.theme.js +91 -0
- package/esm/styles/themes.js +9 -0
- package/esm/table/GridTable.js +329 -0
- package/esm/table/ImageBox.js +38 -0
- package/esm/table/InfiniteGridTable.js +396 -0
- package/esm/table/PermissionTable.js +57 -0
- package/esm/table/SimpleGridTable.js +136 -0
- package/esm/table/Table.js +559 -0
- package/esm/table/__mock__/columns.js +64 -0
- package/esm/table/__mock__/data.js +530 -0
- package/esm/table/hooks/index.js +2 -0
- package/esm/table/hooks/useCalculateDataRange.js +22 -0
- package/esm/table/hooks/useGenerateSort.js +32 -0
- package/esm/table/index.js +6 -0
- package/esm/table/subComponent/BaseTableHeadCell.js +54 -0
- package/esm/table/subComponent/GridTableFooter.js +17 -0
- package/esm/table/subComponent/GridTableHeadCell.js +13 -0
- package/esm/table/subComponent/Resizer.js +70 -0
- package/esm/table/subComponent/TableFooter.js +24 -0
- package/esm/table/subComponent/TableFooterInfo.js +6 -0
- package/esm/table/subComponent/TableFooterPager.js +26 -0
- package/esm/table/subComponent/TableHeadCell.js +12 -0
- package/esm/table/subComponent/TableSort.js +31 -0
- package/esm/tagify/TagifyStyle.js +54 -0
- package/esm/tagify/Tags.js +49 -0
- package/esm/tagify/index.js +3 -0
- package/esm/tagify/templates/getCreateButtonTemplate.js +12 -0
- package/esm/text/Paragraph.js +79 -0
- package/esm/text/index.js +1 -0
- package/esm/timeline/Timeline.js +132 -0
- package/esm/timeline/index.js +1 -0
- package/esm/toast/CustomToastContainer.js +38 -0
- package/esm/toast/MessageContainer.js +44 -0
- package/esm/toast/index.js +3 -0
- package/esm/toast/show.js +29 -0
- package/esm/toast/style.css +1 -0
- package/esm/tooltip/Tooltip.js +133 -0
- package/esm/tooltip/index.js +1 -0
- package/esm/treeView/TreeViewV2.js +32 -0
- package/esm/treeView/TreeflexStyle.js +43 -0
- package/esm/treeView/index.js +2 -0
- package/esm/wizard/Wizard.js +244 -0
- package/esm/wizard/index.js +1 -0
- package/index.js +0 -12
- package/layout/Sidebar.jsx +1 -1
- package/package.json +5 -4
- package/datetimePicker/DatePicker.js +0 -363
- package/datetimePicker/DatePickerV2.js +0 -407
- package/datetimePicker/DatetimePickerV2.js +0 -395
- package/datetimePicker/TimePicker.js +0 -317
- package/datetimePicker/hooks/index.js +0 -27
- package/datetimePicker/hooks/useChangeNumber.js +0 -42
- package/datetimePicker/hooks/useDecrease.js +0 -38
- package/datetimePicker/hooks/useIncrease.js +0 -38
- package/datetimePicker/subComponent/Accordion.js +0 -373
- package/datetimePicker/subComponent/CustomTimeInput.js +0 -47
- package/jsoneditor/JsonEditor.js +0 -142
- package/jsoneditor/index.js +0 -13
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
const Label = styled.label`
|
|
3
|
+
display: inline-block;
|
|
4
|
+
color: var(--font-on-background);
|
|
5
|
+
font-size: var(--font-body1);
|
|
6
|
+
word-break: break-word;
|
|
7
|
+
white-space: pre-wrap;
|
|
8
|
+
margin-bottom: var(--spacing-xs);
|
|
9
|
+
|
|
10
|
+
${_ref => {
|
|
11
|
+
let {
|
|
12
|
+
required
|
|
13
|
+
} = _ref;
|
|
14
|
+
return required && `&:after {
|
|
15
|
+
content: ' *';
|
|
16
|
+
color: var(--color-danger);
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
}}
|
|
20
|
+
|
|
21
|
+
${_ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
noMarginBottom
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return noMarginBottom && 'margin-bottom: 0;';
|
|
26
|
+
}}
|
|
27
|
+
|
|
28
|
+
${_ref3 => {
|
|
29
|
+
let {
|
|
30
|
+
noBreakWord
|
|
31
|
+
} = _ref3;
|
|
32
|
+
return noBreakWord && 'word-break: keep-all;';
|
|
33
|
+
}}
|
|
34
|
+
|
|
35
|
+
/* use float to make element align to right */
|
|
36
|
+
/* use text-align to make all text(multiple line) align to right */
|
|
37
|
+
${_ref4 => {
|
|
38
|
+
let {
|
|
39
|
+
alignRight
|
|
40
|
+
} = _ref4;
|
|
41
|
+
return alignRight && `
|
|
42
|
+
text-align: right;
|
|
43
|
+
float: right;
|
|
44
|
+
`;
|
|
45
|
+
}}
|
|
46
|
+
|
|
47
|
+
${_ref5 => {
|
|
48
|
+
let {
|
|
49
|
+
disabled
|
|
50
|
+
} = _ref5;
|
|
51
|
+
return disabled && 'opacity: 0.5;';
|
|
52
|
+
}}
|
|
53
|
+
`;
|
|
54
|
+
export default Label;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
const MutedText = styled.span`
|
|
3
|
+
display: block;
|
|
4
|
+
font-size: var(--font-caption);
|
|
5
|
+
color: var(--font-on-mute);
|
|
6
|
+
text-align: ${_ref => {
|
|
7
|
+
let {
|
|
8
|
+
alignRight
|
|
9
|
+
} = _ref;
|
|
10
|
+
return alignRight ? 'right' : 'left';
|
|
11
|
+
}};
|
|
12
|
+
margin-top: var(--spacing-xs);
|
|
13
|
+
`;
|
|
14
|
+
export default MutedText;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import Input from './Input';
|
|
4
|
+
import { IconButton } from '../button';
|
|
5
|
+
import { BiShow, BiHide } from 'react-icons/bi/index.esm';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const PasswordInput = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
...props
|
|
10
|
+
} = _ref;
|
|
11
|
+
const [type, setType] = useState('password');
|
|
12
|
+
const toggleType = () => {
|
|
13
|
+
setType(type === 'password' ? 'text' : 'password');
|
|
14
|
+
};
|
|
15
|
+
return /*#__PURE__*/_jsxs(Container, {
|
|
16
|
+
children: [/*#__PURE__*/_jsx(Input, {
|
|
17
|
+
...props,
|
|
18
|
+
type: type
|
|
19
|
+
}), /*#__PURE__*/_jsxs(IconButton, {
|
|
20
|
+
size: "small",
|
|
21
|
+
onClick: toggleType,
|
|
22
|
+
children: [type === 'password' && /*#__PURE__*/_jsx(BiHide, {}), type === 'text' && /*#__PURE__*/_jsx(BiShow, {})]
|
|
23
|
+
})]
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const Container = styled.div`
|
|
27
|
+
position: relative;
|
|
28
|
+
|
|
29
|
+
${Input} {
|
|
30
|
+
padding-right: 40px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
${IconButton} {
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 50%;
|
|
36
|
+
transform: translateY(-50%);
|
|
37
|
+
right: 0.5rem;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
export default PasswordInput;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import Input from './Input';
|
|
3
|
+
import Label from './Label';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
const RadioButton = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
htmlFor,
|
|
8
|
+
value,
|
|
9
|
+
text,
|
|
10
|
+
disabled,
|
|
11
|
+
checked,
|
|
12
|
+
onChange,
|
|
13
|
+
noMarginBottom
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/_jsxs(StyledLabel, {
|
|
16
|
+
htmlFor: htmlFor,
|
|
17
|
+
disabled: disabled,
|
|
18
|
+
noMarginBottom: noMarginBottom,
|
|
19
|
+
children: [/*#__PURE__*/_jsx(StyledCheckbox, {
|
|
20
|
+
onChange: () => {
|
|
21
|
+
onChange(value);
|
|
22
|
+
},
|
|
23
|
+
checked: checked,
|
|
24
|
+
type: "checkbox",
|
|
25
|
+
id: htmlFor,
|
|
26
|
+
disabled: disabled
|
|
27
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
28
|
+
children: [/*#__PURE__*/_jsx(Unchecked, {}), text]
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const StyledCheckbox = styled(Input)`
|
|
33
|
+
display: none;
|
|
34
|
+
|
|
35
|
+
&:checked + span {
|
|
36
|
+
> div {
|
|
37
|
+
&:before {
|
|
38
|
+
display: block;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
const StyledLabel = styled(Label)`
|
|
44
|
+
margin-right: var(--spacing-xs);
|
|
45
|
+
|
|
46
|
+
> span {
|
|
47
|
+
${_ref2 => {
|
|
48
|
+
let {
|
|
49
|
+
disabled
|
|
50
|
+
} = _ref2;
|
|
51
|
+
return disabled && css`
|
|
52
|
+
opacity: 0.5;
|
|
53
|
+
`;
|
|
54
|
+
}}
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
|
|
58
|
+
> div {
|
|
59
|
+
margin-right: var(--spacing-xs);
|
|
60
|
+
border-radius: var(--border-radius-round);
|
|
61
|
+
|
|
62
|
+
width: 24px;
|
|
63
|
+
height: 24px;
|
|
64
|
+
|
|
65
|
+
&:before {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
${_ref3 => {
|
|
72
|
+
let {
|
|
73
|
+
noMarginBottom
|
|
74
|
+
} = _ref3;
|
|
75
|
+
return noMarginBottom && 'margin-bottom: 0;';
|
|
76
|
+
}}
|
|
77
|
+
`;
|
|
78
|
+
const Unchecked = styled.div`
|
|
79
|
+
border: var(--border-width) solid var(--border-color);
|
|
80
|
+
position: relative;
|
|
81
|
+
|
|
82
|
+
&:before {
|
|
83
|
+
content: '';
|
|
84
|
+
background: var(--color-primary);
|
|
85
|
+
width: 16px;
|
|
86
|
+
height: 16px;
|
|
87
|
+
position: absolute;
|
|
88
|
+
border-radius: var(--border-radius-round);
|
|
89
|
+
top: 50%;
|
|
90
|
+
left: 50%;
|
|
91
|
+
transform: translate(-50%, -50%);
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
export default RadioButton;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { FaSearch } from 'react-icons/fa/index.esm';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import Checkbox from './Checkbox';
|
|
5
|
+
import { MdClose } from 'react-icons/md/index.esm';
|
|
6
|
+
import inputPlaceholder from '../styles/mixin/inputPlaceholder';
|
|
7
|
+
import scrollbar from '../styles/mixin/scrollbar';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
+
const SearchSelect = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
keyword,
|
|
12
|
+
onSearch,
|
|
13
|
+
onSearchReset,
|
|
14
|
+
onToggleOptions,
|
|
15
|
+
options,
|
|
16
|
+
placeholder = 'Search',
|
|
17
|
+
setKeyword,
|
|
18
|
+
status = 'idle'
|
|
19
|
+
} = _ref;
|
|
20
|
+
const containerRef = useRef();
|
|
21
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
22
|
+
const [dropdownWidth, setDropdownWidth] = useState(0);
|
|
23
|
+
const handleSearch = event => {
|
|
24
|
+
if (event) {
|
|
25
|
+
onSearch(event.target.value);
|
|
26
|
+
setKeyword(event.target.value);
|
|
27
|
+
} else {
|
|
28
|
+
onSearch(keyword);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const handleSearchReset = () => {
|
|
32
|
+
setKeyword('');
|
|
33
|
+
onSearchReset();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// close dropdown when click outside of the component
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!containerRef.current || !showDropdown) return;
|
|
39
|
+
const handleClick = event => {
|
|
40
|
+
if (!containerRef.current?.contains(event.target)) {
|
|
41
|
+
setShowDropdown(false);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
document.addEventListener('click', handleClick);
|
|
45
|
+
return () => document.removeEventListener('click', handleClick);
|
|
46
|
+
}, [showDropdown]);
|
|
47
|
+
|
|
48
|
+
// close dropdown when no options
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
setShowDropdown(options.length > 0);
|
|
51
|
+
}, [options.length]);
|
|
52
|
+
|
|
53
|
+
// align container width to dropdown
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!containerRef.current) return;
|
|
56
|
+
const observer = new ResizeObserver(entries => {
|
|
57
|
+
const newWidth = entries[0].contentRect.width;
|
|
58
|
+
setDropdownWidth(newWidth);
|
|
59
|
+
});
|
|
60
|
+
observer.observe(containerRef.current);
|
|
61
|
+
return () => observer.disconnect();
|
|
62
|
+
}, []);
|
|
63
|
+
return /*#__PURE__*/_jsxs(Container, {
|
|
64
|
+
ref: containerRef,
|
|
65
|
+
children: [/*#__PURE__*/_jsxs(InputWrapper, {
|
|
66
|
+
children: [/*#__PURE__*/_jsx(FaSearch, {
|
|
67
|
+
onClick: () => {
|
|
68
|
+
if (keyword.trim()) {
|
|
69
|
+
handleSearch();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}), /*#__PURE__*/_jsx(Input, {
|
|
73
|
+
type: "text",
|
|
74
|
+
placeholder: placeholder,
|
|
75
|
+
onChange: handleSearch,
|
|
76
|
+
onFocus: () => setShowDropdown(options.length > 0),
|
|
77
|
+
value: keyword
|
|
78
|
+
}), onSearchReset && /*#__PURE__*/_jsx(MdClose, {
|
|
79
|
+
onClick: handleSearchReset,
|
|
80
|
+
style: {
|
|
81
|
+
visibility: status === 'empty' ? 'visible' : 'hidden'
|
|
82
|
+
}
|
|
83
|
+
})]
|
|
84
|
+
}), (showDropdown || status === 'empty') && /*#__PURE__*/_jsxs(Dropdown, {
|
|
85
|
+
style: {
|
|
86
|
+
width: dropdownWidth
|
|
87
|
+
},
|
|
88
|
+
children: [onSearchReset && status === 'empty' && /*#__PURE__*/_jsx(MessageWrapper, {
|
|
89
|
+
children: /*#__PURE__*/_jsx(Message, {
|
|
90
|
+
children: "Data Not Found"
|
|
91
|
+
})
|
|
92
|
+
}), status !== 'empty' && /*#__PURE__*/_jsx(_Fragment, {
|
|
93
|
+
children: /*#__PURE__*/_jsx(OptionList, {
|
|
94
|
+
children: options.map((option, index) => {
|
|
95
|
+
return /*#__PURE__*/_jsx(Option, {
|
|
96
|
+
onClick: () => onToggleOptions(index),
|
|
97
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
|
98
|
+
checked: option.checked,
|
|
99
|
+
htmlFor: option.text,
|
|
100
|
+
noMargin: true,
|
|
101
|
+
onChange: () => onToggleOptions(index),
|
|
102
|
+
text: option.text
|
|
103
|
+
})
|
|
104
|
+
}, index);
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
})]
|
|
108
|
+
})]
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const Container = styled.div`
|
|
112
|
+
position: relative;
|
|
113
|
+
min-width: 160px;
|
|
114
|
+
max-width: 320px;
|
|
115
|
+
`;
|
|
116
|
+
const InputWrapper = styled.div`
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
height: 36px;
|
|
120
|
+
background: var(--color-background2);
|
|
121
|
+
border-radius: var(--border-radius-l);
|
|
122
|
+
padding: var(--spacing-s);
|
|
123
|
+
margin: 0;
|
|
124
|
+
gap: var(--spacing-xs);
|
|
125
|
+
|
|
126
|
+
> svg {
|
|
127
|
+
color: var(--font-on-mute);
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
const Input = styled.input`
|
|
131
|
+
background: transparent;
|
|
132
|
+
border: none;
|
|
133
|
+
font-size: var(--font-body1);
|
|
134
|
+
color: var(--font-on-background);
|
|
135
|
+
outline: none;
|
|
136
|
+
flex:1;
|
|
137
|
+
min-width: 0;
|
|
138
|
+
|
|
139
|
+
${inputPlaceholder`
|
|
140
|
+
color: var(--font-on-mute);
|
|
141
|
+
`}
|
|
142
|
+
`;
|
|
143
|
+
const Dropdown = styled.div`
|
|
144
|
+
position: absolute;
|
|
145
|
+
inset: 44px auto auto 0px;
|
|
146
|
+
background: var(--color-background1);
|
|
147
|
+
color: var(--font-on-background);
|
|
148
|
+
border: var(--border-width) solid var(--border-color);
|
|
149
|
+
border-radius: var(--border-radius);
|
|
150
|
+
box-shadow: var(--box-shadow);
|
|
151
|
+
z-index: 1;
|
|
152
|
+
padding: var(--spacing-xs) 0;
|
|
153
|
+
overflow-y: auto;
|
|
154
|
+
max-height: min(320px, ((50vh - 36px) - 20px) - 36px);
|
|
155
|
+
${scrollbar}
|
|
156
|
+
`;
|
|
157
|
+
const OptionList = styled.div``;
|
|
158
|
+
const Option = styled.div`
|
|
159
|
+
padding: 12px var(--spacing-s);
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
|
|
162
|
+
&:hover {
|
|
163
|
+
background: var(--color-hover);
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
const MessageWrapper = styled.div`
|
|
167
|
+
width: 100%;
|
|
168
|
+
text-align: center;
|
|
169
|
+
`;
|
|
170
|
+
const Message = styled.p`
|
|
171
|
+
margin: 0;
|
|
172
|
+
padding: 12px var(--spacing-s);
|
|
173
|
+
`;
|
|
174
|
+
export default SearchSelect;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { FaSearch } from 'react-icons/fa/index.esm';
|
|
4
|
+
import { MdClose } from 'react-icons/md/index.esm';
|
|
5
|
+
import inputPlaceholder from '../styles/mixin/inputPlaceholder';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const Searchbox = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
onSearch,
|
|
10
|
+
autoFocus = false,
|
|
11
|
+
...props
|
|
12
|
+
} = _ref;
|
|
13
|
+
const [keyword, setKeyword] = useState('');
|
|
14
|
+
const handleSearch = keyword => {
|
|
15
|
+
if (onSearch) onSearch(keyword);
|
|
16
|
+
};
|
|
17
|
+
const handleKeyup = event => {
|
|
18
|
+
if (event.keyCode === 108 || event.keyCode === 13) {
|
|
19
|
+
handleSearch(keyword);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const handleClear = () => {
|
|
23
|
+
setKeyword('');
|
|
24
|
+
handleSearch('');
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
27
|
+
...props,
|
|
28
|
+
children: [/*#__PURE__*/_jsx(FaSearch, {
|
|
29
|
+
onClick: () => {
|
|
30
|
+
handleSearch(keyword);
|
|
31
|
+
},
|
|
32
|
+
role: "button",
|
|
33
|
+
"aria-label": "search button"
|
|
34
|
+
}), /*#__PURE__*/_jsx(Input, {
|
|
35
|
+
type: "text",
|
|
36
|
+
placeholder: "Search",
|
|
37
|
+
autocomplete: "false",
|
|
38
|
+
value: keyword,
|
|
39
|
+
onChange: event => setKeyword(event.target.value),
|
|
40
|
+
onKeyUp: handleKeyup,
|
|
41
|
+
autoFocus: autoFocus
|
|
42
|
+
}), keyword && /*#__PURE__*/_jsx(MdClose, {
|
|
43
|
+
onClick: handleClear,
|
|
44
|
+
role: "button",
|
|
45
|
+
"aria-label": "clear button"
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const Wrapper = styled.div`
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
position: relative;
|
|
53
|
+
height: 36px;
|
|
54
|
+
background: var(--color-background1);
|
|
55
|
+
border-radius: var(--border-radius-l);
|
|
56
|
+
padding: 0 calc(var(--spacing-s) + var(--font-body1) + var(--spacing-xs)) 0
|
|
57
|
+
var(--spacing-s);
|
|
58
|
+
|
|
59
|
+
> svg {
|
|
60
|
+
font-size: var(--font-body1);
|
|
61
|
+
color: var(--font-on-mute);
|
|
62
|
+
|
|
63
|
+
&:first-child {
|
|
64
|
+
margin-right: var(--spacing-xs);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&:last-child {
|
|
68
|
+
position: absolute;
|
|
69
|
+
right: var(--spacing-s);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
${_ref2 => {
|
|
74
|
+
let {
|
|
75
|
+
border
|
|
76
|
+
} = _ref2;
|
|
77
|
+
return border && 'border: var(--border-width) solid var(--border-color);';
|
|
78
|
+
}}
|
|
79
|
+
`;
|
|
80
|
+
const Input = styled.input`
|
|
81
|
+
background: transparent;
|
|
82
|
+
border: none;
|
|
83
|
+
font-size: var(--font-body1);
|
|
84
|
+
color: var(--font-on-background);
|
|
85
|
+
outline: none;
|
|
86
|
+
|
|
87
|
+
${inputPlaceholder`
|
|
88
|
+
color: var(--font-on-mute);
|
|
89
|
+
`}
|
|
90
|
+
`;
|
|
91
|
+
export default Searchbox;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
const Slider = props => {
|
|
4
|
+
return /*#__PURE__*/_jsx(RangeInput, {
|
|
5
|
+
...props
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
const RangeInput = styled.input.attrs(() => ({
|
|
9
|
+
type: 'range'
|
|
10
|
+
}))`
|
|
11
|
+
appearance: none;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 8px;
|
|
14
|
+
border-radius: var(--border-radius);
|
|
15
|
+
background: var(--color-grey);
|
|
16
|
+
|
|
17
|
+
${_ref => {
|
|
18
|
+
let {
|
|
19
|
+
autoWidth
|
|
20
|
+
} = _ref;
|
|
21
|
+
return autoWidth && 'width: auto;';
|
|
22
|
+
}};
|
|
23
|
+
|
|
24
|
+
&::-webkit-slider-thumb {
|
|
25
|
+
-webkit-appearance: none;
|
|
26
|
+
width: 16px;
|
|
27
|
+
height: 16px;
|
|
28
|
+
border-radius: var(--border-radius-round);
|
|
29
|
+
background: var(--color-primary);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&::-moz-range-thumb {
|
|
33
|
+
width: 16px;
|
|
34
|
+
height: 16px;
|
|
35
|
+
border-radius: var(--border-radius-round);
|
|
36
|
+
background: var(--color-primary);
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
export default Slider;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
const SwitchButton = _ref => {
|
|
4
|
+
let {
|
|
5
|
+
htmlFor,
|
|
6
|
+
text,
|
|
7
|
+
disabled,
|
|
8
|
+
checked = false,
|
|
9
|
+
onChange
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/_jsxs(Label, {
|
|
12
|
+
htmlFor: htmlFor,
|
|
13
|
+
disabled: disabled,
|
|
14
|
+
children: [/*#__PURE__*/_jsx(Checkbox, {
|
|
15
|
+
onChange: () => {
|
|
16
|
+
onChange(checked ? 0 : 1);
|
|
17
|
+
},
|
|
18
|
+
checked: checked,
|
|
19
|
+
type: "checkbox",
|
|
20
|
+
id: htmlFor,
|
|
21
|
+
disabled: disabled
|
|
22
|
+
}), /*#__PURE__*/_jsxs(Switch, {
|
|
23
|
+
children: [/*#__PURE__*/_jsx(SwitchTrack, {
|
|
24
|
+
checked: checked
|
|
25
|
+
}), /*#__PURE__*/_jsx(SwitchThumb, {
|
|
26
|
+
checked: checked
|
|
27
|
+
}), text]
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const Label = styled.label`
|
|
32
|
+
display: inline-block;
|
|
33
|
+
|
|
34
|
+
${_ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
disabled
|
|
37
|
+
} = _ref2;
|
|
38
|
+
return disabled && css`
|
|
39
|
+
opacity: 0.5;
|
|
40
|
+
cursor: not-allowed;
|
|
41
|
+
`;
|
|
42
|
+
}}
|
|
43
|
+
`;
|
|
44
|
+
const Checkbox = styled.input`
|
|
45
|
+
display: none;
|
|
46
|
+
`;
|
|
47
|
+
const Switch = styled.span`
|
|
48
|
+
color: var(--font-on-background);
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
position: relative;
|
|
52
|
+
|
|
53
|
+
${_ref3 => {
|
|
54
|
+
let {
|
|
55
|
+
disabled
|
|
56
|
+
} = _ref3;
|
|
57
|
+
return disabled && css`
|
|
58
|
+
opacity: 0.5;
|
|
59
|
+
`;
|
|
60
|
+
}}
|
|
61
|
+
`;
|
|
62
|
+
const SwitchTrack = styled.div`
|
|
63
|
+
position: relative;
|
|
64
|
+
width: 32px;
|
|
65
|
+
height: 16px;
|
|
66
|
+
border-radius: var(--border-radius);
|
|
67
|
+
background: ${_ref4 => {
|
|
68
|
+
let {
|
|
69
|
+
checked
|
|
70
|
+
} = _ref4;
|
|
71
|
+
return !checked ? 'var(--color-grey)' : 'var(--color-primary)';
|
|
72
|
+
}};
|
|
73
|
+
opacity: 0.5;
|
|
74
|
+
margin-right: calc(var(--spacing-xs) + 12px);
|
|
75
|
+
left: ${_ref5 => {
|
|
76
|
+
let {
|
|
77
|
+
checked
|
|
78
|
+
} = _ref5;
|
|
79
|
+
return checked ? '0' : '12px';
|
|
80
|
+
}};
|
|
81
|
+
`;
|
|
82
|
+
const SwitchThumb = styled.span`
|
|
83
|
+
width: 24px;
|
|
84
|
+
height: 24px;
|
|
85
|
+
background: var(--color-grey);
|
|
86
|
+
border-radius: var(--border-radius-round);
|
|
87
|
+
position: absolute;
|
|
88
|
+
transition: 0.3s;
|
|
89
|
+
|
|
90
|
+
${_ref6 => {
|
|
91
|
+
let {
|
|
92
|
+
checked
|
|
93
|
+
} = _ref6;
|
|
94
|
+
return !checked ? 'left: 0;' : 'left: 20px; background: var(--color-primary);';
|
|
95
|
+
}}
|
|
96
|
+
`;
|
|
97
|
+
export default SwitchButton;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import inputPlaceholder from '../styles/mixin/inputPlaceholder';
|
|
3
|
+
import scrollbar from '../styles/mixin/scrollbar';
|
|
4
|
+
const Textarea = styled.textarea`
|
|
5
|
+
display: block;
|
|
6
|
+
width: 100%;
|
|
7
|
+
border: var(--border-width) solid var(--border-color);
|
|
8
|
+
padding: 10px var(--spacing-s);
|
|
9
|
+
border-radius: var(--border-radius);
|
|
10
|
+
background: transparent;
|
|
11
|
+
color: var(--font-on-background);
|
|
12
|
+
transition: 0.3s;
|
|
13
|
+
line-height: 1.5;
|
|
14
|
+
|
|
15
|
+
/* disable resize because currently cannot fully control the resizer element */
|
|
16
|
+
resize: none;
|
|
17
|
+
|
|
18
|
+
${scrollbar}
|
|
19
|
+
|
|
20
|
+
&:focus {
|
|
21
|
+
border: var(--border-width) solid var(--color-primary);
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:disabled {
|
|
26
|
+
cursor: not-allowed;
|
|
27
|
+
opacity: 0.5;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
${inputPlaceholder`
|
|
31
|
+
color: var(--font-on-mute);
|
|
32
|
+
`}
|
|
33
|
+
`;
|
|
34
|
+
export default Textarea;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import Label from './Label';
|
|
3
|
+
import Checkbox from './Checkbox';
|
|
4
|
+
import Input from './Input';
|
|
5
|
+
import { FlexContainer } from '../container';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const TreeView = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
data,
|
|
10
|
+
onChange,
|
|
11
|
+
onBlur
|
|
12
|
+
} = _ref;
|
|
13
|
+
const renderList = function (data) {
|
|
14
|
+
let parentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
15
|
+
return /*#__PURE__*/_jsx(UnorderedList, {
|
|
16
|
+
children: data.map(item => {
|
|
17
|
+
const id = `${parentPath.join('')}${item.id}`.replace(/\s/g, '');
|
|
18
|
+
const currentPath = parentPath.concat(item.id);
|
|
19
|
+
return /*#__PURE__*/_jsxs("li", {
|
|
20
|
+
children: [item.type === 'checkbox' && /*#__PURE__*/_jsx(Checkbox, {
|
|
21
|
+
noMargin: true,
|
|
22
|
+
htmlFor: id,
|
|
23
|
+
checked: item.value,
|
|
24
|
+
text: item.text,
|
|
25
|
+
onChange: event => {
|
|
26
|
+
onChange(event, currentPath);
|
|
27
|
+
},
|
|
28
|
+
disabled: item.disabled
|
|
29
|
+
}), item.type === 'text' && /*#__PURE__*/_jsxs(FlexContainer, {
|
|
30
|
+
alignCenter: true,
|
|
31
|
+
children: [/*#__PURE__*/_jsx(Label, {
|
|
32
|
+
noMarginBottom: true,
|
|
33
|
+
htmlFor: id,
|
|
34
|
+
children: item.text
|
|
35
|
+
}), "\xA0", /*#__PURE__*/_jsx(Input, {
|
|
36
|
+
autoWidth: true,
|
|
37
|
+
type: "text",
|
|
38
|
+
id: id,
|
|
39
|
+
value: item.value,
|
|
40
|
+
onChange: event => {
|
|
41
|
+
onChange(event, currentPath);
|
|
42
|
+
},
|
|
43
|
+
onBlur: event => {
|
|
44
|
+
onBlur(event, currentPath);
|
|
45
|
+
},
|
|
46
|
+
disabled: item.disabled
|
|
47
|
+
})]
|
|
48
|
+
}), item.children?.length > 0 ? renderList(item.children, parentPath.concat(item.id)) : null]
|
|
49
|
+
}, item.id);
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
return renderList(data);
|
|
54
|
+
};
|
|
55
|
+
const UnorderedList = styled.ul`
|
|
56
|
+
color: var(--font-on-background);
|
|
57
|
+
|
|
58
|
+
ul {
|
|
59
|
+
margin-left: var(--spacing-s);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
li {
|
|
63
|
+
margin-top: var(--spacing-xs);
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
export default TreeView;
|