@registrucentras/rc-ses-react-components 2.1.0 → 2.2.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/dist/components/form/inputs/Select/Select.utils.d.ts +9 -0
- package/dist/components/form/inputs/Select/components/OptionCheckbox.d.ts +5 -0
- package/dist/components/form/inputs/Select/index.d.ts +18 -8
- package/dist/components/overlays/BottomSheet/index.d.ts +17 -0
- package/dist/components/overlays/BottomSheet/useSwipeToDismiss.d.ts +17 -0
- package/dist/library/index.d.ts +2 -1
- package/dist/library/types.d.ts +2 -0
- package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
- package/dist/registrucentras-rc-ses-react-components.js +3492 -3081
- package/package.json +1 -1
- package/src/components/form/inputs/Select/Select.utils.ts +24 -0
- package/src/components/form/inputs/Select/components/OptionCheckbox.tsx +46 -0
- package/src/components/form/inputs/Select/index.test.tsx +127 -0
- package/src/components/form/inputs/Select/index.tsx +426 -181
- package/src/components/overlays/BottomSheet/index.test.tsx +256 -0
- package/src/components/overlays/BottomSheet/index.tsx +242 -0
- package/src/components/overlays/BottomSheet/useSwipeToDismiss.test.ts +295 -0
- package/src/components/overlays/BottomSheet/useSwipeToDismiss.ts +138 -0
- package/src/i18n/namespaces/input/en.json +11 -0
- package/src/i18n/namespaces/input/lt.json +11 -0
- package/src/library/index.ts +2 -0
- package/src/library/types.ts +2 -0
- package/src/stories/atoms/Select.stories.tsx +33 -5
- package/src/stories/organisms/BottomSheet.stories.tsx +291 -0
- package/src/theme/light/MuiAutocomplete.ts +43 -19
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Option } from './Select.types';
|
|
2
|
+
export declare const dropdownSearchFieldValue = "__dropdown-search-field__";
|
|
3
|
+
export declare const dropdownSelectAllValue = "__dropdown-select-all__";
|
|
4
|
+
export declare const dropdownGroupOptionPrefix = "__dropdown-group__:";
|
|
5
|
+
export declare const isGroupOptionValue: (value: string) => boolean;
|
|
6
|
+
export declare const groupNameFromOptionValue: (value: string) => string;
|
|
7
|
+
export declare const dropdownGroupOptionValue: (groupName: string) => string;
|
|
8
|
+
export declare const isInternalOptionValue: (value: string) => boolean;
|
|
9
|
+
export declare const dropdownSearchFieldOption: Option;
|
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
import { AutocompleteProps } from '@mui/material/Autocomplete';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
import { UseControllerProps } from 'react-hook-form';
|
|
3
|
+
import { FieldValues, UseControllerProps } from 'react-hook-form';
|
|
4
4
|
import { RcSesFormControlWrapperProps } from '../../components/FormControlWrapper';
|
|
5
5
|
import { Option } from './Select.types';
|
|
6
|
-
type TControllerProps = UseControllerProps<
|
|
6
|
+
type TControllerProps<TFieldValues extends FieldValues = FieldValues> = UseControllerProps<TFieldValues>;
|
|
7
7
|
type ImmediateControllerProps = 'control' | 'rules' | 'name' | 'disabled';
|
|
8
8
|
type TWrapperProps = RcSesFormControlWrapperProps;
|
|
9
9
|
type ImmediateWrapperProps = 'id' | 'label' | 'errors';
|
|
10
|
-
type
|
|
11
|
-
multiple?: boolean;
|
|
10
|
+
type CommonSelectProps<TFieldValues extends FieldValues = FieldValues> = Pick<TControllerProps<TFieldValues>, ImmediateControllerProps> & Pick<TWrapperProps, ImmediateWrapperProps> & {
|
|
12
11
|
clearable?: boolean;
|
|
13
|
-
limitTags?: number;
|
|
14
12
|
loading?: boolean;
|
|
15
13
|
options: Option[];
|
|
16
14
|
placeholder?: string;
|
|
17
15
|
dropdownLabel?: string;
|
|
18
16
|
dropdownSearch?: boolean;
|
|
19
17
|
dropdownSearchPlaceholder?: string;
|
|
20
|
-
selectAll?: boolean;
|
|
21
18
|
onInputChange?: AutocompleteProps<Option, boolean, boolean, false>['onInputChange'];
|
|
22
19
|
slotProps?: {
|
|
23
|
-
controller?: Partial<Omit<TControllerProps
|
|
20
|
+
controller?: Partial<Omit<TControllerProps<TFieldValues>, ImmediateControllerProps>>;
|
|
24
21
|
field?: Partial<Omit<AutocompleteProps<Option, boolean, boolean, false>, 'renderInput' | 'options' | 'value'>>;
|
|
25
22
|
wrapper?: Partial<Omit<TWrapperProps, ImmediateWrapperProps>>;
|
|
26
23
|
};
|
|
27
24
|
};
|
|
28
|
-
|
|
25
|
+
type SingleSelectProps<TFieldValues extends FieldValues = FieldValues> = CommonSelectProps<TFieldValues> & {
|
|
26
|
+
multiple?: false;
|
|
27
|
+
limitTags?: never;
|
|
28
|
+
selectAll?: never;
|
|
29
|
+
selectAllLabel?: never;
|
|
30
|
+
};
|
|
31
|
+
type MultiSelectProps<TFieldValues extends FieldValues = FieldValues> = CommonSelectProps<TFieldValues> & {
|
|
32
|
+
multiple: true;
|
|
33
|
+
limitTags?: number;
|
|
34
|
+
selectAll?: boolean;
|
|
35
|
+
selectAllLabel?: string;
|
|
36
|
+
};
|
|
37
|
+
type Props<TFieldValues extends FieldValues = FieldValues> = SingleSelectProps<TFieldValues> | MultiSelectProps<TFieldValues>;
|
|
38
|
+
declare function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(props: Props<TFieldValues>): React.JSX.Element;
|
|
29
39
|
export default RcSesSelect;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DialogProps as MuiDialogProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface RcSesBottomSheetProps extends Omit<MuiDialogProps, 'children' | 'title' | 'PaperProps' | 'maxWidth' | 'onClose' | 'slots' | 'slotProps'> {
|
|
4
|
+
title?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
showBack?: boolean;
|
|
7
|
+
onBack?: () => void;
|
|
8
|
+
primaryActionLabel?: string;
|
|
9
|
+
onPrimaryAction?: () => void;
|
|
10
|
+
secondaryActionLabel?: string;
|
|
11
|
+
onSecondaryAction?: () => void;
|
|
12
|
+
disableBackdropClose?: boolean;
|
|
13
|
+
size?: 'sm' | 'md';
|
|
14
|
+
onClose?: (event: unknown, reason: 'backdropClick' | 'escapeKeyDown' | 'swipeDown') => void;
|
|
15
|
+
}
|
|
16
|
+
declare function RcSesBottomSheet({ title, children, showBack, onBack, primaryActionLabel, onPrimaryAction, secondaryActionLabel, onSecondaryAction, onClose, disableBackdropClose, size, open, 'aria-labelledby': ariaLabelledByProp, 'aria-describedby': ariaDescribedByProp, scroll, transitionDuration, ...props }: RcSesBottomSheetProps): import("react").JSX.Element;
|
|
17
|
+
export default RcSesBottomSheet;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PointerEvent as ReactPointerEvent, MutableRefObject } from 'react';
|
|
2
|
+
export interface UseSwipeToDismissOptions {
|
|
3
|
+
open: boolean;
|
|
4
|
+
disableTransform: boolean;
|
|
5
|
+
onDismiss: (event: ReactPointerEvent<HTMLElement>) => void;
|
|
6
|
+
}
|
|
7
|
+
declare function useSwipeToDismiss({ open, disableTransform, onDismiss, }: UseSwipeToDismissOptions): {
|
|
8
|
+
paperRef: MutableRefObject<HTMLDivElement | null>;
|
|
9
|
+
isDragging: boolean;
|
|
10
|
+
handleProps: {
|
|
11
|
+
onPointerDown: (event: ReactPointerEvent<HTMLElement>) => void;
|
|
12
|
+
onPointerMove: (event: ReactPointerEvent<HTMLElement>) => void;
|
|
13
|
+
onPointerUp: (event: ReactPointerEvent<HTMLElement>) => void;
|
|
14
|
+
onPointerCancel: (event: ReactPointerEvent<HTMLElement>) => void;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default useSwipeToDismiss;
|
package/dist/library/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ import { default as ServiceWizardStepper } from '../components/layout/ServiceWiz
|
|
|
55
55
|
import { default as RcSesFullPageLoader } from '../components/loaders/FullPageLoader';
|
|
56
56
|
import { default as RcSesLoader } from '../components/loaders/Loader';
|
|
57
57
|
import { default as RcSesLoadingSpinner } from '../components/loaders/LoadingSpinner';
|
|
58
|
+
import { default as RcSesBottomSheet } from '../components/overlays/BottomSheet';
|
|
58
59
|
import { default as RcSesDialog } from '../components/overlays/Dialog';
|
|
59
60
|
import { default as RcSesModal } from '../components/overlays/Modal';
|
|
60
61
|
import { default as RcSesTheme } from '../theme/light';
|
|
@@ -68,7 +69,7 @@ declare module '@mui/x-date-pickers/models' {
|
|
|
68
69
|
export { RcSesPalette, RcSesTheme };
|
|
69
70
|
export { RcSesAccordion, useAccordionController };
|
|
70
71
|
export { RcSesAdvancedList, RcSesAdvancedListItem };
|
|
71
|
-
export { RcSesAlert, RcSesBadge, RcSesBreadcrumbs, RcSesButton, RcSesButtonWithPopover, RcSesFullPageLoader, RcSesLoader, RcSesLoadingSpinner, RcSesCard, RcSesCardShell, RcSesTitleBlock, RcSesCardFooter, RcSesDialog, RcSesFooter, RcSesImageCard, RcSesSnackbar, RcSesSnackbarProvider, RcSesModal, RcSesStepCard, RcSesSwitch, };
|
|
72
|
+
export { RcSesAlert, RcSesBadge, RcSesBreadcrumbs, RcSesButton, RcSesButtonWithPopover, RcSesFullPageLoader, RcSesLoader, RcSesLoadingSpinner, RcSesCard, RcSesCardShell, RcSesTitleBlock, RcSesCardFooter, RcSesDialog, RcSesFooter, RcSesImageCard, RcSesSnackbar, RcSesSnackbarProvider, RcSesModal, RcSesStepCard, RcSesSwitch, RcSesBottomSheet, };
|
|
72
73
|
export { RcSesSegmentedControl };
|
|
73
74
|
export { RcSesSideNavLayout };
|
|
74
75
|
export { RcSesCheckbox, RcSesCheckboxFormControl, RcSesSimpleCheckbox };
|
package/dist/library/types.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { ServiceWizardStepperProps } from '../components/layout/ServiceWizardSte
|
|
|
18
18
|
import { RcSesFullPageLoaderProps, RcSesLoaderBackdrop } from '../components/loaders/FullPageLoader';
|
|
19
19
|
import { RcSesLoaderProps, RcSesLoaderSize } from '../components/loaders/Loader';
|
|
20
20
|
import { RcSesLoadingSpinnerProps, RcSesSpinnerColor } from '../components/loaders/LoadingSpinner';
|
|
21
|
+
import { RcSesBottomSheetProps } from '../components/overlays/BottomSheet';
|
|
21
22
|
import { DialogSize, RcSesDialogProps } from '../components/overlays/Dialog';
|
|
22
23
|
import { ModalVariant, RcSesModalProps } from '../components/overlays/Modal';
|
|
23
24
|
import { ButtonProps } from '../types/buttons/ButtonProps';
|
|
@@ -27,3 +28,4 @@ export type { ButtonProps };
|
|
|
27
28
|
export type { RcSesFullPageLoaderProps, RcSesLoaderBackdrop, RcSesLoaderProps, RcSesLoaderSize, RcSesCardFormContainerProps, RcSesCardProps, RcSesCardShellProps, RcSesCardShellTestIds, RcSesTitleBlockProps, RcSesTitleBlockTestIds, RcSesCardFooterProps, RcSesCardFooterTestIds, CardFooterAlign, CardShellVariant, CardShellTheme, TitleBlockHeadingLevel, TitleBlockTitleVariant, RcSesSegmentedControlProps, RcSesSegmentButtonProps, RcSesSegmentOption, ServiceWizardStepperProps, SimpleCheckboxProps, RcSesFormControlLabelProps, RcSesLoadingSpinnerProps, RcSesSpinnerColor, RcSesTooltipProps, RcSesSideNavItem, RcSesSideNavLayoutProps, RcSesSideNavOverflow, RcSesStepCardProps, RcSesStepCardTestIds, };
|
|
28
29
|
export type { RcSesDialogProps, DialogSize };
|
|
29
30
|
export type { RcSesModalProps, ModalVariant };
|
|
31
|
+
export type { RcSesBottomSheetProps };
|