ywana-core8 0.1.81 → 0.1.83
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 +100 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +155 -48
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +100 -71
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +100 -71
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- 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/textfield2.css +109 -22
- package/src/html/textfield2.example.js +2 -2
- package/src/html/textfield2.js +28 -9
- package/src/widgets/login/LoginBox.css +14 -11
- package/src/widgets/login/LoginBox.js +1 -1
package/dist/index.umd.js
CHANGED
@@ -4303,8 +4303,8 @@
|
|
4303
4303
|
}));
|
4304
4304
|
};
|
4305
4305
|
|
4306
|
-
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"],
|
4307
|
-
_excluded2$5 = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "searchTerm", "onSearch", "searchable", "searchPlaceholder", "multiSelect", "dense", "disabled", "animated", "cssClasses", "ariaAttributes", "style"],
|
4306
|
+
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"],
|
4307
|
+
_excluded2$5 = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "searchTerm", "onSearch", "searchable", "searchPlaceholder", "searchPosition", "multiSelect", "dense", "disabled", "animated", "cssClasses", "ariaAttributes", "style"],
|
4308
4308
|
_excluded3$2 = ["id", "icon", "iconTooltip", "line1", "line2", "meta", "avatar", "badge", "actions", "disabled"];
|
4309
4309
|
|
4310
4310
|
/**
|
@@ -4331,6 +4331,8 @@
|
|
4331
4331
|
searchPlaceholder = _props$searchPlacehol === void 0 ? "Search..." : _props$searchPlacehol,
|
4332
4332
|
_props$searchBy = props.searchBy,
|
4333
4333
|
searchBy = _props$searchBy === void 0 ? ['line1', 'line2'] : _props$searchBy,
|
4334
|
+
_props$searchPosition = props.searchPosition,
|
4335
|
+
searchPosition = _props$searchPosition === void 0 ? 'top' : _props$searchPosition,
|
4334
4336
|
_props$sortable = props.sortable,
|
4335
4337
|
sortable = _props$sortable === void 0 ? false : _props$sortable,
|
4336
4338
|
sortBy = props.sortBy,
|
@@ -4342,6 +4344,8 @@
|
|
4342
4344
|
onMultiSelect = props.onMultiSelect,
|
4343
4345
|
_props$dense = props.dense,
|
4344
4346
|
dense = _props$dense === void 0 ? false : _props$dense,
|
4347
|
+
_props$outlined = props.outlined,
|
4348
|
+
outlined = _props$outlined === void 0 ? false : _props$outlined,
|
4345
4349
|
_props$disabled = props.disabled,
|
4346
4350
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
4347
4351
|
_props$animated = props.animated,
|
@@ -4390,7 +4394,7 @@
|
|
4390
4394
|
}, [disabled, multiSelect, selected, onSelect, onMultiSelect]);
|
4391
4395
|
|
4392
4396
|
// Handle search
|
4393
|
-
var handleSearch = React.useCallback(function (
|
4397
|
+
var handleSearch = React.useCallback(function (_, value) {
|
4394
4398
|
setSearchTerm(value);
|
4395
4399
|
}, []);
|
4396
4400
|
|
@@ -4431,8 +4435,23 @@
|
|
4431
4435
|
if (onSort) onSort(newConfig);
|
4432
4436
|
}, [sortable, sortConfig, onSort]);
|
4433
4437
|
|
4438
|
+
// Search component JSX - memoized to prevent focus loss
|
4439
|
+
var searchComponent = React.useMemo(function () {
|
4440
|
+
return searchable && /*#__PURE__*/React__default["default"].createElement("div", {
|
4441
|
+
className: "list__search"
|
4442
|
+
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
4443
|
+
id: "list-search",
|
4444
|
+
placeholder: searchPlaceholder,
|
4445
|
+
value: searchTerm,
|
4446
|
+
onChange: handleSearch,
|
4447
|
+
icon: "search",
|
4448
|
+
outlined: true,
|
4449
|
+
size: "small"
|
4450
|
+
}));
|
4451
|
+
}, [searchable, searchPlaceholder, searchTerm, handleSearch]);
|
4452
|
+
|
4434
4453
|
// Generate CSS classes
|
4435
|
-
var cssClasses = ['list', dense && 'list--dense', disabled && 'list--disabled', animated && 'list--animated', loading && 'list--loading', className].filter(Boolean).join(' ');
|
4454
|
+
var cssClasses = ['list', dense && 'list--dense', outlined && 'list--outlined', disabled && 'list--disabled', animated && 'list--animated', loading && 'list--loading', className].filter(Boolean).join(' ');
|
4436
4455
|
|
4437
4456
|
// Accessibility attributes
|
4438
4457
|
var ariaAttributes = {
|
@@ -4459,22 +4478,12 @@
|
|
4459
4478
|
return /*#__PURE__*/React__default["default"].createElement("div", _extends({
|
4460
4479
|
className: cssClasses,
|
4461
4480
|
style: style
|
4462
|
-
}, ariaAttributes, restProps),
|
4463
|
-
className: "list__search"
|
4464
|
-
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
4465
|
-
id: "list-search",
|
4466
|
-
placeholder: searchPlaceholder,
|
4467
|
-
value: searchTerm,
|
4468
|
-
onChange: handleSearch,
|
4469
|
-
icon: "search",
|
4470
|
-
outlined: true,
|
4471
|
-
size: "small"
|
4472
|
-
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
4481
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && searchComponent, /*#__PURE__*/React__default["default"].createElement("div", {
|
4473
4482
|
className: "list__empty"
|
4474
4483
|
}, /*#__PURE__*/React__default["default"].createElement(Icon, {
|
4475
4484
|
icon: emptyIcon,
|
4476
4485
|
size: "large"
|
4477
|
-
}), /*#__PURE__*/React__default["default"].createElement(Text, null, emptyMessage)), children);
|
4486
|
+
}), /*#__PURE__*/React__default["default"].createElement(Text, null, emptyMessage)), searchPosition === 'bottom' && searchComponent, children);
|
4478
4487
|
}
|
4479
4488
|
|
4480
4489
|
// Render grouped or normal list
|
@@ -4491,17 +4500,7 @@
|
|
4491
4500
|
className: cssClasses,
|
4492
4501
|
style: style,
|
4493
4502
|
ref: listRef
|
4494
|
-
}, ariaAttributes, restProps),
|
4495
|
-
className: "list__search"
|
4496
|
-
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
4497
|
-
id: "list-search",
|
4498
|
-
placeholder: searchPlaceholder,
|
4499
|
-
value: searchTerm,
|
4500
|
-
onChange: handleSearch,
|
4501
|
-
icon: "search",
|
4502
|
-
outlined: true,
|
4503
|
-
size: "small"
|
4504
|
-
})), sortable && sortBy && /*#__PURE__*/React__default["default"].createElement("div", {
|
4503
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && searchComponent, sortable && sortBy && /*#__PURE__*/React__default["default"].createElement("div", {
|
4505
4504
|
className: "list__sort"
|
4506
4505
|
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
4507
4506
|
className: "list__sort-button",
|
@@ -4530,7 +4529,7 @@
|
|
4530
4529
|
disabled: disabled,
|
4531
4530
|
animated: animated
|
4532
4531
|
});
|
4533
|
-
})), children);
|
4532
|
+
})), searchPosition === 'bottom' && searchComponent, children);
|
4534
4533
|
};
|
4535
4534
|
|
4536
4535
|
/**
|
@@ -4550,6 +4549,8 @@
|
|
4550
4549
|
searchable = _props$searchable2 === void 0 ? false : _props$searchable2,
|
4551
4550
|
_props$searchPlacehol2 = props.searchPlaceholder,
|
4552
4551
|
searchPlaceholder = _props$searchPlacehol2 === void 0 ? "Search..." : _props$searchPlacehol2,
|
4552
|
+
_props$searchPosition2 = props.searchPosition,
|
4553
|
+
searchPosition = _props$searchPosition2 === void 0 ? 'top' : _props$searchPosition2,
|
4553
4554
|
_props$multiSelect2 = props.multiSelect,
|
4554
4555
|
multiSelect = _props$multiSelect2 === void 0 ? false : _props$multiSelect2,
|
4555
4556
|
_props$dense2 = props.dense,
|
@@ -4596,20 +4597,25 @@
|
|
4596
4597
|
return next;
|
4597
4598
|
});
|
4598
4599
|
}, []);
|
4600
|
+
|
4601
|
+
// Search component for grouped list - memoized to prevent focus loss
|
4602
|
+
var groupedSearchComponent = React.useMemo(function () {
|
4603
|
+
return searchable && /*#__PURE__*/React__default["default"].createElement("div", {
|
4604
|
+
className: "list__search"
|
4605
|
+
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
4606
|
+
id: "grouped-list-search",
|
4607
|
+
placeholder: searchPlaceholder,
|
4608
|
+
value: searchTerm,
|
4609
|
+
onChange: onSearch,
|
4610
|
+
icon: "search",
|
4611
|
+
outlined: true,
|
4612
|
+
size: "small"
|
4613
|
+
}));
|
4614
|
+
}, [searchable, searchPlaceholder, searchTerm, onSearch]);
|
4599
4615
|
return /*#__PURE__*/React__default["default"].createElement("div", _extends({
|
4600
4616
|
className: cssClasses + " grouped",
|
4601
4617
|
style: style
|
4602
|
-
}, ariaAttributes, restProps),
|
4603
|
-
className: "list__search"
|
4604
|
-
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
4605
|
-
id: "grouped-list-search",
|
4606
|
-
placeholder: searchPlaceholder,
|
4607
|
-
value: searchTerm,
|
4608
|
-
onChange: onSearch,
|
4609
|
-
icon: "search",
|
4610
|
-
outlined: true,
|
4611
|
-
size: "small"
|
4612
|
-
})), groups.map(function (group) {
|
4618
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && groupedSearchComponent, groups.map(function (group) {
|
4613
4619
|
var isCollapsed = collapsedGroups.has(group.name);
|
4614
4620
|
var groupTitle = groupRenderer ? groupRenderer(group) : /*#__PURE__*/React__default["default"].createElement(Text, null, group.name);
|
4615
4621
|
return /*#__PURE__*/React__default["default"].createElement(React.Fragment, {
|
@@ -4652,7 +4658,7 @@
|
|
4652
4658
|
animated: animated
|
4653
4659
|
});
|
4654
4660
|
})));
|
4655
|
-
}), children);
|
4661
|
+
}), searchPosition === 'bottom' && groupedSearchComponent, children);
|
4656
4662
|
};
|
4657
4663
|
|
4658
4664
|
/**
|
@@ -4753,14 +4759,14 @@
|
|
4753
4759
|
}, /*#__PURE__*/React__default["default"].createElement(Text, {
|
4754
4760
|
className: "list__item-line2",
|
4755
4761
|
size: "small"
|
4756
|
-
}, line2))),
|
4762
|
+
}, line2))), actions && /*#__PURE__*/React__default["default"].createElement("div", {
|
4763
|
+
className: "list__item-actions",
|
4764
|
+
role: "toolbar"
|
4765
|
+
}, actions), meta && /*#__PURE__*/React__default["default"].createElement("div", {
|
4757
4766
|
className: "list__item-meta"
|
4758
4767
|
}, typeof meta === 'string' ? /*#__PURE__*/React__default["default"].createElement(Text, {
|
4759
4768
|
size: "small"
|
4760
|
-
}, meta) : meta)
|
4761
|
-
className: "list__item-actions",
|
4762
|
-
role: "toolbar"
|
4763
|
-
}, actions));
|
4769
|
+
}, meta) : meta));
|
4764
4770
|
};
|
4765
4771
|
|
4766
4772
|
// PropTypes for List component
|
@@ -4802,6 +4808,8 @@
|
|
4802
4808
|
searchPlaceholder: PropTypes.string,
|
4803
4809
|
/** Properties to search by */
|
4804
4810
|
searchBy: PropTypes.arrayOf(PropTypes.string),
|
4811
|
+
/** Search position */
|
4812
|
+
searchPosition: PropTypes.oneOf(['top', 'bottom']),
|
4805
4813
|
/** Enable sorting */
|
4806
4814
|
sortable: PropTypes.bool,
|
4807
4815
|
/** Property to sort by */
|
@@ -4816,6 +4824,8 @@
|
|
4816
4824
|
onMultiSelect: PropTypes.func,
|
4817
4825
|
/** Dense layout */
|
4818
4826
|
dense: PropTypes.bool,
|
4827
|
+
/** Outlined variant with borders */
|
4828
|
+
outlined: PropTypes.bool,
|
4819
4829
|
/** Disabled state */
|
4820
4830
|
disabled: PropTypes.bool,
|
4821
4831
|
/** Enable animations */
|
@@ -9782,6 +9792,9 @@
|
|
9782
9792
|
var _useState4 = React.useState(true),
|
9783
9793
|
isValid = _useState4[0],
|
9784
9794
|
setIsValid = _useState4[1];
|
9795
|
+
var _useState5 = React.useState(false),
|
9796
|
+
hasBeenTouched = _useState5[0],
|
9797
|
+
setHasBeenTouched = _useState5[1];
|
9785
9798
|
var inputRef = React.useRef(null);
|
9786
9799
|
var debounceRef = React.useRef(null);
|
9787
9800
|
|
@@ -9790,8 +9803,14 @@
|
|
9790
9803
|
console.warn('TextField2 component: id prop is required');
|
9791
9804
|
}
|
9792
9805
|
|
9793
|
-
// Validate value and set error states
|
9806
|
+
// Validate value and set error states - only after user interaction
|
9794
9807
|
React.useEffect(function () {
|
9808
|
+
// Don't validate required fields until user has interacted with the field
|
9809
|
+
if (!hasBeenTouched && required && !value) {
|
9810
|
+
setIsValid(true);
|
9811
|
+
setInternalError('');
|
9812
|
+
return;
|
9813
|
+
}
|
9795
9814
|
if (validation && value !== undefined) {
|
9796
9815
|
var validationResult = validation(value);
|
9797
9816
|
var valid = typeof validationResult === 'boolean' ? validationResult : validationResult.valid;
|
@@ -9801,14 +9820,14 @@
|
|
9801
9820
|
if (onValidation) {
|
9802
9821
|
onValidation(id, valid, errorMessage);
|
9803
9822
|
}
|
9804
|
-
} else if (required && !value) {
|
9823
|
+
} else if (required && !value && hasBeenTouched) {
|
9805
9824
|
setIsValid(false);
|
9806
9825
|
setInternalError('This field is required');
|
9807
9826
|
} else {
|
9808
9827
|
setIsValid(true);
|
9809
9828
|
setInternalError('');
|
9810
9829
|
}
|
9811
|
-
}, [value, required, id]); //
|
9830
|
+
}, [value, required, id, hasBeenTouched]); // Added hasBeenTouched to dependencies
|
9812
9831
|
|
9813
9832
|
// Handle input changes with debouncing
|
9814
9833
|
var handleChange = React.useCallback(function (event) {
|
@@ -9816,6 +9835,11 @@
|
|
9816
9835
|
event.stopPropagation();
|
9817
9836
|
var newValue = event.target.value;
|
9818
9837
|
|
9838
|
+
// Mark field as touched on first change
|
9839
|
+
if (!hasBeenTouched) {
|
9840
|
+
setHasBeenTouched(true);
|
9841
|
+
}
|
9842
|
+
|
9819
9843
|
// Clear previous debounce
|
9820
9844
|
if (debounceRef.current) {
|
9821
9845
|
clearTimeout(debounceRef.current);
|
@@ -9827,7 +9851,7 @@
|
|
9827
9851
|
} else {
|
9828
9852
|
if (onChange) onChange(id, newValue, event);
|
9829
9853
|
}
|
9830
|
-
}, [disabled, readOnly, id, onChange, debounceMs]);
|
9854
|
+
}, [disabled, readOnly, id, onChange, debounceMs, hasBeenTouched]);
|
9831
9855
|
|
9832
9856
|
// Handle key press events
|
9833
9857
|
var handleKeyPress = React.useCallback(function (event) {
|
@@ -9859,8 +9883,13 @@
|
|
9859
9883
|
var handleBlur = React.useCallback(function (event) {
|
9860
9884
|
if (disabled) return;
|
9861
9885
|
setIsFocused(false);
|
9886
|
+
|
9887
|
+
// Mark field as touched on blur if it hasn't been touched yet
|
9888
|
+
if (!hasBeenTouched) {
|
9889
|
+
setHasBeenTouched(true);
|
9890
|
+
}
|
9862
9891
|
if (onBlur) onBlur(event);
|
9863
|
-
}, [disabled, onBlur]);
|
9892
|
+
}, [disabled, onBlur, hasBeenTouched]);
|
9864
9893
|
|
9865
9894
|
// Handle clear action
|
9866
9895
|
var handleClear = React.useCallback(function () {
|
@@ -10140,18 +10169,18 @@
|
|
10140
10169
|
onSearch = props.onSearch,
|
10141
10170
|
restProps = _objectWithoutPropertiesLoose(props, _excluded2$3);
|
10142
10171
|
React.useContext(SiteContext);
|
10143
|
-
var
|
10144
|
-
isOpen =
|
10145
|
-
setIsOpen =
|
10146
|
-
var
|
10147
|
-
searchTerm =
|
10148
|
-
setSearchTerm =
|
10149
|
-
var
|
10150
|
-
focusedIndex =
|
10151
|
-
setFocusedIndex =
|
10152
|
-
var
|
10153
|
-
internalError =
|
10154
|
-
setInternalError =
|
10172
|
+
var _useState6 = React.useState(false),
|
10173
|
+
isOpen = _useState6[0],
|
10174
|
+
setIsOpen = _useState6[1];
|
10175
|
+
var _useState7 = React.useState(''),
|
10176
|
+
searchTerm = _useState7[0],
|
10177
|
+
setSearchTerm = _useState7[1];
|
10178
|
+
var _useState8 = React.useState(-1),
|
10179
|
+
focusedIndex = _useState8[0],
|
10180
|
+
setFocusedIndex = _useState8[1];
|
10181
|
+
var _useState9 = React.useState(''),
|
10182
|
+
internalError = _useState9[0],
|
10183
|
+
setInternalError = _useState9[1];
|
10155
10184
|
var dropdownRef = React.useRef(null);
|
10156
10185
|
var inputRef = React.useRef(null);
|
10157
10186
|
var listRef = React.useRef(null);
|
@@ -10579,18 +10608,18 @@
|
|
10579
10608
|
onChange = props.onChange,
|
10580
10609
|
onValidation = props.onValidation,
|
10581
10610
|
restProps = _objectWithoutPropertiesLoose(props, _excluded3$1);
|
10582
|
-
var
|
10611
|
+
var _useState0 = React.useState({
|
10583
10612
|
from: '',
|
10584
10613
|
to: ''
|
10585
10614
|
}),
|
10586
|
-
form =
|
10587
|
-
setForm =
|
10588
|
-
var
|
10589
|
-
internalError =
|
10590
|
-
setInternalError =
|
10591
|
-
var
|
10592
|
-
isValid =
|
10593
|
-
setIsValid =
|
10615
|
+
form = _useState0[0],
|
10616
|
+
setForm = _useState0[1];
|
10617
|
+
var _useState1 = React.useState(''),
|
10618
|
+
internalError = _useState1[0],
|
10619
|
+
setInternalError = _useState1[1];
|
10620
|
+
var _useState10 = React.useState(true),
|
10621
|
+
isValid = _useState10[0],
|
10622
|
+
setIsValid = _useState10[1];
|
10594
10623
|
|
10595
10624
|
// Validate required props
|
10596
10625
|
if (!id) {
|