@sikka/hawa 0.0.1

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.
Files changed (74) hide show
  1. package/.prettierrc +28 -0
  2. package/README.md +119 -0
  3. package/package.json +47 -0
  4. package/rollup.config.js +40 -0
  5. package/src/components/Hawa/AdaptiveButton/AdaptiveButton.jsx +261 -0
  6. package/src/components/Hawa/AdaptiveButton/index.js +1 -0
  7. package/src/components/Hawa/AutoCompleteField/AutoCompleteField.jsx +33 -0
  8. package/src/components/Hawa/AutoCompleteField/index.js +1 -0
  9. package/src/components/Hawa/Checkbox/Checkbox.jsx +20 -0
  10. package/src/components/Hawa/Checkbox/index.js +1 -0
  11. package/src/components/Hawa/DragDropImages/DragDropImages.jsx +180 -0
  12. package/src/components/Hawa/DragDropImages/index.js +1 -0
  13. package/src/components/Hawa/Hawa.jsx +3 -0
  14. package/src/components/Hawa/HawaProvider/HawaProvider.js +19 -0
  15. package/src/components/Hawa/HawaProvider/index.js +1 -0
  16. package/src/components/Hawa/InputLabel/StyledInputLabel.jsx +36 -0
  17. package/src/components/Hawa/InputLabel/index.js +1 -0
  18. package/src/components/Hawa/RadioBox/RadioBox.jsx +29 -0
  19. package/src/components/Hawa/RadioBox/index.js +1 -0
  20. package/src/components/Hawa/RadioSelector/RadioSelector.jsx +51 -0
  21. package/src/components/Hawa/RadioSelector/index.js +1 -0
  22. package/src/components/Hawa/Row/Row.jsx +23 -0
  23. package/src/components/Hawa/Row/index.js +1 -0
  24. package/src/components/Hawa/SelectedField/SelectedField.jsx +46 -0
  25. package/src/components/Hawa/SelectedField/index.js +1 -0
  26. package/src/components/Hawa/TabPanel/TabPanel.jsx +38 -0
  27. package/src/components/Hawa/TabPanel/index.js +1 -0
  28. package/src/components/Hawa/TextArea/TextArea.jsx +39 -0
  29. package/src/components/Hawa/TextArea/index.js +1 -0
  30. package/src/components/Hawa/TextField/TextField.jsx +41 -0
  31. package/src/components/Hawa/TextField/index.js +1 -0
  32. package/src/components/Hawa/index.js +11 -0
  33. package/src/index.js +1 -0
  34. package/src/stories/AdaptiveButton.stories.js +84 -0
  35. package/src/stories/CheckBox.stories.js +33 -0
  36. package/src/stories/GlobalVariables.stories.js +108 -0
  37. package/src/stories/HawaProvider.stories.js +23 -0
  38. package/src/stories/InputLabel.stories.js +100 -0
  39. package/src/stories/RadioSelector.stories.js +69 -0
  40. package/src/stories/TextField.stories.js +59 -0
  41. package/src/styles.css +403 -0
  42. package/storybook-static/0.86a7edfd.iframe.bundle.js +1 -0
  43. package/storybook-static/0.b73eaee9a88f178d62ed.manager.bundle.js +1 -0
  44. package/storybook-static/1.f296d183a17268696d73.manager.bundle.js +1 -0
  45. package/storybook-static/10.9998ba67d65d81d20896.manager.bundle.js +1 -0
  46. package/storybook-static/11.49c687eaa6261f8b7be2.manager.bundle.js +2 -0
  47. package/storybook-static/11.49c687eaa6261f8b7be2.manager.bundle.js.LICENSE.txt +12 -0
  48. package/storybook-static/12.c9538ed3766c96f289e7.manager.bundle.js +1 -0
  49. package/storybook-static/4.f6eb74f4.iframe.bundle.js +3 -0
  50. package/storybook-static/4.f6eb74f4.iframe.bundle.js.LICENSE.txt +8 -0
  51. package/storybook-static/4.f6eb74f4.iframe.bundle.js.map +1 -0
  52. package/storybook-static/5.ec6f37af.iframe.bundle.js +1 -0
  53. package/storybook-static/5.fa71488e730c5c7f885f.manager.bundle.js +2 -0
  54. package/storybook-static/5.fa71488e730c5c7f885f.manager.bundle.js.LICENSE.txt +8 -0
  55. package/storybook-static/6.8096ae4aadde0743697b.manager.bundle.js +1 -0
  56. package/storybook-static/6.fbc7b90b.iframe.bundle.js +3 -0
  57. package/storybook-static/6.fbc7b90b.iframe.bundle.js.LICENSE.txt +12 -0
  58. package/storybook-static/6.fbc7b90b.iframe.bundle.js.map +1 -0
  59. package/storybook-static/7.a806a38f.iframe.bundle.js +1 -0
  60. package/storybook-static/7.b34baecbd082bc7b188d.manager.bundle.js +1 -0
  61. package/storybook-static/8.15577edffecf900a8de2.manager.bundle.js +1 -0
  62. package/storybook-static/9.d7d85aa0a49a98f17218.manager.bundle.js +1 -0
  63. package/storybook-static/favicon.ico +0 -0
  64. package/storybook-static/iframe.html +138 -0
  65. package/storybook-static/index.html +47 -0
  66. package/storybook-static/main.355ffc59.iframe.bundle.js +1 -0
  67. package/storybook-static/main.ce406c7e93b98325390e.manager.bundle.js +1 -0
  68. package/storybook-static/runtime~main.3d81579b.iframe.bundle.js +1 -0
  69. package/storybook-static/runtime~main.909d038f912f063e8837.manager.bundle.js +1 -0
  70. package/storybook-static/vendors~main.73411ca9.iframe.bundle.js +3 -0
  71. package/storybook-static/vendors~main.73411ca9.iframe.bundle.js.LICENSE.txt +148 -0
  72. package/storybook-static/vendors~main.73411ca9.iframe.bundle.js.map +1 -0
  73. package/storybook-static/vendors~main.d3455eed64b243c89325.manager.bundle.js +2 -0
  74. package/storybook-static/vendors~main.d3455eed64b243c89325.manager.bundle.js.LICENSE.txt +88 -0
package/.prettierrc ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "semi": false,
3
+ "overrides": [
4
+ {
5
+ "files": ["*.jsx", "*.js"],
6
+ "options": {
7
+ "arrowParens": "always",
8
+ "bracketSpacing": true,
9
+ "endOfLine": "lf",
10
+ "htmlWhitespaceSensitivity": "css",
11
+ "insertPragma": false,
12
+ "jsxBracketSameLine": false,
13
+ "jsxSingleQuote": false,
14
+ "printWidth": 80,
15
+ "proseWrap": "preserve",
16
+ "quoteProps": "as-needed",
17
+ "requirePragma": false,
18
+ "semi": true,
19
+ "singleQuote": false,
20
+ "tabWidth": 2,
21
+ "trailingComma": "none",
22
+ "useTabs": false,
23
+ "vueIndentScriptAndStyle": false,
24
+ "parser": "babel"
25
+ }
26
+ }
27
+ ]
28
+ }
package/README.md ADDED
@@ -0,0 +1,119 @@
1
+ <!-- ![Hawa | هواء](https://xakher-images.s3.ap-southeast-1.amazonaws.com/hawa-logo.png) -->
2
+
3
+ <p align="center">
4
+ <img src="https://xakher-images.s3.ap-southeast-1.amazonaws.com/hawa-logo.png" alt="Hawa | هواء" />
5
+ </p>
6
+
7
+
8
+
9
+ # Hawa | هواء
10
+
11
+ [![NPM](https://img.shields.io/npm/v/@sikka/hawa.svg)](https://www.npmjs.com/package/@sikka/hawa)
12
+ [![NPM](https://img.shields.io/npm/dt/@sikka/hawa.svg)](https://www.npmjs.com/package/@sikka/hawa)
13
+ [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
14
+
15
+ > Opinionated UI Kit for web apps and websites.
16
+
17
+ # Concept
18
+
19
+ # Features
20
+ - [ ] Change borders and margin, padding in one place
21
+ - [ ] Drag and drop tool to create a layout of boxes
22
+
23
+
24
+ ## Boxes
25
+ Most components will live inside **boxes**. Windows can show anything. It can show a video, image, form, iFrame, etc. Boxes make out the layout of your website or application. Boxes can be arranged in different layouts
26
+
27
+ <p align="center">
28
+ <img src="https://user-images.githubusercontent.com/46135573/143972102-0c104239-b8f6-4a7b-9aad-54f6d91a8906.png" alt="layout-types" />
29
+ </p>
30
+
31
+ Points
32
+ - The content inside each box can be scrollable (vertical/horizontal/Both) with one prop
33
+ - you can control the spacing of the content inside each box with one prop
34
+ - you can also control the spacing of all the box in the layout
35
+ - some boxes can float (animation of open and close modal)
36
+ - some boxes can go full screen (animation to transition)
37
+
38
+
39
+ ## Install
40
+
41
+ ```bash
42
+
43
+ npm install --save @sikka/hawa
44
+
45
+ ```
46
+
47
+ ## Components
48
+
49
+ - [ ] Layout
50
+ - [ ] Box
51
+ - [ ] TextField
52
+ - [ ] TextArea
53
+ - [ ] Radio Selector
54
+ - [ ] PasswordField
55
+ - [ ] Autocomplete
56
+ - [ ] Tabs
57
+
58
+ ## Usage
59
+
60
+ ```jsx
61
+
62
+ //example coming soon inshallah
63
+
64
+ ```
65
+
66
+ ## Contributing
67
+
68
+ To contribute, clone this github repository and run the development server
69
+
70
+ - clone repository
71
+
72
+ ```bash
73
+ git clone git@github.com:sikka-software/hawa.git
74
+ cd hawa
75
+ npm install
76
+ ```
77
+
78
+ ## TESTING
79
+
80
+ - Run development server
81
+
82
+ ```bash
83
+ git clone git@github.com:sikka-software/hawa.git
84
+ cd hawa
85
+ npm install
86
+ npm run storybook
87
+ ```
88
+
89
+ - Edit **Hawa/src/stories/Hawa.stories.js_** file
90
+
91
+ - Add your custom testing component in **Hawa.stories.js** file
92
+
93
+ - Or you can preview without running development server. [See Preview](https://sikka-software.github.io/Hawa/storybook-static/)
94
+
95
+ ```jsx
96
+
97
+ //example coming soon inshallah
98
+
99
+ ```
100
+
101
+ ## Deployment
102
+
103
+ ```bash
104
+ npm run build-storybook
105
+ ```
106
+
107
+ ## Publishing (Admin)
108
+
109
+ ```bash
110
+ npm version [major | minor | patch]
111
+ npm run build-lib
112
+ npm publish --access public
113
+ ```
114
+
115
+ ## License
116
+
117
+ <!-- https://github.com/react-component/drawer -->
118
+
119
+ MIT © [SIKKA SOFTWARE](https://sikka.sa)
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@sikka/hawa",
3
+ "version": "0.0.1",
4
+ "description": "UI Kit",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.es.js",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "start": "start-storybook -p 6006",
10
+ "storybook": "start-storybook -p 6006",
11
+ "build-storybook": "build-storybook",
12
+ "build-lib": "rollup -c"
13
+ },
14
+ "author": "SIKKA SOFTWARE",
15
+ "license": "MIT",
16
+ "devDependencies": {
17
+ "@babel/core": "^7.12.10",
18
+ "@babel/preset-react": "^7.12.10",
19
+ "@rollup/plugin-commonjs": "^21.0.1",
20
+ "@rollup/plugin-node-resolve": "^11.1.1",
21
+ "@storybook/addon-actions": "^6.4.7",
22
+ "@storybook/addon-essentials": "^6.4.7",
23
+ "@storybook/addon-links": "^6.4.7",
24
+ "@storybook/react": "^6.4.7",
25
+ "babel-loader": "^8.2.2",
26
+ "framer-motion": "^4.1.7",
27
+ "react": "^17.0.1",
28
+ "react-dom": "^17.0.1",
29
+ "rollup": "^2.38.4",
30
+ "rollup-plugin-babel": "^4.4.0",
31
+ "rollup-plugin-peer-deps-external": "^2.2.4",
32
+ "rollup-plugin-postcss": "^4.0.0",
33
+ "rollup-plugin-terser": "^7.0.2"
34
+ },
35
+ "peerDependencies": {
36
+ "react": "^17.0.1",
37
+ "react-dom": "^17.0.1"
38
+ },
39
+ "dependencies": {
40
+ "@material-ui/core": "^4.12.3",
41
+ "@material-ui/icons": "^4.11.2",
42
+ "@material-ui/lab": "*",
43
+ "prop-types": "^15.7.2",
44
+ "react-hook-form": "^7.20.4",
45
+ "tinycolor2": "^1.4.2"
46
+ }
47
+ }
@@ -0,0 +1,40 @@
1
+ import babel from "rollup-plugin-babel";
2
+ import resolve from "@rollup/plugin-node-resolve";
3
+ import external from "rollup-plugin-peer-deps-external";
4
+ import { terser } from "rollup-plugin-terser";
5
+ import postcss from "rollup-plugin-postcss";
6
+ import commonjs from "@rollup/plugin-commonjs";
7
+
8
+ export default [
9
+ {
10
+ input: "src/index.js",
11
+ output: [
12
+ {
13
+ file: "dist/index.js",
14
+ format: "cjs"
15
+ },
16
+ {
17
+ file: "dist/index.es.js",
18
+ format: "es",
19
+ exports: "named"
20
+ }
21
+ ],
22
+ plugins: [
23
+ postcss({
24
+ plugins: [],
25
+ minimize: true
26
+ }),
27
+ babel({
28
+ exclude: "node_modules/**",
29
+ presets: [
30
+ "@babel/preset-env",
31
+ ["@babel/preset-react", { runtime: "automatic" }]
32
+ ]
33
+ }),
34
+ external(),
35
+ resolve(),
36
+ terser(),
37
+ commonjs()
38
+ ]
39
+ }
40
+ ];
@@ -0,0 +1,261 @@
1
+ import React, { useState, useContext } from "react";
2
+ import Button from "@material-ui/core/Button";
3
+ import Tooltip from "@material-ui/core/Tooltip";
4
+ import { motion } from "framer-motion";
5
+ import { ThemeProvider } from "../HawaProvider";
6
+
7
+ const AdaptiveButton = (props) => {
8
+ const { showText, buttonColor, borderRadius, textColor } = props;
9
+ const theme = useContext(ThemeProvider);
10
+
11
+ const screenSize = {
12
+ width: 1500,
13
+ height: 200
14
+ };
15
+ const [tooltip, setTooltip] = useState(false);
16
+ const [hovered, setHovered] = useState(false);
17
+ //full button
18
+ if (showText) {
19
+ return (
20
+ <motion.div
21
+ transition={{ duration: 0.2 }}
22
+ initial={{
23
+ // direction: "rtl",
24
+ backgroundColor: buttonColor,
25
+ color: textColor,
26
+ borderRadius: theme.borderRadius,
27
+ width: "fit-content"
28
+ }}
29
+ whileHover={{
30
+ backgroundColor: props.hoverColor,
31
+ borderRadius: borderRadius
32
+ }}
33
+ whileTap={{ scale: 1.2 }}
34
+ onMouseEnter={() => setHovered(true)}
35
+ onMouseLeave={() => setHovered(false)}
36
+ onMouseDown={() => {
37
+ setHovered(true);
38
+ setTooltip(true);
39
+ }}
40
+ onMouseUp={() => {
41
+ setHovered(false);
42
+ setTooltip(true);
43
+ }}
44
+ onMouseOver={() => {
45
+ setHovered(true);
46
+ setTooltip(true);
47
+ }}
48
+ onMouseOut={() => {
49
+ setHovered(false);
50
+ // setTooltip(true);
51
+ }}
52
+ >
53
+ <Button
54
+ disabled={props.disabled}
55
+ disableRipple
56
+ aria-label={props.buttonLabel}
57
+ color={props.danger ? "secondary" : "primary"}
58
+ onClick={props.handleClick}
59
+ style={{
60
+ borderRadius: borderRadius,
61
+ padding: 10,
62
+ color: hovered
63
+ ? "#ffffff"
64
+ : props.danger
65
+ ? "#f50057"
66
+ : "var(--blue)"
67
+ }}
68
+ >
69
+ {props.icon}
70
+ {props.showText ? (
71
+ <span style={{ marginLeft: props.icon ? 5 : 0 }}>
72
+ {props.buttonLabel}
73
+ </span>
74
+ ) : null}
75
+ </Button>
76
+ </motion.div>
77
+ );
78
+ } else if (props.buttonLabelOnly) {
79
+ return (
80
+ <motion.div
81
+ transition={{
82
+ duration: 0.2
83
+ }}
84
+ initial={{
85
+ width: "fit-content",
86
+ backgroundColor: props.buttonColor,
87
+ borderRadius: borderRadius
88
+ }}
89
+ whileTap={{ scale: 1.2 }}
90
+ whileHover={{
91
+ backgroundColor: props.hoverColor,
92
+ borderRadius: borderRadius
93
+ }}
94
+ onMouseEnter={() => setHovered(true)}
95
+ onMouseLeave={() => setHovered(false)}
96
+ onMouseDown={() => {
97
+ setHovered(true);
98
+ setTooltip(true);
99
+ }}
100
+ onMouseUp={() => {
101
+ setHovered(false);
102
+ setTooltip(true);
103
+ }}
104
+ onMouseOver={() => {
105
+ setHovered(true);
106
+ setTooltip(true);
107
+ }}
108
+ onMouseOut={() => {
109
+ setHovered(false);
110
+ // setTooltip(true);
111
+ }}
112
+ >
113
+ <Tooltip
114
+ placement={screenSize.width > 400 ? "bottom-center" : "top-center"}
115
+ enterTouchDelay={100}
116
+ title={
117
+ props.hint ? (
118
+ props.hint
119
+ ) : (
120
+ <div>
121
+ <div
122
+ style={{
123
+ fontSize: 20,
124
+ fontWeight: 800,
125
+ padding: 10,
126
+ paddingBottom: 5,
127
+ textAlign: "center"
128
+ }}
129
+ >
130
+ {props.hintTitle}
131
+ </div>
132
+ <div
133
+ style={{
134
+ fontSize: 13,
135
+ fontWeight: 100,
136
+ padding: 10,
137
+ textAlign: "center"
138
+ }}
139
+ >
140
+ {props.hintContent}
141
+ </div>
142
+ </div>
143
+ )
144
+ }
145
+ >
146
+ <Button
147
+ disabled={props.disabled}
148
+ size="small"
149
+ disableRipple
150
+ aria-label={props.buttonLabel}
151
+ onClick={props.handleClick}
152
+ color={props.danger ? "secondary" : "primary"}
153
+ style={{
154
+ padding: 10,
155
+
156
+ color: hovered
157
+ ? "#ffffff"
158
+ : props.danger
159
+ ? "#f50057"
160
+ : "var(--blue)"
161
+ }}
162
+ >
163
+ {props.buttonLabel}
164
+ </Button>
165
+ </Tooltip>
166
+ </motion.div>
167
+ );
168
+ } else {
169
+ //icon only
170
+ return (
171
+ <motion.div
172
+ transition={{ duration: 0.2 }}
173
+ initial={{
174
+ width: "fit-content",
175
+ backgroundColor: props.buttonColor,
176
+ borderRadius: borderRadius,
177
+ // padding: 5,
178
+ margin: 5
179
+ }}
180
+ whileTap={{ scale: 1.2 }}
181
+ whileHover={{
182
+ backgroundColor: props.hoverColor,
183
+ borderRadius: borderRadius
184
+ }}
185
+ onMouseEnter={() => setHovered(true)}
186
+ onMouseLeave={() => setHovered(false)}
187
+ onMouseDown={() => {
188
+ setHovered(true);
189
+ setTooltip(true);
190
+ }}
191
+ onMouseUp={() => {
192
+ setHovered(false);
193
+ setTooltip(true);
194
+ }}
195
+ onMouseOver={() => {
196
+ setHovered(true);
197
+ setTooltip(true);
198
+ }}
199
+ onMouseOut={() => {
200
+ setHovered(false);
201
+ // setTooltip(true);
202
+ }}
203
+ >
204
+ <Tooltip
205
+ placement={screenSize.width > 400 ? "bottom-center" : "top-center"}
206
+ enterTouchDelay={100}
207
+ title={
208
+ props.hint ? (
209
+ props.hint
210
+ ) : (
211
+ <div>
212
+ <div
213
+ style={{
214
+ fontSize: 20,
215
+ fontWeight: 800,
216
+ padding: 10,
217
+ paddingBottom: 5,
218
+ textAlign: "center"
219
+ }}
220
+ >
221
+ {props.hintTitle}
222
+ </div>
223
+ <div
224
+ style={{
225
+ fontSize: 13,
226
+ fontWeight: 100,
227
+ padding: 10,
228
+ textAlign: "center"
229
+ }}
230
+ >
231
+ {props.hintContent}
232
+ </div>
233
+ </div>
234
+ )
235
+ }
236
+ >
237
+ <Button
238
+ disabled={props.disabled}
239
+ size="small"
240
+ disableRipple
241
+ aria-label={props.buttonLabel}
242
+ onClick={props.handleClick}
243
+ color={props.danger ? "secondary" : "primary"}
244
+ style={{
245
+ padding: 10,
246
+ color: hovered
247
+ ? "#ffffff"
248
+ : props.danger
249
+ ? "#f50057"
250
+ : "var(--blue)"
251
+ }}
252
+ >
253
+ {props.icon}
254
+ </Button>
255
+ </Tooltip>
256
+ </motion.div>
257
+ );
258
+ }
259
+ };
260
+
261
+ export default AdaptiveButton;
@@ -0,0 +1 @@
1
+ export * from "./AdaptiveButton.jsx";
@@ -0,0 +1,33 @@
1
+ import React from "react"
2
+ import { Controller, useFormContext } from "react-hook-form"
3
+ // import Autocomplete from "@material-ui/lab/Autocomplete";
4
+
5
+ export const AutoCompleteField = (props) => {
6
+ const { control } = useFormContext()
7
+ const { name, rules, shouldUnregister } = props
8
+
9
+ return (
10
+ <React.Fragment>
11
+ <Controller
12
+ name={name}
13
+ rules={rules}
14
+ control={control}
15
+ shouldUnregister={shouldUnregister}
16
+ className="theme_form_input"
17
+ render={({ field: { onChange, value } }) => {
18
+ return (
19
+ <input type="text" />
20
+ // <Autocomplete
21
+ // onChange={(e, data) => {
22
+ // onChange(data);
23
+ // }}
24
+ // value={value ?? ""}
25
+ // {...props}
26
+ // className={"theme_form_input"}
27
+ // />
28
+ )
29
+ }}
30
+ />
31
+ </React.Fragment>
32
+ )
33
+ }
@@ -0,0 +1 @@
1
+ export * from "./AutoCompleteField.jsx"
@@ -0,0 +1,20 @@
1
+ import React from "react"
2
+ import FormControlLabel from "@material-ui/core/FormControlLabel"
3
+ import Checkbox from "@material-ui/core/Checkbox"
4
+ import PropTypes from "prop-types"
5
+
6
+ export const StyledCheckbox = (props) => {
7
+ console.log("props : ", props)
8
+ return (
9
+ <React.Fragment>
10
+ <FormControlLabel
11
+ control={
12
+ <Checkbox
13
+ style={{ color: props.color || null }}
14
+ defaultChecked={props.defaultValue}
15
+ />
16
+ }
17
+ />
18
+ </React.Fragment>
19
+ )
20
+ }
@@ -0,0 +1 @@
1
+ export * from "./Checkbox.jsx";