@useloops/design-system 1.4.720 → 1.4.721
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/Platform.js +1 -1
- package/dist/WebCore/FormBuilder.d.ts +3 -0
- package/dist/WebCore/FormBuilder.js +1 -0
- package/dist/WebCore.d.ts +2 -0
- package/dist/WebCore.js +1 -1
- package/dist/esm/Platform.js +1 -1
- package/dist/esm/WebCore/FormBuilder.js +1 -0
- package/dist/esm/WebCore.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/systems/Marketing/PlanFeatureTable/PlanFeatureTableSkeleton.js +1 -1
- package/dist/esm/systems/Marketing/PlanTierCard/PlanTierCard.js +1 -1
- package/dist/esm/systems/Marketing/PlanTierCard/PlanTierCardSkeleton.js +1 -1
- package/dist/esm/systems/Marketing/PlanTierCard/SavingsPill.js +1 -1
- package/dist/esm/systems/Platform/AIInsight/AIInsight.js +1 -1
- package/dist/esm/systems/Platform/AISummary/AISummary.js +1 -1
- package/dist/esm/systems/Platform/AIWrittenByLockUp/AiWrittenByLockUp.js +1 -1
- package/dist/esm/systems/Platform/AssetItem/AssetItem.js +1 -1
- package/dist/esm/systems/Platform/AssetItem/_partials/AssetItemMenu.js +1 -1
- package/dist/esm/systems/Platform/AssetItem/_partials/CoverTypeIndicator.js +1 -1
- package/dist/esm/systems/Platform/AssetItem/_partials/ImageTile.js +1 -1
- package/dist/esm/systems/Platform/CommentCard/CommentCard.js +1 -1
- package/dist/esm/systems/Platform/DataPointInfo/DataPointInfo.js +1 -1
- package/dist/esm/systems/Platform/DataPointInfo/_partials/DataSourceItem.js +1 -1
- package/dist/esm/systems/Platform/DataPointInfo/_partials/EmptyStateMessage.js +1 -1
- package/dist/esm/systems/Platform/DataPointInfo/_partials/StatValue.js +1 -1
- package/dist/esm/systems/Platform/DemographicSelectionSection/DemographicSelectionSection.js +1 -1
- package/dist/esm/systems/Platform/EmojiListItem/EmojiListItem.js +1 -1
- package/dist/esm/systems/Platform/EmojiListItem/_partials/StyledSurface.js +1 -1
- package/dist/esm/systems/Platform/EmojiQuestionEditorOption/EmojiQuestionEditorOption.js +1 -1
- package/dist/esm/systems/Platform/EmptyStateCard/EmptyStateCard.js +1 -1
- package/dist/esm/systems/Platform/ExtendedTestStatus/ExtendedTestStatus.js +1 -1
- package/dist/esm/systems/Platform/FilterCount/FilterCount.js +1 -1
- package/dist/esm/systems/Platform/FilterGroupAccordion/FilterGroupAccordion.js +1 -1
- package/dist/esm/systems/Platform/FilterPyramidGraph/FilterPyramidGraph.js +1 -1
- package/dist/esm/systems/Platform/FilterRow/FilterRow.js +1 -1
- package/dist/esm/systems/Platform/FilteredItemsCard/FilteredItemsCard.js +1 -1
- package/dist/esm/systems/Platform/GraphBar/_partials/UnitText/UnitText.js +1 -1
- package/dist/esm/systems/Platform/Header/Header.js +1 -1
- package/dist/esm/systems/Platform/KpiDataPopover/KpiDataPopover.js +1 -1
- package/dist/esm/systems/Platform/KpiDataPopover/KpiDetails.js +1 -1
- package/dist/esm/systems/Platform/KpiDataPopover/QuestionStatsCard.js +1 -1
- package/dist/esm/systems/Platform/LikertGraph/_partials/LikertActionController/LikertActionController.js +1 -1
- package/dist/esm/systems/Platform/LikertGraph/_partials/LikertGraphBar/LikertGraphBar.js +1 -1
- package/dist/esm/systems/Platform/LinkExpired/LinkExpired.js +1 -1
- package/dist/esm/systems/Platform/LoopItem/LoopItem.js +1 -1
- package/dist/esm/systems/Platform/LoopItemEmpty/LoopItemEmpty.js +1 -1
- package/dist/esm/systems/Platform/LoopVideoNudge/LoopVideoNudge.js +1 -1
- package/dist/esm/systems/Platform/MFACodeVerify/MFACodeVerify.js +1 -1
- package/dist/esm/systems/Platform/MiniResultCard/MiniResultCard.js +1 -1
- package/dist/esm/systems/Platform/PaginationControl/PaginationControl.js +1 -1
- package/dist/esm/systems/Platform/PinchIndicator/PinchIndicator.js +1 -1
- package/dist/esm/systems/Platform/PinchIndicator/_partials/StyledSurface/StyledSurface.js +1 -1
- package/dist/esm/systems/Platform/ProjectItem/ProjectItemGridView.js +1 -1
- package/dist/esm/systems/Platform/ProjectItem/ProjectItemListView.js +1 -1
- package/dist/esm/systems/Platform/ProjectItem/_partials/NoThumbnailPlaceholder.js +1 -1
- package/dist/esm/systems/Platform/ProjectItem/_partials/styledPartials.js +1 -1
- package/dist/esm/systems/Platform/QuestionBar/QuestionBar.js +1 -1
- package/dist/esm/systems/Platform/QuestionBlock/QuestionBlock.js +1 -1
- package/dist/esm/systems/Platform/QuestionSelector/QuestionSelector.js +1 -1
- package/dist/esm/systems/Platform/ScrollIndicator/ScrollIndicator.js +1 -1
- package/dist/esm/systems/Platform/SearchInput/SearchInput.js +1 -1
- package/dist/esm/systems/Platform/SectionHeader/SectionHeader.js +1 -1
- package/dist/esm/systems/Platform/SentimentArrow/SentimentArrow.js +1 -1
- package/dist/esm/systems/Platform/SliderGraph/_partials/SliderGraphBar/SliderGraphBar.js +1 -1
- package/dist/esm/systems/Platform/SliderGraph/_partials/SliderGraphYAxis/SliderGraphYAxis.js +1 -1
- package/dist/esm/systems/Platform/Tab/Tab.js +1 -1
- package/dist/esm/systems/Platform/TestItem/TestItem.js +1 -1
- package/dist/esm/systems/Platform/TestStatus/TestStatus.js +1 -1
- package/dist/esm/systems/Platform/TimeToFindGraph/TimeToFindGraph.js +1 -1
- package/dist/esm/systems/Platform/TimeToFindResult/TimeToFindResult.js +1 -1
- package/dist/esm/systems/Platform/VideoControls/VideoControls.js +1 -1
- package/dist/esm/systems/Platform/VideoControls2/VideoControls2.js +1 -1
- package/dist/esm/systems/Platform/VideoControls2/components/Timeline/components/FullscreenControls/FullscreenControls.js +1 -1
- package/dist/esm/systems/WebCore/FormBuilder/Field.js +1 -0
- package/dist/esm/systems/WebCore/FormBuilder/FieldMessage.js +1 -0
- package/dist/esm/systems/WebCore/FormBuilder/FormActions.js +1 -0
- package/dist/esm/systems/WebCore/FormBuilder/FormBuilder.js +1 -0
- package/dist/esm/systems/WebCore/FormBuilder/components/StrengthIndicator/StrengthIndicator.js +1 -0
- package/dist/esm/systems/WebCore/FormBuilder/components/StrengthIndicator/components/LinearBar/LinearBar.js +1 -0
- package/dist/esm/systems/WebCore/FormBuilder/components/StrengthIndicator/helpers/getColorBasedOnScore.js +1 -0
- package/dist/esm/systems/WebCore/FormBuilder/fieldRegistry.js +1 -0
- package/dist/esm/systems/WebCore/InputLabelHelp/InputLabelHelp.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/systems/Marketing/PlanFeatureTable/PlanFeatureTableSkeleton.js +1 -1
- package/dist/systems/Marketing/PlanTierCard/PlanTierCard.js +1 -1
- package/dist/systems/Marketing/PlanTierCard/PlanTierCardSkeleton.js +1 -1
- package/dist/systems/Marketing/PlanTierCard/SavingsPill.js +1 -1
- package/dist/systems/Platform/AIInsight/AIInsight.js +1 -1
- package/dist/systems/Platform/AISummary/AISummary.d.ts +1 -0
- package/dist/systems/Platform/AISummary/AISummary.js +1 -1
- package/dist/systems/Platform/AIWrittenByLockUp/AiWrittenByLockUp.js +1 -1
- package/dist/systems/Platform/AssetItem/AssetItem.d.ts +1 -0
- package/dist/systems/Platform/AssetItem/AssetItem.js +1 -1
- package/dist/systems/Platform/AssetItem/_partials/AssetItemMenu.js +1 -1
- package/dist/systems/Platform/AssetItem/_partials/CoverTypeIndicator.js +1 -1
- package/dist/systems/Platform/AssetItem/_partials/ImageTile.js +1 -1
- package/dist/systems/Platform/CommentCard/CommentCard.js +1 -1
- package/dist/systems/Platform/CommentCard/types.d.ts +1 -0
- package/dist/systems/Platform/CommentFeedbackCard/CommentFeedbackCard.d.ts +2 -2
- package/dist/systems/Platform/DataPointInfo/DataPointInfo.js +1 -1
- package/dist/systems/Platform/DataPointInfo/_partials/DataSourceItem.js +1 -1
- package/dist/systems/Platform/DataPointInfo/_partials/EmptyStateMessage.js +1 -1
- package/dist/systems/Platform/DataPointInfo/_partials/StatValue.js +1 -1
- package/dist/systems/Platform/DemographicSelectionSection/DemographicSelectionSection.js +1 -1
- package/dist/systems/Platform/EmojiListItem/EmojiListItem.d.ts +1 -0
- package/dist/systems/Platform/EmojiListItem/EmojiListItem.js +1 -1
- package/dist/systems/Platform/EmojiListItem/_partials/StyledSurface.js +1 -1
- package/dist/systems/Platform/EmojiQuestionEditorOption/EmojiQuestionEditorOption.d.ts +1 -0
- package/dist/systems/Platform/EmojiQuestionEditorOption/EmojiQuestionEditorOption.js +1 -1
- package/dist/systems/Platform/EmptyStateCard/EmptyStateCard.d.ts +1 -0
- package/dist/systems/Platform/EmptyStateCard/EmptyStateCard.js +1 -1
- package/dist/systems/Platform/ExtendedTestStatus/ExtendedTestStatus.js +1 -1
- package/dist/systems/Platform/FilterCount/FilterCount.js +1 -1
- package/dist/systems/Platform/FilterGroupAccordion/FilterGroupAccordion.js +1 -1
- package/dist/systems/Platform/FilterPyramidGraph/FilterPyramidGraph.js +1 -1
- package/dist/systems/Platform/FilterRow/FilterRow.d.ts +1 -0
- package/dist/systems/Platform/FilterRow/FilterRow.js +1 -1
- package/dist/systems/Platform/FilteredItemsCard/FilteredItemsCard.js +1 -1
- package/dist/systems/Platform/GraphBar/_partials/UnitText/UnitText.d.ts +1 -0
- package/dist/systems/Platform/GraphBar/_partials/UnitText/UnitText.js +1 -1
- package/dist/systems/Platform/Header/Header.js +1 -1
- package/dist/systems/Platform/KpiDataPopover/KpiDataPopover.js +1 -1
- package/dist/systems/Platform/KpiDataPopover/KpiDetails.js +1 -1
- package/dist/systems/Platform/KpiDataPopover/QuestionStatsCard.js +1 -1
- package/dist/systems/Platform/LikertGraph/_partials/LikertActionController/LikertActionController.js +1 -1
- package/dist/systems/Platform/LikertGraph/_partials/LikertGraphBar/LikertGraphBar.js +1 -1
- package/dist/systems/Platform/LikertGraph/types.d.ts +1 -0
- package/dist/systems/Platform/LinkExpired/LinkExpired.js +1 -1
- package/dist/systems/Platform/LoopItem/LoopItem.js +1 -1
- package/dist/systems/Platform/LoopItemEmpty/LoopItemEmpty.js +1 -1
- package/dist/systems/Platform/LoopVideoNudge/LoopVideoNudge.js +1 -1
- package/dist/systems/Platform/MFACodeVerify/MFACodeVerify.js +1 -1
- package/dist/systems/Platform/MiniResultCard/MiniResultCard.js +1 -1
- package/dist/systems/Platform/PaginationControl/PaginationControl.js +1 -1
- package/dist/systems/Platform/PinchIndicator/PinchIndicator.js +1 -1
- package/dist/systems/Platform/PinchIndicator/_partials/StyledSurface/StyledSurface.js +1 -1
- package/dist/systems/Platform/ProjectItem/ProjectItemGridView.js +1 -1
- package/dist/systems/Platform/ProjectItem/ProjectItemListView.js +1 -1
- package/dist/systems/Platform/ProjectItem/_partials/NoThumbnailPlaceholder.js +1 -1
- package/dist/systems/Platform/ProjectItem/_partials/styledPartials.js +1 -1
- package/dist/systems/Platform/QuestionBar/QuestionBar.js +1 -1
- package/dist/systems/Platform/QuestionBlock/QuestionBlock.d.ts +1 -0
- package/dist/systems/Platform/QuestionBlock/QuestionBlock.js +1 -1
- package/dist/systems/Platform/QuestionSelector/QuestionSelector.d.ts +1 -0
- package/dist/systems/Platform/QuestionSelector/QuestionSelector.js +1 -1
- package/dist/systems/Platform/ScrollIndicator/ScrollIndicator.d.ts +4 -2
- package/dist/systems/Platform/ScrollIndicator/ScrollIndicator.js +1 -1
- package/dist/systems/Platform/SearchInput/SearchInput.js +1 -1
- package/dist/systems/Platform/SectionHeader/SectionHeader.js +1 -1
- package/dist/systems/Platform/SentimentArrow/SentimentArrow.js +1 -1
- package/dist/systems/Platform/SliderGraph/_partials/SliderGraphBar/SliderGraphBar.js +1 -1
- package/dist/systems/Platform/SliderGraph/_partials/SliderGraphYAxis/SliderGraphYAxis.js +1 -1
- package/dist/systems/Platform/SliderGraph/_partials/StyledComponents.d.ts +1 -1
- package/dist/systems/Platform/SliderGraph/types.d.ts +1 -0
- package/dist/systems/Platform/Tab/Tab.js +1 -1
- package/dist/systems/Platform/TestItem/TestItem.js +1 -1
- package/dist/systems/Platform/TestStatus/TestStatus.js +1 -1
- package/dist/systems/Platform/TimeToFindGraph/TimeToFindGraph.js +1 -1
- package/dist/systems/Platform/TimeToFindResult/TimeToFindResult.js +1 -1
- package/dist/systems/Platform/VideoControls/VideoControls.d.ts +1 -0
- package/dist/systems/Platform/VideoControls/VideoControls.js +1 -1
- package/dist/systems/Platform/VideoControls/components/Timeline/components/Markers/Markers.d.ts +1 -0
- package/dist/systems/Platform/VideoControls2/VideoControls2.d.ts +1 -0
- package/dist/systems/Platform/VideoControls2/VideoControls2.js +1 -1
- package/dist/systems/Platform/VideoControls2/components/Timeline/components/FullscreenControls/FullscreenControls.js +1 -1
- package/dist/systems/Platform/VideoControls2/components/Timeline/components/Markers/Markers.d.ts +1 -0
- package/dist/systems/Platform/VideoControls2/components/VideoOverlayControl/VideoOverlayControl.d.ts +1 -1
- package/dist/systems/WebCore/ExpandableTypographyClamp/ExpandableTypographyClamp.d.ts +1 -1
- package/dist/systems/WebCore/FormBuilder/Field.js +1 -0
- package/dist/systems/WebCore/FormBuilder/FieldMessage.js +1 -0
- package/dist/systems/WebCore/FormBuilder/FormActions.js +1 -0
- package/dist/systems/WebCore/FormBuilder/FormBuilder.d.ts +13 -0
- package/dist/systems/WebCore/FormBuilder/FormBuilder.js +1 -0
- package/dist/systems/WebCore/FormBuilder/components/StrengthIndicator/StrengthIndicator.js +1 -0
- package/dist/systems/WebCore/FormBuilder/components/StrengthIndicator/components/LinearBar/LinearBar.js +1 -0
- package/dist/systems/WebCore/FormBuilder/components/StrengthIndicator/helpers/getColorBasedOnScore.js +1 -0
- package/dist/systems/WebCore/FormBuilder/fieldRegistry.d.ts +140 -0
- package/dist/systems/WebCore/FormBuilder/fieldRegistry.js +1 -0
- package/dist/systems/WebCore/FormBuilder/types.d.ts +69 -0
- package/dist/systems/WebCore/FormGenerator/FormGenerator.d.ts +4 -0
- package/dist/systems/WebCore/FormGenerator/types.d.ts +8 -8
- package/dist/systems/WebCore/InputLabelHelp/InputLabelHelp.d.ts +2 -0
- package/dist/systems/WebCore/InputLabelHelp/InputLabelHelp.js +1 -1
- package/dist/systems/WebCore/Select/types.d.ts +2 -1
- package/package.json +4 -2
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { CustomFieldProps } from '../CustomField/CustomField.js';
|
|
2
|
+
import { RichTextFieldProps } from '../RichTextField/RichTextField.js';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { ComponentProps, ReactElement } from 'react';
|
|
5
|
+
import { RankProps } from '../Rank/types.js';
|
|
6
|
+
import { RadioGroupProps } from '../RadioGroup/RadioGroup.js';
|
|
7
|
+
import { LikertProps } from '../Likert/Likert.js';
|
|
8
|
+
import { DifferentialProps } from '../Differential/Differential.js';
|
|
9
|
+
import { StarRatingProps } from '../StarRating/StarRating.js';
|
|
10
|
+
import { SliderProps } from '../Slider/Slider.js';
|
|
11
|
+
import { SwitchProps } from '../Switch/Switch.js';
|
|
12
|
+
import { CheckboxGroupProps } from '../CheckboxGroup/CheckboxGroup.js';
|
|
13
|
+
import { CheckboxProps } from '../Checkbox/Checkbox.js';
|
|
14
|
+
import { AutocompleteFieldProps } from '../AutocompleteSingle/types.js';
|
|
15
|
+
import { SelectProps } from '../Select/types.js';
|
|
16
|
+
import { CreatableAutocompleteProps } from '../CreatableAutocomplete/CreatableAutocomplete.js';
|
|
17
|
+
import { TextareaProps } from '../Textarea/Textarea.js';
|
|
18
|
+
import { NumberFieldProps } from '../NumberField/types.js';
|
|
19
|
+
import { TextFieldProps } from '../TextField/TextField.js';
|
|
20
|
+
import { FieldValues } from 'react-hook-form';
|
|
21
|
+
import { BaseField } from './types.js';
|
|
22
|
+
|
|
23
|
+
/** Props handed to a field's component on every render — supplied by the form, never the config. */
|
|
24
|
+
interface RhfFieldProps {
|
|
25
|
+
value: unknown;
|
|
26
|
+
onChange: (value: any) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Single source of truth for controlled field types — the `fieldType` union, per-type config
|
|
30
|
+
* props and default values are all derived from it. Add a field type = add one entry here.
|
|
31
|
+
*/
|
|
32
|
+
declare const FIELD_REGISTRY: {
|
|
33
|
+
textfield: {
|
|
34
|
+
component: react.FunctionComponent<TextFieldProps>;
|
|
35
|
+
getDefault: (f: any) => string;
|
|
36
|
+
};
|
|
37
|
+
numberfield: {
|
|
38
|
+
component: react.NamedExoticComponent<NumberFieldProps>;
|
|
39
|
+
getDefault: (f: any) => number;
|
|
40
|
+
};
|
|
41
|
+
textarea: {
|
|
42
|
+
component: react.FunctionComponent<TextareaProps>;
|
|
43
|
+
getDefault: (f: any) => string;
|
|
44
|
+
};
|
|
45
|
+
creatableautocomplete: {
|
|
46
|
+
component: react.FunctionComponent<CreatableAutocompleteProps>;
|
|
47
|
+
getDefault: (f: any) => string;
|
|
48
|
+
};
|
|
49
|
+
select: {
|
|
50
|
+
component: react.FunctionComponent<SelectProps>;
|
|
51
|
+
getDefault: (f: any) => any;
|
|
52
|
+
};
|
|
53
|
+
autocomplete: {
|
|
54
|
+
component: react.FunctionComponent<AutocompleteFieldProps>;
|
|
55
|
+
getDefault: (f: any) => any;
|
|
56
|
+
adapt: (_field: Record<string, any>, rhf: RhfFieldProps) => {
|
|
57
|
+
onChange: (_event: unknown, value: unknown) => void;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
checkbox: {
|
|
61
|
+
component: react.FunctionComponent<CheckboxProps>;
|
|
62
|
+
getDefault: (f: any) => boolean;
|
|
63
|
+
};
|
|
64
|
+
checkboxGroup: {
|
|
65
|
+
component: react.FunctionComponent<CheckboxGroupProps>;
|
|
66
|
+
getDefault: (f: any) => string[];
|
|
67
|
+
};
|
|
68
|
+
switch: {
|
|
69
|
+
component: react.FunctionComponent<SwitchProps>;
|
|
70
|
+
getDefault: (f: any) => boolean;
|
|
71
|
+
adapt: (field: Record<string, any>) => {
|
|
72
|
+
label: any;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
slider: {
|
|
76
|
+
component: react.FunctionComponent<SliderProps>;
|
|
77
|
+
getDefault: (f: any) => any;
|
|
78
|
+
adapt: (_field: Record<string, any>, rhf: RhfFieldProps) => {
|
|
79
|
+
onChange: (_event: unknown, value: number | number[]) => void;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
starRating: {
|
|
83
|
+
component: react.FunctionComponent<StarRatingProps>;
|
|
84
|
+
getDefault: (f: any) => number;
|
|
85
|
+
adapt: (_field: Record<string, any>, rhf: RhfFieldProps) => {
|
|
86
|
+
onChange: (_event: unknown, value: number | null) => void;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
differential: {
|
|
90
|
+
component: react.FunctionComponent<DifferentialProps>;
|
|
91
|
+
getDefault: (f: any) => any;
|
|
92
|
+
};
|
|
93
|
+
likert: {
|
|
94
|
+
component: react.FunctionComponent<LikertProps>;
|
|
95
|
+
getDefault: (f: any) => number;
|
|
96
|
+
};
|
|
97
|
+
radioGroup: {
|
|
98
|
+
component: react.FunctionComponent<RadioGroupProps>;
|
|
99
|
+
getDefault: (f: any) => string;
|
|
100
|
+
};
|
|
101
|
+
ranking: {
|
|
102
|
+
component: react.FunctionComponent<RankProps>;
|
|
103
|
+
getDefault: (f: any) => any;
|
|
104
|
+
};
|
|
105
|
+
richTextfield: {
|
|
106
|
+
component: react.FunctionComponent<RichTextFieldProps>;
|
|
107
|
+
getDefault: (f: any) => any;
|
|
108
|
+
};
|
|
109
|
+
customfield: {
|
|
110
|
+
component: react.FunctionComponent<CustomFieldProps>;
|
|
111
|
+
getDefault: (f: any) => any;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
type DynamicFieldType = keyof typeof FIELD_REGISTRY;
|
|
115
|
+
type ControlProps<K extends DynamicFieldType> = ComponentProps<(typeof FIELD_REGISTRY)[K]['component']>;
|
|
116
|
+
interface FieldTypeExtras {
|
|
117
|
+
textfield: {
|
|
118
|
+
strengthIndicator?: boolean;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
type ExtrasFor<K> = K extends keyof FieldTypeExtras ? FieldTypeExtras[K] : unknown;
|
|
122
|
+
type ControlField<K extends DynamicFieldType, TValues extends FieldValues = FieldValues> = BaseField<TValues> & {
|
|
123
|
+
fieldType: K;
|
|
124
|
+
defaultValue?: ControlProps<K> extends {
|
|
125
|
+
value?: infer V;
|
|
126
|
+
} ? V : unknown;
|
|
127
|
+
} & ExtrasFor<K> & Partial<Omit<ControlProps<K>, 'value' | 'onChange' | 'name' | 'inputRef' | 'internalChange' | 'defaultValue'>>;
|
|
128
|
+
type DynamicField<TValues extends FieldValues = FieldValues> = {
|
|
129
|
+
[K in DynamicFieldType]: ControlField<K, TValues>;
|
|
130
|
+
}[DynamicFieldType];
|
|
131
|
+
type HtmlField<TValues extends FieldValues = FieldValues> = Omit<BaseField<TValues>, 'name'> & {
|
|
132
|
+
name: string;
|
|
133
|
+
fieldType: 'html';
|
|
134
|
+
content: ReactElement;
|
|
135
|
+
};
|
|
136
|
+
type FieldTypes<TValues extends FieldValues = FieldValues> = DynamicField<TValues> | HtmlField<TValues>;
|
|
137
|
+
type FieldType = FieldTypes['fieldType'];
|
|
138
|
+
|
|
139
|
+
export { FIELD_REGISTRY };
|
|
140
|
+
export type { DynamicField, DynamicFieldType, FieldType, FieldTypes, HtmlField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("../AutocompleteField/AutocompleteField.js"),t=require("../Checkbox/Checkbox.js");require("../Checkbox/StyledCheckbox.js");var l=require("../CheckboxGroup/CheckboxGroup.js"),a=require("../CreatableAutocomplete/CreatableAutocomplete.js"),u=require("../CustomField/CustomField.js"),r=require("../Differential/Differential.js"),o=require("../Likert/Likert.js"),n=require("../NumberField/NumberField.js"),i=require("../RadioGroup/RadioGroup.js"),f=require("../Rank/Rank.js"),d=require("../RichTextField/RichTextField.js");require("../SelectItem/SelectItem.js");var s=require("../Select/Select.js"),c=require("../Slider/Slider.js"),p=require("../StarRating/StarRating.js"),m=require("../Switch/Switch.js"),g=require("../Textarea/Textarea.js");const h={textfield:{component:require("../TextField/TextField.js"),getDefault:e=>e.defaultValue??""},numberfield:{component:n.default,getDefault:e=>e.defaultValue??0},textarea:{component:g,getDefault:e=>e.defaultValue??""},creatableautocomplete:{component:a,getDefault:e=>e.defaultValue??""},select:{component:s,getDefault:e=>e.defaultValue??""},autocomplete:{component:e,getDefault:e=>e.defaultValue,adapt:(e,t)=>({onChange:(e,l)=>t.onChange(l)})},checkbox:{component:t,getDefault:e=>e.defaultValue??!1},checkboxGroup:{component:l,getDefault:e=>e.defaultValue??[]},switch:{component:m,getDefault:e=>e.defaultValue??!1,adapt:e=>({label:e.label})},slider:{component:c,getDefault:e=>Array.isArray(e.defaultValue)?e.defaultValue:e.defaultValue??e.min??0,adapt:(e,t)=>({onChange:(e,l)=>t.onChange(l)})},starRating:{component:p,getDefault:e=>e.defaultValue??0,adapt:(e,t)=>({onChange:(e,l)=>t.onChange(l)})},differential:{component:r,getDefault:e=>e.defaultValue??""},likert:{component:o,getDefault:e=>e.defaultValue??""},radioGroup:{component:i,getDefault:e=>e.defaultValue??""},ranking:{component:f,getDefault:e=>e.defaultValue?e.defaultValue.map(t=>e.options.find(e=>e.id===t)):e.options},richTextfield:{component:d,getDefault:e=>e.defaultValue??""},customfield:{component:u,getDefault:e=>e.defaultValue??""}},x=["fieldType","name","ref","label","labelProps","helperText","helpTextProps","content","styleOverrides","strengthIndicator","defaultValue","hidden"],D=e=>{if(e.noneOfThese)return!0;return(e.name||e.value||"").replace(/-/g,"_").includes("none_of_these")};exports.FIELD_REGISTRY=h,exports.extractNoneOfThese=e=>{if(!e.other?.enabled||!Array.isArray(e.options))return e;const t=e.options,l=t.findIndex(D);return-1===l?e:{...e,options:t.filter((e,t)=>t!==l),noneOfTheseOption:t[l]}},exports.getDefaultValues=e=>e.reduce((e,t)=>("html"!==t.fieldType&&(e[t.name]=h[t.fieldType].getDefault(t)),e),{}),exports.getFieldDefault=e=>"html"===e.fieldType?void 0:h[e.fieldType].getDefault(e),exports.getFieldDefinition=e=>h[e],exports.splitFieldProps=e=>{const t={};for(const l of Object.keys(e))x.includes(l)||(t[l]=e[l]);return t};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import { Ref, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { FieldValues, FieldPath, Resolver, SubmitHandler, FieldErrors, UseFormSetValue, UseFormGetFieldState, UseFormTrigger, UseFormWatch } from 'react-hook-form';
|
|
4
|
+
import '../../../index.js';
|
|
5
|
+
import '../Text/types.js';
|
|
6
|
+
import { ZodType } from 'zod';
|
|
7
|
+
import { FieldTypes } from './fieldRegistry.js';
|
|
8
|
+
export { DynamicFieldType, FieldType, HtmlField } from './fieldRegistry.js';
|
|
9
|
+
import { InputLabelProps } from '../InputLabel/InputLabel.js';
|
|
10
|
+
import { InputLabelHelpProps } from '../InputLabelHelp/InputLabelHelp.js';
|
|
11
|
+
|
|
12
|
+
interface BaseField<TValues extends FieldValues = FieldValues> {
|
|
13
|
+
name: FieldPath<TValues>;
|
|
14
|
+
id?: string;
|
|
15
|
+
ref?: Ref<HTMLElement>;
|
|
16
|
+
label?: string | ReactElement;
|
|
17
|
+
labelProps?: InputLabelProps;
|
|
18
|
+
helperText?: string | ReactNode;
|
|
19
|
+
helpTextProps?: InputLabelHelpProps;
|
|
20
|
+
hidden?: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
styleOverrides?: {
|
|
23
|
+
sxInputWrapper?: SxProps<Theme>;
|
|
24
|
+
sxInputBase?: SxProps<Theme>;
|
|
25
|
+
sxInputStack?: SxProps<Theme>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface FormBuilderConfig<TValues extends FieldValues = FieldValues> {
|
|
29
|
+
fields: FieldTypes<TValues>[];
|
|
30
|
+
schema?: ZodType<TValues>;
|
|
31
|
+
resolver?: Resolver<TValues>;
|
|
32
|
+
autoComplete?: 'off';
|
|
33
|
+
mode?: 'onSubmit' | 'onBlur' | 'onChange';
|
|
34
|
+
reValidateMode?: 'onSubmit' | 'onBlur' | 'onChange';
|
|
35
|
+
formId?: string;
|
|
36
|
+
validateOnInit?: boolean;
|
|
37
|
+
disableInvalidSubmit?: boolean;
|
|
38
|
+
styleOverrides?: {
|
|
39
|
+
sxForm?: SxProps<Theme>;
|
|
40
|
+
sxButtons?: SxProps<Theme>;
|
|
41
|
+
sxStack?: SxProps<Theme>;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
interface FormBuilderHandle<TValues extends FieldValues = FieldValues> {
|
|
45
|
+
submit: () => void;
|
|
46
|
+
reset: () => void;
|
|
47
|
+
values: () => TValues;
|
|
48
|
+
valid: () => boolean;
|
|
49
|
+
errors: () => FieldErrors<TValues>;
|
|
50
|
+
focus: (name: FieldPath<TValues>) => void;
|
|
51
|
+
setValue: UseFormSetValue<TValues>;
|
|
52
|
+
getFieldState: UseFormGetFieldState<TValues>;
|
|
53
|
+
trigger: UseFormTrigger<TValues>;
|
|
54
|
+
watch: UseFormWatch<TValues>;
|
|
55
|
+
}
|
|
56
|
+
interface FormBuilderProps<TValues extends FieldValues = FieldValues> {
|
|
57
|
+
formConfig: FormBuilderConfig<TValues>;
|
|
58
|
+
onSubmit?: SubmitHandler<TValues>;
|
|
59
|
+
onChange?: (values: TValues) => void;
|
|
60
|
+
submitButton?: ReactElement;
|
|
61
|
+
secondaryButton?: ReactElement;
|
|
62
|
+
/** @deprecated alias for `onSubmit`. */
|
|
63
|
+
onFormSubmit?: SubmitHandler<TValues>;
|
|
64
|
+
/** @deprecated alias for `onChange`. */
|
|
65
|
+
onFormChange?: (values: TValues) => void;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { FieldTypes };
|
|
69
|
+
export type { BaseField, FormBuilderConfig, FormBuilderHandle, FormBuilderProps };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { FormGeneratorProps } from './types.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `FormBuilder` instead — same config shape plus zod schema validation and
|
|
5
|
+
* per-field render isolation. FormGenerator will be removed in a future major version.
|
|
6
|
+
*/
|
|
3
7
|
declare const FormGenerator: FormGeneratorProps;
|
|
4
8
|
|
|
5
9
|
export { FormGenerator as default };
|
|
@@ -9,19 +9,19 @@ import { CreatableAutocompleteProps } from '../CreatableAutocomplete/CreatableAu
|
|
|
9
9
|
import { CustomFieldProps } from '../CustomField/CustomField.js';
|
|
10
10
|
import { DifferentialProps } from '../Differential/Differential.js';
|
|
11
11
|
import '../Text/types.js';
|
|
12
|
-
import { HtmlProps } from '../Html/Html.js';
|
|
13
|
-
import { InputLabelProps } from '../InputLabel/InputLabel.js';
|
|
14
|
-
import { InputLabelHelpProps } from '../InputLabelHelp/InputLabelHelp.js';
|
|
15
|
-
import { LikertProps } from '../Likert/Likert.js';
|
|
16
|
-
import { NumberFieldProps } from '../NumberField/types.js';
|
|
17
|
-
import { RadioGroupProps } from '../RadioGroup/RadioGroup.js';
|
|
18
|
-
import { RankProps } from '../Rank/types.js';
|
|
19
12
|
import { RichTextFieldProps } from '../RichTextField/RichTextField.js';
|
|
20
|
-
import {
|
|
13
|
+
import { RankProps } from '../Rank/types.js';
|
|
14
|
+
import { RadioGroupProps } from '../RadioGroup/RadioGroup.js';
|
|
15
|
+
import { LikertProps } from '../Likert/Likert.js';
|
|
21
16
|
import { StarRatingProps } from '../StarRating/StarRating.js';
|
|
17
|
+
import { SliderProps } from '../Slider/Slider.js';
|
|
22
18
|
import { SwitchProps } from '../Switch/Switch.js';
|
|
23
19
|
import { TextareaProps } from '../Textarea/Textarea.js';
|
|
20
|
+
import { NumberFieldProps } from '../NumberField/types.js';
|
|
24
21
|
import { TextFieldProps } from '../TextField/TextField.js';
|
|
22
|
+
import { HtmlProps } from '../Html/Html.js';
|
|
23
|
+
import { InputLabelProps } from '../InputLabel/InputLabel.js';
|
|
24
|
+
import { InputLabelHelpProps } from '../InputLabelHelp/InputLabelHelp.js';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Form Generator Core Types
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("@mui/icons-material"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@mui/icons-material"),i=require("@mui/material"),s=require("../../BrandCore/Icon/Icon.js"),a=require("../InputLabelBase/InputLabelBase.js"),r=require("../utils/typography.util.js");module.exports=l=>{const{icon:n=null,state:o="default",disabled:d,showicon:u=!0,paddingLeft:c,id:p,role:x,...g}=l,m=i.useTheme();return e.jsxs(i.Box,{id:p,role:x,sx:{display:"inline-flex",alignItems:"center",paddingLeft:c,color:d?m.custom.palette.text.disabled:(()=>{switch(o){case"disabled":return m.custom.palette.text.disabled;case"positive":return m.custom.palette.text.positive;case"negative":return m.custom.palette.text.negative;default:return m.custom.palette.text.secondary}})(),"& svg":{marginRight:m.spacing(m.custom.margin.xs),width:s.iconSizeMap.xs,height:s.iconSizeMap.xs,color:"inherit"}},children:[(()=>{if(!u)return null;if(n)return n;switch(o){case"disabled":default:return e.jsx(i.Box,{sx:{height:20,display:"flex",alignItems:"center",alignSelf:"flex-start"},children:e.jsx(t.InfoOutlined,{})});case"positive":return e.jsx(i.Box,{sx:{height:20,display:"flex",alignItems:"center",alignSelf:"flex-start"},children:e.jsx(t.Check,{})});case"negative":return e.jsx(i.Box,{sx:{height:20,display:"flex",alignItems:"center",alignSelf:"flex-start"},children:e.jsx(t.ErrorOutlined,{})})}})(),e.jsx(a,{...g,disabled:d,sx:{fontSize:{xs:r.typographyVariantMap.sm.body.sm,sm:r.typographyVariantMap.sm.body.sm,md:r.typographyVariantMap.sm.body.sm,lg:r.typographyVariantMap.lg.body.sm,xl:r.typographyVariantMap.lg.body.sm}}})]})};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SelectProps as SelectProps$1 } from '@mui/material';
|
|
2
|
-
import
|
|
2
|
+
import '../../../index.js';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
4
|
import { SelectOption, SelectItemProps } from '../SelectItem/types.js';
|
|
5
|
+
import { GenericSizeMap } from '../../BrandCore/primitiveVariables.js';
|
|
5
6
|
|
|
6
7
|
type InputSizing = Exclude<GenericSizeMap, 'none' | 'xxs' | 'xxl' | 'xxxl'>;
|
|
7
8
|
type SelectProps = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useloops/design-system",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.721",
|
|
4
4
|
"description": "The official React based Loops design system",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -221,6 +221,7 @@
|
|
|
221
221
|
"@dnd-kit/utilities": "^3.2.2",
|
|
222
222
|
"@gsap/react": "^2.1.2",
|
|
223
223
|
"@hookform/error-message": "^2.0.1",
|
|
224
|
+
"@hookform/resolvers": "^5.4.0",
|
|
224
225
|
"@lottiefiles/dotlottie-react": "^0.13.5",
|
|
225
226
|
"@mui/lab": "^9.0.0-beta.4",
|
|
226
227
|
"@number-flow/react": "^0.5.14",
|
|
@@ -251,7 +252,8 @@
|
|
|
251
252
|
"react-truncate-list": "^1.0.5",
|
|
252
253
|
"stylis": "^4.4.0",
|
|
253
254
|
"stylis-plugin-rtl": "^2.1.1",
|
|
254
|
-
"yup": "^1.7.1"
|
|
255
|
+
"yup": "^1.7.1",
|
|
256
|
+
"zod": "^4.4.3"
|
|
255
257
|
},
|
|
256
258
|
"overrides": {
|
|
257
259
|
"serialize-javascript": "7.0.5",
|