@sikka/hawa 0.0.28 → 0.0.29

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.
@@ -0,0 +1,61 @@
1
+ import { useTheme } from "@mui/system";
2
+ import React from "react";
3
+ import styled from "@emotion/styled";
4
+ import PropTypes from "prop-types";
5
+
6
+ const ColorInput = styled.input`
7
+ -webkit-appearance: none;
8
+ -moz-appearance: none;
9
+ appearance: none;
10
+ border: none;
11
+ cursor: pointer;
12
+ height: 35px;
13
+ border-radius: ${(props) => props.borderRadius}px;
14
+ background-color: ${(props) => props.value};
15
+ &::-webkit-color-swatch {
16
+ border: none;
17
+ }
18
+ &::-moz-color-swatch {
19
+ border: none;
20
+ }
21
+ `;
22
+ const ColorText = styled.input`
23
+ -webkit-appearance: none;
24
+ -moz-appearance: none;
25
+ appearance: none;
26
+ border: none;
27
+ // height: 30px;
28
+ padding: 10px;
29
+ border-radius: ${(props) => props.borderRadius}px;
30
+ &::-webkit-color-swatch {
31
+ border: none;
32
+ }
33
+ &::-moz-color-swatch {
34
+ border: none;
35
+ }
36
+ `;
37
+ export const HawaColorPicker = (props) => {
38
+ const theme = useTheme();
39
+ return (
40
+ <div style={{ display: "flex", flexDirection: "row" }}>
41
+ <ColorText
42
+ type={"text"}
43
+ value={props.color}
44
+ borderRadius={theme.allBorderRadius}
45
+ onChange={props.handleChange}
46
+ />
47
+ <div style={{ width: 10 }} />
48
+ <ColorInput
49
+ type={"color"}
50
+ value={props.color}
51
+ onChange={props.handleChange}
52
+ borderRadius={theme.allBorderRadius}
53
+ />
54
+ </div>
55
+ );
56
+ };
57
+
58
+ HawaColorPicker.propTypes = {
59
+ color: PropTypes.string,
60
+ handleChange: PropTypes.func
61
+ };
@@ -33,5 +33,6 @@ HawaRadio.propTypes = {
33
33
  lang: PropTypes.string,
34
34
  options: PropTypes.array,
35
35
  defaultValue: PropTypes.string,
36
+ handleChange: PropTypes.func,
36
37
  location: PropTypes.string
37
38
  };
@@ -1,12 +1,13 @@
1
1
  import React from "react";
2
-
3
2
  import PropTypes from "prop-types";
4
3
  import Checkbox from "@mui/material/Checkbox";
5
- import { HawaTypography } from "./HawaTypography";
6
4
  import Container from "@mui/material/Container";
5
+ import { HawaTypography } from "./HawaTypography";
7
6
  import { HawaTextField } from "./HawaTextField";
8
7
  import { HawaRadio } from "./HawaRadio";
9
8
  import { HawaSwitch } from "./HawaSwitch";
9
+ import { HawaColorPicker } from "./HawaColorPicker";
10
+
10
11
  export const HawaSettingsRow = (props) => {
11
12
  return (
12
13
  <Container variant="settingsRow">
@@ -17,11 +18,12 @@ export const HawaSettingsRow = (props) => {
17
18
  <HawaRadio location="inSettings" {...props} />
18
19
  )}
19
20
  {props.settingsType === "boolean" && <HawaSwitch {...props} />}
21
+ {props.settingsType === "color" && <HawaColorPicker {...props} />}
20
22
  </Container>
21
23
  );
22
24
  };
23
25
 
24
26
  HawaSettingsRow.propTypes = {
25
- type: PropTypes.oneOf(["text", "number", "password"]),
27
+ type: PropTypes.oneOf(["checkbox", "text", "radio", "boolean", "color"]),
26
28
  helperText: PropTypes.string
27
29
  };
@@ -15,3 +15,4 @@ export * from "./HawaInputLabel";
15
15
  export * from "./HawaTypography";
16
16
  export * from "./HawaAlert";
17
17
  export * from "./HawaTable";
18
+ export * from "./HawaColorPicker";
@@ -345,4 +345,4 @@
345
345
 
346
346
 
347
347
 
348
- window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.708d7ac1.iframe.bundle.js"></script><script src="vendors~main.b026595c.iframe.bundle.js"></script><script src="main.9dd59e4f.iframe.bundle.js"></script></body></html>
348
+ window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.708d7ac1.iframe.bundle.js"></script><script src="vendors~main.b026595c.iframe.bundle.js"></script><script src="main.c6115a9b.iframe.bundle.js"></script></body></html>