@occmundial/occ-atomic 3.0.0-beta.6 → 3.0.0-beta.7

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # [3.0.0-beta.7](https://github.com/occmundial/occ-atomic/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2024-06-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Fix radio styles and add a form nav behavior ([59f0320](https://github.com/occmundial/occ-atomic/commit/59f03207a45b1ec27e02970668cffe2cfd5931a9))
7
+ * Ignore tab index if radio element is disabled ([e479098](https://github.com/occmundial/occ-atomic/commit/e4790982a127408a474f688a4647612ef8fbb446))
8
+
1
9
  # [3.0.0-beta.6](https://github.com/occmundial/occ-atomic/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2024-06-05)
2
10
 
3
11
 
@@ -13,6 +13,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
14
  var _Text = _interopRequireDefault(require("../Text"));
15
15
 
16
+ var _Tag = _interopRequireDefault(require("../Tag"));
17
+
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
19
 
18
20
  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); }
@@ -75,6 +77,14 @@ var Radio = /*#__PURE__*/function (_React$Component) {
75
77
  if (onChange) onChange(option.value);
76
78
  }
77
79
  }
80
+ }, {
81
+ key: "handleKeyDown",
82
+ value: function handleKeyDown(e, option) {
83
+ if (e.keyCode == 13 || e.keyCode == 32) {
84
+ e.preventDefault();
85
+ this.onChange(option);
86
+ }
87
+ }
78
88
  }, {
79
89
  key: "render",
80
90
  value: function render() {
@@ -87,6 +97,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
87
97
  id = _this$props.id,
88
98
  textOverflow = _this$props.textOverflow,
89
99
  className = _this$props.className,
100
+ alignLeft = _this$props.alignLeft,
90
101
  style = _this$props.style;
91
102
  return /*#__PURE__*/_react["default"].createElement("div", {
92
103
  id: id
@@ -94,7 +105,10 @@ var Radio = /*#__PURE__*/function (_React$Component) {
94
105
  return /*#__PURE__*/_react["default"].createElement("div", _extends({
95
106
  id: option.trk,
96
107
  key: option.value,
97
- tabIndex: -1,
108
+ tabIndex: option.disabled ? -1 : 0,
109
+ onKeyDown: function onKeyDown(e) {
110
+ return _this2.handleKeyDown(e, option);
111
+ },
98
112
  "data-testid": option.testId
99
113
  }, option.testId && {
100
114
  'data-value': selected == option.value ? 1 : 0
@@ -109,12 +123,15 @@ var Radio = /*#__PURE__*/function (_React$Component) {
109
123
  id: option.trk
110
124
  }), option.label && /*#__PURE__*/_react["default"].createElement(_Text["default"], {
111
125
  tag: "label",
112
- className: "".concat(classes.label).concat(textOverflow ? " ".concat(classes.overflow) : '')
126
+ className: "".concat(classes.label).concat(textOverflow ? " ".concat(classes.overflow) : '').concat(alignLeft ? " ".concat(classes.alignLeft) : '')
113
127
  }, option.label), option.right && /*#__PURE__*/_react["default"].createElement(_Text["default"], {
114
128
  tag: "label",
115
129
  corpSecondary: true,
116
130
  className: classes.right
117
- }, option.right));
131
+ }, option.right), option.tag && /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
132
+ theme: "link",
133
+ className: classes.tag
134
+ }, option.tag));
118
135
  }));
119
136
  }
120
137
  }]);
@@ -139,6 +156,7 @@ Radio.propTypes = {
139
156
  value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
140
157
  label: _propTypes["default"].string,
141
158
  right: _propTypes["default"].string,
159
+ tag: _propTypes["default"].string,
142
160
  trk: _propTypes["default"].string,
143
161
 
144
162
  /** The testId property adds the data attribute data-testid to
@@ -146,6 +164,9 @@ Radio.propTypes = {
146
164
  testId: _propTypes["default"].string
147
165
  })),
148
166
 
167
+ /** Align the content to the left */
168
+ alignLeft: _propTypes["default"].bool,
169
+
149
170
  /** Use this prop to overflow the text of the label, adding '...' and the end. */
150
171
  textOverflow: _propTypes["default"].bool,
151
172
 
@@ -15,6 +15,9 @@ Object {
15
15
  },
16
16
  },
17
17
  },
18
+ "alignLeft": Object {
19
+ "flex": "none",
20
+ },
18
21
  "cont": Object {
19
22
  "&$active": Object {
20
23
  "&:active": Object {
@@ -24,7 +27,6 @@ Object {
24
27
  "& $radio:before": Object {
25
28
  "borderColor": "#0047A5",
26
29
  "borderWidth": "3px",
27
- "boxShadow": "initial",
28
30
  },
29
31
  },
30
32
  "&:focus $radio:before": Object {
@@ -37,7 +39,6 @@ Object {
37
39
  },
38
40
  "& $radio:before": Object {
39
41
  "borderColor": "#0047A5",
40
- "boxShadow": "initial",
41
42
  },
42
43
  },
43
44
  },
@@ -56,7 +57,7 @@ Object {
56
57
  "boxShadow": "initial",
57
58
  },
58
59
  },
59
- "alignItems": "start",
60
+ "alignItems": "center",
60
61
  "boxSizing": "border-box",
61
62
  "cursor": "pointer",
62
63
  "display": "flex",
@@ -122,8 +123,11 @@ Object {
122
123
  "position": "absolute",
123
124
  "top": "50%",
124
125
  "transform": "translate(-50%, -50%)",
126
+ "transition": "0.3s all",
125
127
  "width": 20,
126
128
  },
129
+ "alignItems": "center",
130
+ "display": "flex",
127
131
  "height": "24px",
128
132
  "position": "relative",
129
133
  "width": "24px",
@@ -131,6 +135,11 @@ Object {
131
135
  "right": Object {
132
136
  "float": "right",
133
137
  "marginLeft": "8px",
138
+ "pointerEvents": "none",
139
+ },
140
+ "tag": Object {
141
+ "marginLeft": "8px",
142
+ "pointerEvents": "none",
134
143
  },
135
144
  }
136
145
  `;
@@ -20,7 +20,7 @@ var _default = {
20
20
  paddingBottom: _spacing["default"]['size-2'],
21
21
  boxSizing: 'border-box',
22
22
  display: 'flex',
23
- alignItems: 'start',
23
+ alignItems: 'center',
24
24
  cursor: 'pointer',
25
25
  outline: '0',
26
26
  '&$active': {
@@ -30,8 +30,7 @@ var _default = {
30
30
  },
31
31
  '&:hover': {
32
32
  '& $radio:before': {
33
- borderColor: radio['selected']['border']['hover'],
34
- boxShadow: 'initial'
33
+ borderColor: radio['selected']['border']['hover']
35
34
  },
36
35
  '& $radio:after': {
37
36
  background: radio['selected']['bg']['hover']
@@ -40,8 +39,7 @@ var _default = {
40
39
  '&:active': {
41
40
  '& $radio:before': {
42
41
  borderColor: radio['selected']['border']['hover'],
43
- borderWidth: '3px',
44
- boxShadow: 'initial'
42
+ borderWidth: '3px'
45
43
  },
46
44
  '& $radio:after': {
47
45
  background: radio['selected']['bg']['hover']
@@ -49,10 +47,6 @@ var _default = {
49
47
  }
50
48
  },
51
49
  '&:not($active)': {
52
- '&:focus $radio:before': {
53
- borderColor: radio['unselected']['border']['default'],
54
- boxShadow: _shadows["default"]['focus-bright-blue']
55
- },
56
50
  '&:hover $radio:before': {
57
51
  borderColor: radio['unselected']['border']['hover'],
58
52
  boxShadow: 'initial'
@@ -61,6 +55,10 @@ var _default = {
61
55
  borderColor: radio['unselected']['border']['hover'],
62
56
  borderWidth: '2px',
63
57
  boxShadow: 'initial'
58
+ },
59
+ '&:focus $radio:before': {
60
+ borderColor: radio['unselected']['border']['default'],
61
+ boxShadow: _shadows["default"]['focus-bright-blue']
64
62
  }
65
63
  }
66
64
  },
@@ -68,6 +66,8 @@ var _default = {
68
66
  width: _spacing["default"]['size-5'],
69
67
  height: _spacing["default"]['size-5'],
70
68
  position: 'relative',
69
+ display: 'flex',
70
+ alignItems: 'center',
71
71
  '&:before': {
72
72
  content: '""',
73
73
  boxSizing: 'border-box',
@@ -79,7 +79,8 @@ var _default = {
79
79
  left: '50%',
80
80
  transform: 'translate(-50%, -50%)',
81
81
  border: "1px solid ".concat(radio['unselected']['border']['default']),
82
- background: radio['bg']['default']
82
+ background: radio['bg']['default'],
83
+ transition: '0.3s all'
83
84
  },
84
85
  '&:after': {
85
86
  content: '""',
@@ -136,12 +137,20 @@ var _default = {
136
137
  },
137
138
  right: {
138
139
  marginLeft: _spacing["default"]['size-2'],
139
- "float": 'right'
140
+ "float": 'right',
141
+ pointerEvents: 'none'
140
142
  },
141
143
  overflow: {
142
144
  overflow: 'hidden',
143
145
  textOverflow: 'ellipsis',
144
146
  whiteSpace: 'nowrap'
147
+ },
148
+ tag: {
149
+ marginLeft: _spacing["default"]['size-2'],
150
+ pointerEvents: 'none'
151
+ },
152
+ alignLeft: {
153
+ flex: 'none'
145
154
  }
146
155
  };
147
156
  exports["default"] = _default;
@@ -343,7 +343,7 @@
343
343
  },
344
344
  "info": {
345
345
  "bg": "#e3efff",
346
- "border": "#e3efff"
346
+ "border": "#b9d7ff"
347
347
  },
348
348
  "neutral": {
349
349
  "bg": "#000",
@@ -402,7 +402,7 @@
402
402
  },
403
403
  "info": {
404
404
  "bg": "#e3efff",
405
- "border": "#e3efff"
405
+ "border": "#b9d7ff"
406
406
  },
407
407
  "featured": {
408
408
  "border": "rgba(255,255,255,0.2)",
@@ -567,7 +567,7 @@
567
567
  "subtle": "#d7f6e3"
568
568
  },
569
569
  "info": {
570
- "subtle": "#e3efff"
570
+ "subtle": "#b9d7ff"
571
571
  }
572
572
  },
573
573
  "text": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occmundial/occ-atomic",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.7",
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",