@7shifts/sous-chef 1.2.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 +23 -1
- package/dist/actions/PaginationControls/PaginationControls.d.ts +1 -1
- package/dist/core/DataTable/DataTable.d.ts +29 -0
- package/dist/core/DataTable/DataTable.js.flow +59 -0
- package/dist/core/DataTable/DataTableCell/DataTableCell.d.ts +7 -0
- package/dist/core/DataTable/DataTableCell/index.d.ts +1 -0
- package/dist/core/DataTable/DataTableContext.d.ts +11 -0
- package/dist/core/DataTable/DataTableContext.js.flow +15 -0
- package/dist/core/DataTable/DataTableHeader.d.ts +9 -0
- package/dist/core/DataTable/index.d.ts +1 -0
- package/dist/core/DataTable/index.js.flow +8 -0
- package/dist/core/DataTable/types.d.ts +27 -0
- package/dist/core/DataTable/types.js.flow +31 -0
- package/dist/core/DataTableCell/DataTableCell.js.flow +16 -0
- package/dist/core/DataTableCell/index.js.flow +8 -0
- package/dist/core/DataTableEditableCell/DataTableEditableCell.d.ts +21 -0
- package/dist/core/DataTableEditableCell/DataTableEditableCell.js.flow +26 -0
- package/dist/core/DataTableEditableCell/index.d.ts +1 -0
- package/dist/core/DataTableEditableCell/index.js.flow +8 -0
- package/dist/core/DataTableRow/DataTableRow.d.ts +11 -0
- package/dist/core/DataTableRow/DataTableRow.js.flow +17 -0
- package/dist/core/DataTableRow/index.d.ts +1 -0
- package/dist/core/DataTableRow/index.js.flow +8 -0
- package/dist/core/ResourceTable/ResourceTable.d.ts +3 -0
- package/dist/core/ResourceTable/ResourceTableHeader.d.ts +3 -0
- package/dist/core/ResourceTableRow/ResourceTableRow.d.ts +3 -0
- package/dist/core/index.d.ts +6 -1
- package/dist/forms/hooks/useFieldControllers.d.ts +2 -1
- package/dist/index.css +223 -51
- package/dist/index.js +652 -239
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +649 -240
- package/dist/index.modern.js.map +1 -1
- package/dist/media/Avatar/AvatarImage/AvatarImage.d.ts +1 -0
- package/dist/overlay/Modal/Modal.d.ts +1 -1
- package/dist/overlay/Modal/Modal.js.flow +3 -1
- package/dist/overlay/Modal/ModalFooter/ModalFooter.js.flow +1 -1
- package/dist/utils/formik.d.ts +5 -0
- package/dist/utils/string.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1177,6 +1177,10 @@ var getLocalTranslation = function getLocalTranslation(key) {
|
|
|
1177
1177
|
return key;
|
|
1178
1178
|
};
|
|
1179
1179
|
|
|
1180
|
+
var capitalizeFirstLetter = function capitalizeFirstLetter(text) {
|
|
1181
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1180
1184
|
var PaginationControls = function PaginationControls(_ref) {
|
|
1181
1185
|
var _ref$hasPrevious = _ref.hasPrevious,
|
|
1182
1186
|
hasPrevious = _ref$hasPrevious === void 0 ? true : _ref$hasPrevious,
|
|
@@ -1189,13 +1193,13 @@ var PaginationControls = function PaginationControls(_ref) {
|
|
|
1189
1193
|
}, React__default.createElement(Button$1, {
|
|
1190
1194
|
disabled: !hasPrevious,
|
|
1191
1195
|
onClick: onPreviousClick,
|
|
1192
|
-
title: getLocalizedString('default.PREVIOUS')
|
|
1196
|
+
title: capitalizeFirstLetter(getLocalizedString('default.PREVIOUS'))
|
|
1193
1197
|
}, React__default.createElement(IconArrowLeft, {
|
|
1194
1198
|
size: "small"
|
|
1195
1199
|
})), React__default.createElement(Button$1, {
|
|
1196
1200
|
disabled: !hasNext,
|
|
1197
1201
|
onClick: onNextClick,
|
|
1198
|
-
title: getLocalizedString('default.next')
|
|
1202
|
+
title: capitalizeFirstLetter(getLocalizedString('default.next'))
|
|
1199
1203
|
}, React__default.createElement(IconArrowRight, {
|
|
1200
1204
|
size: "small"
|
|
1201
1205
|
})));
|
|
@@ -1281,94 +1285,413 @@ var DefaultItemComponent = function DefaultItemComponent(_ref2) {
|
|
|
1281
1285
|
}));
|
|
1282
1286
|
};
|
|
1283
1287
|
|
|
1284
|
-
var
|
|
1285
|
-
|
|
1288
|
+
var initialValue$1 = {
|
|
1289
|
+
columns: [],
|
|
1290
|
+
numberOfRows: 0
|
|
1291
|
+
};
|
|
1292
|
+
var Context$1 = createContext(initialValue$1);
|
|
1293
|
+
var useDataTableContext = function useDataTableContext() {
|
|
1286
1294
|
var context = useContext(Context$1);
|
|
1287
|
-
|
|
1295
|
+
|
|
1296
|
+
if (!context) {
|
|
1297
|
+
throw Error('useDataTableContext should be used withing `DataTable`. Probably you are using `DataTableRow` without a `DataTable` component');
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
return context;
|
|
1288
1301
|
};
|
|
1289
1302
|
|
|
1290
|
-
var styles$a = {"
|
|
1303
|
+
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"};
|
|
1291
1304
|
|
|
1292
|
-
var
|
|
1305
|
+
var DataTableRow = function DataTableRow(_ref) {
|
|
1293
1306
|
var _classnames;
|
|
1294
1307
|
|
|
1295
1308
|
var children = _ref.children,
|
|
1296
|
-
|
|
1297
|
-
_ref$
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
_ref$
|
|
1301
|
-
|
|
1309
|
+
onClick = _ref.onClick,
|
|
1310
|
+
_ref$isSelected = _ref.isSelected,
|
|
1311
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
1312
|
+
_ref$actions = _ref.actions,
|
|
1313
|
+
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
1314
|
+
_ref$hasDefaultPaddin = _ref.hasDefaultPadding,
|
|
1315
|
+
hasDefaultPadding = _ref$hasDefaultPaddin === void 0 ? true : _ref$hasDefaultPaddin;
|
|
1302
1316
|
|
|
1303
|
-
var
|
|
1304
|
-
|
|
1305
|
-
|
|
1317
|
+
var _useDataTableContext = useDataTableContext(),
|
|
1318
|
+
columns = _useDataTableContext.columns,
|
|
1319
|
+
showActionMenu = _useDataTableContext.showActionMenu,
|
|
1320
|
+
hasVerticalBorders = _useDataTableContext.hasVerticalBorders;
|
|
1321
|
+
|
|
1322
|
+
var styleNames = classnames(styles$a['item'], (_classnames = {}, _classnames[styles$a['clickable']] = onClick, _classnames[styles$a['selected']] = isSelected, _classnames));
|
|
1323
|
+
|
|
1324
|
+
var renderColumn = function renderColumn(columnElement, index) {
|
|
1325
|
+
var _classnames2;
|
|
1326
|
+
|
|
1327
|
+
var column = columns === null || columns === void 0 ? void 0 : columns[index];
|
|
1328
|
+
var isRightAligned = column === null || column === void 0 ? void 0 : column.isRightAligned;
|
|
1329
|
+
return React__default.createElement("div", {
|
|
1330
|
+
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']),
|
|
1331
|
+
style: {
|
|
1332
|
+
flex: (column === null || column === void 0 ? void 0 : column.size) || 1
|
|
1333
|
+
},
|
|
1334
|
+
key: index,
|
|
1335
|
+
"data-testid": "data-table-column"
|
|
1336
|
+
}, columnElement);
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
return React__default.createElement("div", {
|
|
1340
|
+
className: styleNames,
|
|
1341
|
+
onClick: onClick ? onClick : undefined,
|
|
1342
|
+
onKeyPress: onClick ? onClick : undefined,
|
|
1343
|
+
"data-testid": "data-table-row",
|
|
1344
|
+
role: "row"
|
|
1345
|
+
}, React__default.Children.map(children, function (child, index) {
|
|
1346
|
+
return renderColumn(child, index);
|
|
1347
|
+
}), showActionMenu && React__default.createElement("div", {
|
|
1348
|
+
className: classnames(styles$a['item-column'], styles$a['actions']),
|
|
1349
|
+
"data-testid": "data-table-dropdown-menu"
|
|
1350
|
+
}, 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) {
|
|
1351
|
+
return React__default.createElement(MenuItem, {
|
|
1352
|
+
onClick: action.onAction,
|
|
1353
|
+
key: index
|
|
1354
|
+
}, action.label);
|
|
1355
|
+
})))));
|
|
1356
|
+
};
|
|
1357
|
+
|
|
1358
|
+
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"};
|
|
1359
|
+
|
|
1360
|
+
var SORT_ORDER$1 = {
|
|
1361
|
+
ASC: 'asc',
|
|
1362
|
+
DESC: 'desc'
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
var DataTableHeader = function DataTableHeader(_ref) {
|
|
1366
|
+
var columns = _ref.columns,
|
|
1367
|
+
onSort = _ref.onSort,
|
|
1368
|
+
showActionMenu = _ref.showActionMenu;
|
|
1369
|
+
var haveLabels = columns.find(function (column) {
|
|
1370
|
+
return column.label && column.label !== '';
|
|
1371
|
+
});
|
|
1372
|
+
|
|
1373
|
+
if (!haveLabels) {
|
|
1374
|
+
return null;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
var handleSort = function handleSort(column) {
|
|
1378
|
+
var nextDirection = getNextSort$1(column);
|
|
1379
|
+
|
|
1380
|
+
if (onSort) {
|
|
1381
|
+
onSort({
|
|
1382
|
+
columnName: column.name,
|
|
1383
|
+
direction: nextDirection
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1306
1386
|
};
|
|
1307
1387
|
|
|
1388
|
+
return React__default.createElement("div", {
|
|
1389
|
+
className: styles$b['header']
|
|
1390
|
+
}, columns.map(function (column) {
|
|
1391
|
+
var _classnames;
|
|
1392
|
+
|
|
1393
|
+
var isSortable = column.isSortable;
|
|
1394
|
+
var sortDir = column.currentSort;
|
|
1395
|
+
var isRightAligned = column.isRightAligned;
|
|
1396
|
+
return React__default.createElement("div", {
|
|
1397
|
+
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)),
|
|
1398
|
+
style: {
|
|
1399
|
+
flex: column.size || 1
|
|
1400
|
+
},
|
|
1401
|
+
key: column.name,
|
|
1402
|
+
onClick: function onClick() {
|
|
1403
|
+
return isSortable && handleSort(column);
|
|
1404
|
+
},
|
|
1405
|
+
onKeyPress: function onKeyPress() {
|
|
1406
|
+
return isSortable && handleSort(column);
|
|
1407
|
+
},
|
|
1408
|
+
role: "columnheader",
|
|
1409
|
+
tabIndex: 0
|
|
1410
|
+
}, column.label, ' ', isSortable && React__default.createElement("span", {
|
|
1411
|
+
className: styles$b['header-sort-icon']
|
|
1412
|
+
}, React__default.createElement(IconSort$1, {
|
|
1413
|
+
sortDirection: sortDir
|
|
1414
|
+
})));
|
|
1415
|
+
}), showActionMenu && React__default.createElement("div", {
|
|
1416
|
+
className: classnames(styles$b['header-item'], styles$b['header-item--action'])
|
|
1417
|
+
}));
|
|
1418
|
+
};
|
|
1419
|
+
|
|
1420
|
+
var getNextSort$1 = function getNextSort(column) {
|
|
1421
|
+
switch (column.currentSort) {
|
|
1422
|
+
case SORT_ORDER$1.ASC:
|
|
1423
|
+
return null;
|
|
1424
|
+
|
|
1425
|
+
case SORT_ORDER$1.DESC:
|
|
1426
|
+
return SORT_ORDER$1.ASC;
|
|
1427
|
+
|
|
1428
|
+
default:
|
|
1429
|
+
return SORT_ORDER$1.DESC;
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1433
|
+
var IconSort$1 = function IconSort(_ref2) {
|
|
1434
|
+
var sortDirection = _ref2.sortDirection;
|
|
1435
|
+
var sortDir = sortDirection || null;
|
|
1436
|
+
return React__default.createElement("div", {
|
|
1437
|
+
style: {
|
|
1438
|
+
display: 'inline-flex',
|
|
1439
|
+
flexDirection: 'column'
|
|
1440
|
+
}
|
|
1441
|
+
}, sortDir !== 'desc' && React__default.createElement(IconChevronUp, {
|
|
1442
|
+
size: "small"
|
|
1443
|
+
}), sortDir !== 'asc' && React__default.createElement("span", {
|
|
1444
|
+
style: {
|
|
1445
|
+
marginTop: '-4px'
|
|
1446
|
+
}
|
|
1447
|
+
}, React__default.createElement(IconChevronDown, {
|
|
1448
|
+
size: "small"
|
|
1449
|
+
})));
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1452
|
+
var DataTable = function DataTable(_ref) {
|
|
1453
|
+
var items = _ref.items,
|
|
1454
|
+
columns = _ref.columns,
|
|
1455
|
+
itemComponent = _ref.itemComponent,
|
|
1456
|
+
maxHeight = _ref.maxHeight,
|
|
1457
|
+
_ref$hasPrevious = _ref.hasPrevious,
|
|
1458
|
+
hasPrevious = _ref$hasPrevious === void 0 ? true : _ref$hasPrevious,
|
|
1459
|
+
_ref$hasNext = _ref.hasNext,
|
|
1460
|
+
hasNext = _ref$hasNext === void 0 ? true : _ref$hasNext,
|
|
1461
|
+
onPreviousClick = _ref.onPreviousClick,
|
|
1462
|
+
onNextClick = _ref.onNextClick,
|
|
1463
|
+
onSort = _ref.onSort,
|
|
1464
|
+
_ref$isLoading = _ref.isLoading,
|
|
1465
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
1466
|
+
_ref$showActionMenu = _ref.showActionMenu,
|
|
1467
|
+
showActionMenu = _ref$showActionMenu === void 0 ? false : _ref$showActionMenu,
|
|
1468
|
+
footerComponent = _ref.footerComponent,
|
|
1469
|
+
_ref$hasVerticalBorde = _ref.hasVerticalBorders,
|
|
1470
|
+
hasVerticalBorders = _ref$hasVerticalBorde === void 0 ? false : _ref$hasVerticalBorde;
|
|
1471
|
+
var RowItem = itemComponent || DefaultItemComponent$1;
|
|
1472
|
+
var conditionalStyles = {};
|
|
1473
|
+
|
|
1474
|
+
if (maxHeight !== null) {
|
|
1475
|
+
conditionalStyles = _extends({}, conditionalStyles, {
|
|
1476
|
+
maxHeight: maxHeight,
|
|
1477
|
+
overflowY: 'auto'
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
var numberOfRows = items.length + (footerComponent ? 1 : 0);
|
|
1308
1482
|
return React__default.createElement(Context$1.Provider, {
|
|
1309
1483
|
value: {
|
|
1310
|
-
|
|
1484
|
+
columns: columns,
|
|
1485
|
+
showActionMenu: showActionMenu,
|
|
1486
|
+
numberOfRows: numberOfRows,
|
|
1487
|
+
hasVerticalBorders: hasVerticalBorders
|
|
1311
1488
|
}
|
|
1312
|
-
}, React__default.createElement("
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
},
|
|
1489
|
+
}, React__default.createElement("div", null, React__default.createElement(DataTableHeader, {
|
|
1490
|
+
columns: columns,
|
|
1491
|
+
onSort: onSort,
|
|
1492
|
+
showActionMenu: showActionMenu
|
|
1493
|
+
}), React__default.createElement("div", {
|
|
1494
|
+
className: styles$b['body'],
|
|
1495
|
+
style: conditionalStyles,
|
|
1496
|
+
role: "table"
|
|
1497
|
+
}, isLoading && React__default.createElement(Spinner, {
|
|
1498
|
+
block: true
|
|
1499
|
+
}), !isLoading && items.map(function (item, index) {
|
|
1500
|
+
return React__default.createElement(RowItem, {
|
|
1501
|
+
item: item,
|
|
1502
|
+
columns: columns,
|
|
1503
|
+
key: index,
|
|
1504
|
+
index: index
|
|
1505
|
+
});
|
|
1506
|
+
}), footerComponent && !isLoading && React__default.createElement("div", {
|
|
1507
|
+
className: styles$b['footer'],
|
|
1508
|
+
"data-testid": "footer"
|
|
1509
|
+
}, footerComponent)), onPreviousClick && onNextClick && (hasPrevious || hasNext) && React__default.createElement("div", {
|
|
1510
|
+
className: styles$b['pagination-controls'],
|
|
1511
|
+
"data-testid": "pagination-controls"
|
|
1512
|
+
}, React__default.createElement(PaginationControls, {
|
|
1513
|
+
hasPrevious: hasPrevious && !isLoading,
|
|
1514
|
+
hasNext: hasNext && !isLoading,
|
|
1515
|
+
onPreviousClick: onPreviousClick,
|
|
1516
|
+
onNextClick: onNextClick
|
|
1517
|
+
}))));
|
|
1317
1518
|
};
|
|
1318
1519
|
|
|
1319
|
-
var
|
|
1320
|
-
var
|
|
1321
|
-
|
|
1322
|
-
var
|
|
1323
|
-
|
|
1520
|
+
var DefaultItemComponent$1 = function DefaultItemComponent(_ref2) {
|
|
1521
|
+
var columns = _ref2.columns,
|
|
1522
|
+
item = _ref2.item;
|
|
1523
|
+
var headingKeys = columns ? columns.map(function (column) {
|
|
1524
|
+
return column.name;
|
|
1525
|
+
}) : Object.keys(item);
|
|
1526
|
+
var columnsToShow = headingKeys.filter(function (key) {
|
|
1527
|
+
return key !== 'actions';
|
|
1528
|
+
});
|
|
1529
|
+
return React__default.createElement(DataTableRow, {
|
|
1530
|
+
actions: item.actions
|
|
1531
|
+
}, columnsToShow.map(function (headingKey) {
|
|
1532
|
+
return React__default.createElement("div", {
|
|
1533
|
+
key: headingKey
|
|
1534
|
+
}, item[headingKey] || '');
|
|
1535
|
+
}));
|
|
1536
|
+
};
|
|
1537
|
+
|
|
1538
|
+
var styles$c = {"data-table-cell":"_orjDM","data-table-cell--right-aligned":"_3EpfF"};
|
|
1539
|
+
|
|
1540
|
+
var DataTableCell = function DataTableCell(_ref) {
|
|
1541
|
+
var _columns$columnIndex, _classnames;
|
|
1324
1542
|
|
|
1325
|
-
var FormRow = function FormRow(_ref) {
|
|
1326
1543
|
var children = _ref.children,
|
|
1327
|
-
|
|
1328
|
-
sizes = _ref.sizes;
|
|
1329
|
-
var items = React__default.Children.toArray(children).filter(Boolean);
|
|
1330
|
-
var additionalColumns = [];
|
|
1544
|
+
columnIndex = _ref.columnIndex;
|
|
1331
1545
|
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1546
|
+
var _useDataTableContext = useDataTableContext(),
|
|
1547
|
+
columns = _useDataTableContext.columns;
|
|
1548
|
+
|
|
1549
|
+
var column = (_columns$columnIndex = columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
1550
|
+
var isRightAligned = column ? column.isRightAligned : false;
|
|
1551
|
+
return React__default.createElement("div", {
|
|
1552
|
+
className: classnames((_classnames = {}, _classnames[styles$c['data-table-cell--right-aligned']] = isRightAligned, _classnames), styles$c['data-table-cell'])
|
|
1553
|
+
}, children);
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
var Context$2 = createContext({});
|
|
1557
|
+
var useFormContext = function useFormContext() {
|
|
1558
|
+
var context = useContext(Context$2);
|
|
1559
|
+
return context || {};
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1562
|
+
var useFieldId = function useFieldId(_ref) {
|
|
1563
|
+
var name = _ref.name,
|
|
1564
|
+
inputId = _ref.id;
|
|
1565
|
+
var id = useMemo(function () {
|
|
1566
|
+
return inputId ? inputId : name + "-" + Math.random();
|
|
1567
|
+
}, [inputId, name]);
|
|
1568
|
+
return id;
|
|
1569
|
+
};
|
|
1570
|
+
|
|
1571
|
+
var getFormikState = function getFormikState(name, formik) {
|
|
1572
|
+
if (formik === undefined) {
|
|
1573
|
+
return null;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
if (Object.keys(formik.values).includes(name)) {
|
|
1577
|
+
return {
|
|
1578
|
+
error: formik.touched[name] ? formik.errors[name] : undefined,
|
|
1579
|
+
value: formik.values[name]
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
var formikArray = getFormikArrayPath(name);
|
|
1584
|
+
|
|
1585
|
+
if (formikArray) {
|
|
1586
|
+
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;
|
|
1587
|
+
|
|
1588
|
+
var arrayName = formikArray.arrayName,
|
|
1589
|
+
itemIndex = formikArray.itemIndex,
|
|
1590
|
+
fieldName = formikArray.fieldName;
|
|
1591
|
+
return {
|
|
1592
|
+
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,
|
|
1593
|
+
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]
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
return null;
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1600
|
+
var getFormikArrayPath = function getFormikArrayPath(name) {
|
|
1601
|
+
if (!name.includes('[')) {
|
|
1602
|
+
return false;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
var _name$split = name.split('['),
|
|
1606
|
+
arrayName = _name$split[0],
|
|
1607
|
+
missingSplit = _name$split[1];
|
|
1608
|
+
|
|
1609
|
+
var _missingSplit$split = missingSplit.split('].'),
|
|
1610
|
+
itemIndex = _missingSplit$split[0],
|
|
1611
|
+
fieldName = _missingSplit$split[1];
|
|
1612
|
+
|
|
1613
|
+
return {
|
|
1614
|
+
arrayName: arrayName,
|
|
1615
|
+
itemIndex: itemIndex,
|
|
1616
|
+
fieldName: fieldName
|
|
1617
|
+
};
|
|
1618
|
+
};
|
|
1619
|
+
|
|
1620
|
+
var useFieldControllers = function useFieldControllers(_ref) {
|
|
1621
|
+
var name = _ref.name,
|
|
1622
|
+
inputId = _ref.id,
|
|
1623
|
+
value = _ref.value,
|
|
1624
|
+
_onChange = _ref.onChange,
|
|
1625
|
+
_onBlur = _ref.onBlur,
|
|
1626
|
+
error = _ref.error,
|
|
1627
|
+
_ref$type = _ref.type,
|
|
1628
|
+
type = _ref$type === void 0 ? 'text' : _ref$type;
|
|
1629
|
+
|
|
1630
|
+
var _useFormContext = useFormContext(),
|
|
1631
|
+
formik = _useFormContext.formik;
|
|
1632
|
+
|
|
1633
|
+
var id = useFieldId({
|
|
1634
|
+
name: name,
|
|
1635
|
+
id: inputId
|
|
1636
|
+
});
|
|
1637
|
+
var controllers = {
|
|
1638
|
+
id: id,
|
|
1639
|
+
error: error,
|
|
1640
|
+
value: value,
|
|
1641
|
+
onChange: function onChange(e) {
|
|
1642
|
+
return _onChange && _onChange(e.target.value);
|
|
1643
|
+
},
|
|
1644
|
+
onBlur: function onBlur(e) {
|
|
1645
|
+
return _onBlur && _onBlur(e.target.value);
|
|
1337
1646
|
}
|
|
1338
|
-
}
|
|
1647
|
+
};
|
|
1648
|
+
var formikState = getFormikState(name, formik);
|
|
1339
1649
|
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1650
|
+
if (formik && formikState) {
|
|
1651
|
+
var currencyBlur = function currencyBlur() {
|
|
1652
|
+
if (type === 'currency') {
|
|
1653
|
+
formik.setFieldValue(name, Number(value).toFixed(2));
|
|
1654
|
+
}
|
|
1655
|
+
};
|
|
1656
|
+
|
|
1657
|
+
controllers = _extends({}, controllers, {
|
|
1658
|
+
error: error !== undefined ? controllers.error : formikState.error,
|
|
1659
|
+
value: value !== undefined ? controllers.value : formikState.value,
|
|
1660
|
+
onChange: _onChange ? controllers.onChange : function (e) {
|
|
1661
|
+
return formik.setFieldValue(name, e.target.value);
|
|
1662
|
+
},
|
|
1663
|
+
onBlur: _onBlur ? function (e) {
|
|
1664
|
+
controllers.onBlur(e);
|
|
1665
|
+
currencyBlur();
|
|
1666
|
+
} : function () {
|
|
1667
|
+
formik.setFieldTouched(name);
|
|
1668
|
+
currencyBlur();
|
|
1669
|
+
}
|
|
1349
1670
|
});
|
|
1350
|
-
}
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
return controllers;
|
|
1351
1674
|
};
|
|
1352
1675
|
|
|
1353
|
-
var styles$
|
|
1676
|
+
var styles$d = {"label":"_h724f"};
|
|
1354
1677
|
|
|
1355
1678
|
var Label = function Label(_ref) {
|
|
1356
1679
|
var htmlFor = _ref.htmlFor,
|
|
1357
1680
|
children = _ref.children;
|
|
1358
1681
|
return React__default.createElement("label", {
|
|
1359
1682
|
htmlFor: htmlFor,
|
|
1360
|
-
className: styles$
|
|
1683
|
+
className: styles$d['label']
|
|
1361
1684
|
}, children);
|
|
1362
1685
|
};
|
|
1363
1686
|
|
|
1364
|
-
var styles$
|
|
1687
|
+
var styles$e = {"caption":"_1DWBq"};
|
|
1365
1688
|
|
|
1366
1689
|
var Caption = function Caption(_ref) {
|
|
1367
1690
|
var fieldId = _ref.fieldId,
|
|
1368
1691
|
children = _ref.children;
|
|
1369
1692
|
return React__default.createElement("div", {
|
|
1370
1693
|
id: fieldId && fieldId + "-describer",
|
|
1371
|
-
className: styles$
|
|
1694
|
+
className: styles$e['caption']
|
|
1372
1695
|
}, children);
|
|
1373
1696
|
};
|
|
1374
1697
|
|
|
@@ -1385,14 +1708,14 @@ var GREY400 = '#929292';
|
|
|
1385
1708
|
var GREY500 = '#555555';
|
|
1386
1709
|
var GREY600 = '#464646';
|
|
1387
1710
|
|
|
1388
|
-
var styles$
|
|
1711
|
+
var styles$f = {"error-message":"_nZ2MD"};
|
|
1389
1712
|
|
|
1390
1713
|
var ErrorMessage = function ErrorMessage(_ref) {
|
|
1391
1714
|
var fieldId = _ref.fieldId,
|
|
1392
1715
|
children = _ref.children;
|
|
1393
1716
|
return React__default.createElement("div", {
|
|
1394
1717
|
id: fieldId && fieldId + "-error-message",
|
|
1395
|
-
className: styles$
|
|
1718
|
+
className: styles$f['error-message']
|
|
1396
1719
|
}, React__default.createElement(Inline, {
|
|
1397
1720
|
space: 8,
|
|
1398
1721
|
alignItems: "center"
|
|
@@ -1420,61 +1743,190 @@ var Field = function Field(_ref) {
|
|
|
1420
1743
|
}, error));
|
|
1421
1744
|
};
|
|
1422
1745
|
|
|
1423
|
-
var styles$
|
|
1746
|
+
var styles$g = {"affix-container":"_ybKOk","affix-container--prefixed":"_2COk3","affix-container--suffixed":"_1xXXN","prefix":"_eX5OL","suffix":"__YH01"};
|
|
1424
1747
|
|
|
1425
|
-
var
|
|
1426
|
-
var
|
|
1427
|
-
|
|
1428
|
-
var
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1748
|
+
var AffixContainer = function AffixContainer(_ref) {
|
|
1749
|
+
var _classnames;
|
|
1750
|
+
|
|
1751
|
+
var prefix = _ref.prefix,
|
|
1752
|
+
suffix = _ref.suffix,
|
|
1753
|
+
children = _ref.children;
|
|
1754
|
+
var container = useRef(null);
|
|
1755
|
+
var prefixElement = useRef(null);
|
|
1756
|
+
var suffixElement = useRef(null);
|
|
1757
|
+
useLayoutEffect(function () {
|
|
1758
|
+
if (container.current) {
|
|
1759
|
+
var input = container.current.querySelector('input, [class$=control] > div');
|
|
1760
|
+
|
|
1761
|
+
if (input) {
|
|
1762
|
+
if (prefix && prefixElement.current) {
|
|
1763
|
+
var _prefixElement$curren;
|
|
1764
|
+
|
|
1765
|
+
var prefixWidth = prefixElement === null || prefixElement === void 0 ? void 0 : (_prefixElement$curren = prefixElement.current) === null || _prefixElement$curren === void 0 ? void 0 : _prefixElement$curren.offsetWidth;
|
|
1766
|
+
input.style.paddingLeft = prefixWidth + 'px';
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
if (suffix && suffixElement.current) {
|
|
1770
|
+
var suffixWidth = suffixElement.current.offsetWidth;
|
|
1771
|
+
input.style.paddingRight = suffixWidth + 'px';
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}, [prefix, suffix]);
|
|
1776
|
+
var hasPrefix = !!prefix;
|
|
1777
|
+
var hasSuffix = !!suffix;
|
|
1778
|
+
|
|
1779
|
+
if (!hasPrefix && !hasSuffix) {
|
|
1780
|
+
return children;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
var classes = classnames(styles$g['affix-container'], (_classnames = {}, _classnames[styles$g['affix-container--prefixed']] = hasPrefix, _classnames[styles$g['affix-container--suffixed']] = hasSuffix, _classnames));
|
|
1784
|
+
return React__default.createElement("div", {
|
|
1785
|
+
className: classes,
|
|
1786
|
+
ref: container,
|
|
1787
|
+
"data-testid": "affix-container"
|
|
1788
|
+
}, hasPrefix && React__default.createElement("div", {
|
|
1789
|
+
className: styles$g['prefix'],
|
|
1790
|
+
ref: prefixElement
|
|
1791
|
+
}, prefix), children, hasSuffix && React__default.createElement("div", {
|
|
1792
|
+
className: styles$g['suffix'],
|
|
1793
|
+
ref: suffixElement
|
|
1794
|
+
}, suffix));
|
|
1432
1795
|
};
|
|
1433
1796
|
|
|
1434
|
-
var
|
|
1797
|
+
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"};
|
|
1798
|
+
|
|
1799
|
+
var DataTableEditableCell = function DataTableEditableCell(_ref) {
|
|
1800
|
+
var _columns$columnIndex, _classnames;
|
|
1801
|
+
|
|
1435
1802
|
var name = _ref.name,
|
|
1803
|
+
columnIndex = _ref.columnIndex,
|
|
1804
|
+
rowIndex = _ref.rowIndex,
|
|
1436
1805
|
inputId = _ref.id,
|
|
1437
1806
|
value = _ref.value,
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1807
|
+
onChange = _ref.onChange,
|
|
1808
|
+
onBlur = _ref.onBlur,
|
|
1809
|
+
placeholder = _ref.placeholder,
|
|
1810
|
+
disabled = _ref.disabled,
|
|
1811
|
+
error = _ref.error,
|
|
1812
|
+
prefix = _ref.prefix,
|
|
1813
|
+
suffix = _ref.suffix,
|
|
1814
|
+
defaultValue = _ref.defaultValue,
|
|
1815
|
+
_ref$type = _ref.type,
|
|
1816
|
+
type = _ref$type === void 0 ? 'text' : _ref$type;
|
|
1817
|
+
|
|
1818
|
+
var _useDataTableContext = useDataTableContext(),
|
|
1819
|
+
columns = _useDataTableContext.columns,
|
|
1820
|
+
numberOfRows = _useDataTableContext.numberOfRows;
|
|
1821
|
+
|
|
1822
|
+
var column = (_columns$columnIndex = columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
1823
|
+
var isRightAligned = column ? column.isRightAligned : false;
|
|
1824
|
+
var numberOfColumns = columns === null || columns === void 0 ? void 0 : columns.length;
|
|
1825
|
+
var isTopLeftCell = columnIndex === 0 && rowIndex === 0;
|
|
1826
|
+
var isTopRightCell = columnIndex === numberOfColumns - 1 && rowIndex === 0;
|
|
1827
|
+
var isBottomLeftCell = columnIndex === 0 && rowIndex === numberOfRows - 1;
|
|
1828
|
+
var isBottomRightCell = columnIndex === numberOfColumns - 1 && rowIndex === numberOfRows - 1;
|
|
1829
|
+
var controllers = useFieldControllers({
|
|
1446
1830
|
name: name,
|
|
1447
|
-
id: inputId
|
|
1448
|
-
});
|
|
1449
|
-
var controllers = {
|
|
1450
|
-
id: id,
|
|
1451
|
-
error: error,
|
|
1831
|
+
id: inputId,
|
|
1452
1832
|
value: value,
|
|
1453
|
-
onChange:
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1833
|
+
onChange: onChange,
|
|
1834
|
+
onBlur: onBlur,
|
|
1835
|
+
error: error,
|
|
1836
|
+
type: type
|
|
1837
|
+
});
|
|
1838
|
+
var hasError = !!controllers.error;
|
|
1839
|
+
var fieldProps = {
|
|
1840
|
+
name: name,
|
|
1841
|
+
id: controllers.id
|
|
1842
|
+
};
|
|
1843
|
+
return React__default.createElement("div", {
|
|
1844
|
+
className: styles$h['data-table-editable-cell']
|
|
1845
|
+
}, React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement(AffixContainer, {
|
|
1846
|
+
prefix: prefix,
|
|
1847
|
+
suffix: suffix
|
|
1848
|
+
}, React__default.createElement("input", {
|
|
1849
|
+
name: name,
|
|
1850
|
+
id: controllers.id,
|
|
1851
|
+
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)),
|
|
1852
|
+
type: "text",
|
|
1853
|
+
"data-testid": "text-field-" + name,
|
|
1854
|
+
"aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
1855
|
+
"aria-invalid": hasError,
|
|
1856
|
+
disabled: disabled,
|
|
1857
|
+
placeholder: placeholder,
|
|
1858
|
+
defaultValue: defaultValue,
|
|
1859
|
+
value: controllers.value,
|
|
1860
|
+
onChange: controllers.onChange,
|
|
1861
|
+
onBlur: controllers.onBlur
|
|
1862
|
+
}))));
|
|
1863
|
+
};
|
|
1864
|
+
|
|
1865
|
+
var styles$i = {"form--standard-size":"_3CaV0"};
|
|
1866
|
+
|
|
1867
|
+
var Form = function Form(_ref) {
|
|
1868
|
+
var _classnames;
|
|
1869
|
+
|
|
1870
|
+
var children = _ref.children,
|
|
1871
|
+
onSubmit = _ref.onSubmit,
|
|
1872
|
+
_ref$wide = _ref.wide,
|
|
1873
|
+
wide = _ref$wide === void 0 ? false : _ref$wide,
|
|
1874
|
+
formik = _ref.formik,
|
|
1875
|
+
_ref$stackContent = _ref.stackContent,
|
|
1876
|
+
stackContent = _ref$stackContent === void 0 ? true : _ref$stackContent;
|
|
1877
|
+
|
|
1878
|
+
var handleSubmit = function handleSubmit(e) {
|
|
1879
|
+
e.preventDefault();
|
|
1880
|
+
onSubmit && onSubmit(e.currentTarget.elements);
|
|
1459
1881
|
};
|
|
1460
1882
|
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1883
|
+
return React__default.createElement(Context$2.Provider, {
|
|
1884
|
+
value: {
|
|
1885
|
+
formik: formik
|
|
1886
|
+
}
|
|
1887
|
+
}, React__default.createElement("form", {
|
|
1888
|
+
onSubmit: onSubmit ? handleSubmit : formik === null || formik === void 0 ? void 0 : formik.handleSubmit,
|
|
1889
|
+
className: classnames((_classnames = {}, _classnames[styles$i['form--standard-size']] = !wide, _classnames)),
|
|
1890
|
+
"data-testid": "form"
|
|
1891
|
+
}, stackContent ? React__default.createElement(Stack, null, children) : children));
|
|
1892
|
+
};
|
|
1893
|
+
|
|
1894
|
+
var SIZE_25_PERCENT = '25%';
|
|
1895
|
+
var SIZE_33_PERCENT = '33.333%';
|
|
1896
|
+
var SIZE_50_PERCENT = '50%';
|
|
1897
|
+
var SIZE_66_PERCENT = '66.666%';
|
|
1898
|
+
var SIZE_75_PERCENT = '75%';
|
|
1899
|
+
|
|
1900
|
+
var FormRow = function FormRow(_ref) {
|
|
1901
|
+
var children = _ref.children,
|
|
1902
|
+
columns = _ref.columns,
|
|
1903
|
+
sizes = _ref.sizes;
|
|
1904
|
+
var items = React__default.Children.toArray(children).filter(Boolean);
|
|
1905
|
+
var additionalColumns = [];
|
|
1906
|
+
|
|
1907
|
+
if (columns !== undefined) {
|
|
1908
|
+
if (columns > items.length) {
|
|
1909
|
+
additionalColumns.push.apply(additionalColumns, new Array(columns - items.length).map(function () {
|
|
1910
|
+
return '';
|
|
1911
|
+
}));
|
|
1912
|
+
}
|
|
1473
1913
|
}
|
|
1474
1914
|
|
|
1475
|
-
return
|
|
1915
|
+
return React__default.createElement(Inline, {
|
|
1916
|
+
flex: [].concat(items, additionalColumns).map(function (_, index) {
|
|
1917
|
+
return (sizes === null || sizes === void 0 ? void 0 : sizes[index]) || 1;
|
|
1918
|
+
}),
|
|
1919
|
+
space: 20
|
|
1920
|
+
}, children, additionalColumns.map(function (_, index) {
|
|
1921
|
+
return React__default.createElement("span", {
|
|
1922
|
+
key: index,
|
|
1923
|
+
"data-testid": "empty-cell"
|
|
1924
|
+
});
|
|
1925
|
+
}));
|
|
1476
1926
|
};
|
|
1477
1927
|
|
|
1928
|
+
var styles$j = {"text-field":"_BkzdC","text-field--focus":"_Rop31","text-field--disabled":"_2x3Cm","text-field--invalid":"_3zOwV","text-field__toolbar":"_rQqnL"};
|
|
1929
|
+
|
|
1478
1930
|
var useGrowTextAreaRef = function useGrowTextAreaRef(minHeight, maxHeight, autoGrow, forwardedRef) {
|
|
1479
1931
|
var textareaRef = useRef(null);
|
|
1480
1932
|
var ref = forwardedRef != null ? forwardedRef : textareaRef;
|
|
@@ -1548,7 +2000,7 @@ var TextAreaField = function TextAreaField(_ref) {
|
|
|
1548
2000
|
updateHeight = _useGrowTextAreaRef.updateHeight;
|
|
1549
2001
|
|
|
1550
2002
|
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
|
|
1551
|
-
className: classnames(styles$
|
|
2003
|
+
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)),
|
|
1552
2004
|
ref: containerRef,
|
|
1553
2005
|
onClick: function onClick(event) {
|
|
1554
2006
|
if (event.target === (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current)) {
|
|
@@ -1580,7 +2032,7 @@ var TextAreaField = function TextAreaField(_ref) {
|
|
|
1580
2032
|
},
|
|
1581
2033
|
ref: textAreaRef
|
|
1582
2034
|
}), toolbar && React__default.createElement("div", {
|
|
1583
|
-
className: styles$
|
|
2035
|
+
className: styles$j['text-field__toolbar'],
|
|
1584
2036
|
id: controllers.id + "-toolbar",
|
|
1585
2037
|
ref: toolbarRef,
|
|
1586
2038
|
onClick: function onClick(event) {
|
|
@@ -1593,58 +2045,7 @@ var TextAreaField = function TextAreaField(_ref) {
|
|
|
1593
2045
|
}, toolbar)));
|
|
1594
2046
|
};
|
|
1595
2047
|
|
|
1596
|
-
var styles$
|
|
1597
|
-
|
|
1598
|
-
var AffixContainer = function AffixContainer(_ref) {
|
|
1599
|
-
var _classnames;
|
|
1600
|
-
|
|
1601
|
-
var prefix = _ref.prefix,
|
|
1602
|
-
suffix = _ref.suffix,
|
|
1603
|
-
children = _ref.children;
|
|
1604
|
-
var container = useRef(null);
|
|
1605
|
-
var prefixElement = useRef(null);
|
|
1606
|
-
var suffixElement = useRef(null);
|
|
1607
|
-
useLayoutEffect(function () {
|
|
1608
|
-
if (container.current) {
|
|
1609
|
-
var input = container.current.querySelector('input, [class$=control] > div');
|
|
1610
|
-
|
|
1611
|
-
if (input) {
|
|
1612
|
-
if (prefix && prefixElement.current) {
|
|
1613
|
-
var _prefixElement$curren;
|
|
1614
|
-
|
|
1615
|
-
var prefixWidth = prefixElement === null || prefixElement === void 0 ? void 0 : (_prefixElement$curren = prefixElement.current) === null || _prefixElement$curren === void 0 ? void 0 : _prefixElement$curren.offsetWidth;
|
|
1616
|
-
input.style.paddingLeft = prefixWidth + 'px';
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
if (suffix && suffixElement.current) {
|
|
1620
|
-
var suffixWidth = suffixElement.current.offsetWidth;
|
|
1621
|
-
input.style.paddingRight = suffixWidth + 'px';
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
}, [prefix, suffix]);
|
|
1626
|
-
var hasPrefix = !!prefix;
|
|
1627
|
-
var hasSuffix = !!suffix;
|
|
1628
|
-
|
|
1629
|
-
if (!hasPrefix && !hasSuffix) {
|
|
1630
|
-
return children;
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
var classes = classnames(styles$f['affix-container'], (_classnames = {}, _classnames[styles$f['affix-container--prefixed']] = hasPrefix, _classnames[styles$f['affix-container--suffixed']] = hasSuffix, _classnames));
|
|
1634
|
-
return React__default.createElement("div", {
|
|
1635
|
-
className: classes,
|
|
1636
|
-
ref: container,
|
|
1637
|
-
"data-testid": "affix-container"
|
|
1638
|
-
}, hasPrefix && React__default.createElement("div", {
|
|
1639
|
-
className: styles$f['prefix'],
|
|
1640
|
-
ref: prefixElement
|
|
1641
|
-
}, prefix), children, hasSuffix && React__default.createElement("div", {
|
|
1642
|
-
className: styles$f['suffix'],
|
|
1643
|
-
ref: suffixElement
|
|
1644
|
-
}, suffix));
|
|
1645
|
-
};
|
|
1646
|
-
|
|
1647
|
-
var styles$g = {"text-field":"_20YOA","text-field--invalid":"_3kUSh","text-field--prefixed":"_3IU3Q","text-field--suffixed":"_QXJOD"};
|
|
2048
|
+
var styles$k = {"text-field":"_20YOA","text-field--invalid":"_3kUSh","text-field--prefixed":"_3IU3Q","text-field--suffixed":"_QXJOD"};
|
|
1648
2049
|
|
|
1649
2050
|
var TextField = function TextField(_ref, ref) {
|
|
1650
2051
|
var _classnames;
|
|
@@ -1685,7 +2086,7 @@ var TextField = function TextField(_ref, ref) {
|
|
|
1685
2086
|
}, React__default.createElement("input", {
|
|
1686
2087
|
name: name,
|
|
1687
2088
|
id: controllers.id,
|
|
1688
|
-
className: classnames(styles$
|
|
2089
|
+
className: classnames(styles$k['text-field'], (_classnames = {}, _classnames[styles$k['text-field--invalid']] = hasError, _classnames)),
|
|
1689
2090
|
type: "text",
|
|
1690
2091
|
"data-testid": "text-field-" + name,
|
|
1691
2092
|
"aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
@@ -1730,12 +2131,12 @@ var useCheckBoxFieldControllers = function useCheckBoxFieldControllers(_ref) {
|
|
|
1730
2131
|
return _onBlur && _onBlur(e.target.checked);
|
|
1731
2132
|
}
|
|
1732
2133
|
};
|
|
2134
|
+
var formikState = getFormikState(name, formik);
|
|
1733
2135
|
|
|
1734
|
-
if (formik &&
|
|
1735
|
-
var formikError = formik.touched[name] ? formik.errors[name] : undefined;
|
|
2136
|
+
if (formik && formikState) {
|
|
1736
2137
|
controllers = _extends({}, controllers, {
|
|
1737
|
-
error: error !== undefined ? controllers.error :
|
|
1738
|
-
checked: checked !== undefined ? controllers.checked :
|
|
2138
|
+
error: error !== undefined ? controllers.error : formikState.error,
|
|
2139
|
+
checked: checked !== undefined ? controllers.checked : formikState.value,
|
|
1739
2140
|
onChange: function onChange(e) {
|
|
1740
2141
|
formik.setFieldValue(name, e.target.checked);
|
|
1741
2142
|
_onChange && _onChange(e.target.checked);
|
|
@@ -1750,7 +2151,7 @@ var useCheckBoxFieldControllers = function useCheckBoxFieldControllers(_ref) {
|
|
|
1750
2151
|
return controllers;
|
|
1751
2152
|
};
|
|
1752
2153
|
|
|
1753
|
-
var styles$
|
|
2154
|
+
var styles$l = {"check-box-field":"_2sg0c","check-box-field__caption":"_2LdrP","check-box-field__custom-input":"_2mA8e"};
|
|
1754
2155
|
|
|
1755
2156
|
var CheckboxField = function CheckboxField(_ref) {
|
|
1756
2157
|
var name = _ref.name,
|
|
@@ -1777,7 +2178,7 @@ var CheckboxField = function CheckboxField(_ref) {
|
|
|
1777
2178
|
space: 8,
|
|
1778
2179
|
alignItems: "center"
|
|
1779
2180
|
}, React__default.createElement("div", {
|
|
1780
|
-
className: styles$
|
|
2181
|
+
className: styles$l['check-box-field']
|
|
1781
2182
|
}, React__default.createElement("input", {
|
|
1782
2183
|
name: name,
|
|
1783
2184
|
id: controllers.id,
|
|
@@ -1790,11 +2191,11 @@ var CheckboxField = function CheckboxField(_ref) {
|
|
|
1790
2191
|
onChange: controllers.onChange,
|
|
1791
2192
|
onBlur: controllers.onBlur
|
|
1792
2193
|
}), React__default.createElement("span", {
|
|
1793
|
-
className: styles$
|
|
2194
|
+
className: styles$l['check-box-field__custom-input']
|
|
1794
2195
|
})), label && React__default.createElement(Label, {
|
|
1795
2196
|
htmlFor: controllers.id
|
|
1796
2197
|
}, label)), caption && React__default.createElement("div", {
|
|
1797
|
-
className: styles$
|
|
2198
|
+
className: styles$l['check-box-field__caption']
|
|
1798
2199
|
}, React__default.createElement(Caption, {
|
|
1799
2200
|
fieldId: controllers.id
|
|
1800
2201
|
}, caption)), controllers.error && React__default.createElement(ErrorMessage, {
|
|
@@ -1818,12 +2219,12 @@ var useRadioGroupFieldControllers = function useRadioGroupFieldControllers(_ref)
|
|
|
1818
2219
|
return _onChange && _onChange(e.target.value);
|
|
1819
2220
|
}
|
|
1820
2221
|
};
|
|
2222
|
+
var formikState = getFormikState(name, formik);
|
|
1821
2223
|
|
|
1822
|
-
if (formik &&
|
|
1823
|
-
var formikError = formik.touched[name] ? formik.errors[name] : undefined;
|
|
2224
|
+
if (formik && formikState) {
|
|
1824
2225
|
controllers = _extends({}, controllers, {
|
|
1825
|
-
error: error !== undefined ? controllers.error :
|
|
1826
|
-
value: value !== undefined ? controllers.value :
|
|
2226
|
+
error: error !== undefined ? controllers.error : formikState.error,
|
|
2227
|
+
value: value !== undefined ? controllers.value : formikState.value,
|
|
1827
2228
|
onChange: function onChange(e) {
|
|
1828
2229
|
formik.setFieldValue(name, e.target.checked);
|
|
1829
2230
|
_onChange && _onChange(e.target.value);
|
|
@@ -1845,7 +2246,7 @@ var useRadioGroupFieldContext = function useRadioGroupFieldContext() {
|
|
|
1845
2246
|
return context;
|
|
1846
2247
|
};
|
|
1847
2248
|
|
|
1848
|
-
var styles$
|
|
2249
|
+
var styles$m = {"label":"_1WGz2","radio-group-field__label":"_RXyG_"};
|
|
1849
2250
|
|
|
1850
2251
|
var RadioGroupField = function RadioGroupField(_ref) {
|
|
1851
2252
|
var name = _ref.name,
|
|
@@ -1878,7 +2279,7 @@ var RadioGroupField = function RadioGroupField(_ref) {
|
|
|
1878
2279
|
}, React__default.createElement(Stack, {
|
|
1879
2280
|
space: 12
|
|
1880
2281
|
}, label && React__default.createElement("div", {
|
|
1881
|
-
className: styles$
|
|
2282
|
+
className: styles$m['radio-group-field__label']
|
|
1882
2283
|
}, label), React__default.createElement(Stack, {
|
|
1883
2284
|
space: 8
|
|
1884
2285
|
}, inline ? React__default.createElement(InlineOptions, null, children) : React__default.createElement(Stack, {
|
|
@@ -1912,7 +2313,7 @@ var InlineOptions = function InlineOptions(_ref2) {
|
|
|
1912
2313
|
return React__default.createElement(FormRow, null, children);
|
|
1913
2314
|
};
|
|
1914
2315
|
|
|
1915
|
-
var styles$
|
|
2316
|
+
var styles$n = {"radio-group-option":"_1Clmp","radio-group-option__caption":"_3UmWA","radio-group-option__custom-input":"_1tMq-"};
|
|
1916
2317
|
|
|
1917
2318
|
var RadioGroupOption = function RadioGroupOption(_ref) {
|
|
1918
2319
|
var value = _ref.value,
|
|
@@ -1930,7 +2331,7 @@ var RadioGroupOption = function RadioGroupOption(_ref) {
|
|
|
1930
2331
|
space: 8,
|
|
1931
2332
|
alignItems: "center"
|
|
1932
2333
|
}, React__default.createElement("div", {
|
|
1933
|
-
className: styles$
|
|
2334
|
+
className: styles$n['radio-group-option']
|
|
1934
2335
|
}, React__default.createElement("input", {
|
|
1935
2336
|
type: "radio",
|
|
1936
2337
|
id: id,
|
|
@@ -1940,19 +2341,19 @@ var RadioGroupOption = function RadioGroupOption(_ref) {
|
|
|
1940
2341
|
checked: radioGroupContext.value !== undefined ? radioGroupContext.value === value : undefined,
|
|
1941
2342
|
disabled: radioGroupContext.disabled
|
|
1942
2343
|
}), React__default.createElement("span", {
|
|
1943
|
-
className: styles$
|
|
2344
|
+
className: styles$n['radio-group-option__custom-input']
|
|
1944
2345
|
})), label && React__default.createElement(Label, {
|
|
1945
2346
|
htmlFor: id
|
|
1946
2347
|
}, label)), caption && React__default.createElement("div", {
|
|
1947
|
-
className: styles$
|
|
2348
|
+
className: styles$n['radio-group-option__caption']
|
|
1948
2349
|
}, React__default.createElement(Caption, {
|
|
1949
2350
|
fieldId: id
|
|
1950
2351
|
}, caption)));
|
|
1951
2352
|
};
|
|
1952
2353
|
|
|
1953
|
-
var styles$
|
|
2354
|
+
var styles$o = {"text-field":"_18Rzv","text-field--invalid":"_3eD7t","text-field--prefixed":"_2evrG","text-field--suffixed":"_-MgeO","password-container":"_-Rf3c","password-toggle":"_yinPY"};
|
|
1954
2355
|
|
|
1955
|
-
var styles$
|
|
2356
|
+
var styles$p = {"password-criteria":"_U0krC","password-criteria--invalid":"_2XIl4"};
|
|
1956
2357
|
|
|
1957
2358
|
var PasswordCriteria = function PasswordCriteria(_ref) {
|
|
1958
2359
|
var _classnames;
|
|
@@ -1960,7 +2361,7 @@ var PasswordCriteria = function PasswordCriteria(_ref) {
|
|
|
1960
2361
|
var met = _ref.met,
|
|
1961
2362
|
children = _ref.children;
|
|
1962
2363
|
return React__default.createElement("span", {
|
|
1963
|
-
className: classnames(styles$
|
|
2364
|
+
className: classnames(styles$p['password-criteria'], (_classnames = {}, _classnames[styles$p['password-criteria--invalid']] = !met, _classnames))
|
|
1964
2365
|
}, "\u25CF ", children);
|
|
1965
2366
|
};
|
|
1966
2367
|
|
|
@@ -2039,11 +2440,11 @@ var PasswordField = function PasswordField(_ref) {
|
|
|
2039
2440
|
error: controllers.error
|
|
2040
2441
|
};
|
|
2041
2442
|
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
|
|
2042
|
-
className: styles$
|
|
2443
|
+
className: styles$o['password-container']
|
|
2043
2444
|
}, React__default.createElement("input", {
|
|
2044
2445
|
name: name,
|
|
2045
2446
|
id: controllers.id,
|
|
2046
|
-
className: classnames(styles$
|
|
2447
|
+
className: classnames(styles$o['text-field'], (_classnames = {}, _classnames[styles$o['text-field--invalid']] = hasError, _classnames)),
|
|
2047
2448
|
type: type,
|
|
2048
2449
|
"data-testid": "text-field-" + name,
|
|
2049
2450
|
"aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
@@ -2055,7 +2456,7 @@ var PasswordField = function PasswordField(_ref) {
|
|
|
2055
2456
|
onChange: controllers.onChange,
|
|
2056
2457
|
onBlur: controllers.onBlur
|
|
2057
2458
|
}), React__default.createElement("div", {
|
|
2058
|
-
className: styles$
|
|
2459
|
+
className: styles$o['password-toggle'],
|
|
2059
2460
|
onClick: toggleType,
|
|
2060
2461
|
onKeyPress: toggleType,
|
|
2061
2462
|
"data-testid": "password-toggle",
|
|
@@ -2090,12 +2491,12 @@ var useMultiSelectFieldControllers = function useMultiSelectFieldControllers(_re
|
|
|
2090
2491
|
return _onBlur && _onBlur(options);
|
|
2091
2492
|
}
|
|
2092
2493
|
};
|
|
2494
|
+
var formikState = getFormikState(name, formik);
|
|
2093
2495
|
|
|
2094
|
-
if (formik &&
|
|
2095
|
-
var formikError = formik.touched[name] ? formik.errors[name] : undefined;
|
|
2496
|
+
if (formik && formikState) {
|
|
2096
2497
|
controllers = _extends({}, controllers, {
|
|
2097
|
-
error: error ? controllers.error :
|
|
2098
|
-
value: value ? controllers.value :
|
|
2498
|
+
error: error ? controllers.error : formikState.error,
|
|
2499
|
+
value: value ? controllers.value : formikState.value,
|
|
2099
2500
|
onChange: function onChange(options) {
|
|
2100
2501
|
if (_onChange) {
|
|
2101
2502
|
_onChange(options);
|
|
@@ -2323,12 +2724,12 @@ var useSelectFieldControllers = function useSelectFieldControllers(_ref) {
|
|
|
2323
2724
|
return _onBlur && _onBlur(option);
|
|
2324
2725
|
}
|
|
2325
2726
|
};
|
|
2727
|
+
var formikState = getFormikState(name, formik);
|
|
2326
2728
|
|
|
2327
|
-
if (formik &&
|
|
2328
|
-
var formikError = formik.touched[name] ? formik.errors[name] : undefined;
|
|
2729
|
+
if (formik && formikState) {
|
|
2329
2730
|
controllers = _extends({}, controllers, {
|
|
2330
|
-
error: error ? controllers.error :
|
|
2331
|
-
value: value ? controllers.value :
|
|
2731
|
+
error: error ? controllers.error : formikState.error,
|
|
2732
|
+
value: value ? controllers.value : formikState.value,
|
|
2332
2733
|
onChange: function onChange(option) {
|
|
2333
2734
|
if (_onChange) {
|
|
2334
2735
|
_onChange(option);
|
|
@@ -2349,7 +2750,7 @@ var useSelectFieldControllers = function useSelectFieldControllers(_ref) {
|
|
|
2349
2750
|
return controllers;
|
|
2350
2751
|
};
|
|
2351
2752
|
|
|
2352
|
-
var styles$
|
|
2753
|
+
var styles$q = {"custom-control":"_1cDCR"};
|
|
2353
2754
|
|
|
2354
2755
|
var _excluded$3 = ["children", "CustomPrefixComponent"];
|
|
2355
2756
|
|
|
@@ -2362,7 +2763,7 @@ function CustomControl(_ref) {
|
|
|
2362
2763
|
|
|
2363
2764
|
var selectedOption = (_props$getValue = props.getValue()) === null || _props$getValue === void 0 ? void 0 : _props$getValue[0];
|
|
2364
2765
|
return React__default.createElement(components.Control, Object.assign({}, props), CustomControl && selectedOption ? React__default.createElement("div", {
|
|
2365
|
-
className: styles$
|
|
2766
|
+
className: styles$q['custom-control'],
|
|
2366
2767
|
style: {
|
|
2367
2768
|
paddingLeft: selectedOption ? 8 : 0
|
|
2368
2769
|
}
|
|
@@ -2475,12 +2876,12 @@ var useDateFieldControllers = function useDateFieldControllers(_ref) {
|
|
|
2475
2876
|
return _onBlur && _onBlur();
|
|
2476
2877
|
}
|
|
2477
2878
|
};
|
|
2879
|
+
var formikState = getFormikState(name, formik);
|
|
2478
2880
|
|
|
2479
|
-
if (formik &&
|
|
2480
|
-
var formikError = formik.touched[name] ? formik.errors[name] : undefined;
|
|
2881
|
+
if (formik && formikState) {
|
|
2481
2882
|
controllers = _extends({}, controllers, {
|
|
2482
|
-
error: error !== undefined ? controllers.error :
|
|
2483
|
-
value: value !== undefined ? controllers.value :
|
|
2883
|
+
error: error !== undefined ? controllers.error : formikState.error,
|
|
2884
|
+
value: value !== undefined ? controllers.value : formikState.value,
|
|
2484
2885
|
onChange: _onChange ? controllers.onChange : function (newValue) {
|
|
2485
2886
|
formik.setFieldValue(name, newValue === undefined ? null : newValue);
|
|
2486
2887
|
},
|
|
@@ -2518,7 +2919,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref) {
|
|
|
2518
2919
|
|
|
2519
2920
|
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"};
|
|
2520
2921
|
|
|
2521
|
-
var styles$
|
|
2922
|
+
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"};
|
|
2522
2923
|
|
|
2523
2924
|
function parseDate(str, format, locale) {
|
|
2524
2925
|
var parsed = dateFnsParse(str, format, new Date(), {
|
|
@@ -2597,7 +2998,7 @@ var DateField = function DateField(_ref) {
|
|
|
2597
2998
|
error: controllers.error
|
|
2598
2999
|
};
|
|
2599
3000
|
var dayPickerProps = {
|
|
2600
|
-
classNames: styles$
|
|
3001
|
+
classNames: styles$r,
|
|
2601
3002
|
disabledDays: function disabledDays(day) {
|
|
2602
3003
|
return _disabledDays && _disabledDays(setToMidnight(day));
|
|
2603
3004
|
},
|
|
@@ -2614,7 +3015,7 @@ var DateField = function DateField(_ref) {
|
|
|
2614
3015
|
})
|
|
2615
3016
|
}, React__default.createElement(DayPickerInput, {
|
|
2616
3017
|
format: format,
|
|
2617
|
-
classNames: styles$
|
|
3018
|
+
classNames: styles$r,
|
|
2618
3019
|
formatDate: formatDate,
|
|
2619
3020
|
parseDate: parseDate,
|
|
2620
3021
|
placeholder: placeholder || format.toUpperCase(),
|
|
@@ -2672,12 +3073,12 @@ var useRangeFieldControllers = function useRangeFieldControllers(_ref) {
|
|
|
2672
3073
|
return _onBlur && _onBlur();
|
|
2673
3074
|
}
|
|
2674
3075
|
};
|
|
3076
|
+
var formikState = getFormikState(name, formik);
|
|
2675
3077
|
|
|
2676
|
-
if (formik &&
|
|
2677
|
-
var formikError = formik.touched[name] ? formik.errors[name] : undefined;
|
|
3078
|
+
if (formik && formikState) {
|
|
2678
3079
|
return _extends({}, initialControllers, {
|
|
2679
|
-
error: error !== undefined ? initialControllers.error :
|
|
2680
|
-
value: value !== undefined ? initialControllers.value :
|
|
3080
|
+
error: error !== undefined ? initialControllers.error : formikState.error,
|
|
3081
|
+
value: value !== undefined ? initialControllers.value : formikState.value,
|
|
2681
3082
|
onChange: _onChange ? initialControllers.onChange : function (newValue) {
|
|
2682
3083
|
formik.setFieldValue(name, newValue === undefined ? null : newValue);
|
|
2683
3084
|
},
|
|
@@ -2690,7 +3091,7 @@ var useRangeFieldControllers = function useRangeFieldControllers(_ref) {
|
|
|
2690
3091
|
return initialControllers;
|
|
2691
3092
|
};
|
|
2692
3093
|
|
|
2693
|
-
var styles$
|
|
3094
|
+
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"};
|
|
2694
3095
|
|
|
2695
3096
|
var FromDate = function FromDate(_ref) {
|
|
2696
3097
|
var name = _ref.name,
|
|
@@ -2710,7 +3111,7 @@ var FromDate = function FromDate(_ref) {
|
|
|
2710
3111
|
to: end
|
|
2711
3112
|
};
|
|
2712
3113
|
var dayPickerProps = {
|
|
2713
|
-
classNames: styles$
|
|
3114
|
+
classNames: styles$s,
|
|
2714
3115
|
months: MONTH_NAMES,
|
|
2715
3116
|
weekdaysLong: DAYS,
|
|
2716
3117
|
weekdaysShort: DAYS.map(function (day) {
|
|
@@ -2731,7 +3132,7 @@ var FromDate = function FromDate(_ref) {
|
|
|
2731
3132
|
};
|
|
2732
3133
|
return React__default.createElement(DayPickerInput, {
|
|
2733
3134
|
format: format,
|
|
2734
|
-
classNames: styles$
|
|
3135
|
+
classNames: styles$s,
|
|
2735
3136
|
selectedDay: start,
|
|
2736
3137
|
value: start,
|
|
2737
3138
|
formatDate: formatDate,
|
|
@@ -2772,7 +3173,7 @@ var ToDate = function ToDate(_ref, ref) {
|
|
|
2772
3173
|
to: end
|
|
2773
3174
|
};
|
|
2774
3175
|
var dayPickerProps = {
|
|
2775
|
-
classNames: styles$
|
|
3176
|
+
classNames: styles$s,
|
|
2776
3177
|
months: MONTH_NAMES,
|
|
2777
3178
|
weekdaysLong: DAYS,
|
|
2778
3179
|
weekdaysShort: DAYS.map(function (day) {
|
|
@@ -2793,7 +3194,7 @@ var ToDate = function ToDate(_ref, ref) {
|
|
|
2793
3194
|
};
|
|
2794
3195
|
return React__default.createElement(DayPickerInput, {
|
|
2795
3196
|
format: format,
|
|
2796
|
-
classNames: styles$
|
|
3197
|
+
classNames: styles$s,
|
|
2797
3198
|
selectedDay: end,
|
|
2798
3199
|
value: end,
|
|
2799
3200
|
formatDate: formatDate,
|
|
@@ -2860,7 +3261,7 @@ var DateRangeField = function DateRangeField(_ref) {
|
|
|
2860
3261
|
start = _controllers$value.start,
|
|
2861
3262
|
end = _controllers$value.end;
|
|
2862
3263
|
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
|
|
2863
|
-
className: classnames(styles$
|
|
3264
|
+
className: classnames(styles$s['date-range-field'], (_classnames = {}, _classnames[styles$s['date-range-field--invalid']] = hasError, _classnames))
|
|
2864
3265
|
}, React__default.createElement(IconCalendar, {
|
|
2865
3266
|
size: "medium"
|
|
2866
3267
|
}), React__default.createElement(FromDate, {
|
|
@@ -2905,7 +3306,7 @@ var DateRangeField = function DateRangeField(_ref) {
|
|
|
2905
3306
|
})));
|
|
2906
3307
|
};
|
|
2907
3308
|
|
|
2908
|
-
var styles$
|
|
3309
|
+
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"};
|
|
2909
3310
|
|
|
2910
3311
|
var WeekField = function WeekField(_ref) {
|
|
2911
3312
|
var _classnames;
|
|
@@ -2976,7 +3377,7 @@ var WeekField = function WeekField(_ref) {
|
|
|
2976
3377
|
};
|
|
2977
3378
|
|
|
2978
3379
|
var dayPickerProps = {
|
|
2979
|
-
classNames: styles$
|
|
3380
|
+
classNames: styles$t,
|
|
2980
3381
|
disabledDays: function disabledDays(day) {
|
|
2981
3382
|
return _disabledDays && _disabledDays(setToMidnight(day));
|
|
2982
3383
|
},
|
|
@@ -3006,7 +3407,7 @@ var WeekField = function WeekField(_ref) {
|
|
|
3006
3407
|
})
|
|
3007
3408
|
}, React__default.createElement(DayPickerInput, {
|
|
3008
3409
|
format: format,
|
|
3009
|
-
classNames: styles$
|
|
3410
|
+
classNames: styles$t,
|
|
3010
3411
|
formatDate: formatDate,
|
|
3011
3412
|
parseDate: parseDate,
|
|
3012
3413
|
placeholder: placeholder || format.toUpperCase(),
|
|
@@ -3035,7 +3436,7 @@ var WeekField = function WeekField(_ref) {
|
|
|
3035
3436
|
})));
|
|
3036
3437
|
};
|
|
3037
3438
|
|
|
3038
|
-
var styles$
|
|
3439
|
+
var styles$u = {"caption":"_1QDLF","label":"_2wiMV","toggle":"_1ui8X","toggle__label":"_1YRJT","toggle__caption":"_1jEiW","toggle__switch":"_3tNyE"};
|
|
3039
3440
|
|
|
3040
3441
|
var Toggle = function Toggle(_ref) {
|
|
3041
3442
|
var checked = _ref.checked,
|
|
@@ -3048,7 +3449,7 @@ var Toggle = function Toggle(_ref) {
|
|
|
3048
3449
|
return React__default.createElement(Stack, {
|
|
3049
3450
|
space: 8
|
|
3050
3451
|
}, React__default.createElement("label", {
|
|
3051
|
-
className: styles$
|
|
3452
|
+
className: styles$u['toggle']
|
|
3052
3453
|
}, React__default.createElement("input", {
|
|
3053
3454
|
"data-testid": "toggle",
|
|
3054
3455
|
type: "checkbox",
|
|
@@ -3057,17 +3458,17 @@ var Toggle = function Toggle(_ref) {
|
|
|
3057
3458
|
disabled: disabled,
|
|
3058
3459
|
id: id
|
|
3059
3460
|
}), React__default.createElement("span", {
|
|
3060
|
-
className: styles$
|
|
3461
|
+
className: styles$u['toggle__switch']
|
|
3061
3462
|
}), label && React__default.createElement("span", {
|
|
3062
|
-
className: styles$
|
|
3463
|
+
className: styles$u['toggle__label']
|
|
3063
3464
|
}, label)), caption && React__default.createElement("span", {
|
|
3064
|
-
className: styles$
|
|
3465
|
+
className: styles$u['toggle__caption']
|
|
3065
3466
|
}, caption));
|
|
3066
3467
|
};
|
|
3067
3468
|
|
|
3068
|
-
var styles$
|
|
3469
|
+
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"};
|
|
3069
3470
|
|
|
3070
|
-
var styles$
|
|
3471
|
+
var styles$w = {"header":"_36nxW","sub-header":"_2XwRD"};
|
|
3071
3472
|
|
|
3072
3473
|
var ModalHeader = function ModalHeader(_ref) {
|
|
3073
3474
|
var header = _ref.header,
|
|
@@ -3079,12 +3480,12 @@ var ModalHeader = function ModalHeader(_ref) {
|
|
|
3079
3480
|
flex: [1],
|
|
3080
3481
|
alignItems: "center"
|
|
3081
3482
|
}, React__default.createElement("span", {
|
|
3082
|
-
className: styles$
|
|
3483
|
+
className: styles$w['header']
|
|
3083
3484
|
}, header), React__default.createElement(Button$1, {
|
|
3084
3485
|
theme: "link-icon",
|
|
3085
3486
|
onClick: onClose
|
|
3086
3487
|
}, React__default.createElement(IconClose, null))), subHeader && React__default.createElement("div", {
|
|
3087
|
-
className: styles$
|
|
3488
|
+
className: styles$w['sub-header']
|
|
3088
3489
|
}, subHeader));
|
|
3089
3490
|
};
|
|
3090
3491
|
|
|
@@ -3120,14 +3521,14 @@ var Modal = function Modal(_ref) {
|
|
|
3120
3521
|
contentLabel: "Modal",
|
|
3121
3522
|
appElement: rootElementId && document.getElementById(rootElementId) || undefined,
|
|
3122
3523
|
overlayClassName: {
|
|
3123
|
-
base: styles$
|
|
3124
|
-
afterOpen: styles$
|
|
3125
|
-
beforeClose: styles$
|
|
3524
|
+
base: styles$v['overlay'],
|
|
3525
|
+
afterOpen: styles$v['overlay--after-open'],
|
|
3526
|
+
beforeClose: styles$v['overlay--before-close']
|
|
3126
3527
|
},
|
|
3127
3528
|
className: {
|
|
3128
|
-
base: styles$
|
|
3129
|
-
afterOpen: styles$
|
|
3130
|
-
beforeClose: styles$
|
|
3529
|
+
base: styles$v['content'],
|
|
3530
|
+
afterOpen: styles$v['content--after-open'],
|
|
3531
|
+
beforeClose: styles$v['content--before-close']
|
|
3131
3532
|
}
|
|
3132
3533
|
}, React__default.createElement(ModalHeader, {
|
|
3133
3534
|
header: header,
|
|
@@ -3136,21 +3537,20 @@ var Modal = function Modal(_ref) {
|
|
|
3136
3537
|
}), children);
|
|
3137
3538
|
};
|
|
3138
3539
|
|
|
3139
|
-
Modal.setAppElement = function (
|
|
3140
|
-
|
|
3141
|
-
element && ReactModal.setAppElement(element);
|
|
3540
|
+
Modal.setAppElement = function (rootElement) {
|
|
3541
|
+
ReactModal.setAppElement(rootElement);
|
|
3142
3542
|
};
|
|
3143
3543
|
|
|
3144
|
-
var styles$
|
|
3544
|
+
var styles$x = {"modal-body":"_2J-ku"};
|
|
3145
3545
|
|
|
3146
3546
|
var ModalBody = function ModalBody(_ref) {
|
|
3147
3547
|
var children = _ref.children;
|
|
3148
3548
|
return React__default.createElement("div", {
|
|
3149
|
-
className: styles$
|
|
3549
|
+
className: styles$x['modal-body']
|
|
3150
3550
|
}, children);
|
|
3151
3551
|
};
|
|
3152
3552
|
|
|
3153
|
-
var styles$
|
|
3553
|
+
var styles$y = {"modal-footer":"_LKOr5","tertiary-container":"_Qktd-"};
|
|
3154
3554
|
|
|
3155
3555
|
var ModalFooter = function ModalFooter(_ref) {
|
|
3156
3556
|
var children = _ref.children,
|
|
@@ -3171,7 +3571,7 @@ var ModalFooter = function ModalFooter(_ref) {
|
|
|
3171
3571
|
return React__default.createElement(FooterContainer, null, React__default.createElement(Inline, {
|
|
3172
3572
|
justifyContent: "space-between"
|
|
3173
3573
|
}, React__default.createElement("div", {
|
|
3174
|
-
className: classnames((_classnames = {}, _classnames[styles$
|
|
3574
|
+
className: classnames((_classnames = {}, _classnames[styles$y['tertiary-container']] = tertiaryButton && tertiaryButton.props.theme.startsWith('link'), _classnames))
|
|
3175
3575
|
}, tertiaryButton || React__default.createElement("div", null)), React__default.createElement(Inline, {
|
|
3176
3576
|
space: 12
|
|
3177
3577
|
}, secondaryButton, primaryButton)));
|
|
@@ -3199,7 +3599,7 @@ var FooterContainer = function FooterContainer(_ref2) {
|
|
|
3199
3599
|
var childrenItens = React__default.Children.toArray(children);
|
|
3200
3600
|
var hasCustomAlignment = childrenItens.length === 1 && childrenItens[0].type === Inline;
|
|
3201
3601
|
return React__default.createElement("div", {
|
|
3202
|
-
className: styles$
|
|
3602
|
+
className: styles$y['modal-footer']
|
|
3203
3603
|
}, React__default.createElement(Inline, {
|
|
3204
3604
|
justifyContent: "end",
|
|
3205
3605
|
space: 12,
|
|
@@ -3207,7 +3607,7 @@ var FooterContainer = function FooterContainer(_ref2) {
|
|
|
3207
3607
|
}, children));
|
|
3208
3608
|
};
|
|
3209
3609
|
|
|
3210
|
-
var styles$
|
|
3610
|
+
var styles$z = {"badge":"_2f81N","badge--warning":"_2g1GI","badge--danger":"_2zLnM","badge--success":"_27QOo","badge--info":"_2gmsM"};
|
|
3211
3611
|
|
|
3212
3612
|
var _excluded$5 = ["children", "theme", "title"];
|
|
3213
3613
|
|
|
@@ -3230,22 +3630,23 @@ var Badge = function Badge(_ref, forwardedRef) {
|
|
|
3230
3630
|
overlay: title,
|
|
3231
3631
|
ref: ref
|
|
3232
3632
|
}, React__default.createElement("div", Object.assign({
|
|
3233
|
-
className: classnames(styles$
|
|
3633
|
+
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)),
|
|
3234
3634
|
ref: ref
|
|
3235
3635
|
}, otherProps), children));
|
|
3236
3636
|
};
|
|
3237
3637
|
|
|
3238
3638
|
var Badge$1 = forwardRef(Badge);
|
|
3239
3639
|
|
|
3240
|
-
var styles$
|
|
3640
|
+
var styles$A = {"avatar":"_2wJGB","avatar--small":"_3QTSo","avatar__badge":"_2Rl8S","avatar--medium":"_1zwj0","avatar--large":"_3-U6x","avatar--extra-large":"_3qn2q"};
|
|
3241
3641
|
|
|
3242
|
-
var styles$
|
|
3642
|
+
var styles$B = {"avatar-image":"_GKL9P"};
|
|
3243
3643
|
|
|
3244
3644
|
var AvatarImage = function AvatarImage(_ref) {
|
|
3245
3645
|
var url = _ref.url,
|
|
3246
3646
|
color = _ref.color,
|
|
3247
3647
|
_ref$alt = _ref.alt,
|
|
3248
|
-
alt = _ref$alt === void 0 ? 'Profile' : _ref$alt
|
|
3648
|
+
alt = _ref$alt === void 0 ? 'Profile' : _ref$alt,
|
|
3649
|
+
onImageFallbackError = _ref.onImageFallbackError;
|
|
3249
3650
|
|
|
3250
3651
|
var _useState = useState(false),
|
|
3251
3652
|
hasImageError = _useState[0],
|
|
@@ -3257,12 +3658,13 @@ var AvatarImage = function AvatarImage(_ref) {
|
|
|
3257
3658
|
alt: alt,
|
|
3258
3659
|
onError: function onError() {
|
|
3259
3660
|
setHasImageError(true);
|
|
3661
|
+
onImageFallbackError();
|
|
3260
3662
|
}
|
|
3261
3663
|
});
|
|
3262
3664
|
}
|
|
3263
3665
|
|
|
3264
3666
|
return React__default.createElement("div", {
|
|
3265
|
-
className: styles$
|
|
3667
|
+
className: styles$B['avatar-image']
|
|
3266
3668
|
}, React__default.createElement(IconUser, {
|
|
3267
3669
|
size: "flexible",
|
|
3268
3670
|
color: color
|
|
@@ -3319,25 +3721,32 @@ var Avatar = function Avatar(_ref) {
|
|
|
3319
3721
|
badge = _ref.badge,
|
|
3320
3722
|
alt = _ref.alt;
|
|
3321
3723
|
|
|
3322
|
-
var _useState = useState(
|
|
3724
|
+
var _useState = useState(false),
|
|
3725
|
+
showIconInsteadOfImage = _useState[0],
|
|
3726
|
+
setShowIconInsteadOfImage = _useState[1];
|
|
3727
|
+
|
|
3728
|
+
var _useState2 = useState(function () {
|
|
3323
3729
|
return PROFILE_IMAGES[Math.floor(Math.random() * PROFILE_IMAGES.length)];
|
|
3324
3730
|
}),
|
|
3325
|
-
defaultProfilePictureColors =
|
|
3731
|
+
defaultProfilePictureColors = _useState2[0];
|
|
3326
3732
|
|
|
3327
3733
|
var backgroundColor = url ? GREY200 : color;
|
|
3328
3734
|
return React__default.createElement("div", {
|
|
3329
|
-
className: classnames(styles$
|
|
3735
|
+
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)),
|
|
3330
3736
|
style: {
|
|
3331
|
-
backgroundColor: children || url ? backgroundColor : defaultProfilePictureColors.backgroundColor
|
|
3737
|
+
backgroundColor: children || url && !showIconInsteadOfImage ? backgroundColor : defaultProfilePictureColors.backgroundColor
|
|
3332
3738
|
}
|
|
3333
3739
|
}, children || React__default.createElement(AvatarImage, {
|
|
3334
3740
|
url: url,
|
|
3335
3741
|
color: defaultProfilePictureColors.avatarColor,
|
|
3336
|
-
alt: alt
|
|
3742
|
+
alt: alt,
|
|
3743
|
+
onImageFallbackError: function onImageFallbackError() {
|
|
3744
|
+
return setShowIconInsteadOfImage(true);
|
|
3745
|
+
}
|
|
3337
3746
|
}), badge && size !== 'small' && React__default.createElement("div", {
|
|
3338
|
-
className: styles$
|
|
3747
|
+
className: styles$A['avatar__badge']
|
|
3339
3748
|
}, badge));
|
|
3340
3749
|
};
|
|
3341
3750
|
|
|
3342
|
-
export { Avatar, Badge$1 as Badge, Button$1 as Button, CheckboxField, DateField, DateRangeField, Form, FormRow, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconCalendar, IconChevronDown, IconChevronUp, IconClose, IconComment, IconDelete, IconEdit, IconExclaim, IconEye, IconEyeSlash, IconLocation, IconMinusCircle, IconMore, IconRemove, IconUser, IconUserPlus, Inline, Modal, ModalBody, ModalFooter, MultiSelectField, PaginationControls, PasswordField, RadioGroupField, RadioGroupOption, ResourceTable, ResourceTableRow, SIZE_25_PERCENT, SIZE_33_PERCENT, SIZE_50_PERCENT, SIZE_66_PERCENT, SIZE_75_PERCENT, SelectField, Spinner, Stack, TextAreaField, TextField$1 as TextField, Toggle, Tooltip$1 as Tooltip, WeekField };
|
|
3751
|
+
export { Avatar, Badge$1 as Badge, Button$1 as Button, CheckboxField, DataTable, DataTableCell, DataTableEditableCell, DataTableRow, DateField, DateRangeField, Form, FormRow, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconCalendar, IconChevronDown, IconChevronUp, IconClose, IconComment, IconDelete, IconEdit, IconExclaim, IconEye, IconEyeSlash, IconLocation, IconMinusCircle, IconMore, IconRemove, IconUser, IconUserPlus, Inline, Modal, ModalBody, ModalFooter, MultiSelectField, PaginationControls, PasswordField, RadioGroupField, RadioGroupOption, ResourceTable, ResourceTableRow, SIZE_25_PERCENT, SIZE_33_PERCENT, SIZE_50_PERCENT, SIZE_66_PERCENT, SIZE_75_PERCENT, SelectField, Spinner, Stack, TextAreaField, TextField$1 as TextField, Toggle, Tooltip$1 as Tooltip, WeekField };
|
|
3343
3752
|
//# sourceMappingURL=index.modern.js.map
|