xmlui 0.10.22 → 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 (35) hide show
  1. package/dist/lib/{index-BaUZuvtZ.mjs → index-CuPvcayg.mjs} +471 -242
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-BVLjWJxZ.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 +3 -2
  10. package/dist/lib/xmlui.mjs +1 -1
  11. package/dist/metadata/{collectedComponentMetadata-MZbCI1Ki.mjs → collectedComponentMetadata-Cp3Ljk8F.mjs} +467 -238
  12. package/dist/metadata/{initMock-BkgwDrCY.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 +2 -1
  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/Text/Text.js +4 -4
  27. package/dist/scripts/src/components-core/StandaloneApp.js +1 -1
  28. package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +118 -7
  29. package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +1 -1
  30. package/dist/scripts/src/components-core/theming/component-layout-resolver.js +4 -4
  31. package/dist/scripts/src/components-core/theming/parse-layout-props.js +38 -0
  32. package/dist/standalone/xmlui-standalone.es.d.ts +3 -2
  33. package/dist/standalone/xmlui-standalone.umd.js +36 -36
  34. package/package.json +1 -1
  35. 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.22",
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",
@@ -659,6 +659,7 @@ class ComponentRegistry {
659
659
  this.registerLoaderRenderer(ExternalDataLoader_1.externalDataLoaderRenderer);
660
660
  this.registerLoaderRenderer(MockLoaderRenderer_1.mockLoaderRenderer);
661
661
  this.registerLoaderRenderer(DataLoader_1.dataLoaderRenderer);
662
+ this.registerBehavior(CoreBehaviors_1.variantBehavior);
662
663
  this.registerBehavior(CoreBehaviors_1.tooltipBehavior);
663
664
  this.registerBehavior(CoreBehaviors_1.animationBehavior);
664
665
  this.registerBehavior(CoreBehaviors_1.labelBehavior);
@@ -775,7 +776,7 @@ class ComponentRegistry {
775
776
  registerBehavior(behavior, location = "after", position) {
776
777
  // If position is specified, insert relative to that behavior
777
778
  if (position) {
778
- const targetIndex = this.behaviors.findIndex(b => b.name === position);
779
+ const targetIndex = this.behaviors.findIndex((b) => b.name === position);
779
780
  if (targetIndex !== -1) {
780
781
  const insertIndex = location === "before" ? targetIndex : targetIndex + 1;
781
782
  this.behaviors.splice(insertIndex, 0, behavior);
@@ -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 }));
@@ -162,10 +162,10 @@ exports.TextMd = (0, metadata_helpers_1.createMetadata)({
162
162
  [`backgroundColor-${COMP}-keyboard`]: "rgb(from $color-surface-100 r g b / 0.4)",
163
163
  [`borderColor-${COMP}-keyboard`]: "$color-surface-300",
164
164
  [`backgroundColor-${COMP}-marked`]: "rgb(from $color-primary-200 r g b / 0.4)",
165
- [`color-${COMP}-placeholder`]: "$color-surface-500",
166
- [`color-${COMP}-codefence`]: "$color-surface-900",
167
- [`color-${COMP}-subheading`]: "$textColor-secondary",
168
- [`color-${COMP}-secondary`]: "$textColor-secondary",
165
+ [`textColor-${COMP}-placeholder`]: "$color-surface-500",
166
+ [`textColor-${COMP}-codefence`]: "$color-surface-900",
167
+ [`textColor-${COMP}-subheading`]: "$textColor-secondary",
168
+ [`textColor-${COMP}-secondary`]: "$textColor-secondary",
169
169
  dark: {
170
170
  [`backgroundColor-${COMP}-marked`]: "rgb(from $color-primary-400 r g b / 0.4)",
171
171
  },
@@ -647,7 +647,7 @@ function useStandalone(standaloneAppDef, runtime = constants_1.EMPTY_OBJECT, ext
647
647
  }
648
648
  }
649
649
  resolvedRuntime.projectCompilation.components.push(compCompilation);
650
- const compoundComp = Object.assign(Object.assign({}, compWrapper.component), { component: Object.assign(Object.assign({}, compWrapper.component.component), { vars: Object.assign(Object.assign({}, compWrapper.component.component.vars), (_b = componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.component) === null || _b === void 0 ? void 0 : _b.vars) }) });
650
+ const compoundComp = Object.assign(Object.assign({}, compWrapper.component), { component: Object.assign(Object.assign({}, compWrapper.component.component), { vars: Object.assign(Object.assign({}, compWrapper.component.component.vars), (_b = componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.codeBehind) === null || _b === void 0 ? void 0 : _b.vars) }) });
651
651
  if (componentCodeBehind && "codeBehind" in componentCodeBehind) {
652
652
  compoundComp.component.functions = componentCodeBehind.codeBehind.functions;
653
653
  compoundComp.component.scriptError = componentCodeBehind.codeBehind.moduleErrors;
@@ -1,11 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCoreBehaviors = exports.labelBehavior = exports.animationBehavior = exports.tooltipBehavior = void 0;
3
+ exports.variantBehavior = exports.labelBehavior = exports.animationBehavior = exports.tooltipBehavior = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const AnimationNative_1 = require("../../components/Animation/AnimationNative");
7
7
  const ItemWithLabel_1 = require("../../components/FormItem/ItemWithLabel");
8
8
  const TooltipNative_1 = require("../../components/Tooltip/TooltipNative");
9
+ const StyleContext_1 = require("../theming/StyleContext");
10
+ const layout_resolver_1 = require("../theming/layout-resolver");
11
+ const parse_layout_props_1 = require("../theming/parse-layout-props");
12
+ const abstractions_1 = require("../../components/abstractions");
13
+ const BadgeNative_1 = require("../../components/Badge/BadgeNative");
9
14
  /**
10
15
  * Behavior for applying tooltips to components.
11
16
  */
@@ -17,7 +22,7 @@ exports.tooltipBehavior = {
17
22
  const tooltipMarkdown = (_b = node.props) === null || _b === void 0 ? void 0 : _b.tooltipMarkdown;
18
23
  return !!tooltipText || !!tooltipMarkdown;
19
24
  },
20
- attach: (context, node) => {
25
+ attach: (context, node, metadata) => {
21
26
  var _a, _b, _c;
22
27
  const { extractValue } = context;
23
28
  const tooltipText = extractValue((_a = context.node.props) === null || _a === void 0 ? void 0 : _a.tooltip, true);
@@ -36,7 +41,7 @@ exports.animationBehavior = {
36
41
  var _a;
37
42
  return !!((_a = node.props) === null || _a === void 0 ? void 0 : _a.animation);
38
43
  },
39
- attach: (context, node) => {
44
+ attach: (context, node, metadata) => {
40
45
  var _a, _b;
41
46
  const { extractValue } = context;
42
47
  const animation = extractValue((_a = context.node.props) === null || _a === void 0 ? void 0 : _a.animation, true);
@@ -68,7 +73,7 @@ exports.labelBehavior = {
68
73
  }
69
74
  return true;
70
75
  },
71
- attach: (context, node) => {
76
+ attach: (context, node, metadata) => {
72
77
  var _a;
73
78
  const { extractValue, node: componentNode, className } = context;
74
79
  const label = extractValue.asOptionalString(componentNode.props.label);
@@ -83,7 +88,113 @@ exports.labelBehavior = {
83
88
  return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, style: style, className: className, shrinkToLabel: shrinkToLabel, labelStyle: { pointerEvents: readOnly ? "none" : undefined }, isInputTemplateUsed: !!((_a = componentNode.props) === null || _a === void 0 ? void 0 : _a.inputTemplate), children: node }));
84
89
  },
85
90
  };
86
- const getCoreBehaviors = () => {
87
- return [exports.tooltipBehavior, exports.animationBehavior, exports.labelBehavior];
91
+ /**
92
+ * Behavior for applying custom variant styling to components with non-predefined variant values.
93
+ * For Button components, this only applies if the variant is not "solid", "outlined", or "ghost".
94
+ * For other components, it applies to any component with a variant prop.
95
+ *
96
+ * This behavior clones the rendered node and adds the generated CSS class directly,
97
+ * without wrapping in an additional component.
98
+ */
99
+ exports.variantBehavior = {
100
+ name: "variant",
101
+ canAttach: (node) => {
102
+ var _a;
103
+ const variant = (_a = node.props) === null || _a === void 0 ? void 0 : _a.variant;
104
+ // Must have a variant prop
105
+ if (!variant) {
106
+ return false;
107
+ }
108
+ // Special handling for Button component
109
+ if (node.type === "Button") {
110
+ // For Button, only attach if variant is NOT one of the predefined values
111
+ const variantStr = typeof variant === "string" ? variant : String(variant);
112
+ return !abstractions_1.buttonVariantValues.includes(variantStr);
113
+ }
114
+ // Special handling for Badge component
115
+ if (node.type === "Badge") {
116
+ // For Badge, only attach if variant is NOT one of the predefined values
117
+ const variantStr = typeof variant === "string" ? variant : String(variant);
118
+ return !BadgeNative_1.badgeVariantValues.includes(variantStr);
119
+ }
120
+ return true;
121
+ },
122
+ attach: (context, node, metadata) => {
123
+ var _a;
124
+ const { extractValue, node: componentNode } = context;
125
+ const variant = extractValue((_a = componentNode.props) === null || _a === void 0 ? void 0 : _a.variant, true);
126
+ const componentType = componentNode.type;
127
+ if (!variant || typeof variant !== "string") {
128
+ return node;
129
+ }
130
+ // Get theme variables from metadata
131
+ const themeVars = metadata === null || metadata === void 0 ? void 0 : metadata.themeVars;
132
+ // Validate that themeVars is a record object
133
+ if (!themeVars || typeof themeVars !== 'object' || Array.isArray(themeVars)) {
134
+ return node;
135
+ }
136
+ const themeVarKeys = Object.keys(themeVars);
137
+ if (themeVarKeys.length === 0) {
138
+ return node;
139
+ }
140
+ // Generate the variant style specification from metadata themeVars
141
+ const subject = `-${componentType}-${variant}`;
142
+ const variantSpec = {
143
+ "&": {},
144
+ "&:hover": {},
145
+ "&:active": {},
146
+ "&:disabled": {},
147
+ };
148
+ // Process each theme variable from metadata
149
+ for (const themeVar of themeVarKeys) {
150
+ const parsed = (0, parse_layout_props_1.parseLayoutProperty)(themeVar, true);
151
+ // Skip if parsing failed or returned an error string
152
+ if (typeof parsed === "string") {
153
+ continue;
154
+ }
155
+ const { property, states } = parsed;
156
+ // Convert camelCase property to CSS property name
157
+ const cssProperty = (0, parse_layout_props_1.toCssPropertyName)(property);
158
+ if (!cssProperty) {
159
+ continue;
160
+ }
161
+ // Determine which selector to use based on states
162
+ let selector = "&";
163
+ let stateSuffix = "";
164
+ if (states && states.length > 0) {
165
+ const state = states[0]; // Use first state
166
+ stateSuffix = `--${states.join("--")}`;
167
+ if (state === "hover") {
168
+ selector = "&:hover";
169
+ }
170
+ else if (state === "active") {
171
+ selector = "&:active";
172
+ }
173
+ else if (state === "disabled") {
174
+ selector = "&:disabled";
175
+ }
176
+ else if (state === "focus") {
177
+ selector = "&:focus";
178
+ }
179
+ }
180
+ // Generate CSS variable reference for this theme variable with variant suffix
181
+ //const cssVarValue = toCssVar(`$${property}${subject}${stateSuffix}`);
182
+ const cssVarValue = `var(--${layout_resolver_1.THEME_VAR_PREFIX}-${property}${subject}${stateSuffix}, ` +
183
+ `var(--${layout_resolver_1.THEME_VAR_PREFIX}-${property}-${componentType}))`;
184
+ // Add to appropriate selector in variant spec
185
+ if (!variantSpec[selector]) {
186
+ variantSpec[selector] = {};
187
+ }
188
+ variantSpec[selector][cssProperty] = cssVarValue;
189
+ }
190
+ // Generate the CSS class using useStyles hook
191
+ // eslint-disable-next-line react-hooks/rules-of-hooks
192
+ const customVariantClassName = (0, StyleContext_1.useStyles)(variantSpec);
193
+ // Clone the node and add the custom variant className
194
+ const existingClassName = node.props.className || "";
195
+ const newClassName = `${existingClassName} ${customVariantClassName || ""}`.trim();
196
+ return (0, react_1.cloneElement)(node, {
197
+ className: newClassName,
198
+ });
199
+ },
88
200
  };
89
- exports.getCoreBehaviors = getCoreBehaviors;
@@ -220,7 +220,7 @@ const ComponentAdapter = (0, react_1.forwardRef)(function ComponentAdapter(_a, r
220
220
  if (!isCompoundComponent) {
221
221
  for (const behavior of behaviors) {
222
222
  if (behavior.canAttach(rendererContext.node, descriptor)) {
223
- renderedNode = behavior.attach(rendererContext, renderedNode);
223
+ renderedNode = behavior.attach(rendererContext, renderedNode, descriptor);
224
224
  }
225
225
  }
226
226
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BASE_COMPONENT_PART = exports.THEME_VAR_PREFIX = void 0;
3
+ exports.specialResolvers = exports.BASE_COMPONENT_PART = exports.THEME_VAR_PREFIX = void 0;
4
4
  exports.resolveComponentLayoutProps = resolveComponentLayoutProps;
5
5
  const constants_1 = require("../constants");
6
6
  const parse_layout_props_1 = require("./parse-layout-props");
@@ -22,8 +22,8 @@ function resolveComponentLayoutProps(layoutProps = constants_1.EMPTY_OBJECT, lay
22
22
  const cssPropName = parsed.property;
23
23
  const appliedValue = (_a = value === null || value === void 0 ? void 0 : value.toString()) === null || _a === void 0 ? void 0 : _a.replace(themeVarCapturesRegex, (match) => toCssVar(match.trim()));
24
24
  // --- Some properties may need transformation
25
- const cssProps = cssPropName in specialResolvers
26
- ? specialResolvers[cssPropName](appliedValue, layoutContext)
25
+ const cssProps = cssPropName in exports.specialResolvers
26
+ ? exports.specialResolvers[cssPropName](appliedValue, layoutContext)
27
27
  : { [cssPropName]: appliedValue };
28
28
  // --- Check if the property belongs to one or more states
29
29
  const stateName = parsed.states && parsed.states.length > 0 ? parsed.states.join("&") : null;
@@ -93,7 +93,7 @@ function getOrientation(layoutContext) {
93
93
  function toCssVar(c) {
94
94
  return `var(--${exports.THEME_VAR_PREFIX}-${c.substring(1)})`;
95
95
  }
96
- const specialResolvers = {
96
+ exports.specialResolvers = {
97
97
  paddingHorizontal: (propValue) => ({
98
98
  paddingLeft: propValue,
99
99
  paddingRight: propValue,
@@ -1,7 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CSS_PROPERTY_EXCEPTIONS = void 0;
3
4
  exports.parseLayoutProperty = parseLayoutProperty;
5
+ exports.toCssPropertyName = toCssPropertyName;
4
6
  const AppContextDefs_1 = require("../../abstractions/AppContextDefs");
7
+ /**
8
+ * Mapping exceptions for camelCase property names to CSS property names.
9
+ * These properties don't follow the standard camelCase-to-kebab-case conversion.
10
+ */
11
+ exports.CSS_PROPERTY_EXCEPTIONS = {
12
+ textColor: "color",
13
+ paddingVertical: "",
14
+ paddingHorizontal: "",
15
+ marginVertical: "",
16
+ marginHorizontal: "",
17
+ borderVertical: "",
18
+ borderHorizontal: "",
19
+ };
5
20
  function parseLayoutProperty(prop, parseComponent = false) {
6
21
  if (!prop || typeof prop !== 'string') {
7
22
  return "Property string cannot be empty";
@@ -77,6 +92,29 @@ function parseLayoutProperty(prop, parseComponent = false) {
77
92
  }
78
93
  return result;
79
94
  }
95
+ /**
96
+ * Transforms a camelCase property name (as used in ParsedLayout.property)
97
+ * to its corresponding CSS style property name.
98
+ *
99
+ * Handles special cases defined in CSS_PROPERTY_EXCEPTIONS, otherwise
100
+ * converts camelCase to kebab-case (e.g., "fontSize" -> "font-size").
101
+ *
102
+ * @param property - The camelCase property name from ParsedLayout
103
+ * @returns The CSS property name in kebab-case or the mapped exception
104
+ *
105
+ * @example
106
+ * toCssPropertyName('fontSize') // returns 'font-size'
107
+ * toCssPropertyName('textColor') // returns 'color' (exception)
108
+ * toCssPropertyName('backgroundColor') // returns 'background-color'
109
+ */
110
+ function toCssPropertyName(property) {
111
+ // Check if there's a mapping exception
112
+ if (property in exports.CSS_PROPERTY_EXCEPTIONS) {
113
+ return exports.CSS_PROPERTY_EXCEPTIONS[property];
114
+ }
115
+ // Convert camelCase to kebab-case
116
+ return property.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
117
+ }
80
118
  function isValidPropertyName(name) {
81
119
  // CSS property names in camelCase - start with lowercase letter, can contain letters and numbers
82
120
  return /^[a-z][a-zA-Z0-9]*$/.test(name);
@@ -263,9 +263,10 @@ declare interface Behavior {
263
263
  * A function that attaches the behavior to the component's React node.
264
264
  * @param context The renderer context of the component.
265
265
  * @param node The React node to attach.
266
+ * @param metadata The metadata of the component.
266
267
  * @returns The attached React node.
267
268
  */
268
- attach: (context: RendererContext<any>, node: ReactNode) => ReactNode;
269
+ attach: (context: RendererContext<any>, node: ReactNode, metadata?: ComponentMetadata) => ReactNode;
269
270
  }
270
271
 
271
272
  declare type BINARY_EXPRESSION = typeof T_BINARY_EXPRESSION;
@@ -479,7 +480,7 @@ declare type ComponentMetadata<TProps extends Record<string, ComponentPropertyMe
479
480
  nonVisual?: boolean;
480
481
  childrenAsTemplate?: string;
481
482
  opaque?: boolean;
482
- themeVars?: Array<string>;
483
+ themeVars?: Record<string, string>;
483
484
  themeVarDescriptions?: Record<string, string>;
484
485
  defaultThemeVars?: DefaultThemeVars;
485
486
  toneSpecificThemeVars?: Record<string, Record<string, string>>;