musae 1.3.1-beta.15 → 1.3.1-beta.16
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.
- package/dist/components/input/input.cjs +13 -10
- package/dist/components/input/input.mjs +13 -10
- package/dist/components/select/select.cjs +2 -0
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.mjs +2 -0
- package/dist/components/select/selector.cjs +2 -0
- package/dist/components/select/selector.d.ts +1 -1
- package/dist/components/select/selector.mjs +2 -0
- package/dist/types/select.d.ts +2 -2
- package/package.json +1 -1
|
@@ -18,7 +18,8 @@ var context = require('./context.cjs');
|
|
|
18
18
|
var theme = require('../theme/theme.cjs');
|
|
19
19
|
var useThemeColorVars = require('../../hooks/use-theme-color-vars.cjs');
|
|
20
20
|
|
|
21
|
-
var _excluded = ["className", "style", "type", "variant", "shaped", "invalid", "disabled", "maxLength", "value", "onBlur", "onChange", "onClick", "onFocus", "leading", "trailing", "label", "inputClassName"]
|
|
21
|
+
var _excluded = ["className", "style", "type", "variant", "shaped", "invalid", "disabled", "maxLength", "value", "onBlur", "onChange", "onClick", "onFocus", "leading", "trailing", "label", "inputClassName"],
|
|
22
|
+
_excluded2 = ["click"];
|
|
22
23
|
/**
|
|
23
24
|
* @author murukal
|
|
24
25
|
* @zh 输入组件
|
|
@@ -87,13 +88,15 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
87
88
|
};
|
|
88
89
|
}, []);
|
|
89
90
|
// input events
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
var _useInputEvents = hooks.useInputEvents({
|
|
92
|
+
setValue: _setValue,
|
|
93
|
+
onBlur: onBlur,
|
|
94
|
+
onChange: onChange,
|
|
95
|
+
onClick: onClick,
|
|
96
|
+
onFocus: onFocus
|
|
97
|
+
}),
|
|
98
|
+
click = _useInputEvents.click,
|
|
99
|
+
inputEvents = _objectWithoutProperties(_useInputEvents, _excluded2);
|
|
97
100
|
// is focused
|
|
98
101
|
var _useFocus = relax.useFocus({
|
|
99
102
|
onBlur: inputEvents.blur,
|
|
@@ -125,7 +128,8 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
125
128
|
var _inputRef$current5;
|
|
126
129
|
(_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 || _inputRef$current5.focus();
|
|
127
130
|
}
|
|
128
|
-
}
|
|
131
|
+
},
|
|
132
|
+
onClick: click
|
|
129
133
|
}), !!leading && (/*#__PURE__*/React.createElement("div", {
|
|
130
134
|
className: className.stringify(classNames.leading, styled.leading.className),
|
|
131
135
|
style: styled.leading.style
|
|
@@ -139,7 +143,6 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
139
143
|
"aria-invalid": invalid,
|
|
140
144
|
disabled: disabled,
|
|
141
145
|
onChange: inputEvents.change,
|
|
142
|
-
onClick: inputEvents.click,
|
|
143
146
|
maxLength: maxLength
|
|
144
147
|
}, inputProps), focusProps)), /*#__PURE__*/React.createElement("div", {
|
|
145
148
|
className: className.stringify(classNames.outline, styled.outline.className),
|
|
@@ -14,7 +14,8 @@ import { CLASS_NAMES } from './context.mjs';
|
|
|
14
14
|
import { $body } from '../theme/theme.mjs';
|
|
15
15
|
import { useThemeColorVars } from '../../hooks/use-theme-color-vars.mjs';
|
|
16
16
|
|
|
17
|
-
var _excluded = ["className", "style", "type", "variant", "shaped", "invalid", "disabled", "maxLength", "value", "onBlur", "onChange", "onClick", "onFocus", "leading", "trailing", "label", "inputClassName"]
|
|
17
|
+
var _excluded = ["className", "style", "type", "variant", "shaped", "invalid", "disabled", "maxLength", "value", "onBlur", "onChange", "onClick", "onFocus", "leading", "trailing", "label", "inputClassName"],
|
|
18
|
+
_excluded2 = ["click"];
|
|
18
19
|
/**
|
|
19
20
|
* @author murukal
|
|
20
21
|
* @zh 输入组件
|
|
@@ -83,13 +84,15 @@ var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
83
84
|
};
|
|
84
85
|
}, []);
|
|
85
86
|
// input events
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
var _useInputEvents = useInputEvents({
|
|
88
|
+
setValue: _setValue,
|
|
89
|
+
onBlur: onBlur,
|
|
90
|
+
onChange: onChange,
|
|
91
|
+
onClick: onClick,
|
|
92
|
+
onFocus: onFocus
|
|
93
|
+
}),
|
|
94
|
+
click = _useInputEvents.click,
|
|
95
|
+
inputEvents = _objectWithoutProperties(_useInputEvents, _excluded2);
|
|
93
96
|
// is focused
|
|
94
97
|
var _useFocus = useFocus({
|
|
95
98
|
onBlur: inputEvents.blur,
|
|
@@ -121,7 +124,8 @@ var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
121
124
|
var _inputRef$current5;
|
|
122
125
|
(_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 || _inputRef$current5.focus();
|
|
123
126
|
}
|
|
124
|
-
}
|
|
127
|
+
},
|
|
128
|
+
onClick: click
|
|
125
129
|
}), !!leading && (/*#__PURE__*/React.createElement("div", {
|
|
126
130
|
className: stringify(classNames.leading, styled.leading.className),
|
|
127
131
|
style: styled.leading.style
|
|
@@ -135,7 +139,6 @@ var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
135
139
|
"aria-invalid": invalid,
|
|
136
140
|
disabled: disabled,
|
|
137
141
|
onChange: inputEvents.change,
|
|
138
|
-
onClick: inputEvents.click,
|
|
139
142
|
maxLength: maxLength
|
|
140
143
|
}, inputProps), focusProps)), /*#__PURE__*/React.createElement("div", {
|
|
141
144
|
className: stringify(classNames.outline, styled.outline.className),
|
|
@@ -30,6 +30,7 @@ var Select = function Select(_ref) {
|
|
|
30
30
|
value = _ref.value,
|
|
31
31
|
onChange = _ref.onChange,
|
|
32
32
|
onBlur = _ref.onBlur,
|
|
33
|
+
label = _ref.label,
|
|
33
34
|
_ref$invalid = _ref.invalid,
|
|
34
35
|
invalid = _ref$invalid === void 0 ? false : _ref$invalid,
|
|
35
36
|
placeholder = _ref.placeholder,
|
|
@@ -111,6 +112,7 @@ var Select = function Select(_ref) {
|
|
|
111
112
|
onOpen: open,
|
|
112
113
|
onClear: onClear ? clear : void 0,
|
|
113
114
|
placeholder: placeholder,
|
|
115
|
+
label: label,
|
|
114
116
|
disabled: disabled,
|
|
115
117
|
invalid: invalid,
|
|
116
118
|
onClick: function onClick() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SelectProps, ValueOrValues } from "../../types/select";
|
|
3
|
-
declare const Select: <T extends ValueOrValues = ValueOrValues>({ mode, searchable: _searchable, onSearch, className, style, options, onFilter, complex, value, onChange, onBlur, invalid, placeholder, onClear, disabled, }: SelectProps<T>) => React.JSX.Element;
|
|
3
|
+
declare const Select: <T extends ValueOrValues = ValueOrValues>({ mode, searchable: _searchable, onSearch, className, style, options, onFilter, complex, value, onChange, onBlur, label, invalid, placeholder, onClear, disabled, }: SelectProps<T>) => React.JSX.Element;
|
|
4
4
|
export default Select;
|
|
@@ -26,6 +26,7 @@ var Select = function Select(_ref) {
|
|
|
26
26
|
value = _ref.value,
|
|
27
27
|
onChange = _ref.onChange,
|
|
28
28
|
onBlur = _ref.onBlur,
|
|
29
|
+
label = _ref.label,
|
|
29
30
|
_ref$invalid = _ref.invalid,
|
|
30
31
|
invalid = _ref$invalid === void 0 ? false : _ref$invalid,
|
|
31
32
|
placeholder = _ref.placeholder,
|
|
@@ -107,6 +108,7 @@ var Select = function Select(_ref) {
|
|
|
107
108
|
onOpen: open,
|
|
108
109
|
onClear: onClear ? clear : void 0,
|
|
109
110
|
placeholder: placeholder,
|
|
111
|
+
label: label,
|
|
110
112
|
disabled: disabled,
|
|
111
113
|
invalid: invalid,
|
|
112
114
|
onClick: function onClick() {
|
|
@@ -24,6 +24,7 @@ var Selector = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
24
24
|
onClear = _ref.onClear,
|
|
25
25
|
onClick = _ref.onClick,
|
|
26
26
|
placeholder = _ref.placeholder,
|
|
27
|
+
label = _ref.label,
|
|
27
28
|
_ref$disabled = _ref.disabled,
|
|
28
29
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
29
30
|
_ref$invalid = _ref.invalid,
|
|
@@ -57,6 +58,7 @@ var Selector = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
57
58
|
ref: ref,
|
|
58
59
|
value: searchable ? keyword : multiple ? "" : selectedValue,
|
|
59
60
|
placeholder: searchable && !multiple ? selectedValue || placeholder : placeholder,
|
|
61
|
+
label: label,
|
|
60
62
|
className: styled.input.className,
|
|
61
63
|
style: styled.input.style,
|
|
62
64
|
onChange: searchable ? search : undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { InputRef } from "../../types/input";
|
|
3
|
-
declare const Selector: React.ForwardRefExoticComponent<import("../../types/element").ComponentProps & Pick<import("@aiszlab/relax/types").RequiredIn<import("../../types/select").SelectProps<import("../../types/select").ValueOrValues>, "searchable" | "onSearch">, "mode" | "disabled" | "onBlur" | "onClear" | "invalid" | "placeholder" | "searchable" | "onSearch"> & {
|
|
3
|
+
declare const Selector: React.ForwardRefExoticComponent<import("../../types/element").ComponentProps & Pick<import("@aiszlab/relax/types").RequiredIn<import("../../types/select").SelectProps<import("../../types/select").ValueOrValues>, "searchable" | "onSearch">, "mode" | "disabled" | "label" | "onBlur" | "onClear" | "invalid" | "placeholder" | "searchable" | "onSearch"> & {
|
|
4
4
|
value: Map<React.Key, React.ReactNode>;
|
|
5
5
|
keyword: string;
|
|
6
6
|
onChange: (key: React.Key) => void;
|
|
@@ -20,6 +20,7 @@ var Selector = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
20
20
|
onClear = _ref.onClear,
|
|
21
21
|
onClick = _ref.onClick,
|
|
22
22
|
placeholder = _ref.placeholder,
|
|
23
|
+
label = _ref.label,
|
|
23
24
|
_ref$disabled = _ref.disabled,
|
|
24
25
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
25
26
|
_ref$invalid = _ref.invalid,
|
|
@@ -53,6 +54,7 @@ var Selector = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
53
54
|
ref: ref,
|
|
54
55
|
value: searchable ? keyword : multiple ? "" : selectedValue,
|
|
55
56
|
placeholder: searchable && !multiple ? selectedValue || placeholder : placeholder,
|
|
57
|
+
label: label,
|
|
56
58
|
className: styled.input.className,
|
|
57
59
|
style: styled.input.style,
|
|
58
60
|
onChange: searchable ? search : undefined,
|
package/dist/types/select.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type ValueOrValues = Value[] | Value;
|
|
|
14
14
|
* @description
|
|
15
15
|
* select props
|
|
16
16
|
*/
|
|
17
|
-
export type SelectProps<T extends ValueOrValues = ValueOrValues> = ComponentProps & Pick<InputProps, "onBlur"> & {
|
|
17
|
+
export type SelectProps<T extends ValueOrValues = ValueOrValues> = ComponentProps & Pick<InputProps, "onBlur" | "label"> & {
|
|
18
18
|
/**
|
|
19
19
|
* @description
|
|
20
20
|
* options
|
|
@@ -98,7 +98,7 @@ export type Filter = (option: Option) => boolean;
|
|
|
98
98
|
* @zh 选择器属性
|
|
99
99
|
* @en Selector props
|
|
100
100
|
*/
|
|
101
|
-
export type SelectorProps = ComponentProps & Pick<RequiredIn<SelectProps, "searchable" | "onSearch">, "searchable" | "mode" | "onSearch" | "onBlur" | "placeholder" | "disabled" | "invalid" | "onClear"> & {
|
|
101
|
+
export type SelectorProps = ComponentProps & Pick<RequiredIn<SelectProps, "searchable" | "onSearch">, "searchable" | "mode" | "onSearch" | "onBlur" | "placeholder" | "label" | "disabled" | "invalid" | "onClear"> & {
|
|
102
102
|
/**
|
|
103
103
|
* @zh 已选值
|
|
104
104
|
* @en Selected values
|