ish-ui 1.0.22 → 1.0.24

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.
@@ -6,5 +6,5 @@ import { EditInPlaceDateTimeFieldProps, FieldInputProps, FieldMetaProps } from '
6
6
  interface InputTypes {
7
7
  type?: 'date' | 'time' | 'datetime';
8
8
  }
9
- declare function EditInPlaceDateTimeField<IP extends FieldInputProps, MP extends FieldMetaProps>({ type, formatDate, formatTime, formatDateTime, timezone, input, fieldClasses, inline, meta: { error, invalid, active, dispatch }, labelAdornment, label, disabled, formatValue, className, onKeyPress, placeholder, persistValue, warning, defaultValue, rightAligned, processActionId }: EditInPlaceDateTimeFieldProps<IP, MP> & InputTypes): React.JSX.Element;
9
+ declare function EditInPlaceDateTimeField<IP extends FieldInputProps, MP extends FieldMetaProps>({ type, formatDate, formatTime, formatDateTime, timezone, input, fieldClasses, inline, meta: { error, invalid, active, dispatch }, labelAdornment, label, disabled, formatValue, className, onKeyPress, placeholder, persistValue, warning, defaultValue, rightAligned, processActionId, variant, }: EditInPlaceDateTimeFieldProps<IP, MP> & InputTypes): React.JSX.Element;
10
10
  export default EditInPlaceDateTimeField;
@@ -22,22 +22,16 @@ import { endFieldProcessingAction, startFieldProcessingAction } from '../actions
22
22
  const useStyles = makeAppStyles(theme => ({
23
23
  inlinePickerButton: {
24
24
  padding: '2px',
25
- marginBottom: '-4px',
26
25
  fontSize: '1.3em',
27
26
  '&:hover': {
28
27
  color: theme.palette.primary.main,
29
28
  }
30
29
  },
31
- pickerButton: {
32
- width: theme.spacing(4),
33
- height: theme.spacing(4),
34
- bottom: theme.spacing(-0.5)
35
- },
36
30
  inlineContainer: {
37
31
  display: 'inline-block',
38
32
  }
39
33
  }));
40
- function EditInPlaceDateTimeField({ type, formatDate, formatTime, formatDateTime, timezone, input, fieldClasses = {}, inline, meta: { error, invalid, active, dispatch }, labelAdornment, label, disabled, formatValue, className, onKeyPress, placeholder = 'No value', persistValue, warning, defaultValue, rightAligned, processActionId }) {
34
+ function EditInPlaceDateTimeField({ type, formatDate, formatTime, formatDateTime, timezone, input, fieldClasses = {}, inline, meta: { error, invalid, active, dispatch }, labelAdornment, label, disabled, formatValue, className, onKeyPress, placeholder, persistValue, warning, defaultValue, rightAligned, processActionId, variant, }) {
41
35
  const [textValue, setTextValue] = useState(defaultValue || '');
42
36
  const [pickerOpened, setPickerOpened] = useState(false);
43
37
  const inputNode = useRef(null);
@@ -169,8 +163,8 @@ function EditInPlaceDateTimeField({ type, formatDate, formatTime, formatDateTime
169
163
  'pointer-events-none': disabled
170
164
  }) },
171
165
  React.createElement("div", { id: input.name, className: "w-100" },
172
- React.createElement(DateTimeField, { type: type, toolbarTitle: label, open: pickerOpened, value: dateValue, onChange: onChange, onClose: onClose, renderInput: () => (React.createElement(EditInPlaceFieldBase, { name: input.name, value: textValue, error: error, invalid: invalid, inline: inline, label: label, warning: warning, fieldClasses: fieldClasses, rightAligned: rightAligned, shrink: Boolean(label || input.value), disabled: disabled, labelAdornment: labelAdornment, placeholder: placeholder, editIcon: React.createElement(IconButton, { tabIndex: -1, onClick: openPicker, classes: {
173
- root: clsx(fieldClasses.text, inline ? classes.inlinePickerButton : classes.pickerButton)
166
+ React.createElement(DateTimeField, { type: type, toolbarTitle: label, open: pickerOpened, value: dateValue, onChange: onChange, onClose: onClose, renderInput: () => (React.createElement(EditInPlaceFieldBase, { name: input.name, value: textValue, variant: variant, error: error, invalid: invalid, inline: inline, label: label, warning: warning, fieldClasses: fieldClasses, rightAligned: rightAligned, shrink: Boolean(label || input.value), disabled: disabled, labelAdornment: labelAdornment, placeholder: placeholder, editIcon: React.createElement(IconButton, { tabIndex: -1, onClick: openPicker, classes: {
167
+ root: clsx('p-0', fieldClasses.text, inline && classes.inlinePickerButton)
174
168
  } }, type === 'time'
175
169
  ? React.createElement(QueryBuilder, { fontSize: "inherit", color: "inherit" })
176
170
  : React.createElement(DateRange, { color: "inherit", fontSize: "inherit" })), InputProps: {
@@ -6,5 +6,5 @@ import { EditInPlaceFieldProps, FieldInputProps, FieldMetaProps } from '../model
6
6
  interface InputTypes {
7
7
  type?: 'password' | 'number' | 'text';
8
8
  }
9
- declare function EditInPlaceField<IP extends FieldInputProps, MP extends FieldMetaProps>({ inputRef, input, label, maxLength, disabled, min, max, step, className, onKeyPress, labelAdornment, truncateLines, rightAligned, defaultValue, onKeyDown, multiline, inline, warning, preformatDisplayValue, type, meta: { error, invalid }, placeholder, fieldClasses, InputProps }: EditInPlaceFieldProps<IP, MP> & InputTypes): React.JSX.Element;
9
+ declare function EditInPlaceField<IP extends FieldInputProps, MP extends FieldMetaProps>({ inputRef, input, label, maxLength, disabled, min, max, step, className, onKeyPress, labelAdornment, truncateLines, rightAligned, defaultValue, onKeyDown, multiline, inline, warning, preformatDisplayValue, type, meta: { error, invalid }, placeholder, fieldClasses, InputProps, editIcon, variant }: EditInPlaceFieldProps<IP, MP> & InputTypes): React.JSX.Element;
10
10
  export default EditInPlaceField;
@@ -31,7 +31,7 @@ const useStyles = makeAppStyles(theme => ({
31
31
  opacity: 0.5
32
32
  }
33
33
  }));
34
- function EditInPlaceField({ inputRef, input, label, maxLength, disabled, min, max, step, className, onKeyPress, labelAdornment, truncateLines, rightAligned, defaultValue, onKeyDown, multiline, inline, warning, preformatDisplayValue, type = 'text', meta: { error, invalid }, placeholder = 'No value', fieldClasses = {}, InputProps = {} }) {
34
+ function EditInPlaceField({ inputRef, input, label, maxLength, disabled, min, max, step, className, onKeyPress, labelAdornment, truncateLines, rightAligned, defaultValue, onKeyDown, multiline, inline, warning, preformatDisplayValue, type = 'text', meta: { error, invalid }, placeholder, fieldClasses = {}, InputProps = {}, editIcon, variant }) {
35
35
  const classes = useStyles();
36
36
  const onBlur = () => {
37
37
  (input === null || input === void 0 ? void 0 : input.onBlur) && input.onBlur(input.value);
@@ -43,7 +43,7 @@ function EditInPlaceField({ inputRef, input, label, maxLength, disabled, min, ma
43
43
  [classes.rightAligned]: rightAligned,
44
44
  [classes.inlineContainer]: inline
45
45
  }) },
46
- React.createElement(EditInPlaceFieldBase, { name: input.name, value: inputValue, error: error, invalid: invalid, inline: inline, label: label, warning: warning, fieldClasses: fieldClasses, endAdornmentClass: classes.endAdornment, rightAligned: rightAligned, shrink: Boolean(label || input.value), disabled: disabled, labelAdornment: labelAdornment, placeholder: placeholder, hideArrows: ['percentage', 'number'].includes(type), editIcon: React.createElement(Edit, { fontSize: "inherit" }), InputProps: Object.assign({ multiline,
46
+ React.createElement(EditInPlaceFieldBase, { name: input.name, value: inputValue, variant: variant, error: error, invalid: invalid, inline: inline, label: label, warning: warning, fieldClasses: fieldClasses, endAdornmentClass: classes.endAdornment, rightAligned: rightAligned, shrink: Boolean(label || input.value), disabled: disabled, labelAdornment: labelAdornment, placeholder: placeholder, hideArrows: ['percentage', 'number'].includes(type), editIcon: editIcon === undefined ? React.createElement(Edit, { fontSize: inline ? 'inherit' : undefined }) : editIcon, InputProps: Object.assign({ multiline,
47
47
  onKeyPress,
48
48
  onBlur, onFocus: input.onFocus, maxRows: truncateLines, inputProps: {
49
49
  ref: inputRef,
@@ -33,9 +33,6 @@ const useStyles = makeAppStyles(theme => ({
33
33
  },
34
34
  '&:hover .invisible': {
35
35
  visibility: 'visible',
36
- },
37
- '& .Mui-focused $inputEndAdornment': {
38
- opacity: 1,
39
36
  }
40
37
  },
41
38
  hideArrows: {
@@ -56,14 +53,6 @@ const useStyles = makeAppStyles(theme => ({
56
53
  readonly: {
57
54
  fontWeight: 300,
58
55
  pointerEvents: 'none'
59
- },
60
- inputEndAdornment: {
61
- display: 'flex',
62
- fontSize: '24px',
63
- color: theme.palette.primary.main,
64
- alignItems: 'flex-end',
65
- alignSelf: 'flex-end',
66
- marginBottom: '5px'
67
56
  }
68
57
  }));
69
58
  const EditInPlaceFieldBase = ({ value, invalid, className, inline, label, fieldClasses = {}, rightAligned, shrink, name, disabled, labelAdornment, editIcon, error, placeholder, hideArrows, warning, endAdornmentClass, CustomInput, InputProps, variant = 'standard' }) => {
@@ -96,7 +85,7 @@ const EditInPlaceFieldBase = ({ value, invalid, className, inline, label, fieldC
96
85
  React.createElement("span", { className: classes.label }, label),
97
86
  labelAdornment)),
98
87
  CustomInput ||
99
- React.createElement(InputComp, Object.assign({}, InputProps || {}, { label: label, inputRef: inputNode, inputProps: Object.assign({ placeholder,
88
+ React.createElement(InputComp, Object.assign({}, InputProps || {}, { inputRef: inputNode, inputProps: Object.assign({ placeholder,
100
89
  disabled, className: clsx(fieldClasses.text, {
101
90
  [classes.inlineInput]: inline,
102
91
  [classes.readonly]: disabled,
@@ -108,10 +97,10 @@ const EditInPlaceFieldBase = ({ value, invalid, className, inline, label, fieldC
108
97
  root: clsx(fieldClasses.text, inline && classes.inlineInput),
109
98
  underline: fieldClasses.underline
110
99
  }, disabled: disabled, endAdornment: !disabled &&
111
- React.createElement(InputAdornment, { position: "end", onClick: onAdornmentClick, className: clsx(classes.inputEndAdornment, endAdornmentClass, {
100
+ React.createElement(InputAdornment, { position: "end", onClick: onAdornmentClick, className: clsx(endAdornmentClass, {
112
101
  ['fsInherit']: inline,
113
102
  ['d-none']: (rightAligned || inline),
114
- ['invisible']: !(rightAligned || inline)
103
+ ['invisible']: variant !== 'outlined' && !(rightAligned || inline)
115
104
  }) }, editIcon), id: `input-${name}`, name: name })),
116
105
  React.createElement(FormHelperText, { classes: {
117
106
  root: clsx(rightAligned && 'text-end'),
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { EditInPlaceSearchSelectFieldProps, FieldInputProps, FieldMetaProps } from '../model';
3
- declare function EditInPlaceSearchSelect<InputProps extends FieldInputProps, MetaProps extends FieldMetaProps>({ label, disabled, className, labelAdornment, inline, loading, creatable, allowEmpty, fieldClasses, selectAdornment, selectValueMark, selectLabelMark, selectLabelCondition, selectFilterCondition, defaultValue, disableUnderline, items, rowHeight, remoteRowCount, loadMoreRows, onCreateOption, itemRenderer, onInputChange, onClearRows, onInnerValueChange, hideMenuOnNoResults, hideEditIcon, remoteData, createLabel, returnType, alwaysDisplayDefault, valueRenderer, popperAnchor, input, meta: { error, invalid }, placeholder, sort, sortPropKey, inputRef, warning, multiple, rightAligned, hasError, categoryKey }: EditInPlaceSearchSelectFieldProps<InputProps, MetaProps>): React.JSX.Element;
3
+ declare function EditInPlaceSearchSelect<InputProps extends FieldInputProps, MetaProps extends FieldMetaProps>({ label, disabled, className, labelAdornment, inline, loading, creatable, allowEmpty, fieldClasses, selectAdornment, selectValueMark, selectLabelMark, selectLabelCondition, selectFilterCondition, defaultValue, disableUnderline, items, rowHeight, remoteRowCount, loadMoreRows, onCreateOption, itemRenderer, onInputChange, onClearRows, onInnerValueChange, hideMenuOnNoResults, hideEditIcon, remoteData, createLabel, returnType, alwaysDisplayDefault, valueRenderer, popperAnchor, input, meta: { error, invalid }, placeholder, sort, sortPropKey, inputRef, warning, multiple, rightAligned, hasError, categoryKey, editIcon, variant }: EditInPlaceSearchSelectFieldProps<InputProps, MetaProps>): React.JSX.Element;
4
4
  export default EditInPlaceSearchSelect;
@@ -28,10 +28,7 @@ import EditInPlaceFieldBase from './EditInPlaceFieldBase';
28
28
  import { makeAppStyles } from '../styles';
29
29
  import { getHighlightedPartLabel, stubComponent } from '../utils';
30
30
  import { usePrevious } from '../utils/hooks';
31
- const useStyles = makeAppStyles(theme => (Object.assign({ selectAdornment: {
32
- marginBottom: '6px',
33
- color: theme.palette.primary.main
34
- }, popper: {
31
+ const useStyles = makeAppStyles(theme => (Object.assign({ popper: {
35
32
  zIndex: 1400
36
33
  } }, selectStyles(theme))));
37
34
  const SelectContext = React.createContext({});
@@ -50,7 +47,7 @@ const PopperAdapter = React.memo(params => {
50
47
  // @ts-ignore
51
48
  : React.createElement(Popper, Object.assign({}, params, { style: inline ? null : params.style })));
52
49
  });
53
- function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, inline, loading, creatable, allowEmpty, fieldClasses = {}, selectAdornment, selectValueMark = 'value', selectLabelMark = 'label', selectLabelCondition, selectFilterCondition, defaultValue, disableUnderline, items = [], rowHeight, remoteRowCount, loadMoreRows, onCreateOption, itemRenderer, onInputChange, onClearRows, onInnerValueChange, hideMenuOnNoResults, hideEditIcon, remoteData, createLabel, returnType = 'string', alwaysDisplayDefault, valueRenderer, popperAnchor, input, meta: { error, invalid }, placeholder, sort, sortPropKey, inputRef, warning, multiple, rightAligned, hasError, categoryKey }) {
50
+ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, inline, loading, creatable, allowEmpty, fieldClasses = {}, selectAdornment, selectValueMark = 'value', selectLabelMark = 'label', selectLabelCondition, selectFilterCondition, defaultValue, disableUnderline, items = [], rowHeight, remoteRowCount, loadMoreRows, onCreateOption, itemRenderer, onInputChange, onClearRows, onInnerValueChange, hideMenuOnNoResults, hideEditIcon, remoteData, createLabel, returnType = 'string', alwaysDisplayDefault, valueRenderer, popperAnchor, input, meta: { error, invalid }, placeholder, sort, sortPropKey, inputRef, warning, multiple, rightAligned, hasError, categoryKey, editIcon, variant }) {
54
51
  const classes = useStyles();
55
52
  const sortedItems = useMemo(() => {
56
53
  const sorted = items && (sort
@@ -262,11 +259,11 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
262
259
  }, [selectedOption, searchValue, displayedValue, selectValueMark, returnType, valueRenderer, input.value]);
263
260
  const renderIcons = useMemo(() => !disabled && (loading
264
261
  ? React.createElement(CircularProgress, { size: 24, thickness: 4, className: fieldClasses.loading })
265
- : (React.createElement("div", { className: classes.inputEndAdornment },
262
+ : (React.createElement("div", null,
266
263
  allowEmpty && input.value && (React.createElement(IconButton, { size: "small", onClick: onClear, color: "inherit" },
267
264
  React.createElement(CloseIcon, { fontSize: "inherit" }))),
268
- React.createElement(IconButton, { size: "small", color: "inherit", className: clsx(classes.expandIcon, 'pl-0 pr-0'), disableRipple: true },
269
- React.createElement(ExpandMore, { className: inline && 'fsInherit' }))))), [disabled, loading, inline, allowEmpty, input.value]);
265
+ editIcon === undefined ? React.createElement(IconButton, { size: "small", color: "inherit", className: clsx(classes.expandIcon, 'pl-0 pr-0'), disableRipple: true },
266
+ React.createElement(ExpandMore, { className: inline && 'fsInherit' })) : editIcon))), [disabled, loading, inline, allowEmpty, input.value]);
270
267
  const inputValue = useMemo(() => {
271
268
  if (multiple) {
272
269
  return (input.value || []).map(v => sortedItems.find(s => s[selectValueMark] === v));
@@ -274,7 +271,7 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
274
271
  return input.value || null;
275
272
  }, [input.value, multiple, selectValueMark, sortedItems]);
276
273
  const renderedPlaceholder = useMemo(() => {
277
- const rendered = placeholder || (!isEditing ? 'No value' : '');
274
+ const rendered = placeholder;
278
275
  return multiple && inputValue.length ? null : rendered;
279
276
  }, [multiple, placeholder, isEditing, inputValue]);
280
277
  return (React.createElement("div", { className: clsx(className, 'outline-none', inline && classes.inline), id: input === null || input === void 0 ? void 0 : input.name },
@@ -301,7 +298,7 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
301
298
  groupUl: 'm-0'
302
299
  }, groupBy: categoryKey && (option => option[categoryKey]), renderOption: renderOption, getOptionLabel: getOptionLabel, filterOptions: filterItems, ListboxComponent: inline || categoryKey ? null : ListBoxAdapter, PopperComponent: categoryKey ? null : PopperAdapter, renderInput: (_a) => {
303
300
  var { InputLabelProps, InputProps, inputProps } = _a, params = __rest(_a, ["InputLabelProps", "InputProps", "inputProps"]);
304
- return (React.createElement(EditInPlaceFieldBase, Object.assign({}, params, { name: input.name, value: displayedValue, error: error, invalid: hasError || invalid, inline: inline, label: label, warning: warning, fieldClasses: fieldClasses, endAdornmentClass: classes.selectAdornment, rightAligned: rightAligned, shrink: Boolean(label || input.value), labelAdornment: labelAdornment, placeholder: renderedPlaceholder, editIcon: !hideEditIcon && renderIcons, InputProps: Object.assign(Object.assign({}, InputProps), { onChange: handleInputChange, onFocus: edit, onClick: onEditButtonFocus, onBlur,
301
+ return (React.createElement(EditInPlaceFieldBase, Object.assign({}, params, { variant: variant, name: input.name, value: displayedValue, error: error, invalid: hasError || invalid, inline: inline, label: label, warning: warning, fieldClasses: fieldClasses, rightAligned: rightAligned, shrink: Boolean(label || input.value), labelAdornment: labelAdornment, placeholder: renderedPlaceholder, editIcon: !hideEditIcon && renderIcons, InputProps: Object.assign(Object.assign({}, InputProps), { onChange: handleInputChange, onFocus: edit, onClick: onEditButtonFocus, onBlur,
305
302
  disableUnderline, classes: {
306
303
  underline: fieldClasses.underline,
307
304
  input: clsx(disabled && classes.readonly, fieldClasses.text),
@@ -314,7 +311,7 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
314
311
  ?
315
312
  React.createElement(Select, Object.assign({}, InputProps, { inputRef: ref => {
316
313
  inputProps.ref.current = ref === null || ref === void 0 ? void 0 : ref.node;
317
- }, classes: { select: 'cursor-text' }, onFocus: edit, value: (returnType === 'object' ? input.value[selectValueMark] : input.value) || '', endAdornment: React.createElement(InputAdornment, { position: "end", className: clsx(classes.selectAdornment, 'd-none') }, renderIcons), IconComponent: stubComponent }), renderValue)
314
+ }, classes: { select: 'cursor-text' }, onFocus: edit, value: (returnType === 'object' ? input.value[selectValueMark] : input.value) || '', endAdornment: React.createElement(InputAdornment, { position: "end", className: 'd-none' }, renderIcons), IconComponent: stubComponent }), renderValue)
318
315
  : null })));
319
316
  }, disableListWrap: true, openOnFocus: true, fullWidth: true }))));
320
317
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare const selectStyles: (theme: any) => import("@mui/styles").StyleRules<{}, "label" | "inline" | "multiple" | "error" | "root" | "expandIcon" | "menuItem" | "inputWrapper" | "readonly" | "inputEndAdornment" | "editIcon" | "bottomMargin" | "bottomPadding" | "topMargin" | "editable" | "valid" | "autoWidthSelect" | "emptySelect" | "validUnderline" | "menuItemActive" | "menuList" | "hasPopup" | "hasClear">;
2
+ export declare const selectStyles: (theme: any) => import("@mui/styles").StyleRules<{}, "label" | "inline" | "multiple" | "error" | "root" | "expandIcon" | "menuItem" | "inputWrapper" | "readonly" | "editIcon" | "bottomMargin" | "bottomPadding" | "topMargin" | "editable" | "valid" | "autoWidthSelect" | "emptySelect" | "validUnderline" | "menuItemActive" | "menuList" | "hasPopup" | "hasClear">;
3
3
  export declare const ListRow: React.MemoExoticComponent<any>;
4
4
  export declare const ListboxComponent: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
5
5
  export declare const NoWrapOption: (content: any, data: any, search: any, parentProps: any) => React.JSX.Element;
@@ -25,7 +25,7 @@ import { areEqual, FixedSizeList as List } from 'react-window';
25
25
  import { createStyles } from '@mui/styles';
26
26
  import { green } from '@mui/material/colors';
27
27
  import clsx from 'clsx';
28
- import { ListItem } from '@mui/material';
28
+ import { ListItemButton } from '@mui/material';
29
29
  import Tooltip from '@mui/material/Tooltip';
30
30
  export const selectStyles = theme => createStyles({
31
31
  bottomMargin: {
@@ -96,31 +96,14 @@ export const selectStyles = theme => createStyles({
96
96
  display: 'inline-block',
97
97
  '& .MuiInput-root .MuiInput-input': {
98
98
  padding: 0
99
- },
100
- '& $inputEndAdornment': {
101
- marginBottom: '-8px'
102
99
  }
103
100
  },
104
101
  root: {
105
102
  '& $multiple': {
106
103
  flexWrap: 'wrap'
107
- },
108
- '& $multiple $inputEndAdornment': {
109
- position: 'absolute',
110
- right: 0,
111
- bottom: 6,
112
- height: 'auto'
113
104
  }
114
105
  },
115
- inputEndAdornment: {
116
- marginBottom: '-6px',
117
- alignItems: 'center',
118
- display: 'flex',
119
- },
120
106
  inputWrapper: {
121
- '&:hover $inputEndAdornment': {
122
- visibility: 'visible'
123
- },
124
107
  '&.Mui-focused $expandIcon': {
125
108
  opacity: 1
126
109
  }
@@ -142,7 +125,7 @@ export const selectStyles = theme => createStyles({
142
125
  });
143
126
  export const ListRow = React.memo(({ data: { children, selectAdornment }, index, style }) => {
144
127
  const inlineStyle = Object.assign(Object.assign({}, style), { top: style.top + 8, paddingLeft: 0, paddingRight: 0, whiteSpace: 'nowrap' });
145
- return (React.createElement(ListItem, { button: true, style: inlineStyle }, (((selectAdornment === null || selectAdornment === void 0 ? void 0 : selectAdornment.position) === 'start' && index === 0)
128
+ return (React.createElement(ListItemButton, { style: inlineStyle }, (((selectAdornment === null || selectAdornment === void 0 ? void 0 : selectAdornment.position) === 'start' && index === 0)
146
129
  || ((selectAdornment === null || selectAdornment === void 0 ? void 0 : selectAdornment.position) === 'end' && index === children.length))
147
130
  ? selectAdornment.content
148
131
  : children[index]));
@@ -20,7 +20,7 @@ const useStyles = makeAppStyles({
20
20
  }
21
21
  });
22
22
  const UneditableBase = React.memo(props => {
23
- const { label, labelAdornment, placeholder = 'No value', rightAligned, value, url, money, currencySymbol, className, format, multiline, error } = props;
23
+ const { label, labelAdornment, placeholder, rightAligned, value, url, money, currencySymbol, className, format, multiline, error } = props;
24
24
  const classes = useStyles();
25
25
  const inputId = `input-${label.toLowerCase().replace(' ', '-')}`;
26
26
  const openLink = useCallback(() => {
@@ -4,6 +4,7 @@ import { InputProps } from '@mui/material/Input/Input';
4
4
  import { AnyArgFunction } from '../model/CommonFunctions';
5
5
  import { ShowConfirmCaller } from '../model/Confirm';
6
6
  import { PopperPlacementType } from '@mui/material';
7
+ import { FormControlTypeMap } from '@mui/material/FormControl/FormControl';
7
8
  export type EventHandler<Event> = (event: Event, name?: string) => void;
8
9
  export interface EventOrValueHandler<Event> extends EventHandler<Event> {
9
10
  (value: any): void;
@@ -65,6 +66,10 @@ export interface SelectItemRendererProps<E = any> {
65
66
  parentProps: any;
66
67
  search?: string;
67
68
  }
69
+ export interface SelectItemDefault {
70
+ value?: any;
71
+ label?: string;
72
+ }
68
73
  export interface ColoredCheckboxFieldProps<IP, MP> {
69
74
  input?: Partial<Omit<IP, 'onBlur'>> & {
70
75
  onBlur?: AnyArgFunction;
@@ -102,6 +107,8 @@ export interface EditInPlaceFieldProps<IP, MP> {
102
107
  onKeyDown?: any;
103
108
  multiline?: boolean;
104
109
  inline?: boolean;
110
+ editIcon?: ReactNode;
111
+ variant?: FormControlTypeMap['props']['variant'];
105
112
  }
106
113
  export interface EditInPlaceDateTimeFieldProps<IP, MP> {
107
114
  inputRef?: MutableRefObject<any>;
@@ -127,6 +134,7 @@ export interface EditInPlaceDateTimeFieldProps<IP, MP> {
127
134
  disabled?: boolean;
128
135
  persistValue?: boolean;
129
136
  rightAligned?: boolean;
137
+ variant?: FormControlTypeMap['props']['variant'];
130
138
  }
131
139
  export interface EditInPlaceSearchSelectFieldProps<IP, MP> {
132
140
  inputRef?: MutableRefObject<any>;
@@ -134,7 +142,7 @@ export interface EditInPlaceSearchSelectFieldProps<IP, MP> {
134
142
  onBlur?: AnyArgFunction;
135
143
  });
136
144
  meta?: Partial<MP>;
137
- items?: any[];
145
+ items?: (SelectItemDefault | any)[];
138
146
  label?: ReactNode;
139
147
  disabled?: boolean;
140
148
  className?: string;
@@ -181,6 +189,8 @@ export interface EditInPlaceSearchSelectFieldProps<IP, MP> {
181
189
  position: 'start' | 'end';
182
190
  content: ReactElement;
183
191
  };
192
+ editIcon?: ReactNode;
193
+ variant?: FormControlTypeMap['props']['variant'];
184
194
  }
185
195
  export interface CodeFieldProps<IP, MP> {
186
196
  input?: Partial<Omit<IP, 'onBlur'>> & {
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { FieldInputProps, FieldMetaProps, TagLike, TagsFieldProps } from '../model';
3
- declare function TagInputList<T extends TagLike, IP extends FieldInputProps, MP extends FieldMetaProps>({ input, tags, placeholder, labelAdornment, meta, label, disabled, className, warning, allowParentSelect, fieldClasses }: TagsFieldProps<T, IP, MP>): React.JSX.Element;
3
+ declare function TagInputList<T extends TagLike, IP extends FieldInputProps, MP extends FieldMetaProps>({ input, tags, placeholder, labelAdornment, meta, label, disabled, className, warning, allowParentSelect, fieldClasses, editIcon, variant }: TagsFieldProps<T, IP, MP>): React.JSX.Element;
4
4
  export default TagInputList;
@@ -25,19 +25,10 @@ import { Edit } from '@mui/icons-material';
25
25
  import { selectStyles } from '../formFields';
26
26
  import AddTagMenu from './AddTagMenu';
27
27
  import EditInPlaceFieldBase from '../formFields/EditInPlaceFieldBase';
28
- import { getAllMenuTags, getHighlightedPartLabel, getMenuTags } from '../utils';
29
- import { stubComponent } from '../utils/stubs';
28
+ import { getAllMenuTags, getHighlightedPartLabel, getMenuTags, stubComponent } from '../utils';
30
29
  import getCaretCoordinates from '../utils/DOM/getCaretCoordinates';
31
30
  import { makeAppStyles } from '../styles';
32
- const useStyles = makeAppStyles((theme) => (Object.assign(Object.assign({}, selectStyles(theme)), { inputEndAdornment: {
33
- visibility: 'hidden',
34
- display: 'flex',
35
- color: theme.palette.primary.main,
36
- alignItems: 'flex-end',
37
- alignSelf: 'flex-end',
38
- marginBottom: '4px',
39
- opacity: 0.5
40
- }, tagColorDotSmall: {
31
+ const useStyles = makeAppStyles((theme) => (Object.assign(Object.assign({}, selectStyles(theme)), { tagColorDotSmall: {
41
32
  width: theme.spacing(2),
42
33
  minWidth: theme.spacing(2),
43
34
  height: theme.spacing(2),
@@ -46,6 +37,8 @@ const useStyles = makeAppStyles((theme) => (Object.assign(Object.assign({}, sele
46
37
  borderRadius: '100%'
47
38
  }, listbox: {
48
39
  whiteSpace: 'break-spaces'
40
+ }, editIcon: {
41
+ opacity: 0.5
49
42
  }, invalid: {} })));
50
43
  const endTagRegex = /#\s*[^\w\d]*$/;
51
44
  const getCurrentInputString = (input, formTagIds = [], allMenuTags = []) => {
@@ -84,7 +77,7 @@ const getInputString = (tagIds, allTags) => ((tagIds === null || tagIds === void
84
77
  return (tag ? `${acc}#${tag.name} ` : acc);
85
78
  }, '')
86
79
  : '');
87
- function TagInputList({ input, tags, placeholder, labelAdornment, meta, label = 'Tags', disabled, className, warning, allowParentSelect, fieldClasses = {} }) {
80
+ function TagInputList({ input, tags, placeholder, labelAdornment, meta, label = 'Tags', disabled, className, warning, allowParentSelect, fieldClasses = {}, editIcon, variant }) {
88
81
  const [menuIsOpen, setMenuIsOpen] = useState(false);
89
82
  const [activeTag, setActiveTag] = useState(null);
90
83
  const [isEditing, setIsEditing] = useState(false);
@@ -256,17 +249,17 @@ function TagInputList({ input, tags, placeholder, labelAdornment, meta, label =
256
249
  inputRoot: classes.inputWrapper,
257
250
  noOptions: 'd-none'
258
251
  }, renderInput: (_a) => {
259
- var { InputLabelProps, InputProps, inputProps } = _a, params = __rest(_a, ["InputLabelProps", "InputProps", "inputProps"]);
260
- return (React.createElement(EditInPlaceFieldBase, Object.assign({}, params, { name: input.name, value: input.value, error: meta.error, invalid: meta === null || meta === void 0 ? void 0 : meta.invalid, label: label, warning: warning, disabled: disabled, fieldClasses: fieldClasses, shrink: Boolean(label || input.value), labelAdornment: labelAdornment, placeholder: placeholder || 'No value', editIcon: React.createElement(Edit, { fontSize: "inherit" }), InputProps: Object.assign(Object.assign({}, InputProps), { onChange: handleInputChange, onFocus,
252
+ var { InputProps, inputProps } = _a, params = __rest(_a, ["InputProps", "inputProps"]);
253
+ return (React.createElement(EditInPlaceFieldBase, Object.assign({}, params, { variant: variant, name: input.name, value: input.value, error: meta.error, invalid: meta === null || meta === void 0 ? void 0 : meta.invalid, label: label, warning: warning, disabled: disabled, fieldClasses: fieldClasses, shrink: Boolean(label || input.value), labelAdornment: labelAdornment, placeholder: placeholder, editIcon: editIcon === undefined ? React.createElement(Edit, null) : editIcon, InputProps: Object.assign(Object.assign({}, InputProps), { onChange: handleInputChange, onFocus,
261
254
  onBlur, inputProps: Object.assign(Object.assign({}, inputProps), { ref: ref => {
262
255
  inputProps.ref.current = ref;
263
256
  inputNode.current = ref;
264
257
  }, value: inputValue }) }), CustomInput: !isEditing
265
258
  ? React.createElement(Select, { inputRef: ref => {
266
259
  inputProps.ref.current = ref === null || ref === void 0 ? void 0 : ref.node;
267
- }, onFocus: edit, value: "stub", className: classes.inputWrapper, classes: { select: 'd-flex flex-wrap cursor-text' }, endAdornment: React.createElement(InputAdornment, { position: "end", className: classes.inputEndAdornment },
268
- React.createElement(Edit, null)), IconComponent: stubComponent },
269
- React.createElement(MenuItem, { value: "stub" }, InputValueForRender || React.createElement("span", { className: "placeholderContent" }, placeholder || 'No value')))
260
+ }, onFocus: edit, value: "stub", className: classes.inputWrapper, classes: { select: 'd-flex flex-wrap cursor-text' }, endAdornment: React.createElement(InputAdornment, { position: "end", className: clsx(classes.editIcon, 'invisible') },
261
+ React.createElement(Edit, { className: "test" })), IconComponent: stubComponent },
262
+ React.createElement(MenuItem, { value: "stub" }, InputValueForRender || React.createElement("span", { className: "placeholderContent" }, placeholder)))
270
263
  : null })));
271
264
  }, popupIcon: stubComponent(), disableListWrap: true, openOnFocus: true }))));
272
265
  }
@@ -69,6 +69,9 @@ const createOverrides = (palette) => ({
69
69
  },
70
70
  MuiSelect: {
71
71
  styleOverrides: {
72
+ outlined: {
73
+ padding: 'inherit'
74
+ },
72
75
  select: {
73
76
  '&:focus': {
74
77
  backgroundColor: 'none',
@@ -87,6 +90,12 @@ const createOverrides = (palette) => ({
87
90
  MuiInputBase: {
88
91
  styleOverrides: {
89
92
  root: {
93
+ '& .MuiInputAdornment-positionEnd.MuiInputAdornment-standard': {
94
+ color: palette.primary.main
95
+ },
96
+ '&.Mui-focused .MuiInputAdornment-positionEnd.MuiInputAdornment-standard': {
97
+ opacity: 1
98
+ },
90
99
  maxWidth: '100%',
91
100
  width: '100%',
92
101
  MuiInput: {
@@ -167,7 +176,15 @@ const createOverrides = (palette) => ({
167
176
  },
168
177
  MuiAutocomplete: {
169
178
  styleOverrides: {
179
+ root: {
180
+ '& .MuiOutlinedInput-root': {
181
+ padding: 'inherit'
182
+ }
183
+ },
170
184
  inputRoot: {
185
+ '& .MuiInputAdornment-outlined': {
186
+ paddingRight: 12
187
+ },
171
188
  flexWrap: 'inherit',
172
189
  }
173
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ish-ui",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "UI elements for onCourse and other ish apps",
5
5
  "main": "main.ts",
6
6
  "devDependencies": {
@@ -93,7 +93,7 @@
93
93
  "scripts": {
94
94
  "test": "exit 0",
95
95
  "start": "cross-env NODE_ENV=development webpack serve --config tools/webpack/webpack.config.dev.js",
96
- "build": "tsc && tsc-alias",
96
+ "build": "tsc -p tsconfig.prod.json && tsc-alias",
97
97
  "serve": "cross-env NODE_ENV=production webpack --config tools/webpack/webpack.config.prod.js && cross-env serve dist/",
98
98
  "lint": "eslint --ext .js,.jsx,.ts,.tsx src/"
99
99
  },
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig",
3
+ "exclude": [
4
+ "./dev"
5
+ ]
6
+ }