@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
|
@@ -65,7 +65,7 @@ export const DynamicFields: Story = {
|
|
|
65
65
|
.string()
|
|
66
66
|
.email("Invalid Email")
|
|
67
67
|
.when("Select a chunk of the form to show", {
|
|
68
|
-
is: (val) => val.includes("groupTwo"),
|
|
68
|
+
is: (val: string[]) => val.includes("groupTwo"),
|
|
69
69
|
then: yup.string().email("Invalid Email").required("Please enter your email"),
|
|
70
70
|
}),
|
|
71
71
|
},
|
|
@@ -79,7 +79,7 @@ export const DynamicFields: Story = {
|
|
|
79
79
|
required: true,
|
|
80
80
|
showIf: ({ values }) => values["Select a chunk of the form to show"].includes("groupTwo"),
|
|
81
81
|
validationFunction: yup.number().when("Select a chunk of the form to show", {
|
|
82
|
-
is: (val) => val.includes("groupTwo"),
|
|
82
|
+
is: (val: string[]) => val.includes("groupTwo"),
|
|
83
83
|
then: yup.number().required("Please enter your anual salary"),
|
|
84
84
|
}),
|
|
85
85
|
},
|
|
@@ -94,7 +94,7 @@ export const DynamicFields: Story = {
|
|
|
94
94
|
required: true,
|
|
95
95
|
showIf: ({ values }) => values["Select a chunk of the form to show"].includes("groupTwo"),
|
|
96
96
|
validationFunction: yup.string().when("Select a chunk of the form to show", {
|
|
97
|
-
is: (val) => val.includes("groupTwo"),
|
|
97
|
+
is: (val: string[]) => val.includes("groupTwo"),
|
|
98
98
|
then: yup.string().required("Please enter a valid credit card number"),
|
|
99
99
|
}),
|
|
100
100
|
},
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { RelativeContainer } from "../../../SharedStorybook/Layout";
|
|
3
4
|
import { colors } from "../../../const/colors";
|
|
4
5
|
import { FormWrapper } from "../FormStyles";
|
|
5
6
|
import { FormikContainer } from "../FormikContainer";
|
|
6
7
|
import { allFieldTypes } from "../mocks/fields";
|
|
7
8
|
|
|
8
|
-
/**
|
|
9
|
+
/**
|
|
9
10
|
* `leftLabels` will change the layout of the `Form` to put the labels on the left side. This is useful to conserve space with longer forms, but is not appropriate on narrow screens.
|
|
10
11
|
|
|
11
12
|
Please note that this format is not an excuse to use longer `fieldLabels`. They should remain as short as possible for easy of legibility. In addition, long, wrapping labels will break the layout, especially if `helperText` is used.
|
|
@@ -18,7 +19,7 @@ export default meta;
|
|
|
18
19
|
|
|
19
20
|
type Story = StoryObj<typeof FormikContainer>;
|
|
20
21
|
|
|
21
|
-
const Template = (args) => (
|
|
22
|
+
const Template = (args: ComponentProps<typeof FormikContainer>) => (
|
|
22
23
|
<RelativeContainer $bgColor={colors.COOL_GREY_4} $paddingString={"20px 0"}>
|
|
23
24
|
<FormWrapper>
|
|
24
25
|
<FormikContainer {...args} />
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { RelativeContainer } from "../../../SharedStorybook/Layout";
|
|
3
4
|
import { colors } from "../../../const/colors";
|
|
4
5
|
import { FormWrapper } from "../FormStyles";
|
|
@@ -11,7 +12,7 @@ export default meta;
|
|
|
11
12
|
|
|
12
13
|
type Story = StoryObj<typeof FormikContainer>;
|
|
13
14
|
|
|
14
|
-
const Template = (args) => (
|
|
15
|
+
const Template = (args: ComponentProps<typeof FormikContainer>) => (
|
|
15
16
|
<RelativeContainer $bgColor={colors.COOL_GREY_4} $paddingString={"20px 0"}>
|
|
16
17
|
<FormWrapper>
|
|
17
18
|
<FormikContainer {...args} />
|
|
@@ -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 { CenterIt, GridContainer } from "../../../SharedStorybook/GridStyles";
|
|
4
5
|
import { ButtonColorFamilyEnum } from "../../../sharedTypes/enums";
|
|
@@ -17,7 +18,7 @@ export default meta;
|
|
|
17
18
|
|
|
18
19
|
type Story = StoryObj<typeof FormikContainer>;
|
|
19
20
|
|
|
20
|
-
const ModalTemplate = (args) => {
|
|
21
|
+
const ModalTemplate = (args: ComponentProps<typeof FormikContainer> & { show?: boolean; closeFunction?: () => void }) => {
|
|
21
22
|
const [{ show }, updateArgs] = useArgs();
|
|
22
23
|
let windowHeight = 0;
|
|
23
24
|
if (typeof window !== "undefined" || process.env.STORYBOOK) {
|
|
@@ -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 { ElementSpacing, Spacer } from "../../SharedStorybook/Layout";
|
|
4
5
|
import { colors } from "../../const/colors";
|
|
@@ -20,7 +21,7 @@ export default meta;
|
|
|
20
21
|
|
|
21
22
|
type Story = StoryObj<typeof HorizontalTabMenu>;
|
|
22
23
|
|
|
23
|
-
const ScrollTemplate = (args) => {
|
|
24
|
+
const ScrollTemplate = (args: ComponentProps<typeof HorizontalTabMenu>) => {
|
|
24
25
|
return (
|
|
25
26
|
<Spacer $width={350}>
|
|
26
27
|
<HorizontalTabMenu {...args} />
|
|
@@ -28,7 +29,7 @@ const ScrollTemplate = (args) => {
|
|
|
28
29
|
);
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
const AlertTemplate = (args) => {
|
|
32
|
+
const AlertTemplate = (args: ComponentProps<typeof HorizontalTabMenu>) => {
|
|
32
33
|
const [{ options }, updateArgs] = useArgs();
|
|
33
34
|
return (
|
|
34
35
|
<>
|
|
@@ -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 { menuOptions } from "../../sharedMocks/options";
|
|
4
5
|
import { ButtonColorFamilyEnum } from "../../sharedTypes/enums";
|
|
@@ -13,7 +14,7 @@ export default meta;
|
|
|
13
14
|
|
|
14
15
|
type Story = StoryObj<typeof IconTile>;
|
|
15
16
|
|
|
16
|
-
const Template = (args) => {
|
|
17
|
+
const Template = (args: ComponentProps<typeof IconTile>) => {
|
|
17
18
|
const [{ active }, updateArgs] = useArgs();
|
|
18
19
|
return <IconTile {...args} onButtonClick={() => updateArgs({ active: !active })} />;
|
|
19
20
|
};
|
|
@@ -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 { InlineCreditCardInput } from "./InlineCreditCardInput";
|
|
4
5
|
|
|
@@ -16,7 +17,7 @@ export default meta;
|
|
|
16
17
|
|
|
17
18
|
type Story = StoryObj<typeof InlineCreditCardInput>;
|
|
18
19
|
|
|
19
|
-
const Template = (args) => {
|
|
20
|
+
const Template = (args: ComponentProps<typeof InlineCreditCardInput>) => {
|
|
20
21
|
const [{}, updateArgs] = useArgs();
|
|
21
22
|
return <InlineCreditCardInput {...args} onValueChange={(newValue) => updateArgs({ value: newValue })} />;
|
|
22
23
|
};
|
|
@@ -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 { InlineCurrencyInput } from "./InlineCurrencyInput";
|
|
4
5
|
|
|
@@ -50,7 +51,7 @@ export default meta;
|
|
|
50
51
|
|
|
51
52
|
type Story = StoryObj<typeof InlineCurrencyInput>;
|
|
52
53
|
|
|
53
|
-
const Template = (args) => {
|
|
54
|
+
const Template = (args: ComponentProps<typeof InlineCurrencyInput>) => {
|
|
54
55
|
const [{}, updateArgs] = useArgs();
|
|
55
56
|
return (
|
|
56
57
|
<InlineCurrencyInput
|
|
@@ -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 { InlineEmailInput } from "./InlineEmailInput";
|
|
4
5
|
|
|
@@ -10,7 +11,7 @@ export default meta;
|
|
|
10
11
|
|
|
11
12
|
type Story = StoryObj<typeof InlineEmailInput>;
|
|
12
13
|
|
|
13
|
-
const Template = (args) => {
|
|
14
|
+
const Template = (args: ComponentProps<typeof InlineEmailInput>) => {
|
|
14
15
|
const [{}, updateArgs] = useArgs();
|
|
15
16
|
return <InlineEmailInput {...args} onValueChange={(newValue) => updateArgs({ value: newValue })} />;
|
|
16
17
|
};
|
|
@@ -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 { CountryMaskEnum } from "../../sharedTypes/enums";
|
|
4
5
|
import { InlinePhoneInput } from "./InlinePhoneInput";
|
|
@@ -18,7 +19,7 @@ export default meta;
|
|
|
18
19
|
|
|
19
20
|
type Story = StoryObj<typeof InlinePhoneInput>;
|
|
20
21
|
|
|
21
|
-
const Template = (args) => {
|
|
22
|
+
const Template = (args: ComponentProps<typeof InlinePhoneInput>) => {
|
|
22
23
|
const [{}, updateArgs] = useArgs();
|
|
23
24
|
return <InlinePhoneInput {...args} onValueChange={(newValue) => updateArgs({ value: newValue })} />;
|
|
24
25
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { Employee, Eye } from "../Icons";
|
|
3
4
|
import { InlineInputButton } from "./InlineInputButton";
|
|
4
5
|
import { InputButton } from "./InputButton";
|
|
@@ -9,8 +10,8 @@ export default meta;
|
|
|
9
10
|
|
|
10
11
|
type Story = StoryObj<typeof InputButton>;
|
|
11
12
|
|
|
12
|
-
const Template = (args) => <InputButton {...args} />;
|
|
13
|
-
const InlineTemplate = (args) => <InlineInputButton {...args} />;
|
|
13
|
+
const Template = (args: ComponentProps<typeof InputButton>) => <InputButton {...args} />;
|
|
14
|
+
const InlineTemplate = (args: ComponentProps<typeof InlineInputButton>) => <InlineInputButton {...args} />;
|
|
14
15
|
|
|
15
16
|
export const Default: Story = {
|
|
16
17
|
render: Template.bind({}),
|
|
@@ -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 { Configure, Email, No, Send } from "../Icons";
|
|
4
5
|
import { LogoSidebar } from "./LogoSidebar";
|
|
@@ -20,7 +21,7 @@ export default meta;
|
|
|
20
21
|
|
|
21
22
|
type Story = StoryObj<typeof LogoSidebar>;
|
|
22
23
|
|
|
23
|
-
const Template = (args) => {
|
|
24
|
+
const Template = (args: ComponentProps<typeof LogoSidebar>) => {
|
|
24
25
|
const [, updateArgs] = useArgs();
|
|
25
26
|
const links = [
|
|
26
27
|
{
|
|
@@ -59,7 +60,7 @@ const Template = (args) => {
|
|
|
59
60
|
);
|
|
60
61
|
};
|
|
61
62
|
|
|
62
|
-
const StandardTemplate = (args) => {
|
|
63
|
+
const StandardTemplate = (args: ComponentProps<typeof LogoSidebar>) => {
|
|
63
64
|
return (
|
|
64
65
|
<SidebarParent>
|
|
65
66
|
<LogoSidebar {...args} />
|
|
@@ -37,7 +37,7 @@ export default meta;
|
|
|
37
37
|
|
|
38
38
|
type Story = StoryObj<FC<ModalStorybookType>>;
|
|
39
39
|
|
|
40
|
-
const Template = (args) => {
|
|
40
|
+
const Template = (args: ModalStorybookType) => {
|
|
41
41
|
const [{ show }, updateArgs] = useArgs();
|
|
42
42
|
return (
|
|
43
43
|
<GridContainer>
|
|
@@ -66,7 +66,7 @@ const Template = (args) => {
|
|
|
66
66
|
);
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
const FocusTemplate = (args) => {
|
|
69
|
+
const FocusTemplate = (args: ModalStorybookType) => {
|
|
70
70
|
const [{ show }, updateArgs] = useArgs();
|
|
71
71
|
const focusRef = useRef(null);
|
|
72
72
|
return (
|
|
@@ -7,7 +7,7 @@ const ThemedPasswordInput = withTheme(PasswordInput);
|
|
|
7
7
|
const ThemedInlinePasswordInput = withTheme(InlinePasswordInput);
|
|
8
8
|
|
|
9
9
|
// Since we have so many tests for the password messages, this will prevent a small amount of duplication
|
|
10
|
-
const testPasswordValidation = async (password, expectedMessage) => {
|
|
10
|
+
const testPasswordValidation = async (password: string, expectedMessage: string) => {
|
|
11
11
|
render(<ThemedPasswordInput value={password} />);
|
|
12
12
|
await waitFor(() => expect(screen.getByText(expectedMessage)).toBeInTheDocument());
|
|
13
13
|
};
|
|
@@ -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 { PhoneInput } from "./PhoneInput";
|
|
@@ -11,7 +12,7 @@ export default meta;
|
|
|
11
12
|
|
|
12
13
|
type Story = StoryObj<typeof PhoneInput>;
|
|
13
14
|
|
|
14
|
-
const Template = (args) => {
|
|
15
|
+
const Template = (args: ComponentProps<typeof PhoneInput>) => {
|
|
15
16
|
const [{}, updateArgs] = useArgs();
|
|
16
17
|
return (
|
|
17
18
|
<PhoneInput
|
|
@@ -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 { radioExamples, radioStateExamples } from "../../sharedMocks/options";
|
|
4
5
|
import { RadioGroup } from "./RadioGroup";
|
|
@@ -13,7 +14,7 @@ export default meta;
|
|
|
13
14
|
|
|
14
15
|
type Story = StoryObj<typeof RadioGroup>;
|
|
15
16
|
|
|
16
|
-
const Template = (args) => {
|
|
17
|
+
const Template = (args: ComponentProps<typeof RadioGroup>) => {
|
|
17
18
|
const [, updateArgs] = useArgs();
|
|
18
19
|
return (
|
|
19
20
|
<RadioGroup
|
|
@@ -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";
|
|
@@ -15,13 +16,13 @@ export default meta;
|
|
|
15
16
|
|
|
16
17
|
type Story = StoryObj<typeof RadioItem>;
|
|
17
18
|
|
|
18
|
-
const Template = (args) => {
|
|
19
|
+
const Template = (args: ComponentProps<typeof RadioItem>) => {
|
|
19
20
|
const [{ active }, updateArgs] = useArgs();
|
|
20
21
|
return (
|
|
21
22
|
<RadioItem
|
|
22
23
|
{...args}
|
|
23
24
|
onRadioClick={(item) => {
|
|
24
|
-
args.onRadioClick(item);
|
|
25
|
+
args.onRadioClick?.(item);
|
|
25
26
|
updateArgs({ active: !active });
|
|
26
27
|
}}
|
|
27
28
|
active={active}
|
|
@@ -29,14 +30,14 @@ const Template = (args) => {
|
|
|
29
30
|
);
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
const LongLabelTemplate = (args) => {
|
|
33
|
+
const LongLabelTemplate = (args: ComponentProps<typeof RadioItem>) => {
|
|
33
34
|
const [{ active }, updateArgs] = useArgs();
|
|
34
35
|
return (
|
|
35
36
|
<FlexContainer $flexFlow="column nowrap" $gap={100}>
|
|
36
37
|
<RadioItem
|
|
37
38
|
{...args}
|
|
38
39
|
onRadioClick={(item) => {
|
|
39
|
-
args.onRadioClick(item);
|
|
40
|
+
args.onRadioClick?.(item);
|
|
40
41
|
updateArgs({ active: !active });
|
|
41
42
|
}}
|
|
42
43
|
active={active}
|
|
@@ -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, SmallComponentLabel } from "../../SharedStorybook/ComponentLabel";
|
|
4
5
|
import { Spacer } from "../../SharedStorybook/Layout";
|
|
@@ -20,7 +21,7 @@ export default meta;
|
|
|
20
21
|
|
|
21
22
|
type Story = StoryObj<typeof Select>;
|
|
22
23
|
|
|
23
|
-
const Template = (args) => {
|
|
24
|
+
const Template = (args: ComponentProps<typeof Select>) => {
|
|
24
25
|
return (
|
|
25
26
|
<Background $bgColor={colors.WHITE}>
|
|
26
27
|
<CenterContainer $width={250}>
|
|
@@ -30,7 +31,7 @@ const Template = (args) => {
|
|
|
30
31
|
);
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
const UndefinedTemplate = (args) => {
|
|
34
|
+
const UndefinedTemplate = (args: ComponentProps<typeof Select>) => {
|
|
34
35
|
const [{ toggleOptionsValue }, updateArgs] = useArgs();
|
|
35
36
|
const mockOptions = [
|
|
36
37
|
{ id: "2023", label: "2023" },
|
|
@@ -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 { Align, Spacer } from "../../SharedStorybook/Layout";
|
|
4
5
|
import { SelectSearch } from "./SelectSearch";
|
|
@@ -13,7 +14,7 @@ export default meta;
|
|
|
13
14
|
|
|
14
15
|
type Story = StoryObj<typeof SelectSearch>;
|
|
15
16
|
|
|
16
|
-
const Template = (args) => {
|
|
17
|
+
const Template = (args: ComponentProps<typeof SelectSearch>) => {
|
|
17
18
|
const [{ value }, updateArgs] = useArgs();
|
|
18
19
|
return (
|
|
19
20
|
<Spacer $topMargin={50} $width={400}>
|
|
@@ -94,7 +94,7 @@ describe("SelectSearch", () => {
|
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
test("onEnter is called on enter and returns the value and option", async () => {
|
|
97
|
-
let response;
|
|
97
|
+
let response: SelectSearchResponseType | undefined;
|
|
98
98
|
const onEnter = (responseObj: SelectSearchResponseType) => {
|
|
99
99
|
response = responseObj;
|
|
100
100
|
};
|
|
@@ -106,13 +106,13 @@ describe("SelectSearch", () => {
|
|
|
106
106
|
const input = screen.getByRole("textbox");
|
|
107
107
|
await userEvent.type(input, "{enter}");
|
|
108
108
|
|
|
109
|
-
expect(response
|
|
110
|
-
expect(response
|
|
111
|
-
expect(response
|
|
109
|
+
expect(response!.value).toEqual(value);
|
|
110
|
+
expect(response!.option.id).toEqual(defaultOption.id);
|
|
111
|
+
expect(response!.option.label).toEqual(defaultOption.label);
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
test("onOptionSelect is called on option select and returns the option", async () => {
|
|
115
|
-
let response;
|
|
115
|
+
let response: ChildlessOptionType | undefined;
|
|
116
116
|
const onOptionSelect = (responseObj: ChildlessOptionType) => {
|
|
117
117
|
response = responseObj;
|
|
118
118
|
};
|
|
@@ -128,12 +128,12 @@ describe("SelectSearch", () => {
|
|
|
128
128
|
const option2 = screen.getByText(targetOption.label);
|
|
129
129
|
await userEvent.click(option2);
|
|
130
130
|
|
|
131
|
-
expect(response
|
|
132
|
-
expect(response
|
|
131
|
+
expect(response!.id).toEqual(targetOption.id);
|
|
132
|
+
expect(response!.label).toEqual(targetOption.label);
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
test("onInputBlur is called on blur and returns the value and option", async () => {
|
|
136
|
-
let response;
|
|
136
|
+
let response: SelectSearchResponseType | undefined;
|
|
137
137
|
const onInputBlur = (responseObj: SelectSearchResponseType) => {
|
|
138
138
|
response = responseObj;
|
|
139
139
|
};
|
|
@@ -151,9 +151,9 @@ describe("SelectSearch", () => {
|
|
|
151
151
|
const distractingText = screen.getByText(clickoutText);
|
|
152
152
|
await userEvent.click(distractingText);
|
|
153
153
|
|
|
154
|
-
expect(response
|
|
155
|
-
expect(response
|
|
156
|
-
expect(response
|
|
154
|
+
expect(response!.value).toEqual(value);
|
|
155
|
+
expect(response!.option.label).toEqual(defaultOption.label);
|
|
156
|
+
expect(response!.option.id).toEqual(defaultOption.id);
|
|
157
157
|
});
|
|
158
158
|
|
|
159
159
|
test("onInputFocus is called on focus", async () => {
|
|
@@ -15,11 +15,11 @@ export default meta;
|
|
|
15
15
|
|
|
16
16
|
type Story = StoryObj<typeof SnackContainer>;
|
|
17
17
|
|
|
18
|
-
const SnackBarTemplate = (
|
|
19
|
-
const SnackDialogTemplate = (
|
|
20
|
-
const ToastTemplate = (
|
|
21
|
-
const MultipleToastsTemplate = (
|
|
22
|
-
const DuplicateIdTemplate = (
|
|
18
|
+
const SnackBarTemplate = () => <SnackbarExample />;
|
|
19
|
+
const SnackDialogTemplate = () => <SnackDialogExample />;
|
|
20
|
+
const ToastTemplate = () => <ToastExample />;
|
|
21
|
+
const MultipleToastsTemplate = () => <MultipleToastsExample />;
|
|
22
|
+
const DuplicateIdTemplate = () => <DuplicateIdExample />;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* `Snackbar` are used to confirm an action of Low-Medium Risk . They linger on screen longer than a Toast notification and are optionally interactive.
|
|
@@ -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 { InlineSsnInput } from "./InlineSsnInput";
|
|
@@ -12,7 +13,7 @@ export default meta;
|
|
|
12
13
|
|
|
13
14
|
type Story = StoryObj<typeof SsnInput>;
|
|
14
15
|
|
|
15
|
-
const Template = (args) => {
|
|
16
|
+
const Template = (args: ComponentProps<typeof SsnInput>) => {
|
|
16
17
|
const [{}, updateArgs] = useArgs();
|
|
17
18
|
return (
|
|
18
19
|
<SsnInput
|
|
@@ -24,7 +25,7 @@ const Template = (args) => {
|
|
|
24
25
|
);
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
const InlineTemplate = (args) => {
|
|
28
|
+
const InlineTemplate = (args: ComponentProps<typeof InlineSsnInput>) => {
|
|
28
29
|
const [{}, updateArgs] = useArgs();
|
|
29
30
|
return (
|
|
30
31
|
<InlineSsnInput
|
|
@@ -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 { ElementSpacing, Spacer } from "../../SharedStorybook/Layout";
|
|
4
5
|
import ClipboardImage from "../../assets/clipboard_pattern.png";
|
|
@@ -20,12 +21,12 @@ export default meta;
|
|
|
20
21
|
|
|
21
22
|
type Story = StoryObj<typeof Stepper>;
|
|
22
23
|
|
|
23
|
-
const ClickableTemplate = (args) => {
|
|
24
|
+
const ClickableTemplate = (args: ComponentProps<typeof Stepper>) => {
|
|
24
25
|
const [{ activeId }, updateArgs] = useArgs();
|
|
25
26
|
return <Stepper {...args} activeId={activeId} stepClick={(id) => updateArgs({ activeId: id })} />;
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
const ControlledTemplate = (args) => {
|
|
29
|
+
const ControlledTemplate = (args: ComponentProps<typeof Stepper>) => {
|
|
29
30
|
const [{ activeId, completedSteps }, updateArgs] = useArgs();
|
|
30
31
|
return (
|
|
31
32
|
<div>
|
|
@@ -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 { ContainsFixed } from "../../SharedStorybook/DocStyles";
|
|
4
5
|
import { SecondaryButton } from "../Button";
|
|
@@ -21,12 +22,12 @@ export default meta;
|
|
|
21
22
|
|
|
22
23
|
type Story = StoryObj<typeof TabModal>;
|
|
23
24
|
|
|
24
|
-
const Template = (args) => {
|
|
25
|
+
const Template = (args: ComponentProps<typeof TabModal>) => {
|
|
25
26
|
const [, updateArgs] = useArgs();
|
|
26
27
|
return <TabModal {...args} closeFunction={() => updateArgs({ show: false })} />;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
|
-
const StepperTemplate = (args) => {
|
|
30
|
+
const StepperTemplate = (args: ComponentProps<typeof TabModal>) => {
|
|
30
31
|
const [{ show }, updateArgs] = useArgs();
|
|
31
32
|
return (
|
|
32
33
|
<>
|
|
@@ -36,7 +37,7 @@ const StepperTemplate = (args) => {
|
|
|
36
37
|
);
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
const ButtonTemplate = (args) => {
|
|
40
|
+
const ButtonTemplate = (args: ComponentProps<typeof TabModal>) => {
|
|
40
41
|
const [{ show }, updateArgs] = useArgs();
|
|
41
42
|
return (
|
|
42
43
|
<>
|
|
@@ -46,7 +47,7 @@ const ButtonTemplate = (args) => {
|
|
|
46
47
|
);
|
|
47
48
|
};
|
|
48
49
|
|
|
49
|
-
const DelayedLoadingTemplate = (args) => {
|
|
50
|
+
const DelayedLoadingTemplate = (args: ComponentProps<typeof TabModal>) => {
|
|
50
51
|
const [{ show }, updateArgs] = useArgs();
|
|
51
52
|
return (
|
|
52
53
|
<>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { ComponentProps, useState } from "react";
|
|
3
3
|
import { Spacer } from "../../../SharedStorybook/Layout";
|
|
4
4
|
import { colors } from "../../../const/colors";
|
|
5
5
|
import { BodyMEmphasis, HeadingH3 } from "../../../const/text";
|
|
@@ -26,7 +26,7 @@ export default meta;
|
|
|
26
26
|
|
|
27
27
|
type Story = StoryObj<typeof Table>;
|
|
28
28
|
|
|
29
|
-
const LoadDataTemplate = (args) => {
|
|
29
|
+
const LoadDataTemplate = (args: ComponentProps<typeof Table> & { rowToggle?: boolean }) => {
|
|
30
30
|
const [originalRows, setOriginalRows] = useState(true);
|
|
31
31
|
const [originalColumns, setOriginalColumns] = useState(true);
|
|
32
32
|
return (
|
|
@@ -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 { Table } from "../Table";
|
|
4
5
|
import { filterColumns } from "../mocks/mockColumns";
|
|
@@ -21,7 +22,7 @@ export default meta;
|
|
|
21
22
|
|
|
22
23
|
type Story = StoryObj<typeof Table>;
|
|
23
24
|
|
|
24
|
-
const Template = (args) => {
|
|
25
|
+
const Template = (args: ComponentProps<typeof Table>) => {
|
|
25
26
|
const [{ activeFilters }, updateArgs] = useArgs();
|
|
26
27
|
// const [activeFilters, setActiveFilters] = useState({});
|
|
27
28
|
return (
|
|
@@ -4,6 +4,7 @@ import { Table } from "../Table";
|
|
|
4
4
|
import { sortRows } from "../helpers";
|
|
5
5
|
import { sortingColumns } from "../mocks/mockColumns";
|
|
6
6
|
import { sortingRows } from "../mocks/mockRows";
|
|
7
|
+
import { ColumnType } from "../types";
|
|
7
8
|
import { TableArgTypes } from "./types";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -57,7 +58,7 @@ It is important that you manage `fetching` if the parent sorting requires any so
|
|
|
57
58
|
export const ParentControlledSort: Story = {
|
|
58
59
|
render: (args) => {
|
|
59
60
|
const [{ parentSortAscending, externalSortColumnId }, updateArgs] = useArgs();
|
|
60
|
-
const clickHeader = (column) => {
|
|
61
|
+
const clickHeader = (column: ColumnType) => {
|
|
61
62
|
const { cellId, reverseSort } = column;
|
|
62
63
|
const ascending = externalSortColumnId === cellId && !parentSortAscending;
|
|
63
64
|
const updatedRows = sortRows({ rows: sortingRows, ascending, cellId, reverseSort });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InputTheme } from "../../sharedTypes/enums";
|
|
2
2
|
|
|
3
3
|
import { Meta, StoryObj } from "@storybook/react";
|
|
4
|
+
import { ComponentProps } from "react";
|
|
4
5
|
import { useArgs } from "storybook/preview-api";
|
|
5
6
|
import { ComponentLabel } from "../../SharedStorybook/ComponentLabel";
|
|
6
7
|
import { InlineTextarea } from "./InlineTextarea";
|
|
@@ -18,26 +19,26 @@ export default meta;
|
|
|
18
19
|
|
|
19
20
|
type Story = StoryObj<typeof Textarea>;
|
|
20
21
|
|
|
21
|
-
const Template = (args) => {
|
|
22
|
+
const Template = (args: ComponentProps<typeof Textarea>) => {
|
|
22
23
|
const [{}, updateArgs] = useArgs();
|
|
23
24
|
return (
|
|
24
25
|
<Textarea
|
|
25
26
|
{...args}
|
|
26
27
|
onValueChange={(changingValue) => {
|
|
27
|
-
args.onValueChange(changingValue);
|
|
28
|
+
args.onValueChange?.(changingValue);
|
|
28
29
|
updateArgs({ value: changingValue });
|
|
29
30
|
}}
|
|
30
31
|
/>
|
|
31
32
|
);
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
const InlineTemplate = (args) => {
|
|
35
|
+
const InlineTemplate = (args: ComponentProps<typeof InlineTextarea>) => {
|
|
35
36
|
const [{ value }, updateArgs] = useArgs();
|
|
36
37
|
return (
|
|
37
38
|
<InlineTextarea
|
|
38
39
|
{...args}
|
|
39
40
|
onValueChange={(changingValue) => {
|
|
40
|
-
args.onValueChange(changingValue);
|
|
41
|
+
args.onValueChange?.(changingValue);
|
|
41
42
|
updateArgs({ value: changingValue });
|
|
42
43
|
}}
|
|
43
44
|
value={value}
|
|
@@ -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 { colors } from "../../const/colors";
|
|
4
5
|
import { ButtonColorFamilyEnum } from "../../sharedTypes/enums";
|
|
@@ -15,7 +16,7 @@ export default meta;
|
|
|
15
16
|
|
|
16
17
|
type Story = StoryObj<typeof ToggleButtons>;
|
|
17
18
|
|
|
18
|
-
const Template = (args) => {
|
|
19
|
+
const Template = (args: ComponentProps<typeof ToggleButtons>) => {
|
|
19
20
|
const [{}, updateArgs] = useArgs();
|
|
20
21
|
return <ToggleButtons {...args} onToggle={({ id }) => updateArgs({ activeId: id })} />;
|
|
21
22
|
};
|
|
@@ -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 ToggleGroup>;
|
|
21
22
|
|
|
22
|
-
const Template = (args) => {
|
|
23
|
+
const Template = (args: ComponentProps<typeof ToggleGroup>) => {
|
|
23
24
|
const [{ activeValues }, updateArgs] = useArgs();
|
|
24
25
|
return (
|
|
25
26
|
<ToggleGroup
|