norma-library 0.5.134 → 0.5.135

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.
@@ -5,7 +5,7 @@ import { styled } from '@mui/material/styles';
5
5
  import { IconButton } from './IconButton';
6
6
  import { Button } from './Button';
7
7
  var ModalStyled = styled(MuiModal)({});
8
- var ModalContentStyled = styled(Paper)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: 1px solid #00000033;\n border-radius: 4px;\n position: absolute;\n top: 50%;\n left: 50%;\n width: 421px;\n transform: translate(-50%, -50%);\n background-color: #FFF;\n box-shadow: 24px;\n"], ["\n border: 1px solid #00000033;\n border-radius: 4px;\n position: absolute;\n top: 50%;\n left: 50%;\n width: 421px;\n transform: translate(-50%, -50%);\n background-color: #FFF;\n box-shadow: 24px;\n"])));
8
+ var ModalContentStyled = styled(Paper)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: 1px solid #00000033;\n border-radius: 4px;\n position: absolute;\n top: 50%;\n left: 50%;\n width: ", ";\n transform: translate(-50%, -50%);\n background-color: #fff;\n"], ["\n border: 1px solid #00000033;\n border-radius: 4px;\n position: absolute;\n top: 50%;\n left: 50%;\n width: ", ";\n transform: translate(-50%, -50%);\n background-color: #fff;\n"])), function (props) { return props.$w || '421px'; });
9
9
  var ModalHeaderStyled = styled(Box)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n text-align: left;\n border-bottom: 1px solid #00000033;\n box-sizing: border-box;\n margin: 0;\n position: relative;\n padding: 22px 26px 15px 26px;\n justify-content: space-between;\n display: flex;\n\n & h2 {\n font-style: normal;\n font-weight: 600;\n font-size: 18px;\n color: #292929;\n }\n"], ["\n text-align: left;\n border-bottom: 1px solid #00000033;\n box-sizing: border-box;\n margin: 0;\n position: relative;\n padding: 22px 26px 15px 26px;\n justify-content: space-between;\n display: flex;\n\n & h2 {\n font-style: normal;\n font-weight: 600;\n font-size: 18px;\n color: #292929;\n }\n"])));
10
10
  var ModalFooterStyled = styled(Box)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border-top: 1px solid #00000033;\n box-sizing: border-box;\n position: relative;\n padding: 24px;\n display: flex;\n justify-content: end;\n gap: 24px;\n"], ["\n border-top: 1px solid #00000033;\n box-sizing: border-box;\n position: relative;\n padding: 24px;\n display: flex;\n justify-content: end;\n gap: 24px;\n"])));
11
11
  var ModalContainerChildrenStyled = styled(Box)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n box-sizing: border-box;\n padding: 24px;\n"], ["\n box-sizing: border-box;\n padding: 24px;\n"])));
@@ -17,10 +17,10 @@ export var Modal = function (_a) {
17
17
  var _b;
18
18
  var open = _a.open, children = _a.children, paperProps = _a.paperProps, props = __rest(_a, ["open", "children", "paperProps"]);
19
19
  return (React.createElement(ModalStyled, __assign({ open: true }, props),
20
- React.createElement(ModalContentStyled, __assign({}, paperProps),
20
+ React.createElement(ModalContentStyled, __assign({}, paperProps, { "$w": props.width }),
21
21
  props.title && (React.createElement(ModalHeaderStyled, null,
22
- React.createElement(Typography, { variant: 'h2' }, props.title),
23
- React.createElement(IconButton, { onClick: props.onClose, size: "small", color: "inherit", variant: "text", cursor: "pointer", sx: { padding: "0" } },
22
+ React.createElement(Typography, { variant: "h2" }, props.title),
23
+ React.createElement(IconButton, { onClick: props.onClose, size: "small", color: "inherit", variant: "text", cursor: "pointer", sx: { padding: '0' } },
24
24
  React.createElement(Close, null)))),
25
25
  React.createElement(ModalContainerChildrenStyled, null, children),
26
26
  !!((_b = props.action) === null || _b === void 0 ? void 0 : _b.length) && (React.createElement(ModalFooterStyled, null, props.action.map(function (_a, key) {
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,eAAe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ChB,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;oBAEpB,oBAAC,KAAK,OAAG,CACE,CACK,CACrB;YACD,oBAAC,4BAA4B,QAAE,QAAQ,CAAgC;YACtE,CAAC,CAAC,CAAA,MAAA,KAAK,CAAC,MAAM,0CAAE,MAAM,CAAA,IAAI,CACzB,oBAAC,iBAAiB,QACf,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,EAAgD,EAAE,GAAG;gBAAnD,IAAA,KAAK,WAAA,EAAE,OAAO,aAAA,EAAE,MAAM,YAAA,EAAE,IAAI,UAAA,EAAE,KAAK,WAAA,EAAK,IAAI,cAA9C,+CAAgD,CAAF;gBAAY,OAAA,CAC3E,oBAAC,MAAM,aAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,IAAM,IAAI,GACpF,KAAK,CACC,CACV,CAAA;aAAA,CAAC,CACgB,CACrB,CACkB,CACT,CACf,CAAC;AACJ,CAAC,CAAC"}
@@ -9,8 +9,8 @@ export interface ModalBaseProps extends MuiModalBaseProps {
9
9
  onClose?: React.ReactEventHandler<{}>;
10
10
  action?: OnAction[];
11
11
  className?: string;
12
- full?: boolean;
13
12
  title?: string;
14
13
  id?: string;
15
14
  paperProps?: MuiPaperBaseProps;
15
+ width?: string;
16
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "norma-library",
3
- "version": "0.5.134",
3
+ "version": "0.5.135",
4
4
  "private": false,
5
5
  "description": "Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.",
6
6
  "scripts": {
@@ -7,16 +7,15 @@ import { Button } from './Button';
7
7
 
8
8
  const ModalStyled = styled(MuiModal)({});
9
9
 
10
- const ModalContentStyled = styled(Paper)`
10
+ const ModalContentStyled = styled(Paper)<{ $w?: string }>`
11
11
  border: 1px solid #00000033;
12
12
  border-radius: 4px;
13
13
  position: absolute;
14
14
  top: 50%;
15
15
  left: 50%;
16
- width: 421px;
16
+ width: ${props => props.$w || '421px'};
17
17
  transform: translate(-50%, -50%);
18
- background-color: #FFF;
19
- box-shadow: 24px;
18
+ background-color: #fff;
20
19
  `;
21
20
 
22
21
  const ModalHeaderStyled = styled(Box)`
@@ -74,36 +73,27 @@ export function Close() {
74
73
  export const Modal = ({ open, children, paperProps, ...props }: ModalBaseProps) => {
75
74
  return (
76
75
  <ModalStyled open {...props}>
77
- <ModalContentStyled {...paperProps}>
76
+ <ModalContentStyled {...paperProps} $w={props.width}>
78
77
  {props.title && (
79
78
  <ModalHeaderStyled>
80
- <Typography variant='h2'>{props.title}</Typography>
79
+ <Typography variant="h2">{props.title}</Typography>
81
80
  <IconButton
82
81
  onClick={props.onClose}
83
82
  size="small"
84
83
  color="inherit"
85
84
  variant="text"
86
85
  cursor="pointer"
87
- sx={{padding: "0"}}
86
+ sx={{ padding: '0' }}
88
87
  >
89
88
  <Close />
90
89
  </IconButton>
91
90
  </ModalHeaderStyled>
92
91
  )}
93
- <ModalContainerChildrenStyled>
94
- {children}
95
- </ModalContainerChildrenStyled>
96
- {!!props.action?.length && (
92
+ <ModalContainerChildrenStyled>{children}</ModalContainerChildrenStyled>
93
+ {!!props.action?.length && (
97
94
  <ModalFooterStyled>
98
- {props.action.map(({color, variant, action, size, label, ...rest}, key) => (
99
- <Button
100
- color={color}
101
- variant={variant}
102
- key={key}
103
- onClick={action}
104
- size={size}
105
- {...rest}
106
- >
95
+ {props.action.map(({ color, variant, action, size, label, ...rest }, key) => (
96
+ <Button color={color} variant={variant} key={key} onClick={action} size={size} {...rest}>
107
97
  {label}
108
98
  </Button>
109
99
  ))}
@@ -9,8 +9,8 @@ export interface ModalBaseProps extends MuiModalBaseProps {
9
9
  onClose?: React.ReactEventHandler<{}>;
10
10
  action?: OnAction[];
11
11
  className?: string;
12
- full?: boolean;
13
12
  title?: string;
14
13
  id?: string;
15
14
  paperProps?: MuiPaperBaseProps;
15
+ width?: string;
16
16
  }
@@ -16,8 +16,6 @@ const meta = {
16
16
 
17
17
  export default meta;
18
18
 
19
- type Story = StoryObj<typeof meta>;
20
-
21
19
  export const ModalBasic = () => {
22
20
  const [open, setOpen] = React.useState(false);
23
21
  const handleOpen = () => setOpen(true);
@@ -122,8 +120,8 @@ export const ModalAction = () => {
122
120
  action={defaultAction}
123
121
  paperProps={{
124
122
  sx: {
125
- width: "90vw"
126
- }
123
+ width: '90vw',
124
+ },
127
125
  }}
128
126
  >
129
127
  <>
@@ -193,3 +191,56 @@ export const ModalProps = () => {
193
191
  };
194
192
 
195
193
  ModalProps.storyName = 'Modal Title and Action';
194
+
195
+ export const ModalSize = () => {
196
+ const [open, setOpen] = React.useState(false);
197
+ const handleOpen = () => setOpen(true);
198
+ const handleClose = () => setOpen(false);
199
+
200
+ const defaultAction = [
201
+ {
202
+ label: 'Cancelar',
203
+ action: handleClose,
204
+ color: 'error',
205
+ size: 'medium',
206
+ variant: 'outlined',
207
+ },
208
+ {
209
+ label: 'Confirmar',
210
+ action: handleClose,
211
+ color: 'primary',
212
+ size: 'medium',
213
+ variant: 'contained',
214
+ },
215
+ ];
216
+ return (
217
+ <>
218
+ <Button onClick={handleOpen} color="primary" variant="outlined">
219
+ Open modal
220
+ </Button>
221
+
222
+ {open && (
223
+ <Modal
224
+ open={open}
225
+ onClose={handleClose}
226
+ aria-labelledby="modal-modal-title"
227
+ aria-describedby="modal-modal-description"
228
+ action={defaultAction}
229
+ title="Select a company"
230
+ width='90vw'
231
+ >
232
+ <>
233
+ <Typography id="modal-modal-title" variant="h6" component="h2">
234
+ Text in a modal
235
+ </Typography>
236
+ <Typography id="modal-modal-description" sx={{ mt: 2 }}>
237
+ Duis mollis, est non commodo luctus, nisi erat porttitor ligula.
238
+ </Typography>
239
+ </>
240
+ </Modal>
241
+ )}
242
+ </>
243
+ );
244
+ };
245
+
246
+ ModalSize.storyName = 'Modal width and height';