musae 1.3.1-beta.12 → 1.3.1-beta.14
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 -5
- package/dist/components/input/input.mjs +13 -5
- package/dist/components/password-input/password-input.cjs +5 -6
- package/dist/components/password-input/password-input.mjs +5 -6
- package/dist/components/password-input/styles.cjs +4 -0
- package/dist/components/password-input/styles.d.ts +5 -0
- package/dist/components/password-input/styles.mjs +4 -0
- package/dist/styles.css +4 -0
- package/dist/types/input.d.ts +5 -0
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ 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"];
|
|
21
|
+
var _excluded = ["className", "style", "type", "variant", "shaped", "invalid", "disabled", "maxLength", "value", "onBlur", "onChange", "onClick", "onFocus", "leading", "trailing", "label", "inputClassName"];
|
|
22
22
|
/**
|
|
23
23
|
* @author murukal
|
|
24
24
|
* @zh 输入组件
|
|
@@ -43,6 +43,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
43
43
|
leading = _ref.leading,
|
|
44
44
|
trailing = _ref.trailing,
|
|
45
45
|
label = _ref.label,
|
|
46
|
+
inputClassName = _ref.inputClassName,
|
|
46
47
|
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
47
48
|
var inputorRef = React.useRef(null);
|
|
48
49
|
var inputRef = React.useRef(null);
|
|
@@ -108,23 +109,30 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
108
109
|
trailing: stylex.props(styles_stylex.default.trailing.base),
|
|
109
110
|
outline: stylex.props(styles_stylex.default.outline.base),
|
|
110
111
|
outlineLeading: stylex.props(styles_stylex.default.outlineLeading.base, disabled && styles_stylex.default.outlineLeading.disabled, invalid && styles_stylex.default.outlineLeading.invalid, shaped && styles_stylex.default.outlineLeading.shaped),
|
|
111
|
-
outlineNotch: stylex.props(styles_stylex.default.outlineNotch.base, theme.$body.small, hasLabel && styles_stylex.default.outlineNotch.withLabel, hasLabel && hasPlaceholder && styles_stylex.default.outlineNotch.withLabelAndPlaceholder, disabled && styles_stylex.default.outlineNotch.disabled, invalid && styles_stylex.default.outlineNotch.invalid),
|
|
112
|
+
outlineNotch: stylex.props(styles_stylex.default.outlineNotch.base, theme.$body.small, hasLabel && styles_stylex.default.outlineNotch.withLabel, hasLabel && (hasPlaceholder || !!_value) && styles_stylex.default.outlineNotch.withLabelAndPlaceholder, disabled && styles_stylex.default.outlineNotch.disabled, invalid && styles_stylex.default.outlineNotch.invalid),
|
|
112
113
|
outlineTrailing: stylex.props(styles_stylex.default.outlineTrailing.base, disabled && styles_stylex.default.outlineTrailing.disabled, invalid && styles_stylex.default.outlineTrailing.invalid, shaped && styles_stylex.default.outlineTrailing.shaped),
|
|
113
|
-
floatingLabel: stylex.props(styles_stylex.default.floatingLabel.base, hasPlaceholder && styles_stylex.default.floatingLabel.placeholder, disabled && styles_stylex.default.floatingLabel.disabled, invalid && styles_stylex.default.floatingLabel.invalid)
|
|
114
|
+
floatingLabel: stylex.props(styles_stylex.default.floatingLabel.base, (hasPlaceholder || !!_value) && styles_stylex.default.floatingLabel.placeholder, disabled && styles_stylex.default.floatingLabel.disabled, invalid && styles_stylex.default.floatingLabel.invalid)
|
|
114
115
|
};
|
|
115
|
-
return /*#__PURE__*/React.createElement("div", _objectSpread({
|
|
116
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({
|
|
116
117
|
ref: inputorRef,
|
|
117
118
|
className: className.stringify(classNames.inputor, _defineProperty(_defineProperty({}, classNames.focused, isFocused), classNames.invalid, !!invalid), className$1, styled.root.className),
|
|
118
119
|
style: _objectSpread(_objectSpread(_objectSpread({}, styled.root.style), style), _themeColorVars)
|
|
119
120
|
}, !disabled && {
|
|
120
121
|
tabIndex: -1
|
|
122
|
+
}), {}, {
|
|
123
|
+
onFocus: function onFocus(event) {
|
|
124
|
+
if (event.target === event.currentTarget) {
|
|
125
|
+
var _inputRef$current5;
|
|
126
|
+
(_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 || _inputRef$current5.focus();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
121
129
|
}), !!leading && (/*#__PURE__*/React.createElement("div", {
|
|
122
130
|
className: className.stringify(classNames.leading, styled.leading.className),
|
|
123
131
|
style: styled.leading.style
|
|
124
132
|
}, leading)), /*#__PURE__*/React.createElement("input", _objectSpread(_objectSpread({
|
|
125
133
|
id: id,
|
|
126
134
|
value: _value,
|
|
127
|
-
className: className.stringify(classNames.input, styled.input.className),
|
|
135
|
+
className: className.stringify(classNames.input, inputClassName, styled.input.className),
|
|
128
136
|
style: styled.input.style,
|
|
129
137
|
type: type,
|
|
130
138
|
ref: inputRef,
|
|
@@ -14,7 +14,7 @@ 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"];
|
|
17
|
+
var _excluded = ["className", "style", "type", "variant", "shaped", "invalid", "disabled", "maxLength", "value", "onBlur", "onChange", "onClick", "onFocus", "leading", "trailing", "label", "inputClassName"];
|
|
18
18
|
/**
|
|
19
19
|
* @author murukal
|
|
20
20
|
* @zh 输入组件
|
|
@@ -39,6 +39,7 @@ var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
39
39
|
leading = _ref.leading,
|
|
40
40
|
trailing = _ref.trailing,
|
|
41
41
|
label = _ref.label,
|
|
42
|
+
inputClassName = _ref.inputClassName,
|
|
42
43
|
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
43
44
|
var inputorRef = useRef(null);
|
|
44
45
|
var inputRef = useRef(null);
|
|
@@ -104,23 +105,30 @@ var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
104
105
|
trailing: props(styles.trailing.base),
|
|
105
106
|
outline: props(styles.outline.base),
|
|
106
107
|
outlineLeading: props(styles.outlineLeading.base, disabled && styles.outlineLeading.disabled, invalid && styles.outlineLeading.invalid, shaped && styles.outlineLeading.shaped),
|
|
107
|
-
outlineNotch: props(styles.outlineNotch.base, $body.small, hasLabel && styles.outlineNotch.withLabel, hasLabel && hasPlaceholder && styles.outlineNotch.withLabelAndPlaceholder, disabled && styles.outlineNotch.disabled, invalid && styles.outlineNotch.invalid),
|
|
108
|
+
outlineNotch: props(styles.outlineNotch.base, $body.small, hasLabel && styles.outlineNotch.withLabel, hasLabel && (hasPlaceholder || !!_value) && styles.outlineNotch.withLabelAndPlaceholder, disabled && styles.outlineNotch.disabled, invalid && styles.outlineNotch.invalid),
|
|
108
109
|
outlineTrailing: props(styles.outlineTrailing.base, disabled && styles.outlineTrailing.disabled, invalid && styles.outlineTrailing.invalid, shaped && styles.outlineTrailing.shaped),
|
|
109
|
-
floatingLabel: props(styles.floatingLabel.base, hasPlaceholder && styles.floatingLabel.placeholder, disabled && styles.floatingLabel.disabled, invalid && styles.floatingLabel.invalid)
|
|
110
|
+
floatingLabel: props(styles.floatingLabel.base, (hasPlaceholder || !!_value) && styles.floatingLabel.placeholder, disabled && styles.floatingLabel.disabled, invalid && styles.floatingLabel.invalid)
|
|
110
111
|
};
|
|
111
|
-
return /*#__PURE__*/React.createElement("div", _objectSpread({
|
|
112
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({
|
|
112
113
|
ref: inputorRef,
|
|
113
114
|
className: stringify(classNames.inputor, _defineProperty(_defineProperty({}, classNames.focused, isFocused), classNames.invalid, !!invalid), className, styled.root.className),
|
|
114
115
|
style: _objectSpread(_objectSpread(_objectSpread({}, styled.root.style), style), _themeColorVars)
|
|
115
116
|
}, !disabled && {
|
|
116
117
|
tabIndex: -1
|
|
118
|
+
}), {}, {
|
|
119
|
+
onFocus: function onFocus(event) {
|
|
120
|
+
if (event.target === event.currentTarget) {
|
|
121
|
+
var _inputRef$current5;
|
|
122
|
+
(_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 || _inputRef$current5.focus();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
117
125
|
}), !!leading && (/*#__PURE__*/React.createElement("div", {
|
|
118
126
|
className: stringify(classNames.leading, styled.leading.className),
|
|
119
127
|
style: styled.leading.style
|
|
120
128
|
}, leading)), /*#__PURE__*/React.createElement("input", _objectSpread(_objectSpread({
|
|
121
129
|
id: id,
|
|
122
130
|
value: _value,
|
|
123
|
-
className: stringify(classNames.input, styled.input.className),
|
|
131
|
+
className: stringify(classNames.input, inputClassName, styled.input.className),
|
|
124
132
|
style: styled.input.style,
|
|
125
133
|
type: type,
|
|
126
134
|
ref: inputRef,
|
|
@@ -9,11 +9,11 @@ var styles = require('./styles.cjs');
|
|
|
9
9
|
var React = require('react');
|
|
10
10
|
var input = require('../input/input.cjs');
|
|
11
11
|
var relax = require('@aiszlab/relax');
|
|
12
|
-
var hooks = require('../theme/hooks.cjs');
|
|
13
12
|
var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
|
|
14
13
|
var context = require('./context.cjs');
|
|
15
14
|
var useClassNames = require('../../hooks/use-class-names.cjs');
|
|
16
15
|
var className = require('@aiszlab/relax/class-name');
|
|
16
|
+
var useThemeColorVars = require('../../hooks/use-theme-color-vars.cjs');
|
|
17
17
|
var visibilityOff = require('../icon/icons/action/visibility-off.cjs');
|
|
18
18
|
var visibility = require('../icon/icons/action/visibility.cjs');
|
|
19
19
|
|
|
@@ -25,19 +25,18 @@ var PasswordInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
25
25
|
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
26
26
|
isVisible = _useBoolean2[0],
|
|
27
27
|
toggle = _useBoolean2[1].toggle;
|
|
28
|
-
var theme = hooks.useTheme();
|
|
29
28
|
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
29
|
+
var themeColorVars = useThemeColorVars.useThemeColorVars(["secondary-fixed-dim", "secondary"]);
|
|
30
30
|
var styled = {
|
|
31
|
+
input: stylex.props(styles.default.input),
|
|
31
32
|
visibility: stylex.props(styles.default.visibility)
|
|
32
33
|
};
|
|
33
34
|
return /*#__PURE__*/React.createElement(input.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
34
35
|
className: className.stringify(classNames.passwordInput, className$1),
|
|
35
|
-
style:
|
|
36
|
-
"--color-secondary-fixed-dim": theme.colors["secondary-fixed-dim"],
|
|
37
|
-
"--color-secondary": theme.colors.secondary
|
|
38
|
-
},
|
|
36
|
+
style: themeColorVars,
|
|
39
37
|
ref: ref,
|
|
40
38
|
type: isVisible ? "text" : "password",
|
|
39
|
+
inputClassName: styled.input.className,
|
|
41
40
|
trailing: /*#__PURE__*/React.createElement(isVisible ? visibilityOff.default : visibility.default, _objectSpread({
|
|
42
41
|
role: "button",
|
|
43
42
|
onClick: toggle,
|
|
@@ -5,11 +5,11 @@ import styles from './styles.mjs';
|
|
|
5
5
|
import React, { forwardRef, createElement } from 'react';
|
|
6
6
|
import Input from '../input/input.mjs';
|
|
7
7
|
import { useBoolean } from '@aiszlab/relax';
|
|
8
|
-
import { useTheme } from '../theme/hooks.mjs';
|
|
9
8
|
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
|
|
10
9
|
import { CLASS_NAMES } from './context.mjs';
|
|
11
10
|
import { useClassNames } from '../../hooks/use-class-names.mjs';
|
|
12
11
|
import { stringify } from '@aiszlab/relax/class-name';
|
|
12
|
+
import { useThemeColorVars } from '../../hooks/use-theme-color-vars.mjs';
|
|
13
13
|
import IconVisibilityOff from '../icon/icons/action/visibility-off.mjs';
|
|
14
14
|
import IconVisibility from '../icon/icons/action/visibility.mjs';
|
|
15
15
|
|
|
@@ -21,19 +21,18 @@ var PasswordInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
21
21
|
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
22
22
|
isVisible = _useBoolean2[0],
|
|
23
23
|
toggle = _useBoolean2[1].toggle;
|
|
24
|
-
var theme = useTheme();
|
|
25
24
|
var classNames = useClassNames(CLASS_NAMES);
|
|
25
|
+
var themeColorVars = useThemeColorVars(["secondary-fixed-dim", "secondary"]);
|
|
26
26
|
var styled = {
|
|
27
|
+
input: props(styles.input),
|
|
27
28
|
visibility: props(styles.visibility)
|
|
28
29
|
};
|
|
29
30
|
return /*#__PURE__*/React.createElement(Input, _objectSpread(_objectSpread({}, props$1), {}, {
|
|
30
31
|
className: stringify(classNames.passwordInput, className),
|
|
31
|
-
style:
|
|
32
|
-
"--color-secondary-fixed-dim": theme.colors["secondary-fixed-dim"],
|
|
33
|
-
"--color-secondary": theme.colors.secondary
|
|
34
|
-
},
|
|
32
|
+
style: themeColorVars,
|
|
35
33
|
ref: ref,
|
|
36
34
|
type: isVisible ? "text" : "password",
|
|
35
|
+
inputClassName: styled.input.className,
|
|
37
36
|
trailing: /*#__PURE__*/createElement(isVisible ? IconVisibilityOff : IconVisibility, _objectSpread({
|
|
38
37
|
role: "button",
|
|
39
38
|
onClick: toggle,
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
declare const styles: Readonly<{
|
|
2
|
+
readonly input: Readonly<{
|
|
3
|
+
readonly "::-ms-reveal": import("@stylexjs/stylex").StyleXClassNameFor<"::-ms-reveal", {
|
|
4
|
+
readonly display: "none";
|
|
5
|
+
}>;
|
|
6
|
+
}>;
|
|
2
7
|
readonly visibility: Readonly<{
|
|
3
8
|
readonly color: import("@stylexjs/stylex").StyleXClassNameFor<"color", "var(--color-secondary-fixed-dim)">;
|
|
4
9
|
readonly willChange: import("@stylexjs/stylex").StyleXClassNameFor<"willChange", "color">;
|
package/dist/styles.css
CHANGED
package/dist/types/input.d.ts
CHANGED
|
@@ -33,6 +33,11 @@ export interface InputProps extends Pick<InputHTMLAttributes<HTMLInputElement>,
|
|
|
33
33
|
* @default false
|
|
34
34
|
*/
|
|
35
35
|
shaped?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* @zh 输入元素的附加类名
|
|
38
|
+
* @en Additional class name for the input element
|
|
39
|
+
*/
|
|
40
|
+
inputClassName?: string;
|
|
36
41
|
/**
|
|
37
42
|
* @zh 前置节点
|
|
38
43
|
* @en Leading node
|