@sikka/hawa 0.0.1 → 0.0.2
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/README.md +48 -19
- package/dist/index.es.js +37 -0
- package/dist/index.js +37 -0
- package/package.json +1 -1
- package/rollup.config.js +3 -13
- package/src/components/Hawa/AdaptiveButton/{AdaptiveButton.jsx → AdaptiveButton.js} +57 -64
- package/src/components/Hawa/AdaptiveButton/index.js +1 -1
- package/src/components/Hawa/AuthForms/NewPasswordForm.js +23 -0
- package/src/components/Hawa/AuthForms/ResetPasswordForm.js +21 -0
- package/src/components/Hawa/AuthForms/SignInForm.js +25 -0
- package/src/components/Hawa/AuthForms/SignUpForm.js +26 -0
- package/src/components/Hawa/AuthForms/index.js +4 -0
- package/src/components/Hawa/AuthForms/viaFacebook.js +0 -0
- package/src/components/Hawa/AuthForms/viaGithub.js +0 -0
- package/src/components/Hawa/AuthForms/viaGoogle.js +0 -0
- package/src/components/Hawa/AuthForms/viaTwitter.js +0 -0
- package/src/components/Hawa/AutoCompleteField/AutoCompleteField.jsx +7 -7
- package/src/components/Hawa/AutoCompleteField/index.js +1 -1
- package/src/components/Hawa/Box/Box.js +18 -0
- package/src/components/Hawa/Box/index.js +1 -0
- package/src/components/Hawa/Checkbox/Checkbox.jsx +7 -7
- package/src/components/Hawa/DragDropImages/DragDropImages.jsx +13 -13
- package/src/components/Hawa/DragDropImages/index.js +1 -1
- package/src/components/Hawa/HawaProvider/HawaProvider.js +4 -4
- package/src/components/Hawa/InputLabel/StyledInputLabel.js +15 -0
- package/src/components/Hawa/InputLabel/index.js +1 -1
- package/src/components/Hawa/RadioBox/RadioBox.jsx +1 -1
- package/src/components/Hawa/RadioBox/index.js +1 -1
- package/src/components/Hawa/RadioSelector/RadioSelector.jsx +5 -5
- package/src/components/Hawa/RadioSelector/index.js +1 -1
- package/src/components/Hawa/Row/Row.jsx +20 -22
- package/src/components/Hawa/SelectedField/SelectedField.jsx +1 -1
- package/src/components/Hawa/SelectedField/index.js +1 -1
- package/src/components/Hawa/StyledAlert/StyledAlert.js +15 -0
- package/src/components/Hawa/StyledAlert/index.js +1 -0
- package/src/components/Hawa/StyledTooltip/StyledTooltip.js +46 -0
- package/src/components/Hawa/StyledTooltip/index.js +1 -0
- package/src/components/Hawa/TabPanel/TabPanel.jsx +1 -2
- package/src/components/Hawa/TextArea/TextArea.jsx +11 -12
- package/src/components/Hawa/TextField/{TextField.jsx → TextField.js} +23 -10
- package/src/components/Hawa/TextField/index.js +1 -1
- package/src/components/Hawa/index.js +0 -1
- package/src/stories/AdaptiveButton.stories.js +3 -7
- package/src/stories/Alert.stories.js +48 -0
- package/src/stories/AuthForm.stories.js +76 -0
- package/src/stories/Box.stories.js +45 -0
- package/src/stories/CheckBox.stories.js +2 -1
- package/src/stories/RadioSelector.stories.js +2 -2
- package/src/stories/TextField.stories.js +17 -26
- package/src/styles.css +0 -3
- package/src/util.js +20 -0
- package/storybook-static/0.12392f0b.iframe.bundle.js +1 -0
- package/storybook-static/0.55b012452099ace2dca6.manager.bundle.js +1 -0
- package/storybook-static/1.0f38715c61c7c3cd11db.manager.bundle.js +1 -0
- package/storybook-static/1.7c0dc86d.iframe.bundle.js +3 -0
- package/storybook-static/{4.f6eb74f4.iframe.bundle.js.LICENSE.txt → 1.7c0dc86d.iframe.bundle.js.LICENSE.txt} +8 -8
- package/storybook-static/1.7c0dc86d.iframe.bundle.js.map +1 -0
- package/storybook-static/10.9f2923a7561bc20fffdb.manager.bundle.js +1 -0
- package/storybook-static/{11.49c687eaa6261f8b7be2.manager.bundle.js → 11.f4e922583ae35da460f3.manager.bundle.js} +2 -2
- package/storybook-static/{11.49c687eaa6261f8b7be2.manager.bundle.js.LICENSE.txt → 11.f4e922583ae35da460f3.manager.bundle.js.LICENSE.txt} +12 -12
- package/storybook-static/{12.c9538ed3766c96f289e7.manager.bundle.js → 12.1415460941f0bdcb8fa8.manager.bundle.js} +1 -1
- package/storybook-static/2.ee357266.iframe.bundle.js +1 -0
- package/storybook-static/3.592ce28f.iframe.bundle.js +1 -0
- package/storybook-static/{5.fa71488e730c5c7f885f.manager.bundle.js → 5.f459d151315e6780c20f.manager.bundle.js} +2 -2
- package/storybook-static/{5.fa71488e730c5c7f885f.manager.bundle.js.LICENSE.txt → 5.f459d151315e6780c20f.manager.bundle.js.LICENSE.txt} +8 -8
- package/storybook-static/6.3bd64d820f3745f262ff.manager.bundle.js +1 -0
- package/storybook-static/{7.b34baecbd082bc7b188d.manager.bundle.js → 7.3d04765dbf3f1dcd706c.manager.bundle.js} +1 -1
- package/storybook-static/7.af56919f.iframe.bundle.js +1 -0
- package/storybook-static/8.8e2132ec.iframe.bundle.js +3 -0
- package/storybook-static/{6.fbc7b90b.iframe.bundle.js.LICENSE.txt → 8.8e2132ec.iframe.bundle.js.LICENSE.txt} +12 -12
- package/storybook-static/8.8e2132ec.iframe.bundle.js.map +1 -0
- package/storybook-static/{8.15577edffecf900a8de2.manager.bundle.js → 8.b541eadfcb9164835dfc.manager.bundle.js} +1 -1
- package/storybook-static/9.109ea555.iframe.bundle.js +1 -0
- package/storybook-static/9.411ac8e451bbb10926c7.manager.bundle.js +1 -0
- package/storybook-static/iframe.html +348 -138
- package/storybook-static/index.html +51 -47
- package/storybook-static/main.78b7d418.iframe.bundle.js +1 -0
- package/storybook-static/main.9bb085ebb152f5b19a2a.manager.bundle.js +1 -0
- package/storybook-static/{runtime~main.909d038f912f063e8837.manager.bundle.js → runtime~main.9468098d21070636985f.manager.bundle.js} +1 -1
- package/storybook-static/runtime~main.ffc8677e.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.4aa936b1.iframe.bundle.js +3 -0
- package/storybook-static/{vendors~main.73411ca9.iframe.bundle.js.LICENSE.txt → vendors~main.4aa936b1.iframe.bundle.js.LICENSE.txt} +148 -148
- package/storybook-static/vendors~main.4aa936b1.iframe.bundle.js.map +1 -0
- package/storybook-static/vendors~main.a935f15a2179a6eff5fd.manager.bundle.js +2 -0
- package/storybook-static/{vendors~main.d3455eed64b243c89325.manager.bundle.js.LICENSE.txt → vendors~main.a935f15a2179a6eff5fd.manager.bundle.js.LICENSE.txt} +110 -88
- package/src/components/Hawa/InputLabel/StyledInputLabel.jsx +0 -36
- package/storybook-static/0.86a7edfd.iframe.bundle.js +0 -1
- package/storybook-static/0.b73eaee9a88f178d62ed.manager.bundle.js +0 -1
- package/storybook-static/1.f296d183a17268696d73.manager.bundle.js +0 -1
- package/storybook-static/10.9998ba67d65d81d20896.manager.bundle.js +0 -1
- package/storybook-static/4.f6eb74f4.iframe.bundle.js +0 -3
- package/storybook-static/4.f6eb74f4.iframe.bundle.js.map +0 -1
- package/storybook-static/5.ec6f37af.iframe.bundle.js +0 -1
- package/storybook-static/6.8096ae4aadde0743697b.manager.bundle.js +0 -1
- package/storybook-static/6.fbc7b90b.iframe.bundle.js +0 -3
- package/storybook-static/6.fbc7b90b.iframe.bundle.js.map +0 -1
- package/storybook-static/7.a806a38f.iframe.bundle.js +0 -1
- package/storybook-static/9.d7d85aa0a49a98f17218.manager.bundle.js +0 -1
- package/storybook-static/main.355ffc59.iframe.bundle.js +0 -1
- package/storybook-static/main.ce406c7e93b98325390e.manager.bundle.js +0 -1
- package/storybook-static/runtime~main.3d81579b.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.73411ca9.iframe.bundle.js +0 -3
- package/storybook-static/vendors~main.73411ca9.iframe.bundle.js.map +0 -1
- package/storybook-static/vendors~main.d3455eed64b243c89325.manager.bundle.js +0 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useState, useContext } from "react";
|
|
2
|
+
import Tooltip from "@material-ui/core/Tooltip";
|
|
3
|
+
|
|
4
|
+
export const StyledTooltip = (props) => {
|
|
5
|
+
const screenSize = {
|
|
6
|
+
width: 1500,
|
|
7
|
+
height: 200
|
|
8
|
+
};
|
|
9
|
+
return (
|
|
10
|
+
<Tooltip
|
|
11
|
+
placement={screenSize.width > 400 ? "bottom-center" : "top-center"}
|
|
12
|
+
enterTouchDelay={100}
|
|
13
|
+
title={
|
|
14
|
+
props.hint ? (
|
|
15
|
+
props.hint
|
|
16
|
+
) : (
|
|
17
|
+
<div>
|
|
18
|
+
<div
|
|
19
|
+
style={{
|
|
20
|
+
fontSize: 20,
|
|
21
|
+
fontWeight: 800,
|
|
22
|
+
padding: 10,
|
|
23
|
+
paddingBottom: 5,
|
|
24
|
+
textAlign: "center"
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
{props.hintTitle}
|
|
28
|
+
</div>
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
fontSize: 13,
|
|
32
|
+
fontWeight: 100,
|
|
33
|
+
padding: 10,
|
|
34
|
+
textAlign: "center"
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{props.hintContent}
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
>
|
|
43
|
+
{props.children}
|
|
44
|
+
</Tooltip>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StyledTooltip.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Controller, useFormContext } from "react-hook-form";
|
|
3
|
-
import {StyledInputLabel} from "../InputLabel";
|
|
3
|
+
import { StyledInputLabel } from "../InputLabel";
|
|
4
4
|
|
|
5
5
|
export const StyledTextArea = (props) => {
|
|
6
6
|
const { control } = useFormContext();
|
|
@@ -13,16 +13,16 @@ export const StyledTextArea = (props) => {
|
|
|
13
13
|
{inputLabel ? <StyledInputLabel label={inputLabel} /> : null}
|
|
14
14
|
<textarea
|
|
15
15
|
style={{
|
|
16
|
-
color
|
|
17
|
-
backgroundColor
|
|
18
|
-
borderRadius
|
|
19
|
-
borderBottom
|
|
20
|
-
border
|
|
21
|
-
width
|
|
22
|
-
padding
|
|
23
|
-
margin
|
|
24
|
-
marginBottom
|
|
25
|
-
resize
|
|
16
|
+
color: "black",
|
|
17
|
+
backgroundColor: props.bgColor || "white",
|
|
18
|
+
borderRadius: props.bdRadius || 10,
|
|
19
|
+
borderBottom: "none",
|
|
20
|
+
border: "none",
|
|
21
|
+
width: "100%",
|
|
22
|
+
padding: 0,
|
|
23
|
+
margin: 0,
|
|
24
|
+
marginBottom: 0,
|
|
25
|
+
resize: props.resize || "vertical"
|
|
26
26
|
}}
|
|
27
27
|
value={field.value ?? ""}
|
|
28
28
|
{...field}
|
|
@@ -36,4 +36,3 @@ export const StyledTextArea = (props) => {
|
|
|
36
36
|
/>
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
|
-
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import TextField from "@material-ui/core/TextField"
|
|
3
|
-
import { StyledInputLabel } from "../InputLabel"
|
|
1
|
+
import React, { useState, useContext } from "react";
|
|
2
|
+
import TextField from "@material-ui/core/TextField";
|
|
3
|
+
import { StyledInputLabel } from "../InputLabel";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
import { ThemeProvider } from "../HawaProvider";
|
|
4
6
|
|
|
5
7
|
export const StyledTextField = (props) => {
|
|
8
|
+
const theme = useContext(ThemeProvider);
|
|
9
|
+
|
|
6
10
|
return (
|
|
7
11
|
<div>
|
|
8
12
|
{props.inputLabel ? <StyledInputLabel label={props.inputLabel} /> : null}
|
|
@@ -10,12 +14,12 @@ export const StyledTextField = (props) => {
|
|
|
10
14
|
fullWidth={true}
|
|
11
15
|
style={{
|
|
12
16
|
color: "white",
|
|
13
|
-
backgroundColor:
|
|
17
|
+
backgroundColor: theme.inputColor,
|
|
14
18
|
borderRadius: props.bdRadius || 10,
|
|
15
19
|
borderBottom: "none",
|
|
16
|
-
padding
|
|
20
|
+
padding: props.padding || 5,
|
|
17
21
|
border: "none",
|
|
18
|
-
width: "100%"
|
|
22
|
+
width: "100%"
|
|
19
23
|
}}
|
|
20
24
|
helperText={props.helperText}
|
|
21
25
|
type={props.type ? props.type : "text"}
|
|
@@ -26,16 +30,25 @@ export const StyledTextField = (props) => {
|
|
|
26
30
|
inputMode: "numeric",
|
|
27
31
|
min: "0",
|
|
28
32
|
max: "9999999",
|
|
29
|
-
step: "0.01"
|
|
33
|
+
step: "0.01"
|
|
30
34
|
}
|
|
31
35
|
: {}
|
|
32
36
|
}
|
|
33
37
|
InputProps={{
|
|
34
38
|
disableUnderline: true,
|
|
35
|
-
onWheelCapture: (e) => e.target.blur()
|
|
39
|
+
onWheelCapture: (e) => e.target.blur()
|
|
36
40
|
}}
|
|
37
41
|
value={props.value ? props.value : null}
|
|
38
42
|
/>
|
|
39
43
|
</div>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
StyledTextField.propTypes = {
|
|
48
|
+
type: PropTypes.oneOf(["text", "number"]),
|
|
49
|
+
helperText: PropTypes.string
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// StyledTextField.defaultProps = {
|
|
53
|
+
// type: "text"
|
|
54
|
+
// };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./TextField.
|
|
1
|
+
export * from "./TextField.js";
|
|
@@ -5,15 +5,15 @@ import { HawaProvider } from "../components/Hawa/HawaProvider";
|
|
|
5
5
|
|
|
6
6
|
const Template = (args) => {
|
|
7
7
|
const theme = {
|
|
8
|
-
borderRadius:
|
|
9
|
-
primaryColor: "
|
|
8
|
+
borderRadius: 10,
|
|
9
|
+
primaryColor: "#004fff",
|
|
10
10
|
secondaryColor: "red",
|
|
11
11
|
// margins: "10px",
|
|
12
12
|
paddings: 10
|
|
13
13
|
};
|
|
14
14
|
return (
|
|
15
15
|
<HawaProvider theme={theme}>
|
|
16
|
-
<AdaptiveButton {...args} />
|
|
16
|
+
<AdaptiveButton {...args} />
|
|
17
17
|
</HawaProvider>
|
|
18
18
|
);
|
|
19
19
|
};
|
|
@@ -45,9 +45,7 @@ Light.args = {
|
|
|
45
45
|
borderRadius: 5,
|
|
46
46
|
icon: <CastIcon />,
|
|
47
47
|
textColor: "#000000",
|
|
48
|
-
|
|
49
48
|
buttonColor: "#f9f9f9"
|
|
50
|
-
|
|
51
49
|
// placeholder: "Example ...",
|
|
52
50
|
// defaultValue: "This is default value",
|
|
53
51
|
// inputLabel: "Text Field",
|
|
@@ -62,7 +60,6 @@ Dark.args = {
|
|
|
62
60
|
buttonColor: "#878787",
|
|
63
61
|
textColor: "#ffffff",
|
|
64
62
|
icon: <CastIcon />
|
|
65
|
-
|
|
66
63
|
// placeholder: "Exemple ...",
|
|
67
64
|
// defaultValue: "This is default value",
|
|
68
65
|
// inputLabel: "Text Field",
|
|
@@ -76,7 +73,6 @@ Danger.args = {
|
|
|
76
73
|
buttonColor: "#c0c0c0",
|
|
77
74
|
danger: true,
|
|
78
75
|
icon: <CastIcon />
|
|
79
|
-
|
|
80
76
|
// placeholder: "Exemple ...",
|
|
81
77
|
// defaultValue: "This is default value",
|
|
82
78
|
// inputLabel: "Text Field",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { HawaProvider } from "../components/Hawa/HawaProvider";
|
|
4
|
+
import { StyledAlert } from "../components/Hawa/StyledAlert/StyledAlert";
|
|
5
|
+
|
|
6
|
+
const Template = (args) => {
|
|
7
|
+
const theme = {
|
|
8
|
+
borderRadius: 10,
|
|
9
|
+
primaryColor: "green",
|
|
10
|
+
secondaryColor: "red",
|
|
11
|
+
// margins: "10px",
|
|
12
|
+
paperColors: "#c6c6c6",
|
|
13
|
+
paddings: 10,
|
|
14
|
+
margins: 10
|
|
15
|
+
};
|
|
16
|
+
return (
|
|
17
|
+
<HawaProvider theme={theme}>
|
|
18
|
+
<StyledAlert text="teshht" />
|
|
19
|
+
</HawaProvider>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
//types:
|
|
23
|
+
//error (red)
|
|
24
|
+
//warning (red)
|
|
25
|
+
//notice (blue)
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
title: "Components/Alert",
|
|
29
|
+
component: StyledAlert
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Light = Template.bind({});
|
|
33
|
+
Light.args = {
|
|
34
|
+
showText: true,
|
|
35
|
+
buttonLabel: "test",
|
|
36
|
+
borderRadius: 5,
|
|
37
|
+
textColor: "#000000",
|
|
38
|
+
buttonColor: "#f9f9f9"
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Dark = Template.bind({});
|
|
42
|
+
Dark.args = {
|
|
43
|
+
showText: true,
|
|
44
|
+
buttonLabel: "test",
|
|
45
|
+
borderRadius: 5,
|
|
46
|
+
buttonColor: "#878787",
|
|
47
|
+
textColor: "#ffffff"
|
|
48
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NewPasswordForm } from "../components/Hawa/AuthForms/NewPasswordForm";
|
|
3
|
+
import { ResetPasswordForm } from "../components/Hawa/AuthForms/ResetPasswordForm";
|
|
4
|
+
import { SignInForm } from "../components/Hawa/AuthForms/SignInForm";
|
|
5
|
+
import { SignUpForm } from "../components/Hawa/AuthForms/SignUpForm";
|
|
6
|
+
import { HawaProvider } from "../components/Hawa/HawaProvider";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Blocks/AuthForms",
|
|
10
|
+
component: SignInForm,
|
|
11
|
+
argsTypes: {
|
|
12
|
+
viaGoogle: { control: "boolean" },
|
|
13
|
+
viaGithub: { control: "boolean" },
|
|
14
|
+
viaTwitter: { control: "boolean" },
|
|
15
|
+
viaFacebook: { control: "boolean" }
|
|
16
|
+
},
|
|
17
|
+
args: {}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const theme = {
|
|
21
|
+
borderRadius: 20,
|
|
22
|
+
primaryColor: "green",
|
|
23
|
+
secondaryColor: "red",
|
|
24
|
+
inputColor: "lightGrey",
|
|
25
|
+
paddings: 10
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const SignInTemplate = (args) => {
|
|
29
|
+
return (
|
|
30
|
+
<HawaProvider theme={theme}>
|
|
31
|
+
<SignInForm {...args} />
|
|
32
|
+
</HawaProvider>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const SignIn = SignInTemplate.bind({});
|
|
37
|
+
SignIn.args = {
|
|
38
|
+
viaGoogle: true,
|
|
39
|
+
viaGithub: true,
|
|
40
|
+
viaTwitter: true,
|
|
41
|
+
viaFacebook: true
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const SignUpTemplate = (args) => {
|
|
45
|
+
return (
|
|
46
|
+
<HawaProvider theme={theme}>
|
|
47
|
+
<SignUpForm {...args} />
|
|
48
|
+
</HawaProvider>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
export const SignUp = SignUpTemplate.bind({});
|
|
52
|
+
SignUp.args = {
|
|
53
|
+
viaGoogle: true,
|
|
54
|
+
viaGithub: true,
|
|
55
|
+
viaTwitter: true,
|
|
56
|
+
viaFacebook: true
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const ResetPasswordTemplate = (args) => {
|
|
60
|
+
return (
|
|
61
|
+
<HawaProvider theme={theme}>
|
|
62
|
+
<ResetPasswordForm {...args} />
|
|
63
|
+
</HawaProvider>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
export const ResetPassword = ResetPasswordTemplate.bind({});
|
|
67
|
+
ResetPassword.args = {};
|
|
68
|
+
const NewPasswordTemplate = (args) => {
|
|
69
|
+
return (
|
|
70
|
+
<HawaProvider theme={theme}>
|
|
71
|
+
<NewPasswordForm {...args} />
|
|
72
|
+
</HawaProvider>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
export const NewPassword = NewPasswordTemplate.bind({});
|
|
76
|
+
NewPassword.args = {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import AdaptiveButton from "../components/Hawa/AdaptiveButton/AdaptiveButton";
|
|
3
|
+
import { Box } from "../components/Hawa/Box";
|
|
4
|
+
import { HawaProvider } from "../components/Hawa/HawaProvider";
|
|
5
|
+
|
|
6
|
+
const Template = (args) => {
|
|
7
|
+
const theme = {
|
|
8
|
+
borderRadius: 10,
|
|
9
|
+
primaryColor: "green",
|
|
10
|
+
secondaryColor: "red",
|
|
11
|
+
// margins: "10px",
|
|
12
|
+
paperColors: "#c6c6c6",
|
|
13
|
+
paddings: 10,
|
|
14
|
+
margins: 10
|
|
15
|
+
};
|
|
16
|
+
return (
|
|
17
|
+
<HawaProvider theme={theme}>
|
|
18
|
+
<Box>Box 1</Box>
|
|
19
|
+
<Box>Box 2</Box>
|
|
20
|
+
<Box>Box 3</Box>
|
|
21
|
+
</HawaProvider>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
export default {
|
|
25
|
+
title: "Layout/Box",
|
|
26
|
+
component: AdaptiveButton
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Light = Template.bind({});
|
|
30
|
+
Light.args = {
|
|
31
|
+
showText: true,
|
|
32
|
+
buttonLabel: "test",
|
|
33
|
+
borderRadius: 5,
|
|
34
|
+
textColor: "#000000",
|
|
35
|
+
buttonColor: "#f9f9f9"
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Dark = Template.bind({});
|
|
39
|
+
Dark.args = {
|
|
40
|
+
showText: true,
|
|
41
|
+
buttonLabel: "test",
|
|
42
|
+
borderRadius: 5,
|
|
43
|
+
buttonColor: "#878787",
|
|
44
|
+
textColor: "#ffffff"
|
|
45
|
+
};
|
|
@@ -35,7 +35,6 @@ export default {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
export const Light = Template.bind({});
|
|
38
|
-
export const Dark = Template.bind({});
|
|
39
38
|
|
|
40
39
|
Light.args = {
|
|
41
40
|
options: [
|
|
@@ -47,11 +46,12 @@ Light.args = {
|
|
|
47
46
|
borderRadius: 12,
|
|
48
47
|
defaultValue: "option2",
|
|
49
48
|
bgSelectedColor: "red",
|
|
50
|
-
textSelectedColor: "
|
|
49
|
+
textSelectedColor: "white",
|
|
51
50
|
handleChange: () => {
|
|
52
51
|
console.log("handleChange goes here");
|
|
53
52
|
}
|
|
54
53
|
};
|
|
54
|
+
export const Dark = Template.bind({});
|
|
55
55
|
Dark.args = {
|
|
56
56
|
options: [
|
|
57
57
|
{ text: "Option 1", label: "option1" },
|
|
@@ -8,36 +8,26 @@ const Template = (args) => {
|
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
title: "Components/TextField",
|
|
11
|
-
component:
|
|
11
|
+
component: StyledTextField,
|
|
12
12
|
argsTypes: {
|
|
13
|
-
defaultValue: {
|
|
14
|
-
control: { type: "text" }
|
|
15
|
-
},
|
|
16
|
-
value: {
|
|
17
|
-
control: { type: "text" }
|
|
18
|
-
},
|
|
19
|
-
inputLabel: {
|
|
20
|
-
control: { type: "text" }
|
|
21
|
-
},
|
|
22
|
-
bdRadius: {
|
|
23
|
-
contol: { type: "number" }
|
|
24
|
-
},
|
|
25
|
-
placeholder: {
|
|
26
|
-
control: { type: "text" }
|
|
27
|
-
},
|
|
28
13
|
type: {
|
|
14
|
+
name: "type",
|
|
15
|
+
type: { name: "string", required: true },
|
|
29
16
|
options: ["text", "number", "date"],
|
|
30
|
-
control: { type: "radio" }
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
control: { type: "radio" },
|
|
18
|
+
defaultValue: "text",
|
|
19
|
+
description: "Styled Text Field",
|
|
20
|
+
table: {
|
|
21
|
+
type: { summary: "string" },
|
|
22
|
+
defaultValue: { summary: "Hello" }
|
|
23
|
+
}
|
|
34
24
|
}
|
|
35
|
-
},
|
|
36
|
-
args: {
|
|
37
|
-
bdRadius: 15,
|
|
38
|
-
defaultValue: "Test",
|
|
39
|
-
type: "date"
|
|
40
25
|
}
|
|
26
|
+
// args: {
|
|
27
|
+
// bdRadius: 15,
|
|
28
|
+
// defaultValue: "Test",
|
|
29
|
+
// type: "date"
|
|
30
|
+
// }
|
|
41
31
|
};
|
|
42
32
|
|
|
43
33
|
export const Light = Template.bind({});
|
|
@@ -45,10 +35,11 @@ export const Dark = Template.bind({});
|
|
|
45
35
|
|
|
46
36
|
Light.args = {
|
|
47
37
|
placeholder: "Exemple ...",
|
|
48
|
-
defaultValue: "This
|
|
38
|
+
defaultValue: "This isko default value",
|
|
49
39
|
inputLabel: "Text Field",
|
|
50
40
|
bgColor: "lightgray",
|
|
51
41
|
padding: 10
|
|
42
|
+
// type: "number"
|
|
52
43
|
};
|
|
53
44
|
Dark.args = {
|
|
54
45
|
placeholder: "Exemple ...",
|
package/src/styles.css
CHANGED
package/src/util.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const hexToRgb = (hex) => {
|
|
2
|
+
let d = hex?.split("#")[1];
|
|
3
|
+
var aRgbHex = d?.match(/.{1,2}/g);
|
|
4
|
+
var aRgb = [
|
|
5
|
+
parseInt(aRgbHex[0], 16),
|
|
6
|
+
parseInt(aRgbHex[1], 16),
|
|
7
|
+
parseInt(aRgbHex[2], 16)
|
|
8
|
+
];
|
|
9
|
+
return aRgb;
|
|
10
|
+
};
|
|
11
|
+
const getTextColor = (backColor) => {
|
|
12
|
+
let rgbArray = hexToRgb(backColor);
|
|
13
|
+
if (rgbArray[0] * 0.299 + rgbArray[1] * 0.587 + rgbArray[2] * 0.114 > 186) {
|
|
14
|
+
return "#000000";
|
|
15
|
+
} else {
|
|
16
|
+
return "#ffffff";
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { hexToRgb, getTextColor };
|