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