ywana-core8 0.1.81 → 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 +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.modern.js
CHANGED
@@ -4301,8 +4301,8 @@ var PasswordField = function PasswordField(props) {
|
|
4301
4301
|
}));
|
4302
4302
|
};
|
4303
4303
|
|
4304
|
-
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"],
|
4305
|
-
_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"],
|
4306
4306
|
_excluded3$2 = ["id", "icon", "iconTooltip", "line1", "line2", "meta", "avatar", "badge", "actions", "disabled"];
|
4307
4307
|
|
4308
4308
|
/**
|
@@ -4329,6 +4329,8 @@ var List = function List(props) {
|
|
4329
4329
|
searchPlaceholder = _props$searchPlacehol === void 0 ? "Search..." : _props$searchPlacehol,
|
4330
4330
|
_props$searchBy = props.searchBy,
|
4331
4331
|
searchBy = _props$searchBy === void 0 ? ['line1', 'line2'] : _props$searchBy,
|
4332
|
+
_props$searchPosition = props.searchPosition,
|
4333
|
+
searchPosition = _props$searchPosition === void 0 ? 'top' : _props$searchPosition,
|
4332
4334
|
_props$sortable = props.sortable,
|
4333
4335
|
sortable = _props$sortable === void 0 ? false : _props$sortable,
|
4334
4336
|
sortBy = props.sortBy,
|
@@ -4340,6 +4342,8 @@ var List = function List(props) {
|
|
4340
4342
|
onMultiSelect = props.onMultiSelect,
|
4341
4343
|
_props$dense = props.dense,
|
4342
4344
|
dense = _props$dense === void 0 ? false : _props$dense,
|
4345
|
+
_props$outlined = props.outlined,
|
4346
|
+
outlined = _props$outlined === void 0 ? false : _props$outlined,
|
4343
4347
|
_props$disabled = props.disabled,
|
4344
4348
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
4345
4349
|
_props$animated = props.animated,
|
@@ -4388,7 +4392,7 @@ var List = function List(props) {
|
|
4388
4392
|
}, [disabled, multiSelect, selected, onSelect, onMultiSelect]);
|
4389
4393
|
|
4390
4394
|
// Handle search
|
4391
|
-
var handleSearch = useCallback(function (
|
4395
|
+
var handleSearch = useCallback(function (_, value) {
|
4392
4396
|
setSearchTerm(value);
|
4393
4397
|
}, []);
|
4394
4398
|
|
@@ -4429,8 +4433,23 @@ var List = function List(props) {
|
|
4429
4433
|
if (onSort) onSort(newConfig);
|
4430
4434
|
}, [sortable, sortConfig, onSort]);
|
4431
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
|
+
|
4432
4451
|
// Generate CSS classes
|
4433
|
-
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(' ');
|
4434
4453
|
|
4435
4454
|
// Accessibility attributes
|
4436
4455
|
var ariaAttributes = {
|
@@ -4457,22 +4476,12 @@ var List = function List(props) {
|
|
4457
4476
|
return /*#__PURE__*/React.createElement("div", _extends({
|
4458
4477
|
className: cssClasses,
|
4459
4478
|
style: style
|
4460
|
-
}, ariaAttributes, restProps),
|
4461
|
-
className: "list__search"
|
4462
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
4463
|
-
id: "list-search",
|
4464
|
-
placeholder: searchPlaceholder,
|
4465
|
-
value: searchTerm,
|
4466
|
-
onChange: handleSearch,
|
4467
|
-
icon: "search",
|
4468
|
-
outlined: true,
|
4469
|
-
size: "small"
|
4470
|
-
})), /*#__PURE__*/React.createElement("div", {
|
4479
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && /*#__PURE__*/React.createElement(SearchComponent, null), /*#__PURE__*/React.createElement("div", {
|
4471
4480
|
className: "list__empty"
|
4472
4481
|
}, /*#__PURE__*/React.createElement(Icon, {
|
4473
4482
|
icon: emptyIcon,
|
4474
4483
|
size: "large"
|
4475
|
-
}), /*#__PURE__*/React.createElement(Text, null, emptyMessage)), children);
|
4484
|
+
}), /*#__PURE__*/React.createElement(Text, null, emptyMessage)), searchPosition === 'bottom' && /*#__PURE__*/React.createElement(SearchComponent, null), children);
|
4476
4485
|
}
|
4477
4486
|
|
4478
4487
|
// Render grouped or normal list
|
@@ -4489,17 +4498,7 @@ var List = function List(props) {
|
|
4489
4498
|
className: cssClasses,
|
4490
4499
|
style: style,
|
4491
4500
|
ref: listRef
|
4492
|
-
}, ariaAttributes, restProps),
|
4493
|
-
className: "list__search"
|
4494
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
4495
|
-
id: "list-search",
|
4496
|
-
placeholder: searchPlaceholder,
|
4497
|
-
value: searchTerm,
|
4498
|
-
onChange: handleSearch,
|
4499
|
-
icon: "search",
|
4500
|
-
outlined: true,
|
4501
|
-
size: "small"
|
4502
|
-
})), sortable && sortBy && /*#__PURE__*/React.createElement("div", {
|
4501
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && /*#__PURE__*/React.createElement(SearchComponent, null), sortable && sortBy && /*#__PURE__*/React.createElement("div", {
|
4503
4502
|
className: "list__sort"
|
4504
4503
|
}, /*#__PURE__*/React.createElement("button", {
|
4505
4504
|
className: "list__sort-button",
|
@@ -4528,7 +4527,7 @@ var List = function List(props) {
|
|
4528
4527
|
disabled: disabled,
|
4529
4528
|
animated: animated
|
4530
4529
|
});
|
4531
|
-
})), children);
|
4530
|
+
})), searchPosition === 'bottom' && /*#__PURE__*/React.createElement(SearchComponent, null), children);
|
4532
4531
|
};
|
4533
4532
|
|
4534
4533
|
/**
|
@@ -4548,6 +4547,8 @@ var GroupedList = function GroupedList(props) {
|
|
4548
4547
|
searchable = _props$searchable2 === void 0 ? false : _props$searchable2,
|
4549
4548
|
_props$searchPlacehol2 = props.searchPlaceholder,
|
4550
4549
|
searchPlaceholder = _props$searchPlacehol2 === void 0 ? "Search..." : _props$searchPlacehol2,
|
4550
|
+
_props$searchPosition2 = props.searchPosition,
|
4551
|
+
searchPosition = _props$searchPosition2 === void 0 ? 'top' : _props$searchPosition2,
|
4551
4552
|
_props$multiSelect2 = props.multiSelect,
|
4552
4553
|
multiSelect = _props$multiSelect2 === void 0 ? false : _props$multiSelect2,
|
4553
4554
|
_props$dense2 = props.dense,
|
@@ -4594,20 +4595,25 @@ var GroupedList = function GroupedList(props) {
|
|
4594
4595
|
return next;
|
4595
4596
|
});
|
4596
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
|
+
};
|
4597
4613
|
return /*#__PURE__*/React.createElement("div", _extends({
|
4598
4614
|
className: cssClasses + " grouped",
|
4599
4615
|
style: style
|
4600
|
-
}, ariaAttributes, restProps),
|
4601
|
-
className: "list__search"
|
4602
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
4603
|
-
id: "grouped-list-search",
|
4604
|
-
placeholder: searchPlaceholder,
|
4605
|
-
value: searchTerm,
|
4606
|
-
onChange: onSearch,
|
4607
|
-
icon: "search",
|
4608
|
-
outlined: true,
|
4609
|
-
size: "small"
|
4610
|
-
})), groups.map(function (group) {
|
4616
|
+
}, ariaAttributes, restProps), searchPosition === 'top' && /*#__PURE__*/React.createElement(GroupedSearchComponent, null), groups.map(function (group) {
|
4611
4617
|
var isCollapsed = collapsedGroups.has(group.name);
|
4612
4618
|
var groupTitle = groupRenderer ? groupRenderer(group) : /*#__PURE__*/React.createElement(Text, null, group.name);
|
4613
4619
|
return /*#__PURE__*/React.createElement(Fragment$2, {
|
@@ -4650,7 +4656,7 @@ var GroupedList = function GroupedList(props) {
|
|
4650
4656
|
animated: animated
|
4651
4657
|
});
|
4652
4658
|
})));
|
4653
|
-
}), children);
|
4659
|
+
}), searchPosition === 'bottom' && /*#__PURE__*/React.createElement(GroupedSearchComponent, null), children);
|
4654
4660
|
};
|
4655
4661
|
|
4656
4662
|
/**
|
@@ -4751,14 +4757,14 @@ var ListItem = function ListItem(_ref) {
|
|
4751
4757
|
}, /*#__PURE__*/React.createElement(Text, {
|
4752
4758
|
className: "list__item-line2",
|
4753
4759
|
size: "small"
|
4754
|
-
}, line2))),
|
4760
|
+
}, line2))), actions && /*#__PURE__*/React.createElement("div", {
|
4761
|
+
className: "list__item-actions",
|
4762
|
+
role: "toolbar"
|
4763
|
+
}, actions), meta && /*#__PURE__*/React.createElement("div", {
|
4755
4764
|
className: "list__item-meta"
|
4756
4765
|
}, typeof meta === 'string' ? /*#__PURE__*/React.createElement(Text, {
|
4757
4766
|
size: "small"
|
4758
|
-
}, meta) : meta)
|
4759
|
-
className: "list__item-actions",
|
4760
|
-
role: "toolbar"
|
4761
|
-
}, actions));
|
4767
|
+
}, meta) : meta));
|
4762
4768
|
};
|
4763
4769
|
|
4764
4770
|
// PropTypes for List component
|
@@ -4800,6 +4806,8 @@ List.propTypes = {
|
|
4800
4806
|
searchPlaceholder: PropTypes.string,
|
4801
4807
|
/** Properties to search by */
|
4802
4808
|
searchBy: PropTypes.arrayOf(PropTypes.string),
|
4809
|
+
/** Search position */
|
4810
|
+
searchPosition: PropTypes.oneOf(['top', 'bottom']),
|
4803
4811
|
/** Enable sorting */
|
4804
4812
|
sortable: PropTypes.bool,
|
4805
4813
|
/** Property to sort by */
|
@@ -4814,6 +4822,8 @@ List.propTypes = {
|
|
4814
4822
|
onMultiSelect: PropTypes.func,
|
4815
4823
|
/** Dense layout */
|
4816
4824
|
dense: PropTypes.bool,
|
4825
|
+
/** Outlined variant with borders */
|
4826
|
+
outlined: PropTypes.bool,
|
4817
4827
|
/** Disabled state */
|
4818
4828
|
disabled: PropTypes.bool,
|
4819
4829
|
/** Enable animations */
|
@@ -9780,6 +9790,9 @@ var TextField2 = function TextField2(props) {
|
|
9780
9790
|
var _useState4 = useState(true),
|
9781
9791
|
isValid = _useState4[0],
|
9782
9792
|
setIsValid = _useState4[1];
|
9793
|
+
var _useState5 = useState(false),
|
9794
|
+
hasBeenTouched = _useState5[0],
|
9795
|
+
setHasBeenTouched = _useState5[1];
|
9783
9796
|
var inputRef = useRef(null);
|
9784
9797
|
var debounceRef = useRef(null);
|
9785
9798
|
|
@@ -9788,8 +9801,14 @@ var TextField2 = function TextField2(props) {
|
|
9788
9801
|
console.warn('TextField2 component: id prop is required');
|
9789
9802
|
}
|
9790
9803
|
|
9791
|
-
// Validate value and set error states
|
9804
|
+
// Validate value and set error states - only after user interaction
|
9792
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
|
+
}
|
9793
9812
|
if (validation && value !== undefined) {
|
9794
9813
|
var validationResult = validation(value);
|
9795
9814
|
var valid = typeof validationResult === 'boolean' ? validationResult : validationResult.valid;
|
@@ -9799,14 +9818,14 @@ var TextField2 = function TextField2(props) {
|
|
9799
9818
|
if (onValidation) {
|
9800
9819
|
onValidation(id, valid, errorMessage);
|
9801
9820
|
}
|
9802
|
-
} else if (required && !value) {
|
9821
|
+
} else if (required && !value && hasBeenTouched) {
|
9803
9822
|
setIsValid(false);
|
9804
9823
|
setInternalError('This field is required');
|
9805
9824
|
} else {
|
9806
9825
|
setIsValid(true);
|
9807
9826
|
setInternalError('');
|
9808
9827
|
}
|
9809
|
-
}, [value, required, id]); //
|
9828
|
+
}, [value, required, id, hasBeenTouched]); // Added hasBeenTouched to dependencies
|
9810
9829
|
|
9811
9830
|
// Handle input changes with debouncing
|
9812
9831
|
var handleChange = useCallback(function (event) {
|
@@ -9814,6 +9833,11 @@ var TextField2 = function TextField2(props) {
|
|
9814
9833
|
event.stopPropagation();
|
9815
9834
|
var newValue = event.target.value;
|
9816
9835
|
|
9836
|
+
// Mark field as touched on first change
|
9837
|
+
if (!hasBeenTouched) {
|
9838
|
+
setHasBeenTouched(true);
|
9839
|
+
}
|
9840
|
+
|
9817
9841
|
// Clear previous debounce
|
9818
9842
|
if (debounceRef.current) {
|
9819
9843
|
clearTimeout(debounceRef.current);
|
@@ -9825,7 +9849,7 @@ var TextField2 = function TextField2(props) {
|
|
9825
9849
|
} else {
|
9826
9850
|
if (onChange) onChange(id, newValue, event);
|
9827
9851
|
}
|
9828
|
-
}, [disabled, readOnly, id, onChange, debounceMs]);
|
9852
|
+
}, [disabled, readOnly, id, onChange, debounceMs, hasBeenTouched]);
|
9829
9853
|
|
9830
9854
|
// Handle key press events
|
9831
9855
|
var handleKeyPress = useCallback(function (event) {
|
@@ -9857,8 +9881,13 @@ var TextField2 = function TextField2(props) {
|
|
9857
9881
|
var handleBlur = useCallback(function (event) {
|
9858
9882
|
if (disabled) return;
|
9859
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
|
+
}
|
9860
9889
|
if (onBlur) onBlur(event);
|
9861
|
-
}, [disabled, onBlur]);
|
9890
|
+
}, [disabled, onBlur, hasBeenTouched]);
|
9862
9891
|
|
9863
9892
|
// Handle clear action
|
9864
9893
|
var handleClear = useCallback(function () {
|
@@ -10138,18 +10167,18 @@ var DropDown2 = function DropDown2(props) {
|
|
10138
10167
|
onSearch = props.onSearch,
|
10139
10168
|
restProps = _objectWithoutPropertiesLoose(props, _excluded2$3);
|
10140
10169
|
useContext(SiteContext);
|
10141
|
-
var
|
10142
|
-
isOpen =
|
10143
|
-
setIsOpen =
|
10144
|
-
var
|
10145
|
-
searchTerm =
|
10146
|
-
setSearchTerm =
|
10147
|
-
var
|
10148
|
-
focusedIndex =
|
10149
|
-
setFocusedIndex =
|
10150
|
-
var
|
10151
|
-
internalError =
|
10152
|
-
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];
|
10153
10182
|
var dropdownRef = useRef(null);
|
10154
10183
|
var inputRef = useRef(null);
|
10155
10184
|
var listRef = useRef(null);
|
@@ -10577,18 +10606,18 @@ var DateRange2 = function DateRange2(props) {
|
|
10577
10606
|
onChange = props.onChange,
|
10578
10607
|
onValidation = props.onValidation,
|
10579
10608
|
restProps = _objectWithoutPropertiesLoose(props, _excluded3$1);
|
10580
|
-
var
|
10609
|
+
var _useState0 = useState({
|
10581
10610
|
from: '',
|
10582
10611
|
to: ''
|
10583
10612
|
}),
|
10584
|
-
form =
|
10585
|
-
setForm =
|
10586
|
-
var
|
10587
|
-
internalError =
|
10588
|
-
setInternalError =
|
10589
|
-
var
|
10590
|
-
isValid =
|
10591
|
-
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];
|
10592
10621
|
|
10593
10622
|
// Validate required props
|
10594
10623
|
if (!id) {
|