@abgov/react-components 7.2.0-dev.20 → 7.2.0-dev.22

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/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export * from './lib/divider/divider';
19
19
  export * from './lib/drawer/drawer';
20
20
  export * from './lib/dropdown/dropdown';
21
21
  export * from './lib/dropdown/dropdown-item';
22
+ export * from './lib/dropdown-multiselect/dropdown-multiselect';
22
23
  export * from './lib/file-upload-card/file-upload-card';
23
24
  export * from './lib/file-upload-input/file-upload-input';
24
25
  export * from './lib/footer/footer';
package/index.js CHANGED
@@ -65,10 +65,26 @@ function GoabAccordion({
65
65
  }
66
66
  );
67
67
  }
68
+ function renderSlottedItems(children, slot) {
69
+ return react.Children.map(children, (child) => {
70
+ if (!react.isValidElement(child)) {
71
+ return child;
72
+ }
73
+ if (child.type === react.Fragment) {
74
+ const fragment = child;
75
+ return renderSlottedItems(fragment.props.children, slot);
76
+ }
77
+ return react.cloneElement(child, { slot });
78
+ });
79
+ }
68
80
  function GoabAppHeader({
69
81
  onMenuClick,
70
82
  children,
71
83
  secondaryText,
84
+ banner,
85
+ phase,
86
+ navigation,
87
+ utilities,
72
88
  ...rest
73
89
  }) {
74
90
  const el = react.useRef(null);
@@ -89,7 +105,7 @@ function GoabAppHeader({
89
105
  current.removeEventListener("_menuClick", listener);
90
106
  };
91
107
  }, [el, onMenuClick]);
92
- return /* @__PURE__ */ jsxRuntime.jsx(
108
+ return /* @__PURE__ */ jsxRuntime.jsxs(
93
109
  "goa-app-header",
94
110
  {
95
111
  ref: el,
@@ -97,7 +113,13 @@ function GoabAppHeader({
97
113
  secondarytext: secondaryText,
98
114
  ..._props,
99
115
  version: "2",
100
- children
116
+ children: [
117
+ children,
118
+ banner && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "banner", children: banner }),
119
+ phase && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "phase", children: phase }),
120
+ navigation && renderSlottedItems(navigation, "navigation"),
121
+ utilities && renderSlottedItems(utilities, "utilities")
122
+ ]
101
123
  }
102
124
  );
103
125
  }
@@ -2857,7 +2879,8 @@ function GoabDropdownItem({
2857
2879
  label,
2858
2880
  filter,
2859
2881
  name,
2860
- mountType = "append"
2882
+ mountType = "append",
2883
+ children
2861
2884
  }) {
2862
2885
  return /* @__PURE__ */ jsxRuntime.jsx(
2863
2886
  "goa-dropdown-item",
@@ -2866,7 +2889,71 @@ function GoabDropdownItem({
2866
2889
  label,
2867
2890
  filter,
2868
2891
  name,
2869
- mount: mountType
2892
+ mount: mountType,
2893
+ children
2894
+ }
2895
+ );
2896
+ }
2897
+ function GoabDropdownMultiselect({
2898
+ name,
2899
+ value = [],
2900
+ placeholder,
2901
+ disabled,
2902
+ error,
2903
+ filterable,
2904
+ leadingIcon,
2905
+ showSelectAll,
2906
+ testId,
2907
+ ariaLabel,
2908
+ ariaLabelledBy,
2909
+ maxHeight,
2910
+ width,
2911
+ size = "default",
2912
+ labelFormat,
2913
+ children,
2914
+ onChange,
2915
+ mt,
2916
+ mr,
2917
+ mb,
2918
+ ml
2919
+ }) {
2920
+ const el = react.useRef(null);
2921
+ react.useEffect(() => {
2922
+ if (!el.current) return;
2923
+ const current = el.current;
2924
+ const listener = (e) => {
2925
+ const detail = e.detail;
2926
+ onChange == null ? void 0 : onChange({ ...detail, event: e });
2927
+ };
2928
+ current.addEventListener("_change", listener);
2929
+ return () => {
2930
+ current.removeEventListener("_change", listener);
2931
+ };
2932
+ }, [onChange]);
2933
+ return /* @__PURE__ */ jsxRuntime.jsx(
2934
+ "goa-dropdown-multiselect",
2935
+ {
2936
+ ref: el,
2937
+ name,
2938
+ value,
2939
+ placeholder,
2940
+ disabled: disabled ? "true" : void 0,
2941
+ error: error ? "true" : void 0,
2942
+ filterable: filterable ? "true" : void 0,
2943
+ "leading-icon": leadingIcon,
2944
+ testid: testId,
2945
+ "aria-label": ariaLabel,
2946
+ "aria-labelledby": ariaLabelledBy,
2947
+ "max-height": maxHeight,
2948
+ width,
2949
+ size,
2950
+ "label-format": labelFormat ? labelFormat : void 0,
2951
+ "show-select-all": showSelectAll ? "true" : void 0,
2952
+ mt,
2953
+ mr,
2954
+ mb,
2955
+ ml,
2956
+ children
2870
2957
  }
2871
2958
  );
2872
2959
  }
@@ -4674,6 +4761,7 @@ exports.GoabDivider = GoabDivider;
4674
4761
  exports.GoabDrawer = GoabDrawer;
4675
4762
  exports.GoabDropdown = GoabDropdown;
4676
4763
  exports.GoabDropdownItem = GoabDropdownItem;
4764
+ exports.GoabDropdownMultiselect = GoabDropdownMultiselect;
4677
4765
  exports.GoabDropdownOption = GoabDropdownOption;
4678
4766
  exports.GoabFieldset = GoabFieldset;
4679
4767
  exports.GoabFileUploadCard = GoabFileUploadCard;