@inceptionbg/iui 2.0.35 → 2.0.37
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/dist/index.d.ts +7 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/idea/GridTable/GridTable.tsx +0 -119
- package/idea/GridTable/gridTable.scss +0 -42
- package/idea/Menu/Menu.tsx +0 -121
- package/idea/Menu/MenuItem.tsx +0 -75
- package/idea/Menu/hooks/useMenuControl.ts +0 -13
- package/idea/Menu.tsx +0 -133
- package/idea/NoAccessInfo.tsx +0 -193
- package/idea/Table/Components/Edit/ItemActionsMenu.tsx +0 -85
- package/idea/Table/Components/Edit/ItemEditOptionsButtons.tsx +0 -31
- package/idea/Table/Components/Edit/TableEditRow.tsx +0 -57
- package/idea/Table/Components/FilterItem.tsx +0 -20
- package/idea/Table/Components/Header/TableHeader.tsx +0 -46
- package/idea/Table/Components/Header/TableHeaderRow.tsx +0 -37
- package/idea/Table/Components/Print/CustomTablePrint.tsx +0 -115
- package/idea/Table/Components/SetSortList.tsx +0 -30
- package/idea/Table/Components/SetTableFilter.tsx +0 -91
- package/idea/Table/Components/TableFooter.tsx +0 -137
- package/idea/Table/Components/TableOptions.tsx +0 -227
- package/idea/Table/Components/Templates/TemplateCreate.tsx +0 -80
- package/idea/Table/Components/Templates/TemplateCreateDefault.tsx +0 -45
- package/idea/Table/Components/Templates/TemplateList.tsx +0 -167
- package/idea/Table/Components/Templates/repo/TemplateRepo.ts +0 -53
- package/idea/Table/Table.tsx +0 -528
- package/idea/Table/hooks/useDefaultTemplate.ts +0 -20
- package/idea/Table/hooks/useTableKeyboard.ts +0 -137
- package/idea/Table/hooks/useTableSelect.ts +0 -11
- package/rollup.config.js +0 -52
- package/src/assets/icons/duotone/faBell.ts +0 -17
- package/src/assets/icons/duotone/faCircleUser.ts +0 -17
- package/src/assets/icons/regular/faArrowLeft.ts +0 -15
- package/src/assets/icons/regular/faArrowRightArrowLeft.ts +0 -15
- package/src/assets/icons/regular/faCircleCheck.ts +0 -15
- package/src/assets/icons/regular/faCircleExclamation.ts +0 -15
- package/src/assets/icons/regular/faCircleInfo.ts +0 -15
- package/src/assets/icons/regular/faFileArrowDown.ts +0 -15
- package/src/assets/icons/regular/faFilterCircleXmark.ts +0 -15
- package/src/assets/icons/regular/faTriangleExclamation.ts +0 -15
- package/src/assets/icons/solid/faAngleLeft.ts +0 -15
- package/src/assets/icons/solid/faAngleRight.ts +0 -15
- package/src/assets/icons/solid/faArrowDownWideShort.ts +0 -15
- package/src/assets/icons/solid/faCaretDown.ts +0 -15
- package/src/assets/icons/solid/faCheck.ts +0 -15
- package/src/assets/icons/solid/faEllipsisVertical.ts +0 -15
- package/src/assets/icons/solid/faEnvelopeDot.ts +0 -15
- package/src/assets/icons/solid/faFilter.ts +0 -15
- package/src/assets/icons/solid/faFloppyDisk.ts +0 -15
- package/src/assets/icons/solid/faGripDotsVertical.ts +0 -15
- package/src/assets/icons/solid/faListUl.ts +0 -15
- package/src/assets/icons/solid/faMinus.ts +0 -15
- package/src/assets/icons/solid/faPlus.ts +0 -15
- package/src/assets/icons/solid/faPrint.ts +0 -15
- package/src/assets/icons/solid/faRotateRight.ts +0 -15
- package/src/assets/icons/solid/faXmark.ts +0 -15
- package/src/assets/images/logo/inception.svg +0 -22
- package/src/assets/images/logo/mts.svg +0 -5703
- package/src/assets/images/logo/paperless.svg +0 -21
- package/src/assets/images/logo/pismonosa.png +0 -0
- package/src/assets/images/not-found.svg +0 -19
- package/src/components/Accordions/Accordions.tsx +0 -74
- package/src/components/Alert/Alert.tsx +0 -31
- package/src/components/Badge/DotBadge.tsx +0 -16
- package/src/components/Badge/NotificationBadge.tsx +0 -29
- package/src/components/Badge/PillBadge.tsx +0 -13
- package/src/components/Button/Button.tsx +0 -56
- package/src/components/Button/IconButton.tsx +0 -51
- package/src/components/Button/SplitButton.tsx +0 -91
- package/src/components/Dashboard/Dashboard.tsx +0 -9
- package/src/components/Dashboard/DashboardWidget.tsx +0 -44
- package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +0 -36
- package/src/components/Dialog/Dialog.tsx +0 -178
- package/src/components/Dialog/components/DialogFooter.tsx +0 -100
- package/src/components/Header/Components/EnvBadge.tsx +0 -17
- package/src/components/Header/Components/ModuleSelect.tsx +0 -68
- package/src/components/Header/Components/Notifications.tsx +0 -204
- package/src/components/Header/Components/UserMenu.tsx +0 -52
- package/src/components/Header/Header.tsx +0 -45
- package/src/components/Helper/Collapse.tsx +0 -53
- package/src/components/Inputs/Checkbox.tsx +0 -53
- package/src/components/Inputs/CurrencyInput.tsx +0 -124
- package/src/components/Inputs/DateInput/DateInput.tsx +0 -184
- package/src/components/Inputs/DateInput/components/DatePartInput.tsx +0 -159
- package/src/components/Inputs/InputWrapper.tsx +0 -95
- package/src/components/Inputs/NumberInput.tsx +0 -86
- package/src/components/Inputs/PasswordInput.tsx +0 -39
- package/src/components/Inputs/PhoneInput/PhoneInput.tsx +0 -108
- package/src/components/Inputs/PhoneInput/utils/countryCode.ts +0 -20
- package/src/components/Inputs/Radio.tsx +0 -59
- package/src/components/Inputs/RadioGroup.tsx +0 -48
- package/src/components/Inputs/RadioLarge.tsx +0 -39
- package/src/components/Inputs/SearchInput.tsx +0 -46
- package/src/components/Inputs/Selects/Select.tsx +0 -17
- package/src/components/Inputs/Selects/components/CustomSelectComponents.tsx +0 -19
- package/src/components/Inputs/Selects/components/SelectWrapper.tsx +0 -118
- package/src/components/Inputs/Selects/utils/selectStyles.ts +0 -101
- package/src/components/Inputs/TextAreaInput.tsx +0 -68
- package/src/components/Inputs/TextInput.tsx +0 -100
- package/src/components/Inputs/TimeInput/TimeInput.tsx +0 -81
- package/src/components/List/List.tsx +0 -21
- package/src/components/List/ListItem.tsx +0 -70
- package/src/components/Loader/Loader.tsx +0 -66
- package/src/components/Loader/ProgressBar.tsx +0 -41
- package/src/components/Menu/Menu.tsx +0 -81
- package/src/components/Menu/MenuItem.tsx +0 -46
- package/src/components/Menu/NewMenu.tsx +0 -63
- package/src/components/Menu/hooks/useMenuPosition.tsx +0 -116
- package/src/components/PageComponents/ScrollableContent.tsx +0 -11
- package/src/components/Pullover/Pullover.tsx +0 -197
- package/src/components/Router/Router.tsx +0 -52
- package/src/components/Sidebar/AddButton.tsx +0 -22
- package/src/components/Sidebar/Sidebar.tsx +0 -85
- package/src/components/Sidebar/SidebarItem.tsx +0 -84
- package/src/components/Sidebar/types/ISidebar.ts +0 -28
- package/src/components/Table/Table.tsx +0 -258
- package/src/components/Table/components/columns/ColumnsList.tsx +0 -60
- package/src/components/Table/components/columns/TableColumnsEdit.tsx +0 -114
- package/src/components/Table/components/edit/TableEditRow.tsx +0 -78
- package/src/components/Table/components/filters/FilterItem.tsx +0 -15
- package/src/components/Table/components/filters/TableFilters.tsx +0 -126
- package/src/components/Table/components/footer/TableFooter.tsx +0 -126
- package/src/components/Table/components/header/TableHeader.tsx +0 -40
- package/src/components/Table/components/header/TableHeaderRow.tsx +0 -57
- package/src/components/Table/components/items/TableItemActions.tsx +0 -78
- package/src/components/Table/components/print/TablePrint.tsx +0 -200
- package/src/components/Table/components/select/TableSelect.tsx +0 -50
- package/src/components/Table/components/sort/TableSort.tsx +0 -75
- package/src/components/Table/components/templates/CreateTemplateDialog.tsx +0 -58
- package/src/components/Table/components/templates/TableTemplates.tsx +0 -65
- package/src/components/Table/components/templates/TemplatesPullover.tsx +0 -88
- package/src/components/Table/contexts/TableContext.tsx +0 -117
- package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +0 -70
- package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +0 -82
- package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +0 -175
- package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +0 -12
- package/src/components/Table/hooks/useTableColumns.ts +0 -34
- package/src/components/Table/hooks/useTableEdit.tsx +0 -140
- package/src/components/Table/hooks/useTableFilterFields.tsx +0 -150
- package/src/components/Table/hooks/useTablePagination.ts +0 -19
- package/src/components/Table/hooks/useTablePrint.ts +0 -83
- package/src/components/Table/hooks/useTableSearch.ts +0 -31
- package/src/components/Table/hooks/useTableSelect.ts +0 -19
- package/src/components/Table/hooks/useTableSort.ts +0 -8
- package/src/components/Tabs/Tabs.tsx +0 -68
- package/src/components/Tooltip/Tooltip.tsx +0 -191
- package/src/components/Tree/Tree.tsx +0 -22
- package/src/components/Tree/TreeItem.tsx +0 -57
- package/src/components/Wrappers/AppLayout.tsx +0 -17
- package/src/components/Wrappers/ConditionalWrapper.tsx +0 -10
- package/src/components/Wrappers/FormWrapper.tsx +0 -84
- package/src/components/Wrappers/PageLayout.tsx +0 -168
- package/src/hooks/useBackgroundClose.ts +0 -19
- package/src/hooks/useGetFocusableElements.ts +0 -43
- package/src/hooks/useIsMenuOpen.ts +0 -11
- package/src/hooks/useLocalPopoverControl.ts +0 -63
- package/src/hooks/useOnEsc.ts +0 -14
- package/src/hooks/usePopupControl.ts +0 -22
- package/src/hooks/useZendesk.ts +0 -22
- package/src/index.ts +0 -387
- package/src/pages/NoAccessPage.tsx +0 -27
- package/src/pages/NotFoundPage.tsx +0 -26
- package/src/styles/App.scss +0 -47
- package/src/styles/common/_animations.scss +0 -58
- package/src/styles/common/_typography.scss +0 -91
- package/src/styles/common/helpers/_base.scss +0 -55
- package/src/styles/common/helpers/_color.scss +0 -10
- package/src/styles/common/helpers/_display.scss +0 -85
- package/src/styles/common/helpers/_size.scss +0 -25
- package/src/styles/common/maps/_align.scss +0 -21
- package/src/styles/common/maps/_buttonMaps.scss +0 -42
- package/src/styles/common/maps/_info-types.scss +0 -1
- package/src/styles/common/maps/_spacing.scss +0 -78
- package/src/styles/common/maps/_text.scss +0 -14
- package/src/styles/components/_accordions.scss +0 -51
- package/src/styles/components/_alert.scss +0 -23
- package/src/styles/components/_badge.scss +0 -84
- package/src/styles/components/_button.scss +0 -99
- package/src/styles/components/_buttonSplit.scss +0 -74
- package/src/styles/components/_card.scss +0 -24
- package/src/styles/components/_dialog.scss +0 -119
- package/src/styles/components/_form.scss +0 -8
- package/src/styles/components/_header.scss +0 -157
- package/src/styles/components/_input.scss +0 -167
- package/src/styles/components/_inputCheckbox.scss +0 -48
- package/src/styles/components/_inputDateTime.scss +0 -161
- package/src/styles/components/_inputRadio.scss +0 -83
- package/src/styles/components/_inputSelect.scss +0 -8
- package/src/styles/components/_list.scss +0 -58
- package/src/styles/components/_loader.scss +0 -55
- package/src/styles/components/_menu-v2.scss +0 -67
- package/src/styles/components/_menu.scss +0 -62
- package/src/styles/components/_notifications.scss +0 -71
- package/src/styles/components/_page.scss +0 -84
- package/src/styles/components/_portal.scss +0 -8
- package/src/styles/components/_print.scss +0 -77
- package/src/styles/components/_progressBar.scss +0 -83
- package/src/styles/components/_pullover.scss +0 -95
- package/src/styles/components/_scrollbar.scss +0 -18
- package/src/styles/components/_sidebar.scss +0 -204
- package/src/styles/components/_smallComponents.scss +0 -23
- package/src/styles/components/_table.scss +0 -340
- package/src/styles/components/_tabs.scss +0 -33
- package/src/styles/components/_tooltip.scss +0 -48
- package/src/styles/components/_tree.scss +0 -21
- package/src/styles/components/_widget.scss +0 -90
- package/src/styles/pages/_fullScreenPage.scss +0 -64
- package/src/styles/variables/_bp.scss +0 -6
- package/src/styles/variables/_variables.scss +0 -142
- package/src/types/Base/custom.d.ts +0 -9
- package/src/types/IBasic.ts +0 -32
- package/src/types/ICountryCode.ts +0 -5
- package/src/types/IError.ts +0 -5
- package/src/types/IHeader.ts +0 -40
- package/src/types/IInfo.ts +0 -1
- package/src/types/IKeyboard.ts +0 -33
- package/src/types/IMenu.ts +0 -19
- package/src/types/INotifications.ts +0 -15
- package/src/types/IPopup.ts +0 -17
- package/src/types/IRouter.ts +0 -6
- package/src/types/ISelect.ts +0 -54
- package/src/types/ITab.ts +0 -10
- package/src/types/ITable.ts +0 -291
- package/src/types/ITree.ts +0 -6
- package/src/utils/InputPatternValidation.ts +0 -12
- package/src/utils/dateUtils.ts +0 -32
- package/src/utils/fileUtils.ts +0 -177
- package/src/utils/i18n/i18nIUICyrilic.ts +0 -119
- package/src/utils/i18n/i18nIUILatin.ts +0 -120
- package/src/utils/i18n/i18nIUIMe.ts +0 -118
- package/src/utils/icons.ts +0 -13
- package/src/utils/localStorageHelper.ts +0 -24
- package/src/utils/logoUtils.ts +0 -7
- package/src/utils/numberUtils.ts +0 -21
- package/src/utils/objectUtils.ts +0 -114
- package/src/utils/popupUtils.ts +0 -82
- package/src/utils/rootDir.ts +0 -1
- package/src/utils/stringUtils.ts +0 -18
- package/src/utils/tableUtils.ts +0 -130
- package/src/utils/toasts.ts +0 -6
- package/src/utils/urlUtils.ts +0 -4
- package/tsconfig.icons.json +0 -5
- package/tsconfig.json +0 -22
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { ChangeEvent, FC, Ref } from 'react';
|
|
2
|
-
import type { ISelectData } from '../../../types/ISelect';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import ReactSelect from 'react-select';
|
|
7
|
-
import { InputWrapper } from '../InputWrapper';
|
|
8
|
-
import { CustomSelectComponents } from '../Selects/components/CustomSelectComponents';
|
|
9
|
-
import { createSelectStyles } from '../Selects/utils/selectStyles';
|
|
10
|
-
import { countryCodeObj, countryCodeOptions } from './utils/countryCode';
|
|
11
|
-
|
|
12
|
-
interface Props {
|
|
13
|
-
label?: string;
|
|
14
|
-
value?: string;
|
|
15
|
-
setValue: (value: string) => void;
|
|
16
|
-
helperText?: string;
|
|
17
|
-
placeholder?: string;
|
|
18
|
-
required?: boolean;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
className?: string;
|
|
21
|
-
ref?: Ref<HTMLInputElement>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const PhoneInput: FC<Props> = ({
|
|
25
|
-
label,
|
|
26
|
-
value,
|
|
27
|
-
setValue,
|
|
28
|
-
helperText,
|
|
29
|
-
placeholder = '6x 123 4567',
|
|
30
|
-
required = false,
|
|
31
|
-
disabled = false,
|
|
32
|
-
className,
|
|
33
|
-
ref,
|
|
34
|
-
}) => {
|
|
35
|
-
const [code, setCode] = useState('+381');
|
|
36
|
-
const [number, setNumber] = useState('');
|
|
37
|
-
|
|
38
|
-
const { t } = useTranslation();
|
|
39
|
-
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (value && value !== `${code}${number}`) {
|
|
42
|
-
let tempValue = value;
|
|
43
|
-
if (value.startsWith('0')) {
|
|
44
|
-
tempValue = `+381${value.slice(1)}`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const valueCode = tempValue.slice(0, 4);
|
|
48
|
-
const valueNumber = tempValue.slice(4);
|
|
49
|
-
setCode(countryCodeObj[valueCode]?.phonePrefix ?? code);
|
|
50
|
-
setNumber(valueNumber);
|
|
51
|
-
}
|
|
52
|
-
}, [code, value, number]);
|
|
53
|
-
|
|
54
|
-
const setValueHandler = (e: ChangeEvent<HTMLInputElement>) => {
|
|
55
|
-
const { value } = e.target;
|
|
56
|
-
|
|
57
|
-
if (!value) {
|
|
58
|
-
setNumber('');
|
|
59
|
-
setValue('');
|
|
60
|
-
} else if (new RegExp(`^\\d*$`).test(value) && value !== '0') {
|
|
61
|
-
setNumber(value);
|
|
62
|
-
setValue(`${code}${value}`);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<InputWrapper
|
|
68
|
-
label={label}
|
|
69
|
-
required={required}
|
|
70
|
-
disabled={disabled}
|
|
71
|
-
helperText={helperText}
|
|
72
|
-
errorText={t('PhoneValidation')}
|
|
73
|
-
className={clsx('select-wrapper', className)}
|
|
74
|
-
minWidth={200}
|
|
75
|
-
>
|
|
76
|
-
<div className="phone-input">
|
|
77
|
-
<ReactSelect
|
|
78
|
-
required={required}
|
|
79
|
-
isDisabled={disabled}
|
|
80
|
-
value={code ? { value: code, label: code } : null}
|
|
81
|
-
onChange={input => {
|
|
82
|
-
const inputValue = (input as ISelectData)?.value;
|
|
83
|
-
setCode(inputValue);
|
|
84
|
-
setValue(number ? `${inputValue}${number}` : '');
|
|
85
|
-
}}
|
|
86
|
-
className="phone-code-input"
|
|
87
|
-
options={countryCodeOptions(t)}
|
|
88
|
-
isClearable={false}
|
|
89
|
-
styles={createSelectStyles({ menuWidth: 200, fontSize: 16, size: 'm' })}
|
|
90
|
-
components={CustomSelectComponents}
|
|
91
|
-
menuPortalTarget={document.querySelector('body')}
|
|
92
|
-
/>
|
|
93
|
-
<input
|
|
94
|
-
ref={ref}
|
|
95
|
-
placeholder={placeholder}
|
|
96
|
-
value={number || ''}
|
|
97
|
-
onChange={setValueHandler}
|
|
98
|
-
required={required}
|
|
99
|
-
disabled={disabled}
|
|
100
|
-
pattern={`^\\d{8,10}$`}
|
|
101
|
-
spellCheck={false}
|
|
102
|
-
lang="sr-RS"
|
|
103
|
-
inputMode="numeric"
|
|
104
|
-
/>
|
|
105
|
-
</div>
|
|
106
|
-
</InputWrapper>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { TFunction } from 'i18next';
|
|
2
|
-
import type { ICountryCode } from '../../../../types/ICountryCode';
|
|
3
|
-
|
|
4
|
-
export const countryCodes = [
|
|
5
|
-
{ name: 'Serbia', code: 'RS', phonePrefix: '+381' },
|
|
6
|
-
{ name: 'Montenegro', code: 'ME', phonePrefix: '+382' },
|
|
7
|
-
];
|
|
8
|
-
|
|
9
|
-
export const countryCodeObj: Record<string, ICountryCode> = Object.entries(
|
|
10
|
-
countryCodes
|
|
11
|
-
).reduce((acc: Record<string, ICountryCode>, [, value]) => {
|
|
12
|
-
acc[value.phonePrefix] = value;
|
|
13
|
-
return acc;
|
|
14
|
-
}, {});
|
|
15
|
-
|
|
16
|
-
export const countryCodeOptions = (t: TFunction) =>
|
|
17
|
-
countryCodes.map(item => ({
|
|
18
|
-
label: `${t(item.name)} (${item.phonePrefix})`,
|
|
19
|
-
value: item.phonePrefix,
|
|
20
|
-
}));
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { FC, ReactNode, Ref } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
|
|
4
|
-
export interface IRadioProps {
|
|
5
|
-
label?: string;
|
|
6
|
-
desc?: string;
|
|
7
|
-
value: string | number | boolean;
|
|
8
|
-
selected: string | number | boolean | undefined | null;
|
|
9
|
-
setSelected: (selected: any) => void;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
groupName?: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
className?: string;
|
|
14
|
-
children?: ReactNode;
|
|
15
|
-
ref?: Ref<HTMLDivElement>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Radio: FC<IRadioProps> = ({
|
|
19
|
-
label,
|
|
20
|
-
desc,
|
|
21
|
-
value,
|
|
22
|
-
selected,
|
|
23
|
-
setSelected,
|
|
24
|
-
required,
|
|
25
|
-
groupName,
|
|
26
|
-
disabled,
|
|
27
|
-
className,
|
|
28
|
-
children,
|
|
29
|
-
ref,
|
|
30
|
-
}) => (
|
|
31
|
-
<div
|
|
32
|
-
ref={ref}
|
|
33
|
-
className={clsx(
|
|
34
|
-
'iui-radio',
|
|
35
|
-
className,
|
|
36
|
-
selected === value ? 'selected' : 'clickable',
|
|
37
|
-
{ disabled }
|
|
38
|
-
)}
|
|
39
|
-
onClick={selected !== value && !disabled ? () => setSelected(value) : undefined}
|
|
40
|
-
>
|
|
41
|
-
<div className={clsx('icon', { selected: selected === value })}>
|
|
42
|
-
<div className="dot" />
|
|
43
|
-
{required && !disabled && !selected && (
|
|
44
|
-
<input
|
|
45
|
-
className="fake-input"
|
|
46
|
-
type="radio"
|
|
47
|
-
name={groupName}
|
|
48
|
-
required
|
|
49
|
-
tabIndex={-1}
|
|
50
|
-
// onFocus={() => ref?.current?.focus()}
|
|
51
|
-
/>
|
|
52
|
-
)}
|
|
53
|
-
</div>
|
|
54
|
-
<div className="radio-content">
|
|
55
|
-
{label ? <p className="label">{label}</p> : children}
|
|
56
|
-
{desc && <p className="desc">{desc}</p>}
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { Radio } from './Radio';
|
|
4
|
-
|
|
5
|
-
interface IRadioGroupProps {
|
|
6
|
-
name: string;
|
|
7
|
-
items: {
|
|
8
|
-
value: string;
|
|
9
|
-
label: string;
|
|
10
|
-
desc?: string;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
hidden?: boolean;
|
|
13
|
-
}[];
|
|
14
|
-
selected: string | number | boolean | undefined | null;
|
|
15
|
-
setSelected: (selected: any) => void;
|
|
16
|
-
required?: boolean;
|
|
17
|
-
align?: 'column' | 'row';
|
|
18
|
-
className?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const RadioGroup: FC<IRadioGroupProps> = ({
|
|
22
|
-
name,
|
|
23
|
-
items,
|
|
24
|
-
selected,
|
|
25
|
-
setSelected,
|
|
26
|
-
required,
|
|
27
|
-
align = 'column',
|
|
28
|
-
className,
|
|
29
|
-
}) => (
|
|
30
|
-
<div className={clsx('radio-group', align, className)}>
|
|
31
|
-
{items.map(
|
|
32
|
-
e =>
|
|
33
|
-
!e.hidden && (
|
|
34
|
-
<Radio
|
|
35
|
-
key={e.value}
|
|
36
|
-
label={e.label}
|
|
37
|
-
desc={e.desc}
|
|
38
|
-
value={e.value}
|
|
39
|
-
disabled={e.disabled}
|
|
40
|
-
required={required}
|
|
41
|
-
groupName={name}
|
|
42
|
-
selected={selected}
|
|
43
|
-
setSelected={setSelected}
|
|
44
|
-
/>
|
|
45
|
-
)
|
|
46
|
-
)}
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { Dispatch, FC, ReactElement, ReactNode, SetStateAction } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { Radio } from './Radio';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
title?: string | ReactElement;
|
|
7
|
-
desc?: string | ReactElement;
|
|
8
|
-
value: string;
|
|
9
|
-
selected: string;
|
|
10
|
-
setSelected: Dispatch<SetStateAction<any>>;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
className?: string;
|
|
13
|
-
children?: ReactNode;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const RadioLarge: FC<Props> = ({
|
|
17
|
-
title,
|
|
18
|
-
desc,
|
|
19
|
-
value,
|
|
20
|
-
selected,
|
|
21
|
-
setSelected,
|
|
22
|
-
disabled,
|
|
23
|
-
className,
|
|
24
|
-
children,
|
|
25
|
-
}) => (
|
|
26
|
-
<Radio
|
|
27
|
-
value={value}
|
|
28
|
-
selected={selected}
|
|
29
|
-
setSelected={setSelected}
|
|
30
|
-
disabled={disabled}
|
|
31
|
-
className={clsx('radio-large', className)}
|
|
32
|
-
>
|
|
33
|
-
<div className="full-width">
|
|
34
|
-
<p className="bold mb-3">{title}</p>
|
|
35
|
-
<p>{desc}</p>
|
|
36
|
-
<div>{children}</div>
|
|
37
|
-
</div>
|
|
38
|
-
</Radio>
|
|
39
|
-
);
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { FC, Ref } from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { faMagnifyingGlass } from '@inceptionbg/icons';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { TextInput } from './TextInput';
|
|
6
|
-
|
|
7
|
-
interface IProps {
|
|
8
|
-
label?: string;
|
|
9
|
-
onSearch: (searchText: string) => void;
|
|
10
|
-
className?: string;
|
|
11
|
-
ref?: Ref<HTMLInputElement>;
|
|
12
|
-
}
|
|
13
|
-
export const SearchInput: FC<IProps> = ({ label, onSearch, className, ref }) => {
|
|
14
|
-
const [text, setText] = useState('');
|
|
15
|
-
const { t } = useTranslation();
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<TextInput
|
|
19
|
-
ref={ref}
|
|
20
|
-
className={className}
|
|
21
|
-
inputProps={{
|
|
22
|
-
'aria-label': 'search',
|
|
23
|
-
onKeyDown: (e: any) => {
|
|
24
|
-
if (e.key === 'Enter') {
|
|
25
|
-
e.stopPropagation();
|
|
26
|
-
e.preventDefault();
|
|
27
|
-
onSearch(e.target.value);
|
|
28
|
-
} else if (e.key === 'Escape') {
|
|
29
|
-
!!text && e.stopPropagation();
|
|
30
|
-
setText('');
|
|
31
|
-
onSearch('');
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
}}
|
|
35
|
-
label={label}
|
|
36
|
-
placeholder={t('Search')}
|
|
37
|
-
value={text}
|
|
38
|
-
setValue={setText}
|
|
39
|
-
onClear={() => onSearch('')}
|
|
40
|
-
endButton={{
|
|
41
|
-
icon: faMagnifyingGlass,
|
|
42
|
-
onClick: () => onSearch(text),
|
|
43
|
-
}}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
AsyncSelectProps,
|
|
4
|
-
BasicSelectProps,
|
|
5
|
-
CreatableSelectProps,
|
|
6
|
-
} from '../../../types/ISelect';
|
|
7
|
-
import { SelectWrapper } from './components/SelectWrapper';
|
|
8
|
-
|
|
9
|
-
export const Select: FC<Omit<BasicSelectProps, 'variant'>> = props => (
|
|
10
|
-
<SelectWrapper {...props} variant="basic" />
|
|
11
|
-
);
|
|
12
|
-
export const SelectAsyncPaginate: FC<Omit<AsyncSelectProps, 'variant'>> = props => (
|
|
13
|
-
<SelectWrapper {...props} variant="async" />
|
|
14
|
-
);
|
|
15
|
-
export const SelectCreatable: FC<Omit<CreatableSelectProps, 'variant'>> = props => (
|
|
16
|
-
<SelectWrapper {...props} variant="async-creatable" />
|
|
17
|
-
);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { GroupBase, SelectComponentsConfig } from 'react-select';
|
|
2
|
-
import { faChevronDown, faCircleXmark } from '@inceptionbg/icons';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
-
import { components } from 'react-select';
|
|
5
|
-
|
|
6
|
-
export const CustomSelectComponents: Partial<
|
|
7
|
-
SelectComponentsConfig<unknown, boolean, GroupBase<unknown>>
|
|
8
|
-
> = {
|
|
9
|
-
DropdownIndicator: props => (
|
|
10
|
-
<components.DropdownIndicator {...props}>
|
|
11
|
-
<FontAwesomeIcon icon={faChevronDown} className="icon" />
|
|
12
|
-
</components.DropdownIndicator>
|
|
13
|
-
),
|
|
14
|
-
ClearIndicator: props => (
|
|
15
|
-
<components.ClearIndicator {...props}>
|
|
16
|
-
<FontAwesomeIcon icon={faCircleXmark} className="icon" />
|
|
17
|
-
</components.ClearIndicator>
|
|
18
|
-
),
|
|
19
|
-
};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AsyncSelectProps,
|
|
3
|
-
BasicSelectProps,
|
|
4
|
-
CreatableSelectProps,
|
|
5
|
-
} from '../../../../types/ISelect';
|
|
6
|
-
import { forwardRef, useRef } from 'react';
|
|
7
|
-
import clsx from 'clsx';
|
|
8
|
-
import { useTranslation } from 'react-i18next';
|
|
9
|
-
import ReactSelect from 'react-select';
|
|
10
|
-
import { AsyncPaginate } from 'react-select-async-paginate';
|
|
11
|
-
import AsyncCreatableSelect from 'react-select/async-creatable';
|
|
12
|
-
import { InputWrapper } from '../../InputWrapper';
|
|
13
|
-
import { createSelectStyles } from '../utils/selectStyles';
|
|
14
|
-
import { CustomSelectComponents } from './CustomSelectComponents';
|
|
15
|
-
|
|
16
|
-
export type ISelectProps = BasicSelectProps | AsyncSelectProps | CreatableSelectProps;
|
|
17
|
-
|
|
18
|
-
export const SelectWrapper = forwardRef<any, ISelectProps>((props, forwardedRef) => {
|
|
19
|
-
const ref = useRef(null);
|
|
20
|
-
const { t } = useTranslation();
|
|
21
|
-
|
|
22
|
-
const {
|
|
23
|
-
variant,
|
|
24
|
-
label,
|
|
25
|
-
required,
|
|
26
|
-
disabled,
|
|
27
|
-
helperText,
|
|
28
|
-
error,
|
|
29
|
-
errorText,
|
|
30
|
-
className,
|
|
31
|
-
minWidth,
|
|
32
|
-
menuWidth,
|
|
33
|
-
value,
|
|
34
|
-
isMulti,
|
|
35
|
-
onChange,
|
|
36
|
-
placeholder = `${t('Choose')}...`,
|
|
37
|
-
isClearable = true,
|
|
38
|
-
isOpen,
|
|
39
|
-
onMenuOpen,
|
|
40
|
-
onMenuClose,
|
|
41
|
-
openDirection = 'auto',
|
|
42
|
-
formatOptionLabel,
|
|
43
|
-
autoFocus,
|
|
44
|
-
closeMenuOnSelect,
|
|
45
|
-
noOptionsMessage,
|
|
46
|
-
size,
|
|
47
|
-
} = props;
|
|
48
|
-
|
|
49
|
-
const commonProps = {
|
|
50
|
-
value: value ?? (isMulti ? [] : null),
|
|
51
|
-
components: CustomSelectComponents,
|
|
52
|
-
onChange,
|
|
53
|
-
placeholder,
|
|
54
|
-
styles: createSelectStyles({ menuWidth, fontSize: size === 's' ? 12 : 16, size }),
|
|
55
|
-
isDisabled: disabled,
|
|
56
|
-
isOptionDisabled: (option: any) => option.disabled,
|
|
57
|
-
isClearable,
|
|
58
|
-
isMulti,
|
|
59
|
-
menuIsOpen: isOpen,
|
|
60
|
-
menuPlacement: openDirection,
|
|
61
|
-
menuPortalTarget: document.querySelector('body'),
|
|
62
|
-
ref: forwardedRef ?? ref,
|
|
63
|
-
autoFocus,
|
|
64
|
-
noOptionsMessage: () => noOptionsMessage || 'Nema opcija',
|
|
65
|
-
onMenuOpen,
|
|
66
|
-
onMenuClose,
|
|
67
|
-
closeMenuOnSelect: closeMenuOnSelect ?? !isMulti,
|
|
68
|
-
formatOptionLabel,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<InputWrapper
|
|
73
|
-
label={label}
|
|
74
|
-
required={required}
|
|
75
|
-
disabled={disabled}
|
|
76
|
-
helperText={helperText}
|
|
77
|
-
error={error}
|
|
78
|
-
errorText={errorText}
|
|
79
|
-
className={clsx('select-wrapper', size, className)}
|
|
80
|
-
minWidth={minWidth}
|
|
81
|
-
heightAuto
|
|
82
|
-
>
|
|
83
|
-
{variant === 'async' ? (
|
|
84
|
-
<AsyncPaginate
|
|
85
|
-
{...commonProps}
|
|
86
|
-
loadOptions={props.loadOptions}
|
|
87
|
-
defaultOptions={props.defaultData ?? false}
|
|
88
|
-
cacheUniqs={props.refresh}
|
|
89
|
-
/>
|
|
90
|
-
) : variant === 'async-creatable' ? (
|
|
91
|
-
<AsyncCreatableSelect
|
|
92
|
-
{...commonProps}
|
|
93
|
-
loadOptions={props.loadOptions}
|
|
94
|
-
defaultOptions={props.defaultData ?? false}
|
|
95
|
-
onCreateOption={props.onCreate}
|
|
96
|
-
formatCreateLabel={(inputValue: string) => (
|
|
97
|
-
<p>{`${t('FreeText')} "${inputValue}"`}</p>
|
|
98
|
-
)}
|
|
99
|
-
/>
|
|
100
|
-
) : (
|
|
101
|
-
<ReactSelect {...commonProps} options={props.options} />
|
|
102
|
-
)}
|
|
103
|
-
{required && !disabled && (
|
|
104
|
-
<input
|
|
105
|
-
className="fake-input"
|
|
106
|
-
required
|
|
107
|
-
tabIndex={-1}
|
|
108
|
-
autoComplete="off"
|
|
109
|
-
value={(isMulti ? commonProps.value[0]?.value : commonProps.value?.value) ?? ''}
|
|
110
|
-
onChange={() => {}}
|
|
111
|
-
// onFocus={() =>
|
|
112
|
-
// ((forwardedRef as MutableRefObject<any>) ?? ref).current?.focus()
|
|
113
|
-
// }
|
|
114
|
-
/>
|
|
115
|
-
)}
|
|
116
|
-
</InputWrapper>
|
|
117
|
-
);
|
|
118
|
-
});
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { StylesConfig } from 'react-select';
|
|
2
|
-
|
|
3
|
-
export const createSelectStyles = ({
|
|
4
|
-
fontSize = 16,
|
|
5
|
-
menuWidth,
|
|
6
|
-
size,
|
|
7
|
-
}: {
|
|
8
|
-
fontSize?: number;
|
|
9
|
-
size?: 's' | 'm';
|
|
10
|
-
menuWidth?: 'fit-content' | 'max-content' | number;
|
|
11
|
-
}) =>
|
|
12
|
-
({
|
|
13
|
-
control: provided => ({
|
|
14
|
-
...provided,
|
|
15
|
-
border: 'none',
|
|
16
|
-
borderWidth: 0,
|
|
17
|
-
boxShadow: 'none',
|
|
18
|
-
width: '100%',
|
|
19
|
-
minHeight: size === 's' ? 12 : 36,
|
|
20
|
-
}),
|
|
21
|
-
container: provided => ({
|
|
22
|
-
...provided,
|
|
23
|
-
width: '100%',
|
|
24
|
-
}),
|
|
25
|
-
valueContainer: provided => ({
|
|
26
|
-
...provided,
|
|
27
|
-
fontSize,
|
|
28
|
-
padding: size === 's' ? '0 4px 0 8px' : '6px 0 6px 12px',
|
|
29
|
-
gap: 4,
|
|
30
|
-
width: '100%',
|
|
31
|
-
}),
|
|
32
|
-
singleValue: provided => ({
|
|
33
|
-
...provided,
|
|
34
|
-
margin: 0,
|
|
35
|
-
}),
|
|
36
|
-
multiValue: provided => ({
|
|
37
|
-
...provided,
|
|
38
|
-
backgroundColor: 'unset',
|
|
39
|
-
border: '1px solid var(--neutral-300)',
|
|
40
|
-
borderRadius: 8,
|
|
41
|
-
margin: 0,
|
|
42
|
-
overflow: 'hidden',
|
|
43
|
-
}),
|
|
44
|
-
multiValueLabel: (provided, state) => ({
|
|
45
|
-
...provided,
|
|
46
|
-
padding: state.isDisabled ? '4px 8px' : provided.padding,
|
|
47
|
-
}),
|
|
48
|
-
multiValueRemove: (provided, state) => ({
|
|
49
|
-
...provided,
|
|
50
|
-
display: state.isDisabled ? 'none' : provided.display,
|
|
51
|
-
boxSizing: 'content-box',
|
|
52
|
-
color: 'var(--text-disabled)',
|
|
53
|
-
}),
|
|
54
|
-
menu: provided => ({
|
|
55
|
-
...provided,
|
|
56
|
-
width: menuWidth || '100%',
|
|
57
|
-
minWidth: '100%',
|
|
58
|
-
borderRadius: 8,
|
|
59
|
-
boxShadow: `0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgba(0, 0, 0, 0.14),
|
|
60
|
-
0px 3px 14px 2px rgba(0, 0, 0, 0.12);`,
|
|
61
|
-
}),
|
|
62
|
-
menuPortal: provided => ({ ...provided, zIndex: 1001 }),
|
|
63
|
-
input: provided => ({
|
|
64
|
-
...provided,
|
|
65
|
-
padding: 0,
|
|
66
|
-
margin: 0,
|
|
67
|
-
}),
|
|
68
|
-
option: (provided, state) => ({
|
|
69
|
-
...provided,
|
|
70
|
-
fontSize,
|
|
71
|
-
padding: size === 's' ? 4 : provided.padding,
|
|
72
|
-
backgroundColor: state.isSelected
|
|
73
|
-
? 'var(--primary) !important'
|
|
74
|
-
: state.isFocused
|
|
75
|
-
? '#eee !important'
|
|
76
|
-
: 'inherit',
|
|
77
|
-
}),
|
|
78
|
-
noOptionsMessage: provided => ({
|
|
79
|
-
...provided,
|
|
80
|
-
fontSize,
|
|
81
|
-
fontStyle: 'italic',
|
|
82
|
-
textAlign: 'left',
|
|
83
|
-
cursor: 'default',
|
|
84
|
-
}),
|
|
85
|
-
placeholder: provided => ({
|
|
86
|
-
...provided,
|
|
87
|
-
whiteSpace: 'nowrap',
|
|
88
|
-
fontStyle: 'italic',
|
|
89
|
-
color: '#00000050',
|
|
90
|
-
fontWeight: 400,
|
|
91
|
-
userSelect: 'none',
|
|
92
|
-
margin: 0,
|
|
93
|
-
}),
|
|
94
|
-
indicatorSeparator: () => ({ display: 'none' }),
|
|
95
|
-
dropdownIndicator: (provided, state) => ({
|
|
96
|
-
...provided,
|
|
97
|
-
padding: size === 's' ? '4px' : provided.padding,
|
|
98
|
-
transition: 'all .2s ease',
|
|
99
|
-
transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : null,
|
|
100
|
-
}),
|
|
101
|
-
}) as StylesConfig;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { FC, InputHTMLAttributes, Ref } from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { InputWrapper } from './InputWrapper';
|
|
5
|
-
|
|
6
|
-
export interface ITextAreaInputProps {
|
|
7
|
-
label: string;
|
|
8
|
-
value?: string;
|
|
9
|
-
setValue: (value: string) => void;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
autoFocus?: boolean;
|
|
13
|
-
rows?: number;
|
|
14
|
-
resize?: boolean;
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
helperText?: string;
|
|
17
|
-
errorText?: string;
|
|
18
|
-
className?: string;
|
|
19
|
-
inputProps?: InputHTMLAttributes<HTMLTextAreaElement>;
|
|
20
|
-
error?: boolean;
|
|
21
|
-
ref?: Ref<HTMLTextAreaElement>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const TextAreaInput: FC<ITextAreaInputProps> = ({
|
|
25
|
-
label,
|
|
26
|
-
value,
|
|
27
|
-
setValue,
|
|
28
|
-
required,
|
|
29
|
-
disabled,
|
|
30
|
-
autoFocus,
|
|
31
|
-
rows = 4,
|
|
32
|
-
resize,
|
|
33
|
-
placeholder,
|
|
34
|
-
helperText,
|
|
35
|
-
errorText,
|
|
36
|
-
className,
|
|
37
|
-
inputProps,
|
|
38
|
-
error,
|
|
39
|
-
ref,
|
|
40
|
-
}) => {
|
|
41
|
-
const [isAutoFill, setIsAutoFill] = useState(false);
|
|
42
|
-
return (
|
|
43
|
-
<InputWrapper
|
|
44
|
-
label={label}
|
|
45
|
-
required={required}
|
|
46
|
-
helperText={helperText}
|
|
47
|
-
errorText={errorText}
|
|
48
|
-
className={className}
|
|
49
|
-
error={error}
|
|
50
|
-
heightAuto
|
|
51
|
-
>
|
|
52
|
-
<textarea
|
|
53
|
-
ref={ref}
|
|
54
|
-
autoFocus={autoFocus}
|
|
55
|
-
onFocus={() => isAutoFill && setIsAutoFill(false)}
|
|
56
|
-
className={clsx({ resize })}
|
|
57
|
-
placeholder={required && placeholder ? `${placeholder} *` : placeholder}
|
|
58
|
-
value={value || ''}
|
|
59
|
-
onChange={e => setValue(e.target.value)}
|
|
60
|
-
rows={rows}
|
|
61
|
-
required={required}
|
|
62
|
-
disabled={disabled}
|
|
63
|
-
onAnimationStart={() => setIsAutoFill(true)}
|
|
64
|
-
{...inputProps}
|
|
65
|
-
/>
|
|
66
|
-
</InputWrapper>
|
|
67
|
-
);
|
|
68
|
-
};
|