umwd-components 0.1.9 → 0.1.11

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 (28) hide show
  1. package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +24 -0
  2. package/dist/cjs/node_modules/style-inject/dist/style-inject.es.js +38 -0
  3. package/dist/cjs/src/components/Button.js +44 -0
  4. package/dist/cjs/src/components/Checkmark/Checkmark.js +29 -0
  5. package/dist/cjs/src/components/NavBar/NavBar.js +239 -0
  6. package/dist/cjs/src/components/NoteTextField/NoteTextField.js +21 -0
  7. package/dist/cjs/src/components/Requirement/Requirement.js +28 -0
  8. package/dist/cjs/src/components/Requirements/Requirements.js +30 -0
  9. package/dist/cjs/src/components/Stack.js +36 -0
  10. package/dist/cjs/src/components/Xmark/Xmark.js +27 -0
  11. package/dist/cjs/src/index.js +21 -0
  12. package/dist/cjs/src/styles.css.js +16 -0
  13. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +22 -0
  14. package/dist/esm/node_modules/style-inject/dist/style-inject.es.js +34 -0
  15. package/dist/esm/src/components/Button.js +40 -0
  16. package/dist/esm/src/components/Checkmark/Checkmark.js +27 -0
  17. package/dist/esm/src/components/NavBar/NavBar.js +237 -0
  18. package/dist/esm/src/components/NoteTextField/NoteTextField.js +19 -0
  19. package/dist/esm/src/components/Requirement/Requirement.js +26 -0
  20. package/dist/esm/src/components/Requirements/Requirements.js +28 -0
  21. package/dist/esm/src/components/Stack.js +32 -0
  22. package/dist/esm/src/components/Xmark/Xmark.js +25 -0
  23. package/dist/esm/src/index.js +11 -0
  24. package/dist/esm/src/styles.css.js +12 -0
  25. package/package.json +4 -2
  26. package/rollup.config.mjs +27 -7
  27. package/dist/index.es.js +0 -1
  28. package/dist/index.js +0 -1
@@ -0,0 +1,24 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ function _extends() {
10
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
11
+ for (var i = 1; i < arguments.length; i++) {
12
+ var source = arguments[i];
13
+ for (var key in source) {
14
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
15
+ target[key] = source[key];
16
+ }
17
+ }
18
+ }
19
+ return target;
20
+ };
21
+ return _extends.apply(this, arguments);
22
+ }
23
+
24
+ exports.extends = _extends;
@@ -0,0 +1,38 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ Object.defineProperty(exports, '__esModule', { value: true });
10
+
11
+ function styleInject(css, ref) {
12
+ if ( ref === void 0 ) ref = {};
13
+ var insertAt = ref.insertAt;
14
+
15
+ if (!css || typeof document === 'undefined') { return; }
16
+
17
+ var head = document.head || document.getElementsByTagName('head')[0];
18
+ var style = document.createElement('style');
19
+ style.type = 'text/css';
20
+
21
+ if (insertAt === 'top') {
22
+ if (head.firstChild) {
23
+ head.insertBefore(style, head.firstChild);
24
+ } else {
25
+ head.appendChild(style);
26
+ }
27
+ } else {
28
+ head.appendChild(style);
29
+ }
30
+
31
+ if (style.styleSheet) {
32
+ style.styleSheet.cssText = css;
33
+ } else {
34
+ style.appendChild(document.createTextNode(css));
35
+ }
36
+ }
37
+
38
+ exports.default = styleInject;
@@ -0,0 +1,44 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ Object.defineProperty(exports, '__esModule', { value: true });
10
+
11
+ var React = require('react');
12
+ var PropTypes = require('prop-types');
13
+
14
+ function Button({
15
+ label,
16
+ backgroundColor = "red",
17
+ size = "md",
18
+ onClick
19
+ }) {
20
+ let scale = 1;
21
+ if (size === "sm") {
22
+ scale = 0.75;
23
+ }
24
+ if (size === "lg") {
25
+ scale = 1.25;
26
+ }
27
+ const style = {
28
+ backgroundColor,
29
+ padding: `${0.5 * scale}rem ${1 * scale}rem`,
30
+ border: "none"
31
+ };
32
+ return /*#__PURE__*/React.createElement("button", {
33
+ style: style,
34
+ onClick: onClick
35
+ }, label);
36
+ }
37
+ Button.propTypes = {
38
+ label: PropTypes.string,
39
+ backgroundColor: PropTypes.string,
40
+ size: PropTypes.oneOf(["sm", "md", "lg"]),
41
+ onClick: PropTypes.func
42
+ };
43
+
44
+ exports.default = Button;
@@ -0,0 +1,29 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ var React = require('react');
10
+
11
+ // Ported from Alexander Haniotis' code here: https://codepen.io/haniotis/pen/KwvYLO
12
+ const Checkmark = () => {
13
+ return /*#__PURE__*/React.createElement("svg", {
14
+ className: "checkmark",
15
+ viewBox: "0 0 52 52"
16
+ }, /*#__PURE__*/React.createElement("circle", {
17
+ className: "checkmark__circle",
18
+ cx: "26",
19
+ cy: "26",
20
+ r: "25",
21
+ fill: "none"
22
+ }), /*#__PURE__*/React.createElement("path", {
23
+ className: "checkmark__check",
24
+ fill: "none",
25
+ d: "M14.1 27.2l7.1 7.2 16.7-16.8"
26
+ }));
27
+ };
28
+
29
+ exports.Checkmark = Checkmark;
@@ -0,0 +1,239 @@
1
+ "use client";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var React$1 = require('react');
11
+ var Link = require('next/link');
12
+ var material = require('@mui/material');
13
+ var CloseIcon = require('@mui/icons-material/Close');
14
+ var MoreVertIcon = require('@mui/icons-material/MoreVert');
15
+
16
+ const NavBar = ({
17
+ site_title,
18
+ logo,
19
+ pages
20
+ }) => {
21
+ // handleMobileMenu
22
+
23
+ const [mobileNavOpen, setMobileNavOpen] = React$1.useState(false);
24
+ const handleOpenMobileMenu = e => {
25
+ setMobileNavOpen(true);
26
+ };
27
+ const handleCloseMobileMenu = e => {
28
+ setMobileNavOpen(false);
29
+ };
30
+ return /*#__PURE__*/React.createElement(material.AppBar, {
31
+ position: "sticky"
32
+ }, /*#__PURE__*/React.createElement(material.Container, {
33
+ maxWidth: "xl"
34
+ }, /*#__PURE__*/React.createElement(material.Toolbar, {
35
+ disableGutters: true,
36
+ sx: {
37
+ py: 1
38
+ }
39
+ }, /*#__PURE__*/React.createElement(Link, {
40
+ href: "/",
41
+ style: {
42
+ textDecoration: "none",
43
+ color: "unset"
44
+ }
45
+ }, /*#__PURE__*/React.createElement(material.Box, {
46
+ sx: {
47
+ display: {
48
+ xs: "none",
49
+ md: "flex"
50
+ },
51
+ cursor: "pointer",
52
+ alignItems: "center"
53
+ }
54
+ }, /*#__PURE__*/React.createElement(material.Box, {
55
+ sx: {
56
+ display: "flex",
57
+ mr: 1
58
+ }
59
+ }, /*#__PURE__*/React.createElement("img", {
60
+ src: logo.url,
61
+ width: logo.width || "32px",
62
+ height: logo.height || "32px",
63
+ alt: "site logo",
64
+ style: {
65
+ maxWidth: "60px",
66
+ maxHeight: "60px"
67
+ }
68
+ })), site_title !== undefined && /*#__PURE__*/React.createElement(material.Typography, {
69
+ variant: "h6",
70
+ noWrap: true,
71
+ component: "h1",
72
+ sx: {
73
+ display: "flex",
74
+ textDecoration: "none"
75
+ }
76
+ }, site_title))), /*#__PURE__*/React.createElement(material.Box, {
77
+ sx: {
78
+ flexGrow: 1,
79
+ display: {
80
+ xs: "none",
81
+ md: "flex"
82
+ },
83
+ alignItems: "center"
84
+ }
85
+ }, pages.map(page => {
86
+ return /*#__PURE__*/React.createElement(material.Button, {
87
+ key: page.name,
88
+ onClick: () => page.action(),
89
+ sx: {
90
+ my: 2,
91
+ color: "primary.contrastText",
92
+ display: "block"
93
+ }
94
+ }, page.name);
95
+ })), /*#__PURE__*/React.createElement(Link, {
96
+ href: "/",
97
+ style: {
98
+ textDecoration: "none",
99
+ color: "unset"
100
+ }
101
+ }, /*#__PURE__*/React.createElement(material.Box, {
102
+ sx: {
103
+ display: {
104
+ xs: "flex",
105
+ md: "none"
106
+ },
107
+ alignItems: "center"
108
+ }
109
+ }, logo.url !== undefined && /*#__PURE__*/React.createElement(material.Box, {
110
+ sx: {
111
+ display: "flex",
112
+ mr: 1
113
+ }
114
+ }, /*#__PURE__*/React.createElement("img", {
115
+ src: logo.url,
116
+ width: logo.width || "32px",
117
+ height: logo.height || "32px",
118
+ alt: logo.alt || "site logo",
119
+ style: {
120
+ maxWidth: "60px",
121
+ maxHeight: "60px"
122
+ }
123
+ })), site_title !== undefined && /*#__PURE__*/React.createElement(material.Typography, {
124
+ variant: "h5",
125
+ noWrap: true,
126
+ component: "h1",
127
+ sx: {
128
+ display: "flex",
129
+ flexGrow: 1
130
+ }
131
+ }, site_title))), /*#__PURE__*/React.createElement(material.Box, {
132
+ sx: {
133
+ display: {
134
+ xs: "flex",
135
+ md: "none"
136
+ },
137
+ flexGrow: 1
138
+ }
139
+ }), /*#__PURE__*/React.createElement(material.Box, {
140
+ sx: {
141
+ flexGrow: 0,
142
+ display: {
143
+ xs: "flex",
144
+ md: "none"
145
+ }
146
+ }
147
+ }, /*#__PURE__*/React.createElement(material.Button, {
148
+ onClick: handleOpenMobileMenu,
149
+ sx: {
150
+ width: "40px",
151
+ height: "40px",
152
+ borderRadius: "50%",
153
+ p: 0,
154
+ minWidth: "unset",
155
+ color: "primary.contrastText",
156
+ boxShadow: "0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"
157
+ }
158
+ }, /*#__PURE__*/React.createElement(MoreVertIcon, {
159
+ sx: {
160
+ color: "primary.contrastText"
161
+ }
162
+ })), /*#__PURE__*/React.createElement(material.Dialog, {
163
+ fullScreen: true,
164
+ open: mobileNavOpen,
165
+ onClose: handleCloseMobileMenu
166
+ }, /*#__PURE__*/React.createElement(material.AppBar, {
167
+ position: "sticky"
168
+ }, /*#__PURE__*/React.createElement(material.Container, {
169
+ maxWidth: "xl"
170
+ }, /*#__PURE__*/React.createElement(material.Toolbar, {
171
+ disableGutters: true,
172
+ sx: {
173
+ py: 1,
174
+ justifyContent: "space-between"
175
+ }
176
+ }, /*#__PURE__*/React.createElement(Link, {
177
+ href: "/",
178
+ style: {
179
+ textDecoration: "none",
180
+ color: "unset"
181
+ }
182
+ }, /*#__PURE__*/React.createElement(material.Box, {
183
+ sx: {
184
+ display: "flex",
185
+ flexDirection: "row",
186
+ alignItems: "center"
187
+ }
188
+ }, /*#__PURE__*/React.createElement(material.Box, {
189
+ sx: {
190
+ display: "flex",
191
+ mr: 1
192
+ }
193
+ }, /*#__PURE__*/React.createElement("img", {
194
+ src: logo.url,
195
+ alt: logo.alt || "logo",
196
+ width: logo.width || "32px",
197
+ height: logo.height || "32px",
198
+ style: {
199
+ maxWidth: "60px",
200
+ maxHeight: "60px"
201
+ }
202
+ })), /*#__PURE__*/React.createElement(material.Typography, {
203
+ variant: "h5",
204
+ noWrap: true,
205
+ component: "h1",
206
+ sx: {
207
+ display: "flex",
208
+ flexGrow: 1
209
+ }
210
+ }, site_title !== undefined && site_title))), /*#__PURE__*/React.createElement(material.Button, {
211
+ onClick: handleCloseMobileMenu,
212
+ sx: {
213
+ width: "40px",
214
+ height: "40px",
215
+ borderRadius: "50%",
216
+ p: 0,
217
+ minWidth: "unset",
218
+ color: "primary.contrastText",
219
+ boxShadow: "0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"
220
+ },
221
+ "aria-label": "close"
222
+ }, /*#__PURE__*/React.createElement(CloseIcon, {
223
+ sx: {
224
+ color: "primary.contrastText"
225
+ }
226
+ }))))), /*#__PURE__*/React.createElement(material.List, null, pages.map(page => {
227
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(material.ListItem, {
228
+ key: page.name,
229
+ onClick: () => {
230
+ page.action();
231
+ handleCloseMobileMenu();
232
+ }
233
+ }, /*#__PURE__*/React.createElement(material.ListItemText, {
234
+ primary: page.name
235
+ })), /*#__PURE__*/React.createElement(material.Divider, null));
236
+ })))))));
237
+ };
238
+
239
+ exports.NavBar = NavBar;
@@ -0,0 +1,21 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
10
+ var React = require('react');
11
+ var material = require('@mui/material');
12
+
13
+ const NoteTextField = props => {
14
+ return /*#__PURE__*/React.createElement(material.TextField, _rollupPluginBabelHelpers.extends({}, props, {
15
+ sx: {
16
+ background: "linear-gradient(45deg, rgba(251,246,137,1) 30%, rgba(252,242,138,1) 90%)"
17
+ }
18
+ }));
19
+ };
20
+
21
+ exports.NoteTextField = NoteTextField;
@@ -0,0 +1,28 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ var Xmark = require('../Xmark/Xmark.js');
10
+ var Checkmark = require('../Checkmark/Checkmark.js');
11
+ var React = require('react');
12
+
13
+ const Requirement = ({
14
+ value,
15
+ requirement
16
+ }) => {
17
+ const [isValid, setIsValid] = React.useState();
18
+ React.useEffect(() => {
19
+ setIsValid(requirement.validator(value));
20
+ }, [value, requirement]);
21
+ return /*#__PURE__*/React.createElement("div", {
22
+ className: "requirement"
23
+ }, isValid ? /*#__PURE__*/React.createElement(Checkmark.Checkmark, null) : /*#__PURE__*/React.createElement(Xmark.Xmark, null), /*#__PURE__*/React.createElement("p", {
24
+ className: isValid ? "valid" : "invalid"
25
+ }, requirement.text));
26
+ };
27
+
28
+ exports.Requirement = Requirement;
@@ -0,0 +1,30 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ require('../../styles.css.js');
10
+ var Requirement = require('../Requirement/Requirement.js');
11
+ var React = require('react');
12
+
13
+ const Requirements = ({
14
+ value,
15
+ requirements,
16
+ onValidChange
17
+ }) => {
18
+ const validChangeCb = React.useCallback(onValidChange, []);
19
+ React.useEffect(() => {
20
+ validChangeCb(requirements.every(r => r.validator(value)));
21
+ }, [value, requirements, validChangeCb]);
22
+ return requirements.map((r, index) => /*#__PURE__*/React.createElement(Requirement.Requirement, {
23
+ key: index,
24
+ value: value,
25
+ requirement: r,
26
+ onValidChange: onValidChange
27
+ }));
28
+ };
29
+
30
+ exports.Requirements = Requirements;
@@ -0,0 +1,36 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ Object.defineProperty(exports, '__esModule', { value: true });
10
+
11
+ var React = require('react');
12
+ var PropTypes = require('prop-types');
13
+
14
+ function Stack({
15
+ children,
16
+ spacing = 2,
17
+ direction = "row",
18
+ wrap = false
19
+ }) {
20
+ const style = {
21
+ display: "flex",
22
+ gap: `${spacing * 0.25}rem`,
23
+ flexWrap: wrap ? "wrap" : "nowrap",
24
+ flexDirection: direction
25
+ };
26
+ return /*#__PURE__*/React.createElement("div", {
27
+ style: style
28
+ }, children);
29
+ }
30
+ Stack.propTypes = {
31
+ spacing: PropTypes.number,
32
+ wrap: PropTypes.bool,
33
+ direction: PropTypes.oneOf(["row", "column"])
34
+ };
35
+
36
+ exports.default = Stack;
@@ -0,0 +1,27 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ var React = require('react');
10
+
11
+ const Xmark = () => {
12
+ return /*#__PURE__*/React.createElement("svg", {
13
+ x: "0px",
14
+ y: "0px",
15
+ width: "15px",
16
+ height: "15px",
17
+ viewBox: "0 0 122.879 122.879",
18
+ enableBackground: "new 0 0 122.879 122.879"
19
+ }, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
20
+ fillRule: "evenodd",
21
+ clipRule: "evenodd",
22
+ fill: "#FF4141",
23
+ d: "M61.44,0c33.933,0,61.439,27.507,61.439,61.439 s-27.506,61.439-61.439,61.439C27.507,122.879,0,95.372,0,61.439S27.507,0,61.44,0L61.44,0z M73.451,39.151 c2.75-2.793,7.221-2.805,9.986-0.027c2.764,2.776,2.775,7.292,0.027,10.083L71.4,61.445l12.076,12.249 c2.729,2.77,2.689,7.257-0.08,10.022c-2.773,2.765-7.23,2.758-9.955-0.013L61.446,71.54L49.428,83.728 c-2.75,2.793-7.22,2.805-9.986,0.027c-2.763-2.776-2.776-7.293-0.027-10.084L51.48,61.434L39.403,49.185 c-2.728-2.769-2.689-7.256,0.082-10.022c2.772-2.765,7.229-2.758,9.953,0.013l11.997,12.165L73.451,39.151L73.451,39.151z"
24
+ })));
25
+ };
26
+
27
+ exports.Xmark = Xmark;
@@ -0,0 +1,21 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ var Requirements = require('./components/Requirements/Requirements.js');
10
+ var NoteTextField = require('./components/NoteTextField/NoteTextField.js');
11
+ var Button = require('./components/Button.js');
12
+ var Stack = require('./components/Stack.js');
13
+ var NavBar = require('./components/NavBar/NavBar.js');
14
+
15
+
16
+
17
+ exports.Requirements = Requirements.Requirements;
18
+ exports.NoteTextField = NoteTextField.NoteTextField;
19
+ exports.Button = Button.default;
20
+ exports.Stack = Stack.default;
21
+ exports.NavBar = NavBar.NavBar;
@@ -0,0 +1,16 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ Object.defineProperty(exports, '__esModule', { value: true });
10
+
11
+ var styleInject_es = require('../node_modules/style-inject/dist/style-inject.es.js');
12
+
13
+ var css_248z = ".requirement{align-items:center;display:flex;height:35px}.requirement p{font-family:sans-serif;font-size:14px;font-weight:700;margin-left:10px}.invalid{color:red}.valid{color:#7ac142}.checkmark{stroke-width:5;stroke:#fff;stroke-miterlimit:10;animation:fill .4s ease-in-out .4s forwards,scale .3s ease-in-out .9s both;border-radius:50%;box-shadow:inset 0 0 0 #7ac142;display:block;height:15px;width:15px}.checkmark__circle{stroke-dasharray:166;stroke-dashoffset:166;stroke-width:2;stroke-miterlimit:10;stroke:#7ac142;fill:none;animation:stroke .6s cubic-bezier(.65,0,.45,1) forwards}.checkmark__check{stroke-dasharray:48;stroke-dashoffset:48;animation:stroke .2s cubic-bezier(.65,0,.45,1) .5s forwards;transform-origin:50% 50%}@keyframes stroke{to{stroke-dashoffset:0}}@keyframes scale{0%,to{transform:none}50%{transform:scale3d(1.1,1.1,1)}}@keyframes fill{to{box-shadow:inset 0 0 0 30px #7ac142}}";
14
+ styleInject_es.default(css_248z);
15
+
16
+ exports.default = css_248z;
@@ -0,0 +1,22 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ function _extends() {
8
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
9
+ for (var i = 1; i < arguments.length; i++) {
10
+ var source = arguments[i];
11
+ for (var key in source) {
12
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
13
+ target[key] = source[key];
14
+ }
15
+ }
16
+ }
17
+ return target;
18
+ };
19
+ return _extends.apply(this, arguments);
20
+ }
21
+
22
+ export { _extends as extends };
@@ -0,0 +1,34 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ function styleInject(css, ref) {
8
+ if ( ref === void 0 ) ref = {};
9
+ var insertAt = ref.insertAt;
10
+
11
+ if (!css || typeof document === 'undefined') { return; }
12
+
13
+ var head = document.head || document.getElementsByTagName('head')[0];
14
+ var style = document.createElement('style');
15
+ style.type = 'text/css';
16
+
17
+ if (insertAt === 'top') {
18
+ if (head.firstChild) {
19
+ head.insertBefore(style, head.firstChild);
20
+ } else {
21
+ head.appendChild(style);
22
+ }
23
+ } else {
24
+ head.appendChild(style);
25
+ }
26
+
27
+ if (style.styleSheet) {
28
+ style.styleSheet.cssText = css;
29
+ } else {
30
+ style.appendChild(document.createTextNode(css));
31
+ }
32
+ }
33
+
34
+ export { styleInject as default };
@@ -0,0 +1,40 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import React from 'react';
8
+ import PropTypes from 'prop-types';
9
+
10
+ function Button({
11
+ label,
12
+ backgroundColor = "red",
13
+ size = "md",
14
+ onClick
15
+ }) {
16
+ let scale = 1;
17
+ if (size === "sm") {
18
+ scale = 0.75;
19
+ }
20
+ if (size === "lg") {
21
+ scale = 1.25;
22
+ }
23
+ const style = {
24
+ backgroundColor,
25
+ padding: `${0.5 * scale}rem ${1 * scale}rem`,
26
+ border: "none"
27
+ };
28
+ return /*#__PURE__*/React.createElement("button", {
29
+ style: style,
30
+ onClick: onClick
31
+ }, label);
32
+ }
33
+ Button.propTypes = {
34
+ label: PropTypes.string,
35
+ backgroundColor: PropTypes.string,
36
+ size: PropTypes.oneOf(["sm", "md", "lg"]),
37
+ onClick: PropTypes.func
38
+ };
39
+
40
+ export { Button as default };
@@ -0,0 +1,27 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import React from 'react';
8
+
9
+ // Ported from Alexander Haniotis' code here: https://codepen.io/haniotis/pen/KwvYLO
10
+ const Checkmark = () => {
11
+ return /*#__PURE__*/React.createElement("svg", {
12
+ className: "checkmark",
13
+ viewBox: "0 0 52 52"
14
+ }, /*#__PURE__*/React.createElement("circle", {
15
+ className: "checkmark__circle",
16
+ cx: "26",
17
+ cy: "26",
18
+ r: "25",
19
+ fill: "none"
20
+ }), /*#__PURE__*/React.createElement("path", {
21
+ className: "checkmark__check",
22
+ fill: "none",
23
+ d: "M14.1 27.2l7.1 7.2 16.7-16.8"
24
+ }));
25
+ };
26
+
27
+ export { Checkmark };
@@ -0,0 +1,237 @@
1
+ "use client";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
6
+ */
7
+
8
+ import { useState } from 'react';
9
+ import Link from 'next/link';
10
+ import { AppBar, Container, Toolbar, Box, Typography, Button, Dialog, List, ListItem, ListItemText, Divider } from '@mui/material';
11
+ import CloseIcon from '@mui/icons-material/Close';
12
+ import MoreVertIcon from '@mui/icons-material/MoreVert';
13
+
14
+ const NavBar = ({
15
+ site_title,
16
+ logo,
17
+ pages
18
+ }) => {
19
+ // handleMobileMenu
20
+
21
+ const [mobileNavOpen, setMobileNavOpen] = useState(false);
22
+ const handleOpenMobileMenu = e => {
23
+ setMobileNavOpen(true);
24
+ };
25
+ const handleCloseMobileMenu = e => {
26
+ setMobileNavOpen(false);
27
+ };
28
+ return /*#__PURE__*/React.createElement(AppBar, {
29
+ position: "sticky"
30
+ }, /*#__PURE__*/React.createElement(Container, {
31
+ maxWidth: "xl"
32
+ }, /*#__PURE__*/React.createElement(Toolbar, {
33
+ disableGutters: true,
34
+ sx: {
35
+ py: 1
36
+ }
37
+ }, /*#__PURE__*/React.createElement(Link, {
38
+ href: "/",
39
+ style: {
40
+ textDecoration: "none",
41
+ color: "unset"
42
+ }
43
+ }, /*#__PURE__*/React.createElement(Box, {
44
+ sx: {
45
+ display: {
46
+ xs: "none",
47
+ md: "flex"
48
+ },
49
+ cursor: "pointer",
50
+ alignItems: "center"
51
+ }
52
+ }, /*#__PURE__*/React.createElement(Box, {
53
+ sx: {
54
+ display: "flex",
55
+ mr: 1
56
+ }
57
+ }, /*#__PURE__*/React.createElement("img", {
58
+ src: logo.url,
59
+ width: logo.width || "32px",
60
+ height: logo.height || "32px",
61
+ alt: "site logo",
62
+ style: {
63
+ maxWidth: "60px",
64
+ maxHeight: "60px"
65
+ }
66
+ })), site_title !== undefined && /*#__PURE__*/React.createElement(Typography, {
67
+ variant: "h6",
68
+ noWrap: true,
69
+ component: "h1",
70
+ sx: {
71
+ display: "flex",
72
+ textDecoration: "none"
73
+ }
74
+ }, site_title))), /*#__PURE__*/React.createElement(Box, {
75
+ sx: {
76
+ flexGrow: 1,
77
+ display: {
78
+ xs: "none",
79
+ md: "flex"
80
+ },
81
+ alignItems: "center"
82
+ }
83
+ }, pages.map(page => {
84
+ return /*#__PURE__*/React.createElement(Button, {
85
+ key: page.name,
86
+ onClick: () => page.action(),
87
+ sx: {
88
+ my: 2,
89
+ color: "primary.contrastText",
90
+ display: "block"
91
+ }
92
+ }, page.name);
93
+ })), /*#__PURE__*/React.createElement(Link, {
94
+ href: "/",
95
+ style: {
96
+ textDecoration: "none",
97
+ color: "unset"
98
+ }
99
+ }, /*#__PURE__*/React.createElement(Box, {
100
+ sx: {
101
+ display: {
102
+ xs: "flex",
103
+ md: "none"
104
+ },
105
+ alignItems: "center"
106
+ }
107
+ }, logo.url !== undefined && /*#__PURE__*/React.createElement(Box, {
108
+ sx: {
109
+ display: "flex",
110
+ mr: 1
111
+ }
112
+ }, /*#__PURE__*/React.createElement("img", {
113
+ src: logo.url,
114
+ width: logo.width || "32px",
115
+ height: logo.height || "32px",
116
+ alt: logo.alt || "site logo",
117
+ style: {
118
+ maxWidth: "60px",
119
+ maxHeight: "60px"
120
+ }
121
+ })), site_title !== undefined && /*#__PURE__*/React.createElement(Typography, {
122
+ variant: "h5",
123
+ noWrap: true,
124
+ component: "h1",
125
+ sx: {
126
+ display: "flex",
127
+ flexGrow: 1
128
+ }
129
+ }, site_title))), /*#__PURE__*/React.createElement(Box, {
130
+ sx: {
131
+ display: {
132
+ xs: "flex",
133
+ md: "none"
134
+ },
135
+ flexGrow: 1
136
+ }
137
+ }), /*#__PURE__*/React.createElement(Box, {
138
+ sx: {
139
+ flexGrow: 0,
140
+ display: {
141
+ xs: "flex",
142
+ md: "none"
143
+ }
144
+ }
145
+ }, /*#__PURE__*/React.createElement(Button, {
146
+ onClick: handleOpenMobileMenu,
147
+ sx: {
148
+ width: "40px",
149
+ height: "40px",
150
+ borderRadius: "50%",
151
+ p: 0,
152
+ minWidth: "unset",
153
+ color: "primary.contrastText",
154
+ boxShadow: "0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"
155
+ }
156
+ }, /*#__PURE__*/React.createElement(MoreVertIcon, {
157
+ sx: {
158
+ color: "primary.contrastText"
159
+ }
160
+ })), /*#__PURE__*/React.createElement(Dialog, {
161
+ fullScreen: true,
162
+ open: mobileNavOpen,
163
+ onClose: handleCloseMobileMenu
164
+ }, /*#__PURE__*/React.createElement(AppBar, {
165
+ position: "sticky"
166
+ }, /*#__PURE__*/React.createElement(Container, {
167
+ maxWidth: "xl"
168
+ }, /*#__PURE__*/React.createElement(Toolbar, {
169
+ disableGutters: true,
170
+ sx: {
171
+ py: 1,
172
+ justifyContent: "space-between"
173
+ }
174
+ }, /*#__PURE__*/React.createElement(Link, {
175
+ href: "/",
176
+ style: {
177
+ textDecoration: "none",
178
+ color: "unset"
179
+ }
180
+ }, /*#__PURE__*/React.createElement(Box, {
181
+ sx: {
182
+ display: "flex",
183
+ flexDirection: "row",
184
+ alignItems: "center"
185
+ }
186
+ }, /*#__PURE__*/React.createElement(Box, {
187
+ sx: {
188
+ display: "flex",
189
+ mr: 1
190
+ }
191
+ }, /*#__PURE__*/React.createElement("img", {
192
+ src: logo.url,
193
+ alt: logo.alt || "logo",
194
+ width: logo.width || "32px",
195
+ height: logo.height || "32px",
196
+ style: {
197
+ maxWidth: "60px",
198
+ maxHeight: "60px"
199
+ }
200
+ })), /*#__PURE__*/React.createElement(Typography, {
201
+ variant: "h5",
202
+ noWrap: true,
203
+ component: "h1",
204
+ sx: {
205
+ display: "flex",
206
+ flexGrow: 1
207
+ }
208
+ }, site_title !== undefined && site_title))), /*#__PURE__*/React.createElement(Button, {
209
+ onClick: handleCloseMobileMenu,
210
+ sx: {
211
+ width: "40px",
212
+ height: "40px",
213
+ borderRadius: "50%",
214
+ p: 0,
215
+ minWidth: "unset",
216
+ color: "primary.contrastText",
217
+ boxShadow: "0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"
218
+ },
219
+ "aria-label": "close"
220
+ }, /*#__PURE__*/React.createElement(CloseIcon, {
221
+ sx: {
222
+ color: "primary.contrastText"
223
+ }
224
+ }))))), /*#__PURE__*/React.createElement(List, null, pages.map(page => {
225
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ListItem, {
226
+ key: page.name,
227
+ onClick: () => {
228
+ page.action();
229
+ handleCloseMobileMenu();
230
+ }
231
+ }, /*#__PURE__*/React.createElement(ListItemText, {
232
+ primary: page.name
233
+ })), /*#__PURE__*/React.createElement(Divider, null));
234
+ })))))));
235
+ };
236
+
237
+ export { NavBar };
@@ -0,0 +1,19 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import { extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import React from 'react';
9
+ import { TextField } from '@mui/material';
10
+
11
+ const NoteTextField = props => {
12
+ return /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
13
+ sx: {
14
+ background: "linear-gradient(45deg, rgba(251,246,137,1) 30%, rgba(252,242,138,1) 90%)"
15
+ }
16
+ }));
17
+ };
18
+
19
+ export { NoteTextField };
@@ -0,0 +1,26 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import { Xmark } from '../Xmark/Xmark.js';
8
+ import { Checkmark } from '../Checkmark/Checkmark.js';
9
+ import React, { useState, useEffect } from 'react';
10
+
11
+ const Requirement = ({
12
+ value,
13
+ requirement
14
+ }) => {
15
+ const [isValid, setIsValid] = useState();
16
+ useEffect(() => {
17
+ setIsValid(requirement.validator(value));
18
+ }, [value, requirement]);
19
+ return /*#__PURE__*/React.createElement("div", {
20
+ className: "requirement"
21
+ }, isValid ? /*#__PURE__*/React.createElement(Checkmark, null) : /*#__PURE__*/React.createElement(Xmark, null), /*#__PURE__*/React.createElement("p", {
22
+ className: isValid ? "valid" : "invalid"
23
+ }, requirement.text));
24
+ };
25
+
26
+ export { Requirement };
@@ -0,0 +1,28 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import '../../styles.css.js';
8
+ import { Requirement } from '../Requirement/Requirement.js';
9
+ import React, { useCallback, useEffect } from 'react';
10
+
11
+ const Requirements = ({
12
+ value,
13
+ requirements,
14
+ onValidChange
15
+ }) => {
16
+ const validChangeCb = useCallback(onValidChange, []);
17
+ useEffect(() => {
18
+ validChangeCb(requirements.every(r => r.validator(value)));
19
+ }, [value, requirements, validChangeCb]);
20
+ return requirements.map((r, index) => /*#__PURE__*/React.createElement(Requirement, {
21
+ key: index,
22
+ value: value,
23
+ requirement: r,
24
+ onValidChange: onValidChange
25
+ }));
26
+ };
27
+
28
+ export { Requirements };
@@ -0,0 +1,32 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import React from 'react';
8
+ import PropTypes from 'prop-types';
9
+
10
+ function Stack({
11
+ children,
12
+ spacing = 2,
13
+ direction = "row",
14
+ wrap = false
15
+ }) {
16
+ const style = {
17
+ display: "flex",
18
+ gap: `${spacing * 0.25}rem`,
19
+ flexWrap: wrap ? "wrap" : "nowrap",
20
+ flexDirection: direction
21
+ };
22
+ return /*#__PURE__*/React.createElement("div", {
23
+ style: style
24
+ }, children);
25
+ }
26
+ Stack.propTypes = {
27
+ spacing: PropTypes.number,
28
+ wrap: PropTypes.bool,
29
+ direction: PropTypes.oneOf(["row", "column"])
30
+ };
31
+
32
+ export { Stack as default };
@@ -0,0 +1,25 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import React from 'react';
8
+
9
+ const Xmark = () => {
10
+ return /*#__PURE__*/React.createElement("svg", {
11
+ x: "0px",
12
+ y: "0px",
13
+ width: "15px",
14
+ height: "15px",
15
+ viewBox: "0 0 122.879 122.879",
16
+ enableBackground: "new 0 0 122.879 122.879"
17
+ }, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
18
+ fillRule: "evenodd",
19
+ clipRule: "evenodd",
20
+ fill: "#FF4141",
21
+ d: "M61.44,0c33.933,0,61.439,27.507,61.439,61.439 s-27.506,61.439-61.439,61.439C27.507,122.879,0,95.372,0,61.439S27.507,0,61.44,0L61.44,0z M73.451,39.151 c2.75-2.793,7.221-2.805,9.986-0.027c2.764,2.776,2.775,7.292,0.027,10.083L71.4,61.445l12.076,12.249 c2.729,2.77,2.689,7.257-0.08,10.022c-2.773,2.765-7.23,2.758-9.955-0.013L61.446,71.54L49.428,83.728 c-2.75,2.793-7.22,2.805-9.986,0.027c-2.763-2.776-2.776-7.293-0.027-10.084L51.48,61.434L39.403,49.185 c-2.728-2.769-2.689-7.256,0.082-10.022c2.772-2.765,7.229-2.758,9.953,0.013l11.997,12.165L73.451,39.151L73.451,39.151z"
22
+ })));
23
+ };
24
+
25
+ export { Xmark };
@@ -0,0 +1,11 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ export { Requirements } from './components/Requirements/Requirements.js';
8
+ export { NoteTextField } from './components/NoteTextField/NoteTextField.js';
9
+ export { default as Button } from './components/Button.js';
10
+ export { default as Stack } from './components/Stack.js';
11
+ export { NavBar } from './components/NavBar/NavBar.js';
@@ -0,0 +1,12 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
8
+
9
+ var css_248z = ".requirement{align-items:center;display:flex;height:35px}.requirement p{font-family:sans-serif;font-size:14px;font-weight:700;margin-left:10px}.invalid{color:red}.valid{color:#7ac142}.checkmark{stroke-width:5;stroke:#fff;stroke-miterlimit:10;animation:fill .4s ease-in-out .4s forwards,scale .3s ease-in-out .9s both;border-radius:50%;box-shadow:inset 0 0 0 #7ac142;display:block;height:15px;width:15px}.checkmark__circle{stroke-dasharray:166;stroke-dashoffset:166;stroke-width:2;stroke-miterlimit:10;stroke:#7ac142;fill:none;animation:stroke .6s cubic-bezier(.65,0,.45,1) forwards}.checkmark__check{stroke-dasharray:48;stroke-dashoffset:48;animation:stroke .2s cubic-bezier(.65,0,.45,1) .5s forwards;transform-origin:50% 50%}@keyframes stroke{to{stroke-dashoffset:0}}@keyframes scale{0%,to{transform:none}50%{transform:scale3d(1.1,1.1,1)}}@keyframes fill{to{box-shadow:inset 0 0 0 30px #7ac142}}";
10
+ styleInject(css_248z);
11
+
12
+ export { css_248z as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -34,9 +34,9 @@
34
34
  ]
35
35
  },
36
36
  "devDependencies": {
37
+ "@babel/preset-react": "7.23.3",
37
38
  "@emotion/react": "^11.11.3",
38
39
  "@emotion/styled": "^11.11.0",
39
- "@babel/preset-react": "7.23.3",
40
40
  "@rollup/plugin-babel": "^6.0.4",
41
41
  "@rollup/plugin-node-resolve": "^15.2.3",
42
42
  "@rollup/plugin-terser": "^0.4.4",
@@ -59,6 +59,8 @@
59
59
  "rollup": "^4.9.2",
60
60
  "rollup-plugin-peer-deps-external": "^2.2.4",
61
61
  "rollup-plugin-postcss": "^4.0.2",
62
+ "rollup-plugin-preserve-directives": "^0.4.0",
63
+ "rollup-plugin-use-client": "^1.4.0",
62
64
  "storybook": "^7.6.7",
63
65
  "web-vitals": "^3.5.1",
64
66
  "webpack": "^5.89.0"
package/rollup.config.mjs CHANGED
@@ -3,19 +3,36 @@ import resolve from "@rollup/plugin-node-resolve";
3
3
  import external from "rollup-plugin-peer-deps-external";
4
4
  import terser from "@rollup/plugin-terser";
5
5
  import postcss from "rollup-plugin-postcss";
6
+ import preserveDirectives from 'rollup-plugin-preserve-directives';
7
+ import useClient from "rollup-plugin-use-client";
8
+
9
+ const outputOptions = {
10
+ exports: 'named',
11
+ preserveModules: true,
12
+ banner: `/*
13
+ * UMWD-Components
14
+ * @copyright Jelle Paulus
15
+ * @license MIT
16
+ */
17
+ `,
18
+ };
19
+
6
20
 
7
21
  const config = [
8
22
  {
9
23
  input: "./src/index.js",
10
24
  output: [
11
25
  {
12
- file: "dist/index.js",
26
+ dir: "dist/cjs",
13
27
  format: "cjs",
28
+ ...outputOptions,
29
+ preserveModules: true,
14
30
  },
15
31
  {
16
- file: "dist/index.es.js",
17
- format: "es",
18
- exports: "named",
32
+ dir: "dist/esm",
33
+ format: "esm",
34
+ ...outputOptions,
35
+ preserveModules: true,
19
36
  },
20
37
  ],
21
38
  plugins: [
@@ -29,10 +46,13 @@ const config = [
29
46
  }),
30
47
  external(),
31
48
  resolve(),
32
- terser(),
49
+ preserveDirectives(),
50
+ /* useClient(), */
51
+ /* terser({
52
+ compress: { directives: false },
53
+ }), */
33
54
  ],
34
55
  },
35
56
  ];
36
57
 
37
- export default config;
38
-
58
+ export default config;
package/dist/index.es.js DELETED
@@ -1 +0,0 @@
1
- import e,{useState as t,useEffect as a,useCallback as r}from"react";import{TextField as n,AppBar as l,Container as c,Toolbar as o,Box as i,Typography as s,Button as m,Dialog as p,List as x,ListItem as d,ListItemText as h,Divider as f}from"@mui/material";import u from"prop-types";import g from"next/link";import y from"@mui/icons-material/Close";import k from"@mui/icons-material/MoreVert";!function(e,t){void 0===t&&(t={});var a=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===a&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".requirement{align-items:center;display:flex;height:35px}.requirement p{font-family:sans-serif;font-size:14px;font-weight:700;margin-left:10px}.invalid{color:red}.valid{color:#7ac142}.checkmark{stroke-width:5;stroke:#fff;stroke-miterlimit:10;animation:fill .4s ease-in-out .4s forwards,scale .3s ease-in-out .9s both;border-radius:50%;box-shadow:inset 0 0 0 #7ac142;display:block;height:15px;width:15px}.checkmark__circle{stroke-dasharray:166;stroke-dashoffset:166;stroke-width:2;stroke-miterlimit:10;stroke:#7ac142;fill:none;animation:stroke .6s cubic-bezier(.65,0,.45,1) forwards}.checkmark__check{stroke-dasharray:48;stroke-dashoffset:48;animation:stroke .2s cubic-bezier(.65,0,.45,1) .5s forwards;transform-origin:50% 50%}@keyframes stroke{to{stroke-dashoffset:0}}@keyframes scale{0%,to{transform:none}50%{transform:scale3d(1.1,1.1,1)}}@keyframes fill{to{box-shadow:inset 0 0 0 30px #7ac142}}");const E=()=>e.createElement("svg",{x:"0px",y:"0px",width:"15px",height:"15px",viewBox:"0 0 122.879 122.879",enableBackground:"new 0 0 122.879 122.879"},e.createElement("g",null,e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"#FF4141",d:"M61.44,0c33.933,0,61.439,27.507,61.439,61.439 s-27.506,61.439-61.439,61.439C27.507,122.879,0,95.372,0,61.439S27.507,0,61.44,0L61.44,0z M73.451,39.151 c2.75-2.793,7.221-2.805,9.986-0.027c2.764,2.776,2.775,7.292,0.027,10.083L71.4,61.445l12.076,12.249 c2.729,2.77,2.689,7.257-0.08,10.022c-2.773,2.765-7.23,2.758-9.955-0.013L61.446,71.54L49.428,83.728 c-2.75,2.793-7.22,2.805-9.986,0.027c-2.763-2.776-2.776-7.293-0.027-10.084L51.48,61.434L39.403,49.185 c-2.728-2.769-2.689-7.256,0.082-10.022c2.772-2.765,7.229-2.758,9.953,0.013l11.997,12.165L73.451,39.151L73.451,39.151z"}))),b=()=>e.createElement("svg",{className:"checkmark",viewBox:"0 0 52 52"},e.createElement("circle",{className:"checkmark__circle",cx:"26",cy:"26",r:"25",fill:"none"}),e.createElement("path",{className:"checkmark__check",fill:"none",d:"M14.1 27.2l7.1 7.2 16.7-16.8"})),R=({value:r,requirement:n})=>{const[l,c]=t();return a((()=>{c(n.validator(r))}),[r,n]),e.createElement("div",{className:"requirement"},l?e.createElement(b,null):e.createElement(E,null),e.createElement("p",{className:l?"valid":"invalid"},n.text))},w=({value:t,requirements:n,onValidChange:l})=>{const c=r(l,[]);return a((()=>{c(n.every((e=>e.validator(t))))}),[t,n,c]),n.map(((a,r)=>e.createElement(R,{key:r,value:t,requirement:a,onValidChange:l})))};function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},v.apply(this,arguments)}const C=t=>e.createElement(n,v({},t,{sx:{background:"linear-gradient(45deg, rgba(251,246,137,1) 30%, rgba(252,242,138,1) 90%)"}}));function W({label:t,backgroundColor:a="red",size:r="md",onClick:n}){let l=1;"sm"===r&&(l=.75),"lg"===r&&(l=1.25);const c={backgroundColor:a,padding:`${.5*l}rem ${1*l}rem`,border:"none"};return e.createElement("button",{style:c,onClick:n},t)}function T({children:t,spacing:a=2,direction:r="row",wrap:n=!1}){const l={display:"flex",gap:.25*a+"rem",flexWrap:n?"wrap":"nowrap",flexDirection:r};return e.createElement("div",{style:l},t)}W.propTypes={label:u.string,backgroundColor:u.string,size:u.oneOf(["sm","md","lg"]),onClick:u.func},T.propTypes={spacing:u.number,wrap:u.bool,direction:u.oneOf(["row","column"])};const _=({site_title:e,logo:a,pages:r})=>{const[n,u]=t(!1),E=e=>{u(!1)};return React.createElement(l,{position:"sticky"},React.createElement(c,{maxWidth:"xl"},React.createElement(o,{disableGutters:!0,sx:{py:1}},React.createElement(g,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(i,{sx:{display:{xs:"none",md:"flex"},cursor:"pointer",alignItems:"center"}},React.createElement(i,{sx:{display:"flex",mr:1}},React.createElement("img",{src:a.url,width:a.width||"32px",height:a.height||"32px",alt:"site logo",style:{maxWidth:"60px",maxHeight:"60px"}})),void 0!==e&&React.createElement(s,{variant:"h6",noWrap:!0,component:"h1",sx:{display:"flex",textDecoration:"none"}},e))),React.createElement(i,{sx:{flexGrow:1,display:{xs:"none",md:"flex"},alignItems:"center"}},r.map((e=>React.createElement(m,{key:e.name,onClick:()=>e.action(),sx:{my:2,color:"primary.contrastText",display:"block"}},e.name)))),React.createElement(g,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(i,{sx:{display:{xs:"flex",md:"none"},alignItems:"center"}},void 0!==a.url&&React.createElement(i,{sx:{display:"flex",mr:1}},React.createElement("img",{src:a.url,width:a.width||"32px",height:a.height||"32px",alt:a.alt||"site logo",style:{maxWidth:"60px",maxHeight:"60px"}})),void 0!==e&&React.createElement(s,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1}},e))),React.createElement(i,{sx:{display:{xs:"flex",md:"none"},flexGrow:1}}),React.createElement(i,{sx:{flexGrow:0,display:{xs:"flex",md:"none"}}},React.createElement(m,{onClick:e=>{u(!0)},sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",color:"primary.contrastText",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"}},React.createElement(k,{sx:{color:"primary.contrastText"}})),React.createElement(p,{fullScreen:!0,open:n,onClose:E},React.createElement(l,{position:"sticky"},React.createElement(c,{maxWidth:"xl"},React.createElement(o,{disableGutters:!0,sx:{py:1,justifyContent:"space-between"}},React.createElement(g,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(i,{sx:{display:"flex",flexDirection:"row",alignItems:"center"}},React.createElement(i,{sx:{display:"flex",mr:1}},React.createElement("img",{src:a.url,alt:a.alt||"logo",width:a.width||"32px",height:a.height||"32px",style:{maxWidth:"60px",maxHeight:"60px"}})),React.createElement(s,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1}},void 0!==e&&e))),React.createElement(m,{onClick:E,sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",color:"primary.contrastText",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},"aria-label":"close"},React.createElement(y,{sx:{color:"primary.contrastText"}}))))),React.createElement(x,null,r.map((e=>React.createElement(React.Fragment,null,React.createElement(d,{key:e.name,onClick:()=>{e.action(),E()}},React.createElement(h,{primary:e.name})),React.createElement(f,null))))))))))};export{W as Button,_ as NavBar,C as NoteTextField,w as Requirements,T as Stack};
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var e=require("react"),t=require("@mui/material"),a=require("prop-types"),r=require("next/link"),n=require("@mui/icons-material/Close"),l=require("@mui/icons-material/MoreVert");!function(e,t){void 0===t&&(t={});var a=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===a&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".requirement{align-items:center;display:flex;height:35px}.requirement p{font-family:sans-serif;font-size:14px;font-weight:700;margin-left:10px}.invalid{color:red}.valid{color:#7ac142}.checkmark{stroke-width:5;stroke:#fff;stroke-miterlimit:10;animation:fill .4s ease-in-out .4s forwards,scale .3s ease-in-out .9s both;border-radius:50%;box-shadow:inset 0 0 0 #7ac142;display:block;height:15px;width:15px}.checkmark__circle{stroke-dasharray:166;stroke-dashoffset:166;stroke-width:2;stroke-miterlimit:10;stroke:#7ac142;fill:none;animation:stroke .6s cubic-bezier(.65,0,.45,1) forwards}.checkmark__check{stroke-dasharray:48;stroke-dashoffset:48;animation:stroke .2s cubic-bezier(.65,0,.45,1) .5s forwards;transform-origin:50% 50%}@keyframes stroke{to{stroke-dashoffset:0}}@keyframes scale{0%,to{transform:none}50%{transform:scale3d(1.1,1.1,1)}}@keyframes fill{to{box-shadow:inset 0 0 0 30px #7ac142}}");const o=()=>e.createElement("svg",{x:"0px",y:"0px",width:"15px",height:"15px",viewBox:"0 0 122.879 122.879",enableBackground:"new 0 0 122.879 122.879"},e.createElement("g",null,e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"#FF4141",d:"M61.44,0c33.933,0,61.439,27.507,61.439,61.439 s-27.506,61.439-61.439,61.439C27.507,122.879,0,95.372,0,61.439S27.507,0,61.44,0L61.44,0z M73.451,39.151 c2.75-2.793,7.221-2.805,9.986-0.027c2.764,2.776,2.775,7.292,0.027,10.083L71.4,61.445l12.076,12.249 c2.729,2.77,2.689,7.257-0.08,10.022c-2.773,2.765-7.23,2.758-9.955-0.013L61.446,71.54L49.428,83.728 c-2.75,2.793-7.22,2.805-9.986,0.027c-2.763-2.776-2.776-7.293-0.027-10.084L51.48,61.434L39.403,49.185 c-2.728-2.769-2.689-7.256,0.082-10.022c2.772-2.765,7.229-2.758,9.953,0.013l11.997,12.165L73.451,39.151L73.451,39.151z"}))),c=()=>e.createElement("svg",{className:"checkmark",viewBox:"0 0 52 52"},e.createElement("circle",{className:"checkmark__circle",cx:"26",cy:"26",r:"25",fill:"none"}),e.createElement("path",{className:"checkmark__check",fill:"none",d:"M14.1 27.2l7.1 7.2 16.7-16.8"})),i=({value:t,requirement:a})=>{const[r,n]=e.useState();return e.useEffect((()=>{n(a.validator(t))}),[t,a]),e.createElement("div",{className:"requirement"},r?e.createElement(c,null):e.createElement(o,null),e.createElement("p",{className:r?"valid":"invalid"},a.text))};function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},s.apply(this,arguments)}function m({label:t,backgroundColor:a="red",size:r="md",onClick:n}){let l=1;"sm"===r&&(l=.75),"lg"===r&&(l=1.25);const o={backgroundColor:a,padding:`${.5*l}rem ${1*l}rem`,border:"none"};return e.createElement("button",{style:o,onClick:n},t)}function x({children:t,spacing:a=2,direction:r="row",wrap:n=!1}){const l={display:"flex",gap:.25*a+"rem",flexWrap:n?"wrap":"nowrap",flexDirection:r};return e.createElement("div",{style:l},t)}m.propTypes={label:a.string,backgroundColor:a.string,size:a.oneOf(["sm","md","lg"]),onClick:a.func},x.propTypes={spacing:a.number,wrap:a.bool,direction:a.oneOf(["row","column"])};exports.Button=m,exports.NavBar=({site_title:a,logo:o,pages:c})=>{const[i,s]=e.useState(!1),m=e=>{s(!1)};return React.createElement(t.AppBar,{position:"sticky"},React.createElement(t.Container,{maxWidth:"xl"},React.createElement(t.Toolbar,{disableGutters:!0,sx:{py:1}},React.createElement(r,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(t.Box,{sx:{display:{xs:"none",md:"flex"},cursor:"pointer",alignItems:"center"}},React.createElement(t.Box,{sx:{display:"flex",mr:1}},React.createElement("img",{src:o.url,width:o.width||"32px",height:o.height||"32px",alt:"site logo",style:{maxWidth:"60px",maxHeight:"60px"}})),void 0!==a&&React.createElement(t.Typography,{variant:"h6",noWrap:!0,component:"h1",sx:{display:"flex",textDecoration:"none"}},a))),React.createElement(t.Box,{sx:{flexGrow:1,display:{xs:"none",md:"flex"},alignItems:"center"}},c.map((e=>React.createElement(t.Button,{key:e.name,onClick:()=>e.action(),sx:{my:2,color:"primary.contrastText",display:"block"}},e.name)))),React.createElement(r,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(t.Box,{sx:{display:{xs:"flex",md:"none"},alignItems:"center"}},void 0!==o.url&&React.createElement(t.Box,{sx:{display:"flex",mr:1}},React.createElement("img",{src:o.url,width:o.width||"32px",height:o.height||"32px",alt:o.alt||"site logo",style:{maxWidth:"60px",maxHeight:"60px"}})),void 0!==a&&React.createElement(t.Typography,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1}},a))),React.createElement(t.Box,{sx:{display:{xs:"flex",md:"none"},flexGrow:1}}),React.createElement(t.Box,{sx:{flexGrow:0,display:{xs:"flex",md:"none"}}},React.createElement(t.Button,{onClick:e=>{s(!0)},sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",color:"primary.contrastText",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"}},React.createElement(l,{sx:{color:"primary.contrastText"}})),React.createElement(t.Dialog,{fullScreen:!0,open:i,onClose:m},React.createElement(t.AppBar,{position:"sticky"},React.createElement(t.Container,{maxWidth:"xl"},React.createElement(t.Toolbar,{disableGutters:!0,sx:{py:1,justifyContent:"space-between"}},React.createElement(r,{href:"/",style:{textDecoration:"none",color:"unset"}},React.createElement(t.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center"}},React.createElement(t.Box,{sx:{display:"flex",mr:1}},React.createElement("img",{src:o.url,alt:o.alt||"logo",width:o.width||"32px",height:o.height||"32px",style:{maxWidth:"60px",maxHeight:"60px"}})),React.createElement(t.Typography,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1}},void 0!==a&&a))),React.createElement(t.Button,{onClick:m,sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",color:"primary.contrastText",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},"aria-label":"close"},React.createElement(n,{sx:{color:"primary.contrastText"}}))))),React.createElement(t.List,null,c.map((e=>React.createElement(React.Fragment,null,React.createElement(t.ListItem,{key:e.name,onClick:()=>{e.action(),m()}},React.createElement(t.ListItemText,{primary:e.name})),React.createElement(t.Divider,null))))))))))},exports.NoteTextField=a=>e.createElement(t.TextField,s({},a,{sx:{background:"linear-gradient(45deg, rgba(251,246,137,1) 30%, rgba(252,242,138,1) 90%)"}})),exports.Requirements=({value:t,requirements:a,onValidChange:r})=>{const n=e.useCallback(r,[]);return e.useEffect((()=>{n(a.every((e=>e.validator(t))))}),[t,a,n]),a.map(((a,n)=>e.createElement(i,{key:n,value:t,requirement:a,onValidChange:r})))},exports.Stack=x;