xmlui 0.9.21 → 0.9.25

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 (102) hide show
  1. package/dist/apiInterceptorWorker-CFF3bC6o.mjs +818 -0
  2. package/dist/{index-B3CWFAxa.mjs → index-DtxDGaqF.mjs} +11942 -3291
  3. package/dist/index.css +1301 -564
  4. package/dist/language-server-web-worker.mjs +1 -1
  5. package/dist/language-server.mjs +1 -1
  6. package/dist/lint-CYAUfk0_.mjs +168 -0
  7. package/dist/metadata-utils-CCIMqe69.mjs +466 -0
  8. package/dist/scripts/package.json +252 -0
  9. package/dist/scripts/src/components/App/AppLayoutContext.js +0 -1
  10. package/dist/scripts/src/components/App/AppNative.js +21 -9
  11. package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -1
  12. package/dist/scripts/src/components/AutoComplete/AutoComplete.js +5 -2
  13. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +13 -10
  14. package/dist/scripts/src/components/Bookmark/BookmarkNative.js +5 -1
  15. package/dist/scripts/src/components/CodeBlock/CodeBlock.js +31 -0
  16. package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +82 -0
  17. package/dist/scripts/src/components/ComponentProvider.js +5 -0
  18. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +1 -0
  19. package/dist/scripts/src/components/Form/FormContext.js +5 -4
  20. package/dist/scripts/src/components/Form/FormNative.js +41 -43
  21. package/dist/scripts/src/components/Form/formActions.js +1 -1
  22. package/dist/scripts/src/components/FormItem/FormItem.js +6 -3
  23. package/dist/scripts/src/components/FormItem/FormItemNative.js +56 -15
  24. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +1 -1
  25. package/dist/scripts/src/components/Heading/Heading.js +13 -0
  26. package/dist/scripts/src/components/Heading/HeadingNative.js +1 -1
  27. package/dist/scripts/src/components/HtmlTags/HtmlTags.js +7 -3
  28. package/dist/scripts/src/components/Icon/DarkToLightIcon.js +10 -0
  29. package/dist/scripts/src/components/Icon/LightToDark.js +10 -0
  30. package/dist/scripts/src/components/IconProvider.js +4 -0
  31. package/dist/scripts/src/components/Image/ImageNative.js +1 -1
  32. package/dist/scripts/src/components/Items/ItemsNative.js +8 -6
  33. package/dist/scripts/src/components/Link/Link.js +5 -5
  34. package/dist/scripts/src/components/List/ListNative.js +1 -1
  35. package/dist/scripts/src/components/Markdown/Markdown.js +52 -16
  36. package/dist/scripts/src/components/Markdown/MarkdownNative.js +34 -73
  37. package/dist/scripts/src/components/Markdown/highlight-code.js +160 -0
  38. package/dist/scripts/src/components/Markdown/parse-binding-expr.js +60 -0
  39. package/dist/scripts/src/components/Markdown/utils.js +282 -0
  40. package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +116 -0
  41. package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
  42. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +4 -5
  43. package/dist/scripts/src/components/NestedApp/NestedApp.js +61 -0
  44. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +125 -0
  45. package/dist/scripts/src/components/NestedApp/Tooltip.js +46 -0
  46. package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -1
  47. package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +2 -2
  48. package/dist/scripts/src/components/Option/Option.js +3 -2
  49. package/dist/scripts/src/components/Select/Select.js +5 -3
  50. package/dist/scripts/src/components/Select/SelectNative.js +53 -40
  51. package/dist/scripts/src/components/SelectionStore/SelectionStore.js +1 -1
  52. package/dist/scripts/src/components/Spinner/Spinner.js +0 -1
  53. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +1 -0
  54. package/dist/scripts/src/components/Text/Text.js +12 -1
  55. package/dist/scripts/src/components/Text/TextNative.js +5 -1
  56. package/dist/scripts/src/components/TextBox/TextBox.js +6 -1
  57. package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
  58. package/dist/scripts/src/components/Theme/ThemeNative.js +7 -3
  59. package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +1 -3
  60. package/dist/scripts/src/components-core/RestApiProxy.js +10 -7
  61. package/dist/scripts/src/components-core/TableOfContentsContext.js +1 -1
  62. package/dist/scripts/src/components-core/appContext/date-functions.js +23 -0
  63. package/dist/scripts/src/components-core/appContext/math-function.js +27 -0
  64. package/dist/scripts/src/components-core/appContext/misc-utils.js +13 -0
  65. package/dist/scripts/src/components-core/interception/ApiInterceptor.js +199 -0
  66. package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +94 -0
  67. package/dist/scripts/src/components-core/interception/Backend.js +128 -0
  68. package/dist/scripts/src/components-core/interception/Errors.js +129 -0
  69. package/dist/scripts/src/components-core/interception/InMemoryDb.js +41 -0
  70. package/dist/scripts/src/components-core/interception/IndexedDb.js +207 -0
  71. package/dist/scripts/src/components-core/interception/ReadonlyCollection.js +145 -0
  72. package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
  73. package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +46 -0
  74. package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
  75. package/dist/scripts/src/components-core/rendering/AppContent.js +336 -0
  76. package/dist/scripts/src/components-core/rendering/AppRoot.js +84 -0
  77. package/dist/scripts/src/components-core/rendering/AppWrapper.js +49 -0
  78. package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +17 -7
  79. package/dist/scripts/src/components-core/rendering/Container.js +2 -1
  80. package/dist/scripts/src/components-core/theming/ThemeProvider.js +2 -7
  81. package/dist/scripts/src/components-core/theming/themes/root.js +1 -0
  82. package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
  83. package/dist/scripts/src/components-core/utils/hooks.js +26 -0
  84. package/dist/scripts/src/components-core/utils/misc.js +1 -1
  85. package/dist/scripts/src/components-core/utils/request-params.js +70 -0
  86. package/dist/scripts/src/logging/LoggerContext.js +22 -0
  87. package/dist/scripts/src/logging/LoggerInitializer.js +14 -0
  88. package/dist/scripts/src/logging/LoggerService.js +60 -0
  89. package/dist/scripts/src/parsers/xmlui-parser/transform.js +7 -0
  90. package/dist/{server-common-DW5h7Q34.mjs → server-common-9TiLMTJj.mjs} +106 -98
  91. package/dist/style.css +3314 -2823
  92. package/dist/{lint-EcgF-9Wr.mjs → transform-DC0Gy6qw.mjs} +1246 -540
  93. package/dist/xmlui-metadata.mjs +2850 -2665
  94. package/dist/xmlui-metadata.umd.js +2850 -2665
  95. package/dist/xmlui-parser.d.ts +49 -4
  96. package/dist/xmlui-parser.mjs +49 -48
  97. package/dist/xmlui-standalone.umd.js +34674 -31457
  98. package/dist/xmlui.d.ts +3 -1
  99. package/dist/xmlui.mjs +10 -10
  100. package/package.json +3 -1
  101. package/dist/apiInterceptorWorker-7aKQ2rBj.mjs +0 -8447
  102. package/dist/parser-CBXS8ft2.mjs +0 -1196
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.Tooltip = void 0;
40
+ const jsx_runtime_1 = require("react/jsx-runtime");
41
+ const RadixTooltip = __importStar(require("@radix-ui/react-tooltip"));
42
+ const Tooltip_module_scss_1 = __importDefault(require("./Tooltip.module.scss"));
43
+ const Tooltip = ({ trigger, label }) => {
44
+ return ((0, jsx_runtime_1.jsx)(RadixTooltip.Provider, { children: (0, jsx_runtime_1.jsxs)(RadixTooltip.Root, { children: [(0, jsx_runtime_1.jsx)(RadixTooltip.Trigger, { asChild: true, children: trigger }), (0, jsx_runtime_1.jsx)(RadixTooltip.Portal, { children: (0, jsx_runtime_1.jsx)(RadixTooltip.Content, { side: "bottom", align: "start", className: Tooltip_module_scss_1.default.TooltipContent, children: label }) })] }) }));
45
+ };
46
+ exports.Tooltip = Tooltip;
@@ -33,6 +33,9 @@ exports.NumberBoxMd = (0, ComponentDefs_1.createMetadata)({
33
33
  startIcon: (0, metadata_helpers_1.dStartIcon)(),
34
34
  endText: (0, metadata_helpers_1.dEndText)(),
35
35
  endIcon: (0, metadata_helpers_1.dEndIcon)(),
36
+ gap: {
37
+ description: "This property defines the gap between the adornments and the input area.",
38
+ },
36
39
  hasSpinBox: {
37
40
  description: `This boolean prop shows (\`true\`) or hides (\`false\`) the spinner buttons for the input field.`,
38
41
  valueType: "boolean",
@@ -73,5 +76,5 @@ exports.NumberBoxMd = (0, ComponentDefs_1.createMetadata)({
73
76
  themeVars: (0, themeVars_1.parseScssVar)(NumberBox_module_scss_1.default.themeVars),
74
77
  });
75
78
  exports.numberBoxComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NumberBoxMd, ({ node, state, updateState, lookupEventHandler, extractValue, layoutCss, registerComponentApi, }) => {
76
- return ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, { style: layoutCss, value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractValue.asOptionalString(node.props.initialValue), step: extractValue(node.props.step), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, hasSpinBox: extractValue.asOptionalBoolean(node.props.hasSpinBox), integersOnly: extractValue.asOptionalBoolean(node.props.integersOnly), zeroOrPositive: extractValue.asOptionalBoolean(node.props.zeroOrPositive), min: extractValue.asOptionalNumber(node.props.minValue), max: extractValue.asOptionalNumber(node.props.maxValue), startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), endIcon: extractValue.asOptionalString(node.props.endIcon), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), maxLength: extractValue(node.props.maxLength), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required) }));
79
+ return ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, { style: layoutCss, value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractValue.asOptionalString(node.props.initialValue), step: extractValue(node.props.step), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, hasSpinBox: extractValue.asOptionalBoolean(node.props.hasSpinBox), integersOnly: extractValue.asOptionalBoolean(node.props.integersOnly), zeroOrPositive: extractValue.asOptionalBoolean(node.props.zeroOrPositive), min: extractValue.asOptionalNumber(node.props.minValue), max: extractValue.asOptionalNumber(node.props.maxValue), startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), gap: extractValue.asOptionalString(node.props.gap), endIcon: extractValue.asOptionalString(node.props.endIcon), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), maxLength: extractValue(node.props.maxLength), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required) }));
77
80
  });
@@ -48,7 +48,7 @@ const IconNative_1 = require("../Icon/IconNative");
48
48
  const InputAdornment_1 = require("../Input/InputAdornment");
49
49
  const ButtonNative_1 = require("../Button/ButtonNative");
50
50
  const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
51
- exports.NumberBox = (0, react_1.forwardRef)(function NumberBox({ id, value, initialValue, style, enabled = true, placeholder, validationStatus = "none", hasSpinBox = true, step, integersOnly = false, zeroOrPositive = false, min = zeroOrPositive ? 0 : -numberbox_abstractions_1.NUMBERBOX_MAX_VALUE, max = numberbox_abstractions_1.NUMBERBOX_MAX_VALUE, maxLength, updateState = constants_1.noop, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, startText, startIcon, endText, endIcon, autoFocus, readOnly, required, label, labelPosition, labelWidth, labelBreak, }, forwardedRef) {
51
+ exports.NumberBox = (0, react_1.forwardRef)(function NumberBox({ id, value, initialValue, style, enabled = true, placeholder, validationStatus = "none", hasSpinBox = true, step, integersOnly = false, zeroOrPositive = false, min = zeroOrPositive ? 0 : -numberbox_abstractions_1.NUMBERBOX_MAX_VALUE, max = numberbox_abstractions_1.NUMBERBOX_MAX_VALUE, maxLength, updateState = constants_1.noop, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, startText, startIcon, endText, endIcon, gap, autoFocus, readOnly, required, label, labelPosition, labelWidth, labelBreak, }, forwardedRef) {
52
52
  var _a;
53
53
  // Ensure the provided minimum is not smaller than the 0 if zeroOrPositive is set to true
54
54
  min = Math.max(zeroOrPositive ? 0 : -numberbox_abstractions_1.NUMBERBOX_MAX_VALUE, min);
@@ -288,7 +288,7 @@ exports.NumberBox = (0, react_1.forwardRef)(function NumberBox({ id, value, init
288
288
  }), tabIndex: -1, onFocus: () => {
289
289
  var _a;
290
290
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
291
- }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: NumberBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: "text", inputMode: "numeric", className: (0, classnames_1.default)(NumberBox_module_scss_1.default.input, { [NumberBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: valueStrRep, step: step, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onBeforeInput: handleOnBeforeInput, onKeyDown: handleOnKey, readOnly: readOnly, ref: inputRef, autoFocus: autoFocus, maxLength: maxLength, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: NumberBox_module_scss_1.default.adornment }), hasSpinBox && ((0, jsx_runtime_1.jsxs)("div", { className: NumberBox_module_scss_1.default.spinnerBox, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-spinner": "up", type: "button", variant: "ghost", themeColor: "secondary", tabIndex: -1, className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: upButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "chevronup", size: "sm" }) }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-spinner": "down", type: "button", tabIndex: -1, variant: "ghost", themeColor: "secondary", className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: downButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "chevrondown", size: "sm" }) })] }))] }) }));
291
+ }, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: NumberBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: "text", inputMode: "numeric", className: (0, classnames_1.default)(NumberBox_module_scss_1.default.input, { [NumberBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: valueStrRep, step: step, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onBeforeInput: handleOnBeforeInput, onKeyDown: handleOnKey, readOnly: readOnly, ref: inputRef, autoFocus: autoFocus, maxLength: maxLength, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: NumberBox_module_scss_1.default.adornment }), hasSpinBox && ((0, jsx_runtime_1.jsxs)("div", { className: NumberBox_module_scss_1.default.spinnerBox, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-spinner": "up", type: "button", variant: "ghost", themeColor: "secondary", tabIndex: -1, className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: upButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "chevronup", size: "sm" }) }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-spinner": "down", type: "button", tabIndex: -1, variant: "ghost", themeColor: "secondary", className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: downButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "chevrondown", size: "sm" }) })] }))] }) }));
292
292
  });
293
293
  function applyStep(valueStrRep, step, min, max, integersOnly) {
294
294
  const currentValue = (0, numberbox_abstractions_1.toUsableNumber)(valueStrRep, integersOnly);
@@ -6,7 +6,7 @@ const react_1 = require("react");
6
6
  const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
7
7
  const renderers_1 = require("../../components-core/renderers");
8
8
  const metadata_helpers_1 = require("../metadata-helpers");
9
- const OptionTypeProvider_1 = require("../Option/OptionTypeProvider");
9
+ const OptionTypeProvider_1 = require("./OptionTypeProvider");
10
10
  const container_helpers_1 = require("../container-helpers");
11
11
  const COMP = "Option";
12
12
  exports.OptionMd = (0, ComponentDefs_1.createMetadata)({
@@ -21,6 +21,7 @@ exports.OptionMd = (0, ComponentDefs_1.createMetadata)({
21
21
  enabled: (0, metadata_helpers_1.dEnabled)(),
22
22
  optionTemplate: (0, ComponentDefs_1.d)("This property is used to define a custom option template"),
23
23
  },
24
+ childrenAsTemplate: "optionTemplate",
24
25
  });
25
26
  const OptionNative = (0, react_1.memo)((props) => {
26
27
  const OptionType = (0, OptionTypeProvider_1.useOptionType)();
@@ -34,5 +35,5 @@ exports.optionComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP,
34
35
  const optionTemplate = node.props.optionTemplate;
35
36
  return ((0, jsx_runtime_1.jsx)(OptionNative, { optionRenderer: optionTemplate
36
37
  ? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: optionTemplate, renderChild: renderChild, contextVars: contextVars, layoutContext: layoutContext }))
37
- : undefined, value: extractValue(node.props.value), label: extractValue.asOptionalString(node.props.label) || renderChild(node.children), enabled: extractValue.asOptionalBoolean(node.props.enabled), style: layoutCss }));
38
+ : undefined, value: extractValue(node.props.value), label: extractValue.asOptionalString(node.props.label) || extractValue(node.props.value), enabled: extractValue.asOptionalBoolean(node.props.enabled), style: layoutCss }));
38
39
  });
@@ -83,7 +83,9 @@ exports.SelectMd = (0, ComponentDefs_1.createMetadata)({
83
83
  },
84
84
  });
85
85
  exports.selectComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SelectMd, ({ node, state, updateState, extractValue, renderChild, lookupEventHandler, layoutCss, registerComponentApi, }) => {
86
- return ((0, jsx_runtime_1.jsx)(SelectNative_1.Select, { multiSelect: extractValue.asOptionalBoolean(node.props.multiSelect), style: layoutCss, inProgress: extractValue.asOptionalBoolean(node.props.inProgress), inProgressNotificationMessage: extractValue.asOptionalString(node.props.inProgressNotificationMessage), updateState: updateState, searchable: extractValue.asOptionalBoolean(node.props.searchable), initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, emptyListTemplate: renderChild(node.props.emptyListTemplate), dropdownHeight: extractValue(node.props.dropdownHeight), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), optionLabelRenderer: node.props.optionLabelTemplate
86
+ const multiSelect = extractValue.asOptionalBoolean(node.props.multiSelect);
87
+ const searchable = extractValue.asOptionalBoolean(node.props.searchable);
88
+ return ((0, jsx_runtime_1.jsx)(SelectNative_1.Select, { multiSelect: multiSelect, style: layoutCss, inProgress: extractValue.asOptionalBoolean(node.props.inProgress), inProgressNotificationMessage: extractValue.asOptionalString(node.props.inProgressNotificationMessage), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), updateState: updateState, searchable: searchable, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, emptyListTemplate: renderChild(node.props.emptyListTemplate), dropdownHeight: extractValue(node.props.dropdownHeight), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), optionLabelRenderer: node.props.optionLabelTemplate
87
89
  ? (item) => {
88
90
  return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.optionLabelTemplate, item: item, renderChild: renderChild }));
89
91
  }
@@ -91,8 +93,8 @@ exports.selectComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP,
91
93
  ? (item, val, inTrigger) => {
92
94
  return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.optionTemplate, item: item, contextVars: {
93
95
  $selectedValue: val,
94
- $inTrigger: inTrigger
95
- }, renderChild: (...args) => ((0, jsx_runtime_1.jsx)(react_select_1.SelectItemText, { children: renderChild(...args) })) }));
96
+ $inTrigger: inTrigger,
97
+ }, renderChild: (...args) => multiSelect || searchable ? (renderChild(...args)) : ((0, jsx_runtime_1.jsx)(react_select_1.SelectItemText, { children: renderChild(...args) })) }));
96
98
  }
97
99
  : undefined, valueRenderer: node.props.valueTemplate
98
100
  ? (item, removeItem) => {
@@ -56,22 +56,28 @@ const OptionTypeProvider_1 = __importDefault(require("../Option/OptionTypeProvid
56
56
  const OptionContext_1 = require("./OptionContext");
57
57
  const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
58
58
  const SimpleSelect = (0, react_1.forwardRef)(function SimpleSelect(props, forwardedRef) {
59
+ var _a;
59
60
  const { root } = (0, ThemeContext_1.useTheme)();
60
- const { enabled, onBlur, autoFocus, onValueChange, validationStatus, children, value, height, style, placeholder, id, triggerRef, onFocus, options, } = props;
61
+ const { enabled, onBlur, autoFocus, onValueChange, validationStatus, value, height, style, placeholder, id, triggerRef, onFocus, options, children, readOnly, } = props;
61
62
  const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(triggerRef, forwardedRef) : triggerRef;
62
- const stringValue = value != undefined ? value + "" : null;
63
+ const stringValue = (0, react_1.useMemo)(() => {
64
+ return value != undefined ? value + "" : undefined;
65
+ }, [value]);
63
66
  const onValChange = (0, react_1.useCallback)((val) => {
64
67
  var _a;
65
- const valueWithMatchingType = (_a = Array.from(options.values()).find((o) => o.value + "" === val)) === null || _a === void 0 ? void 0 : _a.value;
66
- onValueChange(valueWithMatchingType);
68
+ if (readOnly) {
69
+ return;
70
+ }
71
+ const match = Array.from(options).find((o) => `${o.value}` === val);
72
+ onValueChange((_a = match === null || match === void 0 ? void 0 : match.value) !== null && _a !== void 0 ? _a : val);
67
73
  }, [onValueChange, options]);
68
- return ((0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: SelectOption, children: (0, jsx_runtime_1.jsxs)(react_select_1.Root, { value: stringValue, onValueChange: onValChange, children: [(0, jsx_runtime_1.jsxs)(react_select_1.Trigger, { id: id, style: style, onFocus: onFocus, onBlur: onBlur, disabled: !enabled, className: (0, classnames_1.default)(Select_module_scss_1.default.selectTrigger, {
69
- [Select_module_scss_1.default.error]: validationStatus === "error",
70
- [Select_module_scss_1.default.warning]: validationStatus === "warning",
71
- [Select_module_scss_1.default.valid]: validationStatus === "valid",
72
- }), ref: ref, autoFocus: autoFocus, children: [(0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.selectValue, children: (0, jsx_runtime_1.jsx)(react_select_1.Value, { placeholder: placeholder }) }), (0, jsx_runtime_1.jsx)(react_select_1.Icon, { asChild: true, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] }), (0, jsx_runtime_1.jsx)(react_select_1.Portal, { container: root, children: (0, jsx_runtime_1.jsxs)(react_select_1.Content, { className: Select_module_scss_1.default.selectContent, position: "popper", style: { height: height }, children: [(0, jsx_runtime_1.jsx)(react_select_1.ScrollUpButton, { className: Select_module_scss_1.default.selectScrollUpButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevronup" }) }), (0, jsx_runtime_1.jsx)(react_select_1.Viewport, { className: (0, classnames_1.default)(Select_module_scss_1.default.selectViewport), children: children }), (0, jsx_runtime_1.jsx)(react_select_1.ScrollDownButton, { className: Select_module_scss_1.default.selectScrollDownButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] }) })] }) }));
74
+ return ((0, jsx_runtime_1.jsxs)(react_select_1.Root, { value: stringValue, onValueChange: onValChange, children: [(0, jsx_runtime_1.jsxs)(react_select_1.Trigger, { id: id, "aria-haspopup": "listbox", style: style, onFocus: onFocus, onBlur: onBlur, disabled: !enabled, className: (0, classnames_1.default)(Select_module_scss_1.default.selectTrigger, {
75
+ [Select_module_scss_1.default.error]: validationStatus === "error",
76
+ [Select_module_scss_1.default.warning]: validationStatus === "warning",
77
+ [Select_module_scss_1.default.valid]: validationStatus === "valid",
78
+ }), ref: ref, autoFocus: autoFocus, children: [(0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.selectValue, children: readOnly ? (((_a = Array.from(options).find((o) => `${o.value}` === stringValue)) === null || _a === void 0 ? void 0 : _a.label) || (0, jsx_runtime_1.jsx)("span", { children: placeholder })) : ((0, jsx_runtime_1.jsx)(react_select_1.Value, { placeholder: placeholder })) }), (0, jsx_runtime_1.jsx)(react_select_1.Icon, { asChild: true, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] }), (0, jsx_runtime_1.jsx)(react_select_1.Portal, { container: root, children: (0, jsx_runtime_1.jsxs)(react_select_1.Content, { className: Select_module_scss_1.default.selectContent, position: "popper", style: { height: height }, children: [(0, jsx_runtime_1.jsx)(react_select_1.ScrollUpButton, { className: Select_module_scss_1.default.selectScrollUpButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevronup" }) }), (0, jsx_runtime_1.jsx)(react_select_1.SelectViewport, { className: Select_module_scss_1.default.selectViewport, role: "listbox", children: children }), (0, jsx_runtime_1.jsx)(react_select_1.ScrollDownButton, { className: Select_module_scss_1.default.selectScrollDownButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] }) })] }));
73
79
  });
74
- exports.Select = (0, react_1.forwardRef)(function Select({ id, initialValue, value, enabled = true, placeholder, updateState = constants_1.noop, validationStatus = "none", onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, emptyListTemplate, optionLabelRenderer, optionRenderer, valueRenderer, style, dropdownHeight, children, autoFocus = false, searchable = false, multiSelect = false, label, labelPosition, labelWidth, labelBreak, required = false, inProgress = false, inProgressNotificationMessage = "Loading...", }, ref) {
80
+ exports.Select = (0, react_1.forwardRef)(function Select({ id, initialValue, value, enabled = true, placeholder, updateState = constants_1.noop, validationStatus = "none", onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, emptyListTemplate, optionLabelRenderer, optionRenderer, valueRenderer, style, dropdownHeight, children, autoFocus = false, searchable = false, multiSelect = false, label, labelPosition, labelWidth, labelBreak = false, required = false, inProgress = false, inProgressNotificationMessage = "Loading...", readOnly = false, }, ref) {
75
81
  var _a;
76
82
  const [referenceElement, setReferenceElement] = (0, react_1.useState)(null);
77
83
  const [open, setOpen] = (0, react_1.useState)(false);
@@ -79,6 +85,8 @@ exports.Select = (0, react_1.forwardRef)(function Select({ id, initialValue, val
79
85
  const observer = (0, react_1.useRef)();
80
86
  const { root } = (0, ThemeContext_1.useTheme)();
81
87
  const [options, setOptions] = (0, react_1.useState)(new Set());
88
+ const generatedId = (0, react_1.useId)();
89
+ const inputId = id || generatedId;
82
90
  // Set initial state based on the initialValue prop
83
91
  (0, react_1.useEffect)(() => {
84
92
  if (initialValue !== undefined) {
@@ -112,7 +120,9 @@ exports.Select = (0, react_1.forwardRef)(function Select({ id, initialValue, val
112
120
  : selectedValue;
113
121
  updateState({ value: newSelectedValue });
114
122
  onDidChange(newSelectedValue);
115
- setOpen(false);
123
+ if (!multiSelect) {
124
+ setOpen(false);
125
+ }
116
126
  }, [multiSelect, value, updateState, onDidChange]);
117
127
  // Clear selected value
118
128
  const clearValue = (0, react_1.useCallback)(() => {
@@ -165,68 +175,71 @@ exports.Select = (0, react_1.forwardRef)(function Select({ id, initialValue, val
165
175
  optionLabelRenderer,
166
176
  optionRenderer,
167
177
  onChange: toggleOption,
178
+ setOpen,
168
179
  }), [multiSelect, toggleOption, value, optionLabelRenderer, optionRenderer]);
169
- return ((0, jsx_runtime_1.jsx)(SelectContext_1.SelectContext.Provider, { value: selectContextValue, children: (0, jsx_runtime_1.jsx)(OptionContext_1.OptionContext.Provider, { value: optionContextValue, children: searchable || multiSelect ? ((0, jsx_runtime_1.jsxs)(OptionTypeProvider_1.default, { Component: HiddenOption, children: [children, (0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { ref: ref, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsxs)(react_popover_1.Popover, { open: open, onOpenChange: setOpen, modal: false, children: [(0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)("button", { id: id, ref: setReferenceElement, onFocus: onFocus, onBlur: onBlur, disabled: !enabled, "aria-expanded": open, onClick: () => setOpen((prev) => !prev), className: (0, classnames_1.default)(Select_module_scss_1.default.selectTrigger, Select_module_scss_1.default[validationStatus], {
170
- [Select_module_scss_1.default.disabled]: !enabled,
171
- [Select_module_scss_1.default.multi]: multiSelect,
172
- }), placeholder: placeholder, autoFocus: autoFocus, children: [multiSelect ? (Array.isArray(value) && value.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.badgeListContainer, children: (0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.badgeList, children: value.map((v) => {
173
- var _a;
174
- return valueRenderer ? (valueRenderer(Array.from(options).find((o) => o.value === v), () => {
175
- toggleOption(v);
176
- })) : ((0, jsx_runtime_1.jsxs)("span", { className: Select_module_scss_1.default.badge, children: [(_a = Array.from(options).find((o) => o.value === v)) === null || _a === void 0 ? void 0 : _a.label, (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", size: "sm", onClick: (event) => {
177
- event.stopPropagation();
178
- toggleOption(v);
179
- } })] }, v));
180
- }) }) })) : ((0, jsx_runtime_1.jsx)("span", { className: Select_module_scss_1.default.placeholder, children: placeholder || "" }))) : value !== undefined && value !== null ? ((0, jsx_runtime_1.jsx)("div", { children: (_a = Array.from(options).find((o) => o.value === value)) === null || _a === void 0 ? void 0 : _a.label })) : ((0, jsx_runtime_1.jsx)("span", { className: Select_module_scss_1.default.placeholder, children: placeholder || "" })), (0, jsx_runtime_1.jsxs)("div", { className: Select_module_scss_1.default.actions, children: [multiSelect && Array.isArray(value) && value.length > 0 && ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", onClick: (event) => {
181
- event.stopPropagation();
182
- clearValue();
183
- } })), (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" })] })] }) }), open && ((0, jsx_runtime_1.jsx)(react_select_1.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(react_focus_scope_1.FocusScope, { asChild: true, loop: true, trapped: true, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { style: { width, height: dropdownHeight }, className: Select_module_scss_1.default.selectContent, children: (0, jsx_runtime_1.jsxs)(cmdk_1.Command, { className: Select_module_scss_1.default.command, shouldFilter: searchable, filter: (value, search, keywords) => {
180
+ return ((0, jsx_runtime_1.jsx)(SelectContext_1.SelectContext.Provider, { value: selectContextValue, children: (0, jsx_runtime_1.jsx)(OptionContext_1.OptionContext.Provider, { value: optionContextValue, children: (0, jsx_runtime_1.jsxs)(OptionTypeProvider_1.default, { Component: HiddenOption, children: [(0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { ref: ref, id: inputId, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: searchable || multiSelect ? ((0, jsx_runtime_1.jsxs)(react_popover_1.Popover, { open: open, onOpenChange: setOpen, modal: false, children: [(0, jsx_runtime_1.jsxs)(react_popover_1.PopoverTrigger, { id: inputId, "aria-haspopup": "listbox", style: style, ref: setReferenceElement, onFocus: onFocus, onBlur: onBlur, disabled: !enabled, "aria-expanded": open, onClick: () => setOpen((prev) => !prev), className: (0, classnames_1.default)(Select_module_scss_1.default.selectTrigger, Select_module_scss_1.default[validationStatus], {
181
+ [Select_module_scss_1.default.disabled]: !enabled,
182
+ [Select_module_scss_1.default.multi]: multiSelect,
183
+ }), placeholder: placeholder, autoFocus: autoFocus, children: [multiSelect ? (Array.isArray(value) && value.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.badgeListContainer, children: (0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.badgeList, children: value.map((v) => {
184
+ var _a;
185
+ return valueRenderer ? (valueRenderer(Array.from(options).find((o) => o.value === `${v}`), () => {
186
+ toggleOption(v);
187
+ })) : ((0, jsx_runtime_1.jsxs)("span", { className: Select_module_scss_1.default.badge, children: [(_a = Array.from(options).find((o) => o.value === `${v}`)) === null || _a === void 0 ? void 0 : _a.label, (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", size: "sm", onClick: (event) => {
188
+ event.stopPropagation();
189
+ toggleOption(v);
190
+ } })] }, v));
191
+ }) }) })) : ((0, jsx_runtime_1.jsx)("span", { className: Select_module_scss_1.default.placeholder, children: placeholder }))) : value !== undefined && value !== null ? ((0, jsx_runtime_1.jsx)("div", { children: (_a = Array.from(options).find((o) => o.value === value)) === null || _a === void 0 ? void 0 : _a.label })) : ((0, jsx_runtime_1.jsx)("span", { className: Select_module_scss_1.default.placeholder, children: placeholder || "" })), (0, jsx_runtime_1.jsxs)("div", { className: Select_module_scss_1.default.actions, children: [multiSelect && Array.isArray(value) && value.length > 0 && ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", onClick: (event) => {
192
+ event.stopPropagation();
193
+ clearValue();
194
+ } })), (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" })] })] }), open && ((0, jsx_runtime_1.jsx)(react_select_1.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(react_focus_scope_1.FocusScope, { asChild: true, loop: true, trapped: true, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { style: { width, height: dropdownHeight }, className: Select_module_scss_1.default.selectContent, children: (0, jsx_runtime_1.jsxs)(cmdk_1.Command, { className: Select_module_scss_1.default.command, shouldFilter: searchable, filter: (value, search, keywords) => {
184
195
  const extendedValue = value + " " + keywords.join(" ");
185
196
  if (extendedValue.toLowerCase().includes(search.toLowerCase()))
186
197
  return 1;
187
198
  return 0;
188
199
  }, children: [searchable ? ((0, jsx_runtime_1.jsxs)("div", { className: Select_module_scss_1.default.commandInputContainer, children: [(0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "search" }), (0, jsx_runtime_1.jsx)(cmdk_1.CommandInput, { className: (0, classnames_1.default)(Select_module_scss_1.default.commandInput), placeholder: "Search..." })] })) : (
189
200
  // https://github.com/pacocoursey/cmdk/issues/322#issuecomment-2444703817
190
- (0, jsx_runtime_1.jsx)("button", { autoFocus: true, "aria-hidden": "true", className: Select_module_scss_1.default.srOnly })), (0, jsx_runtime_1.jsxs)(cmdk_1.CommandList, { className: Select_module_scss_1.default.commandList, children: [inProgress && ((0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.loading, children: inProgressNotificationMessage })), Array.from(options).map(({ value, label, enabled, keywords }) => ((0, jsx_runtime_1.jsx)(exports.ComboboxOption, { value: value, label: label, enabled: enabled, keywords: keywords }, value))), !inProgress && (0, jsx_runtime_1.jsx)(cmdk_1.CommandEmpty, { children: emptyListNode })] })] }) }) }) }))] }) })] })) : ((0, jsx_runtime_1.jsx)(SimpleSelect, { ref: ref, value: value, options: options, onValueChange: toggleOption, id: id, style: style, onFocus: onFocus, onBlur: onBlur, enabled: enabled, validationStatus: validationStatus, triggerRef: setReferenceElement, autoFocus: autoFocus, placeholder: placeholder, height: dropdownHeight, children: children || emptyListNode })) }) }));
201
+ (0, jsx_runtime_1.jsx)("button", { autoFocus: true, "aria-hidden": "true", className: Select_module_scss_1.default.srOnly })), (0, jsx_runtime_1.jsxs)(cmdk_1.CommandList, { className: Select_module_scss_1.default.commandList, children: [inProgress && ((0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.loading, children: inProgressNotificationMessage })), Array.from(options).map(({ value, label, enabled, keywords }) => ((0, jsx_runtime_1.jsx)(exports.ComboboxOption, { readOnly: readOnly, value: value, label: label, enabled: enabled, keywords: keywords }, value))), !inProgress && (0, jsx_runtime_1.jsx)(cmdk_1.CommandEmpty, { children: emptyListNode })] })] }) }) }) }))] })) : ((0, jsx_runtime_1.jsx)(SimpleSelect, { readOnly: !!readOnly, ref: ref, value: value, options: options, onValueChange: toggleOption, id: inputId, style: style, onFocus: onFocus, onBlur: onBlur, enabled: enabled, validationStatus: validationStatus, triggerRef: setReferenceElement, autoFocus: autoFocus, placeholder: placeholder, height: dropdownHeight, children: options.size > 0
202
+ ? Array.from(options).map((option) => ((0, jsx_runtime_1.jsx)(SelectOption, { value: option.value, label: option.label, enabled: option.enabled }, option.value)))
203
+ : emptyListNode })) }), children] }) }) }));
191
204
  });
192
205
  exports.ComboboxOption = (0, react_1.forwardRef)(function Combobox(option, forwardedRef) {
193
206
  const id = (0, react_1.useId)();
194
- const { label, value, enabled = true, keywords } = option;
195
- const { value: selectedValue, onChange, multiSelect, optionLabelRenderer, optionRenderer, } = (0, SelectContext_1.useSelect)();
207
+ const { label, value, enabled = true, keywords, readOnly } = option;
208
+ const { value: selectedValue, onChange, multiSelect, optionLabelRenderer, optionRenderer, setOpen, } = (0, SelectContext_1.useSelect)();
196
209
  const selected = (0, react_1.useMemo)(() => {
197
210
  return Array.isArray(selectedValue) && multiSelect
198
211
  ? selectedValue.includes(value)
199
212
  : selectedValue === value;
200
213
  }, [selectedValue, value, multiSelect]);
201
- return ((0, jsx_runtime_1.jsx)(cmdk_1.CommandItem, { id: id, ref: forwardedRef, disabled: !enabled, value: `${value}`, className: Select_module_scss_1.default.multiComboboxOption, onSelect: () => {
214
+ return ((0, jsx_runtime_1.jsx)(cmdk_1.CommandItem, { id: id, ref: forwardedRef, disabled: !enabled, value: value, className: Select_module_scss_1.default.multiComboboxOption, onSelect: () => {
215
+ if (readOnly) {
216
+ setOpen(false);
217
+ return;
218
+ }
202
219
  onChange(value);
203
220
  }, "data-state": selected ? "checked" : undefined, keywords: keywords, children: (0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.multiComboboxOptionContent, children: optionRenderer ? (optionRenderer({ label, value, enabled, keywords }, selectedValue, false)) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [optionLabelRenderer ? optionLabelRenderer({ label, value }) : label, selected && (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "checkmark" })] })) }) }, id));
204
221
  });
205
222
  function HiddenOption(option) {
223
+ const { optionRenderer, label } = option;
206
224
  const { onOptionRemove, onOptionAdd } = (0, OptionContext_1.useOption)();
207
225
  const [node, setNode] = (0, react_1.useState)(null);
208
226
  const opt = (0, react_1.useMemo)(() => {
209
227
  var _a, _b;
210
- return Object.assign(Object.assign({}, option), { labelText: (_a = node === null || node === void 0 ? void 0 : node.textContent) !== null && _a !== void 0 ? _a : "", keywords: [(_b = node === null || node === void 0 ? void 0 : node.textContent) !== null && _b !== void 0 ? _b : ""] });
228
+ return Object.assign(Object.assign({}, option), { label: (_a = label !== null && label !== void 0 ? label : node === null || node === void 0 ? void 0 : node.textContent) !== null && _a !== void 0 ? _a : "", keywords: [(_b = node === null || node === void 0 ? void 0 : node.textContent) !== null && _b !== void 0 ? _b : ""] });
211
229
  }, [option, node]);
212
230
  (0, react_1.useEffect)(() => {
213
231
  onOptionAdd(opt);
214
232
  return () => onOptionRemove(opt);
215
233
  }, [opt, onOptionAdd, onOptionRemove]);
216
- return ((0, jsx_runtime_1.jsx)("div", { ref: (el) => setNode(el), style: { display: "none" }, children: option.label }));
234
+ return ((0, jsx_runtime_1.jsx)("div", { ref: (el) => setNode(el), style: { display: "none" }, children: optionRenderer === null || optionRenderer === void 0 ? void 0 : optionRenderer({}) }));
217
235
  }
218
236
  const SelectOption = react_1.default.forwardRef((option, ref) => {
219
237
  const { value, label, enabled = true } = option;
220
- const { onOptionRemove, onOptionAdd } = (0, OptionContext_1.useOption)();
221
- const { optionLabelRenderer, optionRenderer, value: selectedValue, multiSelect } = (0, SelectContext_1.useSelect)();
222
- (0, react_1.useLayoutEffect)(() => {
223
- onOptionAdd(option);
224
- return () => onOptionRemove(option);
225
- }, [option, onOptionAdd, onOptionRemove]);
226
- return ((0, jsx_runtime_1.jsx)(react_select_1.Item, { ref: ref, className: Select_module_scss_1.default.selectItem, value: value + "", disabled: !enabled, children: (0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.selectItemContent, children: optionRenderer ? (optionRenderer({
238
+ const { optionLabelRenderer, optionRenderer, value: selectedValue } = (0, SelectContext_1.useSelect)();
239
+ return ((0, jsx_runtime_1.jsx)(react_select_1.Item, { ref: ref, className: Select_module_scss_1.default.selectItem, value: value + "", disabled: !enabled, "data-state": selectedValue === value && "checked", children: (0, jsx_runtime_1.jsx)("div", { className: Select_module_scss_1.default.selectItemContent, children: optionRenderer ? (optionRenderer({
227
240
  label,
228
241
  value,
229
242
  enabled,
230
- }, selectedValue, false)) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_select_1.ItemText, { className: Select_module_scss_1.default.selectItemContent, children: optionLabelRenderer ? optionLabelRenderer({ value, label }) : label }), (0, jsx_runtime_1.jsx)("span", { className: Select_module_scss_1.default.selectItemIndicator, children: (0, jsx_runtime_1.jsx)(react_select_1.ItemIndicator, { children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "checkmark" }) }) })] })) }) }));
243
+ }, selectedValue, false)) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_select_1.ItemText, { className: Select_module_scss_1.default.selectItemContent, children: optionLabelRenderer ? optionLabelRenderer({ value, label }) : label }), selectedValue === value && ((0, jsx_runtime_1.jsx)("span", { className: Select_module_scss_1.default.selectItemIndicator, children: (0, jsx_runtime_1.jsx)(react_select_1.ItemIndicator, { children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "checkmark" }) }) }))] })) }) }));
231
244
  });
232
245
  SelectOption.displayName = "SelectOption";
@@ -7,7 +7,7 @@ const renderers_1 = require("../../components-core/renderers");
7
7
  const SelectionStoreNative_1 = require("./SelectionStoreNative");
8
8
  const COMP = "SelectionStore";
9
9
  exports.SelectionStoreMd = (0, ComponentDefs_1.createMetadata)({
10
- status: "experimental",
10
+ status: "deprecated",
11
11
  description: `The \`${COMP}\` is a non-visual component that may wrap components (items) and manage ` +
12
12
  `their selection state to accommodate the usage of other actions.`,
13
13
  props: {
@@ -25,7 +25,6 @@ exports.SpinnerMd = (0, ComponentDefs_1.createMetadata)({
25
25
  valueType: "boolean",
26
26
  defaultValue: false,
27
27
  },
28
- themeColor: (0, ComponentDefs_1.d)(`(**NOT IMPLEMENTED YET**) The theme color of the component.`),
29
28
  },
30
29
  themeVars: (0, themeVars_1.parseScssVar)(Spinner_module_scss_1.default.themeVars),
31
30
  defaultThemeVars: {
@@ -62,6 +62,7 @@ exports.TableOfContentsMd = (0, ComponentDefs_1.createMetadata)({
62
62
  [`border-width-${COMP}`]: "0",
63
63
  [`borderColor-${COMP}`]: "transparent",
64
64
  [`border-style-${COMP}`]: "solid",
65
+ [`paddingLeft-${COMP}Item`]: "$space-1",
65
66
  [`textTransform-${COMP}Item`]: "none",
66
67
  [`verticalAlign-${COMP}Item`]: "baseline",
67
68
  [`letterSpacing-${COMP}Item`]: "0",
@@ -66,7 +66,12 @@ exports.TextMd = (0, ComponentDefs_1.createMetadata)({
66
66
  [`fontFamily-${COMP}-code`]: "$fontFamily-monospace",
67
67
  [`fontSize-${COMP}-code`]: "$fontSize-small",
68
68
  [`borderWidth-${COMP}-code`]: "1px",
69
+ [`borderStyle-${COMP}-code`]: "solid",
70
+ [`borderRadius-${COMP}-code`]: "4px",
69
71
  [`paddingHorizontal-${COMP}-code`]: "$space-1",
72
+ [`marginLeft-${COMP}-code`]: "$space-1",
73
+ [`marginRight-${COMP}-code`]: "$space-1",
74
+ [`paddingBottom-${COMP}-code`]: "2px",
70
75
  [`textDecorationLine-${COMP}-deleted`]: "line-through",
71
76
  [`textDecorationLine-${COMP}-inserted`]: "underline",
72
77
  [`fontFamily-${COMP}-keyboard`]: "$fontFamily-monospace",
@@ -100,16 +105,22 @@ exports.TextMd = (0, ComponentDefs_1.createMetadata)({
100
105
  [`marginBottom-${COMP}-tableheading`]: "$space-4",
101
106
  [`paddingHorizontal-${COMP}-tableheading`]: "$space-1",
102
107
  [`fontWeight-${COMP}-tableheading`]: "$fontWeight-bold",
108
+ [`marginTop-${COMP}-markdown`]: "$space-3",
109
+ [`marginBottom-${COMP}-markdown`]: "$space-6",
110
+ [`fontSize-${COMP}-markdown`]: "$fontSize-normal",
103
111
  [`backgroundColor-${COMP}-code`]: "$color-surface-100",
104
112
  [`borderColor-${COMP}-code`]: "$color-surface-200",
105
113
  [`backgroundColor-${COMP}-keyboard`]: "$color-surface-200",
106
114
  [`borderColor-${COMP}-keyboard`]: "$color-surface-300",
107
115
  [`backgroundColor-${COMP}-marked`]: "yellow",
108
116
  [`color-${COMP}-placeholder`]: "$color-surface-500",
109
- [`backgroundColor-${COMP}-codefence`]: "$color-primary-100",
117
+ [`backgroundColor-${COMP}-codefence`]: "#f2f7fc",
110
118
  [`color-${COMP}-codefence`]: "$color-surface-900",
111
119
  [`color-${COMP}-subheading`]: "$textColor-secondary",
112
120
  [`color-${COMP}-secondary`]: "$textColor-secondary",
121
+ dark: {
122
+ [`backgroundColor-${COMP}-codefence`]: "#112033",
123
+ }
113
124
  },
114
125
  });
115
126
  exports.textComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TextMd, ({ node, extractValue, layoutCss, renderChild }) => {
@@ -26,12 +26,16 @@ exports.Text = (0, react_1.forwardRef)(function Text(_a, forwardedRef) {
26
26
  var { uid, variant, maxLines = 0, style, children, preserveLinebreaks, ellipses = true } = _a, variantSpecificProps = __rest(_a, ["uid", "variant", "maxLines", "style", "children", "preserveLinebreaks", "ellipses"]);
27
27
  const innerRef = (0, react_1.useRef)(null);
28
28
  const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(innerRef, forwardedRef) : innerRef;
29
+ // NOTE: This is to accept syntax highlight classes coming from shiki
30
+ // classes need not to be added to the rendered html element, so we remove them from props
31
+ const { syntaxHighlightClasses } = variantSpecificProps, restVariantSpecificProps = __rest(variantSpecificProps, ["syntaxHighlightClasses"]);
29
32
  const Element = (0, react_1.useMemo)(() => {
30
33
  if (!variant || !abstractions_1.TextVariantElement[variant])
31
34
  return "div"; //todo illesg, could be a span?
32
35
  return abstractions_1.TextVariantElement[variant];
33
36
  }, [variant]);
34
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Element, Object.assign({}, variantSpecificProps, { ref: ref, className: (0, classnames_1.default)([
37
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Element, Object.assign({}, restVariantSpecificProps, { ref: ref, className: (0, classnames_1.default)([
38
+ syntaxHighlightClasses,
35
39
  Text_module_scss_1.default.text,
36
40
  Text_module_scss_1.default[variant || "default"],
37
41
  {
@@ -32,6 +32,9 @@ exports.TextBoxMd = (0, ComponentDefs_1.createMetadata)({
32
32
  startIcon: (0, metadata_helpers_1.dStartIcon)(),
33
33
  endText: (0, metadata_helpers_1.dEndText)(),
34
34
  endIcon: (0, metadata_helpers_1.dEndIcon)(),
35
+ gap: {
36
+ description: "This property defines the gap between the adornments and the input area.",
37
+ },
35
38
  },
36
39
  events: {
37
40
  gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
@@ -52,6 +55,7 @@ exports.TextBoxMd = (0, ComponentDefs_1.createMetadata)({
52
55
  "borderWidth-Input": "1px",
53
56
  "minHeight-Input": "39px",
54
57
  "padding-Input": "$space-2",
58
+ "gap-adornment-Input": "$space-2",
55
59
  "borderStyle-Input": "solid",
56
60
  "borderColor-Input--disabled": "$borderColor--disabled",
57
61
  "textColor-Input--disabled": "$textColor--disabled",
@@ -73,7 +77,8 @@ exports.TextBoxMd = (0, ComponentDefs_1.createMetadata)({
73
77
  },
74
78
  });
75
79
  function renderTextBox(layoutCss, state, updateState, extractValue, node, lookupEventHandler, registerComponentApi, type = "text") {
76
- return ((0, jsx_runtime_1.jsx)(TextBoxNative_1.TextBox, { type: type, style: layoutCss, value: state.value, updateState: updateState, initialValue: extractValue(node.props.initialValue), maxLength: extractValue(node.props.maxLength), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), endIcon: extractValue.asOptionalString(node.props.endIcon), 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) }));
80
+ delete layoutCss.gap;
81
+ return ((0, jsx_runtime_1.jsx)(TextBoxNative_1.TextBox, { type: type, style: layoutCss, value: state.value, updateState: updateState, initialValue: extractValue(node.props.initialValue), maxLength: extractValue(node.props.maxLength), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), endIcon: extractValue.asOptionalString(node.props.endIcon), gap: extractValue.asOptionalString(node.props.gap), 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) }));
77
82
  }
78
83
  exports.textBoxComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TextBoxMd, ({ node, state, updateState, lookupEventHandler, extractValue, layoutCss, registerComponentApi, }) => {
79
84
  return renderTextBox(layoutCss, state, updateState, extractValue, node, lookupEventHandler, registerComponentApi);
@@ -46,7 +46,7 @@ const constants_1 = require("../../components-core/constants");
46
46
  const misc_1 = require("../../components-core/utils/misc");
47
47
  const InputAdornment_1 = require("../Input/InputAdornment");
48
48
  const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
49
- exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text", value = "", updateState = constants_1.noop, initialValue = "", style, maxLength, enabled = true, placeholder, validationStatus = "none", onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, startText, startIcon, endText, endIcon, autoFocus, readOnly, tabIndex, label, labelPosition, labelWidth, labelBreak, required, }, ref) {
49
+ exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text", value = "", updateState = constants_1.noop, initialValue = "", style, maxLength, enabled = true, placeholder, validationStatus = "none", onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, startText, startIcon, endText, endIcon, gap, autoFocus, readOnly, tabIndex, label, labelPosition, labelWidth, labelBreak, required, }, ref) {
50
50
  id = id || (0, react_1.useId)();
51
51
  const inputRef = (0, react_2.useRef)(null);
52
52
  (0, react_2.useEffect)(() => {
@@ -103,5 +103,5 @@ exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text",
103
103
  [TextBox_module_scss_1.default.error]: validationStatus === "error",
104
104
  [TextBox_module_scss_1.default.warning]: validationStatus === "warning",
105
105
  [TextBox_module_scss_1.default.valid]: validationStatus === "valid",
106
- }), tabIndex: -1, onFocus: focus, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: TextBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: type, className: (0, classnames_1.default)(TextBox_module_scss_1.default.input, { [TextBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: localValue, maxLength: maxLength, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: enabled ? tabIndex : -1, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: TextBox_module_scss_1.default.adornment })] }) }));
106
+ }), tabIndex: -1, onFocus: focus, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: TextBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: type, className: (0, classnames_1.default)(TextBox_module_scss_1.default.input, { [TextBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: localValue, maxLength: maxLength, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: enabled ? tabIndex : -1, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: TextBox_module_scss_1.default.adornment })] }) }));
107
107
  });
@@ -31,7 +31,7 @@ function calculateHash(str) {
31
31
  }
32
32
  return hash;
33
33
  }
34
- function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 5000, themeVars = constants_1.EMPTY_OBJECT, layoutContext, children }) {
34
+ function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 5000, themeVars = constants_1.EMPTY_OBJECT, layoutContext, children, }) {
35
35
  const generatedId = (0, react_1.useId)();
36
36
  const { themes, resources, resourceMap, activeThemeId, setRoot, root } = (0, ThemeContext_1.useThemes)();
37
37
  const { activeTheme, activeThemeTone } = (0, ThemeContext_1.useTheme)();
@@ -123,11 +123,15 @@ function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 50
123
123
  }, [devToolsEnabled, devToolsSide, devToolsSize]);
124
124
  if (isRoot) {
125
125
  const faviconUrl = getResourceUrl("resource:favicon") || "/resources/favicon.ico";
126
- 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
+ return (
127
+ // <ThemeContext.Provider value={currentThemeContextValue}>
128
+ (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", "data-theme-root": true, 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) => {
127
129
  if (el) {
128
130
  setRoot(el);
129
131
  }
130
- }, children: [(0, jsx_runtime_1.jsxs)(ErrorBoundary_1.ErrorBoundary, { node: node, location: "theme-root", children: [renderChild(node.children), children] }), (0, jsx_runtime_1.jsx)(NotificationToast_1.NotificationToast, { toastDuration: toastDuration })] })] }));
132
+ }, children: [(0, jsx_runtime_1.jsxs)(ErrorBoundary_1.ErrorBoundary, { node: node, location: "theme-root", children: [renderChild(node.children), children] }), (0, jsx_runtime_1.jsx)(NotificationToast_1.NotificationToast, { toastDuration: toastDuration })] })] })
133
+ // </ThemeContext.Provider>
134
+ );
131
135
  }
132
136
  return ((0, jsx_runtime_1.jsxs)(ThemeContext_1.ThemeContext.Provider, { value: currentThemeContextValue, children: [(0, jsx_runtime_1.jsx)("style", { children: `.${rangeClassName} {${css}}` }), (0, jsx_runtime_1.jsx)("style", { children: `.${className} {${css}}` }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Theme_module_scss_1.default.from, fromClass) }), renderChild(node.children, Object.assign(Object.assign({}, layoutContext), { themeClassName: className })), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Theme_module_scss_1.default.to, toClass) }), root &&
133
137
  (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className), ref: (el) => {
@@ -15,9 +15,7 @@ exports.ToneChangerButtonMd = (0, ComponentDefs_1.createMetadata)({
15
15
  });
16
16
  function ToneChangerButton() {
17
17
  const { activeThemeTone, setActiveThemeTone } = (0, ThemeContext_1.useThemes)();
18
- return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: activeThemeTone === "light" ? "stars" : "sun" }), onClick: () => {
19
- activeThemeTone === "light" ? setActiveThemeTone("dark") : setActiveThemeTone("light");
20
- } }));
18
+ return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", style: { flexShrink: 0 }, icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: activeThemeTone === "light" ? "lightToDark" : "darkToLight" }), onClick: () => activeThemeTone === "light" ? setActiveThemeTone("dark") : setActiveThemeTone("light") }));
21
19
  }
22
20
  /**
23
21
  * Define the renderer for the Button component
@@ -294,7 +294,8 @@ class RestApiProxy {
294
294
  if (!response.clone().ok) {
295
295
  throw yield this.raiseError(response);
296
296
  }
297
- return yield parseResponse(response.clone());
297
+ const parsedResponse = yield parseResponse(response.clone());
298
+ return parsedResponse;
298
299
  }
299
300
  });
300
301
  this.tryParseResponse = (response) => __awaiter(this, void 0, void 0, function* () {
@@ -330,12 +331,14 @@ class RestApiProxy {
330
331
  const conf = (appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) || { apiUrl: "" };
331
332
  const { apiUrl, errorResponseTransform } = conf;
332
333
  this.appContext = appContext;
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
- : {};
334
+ // const xsrfToken = readCookie("XSRF-TOKEN");
335
+ const xsrfHeaders =
336
+ // xsrfToken
337
+ // ? {
338
+ // "X-XSRF-TOKEN": readCookie("XSRF-TOKEN"),
339
+ // }
340
+ // :
341
+ {};
339
342
  this.config = {
340
343
  apiUrl,
341
344
  errorResponseTransform,
@@ -115,7 +115,7 @@ function TableOfContentsProvider({ children }) {
115
115
  }, [headings]);
116
116
  //the content could take time to load, this way we try to force the scroll to anchor mechanism to kick in
117
117
  const hasHeadings = sortedHeadings.length > 0;
118
- (0, react_1.useEffect)(() => {
118
+ (0, hooks_1.useIsomorphicLayoutEffect)(() => {
119
119
  if (hasHeadings) {
120
120
  forceRefreshAnchorScroll();
121
121
  }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dateFunctions = void 0;
4
+ const date_utils_1 = require("../utils/date-utils");
5
+ const date_fns_1 = require("date-fns");
6
+ exports.dateFunctions = {
7
+ isoDateString: date_utils_1.isoDateString,
8
+ formatDate: date_utils_1.formatDate,
9
+ formatDateTime: date_utils_1.formatDateTime,
10
+ formatTime: date_utils_1.formatTime,
11
+ formatTimeWithoutSeconds: date_utils_1.formatTimeWithoutSeconds,
12
+ formatDateWithoutYear: date_utils_1.formatDateWithoutYear,
13
+ getDate: date_utils_1.getDate,
14
+ getDateUntilNow: date_utils_1.getDateUntilNow,
15
+ smartFormatDateTime: date_utils_1.smartFormatDateTime,
16
+ smartFormatDate: date_utils_1.smartFormatDate,
17
+ isToday: date_utils_1.isDateToday,
18
+ isYesterday: date_utils_1.isDateYesterday,
19
+ isTomorrow: date_utils_1.isDateTomorrow,
20
+ differenceInMinutes: date_fns_1.differenceInMinutes,
21
+ isSameDay: date_fns_1.isSameDay,
22
+ isThisYear: date_fns_1.isThisYear,
23
+ };