@majoo-ui/react 2.4.10 → 3.0.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 (82) hide show
  1. package/components/alertDialog/AlertDialog.esm.js +45 -3
  2. package/components/alertDialog/locale.esm.js +2 -9
  3. package/components/avatar/Avatar.esm.js +14 -1
  4. package/components/banner/Banner.esm.js +47 -8
  5. package/components/buttonGroup/ButtonGroup.esm.js +39 -2
  6. package/components/datePicker/CustomDatePicker.esm.js +28 -14
  7. package/components/datePicker/InputDatePicker.esm.js +1 -3
  8. package/components/datePicker/locale.esm.js +8 -47
  9. package/components/drawer/Drawer.esm.js +26 -2
  10. package/components/dropdownMenu/DropdownMenu.esm.js +25 -2
  11. package/components/form/components/FormGroup/FormGroup.esm.js +12 -1
  12. package/components/form/components/FormHelper/Helper.esm.js +10 -1
  13. package/components/form/components/FormLabel/Label.esm.js +15 -1
  14. package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +11 -1
  15. package/components/form/components/InputCounter/InputCounter.esm.js +4 -1
  16. package/components/form/components/InputCreatable/InputCreatable.esm.js +17 -1
  17. package/components/form/components/InputCreatable/locale.esm.js +2 -8
  18. package/components/form/components/InputDateRange/locale.esm.js +2 -5
  19. package/components/form/components/InputGroup/InputGroup.esm.js +13 -1
  20. package/components/form/components/InputOTP/locale.esm.js +2 -5
  21. package/components/form/components/InputRadio/InputRadio.esm.js +20 -2
  22. package/components/form/components/InputRadio/InputRadioGroup.esm.js +15 -1
  23. package/components/form/components/InputResourceList/locale.esm.js +2 -14
  24. package/components/form/components/InputSearchbox/locale.esm.js +2 -6
  25. package/components/form/components/InputSelect/locale.esm.js +2 -11
  26. package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +58 -3
  27. package/components/form/components/InputSelectCheck/locale.esm.js +5 -14
  28. package/components/form/components/InputSelectTag/InputSelectTag.esm.js +6 -1
  29. package/components/form/components/InputSignature/locale.esm.js +2 -13
  30. package/components/form/components/InputSwitch/InputSwitch.esm.js +15 -1
  31. package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +19 -1
  32. package/components/form/components/InputTags/InputTags.esm.js +24 -1
  33. package/components/form/components/InputTextArea/InputTextArea.esm.js +16 -1
  34. package/components/image/locale.esm.js +2 -5
  35. package/components/notificationBadge/NotificationBadge.esm.js +14 -1
  36. package/components/pagination/Pagination.esm.js +26 -1
  37. package/components/paper/Paper.esm.js +14 -1
  38. package/components/periodSelect/locale.esm.js +2 -12
  39. package/components/popover/Popover.esm.js +41 -4
  40. package/components/progress/Progress.esm.js +16 -1
  41. package/components/slider/Slider.esm.js +24 -1
  42. package/components/table/Table.esm.js +4 -13
  43. package/components/table/components/columns/DateColumn.esm.js +2 -1
  44. package/components/table/locale.esm.js +4 -47
  45. package/components/tableOfContent/TableOfContent.esm.js +4 -0
  46. package/components/tabs/Tabs.esm.js +45 -4
  47. package/components/tagList/locale.esm.js +2 -10
  48. package/components/tagStatus/TagStatus.esm.js +14 -1
  49. package/components/toast/context/ToastProvider.esm.js +9 -1
  50. package/components/toast/context/locale.esm.js +2 -9
  51. package/components/upload/Upload.esm.js +50 -1
  52. package/config/locale/LocaleContext.esm.js +2 -8
  53. package/config/locale/useLocaleText.esm.js +4 -12
  54. package/index.esm.css +4 -4
  55. package/layout/grid/Grid.esm.js +29 -3
  56. package/layout/pageContainer/PageContainer.esm.js +12 -1
  57. package/majoo-provider/MajooProvider.esm.js +43 -13
  58. package/package.json +2 -4
  59. package/src/components/alertDialog/locale.d.ts +1 -1
  60. package/src/components/datePicker/CustomDatePicker.d.ts +12 -1
  61. package/src/components/datePicker/InputDatePicker.d.ts +10 -10
  62. package/src/components/datePicker/components/CalendarMulti.d.ts +1 -2
  63. package/src/components/datePicker/locale.d.ts +1 -2
  64. package/src/components/editableTable/EditableTable.d.ts +1 -0
  65. package/src/components/form/components/InputCounter/InputCounter.d.ts +1 -1
  66. package/src/components/form/components/InputCreatable/locale.d.ts +1 -2
  67. package/src/components/form/components/InputDateRange/InputDateRange.d.ts +2 -2
  68. package/src/components/form/components/InputDateRange/locale.d.ts +1 -1
  69. package/src/components/form/components/InputOTP/locale.d.ts +1 -1
  70. package/src/components/form/components/InputResourceList/locale.d.ts +1 -2
  71. package/src/components/form/components/InputSearchbox/locale.d.ts +1 -2
  72. package/src/components/form/components/InputSelect/locale.d.ts +1 -2
  73. package/src/components/form/components/InputSelectCheck/locale.d.ts +1 -2
  74. package/src/components/form/components/InputSignature/locale.d.ts +1 -2
  75. package/src/components/image/locale.d.ts +1 -1
  76. package/src/components/periodSelect/PeriodSelect.d.ts +1 -2
  77. package/src/components/periodSelect/locale.d.ts +1 -2
  78. package/src/components/table/locale.d.ts +2 -4
  79. package/src/components/tagList/locale.d.ts +1 -1
  80. package/src/components/toast/context/locale.d.ts +1 -1
  81. package/src/config/locale/LocaleContext.d.ts +1 -1
  82. package/src/config/locale/useLocaleText.d.ts +3 -3
@@ -11,7 +11,20 @@ const {
11
11
  zIndices
12
12
  } = foundations;
13
13
  const PopoverContext = /*#__PURE__*/createContext();
14
- const Popover = ({
14
+ const Popover = (
15
+ /**
16
+ * @type {{
17
+ * open?: boolean,
18
+ * onOpenChange?: Function,
19
+ * placement?: 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end',
20
+ * sideOffset?: number,
21
+ * hideOnScroll?: boolean,
22
+ * flip?: boolean,
23
+ * onClose?: Function,
24
+ * children?: import('react').ReactNode,
25
+ * }}
26
+ */
27
+ {
15
28
  children,
16
29
  open = false,
17
30
  onOpenChange,
@@ -65,7 +78,14 @@ const Popover = ({
65
78
  children: children
66
79
  });
67
80
  };
68
- const PopoverTrigger = ({
81
+ const PopoverTrigger = (
82
+ /**
83
+ * @type {{
84
+ * disabled?: boolean,
85
+ * children: import('react').ReactElement,
86
+ * }}
87
+ */
88
+ {
69
89
  children,
70
90
  disabled
71
91
  }) => {
@@ -81,7 +101,16 @@ const PopoverTrigger = ({
81
101
  ...children.props
82
102
  }));
83
103
  };
84
- const PopoverContent = ({
104
+ const PopoverContent = (
105
+ /**
106
+ * @type {{
107
+ * isMobile?: boolean,
108
+ * style?: object,
109
+ * portalled?: boolean,
110
+ * children?: import('react').ReactNode,
111
+ * }}
112
+ */
113
+ {
85
114
  children,
86
115
  isMobile,
87
116
  style,
@@ -124,7 +153,15 @@ const PopoverContent = ({
124
153
  })
125
154
  }) : /*#__PURE__*/jsx(Fragment, {});
126
155
  };
127
- const PopoverClose = ({
156
+ const PopoverClose = (
157
+ /**
158
+ * @type {{
159
+ * children?: import('react').ReactNode,
160
+ * onClick?: Function,
161
+ * [key: string]: any,
162
+ * }}
163
+ */
164
+ {
128
165
  children,
129
166
  ...props
130
167
  }) => {
@@ -116,7 +116,22 @@ const StyledIndicator = styled(ProgressPrimitive.Indicator, {
116
116
  }
117
117
  }
118
118
  });
119
- function Progress({
119
+ function Progress(
120
+ /**
121
+ * @type {{
122
+ * className?: string,
123
+ * value?: number,
124
+ * max?: number,
125
+ * getValueLabel?: Function,
126
+ * color?: string,
127
+ * size?: string,
128
+ * rounded?: boolean,
129
+ * width?: string | number,
130
+ * css?: object,
131
+ * [key: string]: any,
132
+ * }}
133
+ */
134
+ {
120
135
  className,
121
136
  value,
122
137
  max,
@@ -261,7 +261,30 @@ const StyledThumb = styled(SliderPrimitive.Thumb, {
261
261
  }
262
262
  }
263
263
  });
264
- function Slider({
264
+ function Slider(
265
+ /**
266
+ * @type {{
267
+ * className?: string,
268
+ * defaultValue?: number[],
269
+ * value?: number[],
270
+ * name?: string,
271
+ * disabled?: boolean,
272
+ * orientation?: 'horizontal' | 'vertical',
273
+ * dir?: 'ltr' | 'rtl',
274
+ * min?: number,
275
+ * max?: number,
276
+ * step?: number,
277
+ * onValueChange?: Function,
278
+ * minStepsBetweenThumbs?: number,
279
+ * color?: string,
280
+ * size?: string,
281
+ * width?: string | number,
282
+ * height?: string | number,
283
+ * css?: object,
284
+ * [key: string]: any,
285
+ * }}
286
+ */
287
+ {
265
288
  className,
266
289
  defaultValue,
267
290
  value,
@@ -44,7 +44,7 @@ import { alignCss, headerAlignCss, resolveCellCss } from './utils/columnStyles.e
44
44
  import { footerValueOf } from './utils/footerValue.esm.js';
45
45
  import { HeaderTooltip } from './utils/HeaderTooltip.esm.js';
46
46
  import { isHeaderSortable, getAriaSort } from './utils/headerSort.esm.js';
47
- import { useTableLocaleText, i18nTableLocaleText } from './locale.esm.js';
47
+ import { useTableLocaleText } from './locale.esm.js';
48
48
  import { useSticky, getStickyValue, getMarginRight } from 'react-table-sticky';
49
49
  import { useVirtual } from 'react-virtual';
50
50
  import { PlusPrimitive } from '@majoo-ui/icons';
@@ -550,14 +550,8 @@ const emptyStateProps = (asset, title, description, isMobile) => ({
550
550
  children: description
551
551
  })
552
552
  });
553
- /**
554
- * Builds the default empty state from resolved table texts.
555
- * Passing an i18next `t` function as the first argument is deprecated.
556
- */
557
- const defaultEmptyDataProps = (localeText, isMobile) => {
558
- const text = typeof localeText === 'function' ? i18nTableLocaleText(localeText) : localeText;
559
- return emptyStateProps('emptyData', text.emptyDataTitle, text.emptyDataDescription, isMobile);
560
- };
553
+ /** Builds the default empty state from resolved table texts. */
554
+ const defaultEmptyDataProps = (localeText, isMobile) => emptyStateProps('emptyData', localeText.emptyDataTitle, localeText.emptyDataDescription, isMobile);
561
555
  const defaultEmptySearchProps = (localeText, isMobile, query) => emptyStateProps('emptySearchData', localeText.emptySearchTitle({
562
556
  query
563
557
  }), localeText.emptySearchDescription, isMobile);
@@ -716,7 +710,6 @@ function Table({
716
710
  showDuplicatedData,
717
711
  onRowClick,
718
712
  hidePagination = false,
719
- paginationLabel,
720
713
  searchQuery,
721
714
  additionalExceptionIds = [],
722
715
  expanded: controlledExpanded = {},
@@ -751,9 +744,7 @@ function Table({
751
744
  const [filteredHeader, setFilteredHeader] = useState([]);
752
745
  const [hasDarkParent, setHasDarkParent] = useState(false);
753
746
  const [hoveredRowId, setHoveredRowId] = useState(null);
754
- const tableLocaleText = useTableLocaleText(paginationLabel && {
755
- pagination: paginationLabel
756
- }, localeText);
747
+ const tableLocaleText = useTableLocaleText(localeText);
757
748
  const isMobile = useMediaQuery(isMobileLayout === undefined ? '(max-width: 1024px)' : isMobileLayout ? '(max-width: 8000px)' : '(max-width: 0px)');
758
749
  const customEmptyDataProps = searchQuery ? emptySearchProps || defaultEmptySearchProps(tableLocaleText, isMobile, searchQuery) : emptyDataProps || defaultEmptyDataProps(tableLocaleText, isMobile);
759
750
  const getInitialState = () => {
@@ -17,7 +17,8 @@ const DateColumn = ({
17
17
  });
18
18
  };
19
19
  DateColumn.propTypes = {
20
- value: PropTypes.string
20
+ value: PropTypes.string,
21
+ customFormat: PropTypes.string
21
22
  };
22
23
  DateColumn.defaultProps = {
23
24
  value: undefined
@@ -2,7 +2,6 @@ import 'core-js/modules/es.iterator.constructor.js';
2
2
  import 'core-js/modules/es.iterator.filter.js';
3
3
  import 'core-js/modules/es.iterator.reduce.js';
4
4
  import { useContext, useMemo } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
5
  import { LocaleTextContext } from '../../config/locale/LocaleTextContext.esm.js';
7
6
 
8
7
  const defaultTableLocaleText = {
@@ -30,42 +29,6 @@ const defaultTableLocaleText = {
30
29
  btnSubmitText: 'Lanjutkan'
31
30
  }
32
31
  };
33
- // Transitional: keeps apps that still ship `MajooUI/table` locale files translated until they pass
34
- // `localeText`. Remove together with the react-i18next dependency of the table family.
35
- const i18nTableLocaleText = t => {
36
- const d = defaultTableLocaleText;
37
- return {
38
- sortColumnTitle: t('sortColumnTitle', d.sortColumnTitle),
39
- showColumnTitle: t('customColumnTitle', d.showColumnTitle),
40
- emptyDataTitle: t('dataNotAvailableTitle', d.emptyDataTitle),
41
- emptyDataDescription: `${t('dataNotAvailableDescription_1', 'Belum ada data yang dapat ditampilkan')} ${t('dataNotAvailableDescription_2', 'di halaman ini')}`,
42
- emptySearchTitle: ({
43
- query
44
- }) => t('dataNotAvailableTitleSearch', `Oops... ${query} tidak ditemukan`, {
45
- query
46
- }),
47
- emptySearchDescription: `${t('dataNotAvailableDescriptionSearch_1', 'Coba lagi dengan memasukkan')} ${t('dataNotAvailableDescriptionSearch_2', 'kata kunci yang tepat')}`,
48
- pagination: {
49
- showingText: t('pagination.showingText', d.pagination.showingText),
50
- showingCountText: ({
51
- from,
52
- to,
53
- total
54
- }) => t('pagination.showingCountText', `Ditampilkan ${from} - ${to} dari ${total} data`, {
55
- from,
56
- to,
57
- total
58
- }),
59
- dialogShowingText: t('pagination.dialogShowingText', d.pagination.dialogShowingText),
60
- previousButton: t('pagination.previousButton', d.pagination.previousButton),
61
- nextButton: t('pagination.nextButton', d.pagination.nextButton),
62
- gotoPageText: t('pagination.gotoPageText', d.pagination.gotoPageText),
63
- goToPagePlaceholder: t('pagination.goToPagePlaceholder', d.pagination.goToPagePlaceholder),
64
- btnCancelText: t('pagination.btnCancelText', d.pagination.btnCancelText),
65
- btnSubmitText: t('pagination.btnSubmitText', d.pagination.btnSubmitText)
66
- }
67
- };
68
- };
69
32
  const definedEntries = obj => obj ? Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined)) : {};
70
33
  /** Later sources win; an `undefined` value never erases an earlier one. */
71
34
  const mergeTableLocaleText = (base, ...overrides) => overrides.reduce((merged, override) => Object.assign(Object.assign(Object.assign({}, merged), definedEntries(override)), {
@@ -73,19 +36,13 @@ const mergeTableLocaleText = (base, ...overrides) => overrides.reduce((merged, o
73
36
  }), base);
74
37
  /**
75
38
  * Resolves the table texts. Precedence: the table's own `localeText`, then `MajooProvider`'s
76
- * `localeText.table`, then the app's `MajooUI/table` translations, then the Indonesian defaults.
77
- * Several table-level overrides may be passed; later ones win. Pass the same number on every render.
39
+ * `localeText.table`, then the Indonesian defaults.
78
40
  */
79
- const useTableLocaleText = (...localeTexts) => {
80
- const {
81
- t
82
- } = useTranslation('MajooUI/table');
41
+ const useTableLocaleText = localeText => {
83
42
  const {
84
43
  table: appLocaleText
85
44
  } = useContext(LocaleTextContext);
86
- return useMemo(() => mergeTableLocaleText(i18nTableLocaleText(t), appLocaleText, ...localeTexts),
87
- // eslint-disable-next-line react-hooks/exhaustive-deps
88
- [t, appLocaleText, ...localeTexts]);
45
+ return useMemo(() => mergeTableLocaleText(defaultTableLocaleText, appLocaleText, localeText), [appLocaleText, localeText]);
89
46
  };
90
47
 
91
- export { defaultTableLocaleText, i18nTableLocaleText, mergeTableLocaleText, useTableLocaleText };
48
+ export { defaultTableLocaleText, mergeTableLocaleText, useTableLocaleText };
@@ -256,6 +256,10 @@ TableOfContent.propTypes = {
256
256
  List of contents containing the title and id of a content.
257
257
  */
258
258
  content: PropTypes.array,
259
+ /**
260
+ Additional styles of the container.
261
+ */
262
+ css: PropTypes.object,
259
263
  /**
260
264
  Components devoted to mobile viewing only.
261
265
  */
@@ -158,7 +158,21 @@ const ScrollButtonContainer = styled(Box, {
158
158
  // onto the direct children, so a TabsList may sit inside any wrapper and no element receives
159
159
  // an `activeTabs` attribute it does not understand.
160
160
  const ActiveTabsContext = /*#__PURE__*/React__default.createContext(undefined);
161
- const Tabs = ({
161
+ const Tabs = (
162
+ /**
163
+ * @type {{
164
+ * children?: import('react').ReactNode,
165
+ * asChild?: boolean,
166
+ * defaultValue?: string,
167
+ * value?: string,
168
+ * onValueChange?: (value: string) => void,
169
+ * orientation?: 'horizontal' | 'vertical',
170
+ * dir?: 'ltr' | 'rtl',
171
+ * activationMode?: 'automatic' | 'manual',
172
+ * [key: string]: any,
173
+ * }}
174
+ */
175
+ {
162
176
  children,
163
177
  ...props
164
178
  }) => {
@@ -184,7 +198,15 @@ Tabs.propTypes = {
184
198
  dir: PropTypes.oneOf(['ltr', 'rtl']),
185
199
  activationMode: PropTypes.oneOf(['automatic', 'manual'])
186
200
  };
187
- const TabsList = ({
201
+ const TabsList = (
202
+ /**
203
+ * @type {{
204
+ * children?: import('react').ReactNode,
205
+ * activeTabs?: string,
206
+ * [key: string]: any,
207
+ * }}
208
+ */
209
+ {
188
210
  children,
189
211
  activeTabs: activeTabsProp,
190
212
  ...props
@@ -240,7 +262,18 @@ const TabsList = ({
240
262
  })]
241
263
  });
242
264
  };
243
- const TabsTrigger = ({
265
+ const TabsTrigger = (
266
+ /**
267
+ * @type {{
268
+ * children?: import('react').ReactNode,
269
+ * value: string,
270
+ * icon?: import('react').ReactElement,
271
+ * activeTabs?: string,
272
+ * size?: 'sm' | 'md' | 'lg',
273
+ * [key: string]: any,
274
+ * }}
275
+ */
276
+ {
244
277
  children,
245
278
  icon,
246
279
  activeTabs: activeTabsProp,
@@ -280,7 +313,15 @@ TabsTrigger.propTypes = {
280
313
  icon: PropTypes.element,
281
314
  size: PropTypes.oneOf(['sm', 'md', 'lg'])
282
315
  };
283
- const TabsContent = ({
316
+ const TabsContent = (
317
+ /**
318
+ * @type {{
319
+ * value: string,
320
+ * activeTabs?: string,
321
+ * [key: string]: any,
322
+ * }}
323
+ */
324
+ {
284
325
  activeTabs,
285
326
  ...props
286
327
  }) => /*#__PURE__*/jsx(StyledContent, {
@@ -5,18 +5,10 @@ const defaultTagListLocaleText = {
5
5
  showLessButton: 'Tampilkan Sebagian',
6
6
  counterLabel: 'Item terpilih'
7
7
  };
8
- const i18nTagListLocaleText = t => {
9
- const d = defaultTagListLocaleText;
10
- return {
11
- showAllButton: t('showAllText', d.showAllButton),
12
- showLessButton: t('showSomeText', d.showLessButton),
13
- counterLabel: t('labelCounterText', d.counterLabel)
14
- };
15
- };
16
8
  /**
17
9
  * Resolves the tag list texts. Precedence: the list's own `localeText`, then `MajooProvider`'s
18
- * `localeText.tagList`, then the app's `MajooUI/inputSelectCheck` translations, then the Indonesian defaults.
10
+ * `localeText.tagList`, then the Indonesian defaults.
19
11
  */
20
- const useTagListLocaleText = localeText => useLocaleText('tagList', ['MajooUI/inputSelectCheck', 'translation'], i18nTagListLocaleText, localeText);
12
+ const useTagListLocaleText = localeText => useLocaleText('tagList', defaultTagListLocaleText, localeText);
21
13
 
22
14
  export { defaultTagListLocaleText, useTagListLocaleText };
@@ -94,7 +94,20 @@ const StyledIconLeft = styled('div', {
94
94
  }
95
95
  }
96
96
  });
97
- const TagStatus = /*#__PURE__*/React__default.forwardRef(({
97
+ const TagStatus =
98
+ /*#__PURE__*/
99
+ /**
100
+ * @type {React.ForwardRefExoticComponent<{
101
+ * className?: string,
102
+ * children?: React.ReactNode,
103
+ * onClick?: Function,
104
+ * type?: 'default' | 'new' | 'process' | 'success' | 'error' | 'inactive' | 'pending',
105
+ * size?: 'sm' | 'lg',
106
+ * css?: object,
107
+ * [key: string]: any,
108
+ * } & React.RefAttributes<HTMLDivElement>>}
109
+ */
110
+ React__default.forwardRef(({
98
111
  className,
99
112
  children,
100
113
  onClick,
@@ -19,7 +19,15 @@ let toastCount = 0;
19
19
  * back to `MajooProvider`'s `localeText.toast` when `ToastProvider` sits inside it, then the Indonesian
20
20
  * defaults.
21
21
  */
22
- const ToastProvider = ({
22
+ const ToastProvider = (
23
+ /**
24
+ * @type {{
25
+ * children?: import('react').ReactNode,
26
+ * theme?: object,
27
+ * localeText?: object,
28
+ * }}
29
+ */
30
+ {
23
31
  children,
24
32
  theme,
25
33
  localeText
@@ -4,17 +4,10 @@ const defaultToastLocaleText = {
4
4
  offlineTitle: 'Internet Bermasalah',
5
5
  offlineDescription: 'Tidak ada koneksi internet, mohon periksa jaringan'
6
6
  };
7
- const i18nToastLocaleText = t => {
8
- const d = defaultToastLocaleText;
9
- return {
10
- offlineTitle: t('offlineTitle', d.offlineTitle),
11
- offlineDescription: t('offlineDescription', d.offlineDescription)
12
- };
13
- };
14
7
  /**
15
8
  * Resolves the toast texts. Precedence: `ToastProvider`'s own `localeText`, then `MajooProvider`'s
16
- * `localeText.toast`, then the app's `MajooUI/toast` translations, then the Indonesian defaults.
9
+ * `localeText.toast`, then the Indonesian defaults.
17
10
  */
18
- const useToastLocaleText = localeText => useLocaleText('toast', ['MajooUI/toast', 'translation'], i18nToastLocaleText, localeText);
11
+ const useToastLocaleText = localeText => useLocaleText('toast', defaultToastLocaleText, localeText);
19
12
 
20
13
  export { defaultToastLocaleText, useToastLocaleText };
@@ -134,7 +134,56 @@ const IconStateFull = ({
134
134
  })
135
135
  });
136
136
  };
137
- const Upload = ({
137
+ const Upload = (
138
+ /**
139
+ * @type {{
140
+ * disabled?: boolean,
141
+ * listType?: 'file' | 'picture',
142
+ * multiple?: boolean,
143
+ * fileList?: any[],
144
+ * onChange?: Function,
145
+ * onProgress?: Function,
146
+ * onSuccess?: Function,
147
+ * onError?: Function,
148
+ * onPreview?: Function,
149
+ * onRemove?: Function,
150
+ * children?: import('react').ReactNode,
151
+ * max?: number,
152
+ * maxSizeMB?: number,
153
+ * accept?: string,
154
+ * replaceLabel?: string,
155
+ * width?: number,
156
+ * height?: number,
157
+ * css?: object,
158
+ * cropperTitle?: string,
159
+ * showCropper?: boolean,
160
+ * hiddenToggleAspect?: boolean,
161
+ * ratio?: number,
162
+ * errorMessage?: string,
163
+ * progress?: number,
164
+ * loading?: boolean,
165
+ * action?: string,
166
+ * customBodyRequest?: Function,
167
+ * token?: string,
168
+ * tokenKey?: string,
169
+ * reqKey?: string,
170
+ * resKey?: string,
171
+ * imageCompression?: boolean,
172
+ * onBeforeCrop?: Function,
173
+ * hiddenPreview?: boolean,
174
+ * fullAspectCrop?: boolean,
175
+ * isDefaultCustomRatio?: boolean,
176
+ * maxWidthOrHeight?: number,
177
+ * uploadingLabel?: string,
178
+ * placeholder?: string,
179
+ * cancelLabel?: string,
180
+ * saveLabel?: string,
181
+ * customPreviewIcon?: import('react').ReactElement,
182
+ * onPreviewIconClick?: Function,
183
+ * theme?: object,
184
+ * }}
185
+ */
186
+ {
138
187
  listType,
139
188
  multiple,
140
189
  fileList,
@@ -1,7 +1,6 @@
1
1
  import 'core-js/modules/es.array.includes.js';
2
2
  import * as React from 'react';
3
3
  import { useContext } from 'react';
4
- import { useTranslation } from 'react-i18next';
5
4
 
6
5
  const SUPPORTED_LOCALES = ['id', 'en'];
7
6
  const DEFAULT_LOCALE = 'id';
@@ -14,16 +13,11 @@ const normalizeLocale = locale => {
14
13
  };
15
14
  /**
16
15
  * Resolves the language. Precedence: the component's own `locale`, then `MajooProvider`'s `locale`,
17
- * then the app's i18next language, then `id`.
16
+ * then `id`.
18
17
  */
19
- // Transitional: the i18next step keeps apps that never pass `locale` in their current language.
20
- // Remove together with the react-i18next dependency.
21
18
  const useLocale = locale => {
22
19
  const appLocale = useContext(LocaleContext);
23
- const {
24
- i18n
25
- } = useTranslation();
26
- return normalizeLocale(locale || appLocale || (i18n === null || i18n === void 0 ? void 0 : i18n.language));
20
+ return normalizeLocale(locale || appLocale);
27
21
  };
28
22
 
29
23
  export { DEFAULT_LOCALE, LocaleContext, normalizeLocale, useLocale };
@@ -2,7 +2,6 @@ import 'core-js/modules/es.iterator.constructor.js';
2
2
  import 'core-js/modules/es.iterator.filter.js';
3
3
  import 'core-js/modules/es.iterator.reduce.js';
4
4
  import { useContext, useMemo } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
5
  import { LocaleTextContext } from './LocaleTextContext.esm.js';
7
6
  import { useLocale } from './LocaleContext.esm.js';
8
7
 
@@ -11,20 +10,13 @@ const definedEntries = obj => obj ? Object.fromEntries(Object.entries(obj).filte
11
10
  const mergeLocaleText = (base, ...overrides) => overrides.reduce((merged, override) => Object.assign(Object.assign({}, merged), definedEntries(override)), base);
12
11
  /**
13
12
  * Resolves the flat texts of a component. Precedence: the component's own `localeText`, then
14
- * `MajooProvider`'s `localeText[key]`, then the app's i18next translations, then the defaults that
15
- * `fromI18n` falls back to.
13
+ * `MajooProvider`'s `localeText[key]`, then `defaults`. Pass `defaults` as a function of the resolved
14
+ * language when some default texts differ per language.
16
15
  */
17
- // Transitional: `fromI18n` keeps apps that still ship `MajooUI/*` locale files translated until they pass
18
- // `localeText`. Remove together with the react-i18next dependency, leaving the defaults.
19
- const useLocaleText = (key, namespaces, fromI18n, localeText, locale) => {
20
- const {
21
- t
22
- } = useTranslation(namespaces);
16
+ const useLocaleText = (key, defaults, localeText, locale) => {
23
17
  const language = useLocale(locale);
24
18
  const appLocaleText = useContext(LocaleTextContext)[key];
25
- return useMemo(() => mergeLocaleText(fromI18n(t, language), appLocaleText, localeText),
26
- // eslint-disable-next-line react-hooks/exhaustive-deps
27
- [t, language, appLocaleText, localeText]);
19
+ return useMemo(() => mergeLocaleText(typeof defaults === 'function' ? defaults(language) : defaults, appLocaleText, localeText), [defaults, language, appLocaleText, localeText]);
28
20
  };
29
21
 
30
22
  export { mergeLocaleText, useLocaleText };
package/index.esm.css CHANGED
@@ -1045,10 +1045,6 @@
1045
1045
  counter-reset: ol4;
1046
1046
  }
1047
1047
 
1048
- .recharts-pie-sector {
1049
- outline: none;
1050
- }
1051
-
1052
1048
  .ReactCrop {
1053
1049
  position: relative;
1054
1050
  display: inline-block;
@@ -1293,3 +1289,7 @@
1293
1289
  height: 24px;
1294
1290
  }
1295
1291
  }
1292
+
1293
+ .recharts-pie-sector {
1294
+ outline: none;
1295
+ }
@@ -189,7 +189,20 @@ const GridComponent = styled('div', {
189
189
  }
190
190
  }
191
191
  });
192
- const Grid = ({
192
+ const Grid = (
193
+ /**
194
+ * @type {{
195
+ * children?: import('react').ReactNode,
196
+ * autoColumns?: string | number,
197
+ * autoRows?: string | number,
198
+ * autoFlow?: string,
199
+ * templateColumns?: string,
200
+ * templateRows?: string,
201
+ * css?: object,
202
+ * [key: string]: any,
203
+ * }}
204
+ */
205
+ {
193
206
  children,
194
207
  ...props
195
208
  }) => {
@@ -249,7 +262,20 @@ const GridItemComponent = styled('div', {
249
262
  }
250
263
  }
251
264
  });
252
- const GridItem = ({
265
+ const GridItem = (
266
+ /**
267
+ * @type {{
268
+ * children?: import('react').ReactNode,
269
+ * area?: string | number,
270
+ * colStart?: string | number,
271
+ * colEnd?: string | number,
272
+ * rowStart?: string | number,
273
+ * rowEnd?: string | number,
274
+ * css?: object,
275
+ * [key: string]: any,
276
+ * }}
277
+ */
278
+ {
253
279
  children,
254
280
  ...props
255
281
  }) => {
@@ -276,7 +302,7 @@ const GridItem = ({
276
302
  });
277
303
  };
278
304
  GridItem.propTypes = {
279
- gridArea: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
305
+ area: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
280
306
  colSpan: PropTypes.number,
281
307
  rowSpan: PropTypes.number,
282
308
  colStart: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
@@ -38,7 +38,18 @@ const StyledDiv = styled(Flex, {
38
38
  }
39
39
  }
40
40
  });
41
- const PageContainer = ({
41
+ const PageContainer = (
42
+ /**
43
+ * @type {{
44
+ * children?: import('react').ReactNode,
45
+ * isCollapse?: boolean,
46
+ * isLoading?: boolean,
47
+ * css?: object,
48
+ * contentHeader?: import('react').ReactNode,
49
+ * [key: string]: any,
50
+ * }}
51
+ */
52
+ {
42
53
  children,
43
54
  isCollapse,
44
55
  isLoading: _isLoading,