@majoo-ui/react 2.0.1 → 2.1.0-rc.1
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 +8 -4
- 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
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import 'core-js/modules/es.array.includes.js';
|
|
2
|
+
import 'core-js/modules/es.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/es.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/es.iterator.find.js';
|
|
5
|
+
import 'core-js/modules/es.iterator.map.js';
|
|
6
|
+
import React__default from 'react';
|
|
7
|
+
import { Tag } from '../../../tag/Tag.esm.js';
|
|
8
|
+
import Box from '../../../../layout/box/Box.esm.js';
|
|
9
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
10
|
+
import Paragraph from '../../../paragraph/Paragraph.esm.js';
|
|
11
|
+
import FormHelper from '../FormHelper/Helper.esm.js';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
|
+
|
|
15
|
+
const Wrapper = styled('div', {
|
|
16
|
+
margin: 0,
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
display: 'block',
|
|
19
|
+
position: 'relative',
|
|
20
|
+
fontFamily: 'inherit',
|
|
21
|
+
fontVariantNumeric: 'tabular-nums',
|
|
22
|
+
fontSize: '$short-content-regular',
|
|
23
|
+
fontWeight: '400',
|
|
24
|
+
textAlign: 'left',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
letterSpacing: '$short-content-regular',
|
|
27
|
+
lineHeight: '$short-content-regular',
|
|
28
|
+
color: '$textDisable',
|
|
29
|
+
width: '100%'
|
|
30
|
+
});
|
|
31
|
+
const InputTagsComponent = styled('div', {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
position: 'relative',
|
|
34
|
+
flexWrap: 'wrap',
|
|
35
|
+
width: '100%',
|
|
36
|
+
margin: '0',
|
|
37
|
+
appearance: 'none',
|
|
38
|
+
backgroundolor: 'none',
|
|
39
|
+
boxSizing: 'border-box',
|
|
40
|
+
border: '1px solid $bgOutline',
|
|
41
|
+
color: '$textPrimary',
|
|
42
|
+
lineHeight: '$short-content-regular',
|
|
43
|
+
fontSize: '$short-content-regular',
|
|
44
|
+
fontWeight: '400',
|
|
45
|
+
'&:focus-within': {
|
|
46
|
+
border: '1px solid $formActive'
|
|
47
|
+
},
|
|
48
|
+
'&:hover': {
|
|
49
|
+
border: '1px solid $gray500'
|
|
50
|
+
},
|
|
51
|
+
variants: {
|
|
52
|
+
disabled: {
|
|
53
|
+
true: {
|
|
54
|
+
backgroundColor: '$formDisable',
|
|
55
|
+
color: '$textDisable',
|
|
56
|
+
cursor: 'not-allowed',
|
|
57
|
+
'&:hover': {
|
|
58
|
+
border: '1px solid $formDefault'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
size: {
|
|
63
|
+
sm: {
|
|
64
|
+
height: 32,
|
|
65
|
+
padding: '5px 16px',
|
|
66
|
+
borderRadius: '$md'
|
|
67
|
+
},
|
|
68
|
+
lg: {
|
|
69
|
+
height: 40,
|
|
70
|
+
padding: '8px 16px',
|
|
71
|
+
borderRadius: '$lg'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
isInvalid: {
|
|
75
|
+
true: {
|
|
76
|
+
border: '1px solid $formError',
|
|
77
|
+
'&:focus-within': {
|
|
78
|
+
border: '1px solid $formError'
|
|
79
|
+
},
|
|
80
|
+
'&:hover': {
|
|
81
|
+
border: '1px solid $formError'
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const Input = styled('input', {
|
|
88
|
+
display: 'flex',
|
|
89
|
+
position: 'relative',
|
|
90
|
+
flex: 'auto',
|
|
91
|
+
flexWrap: 'wrap',
|
|
92
|
+
maxWidth: '100%',
|
|
93
|
+
appearance: 'none',
|
|
94
|
+
backgroundolor: 'none',
|
|
95
|
+
border: 'none',
|
|
96
|
+
fontSize: '$short-content-regular',
|
|
97
|
+
lineHeight: '$short-content-regular',
|
|
98
|
+
cursor: 'text',
|
|
99
|
+
outline: 'none',
|
|
100
|
+
letterSpacing: '$short-content-regular',
|
|
101
|
+
'&:disabled': {
|
|
102
|
+
backgroundColor: 'transparent',
|
|
103
|
+
color: '$textDisable',
|
|
104
|
+
cursor: 'not-allowed',
|
|
105
|
+
'&::placeholder': {
|
|
106
|
+
color: '$textDisable'
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
const TagWrapper = styled(Box, {
|
|
111
|
+
display: 'flex',
|
|
112
|
+
position: 'relative',
|
|
113
|
+
flexWrap: 'wrap',
|
|
114
|
+
maxWidth: '100%',
|
|
115
|
+
marginTop: '5px',
|
|
116
|
+
gap: '5px'
|
|
117
|
+
});
|
|
118
|
+
function InputTags({
|
|
119
|
+
size,
|
|
120
|
+
isInvalid,
|
|
121
|
+
placeholder,
|
|
122
|
+
onChange,
|
|
123
|
+
onEnter,
|
|
124
|
+
onInputChange,
|
|
125
|
+
value,
|
|
126
|
+
disabled,
|
|
127
|
+
readOnly,
|
|
128
|
+
max,
|
|
129
|
+
maxChar,
|
|
130
|
+
pattern,
|
|
131
|
+
helperText,
|
|
132
|
+
unremovableTags,
|
|
133
|
+
onRemoveItem,
|
|
134
|
+
...props
|
|
135
|
+
}) {
|
|
136
|
+
const [tags, setTags] = React__default.useState(value);
|
|
137
|
+
const [regexError, setRegexError] = React__default.useState(false);
|
|
138
|
+
React__default.useEffect(() => {
|
|
139
|
+
setTags(value);
|
|
140
|
+
}, [value]);
|
|
141
|
+
React__default.useEffect(() => {
|
|
142
|
+
onChange && onChange(tags);
|
|
143
|
+
}, [tags]);
|
|
144
|
+
const addTags = event => {
|
|
145
|
+
if (event.key === 'Enter' && event.target.value !== '' && max !== tags.length) {
|
|
146
|
+
if (tags.find(tag => tag.toLowerCase() === event.target.value.toLowerCase())) {
|
|
147
|
+
onEnter?.({
|
|
148
|
+
key: 'duplicate',
|
|
149
|
+
value: event.target.value
|
|
150
|
+
});
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (pattern && pattern?.regex) {
|
|
154
|
+
const regex = new RegExp(pattern.regex);
|
|
155
|
+
if (!regex.test(event.target.value)) {
|
|
156
|
+
onEnter?.({
|
|
157
|
+
key: 'error',
|
|
158
|
+
value: event.target.value
|
|
159
|
+
});
|
|
160
|
+
setRegexError(true);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
setRegexError(false);
|
|
165
|
+
onEnter?.({
|
|
166
|
+
key: 'success',
|
|
167
|
+
value: event.target.value
|
|
168
|
+
});
|
|
169
|
+
setTags([...tags, event.target.value]);
|
|
170
|
+
event.target.value = '';
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const removeTags = (index, key) => {
|
|
174
|
+
if (disabled || readOnly) {
|
|
175
|
+
return tags;
|
|
176
|
+
} else {
|
|
177
|
+
onRemoveItem?.(tags[index]);
|
|
178
|
+
setTags([...tags.filter(tag => tags.indexOf(tag) !== index)]);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// const handleErrorMessage = () => {
|
|
183
|
+
// if (regexError && pattern) {
|
|
184
|
+
// if (pattern.errorMessage) {
|
|
185
|
+
// return <Text color="red">{pattern.errorMessage}</Text>;
|
|
186
|
+
// }
|
|
187
|
+
|
|
188
|
+
// return <Text color="red">Invalid Input</Text>;
|
|
189
|
+
// }
|
|
190
|
+
// };
|
|
191
|
+
return /*#__PURE__*/jsxs(Wrapper, {
|
|
192
|
+
children: [/*#__PURE__*/jsx(InputTagsComponent, {
|
|
193
|
+
size: size,
|
|
194
|
+
isInvalid: isInvalid || regexError,
|
|
195
|
+
disabled: disabled || readOnly || tags.length >= max,
|
|
196
|
+
value: value,
|
|
197
|
+
css: {
|
|
198
|
+
...props.css
|
|
199
|
+
},
|
|
200
|
+
...props,
|
|
201
|
+
children: /*#__PURE__*/jsx(Input, {
|
|
202
|
+
type: "text",
|
|
203
|
+
onKeyUp: event => addTags(event)
|
|
204
|
+
// onKeyDown={event => removeTags(tags.length - 1, event.key)}
|
|
205
|
+
,
|
|
206
|
+
placeholder: placeholder,
|
|
207
|
+
onChange: onInputChange,
|
|
208
|
+
disabled: disabled || readOnly || tags.length >= max,
|
|
209
|
+
maxLength: maxChar
|
|
210
|
+
// pattern={pattern}
|
|
211
|
+
})
|
|
212
|
+
}), regexError && pattern && (pattern?.errorMessage ? /*#__PURE__*/jsx(FormHelper, {
|
|
213
|
+
color: "red",
|
|
214
|
+
children: pattern.errorMessage
|
|
215
|
+
}) : /*#__PURE__*/jsx(FormHelper, {
|
|
216
|
+
color: "red",
|
|
217
|
+
children: "Invalid Input"
|
|
218
|
+
})), helperText && /*#__PURE__*/jsx(Paragraph, {
|
|
219
|
+
shortContentRegular: true,
|
|
220
|
+
css: {
|
|
221
|
+
paddingTop: 8,
|
|
222
|
+
paddingBottom: 3,
|
|
223
|
+
fontSize: 12,
|
|
224
|
+
color: '$textSecondary'
|
|
225
|
+
},
|
|
226
|
+
children: helperText
|
|
227
|
+
}), /*#__PURE__*/jsx(TagWrapper, {
|
|
228
|
+
children: tags.map((tag, index) => /*#__PURE__*/jsx(Tag, {
|
|
229
|
+
disabled: disabled,
|
|
230
|
+
readOnly: readOnly,
|
|
231
|
+
size: size,
|
|
232
|
+
isRemovable: disabled || readOnly || unremovableTags.includes(tag) ? false : true,
|
|
233
|
+
onRemove: () => removeTags(index),
|
|
234
|
+
children: tag
|
|
235
|
+
}, index))
|
|
236
|
+
})]
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
InputTags.propTypes = {
|
|
240
|
+
placeholder: PropTypes.string,
|
|
241
|
+
size: PropTypes.string,
|
|
242
|
+
value: PropTypes.arrayOf(PropTypes.string),
|
|
243
|
+
onChange: PropTypes.arrayOf(PropTypes.string),
|
|
244
|
+
onRemoveItem: PropTypes.func,
|
|
245
|
+
onEnter: PropTypes.func,
|
|
246
|
+
onInputChange: PropTypes.func,
|
|
247
|
+
max: PropTypes.number,
|
|
248
|
+
maxChar: PropTypes.number,
|
|
249
|
+
isInvalid: PropTypes.bool,
|
|
250
|
+
disabled: PropTypes.bool,
|
|
251
|
+
unremovableTags: PropTypes.arrayOf(PropTypes.string),
|
|
252
|
+
readOnly: PropTypes.bool,
|
|
253
|
+
helperText: PropTypes.string,
|
|
254
|
+
pattern: PropTypes.shape({
|
|
255
|
+
regex: PropTypes.string.isRequired,
|
|
256
|
+
errorMessage: PropTypes.string
|
|
257
|
+
})
|
|
258
|
+
};
|
|
259
|
+
InputTags.defaultProps = {
|
|
260
|
+
placeholder: 'Placeholder',
|
|
261
|
+
size: 'lg',
|
|
262
|
+
isInvalid: false,
|
|
263
|
+
disabled: false,
|
|
264
|
+
unremovableTags: [],
|
|
265
|
+
readOnly: false
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export { InputTags, InputTags as default };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
const disabledStyle = {
|
|
7
|
+
backgroundColor: '$formDisable',
|
|
8
|
+
color: '$textDisable',
|
|
9
|
+
cursor: 'not-allowed',
|
|
10
|
+
'&::placeholder': {
|
|
11
|
+
color: '$textDisable'
|
|
12
|
+
},
|
|
13
|
+
'&:hover': {
|
|
14
|
+
border: '1px solid $bgOutline'
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const StyledInput = styled('input', {
|
|
18
|
+
// Reset
|
|
19
|
+
appearance: 'none',
|
|
20
|
+
boxSizing: 'border-box',
|
|
21
|
+
fontFamily: 'inherit',
|
|
22
|
+
margin: '0',
|
|
23
|
+
outline: 'none',
|
|
24
|
+
width: '100%',
|
|
25
|
+
WebkitTapHighlightColor: 'rgba(0,0,0,0)',
|
|
26
|
+
'&::before': {
|
|
27
|
+
boxSizing: 'border-box'
|
|
28
|
+
},
|
|
29
|
+
'&::after': {
|
|
30
|
+
boxSizing: 'border-box'
|
|
31
|
+
},
|
|
32
|
+
// Custom
|
|
33
|
+
background: 'none',
|
|
34
|
+
color: '$textPrimary',
|
|
35
|
+
fontVariantNumeric: 'tabular-nums',
|
|
36
|
+
fontSize: '$short-content-regular',
|
|
37
|
+
letterSpacing: '$short-content-regular',
|
|
38
|
+
lineHeight: '$short-content-regular',
|
|
39
|
+
fontWeight: '400',
|
|
40
|
+
padding: '10px $spacing-05',
|
|
41
|
+
border: '1px solid $bgOutline',
|
|
42
|
+
borderRadius: '$lg',
|
|
43
|
+
'&:focus': {
|
|
44
|
+
border: '1px solid $primary400'
|
|
45
|
+
},
|
|
46
|
+
'&:active': {
|
|
47
|
+
border: '1px solid $primary400'
|
|
48
|
+
},
|
|
49
|
+
'&:hover': {
|
|
50
|
+
border: '1px solid $primary600'
|
|
51
|
+
},
|
|
52
|
+
'&:disabled': disabledStyle,
|
|
53
|
+
'&[data-state="readonly"]': {
|
|
54
|
+
backgroundColor: '$formDisable'
|
|
55
|
+
},
|
|
56
|
+
'&::placeholder': {
|
|
57
|
+
color: '$textDisable'
|
|
58
|
+
},
|
|
59
|
+
compoundVariants: [{
|
|
60
|
+
inputGroup: true,
|
|
61
|
+
isInvalid: true,
|
|
62
|
+
css: {
|
|
63
|
+
border: 'none',
|
|
64
|
+
'&:focus': {
|
|
65
|
+
border: 'none'
|
|
66
|
+
},
|
|
67
|
+
'&:hover': {
|
|
68
|
+
border: 'none'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}],
|
|
72
|
+
variants: {
|
|
73
|
+
isDisabled: {
|
|
74
|
+
true: disabledStyle
|
|
75
|
+
},
|
|
76
|
+
isReadOnly: {
|
|
77
|
+
true: {
|
|
78
|
+
backgroundColor: '$formDisable'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
inputGroup: {
|
|
82
|
+
true: {
|
|
83
|
+
border: 'none',
|
|
84
|
+
borderRadius: '$lg',
|
|
85
|
+
'&:focus': {
|
|
86
|
+
border: 'none'
|
|
87
|
+
},
|
|
88
|
+
'&:active': {
|
|
89
|
+
border: 'none'
|
|
90
|
+
},
|
|
91
|
+
'&:hover': {
|
|
92
|
+
border: 'none'
|
|
93
|
+
},
|
|
94
|
+
'&:disabled': {
|
|
95
|
+
backgroundColor: 'transparent',
|
|
96
|
+
color: '$textDisable',
|
|
97
|
+
cursor: 'default',
|
|
98
|
+
'&::placeholder': {
|
|
99
|
+
color: '$textDisable'
|
|
100
|
+
},
|
|
101
|
+
'&:hover': {
|
|
102
|
+
border: '1px solid $bgOutline'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
asChild: {
|
|
108
|
+
true: {
|
|
109
|
+
paddingLeft: 0,
|
|
110
|
+
paddingRight: 0,
|
|
111
|
+
border: 'none',
|
|
112
|
+
borderRadius: '$lg',
|
|
113
|
+
'&:focus': {
|
|
114
|
+
border: 'none'
|
|
115
|
+
},
|
|
116
|
+
'&:active': {
|
|
117
|
+
border: 'none'
|
|
118
|
+
},
|
|
119
|
+
'&:hover': {
|
|
120
|
+
border: 'none'
|
|
121
|
+
},
|
|
122
|
+
'&:disabled': {
|
|
123
|
+
backgroundColor: 'transparent',
|
|
124
|
+
color: '$textDisable',
|
|
125
|
+
cursor: 'default',
|
|
126
|
+
'&::placeholder': {
|
|
127
|
+
color: '$textDisable'
|
|
128
|
+
},
|
|
129
|
+
'&:hover': {
|
|
130
|
+
border: 'none'
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Please insert size with string 'sm' | 'lg'
|
|
137
|
+
*/
|
|
138
|
+
size: {
|
|
139
|
+
sm: {
|
|
140
|
+
height: 32
|
|
141
|
+
},
|
|
142
|
+
lg: {
|
|
143
|
+
height: 40
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
isInvalid: {
|
|
147
|
+
true: {
|
|
148
|
+
border: '1px solid $red400',
|
|
149
|
+
'&:focus': {
|
|
150
|
+
border: '1px solid $red400'
|
|
151
|
+
},
|
|
152
|
+
'&:hover': {
|
|
153
|
+
border: '1px solid $red400'
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
isPicker: {
|
|
158
|
+
true: {
|
|
159
|
+
fontSize: '$placeholder',
|
|
160
|
+
letterSpacing: '$placeholder',
|
|
161
|
+
lineHeight: '$placeholder',
|
|
162
|
+
fontVariantNumeric: 'unset',
|
|
163
|
+
caretColor: 'transparent',
|
|
164
|
+
cursor: 'pointer',
|
|
165
|
+
padding: '0'
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
defaultVariants: {
|
|
170
|
+
size: 'lg'
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
const InputText = /*#__PURE__*/React__default.forwardRef(({
|
|
174
|
+
disabled,
|
|
175
|
+
readOnly,
|
|
176
|
+
...props
|
|
177
|
+
}, ref) => /*#__PURE__*/jsx(StyledInput, {
|
|
178
|
+
ref: ref,
|
|
179
|
+
disabled: disabled,
|
|
180
|
+
isDisabled: disabled,
|
|
181
|
+
readOnly: readOnly,
|
|
182
|
+
isReadOnly: readOnly,
|
|
183
|
+
...props
|
|
184
|
+
}));
|
|
185
|
+
InputText.propTypes = {
|
|
186
|
+
placeholder: PropTypes.string,
|
|
187
|
+
value: PropTypes.string,
|
|
188
|
+
onChange: PropTypes.func,
|
|
189
|
+
disabled: PropTypes.bool,
|
|
190
|
+
readOnly: PropTypes.bool,
|
|
191
|
+
isInvalid: PropTypes.bool,
|
|
192
|
+
size: PropTypes.string,
|
|
193
|
+
isPicker: PropTypes.bool
|
|
194
|
+
};
|
|
195
|
+
InputText.displayName = 'InputText';
|
|
196
|
+
|
|
197
|
+
export { InputText, StyledInput };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import 'core-js/modules/es.iterator.constructor.js';
|
|
2
|
+
import 'core-js/modules/es.iterator.for-each.js';
|
|
3
|
+
import React__default, { useRef, useEffect } from 'react';
|
|
4
|
+
import { StyledInput } from '../InputText/InputText.esm.js';
|
|
5
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
const StyledTextArea = styled(StyledInput, {
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
sm: {
|
|
13
|
+
height: '52px'
|
|
14
|
+
},
|
|
15
|
+
lg: {
|
|
16
|
+
height: '62px'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
size: 'lg'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const InputTextArea = /*#__PURE__*/React__default.forwardRef(({
|
|
25
|
+
disabled,
|
|
26
|
+
readOnly,
|
|
27
|
+
...props
|
|
28
|
+
}, ref) => {
|
|
29
|
+
const textareaRef = useRef(null);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (textareaRef.current) {
|
|
32
|
+
textareaRef.current.style.height = '50px';
|
|
33
|
+
const scrollHeight = textareaRef?.current.scrollHeight;
|
|
34
|
+
textareaRef.current.style.height = scrollHeight + 5 + 'px';
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
37
|
+
function handleKeyDown(e) {
|
|
38
|
+
e.target.style.height = '50px';
|
|
39
|
+
e.target.style.height = `${e.target.scrollHeight + 5}px`;
|
|
40
|
+
}
|
|
41
|
+
function mergeRefs(refs) {
|
|
42
|
+
return value => {
|
|
43
|
+
refs.forEach(ref => {
|
|
44
|
+
if (typeof ref === 'function') {
|
|
45
|
+
ref(value);
|
|
46
|
+
} else if (ref != null) {
|
|
47
|
+
ref.current = value;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/jsx(StyledTextArea, {
|
|
53
|
+
ref: mergeRefs([textareaRef, ref]),
|
|
54
|
+
disabled: disabled,
|
|
55
|
+
isDisabled: disabled,
|
|
56
|
+
readOnly: readOnly,
|
|
57
|
+
isReadOnly: readOnly,
|
|
58
|
+
onKeyDown: handleKeyDown,
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
InputTextArea.propTypes = {
|
|
63
|
+
placeholder: PropTypes.string,
|
|
64
|
+
value: PropTypes.string,
|
|
65
|
+
onChange: PropTypes.func,
|
|
66
|
+
disabled: PropTypes.bool,
|
|
67
|
+
readOnly: PropTypes.bool,
|
|
68
|
+
isInvalid: PropTypes.bool,
|
|
69
|
+
size: PropTypes.string,
|
|
70
|
+
isPicker: PropTypes.bool
|
|
71
|
+
};
|
|
72
|
+
InputTextArea.defaultProps = {
|
|
73
|
+
as: 'textarea',
|
|
74
|
+
size: 'lg'
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export { InputTextArea as default };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { styled } from '../../config/stitches.config.esm.js';
|
|
2
|
+
import Text from '../text/Text.esm.js';
|
|
3
|
+
|
|
4
|
+
const Heading = styled(Text, {
|
|
5
|
+
variants: {
|
|
6
|
+
heading: {
|
|
7
|
+
h1: {
|
|
8
|
+
fontSize: '$heading-1',
|
|
9
|
+
lineHeight: '$heading-1',
|
|
10
|
+
letterSpacing: '$heading-1',
|
|
11
|
+
fontWeight: 'bold'
|
|
12
|
+
},
|
|
13
|
+
h2: {
|
|
14
|
+
fontSize: '$heading-2',
|
|
15
|
+
lineHeight: '$heading-2',
|
|
16
|
+
letterSpacing: '$heading-2',
|
|
17
|
+
fontWeight: '600'
|
|
18
|
+
},
|
|
19
|
+
h3: {
|
|
20
|
+
fontSize: '$heading-3',
|
|
21
|
+
lineHeight: '$heading-3',
|
|
22
|
+
letterSpacing: '$heading-3',
|
|
23
|
+
fontWeight: '600'
|
|
24
|
+
},
|
|
25
|
+
pageTitle: {
|
|
26
|
+
fontSize: '$page-title-2',
|
|
27
|
+
lineHeight: '$page-title',
|
|
28
|
+
letterSpacing: '$page-title',
|
|
29
|
+
fontWeight: '600'
|
|
30
|
+
},
|
|
31
|
+
sectionTitle: {
|
|
32
|
+
fontSize: '$section-title',
|
|
33
|
+
lineHeight: '$section-title',
|
|
34
|
+
letterSpacing: '$section-title',
|
|
35
|
+
fontWeight: '600'
|
|
36
|
+
},
|
|
37
|
+
sectionSubTitle: {
|
|
38
|
+
fontSize: '$section-sub-title',
|
|
39
|
+
lineHeight: '$section-sub-title',
|
|
40
|
+
letterSpacing: '$section-sub-title',
|
|
41
|
+
fontWeight: '600'
|
|
42
|
+
},
|
|
43
|
+
headerTabs: {
|
|
44
|
+
fontSize: '$header-tabs',
|
|
45
|
+
lineHeight: '$header-tabs',
|
|
46
|
+
letterSpacing: '$header-tabs',
|
|
47
|
+
fontWeight: '500'
|
|
48
|
+
},
|
|
49
|
+
headerTable: {
|
|
50
|
+
fontSize: '$header-table',
|
|
51
|
+
lineHeight: '$header-table',
|
|
52
|
+
letterSpacing: '$header-table',
|
|
53
|
+
fontWeight: '600'
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
Heading.defaultProps = {
|
|
59
|
+
color: 'primary',
|
|
60
|
+
heading: 'h1'
|
|
61
|
+
};
|
|
62
|
+
Heading.displayName = 'Heading';
|
|
63
|
+
|
|
64
|
+
export { Heading as default };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { styled } from '../../config/stitches.config.esm.js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
const IconButton = styled('button', {
|
|
6
|
+
cursor: 'pointer',
|
|
7
|
+
borderRadius: '$round',
|
|
8
|
+
size: '24px',
|
|
9
|
+
padding: '$spacing-01',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
border: 'none',
|
|
14
|
+
appearance: 'none',
|
|
15
|
+
// '&:focus': {
|
|
16
|
+
// outline: '2px solid #82C4E0',
|
|
17
|
+
// },
|
|
18
|
+
'&:disabled': {
|
|
19
|
+
cursor: 'default',
|
|
20
|
+
'&:hover': {
|
|
21
|
+
backgroundColor: 'transparent'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
variants: {
|
|
25
|
+
buttonType: {
|
|
26
|
+
primary: {
|
|
27
|
+
backgroundColor: '$btnPrimary',
|
|
28
|
+
'&:hover': {
|
|
29
|
+
backgroundColor: '$btnHoverPrimary',
|
|
30
|
+
color: '$textBrand'
|
|
31
|
+
},
|
|
32
|
+
'&:active': {
|
|
33
|
+
backgroundColor: '$btnActivePrimary'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
secondary: {
|
|
37
|
+
backgroundColor: 'transparent',
|
|
38
|
+
'&:hover': {
|
|
39
|
+
backgroundColor: '$btnHoverSecondary',
|
|
40
|
+
color: '$textBrand'
|
|
41
|
+
},
|
|
42
|
+
'&:active': {
|
|
43
|
+
backgroundColor: '$btnActiveSecondary'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
mobileOnly: {
|
|
48
|
+
true: {
|
|
49
|
+
'@lg': {
|
|
50
|
+
display: 'none !important'
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
desktopOnly: {
|
|
55
|
+
true: {
|
|
56
|
+
display: 'none !important',
|
|
57
|
+
'@lg': {
|
|
58
|
+
display: 'flex !important'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
defaultVariants: {
|
|
64
|
+
buttonType: 'secondary'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
IconButton.propTypes = {
|
|
68
|
+
buttonType: PropTypes.oneOf(['primary', 'secondary'])
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { IconButton as default };
|