@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.
Files changed (202) 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 +8 -4
  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
@@ -0,0 +1,83 @@
1
+ import 'react';
2
+ import { styled } from '../../config/stitches.config.esm.js';
3
+ import PropTypes from 'prop-types';
4
+ import * as AvatarPrimitive from '@radix-ui/react-avatar';
5
+ import { UserFilled } from '@majoo-ui/icons';
6
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
7
+
8
+ const StyledAvatar = styled(AvatarPrimitive.Root, {
9
+ width: '32px',
10
+ height: '32px',
11
+ borderRadius: '100%',
12
+ backgroundColor: '$bgGray',
13
+ display: 'inline-flex',
14
+ alignItems: 'center',
15
+ justifyContent: 'center',
16
+ verticalAlign: 'middle',
17
+ overflow: 'hidden',
18
+ userSelect: 'none'
19
+ });
20
+ const StyledImage = styled(AvatarPrimitive.Image, {
21
+ width: '100%',
22
+ height: '100%',
23
+ objectFit: 'cover',
24
+ borderRadius: 'inherit'
25
+ });
26
+ const StyledFallback = styled(AvatarPrimitive.Fallback, {
27
+ width: '100%',
28
+ height: '100%',
29
+ display: 'flex',
30
+ alignItems: 'center',
31
+ justifyContent: 'center',
32
+ backgroundColor: '$bgBorder',
33
+ color: '$textPrimary',
34
+ fontSize: '$label',
35
+ lineHeight: 1,
36
+ fontWeight: 600
37
+ });
38
+ const StyledIcon = styled('div', {
39
+ fontSize: '20px'
40
+ });
41
+ function Avatar({
42
+ className,
43
+ img,
44
+ children,
45
+ onLoadingStatusChange,
46
+ delayMs,
47
+ onClick,
48
+ css,
49
+ ...props
50
+ }) {
51
+ return /*#__PURE__*/jsxs(StyledAvatar, {
52
+ className: className,
53
+ onClick: onClick,
54
+ css: {
55
+ ...css
56
+ },
57
+ ...props,
58
+ children: [img !== '' ? /*#__PURE__*/jsx(StyledImage, {
59
+ src: img,
60
+ alt: "pic-profile",
61
+ onLoadingStatusChange: onLoadingStatusChange
62
+ }) : null, /*#__PURE__*/jsx(StyledFallback, {
63
+ delayMs: delayMs,
64
+ children: children !== undefined ? /*#__PURE__*/jsx(Fragment, {
65
+ children: children
66
+ }) : /*#__PURE__*/jsx(StyledIcon, {
67
+ children: /*#__PURE__*/jsx(UserFilled, {})
68
+ })
69
+ })]
70
+ });
71
+ }
72
+ Avatar.propTypes = {
73
+ className: PropTypes.string,
74
+ img: PropTypes.string,
75
+ onLoadingStatusChange: PropTypes.func,
76
+ delayMs: PropTypes.number,
77
+ onClick: PropTypes.func
78
+ };
79
+ Avatar.defaultProps = {
80
+ delayMs: 0
81
+ };
82
+
83
+ export { Avatar, Avatar as default };
@@ -0,0 +1,255 @@
1
+ import 'react';
2
+ import { styled } from '../../config/stitches.config.esm.js';
3
+ import Text from '../text/Text.esm.js';
4
+
5
+ const Badge = styled(Text, {
6
+ // Reset
7
+ alignItems: 'center',
8
+ appearance: 'none',
9
+ borderWidth: '0',
10
+ boxSizing: 'border-box',
11
+ display: 'inline-flex',
12
+ flexShrink: 0,
13
+ fontFamily: 'inherit',
14
+ fontSize: '$caption',
15
+ fontWeight: 600,
16
+ justifyContent: 'center',
17
+ lineHeight: '1',
18
+ verticalAlign: 'middle',
19
+ outline: 'none',
20
+ padding: '$spacing-01 $spacing-02',
21
+ textDecoration: 'none',
22
+ userSelect: 'none',
23
+ WebkitTapHighlightColor: 'rgba(0,0,0,0)',
24
+ '&:disabled': {
25
+ backgroundColor: '$btnDisable',
26
+ pointerEvents: 'none',
27
+ color: '$textDisable'
28
+ },
29
+ // Custom
30
+ borderRadius: '$md',
31
+ color: '$textPrimary',
32
+ whiteSpace: 'nowrap',
33
+ fontVariantNumeric: 'tabular-nums',
34
+ backgroundColor: '$btnDisable',
35
+ variants: {
36
+ colorScheme: {
37
+ gray: {
38
+ subtleColor: 'gray'
39
+ },
40
+ primary: {
41
+ subtleColor: 'primary'
42
+ },
43
+ secondary: {
44
+ subtleColor: 'secondary'
45
+ },
46
+ blue: {
47
+ subtleColor: 'blue'
48
+ },
49
+ orange: {
50
+ subtleColor: 'orange'
51
+ },
52
+ red: {
53
+ subtleColor: 'red'
54
+ },
55
+ purple: {
56
+ subtleColor: 'purple'
57
+ },
58
+ green: {
59
+ subtleColor: 'green'
60
+ }
61
+ },
62
+ badgeVariant: {
63
+ outline: {
64
+ backgroundColor: 'transparent',
65
+ border: '1px solid CurrentColor'
66
+ },
67
+ solid: {
68
+ color: '$white'
69
+ },
70
+ subtle: {},
71
+ alpha: {}
72
+ }
73
+ },
74
+ compoundVariants: [{
75
+ badgeVariant: 'outline',
76
+ css: {
77
+ backgroundColor: 'transparent',
78
+ border: '1px solid CurrentColor'
79
+ }
80
+ }, {
81
+ colorScheme: 'gray',
82
+ badgeVariant: 'outline',
83
+ css: {
84
+ color: '$gray500'
85
+ }
86
+ }, {
87
+ colorScheme: 'primary',
88
+ badgeVariant: 'outline',
89
+ css: {
90
+ color: '$bgBrand'
91
+ }
92
+ }, {
93
+ colorScheme: 'secondary',
94
+ badgeVariant: 'outline',
95
+ css: {
96
+ color: '$secondary500'
97
+ }
98
+ }, {
99
+ colorScheme: 'blue',
100
+ badgeVariant: 'outline',
101
+ css: {
102
+ color: '$blue500'
103
+ }
104
+ }, {
105
+ colorScheme: 'orange',
106
+ badgeVariant: 'outline',
107
+ css: {
108
+ color: '$orange500'
109
+ }
110
+ }, {
111
+ colorScheme: 'red',
112
+ badgeVariant: 'outline',
113
+ css: {
114
+ color: '$red500'
115
+ }
116
+ }, {
117
+ colorScheme: 'purple',
118
+ badgeVariant: 'outline',
119
+ css: {
120
+ color: '$purple500'
121
+ }
122
+ }, {
123
+ colorScheme: 'green',
124
+ badgeVariant: 'outline',
125
+ css: {
126
+ color: '$green500'
127
+ }
128
+ }, {
129
+ colorScheme: 'dark',
130
+ badgeVariant: 'outline',
131
+ css: {
132
+ color: '$borderActive'
133
+ }
134
+ }, {
135
+ colorScheme: 'gray',
136
+ badgeVariant: 'solid',
137
+ css: {
138
+ backgroundColor: '$gray500'
139
+ }
140
+ }, {
141
+ colorScheme: 'primary',
142
+ badgeVariant: 'solid',
143
+ css: {
144
+ backgroundColor: '$bgBrand'
145
+ }
146
+ }, {
147
+ colorScheme: 'secondary',
148
+ badgeVariant: 'solid',
149
+ css: {
150
+ backgroundColor: '$secondary500'
151
+ }
152
+ }, {
153
+ colorScheme: 'blue',
154
+ badgeVariant: 'solid',
155
+ css: {
156
+ backgroundColor: '$blue500'
157
+ }
158
+ }, {
159
+ colorScheme: 'orange',
160
+ badgeVariant: 'solid',
161
+ css: {
162
+ backgroundColor: '$orange500'
163
+ }
164
+ }, {
165
+ colorScheme: 'red',
166
+ badgeVariant: 'solid',
167
+ css: {
168
+ backgroundColor: '$red500'
169
+ }
170
+ }, {
171
+ colorScheme: 'purple',
172
+ badgeVariant: 'solid',
173
+ css: {
174
+ backgroundColor: '$purple500'
175
+ }
176
+ }, {
177
+ colorScheme: 'green',
178
+ badgeVariant: 'solid',
179
+ css: {
180
+ backgroundColor: '$green500'
181
+ }
182
+ }, {
183
+ colorScheme: 'dark',
184
+ badgeVariant: 'solid',
185
+ css: {
186
+ backgroundColor: '$borderActive'
187
+ }
188
+ }, {
189
+ colorScheme: 'gray',
190
+ badgeVariant: 'alpha',
191
+ css: {
192
+ backgroundColor: 'color-mix(in srgb, var(--colors-gray500) 50%, transparent)'
193
+ }
194
+ }, {
195
+ colorScheme: 'primary',
196
+ badgeVariant: 'alpha',
197
+ css: {
198
+ backgroundColor: 'color-mix(in srgb, var(--colors-bgBrand) 50%, transparent)'
199
+ }
200
+ }, {
201
+ colorScheme: 'secondary',
202
+ badgeVariant: 'alpha',
203
+ css: {
204
+ backgroundColor: 'color-mix(in srgb, var(--colors-secondary500) 50%, transparent)'
205
+ }
206
+ }, {
207
+ colorScheme: 'blue',
208
+ badgeVariant: 'alpha',
209
+ css: {
210
+ backgroundColor: 'color-mix(in srgb, var(--colors-blue500) 50%, transparent)'
211
+ }
212
+ }, {
213
+ colorScheme: 'orange',
214
+ badgeVariant: 'alpha',
215
+ css: {
216
+ backgroundColor: 'color-mix(in srgb, var(--colors-orange500) 50%, transparent)'
217
+ }
218
+ }, {
219
+ colorScheme: 'red',
220
+ badgeVariant: 'alpha',
221
+ css: {
222
+ backgroundColor: 'color-mix(in srgb, var(--colors-red500) 50%, transparent)'
223
+ }
224
+ }, {
225
+ colorScheme: 'purple',
226
+ badgeVariant: 'alpha',
227
+ css: {
228
+ backgroundColor: 'color-mix(in srgb, var(--colors-purple500) 50%, transparent)'
229
+ }
230
+ }, {
231
+ colorScheme: 'green',
232
+ badgeVariant: 'alpha',
233
+ css: {
234
+ backgroundColor: 'color-mix(in srgb, var(--colors-green500) 50%, transparent)'
235
+ }
236
+ }, {
237
+ colorScheme: 'dark',
238
+ badgeVariant: 'alpha',
239
+ css: {
240
+ backgroundColor: 'color-mix(in srgb, var(--colors-borderActive) 50%, transparent)'
241
+ }
242
+ }],
243
+ defaultVariants: {
244
+ colorScheme: 'grey',
245
+ badgeVariant: 'subtle'
246
+ }
247
+ });
248
+ Badge.defaultProps = {
249
+ as: 'span',
250
+ colorScheme: 'grey',
251
+ badgeVariant: 'subtle'
252
+ };
253
+ Badge.displayName = 'Badge';
254
+
255
+ export { Badge as default };
@@ -0,0 +1,341 @@
1
+ import * as React from 'react';
2
+ import { CloseOutline } from '@majoo-ui/icons';
3
+ import PropTypes from 'prop-types';
4
+ import { colors, styled } from '../../config/stitches.config.esm.js';
5
+ import Flex from '../../layout/flex/Flex.esm.js';
6
+ import Heading from '../heading/Heading.esm.js';
7
+ import Paragraph from '../paragraph/Paragraph.esm.js';
8
+ import { Link } from '../link/Link.esm.js';
9
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
+
11
+ const Context = /*#__PURE__*/React.createContext();
12
+ const StyledBanner = styled(Flex, {
13
+ maxWidth: '100%',
14
+ padding: '$spacing-03 $spacing-05',
15
+ textAlign: 'left',
16
+ borderRadius: 8,
17
+ pointer: 'default',
18
+ variants: {
19
+ bannerBlock: {
20
+ true: {
21
+ width: '100%'
22
+ },
23
+ false: {
24
+ width: 'fit-content'
25
+ }
26
+ },
27
+ variant: {
28
+ info: {
29
+ backgroundColor: '$bgNew',
30
+ border: '1px solid $hlNews'
31
+ },
32
+ warning: {
33
+ backgroundColor: '$bgProcess',
34
+ border: '1px solid $hlPending'
35
+ },
36
+ success: {
37
+ backgroundColor: '$bgSuccess',
38
+ border: '1px solid $hlSuccess'
39
+ },
40
+ failed: {
41
+ backgroundColor: '$bgFailed',
42
+ border: '1px solid $hlFailed'
43
+ },
44
+ pending: {
45
+ backgroundColor: '$bgProcess',
46
+ border: '1px solid $hlPending'
47
+ }
48
+ },
49
+ hasAction: {
50
+ true: {
51
+ cursor: 'pointer'
52
+ }
53
+ },
54
+ mobileOnly: {
55
+ true: {
56
+ '@lg': {
57
+ display: 'none !important'
58
+ }
59
+ }
60
+ },
61
+ desktopOnly: {
62
+ true: {
63
+ display: 'none !important',
64
+ '@lg': {
65
+ display: 'flex !important'
66
+ }
67
+ }
68
+ }
69
+ }
70
+ });
71
+ const Title = styled(Heading, {
72
+ lineHeight: '$long-content-regular',
73
+ whiteSpace: 'nowrap',
74
+ overflow: 'hidden',
75
+ textOverflow: 'ellipsis',
76
+ maxWidth: '956px',
77
+ marginInlineEnd: 12,
78
+ color: '$textPrimary !important'
79
+ });
80
+ const Description = styled(Paragraph, {
81
+ lineHeight: '$long-content-regular',
82
+ flex: 1,
83
+ whiteSpace: 'nowrap',
84
+ overflow: 'hidden',
85
+ textOverflow: 'ellipsis',
86
+ maxWidth: '956px',
87
+ marginInlineEnd: 12
88
+ });
89
+ const CloseButton = styled(Flex, {
90
+ cursor: 'pointer',
91
+ size: '20px',
92
+ borderRadius: '$round',
93
+ '&:hover': {
94
+ backgroundColor: 'rgba(0, 0, 0, .05)'
95
+ },
96
+ alignSelf: 'start',
97
+ alignItems: 'center',
98
+ justifyContent: 'center',
99
+ variants: {
100
+ closeCenter: {
101
+ true: {
102
+ alignSelf: 'center'
103
+ }
104
+ }
105
+ }
106
+ });
107
+ const BannerTitle = props => /*#__PURE__*/jsx(Title, {
108
+ heading: "sectionTitle",
109
+ ...props,
110
+ children: props.children
111
+ });
112
+ BannerTitle.propTypes = {
113
+ /**
114
+ Additional styles of title
115
+ */
116
+ css: PropTypes.object,
117
+ /**
118
+ Title of the Banner to be displayed
119
+ */
120
+ children: PropTypes.string
121
+ };
122
+ const BannerDescription = props => /*#__PURE__*/jsx(Description, {
123
+ paragraph: "longContentRegular",
124
+ color: "secondary",
125
+ ...props,
126
+ children: props.children
127
+ });
128
+ BannerDescription.propTypes = {
129
+ /**
130
+ Additional styles of description
131
+ */
132
+ css: PropTypes.object,
133
+ /**
134
+ Description of the Banner to be displayed
135
+ */
136
+ children: PropTypes.string
137
+ };
138
+ const BannerLink = ({
139
+ css,
140
+ link,
141
+ children,
142
+ variant
143
+ }) => {
144
+ function generateVariant(params) {
145
+ switch (params) {
146
+ case 'warning':
147
+ return 'primary';
148
+ case 'pending':
149
+ return 'primary';
150
+ case 'failed':
151
+ return 'failed';
152
+ default:
153
+ return 'success';
154
+ }
155
+ }
156
+ return /*#__PURE__*/jsx(Context.Consumer, {
157
+ children: value => /*#__PURE__*/jsx(Link, {
158
+ css: {
159
+ marginInlineEnd: '$spacing-04',
160
+ ...css
161
+ },
162
+ href: link,
163
+ color: variant ? generateVariant(variant) : generateVariant(value.variant),
164
+ children: children
165
+ })
166
+ });
167
+ };
168
+ BannerLink.propTypes = {
169
+ /**
170
+ The purpose of a clickable link, presented in url
171
+ */
172
+ link: PropTypes.string,
173
+ /**
174
+ Text of BannerLink to be displayed
175
+ */
176
+ children: PropTypes.string,
177
+ /**
178
+ Additional theme of BannerLink is presented by color variants
179
+ */
180
+ variant: PropTypes.oneOf(['info', 'warning', 'success', 'failed'])
181
+ };
182
+ BannerLink.defaultProps = {
183
+ children: 'Learn more'
184
+ };
185
+ const BannerClose = () => /*#__PURE__*/jsx(Context.Consumer, {
186
+ children: value => /*#__PURE__*/jsx(CloseButton, {
187
+ onClick: e => {
188
+ e.preventDefault();
189
+ e.stopPropagation();
190
+ value?.onRemove();
191
+ },
192
+ children: /*#__PURE__*/jsx(CloseOutline, {
193
+ color: colors.iconSecondary,
194
+ size: "16px"
195
+ })
196
+ })
197
+ });
198
+ const SingleTagBanner = props => {
199
+ return /*#__PURE__*/jsxs(Flex, {
200
+ gap: 2,
201
+ direction: "column",
202
+ children: [/*#__PURE__*/jsxs(Flex, {
203
+ children: [/*#__PURE__*/jsxs(Flex, {
204
+ gap: 3,
205
+ direction: "row",
206
+ children: [props?.icon && /*#__PURE__*/jsx(Flex, {
207
+ css: {
208
+ marginTop: '-2px'
209
+ },
210
+ children: props?.icon?.()
211
+ }), /*#__PURE__*/jsxs(Flex, {
212
+ gap: 2,
213
+ direction: "column",
214
+ css: {
215
+ flex: 1,
216
+ marginRight: '$spacing-04'
217
+ },
218
+ children: [props.title && /*#__PURE__*/jsx(BannerTitle, {
219
+ children: props.title
220
+ }), props.description && /*#__PURE__*/jsx(BannerDescription, {
221
+ children: props.description
222
+ })]
223
+ })]
224
+ }), props?.onRemove && /*#__PURE__*/jsx(CloseButton, {
225
+ onClick: e => {
226
+ e.preventDefault();
227
+ e.stopPropagation();
228
+ props?.onRemove();
229
+ },
230
+ closeCenter: !props.title && !props.link,
231
+ children: /*#__PURE__*/jsx(CloseOutline, {
232
+ color: colors.iconSecondary,
233
+ size: "16px"
234
+ })
235
+ })]
236
+ }), props.link && /*#__PURE__*/jsx(BannerLink, {
237
+ css: {
238
+ alignSelf: 'end',
239
+ marginInlineEnd: 'unset'
240
+ },
241
+ link: props.link,
242
+ variant: props.variant,
243
+ children: props.linkText
244
+ })]
245
+ });
246
+ };
247
+ const Banner = ({
248
+ title,
249
+ description,
250
+ variant,
251
+ link,
252
+ linkText,
253
+ onClick,
254
+ onRemove,
255
+ children,
256
+ bannerBlock,
257
+ icon,
258
+ ...rest
259
+ }) => {
260
+ return /*#__PURE__*/jsx(StyledBanner, {
261
+ variant: variant,
262
+ hasAction: !!onClick,
263
+ onClick: onClick,
264
+ bannerBlock: bannerBlock,
265
+ ...rest,
266
+ children: children ? /*#__PURE__*/jsx(Flex, {
267
+ direction: "row",
268
+ gap: 3,
269
+ align: "center",
270
+ wrap: "wrap",
271
+ css: {
272
+ maxWidth: '100vw',
273
+ position: 'relative',
274
+ flex: 1,
275
+ overflowX: 'hidden'
276
+ },
277
+ children: /*#__PURE__*/jsx(Context.Provider, {
278
+ value: {
279
+ onRemove,
280
+ variant
281
+ },
282
+ children: children
283
+ })
284
+ }) : /*#__PURE__*/jsx(SingleTagBanner, {
285
+ title: title,
286
+ description: description,
287
+ variant: variant,
288
+ icon: icon,
289
+ link: link,
290
+ linkText: linkText,
291
+ onClick: onClick,
292
+ onRemove: onRemove
293
+ })
294
+ });
295
+ };
296
+ Banner.displayName = 'Banner';
297
+ BannerTitle.displayName = 'BannerTitle';
298
+ BannerDescription.displayName = 'BannerDescription';
299
+ Banner.propTypes = {
300
+ /**
301
+ Title of banner to be displayed
302
+ */
303
+ title: PropTypes.string,
304
+ /**
305
+ Description of banner to be displayed
306
+ */
307
+ description: PropTypes.string,
308
+ /**
309
+ The banner theme is presented in color variants
310
+ */
311
+ variant: PropTypes.oneOf(['info', 'warning', 'success', 'failed']),
312
+ /**
313
+ The purpose of a clickable link, presented in url
314
+ */
315
+ link: PropTypes.string,
316
+ /**
317
+ Text of button link to be displayed
318
+ */
319
+ linkText: PropTypes.string,
320
+ /**
321
+ Icon of banner to be displayed
322
+ */
323
+ icon: PropTypes.func,
324
+ /**
325
+ Clickable event handler
326
+ */
327
+ onClick: PropTypes.func,
328
+ /**
329
+ Closable event handler
330
+ */
331
+ onRemove: PropTypes.func,
332
+ /**
333
+ Block type banner to display in full width
334
+ */
335
+ bannerBlock: PropTypes.bool
336
+ };
337
+ Banner.defaultProps = {
338
+ variant: 'info'
339
+ };
340
+
341
+ export { BannerClose, BannerDescription, BannerLink, BannerTitle, Banner as default };