@homebound/beam 2.70.0 → 2.71.3
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/dist/components/Tabs.d.ts +13 -6
- package/dist/components/Tabs.js +69 -24
- package/dist/components/testData.d.ts +3 -2
- package/dist/components/testData.js +6 -6
- package/dist/forms/FormLines.js +2 -1
- package/dist/forms/index.d.ts +1 -0
- package/dist/forms/index.js +1 -0
- package/dist/inputs/RadioGroupField.d.ts +1 -0
- package/dist/inputs/RadioGroupField.js +2 -2
- package/dist/inputs/internal/SelectFieldBase.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import type { IconKey } from "./";
|
|
3
|
-
import { Margin, Only,
|
|
3
|
+
import { Margin, Only, Xss } from "../Css";
|
|
4
4
|
export interface Tab<V extends string = string> {
|
|
5
5
|
name: string;
|
|
6
6
|
value: V;
|
|
@@ -9,13 +9,20 @@ export interface Tab<V extends string = string> {
|
|
|
9
9
|
render: () => ReactNode;
|
|
10
10
|
}
|
|
11
11
|
declare type TabsContentXss = Xss<Margin>;
|
|
12
|
-
export interface TabsProps<V extends string, X
|
|
12
|
+
export interface TabsProps<V extends string, X> {
|
|
13
13
|
ariaLabel?: string;
|
|
14
14
|
selected: V;
|
|
15
15
|
tabs: Tab<V>[];
|
|
16
16
|
onChange: (value: V) => void;
|
|
17
17
|
contentXss?: X;
|
|
18
18
|
}
|
|
19
|
+
export interface RouteTabsProps<V extends string, X> extends Omit<TabsProps<V, X>, "onChange" | "selected" | "tabs"> {
|
|
20
|
+
tabs: RouteTab<V>[];
|
|
21
|
+
}
|
|
22
|
+
export interface RouteTab<V extends string> extends Omit<Tab<V>, "value"> {
|
|
23
|
+
href: V;
|
|
24
|
+
path: string | string[];
|
|
25
|
+
}
|
|
19
26
|
/**
|
|
20
27
|
* Provides a list of tabs and their content.
|
|
21
28
|
*
|
|
@@ -25,10 +32,10 @@ export interface TabsProps<V extends string, X extends Properties> {
|
|
|
25
32
|
* If you want to tease apart Tabs from their TabContent, you can use the `Tab`
|
|
26
33
|
* and `TabContent` components directly.
|
|
27
34
|
*/
|
|
28
|
-
export declare function TabsWithContent<V extends string, X extends Only<TabsContentXss, X>>(props: TabsProps<V, X>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
29
|
-
export declare function TabContent<V extends string>(props: Omit<TabsProps<V, {}>, "onChange">): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare function TabsWithContent<V extends string, X extends Only<TabsContentXss, X>>(props: TabsProps<V, X> | RouteTabsProps<V, X>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function TabContent<V extends string>(props: Omit<TabsProps<V, {}>, "onChange"> | RouteTabsProps<V, {}>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
30
37
|
/** The top list of tabs. */
|
|
31
|
-
export declare function Tabs<V extends string>(props: TabsProps<V, {}>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function Tabs<V extends string>(props: TabsProps<V, {}> | RouteTabsProps<V, {}>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
32
39
|
export declare function getTabStyles(): {
|
|
33
40
|
baseStyles: {
|
|
34
41
|
display: import("csstype").Property.Display | undefined;
|
|
@@ -87,5 +94,5 @@ export declare function getTabStyles(): {
|
|
|
87
94
|
color: import("csstype").Property.Color | undefined;
|
|
88
95
|
};
|
|
89
96
|
};
|
|
90
|
-
export declare function getNextTabValue<V extends string>(selected: V, key: "ArrowLeft" | "ArrowRight", tabs: Tab<V>[]): V;
|
|
97
|
+
export declare function getNextTabValue<V extends string>(selected: V, key: "ArrowLeft" | "ArrowRight", tabs: Tab<V>[] | RouteTab<V>[]): V;
|
|
91
98
|
export {};
|
package/dist/components/Tabs.js
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNextTabValue = exports.getTabStyles = exports.Tabs = exports.TabContent = exports.TabsWithContent = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const change_case_1 = require("change-case");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const react_aria_1 = require("react-aria");
|
|
8
|
+
const react_router_1 = require("react-router");
|
|
9
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
7
10
|
const Css_1 = require("../Css");
|
|
8
11
|
const utils_1 = require("../utils");
|
|
12
|
+
const defaultTestId_1 = require("../utils/defaultTestId");
|
|
9
13
|
const Icon_1 = require("./Icon");
|
|
10
14
|
/**
|
|
11
15
|
* Provides a list of tabs and their content.
|
|
@@ -18,69 +22,100 @@ const Icon_1 = require("./Icon");
|
|
|
18
22
|
*/
|
|
19
23
|
function TabsWithContent(props) {
|
|
20
24
|
const onlyOneTabEnabled = props.tabs.filter((t) => !t.disabled).length === 1;
|
|
21
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!onlyOneTabEnabled && (0, jsx_runtime_1.jsx)(Tabs, Object.assign({}, props), void 0), (0, jsx_runtime_1.jsx)(TabContent, Object.assign({}, props), void 0)] }, void 0));
|
|
22
26
|
}
|
|
23
27
|
exports.TabsWithContent = TabsWithContent;
|
|
24
28
|
function TabContent(props) {
|
|
25
29
|
const tid = (0, utils_1.useTestIds)(props, "tab");
|
|
26
|
-
const {
|
|
27
|
-
const
|
|
28
|
-
|
|
30
|
+
const { tabs, contentXss = {} } = props;
|
|
31
|
+
const location = (0, react_router_1.useLocation)();
|
|
32
|
+
const selectedTab = isRouteTabs(props)
|
|
33
|
+
? props.tabs.find((t) => {
|
|
34
|
+
const paths = Array.isArray(t.path) ? t.path : [t.path];
|
|
35
|
+
return paths.some((p) => !!(0, react_router_1.matchPath)(location.pathname, { path: t.path, exact: true }));
|
|
36
|
+
}) || tabs[0]
|
|
37
|
+
: props.tabs.find((tab) => tab.value === props.selected) || tabs[0];
|
|
38
|
+
const uniqueValue = uniqueTabValue(selectedTab);
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ "aria-labelledby": `${uniqueValue}-tab`, id: `${uniqueValue}-tabPanel`, role: "tabpanel", tabIndex: 0 }, tid.panel, { css: { ...Css_1.Css.mt2.$, ...contentXss } }, { children: isRouteTab(selectedTab) ? (0, jsx_runtime_1.jsx)(react_router_1.Route, { path: selectedTab.path, render: selectedTab.render }, void 0) : selectedTab.render() }), void 0));
|
|
29
40
|
}
|
|
30
41
|
exports.TabContent = TabContent;
|
|
31
42
|
/** The top list of tabs. */
|
|
32
43
|
function Tabs(props) {
|
|
33
|
-
const { ariaLabel,
|
|
44
|
+
const { ariaLabel, tabs, ...others } = props;
|
|
45
|
+
const location = (0, react_router_1.useLocation)();
|
|
46
|
+
const selected = isRouteTabs(props)
|
|
47
|
+
? uniqueTabValue(props.tabs.find((t) => !!(0, react_router_1.matchPath)(location.pathname, { path: t.path, exact: true })) || props.tabs[0])
|
|
48
|
+
: props.selected;
|
|
34
49
|
const { isFocusVisible, focusProps } = (0, react_aria_1.useFocusRing)();
|
|
35
50
|
const tid = (0, utils_1.useTestIds)(others, "tabs");
|
|
36
51
|
const [active, setActive] = (0, react_1.useState)(selected);
|
|
52
|
+
const ref = (0, react_1.useRef)(null);
|
|
37
53
|
// Whenever selected changes, reset active
|
|
38
54
|
(0, react_1.useEffect)(() => setActive(selected), [selected]);
|
|
39
55
|
// the active tab is highlighted, but not necessarily "selected"
|
|
40
56
|
// the selected tab dictates what is displayed in the content panel
|
|
41
|
-
function
|
|
57
|
+
function onKeyUp(e) {
|
|
58
|
+
var _a;
|
|
42
59
|
// left and right arrow keys update the active tab
|
|
43
60
|
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
44
61
|
const nextTabValue = getNextTabValue(active, e.key, tabs);
|
|
45
62
|
setActive(nextTabValue);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (e.key === "Enter") {
|
|
49
|
-
onChange(active);
|
|
63
|
+
// Ensure the browser's focus follows the active element.
|
|
64
|
+
(_a = document.getElementById(`${nextTabValue}-tab`)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
50
65
|
}
|
|
51
66
|
}
|
|
52
67
|
// clicking on a tab sets it to selected and active
|
|
53
|
-
function
|
|
54
|
-
onChange(value);
|
|
55
|
-
setActive(value);
|
|
68
|
+
function onClick(value) {
|
|
69
|
+
!isRouteTabs(props) && props.onChange(value);
|
|
56
70
|
}
|
|
57
71
|
// bluring out resets active to whatever selected is
|
|
58
|
-
function
|
|
59
|
-
|
|
72
|
+
function onBlur(e) {
|
|
73
|
+
// only reset active state if we've moved focus out of the tab list
|
|
74
|
+
if (!(ref.current && ref.current.contains(e.relatedTarget))) {
|
|
75
|
+
setActive(selected);
|
|
76
|
+
}
|
|
60
77
|
}
|
|
61
78
|
// We also check this in TabsWithContent, but if someone is using Tabs standalone, check it here as well
|
|
62
79
|
const onlyOneTabEnabled = props.tabs.filter((t) => !t.disabled).length === 1;
|
|
63
80
|
if (onlyOneTabEnabled) {
|
|
64
81
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0);
|
|
65
82
|
}
|
|
66
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.dif.childGap1.$, "aria-label": ariaLabel, role: "tablist" }, tid, { children: tabs.map((tab) => {
|
|
67
|
-
const
|
|
68
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, css: Css_1.Css.dif.childGap1.$, "aria-label": ariaLabel, role: "tablist" }, tid, { children: tabs.map((tab) => {
|
|
84
|
+
const uniqueValue = uniqueTabValue(tab);
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)(TabImpl, Object.assign({ active: active === uniqueValue, focusProps: focusProps, isFocusVisible: isFocusVisible, onClick: onClick, onKeyUp: onKeyUp, onBlur: onBlur, tab: tab }, tid[(0, defaultTestId_1.defaultTestId)(uniqueValue)]), uniqueValue));
|
|
69
86
|
}) }), void 0));
|
|
70
87
|
}
|
|
71
88
|
exports.Tabs = Tabs;
|
|
72
|
-
function
|
|
73
|
-
const {
|
|
89
|
+
function TabImpl(props) {
|
|
90
|
+
const { tab, onClick, active, onKeyUp, onBlur, focusProps, isFocusVisible = false, ...others } = props;
|
|
91
|
+
const { disabled: isDisabled = false, name: label, icon } = tab;
|
|
74
92
|
const { hoverProps, isHovered } = (0, react_aria_1.useHover)({ isDisabled });
|
|
75
93
|
const { baseStyles, activeStyles, focusRingStyles, hoverStyles, disabledStyles, activeHoverStyles } = (0, react_1.useMemo)(() => getTabStyles(), []);
|
|
76
|
-
|
|
94
|
+
const uniqueValue = uniqueTabValue(tab);
|
|
95
|
+
const tabProps = {
|
|
96
|
+
"aria-controls": `${uniqueValue}-tabPanel`,
|
|
97
|
+
"aria-selected": active,
|
|
98
|
+
"aria-disabled": isDisabled || undefined,
|
|
99
|
+
id: `${uniqueValue}-tab`,
|
|
100
|
+
role: "tab",
|
|
101
|
+
tabIndex: active ? 0 : -1,
|
|
102
|
+
...others,
|
|
103
|
+
css: {
|
|
77
104
|
...baseStyles,
|
|
78
105
|
...(active && activeStyles),
|
|
79
106
|
...(isDisabled && disabledStyles),
|
|
80
107
|
...(isHovered && hoverStyles),
|
|
81
108
|
...(isHovered && active && activeHoverStyles),
|
|
82
109
|
...(isFocusVisible && active && focusRingStyles),
|
|
83
|
-
}
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
const interactiveProps = (0, react_aria_1.mergeProps)(focusProps, hoverProps, {
|
|
113
|
+
onKeyUp,
|
|
114
|
+
onBlur,
|
|
115
|
+
...(isRouteTab(tab) ? {} : { onClick: () => onClick(tab.value) }),
|
|
116
|
+
});
|
|
117
|
+
const tabLabel = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [label, icon && ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.ml1.$ }, { children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: icon }, void 0) }), void 0))] }, void 0));
|
|
118
|
+
return isDisabled ? ((0, jsx_runtime_1.jsx)("div", Object.assign({}, tabProps, { children: tabLabel }), void 0)) : isRouteTab(tab) ? ((0, jsx_runtime_1.jsx)(react_router_dom_1.Link, Object.assign({}, { ...tabProps, ...interactiveProps }, { className: "navLink", to: tab.href }, { children: tabLabel }), void 0)) : ((0, jsx_runtime_1.jsx)("button", Object.assign({}, { ...tabProps, ...interactiveProps }, { children: tabLabel }), void 0));
|
|
84
119
|
}
|
|
85
120
|
function getTabStyles() {
|
|
86
121
|
return {
|
|
@@ -96,8 +131,18 @@ exports.getTabStyles = getTabStyles;
|
|
|
96
131
|
function getNextTabValue(selected, key, tabs) {
|
|
97
132
|
const enabledTabs = tabs.filter((tab) => tab.disabled !== true);
|
|
98
133
|
const tabsToScan = key === "ArrowRight" ? enabledTabs : enabledTabs.reverse();
|
|
99
|
-
const currentIndex = tabsToScan.findIndex((tab) => tab
|
|
134
|
+
const currentIndex = tabsToScan.findIndex((tab) => uniqueTabValue(tab) === selected);
|
|
100
135
|
const nextIndex = currentIndex === tabsToScan.length - 1 ? 0 : currentIndex + 1;
|
|
101
|
-
return tabsToScan[nextIndex]
|
|
136
|
+
return uniqueTabValue(tabsToScan[nextIndex]);
|
|
102
137
|
}
|
|
103
138
|
exports.getNextTabValue = getNextTabValue;
|
|
139
|
+
function isRouteTabs(props) {
|
|
140
|
+
const { tabs } = props;
|
|
141
|
+
return tabs.length > 0 && isRouteTab(tabs[0]);
|
|
142
|
+
}
|
|
143
|
+
function isRouteTab(tab) {
|
|
144
|
+
return "path" in tab;
|
|
145
|
+
}
|
|
146
|
+
function uniqueTabValue(tab) {
|
|
147
|
+
return isRouteTab(tab) ? (0, change_case_1.camelCase)(tab.name) : tab.value;
|
|
148
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
1
2
|
import { Tab } from "./Tabs";
|
|
2
3
|
export declare type TabValue = "tab1" | "tab2" | "tab3" | "tab4";
|
|
3
4
|
export declare const testTabs: Tab<TabValue>[];
|
|
4
|
-
export declare function TestTabContent({
|
|
5
|
-
|
|
5
|
+
export declare function TestTabContent({ content }: {
|
|
6
|
+
content: ReactNode;
|
|
6
7
|
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TestTabContent = exports.testTabs = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
5
|
exports.testTabs = [
|
|
6
|
-
{ name: "Tab 1", value: "tab1", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, {
|
|
7
|
-
{ name: "Tab 2", value: "tab2", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, {
|
|
8
|
-
{ name: "Tab 3", value: "tab3", disabled: true, render: () => (0, jsx_runtime_1.jsx)(TestTabContent, {
|
|
9
|
-
{ name: "Tab 4", value: "tab4", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, {
|
|
6
|
+
{ name: "Tab 1", value: "tab1", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 1 Content" }, void 0) },
|
|
7
|
+
{ name: "Tab 2", value: "tab2", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 2 Content" }, void 0) },
|
|
8
|
+
{ name: "Tab 3", value: "tab3", disabled: true, render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 3 Content" }, void 0) },
|
|
9
|
+
{ name: "Tab 4", value: "tab4", render: () => (0, jsx_runtime_1.jsx)(TestTabContent, { content: "Tab 4 Content" }, void 0) },
|
|
10
10
|
];
|
|
11
|
-
function TestTabContent({
|
|
12
|
-
return (0, jsx_runtime_1.jsx)("div", { children:
|
|
11
|
+
function TestTabContent({ content }) {
|
|
12
|
+
return (0, jsx_runtime_1.jsx)("div", { children: content }, void 0);
|
|
13
13
|
}
|
|
14
14
|
exports.TestTabContent = TestTabContent;
|
package/dist/forms/FormLines.js
CHANGED
|
@@ -16,7 +16,8 @@ function FormLines(props) {
|
|
|
16
16
|
const { children, width = "full", labelSuffix = settings.labelSuffix } = props;
|
|
17
17
|
let firstFormHeading = true;
|
|
18
18
|
return ((0, jsx_runtime_1.jsx)(FormContext_1.FormContext.Provider, Object.assign({ value: { labelSuffix } }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
|
|
19
|
-
|
|
19
|
+
// Note that we're purposefully not using display:flex so that our children's margins will collapse.
|
|
20
|
+
...Css_1.Css.w(sizes[width]).$,
|
|
20
21
|
// Purposefully use this instead of childGap3 to put margin-bottom on the last line
|
|
21
22
|
"& > *": Css_1.Css.mb2.$,
|
|
22
23
|
} }, { children: react_1.Children.map(children, (child) => {
|
package/dist/forms/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./BoundSwitchField";
|
|
|
10
10
|
export * from "./BoundTextAreaField";
|
|
11
11
|
export * from "./BoundTextField";
|
|
12
12
|
export * from "./BoundToggleChipGroupField";
|
|
13
|
+
export * from "./FormHeading";
|
|
13
14
|
export * from "./FormLines";
|
|
14
15
|
export * from "./StaticField";
|
|
15
16
|
export * from "./StaticLinkField";
|
package/dist/forms/index.js
CHANGED
|
@@ -22,6 +22,7 @@ __exportStar(require("./BoundSwitchField"), exports);
|
|
|
22
22
|
__exportStar(require("./BoundTextAreaField"), exports);
|
|
23
23
|
__exportStar(require("./BoundTextField"), exports);
|
|
24
24
|
__exportStar(require("./BoundToggleChipGroupField"), exports);
|
|
25
|
+
__exportStar(require("./FormHeading"), exports);
|
|
25
26
|
__exportStar(require("./FormLines"), exports);
|
|
26
27
|
__exportStar(require("./StaticField"), exports);
|
|
27
28
|
__exportStar(require("./StaticLinkField"), exports);
|
|
@@ -10,6 +10,7 @@ export interface RadioFieldOption<K extends string> {
|
|
|
10
10
|
export interface RadioGroupFieldProps<K extends string> {
|
|
11
11
|
/** The label for the choice itself, i.e. "Favorite Cheese". */
|
|
12
12
|
label: string;
|
|
13
|
+
hideLabel?: boolean;
|
|
13
14
|
/** The currently selected option value (i.e. an id). */
|
|
14
15
|
value: K | undefined;
|
|
15
16
|
/** Called when an option is selected. We don't support unselecting. */
|
|
@@ -20,7 +20,7 @@ let nextNameId = 0;
|
|
|
20
20
|
* TODO: Add hover (non selected and selected) styles
|
|
21
21
|
*/
|
|
22
22
|
function RadioGroupField(props) {
|
|
23
|
-
const { label, value, onChange, options, disabled = false, errorMsg, helperText, ...otherProps } = props;
|
|
23
|
+
const { label, hideLabel, value, onChange, options, disabled = false, errorMsg, helperText, ...otherProps } = props;
|
|
24
24
|
// useRadioGroupState uses a random group name, so use our name
|
|
25
25
|
const name = (0, react_1.useMemo)(() => `radio-group-${++nextNameId}`, []);
|
|
26
26
|
const state = (0, react_stately_1.useRadioGroupState)({
|
|
@@ -38,7 +38,7 @@ function RadioGroupField(props) {
|
|
|
38
38
|
const anyDescriptions = options.some((o) => !!o.description);
|
|
39
39
|
return (
|
|
40
40
|
// width of `max-content` is used to limit invisible label clicking
|
|
41
|
-
(0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.w("max-content").maxw(anyDescriptions ? "344px" : "320px").$ }, { children: [(0, jsx_runtime_1.jsx)(Label_1.Label, Object.assign({ label: label }, labelProps, tid.label), void 0), (0, jsx_runtime_1.jsx)("div", Object.assign({}, radioGroupProps, { children: options.map((option) => ((0, jsx_runtime_1.jsx)(Radio, Object.assign({ parentId: name, option: option, state: state }, otherProps, tid[option.value]), option.value))) }), void 0), errorMsg && (0, jsx_runtime_1.jsx)(ErrorMessage_1.ErrorMessage, Object.assign({ errorMsg: errorMsg }, tid.errorMsg), void 0), helperText && (0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { helperText: helperText }, void 0)] }), void 0));
|
|
41
|
+
(0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.w("max-content").maxw(anyDescriptions ? "344px" : "320px").$ }, { children: [(0, jsx_runtime_1.jsx)(Label_1.Label, Object.assign({ label: label }, labelProps, tid.label, { hidden: hideLabel }), void 0), (0, jsx_runtime_1.jsx)("div", Object.assign({}, radioGroupProps, { children: options.map((option) => ((0, jsx_runtime_1.jsx)(Radio, Object.assign({ parentId: name, option: option, state: state }, otherProps, tid[option.value]), option.value))) }), void 0), errorMsg && (0, jsx_runtime_1.jsx)(ErrorMessage_1.ErrorMessage, Object.assign({ errorMsg: errorMsg }, tid.errorMsg), void 0), helperText && (0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { helperText: helperText }, void 0)] }), void 0));
|
|
42
42
|
}
|
|
43
43
|
exports.RadioGroupField = RadioGroupField;
|
|
44
44
|
// Not meant to be standalone, but its own component so it can use hooks
|
|
@@ -176,6 +176,6 @@ function SelectFieldBase(props) {
|
|
|
176
176
|
...positionProps.style,
|
|
177
177
|
width: (_a = comboBoxRef === null || comboBoxRef === void 0 ? void 0 : comboBoxRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth,
|
|
178
178
|
};
|
|
179
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.
|
|
179
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.df.fdc.w100.maxw((0, Css_1.px)(550)).$, ref: comboBoxRef }, { children: [(0, jsx_runtime_1.jsx)(SelectFieldInput_1.SelectFieldInput, { buttonProps: buttonProps, buttonRef: triggerRef, compact: compact, errorMsg: errorMsg, helperText: helperText, fieldDecoration: fieldDecoration, inputProps: inputProps, inputRef: inputRef, inputWrapRef: inputWrapRef, isDisabled: isDisabled, required: required, isReadOnly: isReadOnly, state: state, onBlur: onBlur, onFocus: onFocus, inlineLabel: inlineLabel, label: label, hideLabel: hideLabel, labelProps: labelProps, selectedOptions: fieldState.selectedOptions, getOptionValue: getOptionValue, getOptionLabel: getOptionLabel, sizeToContent: sizeToContent, contrast: contrast, nothingSelectedText: nothingSelectedText }, void 0), state.isOpen && ((0, jsx_runtime_1.jsx)(internal_1.Popover, Object.assign({ triggerRef: triggerRef, popoverRef: popoverRef, positionProps: positionProps, onClose: () => state.close(), isOpen: state.isOpen }, { children: (0, jsx_runtime_1.jsx)(ListBox_1.ListBox, Object.assign({}, listBoxProps, { state: state, compact: compact, listBoxRef: listBoxRef, selectedOptions: fieldState.selectedOptions, getOptionLabel: getOptionLabel, getOptionValue: (o) => (0, Value_1.valueToKey)(getOptionValue(o)), contrast: contrast }), void 0) }), void 0))] }), void 0));
|
|
180
180
|
}
|
|
181
181
|
exports.SelectFieldBase = SelectFieldBase;
|