UNPKG

one

Version:

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

151 lines (150 loc) • 5.93 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var StackToolbarBottomHost_exports = {}; __export(StackToolbarBottomHost_exports, { BottomToolbarHost: () => BottomToolbarHost }); module.exports = __toCommonJS(StackToolbarBottomHost_exports); var import_platform = require("../../platform/index.cjs"); var import_stackToolbarDescriptors = require("./stackToolbarDescriptors.cjs"); var import_jsx_runtime = require("react/jsx-runtime"); function BottomButtonElement({ data }) { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_platform.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__ */ (0, import_jsx_runtime.jsx)(import_platform.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__ */ (0, import_jsx_runtime.jsx)(BottomSubmenuElement, { data }); } return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BottomMenuActionElement, { data }); } function BottomSubmenuElement({ data }) { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_platform.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__ */ (0, import_jsx_runtime.jsx)(BottomMenuChild, { data: child }, child.identifier)) }); } function BottomMenuElement({ data }) { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_platform.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__ */ (0, import_jsx_runtime.jsx)(BottomMenuChild, { data: child }, child.identifier)) }); } function BottomSpacerElement({ data }) { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_platform.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__ */ (0, import_jsx_runtime.jsx)(import_platform.ToolbarItem, { identifier: data.identifier, type: "searchBar", sharesBackground: data.sharesBackground, hidesSharedBackground: data.hidesSharedBackground, hidden: data.hidden }); } function BottomToolbarHost({ children, hidden, animated = true }) { const data = (0, import_stackToolbarDescriptors.toolbarChildrenToBottomData)(children); if (!data.length) return null; return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_platform.ToolbarHost, { hidden, animated, children: data.map((entry) => { switch (entry.kind) { case "button": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BottomButtonElement, { data: entry }, entry.identifier); case "menu": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BottomMenuElement, { data: entry }, entry.identifier); case "spacer": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BottomSpacerElement, { data: entry }, entry.identifier); case "searchBar": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BottomSearchBarSlotElement, { data: entry }, entry.identifier); default: return null; } }) }); }