@sikka/hawa 0.0.30 → 0.0.31

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,26 @@
1
+ import React from "react";
2
+ import Slider from "@mui/material/Slider";
3
+ import Stack from "@mui/material/Stack";
4
+ import PropTypes from "prop-types";
5
+
6
+ export const HawaRange = (props) => {
7
+ return (
8
+ <Stack spacing={2} direction="row" alignItems="center">
9
+ {props.startElement}
10
+ <Slider
11
+ size="small"
12
+ aria-label="Volume"
13
+ value={props.value}
14
+ onChange={props.handleChange}
15
+ />
16
+ {props.endElement}
17
+ </Stack>
18
+ );
19
+ };
20
+ HawaRange.propTypes = {
21
+ startElement: PropTypes.element,
22
+ endElement: PropTypes.element,
23
+ defaultValue: PropTypes.string,
24
+ handleChange: PropTypes.func,
25
+ location: PropTypes.string
26
+ };
@@ -7,6 +7,7 @@ import { HawaTextField } from "./HawaTextField";
7
7
  import { HawaRadio } from "./HawaRadio";
8
8
  import { HawaSwitch } from "./HawaSwitch";
9
9
  import { HawaColorPicker } from "./HawaColorPicker";
10
+ import { HawaRange } from "./HawaRange";
10
11
 
11
12
  export const HawaSettingsRow = (props) => {
12
13
  return (
@@ -15,6 +16,7 @@ export const HawaSettingsRow = (props) => {
15
16
  {props.settingsType === "checkbox" && <Checkbox {...props} />}
16
17
  {props.settingsType === "text" && <HawaTextField {...props} />}
17
18
  {props.settingsType === "boolean" && <HawaSwitch {...props} />}
19
+ {props.settingsType === "range" && <HawaRange {...props} />}
18
20
  {props.settingsType === "color" && <HawaColorPicker {...props} />}
19
21
  {props.settingsType === "radio" && (
20
22
  <HawaRadio location="inSettings" {...props} />
@@ -6,6 +6,7 @@ import TableContainer from "@mui/material/TableContainer";
6
6
  import TableHead from "@mui/material/TableHead";
7
7
  import TableRow from "@mui/material/TableRow";
8
8
  import PropTypes from "prop-types";
9
+ import { Button } from "@mui/material";
9
10
 
10
11
  export const HawaTable = (props) => {
11
12
  let isArabic = props.lang === "ar";
@@ -26,31 +27,66 @@ export const HawaTable = (props) => {
26
27
  {col}
27
28
  </TableCell>
28
29
  ))}
30
+ {props.actions && (
31
+ <TableCell
32
+ align={isArabic ? "right" : "left"}
33
+ style={{ fontWeight: 700 }}
34
+ variant={isArabic ? "borderedRight" : "borderedLeft"}
35
+ >
36
+ Actions
37
+ </TableCell>
38
+ )}
29
39
  </TableRow>
30
40
  </TableHead>
31
41
 
32
42
  <TableBody>
33
- {props.rows.map((singleRow, j) => (
34
- <TableRow key={j}>
35
- {singleRow.map((r, i) => (
36
- <TableCell
37
- align={isArabic ? "right" : "left"}
38
- key={i}
39
- component="th"
40
- scope="row"
41
- variant={
42
- i > 0
43
- ? isArabic
44
- ? "borderedRight"
45
- : "borderedLeft"
46
- : "body"
47
- }
48
- >
49
- {r}
50
- </TableCell>
51
- ))}
43
+ {props.rows ? (
44
+ props.rows.map((singleRow, j) => (
45
+ <TableRow key={j}>
46
+ {singleRow.map((r, i) => (
47
+ <TableCell
48
+ align={isArabic ? "right" : "left"}
49
+ key={i}
50
+ component="th"
51
+ scope="row"
52
+ variant={
53
+ i > 0
54
+ ? isArabic
55
+ ? "borderedRight"
56
+ : "borderedLeft"
57
+ : "body"
58
+ }
59
+ >
60
+ {r}
61
+ </TableCell>
62
+ ))}
63
+ {props.actions && (
64
+ <TableCell
65
+ align={isArabic ? "right" : "left"}
66
+ style={{ fontWeight: 700 }}
67
+ variant={isArabic ? "borderedRight" : "borderedLeft"}
68
+ >
69
+ {props.actions.map((act) => (
70
+ <Button
71
+ style={{ margin: 2 }}
72
+ variant="outlined"
73
+ size="small"
74
+ onClick={() => props.handleActionClick(singleRow)}
75
+ >
76
+ {act}
77
+ </Button>
78
+ ))}
79
+ </TableCell>
80
+ )}
81
+ </TableRow>
82
+ ))
83
+ ) : (
84
+ <TableRow align="center">
85
+ <TableCell align={"center"} component="th" colSpan={6}>
86
+ {props.noDataText}
87
+ </TableCell>
52
88
  </TableRow>
53
- ))}
89
+ )}
54
90
  </TableBody>
55
91
  {props.end && (
56
92
  <TableRow>
@@ -75,6 +111,8 @@ export const HawaTable = (props) => {
75
111
  );
76
112
  };
77
113
  HawaTable.propTypes = {
114
+ handleActionClick: PropTypes.func,
115
+ noDataText: PropTypes.string,
78
116
  lang: PropTypes.string,
79
117
  columns: PropTypes.array,
80
118
  rows: PropTypes.array,
@@ -9,6 +9,7 @@ export * from "./HawaSettingsRow";
9
9
  export * from "./HawaLogoButton";
10
10
  export * from "./HawaButton";
11
11
  export * from "./HawaSelect";
12
+ export * from "./HawaRange";
12
13
  export * from "./HawaTextField";
13
14
  export * from "./HawaTextArea";
14
15
  export * from "./HawaInputLabel";
@@ -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.8ffaa38a.iframe.bundle.js"></script><script src="main.cbf6de78.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.6c796c97.iframe.bundle.js"></script><script src="main.4bd34158.iframe.bundle.js"></script></body></html>