@koine/react 1.0.36 → 1.0.37

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.
@@ -27,7 +27,7 @@ exports.Body = "div";
27
27
  // Body: _Body,
28
28
  // ...props
29
29
  // }: KoineDialogProps) => (
30
- // <Root BackdropComponent={Backdrop} onBackdropClick={props.onClose} {...props}>
30
+ // <Root components={{ Backdrop }} onBackdropClick={props.onClose} {...props}>
31
31
  // <Container $scrollPaper={$scrollPaper}>
32
32
  // <Paper aria-label={title || ""} $scrollPaper={$scrollPaper}>
33
33
  // {title && <Header>{title}</Header>}
@@ -70,7 +70,7 @@ var DialogWithRef = (0, react_1.forwardRef)(function Dialog(_a, ref) {
70
70
  onClose(event, "backdropClick");
71
71
  }
72
72
  };
73
- return ((0, jsx_runtime_1.jsx)(exports.Root, tslib_1.__assign({ BackdropComponent: exports.Backdrop, onClick: handleBackdropClick, onClose: onClose, ref: ref }, props, { children: (0, jsx_runtime_1.jsx)(exports.Container, tslib_1.__assign({ "$scrollPaper": $scrollPaper, onMouseDown: handleMouseDown }, { children: (0, jsx_runtime_1.jsxs)(exports.Paper, tslib_1.__assign({ "aria-label": title || "", "$scrollPaper": $scrollPaper }, { children: [title && (0, jsx_runtime_1.jsx)(exports.Header, { children: title }), (0, jsx_runtime_1.jsx)(exports.Close, tslib_1.__assign({ onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(md_1.MdClear, {}) })), (0, jsx_runtime_1.jsx)(exports.Body, { children: children })] })) })) })));
73
+ return ((0, jsx_runtime_1.jsx)(exports.Root, tslib_1.__assign({ components: { Backdrop: exports.Backdrop }, onClick: handleBackdropClick, onClose: onClose, ref: ref }, props, { children: (0, jsx_runtime_1.jsx)(exports.Container, tslib_1.__assign({ "$scrollPaper": $scrollPaper, onMouseDown: handleMouseDown }, { children: (0, jsx_runtime_1.jsxs)(exports.Paper, tslib_1.__assign({ "aria-label": title || "", "$scrollPaper": $scrollPaper }, { children: [title && (0, jsx_runtime_1.jsx)(exports.Header, { children: title }), (0, jsx_runtime_1.jsx)(exports.Close, tslib_1.__assign({ onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(md_1.MdClear, {}) })), (0, jsx_runtime_1.jsx)(exports.Body, { children: children })] })) })) })));
74
74
  });
75
75
  exports.KoineDialog = (0, helpers_1.extendComponent)(DialogWithRef, {
76
76
  Root: exports.Root,
@@ -40,7 +40,7 @@ var Dialog = (0, react_1.forwardRef)(function Dialog(_a, ref) {
40
40
  onClose(event, "backdropClick");
41
41
  }
42
42
  };
43
- return ((0, jsx_runtime_1.jsx)(Root, tslib_1.__assign({ keepMounted: true, BackdropComponent: BackdropMotion, onClick: handleBackdropClick, onClose: onClose, ref: ref }, props, { style: (0, index_1.mRootStyle)(props) }, { children: (0, jsx_runtime_1.jsx)(Container, tslib_1.__assign({ "$scrollPaper": $scrollPaper, onMouseDown: handleMouseDown }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: props.open && (
43
+ return ((0, jsx_runtime_1.jsx)(Root, tslib_1.__assign({ keepMounted: true, components: { Backdrop: BackdropMotion }, onClick: handleBackdropClick, onClose: onClose, ref: ref }, props, { style: (0, index_1.mRootStyle)(props) }, { children: (0, jsx_runtime_1.jsx)(Container, tslib_1.__assign({ "$scrollPaper": $scrollPaper, onMouseDown: handleMouseDown }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: props.open && (
44
44
  // @ts-expect-error framer props collision...
45
45
  (0, jsx_runtime_1.jsxs)(Paper, tslib_1.__assign({}, mPaper, { "aria-label": title || "", "$scrollPaper": $scrollPaper }, { children: [title && (0, jsx_runtime_1.jsx)(Header, { children: title }), (0, jsx_runtime_1.jsx)(Close, tslib_1.__assign({ onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(md_1.MdClear, {}) })), (0, jsx_runtime_1.jsx)(Body, { children: children })] }))) }) })) })));
46
46
  });
@@ -11,30 +11,13 @@ exports.FieldRoot = (0, styled_components_1.default)(exports.FieldBase)(template
11
11
  return (p.$danger &&
12
12
  "\n color: var(--danger);\n \n textarea,\n input,\n select {\n color: var(--danger);\n }\n ");
13
13
  });
14
- /**
15
- * Yup's errors produce by these validations:
16
- *
17
- * ```
18
- * email: string().email().required(),
19
- * name: string().required()
20
- * ```
21
- *
22
- * determine the `error.type` of the `FieldError` to be "required" and "email".
23
- * We assume these as standard translations keys without needing to pass
24
- * a string into the validation, e.g. `required("mySpecialKey")`.
25
- */
26
- var YUP_ERROR_TYPES_AS_KEYS = {
27
- required: 1,
28
- email: 1,
29
- };
30
14
  var Field = function (_a) {
31
15
  var name = _a.name, t = _a.t, error = _a.error, errors = _a.errors, children = _a.children, props = tslib_1.__rest(_a, ["name", "t", "error", "errors", "children"]);
32
- var err = errors && name ? errors[name] : error;
16
+ var err = (errors && name ? errors[name] : error);
33
17
  var msg = "";
34
18
  if (err) {
35
19
  if (name && t && err.type !== "plain") {
36
- var translationKey = err.type && YUP_ERROR_TYPES_AS_KEYS[err.type] ? err.type : "";
37
- msg = t("errors.".concat(name, ".").concat(translationKey || err.message));
20
+ msg = t("errors.".concat(name, ".").concat(err.type || err.message));
38
21
  }
39
22
  else {
40
23
  msg = err.message;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.decodeForm = exports.encodeForm = void 0;
4
- var yup_1 = require("yup");
4
+ var yup_1 = require("@kuus/yup");
5
5
  var utils_1 = require("@koine/utils");
6
6
  /**
7
7
  * Encode form
@@ -11,6 +11,8 @@ var utils_1 = require("@koine/utils");
11
11
  *
12
12
  * We skip the names prefixed wth an underscore which are considered programmatic
13
13
  * form data not created by user input.
14
+ *
15
+ * FIXME: types https://github.com/jquense/yup/issues/1700
14
16
  */
15
17
  function encodeForm(validationRules) {
16
18
  var encoded = {};
@@ -27,7 +27,6 @@ exports.Menu = (0, react_1.forwardRef)(function Menu(props, ref) {
27
27
  }).styles;
28
28
  var _c = (0, MenuUnstyled_1.useMenu)({
29
29
  listboxId: id,
30
- // @ts-expect-error fix if we are going to use all this...
31
30
  listboxRef: setPopperElement,
32
31
  // these two make the Tab key behaviour correct, closing the menu on Tab
33
32
  // press and re-focusing the Button trigger element
@@ -68,7 +67,7 @@ exports.Menu = (0, react_1.forwardRef)(function Menu(props, ref) {
68
67
  var childrenProps = { close: close };
69
68
  return children(childrenProps);
70
69
  }, [children, close]);
71
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button, { ref: buttonRef, id: id, "aria-haspopup": "true", "aria-controls": open ? id : undefined, "aria-expanded": open ? "true" : undefined, onClick: handleButtonClick, onKeyDown: handleButtonKeyDown }), (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: open && ((0, jsx_runtime_1.jsx)(ModalUnstyled_1.default, tslib_1.__assign({ BackdropComponent: MenuBackdrop, onClose: close, onBackdropClick: close, open: open }, { children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(ClickAwayListener_1.default, tslib_1.__assign({ onClickAway: close }, { children: (0, jsx_runtime_1.jsx)(MenuRoot, tslib_1.__assign({ initial: {
70
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button, { ref: buttonRef, id: id, "aria-haspopup": "true", "aria-controls": open ? id : undefined, "aria-expanded": open ? "true" : undefined, onClick: handleButtonClick, onKeyDown: handleButtonKeyDown }), (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: open && ((0, jsx_runtime_1.jsx)(ModalUnstyled_1.default, tslib_1.__assign({ components: { Backdrop: MenuBackdrop }, onClose: close, onBackdropClick: close, open: open }, { children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(ClickAwayListener_1.default, tslib_1.__assign({ onClickAway: close }, { children: (0, jsx_runtime_1.jsx)(MenuRoot, tslib_1.__assign({ initial: {
72
71
  opacity: 0,
73
72
  }, animate: {
74
73
  opacity: 1,
package/package.json CHANGED
@@ -6,22 +6,22 @@
6
6
  "dependencies": {},
7
7
  "peerDependencies": {
8
8
  "styled-components": "^5.3.5",
9
- "framer-motion": "^6.3.10",
9
+ "framer-motion": "^6.3.16",
10
10
  "react": "^16.8 || ^17 || ^18",
11
- "@mui/base": "^5.0.0-alpha.83",
12
- "@koine/utils": "1.0.36",
11
+ "@mui/base": "^5.0.0-alpha.87",
12
+ "@koine/utils": "1.0.37",
13
13
  "react-icons": "^4.4.0",
14
14
  "date-fns": "^2.28.0",
15
15
  "react-swipeable": "^7.0.0",
16
- "@tiptap/react": "^2.0.0-beta.109",
17
- "@tiptap/starter-kit": "^2.0.0-beta.185",
18
- "yup": "^0.32.11",
19
- "react-hook-form": "^7.31.3",
20
- "type-fest": "^2.13.0",
16
+ "@tiptap/react": "^2.0.0-beta.114",
17
+ "@tiptap/starter-kit": "^2.0.0-beta.190",
18
+ "@kuus/yup": "^1.0.0-beta.4",
19
+ "react-hook-form": "^7.33.0",
20
+ "type-fest": "^2.14.0",
21
21
  "react-popper": "^2.3.0",
22
22
  "tslib": "^2.4.0"
23
23
  },
24
- "version": "1.0.36",
24
+ "version": "1.0.37",
25
25
  "module": "./index.js",
26
26
  "types": "./index.d.ts"
27
27
  }