@thecb/components 10.11.0-beta.1 → 10.11.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/dist/index.cjs.js +80 -60
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +80 -60
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/search/Search.js +3 -1
- package/src/components/atoms/search/index.d.ts +1 -0
- package/src/components/atoms/sortable-table-heading/SortableTableHeading.js +4 -1
- package/src/components/atoms/sortable-table-heading/index.d.ts +1 -0
- package/src/components/atoms/state-province-dropdown/options.js +4 -1
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -23673,6 +23673,8 @@ var TableHeading = styled__default.th.withConfig({
|
|
|
23673
23673
|
|
|
23674
23674
|
var SortableTableHeading = function SortableTableHeading(_ref) {
|
|
23675
23675
|
var ariaControlsId = _ref.ariaControlsId,
|
|
23676
|
+
_ref$disabled = _ref.disabled,
|
|
23677
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
23676
23678
|
displayName = _ref.displayName,
|
|
23677
23679
|
onSortChange = _ref.onSortChange,
|
|
23678
23680
|
_ref$sortOrder = _ref.sortOrder,
|
|
@@ -23686,8 +23688,11 @@ var SortableTableHeading = function SortableTableHeading(_ref) {
|
|
|
23686
23688
|
return themeValues.inactiveColor;
|
|
23687
23689
|
};
|
|
23688
23690
|
return /*#__PURE__*/React__default.createElement(TableHeading, {
|
|
23691
|
+
disabled: disabled,
|
|
23689
23692
|
extraStyles: "cursor: pointer; ".concat(extraStyles),
|
|
23690
|
-
onClick:
|
|
23693
|
+
onClick: function onClick(event) {
|
|
23694
|
+
return disabled ? noop : onSortChange(event);
|
|
23695
|
+
},
|
|
23691
23696
|
"aria-controls": ariaControlsId
|
|
23692
23697
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
23693
23698
|
justify: "space-between"
|
|
@@ -27087,79 +27092,83 @@ var createFormat = function createFormat(formats, formatChar) {
|
|
|
27087
27092
|
var FormattedInput = function FormattedInput(_ref) {
|
|
27088
27093
|
var value = _ref.value,
|
|
27089
27094
|
formatter = _ref.formatter,
|
|
27090
|
-
|
|
27095
|
+
onChange = _ref.onChange,
|
|
27091
27096
|
props = _objectWithoutProperties$1(_ref, ["value", "formatter", "onChange"]);
|
|
27092
27097
|
|
|
27093
|
-
var
|
|
27098
|
+
var _useState = React.useState(format$1(formatter)(value)),
|
|
27099
|
+
_useState2 = _slicedToArray$1(_useState, 2),
|
|
27100
|
+
formattedValue = _useState2[0],
|
|
27101
|
+
setFormattedValue = _useState2[1];
|
|
27094
27102
|
|
|
27095
|
-
var
|
|
27103
|
+
var inputEl = React.useRef(null);
|
|
27104
|
+
var stateRefs = React.useRef({
|
|
27096
27105
|
selectionStart: 0,
|
|
27097
27106
|
selectionEnd: 0,
|
|
27098
|
-
|
|
27099
|
-
|
|
27100
|
-
|
|
27101
|
-
}),
|
|
27102
|
-
_useState2 = _slicedToArray$1(_useState, 2),
|
|
27103
|
-
state = _useState2[0],
|
|
27104
|
-
setState = _useState2[1];
|
|
27105
|
-
|
|
27107
|
+
isDelete: false,
|
|
27108
|
+
rawValue: ''
|
|
27109
|
+
});
|
|
27106
27110
|
React.useLayoutEffect(function () {
|
|
27107
27111
|
// A lot of the work here is cursor manipulation
|
|
27108
27112
|
if (inputEl.current && inputEl.current === document.activeElement) {
|
|
27109
|
-
inputEl.current.setSelectionRange(
|
|
27113
|
+
inputEl.current.setSelectionRange(stateRefs.current.selectionStart, stateRefs.current.selectionEnd);
|
|
27110
27114
|
}
|
|
27111
|
-
});
|
|
27115
|
+
}, [stateRefs]);
|
|
27116
|
+
|
|
27117
|
+
var handleChange = function handleChange(event) {
|
|
27118
|
+
var deleteKeyPressed = stateRefs.current.isDelete;
|
|
27119
|
+
var maxFormatExceeded = stateRefs.current.rawValue.length >= formatter.formats.length - 1;
|
|
27120
|
+
|
|
27121
|
+
if (maxFormatExceeded && !deleteKeyPressed) {
|
|
27122
|
+
return;
|
|
27123
|
+
}
|
|
27124
|
+
/* At the beginning of onChange, event.target.value is a concat of the previous formatted value
|
|
27125
|
+
* and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
|
|
27126
|
+
* the unformatted value for the user's onChange, the formatted string and unformatted injection need
|
|
27127
|
+
* to be separated, then unformat the formatted string, then insert (or delete) the injection from the
|
|
27128
|
+
* old unformatted value.
|
|
27129
|
+
*/
|
|
27130
|
+
|
|
27131
|
+
|
|
27132
|
+
var injectionLength = event.target.value.length - formattedValue.length;
|
|
27133
|
+
var end = stateRefs.current.selectionStart === stateRefs.current.selectionEnd ? stateRefs.current.selectionStart + injectionLength : stateRefs.current.selectionEnd - 1;
|
|
27134
|
+
var injection = event.target.value.substring(stateRefs.current.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
27135
|
+
// Need to find where to put it
|
|
27136
|
+
|
|
27137
|
+
var rawInjectionPointStart = formattedToUnformattedIndex(stateRefs.current.selectionStart, stateRefs.current.rawValue, formatter);
|
|
27138
|
+
var rawInjectionPointEnd = formattedToUnformattedIndex(stateRefs.current.selectionEnd, stateRefs.current.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
27139
|
+
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
27140
|
+
|
|
27141
|
+
var unformattedOldValue = unformat(formatter)(formattedValue, stateRefs.current.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
27142
|
+
|
|
27143
|
+
var injectIntoOldValue = inject(unformattedOldValue);
|
|
27144
|
+
var unformattedNewValue = deleteKeyPressed ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
|
|
27145
|
+
var lengthDifference = unformattedNewValue.length - stateRefs.current.rawValue.length;
|
|
27146
|
+
var rawIndex = formattedToUnformattedIndex(stateRefs.current.selectionStart, stateRefs.current.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
|
|
27147
|
+
// Applied by useLayoutEffect
|
|
27148
|
+
|
|
27149
|
+
var newFormattedCursorPosition = stateRefs.current.selectionStart === stateRefs.current.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, deleteKeyPressed) : deleteKeyPressed ? stateRefs.current.selectionStart : stateRefs.current.selectionEnd;
|
|
27150
|
+
var formattedNewValue = format$1(formatter)(unformattedNewValue);
|
|
27151
|
+
setFormattedValue(formattedNewValue); // Apply the external onChange function to the raw underlying string
|
|
27152
|
+
// This is where the user generally updates the input value
|
|
27153
|
+
|
|
27154
|
+
if (onChange) {
|
|
27155
|
+
onChange(unformattedNewValue);
|
|
27156
|
+
}
|
|
27157
|
+
};
|
|
27158
|
+
|
|
27112
27159
|
return React__default.createElement("input", _extends$2({}, props, {
|
|
27113
27160
|
ref: inputEl,
|
|
27114
27161
|
value: format$1(formatter)(value),
|
|
27115
27162
|
onKeyDown: function onKeyDown(event) {
|
|
27116
|
-
// Keep track of the state of the input before onChange
|
|
27117
|
-
|
|
27118
|
-
|
|
27163
|
+
// Keep track of the state of the input before onChange
|
|
27164
|
+
stateRefs.current = {
|
|
27165
|
+
isDelete: event.key === "Backspace" || event.key === "Delete",
|
|
27119
27166
|
selectionStart: event.target.selectionStart,
|
|
27120
27167
|
selectionEnd: event.target.selectionEnd,
|
|
27121
|
-
|
|
27122
|
-
|
|
27123
|
-
});
|
|
27168
|
+
rawValue: value
|
|
27169
|
+
};
|
|
27124
27170
|
},
|
|
27125
|
-
onChange:
|
|
27126
|
-
/* At the beginning of onChange, event.target.value is a concat of the previous formatted value
|
|
27127
|
-
* and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
|
|
27128
|
-
* the unformatted value for the user's onChange, the formatted string and unformatted injection need
|
|
27129
|
-
* to be separated, then unformat the formatted string, then insert (or delete) the injection from the
|
|
27130
|
-
* old unformatted value.
|
|
27131
|
-
*/
|
|
27132
|
-
var injectionLength = event.target.value.length - state.formattedValue.length;
|
|
27133
|
-
var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
|
|
27134
|
-
var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
27135
|
-
// Need to find where to put it
|
|
27136
|
-
|
|
27137
|
-
var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
|
|
27138
|
-
var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
27139
|
-
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
27140
|
-
|
|
27141
|
-
var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
27142
|
-
|
|
27143
|
-
var injectIntoOldValue = inject(unformattedOldValue);
|
|
27144
|
-
var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
|
|
27145
|
-
var lengthDifference = unformattedNewValue.length - state.rawValue.length;
|
|
27146
|
-
var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
|
|
27147
|
-
// Applied by useLayoutEffect
|
|
27148
|
-
|
|
27149
|
-
var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
|
|
27150
|
-
setState({
|
|
27151
|
-
selectionStart: newFormattedCursorPosition,
|
|
27152
|
-
selectionEnd: newFormattedCursorPosition,
|
|
27153
|
-
rawValue: state.rawValue,
|
|
27154
|
-
"delete": false,
|
|
27155
|
-
formattedValue: state.formattedValue
|
|
27156
|
-
}); // Apply the external onChange function to the raw underlying string
|
|
27157
|
-
// This is where the user generally updates the input value
|
|
27158
|
-
|
|
27159
|
-
if (_onChange) {
|
|
27160
|
-
_onChange(unformattedNewValue);
|
|
27161
|
-
}
|
|
27162
|
-
}
|
|
27171
|
+
onChange: handleChange
|
|
27163
27172
|
}));
|
|
27164
27173
|
};
|
|
27165
27174
|
|
|
@@ -28821,6 +28830,8 @@ var Search = function Search(_ref) {
|
|
|
28821
28830
|
var field = _ref.field,
|
|
28822
28831
|
fieldActions = _ref.fieldActions,
|
|
28823
28832
|
dataset = _ref.dataset,
|
|
28833
|
+
_ref$disableFilter = _ref.disableFilter,
|
|
28834
|
+
disableFilter = _ref$disableFilter === void 0 ? false : _ref$disableFilter,
|
|
28824
28835
|
valuesToSearchFor = _ref.valuesToSearchFor,
|
|
28825
28836
|
onSearchCallback = _ref.onSearchCallback,
|
|
28826
28837
|
onClearCallback = _ref.onClearCallback,
|
|
@@ -28845,7 +28856,7 @@ var Search = function Search(_ref) {
|
|
|
28845
28856
|
});
|
|
28846
28857
|
};
|
|
28847
28858
|
var handleSubmit = function handleSubmit() {
|
|
28848
|
-
return onSearchCallback(getFilteredDataset());
|
|
28859
|
+
return disableFilter ? onSearchCallback() : onSearchCallback(getFilteredDataset());
|
|
28849
28860
|
};
|
|
28850
28861
|
return /*#__PURE__*/React__default.createElement(Cluster, {
|
|
28851
28862
|
extraStyles: "overflow: visible; width: ".concat(width, "; ").concat(extraStyles)
|
|
@@ -39046,6 +39057,15 @@ var allOptions = {
|
|
|
39046
39057
|
}, {
|
|
39047
39058
|
text: "Wyoming",
|
|
39048
39059
|
value: "WY"
|
|
39060
|
+
}, {
|
|
39061
|
+
text: "Armed Forces Americas",
|
|
39062
|
+
value: "AA"
|
|
39063
|
+
}, {
|
|
39064
|
+
text: "Armed Forces Europe",
|
|
39065
|
+
value: "AE"
|
|
39066
|
+
}, {
|
|
39067
|
+
text: "Armed Forces Pacific",
|
|
39068
|
+
value: "AP"
|
|
39049
39069
|
}],
|
|
39050
39070
|
UM: [{
|
|
39051
39071
|
text: "Palmyra Atoll",
|
|
@@ -50616,7 +50636,7 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref2) {
|
|
|
50616
50636
|
var checkboxListID = "".concat(name, "-checkbox-list");
|
|
50617
50637
|
var backgroundColor = opened ? themeValues.primaryColor : selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? themeValues.secondaryColor : WHITE;
|
|
50618
50638
|
var contentColor = !opened && selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? WHITE : "#292A33";
|
|
50619
|
-
var completeOptionsList = itemList.sort(function (a, b) {
|
|
50639
|
+
var completeOptionsList = itemList.slice().sort(function (a, b) {
|
|
50620
50640
|
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
|
50621
50641
|
});
|
|
50622
50642
|
var selectValues = function selectValues(items) {
|