@thecb/components 8.4.8-beta.4 → 8.4.8-beta.6

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": "8.4.8-beta.4",
3
+ "version": "8.4.8-beta.6",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -12,6 +12,7 @@ export * from "./nav-footer";
12
12
  export * from "./nav-header";
13
13
  export * from "./nav-tabs";
14
14
  export * from "./paragraph";
15
+ export * from "./searchable-select";
15
16
  export * from "./spinner";
16
17
  export * from "./table";
17
18
  export * from "./text";
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import Expand from "../../../util/expand";
3
+ import {
4
+ Field,
5
+ FieldActions,
6
+ SearchableSelectOption
7
+ } from "../../../types/common";
8
+
9
+ export interface SearchableSelectProps {
10
+ items: SearchableSelectOption[];
11
+ selectedItems: SearchableSelectOption[];
12
+ allSelected: boolean;
13
+ toggleSelectAllItems: (isSelectAll: boolean) => void;
14
+ selectItem: (item: SearchableSelectOption) => void;
15
+ fields: {
16
+ searchTerm: Field;
17
+ };
18
+ actions: FieldActions;
19
+ disabled?: boolean;
20
+ placeholder: string;
21
+ }
22
+
23
+ export const SearchableSelect: React.FC<Expand<SearchableSelectProps> &
24
+ React.HTMLAttributes<HTMLElement>>;
@@ -16,17 +16,18 @@ import { Box, Cluster } from "../../atoms/layouts";
16
16
  */
17
17
 
18
18
  const Module = ({
19
+ variant = "default",
20
+ as,
21
+ disabled,
19
22
  heading,
23
+ rightTitleContent,
24
+ titleID = "",
20
25
  spacing = "1rem",
21
26
  padding = "0",
22
- spacingBottom = "2.5rem",
23
27
  margin = "0",
24
- themeValues,
25
- variant = "default",
28
+ spacingBottom = "2.5rem",
26
29
  fontSize,
27
- as,
28
- titleID = "",
29
- rightTitleContent,
30
+ themeValues,
30
31
  children
31
32
  }) => {
32
33
  const themedFontSize =
@@ -39,6 +40,7 @@ const Module = ({
39
40
  const themedElemType =
40
41
  variant === "small" ? "h6" : variant === "default" ? "h5" : "h2";
41
42
  const computedElemType = as || themedElemType;
43
+ const disabledStyles = 'opacity: 0.40;"';
42
44
  const headingText = (
43
45
  <Title
44
46
  weight={themeValues.fontWeight}
@@ -54,7 +56,12 @@ const Module = ({
54
56
  );
55
57
 
56
58
  return (
57
- <Fragment>
59
+ <Box
60
+ aria-disabled={"true"}
61
+ extraStyles={disabled && disabledStyles}
62
+ padding="0"
63
+ role={"group"}
64
+ >
58
65
  {heading && !rightTitleContent && headingText}
59
66
  {heading && rightTitleContent && (
60
67
  <Cluster justify="space-between" align="center" nowrap>
@@ -72,7 +79,7 @@ const Module = ({
72
79
  {children}
73
80
  </Box>
74
81
  </Box>
75
- </Fragment>
82
+ </Box>
76
83
  );
77
84
  };
78
85
 
@@ -0,0 +1,4 @@
1
+ export default interface SearchableSelectOption {
2
+ name?: string;
3
+ value?: string;
4
+ }
@@ -2,5 +2,6 @@ export { default as Field } from "./Field";
2
2
  export { default as ReduxAction } from "./ReduxAction";
3
3
  export { default as FieldActions } from "./FieldActions";
4
4
  export { default as FormSelectOption } from "./FormSelectOption";
5
+ export { default as SearchableSelectOption } from "./SearchableSelectOption";
5
6
  export { default as ErrorMessageDictionary } from "./ErrorMessageDictionary";
6
7
  export * from "./FieldActions";