@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,142 @@
|
|
|
1
|
+
import { ConditionalWrapper } from '../../../../wrapper/ConditionalWrapper.esm.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
4
|
+
import Flex from '../../../../layout/flex/Flex.esm.js';
|
|
5
|
+
import Text from '../../../text/Text.esm.js';
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
const formLabelClassStyle = {
|
|
9
|
+
alignItems: 'start !important',
|
|
10
|
+
'& > div': {
|
|
11
|
+
width: 175
|
|
12
|
+
},
|
|
13
|
+
'& > div > span[role="label"]': {
|
|
14
|
+
color: '$textPrimary',
|
|
15
|
+
fontSize: '$label',
|
|
16
|
+
fontWeight: 500,
|
|
17
|
+
lineHeight: '$label',
|
|
18
|
+
letterSpacings: '$label',
|
|
19
|
+
'@md': {
|
|
20
|
+
color: '$textPrimary',
|
|
21
|
+
fontSize: '$section-sub-title',
|
|
22
|
+
fontWeight: 600,
|
|
23
|
+
lineHeight: '$section-sub-title',
|
|
24
|
+
letterSpacings: '$section-sub-title'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const formLabelStyle = {
|
|
29
|
+
'& > .form-label': {
|
|
30
|
+
...formLabelClassStyle
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const StyledFormGroup = styled('div', {
|
|
34
|
+
display: 'grid',
|
|
35
|
+
gridTemplateColumns: '1fr',
|
|
36
|
+
rowGap: '$spacing-03',
|
|
37
|
+
variants: {
|
|
38
|
+
withCounter: {
|
|
39
|
+
true: {
|
|
40
|
+
'& > .form-label': {
|
|
41
|
+
marginTop: '-24px',
|
|
42
|
+
...formLabelClassStyle
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
responsive: {
|
|
47
|
+
input: {
|
|
48
|
+
display: 'grid',
|
|
49
|
+
gridTemplateColumns: '1fr',
|
|
50
|
+
gap: '$spacing-03',
|
|
51
|
+
...formLabelStyle,
|
|
52
|
+
'@md': {
|
|
53
|
+
gridTemplateColumns: '175px 1fr',
|
|
54
|
+
columnGap: '$cozy',
|
|
55
|
+
rowGap: '$spacing-03',
|
|
56
|
+
'& > *:nth-child(n+3)': {
|
|
57
|
+
gridColumn: '2/3'
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
button: {
|
|
62
|
+
display: 'grid',
|
|
63
|
+
gridTemplateColumns: '1fr',
|
|
64
|
+
...formLabelStyle,
|
|
65
|
+
'@md': {
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
gridTemplateColumns: '175px 1fr',
|
|
68
|
+
columnGap: '$cozy',
|
|
69
|
+
rowGap: '$spacing-03',
|
|
70
|
+
'& > *:nth-child(n+3)': {
|
|
71
|
+
gridColumn: '2/3'
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
switch: {
|
|
76
|
+
display: 'grid',
|
|
77
|
+
gridTemplateColumns: '1fr 1fr',
|
|
78
|
+
'& *:nth-child(2)': {
|
|
79
|
+
justifySelf: 'flex-end'
|
|
80
|
+
},
|
|
81
|
+
'& *:nth-child(3)': {
|
|
82
|
+
gridColumn: '1/3'
|
|
83
|
+
},
|
|
84
|
+
'& *:nth-child(4)': {
|
|
85
|
+
gridColumn: '1/3'
|
|
86
|
+
},
|
|
87
|
+
...formLabelStyle,
|
|
88
|
+
'@md': {
|
|
89
|
+
alignItems: 'center',
|
|
90
|
+
gridTemplateColumns: '175px auto 1fr',
|
|
91
|
+
columnGap: '$cozy',
|
|
92
|
+
rowGap: '$spacing-03',
|
|
93
|
+
'& *:nth-child(2)': {
|
|
94
|
+
justifySelf: 'flex-start'
|
|
95
|
+
},
|
|
96
|
+
'& *:nth-child(3)': {
|
|
97
|
+
gridColumn: 'unset'
|
|
98
|
+
},
|
|
99
|
+
'& > *:nth-child(n+4)': {
|
|
100
|
+
gridColumn: '2/3'
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const FormGroup = ({
|
|
108
|
+
count,
|
|
109
|
+
maxCount,
|
|
110
|
+
css,
|
|
111
|
+
...props
|
|
112
|
+
}) => {
|
|
113
|
+
const withCounter = Boolean(count || maxCount);
|
|
114
|
+
return /*#__PURE__*/jsx(ConditionalWrapper, {
|
|
115
|
+
condition: withCounter,
|
|
116
|
+
wrapper: children => /*#__PURE__*/jsxs(Flex, {
|
|
117
|
+
direction: "column",
|
|
118
|
+
css: css,
|
|
119
|
+
children: [/*#__PURE__*/jsxs(Text, {
|
|
120
|
+
variant: "label",
|
|
121
|
+
color: "disable",
|
|
122
|
+
css: {
|
|
123
|
+
alignSelf: 'end',
|
|
124
|
+
marginBottom: '$spacing-03 !important'
|
|
125
|
+
},
|
|
126
|
+
children: [count, "/", maxCount]
|
|
127
|
+
}), children]
|
|
128
|
+
}),
|
|
129
|
+
children: /*#__PURE__*/jsx(StyledFormGroup, {
|
|
130
|
+
withCounter: withCounter,
|
|
131
|
+
css: {
|
|
132
|
+
...(!withCounter && {
|
|
133
|
+
...css
|
|
134
|
+
})
|
|
135
|
+
},
|
|
136
|
+
...props
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
FormGroup.displayName = 'FormGroup';
|
|
141
|
+
|
|
142
|
+
export { FormGroup as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
3
|
+
import Text from '../../../text/Text.esm.js';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const StyledHelper = styled(Text, {
|
|
8
|
+
display: 'inline-block',
|
|
9
|
+
color: '$textSecondary',
|
|
10
|
+
variants: {
|
|
11
|
+
error: {
|
|
12
|
+
true: {
|
|
13
|
+
color: '$textRed'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const FormHelper = ({
|
|
19
|
+
children,
|
|
20
|
+
error,
|
|
21
|
+
errorMessage,
|
|
22
|
+
...props
|
|
23
|
+
}) => {
|
|
24
|
+
const errorByMessage = !!errorMessage;
|
|
25
|
+
if (error === undefined && errorByMessage) {
|
|
26
|
+
return /*#__PURE__*/jsx(StyledHelper, {
|
|
27
|
+
error: true,
|
|
28
|
+
variant: "helper",
|
|
29
|
+
className: "retina-error",
|
|
30
|
+
...props,
|
|
31
|
+
children: errorMessage
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (children === undefined) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return /*#__PURE__*/jsx(StyledHelper, {
|
|
38
|
+
error: error,
|
|
39
|
+
variant: "helper",
|
|
40
|
+
classname: "retina-error",
|
|
41
|
+
...props,
|
|
42
|
+
children: children
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
FormHelper.propTypes = {
|
|
46
|
+
error: PropTypes.bool
|
|
47
|
+
};
|
|
48
|
+
FormHelper.displayName = 'FormHelper';
|
|
49
|
+
|
|
50
|
+
export { FormHelper as default };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import 'core-js/modules/es.array.includes.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
4
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
5
|
+
import Text from '../../../text/Text.esm.js';
|
|
6
|
+
import { CircleQuestionOutline } from '@majoo-ui/icons';
|
|
7
|
+
import Flex from '../../../../layout/flex/Flex.esm.js';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
import Badge from '../../../badge/Badge.esm.js';
|
|
11
|
+
import Tooltip from '../../../tooltip/Tooltip.esm.js';
|
|
12
|
+
|
|
13
|
+
const StyledLabel = styled(LabelPrimitive.Root, Text, {
|
|
14
|
+
display: 'inline-block',
|
|
15
|
+
fontSize: '$label',
|
|
16
|
+
lineHeight: '$label',
|
|
17
|
+
fontWeight: '500',
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
required: {
|
|
21
|
+
'&::after': {
|
|
22
|
+
color: '$textRed',
|
|
23
|
+
content: '*'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const StyledHelpIcon = styled(CircleQuestionOutline, {
|
|
30
|
+
size: '16px'
|
|
31
|
+
});
|
|
32
|
+
const LabelVariantsEnum = ['required', 'optional', 'with-tooltip'];
|
|
33
|
+
const FormLabel = ({
|
|
34
|
+
children,
|
|
35
|
+
htmlFor,
|
|
36
|
+
variant,
|
|
37
|
+
variants,
|
|
38
|
+
tooltipLabel,
|
|
39
|
+
count,
|
|
40
|
+
maxCount,
|
|
41
|
+
labelCss,
|
|
42
|
+
...props
|
|
43
|
+
}) => {
|
|
44
|
+
return /*#__PURE__*/jsxs(Flex, {
|
|
45
|
+
justify: "between",
|
|
46
|
+
className: "form-label",
|
|
47
|
+
children: [/*#__PURE__*/jsxs(Flex, {
|
|
48
|
+
align: "center",
|
|
49
|
+
gap: 3,
|
|
50
|
+
...props,
|
|
51
|
+
children: [/*#__PURE__*/jsx(StyledLabel, {
|
|
52
|
+
htmlFor: htmlFor,
|
|
53
|
+
variant: variant,
|
|
54
|
+
css: labelCss,
|
|
55
|
+
children: children
|
|
56
|
+
}), (variant === LabelVariantsEnum[1] || variants.includes(LabelVariantsEnum[1])) && /*#__PURE__*/jsx(Badge, {
|
|
57
|
+
css: {
|
|
58
|
+
padding: '$spacing-02 $spacing-03',
|
|
59
|
+
color: '$gray600',
|
|
60
|
+
backgroundColor: '$gray150',
|
|
61
|
+
borderRadius: '100px',
|
|
62
|
+
fontSize: '$label',
|
|
63
|
+
lineHeight: '$label'
|
|
64
|
+
},
|
|
65
|
+
children: "Opsional"
|
|
66
|
+
}), (variant === LabelVariantsEnum[2] || variants.includes(LabelVariantsEnum[2])) && /*#__PURE__*/jsx(Tooltip, {
|
|
67
|
+
label: tooltipLabel,
|
|
68
|
+
children: /*#__PURE__*/jsx(StyledHelpIcon, {})
|
|
69
|
+
})]
|
|
70
|
+
}), maxCount && /*#__PURE__*/jsxs(Text, {
|
|
71
|
+
variant: "label",
|
|
72
|
+
color: "disable",
|
|
73
|
+
children: [count, "/", maxCount]
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
FormLabel.propTypes = {
|
|
78
|
+
variant: PropTypes.oneOf(LabelVariantsEnum),
|
|
79
|
+
variants: PropTypes.array,
|
|
80
|
+
htmlFor: PropTypes.string,
|
|
81
|
+
tooltipLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
82
|
+
count: PropTypes.number,
|
|
83
|
+
maxCount: PropTypes.number
|
|
84
|
+
};
|
|
85
|
+
FormLabel.defaultProps = {
|
|
86
|
+
variants: []
|
|
87
|
+
};
|
|
88
|
+
FormLabel.displayName = 'FormLabel';
|
|
89
|
+
|
|
90
|
+
export { LabelVariantsEnum, FormLabel as default };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
3
|
+
import Text from '../../../text/Text.esm.js';
|
|
4
|
+
|
|
5
|
+
const InputAddon = styled(Text, {
|
|
6
|
+
backgroundColor: '$formDisable',
|
|
7
|
+
flex: '0 0 auto',
|
|
8
|
+
width: 'auto',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
whiteSpace: 'nowrap',
|
|
12
|
+
padding: '6px $spacing-05',
|
|
13
|
+
'&.addon:hover': {
|
|
14
|
+
borderColor: '$gray300'
|
|
15
|
+
},
|
|
16
|
+
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
sm: {
|
|
19
|
+
height: 32
|
|
20
|
+
},
|
|
21
|
+
lg: {
|
|
22
|
+
height: 40
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
placements: {
|
|
26
|
+
left: {
|
|
27
|
+
border: '1px solid $bgOutline',
|
|
28
|
+
borderRightWidth: 0,
|
|
29
|
+
borderRadius: '$lg',
|
|
30
|
+
borderEndEndRadius: 0,
|
|
31
|
+
borderStartEndRadius: 0
|
|
32
|
+
},
|
|
33
|
+
right: {
|
|
34
|
+
border: '1px solid $bgOutline',
|
|
35
|
+
borderLeftWidth: 0,
|
|
36
|
+
borderRadius: '$lg',
|
|
37
|
+
borderEndStartRadius: 0,
|
|
38
|
+
borderStartStartRadius: 0
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
size: 'lg'
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
InputAddon.defaultProps = {
|
|
47
|
+
as: 'div',
|
|
48
|
+
className: 'addon'
|
|
49
|
+
};
|
|
50
|
+
const InputLeftAddon = styled(InputAddon, {
|
|
51
|
+
variants: {
|
|
52
|
+
isInvalid: {
|
|
53
|
+
true: {
|
|
54
|
+
border: '1px solid $colors$red400',
|
|
55
|
+
borderRight: 0,
|
|
56
|
+
'&:focus': {
|
|
57
|
+
border: '1px solid $colors$red400',
|
|
58
|
+
borderRight: 0
|
|
59
|
+
},
|
|
60
|
+
'&:hover': {
|
|
61
|
+
border: '1px solid $colors$red400',
|
|
62
|
+
borderRight: 0
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: {
|
|
68
|
+
placements: 'left',
|
|
69
|
+
variant: 'placeholder'
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
InputLeftAddon.defaultProps = {
|
|
73
|
+
as: 'div',
|
|
74
|
+
className: 'addon'
|
|
75
|
+
};
|
|
76
|
+
InputLeftAddon.name = 'InputLeftAddon';
|
|
77
|
+
const InputRightAddon = styled(InputAddon, {
|
|
78
|
+
variants: {
|
|
79
|
+
isInvalid: {
|
|
80
|
+
true: {
|
|
81
|
+
border: '1px solid $colors$red400',
|
|
82
|
+
borderLeft: 0,
|
|
83
|
+
'&:focus': {
|
|
84
|
+
border: '1px solid $colors$red400',
|
|
85
|
+
borderLeft: 0
|
|
86
|
+
},
|
|
87
|
+
'&:hover': {
|
|
88
|
+
border: '1px solid $colors$red400',
|
|
89
|
+
borderLeft: 0
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
defaultVariants: {
|
|
95
|
+
placements: 'right',
|
|
96
|
+
variant: 'placeholder'
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
InputRightAddon.name = 'InputRightAddon';
|
|
100
|
+
InputRightAddon.defaultProps = {
|
|
101
|
+
as: 'div',
|
|
102
|
+
className: 'addon'
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export { InputLeftAddon, InputRightAddon };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import 'core-js/modules/es.iterator.constructor.js';
|
|
2
|
+
import 'core-js/modules/es.iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/es.iterator.map.js';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import React__default, { useState, createContext } from 'react';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
const CheckboxContext = /*#__PURE__*/createContext();
|
|
9
|
+
const CheckboxGroup = ({
|
|
10
|
+
children,
|
|
11
|
+
onChange,
|
|
12
|
+
value,
|
|
13
|
+
defaultValue,
|
|
14
|
+
disabled
|
|
15
|
+
}) => {
|
|
16
|
+
const [selectedItems, setSelectedItems] = useState(defaultValue);
|
|
17
|
+
const checkItem = (item, index) => {
|
|
18
|
+
if (!value) {
|
|
19
|
+
setSelectedItems(current => {
|
|
20
|
+
const items = [...current, item];
|
|
21
|
+
if (onChange) onChange(items);
|
|
22
|
+
return items;
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
if (onChange) onChange([...value, item], index);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const uncheckItem = (item, index) => {
|
|
29
|
+
if (!value) {
|
|
30
|
+
setSelectedItems(current => {
|
|
31
|
+
const items = current.filter(currItem => currItem !== item);
|
|
32
|
+
if (onChange) onChange(items);
|
|
33
|
+
return items;
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
if (onChange) onChange(value.filter(currItem => currItem !== item), index);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const values = {
|
|
40
|
+
checkItem,
|
|
41
|
+
uncheckItem,
|
|
42
|
+
checkedItems: value || selectedItems
|
|
43
|
+
};
|
|
44
|
+
return /*#__PURE__*/jsx(CheckboxContext.Provider, {
|
|
45
|
+
value: values,
|
|
46
|
+
children: React__default.Children.map(children, child => /*#__PURE__*/React__default.cloneElement(child, {
|
|
47
|
+
disabled: child.props.disabled || disabled
|
|
48
|
+
}))
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
CheckboxGroup.propTypes = {
|
|
52
|
+
onChange: PropTypes.func.isRequired,
|
|
53
|
+
defaultValue: PropTypes.array
|
|
54
|
+
};
|
|
55
|
+
CheckboxGroup.defaultProps = {
|
|
56
|
+
defaultValue: []
|
|
57
|
+
};
|
|
58
|
+
CheckboxGroup.displayName = 'CheckboxGroup';
|
|
59
|
+
|
|
60
|
+
export { CheckboxContext, CheckboxGroup as default };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import 'core-js/modules/es.array.includes.js';
|
|
2
|
+
import { useContext, useState, useEffect } from 'react';
|
|
3
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
6
|
+
import Flex from '../../../../layout/flex/Flex.esm.js';
|
|
7
|
+
import FormLabel from '../FormLabel/Label.esm.js';
|
|
8
|
+
import { CheckboxContext } from './CheckboxGroup.esm.js';
|
|
9
|
+
import CheckOutline from './icon/CheckOutline.esm.js';
|
|
10
|
+
import SvgMinusOutline from './icon/MinusOutline.esm.js';
|
|
11
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
const StyledIndicator = styled(CheckboxPrimitive.Indicator, {
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
display: 'flex',
|
|
16
|
+
height: '125%',
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
width: '125%'
|
|
19
|
+
});
|
|
20
|
+
const StyledCheckbox = styled(CheckboxPrimitive.Root, {
|
|
21
|
+
all: 'unset',
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
backgroundColor: 'white',
|
|
24
|
+
$$cbSize: '13px',
|
|
25
|
+
minWidth: '$$cbSize',
|
|
26
|
+
minHeight: '$$cbSize',
|
|
27
|
+
width: '$$cbSize',
|
|
28
|
+
height: '$$cbSize',
|
|
29
|
+
border: '1.5px solid $bgOutline',
|
|
30
|
+
borderRadius: '3px',
|
|
31
|
+
display: 'flex',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
'&:hover': {
|
|
35
|
+
border: '1.5px solid $primary400'
|
|
36
|
+
},
|
|
37
|
+
'&:focus': {
|
|
38
|
+
outline: '1.5px solid #82C4E0',
|
|
39
|
+
outlineOffset: '1px'
|
|
40
|
+
},
|
|
41
|
+
'&[data-state=checked]': {
|
|
42
|
+
backgroundColor: '$primary500',
|
|
43
|
+
border: '1.5px solid $primary500',
|
|
44
|
+
color: 'white',
|
|
45
|
+
'&:hover': {
|
|
46
|
+
backgroundColor: '$primary600',
|
|
47
|
+
border: '1.5px solid $primary600'
|
|
48
|
+
},
|
|
49
|
+
'&:focus': {}
|
|
50
|
+
},
|
|
51
|
+
'&:disabled': {
|
|
52
|
+
pointerEvents: 'none',
|
|
53
|
+
border: '1.5px solid $gray200',
|
|
54
|
+
'&[data-state=checked]': {
|
|
55
|
+
backgroundColor: '$gray200',
|
|
56
|
+
color: 'white'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const Checkbox = ({
|
|
61
|
+
id,
|
|
62
|
+
checked,
|
|
63
|
+
indeterminate,
|
|
64
|
+
disabled,
|
|
65
|
+
onCheckedChange,
|
|
66
|
+
label,
|
|
67
|
+
index,
|
|
68
|
+
value,
|
|
69
|
+
...props
|
|
70
|
+
}) => {
|
|
71
|
+
const context = useContext(CheckboxContext);
|
|
72
|
+
const [isChecked, setChecked] = useState(false);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
const checkValue = context && context.checkedItems.includes(value) || checked || indeterminate;
|
|
75
|
+
setChecked(checkValue ?? false);
|
|
76
|
+
}, [checked, indeterminate, context]);
|
|
77
|
+
return /*#__PURE__*/jsx(StyledCheckbox, {
|
|
78
|
+
id: id,
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
checked: isChecked,
|
|
81
|
+
onCheckedChange: isChecked => {
|
|
82
|
+
if (context) {
|
|
83
|
+
if (isChecked) context.checkItem(value, index);
|
|
84
|
+
if (!isChecked) context.uncheckItem(value, index);
|
|
85
|
+
}
|
|
86
|
+
if (onCheckedChange) onCheckedChange(isChecked);
|
|
87
|
+
},
|
|
88
|
+
...props,
|
|
89
|
+
children: /*#__PURE__*/jsx(StyledIndicator, {
|
|
90
|
+
children: indeterminate ? /*#__PURE__*/jsx(SvgMinusOutline, {}) : /*#__PURE__*/jsx(CheckOutline, {})
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
const InputCheckbox = ({
|
|
95
|
+
...props
|
|
96
|
+
}) => {
|
|
97
|
+
return props.label ? /*#__PURE__*/jsxs(Flex, {
|
|
98
|
+
align: "center",
|
|
99
|
+
gap: 4,
|
|
100
|
+
children: [/*#__PURE__*/jsx(Checkbox, {
|
|
101
|
+
...props
|
|
102
|
+
}), /*#__PURE__*/jsx(FormLabel, {
|
|
103
|
+
htmlFor: props.id,
|
|
104
|
+
labelCss: {
|
|
105
|
+
fontSize: '$long-content-regular',
|
|
106
|
+
lineHeight: '$long-content-regular',
|
|
107
|
+
letterSpacing: '$long-content-regular',
|
|
108
|
+
fontWeight: '400',
|
|
109
|
+
color: props.disabled ? '$textDisable' : '$textPrimary',
|
|
110
|
+
cursor: 'default'
|
|
111
|
+
},
|
|
112
|
+
children: props.label
|
|
113
|
+
})]
|
|
114
|
+
}) : /*#__PURE__*/jsx(Checkbox, {
|
|
115
|
+
...props
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
InputCheckbox.propTypes = {
|
|
119
|
+
checked: PropTypes.bool,
|
|
120
|
+
indeterminate: PropTypes.bool,
|
|
121
|
+
disabled: PropTypes.bool,
|
|
122
|
+
onCheckedChange: PropTypes.func,
|
|
123
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
124
|
+
index: PropTypes.number,
|
|
125
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object])
|
|
126
|
+
};
|
|
127
|
+
InputCheckbox.displayName = 'InputCheckbox';
|
|
128
|
+
|
|
129
|
+
export { InputCheckbox as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
const CheckOutline = props => /*#__PURE__*/jsxs("svg", {
|
|
5
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
+
xmlSpace: "preserve",
|
|
7
|
+
width: "1em",
|
|
8
|
+
height: "1em",
|
|
9
|
+
style: {
|
|
10
|
+
shapeRendering: 'geometricPrecision',
|
|
11
|
+
textRendering: 'geometricPrecision',
|
|
12
|
+
imageRendering: 'optimizeQuality',
|
|
13
|
+
fillRule: 'evenodd',
|
|
14
|
+
clipRule: 'evenodd'
|
|
15
|
+
},
|
|
16
|
+
viewBox: "0 0 13.06 13.06",
|
|
17
|
+
...props,
|
|
18
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
19
|
+
d: "M0 2.5A2.5 2.5 0 0 1 2.5 0h8.05a2.5 2.5 0 0 1 2.5 2.5v8.05a2.5 2.5 0 0 1-2.5 2.5H2.5c-.66 0-1.3-.26-1.77-.73S0 11.21 0 10.55V2.5z",
|
|
20
|
+
style: {
|
|
21
|
+
fill: 'none',
|
|
22
|
+
fillRule: 'nonzero'
|
|
23
|
+
}
|
|
24
|
+
}), /*#__PURE__*/jsx("path", {
|
|
25
|
+
d: "M10.12 4.53a.47.47 0 0 0 .14-.33.47.47 0 0 0-.14-.33.47.47 0 0 0-.33-.14.47.47 0 0 0-.33.14L5.13 8.2 3.6 6.66a.47.47 0 0 0-.33-.14.47.47 0 0 0-.33.14.47.47 0 0 0-.14.33c0 .12.05.24.14.33l1.87 1.87c.04.04.09.08.15.1.06.02.12.04.18.04s.12-.01.18-.04c.06-.02.11-.06.15-.1l4.66-4.66z",
|
|
26
|
+
style: {
|
|
27
|
+
fill: '#fefefe',
|
|
28
|
+
fillRule: 'nonzero'
|
|
29
|
+
}
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export { CheckOutline as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
const SvgMinusOutline = props => /*#__PURE__*/jsxs("svg", {
|
|
5
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
+
xmlSpace: "preserve",
|
|
7
|
+
width: "1em",
|
|
8
|
+
height: "1em",
|
|
9
|
+
style: {
|
|
10
|
+
shapeRendering: 'geometricPrecision',
|
|
11
|
+
textRendering: 'geometricPrecision',
|
|
12
|
+
imageRendering: 'optimizeQuality',
|
|
13
|
+
fillRule: 'evenodd',
|
|
14
|
+
clipRule: 'evenodd'
|
|
15
|
+
},
|
|
16
|
+
viewBox: "0 0 18.22 18.22",
|
|
17
|
+
...props,
|
|
18
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
19
|
+
d: "M15.61 0H2.6A2.595 2.595 0 0 0 0 2.6v13.01a2.595 2.595 0 0 0 2.6 2.6h13.01a2.595 2.595 0 0 0 2.6-2.6V2.6a2.595 2.595 0 0 0-2.6-2.6z",
|
|
20
|
+
style: {
|
|
21
|
+
fill: 'none',
|
|
22
|
+
fillRule: 'nonzero'
|
|
23
|
+
}
|
|
24
|
+
}), /*#__PURE__*/jsx("path", {
|
|
25
|
+
style: {
|
|
26
|
+
fill: '#fefefe',
|
|
27
|
+
fillRule: 'nonzero'
|
|
28
|
+
},
|
|
29
|
+
d: "M14.31 10.41H3.9v-2.6h10.41z"
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export { SvgMinusOutline as default };
|