ish-ui 1.0.24 → 1.0.26

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.
@@ -64,7 +64,7 @@ function EditInPlaceDateTimeField({ type, formatDate, formatTime, formatDateTime
64
64
  setTextValue(formatDateInner(dateValue));
65
65
  }, [dateValue]);
66
66
  useEffect(() => {
67
- if (!active && processActionId) {
67
+ if (!active && processActionId && dispatch) {
68
68
  dispatch(endFieldProcessingAction(input.name));
69
69
  }
70
70
  }, [input.value, input.name, active, processActionId]);
@@ -111,7 +111,9 @@ function EditInPlaceDateTimeField({ type, formatDate, formatTime, formatDateTime
111
111
  input.onBlur(null);
112
112
  };
113
113
  const onBlur = () => {
114
- dispatch(startFieldProcessingAction(input.name));
114
+ if (dispatch) {
115
+ dispatch(startFieldProcessingAction(input.name));
116
+ }
115
117
  if (persistValue && !textValue) {
116
118
  input.onChange(input.value);
117
119
  input.onBlur(input.value);
@@ -163,8 +165,10 @@ function EditInPlaceDateTimeField({ type, formatDate, formatTime, formatDateTime
163
165
  'pointer-events-none': disabled
164
166
  }) },
165
167
  React.createElement("div", { id: input.name, className: "w-100" },
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)
168
+ 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, sx: variant === 'outlined' ? {
169
+ marginRight: -1
170
+ } : null, classes: {
171
+ root: clsx(fieldClasses.text, inline && classes.inlinePickerButton)
168
172
  } }, type === 'time'
169
173
  ? React.createElement(QueryBuilder, { fontSize: "inherit", color: "inherit" })
170
174
  : React.createElement(DateRange, { color: "inherit", fontSize: "inherit" })), InputProps: {
@@ -17,6 +17,7 @@ const useStyles = makeAppStyles(theme => ({
17
17
  overflow: 'hidden',
18
18
  textOverflow: 'ellipsis',
19
19
  maxWidth: '100%',
20
+ width: 'inherit',
20
21
  marginRight: theme.spacing(0.5)
21
22
  },
22
23
  rightLabel: {
@@ -60,7 +61,8 @@ const EditInPlaceFieldBase = ({ value, invalid, className, inline, label, fieldC
60
61
  const classes = useStyles();
61
62
  const inputNode = useRef();
62
63
  const onAdornmentClick = () => {
63
- inputNode.current.focus();
64
+ var _a;
65
+ (_a = inputNode.current) === null || _a === void 0 ? void 0 : _a.focus();
64
66
  };
65
67
  useEffect(() => {
66
68
  if (inline && inputNode.current) {
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { EditInPlaceFieldProps, FieldInputProps, FieldMetaProps } from '../model';
3
+ declare function EditInPlacePasswordField<FP extends FieldInputProps, MP extends FieldMetaProps>(props: EditInPlaceFieldProps<FP, MP>): React.JSX.Element;
4
+ export default EditInPlacePasswordField;
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+ import React, { useState } from 'react';
9
+ import VisibilityIcon from '@mui/icons-material/Visibility';
10
+ import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
11
+ import EditInPlaceField from './EditInPlaceField';
12
+ import IconButton from '@mui/material/IconButton';
13
+ function EditInPlacePasswordField(props) {
14
+ const [showPassword, setShowPassword] = useState(false);
15
+ return (React.createElement(EditInPlaceField, Object.assign({}, props, { type: showPassword ? 'text' : 'password', editIcon: React.createElement(IconButton, { sx: props.variant === 'outlined' ? { marginRight: -1 } : null, onClick: () => setShowPassword(!showPassword) }, showPassword ? React.createElement(VisibilityOffIcon, null) : React.createElement(VisibilityIcon, null)) })));
16
+ }
17
+ export default EditInPlacePasswordField;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ish-ui",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "UI elements for onCourse and other ish apps",
5
5
  "main": "main.ts",
6
6
  "devDependencies": {