gwchq-textjam 0.5.19 → 0.5.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +37 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -46543,7 +46543,7 @@ var Project = props => {
46543
46543
  (0,external_react_.useMemo)(() => {
46544
46544
  var isDesktop = params["width-larger-than-720"];
46545
46545
  setDefaultWidth(isDesktop ? "50%" : "100%");
46546
- setDefaultHeight(isDesktop ? "100%" : "33.33%");
46546
+ setDefaultHeight(isDesktop ? "100%" : "50%");
46547
46547
  setMaxWidth(isDesktop ? "75%" : "100%");
46548
46548
  setHandleDirection(isDesktop ? "right" : "bottom");
46549
46549
  }, [params["width-larger-than-720"]]);
@@ -46597,7 +46597,8 @@ var Project = props => {
46597
46597
  }), /*#__PURE__*/(0,jsx_runtime_.jsx)((OutputStack_default()), {
46598
46598
  renderOutput: renderOutput,
46599
46599
  outputMeta: outputMeta,
46600
- panelOrder: panelOrder
46600
+ panelOrder: panelOrder,
46601
+ tabbed: !params["width-larger-than-720"]
46601
46602
  })]
46602
46603
  })]
46603
46604
  })]
@@ -80064,14 +80065,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
80064
80065
  Object.defineProperty(exports, "__esModule", ({ value: true }));
80065
80066
  const jsx_runtime_1 = __webpack_require__(71178);
80066
80067
  const OutputTabPanel_1 = __webpack_require__(25931);
80068
+ const OutputTabs_1 = __webpack_require__(32982);
80067
80069
  const ResizableWithHandle_1 = __importDefault(__webpack_require__(32694));
80068
80070
  const stores_1 = __webpack_require__(32132);
80069
80071
  const EditorTypes_1 = __webpack_require__(42108);
80070
80072
  const styles_module_scss_1 = __importDefault(__webpack_require__(12914));
80071
- const OutputStack = ({ renderOutput, outputMeta, panelOrder, }) => {
80073
+ const OutputStack = ({ renderOutput, outputMeta, panelOrder, tabbed = false, }) => {
80072
80074
  const readOnly = (0, stores_1.useAppSelector)((state) => state.editor.readOnly);
80073
80075
  const isPreviewMode = (0, stores_1.useAppSelector)((state) => state.editor.isOutputOnly);
80074
80076
  const [topKind, bottomKind] = panelOrder;
80077
+ if (tabbed && !isPreviewMode) {
80078
+ return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.outputStackContainer, children: (0, jsx_runtime_1.jsx)(OutputTabs_1.OutputTabs, { outputTypes: panelOrder, outputMeta: outputMeta, renderOutput: renderOutput, readOnly: readOnly }) }));
80079
+ }
80075
80080
  return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.outputStackContainer, children: [(0, jsx_runtime_1.jsx)(OutputTabPanel_1.OutputTabPanel, { title: outputMeta[topKind].label, icon: outputMeta[topKind].icon, readOnly: readOnly, extraTabContent: outputMeta[topKind].extraHeaderContent, tabPanelClassName: topKind === EditorTypes_1.OutputType.VISUAL ? styles_module_scss_1.default.visualPanePadding : undefined, children: renderOutput(topKind) }), !isPreviewMode && ((0, jsx_runtime_1.jsx)(ResizableWithHandle_1.default, { "data-testid": "proj-console-container", handleDirection: "top", separatorLabel: `Resize the ${outputMeta[topKind].label} and ${outputMeta[bottomKind].label} panels`, defaultHeight: "50%", className: styles_module_scss_1.default.resizeContainer, handleClassName: styles_module_scss_1.default.resizeHandleContainer, children: (0, jsx_runtime_1.jsx)(OutputTabPanel_1.OutputTabPanel, { title: outputMeta[bottomKind].label, icon: outputMeta[bottomKind].icon, readOnly: readOnly, extraTabContent: outputMeta[bottomKind].extraHeaderContent, tabPanelClassName: bottomKind === EditorTypes_1.OutputType.VISUAL
80076
80081
  ? styles_module_scss_1.default.visualPanePadding
80077
80082
  : undefined, children: renderOutput(bottomKind) }) }))] }));
@@ -80111,6 +80116,35 @@ const OutputTabPanel = ({ title, icon: Icon, readOnly, children, outputWrapperCl
80111
80116
  exports.OutputTabPanel = OutputTabPanel;
80112
80117
 
80113
80118
 
80119
+ /***/ }),
80120
+
80121
+ /***/ 32982:
80122
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
80123
+
80124
+
80125
+ var __importDefault = (this && this.__importDefault) || function (mod) {
80126
+ return (mod && mod.__esModule) ? mod : { "default": mod };
80127
+ };
80128
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
80129
+ exports.OutputTabs = void 0;
80130
+ const jsx_runtime_1 = __webpack_require__(71178);
80131
+ const react_1 = __webpack_require__(13327);
80132
+ const classnames_1 = __importDefault(__webpack_require__(46942));
80133
+ const react_tabs_1 = __webpack_require__(60627);
80134
+ const Text_1 = __webpack_require__(82803);
80135
+ const SvgIcon_1 = __webpack_require__(82917);
80136
+ const EditorTypes_1 = __webpack_require__(42108);
80137
+ const styles_module_scss_1 = __importDefault(__webpack_require__(12914));
80138
+ const OutputTabs = ({ outputTypes, outputMeta, renderOutput, readOnly, }) => {
80139
+ const [selectedIndex, setSelectedIndex] = (0, react_1.useState)(0);
80140
+ return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.outputPanel, children: (0, jsx_runtime_1.jsxs)(react_tabs_1.Tabs, { selectedIndex: selectedIndex, onSelect: setSelectedIndex, forceRenderTabPanel: true, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)("tabContainer", { readOnly: readOnly }), children: (0, jsx_runtime_1.jsx)(react_tabs_1.TabList, { className: (0, classnames_1.default)("react-tabs__tab-list", { readOnly: readOnly }), children: outputTypes.map((outputType) => {
80141
+ const { label, icon, extraHeaderContent } = outputMeta[outputType];
80142
+ return ((0, jsx_runtime_1.jsx)(react_tabs_1.Tab, { className: (0, classnames_1.default)("react-tabs__tab", { readOnly: readOnly }), children: (0, jsx_runtime_1.jsxs)(Text_1.Text, { size: 12, weight: "medium", className: "tabText", children: [(0, jsx_runtime_1.jsx)(SvgIcon_1.SvgIcon, { SvgElement: icon, size: 18 }), label, extraHeaderContent] }) }, outputType));
80143
+ }) }) }), outputTypes.map((outputType) => ((0, jsx_runtime_1.jsx)(react_tabs_1.TabPanel, { className: (0, classnames_1.default)("react-tabs__tab-panel", outputType === EditorTypes_1.OutputType.VISUAL && styles_module_scss_1.default.visualPanePadding), children: renderOutput(outputType) }, outputType)))] }) }));
80144
+ };
80145
+ exports.OutputTabs = OutputTabs;
80146
+
80147
+
80114
80148
  /***/ }),
80115
80149
 
80116
80150
  /***/ 39626:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gwchq-textjam",
3
3
  "description": "Embeddable React editor used in Raspberry Pi text-based projects.",
4
- "version": "0.5.19",
4
+ "version": "0.5.20",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/GirlsFirst/gwchq-textjam",
7
7
  "author": "Girls Who Code HQ",