@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
|
@@ -2,6 +2,7 @@ import { colors } from "../../const/colors";
|
|
|
2
2
|
import { Calendar } from "../Icons";
|
|
3
3
|
|
|
4
4
|
import { Meta, StoryObj } from "@storybook/react";
|
|
5
|
+
import { ComponentProps } from "react";
|
|
5
6
|
import { useArgs } from "storybook/preview-api";
|
|
6
7
|
import { ToggleItem } from "./ToggleItem";
|
|
7
8
|
import { IconBox, ComponentLabel as InlineLabel, StorybookLabel } from "./ToggleItemStyles";
|
|
@@ -15,13 +16,13 @@ export default meta;
|
|
|
15
16
|
|
|
16
17
|
type Story = StoryObj<typeof ToggleItem>;
|
|
17
18
|
|
|
18
|
-
const Template = (args) => {
|
|
19
|
+
const Template = (args: ComponentProps<typeof ToggleItem>) => {
|
|
19
20
|
const [{ active }, updateArgs] = useArgs();
|
|
20
21
|
return (
|
|
21
22
|
<ToggleItem
|
|
22
23
|
{...args}
|
|
23
24
|
onToggle={(item) => {
|
|
24
|
-
args.onToggle(item);
|
|
25
|
+
args.onToggle?.(item);
|
|
25
26
|
updateArgs({ active: !active });
|
|
26
27
|
}}
|
|
27
28
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Fragment, useState } from "react";
|
|
2
|
+
import { ComponentProps, Fragment, useState } from "react";
|
|
3
3
|
import { ContainsFixed } from "../../SharedStorybook/DocStyles";
|
|
4
4
|
import { colors } from "../../const/colors";
|
|
5
5
|
import useMeasure from "../../hooks/useMeasure";
|
|
@@ -26,7 +26,7 @@ export default meta;
|
|
|
26
26
|
|
|
27
27
|
type Story = StoryObj<typeof Tooltip>;
|
|
28
28
|
|
|
29
|
-
const Example = (args) => {
|
|
29
|
+
const Example = (args: ComponentProps<typeof Tooltip>) => {
|
|
30
30
|
const [open, setOpen] = useState(false);
|
|
31
31
|
const [buttonRef, position] = useMeasure(open);
|
|
32
32
|
const hackedPosition = position;
|
|
@@ -45,9 +45,9 @@ const Example = (args) => {
|
|
|
45
45
|
</>
|
|
46
46
|
);
|
|
47
47
|
};
|
|
48
|
-
const ExampleTemplate = (args) => <Example {...args} />;
|
|
48
|
+
const ExampleTemplate = (args: ComponentProps<typeof Tooltip>) => <Example {...args} />;
|
|
49
49
|
|
|
50
|
-
const InteractiveTemplate = (
|
|
50
|
+
const InteractiveTemplate = () => <StoryTooltipExample />;
|
|
51
51
|
|
|
52
52
|
export const BasicExample: Story = {
|
|
53
53
|
render: ExampleTemplate.bind({}),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { TooltipFCText } from "../../SharedStorybook/ComponentLabel";
|
|
3
4
|
import { Spacer } from "../../SharedStorybook/Layout";
|
|
4
5
|
import { Ellipsis, User } from "../Icons";
|
|
@@ -17,7 +18,7 @@ export default meta;
|
|
|
17
18
|
|
|
18
19
|
type Story = StoryObj<typeof TooltipLabel>;
|
|
19
20
|
|
|
20
|
-
const Template = (args) => {
|
|
21
|
+
const Template = (args: ComponentProps<typeof TooltipLabel>) => {
|
|
21
22
|
return (
|
|
22
23
|
<>
|
|
23
24
|
<TooltipLabel {...args} />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { ComponentProps, MouseEvent, useState } from "react";
|
|
3
3
|
import { action } from "storybook/actions";
|
|
4
4
|
import { ContainsFixed } from "../../SharedStorybook/DocStyles";
|
|
5
5
|
import useMeasure from "../../hooks/useMeasure";
|
|
@@ -23,7 +23,7 @@ export default meta;
|
|
|
23
23
|
|
|
24
24
|
type Story = StoryObj<typeof TooltipOptions>;
|
|
25
25
|
|
|
26
|
-
const Example = (args) => {
|
|
26
|
+
const Example = (args: ComponentProps<typeof TooltipOptions>) => {
|
|
27
27
|
const [open, setOpen] = useState(false);
|
|
28
28
|
const [buttonRef, position] = useMeasure(open);
|
|
29
29
|
const hackedPosition = position;
|
|
@@ -40,9 +40,9 @@ const Example = (args) => {
|
|
|
40
40
|
</>
|
|
41
41
|
);
|
|
42
42
|
};
|
|
43
|
-
const Template = (args) => <Example {...args} />;
|
|
43
|
+
const Template = (args: ComponentProps<typeof TooltipOptions>) => <Example {...args} />;
|
|
44
44
|
|
|
45
|
-
const StoryTooltipOptionsTemplate = (args) => <StoryTooltipOptionsExample {...args} />;
|
|
45
|
+
const StoryTooltipOptionsTemplate = (args: ComponentProps<typeof StoryTooltipOptionsExample>) => <StoryTooltipOptionsExample {...args} />;
|
|
46
46
|
|
|
47
47
|
export const BasicExample: Story = {
|
|
48
48
|
render: Template.bind({}),
|
|
@@ -77,7 +77,7 @@ export const HeaderExample = {
|
|
|
77
77
|
header: "Select an Option:",
|
|
78
78
|
data: iconOptions,
|
|
79
79
|
// menuPaddingString: "50px 0",
|
|
80
|
-
onMouseout: (event) => console.log("onMouseout", event),
|
|
80
|
+
onMouseout: (event: MouseEvent<HTMLDivElement> | MouseEventInit) => console.log("onMouseout", event),
|
|
81
81
|
// optionPaddingString: "0",
|
|
82
82
|
closeOnClick: false, // for storybook example only
|
|
83
83
|
width: 195,
|
|
@@ -92,7 +92,7 @@ export const AltOptions = {
|
|
|
92
92
|
args: {
|
|
93
93
|
data: iconOptions,
|
|
94
94
|
altOptions: altTooltipOptions,
|
|
95
|
-
onMouseout: (event) => console.log("onMouseout", event),
|
|
95
|
+
onMouseout: (event: MouseEvent<HTMLDivElement> | MouseEventInit) => console.log("onMouseout", event),
|
|
96
96
|
closeOnClick: false, // for storybook example only
|
|
97
97
|
width: 195,
|
|
98
98
|
},
|
|
@@ -9,7 +9,7 @@ import { Tooltip } from "../Tooltip";
|
|
|
9
9
|
import { Typography } from "../Typography";
|
|
10
10
|
import { TextVariantEnum } from "../Typography/types";
|
|
11
11
|
import { Truncate } from "./";
|
|
12
|
-
import { TruncateStoryType } from "./types";
|
|
12
|
+
import { TruncateStoryType, TruncateTooltipTextType } from "./types";
|
|
13
13
|
|
|
14
14
|
/** Truncate crops text passed to it if the text overflows the parent element. It should only be used on text that needs to remain on a single line.
|
|
15
15
|
|
|
@@ -51,9 +51,9 @@ export default meta;
|
|
|
51
51
|
|
|
52
52
|
type Story = StoryObj<FC<TruncateStoryType>>;
|
|
53
53
|
|
|
54
|
-
const Template = (args) => {
|
|
54
|
+
const Template = (args: TruncateStoryType) => {
|
|
55
55
|
const [{ tooltipOpen = false, tooltipPosition = { top: 0, bottom: 0, left: 0 }, tooltipText = "" }, updateArgs] = useArgs();
|
|
56
|
-
const onHover = (data) => {
|
|
56
|
+
const onHover = (data: TruncateTooltipTextType) => {
|
|
57
57
|
const { text, position } = data;
|
|
58
58
|
updateArgs({ tooltipOpen: true, tooltipText: text, tooltipPosition: position });
|
|
59
59
|
};
|
|
@@ -85,7 +85,7 @@ const Template = (args) => {
|
|
|
85
85
|
<Tooltip open={tooltipOpen} position={tooltipPosition} width={400}>
|
|
86
86
|
{tooltipText}
|
|
87
87
|
</Tooltip>
|
|
88
|
-
<Typography variant={args.arrayTextVariantEnum}>
|
|
88
|
+
<Typography variant={args.arrayTextVariantEnum ?? TextVariantEnum.BodyMPrimary}>
|
|
89
89
|
<Truncate
|
|
90
90
|
fontSize={args.fontSize}
|
|
91
91
|
onHover={(response) => onHover(response)}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { ElementSpacing } from "../../SharedStorybook/Layout";
|
|
3
4
|
import {
|
|
4
5
|
BodyLEmphasis,
|
|
@@ -42,7 +43,7 @@ export default meta;
|
|
|
42
43
|
type Story = StoryObj<typeof Typography>;
|
|
43
44
|
type LegacyStory = StoryObj<TextProps>;
|
|
44
45
|
|
|
45
|
-
const VariantTemplate = (args) => (
|
|
46
|
+
const VariantTemplate = (args: ComponentProps<typeof Typography>) => (
|
|
46
47
|
<ElementSpacing>
|
|
47
48
|
<Typography {...args} variant={args.variant}>
|
|
48
49
|
You can change the variant in the story controls to see this change. You can also see all the different typography types at once in
|
|
@@ -51,7 +52,7 @@ const VariantTemplate = (args) => (
|
|
|
51
52
|
</ElementSpacing>
|
|
52
53
|
);
|
|
53
54
|
|
|
54
|
-
const LegacyTemplate = (args) => (
|
|
55
|
+
const LegacyTemplate = (args: TextProps) => (
|
|
55
56
|
<ElementSpacing>
|
|
56
57
|
<BodyLEmphasis {...args}>BodyLEmphasis</BodyLEmphasis>
|
|
57
58
|
<BodyLPrimary {...args}>BodyLPrimary </BodyLPrimary>
|
|
@@ -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 { FileTypeEnum } from "../../sharedTypes/enums";
|
|
4
5
|
import { UploadDropzone } from "./UploadDropzone";
|
|
@@ -17,7 +18,7 @@ export default meta;
|
|
|
17
18
|
|
|
18
19
|
type Story = StoryObj<typeof UploadDropzone>;
|
|
19
20
|
|
|
20
|
-
const Template = (args) => {
|
|
21
|
+
const Template = (args: ComponentProps<typeof UploadDropzone>) => {
|
|
21
22
|
const [{ fileList = [] }, updateArgs] = useArgs();
|
|
22
23
|
return <UploadDropzone {...args} fileList={fileList} setFileList={(fileArray) => updateArgs({ fileList: fileArray })} />;
|
|
23
24
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Avatar, Button, Text, useMantineTheme } from "@mantine/core";
|
|
2
2
|
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { ComponentProps } from "react";
|
|
4
4
|
import { useArgs } from "storybook/preview-api";
|
|
5
5
|
import { styled } from "styled-components";
|
|
6
6
|
|
|
@@ -78,7 +78,7 @@ const Logo = { src: fakeFile, alt: "Another Fake Logo" };
|
|
|
78
78
|
const EmailLogo = { src: emailFile, alt: "png file" };
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
const ModalTemplate = (args) => {
|
|
81
|
+
const ModalTemplate = (args: ComponentProps<typeof UserCard>) => {
|
|
82
82
|
const [{ showUserCard = false }, updateArgs] = useArgs();
|
|
83
83
|
const theme = useMantineTheme();
|
|
84
84
|
return (
|
|
@@ -148,7 +148,7 @@ const ModalTemplate = (args) => {
|
|
|
148
148
|
);
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
-
const TopOffsetTemplate = (args) => {
|
|
151
|
+
const TopOffsetTemplate = (args: ComponentProps<typeof UserCard>) => {
|
|
152
152
|
return (
|
|
153
153
|
<Background $paddingString="150px 0 0 0">
|
|
154
154
|
<UserCard {...args} />
|
|
@@ -5,6 +5,7 @@ import { ComponentType, FC } from "react";
|
|
|
5
5
|
import { Lock, User } from "../Icons";
|
|
6
6
|
import { UserCard as RawUserCard } from "./UserCard";
|
|
7
7
|
import { ORGS_DIVIDER_ID, SIGN_OUT_DIVIDER_ID, SIGN_OUT_TEXT } from "./const";
|
|
8
|
+
import type { UserCardOptionsType } from "./types";
|
|
8
9
|
|
|
9
10
|
function withProviders<P extends {}>(Component: ComponentType<P>): FC<P> {
|
|
10
11
|
return (props: P) => (
|
|
@@ -36,21 +37,21 @@ const orgOptions = [
|
|
|
36
37
|
{
|
|
37
38
|
Icon: User,
|
|
38
39
|
text: "Acme Limited",
|
|
39
|
-
onClick: ({ option }) => console.log("Set Acme Limited", option),
|
|
40
|
+
onClick: ({ option }: { option: UserCardOptionsType }) => console.log("Set Acme Limited", option),
|
|
40
41
|
id: "1",
|
|
41
42
|
},
|
|
42
43
|
{
|
|
43
44
|
Icon: User,
|
|
44
45
|
iconSize: 30,
|
|
45
46
|
text: "Universal Widgets",
|
|
46
|
-
onClick: ({ option }) => console.log("Set Universal Widgets", option),
|
|
47
|
+
onClick: ({ option }: { option: UserCardOptionsType }) => console.log("Set Universal Widgets", option),
|
|
47
48
|
id: "2",
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
51
|
Icon: User,
|
|
51
52
|
iconSize: 26,
|
|
52
53
|
text: "Foo International",
|
|
53
|
-
onClick: ({ option }) => console.log("Foo International", option),
|
|
54
|
+
onClick: ({ option }: { option: UserCardOptionsType }) => console.log("Foo International", option),
|
|
54
55
|
id: "3",
|
|
55
56
|
},
|
|
56
57
|
];
|
|
@@ -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 { InlineZipCodeInput } from "./InlineZipCodeInput";
|
|
@@ -14,7 +15,7 @@ export default meta;
|
|
|
14
15
|
|
|
15
16
|
type Story = StoryObj<typeof ZipCodeInput>;
|
|
16
17
|
|
|
17
|
-
const Template = (args) => {
|
|
18
|
+
const Template = (args: ComponentProps<typeof ZipCodeInput>) => {
|
|
18
19
|
const [{}, updateArgs] = useArgs();
|
|
19
20
|
return (
|
|
20
21
|
<ZipCodeInput
|
|
@@ -26,7 +27,7 @@ const Template = (args) => {
|
|
|
26
27
|
);
|
|
27
28
|
};
|
|
28
29
|
|
|
29
|
-
const InlineTemplate = (args) => {
|
|
30
|
+
const InlineTemplate = (args: ComponentProps<typeof InlineZipCodeInput>) => {
|
|
30
31
|
const [{}, updateArgs] = useArgs();
|
|
31
32
|
return (
|
|
32
33
|
<InlineZipCodeInput
|
|
@@ -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 { ColorDotDropdown } from "./ColorDotDropdown";
|
|
4
5
|
import adjudicationOptions from "./mocks";
|
|
@@ -13,7 +14,7 @@ export default meta;
|
|
|
13
14
|
|
|
14
15
|
type Story = StoryObj<typeof ColorDotDropdown>;
|
|
15
16
|
|
|
16
|
-
const Template = (args) => {
|
|
17
|
+
const Template = (args: ComponentProps<typeof ColorDotDropdown>) => {
|
|
17
18
|
const [{ selectedOption }, updateArgs] = useArgs();
|
|
18
19
|
return <ColorDotDropdown {...args} selectedOption={selectedOption} onSelect={(option) => updateArgs({ selectedOption: option })} />;
|
|
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 { Spacer } from "./../../SharedStorybook/Layout";
|
|
4
5
|
import { CountryDropdown } from "./CountryDropdown";
|
|
@@ -17,7 +18,7 @@ export default meta;
|
|
|
17
18
|
|
|
18
19
|
type Story = StoryObj<typeof CountryDropdown>;
|
|
19
20
|
|
|
20
|
-
const Template = (args) => {
|
|
21
|
+
const Template = (args: ComponentProps<typeof CountryDropdown>) => {
|
|
21
22
|
const [{}, updateArgs] = useArgs();
|
|
22
23
|
return (
|
|
23
24
|
<Spacer $bottomMargin={350}>
|
|
@@ -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 { USStatesEnum } from "../../sharedTypes/enums";
|
|
@@ -19,7 +20,7 @@ export default meta;
|
|
|
19
20
|
|
|
20
21
|
type Story = StoryObj<typeof CountyDropdown>;
|
|
21
22
|
|
|
22
|
-
const Template = (args) => {
|
|
23
|
+
const Template = (args: ComponentProps<typeof CountyDropdown>) => {
|
|
23
24
|
const [{}, updateArgs] = useArgs();
|
|
24
25
|
return <CountyDropdown {...args} onSelect={(option) => updateArgs({ value: option?.label })} />;
|
|
25
26
|
};
|
package/src/configuredComponents/DescriptiveDropdownInput/DescriptiveDropdownInput.stories.tsx
CHANGED
|
@@ -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 { Spacer } from "../../SharedStorybook/Layout";
|
|
@@ -51,7 +52,7 @@ export default meta;
|
|
|
51
52
|
|
|
52
53
|
type Story = StoryObj<typeof DescriptiveDropdownInput>;
|
|
53
54
|
|
|
54
|
-
const Template = (args) => {
|
|
55
|
+
const Template = (args: ComponentProps<typeof DescriptiveDropdownInput>) => {
|
|
55
56
|
const [, updateArgs] = useArgs();
|
|
56
57
|
return (
|
|
57
58
|
<Spacer $bottomMargin={300} $topMargin={150} $width={400}>
|
|
@@ -60,7 +61,7 @@ const Template = (args) => {
|
|
|
60
61
|
);
|
|
61
62
|
};
|
|
62
63
|
|
|
63
|
-
const CheckboxTemplate = (args) => {
|
|
64
|
+
const CheckboxTemplate = (args: ComponentProps<typeof DescriptiveDropdownInput>) => {
|
|
64
65
|
const [{ options }, updateArgs] = useArgs();
|
|
65
66
|
return (
|
|
66
67
|
<Spacer $bottomMargin={300} $topMargin={150} $width={400}>
|
|
@@ -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 { DropdownButton } from "./DropdownButton";
|
|
4
5
|
|
|
@@ -10,7 +11,7 @@ export default meta;
|
|
|
10
11
|
|
|
11
12
|
type Story = StoryObj<typeof DropdownButton>;
|
|
12
13
|
|
|
13
|
-
const Template = (args) => {
|
|
14
|
+
const Template = (args: ComponentProps<typeof DropdownButton>) => {
|
|
14
15
|
const [{ dropdownOpen }, updateArgs] = useArgs();
|
|
15
16
|
return <DropdownButton {...args} onClick={() => updateArgs({ dropdownOpen: !dropdownOpen })} />;
|
|
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 { Spacer } from "../../SharedStorybook/Layout";
|
|
4
5
|
import { PlusCircle } from "../../components/Icons";
|
|
@@ -17,7 +18,7 @@ export default meta;
|
|
|
17
18
|
|
|
18
19
|
type Story = StoryObj<typeof DropdownInput>;
|
|
19
20
|
|
|
20
|
-
const Template = (args) => {
|
|
21
|
+
const Template = (args: ComponentProps<typeof DropdownInput>) => {
|
|
21
22
|
const [{}, updateArgs] = useArgs();
|
|
22
23
|
return (
|
|
23
24
|
<Spacer $bottomMargin={300} $topMargin={150} $width={400}>
|
|
@@ -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 { IconSwitcher } from "./IconSwitcher";
|
|
4
5
|
import { disabledOptions, fourOptions, tinyOptions, twoOptions } from "./mocks";
|
|
@@ -17,7 +18,7 @@ export default meta;
|
|
|
17
18
|
|
|
18
19
|
type Story = StoryObj<typeof IconSwitcher>;
|
|
19
20
|
|
|
20
|
-
const Template = (args) => {
|
|
21
|
+
const Template = (args: ComponentProps<typeof IconSwitcher>) => {
|
|
21
22
|
const [{}, updateArgs] = useArgs();
|
|
22
23
|
return (
|
|
23
24
|
<IconSwitcher
|
|
@@ -29,7 +30,7 @@ const Template = (args) => {
|
|
|
29
30
|
/>
|
|
30
31
|
);
|
|
31
32
|
};
|
|
32
|
-
const EmptyTemplate = (args) => <IconSwitcher {...args} />;
|
|
33
|
+
const EmptyTemplate = (args: ComponentProps<typeof IconSwitcher>) => <IconSwitcher {...args} />;
|
|
33
34
|
|
|
34
35
|
export const Basic: Story = {
|
|
35
36
|
render: Template.bind({}),
|
package/src/configuredComponents/InlineDescriptiveDropdown/InlineDescriptiveDropdown.stories.tsx
CHANGED
|
@@ -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 { SwitchTypeEnum } from "../../components/DescriptiveSwitchMenu";
|
|
@@ -26,7 +27,7 @@ export default meta;
|
|
|
26
27
|
|
|
27
28
|
type Story = StoryObj<typeof InlineDescriptiveDropdown>;
|
|
28
29
|
|
|
29
|
-
const Template = (args) => {
|
|
30
|
+
const Template = (args: ComponentProps<typeof InlineDescriptiveDropdown>) => {
|
|
30
31
|
const [, updateArgs] = useArgs();
|
|
31
32
|
return (
|
|
32
33
|
<Spacer $bottomMargin={300} $topMargin={150} $width={400}>
|
|
@@ -35,7 +36,7 @@ const Template = (args) => {
|
|
|
35
36
|
);
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
const CheckboxTemplate = (args) => {
|
|
39
|
+
const CheckboxTemplate = (args: ComponentProps<typeof InlineDescriptiveDropdown>) => {
|
|
39
40
|
const [{ options }, updateArgs] = useArgs();
|
|
40
41
|
return (
|
|
41
42
|
<Spacer $bottomMargin={300} $topMargin={150} $width={400}>
|
|
@@ -5,6 +5,7 @@ import { Spacer } from "../../SharedStorybook/Layout";
|
|
|
5
5
|
import { addOrRemoveString } from "../../helpers/arrays";
|
|
6
6
|
import { dates, longOptions, nestedTeamMembers, teamMembers } from "../../sharedMocks/options";
|
|
7
7
|
import { TextStyleEnum } from "../../sharedTypes/enums";
|
|
8
|
+
import { OptionType } from "../../sharedTypes/types";
|
|
8
9
|
import { InlineDropdown } from "./InlineDropdown";
|
|
9
10
|
import { InlineDropdownStoryType } from "./types";
|
|
10
11
|
|
|
@@ -38,7 +39,7 @@ export default meta;
|
|
|
38
39
|
type Story = StoryObj<FC<InlineDropdownStoryType>>;
|
|
39
40
|
|
|
40
41
|
export const BasicExample: Story = {
|
|
41
|
-
render: (args) => {
|
|
42
|
+
render: (args: InlineDropdownStoryType) => {
|
|
42
43
|
const [, updateArgs] = useArgs();
|
|
43
44
|
return (
|
|
44
45
|
<Spacer $topMargin={args.topMargin}>
|
|
@@ -56,7 +57,7 @@ export const BasicExample: Story = {
|
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
export const TextStyles: Story = {
|
|
59
|
-
render: (args) => {
|
|
60
|
+
render: (args: InlineDropdownStoryType) => {
|
|
60
61
|
return (
|
|
61
62
|
<Spacer $topMargin={10}>
|
|
62
63
|
<Spacer $topMargin={30}>
|
|
@@ -120,7 +121,7 @@ This will also set `stayOpen` to true by default.
|
|
|
120
121
|
**Note:** MultiSelect makes it possible to deselect the last active option. Since there is no placeholder for `InlineDropdown`, you will need to manage the potential state with nothing selected.
|
|
121
122
|
*/
|
|
122
123
|
export const MultiSelect: Story = {
|
|
123
|
-
render: (args) => {
|
|
124
|
+
render: (args: InlineDropdownStoryType) => {
|
|
124
125
|
const [{ activeIds, idField, options, storybookPlaceholder, text }, updateArgs] = useArgs();
|
|
125
126
|
return (
|
|
126
127
|
<Spacer $topMargin={args.topMargin}>
|
|
@@ -131,7 +132,7 @@ export const MultiSelect: Story = {
|
|
|
131
132
|
const activeLabels: string[] = [];
|
|
132
133
|
for (let i = 0; i < updatedIds.length; i++) {
|
|
133
134
|
const id = updatedIds[i];
|
|
134
|
-
const activeOption = options.find((localOption) => {
|
|
135
|
+
const activeOption = options.find((localOption: OptionType) => {
|
|
135
136
|
return localOption[idField] === id || localOption.label === id;
|
|
136
137
|
});
|
|
137
138
|
if (activeOption) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { MoreMenuButton } from "./MoreMenuButton";
|
|
3
4
|
import RowExample from "./RowExample";
|
|
4
5
|
|
|
@@ -10,7 +11,7 @@ export default meta;
|
|
|
10
11
|
|
|
11
12
|
type Story = StoryObj<typeof MoreMenuButton>;
|
|
12
13
|
|
|
13
|
-
const Template = (args) => <MoreMenuButton {...args} />;
|
|
14
|
+
const Template = (args: ComponentProps<typeof MoreMenuButton>) => <MoreMenuButton {...args} />;
|
|
14
15
|
|
|
15
16
|
const RowTemplate = () => {
|
|
16
17
|
return <RowExample />;
|
|
@@ -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 { Spacer } from "../../SharedStorybook/Layout";
|
|
@@ -22,7 +23,7 @@ export default meta;
|
|
|
22
23
|
|
|
23
24
|
type Story = StoryObj<typeof MultiSelect>;
|
|
24
25
|
|
|
25
|
-
const Template = (args) => {
|
|
26
|
+
const Template = (args: ComponentProps<typeof MultiSelect>) => {
|
|
26
27
|
const [{ activeIds }, updateArgs] = useArgs();
|
|
27
28
|
return (
|
|
28
29
|
<Spacer $bottomMargin={300} $topMargin={150} $width={400}>
|
|
@@ -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 { NationalityDropdown } from "./NationalityDropdown";
|
|
@@ -17,7 +18,7 @@ export default meta;
|
|
|
17
18
|
|
|
18
19
|
type Story = StoryObj<typeof NationalityDropdown>;
|
|
19
20
|
|
|
20
|
-
const Template = (args) => {
|
|
21
|
+
const Template = (args: ComponentProps<typeof NationalityDropdown>) => {
|
|
21
22
|
const [{}, updateArgs] = useArgs();
|
|
22
23
|
return (
|
|
23
24
|
<Spacer $bottomMargin={350}>
|
|
@@ -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 { StateDropdown } from "./StateDropdown";
|
|
@@ -27,7 +28,7 @@ export default meta;
|
|
|
27
28
|
|
|
28
29
|
type Story = StoryObj<typeof StateDropdown>;
|
|
29
30
|
|
|
30
|
-
const Template = (args) => {
|
|
31
|
+
const Template = (args: ComponentProps<typeof StateDropdown>) => {
|
|
31
32
|
const [{}, updateArgs] = useArgs();
|
|
32
33
|
return (
|
|
33
34
|
<StateDropdown
|
|
@@ -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 { StatusDropdown } from "./StatusDropdown";
|
|
@@ -14,7 +15,7 @@ export default meta;
|
|
|
14
15
|
|
|
15
16
|
type Story = StoryObj<typeof StatusDropdown>;
|
|
16
17
|
|
|
17
|
-
const Template = (args) => {
|
|
18
|
+
const Template = (args: ComponentProps<typeof StatusDropdown>) => {
|
|
18
19
|
const [{}, updateArgs] = useArgs();
|
|
19
20
|
return (
|
|
20
21
|
<StatusDropdown
|
|
@@ -35,7 +35,7 @@ export default meta;
|
|
|
35
35
|
|
|
36
36
|
type Story = StoryObj<TableFiltersPanelStoryType>;
|
|
37
37
|
|
|
38
|
-
const Example = (args) => {
|
|
38
|
+
const Example = (args: TableFiltersPanelStoryType) => {
|
|
39
39
|
const [activeFilters, setActiveFilters] = useState({});
|
|
40
40
|
const [open, setOpen] = useState(false);
|
|
41
41
|
const [buttonRef, position] = useMeasure(open);
|
|
@@ -57,8 +57,8 @@ const Example = (args) => {
|
|
|
57
57
|
</>
|
|
58
58
|
);
|
|
59
59
|
};
|
|
60
|
-
const Template = (args) => <Example {...args} />;
|
|
61
|
-
const RadioTemplate = (args) => <Example {...args} />;
|
|
60
|
+
const Template = (args: TableFiltersPanelStoryType) => <Example {...args} />;
|
|
61
|
+
const RadioTemplate = (args: TableFiltersPanelStoryType) => <Example {...args} />;
|
|
62
62
|
|
|
63
63
|
export const Basic: Story = {
|
|
64
64
|
render: Template.bind({}),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import logoFile from "../../assets/cerebellumLogo.png";
|
|
3
4
|
import { LogoSidebar } from "../../components/LogoSidebar";
|
|
4
5
|
import { mockLinks } from "../../components/LogoSidebar/mockLinks";
|
|
@@ -22,7 +23,7 @@ export default meta;
|
|
|
22
23
|
|
|
23
24
|
type Story = StoryObj<typeof LayoutSidebar>;
|
|
24
25
|
|
|
25
|
-
const Template = (args) => {
|
|
26
|
+
const Template = (args: ComponentProps<typeof LayoutSidebar>) => {
|
|
26
27
|
return (
|
|
27
28
|
<LayoutSidebar {...args}>
|
|
28
29
|
<Table columns={simpleColumns} rows={mediumTableRows} rowsPerPage={10} />
|
|
@@ -30,7 +31,7 @@ const Template = (args) => {
|
|
|
30
31
|
);
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
const ScrollingTemplate = (args) => {
|
|
34
|
+
const ScrollingTemplate = (args: ComponentProps<typeof LayoutSidebar>) => {
|
|
34
35
|
return (
|
|
35
36
|
<LayoutSidebar {...args}>
|
|
36
37
|
<Table columns={simpleColumns} rows={mediumTableRows} rowsPerPage={20} />
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { Background } from "../../SharedStorybook/Layout";
|
|
3
4
|
import logoFile from "../../assets/cerebellumLogo.png";
|
|
4
5
|
import { colors } from "../../const/colors";
|
|
@@ -28,7 +29,7 @@ export default meta;
|
|
|
28
29
|
|
|
29
30
|
type Story = StoryObj<typeof NavLayout>;
|
|
30
31
|
|
|
31
|
-
const Template = (args) => {
|
|
32
|
+
const Template = (args: ComponentProps<typeof NavLayout>) => {
|
|
32
33
|
return (
|
|
33
34
|
<Background $bgColor={colors.COOL_GREY_4}>
|
|
34
35
|
<NavLayout {...args}>
|
|
@@ -85,8 +85,10 @@ const getInputVars = (size?: MantineSize | (string & {})) => {
|
|
|
85
85
|
wrapper["--input-height-lg"] = "calc(3.4375rem * var(--mantine-scale))"; // 55px
|
|
86
86
|
wrapper["--input-height-xl"] = "calc(3.75rem * var(--mantine-scale))"; // 60px
|
|
87
87
|
|
|
88
|
-
wrapper["--input-fz"] =
|
|
89
|
-
|
|
88
|
+
wrapper["--input-fz"] =
|
|
89
|
+
wrapper[`--input-fz-${resolvedSize}` as keyof typeof wrapper];
|
|
90
|
+
wrapper["--input-height"] =
|
|
91
|
+
wrapper[`--input-height-${resolvedSize}` as keyof typeof wrapper];
|
|
90
92
|
|
|
91
93
|
return { wrapper };
|
|
92
94
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
2
3
|
import { NotFound } from "./NotFound";
|
|
3
4
|
|
|
4
5
|
/** NotFound is a 404 page which can be used accross all products. */
|
|
@@ -13,7 +14,7 @@ export default meta;
|
|
|
13
14
|
|
|
14
15
|
type Story = StoryObj<typeof NotFound>;
|
|
15
16
|
|
|
16
|
-
const Template = (args) => (
|
|
17
|
+
const Template = (args: ComponentProps<typeof NotFound>) => (
|
|
17
18
|
<div style={{ height: "100vh", width: "100vw" }}>
|
|
18
19
|
<NotFound {...args} />
|
|
19
20
|
</div>
|