@scbt-ecom/ui 0.19.2 → 0.20.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/{CustomLink-fkoWqN7e.js → CustomLink-BZ2X3A56.js} +2 -2
- package/dist/{CustomLink-fkoWqN7e.js.map → CustomLink-BZ2X3A56.js.map} +1 -1
- package/dist/mergeRefs-qDToYXtM.js +12 -0
- package/dist/mergeRefs-qDToYXtM.js.map +1 -0
- package/dist/shared/ui/formElements/SwitchControl.d.ts +3 -0
- package/dist/shared/ui/formElements/controlled/index.d.ts +1 -0
- package/dist/shared/ui/formElements/controlled/switch/SwitchControl.d.ts +36 -0
- package/dist/shared/ui/formElements/controlled/switch/index.d.ts +1 -0
- package/dist/shared/ui/formElements/uncontrolled/maskInput/MaskInput.d.ts +3 -3
- package/dist/shared/ui/formElements/uncontrolled/switch/Switch.d.ts +12 -0
- package/dist/shared/ui/formElements/uncontrolled/switch/index.d.ts +1 -0
- package/dist/ui.js +5085 -4980
- package/dist/ui.js.map +1 -1
- package/dist/utils.js +10 -16
- package/dist/utils.js.map +1 -1
- package/dist/widget.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const o = (...f) => {
|
|
2
|
+
const r = f.filter(Boolean);
|
|
3
|
+
return r.length <= 1 ? r[0] || null : function(t) {
|
|
4
|
+
r.forEach((e) => {
|
|
5
|
+
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
o as m
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=mergeRefs-qDToYXtM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeRefs-qDToYXtM.js","sources":["../lib/shared/utils/mergeRefs.ts"],"sourcesContent":["import type React from 'react'\n\nexport const mergeRefs = <T>(...inputRefs: (React.Ref<T> | undefined)[]): React.Ref<T> | React.RefCallback<T> => {\n const filteredInputRefs = inputRefs.filter(Boolean)\n\n if (filteredInputRefs.length <= 1) {\n const firstRef = filteredInputRefs[0]\n\n return firstRef || null\n }\n\n return function mergedRefs(ref) {\n filteredInputRefs.forEach((inputRef) => {\n if (typeof inputRef === 'function') {\n inputRef(ref)\n } else if (inputRef) {\n ;(inputRef as React.MutableRefObject<T | null>).current = ref\n }\n })\n }\n}\n"],"names":["mergeRefs","inputRefs","filteredInputRefs","ref","inputRef"],"mappings":"AAEa,MAAAA,IAAY,IAAOC,MAAiF;AACzG,QAAAC,IAAoBD,EAAU,OAAO,OAAO;AAE9C,SAAAC,EAAkB,UAAU,IACbA,EAAkB,CAAC,KAEjB,OAGd,SAAoBC,GAAK;AACZ,IAAAD,EAAA,QAAQ,CAACE,MAAa;AAClC,MAAA,OAAOA,KAAa,aACtBA,EAASD,CAAG,IACHC,MACPA,EAA8C,UAAUD;AAAA,IAC5D,CACD;AAAA,EACH;AACF;"}
|
|
@@ -12,5 +12,8 @@ export interface ISwitchControlProps<T extends FieldValues> extends TCommonField
|
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
classes?: TSwitchControlClasses;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated For better performance use `Controlled.SwitchControl` instead.
|
|
17
|
+
*/
|
|
15
18
|
export declare const SwitchControl: <T extends FieldValues>({ disabled, classes, control, helperText, label, ...props }: ISwitchControlProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
16
19
|
export {};
|
|
@@ -60,4 +60,5 @@ export declare const Controlled: {
|
|
|
60
60
|
};
|
|
61
61
|
textHint?: string;
|
|
62
62
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
SwitchControl: <TFieldValues extends import('react-hook-form').FieldValues = import('react-hook-form').FieldValues>({ classes, className, control, name, rules, defaultValue, disabled, shouldUnregister, children, textHint, tooltip, popoverProps, ...props }: import('./switch/SwitchControl').SwitchControlProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
63
64
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Control, FieldPath, FieldValues, UseControllerProps } from 'react-hook-form';
|
|
2
|
+
import { Popover, SwitchBaseProps } from '../../..';
|
|
3
|
+
type SwitchControlClasses = SwitchBaseProps['classes'] & {
|
|
4
|
+
container?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
};
|
|
7
|
+
type PopoverProps = React.ComponentPropsWithoutRef<typeof Popover>;
|
|
8
|
+
export type SwitchControlProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = UseControllerProps<TFieldValues, TName> & Omit<SwitchBaseProps, 'classes'> & {
|
|
9
|
+
/**
|
|
10
|
+
* Контрол объект для управления полем
|
|
11
|
+
*/
|
|
12
|
+
control: Control<TFieldValues>;
|
|
13
|
+
/**
|
|
14
|
+
* Отображаемый лейбл
|
|
15
|
+
*/
|
|
16
|
+
children: React.ReactElement | string;
|
|
17
|
+
/**
|
|
18
|
+
* Дополнительные стили компонента
|
|
19
|
+
*/
|
|
20
|
+
classes?: SwitchControlClasses;
|
|
21
|
+
/**
|
|
22
|
+
* Дополнительный текст
|
|
23
|
+
*/
|
|
24
|
+
textHint?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Текст всплывающей подсказки
|
|
27
|
+
*/
|
|
28
|
+
tooltip?: React.ReactElement | string;
|
|
29
|
+
/**
|
|
30
|
+
* Свойства `Popover` компонента
|
|
31
|
+
*/
|
|
32
|
+
popoverProps?: PopoverProps;
|
|
33
|
+
};
|
|
34
|
+
declare const InnerComponent: <TFieldValues extends FieldValues = FieldValues>({ classes, className, control, name, rules, defaultValue, disabled, shouldUnregister, children, textHint, tooltip, popoverProps, ...props }: SwitchControlProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare const SwitchControl: typeof InnerComponent;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwitchControl } from './SwitchControl';
|
|
@@ -22,9 +22,9 @@ export type MaskInputProps = InputBaseProps & {
|
|
|
22
22
|
/**
|
|
23
23
|
* Компонент маски очень умный, умеет обрабатывать специальные символы
|
|
24
24
|
* в том порядке, который определён маской
|
|
25
|
-
* @typeParam
|
|
26
|
-
* @typeParam
|
|
27
|
-
* @typeParam
|
|
25
|
+
* @typeParam `#` позволяет вводить только числа (regexp: `/\d/g`)
|
|
26
|
+
* @typeParam `A` позволяет вводить любые буквы русского и английского алфавита (regexp: `/[A-Za-zА-Яа-я]/g`)
|
|
27
|
+
* @typeParam `C` позволяет вводить любые буквы, которые определены для использования в гос номерах автомобилей (regexp: `/([АВЕКМНОРСТУХавекмнорстух])/`)
|
|
28
28
|
*/
|
|
29
29
|
export declare const MaskInput: import('react').ForwardRefExoticComponent<Omit<import('react').InputHTMLAttributes<HTMLInputElement>, "placeholder"> & {
|
|
30
30
|
classes?: {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SwitchProps } from '@radix-ui/react-switch';
|
|
2
|
+
type SwitchBaseClasses = {
|
|
3
|
+
root?: string;
|
|
4
|
+
thumb?: string;
|
|
5
|
+
};
|
|
6
|
+
export type SwitchBaseProps = SwitchProps & {
|
|
7
|
+
classes?: SwitchBaseClasses;
|
|
8
|
+
};
|
|
9
|
+
export declare const SwitchBase: import('react').ForwardRefExoticComponent<SwitchProps & {
|
|
10
|
+
classes?: SwitchBaseClasses;
|
|
11
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwitchBase, type SwitchBaseProps } from './Switch';
|