@7shifts/sous-chef 2.3.2 → 2.3.3
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/dist/core/DataTable/DataTable.d.ts +1 -1
- package/dist/core/DataTable/DataTableContext.d.ts +1 -1
- package/dist/forms/Form/types.d.ts +3 -18
- package/dist/index.css +30 -8
- package/dist/index.js +33 -42
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +33 -42
- package/dist/index.modern.js.map +1 -1
- package/dist/overlay/Tooltip/Tooltip.d.ts +1 -0
- package/dist/utils/formik.d.ts +1 -0
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ declare type Props<T> = {
|
|
|
4
4
|
/** Each element represents a row and each key of the object represents a column */
|
|
5
5
|
items: Item<T>[];
|
|
6
6
|
/** For each column element, the `name` property should match the key on `items` */
|
|
7
|
-
columns
|
|
7
|
+
columns?: Column[];
|
|
8
8
|
/** A custom component for customizing how the each item is rendered. It pass as props: `item`, `index`, `columnSizes` and `columns` */
|
|
9
9
|
itemComponent?: React.ComponentType<CustomComponent<T>>;
|
|
10
10
|
maxHeight?: number;
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export declare type FormikType =
|
|
4
|
-
handleSubmit: (e: Object) => void;
|
|
5
|
-
setFieldValue: (_: string, __: string | boolean | SelectOption<any> | SelectOption<any>[] | Date | DateRange | null) => void;
|
|
6
|
-
setFieldTouched: (e: string) => void;
|
|
7
|
-
values: {
|
|
8
|
-
[key: string]: any;
|
|
9
|
-
};
|
|
10
|
-
touched: {
|
|
11
|
-
[key: string]: boolean;
|
|
12
|
-
};
|
|
13
|
-
errors: {
|
|
14
|
-
[key: string]: string;
|
|
15
|
-
};
|
|
16
|
-
isValid: boolean;
|
|
17
|
-
dirty: boolean;
|
|
18
|
-
};
|
|
1
|
+
import { FormikState, FormikHelpers, FormikHandlers } from 'formik';
|
|
2
|
+
/** The FormValues are `any` here as in Sous Chef we don't care about the shape of the form. We just need to link form fields with the formik state */
|
|
3
|
+
export declare type FormikType = FormikState<any> & FormikHelpers<any> & FormikHandlers;
|
package/dist/index.css
CHANGED
|
@@ -598,7 +598,7 @@ Please ask a designer if you have questions about which colours to use.
|
|
|
598
598
|
border: 1px solid #fff;
|
|
599
599
|
border-bottom: 1px solid #e0e0e0;
|
|
600
600
|
}
|
|
601
|
-
._3DlpO:last-child {
|
|
601
|
+
._3DlpO:last-child:not(._NS-B9) {
|
|
602
602
|
border-bottom: 1px solid #fff;
|
|
603
603
|
}
|
|
604
604
|
|
|
@@ -621,11 +621,20 @@ Please ask a designer if you have questions about which colours to use.
|
|
|
621
621
|
box-shadow: 0 0 8px #a7b7ea;
|
|
622
622
|
}
|
|
623
623
|
._NS-B9:first-child {
|
|
624
|
-
border-radius: 8px
|
|
624
|
+
border-top-left-radius: 8px;
|
|
625
|
+
border-top-right-radius: 8px;
|
|
626
|
+
}
|
|
627
|
+
._NS-B9:first-child:not(:last-child) {
|
|
628
|
+
border-bottom-left-radius: 0;
|
|
629
|
+
border-bottom-right-radius: 0;
|
|
625
630
|
}
|
|
626
631
|
._NS-B9:last-child {
|
|
627
|
-
border-radius:
|
|
628
|
-
border-bottom:
|
|
632
|
+
border-bottom-left-radius: 8px;
|
|
633
|
+
border-bottom-right-radius: 8px;
|
|
634
|
+
}
|
|
635
|
+
._NS-B9:last-child:not(:first-child) {
|
|
636
|
+
border-top-left-radius: 0;
|
|
637
|
+
border-top-right-radius: 0;
|
|
629
638
|
}
|
|
630
639
|
|
|
631
640
|
._3ENNn {
|
|
@@ -664,6 +673,7 @@ Please ask a designer if you have questions about which colours to use.
|
|
|
664
673
|
._3-nHz {
|
|
665
674
|
display: flex;
|
|
666
675
|
align-items: center;
|
|
676
|
+
line-height: 21px;
|
|
667
677
|
}
|
|
668
678
|
._2Rh0i {
|
|
669
679
|
cursor: pointer;
|
|
@@ -682,6 +692,7 @@ Please ask a designer if you have questions about which colours to use.
|
|
|
682
692
|
._W7CnY {
|
|
683
693
|
display: inline-block;
|
|
684
694
|
padding: 0 8px;
|
|
695
|
+
line-height: 1em;
|
|
685
696
|
}
|
|
686
697
|
|
|
687
698
|
._2ygIH {
|
|
@@ -734,7 +745,7 @@ Please ask a designer if you have questions about which colours to use.
|
|
|
734
745
|
._1d8Ci {
|
|
735
746
|
display: flex;
|
|
736
747
|
}
|
|
737
|
-
._1d8Ci:not(:last-child) {
|
|
748
|
+
._1d8Ci:not(:last-child):not(._3tb7U) {
|
|
738
749
|
border-bottom: 1px solid #e0e0e0;
|
|
739
750
|
}
|
|
740
751
|
|
|
@@ -757,11 +768,20 @@ Please ask a designer if you have questions about which colours to use.
|
|
|
757
768
|
box-shadow: 0 0 8px #a7b7ea;
|
|
758
769
|
}
|
|
759
770
|
._3tb7U:first-child {
|
|
760
|
-
border-radius: 8px
|
|
771
|
+
border-top-left-radius: 8px;
|
|
772
|
+
border-top-right-radius: 8px;
|
|
773
|
+
}
|
|
774
|
+
._3tb7U:first-child:not(:last-child) {
|
|
775
|
+
border-bottom-left-radius: 0;
|
|
776
|
+
border-bottom-right-radius: 0;
|
|
761
777
|
}
|
|
762
778
|
._3tb7U:last-child {
|
|
763
|
-
border-radius:
|
|
764
|
-
border-bottom:
|
|
779
|
+
border-bottom-left-radius: 8px;
|
|
780
|
+
border-bottom-right-radius: 8px;
|
|
781
|
+
}
|
|
782
|
+
._3tb7U:last-child:not(:first-child) {
|
|
783
|
+
border-top-left-radius: 0;
|
|
784
|
+
border-top-right-radius: 0;
|
|
765
785
|
}
|
|
766
786
|
|
|
767
787
|
._OTcMc {
|
|
@@ -809,6 +829,7 @@ Please ask a designer if you have questions about which colours to use.
|
|
|
809
829
|
._27x4v {
|
|
810
830
|
display: flex;
|
|
811
831
|
align-items: center;
|
|
832
|
+
line-height: 21px;
|
|
812
833
|
}
|
|
813
834
|
._27x4v:not(._27x4v:first-child) {
|
|
814
835
|
padding-left: 16px;
|
|
@@ -837,6 +858,7 @@ Please ask a designer if you have questions about which colours to use.
|
|
|
837
858
|
._3VjFP {
|
|
838
859
|
display: inline-block;
|
|
839
860
|
padding: 0 8px;
|
|
861
|
+
line-height: 1em;
|
|
840
862
|
}
|
|
841
863
|
|
|
842
864
|
._1bTmd {
|
package/dist/index.js
CHANGED
|
@@ -393,7 +393,9 @@ var TooltipOverlay = function TooltipOverlay(_ref) {
|
|
|
393
393
|
}, []);
|
|
394
394
|
var tooltipRectPosition = tooltipRef === null || tooltipRef === void 0 ? void 0 : (_tooltipRef$current = tooltipRef.current) === null || _tooltipRef$current === void 0 ? void 0 : _tooltipRef$current.getBoundingClientRect();
|
|
395
395
|
var position = calculatePosition(placement, anchorPosition, tooltipRectPosition);
|
|
396
|
-
return React__default.createElement(Portal, null, React__default.createElement("div",
|
|
396
|
+
return React__default.createElement(Portal, null, React__default.createElement("div", {
|
|
397
|
+
role: "tooltip"
|
|
398
|
+
}, React__default.createElement("div", {
|
|
397
399
|
ref: tooltipRef,
|
|
398
400
|
style: _extends({}, position.overlay, {
|
|
399
401
|
zIndex: Z_INDEX_LAYERS.TOOLTIP
|
|
@@ -429,6 +431,7 @@ var Tooltip = function Tooltip(_ref, forwardedRef) {
|
|
|
429
431
|
header = _ref.header,
|
|
430
432
|
extraClass = _ref.extraClass,
|
|
431
433
|
onClose = _ref.onClose,
|
|
434
|
+
onVisibleChange = _ref.onVisibleChange,
|
|
432
435
|
children = _ref.children;
|
|
433
436
|
var checkIsMounted = useIsMounted();
|
|
434
437
|
var internalRef = React.useRef(null);
|
|
@@ -447,6 +450,10 @@ var Tooltip = function Tooltip(_ref, forwardedRef) {
|
|
|
447
450
|
if (!shouldShow) {
|
|
448
451
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
449
452
|
}
|
|
453
|
+
|
|
454
|
+
if (onVisibleChange) {
|
|
455
|
+
onVisibleChange(shouldShow);
|
|
456
|
+
}
|
|
450
457
|
};
|
|
451
458
|
|
|
452
459
|
var onAnchorFocusIn = function onAnchorFocusIn() {
|
|
@@ -2861,7 +2868,7 @@ var IconWrench = function IconWrench(props) {
|
|
|
2861
2868
|
|
|
2862
2869
|
IconWrench.displayName = 'IconWrench';
|
|
2863
2870
|
|
|
2864
|
-
var styles$6 = {"item":"_3DlpO","
|
|
2871
|
+
var styles$6 = {"item":"_3DlpO","selected":"_NS-B9","clickable":"_2jPpF","item-column":"_3ENNn","actions":"_1FTaE"};
|
|
2865
2872
|
|
|
2866
2873
|
var ResourceTableRow = function ResourceTableRow(_ref) {
|
|
2867
2874
|
var _classnames;
|
|
@@ -3178,7 +3185,7 @@ var useDataTableContext = function useDataTableContext() {
|
|
|
3178
3185
|
return context;
|
|
3179
3186
|
};
|
|
3180
3187
|
|
|
3181
|
-
var styles$9 = {"item":"_1d8Ci","
|
|
3188
|
+
var styles$9 = {"item":"_1d8Ci","selected":"_3tb7U","clickable":"_thFcO","item-column":"_OTcMc","item-column--default-padding":"_lNHQ8","item-column--right-align":"_13YLe","item-column--vertical-border":"_1rrRr","actions":"_azbIG"};
|
|
3182
3189
|
|
|
3183
3190
|
var DataTableRow = function DataTableRow(_ref) {
|
|
3184
3191
|
var _classnames;
|
|
@@ -3366,7 +3373,7 @@ var DataTable = function DataTable(_ref) {
|
|
|
3366
3373
|
numberOfRows: numberOfRows,
|
|
3367
3374
|
hasVerticalBorders: hasVerticalBorders
|
|
3368
3375
|
}
|
|
3369
|
-
}, React__default.createElement("div", null, React__default.createElement(DataTableHeader, {
|
|
3376
|
+
}, React__default.createElement("div", null, columns && React__default.createElement(DataTableHeader, {
|
|
3370
3377
|
columns: columns,
|
|
3371
3378
|
onSort: onSort,
|
|
3372
3379
|
showActionMenu: showActionMenu
|
|
@@ -3426,7 +3433,7 @@ var DataTableCell = function DataTableCell(_ref) {
|
|
|
3426
3433
|
var _useDataTableContext = useDataTableContext(),
|
|
3427
3434
|
columns = _useDataTableContext.columns;
|
|
3428
3435
|
|
|
3429
|
-
var column = (_columns$columnIndex = columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
3436
|
+
var column = (_columns$columnIndex = columns === null || columns === void 0 ? void 0 : columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
3430
3437
|
var isRightAligned = column ? column.isRightAligned : false;
|
|
3431
3438
|
return React__default.createElement("div", {
|
|
3432
3439
|
className: classnames((_classnames = {}, _classnames[styles$b['data-table-cell--right-aligned']] = isRightAligned, _classnames), styles$b['data-table-cell'])
|
|
@@ -3453,49 +3460,33 @@ var getFormikState = function getFormikState(name, formik) {
|
|
|
3453
3460
|
return null;
|
|
3454
3461
|
}
|
|
3455
3462
|
|
|
3456
|
-
|
|
3457
|
-
return {
|
|
3458
|
-
error: formik.touched[name] ? formik.errors[name] : undefined,
|
|
3459
|
-
value: formik.values[name]
|
|
3460
|
-
};
|
|
3461
|
-
}
|
|
3463
|
+
var formikPath = getFormikArrayPath(name);
|
|
3462
3464
|
|
|
3463
|
-
|
|
3465
|
+
if (formikPath.length === 0) {
|
|
3466
|
+
return null;
|
|
3467
|
+
}
|
|
3464
3468
|
|
|
3465
|
-
|
|
3466
|
-
var
|
|
3469
|
+
var formikLatestLevel = formikPath.reduce(function (acc, path) {
|
|
3470
|
+
var _acc$touched, _acc$error, _acc$value;
|
|
3467
3471
|
|
|
3468
|
-
var arrayName = formikArray.arrayName,
|
|
3469
|
-
itemIndex = formikArray.itemIndex,
|
|
3470
|
-
fieldName = formikArray.fieldName;
|
|
3471
3472
|
return {
|
|
3472
|
-
|
|
3473
|
-
|
|
3473
|
+
touched: (_acc$touched = acc.touched) === null || _acc$touched === void 0 ? void 0 : _acc$touched[path],
|
|
3474
|
+
error: (_acc$error = acc.error) === null || _acc$error === void 0 ? void 0 : _acc$error[path],
|
|
3475
|
+
value: (_acc$value = acc.value) === null || _acc$value === void 0 ? void 0 : _acc$value[path]
|
|
3474
3476
|
};
|
|
3475
|
-
}
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
var getFormikArrayPath = function getFormikArrayPath(name) {
|
|
3481
|
-
if (!name.includes('[')) {
|
|
3482
|
-
return false;
|
|
3483
|
-
}
|
|
3484
|
-
|
|
3485
|
-
var _name$split = name.split('['),
|
|
3486
|
-
arrayName = _name$split[0],
|
|
3487
|
-
missingSplit = _name$split[1];
|
|
3488
|
-
|
|
3489
|
-
var _missingSplit$split = missingSplit.split('].'),
|
|
3490
|
-
itemIndex = _missingSplit$split[0],
|
|
3491
|
-
fieldName = _missingSplit$split[1];
|
|
3492
|
-
|
|
3477
|
+
}, {
|
|
3478
|
+
touched: formik.touched,
|
|
3479
|
+
error: formik.errors,
|
|
3480
|
+
value: formik.values
|
|
3481
|
+
});
|
|
3493
3482
|
return {
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
fieldName: fieldName
|
|
3483
|
+
error: formikLatestLevel.touched ? formikLatestLevel.error : undefined,
|
|
3484
|
+
value: formikLatestLevel.value
|
|
3497
3485
|
};
|
|
3498
3486
|
};
|
|
3487
|
+
var getFormikArrayPath = function getFormikArrayPath(name) {
|
|
3488
|
+
return name.split(/[^a-zA-Z0-9]/).filter(Boolean);
|
|
3489
|
+
};
|
|
3499
3490
|
|
|
3500
3491
|
var useFieldControllers = function useFieldControllers(_ref) {
|
|
3501
3492
|
var name = _ref.name,
|
|
@@ -3695,9 +3686,9 @@ var DataTableEditableCell = function DataTableEditableCell(_ref) {
|
|
|
3695
3686
|
columns = _useDataTableContext.columns,
|
|
3696
3687
|
numberOfRows = _useDataTableContext.numberOfRows;
|
|
3697
3688
|
|
|
3698
|
-
var column = (_columns$columnIndex = columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
3689
|
+
var column = (_columns$columnIndex = columns === null || columns === void 0 ? void 0 : columns[columnIndex]) != null ? _columns$columnIndex : null;
|
|
3699
3690
|
var isRightAligned = column ? column.isRightAligned : false;
|
|
3700
|
-
var numberOfColumns = columns === null || columns === void 0 ? void 0 : columns.length;
|
|
3691
|
+
var numberOfColumns = (columns === null || columns === void 0 ? void 0 : columns.length) || 0;
|
|
3701
3692
|
var isTopLeftCell = columnIndex === 0 && rowIndex === 0;
|
|
3702
3693
|
var isTopRightCell = columnIndex === numberOfColumns - 1 && rowIndex === 0;
|
|
3703
3694
|
var isBottomLeftCell = columnIndex === 0 && rowIndex === numberOfRows - 1;
|