@moda/om 16.3.0 → 17.0.0

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
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [17.0.0](https://github.com/ModaOperandi/om/compare/v16.3.0...v17.0.0) (2022-08-17)
7
+
8
+
9
+ ### Features
10
+
11
+ * **expandable:** allow it to be controlled ([#2848](https://github.com/ModaOperandi/om/issues/2848)) ([d7128b6](https://github.com/ModaOperandi/om/commit/d7128b60276da6f155acd4cb5abb910648a3a904))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * **expandable:** 'expanded' will now control the component completely
17
+
6
18
  # [16.3.0](https://github.com/ModaOperandi/om/compare/v16.2.1...v16.3.0) (2022-07-06)
7
19
 
8
20
 
package/dist/index.cjs.js CHANGED
@@ -11370,7 +11370,7 @@ var DefinitionList = function DefinitionList(_ref) {
11370
11370
  }, rest), /*#__PURE__*/React__default["default"].createElement("dt", null, term), /*#__PURE__*/React__default["default"].createElement("dd", null, children));
11371
11371
  };
11372
11372
 
11373
- var _excluded$f = ["name", "children", "className", "virtual", "icon", "data-testid", "expanded"];
11373
+ var _excluded$f = ["name", "children", "className", "virtual", "icon", "data-testid", "defaultExpanded", "expanded"];
11374
11374
  var Expandable = function Expandable(_ref) {
11375
11375
  var name = _ref.name,
11376
11376
  children = _ref.children,
@@ -11380,15 +11380,19 @@ var Expandable = function Expandable(_ref) {
11380
11380
  _ref$icon = _ref.icon,
11381
11381
  icon = _ref$icon === void 0 ? 'plus-minus' : _ref$icon,
11382
11382
  dataTestId = _ref['data-testid'],
11383
- _ref$expanded = _ref.expanded,
11384
- __expanded__ = _ref$expanded === void 0 ? false : _ref$expanded,
11383
+ _ref$defaultExpanded = _ref.defaultExpanded,
11384
+ defaultExpanded = _ref$defaultExpanded === void 0 ? false : _ref$defaultExpanded,
11385
+ __expanded__ = _ref.expanded,
11385
11386
  rest = _objectWithoutProperties(_ref, _excluded$f);
11386
11387
 
11387
- var _useState = React.useState(__expanded__),
11388
+ var _useState = React.useState(defaultExpanded),
11388
11389
  _useState2 = _slicedToArray(_useState, 2),
11389
11390
  expanded = _useState2[0],
11390
11391
  setExpanded = _useState2[1];
11391
11392
 
11393
+ React.useEffect(function () {
11394
+ if (__expanded__ != null && __expanded__ !== expanded) setExpanded(__expanded__);
11395
+ }, [expanded, __expanded__]);
11392
11396
  var handleClick = React.useCallback(function () {
11393
11397
  return setExpanded(function (expanded) {
11394
11398
  return !expanded;