@abgov/react-components 7.2.0-dev.2 → 7.2.0-dev.21
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 +3 -0
- package/index.js +258 -28
- package/index.js.map +1 -1
- package/index.mjs +260 -30
- package/index.mjs.map +1 -1
- package/lib/accordion/accordion.d.ts +7 -2
- package/lib/app-header/app-header.d.ts +12 -4
- package/lib/app-header-menu/app-header-menu.d.ts +1 -1
- package/lib/block/block.d.ts +4 -1
- package/lib/checkbox/checkbox.d.ts +6 -2
- package/lib/checkbox-list/checkbox-list.d.ts +6 -2
- package/lib/date-picker/date-picker.d.ts +6 -2
- package/lib/dropdown/dropdown-item.d.ts +5 -2
- package/lib/dropdown/dropdown.d.ts +6 -2
- package/lib/radio-group/radio-group.d.ts +6 -2
- package/lib/scroll-panel/scroll-panel.d.ts +32 -0
- package/lib/table/table-sort-header.d.ts +1 -0
- package/lib/textarea/textarea.d.ts +4 -2
- package/lib/theme/theme-context.d.ts +14 -0
- package/lib/work-side-menu-item/work-side-menu-item.d.ts +4 -2
- package/lib/workspace-layout/workspace-layout-scroll-state.d.ts +22 -0
- package/lib/workspace-layout/workspace-layout.d.ts +42 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export * from './lib/side-menu/side-menu';
|
|
|
62
62
|
export * from './lib/skeleton/skeleton';
|
|
63
63
|
export * from './lib/spacer/spacer';
|
|
64
64
|
export * from './lib/spinner/spinner';
|
|
65
|
+
export * from './lib/scroll-panel/scroll-panel';
|
|
65
66
|
export * from './lib/table/table';
|
|
66
67
|
export * from './lib/table/table-sort-header';
|
|
67
68
|
export * from './lib/tabs/tabs';
|
|
@@ -79,3 +80,5 @@ export * from './lib/work-side-menu-group/work-side-menu-group';
|
|
|
79
80
|
export * from './lib/work-side-menu-item/work-side-menu-item';
|
|
80
81
|
export * from './lib/work-side-notification-item/work-side-notification-item';
|
|
81
82
|
export * from './lib/work-side-notification-panel/work-side-notification-panel';
|
|
83
|
+
export * from './lib/theme/theme-context';
|
|
84
|
+
export * from './lib/workspace-layout/workspace-layout';
|
package/index.js
CHANGED
|
@@ -30,6 +30,8 @@ function GoabAccordion({
|
|
|
30
30
|
open,
|
|
31
31
|
onChange,
|
|
32
32
|
headingContent,
|
|
33
|
+
headingType,
|
|
34
|
+
actions,
|
|
33
35
|
children,
|
|
34
36
|
...rest
|
|
35
37
|
}) {
|
|
@@ -48,15 +50,41 @@ function GoabAccordion({
|
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
}, [onChange]);
|
|
51
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
54
|
+
"goa-accordion",
|
|
55
|
+
{
|
|
56
|
+
ref,
|
|
57
|
+
open: open ? "true" : void 0,
|
|
58
|
+
"heading-type": headingType,
|
|
59
|
+
..._props,
|
|
60
|
+
children: [
|
|
61
|
+
headingContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "headingcontent", children: headingContent }),
|
|
62
|
+
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "actions", children: actions }),
|
|
63
|
+
children
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
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
|
+
});
|
|
55
79
|
}
|
|
56
80
|
function GoabAppHeader({
|
|
57
81
|
onMenuClick,
|
|
58
82
|
children,
|
|
59
83
|
secondaryText,
|
|
84
|
+
banner,
|
|
85
|
+
phase,
|
|
86
|
+
navigation,
|
|
87
|
+
utilities,
|
|
60
88
|
...rest
|
|
61
89
|
}) {
|
|
62
90
|
const el = react.useRef(null);
|
|
@@ -77,7 +105,7 @@ function GoabAppHeader({
|
|
|
77
105
|
current.removeEventListener("_menuClick", listener);
|
|
78
106
|
};
|
|
79
107
|
}, [el, onMenuClick]);
|
|
80
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
108
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
81
109
|
"goa-app-header",
|
|
82
110
|
{
|
|
83
111
|
ref: el,
|
|
@@ -85,7 +113,13 @@ function GoabAppHeader({
|
|
|
85
113
|
secondarytext: secondaryText,
|
|
86
114
|
..._props,
|
|
87
115
|
version: "2",
|
|
88
|
-
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
|
+
]
|
|
89
123
|
}
|
|
90
124
|
);
|
|
91
125
|
}
|
|
@@ -123,9 +157,14 @@ function GoabBadge({
|
|
|
123
157
|
}
|
|
124
158
|
);
|
|
125
159
|
}
|
|
126
|
-
function GoabBlock({
|
|
160
|
+
function GoabBlock({
|
|
161
|
+
testId,
|
|
162
|
+
stretch,
|
|
163
|
+
children,
|
|
164
|
+
...rest
|
|
165
|
+
}) {
|
|
127
166
|
const _props = transformProps({ testid: testId, ...rest }, kebab);
|
|
128
|
-
return /* @__PURE__ */ jsxRuntime.jsx("goa-block", { ..._props, children });
|
|
167
|
+
return /* @__PURE__ */ jsxRuntime.jsx("goa-block", { ..._props, stretch: stretch ? "true" : void 0, children });
|
|
129
168
|
}
|
|
130
169
|
function GoabButton({
|
|
131
170
|
disabled,
|
|
@@ -234,6 +273,8 @@ function GoabCheckbox({
|
|
|
234
273
|
description,
|
|
235
274
|
reveal,
|
|
236
275
|
onChange,
|
|
276
|
+
onFocus,
|
|
277
|
+
onBlur,
|
|
237
278
|
name,
|
|
238
279
|
children,
|
|
239
280
|
size = "default",
|
|
@@ -250,11 +291,23 @@ function GoabCheckbox({
|
|
|
250
291
|
const detail = e.detail;
|
|
251
292
|
onChange == null ? void 0 : onChange({ ...detail, event: e });
|
|
252
293
|
};
|
|
294
|
+
const focusListener = (e) => {
|
|
295
|
+
const detail = e.detail;
|
|
296
|
+
onFocus == null ? void 0 : onFocus({ ...detail, event: e });
|
|
297
|
+
};
|
|
298
|
+
const blurListener = (e) => {
|
|
299
|
+
const detail = e.detail;
|
|
300
|
+
onBlur == null ? void 0 : onBlur({ ...detail, event: e });
|
|
301
|
+
};
|
|
253
302
|
current.addEventListener("_change", listener);
|
|
303
|
+
current.addEventListener("_focus", focusListener);
|
|
304
|
+
current.addEventListener("_blur", blurListener);
|
|
254
305
|
return () => {
|
|
255
306
|
current.removeEventListener("_change", listener);
|
|
307
|
+
current.removeEventListener("_focus", focusListener);
|
|
308
|
+
current.removeEventListener("_blur", blurListener);
|
|
256
309
|
};
|
|
257
|
-
}, [name, onChange]);
|
|
310
|
+
}, [name, onChange, onFocus, onBlur]);
|
|
258
311
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
259
312
|
"goa-checkbox",
|
|
260
313
|
{
|
|
@@ -286,6 +339,8 @@ function GoabCheckboxList({
|
|
|
286
339
|
size = "default",
|
|
287
340
|
children,
|
|
288
341
|
onChange,
|
|
342
|
+
onFocus,
|
|
343
|
+
onBlur,
|
|
289
344
|
mt,
|
|
290
345
|
mr,
|
|
291
346
|
mb,
|
|
@@ -299,11 +354,23 @@ function GoabCheckboxList({
|
|
|
299
354
|
const detail = e.detail;
|
|
300
355
|
onChange == null ? void 0 : onChange({ ...detail, event: e });
|
|
301
356
|
};
|
|
357
|
+
const focusListener = (e) => {
|
|
358
|
+
const detail = e.detail;
|
|
359
|
+
onFocus == null ? void 0 : onFocus({ ...detail, event: e });
|
|
360
|
+
};
|
|
361
|
+
const blurListener = (e) => {
|
|
362
|
+
const detail = e.detail;
|
|
363
|
+
onBlur == null ? void 0 : onBlur({ ...detail, event: e });
|
|
364
|
+
};
|
|
302
365
|
current.addEventListener("_change", listener);
|
|
366
|
+
current.addEventListener("_focus", focusListener);
|
|
367
|
+
current.addEventListener("_blur", blurListener);
|
|
303
368
|
return () => {
|
|
304
369
|
current.removeEventListener("_change", listener);
|
|
370
|
+
current.removeEventListener("_focus", focusListener);
|
|
371
|
+
current.removeEventListener("_blur", blurListener);
|
|
305
372
|
};
|
|
306
|
-
}, [onChange]);
|
|
373
|
+
}, [onChange, onFocus, onBlur]);
|
|
307
374
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
308
375
|
"goa-checkbox-list",
|
|
309
376
|
{
|
|
@@ -400,6 +467,9 @@ function GoabDataGrid({
|
|
|
400
467
|
}
|
|
401
468
|
);
|
|
402
469
|
}
|
|
470
|
+
const GoabWorkspaceLayoutScrollState = {
|
|
471
|
+
NO_SCROLL: "no-scroll"
|
|
472
|
+
};
|
|
403
473
|
function dispatch(el, eventName, detail, opts) {
|
|
404
474
|
if (!el) {
|
|
405
475
|
console.error("dispatch element is null");
|
|
@@ -2599,6 +2669,8 @@ function GoabDatePicker({
|
|
|
2599
2669
|
disabled,
|
|
2600
2670
|
relative,
|
|
2601
2671
|
onChange,
|
|
2672
|
+
onFocus,
|
|
2673
|
+
onBlur,
|
|
2602
2674
|
...rest
|
|
2603
2675
|
}) {
|
|
2604
2676
|
const ref = react.useRef(null);
|
|
@@ -2619,15 +2691,27 @@ function GoabDatePicker({
|
|
|
2619
2691
|
const detail = e.detail;
|
|
2620
2692
|
onChange == null ? void 0 : onChange({ ...detail, event: e });
|
|
2621
2693
|
};
|
|
2694
|
+
const handleFocus = (e) => {
|
|
2695
|
+
const detail = e.detail;
|
|
2696
|
+
onFocus == null ? void 0 : onFocus({ ...detail, event: e });
|
|
2697
|
+
};
|
|
2698
|
+
const handleBlur = (e) => {
|
|
2699
|
+
const detail = e.detail;
|
|
2700
|
+
onBlur == null ? void 0 : onBlur({ ...detail, event: e });
|
|
2701
|
+
};
|
|
2622
2702
|
if (onChange) {
|
|
2623
2703
|
current.addEventListener("_change", handleChange);
|
|
2624
2704
|
}
|
|
2705
|
+
current.addEventListener("_focus", handleFocus);
|
|
2706
|
+
current.addEventListener("_blur", handleBlur);
|
|
2625
2707
|
return () => {
|
|
2626
2708
|
if (onChange) {
|
|
2627
2709
|
current.removeEventListener("_change", handleChange);
|
|
2628
2710
|
}
|
|
2711
|
+
current.removeEventListener("_focus", handleFocus);
|
|
2712
|
+
current.removeEventListener("_blur", handleBlur);
|
|
2629
2713
|
};
|
|
2630
|
-
}, [onChange]);
|
|
2714
|
+
}, [onChange, onFocus, onBlur]);
|
|
2631
2715
|
const formatValue = (val) => {
|
|
2632
2716
|
if (!val) return "";
|
|
2633
2717
|
if (val instanceof Date) {
|
|
@@ -2723,6 +2807,8 @@ function stringify(value) {
|
|
|
2723
2807
|
function GoabDropdown({
|
|
2724
2808
|
value,
|
|
2725
2809
|
onChange,
|
|
2810
|
+
onFocus,
|
|
2811
|
+
onBlur,
|
|
2726
2812
|
disabled,
|
|
2727
2813
|
error,
|
|
2728
2814
|
filterable,
|
|
@@ -2744,15 +2830,27 @@ function GoabDropdown({
|
|
|
2744
2830
|
const detail = e.detail;
|
|
2745
2831
|
onChange == null ? void 0 : onChange({ ...detail, event: e });
|
|
2746
2832
|
};
|
|
2833
|
+
const focusListener = (e) => {
|
|
2834
|
+
const detail = e.detail;
|
|
2835
|
+
onFocus == null ? void 0 : onFocus({ ...detail, event: e });
|
|
2836
|
+
};
|
|
2837
|
+
const blurListener = (e) => {
|
|
2838
|
+
const detail = e.detail;
|
|
2839
|
+
onBlur == null ? void 0 : onBlur({ ...detail, event: e });
|
|
2840
|
+
};
|
|
2747
2841
|
if (onChange) {
|
|
2748
2842
|
current.addEventListener("_change", handler);
|
|
2749
2843
|
}
|
|
2844
|
+
current.addEventListener("_focus", focusListener);
|
|
2845
|
+
current.addEventListener("_blur", blurListener);
|
|
2750
2846
|
return () => {
|
|
2751
2847
|
if (onChange) {
|
|
2752
2848
|
current.removeEventListener("_change", handler);
|
|
2753
2849
|
}
|
|
2850
|
+
current.removeEventListener("_focus", focusListener);
|
|
2851
|
+
current.removeEventListener("_blur", blurListener);
|
|
2754
2852
|
};
|
|
2755
|
-
}, [el, onChange]);
|
|
2853
|
+
}, [el, onChange, onFocus, onBlur]);
|
|
2756
2854
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2757
2855
|
"goa-dropdown",
|
|
2758
2856
|
{
|
|
@@ -2781,7 +2879,8 @@ function GoabDropdownItem({
|
|
|
2781
2879
|
label,
|
|
2782
2880
|
filter,
|
|
2783
2881
|
name,
|
|
2784
|
-
mountType = "append"
|
|
2882
|
+
mountType = "append",
|
|
2883
|
+
children
|
|
2785
2884
|
}) {
|
|
2786
2885
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2787
2886
|
"goa-dropdown-item",
|
|
@@ -2790,7 +2889,8 @@ function GoabDropdownItem({
|
|
|
2790
2889
|
label,
|
|
2791
2890
|
filter,
|
|
2792
2891
|
name,
|
|
2793
|
-
mount: mountType
|
|
2892
|
+
mount: mountType,
|
|
2893
|
+
children
|
|
2794
2894
|
}
|
|
2795
2895
|
);
|
|
2796
2896
|
}
|
|
@@ -3821,6 +3921,8 @@ function GoabRadioGroup({
|
|
|
3821
3921
|
disabled,
|
|
3822
3922
|
error,
|
|
3823
3923
|
onChange,
|
|
3924
|
+
onFocus,
|
|
3925
|
+
onBlur,
|
|
3824
3926
|
name,
|
|
3825
3927
|
children,
|
|
3826
3928
|
size = "default",
|
|
@@ -3834,16 +3936,28 @@ function GoabRadioGroup({
|
|
|
3834
3936
|
const detail = e.detail;
|
|
3835
3937
|
onChange == null ? void 0 : onChange({ ...detail, event: e });
|
|
3836
3938
|
};
|
|
3939
|
+
const focusListener = (e) => {
|
|
3940
|
+
const detail = e.detail;
|
|
3941
|
+
onFocus == null ? void 0 : onFocus({ ...detail, event: e });
|
|
3942
|
+
};
|
|
3943
|
+
const blurListener = (e) => {
|
|
3944
|
+
const detail = e.detail;
|
|
3945
|
+
onBlur == null ? void 0 : onBlur({ ...detail, event: e });
|
|
3946
|
+
};
|
|
3837
3947
|
const currentEl = el.current;
|
|
3838
3948
|
if (onChange) {
|
|
3839
3949
|
currentEl.addEventListener("_change", listener);
|
|
3840
3950
|
}
|
|
3951
|
+
currentEl.addEventListener("_focus", focusListener);
|
|
3952
|
+
currentEl.addEventListener("_blur", blurListener);
|
|
3841
3953
|
return () => {
|
|
3842
3954
|
if (onChange) {
|
|
3843
3955
|
currentEl.removeEventListener("_change", listener);
|
|
3844
3956
|
}
|
|
3957
|
+
currentEl.removeEventListener("_focus", focusListener);
|
|
3958
|
+
currentEl.removeEventListener("_blur", blurListener);
|
|
3845
3959
|
};
|
|
3846
|
-
}, [name, onChange]);
|
|
3960
|
+
}, [name, onChange, onFocus, onBlur]);
|
|
3847
3961
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3848
3962
|
"goa-radio-group",
|
|
3849
3963
|
{
|
|
@@ -3950,6 +4064,21 @@ function GoabSpinner({
|
|
|
3950
4064
|
}
|
|
3951
4065
|
);
|
|
3952
4066
|
}
|
|
4067
|
+
function GoabScrollPanel({
|
|
4068
|
+
header,
|
|
4069
|
+
children,
|
|
4070
|
+
footer,
|
|
4071
|
+
height,
|
|
4072
|
+
testId,
|
|
4073
|
+
...rest
|
|
4074
|
+
}) {
|
|
4075
|
+
const hostStyle = height ? { height } : void 0;
|
|
4076
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("goa-scroll-panel", { height, testid: testId, style: hostStyle, ...rest, children: [
|
|
4077
|
+
header && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "header", children: header }),
|
|
4078
|
+
children,
|
|
4079
|
+
footer && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "footer", children: footer })
|
|
4080
|
+
] });
|
|
4081
|
+
}
|
|
3953
4082
|
function GoabTable({ onSort, onMultiSort, sortMode, ...props }) {
|
|
3954
4083
|
const ref = react.useRef(null);
|
|
3955
4084
|
react.useEffect(() => {
|
|
@@ -4003,6 +4132,7 @@ function GoabTableSortHeader({
|
|
|
4003
4132
|
name,
|
|
4004
4133
|
direction,
|
|
4005
4134
|
"sort-order": sortOrder,
|
|
4135
|
+
version: "2",
|
|
4006
4136
|
...rest,
|
|
4007
4137
|
children
|
|
4008
4138
|
}
|
|
@@ -4091,6 +4221,7 @@ function GoabTextArea({
|
|
|
4091
4221
|
error,
|
|
4092
4222
|
onChange,
|
|
4093
4223
|
onKeyPress,
|
|
4224
|
+
onFocus,
|
|
4094
4225
|
onBlur,
|
|
4095
4226
|
...rest
|
|
4096
4227
|
}) {
|
|
@@ -4109,19 +4240,25 @@ function GoabTextArea({
|
|
|
4109
4240
|
const detail = e.detail;
|
|
4110
4241
|
onKeyPress == null ? void 0 : onKeyPress({ ...detail, event: e });
|
|
4111
4242
|
};
|
|
4243
|
+
const focusListener = (e) => {
|
|
4244
|
+
const detail = e.detail;
|
|
4245
|
+
onFocus == null ? void 0 : onFocus({ ...detail, event: e });
|
|
4246
|
+
};
|
|
4112
4247
|
const blurListener = (e) => {
|
|
4113
4248
|
const detail = e.detail;
|
|
4114
4249
|
onBlur == null ? void 0 : onBlur({ ...detail, event: e });
|
|
4115
4250
|
};
|
|
4116
4251
|
current.addEventListener("_change", changeListener);
|
|
4117
4252
|
current.addEventListener("_keyPress", keypressListener);
|
|
4253
|
+
current.addEventListener("_focus", focusListener);
|
|
4118
4254
|
current.addEventListener("_blur", blurListener);
|
|
4119
4255
|
return () => {
|
|
4120
4256
|
current.removeEventListener("_change", changeListener);
|
|
4121
4257
|
current.removeEventListener("_keyPress", keypressListener);
|
|
4258
|
+
current.removeEventListener("_focus", focusListener);
|
|
4122
4259
|
current.removeEventListener("_blur", blurListener);
|
|
4123
4260
|
};
|
|
4124
|
-
}, [el, onChange, onKeyPress, onBlur]);
|
|
4261
|
+
}, [el, onChange, onKeyPress, onFocus, onBlur]);
|
|
4125
4262
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4126
4263
|
"goa-textarea",
|
|
4127
4264
|
{
|
|
@@ -4303,30 +4440,28 @@ function GoabWorkSideMenu({
|
|
|
4303
4440
|
}) {
|
|
4304
4441
|
const el = react.useRef(null);
|
|
4305
4442
|
react.useEffect(() => {
|
|
4306
|
-
|
|
4307
|
-
if (!
|
|
4443
|
+
const node = el.current;
|
|
4444
|
+
if (!node || !onToggle) {
|
|
4308
4445
|
return;
|
|
4309
4446
|
}
|
|
4310
|
-
|
|
4447
|
+
node.addEventListener("_toggle", onToggle);
|
|
4311
4448
|
return () => {
|
|
4312
|
-
|
|
4313
|
-
(_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_toggle", onToggle);
|
|
4449
|
+
node.removeEventListener("_toggle", onToggle);
|
|
4314
4450
|
};
|
|
4315
|
-
}, [
|
|
4451
|
+
}, [onToggle]);
|
|
4316
4452
|
react.useEffect(() => {
|
|
4317
|
-
|
|
4318
|
-
if (!
|
|
4453
|
+
const node = el.current;
|
|
4454
|
+
if (!node || !onNavigate) {
|
|
4319
4455
|
return;
|
|
4320
4456
|
}
|
|
4321
4457
|
const handler = (e) => {
|
|
4322
4458
|
onNavigate(e.detail.url);
|
|
4323
4459
|
};
|
|
4324
|
-
|
|
4460
|
+
node.addEventListener("_navigate", handler);
|
|
4325
4461
|
return () => {
|
|
4326
|
-
|
|
4327
|
-
(_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_navigate", handler);
|
|
4462
|
+
node.removeEventListener("_navigate", handler);
|
|
4328
4463
|
};
|
|
4329
|
-
}, [
|
|
4464
|
+
}, [onNavigate]);
|
|
4330
4465
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4331
4466
|
"goa-work-side-menu",
|
|
4332
4467
|
{
|
|
@@ -4371,6 +4506,7 @@ function GoabWorkSideMenuItem(props) {
|
|
|
4371
4506
|
type: props.type,
|
|
4372
4507
|
children: [
|
|
4373
4508
|
props.popoverContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "popoverContent", children: props.popoverContent }),
|
|
4509
|
+
props.trailingContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "trailingContent", children: props.trailingContent }),
|
|
4374
4510
|
props.children
|
|
4375
4511
|
]
|
|
4376
4512
|
}
|
|
@@ -4448,6 +4584,95 @@ function GoabWorkSideNotificationPanel({
|
|
|
4448
4584
|
}
|
|
4449
4585
|
);
|
|
4450
4586
|
}
|
|
4587
|
+
const STORAGE_KEY = "goab-theme";
|
|
4588
|
+
const ATTRIBUTE = "data-theme";
|
|
4589
|
+
const GoabThemeContext = react.createContext(null);
|
|
4590
|
+
function readInitialMode(defaultMode) {
|
|
4591
|
+
if (typeof window === "undefined") return defaultMode;
|
|
4592
|
+
try {
|
|
4593
|
+
const stored = window.localStorage.getItem(STORAGE_KEY);
|
|
4594
|
+
if (stored === "light" || stored === "dark") return stored;
|
|
4595
|
+
} catch {
|
|
4596
|
+
}
|
|
4597
|
+
const fromAttribute = document.documentElement.getAttribute(ATTRIBUTE);
|
|
4598
|
+
if (fromAttribute === "light" || fromAttribute === "dark") return fromAttribute;
|
|
4599
|
+
if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
|
|
4600
|
+
return defaultMode;
|
|
4601
|
+
}
|
|
4602
|
+
function GoabThemeProvider({
|
|
4603
|
+
children,
|
|
4604
|
+
defaultMode = "light"
|
|
4605
|
+
}) {
|
|
4606
|
+
const [mode, setModeState] = react.useState(
|
|
4607
|
+
() => readInitialMode(defaultMode)
|
|
4608
|
+
);
|
|
4609
|
+
react.useEffect(() => {
|
|
4610
|
+
if (typeof document === "undefined") return;
|
|
4611
|
+
document.documentElement.setAttribute(ATTRIBUTE, mode);
|
|
4612
|
+
try {
|
|
4613
|
+
window.localStorage.setItem(STORAGE_KEY, mode);
|
|
4614
|
+
} catch {
|
|
4615
|
+
}
|
|
4616
|
+
}, [mode]);
|
|
4617
|
+
const setMode = react.useCallback((next) => {
|
|
4618
|
+
setModeState(next);
|
|
4619
|
+
}, []);
|
|
4620
|
+
const toggle = react.useCallback(() => {
|
|
4621
|
+
setModeState((prev) => prev === "light" ? "dark" : "light");
|
|
4622
|
+
}, []);
|
|
4623
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GoabThemeContext.Provider, { value: { mode, setMode, toggle }, children });
|
|
4624
|
+
}
|
|
4625
|
+
function useTheme() {
|
|
4626
|
+
const ctx = react.useContext(GoabThemeContext);
|
|
4627
|
+
if (!ctx) {
|
|
4628
|
+
throw new Error("useTheme must be used within a GoabThemeProvider");
|
|
4629
|
+
}
|
|
4630
|
+
return ctx;
|
|
4631
|
+
}
|
|
4632
|
+
const GoabWorkspaceLayoutScrollStateDefault = {
|
|
4633
|
+
scrollPosition: GoabWorkspaceLayoutScrollState.NO_SCROLL,
|
|
4634
|
+
isScrollable: false
|
|
4635
|
+
};
|
|
4636
|
+
const GoabWorkspaceLayoutScrollStateContext = react.createContext(
|
|
4637
|
+
GoabWorkspaceLayoutScrollStateDefault
|
|
4638
|
+
);
|
|
4639
|
+
function useGoabWorkspaceLayoutScrollState() {
|
|
4640
|
+
return react.useContext(GoabWorkspaceLayoutScrollStateContext);
|
|
4641
|
+
}
|
|
4642
|
+
function GoabWorkspaceLayout({
|
|
4643
|
+
sideMenu,
|
|
4644
|
+
pageHeader,
|
|
4645
|
+
pageFooter,
|
|
4646
|
+
pushDrawer,
|
|
4647
|
+
children,
|
|
4648
|
+
testId,
|
|
4649
|
+
onScrollStateChange,
|
|
4650
|
+
...rest
|
|
4651
|
+
}) {
|
|
4652
|
+
const ref = react.useRef(null);
|
|
4653
|
+
const [scrollState, setScrollState] = react.useState(GoabWorkspaceLayoutScrollStateDefault);
|
|
4654
|
+
react.useEffect(() => {
|
|
4655
|
+
const el = ref.current;
|
|
4656
|
+
if (!el) return;
|
|
4657
|
+
const listener = (e) => {
|
|
4658
|
+
const detail = e.detail;
|
|
4659
|
+
setScrollState({
|
|
4660
|
+
scrollPosition: detail.state,
|
|
4661
|
+
isScrollable: detail.isScrollable
|
|
4662
|
+
});
|
|
4663
|
+
onScrollStateChange == null ? void 0 : onScrollStateChange({ ...detail, event: e });
|
|
4664
|
+
};
|
|
4665
|
+
el.addEventListener("_scrollStateChange", listener);
|
|
4666
|
+
return () => el.removeEventListener("_scrollStateChange", listener);
|
|
4667
|
+
}, [onScrollStateChange]);
|
|
4668
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GoabWorkspaceLayoutScrollStateContext.Provider, { value: scrollState, children: /* @__PURE__ */ jsxRuntime.jsxs("goa-workspace-layout", { ref, testid: testId, ...rest, children: [
|
|
4669
|
+
sideMenu && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "side-menu", children: sideMenu }),
|
|
4670
|
+
pageHeader && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "page-header", children: pageHeader }),
|
|
4671
|
+
children,
|
|
4672
|
+
pageFooter && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "page-footer", children: pageFooter }),
|
|
4673
|
+
pushDrawer && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "push-drawer", children: pushDrawer })
|
|
4674
|
+
] }) });
|
|
4675
|
+
}
|
|
4451
4676
|
exports.GoALinkButton = GoALinkButton;
|
|
4452
4677
|
exports.GoabAccordion = GoabAccordion;
|
|
4453
4678
|
exports.GoabAppFooter = GoabAppFooter;
|
|
@@ -4522,6 +4747,7 @@ exports.GoabPublicSubformIndex = GoabPublicSubformIndex;
|
|
|
4522
4747
|
exports.GoabPushDrawer = GoabPushDrawer;
|
|
4523
4748
|
exports.GoabRadioGroup = GoabRadioGroup;
|
|
4524
4749
|
exports.GoabRadioItem = GoabRadioItem;
|
|
4750
|
+
exports.GoabScrollPanel = GoabScrollPanel;
|
|
4525
4751
|
exports.GoabSideMenu = GoabSideMenu;
|
|
4526
4752
|
exports.GoabSideMenuGroup = GoabSideMenuGroup;
|
|
4527
4753
|
exports.GoabSideMenuHeading = GoabSideMenuHeading;
|
|
@@ -4536,6 +4762,7 @@ exports.GoabTemporaryNotificationCtrl = GoabTemporaryNotificationCtrl;
|
|
|
4536
4762
|
exports.GoabText = GoabText;
|
|
4537
4763
|
exports.GoabTextArea = GoabTextArea;
|
|
4538
4764
|
exports.GoabTextarea = GoabTextArea;
|
|
4765
|
+
exports.GoabThemeProvider = GoabThemeProvider;
|
|
4539
4766
|
exports.GoabThreeColumnLayout = GoabThreeColumnLayout;
|
|
4540
4767
|
exports.GoabTooltip = GoabTooltip;
|
|
4541
4768
|
exports.GoabTwoColumnLayout = GoabTwoColumnLayout;
|
|
@@ -4544,5 +4771,8 @@ exports.GoabWorkSideMenuGroup = GoabWorkSideMenuGroup;
|
|
|
4544
4771
|
exports.GoabWorkSideMenuItem = GoabWorkSideMenuItem;
|
|
4545
4772
|
exports.GoabWorkSideNotificationItem = GoabWorkSideNotificationItem;
|
|
4546
4773
|
exports.GoabWorkSideNotificationPanel = GoabWorkSideNotificationPanel;
|
|
4774
|
+
exports.GoabWorkspaceLayout = GoabWorkspaceLayout;
|
|
4775
|
+
exports.useGoabWorkspaceLayoutScrollState = useGoabWorkspaceLayoutScrollState;
|
|
4547
4776
|
exports.usePublicFormController = usePublicFormController;
|
|
4777
|
+
exports.useTheme = useTheme;
|
|
4548
4778
|
//# sourceMappingURL=index.js.map
|