@7shifts/sous-chef 1.3.0 → 1.3.1
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 +2 -2
- package/dist/actions/PaginationControls/PaginationControls.d.ts +1 -1
- package/dist/core/index.d.ts +6 -1
- package/dist/icons/IconUser.flow +17 -0
- package/dist/index.css +215 -47
- package/dist/index.js +662 -309
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +659 -310
- package/dist/index.modern.js.map +1 -1
- package/dist/media/Avatar/AvatarImage/AvatarImage.d.ts +1 -0
- package/dist/nophoto~DrLDqLZE.png +0 -0
- package/dist/profile/LetterProfile/LetterProfile.d.ts +9 -0
- package/dist/profile/LetterProfile/index.d.ts +1 -0
- package/dist/profile/index.d.ts +2 -0
- package/dist/utils/string.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1181,6 +1181,10 @@ var getLocalTranslation = function getLocalTranslation(key) {
|
|
|
1181
1181
|
return key;
|
|
1182
1182
|
};
|
|
1183
1183
|
|
|
1184
|
+
var capitalizeFirstLetter = function capitalizeFirstLetter(text) {
|
|
1185
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1184
1188
|
var PaginationControls = function PaginationControls(_ref) {
|
|
1185
1189
|
var _ref$hasPrevious = _ref.hasPrevious,
|
|
1186
1190
|
hasPrevious = _ref$hasPrevious === void 0 ? true : _ref$hasPrevious,
|
|
@@ -1193,13 +1197,13 @@ var PaginationControls = function PaginationControls(_ref) {
|
|
|
1193
1197
|
}, React__default.createElement(Button$1, {
|
|
1194
1198
|
disabled: !hasPrevious,
|
|
1195
1199
|
onClick: onPreviousClick,
|
|
1196
|
-
title: getLocalizedString('default.PREVIOUS')
|
|
1200
|
+
title: capitalizeFirstLetter(getLocalizedString('default.PREVIOUS'))
|
|
1197
1201
|
}, React__default.createElement(IconArrowLeft, {
|
|
1198
1202
|
size: "small"
|
|
1199
1203
|
})), React__default.createElement(Button$1, {
|
|
1200
1204
|
disabled: !hasNext,
|
|
1201
1205
|
onClick: onNextClick,
|
|
1202
|
-
title: getLocalizedString('default.next')
|
|
1206
|
+
title: capitalizeFirstLetter(getLocalizedString('default.next'))
|
|
1203
1207
|
}, React__default.createElement(IconArrowRight, {
|
|
1204
1208
|
size: "small"
|
|
1205
1209
|
})));
|
|
@@ -1285,13 +1289,584 @@ var DefaultItemComponent = function DefaultItemComponent(_ref2) {
|
|
|
1285
1289
|
}));
|
|
1286
1290
|
};
|
|
1287
1291
|
|
|
1288
|
-
var
|
|
1289
|
-
|
|
1292
|
+
var initialValue$1 = {
|
|
1293
|
+
columns: [],
|
|
1294
|
+
numberOfRows: 0
|
|
1295
|
+
};
|
|
1296
|
+
var Context$1 = React.createContext(initialValue$1);
|
|
1297
|
+
var useDataTableContext = function useDataTableContext() {
|
|
1290
1298
|
var context = React.useContext(Context$1);
|
|
1299
|
+
|
|
1300
|
+
if (!context) {
|
|
1301
|
+
throw Error('useDataTableContext should be used withing `DataTable`. Probably you are using `DataTableRow` without a `DataTable` component');
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
return context;
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1307
|
+
var styles$a = {"item":"_1d8Ci","clickable":"_thFcO","selected":"_3tb7U","item-column":"_OTcMc","item-column--default-padding":"_lNHQ8","item-column--right-align":"_13YLe","item-column--vertical-border":"_1rrRr","actions":"_azbIG"};
|
|
1308
|
+
|
|
1309
|
+
var DataTableRow = function DataTableRow(_ref) {
|
|
1310
|
+
var _classnames;
|
|
1311
|
+
|
|
1312
|
+
var children = _ref.children,
|
|
1313
|
+
onClick = _ref.onClick,
|
|
1314
|
+
_ref$isSelected = _ref.isSelected,
|
|
1315
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
1316
|
+
_ref$actions = _ref.actions,
|
|
1317
|
+
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
1318
|
+
_ref$hasDefaultPaddin = _ref.hasDefaultPadding,
|
|
1319
|
+
hasDefaultPadding = _ref$hasDefaultPaddin === void 0 ? true : _ref$hasDefaultPaddin;
|
|
1320
|
+
|
|
1321
|
+
var _useDataTableContext = useDataTableContext(),
|
|
1322
|
+
columns = _useDataTableContext.columns,
|
|
1323
|
+
showActionMenu = _useDataTableContext.showActionMenu,
|
|
1324
|
+
hasVerticalBorders = _useDataTableContext.hasVerticalBorders;
|
|
1325
|
+
|
|
1326
|
+
var styleNames = classnames(styles$a['item'], (_classnames = {}, _classnames[styles$a['clickable']] = onClick, _classnames[styles$a['selected']] = isSelected, _classnames));
|
|
1327
|
+
|
|
1328
|
+
var renderColumn = function renderColumn(columnElement, index) {
|
|
1329
|
+
var _classnames2;
|
|
1330
|
+
|
|
1331
|
+
var column = columns === null || columns === void 0 ? void 0 : columns[index];
|
|
1332
|
+
var isRightAligned = column === null || column === void 0 ? void 0 : column.isRightAligned;
|
|
1333
|
+
return React__default.createElement("div", {
|
|
1334
|
+
className: classnames((_classnames2 = {}, _classnames2[styles$a['item-column--right-align']] = isRightAligned, _classnames2[styles$a['item-column--vertical-border']] = hasVerticalBorders, _classnames2[styles$a['item-column--default-padding']] = hasDefaultPadding, _classnames2), styles$a['item-column']),
|
|
1335
|
+
style: {
|
|
1336
|
+
flex: (column === null || column === void 0 ? void 0 : column.size) || 1
|
|
1337
|
+
},
|
|
1338
|
+
key: index,
|
|
1339
|
+
"data-testid": "data-table-column"
|
|
1340
|
+
}, columnElement);
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
return React__default.createElement("div", {
|
|
1344
|
+
className: styleNames,
|
|
1345
|
+
onClick: onClick ? onClick : undefined,
|
|
1346
|
+
onKeyPress: onClick ? onClick : undefined,
|
|
1347
|
+
"data-testid": "data-table-row",
|
|
1348
|
+
role: "row"
|
|
1349
|
+
}, React__default.Children.map(children, function (child, index) {
|
|
1350
|
+
return renderColumn(child, index);
|
|
1351
|
+
}), showActionMenu && React__default.createElement("div", {
|
|
1352
|
+
className: classnames(styles$a['item-column'], styles$a['actions']),
|
|
1353
|
+
"data-testid": "data-table-dropdown-menu"
|
|
1354
|
+
}, actions.length > 0 && React__default.createElement(Menu, null, React__default.createElement(MenuButton, null, React__default.createElement(IconMore, null)), React__default.createElement(MenuList, null, actions.map(function (action, index) {
|
|
1355
|
+
return React__default.createElement(MenuItem, {
|
|
1356
|
+
onClick: action.onAction,
|
|
1357
|
+
key: index
|
|
1358
|
+
}, action.label);
|
|
1359
|
+
})))));
|
|
1360
|
+
};
|
|
1361
|
+
|
|
1362
|
+
var styles$b = {"header":"_of22N","header-item":"_27x4v","header-item--sortable":"_3gw3Z","header-item--right-align":"_Fjm2n","header-item--action":"_LoIvx","header-sort-icon":"_3VjFP","body":"_1bTmd","footer":"_1opWx","pagination-controls":"_F_spz"};
|
|
1363
|
+
|
|
1364
|
+
var SORT_ORDER$1 = {
|
|
1365
|
+
ASC: 'asc',
|
|
1366
|
+
DESC: 'desc'
|
|
1367
|
+
};
|
|
1368
|
+
|
|
1369
|
+
var DataTableHeader = function DataTableHeader(_ref) {
|
|
1370
|
+
var columns = _ref.columns,
|
|
1371
|
+
onSort = _ref.onSort,
|
|
1372
|
+
showActionMenu = _ref.showActionMenu;
|
|
1373
|
+
var haveLabels = columns.find(function (column) {
|
|
1374
|
+
return column.label && column.label !== '';
|
|
1375
|
+
});
|
|
1376
|
+
|
|
1377
|
+
if (!haveLabels) {
|
|
1378
|
+
return null;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
var handleSort = function handleSort(column) {
|
|
1382
|
+
var nextDirection = getNextSort$1(column);
|
|
1383
|
+
|
|
1384
|
+
if (onSort) {
|
|
1385
|
+
onSort({
|
|
1386
|
+
columnName: column.name,
|
|
1387
|
+
direction: nextDirection
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1392
|
+
return React__default.createElement("div", {
|
|
1393
|
+
className: styles$b['header']
|
|
1394
|
+
}, columns.map(function (column) {
|
|
1395
|
+
var _classnames;
|
|
1396
|
+
|
|
1397
|
+
var isSortable = column.isSortable;
|
|
1398
|
+
var sortDir = column.currentSort;
|
|
1399
|
+
var isRightAligned = column.isRightAligned;
|
|
1400
|
+
return React__default.createElement("div", {
|
|
1401
|
+
className: classnames((_classnames = {}, _classnames[styles$b['header-item']] = true, _classnames[styles$b['header-item--sortable']] = isSortable, _classnames[styles$b['header-item--right-align']] = isRightAligned, _classnames)),
|
|
1402
|
+
style: {
|
|
1403
|
+
flex: column.size || 1
|
|
1404
|
+
},
|
|
1405
|
+
key: column.name,
|
|
1406
|
+
onClick: function onClick() {
|
|
1407
|
+
return isSortable && handleSort(column);
|
|
1408
|
+
},
|
|
1409
|
+
onKeyPress: function onKeyPress() {
|
|
1410
|
+
return isSortable && handleSort(column);
|
|
1411
|
+
},
|
|
1412
|
+
role: "columnheader",
|
|
1413
|
+
tabIndex: 0
|
|
1414
|
+
}, column.label, ' ', isSortable && React__default.createElement("span", {
|
|
1415
|
+
className: styles$b['header-sort-icon']
|
|
1416
|
+
}, React__default.createElement(IconSort$1, {
|
|
1417
|
+
sortDirection: sortDir
|
|
1418
|
+
})));
|
|
1419
|
+
}), showActionMenu && React__default.createElement("div", {
|
|
1420
|
+
className: classnames(styles$b['header-item'], styles$b['header-item--action'])
|
|
1421
|
+
}));
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1424
|
+
var getNextSort$1 = function getNextSort(column) {
|
|
1425
|
+
switch (column.currentSort) {
|
|
1426
|
+
case SORT_ORDER$1.ASC:
|
|
1427
|
+
return null;
|
|
1428
|
+
|
|
1429
|
+
case SORT_ORDER$1.DESC:
|
|
1430
|
+
return SORT_ORDER$1.ASC;
|
|
1431
|
+
|
|
1432
|
+
default:
|
|
1433
|
+
return SORT_ORDER$1.DESC;
|
|
1434
|
+
}
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
var IconSort$1 = function IconSort(_ref2) {
|
|
1438
|
+
var sortDirection = _ref2.sortDirection;
|
|
1439
|
+
var sortDir = sortDirection || null;
|
|
1440
|
+
return React__default.createElement("div", {
|
|
1441
|
+
style: {
|
|
1442
|
+
display: 'inline-flex',
|
|
1443
|
+
flexDirection: 'column'
|
|
1444
|
+
}
|
|
1445
|
+
}, sortDir !== 'desc' && React__default.createElement(IconChevronUp, {
|
|
1446
|
+
size: "small"
|
|
1447
|
+
}), sortDir !== 'asc' && React__default.createElement("span", {
|
|
1448
|
+
style: {
|
|
1449
|
+
marginTop: '-4px'
|
|
1450
|
+
}
|
|
1451
|
+
}, React__default.createElement(IconChevronDown, {
|
|
1452
|
+
size: "small"
|
|
1453
|
+
})));
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
var DataTable = function DataTable(_ref) {
|
|
1457
|
+
var items = _ref.items,
|
|
1458
|
+
columns = _ref.columns,
|
|
1459
|
+
itemComponent = _ref.itemComponent,
|
|
1460
|
+
maxHeight = _ref.maxHeight,
|
|
1461
|
+
_ref$hasPrevious = _ref.hasPrevious,
|
|
1462
|
+
hasPrevious = _ref$hasPrevious === void 0 ? true : _ref$hasPrevious,
|
|
1463
|
+
_ref$hasNext = _ref.hasNext,
|
|
1464
|
+
hasNext = _ref$hasNext === void 0 ? true : _ref$hasNext,
|
|
1465
|
+
onPreviousClick = _ref.onPreviousClick,
|
|
1466
|
+
onNextClick = _ref.onNextClick,
|
|
1467
|
+
onSort = _ref.onSort,
|
|
1468
|
+
_ref$isLoading = _ref.isLoading,
|
|
1469
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
1470
|
+
_ref$showActionMenu = _ref.showActionMenu,
|
|
1471
|
+
showActionMenu = _ref$showActionMenu === void 0 ? false : _ref$showActionMenu,
|
|
1472
|
+
footerComponent = _ref.footerComponent,
|
|
1473
|
+
_ref$hasVerticalBorde = _ref.hasVerticalBorders,
|
|
1474
|
+
hasVerticalBorders = _ref$hasVerticalBorde === void 0 ? false : _ref$hasVerticalBorde;
|
|
1475
|
+
var RowItem = itemComponent || DefaultItemComponent$1;
|
|
1476
|
+
var conditionalStyles = {};
|
|
1477
|
+
|
|
1478
|
+
if (maxHeight !== null) {
|
|
1479
|
+
conditionalStyles = _extends({}, conditionalStyles, {
|
|
1480
|
+
maxHeight: maxHeight,
|
|
1481
|
+
overflowY: 'auto'
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
var numberOfRows = items.length + (footerComponent ? 1 : 0);
|
|
1486
|
+
return React__default.createElement(Context$1.Provider, {
|
|
1487
|
+
value: {
|
|
1488
|
+
columns: columns,
|
|
1489
|
+
showActionMenu: showActionMenu,
|
|
1490
|
+
numberOfRows: numberOfRows,
|
|
1491
|
+
hasVerticalBorders: hasVerticalBorders
|
|
1492
|
+
}
|
|
1493
|
+
}, React__default.createElement("div", null, React__default.createElement(DataTableHeader, {
|
|
1494
|
+
columns: columns,
|
|
1495
|
+
onSort: onSort,
|
|
1496
|
+
showActionMenu: showActionMenu
|
|
1497
|
+
}), React__default.createElement("div", {
|
|
1498
|
+
className: styles$b['body'],
|
|
1499
|
+
style: conditionalStyles,
|
|
1500
|
+
role: "table"
|
|
1501
|
+
}, isLoading && React__default.createElement(Spinner, {
|
|
1502
|
+
block: true
|
|
1503
|
+
}), !isLoading && items.map(function (item, index) {
|
|
1504
|
+
return React__default.createElement(RowItem, {
|
|
1505
|
+
item: item,
|
|
1506
|
+
columns: columns,
|
|
1507
|
+
key: index,
|
|
1508
|
+
index: index
|
|
1509
|
+
});
|
|
1510
|
+
}), footerComponent && !isLoading && React__default.createElement("div", {
|
|
1511
|
+
className: styles$b['footer'],
|
|
1512
|
+
"data-testid": "footer"
|
|
1513
|
+
}, footerComponent)), onPreviousClick && onNextClick && (hasPrevious || hasNext) && React__default.createElement("div", {
|
|
1514
|
+
className: styles$b['pagination-controls'],
|
|
1515
|
+
"data-testid": "pagination-controls"
|
|
1516
|
+
}, React__default.createElement(PaginationControls, {
|
|
1517
|
+
hasPrevious: hasPrevious && !isLoading,
|
|
1518
|
+
hasNext: hasNext && !isLoading,
|
|
1519
|
+
onPreviousClick: onPreviousClick,
|
|
1520
|
+
onNextClick: onNextClick
|
|
1521
|
+
}))));
|
|
1522
|
+
};
|
|
1523
|
+
|
|
1524
|
+
var DefaultItemComponent$1 = function DefaultItemComponent(_ref2) {
|
|
1525
|
+
var columns = _ref2.columns,
|
|
1526
|
+
item = _ref2.item;
|
|
1527
|
+
var headingKeys = columns ? columns.map(function (column) {
|
|
1528
|
+
return column.name;
|
|
1529
|
+
}) : Object.keys(item);
|
|
1530
|
+
var columnsToShow = headingKeys.filter(function (key) {
|
|
1531
|
+
return key !== 'actions';
|
|
1532
|
+
});
|
|
1533
|
+
return React__default.createElement(DataTableRow, {
|
|
1534
|
+
actions: item.actions
|
|
1535
|
+
}, columnsToShow.map(function (headingKey) {
|
|
1536
|
+
return React__default.createElement("div", {
|
|
1537
|
+
key: headingKey
|
|
1538
|
+
}, item[headingKey] || '');
|
|
1539
|
+
}));
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1542
|
+
var styles$c = {"data-table-cell":"_orjDM","data-table-cell--right-aligned":"_3EpfF"};
|
|
1543
|
+
|
|
1544
|
+
var DataTableCell = function DataTableCell(_ref) {
|
|
1545
|
+
var _columns$columnIndex, _classnames;
|
|
1546
|
+
|
|
1547
|
+
var children = _ref.children,
|
|
1548
|
+
columnIndex = _ref.columnIndex;
|
|
1549
|
+
|
|
1550
|
+
var _useDataTableContext = useDataTableContext(),
|
|
1551
|
+
columns = _useDataTableContext.columns;
|
|
1552
|
+
|
|
1553
|
+
var column = (_columns$columnIndex = columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
1554
|
+
var isRightAligned = column ? column.isRightAligned : false;
|
|
1555
|
+
return React__default.createElement("div", {
|
|
1556
|
+
className: classnames((_classnames = {}, _classnames[styles$c['data-table-cell--right-aligned']] = isRightAligned, _classnames), styles$c['data-table-cell'])
|
|
1557
|
+
}, children);
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
var Context$2 = React.createContext({});
|
|
1561
|
+
var useFormContext = function useFormContext() {
|
|
1562
|
+
var context = React.useContext(Context$2);
|
|
1291
1563
|
return context || {};
|
|
1292
1564
|
};
|
|
1293
1565
|
|
|
1294
|
-
var
|
|
1566
|
+
var useFieldId = function useFieldId(_ref) {
|
|
1567
|
+
var name = _ref.name,
|
|
1568
|
+
inputId = _ref.id;
|
|
1569
|
+
var id = React.useMemo(function () {
|
|
1570
|
+
return inputId ? inputId : name + "-" + Math.random();
|
|
1571
|
+
}, [inputId, name]);
|
|
1572
|
+
return id;
|
|
1573
|
+
};
|
|
1574
|
+
|
|
1575
|
+
var getFormikState = function getFormikState(name, formik) {
|
|
1576
|
+
if (formik === undefined) {
|
|
1577
|
+
return null;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
if (Object.keys(formik.values).includes(name)) {
|
|
1581
|
+
return {
|
|
1582
|
+
error: formik.touched[name] ? formik.errors[name] : undefined,
|
|
1583
|
+
value: formik.values[name]
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
var formikArray = getFormikArrayPath(name);
|
|
1588
|
+
|
|
1589
|
+
if (formikArray) {
|
|
1590
|
+
var _formik$touched, _formik$touched$array, _formik$touched$array2, _formik$errors, _formik$errors$arrayN, _formik$errors$arrayN2, _formik$values, _formik$values$arrayN, _formik$values$arrayN2;
|
|
1591
|
+
|
|
1592
|
+
var arrayName = formikArray.arrayName,
|
|
1593
|
+
itemIndex = formikArray.itemIndex,
|
|
1594
|
+
fieldName = formikArray.fieldName;
|
|
1595
|
+
return {
|
|
1596
|
+
error: (_formik$touched = formik.touched) !== null && _formik$touched !== void 0 && (_formik$touched$array = _formik$touched[arrayName]) !== null && _formik$touched$array !== void 0 && (_formik$touched$array2 = _formik$touched$array[itemIndex]) !== null && _formik$touched$array2 !== void 0 && _formik$touched$array2[fieldName] ? (_formik$errors = formik.errors) === null || _formik$errors === void 0 ? void 0 : (_formik$errors$arrayN = _formik$errors[arrayName]) === null || _formik$errors$arrayN === void 0 ? void 0 : (_formik$errors$arrayN2 = _formik$errors$arrayN[itemIndex]) === null || _formik$errors$arrayN2 === void 0 ? void 0 : _formik$errors$arrayN2[fieldName] : undefined,
|
|
1597
|
+
value: (_formik$values = formik.values) === null || _formik$values === void 0 ? void 0 : (_formik$values$arrayN = _formik$values[arrayName]) === null || _formik$values$arrayN === void 0 ? void 0 : (_formik$values$arrayN2 = _formik$values$arrayN[itemIndex]) === null || _formik$values$arrayN2 === void 0 ? void 0 : _formik$values$arrayN2[fieldName]
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
return null;
|
|
1602
|
+
};
|
|
1603
|
+
|
|
1604
|
+
var getFormikArrayPath = function getFormikArrayPath(name) {
|
|
1605
|
+
if (!name.includes('[')) {
|
|
1606
|
+
return false;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
var _name$split = name.split('['),
|
|
1610
|
+
arrayName = _name$split[0],
|
|
1611
|
+
missingSplit = _name$split[1];
|
|
1612
|
+
|
|
1613
|
+
var _missingSplit$split = missingSplit.split('].'),
|
|
1614
|
+
itemIndex = _missingSplit$split[0],
|
|
1615
|
+
fieldName = _missingSplit$split[1];
|
|
1616
|
+
|
|
1617
|
+
return {
|
|
1618
|
+
arrayName: arrayName,
|
|
1619
|
+
itemIndex: itemIndex,
|
|
1620
|
+
fieldName: fieldName
|
|
1621
|
+
};
|
|
1622
|
+
};
|
|
1623
|
+
|
|
1624
|
+
var useFieldControllers = function useFieldControllers(_ref) {
|
|
1625
|
+
var name = _ref.name,
|
|
1626
|
+
inputId = _ref.id,
|
|
1627
|
+
value = _ref.value,
|
|
1628
|
+
_onChange = _ref.onChange,
|
|
1629
|
+
_onBlur = _ref.onBlur,
|
|
1630
|
+
error = _ref.error,
|
|
1631
|
+
_ref$type = _ref.type,
|
|
1632
|
+
type = _ref$type === void 0 ? 'text' : _ref$type;
|
|
1633
|
+
|
|
1634
|
+
var _useFormContext = useFormContext(),
|
|
1635
|
+
formik = _useFormContext.formik;
|
|
1636
|
+
|
|
1637
|
+
var id = useFieldId({
|
|
1638
|
+
name: name,
|
|
1639
|
+
id: inputId
|
|
1640
|
+
});
|
|
1641
|
+
var controllers = {
|
|
1642
|
+
id: id,
|
|
1643
|
+
error: error,
|
|
1644
|
+
value: value,
|
|
1645
|
+
onChange: function onChange(e) {
|
|
1646
|
+
return _onChange && _onChange(e.target.value);
|
|
1647
|
+
},
|
|
1648
|
+
onBlur: function onBlur(e) {
|
|
1649
|
+
return _onBlur && _onBlur(e.target.value);
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
var formikState = getFormikState(name, formik);
|
|
1653
|
+
|
|
1654
|
+
if (formik && formikState) {
|
|
1655
|
+
var currencyBlur = function currencyBlur() {
|
|
1656
|
+
if (type === 'currency') {
|
|
1657
|
+
formik.setFieldValue(name, Number(value).toFixed(2));
|
|
1658
|
+
}
|
|
1659
|
+
};
|
|
1660
|
+
|
|
1661
|
+
controllers = _extends({}, controllers, {
|
|
1662
|
+
error: error !== undefined ? controllers.error : formikState.error,
|
|
1663
|
+
value: value !== undefined ? controllers.value : formikState.value,
|
|
1664
|
+
onChange: _onChange ? controllers.onChange : function (e) {
|
|
1665
|
+
return formik.setFieldValue(name, e.target.value);
|
|
1666
|
+
},
|
|
1667
|
+
onBlur: _onBlur ? function (e) {
|
|
1668
|
+
controllers.onBlur(e);
|
|
1669
|
+
currencyBlur();
|
|
1670
|
+
} : function () {
|
|
1671
|
+
formik.setFieldTouched(name);
|
|
1672
|
+
currencyBlur();
|
|
1673
|
+
}
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
return controllers;
|
|
1678
|
+
};
|
|
1679
|
+
|
|
1680
|
+
var styles$d = {"label":"_h724f"};
|
|
1681
|
+
|
|
1682
|
+
var Label = function Label(_ref) {
|
|
1683
|
+
var htmlFor = _ref.htmlFor,
|
|
1684
|
+
children = _ref.children;
|
|
1685
|
+
return React__default.createElement("label", {
|
|
1686
|
+
htmlFor: htmlFor,
|
|
1687
|
+
className: styles$d['label']
|
|
1688
|
+
}, children);
|
|
1689
|
+
};
|
|
1690
|
+
|
|
1691
|
+
var styles$e = {"caption":"_1DWBq"};
|
|
1692
|
+
|
|
1693
|
+
var Caption = function Caption(_ref) {
|
|
1694
|
+
var fieldId = _ref.fieldId,
|
|
1695
|
+
children = _ref.children;
|
|
1696
|
+
return React__default.createElement("div", {
|
|
1697
|
+
id: fieldId && fieldId + "-describer",
|
|
1698
|
+
className: styles$e['caption']
|
|
1699
|
+
}, children);
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1702
|
+
var WHITE = '#ffffff';
|
|
1703
|
+
var EGGPLANT200 = '#d3dbf4';
|
|
1704
|
+
var EGGPLANT300 = '#a7b7ea';
|
|
1705
|
+
var EGGPLANT400 = '#6d87dd';
|
|
1706
|
+
var EGGPLANT700 = '#32295c';
|
|
1707
|
+
var RADISH400 = '#e76767';
|
|
1708
|
+
var GREY100 = '#f8f8f8';
|
|
1709
|
+
var GREY200 = '#e0e0e0';
|
|
1710
|
+
var GREY300 = '#c1c1c1';
|
|
1711
|
+
var GREY400 = '#929292';
|
|
1712
|
+
var GREY500 = '#555555';
|
|
1713
|
+
var GREY600 = '#464646';
|
|
1714
|
+
|
|
1715
|
+
var styles$f = {"error-message":"_nZ2MD"};
|
|
1716
|
+
|
|
1717
|
+
var ErrorMessage = function ErrorMessage(_ref) {
|
|
1718
|
+
var fieldId = _ref.fieldId,
|
|
1719
|
+
children = _ref.children;
|
|
1720
|
+
return React__default.createElement("div", {
|
|
1721
|
+
id: fieldId && fieldId + "-error-message",
|
|
1722
|
+
className: styles$f['error-message']
|
|
1723
|
+
}, React__default.createElement(Inline, {
|
|
1724
|
+
space: 8,
|
|
1725
|
+
alignItems: "center"
|
|
1726
|
+
}, React__default.createElement(IconDelete, {
|
|
1727
|
+
color: RADISH400,
|
|
1728
|
+
size: "medium"
|
|
1729
|
+
}), children));
|
|
1730
|
+
};
|
|
1731
|
+
|
|
1732
|
+
var Field = function Field(_ref) {
|
|
1733
|
+
var id = _ref.id,
|
|
1734
|
+
label = _ref.label,
|
|
1735
|
+
caption = _ref.caption,
|
|
1736
|
+
error = _ref.error,
|
|
1737
|
+
children = _ref.children;
|
|
1738
|
+
return React__default.createElement(Stack, {
|
|
1739
|
+
space: 8,
|
|
1740
|
+
flexItems: true
|
|
1741
|
+
}, label && React__default.createElement(Label, {
|
|
1742
|
+
htmlFor: id
|
|
1743
|
+
}, label), children, caption && React__default.createElement(Caption, {
|
|
1744
|
+
fieldId: id
|
|
1745
|
+
}, caption), error && React__default.createElement(ErrorMessage, {
|
|
1746
|
+
fieldId: id
|
|
1747
|
+
}, error));
|
|
1748
|
+
};
|
|
1749
|
+
|
|
1750
|
+
var styles$g = {"affix-container":"_ybKOk","affix-container--prefixed":"_2COk3","affix-container--suffixed":"_1xXXN","prefix":"_eX5OL","suffix":"__YH01"};
|
|
1751
|
+
|
|
1752
|
+
var AffixContainer = function AffixContainer(_ref) {
|
|
1753
|
+
var _classnames;
|
|
1754
|
+
|
|
1755
|
+
var prefix = _ref.prefix,
|
|
1756
|
+
suffix = _ref.suffix,
|
|
1757
|
+
children = _ref.children;
|
|
1758
|
+
var container = React.useRef(null);
|
|
1759
|
+
var prefixElement = React.useRef(null);
|
|
1760
|
+
var suffixElement = React.useRef(null);
|
|
1761
|
+
React.useLayoutEffect(function () {
|
|
1762
|
+
if (container.current) {
|
|
1763
|
+
var input = container.current.querySelector('input, [class$=control] > div');
|
|
1764
|
+
|
|
1765
|
+
if (input) {
|
|
1766
|
+
if (prefix && prefixElement.current) {
|
|
1767
|
+
var _prefixElement$curren;
|
|
1768
|
+
|
|
1769
|
+
var prefixWidth = prefixElement === null || prefixElement === void 0 ? void 0 : (_prefixElement$curren = prefixElement.current) === null || _prefixElement$curren === void 0 ? void 0 : _prefixElement$curren.offsetWidth;
|
|
1770
|
+
input.style.paddingLeft = prefixWidth + 'px';
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
if (suffix && suffixElement.current) {
|
|
1774
|
+
var suffixWidth = suffixElement.current.offsetWidth;
|
|
1775
|
+
input.style.paddingRight = suffixWidth + 'px';
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
}, [prefix, suffix]);
|
|
1780
|
+
var hasPrefix = !!prefix;
|
|
1781
|
+
var hasSuffix = !!suffix;
|
|
1782
|
+
|
|
1783
|
+
if (!hasPrefix && !hasSuffix) {
|
|
1784
|
+
return children;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
var classes = classnames(styles$g['affix-container'], (_classnames = {}, _classnames[styles$g['affix-container--prefixed']] = hasPrefix, _classnames[styles$g['affix-container--suffixed']] = hasSuffix, _classnames));
|
|
1788
|
+
return React__default.createElement("div", {
|
|
1789
|
+
className: classes,
|
|
1790
|
+
ref: container,
|
|
1791
|
+
"data-testid": "affix-container"
|
|
1792
|
+
}, hasPrefix && React__default.createElement("div", {
|
|
1793
|
+
className: styles$g['prefix'],
|
|
1794
|
+
ref: prefixElement
|
|
1795
|
+
}, prefix), children, hasSuffix && React__default.createElement("div", {
|
|
1796
|
+
className: styles$g['suffix'],
|
|
1797
|
+
ref: suffixElement
|
|
1798
|
+
}, suffix));
|
|
1799
|
+
};
|
|
1800
|
+
|
|
1801
|
+
var styles$h = {"data-table-editable-cell":"_kIngZ","data-table-editable-cell--right-aligned":"_3_QIj","data-table-editable-cell--top-left":"_32mWH","data-table-editable-cell--top-right":"_3Jg2-","data-table-editable-cell--bottom-left":"_1F5fj","data-table-editable-cell--bottom-right":"_1fTTW","data-table-editable-cell--invalid":"_y9SBQ"};
|
|
1802
|
+
|
|
1803
|
+
var DataTableEditableCell = function DataTableEditableCell(_ref) {
|
|
1804
|
+
var _columns$columnIndex, _classnames;
|
|
1805
|
+
|
|
1806
|
+
var name = _ref.name,
|
|
1807
|
+
columnIndex = _ref.columnIndex,
|
|
1808
|
+
rowIndex = _ref.rowIndex,
|
|
1809
|
+
inputId = _ref.id,
|
|
1810
|
+
value = _ref.value,
|
|
1811
|
+
onChange = _ref.onChange,
|
|
1812
|
+
onBlur = _ref.onBlur,
|
|
1813
|
+
placeholder = _ref.placeholder,
|
|
1814
|
+
disabled = _ref.disabled,
|
|
1815
|
+
error = _ref.error,
|
|
1816
|
+
prefix = _ref.prefix,
|
|
1817
|
+
suffix = _ref.suffix,
|
|
1818
|
+
defaultValue = _ref.defaultValue,
|
|
1819
|
+
_ref$type = _ref.type,
|
|
1820
|
+
type = _ref$type === void 0 ? 'text' : _ref$type;
|
|
1821
|
+
|
|
1822
|
+
var _useDataTableContext = useDataTableContext(),
|
|
1823
|
+
columns = _useDataTableContext.columns,
|
|
1824
|
+
numberOfRows = _useDataTableContext.numberOfRows;
|
|
1825
|
+
|
|
1826
|
+
var column = (_columns$columnIndex = columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
1827
|
+
var isRightAligned = column ? column.isRightAligned : false;
|
|
1828
|
+
var numberOfColumns = columns === null || columns === void 0 ? void 0 : columns.length;
|
|
1829
|
+
var isTopLeftCell = columnIndex === 0 && rowIndex === 0;
|
|
1830
|
+
var isTopRightCell = columnIndex === numberOfColumns - 1 && rowIndex === 0;
|
|
1831
|
+
var isBottomLeftCell = columnIndex === 0 && rowIndex === numberOfRows - 1;
|
|
1832
|
+
var isBottomRightCell = columnIndex === numberOfColumns - 1 && rowIndex === numberOfRows - 1;
|
|
1833
|
+
var controllers = useFieldControllers({
|
|
1834
|
+
name: name,
|
|
1835
|
+
id: inputId,
|
|
1836
|
+
value: value,
|
|
1837
|
+
onChange: onChange,
|
|
1838
|
+
onBlur: onBlur,
|
|
1839
|
+
error: error,
|
|
1840
|
+
type: type
|
|
1841
|
+
});
|
|
1842
|
+
var hasError = !!controllers.error;
|
|
1843
|
+
var fieldProps = {
|
|
1844
|
+
name: name,
|
|
1845
|
+
id: controllers.id
|
|
1846
|
+
};
|
|
1847
|
+
return React__default.createElement("div", {
|
|
1848
|
+
className: styles$h['data-table-editable-cell']
|
|
1849
|
+
}, React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement(AffixContainer, {
|
|
1850
|
+
prefix: prefix,
|
|
1851
|
+
suffix: suffix
|
|
1852
|
+
}, React__default.createElement("input", {
|
|
1853
|
+
name: name,
|
|
1854
|
+
id: controllers.id,
|
|
1855
|
+
className: classnames((_classnames = {}, _classnames[styles$h['data-table-editable-cell--right-aligned']] = isRightAligned, _classnames[styles$h['data-table-editable-cell--top-left']] = isTopLeftCell, _classnames[styles$h['data-table-editable-cell--top-right']] = isTopRightCell, _classnames[styles$h['data-table-editable-cell--bottom-left']] = isBottomLeftCell, _classnames[styles$h['data-table-editable-cell--bottom-right']] = isBottomRightCell, _classnames[styles$h['data-table-editable-cell--invalid']] = hasError, _classnames)),
|
|
1856
|
+
type: "text",
|
|
1857
|
+
"data-testid": "text-field-" + name,
|
|
1858
|
+
"aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
1859
|
+
"aria-invalid": hasError,
|
|
1860
|
+
disabled: disabled,
|
|
1861
|
+
placeholder: placeholder,
|
|
1862
|
+
defaultValue: defaultValue,
|
|
1863
|
+
value: controllers.value,
|
|
1864
|
+
onChange: controllers.onChange,
|
|
1865
|
+
onBlur: controllers.onBlur
|
|
1866
|
+
}))));
|
|
1867
|
+
};
|
|
1868
|
+
|
|
1869
|
+
var styles$i = {"form--standard-size":"_3CaV0"};
|
|
1295
1870
|
|
|
1296
1871
|
var Form = function Form(_ref) {
|
|
1297
1872
|
var _classnames;
|
|
@@ -1309,13 +1884,13 @@ var Form = function Form(_ref) {
|
|
|
1309
1884
|
onSubmit && onSubmit(e.currentTarget.elements);
|
|
1310
1885
|
};
|
|
1311
1886
|
|
|
1312
|
-
return React__default.createElement(Context$
|
|
1887
|
+
return React__default.createElement(Context$2.Provider, {
|
|
1313
1888
|
value: {
|
|
1314
1889
|
formik: formik
|
|
1315
1890
|
}
|
|
1316
1891
|
}, React__default.createElement("form", {
|
|
1317
1892
|
onSubmit: onSubmit ? handleSubmit : formik === null || formik === void 0 ? void 0 : formik.handleSubmit,
|
|
1318
|
-
className: classnames((_classnames = {}, _classnames[styles$
|
|
1893
|
+
className: classnames((_classnames = {}, _classnames[styles$i['form--standard-size']] = !wide, _classnames)),
|
|
1319
1894
|
"data-testid": "form"
|
|
1320
1895
|
}, stackContent ? React__default.createElement(Stack, null, children) : children));
|
|
1321
1896
|
};
|
|
@@ -1354,191 +1929,7 @@ var FormRow = function FormRow(_ref) {
|
|
|
1354
1929
|
}));
|
|
1355
1930
|
};
|
|
1356
1931
|
|
|
1357
|
-
var styles$
|
|
1358
|
-
|
|
1359
|
-
var Label = function Label(_ref) {
|
|
1360
|
-
var htmlFor = _ref.htmlFor,
|
|
1361
|
-
children = _ref.children;
|
|
1362
|
-
return React__default.createElement("label", {
|
|
1363
|
-
htmlFor: htmlFor,
|
|
1364
|
-
className: styles$b['label']
|
|
1365
|
-
}, children);
|
|
1366
|
-
};
|
|
1367
|
-
|
|
1368
|
-
var styles$c = {"caption":"_1DWBq"};
|
|
1369
|
-
|
|
1370
|
-
var Caption = function Caption(_ref) {
|
|
1371
|
-
var fieldId = _ref.fieldId,
|
|
1372
|
-
children = _ref.children;
|
|
1373
|
-
return React__default.createElement("div", {
|
|
1374
|
-
id: fieldId && fieldId + "-describer",
|
|
1375
|
-
className: styles$c['caption']
|
|
1376
|
-
}, children);
|
|
1377
|
-
};
|
|
1378
|
-
|
|
1379
|
-
var WHITE = '#ffffff';
|
|
1380
|
-
var EGGPLANT200 = '#d3dbf4';
|
|
1381
|
-
var EGGPLANT300 = '#a7b7ea';
|
|
1382
|
-
var EGGPLANT400 = '#6d87dd';
|
|
1383
|
-
var EGGPLANT700 = '#32295c';
|
|
1384
|
-
var RADISH400 = '#e76767';
|
|
1385
|
-
var GREY100 = '#f8f8f8';
|
|
1386
|
-
var GREY200 = '#e0e0e0';
|
|
1387
|
-
var GREY300 = '#c1c1c1';
|
|
1388
|
-
var GREY400 = '#929292';
|
|
1389
|
-
var GREY500 = '#555555';
|
|
1390
|
-
var GREY600 = '#464646';
|
|
1391
|
-
|
|
1392
|
-
var styles$d = {"error-message":"_nZ2MD"};
|
|
1393
|
-
|
|
1394
|
-
var ErrorMessage = function ErrorMessage(_ref) {
|
|
1395
|
-
var fieldId = _ref.fieldId,
|
|
1396
|
-
children = _ref.children;
|
|
1397
|
-
return React__default.createElement("div", {
|
|
1398
|
-
id: fieldId && fieldId + "-error-message",
|
|
1399
|
-
className: styles$d['error-message']
|
|
1400
|
-
}, React__default.createElement(Inline, {
|
|
1401
|
-
space: 8,
|
|
1402
|
-
alignItems: "center"
|
|
1403
|
-
}, React__default.createElement(IconDelete, {
|
|
1404
|
-
color: RADISH400,
|
|
1405
|
-
size: "medium"
|
|
1406
|
-
}), children));
|
|
1407
|
-
};
|
|
1408
|
-
|
|
1409
|
-
var Field = function Field(_ref) {
|
|
1410
|
-
var id = _ref.id,
|
|
1411
|
-
label = _ref.label,
|
|
1412
|
-
caption = _ref.caption,
|
|
1413
|
-
error = _ref.error,
|
|
1414
|
-
children = _ref.children;
|
|
1415
|
-
return React__default.createElement(Stack, {
|
|
1416
|
-
space: 8,
|
|
1417
|
-
flexItems: true
|
|
1418
|
-
}, label && React__default.createElement(Label, {
|
|
1419
|
-
htmlFor: id
|
|
1420
|
-
}, label), children, caption && React__default.createElement(Caption, {
|
|
1421
|
-
fieldId: id
|
|
1422
|
-
}, caption), error && React__default.createElement(ErrorMessage, {
|
|
1423
|
-
fieldId: id
|
|
1424
|
-
}, error));
|
|
1425
|
-
};
|
|
1426
|
-
|
|
1427
|
-
var styles$e = {"text-field":"_BkzdC","text-field--focus":"_Rop31","text-field--disabled":"_2x3Cm","text-field--invalid":"_3zOwV","text-field__toolbar":"_rQqnL"};
|
|
1428
|
-
|
|
1429
|
-
var useFieldId = function useFieldId(_ref) {
|
|
1430
|
-
var name = _ref.name,
|
|
1431
|
-
inputId = _ref.id;
|
|
1432
|
-
var id = React.useMemo(function () {
|
|
1433
|
-
return inputId ? inputId : name + "-" + Math.random();
|
|
1434
|
-
}, [inputId, name]);
|
|
1435
|
-
return id;
|
|
1436
|
-
};
|
|
1437
|
-
|
|
1438
|
-
var getFormikState = function getFormikState(name, formik) {
|
|
1439
|
-
if (formik === undefined) {
|
|
1440
|
-
return null;
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
if (Object.keys(formik.values).includes(name)) {
|
|
1444
|
-
return {
|
|
1445
|
-
error: formik.touched[name] ? formik.errors[name] : undefined,
|
|
1446
|
-
value: formik.values[name]
|
|
1447
|
-
};
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
var formikArray = getFormikArrayPath(name);
|
|
1451
|
-
|
|
1452
|
-
if (formikArray) {
|
|
1453
|
-
var _formik$touched, _formik$touched$array, _formik$touched$array2, _formik$errors, _formik$errors$arrayN, _formik$errors$arrayN2, _formik$values, _formik$values$arrayN, _formik$values$arrayN2;
|
|
1454
|
-
|
|
1455
|
-
var arrayName = formikArray.arrayName,
|
|
1456
|
-
itemIndex = formikArray.itemIndex,
|
|
1457
|
-
fieldName = formikArray.fieldName;
|
|
1458
|
-
return {
|
|
1459
|
-
error: (_formik$touched = formik.touched) !== null && _formik$touched !== void 0 && (_formik$touched$array = _formik$touched[arrayName]) !== null && _formik$touched$array !== void 0 && (_formik$touched$array2 = _formik$touched$array[itemIndex]) !== null && _formik$touched$array2 !== void 0 && _formik$touched$array2[fieldName] ? (_formik$errors = formik.errors) === null || _formik$errors === void 0 ? void 0 : (_formik$errors$arrayN = _formik$errors[arrayName]) === null || _formik$errors$arrayN === void 0 ? void 0 : (_formik$errors$arrayN2 = _formik$errors$arrayN[itemIndex]) === null || _formik$errors$arrayN2 === void 0 ? void 0 : _formik$errors$arrayN2[fieldName] : undefined,
|
|
1460
|
-
value: (_formik$values = formik.values) === null || _formik$values === void 0 ? void 0 : (_formik$values$arrayN = _formik$values[arrayName]) === null || _formik$values$arrayN === void 0 ? void 0 : (_formik$values$arrayN2 = _formik$values$arrayN[itemIndex]) === null || _formik$values$arrayN2 === void 0 ? void 0 : _formik$values$arrayN2[fieldName]
|
|
1461
|
-
};
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
return null;
|
|
1465
|
-
};
|
|
1466
|
-
|
|
1467
|
-
var getFormikArrayPath = function getFormikArrayPath(name) {
|
|
1468
|
-
if (!name.includes('[')) {
|
|
1469
|
-
return false;
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
var _name$split = name.split('['),
|
|
1473
|
-
arrayName = _name$split[0],
|
|
1474
|
-
missingSplit = _name$split[1];
|
|
1475
|
-
|
|
1476
|
-
var _missingSplit$split = missingSplit.split('].'),
|
|
1477
|
-
itemIndex = _missingSplit$split[0],
|
|
1478
|
-
fieldName = _missingSplit$split[1];
|
|
1479
|
-
|
|
1480
|
-
return {
|
|
1481
|
-
arrayName: arrayName,
|
|
1482
|
-
itemIndex: itemIndex,
|
|
1483
|
-
fieldName: fieldName
|
|
1484
|
-
};
|
|
1485
|
-
};
|
|
1486
|
-
|
|
1487
|
-
var useFieldControllers = function useFieldControllers(_ref) {
|
|
1488
|
-
var name = _ref.name,
|
|
1489
|
-
inputId = _ref.id,
|
|
1490
|
-
value = _ref.value,
|
|
1491
|
-
_onChange = _ref.onChange,
|
|
1492
|
-
_onBlur = _ref.onBlur,
|
|
1493
|
-
error = _ref.error,
|
|
1494
|
-
_ref$type = _ref.type,
|
|
1495
|
-
type = _ref$type === void 0 ? 'text' : _ref$type;
|
|
1496
|
-
|
|
1497
|
-
var _useFormContext = useFormContext(),
|
|
1498
|
-
formik = _useFormContext.formik;
|
|
1499
|
-
|
|
1500
|
-
var id = useFieldId({
|
|
1501
|
-
name: name,
|
|
1502
|
-
id: inputId
|
|
1503
|
-
});
|
|
1504
|
-
var controllers = {
|
|
1505
|
-
id: id,
|
|
1506
|
-
error: error,
|
|
1507
|
-
value: value,
|
|
1508
|
-
onChange: function onChange(e) {
|
|
1509
|
-
return _onChange && _onChange(e.target.value);
|
|
1510
|
-
},
|
|
1511
|
-
onBlur: function onBlur(e) {
|
|
1512
|
-
return _onBlur && _onBlur(e.target.value);
|
|
1513
|
-
}
|
|
1514
|
-
};
|
|
1515
|
-
var formikState = getFormikState(name, formik);
|
|
1516
|
-
|
|
1517
|
-
if (formik && formikState) {
|
|
1518
|
-
var currencyBlur = function currencyBlur() {
|
|
1519
|
-
if (type === 'currency') {
|
|
1520
|
-
formik.setFieldValue(name, Number(value).toFixed(2));
|
|
1521
|
-
}
|
|
1522
|
-
};
|
|
1523
|
-
|
|
1524
|
-
controllers = _extends({}, controllers, {
|
|
1525
|
-
error: error !== undefined ? controllers.error : formikState.error,
|
|
1526
|
-
value: value !== undefined ? controllers.value : formikState.value,
|
|
1527
|
-
onChange: _onChange ? controllers.onChange : function (e) {
|
|
1528
|
-
return formik.setFieldValue(name, e.target.value);
|
|
1529
|
-
},
|
|
1530
|
-
onBlur: _onBlur ? function (e) {
|
|
1531
|
-
controllers.onBlur(e);
|
|
1532
|
-
currencyBlur();
|
|
1533
|
-
} : function () {
|
|
1534
|
-
formik.setFieldTouched(name);
|
|
1535
|
-
currencyBlur();
|
|
1536
|
-
}
|
|
1537
|
-
});
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
return controllers;
|
|
1541
|
-
};
|
|
1932
|
+
var styles$j = {"text-field":"_BkzdC","text-field--focus":"_Rop31","text-field--disabled":"_2x3Cm","text-field--invalid":"_3zOwV","text-field__toolbar":"_rQqnL"};
|
|
1542
1933
|
|
|
1543
1934
|
var useGrowTextAreaRef = function useGrowTextAreaRef(minHeight, maxHeight, autoGrow, forwardedRef) {
|
|
1544
1935
|
var textareaRef = React.useRef(null);
|
|
@@ -1613,7 +2004,7 @@ var TextAreaField = function TextAreaField(_ref) {
|
|
|
1613
2004
|
updateHeight = _useGrowTextAreaRef.updateHeight;
|
|
1614
2005
|
|
|
1615
2006
|
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
|
|
1616
|
-
className: classnames(styles$
|
|
2007
|
+
className: classnames(styles$j['text-field'], (_classnames = {}, _classnames[styles$j['text-field--invalid']] = hasError, _classnames[styles$j['text-field--disabled']] = disabled, _classnames[styles$j['text-field--focus']] = hasFocus, _classnames)),
|
|
1617
2008
|
ref: containerRef,
|
|
1618
2009
|
onClick: function onClick(event) {
|
|
1619
2010
|
if (event.target === (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current)) {
|
|
@@ -1645,7 +2036,7 @@ var TextAreaField = function TextAreaField(_ref) {
|
|
|
1645
2036
|
},
|
|
1646
2037
|
ref: textAreaRef
|
|
1647
2038
|
}), toolbar && React__default.createElement("div", {
|
|
1648
|
-
className: styles$
|
|
2039
|
+
className: styles$j['text-field__toolbar'],
|
|
1649
2040
|
id: controllers.id + "-toolbar",
|
|
1650
2041
|
ref: toolbarRef,
|
|
1651
2042
|
onClick: function onClick(event) {
|
|
@@ -1658,58 +2049,7 @@ var TextAreaField = function TextAreaField(_ref) {
|
|
|
1658
2049
|
}, toolbar)));
|
|
1659
2050
|
};
|
|
1660
2051
|
|
|
1661
|
-
var styles$
|
|
1662
|
-
|
|
1663
|
-
var AffixContainer = function AffixContainer(_ref) {
|
|
1664
|
-
var _classnames;
|
|
1665
|
-
|
|
1666
|
-
var prefix = _ref.prefix,
|
|
1667
|
-
suffix = _ref.suffix,
|
|
1668
|
-
children = _ref.children;
|
|
1669
|
-
var container = React.useRef(null);
|
|
1670
|
-
var prefixElement = React.useRef(null);
|
|
1671
|
-
var suffixElement = React.useRef(null);
|
|
1672
|
-
React.useLayoutEffect(function () {
|
|
1673
|
-
if (container.current) {
|
|
1674
|
-
var input = container.current.querySelector('input, [class$=control] > div');
|
|
1675
|
-
|
|
1676
|
-
if (input) {
|
|
1677
|
-
if (prefix && prefixElement.current) {
|
|
1678
|
-
var _prefixElement$curren;
|
|
1679
|
-
|
|
1680
|
-
var prefixWidth = prefixElement === null || prefixElement === void 0 ? void 0 : (_prefixElement$curren = prefixElement.current) === null || _prefixElement$curren === void 0 ? void 0 : _prefixElement$curren.offsetWidth;
|
|
1681
|
-
input.style.paddingLeft = prefixWidth + 'px';
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
if (suffix && suffixElement.current) {
|
|
1685
|
-
var suffixWidth = suffixElement.current.offsetWidth;
|
|
1686
|
-
input.style.paddingRight = suffixWidth + 'px';
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
}, [prefix, suffix]);
|
|
1691
|
-
var hasPrefix = !!prefix;
|
|
1692
|
-
var hasSuffix = !!suffix;
|
|
1693
|
-
|
|
1694
|
-
if (!hasPrefix && !hasSuffix) {
|
|
1695
|
-
return children;
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
var classes = classnames(styles$f['affix-container'], (_classnames = {}, _classnames[styles$f['affix-container--prefixed']] = hasPrefix, _classnames[styles$f['affix-container--suffixed']] = hasSuffix, _classnames));
|
|
1699
|
-
return React__default.createElement("div", {
|
|
1700
|
-
className: classes,
|
|
1701
|
-
ref: container,
|
|
1702
|
-
"data-testid": "affix-container"
|
|
1703
|
-
}, hasPrefix && React__default.createElement("div", {
|
|
1704
|
-
className: styles$f['prefix'],
|
|
1705
|
-
ref: prefixElement
|
|
1706
|
-
}, prefix), children, hasSuffix && React__default.createElement("div", {
|
|
1707
|
-
className: styles$f['suffix'],
|
|
1708
|
-
ref: suffixElement
|
|
1709
|
-
}, suffix));
|
|
1710
|
-
};
|
|
1711
|
-
|
|
1712
|
-
var styles$g = {"text-field":"_20YOA","text-field--invalid":"_3kUSh","text-field--prefixed":"_3IU3Q","text-field--suffixed":"_QXJOD"};
|
|
2052
|
+
var styles$k = {"text-field":"_20YOA","text-field--invalid":"_3kUSh","text-field--prefixed":"_3IU3Q","text-field--suffixed":"_QXJOD"};
|
|
1713
2053
|
|
|
1714
2054
|
var TextField = function TextField(_ref, ref) {
|
|
1715
2055
|
var _classnames;
|
|
@@ -1750,7 +2090,7 @@ var TextField = function TextField(_ref, ref) {
|
|
|
1750
2090
|
}, React__default.createElement("input", {
|
|
1751
2091
|
name: name,
|
|
1752
2092
|
id: controllers.id,
|
|
1753
|
-
className: classnames(styles$
|
|
2093
|
+
className: classnames(styles$k['text-field'], (_classnames = {}, _classnames[styles$k['text-field--invalid']] = hasError, _classnames)),
|
|
1754
2094
|
type: "text",
|
|
1755
2095
|
"data-testid": "text-field-" + name,
|
|
1756
2096
|
"aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
@@ -1815,7 +2155,7 @@ var useCheckBoxFieldControllers = function useCheckBoxFieldControllers(_ref) {
|
|
|
1815
2155
|
return controllers;
|
|
1816
2156
|
};
|
|
1817
2157
|
|
|
1818
|
-
var styles$
|
|
2158
|
+
var styles$l = {"check-box-field":"_2sg0c","check-box-field__caption":"_2LdrP","check-box-field__custom-input":"_2mA8e"};
|
|
1819
2159
|
|
|
1820
2160
|
var CheckboxField = function CheckboxField(_ref) {
|
|
1821
2161
|
var name = _ref.name,
|
|
@@ -1842,7 +2182,7 @@ var CheckboxField = function CheckboxField(_ref) {
|
|
|
1842
2182
|
space: 8,
|
|
1843
2183
|
alignItems: "center"
|
|
1844
2184
|
}, React__default.createElement("div", {
|
|
1845
|
-
className: styles$
|
|
2185
|
+
className: styles$l['check-box-field']
|
|
1846
2186
|
}, React__default.createElement("input", {
|
|
1847
2187
|
name: name,
|
|
1848
2188
|
id: controllers.id,
|
|
@@ -1855,11 +2195,11 @@ var CheckboxField = function CheckboxField(_ref) {
|
|
|
1855
2195
|
onChange: controllers.onChange,
|
|
1856
2196
|
onBlur: controllers.onBlur
|
|
1857
2197
|
}), React__default.createElement("span", {
|
|
1858
|
-
className: styles$
|
|
2198
|
+
className: styles$l['check-box-field__custom-input']
|
|
1859
2199
|
})), label && React__default.createElement(Label, {
|
|
1860
2200
|
htmlFor: controllers.id
|
|
1861
2201
|
}, label)), caption && React__default.createElement("div", {
|
|
1862
|
-
className: styles$
|
|
2202
|
+
className: styles$l['check-box-field__caption']
|
|
1863
2203
|
}, React__default.createElement(Caption, {
|
|
1864
2204
|
fieldId: controllers.id
|
|
1865
2205
|
}, caption)), controllers.error && React__default.createElement(ErrorMessage, {
|
|
@@ -1910,7 +2250,7 @@ var useRadioGroupFieldContext = function useRadioGroupFieldContext() {
|
|
|
1910
2250
|
return context;
|
|
1911
2251
|
};
|
|
1912
2252
|
|
|
1913
|
-
var styles$
|
|
2253
|
+
var styles$m = {"label":"_1WGz2","radio-group-field__label":"_RXyG_"};
|
|
1914
2254
|
|
|
1915
2255
|
var RadioGroupField = function RadioGroupField(_ref) {
|
|
1916
2256
|
var name = _ref.name,
|
|
@@ -1943,7 +2283,7 @@ var RadioGroupField = function RadioGroupField(_ref) {
|
|
|
1943
2283
|
}, React__default.createElement(Stack, {
|
|
1944
2284
|
space: 12
|
|
1945
2285
|
}, label && React__default.createElement("div", {
|
|
1946
|
-
className: styles$
|
|
2286
|
+
className: styles$m['radio-group-field__label']
|
|
1947
2287
|
}, label), React__default.createElement(Stack, {
|
|
1948
2288
|
space: 8
|
|
1949
2289
|
}, inline ? React__default.createElement(InlineOptions, null, children) : React__default.createElement(Stack, {
|
|
@@ -1977,7 +2317,7 @@ var InlineOptions = function InlineOptions(_ref2) {
|
|
|
1977
2317
|
return React__default.createElement(FormRow, null, children);
|
|
1978
2318
|
};
|
|
1979
2319
|
|
|
1980
|
-
var styles$
|
|
2320
|
+
var styles$n = {"radio-group-option":"_1Clmp","radio-group-option__caption":"_3UmWA","radio-group-option__custom-input":"_1tMq-"};
|
|
1981
2321
|
|
|
1982
2322
|
var RadioGroupOption = function RadioGroupOption(_ref) {
|
|
1983
2323
|
var value = _ref.value,
|
|
@@ -1995,7 +2335,7 @@ var RadioGroupOption = function RadioGroupOption(_ref) {
|
|
|
1995
2335
|
space: 8,
|
|
1996
2336
|
alignItems: "center"
|
|
1997
2337
|
}, React__default.createElement("div", {
|
|
1998
|
-
className: styles$
|
|
2338
|
+
className: styles$n['radio-group-option']
|
|
1999
2339
|
}, React__default.createElement("input", {
|
|
2000
2340
|
type: "radio",
|
|
2001
2341
|
id: id,
|
|
@@ -2005,19 +2345,19 @@ var RadioGroupOption = function RadioGroupOption(_ref) {
|
|
|
2005
2345
|
checked: radioGroupContext.value !== undefined ? radioGroupContext.value === value : undefined,
|
|
2006
2346
|
disabled: radioGroupContext.disabled
|
|
2007
2347
|
}), React__default.createElement("span", {
|
|
2008
|
-
className: styles$
|
|
2348
|
+
className: styles$n['radio-group-option__custom-input']
|
|
2009
2349
|
})), label && React__default.createElement(Label, {
|
|
2010
2350
|
htmlFor: id
|
|
2011
2351
|
}, label)), caption && React__default.createElement("div", {
|
|
2012
|
-
className: styles$
|
|
2352
|
+
className: styles$n['radio-group-option__caption']
|
|
2013
2353
|
}, React__default.createElement(Caption, {
|
|
2014
2354
|
fieldId: id
|
|
2015
2355
|
}, caption)));
|
|
2016
2356
|
};
|
|
2017
2357
|
|
|
2018
|
-
var styles$
|
|
2358
|
+
var styles$o = {"text-field":"_18Rzv","text-field--invalid":"_3eD7t","text-field--prefixed":"_2evrG","text-field--suffixed":"_-MgeO","password-container":"_-Rf3c","password-toggle":"_yinPY"};
|
|
2019
2359
|
|
|
2020
|
-
var styles$
|
|
2360
|
+
var styles$p = {"password-criteria":"_U0krC","password-criteria--invalid":"_2XIl4"};
|
|
2021
2361
|
|
|
2022
2362
|
var PasswordCriteria = function PasswordCriteria(_ref) {
|
|
2023
2363
|
var _classnames;
|
|
@@ -2025,7 +2365,7 @@ var PasswordCriteria = function PasswordCriteria(_ref) {
|
|
|
2025
2365
|
var met = _ref.met,
|
|
2026
2366
|
children = _ref.children;
|
|
2027
2367
|
return React__default.createElement("span", {
|
|
2028
|
-
className: classnames(styles$
|
|
2368
|
+
className: classnames(styles$p['password-criteria'], (_classnames = {}, _classnames[styles$p['password-criteria--invalid']] = !met, _classnames))
|
|
2029
2369
|
}, "\u25CF ", children);
|
|
2030
2370
|
};
|
|
2031
2371
|
|
|
@@ -2104,11 +2444,11 @@ var PasswordField = function PasswordField(_ref) {
|
|
|
2104
2444
|
error: controllers.error
|
|
2105
2445
|
};
|
|
2106
2446
|
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
|
|
2107
|
-
className: styles$
|
|
2447
|
+
className: styles$o['password-container']
|
|
2108
2448
|
}, React__default.createElement("input", {
|
|
2109
2449
|
name: name,
|
|
2110
2450
|
id: controllers.id,
|
|
2111
|
-
className: classnames(styles$
|
|
2451
|
+
className: classnames(styles$o['text-field'], (_classnames = {}, _classnames[styles$o['text-field--invalid']] = hasError, _classnames)),
|
|
2112
2452
|
type: type,
|
|
2113
2453
|
"data-testid": "text-field-" + name,
|
|
2114
2454
|
"aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
@@ -2120,7 +2460,7 @@ var PasswordField = function PasswordField(_ref) {
|
|
|
2120
2460
|
onChange: controllers.onChange,
|
|
2121
2461
|
onBlur: controllers.onBlur
|
|
2122
2462
|
}), React__default.createElement("div", {
|
|
2123
|
-
className: styles$
|
|
2463
|
+
className: styles$o['password-toggle'],
|
|
2124
2464
|
onClick: toggleType,
|
|
2125
2465
|
onKeyPress: toggleType,
|
|
2126
2466
|
"data-testid": "password-toggle",
|
|
@@ -2414,7 +2754,7 @@ var useSelectFieldControllers = function useSelectFieldControllers(_ref) {
|
|
|
2414
2754
|
return controllers;
|
|
2415
2755
|
};
|
|
2416
2756
|
|
|
2417
|
-
var styles$
|
|
2757
|
+
var styles$q = {"custom-control":"_1cDCR"};
|
|
2418
2758
|
|
|
2419
2759
|
var _excluded$3 = ["children", "CustomPrefixComponent"];
|
|
2420
2760
|
|
|
@@ -2427,7 +2767,7 @@ function CustomControl(_ref) {
|
|
|
2427
2767
|
|
|
2428
2768
|
var selectedOption = (_props$getValue = props.getValue()) === null || _props$getValue === void 0 ? void 0 : _props$getValue[0];
|
|
2429
2769
|
return React__default.createElement(Select.components.Control, Object.assign({}, props), CustomControl && selectedOption ? React__default.createElement("div", {
|
|
2430
|
-
className: styles$
|
|
2770
|
+
className: styles$q['custom-control'],
|
|
2431
2771
|
style: {
|
|
2432
2772
|
paddingLeft: selectedOption ? 8 : 0
|
|
2433
2773
|
}
|
|
@@ -2583,7 +2923,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref) {
|
|
|
2583
2923
|
|
|
2584
2924
|
var inputStyles = {"text-field":"_1btTx","date-field":"_1Sc9D","text-field--invalid":"_2feYp","date-field--invalid":"_2SNat","text-field--prefixed":"_E18JV","date-field--prefixed":"_jLolW","text-field--suffixed":"_27J43","date-field--suffixed":"_3eTNi"};
|
|
2585
2925
|
|
|
2586
|
-
var styles$
|
|
2926
|
+
var styles$r = {"container":"_v1b-5","wrapper":"_3mrLu","interactionDisabled":"_1J9dh","DayPicker-Day":"_8FcQE","navBar":"_1SPuq","todayButton":"_24FJ6","navButtonInteractionDisabled":"_Oxdm9","navButtonPrev":"_20uqc","navButtonNext":"_3C53z","months":"_M_eHz","month":"_3RPpJ","caption":"_1FXNw","weekdays":"_3KcRU","weekdaysRow":"_1fO_e","weekday":"_c1Y-X","body":"_34mA1","week":"_1PmqZ","day":"_1AWH2","disabled":"_3vJkw","selected":"_1DR0N","outside":"_276GV","footer":"_2M5xr","today":"_3N6fj","overlayWrapper":"_3Zqgu","overlay":"_20Ncd","weekNumber":"_2hb-S"};
|
|
2587
2927
|
|
|
2588
2928
|
function parseDate(str, format, locale) {
|
|
2589
2929
|
var parsed = dateFnsParse(str, format, new Date(), {
|
|
@@ -2662,7 +3002,7 @@ var DateField = function DateField(_ref) {
|
|
|
2662
3002
|
error: controllers.error
|
|
2663
3003
|
};
|
|
2664
3004
|
var dayPickerProps = {
|
|
2665
|
-
classNames: styles$
|
|
3005
|
+
classNames: styles$r,
|
|
2666
3006
|
disabledDays: function disabledDays(day) {
|
|
2667
3007
|
return _disabledDays && _disabledDays(setToMidnight(day));
|
|
2668
3008
|
},
|
|
@@ -2679,7 +3019,7 @@ var DateField = function DateField(_ref) {
|
|
|
2679
3019
|
})
|
|
2680
3020
|
}, React__default.createElement(DayPickerInput, {
|
|
2681
3021
|
format: format,
|
|
2682
|
-
classNames: styles$
|
|
3022
|
+
classNames: styles$r,
|
|
2683
3023
|
formatDate: formatDate,
|
|
2684
3024
|
parseDate: parseDate,
|
|
2685
3025
|
placeholder: placeholder || format.toUpperCase(),
|
|
@@ -2755,7 +3095,7 @@ var useRangeFieldControllers = function useRangeFieldControllers(_ref) {
|
|
|
2755
3095
|
return initialControllers;
|
|
2756
3096
|
};
|
|
2757
3097
|
|
|
2758
|
-
var styles$
|
|
3098
|
+
var styles$s = {"container":"_1Ini2","wrapper":"_21VnL","interactionDisabled":"_wJ6Cb","DayPicker-Day":"_1c48y","navBar":"_3KwsN","todayButton":"_10CBO","navButtonInteractionDisabled":"_dHL-D","navButtonPrev":"_6kNi3","navButtonNext":"_13W_e","months":"_1FeSY","month":"_wU6A4","caption":"_AMbAo","weekdays":"_1LEst","weekdaysRow":"_2XECo","weekday":"_1C5ry","body":"_11F-Y","week":"_3MAFk","day":"_mG73F","disabled":"_2pgnH","selected":"_MtLaz","outside":"_CRqyX","footer":"_2KG9-","today":"_2JA2y","overlayWrapper":"_1JWbc","overlay":"_2tL6g","weekNumber":"_3u72O","text-field":"_25rf7","date-range-field":"_3qVhi","text-field--invalid":"_2M9Ud","text-field--prefixed":"_3TUb2","text-field--suffixed":"_foqL0","date-range-field--invalid":"_3df9R"};
|
|
2759
3099
|
|
|
2760
3100
|
var FromDate = function FromDate(_ref) {
|
|
2761
3101
|
var name = _ref.name,
|
|
@@ -2775,7 +3115,7 @@ var FromDate = function FromDate(_ref) {
|
|
|
2775
3115
|
to: end
|
|
2776
3116
|
};
|
|
2777
3117
|
var dayPickerProps = {
|
|
2778
|
-
classNames: styles$
|
|
3118
|
+
classNames: styles$s,
|
|
2779
3119
|
months: MONTH_NAMES,
|
|
2780
3120
|
weekdaysLong: DAYS,
|
|
2781
3121
|
weekdaysShort: DAYS.map(function (day) {
|
|
@@ -2796,7 +3136,7 @@ var FromDate = function FromDate(_ref) {
|
|
|
2796
3136
|
};
|
|
2797
3137
|
return React__default.createElement(DayPickerInput, {
|
|
2798
3138
|
format: format,
|
|
2799
|
-
classNames: styles$
|
|
3139
|
+
classNames: styles$s,
|
|
2800
3140
|
selectedDay: start,
|
|
2801
3141
|
value: start,
|
|
2802
3142
|
formatDate: formatDate,
|
|
@@ -2837,7 +3177,7 @@ var ToDate = function ToDate(_ref, ref) {
|
|
|
2837
3177
|
to: end
|
|
2838
3178
|
};
|
|
2839
3179
|
var dayPickerProps = {
|
|
2840
|
-
classNames: styles$
|
|
3180
|
+
classNames: styles$s,
|
|
2841
3181
|
months: MONTH_NAMES,
|
|
2842
3182
|
weekdaysLong: DAYS,
|
|
2843
3183
|
weekdaysShort: DAYS.map(function (day) {
|
|
@@ -2858,7 +3198,7 @@ var ToDate = function ToDate(_ref, ref) {
|
|
|
2858
3198
|
};
|
|
2859
3199
|
return React__default.createElement(DayPickerInput, {
|
|
2860
3200
|
format: format,
|
|
2861
|
-
classNames: styles$
|
|
3201
|
+
classNames: styles$s,
|
|
2862
3202
|
selectedDay: end,
|
|
2863
3203
|
value: end,
|
|
2864
3204
|
formatDate: formatDate,
|
|
@@ -2925,7 +3265,7 @@ var DateRangeField = function DateRangeField(_ref) {
|
|
|
2925
3265
|
start = _controllers$value.start,
|
|
2926
3266
|
end = _controllers$value.end;
|
|
2927
3267
|
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
|
|
2928
|
-
className: classnames(styles$
|
|
3268
|
+
className: classnames(styles$s['date-range-field'], (_classnames = {}, _classnames[styles$s['date-range-field--invalid']] = hasError, _classnames))
|
|
2929
3269
|
}, React__default.createElement(IconCalendar, {
|
|
2930
3270
|
size: "medium"
|
|
2931
3271
|
}), React__default.createElement(FromDate, {
|
|
@@ -2970,7 +3310,7 @@ var DateRangeField = function DateRangeField(_ref) {
|
|
|
2970
3310
|
})));
|
|
2971
3311
|
};
|
|
2972
3312
|
|
|
2973
|
-
var styles$
|
|
3313
|
+
var styles$t = {"container":"_okDvi","wrapper":"_17XdD","interactionDisabled":"_1O7OT","DayPicker-Day":"_3noGA","navBar":"_1Hl3Q","todayButton":"_m0Vs9","navButtonInteractionDisabled":"_1ULWH","navButtonPrev":"_3gjq8","navButtonNext":"_1m-Kd","months":"_Fq6Xh","month":"_3i0Oo","caption":"_36X9Y","weekdays":"_1aWPn","weekdaysRow":"_3HXCK","weekday":"_t-ctd","body":"_XAbiR","week":"_3Nwep","day":"_3nNcG","disabled":"_1M4ZF","selected":"_2PEs8","outside":"_1PIJa","footer":"_2T_z1","today":"_1hVM6","overlayWrapper":"_1L-hI","overlay":"_dDPZb","weekNumber":"_1alhT"};
|
|
2974
3314
|
|
|
2975
3315
|
var WeekField = function WeekField(_ref) {
|
|
2976
3316
|
var _classnames;
|
|
@@ -3041,7 +3381,7 @@ var WeekField = function WeekField(_ref) {
|
|
|
3041
3381
|
};
|
|
3042
3382
|
|
|
3043
3383
|
var dayPickerProps = {
|
|
3044
|
-
classNames: styles$
|
|
3384
|
+
classNames: styles$t,
|
|
3045
3385
|
disabledDays: function disabledDays(day) {
|
|
3046
3386
|
return _disabledDays && _disabledDays(setToMidnight(day));
|
|
3047
3387
|
},
|
|
@@ -3071,7 +3411,7 @@ var WeekField = function WeekField(_ref) {
|
|
|
3071
3411
|
})
|
|
3072
3412
|
}, React__default.createElement(DayPickerInput, {
|
|
3073
3413
|
format: format,
|
|
3074
|
-
classNames: styles$
|
|
3414
|
+
classNames: styles$t,
|
|
3075
3415
|
formatDate: formatDate,
|
|
3076
3416
|
parseDate: parseDate,
|
|
3077
3417
|
placeholder: placeholder || format.toUpperCase(),
|
|
@@ -3100,7 +3440,7 @@ var WeekField = function WeekField(_ref) {
|
|
|
3100
3440
|
})));
|
|
3101
3441
|
};
|
|
3102
3442
|
|
|
3103
|
-
var styles$
|
|
3443
|
+
var styles$u = {"caption":"_1QDLF","label":"_2wiMV","toggle":"_1ui8X","toggle__label":"_1YRJT","toggle__caption":"_1jEiW","toggle__switch":"_3tNyE"};
|
|
3104
3444
|
|
|
3105
3445
|
var Toggle = function Toggle(_ref) {
|
|
3106
3446
|
var checked = _ref.checked,
|
|
@@ -3113,7 +3453,7 @@ var Toggle = function Toggle(_ref) {
|
|
|
3113
3453
|
return React__default.createElement(Stack, {
|
|
3114
3454
|
space: 8
|
|
3115
3455
|
}, React__default.createElement("label", {
|
|
3116
|
-
className: styles$
|
|
3456
|
+
className: styles$u['toggle']
|
|
3117
3457
|
}, React__default.createElement("input", {
|
|
3118
3458
|
"data-testid": "toggle",
|
|
3119
3459
|
type: "checkbox",
|
|
@@ -3122,17 +3462,17 @@ var Toggle = function Toggle(_ref) {
|
|
|
3122
3462
|
disabled: disabled,
|
|
3123
3463
|
id: id
|
|
3124
3464
|
}), React__default.createElement("span", {
|
|
3125
|
-
className: styles$
|
|
3465
|
+
className: styles$u['toggle__switch']
|
|
3126
3466
|
}), label && React__default.createElement("span", {
|
|
3127
|
-
className: styles$
|
|
3467
|
+
className: styles$u['toggle__label']
|
|
3128
3468
|
}, label)), caption && React__default.createElement("span", {
|
|
3129
|
-
className: styles$
|
|
3469
|
+
className: styles$u['toggle__caption']
|
|
3130
3470
|
}, caption));
|
|
3131
3471
|
};
|
|
3132
3472
|
|
|
3133
|
-
var styles$
|
|
3473
|
+
var styles$v = {"overlay":"_2puqJ","overlay--after-open":"_1167h","overlay--before-close":"_t_t7L","content":"_wQQ_2","content--after-open":"_3jwux","content--before-close":"_2c2QP"};
|
|
3134
3474
|
|
|
3135
|
-
var styles$
|
|
3475
|
+
var styles$w = {"header":"_36nxW","sub-header":"_2XwRD"};
|
|
3136
3476
|
|
|
3137
3477
|
var ModalHeader = function ModalHeader(_ref) {
|
|
3138
3478
|
var header = _ref.header,
|
|
@@ -3144,12 +3484,12 @@ var ModalHeader = function ModalHeader(_ref) {
|
|
|
3144
3484
|
flex: [1],
|
|
3145
3485
|
alignItems: "center"
|
|
3146
3486
|
}, React__default.createElement("span", {
|
|
3147
|
-
className: styles$
|
|
3487
|
+
className: styles$w['header']
|
|
3148
3488
|
}, header), React__default.createElement(Button$1, {
|
|
3149
3489
|
theme: "link-icon",
|
|
3150
3490
|
onClick: onClose
|
|
3151
3491
|
}, React__default.createElement(IconClose, null))), subHeader && React__default.createElement("div", {
|
|
3152
|
-
className: styles$
|
|
3492
|
+
className: styles$w['sub-header']
|
|
3153
3493
|
}, subHeader));
|
|
3154
3494
|
};
|
|
3155
3495
|
|
|
@@ -3185,14 +3525,14 @@ var Modal = function Modal(_ref) {
|
|
|
3185
3525
|
contentLabel: "Modal",
|
|
3186
3526
|
appElement: rootElementId && document.getElementById(rootElementId) || undefined,
|
|
3187
3527
|
overlayClassName: {
|
|
3188
|
-
base: styles$
|
|
3189
|
-
afterOpen: styles$
|
|
3190
|
-
beforeClose: styles$
|
|
3528
|
+
base: styles$v['overlay'],
|
|
3529
|
+
afterOpen: styles$v['overlay--after-open'],
|
|
3530
|
+
beforeClose: styles$v['overlay--before-close']
|
|
3191
3531
|
},
|
|
3192
3532
|
className: {
|
|
3193
|
-
base: styles$
|
|
3194
|
-
afterOpen: styles$
|
|
3195
|
-
beforeClose: styles$
|
|
3533
|
+
base: styles$v['content'],
|
|
3534
|
+
afterOpen: styles$v['content--after-open'],
|
|
3535
|
+
beforeClose: styles$v['content--before-close']
|
|
3196
3536
|
}
|
|
3197
3537
|
}, React__default.createElement(ModalHeader, {
|
|
3198
3538
|
header: header,
|
|
@@ -3205,16 +3545,16 @@ Modal.setAppElement = function (rootElement) {
|
|
|
3205
3545
|
ReactModal.setAppElement(rootElement);
|
|
3206
3546
|
};
|
|
3207
3547
|
|
|
3208
|
-
var styles$
|
|
3548
|
+
var styles$x = {"modal-body":"_2J-ku"};
|
|
3209
3549
|
|
|
3210
3550
|
var ModalBody = function ModalBody(_ref) {
|
|
3211
3551
|
var children = _ref.children;
|
|
3212
3552
|
return React__default.createElement("div", {
|
|
3213
|
-
className: styles$
|
|
3553
|
+
className: styles$x['modal-body']
|
|
3214
3554
|
}, children);
|
|
3215
3555
|
};
|
|
3216
3556
|
|
|
3217
|
-
var styles$
|
|
3557
|
+
var styles$y = {"modal-footer":"_LKOr5","tertiary-container":"_Qktd-"};
|
|
3218
3558
|
|
|
3219
3559
|
var ModalFooter = function ModalFooter(_ref) {
|
|
3220
3560
|
var children = _ref.children,
|
|
@@ -3235,7 +3575,7 @@ var ModalFooter = function ModalFooter(_ref) {
|
|
|
3235
3575
|
return React__default.createElement(FooterContainer, null, React__default.createElement(Inline, {
|
|
3236
3576
|
justifyContent: "space-between"
|
|
3237
3577
|
}, React__default.createElement("div", {
|
|
3238
|
-
className: classnames((_classnames = {}, _classnames[styles$
|
|
3578
|
+
className: classnames((_classnames = {}, _classnames[styles$y['tertiary-container']] = tertiaryButton && tertiaryButton.props.theme.startsWith('link'), _classnames))
|
|
3239
3579
|
}, tertiaryButton || React__default.createElement("div", null)), React__default.createElement(Inline, {
|
|
3240
3580
|
space: 12
|
|
3241
3581
|
}, secondaryButton, primaryButton)));
|
|
@@ -3263,7 +3603,7 @@ var FooterContainer = function FooterContainer(_ref2) {
|
|
|
3263
3603
|
var childrenItens = React__default.Children.toArray(children);
|
|
3264
3604
|
var hasCustomAlignment = childrenItens.length === 1 && childrenItens[0].type === Inline;
|
|
3265
3605
|
return React__default.createElement("div", {
|
|
3266
|
-
className: styles$
|
|
3606
|
+
className: styles$y['modal-footer']
|
|
3267
3607
|
}, React__default.createElement(Inline, {
|
|
3268
3608
|
justifyContent: "end",
|
|
3269
3609
|
space: 12,
|
|
@@ -3271,7 +3611,7 @@ var FooterContainer = function FooterContainer(_ref2) {
|
|
|
3271
3611
|
}, children));
|
|
3272
3612
|
};
|
|
3273
3613
|
|
|
3274
|
-
var styles$
|
|
3614
|
+
var styles$z = {"badge":"_2f81N","badge--warning":"_2g1GI","badge--danger":"_2zLnM","badge--success":"_27QOo","badge--info":"_2gmsM"};
|
|
3275
3615
|
|
|
3276
3616
|
var _excluded$5 = ["children", "theme", "title"];
|
|
3277
3617
|
|
|
@@ -3294,22 +3634,23 @@ var Badge = function Badge(_ref, forwardedRef) {
|
|
|
3294
3634
|
overlay: title,
|
|
3295
3635
|
ref: ref
|
|
3296
3636
|
}, React__default.createElement("div", Object.assign({
|
|
3297
|
-
className: classnames(styles$
|
|
3637
|
+
className: classnames(styles$z['badge'], (_classnames = {}, _classnames[styles$z['badge--success']] = theme === 'success', _classnames[styles$z['badge--danger']] = theme === 'danger', _classnames[styles$z['badge--info']] = theme === 'info', _classnames[styles$z['badge--warning']] = theme === 'warning', _classnames)),
|
|
3298
3638
|
ref: ref
|
|
3299
3639
|
}, otherProps), children));
|
|
3300
3640
|
};
|
|
3301
3641
|
|
|
3302
3642
|
var Badge$1 = React.forwardRef(Badge);
|
|
3303
3643
|
|
|
3304
|
-
var styles$
|
|
3644
|
+
var styles$A = {"avatar":"_2wJGB","avatar--small":"_3QTSo","avatar__badge":"_2Rl8S","avatar--medium":"_1zwj0","avatar--large":"_3-U6x","avatar--extra-large":"_3qn2q"};
|
|
3305
3645
|
|
|
3306
|
-
var styles$
|
|
3646
|
+
var styles$B = {"avatar-image":"_GKL9P"};
|
|
3307
3647
|
|
|
3308
3648
|
var AvatarImage = function AvatarImage(_ref) {
|
|
3309
3649
|
var url = _ref.url,
|
|
3310
3650
|
color = _ref.color,
|
|
3311
3651
|
_ref$alt = _ref.alt,
|
|
3312
|
-
alt = _ref$alt === void 0 ? 'Profile' : _ref$alt
|
|
3652
|
+
alt = _ref$alt === void 0 ? 'Profile' : _ref$alt,
|
|
3653
|
+
onImageFallbackError = _ref.onImageFallbackError;
|
|
3313
3654
|
|
|
3314
3655
|
var _useState = React.useState(false),
|
|
3315
3656
|
hasImageError = _useState[0],
|
|
@@ -3321,12 +3662,13 @@ var AvatarImage = function AvatarImage(_ref) {
|
|
|
3321
3662
|
alt: alt,
|
|
3322
3663
|
onError: function onError() {
|
|
3323
3664
|
setHasImageError(true);
|
|
3665
|
+
onImageFallbackError();
|
|
3324
3666
|
}
|
|
3325
3667
|
});
|
|
3326
3668
|
}
|
|
3327
3669
|
|
|
3328
3670
|
return React__default.createElement("div", {
|
|
3329
|
-
className: styles$
|
|
3671
|
+
className: styles$B['avatar-image']
|
|
3330
3672
|
}, React__default.createElement(IconUser, {
|
|
3331
3673
|
size: "flexible",
|
|
3332
3674
|
color: color
|
|
@@ -3383,23 +3725,30 @@ var Avatar = function Avatar(_ref) {
|
|
|
3383
3725
|
badge = _ref.badge,
|
|
3384
3726
|
alt = _ref.alt;
|
|
3385
3727
|
|
|
3386
|
-
var _useState = React.useState(
|
|
3728
|
+
var _useState = React.useState(false),
|
|
3729
|
+
showIconInsteadOfImage = _useState[0],
|
|
3730
|
+
setShowIconInsteadOfImage = _useState[1];
|
|
3731
|
+
|
|
3732
|
+
var _useState2 = React.useState(function () {
|
|
3387
3733
|
return PROFILE_IMAGES[Math.floor(Math.random() * PROFILE_IMAGES.length)];
|
|
3388
3734
|
}),
|
|
3389
|
-
defaultProfilePictureColors =
|
|
3735
|
+
defaultProfilePictureColors = _useState2[0];
|
|
3390
3736
|
|
|
3391
3737
|
var backgroundColor = url ? GREY200 : color;
|
|
3392
3738
|
return React__default.createElement("div", {
|
|
3393
|
-
className: classnames(styles$
|
|
3739
|
+
className: classnames(styles$A['avatar'], (_classnames = {}, _classnames[styles$A['avatar--small']] = size === 'small', _classnames[styles$A['avatar--medium']] = size === 'medium', _classnames[styles$A['avatar--large']] = size === 'large', _classnames[styles$A['avatar--extra-large']] = size === 'extra-large', _classnames)),
|
|
3394
3740
|
style: {
|
|
3395
|
-
backgroundColor: children || url ? backgroundColor : defaultProfilePictureColors.backgroundColor
|
|
3741
|
+
backgroundColor: children || url && !showIconInsteadOfImage ? backgroundColor : defaultProfilePictureColors.backgroundColor
|
|
3396
3742
|
}
|
|
3397
3743
|
}, children || React__default.createElement(AvatarImage, {
|
|
3398
3744
|
url: url,
|
|
3399
3745
|
color: defaultProfilePictureColors.avatarColor,
|
|
3400
|
-
alt: alt
|
|
3746
|
+
alt: alt,
|
|
3747
|
+
onImageFallbackError: function onImageFallbackError() {
|
|
3748
|
+
return setShowIconInsteadOfImage(true);
|
|
3749
|
+
}
|
|
3401
3750
|
}), badge && size !== 'small' && React__default.createElement("div", {
|
|
3402
|
-
className: styles$
|
|
3751
|
+
className: styles$A['avatar__badge']
|
|
3403
3752
|
}, badge));
|
|
3404
3753
|
};
|
|
3405
3754
|
|
|
@@ -3407,6 +3756,10 @@ exports.Avatar = Avatar;
|
|
|
3407
3756
|
exports.Badge = Badge$1;
|
|
3408
3757
|
exports.Button = Button$1;
|
|
3409
3758
|
exports.CheckboxField = CheckboxField;
|
|
3759
|
+
exports.DataTable = DataTable;
|
|
3760
|
+
exports.DataTableCell = DataTableCell;
|
|
3761
|
+
exports.DataTableEditableCell = DataTableEditableCell;
|
|
3762
|
+
exports.DataTableRow = DataTableRow;
|
|
3410
3763
|
exports.DateField = DateField;
|
|
3411
3764
|
exports.DateRangeField = DateRangeField;
|
|
3412
3765
|
exports.Form = Form;
|