@occmundial/occ-atomic 3.0.0-beta.39 → 3.0.0-beta.40

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [3.0.0-beta.40](https://github.com/occmundial/occ-atomic/compare/v3.0.0-beta.39...v3.0.0-beta.40) (2024-08-05)
2
+
3
+
4
+ ### Features
5
+
6
+ * Update the Modal component ([b10976b](https://github.com/occmundial/occ-atomic/commit/b10976b0a7e2020d714f2097b3fb6b4f12aadb6e))
7
+
1
8
  # [3.0.0-beta.39](https://github.com/occmundial/occ-atomic/compare/v3.0.0-beta.38...v3.0.0-beta.39) (2024-07-31)
2
9
 
3
10
 
@@ -11,20 +11,12 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
- var _Card = _interopRequireDefault(require("../Card"));
15
-
16
- var _Icon = _interopRequireDefault(require("../Icon"));
17
-
18
14
  var _Text = _interopRequireDefault(require("../Text"));
19
15
 
20
16
  var _Flexbox = _interopRequireDefault(require("../Flexbox"));
21
17
 
22
18
  var _Button = _interopRequireDefault(require("../Button"));
23
19
 
24
- var _colors = _interopRequireDefault(require("../subatomic/colors"));
25
-
26
- var _grid = _interopRequireDefault(require("../subatomic/grid"));
27
-
28
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
21
 
30
22
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -49,8 +41,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
49
41
 
50
42
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
51
43
 
52
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
53
-
54
44
  /**
55
45
  * The Modal component is rendered in any given container, avoiding z-index an position conflicts. Your application must have the logic to show or hide the Modal component.
56
46
  */
@@ -65,17 +55,12 @@ var Modal = /*#__PURE__*/function (_React$Component) {
65
55
  _classCallCheck(this, Modal);
66
56
 
67
57
  _this = _super.call(this, props);
68
-
69
- _defineProperty(_assertThisInitialized(_this), "resize", function () {
70
- _this.setState({
71
- mobile: window.innerWidth < _grid["default"].xs
72
- });
73
- });
74
-
75
58
  _this.state = {
76
- mobile: false
59
+ headerBorder: false,
60
+ footerBorder: false
77
61
  };
78
62
  _this.onKeyDown = _this.onKeyDown.bind(_assertThisInitialized(_this));
63
+ _this.onScroll = _this.onScroll.bind(_assertThisInitialized(_this));
79
64
  return _this;
80
65
  }
81
66
 
@@ -83,21 +68,53 @@ var Modal = /*#__PURE__*/function (_React$Component) {
83
68
  key: "componentDidMount",
84
69
  value: function componentDidMount() {
85
70
  window.addEventListener('keydown', this.onKeyDown);
86
- window.addEventListener('resize', this.resize);
87
- this.resize();
88
71
  }
89
72
  }, {
90
73
  key: "componentWillUnmount",
91
74
  value: function componentWillUnmount() {
92
75
  window.removeEventListener('keydown', this.onKeyDown);
93
- window.removeEventListener('resize', this.resize);
76
+ }
77
+ }, {
78
+ key: "onScroll",
79
+ value: function onScroll(e) {
80
+ var _e$currentTarget = e.currentTarget,
81
+ scrollTop = _e$currentTarget.scrollTop,
82
+ scrollHeight = _e$currentTarget.scrollHeight,
83
+ clientHeight = _e$currentTarget.clientHeight;
84
+
85
+ if (scrollHeight > clientHeight) {
86
+ if (scrollTop > 0) {
87
+ this.setState({
88
+ headerBorder: true
89
+ });
90
+ } else {
91
+ this.setState({
92
+ headerBorder: false
93
+ });
94
+ }
95
+
96
+ if (scrollTop + clientHeight + 1 < scrollHeight) {
97
+ this.setState({
98
+ footerBorder: true
99
+ });
100
+ } else {
101
+ this.setState({
102
+ footerBorder: false
103
+ });
104
+ }
105
+ } else {
106
+ this.setState({
107
+ headerBorder: false,
108
+ footerBorder: false
109
+ });
110
+ }
94
111
  }
95
112
  }, {
96
113
  key: "onKeyDown",
97
114
  value: function onKeyDown(_ref) {
98
115
  var which = _ref.which;
99
116
  var onClose = this.props.onClose;
100
- if (onClose && which == 27) onClose();
117
+ if (onClose && which === 27) onClose();
101
118
  }
102
119
  }, {
103
120
  key: "avoidClose",
@@ -107,7 +124,6 @@ var Modal = /*#__PURE__*/function (_React$Component) {
107
124
  }, {
108
125
  key: "render",
109
126
  value: function render() {
110
- var mobile = this.state.mobile;
111
127
  var _this$props = this.props,
112
128
  classes = _this$props.classes,
113
129
  children = _this$props.children,
@@ -116,28 +132,31 @@ var Modal = /*#__PURE__*/function (_React$Component) {
116
132
  mainBtn = _this$props.mainBtn,
117
133
  show = _this$props.show,
118
134
  secBtn = _this$props.secBtn,
119
- size = _this$props.size,
120
- imgTop = _this$props.imgTop,
121
- imgLeft = _this$props.imgLeft,
135
+ _this$props$size = _this$props.size,
136
+ size = _this$props$size === void 0 ? 'md' : _this$props$size,
137
+ _this$props$imgTop = _this$props.imgTop,
138
+ imgTop = _this$props$imgTop === void 0 ? {} : _this$props$imgTop,
139
+ _this$props$imgLeft = _this$props.imgLeft,
140
+ imgLeft = _this$props$imgLeft === void 0 ? {} : _this$props$imgLeft,
122
141
  onTransitionEnd = _this$props.onTransitionEnd,
123
142
  fullSize = _this$props.fullSize,
124
143
  testId = _this$props.testId;
144
+ var _this$state = this.state,
145
+ headerBorder = _this$state.headerBorder,
146
+ footerBorder = _this$state.footerBorder;
125
147
 
126
- var closeButton = /*#__PURE__*/_react["default"].createElement("div", {
127
- className: classes.closeIcon
128
- }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], _extends({
129
- iconName: "close",
130
- width: 24,
131
- height: 24,
132
- colors: [_colors["default"].grey900],
133
- onClick: onClose
148
+ var closeButton = /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
149
+ theme: "ghostGrey",
150
+ onClick: onClose,
151
+ icon: "x",
152
+ size: "md"
134
153
  }, testId && {
135
154
  testId: "".concat(testId, "__close-icon")
136
- })));
155
+ }));
137
156
 
138
157
  return /*#__PURE__*/_react["default"].createElement("div", {
139
158
  "data-testid": testId,
140
- className: "".concat(classes.overlay, " ").concat(show ? classes.overlayShow : classes.overlayHide).concat(!onClose ? " ".concat(classes.noClose) : ''),
159
+ className: "".concat(classes.overlay, " ").concat(show ? classes.show : classes.hide).concat(!onClose ? " ".concat(classes.noClose) : ''),
141
160
  onClick: onClose,
142
161
  onTransitionEnd: onTransitionEnd
143
162
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -145,43 +164,51 @@ var Modal = /*#__PURE__*/function (_React$Component) {
145
164
  }, /*#__PURE__*/_react["default"].createElement("div", {
146
165
  className: classes.cardBlock,
147
166
  onClick: this.avoidClose
148
- }, /*#__PURE__*/_react["default"].createElement(_Card["default"], {
149
- shadow: 5,
150
- className: "".concat(classes.card).concat(size ? " ".concat(classes[size]) : '').concat(show ? " ".concat(classes.cardShow) : " ".concat(classes.cardHide))
151
- }, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
167
+ }, /*#__PURE__*/_react["default"].createElement("div", {
168
+ className: "".concat(classes.card).concat(size ? " ".concat(classes[size]) : '').concat(fullSize ? " ".concat(classes.fullSize) : '')
169
+ }, /*#__PURE__*/_react["default"].createElement("div", {
170
+ className: classes.split
171
+ }, imgLeft.img && /*#__PURE__*/_react["default"].createElement("div", {
172
+ style: {
173
+ backgroundColor: imgLeft.color || 'transparent',
174
+ backgroundImage: "url(".concat(imgLeft.img, ")"),
175
+ backgroundSize: imgLeft.size || 'cover',
176
+ backgroundPosition: imgLeft.position || 'center'
177
+ },
178
+ className: classes.imgLeft
179
+ }), /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
152
180
  display: "flex",
153
- direction: imgLeft.img ? 'row' : 'col'
154
- }, (imgLeft.img || imgTop.img) && /*#__PURE__*/_react["default"].createElement("div", {
155
- className: imgLeft.img ? classes.imgLeft : classes.imgTop
156
- }, imgTop.img && onClose && /*#__PURE__*/_react["default"].createElement("div", {
157
- className: classes.closePosition
158
- }, closeButton)), /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
159
- flex: imgLeft.img ? '1' : null
160
- }, fullSize && mobile ? /*#__PURE__*/_react["default"].createElement("div", {
161
- className: classes.top
162
- }, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
163
- alignItems: "end",
164
- className: classes.top
165
- }, !imgTop.img && onClose && closeButton), title && /*#__PURE__*/_react["default"].createElement(_Text["default"], {
166
- heading: true,
167
- className: classes.title
168
- }, title)) : /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
181
+ direction: "col",
182
+ className: classes.contentWrapper
183
+ }, title || onClose ? /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
169
184
  display: "flex",
170
185
  justifyContent: "end",
171
186
  alignItems: "start",
172
- className: classes.top
187
+ className: "".concat(classes.header).concat(headerBorder ? " ".concat(classes.headerBorder) : '').concat(imgTop.img ? " ".concat(classes.stickyHeader) : '').concat(imgTop.img && headerBorder ? " ".concat(classes.solidHeader) : '')
173
188
  }, title && /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
174
189
  flex: "1"
175
- }, /*#__PURE__*/_react["default"].createElement(_Text["default"], {
176
- heading: true,
190
+ }, /*#__PURE__*/_react["default"].createElement("h4", {
177
191
  className: classes.title
178
- }, title)), !imgTop.img && onClose && closeButton), /*#__PURE__*/_react["default"].createElement("div", {
192
+ }, title)), onClose && closeButton) : null, /*#__PURE__*/_react["default"].createElement("div", {
193
+ onScroll: this.onScroll,
179
194
  className: classes.content
180
- }, children), mainBtn && /*#__PURE__*/_react["default"].createElement("div", {
181
- className: classes.bottom
195
+ }, imgTop.img && /*#__PURE__*/_react["default"].createElement("div", {
196
+ style: {
197
+ backgroundColor: imgTop.color || 'transparent',
198
+ backgroundImage: "url(".concat(imgTop.img, ")"),
199
+ backgroundSize: imgTop.size || 'cover',
200
+ backgroundPosition: imgTop.position || 'center'
201
+ },
202
+ className: classes.imgTop
203
+ }), /*#__PURE__*/_react["default"].createElement(_Text["default"], {
204
+ tag: "div",
205
+ className: "".concat(classes.contentChild).concat(!title && !onClose ? " ".concat(classes.noHeader) : '').concat(!mainBtn ? " ".concat(classes.noFooter) : '')
206
+ }, children)), mainBtn && /*#__PURE__*/_react["default"].createElement("div", {
207
+ className: "".concat(classes.footer).concat(footerBorder ? " ".concat(classes.footerBorder) : '')
182
208
  }, secBtn && /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
209
+ type: secBtn.type,
210
+ size: "lg",
183
211
  theme: "ghostGrey",
184
- className: classes.secBtn,
185
212
  onClick: secBtn.onClick,
186
213
  href: secBtn.href,
187
214
  target: secBtn.target,
@@ -189,9 +216,10 @@ var Modal = /*#__PURE__*/function (_React$Component) {
189
216
  disabled: secBtn.disabled,
190
217
  id: secBtn.id
191
218
  }, testId && {
192
- testId: "".concat(testId, "__button_secondary")
219
+ testId: "".concat(testId, "__button-secondary")
193
220
  }), secBtn.text), /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
194
- className: classes.mainBtn,
221
+ type: mainBtn.type,
222
+ size: "lg",
195
223
  onClick: mainBtn.onClick,
196
224
  href: mainBtn.href,
197
225
  target: mainBtn.target,
@@ -199,7 +227,7 @@ var Modal = /*#__PURE__*/function (_React$Component) {
199
227
  disabled: mainBtn.disabled,
200
228
  id: mainBtn.id
201
229
  }, testId && {
202
- testId: "".concat(testId, "__button_main")
230
+ testId: "".concat(testId, "__button-main")
203
231
  }), mainBtn.text))))))));
204
232
  }
205
233
  }]);
@@ -71,11 +71,11 @@ describe("Modal", function () {
71
71
  onClose: onClose,
72
72
  show: true
73
73
  }));
74
- expect(wrapper.find('.overlayShow').length).toBe(1);
74
+ expect(wrapper.find('.show').length).toBe(1);
75
75
  wrapper.setProps({
76
76
  show: false
77
77
  });
78
- expect(wrapper.find('.overlayHide').length).toBe(1);
78
+ expect(wrapper.find('.hide').length).toBe(1);
79
79
  });
80
80
  it('renders the title', function () {
81
81
  var onClose = jest.fn();
@@ -106,12 +106,19 @@ describe("Modal", function () {
106
106
  secBtn: {
107
107
  text: 'Secondary button',
108
108
  onClick: onClose
109
- }
109
+ },
110
+ testId: "modal"
110
111
  }));
111
- wrapper.find('.mainBtn').at(0).simulate('click');
112
- wrapper.find('.secBtn').at(0).simulate('click');
113
- expect(wrapper.find('.mainBtn').at(0).text()).toBe('Main button');
114
- expect(wrapper.find('.secBtn').at(0).text()).toBe('Secondary button');
112
+ var mainBtn = wrapper.find({
113
+ 'data-testid': 'modal__button-main'
114
+ }).at(0);
115
+ var secBtn = wrapper.find({
116
+ 'data-testid': 'modal__button-secondary'
117
+ }).at(0);
118
+ mainBtn.simulate('click');
119
+ secBtn.simulate('click');
120
+ expect(mainBtn.text()).toBe('Main button');
121
+ expect(secBtn.text()).toBe('Secondary button');
115
122
  expect(onClose.mock.calls.length).toBe(2);
116
123
  });
117
124
  });
@@ -27,51 +27,30 @@ Object {
27
27
  "opacity": 1,
28
28
  },
29
29
  },
30
- "bottom": Object {
31
- "marginTop": 8,
32
- "textAlign": "right",
33
- },
34
30
  "card": Object {
35
31
  "@media screen and (max-width:575px)": Object {
36
32
  "borderRadius": [Function],
37
33
  "minHeight": [Function],
38
- "padding": [Function],
39
- },
40
- "@media screen and (min-width:768px)": Object {
41
- "padding": 32,
42
34
  },
35
+ "background": "#fff",
36
+ "border": "1px solid #D3D4DC",
37
+ "borderRadius": "8px",
43
38
  "cursor": "auto",
44
39
  "maxWidth": "100%",
45
- "padding": 16,
40
+ "overflow": "hidden",
46
41
  "transition": "0.3s opacity, 0.3s margin-top",
47
42
  },
48
43
  "cardBlock": Object {
49
44
  "@media screen and (max-width:575px)": Object {
50
- "height": [Function],
51
45
  "margin": [Function],
52
46
  },
53
47
  "margin": 12,
54
48
  },
55
- "cardHide": Object {
56
- "marginTop": -64,
57
- "opacity": 0,
58
- },
59
- "cardShow": Object {
60
- "animation": "0.3s modalFadeDown ease-out",
61
- },
62
49
  "cardWrapper": Object {
63
- "@media screen and (max-width:575px)": Object {
64
- "height": [Function],
65
- },
66
- "maxHeight": "100%",
67
- "maxWidth": "100%",
50
+ "maxHeight": "100vh",
51
+ "maxWidth": "100vw",
68
52
  "position": "relative",
69
53
  },
70
- "closeIcon": Object {
71
- "alignItems": "center",
72
- "display": "flex",
73
- "height": 32,
74
- },
75
54
  "closePosition": Object {
76
55
  "@media screen and (min-width:768px)": Object {
77
56
  "right": 32,
@@ -89,84 +68,127 @@ Object {
89
68
  "background": "#dddddd",
90
69
  "borderRadius": 3,
91
70
  },
92
- "@media screen and (min-width:768px)": Object {
93
- "marginLeft": -32,
94
- "marginRight": -32,
95
- "paddingLeft": 32,
96
- "paddingRight": 32,
97
- },
98
- "marginLeft": -16,
99
- "marginRight": -16,
100
- "paddingLeft": 16,
101
- "paddingRight": 16,
71
+ "flex": 1,
72
+ "overflow": "auto",
102
73
  "transition": "0.1s height",
103
74
  },
104
- "imgLeft": Object {
105
- "@media screen and (min-width:768px)": Object {
106
- "marginBottom": -32,
107
- "marginLeft": -32,
108
- "marginRight": 32,
109
- "marginTop": -32,
110
- },
111
- "backgroundColor": [Function],
112
- "backgroundImage": [Function],
113
- "backgroundPosition": [Function],
114
- "backgroundRepeat": "no-repeat",
115
- "backgroundSize": [Function],
116
- "borderRadius": Array [
117
- 6,
118
- 0,
119
- 0,
120
- 6,
75
+ "contentChild": Object {
76
+ "@media screen and (min-width:576px)": Object {
77
+ "padding": Array [
78
+ "12px",
79
+ "40px",
80
+ ],
81
+ },
82
+ "borderBottom": "1px solid transparent",
83
+ "padding": "12px",
84
+ },
85
+ "contentWrapper": Object {
86
+ "flex": 1,
87
+ "height": "auto",
88
+ "maxHeight": "85vh",
89
+ },
90
+ "footer": Object {
91
+ "@media screen and (min-width:576px)": Object {
92
+ "flexDirection": "row",
93
+ "gap": "8px",
94
+ "justifyContent": "flex-end",
95
+ "padding": Array [
96
+ "16px",
97
+ "40px",
98
+ ],
99
+ },
100
+ "borderTop": "1px solid transparent",
101
+ "display": "flex",
102
+ "flexDirection": "column-reverse",
103
+ "flexGrow": 0,
104
+ "gap": "4px",
105
+ "padding": "12px",
106
+ "textAlign": "right",
107
+ },
108
+ "footerBorder": Object {
109
+ "borderTop": "1px solid #EDEDF1",
110
+ },
111
+ "fullSize": Object {
112
+ "& $contentWrapper": Object {
113
+ "@media screen and (min-width:576px)": Object {
114
+ "height": "auto",
115
+ "maxHeight": "85vh",
116
+ },
117
+ "height": "100vh",
118
+ "maxHeight": "100vh",
119
+ "overflow": "auto",
120
+ },
121
+ "@media screen and (max-width:575px)": Object {
122
+ "border": 0,
123
+ "width": "100% !important",
124
+ },
125
+ },
126
+ "header": Object {
127
+ "@media screen and (min-width:576px)": Object {
128
+ "height": 72,
129
+ "padding": Array [
130
+ "16px",
131
+ "16px",
132
+ "16px",
133
+ "40px",
134
+ ],
135
+ },
136
+ "alignItems": "center",
137
+ "background": "transparent",
138
+ "border": "1px solid transparent",
139
+ "display": "flex",
140
+ "flexGrow": 0,
141
+ "height": 56,
142
+ "padding": Array [
143
+ "8px",
144
+ "12px",
121
145
  ],
122
- "marginBottom": -16,
123
- "marginLeft": -16,
124
- "marginRight": 16,
125
- "marginTop": -16,
126
- "width": 200,
146
+ "transition": "0.2s all",
147
+ "zIndex": 1,
148
+ },
149
+ "headerBorder": Object {
150
+ "borderBottom": "1px solid #EDEDF1",
151
+ },
152
+ "hide": Object {
153
+ "& $card": Object {
154
+ "marginTop": -64,
155
+ "opacity": 0,
156
+ },
157
+ "opacity": 0,
158
+ },
159
+ "imgLeft": Object {
160
+ "@media screen and (min-width:576px)": Object {
161
+ "display": "block",
162
+ "width": 200,
163
+ },
164
+ "display": "none",
127
165
  },
128
166
  "imgTop": Object {
129
- "@media screen and (min-width:768px)": Object {
130
- "marginBottom": 32,
131
- "marginLeft": -32,
132
- "marginRight": -32,
133
- "marginTop": -32,
134
- },
135
- "backgroundColor": [Function],
136
- "backgroundImage": [Function],
137
- "backgroundPosition": [Function],
138
- "backgroundRepeat": "no-repeat",
139
- "backgroundSize": [Function],
140
- "borderRadius": Array [
141
- 6,
142
- 6,
143
- 0,
144
- 0,
145
- ],
146
- "height": [Function],
147
- "marginBottom": 16,
148
- "marginLeft": -16,
149
- "marginRight": -16,
150
- "marginTop": -16,
151
- "position": "relative",
167
+ "aspectRatio": "21 / 9",
168
+ "maxHeight": 200,
169
+ "objectFit": "cover",
170
+ "width": "100%",
152
171
  },
153
172
  "lg": Object {
154
173
  "width": 820,
155
174
  },
156
- "mainBtn": Object {
157
- "marginLeft": 24,
158
- "marginTop": 16,
159
- },
160
175
  "md": Object {
161
176
  "@media screen and (max-width:767px)": Object {
162
177
  "maxWidth": "100%",
163
- "width": 322,
164
178
  },
165
- "width": 520,
179
+ "width": 600,
166
180
  },
167
181
  "noClose": Object {
168
182
  "cursor": "default",
169
183
  },
184
+ "noFooter": Object {
185
+ "paddingBottom": "40px",
186
+ },
187
+ "noHeader": Object {
188
+ "@media screen and (min-width:768px)": Object {
189
+ "paddingTop": "40px",
190
+ },
191
+ },
170
192
  "overlay": Object {
171
193
  "alignItems": "center",
172
194
  "background": "rgba(0, 0, 5, 0.85)",
@@ -175,29 +197,59 @@ Object {
175
197
  "height": "100%",
176
198
  "justifyContent": "center",
177
199
  "left": 0,
178
- "overflow": "auto",
179
200
  "position": "fixed",
180
201
  "top": 0,
181
202
  "transition": "0.3s all",
182
203
  "width": "100%",
183
204
  "zIndex": 1000,
184
205
  },
185
- "overlayHide": Object {
186
- "opacity": 0,
187
- },
188
- "overlayShow": Object {
206
+ "show": Object {
207
+ "& $card": Object {
208
+ "animation": "0.3s modalFadeDown ease-out",
209
+ },
189
210
  "animation": "0.3s modalFadeIn linear",
190
211
  },
191
- "secBtn": Object {
192
- "marginTop": 16,
193
- },
194
212
  "sm": Object {
213
+ "& $contentChild": Object {
214
+ "padding": "12px",
215
+ },
216
+ "& $footer": Object {
217
+ "flexDirection": "column-reverse",
218
+ "gap": "4px",
219
+ "padding": "12px",
220
+ },
221
+ "& $header": Object {
222
+ "height": 56,
223
+ "padding": Array [
224
+ "8px",
225
+ "12px",
226
+ ],
227
+ },
228
+ "& $title": Object {
229
+ "font": "400 20px/1.1 'OccText', sans-serif",
230
+ },
195
231
  "maxWidth": "100%",
196
- "width": 322,
232
+ "width": 320,
233
+ },
234
+ "solidHeader": Object {
235
+ "background": "#fff",
236
+ },
237
+ "split": Object {
238
+ "display": "flex",
239
+ "flexDirection": "row",
240
+ },
241
+ "stickyHeader": Object {
242
+ "@media screen and (min-width:576px)": Object {
243
+ "marginBottom": -72,
244
+ },
245
+ "marginBottom": -56,
197
246
  },
198
- "title": Object {},
199
- "top": Object {
200
- "marginBottom": 16,
247
+ "title": Object {
248
+ "@media screen and (min-width:576px)": Object {
249
+ "font": "400 24px/1.1 'OccText', sans-serif",
250
+ },
251
+ "font": "400 20px/1.1 'OccText', sans-serif",
252
+ "margin": 0,
201
253
  },
202
254
  "xl": Object {
203
255
  "width": 1024,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = void 0;
6
+ exports["default"] = exports.objectToFontValue = void 0;
7
7
 
8
8
  var _spacing = _interopRequireDefault(require("../subatomic/spacing"));
9
9
 
@@ -11,12 +11,27 @@ var _grid = _interopRequireDefault(require("../subatomic/grid"));
11
11
 
12
12
  var _colors = _interopRequireDefault(require("../subatomic/colors"));
13
13
 
14
- var _card, _content;
14
+ var _fonts = _interopRequireDefault(require("../subatomic/fonts"));
15
+
16
+ var _colors2 = _interopRequireDefault(require("../tokens/colors.json"));
17
+
18
+ var _spacing2 = _interopRequireDefault(require("../tokens/spacing.json"));
19
+
20
+ var _borderRadius = _interopRequireDefault(require("../tokens/borderRadius.json"));
21
+
22
+ var _fonts2 = _interopRequireDefault(require("../tokens/fonts.json"));
23
+
24
+ var _fullSize;
15
25
 
16
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
27
 
18
28
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
29
 
30
+ var objectToFontValue = function objectToFontValue(font) {
31
+ return "".concat(font.fontWeight, " ").concat(font.fontSize, "/").concat(font.lineHeight, " ").concat(_fonts["default"].body);
32
+ };
33
+
34
+ exports.objectToFontValue = objectToFontValue;
20
35
  var _default = {
21
36
  '@global': {
22
37
  body: {
@@ -46,7 +61,6 @@ var _default = {
46
61
  width: '100%',
47
62
  height: '100%',
48
63
  background: 'rgba(0, 0, 5, 0.85)',
49
- overflow: 'auto',
50
64
  display: 'flex',
51
65
  justifyContent: 'center',
52
66
  alignItems: 'center',
@@ -56,65 +70,53 @@ var _default = {
56
70
  transition: '0.3s all',
57
71
  cursor: 'pointer'
58
72
  },
59
- overlayShow: {
60
- animation: '0.3s modalFadeIn linear'
73
+ show: {
74
+ animation: '0.3s modalFadeIn linear',
75
+ '& $card': {
76
+ animation: '0.3s modalFadeDown ease-out'
77
+ }
61
78
  },
62
- overlayHide: {
63
- opacity: 0
79
+ hide: {
80
+ opacity: 0,
81
+ '& $card': {
82
+ opacity: 0,
83
+ marginTop: -_spacing["default"].xLarge
84
+ }
64
85
  },
65
86
  noClose: {
66
87
  cursor: 'default'
67
88
  },
68
- cardWrapper: _defineProperty({
89
+ cardWrapper: {
69
90
  position: 'relative',
70
- maxWidth: '100%',
71
- maxHeight: '100%'
72
- }, "@media screen and (max-width:".concat(_grid["default"].xs - 1, "px)"), {
73
- height: function height(_ref) {
74
- var fullSize = _ref.fullSize;
75
- return fullSize && '100%';
76
- }
77
- }),
91
+ maxWidth: '100vw',
92
+ maxHeight: '100vh'
93
+ },
78
94
  cardBlock: _defineProperty({
79
95
  margin: _spacing["default"].gutter
80
96
  }, "@media screen and (max-width:".concat(_grid["default"].xs - 1, "px)"), {
81
- margin: function margin(_ref2) {
82
- var fullSize = _ref2.fullSize;
97
+ margin: function margin(_ref) {
98
+ var fullSize = _ref.fullSize;
83
99
  return fullSize && 0;
84
- },
85
- height: function height(_ref3) {
86
- var fullSize = _ref3.fullSize;
87
- return fullSize && '100%';
88
100
  }
89
101
  }),
90
- card: (_card = {
102
+ card: _defineProperty({
91
103
  maxWidth: '100%',
92
104
  cursor: 'auto',
105
+ overflow: 'hidden',
93
106
  transition: '0.3s opacity, 0.3s margin-top',
94
- padding: _spacing["default"].small
95
- }, _defineProperty(_card, "@media screen and (min-width:".concat(_grid["default"].sm, "px)"), {
96
- padding: _spacing["default"].medium
97
- }), _defineProperty(_card, "@media screen and (max-width:".concat(_grid["default"].xs - 1, "px)"), {
98
- padding: function padding(_ref4) {
99
- var fullSize = _ref4.fullSize;
100
- return fullSize && _spacing["default"].base;
101
- },
102
- minHeight: function minHeight(_ref5) {
103
- var fullSize = _ref5.fullSize;
104
- return fullSize && '100%';
107
+ borderRadius: _borderRadius["default"]['br-sm'],
108
+ border: "1px solid ".concat(_colors2["default"].border["default"]["default"]),
109
+ background: _colors2["default"].bg.surface["default"]
110
+ }, "@media screen and (max-width:".concat(_grid["default"].xs - 1, "px)"), {
111
+ minHeight: function minHeight(_ref2) {
112
+ var fullSize = _ref2.fullSize;
113
+ return fullSize && '100vh';
105
114
  },
106
- borderRadius: function borderRadius(_ref6) {
107
- var fullSize = _ref6.fullSize;
115
+ borderRadius: function borderRadius(_ref3) {
116
+ var fullSize = _ref3.fullSize;
108
117
  return fullSize && 0;
109
118
  }
110
- }), _card),
111
- cardShow: {
112
- animation: '0.3s modalFadeDown ease-out'
113
- },
114
- cardHide: {
115
- opacity: 0,
116
- marginTop: -_spacing["default"].xLarge
117
- },
119
+ }),
118
120
  xl: {
119
121
  width: 1024
120
122
  },
@@ -122,116 +124,133 @@ var _default = {
122
124
  width: 820
123
125
  },
124
126
  md: _defineProperty({
125
- width: 520
127
+ width: 600
126
128
  }, "@media screen and (max-width:".concat(_grid["default"].sm - 1, "px)"), {
127
- width: 322,
128
129
  maxWidth: '100%'
129
130
  }),
130
131
  sm: {
131
- width: 322,
132
- maxWidth: '100%'
132
+ width: 320,
133
+ maxWidth: '100%',
134
+ '& $header': {
135
+ height: 56,
136
+ padding: [_spacing2["default"]['size-2'], _spacing2["default"]['size-3']]
137
+ },
138
+ '& $title': {
139
+ font: objectToFontValue(_fonts2["default"]['mobile-h4-m'])
140
+ },
141
+ '& $contentChild': {
142
+ padding: _spacing2["default"]['size-3']
143
+ },
144
+ '& $footer': {
145
+ flexDirection: 'column-reverse',
146
+ gap: _spacing2["default"]['size-1'],
147
+ padding: _spacing2["default"]['size-3']
148
+ }
133
149
  },
134
- top: {
135
- marginBottom: _spacing["default"].small
150
+ fullSize: (_fullSize = {}, _defineProperty(_fullSize, "@media screen and (max-width:".concat(_grid["default"].xs - 1, "px)"), {
151
+ width: '100% !important',
152
+ border: 0
153
+ }), _defineProperty(_fullSize, '& $contentWrapper', _defineProperty({
154
+ height: '100vh',
155
+ maxHeight: '100vh',
156
+ overflow: 'auto'
157
+ }, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
158
+ height: 'auto',
159
+ maxHeight: '85vh'
160
+ })), _fullSize),
161
+ contentWrapper: {
162
+ flex: 1,
163
+ height: 'auto',
164
+ maxHeight: '85vh'
136
165
  },
137
- title: {},
138
- closeIcon: {
139
- height: _spacing["default"].medium,
166
+ header: _defineProperty({
167
+ height: 56,
168
+ flexGrow: 0,
169
+ padding: [_spacing2["default"]['size-2'], _spacing2["default"]['size-3']],
140
170
  display: 'flex',
141
- alignItems: 'center'
142
- },
143
- content: (_content = {
144
- marginLeft: -_spacing["default"].small,
145
- marginRight: -_spacing["default"].small,
146
- paddingLeft: _spacing["default"].small,
147
- paddingRight: _spacing["default"].small,
148
- transition: '0.1s height'
149
- }, _defineProperty(_content, "@media screen and (min-width:".concat(_grid["default"].sm, "px)"), {
150
- marginLeft: -_spacing["default"].medium,
151
- marginRight: -_spacing["default"].medium,
152
- paddingLeft: _spacing["default"].medium,
153
- paddingRight: _spacing["default"].medium
154
- }), _defineProperty(_content, '&::-webkit-scrollbar', {
155
- width: 6
156
- }), _defineProperty(_content, '&::-webkit-scrollbar-thumb', {
157
- background: _colors["default"].grey200,
158
- borderRadius: 3
159
- }), _content),
160
- bottom: {
161
- textAlign: 'right',
162
- marginTop: _spacing["default"].tiny
171
+ alignItems: 'center',
172
+ zIndex: 1,
173
+ background: 'transparent',
174
+ border: '1px solid transparent',
175
+ transition: '0.2s all'
176
+ }, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
177
+ height: 72,
178
+ padding: [_spacing2["default"]['size-4'], _spacing2["default"]['size-4'], _spacing2["default"]['size-4'], _spacing2["default"]['size-7']]
179
+ }),
180
+ stickyHeader: _defineProperty({
181
+ marginBottom: -56
182
+ }, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
183
+ marginBottom: -72
184
+ }),
185
+ solidHeader: {
186
+ background: _colors2["default"].bg.surface["default"]
163
187
  },
164
- secBtn: {
165
- marginTop: _spacing["default"].small
188
+ title: _defineProperty({
189
+ margin: 0,
190
+ font: objectToFontValue(_fonts2["default"]['mobile-h4-m'])
191
+ }, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
192
+ font: objectToFontValue(_fonts2["default"]['heading-h4'])
193
+ }),
194
+ content: {
195
+ transition: '0.1s height',
196
+ overflow: 'auto',
197
+ flex: 1,
198
+ '&::-webkit-scrollbar': {
199
+ width: 6
200
+ },
201
+ '&::-webkit-scrollbar-thumb': {
202
+ background: _colors["default"].grey200,
203
+ borderRadius: 3
204
+ }
166
205
  },
167
- mainBtn: {
168
- marginLeft: _spacing["default"].base,
169
- marginTop: _spacing["default"].small
206
+ contentChild: _defineProperty({
207
+ padding: _spacing2["default"]['size-3'],
208
+ borderBottom: '1px solid transparent'
209
+ }, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
210
+ padding: [_spacing2["default"]['size-3'], _spacing2["default"]['size-7']]
211
+ }),
212
+ noHeader: _defineProperty({}, "@media screen and (min-width:".concat(_grid["default"].sm, "px)"), {
213
+ paddingTop: _spacing2["default"]['size-7']
214
+ }),
215
+ noFooter: {
216
+ paddingBottom: _spacing2["default"]['size-7']
170
217
  },
171
- imgLeft: _defineProperty({
172
- width: 200,
173
- backgroundImage: function backgroundImage(_ref7) {
174
- var imgLeft = _ref7.imgLeft;
175
- return "url(".concat(imgLeft.img, ")");
176
- },
177
- backgroundPosition: function backgroundPosition(_ref8) {
178
- var imgLeft = _ref8.imgLeft;
179
- return "center ".concat(imgLeft.position || 'center');
180
- },
181
- backgroundSize: function backgroundSize(_ref9) {
182
- var imgLeft = _ref9.imgLeft;
183
- return imgLeft.size === 'contain' ? '100% auto' : 'cover';
184
- },
185
- backgroundColor: function backgroundColor(_ref10) {
186
- var imgLeft = _ref10.imgLeft;
187
- return imgLeft.color || null;
188
- },
189
- backgroundRepeat: 'no-repeat',
190
- borderRadius: [_spacing["default"].radius, 0, 0, _spacing["default"].radius],
191
- marginLeft: -_spacing["default"].small,
192
- marginTop: -_spacing["default"].small,
193
- marginBottom: -_spacing["default"].small,
194
- marginRight: _spacing["default"].small
195
- }, "@media screen and (min-width:".concat(_grid["default"].sm, "px)"), {
196
- marginLeft: -_spacing["default"].medium,
197
- marginTop: -_spacing["default"].medium,
198
- marginBottom: -_spacing["default"].medium,
199
- marginRight: _spacing["default"].medium
218
+ headerBorder: {
219
+ borderBottom: "1px solid ".concat(_colors2["default"].border["default"].subtle)
220
+ },
221
+ footer: _defineProperty({
222
+ flexGrow: 0,
223
+ textAlign: 'right',
224
+ padding: _spacing2["default"]['size-3'],
225
+ borderTop: '1px solid transparent',
226
+ display: 'flex',
227
+ flexDirection: 'column-reverse',
228
+ gap: _spacing2["default"]['size-1']
229
+ }, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
230
+ padding: [_spacing2["default"]['size-4'], _spacing2["default"]['size-7']],
231
+ flexDirection: 'row',
232
+ justifyContent: 'flex-end',
233
+ gap: _spacing2["default"]['size-2']
200
234
  }),
201
- imgTop: _defineProperty({
202
- position: 'relative',
203
- height: function height(_ref11) {
204
- var imgTop = _ref11.imgTop;
205
- return imgTop.height || 128;
206
- },
207
- backgroundImage: function backgroundImage(_ref12) {
208
- var imgTop = _ref12.imgTop;
209
- return "url(".concat(imgTop.img, ")");
210
- },
211
- backgroundPosition: function backgroundPosition(_ref13) {
212
- var imgTop = _ref13.imgTop;
213
- return "".concat(imgTop.position || 'center', " center");
214
- },
215
- backgroundSize: function backgroundSize(_ref14) {
216
- var imgTop = _ref14.imgTop;
217
- return imgTop.size === 'contain' ? 'auto 100%' : imgTop.size || 'cover';
218
- },
219
- backgroundColor: function backgroundColor(_ref15) {
220
- var imgTop = _ref15.imgTop;
221
- return imgTop.color || null;
222
- },
223
- backgroundRepeat: 'no-repeat',
224
- borderRadius: [_spacing["default"].radius, _spacing["default"].radius, 0, 0],
225
- marginLeft: -_spacing["default"].small,
226
- marginTop: -_spacing["default"].small,
227
- marginBottom: _spacing["default"].small,
228
- marginRight: -_spacing["default"].small
229
- }, "@media screen and (min-width:".concat(_grid["default"].sm, "px)"), {
230
- marginLeft: -_spacing["default"].medium,
231
- marginTop: -_spacing["default"].medium,
232
- marginBottom: _spacing["default"].medium,
233
- marginRight: -_spacing["default"].medium
235
+ footerBorder: {
236
+ borderTop: "1px solid ".concat(_colors2["default"].border["default"].subtle)
237
+ },
238
+ split: {
239
+ display: 'flex',
240
+ flexDirection: 'row'
241
+ },
242
+ imgLeft: _defineProperty({
243
+ display: 'none'
244
+ }, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
245
+ display: 'block',
246
+ width: 200
234
247
  }),
248
+ imgTop: {
249
+ width: '100%',
250
+ aspectRatio: '21 / 9',
251
+ maxHeight: 200,
252
+ objectFit: 'cover'
253
+ },
235
254
  closePosition: _defineProperty({
236
255
  position: 'absolute',
237
256
  top: _spacing["default"].small,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occmundial/occ-atomic",
3
- "version": "3.0.0-beta.39",
3
+ "version": "3.0.0-beta.40",
4
4
  "description": "Collection of shareable styled React components for OCC applications.",
5
5
  "homepage": "http://occmundial.github.io/occ-atomic",
6
6
  "main": "build/index.js",