@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.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,13 +1285,584 @@ 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);
|
|
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;
|
|
1301
|
+
};
|
|
1302
|
+
|
|
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"};
|
|
1304
|
+
|
|
1305
|
+
var DataTableRow = function DataTableRow(_ref) {
|
|
1306
|
+
var _classnames;
|
|
1307
|
+
|
|
1308
|
+
var children = _ref.children,
|
|
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;
|
|
1316
|
+
|
|
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
|
+
}
|
|
1386
|
+
};
|
|
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);
|
|
1482
|
+
return React__default.createElement(Context$1.Provider, {
|
|
1483
|
+
value: {
|
|
1484
|
+
columns: columns,
|
|
1485
|
+
showActionMenu: showActionMenu,
|
|
1486
|
+
numberOfRows: numberOfRows,
|
|
1487
|
+
hasVerticalBorders: hasVerticalBorders
|
|
1488
|
+
}
|
|
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
|
+
}))));
|
|
1518
|
+
};
|
|
1519
|
+
|
|
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;
|
|
1542
|
+
|
|
1543
|
+
var children = _ref.children,
|
|
1544
|
+
columnIndex = _ref.columnIndex;
|
|
1545
|
+
|
|
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);
|
|
1287
1559
|
return context || {};
|
|
1288
1560
|
};
|
|
1289
1561
|
|
|
1290
|
-
var
|
|
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);
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
var formikState = getFormikState(name, formik);
|
|
1649
|
+
|
|
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
|
+
}
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
return controllers;
|
|
1674
|
+
};
|
|
1675
|
+
|
|
1676
|
+
var styles$d = {"label":"_h724f"};
|
|
1677
|
+
|
|
1678
|
+
var Label = function Label(_ref) {
|
|
1679
|
+
var htmlFor = _ref.htmlFor,
|
|
1680
|
+
children = _ref.children;
|
|
1681
|
+
return React__default.createElement("label", {
|
|
1682
|
+
htmlFor: htmlFor,
|
|
1683
|
+
className: styles$d['label']
|
|
1684
|
+
}, children);
|
|
1685
|
+
};
|
|
1686
|
+
|
|
1687
|
+
var styles$e = {"caption":"_1DWBq"};
|
|
1688
|
+
|
|
1689
|
+
var Caption = function Caption(_ref) {
|
|
1690
|
+
var fieldId = _ref.fieldId,
|
|
1691
|
+
children = _ref.children;
|
|
1692
|
+
return React__default.createElement("div", {
|
|
1693
|
+
id: fieldId && fieldId + "-describer",
|
|
1694
|
+
className: styles$e['caption']
|
|
1695
|
+
}, children);
|
|
1696
|
+
};
|
|
1697
|
+
|
|
1698
|
+
var WHITE = '#ffffff';
|
|
1699
|
+
var EGGPLANT200 = '#d3dbf4';
|
|
1700
|
+
var EGGPLANT300 = '#a7b7ea';
|
|
1701
|
+
var EGGPLANT400 = '#6d87dd';
|
|
1702
|
+
var EGGPLANT700 = '#32295c';
|
|
1703
|
+
var RADISH400 = '#e76767';
|
|
1704
|
+
var GREY100 = '#f8f8f8';
|
|
1705
|
+
var GREY200 = '#e0e0e0';
|
|
1706
|
+
var GREY300 = '#c1c1c1';
|
|
1707
|
+
var GREY400 = '#929292';
|
|
1708
|
+
var GREY500 = '#555555';
|
|
1709
|
+
var GREY600 = '#464646';
|
|
1710
|
+
|
|
1711
|
+
var styles$f = {"error-message":"_nZ2MD"};
|
|
1712
|
+
|
|
1713
|
+
var ErrorMessage = function ErrorMessage(_ref) {
|
|
1714
|
+
var fieldId = _ref.fieldId,
|
|
1715
|
+
children = _ref.children;
|
|
1716
|
+
return React__default.createElement("div", {
|
|
1717
|
+
id: fieldId && fieldId + "-error-message",
|
|
1718
|
+
className: styles$f['error-message']
|
|
1719
|
+
}, React__default.createElement(Inline, {
|
|
1720
|
+
space: 8,
|
|
1721
|
+
alignItems: "center"
|
|
1722
|
+
}, React__default.createElement(IconDelete, {
|
|
1723
|
+
color: RADISH400,
|
|
1724
|
+
size: "medium"
|
|
1725
|
+
}), children));
|
|
1726
|
+
};
|
|
1727
|
+
|
|
1728
|
+
var Field = function Field(_ref) {
|
|
1729
|
+
var id = _ref.id,
|
|
1730
|
+
label = _ref.label,
|
|
1731
|
+
caption = _ref.caption,
|
|
1732
|
+
error = _ref.error,
|
|
1733
|
+
children = _ref.children;
|
|
1734
|
+
return React__default.createElement(Stack, {
|
|
1735
|
+
space: 8,
|
|
1736
|
+
flexItems: true
|
|
1737
|
+
}, label && React__default.createElement(Label, {
|
|
1738
|
+
htmlFor: id
|
|
1739
|
+
}, label), children, caption && React__default.createElement(Caption, {
|
|
1740
|
+
fieldId: id
|
|
1741
|
+
}, caption), error && React__default.createElement(ErrorMessage, {
|
|
1742
|
+
fieldId: id
|
|
1743
|
+
}, error));
|
|
1744
|
+
};
|
|
1745
|
+
|
|
1746
|
+
var styles$g = {"affix-container":"_ybKOk","affix-container--prefixed":"_2COk3","affix-container--suffixed":"_1xXXN","prefix":"_eX5OL","suffix":"__YH01"};
|
|
1747
|
+
|
|
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));
|
|
1795
|
+
};
|
|
1796
|
+
|
|
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
|
+
|
|
1802
|
+
var name = _ref.name,
|
|
1803
|
+
columnIndex = _ref.columnIndex,
|
|
1804
|
+
rowIndex = _ref.rowIndex,
|
|
1805
|
+
inputId = _ref.id,
|
|
1806
|
+
value = _ref.value,
|
|
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({
|
|
1830
|
+
name: name,
|
|
1831
|
+
id: inputId,
|
|
1832
|
+
value: value,
|
|
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"};
|
|
1291
1866
|
|
|
1292
1867
|
var Form = function Form(_ref) {
|
|
1293
1868
|
var _classnames;
|
|
@@ -1305,13 +1880,13 @@ var Form = function Form(_ref) {
|
|
|
1305
1880
|
onSubmit && onSubmit(e.currentTarget.elements);
|
|
1306
1881
|
};
|
|
1307
1882
|
|
|
1308
|
-
return React__default.createElement(Context$
|
|
1883
|
+
return React__default.createElement(Context$2.Provider, {
|
|
1309
1884
|
value: {
|
|
1310
1885
|
formik: formik
|
|
1311
1886
|
}
|
|
1312
1887
|
}, React__default.createElement("form", {
|
|
1313
1888
|
onSubmit: onSubmit ? handleSubmit : formik === null || formik === void 0 ? void 0 : formik.handleSubmit,
|
|
1314
|
-
className: classnames((_classnames = {}, _classnames[styles$
|
|
1889
|
+
className: classnames((_classnames = {}, _classnames[styles$i['form--standard-size']] = !wide, _classnames)),
|
|
1315
1890
|
"data-testid": "form"
|
|
1316
1891
|
}, stackContent ? React__default.createElement(Stack, null, children) : children));
|
|
1317
1892
|
};
|
|
@@ -1350,191 +1925,7 @@ var FormRow = function FormRow(_ref) {
|
|
|
1350
1925
|
}));
|
|
1351
1926
|
};
|
|
1352
1927
|
|
|
1353
|
-
var styles$
|
|
1354
|
-
|
|
1355
|
-
var Label = function Label(_ref) {
|
|
1356
|
-
var htmlFor = _ref.htmlFor,
|
|
1357
|
-
children = _ref.children;
|
|
1358
|
-
return React__default.createElement("label", {
|
|
1359
|
-
htmlFor: htmlFor,
|
|
1360
|
-
className: styles$b['label']
|
|
1361
|
-
}, children);
|
|
1362
|
-
};
|
|
1363
|
-
|
|
1364
|
-
var styles$c = {"caption":"_1DWBq"};
|
|
1365
|
-
|
|
1366
|
-
var Caption = function Caption(_ref) {
|
|
1367
|
-
var fieldId = _ref.fieldId,
|
|
1368
|
-
children = _ref.children;
|
|
1369
|
-
return React__default.createElement("div", {
|
|
1370
|
-
id: fieldId && fieldId + "-describer",
|
|
1371
|
-
className: styles$c['caption']
|
|
1372
|
-
}, children);
|
|
1373
|
-
};
|
|
1374
|
-
|
|
1375
|
-
var WHITE = '#ffffff';
|
|
1376
|
-
var EGGPLANT200 = '#d3dbf4';
|
|
1377
|
-
var EGGPLANT300 = '#a7b7ea';
|
|
1378
|
-
var EGGPLANT400 = '#6d87dd';
|
|
1379
|
-
var EGGPLANT700 = '#32295c';
|
|
1380
|
-
var RADISH400 = '#e76767';
|
|
1381
|
-
var GREY100 = '#f8f8f8';
|
|
1382
|
-
var GREY200 = '#e0e0e0';
|
|
1383
|
-
var GREY300 = '#c1c1c1';
|
|
1384
|
-
var GREY400 = '#929292';
|
|
1385
|
-
var GREY500 = '#555555';
|
|
1386
|
-
var GREY600 = '#464646';
|
|
1387
|
-
|
|
1388
|
-
var styles$d = {"error-message":"_nZ2MD"};
|
|
1389
|
-
|
|
1390
|
-
var ErrorMessage = function ErrorMessage(_ref) {
|
|
1391
|
-
var fieldId = _ref.fieldId,
|
|
1392
|
-
children = _ref.children;
|
|
1393
|
-
return React__default.createElement("div", {
|
|
1394
|
-
id: fieldId && fieldId + "-error-message",
|
|
1395
|
-
className: styles$d['error-message']
|
|
1396
|
-
}, React__default.createElement(Inline, {
|
|
1397
|
-
space: 8,
|
|
1398
|
-
alignItems: "center"
|
|
1399
|
-
}, React__default.createElement(IconDelete, {
|
|
1400
|
-
color: RADISH400,
|
|
1401
|
-
size: "medium"
|
|
1402
|
-
}), children));
|
|
1403
|
-
};
|
|
1404
|
-
|
|
1405
|
-
var Field = function Field(_ref) {
|
|
1406
|
-
var id = _ref.id,
|
|
1407
|
-
label = _ref.label,
|
|
1408
|
-
caption = _ref.caption,
|
|
1409
|
-
error = _ref.error,
|
|
1410
|
-
children = _ref.children;
|
|
1411
|
-
return React__default.createElement(Stack, {
|
|
1412
|
-
space: 8,
|
|
1413
|
-
flexItems: true
|
|
1414
|
-
}, label && React__default.createElement(Label, {
|
|
1415
|
-
htmlFor: id
|
|
1416
|
-
}, label), children, caption && React__default.createElement(Caption, {
|
|
1417
|
-
fieldId: id
|
|
1418
|
-
}, caption), error && React__default.createElement(ErrorMessage, {
|
|
1419
|
-
fieldId: id
|
|
1420
|
-
}, error));
|
|
1421
|
-
};
|
|
1422
|
-
|
|
1423
|
-
var styles$e = {"text-field":"_BkzdC","text-field--focus":"_Rop31","text-field--disabled":"_2x3Cm","text-field--invalid":"_3zOwV","text-field__toolbar":"_rQqnL"};
|
|
1424
|
-
|
|
1425
|
-
var useFieldId = function useFieldId(_ref) {
|
|
1426
|
-
var name = _ref.name,
|
|
1427
|
-
inputId = _ref.id;
|
|
1428
|
-
var id = useMemo(function () {
|
|
1429
|
-
return inputId ? inputId : name + "-" + Math.random();
|
|
1430
|
-
}, [inputId, name]);
|
|
1431
|
-
return id;
|
|
1432
|
-
};
|
|
1433
|
-
|
|
1434
|
-
var getFormikState = function getFormikState(name, formik) {
|
|
1435
|
-
if (formik === undefined) {
|
|
1436
|
-
return null;
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
if (Object.keys(formik.values).includes(name)) {
|
|
1440
|
-
return {
|
|
1441
|
-
error: formik.touched[name] ? formik.errors[name] : undefined,
|
|
1442
|
-
value: formik.values[name]
|
|
1443
|
-
};
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
var formikArray = getFormikArrayPath(name);
|
|
1447
|
-
|
|
1448
|
-
if (formikArray) {
|
|
1449
|
-
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;
|
|
1450
|
-
|
|
1451
|
-
var arrayName = formikArray.arrayName,
|
|
1452
|
-
itemIndex = formikArray.itemIndex,
|
|
1453
|
-
fieldName = formikArray.fieldName;
|
|
1454
|
-
return {
|
|
1455
|
-
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,
|
|
1456
|
-
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]
|
|
1457
|
-
};
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
return null;
|
|
1461
|
-
};
|
|
1462
|
-
|
|
1463
|
-
var getFormikArrayPath = function getFormikArrayPath(name) {
|
|
1464
|
-
if (!name.includes('[')) {
|
|
1465
|
-
return false;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
var _name$split = name.split('['),
|
|
1469
|
-
arrayName = _name$split[0],
|
|
1470
|
-
missingSplit = _name$split[1];
|
|
1471
|
-
|
|
1472
|
-
var _missingSplit$split = missingSplit.split('].'),
|
|
1473
|
-
itemIndex = _missingSplit$split[0],
|
|
1474
|
-
fieldName = _missingSplit$split[1];
|
|
1475
|
-
|
|
1476
|
-
return {
|
|
1477
|
-
arrayName: arrayName,
|
|
1478
|
-
itemIndex: itemIndex,
|
|
1479
|
-
fieldName: fieldName
|
|
1480
|
-
};
|
|
1481
|
-
};
|
|
1482
|
-
|
|
1483
|
-
var useFieldControllers = function useFieldControllers(_ref) {
|
|
1484
|
-
var name = _ref.name,
|
|
1485
|
-
inputId = _ref.id,
|
|
1486
|
-
value = _ref.value,
|
|
1487
|
-
_onChange = _ref.onChange,
|
|
1488
|
-
_onBlur = _ref.onBlur,
|
|
1489
|
-
error = _ref.error,
|
|
1490
|
-
_ref$type = _ref.type,
|
|
1491
|
-
type = _ref$type === void 0 ? 'text' : _ref$type;
|
|
1492
|
-
|
|
1493
|
-
var _useFormContext = useFormContext(),
|
|
1494
|
-
formik = _useFormContext.formik;
|
|
1495
|
-
|
|
1496
|
-
var id = useFieldId({
|
|
1497
|
-
name: name,
|
|
1498
|
-
id: inputId
|
|
1499
|
-
});
|
|
1500
|
-
var controllers = {
|
|
1501
|
-
id: id,
|
|
1502
|
-
error: error,
|
|
1503
|
-
value: value,
|
|
1504
|
-
onChange: function onChange(e) {
|
|
1505
|
-
return _onChange && _onChange(e.target.value);
|
|
1506
|
-
},
|
|
1507
|
-
onBlur: function onBlur(e) {
|
|
1508
|
-
return _onBlur && _onBlur(e.target.value);
|
|
1509
|
-
}
|
|
1510
|
-
};
|
|
1511
|
-
var formikState = getFormikState(name, formik);
|
|
1512
|
-
|
|
1513
|
-
if (formik && formikState) {
|
|
1514
|
-
var currencyBlur = function currencyBlur() {
|
|
1515
|
-
if (type === 'currency') {
|
|
1516
|
-
formik.setFieldValue(name, Number(value).toFixed(2));
|
|
1517
|
-
}
|
|
1518
|
-
};
|
|
1519
|
-
|
|
1520
|
-
controllers = _extends({}, controllers, {
|
|
1521
|
-
error: error !== undefined ? controllers.error : formikState.error,
|
|
1522
|
-
value: value !== undefined ? controllers.value : formikState.value,
|
|
1523
|
-
onChange: _onChange ? controllers.onChange : function (e) {
|
|
1524
|
-
return formik.setFieldValue(name, e.target.value);
|
|
1525
|
-
},
|
|
1526
|
-
onBlur: _onBlur ? function (e) {
|
|
1527
|
-
controllers.onBlur(e);
|
|
1528
|
-
currencyBlur();
|
|
1529
|
-
} : function () {
|
|
1530
|
-
formik.setFieldTouched(name);
|
|
1531
|
-
currencyBlur();
|
|
1532
|
-
}
|
|
1533
|
-
});
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
return controllers;
|
|
1537
|
-
};
|
|
1928
|
+
var styles$j = {"text-field":"_BkzdC","text-field--focus":"_Rop31","text-field--disabled":"_2x3Cm","text-field--invalid":"_3zOwV","text-field__toolbar":"_rQqnL"};
|
|
1538
1929
|
|
|
1539
1930
|
var useGrowTextAreaRef = function useGrowTextAreaRef(minHeight, maxHeight, autoGrow, forwardedRef) {
|
|
1540
1931
|
var textareaRef = useRef(null);
|
|
@@ -1609,7 +2000,7 @@ var TextAreaField = function TextAreaField(_ref) {
|
|
|
1609
2000
|
updateHeight = _useGrowTextAreaRef.updateHeight;
|
|
1610
2001
|
|
|
1611
2002
|
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
|
|
1612
|
-
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)),
|
|
1613
2004
|
ref: containerRef,
|
|
1614
2005
|
onClick: function onClick(event) {
|
|
1615
2006
|
if (event.target === (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current)) {
|
|
@@ -1641,7 +2032,7 @@ var TextAreaField = function TextAreaField(_ref) {
|
|
|
1641
2032
|
},
|
|
1642
2033
|
ref: textAreaRef
|
|
1643
2034
|
}), toolbar && React__default.createElement("div", {
|
|
1644
|
-
className: styles$
|
|
2035
|
+
className: styles$j['text-field__toolbar'],
|
|
1645
2036
|
id: controllers.id + "-toolbar",
|
|
1646
2037
|
ref: toolbarRef,
|
|
1647
2038
|
onClick: function onClick(event) {
|
|
@@ -1654,58 +2045,7 @@ var TextAreaField = function TextAreaField(_ref) {
|
|
|
1654
2045
|
}, toolbar)));
|
|
1655
2046
|
};
|
|
1656
2047
|
|
|
1657
|
-
var styles$
|
|
1658
|
-
|
|
1659
|
-
var AffixContainer = function AffixContainer(_ref) {
|
|
1660
|
-
var _classnames;
|
|
1661
|
-
|
|
1662
|
-
var prefix = _ref.prefix,
|
|
1663
|
-
suffix = _ref.suffix,
|
|
1664
|
-
children = _ref.children;
|
|
1665
|
-
var container = useRef(null);
|
|
1666
|
-
var prefixElement = useRef(null);
|
|
1667
|
-
var suffixElement = useRef(null);
|
|
1668
|
-
useLayoutEffect(function () {
|
|
1669
|
-
if (container.current) {
|
|
1670
|
-
var input = container.current.querySelector('input, [class$=control] > div');
|
|
1671
|
-
|
|
1672
|
-
if (input) {
|
|
1673
|
-
if (prefix && prefixElement.current) {
|
|
1674
|
-
var _prefixElement$curren;
|
|
1675
|
-
|
|
1676
|
-
var prefixWidth = prefixElement === null || prefixElement === void 0 ? void 0 : (_prefixElement$curren = prefixElement.current) === null || _prefixElement$curren === void 0 ? void 0 : _prefixElement$curren.offsetWidth;
|
|
1677
|
-
input.style.paddingLeft = prefixWidth + 'px';
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
if (suffix && suffixElement.current) {
|
|
1681
|
-
var suffixWidth = suffixElement.current.offsetWidth;
|
|
1682
|
-
input.style.paddingRight = suffixWidth + 'px';
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
}, [prefix, suffix]);
|
|
1687
|
-
var hasPrefix = !!prefix;
|
|
1688
|
-
var hasSuffix = !!suffix;
|
|
1689
|
-
|
|
1690
|
-
if (!hasPrefix && !hasSuffix) {
|
|
1691
|
-
return children;
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
var classes = classnames(styles$f['affix-container'], (_classnames = {}, _classnames[styles$f['affix-container--prefixed']] = hasPrefix, _classnames[styles$f['affix-container--suffixed']] = hasSuffix, _classnames));
|
|
1695
|
-
return React__default.createElement("div", {
|
|
1696
|
-
className: classes,
|
|
1697
|
-
ref: container,
|
|
1698
|
-
"data-testid": "affix-container"
|
|
1699
|
-
}, hasPrefix && React__default.createElement("div", {
|
|
1700
|
-
className: styles$f['prefix'],
|
|
1701
|
-
ref: prefixElement
|
|
1702
|
-
}, prefix), children, hasSuffix && React__default.createElement("div", {
|
|
1703
|
-
className: styles$f['suffix'],
|
|
1704
|
-
ref: suffixElement
|
|
1705
|
-
}, suffix));
|
|
1706
|
-
};
|
|
1707
|
-
|
|
1708
|
-
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"};
|
|
1709
2049
|
|
|
1710
2050
|
var TextField = function TextField(_ref, ref) {
|
|
1711
2051
|
var _classnames;
|
|
@@ -1746,7 +2086,7 @@ var TextField = function TextField(_ref, ref) {
|
|
|
1746
2086
|
}, React__default.createElement("input", {
|
|
1747
2087
|
name: name,
|
|
1748
2088
|
id: controllers.id,
|
|
1749
|
-
className: classnames(styles$
|
|
2089
|
+
className: classnames(styles$k['text-field'], (_classnames = {}, _classnames[styles$k['text-field--invalid']] = hasError, _classnames)),
|
|
1750
2090
|
type: "text",
|
|
1751
2091
|
"data-testid": "text-field-" + name,
|
|
1752
2092
|
"aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
@@ -1811,7 +2151,7 @@ var useCheckBoxFieldControllers = function useCheckBoxFieldControllers(_ref) {
|
|
|
1811
2151
|
return controllers;
|
|
1812
2152
|
};
|
|
1813
2153
|
|
|
1814
|
-
var styles$
|
|
2154
|
+
var styles$l = {"check-box-field":"_2sg0c","check-box-field__caption":"_2LdrP","check-box-field__custom-input":"_2mA8e"};
|
|
1815
2155
|
|
|
1816
2156
|
var CheckboxField = function CheckboxField(_ref) {
|
|
1817
2157
|
var name = _ref.name,
|
|
@@ -1838,7 +2178,7 @@ var CheckboxField = function CheckboxField(_ref) {
|
|
|
1838
2178
|
space: 8,
|
|
1839
2179
|
alignItems: "center"
|
|
1840
2180
|
}, React__default.createElement("div", {
|
|
1841
|
-
className: styles$
|
|
2181
|
+
className: styles$l['check-box-field']
|
|
1842
2182
|
}, React__default.createElement("input", {
|
|
1843
2183
|
name: name,
|
|
1844
2184
|
id: controllers.id,
|
|
@@ -1851,11 +2191,11 @@ var CheckboxField = function CheckboxField(_ref) {
|
|
|
1851
2191
|
onChange: controllers.onChange,
|
|
1852
2192
|
onBlur: controllers.onBlur
|
|
1853
2193
|
}), React__default.createElement("span", {
|
|
1854
|
-
className: styles$
|
|
2194
|
+
className: styles$l['check-box-field__custom-input']
|
|
1855
2195
|
})), label && React__default.createElement(Label, {
|
|
1856
2196
|
htmlFor: controllers.id
|
|
1857
2197
|
}, label)), caption && React__default.createElement("div", {
|
|
1858
|
-
className: styles$
|
|
2198
|
+
className: styles$l['check-box-field__caption']
|
|
1859
2199
|
}, React__default.createElement(Caption, {
|
|
1860
2200
|
fieldId: controllers.id
|
|
1861
2201
|
}, caption)), controllers.error && React__default.createElement(ErrorMessage, {
|
|
@@ -1906,7 +2246,7 @@ var useRadioGroupFieldContext = function useRadioGroupFieldContext() {
|
|
|
1906
2246
|
return context;
|
|
1907
2247
|
};
|
|
1908
2248
|
|
|
1909
|
-
var styles$
|
|
2249
|
+
var styles$m = {"label":"_1WGz2","radio-group-field__label":"_RXyG_"};
|
|
1910
2250
|
|
|
1911
2251
|
var RadioGroupField = function RadioGroupField(_ref) {
|
|
1912
2252
|
var name = _ref.name,
|
|
@@ -1939,7 +2279,7 @@ var RadioGroupField = function RadioGroupField(_ref) {
|
|
|
1939
2279
|
}, React__default.createElement(Stack, {
|
|
1940
2280
|
space: 12
|
|
1941
2281
|
}, label && React__default.createElement("div", {
|
|
1942
|
-
className: styles$
|
|
2282
|
+
className: styles$m['radio-group-field__label']
|
|
1943
2283
|
}, label), React__default.createElement(Stack, {
|
|
1944
2284
|
space: 8
|
|
1945
2285
|
}, inline ? React__default.createElement(InlineOptions, null, children) : React__default.createElement(Stack, {
|
|
@@ -1973,7 +2313,7 @@ var InlineOptions = function InlineOptions(_ref2) {
|
|
|
1973
2313
|
return React__default.createElement(FormRow, null, children);
|
|
1974
2314
|
};
|
|
1975
2315
|
|
|
1976
|
-
var styles$
|
|
2316
|
+
var styles$n = {"radio-group-option":"_1Clmp","radio-group-option__caption":"_3UmWA","radio-group-option__custom-input":"_1tMq-"};
|
|
1977
2317
|
|
|
1978
2318
|
var RadioGroupOption = function RadioGroupOption(_ref) {
|
|
1979
2319
|
var value = _ref.value,
|
|
@@ -1991,7 +2331,7 @@ var RadioGroupOption = function RadioGroupOption(_ref) {
|
|
|
1991
2331
|
space: 8,
|
|
1992
2332
|
alignItems: "center"
|
|
1993
2333
|
}, React__default.createElement("div", {
|
|
1994
|
-
className: styles$
|
|
2334
|
+
className: styles$n['radio-group-option']
|
|
1995
2335
|
}, React__default.createElement("input", {
|
|
1996
2336
|
type: "radio",
|
|
1997
2337
|
id: id,
|
|
@@ -2001,19 +2341,19 @@ var RadioGroupOption = function RadioGroupOption(_ref) {
|
|
|
2001
2341
|
checked: radioGroupContext.value !== undefined ? radioGroupContext.value === value : undefined,
|
|
2002
2342
|
disabled: radioGroupContext.disabled
|
|
2003
2343
|
}), React__default.createElement("span", {
|
|
2004
|
-
className: styles$
|
|
2344
|
+
className: styles$n['radio-group-option__custom-input']
|
|
2005
2345
|
})), label && React__default.createElement(Label, {
|
|
2006
2346
|
htmlFor: id
|
|
2007
2347
|
}, label)), caption && React__default.createElement("div", {
|
|
2008
|
-
className: styles$
|
|
2348
|
+
className: styles$n['radio-group-option__caption']
|
|
2009
2349
|
}, React__default.createElement(Caption, {
|
|
2010
2350
|
fieldId: id
|
|
2011
2351
|
}, caption)));
|
|
2012
2352
|
};
|
|
2013
2353
|
|
|
2014
|
-
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"};
|
|
2015
2355
|
|
|
2016
|
-
var styles$
|
|
2356
|
+
var styles$p = {"password-criteria":"_U0krC","password-criteria--invalid":"_2XIl4"};
|
|
2017
2357
|
|
|
2018
2358
|
var PasswordCriteria = function PasswordCriteria(_ref) {
|
|
2019
2359
|
var _classnames;
|
|
@@ -2021,7 +2361,7 @@ var PasswordCriteria = function PasswordCriteria(_ref) {
|
|
|
2021
2361
|
var met = _ref.met,
|
|
2022
2362
|
children = _ref.children;
|
|
2023
2363
|
return React__default.createElement("span", {
|
|
2024
|
-
className: classnames(styles$
|
|
2364
|
+
className: classnames(styles$p['password-criteria'], (_classnames = {}, _classnames[styles$p['password-criteria--invalid']] = !met, _classnames))
|
|
2025
2365
|
}, "\u25CF ", children);
|
|
2026
2366
|
};
|
|
2027
2367
|
|
|
@@ -2100,11 +2440,11 @@ var PasswordField = function PasswordField(_ref) {
|
|
|
2100
2440
|
error: controllers.error
|
|
2101
2441
|
};
|
|
2102
2442
|
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
|
|
2103
|
-
className: styles$
|
|
2443
|
+
className: styles$o['password-container']
|
|
2104
2444
|
}, React__default.createElement("input", {
|
|
2105
2445
|
name: name,
|
|
2106
2446
|
id: controllers.id,
|
|
2107
|
-
className: classnames(styles$
|
|
2447
|
+
className: classnames(styles$o['text-field'], (_classnames = {}, _classnames[styles$o['text-field--invalid']] = hasError, _classnames)),
|
|
2108
2448
|
type: type,
|
|
2109
2449
|
"data-testid": "text-field-" + name,
|
|
2110
2450
|
"aria-describedby": hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
@@ -2116,7 +2456,7 @@ var PasswordField = function PasswordField(_ref) {
|
|
|
2116
2456
|
onChange: controllers.onChange,
|
|
2117
2457
|
onBlur: controllers.onBlur
|
|
2118
2458
|
}), React__default.createElement("div", {
|
|
2119
|
-
className: styles$
|
|
2459
|
+
className: styles$o['password-toggle'],
|
|
2120
2460
|
onClick: toggleType,
|
|
2121
2461
|
onKeyPress: toggleType,
|
|
2122
2462
|
"data-testid": "password-toggle",
|
|
@@ -2410,7 +2750,7 @@ var useSelectFieldControllers = function useSelectFieldControllers(_ref) {
|
|
|
2410
2750
|
return controllers;
|
|
2411
2751
|
};
|
|
2412
2752
|
|
|
2413
|
-
var styles$
|
|
2753
|
+
var styles$q = {"custom-control":"_1cDCR"};
|
|
2414
2754
|
|
|
2415
2755
|
var _excluded$3 = ["children", "CustomPrefixComponent"];
|
|
2416
2756
|
|
|
@@ -2423,7 +2763,7 @@ function CustomControl(_ref) {
|
|
|
2423
2763
|
|
|
2424
2764
|
var selectedOption = (_props$getValue = props.getValue()) === null || _props$getValue === void 0 ? void 0 : _props$getValue[0];
|
|
2425
2765
|
return React__default.createElement(components.Control, Object.assign({}, props), CustomControl && selectedOption ? React__default.createElement("div", {
|
|
2426
|
-
className: styles$
|
|
2766
|
+
className: styles$q['custom-control'],
|
|
2427
2767
|
style: {
|
|
2428
2768
|
paddingLeft: selectedOption ? 8 : 0
|
|
2429
2769
|
}
|
|
@@ -2579,7 +2919,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref) {
|
|
|
2579
2919
|
|
|
2580
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"};
|
|
2581
2921
|
|
|
2582
|
-
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"};
|
|
2583
2923
|
|
|
2584
2924
|
function parseDate(str, format, locale) {
|
|
2585
2925
|
var parsed = dateFnsParse(str, format, new Date(), {
|
|
@@ -2658,7 +2998,7 @@ var DateField = function DateField(_ref) {
|
|
|
2658
2998
|
error: controllers.error
|
|
2659
2999
|
};
|
|
2660
3000
|
var dayPickerProps = {
|
|
2661
|
-
classNames: styles$
|
|
3001
|
+
classNames: styles$r,
|
|
2662
3002
|
disabledDays: function disabledDays(day) {
|
|
2663
3003
|
return _disabledDays && _disabledDays(setToMidnight(day));
|
|
2664
3004
|
},
|
|
@@ -2675,7 +3015,7 @@ var DateField = function DateField(_ref) {
|
|
|
2675
3015
|
})
|
|
2676
3016
|
}, React__default.createElement(DayPickerInput, {
|
|
2677
3017
|
format: format,
|
|
2678
|
-
classNames: styles$
|
|
3018
|
+
classNames: styles$r,
|
|
2679
3019
|
formatDate: formatDate,
|
|
2680
3020
|
parseDate: parseDate,
|
|
2681
3021
|
placeholder: placeholder || format.toUpperCase(),
|
|
@@ -2751,7 +3091,7 @@ var useRangeFieldControllers = function useRangeFieldControllers(_ref) {
|
|
|
2751
3091
|
return initialControllers;
|
|
2752
3092
|
};
|
|
2753
3093
|
|
|
2754
|
-
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"};
|
|
2755
3095
|
|
|
2756
3096
|
var FromDate = function FromDate(_ref) {
|
|
2757
3097
|
var name = _ref.name,
|
|
@@ -2771,7 +3111,7 @@ var FromDate = function FromDate(_ref) {
|
|
|
2771
3111
|
to: end
|
|
2772
3112
|
};
|
|
2773
3113
|
var dayPickerProps = {
|
|
2774
|
-
classNames: styles$
|
|
3114
|
+
classNames: styles$s,
|
|
2775
3115
|
months: MONTH_NAMES,
|
|
2776
3116
|
weekdaysLong: DAYS,
|
|
2777
3117
|
weekdaysShort: DAYS.map(function (day) {
|
|
@@ -2792,7 +3132,7 @@ var FromDate = function FromDate(_ref) {
|
|
|
2792
3132
|
};
|
|
2793
3133
|
return React__default.createElement(DayPickerInput, {
|
|
2794
3134
|
format: format,
|
|
2795
|
-
classNames: styles$
|
|
3135
|
+
classNames: styles$s,
|
|
2796
3136
|
selectedDay: start,
|
|
2797
3137
|
value: start,
|
|
2798
3138
|
formatDate: formatDate,
|
|
@@ -2833,7 +3173,7 @@ var ToDate = function ToDate(_ref, ref) {
|
|
|
2833
3173
|
to: end
|
|
2834
3174
|
};
|
|
2835
3175
|
var dayPickerProps = {
|
|
2836
|
-
classNames: styles$
|
|
3176
|
+
classNames: styles$s,
|
|
2837
3177
|
months: MONTH_NAMES,
|
|
2838
3178
|
weekdaysLong: DAYS,
|
|
2839
3179
|
weekdaysShort: DAYS.map(function (day) {
|
|
@@ -2854,7 +3194,7 @@ var ToDate = function ToDate(_ref, ref) {
|
|
|
2854
3194
|
};
|
|
2855
3195
|
return React__default.createElement(DayPickerInput, {
|
|
2856
3196
|
format: format,
|
|
2857
|
-
classNames: styles$
|
|
3197
|
+
classNames: styles$s,
|
|
2858
3198
|
selectedDay: end,
|
|
2859
3199
|
value: end,
|
|
2860
3200
|
formatDate: formatDate,
|
|
@@ -2921,7 +3261,7 @@ var DateRangeField = function DateRangeField(_ref) {
|
|
|
2921
3261
|
start = _controllers$value.start,
|
|
2922
3262
|
end = _controllers$value.end;
|
|
2923
3263
|
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement("div", {
|
|
2924
|
-
className: classnames(styles$
|
|
3264
|
+
className: classnames(styles$s['date-range-field'], (_classnames = {}, _classnames[styles$s['date-range-field--invalid']] = hasError, _classnames))
|
|
2925
3265
|
}, React__default.createElement(IconCalendar, {
|
|
2926
3266
|
size: "medium"
|
|
2927
3267
|
}), React__default.createElement(FromDate, {
|
|
@@ -2966,7 +3306,7 @@ var DateRangeField = function DateRangeField(_ref) {
|
|
|
2966
3306
|
})));
|
|
2967
3307
|
};
|
|
2968
3308
|
|
|
2969
|
-
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"};
|
|
2970
3310
|
|
|
2971
3311
|
var WeekField = function WeekField(_ref) {
|
|
2972
3312
|
var _classnames;
|
|
@@ -3037,7 +3377,7 @@ var WeekField = function WeekField(_ref) {
|
|
|
3037
3377
|
};
|
|
3038
3378
|
|
|
3039
3379
|
var dayPickerProps = {
|
|
3040
|
-
classNames: styles$
|
|
3380
|
+
classNames: styles$t,
|
|
3041
3381
|
disabledDays: function disabledDays(day) {
|
|
3042
3382
|
return _disabledDays && _disabledDays(setToMidnight(day));
|
|
3043
3383
|
},
|
|
@@ -3067,7 +3407,7 @@ var WeekField = function WeekField(_ref) {
|
|
|
3067
3407
|
})
|
|
3068
3408
|
}, React__default.createElement(DayPickerInput, {
|
|
3069
3409
|
format: format,
|
|
3070
|
-
classNames: styles$
|
|
3410
|
+
classNames: styles$t,
|
|
3071
3411
|
formatDate: formatDate,
|
|
3072
3412
|
parseDate: parseDate,
|
|
3073
3413
|
placeholder: placeholder || format.toUpperCase(),
|
|
@@ -3096,7 +3436,7 @@ var WeekField = function WeekField(_ref) {
|
|
|
3096
3436
|
})));
|
|
3097
3437
|
};
|
|
3098
3438
|
|
|
3099
|
-
var styles$
|
|
3439
|
+
var styles$u = {"caption":"_1QDLF","label":"_2wiMV","toggle":"_1ui8X","toggle__label":"_1YRJT","toggle__caption":"_1jEiW","toggle__switch":"_3tNyE"};
|
|
3100
3440
|
|
|
3101
3441
|
var Toggle = function Toggle(_ref) {
|
|
3102
3442
|
var checked = _ref.checked,
|
|
@@ -3109,7 +3449,7 @@ var Toggle = function Toggle(_ref) {
|
|
|
3109
3449
|
return React__default.createElement(Stack, {
|
|
3110
3450
|
space: 8
|
|
3111
3451
|
}, React__default.createElement("label", {
|
|
3112
|
-
className: styles$
|
|
3452
|
+
className: styles$u['toggle']
|
|
3113
3453
|
}, React__default.createElement("input", {
|
|
3114
3454
|
"data-testid": "toggle",
|
|
3115
3455
|
type: "checkbox",
|
|
@@ -3118,17 +3458,17 @@ var Toggle = function Toggle(_ref) {
|
|
|
3118
3458
|
disabled: disabled,
|
|
3119
3459
|
id: id
|
|
3120
3460
|
}), React__default.createElement("span", {
|
|
3121
|
-
className: styles$
|
|
3461
|
+
className: styles$u['toggle__switch']
|
|
3122
3462
|
}), label && React__default.createElement("span", {
|
|
3123
|
-
className: styles$
|
|
3463
|
+
className: styles$u['toggle__label']
|
|
3124
3464
|
}, label)), caption && React__default.createElement("span", {
|
|
3125
|
-
className: styles$
|
|
3465
|
+
className: styles$u['toggle__caption']
|
|
3126
3466
|
}, caption));
|
|
3127
3467
|
};
|
|
3128
3468
|
|
|
3129
|
-
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"};
|
|
3130
3470
|
|
|
3131
|
-
var styles$
|
|
3471
|
+
var styles$w = {"header":"_36nxW","sub-header":"_2XwRD"};
|
|
3132
3472
|
|
|
3133
3473
|
var ModalHeader = function ModalHeader(_ref) {
|
|
3134
3474
|
var header = _ref.header,
|
|
@@ -3140,12 +3480,12 @@ var ModalHeader = function ModalHeader(_ref) {
|
|
|
3140
3480
|
flex: [1],
|
|
3141
3481
|
alignItems: "center"
|
|
3142
3482
|
}, React__default.createElement("span", {
|
|
3143
|
-
className: styles$
|
|
3483
|
+
className: styles$w['header']
|
|
3144
3484
|
}, header), React__default.createElement(Button$1, {
|
|
3145
3485
|
theme: "link-icon",
|
|
3146
3486
|
onClick: onClose
|
|
3147
3487
|
}, React__default.createElement(IconClose, null))), subHeader && React__default.createElement("div", {
|
|
3148
|
-
className: styles$
|
|
3488
|
+
className: styles$w['sub-header']
|
|
3149
3489
|
}, subHeader));
|
|
3150
3490
|
};
|
|
3151
3491
|
|
|
@@ -3181,14 +3521,14 @@ var Modal = function Modal(_ref) {
|
|
|
3181
3521
|
contentLabel: "Modal",
|
|
3182
3522
|
appElement: rootElementId && document.getElementById(rootElementId) || undefined,
|
|
3183
3523
|
overlayClassName: {
|
|
3184
|
-
base: styles$
|
|
3185
|
-
afterOpen: styles$
|
|
3186
|
-
beforeClose: styles$
|
|
3524
|
+
base: styles$v['overlay'],
|
|
3525
|
+
afterOpen: styles$v['overlay--after-open'],
|
|
3526
|
+
beforeClose: styles$v['overlay--before-close']
|
|
3187
3527
|
},
|
|
3188
3528
|
className: {
|
|
3189
|
-
base: styles$
|
|
3190
|
-
afterOpen: styles$
|
|
3191
|
-
beforeClose: styles$
|
|
3529
|
+
base: styles$v['content'],
|
|
3530
|
+
afterOpen: styles$v['content--after-open'],
|
|
3531
|
+
beforeClose: styles$v['content--before-close']
|
|
3192
3532
|
}
|
|
3193
3533
|
}, React__default.createElement(ModalHeader, {
|
|
3194
3534
|
header: header,
|
|
@@ -3201,16 +3541,16 @@ Modal.setAppElement = function (rootElement) {
|
|
|
3201
3541
|
ReactModal.setAppElement(rootElement);
|
|
3202
3542
|
};
|
|
3203
3543
|
|
|
3204
|
-
var styles$
|
|
3544
|
+
var styles$x = {"modal-body":"_2J-ku"};
|
|
3205
3545
|
|
|
3206
3546
|
var ModalBody = function ModalBody(_ref) {
|
|
3207
3547
|
var children = _ref.children;
|
|
3208
3548
|
return React__default.createElement("div", {
|
|
3209
|
-
className: styles$
|
|
3549
|
+
className: styles$x['modal-body']
|
|
3210
3550
|
}, children);
|
|
3211
3551
|
};
|
|
3212
3552
|
|
|
3213
|
-
var styles$
|
|
3553
|
+
var styles$y = {"modal-footer":"_LKOr5","tertiary-container":"_Qktd-"};
|
|
3214
3554
|
|
|
3215
3555
|
var ModalFooter = function ModalFooter(_ref) {
|
|
3216
3556
|
var children = _ref.children,
|
|
@@ -3231,7 +3571,7 @@ var ModalFooter = function ModalFooter(_ref) {
|
|
|
3231
3571
|
return React__default.createElement(FooterContainer, null, React__default.createElement(Inline, {
|
|
3232
3572
|
justifyContent: "space-between"
|
|
3233
3573
|
}, React__default.createElement("div", {
|
|
3234
|
-
className: classnames((_classnames = {}, _classnames[styles$
|
|
3574
|
+
className: classnames((_classnames = {}, _classnames[styles$y['tertiary-container']] = tertiaryButton && tertiaryButton.props.theme.startsWith('link'), _classnames))
|
|
3235
3575
|
}, tertiaryButton || React__default.createElement("div", null)), React__default.createElement(Inline, {
|
|
3236
3576
|
space: 12
|
|
3237
3577
|
}, secondaryButton, primaryButton)));
|
|
@@ -3259,7 +3599,7 @@ var FooterContainer = function FooterContainer(_ref2) {
|
|
|
3259
3599
|
var childrenItens = React__default.Children.toArray(children);
|
|
3260
3600
|
var hasCustomAlignment = childrenItens.length === 1 && childrenItens[0].type === Inline;
|
|
3261
3601
|
return React__default.createElement("div", {
|
|
3262
|
-
className: styles$
|
|
3602
|
+
className: styles$y['modal-footer']
|
|
3263
3603
|
}, React__default.createElement(Inline, {
|
|
3264
3604
|
justifyContent: "end",
|
|
3265
3605
|
space: 12,
|
|
@@ -3267,7 +3607,7 @@ var FooterContainer = function FooterContainer(_ref2) {
|
|
|
3267
3607
|
}, children));
|
|
3268
3608
|
};
|
|
3269
3609
|
|
|
3270
|
-
var styles$
|
|
3610
|
+
var styles$z = {"badge":"_2f81N","badge--warning":"_2g1GI","badge--danger":"_2zLnM","badge--success":"_27QOo","badge--info":"_2gmsM"};
|
|
3271
3611
|
|
|
3272
3612
|
var _excluded$5 = ["children", "theme", "title"];
|
|
3273
3613
|
|
|
@@ -3290,22 +3630,23 @@ var Badge = function Badge(_ref, forwardedRef) {
|
|
|
3290
3630
|
overlay: title,
|
|
3291
3631
|
ref: ref
|
|
3292
3632
|
}, React__default.createElement("div", Object.assign({
|
|
3293
|
-
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)),
|
|
3294
3634
|
ref: ref
|
|
3295
3635
|
}, otherProps), children));
|
|
3296
3636
|
};
|
|
3297
3637
|
|
|
3298
3638
|
var Badge$1 = forwardRef(Badge);
|
|
3299
3639
|
|
|
3300
|
-
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"};
|
|
3301
3641
|
|
|
3302
|
-
var styles$
|
|
3642
|
+
var styles$B = {"avatar-image":"_GKL9P"};
|
|
3303
3643
|
|
|
3304
3644
|
var AvatarImage = function AvatarImage(_ref) {
|
|
3305
3645
|
var url = _ref.url,
|
|
3306
3646
|
color = _ref.color,
|
|
3307
3647
|
_ref$alt = _ref.alt,
|
|
3308
|
-
alt = _ref$alt === void 0 ? 'Profile' : _ref$alt
|
|
3648
|
+
alt = _ref$alt === void 0 ? 'Profile' : _ref$alt,
|
|
3649
|
+
onImageFallbackError = _ref.onImageFallbackError;
|
|
3309
3650
|
|
|
3310
3651
|
var _useState = useState(false),
|
|
3311
3652
|
hasImageError = _useState[0],
|
|
@@ -3317,12 +3658,13 @@ var AvatarImage = function AvatarImage(_ref) {
|
|
|
3317
3658
|
alt: alt,
|
|
3318
3659
|
onError: function onError() {
|
|
3319
3660
|
setHasImageError(true);
|
|
3661
|
+
onImageFallbackError();
|
|
3320
3662
|
}
|
|
3321
3663
|
});
|
|
3322
3664
|
}
|
|
3323
3665
|
|
|
3324
3666
|
return React__default.createElement("div", {
|
|
3325
|
-
className: styles$
|
|
3667
|
+
className: styles$B['avatar-image']
|
|
3326
3668
|
}, React__default.createElement(IconUser, {
|
|
3327
3669
|
size: "flexible",
|
|
3328
3670
|
color: color
|
|
@@ -3379,25 +3721,32 @@ var Avatar = function Avatar(_ref) {
|
|
|
3379
3721
|
badge = _ref.badge,
|
|
3380
3722
|
alt = _ref.alt;
|
|
3381
3723
|
|
|
3382
|
-
var _useState = useState(
|
|
3724
|
+
var _useState = useState(false),
|
|
3725
|
+
showIconInsteadOfImage = _useState[0],
|
|
3726
|
+
setShowIconInsteadOfImage = _useState[1];
|
|
3727
|
+
|
|
3728
|
+
var _useState2 = useState(function () {
|
|
3383
3729
|
return PROFILE_IMAGES[Math.floor(Math.random() * PROFILE_IMAGES.length)];
|
|
3384
3730
|
}),
|
|
3385
|
-
defaultProfilePictureColors =
|
|
3731
|
+
defaultProfilePictureColors = _useState2[0];
|
|
3386
3732
|
|
|
3387
3733
|
var backgroundColor = url ? GREY200 : color;
|
|
3388
3734
|
return React__default.createElement("div", {
|
|
3389
|
-
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)),
|
|
3390
3736
|
style: {
|
|
3391
|
-
backgroundColor: children || url ? backgroundColor : defaultProfilePictureColors.backgroundColor
|
|
3737
|
+
backgroundColor: children || url && !showIconInsteadOfImage ? backgroundColor : defaultProfilePictureColors.backgroundColor
|
|
3392
3738
|
}
|
|
3393
3739
|
}, children || React__default.createElement(AvatarImage, {
|
|
3394
3740
|
url: url,
|
|
3395
3741
|
color: defaultProfilePictureColors.avatarColor,
|
|
3396
|
-
alt: alt
|
|
3742
|
+
alt: alt,
|
|
3743
|
+
onImageFallbackError: function onImageFallbackError() {
|
|
3744
|
+
return setShowIconInsteadOfImage(true);
|
|
3745
|
+
}
|
|
3397
3746
|
}), badge && size !== 'small' && React__default.createElement("div", {
|
|
3398
|
-
className: styles$
|
|
3747
|
+
className: styles$A['avatar__badge']
|
|
3399
3748
|
}, badge));
|
|
3400
3749
|
};
|
|
3401
3750
|
|
|
3402
|
-
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 };
|
|
3403
3752
|
//# sourceMappingURL=index.modern.js.map
|