@backstage/plugin-scaffolder-react 1.20.2-next.0 → 2.0.0
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/CHANGELOG.md +83 -0
- package/dist/alpha.d.ts +35 -8
- package/dist/alpha.esm.js +1 -0
- package/dist/alpha.esm.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/next/blueprints/FormDecoratorBlueprint.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/Form.module.css.esm.js +8 -0
- package/dist/next/components/Form/BuiTheme/Form.module.css.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/index.esm.js +12 -0
- package/dist/next/components/Form/BuiTheme/index.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldDescriptionTemplate.esm.js +17 -0
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldDescriptionTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldItemTemplate.esm.js +107 -0
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldItemTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldTemplate.esm.js +84 -0
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldTitleTemplate.esm.js +20 -0
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldTitleTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/ButtonTemplates.esm.js +83 -0
- package/dist/next/components/Form/BuiTheme/templates/ButtonTemplates.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/DescriptionFieldTemplate.esm.js +19 -0
- package/dist/next/components/Form/BuiTheme/templates/DescriptionFieldTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/ErrorListTemplate.esm.js +40 -0
- package/dist/next/components/Form/BuiTheme/templates/ErrorListTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/FieldErrorTemplate.esm.js +14 -0
- package/dist/next/components/Form/BuiTheme/templates/FieldErrorTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/FieldHelpTemplate.esm.js +15 -0
- package/dist/next/components/Form/BuiTheme/templates/FieldHelpTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/FieldTemplate.esm.js +66 -0
- package/dist/next/components/Form/BuiTheme/templates/FieldTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/ObjectFieldTemplate.esm.js +86 -0
- package/dist/next/components/Form/BuiTheme/templates/ObjectFieldTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/TitleFieldTemplate.esm.js +15 -0
- package/dist/next/components/Form/BuiTheme/templates/TitleFieldTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/UnsupportedFieldTemplate.esm.js +14 -0
- package/dist/next/components/Form/BuiTheme/templates/UnsupportedFieldTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/WrapIfAdditionalTemplate.esm.js +57 -0
- package/dist/next/components/Form/BuiTheme/templates/WrapIfAdditionalTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/templates/index.esm.js +44 -0
- package/dist/next/components/Form/BuiTheme/templates/index.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/BaseInputTemplate.esm.js +73 -0
- package/dist/next/components/Form/BuiTheme/widgets/BaseInputTemplate.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/CheckboxWidget.esm.js +34 -0
- package/dist/next/components/Form/BuiTheme/widgets/CheckboxWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/CheckboxesWidget.esm.js +50 -0
- package/dist/next/components/Form/BuiTheme/widgets/CheckboxesWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/ColorWidget.esm.js +9 -0
- package/dist/next/components/Form/BuiTheme/widgets/ColorWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/DateInput.esm.js +89 -0
- package/dist/next/components/Form/BuiTheme/widgets/DateInput.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/DateTimeWidget.esm.js +9 -0
- package/dist/next/components/Form/BuiTheme/widgets/DateTimeWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/DateWidget.esm.js +9 -0
- package/dist/next/components/Form/BuiTheme/widgets/DateWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/EmailWidget.esm.js +9 -0
- package/dist/next/components/Form/BuiTheme/widgets/EmailWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/FileWidget.esm.js +62 -0
- package/dist/next/components/Form/BuiTheme/widgets/FileWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/HiddenWidget.esm.js +16 -0
- package/dist/next/components/Form/BuiTheme/widgets/HiddenWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/PasswordWidget.esm.js +48 -0
- package/dist/next/components/Form/BuiTheme/widgets/PasswordWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/RadioWidget.esm.js +48 -0
- package/dist/next/components/Form/BuiTheme/widgets/RadioWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/RangeWidget.esm.js +56 -0
- package/dist/next/components/Form/BuiTheme/widgets/RangeWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/SelectWidget.esm.js +73 -0
- package/dist/next/components/Form/BuiTheme/widgets/SelectWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/TextWidget.esm.js +9 -0
- package/dist/next/components/Form/BuiTheme/widgets/TextWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/TextareaWidget.esm.js +90 -0
- package/dist/next/components/Form/BuiTheme/widgets/TextareaWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/TimeWidget.esm.js +9 -0
- package/dist/next/components/Form/BuiTheme/widgets/TimeWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/URLWidget.esm.js +9 -0
- package/dist/next/components/Form/BuiTheme/widgets/URLWidget.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/index.esm.js +42 -0
- package/dist/next/components/Form/BuiTheme/widgets/index.esm.js.map +1 -0
- package/dist/next/components/Form/BuiTheme/widgets/selectOverrides.module.css.esm.js +8 -0
- package/dist/next/components/Form/BuiTheme/widgets/selectOverrides.module.css.esm.js.map +1 -0
- package/dist/next/components/Form/Form.esm.js +16 -8
- package/dist/next/components/Form/Form.esm.js.map +1 -1
- package/dist/next/components/Form/ScaffolderThemeContext.esm.js +8 -0
- package/dist/next/components/Form/ScaffolderThemeContext.esm.js.map +1 -0
- package/dist/next/components/ScaffolderField/ScaffolderField.esm.js +25 -2
- package/dist/next/components/ScaffolderField/ScaffolderField.esm.js.map +1 -1
- package/dist/next/components/Stepper/Stepper.esm.js +12 -19
- package/dist/next/components/Stepper/Stepper.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/CardHeader.esm.js +1 -1
- package/dist/next/components/TemplateCard/TemplateCard.esm.js +5 -67
- package/dist/next/components/TemplateCard/TemplateCard.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/TemplateCardImpl.esm.js +71 -0
- package/dist/next/components/TemplateCard/TemplateCardImpl.esm.js.map +1 -0
- package/dist/next/components/TemplateGroup/TemplateGroup.esm.js +9 -3
- package/dist/next/components/TemplateGroup/TemplateGroup.esm.js.map +1 -1
- package/dist/next/extensions/createScaffolderFormDecorator.esm.js.map +1 -1
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js +29 -0
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -0
- package/package.json +23 -20
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { optionId, ariaDescribedByIds } from '@rjsf/utils';
|
|
3
|
+
import { CheckboxGroup, Checkbox } from '@backstage/ui';
|
|
4
|
+
|
|
5
|
+
function CheckboxesWidget({
|
|
6
|
+
id,
|
|
7
|
+
label,
|
|
8
|
+
required,
|
|
9
|
+
disabled,
|
|
10
|
+
readonly,
|
|
11
|
+
options,
|
|
12
|
+
value,
|
|
13
|
+
onChange: onFieldChange,
|
|
14
|
+
rawErrors = []
|
|
15
|
+
}) {
|
|
16
|
+
const { enumOptions, enumDisabled } = options;
|
|
17
|
+
const selectedKeys = Array.isArray(value) ? value.map(String) : [];
|
|
18
|
+
const hasError = rawErrors.length > 0;
|
|
19
|
+
const handleChange = (keys) => {
|
|
20
|
+
const next = enumOptions?.filter((option) => keys.includes(String(option.value))).map((option) => option.value) ?? [];
|
|
21
|
+
onFieldChange(next);
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
CheckboxGroup,
|
|
25
|
+
{
|
|
26
|
+
label,
|
|
27
|
+
isRequired: required,
|
|
28
|
+
isInvalid: hasError,
|
|
29
|
+
isDisabled: disabled || readonly,
|
|
30
|
+
value: selectedKeys,
|
|
31
|
+
onChange: handleChange,
|
|
32
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
33
|
+
children: enumOptions?.map((option, index) => {
|
|
34
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
Checkbox,
|
|
37
|
+
{
|
|
38
|
+
value: String(option.value),
|
|
39
|
+
isDisabled: itemDisabled,
|
|
40
|
+
children: option.label
|
|
41
|
+
},
|
|
42
|
+
optionId(id, index)
|
|
43
|
+
);
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { CheckboxesWidget as default };
|
|
50
|
+
//# sourceMappingURL=CheckboxesWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxesWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/CheckboxesWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport {\n ariaDescribedByIds,\n FormContextType,\n optionId,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport { Checkbox, CheckboxGroup } from '@backstage/ui';\n\nexport default function CheckboxesWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n id,\n label,\n required,\n disabled,\n readonly,\n options,\n value,\n onChange: onFieldChange,\n rawErrors = [],\n}: WidgetProps<T, S, F>) {\n const { enumOptions, enumDisabled } = options;\n\n const selectedKeys = Array.isArray(value) ? value.map(String) : [];\n const hasError = rawErrors.length > 0;\n\n const handleChange = (keys: string[]) => {\n const next =\n enumOptions\n ?.filter(option => keys.includes(String(option.value)))\n .map(option => option.value) ?? [];\n onFieldChange(next as T);\n };\n\n return (\n <CheckboxGroup\n label={label}\n isRequired={required}\n isInvalid={hasError}\n isDisabled={disabled || readonly}\n value={selectedKeys}\n onChange={handleChange}\n aria-describedby={ariaDescribedByIds<T>(id)}\n >\n {enumOptions?.map((option, index) => {\n const itemDisabled =\n Array.isArray(enumDisabled) &&\n enumDisabled.indexOf(option.value) !== -1;\n return (\n <Checkbox\n key={optionId(id, index)}\n value={String(option.value)}\n isDisabled={itemD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A,CAAQ,MAAA,CAAO,KAAK,CAAA,KAAM,EAAA;AACzC,QAAA,uBACE,GAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YAEC,KAAA,EAAO,MAAA,CAAO,MAAA,CAAO,KAAK,CAAA;AAAA,YAC1B,UAAA,EAAY,YAAA;AAAA,YAEX,QAAA,EAAA,MAAA,CAAO;AAAA,WAAA;AAAA,UAJH,QAAA,CAAS,IAAI,KAAK;AAAA,SAKzB;AAAA,MAEJ,CAAC;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import BaseInputTemplate from './BaseInputTemplate.esm.js';
|
|
3
|
+
|
|
4
|
+
function ColorWidget(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(BaseInputTemplate, { ...props, type: "color" });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { ColorWidget as default };
|
|
9
|
+
//# sourceMappingURL=ColorWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/ColorWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport {\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport BaseInputTemplate from './BaseInputTemplate';\n\nexport default function ColorWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: WidgetProps<T, S, F>) {\n return <BaseInputTemplate {...props} type=\"color\" />;\n}\n"],"names":[],"mappings":";;;AAuBA,SAAwB,YAItB,KAAA,EAA6B;AAC7B,EAAA,uBAAO,GAAA,CAAC,iBAAA,EAAA,EAAmB,GAAG,KAAA,EAAO,MAAK,OAAA,EAAQ,CAAA;AACpD;;;;"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ariaDescribedByIds } from '@rjsf/utils';
|
|
3
|
+
import { FieldLabel } from '@backstage/ui';
|
|
4
|
+
|
|
5
|
+
const baseStyle = {
|
|
6
|
+
display: "flex",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
height: "2rem",
|
|
9
|
+
padding: "0 var(--bui-space-3)",
|
|
10
|
+
borderRadius: "var(--bui-radius-2)",
|
|
11
|
+
border: "1px solid var(--bui-border-2)",
|
|
12
|
+
backgroundColor: "var(--bui-bg-neutral-1)",
|
|
13
|
+
fontSize: "var(--bui-font-size-3)",
|
|
14
|
+
fontFamily: "var(--bui-font-regular)",
|
|
15
|
+
fontWeight: 400,
|
|
16
|
+
color: "var(--bui-fg-primary)",
|
|
17
|
+
transition: "border-color 0.2s ease-in-out",
|
|
18
|
+
width: "100%",
|
|
19
|
+
boxSizing: "border-box",
|
|
20
|
+
outline: "none",
|
|
21
|
+
WebkitAppearance: "none",
|
|
22
|
+
MozAppearance: "none",
|
|
23
|
+
appearance: "none"
|
|
24
|
+
};
|
|
25
|
+
function DateInput({
|
|
26
|
+
id,
|
|
27
|
+
label,
|
|
28
|
+
required,
|
|
29
|
+
disabled,
|
|
30
|
+
readonly,
|
|
31
|
+
value,
|
|
32
|
+
autofocus,
|
|
33
|
+
schema,
|
|
34
|
+
options = {},
|
|
35
|
+
onChange: onFieldChange,
|
|
36
|
+
onBlur: onFieldBlur,
|
|
37
|
+
onFocus: onFieldFocus,
|
|
38
|
+
rawErrors = [],
|
|
39
|
+
inputType
|
|
40
|
+
}) {
|
|
41
|
+
const handleChange = (event) => onFieldChange(
|
|
42
|
+
event.target.value === "" ? options.emptyValue : event.target.value
|
|
43
|
+
);
|
|
44
|
+
const handleBlur = () => onFieldBlur(id, value);
|
|
45
|
+
const handleFocus = () => onFieldFocus(id, value);
|
|
46
|
+
const hasError = rawErrors.length > 0;
|
|
47
|
+
const stringValue = String(value ?? "");
|
|
48
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49
|
+
(label || schema.title) && /* @__PURE__ */ jsx(
|
|
50
|
+
FieldLabel,
|
|
51
|
+
{
|
|
52
|
+
label: label || schema.title,
|
|
53
|
+
secondaryLabel: required ? "Required" : void 0,
|
|
54
|
+
htmlFor: id
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
"input",
|
|
59
|
+
{
|
|
60
|
+
id,
|
|
61
|
+
name: id,
|
|
62
|
+
type: inputType,
|
|
63
|
+
autoFocus: autofocus,
|
|
64
|
+
disabled,
|
|
65
|
+
readOnly: readonly,
|
|
66
|
+
value: stringValue,
|
|
67
|
+
onChange: handleChange,
|
|
68
|
+
onBlur: handleBlur,
|
|
69
|
+
onFocus: handleFocus,
|
|
70
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
71
|
+
"aria-invalid": hasError,
|
|
72
|
+
style: {
|
|
73
|
+
...baseStyle,
|
|
74
|
+
...disabled && {
|
|
75
|
+
opacity: 0.5,
|
|
76
|
+
cursor: "not-allowed",
|
|
77
|
+
borderColor: "var(--bui-border-disabled)"
|
|
78
|
+
},
|
|
79
|
+
...hasError && {
|
|
80
|
+
borderColor: "var(--bui-fg-danger)"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { DateInput as default };
|
|
89
|
+
//# sourceMappingURL=DateInput.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateInput.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/DateInput.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport { CSSProperties, ChangeEvent } from 'react';\nimport {\n ariaDescribedByIds,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport { FieldLabel } from '@backstage/ui';\n\n// Native fallback until BUI ships DatePicker/TimePicker components.\nconst baseStyle: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n height: '2rem',\n padding: '0 var(--bui-space-3)',\n borderRadius: 'var(--bui-radius-2)',\n border: '1px solid var(--bui-border-2)',\n backgroundColor: 'var(--bui-bg-neutral-1)',\n fontSize: 'var(--bui-font-size-3)',\n fontFamily: 'var(--bui-font-regular)',\n fontWeight: 400,\n color: 'var(--bui-fg-primary)',\n transition: 'border-color 0.2s ease-in-out',\n width: '100%',\n boxSizing: 'border-box' as const,\n outline: 'none',\n WebkitAppearance: 'none' as const,\n MozAppearance: 'none' as const,\n appearance: 'none' as const,\n};\n\ninterface DateInputProps<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n> extends WidgetProps<T, S, F> {\n inputType: 'date' | 'datetime-local' | 'time';\n}\n\nexport default function DateInput<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n id,\n label,\n required,\n disabled,\n readonly,\n value,\n autofocus,\n schema,\n options = {},\n onChange: onFieldChange,\n onBlur: onFieldBlur,\n onFocus: onFieldFocus,\n rawErrors = [],\n inputType,\n}: DateInputProps<T, S, F>) {\n const handleChange = (event: ChangeEvent<HTMLInputElement>) =>\n onFieldChange(\n event.target.value === '' ? options.emptyValue : event.target.value,\n );\n const handleBlur = () => onFieldBlur(id, value);\n const handleFocus = () => onFieldFocus(id, value);\n\n const hasError = rawErrors.length > 0;\n const stringValue = String(value ?? '');\n\n return (\n <>\n {(label || schema.title) && (\n <FieldLabel\n label={label || schema.title}\n secondaryLabel={required ? 'Required' : undefined}\n htmlFor={id}\n />\n )}\n <input\n id={id}\n name={id}\n type={inputType}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autofocus}\n disabled={disabled}\n readOnly={readonly}\n value={stringValue}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n aria-describedby={ariaDescribedByIds<T>(id)}\n aria-invalid={hasError}\n style={{\n ...baseStyle,\n ...(disabled && {\n opacity: 0.5,\n cursor: 'not-allowed',\n borderColor: 'var(--bui-border-disabled)',\n }),\n ...(hasError && {\n borderColor: 'var(--bui-fg-danger)',\n }),\n }}\n />\n </>\n );\n}\n"],"names":[],"mappings":";;;;AA0BA,MAAM,SAAA,GAA2B;AAAA,EAC/B,OAAA,EAAS,MAAA;AAAA,EACT,UAAA,EAAY,QAAA;AAAA,EACZ,MAAA,EAAQ,MAAA;AAAA,EACR,OAAA,EAAS,sBAAA;AAAA,EACT,YAAA,EAAc,qBAAA;AAAA,EACd,MAAA,EAAQ,+BAAA;AAAA,EACR,eAAA,EAAiB,yBAAA;AAAA,EACjB,QAAA,EAAU,wBAAA;AAAA,EACV,UAAA,EAAY,yBAAA;AAAA,EACZ,UAAA,EAAY,GAAA;AAAA,EACZ,KAAA,EAAO,uBAAA;AAAA,EACP,UAAA,EAAY,+BAAA;AAAA,EACZ,KAAA,EAAO,MAAA;AAAA,EACP,SAAA,EAAW,YAAA;AAAA,EACX,OAAA,EAAS,MAAA;AAAA,EACT,gBAAA,EAAkB,MAAA;AAAA,EACl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AAA;AAAA,QACX,QAAA;AAAA,QACA,QAAA,EAAU,QAAA;AAAA,QACV,KAAA,EAAO,WAAA;AAAA,QACP,QAAA,EAAU,YAAA;AAAA,QACV,MAAA,EAAQ,UAAA;AAAA,QACR,OAAA,EAAS,WAAA;AAAA,QACT,kBAAA,EAAkB,mBAAsB,EAAE,CAAA;AAAA,QAC1C,cAAA,EAAc,QAAA;AAAA,QACd,KAAA,EAAO;AAAA,UACL,GAAG,SAAA;AAAA,UACH,GAAI,QAAA,IAAY;AAAA,YACd,OAAA,EAAS,GAAA;AAAA,YACT,MAAA,EAAQ,aAAA;AAAA,YACR,WAAA,EAAa;AAAA,WACf;AAAA,UACA,GAAI,QAAA,IAAY;AAAA,YACd,WAAA,EAAa;AAAA;AACf;AACF;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import DateInput from './DateInput.esm.js';
|
|
3
|
+
|
|
4
|
+
function DateTimeWidget(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(DateInput, { ...props, inputType: "datetime-local" });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { DateTimeWidget as default };
|
|
9
|
+
//# sourceMappingURL=DateTimeWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimeWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/DateTimeWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport {\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport DateInput from './DateInput';\n\nexport default function DateTimeWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: WidgetProps<T, S, F>) {\n return <DateInput {...props} inputType=\"datetime-local\" />;\n}\n"],"names":[],"mappings":";;;AAuBA,SAAwB,eAItB,KAAA,EAA6B;AAC7B,EAAA,uBAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAG,KAAA,EAAO,WAAU,gBAAA,EAAiB,CAAA;AAC1D;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import DateInput from './DateInput.esm.js';
|
|
3
|
+
|
|
4
|
+
function DateWidget(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(DateInput, { ...props, inputType: "date" });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { DateWidget as default };
|
|
9
|
+
//# sourceMappingURL=DateWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/DateWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport {\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport DateInput from './DateInput';\n\nexport default function DateWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: WidgetProps<T, S, F>) {\n return <DateInput {...props} inputType=\"date\" />;\n}\n"],"names":[],"mappings":";;;AAuBA,SAAwB,WAItB,KAAA,EAA6B;AAC7B,EAAA,uBAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAG,KAAA,EAAO,WAAU,MAAA,EAAO,CAAA;AAChD;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import BaseInputTemplate from './BaseInputTemplate.esm.js';
|
|
3
|
+
|
|
4
|
+
function EmailWidget(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(BaseInputTemplate, { ...props, type: "email" });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { EmailWidget as default };
|
|
9
|
+
//# sourceMappingURL=EmailWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/EmailWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport {\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport BaseInputTemplate from './BaseInputTemplate';\n\nexport default function EmailWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: WidgetProps<T, S, F>) {\n return <BaseInputTemplate {...props} type=\"email\" />;\n}\n"],"names":[],"mappings":";;;AAuBA,SAAwB,YAItB,KAAA,EAA6B;AAC7B,EAAA,uBAAO,GAAA,CAAC,iBAAA,EAAA,EAAmB,GAAG,KAAA,EAAO,MAAK,OAAA,EAAQ,CAAA;AACpD;;;;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { ariaDescribedByIds } from '@rjsf/utils';
|
|
4
|
+
|
|
5
|
+
function processFile(file) {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const reader = new FileReader();
|
|
8
|
+
reader.onload = () => {
|
|
9
|
+
resolve({
|
|
10
|
+
dataURL: reader.result,
|
|
11
|
+
name: file.name,
|
|
12
|
+
size: file.size,
|
|
13
|
+
type: file.type
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
reader.onerror = reject;
|
|
17
|
+
reader.readAsDataURL(file);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function processFiles(files) {
|
|
21
|
+
return Promise.all(Array.from(files).map(processFile));
|
|
22
|
+
}
|
|
23
|
+
function FileWidget({
|
|
24
|
+
id,
|
|
25
|
+
readonly,
|
|
26
|
+
disabled,
|
|
27
|
+
required,
|
|
28
|
+
multiple,
|
|
29
|
+
onChange,
|
|
30
|
+
options
|
|
31
|
+
}) {
|
|
32
|
+
const handleChange = useCallback(
|
|
33
|
+
(event) => {
|
|
34
|
+
if (!event.target.files || readonly || disabled) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
processFiles(event.target.files).then((filesInfo) => {
|
|
38
|
+
onChange(multiple ? filesInfo : filesInfo[0]);
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
[multiple, readonly, disabled, onChange]
|
|
42
|
+
);
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
"input",
|
|
45
|
+
{
|
|
46
|
+
id,
|
|
47
|
+
name: id,
|
|
48
|
+
type: "file",
|
|
49
|
+
disabled: readonly || disabled,
|
|
50
|
+
onChange: handleChange,
|
|
51
|
+
defaultValue: "",
|
|
52
|
+
autoFocus: options.autofocus,
|
|
53
|
+
multiple,
|
|
54
|
+
required,
|
|
55
|
+
accept: options.accept,
|
|
56
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { FileWidget as default };
|
|
62
|
+
//# sourceMappingURL=FileWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/FileWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport { ChangeEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\n\nfunction processFile(\n file: File,\n): Promise<{ dataURL: string; name: string; size: number; type: string }> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve({\n dataURL: reader.result as string,\n name: file.name,\n size: file.size,\n type: file.type,\n });\n };\n reader.onerror = reject;\n reader.readAsDataURL(file);\n });\n}\n\nfunction processFiles(files: FileList): Promise<any> {\n return Promise.all(Array.from(files).map(processFile));\n}\n\nexport default function FileWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n id,\n readonly,\n disabled,\n required,\n multiple,\n onChange,\n options,\n}: WidgetProps<T, S, F>) {\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!event.target.files || readonly || disabled) {\n return;\n }\n processFiles(event.target.files).then(filesInfo => {\n onChange(multiple ? filesInfo : filesInfo[0]);\n });\n },\n [multiple, readonly, disabled, onChange],\n );\n\n return (\n <input\n id={id}\n name={id}\n type=\"file\"\n disabled={readonly || disabled}\n onChange={handleChange}\n defaultValue=\"\"\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={options.autofocus as boolean}\n multiple={multiple}\n required={required}\n accept={options.accept as string | undefined}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n );\n}\n"],"names":[],"mappings":";;;;AAwBA,SAAS,YACP,IAAA,EACwE;AACxE,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,EAAS,MAAA,KAAW;AACtC,IAAA,MAAM,MAAA,GAAS,IAAI,UAAA,EAAW;AAC9B,IAAA,MAAA,CAAO,SAAS,MAAM;AACpB,MAAA,OAAA,CAAQ;AAAA,QACN,SAAS,MAAA,CAAO,MAAA;AAAA,QAChB,MAAM,IAAA,CAAK,IAAA;AAAA,QACX,MAAM,IAAA,CAAK,IAAA;AAAA,QACX,MAAM,IAAA,CAAK;AAAA,OACZ,CAAA;AAAA,IACH,CAAA;AACA,IAAA,MAAA,CAAO,OAAA,GAAU,MAAA;AACjB,IAAA,MAAA,CAAO,cAAc,IAAI,CAAA;AAAA,EAC3B,CAAC,CAAA;AACH;AAEA,SAAS,aAAa,KAAA,EAA+B;AACnD,EAAA,OAAO,OAAA,CAAQ,IAAI,KAAA,CAAM,IAAA,CAAK,KAAK,CAAA,CAAE,GAAA,CAAI,WAAW,CAAC,CAAA;AACvD;AAEA,SAAwB,UAAA,CAItB;AAAA,EACA,EAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAAyB;AACvB,EAAA,MAAM,YAAA,GAAe,WAAA;AAAA,IACnB,CAAC,KAAA,KAAyC;AACxC,MAAA,IAAI,CAAC,KAAA,CAAM,MAAA,CAAO,KAAA,IAAS,YAAY,QAAA,EAAU;AAC/C,QAAA;AAAA,MACF;AACA,MAAA,YAAA,CAAa,KAAA,CAAM,MAAA,CAAO,KAAK,CAAA,CAAE,KAAK,CAAA,SAAA,KAAa;AACjD,QAAA,QAAA,CAAS,QAAA,GAAW,SAAA,GAAY,SAAA,CAAU,CAAC,CAAC,CAAA;AAAA,MAC9C,CAAC,CAAA;AAAA,IACH,CAAA;AAAA,IACA,CAAC,QAAA,EAAU,QAAA,EAAU,QAAA,EAAU,QAAQ;AAAA,GACzC;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,EAAA;AAAA,MACA,IAAA,EAAM,EAAA;AAAA,MACN,IAAA,EAAK,MAAA;AAAA,MACL,UAAU,QAAA,IAAY,QAAA;AAAA,MACtB,QAAA,EAAU,YAAA;AAAA,MACV,YAAA,EAAa,EAAA;AAAA,MAEb,WAAW,OAAA,CAAQ,SAAA;AAAA,MACnB,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAQ,OAAA,CAAQ,MAAA;AAAA,MAChB,kBAAA,EAAkB,mBAAsB,EAAE;AAAA;AAAA,GAC5C;AAEJ;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
function HiddenWidget({ id, value }) {
|
|
4
|
+
return /* @__PURE__ */ jsx(
|
|
5
|
+
"input",
|
|
6
|
+
{
|
|
7
|
+
type: "hidden",
|
|
8
|
+
id,
|
|
9
|
+
name: id,
|
|
10
|
+
value: typeof value === "undefined" ? "" : value
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { HiddenWidget as default };
|
|
16
|
+
//# sourceMappingURL=HiddenWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HiddenWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/HiddenWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport {\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\n\nexport default function HiddenWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({ id, value }: WidgetProps<T, S, F>) {\n return (\n <input\n type=\"hidden\"\n id={id}\n name={id}\n value={typeof value === 'undefined' ? '' : value}\n />\n );\n}\n"],"names":[],"mappings":";;AAsBA,SAAwB,YAAA,CAItB,EAAE,EAAA,EAAI,KAAA,EAAM,EAAyB;AACrC,EAAA,uBACE,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,QAAA;AAAA,MACL,EAAA;AAAA,MACA,IAAA,EAAM,EAAA;AAAA,MACN,KAAA,EAAO,OAAO,KAAA,KAAU,WAAA,GAAc,EAAA,GAAK;AAAA;AAAA,GAC7C;AAEJ;;;;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ariaDescribedByIds } from '@rjsf/utils';
|
|
3
|
+
import { PasswordField } from '@backstage/ui';
|
|
4
|
+
|
|
5
|
+
function PasswordWidget({
|
|
6
|
+
id,
|
|
7
|
+
placeholder,
|
|
8
|
+
required,
|
|
9
|
+
readonly,
|
|
10
|
+
disabled,
|
|
11
|
+
label,
|
|
12
|
+
value,
|
|
13
|
+
onChange: onFieldChange,
|
|
14
|
+
onBlur: onFieldBlur,
|
|
15
|
+
onFocus: onFieldFocus,
|
|
16
|
+
autofocus,
|
|
17
|
+
options,
|
|
18
|
+
schema,
|
|
19
|
+
rawErrors = []
|
|
20
|
+
}) {
|
|
21
|
+
const handleChange = (val) => onFieldChange(val === "" ? options.emptyValue : val);
|
|
22
|
+
const handleBlur = () => onFieldBlur(id, value);
|
|
23
|
+
const handleFocus = () => onFieldFocus(id, value);
|
|
24
|
+
const hasError = rawErrors.length > 0;
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
PasswordField,
|
|
27
|
+
{
|
|
28
|
+
id,
|
|
29
|
+
name: id,
|
|
30
|
+
label: label || schema.title,
|
|
31
|
+
secondaryLabel: required ? "Required" : void 0,
|
|
32
|
+
placeholder,
|
|
33
|
+
autoFocus: autofocus,
|
|
34
|
+
isRequired: required,
|
|
35
|
+
isDisabled: disabled,
|
|
36
|
+
isReadOnly: readonly,
|
|
37
|
+
isInvalid: hasError,
|
|
38
|
+
value: value || "",
|
|
39
|
+
onChange: handleChange,
|
|
40
|
+
onBlur: handleBlur,
|
|
41
|
+
onFocus: handleFocus,
|
|
42
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { PasswordWidget as default };
|
|
48
|
+
//# sourceMappingURL=PasswordWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/PasswordWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport {\n ariaDescribedByIds,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport { PasswordField } from '@backstage/ui';\n\nexport default function PasswordWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n id,\n placeholder,\n required,\n readonly,\n disabled,\n label,\n value,\n onChange: onFieldChange,\n onBlur: onFieldBlur,\n onFocus: onFieldFocus,\n autofocus,\n options,\n schema,\n rawErrors = [],\n}: WidgetProps<T, S, F>) {\n const handleChange = (val: string) =>\n onFieldChange(val === '' ? options.emptyValue : val);\n const handleBlur = () => onFieldBlur(id, value);\n const handleFocus = () => onFieldFocus(id, value);\n\n const hasError = rawErrors.length > 0;\n\n return (\n <PasswordField\n id={id}\n name={id}\n label={label || schema.title}\n secondaryLabel={required ? 'Required' : undefined}\n placeholder={placeholder}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autofocus}\n isRequired={required}\n isDisabled={disabled}\n isReadOnly={readonly}\n isInvalid={hasError}\n value={value || ''}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n );\n}\n"],"names":[],"mappings":";;;;AAwBA,SAAwB,cAAA,CAItB;AAAA,EACA,EAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA,EAAU,aAAA;AAAA,EACV,MAAA,EAAQ,WAAA;AAAA,EACR,OAAA,EAAS,YAAA;AAAA,EACT,SAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAY;AACd,CAAA,EAAyB;AACvB,EAAA,MAAM,YAAA,GAAe,CAAC,GAAA,KACpB,aAAA,CAAc,QAAQ,EAAA,GAAK,OAAA,CAAQ,aAAa,GAAG,CAAA;AACrD,EAAA,MAAM,UAAA,GAAa,MAAM,WAAA,CAAY,EAAA,EAAI,KAAK,CAAA;AAC9C,EAAA,MAAM,WAAA,GAAc,MAAM,YAAA,CAAa,EAAA,EAAI,KAAK,CAAA;AAEhD,EAAA,MAAM,QAAA,GAAW,UAAU,MAAA,GAAS,CAAA;AAEpC,EAAA,uBACE,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,EAAA;AAAA,MACA,IAAA,EAAM,EAAA;AAAA,MACN,KAAA,EAAO,SAAS,MAAA,CAAO,KAAA;AAAA,MACvB,cAAA,EAAgB,WAAW,UAAA,GAAa,MAAA;AAAA,MACxC,WAAA;AAAA,MAEA,SAAA,EAAW,SAAA;AAAA,MACX,UAAA,EAAY,QAAA;AAAA,MACZ,UAAA,EAAY,QAAA;AAAA,MACZ,UAAA,EAAY,QAAA;AAAA,MACZ,SAAA,EAAW,QAAA;AAAA,MACX,OAAO,KAAA,IAAS,EAAA;AAAA,MAChB,QAAA,EAAU,YAAA;AAAA,MACV,MAAA,EAAQ,UAAA;AAAA,MACR,OAAA,EAAS,WAAA;AAAA,MACT,kBAAA,EAAkB,mBAAsB,EAAE;AAAA;AAAA,GAC5C;AAEJ;;;;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { enumOptionsIndexForValue, ariaDescribedByIds, enumOptionsValueForIndex } from '@rjsf/utils';
|
|
3
|
+
import { RadioGroup, Radio } from '@backstage/ui';
|
|
4
|
+
|
|
5
|
+
function RadioWidget({
|
|
6
|
+
id,
|
|
7
|
+
options,
|
|
8
|
+
required,
|
|
9
|
+
value,
|
|
10
|
+
disabled,
|
|
11
|
+
readonly,
|
|
12
|
+
label,
|
|
13
|
+
onChange: onFieldChange,
|
|
14
|
+
rawErrors = []
|
|
15
|
+
}) {
|
|
16
|
+
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
17
|
+
const handleChange = (newValue) => {
|
|
18
|
+
const actualValue = enumOptionsValueForIndex(
|
|
19
|
+
newValue,
|
|
20
|
+
enumOptions,
|
|
21
|
+
emptyValue
|
|
22
|
+
);
|
|
23
|
+
onFieldChange(actualValue);
|
|
24
|
+
};
|
|
25
|
+
const selectedIndex = enumOptionsIndexForValue(value, enumOptions) ?? void 0;
|
|
26
|
+
const hasError = rawErrors.length > 0;
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
RadioGroup,
|
|
29
|
+
{
|
|
30
|
+
name: id,
|
|
31
|
+
label,
|
|
32
|
+
secondaryLabel: required ? "Required" : void 0,
|
|
33
|
+
value: selectedIndex !== void 0 ? String(selectedIndex) : "",
|
|
34
|
+
onChange: handleChange,
|
|
35
|
+
isRequired: required,
|
|
36
|
+
isDisabled: disabled || readonly,
|
|
37
|
+
isInvalid: hasError,
|
|
38
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
39
|
+
children: enumOptions?.map(({ value: optionValue, label: optionLabel }, index) => {
|
|
40
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1;
|
|
41
|
+
return /* @__PURE__ */ jsx(Radio, { value: String(index), isDisabled: itemDisabled, children: optionLabel }, index);
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { RadioWidget as default };
|
|
48
|
+
//# sourceMappingURL=RadioWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/RadioWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport {\n ariaDescribedByIds,\n enumOptionsIndexForValue,\n enumOptionsValueForIndex,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport { RadioGroup, Radio } from '@backstage/ui';\n\nexport default function RadioWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n id,\n options,\n required,\n value,\n disabled,\n readonly,\n label,\n onChange: onFieldChange,\n rawErrors = [],\n}: WidgetProps<T, S, F>) {\n const { enumOptions, enumDisabled, emptyValue } = options;\n\n const handleChange = (newValue: string) => {\n const actualValue = enumOptionsValueForIndex<S>(\n newValue,\n enumOptions,\n emptyValue,\n );\n onFieldChange(actualValue);\n };\n\n const selectedIndex =\n enumOptionsIndexForValue<S>(value, enumOptions) ?? undefined;\n const hasError = rawErrors.length > 0;\n\n return (\n <RadioGroup\n name={id}\n label={label}\n secondaryLabel={required ? 'Required' : undefined}\n value={selectedIndex !== undefined ? String(selectedIndex) : ''}\n onChange={handleChange}\n isRequired={required}\n isDisabled={disabled || readonly}\n isInvalid={hasError}\n aria-describedby={ariaDescribedByIds<T>(id)}\n >\n {enumOptions?.map(({ value: optionValue, label: optionLabel }, index) => {\n const itemDisabled =\n Array.isArray(enumDisabled) &&\n enumDisabled.indexOf(optionValue) !== -1;\n\n return (\n <Radio key={index} value={String(index)} isDisabled={itemDisabled}>\n {optionLabel}\n </Radio>\n );\n })}\n </RadioGroup>\n );\n}\n"],"names":[],"mappings":";;;;AA0BA,SAAwB,WAAA,CAItB;AAAA,EACA,EAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA,EAAU,aAAA;AAAA,EACV,YAAY;AACd,CAAA,EAAyB;AACvB,EAAA,MAAM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+1,56 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { rangeSpec, ariaDescribedByIds } from '@rjsf/utils';
|
|
3
|
+
import { Flex, Text } from '@backstage/ui';
|
|
4
|
+
|
|
5
|
+
function RangeWidget({
|
|
6
|
+
id,
|
|
7
|
+
value,
|
|
8
|
+
readonly,
|
|
9
|
+
disabled,
|
|
10
|
+
schema,
|
|
11
|
+
label,
|
|
12
|
+
required,
|
|
13
|
+
onChange: onFieldChange,
|
|
14
|
+
onBlur: onFieldBlur,
|
|
15
|
+
onFocus: onFieldFocus
|
|
16
|
+
}) {
|
|
17
|
+
const { min, max, step } = rangeSpec(schema);
|
|
18
|
+
const handleChange = ({
|
|
19
|
+
target: { value: inputValue }
|
|
20
|
+
}) => onFieldChange(parseFloat(inputValue));
|
|
21
|
+
const handleBlur = () => onFieldBlur(id, value);
|
|
22
|
+
const handleFocus = () => onFieldFocus(id, value);
|
|
23
|
+
return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "4", children: [
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
25
|
+
"input",
|
|
26
|
+
{
|
|
27
|
+
id,
|
|
28
|
+
name: id,
|
|
29
|
+
type: "range",
|
|
30
|
+
disabled: disabled || readonly,
|
|
31
|
+
min,
|
|
32
|
+
max,
|
|
33
|
+
step,
|
|
34
|
+
value: value ?? min,
|
|
35
|
+
onChange: handleChange,
|
|
36
|
+
onBlur: handleBlur,
|
|
37
|
+
onFocus: handleFocus,
|
|
38
|
+
"aria-label": label,
|
|
39
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
40
|
+
required,
|
|
41
|
+
style: { flex: 1 }
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
Text,
|
|
46
|
+
{
|
|
47
|
+
variant: "body-medium",
|
|
48
|
+
style: { minWidth: "3rem", textAlign: "right" },
|
|
49
|
+
children: value ?? min
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { RangeWidget as default };
|
|
56
|
+
//# sourceMappingURL=RangeWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/RangeWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport { ChangeEvent } from 'react';\nimport {\n ariaDescribedByIds,\n FormContextType,\n rangeSpec,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport { Flex, Text } from '@backstage/ui';\n\nexport default function RangeWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n id,\n value,\n readonly,\n disabled,\n schema,\n label,\n required,\n onChange: onFieldChange,\n onBlur: onFieldBlur,\n onFocus: onFieldFocus,\n}: WidgetProps<T, S, F>) {\n const { min, max, step } = rangeSpec<S>(schema);\n\n const handleChange = ({\n target: { value: inputValue },\n }: ChangeEvent<HTMLInputElement>) => onFieldChange(parseFloat(inputValue));\n const handleBlur = () => onFieldBlur(id, value);\n const handleFocus = () => onFieldFocus(id, value);\n\n return (\n <Flex align=\"center\" gap=\"4\">\n <input\n id={id}\n name={id}\n type=\"range\"\n disabled={disabled || readonly}\n min={min}\n max={max}\n step={step}\n value={value ?? min}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n aria-label={label}\n aria-describedby={ariaDescribedByIds<T>(id)}\n required={required}\n style={{ flex: 1 }}\n />\n <Text\n variant=\"body-medium\"\n style={{ minWidth: '3rem', textAlign: 'right' }}\n >\n {value ?? min}\n </Text>\n </Flex>\n );\n}\n"],"names":[],"mappings":";;;;AA0BA,SAAwB,WAAA,CAItB;AAAA,EACA,EAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA,EAAU,aAAA;AAAA,EACV,MAAA,EAAQ,WAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAA,EAAyB;AACvB,EAAA,MAAM,EAAE,GAAA,EAAK,GAAA,EAAK,IAAA,EAAK,GAAI,UAAa,MAAM,CAAA;AAE9C,EAAA,MAAM,eAAe,CAAC;AAAA,IACpB,MAAA,EAAQ,EAAE,KAAA,EAAO,UAAA;AAAW,GAC9B,KAAqC,aAAA,CAAc,UAAA,CAAW,UAAU,CAAC,CAAA;AACzE,EAAA,MAAM,UAAA,GAAa,MAAM,WAAA,CAAY,EAAA,EAAI,KAAK,CAAA;AAC9C,EAAA,MAAM,WAAA,GAAc,MAAM,YAAA,CAAa,EAAA,EAAI,KAAK,CAAA;AAEhD,EAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,KAAA,EAAM,QAAA,EAAS,KAAI,GAAA,EACvB,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,EAAA;AAAA,QACA,IAAA,EAAM,EAAA;AAAA,QACN,IAAA,EAAK,OAAA;AAAA,QACL,UAAU,QAAA,IAAY,QAAA;AAAA,QACtB,GAAA;AAAA,QACA,GAAA;AAAA,QACA,IAAA;AAAA,QACA,OAAO,KAAA,IAAS,GAAA;AAAA,QAChB,QAAA,EAAU,YAAA;AAAA,QACV,MAAA,EAAQ,UAAA;AAAA,QACR,OAAA,EAAS,WAAA;AAAA,QACT,YAAA,EAAY,KAAA;AAAA,QACZ,kBAAA,EAAkB,mBAAsB,EAAE,CAAA;AAAA,QAC1C,QAAA;AAAA,QACA,KAAA,EAAO,EAAE,IAAA,EAAM,CAAA;AAAE;AAAA,KACnB;AAAA,oBACA,GAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAQ,aAAA;AAAA,QACR,KAAA,EAAO,EAAE,QAAA,EAAU,MAAA,EAAQ,WAAW,OAAA,EAAQ;AAAA,QAE7C,QAAA,EAAA,KAAA,IAAS;AAAA;AAAA;AACZ,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { enumOptionsIndexForValue, ariaDescribedByIds, enumOptionsValueForIndex } from '@rjsf/utils';
|
|
3
|
+
import { Select } from '@backstage/ui';
|
|
4
|
+
import overrides from './selectOverrides.module.css.esm.js';
|
|
5
|
+
|
|
6
|
+
function SelectWidget({
|
|
7
|
+
id,
|
|
8
|
+
options,
|
|
9
|
+
required,
|
|
10
|
+
disabled,
|
|
11
|
+
readonly,
|
|
12
|
+
value,
|
|
13
|
+
multiple,
|
|
14
|
+
label,
|
|
15
|
+
schema,
|
|
16
|
+
onChange: onFieldChange,
|
|
17
|
+
onBlur: onFieldBlur,
|
|
18
|
+
onFocus: onFieldFocus,
|
|
19
|
+
rawErrors = []
|
|
20
|
+
}) {
|
|
21
|
+
const { enumOptions, emptyValue } = options;
|
|
22
|
+
const handleChange = (newValue) => {
|
|
23
|
+
const actualIndex = newValue === "" ? "" : newValue;
|
|
24
|
+
onFieldChange(
|
|
25
|
+
enumOptionsValueForIndex(actualIndex, enumOptions, emptyValue)
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
const handleBlur = () => onFieldBlur(
|
|
29
|
+
id,
|
|
30
|
+
enumOptionsValueForIndex(value, enumOptions, emptyValue)
|
|
31
|
+
);
|
|
32
|
+
const handleFocus = () => onFieldFocus(
|
|
33
|
+
id,
|
|
34
|
+
enumOptionsValueForIndex(value, enumOptions, emptyValue)
|
|
35
|
+
);
|
|
36
|
+
const selectedIndex = enumOptionsIndexForValue(value, enumOptions);
|
|
37
|
+
const hasError = rawErrors.length > 0;
|
|
38
|
+
const selectOptions = enumOptions?.map(({ label: optionLabel }, index) => ({
|
|
39
|
+
value: String(index),
|
|
40
|
+
label: optionLabel
|
|
41
|
+
})) || [];
|
|
42
|
+
if (!multiple && schema.default === void 0) {
|
|
43
|
+
selectOptions.unshift({
|
|
44
|
+
value: "",
|
|
45
|
+
label: options.placeholder || "Select an option"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
Select,
|
|
50
|
+
{
|
|
51
|
+
className: overrides.select,
|
|
52
|
+
id,
|
|
53
|
+
name: id,
|
|
54
|
+
label: label || schema.title,
|
|
55
|
+
secondaryLabel: required ? "Required" : void 0,
|
|
56
|
+
options: selectOptions,
|
|
57
|
+
selectedKey: selectedIndex !== void 0 ? String(selectedIndex) : "",
|
|
58
|
+
onSelectionChange: (key) => {
|
|
59
|
+
const selected = key ? String(key) : "";
|
|
60
|
+
handleChange(selected);
|
|
61
|
+
},
|
|
62
|
+
isRequired: required,
|
|
63
|
+
isDisabled: disabled || readonly,
|
|
64
|
+
isInvalid: hasError,
|
|
65
|
+
onBlur: handleBlur,
|
|
66
|
+
onFocus: handleFocus,
|
|
67
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { SelectWidget as default };
|
|
73
|
+
//# sourceMappingURL=SelectWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/SelectWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport {\n ariaDescribedByIds,\n enumOptionsIndexForValue,\n enumOptionsValueForIndex,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport { Select } from '@backstage/ui';\nimport overrides from './selectOverrides.module.css';\n\nexport default function SelectWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n id,\n options,\n required,\n disabled,\n readonly,\n value,\n multiple,\n label,\n schema,\n onChange: onFieldChange,\n onBlur: onFieldBlur,\n onFocus: onFieldFocus,\n rawErrors = [],\n}: WidgetProps<T, S, F>) {\n const { enumOptions, emptyValue } = options;\n\n const handleChange = (newValue: string) => {\n const actualIndex = newValue === '' ? '' : newValue;\n onFieldChange(\n enumOptionsValueForIndex<S>(actualIndex, enumOptions, emptyValue),\n );\n };\n\n const handleBlur = () =>\n onFieldBlur(\n id,\n enumOptionsValueForIndex<S>(value, enumOptions, emptyValue),\n );\n const handleFocus = () =>\n onFieldFocus(\n id,\n enumOptionsValueForIndex<S>(value, enumOptions, emptyValue),\n );\n\n const selectedIndex = enumOptionsIndexForValue<S>(value, enumOptions);\n const hasError = rawErrors.length > 0;\n\n const selectOptions =\n enumOptions?.map(({ label: optionLabel }, index) => ({\n value: String(index),\n label: optionLabel,\n })) || [];\n\n if (!multiple && schema.default === undefined) {\n selectOptions.unshift({\n value: '',\n label: (options.placeholder as string) || 'Select an option',\n });\n }\n\n return (\n <Select\n className={overrides.select}\n id={id}\n name={id}\n label={label || schema.title}\n secondaryLabel={required ? 'Required' : undefined}\n options={selectOptions}\n selectedKey={selectedIndex !== undefined ? String(selectedIndex) : ''}\n onSelectionChange={key => {\n const selected = key ? String(key) : '';\n handleChange(selected);\n }}\n isRequired={required}\n isDisabled={disabled || readonly}\n isInvalid={hasError}\n onBlur={handleBlur}\n onFocus={handleFocus}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n );\n}\n"],"names":[],"mappings":";;;;;AA2BA,SAAwB,YAAA,CAItB;AAAA,EACA,EAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA,EAAU,aAAA;AAAA,EACV,MAAA,EAAQ,WAAA;AAAA,EACR,OAAA,EAAS,YAAA;AAAA,EACT,YAAY;AACd,CAAA,EAAyB;AACvB,EAAA,MAAM,EAAE,WAAA,EAAa,UAAA,EAAW,GAAI,OAAA;AAEpC,EAAA,MAAM,YAAA,GAAe,CAAC,QAAA,KAAqB;AACzC,IAAA,MAAM,WAAA,GAAc,QAAA,KAAa,EAAA,GAAK,EAAA,GAAK,QAAA;AAC3C,IAAA,aAAA;AAAA,MACE,wBAAA,CAA4B,WAAA,EAAa,WAAA,EAAa,UAAU;AAAA,KAClE;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,aAAa,MACjB,WAAA;AAAA,IACE,EAAA;AAAA,IACA,wBAAA,CAA4B,KAAA,EAAO,WAAA,EAAa,UAAU;AAAA,GAC5D;AACF,EAAA,MAAM,cAAc,MAClB,YAAA;AAAA,IACE,EAAA;AAAA,IACA,wBAAA,CAA4B,KAAA,EAAO,WAAA,EAAa,UAAU;AAAA,GAC5D;AAEF,EAAA,MAAM,aAAA,GAAgB,wBAAA,CAA4B,KAAA,EAAO,WAAW,CAAA;AACpE,EAAA,MAAM,QAAA,GAAW,UAAU,MAAA,GAAS,CAAA;AAEpC,EAAA,MAAM,aAAA,GACJ,aAAa,GAAA,CAAI,CAAC,EAAE,KAAA,EAAO,WAAA,IAA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@__PURE__ */ jsx(BaseInputTemplate, { ...props });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { TextWidget as default };
|
|
9
|
+
//# sourceMappingURL=TextWidget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextWidget.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/TextWidget.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 */\nimport {\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\nimport BaseInputTemplate from './BaseInputTemplate';\n\nexport default function TextWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: WidgetProps<T, S, F>) {\n return <BaseInputTemplate {...props} />;\n}\n"],"names":[],"mappings":";;;AAuBA,SAAwB,WAItB,KAAA,EAA6B;AAC7B,EAAA,uBAAO,GAAA,CAAC,iBAAA,EAAA,EAAmB,GAAG,KAAA,EAAO,CAAA;AACvC;;;;"}
|