@cerebruminc/cerebellum 20.0.2 → 20.0.3
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/CHANGELOG.md +8 -0
- package/package.json +2 -2
- package/src/SharedStorybook/types.ts +1 -1
- package/src/codemods/formatMdxStorybook7Update.ts +4 -2
- package/src/components/Button/Button.stories.tsx +2 -2
- package/src/components/CheckboxGroup/CheckboxGroup.stories.tsx +2 -1
- package/src/components/CheckboxItem/CheckboxItem.stories.tsx +5 -4
- package/src/components/ClickOutHandler/ClickOutHandler.stories.tsx +3 -3
- package/src/components/ColorPickerInput/ColorPickerInput.stories.tsx +2 -1
- package/src/components/ColorPickerMenu/ColorPickerMenu.stories.tsx +2 -1
- package/src/components/ConfigurableInput/ConfigurableInput.stories.tsx +2 -1
- package/src/components/ConfigurableInput/ConfigurableInput.test.tsx +1 -1
- package/src/components/ConfirmModal/ConfirmModal.stories.tsx +2 -1
- package/src/components/CreditCardInput/CreditCardInput.stories.tsx +3 -2
- package/src/components/CurrencyInput/CurrencyInput.stories.tsx +2 -1
- package/src/components/DescriptiveSwitchMenu/DescriptiveSwitchMenu.stories.tsx +3 -2
- package/src/components/Drawer/Drawer.stories.tsx +1 -1
- package/src/components/EmailInput/EmailInput.stories.tsx +2 -1
- package/src/components/FiltersBar/FiltersBar.stories.tsx +2 -1
- package/src/components/Form/Form.stories.tsx +1 -1
- package/src/components/Form/Form.test.tsx +1 -1
- package/src/components/Form/fields/AddressField/AddressField.stories.tsx +5 -4
- package/src/components/Form/fields/CheckboxField/CheckboxField.stories.tsx +4 -3
- package/src/components/Form/fields/CheckboxGroupField/CheckboxGroupField.stories.tsx +4 -3
- package/src/components/Form/fields/ColorPickerField/ColorPickerField.stories.tsx +2 -2
- package/src/components/Form/fields/ConfigurableInputField/ConfigurableInputField.stories.tsx +6 -5
- package/src/components/Form/fields/CountrySelectField/CountrySelectField.stories.tsx +4 -4
- package/src/components/Form/fields/CountySelectField/CountySelectField.stories.tsx +5 -5
- package/src/components/Form/fields/CreditCardField/CreditCardField.stories.tsx +2 -2
- package/src/components/Form/fields/CurrencyField/CurrencyField.stories.tsx +2 -2
- package/src/components/Form/fields/DatePickerField/DatePickerField.stories.tsx +7 -6
- package/src/components/Form/fields/DescriptiveDropdownInputField/DescriptiveDropdownInputField.stories.tsx +2 -2
- package/src/components/Form/fields/EmailField/EmailField.stories.tsx +2 -2
- package/src/components/Form/fields/HiddenField/HiddenField.stories.tsx +2 -2
- package/src/components/Form/fields/ImagePickerField/ImagePickerField.stories.tsx +6 -5
- package/src/components/Form/fields/MultiSelectField/MultiSelectField.stories.tsx +3 -3
- package/src/components/Form/fields/NationalitySelectField/NationalitySelectField.stories.tsx +3 -3
- package/src/components/Form/fields/NumberField/NumberField.stories.tsx +5 -4
- package/src/components/Form/fields/PasswordField/PasswordField.stories.tsx +5 -4
- package/src/components/Form/fields/PhoneField/PhoneField.stories.tsx +5 -4
- package/src/components/Form/fields/RadioGroupField/RadioGroupField.stories.tsx +4 -3
- package/src/components/Form/fields/RemovableField/RemovableField.stories.tsx +2 -2
- package/src/components/Form/fields/SectionHeader/SectionHeader.stories.tsx +2 -2
- package/src/components/Form/fields/SelectField/SelectField.stories.tsx +3 -3
- package/src/components/Form/fields/SocialSecurityField/SocialSecurityField.stories.tsx +5 -4
- package/src/components/Form/fields/SplitLineField/SplitLineField.stories.tsx +1 -1
- package/src/components/Form/fields/StateSelectField/StateSelectField.stories.tsx +3 -3
- package/src/components/Form/fields/TextField/TextField.stories.tsx +5 -4
- package/src/components/Form/fields/TextareaField/TextareaField.stories.tsx +5 -4
- package/src/components/Form/fields/ToggleField/ToggleField.stories.tsx +4 -3
- package/src/components/Form/fields/ToggleGroupField/ToggleGroupField.stories.tsx +4 -3
- package/src/components/Form/fields/ZipCodeField/ZipCodeField.stories.tsx +5 -4
- package/src/components/Form/stories/ClearingForms.stories.tsx +2 -1
- package/src/components/Form/stories/DynamicFields.stories.tsx +3 -3
- package/src/components/Form/stories/LeftLabels.stories.tsx +3 -2
- package/src/components/Form/stories/Loading.stories.tsx +2 -1
- package/src/components/Form/stories/StickyFooter.stories.tsx +2 -1
- package/src/components/HorizontalTabMenu/HorizontalTabMenu.stories.tsx +3 -2
- package/src/components/IconTile/IconTile.stories.tsx +2 -1
- package/src/components/InlineCreditCardInput/InlineCreditCardInput.stories.tsx +2 -1
- package/src/components/InlineCurrencyInput/InlineCurrencyInput.stories.tsx +2 -1
- package/src/components/InlineEmailInput/InlineEmailInput.stories.tsx +2 -1
- package/src/components/InlinePhoneInput/InlinePhoneInput.stories.tsx +2 -1
- package/src/components/InputButton/InputButton.stories.tsx +3 -2
- package/src/components/LogoSidebar/LogoSidebar.stories.tsx +3 -2
- package/src/components/Modal/Modal.stories.tsx +2 -2
- package/src/components/PasswordInput/PasswordInput.test.tsx +1 -1
- package/src/components/PhoneInput/PhoneInput.stories.tsx +2 -1
- package/src/components/RadioGroup/RadioGroup.stories.tsx +2 -1
- package/src/components/RadioItem/RadioItem.stories.tsx +5 -4
- package/src/components/Select/Select.stories.tsx +3 -2
- package/src/components/SelectSearch/SelectSearch.stories.tsx +2 -1
- package/src/components/SelectSearch/SelectSearch.test.tsx +11 -11
- package/src/components/SnackContainer/DialogHandler.stories.tsx +5 -5
- package/src/components/SsnInput/SsnInput.stories.tsx +3 -2
- package/src/components/Stepper/Stepper.stories.tsx +3 -2
- package/src/components/TabModal/TabModal.stories.tsx +5 -4
- package/src/components/Table/stories/Empty.stories.tsx +2 -2
- package/src/components/Table/stories/Filters.stories.tsx +2 -1
- package/src/components/Table/stories/Sorting.stories.tsx +2 -1
- package/src/components/Textarea/Textarea.stories.tsx +5 -4
- package/src/components/ToggleButtons/ToggleButtons.stories.tsx +2 -1
- package/src/components/ToggleGroup/ToggleGroup.stories.tsx +2 -1
- package/src/components/ToggleItem/ToggleItem.stories.tsx +3 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +4 -4
- package/src/components/TooltipLabel/TooltipLabel.stories.tsx +2 -1
- package/src/components/TooltipOptions/TooltipOptions.stories.tsx +6 -6
- package/src/components/Truncate/Truncate.stories.tsx +4 -4
- package/src/components/Typography/Typography.stories.tsx +3 -2
- package/src/components/UploadDropzone/UploadDropzone.stories.tsx +2 -1
- package/src/components/UserCard/UserCard.stories.tsx +3 -3
- package/src/components/UserCard/UserCard.test.tsx +4 -3
- package/src/components/ZipCodeInput/ZipCodeInput.stories.tsx +3 -2
- package/src/configuredComponents/AddMenu/AddMenu.stories.tsx +1 -1
- package/src/configuredComponents/ColorDotDropdown/ColorDotDropdown.stories.tsx +2 -1
- package/src/configuredComponents/ColorPicker/ColorPicker.stories.tsx +1 -1
- package/src/configuredComponents/CountryDropdown/CountryDropdown.stories.tsx +2 -1
- package/src/configuredComponents/CountyDropdown/CountyDropdown.stories.tsx +2 -1
- package/src/configuredComponents/DescriptiveDropdownInput/DescriptiveDropdownInput.stories.tsx +3 -2
- package/src/configuredComponents/DropdownButton/DropdownButton.stories.tsx +2 -1
- package/src/configuredComponents/DropdownInput/DropdownInput.stories.tsx +2 -1
- package/src/configuredComponents/IconSwitcher/IconSwitcher.stories.tsx +3 -2
- package/src/configuredComponents/InlineDescriptiveDropdown/InlineDescriptiveDropdown.stories.tsx +3 -2
- package/src/configuredComponents/InlineDropdown/InlineDropdown.stories.tsx +5 -4
- package/src/configuredComponents/MoreMenuButton/MoreMenuButton.stories.tsx +2 -1
- package/src/configuredComponents/MultiSelect/MultiSelect.stories.tsx +2 -1
- package/src/configuredComponents/NationalityDropdown/NationalityDropdown.stories.tsx +2 -1
- package/src/configuredComponents/StateDropdown/StateDropdown.stories.tsx +2 -1
- package/src/configuredComponents/StatusDropdown/StatusDropdown.stories.tsx +2 -1
- package/src/configuredComponents/TableFiltersPanel/TableFiltersPanel.stories.tsx +3 -3
- package/src/layout/LayoutSidebar/LayoutSidebar.stories.tsx +3 -2
- package/src/layout/NavLayout/NavLayout.stories.tsx +2 -1
- package/src/mantine/mantineTheme.ts +4 -2
- package/src/pages/NotFound/NotFound.stories.tsx +2 -1
- package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# react-component-lib-boilerplate
|
|
2
2
|
|
|
3
|
+
## [20.0.3](https://github.com/cerebruminc/cerebellum/compare/v20.0.2...v20.0.3) (2026-08-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **typescript:** fix wrapper type in mantineTheme after noImplicitAny update ([7388314](https://github.com/cerebruminc/cerebellum/commit/7388314753bc64ee76f5f6acc6c7238650e0b8f9))
|
|
9
|
+
* **typescript:** turn on noImplicitAny ([ab8a818](https://github.com/cerebruminc/cerebellum/commit/ab8a8182b87f808e785218bd26c8eea2bfc4c55f))
|
|
10
|
+
|
|
3
11
|
## [20.0.2](https://github.com/cerebruminc/cerebellum/compare/v20.0.1...v20.0.2) (2026-08-04)
|
|
4
12
|
|
|
5
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerebruminc/cerebellum",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.0.3",
|
|
4
4
|
"description": "Cerebrum's React Component Library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"remark-gfm": "^4.0.0",
|
|
101
101
|
"storybook": "^9.1.17",
|
|
102
102
|
"ts-jest": "29.3.4",
|
|
103
|
-
"typescript": "^5.
|
|
103
|
+
"typescript": "^5.9.3",
|
|
104
104
|
"vite": "^6.3.5",
|
|
105
105
|
"vite-plugin-babel-macros": "^1.0.6"
|
|
106
106
|
},
|
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
* Your .mdx file will still need updating, specifically moving comments into the <Description /> tag
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import type { FileInfo, API, ASTPath, ImportDeclaration } from "jscodeshift";
|
|
9
|
+
|
|
10
|
+
export default (fileInfo: FileInfo, api: API) => {
|
|
9
11
|
const j = api.jscodeshift;
|
|
10
12
|
const root = j(fileInfo.source);
|
|
11
13
|
|
|
12
14
|
// Replace import
|
|
13
15
|
root
|
|
14
16
|
.find(j.ImportDeclaration)
|
|
15
|
-
.filter((path) => !path.value.specifiers
|
|
17
|
+
.filter((path: ASTPath<ImportDeclaration>) => !path.value.specifiers?.some((s) => s.type === "ImportNamespaceSpecifier"))
|
|
16
18
|
.remove()
|
|
17
19
|
.toSource();
|
|
18
20
|
// .find(j.ImportDeclaration)
|
|
@@ -87,7 +87,7 @@ export default meta;
|
|
|
87
87
|
|
|
88
88
|
type Story = StoryObj<ButtonStorybookType>;
|
|
89
89
|
|
|
90
|
-
const Template = (args) => (
|
|
90
|
+
const Template = (args: ButtonStorybookType) => (
|
|
91
91
|
<GridContainer $bgColor={args.storyBgColor}>
|
|
92
92
|
<Cell>
|
|
93
93
|
<Label>PrimaryButton</Label>
|
|
@@ -117,7 +117,7 @@ const Template = (args) => (
|
|
|
117
117
|
</GridContainer>
|
|
118
118
|
);
|
|
119
119
|
|
|
120
|
-
const SingleButtonTemplate = (args) => (
|
|
120
|
+
const SingleButtonTemplate = (args: ButtonStorybookType) => (
|
|
121
121
|
<GridContainer>
|
|
122
122
|
<Button {...args} />
|
|
123
123
|
<Note $topMargin={30}>{args.note}</Note>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { addOrRemoveString } from "../../helpers/arrays";
|
|
4
5
|
import {
|
|
@@ -19,7 +20,7 @@ export default meta;
|
|
|
19
20
|
|
|
20
21
|
type Story = StoryObj<typeof CheckboxGroup>;
|
|
21
22
|
|
|
22
|
-
const Template = (args) => {
|
|
23
|
+
const Template = (args: ComponentProps<typeof CheckboxGroup>) => {
|
|
23
24
|
const [{ activeValues }, updateArgs] = useArgs();
|
|
24
25
|
return (
|
|
25
26
|
<CheckboxGroup
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { FlexContainer, IconContainer } from "../../SharedStorybook/Layout";
|
|
4
5
|
import { Note } from "../../SharedStorybook/Notes";
|
|
@@ -16,13 +17,13 @@ export default meta;
|
|
|
16
17
|
|
|
17
18
|
type Story = StoryObj<typeof CheckboxItem>;
|
|
18
19
|
|
|
19
|
-
const Template = (args) => {
|
|
20
|
+
const Template = (args: ComponentProps<typeof CheckboxItem>) => {
|
|
20
21
|
const [{ active }, updateArgs] = useArgs();
|
|
21
22
|
return (
|
|
22
23
|
<CheckboxItem
|
|
23
24
|
{...args}
|
|
24
25
|
onClick={(item) => {
|
|
25
|
-
args.onClick(item);
|
|
26
|
+
args.onClick?.(item);
|
|
26
27
|
updateArgs({ active: !active });
|
|
27
28
|
}}
|
|
28
29
|
active={active}
|
|
@@ -30,14 +31,14 @@ const Template = (args) => {
|
|
|
30
31
|
);
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
const LongLabelTemplate = (args) => {
|
|
34
|
+
const LongLabelTemplate = (args: ComponentProps<typeof CheckboxItem>) => {
|
|
34
35
|
const [{ active }, updateArgs] = useArgs();
|
|
35
36
|
return (
|
|
36
37
|
<FlexContainer $flexFlow="column nowrap" $gap={100}>
|
|
37
38
|
<CheckboxItem
|
|
38
39
|
{...args}
|
|
39
40
|
onClick={(item) => {
|
|
40
|
-
args.onClick(item);
|
|
41
|
+
args.onClick?.(item);
|
|
41
42
|
updateArgs({ active: !active });
|
|
42
43
|
}}
|
|
43
44
|
active={active}
|
|
@@ -31,7 +31,7 @@ export default meta;
|
|
|
31
31
|
|
|
32
32
|
type Story = StoryObj<FC<ClickOutHandlerStoryType>>;
|
|
33
33
|
|
|
34
|
-
const Template = (args) => {
|
|
34
|
+
const Template = (args: ClickOutHandlerStoryType) => {
|
|
35
35
|
const [{ storyBookShow }, updateArgs] = useArgs();
|
|
36
36
|
|
|
37
37
|
return (
|
|
@@ -47,9 +47,9 @@ const Template = (args) => {
|
|
|
47
47
|
/>
|
|
48
48
|
<ClickOutHandler
|
|
49
49
|
borderRadius={args.borderRadius}
|
|
50
|
-
handleClickAway={() => {
|
|
50
|
+
handleClickAway={(event) => {
|
|
51
51
|
updateArgs({ storyBookShow: false });
|
|
52
|
-
args.handleClickAway();
|
|
52
|
+
args.handleClickAway(event);
|
|
53
53
|
}}
|
|
54
54
|
>
|
|
55
55
|
{storyBookShow && (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { ComponentLabel } from "../../SharedStorybook/ComponentLabel";
|
|
4
5
|
import { ColorPickerInput } from "./ColorPickerInput";
|
|
@@ -11,7 +12,7 @@ export default meta;
|
|
|
11
12
|
|
|
12
13
|
type Story = StoryObj<typeof ColorPickerInput>;
|
|
13
14
|
|
|
14
|
-
const Template = (args) => {
|
|
15
|
+
const Template = (args: ComponentProps<typeof ColorPickerInput>) => {
|
|
15
16
|
const [{}, updateArgs] = useArgs();
|
|
16
17
|
return <ColorPickerInput {...args} onValueChange={(newValue) => updateArgs({ value: newValue })} />;
|
|
17
18
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { fewSwatches, manySwatches, swatches } from "../../sharedMocks/swatches";
|
|
4
5
|
import { ColorPickerMenu } from "./ColorPickerMenu";
|
|
@@ -11,7 +12,7 @@ export default meta;
|
|
|
11
12
|
|
|
12
13
|
type Story = StoryObj<typeof ColorPickerMenu>;
|
|
13
14
|
|
|
14
|
-
const Template = (args) => {
|
|
15
|
+
const Template = (args: ComponentProps<typeof ColorPickerMenu>) => {
|
|
15
16
|
const [{}, updateArgs] = useArgs();
|
|
16
17
|
return <ColorPickerMenu {...args} onSwatchSelect={(swatch) => updateArgs({ selectedSwatch: swatch.color })} />;
|
|
17
18
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { ComponentLabel } from "../../SharedStorybook/ComponentLabel";
|
|
4
5
|
import { colors } from "../../const/colors";
|
|
@@ -15,7 +16,7 @@ export default meta;
|
|
|
15
16
|
|
|
16
17
|
type Story = StoryObj<typeof ConfigurableInput>;
|
|
17
18
|
|
|
18
|
-
const Template = (args) => {
|
|
19
|
+
const Template = (args: ComponentProps<typeof ConfigurableInput>) => {
|
|
19
20
|
const [{}, updateArgs] = useArgs();
|
|
20
21
|
return <ConfigurableInput {...args} onValueChange={(value) => updateArgs({ value })} />;
|
|
21
22
|
};
|
|
@@ -135,7 +135,7 @@ describe("ConfigurableInput", () => {
|
|
|
135
135
|
const labelTwo = "Brazil";
|
|
136
136
|
const radios = [
|
|
137
137
|
{ value: "none" },
|
|
138
|
-
{ value: labelTwo, mask: (value) => applyMask({ numberValue: value, region: CountryMaskEnum.Brazil }) },
|
|
138
|
+
{ value: labelTwo, mask: (value: string) => applyMask({ numberValue: value, region: CountryMaskEnum.Brazil }) },
|
|
139
139
|
];
|
|
140
140
|
render(<ThemedConfigurableInput defaultId={labelTwo} maskedRadios={radios} value={rawString} />);
|
|
141
141
|
const inputAfterMask = screen.getByRole("textbox");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { Spacer } from "../../SharedStorybook/Layout";
|
|
4
5
|
import { colors } from "../../const/colors";
|
|
@@ -16,7 +17,7 @@ export default meta;
|
|
|
16
17
|
|
|
17
18
|
type Story = StoryObj<typeof ConfirmModal>;
|
|
18
19
|
|
|
19
|
-
const Template = (args) => {
|
|
20
|
+
const Template = (args: ComponentProps<typeof ConfirmModal> & { children?: React.ReactNode }) => {
|
|
20
21
|
const [, updateArgs] = useArgs();
|
|
21
22
|
return (
|
|
22
23
|
<Spacer $topMargin={30}>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { ComponentLabel } from "../../SharedStorybook/ComponentLabel";
|
|
4
5
|
import { luhnCreditCardCheck } from "../InlineCreditCardInput/creditCardValidators";
|
|
@@ -12,7 +13,7 @@ export default meta;
|
|
|
12
13
|
|
|
13
14
|
type Story = StoryObj<typeof CreditCardInput>;
|
|
14
15
|
|
|
15
|
-
const Template = (args) => {
|
|
16
|
+
const Template = (args: ComponentProps<typeof CreditCardInput>) => {
|
|
16
17
|
const [{}, updateArgs] = useArgs();
|
|
17
18
|
return (
|
|
18
19
|
<CreditCardInput
|
|
@@ -24,7 +25,7 @@ const Template = (args) => {
|
|
|
24
25
|
);
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
const ValidationTemplate = (args) => {
|
|
28
|
+
const ValidationTemplate = (args: ComponentProps<typeof CreditCardInput>) => {
|
|
28
29
|
const [{ value }, updateArgs] = useArgs();
|
|
29
30
|
return (
|
|
30
31
|
<CreditCardInput
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { ComponentLabelFC } from "../../SharedStorybook/ComponentLabel";
|
|
4
5
|
import { CurrencyInput } from "./CurrencyInput";
|
|
@@ -11,7 +12,7 @@ export default meta;
|
|
|
11
12
|
|
|
12
13
|
type Story = StoryObj<typeof CurrencyInput>;
|
|
13
14
|
|
|
14
|
-
const Template = (args) => {
|
|
15
|
+
const Template = (args: ComponentProps<typeof CurrencyInput>) => {
|
|
15
16
|
const [{}, updateArgs] = useArgs();
|
|
16
17
|
return (
|
|
17
18
|
<CurrencyInput
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { toggleObjectById } from "../../helpers/arrays";
|
|
4
5
|
import { DescriptiveSwitchMenu } from "./DescriptiveSwitchMenu";
|
|
@@ -17,12 +18,12 @@ export default meta;
|
|
|
17
18
|
|
|
18
19
|
type Story = StoryObj<typeof DescriptiveSwitchMenu>;
|
|
19
20
|
|
|
20
|
-
const Template = (args) => {
|
|
21
|
+
const Template = (args: ComponentProps<typeof DescriptiveSwitchMenu>) => {
|
|
21
22
|
const [{}, updateArgs] = useArgs();
|
|
22
23
|
return <DescriptiveSwitchMenu {...args} onSelect={(option) => updateArgs({ activeRadioId: option.value })} />;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
const CheckboxTemplate = (args) => {
|
|
26
|
+
const CheckboxTemplate = (args: ComponentProps<typeof DescriptiveSwitchMenu>) => {
|
|
26
27
|
const [{ options }, updateArgs] = useArgs();
|
|
27
28
|
return (
|
|
28
29
|
<DescriptiveSwitchMenu
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { ComponentLabel } from "../../SharedStorybook/ComponentLabel";
|
|
4
5
|
import { EmailInput } from "./EmailInput";
|
|
@@ -11,7 +12,7 @@ export default meta;
|
|
|
11
12
|
|
|
12
13
|
type Story = StoryObj<typeof EmailInput>;
|
|
13
14
|
|
|
14
|
-
const Template = (args) => {
|
|
15
|
+
const Template = (args: ComponentProps<typeof EmailInput>) => {
|
|
15
16
|
const [{}, updateArgs] = useArgs();
|
|
16
17
|
return <EmailInput {...args} onValueChange={(newValue) => updateArgs({ value: newValue })} />;
|
|
17
18
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { useArgs } from "storybook/preview-api";
|
|
3
4
|
import { removeById, removeByIdArray } from "../../helpers/arrays";
|
|
4
5
|
import { ButtonColorFamilyEnum } from "../../sharedTypes/enums";
|
|
@@ -12,7 +13,7 @@ export default meta;
|
|
|
12
13
|
|
|
13
14
|
type Story = StoryObj<typeof FiltersBar>;
|
|
14
15
|
|
|
15
|
-
const Template = (args) => {
|
|
16
|
+
const Template = (args: ComponentProps<typeof FiltersBar>) => {
|
|
16
17
|
const [{ filters }, updateArgs] = useArgs();
|
|
17
18
|
return (
|
|
18
19
|
<FiltersBar
|
|
@@ -26,7 +26,7 @@ export default meta;
|
|
|
26
26
|
|
|
27
27
|
type Story = StoryObj<FormStorybookType>;
|
|
28
28
|
|
|
29
|
-
const Template = (args) => (
|
|
29
|
+
const Template = (args: FormStorybookType) => (
|
|
30
30
|
<RelativeContainer $bgColor={colors.COOL_GREY_4} $paddingString={"20px 0"}>
|
|
31
31
|
<FormWrapper $maxWidth={args.maxWidth}>
|
|
32
32
|
<FormikContainer {...args} />
|
|
@@ -697,7 +697,7 @@ describe("Form", () => {
|
|
|
697
697
|
const labelTwo = "Brazil";
|
|
698
698
|
const radios = [
|
|
699
699
|
{ value: defaultRadioLabel },
|
|
700
|
-
{ value: labelTwo, mask: (value) => applyMask({ numberValue: value, region: CountryMaskEnum.Brazil }) },
|
|
700
|
+
{ value: labelTwo, mask: (value: string) => applyMask({ numberValue: value, region: CountryMaskEnum.Brazil }) },
|
|
701
701
|
];
|
|
702
702
|
const fields = [
|
|
703
703
|
{
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { FocusEvent } from "react";
|
|
2
3
|
import { Location } from "../../../../index";
|
|
3
4
|
import { FormWrapper } from "../../FormStyles";
|
|
4
5
|
import { FormikContainer } from "../../FormikContainer";
|
|
5
6
|
import { addressFields } from "../../mocks/fields";
|
|
6
|
-
import { FormFieldTypeEnum } from "../../types";
|
|
7
|
+
import { FormFieldTypeEnum, FormStorybookType } from "../../types";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* `Address` is a text input that is hooked up to Google maps. You must pass a `googleMapsAPIKey` to `Form` to enable this field.
|
|
@@ -15,7 +16,7 @@ export default meta;
|
|
|
15
16
|
|
|
16
17
|
type Story = StoryObj<typeof FormikContainer>;
|
|
17
18
|
|
|
18
|
-
const Template = (args) => (
|
|
19
|
+
const Template = (args: FormStorybookType) => (
|
|
19
20
|
<FormWrapper $maxWidth={args.maxWidth}>
|
|
20
21
|
<FormikContainer {...args} />
|
|
21
22
|
</FormWrapper>
|
|
@@ -50,9 +51,9 @@ export const AddressOptions: Story = {
|
|
|
50
51
|
helperText: "You can configure the options, like 'helperText', in field[n].options",
|
|
51
52
|
LeadingIcon: Location,
|
|
52
53
|
onEnter: () => console.log("onEnter - text"),
|
|
53
|
-
onInputBlur: (event) => console.log("onInputBlur - text", event),
|
|
54
|
+
onInputBlur: (event: FocusEvent<HTMLInputElement>) => console.log("onInputBlur - text", event),
|
|
54
55
|
onInputFocus: () => console.log("onInputFocus - text"),
|
|
55
|
-
onChange: (event) => console.log("onChange - text", event),
|
|
56
|
+
onChange: (event: { target: { value: string; name?: string } }) => console.log("onChange - text", event),
|
|
56
57
|
placeholder: "Where do you live?",
|
|
57
58
|
},
|
|
58
59
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ChangeEvent } from "react";
|
|
2
3
|
import { FormWrapper } from "../../FormStyles";
|
|
3
4
|
import { FormikContainer } from "../../FormikContainer";
|
|
4
|
-
import { FormFieldTypeEnum } from "../../types";
|
|
5
|
+
import { FormFieldTypeEnum, FormStorybookType } from "../../types";
|
|
5
6
|
|
|
6
7
|
/** `Checkbox` is a single checkbox input and label. For multiple checkboxes, use `CheckboxGroup`. */
|
|
7
8
|
const meta: Meta<typeof FormikContainer> = { component: FormikContainer, title: "organisms/Form/Fields/Checkbox" };
|
|
@@ -9,7 +10,7 @@ export default meta;
|
|
|
9
10
|
|
|
10
11
|
type Story = StoryObj<typeof FormikContainer>;
|
|
11
12
|
|
|
12
|
-
const Template = (args) => (
|
|
13
|
+
const Template = (args: FormStorybookType) => (
|
|
13
14
|
<FormWrapper $maxWidth={args.maxWidth}>
|
|
14
15
|
<FormikContainer {...args} />
|
|
15
16
|
</FormWrapper>
|
|
@@ -41,7 +42,7 @@ export const CheckboxOptions: Story = {
|
|
|
41
42
|
type: FormFieldTypeEnum.Checkbox,
|
|
42
43
|
options: {
|
|
43
44
|
center: true,
|
|
44
|
-
onCheckboxClick: (event) => console.log("onCheckboxClick", event),
|
|
45
|
+
onCheckboxClick: (event: ChangeEvent<HTMLInputElement>) => console.log("onCheckboxClick", event),
|
|
45
46
|
leftLabel: "this is the 'leftLabel'",
|
|
46
47
|
},
|
|
47
48
|
},
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ChangeEvent } from "react";
|
|
2
3
|
import { FormWrapper } from "../../FormStyles";
|
|
3
4
|
import { FormikContainer } from "../../FormikContainer";
|
|
4
5
|
import { switches } from "../../mocks/switches";
|
|
5
|
-
import { FormFieldTypeEnum } from "../../types";
|
|
6
|
+
import { FormFieldTypeEnum, FormStorybookType } from "../../types";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* `CheckboxGroup` is a group of checkboxes with labels. For a single checkbox, use `Checkbox`.
|
|
@@ -14,7 +15,7 @@ export default meta;
|
|
|
14
15
|
|
|
15
16
|
type Story = StoryObj<typeof FormikContainer>;
|
|
16
17
|
|
|
17
|
-
const Template = (args) => (
|
|
18
|
+
const Template = (args: FormStorybookType) => (
|
|
18
19
|
<FormWrapper $maxWidth={args.maxWidth}>
|
|
19
20
|
<FormikContainer {...args} />
|
|
20
21
|
</FormWrapper>
|
|
@@ -71,7 +72,7 @@ export const CheckboxGroupOptions: Story = {
|
|
|
71
72
|
|
|
72
73
|
options: {
|
|
73
74
|
checkboxes: switches,
|
|
74
|
-
onCheckboxClick: (event) => console.log("onCheckboxClick", event),
|
|
75
|
+
onCheckboxClick: (event: ChangeEvent<HTMLInputElement>) => console.log("onCheckboxClick", event),
|
|
75
76
|
helperText: "This is the 'helperText'",
|
|
76
77
|
label: "CheckboxGroup with options",
|
|
77
78
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { FormWrapper } from "../../FormStyles";
|
|
3
3
|
import { FormikContainer } from "../../FormikContainer";
|
|
4
|
-
import { FormFieldTypeEnum } from "../../types";
|
|
4
|
+
import { FormFieldTypeEnum, FormStorybookType } from "../../types";
|
|
5
5
|
|
|
6
6
|
/** `ColorPicker` is a native HTML color picker input that allows users to select colors. It supports optional contrast validation to ensure legibility. */
|
|
7
7
|
const meta: Meta<typeof FormikContainer> = { component: FormikContainer, title: "organisms/Form/Fields/ColorPicker" };
|
|
@@ -9,7 +9,7 @@ export default meta;
|
|
|
9
9
|
|
|
10
10
|
type Story = StoryObj<typeof FormikContainer>;
|
|
11
11
|
|
|
12
|
-
const Template = (args) => (
|
|
12
|
+
const Template = (args: FormStorybookType) => (
|
|
13
13
|
<FormWrapper $maxWidth={args.maxWidth}>
|
|
14
14
|
<FormikContainer {...args} />
|
|
15
15
|
</FormWrapper>
|
package/src/components/Form/fields/ConfigurableInputField/ConfigurableInputField.stories.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { FocusEvent } from "react";
|
|
2
3
|
import { maskedRadios, maskedRadiosWithValidation } from "../../../ConfigurableInput/mocks";
|
|
3
4
|
import { FormWrapper } from "../../FormStyles";
|
|
4
5
|
import { FormikContainer } from "../../FormikContainer";
|
|
5
|
-
import { FormFieldTypeEnum } from "../../types";
|
|
6
|
+
import { FormFieldTypeEnum, FormStorybookType } from "../../types";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* `ConfigurableInput` uses a group of radio buttons to apply specific masks and/or placeholder text to an input.
|
|
@@ -12,7 +13,7 @@ export default meta;
|
|
|
12
13
|
|
|
13
14
|
type Story = StoryObj<typeof FormikContainer>;
|
|
14
15
|
|
|
15
|
-
const Template = (args) => (
|
|
16
|
+
const Template = (args: FormStorybookType) => (
|
|
16
17
|
<FormWrapper $maxWidth={args.maxWidth}>
|
|
17
18
|
<FormikContainer {...args} />
|
|
18
19
|
</FormWrapper>
|
|
@@ -59,10 +60,10 @@ export const ConfigurableInputOptions: Story = {
|
|
|
59
60
|
maskedRadios,
|
|
60
61
|
maxRadioLabelWidth: 50,
|
|
61
62
|
onEnter: () => console.log("onEnter - ConfigurableInput"),
|
|
62
|
-
onInputBlur: (event) => console.log("onInputBlur - ConfigurableInput", event),
|
|
63
|
+
onInputBlur: (event: FocusEvent<HTMLInputElement>) => console.log("onInputBlur - ConfigurableInput", event),
|
|
63
64
|
onInputFocus: () => console.log("onInputFocus - ConfigurableInput"),
|
|
64
|
-
onChange: (event) => console.log("onChange - ConfigurableInput", event),
|
|
65
|
-
onRadioClick: (
|
|
65
|
+
onChange: (event: { target: { value: string; name?: string } }) => console.log("onChange - ConfigurableInput", event),
|
|
66
|
+
onRadioClick: (id: string) => console.log("onRadioClick - ConfigurableInput", id),
|
|
66
67
|
placeholder: "Type something",
|
|
67
68
|
type: "text",
|
|
68
69
|
vertical: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { FormWrapper } from "../../FormStyles";
|
|
3
3
|
import { FormikContainer } from "../../FormikContainer";
|
|
4
|
-
import { FormFieldTypeEnum } from "../../types";
|
|
4
|
+
import { FormFieldTypeEnum, FormStorybookType, SelectOptionType } from "../../types";
|
|
5
5
|
import { DynamicLabelsExample } from "./DynamicLabelsExample";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -12,13 +12,13 @@ export default meta;
|
|
|
12
12
|
|
|
13
13
|
type Story = StoryObj<typeof FormikContainer>;
|
|
14
14
|
|
|
15
|
-
const Template = (args) => (
|
|
15
|
+
const Template = (args: FormStorybookType) => (
|
|
16
16
|
<FormWrapper $maxWidth={args.maxWidth}>
|
|
17
17
|
<FormikContainer {...args} />
|
|
18
18
|
</FormWrapper>
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
const DynamicLabelsTemplate = (
|
|
21
|
+
const DynamicLabelsTemplate = (_args: FormStorybookType) => <DynamicLabelsExample />;
|
|
22
22
|
|
|
23
23
|
/** This is `FormFieldTypeEnum.CountrySelect` with the default options */
|
|
24
24
|
export const CountrySelect: Story = {
|
|
@@ -52,7 +52,7 @@ export const CountrySelectOptions: Story = {
|
|
|
52
52
|
width: 400,
|
|
53
53
|
initialValue: "us",
|
|
54
54
|
options: {
|
|
55
|
-
onSelect: (event) => console.log("onSelect", event),
|
|
55
|
+
onSelect: (event: SelectOptionType | undefined) => console.log("onSelect", event),
|
|
56
56
|
helperText: "This is the 'helperText', It's okay if this is a bit longer",
|
|
57
57
|
innerSearch: true,
|
|
58
58
|
label: "CountrySelect with options",
|
|
@@ -2,7 +2,7 @@ import { Meta, StoryObj } from "@storybook/react";
|
|
|
2
2
|
import { USStatesEnum } from "../../../../sharedTypes/enums";
|
|
3
3
|
import { FormWrapper } from "../../FormStyles";
|
|
4
4
|
import { FormikContainer } from "../../FormikContainer";
|
|
5
|
-
import { FormFieldTypeEnum } from "../../types";
|
|
5
|
+
import { FormFieldTypeEnum, FormStorybookType, SelectOptionType } from "../../types";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* `CountySelect` is a select component preconfigured to support US Counties. It will be blank unless `state` is provided
|
|
@@ -12,7 +12,7 @@ export default meta;
|
|
|
12
12
|
|
|
13
13
|
type Story = StoryObj<typeof FormikContainer>;
|
|
14
14
|
|
|
15
|
-
const Template = (args) => (
|
|
15
|
+
const Template = (args: FormStorybookType) => (
|
|
16
16
|
<FormWrapper $maxWidth={args.maxWidth}>
|
|
17
17
|
<FormikContainer {...args} />
|
|
18
18
|
</FormWrapper>
|
|
@@ -51,7 +51,7 @@ export const CountySelectOptions: Story = {
|
|
|
51
51
|
width: 400,
|
|
52
52
|
initialValue: "Angelina",
|
|
53
53
|
options: {
|
|
54
|
-
onSelect: (event) => console.log("onSelect", event),
|
|
54
|
+
onSelect: (event: SelectOptionType | undefined) => console.log("onSelect", event),
|
|
55
55
|
helperText: "This is the 'helperText', It's okay if this is a bit longer",
|
|
56
56
|
innerSearch: true,
|
|
57
57
|
label: "CountySelect with options",
|
|
@@ -82,7 +82,7 @@ export const WithStatePicker: Story = {
|
|
|
82
82
|
width: 400,
|
|
83
83
|
options: {
|
|
84
84
|
countyFieldName: "County",
|
|
85
|
-
onSelect: (event) => console.log("onSelect", event),
|
|
85
|
+
onSelect: (event: SelectOptionType | undefined) => console.log("onSelect", event),
|
|
86
86
|
placeholder: "Select a state",
|
|
87
87
|
},
|
|
88
88
|
},
|
|
@@ -92,7 +92,7 @@ export const WithStatePicker: Story = {
|
|
|
92
92
|
type: FormFieldTypeEnum.CountySelect,
|
|
93
93
|
width: 400,
|
|
94
94
|
options: {
|
|
95
|
-
onSelect: (event) => console.log("onSelect", event),
|
|
95
|
+
onSelect: (event: SelectOptionType | undefined) => console.log("onSelect", event),
|
|
96
96
|
helperText: "This will be disabled until a State is selected",
|
|
97
97
|
placeholder: "Select a county",
|
|
98
98
|
stateFieldName: "State",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { FormWrapper } from "../../FormStyles";
|
|
3
3
|
import { FormikContainer } from "../../FormikContainer";
|
|
4
|
-
import { FormFieldTypeEnum } from "../../types";
|
|
4
|
+
import { FormFieldTypeEnum, FormStorybookType } from "../../types";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* `CreditCard` is a text input configured for credit cards, with an inbuilt `CreditCard` icon and string formatting support. It accepts a string as a value, but only accepts digits internally. The returned value is also a string. The credit card issuer will be shown as a TrailingText, but it can be removed through the `hideCardName` prop.
|
|
@@ -11,7 +11,7 @@ export default meta;
|
|
|
11
11
|
|
|
12
12
|
type Story = StoryObj<typeof FormikContainer>;
|
|
13
13
|
|
|
14
|
-
const Template = (args) => (
|
|
14
|
+
const Template = (args: FormStorybookType) => (
|
|
15
15
|
<FormWrapper $maxWidth={args.maxWidth}>
|
|
16
16
|
<FormikContainer {...args} />
|
|
17
17
|
</FormWrapper>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { FormWrapper } from "../../FormStyles";
|
|
3
3
|
import { FormikContainer } from "../../FormikContainer";
|
|
4
|
-
import { FormFieldTypeEnum } from "../../types";
|
|
4
|
+
import { FormFieldTypeEnum, FormStorybookType } from "../../types";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* `Currency` is a text input configured for currency. It accepts numbers, but converts this into a formatted string for legibility.
|
|
@@ -13,7 +13,7 @@ export default meta;
|
|
|
13
13
|
|
|
14
14
|
type Story = StoryObj<typeof FormikContainer>;
|
|
15
15
|
|
|
16
|
-
const Template = (args) => (
|
|
16
|
+
const Template = (args: FormStorybookType) => (
|
|
17
17
|
<FormWrapper $maxWidth={args.maxWidth}>
|
|
18
18
|
<FormikContainer {...args} />
|
|
19
19
|
</FormWrapper>
|