xmlui 0.10.21 → 0.10.23

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 (40) hide show
  1. package/dist/lib/{index-BiS4wEuu.mjs → index-CuPvcayg.mjs} +1198 -828
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-CB_cMi6U.mjs → initMock-BBdNO6FB.mjs} +1 -1
  4. package/dist/lib/language-server-web-worker.mjs +1 -1
  5. package/dist/lib/language-server.mjs +1 -1
  6. package/dist/lib/{metadata-utils-BTIt1_wE.mjs → metadata-utils-Dx-2qZBh.mjs} +5 -4
  7. package/dist/lib/{server-common-DYZtsdM7.mjs → server-common--BHVvP1o.mjs} +1 -1
  8. package/dist/lib/xmlui-parser.d.ts +1 -1
  9. package/dist/lib/xmlui.d.ts +34 -1
  10. package/dist/lib/xmlui.mjs +1 -1
  11. package/dist/metadata/{collectedComponentMetadata-MFUg6aSX.mjs → collectedComponentMetadata-Cp3Ljk8F.mjs} +1192 -822
  12. package/dist/metadata/{initMock-Dw9wrVkQ.mjs → initMock-Dki8247s.mjs} +1 -1
  13. package/dist/metadata/style.css +1 -1
  14. package/dist/metadata/xmlui-metadata.mjs +1 -1
  15. package/dist/metadata/xmlui-metadata.umd.js +3 -3
  16. package/dist/scripts/package.json +1 -1
  17. package/dist/scripts/src/components/AppHeader/AppHeader.js +6 -1
  18. package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +7 -4
  19. package/dist/scripts/src/components/Button/Button.js +7 -0
  20. package/dist/scripts/src/components/ComponentProvider.js +31 -2
  21. package/dist/scripts/src/components/Form/Form.js +3 -0
  22. package/dist/scripts/src/components/Form/FormNative.js +12 -2
  23. package/dist/scripts/src/components/Heading/Heading.js +5 -4
  24. package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +13 -0
  25. package/dist/scripts/src/components/Pages/Pages.js +11 -0
  26. package/dist/scripts/src/components/Tabs/TabContext.js +26 -17
  27. package/dist/scripts/src/components/Tabs/TabItemNative.js +7 -2
  28. package/dist/scripts/src/components/Tabs/Tabs.js +22 -3
  29. package/dist/scripts/src/components/Tabs/Tabs.spec.js +362 -0
  30. package/dist/scripts/src/components/Tabs/TabsNative.js +28 -4
  31. package/dist/scripts/src/components/Text/Text.js +4 -4
  32. package/dist/scripts/src/components-core/StandaloneApp.js +1 -1
  33. package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +118 -7
  34. package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +3 -4
  35. package/dist/scripts/src/components-core/theming/component-layout-resolver.js +4 -4
  36. package/dist/scripts/src/components-core/theming/parse-layout-props.js +38 -0
  37. package/dist/standalone/xmlui-standalone.es.d.ts +36 -1
  38. package/dist/standalone/xmlui-standalone.umd.js +36 -36
  39. package/package.json +1 -1
  40. package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +0 -50
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmlui",
3
- "version": "0.10.21",
3
+ "version": "0.10.23",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "start-test-bed": "cd src/testing/infrastructure && xmlui start",
@@ -34,6 +34,11 @@ exports.AppHeaderMd = (0, metadata_helpers_1.createMetadata)({
34
34
  valueType: "boolean",
35
35
  defaultValue: AppHeaderNative_1.defaultProps.showLogo,
36
36
  },
37
+ showNavPanelIf: {
38
+ description: "Determines if the navigation panel should be displayed",
39
+ valueType: "boolean",
40
+ defaultValue: AppHeaderNative_1.defaultProps.showNavPanelIf,
41
+ },
37
42
  },
38
43
  themeVars: (0, themeVars_1.parseScssVar)(AppHeader_module_scss_1.default.themeVars),
39
44
  themeVarDescriptions: {
@@ -48,7 +53,7 @@ exports.appHeaderComponentRenderer = (0, renderers_1.createComponentRenderer)(CO
48
53
  // --- Convert the plain (text) logo template into component definition
49
54
  const logoTemplate = node.props.logoTemplate || ((_a = node.slots) === null || _a === void 0 ? void 0 : _a.logoSlot);
50
55
  const titleTemplate = node.props.titleTemplate || ((_b = node.slots) === null || _b === void 0 ? void 0 : _b.titleSlot);
51
- return ((0, jsx_runtime_1.jsx)(AppHeaderNative_1.AppContextAwareAppHeader, { profileMenu: renderChild(extractValue(node.props.profileMenuTemplate, true)), title: extractValue(node.props.title), showLogo: extractValue.asOptionalBoolean(node.props.showLogo), titleContent: titleTemplate && ((0, jsx_runtime_1.jsx)(SlotItem_1.SlotItem, { node: titleTemplate, renderChild: renderChild, slotProps: { title: extractValue(node.props.title) } })), logoContent: renderChild(logoTemplate, {
56
+ return ((0, jsx_runtime_1.jsx)(AppHeaderNative_1.AppContextAwareAppHeader, { profileMenu: renderChild(extractValue(node.props.profileMenuTemplate, true)), title: extractValue(node.props.title), showLogo: extractValue.asOptionalBoolean(node.props.showLogo), showNavPanelIf: extractValue.asOptionalBoolean(node.props.showNavPanelIf, AppHeaderNative_1.defaultProps.showNavPanelIf), titleContent: titleTemplate && ((0, jsx_runtime_1.jsx)(SlotItem_1.SlotItem, { node: titleTemplate, renderChild: renderChild, slotProps: { title: extractValue(node.props.title) } })), logoContent: renderChild(logoTemplate, {
52
57
  type: "Stack",
53
58
  orientation: "horizontal",
54
59
  }), className: (0, classnames_1.default)(layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.themeClassName, className), renderChild: renderChild, children: renderChild(node.children, {
@@ -32,6 +32,7 @@ const NavLinkNative_1 = require("../../components/NavLink/NavLinkNative");
32
32
  const hooks_1 = require("../../components-core/utils/hooks");
33
33
  exports.defaultProps = {
34
34
  showLogo: true,
35
+ showNavPanelIf: true,
35
36
  };
36
37
  function useLogoUrl() {
37
38
  const { logo, logoLight, logoDark } = (0, AppLayoutContext_1.useAppLayoutContext)() || {};
@@ -45,25 +46,27 @@ function useLogoUrl() {
45
46
  return toneLogoUrl || baseLogoUrl;
46
47
  }
47
48
  const AppHeader = (_a) => {
48
- var { children, profileMenu, style = constants_1.EMPTY_OBJECT, logoContent, className, canRestrictContentWidth, navPanelVisible = true, toggleDrawer, showLogo = exports.defaultProps.showLogo, hasRegisteredNavPanel, title, titleContent, registerSubNavPanelSlot } = _a, rest = __rest(_a, ["children", "profileMenu", "style", "logoContent", "className", "canRestrictContentWidth", "navPanelVisible", "toggleDrawer", "showLogo", "hasRegisteredNavPanel", "title", "titleContent", "registerSubNavPanelSlot"]);
49
+ var { children, profileMenu, style = constants_1.EMPTY_OBJECT, logoContent, className, canRestrictContentWidth, navPanelVisible = true, toggleDrawer, showLogo = exports.defaultProps.showLogo, showNavPanelIf = exports.defaultProps.showNavPanelIf, hasRegisteredNavPanel, title, titleContent, registerSubNavPanelSlot } = _a, rest = __rest(_a, ["children", "profileMenu", "style", "logoContent", "className", "canRestrictContentWidth", "navPanelVisible", "toggleDrawer", "showLogo", "showNavPanelIf", "hasRegisteredNavPanel", "title", "titleContent", "registerSubNavPanelSlot"]);
49
50
  const { mediaSize } = (0, AppContext_1.useAppContext)();
50
51
  const logoUrl = useLogoUrl();
51
52
  const subNavPanelSlot = (0, react_1.useRef)(null);
53
+ const effectiveNavPanelVisible = navPanelVisible && showNavPanelIf;
52
54
  const safeLogoTitle = mediaSize.sizeIndex < 2 ? null : !titleContent && title ? ((0, jsx_runtime_1.jsx)(NavLinkNative_1.NavLink, { to: "/", displayActive: false, style: { paddingLeft: 0 }, children: title })) : (titleContent);
53
55
  (0, hooks_1.useIsomorphicLayoutEffect)(() => {
54
56
  registerSubNavPanelSlot === null || registerSubNavPanelSlot === void 0 ? void 0 : registerSubNavPanelSlot(subNavPanelSlot.current);
55
57
  }, []);
56
58
  return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.header, className), style: style, role: "banner", children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.headerInner, {
57
59
  [AppHeader_module_scss_1.default.full]: !canRestrictContentWidth,
58
- }), children: [hasRegisteredNavPanel && ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: toggleDrawer, icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "hamburger" }), variant: "ghost", className: AppHeader_module_scss_1.default.drawerToggle, style: { color: "inherit", flexShrink: 0 } })), (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.logoAndTitle, children: (showLogo || !navPanelVisible) &&
60
+ }), children: [hasRegisteredNavPanel && showNavPanelIf && ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: toggleDrawer, icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "hamburger" }), variant: "ghost", className: AppHeader_module_scss_1.default.drawerToggle, style: { color: "inherit", flexShrink: 0 } })), (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.logoAndTitle, children: (showLogo || !effectiveNavPanelVisible) &&
59
61
  (logoContent ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.customLogoContainer, children: logoContent }), safeLogoTitle] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!logoUrl && ((0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.logoContainer, children: (0, jsx_runtime_1.jsx)(NavLinkNative_1.NavLink, { to: "/", displayActive: false, className: AppHeader_module_scss_1.default.logoLink, children: (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) }) })), safeLogoTitle] }))) }), (0, jsx_runtime_1.jsx)("div", { ref: subNavPanelSlot, className: AppHeader_module_scss_1.default.subNavPanelSlot }), (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.childrenWrapper, children: children }), profileMenu && (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.rightItems, children: profileMenu })] }) })));
60
62
  };
61
63
  exports.AppHeader = AppHeader;
62
- function AppContextAwareAppHeader({ children, logoContent, profileMenu, style, className, title, titleContent, showLogo = true, renderChild, }) {
64
+ function AppContextAwareAppHeader({ children, logoContent, profileMenu, style, className, title, titleContent, showLogo = true, showNavPanelIf = exports.defaultProps.showNavPanelIf, renderChild, }) {
63
65
  const appLayoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
64
66
  const { navPanelVisible, toggleDrawer, layout, hasRegisteredNavPanel, navPanelDef, logoContentDef, registerSubNavPanelSlot, } = appLayoutContext || {};
65
67
  // console.log("APP LAYOUT CONTEXT", appLayoutContext);
66
68
  const displayLogo = layout !== "vertical" && layout !== "vertical-sticky" && showLogo;
67
69
  const canRestrictContentWidth = layout !== "vertical-full-header";
68
- return ((0, jsx_runtime_1.jsxs)(exports.AppHeader, { hasRegisteredNavPanel: hasRegisteredNavPanel, navPanelVisible: navPanelVisible, toggleDrawer: toggleDrawer, canRestrictContentWidth: canRestrictContentWidth, showLogo: displayLogo, logoContent: logoContent || renderChild(logoContentDef), profileMenu: profileMenu, style: style, className: className, title: title, titleContent: titleContent, registerSubNavPanelSlot: registerSubNavPanelSlot, children: [(layout === null || layout === void 0 ? void 0 : layout.startsWith("condensed")) && navPanelVisible && ((0, jsx_runtime_1.jsx)("div", { style: { minWidth: 0 }, children: renderChild(navPanelDef) })), children] }));
70
+ const effectiveNavPanelVisible = navPanelVisible && showNavPanelIf;
71
+ return ((0, jsx_runtime_1.jsxs)(exports.AppHeader, { hasRegisteredNavPanel: hasRegisteredNavPanel, navPanelVisible: effectiveNavPanelVisible, toggleDrawer: toggleDrawer, canRestrictContentWidth: canRestrictContentWidth, showLogo: displayLogo, showNavPanelIf: showNavPanelIf, logoContent: logoContent || renderChild(logoContentDef), profileMenu: profileMenu, style: style, className: className, title: title, titleContent: titleContent, registerSubNavPanelSlot: registerSubNavPanelSlot, children: [(layout === null || layout === void 0 ? void 0 : layout.startsWith("condensed")) && effectiveNavPanelVisible && ((0, jsx_runtime_1.jsx)("div", { style: { minWidth: 0 }, children: renderChild(navPanelDef) })), children] }));
69
72
  }
@@ -99,11 +99,18 @@ exports.ButtonMd = (0, metadata_helpers_1.createMetadata)({
99
99
  },
100
100
  themeVars: (0, themeVars_1.parseScssVar)(Button_module_scss_1.default.themeVars),
101
101
  defaultThemeVars: {
102
+ // --- Default styles for supporting "variant" behavior
103
+ [`padding-${COMP}`]: "$space-2 $space-4",
104
+ [`gap-${COMP}`]: "$space-2",
105
+ [`borderColor-${COMP}`]: "transparent",
106
+ [`backgroundColor-${COMP}`]: "transparent",
107
+ [`transition-${COMP}`]: "color 0.2s, background 0.2s",
102
108
  [`width-${COMP}`]: "fit-content",
103
109
  [`height-${COMP}`]: "fit-content",
104
110
  [`borderRadius-${COMP}`]: "$borderRadius",
105
111
  [`fontSize-${COMP}`]: "$fontSize-sm",
106
112
  [`fontWeight-${COMP}`]: "$fontWeight-medium",
113
+ [`fontStyle-${COMP}`]: "$fontStyle-normal",
107
114
  [`backgroundColor-${COMP}-primary`]: "$color-primary-500",
108
115
  [`backgroundColor-${COMP}-attention`]: "$backgroundColor-attention",
109
116
  [`borderColor-${COMP}-attention`]: "$color-attention",
@@ -74,6 +74,7 @@ const FileDownloadAction_1 = require("../components-core/action/FileDownloadActi
74
74
  const FileUploadAction_1 = require("../components-core/action/FileUploadAction");
75
75
  const NavigateAction_1 = require("../components-core/action/NavigateAction");
76
76
  const TimedAction_1 = require("../components-core/action/TimedAction");
77
+ const CoreBehaviors_1 = require("../components-core/behaviors/CoreBehaviors");
77
78
  const ApiLoader_1 = require("../components-core/loader/ApiLoader");
78
79
  const ExternalDataLoader_1 = require("../components-core/loader/ExternalDataLoader");
79
80
  const MockLoaderRenderer_1 = require("../components-core/loader/MockLoaderRenderer");
@@ -149,7 +150,7 @@ class ComponentRegistry {
149
150
  * about component registrations
150
151
  */
151
152
  constructor(contributes = {}, extensionManager) {
152
- var _a, _b, _c;
153
+ var _a, _b, _c, _d;
153
154
  this.extensionManager = extensionManager;
154
155
  // --- The pool of available components
155
156
  this.pool = new Map(); // namespace -> name -> ComponentRegistryEntry;
@@ -162,6 +163,8 @@ class ComponentRegistry {
162
163
  this.actionFns = new Map();
163
164
  // --- The pool of available loader renderers
164
165
  this.loaders = new Map();
166
+ // --- The pool of available behaviors
167
+ this.behaviors = [];
165
168
  this.extensionRegistered = (extension) => {
166
169
  var _a;
167
170
  (_a = extension.components) === null || _a === void 0 ? void 0 : _a.forEach((c) => {
@@ -656,7 +659,15 @@ class ComponentRegistry {
656
659
  this.registerLoaderRenderer(ExternalDataLoader_1.externalDataLoaderRenderer);
657
660
  this.registerLoaderRenderer(MockLoaderRenderer_1.mockLoaderRenderer);
658
661
  this.registerLoaderRenderer(DataLoader_1.dataLoaderRenderer);
659
- (_c = this.extensionManager) === null || _c === void 0 ? void 0 : _c.subscribeToRegistrations(this.extensionRegistered);
662
+ this.registerBehavior(CoreBehaviors_1.variantBehavior);
663
+ this.registerBehavior(CoreBehaviors_1.tooltipBehavior);
664
+ this.registerBehavior(CoreBehaviors_1.animationBehavior);
665
+ this.registerBehavior(CoreBehaviors_1.labelBehavior);
666
+ // Register external behaviors from contributes
667
+ (_c = contributes.behaviors) === null || _c === void 0 ? void 0 : _c.forEach((behavior) => {
668
+ this.registerBehavior(behavior);
669
+ });
670
+ (_d = this.extensionManager) === null || _d === void 0 ? void 0 : _d.subscribeToRegistrations(this.extensionRegistered);
660
671
  }
661
672
  /**
662
673
  * All theme variables used by the registered components.
@@ -761,6 +772,24 @@ class ComponentRegistry {
761
772
  registerActionFn({ actionName: functionName, actionFn }) {
762
773
  this.actionFns.set(functionName, actionFn);
763
774
  }
775
+ // --- Registers a behavior
776
+ registerBehavior(behavior, location = "after", position) {
777
+ // If position is specified, insert relative to that behavior
778
+ if (position) {
779
+ const targetIndex = this.behaviors.findIndex((b) => b.name === position);
780
+ if (targetIndex !== -1) {
781
+ const insertIndex = location === "before" ? targetIndex : targetIndex + 1;
782
+ this.behaviors.splice(insertIndex, 0, behavior);
783
+ return;
784
+ }
785
+ }
786
+ // Default: append to the end
787
+ this.behaviors.push(behavior);
788
+ }
789
+ // --- Returns all registered behaviors
790
+ getBehaviors() {
791
+ return this.behaviors;
792
+ }
764
793
  }
765
794
  exports.ComponentRegistry = ComponentRegistry;
766
795
  /**
@@ -90,6 +90,9 @@ exports.FormMd = (0, metadata_helpers_1.createMetadata)({
90
90
  _data_url: (0, metadata_helpers_1.dInternal)("when we have an api bound data prop, we inject the url here"),
91
91
  },
92
92
  events: {
93
+ willSubmit: (0, metadata_helpers_1.d)(`The form infrastructure fires this event just before the form is submitted. The event argument ` +
94
+ `is the current \`data\` value to be submitted. You can cancel the submission by returning ` +
95
+ `\`false\` from the event handler.`),
93
96
  submit: (0, metadata_helpers_1.d)(`The form infrastructure fires this event when the form is submitted. The event argument ` +
94
97
  `is the current \`data\` value to save.`),
95
98
  success: (0, metadata_helpers_1.d)("The form infrastructure fires this event when the form is submitted successfully."),
@@ -203,7 +203,7 @@ function cleanUpSubject(subject) {
203
203
  }, {});
204
204
  }
205
205
  const Form = (0, react_2.forwardRef)(function (_a, ref) {
206
- var { formState, dispatch, initialValue = constants_1.EMPTY_OBJECT, children, style, className, enabled = true, cancelLabel = exports.defaultProps.cancelLabel, saveLabel = exports.defaultProps.saveLabel, saveInProgressLabel = exports.defaultProps.saveInProgressLabel, swapCancelAndSave, onSubmit, onCancel, onReset, onSuccess, buttonRow, id, registerComponentApi, itemLabelBreak = exports.defaultProps.itemLabelBreak, itemLabelWidth, itemLabelPosition = exports.defaultProps.itemLabelPosition, keepModalOpenOnSubmit = exports.defaultProps.keepModalOpenOnSubmit, hideButtonRowUntilDirty } = _a, rest = __rest(_a, ["formState", "dispatch", "initialValue", "children", "style", "className", "enabled", "cancelLabel", "saveLabel", "saveInProgressLabel", "swapCancelAndSave", "onSubmit", "onCancel", "onReset", "onSuccess", "buttonRow", "id", "registerComponentApi", "itemLabelBreak", "itemLabelWidth", "itemLabelPosition", "keepModalOpenOnSubmit", "hideButtonRowUntilDirty"]);
206
+ var { formState, dispatch, initialValue = constants_1.EMPTY_OBJECT, children, style, className, enabled = true, cancelLabel = exports.defaultProps.cancelLabel, saveLabel = exports.defaultProps.saveLabel, saveInProgressLabel = exports.defaultProps.saveInProgressLabel, swapCancelAndSave, onWillSubmit, onSubmit, onCancel, onReset, onSuccess, buttonRow, id, registerComponentApi, itemLabelBreak = exports.defaultProps.itemLabelBreak, itemLabelWidth, itemLabelPosition = exports.defaultProps.itemLabelPosition, keepModalOpenOnSubmit = exports.defaultProps.keepModalOpenOnSubmit, hideButtonRowUntilDirty } = _a, rest = __rest(_a, ["formState", "dispatch", "initialValue", "children", "style", "className", "enabled", "cancelLabel", "saveLabel", "saveInProgressLabel", "swapCancelAndSave", "onWillSubmit", "onSubmit", "onCancel", "onReset", "onSuccess", "buttonRow", "id", "registerComponentApi", "itemLabelBreak", "itemLabelWidth", "itemLabelPosition", "keepModalOpenOnSubmit", "hideButtonRowUntilDirty"]);
207
207
  const formRef = (0, react_2.useRef)(null);
208
208
  const [confirmSubmitModalVisible, setConfirmSubmitModalVisible] = (0, react_2.useState)(false);
209
209
  const requestModalFormClose = (0, ModalVisibilityContext_1.useModalFormClose)();
@@ -271,6 +271,12 @@ const Form = (0, react_2.forwardRef)(function (_a, ref) {
271
271
  dispatch((0, formActions_1.formSubmitting)());
272
272
  try {
273
273
  const filteredSubject = cleanUpSubject(formState.subject);
274
+ const canSubmit = yield (onWillSubmit === null || onWillSubmit === void 0 ? void 0 : onWillSubmit(filteredSubject));
275
+ if (canSubmit === false) {
276
+ // --- We do not reset the form but allow the next submit.
277
+ dispatch((0, formActions_1.backendValidationArrived)({ generalValidationResults: [], fieldValidationResults: {} }));
278
+ return;
279
+ }
274
280
  const result = yield (onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(filteredSubject, {
275
281
  passAsDefaultBody: true,
276
282
  }));
@@ -397,7 +403,11 @@ exports.FormWithContextVar = (0, react_2.forwardRef)(function ({ node, renderChi
397
403
  extractValue.asOptionalString(node.props._data_url);
398
404
  const itemLabelWidth = extractValue.asOptionalString(node.props.itemLabelWidth);
399
405
  const { cssProps: itemLabelWidthCssProps } = (0, layout_resolver_1.resolveLayoutProps)({ width: itemLabelWidth });
400
- return ((0, jsx_runtime_1.jsx)(react_slot_1.Slot, { ref: ref, style: style, children: (0, jsx_runtime_1.jsx)(Form, { keepModalOpenOnSubmit: extractValue.asOptionalBoolean(node.props.keepModalOpenOnSubmit), itemLabelPosition: extractValue.asOptionalString(node.props.itemLabelPosition), itemLabelBreak: extractValue.asOptionalBoolean(node.props.itemLabelBreak), itemLabelWidth: itemLabelWidthCssProps.width, hideButtonRowUntilDirty: extractValue.asOptionalBoolean(node.props.hideButtonRowUntilDirty), formState: formState, dispatch: dispatch, id: node.uid, className: className, cancelLabel: extractValue(node.props.cancelLabel), saveLabel: extractValue(node.props.saveLabel), saveInProgressLabel: extractValue(node.props.saveInProgressLabel), swapCancelAndSave: extractValue.asOptionalBoolean(node.props.swapCancelAndSave, false), onSubmit: lookupEventHandler("submit", {
406
+ return ((0, jsx_runtime_1.jsx)(react_slot_1.Slot, { ref: ref, style: style, children: (0, jsx_runtime_1.jsx)(Form, { keepModalOpenOnSubmit: extractValue.asOptionalBoolean(node.props.keepModalOpenOnSubmit), itemLabelPosition: extractValue.asOptionalString(node.props.itemLabelPosition), itemLabelBreak: extractValue.asOptionalBoolean(node.props.itemLabelBreak), itemLabelWidth: itemLabelWidthCssProps.width, hideButtonRowUntilDirty: extractValue.asOptionalBoolean(node.props.hideButtonRowUntilDirty), formState: formState, dispatch: dispatch, id: node.uid, className: className, cancelLabel: extractValue(node.props.cancelLabel), saveLabel: extractValue(node.props.saveLabel), saveInProgressLabel: extractValue(node.props.saveInProgressLabel), swapCancelAndSave: extractValue.asOptionalBoolean(node.props.swapCancelAndSave, false), onWillSubmit: lookupEventHandler("willSubmit", {
407
+ context: {
408
+ $data,
409
+ },
410
+ }), onSubmit: lookupEventHandler("submit", {
401
411
  defaultHandler: submitUrl
402
412
  ? `(eventArgs)=> Actions.callApi({ url: "${submitUrl}", method: "${submitMethod}", body: eventArgs, inProgressNotificationMessage: "${inProgressNotificationMessage}", completedNotificationMessage: "${completedNotificationMessage}", errorNotificationMessage: "${errorNotificationMessage}" })`
403
413
  : undefined,
@@ -277,11 +277,12 @@ exports.H6Md = (0, metadata_helpers_1.createMetadata)({
277
277
  },
278
278
  },
279
279
  });
280
- function renderHeading({ node, extractValue, className, level, showAnchor, renderChild, registerComponentApi, }) {
281
- var _a, _b;
282
- const _c = node.props, { maxLines, preserveLinebreaks, ellipses } = _c, restProps = __rest(_c, ["maxLines", "preserveLinebreaks", "ellipses"]);
280
+ function renderHeading({ node, extractValue, className, level, renderChild, registerComponentApi, }) {
281
+ var _a, _b, _c;
282
+ const _d = node.props, { maxLines, preserveLinebreaks, ellipses, showAnchor } = _d, restProps = __rest(_d, ["maxLines", "preserveLinebreaks", "ellipses", "showAnchor"]);
283
283
  delete restProps.level; // Remove level from restProps as it is handled separately
284
- return ((0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, Object.assign({ uid: node.uid, level: ((_a = extractValue.asOptionalString(level)) !== null && _a !== void 0 ? _a : "h1"), maxLines: extractValue.asOptionalNumber(maxLines), preserveLinebreaks: extractValue.asOptionalBoolean(preserveLinebreaks, false), ellipses: extractValue.asOptionalBoolean(ellipses, true), showAnchor: extractValue.asOptionalBoolean(showAnchor), className: className, omitFromToc: extractValue.asOptionalBoolean((_b = node.props) === null || _b === void 0 ? void 0 : _b.omitFromToc), registerComponentApi: registerComponentApi }, (0, extractParam_1.resolveAndCleanProps)(restProps, extractValue), { children: extractValue.asDisplayText(node.props.value) || renderChild(node.children) })));
284
+ const showAnchorValue = extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.showAnchor);
285
+ return ((0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, Object.assign({ uid: node.uid, level: ((_b = extractValue.asOptionalString(level)) !== null && _b !== void 0 ? _b : "h1"), maxLines: extractValue.asOptionalNumber(maxLines), preserveLinebreaks: extractValue.asOptionalBoolean(preserveLinebreaks, false), ellipses: extractValue.asOptionalBoolean(ellipses, true), showAnchor: showAnchorValue, className: className, omitFromToc: extractValue.asOptionalBoolean((_c = node.props) === null || _c === void 0 ? void 0 : _c.omitFromToc), registerComponentApi: registerComponentApi }, (0, extractParam_1.resolveAndCleanProps)(restProps, extractValue), { children: extractValue.asDisplayText(node.props.value) || renderChild(node.children) })));
285
286
  }
286
287
  exports.headingComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.HeadingMd, ({ node, extractValue, className, renderChild, registerComponentApi }) => {
287
288
  return renderHeading({
@@ -141,6 +141,19 @@ exports.ModalDialog = react_1.default.forwardRef((_a, ref) => {
141
141
  const modalRef = (0, react_1.useRef)(null);
142
142
  const composedRef = ref ? (0, react_compose_refs_1.composeRefs)(ref, modalRef) : modalRef;
143
143
  const { isOpen, doClose, doOpen } = useModalOpenState(isInitiallyOpen, onOpen, onClose);
144
+ /**
145
+ * https://github.com/radix-ui/primitives/issues/3648
146
+ */
147
+ (0, react_1.useLayoutEffect)(() => {
148
+ return () => {
149
+ const root = document.getElementById("root");
150
+ if (root)
151
+ requestAnimationFrame(() => {
152
+ root.removeAttribute("aria-hidden");
153
+ document.body.style.pointerEvents = "auto";
154
+ });
155
+ };
156
+ }, []);
144
157
  (0, react_1.useEffect)(() => {
145
158
  var _a;
146
159
  if (isOpen) {
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.pagesRenderer = exports.PagesMd = exports.pageRenderer = exports.PageMd = void 0;
4
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const Pages_module_scss_1 = __importDefault(require("./Pages.module.scss"));
5
9
  const renderers_1 = require("../../components-core/renderers");
6
10
  const TableOfContentsContext_1 = require("../../components-core/TableOfContentsContext");
7
11
  const metadata_helpers_1 = require("../metadata-helpers");
8
12
  const PagesNative_1 = require("./PagesNative");
9
13
  const css_utils_1 = require("../../components-core/utils/css-utils");
14
+ const themeVars_1 = require("../../components-core/theming/themeVars");
10
15
  const PAGE = "Page";
11
16
  exports.PageMd = (0, metadata_helpers_1.createMetadata)({
12
17
  status: "stable",
@@ -37,6 +42,12 @@ exports.PagesMd = (0, metadata_helpers_1.createMetadata)({
37
42
  defaultValue: PagesNative_1.defaultProps.fallbackPath,
38
43
  },
39
44
  },
45
+ themeVars: (0, themeVars_1.parseScssVar)(Pages_module_scss_1.default.themeVars),
46
+ defaultThemeVars: {
47
+ [`paddingVertical-${COMP}`]: "$space-5",
48
+ [`paddingHorizontal-${COMP}`]: "$space-4",
49
+ [`gap-${COMP}`]: "$space-5",
50
+ },
40
51
  });
41
52
  exports.pagesRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.PagesMd, ({ node, extractValue, renderChild }) => {
42
53
  return ((0, jsx_runtime_1.jsx)(PagesNative_1.Pages, { fallbackPath: extractValue(node.props.fallbackPath), node: node, renderChild: renderChild, extractValue: extractValue }));
@@ -13,32 +13,41 @@ exports.TabContext = (0, react_1.createContext)({
13
13
  register: (tabItem) => { },
14
14
  unRegister: (innerId) => { },
15
15
  activeTabId: "",
16
+ getTabItems: () => [],
16
17
  });
17
18
  function useTabContextValue() {
18
19
  const [tabItems, setTabItems] = (0, react_1.useState)(constants_1.EMPTY_ARRAY);
20
+ const tabItemsRef = (0, react_1.useRef)(constants_1.EMPTY_ARRAY);
21
+ tabItemsRef.current = tabItems;
19
22
  const [activeTabId, setActiveTabId] = (0, react_1.useState)("");
23
+ const register = (0, react_1.useCallback)((tabItem) => {
24
+ setTabItems((0, immer_1.default)((draft) => {
25
+ const existing = draft.findIndex((col) => col.innerId === tabItem.innerId);
26
+ if (existing < 0) {
27
+ draft.push(tabItem);
28
+ }
29
+ else {
30
+ draft[existing] = tabItem;
31
+ }
32
+ }));
33
+ }, []);
34
+ const unRegister = (0, react_1.useCallback)((innerId) => {
35
+ setTabItems((0, immer_1.default)((draft) => {
36
+ return draft.filter((col) => col.innerId !== innerId);
37
+ }));
38
+ }, []);
39
+ const getTabItems = (0, react_1.useCallback)(() => {
40
+ return tabItemsRef.current;
41
+ }, []);
20
42
  const tabContextValue = (0, react_1.useMemo)(() => {
21
43
  return {
22
- register: (tabItem) => {
23
- setTabItems((0, immer_1.default)((draft) => {
24
- const existing = draft.findIndex((col) => col.innerId === tabItem.innerId);
25
- if (existing < 0) {
26
- draft.push(tabItem);
27
- }
28
- else {
29
- draft[existing] = tabItem;
30
- }
31
- }));
32
- },
33
- unRegister: (innerId) => {
34
- setTabItems((0, immer_1.default)((draft) => {
35
- return draft.filter((col) => col.innerId !== innerId);
36
- }));
37
- },
44
+ register,
45
+ unRegister,
38
46
  activeTabId,
39
47
  setActiveTabId,
48
+ getTabItems,
40
49
  };
41
- }, [activeTabId]);
50
+ }, [register, unRegister, activeTabId, getTabItems]);
42
51
  return {
43
52
  tabItems,
44
53
  tabContextValue,
@@ -21,9 +21,10 @@ const react_tabs_1 = require("@radix-ui/react-tabs");
21
21
  const Tabs_module_scss_1 = __importDefault(require("../Tabs/Tabs.module.scss"));
22
22
  const TabContext_1 = require("./TabContext");
23
23
  exports.TabItemComponent = (0, react_2.forwardRef)(function TabItemComponent(_a, forwardedRef) {
24
+ var _b;
24
25
  var { children, label, headerRenderer, style, id, activated } = _a, rest = __rest(_a, ["children", "label", "headerRenderer", "style", "id", "activated"]);
25
26
  const innerId = (0, react_2.useId)();
26
- const { register, unRegister, activeTabId } = (0, TabContext_1.useTabContext)();
27
+ const { register, unRegister, activeTabId, getTabItems } = (0, TabContext_1.useTabContext)();
27
28
  (0, react_2.useEffect)(() => {
28
29
  register({
29
30
  label,
@@ -44,5 +45,9 @@ exports.TabItemComponent = (0, react_2.forwardRef)(function TabItemComponent(_a,
44
45
  }, [activeTabId, innerId, activated]);
45
46
  if (activeTabId !== innerId)
46
47
  return null;
47
- return ((0, react_1.createElement)(react_tabs_1.Content, Object.assign({}, rest, { key: innerId, value: innerId, className: Tabs_module_scss_1.default.tabsContent, ref: forwardedRef, style: style }), children));
48
+ // Find the index of this tab for ordering
49
+ const tabItems = getTabItems();
50
+ const tabIndex = (_b = tabItems === null || tabItems === void 0 ? void 0 : tabItems.findIndex(item => item.innerId === innerId)) !== null && _b !== void 0 ? _b : 0;
51
+ const contentOrder = tabIndex * 2 + 1;
52
+ return ((0, react_1.createElement)(react_tabs_1.Content, Object.assign({}, rest, { key: innerId, value: innerId, className: Tabs_module_scss_1.default.tabsContent, ref: forwardedRef, style: Object.assign(Object.assign({}, style), { order: contentOrder }) }), children));
48
53
  });
@@ -24,11 +24,30 @@ exports.TabsMd = (0, metadata_helpers_1.createMetadata)({
24
24
  orientation: {
25
25
  description: `This property indicates the orientation of the component. In horizontal orientation, ` +
26
26
  `the tab sections are laid out on the left side of the content panel, while in vertical ` +
27
- `orientation, the buttons are at the top.`,
27
+ `orientation, the buttons are at the top. Note: This property is ignored when ` +
28
+ `accordionView is set to true.`,
28
29
  availableValues: ["horizontal", "vertical"],
29
30
  defaultValue: TabsNative_1.defaultProps.orientation,
30
31
  valueType: "string",
31
32
  },
33
+ tabAlignment: {
34
+ description: `This property controls how tabs are aligned within the tab header container in ` +
35
+ `horizontal orientation. Use 'start' to align tabs to the left, 'end' to align to the ` +
36
+ `right, 'center' to center the tabs, and 'stretch' to make tabs fill the full width ` +
37
+ `of the header. Note: This property is ignored when orientation is set to 'vertical' ` +
38
+ `or when accordionView is enabled.`,
39
+ availableValues: ["start", "end", "center", "stretch"],
40
+ defaultValue: TabsNative_1.defaultProps.tabAlignment,
41
+ valueType: "string",
42
+ },
43
+ accordionView: {
44
+ description: `When enabled, displays tabs in an accordion-like view where tab headers are stacked ` +
45
+ `vertically and only the active tab's content is visible. Each tab header remains visible ` +
46
+ `and clicking a header opens its content while closing others. When enabled, the ` +
47
+ `orientation property is ignored.`,
48
+ defaultValue: TabsNative_1.defaultProps.accordionView,
49
+ valueType: "boolean",
50
+ },
32
51
  headerTemplate: Object.assign({}, (0, metadata_helpers_1.dComponent)(`This property declares the template for the clickable tab area.`)),
33
52
  },
34
53
  events: {
@@ -67,10 +86,10 @@ exports.TabsMd = (0, metadata_helpers_1.createMetadata)({
67
86
  },
68
87
  });
69
88
  exports.tabsComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TabsMd, ({ extractValue, node, renderChild, className, registerComponentApi, lookupEventHandler }) => {
70
- var _a, _b, _c;
89
+ var _a, _b, _c, _d, _e;
71
90
  return ((0, jsx_runtime_1.jsx)(TabsNative_1.Tabs, { id: node === null || node === void 0 ? void 0 : node.uid, className: className, headerRenderer: ((_a = node === null || node === void 0 ? void 0 : node.props) === null || _a === void 0 ? void 0 : _a.headerTemplate)
72
91
  ? (item) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.headerTemplate, itemKey: "$header", contextVars: {
73
92
  $header: item,
74
93
  }, renderChild: renderChild }))
75
- : undefined, activeTab: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.activeTab), orientation: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.orientation), onDidChange: lookupEventHandler("didChange"), registerComponentApi: registerComponentApi, children: renderChild(node.children) }));
94
+ : undefined, activeTab: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.activeTab), orientation: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.orientation), tabAlignment: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.tabAlignment), accordionView: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.accordionView), onDidChange: lookupEventHandler("didChange"), registerComponentApi: registerComponentApi, children: renderChild(node.children) }));
76
95
  });