astrimid/sch-section-wrapper
Group tscircuit components into schematic sections without repeating schSectionName on every element.
- Version
- 0.0.1
- License
- MIT
- Stars
- 0
dist/index.cjs
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
const SchSection = ({ children, name, displayName, }) => {
const sectionName = name;
if (children) {
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: React.Children.map(children, (child) => {
if (React.isValidElement(child)) {
return React.cloneElement(child, { schSectionName: sectionName });
}
return child;
}) }));
}
else {
return jsxRuntime.jsx("schematicsection", { name: name, displayName: displayName || name.toUpperCase() });
}
};
var index = () => (jsxRuntime.jsxs("board", { width: "10mm", height: "10mm", children: [jsxRuntime.jsx(SchSection, { name: "filter" }), jsxRuntime.jsx(SchSection, { name: "power" }), jsxRuntime.jsxs(SchSection, { name: "power", children: [jsxRuntime.jsx("capacitor", { name: "C1", capacitance: "100uF", footprint: "0805", schX: -4, schY: 3 }), jsxRuntime.jsx("capacitor", { name: "C2", capacitance: "100nF", footprint: "0402", schX: -2, schY: 3 })] }), jsxRuntime.jsxs(SchSection, { name: "filter", children: [jsxRuntime.jsx("resistor", { name: "R1", resistance: "10k", footprint: "0402", schX: 2, schY: 3 }), jsxRuntime.jsx("capacitor", { name: "C3", capacitance: "10nF", footprint: "0402", schX: 4, schY: 3 })] })] }));
exports.SchSection = SchSection;
exports.default = index;