UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

35 lines (34 loc) 1.88 kB
var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import { jsx as _jsx } from "react/jsx-runtime"; import clsx from 'clsx'; import { Tab, TabList, TabPanel, Tabs } from 'react-tabs'; const CustomTab = (_a) => { var { children, hasErrors = false } = _a, props = __rest(_a, ["children", "hasErrors"]); const linkClassName = clsx('nav-link', { active: props.selected, 'is-invalid': hasErrors, 'tab-error': hasErrors, }); return (_jsx(Tab, Object.assign({ className: "nav-item", selectedClassName: "active" }, props, { children: _jsx("a", Object.assign({ href: "#", onClick: e => e.preventDefault(), className: linkClassName }, { children: children })) }))); }; CustomTab.tabsRole = 'Tab'; const CustomTabList = props => (_jsx("div", Object.assign({ className: "card-header" }, { children: _jsx(TabList, Object.assign({ className: "nav nav-tabs card-header-tabs" }, props)) }))); CustomTabList.tabsRole = 'TabList'; const CustomTabs = props => (_jsx(Tabs, Object.assign({ className: "card" }, props))); CustomTabs.tabsRole = 'Tabs'; const CustomTabPanel = props => { const style = props.selected ? {} : { display: 'none' }; return (_jsx(TabPanel, Object.assign({ className: "card-body tab-pane", selectedClassName: "active", style: style }, props))); }; CustomTabPanel.tabsRole = 'TabPanel'; export { CustomTab as Tab, CustomTabList as TabList, CustomTabPanel as TabPanel, CustomTabs as Tabs };