antd-mobile 5.8.1 → 5.9.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 (98) hide show
  1. package/2x/cjs/components/button/button.d.ts +18 -2
  2. package/2x/cjs/components/button/button.js +15 -5
  3. package/2x/cjs/components/button/index.d.ts +1 -1
  4. package/2x/cjs/components/form/context.d.ts +1 -0
  5. package/2x/cjs/components/form/context.js +1 -0
  6. package/2x/cjs/components/form/form-item.js +6 -4
  7. package/2x/cjs/components/form/form.js +1 -0
  8. package/2x/cjs/components/image-uploader/image-uploader.js +2 -1
  9. package/2x/cjs/components/picker/picker-utils.d.ts +2 -0
  10. package/2x/cjs/components/picker/picker-utils.js +10 -0
  11. package/2x/cjs/components/picker/picker.d.ts +1 -0
  12. package/2x/cjs/components/picker/picker.js +5 -1
  13. package/2x/cjs/components/picker-view/picker-view.d.ts +2 -1
  14. package/2x/cjs/components/picker-view/picker-view.js +6 -2
  15. package/2x/cjs/components/picker-view/wheel.d.ts +4 -3
  16. package/2x/cjs/components/picker-view/wheel.js +3 -2
  17. package/2x/cjs/components/popover/popover.js +0 -1
  18. package/2x/cjs/components/swipe-action/swipe-action.d.ts +3 -0
  19. package/2x/cjs/components/swipe-action/swipe-action.js +8 -5
  20. package/2x/cjs/locales/es-ES.d.ts +102 -0
  21. package/2x/cjs/locales/es-ES.js +115 -0
  22. package/2x/cjs/utils/measure-css-length.d.ts +1 -1
  23. package/2x/cjs/utils/measure-css-length.js +8 -0
  24. package/2x/es/components/button/button.d.ts +18 -2
  25. package/2x/es/components/button/button.js +11 -3
  26. package/2x/es/components/button/index.d.ts +1 -1
  27. package/2x/es/components/form/context.d.ts +1 -0
  28. package/2x/es/components/form/context.js +1 -0
  29. package/2x/es/components/form/form-item.js +6 -2
  30. package/2x/es/components/form/form.js +1 -0
  31. package/2x/es/components/image-uploader/image-uploader.js +2 -1
  32. package/2x/es/components/picker/picker-utils.d.ts +2 -0
  33. package/2x/es/components/picker/picker-utils.js +1 -0
  34. package/2x/es/components/picker/picker.d.ts +1 -0
  35. package/2x/es/components/picker/picker.js +4 -1
  36. package/2x/es/components/picker-view/picker-view.d.ts +2 -1
  37. package/2x/es/components/picker-view/picker-view.js +5 -2
  38. package/2x/es/components/picker-view/wheel.d.ts +4 -3
  39. package/2x/es/components/picker-view/wheel.js +3 -2
  40. package/2x/es/components/popover/popover.js +0 -1
  41. package/2x/es/components/swipe-action/swipe-action.d.ts +3 -0
  42. package/2x/es/components/swipe-action/swipe-action.js +7 -5
  43. package/2x/es/locales/es-ES.d.ts +102 -0
  44. package/2x/es/locales/es-ES.js +105 -0
  45. package/2x/es/utils/measure-css-length.d.ts +1 -1
  46. package/2x/es/utils/measure-css-length.js +8 -0
  47. package/2x/package.json +21 -2
  48. package/bundle/antd-mobile.cjs.js +17909 -0
  49. package/bundle/antd-mobile.es.js +17823 -0
  50. package/bundle/style.css +3930 -0
  51. package/cjs/components/button/button.d.ts +18 -2
  52. package/cjs/components/button/button.js +15 -5
  53. package/cjs/components/button/index.d.ts +1 -1
  54. package/cjs/components/form/context.d.ts +1 -0
  55. package/cjs/components/form/context.js +1 -0
  56. package/cjs/components/form/form-item.js +6 -4
  57. package/cjs/components/form/form.js +1 -0
  58. package/cjs/components/image-uploader/image-uploader.js +2 -1
  59. package/cjs/components/picker/picker-utils.d.ts +2 -0
  60. package/cjs/components/picker/picker-utils.js +10 -0
  61. package/cjs/components/picker/picker.d.ts +1 -0
  62. package/cjs/components/picker/picker.js +5 -1
  63. package/cjs/components/picker-view/picker-view.d.ts +2 -1
  64. package/cjs/components/picker-view/picker-view.js +6 -2
  65. package/cjs/components/picker-view/wheel.d.ts +4 -3
  66. package/cjs/components/picker-view/wheel.js +3 -2
  67. package/cjs/components/popover/popover.js +0 -1
  68. package/cjs/components/swipe-action/swipe-action.d.ts +3 -0
  69. package/cjs/components/swipe-action/swipe-action.js +8 -5
  70. package/cjs/locales/es-ES.d.ts +102 -0
  71. package/cjs/locales/es-ES.js +115 -0
  72. package/cjs/utils/measure-css-length.d.ts +1 -1
  73. package/cjs/utils/measure-css-length.js +8 -0
  74. package/es/components/button/button.d.ts +18 -2
  75. package/es/components/button/button.js +11 -3
  76. package/es/components/button/index.d.ts +1 -1
  77. package/es/components/form/context.d.ts +1 -0
  78. package/es/components/form/context.js +1 -0
  79. package/es/components/form/form-item.js +6 -2
  80. package/es/components/form/form.js +1 -0
  81. package/es/components/image-uploader/image-uploader.js +2 -1
  82. package/es/components/picker/picker-utils.d.ts +2 -0
  83. package/es/components/picker/picker-utils.js +1 -0
  84. package/es/components/picker/picker.d.ts +1 -0
  85. package/es/components/picker/picker.js +4 -1
  86. package/es/components/picker-view/picker-view.d.ts +2 -1
  87. package/es/components/picker-view/picker-view.js +5 -2
  88. package/es/components/picker-view/wheel.d.ts +4 -3
  89. package/es/components/picker-view/wheel.js +3 -2
  90. package/es/components/popover/popover.js +0 -1
  91. package/es/components/swipe-action/swipe-action.d.ts +3 -0
  92. package/es/components/swipe-action/swipe-action.js +7 -5
  93. package/es/locales/es-ES.d.ts +102 -0
  94. package/es/locales/es-ES.js +105 -0
  95. package/es/utils/measure-css-length.d.ts +1 -1
  96. package/es/utils/measure-css-length.js +8 -0
  97. package/package.json +21 -2
  98. package/umd/antd-mobile.js +1 -1
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { FormLayout } from '.';
3
3
  import type { Meta, InternalNamePath } from 'rc-field-form/lib/interface';
4
4
  export declare type FormContextType = {
5
+ name?: string;
5
6
  hasFeedback: boolean;
6
7
  layout: FormLayout;
7
8
  requiredMarkStyle: 'asterisk' | 'text-required' | 'text-optional';
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  export const defaultFormContext = {
3
+ name: undefined,
3
4
  hasFeedback: true,
4
5
  layout: 'vertical',
5
6
  requiredMarkStyle: 'asterisk'
@@ -136,9 +136,12 @@ export const FormItem = props => {
136
136
  } = props,
137
137
  fieldProps = __rest(props, ["className", "style", "label", "help", "extra", "hasFeedback", "name", "required", "noStyle", "hidden", "layout", "childElementPosition", "description", "disabled", "rules", "children", "messageVariables", "trigger", "validateTrigger", "onClick", "shouldUpdate", "dependencies", "clickable", "arrow"]);
138
138
 
139
+ const {
140
+ name: formName
141
+ } = useContext(FormContext);
139
142
  const {
140
143
  validateTrigger: contextValidateTrigger
141
- } = React.useContext(FieldContext);
144
+ } = useContext(FieldContext);
142
145
  const mergedValidateTrigger = validateTrigger !== undefined ? validateTrigger : contextValidateTrigger;
143
146
  const updateRef = React.useRef(0);
144
147
  updateRef.current += 1;
@@ -250,7 +253,8 @@ export const FormItem = props => {
250
253
  }), (control, meta, context) => {
251
254
  let childNode = null;
252
255
  const isRequired = required !== undefined ? required : rules && rules.some(rule => !!(rule && typeof rule === 'object' && rule.required));
253
- const fieldId = (toArray(name).length && meta ? meta.name : []).join('_');
256
+ const nameList = toArray(name).length && meta ? meta.name : [];
257
+ const fieldId = (nameList.length > 0 && formName ? [formName, ...nameList] : nameList).join('_');
254
258
 
255
259
  if (shouldUpdate && dependencies) {
256
260
  devWarning('Form.Item', "`shouldUpdate` and `dependencies` shouldn't be used together.");
@@ -72,6 +72,7 @@ export const Form = forwardRef((p, ref) => {
72
72
  validateMessages: validateMessages
73
73
  }), React.createElement(FormContext.Provider, {
74
74
  value: {
75
+ name: formProps.name,
75
76
  hasFeedback,
76
77
  layout,
77
78
  requiredMarkStyle
@@ -148,7 +148,8 @@ export const ImageUploader = p => {
148
148
  className: classPrefix
149
149
  }, React.createElement(Space, {
150
150
  className: `${classPrefix}-space`,
151
- wrap: true
151
+ wrap: true,
152
+ block: true
152
153
  }, value.map((fileItem, index) => {
153
154
  var _a, _b;
154
155
 
@@ -0,0 +1,2 @@
1
+ import { PickerColumnItem } from '../picker-view';
2
+ export declare const defaultRenderLabel: (item: PickerColumnItem) => import("react").ReactNode;
@@ -0,0 +1 @@
1
+ export const defaultRenderLabel = item => item.label;
@@ -16,5 +16,6 @@ export declare type PickerProps = {
16
16
  confirmText?: ReactNode;
17
17
  cancelText?: ReactNode;
18
18
  children?: (items: (PickerColumnItem | null)[]) => ReactNode;
19
+ renderLabel?: (item: PickerColumnItem) => ReactNode;
19
20
  } & Pick<PopupProps, 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'stopPropagation'> & NativeProps<'--header-button-font-size' | '--title-font-size' | '--item-font-size' | '--item-height'>;
20
21
  export declare const Picker: React.NamedExoticComponent<PickerProps>;
@@ -8,10 +8,12 @@ import { generateColumnsExtend, useColumnsExtend } from '../picker-view/columns-
8
8
  import { useConfig } from '../config-provider';
9
9
  import { useMemoizedFn } from 'ahooks';
10
10
  import SafeArea from '../safe-area';
11
+ import { defaultRenderLabel } from './picker-utils';
11
12
  const classPrefix = `adm-picker`;
12
13
  const defaultProps = {
13
14
  defaultValue: [],
14
- closeOnMaskClick: true
15
+ closeOnMaskClick: true,
16
+ renderLabel: defaultRenderLabel
15
17
  };
16
18
  export const Picker = memo(p => {
17
19
  var _a;
@@ -78,6 +80,7 @@ export const Picker = memo(p => {
78
80
  className: `${classPrefix}-body`
79
81
  }, React.createElement(PickerView, {
80
82
  columns: props.columns,
83
+ renderLabel: props.renderLabel,
81
84
  value: innerValue,
82
85
  onChange: onChange
83
86
  }))));
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
+ import { PickerProps } from '../picker';
3
4
  export declare type PickerValue = string | null;
4
5
  export declare type PickerValueExtend = {
5
6
  columns: PickerColumnItem[][];
@@ -15,5 +16,5 @@ export declare type PickerViewProps = {
15
16
  value?: PickerValue[];
16
17
  defaultValue?: PickerValue[];
17
18
  onChange?: (value: PickerValue[], extend: PickerValueExtend) => void;
18
- } & NativeProps<'--height' | '--item-height' | '--item-font-size'>;
19
+ } & Pick<PickerProps, 'renderLabel'> & NativeProps<'--height' | '--item-height' | '--item-font-size'>;
19
20
  export declare const PickerView: React.NamedExoticComponent<PickerViewProps>;
@@ -4,9 +4,11 @@ import { Wheel } from './wheel';
4
4
  import { useColumnsExtend } from './columns-extend';
5
5
  import { withNativeProps } from '../../utils/native-props';
6
6
  import { useDebounceEffect } from 'ahooks';
7
+ import { defaultRenderLabel } from '../picker/picker-utils';
7
8
  const classPrefix = `adm-picker-view`;
8
9
  const defaultProps = {
9
- defaultValue: []
10
+ defaultValue: [],
11
+ renderLabel: defaultRenderLabel
10
12
  };
11
13
  export const PickerView = memo(p => {
12
14
  const props = mergeProps(defaultProps, p);
@@ -55,7 +57,8 @@ export const PickerView = memo(p => {
55
57
  index: index,
56
58
  column: column,
57
59
  value: innerValue[index],
58
- onSelect: handleSelect
60
+ onSelect: handleSelect,
61
+ renderLabel: props.renderLabel
59
62
  })), React.createElement("div", {
60
63
  className: `${classPrefix}-mask`
61
64
  }, React.createElement("div", {
@@ -1,10 +1,11 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { PickerColumnItem, PickerValue } from './index';
3
- interface Props {
3
+ declare type Props = {
4
4
  index: number;
5
5
  column: PickerColumnItem[];
6
6
  value: PickerValue;
7
7
  onSelect: (value: PickerValue, index: number) => void;
8
- }
8
+ renderLabel: (item: PickerColumnItem) => ReactNode;
9
+ };
9
10
  export declare const Wheel: React.NamedExoticComponent<Props>;
10
11
  export {};
@@ -10,7 +10,8 @@ const classPrefix = `adm-picker-view`;
10
10
  export const Wheel = memo(props => {
11
11
  const {
12
12
  value,
13
- column
13
+ column,
14
+ renderLabel
14
15
  } = props;
15
16
 
16
17
  function onSelect(val) {
@@ -156,7 +157,7 @@ export const Wheel = memo(props => {
156
157
  "aria-label": selected ? 'active' : ''
157
158
  }, React.createElement("div", {
158
159
  className: `${classPrefix}-column-item-label`
159
- }, item.label));
160
+ }, renderLabel(item)));
160
161
  })), renderAccessible());
161
162
  }, (prev, next) => {
162
163
  if (prev.index !== next.index) return false;
@@ -121,7 +121,6 @@ export const Popover = forwardRef((p, ref) => {
121
121
  if (!props.trigger) return;
122
122
 
123
123
  function handleClick() {
124
- console.log('handleClick');
125
124
  setVisible(v => !v);
126
125
  }
127
126
 
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
+ import { PropagationEvent } from '../../utils/with-stop-propagation';
3
4
  export declare type SwipeActionRef = {
4
5
  close: () => void;
5
6
  show: (side?: 'left' | 'right') => void;
@@ -18,6 +19,7 @@ export declare type SwipeActionProps = {
18
19
  closeOnTouchOutside?: boolean;
19
20
  closeOnAction?: boolean;
20
21
  children: ReactNode;
22
+ stopPropagation?: PropagationEvent[];
21
23
  } & NativeProps<'--background'>;
22
24
  export declare const SwipeAction: React.ForwardRefExoticComponent<{
23
25
  rightActions?: Action[] | undefined;
@@ -26,5 +28,6 @@ export declare const SwipeAction: React.ForwardRefExoticComponent<{
26
28
  closeOnTouchOutside?: boolean | undefined;
27
29
  closeOnAction?: boolean | undefined;
28
30
  children: ReactNode;
31
+ stopPropagation?: "click"[] | undefined;
29
32
  } & NativeProps<"--background"> & React.RefAttributes<SwipeActionRef>>;
30
33
  export {};
@@ -5,11 +5,13 @@ import { useDrag } from '@use-gesture/react';
5
5
  import Button from '../button';
6
6
  import { nearest } from '../../utils/nearest';
7
7
  import { withNativeProps } from '../../utils/native-props';
8
+ import { withStopPropagation } from '../../utils/with-stop-propagation';
8
9
  const defaultProps = {
9
10
  rightActions: [],
10
11
  leftActions: [],
11
12
  closeOnTouchOutside: true,
12
- closeOnAction: true
13
+ closeOnAction: true,
14
+ stopPropagation: []
13
15
  };
14
16
  export const SwipeAction = forwardRef((p, ref) => {
15
17
  const props = mergeProps(defaultProps, p);
@@ -167,10 +169,10 @@ export const SwipeAction = forwardRef((p, ref) => {
167
169
  style: {
168
170
  x
169
171
  }
170
- }, React.createElement("div", {
172
+ }, withStopPropagation(props.stopPropagation, React.createElement("div", {
171
173
  className: 'adm-swipe-action-actions adm-swipe-action-actions-left',
172
174
  ref: leftRef
173
- }, props.leftActions.map(renderAction)), React.createElement("div", {
175
+ }, props.leftActions.map(renderAction))), React.createElement("div", {
174
176
  className: 'adm-swipe-action-content',
175
177
  onClickCapture: e => {
176
178
  if (x.goal !== 0) {
@@ -185,10 +187,10 @@ export const SwipeAction = forwardRef((p, ref) => {
185
187
  style: {
186
188
  pointerEvents: x.to(v => v !== 0 && x.goal !== 0 ? 'none' : 'unset')
187
189
  }
188
- }, props.children)), React.createElement("div", {
190
+ }, props.children)), withStopPropagation(props.stopPropagation, React.createElement("div", {
189
191
  className: 'adm-swipe-action-actions adm-swipe-action-actions-right',
190
192
  ref: rightRef
191
- }, props.rightActions.map(renderAction)))));
193
+ }, props.rightActions.map(renderAction))))));
192
194
  });
193
195
  const colorRecord = {
194
196
  light: 'var(--adm-color-light)',
@@ -0,0 +1,102 @@
1
+ declare const esES: {
2
+ locale: string;
3
+ common: {
4
+ confirm: string;
5
+ cancel: string;
6
+ loading: string;
7
+ };
8
+ Calendar: {
9
+ markItems: string[];
10
+ renderYearAndMonth: (year: number, month: number) => string;
11
+ };
12
+ Cascader: {
13
+ placeholder: string;
14
+ };
15
+ Dialog: {
16
+ ok: string;
17
+ };
18
+ ErrorBlock: {
19
+ default: {
20
+ title: string;
21
+ description: string;
22
+ };
23
+ busy: {
24
+ title: string;
25
+ description: string;
26
+ };
27
+ disconnected: {
28
+ title: string;
29
+ description: string;
30
+ };
31
+ empty: {
32
+ title: string;
33
+ description: string;
34
+ };
35
+ };
36
+ Form: {
37
+ required: string;
38
+ optional: string;
39
+ defaultValidateMessages: {
40
+ default: string;
41
+ required: string;
42
+ enum: string;
43
+ whitespace: string;
44
+ date: {
45
+ format: string;
46
+ parse: string;
47
+ invalid: string;
48
+ };
49
+ types: {
50
+ string: string;
51
+ method: string;
52
+ array: string;
53
+ object: string;
54
+ number: string;
55
+ date: string;
56
+ boolean: string;
57
+ integer: string;
58
+ float: string;
59
+ regexp: string;
60
+ email: string;
61
+ url: string;
62
+ hex: string;
63
+ };
64
+ string: {
65
+ len: string;
66
+ min: string;
67
+ max: string;
68
+ range: string;
69
+ };
70
+ number: {
71
+ len: string;
72
+ min: string;
73
+ max: string;
74
+ range: string;
75
+ };
76
+ array: {
77
+ len: string;
78
+ min: string;
79
+ max: string;
80
+ range: string;
81
+ };
82
+ pattern: {
83
+ mismatch: string;
84
+ };
85
+ };
86
+ };
87
+ ImageUploader: {
88
+ uploading: string;
89
+ };
90
+ Mask: {
91
+ name: string;
92
+ };
93
+ Modal: {
94
+ ok: string;
95
+ };
96
+ PullToRefresh: {
97
+ pulling: string;
98
+ canRelease: string;
99
+ complete: string;
100
+ };
101
+ };
102
+ export default esES;
@@ -0,0 +1,105 @@
1
+ import { mergeLocale } from '../utils/merge-locale';
2
+ import { base } from './base';
3
+ const typeTemplate = '${label} no es un ${type} válido';
4
+ const esES = mergeLocale(base, {
5
+ locale: 'es',
6
+ common: {
7
+ confirm: 'Confirmar',
8
+ cancel: 'Cancelar',
9
+ loading: 'Cargando...'
10
+ },
11
+ Calendar: {
12
+ markItems: ['Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab', 'Dom'],
13
+ renderYearAndMonth: (year, month) => `${year}/${month}`
14
+ },
15
+ Cascader: {
16
+ placeholder: 'Seleccionando'
17
+ },
18
+ Dialog: {
19
+ ok: 'OK'
20
+ },
21
+ ErrorBlock: {
22
+ default: {
23
+ title: 'Oops, algo salió mal',
24
+ description: 'Por favor espere un minuto e intente nuevamente'
25
+ },
26
+ busy: {
27
+ title: 'Oops, no está cargando',
28
+ description: 'Intente refrescar la página'
29
+ },
30
+ disconnected: {
31
+ title: 'La red se encuentra ocupada',
32
+ description: 'Intente refrescar la página'
33
+ },
34
+ empty: {
35
+ title: 'Hmm, no pudimos encontrar eso...',
36
+ description: 'Quieres intentar una nueva búsqueda?'
37
+ }
38
+ },
39
+ Form: {
40
+ required: 'Requerido',
41
+ optional: 'Opcional',
42
+ defaultValidateMessages: {
43
+ default: 'Error de validación para el campo ${label}',
44
+ required: 'Por favor ingrese ${label}',
45
+ enum: '${label} debe ser uno de los siguientes [${enum}]',
46
+ whitespace: '${label} no puede ser un caracter en blanco',
47
+ date: {
48
+ format: '${label} el formato de fecha es inválido',
49
+ parse: '${label} no puede ser convertido a fecha',
50
+ invalid: '${label} no es una fecha válida'
51
+ },
52
+ types: {
53
+ string: typeTemplate,
54
+ method: typeTemplate,
55
+ array: typeTemplate,
56
+ object: typeTemplate,
57
+ number: typeTemplate,
58
+ date: typeTemplate,
59
+ boolean: typeTemplate,
60
+ integer: typeTemplate,
61
+ float: typeTemplate,
62
+ regexp: typeTemplate,
63
+ email: typeTemplate,
64
+ url: typeTemplate,
65
+ hex: typeTemplate
66
+ },
67
+ string: {
68
+ len: '${label} debe tener ${len} caracteres',
69
+ min: '${label} debe tener al menos ${min} caracteres',
70
+ max: '${label} debe tener como mucho ${max} caracteres',
71
+ range: '${label} debe tener entre ${min}-${max} caracteres'
72
+ },
73
+ number: {
74
+ len: '${label} debe ser igual a ${len}',
75
+ min: '${label} debe ser mínimo ${min}',
76
+ max: '${label} debe ser máximo ${max}',
77
+ range: '${label} debe ser entre ${min}-${max}'
78
+ },
79
+ array: {
80
+ len: 'Debe ser ${len} ${label}',
81
+ min: 'Al menos ${min} ${label}',
82
+ max: 'Como mucho ${max} ${label}',
83
+ range: 'La cantidad de ${label} debe ser entre ${min}-${max}'
84
+ },
85
+ pattern: {
86
+ mismatch: '${label} no coincide con el patrón ${pattern}'
87
+ }
88
+ }
89
+ },
90
+ ImageUploader: {
91
+ uploading: 'Subiendo...'
92
+ },
93
+ Mask: {
94
+ name: 'Máscara'
95
+ },
96
+ Modal: {
97
+ ok: 'OK'
98
+ },
99
+ PullToRefresh: {
100
+ pulling: 'Desplácese hacia abajo para refrescar',
101
+ canRelease: 'Suelte para refrescar inmediatamente',
102
+ complete: 'Refrescó exitosamente'
103
+ }
104
+ });
105
+ export default esES;
@@ -1 +1 @@
1
- export declare function measureCSSLength(raw: string): number;
1
+ export declare function measureCSSLength(raw: string | undefined | null): number;
@@ -1,6 +1,14 @@
1
1
  import { isDev } from './is-dev';
2
2
  import { devError } from './dev-log';
3
3
  export function measureCSSLength(raw) {
4
+ if (raw === null || raw === undefined) {
5
+ if (isDev) {
6
+ devError('Global', 'Seems like the you will encounter a style messed problem. Please check the browser environment to make sure it supports CSS variables.');
7
+ }
8
+
9
+ return 0;
10
+ }
11
+
4
12
  const withUnit = raw.trim();
5
13
 
6
14
  if (withUnit.endsWith('px')) {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.8.1",
3
+ "version": "5.9.1",
4
4
  "dependencies": {
5
- "@floating-ui/dom": "^0.4.1",
5
+ "@floating-ui/dom": "^0.4.2",
6
6
  "@react-spring/web": "^9.4.4",
7
7
  "@types/resize-observer-browser": "^0.1.7",
8
8
  "@use-gesture/react": "^10.2.10",
@@ -25,6 +25,25 @@
25
25
  "typings": "./es/index.d.ts",
26
26
  "unpkg": "./umd/antd-mobile.js",
27
27
  "GravityCDN": "./umd/antd-mobile.js",
28
+ "exports": {
29
+ ".": {
30
+ "node": {
31
+ "import": "./bundle/antd-mobile.es.js",
32
+ "require": "./bundle/antd-mobile.cjs.js"
33
+ },
34
+ "import": "./es/index.js",
35
+ "require": "./cjs/index.js",
36
+ "types": "./es/index.d.ts"
37
+ },
38
+ "./es": "./es/index.js",
39
+ "./cjs": "./cjs/index.js",
40
+ "./es/": "./es/",
41
+ "./cjs/": "./cjs/",
42
+ "./bundle/": "./bundle/",
43
+ "./package.json": "./package.json",
44
+ "./package": "./package.json",
45
+ "./2x": "./2x"
46
+ },
28
47
  "sideEffects": [
29
48
  "**/*.css",
30
49
  "**/*.less",