@occmundial/occ-atomic 2.0.0-beta.14 → 2.0.0-beta.16

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # [2.0.0-beta.16](https://github.com/occmundial/occ-atomic/compare/v2.0.0-beta.15...v2.0.0-beta.16) (2024-05-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Adjust icon in prev and next button ([8d78c19](https://github.com/occmundial/occ-atomic/commit/8d78c196ce2a27990084683fbeb95b0b9e49be02))
7
+ * Change tabs to spaces ([ba606c3](https://github.com/occmundial/occ-atomic/commit/ba606c3951a779fd05937fed49f785cc529cd611))
8
+
9
+ # [2.0.0-beta.15](https://github.com/occmundial/occ-atomic/compare/v2.0.0-beta.14...v2.0.0-beta.15) (2024-05-10)
10
+
11
+
12
+ ### Features
13
+
14
+ * Updated radio styles and documentation ([2c39496](https://github.com/occmundial/occ-atomic/commit/2c39496186092fe20434ce4a030c28e42cebff91))
15
+
1
16
  # [2.0.0-beta.14](https://github.com/occmundial/occ-atomic/compare/v2.0.0-beta.13...v2.0.0-beta.14) (2024-05-07)
2
17
 
3
18
 
@@ -218,20 +218,28 @@ var Pager = /*#__PURE__*/function (_React$Component) {
218
218
  return /*#__PURE__*/_react["default"].createElement("ul", {
219
219
  className: "".concat(classes.pager).concat(className ? " ".concat(className) : '')
220
220
  }, /*#__PURE__*/_react["default"].createElement("li", {
221
- className: "".concat(classes.btn, " ").concat(classes.prev).concat(selected == 1 ? " ".concat(classes.disabled) : ''),
221
+ className: "".concat(classes.btn, " ").concat(classes.listItemPrevious).concat(selected == 1 ? " ".concat(classes.disabled) : ''),
222
222
  tabIndex: "0",
223
223
  onClick: this.handlePrevPage
224
+ }, /*#__PURE__*/_react["default"].createElement("div", {
225
+ className: classes.prev
224
226
  }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
225
- iconName: "arrowDown",
227
+ iconName: "chevron-left",
228
+ width: 14,
229
+ height: 14,
226
230
  colors: ['#adb4bb']
227
- }), " ", previousLabel), !hideNumbers && this.pagination(), /*#__PURE__*/_react["default"].createElement("li", {
228
- className: "".concat(classes.btn, " ").concat(classes.next).concat(selected == pageCount ? " ".concat(classes.disabled) : ''),
231
+ }), previousLabel)), !hideNumbers && this.pagination(), /*#__PURE__*/_react["default"].createElement("li", {
232
+ className: "".concat(classes.btn, " ").concat(classes.listItemNext).concat(selected == pageCount ? " ".concat(classes.disabled) : ''),
229
233
  tabIndex: "0",
230
234
  onClick: this.handleNextPage
231
- }, nextLabel, " ", /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
232
- iconName: "arrowDown",
235
+ }, /*#__PURE__*/_react["default"].createElement("div", {
236
+ className: classes.next
237
+ }, nextLabel, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
238
+ iconName: "chevron-right",
239
+ width: 14,
240
+ height: 14,
233
241
  colors: ['#adb4bb']
234
- })));
242
+ }))));
235
243
  }
236
244
  }]);
237
245
 
@@ -30,10 +30,10 @@ describe("Pager", function () {
30
30
  var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Pager["default"], {
31
31
  classes: classes
32
32
  }));
33
- expect(wrapper.find('.prev').length).toBe(1);
34
- expect(wrapper.find('.prev').text()).toEqual('<Jss(Icon) /> Previous');
35
- expect(wrapper.find('.next').length).toBe(1);
36
- expect(wrapper.find('.next').text()).toEqual('Next <Jss(Icon) />');
33
+ expect(wrapper.find('.listItemPrevious').length).toBe(1);
34
+ expect(wrapper.find('.listItemPrevious').text()).toEqual('<Jss(Icon) />Previous');
35
+ expect(wrapper.find('.listItemNext').length).toBe(1);
36
+ expect(wrapper.find('.listItemNext').text()).toEqual('Next<Jss(Icon) />');
37
37
  });
38
38
  it('changes to previous page', function () {
39
39
  var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Pager["default"], {
@@ -41,7 +41,7 @@ describe("Pager", function () {
41
41
  classes: classes
42
42
  }));
43
43
  expect(wrapper.state('selected')).toEqual(3);
44
- wrapper.find('.prev').simulate('click', {
44
+ wrapper.find('.listItemPrevious').simulate('click', {
45
45
  target: {}
46
46
  });
47
47
  expect(wrapper.state('selected')).toEqual(2);
@@ -52,7 +52,7 @@ describe("Pager", function () {
52
52
  classes: classes
53
53
  }));
54
54
  expect(wrapper.state('selected')).toEqual(3);
55
- wrapper.find('.next').simulate('click', {
55
+ wrapper.find('.listItemNext').simulate('click', {
56
56
  target: {}
57
57
  });
58
58
  expect(wrapper.state('selected')).toEqual(4);
@@ -84,11 +84,11 @@ describe("Pager", function () {
84
84
  initialPage: 1,
85
85
  classes: classes
86
86
  }));
87
- expect(wrapper.find('.prev').hasClass('disabled')).toEqual(true);
87
+ expect(wrapper.find('.listItemPrevious').hasClass('disabled')).toEqual(true);
88
88
  wrapper.setProps({
89
89
  forcePage: 5
90
90
  });
91
- expect(wrapper.find('.prev').hasClass('disabled')).toEqual(false);
91
+ expect(wrapper.find('.listItemPrevious').hasClass('disabled')).toEqual(false);
92
92
  });
93
93
  it('disables the next page button', function () {
94
94
  var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Pager["default"], {
@@ -96,11 +96,11 @@ describe("Pager", function () {
96
96
  initialPage: 5,
97
97
  classes: classes
98
98
  }));
99
- expect(wrapper.find('.next').hasClass('disabled')).toEqual(true);
99
+ expect(wrapper.find('.listItemNext').hasClass('disabled')).toEqual(true);
100
100
  wrapper.setProps({
101
101
  forcePage: 1
102
102
  });
103
- expect(wrapper.find('.next').hasClass('disabled')).toEqual(false);
103
+ expect(wrapper.find('.listItemNext').hasClass('disabled')).toEqual(false);
104
104
  });
105
105
  it('calls the onPageChange function', function () {
106
106
  var onPageChange = jest.fn();
@@ -108,7 +108,7 @@ describe("Pager", function () {
108
108
  onPageChange: onPageChange,
109
109
  classes: classes
110
110
  }));
111
- wrapper.find('.next').simulate('click', {
111
+ wrapper.find('.listItemNext').simulate('click', {
112
112
  target: {}
113
113
  });
114
114
  expect(onPageChange.mock.calls.length).toBe(1);
@@ -15,7 +15,6 @@ Object {
15
15
  "border": "1px solid #bfbfbf",
16
16
  "borderRadius": "5px",
17
17
  "cursor": "pointer",
18
- "display": "inline-block",
19
18
  "fontFamily": "'OccText', sans-serif",
20
19
  "outline": "0",
21
20
  "padding": "3px 13px",
@@ -25,24 +24,28 @@ Object {
25
24
  "opacity": "0.4",
26
25
  "pointerEvents": "none",
27
26
  },
28
- "next": Object {
29
- "& span": Object {
30
- "transform": "rotate(-90deg)",
31
- },
27
+ "listItemNext": Object {
32
28
  "marginLeft": "15px",
33
29
  },
30
+ "listItemPrevious": Object {
31
+ "marginRight": "15px",
32
+ },
33
+ "next": Object {
34
+ "alignItems": "center",
35
+ "display": "flex",
36
+ },
34
37
  "pager": Object {
38
+ "alignItems": "center",
35
39
  "color": "#727272",
40
+ "display": "flex",
36
41
  "fontFamily": "'OccText', sans-serif",
37
42
  "fontSize": "14px",
38
43
  "listStyle": "none",
39
44
  "paddingLeft": "0",
40
45
  },
41
46
  "prev": Object {
42
- "& span": Object {
43
- "transform": "rotate(90deg)",
44
- },
45
- "marginRight": "15px",
47
+ "alignItems": "center",
48
+ "display": "flex",
46
49
  },
47
50
  }
48
51
  `;
@@ -15,12 +15,13 @@ var _default = {
15
15
  pager: {
16
16
  listStyle: 'none',
17
17
  paddingLeft: '0',
18
+ display: 'flex',
19
+ alignItems: 'center',
18
20
  fontFamily: _fonts["default"].body,
19
21
  color: _colors["default"].grey7,
20
22
  fontSize: '14px'
21
23
  },
22
24
  btn: {
23
- display: 'inline-block',
24
25
  fontFamily: _fonts["default"].body,
25
26
  border: "1px solid ".concat(_colors["default"].grey1),
26
27
  borderRadius: '5px',
@@ -37,16 +38,18 @@ var _default = {
37
38
  }
38
39
  },
39
40
  prev: {
40
- marginRight: '15px',
41
- '& span': {
42
- transform: 'rotate(90deg)'
43
- }
41
+ display: 'flex',
42
+ alignItems: 'center'
43
+ },
44
+ listItemPrevious: {
45
+ marginRight: '15px'
44
46
  },
45
47
  next: {
46
- marginLeft: '15px',
47
- '& span': {
48
- transform: 'rotate(-90deg)'
49
- }
48
+ display: 'flex',
49
+ alignItems: 'center'
50
+ },
51
+ listItemNext: {
52
+ marginLeft: '15px'
50
53
  },
51
54
  disabled: {
52
55
  pointerEvents: 'none',
@@ -94,6 +94,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
94
94
  return /*#__PURE__*/_react["default"].createElement("div", _extends({
95
95
  id: option.trk,
96
96
  key: option.value,
97
+ tabIndex: -1,
97
98
  "data-testid": option.testId
98
99
  }, option.testId && {
99
100
  'data-value': selected == option.value ? 1 : 0
@@ -111,7 +112,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
111
112
  className: "".concat(classes.label).concat(textOverflow ? " ".concat(classes.overflow) : '')
112
113
  }, option.label), option.right && /*#__PURE__*/_react["default"].createElement(_Text["default"], {
113
114
  tag: "label",
114
- mid: true,
115
+ corpSecondary: true,
115
116
  className: classes.right
116
117
  }, option.right));
117
118
  }));
@@ -147,8 +148,14 @@ Radio.propTypes = {
147
148
 
148
149
  /** Use this prop to overflow the text of the label, adding '...' and the end. */
149
150
  textOverflow: _propTypes["default"].bool,
151
+
152
+ /** Id of the component */
150
153
  id: _propTypes["default"].string,
154
+
155
+ /** Adds class(es) to each option container */
151
156
  className: _propTypes["default"].string,
157
+
158
+ /** Adds style(s) to each option container */
152
159
  style: _propTypes["default"].object
153
160
  };
154
161
  var _default = Radio;
@@ -5,39 +5,92 @@ exports[`Radio matches the snapshot 1`] = `ShallowWrapper {}`;
5
5
  exports[`Radio styles matches the snapshot 1`] = `
6
6
  Object {
7
7
  "active": Object {
8
- "& $radio:after": Object {
9
- "background": Array [
10
- "#083cae",
11
- "!important",
12
- ],
8
+ "& $radio": Object {
9
+ "&:after": Object {
10
+ "background": "#0059CD",
11
+ },
12
+ "&:before": Object {
13
+ "borderColor": "#0059CD",
14
+ "borderWidth": 2,
15
+ },
13
16
  },
14
17
  },
15
18
  "cont": Object {
16
- "&:after": Object {
17
- "clear": "both",
18
- "content": "\\"\\"",
19
- "display": "table",
19
+ "&$active": Object {
20
+ "&:active": Object {
21
+ "& $radio:after": Object {
22
+ "background": "#0047A5",
23
+ },
24
+ "& $radio:before": Object {
25
+ "borderColor": "#0047A5",
26
+ "borderWidth": "3px",
27
+ "boxShadow": "initial",
28
+ },
29
+ },
30
+ "&:focus $radio:before": Object {
31
+ "borderColor": "#0059CD",
32
+ "boxShadow": undefined,
33
+ },
34
+ "&:hover": Object {
35
+ "& $radio:after": Object {
36
+ "background": "#0047A5",
37
+ },
38
+ "& $radio:before": Object {
39
+ "borderColor": "#0047A5",
40
+ "boxShadow": "initial",
41
+ },
42
+ },
20
43
  },
21
- "&:hover $radio:after": Object {
22
- "background": "#dddddd",
44
+ "&:not($active)": Object {
45
+ "&:active $radio:before": Object {
46
+ "borderColor": "#6C6F89",
47
+ "borderWidth": "2px",
48
+ "boxShadow": "initial",
49
+ },
50
+ "&:focus $radio:before": Object {
51
+ "borderColor": "#D3D4DC",
52
+ "boxShadow": undefined,
53
+ },
54
+ "&:hover $radio:before": Object {
55
+ "borderColor": "#6C6F89",
56
+ "boxShadow": "initial",
57
+ },
23
58
  },
24
59
  "alignItems": "start",
25
60
  "boxSizing": "border-box",
26
61
  "cursor": "pointer",
27
62
  "display": "flex",
28
63
  "outline": "0",
29
- "paddingBottom": 8,
30
- "paddingTop": 8,
64
+ "paddingBottom": "8px",
65
+ "paddingTop": "8px",
31
66
  },
32
67
  "disabled": Object {
33
- "opacity": 0.4,
68
+ "& :not($radio)": Object {
69
+ "opacity": 0.4,
70
+ },
71
+ "&$active": Object {
72
+ "& $radio:after": Object {
73
+ "background": "#8DA5DA",
74
+ },
75
+ "& $radio:before": Object {
76
+ "borderColor": "#8DA5DA",
77
+ },
78
+ },
79
+ "&:not($active)": Object {
80
+ "& $radio:after": Object {
81
+ "background": "#EDEDF1",
82
+ },
83
+ "& $radio:before": Object {
84
+ "background": "#EDEDF1",
85
+ },
86
+ },
34
87
  "pointerEvents": "none",
35
88
  },
36
89
  "label": Object {
37
90
  "cursor": "pointer",
38
91
  "flex": "1",
39
92
  "float": "left",
40
- "marginLeft": 8,
93
+ "marginLeft": "8px",
41
94
  },
42
95
  "overflow": Object {
43
96
  "overflow": "hidden",
@@ -46,36 +99,38 @@ Object {
46
99
  },
47
100
  "radio": Object {
48
101
  "&:after": Object {
49
- "background": "transparent",
102
+ "background": "#fff",
50
103
  "borderRadius": "50%",
104
+ "boxSizing": "border-box",
51
105
  "content": "\\"\\"",
52
- "height": 6,
106
+ "height": 10,
53
107
  "left": "50%",
54
108
  "position": "absolute",
55
109
  "top": "50%",
56
110
  "transform": "translate(-50%, -50%)",
57
111
  "transition": "0.3s all",
58
- "width": 6,
112
+ "width": 10,
59
113
  },
60
114
  "&:before": Object {
61
- "background": "#ffffff",
62
- "border": "1px solid #dddddd",
115
+ "background": "#fff",
116
+ "border": "1px solid #D3D4DC",
63
117
  "borderRadius": "50%",
118
+ "boxSizing": "border-box",
64
119
  "content": "\\"\\"",
65
- "height": 16,
120
+ "height": 20,
66
121
  "left": "50%",
67
122
  "position": "absolute",
68
123
  "top": "50%",
69
124
  "transform": "translate(-50%, -50%)",
70
- "width": 16,
125
+ "width": 20,
71
126
  },
72
- "height": 24,
127
+ "height": "24px",
73
128
  "position": "relative",
74
- "width": 24,
129
+ "width": "24px",
75
130
  },
76
131
  "right": Object {
77
132
  "float": "right",
78
- "marginLeft": 8,
133
+ "marginLeft": "8px",
79
134
  },
80
135
  }
81
136
  `;
@@ -5,76 +5,135 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
 
8
- var _colors = _interopRequireDefault(require("../subatomic/colors"));
8
+ var _spacing = _interopRequireDefault(require("../tokens/spacing.json"));
9
9
 
10
- var _spacing = _interopRequireDefault(require("../subatomic/spacing"));
10
+ var _colors = _interopRequireDefault(require("../tokens/colors.json"));
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
13
 
14
+ var radio = _colors["default"].radio;
14
15
  var _default = {
15
16
  cont: {
16
- paddingTop: _spacing["default"].tiny,
17
- paddingBottom: _spacing["default"].tiny,
17
+ paddingTop: _spacing["default"]['size-2'],
18
+ paddingBottom: _spacing["default"]['size-2'],
18
19
  boxSizing: 'border-box',
19
20
  display: 'flex',
20
21
  alignItems: 'start',
21
22
  cursor: 'pointer',
22
23
  outline: '0',
23
- '&:after': {
24
- content: '""',
25
- display: 'table',
26
- clear: 'both'
24
+ '&$active': {
25
+ '&:focus $radio:before': {
26
+ borderColor: radio['selected']['border']['default'],
27
+ boxShadow: _colors["default"]['focus-bright-blue']
28
+ },
29
+ '&:hover': {
30
+ '& $radio:before': {
31
+ borderColor: radio['selected']['border']['hover'],
32
+ boxShadow: 'initial'
33
+ },
34
+ '& $radio:after': {
35
+ background: radio['selected']['bg']['hover']
36
+ }
37
+ },
38
+ '&:active': {
39
+ '& $radio:before': {
40
+ borderColor: radio['selected']['border']['hover'],
41
+ borderWidth: '3px',
42
+ boxShadow: 'initial'
43
+ },
44
+ '& $radio:after': {
45
+ background: radio['selected']['bg']['hover']
46
+ }
47
+ }
27
48
  },
28
- '&:hover $radio:after': {
29
- background: _colors["default"].grey200
49
+ '&:not($active)': {
50
+ '&:focus $radio:before': {
51
+ borderColor: radio['unselected']['border']['default'],
52
+ boxShadow: _colors["default"]['focus-bright-blue']
53
+ },
54
+ '&:hover $radio:before': {
55
+ borderColor: radio['unselected']['border']['hover'],
56
+ boxShadow: 'initial'
57
+ },
58
+ '&:active $radio:before': {
59
+ borderColor: radio['unselected']['border']['hover'],
60
+ borderWidth: '2px',
61
+ boxShadow: 'initial'
62
+ }
30
63
  }
31
64
  },
32
65
  radio: {
33
- width: _spacing["default"].base,
34
- height: _spacing["default"].base,
66
+ width: _spacing["default"]['size-5'],
67
+ height: _spacing["default"]['size-5'],
35
68
  position: 'relative',
36
69
  '&:before': {
37
70
  content: '""',
38
- width: _spacing["default"].small,
39
- height: _spacing["default"].small,
71
+ boxSizing: 'border-box',
72
+ width: 20,
73
+ height: 20,
40
74
  borderRadius: '50%',
41
75
  position: 'absolute',
42
76
  top: '50%',
43
77
  left: '50%',
44
78
  transform: 'translate(-50%, -50%)',
45
- border: "1px solid ".concat(_colors["default"].grey200),
46
- background: _colors["default"].bgWhite
79
+ border: "1px solid ".concat(radio['unselected']['border']['default']),
80
+ background: radio['bg']['default']
47
81
  },
48
82
  '&:after': {
49
83
  content: '""',
50
- width: 6,
51
- height: 6,
84
+ boxSizing: 'border-box',
85
+ width: 10,
86
+ height: 10,
52
87
  borderRadius: '50%',
53
88
  position: 'absolute',
54
89
  top: '50%',
55
90
  left: '50%',
56
91
  transform: 'translate(-50%, -50%)',
57
92
  transition: '0.3s all',
58
- background: 'transparent'
93
+ background: radio['bg']['default']
59
94
  }
60
95
  },
61
96
  active: {
62
- '& $radio:after': {
63
- background: [_colors["default"].prim, '!important']
97
+ '& $radio': {
98
+ '&:before': {
99
+ borderWidth: 2,
100
+ borderColor: radio['selected']['border']['default']
101
+ },
102
+ '&:after': {
103
+ background: radio['selected']['bg']['default']
104
+ }
64
105
  }
65
106
  },
66
107
  disabled: {
67
- opacity: 0.4,
68
- pointerEvents: 'none'
108
+ pointerEvents: 'none',
109
+ '& :not($radio)': {
110
+ opacity: 0.4
111
+ },
112
+ '&$active': {
113
+ '& $radio:before': {
114
+ borderColor: radio['selected']['border']['disabled']
115
+ },
116
+ '& $radio:after': {
117
+ background: radio['selected']['bg']['disabled']
118
+ }
119
+ },
120
+ '&:not($active)': {
121
+ '& $radio:before': {
122
+ background: radio['bg']['disabled']
123
+ },
124
+ '& $radio:after': {
125
+ background: radio['bg']['disabled']
126
+ }
127
+ }
69
128
  },
70
129
  label: {
71
- marginLeft: _spacing["default"].tiny,
130
+ marginLeft: _spacing["default"]['size-2'],
72
131
  cursor: 'pointer',
73
132
  "float": 'left',
74
133
  flex: '1'
75
134
  },
76
135
  right: {
77
- marginLeft: _spacing["default"].tiny,
136
+ marginLeft: _spacing["default"]['size-2'],
78
137
  "float": 'right'
79
138
  },
80
139
  overflow: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occmundial/occ-atomic",
3
- "version": "2.0.0-beta.14",
3
+ "version": "2.0.0-beta.16",
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",