@majoo-ui/react 2.4.9 → 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.
- package/components/alertDialog/AlertDialog.esm.js +45 -3
- package/components/alertDialog/locale.esm.js +2 -9
- package/components/avatar/Avatar.esm.js +14 -1
- package/components/banner/Banner.esm.js +47 -8
- package/components/buttonGroup/ButtonGroup.esm.js +39 -2
- package/components/datePicker/CustomDatePicker.esm.js +28 -14
- package/components/datePicker/InputDatePicker.esm.js +1 -3
- package/components/datePicker/locale.esm.js +8 -47
- package/components/drawer/Drawer.esm.js +26 -2
- package/components/dropdownMenu/DropdownMenu.esm.js +25 -2
- package/components/form/components/FormGroup/FormGroup.esm.js +12 -1
- package/components/form/components/FormHelper/Helper.esm.js +10 -1
- package/components/form/components/FormLabel/Label.esm.js +15 -1
- package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +11 -1
- package/components/form/components/InputCounter/InputCounter.esm.js +4 -1
- package/components/form/components/InputCreatable/InputCreatable.esm.js +17 -1
- package/components/form/components/InputCreatable/locale.esm.js +2 -8
- package/components/form/components/InputDateRange/locale.esm.js +2 -5
- package/components/form/components/InputGroup/InputGroup.esm.js +13 -1
- package/components/form/components/InputOTP/locale.esm.js +2 -5
- package/components/form/components/InputRadio/InputRadio.esm.js +20 -2
- package/components/form/components/InputRadio/InputRadioGroup.esm.js +15 -1
- package/components/form/components/InputResourceList/locale.esm.js +2 -14
- package/components/form/components/InputSearchbox/locale.esm.js +2 -6
- package/components/form/components/InputSelect/InputSelect.esm.js +48 -16
- package/components/form/components/InputSelect/locale.esm.js +2 -11
- package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +58 -3
- package/components/form/components/InputSelectCheck/locale.esm.js +5 -14
- package/components/form/components/InputSelectTag/InputSelectTag.esm.js +6 -1
- package/components/form/components/InputSignature/locale.esm.js +2 -13
- package/components/form/components/InputSwitch/InputSwitch.esm.js +15 -1
- package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +19 -1
- package/components/form/components/InputTags/InputTags.esm.js +24 -1
- package/components/form/components/InputTextArea/InputTextArea.esm.js +16 -1
- package/components/image/locale.esm.js +2 -5
- package/components/notificationBadge/NotificationBadge.esm.js +14 -1
- package/components/pagination/Pagination.esm.js +26 -1
- package/components/paper/Paper.esm.js +14 -1
- package/components/periodSelect/locale.esm.js +2 -12
- package/components/popover/Popover.esm.js +41 -4
- package/components/progress/Progress.esm.js +16 -1
- package/components/slider/Slider.esm.js +24 -1
- package/components/table/Table.esm.js +4 -13
- package/components/table/components/columns/DateColumn.esm.js +2 -1
- package/components/table/locale.esm.js +4 -47
- package/components/tableOfContent/TableOfContent.esm.js +4 -0
- package/components/tabs/Tabs.esm.js +45 -4
- package/components/tagList/locale.esm.js +2 -10
- package/components/tagStatus/TagStatus.esm.js +14 -1
- package/components/toast/context/ToastProvider.esm.js +9 -1
- package/components/toast/context/locale.esm.js +2 -9
- package/components/upload/Upload.esm.js +50 -1
- package/config/locale/LocaleContext.esm.js +2 -8
- package/config/locale/useLocaleText.esm.js +4 -12
- package/index.esm.css +4 -4
- package/layout/grid/Grid.esm.js +29 -3
- package/layout/pageContainer/PageContainer.esm.js +12 -1
- package/majoo-provider/MajooProvider.esm.js +43 -13
- package/package.json +2 -4
- package/src/components/alertDialog/locale.d.ts +1 -1
- package/src/components/datePicker/CustomDatePicker.d.ts +12 -1
- package/src/components/datePicker/InputDatePicker.d.ts +10 -10
- package/src/components/datePicker/components/CalendarMulti.d.ts +1 -2
- package/src/components/datePicker/locale.d.ts +1 -2
- package/src/components/editableTable/EditableTable.d.ts +1 -0
- package/src/components/form/components/InputCounter/InputCounter.d.ts +1 -1
- package/src/components/form/components/InputCreatable/locale.d.ts +1 -2
- package/src/components/form/components/InputDateRange/InputDateRange.d.ts +2 -2
- package/src/components/form/components/InputDateRange/locale.d.ts +1 -1
- package/src/components/form/components/InputOTP/locale.d.ts +1 -1
- package/src/components/form/components/InputResourceList/locale.d.ts +1 -2
- package/src/components/form/components/InputSearchbox/locale.d.ts +1 -2
- package/src/components/form/components/InputSelect/locale.d.ts +1 -2
- package/src/components/form/components/InputSelectCheck/locale.d.ts +1 -2
- package/src/components/form/components/InputSignature/locale.d.ts +1 -2
- package/src/components/image/locale.d.ts +1 -1
- package/src/components/periodSelect/PeriodSelect.d.ts +1 -2
- package/src/components/periodSelect/locale.d.ts +1 -2
- package/src/components/table/locale.d.ts +2 -4
- package/src/components/tagList/locale.d.ts +1 -1
- package/src/components/toast/context/locale.d.ts +1 -1
- package/src/config/locale/LocaleContext.d.ts +1 -1
- package/src/config/locale/useLocaleText.d.ts +3 -3
|
@@ -143,7 +143,23 @@ const Item = styled('div', {
|
|
|
143
143
|
cursor: 'pointer',
|
|
144
144
|
lineHeight: '20px'
|
|
145
145
|
});
|
|
146
|
-
const InputCreatable =
|
|
146
|
+
const InputCreatable =
|
|
147
|
+
/*#__PURE__*/
|
|
148
|
+
/**
|
|
149
|
+
* @type {React.ForwardRefExoticComponent<{
|
|
150
|
+
* placeholder?: string,
|
|
151
|
+
* size?: string,
|
|
152
|
+
* value?: string,
|
|
153
|
+
* onChange?: Function,
|
|
154
|
+
* onClickItem?: Function,
|
|
155
|
+
* maxChar?: number,
|
|
156
|
+
* isInvalid?: boolean,
|
|
157
|
+
* disabled?: boolean,
|
|
158
|
+
* readOnly?: boolean,
|
|
159
|
+
* localeText?: { addOptionLabel?: Function },
|
|
160
|
+
* } & React.RefAttributes<HTMLInputElement>>}
|
|
161
|
+
*/
|
|
162
|
+
React__default.forwardRef(function InputCreatable({
|
|
147
163
|
size,
|
|
148
164
|
isInvalid,
|
|
149
165
|
placeholder,
|
|
@@ -5,16 +5,10 @@ const defaultInputCreatableLocaleText = {
|
|
|
5
5
|
value
|
|
6
6
|
}) => `Tambah "${value}"`
|
|
7
7
|
};
|
|
8
|
-
const i18nInputCreatableLocaleText = t => ({
|
|
9
|
-
addOptionLabel: ({
|
|
10
|
-
value
|
|
11
|
-
}) => `${t('addText', 'Tambah')} "${value}"`
|
|
12
|
-
});
|
|
13
8
|
/**
|
|
14
9
|
* Resolves the creatable input texts. Precedence: the input's own `localeText`, then `MajooProvider`'s
|
|
15
|
-
* `localeText.inputCreatable`, then the
|
|
16
|
-
* defaults.
|
|
10
|
+
* `localeText.inputCreatable`, then the Indonesian defaults.
|
|
17
11
|
*/
|
|
18
|
-
const useInputCreatableLocaleText = localeText => useLocaleText('inputCreatable',
|
|
12
|
+
const useInputCreatableLocaleText = localeText => useLocaleText('inputCreatable', defaultInputCreatableLocaleText, localeText);
|
|
19
13
|
|
|
20
14
|
export { defaultInputCreatableLocaleText, useInputCreatableLocaleText };
|
|
@@ -3,13 +3,10 @@ import { useLocaleText } from '../../../../config/locale/useLocaleText.esm.js';
|
|
|
3
3
|
const defaultInputDateRangeLocaleText = {
|
|
4
4
|
placeholder: 'Pilih'
|
|
5
5
|
};
|
|
6
|
-
const i18nInputDateRangeLocaleText = t => ({
|
|
7
|
-
placeholder: t('placeholder.select', defaultInputDateRangeLocaleText.placeholder)
|
|
8
|
-
});
|
|
9
6
|
/**
|
|
10
7
|
* Resolves the date range select texts. Precedence: the select's own `localeText`, then `MajooProvider`'s
|
|
11
|
-
* `localeText.inputDateRange`, then the
|
|
8
|
+
* `localeText.inputDateRange`, then the Indonesian defaults.
|
|
12
9
|
*/
|
|
13
|
-
const useInputDateRangeLocaleText = localeText => useLocaleText('inputDateRange',
|
|
10
|
+
const useInputDateRangeLocaleText = localeText => useLocaleText('inputDateRange', defaultInputDateRangeLocaleText, localeText);
|
|
14
11
|
|
|
15
12
|
export { defaultInputDateRangeLocaleText, useInputDateRangeLocaleText };
|
|
@@ -140,7 +140,19 @@ const InputGroupStyle = styled('div', {
|
|
|
140
140
|
size: 'lg'
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
|
-
const InputGroup = (
|
|
143
|
+
const InputGroup = (
|
|
144
|
+
/**
|
|
145
|
+
* @type {{
|
|
146
|
+
* children: import('react').ReactNode,
|
|
147
|
+
* size?: 'sm' | 'lg',
|
|
148
|
+
* isInvalid?: boolean,
|
|
149
|
+
* readOnly?: boolean,
|
|
150
|
+
* disabled?: boolean,
|
|
151
|
+
* css?: object,
|
|
152
|
+
* [key: string]: any,
|
|
153
|
+
* }}
|
|
154
|
+
*/
|
|
155
|
+
{
|
|
144
156
|
children,
|
|
145
157
|
size = 'lg',
|
|
146
158
|
...rest
|
|
@@ -3,13 +3,10 @@ import { useLocaleText } from '../../../../config/locale/useLocaleText.esm.js';
|
|
|
3
3
|
const defaultInputOtpLocaleText = {
|
|
4
4
|
resendButton: 'Kirim Ulang'
|
|
5
5
|
};
|
|
6
|
-
const i18nInputOtpLocaleText = t => ({
|
|
7
|
-
resendButton: t('resendingText', defaultInputOtpLocaleText.resendButton)
|
|
8
|
-
});
|
|
9
6
|
/**
|
|
10
7
|
* Resolves the OTP texts. Precedence: the component's own `localeText`, then `MajooProvider`'s
|
|
11
|
-
* `localeText.inputOtp`, then the
|
|
8
|
+
* `localeText.inputOtp`, then the Indonesian defaults.
|
|
12
9
|
*/
|
|
13
|
-
const useInputOtpLocaleText = localeText => useLocaleText('inputOtp',
|
|
10
|
+
const useInputOtpLocaleText = localeText => useLocaleText('inputOtp', defaultInputOtpLocaleText, localeText);
|
|
14
11
|
|
|
15
12
|
export { defaultInputOtpLocaleText, useInputOtpLocaleText };
|
|
@@ -166,7 +166,25 @@ const ContainerLabel = styled('label', {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
|
-
const InputRadio = (
|
|
169
|
+
const InputRadio = (
|
|
170
|
+
/**
|
|
171
|
+
* @type {{
|
|
172
|
+
* id?: string,
|
|
173
|
+
* value?: string,
|
|
174
|
+
* label?: import('react').ReactNode,
|
|
175
|
+
* description?: import('react').ReactNode,
|
|
176
|
+
* disabled?: boolean,
|
|
177
|
+
* readOnly?: boolean,
|
|
178
|
+
* css?: object,
|
|
179
|
+
* inputType?: 'number' | 'text' | 'default',
|
|
180
|
+
* inputProps?: object,
|
|
181
|
+
* onChange?: Function,
|
|
182
|
+
* outlined?: boolean,
|
|
183
|
+
* block?: boolean,
|
|
184
|
+
* [key: string]: any,
|
|
185
|
+
* }}
|
|
186
|
+
*/
|
|
187
|
+
{
|
|
170
188
|
id,
|
|
171
189
|
disabled,
|
|
172
190
|
css,
|
|
@@ -268,7 +286,7 @@ InputRadio.propTypes = {
|
|
|
268
286
|
css: PropTypes.object,
|
|
269
287
|
inputType: PropTypes.oneOf(['number', 'text', 'default']),
|
|
270
288
|
onChange: PropTypes.func,
|
|
271
|
-
description: PropTypes.
|
|
289
|
+
description: PropTypes.node,
|
|
272
290
|
readOnly: PropTypes.bool
|
|
273
291
|
};
|
|
274
292
|
InputRadio.displayName = 'InputRadio';
|
|
@@ -9,7 +9,21 @@ import { InputRadioContext } from './context.esm.js';
|
|
|
9
9
|
import { jsx } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
11
|
const RadioGroup = styled(RadioGroupPrimitive.Root, Flex);
|
|
12
|
-
const InputRadioGroup =
|
|
12
|
+
const InputRadioGroup =
|
|
13
|
+
/*#__PURE__*/
|
|
14
|
+
/**
|
|
15
|
+
* @type {React.ForwardRefExoticComponent<{
|
|
16
|
+
* children?: React.ReactNode,
|
|
17
|
+
* defaultValue?: string,
|
|
18
|
+
* value?: string,
|
|
19
|
+
* onValueChange?: (value: string) => void,
|
|
20
|
+
* disabled?: boolean,
|
|
21
|
+
* outlined?: boolean,
|
|
22
|
+
* block?: boolean,
|
|
23
|
+
* [key: string]: any,
|
|
24
|
+
* } & React.RefAttributes<HTMLDivElement>>}
|
|
25
|
+
*/
|
|
26
|
+
React__default.forwardRef(function InputRadioGroup(props, ref) {
|
|
13
27
|
const {
|
|
14
28
|
children,
|
|
15
29
|
outlined: _outlined,
|
|
@@ -6,22 +6,10 @@ const defaultInputResourceListLocaleText = {
|
|
|
6
6
|
emptyDataText: 'Tidak ada data',
|
|
7
7
|
counterLabel: 'kategori dipilih'
|
|
8
8
|
};
|
|
9
|
-
const i18nInputResourceListLocaleText = t => {
|
|
10
|
-
const d = defaultInputResourceListLocaleText;
|
|
11
|
-
return {
|
|
12
|
-
searchPlaceholder: t('placeholder.search', d.searchPlaceholder),
|
|
13
|
-
title: t('defaultTitle', d.title),
|
|
14
|
-
emptyDataText: t('label.noData', d.emptyDataText, {
|
|
15
|
-
ns: 'translation'
|
|
16
|
-
}),
|
|
17
|
-
counterLabel: t('counterFooterText', d.counterLabel)
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
9
|
/**
|
|
21
10
|
* Resolves the resource list texts. Precedence: the list's own `localeText`, then `MajooProvider`'s
|
|
22
|
-
* `localeText.inputResourceList`, then the
|
|
23
|
-
* Indonesian defaults.
|
|
11
|
+
* `localeText.inputResourceList`, then the Indonesian defaults.
|
|
24
12
|
*/
|
|
25
|
-
const useInputResourceListLocaleText = localeText => useLocaleText('inputResourceList',
|
|
13
|
+
const useInputResourceListLocaleText = localeText => useLocaleText('inputResourceList', defaultInputResourceListLocaleText, localeText);
|
|
26
14
|
|
|
27
15
|
export { defaultInputResourceListLocaleText, useInputResourceListLocaleText };
|
|
@@ -3,14 +3,10 @@ import { useLocaleText } from '../../../../config/locale/useLocaleText.esm.js';
|
|
|
3
3
|
const defaultInputSearchboxLocaleText = {
|
|
4
4
|
placeholder: 'Cari ...'
|
|
5
5
|
};
|
|
6
|
-
const i18nInputSearchboxLocaleText = t => ({
|
|
7
|
-
placeholder: t('placeholder', defaultInputSearchboxLocaleText.placeholder)
|
|
8
|
-
});
|
|
9
6
|
/**
|
|
10
7
|
* Resolves the search box texts. Precedence: the search box's own `localeText`, then `MajooProvider`'s
|
|
11
|
-
* `localeText.inputSearchbox`, then the
|
|
12
|
-
* defaults.
|
|
8
|
+
* `localeText.inputSearchbox`, then the Indonesian defaults.
|
|
13
9
|
*/
|
|
14
|
-
const useInputSearchboxLocaleText = localeText => useLocaleText('inputSearchbox',
|
|
10
|
+
const useInputSearchboxLocaleText = localeText => useLocaleText('inputSearchbox', defaultInputSearchboxLocaleText, localeText);
|
|
15
11
|
|
|
16
12
|
export { defaultInputSearchboxLocaleText, useInputSearchboxLocaleText };
|
|
@@ -7,7 +7,7 @@ import 'core-js/modules/es.iterator.map.js';
|
|
|
7
7
|
import 'core-js/modules/es.iterator.reduce.js';
|
|
8
8
|
import { __rest, __awaiter } from 'tslib';
|
|
9
9
|
import * as React from 'react';
|
|
10
|
-
import { useState, useRef, useEffect, createElement } from 'react';
|
|
10
|
+
import { useState, useRef, useCallback, useEffect, createElement } from 'react';
|
|
11
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
12
12
|
import { renderToString } from 'react-dom/server';
|
|
13
13
|
import Downshift from 'downshift';
|
|
@@ -407,10 +407,20 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
407
407
|
const [selectedValue, setSelectedValue] = useState(value);
|
|
408
408
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
409
409
|
const [query, setQuery] = useState();
|
|
410
|
-
const [openOptions, setOpenOptions] = useState(false);
|
|
411
410
|
const [open, setOpen] = useState(false);
|
|
412
411
|
const selectBoxRef = useRef(null);
|
|
413
412
|
const scrollerRef = useRef(null);
|
|
413
|
+
const downshiftMenuRef = useRef();
|
|
414
|
+
// The desktop menu shows only while Downshift's isOpen and the Popover's own open state are both true,
|
|
415
|
+
// and each one opens and closes itself: the search input toggles Downshift only while it is closed, the
|
|
416
|
+
// Popover trigger toggles on every click and also closes on outside press or ancestor scroll. Kept as two
|
|
417
|
+
// independent states they drifted out of phase, and from then on every click flipped both, so the menu
|
|
418
|
+
// never showed. Downshift is the source of truth; whatever the Popover decides is pushed into it.
|
|
419
|
+
const handlePopoverOpenChange = useCallback(popoverOpen => {
|
|
420
|
+
const downshiftMenu = downshiftMenuRef.current;
|
|
421
|
+
if (!downshiftMenu || downshiftMenu.isOpen === popoverOpen) return;
|
|
422
|
+
if (popoverOpen) downshiftMenu.openMenu();else downshiftMenu.closeMenu();
|
|
423
|
+
}, []);
|
|
414
424
|
useEffect(() => {
|
|
415
425
|
var _a;
|
|
416
426
|
if (search && Boolean(query)) {
|
|
@@ -428,7 +438,7 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
428
438
|
}
|
|
429
439
|
};
|
|
430
440
|
scrollToSelectedElement();
|
|
431
|
-
}, [query, search,
|
|
441
|
+
}, [query, search, open, selectedIndex]);
|
|
432
442
|
const handleInputValue = (value, isReset = false) => {
|
|
433
443
|
if (onSearch && !isReset) onSearch(value);
|
|
434
444
|
if (fetchData) return;
|
|
@@ -536,9 +546,12 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
536
546
|
}, [item]);
|
|
537
547
|
const stateReducer = (state, changes) => {
|
|
538
548
|
switch (changes.type) {
|
|
549
|
+
// A blurred toggle button must not close the menu (on mobile focus moves into the dialog the menu
|
|
550
|
+
// renders in), but it must not open a closed one either: the Popover follows isOpen, so that would
|
|
551
|
+
// pop the menu open whenever the user tabs away from the field.
|
|
539
552
|
case Downshift.stateChangeTypes.blurButton:
|
|
540
553
|
return {
|
|
541
|
-
isOpen:
|
|
554
|
+
isOpen: state.isOpen
|
|
542
555
|
};
|
|
543
556
|
// Downshift wipes selectedItem on Escape whenever its own isOpen is already false,
|
|
544
557
|
// firing onChange(null) on consumers that never asked to clear the selection.
|
|
@@ -581,17 +594,41 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
581
594
|
getInputProps,
|
|
582
595
|
getItemProps,
|
|
583
596
|
isOpen,
|
|
597
|
+
openMenu,
|
|
598
|
+
closeMenu,
|
|
599
|
+
toggleMenu,
|
|
584
600
|
selectedItem,
|
|
585
601
|
highlightedIndex
|
|
586
602
|
}) => {
|
|
587
603
|
var _a, _b;
|
|
604
|
+
downshiftMenuRef.current = {
|
|
605
|
+
isOpen,
|
|
606
|
+
openMenu,
|
|
607
|
+
closeMenu
|
|
608
|
+
};
|
|
609
|
+
// Outside tests Downshift runs a toggle-button click in a setTimeout (an iOS blur workaround), while
|
|
610
|
+
// the Popover trigger toggles inside the click itself. The late toggle then undid the Popover sync,
|
|
611
|
+
// so on desktop the toggle happens in the same tick. The mobile dialog has no Popover and keeps
|
|
612
|
+
// Downshift's default.
|
|
613
|
+
const getDesktopToggleButtonProps = () => getToggleButtonProps({
|
|
614
|
+
disabled: disabled || readOnly,
|
|
615
|
+
onClick: event => {
|
|
616
|
+
event.preventDefault();
|
|
617
|
+
event.nativeEvent.preventDownshiftDefault = true;
|
|
618
|
+
toggleMenu();
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
const toggleButtonProps = isMobile ? getToggleButtonProps({
|
|
622
|
+
disabled: disabled || readOnly
|
|
623
|
+
}) : getDesktopToggleButtonProps();
|
|
588
624
|
const handleDownOption = () => {
|
|
589
625
|
if (hideArrowicon || noOptionIcon) {
|
|
590
626
|
return null;
|
|
591
627
|
}
|
|
592
|
-
return jsx(IconContainer, Object.assign({},
|
|
593
|
-
|
|
594
|
-
|
|
628
|
+
return jsx(IconContainer, Object.assign({}, toggleButtonProps, {
|
|
629
|
+
// Pressing the caret would blur the search input, and Downshift's deferred blur check closes the
|
|
630
|
+
// menu this click just opened whenever the button is already released by then.
|
|
631
|
+
onMouseDown: !isMobile ? event => event.preventDefault() : undefined,
|
|
595
632
|
disabled: disabled,
|
|
596
633
|
readOnly: readOnly,
|
|
597
634
|
children: jsx(CaretDownOutline, {
|
|
@@ -600,8 +637,8 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
600
637
|
}));
|
|
601
638
|
};
|
|
602
639
|
return !isMobile ? jsx(Popover, {
|
|
603
|
-
open:
|
|
604
|
-
onOpenChange:
|
|
640
|
+
open: isOpen,
|
|
641
|
+
onOpenChange: handlePopoverOpenChange,
|
|
605
642
|
placement: placement,
|
|
606
643
|
hideOnScroll: true,
|
|
607
644
|
children: jsxs(SelectContainer, {
|
|
@@ -644,22 +681,17 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
644
681
|
},
|
|
645
682
|
inputProps: getInputProps({
|
|
646
683
|
onChange: event => {
|
|
647
|
-
setOpenOptions(true);
|
|
648
684
|
if (event.type !== 'change') return;
|
|
649
685
|
const query = event.target.value;
|
|
650
686
|
if (!fetchData) handleInputValue(query);else debouncedSearch(query);
|
|
651
687
|
},
|
|
652
688
|
disabled
|
|
653
689
|
}),
|
|
654
|
-
onClick: !isOpen ?
|
|
655
|
-
disabled: disabled || readOnly
|
|
656
|
-
}).onClick : undefined
|
|
690
|
+
onClick: !isOpen ? toggleButtonProps.onClick : undefined
|
|
657
691
|
})
|
|
658
692
|
}) : jsx(Button, Object.assign({
|
|
659
693
|
ref: ref
|
|
660
|
-
},
|
|
661
|
-
disabled: disabled || readOnly
|
|
662
|
-
}), {
|
|
694
|
+
}, toggleButtonProps, {
|
|
663
695
|
disabled: disabled,
|
|
664
696
|
size: size,
|
|
665
697
|
readOnly: readOnly,
|
|
@@ -5,19 +5,10 @@ const defaultInputSelectLocaleText = {
|
|
|
5
5
|
searchPlaceholder: 'Cari ...',
|
|
6
6
|
emptyDataText: 'Item tidak ditemukan'
|
|
7
7
|
};
|
|
8
|
-
const i18nInputSelectLocaleText = t => {
|
|
9
|
-
const d = defaultInputSelectLocaleText;
|
|
10
|
-
return {
|
|
11
|
-
placeholder: t('placeholder', d.placeholder),
|
|
12
|
-
searchPlaceholder: t('searchPlaceholder', d.searchPlaceholder),
|
|
13
|
-
emptyDataText: t('noItemPlaceholder', d.emptyDataText)
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
8
|
/**
|
|
17
9
|
* Resolves the select texts. Precedence: the select's own `localeText`, then `MajooProvider`'s
|
|
18
|
-
* `localeText.inputSelect`, then the
|
|
19
|
-
* defaults.
|
|
10
|
+
* `localeText.inputSelect`, then the Indonesian defaults.
|
|
20
11
|
*/
|
|
21
|
-
const useInputSelectLocaleText = localeText => useLocaleText('inputSelect',
|
|
12
|
+
const useInputSelectLocaleText = localeText => useLocaleText('inputSelect', defaultInputSelectLocaleText, localeText);
|
|
22
13
|
|
|
23
14
|
export { defaultInputSelectLocaleText, useInputSelectLocaleText };
|
|
@@ -288,7 +288,62 @@ const IndeterminateFilled = styled('div', {
|
|
|
288
288
|
justifyContent: 'center',
|
|
289
289
|
alignItems: 'center'
|
|
290
290
|
});
|
|
291
|
-
const InputSelectCheck =
|
|
291
|
+
const InputSelectCheck =
|
|
292
|
+
/*#__PURE__*/
|
|
293
|
+
/**
|
|
294
|
+
* @type {React.ForwardRefExoticComponent<{
|
|
295
|
+
* placeholder?: string,
|
|
296
|
+
* option: any[],
|
|
297
|
+
* size?: string,
|
|
298
|
+
* disabled?: boolean,
|
|
299
|
+
* readOnly?: boolean,
|
|
300
|
+
* isInvalid?: boolean,
|
|
301
|
+
* sortBy?: string | null,
|
|
302
|
+
* value?: string[] | number[],
|
|
303
|
+
* onChange?: Function,
|
|
304
|
+
* onRemoveItem?: Function,
|
|
305
|
+
* search?: boolean,
|
|
306
|
+
* placement?: 'top' | 'bottom',
|
|
307
|
+
* disabledOptions?: string[],
|
|
308
|
+
* disabledSortChecked?: boolean,
|
|
309
|
+
* unremovableTags?: string[],
|
|
310
|
+
* textEmptyItem?: string,
|
|
311
|
+
* showSelectAll?: boolean,
|
|
312
|
+
* selectAllLabel?: string,
|
|
313
|
+
* showSelectedTag?: boolean,
|
|
314
|
+
* css?: object,
|
|
315
|
+
* helperText?: string,
|
|
316
|
+
* showCounter?: boolean,
|
|
317
|
+
* labelCounter?: string,
|
|
318
|
+
* collapsible?: boolean,
|
|
319
|
+
* toggleInput?: boolean,
|
|
320
|
+
* defaultValue?: string[] | number[],
|
|
321
|
+
* fetchData?: Function,
|
|
322
|
+
* onSearch?: Function,
|
|
323
|
+
* isLoading?: boolean,
|
|
324
|
+
* showTagSelectAll?: boolean,
|
|
325
|
+
* maxSelectedItem?: number,
|
|
326
|
+
* mobileOnly?: boolean,
|
|
327
|
+
* desktopOnly?: boolean,
|
|
328
|
+
* label?: string,
|
|
329
|
+
* tagCss?: object,
|
|
330
|
+
* checkBoxCss?: object,
|
|
331
|
+
* optionListCss?: object,
|
|
332
|
+
* showCollapsibleCounter?: boolean,
|
|
333
|
+
* collapsibleLimit?: number,
|
|
334
|
+
* clearSearchOnSelect?: boolean,
|
|
335
|
+
* onItemClick?: Function,
|
|
336
|
+
* virtualized?: boolean,
|
|
337
|
+
* virtualizedThreshold?: number,
|
|
338
|
+
* locale?: string,
|
|
339
|
+
* localeText?: object,
|
|
340
|
+
* pageIndex?: number,
|
|
341
|
+
* onSelectAllChecked?: Function,
|
|
342
|
+
* totalOptions?: number,
|
|
343
|
+
* [key: string]: any,
|
|
344
|
+
* } & React.RefAttributes<HTMLInputElement>>}
|
|
345
|
+
*/
|
|
346
|
+
forwardRef(({
|
|
292
347
|
placeholder,
|
|
293
348
|
option,
|
|
294
349
|
value,
|
|
@@ -1364,8 +1419,8 @@ InputSelectCheck.propTypes = {
|
|
|
1364
1419
|
virtualized: PropTypes.bool,
|
|
1365
1420
|
virtualizedThreshold: PropTypes.number,
|
|
1366
1421
|
/**
|
|
1367
|
-
* Language the select-all label follows
|
|
1368
|
-
*
|
|
1422
|
+
* Language the select-all label follows (`en` defaults to "Select All"). Falls back to
|
|
1423
|
+
* `MajooProvider`'s `locale`, then `id`.
|
|
1369
1424
|
*/
|
|
1370
1425
|
locale: PropTypes.string,
|
|
1371
1426
|
/**
|
|
@@ -9,22 +9,13 @@ const defaultInputSelectCheckLocaleText = {
|
|
|
9
9
|
emptyDataText: 'Item tidak ditemukan'
|
|
10
10
|
};
|
|
11
11
|
// `en` keeps the English select-all label the component used to pick by language.
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
placeholder: t('placeholder', d.placeholder),
|
|
16
|
-
selectAllLabel: t('selectAllLabelText', locale === 'en' ? 'Select All' : d.selectAllLabel),
|
|
17
|
-
showAllButton: t('showAllText', d.showAllButton),
|
|
18
|
-
showLessButton: t('showSomeText', d.showLessButton),
|
|
19
|
-
counterLabel: t('labelCounterText', d.counterLabel),
|
|
20
|
-
emptyDataText: t('emptyItemText', d.emptyDataText)
|
|
21
|
-
};
|
|
22
|
-
};
|
|
12
|
+
const inputSelectCheckDefaultsFor = locale => locale === 'en' ? Object.assign(Object.assign({}, defaultInputSelectCheckLocaleText), {
|
|
13
|
+
selectAllLabel: 'Select All'
|
|
14
|
+
}) : defaultInputSelectCheckLocaleText;
|
|
23
15
|
/**
|
|
24
16
|
* Resolves the multi-select texts. Precedence: the select's own `localeText`, then `MajooProvider`'s
|
|
25
|
-
* `localeText.inputSelectCheck`, then the
|
|
26
|
-
* Indonesian defaults.
|
|
17
|
+
* `localeText.inputSelectCheck`, then the defaults (Indonesian, except `selectAllLabel` for `en`).
|
|
27
18
|
*/
|
|
28
|
-
const useInputSelectCheckLocaleText = (localeText, locale) => useLocaleText('inputSelectCheck',
|
|
19
|
+
const useInputSelectCheckLocaleText = (localeText, locale) => useLocaleText('inputSelectCheck', inputSelectCheckDefaultsFor, localeText, locale);
|
|
29
20
|
|
|
30
21
|
export { defaultInputSelectCheckLocaleText, useInputSelectCheckLocaleText };
|
|
@@ -3,7 +3,12 @@ import InputSelectCheck from '../InputSelectCheck/InputSelectCheck.esm.js';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
const InputSelectTag =
|
|
6
|
+
const InputSelectTag =
|
|
7
|
+
/*#__PURE__*/
|
|
8
|
+
/**
|
|
9
|
+
* @type {React.ForwardRefExoticComponent<React.ComponentProps<typeof InputSelectCheck>>}
|
|
10
|
+
*/
|
|
11
|
+
React.forwardRef((props, ref) => {
|
|
7
12
|
return /*#__PURE__*/jsx(InputSelectCheck, {
|
|
8
13
|
ref: ref,
|
|
9
14
|
showSelectedTag: true,
|
|
@@ -7,21 +7,10 @@ const defaultInputSignatureLocaleText = {
|
|
|
7
7
|
cancelButton: 'Batal',
|
|
8
8
|
saveButton: 'Simpan'
|
|
9
9
|
};
|
|
10
|
-
const i18nInputSignatureLocaleText = t => {
|
|
11
|
-
const d = defaultInputSignatureLocaleText;
|
|
12
|
-
return {
|
|
13
|
-
placeholder: t('placeholder', d.placeholder),
|
|
14
|
-
addTitle: t('addTitle', d.addTitle),
|
|
15
|
-
editTitle: t('editTitle', d.editTitle),
|
|
16
|
-
cancelButton: t('label.cancel', d.cancelButton),
|
|
17
|
-
saveButton: t('label.save', d.saveButton)
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
10
|
/**
|
|
21
11
|
* Resolves the signature input texts. Precedence: the input's own `localeText`, then `MajooProvider`'s
|
|
22
|
-
* `localeText.inputSignature`, then the
|
|
23
|
-
* defaults.
|
|
12
|
+
* `localeText.inputSignature`, then the Indonesian defaults.
|
|
24
13
|
*/
|
|
25
|
-
const useInputSignatureLocaleText = localeText => useLocaleText('inputSignature',
|
|
14
|
+
const useInputSignatureLocaleText = localeText => useLocaleText('inputSignature', defaultInputSignatureLocaleText, localeText);
|
|
26
15
|
|
|
27
16
|
export { defaultInputSignatureLocaleText, useInputSignatureLocaleText };
|
|
@@ -66,7 +66,21 @@ const StyledSwitch = styled(SwitchPrimitive.Root, {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
-
const InputSwitch =
|
|
69
|
+
const InputSwitch =
|
|
70
|
+
/*#__PURE__*/
|
|
71
|
+
/**
|
|
72
|
+
* @type {React.ForwardRefExoticComponent<{
|
|
73
|
+
* id?: string,
|
|
74
|
+
* disabled?: boolean,
|
|
75
|
+
* dataOnLabel?: string,
|
|
76
|
+
* dataOffLabel?: string,
|
|
77
|
+
* defaultChecked?: boolean,
|
|
78
|
+
* checked?: boolean,
|
|
79
|
+
* onCheckedChange?: (checked: boolean) => void,
|
|
80
|
+
* [key: string]: any,
|
|
81
|
+
* } & React.RefAttributes<HTMLButtonElement>>}
|
|
82
|
+
*/
|
|
83
|
+
React__default.forwardRef(({
|
|
70
84
|
id,
|
|
71
85
|
defaultChecked,
|
|
72
86
|
dataOnLabel,
|
|
@@ -88,7 +88,25 @@ const StyledSwitch = styled(SwitchPrimitive.Root, {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
|
-
const InputSwitchWithImage =
|
|
91
|
+
const InputSwitchWithImage =
|
|
92
|
+
/*#__PURE__*/
|
|
93
|
+
/**
|
|
94
|
+
* @type {React.ForwardRefExoticComponent<{
|
|
95
|
+
* id?: string,
|
|
96
|
+
* disabled?: boolean,
|
|
97
|
+
* dataOnLabel?: string,
|
|
98
|
+
* dataOffLabel?: string,
|
|
99
|
+
* defaultChecked?: boolean,
|
|
100
|
+
* checked?: boolean,
|
|
101
|
+
* onCheckedChange?: (checked: boolean) => void,
|
|
102
|
+
* onImage?: string,
|
|
103
|
+
* offImage?: string,
|
|
104
|
+
* thumbAltOn?: string,
|
|
105
|
+
* thumbAltOff?: string,
|
|
106
|
+
* [key: string]: any,
|
|
107
|
+
* } & React.RefAttributes<HTMLButtonElement>>}
|
|
108
|
+
*/
|
|
109
|
+
React__default.forwardRef(({
|
|
92
110
|
id,
|
|
93
111
|
defaultChecked,
|
|
94
112
|
dataOnLabel,
|
|
@@ -115,7 +115,30 @@ const TagWrapper = styled(Box, {
|
|
|
115
115
|
marginTop: '5px',
|
|
116
116
|
gap: '5px'
|
|
117
117
|
});
|
|
118
|
-
const InputTags =
|
|
118
|
+
const InputTags =
|
|
119
|
+
/*#__PURE__*/
|
|
120
|
+
/**
|
|
121
|
+
* @type {React.ForwardRefExoticComponent<{
|
|
122
|
+
* placeholder?: string,
|
|
123
|
+
* size?: string,
|
|
124
|
+
* value?: string[],
|
|
125
|
+
* onChange?: Function,
|
|
126
|
+
* onRemoveItem?: Function,
|
|
127
|
+
* onEnter?: Function,
|
|
128
|
+
* onInputChange?: Function,
|
|
129
|
+
* max?: number,
|
|
130
|
+
* maxChar?: number,
|
|
131
|
+
* isInvalid?: boolean,
|
|
132
|
+
* disabled?: boolean,
|
|
133
|
+
* unremovableTags?: string[],
|
|
134
|
+
* readOnly?: boolean,
|
|
135
|
+
* helperText?: string,
|
|
136
|
+
* pattern?: { regex: string, errorMessage?: string },
|
|
137
|
+
* css?: object,
|
|
138
|
+
* [key: string]: any,
|
|
139
|
+
* } & React.RefAttributes<HTMLInputElement>>}
|
|
140
|
+
*/
|
|
141
|
+
React__default.forwardRef(function InputTags({
|
|
119
142
|
size,
|
|
120
143
|
isInvalid,
|
|
121
144
|
placeholder,
|
|
@@ -21,7 +21,22 @@ const StyledTextArea = styled(StyledInput, {
|
|
|
21
21
|
size: 'lg'
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
const InputTextArea =
|
|
24
|
+
const InputTextArea =
|
|
25
|
+
/*#__PURE__*/
|
|
26
|
+
/**
|
|
27
|
+
* @type {React.ForwardRefExoticComponent<{
|
|
28
|
+
* placeholder?: string,
|
|
29
|
+
* value?: string,
|
|
30
|
+
* onChange?: Function,
|
|
31
|
+
* disabled?: boolean,
|
|
32
|
+
* readOnly?: boolean,
|
|
33
|
+
* isInvalid?: boolean,
|
|
34
|
+
* size?: string,
|
|
35
|
+
* isPicker?: boolean,
|
|
36
|
+
* [key: string]: any,
|
|
37
|
+
* } & React.RefAttributes<HTMLTextAreaElement>>}
|
|
38
|
+
*/
|
|
39
|
+
React__default.forwardRef(({
|
|
25
40
|
disabled,
|
|
26
41
|
readOnly,
|
|
27
42
|
...props
|
|
@@ -3,13 +3,10 @@ import { useLocaleText } from '../../config/locale/useLocaleText.esm.js';
|
|
|
3
3
|
const defaultImageLocaleText = {
|
|
4
4
|
fallbackTitle: 'Tidak ada foto'
|
|
5
5
|
};
|
|
6
|
-
const i18nImageLocaleText = t => ({
|
|
7
|
-
fallbackTitle: t('fallbackTitle', defaultImageLocaleText.fallbackTitle)
|
|
8
|
-
});
|
|
9
6
|
/**
|
|
10
7
|
* Resolves the image texts. Precedence: the image's own `localeText`, then `MajooProvider`'s
|
|
11
|
-
* `localeText.image`, then the
|
|
8
|
+
* `localeText.image`, then the Indonesian defaults.
|
|
12
9
|
*/
|
|
13
|
-
const useImageLocaleText = localeText => useLocaleText('image',
|
|
10
|
+
const useImageLocaleText = localeText => useLocaleText('image', defaultImageLocaleText, localeText);
|
|
14
11
|
|
|
15
12
|
export { defaultImageLocaleText, useImageLocaleText };
|
|
@@ -99,7 +99,20 @@ const NotificationBadgeStyle = styled('span', {
|
|
|
99
99
|
anchorHorizontal: 'right'
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
-
const NotificationBadge = (
|
|
102
|
+
const NotificationBadge = (
|
|
103
|
+
/**
|
|
104
|
+
* @type {{
|
|
105
|
+
* anchorHorizontal?: 'left' | 'right',
|
|
106
|
+
* anchorVertical?: 'top' | 'bottom',
|
|
107
|
+
* variant?: 'info' | 'important' | 'warning' | 'success' | 'alpha' | 'dot',
|
|
108
|
+
* variantIcon?: 'leading' | 'trailing',
|
|
109
|
+
* value?: number,
|
|
110
|
+
* dot?: boolean,
|
|
111
|
+
* children?: import('react').ReactNode,
|
|
112
|
+
* [key: string]: any,
|
|
113
|
+
* }}
|
|
114
|
+
*/
|
|
115
|
+
{
|
|
103
116
|
children,
|
|
104
117
|
variantIcon,
|
|
105
118
|
variant,
|