react-asc 19.0.0 → 19.0.1

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.
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  export interface ICheckboxProps extends React.ComponentProps<"input"> {
3
3
  label?: string;
4
4
  value?: string;
5
- onChange?: (val: React.FocusEvent<HTMLInputElement>) => void;
6
5
  onKeyDown?: (event: React.KeyboardEvent) => void;
7
6
  }
8
7
  export declare const Checkbox: (props: ICheckboxProps) => JSX.Element;
@@ -1,8 +1,7 @@
1
- import React, { ReactNode } from 'react';
2
- export interface IDrawerProps {
3
- children?: ReactNode;
1
+ import React from 'react';
2
+ export interface IDrawerProps extends React.ComponentProps<"div"> {
4
3
  position?: 'left' | 'right';
5
- className?: string;
4
+ shadow?: boolean;
6
5
  onClickBackdrop?: () => void;
7
6
  permanent?: boolean;
8
7
  target?: HTMLElement;
@@ -31,7 +31,7 @@ export declare class Form extends Component<IFormProps, IFormState> {
31
31
  private renderLabel;
32
32
  handleFormSubmit(): void;
33
33
  handleFormReset(): void;
34
- handleOnKeyDown(e: KeyboardEvent): void;
34
+ handleOnKeyDown(e: React.KeyboardEvent<HTMLInputElement>): void;
35
35
  destroy(): void;
36
36
  getFormGroupCssClass(fieldKey: string): string | undefined;
37
37
  render(): JSX.Element;
@@ -1,13 +1,13 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { IFormInputOptions, IFormTextAreaOptions, IFormSelectOptions, IFormAutoCompleteOptions } from '../form.interfaces';
3
3
  import { IFormControlType } from '../form.types';
4
4
  export interface IFormInputEvent {
5
- value?: any;
5
+ value: string | number | readonly string[] | undefined;
6
6
  type?: string;
7
7
  name?: string;
8
8
  }
9
9
  export interface IFormInputProps {
10
- value: any;
10
+ value: string | number | readonly string[] | undefined;
11
11
  name: string;
12
12
  type: IFormControlType;
13
13
  placeholder?: string;
@@ -23,7 +23,7 @@ export interface IFormInputProps {
23
23
  label?: string;
24
24
  onInput?: (e: IFormInputEvent) => void;
25
25
  onChange?: (e: IFormInputEvent) => void;
26
- onBlur?: (event: any) => void;
27
- onKeyDown?: (event: any) => void;
26
+ onBlur?: React.FocusEventHandler<HTMLInputElement> | undefined;
27
+ onKeyDown?: React.KeyboardEventHandler<HTMLInputElement> | undefined;
28
28
  }
29
29
  export declare const FormInput: (props: IFormInputProps) => JSX.Element;
@@ -1,13 +1,17 @@
1
- import { ReactElement } from 'react';
1
+ import React, { ReactElement } from 'react';
2
2
  import { COLOR } from '../component.enums';
3
3
  import { ITabProps } from './Tab';
4
+ export interface ITabOnChangeEvent {
5
+ event: React.MouseEvent;
6
+ newValue: string;
7
+ }
4
8
  export interface ITabsProps {
5
9
  color?: COLOR;
6
10
  indicatorColor?: COLOR;
7
11
  children?: ReactElement<ITabProps> | Array<ReactElement<ITabProps>>;
8
12
  className?: string;
9
13
  fixed?: boolean;
10
- onChange?: (event: any, newValue: string) => void;
14
+ onChange?: (e: ITabOnChangeEvent) => void;
11
15
  value?: string;
12
16
  }
13
17
  export declare const Tabs: (props: ITabsProps) => JSX.Element;
@@ -1,7 +1,6 @@
1
- import { ReactElement } from 'react';
2
- export interface ITooltipProps {
1
+ import React from 'react';
2
+ export interface ITooltipProps extends React.ComponentProps<"div"> {
3
3
  placement?: 'top' | 'bottom' | 'right' | 'left';
4
4
  text?: string;
5
- children: ReactElement;
6
5
  }
7
6
  export declare const Tooltip: (props: ITooltipProps) => JSX.Element;
package/index.es.js CHANGED
@@ -1015,13 +1015,15 @@ const FormInput = (props) => {
1015
1015
  type === 'file' &&
1016
1016
  React.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"),
1017
1017
  type === 'textarea' &&
1018
- React.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' } }),
1018
+ React.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' } }),
1019
1019
  type === 'select' &&
1020
1020
  React.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 }),
1021
1021
  type === 'autocomplete' &&
1022
1022
  React.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 }),
1023
1023
  type === 'checkbox' &&
1024
- React.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 }),
1024
+ React.createElement(Checkbox, { id: name, name: name, label: label, className: (!isValid ? ' is-invalid' : ''),
1025
+ // onChange={e => handleOnChange((e?.target as HTMLInputElement).checked, type, name as string)}
1026
+ checked: value === 'true' ? true : false }),
1025
1027
  type === 'radio' &&
1026
1028
  React.createElement(Fragment, null, options.map((option) => React.createElement("div", { className: "form-check", key: option.id },
1027
1029
  React.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 }),
@@ -1121,7 +1123,7 @@ class Form extends Component {
1121
1123
  }
1122
1124
  return errors;
1123
1125
  }
1124
- handleInputChange(name, value, type) {
1126
+ handleInputChange(name, value) {
1125
1127
  const field = this.getControl(name);
1126
1128
  field.value = value;
1127
1129
  // redundant mit handleOnBlur
@@ -1146,7 +1148,6 @@ class Form extends Component {
1146
1148
  }
1147
1149
  }
1148
1150
  }
1149
- ;
1150
1151
  isRequired(fieldName) {
1151
1152
  let result = false;
1152
1153
  result = this.getControl(fieldName).validators.indexOf('required') >= 0;
@@ -1165,7 +1166,6 @@ class Form extends Component {
1165
1166
  const cssClasses = [labelClassName, this.isRequired(fieldKey) ? 'required' : undefined];
1166
1167
  return React.createElement(FormLabel, { htmlFor: fieldKey, className: cssClasses.join(' ') }, label);
1167
1168
  }
1168
- ;
1169
1169
  // trigger via ref
1170
1170
  handleFormSubmit() {
1171
1171
  for (const fieldKey of Object.keys(this.state.controls)) {
@@ -1207,7 +1207,7 @@ class Form extends Component {
1207
1207
  this.setState({ controls: {}, isValid: false, isChanged: false, isSubmitted: false });
1208
1208
  }
1209
1209
  getFormGroupCssClass(fieldKey) {
1210
- let result = this.getControl(fieldKey).config.formGroupClassName;
1210
+ const result = this.getControl(fieldKey).config.formGroupClassName;
1211
1211
  return result;
1212
1212
  }
1213
1213
  render() {
@@ -1215,7 +1215,7 @@ class Form extends Component {
1215
1215
  return (React.createElement(FormGroup, { key: fieldKey, className: this.getFormGroupCssClass(fieldKey) },
1216
1216
  this.getControl(fieldKey).config.labelPosition !== 'behind' && this.getControl(fieldKey).type !== 'checkbox' &&
1217
1217
  this.renderLabel(fieldKey, this.getControl(fieldKey).config.label, this.getControl(fieldKey).config.labelClassName),
1218
- React.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) }),
1218
+ React.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) }),
1219
1219
  this.getControl(fieldKey).config.labelPosition === 'behind' && this.getControl(fieldKey).type !== 'checkbox' &&
1220
1220
  this.renderLabel(fieldKey, this.getControl(fieldKey).config.label, this.getControl(fieldKey).config.labelClassName),
1221
1221
  this.getControl(fieldKey).config.hint &&
@@ -1356,12 +1356,12 @@ const DateSelect = (props) => {
1356
1356
  // return Math.ceil((((d - yearStart) / 86400000) + 1) / 7)
1357
1357
  // };
1358
1358
 
1359
- 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";
1360
- 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"};
1359
+ 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";
1360
+ 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"};
1361
1361
  styleInject(css_248z$r);
1362
1362
 
1363
1363
  const Drawer = (props) => {
1364
- const { children, className, position = 'left', permanent = false, target = document.body, onClickBackdrop } = props;
1364
+ const { children, className, position = 'left', permanent = false, target = document.body, shadow = true, onClickBackdrop } = props, rest = __rest(props, ["children", "className", "position", "permanent", "target", "shadow", "onClickBackdrop"]);
1365
1365
  useEffect(() => {
1366
1366
  document.body.classList.add(styles$r.drawerOpen);
1367
1367
  return () => {
@@ -1371,18 +1371,19 @@ const Drawer = (props) => {
1371
1371
  const handleClickBackdrop = () => {
1372
1372
  onClickBackdrop && onClickBackdrop();
1373
1373
  };
1374
- return createPortal(React.createElement(Fragment, null,
1375
- React.createElement(DrawerContent, { className: className, position: position, permanent: permanent }, children),
1374
+ return createPortal(React.createElement(React.Fragment, null,
1375
+ React.createElement(DrawerContent, Object.assign({ className: className, position: position, permanent: permanent, shadow: shadow }, rest), children),
1376
1376
  !permanent && React.createElement(Backdrop, { onClick: handleClickBackdrop })), target);
1377
1377
  };
1378
1378
  const DrawerContent = (props) => {
1379
- const { children, className, position = 'left', permanent = false } = props;
1379
+ const { children, className, position = 'left', permanent = false, shadow } = props, rest = __rest(props, ["children", "className", "position", "permanent", "shadow"]);
1380
1380
  const getCssClasses = () => {
1381
1381
  const cssClasses = [];
1382
1382
  cssClasses.push(styles$r.drawer);
1383
- className && cssClasses.push(className);
1383
+ shadow && cssClasses.push(styles$r.shadow);
1384
1384
  !!permanent && cssClasses.push(styles$r['permanent']);
1385
1385
  position === 'left' ? cssClasses.push(styles$r['left']) : cssClasses.push(styles$r['right']);
1386
+ className && cssClasses.push(className);
1386
1387
  return cssClasses.filter(css => css).join(' ');
1387
1388
  };
1388
1389
  const positionStyles = {
@@ -1392,7 +1393,7 @@ const DrawerContent = (props) => {
1392
1393
  const getStyles = () => {
1393
1394
  return !permanent ? positionStyles[position] : undefined;
1394
1395
  };
1395
- return (React.createElement("div", { className: getCssClasses(), style: getStyles() }, children));
1396
+ return (React.createElement("div", Object.assign({ className: getCssClasses(), style: getStyles() }, rest), children));
1396
1397
  };
1397
1398
 
1398
1399
  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";
@@ -2307,7 +2308,7 @@ const Tabs = (props) => {
2307
2308
  const handleClickTab = (event, newValue, index) => {
2308
2309
  setSelectedValue(newValue);
2309
2310
  setSelectedIndex(index);
2310
- onChange && onChange(event, newValue);
2311
+ onChange && onChange({ event, newValue });
2311
2312
  };
2312
2313
  const renderTabs = (child, index) => {
2313
2314
  return React.isValidElement(child) && cloneElement(child, {
@@ -2354,10 +2355,10 @@ styleInject(css_248z$2);
2354
2355
  const Tooltip = (props) => {
2355
2356
  const { children, text, placement = 'bottom' } = props;
2356
2357
  const [show, setShow] = useState(false);
2357
- const refChild = useRef(null);
2358
- const refTooltip = useRef(null);
2358
+ const refChild = useRef();
2359
+ const refTooltip = useRef();
2359
2360
  useEffect(() => {
2360
- if (show === true && refChild && refChild.current) {
2361
+ if (show === true && refChild && refChild.current && refTooltip && refTooltip.current) {
2361
2362
  // TODO - extract to own component?
2362
2363
  createPopper(refChild.current, refTooltip.current, {
2363
2364
  placement: placement,
@@ -2376,7 +2377,7 @@ const Tooltip = (props) => {
2376
2377
  const handleMouseLeave = () => {
2377
2378
  setShow(false);
2378
2379
  };
2379
- return (React.createElement(Fragment, null,
2380
+ return (React.createElement(React.Fragment, null,
2380
2381
  React.createElement("div", { className: styles$2.tooltipContainer, ref: refChild, id: "tooltip-container" }, cloneElement(children, {
2381
2382
  onMouseOver: handleMouseOver,
2382
2383
  onMouseLeave: handleMouseLeave,
package/index.js CHANGED
@@ -1023,13 +1023,15 @@ 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
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 }),
1029
1029
  type === 'autocomplete' &&
1030
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 }),
1031
1031
  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 }),
1032
+ React__default["default"].createElement(Checkbox, { id: name, name: name, label: label, className: (!isValid ? ' is-invalid' : ''),
1033
+ // onChange={e => handleOnChange((e?.target as HTMLInputElement).checked, type, name as string)}
1034
+ checked: value === 'true' ? true : false }),
1033
1035
  type === 'radio' &&
1034
1036
  React__default["default"].createElement(React.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 }),
@@ -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 &&
@@ -1364,12 +1364,12 @@ const DateSelect = (props) => {
1364
1364
  // return Math.ceil((((d - yearStart) / 86400000) + 1) / 7)
1365
1365
  // };
1366
1366
 
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"};
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 .Drawer-module_drawer__kdQCk.Drawer-module_shadow__Myo3n {\n box-shadow: var(--shadow); }\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","shadow":"Drawer-module_shadow__Myo3n","drawerOpen":"Drawer-module_drawerOpen__07ptP"};
1369
1369
  styleInject(css_248z$r);
1370
1370
 
1371
1371
  const Drawer = (props) => {
1372
- const { children, className, position = 'left', permanent = false, target = document.body, onClickBackdrop } = props;
1372
+ 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
1373
  React.useEffect(() => {
1374
1374
  document.body.classList.add(styles$r.drawerOpen);
1375
1375
  return () => {
@@ -1379,18 +1379,19 @@ const Drawer = (props) => {
1379
1379
  const handleClickBackdrop = () => {
1380
1380
  onClickBackdrop && onClickBackdrop();
1381
1381
  };
1382
- return reactDom.createPortal(React__default["default"].createElement(React.Fragment, null,
1383
- React__default["default"].createElement(DrawerContent, { className: className, position: position, permanent: permanent }, children),
1382
+ return reactDom.createPortal(React__default["default"].createElement(React__default["default"].Fragment, null,
1383
+ React__default["default"].createElement(DrawerContent, Object.assign({ className: className, position: position, permanent: permanent, shadow: shadow }, rest), children),
1384
1384
  !permanent && React__default["default"].createElement(Backdrop, { onClick: handleClickBackdrop })), target);
1385
1385
  };
1386
1386
  const DrawerContent = (props) => {
1387
- const { children, className, position = 'left', permanent = false } = props;
1387
+ const { children, className, position = 'left', permanent = false, shadow } = props, rest = __rest(props, ["children", "className", "position", "permanent", "shadow"]);
1388
1388
  const getCssClasses = () => {
1389
1389
  const cssClasses = [];
1390
1390
  cssClasses.push(styles$r.drawer);
1391
- className && cssClasses.push(className);
1391
+ shadow && cssClasses.push(styles$r.shadow);
1392
1392
  !!permanent && cssClasses.push(styles$r['permanent']);
1393
1393
  position === 'left' ? cssClasses.push(styles$r['left']) : cssClasses.push(styles$r['right']);
1394
+ className && cssClasses.push(className);
1394
1395
  return cssClasses.filter(css => css).join(' ');
1395
1396
  };
1396
1397
  const positionStyles = {
@@ -1400,7 +1401,7 @@ const DrawerContent = (props) => {
1400
1401
  const getStyles = () => {
1401
1402
  return !permanent ? positionStyles[position] : undefined;
1402
1403
  };
1403
- return (React__default["default"].createElement("div", { className: getCssClasses(), style: getStyles() }, children));
1404
+ return (React__default["default"].createElement("div", Object.assign({ className: getCssClasses(), style: getStyles() }, rest), children));
1404
1405
  };
1405
1406
 
1406
1407
  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";
@@ -2315,7 +2316,7 @@ const Tabs = (props) => {
2315
2316
  const handleClickTab = (event, newValue, index) => {
2316
2317
  setSelectedValue(newValue);
2317
2318
  setSelectedIndex(index);
2318
- onChange && onChange(event, newValue);
2319
+ onChange && onChange({ event, newValue });
2319
2320
  };
2320
2321
  const renderTabs = (child, index) => {
2321
2322
  return React__default["default"].isValidElement(child) && React.cloneElement(child, {
@@ -2362,10 +2363,10 @@ styleInject(css_248z$2);
2362
2363
  const Tooltip = (props) => {
2363
2364
  const { children, text, placement = 'bottom' } = props;
2364
2365
  const [show, setShow] = React.useState(false);
2365
- const refChild = React.useRef(null);
2366
- const refTooltip = React.useRef(null);
2366
+ const refChild = React.useRef();
2367
+ const refTooltip = React.useRef();
2367
2368
  React.useEffect(() => {
2368
- if (show === true && refChild && refChild.current) {
2369
+ if (show === true && refChild && refChild.current && refTooltip && refTooltip.current) {
2369
2370
  // TODO - extract to own component?
2370
2371
  core.createPopper(refChild.current, refTooltip.current, {
2371
2372
  placement: placement,
@@ -2384,7 +2385,7 @@ const Tooltip = (props) => {
2384
2385
  const handleMouseLeave = () => {
2385
2386
  setShow(false);
2386
2387
  };
2387
- return (React__default["default"].createElement(React.Fragment, null,
2388
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
2388
2389
  React__default["default"].createElement("div", { className: styles$2.tooltipContainer, ref: refChild, id: "tooltip-container" }, React.cloneElement(children, {
2389
2390
  onMouseOver: handleMouseOver,
2390
2391
  onMouseLeave: handleMouseLeave,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-asc",
3
- "version": "19.0.0",
3
+ "version": "19.0.1",
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;