@bosonprotocol/react-kit 0.31.1 → 0.32.0-alpha.0
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/buttons/BaseButton.d.ts +27 -0
- package/dist/cjs/components/buttons/BaseButton.d.ts.map +1 -0
- package/dist/cjs/components/buttons/BaseButton.js +154 -0
- package/dist/cjs/components/buttons/BaseButton.js.map +1 -0
- package/dist/cjs/components/form/BaseInput.d.ts +17 -0
- package/dist/cjs/components/form/BaseInput.d.ts.map +1 -0
- package/dist/cjs/components/form/BaseInput.js +88 -0
- package/dist/cjs/components/form/BaseInput.js.map +1 -0
- package/dist/cjs/components/form/BaseTagsInput.d.ts +8 -0
- package/dist/cjs/components/form/BaseTagsInput.d.ts.map +1 -0
- package/dist/cjs/components/form/{TagsInput.js → BaseTagsInput.js} +24 -16
- package/dist/cjs/components/form/BaseTagsInput.js.map +1 -0
- package/dist/cjs/components/form/ClearButton.d.ts +14 -0
- package/dist/cjs/components/form/ClearButton.d.ts.map +1 -0
- package/dist/cjs/components/form/ClearButton.js +28 -0
- package/dist/cjs/components/form/ClearButton.js.map +1 -0
- package/dist/cjs/components/form/Field.styles.d.ts +45 -7
- package/dist/cjs/components/form/Field.styles.d.ts.map +1 -1
- package/dist/cjs/components/form/Field.styles.js +44 -36
- package/dist/cjs/components/form/Field.styles.js.map +1 -1
- package/dist/cjs/components/form/Input.d.ts +3 -2
- package/dist/cjs/components/form/Input.d.ts.map +1 -1
- package/dist/cjs/components/form/Input.js +37 -24
- package/dist/cjs/components/form/Input.js.map +1 -1
- package/dist/cjs/components/form/Phone.js +1 -1
- package/dist/cjs/components/form/Phone.js.map +1 -1
- package/dist/cjs/components/form/index.d.ts +3 -2
- package/dist/cjs/components/form/index.d.ts.map +1 -1
- package/dist/cjs/components/form/index.js +17 -3
- package/dist/cjs/components/form/index.js.map +1 -1
- package/dist/cjs/components/form/styles/{TagsInput.styles.d.ts → BaseTagsInput.styles.d.ts} +6 -2
- package/dist/cjs/components/form/styles/BaseTagsInput.styles.d.ts.map +1 -0
- package/dist/cjs/components/form/styles/BaseTagsInput.styles.js +76 -0
- package/dist/cjs/components/form/styles/BaseTagsInput.styles.js.map +1 -0
- package/dist/cjs/components/styles/GlobalStyle.d.ts +1 -14
- package/dist/cjs/components/styles/GlobalStyle.d.ts.map +1 -1
- package/dist/cjs/components/styles/GlobalStyle.js +14 -41
- package/dist/cjs/components/styles/GlobalStyle.js.map +1 -1
- package/dist/cjs/components/ui/ThemedButton.d.ts.map +1 -1
- package/dist/cjs/components/ui/ThemedButton.js +3 -97
- package/dist/cjs/components/ui/ThemedButton.js.map +1 -1
- package/dist/cjs/components/ui/styles.d.ts.map +1 -1
- package/dist/cjs/components/ui/styles.js +5 -2
- package/dist/cjs/components/ui/styles.js.map +1 -1
- package/dist/cjs/hooks/useCurrentSellers.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/buttons/BaseButton.d.ts +27 -0
- package/dist/esm/components/buttons/BaseButton.d.ts.map +1 -0
- package/dist/esm/components/buttons/BaseButton.js +107 -0
- package/dist/esm/components/buttons/BaseButton.js.map +1 -0
- package/dist/esm/components/form/BaseInput.d.ts +17 -0
- package/dist/esm/components/form/BaseInput.d.ts.map +1 -0
- package/dist/esm/components/form/BaseInput.js +47 -0
- package/dist/esm/components/form/BaseInput.js.map +1 -0
- package/dist/esm/components/form/BaseTagsInput.d.ts +8 -0
- package/dist/esm/components/form/BaseTagsInput.d.ts.map +1 -0
- package/dist/esm/components/form/{TagsInput.js → BaseTagsInput.js} +22 -17
- package/dist/esm/components/form/BaseTagsInput.js.map +1 -0
- package/dist/esm/components/form/ClearButton.d.ts +14 -0
- package/dist/esm/components/form/ClearButton.d.ts.map +1 -0
- package/dist/esm/components/form/ClearButton.js +22 -0
- package/dist/esm/components/form/ClearButton.js.map +1 -0
- package/dist/esm/components/form/Field.styles.d.ts +45 -7
- package/dist/esm/components/form/Field.styles.d.ts.map +1 -1
- package/dist/esm/components/form/Field.styles.js +44 -36
- package/dist/esm/components/form/Field.styles.js.map +1 -1
- package/dist/esm/components/form/Input.d.ts +3 -2
- package/dist/esm/components/form/Input.d.ts.map +1 -1
- package/dist/esm/components/form/Input.js +37 -12
- package/dist/esm/components/form/Input.js.map +1 -1
- package/dist/esm/components/form/Phone.js +1 -1
- package/dist/esm/components/form/Phone.js.map +1 -1
- package/dist/esm/components/form/index.d.ts +3 -2
- 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/styles/{TagsInput.styles.d.ts → BaseTagsInput.styles.d.ts} +6 -2
- package/dist/esm/components/form/styles/BaseTagsInput.styles.d.ts.map +1 -0
- package/dist/esm/components/form/styles/{TagsInput.styles.js → BaseTagsInput.styles.js} +14 -4
- package/dist/esm/components/form/styles/BaseTagsInput.styles.js.map +1 -0
- package/dist/esm/components/styles/GlobalStyle.d.ts +1 -14
- package/dist/esm/components/styles/GlobalStyle.d.ts.map +1 -1
- package/dist/esm/components/styles/GlobalStyle.js +14 -41
- package/dist/esm/components/styles/GlobalStyle.js.map +1 -1
- package/dist/esm/components/ui/ThemedButton.d.ts.map +1 -1
- package/dist/esm/components/ui/ThemedButton.js +4 -98
- package/dist/esm/components/ui/ThemedButton.js.map +1 -1
- package/dist/esm/components/ui/styles.d.ts.map +1 -1
- package/dist/esm/components/ui/styles.js +5 -2
- package/dist/esm/components/ui/styles.js.map +1 -1
- package/dist/esm/hooks/useCurrentSellers.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/buttons/BaseButton.tsx +181 -0
- package/src/components/form/BaseInput.tsx +88 -0
- package/src/components/form/{TagsInput.tsx → BaseTagsInput.tsx} +46 -24
- package/src/components/form/ClearButton.tsx +39 -0
- package/src/components/form/Field.styles.ts +83 -40
- package/src/components/form/Input.tsx +42 -21
- package/src/components/form/Phone.tsx +1 -1
- package/src/components/form/index.ts +3 -2
- package/src/components/form/styles/{TagsInput.styles.ts → BaseTagsInput.styles.ts} +18 -4
- package/src/components/styles/GlobalStyle.tsx +15 -71
- package/src/components/ui/ThemedButton.tsx +8 -145
- package/src/components/ui/styles.ts +5 -2
- package/src/hooks/useCurrentSellers.ts +8 -8
- package/src/index.tsx +2 -0
- package/src/stories/buttons/button.stories.tsx +84 -62
- package/src/stories/form/Input.stories.tsx +67 -0
- package/src/stories/ui/ThemedButton.stories.tsx +79 -52
- package/dist/cjs/components/form/TagsInput.d.ts +0 -4
- package/dist/cjs/components/form/TagsInput.d.ts.map +0 -1
- package/dist/cjs/components/form/TagsInput.js.map +0 -1
- package/dist/cjs/components/form/styles/TagsInput.styles.d.ts.map +0 -1
- package/dist/cjs/components/form/styles/TagsInput.styles.js +0 -46
- package/dist/cjs/components/form/styles/TagsInput.styles.js.map +0 -1
- package/dist/cjs/global.d.ts +0 -5
- package/dist/cjs/global.d.ts.map +0 -1
- package/dist/cjs/global.js +0 -44
- package/dist/cjs/global.js.map +0 -1
- package/dist/esm/components/form/TagsInput.d.ts +0 -4
- package/dist/esm/components/form/TagsInput.d.ts.map +0 -1
- package/dist/esm/components/form/TagsInput.js.map +0 -1
- package/dist/esm/components/form/styles/TagsInput.styles.d.ts.map +0 -1
- package/dist/esm/components/form/styles/TagsInput.styles.js.map +0 -1
- package/dist/esm/global.d.ts +0 -5
- package/dist/esm/global.d.ts.map +0 -1
- package/dist/esm/global.js +0 -41
- package/dist/esm/global.js.map +0 -1
- package/src/global.ts +0 -42
|
@@ -1,104 +1,11 @@
|
|
|
1
|
-
import React, { ButtonHTMLAttributes, forwardRef
|
|
2
|
-
import styled, { css, ThemeProvider } from "styled-components";
|
|
1
|
+
import React, { ButtonHTMLAttributes, forwardRef } from "react";
|
|
3
2
|
|
|
4
|
-
import { zIndex } from "./zIndex";
|
|
5
|
-
import { Tooltip } from "../tooltip/Tooltip";
|
|
6
|
-
import * as Styles from "./styles";
|
|
7
|
-
import { Typography } from "./Typography";
|
|
8
3
|
import { theme } from "../../theme";
|
|
9
|
-
import {
|
|
4
|
+
import { BaseButton } from "../buttons/BaseButton";
|
|
10
5
|
import { ButtonSize } from "./buttonSize";
|
|
11
6
|
|
|
12
7
|
const colors = theme.colors.light;
|
|
13
8
|
|
|
14
|
-
const BaseButton = styled.button<{
|
|
15
|
-
size: IButton["size"];
|
|
16
|
-
fill: IButton["fill"];
|
|
17
|
-
}>`
|
|
18
|
-
${() => Styles.button};
|
|
19
|
-
${(props) => Styles[props.size as keyof typeof Styles]}
|
|
20
|
-
border-style: solid;
|
|
21
|
-
border-color: ${(props) => props.theme.borderColor || "transparent"};
|
|
22
|
-
border-width: ${(props) => props.theme.borderWidth || 0}px;
|
|
23
|
-
color: ${(props) => props.theme.color || "#000000"};
|
|
24
|
-
background-color: ${(props) => props.theme.background || "transparent"};
|
|
25
|
-
svg {
|
|
26
|
-
stroke: ${(props) => props.theme.color || "#000000"};
|
|
27
|
-
}
|
|
28
|
-
${(props) =>
|
|
29
|
-
props.fill
|
|
30
|
-
? css`
|
|
31
|
-
width: 100%;
|
|
32
|
-
`
|
|
33
|
-
: ""};
|
|
34
|
-
${(props) =>
|
|
35
|
-
props.theme.hover &&
|
|
36
|
-
css`
|
|
37
|
-
&:hover:not(:disabled) {
|
|
38
|
-
background-color: ${props.theme.hover.background};
|
|
39
|
-
${props.theme.hover.color &&
|
|
40
|
-
css`
|
|
41
|
-
color: ${props.theme.hover.color} !important;
|
|
42
|
-
svg {
|
|
43
|
-
fill: ${props.theme.hover.color} !important;
|
|
44
|
-
line {
|
|
45
|
-
stroke: ${props.theme.hover.color} !important;
|
|
46
|
-
}
|
|
47
|
-
polyline {
|
|
48
|
-
stroke: ${props.theme.hover.color} !important;
|
|
49
|
-
}
|
|
50
|
-
path {
|
|
51
|
-
stroke: ${props.theme.hover.color} !important;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
`};
|
|
55
|
-
${props.theme.hover.borderColor &&
|
|
56
|
-
css`
|
|
57
|
-
border-color: ${props.theme.hover.borderColor};
|
|
58
|
-
`};
|
|
59
|
-
}
|
|
60
|
-
`}
|
|
61
|
-
${(props) =>
|
|
62
|
-
props.theme.padding
|
|
63
|
-
? css`
|
|
64
|
-
padding: ${props.theme.padding} !important;
|
|
65
|
-
`
|
|
66
|
-
: ""}
|
|
67
|
-
|
|
68
|
-
${(props) =>
|
|
69
|
-
props.theme.disabled
|
|
70
|
-
? css`
|
|
71
|
-
&:disabled {
|
|
72
|
-
background-color: ${props.theme.disabled.background ||
|
|
73
|
-
"transparent"};
|
|
74
|
-
color: ${props.theme.disabled.color || colors.darkGrey};
|
|
75
|
-
border-color: transparent;
|
|
76
|
-
cursor: not-allowed;
|
|
77
|
-
opacity: 0.5;
|
|
78
|
-
}
|
|
79
|
-
`
|
|
80
|
-
: css`
|
|
81
|
-
&:disabled {
|
|
82
|
-
background-color: ${colors.lightGrey};
|
|
83
|
-
color: ${colors.darkGrey};
|
|
84
|
-
border-color: transparent;
|
|
85
|
-
cursor: not-allowed;
|
|
86
|
-
opacity: 0.5;
|
|
87
|
-
}
|
|
88
|
-
`};
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
const ChildWrapperButton = styled.div`
|
|
92
|
-
display: flex;
|
|
93
|
-
align-items: center;
|
|
94
|
-
justify-content: center;
|
|
95
|
-
gap: 12px;
|
|
96
|
-
position: relative;
|
|
97
|
-
z-index: ${zIndex.Button};
|
|
98
|
-
|
|
99
|
-
${() => Styles.buttonText};
|
|
100
|
-
`;
|
|
101
|
-
|
|
102
9
|
const allThemes = ({ withBosonStyle }: { withBosonStyle?: boolean }) => {
|
|
103
10
|
return {
|
|
104
11
|
primary: {
|
|
@@ -325,57 +232,13 @@ export type IButton = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
325
232
|
};
|
|
326
233
|
|
|
327
234
|
const ThemedButton = forwardRef<HTMLButtonElement, IButton>(
|
|
328
|
-
(
|
|
329
|
-
{
|
|
330
|
-
children,
|
|
331
|
-
onClick,
|
|
332
|
-
size = "regular",
|
|
333
|
-
themeVal = "primary",
|
|
334
|
-
type = "button",
|
|
335
|
-
step = 0,
|
|
336
|
-
fill = false,
|
|
337
|
-
isLoading = false,
|
|
338
|
-
tooltip = "",
|
|
339
|
-
withBosonStyle = false,
|
|
340
|
-
...rest
|
|
341
|
-
},
|
|
342
|
-
ref
|
|
343
|
-
) => {
|
|
344
|
-
const Wrapper = tooltip !== "" && rest?.disabled ? Tooltip : Fragment;
|
|
345
|
-
const wrapperParams =
|
|
346
|
-
tooltip !== "" && rest?.disabled ? { wrap: false, content: tooltip } : {};
|
|
235
|
+
({ themeVal = "primary", withBosonStyle = false, ...rest }, ref) => {
|
|
347
236
|
return (
|
|
348
|
-
|
|
349
|
-
{
|
|
350
|
-
{
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
{/* @ts-ignore */}
|
|
354
|
-
<Wrapper {...wrapperParams}>
|
|
355
|
-
<BaseButton
|
|
356
|
-
onClick={onClick}
|
|
357
|
-
type={type}
|
|
358
|
-
size={size}
|
|
359
|
-
fill={fill ? fill : undefined}
|
|
360
|
-
{...rest}
|
|
361
|
-
ref={ref}
|
|
362
|
-
>
|
|
363
|
-
{isLoading ? (
|
|
364
|
-
<Loading />
|
|
365
|
-
) : (
|
|
366
|
-
<ChildWrapperButton data-child-wrapper-button>
|
|
367
|
-
{children}
|
|
368
|
-
{step !== 0 && (
|
|
369
|
-
<Typography>
|
|
370
|
-
<small>Step {step}</small>
|
|
371
|
-
</Typography>
|
|
372
|
-
)}
|
|
373
|
-
</ChildWrapperButton>
|
|
374
|
-
)}
|
|
375
|
-
</BaseButton>
|
|
376
|
-
</Wrapper>
|
|
377
|
-
</ThemeProvider>
|
|
378
|
-
</>
|
|
237
|
+
<BaseButton
|
|
238
|
+
{...rest}
|
|
239
|
+
ref={ref}
|
|
240
|
+
theme={allThemes({ withBosonStyle })[themeVal]}
|
|
241
|
+
/>
|
|
379
242
|
);
|
|
380
243
|
}
|
|
381
244
|
);
|
|
@@ -33,8 +33,11 @@ export const clamp = css`
|
|
|
33
33
|
-webkit-box-orient: vertical;
|
|
34
34
|
`;
|
|
35
35
|
export const boxShadow = css`
|
|
36
|
-
box-shadow:
|
|
37
|
-
0px 0px
|
|
36
|
+
box-shadow:
|
|
37
|
+
0px 0px 4px rgba(0, 0, 0, 0.05),
|
|
38
|
+
0px 0px 8px rgba(0, 0, 0, 0.05),
|
|
39
|
+
0px 0px 16px rgba(0, 0, 0, 0.05),
|
|
40
|
+
0px 0px 32px rgba(0, 0, 0, 0.05);
|
|
38
41
|
`;
|
|
39
42
|
|
|
40
43
|
export const text = css`
|
|
@@ -259,15 +259,15 @@ export function useCurrentSellers(
|
|
|
259
259
|
const sellerType: string[] | string[][] = resultById?.data
|
|
260
260
|
? resultById.data.map((d) => Object.keys(d))
|
|
261
261
|
: resultByLensId?.data
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
? Object.keys(resultByLensId.data)
|
|
263
|
+
: resultByAddress?.data?.sellerType || [];
|
|
264
264
|
|
|
265
265
|
const sellerIdsToQuery: string[] =
|
|
266
266
|
sellerAddressType === "SELLER_IDS"
|
|
267
267
|
? (sellerAddress as string[])
|
|
268
268
|
: sellerAddressType === "LENS_TOKEN_ID" && resultByLensId?.data?.sellerId
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
? [resultByLensId?.data.sellerId]
|
|
270
|
+
: [];
|
|
271
271
|
const enableSellerById = !!sellerIdsToQuery?.length;
|
|
272
272
|
const { data: sellers2, refetch: refetchFetchSellers } = fetchSellers(
|
|
273
273
|
sellerIdsToQuery,
|
|
@@ -360,10 +360,10 @@ export function useCurrentSellers(
|
|
|
360
360
|
resultByAddress.data
|
|
361
361
|
? resultByAddress.data.sellers.map((seller) => seller.id)
|
|
362
362
|
: sellerAddressType === "SELLER_IDS"
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
363
|
+
? Array.isArray(sellerAddress)
|
|
364
|
+
? sellerAddress
|
|
365
|
+
: [sellerAddress]
|
|
366
|
+
: []
|
|
367
367
|
).filter((sellerId) => !!sellerId) as string[];
|
|
368
368
|
}, [resultByAddress.data, sellerAddress, sellerAddressType]);
|
|
369
369
|
return {
|
package/src/index.tsx
CHANGED
|
@@ -6,6 +6,7 @@ export { default as ThemedButton, IButton } from "./components/ui/ThemedButton";
|
|
|
6
6
|
export * from "./components/ui/zIndex";
|
|
7
7
|
export * from "./components/ui/buttonSize";
|
|
8
8
|
export * from "./components/buttons/Button";
|
|
9
|
+
export * from "./components/buttons/BaseButton";
|
|
9
10
|
export * from "./components/buttons/CommitButtonView";
|
|
10
11
|
export * from "./components/cta/exchange/BatchCompleteButton";
|
|
11
12
|
export * from "./components/cta/exchange/CancelButton";
|
|
@@ -58,6 +59,7 @@ export * from "./components/ui/Grid";
|
|
|
58
59
|
export * from "./components/ui/GridContainer";
|
|
59
60
|
export * from "./components/ui/Typography";
|
|
60
61
|
export * from "./components/ui/MuteButton";
|
|
62
|
+
export * from "./components/form";
|
|
61
63
|
export * from "./lib/magicLink/logout";
|
|
62
64
|
export * from "./lib/magicLink/provider";
|
|
63
65
|
export * from "./lib/const/networks";
|
|
@@ -1,88 +1,110 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
-
|
|
1
|
+
import { fn } from "@storybook/test";
|
|
4
2
|
import { Button } from "../../components/buttons/Button";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Meta } from "@storybook/react";
|
|
5
5
|
|
|
6
6
|
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
7
7
|
export default {
|
|
8
8
|
title: "Visual Components/Buttons/Button",
|
|
9
|
-
component: Button
|
|
10
|
-
|
|
9
|
+
component: Button,
|
|
10
|
+
parameters: {
|
|
11
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
12
|
+
layout: "centered"
|
|
13
|
+
},
|
|
14
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
15
|
+
tags: ["autodocs"],
|
|
16
|
+
args: { onClick: fn() },
|
|
17
|
+
argTypes: {
|
|
18
|
+
disabled: { control: "boolean" },
|
|
19
|
+
size: {
|
|
20
|
+
control: "select",
|
|
21
|
+
options: ["small", "regular", "large"]
|
|
22
|
+
},
|
|
23
|
+
children: { control: "text" },
|
|
24
|
+
tooltip: { control: "text" }
|
|
25
|
+
},
|
|
26
|
+
decorators: [
|
|
27
|
+
(Story) => {
|
|
28
|
+
return <Story />;
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
} satisfies Meta<typeof Button>;
|
|
11
32
|
|
|
12
33
|
const BASE_ARGS = {
|
|
13
34
|
children: "Button Text",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
size: "regular"
|
|
35
|
+
size: "regular",
|
|
36
|
+
tooltip: "tooltip shown when disabled only"
|
|
17
37
|
} as const;
|
|
18
|
-
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
19
|
-
const Template: ComponentStory<typeof Button> = (args) => (
|
|
20
|
-
<Button {...BASE_ARGS} {...args} />
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
export const PrimaryFill: ComponentStory<typeof Button> = Template.bind({});
|
|
24
|
-
|
|
25
|
-
export const PrimaryInverted: ComponentStory<typeof Button> = Template.bind({});
|
|
26
|
-
|
|
27
|
-
export const SecondaryFill: ComponentStory<typeof Button> = Template.bind({});
|
|
28
|
-
|
|
29
|
-
export const SecondaryInverted: ComponentStory<typeof Button> = Template.bind(
|
|
30
|
-
{}
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
export const AccentFill: ComponentStory<typeof Button> = Template.bind({});
|
|
34
|
-
|
|
35
|
-
export const AccentInverted: ComponentStory<typeof Button> = Template.bind({});
|
|
36
|
-
|
|
37
|
-
export const Disabled: ComponentStory<typeof Button> = Template.bind({});
|
|
38
|
-
|
|
39
|
-
export const Loading: ComponentStory<typeof Button> = Template.bind({});
|
|
40
38
|
|
|
41
39
|
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
42
|
-
PrimaryFill
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
export const PrimaryFill = {
|
|
41
|
+
args: {
|
|
42
|
+
...BASE_ARGS,
|
|
43
|
+
disabled: false,
|
|
44
|
+
loading: false,
|
|
45
|
+
variant: "primaryFill"
|
|
46
|
+
}
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
PrimaryInverted
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
export const PrimaryInverted = {
|
|
50
|
+
args: {
|
|
51
|
+
...BASE_ARGS,
|
|
52
|
+
disabled: false,
|
|
53
|
+
loading: false,
|
|
54
|
+
variant: "primaryInverted"
|
|
55
|
+
}
|
|
52
56
|
};
|
|
53
57
|
|
|
54
|
-
SecondaryFill
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
export const SecondaryFill = {
|
|
59
|
+
args: {
|
|
60
|
+
...BASE_ARGS,
|
|
61
|
+
disabled: false,
|
|
62
|
+
loading: false,
|
|
63
|
+
variant: "secondaryFill"
|
|
64
|
+
}
|
|
58
65
|
};
|
|
59
66
|
|
|
60
|
-
SecondaryInverted
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
export const SecondaryInverted = {
|
|
68
|
+
args: {
|
|
69
|
+
...BASE_ARGS,
|
|
70
|
+
disabled: false,
|
|
71
|
+
loading: false,
|
|
72
|
+
variant: "secondaryInverted"
|
|
73
|
+
}
|
|
64
74
|
};
|
|
65
75
|
|
|
66
|
-
AccentFill
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
export const AccentFill = {
|
|
77
|
+
args: {
|
|
78
|
+
...BASE_ARGS,
|
|
79
|
+
disabled: false,
|
|
80
|
+
loading: false,
|
|
81
|
+
variant: "accentFill"
|
|
82
|
+
}
|
|
70
83
|
};
|
|
71
84
|
|
|
72
|
-
AccentInverted
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
export const AccentInverted = {
|
|
86
|
+
args: {
|
|
87
|
+
...BASE_ARGS,
|
|
88
|
+
disabled: false,
|
|
89
|
+
loading: false,
|
|
90
|
+
variant: "accentInverted"
|
|
91
|
+
}
|
|
76
92
|
};
|
|
77
93
|
|
|
78
|
-
Disabled
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
export const Disabled = {
|
|
95
|
+
args: {
|
|
96
|
+
...BASE_ARGS,
|
|
97
|
+
disabled: true,
|
|
98
|
+
loading: false,
|
|
99
|
+
variant: "primaryFill"
|
|
100
|
+
}
|
|
82
101
|
};
|
|
83
102
|
|
|
84
|
-
Loading
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
103
|
+
export const Loading = {
|
|
104
|
+
args: {
|
|
105
|
+
...BASE_ARGS,
|
|
106
|
+
disabled: false,
|
|
107
|
+
loading: true,
|
|
108
|
+
variant: "primaryFill"
|
|
109
|
+
}
|
|
88
110
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Input } from "../../components/form";
|
|
3
|
+
import { Formik } from "formik";
|
|
4
|
+
import type { Meta } from "@storybook/react";
|
|
5
|
+
import { fn } from "@storybook/test";
|
|
6
|
+
const inputWithErrors = "With error";
|
|
7
|
+
const defaultHeightSize = "regular";
|
|
8
|
+
const inputName = "test";
|
|
9
|
+
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
10
|
+
export default {
|
|
11
|
+
title: "Visual Components/Inputs/Input",
|
|
12
|
+
component: Input,
|
|
13
|
+
parameters: {
|
|
14
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
15
|
+
layout: "centered"
|
|
16
|
+
},
|
|
17
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
18
|
+
tags: ["autodocs"],
|
|
19
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
20
|
+
argTypes: {
|
|
21
|
+
disabled: { control: "boolean" },
|
|
22
|
+
heightSize: {
|
|
23
|
+
control: "select",
|
|
24
|
+
options: ["small", "regular", "large"]
|
|
25
|
+
},
|
|
26
|
+
isClearable: { control: "boolean" }
|
|
27
|
+
},
|
|
28
|
+
// 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
|
|
29
|
+
args: { onClick: fn() },
|
|
30
|
+
decorators: [
|
|
31
|
+
(Story, { name }) => {
|
|
32
|
+
return (
|
|
33
|
+
<Formik<{ [inputName]: unknown }>
|
|
34
|
+
onSubmit={() => {
|
|
35
|
+
//
|
|
36
|
+
}}
|
|
37
|
+
initialErrors={
|
|
38
|
+
name === inputWithErrors
|
|
39
|
+
? { [inputName]: "Input error before typing!" }
|
|
40
|
+
: {}
|
|
41
|
+
}
|
|
42
|
+
initialValues={{ [inputName]: "" }}
|
|
43
|
+
initialTouched={{ [inputName]: true }}
|
|
44
|
+
>
|
|
45
|
+
<Story />
|
|
46
|
+
</Formik>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
] satisfies Meta<typeof Input>["decorators"]
|
|
50
|
+
} satisfies Meta<typeof Input>;
|
|
51
|
+
|
|
52
|
+
export const Simple = {
|
|
53
|
+
args: {
|
|
54
|
+
name: inputName,
|
|
55
|
+
placeholder: "this is a placeholder",
|
|
56
|
+
heightSize: defaultHeightSize
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const InputWithError = {
|
|
61
|
+
name: "With error",
|
|
62
|
+
args: {
|
|
63
|
+
name: inputName,
|
|
64
|
+
placeholder: "this is a placeholder",
|
|
65
|
+
heightSize: defaultHeightSize
|
|
66
|
+
}
|
|
67
|
+
};
|
|
@@ -1,75 +1,102 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import React from "react";
|
|
3
|
+
import { fn } from "@storybook/test";
|
|
5
4
|
import { CaretDown } from "phosphor-react";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import ThemedButton from "../../components/ui/ThemedButton";
|
|
6
7
|
|
|
7
8
|
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
8
9
|
export default {
|
|
9
|
-
title: "Visual Components/
|
|
10
|
-
component: ThemedButton
|
|
11
|
-
|
|
10
|
+
title: "Visual Components/Buttons/ThemedButton",
|
|
11
|
+
component: ThemedButton,
|
|
12
|
+
parameters: {
|
|
13
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
+
layout: "centered"
|
|
15
|
+
},
|
|
16
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
17
|
+
tags: ["autodocs"],
|
|
18
|
+
args: { onClick: fn() },
|
|
19
|
+
argTypes: {
|
|
20
|
+
disabled: { control: "boolean" },
|
|
21
|
+
size: {
|
|
22
|
+
control: "select",
|
|
23
|
+
options: ["small", "regular", "large"]
|
|
24
|
+
},
|
|
25
|
+
children: {
|
|
26
|
+
table: {
|
|
27
|
+
disable: true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
onClick: {
|
|
31
|
+
table: {
|
|
32
|
+
disable: true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
tooltip: { control: "text" }
|
|
36
|
+
},
|
|
37
|
+
decorators: [
|
|
38
|
+
(Story) => {
|
|
39
|
+
return <Story />;
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
} satisfies Meta<typeof ThemedButton>;
|
|
12
43
|
|
|
13
|
-
const BASE_ARGS
|
|
44
|
+
const BASE_ARGS = {
|
|
14
45
|
children: (
|
|
15
46
|
<>
|
|
16
47
|
Button Text <CaretDown size={16} />
|
|
17
48
|
</>
|
|
18
49
|
),
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
20
|
-
onClick: () => {},
|
|
21
50
|
size: "regular"
|
|
22
|
-
};
|
|
23
|
-
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
24
|
-
const Template: ComponentStory<typeof ThemedButton> = (args) => (
|
|
25
|
-
<ThemedButton {...BASE_ARGS} {...args} />
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
export const Primary: ComponentStory<typeof ThemedButton> = Template.bind({});
|
|
29
|
-
|
|
30
|
-
export const BosonPrimary: ComponentStory<typeof ThemedButton> = Template.bind(
|
|
31
|
-
{}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export const Secondary: ComponentStory<typeof ThemedButton> = Template.bind({});
|
|
35
|
-
export const BosonSecondary: ComponentStory<typeof ThemedButton> =
|
|
36
|
-
Template.bind({});
|
|
37
|
-
export const AccentFiil: ComponentStory<typeof ThemedButton> = Template.bind(
|
|
38
|
-
{}
|
|
39
|
-
);
|
|
51
|
+
} as const;
|
|
40
52
|
|
|
41
53
|
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
42
|
-
Primary
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
export const Primary = {
|
|
55
|
+
args: {
|
|
56
|
+
...BASE_ARGS,
|
|
57
|
+
disabled: false,
|
|
58
|
+
isLoading: false,
|
|
59
|
+
themeVal: "primary",
|
|
60
|
+
withBosonStyle: false
|
|
61
|
+
}
|
|
47
62
|
};
|
|
48
63
|
|
|
49
|
-
BosonPrimary
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
export const BosonPrimary = {
|
|
65
|
+
args: {
|
|
66
|
+
...BASE_ARGS,
|
|
67
|
+
disabled: false,
|
|
68
|
+
isLoading: false,
|
|
69
|
+
themeVal: "bosonPrimary",
|
|
70
|
+
withBosonStyle: true
|
|
71
|
+
}
|
|
54
72
|
};
|
|
55
73
|
|
|
56
|
-
Secondary
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
74
|
+
export const Secondary = {
|
|
75
|
+
args: {
|
|
76
|
+
...BASE_ARGS,
|
|
77
|
+
disabled: false,
|
|
78
|
+
isLoading: false,
|
|
79
|
+
themeVal: "secondary",
|
|
80
|
+
withBosonStyle: false
|
|
81
|
+
}
|
|
61
82
|
};
|
|
62
83
|
|
|
63
|
-
BosonSecondary
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
84
|
+
export const BosonSecondary = {
|
|
85
|
+
args: {
|
|
86
|
+
...BASE_ARGS,
|
|
87
|
+
disabled: false,
|
|
88
|
+
isLoading: false,
|
|
89
|
+
themeVal: "secondary",
|
|
90
|
+
withBosonStyle: true
|
|
91
|
+
}
|
|
68
92
|
};
|
|
69
93
|
|
|
70
|
-
AccentFiil
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
94
|
+
export const AccentFiil = {
|
|
95
|
+
args: {
|
|
96
|
+
...BASE_ARGS,
|
|
97
|
+
disabled: false,
|
|
98
|
+
isLoading: false,
|
|
99
|
+
themeVal: "accentFill",
|
|
100
|
+
withBosonStyle: true
|
|
101
|
+
}
|
|
75
102
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TagsInput.d.ts","sourceRoot":"","sources":["../../../../src/components/form/TagsInput.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,QAAA,MAAM,SAAS,gFASZ,SAAS,gBA6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C,CAAC,CAAC;IAClB,OAAO,CACL;QACE,8BAAC,WAAI,IAAC,GAAG,EAAC,QAAQ,EAAC,UAAU,EAAC,QAAQ;YACnC,KAAK,IAAI,8BAAC,uBAAU,QAAE,KAAK,CAAc;YAC1C,8BAAC,+BAAY;gBACX,8BAAC,yBAAU,IACT,SAAS,EAAE,aAAa,EACxB,IAAI,EAAC,MAAM,EACX,WAAW,EAAE,WAAW,IAAI,gBAAgB,EAC5C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,YAAY,GACnB;gBACF,8BAAC,yBAAM;;oBACK,8BAAC,0BAAS,IAAC,IAAI,EAAE,EAAE,GAAI,CAC1B,CACI,CACV;QACP,8BAAC,+BAAY,IAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YACtC,KAAK,IAAI,CACR,8BAAC,uBAAU,IAAC,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAG,KAAK,CAAc,CAClE;YACA,IAAI,CAAC,GAAG,CAAC,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE,CAAC,CACxC,8BAAC,6BAAU,IAAC,GAAG,EAAE,gBAAgB,GAAG,EAAE;gBACpC,wCAAM,SAAS,EAAC,MAAM,IAAE,GAAG,CAAQ;gBACnC,8BAAC,wBAAK,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,aAAiB,CAC5C,CACd,CAAC,CACW;QACf,8BAAC,eAAK,IAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,GAAI;QAAC,GAAG,CAC1D,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TagsInput.styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/styles/TagsInput.styles.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,YAAY,gNAQxB,CAAC;AAEF,eAAO,MAAM,MAAM,gNAWlB,CAAC;AACF,eAAO,MAAM,UAAU,gNAItB,CAAC;AAEF,eAAO,MAAM,KAAK,kNASjB,CAAC"}
|