@bosonprotocol/react-kit 0.33.0-alpha.16 → 0.33.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/form/BaseCheckbox.d.ts +5 -0
- package/dist/cjs/components/form/BaseCheckbox.d.ts.map +1 -0
- package/dist/cjs/components/form/BaseCheckbox.js +69 -0
- package/dist/cjs/components/form/BaseCheckbox.js.map +1 -0
- package/dist/cjs/components/form/Checkbox.d.ts +13 -2
- package/dist/cjs/components/form/Checkbox.d.ts.map +1 -1
- package/dist/cjs/components/form/Checkbox.js +18 -61
- package/dist/cjs/components/form/Checkbox.js.map +1 -1
- package/dist/cjs/components/form/Field.styles.d.ts +23 -1
- package/dist/cjs/components/form/Field.styles.d.ts.map +1 -1
- package/dist/cjs/components/form/Field.styles.js +66 -14
- package/dist/cjs/components/form/Field.styles.js.map +1 -1
- package/dist/cjs/components/form/Upload/WithUploadToIpfs.d.ts.map +1 -1
- package/dist/cjs/components/form/Upload/WithUploadToIpfs.js +7 -10
- package/dist/cjs/components/form/Upload/WithUploadToIpfs.js.map +1 -1
- package/dist/cjs/components/form/index.d.ts +2 -1
- package/dist/cjs/components/form/index.d.ts.map +1 -1
- package/dist/cjs/components/form/index.js +4 -2
- package/dist/cjs/components/form/index.js.map +1 -1
- package/dist/cjs/components/form/types.d.ts +2 -1
- package/dist/cjs/components/form/types.d.ts.map +1 -1
- package/dist/cjs/components/ui/IpfsImage.d.ts +4 -3
- package/dist/cjs/components/ui/IpfsImage.d.ts.map +1 -1
- package/dist/cjs/components/ui/IpfsImage.js +2 -2
- package/dist/cjs/components/ui/IpfsImage.js.map +1 -1
- package/dist/cjs/components/ui/Video.d.ts +3 -3
- package/dist/cjs/components/ui/Video.d.ts.map +1 -1
- package/dist/cjs/components/ui/Video.js +5 -3
- package/dist/cjs/components/ui/Video.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/form/BaseCheckbox.d.ts +5 -0
- package/dist/esm/components/form/BaseCheckbox.d.ts.map +1 -0
- package/dist/esm/components/form/BaseCheckbox.js +27 -0
- package/dist/esm/components/form/BaseCheckbox.js.map +1 -0
- package/dist/esm/components/form/Checkbox.d.ts +13 -2
- package/dist/esm/components/form/Checkbox.d.ts.map +1 -1
- package/dist/esm/components/form/Checkbox.js +16 -25
- package/dist/esm/components/form/Checkbox.js.map +1 -1
- package/dist/esm/components/form/Field.styles.d.ts +23 -1
- package/dist/esm/components/form/Field.styles.d.ts.map +1 -1
- package/dist/esm/components/form/Field.styles.js +47 -13
- package/dist/esm/components/form/Field.styles.js.map +1 -1
- package/dist/esm/components/form/Upload/WithUploadToIpfs.d.ts.map +1 -1
- package/dist/esm/components/form/Upload/WithUploadToIpfs.js +7 -10
- package/dist/esm/components/form/Upload/WithUploadToIpfs.js.map +1 -1
- package/dist/esm/components/form/index.d.ts +2 -1
- package/dist/esm/components/form/index.d.ts.map +1 -1
- package/dist/esm/components/form/index.js +2 -1
- package/dist/esm/components/form/index.js.map +1 -1
- package/dist/esm/components/form/types.d.ts +2 -1
- package/dist/esm/components/form/types.d.ts.map +1 -1
- package/dist/esm/components/ui/IpfsImage.d.ts +4 -3
- package/dist/esm/components/ui/IpfsImage.d.ts.map +1 -1
- package/dist/esm/components/ui/IpfsImage.js +2 -2
- package/dist/esm/components/ui/IpfsImage.js.map +1 -1
- package/dist/esm/components/ui/Video.d.ts +3 -3
- package/dist/esm/components/ui/Video.d.ts.map +1 -1
- package/dist/esm/components/ui/Video.js +3 -3
- package/dist/esm/components/ui/Video.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/form/BaseCheckbox.tsx +49 -0
- package/src/components/form/Checkbox.tsx +17 -40
- package/src/components/form/Field.styles.ts +85 -15
- package/src/components/form/Upload/WithUploadToIpfs.tsx +7 -10
- package/src/components/form/index.ts +2 -1
- package/src/components/form/types.ts +6 -1
- package/src/components/ui/IpfsImage.tsx +14 -7
- package/src/components/ui/Video.tsx +5 -5
- package/src/index.tsx +1 -0
- package/src/stories/buttons/Upload.stories.tsx +8 -0
- package/src/stories/form/BaseCheckbox.stories.tsx +113 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BaseCheckbox, BaseCheckboxProps } from "../../components/form";
|
|
3
|
+
import { Formik } from "formik";
|
|
4
|
+
import type { Meta } from "@storybook/react";
|
|
5
|
+
import { theme } from "../../theme";
|
|
6
|
+
import { bosonCheckboxTheme } from "../../components/form/Checkbox";
|
|
7
|
+
const colors = theme.colors.light;
|
|
8
|
+
|
|
9
|
+
const inputName = "test";
|
|
10
|
+
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
11
|
+
export default {
|
|
12
|
+
title: "Visual Components/Inputs/BaseCheckbox",
|
|
13
|
+
component: BaseCheckbox,
|
|
14
|
+
parameters: {
|
|
15
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
16
|
+
layout: "centered"
|
|
17
|
+
},
|
|
18
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
21
|
+
argTypes: {
|
|
22
|
+
disabled: { control: "boolean" },
|
|
23
|
+
text: { control: "text" }
|
|
24
|
+
},
|
|
25
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
26
|
+
// args: { onClick: fn() },
|
|
27
|
+
decorators: [
|
|
28
|
+
(Story, { name }) => {
|
|
29
|
+
return (
|
|
30
|
+
<Formik<{ [inputName]: unknown }>
|
|
31
|
+
onSubmit={() => {
|
|
32
|
+
//
|
|
33
|
+
}}
|
|
34
|
+
initialErrors={
|
|
35
|
+
name.toLowerCase().includes("error")
|
|
36
|
+
? { [inputName]: "Checkbox error!" }
|
|
37
|
+
: {}
|
|
38
|
+
}
|
|
39
|
+
initialValues={{ [inputName]: "" }}
|
|
40
|
+
initialTouched={{ [inputName]: true }}
|
|
41
|
+
>
|
|
42
|
+
<Story />
|
|
43
|
+
</Formik>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
] satisfies Meta<typeof BaseCheckbox>["decorators"]
|
|
47
|
+
} satisfies Meta<typeof BaseCheckbox>;
|
|
48
|
+
|
|
49
|
+
const BASE_ARGS = {
|
|
50
|
+
name: inputName,
|
|
51
|
+
text: "text next to checkbox via 'text' prop",
|
|
52
|
+
theme: bosonCheckboxTheme
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Simple = {
|
|
56
|
+
args: {
|
|
57
|
+
...BASE_ARGS
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const CustomTheme = {
|
|
62
|
+
name: "With custom theme",
|
|
63
|
+
args: {
|
|
64
|
+
...BASE_ARGS,
|
|
65
|
+
theme: {
|
|
66
|
+
backgroundColor: colors.blue,
|
|
67
|
+
borderColor: colors.green,
|
|
68
|
+
color: colors.red,
|
|
69
|
+
borderRadius: "4px",
|
|
70
|
+
hover: {
|
|
71
|
+
borderColor: colors.red,
|
|
72
|
+
backgroundColor: colors.primary,
|
|
73
|
+
color: colors.darkRed
|
|
74
|
+
},
|
|
75
|
+
checked: {
|
|
76
|
+
borderColor: "#ff00d4",
|
|
77
|
+
color: "#ff00d4",
|
|
78
|
+
backgroundColor: "#ff00d444"
|
|
79
|
+
},
|
|
80
|
+
error: {
|
|
81
|
+
color: colors.orange,
|
|
82
|
+
borderColor: colors.bosonSkyBlue,
|
|
83
|
+
backgroundColor: colors.cyan
|
|
84
|
+
}
|
|
85
|
+
} satisfies BaseCheckboxProps["theme"]
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
export const InputWithError = {
|
|
89
|
+
name: "With error",
|
|
90
|
+
args: {
|
|
91
|
+
...BASE_ARGS
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const CustomThemeWithError = {
|
|
96
|
+
name: "With custom theme and error",
|
|
97
|
+
args: {
|
|
98
|
+
...BASE_ARGS,
|
|
99
|
+
theme: {
|
|
100
|
+
backgroundColor: colors.blue,
|
|
101
|
+
borderColor: colors.green,
|
|
102
|
+
hover: {
|
|
103
|
+
borderColor: colors.red,
|
|
104
|
+
backgroundColor: colors.grey
|
|
105
|
+
},
|
|
106
|
+
error: {
|
|
107
|
+
color: colors.orange,
|
|
108
|
+
borderColor: colors.bosonSkyBlue,
|
|
109
|
+
backgroundColor: colors.cyan
|
|
110
|
+
}
|
|
111
|
+
} satisfies BaseCheckboxProps["theme"]
|
|
112
|
+
}
|
|
113
|
+
};
|