@worknice/whiteboard 0.22.6 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/Storybook.js +50 -0
  2. package/dist/controls/Button.d.ts +5 -0
  3. package/dist/controls/Button.stories.d.ts +67 -0
  4. package/dist/controls/Button.stories.js +121 -0
  5. package/dist/fields/CheckboxSetField.d.ts +3 -0
  6. package/dist/fields/CheckboxSetField.stories.d.ts +62 -0
  7. package/dist/fields/CheckboxSetField.stories.js +85 -0
  8. package/dist/fields/ColorPickerField.stories.d.ts +49 -0
  9. package/dist/fields/ColorPickerField.stories.js +56 -0
  10. package/dist/fields/OrgLogoField.stories.d.ts +44 -0
  11. package/dist/fields/OrgLogoField.stories.js +79 -0
  12. package/dist/fields/PaletteColorPickerField.stories.d.ts +43 -0
  13. package/dist/fields/PaletteColorPickerField.stories.js +60 -0
  14. package/dist/fields/TimezoneField.stories.d.ts +48 -0
  15. package/dist/fields/TimezoneField.stories.js +66 -0
  16. package/dist/icons/IconGallery.js +47 -0
  17. package/dist/inputs/ColorInput.stories.d.ts +36 -0
  18. package/dist/inputs/ColorInput.stories.js +42 -0
  19. package/dist/inputs/PaletteColorInput.stories.d.ts +28 -0
  20. package/dist/inputs/PaletteColorInput.stories.js +40 -0
  21. package/dist/presentation/Container.d.ts +7 -0
  22. package/dist/presentation/Container.js +12 -0
  23. package/dist/presentation/Container.module.js +7 -0
  24. package/dist/presentation/Container.stories.d.ts +14 -0
  25. package/dist/presentation/Container.stories.js +29 -0
  26. package/dist/presentation/Container_module.css +36 -0
  27. package/dist/presentation/Icon.stories.d.ts +20 -0
  28. package/dist/presentation/Icon.stories.js +24 -0
  29. package/dist/presentation/Tag.stories.d.ts +15 -0
  30. package/dist/presentation/Tag.stories.js +16 -0
  31. package/package.json +15 -5
@@ -0,0 +1,50 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ function _createMdxContent(props) {
3
+ const _components = {
4
+ a: "a",
5
+ h1: "h1",
6
+ h2: "h2",
7
+ p: "p",
8
+ ...props.components
9
+ };
10
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
11
+ children: [
12
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(_components.h1, {
13
+ children: "Storybook"
14
+ }),
15
+ "\n",
16
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(_components.p, {
17
+ children: "Welcome to the Worknice storybook!"
18
+ }),
19
+ "\n",
20
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(_components.p, {
21
+ children: [
22
+ "This is a collection of stories for the Worknice components and UI/UX. The main source of components is the ",
23
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(_components.a, {
24
+ href: "https://github.com/worknice/whiteboard",
25
+ children: "worknice/whiteboard"
26
+ }),
27
+ " package."
28
+ ]
29
+ }),
30
+ "\n",
31
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(_components.h2, {
32
+ children: "Stories"
33
+ }),
34
+ "\n",
35
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(_components.p, {
36
+ children: "The folder structure for stories matches the component package/app where the component is located."
37
+ })
38
+ ]
39
+ });
40
+ }
41
+ function MDXContent(props = {}) {
42
+ const { wrapper: MDXLayout } = props.components || {};
43
+ return MDXLayout ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(MDXLayout, {
44
+ ...props,
45
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(_createMdxContent, {
46
+ ...props
47
+ })
48
+ }) : _createMdxContent(props);
49
+ }
50
+ export { MDXContent as default };
@@ -4,6 +4,7 @@ type Props = {
4
4
  id?: string;
5
5
  onClick?: (event: React.MouseEvent) => void;
6
6
  size?: "normal" | "small";
7
+ /** @deprecated Use tooltip instead. */
7
8
  title?: string;
8
9
  /**
9
10
  * A "submit" type will behave as a submit button in a form, while "primary"
@@ -16,7 +17,11 @@ type Props = {
16
17
  icon?: ReactNode;
17
18
  } | {
18
19
  children?: ReactNode;
20
+ /** The icon to render, use an instance of the Icon component */
19
21
  icon: ReactNode;
20
22
  });
23
+ /**
24
+ * Main button component, using onClick to trigger the action. For links, use ButtonLink.
25
+ */
21
26
  declare const Button: ({ children, disabled, icon, id, onClick, size, type, title, tooltip, }: Props) => import("react/jsx-runtime").JSX.Element;
22
27
  export default Button;
@@ -0,0 +1,67 @@
1
+ import type { StoryObj } from "@storybook/nextjs-vite";
2
+ declare const meta: {
3
+ component: ({ children, disabled, icon, id, onClick, size, type, title, tooltip, }: {
4
+ disabled?: boolean;
5
+ id?: string;
6
+ onClick?: (event: React.MouseEvent) => void;
7
+ size?: "normal" | "small";
8
+ title?: string;
9
+ type?: "submit" | "primary" | "secondary" | "danger";
10
+ tooltip?: import("react").ReactNode | null;
11
+ } & ({
12
+ children: import("react").ReactNode;
13
+ icon?: import("react").ReactNode;
14
+ } | {
15
+ children?: import("react").ReactNode;
16
+ icon: import("react").ReactNode;
17
+ })) => import("react/jsx-runtime").JSX.Element;
18
+ argTypes: {
19
+ id: {
20
+ control: false;
21
+ };
22
+ title: {
23
+ control: false;
24
+ };
25
+ children: {
26
+ table: {
27
+ type: {
28
+ summary: string;
29
+ };
30
+ };
31
+ };
32
+ icon: {
33
+ control: "inline-radio";
34
+ options: string[];
35
+ mapping: {
36
+ None: null;
37
+ Edit: import("react/jsx-runtime").JSX.Element;
38
+ Plus: import("react/jsx-runtime").JSX.Element;
39
+ Loading: import("react/jsx-runtime").JSX.Element;
40
+ };
41
+ table: {
42
+ type: {
43
+ summary: string;
44
+ };
45
+ };
46
+ };
47
+ };
48
+ args: {
49
+ id: string;
50
+ type: "primary";
51
+ onClick: import("storybook/test").Mock<(...args: any[]) => any>;
52
+ children: string;
53
+ size: "normal";
54
+ disabled: false;
55
+ tooltip: string;
56
+ };
57
+ };
58
+ export default meta;
59
+ type Story = StoryObj<typeof meta>;
60
+ export declare const Primary: Story;
61
+ export declare const Secondary: Story;
62
+ export declare const Disabled: Story;
63
+ export declare const Small: Story;
64
+ export declare const WithIcon: Story;
65
+ export declare const WithTooltip: Story;
66
+ export declare const Loading: Story;
67
+ export declare const Submit: Story;
@@ -0,0 +1,121 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__ from "storybook/test";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__ from "../presentation/Icon.js";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__Button_js_17bdd71d__ from "./Button.js";
5
+ const meta = {
6
+ component: __WEBPACK_EXTERNAL_MODULE__Button_js_17bdd71d__["default"],
7
+ argTypes: {
8
+ id: {
9
+ control: false
10
+ },
11
+ title: {
12
+ control: false
13
+ },
14
+ children: {
15
+ table: {
16
+ type: {
17
+ summary: "ReactNode"
18
+ }
19
+ }
20
+ },
21
+ icon: {
22
+ control: "inline-radio",
23
+ options: [
24
+ "None",
25
+ "Edit",
26
+ "Plus",
27
+ "Loading"
28
+ ],
29
+ mapping: {
30
+ None: null,
31
+ Edit: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
32
+ symbol: "Edit"
33
+ }),
34
+ Plus: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
35
+ symbol: "Plus"
36
+ }),
37
+ Loading: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
38
+ animate: true,
39
+ symbol: "Loading"
40
+ })
41
+ },
42
+ table: {
43
+ type: {
44
+ summary: "ReactNode"
45
+ }
46
+ }
47
+ }
48
+ },
49
+ args: {
50
+ id: "default-button",
51
+ type: "primary",
52
+ onClick: (0, __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__.fn)(),
53
+ children: "Click Me!",
54
+ size: "normal",
55
+ disabled: false,
56
+ tooltip: "This is a tooltip"
57
+ }
58
+ };
59
+ const Button_stories_rslib_entry_ = meta;
60
+ const Primary = {
61
+ args: {
62
+ id: "primary-button"
63
+ }
64
+ };
65
+ const Secondary = {
66
+ args: {
67
+ id: "secondary-button",
68
+ type: "secondary"
69
+ }
70
+ };
71
+ const Disabled = {
72
+ args: {
73
+ id: "disabled-button",
74
+ disabled: true
75
+ }
76
+ };
77
+ const Small = {
78
+ args: {
79
+ id: "small-button",
80
+ size: "small"
81
+ }
82
+ };
83
+ const WithIcon = {
84
+ args: {
85
+ id: "with-icon-button",
86
+ children: "Edit",
87
+ icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
88
+ symbol: "Edit"
89
+ })
90
+ }
91
+ };
92
+ const WithTooltip = {
93
+ args: {
94
+ id: "with-tooltip-button",
95
+ tooltip: "This is a tooltip"
96
+ }
97
+ };
98
+ const Loading = {
99
+ args: {
100
+ id: "loading-button",
101
+ children: "Loading",
102
+ icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
103
+ animate: true,
104
+ symbol: "Loading"
105
+ })
106
+ }
107
+ };
108
+ const Submit = {
109
+ args: {
110
+ id: "submit-button",
111
+ type: "submit",
112
+ children: "Submit"
113
+ },
114
+ play: async ({ args, canvas, userEvent })=>{
115
+ await userEvent.click(canvas.getByRole("button", {
116
+ name: "Submit"
117
+ }));
118
+ await (0, __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__.expect)(args.onClick).toHaveBeenCalled();
119
+ }
120
+ };
121
+ export { Disabled, Loading, Primary, Secondary, Small, Submit, WithIcon, WithTooltip, Button_stories_rslib_entry_ as default };
@@ -11,8 +11,11 @@ type Props<Option> = {
11
11
  labelFont?: LabelFontOption;
12
12
  onChange: Dispatch<Option>;
13
13
  options: Array<Option>;
14
+ /** Function to infer an id from an option. */
14
15
  optionToId: (option: Option) => string;
16
+ /** Function to infer a label from an option. */
15
17
  optionToLabel: (option: Option) => ReactNode;
18
+ /** Function to infer if an option is disabled */
16
19
  optionToDisabled?: (option: Option) => boolean;
17
20
  required?: boolean;
18
21
  values: Array<Option>;
@@ -0,0 +1,62 @@
1
+ import type { StoryObj } from "@storybook/nextjs-vite";
2
+ declare const meta: {
3
+ component: <Option>({ autoFocus, description, errors, id, includeValueInTracking, label, labelFont, onChange, options, optionToId, optionToLabel, optionToDisabled, required, values, direction, }: {
4
+ autoFocus?: boolean;
5
+ description?: import("react").ReactNode;
6
+ errors?: Array<import("../forms/_types").ValidationError>;
7
+ id: string;
8
+ includeValueInTracking?: boolean;
9
+ label: import("react").ReactNode;
10
+ labelFont?: import("../utils/field").LabelFontOption;
11
+ onChange: import("react").Dispatch<Option>;
12
+ options: Option[];
13
+ optionToId: (option: Option) => string;
14
+ optionToLabel: (option: Option) => import("react").ReactNode;
15
+ optionToDisabled?: ((option: Option) => boolean) | undefined;
16
+ required?: boolean;
17
+ values: Option[];
18
+ direction?: "row" | "column";
19
+ }) => import("react/jsx-runtime").JSX.Element;
20
+ argTypes: {
21
+ id: {
22
+ table: {
23
+ disable: true;
24
+ };
25
+ };
26
+ };
27
+ args: {
28
+ label: string;
29
+ description: string;
30
+ direction: "column";
31
+ errors: never[];
32
+ labelFont: "label";
33
+ required: false;
34
+ options: string[];
35
+ optionToId: (option: string) => string;
36
+ optionToLabel: (option: string) => string;
37
+ onChange: import("storybook/test").Mock<(...args: any[]) => any>;
38
+ values: never[];
39
+ };
40
+ render: (args: {
41
+ autoFocus?: boolean;
42
+ description?: import("react").ReactNode;
43
+ errors?: Array<import("../forms/_types").ValidationError>;
44
+ id: string;
45
+ includeValueInTracking?: boolean;
46
+ label: import("react").ReactNode;
47
+ labelFont?: import("../utils/field").LabelFontOption;
48
+ onChange: import("react").Dispatch<string>;
49
+ options: string[];
50
+ optionToId: (option: string) => string;
51
+ optionToLabel: (option: string) => import("react").ReactNode;
52
+ optionToDisabled?: ((option: string) => boolean) | undefined;
53
+ required?: boolean;
54
+ values: string[];
55
+ direction?: "row" | "column";
56
+ }) => import("react/jsx-runtime").JSX.Element;
57
+ };
58
+ export default meta;
59
+ type Story = StoryObj<typeof meta>;
60
+ export declare const Normal: Story;
61
+ export declare const WithErrors: Story;
62
+ export declare const WithDisabledOption: Story;
@@ -0,0 +1,85 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_storybook_internal_preview_api_1bb4c151__ from "storybook/internal/preview-api";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__ from "storybook/test";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__CheckboxSetField_js_221d12c5__ from "./CheckboxSetField.js";
5
+ const meta = {
6
+ component: __WEBPACK_EXTERNAL_MODULE__CheckboxSetField_js_221d12c5__["default"],
7
+ argTypes: {
8
+ id: {
9
+ table: {
10
+ disable: true
11
+ }
12
+ }
13
+ },
14
+ args: {
15
+ label: "Checkbox Set",
16
+ description: "Select some options",
17
+ direction: "column",
18
+ errors: [],
19
+ labelFont: "label",
20
+ required: false,
21
+ options: [
22
+ "Option 1",
23
+ "Option 2",
24
+ "Option 3"
25
+ ],
26
+ optionToId: (option)=>option,
27
+ optionToLabel: (option)=>option,
28
+ onChange: (0, __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__.fn)(),
29
+ values: []
30
+ },
31
+ render: (args)=>{
32
+ const [{ values, onChange }, updateArgs] = (0, __WEBPACK_EXTERNAL_MODULE_storybook_internal_preview_api_1bb4c151__.useArgs)();
33
+ const onCheckboxChange = (option)=>{
34
+ const newValues = values.includes(option) ? values.filter((val)=>val !== option) : [
35
+ ...values,
36
+ option
37
+ ];
38
+ updateArgs({
39
+ values: newValues
40
+ });
41
+ onChange(option);
42
+ };
43
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__CheckboxSetField_js_221d12c5__["default"], {
44
+ ...args,
45
+ values: values,
46
+ onChange: onCheckboxChange
47
+ });
48
+ }
49
+ };
50
+ const CheckboxSetField_stories_rslib_entry_ = meta;
51
+ const Normal = {
52
+ args: {
53
+ id: "normalCheckboxSetField"
54
+ },
55
+ play: async ({ args, canvas, userEvent })=>{
56
+ await userEvent.click(await canvas.findByLabelText("Option 1"));
57
+ await (0, __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__.expect)(await canvas.findByLabelText("Option 1")).toBeChecked();
58
+ await (0, __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__.expect)(args.onChange).toHaveBeenCalledWith("Option 1");
59
+ await userEvent.click(await canvas.findByLabelText("Option 1"));
60
+ }
61
+ };
62
+ const WithErrors = {
63
+ args: {
64
+ id: "withErrorsCheckboxSetField",
65
+ errors: [
66
+ {
67
+ id: "error1",
68
+ message: "Please select an option",
69
+ field: "option"
70
+ }
71
+ ]
72
+ }
73
+ };
74
+ const WithDisabledOption = {
75
+ args: {
76
+ id: "withDisabledOptionsCheckboxSetField",
77
+ options: [
78
+ "Option 1",
79
+ "Option 2",
80
+ "Option 3"
81
+ ],
82
+ optionToDisabled: (option)=>"Option 2" === option
83
+ }
84
+ };
85
+ export { Normal, WithDisabledOption, WithErrors, CheckboxSetField_stories_rslib_entry_ as default };
@@ -0,0 +1,49 @@
1
+ import type { StoryObj } from "@storybook/nextjs-vite";
2
+ declare const meta: {
3
+ component: ({ autoFocus, description, disabled, errors, id, label, labelFont, onChange, required, value, }: {
4
+ autoFocus?: boolean;
5
+ description?: import("react").ReactNode;
6
+ disabled?: boolean;
7
+ errors?: Array<import("../forms/_types").ValidationError>;
8
+ id: string;
9
+ label: import("react").ReactNode;
10
+ labelFont?: import("../utils/field").LabelFontOption;
11
+ onChange: (value: string) => void;
12
+ placeholder?: string;
13
+ required?: boolean;
14
+ value: string | null;
15
+ }) => import("react/jsx-runtime").JSX.Element;
16
+ argTypes: {
17
+ id: {
18
+ table: {
19
+ disable: true;
20
+ };
21
+ };
22
+ };
23
+ args: {
24
+ label: string;
25
+ value: string;
26
+ onChange: import("storybook/test").Mock<(...args: any[]) => any>;
27
+ description: string;
28
+ labelFont: "label";
29
+ required: false;
30
+ disabled: false;
31
+ };
32
+ render: (args: {
33
+ autoFocus?: boolean;
34
+ description?: import("react").ReactNode;
35
+ disabled?: boolean;
36
+ errors?: Array<import("../forms/_types").ValidationError>;
37
+ id: string;
38
+ label: import("react").ReactNode;
39
+ labelFont?: import("../utils/field").LabelFontOption;
40
+ onChange: (value: string) => void;
41
+ placeholder?: string;
42
+ required?: boolean;
43
+ value: string | null;
44
+ }) => import("react/jsx-runtime").JSX.Element;
45
+ };
46
+ export default meta;
47
+ type Story = StoryObj<typeof meta>;
48
+ export declare const Normal: Story;
49
+ export declare const WithErrors: Story;
@@ -0,0 +1,56 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_storybook_preview_api_98c434a5__ from "storybook/preview-api";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__ from "storybook/test";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__ColorPickerField_js_e131d60a__ from "./ColorPickerField.js";
5
+ const meta = {
6
+ component: __WEBPACK_EXTERNAL_MODULE__ColorPickerField_js_e131d60a__["default"],
7
+ argTypes: {
8
+ id: {
9
+ table: {
10
+ disable: true
11
+ }
12
+ }
13
+ },
14
+ args: {
15
+ label: "Color",
16
+ value: "#90116e",
17
+ onChange: (0, __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__.fn)(),
18
+ description: "Select a color",
19
+ labelFont: "label",
20
+ required: false,
21
+ disabled: false
22
+ },
23
+ render: (args)=>{
24
+ const [{ value, onChange }, updateArgs] = (0, __WEBPACK_EXTERNAL_MODULE_storybook_preview_api_98c434a5__.useArgs)();
25
+ const onColorChange = (color)=>{
26
+ updateArgs({
27
+ value: color
28
+ });
29
+ onChange(color);
30
+ };
31
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ColorPickerField_js_e131d60a__["default"], {
32
+ ...args,
33
+ value: value,
34
+ onChange: onColorChange
35
+ });
36
+ }
37
+ };
38
+ const ColorPickerField_stories_rslib_entry_ = meta;
39
+ const Normal = {
40
+ args: {
41
+ id: "normalColorPickerField"
42
+ }
43
+ };
44
+ const WithErrors = {
45
+ args: {
46
+ id: "withErrorsColorPickerField",
47
+ errors: [
48
+ {
49
+ id: "error1",
50
+ message: "Please select a color",
51
+ field: "color"
52
+ }
53
+ ]
54
+ }
55
+ };
56
+ export { Normal, WithErrors, ColorPickerField_stories_rslib_entry_ as default };
@@ -0,0 +1,44 @@
1
+ import type { StoryObj } from "@storybook/nextjs-vite";
2
+ declare const meta: {
3
+ component: ({ id, label, description, value, onChange, errors, logoUrl, required, }: {
4
+ id?: string;
5
+ label?: import("react").ReactNode;
6
+ description?: import("react").ReactNode;
7
+ value: File | null | undefined;
8
+ onChange: import("react").Dispatch<File | null | undefined>;
9
+ errors?: Array<import("../forms/_types").ValidationError>;
10
+ logoUrl?: string | null;
11
+ required?: boolean;
12
+ }) => import("react/jsx-runtime").JSX.Element;
13
+ argTypes: {
14
+ id: {
15
+ table: {
16
+ disable: true;
17
+ };
18
+ };
19
+ };
20
+ args: {
21
+ value: undefined;
22
+ logoUrl: string;
23
+ onChange: import("storybook/test").Mock<(...args: any[]) => any>;
24
+ errors: never[];
25
+ required: false;
26
+ };
27
+ render: (args: {
28
+ id?: string;
29
+ label?: import("react").ReactNode;
30
+ description?: import("react").ReactNode;
31
+ value: File | null | undefined;
32
+ onChange: import("react").Dispatch<File | null | undefined>;
33
+ errors?: Array<import("../forms/_types").ValidationError>;
34
+ logoUrl?: string | null;
35
+ required?: boolean;
36
+ }) => import("react/jsx-runtime").JSX.Element;
37
+ };
38
+ export default meta;
39
+ type Story = StoryObj<typeof meta>;
40
+ export declare const WithExistingLogo: Story;
41
+ export declare const WithSelectedFile: Story;
42
+ export declare const WithErrors: Story;
43
+ export declare const Required: Story;
44
+ export declare const NoExistingLogo: Story;
@@ -0,0 +1,79 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_storybook_internal_preview_api_1bb4c151__ from "storybook/internal/preview-api";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__ from "storybook/test";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__OrgLogoField_js_246d57f5__ from "./OrgLogoField.js";
5
+ const meta = {
6
+ component: __WEBPACK_EXTERNAL_MODULE__OrgLogoField_js_246d57f5__["default"],
7
+ argTypes: {
8
+ id: {
9
+ table: {
10
+ disable: true
11
+ }
12
+ }
13
+ },
14
+ args: {
15
+ value: void 0,
16
+ logoUrl: "/worknice-logo.png",
17
+ onChange: (0, __WEBPACK_EXTERNAL_MODULE_storybook_test_a99c99ea__.fn)(),
18
+ errors: [],
19
+ required: false
20
+ },
21
+ render: (args)=>{
22
+ const [{ value, onChange }, updateArgs] = (0, __WEBPACK_EXTERNAL_MODULE_storybook_internal_preview_api_1bb4c151__.useArgs)();
23
+ const onFileChange = (file)=>{
24
+ console.log("file", file);
25
+ updateArgs({
26
+ value: file
27
+ });
28
+ onChange(file);
29
+ };
30
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__OrgLogoField_js_246d57f5__["default"], {
31
+ ...args,
32
+ value: value,
33
+ onChange: onFileChange
34
+ });
35
+ }
36
+ };
37
+ const OrgLogoField_stories_rslib_entry_ = meta;
38
+ const WithExistingLogo = {
39
+ args: {
40
+ id: "normalOrgLogoField"
41
+ }
42
+ };
43
+ const WithSelectedFile = {
44
+ args: {
45
+ id: "withSelectedFileOrgLogoField",
46
+ logoUrl: null,
47
+ value: new File([
48
+ "content"
49
+ ], "logo.png", {
50
+ type: "image/png"
51
+ })
52
+ }
53
+ };
54
+ const WithErrors = {
55
+ args: {
56
+ id: "withErrorsOrgLogoField",
57
+ errors: [
58
+ {
59
+ id: "error1",
60
+ message: "Please upload a valid image file",
61
+ field: "logo"
62
+ }
63
+ ]
64
+ }
65
+ };
66
+ const Required = {
67
+ args: {
68
+ id: "requiredOrgLogoField",
69
+ required: true
70
+ }
71
+ };
72
+ const NoExistingLogo = {
73
+ args: {
74
+ id: "noExistingLogoOrgLogoField",
75
+ logoUrl: null,
76
+ value: void 0
77
+ }
78
+ };
79
+ export { NoExistingLogo, Required, WithErrors, WithExistingLogo, WithSelectedFile, OrgLogoField_stories_rslib_entry_ as default };