xmlui 0.9.56 → 0.9.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/{apiInterceptorWorker-CDFLYTIQ.mjs → apiInterceptorWorker-uyd3MlHU.mjs} +1 -1
- package/dist/lib/{index-DRdbVRNd.mjs → index-BqBDeBdn.mjs} +11446 -11158
- package/dist/lib/index.css +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-4EQ6kQIM.mjs → metadata-utils-BXdiMJQN.mjs} +40 -31
- package/dist/lib/{server-common-C0cF2UTg.mjs → server-common-CN44QquQ.mjs} +1318 -739
- package/dist/lib/{transform-CgRMkbb0.mjs → transform-BboeJCuA.mjs} +798 -733
- package/dist/lib/xmlui-parser.d.ts +31 -6
- package/dist/lib/xmlui-parser.mjs +49 -42
- package/dist/lib/{xmlui-serializer-EDw51UFN.mjs → xmlui-serializer-D0p6Hyum.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +5 -4
- package/dist/lib/xmlui.mjs +2 -2
- package/dist/metadata/{apiInterceptorWorker-CL7I-FJl.mjs → apiInterceptorWorker-B4dqtAX9.mjs} +1 -1
- package/dist/metadata/{collectedComponentMetadata-J8g24vFO.mjs → collectedComponentMetadata-DFcuGgT_.mjs} +10743 -10367
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +110 -110
- package/dist/scripts/package.json +5 -4
- package/dist/scripts/src/components/APICall/APICall.js +12 -11
- package/dist/scripts/src/components/Accordion/Accordion.js +1 -1
- package/dist/scripts/src/components/App/App.js +3 -3
- package/dist/scripts/src/components/AppHeader/AppHeader.js +4 -2
- package/dist/scripts/src/components/AppState/AppState.js +4 -2
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +4 -2
- package/dist/scripts/src/components/Avatar/Avatar.js +4 -1
- package/dist/scripts/src/components/Badge/Badge.js +3 -1
- package/dist/scripts/src/components/Button/Button.js +3 -1
- package/dist/scripts/src/components/Card/Card.js +5 -2
- package/dist/scripts/src/components/Card/CardNative.js +2 -1
- package/dist/scripts/src/components/ChangeListener/ChangeListener.js +4 -2
- package/dist/scripts/src/components/Charts/BarChart/BarChart.js +4 -2
- package/dist/scripts/src/components/Charts/DonutChart/DonutChart.js +6 -5
- package/dist/scripts/src/components/Charts/LabelList/LabelList.js +4 -1
- package/dist/scripts/src/components/Charts/Legend/Legend.js +4 -1
- package/dist/scripts/src/components/Charts/LineChart/LineChart.js +4 -1
- package/dist/scripts/src/components/Charts/PieChart/PieChart.js +13 -7
- package/dist/scripts/src/components/Charts/PieChart/PieChartNative.js +9 -4
- package/dist/scripts/src/components/Checkbox/Checkbox.js +3 -2
- package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +1 -1
- package/dist/scripts/src/components/ColorPicker/ColorPicker.js +1 -1
- package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +2 -2
- package/dist/scripts/src/components/Column/Column.js +14 -12
- package/dist/scripts/src/components/ComponentProvider.js +4 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +4 -3
- package/dist/scripts/src/components/DatePicker/DatePicker.js +4 -1
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +18 -6
- package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +2 -2
- package/dist/scripts/src/components/ExpandableItem/ExpandableItem.js +6 -5
- package/dist/scripts/src/components/FileInput/FileInput.js +9 -4
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +2 -2
- package/dist/scripts/src/components/FlowLayout/FlowLayout.js +2 -2
- package/dist/scripts/src/components/FlowLayout/FlowLayoutNative.js +35 -6
- package/dist/scripts/src/components/Footer/Footer.js +4 -2
- package/dist/scripts/src/components/Form/Form.js +9 -3
- package/dist/scripts/src/components/Form/FormNative.js +12 -4
- package/dist/scripts/src/components/FormItem/FormItem.js +8 -9
- package/dist/scripts/src/components/FormSection/FormSection.js +2 -3
- package/dist/scripts/src/components/Heading/Heading.js +6 -3
- package/dist/scripts/src/components/HelloWorld/HelloWorld.js +103 -0
- package/dist/scripts/src/components/HelloWorld/HelloWorldNative.js +92 -0
- package/dist/scripts/src/components/Icon/Icon.js +4 -2
- package/dist/scripts/src/components/Image/Image.js +3 -2
- package/dist/scripts/src/components/Items/Items.js +7 -6
- package/dist/scripts/src/components/Link/Link.js +4 -2
- package/dist/scripts/src/components/Link/LinkNative.js +46 -1
- package/dist/scripts/src/components/List/List.js +10 -8
- package/dist/scripts/src/components/Logo/Logo.js +7 -5
- package/dist/scripts/src/components/Markdown/Markdown.js +6 -4
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +6 -7
- package/dist/scripts/src/components/NavGroup/NavGroup.js +4 -2
- package/dist/scripts/src/components/NavLink/NavLink.js +4 -2
- package/dist/scripts/src/components/NavPanel/NavPanel.js +5 -2
- package/dist/scripts/src/components/NavPanel/NavPanelNative.js +3 -3
- package/dist/scripts/src/components/NestedApp/NestedApp.js +2 -2
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +3 -4
- package/dist/scripts/src/components/NoResult/NoResult.js +1 -2
- package/dist/scripts/src/components/NumberBox/NumberBox.js +5 -3
- package/dist/scripts/src/components/Option/Option.js +5 -3
- package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +2 -2
- package/dist/scripts/src/components/Pages/Pages.js +7 -5
- package/dist/scripts/src/components/ProgressBar/ProgressBar.js +4 -1
- package/dist/scripts/src/components/Queue/Queue.js +2 -2
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +4 -3
- package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +1 -1
- package/dist/scripts/src/components/Redirect/Redirect.js +3 -3
- package/dist/scripts/src/components/Select/Select.js +7 -4
- package/dist/scripts/src/components/Select/SelectNative.js +1 -1
- package/dist/scripts/src/components/Slider/Slider.js +5 -3
- package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +2 -2
- package/dist/scripts/src/components/Spinner/Spinner.js +2 -2
- package/dist/scripts/src/components/Splitter/Splitter.js +3 -2
- package/dist/scripts/src/components/Stack/Stack.js +4 -1
- package/dist/scripts/src/components/StickyBox/StickyBox.js +2 -3
- package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +2 -0
- package/dist/scripts/src/components/Switch/Switch.js +1 -3
- package/dist/scripts/src/components/Table/Table.js +1 -2
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +2 -3
- package/dist/scripts/src/components/Tabs/TabItem.js +5 -2
- package/dist/scripts/src/components/Tabs/Tabs.js +9 -3
- package/dist/scripts/src/components/Text/Text.js +2 -2
- package/dist/scripts/src/components/TextArea/TextArea.js +2 -2
- package/dist/scripts/src/components/TextBox/TextBox.js +5 -4
- package/dist/scripts/src/components/Theme/NotificationToast.js +11 -0
- package/dist/scripts/src/components/Theme/Theme.js +2 -4
- package/dist/scripts/src/components/Theme/ThemeNative.js +4 -4
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +5 -5
- package/dist/scripts/src/components-core/Fragment.js +2 -1
- package/dist/scripts/src/components-core/RestApiProxy.js +10 -7
- package/dist/scripts/src/components-core/descriptorHelper.js +9 -0
- package/dist/scripts/src/components-core/rendering/AppContent.js +6 -2
- package/dist/scripts/src/components-core/theming/layout-resolver.js +18 -0
- package/dist/scripts/src/parsers/xmlui-parser/parser.js +42 -39
- package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +65 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +10 -8
- package/dist/scripts/src/parsers/xmlui-parser/utils.js +1 -2
- package/dist/standalone/xmlui-standalone.es.d.ts +5 -4
- package/dist/standalone/xmlui-standalone.umd.js +221 -221
- package/package.json +5 -4
|
@@ -10,8 +10,8 @@ const EmojiSelectorNative_1 = require("./EmojiSelectorNative");
|
|
|
10
10
|
const COMP = "EmojiSelector";
|
|
11
11
|
exports.EmojiSelectorMd = (0, ComponentDefs_1.createMetadata)({
|
|
12
12
|
status: "experimental",
|
|
13
|
-
description: `
|
|
14
|
-
|
|
13
|
+
description: "`EmojiSelector` enables users to browse, search and select emojis from " +
|
|
14
|
+
"their system's native emoji set.",
|
|
15
15
|
props: {
|
|
16
16
|
autoFocus: Object.assign(Object.assign({}, (0, metadata_helpers_1.dAutoFocus)()), { defaultValue: EmojiSelectorNative_1.defaultProps.autoFocus }),
|
|
17
17
|
},
|
|
@@ -14,8 +14,9 @@ const metadata_helpers_1 = require("../../components/metadata-helpers");
|
|
|
14
14
|
const ExpandableItemNative_1 = require("./ExpandableItemNative");
|
|
15
15
|
const COMP = "ExpandableItem";
|
|
16
16
|
exports.ExpandableItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
17
|
-
description: `
|
|
18
|
-
|
|
17
|
+
description: "`ExpandableItem` creates expandable/collapsible section, similar to the HTML " +
|
|
18
|
+
"details disclosure element. When the user clicks on the `summary` the content " +
|
|
19
|
+
"expands or collapses.",
|
|
19
20
|
props: {
|
|
20
21
|
summary: (0, metadata_helpers_1.dComponent)("The summary content that is always visible and acts as the trigger."),
|
|
21
22
|
initiallyExpanded: {
|
|
@@ -76,9 +77,9 @@ exports.ExpandableItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
76
77
|
[`paddingLeft-${COMP}`]: "$space-0",
|
|
77
78
|
[`paddingRight-${COMP}`]: "$space-0",
|
|
78
79
|
[`gap-${COMP}`]: "$space-2",
|
|
79
|
-
[`
|
|
80
|
-
[`
|
|
81
|
-
[`
|
|
80
|
+
[`paddingLeft-content-${COMP}`]: "$space-3",
|
|
81
|
+
[`paddingRight-content-${COMP}`]: "$space-3",
|
|
82
|
+
[`paddingVertical-content-${COMP}`]: "$space-2",
|
|
82
83
|
[`transition-${COMP}`]: "0.2s ease",
|
|
83
84
|
},
|
|
84
85
|
});
|
|
@@ -16,9 +16,11 @@ const FileInputNative_1 = require("./FileInputNative");
|
|
|
16
16
|
const COMP = "FileInput";
|
|
17
17
|
const DEFAULT_ICON = "browse:FileInput";
|
|
18
18
|
exports.FileInputMd = (0, ComponentDefs_1.createMetadata)({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
status: "stable",
|
|
20
|
+
description: "`FileInput` enables users to select files from their device's file system for " +
|
|
21
|
+
"upload or processing. It combines a text field displaying selected files with " +
|
|
22
|
+
"a customizable button that opens the system file browser. Use it for forms, " +
|
|
23
|
+
"media uploads, and document processing workflows.",
|
|
22
24
|
props: {
|
|
23
25
|
placeholder: (0, metadata_helpers_1.dPlaceholder)(),
|
|
24
26
|
initialValue: (0, metadata_helpers_1.dInitialValue)(),
|
|
@@ -42,7 +44,10 @@ exports.FileInputMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
42
44
|
`in the browser menu after clicking the input field button.`, null, "boolean")), { defaultValue: FileInputNative_1.defaultProps.multiple }),
|
|
43
45
|
directory: Object.assign(Object.assign({}, (0, ComponentDefs_1.d)(`This boolean property indicates whether the component allows selecting directories (\`true\`) ` +
|
|
44
46
|
`or files only (\`false\`).`, null, "boolean")), { defaultValue: FileInputNative_1.defaultProps.directory }),
|
|
45
|
-
buttonPosition: Object.assign(Object.assign({}, (0, ComponentDefs_1.d)(`This property determines the position of the button relative to the input field.`, [
|
|
47
|
+
buttonPosition: Object.assign(Object.assign({}, (0, ComponentDefs_1.d)(`This property determines the position of the button relative to the input field.`, [
|
|
48
|
+
"start",
|
|
49
|
+
"end",
|
|
50
|
+
])), { defaultValue: FileInputNative_1.defaultProps.buttonPosition }),
|
|
46
51
|
buttonSize: (0, ComponentDefs_1.d)("The size of the button (small, medium, large)", abstractions_1.sizeMd),
|
|
47
52
|
buttonThemeColor: (0, ComponentDefs_1.d)("The button color scheme (primary, secondary, attention)", abstractions_1.buttonThemeNames, "string", FileInputNative_1.defaultProps.buttonThemeColor),
|
|
48
53
|
},
|
|
@@ -12,8 +12,8 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
|
12
12
|
const FileUploadDropZoneNative_1 = require("./FileUploadDropZoneNative");
|
|
13
13
|
const COMP = "FileUploadDropZone";
|
|
14
14
|
exports.FileUploadDropZoneMd = (0, ComponentDefs_1.createMetadata)({
|
|
15
|
-
description: `
|
|
16
|
-
|
|
15
|
+
description: "`FileUploadDropZone` enables users to upload files by dragging and dropping " +
|
|
16
|
+
"files from their local file system onto a designated area within the UI.",
|
|
17
17
|
props: {
|
|
18
18
|
text: {
|
|
19
19
|
description: "With this property, you can change the default text to display when files " +
|
|
@@ -14,8 +14,8 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
|
14
14
|
const FlowLayoutNative_1 = require("./FlowLayoutNative");
|
|
15
15
|
const COMP = "FlowLayout";
|
|
16
16
|
exports.FlowLayoutMd = (0, ComponentDefs_1.createMetadata)({
|
|
17
|
-
description: "
|
|
18
|
-
"
|
|
17
|
+
description: "`FlowLayout` positions content in rows with automatic wrapping. When items " +
|
|
18
|
+
"exceed the available horizontal space, they automatically wrap to a new line.",
|
|
19
19
|
props: {
|
|
20
20
|
gap: {
|
|
21
21
|
description: `This property defines the gap between items in the same row and between rows. The ${COMP} ` +
|
|
@@ -24,6 +24,7 @@ const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
|
|
|
24
24
|
const css_utils_1 = require("../../components-core/utils/css-utils");
|
|
25
25
|
const hooks_1 = require("../../components-core/utils/hooks");
|
|
26
26
|
const layout_resolver_1 = require("../../components-core/theming/layout-resolver");
|
|
27
|
+
const AppContext_1 = require("../../components-core/AppContext");
|
|
27
28
|
const resolvedCssVars = {};
|
|
28
29
|
const FlowLayoutContext = (0, react_1.createContext)({
|
|
29
30
|
rowGap: 0,
|
|
@@ -35,6 +36,7 @@ exports.FlowItemBreak = FlowItemBreak;
|
|
|
35
36
|
exports.FlowItemWrapper = (0, react_1.forwardRef)(function FlowItemWrapper(_a, ref) {
|
|
36
37
|
var { children, forceBreak } = _a, restProps = __rest(_a, ["children", "forceBreak"]);
|
|
37
38
|
const { rowGap, columnGap, setNumberOfChildren } = (0, react_1.useContext)(FlowLayoutContext);
|
|
39
|
+
const { mediaSize } = (0, AppContext_1.useAppContext)();
|
|
38
40
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
39
41
|
setNumberOfChildren((prev) => prev + 1);
|
|
40
42
|
return () => {
|
|
@@ -62,7 +64,7 @@ exports.FlowItemWrapper = (0, react_1.forwardRef)(function FlowItemWrapper(_a, r
|
|
|
62
64
|
// },
|
|
63
65
|
// ).cssProps || {}
|
|
64
66
|
);
|
|
65
|
-
}, [_maxWidth, _minWidth, _width
|
|
67
|
+
}, [_maxWidth, _minWidth, _width]);
|
|
66
68
|
const resolvedWidth = (0, react_1.useMemo)(() => {
|
|
67
69
|
if (width && typeof width === "string" && width.startsWith("var(")) {
|
|
68
70
|
if (!resolvedCssVars[width]) {
|
|
@@ -76,14 +78,41 @@ exports.FlowItemWrapper = (0, react_1.forwardRef)(function FlowItemWrapper(_a, r
|
|
|
76
78
|
}, [_width, root, width]);
|
|
77
79
|
const isWidthPercentage = typeof resolvedWidth === "string" && resolvedWidth.endsWith("%");
|
|
78
80
|
const _columnGap = (0, css_utils_1.normalizeCssValueForCalc)(columnGap);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
let responsiveWidth;
|
|
82
|
+
if (isWidthPercentage) {
|
|
83
|
+
const percNumber = parseFloat(resolvedWidth);
|
|
84
|
+
if (mediaSize.sizeIndex <= 1) {
|
|
85
|
+
let percentage = percNumber * 4;
|
|
86
|
+
if (percentage > 50) {
|
|
87
|
+
responsiveWidth = `100%`;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
responsiveWidth = `min(${percentage}%, 100%)`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (mediaSize.sizeIndex <= 2) {
|
|
94
|
+
let percentage = percNumber * 3;
|
|
95
|
+
if (percentage >= 50 && percentage <= 75) {
|
|
96
|
+
responsiveWidth = `50%`;
|
|
97
|
+
}
|
|
98
|
+
else if (percentage > 75) {
|
|
99
|
+
responsiveWidth = `100%`;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
responsiveWidth = `min(${percentage}%, 100%)`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
responsiveWidth = `min(${width}, 100%)`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
responsiveWidth = `min(calc(${width} + ${_columnGap}), 100%)`;
|
|
111
|
+
}
|
|
81
112
|
const outerWrapperStyle = {
|
|
82
113
|
minWidth,
|
|
83
114
|
maxWidth,
|
|
84
|
-
width:
|
|
85
|
-
? `min(${width} * ${isViewportPhone ? "8" : isViewportTablet ? "4" : "1"}, 100%)`
|
|
86
|
-
: `min(calc(${width} + ${_columnGap}), 100%)`,
|
|
115
|
+
width: responsiveWidth,
|
|
87
116
|
paddingBottom: rowGap,
|
|
88
117
|
flex,
|
|
89
118
|
};
|
|
@@ -12,12 +12,14 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
|
12
12
|
const FooterNative_1 = require("./FooterNative");
|
|
13
13
|
const COMP = "Footer";
|
|
14
14
|
exports.FooterMd = (0, ComponentDefs_1.createMetadata)({
|
|
15
|
-
description: `
|
|
15
|
+
description: "`Footer` provides a designated area at the bottom of your application for " +
|
|
16
|
+
"footer content such as branding, copyright notices, or utility controls like " +
|
|
17
|
+
"theme toggles.",
|
|
16
18
|
themeVars: (0, themeVars_1.parseScssVar)(Footer_module_scss_1.default.themeVars),
|
|
17
19
|
limitThemeVarsToComponent: true,
|
|
18
20
|
defaultThemeVars: {
|
|
19
21
|
[`backgroundColor-${COMP}`]: "$backgroundColor-AppHeader",
|
|
20
|
-
[`
|
|
22
|
+
[`verticalAlignment-${COMP}`]: "center",
|
|
21
23
|
[`fontSize-${COMP}`]: "$fontSize-small",
|
|
22
24
|
[`textColor-${COMP}`]: "$textColor-secondary",
|
|
23
25
|
[`maxWidth-content-${COMP}`]: "$maxWidth-content",
|
|
@@ -14,9 +14,11 @@ const abstractions_1 = require("../abstractions");
|
|
|
14
14
|
const FormNative_1 = require("./FormNative");
|
|
15
15
|
const COMP = "Form";
|
|
16
16
|
exports.FormMd = (0, ComponentDefs_1.createMetadata)({
|
|
17
|
-
status: "
|
|
18
|
-
description: `
|
|
19
|
-
|
|
17
|
+
status: "stable",
|
|
18
|
+
description: "`Form` provides a structured container for collecting and validating user " +
|
|
19
|
+
"input, with built-in data binding, validation, and submission handling. It " +
|
|
20
|
+
"automatically manages form state and provides context for nested form controls " +
|
|
21
|
+
"to work together.",
|
|
20
22
|
props: {
|
|
21
23
|
buttonRowTemplate: (0, metadata_helpers_1.dComponent)(`This property allows defining a custom component to display the buttons at the bottom of the form.`),
|
|
22
24
|
itemLabelPosition: {
|
|
@@ -77,12 +79,16 @@ exports.FormMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
77
79
|
description: "This property sets the HTTP method to use when submitting the form data. If not " +
|
|
78
80
|
"defined, `put` is used when the form has initial data; otherwise, `post`.",
|
|
79
81
|
},
|
|
82
|
+
inProgressNotificationMessage: (0, ComponentDefs_1.d)("This property sets the message to display when the form is being submitted."),
|
|
83
|
+
completedNotificationMessage: (0, ComponentDefs_1.d)("This property sets the message to display when the form is submitted successfully."),
|
|
84
|
+
errorNotificationMessage: (0, ComponentDefs_1.d)("This property sets the message to display when the form submission fails."),
|
|
80
85
|
enabled: (0, metadata_helpers_1.dEnabled)(),
|
|
81
86
|
_data_url: (0, metadata_helpers_1.dInternal)("when we have an api bound data prop, we inject the url here"),
|
|
82
87
|
},
|
|
83
88
|
events: {
|
|
84
89
|
submit: (0, ComponentDefs_1.d)(`The form infrastructure fires this event when the form is submitted. The event argument ` +
|
|
85
90
|
`is the current \`data\` value to save.`),
|
|
91
|
+
success: (0, ComponentDefs_1.d)("The form infrastructure fires this event when the form is submitted successfully."),
|
|
86
92
|
cancel: (0, ComponentDefs_1.d)(`The form infrastructure fires this event when the form is canceled.`),
|
|
87
93
|
reset: (0, ComponentDefs_1.d)(`The form infrastructure fires this event when the form is reset.`),
|
|
88
94
|
},
|
|
@@ -181,7 +181,7 @@ function cleanUpSubject(subject) {
|
|
|
181
181
|
return acc;
|
|
182
182
|
}, {});
|
|
183
183
|
}
|
|
184
|
-
const Form = (0, react_1.forwardRef)(function ({ formState, dispatch, initialValue = constants_1.EMPTY_OBJECT, children, style, enabled = true, cancelLabel = exports.defaultProps.cancelLabel, saveLabel = exports.defaultProps.saveLabel, saveInProgressLabel = exports.defaultProps.saveInProgressLabel, swapCancelAndSave, onSubmit, onCancel, onReset, buttonRow, id, registerComponentApi, itemLabelBreak = exports.defaultProps.itemLabelBreak, itemLabelWidth, itemLabelPosition = exports.defaultProps.itemLabelPosition, keepModalOpenOnSubmit = exports.defaultProps.keepModalOpenOnSubmit, }, ref) {
|
|
184
|
+
const Form = (0, react_1.forwardRef)(function ({ formState, dispatch, initialValue = constants_1.EMPTY_OBJECT, children, style, enabled = true, cancelLabel = exports.defaultProps.cancelLabel, saveLabel = exports.defaultProps.saveLabel, saveInProgressLabel = exports.defaultProps.saveInProgressLabel, swapCancelAndSave, onSubmit, onCancel, onReset, onSuccess, buttonRow, id, registerComponentApi, itemLabelBreak = exports.defaultProps.itemLabelBreak, itemLabelWidth, itemLabelPosition = exports.defaultProps.itemLabelPosition, keepModalOpenOnSubmit = exports.defaultProps.keepModalOpenOnSubmit, }, ref) {
|
|
185
185
|
const formRef = (0, react_1.useRef)(null);
|
|
186
186
|
(0, react_1.useImperativeHandle)(ref, () => formRef.current);
|
|
187
187
|
const [confirmSubmitModalVisible, setConfirmSubmitModalVisible] = (0, react_1.useState)(false);
|
|
@@ -234,10 +234,11 @@ const Form = (0, react_1.forwardRef)(function ({ formState, dispatch, initialVal
|
|
|
234
234
|
dispatch((0, formActions_1.formSubmitting)());
|
|
235
235
|
try {
|
|
236
236
|
const filteredSubject = cleanUpSubject(formState.subject);
|
|
237
|
-
yield (onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(filteredSubject, {
|
|
238
|
-
passAsDefaultBody: true
|
|
237
|
+
const result = yield (onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(filteredSubject, {
|
|
238
|
+
passAsDefaultBody: true
|
|
239
239
|
}));
|
|
240
240
|
dispatch((0, formActions_1.formSubmitted)());
|
|
241
|
+
yield (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(result));
|
|
241
242
|
if (!keepModalOpenOnSubmit) {
|
|
242
243
|
requestModalFormClose();
|
|
243
244
|
}
|
|
@@ -348,11 +349,14 @@ function FormWithContextVar({ node, renderChild, extractValue, style, lookupEven
|
|
|
348
349
|
}, [$data, node.children]);
|
|
349
350
|
const initialValue = extractValue(node.props.data);
|
|
350
351
|
const submitMethod = extractValue.asOptionalString(node.props.submitMethod) || (initialValue ? "put" : "post");
|
|
352
|
+
const inProgressNotificationMessage = extractValue.asOptionalString(node.props.inProgressNotificationMessage) || "";
|
|
353
|
+
const completedNotificationMessage = extractValue.asOptionalString(node.props.completedNotificationMessage) || "";
|
|
354
|
+
const errorNotificationMessage = extractValue.asOptionalString(node.props.errorNotificationMessage) || "";
|
|
351
355
|
const submitUrl = extractValue.asOptionalString(node.props.submitUrl) ||
|
|
352
356
|
extractValue.asOptionalString(node.props._data_url);
|
|
353
357
|
return ((0, jsx_runtime_1.jsx)(Form, { keepModalOpenOnSubmit: extractValue.asOptionalBoolean(node.props.keepModalOpenOnSubmit), itemLabelPosition: extractValue.asOptionalString(node.props.itemLabelPosition), itemLabelBreak: extractValue.asOptionalBoolean(node.props.itemLabelBreak), itemLabelWidth: extractValue.asOptionalString(node.props.itemLabelWidth), formState: formState, dispatch: dispatch, id: node.uid, style: style, cancelLabel: extractValue(node.props.cancelLabel), saveLabel: extractValue(node.props.saveLabel), saveInProgressLabel: extractValue(node.props.saveInProgressLabel), swapCancelAndSave: extractValue.asOptionalBoolean(node.props.swapCancelAndSave, false), onSubmit: lookupEventHandler("submit", {
|
|
354
358
|
defaultHandler: submitUrl
|
|
355
|
-
? `(eventArgs)=> Actions.callApi({ url: "${submitUrl}", method: "${submitMethod}", body: eventArgs })`
|
|
359
|
+
? `(eventArgs)=> Actions.callApi({ url: "${submitUrl}", method: "${submitMethod}", body: eventArgs, inProgressNotificationMessage: "${inProgressNotificationMessage}", completedNotificationMessage: "${completedNotificationMessage}", errorNotificationMessage: "${errorNotificationMessage}" })`
|
|
356
360
|
: undefined,
|
|
357
361
|
context: {
|
|
358
362
|
$data,
|
|
@@ -365,6 +369,10 @@ function FormWithContextVar({ node, renderChild, extractValue, style, lookupEven
|
|
|
365
369
|
context: {
|
|
366
370
|
$data,
|
|
367
371
|
},
|
|
372
|
+
}), onSuccess: lookupEventHandler("success", {
|
|
373
|
+
context: {
|
|
374
|
+
$data,
|
|
375
|
+
},
|
|
368
376
|
}), initialValue: initialValue, buttonRow: renderChild(node.props.buttonRowTemplate), registerComponentApi: registerComponentApi, enabled: extractValue.asOptionalBoolean(node.props.enabled, true) &&
|
|
369
377
|
!extractValue.asOptionalBoolean(node.props.loading, false), children: renderChild(nodeWithItem) }));
|
|
370
378
|
}
|
|
@@ -29,10 +29,11 @@ const COMP = "FormItem";
|
|
|
29
29
|
// NOTE: We need to filter the "none" value out so that it doesn't show up in the docs.
|
|
30
30
|
const filteredValidationSeverityValues = FormContext_1.validationSeverityValues.filter((value) => value !== "none");
|
|
31
31
|
exports.FormItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
32
|
-
status: "
|
|
33
|
-
description: `
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
status: "stable",
|
|
33
|
+
description: "`FormItem` wraps individual input controls within a `Form`, providing data " +
|
|
34
|
+
"binding, validation, labeling, and layout functionality. It connects form " +
|
|
35
|
+
"controls to the parent form's data model and handles validation feedback " +
|
|
36
|
+
"automatically.",
|
|
36
37
|
props: {
|
|
37
38
|
bindTo: {
|
|
38
39
|
description: "This property binds a particular input field to one of the attributes of the \`Form\` data. " +
|
|
@@ -176,11 +177,9 @@ exports.FormItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
176
177
|
"The function has a single argument, the index to remove."),
|
|
177
178
|
},
|
|
178
179
|
contextVars: {
|
|
179
|
-
$value: (0, ComponentDefs_1.d)(
|
|
180
|
-
|
|
181
|
-
$
|
|
182
|
-
`single argument, the new value to set.`),
|
|
183
|
-
$validationResult: (0, ComponentDefs_1.d)(`This variable represents the result of the latest validation of the \`${COMP}\` instance.`),
|
|
180
|
+
$value: (0, ComponentDefs_1.d)("Current value of the FormItem, accessible in expressions and code snippets"),
|
|
181
|
+
$setValue: (0, ComponentDefs_1.d)("Function to set the FormItem's value programmatically"),
|
|
182
|
+
$validationResult: (0, ComponentDefs_1.d)("Current validation state and error messages for this field"),
|
|
184
183
|
},
|
|
185
184
|
themeVars: (0, themeVars_1.parseScssVar)(FormItem_module_scss_1.default.themeVars),
|
|
186
185
|
defaultThemeVars: {
|
|
@@ -8,9 +8,8 @@ const compound_utils_1 = require("../../components-core/utils/compound-utils");
|
|
|
8
8
|
const COMP = "FormSection";
|
|
9
9
|
exports.FormSectionMd = (0, ComponentDefs_1.createMetadata)({
|
|
10
10
|
status: "experimental",
|
|
11
|
-
description: `
|
|
12
|
-
|
|
13
|
-
`are placed in a [\`FlowLayout\`](./FlowLayout.mdx) component.`,
|
|
11
|
+
description: "`FormSection` groups elements within a `Form`. Child components are placed in " +
|
|
12
|
+
"a [FlowLayout](/components/FlowLayout).",
|
|
14
13
|
});
|
|
15
14
|
const componentSource = `
|
|
16
15
|
<Component name="FormSection">
|
|
@@ -44,7 +44,10 @@ const OMIT_FROM_TOC_DESC = {
|
|
|
44
44
|
defaultValue: HeadingNative_1.defaultProps.omitFromToc,
|
|
45
45
|
};
|
|
46
46
|
exports.HeadingMd = (0, ComponentDefs_1.createMetadata)({
|
|
47
|
-
description: "
|
|
47
|
+
description: "`Heading` displays hierarchical text headings with semantic importance levels " +
|
|
48
|
+
"from H1 to H6, following HTML heading standards. It provides text overflow " +
|
|
49
|
+
"handling, anchor link generation, and integrates with " +
|
|
50
|
+
"[TableOfContents](/components/TableOfContents).",
|
|
48
51
|
props: {
|
|
49
52
|
value: VALUE_DESC,
|
|
50
53
|
level: {
|
|
@@ -60,7 +63,7 @@ exports.HeadingMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
60
63
|
description: "This property indicates whether an anchor link should be displayed next to the heading. " +
|
|
61
64
|
"If set to `true`, an anchor link will be displayed on hover next to the heading.",
|
|
62
65
|
type: "boolean",
|
|
63
|
-
}
|
|
66
|
+
},
|
|
64
67
|
},
|
|
65
68
|
themeVars: (0, themeVars_1.parseScssVar)(Heading_module_scss_1.default.themeVars),
|
|
66
69
|
limitThemeVarsToComponent: true,
|
|
@@ -225,7 +228,7 @@ exports.H6Md = (0, ComponentDefs_1.createMetadata)({
|
|
|
225
228
|
},
|
|
226
229
|
},
|
|
227
230
|
});
|
|
228
|
-
function renderHeading({ node, extractValue, layoutCss, level, showAnchor, renderChild }) {
|
|
231
|
+
function renderHeading({ node, extractValue, layoutCss, level, showAnchor, renderChild, }) {
|
|
229
232
|
var _a, _b;
|
|
230
233
|
const _c = node.props, { maxLines, preserveLinebreaks, ellipses } = _c, restProps = __rest(_c, ["maxLines", "preserveLinebreaks", "ellipses"]);
|
|
231
234
|
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), style: layoutCss, omitFromToc: extractValue.asOptionalBoolean((_b = node.props) === null || _b === void 0 ? void 0 : _b.omitFromToc) }, (0, extractParam_1.resolveAndCleanProps)(restProps, extractValue, layoutCss), { children: extractValue.asDisplayText(node.props.value) || renderChild(node.children) })));
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.helloWorldComponentRenderer = exports.HelloWorldMd = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const HelloWorld_module_scss_1 = __importDefault(require("./HelloWorld.module.scss"));
|
|
9
|
+
const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
|
|
10
|
+
const renderers_1 = require("../../components-core/renderers");
|
|
11
|
+
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
12
|
+
const metadata_helpers_1 = require("../metadata-helpers");
|
|
13
|
+
const HelloWorldNative_1 = require("./HelloWorldNative");
|
|
14
|
+
const COMP = "HelloWorld";
|
|
15
|
+
exports.HelloWorldMd = (0, ComponentDefs_1.createMetadata)({
|
|
16
|
+
description: "`HelloWorld` is a demonstration component that shows basic XMLUI patterns. " +
|
|
17
|
+
"It displays a customizable greeting message with an interactive click counter.",
|
|
18
|
+
status: "experimental",
|
|
19
|
+
props: {
|
|
20
|
+
id: {
|
|
21
|
+
description: "The unique identifier for the component.",
|
|
22
|
+
type: "string",
|
|
23
|
+
},
|
|
24
|
+
message: {
|
|
25
|
+
description: "The greeting message to display.",
|
|
26
|
+
type: "string",
|
|
27
|
+
defaultValue: HelloWorldNative_1.defaultProps.message,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
events: {
|
|
31
|
+
onClick: {
|
|
32
|
+
description: "Triggered when the click button is pressed. Receives the current click count.",
|
|
33
|
+
type: "function",
|
|
34
|
+
},
|
|
35
|
+
onReset: {
|
|
36
|
+
description: "Triggered when the reset button is pressed. Called when count is reset to 0.",
|
|
37
|
+
type: "function",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
apis: {
|
|
41
|
+
value: (0, metadata_helpers_1.dValue)(),
|
|
42
|
+
setValue: (0, metadata_helpers_1.dSetValueApi)(),
|
|
43
|
+
},
|
|
44
|
+
themeVars: (0, themeVars_1.parseScssVar)(HelloWorld_module_scss_1.default.themeVars),
|
|
45
|
+
defaultThemeVars: {
|
|
46
|
+
// Standard HelloWorld theme variables with visible defaults
|
|
47
|
+
[`backgroundColor-${COMP}`]: "$color-surface-50",
|
|
48
|
+
[`borderColor-${COMP}`]: "$color-surface-200",
|
|
49
|
+
[`borderWidth-${COMP}`]: "$space-2",
|
|
50
|
+
[`borderStyle-${COMP}`]: "solid",
|
|
51
|
+
[`borderRadius-${COMP}`]: "$borderRadius",
|
|
52
|
+
[`padding-${COMP}`]: "$space-4",
|
|
53
|
+
[`textColor-${COMP}`]: "$color-primary",
|
|
54
|
+
[`maxWidth-${COMP}`]: "400px",
|
|
55
|
+
// Content styling
|
|
56
|
+
[`textAlign-${COMP}-content`]: "center",
|
|
57
|
+
// Message styling
|
|
58
|
+
[`marginBottom-${COMP}-message`]: "$space-4",
|
|
59
|
+
[`fontSize-${COMP}-message`]: "$fontSize-lg",
|
|
60
|
+
[`fontWeight-${COMP}-message`]: "$fontWeight-semibold",
|
|
61
|
+
// Children styling
|
|
62
|
+
[`margin-${COMP}-children`]: "$space-4 0",
|
|
63
|
+
[`padding-${COMP}-children`]: "$space-3",
|
|
64
|
+
[`backgroundColor-${COMP}-children`]: "$color-surface-100",
|
|
65
|
+
[`borderRadius-${COMP}-children`]: "$borderRadius-sm",
|
|
66
|
+
[`fontStyle-${COMP}-children`]: "italic",
|
|
67
|
+
// Interactive container
|
|
68
|
+
[`gap-${COMP}-interactive`]: "$space-3",
|
|
69
|
+
// Click button styling
|
|
70
|
+
[`backgroundColor-${COMP}-clickButton`]: "$color-primary-500",
|
|
71
|
+
[`textColor-${COMP}-clickButton`]: "white",
|
|
72
|
+
[`border-${COMP}-clickButton`]: "none",
|
|
73
|
+
[`borderRadius-${COMP}-clickButton`]: "$borderRadius",
|
|
74
|
+
[`padding-${COMP}-clickButton`]: "$space-3 $space-6",
|
|
75
|
+
[`fontSize-${COMP}-clickButton`]: "$fontSize-base",
|
|
76
|
+
[`fontWeight-${COMP}-clickButton`]: "$fontWeight-medium",
|
|
77
|
+
[`transition-${COMP}-clickButton`]: "background-color 0.2s ease",
|
|
78
|
+
[`backgroundColor-${COMP}-clickButton--hover`]: "$color-primary-600",
|
|
79
|
+
[`transform-${COMP}-clickButton--active`]: "translateY(1px)",
|
|
80
|
+
// Counter styling
|
|
81
|
+
[`fontSize-${COMP}-counter`]: "$fontSize-lg",
|
|
82
|
+
[`fontWeight-${COMP}-counter`]: "$fontWeight-medium",
|
|
83
|
+
// Count badge styling
|
|
84
|
+
[`backgroundColor-${COMP}-count`]: "$color-primary-100",
|
|
85
|
+
[`textColor-${COMP}-count`]: "$color-primary-700",
|
|
86
|
+
[`padding-${COMP}-count`]: "$space-1 $space-2",
|
|
87
|
+
[`borderRadius-${COMP}-count`]: "$borderRadius-sm",
|
|
88
|
+
[`fontWeight-${COMP}-count`]: "$fontWeight-bold",
|
|
89
|
+
[`minWidth-${COMP}-count`]: "24px",
|
|
90
|
+
// Reset button styling
|
|
91
|
+
[`backgroundColor-${COMP}-resetButton`]: "$color-surface-400",
|
|
92
|
+
[`textColor-${COMP}-resetButton`]: "white",
|
|
93
|
+
[`border-${COMP}-resetButton`]: "none",
|
|
94
|
+
[`borderRadius-${COMP}-resetButton`]: "$borderRadius-sm",
|
|
95
|
+
[`padding-${COMP}-resetButton`]: "$space-2 $space-4",
|
|
96
|
+
[`fontSize-${COMP}-resetButton`]: "$fontSize-sm",
|
|
97
|
+
[`transition-${COMP}-resetButton`]: "background-color 0.2s ease",
|
|
98
|
+
[`backgroundColor-${COMP}-resetButton--hover`]: "$color-surface-500",
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
exports.helloWorldComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.HelloWorldMd, ({ node, extractValue, renderChild, layoutCss, lookupEventHandler, registerComponentApi, updateState }) => {
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(HelloWorldNative_1.HelloWorld, { id: extractValue.asOptionalString(node.props.id), message: extractValue.asOptionalString(node.props.message), onClick: lookupEventHandler("onClick"), onReset: lookupEventHandler("onReset"), registerComponentApi: registerComponentApi, updateState: updateState, style: layoutCss, children: renderChild(node.children) }));
|
|
103
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.HelloWorld = exports.defaultProps = void 0;
|
|
51
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
52
|
+
const react_1 = __importStar(require("react"));
|
|
53
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
54
|
+
const misc_1 = require("../../components-core/utils/misc");
|
|
55
|
+
const HelloWorld_module_scss_1 = __importDefault(require("./HelloWorld.module.scss"));
|
|
56
|
+
exports.defaultProps = {
|
|
57
|
+
message: "Hello, World!",
|
|
58
|
+
theme: "default",
|
|
59
|
+
};
|
|
60
|
+
exports.HelloWorld = react_1.default.forwardRef(function HelloWorld(_a, ref) {
|
|
61
|
+
var { id, message = exports.defaultProps.message, theme = exports.defaultProps.theme, children, style, className, onClick, onReset, registerComponentApi, updateState } = _a, rest = __rest(_a, ["id", "message", "theme", "children", "style", "className", "onClick", "onReset", "registerComponentApi", "updateState"]);
|
|
62
|
+
const [clickCount, setClickCount] = (0, react_1.useState)(0);
|
|
63
|
+
const setValue = (0, misc_1.useEvent)((newCount) => {
|
|
64
|
+
setClickCount(newCount);
|
|
65
|
+
updateState === null || updateState === void 0 ? void 0 : updateState({ value: newCount });
|
|
66
|
+
});
|
|
67
|
+
// Sync clickCount with XMLUI state system (like AppState does)
|
|
68
|
+
(0, react_1.useEffect)(() => {
|
|
69
|
+
updateState === null || updateState === void 0 ? void 0 : updateState({ value: clickCount });
|
|
70
|
+
}, [updateState, clickCount]);
|
|
71
|
+
(0, react_1.useEffect)(() => {
|
|
72
|
+
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
73
|
+
setValue,
|
|
74
|
+
});
|
|
75
|
+
}, [registerComponentApi, setValue]);
|
|
76
|
+
const handleClick = (event) => {
|
|
77
|
+
const newCount = clickCount + 1;
|
|
78
|
+
setClickCount(newCount);
|
|
79
|
+
updateState === null || updateState === void 0 ? void 0 : updateState({ value: newCount });
|
|
80
|
+
// Call XMLUI event handler if provided
|
|
81
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
82
|
+
};
|
|
83
|
+
const handleReset = (event) => {
|
|
84
|
+
setClickCount(0);
|
|
85
|
+
updateState === null || updateState === void 0 ? void 0 : updateState({ value: 0 });
|
|
86
|
+
// Call XMLUI event handler if provided
|
|
87
|
+
onReset === null || onReset === void 0 ? void 0 : onReset(event);
|
|
88
|
+
};
|
|
89
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { id: id, ref: ref, className: (0, classnames_1.default)(className, HelloWorld_module_scss_1.default.helloWorld, {
|
|
90
|
+
[HelloWorld_module_scss_1.default.success]: theme === "success",
|
|
91
|
+
}), style: style, children: (0, jsx_runtime_1.jsxs)("div", { className: HelloWorld_module_scss_1.default.content, children: [(0, jsx_runtime_1.jsx)("h3", { className: HelloWorld_module_scss_1.default.message, children: message }), children && ((0, jsx_runtime_1.jsx)("div", { className: HelloWorld_module_scss_1.default.children, children: children })), (0, jsx_runtime_1.jsxs)("div", { className: HelloWorld_module_scss_1.default.interactive, children: [(0, jsx_runtime_1.jsx)("button", { className: HelloWorld_module_scss_1.default.clickButton, onClick: handleClick, children: "Click me!" }), (0, jsx_runtime_1.jsxs)("div", { className: HelloWorld_module_scss_1.default.counter, children: ["Clicks: ", (0, jsx_runtime_1.jsx)("span", { className: HelloWorld_module_scss_1.default.count, children: clickCount })] }), clickCount > 0 && ((0, jsx_runtime_1.jsx)("button", { className: HelloWorld_module_scss_1.default.resetButton, onClick: handleReset, children: "Reset" }))] })] }) })));
|
|
92
|
+
});
|
|
@@ -12,8 +12,10 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
|
12
12
|
const IconNative_1 = __importDefault(require("./IconNative"));
|
|
13
13
|
const COMP = "Icon";
|
|
14
14
|
exports.IconMd = (0, ComponentDefs_1.createMetadata)({
|
|
15
|
-
status: "
|
|
16
|
-
description: `
|
|
15
|
+
status: "stable",
|
|
16
|
+
description: "`Icon` displays scalable vector icons from XMLUI's built-in icon registry " +
|
|
17
|
+
"using simple name references. Icons are commonly used in buttons, navigation " +
|
|
18
|
+
"elements, and status indicators.",
|
|
17
19
|
props: {
|
|
18
20
|
name: (0, ComponentDefs_1.d)("This string property specifies the name of the icon to display. All icons have " +
|
|
19
21
|
"unique, case-sensitive names identifying them. If the icon name is not set, the " +
|
|
@@ -13,8 +13,9 @@ const metadata_helpers_1 = require("../metadata-helpers");
|
|
|
13
13
|
const ImageNative_1 = require("./ImageNative");
|
|
14
14
|
const COMP = "Image";
|
|
15
15
|
exports.ImageMd = (0, ComponentDefs_1.createMetadata)({
|
|
16
|
-
description: `
|
|
17
|
-
|
|
16
|
+
description: "`Image` displays pictures from URLs or local sources with built-in responsive " +
|
|
17
|
+
"sizing, aspect ratio control, and accessibility features. It handles different " +
|
|
18
|
+
"image formats and provides options for lazy loading and click interactions.",
|
|
18
19
|
props: {
|
|
19
20
|
src: (0, ComponentDefs_1.d)("This property is used to indicate the source (path) of the image to display. " +
|
|
20
21
|
"When not defined, no image is displayed."),
|
|
@@ -9,8 +9,9 @@ const metadata_helpers_1 = require("../metadata-helpers");
|
|
|
9
9
|
const ItemsNative_1 = require("./ItemsNative");
|
|
10
10
|
const COMP = "Items";
|
|
11
11
|
exports.ItemsMd = (0, ComponentDefs_1.createMetadata)({
|
|
12
|
-
description: `
|
|
13
|
-
`
|
|
12
|
+
description: "`Items` renders data arrays without built-in layout or styling, providing " +
|
|
13
|
+
"a lightweight alternative to `List`. Unlike `List`, it provides no " +
|
|
14
|
+
"virtualization, grouping, or visual formatting — just pure data iteration.",
|
|
14
15
|
props: {
|
|
15
16
|
items: (0, metadata_helpers_1.dInternal)(`This property contains the list of data items this component renders.`),
|
|
16
17
|
data: (0, ComponentDefs_1.d)(`This property contains the list of data items (obtained from a data source) this component renders.`),
|
|
@@ -23,10 +24,10 @@ exports.ItemsMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
23
24
|
},
|
|
24
25
|
childrenAsTemplate: "itemTemplate",
|
|
25
26
|
contextVars: {
|
|
26
|
-
$item: (0, metadata_helpers_1.dComponent)("
|
|
27
|
-
$itemIndex: (0, metadata_helpers_1.dComponent)("
|
|
28
|
-
$isFirst: (0, metadata_helpers_1.dComponent)("
|
|
29
|
-
$isLast: (0, metadata_helpers_1.dComponent)("
|
|
27
|
+
$item: (0, metadata_helpers_1.dComponent)("Current data item being rendered"),
|
|
28
|
+
$itemIndex: (0, metadata_helpers_1.dComponent)("Zero-based index of current item"),
|
|
29
|
+
$isFirst: (0, metadata_helpers_1.dComponent)("Boolean indicating if this is the first item"),
|
|
30
|
+
$isLast: (0, metadata_helpers_1.dComponent)("Boolean indicating if this is the last item"),
|
|
30
31
|
},
|
|
31
32
|
opaque: true,
|
|
32
33
|
});
|
|
@@ -14,8 +14,10 @@ const abstractions_1 = require("../abstractions");
|
|
|
14
14
|
const LinkNative_1 = require("./LinkNative");
|
|
15
15
|
const COMP = "Link";
|
|
16
16
|
exports.LinkMd = (0, ComponentDefs_1.createMetadata)({
|
|
17
|
-
description: `
|
|
18
|
-
`
|
|
17
|
+
description: "`Link` creates clickable navigation elements for internal app routes or " +
|
|
18
|
+
"external URLs. You can use the `label` and `icon` properties for simple text " +
|
|
19
|
+
"links, or embed custom components like buttons, cards, or complex layouts " +
|
|
20
|
+
"for rich interactive link presentations.",
|
|
19
21
|
props: {
|
|
20
22
|
to: (0, ComponentDefs_1.d)("This property defines the URL of the link. If the value is not defined, the link cannot be activated."),
|
|
21
23
|
enabled: (0, metadata_helpers_1.dEnabled)(),
|