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.cjs
CHANGED
@@ -4310,8 +4310,8 @@ var PasswordField = function PasswordField(props) {
|
|
4310
4310
|
}));
|
4311
4311
|
};
|
4312
4312
|
|
4313
|
-
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"],
|
4314
|
-
_excluded2$5 = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "searchTerm", "onSearch", "searchable", "searchPlaceholder", "multiSelect", "dense", "disabled", "animated", "cssClasses", "ariaAttributes", "style"],
|
4313
|
+
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"],
|
4314
|
+
_excluded2$5 = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "searchTerm", "onSearch", "searchable", "searchPlaceholder", "searchPosition", "multiSelect", "dense", "disabled", "animated", "cssClasses", "ariaAttributes", "style"],
|
4315
4315
|
_excluded3$2 = ["id", "icon", "iconTooltip", "line1", "line2", "meta", "avatar", "badge", "actions", "disabled"];
|
4316
4316
|
|
4317
4317
|
/**
|
@@ -4338,6 +4338,8 @@ var List = function List(props) {
|
|
4338
4338
|
searchPlaceholder = _props$searchPlacehol === void 0 ? "Search..." : _props$searchPlacehol,
|
4339
4339
|
_props$searchBy = props.searchBy,
|
4340
4340
|
searchBy = _props$searchBy === void 0 ? ['line1', 'line2'] : _props$searchBy,
|
4341
|
+
_props$searchPosition = props.searchPosition,
|
4342
|
+
searchPosition = _props$searchPosition === void 0 ? 'top' : _props$searchPosition,
|
4341
4343
|
_props$sortable = props.sortable,
|
4342
4344
|
sortable = _props$sortable === void 0 ? false : _props$sortable,
|
4343
4345
|
sortBy = props.sortBy,
|
@@ -4349,6 +4351,8 @@ var List = function List(props) {
|
|
4349
4351
|
onMultiSelect = props.onMultiSelect,
|
4350
4352
|
_props$dense = props.dense,
|
4351
4353
|
dense = _props$dense === void 0 ? false : _props$dense,
|
4354
|
+
_props$outlined = props.outlined,
|
4355
|
+
outlined = _props$outlined === void 0 ? false : _props$outlined,
|
4352
4356
|
_props$disabled = props.disabled,
|
4353
4357
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
4354
4358
|
_props$animated = props.animated,
|
@@ -4397,7 +4401,7 @@ var List = function List(props) {
|
|
4397
4401
|
}, [disabled, multiSelect, selected, onSelect, onMultiSelect]);
|
4398
4402
|
|
4399
4403
|
// Handle search
|
4400
|
-
var handleSearch = React.useCallback(function (
|
4404
|
+
var handleSearch = React.useCallback(function (_, value) {
|
4401
4405
|
setSearchTerm(value);
|
4402
4406
|
}, []);
|
4403
4407
|
|
@@ -4438,8 +4442,23 @@ var List = function List(props) {
|
|
4438
4442
|
if (onSort) onSort(newConfig);
|
4439
4443
|
}, [sortable, sortConfig, onSort]);
|
4440
4444
|
|
4445
|
+
// Search component JSX - memoized to prevent focus loss
|
4446
|
+
var searchComponent = React.useMemo(function () {
|
4447
|
+
return searchable && /*#__PURE__*/React__default["default"].createElement("div", {
|
4448
|
+
className: "list__search"
|
4449
|
+
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
4450
|
+
id: "list-search",
|
4451
|
+
placeholder: searchPlaceholder,
|
4452
|
+
value: searchTerm,
|
4453
|
+
onChange: handleSearch,
|
4454
|
+
icon: "search",
|
4455
|
+
outlined: true,
|
4456
|
+
size: "small"
|
4457
|
+
}));
|
4458
|
+
}, [searchable, searchPlaceholder, searchTerm, handleSearch]);
|
4459
|
+
|
4441
4460
|
// Generate CSS classes
|
4442
|
-
var cssClasses = ['list', dense && 'list--dense', disabled && 'list--disabled', animated && 'list--animated', loading && 'list--loading', className].filter(Boolean).join(' ');
|
4461
|
+
var cssClasses = ['list', dense && 'list--dense', outlined && 'list--outlined', disabled && 'list--disabled', animated && 'list--animated', loading && 'list--loading', className].filter(Boolean).join(' ');
|
4443
4462
|
|
4444
4463
|
// Accessibility attributes
|
4445
4464
|
var ariaAttributes = {
|
@@ -4466,22 +4485,12 @@ var List = function List(props) {
|
|
4466
4485
|
return /*#__PURE__*/React__default["default"].createElement("div", _extends({
|
4467
4486
|
className: cssClasses,
|
4468
4487
|
style: style
|
4469
|
-
}, ariaAttributes, restProps),
|
4470
|
-
className: "list__search"
|
4471
|
-
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
4472
|
-
id: "list-search",
|
4473
|
-
placeholder: searchPlaceholder,
|
4474
|
-
value: searchTerm,
|
4475
|
-
onChange: handleSearch,
|
4476
|
-
icon: "search",
|
4477
|
-
outlined: true,
|
4478
|
-
size: "small"
|
4479
|
-
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
4488
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && searchComponent, /*#__PURE__*/React__default["default"].createElement("div", {
|
4480
4489
|
className: "list__empty"
|
4481
4490
|
}, /*#__PURE__*/React__default["default"].createElement(Icon, {
|
4482
4491
|
icon: emptyIcon,
|
4483
4492
|
size: "large"
|
4484
|
-
}), /*#__PURE__*/React__default["default"].createElement(Text, null, emptyMessage)), children);
|
4493
|
+
}), /*#__PURE__*/React__default["default"].createElement(Text, null, emptyMessage)), searchPosition === 'bottom' && searchComponent, children);
|
4485
4494
|
}
|
4486
4495
|
|
4487
4496
|
// Render grouped or normal list
|
@@ -4498,17 +4507,7 @@ var List = function List(props) {
|
|
4498
4507
|
className: cssClasses,
|
4499
4508
|
style: style,
|
4500
4509
|
ref: listRef
|
4501
|
-
}, ariaAttributes, restProps),
|
4502
|
-
className: "list__search"
|
4503
|
-
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
4504
|
-
id: "list-search",
|
4505
|
-
placeholder: searchPlaceholder,
|
4506
|
-
value: searchTerm,
|
4507
|
-
onChange: handleSearch,
|
4508
|
-
icon: "search",
|
4509
|
-
outlined: true,
|
4510
|
-
size: "small"
|
4511
|
-
})), sortable && sortBy && /*#__PURE__*/React__default["default"].createElement("div", {
|
4510
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && searchComponent, sortable && sortBy && /*#__PURE__*/React__default["default"].createElement("div", {
|
4512
4511
|
className: "list__sort"
|
4513
4512
|
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
4514
4513
|
className: "list__sort-button",
|
@@ -4537,7 +4536,7 @@ var List = function List(props) {
|
|
4537
4536
|
disabled: disabled,
|
4538
4537
|
animated: animated
|
4539
4538
|
});
|
4540
|
-
})), children);
|
4539
|
+
})), searchPosition === 'bottom' && searchComponent, children);
|
4541
4540
|
};
|
4542
4541
|
|
4543
4542
|
/**
|
@@ -4557,6 +4556,8 @@ var GroupedList = function GroupedList(props) {
|
|
4557
4556
|
searchable = _props$searchable2 === void 0 ? false : _props$searchable2,
|
4558
4557
|
_props$searchPlacehol2 = props.searchPlaceholder,
|
4559
4558
|
searchPlaceholder = _props$searchPlacehol2 === void 0 ? "Search..." : _props$searchPlacehol2,
|
4559
|
+
_props$searchPosition2 = props.searchPosition,
|
4560
|
+
searchPosition = _props$searchPosition2 === void 0 ? 'top' : _props$searchPosition2,
|
4560
4561
|
_props$multiSelect2 = props.multiSelect,
|
4561
4562
|
multiSelect = _props$multiSelect2 === void 0 ? false : _props$multiSelect2,
|
4562
4563
|
_props$dense2 = props.dense,
|
@@ -4603,20 +4604,25 @@ var GroupedList = function GroupedList(props) {
|
|
4603
4604
|
return next;
|
4604
4605
|
});
|
4605
4606
|
}, []);
|
4607
|
+
|
4608
|
+
// Search component for grouped list - memoized to prevent focus loss
|
4609
|
+
var groupedSearchComponent = React.useMemo(function () {
|
4610
|
+
return searchable && /*#__PURE__*/React__default["default"].createElement("div", {
|
4611
|
+
className: "list__search"
|
4612
|
+
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
4613
|
+
id: "grouped-list-search",
|
4614
|
+
placeholder: searchPlaceholder,
|
4615
|
+
value: searchTerm,
|
4616
|
+
onChange: onSearch,
|
4617
|
+
icon: "search",
|
4618
|
+
outlined: true,
|
4619
|
+
size: "small"
|
4620
|
+
}));
|
4621
|
+
}, [searchable, searchPlaceholder, searchTerm, onSearch]);
|
4606
4622
|
return /*#__PURE__*/React__default["default"].createElement("div", _extends({
|
4607
4623
|
className: cssClasses + " grouped",
|
4608
4624
|
style: style
|
4609
|
-
}, ariaAttributes, restProps),
|
4610
|
-
className: "list__search"
|
4611
|
-
}, /*#__PURE__*/React__default["default"].createElement(TextField, {
|
4612
|
-
id: "grouped-list-search",
|
4613
|
-
placeholder: searchPlaceholder,
|
4614
|
-
value: searchTerm,
|
4615
|
-
onChange: onSearch,
|
4616
|
-
icon: "search",
|
4617
|
-
outlined: true,
|
4618
|
-
size: "small"
|
4619
|
-
})), groups.map(function (group) {
|
4625
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && groupedSearchComponent, groups.map(function (group) {
|
4620
4626
|
var isCollapsed = collapsedGroups.has(group.name);
|
4621
4627
|
var groupTitle = groupRenderer ? groupRenderer(group) : /*#__PURE__*/React__default["default"].createElement(Text, null, group.name);
|
4622
4628
|
return /*#__PURE__*/React__default["default"].createElement(React.Fragment, {
|
@@ -4659,7 +4665,7 @@ var GroupedList = function GroupedList(props) {
|
|
4659
4665
|
animated: animated
|
4660
4666
|
});
|
4661
4667
|
})));
|
4662
|
-
}), children);
|
4668
|
+
}), searchPosition === 'bottom' && groupedSearchComponent, children);
|
4663
4669
|
};
|
4664
4670
|
|
4665
4671
|
/**
|
@@ -4760,14 +4766,14 @@ var ListItem = function ListItem(_ref) {
|
|
4760
4766
|
}, /*#__PURE__*/React__default["default"].createElement(Text, {
|
4761
4767
|
className: "list__item-line2",
|
4762
4768
|
size: "small"
|
4763
|
-
}, line2))),
|
4769
|
+
}, line2))), actions && /*#__PURE__*/React__default["default"].createElement("div", {
|
4770
|
+
className: "list__item-actions",
|
4771
|
+
role: "toolbar"
|
4772
|
+
}, actions), meta && /*#__PURE__*/React__default["default"].createElement("div", {
|
4764
4773
|
className: "list__item-meta"
|
4765
4774
|
}, typeof meta === 'string' ? /*#__PURE__*/React__default["default"].createElement(Text, {
|
4766
4775
|
size: "small"
|
4767
|
-
}, meta) : meta)
|
4768
|
-
className: "list__item-actions",
|
4769
|
-
role: "toolbar"
|
4770
|
-
}, actions));
|
4776
|
+
}, meta) : meta));
|
4771
4777
|
};
|
4772
4778
|
|
4773
4779
|
// PropTypes for List component
|
@@ -4809,6 +4815,8 @@ List.propTypes = {
|
|
4809
4815
|
searchPlaceholder: PropTypes.string,
|
4810
4816
|
/** Properties to search by */
|
4811
4817
|
searchBy: PropTypes.arrayOf(PropTypes.string),
|
4818
|
+
/** Search position */
|
4819
|
+
searchPosition: PropTypes.oneOf(['top', 'bottom']),
|
4812
4820
|
/** Enable sorting */
|
4813
4821
|
sortable: PropTypes.bool,
|
4814
4822
|
/** Property to sort by */
|
@@ -4823,6 +4831,8 @@ List.propTypes = {
|
|
4823
4831
|
onMultiSelect: PropTypes.func,
|
4824
4832
|
/** Dense layout */
|
4825
4833
|
dense: PropTypes.bool,
|
4834
|
+
/** Outlined variant with borders */
|
4835
|
+
outlined: PropTypes.bool,
|
4826
4836
|
/** Disabled state */
|
4827
4837
|
disabled: PropTypes.bool,
|
4828
4838
|
/** Enable animations */
|
@@ -9789,6 +9799,9 @@ var TextField2 = function TextField2(props) {
|
|
9789
9799
|
var _useState4 = React.useState(true),
|
9790
9800
|
isValid = _useState4[0],
|
9791
9801
|
setIsValid = _useState4[1];
|
9802
|
+
var _useState5 = React.useState(false),
|
9803
|
+
hasBeenTouched = _useState5[0],
|
9804
|
+
setHasBeenTouched = _useState5[1];
|
9792
9805
|
var inputRef = React.useRef(null);
|
9793
9806
|
var debounceRef = React.useRef(null);
|
9794
9807
|
|
@@ -9797,8 +9810,14 @@ var TextField2 = function TextField2(props) {
|
|
9797
9810
|
console.warn('TextField2 component: id prop is required');
|
9798
9811
|
}
|
9799
9812
|
|
9800
|
-
// Validate value and set error states
|
9813
|
+
// Validate value and set error states - only after user interaction
|
9801
9814
|
React.useEffect(function () {
|
9815
|
+
// Don't validate required fields until user has interacted with the field
|
9816
|
+
if (!hasBeenTouched && required && !value) {
|
9817
|
+
setIsValid(true);
|
9818
|
+
setInternalError('');
|
9819
|
+
return;
|
9820
|
+
}
|
9802
9821
|
if (validation && value !== undefined) {
|
9803
9822
|
var validationResult = validation(value);
|
9804
9823
|
var valid = typeof validationResult === 'boolean' ? validationResult : validationResult.valid;
|
@@ -9808,14 +9827,14 @@ var TextField2 = function TextField2(props) {
|
|
9808
9827
|
if (onValidation) {
|
9809
9828
|
onValidation(id, valid, errorMessage);
|
9810
9829
|
}
|
9811
|
-
} else if (required && !value) {
|
9830
|
+
} else if (required && !value && hasBeenTouched) {
|
9812
9831
|
setIsValid(false);
|
9813
9832
|
setInternalError('This field is required');
|
9814
9833
|
} else {
|
9815
9834
|
setIsValid(true);
|
9816
9835
|
setInternalError('');
|
9817
9836
|
}
|
9818
|
-
}, [value, required, id]); //
|
9837
|
+
}, [value, required, id, hasBeenTouched]); // Added hasBeenTouched to dependencies
|
9819
9838
|
|
9820
9839
|
// Handle input changes with debouncing
|
9821
9840
|
var handleChange = React.useCallback(function (event) {
|
@@ -9823,6 +9842,11 @@ var TextField2 = function TextField2(props) {
|
|
9823
9842
|
event.stopPropagation();
|
9824
9843
|
var newValue = event.target.value;
|
9825
9844
|
|
9845
|
+
// Mark field as touched on first change
|
9846
|
+
if (!hasBeenTouched) {
|
9847
|
+
setHasBeenTouched(true);
|
9848
|
+
}
|
9849
|
+
|
9826
9850
|
// Clear previous debounce
|
9827
9851
|
if (debounceRef.current) {
|
9828
9852
|
clearTimeout(debounceRef.current);
|
@@ -9834,7 +9858,7 @@ var TextField2 = function TextField2(props) {
|
|
9834
9858
|
} else {
|
9835
9859
|
if (onChange) onChange(id, newValue, event);
|
9836
9860
|
}
|
9837
|
-
}, [disabled, readOnly, id, onChange, debounceMs]);
|
9861
|
+
}, [disabled, readOnly, id, onChange, debounceMs, hasBeenTouched]);
|
9838
9862
|
|
9839
9863
|
// Handle key press events
|
9840
9864
|
var handleKeyPress = React.useCallback(function (event) {
|
@@ -9866,8 +9890,13 @@ var TextField2 = function TextField2(props) {
|
|
9866
9890
|
var handleBlur = React.useCallback(function (event) {
|
9867
9891
|
if (disabled) return;
|
9868
9892
|
setIsFocused(false);
|
9893
|
+
|
9894
|
+
// Mark field as touched on blur if it hasn't been touched yet
|
9895
|
+
if (!hasBeenTouched) {
|
9896
|
+
setHasBeenTouched(true);
|
9897
|
+
}
|
9869
9898
|
if (onBlur) onBlur(event);
|
9870
|
-
}, [disabled, onBlur]);
|
9899
|
+
}, [disabled, onBlur, hasBeenTouched]);
|
9871
9900
|
|
9872
9901
|
// Handle clear action
|
9873
9902
|
var handleClear = React.useCallback(function () {
|
@@ -10147,18 +10176,18 @@ var DropDown2 = function DropDown2(props) {
|
|
10147
10176
|
onSearch = props.onSearch,
|
10148
10177
|
restProps = _objectWithoutPropertiesLoose(props, _excluded2$3);
|
10149
10178
|
React.useContext(SiteContext);
|
10150
|
-
var
|
10151
|
-
isOpen =
|
10152
|
-
setIsOpen =
|
10153
|
-
var
|
10154
|
-
searchTerm =
|
10155
|
-
setSearchTerm =
|
10156
|
-
var
|
10157
|
-
focusedIndex =
|
10158
|
-
setFocusedIndex =
|
10159
|
-
var
|
10160
|
-
internalError =
|
10161
|
-
setInternalError =
|
10179
|
+
var _useState6 = React.useState(false),
|
10180
|
+
isOpen = _useState6[0],
|
10181
|
+
setIsOpen = _useState6[1];
|
10182
|
+
var _useState7 = React.useState(''),
|
10183
|
+
searchTerm = _useState7[0],
|
10184
|
+
setSearchTerm = _useState7[1];
|
10185
|
+
var _useState8 = React.useState(-1),
|
10186
|
+
focusedIndex = _useState8[0],
|
10187
|
+
setFocusedIndex = _useState8[1];
|
10188
|
+
var _useState9 = React.useState(''),
|
10189
|
+
internalError = _useState9[0],
|
10190
|
+
setInternalError = _useState9[1];
|
10162
10191
|
var dropdownRef = React.useRef(null);
|
10163
10192
|
var inputRef = React.useRef(null);
|
10164
10193
|
var listRef = React.useRef(null);
|
@@ -10586,18 +10615,18 @@ var DateRange2 = function DateRange2(props) {
|
|
10586
10615
|
onChange = props.onChange,
|
10587
10616
|
onValidation = props.onValidation,
|
10588
10617
|
restProps = _objectWithoutPropertiesLoose(props, _excluded3$1);
|
10589
|
-
var
|
10618
|
+
var _useState0 = React.useState({
|
10590
10619
|
from: '',
|
10591
10620
|
to: ''
|
10592
10621
|
}),
|
10593
|
-
form =
|
10594
|
-
setForm =
|
10595
|
-
var
|
10596
|
-
internalError =
|
10597
|
-
setInternalError =
|
10598
|
-
var
|
10599
|
-
isValid =
|
10600
|
-
setIsValid =
|
10622
|
+
form = _useState0[0],
|
10623
|
+
setForm = _useState0[1];
|
10624
|
+
var _useState1 = React.useState(''),
|
10625
|
+
internalError = _useState1[0],
|
10626
|
+
setInternalError = _useState1[1];
|
10627
|
+
var _useState10 = React.useState(true),
|
10628
|
+
isValid = _useState10[0],
|
10629
|
+
setIsValid = _useState10[1];
|
10601
10630
|
|
10602
10631
|
// Validate required props
|
10603
10632
|
if (!id) {
|