UNPKG

@payfit/unity-components

Version:

41 lines (40 loc) • 1.6 kB
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 { useTranslation as l } from "react-i18next"; //#region src/core/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 { t: y } = l("unity"), { base: b, actionArea: x } = e({ hasPrefixContent: !!u }), { renderActions: S, mobileOverflowActions: C, hasActions: w } = t({ actions: f, children: d, forceExpandMobile: g }), T = p ?? y((e) => e.unity.component.actionBar.toolbarLabel); 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((e) => e.unity.component.actionBar.actions.label), children: [S(), C.length > 0 && /* @__PURE__ */ a(n, { actions: C })] })] }); }); u.displayName = "ActionBar"; //#endregion export { u as ActionBar };