@moda/om 17.3.0 → 17.5.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 +14 -0
- package/dist/index.cjs.js +43 -47
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +43 -47
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/src/components/Expandable/Expandable.d.ts +2 -0
- package/dist/src/components/Expandable/Expandable.stories.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/package.json +6 -6
- package/src/components/Checkbox/Checkbox.tsx +4 -0
- package/src/components/Expandable/Expandable.scss +42 -21
- package/src/components/Expandable/Expandable.stories.tsx +12 -0
- package/src/components/Expandable/Expandable.tsx +15 -8
package/dist/index.esm.js
CHANGED
|
@@ -1286,14 +1286,15 @@ var classnames = {exports: {}};
|
|
|
1286
1286
|
}
|
|
1287
1287
|
}
|
|
1288
1288
|
} else if (argType === 'object') {
|
|
1289
|
-
if (arg.toString
|
|
1290
|
-
for (var key in arg) {
|
|
1291
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
1292
|
-
classes.push(key);
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
} else {
|
|
1289
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
1296
1290
|
classes.push(arg.toString());
|
|
1291
|
+
continue;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
for (var key in arg) {
|
|
1295
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
1296
|
+
classes.push(key);
|
|
1297
|
+
}
|
|
1297
1298
|
}
|
|
1298
1299
|
}
|
|
1299
1300
|
}
|
|
@@ -1583,9 +1584,6 @@ function useMergeRefs(refs, defaultValue) {
|
|
|
1583
1584
|
});
|
|
1584
1585
|
}
|
|
1585
1586
|
|
|
1586
|
-
// Only Node.JS has a process variable that is of [[Class]] process
|
|
1587
|
-
Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
|
|
1588
|
-
|
|
1589
1587
|
function ItoI(a) {
|
|
1590
1588
|
return a;
|
|
1591
1589
|
}
|
|
@@ -3385,6 +3383,7 @@ FocusLock.defaultProps = {
|
|
|
3385
3383
|
onActivation: undefined,
|
|
3386
3384
|
onDeactivation: undefined
|
|
3387
3385
|
};
|
|
3386
|
+
var FocusLockUI = FocusLock;
|
|
3388
3387
|
|
|
3389
3388
|
function deferAction(action) {
|
|
3390
3389
|
// Hidding setImmediate from Webpack to avoid inserting polyfill
|
|
@@ -3398,28 +3397,9 @@ function deferAction(action) {
|
|
|
3398
3397
|
}
|
|
3399
3398
|
}
|
|
3400
3399
|
|
|
3401
|
-
process.env.NODE_ENV !== "production" ? {
|
|
3402
|
-
children: propTypes.exports.node.isRequired,
|
|
3403
|
-
disabled: propTypes.exports.bool,
|
|
3404
|
-
className: propTypes.exports.string
|
|
3405
|
-
} : {};
|
|
3406
|
-
|
|
3407
|
-
process.env.NODE_ENV !== "production" ? {
|
|
3408
|
-
children: propTypes.exports.node.isRequired,
|
|
3409
|
-
disabled: propTypes.exports.bool,
|
|
3410
|
-
className: propTypes.exports.string
|
|
3411
|
-
} : {};
|
|
3412
|
-
|
|
3413
|
-
process.env.NODE_ENV !== "production" ? {
|
|
3414
|
-
children: propTypes.exports.node.isRequired,
|
|
3415
|
-
className: propTypes.exports.string
|
|
3416
|
-
} : {};
|
|
3417
|
-
|
|
3418
3400
|
var effectCar = createSidecarMedium();
|
|
3419
3401
|
var focusHiddenMarker = 'data-focus-on-hidden';
|
|
3420
3402
|
|
|
3421
|
-
_assign({}, RemoveScroll.classNames);
|
|
3422
|
-
|
|
3423
3403
|
var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
3424
3404
|
var _a = React.useState(false),
|
|
3425
3405
|
lockProps = _a[0],
|
|
@@ -3461,7 +3441,7 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3461
3441
|
enabled: enabled && scrollLock
|
|
3462
3442
|
});
|
|
3463
3443
|
|
|
3464
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
3444
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FocusLockUI, {
|
|
3465
3445
|
ref: parentRef,
|
|
3466
3446
|
sideCar: sideCar,
|
|
3467
3447
|
disabled: !(lockProps && enabled && focusLock),
|
|
@@ -4277,6 +4257,8 @@ var setFocus = function setFocus(topNode, lastNode, options) {
|
|
|
4277
4257
|
}
|
|
4278
4258
|
};
|
|
4279
4259
|
|
|
4260
|
+
var moveFocusInside = setFocus; //
|
|
4261
|
+
|
|
4280
4262
|
/* eslint-disable no-mixed-operators */
|
|
4281
4263
|
|
|
4282
4264
|
var focusOnBody = function focusOnBody() {
|
|
@@ -4395,7 +4377,7 @@ var activateTrap = function activateTrap() {
|
|
|
4395
4377
|
|
|
4396
4378
|
document.body.focus();
|
|
4397
4379
|
} else {
|
|
4398
|
-
result =
|
|
4380
|
+
result = moveFocusInside(workingArea, lastActiveFocus, {
|
|
4399
4381
|
focusOptions: focusOptions
|
|
4400
4382
|
});
|
|
4401
4383
|
lastPortaledElement = {};
|
|
@@ -4535,7 +4517,7 @@ mediumFocus.assignSyncMedium(onFocus);
|
|
|
4535
4517
|
mediumBlur.assignMedium(onBlur);
|
|
4536
4518
|
mediumEffect.assignMedium(function (cb) {
|
|
4537
4519
|
return cb({
|
|
4538
|
-
moveFocusInside:
|
|
4520
|
+
moveFocusInside: moveFocusInside,
|
|
4539
4521
|
focusInside: focusInside
|
|
4540
4522
|
});
|
|
4541
4523
|
});
|
|
@@ -5858,7 +5840,7 @@ var Circle12 = function Circle12(_a) {
|
|
|
5858
5840
|
|
|
5859
5841
|
Circle12.displayName = 'Circle12';
|
|
5860
5842
|
|
|
5861
|
-
var _excluded$t = ["className", "defaultChecked", "checked", "children", "value", "onChange", "disabled", "checkIcon"];
|
|
5843
|
+
var _excluded$t = ["className", "defaultChecked", "checked", "children", "value", "onChange", "disabled", "checkIcon", "dataTestId"];
|
|
5862
5844
|
var CHECKED_ITEM_PROPS = {
|
|
5863
5845
|
className: 'Checkbox__check-mark',
|
|
5864
5846
|
height: '85%',
|
|
@@ -5876,6 +5858,7 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
5876
5858
|
disabled = _ref.disabled,
|
|
5877
5859
|
_ref$checkIcon = _ref.checkIcon,
|
|
5878
5860
|
checkIcon = _ref$checkIcon === void 0 ? 'checkmark' : _ref$checkIcon,
|
|
5861
|
+
dataTestId = _ref.dataTestId,
|
|
5879
5862
|
rest = _objectWithoutProperties(_ref, _excluded$t);
|
|
5880
5863
|
|
|
5881
5864
|
var _useState = useState((_ref2 = checked !== null && checked !== void 0 ? checked : defaultChecked) !== null && _ref2 !== void 0 ? _ref2 : false),
|
|
@@ -5895,7 +5878,8 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
5895
5878
|
tabIndex: 0,
|
|
5896
5879
|
className: classNames('Checkbox', className, {
|
|
5897
5880
|
'Checkbox--disabled': disabled
|
|
5898
|
-
})
|
|
5881
|
+
}),
|
|
5882
|
+
"data-test-id": "".concat(dataTestId, "--label")
|
|
5899
5883
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
5900
5884
|
tabIndex: -1,
|
|
5901
5885
|
className: classNames('Checkbox__indicator', {
|
|
@@ -5908,7 +5892,8 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
5908
5892
|
checked: isChecked,
|
|
5909
5893
|
value: value,
|
|
5910
5894
|
onChange: handleChange,
|
|
5911
|
-
disabled: disabled
|
|
5895
|
+
disabled: disabled,
|
|
5896
|
+
"data-test-id": "".concat(dataTestId, "--input")
|
|
5912
5897
|
}, rest)), children && /*#__PURE__*/React__default.createElement("span", {
|
|
5913
5898
|
className: "Checkbox__label"
|
|
5914
5899
|
}, children));
|
|
@@ -9575,6 +9560,8 @@ var T = function T() {
|
|
|
9575
9560
|
return true;
|
|
9576
9561
|
};
|
|
9577
9562
|
|
|
9563
|
+
var otherwise = T;
|
|
9564
|
+
|
|
9578
9565
|
function _isPlaceholder(a) {
|
|
9579
9566
|
return a != null && _typeof(a) === 'object' && a['@@functional/placeholder'] === true;
|
|
9580
9567
|
}
|
|
@@ -10735,6 +10722,8 @@ var cond = /*#__PURE__*/_curry1(function cond(pairs) {
|
|
|
10735
10722
|
});
|
|
10736
10723
|
});
|
|
10737
10724
|
|
|
10725
|
+
var cond$1 = cond;
|
|
10726
|
+
|
|
10738
10727
|
var _Set = /*#__PURE__*/function () {
|
|
10739
10728
|
function _Set() {
|
|
10740
10729
|
/* globals Set */
|
|
@@ -11012,6 +11001,7 @@ var uniqBy = /*#__PURE__*/_curry2( /*#__PURE__*/_dispatchable([], _xuniqBy, func
|
|
|
11012
11001
|
*/
|
|
11013
11002
|
|
|
11014
11003
|
var uniq = /*#__PURE__*/uniqBy(identity);
|
|
11004
|
+
var uniq$1 = uniq;
|
|
11015
11005
|
|
|
11016
11006
|
function _isNumber(x) {
|
|
11017
11007
|
return Object.prototype.toString.call(x) === '[object Number]';
|
|
@@ -11050,6 +11040,8 @@ var range = /*#__PURE__*/_curry2(function range(from, to) {
|
|
|
11050
11040
|
return result;
|
|
11051
11041
|
});
|
|
11052
11042
|
|
|
11043
|
+
var range$1 = range;
|
|
11044
|
+
|
|
11053
11045
|
var __assign$2 = undefined && undefined.__assign || function () {
|
|
11054
11046
|
__assign$2 = Object.assign || function (t) {
|
|
11055
11047
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -11150,7 +11142,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
11150
11142
|
dispatch({
|
|
11151
11143
|
type: 'SELECT',
|
|
11152
11144
|
payload: {
|
|
11153
|
-
value: uniq([].concat(_toConsumableArray(values), [option.value]))
|
|
11145
|
+
value: uniq$1([].concat(_toConsumableArray(values), [option.value]))
|
|
11154
11146
|
}
|
|
11155
11147
|
});
|
|
11156
11148
|
}, [dispatch, values]);
|
|
@@ -11351,7 +11343,7 @@ var DefinitionList = function DefinitionList(_ref) {
|
|
|
11351
11343
|
}, rest), /*#__PURE__*/React__default.createElement("dt", null, term), /*#__PURE__*/React__default.createElement("dd", null, children));
|
|
11352
11344
|
};
|
|
11353
11345
|
|
|
11354
|
-
var _excluded$f = ["name", "children", "className", "virtual", "icon", "data-testid", "defaultExpanded", "expanded", "onToggle"];
|
|
11346
|
+
var _excluded$f = ["name", "children", "className", "virtual", "icon", "data-testid", "defaultExpanded", "expanded", "onToggle", "background", "border"];
|
|
11355
11347
|
var Expandable = function Expandable(_ref) {
|
|
11356
11348
|
var name = _ref.name,
|
|
11357
11349
|
children = _ref.children,
|
|
@@ -11365,6 +11357,10 @@ var Expandable = function Expandable(_ref) {
|
|
|
11365
11357
|
defaultExpanded = _ref$defaultExpanded === void 0 ? false : _ref$defaultExpanded,
|
|
11366
11358
|
__expanded__ = _ref.expanded,
|
|
11367
11359
|
onToggle = _ref.onToggle,
|
|
11360
|
+
_ref$background = _ref.background,
|
|
11361
|
+
background = _ref$background === void 0 ? 'light' : _ref$background,
|
|
11362
|
+
_ref$border = _ref.border,
|
|
11363
|
+
border = _ref$border === void 0 ? true : _ref$border,
|
|
11368
11364
|
rest = _objectWithoutProperties(_ref, _excluded$f);
|
|
11369
11365
|
|
|
11370
11366
|
var _useState = useState(defaultExpanded),
|
|
@@ -11382,13 +11378,13 @@ var Expandable = function Expandable(_ref) {
|
|
|
11382
11378
|
onToggle === null || onToggle === void 0 ? void 0 : onToggle();
|
|
11383
11379
|
}, [onToggle]);
|
|
11384
11380
|
return /*#__PURE__*/React__default.createElement("div", _extends$1({
|
|
11385
|
-
className: classNames('Expandable', {
|
|
11386
|
-
'Expandable--expanded': expanded
|
|
11381
|
+
className: classNames('Expandable', "Expandable--".concat(background, "-background"), {
|
|
11382
|
+
'Expandable--expanded': expanded,
|
|
11383
|
+
'Expandable--with-border': border,
|
|
11384
|
+
'Expandable--plus-minus': icon === 'plus-minus'
|
|
11387
11385
|
}, className)
|
|
11388
11386
|
}, rest), /*#__PURE__*/React__default.createElement(Clickable, {
|
|
11389
|
-
className:
|
|
11390
|
-
'Expandable__name--plusMinus': icon === 'plus-minus'
|
|
11391
|
-
}),
|
|
11387
|
+
className: "Expandable__name",
|
|
11392
11388
|
onClick: handleClick,
|
|
11393
11389
|
"data-testid": dataTestId
|
|
11394
11390
|
}, name, icon !== 'plus-minus' && /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -11911,23 +11907,23 @@ var whenCurrentPageIsGreaterThanHalfTheTotal = function whenCurrentPageIsGreater
|
|
|
11911
11907
|
};
|
|
11912
11908
|
|
|
11913
11909
|
var showAllPages = function showAllPages(_, totalPages) {
|
|
11914
|
-
return range(1, totalPages + 1);
|
|
11910
|
+
return range$1(1, totalPages + 1);
|
|
11915
11911
|
};
|
|
11916
11912
|
|
|
11917
11913
|
var showFirstNPagesAndLastPage = function showFirstNPagesAndLastPage(_, totalPages, maxPages) {
|
|
11918
|
-
return [].concat(_toConsumableArray(range(1, maxPages)), [totalPages]);
|
|
11914
|
+
return [].concat(_toConsumableArray(range$1(1, maxPages)), [totalPages]);
|
|
11919
11915
|
};
|
|
11920
11916
|
|
|
11921
11917
|
var showTheLastNPages = function showTheLastNPages(_, totalPages, maxPages) {
|
|
11922
|
-
return [1].concat(_toConsumableArray(range(totalPages - maxPages + 2, totalPages + 1)));
|
|
11918
|
+
return [1].concat(_toConsumableArray(range$1(totalPages - maxPages + 2, totalPages + 1)));
|
|
11923
11919
|
};
|
|
11924
11920
|
|
|
11925
11921
|
var showAGroupOfPagesCenteredOnTheCurrentPage = function showAGroupOfPagesCenteredOnTheCurrentPage(page, totalPages, maxPages) {
|
|
11926
11922
|
var diff = Math.floor((maxPages - 2) / 2);
|
|
11927
|
-
return [1].concat(_toConsumableArray(range(page - diff, page + diff + 1)), [totalPages]);
|
|
11923
|
+
return [1].concat(_toConsumableArray(range$1(page - diff, page + diff + 1)), [totalPages]);
|
|
11928
11924
|
};
|
|
11929
11925
|
|
|
11930
|
-
var determinePagesToShow = cond([[whenThereAreFewerPagesThanWeDisplay, showAllPages], [whenCurrentPageIsLessThanHalfTheTotal, showFirstNPagesAndLastPage], [whenCurrentPageIsGreaterThanHalfTheTotal, showTheLastNPages], [
|
|
11926
|
+
var determinePagesToShow = cond$1([[whenThereAreFewerPagesThanWeDisplay, showAllPages], [whenCurrentPageIsLessThanHalfTheTotal, showFirstNPagesAndLastPage], [whenCurrentPageIsGreaterThanHalfTheTotal, showTheLastNPages], [otherwise, showAGroupOfPagesCenteredOnTheCurrentPage]]);
|
|
11931
11927
|
var Paginator = function Paginator(_ref) {
|
|
11932
11928
|
var selectedPage = _ref.selectedPage,
|
|
11933
11929
|
totalPages = _ref.totalPages,
|