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

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,17 @@
1
+ # [3.0.0-beta.41](https://github.com/occmundial/occ-atomic/compare/v3.0.0-beta.40...v3.0.0-beta.41) (2024-08-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add no padding prop to slide down navigation menu ([bda81dc](https://github.com/occmundial/occ-atomic/commit/bda81dc102efb4c2bba25a83638baeb00cad2f60))
7
+ * Remove component data file ([6e58558](https://github.com/occmundial/occ-atomic/commit/6e58558cba4627e3e6ee3aea7ac2d55f21ffd5c0))
8
+
9
+
10
+ ### Features
11
+
12
+ * Add custom title prop ([fd14212](https://github.com/occmundial/occ-atomic/commit/fd142127a26207e28c3ab57fa32486066fb03f75))
13
+ * Update slidedown with new design tokens ([930da58](https://github.com/occmundial/occ-atomic/commit/930da58f04c7b87b5687784dc67fcb7eb2e200e7))
14
+
1
15
  # [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
16
 
3
17
 
@@ -11,7 +11,7 @@ var usePrevious = function usePrevious(value) {
11
11
  var ref = (0, _react.useRef)();
12
12
  (0, _react.useEffect)(function () {
13
13
  ref.current = value;
14
- }, []);
14
+ });
15
15
  return ref.current;
16
16
  };
17
17
 
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
@@ -19,10 +19,16 @@ var _Tag = _interopRequireDefault(require("../Tag"));
19
19
 
20
20
  var _Flexbox = _interopRequireDefault(require("../Flexbox"));
21
21
 
22
- var _colors = _interopRequireDefault(require("../subatomic/colors"));
22
+ var _colors = _interopRequireDefault(require("../tokens/colors.json"));
23
+
24
+ var _usePrevious = _interopRequireDefault(require("../Provider/usePrevious"));
23
25
 
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
27
 
28
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
+
30
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
+
26
32
  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); }
27
33
 
28
34
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
@@ -31,189 +37,141 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
31
37
 
32
38
  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; }
33
39
 
34
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35
-
36
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
37
-
38
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
39
-
40
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
41
-
42
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
40
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
43
41
 
44
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
42
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
45
43
 
46
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
44
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
47
45
 
48
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
46
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
49
47
 
50
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
48
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
51
49
 
52
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
50
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
53
51
 
54
- /** Component to create an accordion section. The content will be hidden by default, and shown after click. */
55
- var SlideDown = /*#__PURE__*/function (_React$Component) {
56
- _inherits(SlideDown, _React$Component);
57
-
58
- var _super = _createSuper(SlideDown);
59
-
60
- function SlideDown(props) {
61
- var _this;
62
-
63
- _classCallCheck(this, SlideDown);
64
-
65
- _this = _super.call(this, props);
66
- _this.state = {
67
- expanded: _this.props.expanded,
68
- toggled: _this.props.expanded
69
- };
70
- _this.toggleContent = _this.toggleContent.bind(_assertThisInitialized(_this));
71
- return _this;
52
+ var textSizes = {
53
+ sm: {
54
+ small: true
55
+ },
56
+ md: {
57
+ standard: true
58
+ },
59
+ lg: {
60
+ extraLarge: true
61
+ },
62
+ "default": {
63
+ standard: true
72
64
  }
73
-
74
- _createClass(SlideDown, [{
75
- key: "componentDidUpdate",
76
- value: function componentDidUpdate(prevProps) {
77
- var expanded = this.props.expanded;
78
-
79
- if (prevProps.expanded !== expanded) {
80
- this.toggleContent(expanded);
81
- }
82
- }
83
- }, {
84
- key: "toggleContent",
85
- value: function toggleContent(value) {
86
- var _this2 = this;
87
-
88
- var onToggle = this.props.onToggle;
89
- this.setState(_defineProperty({}, value ? 'expanded' : 'toggled', value));
90
- if (onToggle) onToggle(value);
91
- setTimeout(function () {
92
- _this2.setState(_defineProperty({}, value ? 'toggled' : 'expanded', value));
93
- }, value ? 0 : 300);
65
+ };
66
+ var _themeColors = {
67
+ blue: {
68
+ icon: _colors["default"].icon.brand["default"],
69
+ text: {
70
+ primary: true
94
71
  }
95
- }, {
96
- key: "render",
97
- value: function render() {
98
- var _this3 = this;
99
-
100
- var _this$state = this.state,
101
- expanded = _this$state.expanded,
102
- toggled = _this$state.toggled;
103
- var _this$props = this.props,
104
- classes = _this$props.classes,
105
- title = _this$props.title,
106
- children = _this$props.children,
107
- tag = _this$props.tag,
108
- textSize = _this$props.textSize,
109
- strong = _this$props.strong,
110
- theme = _this$props.theme,
111
- noJustified = _this$props.noJustified;
112
-
113
- var getTextSize = function getTextSize() {
114
- switch (textSize) {
115
- case 'md':
116
- return {
117
- standard: true
118
- };
119
-
120
- case 'lg':
121
- return {
122
- large: true
123
- };
124
-
125
- case 'sm':
126
- return {
127
- small: true
128
- };
129
-
130
- default:
131
- return {
132
- standard: true
133
- };
134
- }
135
- };
136
-
137
- var getTextTheme = function getTextTheme() {
138
- switch (theme) {
139
- case 'blue':
140
- return {
141
- link: true
142
- };
143
-
144
- case 'default':
145
- default:
146
- return null;
147
- }
148
- };
149
-
150
- var getIconColor = function getIconColor() {
151
- switch (theme) {
152
- case 'blue':
153
- return _colors["default"].textLink;
154
-
155
- case 'default':
156
- default:
157
- return _colors["default"].grey900;
158
- }
159
- };
160
-
161
- var getTextProps = function getTextProps() {
162
- return _objectSpread(_objectSpread({}, getTextSize()), getTextTheme());
163
- };
164
-
165
- return /*#__PURE__*/_react["default"].createElement("div", {
166
- className: classes.wrapper
167
- }, /*#__PURE__*/_react["default"].createElement("div", {
168
- className: classes.button,
169
- onClick: function onClick() {
170
- return _this3.toggleContent(!expanded);
171
- }
172
- }, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
173
- display: "flex",
174
- justifyContent: !noJustified ? 'between' : null,
175
- alignItems: "start"
176
- }, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
177
- display: "flex",
178
- alignItems: "center"
179
- }, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
180
- display: "flex",
181
- alignItems: "start",
182
- wrap: "wrap"
183
- }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Text["default"], _extends({}, getTextProps(), {
184
- strong: strong,
185
- tag: "label",
186
- className: classes.text
187
- }), title), tag && /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
188
- theme: "info",
189
- className: classes.tag
190
- }, tag)))), /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
191
- flex: "0 0 auto"
192
- }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
193
- iconName: "arrowDown",
194
- colors: [getIconColor()],
195
- className: classes.icon,
196
- width: 18,
197
- height: 18,
198
- style: {
199
- transform: toggled ? 'rotate(180deg)' : ''
200
- },
201
- testId: "slidedown__arrow-down"
202
- })))), expanded && /*#__PURE__*/_react["default"].createElement("div", {
203
- className: "".concat(classes.content, " ").concat(toggled ? classes.show : classes.hide)
204
- }, children));
72
+ },
73
+ "default": {
74
+ icon: _colors["default"].icon["default"].bold,
75
+ text: {
76
+ highEmphasis: true
205
77
  }
206
- }]);
78
+ }
79
+ };
80
+ /** Component to create an accordion section. The content will be hidden by default, and shown after click. */
207
81
 
208
- return SlideDown;
209
- }(_react["default"].Component);
82
+ function SlideDown(_ref) {
83
+ var expanded = _ref.expanded,
84
+ classes = _ref.classes,
85
+ title = _ref.title,
86
+ customTitle = _ref.customTitle,
87
+ children = _ref.children,
88
+ tag = _ref.tag,
89
+ textSize = _ref.textSize,
90
+ strong = _ref.strong,
91
+ theme = _ref.theme,
92
+ noJustified = _ref.noJustified,
93
+ onToggle = _ref.onToggle,
94
+ icon = _ref.icon,
95
+ divider = _ref.divider,
96
+ noPadding = _ref.noPadding,
97
+ testId = _ref.testId;
98
+
99
+ var _useState = (0, _react.useState)(!!expanded),
100
+ _useState2 = _slicedToArray(_useState, 2),
101
+ _expanded = _useState2[0],
102
+ setExpanded = _useState2[1];
103
+
104
+ var prevExpanded = (0, _usePrevious["default"])(!!expanded);
105
+ var themeColors = _themeColors[theme] || _themeColors['default'];
106
+
107
+ var toggleContent = function toggleContent(e) {
108
+ e.stopPropagation();
109
+ setExpanded(!_expanded);
110
+ if (onToggle) onToggle(!_expanded);
111
+ };
112
+
113
+ var getTextProps = function getTextProps() {
114
+ return _objectSpread(_objectSpread({}, textSizes[textSize] || textSizes["default"]), themeColors.text);
115
+ };
116
+
117
+ (0, _react.useEffect)(function () {
118
+ if (prevExpanded !== expanded) {
119
+ setExpanded(expanded);
120
+ }
121
+ }, [prevExpanded, expanded]);
122
+ return /*#__PURE__*/_react["default"].createElement("div", {
123
+ className: classes.wrapper
124
+ }, /*#__PURE__*/_react["default"].createElement("div", {
125
+ className: "".concat(classes.button, " ").concat(textSize === 'lg' ? classes.largePadding : classes.normalPadding).concat(!noPadding ? " ".concat(classes.buttonPadding) : ''),
126
+ role: "button",
127
+ onClick: toggleContent,
128
+ "data-testid": testId
129
+ }, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
130
+ display: "flex",
131
+ justifyContent: !noJustified ? 'between' : null,
132
+ alignItems: "center",
133
+ className: classes.flexContainer
134
+ }, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
135
+ display: "flex",
136
+ alignItems: "center",
137
+ wrap: "wrap"
138
+ }, icon ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
139
+ iconName: icon,
140
+ width: 16,
141
+ height: 16,
142
+ colors: [themeColors.icon],
143
+ className: classes.leftIcon
144
+ }) : '', customTitle || /*#__PURE__*/_react["default"].createElement(_Text["default"], _extends({}, getTextProps(), {
145
+ strong: strong,
146
+ tag: "label",
147
+ className: classes.text
148
+ }), title), tag && /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
149
+ theme: "info",
150
+ className: classes.tag
151
+ }, tag)), /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
152
+ iconName: "arrowDown",
153
+ colors: [themeColors.icon],
154
+ className: "".concat(classes.icon).concat(_expanded ? " ".concat(classes.rotateIcon) : ''),
155
+ width: 16,
156
+ height: 16,
157
+ testId: "slidedown__arrow-down"
158
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
159
+ className: "".concat(classes.contentWrapper).concat(_expanded ? " ".concat(classes.showContentWrapper) : '')
160
+ }, /*#__PURE__*/_react["default"].createElement("div", {
161
+ className: "".concat(classes.content).concat(_expanded ? " ".concat(classes.showContent) : '')
162
+ }, children)), divider ? /*#__PURE__*/_react["default"].createElement("div", {
163
+ className: classes.divider
164
+ }) : '');
165
+ }
210
166
 
211
167
  SlideDown.defaultProps = {
212
168
  expanded: false,
213
169
  textSize: 'md',
214
170
  strong: false,
215
171
  theme: 'default',
216
- noJustified: false
172
+ noJustified: false,
173
+ icon: '',
174
+ noPadding: false
217
175
  };
218
176
  SlideDown.propTypes = {
219
177
  classes: _propTypes["default"].object,
@@ -222,6 +180,9 @@ SlideDown.propTypes = {
222
180
  /** Title of the tab. */
223
181
  title: _propTypes["default"].string,
224
182
 
183
+ /** If the title needs to be customized. It will be rendered instead of the title. */
184
+ customTitle: _propTypes["default"].node,
185
+
225
186
  /** Set this as true to show the content by default. If the external prop is the same of the internal state the component dont toggle */
226
187
  expanded: _propTypes["default"].bool,
227
188
 
@@ -241,7 +202,19 @@ SlideDown.propTypes = {
241
202
  theme: _propTypes["default"].oneOf(['default', 'blue']),
242
203
 
243
204
  /** The Title container has an alignment by default. Use this property if you need to remove it. */
244
- noJustified: _propTypes["default"].bool
205
+ noJustified: _propTypes["default"].bool,
206
+
207
+ /** Shows a divider at the bottom*/
208
+ divider: _propTypes["default"].bool,
209
+
210
+ /** Use the name of any of the icons available in the library. */
211
+ icon: _propTypes["default"].string,
212
+
213
+ /** The container has by default a side padding. Use this property if you need to remove it. */
214
+ noPadding: _propTypes["default"].bool,
215
+
216
+ /** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
217
+ testId: _propTypes["default"].string
245
218
  };
246
219
  var _default = SlideDown;
247
220
  exports["default"] = _default;
@@ -14,7 +14,7 @@ var _Text = _interopRequireDefault(require("../Text"));
14
14
 
15
15
  var _Icon = _interopRequireDefault(require("../Icon"));
16
16
 
17
- var _colors = _interopRequireDefault(require("../subatomic/colors"));
17
+ var _colors = _interopRequireDefault(require("../tokens/colors.json"));
18
18
 
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
20
20
 
@@ -44,23 +44,16 @@ describe('SlideDown', function () {
44
44
  var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_SlideDown["default"], {
45
45
  expanded: true,
46
46
  classes: classes,
47
- title: "Title"
47
+ title: "Title",
48
+ testId: "slidedown-test"
48
49
  }));
49
- expect(wrapper.find({
50
- 'data-testid': 'slidedown__arrow-down'
51
- }).prop('style')).toEqual({
52
- transform: 'rotate(180deg)',
53
- transition: '0.3s all'
54
- });
55
- wrapper.setState({
56
- toggled: false
57
- });
58
- expect(wrapper.find({
59
- 'data-testid': 'slidedown__arrow-down'
60
- }).prop('style')).toEqual({
61
- transform: '',
62
- transition: '0.3s all'
50
+ expect(wrapper.find('Icon .rotateIcon').length).toBe(1);
51
+ wrapper.find({
52
+ "data-testid": 'slidedown-test'
53
+ }).simulate('click', {
54
+ stopPropagation: function stopPropagation() {}
63
55
  });
56
+ expect(wrapper.find('Icon .rotateIcon').length).toBe(0);
64
57
  });
65
58
  it('shows a Tag on the title', function () {
66
59
  var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_SlideDown["default"], {
@@ -75,31 +68,17 @@ describe('SlideDown', function () {
75
68
  it('renders the child content', function () {
76
69
  var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_SlideDown["default"], {
77
70
  classes: classes,
78
- title: "Title"
79
- }, "Children content"));
80
- expect(wrapper.find('.content').length).toBe(0);
81
- wrapper.setState({
82
- expanded: true
83
- });
84
- expect(wrapper.find('.content').length).toBe(1);
85
- expect(wrapper.find('.content').text()).toEqual('Children content');
86
- });
87
- it('correct render when prop expanded change', function () {
88
- var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_SlideDown["default"], {
89
- classes: classes,
90
- title: "Title"
71
+ title: "Title",
72
+ testId: "slidedown-test"
91
73
  }, "Children content"));
92
- expect(wrapper.find('.content').length).toBe(0);
93
- wrapper.setProps({
94
- expanded: true
95
- });
96
- expect(wrapper.find('.content').length).toBe(1);
97
- wrapper.setProps({
98
- expanded: false
74
+ expect(wrapper.find('.showContent').length).toBe(0);
75
+ wrapper.find({
76
+ "data-testid": 'slidedown-test'
77
+ }).simulate('click', {
78
+ stopPropagation: function stopPropagation() {}
99
79
  });
100
- setTimeout(function () {
101
- expect(wrapper.find('.content').length).toBe(0);
102
- }, 400);
80
+ expect(wrapper.find('.showContent').length).toBe(1);
81
+ expect(wrapper.find('.showContent').text()).toEqual('Children content');
103
82
  });
104
83
  it('Text have the right properties', function () {
105
84
  var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_SlideDown["default"], {
@@ -107,20 +86,46 @@ describe('SlideDown', function () {
107
86
  textSize: 'lg',
108
87
  title: "Title"
109
88
  }, "Children content"));
110
- expect(wrapper.find(_Text["default"]).props().large).toEqual(true);
89
+ expect(wrapper.find(_Text["default"]).props().extraLarge).toEqual(true);
111
90
  });
112
91
  it('Text and Icon has theme color', function () {
113
92
  var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_SlideDown["default"], {
114
93
  classes: classes,
115
94
  title: "Title"
116
95
  }, "Children content"));
117
- expect(wrapper.find(_Icon["default"]).props().colors).toEqual([_colors["default"].grey900]);
118
- expect(wrapper.find(_Text["default"]).props().link).toBeFalsy();
96
+ expect(wrapper.find(_Icon["default"]).props().colors).toEqual([_colors["default"].icon["default"].bold]);
97
+ expect(wrapper.find(_Text["default"]).props().primary).toBeFalsy();
119
98
  wrapper.setProps({
120
99
  theme: 'blue'
121
100
  });
122
- expect(wrapper.find(_Text["default"]).props().link).toEqual(true);
123
- expect(wrapper.find(_Icon["default"]).props().colors).toEqual([_colors["default"].textLink]);
101
+ expect(wrapper.find(_Text["default"]).props().primary).toEqual(true);
102
+ expect(wrapper.find(_Icon["default"]).props().colors).toEqual([_colors["default"].icon.brand["default"]]);
103
+ });
104
+ it('render a custom title', function () {
105
+ var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_SlideDown["default"], {
106
+ customTitle: /*#__PURE__*/_react["default"].createElement("div", {
107
+ "data-testid": "custom-title",
108
+ style: {
109
+ display: 'flex',
110
+ gap: '24px',
111
+ alignItems: 'center'
112
+ }
113
+ }, /*#__PURE__*/_react["default"].createElement("p", {
114
+ style: {
115
+ margin: 0
116
+ }
117
+ }, "Custom ", /*#__PURE__*/_react["default"].createElement("b", null, "SlideDown"), " Title"), /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
118
+ iconName: "search",
119
+ width: 16,
120
+ height: 16
121
+ })),
122
+ title: "This title should not render",
123
+ classes: classes
124
+ }, "Children content"));
125
+ expect(wrapper.find({
126
+ "data-testid": 'custom-title'
127
+ }).exists()).toEqual(true);
128
+ expect(wrapper.find('label').exists()).toEqual(false);
124
129
  });
125
130
  });
126
131
  describe('SlideDownJSS', function () {
@@ -7,34 +7,65 @@ Object {
7
7
  "button": Object {
8
8
  "cursor": "pointer",
9
9
  },
10
+ "buttonPadding": Object {
11
+ "paddingLeft": "16px",
12
+ "paddingRight": "16px",
13
+ },
10
14
  "content": Object {
11
- "transition": "0.3s all ease-out",
15
+ "overflow": "hidden",
16
+ "transform": "translateY(-10px)",
17
+ "transition": "transform cubic-bezier(0.25,0.46,0.45,0.94) 0.2s",
12
18
  },
13
- "hide": Object {
14
- "marginBottom": 16,
15
- "marginTop": -16,
19
+ "contentWrapper": Object {
20
+ "display": "grid",
21
+ "gridTemplateRows": "0fr",
16
22
  "opacity": 0,
17
- "pointerEvents": "none",
23
+ "transition": "grid-template-rows cubic-bezier(0.25,0.46,0.45,0.94) 0.2s 0.05s, opacity cubic-bezier(0.25,0.46,0.45,0.94) 0.2s",
24
+ },
25
+ "divider": Object {
26
+ "border": "1px solid #EDEDF1",
27
+ "marginTop": "-2px",
28
+ },
29
+ "flexContainer": Object {
30
+ "gap": "16px",
18
31
  },
19
32
  "icon": Object {
20
- "marginLeft": 8,
21
- "marginTop": 4,
33
+ "transition": "rotate cubic-bezier(0.25,0.46,0.45,0.94) 0.2s",
34
+ },
35
+ "largePadding": Object {
36
+ "paddingBottom": "16px",
37
+ "paddingTop": "16px",
38
+ },
39
+ "leftIcon": Object {
40
+ "marginRight": "8px",
41
+ },
42
+ "normalPadding": Object {
43
+ "paddingBottom": "12px",
44
+ "paddingTop": "12px",
45
+ },
46
+ "rotateIcon": Object {
47
+ "transform": "rotate(-180deg)",
48
+ },
49
+ "showContent": Object {
50
+ "marginBottom": "12px",
51
+ "transform": "translateY(0px)",
52
+ "transition": "transform cubic-bezier(0.25,0.46,0.45,0.94) 0.2s 0.05s",
22
53
  },
23
- "show": Object {
24
- "marginBottom": 0,
25
- "marginTop": 0,
54
+ "showContentWrapper": Object {
55
+ "gridTemplateRows": "1fr",
26
56
  "opacity": 1,
57
+ "transition": "grid-template-rows cubic-bezier(0.25,0.46,0.45,0.94) 0.2s, opacity cubic-bezier(0.25,0.46,0.45,0.94) 0.2s 0.05s",
27
58
  },
28
59
  "tag": Object {
29
- "marginLeft": 8,
30
- "marginTop": 4,
60
+ "marginLeft": "8px",
61
+ "marginTop": "4px",
31
62
  "pointerEvents": "none",
32
63
  },
33
64
  "text": Object {
34
65
  "cursor": "pointer",
35
66
  },
36
67
  "wrapper": Object {
37
- "marginBottom": 16,
68
+ "marginBottom": "16px",
38
69
  },
39
70
  }
40
71
  `;
@@ -5,42 +5,75 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
 
8
- var _spacing = _interopRequireDefault(require("../subatomic/spacing"));
8
+ var _spacing = _interopRequireDefault(require("../tokens/spacing.json"));
9
+
10
+ var _colors = _interopRequireDefault(require("../tokens/colors.json"));
9
11
 
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
13
 
12
14
  var _default = {
13
15
  wrapper: {
14
- marginBottom: _spacing["default"].small
16
+ marginBottom: _spacing["default"]['size-4']
15
17
  },
16
18
  button: {
17
19
  cursor: 'pointer'
18
20
  },
21
+ normalPadding: {
22
+ paddingTop: _spacing["default"]['size-3'],
23
+ paddingBottom: _spacing["default"]['size-3']
24
+ },
25
+ largePadding: {
26
+ paddingTop: _spacing["default"]['size-4'],
27
+ paddingBottom: _spacing["default"]['size-4']
28
+ },
29
+ buttonPadding: {
30
+ paddingLeft: _spacing["default"]['size-4'],
31
+ paddingRight: _spacing["default"]['size-4']
32
+ },
19
33
  text: {
20
34
  cursor: 'pointer'
21
35
  },
36
+ tag: {
37
+ marginTop: _spacing["default"]['size-1'],
38
+ marginLeft: _spacing["default"]['size-2'],
39
+ pointerEvents: 'none'
40
+ },
41
+ icon: {
42
+ transition: 'rotate cubic-bezier(0.25,0.46,0.45,0.94) 0.2s'
43
+ },
44
+ leftIcon: {
45
+ marginRight: _spacing["default"]['size-2']
46
+ },
47
+ rotateIcon: {
48
+ transform: 'rotate(-180deg)'
49
+ },
22
50
  content: {
23
- transition: '0.3s all ease-out'
51
+ overflow: 'hidden',
52
+ transform: 'translateY(-10px)',
53
+ transition: 'transform cubic-bezier(0.25,0.46,0.45,0.94) 0.2s'
24
54
  },
25
- hide: {
26
- opacity: 0,
27
- marginTop: -_spacing["default"].small,
28
- marginBottom: _spacing["default"].small,
29
- pointerEvents: 'none'
55
+ showContent: {
56
+ transform: 'translateY(0px)',
57
+ transition: 'transform cubic-bezier(0.25,0.46,0.45,0.94) 0.2s 0.05s',
58
+ marginBottom: _spacing["default"]['size-3']
30
59
  },
31
- show: {
60
+ contentWrapper: {
61
+ display: 'grid',
62
+ gridTemplateRows: '0fr',
63
+ transition: 'grid-template-rows cubic-bezier(0.25,0.46,0.45,0.94) 0.2s 0.05s, opacity cubic-bezier(0.25,0.46,0.45,0.94) 0.2s',
64
+ opacity: 0
65
+ },
66
+ showContentWrapper: {
32
67
  opacity: 1,
33
- marginTop: 0,
34
- marginBottom: 0
68
+ gridTemplateRows: '1fr',
69
+ transition: 'grid-template-rows cubic-bezier(0.25,0.46,0.45,0.94) 0.2s, opacity cubic-bezier(0.25,0.46,0.45,0.94) 0.2s 0.05s'
35
70
  },
36
- tag: {
37
- marginTop: _spacing["default"].xTiny,
38
- marginLeft: _spacing["default"].tiny,
39
- pointerEvents: 'none'
71
+ divider: {
72
+ border: "1px solid ".concat(_colors["default"].border["default"].subtle),
73
+ marginTop: "-".concat(_spacing["default"]['size-0'])
40
74
  },
41
- icon: {
42
- marginTop: _spacing["default"].xTiny,
43
- marginLeft: _spacing["default"].tiny
75
+ flexContainer: {
76
+ gap: _spacing["default"]['size-4']
44
77
  }
45
78
  };
46
79
  exports["default"] = _default;
@@ -85,6 +85,7 @@
85
85
  },
86
86
  "alpha": {
87
87
  "white": {
88
+ "0": "rgba(255,255,255,0)",
88
89
  "5": "rgba(255,255,255,0.05)",
89
90
  "10": "rgba(255,255,255,0.1)",
90
91
  "20": "rgba(255,255,255,0.2)",
@@ -137,6 +138,7 @@
137
138
  "100": "hsl(234 75.4% 12.7%)"
138
139
  },
139
140
  "black": {
141
+ "0": "rgba(0,0,0,0.0)",
140
142
  "5": "rgba(0,0,0,0.05)",
141
143
  "10": "rgba(0,0,0,0.1)",
142
144
  "20": "rgba(0,0,0,0.2)",
@@ -481,6 +483,18 @@
481
483
  }
482
484
  }
483
485
  },
486
+ "skeleton": {
487
+ "bg": {
488
+ "default": {
489
+ "gradient": "linear-gradient(90deg, rgba(0,0,0,0.0) , rgba(0,0,0,0.05) , rgba(0,0,0,0.0) )",
490
+ "default": "rgba(0,0,0,0.05)"
491
+ },
492
+ "inverse": {
493
+ "default": "rgba(255,255,255,0.1)",
494
+ "gradient": "linear-gradient(90deg rgba(255,255,255,0), rgba(255,255,255,0.1) , rgba(255,255,255,0) )"
495
+ }
496
+ }
497
+ },
484
498
  "bg": {
485
499
  "action": {
486
500
  "primary": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occmundial/occ-atomic",
3
- "version": "3.0.0-beta.40",
3
+ "version": "3.0.0-beta.41",
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",