ywana-core8 0.1.80 → 0.1.82
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 +264 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +156 -48
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +264 -91
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +264 -91
- 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/list.css +27 -10
- package/src/html/list.example.js +336 -60
- package/src/html/list.js +56 -47
- package/src/html/table2.css +5 -5
- package/src/html/textfield.js +73 -7
- package/src/html/textfield2.css +109 -22
- package/src/html/textfield2.example.js +2 -2
- package/src/html/textfield2.js +47 -13
- package/src/html/tooltip.js +21 -3
- package/src/widgets/login/LoginBox.css +15 -11
- package/src/widgets/login/LoginBox.js +30 -7
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, {
|
@@ -4180,8 +4301,8 @@ var PasswordField = function PasswordField(props) {
|
|
4180
4301
|
}));
|
4181
4302
|
};
|
4182
4303
|
|
4183
|
-
var _excluded$a = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "loading", "empty", "emptyMessage", "emptyIcon", "searchable", "searchPlaceholder", "searchBy", "sortable", "sortBy", "sortDirection", "onSort", "multiSelect", "onMultiSelect", "dense", "disabled", "animated", "virtualized", "itemHeight", "maxHeight", "className", "style", "ariaLabel", "role"],
|
4184
|
-
_excluded2$5 = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "searchTerm", "onSearch", "searchable", "searchPlaceholder", "multiSelect", "dense", "disabled", "animated", "cssClasses", "ariaAttributes", "style"],
|
4304
|
+
var _excluded$a = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "loading", "empty", "emptyMessage", "emptyIcon", "searchable", "searchPlaceholder", "searchBy", "searchPosition", "sortable", "sortBy", "sortDirection", "onSort", "multiSelect", "onMultiSelect", "dense", "outlined", "disabled", "animated", "virtualized", "itemHeight", "maxHeight", "className", "style", "ariaLabel", "role"],
|
4305
|
+
_excluded2$5 = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "searchTerm", "onSearch", "searchable", "searchPlaceholder", "searchPosition", "multiSelect", "dense", "disabled", "animated", "cssClasses", "ariaAttributes", "style"],
|
4185
4306
|
_excluded3$2 = ["id", "icon", "iconTooltip", "line1", "line2", "meta", "avatar", "badge", "actions", "disabled"];
|
4186
4307
|
|
4187
4308
|
/**
|
@@ -4208,6 +4329,8 @@ var List = function List(props) {
|
|
4208
4329
|
searchPlaceholder = _props$searchPlacehol === void 0 ? "Search..." : _props$searchPlacehol,
|
4209
4330
|
_props$searchBy = props.searchBy,
|
4210
4331
|
searchBy = _props$searchBy === void 0 ? ['line1', 'line2'] : _props$searchBy,
|
4332
|
+
_props$searchPosition = props.searchPosition,
|
4333
|
+
searchPosition = _props$searchPosition === void 0 ? 'top' : _props$searchPosition,
|
4211
4334
|
_props$sortable = props.sortable,
|
4212
4335
|
sortable = _props$sortable === void 0 ? false : _props$sortable,
|
4213
4336
|
sortBy = props.sortBy,
|
@@ -4219,6 +4342,8 @@ var List = function List(props) {
|
|
4219
4342
|
onMultiSelect = props.onMultiSelect,
|
4220
4343
|
_props$dense = props.dense,
|
4221
4344
|
dense = _props$dense === void 0 ? false : _props$dense,
|
4345
|
+
_props$outlined = props.outlined,
|
4346
|
+
outlined = _props$outlined === void 0 ? false : _props$outlined,
|
4222
4347
|
_props$disabled = props.disabled,
|
4223
4348
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
4224
4349
|
_props$animated = props.animated,
|
@@ -4267,7 +4392,7 @@ var List = function List(props) {
|
|
4267
4392
|
}, [disabled, multiSelect, selected, onSelect, onMultiSelect]);
|
4268
4393
|
|
4269
4394
|
// Handle search
|
4270
|
-
var handleSearch = useCallback(function (
|
4395
|
+
var handleSearch = useCallback(function (_, value) {
|
4271
4396
|
setSearchTerm(value);
|
4272
4397
|
}, []);
|
4273
4398
|
|
@@ -4308,8 +4433,23 @@ var List = function List(props) {
|
|
4308
4433
|
if (onSort) onSort(newConfig);
|
4309
4434
|
}, [sortable, sortConfig, onSort]);
|
4310
4435
|
|
4436
|
+
// Search component
|
4437
|
+
var SearchComponent = function SearchComponent() {
|
4438
|
+
return searchable && /*#__PURE__*/React.createElement("div", {
|
4439
|
+
className: "list__search"
|
4440
|
+
}, /*#__PURE__*/React.createElement(TextField, {
|
4441
|
+
id: "list-search",
|
4442
|
+
placeholder: searchPlaceholder,
|
4443
|
+
value: searchTerm,
|
4444
|
+
onChange: handleSearch,
|
4445
|
+
icon: "search",
|
4446
|
+
outlined: true,
|
4447
|
+
size: "small"
|
4448
|
+
}));
|
4449
|
+
};
|
4450
|
+
|
4311
4451
|
// Generate CSS classes
|
4312
|
-
var cssClasses = ['list', dense && 'list--dense', disabled && 'list--disabled', animated && 'list--animated', loading && 'list--loading', className].filter(Boolean).join(' ');
|
4452
|
+
var cssClasses = ['list', dense && 'list--dense', outlined && 'list--outlined', disabled && 'list--disabled', animated && 'list--animated', loading && 'list--loading', className].filter(Boolean).join(' ');
|
4313
4453
|
|
4314
4454
|
// Accessibility attributes
|
4315
4455
|
var ariaAttributes = {
|
@@ -4336,22 +4476,12 @@ var List = function List(props) {
|
|
4336
4476
|
return /*#__PURE__*/React.createElement("div", _extends({
|
4337
4477
|
className: cssClasses,
|
4338
4478
|
style: style
|
4339
|
-
}, ariaAttributes, restProps),
|
4340
|
-
className: "list__search"
|
4341
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
4342
|
-
id: "list-search",
|
4343
|
-
placeholder: searchPlaceholder,
|
4344
|
-
value: searchTerm,
|
4345
|
-
onChange: handleSearch,
|
4346
|
-
icon: "search",
|
4347
|
-
outlined: true,
|
4348
|
-
size: "small"
|
4349
|
-
})), /*#__PURE__*/React.createElement("div", {
|
4479
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && /*#__PURE__*/React.createElement(SearchComponent, null), /*#__PURE__*/React.createElement("div", {
|
4350
4480
|
className: "list__empty"
|
4351
4481
|
}, /*#__PURE__*/React.createElement(Icon, {
|
4352
4482
|
icon: emptyIcon,
|
4353
4483
|
size: "large"
|
4354
|
-
}), /*#__PURE__*/React.createElement(Text, null, emptyMessage)), children);
|
4484
|
+
}), /*#__PURE__*/React.createElement(Text, null, emptyMessage)), searchPosition === 'bottom' && /*#__PURE__*/React.createElement(SearchComponent, null), children);
|
4355
4485
|
}
|
4356
4486
|
|
4357
4487
|
// Render grouped or normal list
|
@@ -4368,17 +4498,7 @@ var List = function List(props) {
|
|
4368
4498
|
className: cssClasses,
|
4369
4499
|
style: style,
|
4370
4500
|
ref: listRef
|
4371
|
-
}, ariaAttributes, restProps),
|
4372
|
-
className: "list__search"
|
4373
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
4374
|
-
id: "list-search",
|
4375
|
-
placeholder: searchPlaceholder,
|
4376
|
-
value: searchTerm,
|
4377
|
-
onChange: handleSearch,
|
4378
|
-
icon: "search",
|
4379
|
-
outlined: true,
|
4380
|
-
size: "small"
|
4381
|
-
})), sortable && sortBy && /*#__PURE__*/React.createElement("div", {
|
4501
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && /*#__PURE__*/React.createElement(SearchComponent, null), sortable && sortBy && /*#__PURE__*/React.createElement("div", {
|
4382
4502
|
className: "list__sort"
|
4383
4503
|
}, /*#__PURE__*/React.createElement("button", {
|
4384
4504
|
className: "list__sort-button",
|
@@ -4407,7 +4527,7 @@ var List = function List(props) {
|
|
4407
4527
|
disabled: disabled,
|
4408
4528
|
animated: animated
|
4409
4529
|
});
|
4410
|
-
})), children);
|
4530
|
+
})), searchPosition === 'bottom' && /*#__PURE__*/React.createElement(SearchComponent, null), children);
|
4411
4531
|
};
|
4412
4532
|
|
4413
4533
|
/**
|
@@ -4427,6 +4547,8 @@ var GroupedList = function GroupedList(props) {
|
|
4427
4547
|
searchable = _props$searchable2 === void 0 ? false : _props$searchable2,
|
4428
4548
|
_props$searchPlacehol2 = props.searchPlaceholder,
|
4429
4549
|
searchPlaceholder = _props$searchPlacehol2 === void 0 ? "Search..." : _props$searchPlacehol2,
|
4550
|
+
_props$searchPosition2 = props.searchPosition,
|
4551
|
+
searchPosition = _props$searchPosition2 === void 0 ? 'top' : _props$searchPosition2,
|
4430
4552
|
_props$multiSelect2 = props.multiSelect,
|
4431
4553
|
multiSelect = _props$multiSelect2 === void 0 ? false : _props$multiSelect2,
|
4432
4554
|
_props$dense2 = props.dense,
|
@@ -4473,20 +4595,25 @@ var GroupedList = function GroupedList(props) {
|
|
4473
4595
|
return next;
|
4474
4596
|
});
|
4475
4597
|
}, []);
|
4598
|
+
|
4599
|
+
// Search component for grouped list
|
4600
|
+
var GroupedSearchComponent = function GroupedSearchComponent() {
|
4601
|
+
return searchable && /*#__PURE__*/React.createElement("div", {
|
4602
|
+
className: "list__search"
|
4603
|
+
}, /*#__PURE__*/React.createElement(TextField, {
|
4604
|
+
id: "grouped-list-search",
|
4605
|
+
placeholder: searchPlaceholder,
|
4606
|
+
value: searchTerm,
|
4607
|
+
onChange: onSearch,
|
4608
|
+
icon: "search",
|
4609
|
+
outlined: true,
|
4610
|
+
size: "small"
|
4611
|
+
}));
|
4612
|
+
};
|
4476
4613
|
return /*#__PURE__*/React.createElement("div", _extends({
|
4477
4614
|
className: cssClasses + " grouped",
|
4478
4615
|
style: style
|
4479
|
-
}, ariaAttributes, restProps),
|
4480
|
-
className: "list__search"
|
4481
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
4482
|
-
id: "grouped-list-search",
|
4483
|
-
placeholder: searchPlaceholder,
|
4484
|
-
value: searchTerm,
|
4485
|
-
onChange: onSearch,
|
4486
|
-
icon: "search",
|
4487
|
-
outlined: true,
|
4488
|
-
size: "small"
|
4489
|
-
})), groups.map(function (group) {
|
4616
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && /*#__PURE__*/React.createElement(GroupedSearchComponent, null), groups.map(function (group) {
|
4490
4617
|
var isCollapsed = collapsedGroups.has(group.name);
|
4491
4618
|
var groupTitle = groupRenderer ? groupRenderer(group) : /*#__PURE__*/React.createElement(Text, null, group.name);
|
4492
4619
|
return /*#__PURE__*/React.createElement(Fragment$2, {
|
@@ -4529,7 +4656,7 @@ var GroupedList = function GroupedList(props) {
|
|
4529
4656
|
animated: animated
|
4530
4657
|
});
|
4531
4658
|
})));
|
4532
|
-
}), children);
|
4659
|
+
}), searchPosition === 'bottom' && /*#__PURE__*/React.createElement(GroupedSearchComponent, null), children);
|
4533
4660
|
};
|
4534
4661
|
|
4535
4662
|
/**
|
@@ -4630,14 +4757,14 @@ var ListItem = function ListItem(_ref) {
|
|
4630
4757
|
}, /*#__PURE__*/React.createElement(Text, {
|
4631
4758
|
className: "list__item-line2",
|
4632
4759
|
size: "small"
|
4633
|
-
}, line2))),
|
4760
|
+
}, line2))), actions && /*#__PURE__*/React.createElement("div", {
|
4761
|
+
className: "list__item-actions",
|
4762
|
+
role: "toolbar"
|
4763
|
+
}, actions), meta && /*#__PURE__*/React.createElement("div", {
|
4634
4764
|
className: "list__item-meta"
|
4635
4765
|
}, typeof meta === 'string' ? /*#__PURE__*/React.createElement(Text, {
|
4636
4766
|
size: "small"
|
4637
|
-
}, meta) : meta)
|
4638
|
-
className: "list__item-actions",
|
4639
|
-
role: "toolbar"
|
4640
|
-
}, actions));
|
4767
|
+
}, meta) : meta));
|
4641
4768
|
};
|
4642
4769
|
|
4643
4770
|
// PropTypes for List component
|
@@ -4679,6 +4806,8 @@ List.propTypes = {
|
|
4679
4806
|
searchPlaceholder: PropTypes.string,
|
4680
4807
|
/** Properties to search by */
|
4681
4808
|
searchBy: PropTypes.arrayOf(PropTypes.string),
|
4809
|
+
/** Search position */
|
4810
|
+
searchPosition: PropTypes.oneOf(['top', 'bottom']),
|
4682
4811
|
/** Enable sorting */
|
4683
4812
|
sortable: PropTypes.bool,
|
4684
4813
|
/** Property to sort by */
|
@@ -4693,6 +4822,8 @@ List.propTypes = {
|
|
4693
4822
|
onMultiSelect: PropTypes.func,
|
4694
4823
|
/** Dense layout */
|
4695
4824
|
dense: PropTypes.bool,
|
4825
|
+
/** Outlined variant with borders */
|
4826
|
+
outlined: PropTypes.bool,
|
4696
4827
|
/** Disabled state */
|
4697
4828
|
disabled: PropTypes.bool,
|
4698
4829
|
/** Enable animations */
|
@@ -9659,6 +9790,9 @@ var TextField2 = function TextField2(props) {
|
|
9659
9790
|
var _useState4 = useState(true),
|
9660
9791
|
isValid = _useState4[0],
|
9661
9792
|
setIsValid = _useState4[1];
|
9793
|
+
var _useState5 = useState(false),
|
9794
|
+
hasBeenTouched = _useState5[0],
|
9795
|
+
setHasBeenTouched = _useState5[1];
|
9662
9796
|
var inputRef = useRef(null);
|
9663
9797
|
var debounceRef = useRef(null);
|
9664
9798
|
|
@@ -9667,8 +9801,14 @@ var TextField2 = function TextField2(props) {
|
|
9667
9801
|
console.warn('TextField2 component: id prop is required');
|
9668
9802
|
}
|
9669
9803
|
|
9670
|
-
// Validate value and set error states
|
9804
|
+
// Validate value and set error states - only after user interaction
|
9671
9805
|
useEffect(function () {
|
9806
|
+
// Don't validate required fields until user has interacted with the field
|
9807
|
+
if (!hasBeenTouched && required && !value) {
|
9808
|
+
setIsValid(true);
|
9809
|
+
setInternalError('');
|
9810
|
+
return;
|
9811
|
+
}
|
9672
9812
|
if (validation && value !== undefined) {
|
9673
9813
|
var validationResult = validation(value);
|
9674
9814
|
var valid = typeof validationResult === 'boolean' ? validationResult : validationResult.valid;
|
@@ -9678,14 +9818,14 @@ var TextField2 = function TextField2(props) {
|
|
9678
9818
|
if (onValidation) {
|
9679
9819
|
onValidation(id, valid, errorMessage);
|
9680
9820
|
}
|
9681
|
-
} else if (required && !value) {
|
9821
|
+
} else if (required && !value && hasBeenTouched) {
|
9682
9822
|
setIsValid(false);
|
9683
9823
|
setInternalError('This field is required');
|
9684
9824
|
} else {
|
9685
9825
|
setIsValid(true);
|
9686
9826
|
setInternalError('');
|
9687
9827
|
}
|
9688
|
-
}, [value, required, id]); //
|
9828
|
+
}, [value, required, id, hasBeenTouched]); // Added hasBeenTouched to dependencies
|
9689
9829
|
|
9690
9830
|
// Handle input changes with debouncing
|
9691
9831
|
var handleChange = useCallback(function (event) {
|
@@ -9693,6 +9833,11 @@ var TextField2 = function TextField2(props) {
|
|
9693
9833
|
event.stopPropagation();
|
9694
9834
|
var newValue = event.target.value;
|
9695
9835
|
|
9836
|
+
// Mark field as touched on first change
|
9837
|
+
if (!hasBeenTouched) {
|
9838
|
+
setHasBeenTouched(true);
|
9839
|
+
}
|
9840
|
+
|
9696
9841
|
// Clear previous debounce
|
9697
9842
|
if (debounceRef.current) {
|
9698
9843
|
clearTimeout(debounceRef.current);
|
@@ -9704,7 +9849,7 @@ var TextField2 = function TextField2(props) {
|
|
9704
9849
|
} else {
|
9705
9850
|
if (onChange) onChange(id, newValue, event);
|
9706
9851
|
}
|
9707
|
-
}, [disabled, readOnly, id, onChange, debounceMs]);
|
9852
|
+
}, [disabled, readOnly, id, onChange, debounceMs, hasBeenTouched]);
|
9708
9853
|
|
9709
9854
|
// Handle key press events
|
9710
9855
|
var handleKeyPress = useCallback(function (event) {
|
@@ -9736,8 +9881,13 @@ var TextField2 = function TextField2(props) {
|
|
9736
9881
|
var handleBlur = useCallback(function (event) {
|
9737
9882
|
if (disabled) return;
|
9738
9883
|
setIsFocused(false);
|
9884
|
+
|
9885
|
+
// Mark field as touched on blur if it hasn't been touched yet
|
9886
|
+
if (!hasBeenTouched) {
|
9887
|
+
setHasBeenTouched(true);
|
9888
|
+
}
|
9739
9889
|
if (onBlur) onBlur(event);
|
9740
|
-
}, [disabled, onBlur]);
|
9890
|
+
}, [disabled, onBlur, hasBeenTouched]);
|
9741
9891
|
|
9742
9892
|
// Handle clear action
|
9743
9893
|
var handleClear = useCallback(function () {
|
@@ -9793,8 +9943,23 @@ var TextField2 = function TextField2(props) {
|
|
9793
9943
|
autoComplete: autoComplete
|
9794
9944
|
}, ariaAttributes, restProps);
|
9795
9945
|
|
9796
|
-
// Label text
|
9797
|
-
var labelTxt =
|
9946
|
+
// Label text - support both string and React components
|
9947
|
+
var labelTxt = useMemo(function () {
|
9948
|
+
if (!label) return null;
|
9949
|
+
|
9950
|
+
// If label is already a React element, use it directly
|
9951
|
+
if (React.isValidElement(label)) {
|
9952
|
+
return label;
|
9953
|
+
}
|
9954
|
+
|
9955
|
+
// If label is a string, wrap it in Text component
|
9956
|
+
if (typeof label === 'string') {
|
9957
|
+
return /*#__PURE__*/React.createElement(Text, null, label);
|
9958
|
+
}
|
9959
|
+
|
9960
|
+
// Fallback for other types (convert to string)
|
9961
|
+
return /*#__PURE__*/React.createElement(Text, null, String(label));
|
9962
|
+
}, [label]);
|
9798
9963
|
var placeholderTxt = site != null && site.translate ? site.translate(placeholder) : placeholder;
|
9799
9964
|
|
9800
9965
|
// Error/helper text
|
@@ -9872,8 +10037,8 @@ TextField2.propTypes = {
|
|
9872
10037
|
type: PropTypes.oneOf(['text', 'email', 'password', 'number', 'tel', 'url', 'search', 'date', 'time', 'datetime-local', 'month', 'week', 'textarea']),
|
9873
10038
|
/** Additional CSS classes */
|
9874
10039
|
className: PropTypes.string,
|
9875
|
-
/** Field label */
|
9876
|
-
label: PropTypes.string,
|
10040
|
+
/** Field label - can be string or React element */
|
10041
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
9877
10042
|
/** Label position */
|
9878
10043
|
labelPosition: PropTypes.oneOf(['top', 'left']),
|
9879
10044
|
/** Placeholder text */
|
@@ -10002,18 +10167,18 @@ var DropDown2 = function DropDown2(props) {
|
|
10002
10167
|
onSearch = props.onSearch,
|
10003
10168
|
restProps = _objectWithoutPropertiesLoose(props, _excluded2$3);
|
10004
10169
|
useContext(SiteContext);
|
10005
|
-
var
|
10006
|
-
isOpen =
|
10007
|
-
setIsOpen =
|
10008
|
-
var
|
10009
|
-
searchTerm =
|
10010
|
-
setSearchTerm =
|
10011
|
-
var
|
10012
|
-
focusedIndex =
|
10013
|
-
setFocusedIndex =
|
10014
|
-
var
|
10015
|
-
internalError =
|
10016
|
-
setInternalError =
|
10170
|
+
var _useState6 = useState(false),
|
10171
|
+
isOpen = _useState6[0],
|
10172
|
+
setIsOpen = _useState6[1];
|
10173
|
+
var _useState7 = useState(''),
|
10174
|
+
searchTerm = _useState7[0],
|
10175
|
+
setSearchTerm = _useState7[1];
|
10176
|
+
var _useState8 = useState(-1),
|
10177
|
+
focusedIndex = _useState8[0],
|
10178
|
+
setFocusedIndex = _useState8[1];
|
10179
|
+
var _useState9 = useState(''),
|
10180
|
+
internalError = _useState9[0],
|
10181
|
+
setInternalError = _useState9[1];
|
10017
10182
|
var dropdownRef = useRef(null);
|
10018
10183
|
var inputRef = useRef(null);
|
10019
10184
|
var listRef = useRef(null);
|
@@ -10441,18 +10606,18 @@ var DateRange2 = function DateRange2(props) {
|
|
10441
10606
|
onChange = props.onChange,
|
10442
10607
|
onValidation = props.onValidation,
|
10443
10608
|
restProps = _objectWithoutPropertiesLoose(props, _excluded3$1);
|
10444
|
-
var
|
10609
|
+
var _useState0 = useState({
|
10445
10610
|
from: '',
|
10446
10611
|
to: ''
|
10447
10612
|
}),
|
10448
|
-
form =
|
10449
|
-
setForm =
|
10450
|
-
var
|
10451
|
-
internalError =
|
10452
|
-
setInternalError =
|
10453
|
-
var
|
10454
|
-
isValid =
|
10455
|
-
setIsValid =
|
10613
|
+
form = _useState0[0],
|
10614
|
+
setForm = _useState0[1];
|
10615
|
+
var _useState1 = useState(''),
|
10616
|
+
internalError = _useState1[0],
|
10617
|
+
setInternalError = _useState1[1];
|
10618
|
+
var _useState10 = useState(true),
|
10619
|
+
isValid = _useState10[0],
|
10620
|
+
setIsValid = _useState10[1];
|
10456
10621
|
|
10457
10622
|
// Validate required props
|
10458
10623
|
if (!id) {
|
@@ -13003,25 +13168,32 @@ var LoginBox = function LoginBox(_ref) {
|
|
13003
13168
|
function ok(forcedPwd) {
|
13004
13169
|
if (onOK && canOK()) onOK(user, forcedPwd || password);
|
13005
13170
|
}
|
13171
|
+
|
13172
|
+
// Helper function for backward compatibility
|
13173
|
+
// TextField2 now supports both strings and React elements
|
13006
13174
|
function tx(txt) {
|
13175
|
+
// For TextField2, we can pass strings directly for better performance
|
13176
|
+
// But keep this function for backward compatibility with other components
|
13007
13177
|
return /*#__PURE__*/React.createElement(Text, null, txt);
|
13008
13178
|
}
|
13009
|
-
function changeUser(
|
13179
|
+
function changeUser(_, value) {
|
13010
13180
|
setUser(value);
|
13011
13181
|
}
|
13012
|
-
function changePassword(
|
13182
|
+
function changePassword(_, value) {
|
13013
13183
|
setPassword(value);
|
13014
13184
|
}
|
13015
13185
|
return /*#__PURE__*/React.createElement("div", {
|
13016
13186
|
className: "login-box"
|
13017
|
-
}, /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement(
|
13187
|
+
}, /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement(TextField2, {
|
13188
|
+
id: "loginbox-user",
|
13018
13189
|
label: tx(userLabel),
|
13019
13190
|
value: user,
|
13020
13191
|
onChange: changeUser,
|
13021
13192
|
onEnter: ok,
|
13022
13193
|
outlined: true,
|
13023
|
-
autoComplete: "
|
13024
|
-
|
13194
|
+
autoComplete: "username",
|
13195
|
+
required: true
|
13196
|
+
}), /*#__PURE__*/React.createElement(TextField2, {
|
13025
13197
|
id: "loginbox-password",
|
13026
13198
|
label: tx(passwordLabel),
|
13027
13199
|
value: password,
|
@@ -13029,7 +13201,8 @@ var LoginBox = function LoginBox(_ref) {
|
|
13029
13201
|
onEnter: ok,
|
13030
13202
|
type: "password",
|
13031
13203
|
outlined: true,
|
13032
|
-
autoComplete: "
|
13204
|
+
autoComplete: "current-password",
|
13205
|
+
required: true
|
13033
13206
|
})), /*#__PURE__*/React.createElement("footer", null, loading ? /*#__PURE__*/React.createElement("div", {
|
13034
13207
|
className: "load-box"
|
13035
13208
|
}, /*#__PURE__*/React.createElement(Icon, {
|