UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

132 lines (129 loc) • 4.54 kB
import { MenuAction, ToolbarHost, ToolbarItem } from "../../platform/index.mjs"; import { toolbarChildrenToBottomData } from "./stackToolbarDescriptors.mjs"; import { jsx } from "react/jsx-runtime"; function BottomButtonElement({ data }) { return /* @__PURE__ */ jsx(ToolbarItem, { identifier: data.identifier, title: data.title, systemImageName: data.systemImageName, xcassetName: data.xcassetName, image: data.image, imageRenderingMode: data.imageRenderingMode, tintColor: data.tintColor, barButtonItemStyle: data.barButtonItemStyle, sharesBackground: data.sharesBackground, hidesSharedBackground: data.hidesSharedBackground, hidden: data.hidden, selected: data.selected, disabled: data.disabled, badgeConfiguration: data.badgeConfiguration, titleStyle: data.titleStyle, accessibilityLabel: data.accessibilityLabel, accessibilityHint: data.accessibilityHint, onSelected: data.handler }); } function BottomMenuActionElement({ data }) { return /* @__PURE__ */ jsx(MenuAction, { identifier: data.identifier, title: data.title, icon: data.icon, xcassetName: data.xcassetName, image: data.image, imageRenderingMode: data.imageRenderingMode, disabled: data.disabled, destructive: data.destructive, hidden: data.hidden, isOn: data.isOn, keepPresented: data.keepPresented, discoverabilityLabel: data.discoverabilityLabel, subtitle: data.subtitle, accessibilityLabel: data.accessibilityLabel, accessibilityHint: data.accessibilityHint, onSelected: data.handler }); } function BottomMenuChild({ data }) { if (data.kind === "submenu") { return /* @__PURE__ */ jsx(BottomSubmenuElement, { data }); } return /* @__PURE__ */ jsx(BottomMenuActionElement, { data }); } function BottomSubmenuElement({ data }) { return /* @__PURE__ */ jsx(MenuAction, { identifier: data.identifier, title: data.title, icon: data.icon, xcassetName: data.xcassetName, image: data.image, imageRenderingMode: data.imageRenderingMode, destructive: data.destructive, hidden: data.hidden, displayInline: data.inline, displayAsPalette: data.palette, accessibilityLabel: data.accessibilityLabel, accessibilityHint: data.accessibilityHint, children: data.children.map((child) => /* @__PURE__ */ jsx(BottomMenuChild, { data: child }, child.identifier)) }); } function BottomMenuElement({ data }) { return /* @__PURE__ */ jsx(MenuAction, { identifier: data.identifier, title: data.title, label: data.label, icon: data.systemImageName, xcassetName: data.xcassetName, image: data.image, imageRenderingMode: data.imageRenderingMode, tintColor: data.tintColor, barButtonItemStyle: data.barButtonItemStyle, sharesBackground: data.sharesBackground, hidesSharedBackground: data.hidesSharedBackground, disabled: data.disabled, destructive: data.destructive, hidden: data.hidden, displayInline: data.inline, displayAsPalette: data.palette, preferredElementSize: data.elementSize, accessibilityLabel: data.accessibilityLabel, accessibilityHint: data.accessibilityHint, children: data.children.map((child) => /* @__PURE__ */ jsx(BottomMenuChild, { data: child }, child.identifier)) }); } function BottomSpacerElement({ data }) { return /* @__PURE__ */ jsx(ToolbarItem, { identifier: data.identifier, type: data.width === void 0 ? "fluidSpacer" : "fixedSpacer", width: data.width, sharesBackground: data.sharesBackground, hidden: data.hidden }); } function BottomSearchBarSlotElement({ data }) { return /* @__PURE__ */ jsx(ToolbarItem, { identifier: data.identifier, type: "searchBar", sharesBackground: data.sharesBackground, hidesSharedBackground: data.hidesSharedBackground, hidden: data.hidden }); } function BottomToolbarHost({ children, hidden, animated = true }) { const data = toolbarChildrenToBottomData(children); if (!data.length) return null; return /* @__PURE__ */ jsx(ToolbarHost, { hidden, animated, children: data.map((entry) => { switch (entry.kind) { case "button": return /* @__PURE__ */ jsx(BottomButtonElement, { data: entry }, entry.identifier); case "menu": return /* @__PURE__ */ jsx(BottomMenuElement, { data: entry }, entry.identifier); case "spacer": return /* @__PURE__ */ jsx(BottomSpacerElement, { data: entry }, entry.identifier); case "searchBar": return /* @__PURE__ */ jsx(BottomSearchBarSlotElement, { data: entry }, entry.identifier); default: return null; } }) }); } export { BottomToolbarHost }; //# sourceMappingURL=StackToolbarBottomHost.mjs.map