xmlui 0.7.24 → 0.7.26
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/{apiInterceptorWorker-C6UAUhRI.mjs → apiInterceptorWorker-BlvgbCSf.mjs} +1 -1
- package/dist/{index-BcnKqeXb.mjs → index-CWLnzVw7.mjs} +13191 -12468
- package/dist/index.css +1 -1
- package/dist/scripts/src/abstractions/ComponentDefs.js +2 -2
- package/dist/scripts/src/components/Accordion/Accordion.js +1 -1
- package/dist/scripts/src/components/App/App.js +1 -0
- package/dist/scripts/src/components/App/AppNative.js +9 -3
- package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -12
- package/dist/scripts/src/components/Avatar/Avatar.js +2 -4
- package/dist/scripts/src/components/Badge/Badge.js +8 -7
- package/dist/scripts/src/components/Bookmark/BookmarkNative.js +1 -1
- package/dist/scripts/src/components/Button/Button.js +74 -24
- package/dist/scripts/src/components/Button/ButtonNative.js +11 -3
- package/dist/scripts/src/components/Card/Card.js +1 -2
- package/dist/scripts/src/components/Checkbox/Checkbox.js +8 -2
- package/dist/scripts/src/components/Column/Column.js +24 -1
- package/dist/scripts/src/components/Column/ColumnNative.js +8 -2
- package/dist/scripts/src/components/ComponentProvider.js +4 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +2 -2
- package/dist/scripts/src/components/Footer/Footer.js +13 -10
- package/dist/scripts/src/components/Form/Form.js +7 -1
- package/dist/scripts/src/components/Form/FormNative.js +31 -2
- package/dist/scripts/src/components/FormItem/FormItem.js +10 -4
- package/dist/scripts/src/components/FormItem/FormItemNative.js +3 -3
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +2 -2
- package/dist/scripts/src/components/FormSection/FormSection.js +2 -1
- package/dist/scripts/src/components/Heading/Heading.js +12 -18
- package/dist/scripts/src/components/Heading/HeadingNative.js +4 -4
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +39 -0
- package/dist/scripts/src/components/Link/Link.js +1 -0
- package/dist/scripts/src/components/Markdown/Markdown.js +1 -1
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +90 -2
- package/dist/scripts/src/components/NavLink/NavLink.js +1 -0
- package/dist/scripts/src/components/NavPanel/NavPanel.js +12 -4
- package/dist/scripts/src/components/NoResult/NoResult.js +1 -0
- package/dist/scripts/src/components/Option/Option.js +7 -2
- package/dist/scripts/src/components/Pages/PagesNative.js +1 -1
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +7 -4
- package/dist/scripts/src/components/RadioGroup/RadioItem.js +19 -0
- package/dist/scripts/src/components/RadioGroup/RadioItemNative.js +49 -0
- package/dist/scripts/src/components/Select/SelectNative.js +17 -17
- package/dist/scripts/src/components/Splitter/Splitter.js +8 -10
- package/dist/scripts/src/components/Stack/Stack.js +30 -15
- package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +16 -4
- package/dist/scripts/src/components/Table/Table.js +2 -7
- package/dist/scripts/src/components/Table/TableNative.js +1 -1
- package/dist/scripts/src/components/TableOfContents/TableOfContentsNative.js +18 -9
- package/dist/scripts/src/components/Toggle/Toggle.js +36 -18
- package/dist/scripts/src/components/abstractions.js +1 -2
- package/dist/scripts/src/components/metadata-helpers.js +2 -1
- package/dist/scripts/src/components-core/TableOfContentsContext.js +21 -10
- package/dist/scripts/src/components-core/loader/DataLoader.js +6 -2
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +1 -3
- package/dist/scripts/src/components-core/rendering/valueExtractor.js +5 -2
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +5 -2
- package/dist/scripts/src/components-core/theming/extendThemeUtils.js +0 -67
- package/dist/scripts/src/components-core/theming/layout-resolver.js +1 -20
- package/dist/scripts/src/components-core/theming/transformThemeVars.js +185 -53
- package/dist/scripts/src/components-core/utils/hooks.js +73 -1
- package/dist/scripts/src/components-core/xmlui-parser.js +17 -2
- package/dist/scripts/src/parsers/xmlui-parser/ParserError.js +2 -2
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +3 -3
- package/dist/style.css +1 -1
- package/dist/xmlui-metadata.mjs +4138 -3997
- package/dist/xmlui-metadata.umd.js +19 -18
- package/dist/xmlui-standalone.umd.js +202 -201
- package/dist/xmlui.d.ts +12 -14
- package/dist/xmlui.mjs +1 -1
- package/package.json +12 -13
|
@@ -22,6 +22,6 @@ function createMetadata({ description, shortDescription, specializedFrom, status
|
|
|
22
22
|
isHtmlTag,
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function d(description, availableValues, valueType, defaultValue, isValid) {
|
|
26
|
-
return { description, availableValues, valueType, defaultValue, isValid };
|
|
25
|
+
function d(description, availableValues, valueType, defaultValue, isValid, isRequired) {
|
|
26
|
+
return { description, isRequired, availableValues, valueType, defaultValue, isValid };
|
|
27
27
|
}
|
|
@@ -47,7 +47,7 @@ exports.AccordionMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
47
47
|
[`font-size-header-${COMP}`]: "$font-size-normal",
|
|
48
48
|
[`font-weight-header-${COMP}`]: "$font-weight-normal",
|
|
49
49
|
[`font-family-header-${COMP}`]: "$font-family",
|
|
50
|
-
[`border-${COMP}`]: "
|
|
50
|
+
[`border-${COMP}`]: "0px solid $color-border",
|
|
51
51
|
[`width-icon-${COMP}`]: "",
|
|
52
52
|
[`height-icon-${COMP}`]: "",
|
|
53
53
|
light: {
|
|
@@ -43,6 +43,7 @@ exports.AppMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
43
43
|
[`max-content-width-${COMP}`]: "$max-content-width",
|
|
44
44
|
[`shadow-header-${COMP}`]: "$shadow-spread",
|
|
45
45
|
[`shadow-pages-${COMP}`]: "$shadow-spread",
|
|
46
|
+
[`scroll-padding-block-Pages`]: "$space-4",
|
|
46
47
|
light: {
|
|
47
48
|
// --- No light-specific theme vars
|
|
48
49
|
},
|
|
@@ -95,9 +95,11 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
|
|
|
95
95
|
return {
|
|
96
96
|
"--header-height": !scrollWholePage ? 0 : headerHeight + "px",
|
|
97
97
|
"--footer-height": !scrollWholePage ? 0 : footerHeight + "px",
|
|
98
|
-
"--
|
|
98
|
+
"--header-abs-height": headerHeight + "px",
|
|
99
|
+
"--footer-abs-height": footerHeight + "px",
|
|
100
|
+
"--scrollbar-width": noScrollbarGutters ? 0 : (scrollbarWidth + "px"),
|
|
99
101
|
};
|
|
100
|
-
}, [footerHeight, headerHeight, scrollWholePage, scrollbarWidth]);
|
|
102
|
+
}, [footerHeight, headerHeight, noScrollbarGutters, scrollWholePage, scrollbarWidth]);
|
|
101
103
|
const [drawerVisible, setDrawerVisible] = (0, react_1.useState)(false);
|
|
102
104
|
const location = (0, react_2.useLocation)();
|
|
103
105
|
const toggleDrawer = (0, react_1.useCallback)(() => {
|
|
@@ -105,7 +107,11 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
|
|
|
105
107
|
}, []);
|
|
106
108
|
(0, react_1.useLayoutEffect)(() => {
|
|
107
109
|
var _a;
|
|
108
|
-
(_a =
|
|
110
|
+
(_a = scrollContainerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
111
|
+
top: 0,
|
|
112
|
+
left: 0,
|
|
113
|
+
behavior: "instant", // Optional if you want to skip the scrolling animation
|
|
114
|
+
});
|
|
109
115
|
}, [location.pathname]);
|
|
110
116
|
const layoutContextValue = (0, react_1.useMemo)(() => {
|
|
111
117
|
return {
|
|
@@ -27,18 +27,7 @@ exports.AppHeaderMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
27
27
|
showLogo: (0, ComponentDefs_1.d)("Show the logo in the header", null, "boolean", true),
|
|
28
28
|
},
|
|
29
29
|
themeVars: (0, themeVars_1.parseScssVar)(AppHeader_module_scss_1.default.themeVars),
|
|
30
|
-
defaultThemeVars: Object.assign(Object.assign(Object.assign(
|
|
31
|
-
bottom: {
|
|
32
|
-
color: "$color-border",
|
|
33
|
-
thickness: "1px",
|
|
34
|
-
style: "solid",
|
|
35
|
-
},
|
|
36
|
-
all: {
|
|
37
|
-
color: "$color-border",
|
|
38
|
-
thickness: "0",
|
|
39
|
-
style: "solid",
|
|
40
|
-
},
|
|
41
|
-
})), (0, base_utils_1.paddingSubject)("logo-AppHeader", { horizontal: "$space-0", vertical: "$space-4" })), (0, base_utils_1.paddingSubject)("AppHeader", { horizontal: "$space-4", vertical: "$space-0" })), { "radius-AppHeader": "0px", light: {
|
|
30
|
+
defaultThemeVars: Object.assign(Object.assign(Object.assign({ "height-AppHeader": "$space-14", "max-content-width-AppHeader": "$max-content-width-App", "border-bottom-AppHeader": "1px solid $color-border" }, (0, base_utils_1.paddingSubject)("logo-AppHeader", { horizontal: "$space-0", vertical: "$space-4" })), (0, base_utils_1.paddingSubject)("AppHeader", { horizontal: "$space-4", vertical: "$space-0" })), { "radius-AppHeader": "0px", light: {
|
|
42
31
|
"color-bg-AppHeader": "white",
|
|
43
32
|
}, dark: {
|
|
44
33
|
"color-bg-AppHeader": "$color-surface-900",
|
|
@@ -25,17 +25,15 @@ exports.AvatarMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
25
25
|
themeVars: (0, themeVars_1.parseScssVar)(Avatar_module_scss_1.default.themeVars),
|
|
26
26
|
defaultThemeVars: {
|
|
27
27
|
[`radius-${COMP}`]: "4px",
|
|
28
|
-
[`thickness-border-${COMP}`]: "0px",
|
|
29
|
-
[`style-border-${COMP}`]: "solid",
|
|
30
|
-
[`border-${COMP}`]: `$thickness-border-${COMP} $style-border-${COMP} $color-border-${COMP}`,
|
|
31
28
|
[`shadow-${COMP}`]: "inset 0 0 0 1px rgba(4,32,69,0.1)",
|
|
32
29
|
[`color-text-${COMP}`]: "$color-text-secondary",
|
|
33
30
|
[`font-weight-${COMP}`]: "$font-weight-bold",
|
|
34
31
|
light: {
|
|
32
|
+
[`border-${COMP}`]: "0px solid $color-surface-400A80",
|
|
35
33
|
[`color-bg-${COMP}`]: "$color-surface-100",
|
|
36
|
-
[`color-border-${COMP}`]: "$color-surface-400A80",
|
|
37
34
|
},
|
|
38
35
|
dark: {
|
|
36
|
+
[`border-${COMP}`]: "0px solid $color-surface-700",
|
|
39
37
|
[`color-bg-${COMP}`]: "$color-surface-800",
|
|
40
38
|
[`color-border-${COMP}`]: "$color-surface-700",
|
|
41
39
|
},
|
|
@@ -15,7 +15,11 @@ exports.BadgeMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
15
15
|
status: "stable",
|
|
16
16
|
description: `The \`${COMP}\` is a text label that accepts a color map to define its background color and, optionally, its label color.`,
|
|
17
17
|
props: {
|
|
18
|
-
value:
|
|
18
|
+
value: {
|
|
19
|
+
description: "The text that the component displays",
|
|
20
|
+
type: "string",
|
|
21
|
+
isRequired: true,
|
|
22
|
+
},
|
|
19
23
|
variant: (0, ComponentDefs_1.d)(`Modifies the shape of the component. Comes in the regular \`badge\` variant or the \`pill\` variant ` +
|
|
20
24
|
`with fully rounded corners.`),
|
|
21
25
|
colorMap: (0, ComponentDefs_1.d)(`The \`${COMP}\` component supports the mapping of a list of colors using the \`value\` prop as the ` +
|
|
@@ -31,15 +35,12 @@ exports.BadgeMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
31
35
|
events: {},
|
|
32
36
|
themeVars: (0, themeVars_1.parseScssVar)(Badge_module_scss_1.default.themeVars),
|
|
33
37
|
defaultThemeVars: {
|
|
34
|
-
[`padding
|
|
35
|
-
[`
|
|
36
|
-
[`padding-${COMP}`]: `$
|
|
37
|
-
[`padding-${COMP}-pill`]: `$padding-vertical-${COMP}-pill $padding-horizontal-${COMP}-pill`,
|
|
38
|
+
[`padding-${COMP}`]: `$space-0_5 $space-2`,
|
|
39
|
+
[`border-${COMP}`]: `0px solid $color-border`,
|
|
40
|
+
[`padding-${COMP}-pill`]: `$space-0_5 $space-2`,
|
|
38
41
|
[`radius-${COMP}`]: "4px",
|
|
39
42
|
[`font-size-${COMP}`]: "0.8em",
|
|
40
43
|
[`font-size-${COMP}-pill`]: "0.8em",
|
|
41
|
-
// [`font-weight-${COMP}`]: "$font-weight-bold",
|
|
42
|
-
// [`font-weight-${COMP}-pill`]: "$font-weight-normal",
|
|
43
44
|
light: {
|
|
44
45
|
[`color-bg-${COMP}`]: "rgba($color-secondary-500-rgb, .6)",
|
|
45
46
|
[`color-text-${COMP}`]: "white",
|
|
@@ -20,6 +20,6 @@ const Bookmark = ({ uid, level = 1, children, title, omitFromToc = false }) => {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
}, [uid, observeIntersection, registerHeading, level, title, omitFromToc]);
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)("span", { ref: elementRef, id: uid, children: children }));
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)("span", { ref: elementRef, id: uid, "data-anchor": true, children: children }));
|
|
24
24
|
};
|
|
25
25
|
exports.Bookmark = Bookmark;
|
|
@@ -18,25 +18,79 @@ exports.ButtonMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
18
18
|
description: `Button is an interactive element that triggers an action when clicked.`,
|
|
19
19
|
status: "stable",
|
|
20
20
|
props: {
|
|
21
|
-
autoFocus:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
autoFocus: {
|
|
22
|
+
description: "Indicates if the button should receive focus when the page loads.",
|
|
23
|
+
isRequired: false,
|
|
24
|
+
type: "boolean",
|
|
25
|
+
defaultValue: false,
|
|
26
|
+
},
|
|
27
|
+
variant: {
|
|
28
|
+
description: "The button variant determines the level of emphasis the button should possess.",
|
|
29
|
+
isRequired: false,
|
|
30
|
+
type: "string",
|
|
31
|
+
availableValues: abstractions_1.buttonVariantMd,
|
|
32
|
+
defaultValue: ButtonNative_1.propDefaults.variant,
|
|
33
|
+
},
|
|
34
|
+
themeColor: {
|
|
35
|
+
description: "Sets the button color scheme defined in the application theme.",
|
|
36
|
+
isRequired: false,
|
|
37
|
+
type: "string",
|
|
38
|
+
availableValues: abstractions_1.buttonThemeMd,
|
|
39
|
+
defaultValue: ButtonNative_1.propDefaults.themeColor,
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
description: "Sets the size of the button.",
|
|
43
|
+
isRequired: false,
|
|
44
|
+
type: "string",
|
|
45
|
+
availableValues: abstractions_1.sizeMd,
|
|
46
|
+
defaultValue: ButtonNative_1.propDefaults.size,
|
|
47
|
+
},
|
|
48
|
+
label: {
|
|
49
|
+
description: `This property is an optional string to set a label for the ${COMP}. If no label is ` +
|
|
50
|
+
`specified and an icon is set, the ${COMP} will modify its styling to look like a ` +
|
|
51
|
+
`small icon button. When the ${COMP} has nested children, it will display them and ` +
|
|
52
|
+
`ignore the value of the \`label\` prop.`,
|
|
53
|
+
isRequired: false,
|
|
54
|
+
type: "string",
|
|
55
|
+
},
|
|
56
|
+
type: {
|
|
57
|
+
description: `This optional string describes how the ${COMP} appears in an HTML context. You ` +
|
|
58
|
+
`rarely need to set this property explicitly.`,
|
|
59
|
+
isRequired: false,
|
|
60
|
+
availableValues: abstractions_1.buttonTypesMd,
|
|
61
|
+
valueType: "string",
|
|
62
|
+
defaultValue: ButtonNative_1.propDefaults.type,
|
|
63
|
+
},
|
|
64
|
+
enabled: {
|
|
65
|
+
description: `The value of this property indicates whether the button accepts actions (\`true\`) ` +
|
|
66
|
+
`or does not react to them (\`false\`).`,
|
|
67
|
+
isRequired: false,
|
|
68
|
+
type: "boolean",
|
|
69
|
+
defaultValue: true,
|
|
70
|
+
},
|
|
71
|
+
orientation: (0, metadata_helpers_1.dOrientation)(ButtonNative_1.propDefaults.orientation),
|
|
72
|
+
icon: {
|
|
73
|
+
description: `This string value denotes an icon name. The framework will render an icon if XMLUI ` +
|
|
74
|
+
`recognizes the icon by its name. If no label is specified and an icon is set, the ${COMP} ` +
|
|
75
|
+
`displays only that icon.`,
|
|
76
|
+
isRequired: false,
|
|
77
|
+
type: "string",
|
|
78
|
+
},
|
|
79
|
+
iconPosition: {
|
|
80
|
+
description: `This optional string determines the location of the icon in the ${COMP}.`,
|
|
81
|
+
isRequired: false,
|
|
82
|
+
availableValues: abstractions_1.iconPositionMd,
|
|
83
|
+
type: "string",
|
|
84
|
+
defaultValue: ButtonNative_1.propDefaults.iconPosition,
|
|
85
|
+
},
|
|
86
|
+
contentPosition: {
|
|
87
|
+
description: `This optional value determines how the label and icon (or nested children) should be placed` +
|
|
88
|
+
`inside the ${COMP} component.`,
|
|
89
|
+
isRequired: false,
|
|
90
|
+
availableValues: abstractions_1.alignmentOptionMd,
|
|
91
|
+
type: "string",
|
|
92
|
+
defaultValue: ButtonNative_1.propDefaults.contentPosition,
|
|
93
|
+
},
|
|
40
94
|
},
|
|
41
95
|
events: {
|
|
42
96
|
click: (0, metadata_helpers_1.dClick)(COMP),
|
|
@@ -133,11 +187,7 @@ exports.ButtonMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
133
187
|
},
|
|
134
188
|
});
|
|
135
189
|
exports.buttonComponentRenderer = (0, renderers_1.createComponentRenderer)("Button", exports.ButtonMd, ({ node, extractValue, renderChild, lookupEventHandler, layoutCss }) => {
|
|
136
|
-
var _a;
|
|
137
190
|
const iconName = extractValue.asString(node.props.icon);
|
|
138
191
|
const label = extractValue.asDisplayText(node.props.label);
|
|
139
|
-
return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: node.props.type, variant: extractValue(node.props.variant), themeColor: extractValue(node.props.themeColor), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), size: extractValue(node.props.size), icon: iconName && (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: iconName }), iconPosition: extractValue(node.props.iconPosition), orientation: extractValue(node.props.orientation), contentPosition: extractValue(node.props.contentPosition), disabled: !extractValue.asOptionalBoolean(
|
|
140
|
-
type: "Stack",
|
|
141
|
-
orientation: "horizontal"
|
|
142
|
-
}) || label }));
|
|
192
|
+
return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: extractValue.asOptionalString(node.props.type), variant: extractValue.asOptionalString(node.props.variant), themeColor: extractValue.asOptionalString(node.props.themeColor), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), size: extractValue.asOptionalString(node.props.size), icon: iconName && (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: iconName }), iconPosition: extractValue.asOptionalString(node.props.iconPosition), orientation: extractValue.asOptionalString(node.props.orientation), contentPosition: extractValue.asOptionalString(node.props.contentPosition), disabled: !extractValue.asOptionalBoolean(node.props.enabled, true), onClick: lookupEventHandler("click"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), style: layoutCss, children: renderChild(node.children, { type: "Stack", orientation: "horizontal" }) || label }));
|
|
143
193
|
});
|
|
@@ -47,14 +47,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
47
47
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.Button = void 0;
|
|
50
|
+
exports.Button = exports.propDefaults = void 0;
|
|
51
51
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
52
52
|
const react_1 = __importStar(require("react"));
|
|
53
53
|
const classnames_1 = __importDefault(require("classnames"));
|
|
54
54
|
const Button_module_scss_1 = __importDefault(require("./Button.module.scss"));
|
|
55
|
-
|
|
55
|
+
exports.propDefaults = {
|
|
56
|
+
type: "button",
|
|
57
|
+
iconPosition: "start",
|
|
58
|
+
contentPosition: "center",
|
|
59
|
+
orientation: "horizontal",
|
|
60
|
+
variant: "solid",
|
|
61
|
+
themeColor: "primary",
|
|
62
|
+
size: "sm",
|
|
63
|
+
};
|
|
56
64
|
exports.Button = react_1.default.forwardRef(function Button(_a, ref) {
|
|
57
|
-
var { id, type =
|
|
65
|
+
var { id, type = exports.propDefaults.type, icon, iconPosition = exports.propDefaults.iconPosition, contentPosition = exports.propDefaults.contentPosition, orientation = exports.propDefaults.orientation, variant = exports.propDefaults.variant, themeColor = exports.propDefaults.themeColor, size = exports.propDefaults.size, disabled, children, formId, onClick, onFocus, onBlur, style, gap, className, autoFocus } = _a, rest = __rest(_a, ["id", "type", "icon", "iconPosition", "contentPosition", "orientation", "variant", "themeColor", "size", "disabled", "children", "formId", "onClick", "onFocus", "onBlur", "style", "gap", "className", "autoFocus"]);
|
|
58
66
|
const innerRef = (0, react_1.useRef)(null);
|
|
59
67
|
(0, react_1.useImperativeHandle)(ref, () => innerRef.current);
|
|
60
68
|
(0, react_1.useEffect)(() => {
|
|
@@ -32,8 +32,7 @@ exports.CardMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
32
32
|
},
|
|
33
33
|
themeVars: (0, themeVars_1.parseScssVar)(Card_module_scss_1.default.themeVars),
|
|
34
34
|
defaultThemeVars: {
|
|
35
|
-
[`padding
|
|
36
|
-
[`padding-vertical-${COMP}`]: "$space-4",
|
|
35
|
+
[`padding-${COMP}`]: "$space-4",
|
|
37
36
|
[`border-${COMP}`]: "1px solid $color-border",
|
|
38
37
|
[`radius-${COMP}`]: "$radius",
|
|
39
38
|
[`shadow-${COMP}`]: "none",
|
|
@@ -11,6 +11,7 @@ const renderers_1 = require("../../components-core/renderers");
|
|
|
11
11
|
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
12
12
|
const metadata_helpers_1 = require("../../components/metadata-helpers");
|
|
13
13
|
const Toggle_1 = require("../Toggle/Toggle");
|
|
14
|
+
const container_helpers_1 = require("../container-helpers");
|
|
14
15
|
const COMP = "Checkbox";
|
|
15
16
|
exports.CheckboxMd = (0, ComponentDefs_1.createMetadata)({
|
|
16
17
|
status: "stable",
|
|
@@ -30,6 +31,7 @@ exports.CheckboxMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
30
31
|
validationStatus: (0, metadata_helpers_1.dValidationStatus)(),
|
|
31
32
|
description: (0, ComponentDefs_1.d)(`(*** NOT IMPLEMENTED YET ***) This optional property displays an alternate description ` +
|
|
32
33
|
`of the ${COMP} besides its label.`),
|
|
34
|
+
inputTemplate: (0, ComponentDefs_1.d)("This property is used to define a custom checkbox input template"),
|
|
33
35
|
},
|
|
34
36
|
events: {
|
|
35
37
|
click: (0, metadata_helpers_1.dClick)(COMP),
|
|
@@ -63,6 +65,10 @@ exports.CheckboxMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
63
65
|
},
|
|
64
66
|
},
|
|
65
67
|
});
|
|
66
|
-
exports.checkboxComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.CheckboxMd, ({ node, extractValue, layoutCss, updateState, lookupEventHandler, state, registerComponentApi, }) => {
|
|
67
|
-
|
|
68
|
+
exports.checkboxComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.CheckboxMd, ({ node, extractValue, layoutCss, updateState, lookupEventHandler, state, registerComponentApi, renderChild, layoutContext, }) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const inputTemplate = node.children || ((_a = node.props) === null || _a === void 0 ? void 0 : _a.inputTemplate);
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { inputRenderer: inputTemplate
|
|
72
|
+
? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: inputTemplate, renderChild: renderChild, layoutContext: layoutContext }))
|
|
73
|
+
: undefined, enabled: extractValue.asOptionalBoolean(node.props.enabled), style: layoutCss, initialValue: extractValue.asOptionalBoolean(node.props.initialValue, false), value: state === null || state === void 0 ? void 0 : state.value, readOnly: extractValue.asOptionalBoolean(node.props.readOnly), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), indeterminate: extractValue.asOptionalBoolean(node.props.indeterminate), registerComponentApi: registerComponentApi }));
|
|
68
74
|
});
|
|
@@ -10,7 +10,10 @@ exports.ColumnMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
10
10
|
description: `The \`${COMP}\` component can be used within a \`Table\` to define a particular table ` +
|
|
11
11
|
`column's visual properties and data bindings.`,
|
|
12
12
|
props: {
|
|
13
|
-
bindTo:
|
|
13
|
+
bindTo: {
|
|
14
|
+
description: `Indicates what part of the data to lay out in the column.`,
|
|
15
|
+
isRequired: true,
|
|
16
|
+
},
|
|
14
17
|
header: (0, ComponentDefs_1.d)(`Adds a label for a particular column.`),
|
|
15
18
|
width: (0, ComponentDefs_1.d)(`This property defines the width of the column. You can use a numeric value, a pixel ` +
|
|
16
19
|
`value (such as \`100px\`), or a star size value (such as \`*\`, \`2*\`, etc.). ` +
|
|
@@ -27,6 +30,26 @@ exports.ColumnMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
27
30
|
`\`false\`, the column cannot be resized. Double-clicking the column border ` +
|
|
28
31
|
`resets to the original size.`),
|
|
29
32
|
},
|
|
33
|
+
contextVars: {
|
|
34
|
+
$item: {
|
|
35
|
+
description: "The data item being rendered.",
|
|
36
|
+
},
|
|
37
|
+
$row: {
|
|
38
|
+
description: "The data item being rendered (the same as \`$item\`).",
|
|
39
|
+
},
|
|
40
|
+
$itemIndex: {
|
|
41
|
+
description: "The index of the data item being rendered.",
|
|
42
|
+
},
|
|
43
|
+
$rowIndex: {
|
|
44
|
+
description: "The index of the data item being rendered (the same as \`$itemIndex\`).",
|
|
45
|
+
},
|
|
46
|
+
$colIndex: {
|
|
47
|
+
description: "The index of the column being rendered.",
|
|
48
|
+
},
|
|
49
|
+
$cell: {
|
|
50
|
+
description: "The value of the cell being rendered.",
|
|
51
|
+
},
|
|
52
|
+
}
|
|
30
53
|
});
|
|
31
54
|
exports.columnComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.ColumnMd, (rendererContext) => {
|
|
32
55
|
const { node, renderChild, extractValue, layoutCss } = rendererContext;
|
|
@@ -20,8 +20,14 @@ function Column(_a) {
|
|
|
20
20
|
var { nodeChildren, renderChild } = _a, columnMetadata = __rest(_a, ["nodeChildren", "renderChild"]);
|
|
21
21
|
const id = (0, react_1.useId)();
|
|
22
22
|
const { registerColumn, unRegisterColumn } = (0, TableContext_1.useTableContext)();
|
|
23
|
-
const cellRenderer = (0, react_1.useCallback)((row) => {
|
|
24
|
-
return (0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: nodeChildren, item: row,
|
|
23
|
+
const cellRenderer = (0, react_1.useCallback)((row, rowIndex, colIndex, value) => {
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: nodeChildren, item: row, contextVars: {
|
|
25
|
+
$rowIndex: rowIndex,
|
|
26
|
+
$colIndex: colIndex,
|
|
27
|
+
$row: row,
|
|
28
|
+
$itemIndex: rowIndex,
|
|
29
|
+
$cell: value,
|
|
30
|
+
}, renderChild: renderChild }));
|
|
25
31
|
}, [nodeChildren, renderChild]);
|
|
26
32
|
const safeCellRenderer = (0, react_1.useMemo)(() => {
|
|
27
33
|
return nodeChildren ? cellRenderer : undefined;
|
|
@@ -105,6 +105,7 @@ const AutoComplete_1 = require("./AutoComplete/AutoComplete");
|
|
|
105
105
|
const Backdrop_1 = require("./Backdrop/Backdrop");
|
|
106
106
|
const HtmlTags_1 = require("./HtmlTags/HtmlTags");
|
|
107
107
|
const ColorPicker_1 = require("./ColorPicker/ColorPicker");
|
|
108
|
+
const RadioItem_1 = require("./RadioGroup/RadioItem");
|
|
108
109
|
/**
|
|
109
110
|
* The framework has a specialized component concept, the "property holder
|
|
110
111
|
* component." These components only hold property values but do not render
|
|
@@ -319,6 +320,9 @@ class ComponentRegistry {
|
|
|
319
320
|
if (process.env.VITE_USED_COMPONENTS_CarouselItem !== "false") {
|
|
320
321
|
this.registerCoreComponent(CarouselItem_1.carouselItemComponentRenderer);
|
|
321
322
|
}
|
|
323
|
+
if (process.env.VITE_USED_COMPONENTS_RadioItem !== "false") {
|
|
324
|
+
this.registerCoreComponent(RadioItem_1.radioItemComponentRenderer);
|
|
325
|
+
}
|
|
322
326
|
if (process.env.VITE_USED_COMPONENTS_FileUploadDropZone !== "false") {
|
|
323
327
|
this.registerCoreComponent(FileUploadDropZone_1.fileUploadDropZoneComponentRenderer);
|
|
324
328
|
}
|
|
@@ -33,6 +33,6 @@ exports.ContentSeparatorMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
|
-
exports.contentSeparatorComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.ContentSeparatorMd, ({ node, layoutCss,
|
|
37
|
-
return ((0, jsx_runtime_1.jsx)(ContentSeparatorNative_1.ContentSeparator, { orientation:
|
|
36
|
+
exports.contentSeparatorComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.ContentSeparatorMd, ({ node, layoutCss, extractValue }) => {
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(ContentSeparatorNative_1.ContentSeparator, { orientation: extractValue(node.props.orientation), size: extractValue.asSize(node.props.size), style: layoutCss }));
|
|
38
38
|
});
|
|
@@ -9,23 +9,26 @@ const Footer_module_scss_1 = __importDefault(require("./Footer.module.scss"));
|
|
|
9
9
|
const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
|
|
10
10
|
const renderers_1 = require("../../components-core/renderers");
|
|
11
11
|
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
12
|
-
const base_utils_1 = require("../../components-core/theming/themes/base-utils");
|
|
13
12
|
const FooterNative_1 = require("./FooterNative");
|
|
14
13
|
const COMP = "Footer";
|
|
15
14
|
exports.FooterMd = (0, ComponentDefs_1.createMetadata)({
|
|
16
15
|
description: `The \`${COMP}\` is a component that acts as a placeholder within \`App\`.`,
|
|
17
16
|
themeVars: (0, themeVars_1.parseScssVar)(Footer_module_scss_1.default.themeVars),
|
|
18
|
-
defaultThemeVars:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
17
|
+
defaultThemeVars: {
|
|
18
|
+
[`color-bg-${COMP}`]: "$color-bg-AppHeader",
|
|
19
|
+
[`align-vertical-${COMP}`]: "center",
|
|
20
|
+
[`font-size-${COMP}`]: "$font-size-small",
|
|
21
|
+
[`color-text-${COMP}`]: "$color-text-secondary",
|
|
22
|
+
[`max-content-width-${COMP}`]: "$max-content-width",
|
|
23
|
+
[`border-${COMP}`]: `1px solid $color-border`,
|
|
24
|
+
[`padding-${COMP}`]: "$space-2 $space-4",
|
|
25
|
+
light: {
|
|
25
26
|
// --- No light-specific theme vars
|
|
26
|
-
},
|
|
27
|
+
},
|
|
28
|
+
dark: {
|
|
27
29
|
// --- No dark-specific theme vars
|
|
28
|
-
}
|
|
30
|
+
},
|
|
31
|
+
},
|
|
29
32
|
});
|
|
30
33
|
exports.footerRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.FooterMd, ({ node, renderChild, layoutCss, layoutContext }) => {
|
|
31
34
|
return ((0, jsx_runtime_1.jsx)(FooterNative_1.Footer, { style: layoutCss, className: layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.themeClassName, children: renderChild(node.children, {
|
|
@@ -48,7 +48,13 @@ exports.FormMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
48
48
|
},
|
|
49
49
|
contextVars: {
|
|
50
50
|
$data: (0, ComponentDefs_1.d)(`This property represents the value of the form data. You can access the fields of the form ` +
|
|
51
|
-
`using the IDs in the \`bindTo\` property of nested \`FormItem\` instances
|
|
51
|
+
`using the IDs in the \`bindTo\` property of nested \`FormItem\` instances. \`$data\` also ` +
|
|
52
|
+
`provides an \`update\` method as a shortcut to the Form's exposed \`update\` method.`),
|
|
53
|
+
},
|
|
54
|
+
apis: {
|
|
55
|
+
reset: (0, ComponentDefs_1.d)(`Call this event to reset the form to its initial state.`),
|
|
56
|
+
update: (0, ComponentDefs_1.d)("You can pass a data object to update the form data. The properties in the passed data " +
|
|
57
|
+
"object are updated to their values accordingly. Other form properties remain intact."),
|
|
52
58
|
},
|
|
53
59
|
themeVars: (0, themeVars_1.parseScssVar)(Form_module_scss_1.default.themeVars),
|
|
54
60
|
defaultThemeVars: {
|
|
@@ -283,23 +283,52 @@ const Form = (0, react_2.forwardRef)(function ({ formState, dispatch, initialVal
|
|
|
283
283
|
dispatch((0, formActions_2.formReset)(initialValue));
|
|
284
284
|
onReset === null || onReset === void 0 ? void 0 : onReset();
|
|
285
285
|
});
|
|
286
|
+
const updateData = (0, misc_1.useEvent)((change) => {
|
|
287
|
+
if (typeof change !== "object" || change === null || change === undefined) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
Object.entries(change).forEach(([key, value]) => {
|
|
291
|
+
dispatch({
|
|
292
|
+
type: formActions_1.FormActionKind.FIELD_VALUE_CHANGED,
|
|
293
|
+
payload: {
|
|
294
|
+
uid: key,
|
|
295
|
+
value: value,
|
|
296
|
+
},
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
});
|
|
286
300
|
const cancelButton = cancelLabel === "" ? null : ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: "button", themeColor: "secondary", variant: "ghost", onClick: doCancel, children: cancelLabel }, "cancel"));
|
|
287
301
|
const submitButton = (0, react_2.useMemo)(() => ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { type: "submit", disabled: !isEnabled, children: formState.submitInProgress ? saveInProgressLabel : saveLabel }, "submit")), [isEnabled, formState.submitInProgress, saveInProgressLabel, saveLabel]);
|
|
288
302
|
(0, react_2.useEffect)(() => {
|
|
289
303
|
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
290
304
|
reset: doReset,
|
|
305
|
+
update: updateData,
|
|
291
306
|
});
|
|
292
|
-
}, [doReset, registerComponentApi]);
|
|
307
|
+
}, [doReset, updateData, registerComponentApi]);
|
|
293
308
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("form", { style: style, className: Form_module_scss_1.default.wrapper, onSubmit: doSubmit, onReset: doReset, id: id, ref: formRef, children: [(0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults }), (0, jsx_runtime_1.jsx)(FormContext_1.FormContext.Provider, { value: formContextValue, children: children }), buttonRow || ((0, jsx_runtime_1.jsxs)("div", { className: Form_module_scss_1.default.buttonRow, children: [swapCancelAndSave && [submitButton, cancelButton], !swapCancelAndSave && [cancelButton, submitButton]] }))] }), confirmSubmitModalVisible && ((0, jsx_runtime_1.jsx)(ModalDialogNative_1.ModalDialog, { onClose: () => setConfirmSubmitModalVisible(false), isInitiallyOpen: true, title: "Are you sure want to move forward?", children: (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "vertical", style: { gap: "0.5rem" }, children: [(0, jsx_runtime_1.jsx)(TextNative_1.Text, { children: "The following warnings were found during validation. Please make sure you are willing to move forward despite these issues." }), (0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults, fieldValidationResults: formState.validationResults }), (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "horizontal", horizontalAlignment: "end", style: { gap: "1em" }, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", themeColor: "secondary", onClick: () => setConfirmSubmitModalVisible(false), children: "No" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => doSubmit(), autoFocus: true, children: "Yes, proceed" })] })] }) }))] }));
|
|
294
309
|
});
|
|
295
310
|
Form.displayName = "Form";
|
|
296
311
|
function FormWithContextVar({ node, renderChild, extractValue, style, lookupEventHandler, registerComponentApi, }) {
|
|
297
312
|
const [formState, dispatch] = (0, react_2.useReducer)(formReducer, initialState);
|
|
298
313
|
const nodeWithItem = (0, react_2.useMemo)(() => {
|
|
314
|
+
const updateData = (change) => {
|
|
315
|
+
if (typeof change !== "object" || change === null || change === undefined) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
Object.entries(change).forEach(([key, value]) => {
|
|
319
|
+
dispatch({
|
|
320
|
+
type: formActions_1.FormActionKind.FIELD_VALUE_CHANGED,
|
|
321
|
+
payload: {
|
|
322
|
+
uid: key,
|
|
323
|
+
value: value,
|
|
324
|
+
},
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
};
|
|
299
328
|
return {
|
|
300
329
|
type: "Fragment",
|
|
301
330
|
vars: {
|
|
302
|
-
$data: formState.subject,
|
|
331
|
+
$data: Object.assign(Object.assign({}, formState.subject), { update: updateData }),
|
|
303
332
|
},
|
|
304
333
|
children: node.children,
|
|
305
334
|
};
|
|
@@ -23,6 +23,7 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
|
23
23
|
const metadata_helpers_1 = require("../metadata-helpers");
|
|
24
24
|
const Validations_1 = require("./Validations");
|
|
25
25
|
const FormItemNative_1 = require("./FormItemNative");
|
|
26
|
+
const container_helpers_1 = require("../container-helpers");
|
|
26
27
|
const COMP = "FormItem";
|
|
27
28
|
exports.FormItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
28
29
|
status: "experimental",
|
|
@@ -69,6 +70,7 @@ exports.FormItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
69
70
|
regexInvalidMessage: (0, ComponentDefs_1.d)(`This optional string property is used to customize the message that is displayed on a ` +
|
|
70
71
|
`failed regular expression test.`),
|
|
71
72
|
regexInvalidSeverity: (0, ComponentDefs_1.d)(`This property sets the severity level of regular expression validation.`),
|
|
73
|
+
inputTemplate: (0, ComponentDefs_1.d)("This property is used to define a custom input template."),
|
|
72
74
|
},
|
|
73
75
|
events: {
|
|
74
76
|
validate: (0, ComponentDefs_1.d)(`This event is used to define a custom validation function.`),
|
|
@@ -90,8 +92,9 @@ exports.FormItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
90
92
|
"color-text-FormItemLabel-requiredMark": "$color-danger-400",
|
|
91
93
|
},
|
|
92
94
|
});
|
|
93
|
-
exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.FormItemMd, ({ node, renderChild, extractValue, layoutCss, lookupEventHandler, lookupAction, registerComponentApi, }) => {
|
|
94
|
-
|
|
95
|
+
exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.FormItemMd, ({ node, renderChild, extractValue, layoutCss, layoutContext, lookupEventHandler, lookupAction, registerComponentApi, }) => {
|
|
96
|
+
var _a;
|
|
97
|
+
const _b = node.props, { bindTo, autoFocus, label, labelPosition, labelWidth, labelBreak, enabled, required, type, requiredInvalidMessage, minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity, minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity, pattern, patternInvalidMessage, patternInvalidSeverity, regex, regexInvalidMessage, regexInvalidSeverity, customValidationsDebounce, validationMode, maxTextLength } = _b, rest = __rest(_b, ["bindTo", "autoFocus", "label", "labelPosition", "labelWidth", "labelBreak", "enabled", "required", "type", "requiredInvalidMessage", "minLength", "maxLength", "lengthInvalidMessage", "lengthInvalidSeverity", "minValue", "maxValue", "rangeInvalidMessage", "rangeInvalidSeverity", "pattern", "patternInvalidMessage", "patternInvalidSeverity", "regex", "regexInvalidMessage", "regexInvalidSeverity", "customValidationsDebounce", "validationMode", "maxTextLength"]);
|
|
95
98
|
//extractValue works as a memoization mechanism too (if there's nothing to resolve, it won't produce a new object every time)
|
|
96
99
|
const resolvedValidationPropsAndEvents = extractValue({
|
|
97
100
|
required: extractValue.asOptionalBoolean(required),
|
|
@@ -119,7 +122,10 @@ exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COM
|
|
|
119
122
|
const resolvedRestProps = extractValue(nonLayoutCssProps);
|
|
120
123
|
const formItemType = extractValue.asOptionalString(type);
|
|
121
124
|
const isCustomFormItem = formItemType === undefined && !!node.children;
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
const inputTemplate = node.children || ((_a = node.props) === null || _a === void 0 ? void 0 : _a.inputTemplate);
|
|
126
|
+
return ((0, jsx_runtime_1.jsx)(FormItemNative_1.FormItem, Object.assign({ style: layoutCss, layoutContext: layoutContext, labelBreak: extractValue.asOptionalBoolean(labelBreak), labelWidth: extractValue.asOptionalString(labelWidth), bindTo: extractValue.asString(bindTo), autoFocus: extractValue.asOptionalBoolean(autoFocus), enabled: extractValue.asOptionalBoolean(enabled), label: extractValue.asOptionalString(label), labelPosition: extractValue.asOptionalString(labelPosition), type: isCustomFormItem ? "custom" : formItemType, validations: resolvedValidationPropsAndEvents, onValidate: lookupEventHandler("validate"), customValidationsDebounce: extractValue.asOptionalNumber(customValidationsDebounce), validationMode: extractValue.asOptionalString(validationMode), registerComponentApi: registerComponentApi, maxTextLength: extractValue(maxTextLength), inputRenderer: inputTemplate
|
|
127
|
+
? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: inputTemplate, renderChild: renderChild, layoutContext: layoutContext }))
|
|
128
|
+
: undefined }, resolvedRestProps, { children: isCustomFormItem ? ((0, jsx_runtime_1.jsx)(FormItemNative_1.CustomFormItem, { renderChild: renderChild, node: node, bindTo: extractValue.asString(bindTo) })) : (renderChild(node.children, {
|
|
129
|
+
type: formItemType,
|
|
124
130
|
})) })));
|
|
125
131
|
});
|
|
@@ -24,7 +24,6 @@ const FileInputNative_1 = require("../FileInput/FileInputNative");
|
|
|
24
24
|
const NumberBoxNative_1 = require("../NumberBox/NumberBoxNative");
|
|
25
25
|
const SelectNative_1 = require("../Select/SelectNative");
|
|
26
26
|
const RadioGroupNative_1 = require("../RadioGroup/RadioGroupNative");
|
|
27
|
-
const HelperText_1 = require("../FormItem/HelperText");
|
|
28
27
|
const formActions_1 = require("../Form/formActions");
|
|
29
28
|
const TextAreaNative_1 = require("../TextArea/TextAreaNative");
|
|
30
29
|
const misc_1 = require("../../components-core/utils/misc");
|
|
@@ -35,11 +34,12 @@ const ItemWithLabel_1 = require("./ItemWithLabel");
|
|
|
35
34
|
const Validations_1 = require("./Validations");
|
|
36
35
|
const SliderNative_1 = require("../Slider/SliderNative");
|
|
37
36
|
const ColorPickerNative_1 = require("../ColorPicker/ColorPickerNative");
|
|
37
|
+
const HelperText_1 = require("./HelperText");
|
|
38
38
|
const DEFAULT_LABEL_POSITIONS = {
|
|
39
39
|
checkbox: "end",
|
|
40
40
|
};
|
|
41
41
|
exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
42
|
-
var { style, bindTo, type = "text", label, enabled = true, labelPosition, labelWidth, labelBreak = true, children, validations, onValidate, customValidationsDebounce, validationMode, registerComponentApi, maxTextLength } = _a, rest = __rest(_a, ["style", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "validations", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength"]);
|
|
42
|
+
var { style, bindTo, type = "text", label, enabled = true, labelPosition, labelWidth, labelBreak = true, children, validations, onValidate, customValidationsDebounce, validationMode, registerComponentApi, maxTextLength, inputRenderer } = _a, rest = __rest(_a, ["style", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "validations", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength", "inputRenderer"]);
|
|
43
43
|
const labelWidthValue = (0, FormContext_1.useFormContextPart)((value) => labelWidth || value.itemLabelWidth);
|
|
44
44
|
const labelBreakValue = (0, FormContext_1.useFormContextPart)((value) => labelBreak !== undefined ? labelBreak : value.itemLabelBreak);
|
|
45
45
|
const labelPositionValue = (0, FormContext_1.useFormContextPart)((value) => labelPosition || value.itemLabelPosition || DEFAULT_LABEL_POSITIONS[type]);
|
|
@@ -97,7 +97,7 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
97
97
|
case "checkbox": {
|
|
98
98
|
formControl = ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, Object.assign({}, rest, { value: value, updateState: onStateChange,
|
|
99
99
|
// registerComponentApi={registerComponentApi}
|
|
100
|
-
enabled: isEnabled, validationStatus: validationStatus, variant: type })));
|
|
100
|
+
enabled: isEnabled, validationStatus: validationStatus, variant: type, inputRenderer: inputRenderer })));
|
|
101
101
|
break;
|
|
102
102
|
}
|
|
103
103
|
case "file": {
|