ywana-core8 0.1.80 → 0.1.81
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/index.cjs +164 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +164 -20
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +164 -20
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/button.js +22 -4
- package/src/html/header.js +20 -3
- package/src/html/textfield.js +73 -7
- package/src/html/textfield2.js +19 -4
- package/src/html/tooltip.js +21 -3
- package/src/widgets/login/LoginBox.css +1 -0
- package/src/widgets/login/LoginBox.js +29 -6
package/dist/index.umd.js
CHANGED
@@ -1688,12 +1688,30 @@
|
|
1688
1688
|
top: top,
|
1689
1689
|
left: left
|
1690
1690
|
};
|
1691
|
+
|
1692
|
+
// Text element - support both string and React components
|
1693
|
+
var textElement = React.useMemo(function () {
|
1694
|
+
if (!text) return null;
|
1695
|
+
|
1696
|
+
// If text is already a React element, use it directly
|
1697
|
+
if (React__default["default"].isValidElement(text)) {
|
1698
|
+
return text;
|
1699
|
+
}
|
1700
|
+
|
1701
|
+
// If text is a string, wrap it in Text component
|
1702
|
+
if (typeof text === 'string') {
|
1703
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, text);
|
1704
|
+
}
|
1705
|
+
|
1706
|
+
// Fallback for other types (convert to string)
|
1707
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(text));
|
1708
|
+
}, [text]);
|
1691
1709
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
1692
1710
|
className: "tooltip"
|
1693
1711
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
1694
1712
|
className: "tooltip-text",
|
1695
1713
|
style: style
|
1696
|
-
},
|
1714
|
+
}, textElement), props.children);
|
1697
1715
|
};
|
1698
1716
|
|
1699
1717
|
/**
|
@@ -2160,6 +2178,24 @@
|
|
2160
2178
|
'aria-describedby': tooltip ? id + "-tooltip" : undefined
|
2161
2179
|
};
|
2162
2180
|
|
2181
|
+
// Label text - support both string and React components
|
2182
|
+
var labelElement = React.useMemo(function () {
|
2183
|
+
if (!label) return null;
|
2184
|
+
|
2185
|
+
// If label is already a React element, use it directly
|
2186
|
+
if (React__default["default"].isValidElement(label)) {
|
2187
|
+
return label;
|
2188
|
+
}
|
2189
|
+
|
2190
|
+
// If label is a string, wrap it in Text component
|
2191
|
+
if (typeof label === 'string') {
|
2192
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
2193
|
+
}
|
2194
|
+
|
2195
|
+
// Fallback for other types (convert to string)
|
2196
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
2197
|
+
}, [label]);
|
2198
|
+
|
2163
2199
|
// Icon configuration
|
2164
2200
|
var iconProps = {
|
2165
2201
|
icon: loading ? 'hourglass_empty' : icon,
|
@@ -2177,7 +2213,7 @@
|
|
2177
2213
|
onBlur: handleBlur,
|
2178
2214
|
onKeyDown: handleKeyDown,
|
2179
2215
|
disabled: disabled || loading
|
2180
|
-
}, ariaAttributes, restProps), (icon || loading) && /*#__PURE__*/React__default["default"].createElement(Icon, iconProps),
|
2216
|
+
}, ariaAttributes, restProps), (icon || loading) && /*#__PURE__*/React__default["default"].createElement(Icon, iconProps), labelElement, loading && !icon && /*#__PURE__*/React__default["default"].createElement("span", {
|
2181
2217
|
className: "loading-text"
|
2182
2218
|
}, "Loading..."));
|
2183
2219
|
};
|
@@ -2273,8 +2309,8 @@
|
|
2273
2309
|
Button.propTypes = {
|
2274
2310
|
/** Unique identifier for the button */
|
2275
2311
|
id: PropTypes.string,
|
2276
|
-
/** Button text label */
|
2277
|
-
label: PropTypes.string,
|
2312
|
+
/** Button text label - can be string or React element */
|
2313
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
2278
2314
|
/** Icon name for Material Icons */
|
2279
2315
|
icon: PropTypes.string,
|
2280
2316
|
/** Click handler function */
|
@@ -3105,11 +3141,28 @@
|
|
3105
3141
|
var style = props.img ? {
|
3106
3142
|
backgroundImage: "url(" + props.img + ")"
|
3107
3143
|
} : {};
|
3108
|
-
|
3144
|
+
|
3145
|
+
// Title element - support both string and React components
|
3146
|
+
var titleElement = React.useMemo(function () {
|
3147
|
+
if (!props.title) return null;
|
3148
|
+
|
3149
|
+
// If title is already a React element, use it directly
|
3150
|
+
if (React__default["default"].isValidElement(props.title)) {
|
3151
|
+
return props.title;
|
3152
|
+
}
|
3153
|
+
|
3154
|
+
// If title is a string, wrap it in Text component
|
3155
|
+
if (typeof props.title === 'string') {
|
3156
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, props.title);
|
3157
|
+
}
|
3158
|
+
|
3159
|
+
// Fallback for other types (convert to string)
|
3160
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(props.title));
|
3161
|
+
}, [props.title]);
|
3109
3162
|
return /*#__PURE__*/React__default["default"].createElement("header", {
|
3110
3163
|
className: "header " + caption + " " + prominent + " " + dense + " " + theme + " " + props.className,
|
3111
3164
|
style: style
|
3112
|
-
}, icon, props.title ? /*#__PURE__*/React__default["default"].createElement("label", null,
|
3165
|
+
}, icon, props.title ? /*#__PURE__*/React__default["default"].createElement("label", null, titleElement) : null, /*#__PURE__*/React__default["default"].createElement("span", {
|
3113
3166
|
className: "actions"
|
3114
3167
|
}, props.children));
|
3115
3168
|
};
|
@@ -3888,7 +3941,24 @@
|
|
3888
3941
|
var labelStyle = label ? "" : "no-label";
|
3889
3942
|
var labelPositionStyle = labelPosition == 'left' ? "label-left" : "label-top";
|
3890
3943
|
var style = labelStyle + " " + labelPositionStyle + " " + borderStyle + " textfield-" + type;
|
3891
|
-
|
3944
|
+
|
3945
|
+
// Label text - support both string and React components
|
3946
|
+
var labelTxt = React.useMemo(function () {
|
3947
|
+
if (!label) return null;
|
3948
|
+
|
3949
|
+
// If label is already a React element, use it directly
|
3950
|
+
if (React__default["default"].isValidElement(label)) {
|
3951
|
+
return label;
|
3952
|
+
}
|
3953
|
+
|
3954
|
+
// If label is a string, wrap it in Text component
|
3955
|
+
if (typeof label === 'string') {
|
3956
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
3957
|
+
}
|
3958
|
+
|
3959
|
+
// Fallback for other types (convert to string)
|
3960
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
3961
|
+
}, [label]);
|
3892
3962
|
var placeholderTxt = site.translate ? site.translate(placeholder) : placeholder;
|
3893
3963
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
3894
3964
|
className: style + " " + id + " " + className,
|
@@ -3966,7 +4036,24 @@
|
|
3966
4036
|
}
|
3967
4037
|
var labelStyle = label ? "" : "no-label";
|
3968
4038
|
var style = "textarea " + labelStyle + " textarea-" + type;
|
3969
|
-
|
4039
|
+
|
4040
|
+
// Label text - support both string and React components
|
4041
|
+
var labelTxt = React.useMemo(function () {
|
4042
|
+
if (!label) return null;
|
4043
|
+
|
4044
|
+
// If label is already a React element, use it directly
|
4045
|
+
if (React__default["default"].isValidElement(label)) {
|
4046
|
+
return label;
|
4047
|
+
}
|
4048
|
+
|
4049
|
+
// If label is a string, wrap it in Text component
|
4050
|
+
if (typeof label === 'string') {
|
4051
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
4052
|
+
}
|
4053
|
+
|
4054
|
+
// Fallback for other types (convert to string)
|
4055
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
4056
|
+
}, [label]);
|
3970
4057
|
var placeholderTxt = site.translate ? site.translate(placeholder) : placeholder;
|
3971
4058
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
3972
4059
|
className: "" + style,
|
@@ -4137,7 +4224,24 @@
|
|
4137
4224
|
var next = Object.assign({}, form, (_Object$assign = {}, _Object$assign[id] = value, _Object$assign));
|
4138
4225
|
setForm(next);
|
4139
4226
|
}
|
4140
|
-
|
4227
|
+
|
4228
|
+
// Label text - support both string and React components
|
4229
|
+
var labelTxt = React.useMemo(function () {
|
4230
|
+
if (!label) return null;
|
4231
|
+
|
4232
|
+
// If label is already a React element, use it directly
|
4233
|
+
if (React__default["default"].isValidElement(label)) {
|
4234
|
+
return label;
|
4235
|
+
}
|
4236
|
+
|
4237
|
+
// If label is a string, wrap it in Text component
|
4238
|
+
if (typeof label === 'string') {
|
4239
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
4240
|
+
}
|
4241
|
+
|
4242
|
+
// Fallback for other types (convert to string)
|
4243
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
4244
|
+
}, [label]);
|
4141
4245
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
4142
4246
|
className: "date-range"
|
4143
4247
|
}, label ? /*#__PURE__*/React__default["default"].createElement("label", null, labelTxt) : null, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
@@ -4165,7 +4269,24 @@
|
|
4165
4269
|
function toggle() {
|
4166
4270
|
setShow(!show);
|
4167
4271
|
}
|
4168
|
-
|
4272
|
+
|
4273
|
+
// Label text - support both string and React components
|
4274
|
+
var labelTxt = React.useMemo(function () {
|
4275
|
+
if (!label) return null;
|
4276
|
+
|
4277
|
+
// If label is already a React element, use it directly
|
4278
|
+
if (React__default["default"].isValidElement(label)) {
|
4279
|
+
return label;
|
4280
|
+
}
|
4281
|
+
|
4282
|
+
// If label is a string, wrap it in Text component
|
4283
|
+
if (typeof label === 'string') {
|
4284
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
4285
|
+
}
|
4286
|
+
|
4287
|
+
// Fallback for other types (convert to string)
|
4288
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
4289
|
+
}, [label]);
|
4169
4290
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
4170
4291
|
className: "password-field"
|
4171
4292
|
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
@@ -9795,8 +9916,23 @@
|
|
9795
9916
|
autoComplete: autoComplete
|
9796
9917
|
}, ariaAttributes, restProps);
|
9797
9918
|
|
9798
|
-
// Label text
|
9799
|
-
var labelTxt =
|
9919
|
+
// Label text - support both string and React components
|
9920
|
+
var labelTxt = React.useMemo(function () {
|
9921
|
+
if (!label) return null;
|
9922
|
+
|
9923
|
+
// If label is already a React element, use it directly
|
9924
|
+
if (React__default["default"].isValidElement(label)) {
|
9925
|
+
return label;
|
9926
|
+
}
|
9927
|
+
|
9928
|
+
// If label is a string, wrap it in Text component
|
9929
|
+
if (typeof label === 'string') {
|
9930
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
9931
|
+
}
|
9932
|
+
|
9933
|
+
// Fallback for other types (convert to string)
|
9934
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
9935
|
+
}, [label]);
|
9800
9936
|
var placeholderTxt = site != null && site.translate ? site.translate(placeholder) : placeholder;
|
9801
9937
|
|
9802
9938
|
// Error/helper text
|
@@ -9874,8 +10010,8 @@
|
|
9874
10010
|
type: PropTypes.oneOf(['text', 'email', 'password', 'number', 'tel', 'url', 'search', 'date', 'time', 'datetime-local', 'month', 'week', 'textarea']),
|
9875
10011
|
/** Additional CSS classes */
|
9876
10012
|
className: PropTypes.string,
|
9877
|
-
/** Field label */
|
9878
|
-
label: PropTypes.string,
|
10013
|
+
/** Field label - can be string or React element */
|
10014
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
9879
10015
|
/** Label position */
|
9880
10016
|
labelPosition: PropTypes.oneOf(['top', 'left']),
|
9881
10017
|
/** Placeholder text */
|
@@ -13005,25 +13141,32 @@
|
|
13005
13141
|
function ok(forcedPwd) {
|
13006
13142
|
if (onOK && canOK()) onOK(user, forcedPwd || password);
|
13007
13143
|
}
|
13144
|
+
|
13145
|
+
// Helper function for backward compatibility
|
13146
|
+
// TextField2 now supports both strings and React elements
|
13008
13147
|
function tx(txt) {
|
13148
|
+
// For TextField2, we can pass strings directly for better performance
|
13149
|
+
// But keep this function for backward compatibility with other components
|
13009
13150
|
return /*#__PURE__*/React__default["default"].createElement(Text, null, txt);
|
13010
13151
|
}
|
13011
|
-
function changeUser(
|
13152
|
+
function changeUser(_, value) {
|
13012
13153
|
setUser(value);
|
13013
13154
|
}
|
13014
|
-
function changePassword(
|
13155
|
+
function changePassword(_, value) {
|
13015
13156
|
setPassword(value);
|
13016
13157
|
}
|
13017
13158
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
13018
13159
|
className: "login-box"
|
13019
|
-
}, /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(
|
13160
|
+
}, /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(TextField2, {
|
13161
|
+
id: "loginbox-user",
|
13020
13162
|
label: tx(userLabel),
|
13021
13163
|
value: user,
|
13022
13164
|
onChange: changeUser,
|
13023
13165
|
onEnter: ok,
|
13024
13166
|
outlined: true,
|
13025
|
-
autoComplete: "
|
13026
|
-
|
13167
|
+
autoComplete: "username",
|
13168
|
+
required: true
|
13169
|
+
}), /*#__PURE__*/React__default["default"].createElement(TextField2, {
|
13027
13170
|
id: "loginbox-password",
|
13028
13171
|
label: tx(passwordLabel),
|
13029
13172
|
value: password,
|
@@ -13031,7 +13174,8 @@
|
|
13031
13174
|
onEnter: ok,
|
13032
13175
|
type: "password",
|
13033
13176
|
outlined: true,
|
13034
|
-
autoComplete: "
|
13177
|
+
autoComplete: "current-password",
|
13178
|
+
required: true
|
13035
13179
|
})), /*#__PURE__*/React__default["default"].createElement("footer", null, loading ? /*#__PURE__*/React__default["default"].createElement("div", {
|
13036
13180
|
className: "load-box"
|
13037
13181
|
}, /*#__PURE__*/React__default["default"].createElement(Icon, {
|