@oxide/design-system 1.4.7--canary.a5ff0ea.0 → 1.4.7--canary.70a0b39.0
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.
|
@@ -13,7 +13,7 @@ declare const AsciiDocBlocks: {
|
|
|
13
13
|
node: _oxide_react_asciidoc.TableBlock;
|
|
14
14
|
}) => react_jsx_runtime.JSX.Element;
|
|
15
15
|
Section: ({ node }: {
|
|
16
|
-
node:
|
|
16
|
+
node: _oxide_react_asciidoc.SectionBlock;
|
|
17
17
|
}) => react_jsx_runtime.JSX.Element;
|
|
18
18
|
};
|
|
19
19
|
|
package/components/dist/index.js
CHANGED
|
@@ -7118,49 +7118,28 @@ var import_react_asciidoc2 = require("@oxide/react-asciidoc");
|
|
|
7118
7118
|
var import_classnames = __toESM(require_classnames());
|
|
7119
7119
|
var import_react2 = require("react");
|
|
7120
7120
|
var import_jsx_runtime161 = require("react/jsx-runtime");
|
|
7121
|
+
var stripAnchors = (str) => str.replace(/<a[^>]*>(.*?)<\/a>/gi, "$1");
|
|
7121
7122
|
var Section = ({ node }) => {
|
|
7122
|
-
const
|
|
7123
|
-
const level = node.getLevel();
|
|
7123
|
+
const level = node.level;
|
|
7124
7124
|
let title = "";
|
|
7125
|
-
let sectNum = node.
|
|
7125
|
+
let sectNum = node.num;
|
|
7126
7126
|
sectNum = sectNum === "." ? "" : sectNum;
|
|
7127
|
-
const sectNumLevels = docAttrs["sectnumlevels"] ? parseInt(docAttrs["sectnumlevels"]) : 3;
|
|
7128
|
-
if (node.getCaption()) {
|
|
7129
|
-
title = node.getCaptionedTitle();
|
|
7130
|
-
} else if (node.isNumbered() && level <= sectNumLevels) {
|
|
7131
|
-
if (level < 2 && node.getDocument().getDoctype() === "book") {
|
|
7132
|
-
const sectionName = node.getSectionName();
|
|
7133
|
-
if (sectionName === "chapter") {
|
|
7134
|
-
const signifier = docAttrs["chapter-signifier"];
|
|
7135
|
-
title = `${signifier || ""} ${sectNum} ${node.getTitle()}`;
|
|
7136
|
-
} else if (sectionName === "part") {
|
|
7137
|
-
const signifier = docAttrs["part-signifier"];
|
|
7138
|
-
title = `${signifier || ""} ${sectNum} ${node.getTitle()}`;
|
|
7139
|
-
} else {
|
|
7140
|
-
title = node.getTitle() || "";
|
|
7141
|
-
}
|
|
7142
|
-
} else {
|
|
7143
|
-
title = node.getTitle() || "";
|
|
7144
|
-
}
|
|
7145
|
-
} else {
|
|
7146
|
-
title = node.getTitle() || "";
|
|
7147
|
-
}
|
|
7148
7127
|
title = /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)(import_jsx_runtime161.Fragment, { children: [
|
|
7149
|
-
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)("
|
|
7150
|
-
/* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("a", { className: "link group", href: `#${node.
|
|
7151
|
-
html_react_parser_default(title),
|
|
7152
|
-
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(Link16Icon_default, { className: "text-accent-secondary
|
|
7128
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { className: "anchor", id: node.id || "", "aria-hidden": "true" }),
|
|
7129
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("a", { className: "link group", href: `#${node.id}`, children: [
|
|
7130
|
+
html_react_parser_default(stripAnchors(node.title)),
|
|
7131
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(Link16Icon_default, { className: "ml-2 hidden text-accent-secondary group-hover:inline-block" })
|
|
7153
7132
|
] })
|
|
7154
7133
|
] });
|
|
7155
7134
|
if (level === 0) {
|
|
7156
7135
|
return /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)(import_jsx_runtime161.Fragment, { children: [
|
|
7157
|
-
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)("h1", { className: (0, import_classnames.default)("sect0",
|
|
7158
|
-
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(import_react_asciidoc2.Content, { blocks: node.
|
|
7136
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)("h1", { className: (0, import_classnames.default)("sect0", node.role), "data-sectnum": sectNum, children: title }),
|
|
7137
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(import_react_asciidoc2.Content, { blocks: node.blocks })
|
|
7159
7138
|
] });
|
|
7160
7139
|
} else {
|
|
7161
|
-
return /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("div", { className: (0, import_classnames.default)(`sect${level}`,
|
|
7140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("div", { className: (0, import_classnames.default)(`sect${level}`, node.role), children: [
|
|
7162
7141
|
(0, import_react2.createElement)(`h${level + 1}`, { "data-sectnum": sectNum }, title),
|
|
7163
|
-
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)("div", { className: "sectionbody", children: /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(import_react_asciidoc2.Content, { blocks: node.
|
|
7142
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)("div", { className: "sectionbody", children: /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(import_react_asciidoc2.Content, { blocks: node.blocks }) })
|
|
7164
7143
|
] });
|
|
7165
7144
|
}
|
|
7166
7145
|
};
|