@abgov/react-components 7.2.0-dev.4 → 7.2.0-dev.40

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.mjs CHANGED
@@ -9,7 +9,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
9
9
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
10
10
  var _PublicFormController_instances, updateObjectListState_fn, dispatchError_fn;
11
11
  import { jsxs, jsx } from "react/jsx-runtime";
12
- import { useRef, useEffect, useLayoutEffect, useState, useCallback } from "react";
12
+ import { useRef, useEffect, Children, isValidElement, Fragment, cloneElement, useLayoutEffect, useState, useCallback, createContext, useContext } from "react";
13
13
  const lowercase = (input) => input.toLowerCase();
14
14
  const kebab = (input) => input.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
15
15
  function transformProps(props, transform = lowercase) {
@@ -28,6 +28,8 @@ function GoabAccordion({
28
28
  open,
29
29
  onChange,
30
30
  headingContent,
31
+ headingType,
32
+ actions,
31
33
  children,
32
34
  ...rest
33
35
  }) {
@@ -46,15 +48,41 @@ function GoabAccordion({
46
48
  };
47
49
  }
48
50
  }, [onChange]);
49
- return /* @__PURE__ */ jsxs("goa-accordion", { ref, open: open ? "true" : void 0, ..._props, children: [
50
- headingContent && /* @__PURE__ */ jsx("div", { slot: "headingcontent", children: headingContent }),
51
- children
52
- ] });
51
+ return /* @__PURE__ */ jsxs(
52
+ "goa-accordion",
53
+ {
54
+ ref,
55
+ open: open ? "true" : void 0,
56
+ "heading-type": headingType,
57
+ ..._props,
58
+ children: [
59
+ headingContent && /* @__PURE__ */ jsx("div", { slot: "headingcontent", children: headingContent }),
60
+ actions && /* @__PURE__ */ jsx("div", { slot: "actions", children: actions }),
61
+ children
62
+ ]
63
+ }
64
+ );
65
+ }
66
+ function renderSlottedItems(children, slot) {
67
+ return Children.map(children, (child) => {
68
+ if (!isValidElement(child)) {
69
+ return child;
70
+ }
71
+ if (child.type === Fragment) {
72
+ const fragment = child;
73
+ return renderSlottedItems(fragment.props.children, slot);
74
+ }
75
+ return cloneElement(child, { slot });
76
+ });
53
77
  }
54
78
  function GoabAppHeader({
55
79
  onMenuClick,
56
80
  children,
57
81
  secondaryText,
82
+ banner,
83
+ phase,
84
+ navigation,
85
+ utilities,
58
86
  ...rest
59
87
  }) {
60
88
  const el = useRef(null);
@@ -75,7 +103,7 @@ function GoabAppHeader({
75
103
  current.removeEventListener("_menuClick", listener);
76
104
  };
77
105
  }, [el, onMenuClick]);
78
- return /* @__PURE__ */ jsx(
106
+ return /* @__PURE__ */ jsxs(
79
107
  "goa-app-header",
80
108
  {
81
109
  ref: el,
@@ -83,7 +111,13 @@ function GoabAppHeader({
83
111
  secondarytext: secondaryText,
84
112
  ..._props,
85
113
  version: "2",
86
- children
114
+ children: [
115
+ children,
116
+ banner && /* @__PURE__ */ jsx("div", { slot: "banner", children: banner }),
117
+ phase && /* @__PURE__ */ jsx("div", { slot: "phase", children: phase }),
118
+ navigation && renderSlottedItems(navigation, "navigation"),
119
+ utilities && renderSlottedItems(utilities, "utilities")
120
+ ]
87
121
  }
88
122
  );
89
123
  }
@@ -102,6 +136,7 @@ function getIconValue(icon, iconType) {
102
136
  return iconType ? "true" : "false";
103
137
  }
104
138
  function GoabBadge({
139
+ content,
105
140
  icon,
106
141
  iconType,
107
142
  size = "medium",
@@ -114,22 +149,30 @@ function GoabBadge({
114
149
  {
115
150
  icon: getIconValue(icon, iconType),
116
151
  icontype: iconType,
152
+ content: typeof content === "string" ? content : void 0,
117
153
  ..._props,
118
154
  version: "2",
119
155
  size,
120
- emphasis
156
+ emphasis,
157
+ children: typeof content !== "string" && content != null && /* @__PURE__ */ jsx("div", { slot: "content", children: content })
121
158
  }
122
159
  );
123
160
  }
124
- function GoabBlock({ testId, children, ...rest }) {
161
+ function GoabBlock({
162
+ testId,
163
+ stretch,
164
+ children,
165
+ ...rest
166
+ }) {
125
167
  const _props = transformProps({ testid: testId, ...rest }, kebab);
126
- return /* @__PURE__ */ jsx("goa-block", { ..._props, children });
168
+ return /* @__PURE__ */ jsx("goa-block", { ..._props, stretch: stretch ? "true" : void 0, children });
127
169
  }
128
170
  function GoabButton({
129
171
  disabled,
130
172
  onClick,
131
173
  actionArgs,
132
174
  actionArg,
175
+ ariaLabel,
133
176
  children,
134
177
  ...rest
135
178
  }) {
@@ -158,6 +201,7 @@ function GoabButton({
158
201
  disabled: disabled ? "true" : void 0,
159
202
  "action-arg": actionArg,
160
203
  "action-args": JSON.stringify(actionArgs),
204
+ arialabel: ariaLabel || void 0,
161
205
  ..._props,
162
206
  version: "2",
163
207
  children
@@ -232,6 +276,8 @@ function GoabCheckbox({
232
276
  description,
233
277
  reveal,
234
278
  onChange,
279
+ onFocus,
280
+ onBlur,
235
281
  name,
236
282
  children,
237
283
  size = "default",
@@ -248,11 +294,23 @@ function GoabCheckbox({
248
294
  const detail = e.detail;
249
295
  onChange == null ? void 0 : onChange({ ...detail, event: e });
250
296
  };
297
+ const focusListener = (e) => {
298
+ const detail = e.detail;
299
+ onFocus == null ? void 0 : onFocus({ ...detail, event: e });
300
+ };
301
+ const blurListener = (e) => {
302
+ const detail = e.detail;
303
+ onBlur == null ? void 0 : onBlur({ ...detail, event: e });
304
+ };
251
305
  current.addEventListener("_change", listener);
306
+ current.addEventListener("_focus", focusListener);
307
+ current.addEventListener("_blur", blurListener);
252
308
  return () => {
253
309
  current.removeEventListener("_change", listener);
310
+ current.removeEventListener("_focus", focusListener);
311
+ current.removeEventListener("_blur", blurListener);
254
312
  };
255
- }, [name, onChange]);
313
+ }, [name, onChange, onFocus, onBlur]);
256
314
  return /* @__PURE__ */ jsxs(
257
315
  "goa-checkbox",
258
316
  {
@@ -284,6 +342,8 @@ function GoabCheckboxList({
284
342
  size = "default",
285
343
  children,
286
344
  onChange,
345
+ onFocus,
346
+ onBlur,
287
347
  mt,
288
348
  mr,
289
349
  mb,
@@ -297,11 +357,23 @@ function GoabCheckboxList({
297
357
  const detail = e.detail;
298
358
  onChange == null ? void 0 : onChange({ ...detail, event: e });
299
359
  };
360
+ const focusListener = (e) => {
361
+ const detail = e.detail;
362
+ onFocus == null ? void 0 : onFocus({ ...detail, event: e });
363
+ };
364
+ const blurListener = (e) => {
365
+ const detail = e.detail;
366
+ onBlur == null ? void 0 : onBlur({ ...detail, event: e });
367
+ };
300
368
  current.addEventListener("_change", listener);
369
+ current.addEventListener("_focus", focusListener);
370
+ current.addEventListener("_blur", blurListener);
301
371
  return () => {
302
372
  current.removeEventListener("_change", listener);
373
+ current.removeEventListener("_focus", focusListener);
374
+ current.removeEventListener("_blur", blurListener);
303
375
  };
304
- }, [onChange]);
376
+ }, [onChange, onFocus, onBlur]);
305
377
  return /* @__PURE__ */ jsx(
306
378
  "goa-checkbox-list",
307
379
  {
@@ -398,6 +470,9 @@ function GoabDataGrid({
398
470
  }
399
471
  );
400
472
  }
473
+ const GoabWorkspaceLayoutScrollState = {
474
+ NO_SCROLL: "no-scroll"
475
+ };
401
476
  function dispatch(el, eventName, detail, opts) {
402
477
  if (!el) {
403
478
  console.error("dispatch element is null");
@@ -2597,6 +2672,8 @@ function GoabDatePicker({
2597
2672
  disabled,
2598
2673
  relative,
2599
2674
  onChange,
2675
+ onFocus,
2676
+ onBlur,
2600
2677
  ...rest
2601
2678
  }) {
2602
2679
  const ref = useRef(null);
@@ -2617,15 +2694,27 @@ function GoabDatePicker({
2617
2694
  const detail = e.detail;
2618
2695
  onChange == null ? void 0 : onChange({ ...detail, event: e });
2619
2696
  };
2697
+ const handleFocus = (e) => {
2698
+ const detail = e.detail;
2699
+ onFocus == null ? void 0 : onFocus({ ...detail, event: e });
2700
+ };
2701
+ const handleBlur = (e) => {
2702
+ const detail = e.detail;
2703
+ onBlur == null ? void 0 : onBlur({ ...detail, event: e });
2704
+ };
2620
2705
  if (onChange) {
2621
2706
  current.addEventListener("_change", handleChange);
2622
2707
  }
2708
+ current.addEventListener("_focus", handleFocus);
2709
+ current.addEventListener("_blur", handleBlur);
2623
2710
  return () => {
2624
2711
  if (onChange) {
2625
2712
  current.removeEventListener("_change", handleChange);
2626
2713
  }
2714
+ current.removeEventListener("_focus", handleFocus);
2715
+ current.removeEventListener("_blur", handleBlur);
2627
2716
  };
2628
- }, [onChange]);
2717
+ }, [onChange, onFocus, onBlur]);
2629
2718
  const formatValue = (val) => {
2630
2719
  if (!val) return "";
2631
2720
  if (val instanceof Date) {
@@ -2721,6 +2810,8 @@ function stringify(value) {
2721
2810
  function GoabDropdown({
2722
2811
  value,
2723
2812
  onChange,
2813
+ onFocus,
2814
+ onBlur,
2724
2815
  disabled,
2725
2816
  error,
2726
2817
  filterable,
@@ -2742,15 +2833,27 @@ function GoabDropdown({
2742
2833
  const detail = e.detail;
2743
2834
  onChange == null ? void 0 : onChange({ ...detail, event: e });
2744
2835
  };
2836
+ const focusListener = (e) => {
2837
+ const detail = e.detail;
2838
+ onFocus == null ? void 0 : onFocus({ ...detail, event: e });
2839
+ };
2840
+ const blurListener = (e) => {
2841
+ const detail = e.detail;
2842
+ onBlur == null ? void 0 : onBlur({ ...detail, event: e });
2843
+ };
2745
2844
  if (onChange) {
2746
2845
  current.addEventListener("_change", handler);
2747
2846
  }
2847
+ current.addEventListener("_focus", focusListener);
2848
+ current.addEventListener("_blur", blurListener);
2748
2849
  return () => {
2749
2850
  if (onChange) {
2750
2851
  current.removeEventListener("_change", handler);
2751
2852
  }
2853
+ current.removeEventListener("_focus", focusListener);
2854
+ current.removeEventListener("_blur", blurListener);
2752
2855
  };
2753
- }, [el, onChange]);
2856
+ }, [el, onChange, onFocus, onBlur]);
2754
2857
  return /* @__PURE__ */ jsx(
2755
2858
  "goa-dropdown",
2756
2859
  {
@@ -2779,7 +2882,8 @@ function GoabDropdownItem({
2779
2882
  label,
2780
2883
  filter,
2781
2884
  name,
2782
- mountType = "append"
2885
+ mountType = "append",
2886
+ children
2783
2887
  }) {
2784
2888
  return /* @__PURE__ */ jsx(
2785
2889
  "goa-dropdown-item",
@@ -2788,7 +2892,71 @@ function GoabDropdownItem({
2788
2892
  label,
2789
2893
  filter,
2790
2894
  name,
2791
- mount: mountType
2895
+ mount: mountType,
2896
+ children
2897
+ }
2898
+ );
2899
+ }
2900
+ function GoabDropdownMultiselect({
2901
+ name,
2902
+ value = [],
2903
+ placeholder,
2904
+ disabled,
2905
+ error,
2906
+ filterable,
2907
+ leadingIcon,
2908
+ showSelectAll,
2909
+ testId,
2910
+ ariaLabel,
2911
+ ariaLabelledBy,
2912
+ maxHeight,
2913
+ width,
2914
+ size = "default",
2915
+ labelFormat,
2916
+ children,
2917
+ onChange,
2918
+ mt,
2919
+ mr,
2920
+ mb,
2921
+ ml
2922
+ }) {
2923
+ const el = useRef(null);
2924
+ useEffect(() => {
2925
+ if (!el.current) return;
2926
+ const current = el.current;
2927
+ const listener = (e) => {
2928
+ const detail = e.detail;
2929
+ onChange == null ? void 0 : onChange({ ...detail, event: e });
2930
+ };
2931
+ current.addEventListener("_change", listener);
2932
+ return () => {
2933
+ current.removeEventListener("_change", listener);
2934
+ };
2935
+ }, [onChange]);
2936
+ return /* @__PURE__ */ jsx(
2937
+ "goa-dropdown-multiselect",
2938
+ {
2939
+ ref: el,
2940
+ name,
2941
+ value,
2942
+ placeholder,
2943
+ disabled: disabled ? "true" : void 0,
2944
+ error: error ? "true" : void 0,
2945
+ filterable: filterable ? "true" : void 0,
2946
+ "leading-icon": leadingIcon,
2947
+ testid: testId,
2948
+ "aria-label": ariaLabel,
2949
+ "aria-labelledby": ariaLabelledBy,
2950
+ "max-height": maxHeight,
2951
+ width,
2952
+ size,
2953
+ "label-format": labelFormat ? labelFormat : void 0,
2954
+ "show-select-all": showSelectAll ? "true" : void 0,
2955
+ mt,
2956
+ mr,
2957
+ mb,
2958
+ ml,
2959
+ children
2792
2960
  }
2793
2961
  );
2794
2962
  }
@@ -3153,6 +3321,7 @@ function GoabHeroBannerActions({
3153
3321
  }
3154
3322
  function GoabIconButton({
3155
3323
  variant = "color",
3324
+ type = "default",
3156
3325
  size = "medium",
3157
3326
  theme = "outline",
3158
3327
  disabled,
@@ -3163,7 +3332,7 @@ function GoabIconButton({
3163
3332
  ...rest
3164
3333
  }) {
3165
3334
  const ref = useRef(null);
3166
- const _props = transformProps({ variant, size, theme, ...rest }, lowercase);
3335
+ const _props = transformProps({ variant, type, size, theme, ...rest }, lowercase);
3167
3336
  useEffect(() => {
3168
3337
  if (!ref.current) {
3169
3338
  return;
@@ -3192,12 +3361,13 @@ function GoabIconButton({
3192
3361
  }
3193
3362
  );
3194
3363
  }
3195
- function GoabIcon({ inverted, ...rest }) {
3364
+ function GoabIcon({ inverted, ariaHidden, ...rest }) {
3196
3365
  const _props = transformProps(rest, lowercase);
3197
3366
  return /* @__PURE__ */ jsx(
3198
3367
  "goa-icon",
3199
3368
  {
3200
3369
  inverted: typeof inverted === "boolean" ? inverted ? "true" : void 0 : inverted,
3370
+ ariahidden: ariaHidden ? "true" : void 0,
3201
3371
  ..._props
3202
3372
  }
3203
3373
  );
@@ -3819,6 +3989,8 @@ function GoabRadioGroup({
3819
3989
  disabled,
3820
3990
  error,
3821
3991
  onChange,
3992
+ onFocus,
3993
+ onBlur,
3822
3994
  name,
3823
3995
  children,
3824
3996
  size = "default",
@@ -3832,16 +4004,28 @@ function GoabRadioGroup({
3832
4004
  const detail = e.detail;
3833
4005
  onChange == null ? void 0 : onChange({ ...detail, event: e });
3834
4006
  };
4007
+ const focusListener = (e) => {
4008
+ const detail = e.detail;
4009
+ onFocus == null ? void 0 : onFocus({ ...detail, event: e });
4010
+ };
4011
+ const blurListener = (e) => {
4012
+ const detail = e.detail;
4013
+ onBlur == null ? void 0 : onBlur({ ...detail, event: e });
4014
+ };
3835
4015
  const currentEl = el.current;
3836
4016
  if (onChange) {
3837
4017
  currentEl.addEventListener("_change", listener);
3838
4018
  }
4019
+ currentEl.addEventListener("_focus", focusListener);
4020
+ currentEl.addEventListener("_blur", blurListener);
3839
4021
  return () => {
3840
4022
  if (onChange) {
3841
4023
  currentEl.removeEventListener("_change", listener);
3842
4024
  }
4025
+ currentEl.removeEventListener("_focus", focusListener);
4026
+ currentEl.removeEventListener("_blur", blurListener);
3843
4027
  };
3844
- }, [name, onChange]);
4028
+ }, [name, onChange, onFocus, onBlur]);
3845
4029
  return /* @__PURE__ */ jsx(
3846
4030
  "goa-radio-group",
3847
4031
  {
@@ -3948,6 +4132,32 @@ function GoabSpinner({
3948
4132
  }
3949
4133
  );
3950
4134
  }
4135
+ function GoabScrollPanel({
4136
+ header,
4137
+ children,
4138
+ footer,
4139
+ height,
4140
+ testId,
4141
+ direction = "vertical",
4142
+ ...rest
4143
+ }) {
4144
+ const hostStyle = height ? { height } : void 0;
4145
+ return /* @__PURE__ */ jsxs(
4146
+ "goa-scroll-panel",
4147
+ {
4148
+ height,
4149
+ testid: testId,
4150
+ direction,
4151
+ style: hostStyle,
4152
+ ...rest,
4153
+ children: [
4154
+ header && /* @__PURE__ */ jsx("div", { slot: "header", children: header }),
4155
+ children,
4156
+ footer && /* @__PURE__ */ jsx("div", { slot: "footer", children: footer })
4157
+ ]
4158
+ }
4159
+ );
4160
+ }
3951
4161
  function GoabTable({ onSort, onMultiSort, sortMode, ...props }) {
3952
4162
  const ref = useRef(null);
3953
4163
  useEffect(() => {
@@ -4090,6 +4300,7 @@ function GoabTextArea({
4090
4300
  error,
4091
4301
  onChange,
4092
4302
  onKeyPress,
4303
+ onFocus,
4093
4304
  onBlur,
4094
4305
  ...rest
4095
4306
  }) {
@@ -4108,19 +4319,25 @@ function GoabTextArea({
4108
4319
  const detail = e.detail;
4109
4320
  onKeyPress == null ? void 0 : onKeyPress({ ...detail, event: e });
4110
4321
  };
4322
+ const focusListener = (e) => {
4323
+ const detail = e.detail;
4324
+ onFocus == null ? void 0 : onFocus({ ...detail, event: e });
4325
+ };
4111
4326
  const blurListener = (e) => {
4112
4327
  const detail = e.detail;
4113
4328
  onBlur == null ? void 0 : onBlur({ ...detail, event: e });
4114
4329
  };
4115
4330
  current.addEventListener("_change", changeListener);
4116
4331
  current.addEventListener("_keyPress", keypressListener);
4332
+ current.addEventListener("_focus", focusListener);
4117
4333
  current.addEventListener("_blur", blurListener);
4118
4334
  return () => {
4119
4335
  current.removeEventListener("_change", changeListener);
4120
4336
  current.removeEventListener("_keyPress", keypressListener);
4337
+ current.removeEventListener("_focus", focusListener);
4121
4338
  current.removeEventListener("_blur", blurListener);
4122
4339
  };
4123
- }, [el, onChange, onKeyPress, onBlur]);
4340
+ }, [el, onChange, onKeyPress, onFocus, onBlur]);
4124
4341
  return /* @__PURE__ */ jsx(
4125
4342
  "goa-textarea",
4126
4343
  {
@@ -4179,6 +4396,7 @@ function GoabTwoColumnLayout(props) {
4179
4396
  );
4180
4397
  }
4181
4398
  const GoabFilterChip = ({
4399
+ content,
4182
4400
  iconTheme = "outline",
4183
4401
  error,
4184
4402
  onClick,
@@ -4199,9 +4417,11 @@ const GoabFilterChip = ({
4199
4417
  "goa-filter-chip",
4200
4418
  {
4201
4419
  ref: el,
4420
+ content: typeof content === "string" ? content : void 0,
4202
4421
  error: error ? "true" : void 0,
4203
4422
  version: "2",
4204
- ..._props
4423
+ ..._props,
4424
+ children: typeof content !== "string" && content != null && /* @__PURE__ */ jsx("div", { slot: "content", children: content })
4205
4425
  }
4206
4426
  );
4207
4427
  };
@@ -4302,30 +4522,28 @@ function GoabWorkSideMenu({
4302
4522
  }) {
4303
4523
  const el = useRef(null);
4304
4524
  useEffect(() => {
4305
- var _a;
4306
- if (!(el == null ? void 0 : el.current) || !onToggle) {
4525
+ const node = el.current;
4526
+ if (!node || !onToggle) {
4307
4527
  return;
4308
4528
  }
4309
- (_a = el.current) == null ? void 0 : _a.addEventListener("_toggle", onToggle);
4529
+ node.addEventListener("_toggle", onToggle);
4310
4530
  return () => {
4311
- var _a2;
4312
- (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_toggle", onToggle);
4531
+ node.removeEventListener("_toggle", onToggle);
4313
4532
  };
4314
- }, [el, onToggle]);
4533
+ }, [onToggle]);
4315
4534
  useEffect(() => {
4316
- var _a;
4317
- if (!(el == null ? void 0 : el.current) || !onNavigate) {
4535
+ const node = el.current;
4536
+ if (!node || !onNavigate) {
4318
4537
  return;
4319
4538
  }
4320
4539
  const handler = (e) => {
4321
4540
  onNavigate(e.detail.url);
4322
4541
  };
4323
- (_a = el.current) == null ? void 0 : _a.addEventListener("_navigate", handler);
4542
+ node.addEventListener("_navigate", handler);
4324
4543
  return () => {
4325
- var _a2;
4326
- (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_navigate", handler);
4544
+ node.removeEventListener("_navigate", handler);
4327
4545
  };
4328
- }, [el, onNavigate]);
4546
+ }, [onNavigate]);
4329
4547
  return /* @__PURE__ */ jsxs(
4330
4548
  "goa-work-side-menu",
4331
4549
  {
@@ -4370,6 +4588,7 @@ function GoabWorkSideMenuItem(props) {
4370
4588
  type: props.type,
4371
4589
  children: [
4372
4590
  props.popoverContent && /* @__PURE__ */ jsx("div", { slot: "popoverContent", children: props.popoverContent }),
4591
+ props.trailingContent && /* @__PURE__ */ jsx("div", { slot: "trailingContent", children: props.trailingContent }),
4373
4592
  props.children
4374
4593
  ]
4375
4594
  }
@@ -4447,6 +4666,95 @@ function GoabWorkSideNotificationPanel({
4447
4666
  }
4448
4667
  );
4449
4668
  }
4669
+ const STORAGE_KEY = "goab-theme";
4670
+ const ATTRIBUTE = "data-theme";
4671
+ const GoabThemeContext = createContext(null);
4672
+ function readInitialMode(defaultMode) {
4673
+ if (typeof window === "undefined") return defaultMode;
4674
+ try {
4675
+ const stored = window.localStorage.getItem(STORAGE_KEY);
4676
+ if (stored === "light" || stored === "dark") return stored;
4677
+ } catch {
4678
+ }
4679
+ const fromAttribute = document.documentElement.getAttribute(ATTRIBUTE);
4680
+ if (fromAttribute === "light" || fromAttribute === "dark") return fromAttribute;
4681
+ if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
4682
+ return defaultMode;
4683
+ }
4684
+ function GoabThemeProvider({
4685
+ children,
4686
+ defaultMode = "light"
4687
+ }) {
4688
+ const [mode, setModeState] = useState(
4689
+ () => readInitialMode(defaultMode)
4690
+ );
4691
+ useEffect(() => {
4692
+ if (typeof document === "undefined") return;
4693
+ document.documentElement.setAttribute(ATTRIBUTE, mode);
4694
+ try {
4695
+ window.localStorage.setItem(STORAGE_KEY, mode);
4696
+ } catch {
4697
+ }
4698
+ }, [mode]);
4699
+ const setMode = useCallback((next) => {
4700
+ setModeState(next);
4701
+ }, []);
4702
+ const toggle = useCallback(() => {
4703
+ setModeState((prev) => prev === "light" ? "dark" : "light");
4704
+ }, []);
4705
+ return /* @__PURE__ */ jsx(GoabThemeContext.Provider, { value: { mode, setMode, toggle }, children });
4706
+ }
4707
+ function useTheme() {
4708
+ const ctx = useContext(GoabThemeContext);
4709
+ if (!ctx) {
4710
+ throw new Error("useTheme must be used within a GoabThemeProvider");
4711
+ }
4712
+ return ctx;
4713
+ }
4714
+ const GoabWorkspaceLayoutScrollStateDefault = {
4715
+ scrollPosition: GoabWorkspaceLayoutScrollState.NO_SCROLL,
4716
+ isScrollable: false
4717
+ };
4718
+ const GoabWorkspaceLayoutScrollStateContext = createContext(
4719
+ GoabWorkspaceLayoutScrollStateDefault
4720
+ );
4721
+ function useGoabWorkspaceLayoutScrollState() {
4722
+ return useContext(GoabWorkspaceLayoutScrollStateContext);
4723
+ }
4724
+ function GoabWorkspaceLayout({
4725
+ sideMenu,
4726
+ pageHeader,
4727
+ pageFooter,
4728
+ pushDrawer,
4729
+ children,
4730
+ testId,
4731
+ onScrollStateChange,
4732
+ ...rest
4733
+ }) {
4734
+ const ref = useRef(null);
4735
+ const [scrollState, setScrollState] = useState(GoabWorkspaceLayoutScrollStateDefault);
4736
+ useEffect(() => {
4737
+ const el = ref.current;
4738
+ if (!el) return;
4739
+ const listener = (e) => {
4740
+ const detail = e.detail;
4741
+ setScrollState({
4742
+ scrollPosition: detail.state,
4743
+ isScrollable: detail.isScrollable
4744
+ });
4745
+ onScrollStateChange == null ? void 0 : onScrollStateChange({ ...detail, event: e });
4746
+ };
4747
+ el.addEventListener("_scrollStateChange", listener);
4748
+ return () => el.removeEventListener("_scrollStateChange", listener);
4749
+ }, [onScrollStateChange]);
4750
+ return /* @__PURE__ */ jsx(GoabWorkspaceLayoutScrollStateContext.Provider, { value: scrollState, children: /* @__PURE__ */ jsxs("goa-workspace-layout", { ref, testid: testId, ...rest, children: [
4751
+ sideMenu && /* @__PURE__ */ jsx("div", { slot: "side-menu", children: sideMenu }),
4752
+ pageHeader && /* @__PURE__ */ jsx("div", { slot: "page-header", children: pageHeader }),
4753
+ children,
4754
+ pageFooter && /* @__PURE__ */ jsx("div", { slot: "page-footer", children: pageFooter }),
4755
+ pushDrawer && /* @__PURE__ */ jsx("div", { slot: "push-drawer", children: pushDrawer })
4756
+ ] }) });
4757
+ }
4450
4758
  export {
4451
4759
  GoALinkButton,
4452
4760
  GoabAccordion,
@@ -4473,6 +4781,7 @@ export {
4473
4781
  GoabDrawer,
4474
4782
  GoabDropdown,
4475
4783
  GoabDropdownItem,
4784
+ GoabDropdownMultiselect,
4476
4785
  GoabDropdownOption,
4477
4786
  GoabFieldset,
4478
4787
  GoabFileUploadCard,
@@ -4522,6 +4831,7 @@ export {
4522
4831
  GoabPushDrawer,
4523
4832
  GoabRadioGroup,
4524
4833
  GoabRadioItem,
4834
+ GoabScrollPanel,
4525
4835
  GoabSideMenu,
4526
4836
  GoabSideMenuGroup,
4527
4837
  GoabSideMenuHeading,
@@ -4536,6 +4846,7 @@ export {
4536
4846
  GoabText,
4537
4847
  GoabTextArea,
4538
4848
  GoabTextArea as GoabTextarea,
4849
+ GoabThemeProvider,
4539
4850
  GoabThreeColumnLayout,
4540
4851
  GoabTooltip,
4541
4852
  GoabTwoColumnLayout,
@@ -4544,6 +4855,9 @@ export {
4544
4855
  GoabWorkSideMenuItem,
4545
4856
  GoabWorkSideNotificationItem,
4546
4857
  GoabWorkSideNotificationPanel,
4547
- usePublicFormController
4858
+ GoabWorkspaceLayout,
4859
+ useGoabWorkspaceLayoutScrollState,
4860
+ usePublicFormController,
4861
+ useTheme
4548
4862
  };
4549
4863
  //# sourceMappingURL=index.mjs.map