@payfit/unity-components
Version:
47 lines (46 loc) • 1.69 kB
JavaScript
import { actionBar as e } from "./ActionBar.variants.js";
import { useActionBarState as t } from "./hooks/use-action-bar-state.js";
import { ActionBarOverflowMenu as n } from "./parts/ActionBarOverflowMenu.js";
import { ActionBarPrefixArea as r } from "./parts/ActionBarPrefixArea.js";
import { forwardRef as i } from "react";
import { jsx as a, jsxs as o } from "react/jsx-runtime";
import { Group as s } from "react-aria-components/Group";
import { Toolbar as c } from "react-aria-components/Toolbar";
import { useIntl as l } from "react-intl";
//#region src/components/action-bar/ActionBar.tsx
var u = i(({ id: i, prefixContent: u, children: d, actions: f, "aria-label": p, onFocus: m, onBlur: h, forceExpandMobile: g = !1, ..._ }, v) => {
let y = l(), { base: b, actionArea: x } = e({ hasPrefixContent: !!u }), { renderActions: S, mobileOverflowActions: C, hasActions: w } = t({
actions: f,
children: d,
forceExpandMobile: g
}), T = p ?? y.formatMessage({
id: "unity:component:action-bar:toolbar-label",
defaultMessage: "Actions toolbar"
});
return /* @__PURE__ */ o(c, {
..._,
id: i,
ref: v,
className: b(),
"aria-label": T,
orientation: "horizontal",
tabIndex: -1,
onFocus: m,
onBlur: h,
children: [u && /* @__PURE__ */ a(r, {
ariaKeyshortcuts: _["aria-keyshortcuts"],
children: u
}), w && /* @__PURE__ */ o(s, {
className: x(),
role: "group",
"aria-label": y.formatMessage({
id: "unity:component:action-bar:actions:label",
defaultMessage: "Available actions"
}),
children: [S(), C.length > 0 && /* @__PURE__ */ a(n, { actions: C })]
})]
});
});
u.displayName = "ActionBar";
//#endregion
export { u as ActionBar };