xmlui 0.9.2 → 0.9.4

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.
@@ -33,7 +33,7 @@ const AppHeaderNative_1 = require("../../components/AppHeader/AppHeaderNative");
33
33
  const AppLayoutContext_1 = require("./AppLayoutContext");
34
34
  function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollbarGutters = false, onReady = lodash_es_1.noop, header, navPanel, footer, navPanelDef, logoContentDef, logo, logoDark, logoLight, defaultTone, defaultTheme, renderChild, name, }) {
35
35
  const { getThemeVar } = (0, ThemeContext_1.useTheme)();
36
- const { setActiveThemeTone, setActiveThemeId } = (0, ThemeContext_1.useThemes)();
36
+ const { setActiveThemeTone, setActiveThemeId, themes } = (0, ThemeContext_1.useThemes)();
37
37
  const mounted = (0, react_1.useRef)(false);
38
38
  const layoutWithDefaultValue = layout || getThemeVar("layout-App") || "condensed-sticky";
39
39
  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 (-).
@@ -60,7 +60,7 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
60
60
  return () => {
61
61
  mounted.current = false;
62
62
  };
63
- }, [defaultTone, defaultTheme, setActiveThemeTone, setActiveThemeId]);
63
+ }, [defaultTone, defaultTheme, setActiveThemeTone, setActiveThemeId, themes]);
64
64
  (0, react_1.useEffect)(() => {
65
65
  onReady();
66
66
  }, [onReady]);
@@ -338,12 +338,17 @@ exports.HtmlDetailsMd = (0, ComponentDefs_1.createMetadata)({
338
338
  props: {
339
339
  open: (0, ComponentDefs_1.d)("Specifies that the details are visible (open)"),
340
340
  },
341
+ themeVars: (0, themeVars_1.parseScssVar)(HtmlTags_module_scss_1.default.themeVarsDetails),
342
+ defaultThemeVars: {
343
+ "marginTop-HtmlDetails": "1rem",
344
+ "marginBottom-HtmlDetails": "1rem",
345
+ }
341
346
  });
342
347
  exports.htmlDetailsTagRenderer = (0, renderers_1.createComponentRenderer)("details", exports.HtmlDetailsMd, ({ node, renderChild, extractValue, extractResourceUrl, layoutCss }) => {
343
348
  const p = new extractParam_1.PropsTrasform(extractValue, extractResourceUrl, layoutCss, node.props);
344
349
  const { open } = p.asOptionalBoolean("open");
345
350
  const props = p.asRest();
346
- return ((0, jsx_runtime_1.jsx)("details", Object.assign({ style: layoutCss, open: open !== null && open !== void 0 ? open : false }, props, { children: renderChild(node.children) })));
351
+ return ((0, jsx_runtime_1.jsx)("details", Object.assign({ style: layoutCss, className: HtmlTags_module_scss_1.default.htmlDetails, open: open !== null && open !== void 0 ? open : false }, props, { children: renderChild(node.children) })));
347
352
  });
348
353
  exports.HtmlDfnMd = (0, ComponentDefs_1.createMetadata)({
349
354
  status: "experimental",
@@ -1392,6 +1397,11 @@ exports.HtmlVideoMd = (0, ComponentDefs_1.createMetadata)({
1392
1397
  src: (0, ComponentDefs_1.d)("Specifies the URL of the video file"),
1393
1398
  width: (0, ComponentDefs_1.d)("Specifies the width of the video player"),
1394
1399
  },
1400
+ themeVars: (0, themeVars_1.parseScssVar)(HtmlTags_module_scss_1.default.themeVarsVideo),
1401
+ defaultThemeVars: {
1402
+ "marginTop-HtmlVideo": "1rem",
1403
+ "marginBottom-HtmlVideo": "1rem",
1404
+ },
1395
1405
  });
1396
1406
  exports.htmlVideoTagRenderer = (0, renderers_1.createComponentRenderer)("video", exports.HtmlVideoMd, ({ node, renderChild, extractValue, extractResourceUrl, layoutCss }) => {
1397
1407
  const p = new extractParam_1.PropsTrasform(extractValue, extractResourceUrl, layoutCss, node.props);
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.markdownComponentRenderer = exports.MarkdownMd = void 0;
6
+ exports.Markdown = exports.markdownComponentRenderer = exports.MarkdownMd = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const Markdown_module_scss_1 = __importDefault(require("./Markdown.module.scss"));
9
9
  const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
@@ -12,7 +12,7 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
12
12
  const MarkdownNative_1 = require("./MarkdownNative");
13
13
  const COMP = "Markdown";
14
14
  exports.MarkdownMd = (0, ComponentDefs_1.createMetadata)({
15
- description: `\`${COMP}\` displays plain text styled with markdown syntax.`,
15
+ description: `\`${COMP}\` displays plain text styled using markdown syntax.`,
16
16
  themeVars: (0, themeVars_1.parseScssVar)(Markdown_module_scss_1.default.themeVars),
17
17
  props: {
18
18
  content: (0, ComponentDefs_1.d)("This property sets the markdown content to display."),
@@ -22,19 +22,21 @@ exports.MarkdownMd = (0, ComponentDefs_1.createMetadata)({
22
22
  "indent found at the start of the content lines is removed from the " +
23
23
  "beginning of every line.",
24
24
  valueType: "boolean",
25
- defaultValue: MarkdownNative_1.defaultProps.removeIndents,
25
+ defaultValue: true,
26
26
  },
27
27
  },
28
28
  defaultThemeVars: {
29
- "borderColor-HorizontalRule": "$borderColor",
30
- "borderWidth-HorizontalRule": "1px",
31
- "borderStyle-HorizontalRule": "solid",
32
- "accent-Blockquote": "$color-primary",
33
- "padding-Blockquote": "$space-2 $space-6",
34
- "margin-Blockquote": "$space-2",
35
- "paddingLeft-UnorderedList": "$space-6",
36
- "paddingLeft-OrderedList": "$space-6",
37
- "paddingLeft-ListItem": "$space-1",
29
+ "borderRadius-Admonition": "$space-4",
30
+ "iconSize-Admonition": "1.5rem",
31
+ "padding-Admonition": "1rem",
32
+ "marginBottom-Admonition": "1rem",
33
+ "marginLeft-Admonition-content": ".5rem",
34
+ "accentWidth-Blockquote": "3px",
35
+ "accentColor-Blockquote": "$color-surface-500",
36
+ "padding-Blockquote": ".5rem",
37
+ "marginBottom-Blockquote": "1rem",
38
+ "marginBottom-Text-codefence": ".5rem",
39
+ "marginBottom-Text-markdown": ".5rem",
38
40
  light: {
39
41
  // --- No light-specific theme vars
40
42
  },
@@ -63,5 +65,7 @@ exports.markdownComponentRenderer = (0, renderers_1.createComponentRenderer)(COM
63
65
  }
64
66
  });
65
67
  }
66
- return ((0, jsx_runtime_1.jsx)(MarkdownNative_1.Markdown, { style: layoutCss, removeIndents: extractValue.asOptionalBoolean(node.props.removeIndents, MarkdownNative_1.defaultProps.removeIndents), extractValue: extractValue, children: renderedChildren }));
68
+ return ((0, jsx_runtime_1.jsx)(MarkdownNative_1.Markdown, { style: layoutCss, removeIndents: extractValue.asOptionalBoolean(node.props.removeIndents, true), extractValue: extractValue, children: renderedChildren }));
67
69
  });
70
+ var MarkdownNative_2 = require("./MarkdownNative");
71
+ Object.defineProperty(exports, "Markdown", { enumerable: true, get: function () { return MarkdownNative_2.Markdown; } });
@@ -1,51 +1,69 @@
1
1
  "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Markdown = exports.defaultProps = void 0;
17
+ exports.Markdown = void 0;
7
18
  const jsx_runtime_1 = require("react/jsx-runtime");
8
19
  const react_1 = require("react");
9
20
  const react_2 = __importDefault(require("react"));
10
21
  const react_markdown_1 = __importDefault(require("react-markdown"));
11
22
  const remark_gfm_1 = __importDefault(require("remark-gfm"));
23
+ const rehype_raw_1 = __importDefault(require("rehype-raw"));
12
24
  const unist_util_visit_1 = require("unist-util-visit");
13
25
  const Markdown_module_scss_1 = __importDefault(require("./Markdown.module.scss"));
14
26
  const HtmlTags_module_scss_1 = __importDefault(require("../HtmlTags/HtmlTags.module.scss"));
27
+ const HeadingNative_1 = require("../Heading/HeadingNative");
15
28
  const TextNative_1 = require("../Text/TextNative");
16
29
  const LinkNative_1 = require("../Link/LinkNative");
17
30
  const ImageNative_1 = require("../Image/ImageNative");
18
31
  const Toggle_1 = require("../Toggle/Toggle");
19
32
  const ScriptingSourceTree_1 = require("../../abstractions/scripting/ScriptingSourceTree");
20
- exports.defaultProps = {
21
- removeIndents: true,
22
- };
23
- exports.Markdown = (0, react_1.memo)(function Markdown({ extractValue, removeIndents = exports.defaultProps.removeIndents, children, style, }) {
33
+ exports.Markdown = (0, react_1.memo)(function Markdown({ extractValue, removeIndents = true, children, style, }) {
24
34
  if (typeof children !== "string") {
25
35
  return null;
26
36
  }
27
- const _children = removeIndents ? removeTextIndents(children) : children;
28
- return ((0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.markdownContent, style: Object.assign({}, style), children: (0, jsx_runtime_1.jsx)(react_markdown_1.default, { remarkPlugins: [remark_gfm_1.default, [bindingExpression, { extractValue }]], components: {
37
+ children = removeIndents ? removeTextIndents(children) : children;
38
+ return ((0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.markdownContent, style: Object.assign({}, style), children: (0, jsx_runtime_1.jsx)(react_markdown_1.default, { remarkPlugins: [remark_gfm_1.default, [bindingExpression, { extractValue }]], rehypePlugins: [rehype_raw_1.default], components: {
39
+ details(_a) {
40
+ var { children, node } = _a, props = __rest(_a, ["children", "node"]);
41
+ return (0, jsx_runtime_1.jsx)("details", Object.assign({ className: HtmlTags_module_scss_1.default.htmlDetails }, props, { children: children }));
42
+ },
43
+ video(_a) {
44
+ var { children, node } = _a, props = __rest(_a, ["children", "node"]);
45
+ return (0, jsx_runtime_1.jsx)("video", Object.assign({ className: HtmlTags_module_scss_1.default.htmlVideo }, props, { children: children }));
46
+ },
29
47
  h1({ children }) {
30
- return (0, jsx_runtime_1.jsx)("h1", { className: HtmlTags_module_scss_1.default.htmlH1, children: children });
48
+ return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h1", children: children });
31
49
  },
32
50
  h2({ children }) {
33
- return (0, jsx_runtime_1.jsx)("h2", { className: HtmlTags_module_scss_1.default.htmlH2, children: children });
51
+ return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h2", children: children });
34
52
  },
35
53
  h3({ children }) {
36
- return (0, jsx_runtime_1.jsx)("h3", { className: HtmlTags_module_scss_1.default.htmlH3, children: children });
54
+ return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h3", children: children });
37
55
  },
38
56
  h4({ children }) {
39
- return (0, jsx_runtime_1.jsx)("h4", { className: HtmlTags_module_scss_1.default.htmlH4, children: children });
57
+ return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h4", children: children });
40
58
  },
41
59
  h5({ children }) {
42
- return (0, jsx_runtime_1.jsx)("h5", { className: HtmlTags_module_scss_1.default.htmlH5, children: children });
60
+ return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h5", children: children });
43
61
  },
44
62
  h6({ children }) {
45
- return (0, jsx_runtime_1.jsx)("h6", { className: HtmlTags_module_scss_1.default.htmlH6, children: children });
63
+ return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h6", children: children });
46
64
  },
47
65
  p({ id, children }) {
48
- return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, children: children }));
66
+ return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, variant: "markdown", children: children }));
49
67
  },
50
68
  code({ id, children }) {
51
69
  return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, variant: "code", children: children }));
@@ -77,8 +95,10 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ extractValue, removeInd
77
95
  hr() {
78
96
  return (0, jsx_runtime_1.jsx)(HorizontalRule, {});
79
97
  },
80
- a({ href, children }) {
81
- return (0, jsx_runtime_1.jsx)(LinkNative_1.LocalLink, { to: href || "/", children: children });
98
+ a(_a) {
99
+ var { children, href } = _a, props = __rest(_a, ["children", "href"]);
100
+ const allowedProps = ['style', 'disabled', 'active', 'icon', 'onClick'];
101
+ return ((0, jsx_runtime_1.jsx)(LinkNative_1.LocalLink, Object.assign({ to: href }, allowedProps, { children: children })));
82
102
  },
83
103
  img({ src, alt }) {
84
104
  return (0, jsx_runtime_1.jsx)(ImageNative_1.Image, { src: src, alt: alt });
@@ -108,7 +128,7 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ extractValue, removeInd
108
128
  tfoot({ children }) {
109
129
  return (0, jsx_runtime_1.jsx)("tfoot", { className: HtmlTags_module_scss_1.default.htmlTfoot, children: children });
110
130
  },
111
- }, children: _children }) }));
131
+ }, children: children }) }));
112
132
  });
113
133
  function removeTextIndents(input) {
114
134
  if (!input) {
@@ -184,8 +204,7 @@ const Blockquote = ({ children, style }) => {
184
204
  // Render admonition blockquote with the updated structure
185
205
  return ((0, jsx_runtime_1.jsx)("blockquote", { className: Markdown_module_scss_1.default.admonitionBlockquote, style: style, children: (0, jsx_runtime_1.jsxs)("div", { className: Markdown_module_scss_1.default.admonitionContainer, children: [(0, jsx_runtime_1.jsx)("div", { className: `${Markdown_module_scss_1.default.admonitionIcon} ${Markdown_module_scss_1.default[type] || ''}`, children: emojiMap[type] || '💡' }), (0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.admonitionContent, children: processedChildren })] }) }));
186
206
  }
187
- // Render regular blockquote
188
- return ((0, jsx_runtime_1.jsx)("blockquote", { className: Markdown_module_scss_1.default.blockquote, style: style, children: children }));
207
+ return ((0, jsx_runtime_1.jsx)("blockquote", { className: Markdown_module_scss_1.default.blockquote, style: style, children: (0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.blockquoteContainer, children: children }) }));
189
208
  };
190
209
  const UnorderedList = ({ children, style }) => {
191
210
  return ((0, jsx_runtime_1.jsx)("ul", { className: Markdown_module_scss_1.default.unorderedList, style: style, children: children }));
@@ -32,7 +32,9 @@ exports.SliderMd = (0, ComponentDefs_1.createMetadata)({
32
32
  readOnly: (0, metadata_helpers_1.dReadonly)(),
33
33
  validationStatus: (0, metadata_helpers_1.dValidationStatus)(),
34
34
  rangeStyle: (0, ComponentDefs_1.d)(`This property allows you to apply custom styles to the range element of the slider.`),
35
- thumbStyle: (0, ComponentDefs_1.d)(`This property allows yout top apply custom styles to the thumb elements of the slider.`)
35
+ thumbStyle: (0, ComponentDefs_1.d)(`This property allows you to apply custom styles to the thumb elements of the slider.`),
36
+ showValues: (0, ComponentDefs_1.d)(`This property controls whether the slider shows the current values of the thumbs.`, null, "boolean", true),
37
+ valueFormat: (0, ComponentDefs_1.d)(`This property allows you to customize how the values are displayed.`, null, "any")
36
38
  },
37
39
  events: {
38
40
  didChange: (0, metadata_helpers_1.dDidChange)(COMP),
@@ -53,11 +55,28 @@ exports.SliderMd = (0, ComponentDefs_1.createMetadata)({
53
55
  [`borderColor-thumb-${COMP}`]: "$color-surface-50",
54
56
  [`backgroundColor-thumb-${COMP}`]: "$color-primary",
55
57
  [`boxShadow-thumb-${COMP}`]: "$boxShadow-md",
56
- [`backgroundColor-track-${COMP}--disabled`]: "$color-surface-300",
57
- [`backgroundColor-range-${COMP}--disabled`]: "$color-surface-400",
58
+ [`boxShadow-thumb-${COMP}--hover`]: "$boxShadow-lg",
59
+ [`boxShadow-thumb-${COMP}--focus`]: "$boxShadow-xl",
60
+ [`borderRadius-${COMP}-default`]: "$borderRadius",
61
+ [`borderColor-${COMP}-default`]: "transparent",
62
+ [`borderWidth-${COMP}-default`]: "0",
63
+ [`borderStyle-${COMP}-default`]: "solid",
64
+ [`boxShadow-${COMP}-default`]: "none",
65
+ light: {
66
+ [`backgroundColor-track-${COMP}--disabled`]: "$color-surface-300",
67
+ [`backgroundColor-range-${COMP}--disabled`]: "$color-surface-400",
68
+ [`backgroundColor-thumb-${COMP}`]: "$color-primary-500",
69
+ [`borderColor-thumb-${COMP}`]: "$color-surface-50",
70
+ },
71
+ dark: {
72
+ [`backgroundColor-track-${COMP}--disabled`]: "$color-surface-600",
73
+ [`backgroundColor-range-${COMP}--disabled`]: "$color-surface-800",
74
+ [`backgroundColor-thumb-${COMP}`]: "$color-primary-400",
75
+ [`borderColor-thumb-${COMP}`]: "$color-surface-950",
76
+ },
58
77
  },
59
78
  });
60
- exports.sliderComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SliderMd, ({ node, extractValue, lookupEventHandler, layoutCss, updateState, state, registerComponentApi, }) => {
61
- var _a, _b, _c, _d, _e, _f, _g;
62
- return ((0, jsx_runtime_1.jsx)(SliderNative_1.Slider, { validationStatus: extractValue(node.props.validationStatus), minStepsBetweenThumbs: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.minStepsBetweenThumbs), value: state.value, initialValue: extractValue(node.props.initialValue), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, style: layoutCss, step: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.step), min: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.minValue), max: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.maxValue), enabled: extractValue.asOptionalBoolean((_e = node.props) === null || _e === void 0 ? void 0 : _e.enabled), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), label: extractValue.asOptionalString(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue.asOptionalString(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), rangeStyle: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.rangeStyle), thumbStyle: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.thumbStyle) }));
79
+ exports.sliderComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SliderMd, ({ node, extractValue, lookupEventHandler, lookupSyncCallback, layoutCss, updateState, state, registerComponentApi, }) => {
80
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
81
+ return ((0, jsx_runtime_1.jsx)(SliderNative_1.Slider, { validationStatus: extractValue(node.props.validationStatus), minStepsBetweenThumbs: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.minStepsBetweenThumbs), value: state.value, initialValue: extractValue(node.props.initialValue), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, style: layoutCss, step: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.step), min: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.minValue), max: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.maxValue), enabled: extractValue.asOptionalBoolean((_e = node.props) === null || _e === void 0 ? void 0 : _e.enabled), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), label: extractValue.asOptionalString(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue.asOptionalString(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), rangeStyle: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.rangeStyle), thumbStyle: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.thumbStyle), showValues: extractValue.asOptionalBoolean((_h = node.props) === null || _h === void 0 ? void 0 : _h.showValues), valueFormat: lookupSyncCallback((_j = node.props) === null || _j === void 0 ? void 0 : _j.valueFormat) }));
63
82
  });
@@ -46,33 +46,80 @@ const constants_1 = require("../../components-core/constants");
46
46
  const misc_1 = require("../../components-core/utils/misc");
47
47
  const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
48
48
  const classnames_1 = __importDefault(require("classnames"));
49
- exports.Slider = (0, react_2.forwardRef)(({ style, step = 1, min, max, inverted, updateState, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, enabled = true, value, autoFocus, readOnly, tabIndex = -1, label, labelPosition, labelWidth, labelBreak, required, validationStatus = "none", initialValue, minStepsBetweenThumbs, rangeStyle, thumbStyle, }, forwardedRef) => {
49
+ // Helper function to ensure value is properly formatted
50
+ const formatValue = (val, defaultVal = 0) => {
51
+ if (val === undefined) {
52
+ return [defaultVal];
53
+ }
54
+ if (typeof val === "number") {
55
+ return [val];
56
+ }
57
+ if (Array.isArray(val) && val.length > 0) {
58
+ return val;
59
+ }
60
+ return [defaultVal];
61
+ };
62
+ exports.Slider = (0, react_2.forwardRef)(({ style, step = 1, min = 0, max = 10, inverted, updateState, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, enabled = true, value, autoFocus, readOnly, tabIndex = -1, label, labelPosition, labelWidth, labelBreak, required, validationStatus = "none", initialValue, minStepsBetweenThumbs, rangeStyle, thumbStyle, showValues = true, valueFormat = (value) => value.toString(), }, forwardedRef) => {
50
63
  const inputRef = (0, react_1.useRef)(null);
64
+ // Initialize localValue properly
51
65
  const [localValue, setLocalValue] = react_1.default.useState([]);
66
+ // Process initialValue on mount
52
67
  (0, react_1.useEffect)(() => {
53
- if (typeof value === "object") {
54
- setLocalValue(value);
68
+ let initialVal;
69
+ if (typeof initialValue === "string") {
70
+ try {
71
+ // Try to parse as JSON first (for arrays)
72
+ initialVal = JSON.parse(initialValue);
73
+ }
74
+ catch (e) {
75
+ // If not JSON, try to parse as number
76
+ const num = parseFloat(initialValue);
77
+ if (!isNaN(num)) {
78
+ initialVal = num;
79
+ }
80
+ }
55
81
  }
56
- else if (typeof value === "number") {
57
- setLocalValue([value]);
82
+ else {
83
+ initialVal = initialValue;
58
84
  }
59
- }, [value]);
85
+ // Format the value properly
86
+ const formattedValue = formatValue(initialVal, min);
87
+ setLocalValue(formattedValue);
88
+ // Notify parent component
89
+ if (updateState) {
90
+ updateState({
91
+ value: formattedValue.length === 1 ? formattedValue[0] : formattedValue
92
+ }, { initial: true });
93
+ }
94
+ }, [initialValue, min, updateState]);
95
+ // Sync with external value changes
60
96
  (0, react_1.useEffect)(() => {
61
- updateState({ value: initialValue }, { initial: true });
62
- }, [initialValue, updateState]);
97
+ if (value !== undefined) {
98
+ const formattedValue = formatValue(value, min);
99
+ setLocalValue(formattedValue);
100
+ }
101
+ }, [value, min]);
63
102
  const updateValue = (0, react_1.useCallback)((value) => {
64
- updateState({ value });
103
+ if (updateState) {
104
+ updateState({ value });
105
+ }
106
+ // Call onDidChange without extra arguments to maintain type compatibility
65
107
  onDidChange(value);
66
108
  }, [onDidChange, updateState]);
67
109
  const onInputChange = (0, react_1.useCallback)((value) => {
110
+ setLocalValue(value);
111
+ // 👇 Force the DOM element to reflect the latest value synchronously
112
+ if (inputRef.current) {
113
+ inputRef.current.value = value;
114
+ }
68
115
  if (value.length > 1) {
69
- updateValue(value);
116
+ updateValue(value); // calls updateState + onDidChange
70
117
  }
71
118
  else if (value.length === 1) {
72
119
  updateValue(value[0]);
73
120
  }
74
121
  }, [updateValue]);
75
- // --- Manage obtaining and losing the focus
122
+ // Component APIs
76
123
  const handleOnFocus = (0, react_1.useCallback)(() => {
77
124
  onFocus === null || onFocus === void 0 ? void 0 : onFocus();
78
125
  }, [onFocus]);
@@ -92,12 +139,25 @@ exports.Slider = (0, react_2.forwardRef)(({ style, step = 1, min, max, inverted,
92
139
  setValue,
93
140
  });
94
141
  }, [focus, registerComponentApi, setValue]);
95
- return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, ref: forwardedRef, children: (0, jsx_runtime_1.jsxs)(react_slider_1.Root, { minStepsBetweenThumbs: minStepsBetweenThumbs, ref: inputRef, tabIndex: tabIndex, "aria-readonly": readOnly, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderRoot), style: style, max: max, min: min, inverted: inverted, step: step, disabled: !enabled, onFocus: handleOnFocus, onBlur: handleOnBlur, onValueChange: onInputChange, "aria-required": required, value: localValue, autoFocus: autoFocus, children: [(0, jsx_runtime_1.jsx)(react_slider_1.Track, { className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderTrack, {
96
- [Slider_module_scss_1.default.disabled]: !enabled,
97
- [Slider_module_scss_1.default.readOnly]: readOnly,
98
- [Slider_module_scss_1.default.error]: validationStatus === "error",
99
- [Slider_module_scss_1.default.warning]: validationStatus === "warning",
100
- [Slider_module_scss_1.default.valid]: validationStatus === "valid",
101
- }), children: (0, jsx_runtime_1.jsx)(react_slider_1.Range, { className: Slider_module_scss_1.default.sliderRange, style: rangeStyle }) }), localValue === null || localValue === void 0 ? void 0 : localValue.map((_, index) => ((0, jsx_runtime_1.jsx)(react_slider_1.Thumb, { className: Slider_module_scss_1.default.sliderThumb, style: thumbStyle }, index)))] }) }));
142
+ // Ensure we always have at least one thumb
143
+ const displayValue = localValue.length > 0 ? localValue : [min];
144
+ // Format the current values as a string
145
+ const valuesText = displayValue.map(v => valueFormat(v)).join(', ');
146
+ // Create a custom label that includes the current values
147
+ const displayLabel = label ? (showValues ? `${label} ${valuesText}` : label) : (showValues ? valuesText : '');
148
+ return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { labelPosition: labelPosition, label: displayLabel, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, ref: forwardedRef, children: (0, jsx_runtime_1.jsx)("div", { className: Slider_module_scss_1.default.sliderContainer, children: (0, jsx_runtime_1.jsxs)(react_slider_1.Root, { minStepsBetweenThumbs: minStepsBetweenThumbs || 1, ref: inputRef, tabIndex: tabIndex, "aria-readonly": readOnly, className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderRoot, {
149
+ [Slider_module_scss_1.default.disabled]: !enabled,
150
+ [Slider_module_scss_1.default.readOnly]: readOnly
151
+ }), style: style, max: max, min: min, inverted: inverted, step: step, disabled: !enabled, onFocus: handleOnFocus, onBlur: handleOnBlur, onValueChange: onInputChange, "aria-required": required, value: displayValue, autoFocus: autoFocus, children: [(0, jsx_runtime_1.jsx)(react_slider_1.Track, { className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderTrack, {
152
+ [Slider_module_scss_1.default.disabled]: !enabled,
153
+ [Slider_module_scss_1.default.readOnly]: readOnly,
154
+ [Slider_module_scss_1.default.error]: validationStatus === "error",
155
+ [Slider_module_scss_1.default.warning]: validationStatus === "warning",
156
+ [Slider_module_scss_1.default.valid]: validationStatus === "valid",
157
+ }), style: rangeStyle ? Object.assign({}, rangeStyle) : undefined, children: (0, jsx_runtime_1.jsx)(react_slider_1.Range, { className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderRange, {
158
+ [Slider_module_scss_1.default.disabled]: !enabled
159
+ }) }) }), displayValue.map((_, index) => ((0, jsx_runtime_1.jsx)(react_slider_1.Thumb, { className: (0, classnames_1.default)(Slider_module_scss_1.default.sliderThumb, {
160
+ [Slider_module_scss_1.default.disabled]: !enabled
161
+ }), style: thumbStyle ? Object.assign({}, thumbStyle) : undefined }, index)))] }) }) }));
102
162
  });
103
163
  exports.Slider.displayName = react_slider_1.Root.displayName;
@@ -122,7 +122,7 @@ function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 50
122
122
  }, [devToolsEnabled, devToolsSide, devToolsSize]);
123
123
  if (isRoot) {
124
124
  const faviconUrl = getResourceUrl("resource:favicon") || "/resources/favicon.ico";
125
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_helmet_async_1.Helmet, { children: [!!faviconUrl && (0, jsx_runtime_1.jsx)("link", { rel: "icon", type: "image/svg+xml", href: faviconUrl }), fontLinks === null || fontLinks === void 0 ? void 0 : fontLinks.map((fontLink) => (0, jsx_runtime_1.jsx)("link", { href: fontLink, rel: "stylesheet" }, fontLink))] }), (0, jsx_runtime_1.jsx)("style", { type: "text/css", children: `:root {${css}}` }), (0, jsx_runtime_1.jsxs)("div", { style: inspectStyle, id: "_ui-engine-theme-root", className: (0, classnames_1.default)(Theme_module_scss_1.default.baseRootComponent), ref: (el) => {
125
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_helmet_async_1.Helmet, { children: [!!faviconUrl && (0, jsx_runtime_1.jsx)("link", { rel: "icon", type: "image/svg+xml", href: faviconUrl }), fontLinks === null || fontLinks === void 0 ? void 0 : fontLinks.map((fontLink) => (0, jsx_runtime_1.jsx)("link", { href: fontLink, rel: "stylesheet" }, fontLink))] }), (0, jsx_runtime_1.jsx)("style", { type: "text/css", children: `.${className} {${css}}` }), (0, jsx_runtime_1.jsxs)("div", { style: inspectStyle, id: "_ui-engine-theme-root", className: (0, classnames_1.default)(Theme_module_scss_1.default.baseRootComponent, className), ref: (el) => {
126
126
  if (el) {
127
127
  setRoot(el);
128
128
  }
@@ -16,7 +16,7 @@ const classnames_1 = __importDefault(require("classnames"));
16
16
  const ButtonNative_1 = require("../components/Button/ButtonNative");
17
17
  const IconNative_1 = __importDefault(require("../components/Icon/IconNative"));
18
18
  const InspectorButton_module_scss_1 = __importDefault(require("./InspectorButton.module.scss"));
19
- const DevTools_1 = require("./DevTools");
19
+ const DevTools_1 = require("./devtools/DevTools");
20
20
  // --- The context object that is used to store the inspector information.
21
21
  exports.InspectorContext = (0, react_1.createContext)(null);
22
22
  function InspectorProvider({ children, sources, }) {
@@ -115,7 +115,9 @@ class RestApiProxy {
115
115
  //we can't access content-disposition header if it's a CORS request: The suggested workaround was adding Access-Control-Expose-Headers:Content-Disposition to the response header on the server.
116
116
  // more info here: https://github.com/matthew-andrews/isomorphic-fetch/issues/67
117
117
  let fileName = operation.fileName || "unknown";
118
- if (response.headers && response.headers.get && typeof response.headers.get === "function") {
118
+ if (response.headers &&
119
+ response.headers.get &&
120
+ typeof response.headers.get === "function") {
119
121
  const contentDisposition = (_a = response.headers.get("Content-Disposition")) === null || _a === void 0 ? void 0 : _a.toString();
120
122
  if (contentDisposition) {
121
123
  const fileNameMatch = contentDisposition.match(/filename="(.+)"/);
@@ -123,7 +125,9 @@ class RestApiProxy {
123
125
  fileName = fileNameMatch[1];
124
126
  }
125
127
  }
126
- return isAxiosResponse(response) ? response.data : new File([yield response.clone().blob()], fileName);
128
+ return isAxiosResponse(response)
129
+ ? response.data
130
+ : new File([yield response.clone().blob()], fileName);
127
131
  })
128
132
  : undefined,
129
133
  transactionId,
@@ -213,7 +217,8 @@ class RestApiProxy {
213
217
  };
214
218
  (0, process_statement_sync_1.processStatementQueue)([arrowStmt], evalContext);
215
219
  if ((_b = (_a = evalContext.mainThread) === null || _a === void 0 ? void 0 : _a.blocks) === null || _b === void 0 ? void 0 : _b.length) {
216
- return evalContext.mainThread.blocks[evalContext.mainThread.blocks.length - 1].returnValue;
220
+ return evalContext.mainThread.blocks[evalContext.mainThread.blocks.length - 1]
221
+ .returnValue;
217
222
  }
218
223
  return undefined;
219
224
  }
@@ -260,7 +265,7 @@ class RestApiProxy {
260
265
  method: method,
261
266
  headers: aggregatedHeaders,
262
267
  signal: abortSignal,
263
- body: requestBody
268
+ body: requestBody,
264
269
  };
265
270
  if (onUploadProgress) {
266
271
  console.log("Falling back to axios. Reason: onUploadProgress specified");
@@ -300,7 +305,9 @@ class RestApiProxy {
300
305
  //poor man's axios response type guard
301
306
  try {
302
307
  return new EngineError_1.GenericBackendError(this.config.errorResponseTransform
303
- ? this.extractParam(true, this.config.errorResponseTransform, { $response: response.data })
308
+ ? this.extractParam(true, this.config.errorResponseTransform, {
309
+ $response: response.data,
310
+ })
304
311
  : response.data, response.status);
305
312
  }
306
313
  catch (_a) { }
@@ -323,13 +330,16 @@ class RestApiProxy {
323
330
  const conf = (appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) || { apiUrl: "" };
324
331
  const { apiUrl, errorResponseTransform } = conf;
325
332
  this.appContext = appContext;
326
- const xsrfHeaders = {
327
- "X-XSRF-TOKEN": (0, misc_1.readCookie)('XSRF-TOKEN')
328
- };
333
+ const xsrfToken = (0, misc_1.readCookie)("XSRF-TOKEN");
334
+ const xsrfHeaders = xsrfToken
335
+ ? {
336
+ "X-XSRF-TOKEN": (0, misc_1.readCookie)("XSRF-TOKEN"),
337
+ }
338
+ : {};
329
339
  this.config = {
330
340
  apiUrl,
331
341
  errorResponseTransform,
332
- headers: Object.assign(Object.assign({}, (_a = appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) === null || _a === void 0 ? void 0 : _a.headers), xsrfHeaders)
342
+ headers: Object.assign(Object.assign({}, (_a = appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) === null || _a === void 0 ? void 0 : _a.headers), xsrfHeaders),
333
343
  };
334
344
  }
335
345
  generateFullApiUrl(relativePath, queryParams) {