@aglyn/shared-ui-jsx-forms 1.0.0-beta.143
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/LICENSE +201 -0
- package/README.md +7 -0
- package/package.json +52 -0
- package/src/index.d.ts +17 -0
- package/src/index.js +18 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/color-picker-tokens.d.ts +135 -0
- package/src/lib/components/color-picker-tokens.js +431 -0
- package/src/lib/components/color-picker-tokens.js.map +1 -0
- package/src/lib/components/color-picker.component.d.ts +64 -0
- package/src/lib/components/color-picker.component.js +322 -0
- package/src/lib/components/color-picker.component.js.map +1 -0
- package/src/lib/components/create-artifact-drawer.component.d.ts +100 -0
- package/src/lib/components/create-artifact-drawer.component.js +184 -0
- package/src/lib/components/create-artifact-drawer.component.js.map +1 -0
- package/src/lib/components/grid-form-template.component.d.ts +21 -0
- package/src/lib/components/grid-form-template.component.js +81 -0
- package/src/lib/components/grid-form-template.component.js.map +1 -0
- package/src/lib/components/icon-select.component.d.ts +52 -0
- package/src/lib/components/icon-select.component.js +453 -0
- package/src/lib/components/icon-select.component.js.map +1 -0
- package/src/lib/components/select.component.d.ts +58 -0
- package/src/lib/components/select.component.js +107 -0
- package/src/lib/components/select.component.js.map +1 -0
- package/src/lib/components/switch.component.d.ts +38 -0
- package/src/lib/components/switch.component.js +76 -0
- package/src/lib/components/switch.component.js.map +1 -0
- package/src/lib/components/text-field.component.d.ts +45 -0
- package/src/lib/components/text-field.component.js +77 -0
- package/src/lib/components/text-field.component.js.map +1 -0
- package/src/lib/components/textarea.component.d.ts +45 -0
- package/src/lib/components/textarea.component.js +61 -0
- package/src/lib/components/textarea.component.js.map +1 -0
- package/src/lib/components/toggle-button.component.d.ts +27 -0
- package/src/lib/components/toggle-button.component.js +116 -0
- package/src/lib/components/toggle-button.component.js.map +1 -0
- package/src/lib/constants/component-mappers.d.ts +42 -0
- package/src/lib/constants/component-mappers.js +70 -0
- package/src/lib/constants/component-mappers.js.map +1 -0
- package/src/lib/constants/dynamic-fields.d.ts +45 -0
- package/src/lib/constants/dynamic-fields.js +65 -0
- package/src/lib/constants/dynamic-fields.js.map +1 -0
- package/src/lib/constants/field-configurations.d.ts +53 -0
- package/src/lib/constants/field-configurations.js +121 -0
- package/src/lib/constants/field-configurations.js.map +1 -0
- package/src/lib/constants/flags.d.ts +72 -0
- package/src/lib/constants/flags.js +69 -0
- package/src/lib/constants/flags.js.map +1 -0
- package/src/lib/hocs/with-grid-item.d.ts +25 -0
- package/src/lib/hocs/with-grid-item.js +48 -0
- package/src/lib/hocs/with-grid-item.js.map +1 -0
- package/src/lib/jsx-forms.d.ts +41 -0
- package/src/lib/jsx-forms.js +42 -0
- package/src/lib/jsx-forms.js.map +1 -0
- package/src/lib/mapper/breakpoint-span.d.ts +73 -0
- package/src/lib/mapper/breakpoint-span.js +346 -0
- package/src/lib/mapper/breakpoint-span.js.map +1 -0
- package/src/lib/mapper/checkbox.d.ts +43 -0
- package/src/lib/mapper/checkbox.js +111 -0
- package/src/lib/mapper/checkbox.js.map +1 -0
- package/src/lib/mapper/css-border.d.ts +113 -0
- package/src/lib/mapper/css-border.js +410 -0
- package/src/lib/mapper/css-border.js.map +1 -0
- package/src/lib/mapper/css-dimension.d.ts +89 -0
- package/src/lib/mapper/css-dimension.js +327 -0
- package/src/lib/mapper/css-dimension.js.map +1 -0
- package/src/lib/mapper/css-gradient.d.ts +110 -0
- package/src/lib/mapper/css-gradient.js +720 -0
- package/src/lib/mapper/css-gradient.js.map +1 -0
- package/src/lib/mapper/data-table.d.ts +23 -0
- package/src/lib/mapper/data-table.js +296 -0
- package/src/lib/mapper/data-table.js.map +1 -0
- package/src/lib/mapper/date-picker.d.ts +26 -0
- package/src/lib/mapper/date-picker.js +69 -0
- package/src/lib/mapper/date-picker.js.map +1 -0
- package/src/lib/mapper/dual-list-select.d.ts +115 -0
- package/src/lib/mapper/dual-list-select.js +353 -0
- package/src/lib/mapper/dual-list-select.js.map +1 -0
- package/src/lib/mapper/field-array.d.ts +71 -0
- package/src/lib/mapper/field-array.js +326 -0
- package/src/lib/mapper/field-array.js.map +1 -0
- package/src/lib/mapper/form-field-grid.d.ts +155 -0
- package/src/lib/mapper/form-field-grid.js +194 -0
- package/src/lib/mapper/form-field-grid.js.map +1 -0
- package/src/lib/mapper/index.d.ts +50 -0
- package/src/lib/mapper/index.js +49 -0
- package/src/lib/mapper/index.js.map +1 -0
- package/src/lib/mapper/multiple-choice-list.d.ts +32 -0
- package/src/lib/mapper/multiple-choice-list.js +105 -0
- package/src/lib/mapper/multiple-choice-list.js.map +1 -0
- package/src/lib/mapper/plain-text.d.ts +31 -0
- package/src/lib/mapper/plain-text.js +48 -0
- package/src/lib/mapper/plain-text.js.map +1 -0
- package/src/lib/mapper/preset-choice.d.ts +106 -0
- package/src/lib/mapper/preset-choice.js +267 -0
- package/src/lib/mapper/preset-choice.js.map +1 -0
- package/src/lib/mapper/radio.d.ts +40 -0
- package/src/lib/mapper/radio.js +122 -0
- package/src/lib/mapper/radio.js.map +1 -0
- package/src/lib/mapper/select.d.ts +60 -0
- package/src/lib/mapper/select.js +203 -0
- package/src/lib/mapper/select.js.map +1 -0
- package/src/lib/mapper/slider.d.ts +45 -0
- package/src/lib/mapper/slider.js +119 -0
- package/src/lib/mapper/slider.js.map +1 -0
- package/src/lib/mapper/stored-field-value.d.ts +23 -0
- package/src/lib/mapper/stored-field-value.js +29 -0
- package/src/lib/mapper/stored-field-value.js.map +1 -0
- package/src/lib/mapper/sub-form.d.ts +39 -0
- package/src/lib/mapper/sub-form.js +108 -0
- package/src/lib/mapper/sub-form.js.map +1 -0
- package/src/lib/mapper/switch.d.ts +47 -0
- package/src/lib/mapper/switch.js +93 -0
- package/src/lib/mapper/switch.js.map +1 -0
- package/src/lib/mapper/tabs.d.ts +34 -0
- package/src/lib/mapper/tabs.js +64 -0
- package/src/lib/mapper/tabs.js.map +1 -0
- package/src/lib/mapper/text-field.d.ts +33 -0
- package/src/lib/mapper/text-field.js +88 -0
- package/src/lib/mapper/text-field.js.map +1 -0
- package/src/lib/mapper/textarea.d.ts +31 -0
- package/src/lib/mapper/textarea.js +68 -0
- package/src/lib/mapper/textarea.js.map +1 -0
- package/src/lib/mapper/theme-scale.d.ts +79 -0
- package/src/lib/mapper/theme-scale.js +162 -0
- package/src/lib/mapper/theme-scale.js.map +1 -0
- package/src/lib/mapper/time-picker.d.ts +26 -0
- package/src/lib/mapper/time-picker.js +69 -0
- package/src/lib/mapper/time-picker.js.map +1 -0
- package/src/lib/mapper/types.d.ts +43 -0
- package/src/lib/mapper/types.js +22 -0
- package/src/lib/mapper/types.js.map +1 -0
- package/src/lib/mapper/validation-error.d.ts +24 -0
- package/src/lib/mapper/validation-error.js +24 -0
- package/src/lib/mapper/validation-error.js.map +1 -0
- package/src/lib/mapper/wizard.d.ts +21 -0
- package/src/lib/mapper/wizard.js +203 -0
- package/src/lib/mapper/wizard.js.map +1 -0
- package/src/lib/types.d.ts +19 -0
- package/src/lib/types.js +18 -0
- package/src/lib/types.js.map +1 -0
- package/src/lib/utils/option-is-equal-to-value.d.ts +20 -0
- package/src/lib/utils/option-is-equal-to-value.js +21 -0
- package/src/lib/utils/option-is-equal-to-value.js.map +1 -0
- package/src/lib/utils/validation-message.d.ts +22 -0
- package/src/lib/utils/validation-message.js +24 -0
- package/src/lib/utils/validation-message.js.map +1 -0
- package/src/lib/vendor/data-driven-forms.d.ts +33 -0
- package/src/lib/vendor/data-driven-forms.js +29 -0
- package/src/lib/vendor/data-driven-forms.js.map +1 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /**
|
|
17
|
+
* Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0) and
|
|
18
|
+
* updated for the current MUI Grid API (`size` instead of `item`/`xs`).
|
|
19
|
+
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
20
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { ICON_VARIANT_VISIBILITY_HIDDEN, ICON_VARIANT_VISIBILITY_SHOWN } from "@aglyn/shared-data-enums";
|
|
23
|
+
import { mdiCodeBraces } from "@aglyn/shared-data-mdi";
|
|
24
|
+
import { HelpTip, MdiIcon } from "@aglyn/shared-ui-jsx";
|
|
25
|
+
import { formControlClasses, formLabelClasses, Grid, IconButton, inputBaseClasses, Tooltip, toggleButtonGroupClasses, typographyClasses } from "@mui/material";
|
|
26
|
+
import { styled } from "@mui/material/styles";
|
|
27
|
+
import clsx from "clsx";
|
|
28
|
+
const PREFIX = 'FormFieldGrid';
|
|
29
|
+
const classes = {
|
|
30
|
+
grid: `${PREFIX}-grid`,
|
|
31
|
+
muted: `${PREFIX}-muted`
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* How a row whose declaration is switched off reads.
|
|
35
|
+
*
|
|
36
|
+
* It has to say "set, but not applying" and never "unset" — that distinction
|
|
37
|
+
* is the whole point of switching a declaration off rather than deleting it.
|
|
38
|
+
* So the VALUE is struck through and the control fades, while the corner
|
|
39
|
+
* buttons stay at full strength: they are the way back, and must not look
|
|
40
|
+
* disabled themselves.
|
|
41
|
+
*
|
|
42
|
+
* Exported as a plain sx object because a mute can sit on surfaces that are
|
|
43
|
+
* not grid-wrapped fields — the inline toggle rows, the box editor's sides,
|
|
44
|
+
* the custom-CSS builder — and all of them have to read the same.
|
|
45
|
+
*/ export const FIELD_MUTED_STYLES = {
|
|
46
|
+
[[
|
|
47
|
+
`& .${formControlClasses.root}`,
|
|
48
|
+
`& .${formLabelClasses.root}`,
|
|
49
|
+
`& .${typographyClasses.root}`,
|
|
50
|
+
`& .${toggleButtonGroupClasses.root}`
|
|
51
|
+
].join(',')]: {
|
|
52
|
+
opacity: 0.5
|
|
53
|
+
},
|
|
54
|
+
[`& .${inputBaseClasses.input}`]: {
|
|
55
|
+
textDecoration: 'line-through'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const StyledGrid = styled(Grid)({
|
|
59
|
+
[`&.${classes.grid}`]: {
|
|
60
|
+
position: 'relative'
|
|
61
|
+
},
|
|
62
|
+
[`&.${classes.muted}`]: FIELD_MUTED_STYLES
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* Builds a {@link FieldClearAction} for one editor.
|
|
66
|
+
*
|
|
67
|
+
* `hasValue` is passed in rather than derived from a form value because
|
|
68
|
+
* `0` and `'0'` are legitimate style values and this repo compiles with
|
|
69
|
+
* `strictNullChecks` off — a falsy test here would hide the clear button
|
|
70
|
+
* on exactly the values hardest to type back in.
|
|
71
|
+
*/ export const buildFieldClear = (options)=>{
|
|
72
|
+
const { clearable, label, hasValue, locked, onClear } = options;
|
|
73
|
+
if (!clearable || locked) return undefined;
|
|
74
|
+
return {
|
|
75
|
+
label: typeof label === 'string' && label ? `Clear ${label}` : 'Clear value',
|
|
76
|
+
hidden: !hasValue,
|
|
77
|
+
onClear
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* The eye itself, so every surface that can carry a mute renders the same
|
|
82
|
+
* control: the grid-wrapped fields, the inline toggle rows, the box editor's
|
|
83
|
+
* sides and the custom-CSS builder. `offset` places it in a corner where one
|
|
84
|
+
* is free.
|
|
85
|
+
*/ export const FieldMuteButton = ({ mute, offset, sx })=>mute ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
86
|
+
title: mute.label,
|
|
87
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
88
|
+
size: "small",
|
|
89
|
+
"aria-label": mute.label,
|
|
90
|
+
"aria-pressed": !!mute.muted,
|
|
91
|
+
onClick: mute.onToggle,
|
|
92
|
+
sx: _extends({
|
|
93
|
+
p: 0.25,
|
|
94
|
+
fontSize: '0.85rem',
|
|
95
|
+
lineHeight: 1,
|
|
96
|
+
color: mute.muted ? 'secondary.main' : 'text.secondary'
|
|
97
|
+
}, offset === undefined ? {} : {
|
|
98
|
+
position: 'absolute',
|
|
99
|
+
top: -8,
|
|
100
|
+
right: offset,
|
|
101
|
+
zIndex: 1
|
|
102
|
+
}, sx),
|
|
103
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
104
|
+
fontSize: "inherit",
|
|
105
|
+
path: mute.muted ? ICON_VARIANT_VISIBILITY_HIDDEN.path : ICON_VARIANT_VISIBILITY_SHOWN.path
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
}) : null;
|
|
109
|
+
FieldMuteButton.displayName = 'AglynFieldMuteButton';
|
|
110
|
+
/** Class marking a row whose declaration is switched off. */ export const FIELD_MUTED_CLASS = classes.muted;
|
|
111
|
+
export const FormFieldGrid = (_0)=>{
|
|
112
|
+
let { children, className, help, clear, mute, bind, size = {
|
|
113
|
+
xs: 12
|
|
114
|
+
} } = _0, props = _object_without_properties_loose(_0, [
|
|
115
|
+
"children",
|
|
116
|
+
"className",
|
|
117
|
+
"help",
|
|
118
|
+
"clear",
|
|
119
|
+
"mute",
|
|
120
|
+
"bind",
|
|
121
|
+
"size"
|
|
122
|
+
]);
|
|
123
|
+
return /*#__PURE__*/ _jsxs(StyledGrid, _extends({
|
|
124
|
+
size: size,
|
|
125
|
+
className: clsx(classes.grid, (mute == null ? void 0 : mute.muted) && classes.muted, className)
|
|
126
|
+
}, props, {
|
|
127
|
+
children: [
|
|
128
|
+
children,
|
|
129
|
+
bind ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
130
|
+
title: bind.label,
|
|
131
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
132
|
+
size: "small",
|
|
133
|
+
"aria-label": bind.label,
|
|
134
|
+
onClick: (event)=>bind.onOpen(event.currentTarget),
|
|
135
|
+
sx: {
|
|
136
|
+
position: 'absolute',
|
|
137
|
+
top: -8,
|
|
138
|
+
// Outermost of all, for the reason the mute button below is
|
|
139
|
+
// outermost of the rest: every control an author has already
|
|
140
|
+
// learned the place of stays exactly where it was.
|
|
141
|
+
right: (help ? 22 : 0) + (clear && !clear.hidden ? 22 : 0) + (mute ? 22 : 0),
|
|
142
|
+
zIndex: 1,
|
|
143
|
+
p: 0.25,
|
|
144
|
+
fontSize: '0.85rem',
|
|
145
|
+
lineHeight: 1,
|
|
146
|
+
color: 'text.secondary'
|
|
147
|
+
},
|
|
148
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
149
|
+
fontSize: "inherit",
|
|
150
|
+
path: mdiCodeBraces.path
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
}) : null,
|
|
154
|
+
/*#__PURE__*/ _jsx(FieldMuteButton, {
|
|
155
|
+
mute: mute,
|
|
156
|
+
// Outermost of the corner controls, so adding it never moves the help
|
|
157
|
+
// tip or the clear button an author has learned the place of.
|
|
158
|
+
offset: (help ? 22 : 0) + (clear && !clear.hidden ? 22 : 0)
|
|
159
|
+
}),
|
|
160
|
+
clear && !clear.hidden && /*#__PURE__*/ _jsx(Tooltip, {
|
|
161
|
+
title: clear.label,
|
|
162
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
163
|
+
size: "small",
|
|
164
|
+
"aria-label": clear.label,
|
|
165
|
+
disabled: clear.disabled,
|
|
166
|
+
onClick: clear.onClear,
|
|
167
|
+
sx: {
|
|
168
|
+
position: 'absolute',
|
|
169
|
+
top: -8,
|
|
170
|
+
right: help ? 22 : 0,
|
|
171
|
+
zIndex: 1,
|
|
172
|
+
p: 0.25,
|
|
173
|
+
fontSize: '0.85rem',
|
|
174
|
+
lineHeight: 1,
|
|
175
|
+
color: 'text.secondary'
|
|
176
|
+
},
|
|
177
|
+
children: '✕'
|
|
178
|
+
})
|
|
179
|
+
}),
|
|
180
|
+
help && /*#__PURE__*/ _jsx(HelpTip, _extends({}, help, {
|
|
181
|
+
sx: {
|
|
182
|
+
position: 'absolute',
|
|
183
|
+
top: -6,
|
|
184
|
+
right: 0,
|
|
185
|
+
fontSize: '0.95em',
|
|
186
|
+
zIndex: 1
|
|
187
|
+
}
|
|
188
|
+
}))
|
|
189
|
+
]
|
|
190
|
+
}));
|
|
191
|
+
};
|
|
192
|
+
export default FormFieldGrid;
|
|
193
|
+
|
|
194
|
+
//# sourceMappingURL=form-field-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/mapper/form-field-grid.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0) and\n * updated for the current MUI Grid API (`size` instead of `item`/`xs`).\n */\n\nimport type { ReactNode } from 'react'\n\nimport {\n ICON_VARIANT_VISIBILITY_HIDDEN,\n ICON_VARIANT_VISIBILITY_SHOWN,\n} from '@aglyn/shared-data-enums'\nimport { mdiCodeBraces } from '@aglyn/shared-data-mdi'\nimport { HelpTip, type HelpTipContent, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport {\n formControlClasses,\n formLabelClasses,\n Grid,\n type GridProps,\n IconButton,\n inputBaseClasses,\n Tooltip,\n toggleButtonGroupClasses,\n typographyClasses,\n} from '@mui/material'\nimport { styled } from '@mui/material/styles'\n\nimport clsx from 'clsx'\n\nconst PREFIX = 'FormFieldGrid'\n\nconst classes = {\n grid: `${PREFIX}-grid`,\n muted: `${PREFIX}-muted`,\n}\n\n/**\n * How a row whose declaration is switched off reads.\n *\n * It has to say \"set, but not applying\" and never \"unset\" — that distinction\n * is the whole point of switching a declaration off rather than deleting it.\n * So the VALUE is struck through and the control fades, while the corner\n * buttons stay at full strength: they are the way back, and must not look\n * disabled themselves.\n *\n * Exported as a plain sx object because a mute can sit on surfaces that are\n * not grid-wrapped fields — the inline toggle rows, the box editor's sides,\n * the custom-CSS builder — and all of them have to read the same.\n */\nexport const FIELD_MUTED_STYLES = {\n [[\n `& .${formControlClasses.root}`,\n `& .${formLabelClasses.root}`,\n `& .${typographyClasses.root}`,\n `& .${toggleButtonGroupClasses.root}`,\n ].join(',')]: {\n opacity: 0.5,\n },\n [`& .${inputBaseClasses.input}`]: {\n textDecoration: 'line-through',\n },\n}\n\nconst StyledGrid = styled(Grid)({\n [`&.${classes.grid}`]: {\n position: 'relative',\n },\n [`&.${classes.muted}`]: FIELD_MUTED_STYLES,\n})\n\n/**\n * The \"put this field back to unset\" affordance (AGL-2486).\n *\n * Every editor in the styles panel could SET a value and none of them\n * could take one off again: a colour typed once stayed on the node\n * forever, because \"unset\" is not a value any of these controls can be\n * driven to — a colour picker has no empty swatch, a length box with a\n * unit picked re-serializes `px` onto an emptied number, and a select's\n * \"Default\" option only exists where someone remembered to author one.\n * The way back has to be a control of its own.\n *\n * It lives on the shared wrapper rather than inside each editor so the\n * affordance is one thing in one place — but each editor still supplies\n * {@link onClear}, because what \"clear\" MEANS differs per editor (a\n * gradient drops its stops, a length drops its unit) and a wrapper that\n * only knew the form value would leave those drafts behind.\n */\nexport interface FieldClearAction {\n /** Accessible name, e.g. `Clear Text Color`. */\n label: string\n /** Nothing to clear — the button is not rendered at all. */\n hidden?: boolean\n disabled?: boolean\n onClear: () => void\n}\n\n/**\n * Builds a {@link FieldClearAction} for one editor.\n *\n * `hasValue` is passed in rather than derived from a form value because\n * `0` and `'0'` are legitimate style values and this repo compiles with\n * `strictNullChecks` off — a falsy test here would hide the clear button\n * on exactly the values hardest to type back in.\n */\nexport const buildFieldClear = (options: {\n /** Opt-in: only fields whose schema asks for it get the affordance. */\n clearable?: boolean\n label?: ReactNode\n hasValue: boolean\n locked?: boolean\n onClear: () => void\n}): FieldClearAction | undefined => {\n const { clearable, label, hasValue, locked, onClear } = options\n if (!clearable || locked) return undefined\n return {\n label:\n typeof label === 'string' && label ? `Clear ${label}` : 'Clear value',\n hidden: !hasValue,\n onClear,\n }\n}\n\n/**\n * The \"stop applying this one declaration, keep its value\" affordance\n * (AGL-2486) — the browser-devtools checkbox, in the styles panel.\n *\n * Distinct from {@link FieldClearAction} in the only way that matters: clear\n * takes the value off the element, mute leaves it exactly where it is and\n * stops it painting, so a layout can be looked at with one property switched\n * off and the comparison value is still there to switch back on.\n *\n * Supplied by the panel through the field's `FormFieldGridProps`, not by each\n * editor, because unlike clear it needs nothing from the editor: which\n * declaration to mute is the field's own name, and where the mute lives is\n * the panel's business.\n */\nexport interface FieldMuteAction {\n /** Accessible name, e.g. `Stop applying Max Width`. */\n label: string\n /** True while the declaration is switched off. */\n muted?: boolean\n onToggle: () => void\n}\n\n/**\n * The eye itself, so every surface that can carry a mute renders the same\n * control: the grid-wrapped fields, the inline toggle rows, the box editor's\n * sides and the custom-CSS builder. `offset` places it in a corner where one\n * is free.\n */\nexport const FieldMuteButton = ({\n mute,\n offset,\n sx,\n}: {\n mute?: FieldMuteAction\n offset?: number\n sx?: object\n}) =>\n mute ? (\n <Tooltip title={mute.label}>\n <IconButton\n size=\"small\"\n aria-label={mute.label}\n aria-pressed={!!mute.muted}\n onClick={mute.onToggle}\n sx={{\n p: 0.25,\n fontSize: '0.85rem',\n lineHeight: 1,\n color: mute.muted ? 'secondary.main' : 'text.secondary',\n ...(offset === undefined\n ? {}\n : { position: 'absolute', top: -8, right: offset, zIndex: 1 }),\n ...sx,\n }}\n >\n <MdiIcon\n fontSize=\"inherit\"\n path={\n mute.muted\n ? ICON_VARIANT_VISIBILITY_HIDDEN.path\n : ICON_VARIANT_VISIBILITY_SHOWN.path\n }\n />\n </IconButton>\n </Tooltip>\n ) : null\nFieldMuteButton.displayName = 'AglynFieldMuteButton'\n\n/** Class marking a row whose declaration is switched off. */\nexport const FIELD_MUTED_CLASS = classes.muted\n\n/**\n * The \"let something else supply this value\" affordance — the `{}` a\n * free-text field carries inside its box, for a field that has no box to\n * carry it in.\n *\n * A switch or a checkbox has no box to put an end adornment in, so the button\n * joins the corner controls instead, where it sits the same way on any field.\n * What it opens is the caller's business: the field's name is all a wrapper\n * knows, and which values may stand in for it is a question only the surface\n * that rendered the field can answer.\n */\nexport interface FieldBindAction {\n /** Accessible name, e.g. `Bind Autoplay to a property`. */\n label: string\n /** Opens the caller's picker, anchored on the button that was pressed. */\n onOpen: (anchor: HTMLElement) => void\n}\n\nexport interface FormFieldGridProps extends Omit<GridProps, 'size'> {\n children?: ReactNode\n className?: string\n size?: GridProps['size']\n /** Contextual help affordance at the field's top-right (AGL-601). */\n help?: HelpTipContent\n /** Reset-to-unset affordance at the field's top-right (AGL-2486). */\n clear?: FieldClearAction\n /** Switch this declaration off without losing it (AGL-2486). */\n mute?: FieldMuteAction\n /** Supply this value from elsewhere, e.g. a component property. */\n bind?: FieldBindAction\n}\n\nexport const FormFieldGrid = ({\n children,\n className,\n help,\n clear,\n mute,\n bind,\n size = { xs: 12 },\n ...props\n}: FormFieldGridProps) => (\n <StyledGrid\n size={size}\n className={clsx(classes.grid, mute?.muted && classes.muted, className)}\n {...props}\n >\n {children}\n {bind ? (\n <Tooltip title={bind.label}>\n <IconButton\n size=\"small\"\n aria-label={bind.label}\n onClick={(event) => bind.onOpen(event.currentTarget)}\n sx={{\n position: 'absolute',\n top: -8,\n // Outermost of all, for the reason the mute button below is\n // outermost of the rest: every control an author has already\n // learned the place of stays exactly where it was.\n right:\n (help ? 22 : 0) +\n (clear && !clear.hidden ? 22 : 0) +\n (mute ? 22 : 0),\n zIndex: 1,\n p: 0.25,\n fontSize: '0.85rem',\n lineHeight: 1,\n color: 'text.secondary',\n }}\n >\n <MdiIcon fontSize=\"inherit\" path={mdiCodeBraces.path} />\n </IconButton>\n </Tooltip>\n ) : null}\n <FieldMuteButton\n mute={mute}\n // Outermost of the corner controls, so adding it never moves the help\n // tip or the clear button an author has learned the place of.\n offset={(help ? 22 : 0) + (clear && !clear.hidden ? 22 : 0)}\n />\n {clear && !clear.hidden && (\n <Tooltip title={clear.label}>\n {/* Sits beside the help tip rather than under it — both are pinned\n to the field's top-right corner. */}\n <IconButton\n size=\"small\"\n aria-label={clear.label}\n disabled={clear.disabled}\n onClick={clear.onClear}\n sx={{\n position: 'absolute',\n top: -8,\n right: help ? 22 : 0,\n zIndex: 1,\n p: 0.25,\n fontSize: '0.85rem',\n lineHeight: 1,\n color: 'text.secondary',\n }}\n >\n {'✕'}\n </IconButton>\n </Tooltip>\n )}\n {help && (\n <HelpTip\n {...help}\n sx={{\n position: 'absolute',\n top: -6,\n right: 0,\n fontSize: '0.95em',\n zIndex: 1,\n }}\n />\n )}\n </StyledGrid>\n)\n\nexport default FormFieldGrid\n"],"names":["ICON_VARIANT_VISIBILITY_HIDDEN","ICON_VARIANT_VISIBILITY_SHOWN","mdiCodeBraces","HelpTip","MdiIcon","formControlClasses","formLabelClasses","Grid","IconButton","inputBaseClasses","Tooltip","toggleButtonGroupClasses","typographyClasses","styled","clsx","PREFIX","classes","grid","muted","FIELD_MUTED_STYLES","root","join","opacity","input","textDecoration","StyledGrid","position","buildFieldClear","options","clearable","label","hasValue","locked","onClear","undefined","hidden","FieldMuteButton","mute","offset","sx","title","size","aria-label","aria-pressed","onClick","onToggle","p","fontSize","lineHeight","color","top","right","zIndex","path","displayName","FIELD_MUTED_CLASS","FormFieldGrid","children","className","help","clear","bind","xs","props","event","onOpen","currentTarget","disabled"],"mappings":"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"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Aglyn's MUI component mapper for data-driven-forms.
|
|
19
|
+
*
|
|
20
|
+
* Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0), which
|
|
21
|
+
* still targets MUI v5, and rewritten against the current MUI APIs (Grid
|
|
22
|
+
* `size`, `slotProps`, `ListItemButton`, x-date-pickers slots) so the
|
|
23
|
+
* patch-package override of the upstream mapper is no longer needed (AGL-226).
|
|
24
|
+
*/
|
|
25
|
+
export { default as Checkbox, SingleCheckbox, type CheckboxProps, type SingleCheckboxProps, } from './checkbox';
|
|
26
|
+
export { default as BreakpointSpan, BreakpointSpanField, seedSpanDraft, serializeSpanDraft, type BreakpointSpanProps, type SpanDraft, } from './breakpoint-span';
|
|
27
|
+
export { default as CssBorder, CssBorderField, seedBorderDraft, serializeBorderDraft, CSS_BORDER_STYLES, CSS_BORDER_STYLE_LABELS, type BorderDraft, type CssBorderProps, type CssBorderStyle, } from './css-border';
|
|
28
|
+
export { default as CssDimension, CssDimensionField, seedDimensionDraft, serializeDimensionDraft, type CssDimensionProps, } from './css-dimension';
|
|
29
|
+
export { default as CssGradient, CssGradientField, seedGradientDraft, serializeGradientDraft, type CssGradientProps, } from './css-gradient';
|
|
30
|
+
export { default as DataTableField, type DataTableFieldProps, } from './data-table';
|
|
31
|
+
export { default as DatePicker, type DatePickerProps } from './date-picker';
|
|
32
|
+
export { default as DualListSelect, type DualListSelectProps, } from './dual-list-select';
|
|
33
|
+
export { default as FieldArray, DynamicArray, type FieldArrayProps, } from './field-array';
|
|
34
|
+
export { FIELD_MUTED_CLASS, FIELD_MUTED_STYLES, FieldMuteButton, type FieldBindAction, type FieldMuteAction, default as FormFieldGrid, type FormFieldGridProps, } from './form-field-grid';
|
|
35
|
+
export { default as MultipleChoiceList, type MultipleChoiceListProps, } from './multiple-choice-list';
|
|
36
|
+
export { default as PlainText, type PlainTextProps } from './plain-text';
|
|
37
|
+
export { default as PresetChoice, PresetChoiceField, findPresetChoice, presetChoiceValueToText, PRESET_CHOICE_CUSTOM, type PresetChoiceOption, type PresetChoicePreview, type PresetChoiceProps, } from './preset-choice';
|
|
38
|
+
export { default as Radio, type RadioProps } from './radio';
|
|
39
|
+
export { default as Select, type SelectProps } from './select';
|
|
40
|
+
export { default as Slider, type SliderProps } from './slider';
|
|
41
|
+
export { default as SubForm, type SubFormProps } from './sub-form';
|
|
42
|
+
export { default as Switch, type SwitchProps } from './switch';
|
|
43
|
+
export { default as Tabs, FormTabs, type FormTabsProps } from './tabs';
|
|
44
|
+
export { default as TextField, type TextFieldProps } from './text-field';
|
|
45
|
+
export { default as Textarea, type TextareaProps } from './textarea';
|
|
46
|
+
export { default as ThemeScale, ThemeScaleField, filterThemeScaleOptions, themeScaleValueToText, type ThemeScaleOption, type ThemeScaleProps, } from './theme-scale';
|
|
47
|
+
export { default as TimePicker, type TimePickerProps } from './time-picker';
|
|
48
|
+
export { default as Wizard, type WizardProps } from './wizard';
|
|
49
|
+
export type { BaseFieldProps, OptionValue, SelectOption, SelectValue, } from './types';
|
|
50
|
+
export { default as validationError, type ExtendedFieldMeta, } from './validation-error';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /**
|
|
17
|
+
* Aglyn's MUI component mapper for data-driven-forms.
|
|
18
|
+
*
|
|
19
|
+
* Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0), which
|
|
20
|
+
* still targets MUI v5, and rewritten against the current MUI APIs (Grid
|
|
21
|
+
* `size`, `slotProps`, `ListItemButton`, x-date-pickers slots) so the
|
|
22
|
+
* patch-package override of the upstream mapper is no longer needed (AGL-226).
|
|
23
|
+
*/ export { default as Checkbox, SingleCheckbox } from "./checkbox.js";
|
|
24
|
+
export { default as BreakpointSpan, BreakpointSpanField, seedSpanDraft, serializeSpanDraft } from "./breakpoint-span.js";
|
|
25
|
+
export { default as CssBorder, CssBorderField, seedBorderDraft, serializeBorderDraft, CSS_BORDER_STYLES, CSS_BORDER_STYLE_LABELS } from "./css-border.js";
|
|
26
|
+
export { default as CssDimension, CssDimensionField, seedDimensionDraft, serializeDimensionDraft } from "./css-dimension.js";
|
|
27
|
+
export { default as CssGradient, CssGradientField, seedGradientDraft, serializeGradientDraft } from "./css-gradient.js";
|
|
28
|
+
export { default as DataTableField } from "./data-table.js";
|
|
29
|
+
export { default as DatePicker } from "./date-picker.js";
|
|
30
|
+
export { default as DualListSelect } from "./dual-list-select.js";
|
|
31
|
+
export { default as FieldArray, DynamicArray } from "./field-array.js";
|
|
32
|
+
export { FIELD_MUTED_CLASS, FIELD_MUTED_STYLES, FieldMuteButton, default as FormFieldGrid } from "./form-field-grid.js";
|
|
33
|
+
export { default as MultipleChoiceList } from "./multiple-choice-list.js";
|
|
34
|
+
export { default as PlainText } from "./plain-text.js";
|
|
35
|
+
export { default as PresetChoice, PresetChoiceField, findPresetChoice, presetChoiceValueToText, PRESET_CHOICE_CUSTOM } from "./preset-choice.js";
|
|
36
|
+
export { default as Radio } from "./radio.js";
|
|
37
|
+
export { default as Select } from "./select.js";
|
|
38
|
+
export { default as Slider } from "./slider.js";
|
|
39
|
+
export { default as SubForm } from "./sub-form.js";
|
|
40
|
+
export { default as Switch } from "./switch.js";
|
|
41
|
+
export { default as Tabs, FormTabs } from "./tabs.js";
|
|
42
|
+
export { default as TextField } from "./text-field.js";
|
|
43
|
+
export { default as Textarea } from "./textarea.js";
|
|
44
|
+
export { default as ThemeScale, ThemeScaleField, filterThemeScaleOptions, themeScaleValueToText } from "./theme-scale.js";
|
|
45
|
+
export { default as TimePicker } from "./time-picker.js";
|
|
46
|
+
export { default as Wizard } from "./wizard.js";
|
|
47
|
+
export { default as validationError } from "./validation-error.js";
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/mapper/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Aglyn's MUI component mapper for data-driven-forms.\n *\n * Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0), which\n * still targets MUI v5, and rewritten against the current MUI APIs (Grid\n * `size`, `slotProps`, `ListItemButton`, x-date-pickers slots) so the\n * patch-package override of the upstream mapper is no longer needed (AGL-226).\n */\n\nexport {\n default as Checkbox,\n SingleCheckbox,\n type CheckboxProps,\n type SingleCheckboxProps,\n} from './checkbox'\nexport {\n default as BreakpointSpan,\n BreakpointSpanField,\n seedSpanDraft,\n serializeSpanDraft,\n type BreakpointSpanProps,\n type SpanDraft,\n} from './breakpoint-span'\nexport {\n default as CssBorder,\n CssBorderField,\n seedBorderDraft,\n serializeBorderDraft,\n CSS_BORDER_STYLES,\n CSS_BORDER_STYLE_LABELS,\n type BorderDraft,\n type CssBorderProps,\n type CssBorderStyle,\n} from './css-border'\nexport {\n default as CssDimension,\n CssDimensionField,\n seedDimensionDraft,\n serializeDimensionDraft,\n type CssDimensionProps,\n} from './css-dimension'\nexport {\n default as CssGradient,\n CssGradientField,\n seedGradientDraft,\n serializeGradientDraft,\n type CssGradientProps,\n} from './css-gradient'\nexport {\n default as DataTableField,\n type DataTableFieldProps,\n} from './data-table'\nexport { default as DatePicker, type DatePickerProps } from './date-picker'\nexport {\n default as DualListSelect,\n type DualListSelectProps,\n} from './dual-list-select'\nexport {\n default as FieldArray,\n DynamicArray,\n type FieldArrayProps,\n} from './field-array'\nexport {\n FIELD_MUTED_CLASS,\n FIELD_MUTED_STYLES,\n FieldMuteButton,\n type FieldBindAction,\n type FieldMuteAction,\n default as FormFieldGrid,\n type FormFieldGridProps,\n} from './form-field-grid'\nexport {\n default as MultipleChoiceList,\n type MultipleChoiceListProps,\n} from './multiple-choice-list'\nexport { default as PlainText, type PlainTextProps } from './plain-text'\nexport {\n default as PresetChoice,\n PresetChoiceField,\n findPresetChoice,\n presetChoiceValueToText,\n PRESET_CHOICE_CUSTOM,\n type PresetChoiceOption,\n type PresetChoicePreview,\n type PresetChoiceProps,\n} from './preset-choice'\nexport { default as Radio, type RadioProps } from './radio'\nexport { default as Select, type SelectProps } from './select'\nexport { default as Slider, type SliderProps } from './slider'\nexport { default as SubForm, type SubFormProps } from './sub-form'\nexport { default as Switch, type SwitchProps } from './switch'\nexport { default as Tabs, FormTabs, type FormTabsProps } from './tabs'\nexport { default as TextField, type TextFieldProps } from './text-field'\nexport { default as Textarea, type TextareaProps } from './textarea'\nexport {\n default as ThemeScale,\n ThemeScaleField,\n filterThemeScaleOptions,\n themeScaleValueToText,\n type ThemeScaleOption,\n type ThemeScaleProps,\n} from './theme-scale'\nexport { default as TimePicker, type TimePickerProps } from './time-picker'\nexport { default as Wizard, type WizardProps } from './wizard'\nexport type {\n BaseFieldProps,\n OptionValue,\n SelectOption,\n SelectValue,\n} from './types'\nexport {\n default as validationError,\n type ExtendedFieldMeta,\n} from './validation-error'\n"],"names":["default","Checkbox","SingleCheckbox","BreakpointSpan","BreakpointSpanField","seedSpanDraft","serializeSpanDraft","CssBorder","CssBorderField","seedBorderDraft","serializeBorderDraft","CSS_BORDER_STYLES","CSS_BORDER_STYLE_LABELS","CssDimension","CssDimensionField","seedDimensionDraft","serializeDimensionDraft","CssGradient","CssGradientField","seedGradientDraft","serializeGradientDraft","DataTableField","DatePicker","DualListSelect","FieldArray","DynamicArray","FIELD_MUTED_CLASS","FIELD_MUTED_STYLES","FieldMuteButton","FormFieldGrid","MultipleChoiceList","PlainText","PresetChoice","PresetChoiceField","findPresetChoice","presetChoiceValueToText","PRESET_CHOICE_CUSTOM","Radio","Select","Slider","SubForm","Switch","Tabs","FormTabs","TextField","Textarea","ThemeScale","ThemeScaleField","filterThemeScaleOptions","themeScaleValueToText","TimePicker","Wizard","validationError"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;CAOC,GAED,SACEA,WAAWC,QAAQ,EACnBC,cAAc,QAGT,gBAAY;AACnB,SACEF,WAAWG,cAAc,EACzBC,mBAAmB,EACnBC,aAAa,EACbC,kBAAkB,QAGb,uBAAmB;AAC1B,SACEN,WAAWO,SAAS,EACpBC,cAAc,EACdC,eAAe,EACfC,oBAAoB,EACpBC,iBAAiB,EACjBC,uBAAuB,QAIlB,kBAAc;AACrB,SACEZ,WAAWa,YAAY,EACvBC,iBAAiB,EACjBC,kBAAkB,EAClBC,uBAAuB,QAElB,qBAAiB;AACxB,SACEhB,WAAWiB,WAAW,EACtBC,gBAAgB,EAChBC,iBAAiB,EACjBC,sBAAsB,QAEjB,oBAAgB;AACvB,SACEpB,WAAWqB,cAAc,QAEpB,kBAAc;AACrB,SAASrB,WAAWsB,UAAU,QAA8B,mBAAe;AAC3E,SACEtB,WAAWuB,cAAc,QAEpB,wBAAoB;AAC3B,SACEvB,WAAWwB,UAAU,EACrBC,YAAY,QAEP,mBAAe;AACtB,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAe,EAGf5B,WAAW6B,aAAa,QAEnB,uBAAmB;AAC1B,SACE7B,WAAW8B,kBAAkB,QAExB,4BAAwB;AAC/B,SAAS9B,WAAW+B,SAAS,QAA6B,kBAAc;AACxE,SACE/B,WAAWgC,YAAY,EACvBC,iBAAiB,EACjBC,gBAAgB,EAChBC,uBAAuB,EACvBC,oBAAoB,QAIf,qBAAiB;AACxB,SAASpC,WAAWqC,KAAK,QAAyB,aAAS;AAC3D,SAASrC,WAAWsC,MAAM,QAA0B,cAAU;AAC9D,SAAStC,WAAWuC,MAAM,QAA0B,cAAU;AAC9D,SAASvC,WAAWwC,OAAO,QAA2B,gBAAY;AAClE,SAASxC,WAAWyC,MAAM,QAA0B,cAAU;AAC9D,SAASzC,WAAW0C,IAAI,EAAEC,QAAQ,QAA4B,YAAQ;AACtE,SAAS3C,WAAW4C,SAAS,QAA6B,kBAAc;AACxE,SAAS5C,WAAW6C,QAAQ,QAA4B,gBAAY;AACpE,SACE7C,WAAW8C,UAAU,EACrBC,eAAe,EACfC,uBAAuB,EACvBC,qBAAqB,QAGhB,mBAAe;AACtB,SAASjD,WAAWkD,UAAU,QAA8B,mBAAe;AAC3E,SAASlD,WAAWmD,MAAM,QAA0B,cAAU;AAO9D,SACEnD,WAAWoD,eAAe,QAErB,wBAAoB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { type CheckboxProps as MuiCheckboxProps, type FormControlLabelProps, type FormControlProps, type FormGroupProps, type FormHelperTextProps, type FormLabelProps, type GridProps } from '@mui/material';
|
|
18
|
+
import type { OptionValue, SelectOption } from './types';
|
|
19
|
+
export interface MultipleChoiceListProps<T extends OptionValue = OptionValue> {
|
|
20
|
+
name: string;
|
|
21
|
+
options?: SelectOption<T>[];
|
|
22
|
+
FormControlProps?: FormControlProps;
|
|
23
|
+
FormLabelProps?: FormLabelProps;
|
|
24
|
+
FormGroupProps?: FormGroupProps;
|
|
25
|
+
FormHelperTextProps?: FormHelperTextProps;
|
|
26
|
+
FormFieldGridProps?: GridProps;
|
|
27
|
+
FormControlLabelProps?: Omit<FormControlLabelProps, 'control' | 'label'>;
|
|
28
|
+
CheckboxProps?: MuiCheckboxProps;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
export declare const MultipleChoiceList: <T extends OptionValue = OptionValue>({ FormControlProps, FormLabelProps, FormGroupProps, FormHelperTextProps, help, FormFieldGridProps, FormControlLabelProps, CheckboxProps, name, options, ...props }: MultipleChoiceListProps<T>) => import("react").JSX.Element;
|
|
32
|
+
export default MultipleChoiceList;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2026 Aglyn LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/ /**
|
|
20
|
+
* Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0) and
|
|
21
|
+
* updated for the current MUI Grid API.
|
|
22
|
+
*/ import { createContext, useContext } from "react";
|
|
23
|
+
import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel, Grid } from "@mui/material";
|
|
24
|
+
import MultipleChoiceListCommon from "@data-driven-forms/common/multiple-choice-list";
|
|
25
|
+
import { validationError } from "./validation-error.js";
|
|
26
|
+
const CheckboxContext = /*#__PURE__*/ createContext({
|
|
27
|
+
props: {}
|
|
28
|
+
});
|
|
29
|
+
const FinalCheckbox = ({ label, checked, onChange, value })=>{
|
|
30
|
+
const { FormControlLabelProps, CheckboxProps, props: { isDisabled } } = useContext(CheckboxContext);
|
|
31
|
+
return /*#__PURE__*/ _jsx(FormControlLabel, _extends({}, FormControlLabelProps, {
|
|
32
|
+
control: /*#__PURE__*/ _jsx(Checkbox, _extends({
|
|
33
|
+
checked: checked,
|
|
34
|
+
onChange: ()=>onChange && onChange(value),
|
|
35
|
+
disabled: isDisabled
|
|
36
|
+
}, CheckboxProps)),
|
|
37
|
+
label: label
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
const Wrapper = ({ label, isRequired, children, meta, validateOnMount, helperText, description })=>{
|
|
41
|
+
const invalid = validationError(meta, validateOnMount);
|
|
42
|
+
const { FormFieldGridProps, FormControlProps, FormLabelProps, FormGroupProps, FormHelperTextProps } = useContext(CheckboxContext);
|
|
43
|
+
return /*#__PURE__*/ _jsx(Grid, _extends({
|
|
44
|
+
container: true,
|
|
45
|
+
size: {
|
|
46
|
+
xs: 12
|
|
47
|
+
}
|
|
48
|
+
}, FormFieldGridProps, {
|
|
49
|
+
children: /*#__PURE__*/ _jsxs(FormControl, _extends({
|
|
50
|
+
required: isRequired,
|
|
51
|
+
error: !!invalid,
|
|
52
|
+
component: "fieldset"
|
|
53
|
+
}, FormControlProps, {
|
|
54
|
+
children: [
|
|
55
|
+
/*#__PURE__*/ _jsx(FormLabel, _extends({}, FormLabelProps, {
|
|
56
|
+
children: label
|
|
57
|
+
})),
|
|
58
|
+
/*#__PURE__*/ _jsx(FormGroup, _extends({}, FormGroupProps, {
|
|
59
|
+
children: children
|
|
60
|
+
})),
|
|
61
|
+
(invalid || helperText || description) && /*#__PURE__*/ _jsx(FormHelperText, _extends({}, FormHelperTextProps, {
|
|
62
|
+
children: invalid || helperText || description
|
|
63
|
+
}))
|
|
64
|
+
]
|
|
65
|
+
}))
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
export const MultipleChoiceList = (_0)=>{
|
|
69
|
+
let { FormControlProps = {}, FormLabelProps = {}, FormGroupProps = {}, FormHelperTextProps = {}, help, FormFieldGridProps = {}, FormControlLabelProps = {}, CheckboxProps = {}, name, options } = _0, props = _object_without_properties_loose(_0, [
|
|
70
|
+
"FormControlProps",
|
|
71
|
+
"FormLabelProps",
|
|
72
|
+
"FormGroupProps",
|
|
73
|
+
"FormHelperTextProps",
|
|
74
|
+
"help",
|
|
75
|
+
"FormFieldGridProps",
|
|
76
|
+
"FormControlLabelProps",
|
|
77
|
+
"CheckboxProps",
|
|
78
|
+
"name",
|
|
79
|
+
"options"
|
|
80
|
+
]);
|
|
81
|
+
return /*#__PURE__*/ _jsx(CheckboxContext.Provider, {
|
|
82
|
+
value: {
|
|
83
|
+
FormControlProps,
|
|
84
|
+
FormLabelProps,
|
|
85
|
+
FormGroupProps,
|
|
86
|
+
FormHelperTextProps,
|
|
87
|
+
FormFieldGridProps,
|
|
88
|
+
FormControlLabelProps,
|
|
89
|
+
CheckboxProps,
|
|
90
|
+
props
|
|
91
|
+
},
|
|
92
|
+
children: /*#__PURE__*/ _jsx(MultipleChoiceListCommon, _extends({
|
|
93
|
+
name: name,
|
|
94
|
+
// The common list only maps over options; ReactNode labels render
|
|
95
|
+
// fine even though its prop type says string.
|
|
96
|
+
options: options
|
|
97
|
+
}, props, {
|
|
98
|
+
Wrapper: Wrapper,
|
|
99
|
+
Checkbox: FinalCheckbox
|
|
100
|
+
}))
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
export default MultipleChoiceList;
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=multiple-choice-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/mapper/multiple-choice-list.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0) and\n * updated for the current MUI Grid API.\n */\n\nimport { type ReactNode, createContext, useContext } from 'react'\n\nimport {\n Checkbox,\n type CheckboxProps as MuiCheckboxProps,\n FormControl,\n type FormControlLabelProps,\n FormControlLabel,\n type FormControlProps,\n FormGroup,\n type FormGroupProps,\n FormHelperText,\n type FormHelperTextProps,\n FormLabel,\n type FormLabelProps,\n Grid,\n type GridProps,\n} from '@mui/material'\n\nimport MultipleChoiceListCommon from '@data-driven-forms/common/multiple-choice-list'\n\nimport type { OptionValue, SelectOption } from './types'\nimport { type ExtendedFieldMeta, validationError } from './validation-error'\n\ninterface CheckboxContextValue {\n FormControlLabelProps?: Omit<FormControlLabelProps, 'control' | 'label'>\n CheckboxProps?: MuiCheckboxProps\n FormFieldGridProps?: GridProps\n FormControlProps?: FormControlProps\n FormLabelProps?: FormLabelProps\n FormGroupProps?: FormGroupProps\n FormHelperTextProps?: FormHelperTextProps\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>\n}\n\nconst CheckboxContext = createContext<CheckboxContextValue>({\n props: {},\n})\n\ninterface FinalCheckboxProps<T extends OptionValue = OptionValue> {\n label?: ReactNode\n isDisabled?: boolean\n checked?: boolean\n onChange?: (value: T) => void\n value?: T\n}\n\nconst FinalCheckbox = <T extends OptionValue = OptionValue>({\n label,\n checked,\n onChange,\n value,\n}: FinalCheckboxProps<T>) => {\n const {\n FormControlLabelProps,\n CheckboxProps,\n props: { isDisabled },\n } = useContext(CheckboxContext)\n\n return (\n <FormControlLabel\n {...FormControlLabelProps}\n control={\n <Checkbox\n checked={checked}\n onChange={() => onChange && onChange(value as T)}\n disabled={isDisabled}\n {...CheckboxProps}\n />\n }\n label={label}\n />\n )\n}\n\ninterface WrapperProps {\n label?: ReactNode\n isRequired?: boolean\n children?: ReactNode\n meta: ExtendedFieldMeta\n validateOnMount?: boolean\n helperText?: ReactNode\n description?: ReactNode\n}\n\nconst Wrapper = ({\n label,\n isRequired,\n children,\n meta,\n validateOnMount,\n helperText,\n description,\n}: WrapperProps) => {\n const invalid = validationError(meta, validateOnMount)\n const {\n FormFieldGridProps,\n FormControlProps,\n FormLabelProps,\n FormGroupProps,\n FormHelperTextProps,\n } = useContext(CheckboxContext)\n\n return (\n <Grid container size={{ xs: 12 }} {...FormFieldGridProps}>\n <FormControl\n required={isRequired}\n error={!!invalid}\n component=\"fieldset\"\n {...FormControlProps}\n >\n <FormLabel {...FormLabelProps}>{label}</FormLabel>\n <FormGroup {...FormGroupProps}>{children}</FormGroup>\n {(invalid || helperText || description) && (\n <FormHelperText {...FormHelperTextProps}>\n {invalid || helperText || description}\n </FormHelperText>\n )}\n </FormControl>\n </Grid>\n )\n}\n\nexport interface MultipleChoiceListProps<T extends OptionValue = OptionValue> {\n name: string\n options?: SelectOption<T>[]\n FormControlProps?: FormControlProps\n FormLabelProps?: FormLabelProps\n FormGroupProps?: FormGroupProps\n FormHelperTextProps?: FormHelperTextProps\n FormFieldGridProps?: GridProps\n FormControlLabelProps?: Omit<FormControlLabelProps, 'control' | 'label'>\n CheckboxProps?: MuiCheckboxProps\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any\n}\n\nexport const MultipleChoiceList = <T extends OptionValue = OptionValue>({\n FormControlProps = {},\n FormLabelProps = {},\n FormGroupProps = {},\n FormHelperTextProps = {},\n help,\n FormFieldGridProps = {},\n FormControlLabelProps = {},\n CheckboxProps = {},\n name,\n options,\n ...props\n}: MultipleChoiceListProps<T>) => (\n <CheckboxContext.Provider\n value={{\n FormControlProps,\n FormLabelProps,\n FormGroupProps,\n FormHelperTextProps,\n FormFieldGridProps,\n FormControlLabelProps,\n CheckboxProps,\n props,\n }}\n >\n <MultipleChoiceListCommon\n name={name}\n // The common list only maps over options; ReactNode labels render\n // fine even though its prop type says string.\n options={options as never}\n {...props}\n Wrapper={Wrapper}\n Checkbox={FinalCheckbox}\n />\n </CheckboxContext.Provider>\n)\n\nexport default MultipleChoiceList\n"],"names":["createContext","useContext","Checkbox","FormControl","FormControlLabel","FormGroup","FormHelperText","FormLabel","Grid","MultipleChoiceListCommon","validationError","CheckboxContext","props","FinalCheckbox","label","checked","onChange","value","FormControlLabelProps","CheckboxProps","isDisabled","control","disabled","Wrapper","isRequired","children","meta","validateOnMount","helperText","description","invalid","FormFieldGridProps","FormControlProps","FormLabelProps","FormGroupProps","FormHelperTextProps","container","size","xs","required","error","component","MultipleChoiceList","help","name","options","Provider"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;CAGC,GAED,SAAyBA,aAAa,EAAEC,UAAU,QAAQ,QAAO;AAEjE,SACEC,QAAQ,EAERC,WAAW,EAEXC,gBAAgB,EAEhBC,SAAS,EAETC,cAAc,EAEdC,SAAS,EAETC,IAAI,QAEC,gBAAe;AAEtB,OAAOC,8BAA8B,iDAAgD;AAGrF,SAAiCC,eAAe,QAAQ,wBAAoB;AAc5E,MAAMC,gCAAkBX,cAAoC;IAC1DY,OAAO,CAAC;AACV;AAUA,MAAMC,gBAAgB,CAAsC,EAC1DC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,KAAK,EACiB;IACtB,MAAM,EACJC,qBAAqB,EACrBC,aAAa,EACbP,OAAO,EAAEQ,UAAU,EAAE,EACtB,GAAGnB,WAAWU;IAEf,qBACE,KAACP,+BACKc;QACJG,uBACE,KAACnB;YACCa,SAASA;YACTC,UAAU,IAAMA,YAAYA,SAASC;YACrCK,UAAUF;WACND;QAGRL,OAAOA;;AAGb;AAYA,MAAMS,UAAU,CAAC,EACfT,KAAK,EACLU,UAAU,EACVC,QAAQ,EACRC,IAAI,EACJC,eAAe,EACfC,UAAU,EACVC,WAAW,EACE;IACb,MAAMC,UAAUpB,gBAAgBgB,MAAMC;IACtC,MAAM,EACJI,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,EACdC,cAAc,EACdC,mBAAmB,EACpB,GAAGlC,WAAWU;IAEf,qBACE,KAACH;QAAK4B,SAAS;QAACC,MAAM;YAAEC,IAAI;QAAG;OAAOP;kBACpC,cAAA,MAAC5B;YACCoC,UAAUf;YACVgB,OAAO,CAAC,CAACV;YACTW,WAAU;WACNT;;8BAEJ,KAACzB,wBAAc0B;8BAAiBnB;;8BAChC,KAACT,wBAAc6B;8BAAiBT;;gBAC9BK,CAAAA,WAAWF,cAAcC,WAAU,mBACnC,KAACvB,6BAAmB6B;8BACjBL,WAAWF,cAAcC;;;;;AAMtC;AAgBA,OAAO,MAAMa,qBAAqB;QAAsC,EACtEV,mBAAmB,CAAC,CAAC,EACrBC,iBAAiB,CAAC,CAAC,EACnBC,iBAAiB,CAAC,CAAC,EACnBC,sBAAsB,CAAC,CAAC,EACxBQ,IAAI,EACJZ,qBAAqB,CAAC,CAAC,EACvBb,wBAAwB,CAAC,CAAC,EAC1BC,gBAAgB,CAAC,CAAC,EAClByB,IAAI,EACJC,OAAO,EAEoB,OADxBjC;;;;;;;;;;;;yBAEH,KAACD,gBAAgBmC,QAAQ;QACvB7B,OAAO;YACLe;YACAC;YACAC;YACAC;YACAJ;YACAb;YACAC;YACAP;QACF;kBAEA,cAAA,KAACH;YACCmC,MAAMA;YACN,kEAAkE;YAClE,8CAA8C;YAC9CC,SAASA;WACLjC;YACJW,SAASA;YACTrB,UAAUW;;;EAGf;AAED,eAAe6B,mBAAkB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0).
|
|
19
|
+
*/
|
|
20
|
+
import type { ElementType, ReactNode } from 'react';
|
|
21
|
+
import { type TypographyProps } from '@mui/material';
|
|
22
|
+
export interface PlainTextProps extends Omit<TypographyProps, 'variant'> {
|
|
23
|
+
label?: ReactNode;
|
|
24
|
+
name?: string;
|
|
25
|
+
component?: ElementType;
|
|
26
|
+
element?: ElementType;
|
|
27
|
+
variant?: TypographyProps['variant'];
|
|
28
|
+
gutterBottom?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const PlainText: ({ label, name, component, element, variant, gutterBottom, ...props }: PlainTextProps) => import("react").JSX.Element;
|
|
31
|
+
export default PlainText;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /**
|
|
17
|
+
* Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0).
|
|
18
|
+
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
19
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
20
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
|
+
import { Typography } from "@mui/material";
|
|
22
|
+
export const PlainText = (_0)=>{
|
|
23
|
+
let { label, name, component, element, variant = 'body1', gutterBottom = true } = _0, props = _object_without_properties_loose(_0, [
|
|
24
|
+
"label",
|
|
25
|
+
"name",
|
|
26
|
+
"component",
|
|
27
|
+
"element",
|
|
28
|
+
"variant",
|
|
29
|
+
"gutterBottom"
|
|
30
|
+
]);
|
|
31
|
+
return typeof label === 'string' ? /*#__PURE__*/ _jsx(_Fragment, {
|
|
32
|
+
children: label.split('\n').map((paragraph, index)=>/*#__PURE__*/ _jsx(Typography, _extends({
|
|
33
|
+
variant: variant,
|
|
34
|
+
gutterBottom: gutterBottom
|
|
35
|
+
}, props, element && {
|
|
36
|
+
component: element
|
|
37
|
+
}, {
|
|
38
|
+
children: paragraph
|
|
39
|
+
}), `${index}-${name}`))
|
|
40
|
+
}) : /*#__PURE__*/ _jsx(Typography, _extends({}, props, element && {
|
|
41
|
+
component: element
|
|
42
|
+
}, {
|
|
43
|
+
children: label
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
export default PlainText;
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=plain-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/mapper/plain-text.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0).\n */\n\nimport type { ElementType, ReactNode } from 'react'\n\nimport { Typography, type TypographyProps } from '@mui/material'\n\nexport interface PlainTextProps extends Omit<TypographyProps, 'variant'> {\n label?: ReactNode\n name?: string\n component?: ElementType\n element?: ElementType\n variant?: TypographyProps['variant']\n gutterBottom?: boolean\n}\n\nexport const PlainText = ({\n label,\n name,\n component,\n element,\n variant = 'body1',\n gutterBottom = true,\n ...props\n}: PlainTextProps) =>\n typeof label === 'string' ? (\n <>\n {label.split('\\n').map((paragraph, index) => (\n <Typography\n key={`${index}-${name}`}\n variant={variant}\n gutterBottom={gutterBottom}\n {...props}\n {...(element && { component: element })}\n >\n {paragraph}\n </Typography>\n ))}\n </>\n ) : (\n <Typography {...props} {...(element && { component: element })}>\n {label}\n </Typography>\n )\n\nexport default PlainText\n"],"names":["Typography","PlainText","label","name","component","element","variant","gutterBottom","props","split","map","paragraph","index"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;CAEC;;;AAID,SAASA,UAAU,QAA8B,gBAAe;AAWhE,OAAO,MAAMC,YAAY;QAAC,EACxBC,KAAK,EACLC,IAAI,EACJC,SAAS,EACTC,OAAO,EACPC,UAAU,OAAO,EACjBC,eAAe,IAAI,EAEJ,OADZC;;;;;;;;WAEH,OAAON,UAAU,yBACf;kBACGA,MAAMO,KAAK,CAAC,MAAMC,GAAG,CAAC,CAACC,WAAWC,sBACjC,KAACZ;gBAECM,SAASA;gBACTC,cAAcA;eACVC,OACCH,WAAW;gBAAED,WAAWC;YAAQ;0BAEpCM;gBANI,GAAGC,MAAM,CAAC,EAAET,MAAM;uBAW7B,KAACH,yBAAeQ,OAAYH,WAAW;QAAED,WAAWC;IAAQ;kBACzDH;;EAEJ;AAEH,eAAeD,UAAS"}
|