@symply.io/basic-components 1.7.11 → 1.7.12-alpha.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.
@@ -76,7 +76,7 @@ var Transition = forwardRef(function Transition(props, ref) {
76
76
  });
77
77
  function BasicModal(props, ref) {
78
78
  var _this = this;
79
- var desc = props.desc, title = props.title, loading = props.loading, buttons = props.buttons, _a = props.open, open = _a === void 0 ? false : _a, _b = props.noForm, noForm = _b === void 0 ? false : _b, children = props.children, disabled = props.disabled, _c = props.maxWidth, maxWidth = _c === void 0 ? "sm" : _c, _d = props.color, color = _d === void 0 ? "primary" : _d, _e = props.submitText, submitText = _e === void 0 ? "Save" : _e, _f = props.cancelText, cancelText = _f === void 0 ? "Cancel" : _f, _g = props.hideBottomButtons, hideBottomButtons = _g === void 0 ? false : _g, _h = props.showTopRightCloseButton, showTopRightCloseButton = _h === void 0 ? false : _h, onClose = props.onClose, onSubmit = props.onSubmit, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["desc", "title", "loading", "buttons", "open", "noForm", "children", "disabled", "maxWidth", "color", "submitText", "cancelText", "hideBottomButtons", "showTopRightCloseButton", "onClose", "onSubmit", "primaryColor", "secondaryColor"]);
79
+ var desc = props.desc, title = props.title, loading = props.loading, buttons = props.buttons, _a = props.open, open = _a === void 0 ? false : _a, _b = props.noForm, noForm = _b === void 0 ? false : _b, children = props.children, disabled = props.disabled, _c = props.maxWidth, maxWidth = _c === void 0 ? "sm" : _c, _d = props.color, color = _d === void 0 ? "primary" : _d, submitButtonColor = props.submitButtonColor, cancelButtonColor = props.cancelButtonColor, _e = props.submitText, submitText = _e === void 0 ? "Save" : _e, _f = props.cancelText, cancelText = _f === void 0 ? "Cancel" : _f, _g = props.hideBottomButtons, hideBottomButtons = _g === void 0 ? false : _g, _h = props.showTopRightCloseButton, showTopRightCloseButton = _h === void 0 ? false : _h, onClose = props.onClose, onSubmit = props.onSubmit, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["desc", "title", "loading", "buttons", "open", "noForm", "children", "disabled", "maxWidth", "color", "submitButtonColor", "cancelButtonColor", "submitText", "cancelText", "hideBottomButtons", "showTopRightCloseButton", "onClose", "onSubmit", "primaryColor", "secondaryColor"]);
80
80
  if (!noForm && !buttons && !onSubmit) {
81
81
  throw new Error("Error from @symply.io/basic-components/BasicModal: `onSubmit` is required when there are no custom buttons and `noForm` is false.");
82
82
  }
@@ -121,7 +121,7 @@ function BasicModal(props, ref) {
121
121
  ? undefined
122
122
  : function (ev) {
123
123
  ev.preventDefault();
124
- } }, { children: [desc && _jsx(DialogContentText, { children: desc }), Boolean(children) && cloneElement(children)] })) })), !hideBottomButtons && (_jsx(DialogActions, __assign({ sx: { padding: theme.spacing(1.25) } }, { children: _jsx(Grid, __assign({ container: true, spacing: 2, justifyContent: "flex-end", alignItems: "center", sx: { margin: 0 } }, { children: buttons || (_jsxs(_Fragment, { children: [_jsx(Grid, __assign({ item: true, xs: 12, md: 3, xl: 2 }, { children: _jsx(Button, __assign({ onClick: onClose, variant: "outlined", color: color, disabled: loading, fullWidth: true }, { children: cancelText })) })), _jsx(Grid, __assign({ item: true, xs: 12, md: 3, xl: 2 }, { children: _jsx(Button, __assign({ type: noForm ? "button" : "submit", onClick: noForm ? onSubmit : onFormSubmit, variant: "contained", color: color, disabled: loading || disabled, fullWidth: true }, { children: submitText })) }))] })) })) })))] })) })));
124
+ } }, { children: [desc && _jsx(DialogContentText, { children: desc }), Boolean(children) && cloneElement(children)] })) })), !hideBottomButtons && (_jsx(DialogActions, __assign({ sx: { padding: theme.spacing(1.25) } }, { children: _jsx(Grid, __assign({ container: true, spacing: 2, justifyContent: "flex-end", alignItems: "center", sx: { margin: 0 } }, { children: buttons || (_jsxs(_Fragment, { children: [_jsx(Grid, __assign({ item: true, xs: 12, md: "auto" }, { children: _jsx(Button, __assign({ onClick: onClose, variant: "outlined", color: cancelButtonColor || color, disabled: loading, fullWidth: fullScreen }, { children: cancelText })) })), _jsx(Grid, __assign({ item: true, xs: 12, md: "auto" }, { children: _jsx(Button, __assign({ type: noForm ? "button" : "submit", onClick: noForm ? onSubmit : onFormSubmit, variant: "contained", color: submitButtonColor || color, disabled: loading || disabled, fullWidth: fullScreen }, { children: submitText })) }))] })) })) })))] })) })));
125
125
  }
126
126
  var BasicModalWithRefForward = forwardRef(BasicModal);
127
127
  BasicModalWithRefForward.displayName = "BasicModal";
@@ -10,6 +10,8 @@ export interface BasicModalProps extends DialogProps {
10
10
  buttons?: ReactNode;
11
11
  submitText?: string;
12
12
  cancelText?: string;
13
+ submitButtonColor?: ButtonProps["color"];
14
+ cancelButtonColor?: ButtonProps["color"];
13
15
  hideBottomButtons?: boolean;
14
16
  noForm?: boolean;
15
17
  onClose: () => unknown | Promise<unknown>;
package/README.md CHANGED
@@ -190,25 +190,27 @@ import BasicModal from '@symply.io/basic-components/BasicModal';
190
190
 
191
191
  <h5>Props</h5>
192
192
 
193
- | Name | Type | Default | Required | Description |
194
- | ----------------------- | ------------------------------------------------------------ | --------- | -------- | ------------------------------------------------------------ |
195
- | cancelText | string | 'Cancel' | false | The text of the cancel button. |
196
- | children | node | | true | The content of the component. |
197
- | color | 'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' \| undefined | 'primary' | false | The main color of the component. |
198
- | desc | string | | false | Some descriptions you want to add, similar to a subtitle. |
199
- | disabled | bool | false | false | If `true`, the submit button would be disabled. |
200
- | hideBottomButtons | bool | false | false | If `true`, hide all action buttons at the bottom of the modal. |
201
- | loading | bool | false | false | If `true`, the submit and cancel buttons would be disabled. |
202
- | maxWidth | 'xs' \|'sm' \|'md' \|'lg' \|'xl' | 'sm' | false | Determine the max-width of the dialog. The dialog width grows with the size of the screen. Set to `false` to disable `maxWidth`. |
203
- | noForm | bool | false | False | If `true`, put the content and action buttons out of a form element. |
204
- | onClose | func | | true | Callback fired when the cancel button requests to be clicked.<br />**Signature:**<br/>`function() => void` |
205
- | onSubmit | func | | true | Callback fired when the submit button requests to be clicked.<br />**Signature:**<br/>`function() => void` |
206
- | open | bool | false | true | If `true`, the component is shown. |
207
- | ref | ref | | false | You can get the form "onSubmit" function from the ref. |
208
- | scroll | 'body' \| 'paper' | 'paper' | false | Determine the container for scrolling the dialog. |
209
- | showTopRightCloseButton | bool | false | false | If `true`, show a close icon button at the top right of the modal. |
210
- | submitText | string | ‘Save’ | false | The text of the submit button. |
211
- | title | string | | true | The title of the component, to show at the top left. |
193
+ | Name | Type | Default | Required | Description |
194
+ | ----------------------- | ------------------------------------------------------------ | ------------------- | -------- | ------------------------------------------------------------ |
195
+ | cancelButtonColor | 'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' \| undefined | same as the `color` | false | The color of the cancel button. |
196
+ | cancelText | string | 'Cancel' | false | The text of the cancel button. |
197
+ | children | node | | true | The content of the component. |
198
+ | color | 'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' \| undefined | 'primary' | false | The main color of the component. |
199
+ | desc | string | | false | Some descriptions you want to add, similar to a subtitle. |
200
+ | disabled | bool | false | false | If `true`, the submit button would be disabled. |
201
+ | hideBottomButtons | bool | false | false | If `true`, hide all action buttons at the bottom of the modal. |
202
+ | loading | bool | false | false | If `true`, the submit and cancel buttons would be disabled. |
203
+ | maxWidth | 'xs' \|'sm' \|'md' \|'lg' \|'xl' | 'sm' | false | Determine the max-width of the dialog. The dialog width grows with the size of the screen. Set to `false` to disable `maxWidth`. |
204
+ | noForm | bool | false | False | If `true`, put the content and action buttons out of a form element. |
205
+ | onClose | func | | true | Callback fired when the cancel button requests to be clicked.<br />**Signature:**<br/>`function() => void` |
206
+ | onSubmit | func | | true | Callback fired when the submit button requests to be clicked.<br />**Signature:**<br/>`function() => void` |
207
+ | open | bool | false | true | If `true`, the component is shown. |
208
+ | ref | ref | | false | You can get the form "onSubmit" function from the ref. |
209
+ | scroll | 'body' \| 'paper' | 'paper' | false | Determine the container for scrolling the dialog. |
210
+ | submitButtonColor | 'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' \| undefined | same as the `color` | false | The color of the submit button. |
211
+ | submitText | string | ‘Save’ | false | The text of the submit button. |
212
+ | showTopRightCloseButton | bool | false | false | If `true`, show a close icon button at the top right of the modal. |
213
+ | title | string | | true | The title of the component, to show at the top left. |
212
214
 
213
215
 
214
216
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.7.11",
3
+ "version": "1.7.12-alpha.1",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",