@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.
Files changed (203) hide show
  1. package/charts.esm.js +3 -1453
  2. package/colors/Colors.esm.js +93 -0
  3. package/components/accordion/Accordion.esm.js +109 -0
  4. package/components/alertDialog/AlertDialog.esm.js +440 -0
  5. package/components/avatar/Avatar.esm.js +83 -0
  6. package/components/badge/Badge.esm.js +255 -0
  7. package/components/banner/Banner.esm.js +341 -0
  8. package/components/barChart/BarChart.esm.js +212 -0
  9. package/components/breadcrumb/Breadcrumb.esm.js +65 -0
  10. package/components/breadcrumb/index.esm.js +19 -0
  11. package/components/button/Button.esm.js +331 -0
  12. package/components/buttonGroup/ButtonGroup.esm.js +350 -0
  13. package/components/card/Card.esm.js +236 -0
  14. package/components/chart/assets/data_kosong.png.esm.js +3 -0
  15. package/components/chart/lineChart/LineChart.esm.js +358 -0
  16. package/components/chart/lineChart/components/Comparator.esm.js +82 -0
  17. package/components/chart/lineChart/components/ComparatorController.esm.js +112 -0
  18. package/components/chart/lineChart/components/ComparatorItem.esm.js +104 -0
  19. package/components/chart/lineChart/components/ProductList.esm.js +78 -0
  20. package/components/chart/lineChart/components/TitleLegend.esm.js +107 -0
  21. package/components/chart/lineChart/components/Tooltip.esm.js +90 -0
  22. package/components/chart/utils/index.esm.js +109 -0
  23. package/components/checkboxTable/CheckboxTable.esm.js +287 -0
  24. package/components/colorPicker/ColorPicker.esm.js +342 -0
  25. package/components/colorPicker/InputColorPicker.esm.js +120 -0
  26. package/components/colorPicker/assets/img_colormap.gif.esm.js +3 -0
  27. package/components/colorPicker/components/ColorFields.esm.js +144 -0
  28. package/components/colorPicker/components/ColorMap.esm.js +1188 -0
  29. package/components/contentEditor/ContentEditor.esm.js +251 -0
  30. package/components/contentEditor/assets/Inline-code-outline.svg.esm.js +3 -0
  31. package/components/contentEditor/assets/Link-outline.svg.esm.js +3 -0
  32. package/components/contentEditor/assets/List-bulleted-outline.svg.esm.js +3 -0
  33. package/components/contentEditor/assets/List-numbered-outline.svg.esm.js +3 -0
  34. package/components/contentEditor/assets/Redo-outline.svg.esm.js +3 -0
  35. package/components/contentEditor/assets/Text-bold-filled.svg.esm.js +3 -0
  36. package/components/contentEditor/assets/Text-clear-format-outline.svg.esm.js +3 -0
  37. package/components/contentEditor/assets/Text-italic-outline.svg.esm.js +3 -0
  38. package/components/contentEditor/assets/Text-strikethrough-outline.svg.esm.js +3 -0
  39. package/components/contentEditor/assets/Text-underline-outline.svg.esm.js +3 -0
  40. package/components/contentEditor/assets/Undo-outline.svg.esm.js +3 -0
  41. package/components/contextMenu/ContextMenu.esm.js +298 -0
  42. package/components/datePicker/AdvancedOption.esm.js +37 -0
  43. package/components/datePicker/CustomDatePicker.esm.js +121 -0
  44. package/components/datePicker/DatePicker.esm.js +244 -0
  45. package/components/datePicker/DatePickerMulti.esm.js +70 -0
  46. package/components/datePicker/InputDatePicker.esm.js +290 -0
  47. package/components/datePicker/InputDateRangePicker.esm.js +174 -0
  48. package/components/datePicker/components/Calendar.esm.js +654 -0
  49. package/components/datePicker/components/CalendarMulti.esm.js +407 -0
  50. package/components/datePicker/components/CalendarTimePicker.esm.js +104 -0
  51. package/components/datePicker/components/DateNumber.esm.js +89 -0
  52. package/components/datePicker/components/MobileCalendar.esm.js +522 -0
  53. package/components/datePicker/state/reducer.esm.js +286 -0
  54. package/components/datePicker/timePicker/InputTimePicker.esm.js +205 -0
  55. package/components/datePicker/timePicker/TimePicker.esm.js +481 -0
  56. package/components/devicePreview/DevicePreview.esm.js +631 -0
  57. package/components/devicePreview/deviceFrame/android-transparant.png.esm.js +3 -0
  58. package/components/devicePreview/deviceFrame/android-wide-transparant.png.esm.js +3 -0
  59. package/components/devicePreview/deviceFrame/bg-email.png.esm.js +3 -0
  60. package/components/devicePreview/deviceFrame/bg-notification.png.esm.js +3 -0
  61. package/components/devicePreview/deviceFrame/bg-sms.png.esm.js +3 -0
  62. package/components/devicePreview/deviceFrame/bg-whatsapp.png.esm.js +3 -0
  63. package/components/devicePreview/deviceFrame/desktop-transparant.png.esm.js +3 -0
  64. package/components/devicePreview/deviceFrame/ic-majoo-profpic.png.esm.js +3 -0
  65. package/components/devicePreview/deviceFrame/iphone-transparant.png.esm.js +3 -0
  66. package/components/dialog/Dialog.esm.js +106 -0
  67. package/components/drawer/Drawer.esm.js +294 -0
  68. package/components/dropdownMenu/DropdownMenu.esm.js +281 -0
  69. package/components/editableTable/EditableMobile.esm.js +361 -0
  70. package/components/editableTable/EditableTable.esm.js +618 -0
  71. package/components/editableTable/transition.esm.js +37 -0
  72. package/components/form/components/FormGroup/FormGroup.esm.js +142 -0
  73. package/components/form/components/FormHelper/Helper.esm.js +50 -0
  74. package/components/form/components/FormLabel/Label.esm.js +90 -0
  75. package/components/form/components/InputAddon/InputAddon.esm.js +105 -0
  76. package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +60 -0
  77. package/components/form/components/InputCheckbox/InputCheckbox.esm.js +129 -0
  78. package/components/form/components/InputCheckbox/icon/CheckOutline.esm.js +33 -0
  79. package/components/form/components/InputCheckbox/icon/MinusOutline.esm.js +33 -0
  80. package/components/form/components/InputCombobox/InputCombobox.esm.js +169 -0
  81. package/components/form/components/InputCounter/InputCounter.esm.js +226 -0
  82. package/components/form/components/InputCreatable/InputCreatable.esm.js +229 -0
  83. package/components/form/components/InputDateRange/InputDateRange.esm.js +46 -0
  84. package/components/form/components/InputElement/InputElement.esm.js +35 -0
  85. package/components/form/components/InputGroup/InputGroup.esm.js +188 -0
  86. package/components/form/components/InputLetter/InputLetter.esm.js +68 -0
  87. package/components/form/components/InputNumber/InputNumber.esm.js +248 -0
  88. package/components/form/components/InputNumber/NumberFormat.esm.js +1263 -0
  89. package/components/form/components/InputOTP/InputOTP.esm.js +70 -0
  90. package/components/form/components/InputRadio/InputRadio.esm.js +273 -0
  91. package/components/form/components/InputRadio/InputRadioGroup.esm.js +35 -0
  92. package/components/form/components/InputRadio/context.esm.js +5 -0
  93. package/components/form/components/InputResourceList/InputResourceList.esm.js +429 -0
  94. package/components/form/components/InputSearchbox/CloseFilled.esm.js +34 -0
  95. package/components/form/components/InputSearchbox/InputSearchbox.esm.js +90 -0
  96. package/components/form/components/InputSearchbox/SearchOutline.esm.js +26 -0
  97. package/components/form/components/InputSelect/InputSelect.esm.js +964 -0
  98. package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +1388 -0
  99. package/components/form/components/InputSelectCheck/OptionGroupItem.esm.js +39 -0
  100. package/components/form/components/InputSelectCheck/icon/CheckOutline.esm.js +33 -0
  101. package/components/form/components/InputSelectTag/InputSelectTag.esm.js +62 -0
  102. package/components/form/components/InputSignature/InputSignature.esm.js +122 -0
  103. package/components/form/components/InputSignature/SignatureModal.esm.js +67 -0
  104. package/components/form/components/InputSwitch/InputSwitch.esm.js +96 -0
  105. package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +136 -0
  106. package/components/form/components/InputTags/InputTags.esm.js +268 -0
  107. package/components/form/components/InputText/InputText.esm.js +197 -0
  108. package/components/form/components/InputTextArea/InputTextArea.esm.js +77 -0
  109. package/components/heading/Heading.esm.js +64 -0
  110. package/components/iconButton/IconButton.esm.js +71 -0
  111. package/components/image/Image.esm.js +141 -0
  112. package/components/link/Link.esm.js +59 -0
  113. package/components/loadingBar/LoadingBar.esm.js +113 -0
  114. package/components/mapPicker/InputMapPicker.esm.js +160 -0
  115. package/components/mapPicker/MapPicker.esm.js +122 -0
  116. package/components/mapPicker/MapPicker.styles.esm.js +70 -0
  117. package/components/mapPicker/assets/images/Mapsicle.png.esm.js +3 -0
  118. package/components/mapPicker/components/AddressCard.esm.js +25 -0
  119. package/components/mapPicker/components/ButtonSelect.esm.js +46 -0
  120. package/components/mapPicker/components/ChangeView.esm.js +20 -0
  121. package/components/mapPicker/components/InputSearch.esm.js +74 -0
  122. package/components/mapPicker/components/MarkerIcon.esm.js +22 -0
  123. package/components/mapPicker/components/MarkerSvg.esm.js +62 -0
  124. package/components/mapPicker/components/ZoomControls.esm.js +36 -0
  125. package/components/mapPicker/hooks/useMapSearch.esm.js +161 -0
  126. package/components/modalDialog/ModalDialog.esm.js +247 -0
  127. package/components/notificationBadge/NotificationBadge.esm.js +149 -0
  128. package/components/pageDialog/PageDialog.esm.js +291 -0
  129. package/components/pageDialog/logo.svg.esm.js +3 -0
  130. package/components/pagination/Pagination.esm.js +94 -0
  131. package/components/pagination/PaginationButton.esm.js +346 -0
  132. package/components/pagination/PaginationInfo.esm.js +146 -0
  133. package/components/paper/Paper.esm.js +76 -0
  134. package/components/paragraph/Paragraph.esm.js +52 -0
  135. package/components/pieChart/PieChart.esm.js +287 -0
  136. package/components/popover/Popover.esm.js +142 -0
  137. package/components/progress/Progress.esm.js +170 -0
  138. package/components/progressIndicator/ProgressIndicator.esm.js +287 -0
  139. package/components/scrollSync/ScrollSync.esm.js +172 -0
  140. package/components/scrollSync/ScrollSyncNode.esm.js +87 -0
  141. package/components/scrollSync/utils.esm.js +9 -0
  142. package/components/separator/Separator.esm.js +43 -0
  143. package/components/skeleton/Skeleton.esm.js +131 -0
  144. package/components/slider/Slider.esm.js +345 -0
  145. package/components/stepWizard/StepWizard.esm.js +451 -0
  146. package/components/stepWizard/index.esm.js +14 -0
  147. package/components/table/MobileTable.esm.js +415 -0
  148. package/components/table/Table.esm.js +1472 -0
  149. package/components/table/components/columns/DateColumn.esm.js +26 -0
  150. package/components/table/components/columns/DecimalColumn.esm.js +36 -0
  151. package/components/table/components/columns/PriceColumn.esm.js +57 -0
  152. package/components/table/components/columns/RowDraggableColumn.esm.js +24 -0
  153. package/components/table/components/columns/RowExpanderColumn.esm.js +32 -0
  154. package/components/table/components/columns/RowExpanderMultipleColumn.esm.js +24 -0
  155. package/components/table/components/columns/RowMenuColumn.esm.js +101 -0
  156. package/components/table/components/columns/RowSelectionCallbackColumn.esm.js +38 -0
  157. package/components/table/components/columns/RowSelectionColumn.esm.js +34 -0
  158. package/components/table/images/img-emptydata.webp.esm.js +3 -0
  159. package/components/table/images/img-emptysearchdata.webp.esm.js +3 -0
  160. package/components/tableOfContent/TableOfContent.esm.js +267 -0
  161. package/components/tableOfContent/index.esm.js +18 -0
  162. package/components/tableOfContent/transition.esm.js +38 -0
  163. package/components/tabs/Tabs.esm.js +282 -0
  164. package/components/tag/Tag.esm.js +161 -0
  165. package/components/tagList/TagList.esm.js +90 -0
  166. package/components/tagStatus/TagStatus.esm.js +134 -0
  167. package/components/text/Text.esm.js +140 -0
  168. package/components/toast/Toast.esm.js +297 -0
  169. package/components/toast/ToastContainer.esm.js +73 -0
  170. package/components/toast/context/ToastContext.esm.js +5 -0
  171. package/components/toast/context/ToastProvider.esm.js +96 -0
  172. package/components/tooltip/Tooltip.esm.js +175 -0
  173. package/components/upload/Upload.esm.js +1103 -0
  174. package/components/upload/utils/canvasPreview.esm.js +39 -0
  175. package/components/upload/utils/imgPreview.esm.js +21 -0
  176. package/config/stitches.config.esm.js +216 -0
  177. package/editor.esm.js +1 -264
  178. package/hooks/useListOption/useListOption.esm.js +56 -0
  179. package/hooks/useToggle/useToggle.esm.js +8 -0
  180. package/index.esm.js +106 -42293
  181. package/layout/box/Box.esm.js +24 -0
  182. package/layout/flex/Flex.esm.js +135 -0
  183. package/layout/grid/Grid.esm.js +270 -0
  184. package/layout/pageContainer/PageContainer.esm.js +60 -0
  185. package/majoo-provider/MajooProvider.esm.js +42 -0
  186. package/majoo-provider/ThemeProvider.esm.js +41 -0
  187. package/majoo-provider/globalStyles.esm.js +242 -0
  188. package/majoo-provider/styles/modern-normalize.esm.js +95 -0
  189. package/map.esm.js +2 -734
  190. package/package.json +16 -5
  191. package/utils/calendar.esm.js +26 -0
  192. package/utils/element.esm.js +21 -0
  193. package/utils/object.esm.js +12 -0
  194. package/utils/request.esm.js +74 -0
  195. package/utils/strings.esm.js +6 -0
  196. package/{useMediaQuery.esm.js → utils/useMediaQuery.esm.js} +1 -1
  197. package/utils/useNavigatorOnline.esm.js +19 -0
  198. package/utils/variant.esm.js +12 -0
  199. package/wrapper/ConditionalWrapper.esm.js +9 -0
  200. package/ModalDialog.esm.js +0 -2669
  201. package/Separator.esm.js +0 -3002
  202. package/stitches.config.esm.js +0 -2284
  203. package/{index.esm.css → charts.esm.css} +4 -4
@@ -0,0 +1,93 @@
1
+ import 'core-js/modules/es.iterator.constructor.js';
2
+ import 'core-js/modules/es.iterator.map.js';
3
+ import React__default from 'react';
4
+ import { styled } from '../config/stitches.config.esm.js';
5
+ import Box from '../layout/box/Box.esm.js';
6
+ import Flex from '../layout/flex/Flex.esm.js';
7
+ import { Paper } from '../components/paper/Paper.esm.js';
8
+ import ToastContext from '../components/toast/context/ToastContext.esm.js';
9
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
+
11
+ const StyledPaper = styled(Paper, {
12
+ borderRadius: '10px 10px 0 0',
13
+ padding: 15,
14
+ width: '100% !important',
15
+ height: '$spacing-09 !important'
16
+ });
17
+ const StyledParagraph = styled('span', {
18
+ margin: '7px 0',
19
+ marginTop: 2,
20
+ fontSize: '9pt'
21
+ });
22
+ const StyledBox = styled(Box, {
23
+ display: 'grid',
24
+ gridTemplateColumns: 'repeat(auto-fill, minmax(calc(768px / 4 - 20px), 1fr))',
25
+ gridGap: '10px'
26
+ });
27
+ const StyledSpan = styled('span', {
28
+ fontFamily: 'monospace',
29
+ variants: {
30
+ color: {
31
+ red: {
32
+ color: '$red400'
33
+ },
34
+ primary: {
35
+ color: '$primary800'
36
+ }
37
+ }
38
+ },
39
+ defaultVariants: {
40
+ color: 'red'
41
+ }
42
+ });
43
+ const StyledFlex = styled(Flex, {
44
+ width: '100%',
45
+ padding: 5,
46
+ userSelect: 'none',
47
+ cursor: 'pointer',
48
+ alignItems: 'center',
49
+ justifyContent: 'center'
50
+ });
51
+ StyledFlex.displayName = 'Flex';
52
+ const Colors = props => {
53
+ const {
54
+ addToast
55
+ } = React__default.useContext(ToastContext);
56
+ function onClick(i) {
57
+ return () => {
58
+ navigator.clipboard.writeText(i);
59
+ addToast({
60
+ title: 'Success',
61
+ description: `color '${i}' succesfully copied`,
62
+ position: 'bottom-right',
63
+ variant: 'success',
64
+ captionOfAction: ''
65
+ });
66
+ };
67
+ }
68
+ if (props.items) return props.items.map((i, index) => /*#__PURE__*/jsxs(StyledFlex, {
69
+ gap: 2,
70
+ direction: "column",
71
+ children: [/*#__PURE__*/jsx(StyledPaper, {
72
+ onClick: onClick(i.hex),
73
+ css: {
74
+ backgroundColor: `${i.hex}`
75
+ }
76
+ }), /*#__PURE__*/jsxs(StyledFlex, {
77
+ justify: "between",
78
+ wrap: "wrap",
79
+ children: [/*#__PURE__*/jsx(StyledParagraph, {
80
+ onClick: onClick(i.name),
81
+ children: i.name
82
+ }), /*#__PURE__*/jsx(StyledParagraph, {
83
+ onClick: onClick(i.hex),
84
+ css: {
85
+ fontWeight: 'bold'
86
+ },
87
+ children: i.hex
88
+ })]
89
+ })]
90
+ }, index));
91
+ };
92
+
93
+ export { Colors, StyledBox, StyledSpan };
@@ -0,0 +1,109 @@
1
+ import { __rest } from 'tslib';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import React__default from 'react';
4
+ import { ChevronDownOutline } from '@majoo-ui/icons';
5
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
6
+ import { styled } from '../../config/stitches.config.esm.js';
7
+
8
+ const StyledAccordion = styled(AccordionPrimitive.Root, {});
9
+ const Accordion = /*#__PURE__*/React__default.forwardRef((_a, forwardedRef) => {
10
+ var {
11
+ children
12
+ } = _a,
13
+ props = __rest(_a, ["children"]);
14
+ return jsx(StyledAccordion, Object.assign({
15
+ ref: forwardedRef
16
+ }, props, props.type === 'single' ? {
17
+ collapsible: true
18
+ } : {}, {
19
+ children: children
20
+ }));
21
+ });
22
+ const StyledItem = styled(AccordionPrimitive.Item, {
23
+ borderTop: '1px solid $colors$slate6',
24
+ '&:last-of-type': {
25
+ borderBottom: '1px solid $colors$slate6'
26
+ }
27
+ });
28
+ const StyledHeader = styled(AccordionPrimitive.Header, {
29
+ all: 'unset'
30
+ });
31
+ const StyledTrigger = styled(AccordionPrimitive.Trigger, {
32
+ all: 'unset',
33
+ boxSizing: 'border-box',
34
+ userSelect: 'none',
35
+ '&::before': {
36
+ boxSizing: 'border-box'
37
+ },
38
+ '&::after': {
39
+ boxSizing: 'border-box'
40
+ },
41
+ cursor: 'pointer',
42
+ display: 'flex',
43
+ alignItems: 'center',
44
+ color: '$hiContrast',
45
+ width: '100%',
46
+ '@hover': {
47
+ '&:hover': {
48
+ backgroundColor: '$slate2'
49
+ }
50
+ },
51
+ '&:focus': {
52
+ outline: 'none',
53
+ boxShadow: 'inset 0 0 0 1px $colors$slate8, 0 0 0 1px $colors$slate8'
54
+ },
55
+ '& svg.icon-cdf': {
56
+ color: '$white',
57
+ size: '24px',
58
+ transition: 'transform 175ms cubic-bezier(0.65, 0, 0.35, 1)'
59
+ },
60
+ '& svg.right': {
61
+ marginRight: '$spacing-05'
62
+ },
63
+ '&[data-state="open"]': {
64
+ '& svg.icon-cdf': {
65
+ transform: 'rotate(180deg)'
66
+ }
67
+ },
68
+ variants: {
69
+ arrowPosition: {
70
+ right: {
71
+ justifyContent: 'space-between'
72
+ },
73
+ left: {
74
+ justifyContent: 'start'
75
+ }
76
+ }
77
+ }
78
+ });
79
+ const AccordionTrigger = /*#__PURE__*/React__default.forwardRef((_a, forwardedRef) => {
80
+ var {
81
+ children,
82
+ arrowPosition = 'right',
83
+ hasContent = true,
84
+ arrowColor = 'white',
85
+ customArrow
86
+ } = _a,
87
+ props = __rest(_a, ["children", "arrowPosition", "hasContent", "arrowColor", "customArrow"]);
88
+ return jsx(StyledHeader, {
89
+ children: jsx(StyledTrigger, Object.assign({}, props, {
90
+ arrowPosition: arrowPosition,
91
+ ref: forwardedRef,
92
+ children: arrowPosition === 'right' ? jsxs(Fragment, {
93
+ children: [children, hasContent && (customArrow || jsx(ChevronDownOutline, {
94
+ className: "icon-cdf right",
95
+ color: arrowColor
96
+ }))]
97
+ }) : jsxs(Fragment, {
98
+ children: [hasContent && (customArrow || jsx(ChevronDownOutline, {
99
+ className: "icon-cdf right",
100
+ color: arrowColor
101
+ })), children]
102
+ })
103
+ }))
104
+ });
105
+ });
106
+ const AccordionItem = StyledItem;
107
+ const AccordionContent = AccordionPrimitive.Content;
108
+
109
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
@@ -0,0 +1,440 @@
1
+ import React__default, { useCallback, forwardRef } from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import * as ADialog from '@radix-ui/react-alert-dialog';
4
+ import { CloseOutline } from '@majoo-ui/icons';
5
+ import Box from '../../layout/box/Box.esm.js';
6
+ import { Button } from '../button/Button.esm.js';
7
+ import Heading from '../heading/Heading.esm.js';
8
+ import Paragraph from '../paragraph/Paragraph.esm.js';
9
+ import { Separator } from '../separator/Separator.esm.js';
10
+ import { styled, keyframes } from '../../config/stitches.config.esm.js';
11
+ import PropTypes from 'prop-types';
12
+ import { useTranslation } from 'react-i18next';
13
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
+
15
+ /* eslint-disable @typescript-eslint/no-empty-function */
16
+ const overlayShow = keyframes({
17
+ '0%': {
18
+ opacity: 0
19
+ },
20
+ '100%': {
21
+ opacity: 1
22
+ }
23
+ });
24
+ const contentShow = keyframes({
25
+ '0%': {
26
+ opacity: 0,
27
+ transform: 'translate(-50%, -48%) scale(.96)'
28
+ },
29
+ '100%': {
30
+ opacity: 1,
31
+ transform: 'translate(-50%, -50%) scale(1)'
32
+ }
33
+ });
34
+ const StyledOverlay = styled(ADialog.Overlay, {
35
+ zIndex: 1,
36
+ backgroundColor: '$bgDimmer',
37
+ position: 'fixed',
38
+ inset: 0,
39
+ '@media (prefers-reduced-motion: no-preference)': {
40
+ animation: `${overlayShow} 150ms cubic-bezier(0.16, 1, 0.3, 1) forwards`
41
+ }
42
+ });
43
+ const StyledContent = styled(ADialog.Content, {
44
+ backgroundColor: 'white',
45
+ borderRadius: 8,
46
+ boxShadow: 'hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px',
47
+ position: 'fixed',
48
+ top: '50%',
49
+ left: '50%',
50
+ transform: 'translate(-50%, -50%)',
51
+ width: '90vw',
52
+ maxWidth: '422px',
53
+ maxHeight: '100vh',
54
+ '@media (prefers-reduced-motion: no-preference)': {
55
+ animation: `${contentShow} 150ms cubic-bezier(0.16, 1, 0.3, 1) forwards`
56
+ },
57
+ '&:focus': {
58
+ outline: 'none'
59
+ }
60
+ });
61
+ const StyledTitle = styled(ADialog.Title, {
62
+ '@sm': {
63
+ margin: '24px 16px'
64
+ },
65
+ margin: '16px 24px 10px 24px',
66
+ display: 'flex',
67
+ flexDirection: 'row',
68
+ justifyContent: 'space-between',
69
+ color: '$gray900',
70
+ fontSize: 17,
71
+ fontWeight: 500
72
+ });
73
+ const StyledDescription = styled('div', {
74
+ mx: 24,
75
+ my: 20,
76
+ color: '$gray900',
77
+ fontSize: 15,
78
+ lineHeight: 1.5
79
+ });
80
+ const Flex = styled('div', {
81
+ display: 'flex'
82
+ });
83
+ const Content = /*#__PURE__*/forwardRef(({
84
+ children,
85
+ ...props
86
+ }, ref) => /*#__PURE__*/jsxs(ADialog.Portal, {
87
+ children: [/*#__PURE__*/jsx(StyledOverlay, {
88
+ css: {
89
+ zIndex: '$toast'
90
+ }
91
+ }), /*#__PURE__*/jsx(StyledContent, {
92
+ ref: ref,
93
+ ...props,
94
+ children: children
95
+ })]
96
+ }));
97
+ function AlertDialogFunction(properties) {
98
+ let props = properties;
99
+ this.show = function () {
100
+ ReactDOM.render(/*#__PURE__*/jsx(React__default.StrictMode, {
101
+ children: /*#__PURE__*/jsx(TemplateAlertFunction, {
102
+ ...props
103
+ })
104
+ }), document.getElementById('a-dialog'));
105
+ };
106
+ }
107
+ const TemplateAlertFunction = props => {
108
+ const {
109
+ t
110
+ } = useTranslation('translation');
111
+ const [open, setOpen] = React__default.useState(true);
112
+ const ref = useCallback(node => {
113
+ const appElement = document.getElementById('app');
114
+ if (appElement) {
115
+ if (node !== null) {
116
+ appElement.classList.add('noscroll');
117
+ } else {
118
+ appElement.classList.remove('noscroll');
119
+ }
120
+ }
121
+ }, []);
122
+ const isMobileCss = props.isMobile && {
123
+ minWidth: '100%',
124
+ borderBottomLeftRadius: 0,
125
+ borderBottomRightRadius: 0,
126
+ animation: 'unset',
127
+ bottom: 0,
128
+ top: 'auto',
129
+ left: 0,
130
+ transform: 'translate(0,0)'
131
+ };
132
+ const onCancelFunc = props.onCancel ? props.onCancel : () => {};
133
+ const onConfirmFunc = props.onConfirm ? props.onConfirm : () => {};
134
+ const buttonCancel = () => {
135
+ onCancelFunc();
136
+ buttonClose();
137
+ };
138
+ const buttonClose = () => {
139
+ setOpen(false);
140
+ ReactDOM.unmountComponentAtNode(document.getElementById('a-dialog'));
141
+ };
142
+ const buttonConfirm = () => {
143
+ onConfirmFunc();
144
+ setOpen(false);
145
+ ReactDOM.unmountComponentAtNode(document.getElementById('a-dialog'));
146
+ };
147
+ return /*#__PURE__*/jsx(ADialog.Root, {
148
+ open: open,
149
+ ...props,
150
+ children: /*#__PURE__*/jsxs(Content, {
151
+ ref: ref,
152
+ css: {
153
+ zIndex: '$tooltip',
154
+ ...isMobileCss,
155
+ ...props.css
156
+ },
157
+ onOpenAutoFocus: e => {
158
+ if (!props.onOpenAutoFocus) {
159
+ e.preventDefault();
160
+ } else {
161
+ props?.onOpenAutoFocus();
162
+ }
163
+ },
164
+ children: [/*#__PURE__*/jsx(ADialog.Title, {
165
+ asChild: true,
166
+ children: /*#__PURE__*/jsxs(StyledTitle, {
167
+ children: [/*#__PURE__*/jsx(Heading, {
168
+ heading: "pageTitle",
169
+ children: props.title
170
+ }), !props.hideCloseButton && /*#__PURE__*/jsx(ADialog.Cancel, {
171
+ asChild: true,
172
+ children: /*#__PURE__*/jsx(Box, {
173
+ onClick: buttonClose,
174
+ css: {
175
+ cursor: 'pointer'
176
+ },
177
+ children: /*#__PURE__*/jsx(CloseOutline, {
178
+ size: 22
179
+ })
180
+ })
181
+ })]
182
+ })
183
+ }), /*#__PURE__*/jsx(Separator, {
184
+ orientation: "horizontal"
185
+ }), /*#__PURE__*/jsx(ADialog.Description, {
186
+ asChild: true,
187
+ children: /*#__PURE__*/jsx(StyledDescription, {
188
+ children: /*#__PURE__*/jsx(Paragraph, {
189
+ paragraph: "longContentRegular",
190
+ css: {
191
+ textAlign: 'justify'
192
+ },
193
+ children: props.description
194
+ })
195
+ })
196
+ }), /*#__PURE__*/jsxs(Box, {
197
+ css: {
198
+ width: '100%',
199
+ display: props?.singleButton && props?.hideActionButton ? 'none' : 'inherit'
200
+ },
201
+ children: [/*#__PURE__*/jsx(Separator, {
202
+ orientation: "horizontal"
203
+ }), /*#__PURE__*/jsx(Flex, {
204
+ css: {
205
+ gap: 10,
206
+ justifyContent: 'flex-end',
207
+ mt: 20,
208
+ mb: 18,
209
+ mx: 24
210
+ },
211
+ children: props.singleButton ? /*#__PURE__*/jsx(ADialog.Action, {
212
+ asChild: true,
213
+ children: /*#__PURE__*/jsx(Button, {
214
+ size: props.btnSize,
215
+ onClick: buttonConfirm,
216
+ buttonType: props.dialogType,
217
+ disabled: props?.disabledButton,
218
+ ...props?.actionButtonProps,
219
+ children: props.labelConfirm ? props.labelConfirm : t('label.continue', 'Ya, Lanjutkan')
220
+ })
221
+ }) : /*#__PURE__*/jsxs(Fragment, {
222
+ children: [/*#__PURE__*/jsx(ADialog.Cancel, {
223
+ asChild: true,
224
+ children: /*#__PURE__*/jsx(Button, {
225
+ size: props.btnSize,
226
+ onClick: buttonCancel,
227
+ css: {
228
+ color: props.dialogType === 'negative' && !props?.disabledButton && '$textSecondary !important',
229
+ flex: props.isMobile && 1
230
+ },
231
+ buttonType: props.dialogType === 'negative' && !props?.disabledButton ? 'ghost-secondary' : 'ghost',
232
+ disabled: props?.disabledButton,
233
+ ...props?.cancelButtonProps,
234
+ children: props.labelCancel ? props.labelCancel : t('label.cancel', 'Batal')
235
+ })
236
+ }), !props?.hideActionButton && /*#__PURE__*/jsx(ADialog.Action, {
237
+ asChild: true,
238
+ children: /*#__PURE__*/jsx(Button, {
239
+ size: props.btnSize,
240
+ onClick: buttonConfirm,
241
+ buttonType: props.dialogType,
242
+ css: {
243
+ flex: props.isMobile && 1
244
+ },
245
+ disabled: props?.disabledButton,
246
+ ...props?.actionButtonProps,
247
+ children: props.labelConfirm ? props.labelConfirm : t('label.continue', 'Ya, Lanjutkan')
248
+ })
249
+ })]
250
+ })
251
+ })]
252
+ })]
253
+ })
254
+ });
255
+ };
256
+ function AlertDialog(props) {
257
+ const {
258
+ t
259
+ } = useTranslation('translation');
260
+ const ref = useCallback(node => {
261
+ const appElement = document.getElementById('app');
262
+ if (appElement) {
263
+ if (node !== null) {
264
+ appElement.classList.add('noscroll');
265
+ } else {
266
+ appElement.classList.remove('noscroll');
267
+ }
268
+ }
269
+ }, []);
270
+ const isMobileCss = props.isMobile && {
271
+ minWidth: '100%',
272
+ borderBottomLeftRadius: 0,
273
+ borderBottomRightRadius: 0,
274
+ animation: 'unset',
275
+ bottom: 0,
276
+ top: 'auto',
277
+ left: 0,
278
+ transform: 'translate(0,0)'
279
+ };
280
+ return /*#__PURE__*/jsx(ADialog.Root, {
281
+ open: props.open,
282
+ onOpenChange: props.onOpenChange,
283
+ defaultOpen: props.defaultOpen,
284
+ id: props.id,
285
+ children: /*#__PURE__*/jsxs(Content, {
286
+ ref: ref,
287
+ css: {
288
+ zIndex: '$tooltip',
289
+ ...isMobileCss,
290
+ ...props.css
291
+ },
292
+ onOpenAutoFocus: e => {
293
+ if (!props.onOpenAutoFocus) e.preventDefault();else props.onOpenAutoFocus(e);
294
+ },
295
+ children: [/*#__PURE__*/jsx(ADialog.Title, {
296
+ asChild: true,
297
+ children: /*#__PURE__*/jsxs(StyledTitle, {
298
+ children: [/*#__PURE__*/jsx(Heading, {
299
+ heading: "pageTitle",
300
+ children: props.title
301
+ }), !props.hideCloseButton && /*#__PURE__*/jsx(AlertDialogCancel, {
302
+ asChild: true,
303
+ children: /*#__PURE__*/jsx(Box, {
304
+ onClick: props.onClose || props.onCancel,
305
+ css: {
306
+ cursor: 'pointer'
307
+ },
308
+ children: /*#__PURE__*/jsx(CloseOutline, {
309
+ size: 22
310
+ })
311
+ })
312
+ })]
313
+ })
314
+ }), /*#__PURE__*/jsx(Separator, {
315
+ orientation: "horizontal"
316
+ }), /*#__PURE__*/jsx(ADialog.Description, {
317
+ asChild: true,
318
+ children: /*#__PURE__*/jsx(StyledDescription, {
319
+ children: /*#__PURE__*/jsx(Paragraph, {
320
+ paragraph: "longContentRegular",
321
+ css: {
322
+ textAlign: 'justify',
323
+ wordBreak: 'break-word'
324
+ },
325
+ children: props.description
326
+ })
327
+ })
328
+ }), /*#__PURE__*/jsxs(Box, {
329
+ css: {
330
+ width: '100%',
331
+ display: props?.singleButton && props?.hideActionButton ? 'none' : 'inherit'
332
+ },
333
+ children: [/*#__PURE__*/jsx(Separator, {
334
+ orientation: "horizontal"
335
+ }), /*#__PURE__*/jsx(Flex, {
336
+ css: {
337
+ gap: 10,
338
+ justifyContent: 'flex-end',
339
+ mt: 20,
340
+ mb: 18,
341
+ mx: 24
342
+ },
343
+ children: props.singleButton ? /*#__PURE__*/jsx(ADialog.Action, {
344
+ asChild: true,
345
+ children: /*#__PURE__*/jsx(Button, {
346
+ size: props.btnSize,
347
+ onClick: props.onConfirm,
348
+ buttonType: props.dialogType,
349
+ css: {
350
+ flex: props.isMobile && 1
351
+ },
352
+ disabled: props?.disabledButton,
353
+ ...props?.actionButtonProps,
354
+ children: props.labelConfirm ? props.labelConfirm : t('label.continue', 'Ya, Lanjutkan')
355
+ })
356
+ }) : /*#__PURE__*/jsxs(Fragment, {
357
+ children: [/*#__PURE__*/jsx(ADialog.Cancel, {
358
+ asChild: true,
359
+ children: /*#__PURE__*/jsx(Button, {
360
+ size: props.btnSize,
361
+ onClick: props.onCancel,
362
+ css: {
363
+ color: props.dialogType === 'negative' && !props?.disabledButton && '$textSecondary !important',
364
+ flex: props.isMobile && 1
365
+ },
366
+ buttonType: props.dialogType === 'negative' && !props?.disabledButton ? 'ghost-secondary' : 'ghost',
367
+ disabled: props?.disabledButton,
368
+ ...props?.cancelButtonProps,
369
+ children: props.labelCancel ? props.labelCancel : t('label.cancel', 'Batal')
370
+ })
371
+ }), !props?.hideActionButton && /*#__PURE__*/jsx(ADialog.Action, {
372
+ asChild: true,
373
+ children: /*#__PURE__*/jsx(Button, {
374
+ size: props.btnSize,
375
+ onClick: props.onConfirm,
376
+ buttonType: props.dialogType,
377
+ css: {
378
+ flex: props.isMobile && 1
379
+ },
380
+ disabled: props?.disabledButton,
381
+ ...props?.actionButtonProps,
382
+ children: props.labelConfirm ? props.labelConfirm : t('label.continue', 'Ya, Lanjutkan')
383
+ })
384
+ })]
385
+ })
386
+ })]
387
+ })]
388
+ })
389
+ });
390
+ }
391
+ TemplateAlertFunction.propTypes = {
392
+ title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
393
+ description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
394
+ btnSize: PropTypes.string,
395
+ dialogType: PropTypes.string,
396
+ onCancel: PropTypes.func,
397
+ onConfirm: PropTypes.func,
398
+ disabledButton: PropTypes.bool,
399
+ actionButtonProps: PropTypes.object,
400
+ cancelButtonProps: PropTypes.object,
401
+ hideCloseButton: PropTypes.bool,
402
+ hideActionButton: PropTypes.bool
403
+ };
404
+ TemplateAlertFunction.defaultProps = {
405
+ dialogType: 'primary',
406
+ btnSize: 'md',
407
+ onCancel: () => {},
408
+ onConfirm: () => {},
409
+ disabledButton: false,
410
+ hideCloseButton: false
411
+ };
412
+ AlertDialog.propTypes = {
413
+ title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
414
+ description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
415
+ btnSize: PropTypes.string,
416
+ dialogType: PropTypes.string,
417
+ onCancel: PropTypes.func,
418
+ onConfirm: PropTypes.func,
419
+ disabledButton: PropTypes.bool,
420
+ actionButtonProps: PropTypes.object,
421
+ cancelButtonProps: PropTypes.object,
422
+ hideCloseButton: PropTypes.bool
423
+ };
424
+ AlertDialog.defaultProps = {
425
+ dialogType: 'primary',
426
+ btnSize: 'md',
427
+ onCancel: () => {},
428
+ onConfirm: () => {},
429
+ disabledButton: false,
430
+ hideCloseButton: false
431
+ };
432
+ const AlertDialogRoot = ADialog.Root;
433
+ const AlertDialogTrigger = ADialog.Trigger;
434
+ const AlertDialogContent = Content;
435
+ const AlertDialogTitle = StyledTitle;
436
+ const AlertDialogDescription = StyledDescription;
437
+ const AlertDialogCancel = ADialog.Cancel;
438
+ const AlertDialogConfirm = ADialog.Action;
439
+
440
+ export { AlertDialog, AlertDialogCancel, AlertDialogConfirm, AlertDialogContent, AlertDialogDescription, AlertDialogFunction, AlertDialogRoot, AlertDialogTitle, AlertDialogTrigger };