@majoo-ui/react 2.0.0 → 2.1.0-rc.0
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/charts.esm.js +3 -1453
- package/colors/Colors.esm.js +93 -0
- package/components/accordion/Accordion.esm.js +109 -0
- package/components/alertDialog/AlertDialog.esm.js +440 -0
- package/components/avatar/Avatar.esm.js +83 -0
- package/components/badge/Badge.esm.js +255 -0
- package/components/banner/Banner.esm.js +341 -0
- package/components/barChart/BarChart.esm.js +212 -0
- package/components/breadcrumb/Breadcrumb.esm.js +65 -0
- package/components/breadcrumb/index.esm.js +19 -0
- package/components/button/Button.esm.js +331 -0
- package/components/buttonGroup/ButtonGroup.esm.js +350 -0
- package/components/card/Card.esm.js +236 -0
- package/components/chart/assets/data_kosong.png.esm.js +3 -0
- package/components/chart/lineChart/LineChart.esm.js +358 -0
- package/components/chart/lineChart/components/Comparator.esm.js +82 -0
- package/components/chart/lineChart/components/ComparatorController.esm.js +112 -0
- package/components/chart/lineChart/components/ComparatorItem.esm.js +104 -0
- package/components/chart/lineChart/components/ProductList.esm.js +78 -0
- package/components/chart/lineChart/components/TitleLegend.esm.js +107 -0
- package/components/chart/lineChart/components/Tooltip.esm.js +90 -0
- package/components/chart/utils/index.esm.js +109 -0
- package/components/checkboxTable/CheckboxTable.esm.js +287 -0
- package/components/colorPicker/ColorPicker.esm.js +342 -0
- package/components/colorPicker/InputColorPicker.esm.js +120 -0
- package/components/colorPicker/assets/img_colormap.gif.esm.js +3 -0
- package/components/colorPicker/components/ColorFields.esm.js +144 -0
- package/components/colorPicker/components/ColorMap.esm.js +1188 -0
- package/components/contentEditor/ContentEditor.esm.js +251 -0
- package/components/contentEditor/assets/Inline-code-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Link-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/List-bulleted-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/List-numbered-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Redo-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-bold-filled.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-clear-format-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-italic-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-strikethrough-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-underline-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Undo-outline.svg.esm.js +3 -0
- package/components/contextMenu/ContextMenu.esm.js +298 -0
- package/components/datePicker/AdvancedOption.esm.js +37 -0
- package/components/datePicker/CustomDatePicker.esm.js +121 -0
- package/components/datePicker/DatePicker.esm.js +244 -0
- package/components/datePicker/DatePickerMulti.esm.js +70 -0
- package/components/datePicker/InputDatePicker.esm.js +290 -0
- package/components/datePicker/InputDateRangePicker.esm.js +174 -0
- package/components/datePicker/components/Calendar.esm.js +654 -0
- package/components/datePicker/components/CalendarMulti.esm.js +407 -0
- package/components/datePicker/components/CalendarTimePicker.esm.js +104 -0
- package/components/datePicker/components/DateNumber.esm.js +89 -0
- package/components/datePicker/components/MobileCalendar.esm.js +522 -0
- package/components/datePicker/state/reducer.esm.js +286 -0
- package/components/datePicker/timePicker/InputTimePicker.esm.js +205 -0
- package/components/datePicker/timePicker/TimePicker.esm.js +481 -0
- package/components/devicePreview/DevicePreview.esm.js +631 -0
- package/components/devicePreview/deviceFrame/android-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/android-wide-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-email.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-notification.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-sms.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-whatsapp.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/desktop-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/ic-majoo-profpic.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/iphone-transparant.png.esm.js +3 -0
- package/components/dialog/Dialog.esm.js +106 -0
- package/components/drawer/Drawer.esm.js +294 -0
- package/components/dropdownMenu/DropdownMenu.esm.js +281 -0
- package/components/editableTable/EditableMobile.esm.js +361 -0
- package/components/editableTable/EditableTable.esm.js +618 -0
- package/components/editableTable/transition.esm.js +37 -0
- package/components/form/components/FormGroup/FormGroup.esm.js +142 -0
- package/components/form/components/FormHelper/Helper.esm.js +50 -0
- package/components/form/components/FormLabel/Label.esm.js +90 -0
- package/components/form/components/InputAddon/InputAddon.esm.js +105 -0
- package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +60 -0
- package/components/form/components/InputCheckbox/InputCheckbox.esm.js +129 -0
- package/components/form/components/InputCheckbox/icon/CheckOutline.esm.js +33 -0
- package/components/form/components/InputCheckbox/icon/MinusOutline.esm.js +33 -0
- package/components/form/components/InputCombobox/InputCombobox.esm.js +169 -0
- package/components/form/components/InputCounter/InputCounter.esm.js +226 -0
- package/components/form/components/InputCreatable/InputCreatable.esm.js +229 -0
- package/components/form/components/InputDateRange/InputDateRange.esm.js +46 -0
- package/components/form/components/InputElement/InputElement.esm.js +35 -0
- package/components/form/components/InputGroup/InputGroup.esm.js +188 -0
- package/components/form/components/InputLetter/InputLetter.esm.js +68 -0
- package/components/form/components/InputNumber/InputNumber.esm.js +248 -0
- package/components/form/components/InputNumber/NumberFormat.esm.js +1263 -0
- package/components/form/components/InputOTP/InputOTP.esm.js +70 -0
- package/components/form/components/InputRadio/InputRadio.esm.js +273 -0
- package/components/form/components/InputRadio/InputRadioGroup.esm.js +35 -0
- package/components/form/components/InputRadio/context.esm.js +5 -0
- package/components/form/components/InputResourceList/InputResourceList.esm.js +429 -0
- package/components/form/components/InputSearchbox/CloseFilled.esm.js +34 -0
- package/components/form/components/InputSearchbox/InputSearchbox.esm.js +90 -0
- package/components/form/components/InputSearchbox/SearchOutline.esm.js +26 -0
- package/components/form/components/InputSelect/InputSelect.esm.js +964 -0
- package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +1388 -0
- package/components/form/components/InputSelectCheck/OptionGroupItem.esm.js +39 -0
- package/components/form/components/InputSelectCheck/icon/CheckOutline.esm.js +33 -0
- package/components/form/components/InputSelectTag/InputSelectTag.esm.js +62 -0
- package/components/form/components/InputSignature/InputSignature.esm.js +122 -0
- package/components/form/components/InputSignature/SignatureModal.esm.js +67 -0
- package/components/form/components/InputSwitch/InputSwitch.esm.js +96 -0
- package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +136 -0
- package/components/form/components/InputTags/InputTags.esm.js +268 -0
- package/components/form/components/InputText/InputText.esm.js +197 -0
- package/components/form/components/InputTextArea/InputTextArea.esm.js +77 -0
- package/components/heading/Heading.esm.js +64 -0
- package/components/iconButton/IconButton.esm.js +71 -0
- package/components/image/Image.esm.js +141 -0
- package/components/link/Link.esm.js +59 -0
- package/components/loadingBar/LoadingBar.esm.js +113 -0
- package/components/mapPicker/InputMapPicker.esm.js +160 -0
- package/components/mapPicker/MapPicker.esm.js +122 -0
- package/components/mapPicker/MapPicker.styles.esm.js +70 -0
- package/components/mapPicker/assets/images/Mapsicle.png.esm.js +3 -0
- package/components/mapPicker/components/AddressCard.esm.js +25 -0
- package/components/mapPicker/components/ButtonSelect.esm.js +46 -0
- package/components/mapPicker/components/ChangeView.esm.js +20 -0
- package/components/mapPicker/components/InputSearch.esm.js +74 -0
- package/components/mapPicker/components/MarkerIcon.esm.js +22 -0
- package/components/mapPicker/components/MarkerSvg.esm.js +62 -0
- package/components/mapPicker/components/ZoomControls.esm.js +36 -0
- package/components/mapPicker/hooks/useMapSearch.esm.js +161 -0
- package/components/modalDialog/ModalDialog.esm.js +247 -0
- package/components/notificationBadge/NotificationBadge.esm.js +149 -0
- package/components/pageDialog/PageDialog.esm.js +291 -0
- package/components/pageDialog/logo.svg.esm.js +3 -0
- package/components/pagination/Pagination.esm.js +94 -0
- package/components/pagination/PaginationButton.esm.js +346 -0
- package/components/pagination/PaginationInfo.esm.js +146 -0
- package/components/paper/Paper.esm.js +76 -0
- package/components/paragraph/Paragraph.esm.js +52 -0
- package/components/pieChart/PieChart.esm.js +287 -0
- package/components/popover/Popover.esm.js +142 -0
- package/components/progress/Progress.esm.js +170 -0
- package/components/progressIndicator/ProgressIndicator.esm.js +287 -0
- package/components/scrollSync/ScrollSync.esm.js +172 -0
- package/components/scrollSync/ScrollSyncNode.esm.js +87 -0
- package/components/scrollSync/utils.esm.js +9 -0
- package/components/separator/Separator.esm.js +43 -0
- package/components/skeleton/Skeleton.esm.js +131 -0
- package/components/slider/Slider.esm.js +345 -0
- package/components/stepWizard/StepWizard.esm.js +451 -0
- package/components/stepWizard/index.esm.js +14 -0
- package/components/table/MobileTable.esm.js +415 -0
- package/components/table/Table.esm.js +1472 -0
- package/components/table/components/columns/DateColumn.esm.js +26 -0
- package/components/table/components/columns/DecimalColumn.esm.js +36 -0
- package/components/table/components/columns/PriceColumn.esm.js +57 -0
- package/components/table/components/columns/RowDraggableColumn.esm.js +24 -0
- package/components/table/components/columns/RowExpanderColumn.esm.js +32 -0
- package/components/table/components/columns/RowExpanderMultipleColumn.esm.js +24 -0
- package/components/table/components/columns/RowMenuColumn.esm.js +101 -0
- package/components/table/components/columns/RowSelectionCallbackColumn.esm.js +38 -0
- package/components/table/components/columns/RowSelectionColumn.esm.js +34 -0
- package/components/table/images/img-emptydata.webp.esm.js +3 -0
- package/components/table/images/img-emptysearchdata.webp.esm.js +3 -0
- package/components/tableOfContent/TableOfContent.esm.js +267 -0
- package/components/tableOfContent/index.esm.js +18 -0
- package/components/tableOfContent/transition.esm.js +38 -0
- package/components/tabs/Tabs.esm.js +282 -0
- package/components/tag/Tag.esm.js +161 -0
- package/components/tagList/TagList.esm.js +90 -0
- package/components/tagStatus/TagStatus.esm.js +134 -0
- package/components/text/Text.esm.js +140 -0
- package/components/toast/Toast.esm.js +297 -0
- package/components/toast/ToastContainer.esm.js +73 -0
- package/components/toast/context/ToastContext.esm.js +5 -0
- package/components/toast/context/ToastProvider.esm.js +96 -0
- package/components/tooltip/Tooltip.esm.js +175 -0
- package/components/upload/Upload.esm.js +1103 -0
- package/components/upload/utils/canvasPreview.esm.js +39 -0
- package/components/upload/utils/imgPreview.esm.js +21 -0
- package/config/stitches.config.esm.js +216 -0
- package/editor.esm.js +1 -264
- package/hooks/useListOption/useListOption.esm.js +56 -0
- package/hooks/useToggle/useToggle.esm.js +8 -0
- package/index.esm.js +106 -42293
- package/layout/box/Box.esm.js +24 -0
- package/layout/flex/Flex.esm.js +135 -0
- package/layout/grid/Grid.esm.js +270 -0
- package/layout/pageContainer/PageContainer.esm.js +60 -0
- package/majoo-provider/MajooProvider.esm.js +42 -0
- package/majoo-provider/ThemeProvider.esm.js +41 -0
- package/majoo-provider/globalStyles.esm.js +242 -0
- package/majoo-provider/styles/modern-normalize.esm.js +95 -0
- package/map.esm.js +2 -734
- package/package.json +16 -5
- package/utils/calendar.esm.js +26 -0
- package/utils/element.esm.js +21 -0
- package/utils/object.esm.js +12 -0
- package/utils/request.esm.js +74 -0
- package/utils/strings.esm.js +6 -0
- package/{useMediaQuery.esm.js → utils/useMediaQuery.esm.js} +1 -1
- package/utils/useNavigatorOnline.esm.js +19 -0
- package/utils/variant.esm.js +12 -0
- package/wrapper/ConditionalWrapper.esm.js +9 -0
- package/ModalDialog.esm.js +0 -2669
- package/Separator.esm.js +0 -3002
- package/stitches.config.esm.js +0 -2284
- package/{index.esm.css → charts.esm.css} +4 -4
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import 'core-js/modules/es.iterator.constructor.js';
|
|
2
|
+
import 'core-js/modules/es.iterator.map.js';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import ReactSkeleton, { SkeletonTheme } from 'react-loading-skeleton';
|
|
5
|
+
import { keyframes, styled, colors } from '../../config/stitches.config.esm.js';
|
|
6
|
+
import { Grid, GridItem } from '../../layout/grid/Grid.esm.js';
|
|
7
|
+
import Box from '../../layout/box/Box.esm.js';
|
|
8
|
+
import { Card } from '../card/Card.esm.js';
|
|
9
|
+
import 'react-loading-skeleton/dist/skeleton.css';
|
|
10
|
+
import Flex from '../../layout/flex/Flex.esm.js';
|
|
11
|
+
|
|
12
|
+
const transform = keyframes({
|
|
13
|
+
'100%': {
|
|
14
|
+
transform: 'translateX(100%)'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const SkeletonContainer = styled(Box, {
|
|
18
|
+
'& .react-loading-skeleton::after': {
|
|
19
|
+
animation: `1.5s infinite normal ${transform} !important`,
|
|
20
|
+
animationTimingFunction: 'ease-in-out !important'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const StyledSkeleton = props => {
|
|
24
|
+
const {
|
|
25
|
+
color,
|
|
26
|
+
count,
|
|
27
|
+
width,
|
|
28
|
+
size,
|
|
29
|
+
circle
|
|
30
|
+
} = props;
|
|
31
|
+
function getBaseColor(color) {
|
|
32
|
+
switch (color) {
|
|
33
|
+
case 'primary':
|
|
34
|
+
return colors.gray300;
|
|
35
|
+
default:
|
|
36
|
+
return colors.gray150;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function getSize(size) {
|
|
40
|
+
switch (size) {
|
|
41
|
+
case 'md':
|
|
42
|
+
return 16;
|
|
43
|
+
case 'lg':
|
|
44
|
+
return 118;
|
|
45
|
+
default:
|
|
46
|
+
return 12;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return jsx(SkeletonTheme, {
|
|
50
|
+
width: width,
|
|
51
|
+
borderRadius: size === 'lg' ? 0 : 20,
|
|
52
|
+
baseColor: getBaseColor(color),
|
|
53
|
+
highlightColor: "#FAFAFA",
|
|
54
|
+
children: jsx(SkeletonContainer, {
|
|
55
|
+
children: jsx(ReactSkeleton, {
|
|
56
|
+
height: getSize(size),
|
|
57
|
+
count: count,
|
|
58
|
+
circle: circle
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const Space = styled('div', {
|
|
64
|
+
height: 8,
|
|
65
|
+
variants: {
|
|
66
|
+
size: {
|
|
67
|
+
sm: {
|
|
68
|
+
height: 8
|
|
69
|
+
},
|
|
70
|
+
md: {
|
|
71
|
+
height: 16
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const Container = styled(Flex, {
|
|
77
|
+
height: 'calc(100vh - 140px)',
|
|
78
|
+
flexDirection: 'column',
|
|
79
|
+
gap: '$spacing-06'
|
|
80
|
+
});
|
|
81
|
+
function Skeleton(props) {
|
|
82
|
+
const {
|
|
83
|
+
css,
|
|
84
|
+
variant,
|
|
85
|
+
width,
|
|
86
|
+
color,
|
|
87
|
+
patternCount = 2
|
|
88
|
+
} = props;
|
|
89
|
+
const renderGroup = count => jsx(Container, {
|
|
90
|
+
css: css,
|
|
91
|
+
children: jsx(Card, {
|
|
92
|
+
showBottomLine: false,
|
|
93
|
+
css: {
|
|
94
|
+
flex: 1,
|
|
95
|
+
padding: '$spacing-08 80px $spacing-08 $spacing-08',
|
|
96
|
+
background: '$bgWhite',
|
|
97
|
+
boxShadow: '0px 7px 15px rgba(0, 0, 0, 0.07)'
|
|
98
|
+
},
|
|
99
|
+
children: jsx(Grid, {
|
|
100
|
+
columns: 6,
|
|
101
|
+
gapY: 5,
|
|
102
|
+
children: new Array(count).fill('').map((_, index) => jsxs(GridItem, {
|
|
103
|
+
colSpan: 6,
|
|
104
|
+
children: [jsx(StyledSkeleton, {
|
|
105
|
+
size: "md",
|
|
106
|
+
color: "primary"
|
|
107
|
+
}), jsx(Space, {
|
|
108
|
+
size: "md"
|
|
109
|
+
}), jsxs(Box, {
|
|
110
|
+
children: [jsx(StyledSkeleton, {
|
|
111
|
+
width: "70%"
|
|
112
|
+
}), jsx(Space, {}), jsx(StyledSkeleton, {
|
|
113
|
+
width: "30%"
|
|
114
|
+
})]
|
|
115
|
+
})]
|
|
116
|
+
}, index))
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
return variant === 'single' ? jsx(StyledSkeleton, {
|
|
121
|
+
width: width,
|
|
122
|
+
color: color
|
|
123
|
+
}) : renderGroup(patternCount);
|
|
124
|
+
}
|
|
125
|
+
Skeleton.defaultProps = {
|
|
126
|
+
variant: 'group',
|
|
127
|
+
color: 'secondary',
|
|
128
|
+
width: '100%'
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { Skeleton as default };
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { styled } from '@stitches/react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const StyledSlider = styled(SliderPrimitive.Root, {
|
|
8
|
+
position: 'relative',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
userSelect: 'none',
|
|
12
|
+
touchAction: 'none',
|
|
13
|
+
width: 'auto',
|
|
14
|
+
padding: '4px 0',
|
|
15
|
+
cursor: 'pointer',
|
|
16
|
+
'&[data-orientation="horizontal"]': {
|
|
17
|
+
height: 20
|
|
18
|
+
},
|
|
19
|
+
'&[data-orientation="vertical"]': {
|
|
20
|
+
flexDirection: 'column',
|
|
21
|
+
width: 20,
|
|
22
|
+
minHeight: 100
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const StyledTrack = styled(SliderPrimitive.Track, {
|
|
26
|
+
position: 'relative',
|
|
27
|
+
flexGrow: 1,
|
|
28
|
+
borderRadius: '9999px',
|
|
29
|
+
backgroundColor: '$chartLightBrand',
|
|
30
|
+
'&:hover': {
|
|
31
|
+
backgroundColor: '$bgSelectedLight'
|
|
32
|
+
},
|
|
33
|
+
'&[data-orientation="horizontal"]': {
|
|
34
|
+
height: 4
|
|
35
|
+
},
|
|
36
|
+
'&[data-orientation="vertical"]': {
|
|
37
|
+
width: 4
|
|
38
|
+
},
|
|
39
|
+
variants: {
|
|
40
|
+
size: {
|
|
41
|
+
sm: {
|
|
42
|
+
'&[data-orientation="horizontal"]': {
|
|
43
|
+
height: 2
|
|
44
|
+
},
|
|
45
|
+
'&[data-orientation="vertical"]': {
|
|
46
|
+
width: 2
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
m: {
|
|
50
|
+
'&[data-orientation="horizontal"]': {
|
|
51
|
+
height: 4
|
|
52
|
+
},
|
|
53
|
+
'&[data-orientation="vertical"]': {
|
|
54
|
+
width: 4
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
lg: {
|
|
58
|
+
'&[data-orientation="horizontal"]': {
|
|
59
|
+
height: 6
|
|
60
|
+
},
|
|
61
|
+
'&[data-orientation="vertical"]': {
|
|
62
|
+
width: 6
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
color: {
|
|
67
|
+
green: {
|
|
68
|
+
backgroundColor: '$chartLightGreen',
|
|
69
|
+
'&:hover': {
|
|
70
|
+
backgroundColor: '$green100'
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
orange: {
|
|
74
|
+
backgroundColor: '$chartLightOrange',
|
|
75
|
+
'&:hover': {
|
|
76
|
+
backgroundColor: '$orange100'
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
blue: {
|
|
80
|
+
backgroundColor: '$chartLightBlue',
|
|
81
|
+
'&:hover': {
|
|
82
|
+
backgroundColor: '$blue100'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
purple: {
|
|
86
|
+
backgroundColor: '$chartLightPurple',
|
|
87
|
+
'&:hover': {
|
|
88
|
+
backgroundColor: '$purple100'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
yellow: {
|
|
92
|
+
backgroundColor: '$chartLightYellow',
|
|
93
|
+
'&:hover': {
|
|
94
|
+
backgroundColor: '$secondary100'
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
red: {
|
|
98
|
+
backgroundColor: '$chartLightRed',
|
|
99
|
+
'&:hover': {
|
|
100
|
+
backgroundColor: '$red100'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
dark: {
|
|
104
|
+
backgroundColor: '$chartLightGray',
|
|
105
|
+
'&:hover': {
|
|
106
|
+
backgroundColor: '$gray200'
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
brand: {
|
|
110
|
+
backgroundColor: '$chartLightBrand',
|
|
111
|
+
'&:hover': {
|
|
112
|
+
backgroundColor: '$bgSelectedLight'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const StyledRange = styled(SliderPrimitive.Range, {
|
|
119
|
+
position: 'absolute',
|
|
120
|
+
borderRadius: '9999px',
|
|
121
|
+
backgroundColor: '$primary500',
|
|
122
|
+
'&[data-orientation="horizontal"]': {
|
|
123
|
+
height: '100%'
|
|
124
|
+
},
|
|
125
|
+
'&[data-orientation="vertical"]': {
|
|
126
|
+
width: '100%'
|
|
127
|
+
},
|
|
128
|
+
variants: {
|
|
129
|
+
color: {
|
|
130
|
+
green: {
|
|
131
|
+
backgroundColor: '$chartGreen',
|
|
132
|
+
'&:hover': {
|
|
133
|
+
backgroundColor: '$primary500'
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
orange: {
|
|
137
|
+
backgroundColor: '$chartOrange',
|
|
138
|
+
'&:hover': {
|
|
139
|
+
backgroundColor: '$orange600'
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
blue: {
|
|
143
|
+
backgroundColor: '$chartBlue',
|
|
144
|
+
'&:hover': {
|
|
145
|
+
backgroundColor: '$blue600'
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
purple: {
|
|
149
|
+
backgroundColor: '$chartPurple',
|
|
150
|
+
'&:hover': {
|
|
151
|
+
backgroundColor: '$purple600'
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
yellow: {
|
|
155
|
+
backgroundColor: '$chartYellow',
|
|
156
|
+
'&:hover': {
|
|
157
|
+
backgroundColor: '$secondary600'
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
red: {
|
|
161
|
+
backgroundColor: '$chartRed',
|
|
162
|
+
'&:hover': {
|
|
163
|
+
backgroundColor: '$red600'
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
dark: {
|
|
167
|
+
backgroundColor: '$chartDark',
|
|
168
|
+
'&:hover': {
|
|
169
|
+
backgroundColor: '$gray900'
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
brand: {
|
|
173
|
+
backgroundColor: '$chartBrand',
|
|
174
|
+
'&:hover': {
|
|
175
|
+
backgroundColor: '$primary600'
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
const StyledThumb = styled(SliderPrimitive.Thumb, {
|
|
182
|
+
all: 'unset',
|
|
183
|
+
display: 'block',
|
|
184
|
+
width: 17,
|
|
185
|
+
height: 17,
|
|
186
|
+
borderRadius: '50%',
|
|
187
|
+
backgroundColor: '$white',
|
|
188
|
+
border: '1px solid $chartLightBrand',
|
|
189
|
+
$$shadowColor: '$colors$gray200',
|
|
190
|
+
boxShadow: '0px 2px 10px $$shadowColor',
|
|
191
|
+
'&:hover': {
|
|
192
|
+
backgroundColor: '$chartBrand'
|
|
193
|
+
},
|
|
194
|
+
'&:focus': {
|
|
195
|
+
boxShadow: '0 0 0 3px $$shadowColor'
|
|
196
|
+
},
|
|
197
|
+
variants: {
|
|
198
|
+
size: {
|
|
199
|
+
sm: {
|
|
200
|
+
width: 14,
|
|
201
|
+
height: 14
|
|
202
|
+
},
|
|
203
|
+
m: {
|
|
204
|
+
width: 17,
|
|
205
|
+
height: 17
|
|
206
|
+
},
|
|
207
|
+
lg: {
|
|
208
|
+
width: 20,
|
|
209
|
+
height: 20
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
color: {
|
|
213
|
+
green: {
|
|
214
|
+
border: '1px solid $chartGreen',
|
|
215
|
+
'&:hover': {
|
|
216
|
+
backgroundColor: '$chartLightGreen'
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
orange: {
|
|
220
|
+
border: '1px solid $chartOrange',
|
|
221
|
+
'&:hover': {
|
|
222
|
+
backgroundColor: '$chartLightOrange'
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
blue: {
|
|
226
|
+
border: '1px solid $chartBlue',
|
|
227
|
+
'&:hover': {
|
|
228
|
+
backgroundColor: '$chartLightBlue'
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
purple: {
|
|
232
|
+
border: '1px solid $chartPurple',
|
|
233
|
+
'&:hover': {
|
|
234
|
+
backgroundColor: '$chartLightPurple'
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
yellow: {
|
|
238
|
+
border: '1px solid $chartYellow',
|
|
239
|
+
'&:hover': {
|
|
240
|
+
backgroundColor: '$chartLightYellow'
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
red: {
|
|
244
|
+
border: '1px solid $chartRed',
|
|
245
|
+
'&:hover': {
|
|
246
|
+
backgroundColor: '$chartLightRed'
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
dark: {
|
|
250
|
+
border: '1px solid $chartDark',
|
|
251
|
+
'&:hover': {
|
|
252
|
+
backgroundColor: '$chartLightGray'
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
brand: {
|
|
256
|
+
border: '1px solid $chartBrand',
|
|
257
|
+
'&:hover': {
|
|
258
|
+
backgroundColor: '$chartLightBrand'
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
function Slider({
|
|
265
|
+
className,
|
|
266
|
+
defaultValue,
|
|
267
|
+
value,
|
|
268
|
+
name,
|
|
269
|
+
disabled,
|
|
270
|
+
orientation,
|
|
271
|
+
dir,
|
|
272
|
+
min,
|
|
273
|
+
max,
|
|
274
|
+
step,
|
|
275
|
+
onValueChange,
|
|
276
|
+
minStepsBetweenThumbs,
|
|
277
|
+
color,
|
|
278
|
+
size,
|
|
279
|
+
width,
|
|
280
|
+
height,
|
|
281
|
+
...props
|
|
282
|
+
}) {
|
|
283
|
+
return /*#__PURE__*/jsxs(StyledSlider, {
|
|
284
|
+
className: className,
|
|
285
|
+
defaultValue: defaultValue,
|
|
286
|
+
value: value,
|
|
287
|
+
name: name,
|
|
288
|
+
disabled: disabled,
|
|
289
|
+
orientation: orientation,
|
|
290
|
+
dir: dir,
|
|
291
|
+
min: min,
|
|
292
|
+
max: max,
|
|
293
|
+
step: step,
|
|
294
|
+
onValueChange: onValueChange,
|
|
295
|
+
minStepsBetweenThumbs: minStepsBetweenThumbs,
|
|
296
|
+
color: color,
|
|
297
|
+
css: {
|
|
298
|
+
width: orientation === 'vertical' ? 20 : width,
|
|
299
|
+
height: orientation === 'vertical' ? height : 20,
|
|
300
|
+
...props.css
|
|
301
|
+
},
|
|
302
|
+
...props,
|
|
303
|
+
children: [/*#__PURE__*/jsx(StyledTrack, {
|
|
304
|
+
color: color,
|
|
305
|
+
size: size,
|
|
306
|
+
children: /*#__PURE__*/jsx(StyledRange, {
|
|
307
|
+
color: color
|
|
308
|
+
})
|
|
309
|
+
}), /*#__PURE__*/jsx(StyledThumb, {
|
|
310
|
+
color: color,
|
|
311
|
+
size: size
|
|
312
|
+
})]
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
Slider.propTypes = {
|
|
316
|
+
className: PropTypes.string,
|
|
317
|
+
defaultValue: PropTypes.arrayOf(PropTypes.number),
|
|
318
|
+
value: PropTypes.arrayOf(PropTypes.number),
|
|
319
|
+
name: PropTypes.string,
|
|
320
|
+
disabled: PropTypes.bool,
|
|
321
|
+
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
322
|
+
dir: PropTypes.oneOf(['ltr', 'rtl']),
|
|
323
|
+
min: PropTypes.number,
|
|
324
|
+
max: PropTypes.number,
|
|
325
|
+
step: PropTypes.number,
|
|
326
|
+
onValueChange: PropTypes.func,
|
|
327
|
+
minStepsBetweenThumbs: PropTypes.number,
|
|
328
|
+
color: PropTypes.string,
|
|
329
|
+
size: PropTypes.string,
|
|
330
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
331
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
332
|
+
};
|
|
333
|
+
Slider.defaultProps = {
|
|
334
|
+
disabled: false,
|
|
335
|
+
orientation: 'horizontal',
|
|
336
|
+
dir: 'ltr',
|
|
337
|
+
min: 0,
|
|
338
|
+
max: 100,
|
|
339
|
+
step: 1,
|
|
340
|
+
minStepsBetweenThumbs: 0,
|
|
341
|
+
color: 'brand',
|
|
342
|
+
size: 'm'
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
export { Slider, Slider as default };
|