xmlui 0.9.59 → 0.9.60
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.
- package/dist/lib/{apiInterceptorWorker-BYU_Trhx.mjs → apiInterceptorWorker-CNiXy9XE.mjs} +1 -1
- package/dist/lib/{index-JqY6G28u.mjs → index-B1V2vJWh.mjs} +12728 -13275
- package/dist/lib/index.css +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-BXdiMJQN.mjs → metadata-utils-4EQ6kQIM.mjs} +31 -40
- package/dist/lib/{server-common-DGglaqCL.mjs → server-common-SNl_47nE.mjs} +858 -1450
- package/dist/lib/{transform-BboeJCuA.mjs → transform-CgRMkbb0.mjs} +733 -798
- package/dist/lib/xmlui-parser.d.ts +6 -31
- package/dist/lib/xmlui-parser.mjs +42 -49
- package/dist/lib/{xmlui-serializer-D0p6Hyum.mjs → xmlui-serializer-EDw51UFN.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +6 -45
- package/dist/lib/xmlui.mjs +2 -2
- package/dist/metadata/{apiInterceptorWorker-CqXRCP46.mjs → apiInterceptorWorker-DsjW46f_.mjs} +1 -1
- package/dist/metadata/{collectedComponentMetadata-BA6d7xt-.mjs → collectedComponentMetadata-CBiI_eDf.mjs} +13515 -14148
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +124 -124
- package/dist/scripts/package.json +5 -5
- package/dist/scripts/src/components/Accordion/Accordion.js +1 -1
- package/dist/scripts/src/components/App/App.js +1 -5
- package/dist/scripts/src/components/App/AppNative.js +1 -11
- package/dist/scripts/src/components/Card/Card.js +1 -1
- package/dist/scripts/src/components/Card/CardNative.js +1 -2
- package/dist/scripts/src/components/Charts/DonutChart/DonutChart.js +5 -6
- package/dist/scripts/src/components/Charts/PieChart/PieChart.js +7 -11
- package/dist/scripts/src/components/Charts/PieChart/PieChartNative.js +4 -9
- package/dist/scripts/src/components/CodeBlock/CodeBlock.js +1 -4
- package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +1 -1
- package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +2 -2
- package/dist/scripts/src/components/ComponentProvider.js +0 -4
- package/dist/scripts/src/components/ExpandableItem/ExpandableItem.js +3 -3
- package/dist/scripts/src/components/FlowLayout/FlowLayoutNative.js +6 -35
- package/dist/scripts/src/components/Footer/Footer.js +1 -2
- package/dist/scripts/src/components/Form/Form.js +0 -4
- package/dist/scripts/src/components/Form/FormNative.js +4 -12
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +1 -1
- package/dist/scripts/src/components/Link/LinkNative.js +1 -46
- package/dist/scripts/src/components/Markdown/Markdown.js +3 -3
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +3 -2
- package/dist/scripts/src/components/Markdown/utils.js +12 -21
- package/dist/scripts/src/components/NavGroup/NavGroupContext.js +0 -1
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +2 -6
- package/dist/scripts/src/components/NavLink/NavLinkNative.js +9 -10
- package/dist/scripts/src/components/NavPanel/NavPanel.js +2 -3
- package/dist/scripts/src/components/NavPanel/NavPanelNative.js +3 -132
- package/dist/scripts/src/components/NestedApp/AppWithCodeView.js +3 -22
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +7 -66
- package/dist/scripts/src/components/NestedApp/NestedApp.js +7 -13
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +6 -8
- package/dist/scripts/src/components/Pages/Pages.js +4 -4
- package/dist/scripts/src/components/Pages/PagesNative.js +3 -8
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +11 -12
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +28 -13
- package/dist/scripts/src/components/Select/Select.js +1 -2
- package/dist/scripts/src/components/Select/SelectNative.js +1 -1
- package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +0 -2
- package/dist/scripts/src/components/Switch/Switch.js +2 -6
- package/dist/scripts/src/components/Table/TableNative.js +2 -6
- package/dist/scripts/src/components/Table/useRowSelection.js +2 -6
- package/dist/scripts/src/components/Tabs/Tabs.js +2 -5
- package/dist/scripts/src/components/Text/Text.js +2 -2
- package/dist/scripts/src/components/TextBox/TextBox.js +1 -1
- package/dist/scripts/src/components/Theme/NotificationToast.js +0 -11
- package/dist/scripts/src/components/Theme/ThemeNative.js +4 -4
- package/dist/scripts/src/components/TreeDisplay/TreeDisplay.js +0 -2
- package/dist/scripts/src/components-core/Fragment.js +2 -5
- package/dist/scripts/src/components-core/RestApiProxy.js +7 -10
- package/dist/scripts/src/components-core/appContext/date-functions.js +0 -1
- package/dist/scripts/src/components-core/descriptorHelper.js +0 -9
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +2 -2
- package/dist/scripts/src/components-core/rendering/AppContent.js +2 -6
- package/dist/scripts/src/components-core/rendering/AppRoot.js +2 -4
- package/dist/scripts/src/components-core/rendering/StateContainer.js +0 -6
- package/dist/scripts/src/components-core/theming/layout-resolver.js +0 -18
- package/dist/scripts/src/components-core/theming/themes/root.js +0 -3
- package/dist/scripts/src/components-core/utils/date-utils.js +0 -60
- package/dist/scripts/src/parsers/xmlui-parser/parser.js +39 -42
- package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +0 -65
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +8 -10
- package/dist/scripts/src/parsers/xmlui-parser/utils.js +2 -1
- package/dist/standalone/xmlui-standalone.es.d.ts +6 -45
- package/dist/standalone/xmlui-standalone.umd.js +248 -248
- package/package.json +5 -5
- package/dist/scripts/src/components/HelloWorld/HelloWorld.js +0 -103
- package/dist/scripts/src/components/HelloWorld/HelloWorldNative.js +0 -92
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xmlui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.60",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start-test-bed": "cd src/testing/infrastructure && xmlui start",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
|
|
18
18
|
"prepublishOnly": "clean-package",
|
|
19
19
|
"postpublish": "clean-package restore",
|
|
20
|
+
"prepare-docs-data": "npm run build:xmlui-metadata",
|
|
20
21
|
"generate-docs-summaries": "node scripts/generate-docs/generate-summary-files.mjs",
|
|
21
|
-
"generate-docs": "node scripts/generate-docs/get-docs.mjs",
|
|
22
|
-
"generate-all-docs": "npm run build:xmlui-metadata && npm run build:ext-meta && npm run generate-docs
|
|
23
|
-
"export-themes": "npm run
|
|
24
|
-
"generate-docs-with-refresh": "npm run build:xmlui-metadata && npm run generate-docs && npm run generate-docs-summaries",
|
|
22
|
+
"generate-docs": "node scripts/generate-docs/get-docs.mjs && npm run generate-docs-summaries",
|
|
23
|
+
"generate-all-docs": "npm run build:xmlui-metadata && npm run build:ext-meta && npm run generate-docs",
|
|
24
|
+
"export-themes": "npm run prepare-docs-data && node scripts/generate-docs/create-theme-files.mjs",
|
|
25
25
|
"gen:langserver-metadata": "node scripts/get-langserver-metadata.mjs > src/language-server/xmlui-metadata-generated.mjs"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
@@ -65,7 +65,7 @@ exports.AccordionMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
65
65
|
defaultThemeVars: {
|
|
66
66
|
[`paddingHorizontal-header-${COMP}`]: "$space-3",
|
|
67
67
|
[`paddingVertical-header-${COMP}`]: "$space-3",
|
|
68
|
-
[`
|
|
68
|
+
[`verticalAlign-header-${COMP}`]: "center",
|
|
69
69
|
[`fontSize-header-${COMP}`]: "$fontSize-normal",
|
|
70
70
|
[`fontWeight-header-${COMP}`]: "$fontWeight-normal",
|
|
71
71
|
[`fontFamily-header-${COMP}`]: "$fontFamily",
|
|
@@ -315,16 +315,12 @@ function AppNode({ node, extractValue, renderChild, style, lookupEventHandler })
|
|
|
315
315
|
return ((0, jsx_runtime_1.jsxs)(AppNative_1.App, Object.assign({}, appProps, { header: renderedHeader, footer: renderedFooter, navPanel: renderedNavPanel, navPanelDef: NavPanel, logoContentDef: node.props.logoTemplate, renderChild: renderChild, children: [renderedContent, (0, jsx_runtime_1.jsx)(SearchIndexCollector, { Pages: Pages, renderChild: renderChild })] })));
|
|
316
316
|
}
|
|
317
317
|
const HIDDEN_STYLE = {
|
|
318
|
-
position: "absolute",
|
|
319
|
-
top: "-9999px",
|
|
320
318
|
display: "none",
|
|
321
319
|
};
|
|
322
|
-
const indexerContextValue = {
|
|
323
|
-
indexing: true,
|
|
324
|
-
};
|
|
325
320
|
function SearchIndexCollector({ Pages, renderChild }) {
|
|
326
321
|
var _a, _b;
|
|
327
322
|
const appContext = (0, AppContext_1.useAppContext)();
|
|
323
|
+
const indexerContextValue = (0, react_1.useMemo)(() => ({ indexing: true }), []);
|
|
328
324
|
const setIndexing = (0, SearchContext_1.useSearchContextSetIndexing)();
|
|
329
325
|
const [isClient, setIsClient] = (0, react_1.useState)(false);
|
|
330
326
|
(0, react_1.useEffect)(() => {
|
|
@@ -46,7 +46,7 @@ function App({ children, style, layout, loggedInUser, scrollWholePage = exports.
|
|
|
46
46
|
const mounted = (0, react_1.useRef)(false);
|
|
47
47
|
const layoutWithDefaultValue = layout || getThemeVar("layout-App") || "condensed-sticky";
|
|
48
48
|
const safeLayout = layoutWithDefaultValue === null || layoutWithDefaultValue === void 0 ? void 0 : layoutWithDefaultValue.trim().replace(/[\u2013\u2014\u2011]/g, "-"); //It replaces all – (–) and — (—) and non-breaking hyphen '‑' symbols with simple dashes (-).
|
|
49
|
-
const { setLoggedInUser, mediaSize, forceRefreshAnchorScroll
|
|
49
|
+
const { setLoggedInUser, mediaSize, forceRefreshAnchorScroll } = (0, AppContext_1.useAppContext)();
|
|
50
50
|
const hasRegisteredHeader = header !== undefined;
|
|
51
51
|
const hasRegisteredNavPanel = navPanelDef !== undefined;
|
|
52
52
|
const pagesWrapperInnerStyle = (0, react_1.useMemo)(() => {
|
|
@@ -139,13 +139,9 @@ function App({ children, style, layout, loggedInUser, scrollWholePage = exports.
|
|
|
139
139
|
});
|
|
140
140
|
}, [forceRefreshAnchorScroll]);
|
|
141
141
|
const [subNavPanelSlot, setSubNavPanelSlot] = (0, react_1.useState)(null);
|
|
142
|
-
const [linkMap, setLinkMap] = (0, react_1.useState)(new Map());
|
|
143
142
|
const registerSubNavPanelSlot = (0, react_1.useCallback)((element) => {
|
|
144
143
|
setSubNavPanelSlot(element);
|
|
145
144
|
}, []);
|
|
146
|
-
const registerLinkMap = (0, react_1.useCallback)((newLinkMap) => {
|
|
147
|
-
setLinkMap(newLinkMap);
|
|
148
|
-
}, []);
|
|
149
145
|
const layoutContextValue = (0, react_1.useMemo)(() => {
|
|
150
146
|
return {
|
|
151
147
|
hasRegisteredNavPanel,
|
|
@@ -167,9 +163,6 @@ function App({ children, style, layout, loggedInUser, scrollWholePage = exports.
|
|
|
167
163
|
logoContentDef,
|
|
168
164
|
registerSubNavPanelSlot,
|
|
169
165
|
subNavPanelSlot,
|
|
170
|
-
isNested: (appGlobals === null || appGlobals === void 0 ? void 0 : appGlobals.isNested) || false,
|
|
171
|
-
linkMap,
|
|
172
|
-
registerLinkMap,
|
|
173
166
|
};
|
|
174
167
|
}, [
|
|
175
168
|
hasRegisteredNavPanel,
|
|
@@ -185,9 +178,6 @@ function App({ children, style, layout, loggedInUser, scrollWholePage = exports.
|
|
|
185
178
|
logoContentDef,
|
|
186
179
|
registerSubNavPanelSlot,
|
|
187
180
|
subNavPanelSlot,
|
|
188
|
-
appGlobals === null || appGlobals === void 0 ? void 0 : appGlobals.isNested,
|
|
189
|
-
linkMap,
|
|
190
|
-
registerLinkMap,
|
|
191
181
|
]);
|
|
192
182
|
(0, react_1.useEffect)(() => {
|
|
193
183
|
if (navPanelVisible) {
|
|
@@ -69,7 +69,7 @@ exports.CardMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
69
69
|
[`boxShadow-${COMP}`]: "none",
|
|
70
70
|
[`backgroundColor-${COMP}`]: "$color-surface-raised",
|
|
71
71
|
[`gap-${COMP}`]: "var(--stack-gap-default)",
|
|
72
|
-
[`gap-title-${COMP}`]: "$gap-
|
|
72
|
+
[`gap-title-${COMP}`]: "$gap-normal",
|
|
73
73
|
[`gap-avatar-${COMP}`]: "$gap-normal",
|
|
74
74
|
[`verticalAlignment-title-${COMP}`]: "center",
|
|
75
75
|
},
|
|
@@ -19,11 +19,10 @@ exports.defaultProps = {
|
|
|
19
19
|
exports.Card = (0, react_1.forwardRef)(function Card({ children, orientation = exports.defaultProps.orientation, style, title, subtitle, linkTo, avatarUrl, showAvatar = !!avatarUrl || exports.defaultProps.showAvatar, avatarSize, onClick, }, forwardedRef) {
|
|
20
20
|
const titleProps = {
|
|
21
21
|
level: "h2",
|
|
22
|
-
maxLines: 1
|
|
23
22
|
};
|
|
24
23
|
return ((0, jsx_runtime_1.jsxs)("div", { ref: forwardedRef, className: (0, classnames_1.default)(Card_module_scss_1.default.wrapper, {
|
|
25
24
|
[Card_module_scss_1.default.isClickable]: !!onClick,
|
|
26
25
|
[Card_module_scss_1.default.vertical]: orientation === "vertical",
|
|
27
26
|
[Card_module_scss_1.default.horizontal]: orientation === "horizontal",
|
|
28
|
-
}), style: style, onClick: onClick, children: [[title, subtitle, avatarUrl, showAvatar].some(Boolean) && ((0, jsx_runtime_1.jsxs)("div", { className: Card_module_scss_1.default.avatarWrapper, children: [showAvatar && (0, jsx_runtime_1.jsx)(AvatarNative_1.Avatar, { url: avatarUrl, name: title, size: avatarSize }), (0, jsx_runtime_1.jsxs)("div", { className: Card_module_scss_1.default.titleWrapper, children: [linkTo ? (title ? ((0, jsx_runtime_1.jsx)(LinkNative_1.LinkNative, { to: linkTo + "", children: (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, Object.assign({}, titleProps, { children: title })) })) : null) : title ? ((0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, Object.assign({}, titleProps, { children: title }))) : null, subtitle !== undefined && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(TextNative_1.Text, { variant: "
|
|
27
|
+
}), style: style, onClick: onClick, children: [[title, subtitle, avatarUrl, showAvatar].some(Boolean) && ((0, jsx_runtime_1.jsxs)("div", { className: Card_module_scss_1.default.avatarWrapper, children: [showAvatar && (0, jsx_runtime_1.jsx)(AvatarNative_1.Avatar, { url: avatarUrl, name: title, size: avatarSize }), (0, jsx_runtime_1.jsxs)("div", { className: Card_module_scss_1.default.titleWrapper, children: [linkTo ? (title ? ((0, jsx_runtime_1.jsx)(LinkNative_1.LinkNative, { to: linkTo + "", children: (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, Object.assign({}, titleProps, { children: title })) })) : null) : title ? ((0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, Object.assign({}, titleProps, { children: title }))) : null, subtitle !== undefined && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(TextNative_1.Text, { variant: "small", children: subtitle }) }))] })] })), children] }));
|
|
29
28
|
});
|
|
@@ -13,19 +13,18 @@ const themeVars_1 = require("../../../components-core/theming/themeVars");
|
|
|
13
13
|
const COMP = "DonutChart";
|
|
14
14
|
const defaultPropsDonut = Object.assign(Object.assign({}, PieChartNative_1.defaultProps), { innerRadius: 60 });
|
|
15
15
|
exports.DonutChartMd = (0, ComponentDefs_1.createMetadata)({
|
|
16
|
-
description: "A derivative of [PieChart](/components/PieChart) with a hollow center.
|
|
17
|
-
"Note that the height of the component or its parent needs to be set explicitly.",
|
|
16
|
+
description: "A derivative of [PieChart](/components/PieChart) with a hollow center.",
|
|
18
17
|
status: "experimental",
|
|
19
18
|
props: {
|
|
20
19
|
data: {
|
|
21
20
|
description: "The data to be displayed in the chart. Needs to be an array of objects.",
|
|
22
21
|
},
|
|
23
|
-
|
|
24
|
-
description: "
|
|
22
|
+
dataKeys: {
|
|
23
|
+
description: "This property specifies the keys in the data objects that should be used for rendering the bars.",
|
|
25
24
|
valueType: "string",
|
|
26
25
|
},
|
|
27
|
-
|
|
28
|
-
description: "
|
|
26
|
+
nameKey: {
|
|
27
|
+
description: "Specifies the key in the data objects that will be used to label the different data series.",
|
|
29
28
|
valueType: "string",
|
|
30
29
|
},
|
|
31
30
|
showLabel: {
|
|
@@ -14,20 +14,19 @@ const renderers_1 = require("../../../components-core/renderers");
|
|
|
14
14
|
const COMP = "PieChart";
|
|
15
15
|
exports.PieChartMd = (0, ComponentDefs_1.createMetadata)({
|
|
16
16
|
description: "`PieChart` visualizes proportional data as circular segments; each slice " +
|
|
17
|
-
"represents a percentage of the whole.
|
|
18
|
-
"its parent needs to be set explicitly.",
|
|
17
|
+
"represents a percentage of the whole.",
|
|
19
18
|
status: "experimental",
|
|
20
19
|
docFolder: "Charts/PieChart",
|
|
21
20
|
props: {
|
|
22
21
|
data: {
|
|
23
22
|
description: "The data to be displayed in the chart. Needs to be an array of objects.",
|
|
24
23
|
},
|
|
25
|
-
|
|
26
|
-
description: "
|
|
24
|
+
dataKeys: {
|
|
25
|
+
description: "This property specifies the keys in the data objects that should be used for rendering the bars.",
|
|
27
26
|
valueType: "string",
|
|
28
27
|
},
|
|
29
|
-
|
|
30
|
-
description: "
|
|
28
|
+
nameKey: {
|
|
29
|
+
description: "Specifies the key in the data objects that will be used to label the different data series.",
|
|
31
30
|
valueType: "string",
|
|
32
31
|
},
|
|
33
32
|
showLabel: {
|
|
@@ -46,12 +45,9 @@ exports.PieChartMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
46
45
|
defaultValue: PieChartNative_1.defaultProps.labelListPosition,
|
|
47
46
|
availableValues: abstractions_1.LabelPositionValues,
|
|
48
47
|
},
|
|
48
|
+
width: (0, ComponentDefs_1.d)("The width of the chart"),
|
|
49
|
+
height: (0, ComponentDefs_1.d)("The height of the chart"),
|
|
49
50
|
outerRadius: (0, ComponentDefs_1.d)("The outer radius of the pie chart, can be a number or a string (e.g., '100%')."),
|
|
50
|
-
showLegend: {
|
|
51
|
-
description: "Toggles whether to show legend (\`true\`) or not (\`false\`).",
|
|
52
|
-
valueType: "boolean",
|
|
53
|
-
defaultValue: PieChartNative_1.defaultProps.showLegend,
|
|
54
|
-
}
|
|
55
51
|
},
|
|
56
52
|
themeVars: (0, themeVars_1.parseScssVar)(PieChartNative_module_scss_1.default.themeVars),
|
|
57
53
|
defaultThemeVars: {
|
|
@@ -73,7 +73,7 @@ const renderActiveShape = (props) => {
|
|
|
73
73
|
const { cx, cy, innerRadius, outerRadius, startAngle, endAngle, fill } = props;
|
|
74
74
|
return ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)(recharts_1.Sector, { cx: cx, cy: cy, innerRadius: innerRadius, outerRadius: outerRadius + 10, startAngle: startAngle, endAngle: endAngle, fill: fill }), (0, jsx_runtime_1.jsx)(recharts_1.Sector, { cx: cx, cy: cy, startAngle: startAngle, endAngle: endAngle, innerRadius: outerRadius + 6, outerRadius: outerRadius + 10, fill: fill })] }));
|
|
75
75
|
};
|
|
76
|
-
function PieChart({ data, dataKey, nameKey, style, showLabel = exports.defaultProps.showLabel, showLabelList = exports.defaultProps.showLabelList, labelListPosition = exports.defaultProps.labelListPosition, innerRadius = exports.defaultProps.innerRadius, children, outerRadius = "60%", showLegend = exports.defaultProps.showLegend, }) {
|
|
76
|
+
function PieChart({ data, dataKey, nameKey, style, showLabel = exports.defaultProps.showLabel, showLabelList = exports.defaultProps.showLabelList, labelListPosition = exports.defaultProps.labelListPosition, innerRadius = exports.defaultProps.innerRadius, children, width = "100%", height = "100%", outerRadius = "60%", showLegend = exports.defaultProps.showLegend, }) {
|
|
77
77
|
const { getThemeVar } = (0, xmlui_1.useTheme)();
|
|
78
78
|
const colorValues = (0, react_1.useMemo)(() => {
|
|
79
79
|
return [
|
|
@@ -121,12 +121,7 @@ function PieChart({ data, dataKey, nameKey, style, showLabel = exports.defaultPr
|
|
|
121
121
|
return data.map((item, index) => (Object.assign(Object.assign({}, item), { fill: item.fill || colorValues[index % colorValues.length] })));
|
|
122
122
|
}, [colorValues, data]);
|
|
123
123
|
const chartContextValue = (0, ChartProvider_1.useChartContextValue)({ dataKey, nameKey });
|
|
124
|
-
return ((0, jsx_runtime_1.jsxs)(ChartProvider_1.default, { value: chartContextValue, children: [children, (0, jsx_runtime_1.jsx)(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
width: style.width || "100%",
|
|
128
|
-
height: style.height || "100%",
|
|
129
|
-
}, children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { style: style, width: "100%", height: "100%", minWidth: 0, children: (0, jsx_runtime_1.jsxs)(recharts_1.PieChart, { children: [(0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { content: (0, jsx_runtime_1.jsx)(TooltipContent_1.TooltipContent, {}) }), (0, jsx_runtime_1.jsx)(recharts_1.Pie, { data: chartData, dataKey: dataKey, nameKey: nameKey, innerRadius: innerRadius, outerRadius: outerRadius, paddingAngle: 1, activeShape: renderActiveShape, label: showLabel ? renderCustomizedLabel : false, labelLine: showLabel, children: chartContextValue.labelList
|
|
130
|
-
? chartContextValue.labelList
|
|
131
|
-
: showLabelList && ((0, jsx_runtime_1.jsx)(recharts_1.LabelList, { position: labelListPosition, dataKey: nameKey, className: PieChartNative_module_scss_1.default.labelList, stroke: "none", fill: "currentColor", fontSize: 12 })) }), chartContextValue.legend ? chartContextValue.legend : showLegend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, {})] }) }) })] }));
|
|
124
|
+
return ((0, jsx_runtime_1.jsxs)(ChartProvider_1.default, { value: chartContextValue, children: [children, (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { style: style, width: width, height: height, children: (0, jsx_runtime_1.jsxs)(recharts_1.PieChart, { children: [(0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { content: (0, jsx_runtime_1.jsx)(TooltipContent_1.TooltipContent, {}) }), (0, jsx_runtime_1.jsx)(recharts_1.Pie, { data: chartData, dataKey: dataKey, nameKey: nameKey, innerRadius: innerRadius, outerRadius: outerRadius, paddingAngle: 1, activeShape: renderActiveShape, label: showLabel ? renderCustomizedLabel : false, labelLine: showLabel, children: chartContextValue.labelList
|
|
125
|
+
? chartContextValue.labelList
|
|
126
|
+
: showLabelList && ((0, jsx_runtime_1.jsx)(recharts_1.LabelList, { position: labelListPosition, dataKey: nameKey, className: PieChartNative_module_scss_1.default.labelList, stroke: "none", fill: "currentColor", fontSize: 12 })) }), chartContextValue.legend ? chartContextValue.legend : showLegend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, {})] }) })] }));
|
|
132
127
|
}
|
|
@@ -23,11 +23,8 @@ exports.CodeBlockMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
23
23
|
"marginBottom-CodeBlock": "$space-5",
|
|
24
24
|
"backgroundColor-CodeBlock-highlightRow": "rgb(from $color-primary-200 r g b / 0.25)",
|
|
25
25
|
"backgroundColor-CodeBlock-highlightString": "rgb(from $color-primary-200 r g b / 0.5)",
|
|
26
|
-
"borderColor-CodeBlock-highlightString-emphasis": "$color-attention",
|
|
27
|
-
"border-CodeBlock": "0.5px solid $borderColor",
|
|
28
26
|
"borderRadius-CodeBlock": "$space-2",
|
|
29
|
-
"
|
|
30
|
-
"height-CodeBlock": "fit-content",
|
|
27
|
+
"borderColor-CodeBlock-highlightString-emphasis": "$color-attention",
|
|
31
28
|
dark: {
|
|
32
29
|
"backgroundColor-CodeBlock-header": "$color-surface-200",
|
|
33
30
|
"backgroundColor-CodeBlock": "$color-surface-50",
|
|
@@ -23,7 +23,7 @@ function CodeBlock({ children, meta, textToCopy, style }) {
|
|
|
23
23
|
if (!meta) {
|
|
24
24
|
return ((0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlock, style: style, children: (0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlockContent, children: children }) }));
|
|
25
25
|
}
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: CodeBlock_module_scss_1.default.codeBlock, style: style, children: [meta.filename && ((0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlockHeader, children: (0, jsx_runtime_1.jsx)(TextNative_1.Text, { variant: "em", children: meta.filename }) })), (0, jsx_runtime_1.jsxs)("div", { className: CodeBlock_module_scss_1.default.codeBlockContent, children: [children,
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: CodeBlock_module_scss_1.default.codeBlock, style: style, children: [meta.filename && ((0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlockHeader, children: (0, jsx_runtime_1.jsx)(TextNative_1.Text, { variant: "em", children: meta.filename }) })), (0, jsx_runtime_1.jsxs)("div", { className: CodeBlock_module_scss_1.default.codeBlockContent, children: [children, (0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlockCopyButton, children: (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", size: "xs", className: CodeBlock_module_scss_1.default.copyButton, icon: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "copy", "aria-hidden": true }), onClick: () => {
|
|
27
27
|
if (!textToCopy)
|
|
28
28
|
return;
|
|
29
29
|
navigator.clipboard.writeText(textToCopy);
|
|
@@ -13,8 +13,8 @@ const misc_1 = require("../../components-core/utils/misc");
|
|
|
13
13
|
const ColorPicker_module_scss_1 = __importDefault(require("./ColorPicker.module.scss"));
|
|
14
14
|
const classnames_1 = __importDefault(require("classnames"));
|
|
15
15
|
exports.defaultProps = {
|
|
16
|
-
initialValue: "
|
|
17
|
-
value: "
|
|
16
|
+
initialValue: "",
|
|
17
|
+
value: "",
|
|
18
18
|
enabled: true,
|
|
19
19
|
validationStatus: "none",
|
|
20
20
|
};
|
|
@@ -12,7 +12,6 @@ const Link_1 = require("./Link/Link");
|
|
|
12
12
|
const TreeComponent_1 = require("./Tree/TreeComponent");
|
|
13
13
|
const TreeDisplay_1 = require("./TreeDisplay/TreeDisplay");
|
|
14
14
|
const Button_1 = require("./Button/Button");
|
|
15
|
-
const HelloWorld_1 = require("./HelloWorld/HelloWorld");
|
|
16
15
|
const Heading_1 = require("./Heading/Heading");
|
|
17
16
|
const Text_1 = require("./Text/Text");
|
|
18
17
|
const Fragment_1 = require("../components-core/Fragment");
|
|
@@ -257,9 +256,6 @@ class ComponentRegistry {
|
|
|
257
256
|
if (process.env.VITE_USED_COMPONENTS_Button !== "false") {
|
|
258
257
|
this.registerCoreComponent(Button_1.buttonComponentRenderer);
|
|
259
258
|
}
|
|
260
|
-
if (process.env.VITE_USED_COMPONENTS_HelloWorld !== "false") {
|
|
261
|
-
this.registerCoreComponent(HelloWorld_1.helloWorldComponentRenderer);
|
|
262
|
-
}
|
|
263
259
|
if (process.env.VITE_USED_COMPONENTS_Checkbox !== "false") {
|
|
264
260
|
this.registerCoreComponent(Checkbox_1.checkboxComponentRenderer);
|
|
265
261
|
}
|
|
@@ -77,9 +77,9 @@ exports.ExpandableItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
77
77
|
[`paddingLeft-${COMP}`]: "$space-0",
|
|
78
78
|
[`paddingRight-${COMP}`]: "$space-0",
|
|
79
79
|
[`gap-${COMP}`]: "$space-2",
|
|
80
|
-
[`
|
|
81
|
-
[`
|
|
82
|
-
[`
|
|
80
|
+
[`contentPaddingLeft-${COMP}`]: "$space-3",
|
|
81
|
+
[`contentPaddingRight-${COMP}`]: "$space-3",
|
|
82
|
+
[`contentPaddingVertical-${COMP}`]: "$space-2",
|
|
83
83
|
[`transition-${COMP}`]: "0.2s ease",
|
|
84
84
|
},
|
|
85
85
|
});
|
|
@@ -24,7 +24,6 @@ const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
|
|
|
24
24
|
const css_utils_1 = require("../../components-core/utils/css-utils");
|
|
25
25
|
const hooks_1 = require("../../components-core/utils/hooks");
|
|
26
26
|
const layout_resolver_1 = require("../../components-core/theming/layout-resolver");
|
|
27
|
-
const AppContext_1 = require("../../components-core/AppContext");
|
|
28
27
|
const resolvedCssVars = {};
|
|
29
28
|
const FlowLayoutContext = (0, react_1.createContext)({
|
|
30
29
|
rowGap: 0,
|
|
@@ -36,7 +35,6 @@ exports.FlowItemBreak = FlowItemBreak;
|
|
|
36
35
|
exports.FlowItemWrapper = (0, react_1.forwardRef)(function FlowItemWrapper(_a, ref) {
|
|
37
36
|
var { children, forceBreak } = _a, restProps = __rest(_a, ["children", "forceBreak"]);
|
|
38
37
|
const { rowGap, columnGap, setNumberOfChildren } = (0, react_1.useContext)(FlowLayoutContext);
|
|
39
|
-
const { mediaSize } = (0, AppContext_1.useAppContext)();
|
|
40
38
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
41
39
|
setNumberOfChildren((prev) => prev + 1);
|
|
42
40
|
return () => {
|
|
@@ -64,7 +62,7 @@ exports.FlowItemWrapper = (0, react_1.forwardRef)(function FlowItemWrapper(_a, r
|
|
|
64
62
|
// },
|
|
65
63
|
// ).cssProps || {}
|
|
66
64
|
);
|
|
67
|
-
}, [_maxWidth, _minWidth, _width]);
|
|
65
|
+
}, [_maxWidth, _minWidth, _width, activeTheme.themeVars]);
|
|
68
66
|
const resolvedWidth = (0, react_1.useMemo)(() => {
|
|
69
67
|
if (width && typeof width === "string" && width.startsWith("var(")) {
|
|
70
68
|
if (!resolvedCssVars[width]) {
|
|
@@ -78,41 +76,14 @@ exports.FlowItemWrapper = (0, react_1.forwardRef)(function FlowItemWrapper(_a, r
|
|
|
78
76
|
}, [_width, root, width]);
|
|
79
77
|
const isWidthPercentage = typeof resolvedWidth === "string" && resolvedWidth.endsWith("%");
|
|
80
78
|
const _columnGap = (0, css_utils_1.normalizeCssValueForCalc)(columnGap);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const percNumber = parseFloat(resolvedWidth);
|
|
84
|
-
if (mediaSize.sizeIndex <= 1) {
|
|
85
|
-
let percentage = percNumber * 4;
|
|
86
|
-
if (percentage > 50) {
|
|
87
|
-
responsiveWidth = `100%`;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
responsiveWidth = `min(${percentage}%, 100%)`;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else if (mediaSize.sizeIndex <= 2) {
|
|
94
|
-
let percentage = percNumber * 3;
|
|
95
|
-
if (percentage >= 50 && percentage <= 75) {
|
|
96
|
-
responsiveWidth = `50%`;
|
|
97
|
-
}
|
|
98
|
-
else if (percentage > 75) {
|
|
99
|
-
responsiveWidth = `100%`;
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
responsiveWidth = `min(${percentage}%, 100%)`;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
responsiveWidth = `min(${width}, 100%)`;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
responsiveWidth = `min(calc(${width} + ${_columnGap}), 100%)`;
|
|
111
|
-
}
|
|
79
|
+
const isViewportPhone = (0, hooks_1.useMediaQuery)("(max-width: 420px)"); //TODO useContainerQuery
|
|
80
|
+
const isViewportTablet = (0, hooks_1.useMediaQuery)("(max-width: 800px)");
|
|
112
81
|
const outerWrapperStyle = {
|
|
113
82
|
minWidth,
|
|
114
83
|
maxWidth,
|
|
115
|
-
width:
|
|
84
|
+
width: isWidthPercentage
|
|
85
|
+
? `min(${width} * ${isViewportPhone ? "8" : isViewportTablet ? "4" : "1"}, 100%)`
|
|
86
|
+
: `min(calc(${width} + ${_columnGap}), 100%)`,
|
|
116
87
|
paddingBottom: rowGap,
|
|
117
88
|
flex,
|
|
118
89
|
};
|
|
@@ -19,14 +19,13 @@ exports.FooterMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
19
19
|
limitThemeVarsToComponent: true,
|
|
20
20
|
defaultThemeVars: {
|
|
21
21
|
[`backgroundColor-${COMP}`]: "$backgroundColor-AppHeader",
|
|
22
|
-
[`
|
|
22
|
+
[`verticalAlign-${COMP}`]: "center",
|
|
23
23
|
[`fontSize-${COMP}`]: "$fontSize-small",
|
|
24
24
|
[`textColor-${COMP}`]: "$textColor-secondary",
|
|
25
25
|
[`maxWidth-content-${COMP}`]: "$maxWidth-content",
|
|
26
26
|
[`borderTop-${COMP}`]: `1px solid $borderColor`,
|
|
27
27
|
[`padding-${COMP}`]: "$space-2 $space-4",
|
|
28
28
|
[`gap-${COMP}`]: "$space-normal",
|
|
29
|
-
[`margin-${COMP}`]: `0 auto`,
|
|
30
29
|
light: {
|
|
31
30
|
// --- No light-specific theme vars
|
|
32
31
|
},
|
|
@@ -79,16 +79,12 @@ exports.FormMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
79
79
|
description: "This property sets the HTTP method to use when submitting the form data. If not " +
|
|
80
80
|
"defined, `put` is used when the form has initial data; otherwise, `post`.",
|
|
81
81
|
},
|
|
82
|
-
inProgressNotificationMessage: (0, ComponentDefs_1.d)("This property sets the message to display when the form is being submitted."),
|
|
83
|
-
completedNotificationMessage: (0, ComponentDefs_1.d)("This property sets the message to display when the form is submitted successfully."),
|
|
84
|
-
errorNotificationMessage: (0, ComponentDefs_1.d)("This property sets the message to display when the form submission fails."),
|
|
85
82
|
enabled: (0, metadata_helpers_1.dEnabled)(),
|
|
86
83
|
_data_url: (0, metadata_helpers_1.dInternal)("when we have an api bound data prop, we inject the url here"),
|
|
87
84
|
},
|
|
88
85
|
events: {
|
|
89
86
|
submit: (0, ComponentDefs_1.d)(`The form infrastructure fires this event when the form is submitted. The event argument ` +
|
|
90
87
|
`is the current \`data\` value to save.`),
|
|
91
|
-
success: (0, ComponentDefs_1.d)("The form infrastructure fires this event when the form is submitted successfully."),
|
|
92
88
|
cancel: (0, ComponentDefs_1.d)(`The form infrastructure fires this event when the form is canceled.`),
|
|
93
89
|
reset: (0, ComponentDefs_1.d)(`The form infrastructure fires this event when the form is reset.`),
|
|
94
90
|
},
|
|
@@ -181,7 +181,7 @@ function cleanUpSubject(subject) {
|
|
|
181
181
|
return acc;
|
|
182
182
|
}, {});
|
|
183
183
|
}
|
|
184
|
-
const Form = (0, react_1.forwardRef)(function ({ formState, dispatch, initialValue = constants_1.EMPTY_OBJECT, children, style, enabled = true, cancelLabel = exports.defaultProps.cancelLabel, saveLabel = exports.defaultProps.saveLabel, saveInProgressLabel = exports.defaultProps.saveInProgressLabel, swapCancelAndSave, onSubmit, onCancel, onReset,
|
|
184
|
+
const Form = (0, react_1.forwardRef)(function ({ formState, dispatch, initialValue = constants_1.EMPTY_OBJECT, children, style, enabled = true, cancelLabel = exports.defaultProps.cancelLabel, saveLabel = exports.defaultProps.saveLabel, saveInProgressLabel = exports.defaultProps.saveInProgressLabel, swapCancelAndSave, onSubmit, onCancel, onReset, buttonRow, id, registerComponentApi, itemLabelBreak = exports.defaultProps.itemLabelBreak, itemLabelWidth, itemLabelPosition = exports.defaultProps.itemLabelPosition, keepModalOpenOnSubmit = exports.defaultProps.keepModalOpenOnSubmit, }, ref) {
|
|
185
185
|
const formRef = (0, react_1.useRef)(null);
|
|
186
186
|
(0, react_1.useImperativeHandle)(ref, () => formRef.current);
|
|
187
187
|
const [confirmSubmitModalVisible, setConfirmSubmitModalVisible] = (0, react_1.useState)(false);
|
|
@@ -234,11 +234,10 @@ const Form = (0, react_1.forwardRef)(function ({ formState, dispatch, initialVal
|
|
|
234
234
|
dispatch((0, formActions_1.formSubmitting)());
|
|
235
235
|
try {
|
|
236
236
|
const filteredSubject = cleanUpSubject(formState.subject);
|
|
237
|
-
|
|
238
|
-
passAsDefaultBody: true
|
|
237
|
+
yield (onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(filteredSubject, {
|
|
238
|
+
passAsDefaultBody: true,
|
|
239
239
|
}));
|
|
240
240
|
dispatch((0, formActions_1.formSubmitted)());
|
|
241
|
-
yield (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(result));
|
|
242
241
|
if (!keepModalOpenOnSubmit) {
|
|
243
242
|
requestModalFormClose();
|
|
244
243
|
}
|
|
@@ -349,14 +348,11 @@ function FormWithContextVar({ node, renderChild, extractValue, style, lookupEven
|
|
|
349
348
|
}, [$data, node.children]);
|
|
350
349
|
const initialValue = extractValue(node.props.data);
|
|
351
350
|
const submitMethod = extractValue.asOptionalString(node.props.submitMethod) || (initialValue ? "put" : "post");
|
|
352
|
-
const inProgressNotificationMessage = extractValue.asOptionalString(node.props.inProgressNotificationMessage) || "";
|
|
353
|
-
const completedNotificationMessage = extractValue.asOptionalString(node.props.completedNotificationMessage) || "";
|
|
354
|
-
const errorNotificationMessage = extractValue.asOptionalString(node.props.errorNotificationMessage) || "";
|
|
355
351
|
const submitUrl = extractValue.asOptionalString(node.props.submitUrl) ||
|
|
356
352
|
extractValue.asOptionalString(node.props._data_url);
|
|
357
353
|
return ((0, jsx_runtime_1.jsx)(Form, { keepModalOpenOnSubmit: extractValue.asOptionalBoolean(node.props.keepModalOpenOnSubmit), itemLabelPosition: extractValue.asOptionalString(node.props.itemLabelPosition), itemLabelBreak: extractValue.asOptionalBoolean(node.props.itemLabelBreak), itemLabelWidth: extractValue.asOptionalString(node.props.itemLabelWidth), formState: formState, dispatch: dispatch, id: node.uid, style: style, cancelLabel: extractValue(node.props.cancelLabel), saveLabel: extractValue(node.props.saveLabel), saveInProgressLabel: extractValue(node.props.saveInProgressLabel), swapCancelAndSave: extractValue.asOptionalBoolean(node.props.swapCancelAndSave, false), onSubmit: lookupEventHandler("submit", {
|
|
358
354
|
defaultHandler: submitUrl
|
|
359
|
-
? `(eventArgs)=> Actions.callApi({ url: "${submitUrl}", method: "${submitMethod}", body: eventArgs
|
|
355
|
+
? `(eventArgs)=> Actions.callApi({ url: "${submitUrl}", method: "${submitMethod}", body: eventArgs })`
|
|
360
356
|
: undefined,
|
|
361
357
|
context: {
|
|
362
358
|
$data,
|
|
@@ -369,10 +365,6 @@ function FormWithContextVar({ node, renderChild, extractValue, style, lookupEven
|
|
|
369
365
|
context: {
|
|
370
366
|
$data,
|
|
371
367
|
},
|
|
372
|
-
}), onSuccess: lookupEventHandler("success", {
|
|
373
|
-
context: {
|
|
374
|
-
$data,
|
|
375
|
-
},
|
|
376
368
|
}), initialValue: initialValue, buttonRow: renderChild(node.props.buttonRowTemplate), registerComponentApi: registerComponentApi, enabled: extractValue.asOptionalBoolean(node.props.enabled, true) &&
|
|
377
369
|
!extractValue.asOptionalBoolean(node.props.loading, false), children: renderChild(nodeWithItem) }));
|
|
378
370
|
}
|
|
@@ -31,7 +31,7 @@ exports.ItemWithLabel = (0, react_1.forwardRef)(function ItemWithLabel({ id, lab
|
|
|
31
31
|
[FormItem_module_scss_1.default.start]: labelPosition === "start",
|
|
32
32
|
[FormItem_module_scss_1.default.end]: labelPosition === "end",
|
|
33
33
|
[FormItem_module_scss_1.default.shrinkToLabel]: shrinkToLabel,
|
|
34
|
-
}), children: [label && ((0, jsx_runtime_1.jsxs)("label", { htmlFor: inputId, onClick: () =>
|
|
34
|
+
}), children: [label && ((0, jsx_runtime_1.jsxs)("label", { htmlFor: inputId, onClick: () => document.getElementById(inputId).focus(), style: Object.assign(Object.assign({}, labelStyle), { width: labelWidth && numberRegex.test(labelWidth) ? `${labelWidth}px` : labelWidth, flexShrink: labelWidth !== undefined ? 0 : undefined }), className: (0, classnames_1.default)(FormItem_module_scss_1.default.inputLabel, {
|
|
35
35
|
[FormItem_module_scss_1.default.required]: required,
|
|
36
36
|
[FormItem_module_scss_1.default.disabled]: !enabled,
|
|
37
37
|
[FormItem_module_scss_1.default.labelBreak]: labelBreak,
|
|
@@ -33,52 +33,7 @@ exports.LinkNative = (0, react_1.forwardRef)(function LinkNative(props, forwarde
|
|
|
33
33
|
return (0, component_utils_1.createUrlWithQueryParams)(to);
|
|
34
34
|
}, [to]);
|
|
35
35
|
const Node = !to ? "div" : react_2.Link;
|
|
36
|
-
|
|
37
|
-
const isHashLink = typeof to === 'string' && to.startsWith('#');
|
|
38
|
-
const FinalNode = isHashLink ? "a" : Node;
|
|
39
|
-
// Handle hash navigation for same-page scrolling
|
|
40
|
-
const handleClick = (0, react_1.useCallback)((event) => {
|
|
41
|
-
const toUrl = typeof to === 'string' ? to : to === null || to === void 0 ? void 0 : to.pathname;
|
|
42
|
-
// Check if this is a hash link (starts with #)
|
|
43
|
-
if (toUrl && toUrl.startsWith('#')) {
|
|
44
|
-
const targetId = toUrl.substring(1);
|
|
45
|
-
const currentHash = window.location.hash;
|
|
46
|
-
// Always prevent default for hash links and handle manually
|
|
47
|
-
event.preventDefault();
|
|
48
|
-
const targetElement = document.getElementById(targetId);
|
|
49
|
-
if (targetElement) {
|
|
50
|
-
targetElement.scrollIntoView();
|
|
51
|
-
// Build the new URL with existing hash route + fragment
|
|
52
|
-
const currentUrl = window.location.href;
|
|
53
|
-
const baseUrl = currentUrl.split('#')[0]; // Get everything before the first #
|
|
54
|
-
const existingHash = window.location.hash; // Current hash (e.g., #/about)
|
|
55
|
-
let newUrl;
|
|
56
|
-
if (existingHash && existingHash !== toUrl) {
|
|
57
|
-
// If there's an existing hash route, append the fragment to it
|
|
58
|
-
if (existingHash.includes('/#')) {
|
|
59
|
-
// Remove any existing fragment and add the new one
|
|
60
|
-
const hashRoute = existingHash.split('/#')[0];
|
|
61
|
-
newUrl = `${baseUrl}${hashRoute}/${toUrl}`;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
// Just append the fragment to the existing hash
|
|
65
|
-
newUrl = `${baseUrl}${existingHash}/${toUrl}`;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
// No existing hash or same fragment, just use the fragment
|
|
70
|
-
newUrl = `${baseUrl}${toUrl}`;
|
|
71
|
-
}
|
|
72
|
-
window.history.pushState(null, '', newUrl);
|
|
73
|
-
}
|
|
74
|
-
// Call the original onClick if provided
|
|
75
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
// For all other cases, call the original onClick
|
|
79
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
80
|
-
}, [to, onClick]);
|
|
81
|
-
return ((0, jsx_runtime_1.jsxs)(FinalNode, Object.assign({ ref: forwardedRef, to: isHashLink ? undefined : smartTo, href: isHashLink ? to : undefined, style: style, target: target, onClick: handleClick, className: (0, classnames_1.default)(Link_module_scss_1.default.container, {
|
|
36
|
+
return ((0, jsx_runtime_1.jsxs)(Node, Object.assign({ ref: forwardedRef, to: smartTo, style: style, target: target, onClick: onClick, className: (0, classnames_1.default)(Link_module_scss_1.default.container, {
|
|
82
37
|
[Link_module_scss_1.default.iconLink]: iconLink,
|
|
83
38
|
[Link_module_scss_1.default.active]: active,
|
|
84
39
|
[Link_module_scss_1.default.disabled]: disabled,
|
|
@@ -50,7 +50,7 @@ exports.MarkdownMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
50
50
|
"backgroundColor-Admonition-danger": "$color-danger-100",
|
|
51
51
|
"borderColor-Admonition-danger": "$color-danger-300",
|
|
52
52
|
"borderRadius-Admonition": "$space-2",
|
|
53
|
-
"
|
|
53
|
+
"iconSize-Admonition": "$space-5",
|
|
54
54
|
"paddingLeft-Admonition": "$space-2",
|
|
55
55
|
"paddingRight-Admonition": "$space-6",
|
|
56
56
|
"paddingTop-Admonition": "$space-3",
|
|
@@ -64,8 +64,8 @@ exports.MarkdownMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
64
64
|
"paddingTop-Blockquote": "$space-3",
|
|
65
65
|
"paddingBottom-Blockquote": "$space-2_5",
|
|
66
66
|
"backgroundColor-Blockquote": "$color-surface-100",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
67
|
+
"accentWidth-Blockquote": "3px",
|
|
68
|
+
"accentColor-Blockquote": "$color-surface-500",
|
|
69
69
|
"marginTop-HtmlLi": "$space-2_5",
|
|
70
70
|
"marginBottom-HtmlLi": "$space-2_5",
|
|
71
71
|
"marginTop-Image-markdown": "$space-4",
|
|
@@ -232,14 +232,15 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = exports
|
|
|
232
232
|
return (0, jsx_runtime_1.jsx)("tfoot", { className: HtmlTags_module_scss_1.default.htmlTfoot, children: children });
|
|
233
233
|
},
|
|
234
234
|
samp(_a) {
|
|
235
|
-
var _b
|
|
235
|
+
var _b;
|
|
236
236
|
var props = __rest(_a, []);
|
|
237
|
+
const nestedProps = props;
|
|
237
238
|
const markdownContentBase64 = props === null || props === void 0 ? void 0 : props["data-pg-markdown"];
|
|
238
239
|
const markdownContent = markdownContentBase64 ? atob(markdownContentBase64) : "";
|
|
239
240
|
const dataContentBase64 = props === null || props === void 0 ? void 0 : props["data-pg-content"];
|
|
240
241
|
const jsonContent = atob(dataContentBase64);
|
|
241
242
|
const appProps = JSON.parse(jsonContent);
|
|
242
|
-
return ((0, jsx_runtime_1.jsx)(AppWithCodeViewNative_1.default, { markdown: markdownContent, app: appProps.app, config: appProps.config, components: appProps.components, api: appProps.api, activeTheme: appProps.activeTheme, activeTone: appProps.activeTone, title: appProps.name, height: appProps.height, allowPlaygroundPopup: !appProps.noPopup, withFrame: appProps.noFrame ? false : true,
|
|
243
|
+
return ((0, jsx_runtime_1.jsx)(AppWithCodeViewNative_1.default, { markdown: markdownContent, app: appProps.app, config: appProps.config, components: appProps.components, api: appProps.api, activeTheme: appProps.activeTheme, activeTone: appProps.activeTone, title: appProps.name, height: appProps.height, allowPlaygroundPopup: !appProps.noPopup, withFrame: appProps.noFrame ? false : true, sideBySide: (_b = appProps.sideBySide) !== null && _b !== void 0 ? _b : false }));
|
|
243
244
|
},
|
|
244
245
|
section(_a) {
|
|
245
246
|
var { children } = _a, props = __rest(_a, ["children"]);
|