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.cjs
CHANGED
@@ -1695,12 +1695,30 @@ var Tooltip = function Tooltip(props) {
|
|
1695
1695
|
top: top,
|
1696
1696
|
left: left
|
1697
1697
|
};
|
1698
|
+
|
1699
|
+
// Text element - support both string and React components
|
1700
|
+
var textElement = React.useMemo(function () {
|
1701
|
+
if (!text) return null;
|
1702
|
+
|
1703
|
+
// If text is already a React element, use it directly
|
1704
|
+
if (React__default["default"].isValidElement(text)) {
|
1705
|
+
return text;
|
1706
|
+
}
|
1707
|
+
|
1708
|
+
// If text is a string, wrap it in Text component
|
1709
|
+
if (typeof text === 'string') {
|
1710
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, text);
|
1711
|
+
}
|
1712
|
+
|
1713
|
+
// Fallback for other types (convert to string)
|
1714
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(text));
|
1715
|
+
}, [text]);
|
1698
1716
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
1699
1717
|
className: "tooltip"
|
1700
1718
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
1701
1719
|
className: "tooltip-text",
|
1702
1720
|
style: style
|
1703
|
-
},
|
1721
|
+
}, textElement), props.children);
|
1704
1722
|
};
|
1705
1723
|
|
1706
1724
|
/**
|
@@ -2167,6 +2185,24 @@ var Button = function Button(props) {
|
|
2167
2185
|
'aria-describedby': tooltip ? id + "-tooltip" : undefined
|
2168
2186
|
};
|
2169
2187
|
|
2188
|
+
// Label text - support both string and React components
|
2189
|
+
var labelElement = React.useMemo(function () {
|
2190
|
+
if (!label) return null;
|
2191
|
+
|
2192
|
+
// If label is already a React element, use it directly
|
2193
|
+
if (React__default["default"].isValidElement(label)) {
|
2194
|
+
return label;
|
2195
|
+
}
|
2196
|
+
|
2197
|
+
// If label is a string, wrap it in Text component
|
2198
|
+
if (typeof label === 'string') {
|
2199
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
2200
|
+
}
|
2201
|
+
|
2202
|
+
// Fallback for other types (convert to string)
|
2203
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
2204
|
+
}, [label]);
|
2205
|
+
|
2170
2206
|
// Icon configuration
|
2171
2207
|
var iconProps = {
|
2172
2208
|
icon: loading ? 'hourglass_empty' : icon,
|
@@ -2184,7 +2220,7 @@ var Button = function Button(props) {
|
|
2184
2220
|
onBlur: handleBlur,
|
2185
2221
|
onKeyDown: handleKeyDown,
|
2186
2222
|
disabled: disabled || loading
|
2187
|
-
}, ariaAttributes, restProps), (icon || loading) && /*#__PURE__*/React__default["default"].createElement(Icon, iconProps),
|
2223
|
+
}, ariaAttributes, restProps), (icon || loading) && /*#__PURE__*/React__default["default"].createElement(Icon, iconProps), labelElement, loading && !icon && /*#__PURE__*/React__default["default"].createElement("span", {
|
2188
2224
|
className: "loading-text"
|
2189
2225
|
}, "Loading..."));
|
2190
2226
|
};
|
@@ -2280,8 +2316,8 @@ var ActionButton = function ActionButton(props) {
|
|
2280
2316
|
Button.propTypes = {
|
2281
2317
|
/** Unique identifier for the button */
|
2282
2318
|
id: PropTypes.string,
|
2283
|
-
/** Button text label */
|
2284
|
-
label: PropTypes.string,
|
2319
|
+
/** Button text label - can be string or React element */
|
2320
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
2285
2321
|
/** Icon name for Material Icons */
|
2286
2322
|
icon: PropTypes.string,
|
2287
2323
|
/** Click handler function */
|
@@ -3112,11 +3148,28 @@ var Header = function Header(props) {
|
|
3112
3148
|
var style = props.img ? {
|
3113
3149
|
backgroundImage: "url(" + props.img + ")"
|
3114
3150
|
} : {};
|
3115
|
-
|
3151
|
+
|
3152
|
+
// Title element - support both string and React components
|
3153
|
+
var titleElement = React.useMemo(function () {
|
3154
|
+
if (!props.title) return null;
|
3155
|
+
|
3156
|
+
// If title is already a React element, use it directly
|
3157
|
+
if (React__default["default"].isValidElement(props.title)) {
|
3158
|
+
return props.title;
|
3159
|
+
}
|
3160
|
+
|
3161
|
+
// If title is a string, wrap it in Text component
|
3162
|
+
if (typeof props.title === 'string') {
|
3163
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, props.title);
|
3164
|
+
}
|
3165
|
+
|
3166
|
+
// Fallback for other types (convert to string)
|
3167
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(props.title));
|
3168
|
+
}, [props.title]);
|
3116
3169
|
return /*#__PURE__*/React__default["default"].createElement("header", {
|
3117
3170
|
className: "header " + caption + " " + prominent + " " + dense + " " + theme + " " + props.className,
|
3118
3171
|
style: style
|
3119
|
-
}, icon, props.title ? /*#__PURE__*/React__default["default"].createElement("label", null,
|
3172
|
+
}, icon, props.title ? /*#__PURE__*/React__default["default"].createElement("label", null, titleElement) : null, /*#__PURE__*/React__default["default"].createElement("span", {
|
3120
3173
|
className: "actions"
|
3121
3174
|
}, props.children));
|
3122
3175
|
};
|
@@ -3895,7 +3948,24 @@ var TextField = function TextField(props) {
|
|
3895
3948
|
var labelStyle = label ? "" : "no-label";
|
3896
3949
|
var labelPositionStyle = labelPosition == 'left' ? "label-left" : "label-top";
|
3897
3950
|
var style = labelStyle + " " + labelPositionStyle + " " + borderStyle + " textfield-" + type;
|
3898
|
-
|
3951
|
+
|
3952
|
+
// Label text - support both string and React components
|
3953
|
+
var labelTxt = React.useMemo(function () {
|
3954
|
+
if (!label) return null;
|
3955
|
+
|
3956
|
+
// If label is already a React element, use it directly
|
3957
|
+
if (React__default["default"].isValidElement(label)) {
|
3958
|
+
return label;
|
3959
|
+
}
|
3960
|
+
|
3961
|
+
// If label is a string, wrap it in Text component
|
3962
|
+
if (typeof label === 'string') {
|
3963
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
3964
|
+
}
|
3965
|
+
|
3966
|
+
// Fallback for other types (convert to string)
|
3967
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
3968
|
+
}, [label]);
|
3899
3969
|
var placeholderTxt = site.translate ? site.translate(placeholder) : placeholder;
|
3900
3970
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
3901
3971
|
className: style + " " + id + " " + className,
|
@@ -3973,7 +4043,24 @@ var TextArea = function TextArea(props) {
|
|
3973
4043
|
}
|
3974
4044
|
var labelStyle = label ? "" : "no-label";
|
3975
4045
|
var style = "textarea " + labelStyle + " textarea-" + type;
|
3976
|
-
|
4046
|
+
|
4047
|
+
// Label text - support both string and React components
|
4048
|
+
var labelTxt = React.useMemo(function () {
|
4049
|
+
if (!label) return null;
|
4050
|
+
|
4051
|
+
// If label is already a React element, use it directly
|
4052
|
+
if (React__default["default"].isValidElement(label)) {
|
4053
|
+
return label;
|
4054
|
+
}
|
4055
|
+
|
4056
|
+
// If label is a string, wrap it in Text component
|
4057
|
+
if (typeof label === 'string') {
|
4058
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
4059
|
+
}
|
4060
|
+
|
4061
|
+
// Fallback for other types (convert to string)
|
4062
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
4063
|
+
}, [label]);
|
3977
4064
|
var placeholderTxt = site.translate ? site.translate(placeholder) : placeholder;
|
3978
4065
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
3979
4066
|
className: "" + style,
|
@@ -4144,7 +4231,24 @@ var DateRange = function DateRange(props) {
|
|
4144
4231
|
var next = Object.assign({}, form, (_Object$assign = {}, _Object$assign[id] = value, _Object$assign));
|
4145
4232
|
setForm(next);
|
4146
4233
|
}
|
4147
|
-
|
4234
|
+
|
4235
|
+
// Label text - support both string and React components
|
4236
|
+
var labelTxt = React.useMemo(function () {
|
4237
|
+
if (!label) return null;
|
4238
|
+
|
4239
|
+
// If label is already a React element, use it directly
|
4240
|
+
if (React__default["default"].isValidElement(label)) {
|
4241
|
+
return label;
|
4242
|
+
}
|
4243
|
+
|
4244
|
+
// If label is a string, wrap it in Text component
|
4245
|
+
if (typeof label === 'string') {
|
4246
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
4247
|
+
}
|
4248
|
+
|
4249
|
+
// Fallback for other types (convert to string)
|
4250
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
4251
|
+
}, [label]);
|
4148
4252
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
4149
4253
|
className: "date-range"
|
4150
4254
|
}, label ? /*#__PURE__*/React__default["default"].createElement("label", null, labelTxt) : null, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
@@ -4172,7 +4276,24 @@ var PasswordField = function PasswordField(props) {
|
|
4172
4276
|
function toggle() {
|
4173
4277
|
setShow(!show);
|
4174
4278
|
}
|
4175
|
-
|
4279
|
+
|
4280
|
+
// Label text - support both string and React components
|
4281
|
+
var labelTxt = React.useMemo(function () {
|
4282
|
+
if (!label) return null;
|
4283
|
+
|
4284
|
+
// If label is already a React element, use it directly
|
4285
|
+
if (React__default["default"].isValidElement(label)) {
|
4286
|
+
return label;
|
4287
|
+
}
|
4288
|
+
|
4289
|
+
// If label is a string, wrap it in Text component
|
4290
|
+
if (typeof label === 'string') {
|
4291
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
4292
|
+
}
|
4293
|
+
|
4294
|
+
// Fallback for other types (convert to string)
|
4295
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
4296
|
+
}, [label]);
|
4176
4297
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
4177
4298
|
className: "password-field"
|
4178
4299
|
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
@@ -9802,8 +9923,23 @@ var TextField2 = function TextField2(props) {
|
|
9802
9923
|
autoComplete: autoComplete
|
9803
9924
|
}, ariaAttributes, restProps);
|
9804
9925
|
|
9805
|
-
// Label text
|
9806
|
-
var labelTxt =
|
9926
|
+
// Label text - support both string and React components
|
9927
|
+
var labelTxt = React.useMemo(function () {
|
9928
|
+
if (!label) return null;
|
9929
|
+
|
9930
|
+
// If label is already a React element, use it directly
|
9931
|
+
if (React__default["default"].isValidElement(label)) {
|
9932
|
+
return label;
|
9933
|
+
}
|
9934
|
+
|
9935
|
+
// If label is a string, wrap it in Text component
|
9936
|
+
if (typeof label === 'string') {
|
9937
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, label);
|
9938
|
+
}
|
9939
|
+
|
9940
|
+
// Fallback for other types (convert to string)
|
9941
|
+
return /*#__PURE__*/React__default["default"].createElement(Text, null, String(label));
|
9942
|
+
}, [label]);
|
9807
9943
|
var placeholderTxt = site != null && site.translate ? site.translate(placeholder) : placeholder;
|
9808
9944
|
|
9809
9945
|
// Error/helper text
|
@@ -9881,8 +10017,8 @@ TextField2.propTypes = {
|
|
9881
10017
|
type: PropTypes.oneOf(['text', 'email', 'password', 'number', 'tel', 'url', 'search', 'date', 'time', 'datetime-local', 'month', 'week', 'textarea']),
|
9882
10018
|
/** Additional CSS classes */
|
9883
10019
|
className: PropTypes.string,
|
9884
|
-
/** Field label */
|
9885
|
-
label: PropTypes.string,
|
10020
|
+
/** Field label - can be string or React element */
|
10021
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
9886
10022
|
/** Label position */
|
9887
10023
|
labelPosition: PropTypes.oneOf(['top', 'left']),
|
9888
10024
|
/** Placeholder text */
|
@@ -13012,25 +13148,32 @@ var LoginBox = function LoginBox(_ref) {
|
|
13012
13148
|
function ok(forcedPwd) {
|
13013
13149
|
if (onOK && canOK()) onOK(user, forcedPwd || password);
|
13014
13150
|
}
|
13151
|
+
|
13152
|
+
// Helper function for backward compatibility
|
13153
|
+
// TextField2 now supports both strings and React elements
|
13015
13154
|
function tx(txt) {
|
13155
|
+
// For TextField2, we can pass strings directly for better performance
|
13156
|
+
// But keep this function for backward compatibility with other components
|
13016
13157
|
return /*#__PURE__*/React__default["default"].createElement(Text, null, txt);
|
13017
13158
|
}
|
13018
|
-
function changeUser(
|
13159
|
+
function changeUser(_, value) {
|
13019
13160
|
setUser(value);
|
13020
13161
|
}
|
13021
|
-
function changePassword(
|
13162
|
+
function changePassword(_, value) {
|
13022
13163
|
setPassword(value);
|
13023
13164
|
}
|
13024
13165
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
13025
13166
|
className: "login-box"
|
13026
|
-
}, /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(
|
13167
|
+
}, /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(TextField2, {
|
13168
|
+
id: "loginbox-user",
|
13027
13169
|
label: tx(userLabel),
|
13028
13170
|
value: user,
|
13029
13171
|
onChange: changeUser,
|
13030
13172
|
onEnter: ok,
|
13031
13173
|
outlined: true,
|
13032
|
-
autoComplete: "
|
13033
|
-
|
13174
|
+
autoComplete: "username",
|
13175
|
+
required: true
|
13176
|
+
}), /*#__PURE__*/React__default["default"].createElement(TextField2, {
|
13034
13177
|
id: "loginbox-password",
|
13035
13178
|
label: tx(passwordLabel),
|
13036
13179
|
value: password,
|
@@ -13038,7 +13181,8 @@ var LoginBox = function LoginBox(_ref) {
|
|
13038
13181
|
onEnter: ok,
|
13039
13182
|
type: "password",
|
13040
13183
|
outlined: true,
|
13041
|
-
autoComplete: "
|
13184
|
+
autoComplete: "current-password",
|
13185
|
+
required: true
|
13042
13186
|
})), /*#__PURE__*/React__default["default"].createElement("footer", null, loading ? /*#__PURE__*/React__default["default"].createElement("div", {
|
13043
13187
|
className: "load-box"
|
13044
13188
|
}, /*#__PURE__*/React__default["default"].createElement(Icon, {
|