react-asc 19.0.0 → 19.0.4

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.
Files changed (44) hide show
  1. package/components/AutoComplete/AutoComplete.d.ts +0 -1
  2. package/components/Badge/Badge.d.ts +1 -1
  3. package/components/Breadcrumb/BreadcrumbItem.d.ts +2 -5
  4. package/components/ButtonGroup/ButtonGroup.d.ts +1 -3
  5. package/components/Card/CardBody.d.ts +1 -4
  6. package/components/Card/CardFooter.d.ts +1 -4
  7. package/components/Card/CardImage.d.ts +1 -4
  8. package/components/Card/CardSubtitle.d.ts +1 -4
  9. package/components/Card/CardText.d.ts +1 -4
  10. package/components/Checkbox/Checkbox.d.ts +0 -1
  11. package/components/Chip/Chip.d.ts +1 -1
  12. package/components/ConditionalWrapper/ConditionalWrapper.d.ts +3 -3
  13. package/components/Drawer/Drawer.d.ts +3 -4
  14. package/components/FloatingActionButton/FloatingActionButton.d.ts +1 -1
  15. package/components/Form/Form.d.ts +1 -1
  16. package/components/Form/FormHint/FormHint.d.ts +1 -4
  17. package/components/Form/FormInput/FormInput.d.ts +4 -4
  18. package/components/Form/FormLabel/FormLabel.d.ts +2 -4
  19. package/components/Form/form.interfaces.d.ts +1 -1
  20. package/components/Form/form.models.d.ts +2 -2
  21. package/components/Form/validators/IsEmptyValidator.d.ts +1 -1
  22. package/components/Form/validators/IsEqualValidator.d.ts +1 -1
  23. package/components/List/list.models.d.ts +2 -2
  24. package/components/LoadingIndicator/LoadingIndicator.d.ts +0 -2
  25. package/components/LoadingIndicator/loading-indicator.service.d.ts +2 -4
  26. package/components/Menu/Menu.d.ts +0 -1
  27. package/components/Menu/MenuBody.d.ts +1 -1
  28. package/components/Modal/Modal.d.ts +2 -2
  29. package/components/Modal/ModalHeader.d.ts +3 -4
  30. package/components/Select/Select.d.ts +2 -2
  31. package/components/SpeedDial/SpeedDialActions.d.ts +2 -6
  32. package/components/Stepper/Step/Step.d.ts +5 -2
  33. package/components/Tabs/Tab.d.ts +5 -2
  34. package/components/Tabs/TabIndicator.d.ts +2 -2
  35. package/components/Tabs/TabPanel.d.ts +0 -1
  36. package/components/Tabs/Tabs.d.ts +6 -2
  37. package/components/Tooltip/Tooltip.d.ts +2 -3
  38. package/components/TreeView/TreeItem.d.ts +6 -5
  39. package/hooks/useConstructor.d.ts +1 -1
  40. package/hooks/useDebounce.d.ts +2 -1
  41. package/index.es.js +81 -74
  42. package/index.js +81 -74
  43. package/package.json +1 -1
  44. package/react-asc.scss +52 -52
package/index.js CHANGED
@@ -257,6 +257,7 @@ function useHover() {
257
257
  const handleMouseOver = () => setValue(true);
258
258
  const handleMouseOut = () => setValue(false);
259
259
  React.useEffect(() => {
260
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
260
261
  const node = ref.current;
261
262
  if (node) {
262
263
  node.addEventListener("mouseover", handleMouseOver);
@@ -272,7 +273,7 @@ function useHover() {
272
273
  return [ref, value];
273
274
  }
274
275
 
275
- const useConstructor = (callBack = () => { }) => {
276
+ const useConstructor = (callBack) => {
276
277
  const [hasBeenCalled, setHasBeenCalled] = React.useState(false);
277
278
  if (hasBeenCalled)
278
279
  return;
@@ -583,7 +584,7 @@ const Breadcrumb = (props) => {
583
584
 
584
585
  const ConditionalWrapper = ({ condition, wrapper, children }) => condition ? wrapper(children) : children;
585
586
 
586
- var css_248z$F = ".BreadcrumbItem-module_breadcrumbItem__zsUq- + .BreadcrumbItem-module_breadcrumbItem__zsUq- {\n padding-left: 0.5rem; }\n\n.BreadcrumbItem-module_breadcrumbItem__zsUq- + .BreadcrumbItem-module_breadcrumbItem__zsUq-::before {\n float: left;\n padding-right: 0.5rem;\n color: #6c757d;\n content: \"/\"; }\n\n.BreadcrumbItem-module_breadcrumbItem__zsUq- a:not([href]):not([class]) {\n color: var(--primary); }\n\n.BreadcrumbItem-module_breadcrumbItem__zsUq-:hover {\n cursor: pointer; }\n\n.BreadcrumbItem-module_breadcrumbItem__zsUq-.BreadcrumbItem-module_active__Kn1dA:hover {\n cursor: unset; }\n";
587
+ var css_248z$F = ".BreadcrumbItem-module_breadcrumbItem__zsUq- {\n display: flex;\n align-items: center; }\n .BreadcrumbItem-module_breadcrumbItem__zsUq- + .BreadcrumbItem-module_breadcrumbItem__zsUq- {\n padding-left: 0.5rem; }\n .BreadcrumbItem-module_breadcrumbItem__zsUq- + .BreadcrumbItem-module_breadcrumbItem__zsUq-::before {\n float: left;\n padding-right: 0.5rem;\n color: #6c757d;\n content: \"/\"; }\n .BreadcrumbItem-module_breadcrumbItem__zsUq- a:not([href]):not([class]) {\n color: var(--primary); }\n .BreadcrumbItem-module_breadcrumbItem__zsUq-:hover {\n cursor: pointer; }\n .BreadcrumbItem-module_breadcrumbItem__zsUq-.BreadcrumbItem-module_active__Kn1dA:hover {\n cursor: unset; }\n";
587
588
  var styles$F = {"breadcrumbItem":"BreadcrumbItem-module_breadcrumbItem__zsUq-","active":"BreadcrumbItem-module_active__Kn1dA"};
588
589
  styleInject(css_248z$F);
589
590
 
@@ -600,9 +601,7 @@ const BreadcrumbItem = (props) => {
600
601
  onClick && onClick(event);
601
602
  };
602
603
  return (React__default["default"].createElement("li", { className: getCssClasses(), onClick: handleClick },
603
- React__default["default"].createElement(ConditionalWrapper, { condition: !isActive,
604
- // eslint-disable-next-line jsx-a11y/anchor-is-valid
605
- wrapper: label => React__default["default"].createElement("a", null, label) }, children)));
604
+ React__default["default"].createElement(ConditionalWrapper, { condition: !isActive, wrapper: label => React__default["default"].createElement("a", null, label) }, children)));
606
605
  };
607
606
 
608
607
  var css_248z$E = ".Card-module_card__TQdQq {\n background: var(--white);\n border-radius: var(--borderRadius); }\n .Card-module_card__TQdQq.Card-module_shadow__NxDVz {\n box-shadow: var(--shadow); }\n";
@@ -678,7 +677,7 @@ const CardText = (props) => {
678
677
  className && cssClasses.push(className);
679
678
  return cssClasses.filter(css => css).join(' ');
680
679
  };
681
- return (React__default["default"].createElement("p", Object.assign({ className: getCssClasses() }, rest), props.children));
680
+ return (React__default["default"].createElement("p", Object.assign({ className: getCssClasses() }, rest), children));
682
681
  };
683
682
 
684
683
  var css_248z$z = ".CardTitle-module_cardTitle__aiPSE {\n margin-bottom: 0;\n font-size: 1.5rem;\n font-weight: 400;\n line-height: 1.334;\n letter-spacing: 0em; }\n";
@@ -784,8 +783,8 @@ var css_248z$v = ".FormLabel-module_formLabel__TXcHc {\n margin-bottom: .5rem;
784
783
  var styles$v = {"formLabel":"FormLabel-module_formLabel__TXcHc"};
785
784
  styleInject(css_248z$v);
786
785
 
787
- const FormLabel = (props) => {
788
- const { children, className, htmlFor } = props, rest = __rest(props, ["children", "className", "htmlFor"]);
786
+ const FormLabel = (_a) => {
787
+ var { children, className, htmlFor } = _a, rest = __rest(_a, ["children", "className", "htmlFor"]);
789
788
  const getCssClasses = () => {
790
789
  const cssClasses = [];
791
790
  cssClasses.push(styles$v.formLabel);
@@ -801,7 +800,7 @@ const FormGroup = (props) => {
801
800
  };
802
801
 
803
802
  const FileInput = (props) => {
804
- const { id, checked, className, children, name, multiple = false, accept, disabled, onChange, readOnly, value, deletable = false } = props, rest = __rest(props, ["id", "checked", "className", "children", "name", "multiple", "accept", "disabled", "onChange", "readOnly", "value", "deletable"]);
803
+ const { id, className, children, name, multiple = false, accept, disabled, onChange, readOnly, value, deletable = false } = props, rest = __rest(props, ["id", "className", "children", "name", "multiple", "accept", "disabled", "onChange", "readOnly", "value", "deletable"]);
805
804
  const inputFileElement = React.useRef(null);
806
805
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
807
806
  const [model, setModel] = React.useState(value);
@@ -816,8 +815,7 @@ const FileInput = (props) => {
816
815
  setFileList(values);
817
816
  onChange && onChange(event);
818
817
  };
819
- const handleOnDelete = (file) => {
820
- // TODO - setModel
818
+ const handleOnDelete = () => {
821
819
  alert('coming soon');
822
820
  };
823
821
  return (React__default["default"].createElement("div", { className: "d-flex align-items-start" },
@@ -845,7 +843,7 @@ const Select = (props) => {
845
843
  return cssClasses.filter(r => r).join(' ');
846
844
  };
847
845
  React.useEffect(() => {
848
- const newValue = !!value ? value : '';
846
+ const newValue = value ? value : '';
849
847
  writeValue(newValue);
850
848
  if (newValue) {
851
849
  const option = options.find(o => o.value === newValue);
@@ -917,7 +915,7 @@ const Select = (props) => {
917
915
  let result = null;
918
916
  if (selectedOptions.length <= multipleMaxCountItems && selectedOptions.length > 0) {
919
917
  result = selectedOptions
920
- .map(o => React__default["default"].createElement(Chip, { key: o.value, className: "mr-2", color: exports.COLOR.primary, isDeletable: true, onDelete: (e) => handleOnDelete(e, o) }, o.label));
918
+ .map(option => React__default["default"].createElement(Chip, { key: option.value, className: "mr-2", color: exports.COLOR.primary, isDeletable: true, onDelete: (e) => handleOnDelete(e, option) }, option.label));
921
919
  }
922
920
  else {
923
921
  result = React__default["default"].createElement("span", null,
@@ -1003,9 +1001,11 @@ const FormInput = (props) => {
1003
1001
  !isValid && cssClasses.push('is-invalid');
1004
1002
  return cssClasses.filter(css => css).join(' ');
1005
1003
  };
1004
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1006
1005
  const handleOnInput = (value, type, name) => {
1007
1006
  onInput && onInput({ value, type, name });
1008
1007
  };
1008
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1009
1009
  const handleOnChange = (value, type, name) => {
1010
1010
  onChange && onChange({ value, type, name });
1011
1011
  };
@@ -1023,15 +1023,17 @@ const FormInput = (props) => {
1023
1023
  type === 'file' &&
1024
1024
  React__default["default"].createElement(FileInput, { id: name, name: name, className: className + (!isValid ? ' is-invalid' : ''), value: value, autoFocus: autoFocus, readOnly: readonly, disabled: disabled, onChange: e => handleOnChange(e.target.value, type, name) }, "choose a file"),
1025
1025
  type === 'textarea' &&
1026
- React__default["default"].createElement(Textarea, { id: name, name: name, className: className + (!isValid ? ' is-invalid' : ''), value: value, autoFocus: autoFocus, onInput: e => handleOnInput(e.target.value, type, name), onChange: e => handleOnChange((e === null || e === void 0 ? void 0 : e.target).value, type, name), placeholder: placeholder, rows: textareaOptions === null || textareaOptions === void 0 ? void 0 : textareaOptions.rows, style: (textareaOptions === null || textareaOptions === void 0 ? void 0 : textareaOptions.resize) !== false ? undefined : { resize: 'none' } }),
1026
+ React__default["default"].createElement(Textarea, { id: name, name: name, className: className + (!isValid ? ' is-invalid' : ''), value: value, autoFocus: autoFocus, onInput: e => handleOnInput(e.target.value, type, name), onChange: e => handleOnChange(e.target.value, type, name), placeholder: placeholder, rows: textareaOptions === null || textareaOptions === void 0 ? void 0 : textareaOptions.rows, style: (textareaOptions === null || textareaOptions === void 0 ? void 0 : textareaOptions.resize) !== false ? undefined : { resize: 'none' } }),
1027
1027
  type === 'select' &&
1028
- React__default["default"].createElement(Select, { id: name, name: name, className: className + (!isValid ? ' is-invalid' : ''), value: value, multiple: selectOptions === null || selectOptions === void 0 ? void 0 : selectOptions.multiple, onChange: e => handleOnChange(e, type, name), onKeyDown: onKeyDown, options: options }),
1028
+ React__default["default"].createElement(Select, { id: name, name: name, className: className + (!isValid ? ' is-invalid' : ''), value: value, multiple: selectOptions === null || selectOptions === void 0 ? void 0 : selectOptions.multiple, onChange: e => handleOnChange(e, type, name),
1029
+ // onKeyDown={e => onKeyDown(e)}
1030
+ options: options }),
1029
1031
  type === 'autocomplete' &&
1030
- React__default["default"].createElement(AutoComplete, { id: name, name: name, className: className + (!isValid ? ' is-invalid' : ''), value: value, openOnFocus: autoCompleteOptions === null || autoCompleteOptions === void 0 ? void 0 : autoCompleteOptions.openOnFocus, onChange: e => handleOnChange(e, type, name), onKeyDown: onKeyDown, options: options }),
1032
+ React__default["default"].createElement(AutoComplete, { id: name, name: name, className: className + (!isValid ? ' is-invalid' : ''), value: value, openOnFocus: autoCompleteOptions === null || autoCompleteOptions === void 0 ? void 0 : autoCompleteOptions.openOnFocus, onChange: e => handleOnChange(e, type, name), options: options }),
1031
1033
  type === 'checkbox' &&
1032
- React__default["default"].createElement(Checkbox, { id: name, name: name, label: label, className: (!isValid ? ' is-invalid' : ''), onChange: e => handleOnChange((e === null || e === void 0 ? void 0 : e.target).checked, type, name), checked: value, onKeyDown: onKeyDown }),
1034
+ React__default["default"].createElement(Checkbox, { id: name, name: name, label: label, className: (!isValid ? ' is-invalid' : ''), onChange: e => handleOnChange((e === null || e === void 0 ? void 0 : e.target).checked, type, name), checked: value === 'true' ? true : false }),
1033
1035
  type === 'radio' &&
1034
- React__default["default"].createElement(React.Fragment, null, options.map((option) => React__default["default"].createElement("div", { className: "form-check", key: option.id },
1036
+ React__default["default"].createElement(React__default["default"].Fragment, null, options.map((option) => React__default["default"].createElement("div", { className: "form-check", key: option.id },
1035
1037
  React__default["default"].createElement("input", { id: option.id ? option.id : option.value, name: name, type: "radio", className: "form-check-input", onChange: e => handleOnChange((e === null || e === void 0 ? void 0 : e.target).value, type, name), value: option.value, checked: value === option.value, onKeyDown: onKeyDown }),
1036
1038
  React__default["default"].createElement("label", { className: "form-check-label", htmlFor: option.id }, option.label))))));
1037
1039
  };
@@ -1052,7 +1054,7 @@ const FormError = (props) => {
1052
1054
  React__default["default"].createElement("div", { className: className }, errors.map(e => React__default["default"].createElement("div", { key: e.validator }, e.message)))));
1053
1055
  };
1054
1056
 
1055
- const IsEmptyValidator = (value) => value === '' || value === null || value === undefined;
1057
+ const IsEmptyValidator = (value) => value.trim() === '' || value === null || value === undefined;
1056
1058
 
1057
1059
  const EmailValidator = (value) => {
1058
1060
  const isInvalidEmailFormat = value.match(/^([\w.%+-]+)@([\w-]+\.)+([\w]{2,})$/i) === null;
@@ -1082,7 +1084,7 @@ class Form extends React.Component {
1082
1084
  const values = keys.reduce((obj, f) => {
1083
1085
  const control = this.getControl(f);
1084
1086
  // TODO - refactor
1085
- const newValue = ((control.type === 'date' || control.type === 'datetime-local') && control.value && isValidDate(control.value)) ? new Date(control.value).toISOString() : control.value;
1087
+ const newValue = ((control.type === 'date' || control.type === 'datetime-local') && control.value && isValidDate((control.value))) ? new Date((control.value)).toISOString() : control.value;
1086
1088
  return (Object.assign(Object.assign({}, obj), { [f]: newValue }));
1087
1089
  }, {});
1088
1090
  if (this.state.isValid && this.state.isSubmitted) {
@@ -1129,7 +1131,7 @@ class Form extends React.Component {
1129
1131
  }
1130
1132
  return errors;
1131
1133
  }
1132
- handleInputChange(name, value, type) {
1134
+ handleInputChange(name, value) {
1133
1135
  const field = this.getControl(name);
1134
1136
  field.value = value;
1135
1137
  // redundant mit handleOnBlur
@@ -1154,7 +1156,6 @@ class Form extends React.Component {
1154
1156
  }
1155
1157
  }
1156
1158
  }
1157
- ;
1158
1159
  isRequired(fieldName) {
1159
1160
  let result = false;
1160
1161
  result = this.getControl(fieldName).validators.indexOf('required') >= 0;
@@ -1173,7 +1174,6 @@ class Form extends React.Component {
1173
1174
  const cssClasses = [labelClassName, this.isRequired(fieldKey) ? 'required' : undefined];
1174
1175
  return React__default["default"].createElement(FormLabel, { htmlFor: fieldKey, className: cssClasses.join(' ') }, label);
1175
1176
  }
1176
- ;
1177
1177
  // trigger via ref
1178
1178
  handleFormSubmit() {
1179
1179
  for (const fieldKey of Object.keys(this.state.controls)) {
@@ -1215,7 +1215,7 @@ class Form extends React.Component {
1215
1215
  this.setState({ controls: {}, isValid: false, isChanged: false, isSubmitted: false });
1216
1216
  }
1217
1217
  getFormGroupCssClass(fieldKey) {
1218
- let result = this.getControl(fieldKey).config.formGroupClassName;
1218
+ const result = this.getControl(fieldKey).config.formGroupClassName;
1219
1219
  return result;
1220
1220
  }
1221
1221
  render() {
@@ -1223,7 +1223,7 @@ class Form extends React.Component {
1223
1223
  return (React__default["default"].createElement(FormGroup, { key: fieldKey, className: this.getFormGroupCssClass(fieldKey) },
1224
1224
  this.getControl(fieldKey).config.labelPosition !== 'behind' && this.getControl(fieldKey).type !== 'checkbox' &&
1225
1225
  this.renderLabel(fieldKey, this.getControl(fieldKey).config.label, this.getControl(fieldKey).config.labelClassName),
1226
- React__default["default"].createElement(FormInput, { autoFocus: this.getControl(fieldKey).config.autoFocus, className: this.getControl(fieldKey).config.formControlClassName, isValid: !this.isInvalid(fieldKey), label: this.getControl(fieldKey).config.label, name: fieldKey, options: this.getControl(fieldKey).config.options, placeholder: this.getControl(fieldKey).config.placeholder, textareaOptions: this.getControl(fieldKey).config.textareaOptions, selectOptions: this.getControl(fieldKey).config.selectOptions, autoCompleteOptions: this.getControl(fieldKey).config.autoCompleteOptions, type: this.getControl(fieldKey).type, value: this.getControl(fieldKey).value, disabled: this.getControl(fieldKey).config.disabled, readonly: this.getControl(fieldKey).config.readonly, onChange: ({ name, value, type }) => this.handleInputChange(name, value, type), onBlur: (e) => this.handleOnBlur(e), onKeyDown: (e) => this.handleOnKeyDown(e) }),
1226
+ React__default["default"].createElement(FormInput, { autoFocus: this.getControl(fieldKey).config.autoFocus, className: this.getControl(fieldKey).config.formControlClassName, isValid: !this.isInvalid(fieldKey), label: this.getControl(fieldKey).config.label, name: fieldKey, options: this.getControl(fieldKey).config.options, placeholder: this.getControl(fieldKey).config.placeholder, textareaOptions: this.getControl(fieldKey).config.textareaOptions, selectOptions: this.getControl(fieldKey).config.selectOptions, autoCompleteOptions: this.getControl(fieldKey).config.autoCompleteOptions, type: this.getControl(fieldKey).type, value: this.getControl(fieldKey).value, disabled: this.getControl(fieldKey).config.disabled, readonly: this.getControl(fieldKey).config.readonly, onChange: ({ name, value }) => this.handleInputChange(name, value), onBlur: (e) => this.handleOnBlur(e), onKeyDown: (e) => this.handleOnKeyDown(e) }),
1227
1227
  this.getControl(fieldKey).config.labelPosition === 'behind' && this.getControl(fieldKey).type !== 'checkbox' &&
1228
1228
  this.renderLabel(fieldKey, this.getControl(fieldKey).config.label, this.getControl(fieldKey).config.labelClassName),
1229
1229
  this.getControl(fieldKey).config.hint &&
@@ -1238,7 +1238,9 @@ function isValidDate(dateObject) {
1238
1238
  }
1239
1239
 
1240
1240
  class FormControl {
1241
- constructor(value, validators = [], type, config) {
1241
+ constructor(
1242
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1243
+ value, validators = [], type, config) {
1242
1244
  this.value = value;
1243
1245
  this.validators = validators;
1244
1246
  this.type = type;
@@ -1255,7 +1257,7 @@ const DaySelect = (props) => {
1255
1257
  init();
1256
1258
  }, [month, year]);
1257
1259
  const init = () => {
1258
- var daysInMonth = new Date(year, month + 1, 0).getDate();
1260
+ const daysInMonth = new Date(year, month + 1, 0).getDate();
1259
1261
  const newDays = [];
1260
1262
  for (let i = 1; i <= daysInMonth; i++) {
1261
1263
  newDays.push({ value: i.toString(), label: i.toString() });
@@ -1364,12 +1366,12 @@ const DateSelect = (props) => {
1364
1366
  // return Math.ceil((((d - yearStart) / 86400000) + 1) / 7)
1365
1367
  // };
1366
1368
 
1367
- var css_248z$r = ".Drawer-module_drawer__kdQCk {\n height: 100%;\n z-index: 1101;\n bottom: 0;\n position: fixed;\n background: white;\n min-width: 280px;\n overflow-y: auto; }\n .Drawer-module_drawer__kdQCk.Drawer-module_permanent__c-y8y {\n position: inherit;\n z-index: 0; }\n .Drawer-module_drawer__kdQCk.Drawer-module_left__loQVO {\n order: 0; }\n .Drawer-module_drawer__kdQCk.Drawer-module_right__sJ3mZ {\n order: 2; }\n\n.Drawer-module_drawerOpen__07ptP {\n overflow: hidden; }\n";
1368
- var styles$r = {"drawer":"Drawer-module_drawer__kdQCk","permanent":"Drawer-module_permanent__c-y8y","left":"Drawer-module_left__loQVO","right":"Drawer-module_right__sJ3mZ","drawerOpen":"Drawer-module_drawerOpen__07ptP"};
1369
+ var css_248z$r = ".Drawer-module_drawer__kdQCk {\n height: 100%;\n z-index: 1101;\n bottom: 0;\n position: fixed;\n background: white;\n min-width: 280px;\n overflow-y: auto; }\n .Drawer-module_drawer__kdQCk.Drawer-module_permanent__c-y8y {\n position: inherit;\n z-index: 0; }\n .Drawer-module_drawer__kdQCk.Drawer-module_left__loQVO {\n order: 0; }\n .Drawer-module_drawer__kdQCk.Drawer-module_right__sJ3mZ {\n order: 2; }\n .Drawer-module_drawer__kdQCk.Drawer-module_shadow__Myo3n {\n box-shadow: var(--shadow); }\n\n.Drawer-module_drawerOpen__07ptP {\n overflow: hidden; }\n";
1370
+ var styles$r = {"drawer":"Drawer-module_drawer__kdQCk","permanent":"Drawer-module_permanent__c-y8y","left":"Drawer-module_left__loQVO","right":"Drawer-module_right__sJ3mZ","shadow":"Drawer-module_shadow__Myo3n","drawerOpen":"Drawer-module_drawerOpen__07ptP"};
1369
1371
  styleInject(css_248z$r);
1370
1372
 
1371
1373
  const Drawer = (props) => {
1372
- const { children, className, position = 'left', permanent = false, target = document.body, onClickBackdrop } = props;
1374
+ const { children, className, position = 'left', permanent = false, target = document.body, shadow = true, onClickBackdrop } = props, rest = __rest(props, ["children", "className", "position", "permanent", "target", "shadow", "onClickBackdrop"]);
1373
1375
  React.useEffect(() => {
1374
1376
  document.body.classList.add(styles$r.drawerOpen);
1375
1377
  return () => {
@@ -1379,18 +1381,19 @@ const Drawer = (props) => {
1379
1381
  const handleClickBackdrop = () => {
1380
1382
  onClickBackdrop && onClickBackdrop();
1381
1383
  };
1382
- return reactDom.createPortal(React__default["default"].createElement(React.Fragment, null,
1383
- React__default["default"].createElement(DrawerContent, { className: className, position: position, permanent: permanent }, children),
1384
+ return reactDom.createPortal(React__default["default"].createElement(React__default["default"].Fragment, null,
1385
+ React__default["default"].createElement(DrawerContent, Object.assign({ className: className, position: position, permanent: permanent, shadow: shadow }, rest), children),
1384
1386
  !permanent && React__default["default"].createElement(Backdrop, { onClick: handleClickBackdrop })), target);
1385
1387
  };
1386
1388
  const DrawerContent = (props) => {
1387
- const { children, className, position = 'left', permanent = false } = props;
1389
+ const { children, className, position = 'left', permanent = false, shadow } = props, rest = __rest(props, ["children", "className", "position", "permanent", "shadow"]);
1388
1390
  const getCssClasses = () => {
1389
1391
  const cssClasses = [];
1390
1392
  cssClasses.push(styles$r.drawer);
1391
- className && cssClasses.push(className);
1393
+ shadow && cssClasses.push(styles$r.shadow);
1392
1394
  !!permanent && cssClasses.push(styles$r['permanent']);
1393
1395
  position === 'left' ? cssClasses.push(styles$r['left']) : cssClasses.push(styles$r['right']);
1396
+ className && cssClasses.push(className);
1394
1397
  return cssClasses.filter(css => css).join(' ');
1395
1398
  };
1396
1399
  const positionStyles = {
@@ -1400,7 +1403,7 @@ const DrawerContent = (props) => {
1400
1403
  const getStyles = () => {
1401
1404
  return !permanent ? positionStyles[position] : undefined;
1402
1405
  };
1403
- return (React__default["default"].createElement("div", { className: getCssClasses(), style: getStyles() }, children));
1406
+ return (React__default["default"].createElement("div", Object.assign({ className: getCssClasses(), style: getStyles() }, rest), children));
1404
1407
  };
1405
1408
 
1406
1409
  var css_248z$q = ".MenuBody-module_menuBody__u4FIQ {\n z-index: 1111;\n margin: 0;\n position: absolute;\n top: 100%;\n left: 0;\n min-width: 10rem;\n padding: 8px 0px;\n font-size: 1rem;\n color: #212529;\n text-align: left;\n list-style: none;\n background-color: #fff;\n background-clip: padding-box;\n border-radius: var(--borderRadius); }\n .MenuBody-module_menuBody__u4FIQ.MenuBody-module_shadow__OBp-f {\n box-shadow: var(--shadow); }\n";
@@ -1411,14 +1414,15 @@ const MenuBody = (props) => {
1411
1414
  const { parentRef, children, className, shadow = true, menuPosition = 'left', onClickBackdrop } = props;
1412
1415
  const menuBodyRef = React.useRef(null);
1413
1416
  React.useEffect(() => {
1414
- if (menuBodyRef) {
1417
+ if (menuBodyRef && parentRef.current && menuBodyRef.current) {
1415
1418
  core.createPopper(parentRef.current, menuBodyRef.current, {
1416
1419
  placement: `${menuPosition}-start`,
1417
1420
  modifiers: [
1418
1421
  {
1419
1422
  name: 'offset',
1420
1423
  options: {
1421
- offset: ({ placement, reference, popper }) => {
1424
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1425
+ offset: ({ placement, popper }) => {
1422
1426
  if (placement === 'left-start') {
1423
1427
  return [0, -popper.width]; // y, x
1424
1428
  }
@@ -1453,7 +1457,7 @@ var styles$p = {"menu":"Menu-module_menu__p8QL-"};
1453
1457
  styleInject(css_248z$p);
1454
1458
 
1455
1459
  const Menu = (props) => {
1456
- const { toggle, children, className, open, menuPosition, onClickBackdrop, onToggleClick } = props, rest = __rest(props, ["toggle", "children", "className", "open", "menuPosition", "onClickBackdrop", "onToggleClick"]);
1460
+ const { toggle, children, className, open, menuPosition, onClickBackdrop } = props, rest = __rest(props, ["toggle", "children", "className", "open", "menuPosition", "onClickBackdrop"]);
1457
1461
  const menuContainer = React.useRef(null);
1458
1462
  const toggleContainerRef = React.useRef(null);
1459
1463
  const getCssClasses = () => {
@@ -1489,9 +1493,7 @@ const MenuItem = (props) => {
1489
1493
  e.stopPropagation();
1490
1494
  onClick && onClick(e);
1491
1495
  };
1492
- return (React__default["default"].createElement(ConditionalWrapper, { condition: true, wrapper: children => ((type === 'item' ? (
1493
- // eslint-disable-next-line jsx-a11y/anchor-is-valid
1494
- React__default["default"].createElement("a", { className: getCssClasses(), onClick: handleClick }, children)) :
1496
+ return (React__default["default"].createElement(ConditionalWrapper, { condition: true, wrapper: children => ((type === 'item' ? (React__default["default"].createElement("a", { className: getCssClasses(), onClick: handleClick }, children)) :
1495
1497
  React__default["default"].createElement("div", { className: getCssClasses(), onClick: handleClick }, children))) }, children));
1496
1498
  };
1497
1499
 
@@ -1653,23 +1655,21 @@ const LoadingIndicatorContainer = ({ children }) => {
1653
1655
 
1654
1656
  class LoadingIndicatorService {
1655
1657
  show() {
1656
- return new Promise((resolve, reject) => {
1657
- if (this.container) {
1658
- this.hide();
1659
- }
1660
- this.container = document.createElement('div');
1661
- this.container.classList.add('snackbar-container');
1662
- document.body.appendChild(this.container);
1663
- reactDom.render(React__default["default"].createElement(LoadingIndicatorContainer, null,
1664
- React__default["default"].createElement(LoadingIndicator, null)), this.container);
1665
- });
1658
+ if (this.container) {
1659
+ this.hide();
1660
+ }
1661
+ this.container = document.createElement('div');
1662
+ this.container.classList.add('snackbar-container');
1663
+ document.body.appendChild(this.container);
1664
+ reactDom.render(React__default["default"].createElement(LoadingIndicatorContainer, null,
1665
+ React__default["default"].createElement(LoadingIndicator, null)), this.container);
1666
1666
  }
1667
1667
  hide() {
1668
1668
  if (this.container) {
1669
1669
  reactDom.unmountComponentAtNode(this.container);
1670
1670
  document.body.removeChild(this.container);
1671
- this.container = null;
1672
- clearTimeout(this.handler);
1671
+ this.container = undefined;
1672
+ this.handler && clearTimeout(this.handler);
1673
1673
  }
1674
1674
  }
1675
1675
  }
@@ -1680,11 +1680,11 @@ var styles$h = {"modalHeader":"ModalHeader-module_modalHeader__tw-u-"};
1680
1680
  styleInject(css_248z$h);
1681
1681
 
1682
1682
  const ModalHeader = (props) => {
1683
- const { children, isDismissable = false, onClose } = props;
1683
+ const { children, isDismissable = false, onClose } = props, rest = __rest(props, ["children", "isDismissable", "onClose"]);
1684
1684
  const handleClick = () => {
1685
1685
  onClose && onClose();
1686
1686
  };
1687
- return (React__default["default"].createElement("div", { className: "modal-header " + styles$h.modalHeader },
1687
+ return (React__default["default"].createElement("div", Object.assign({ className: "modal-header " + styles$h.modalHeader }, rest),
1688
1688
  React__default["default"].createElement("h5", { className: "modal-title" }, children),
1689
1689
  isDismissable &&
1690
1690
  React__default["default"].createElement(IconButton, { icon: React__default["default"].createElement(TimesSolidIcon, null), variant: exports.VARIANT.text, onClick: handleClick })));
@@ -1725,7 +1725,7 @@ const Modal = (props) => {
1725
1725
  return (React__default["default"].createElement(React.Fragment, null,
1726
1726
  React__default["default"].createElement("div", { className: "modal show " + styles$g.modal, style: { display: 'block' } },
1727
1727
  React__default["default"].createElement("div", { className: getCssClass() },
1728
- React__default["default"].createElement("div", { className: 'modal-content ' + (!!fullScreen ? styles$g['modalContent'] : undefined) },
1728
+ React__default["default"].createElement("div", { className: 'modal-content ' + (fullScreen ? styles$g['modalContent'] : undefined) },
1729
1729
  header &&
1730
1730
  React__default["default"].createElement(ModalHeader, { isDismissable: isDismissable, onClose: () => onHeaderCloseClick && onHeaderCloseClick() }, header),
1731
1731
  React__default["default"].createElement(ModalBody, null, children),
@@ -1954,7 +1954,7 @@ class SnackbarService {
1954
1954
  show(message, options) {
1955
1955
  const defaultOptions = { timeout: 3000, actionText: 'ok', color: exports.COLOR.dark, target: document.body };
1956
1956
  const mergedOptions = Object.assign(defaultOptions, options);
1957
- return new Promise((resolve, reject) => {
1957
+ return new Promise((resolve) => {
1958
1958
  if (this.container) {
1959
1959
  this.hide();
1960
1960
  }
@@ -1977,8 +1977,8 @@ class SnackbarService {
1977
1977
  if (this.container) {
1978
1978
  reactDom.unmountComponentAtNode(this.container);
1979
1979
  document.body.removeChild(this.container);
1980
- this.container = null;
1981
- clearTimeout(this.handler);
1980
+ this.container = undefined;
1981
+ this.handler && clearTimeout(this.handler);
1982
1982
  }
1983
1983
  }
1984
1984
  }
@@ -2132,7 +2132,7 @@ const Stepper = (props) => {
2132
2132
  isDisabled: isLinear && (activeIndex + 1 < index),
2133
2133
  showLabel: showLabel,
2134
2134
  showProgressCheckIcon: showProgressCheckIcon,
2135
- onClick: (event, val) => handleClickStep(event, val, index)
2135
+ onClick: (e) => handleClickStep(e.event, e.value, index)
2136
2136
  });
2137
2137
  };
2138
2138
  const isStepOptional = (index) => {
@@ -2225,9 +2225,9 @@ styleInject(css_248z$6);
2225
2225
  const Step = (props) => {
2226
2226
  const { className, label, showLabel, index, value, isActive, isDone, isDisabled, showProgressCheckIcon, onClick } = props;
2227
2227
  const [hoverRef, isHovered] = useHover();
2228
- const handleClick = (e) => {
2228
+ const handleClick = (event) => {
2229
2229
  if (!isDisabled) {
2230
- onClick && onClick(e, value);
2230
+ onClick && onClick({ event, value });
2231
2231
  }
2232
2232
  };
2233
2233
  const getCssClasses = () => {
@@ -2245,11 +2245,18 @@ const Step = (props) => {
2245
2245
  isDisabled && cssClasses.push(styles$6['disabled']);
2246
2246
  return cssClasses.filter(css => css).join(' ');
2247
2247
  };
2248
+ const getCssClassesStepValue = () => {
2249
+ const cssClasses = [];
2250
+ cssClasses.push(styles$6.stepValue);
2251
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2252
+ isActive && cssClasses.push(styles$6.stepValue['isActive']);
2253
+ return cssClasses.filter(css => css).join(' ');
2254
+ };
2248
2255
  return (React__default["default"].createElement("div", { ref: hoverRef, className: getCssClasses(), onClick: handleClick },
2249
2256
  React__default["default"].createElement("div", { className: getCssClassesStep() },
2250
2257
  React__default["default"].createElement(Icon, { className: styles$6.stepIconCircle, iconColor: (isHovered || isActive) && !isDisabled ? exports.COLOR.primary : exports.COLOR.secondary },
2251
2258
  React__default["default"].createElement(CircleSolidIcon, null)),
2252
- React__default["default"].createElement("div", { className: styles$6.stepValue + ' ' + (isActive ? (styles$6.stepValue['isActive']) : '') }, showProgressCheckIcon && isActive && isDone ?
2259
+ React__default["default"].createElement("div", { className: getCssClassesStepValue() }, showProgressCheckIcon && isActive && isDone ?
2253
2260
  React__default["default"].createElement(Icon, null,
2254
2261
  React__default["default"].createElement(CheckSolidIcon, null))
2255
2262
  :
@@ -2315,17 +2322,17 @@ const Tabs = (props) => {
2315
2322
  const handleClickTab = (event, newValue, index) => {
2316
2323
  setSelectedValue(newValue);
2317
2324
  setSelectedIndex(index);
2318
- onChange && onChange(event, newValue);
2325
+ onChange && onChange({ event, newValue });
2319
2326
  };
2320
2327
  const renderTabs = (child, index) => {
2321
2328
  return React__default["default"].isValidElement(child) && React.cloneElement(child, {
2322
2329
  key: child.props.value,
2323
2330
  isActive: child.props.value === selectedValue,
2324
2331
  fixed: fixed,
2325
- onClick: (event, newValue) => handleClickTab(event, newValue, index),
2332
+ onClick: (e) => handleClickTab(e.event, e.value, index),
2326
2333
  });
2327
2334
  };
2328
- return (React__default["default"].createElement(React.Fragment, null,
2335
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
2329
2336
  React__default["default"].createElement("div", { className: getCssClasses() },
2330
2337
  children && React__default["default"].Children.toArray(children).map((child, index) => renderTabs(child, index)),
2331
2338
  children &&
@@ -2347,11 +2354,11 @@ const Tab = (props) => {
2347
2354
  className && cssClasses.push(className);
2348
2355
  return cssClasses.filter(css => css).join(' ');
2349
2356
  };
2350
- return (React__default["default"].createElement(Button, { className: getCssClasses(), onClick: (event) => onClick && onClick(event, value), isActive: isActive, disabled: disabled }, label));
2357
+ return (React__default["default"].createElement(Button, { className: getCssClasses(), onClick: (event) => onClick && onClick({ event, value }), isActive: isActive, disabled: disabled }, label));
2351
2358
  };
2352
2359
 
2353
2360
  const TabPanel = (props) => {
2354
- const { children, className, value, index } = props, rest = __rest(props, ["children", "className", "value", "index"]);
2361
+ const { children, value, index } = props, rest = __rest(props, ["children", "value", "index"]);
2355
2362
  return (React__default["default"].createElement("div", Object.assign({ role: "tabpanel", hidden: value !== index, id: `tabpanel-${index}`, "aria-labelledby": `wrapped-tab-${index}` }, rest), value === index && children));
2356
2363
  };
2357
2364
 
@@ -2362,10 +2369,10 @@ styleInject(css_248z$2);
2362
2369
  const Tooltip = (props) => {
2363
2370
  const { children, text, placement = 'bottom' } = props;
2364
2371
  const [show, setShow] = React.useState(false);
2365
- const refChild = React.useRef(null);
2366
- const refTooltip = React.useRef(null);
2372
+ const refChild = React.useRef();
2373
+ const refTooltip = React.useRef();
2367
2374
  React.useEffect(() => {
2368
- if (show === true && refChild && refChild.current) {
2375
+ if (show === true && refChild && refChild.current && refTooltip && refTooltip.current) {
2369
2376
  // TODO - extract to own component?
2370
2377
  core.createPopper(refChild.current, refTooltip.current, {
2371
2378
  placement: placement,
@@ -2384,7 +2391,7 @@ const Tooltip = (props) => {
2384
2391
  const handleMouseLeave = () => {
2385
2392
  setShow(false);
2386
2393
  };
2387
- return (React__default["default"].createElement(React.Fragment, null,
2394
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
2388
2395
  React__default["default"].createElement("div", { className: styles$2.tooltipContainer, ref: refChild, id: "tooltip-container" }, React.cloneElement(children, {
2389
2396
  onMouseOver: handleMouseOver,
2390
2397
  onMouseLeave: handleMouseLeave,
@@ -2554,7 +2561,7 @@ var styles = {"treeItem":"TreeItem-module_treeItem__Mxsjr"};
2554
2561
  styleInject(css_248z);
2555
2562
 
2556
2563
  const TreeItem = (props) => {
2557
- const { nodeId, label, children, className, isExpanded, isSelected, isSelectable, onToggleExpand, onSelect } = props;
2564
+ const { nodeId, label, children, className, isExpanded, isSelected, isSelectable, onToggleExpand, onItemSelect } = props;
2558
2565
  const [_isExpanded, setIsExpanded] = React.useState(false);
2559
2566
  const [_isSelected, setIsSelected] = React.useState(false);
2560
2567
  const getCssClasses = () => {
@@ -2577,7 +2584,7 @@ const TreeItem = (props) => {
2577
2584
  };
2578
2585
  const handleOnSelect = (nodeId) => {
2579
2586
  setIsSelected(!_isSelected);
2580
- onSelect && onSelect(nodeId, !_isSelected);
2587
+ onItemSelect && onItemSelect({ id: nodeId, isSelected: !_isSelected });
2581
2588
  };
2582
2589
  return (React__default["default"].createElement("li", { className: getCssClasses(), style: { paddingLeft: `${(48 * (children ? 0 : 1))}px` } },
2583
2590
  React__default["default"].createElement("div", { className: "d-flex align-items-center" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-asc",
3
- "version": "19.0.0",
3
+ "version": "19.0.4",
4
4
  "description": "handcrafted react components",
5
5
  "main": "index.js",
6
6
  "module": "index.es.js",
package/react-asc.scss CHANGED
@@ -1,3 +1,55 @@
1
+ :root {
2
+ --primary-light: #6573c3;
3
+ --primary: #3f51b5;
4
+ --primary-dark: #2c387e;
5
+ --primary-contrast-text: #fff;
6
+ --primary-highlight: #d6dbf7;
7
+
8
+ --secondary-light: #e5e7eb;
9
+ --secondary: #dfe1e6;
10
+ --secondary-dark: #9c9da1;
11
+ --secondary-contrast-text: #fff;
12
+ --secondary-highlight: rgb(232, 234, 250);
13
+
14
+ --accent-light: #fd96b8;
15
+ --accent: #ff4081;
16
+ --accent-dark: #fd2c72;
17
+ --accent-contrast-text: #fff;
18
+ --accent-highlight: #fca9c5;
19
+
20
+ // rename!?
21
+ --light-light: #ffffff;
22
+ --light: #f8f9fa;
23
+ --light-dark: #ebebeb;
24
+ --light-contrast-text: #212529;
25
+ --light-highlight: #f8f9fa;
26
+
27
+ --dark-light: #616468;
28
+ --dark: #343a40;
29
+ --dark-dark: #343a40;
30
+ --dark-contrast-text: #fff;
31
+ --dark-highlight: #5e6164;
32
+
33
+ --white: #fff;
34
+
35
+ --bodyBg: white;
36
+ --bodyColor: #212529;
37
+
38
+ --borderRadius: 5px;
39
+ --shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14),
40
+ 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
41
+
42
+ --buttonMinWidth: 62px;
43
+ --buttonPadding: 11px 15px;
44
+
45
+ --fontFamily: "Segoe UI", "Roboto", "Helvetica Neue", "Arial";
46
+ --fontSize: 16px;
47
+
48
+ --highlight: rgba(204, 216, 224, 0.2); // ???
49
+
50
+ --breakpointMd: 768px;
51
+ }
52
+
1
53
  .input-group-append {
2
54
  .btn {
3
55
  min-width: auto;
@@ -112,58 +164,6 @@
112
164
  }
113
165
 
114
166
 
115
- // TODO
116
- :root {
117
- --primary-light: #6573c3;
118
- --primary: #3f51b5;
119
- --primary-dark: #2c387e;
120
- --primary-contrast-text: #fff;
121
- --primary-highlight: #d6dbf7;
122
-
123
- --secondary-light: #e5e7eb;
124
- --secondary: #dfe1e6;
125
- --secondary-dark: #9c9da1;
126
- --secondary-contrast-text: #fff;
127
- --secondary-highlight: rgb(232, 234, 250);
128
-
129
- --accent-light: #fd96b8;
130
- --accent: #ff4081;
131
- --accent-dark: #fd2c72;
132
- --accent-contrast-text: #fff;
133
- --accent-highlight: #fca9c5;
134
-
135
- // rename!?
136
- --light-light: #ffffff;
137
- --light: #f8f9fa;
138
- --light-dark: #ebebeb;
139
- --light-contrast-text: #212529;
140
- --light-highlight: #f8f9fa;
141
-
142
- --dark-light: #616468;
143
- --dark: #343a40;
144
- --dark-dark: #343a40;
145
- --dark-contrast-text: #fff;
146
- --dark-highlight: #5e6164;
147
-
148
- --white: #fff;
149
-
150
- --bodyBg: #f8f9fa;
151
- --bodyColor: #212529;
152
-
153
- --borderRadius: 5px;
154
- --shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
155
-
156
- --buttonMinWidth: 62px;
157
- --buttonPadding: 11px 15px;
158
-
159
- --fontFamily: "Segoe UI", "Roboto", "Helvetica Neue", "Arial";
160
- --fontSize: 16px;
161
-
162
- --highlight: rgba(204, 216, 224, 0.2); // ???
163
-
164
- --breakpointMd: 768px;
165
- }
166
-
167
167
  label.required {
168
168
  &::after {
169
169
  display: inline-block;