@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "10.11.0-beta.1",
3
+ "version": "10.11.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
Binary file
@@ -27,6 +27,7 @@ const Search = ({
27
27
  field,
28
28
  fieldActions,
29
29
  dataset,
30
+ disableFilter = false, // Some implementations may prefer to filter the list at the application level (e.g., Revenue Management centralizing search, sort, and filtering Users state).
30
31
  valuesToSearchFor,
31
32
  onSearchCallback,
32
33
  onClearCallback,
@@ -52,7 +53,8 @@ const Search = ({
52
53
  );
53
54
  };
54
55
 
55
- const handleSubmit = () => onSearchCallback(getFilteredDataset());
56
+ const handleSubmit = () =>
57
+ disableFilter ? onSearchCallback() : onSearchCallback(getFilteredDataset());
56
58
 
57
59
  return (
58
60
  <Cluster extraStyles={`overflow: visible; width: ${width}; ${extraStyles}`}>
@@ -10,6 +10,7 @@ export interface SearchProps {
10
10
  field: Field;
11
11
  fieldActions: FieldActions;
12
12
  dataset: FlexibleObjectArray;
13
+ disableFilter?: boolean;
13
14
  valuesToSearchFor: string[];
14
15
  onSearchCallback: () => void;
15
16
  onClearCallback: () => void;
@@ -5,9 +5,11 @@ import { fallbackValues } from "./SortableTableHeading.theme";
5
5
  import { themeComponent } from "../../../util/themeUtils";
6
6
  import { Cluster, Stack } from "../layouts";
7
7
  import { TableHeading } from "../table";
8
+ import { noop } from "../../../util/general";
8
9
 
9
10
  const SortableTableHeading = ({
10
11
  ariaControlsId,
12
+ disabled = false,
11
13
  displayName,
12
14
  onSortChange,
13
15
  sortOrder = null,
@@ -22,8 +24,9 @@ const SortableTableHeading = ({
22
24
  };
23
25
  return (
24
26
  <TableHeading
27
+ disabled={disabled}
25
28
  extraStyles={`cursor: pointer; ${extraStyles}`}
26
- onClick={onSortChange}
29
+ onClick={event => (disabled ? noop : onSortChange(event))}
27
30
  aria-controls={ariaControlsId}
28
31
  >
29
32
  <Cluster justify="space-between">
@@ -4,6 +4,7 @@ import Expand from "../../../util/expand";
4
4
  export type SortOrder = "asc" | "desc" | null;
5
5
  export interface SortableTableHeadingProps {
6
6
  ariaControlsId: string;
7
+ disabled?: boolean; // Useful if you want to render the component while data is fetching
7
8
  displayName: string; // The name displayed in the <th> element
8
9
  onSortChange: () => void;
9
10
  sortOrder: SortOrder;
@@ -3650,7 +3650,10 @@ const allOptions = {
3650
3650
  { text: "Washington", value: "WA" },
3651
3651
  { text: "West Virginia", value: "WV" },
3652
3652
  { text: "Wisconsin", value: "WI" },
3653
- { text: "Wyoming", value: "WY" }
3653
+ { text: "Wyoming", value: "WY" },
3654
+ { text: "Armed Forces Americas", value: "AA" },
3655
+ { text: "Armed Forces Europe", value: "AE" },
3656
+ { text: "Armed Forces Pacific", value: "AP" }
3654
3657
  ],
3655
3658
  UM: [{ text: "Palmyra Atoll", value: "95" }],
3656
3659
  UY: [
@@ -180,9 +180,9 @@ const MultipleSelectFilter = ({
180
180
  : WHITE;
181
181
  const contentColor = !opened && selectedOptions?.length ? WHITE : "#292A33";
182
182
 
183
- const completeOptionsList = itemList.sort((a, b) =>
184
- a.name.toLowerCase().localeCompare(b.name.toLowerCase())
185
- );
183
+ const completeOptionsList = itemList
184
+ .slice()
185
+ .sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
186
186
  const selectValues = items => items.map(item => item.value);
187
187
  const selectOption = selectedOption => {
188
188
  if (selectValues(selectedOptions).includes(selectedOption.value)) {