@scbt-ecom/ui 0.66.0 → 0.67.1
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/hooks.js +40 -44
- package/dist/hooks.js.map +1 -1
- package/dist/{index-CywQGF6V.js → index-Cw6f0svP.js} +11483 -10916
- package/dist/index-Cw6f0svP.js.map +1 -0
- package/dist/index-cm9kMt4X.js +435 -0
- package/dist/index-cm9kMt4X.js.map +1 -0
- package/dist/shared/ui/button/model/helpers.d.ts +1 -1
- package/dist/shared/ui/carousel/CarouselNative.d.ts +6 -0
- package/dist/shared/ui/formElements/controlled/index.d.ts +2 -0
- package/dist/shared/ui/formElements/controlled/radio/RadioGroupCardControl.d.ts +3 -0
- package/dist/shared/ui/formElements/controlled/radio/RadioGroupControl.d.ts +1 -1
- package/dist/shared/ui/formElements/controlled/radio/RadioGroupTabControl.d.ts +3 -0
- package/dist/shared/ui/formElements/controlled/radio/index.d.ts +2 -0
- package/dist/shared/ui/formElements/uncontrolled/dayPicker/DayPicker.d.ts +1 -1
- package/dist/shared/ui/formElements/uncontrolled/index.d.ts +7 -6
- package/dist/shared/ui/formElements/uncontrolled/input/Input.d.ts +1 -1
- package/dist/shared/ui/formElements/uncontrolled/maskInput/MaskInput.d.ts +1 -1
- package/dist/shared/ui/formElements/uncontrolled/radio/RadioGroup.d.ts +12 -0
- package/dist/shared/ui/formElements/uncontrolled/radio/index.d.ts +1 -1
- package/dist/shared/ui/formElements/uncontrolled/radio/ui/AdditionalContent.d.ts +12 -0
- package/dist/shared/ui/formElements/uncontrolled/radio/ui/RadioItem.d.ts +3 -0
- package/dist/shared/ui/formElements/uncontrolled/radio/ui/RadioItemCard.d.ts +4 -0
- package/dist/shared/ui/formElements/uncontrolled/radio/ui/RadioItemTab.d.ts +4 -0
- package/dist/shared/ui/formElements/uncontrolled/radio/ui/index.d.ts +3 -1
- package/dist/shared/ui/formElements/uncontrolled/select/Select.d.ts +1 -1
- package/dist/shared/ui/formElements/uncontrolled/select/ui/SelectItem.d.ts +1 -1
- package/dist/shared/ui/formElements/uncontrolled/textarea/Textarea.d.ts +1 -1
- package/dist/shared/ui/heading/Heading.d.ts +1 -1
- package/dist/shared/ui/hint/Hint.d.ts +1 -0
- package/dist/shared/ui/icon/sprite.gen.d.ts +1 -1
- package/dist/shared/ui/popover/Popover.d.ts +2 -1
- package/dist/shared/validation/base/base.validators.d.ts +2 -0
- package/dist/shared/validation/base/boolean.validators.d.ts +13 -0
- package/dist/shared/validation/base/number.validators.d.ts +1 -0
- package/dist/shared/validation/base/select.validators.d.ts +1 -0
- package/dist/shared/validation/base/string.validators.d.ts +1 -0
- package/dist/shared/validation/index.d.ts +1 -0
- package/dist/sprites/general.svg +1 -1
- package/dist/ui.js +1364 -1435
- package/dist/ui.js.map +1 -1
- package/dist/useDebounce-BZSs8EPD.js +1211 -0
- package/dist/useDebounce-BZSs8EPD.js.map +1 -0
- package/dist/useFieldsProgress-B_tgt_Hg.js +26 -0
- package/dist/useFieldsProgress-B_tgt_Hg.js.map +1 -0
- package/dist/validation.js +1 -1
- package/dist/widget.js +1264 -1098
- package/dist/widget.js.map +1 -1
- package/dist/widgets/calculator/Calculator.d.ts +7 -0
- package/dist/widgets/calculator/CalculatorRoot.d.ts +8 -0
- package/dist/widgets/calculator/index.d.ts +2 -0
- package/dist/widgets/calculator/model/helpers.d.ts +4 -0
- package/dist/widgets/calculator/model/index.d.ts +3 -0
- package/dist/widgets/calculator/model/types.d.ts +9 -0
- package/dist/widgets/calculator/model/utils.d.ts +11 -0
- package/dist/widgets/calculator/ui/CalculatorTabs.d.ts +12 -0
- package/dist/widgets/calculator/ui/calculatorInfo/CalculatorInfo.d.ts +4 -0
- package/dist/widgets/calculator/ui/calculatorInfo/index.d.ts +2 -0
- package/dist/widgets/calculator/ui/calculatorInfo/ui/AssistHint.d.ts +7 -0
- package/dist/widgets/calculator/ui/calculatorInfo/ui/CalculatedBlock.d.ts +7 -0
- package/dist/widgets/calculator/ui/calculatorInfo/ui/CalculatorInfoBody.d.ts +5 -0
- package/dist/widgets/calculator/ui/calculatorInfo/ui/CalculatorInfoFooter.d.ts +8 -0
- package/dist/widgets/calculator/ui/calculatorInfo/ui/CalculatorInfoHead.d.ts +5 -0
- package/dist/widgets/calculator/ui/calculatorInfo/ui/InfoListItem.d.ts +15 -0
- package/dist/widgets/calculator/ui/calculatorInfo/ui/index.d.ts +6 -0
- package/dist/widgets/calculator/ui/index.d.ts +3 -0
- package/dist/widgets/calculator/ui/rootCalculator/RootCalculator.d.ts +15 -0
- package/dist/widgets/calculator/ui/rootCalculator/index.d.ts +1 -0
- package/dist/widgets/calculator/ui/rootCalculator/ui/CalculatorModal.d.ts +8 -0
- package/dist/widgets/calculator/ui/rootCalculator/ui/FieldsGroup.d.ts +25 -0
- package/dist/widgets/calculator/ui/rootCalculator/ui/index.d.ts +2 -0
- package/dist/widgets/dynamicForm/DynamicForm.d.ts +2 -1
- package/dist/widgets/dynamicForm/model/getDynamicSchema.d.ts +0 -10
- package/dist/widgets/dynamicForm/model/index.d.ts +0 -1
- package/dist/widgets/fieldMapper/index.d.ts +1 -1
- package/dist/widgets/fieldMapper/model/types.d.ts +6 -0
- package/dist/widgets/index.d.ts +1 -0
- package/dist/widgets/model/helpers.d.ts +2 -2
- package/dist/widgets/model/index.d.ts +1 -0
- package/dist/widgets/model/utils.d.ts +10 -0
- package/package.json +3 -2
- package/dist/index-BKXpPQ1s.js +0 -426
- package/dist/index-BKXpPQ1s.js.map +0 -1
- package/dist/index-CywQGF6V.js.map +0 -1
- package/dist/useDebounce-i1sdXecI.js +0 -1196
- package/dist/useDebounce-i1sdXecI.js.map +0 -1
- package/dist/useFieldsProgress-C3nmU8Vi.js +0 -21
- package/dist/useFieldsProgress-C3nmU8Vi.js.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
2
|
+
import { CalculatorInfoProps, RootCalculatorProps } from './ui';
|
|
3
|
+
export interface CalculatorProps<T extends FieldValues = FieldValues> {
|
|
4
|
+
calculatedInfoConfig: CalculatorInfoProps;
|
|
5
|
+
rootCalculatorConfig: RootCalculatorProps<T>;
|
|
6
|
+
}
|
|
7
|
+
export declare const Calculator: <T extends FieldValues>({ calculatedInfoConfig, rootCalculatorConfig }: CalculatorProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CalculatorProps } from './Calculator';
|
|
2
|
+
import { CalculatorTab } from './ui';
|
|
3
|
+
export interface CalculatorRootProps {
|
|
4
|
+
headline: string;
|
|
5
|
+
calculators: CalculatorProps[];
|
|
6
|
+
calculatorTabs?: CalculatorTab[];
|
|
7
|
+
}
|
|
8
|
+
export declare const CalculatorRoot: ({ calculators, calculatorTabs, headline }: CalculatorRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InfoListItemDto, InfoListItemProps } from '../ui';
|
|
2
|
+
import { CalculatorVariables } from './types';
|
|
3
|
+
export declare const evaluateFormula: (formula: string, variables: CalculatorVariables) => string;
|
|
4
|
+
export declare const formatInfoList: (list: InfoListItemDto[], variables: CalculatorVariables) => InfoListItemProps[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { getCalculatorSchema } from './utils';
|
|
2
|
+
export type CalculatorVariables = Record<string, any>;
|
|
3
|
+
export type CalculatorSuffix = 'percent' | 'currency';
|
|
4
|
+
export type ValueWithFormula = {
|
|
5
|
+
formula: string;
|
|
6
|
+
};
|
|
7
|
+
export type CalculatorValue = ValueWithFormula | string;
|
|
8
|
+
export type ModalContentVariant = 'content1' | 'content2';
|
|
9
|
+
export type CalculatorSchema = ReturnType<typeof getCalculatorSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { CalculatorProps } from '../Calculator';
|
|
4
|
+
import { CalculatorSuffix, ValueWithFormula } from './types';
|
|
5
|
+
export declare const isFormula: (value: ValueWithFormula | string) => value is ValueWithFormula;
|
|
6
|
+
export declare const formatWithIntl: (suffix: CalculatorSuffix, value: number) => string;
|
|
7
|
+
export declare const getCalculatorSchema: <T extends FieldValues>(props: CalculatorProps<T>["rootCalculatorConfig"]["fieldsGroup"]) => z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
}, {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export interface CalculatorTab {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export type CalculatorTabValue = CalculatorTab['value'];
|
|
7
|
+
export interface CalculatorTabsProps {
|
|
8
|
+
calculatorTabs: CalculatorTab[];
|
|
9
|
+
activeCalculator: CalculatorTabValue;
|
|
10
|
+
setActiveCalculator: Dispatch<SetStateAction<CalculatorTabValue>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const CalculatorTabs: ({ calculatorTabs, activeCalculator, setActiveCalculator }: CalculatorTabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CalculatedBlockProps, CalculatedInfoBodyProps, CalculatorInfoFooterProps, CalculatorInfoHeadProps } from './ui';
|
|
2
|
+
export interface CalculatorInfoProps extends CalculatedBlockProps, CalculatorInfoHeadProps, CalculatedInfoBodyProps, CalculatorInfoFooterProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const CalculatorInfo: ({ topDescription, bottomDescription, rootValue, title, subtitle, buttonProps, infoList, suffix, assistHint }: CalculatorInfoProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AllowedIcons } from '../../../../../shared/ui';
|
|
2
|
+
export interface AssistHintProps {
|
|
3
|
+
iconName: AllowedIcons;
|
|
4
|
+
text: string;
|
|
5
|
+
hint?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const AssistHint: ({ iconName, text, hint }: AssistHintProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CalculatorSuffix, CalculatorValue } from '../../../model';
|
|
2
|
+
export interface CalculatedBlockProps {
|
|
3
|
+
topDescription: string;
|
|
4
|
+
rootValue: CalculatorValue;
|
|
5
|
+
suffix: CalculatorSuffix;
|
|
6
|
+
}
|
|
7
|
+
export declare const CalculatedBlock: ({ topDescription, rootValue, suffix }: CalculatedBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AssistHintProps } from './AssistHint';
|
|
2
|
+
import { ButtonProps } from '../../../../../shared/ui';
|
|
3
|
+
export interface CalculatorInfoFooterProps {
|
|
4
|
+
assistHint?: AssistHintProps;
|
|
5
|
+
buttonProps?: ButtonProps;
|
|
6
|
+
bottomDescription?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const CalculatorInfoFooter: ({ assistHint, buttonProps, bottomDescription }: CalculatorInfoFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CalculatorSuffix, CalculatorValue } from '../../../model';
|
|
2
|
+
export interface InfoListItemCommon {
|
|
3
|
+
label: string;
|
|
4
|
+
hint?: string;
|
|
5
|
+
suffix: CalculatorSuffix;
|
|
6
|
+
accent?: boolean;
|
|
7
|
+
color?: 'dark' | 'blue';
|
|
8
|
+
}
|
|
9
|
+
export interface InfoListItemDto extends InfoListItemCommon {
|
|
10
|
+
value: CalculatorValue;
|
|
11
|
+
}
|
|
12
|
+
export interface InfoListItemProps extends InfoListItemCommon {
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const InfoListItem: ({ hint, value, label, suffix, color, accent }: InfoListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
2
|
+
import { CalculatorModalProps, CheckboxGroupProps, RadioGroupProps, SelectGroupProps, SlidersGroupProps, SwitchGroupProps } from './ui';
|
|
3
|
+
export interface RootCalculatorProps<T extends FieldValues> {
|
|
4
|
+
modalConfig?: CalculatorModalProps;
|
|
5
|
+
fieldsGroup: {
|
|
6
|
+
selectGroupConfig?: SelectGroupProps<T>;
|
|
7
|
+
slidersGroupConfig?: SlidersGroupProps<T>;
|
|
8
|
+
radioGroupTabConfig?: RadioGroupProps<T>;
|
|
9
|
+
checkboxGroupConfig?: CheckboxGroupProps<T>;
|
|
10
|
+
radioGroupConfig?: RadioGroupProps<T>;
|
|
11
|
+
radioGroupCardConfig?: RadioGroupProps<T>;
|
|
12
|
+
switchGroupConfig?: SwitchGroupProps<T>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const RootCalculator: <T extends FieldValues>({ modalConfig, fieldsGroup }: RootCalculatorProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RootCalculator';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModalContentVariant } from '../../../model';
|
|
2
|
+
export interface CalculatorModalProps {
|
|
3
|
+
triggerText: string;
|
|
4
|
+
contentVariant: ModalContentVariant;
|
|
5
|
+
modalTitle?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const CalculatorModal: ({ triggerText, modalTitle, description, contentVariant }: CalculatorModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
2
|
+
import { FieldElementWithoutControl } from '../../../../fieldMapper';
|
|
3
|
+
import { FieldValidation } from '../../../../model';
|
|
4
|
+
type ValidationField = {
|
|
5
|
+
validation: FieldValidation;
|
|
6
|
+
};
|
|
7
|
+
export interface SelectGroupProps<T extends FieldValues> {
|
|
8
|
+
fields: FieldElementWithoutControl<T, 'SelectControl', ValidationField>[];
|
|
9
|
+
}
|
|
10
|
+
export interface CheckboxGroupProps<T extends FieldValues> {
|
|
11
|
+
fields: FieldElementWithoutControl<T, 'CheckboxControl', ValidationField>[];
|
|
12
|
+
}
|
|
13
|
+
type RadioGroupFields<T extends FieldValues> = FieldElementWithoutControl<T, 'RadioGroupTabControl' | 'RadioGroupControl' | 'RadioGroupCardControl', ValidationField>[];
|
|
14
|
+
export interface RadioGroupProps<T extends FieldValues> {
|
|
15
|
+
fields: RadioGroupFields<T>;
|
|
16
|
+
}
|
|
17
|
+
export interface SlidersGroupProps<T extends FieldValues> {
|
|
18
|
+
fields: FieldElementWithoutControl<T, 'SliderControl', ValidationField>[];
|
|
19
|
+
}
|
|
20
|
+
export interface SwitchGroupProps<T extends FieldValues> {
|
|
21
|
+
fields: FieldElementWithoutControl<T, 'SwitchControl', ValidationField>[];
|
|
22
|
+
}
|
|
23
|
+
export type FieldsGroupProps<T extends FieldValues> = SelectGroupProps<T> | CheckboxGroupProps<T> | RadioGroupProps<T> | SlidersGroupProps<T> | SwitchGroupProps<T>;
|
|
24
|
+
export declare const FieldsGroup: <T extends FieldValues>({ fields }: FieldsGroupProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FieldValues } from 'react-hook-form';
|
|
2
|
-
import {
|
|
2
|
+
import { FieldValidation } from '../model';
|
|
3
|
+
import { Approvement, ApprovementType, Chips, ChipsType, Progress, ProgressField, ProgressType } from './model';
|
|
3
4
|
import { ProgressBar, Uncontrolled } from '../../shared/ui';
|
|
4
5
|
import { FieldElement } from '../fieldMapper';
|
|
5
6
|
type SubmitProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> & {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FieldValues } from 'react-hook-form';
|
|
2
|
-
import { ZodObject, ZodRawShape } from 'zod';
|
|
3
|
-
import { FieldElement } from '../..';
|
|
4
|
-
export type FieldValidation = {
|
|
5
|
-
type: string;
|
|
6
|
-
args: Record<string, any>;
|
|
7
|
-
};
|
|
8
|
-
export declare const getDynamicSchema: <TFieldValues extends FieldValues>(fields: FieldElement<TFieldValues, any, {
|
|
9
|
-
validation: FieldValidation;
|
|
10
|
-
}>[]) => ZodObject<ZodRawShape>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { FieldMapper } from './FieldMapper';
|
|
2
|
-
export type
|
|
2
|
+
export type * from './model/types';
|
|
@@ -7,3 +7,9 @@ export type FieldElement<TFieldValues extends FieldValues = FieldValues, Type ex
|
|
|
7
7
|
name: FieldPath<TFieldValues>;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
+
export type FieldElementWithoutControl<TFieldValues extends FieldValues = FieldValues, Type extends ElementType = ElementType, ExternalProps = {}> = {
|
|
11
|
+
type: Type;
|
|
12
|
+
args: Omit<React.ComponentPropsWithoutRef<(typeof Controlled)[Type]>, 'control'> & ExternalProps & {
|
|
13
|
+
name: FieldPath<TFieldValues>;
|
|
14
|
+
};
|
|
15
|
+
};
|
package/dist/widgets/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const WIDGET_LIST: readonly ["header", "footer", "interLinking", "stepper", "usefulInfo", "longBanner", "banner", "benefit", "form", "seoHeader"];
|
|
2
|
-
export declare const widgetIds: Record<"header" | "footer" | "interLinking" | "stepper" | "usefulInfo" | "longBanner" | "banner" | "benefit" | "form" | "seoHeader", "header" | "footer" | "interLinking" | "stepper" | "usefulInfo" | "longBanner" | "banner" | "benefit" | "form" | "seoHeader">;
|
|
1
|
+
export declare const WIDGET_LIST: readonly ["header", "footer", "interLinking", "stepper", "usefulInfo", "longBanner", "banner", "benefit", "form", "seoHeader", "calculator"];
|
|
2
|
+
export declare const widgetIds: Record<"header" | "footer" | "interLinking" | "stepper" | "usefulInfo" | "longBanner" | "banner" | "benefit" | "form" | "seoHeader" | "calculator", "header" | "footer" | "interLinking" | "stepper" | "usefulInfo" | "longBanner" | "banner" | "benefit" | "form" | "seoHeader" | "calculator">;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
2
|
+
import { ZodObject, ZodRawShape } from 'zod';
|
|
3
|
+
import { FieldElement } from '..';
|
|
4
|
+
export type FieldValidation = {
|
|
5
|
+
type: string;
|
|
6
|
+
args: Record<string, any>;
|
|
7
|
+
};
|
|
8
|
+
export declare const getDynamicSchema: <TFieldValues extends FieldValues>(fields: FieldElement<TFieldValues, any, {
|
|
9
|
+
validation: FieldValidation;
|
|
10
|
+
}>[]) => ZodObject<ZodRawShape>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scbt-ecom/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.67.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
"prepare": "husky",
|
|
59
59
|
"pre-commit": "npm run lint",
|
|
60
60
|
"chromatic": "npx chromatic --project-token=chpt_9468dafcf1bf3e3 --only-changed --files='src/stories/**/*.stories.@(tsx)'",
|
|
61
|
-
"pre-deploy": "npm run lint "
|
|
61
|
+
"pre-deploy": "npm run lint ",
|
|
62
|
+
"ts-check": "pnpm exec tsc"
|
|
62
63
|
},
|
|
63
64
|
"peerDependecies": {
|
|
64
65
|
"react": "^18.3.1",
|