@backstage/plugin-scaffolder-react 1.20.1 → 1.21.0-next.1
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 +56 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-react
|
|
2
2
|
|
|
3
|
+
## 1.21.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dbeb7aa: Added experimental BUI (Backstage UI) form theme for scaffolder forms. All default field extensions render BUI variants when enabled.
|
|
8
|
+
|
|
9
|
+
**Extension config:**
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
app:
|
|
13
|
+
extensions:
|
|
14
|
+
- sub-page:scaffolder/templates:
|
|
15
|
+
config:
|
|
16
|
+
enableBackstageUi: true
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**JSX props:**
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
<ScaffolderPage formProps={{ EXPERIMENTAL_theme: 'bui' }} />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- 8006acf: Promoted `FormDecoratorBlueprint` and `ScaffolderFormDecorator` from `@alpha`
|
|
26
|
+
to `@public`.
|
|
27
|
+
- d09c21c: The `TemplateCard` component is now a swappable component. Apps using the new
|
|
28
|
+
frontend system can replace it by registering a `SwappableComponentBlueprint`
|
|
29
|
+
that targets `TemplateCard`. Components used as the swappable implementation
|
|
30
|
+
receive `TemplateCardComponentProps`, where `onSelected` is a zero-argument
|
|
31
|
+
callback bound to the rendered template. Existing usage continues to work
|
|
32
|
+
unchanged.
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
- @backstage/ui@0.15.0-next.3
|
|
38
|
+
- @backstage/plugin-scaffolder-common@2.2.0-next.1
|
|
39
|
+
- @backstage/plugin-catalog-react@2.1.5-next.1
|
|
40
|
+
|
|
41
|
+
## 1.20.2-next.0
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Updated dependencies
|
|
46
|
+
- @backstage/core-components@0.18.10-next.0
|
|
47
|
+
- @backstage/frontend-test-utils@0.5.3-next.0
|
|
48
|
+
- @backstage/plugin-catalog-react@2.1.5-next.0
|
|
49
|
+
- @backstage/frontend-plugin-api@0.17.0-next.0
|
|
50
|
+
- @backstage/catalog-client@1.15.1-next.0
|
|
51
|
+
- @backstage/catalog-model@1.8.1-next.0
|
|
52
|
+
- @backstage/core-plugin-api@1.12.6-next.0
|
|
53
|
+
- @backstage/plugin-scaffolder-common@2.1.1-next.0
|
|
54
|
+
- @backstage/theme@0.7.3
|
|
55
|
+
- @backstage/types@1.2.2
|
|
56
|
+
- @backstage/version-bridge@1.0.12
|
|
57
|
+
- @backstage/plugin-permission-react@0.5.1-next.0
|
|
58
|
+
|
|
3
59
|
## 1.20.1
|
|
4
60
|
|
|
5
61
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ declare const createAsyncValidators: (rootSchema: JsonObject, validators: Record
|
|
|
104
104
|
}) => (formData: JsonObject) => Promise<FormValidation>;
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* The Props for the {@link
|
|
107
|
+
* The legacy Props for the `CardComponent` slot in {@link TemplateGroupsProps}.
|
|
108
108
|
* @alpha
|
|
109
109
|
*/
|
|
110
110
|
interface TemplateCardProps {
|
|
@@ -117,10 +117,32 @@ interface TemplateCardProps {
|
|
|
117
117
|
onSelected?: (template: TemplateEntityV1beta3) => void;
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
|
-
* The
|
|
120
|
+
* The Props for components used as the swappable {@link TemplateCard}. The
|
|
121
|
+
* surrounding list takes care of binding the template to `onSelected`, so
|
|
122
|
+
* implementations only need to invoke it without arguments.
|
|
121
123
|
* @alpha
|
|
122
124
|
*/
|
|
123
|
-
|
|
125
|
+
interface TemplateCardComponentProps {
|
|
126
|
+
template: TemplateEntityV1beta3;
|
|
127
|
+
additionalLinks?: {
|
|
128
|
+
icon: IconComponent;
|
|
129
|
+
text: string;
|
|
130
|
+
url: string;
|
|
131
|
+
}[];
|
|
132
|
+
onSelected?: () => void;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The `TemplateCard` component that is rendered in a list for each template.
|
|
137
|
+
* Apps using the new frontend system can replace it by registering a
|
|
138
|
+
* `SwappableComponentBlueprint` that targets `TemplateCard`.
|
|
139
|
+
*
|
|
140
|
+
* @alpha
|
|
141
|
+
*/
|
|
142
|
+
declare const TemplateCard: {
|
|
143
|
+
(props: TemplateCardComponentProps): JSX.Element | null;
|
|
144
|
+
ref: _backstage_frontend_plugin_api.SwappableComponentRef<TemplateCardComponentProps, TemplateCardComponentProps>;
|
|
145
|
+
};
|
|
124
146
|
|
|
125
147
|
/**
|
|
126
148
|
* The props for the {@link TemplateGroup} component.
|
|
@@ -203,7 +225,12 @@ declare const DefaultTemplateOutputs: (props: {
|
|
|
203
225
|
* The Form component
|
|
204
226
|
* @alpha
|
|
205
227
|
*/
|
|
206
|
-
declare const Form: (props: PropsWithChildren<ScaffolderRJSFFormProps
|
|
228
|
+
declare const Form: (props: PropsWithChildren<ScaffolderRJSFFormProps & Pick<FormProps, "EXPERIMENTAL_theme">>) => react_jsx_runtime.JSX.Element;
|
|
229
|
+
|
|
230
|
+
/** @alpha */
|
|
231
|
+
type ScaffolderTheme = 'mui' | 'bui';
|
|
232
|
+
/** @alpha */
|
|
233
|
+
declare const useScaffolderTheme: () => ScaffolderTheme;
|
|
207
234
|
|
|
208
235
|
/**
|
|
209
236
|
* Props for the TaskSteps component
|
|
@@ -341,7 +368,7 @@ type ScaffolderFormDecoratorContext<TInput extends JsonObject = JsonObject> = {
|
|
|
341
368
|
setFormState: (fn: (currentState: Record<string, JsonValue>) => Record<string, JsonValue>) => void;
|
|
342
369
|
setSecrets: (fn: (currentState: Record<string, string>) => Record<string, string>) => void;
|
|
343
370
|
};
|
|
344
|
-
/** @
|
|
371
|
+
/** @public */
|
|
345
372
|
type ScaffolderFormDecorator<TInput extends JsonObject = JsonObject> = {
|
|
346
373
|
readonly $$type: '@backstage/scaffolder/FormDecorator';
|
|
347
374
|
readonly id: string;
|
|
@@ -376,7 +403,7 @@ declare function createScaffolderFormDecorator<TInputSchema extends {
|
|
|
376
403
|
}): ScaffolderFormDecorator<TInput>;
|
|
377
404
|
|
|
378
405
|
/**
|
|
379
|
-
* @
|
|
406
|
+
* @public
|
|
380
407
|
* Creates extensions that are Field Extensions for the Scaffolder
|
|
381
408
|
* */
|
|
382
409
|
declare const FormDecoratorBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
@@ -449,5 +476,5 @@ declare const scaffolderReactTranslationRef: _backstage_frontend_plugin_api.Tran
|
|
|
449
476
|
readonly "templateOutputs.title": "Text Output";
|
|
450
477
|
}>;
|
|
451
478
|
|
|
452
|
-
export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormDecoratorBlueprint, FormFieldBlueprint, ReviewState, ScaffolderField, ScaffolderPageContextMenu, SecretWidget, Stepper, TaskLogStream, TaskSteps, TemplateCard, TemplateCategoryPicker, TemplateGroup, TemplateGroups, Workflow, createAsyncValidators, createFieldValidation, createFormField, createScaffolderFormDecorator, extractSchemaFromStep, formFieldsApiRef, scaffolderReactTranslationRef, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
|
|
453
|
-
export type { BackstageOverrides, BackstageTemplateStepperClassKey, FormField, FormFieldExtensionData, FormValidation, ParsedTemplateSchema, ReviewStateProps, ScaffolderFieldProps, ScaffolderFormDecorator, ScaffolderFormDecoratorContext, ScaffolderFormFieldsApi, ScaffolderPageContextMenuProps, ScaffolderReactComponentsNameToClassKey, ScaffolderReactTemplateCategoryPickerClassKey, StepperProps, TaskStepsProps, TemplateCardProps, TemplateGroupProps, TemplateGroupsProps, WorkflowProps };
|
|
479
|
+
export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormDecoratorBlueprint, FormFieldBlueprint, ReviewState, ScaffolderField, ScaffolderPageContextMenu, SecretWidget, Stepper, TaskLogStream, TaskSteps, TemplateCard, TemplateCategoryPicker, TemplateGroup, TemplateGroups, Workflow, createAsyncValidators, createFieldValidation, createFormField, createScaffolderFormDecorator, extractSchemaFromStep, formFieldsApiRef, scaffolderReactTranslationRef, useFilteredSchemaProperties, useFormDataFromQuery, useScaffolderTheme, useTemplateParameterSchema, useTemplateSchema };
|
|
480
|
+
export type { BackstageOverrides, BackstageTemplateStepperClassKey, FormField, FormFieldExtensionData, FormValidation, ParsedTemplateSchema, ReviewStateProps, ScaffolderFieldProps, ScaffolderFormDecorator, ScaffolderFormDecoratorContext, ScaffolderFormFieldsApi, ScaffolderPageContextMenuProps, ScaffolderReactComponentsNameToClassKey, ScaffolderReactTemplateCategoryPickerClassKey, ScaffolderTheme, StepperProps, TaskStepsProps, TemplateCardComponentProps, TemplateCardProps, TemplateGroupProps, TemplateGroupsProps, WorkflowProps };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -8,6 +8,7 @@ export { TemplateGroups } from './next/components/TemplateGroups/TemplateGroups.
|
|
|
8
8
|
export { EmbeddableWorkflow, Workflow } from './next/components/Workflow/Workflow.esm.js';
|
|
9
9
|
export { DefaultTemplateOutputs } from './next/components/TemplateOutputs/DefaultTemplateOutputs.esm.js';
|
|
10
10
|
export { Form } from './next/components/Form/Form.esm.js';
|
|
11
|
+
export { useScaffolderTheme } from './next/components/Form/ScaffolderThemeContext.esm.js';
|
|
11
12
|
export { TaskSteps } from './next/components/TaskSteps/TaskSteps.esm.js';
|
|
12
13
|
export { TaskLogStream } from './next/components/TaskLogStream/TaskLogStream.esm.js';
|
|
13
14
|
export { TemplateCategoryPicker } from './next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js';
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\n * Copyright 2022 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 */\n\nexport * from './next';\n\nimport { scaffolderReactTranslationRef as _scaffolderReactTranslationRef } from './translation';\n\n/**\n * @alpha\n * @deprecated Import from `@backstage/plugin-scaffolder-react` instead.\n */\nexport const scaffolderReactTranslationRef = _scaffolderReactTranslationRef;\n"],"names":["_scaffolderReactTranslationRef"],"mappings":"
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\n * Copyright 2022 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 */\n\nexport * from './next';\n\nimport { scaffolderReactTranslationRef as _scaffolderReactTranslationRef } from './translation';\n\n/**\n * @alpha\n * @deprecated Import from `@backstage/plugin-scaffolder-react` instead.\n */\nexport const scaffolderReactTranslationRef = _scaffolderReactTranslationRef;\n"],"names":["_scaffolderReactTranslationRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,6BAAA,GAAgCA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -314,7 +314,9 @@ type TemplateGroupFilter = {
|
|
|
314
314
|
*
|
|
315
315
|
* @public
|
|
316
316
|
*/
|
|
317
|
-
type FormProps = Pick<FormProps$1, 'transformErrors' | 'noHtml5Validate' | 'uiSchema' | 'formContext' | 'omitExtraData' | 'liveOmit'
|
|
317
|
+
type FormProps = Pick<FormProps$1, 'transformErrors' | 'noHtml5Validate' | 'uiSchema' | 'formContext' | 'omitExtraData' | 'liveOmit'> & {
|
|
318
|
+
EXPERIMENTAL_theme?: 'mui' | 'bui';
|
|
319
|
+
};
|
|
318
320
|
/**
|
|
319
321
|
* The props for the Last Step in scaffolder template form.
|
|
320
322
|
* Which represents the summary of the input provided by the end user.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormDecoratorBlueprint.esm.js","sources":["../../../src/next/blueprints/FormDecoratorBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormDecorator } from '../extensions';\n\nconst formDecoratorExtensionDataRef =\n createExtensionDataRef<ScaffolderFormDecorator>().with({\n id: 'scaffolder.form-decorator-loader',\n });\n\n/**\n * @
|
|
1
|
+
{"version":3,"file":"FormDecoratorBlueprint.esm.js","sources":["../../../src/next/blueprints/FormDecoratorBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormDecorator } from '../extensions';\n\nconst formDecoratorExtensionDataRef =\n createExtensionDataRef<ScaffolderFormDecorator>().with({\n id: 'scaffolder.form-decorator-loader',\n });\n\n/**\n * @public\n * Creates extensions that are Field Extensions for the Scaffolder\n * */\nexport const FormDecoratorBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-form-decorator',\n attachTo: { id: 'api:scaffolder/form-decorators', input: 'formDecorators' },\n dataRefs: {\n formDecoratorLoader: formDecoratorExtensionDataRef,\n },\n output: [formDecoratorExtensionDataRef],\n *factory(params: { decorator: ScaffolderFormDecorator }) {\n yield formDecoratorExtensionDataRef(params.decorator);\n },\n});\n"],"names":[],"mappings":";;AAqBA,MAAM,6BAAA,GACJ,sBAAA,EAAgD,CAAE,IAAA,CAAK;AAAA,EACrD,EAAA,EAAI;AACN,CAAC,CAAA;AAMI,MAAM,yBAAyB,wBAAA,CAAyB;AAAA,EAC7D,IAAA,EAAM,2BAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,gCAAA,EAAkC,OAAO,gBAAA,EAAiB;AAAA,EAC1E,QAAA,EAAU;AAAA,IACR,mBAAA,EAAqB;AAAA,GACvB;AAAA,EACA,MAAA,EAAQ,CAAC,6BAA6B,CAAA;AAAA,EACtC,CAAC,QAAQ,MAAA,EAAgD;AACvD,IAAA,MAAM,6BAAA,CAA8B,OAAO,SAAS,CAAA;AAAA,EACtD;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import styleInject from '../../../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = "/*\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 */\n\n/* BUI inputs ship in a \"filled\" style that picks a neutral one step above the\n * surface they sit on. Scaffolder forms live on the same neutral-1 surface as\n * their inputs, so the bg step-up either reads as disabled or disappears\n * entirely. Override to the outlined style PasswordField already uses: rest\n * border, focus/invalid borders preserved from BUI defaults. */\n\n@layer components {\n .Form_form__dce6521a3e .bui-Input:not([data-focused]):not([data-invalid]),\n .Form_form__dce6521a3e\n .bui-ComboboxInput:not([data-focus-within]):not([data-invalid]) {\n box-shadow: inset 0 0 0 1px var(--bui-border-2);\n }\n\n .Form_form__dce6521a3e\n .bui-SelectTrigger:not([data-focus-visible]):not([data-invalid]) {\n box-shadow: inset 0 0 0 1px var(--bui-border-2);\n }\n}\n";
|
|
4
|
+
var styles = {"form":"Form_form__dce6521a3e"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { styles as default };
|
|
8
|
+
//# sourceMappingURL=Form.module.css.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateBuiTemplates } from './templates/index.esm.js';
|
|
2
|
+
import { generateBuiWidgets } from './widgets/index.esm.js';
|
|
3
|
+
|
|
4
|
+
function generateBuiTheme() {
|
|
5
|
+
return {
|
|
6
|
+
templates: generateBuiTemplates(),
|
|
7
|
+
widgets: generateBuiWidgets()
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { generateBuiTheme };
|
|
12
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../src/next/components/Form/BuiTheme/index.ts"],"sourcesContent":["/*\n * Copyright 2022 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 { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\nimport { ThemeProps } from '@rjsf/core';\n\nimport { generateBuiTemplates } from './templates';\nimport { generateBuiWidgets } from './widgets';\n\nexport function generateBuiTheme<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(): ThemeProps<T, S, F> {\n return {\n templates: generateBuiTemplates<T, S, F>(),\n widgets: generateBuiWidgets<T, S, F>(),\n };\n}\n"],"names":[],"mappings":";;;AAqBO,SAAS,gBAAA,GAIS;AACvB,EAAA,OAAO;AAAA,IACL,WAAW,oBAAA,EAA8B;AAAA,IACzC,SAAS,kBAAA;AAA4B,GACvC;AACF;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { isValidElement } from 'react';
|
|
3
|
+
import { MarkdownContent } from '@backstage/core-components';
|
|
4
|
+
|
|
5
|
+
function ArrayFieldDescriptionTemplate(props) {
|
|
6
|
+
const { description } = props;
|
|
7
|
+
if (!description) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
if (isValidElement(description)) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Fragment, { children: description });
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ jsx(MarkdownContent, { content: description, linkTarget: "_blank" });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { ArrayFieldDescriptionTemplate as default };
|
|
17
|
+
//# sourceMappingURL=ArrayFieldDescriptionTemplate.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayFieldDescriptionTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ArrayFieldDescriptionTemplate.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 { isValidElement } from 'react';\nimport {\n ArrayFieldDescriptionProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { MarkdownContent } from '@backstage/core-components';\n\nexport default function ArrayFieldDescriptionTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: ArrayFieldDescriptionProps<T, S, F>) {\n const { description } = props;\n if (!description) {\n return null;\n }\n\n if (isValidElement(description)) {\n return <>{description}</>;\n }\n\n return <MarkdownContent content={description as string} linkTarget=\"_blank\" />;\n}\n"],"names":[],"mappings":";;;;AAwBA,SAAwB,8BAItB,KAAA,EAA4C;AAC5C,EAAA,MAAM,EAAE,aAAY,GAAI,KAAA;AACxB,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,cAAA,CAAe,WAAW,CAAA,EAAG;AAC/B,IAAA,uCAAU,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,EACxB;AAEA,EAAA,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,WAAA,EAAuB,YAAW,QAAA,EAAS,CAAA;AAC9E;;;;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Box, Card, CardHeader, Flex, Button, Text, ButtonIcon, CardBody } from '@backstage/ui';
|
|
4
|
+
import { Disclosure, DisclosurePanel } from 'react-aria-components';
|
|
5
|
+
import { RiArrowDownSLine, RiArrowRightSLine, RiArrowUpSLine, RiAddLine, RiDeleteBinLine } from '@remixicon/react';
|
|
6
|
+
|
|
7
|
+
function ArrayFieldItemTemplate({
|
|
8
|
+
children,
|
|
9
|
+
disabled,
|
|
10
|
+
hasToolbar,
|
|
11
|
+
hasCopy,
|
|
12
|
+
hasMoveDown,
|
|
13
|
+
hasMoveUp,
|
|
14
|
+
hasRemove,
|
|
15
|
+
index,
|
|
16
|
+
onCopyIndexClick,
|
|
17
|
+
onDropIndexClick,
|
|
18
|
+
onReorderClick,
|
|
19
|
+
readonly,
|
|
20
|
+
schema
|
|
21
|
+
}) {
|
|
22
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
23
|
+
const itemSchema = schema?.items;
|
|
24
|
+
const itemTitle = itemSchema?.title ? `${itemSchema.title} ${index + 1}` : `Item ${index + 1}`;
|
|
25
|
+
return /* @__PURE__ */ jsx(Box, { mb: "4", children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Disclosure, { isExpanded: isOpen, onExpandedChange: setIsOpen, children: ({ isExpanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
CardHeader,
|
|
28
|
+
{
|
|
29
|
+
style: { backgroundColor: "var(--bui-bg-neutral-2)" },
|
|
30
|
+
children: /* @__PURE__ */ jsx(Box, { py: "3", px: "4", children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "between", children: [
|
|
31
|
+
/* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
Button,
|
|
34
|
+
{
|
|
35
|
+
slot: "trigger",
|
|
36
|
+
style: {
|
|
37
|
+
padding: "2px",
|
|
38
|
+
background: "none",
|
|
39
|
+
border: "none",
|
|
40
|
+
cursor: "pointer",
|
|
41
|
+
display: "flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
color: "var(--bui-fg-secondary)"
|
|
44
|
+
},
|
|
45
|
+
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
46
|
+
children: isExpanded ? /* @__PURE__ */ jsx(RiArrowDownSLine, { size: 18 }) : /* @__PURE__ */ jsx(RiArrowRightSLine, { size: 18 })
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ jsx(Text, { variant: "body-medium", weight: "bold", children: itemTitle })
|
|
50
|
+
] }),
|
|
51
|
+
hasToolbar && /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "1", children: [
|
|
52
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
ButtonIcon,
|
|
55
|
+
{
|
|
56
|
+
variant: "tertiary",
|
|
57
|
+
size: "small",
|
|
58
|
+
isDisabled: disabled || readonly || !hasMoveUp,
|
|
59
|
+
onClick: onReorderClick(index, index - 1),
|
|
60
|
+
"aria-label": "Move up",
|
|
61
|
+
icon: /* @__PURE__ */ jsx(RiArrowUpSLine, { size: 18 })
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
ButtonIcon,
|
|
66
|
+
{
|
|
67
|
+
variant: "tertiary",
|
|
68
|
+
size: "small",
|
|
69
|
+
isDisabled: disabled || readonly || !hasMoveDown,
|
|
70
|
+
onClick: onReorderClick(index, index + 1),
|
|
71
|
+
"aria-label": "Move down",
|
|
72
|
+
icon: /* @__PURE__ */ jsx(RiArrowDownSLine, { size: 18 })
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] }),
|
|
76
|
+
hasCopy && /* @__PURE__ */ jsx(
|
|
77
|
+
ButtonIcon,
|
|
78
|
+
{
|
|
79
|
+
variant: "tertiary",
|
|
80
|
+
size: "small",
|
|
81
|
+
isDisabled: disabled || readonly,
|
|
82
|
+
onClick: onCopyIndexClick(index),
|
|
83
|
+
"aria-label": "Duplicate",
|
|
84
|
+
icon: /* @__PURE__ */ jsx(RiAddLine, { size: 18 })
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
hasRemove && /* @__PURE__ */ jsx(
|
|
88
|
+
ButtonIcon,
|
|
89
|
+
{
|
|
90
|
+
variant: "tertiary",
|
|
91
|
+
size: "small",
|
|
92
|
+
isDisabled: disabled || readonly,
|
|
93
|
+
onClick: onDropIndexClick(index),
|
|
94
|
+
"aria-label": "Remove",
|
|
95
|
+
icon: /* @__PURE__ */ jsx(RiDeleteBinLine, { size: 18 })
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] })
|
|
99
|
+
] }) })
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ jsx(DisclosurePanel, { children: /* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsx(Box, { p: "4", children }) }) })
|
|
103
|
+
] }) }) }) });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { ArrayFieldItemTemplate as default };
|
|
107
|
+
//# sourceMappingURL=ArrayFieldItemTemplate.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayFieldItemTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ArrayFieldItemTemplate.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 ArrayFieldTemplateItemType,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { useState } from 'react';\nimport {\n Card,\n CardHeader,\n CardBody,\n Flex,\n Text,\n ButtonIcon,\n Box,\n Button,\n} from '@backstage/ui';\nimport { Disclosure, DisclosurePanel } from 'react-aria-components';\nimport {\n RiArrowDownSLine,\n RiArrowUpSLine,\n RiDeleteBinLine,\n RiAddLine,\n RiArrowRightSLine,\n} from '@remixicon/react';\n\nexport default function ArrayFieldItemTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n children,\n disabled,\n hasToolbar,\n hasCopy,\n hasMoveDown,\n hasMoveUp,\n hasRemove,\n index,\n onCopyIndexClick,\n onDropIndexClick,\n onReorderClick,\n readonly,\n schema,\n}: ArrayFieldTemplateItemType<T, S, F>) {\n const [isOpen, setIsOpen] = useState(true);\n\n const itemSchema = schema?.items as S | undefined;\n const itemTitle = itemSchema?.title\n ? `${itemSchema.title} ${index + 1}`\n : `Item ${index + 1}`;\n\n return (\n <Box mb=\"4\">\n <Card>\n <Disclosure isExpanded={isOpen} onExpandedChange={setIsOpen}>\n {({ isExpanded }) => (\n <>\n <CardHeader\n style={{ backgroundColor: 'var(--bui-bg-neutral-2)' }}\n >\n <Box py=\"3\" px=\"4\">\n <Flex align=\"center\" justify=\"between\">\n <Flex align=\"center\" gap=\"2\">\n <Button\n slot=\"trigger\"\n style={{\n padding: '2px',\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n color: 'var(--bui-fg-secondary)',\n }}\n aria-label={isExpanded ? 'Collapse' : 'Expand'}\n >\n {isExpanded ? (\n <RiArrowDownSLine size={18} />\n ) : (\n <RiArrowRightSLine size={18} />\n )}\n </Button>\n <Text variant=\"body-medium\" weight=\"bold\">\n {itemTitle}\n </Text>\n </Flex>\n {hasToolbar && (\n <Flex align=\"center\" gap=\"1\">\n {(hasMoveUp || hasMoveDown) && (\n <>\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly || !hasMoveUp}\n onClick={onReorderClick(index, index - 1)}\n aria-label=\"Move up\"\n icon={<RiArrowUpSLine size={18} />}\n />\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly || !hasMoveDown}\n onClick={onReorderClick(index, index + 1)}\n aria-label=\"Move down\"\n icon={<RiArrowDownSLine size={18} />}\n />\n </>\n )}\n {hasCopy && (\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly}\n onClick={onCopyIndexClick(index)}\n aria-label=\"Duplicate\"\n icon={<RiAddLine size={18} />}\n />\n )}\n {hasRemove && (\n <ButtonIcon\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={disabled || readonly}\n onClick={onDropIndexClick(index)}\n aria-label=\"Remove\"\n icon={<RiDeleteBinLine size={18} />}\n />\n )}\n </Flex>\n )}\n </Flex>\n </Box>\n </CardHeader>\n <DisclosurePanel>\n <CardBody>\n <Box p=\"4\">{children}</Box>\n </CardBody>\n </DisclosurePanel>\n </>\n )}\n </Disclosure>\n </Card>\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;AAyCA,SAAwB,sBAAA,CAItB;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAAwC;AACtC,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAS,IAAI,CAAA;AAEzC,EAAA,MAAM,aAAa,MAAA,EAAQ,KAAA;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EACF,CAAA;AAAA,YAED,OAAA,oBACC,GAAA;AAAA,cAAC,UAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAQ,UAAA;AAAA,gBACR,IAAA,EAAK,OAAA;AAAA,gBACL,YAAY,QAAA,IAAY,QAAA;AAAA,gBACxB,OAAA,EAAS,iBAAiB,KAAK,CAAA;AAAA,gBAC/B,YAAA,EAAW,WAAA;AAAA,gBACX,IAAA,kBAAM,GAAA,CAAC,SAAA,EAAA,EAAU,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA,aAC7B;AAAA,YAED,SAAA,oBACC,GAAA;AAAA,cAAC,UAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAQ,UAAA;AAAA,gBACR,IAAA,EAAK,OAAA;AAAA,gBACL,YAAY,QAAA,IAAY,QAAA;AAAA,gBACxB,OAAA,EAAS,iBAAiB,KAAK,CAAA;AAAA,gBAC/B,YAAA,EAAW,QAAA;AAAA,gBACX,IAAA,kBAAM,GAAA,CAAC,eAAA,EAAA,EAAgB,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA;AACnC,WAAA,EAEJ;AAAA,SAAA,EAEJ,CAAA,EACF;AAAA;AAAA,KACF;AAAA,oBACA,GAAA,CAAC,eAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,OAAI,CAAA,EAAE,GAAA,EAAK,QAAA,EAAS,CAAA,EACvB,CAAA,EACF;AAAA,GAAA,EACF,CAAA,EAEJ,GACF,CAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { getUiOptions, getTemplate } from '@rjsf/utils';
|
|
3
|
+
import { Box, Text } from '@backstage/ui';
|
|
4
|
+
|
|
5
|
+
function ArrayFieldTemplate({
|
|
6
|
+
canAdd,
|
|
7
|
+
disabled,
|
|
8
|
+
idSchema,
|
|
9
|
+
uiSchema,
|
|
10
|
+
items,
|
|
11
|
+
onAddClick,
|
|
12
|
+
readonly,
|
|
13
|
+
registry,
|
|
14
|
+
required,
|
|
15
|
+
schema,
|
|
16
|
+
title
|
|
17
|
+
}) {
|
|
18
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
19
|
+
const ArrayFieldDescriptionTemplate = getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
|
|
20
|
+
const ArrayFieldItemTemplate = getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
|
|
21
|
+
const ArrayFieldTitleTemplate = getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
|
|
22
|
+
const {
|
|
23
|
+
ButtonTemplates: { AddButton }
|
|
24
|
+
} = registry.templates;
|
|
25
|
+
const hasTitle = uiOptions.title || title;
|
|
26
|
+
const hasDescription = uiOptions.description || schema.description;
|
|
27
|
+
return /* @__PURE__ */ jsxs(Box, { mb: "4", children: [
|
|
28
|
+
hasTitle && /* @__PURE__ */ jsx(Box, { mb: "2", children: /* @__PURE__ */ jsx(
|
|
29
|
+
ArrayFieldTitleTemplate,
|
|
30
|
+
{
|
|
31
|
+
idSchema,
|
|
32
|
+
title: uiOptions.title || title,
|
|
33
|
+
required,
|
|
34
|
+
schema,
|
|
35
|
+
uiSchema,
|
|
36
|
+
registry
|
|
37
|
+
}
|
|
38
|
+
) }),
|
|
39
|
+
hasDescription && /* @__PURE__ */ jsx(Box, { mb: "2", children: /* @__PURE__ */ jsx(
|
|
40
|
+
ArrayFieldDescriptionTemplate,
|
|
41
|
+
{
|
|
42
|
+
idSchema,
|
|
43
|
+
description: uiOptions.description || schema.description,
|
|
44
|
+
schema,
|
|
45
|
+
uiSchema,
|
|
46
|
+
registry
|
|
47
|
+
}
|
|
48
|
+
) }),
|
|
49
|
+
items && items.length > 0 ? items.map(
|
|
50
|
+
({ key, ...itemProps }) => /* @__PURE__ */ jsx(ArrayFieldItemTemplate, { ...itemProps }, key)
|
|
51
|
+
) : /* @__PURE__ */ jsx(
|
|
52
|
+
Box,
|
|
53
|
+
{
|
|
54
|
+
p: "3",
|
|
55
|
+
mb: "4",
|
|
56
|
+
style: {
|
|
57
|
+
backgroundColor: "var(--bui-bg-neutral-2)",
|
|
58
|
+
borderRadius: "var(--bui-radius-2)"
|
|
59
|
+
},
|
|
60
|
+
children: /* @__PURE__ */ jsx(
|
|
61
|
+
Text,
|
|
62
|
+
{
|
|
63
|
+
variant: "body-medium",
|
|
64
|
+
color: "secondary",
|
|
65
|
+
style: { textAlign: "center" },
|
|
66
|
+
children: "No items added yet"
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
canAdd && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
72
|
+
AddButton,
|
|
73
|
+
{
|
|
74
|
+
onClick: onAddClick,
|
|
75
|
+
disabled: disabled || readonly,
|
|
76
|
+
uiSchema,
|
|
77
|
+
registry
|
|
78
|
+
}
|
|
79
|
+
) })
|
|
80
|
+
] });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { ArrayFieldTemplate as default };
|
|
84
|
+
//# sourceMappingURL=ArrayFieldTemplate.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayFieldTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ArrayFieldTemplate.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 ArrayFieldTemplateProps,\n ArrayFieldTemplateItemType,\n FormContextType,\n getTemplate,\n getUiOptions,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { Box, Text } from '@backstage/ui';\n\nexport default function ArrayFieldTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({\n canAdd,\n disabled,\n idSchema,\n uiSchema,\n items,\n onAddClick,\n readonly,\n registry,\n required,\n schema,\n title,\n}: ArrayFieldTemplateProps<T, S, F>) {\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const ArrayFieldDescriptionTemplate = getTemplate<\n 'ArrayFieldDescriptionTemplate',\n T,\n S,\n F\n >('ArrayFieldDescriptionTemplate', registry, uiOptions);\n const ArrayFieldItemTemplate = getTemplate<\n 'ArrayFieldItemTemplate',\n T,\n S,\n F\n >('ArrayFieldItemTemplate', registry, uiOptions);\n const ArrayFieldTitleTemplate = getTemplate<\n 'ArrayFieldTitleTemplate',\n T,\n S,\n F\n >('ArrayFieldTitleTemplate', registry, uiOptions);\n const {\n ButtonTemplates: { AddButton },\n } = registry.templates;\n\n const hasTitle = uiOptions.title || title;\n const hasDescription = uiOptions.description || schema.description;\n\n return (\n <Box mb=\"4\">\n {hasTitle && (\n <Box mb=\"2\">\n <ArrayFieldTitleTemplate\n idSchema={idSchema}\n title={uiOptions.title || title}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Box>\n )}\n {hasDescription && (\n <Box mb=\"2\">\n <ArrayFieldDescriptionTemplate\n idSchema={idSchema}\n description={uiOptions.description || schema.description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Box>\n )}\n {items && items.length > 0 ? (\n items.map(\n ({ key, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => (\n <ArrayFieldItemTemplate key={key} {...itemProps} />\n ),\n )\n ) : (\n <Box\n p=\"3\"\n mb=\"4\"\n style={{\n backgroundColor: 'var(--bui-bg-neutral-2)',\n borderRadius: 'var(--bui-radius-2)',\n }}\n >\n <Text\n variant=\"body-medium\"\n color=\"secondary\"\n style={{ textAlign: 'center' }}\n >\n No items added yet\n </Text>\n </Box>\n )}\n {canAdd && (\n <Box>\n <AddButton\n onClick={onAddClick}\n disabled={disabled || readonly}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Box>\n )}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;AA0BA,SAAwB,kBAAA,CAItB;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAqC;AACnC,EAAA,MAAM,SAAA,GAAY,aAAsB,QAAQ,CAAA;AAChD,EAAA,MAAM,6BAAA,GAAgC,WAAA,CAKpC,+BAAA,EAAiC,QAAA,EAAU,SAAS,CAAA;AACtD,EAAA,MAAM,sBAAA,GAAyB,WAAA,CAK7B,wBAAA,EAA0B,QAAA,EAAU,SAAS,CAAA;AAC/C,EAAA,MAAM,uBAAA,GAA0B,WAAA,CAK9B,yBAAA,EAA2B,QAAA,EAAU,SAAS,CAAA;AAChD,EAAA,MAAM;AAAA,IACJ,eAAA,EAAiB,EAAE,SAAA;AAAU,MAC3B,QAAA,CAAS,SAAA;AAEb,EAAA,MAAM,QAAA,GAAW,UAAU,KAAA,IAAS,KAAA;AACpC,EAAA,MAAM,cAAA,GAAiB,SAAA,CAAU,WAAA,IAAe,MAAA,CAAO,WAAA;AAEvD,EAAA,uBACE,IAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAG,GAAA,EACL,QAAA,EAAA;AAAA,IAAA,QAAA,oBACC,GAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAG,GAAA,EACN,QAAA,kBAAA,GAAA;AAAA,MAAC,uBAAA;AAAA,MAAA;AAAA,QACC,QAAA;AAAA,QACA,KAAA,EAAO,UAAU,KAAA,IAAS,KAAA;AAAA,QA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
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { titleId } from '@rjsf/utils';
|
|
3
|
+
import { Text } from '@backstage/ui';
|
|
4
|
+
|
|
5
|
+
function ArrayFieldTitleTemplate({ idSchema, title, required }) {
|
|
6
|
+
if (!title) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const id = titleId(idSchema);
|
|
10
|
+
return /* @__PURE__ */ jsxs(Text, { id, as: "h3", variant: "title-medium", weight: "bold", children: [
|
|
11
|
+
title,
|
|
12
|
+
required && /* @__PURE__ */ jsxs(Text, { as: "span", color: "danger", children: [
|
|
13
|
+
" ",
|
|
14
|
+
"*"
|
|
15
|
+
] })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { ArrayFieldTitleTemplate as default };
|
|
20
|
+
//# sourceMappingURL=ArrayFieldTitleTemplate.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayFieldTitleTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ArrayFieldTitleTemplate.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 ArrayFieldTitleProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n titleId,\n} from '@rjsf/utils';\nimport { Text } from '@backstage/ui';\n\nexport default function ArrayFieldTitleTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({ idSchema, title, required }: ArrayFieldTitleProps<T, S, F>) {\n if (!title) {\n return null;\n }\n\n const id = titleId<T>(idSchema);\n\n return (\n <Text id={id} as=\"h3\" variant=\"title-medium\" weight=\"bold\">\n {title}\n {required && (\n <Text as=\"span\" color=\"danger\">\n {' '}\n *\n </Text>\n )}\n </Text>\n );\n}\n"],"names":[],"mappings":";;;;AAwBA,SAAwB,uBAAA,CAItB,EAAE,QAAA,EAAU,KAAA,EAAO,UAAS,EAAkC;AAC9D,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,EAAA,GAAK,QAAW,QAAQ,CAAA;AAE9B,EAAA,uBACE,IAAA,CAAC,QAAK,EAAA,EAAQ,EAAA,EAAG,MAAK,OAAA,EAAQ,cAAA,EAAe,QAAO,MAAA,EACjD,QAAA,EAAA;AAAA,IAAA,KAAA;AAAA,IACA,4BACC,IAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAG,MAAA,EAAO,OAAM,QAAA,EACnB,QAAA,EAAA;AAAA,MAAA,GAAA;AAAA,MAAI;AAAA,KAAA,EAEP;AAAA,GAAA,EAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { TranslatableString, getSubmitButtonOptions } from '@rjsf/utils';
|
|
3
|
+
import { Button } from '@backstage/ui';
|
|
4
|
+
import { RiAddLine, RiFileCopyLine, RiDeleteBinLine, RiArrowDownLine, RiArrowUpLine } from '@remixicon/react';
|
|
5
|
+
|
|
6
|
+
function SubmitButton({ uiSchema }) {
|
|
7
|
+
const {
|
|
8
|
+
submitText,
|
|
9
|
+
norender,
|
|
10
|
+
props: submitButtonProps = {}
|
|
11
|
+
} = getSubmitButtonOptions(uiSchema);
|
|
12
|
+
if (norender) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ jsx(Button, { type: "submit", variant: "primary", ...submitButtonProps, children: submitText });
|
|
16
|
+
}
|
|
17
|
+
function AddButton({ registry, disabled, onClick, className }) {
|
|
18
|
+
const { translateString } = registry;
|
|
19
|
+
const handleClick = onClick ? (e) => onClick(e) : void 0;
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
Button,
|
|
22
|
+
{
|
|
23
|
+
isDisabled: disabled,
|
|
24
|
+
onClick: handleClick,
|
|
25
|
+
className,
|
|
26
|
+
variant: "secondary",
|
|
27
|
+
size: "small",
|
|
28
|
+
iconStart: /* @__PURE__ */ jsx(RiAddLine, {}),
|
|
29
|
+
children: translateString(TranslatableString.AddItemButton)
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function IconButton(props) {
|
|
34
|
+
const { icon, registry, disabled, onClick, className } = props;
|
|
35
|
+
const { translateString } = registry;
|
|
36
|
+
let buttonIcon;
|
|
37
|
+
let buttonLabel;
|
|
38
|
+
switch (icon) {
|
|
39
|
+
case "arrow-up":
|
|
40
|
+
buttonIcon = /* @__PURE__ */ jsx(RiArrowUpLine, {});
|
|
41
|
+
buttonLabel = translateString(TranslatableString.MoveUpButton);
|
|
42
|
+
break;
|
|
43
|
+
case "arrow-down":
|
|
44
|
+
buttonIcon = /* @__PURE__ */ jsx(RiArrowDownLine, {});
|
|
45
|
+
buttonLabel = translateString(TranslatableString.MoveDownButton);
|
|
46
|
+
break;
|
|
47
|
+
case "remove":
|
|
48
|
+
buttonIcon = /* @__PURE__ */ jsx(RiDeleteBinLine, {});
|
|
49
|
+
buttonLabel = translateString(TranslatableString.RemoveButton);
|
|
50
|
+
break;
|
|
51
|
+
case "copy":
|
|
52
|
+
buttonIcon = /* @__PURE__ */ jsx(RiFileCopyLine, {});
|
|
53
|
+
buttonLabel = translateString(TranslatableString.CopyButton);
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
buttonIcon = null;
|
|
57
|
+
buttonLabel = "";
|
|
58
|
+
}
|
|
59
|
+
const handleClick = onClick ? () => onClick(void 0) : void 0;
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
Button,
|
|
62
|
+
{
|
|
63
|
+
isDisabled: disabled,
|
|
64
|
+
onClick: handleClick,
|
|
65
|
+
className,
|
|
66
|
+
variant: "tertiary",
|
|
67
|
+
size: "small",
|
|
68
|
+
iconStart: buttonIcon || void 0,
|
|
69
|
+
children: buttonLabel
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const ButtonTemplates = {
|
|
74
|
+
SubmitButton,
|
|
75
|
+
AddButton,
|
|
76
|
+
RemoveButton: IconButton,
|
|
77
|
+
MoveDownButton: IconButton,
|
|
78
|
+
MoveUpButton: IconButton,
|
|
79
|
+
CopyButton: IconButton
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { AddButton, IconButton, SubmitButton, ButtonTemplates as default };
|
|
83
|
+
//# sourceMappingURL=ButtonTemplates.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonTemplates.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/ButtonTemplates.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 IconButtonProps,\n RJSFSchema,\n StrictRJSFSchema,\n SubmitButtonProps,\n TranslatableString,\n getSubmitButtonOptions,\n} from '@rjsf/utils';\nimport { Button } from '@backstage/ui';\nimport {\n RiAddLine,\n RiArrowUpLine,\n RiArrowDownLine,\n RiDeleteBinLine,\n RiFileCopyLine,\n} from '@remixicon/react';\n\nexport function SubmitButton<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({ uiSchema }: SubmitButtonProps<T, S, F>) {\n const {\n submitText,\n norender,\n props: submitButtonProps = {},\n } = getSubmitButtonOptions<T, S, F>(uiSchema);\n\n if (norender) {\n return null;\n }\n\n return (\n <Button type=\"submit\" variant=\"primary\" {...submitButtonProps}>\n {submitText}\n </Button>\n );\n}\n\nexport function AddButton<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({ registry, disabled, onClick, className }: IconButtonProps<T, S, F>) {\n const { translateString } = registry;\n\n const handleClick = onClick ? (e: any) => onClick(e) : undefined;\n\n return (\n <Button\n isDisabled={disabled}\n onClick={handleClick}\n className={className}\n variant=\"secondary\"\n size=\"small\"\n iconStart={<RiAddLine />}\n >\n {translateString(TranslatableString.AddItemButton)}\n </Button>\n );\n}\n\nexport function IconButton<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: IconButtonProps<T, S, F>) {\n const { icon, registry, disabled, onClick, className } = props;\n const { translateString } = registry;\n\n let buttonIcon;\n let buttonLabel;\n\n switch (icon) {\n case 'arrow-up':\n buttonIcon = <RiArrowUpLine />;\n buttonLabel = translateString(TranslatableString.MoveUpButton);\n break;\n case 'arrow-down':\n buttonIcon = <RiArrowDownLine />;\n buttonLabel = translateString(TranslatableString.MoveDownButton);\n break;\n case 'remove':\n buttonIcon = <RiDeleteBinLine />;\n buttonLabel = translateString(TranslatableString.RemoveButton);\n break;\n case 'copy':\n buttonIcon = <RiFileCopyLine />;\n buttonLabel = translateString(TranslatableString.CopyButton);\n break;\n default:\n buttonIcon = null;\n buttonLabel = '';\n }\n\n const handleClick = onClick ? () => onClick(undefined as any) : undefined;\n\n return (\n <Button\n isDisabled={disabled}\n onClick={handleClick}\n className={className}\n variant=\"tertiary\"\n size=\"small\"\n iconStart={buttonIcon || undefined}\n >\n {buttonLabel}\n </Button>\n );\n}\n\nconst ButtonTemplates = {\n SubmitButton,\n AddButton,\n RemoveButton: IconButton,\n MoveDownButton: IconButton,\n MoveUpButton: IconButton,\n CopyButton: IconButton,\n};\n\nexport default ButtonTemplates;\n"],"names":[],"mappings":";;;;;AAiCO,SAAS,YAAA,CAId,EAAE,QAAA,EAAS,EAA+B;AAC1C,EAAA,MAAM;AAAA,IACJ,UAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA,EAAO,oBAAoB;AAAC,GAC9B,GAAI,uBAAgC,QAAQ,CAAA;AAE5C,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,uBACE,GAAA,CAAC,UAAO,IAAA,EAAK,QAAA,EAAS,SAAQ,SAAA,EAAW,GAAG,mBACzC,QAAA,EAAA,UAAA,EACH,CAAA;AAEJ;AAEO,SAAS,UAId,EAAE,QAAA,EAAU,QAAA,EAAU,OAAA,EAAS,WAAU,EAA6B;AACtE,EAAA,MAAM,EAAE,iBAAgB,GAAI,QAAA;AAE5B,EAAA,MAAM,cAAc,OAAA,GAAU,CAAC,CAAA,KAAW,OAAA,CAAQ,CAAC,CAAA,GAAI,MAAA;AAEvD,EAAA,uBACE,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,UAAA,EAAY,QAAA;AAAA,MACZ,OAAA,EAAS,WAAA;AAAA,MACT,SAAA;AAAA,MACA,OAAA,EAAQ,WAAA;AAAA,MACR,IAAA,EAAK,OAAA;AAAA,MACL,SAAA,sBAAY,SAAA,EAAA,EAAU,CAAA;AAAA,MAErB,QAAA,EAAA,eAAA,CAAgB,mBAAmB,aAAa;AAAA;AAAA,GACnD;AAEJ;AAEO,SAAS,WAId,KAAA,EAAiC;AACjC,EAAA,MAAM,EAAE,IAAA,EAAM,QAAA,EAAU,QAAA,EAAU,OAAA,EAAS,WAAU,GAAI,KAAA;AACzD,EAAA,MAAM,EAAE,iBAAgB,GAAI,QAAA;AAE5B,EAAA,IAAI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AA,EAAY;AACd;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { isValidElement } from 'react';
|
|
3
|
+
import { MarkdownContent } from '@backstage/core-components';
|
|
4
|
+
|
|
5
|
+
function DescriptionFieldTemplate({ id, description }) {
|
|
6
|
+
if (!description) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return /* @__PURE__ */ jsx("div", { id, children: isValidElement(description) ? description : /* @__PURE__ */ jsx(
|
|
10
|
+
MarkdownContent,
|
|
11
|
+
{
|
|
12
|
+
content: description,
|
|
13
|
+
linkTarget: "_blank"
|
|
14
|
+
}
|
|
15
|
+
) });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { DescriptionFieldTemplate as default };
|
|
19
|
+
//# sourceMappingURL=DescriptionFieldTemplate.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescriptionFieldTemplate.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/templates/DescriptionFieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { isValidElement } from 'react';\nimport {\n DescriptionFieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { MarkdownContent } from '@backstage/core-components';\n\nexport default function DescriptionFieldTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({ id, description }: DescriptionFieldProps<T, S, F>) {\n if (!description) {\n return null;\n }\n\n return (\n <div id={id}>\n {isValidElement(description) ? (\n description\n ) : (\n <MarkdownContent\n content={description as string}\n linkTarget=\"_blank\"\n />\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;AAwBA,SAAwB,wBAAA,CAItB,EAAE,EAAA,EAAI,WAAA,EAAY,EAAmC;AACrD,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,2BACG,KAAA,EAAA,EAAI,EAAA,EACF,QAAA,EAAA,cAAA,CAAe,WAAW,IACzB,WAAA,mBAEA,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,WAAA;AAAA,MACT,UAAA,EAAW;AAAA;AAAA,GACb,EAEJ,CAAA;AAEJ;;;;"}
|