musae 1.3.1-beta.17 → 1.3.1-beta.19

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.
@@ -14,7 +14,7 @@ var className = require('@aiszlab/relax/class-name');
14
14
  var context = require('../context.cjs');
15
15
  var index = require('../hooks/index.cjs');
16
16
 
17
- var _excluded = ["required", "children", "className", "style", "supporting", "name", "rules"];
17
+ var _excluded = ["required", "children", "className", "style", "supporting", "error", "name", "rules"];
18
18
  /**
19
19
  * @description
20
20
  * form item may not has name prop
@@ -26,6 +26,7 @@ var Field = function Field(_ref) {
26
26
  className$1 = _ref.className,
27
27
  style = _ref.style,
28
28
  supporting$1 = _ref.supporting,
29
+ renderError = _ref.error,
29
30
  name = _ref.name,
30
31
  rules = _ref.rules,
31
32
  props = _objectWithoutProperties(_ref, _excluded);
@@ -62,7 +63,7 @@ var Field = function Field(_ref) {
62
63
  className: classNames.item,
63
64
  supporting: /*#__PURE__*/React.createElement(React.Fragment, null, !!supporting$1 && /*#__PURE__*/React.createElement(supporting.default, null, supporting$1), /*#__PURE__*/React.createElement(react.AnimatePresence, {
64
65
  mode: "wait"
65
- }, isInvalid && /*#__PURE__*/React.createElement(error.default, null, error$1)))
66
+ }, isInvalid && (renderError === false ? null : relax.isFunction(renderError) ? renderError(error$1) : (/*#__PURE__*/React.createElement(error.default, null, error$1)))))
66
67
  }, /*#__PURE__*/React.createElement("div", {
67
68
  className: className.stringify(classNames.field, className$1),
68
69
  style: style
@@ -6,5 +6,5 @@ import type { RequiredIn } from "@aiszlab/relax/types";
6
6
  * form item may not has name prop
7
7
  * if there is name prop, it will render
8
8
  */
9
- declare const Field: <T extends FieldsValue, FieldKey extends keyof T>({ required, children: _children, className, style, supporting, name, rules, ...props }: RequiredIn<FormItemProps<T, FieldKey>, "name" | "required">) => React.JSX.Element;
9
+ declare const Field: <T extends FieldsValue, FieldKey extends keyof T>({ required, children: _children, className, style, supporting, error: renderError, name, rules, ...props }: RequiredIn<FormItemProps<T, FieldKey>, "name" | "required">) => React.JSX.Element;
10
10
  export default Field;
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
3
  import React, { useContext, useMemo, Children, isValidElement, cloneElement } from 'react';
4
- import { chain } from '@aiszlab/relax';
4
+ import { chain, isFunction } from '@aiszlab/relax';
5
5
  import Layout from './layout.mjs';
6
6
  import Error from './error.mjs';
7
7
  import { AnimatePresence } from 'motion/react';
@@ -10,7 +10,7 @@ import { stringify } from '@aiszlab/relax/class-name';
10
10
  import Context from '../context.mjs';
11
11
  import { useFormItem } from '../hooks/index.mjs';
12
12
 
13
- var _excluded = ["required", "children", "className", "style", "supporting", "name", "rules"];
13
+ var _excluded = ["required", "children", "className", "style", "supporting", "error", "name", "rules"];
14
14
  /**
15
15
  * @description
16
16
  * form item may not has name prop
@@ -22,6 +22,7 @@ var Field = function Field(_ref) {
22
22
  className = _ref.className,
23
23
  style = _ref.style,
24
24
  supporting = _ref.supporting,
25
+ renderError = _ref.error,
25
26
  name = _ref.name,
26
27
  rules = _ref.rules,
27
28
  props = _objectWithoutProperties(_ref, _excluded);
@@ -58,7 +59,7 @@ var Field = function Field(_ref) {
58
59
  className: classNames.item,
59
60
  supporting: /*#__PURE__*/React.createElement(React.Fragment, null, !!supporting && /*#__PURE__*/React.createElement(Supporting, null, supporting), /*#__PURE__*/React.createElement(AnimatePresence, {
60
61
  mode: "wait"
61
- }, isInvalid && /*#__PURE__*/React.createElement(Error, null, error)))
62
+ }, isInvalid && (renderError === false ? null : isFunction(renderError) ? renderError(error) : (/*#__PURE__*/React.createElement(Error, null, error)))))
62
63
  }, /*#__PURE__*/React.createElement("div", {
63
64
  className: stringify(classNames.field, className),
64
65
  style: style
@@ -13,6 +13,7 @@ var hooks = require('./hooks.cjs');
13
13
  var dom = require('@aiszlab/relax/dom');
14
14
  var context = require('./context.cjs');
15
15
  var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
16
+ var tokens_stylex = require('../theme/tokens.stylex.cjs');
16
17
 
17
18
  var _excluded = ["open", "children", "placement", "style", "className", "onEnter", "onExit", "onExited", "onEntered", "trigger", "offset", "overlay", "arrow", "disappearable", "elevation", "portalClassName", "portalStyle"];
18
19
  var Dropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
@@ -39,7 +40,7 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
39
40
  portalStyle = _ref.portalStyle,
40
41
  props = _objectWithoutProperties(_ref, _excluded);
41
42
  var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
42
- var themeColorVars = useThemeColorVars.useThemeColorVars(["surface"]);
43
+ var themeColorVars = useThemeColorVars.useThemeColorVars(["surface", ["shadow", tokens_stylex.OPACITY.thicker], ["shadow", tokens_stylex.OPACITY.thick], ["shadow", tokens_stylex.OPACITY.medium]]);
43
44
  var _useFloating = hooks.useFloating({
44
45
  arrowable: arrowable,
45
46
  offset: offset,
@@ -9,6 +9,7 @@ import { useFloating } from './hooks.mjs';
9
9
  import { contains } from '@aiszlab/relax/dom';
10
10
  import { CLASS_NAMES } from './context.mjs';
11
11
  import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
12
+ import { OPACITY } from '../theme/tokens.stylex.mjs';
12
13
 
13
14
  var _excluded = ["open", "children", "placement", "style", "className", "onEnter", "onExit", "onExited", "onEntered", "trigger", "offset", "overlay", "arrow", "disappearable", "elevation", "portalClassName", "portalStyle"];
14
15
  var Dropdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
@@ -35,7 +36,7 @@ var Dropdown = /*#__PURE__*/forwardRef(function (_ref, ref) {
35
36
  portalStyle = _ref.portalStyle,
36
37
  props$1 = _objectWithoutProperties(_ref, _excluded);
37
38
  var classNames = useClassNames(CLASS_NAMES);
38
- var themeColorVars = useThemeColorVars(["surface"]);
39
+ var themeColorVars = useThemeColorVars(["surface", ["shadow", OPACITY.thicker], ["shadow", OPACITY.thick], ["shadow", OPACITY.medium]]);
39
40
  var _useFloating = useFloating({
40
41
  arrowable: arrowable,
41
42
  offset: offset,
@@ -141,7 +141,7 @@ var useFloating = function useFloating(_ref2) {
141
141
  }, _callee2);
142
142
  })));
143
143
  // memorized offsets
144
- useOffsets({
144
+ var offsets = useOffsets({
145
145
  offset: _offset,
146
146
  arrowable: arrowable
147
147
  });
@@ -153,7 +153,7 @@ var useFloating = function useFloating(_ref2) {
153
153
  var cleanup = dom.autoUpdate(trigger, _floatable, function () {
154
154
  dom.computePosition(trigger, _floatable, {
155
155
  placement: placement,
156
- middleware: [dom.flip(), dom.shift(), arrowable && !!arrowRef.current && dom.arrow({
156
+ middleware: [dom.offset(offsets), dom.flip(), dom.shift(), arrowable && !!arrowRef.current && dom.arrow({
157
157
  element: arrowRef.current,
158
158
  padding: 16
159
159
  })]
@@ -4,7 +4,7 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
4
4
  import { useRef, useEffect, useMemo } from 'react';
5
5
  import { animate } from 'motion/react';
6
6
  import { isFunction, useEvent } from '@aiszlab/relax';
7
- import { autoUpdate, computePosition, flip, shift, arrow } from '@floating-ui/dom';
7
+ import { autoUpdate, computePosition, offset, flip, shift, arrow } from '@floating-ui/dom';
8
8
 
9
9
  /**
10
10
  * @description
@@ -139,7 +139,7 @@ var useFloating = function useFloating(_ref2) {
139
139
  }, _callee2);
140
140
  })));
141
141
  // memorized offsets
142
- useOffsets({
142
+ var offsets = useOffsets({
143
143
  offset: _offset,
144
144
  arrowable: arrowable
145
145
  });
@@ -151,7 +151,7 @@ var useFloating = function useFloating(_ref2) {
151
151
  var cleanup = autoUpdate(trigger, _floatable, function () {
152
152
  computePosition(trigger, _floatable, {
153
153
  placement: placement,
154
- middleware: [flip(), shift(), arrowable && !!arrowRef.current && arrow({
154
+ middleware: [offset(offsets), flip(), shift(), arrowable && !!arrowRef.current && arrow({
155
155
  element: arrowRef.current,
156
156
  padding: 16
157
157
  })]
@@ -32,7 +32,7 @@ var dropdown = {
32
32
  $$css: true
33
33
  },
34
34
  elevation: {
35
- kGVxlE: "musaex-16g3oyh",
35
+ ku685b: "musaex-qmh4cb",
36
36
  $$css: true
37
37
  }
38
38
  };
@@ -26,7 +26,7 @@ declare const styles: {
26
26
  readonly opacity: import("@stylexjs/stylex").StyleXClassNameFor<"opacity", 0>;
27
27
  }>;
28
28
  readonly elevation: Readonly<{
29
- readonly boxShadow: import("@stylexjs/stylex").StyleXClassNameFor<"boxShadow", string>;
29
+ readonly filter: import("@stylexjs/stylex").StyleXClassNameFor<"filter", "drop-shadow(0 3px 3px var(--color-shadow-opacity-20))\n drop-shadow(0 3px 4px var(--color-shadow-opacity-16))\n drop-shadow(0 1px 8px var(--color-shadow-opacity-12))">;
30
30
  }>;
31
31
  }>;
32
32
  arrow: Readonly<{
@@ -28,7 +28,7 @@ var dropdown = {
28
28
  $$css: true
29
29
  },
30
30
  elevation: {
31
- kGVxlE: "musaex-16g3oyh",
31
+ ku685b: "musaex-qmh4cb",
32
32
  $$css: true
33
33
  }
34
34
  };
package/dist/styles.css CHANGED
@@ -1044,6 +1044,10 @@
1044
1044
  fill: none;
1045
1045
  }
1046
1046
 
1047
+ .musaex-qmh4cb {
1048
+ filter: drop-shadow(0 3px 3px var(--color-shadow-opacity-20)) drop-shadow(0 3px 4px var(--color-shadow-opacity-16)) drop-shadow(0 1px 8px var(--color-shadow-opacity-12));
1049
+ }
1050
+
1047
1051
  .musaex-1t1x2f9 {
1048
1052
  flex-basis: 0%;
1049
1053
  }
@@ -164,6 +164,11 @@ interface FormItemProps<T extends FieldsValue, FieldKey extends keyof T> {
164
164
  * supporting
165
165
  */
166
166
  supporting?: ReactNode;
167
+ /**
168
+ * @zh 自定义错误消息的渲染方式
169
+ * @en Customize how the error message is rendered
170
+ */
171
+ error?: false | ((error: ReactNode) => ReactNode);
167
172
  /**
168
173
  * label
169
174
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musae",
3
- "version": "1.3.1-beta.17",
3
+ "version": "1.3.1-beta.19",
4
4
  "description": "musae-ui",
5
5
  "author": "tutu@fantufantu.com",
6
6
  "license": "MIT",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@aiszlab/fuzzy": "^2.1.1",
54
- "@aiszlab/relax": "2.1.3-beta.10",
54
+ "@aiszlab/relax": "2.1.3-beta.13",
55
55
  "@babel/runtime": "^7.28.6",
56
56
  "@floating-ui/dom": "^1.7.5",
57
57
  "@lexical/code": "^0.40.0",