@backstage/plugin-scaffolder-react 2.1.0-next.1 → 2.1.1-next.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 +37 -0
- package/dist/alpha.esm.js.map +1 -1
- package/dist/api/ref.esm.js.map +1 -1
- package/dist/extensions/createScaffolderFieldExtension.esm.js.map +1 -1
- package/dist/extensions/keys.esm.js.map +1 -1
- package/dist/hooks/useCustomFieldExtensions.esm.js.map +1 -1
- package/dist/hooks/useCustomLayouts.esm.js.map +1 -1
- package/dist/hooks/useEventStream.esm.js +132 -67
- package/dist/hooks/useEventStream.esm.js.map +1 -1
- package/dist/layouts/createScaffolderLayout.esm.js.map +1 -1
- package/dist/layouts/keys.esm.js.map +1 -1
- package/dist/next/api/index.esm.js.map +1 -1
- package/dist/next/blueprints/FormDecoratorBlueprint.esm.js.map +1 -1
- package/dist/next/blueprints/FormFieldBlueprint.esm.js.map +1 -1
- package/dist/next/blueprints/scaffolderTaskOutputsBlueprint.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/Form.module.css.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/index.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldDescriptionTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldItemTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/ArrayFieldTitleTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/ButtonTemplates.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/DescriptionFieldTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/ErrorListTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/FieldErrorTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/FieldHelpTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/FieldTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/ObjectFieldTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/TitleFieldTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/UnsupportedFieldTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/WrapIfAdditionalTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/templates/index.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/BaseInputTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/CheckboxWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/CheckboxesWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/ColorWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/DateInput.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/DateTimeWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/DateWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/EmailWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/FileWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/HiddenWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/PasswordWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/RadioWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/RangeWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/SelectWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/TextWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/TextareaWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/TimeWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/URLWidget.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/index.esm.js.map +1 -1
- package/dist/next/components/Form/BuiTheme/widgets/selectOverrides.module.css.esm.js.map +1 -1
- package/dist/next/components/Form/DescriptionFieldTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/FieldTemplate.esm.js.map +1 -1
- package/dist/next/components/Form/Form.esm.js.map +1 -1
- package/dist/next/components/Form/ScaffolderThemeContext.esm.js.map +1 -1
- package/dist/next/components/PasswordWidget/PasswordWidget.esm.js.map +1 -1
- package/dist/next/components/ReviewState/ReviewState.esm.js +1 -1
- package/dist/next/components/ReviewState/ReviewState.esm.js.map +1 -1
- package/dist/next/components/ReviewState/util.esm.js.map +1 -1
- package/dist/next/components/ScaffolderField/ScaffolderField.esm.js.map +1 -1
- package/dist/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.esm.js.map +1 -1
- package/dist/next/components/SecretWidget/SecretWidget.esm.js.map +1 -1
- package/dist/next/components/Stepper/ErrorListTemplate/errorListTemplate.esm.js.map +1 -1
- package/dist/next/components/Stepper/FieldOverrides/DescriptionField.esm.js.map +1 -1
- package/dist/next/components/Stepper/Stepper.esm.js.map +1 -1
- package/dist/next/components/Stepper/createAsyncValidators.esm.js.map +1 -1
- package/dist/next/components/Stepper/utils.esm.js.map +1 -1
- package/dist/next/components/TaskLogStream/TaskLogStream.esm.js.map +1 -1
- package/dist/next/components/TaskSteps/StepIcon.esm.js.map +1 -1
- package/dist/next/components/TaskSteps/StepTime.esm.js.map +1 -1
- package/dist/next/components/TaskSteps/TaskBorder.esm.js.map +1 -1
- package/dist/next/components/TaskSteps/TaskSteps.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/CardHeader.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/CardLink.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/TemplateCard.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/TemplateCardActions.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/TemplateCardContent.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/TemplateCardImpl.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/TemplateCardLinks.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/TemplateCardTags.esm.js.map +1 -1
- package/dist/next/components/TemplateCard/TemplateDetailButton.esm.js.map +1 -1
- package/dist/next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js.map +1 -1
- package/dist/next/components/TemplateGroup/TemplateGroup.esm.js.map +1 -1
- package/dist/next/components/TemplateGroups/TemplateGroups.esm.js.map +1 -1
- package/dist/next/components/TemplateOutputs/DefaultTemplateOutputs.esm.js.map +1 -1
- package/dist/next/components/TemplateOutputs/LinkOutputs.esm.js.map +1 -1
- package/dist/next/components/TemplateOutputs/TextOutputs.esm.js.map +1 -1
- package/dist/next/components/Workflow/Workflow.esm.js.map +1 -1
- package/dist/next/extensions/createScaffolderFormDecorator.esm.js.map +1 -1
- package/dist/next/hooks/useDownloadLogs.esm.js.map +1 -1
- package/dist/next/hooks/useFilteredSchemaProperties.esm.js.map +1 -1
- package/dist/next/hooks/useFormDataFromQuery.esm.js.map +1 -1
- package/dist/next/hooks/useTemplateParameterSchema.esm.js.map +1 -1
- package/dist/next/hooks/useTemplateSchema.esm.js.map +1 -1
- package/dist/next/hooks/useTemplateTimeSaved.esm.js.map +1 -1
- package/dist/next/hooks/useTransformSchemaToProps.esm.js.map +1 -1
- package/dist/next/lib/schema.esm.js.map +1 -1
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -1
- package/dist/packages/opaque-internal/src/OpaqueType.esm.js.map +1 -1
- package/dist/packages/scaffolder-internal/src/wiring/InternalFormDecorator.esm.js.map +1 -1
- package/dist/packages/scaffolder-internal/src/wiring/InternalFormField.esm.js.map +1 -1
- package/dist/secrets/SecretsContext.esm.js.map +1 -1
- package/dist/testUtils/scaffolderApiMock.esm.js.map +1 -1
- package/dist/translation.esm.js.map +1 -1
- package/dist/utils.esm.js.map +1 -1
- package/package.json +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/index.ts"],"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 RegistryWidgetsType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\nimport BaseInputTemplate from './BaseInputTemplate';\nimport CheckboxWidget from './CheckboxWidget';\nimport CheckboxesWidget from './CheckboxesWidget';\nimport ColorWidget from './ColorWidget';\nimport DateWidget from './DateWidget';\nimport DateTimeWidget from './DateTimeWidget';\nimport EmailWidget from './EmailWidget';\nimport FileWidget from './FileWidget';\nimport HiddenWidget from './HiddenWidget';\nimport PasswordWidget from './PasswordWidget';\nimport RadioWidget from './RadioWidget';\nimport RangeWidget from './RangeWidget';\nimport SelectWidget from './SelectWidget';\nimport TextareaWidget from './TextareaWidget';\nimport TextWidget from './TextWidget';\nimport TimeWidget from './TimeWidget';\nimport URLWidget from './URLWidget';\n\nexport function generateBuiWidgets<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(): RegistryWidgetsType<T, S, F> {\n return {\n BaseInput: BaseInputTemplate,\n CheckboxWidget,\n CheckboxesWidget,\n ColorWidget,\n DateWidget,\n DateTimeWidget,\n EmailWidget,\n FileWidget,\n HiddenWidget,\n PasswordWidget,\n RadioWidget,\n RangeWidget,\n SelectWidget,\n TextareaWidget,\n TextWidget,\n TimeWidget,\n URLWidget,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAwCO,SAAS,kBAAA,GAIkB;AAChC,EAAA,OAAO;AAAA,IACL,SAAA,EAAW,iBAAA;AAAA,IACX,cAAA;AAAA,IACA,gBAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,cAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF;AACF
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../../src/next/components/Form/BuiTheme/widgets/index.ts"],"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 RegistryWidgetsType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\nimport BaseInputTemplate from './BaseInputTemplate';\nimport CheckboxWidget from './CheckboxWidget';\nimport CheckboxesWidget from './CheckboxesWidget';\nimport ColorWidget from './ColorWidget';\nimport DateWidget from './DateWidget';\nimport DateTimeWidget from './DateTimeWidget';\nimport EmailWidget from './EmailWidget';\nimport FileWidget from './FileWidget';\nimport HiddenWidget from './HiddenWidget';\nimport PasswordWidget from './PasswordWidget';\nimport RadioWidget from './RadioWidget';\nimport RangeWidget from './RangeWidget';\nimport SelectWidget from './SelectWidget';\nimport TextareaWidget from './TextareaWidget';\nimport TextWidget from './TextWidget';\nimport TimeWidget from './TimeWidget';\nimport URLWidget from './URLWidget';\n\nexport function generateBuiWidgets<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(): RegistryWidgetsType<T, S, F> {\n return {\n BaseInput: BaseInputTemplate,\n CheckboxWidget,\n CheckboxesWidget,\n ColorWidget,\n DateWidget,\n DateTimeWidget,\n EmailWidget,\n FileWidget,\n HiddenWidget,\n PasswordWidget,\n RadioWidget,\n RangeWidget,\n SelectWidget,\n TextareaWidget,\n TextWidget,\n TimeWidget,\n URLWidget,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAwCO,SAAS,kBAAA,GAIkB;AAChC,EAAA,OAAO;AAAA,IACL,SAAA,EAAW,iBAAA;AAAA,IACX,cAAA;AAAA,IACA,gBAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,cAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectOverrides.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"selectOverrides.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionFieldTemplate.esm.js","sources":["../../../../src/next/components/Form/DescriptionFieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { MarkdownContent } from '@backstage/core-components';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n DescriptionFieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\n/** The `DescriptionField` is the template to use to render the description of a field\n * @alpha\n * @param props - The `DescriptionFieldProps` for this component\n */\nexport const DescriptionFieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: DescriptionFieldProps<T, S, F>,\n) => {\n const { id, description } = props;\n const classes = useStyles();\n\n if (description) {\n if (typeof description === 'string') {\n return (\n <MarkdownContent\n content={description}\n linkTarget=\"_blank\"\n className={classes.markdownDescription}\n />\n );\n }\n\n return (\n <Typography id={id} variant=\"subtitle2\" style={{ marginTop: '5px' }}>\n {description}\n </Typography>\n );\n }\n\n return null;\n};\n"],"names":[],"mappings":";;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,mBAAA,EAAqB;AAAA,IACnB,QAAA,EAAU,KAAA,CAAM,UAAA,CAAW,OAAA,CAAQ,QAAA;AAAA,IACnC,MAAA,EAAQ,CAAA;AAAA,IACR,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,SAAA;AAAA,IAC1B,gBAAA,EAAkB;AAAA,MAChB,MAAA,EAAQ,CAAA;AAAA,MACR,SAAA,EAAW;AAAA;AAAA;AACb;AAEJ,CAAA,CAAE,CAAA;AAMK,MAAM,wBAAA,GAA2B,CAKtC,KAAA,KACG;AACH,EAAA,MAAM,EAAE,EAAA,EAAI,WAAA,EAAY,GAAI,KAAA;AAC5B,EAAA,MAAM,UAAU,SAAA,EAAU;AAE1B,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAI,OAAO,gBAAgB,QAAA,EAAU;AACnC,MAAA,uBACE,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAS,WAAA;AAAA,UACT,UAAA,EAAW,QAAA;AAAA,UACX,WAAW,OAAA,CAAQ;AAAA;AAAA,OACrB;AAAA,IAEJ;AAEA,IAAA,uBACE,GAAA,CAAC,UAAA,EAAA,EAAW,EAAA,EAAQ,OAAA,EAAQ,WAAA,EAAY,OAAO,EAAE,SAAA,EAAW,KAAA,EAAM,EAC/D,QAAA,EAAA,WAAA,EACH,CAAA;AAAA,EAEJ;AAEA,EAAA,OAAO,IAAA;AACT
|
|
1
|
+
{"version":3,"file":"DescriptionFieldTemplate.esm.js","sources":["../../../../src/next/components/Form/DescriptionFieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { MarkdownContent } from '@backstage/core-components';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n DescriptionFieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\n/** The `DescriptionField` is the template to use to render the description of a field\n * @alpha\n * @param props - The `DescriptionFieldProps` for this component\n */\nexport const DescriptionFieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: DescriptionFieldProps<T, S, F>,\n) => {\n const { id, description } = props;\n const classes = useStyles();\n\n if (description) {\n if (typeof description === 'string') {\n return (\n <MarkdownContent\n content={description}\n linkTarget=\"_blank\"\n className={classes.markdownDescription}\n />\n );\n }\n\n return (\n <Typography id={id} variant=\"subtitle2\" style={{ marginTop: '5px' }}>\n {description}\n </Typography>\n );\n }\n\n return null;\n};\n"],"names":[],"mappings":";;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,mBAAA,EAAqB;AAAA,IACnB,QAAA,EAAU,KAAA,CAAM,UAAA,CAAW,OAAA,CAAQ,QAAA;AAAA,IACnC,MAAA,EAAQ,CAAA;AAAA,IACR,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,SAAA;AAAA,IAC1B,gBAAA,EAAkB;AAAA,MAChB,MAAA,EAAQ,CAAA;AAAA,MACR,SAAA,EAAW;AAAA;AAAA;AACb;AAEJ,CAAA,CAAE,CAAA;AAMK,MAAM,wBAAA,GAA2B,CAKtC,KAAA,KACG;AACH,EAAA,MAAM,EAAE,EAAA,EAAI,WAAA,EAAY,GAAI,KAAA;AAC5B,EAAA,MAAM,UAAU,SAAA,EAAU;AAE1B,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAI,OAAO,gBAAgB,QAAA,EAAU;AACnC,MAAA,uBACE,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAS,WAAA;AAAA,UACT,UAAA,EAAW,QAAA;AAAA,UACX,WAAW,OAAA,CAAQ;AAAA;AAAA,OACrB;AAAA,IAEJ;AAEA,IAAA,uBACE,GAAA,CAAC,UAAA,EAAA,EAAW,EAAA,EAAQ,OAAA,EAAQ,WAAA,EAAY,OAAO,EAAE,SAAA,EAAW,KAAA,EAAM,EAC/D,QAAA,EAAA,WAAA,EACH,CAAA;AAAA,EAEJ;AAEA,EAAA,OAAO,IAAA;AACT;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldTemplate.esm.js","sources":["../../../../src/next/components/Form/FieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 FieldTemplateProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n getTemplate,\n getUiOptions,\n} from '@rjsf/utils';\n\nimport { ScaffolderField } from '../ScaffolderField';\n\n/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field\n * content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.\n * @alpha\n * @param props - The `FieldTemplateProps` for this component\n */\nexport const FieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: FieldTemplateProps<T, S, F>,\n) => {\n const {\n id,\n children,\n classNames,\n style,\n disabled,\n displayLabel,\n hidden,\n label,\n onDropPropertyClick,\n onKeyChange,\n readonly,\n required,\n rawErrors = [],\n errors,\n help,\n rawDescription,\n schema,\n uiSchema,\n registry,\n } = props;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const WrapIfAdditionalTemplate = getTemplate<\n 'WrapIfAdditionalTemplate',\n T,\n S,\n F\n >('WrapIfAdditionalTemplate', registry, uiOptions);\n\n if (hidden) {\n return <div style={{ display: 'none' }}>{children}</div>;\n }\n return (\n <WrapIfAdditionalTemplate\n classNames={classNames}\n style={style}\n disabled={disabled}\n id={id}\n label={label}\n onDropPropertyClick={onDropPropertyClick}\n onKeyChange={onKeyChange}\n readonly={readonly}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n >\n <ScaffolderField\n displayLabel={displayLabel}\n rawErrors={rawErrors}\n help={help}\n disabled={disabled}\n rawDescription={rawDescription}\n errors={errors}\n required={required}\n >\n {children}\n </ScaffolderField>\n </WrapIfAdditionalTemplate>\n );\n};\n"],"names":[],"mappings":";;;;AA+BO,MAAM,aAAA,GAAgB,CAK3B,KAAA,KACG;AACH,EAAA,MAAM;AAAA,IACJ,EAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,mBAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAY,EAAC;AAAA,IACb,MAAA;AAAA,IACA,IAAA;AAAA,IACA,cAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,MAAM,SAAA,GAAY,aAAsB,QAAQ,CAAA;AAChD,EAAA,MAAM,wBAAA,GAA2B,WAAA,CAK/B,0BAAA,EAA4B,QAAA,EAAU,SAAS,CAAA;AAEjD,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,2BAAQ,KAAA,EAAA,EAAI,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,IAAW,QAAA,EAAS,CAAA;AAAA,EACpD;AACA,EAAA,uBACE,GAAA;AAAA,IAAC,wBAAA;AAAA,IAAA;AAAA,MACC,UAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,EAAA;AAAA,MACA,KAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,YAAA;AAAA,UACA,SAAA;AAAA,UACA,IAAA;AAAA,UACA,QAAA;AAAA,UACA,cAAA;AAAA,UACA,MAAA;AAAA,UACA,QAAA;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF;AAEJ
|
|
1
|
+
{"version":3,"file":"FieldTemplate.esm.js","sources":["../../../../src/next/components/Form/FieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 FieldTemplateProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n getTemplate,\n getUiOptions,\n} from '@rjsf/utils';\n\nimport { ScaffolderField } from '../ScaffolderField';\n\n/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field\n * content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.\n * @alpha\n * @param props - The `FieldTemplateProps` for this component\n */\nexport const FieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: FieldTemplateProps<T, S, F>,\n) => {\n const {\n id,\n children,\n classNames,\n style,\n disabled,\n displayLabel,\n hidden,\n label,\n onDropPropertyClick,\n onKeyChange,\n readonly,\n required,\n rawErrors = [],\n errors,\n help,\n rawDescription,\n schema,\n uiSchema,\n registry,\n } = props;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const WrapIfAdditionalTemplate = getTemplate<\n 'WrapIfAdditionalTemplate',\n T,\n S,\n F\n >('WrapIfAdditionalTemplate', registry, uiOptions);\n\n if (hidden) {\n return <div style={{ display: 'none' }}>{children}</div>;\n }\n return (\n <WrapIfAdditionalTemplate\n classNames={classNames}\n style={style}\n disabled={disabled}\n id={id}\n label={label}\n onDropPropertyClick={onDropPropertyClick}\n onKeyChange={onKeyChange}\n readonly={readonly}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n >\n <ScaffolderField\n displayLabel={displayLabel}\n rawErrors={rawErrors}\n help={help}\n disabled={disabled}\n rawDescription={rawDescription}\n errors={errors}\n required={required}\n >\n {children}\n </ScaffolderField>\n </WrapIfAdditionalTemplate>\n );\n};\n"],"names":[],"mappings":";;;;AA+BO,MAAM,aAAA,GAAgB,CAK3B,KAAA,KACG;AACH,EAAA,MAAM;AAAA,IACJ,EAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,mBAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAY,EAAC;AAAA,IACb,MAAA;AAAA,IACA,IAAA;AAAA,IACA,cAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,MAAM,SAAA,GAAY,aAAsB,QAAQ,CAAA;AAChD,EAAA,MAAM,wBAAA,GAA2B,WAAA,CAK/B,0BAAA,EAA4B,QAAA,EAAU,SAAS,CAAA;AAEjD,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,2BAAQ,KAAA,EAAA,EAAI,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,IAAW,QAAA,EAAS,CAAA;AAAA,EACpD;AACA,EAAA,uBACE,GAAA;AAAA,IAAC,wBAAA;AAAA,IAAA;AAAA,MACC,UAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,EAAA;AAAA,MACA,KAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,YAAA;AAAA,UACA,SAAA;AAAA,UACA,IAAA;AAAA,UACA,QAAA;AAAA,UACA,cAAA;AAAA,UACA,MAAA;AAAA,UACA,QAAA;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.esm.js","sources":["../../../../src/next/components/Form/Form.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 */\n\nimport { withTheme } from '@rjsf/core';\nimport { useMemo, PropsWithChildren } from 'react';\nimport { FieldTemplate } from './FieldTemplate';\nimport { DescriptionFieldTemplate } from './DescriptionFieldTemplate';\nimport { FieldProps } from '@rjsf/utils';\nimport {\n ScaffolderRJSFFormProps,\n type FormProps,\n} from '@backstage/plugin-scaffolder-react';\nimport { Theme as MuiTheme } from '@rjsf/material-ui';\nimport { generateBuiTheme } from './BuiTheme';\nimport {\n ScaffolderThemeProvider,\n type ScaffolderTheme,\n} from './ScaffolderThemeContext';\nimport styles from './BuiTheme/Form.module.css';\n\nconst MuiForm = withTheme(MuiTheme);\nconst BuiForm = withTheme(generateBuiTheme());\n\n/**\n * The Form component\n * @alpha\n */\nexport const Form = (\n props: PropsWithChildren<\n ScaffolderRJSFFormProps & Pick<FormProps, 'EXPERIMENTAL_theme'>\n >,\n) => {\n const { EXPERIMENTAL_theme: themeProp, ...formProps } = props;\n const theme: ScaffolderTheme = themeProp ?? 'mui';\n const WrappedForm = theme === 'bui' ? BuiForm : MuiForm;\n\n // This is where we unbreak the changes from RJSF, and make it work with our custom fields so we don't pass on this\n // breaking change to our users. We will look more into a better API for this in scaffolderv2.\n const wrappedFields = useMemo(\n () =>\n Object.fromEntries(\n Object.entries(formProps.fields ?? {}).map(([key, Component]) => [\n key,\n (wrapperProps: FieldProps) => {\n return (\n <Component\n {...wrapperProps}\n uiSchema={wrapperProps.uiSchema ?? {}}\n formData={wrapperProps.formData}\n rawErrors={wrapperProps.rawErrors ?? []}\n disabled={wrapperProps.disabled ?? false}\n readonly={wrapperProps.readonly ?? false}\n />\n );\n },\n ]),\n ),\n [formProps.fields],\n );\n\n const templates = useMemo(\n () =>\n theme === 'bui'\n ? formProps.templates ?? {}\n : {\n FieldTemplate,\n DescriptionFieldTemplate,\n ...formProps.templates,\n },\n [formProps.templates, theme],\n );\n\n const form = (\n <WrappedForm {...formProps} templates={templates} fields={wrappedFields} />\n );\n\n return (\n <ScaffolderThemeProvider value={theme}>\n {theme === 'bui' ? <div className={styles.form}>{form}</div> : form}\n </ScaffolderThemeProvider>\n );\n};\n"],"names":["MuiTheme"],"mappings":";;;;;;;;;;AAiCA,MAAM,OAAA,GAAU,UAAUA,KAAQ,CAAA;AAClC,MAAM,OAAA,GAAU,SAAA,CAAU,gBAAA,EAAkB,CAAA;AAMrC,MAAM,IAAA,GAAO,CAClB,KAAA,KAGG;AACH,EAAA,MAAM,EAAE,kBAAA,EAAoB,SAAA,EAAW,GAAG,WAAU,GAAI,KAAA;AACxD,EAAA,MAAM,QAAyB,SAAA,IAAa,KAAA;AAC5C,EAAA,MAAM,WAAA,GAAc,KAAA,KAAU,KAAA,GAAQ,OAAA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,EAAK,IAAS,IAAA,EACjE,CAAA;AAEJ
|
|
1
|
+
{"version":3,"file":"Form.esm.js","sources":["../../../../src/next/components/Form/Form.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 */\n\nimport { withTheme } from '@rjsf/core';\nimport { useMemo, PropsWithChildren } from 'react';\nimport { FieldTemplate } from './FieldTemplate';\nimport { DescriptionFieldTemplate } from './DescriptionFieldTemplate';\nimport { FieldProps } from '@rjsf/utils';\nimport {\n ScaffolderRJSFFormProps,\n type FormProps,\n} from '@backstage/plugin-scaffolder-react';\nimport { Theme as MuiTheme } from '@rjsf/material-ui';\nimport { generateBuiTheme } from './BuiTheme';\nimport {\n ScaffolderThemeProvider,\n type ScaffolderTheme,\n} from './ScaffolderThemeContext';\nimport styles from './BuiTheme/Form.module.css';\n\nconst MuiForm = withTheme(MuiTheme);\nconst BuiForm = withTheme(generateBuiTheme());\n\n/**\n * The Form component\n * @alpha\n */\nexport const Form = (\n props: PropsWithChildren<\n ScaffolderRJSFFormProps & Pick<FormProps, 'EXPERIMENTAL_theme'>\n >,\n) => {\n const { EXPERIMENTAL_theme: themeProp, ...formProps } = props;\n const theme: ScaffolderTheme = themeProp ?? 'mui';\n const WrappedForm = theme === 'bui' ? BuiForm : MuiForm;\n\n // This is where we unbreak the changes from RJSF, and make it work with our custom fields so we don't pass on this\n // breaking change to our users. We will look more into a better API for this in scaffolderv2.\n const wrappedFields = useMemo(\n () =>\n Object.fromEntries(\n Object.entries(formProps.fields ?? {}).map(([key, Component]) => [\n key,\n (wrapperProps: FieldProps) => {\n return (\n <Component\n {...wrapperProps}\n uiSchema={wrapperProps.uiSchema ?? {}}\n formData={wrapperProps.formData}\n rawErrors={wrapperProps.rawErrors ?? []}\n disabled={wrapperProps.disabled ?? false}\n readonly={wrapperProps.readonly ?? false}\n />\n );\n },\n ]),\n ),\n [formProps.fields],\n );\n\n const templates = useMemo(\n () =>\n theme === 'bui'\n ? formProps.templates ?? {}\n : {\n FieldTemplate,\n DescriptionFieldTemplate,\n ...formProps.templates,\n },\n [formProps.templates, theme],\n );\n\n const form = (\n <WrappedForm {...formProps} templates={templates} fields={wrappedFields} />\n );\n\n return (\n <ScaffolderThemeProvider value={theme}>\n {theme === 'bui' ? <div className={styles.form}>{form}</div> : form}\n </ScaffolderThemeProvider>\n );\n};\n"],"names":["MuiTheme"],"mappings":";;;;;;;;;;AAiCA,MAAM,OAAA,GAAU,UAAUA,KAAQ,CAAA;AAClC,MAAM,OAAA,GAAU,SAAA,CAAU,gBAAA,EAAkB,CAAA;AAMrC,MAAM,IAAA,GAAO,CAClB,KAAA,KAGG;AACH,EAAA,MAAM,EAAE,kBAAA,EAAoB,SAAA,EAAW,GAAG,WAAU,GAAI,KAAA;AACxD,EAAA,MAAM,QAAyB,SAAA,IAAa,KAAA;AAC5C,EAAA,MAAM,WAAA,GAAc,KAAA,KAAU,KAAA,GAAQ,OAAA,GAAU,OAAA;AAIhD,EAAA,MAAM,aAAA,GAAgB,OAAA;AAAA,IACpB,MACE,MAAA,CAAO,WAAA;AAAA,MACL,MAAA,CAAO,OAAA,CAAQ,SAAA,CAAU,MAAA,IAAU,EAAE,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,SAAS,CAAA,KAAM;AAAA,QAC/D,GAAA;AAAA,QACA,CAAC,YAAA,KAA6B;AAC5B,UAAA,uBACE,GAAA;AAAA,YAAC,SAAA;AAAA,YAAA;AAAA,cACE,GAAG,YAAA;AAAA,cACJ,QAAA,EAAU,YAAA,CAAa,QAAA,IAAY,EAAC;AAAA,cACpC,UAAU,YAAA,CAAa,QAAA;AAAA,cACvB,SAAA,EAAW,YAAA,CAAa,SAAA,IAAa,EAAC;AAAA,cACtC,QAAA,EAAU,aAAa,QAAA,IAAY,KAAA;AAAA,cACnC,QAAA,EAAU,aAAa,QAAA,IAAY;AAAA;AAAA,WACrC;AAAA,QAEJ;AAAA,OACD;AAAA,KACH;AAAA,IACF,CAAC,UAAU,MAAM;AAAA,GACnB;AAEA,EAAA,MAAM,SAAA,GAAY,OAAA;AAAA,IAChB,MACE,KAAA,KAAU,KAAA,GACN,SAAA,CAAU,SAAA,IAAa,EAAC,GACxB;AAAA,MACE,aAAA;AAAA,MACA,wBAAA;AAAA,MACA,GAAG,SAAA,CAAU;AAAA,KACf;AAAA,IACN,CAAC,SAAA,CAAU,SAAA,EAAW,KAAK;AAAA,GAC7B;AAEA,EAAA,MAAM,uBACJ,GAAA,CAAC,WAAA,EAAA,EAAa,GAAG,SAAA,EAAW,SAAA,EAAsB,QAAQ,aAAA,EAAe,CAAA;AAG3E,EAAA,uBACE,GAAA,CAAC,uBAAA,EAAA,EAAwB,KAAA,EAAO,KAAA,EAC7B,QAAA,EAAA,KAAA,KAAU,KAAA,mBAAQ,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,IAAA,EAAO,QAAA,EAAA,IAAA,EAAK,IAAS,IAAA,EACjE,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScaffolderThemeContext.esm.js","sources":["../../../../src/next/components/Form/ScaffolderThemeContext.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 { createContext, useContext } from 'react';\n\n/** @alpha */\nexport type ScaffolderTheme = 'mui' | 'bui';\n\nconst ScaffolderThemeContext = createContext<ScaffolderTheme>('mui');\n\n/** @alpha */\nexport const ScaffolderThemeProvider = ScaffolderThemeContext.Provider;\n\n/** @alpha */\nexport const useScaffolderTheme = (): ScaffolderTheme =>\n useContext(ScaffolderThemeContext);\n"],"names":[],"mappings":";;AAoBA,MAAM,sBAAA,GAAyB,cAA+B,KAAK,CAAA;AAG5D,MAAM,0BAA0B,sBAAA,CAAuB;AAGvD,MAAM,kBAAA,GAAqB,MAChC,UAAA,CAAW,sBAAsB
|
|
1
|
+
{"version":3,"file":"ScaffolderThemeContext.esm.js","sources":["../../../../src/next/components/Form/ScaffolderThemeContext.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 { createContext, useContext } from 'react';\n\n/** @alpha */\nexport type ScaffolderTheme = 'mui' | 'bui';\n\nconst ScaffolderThemeContext = createContext<ScaffolderTheme>('mui');\n\n/** @alpha */\nexport const ScaffolderThemeProvider = ScaffolderThemeContext.Provider;\n\n/** @alpha */\nexport const useScaffolderTheme = (): ScaffolderTheme =>\n useContext(ScaffolderThemeContext);\n"],"names":[],"mappings":";;AAoBA,MAAM,sBAAA,GAAyB,cAA+B,KAAK,CAAA;AAG5D,MAAM,0BAA0B,sBAAA,CAAuB;AAGvD,MAAM,kBAAA,GAAqB,MAChC,UAAA,CAAW,sBAAsB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordWidget.esm.js","sources":["../../../../src/next/components/PasswordWidget/PasswordWidget.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 */\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport TextField from '@material-ui/core/TextField';\nimport { WidgetProps } from '@rjsf/utils';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nexport const PasswordWidget = (\n props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,\n) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n\n const {\n value,\n onChange,\n schema: { title },\n } = props;\n\n return (\n <>\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={e => {\n onChange(e.target.value);\n }}\n value={value}\n autoComplete=\"off\"\n />\n <FormHelperText error>\n <MarkdownContent content={t('passwordWidget.content')} />\n </FormHelperText>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBO,MAAM,cAAA,GAAiB,CAC5B,KAAA,KACG;AACH,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAE7D,EAAA,MAAM;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAA;AAAM,GAClB,GAAI,KAAA;AAEJ,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,EAAA,EAAI,KAAA;AAAA,QACJ,KAAA,EAAO,KAAA;AAAA,QACP,kBAAA,EAAkB,KAAA;AAAA,QAClB,UAAU,CAAA,CAAA,KAAK;AACb,UAAA,QAAA,CAAS,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,QACzB,CAAA;AAAA,QACA,KAAA;AAAA,QACA,YAAA,EAAa;AAAA;AAAA,KACf;AAAA,oBACA,GAAA,CAAC,cAAA,EAAA,EAAe,KAAA,EAAK,IAAA,EACnB,QAAA,kBAAA,GAAA,CAAC,mBAAgB,OAAA,EAAS,CAAA,CAAE,wBAAwB,CAAA,EAAG,CAAA,EACzD;AAAA,GAAA,EACF,CAAA;AAEJ
|
|
1
|
+
{"version":3,"file":"PasswordWidget.esm.js","sources":["../../../../src/next/components/PasswordWidget/PasswordWidget.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 */\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport TextField from '@material-ui/core/TextField';\nimport { WidgetProps } from '@rjsf/utils';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nexport const PasswordWidget = (\n props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,\n) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n\n const {\n value,\n onChange,\n schema: { title },\n } = props;\n\n return (\n <>\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={e => {\n onChange(e.target.value);\n }}\n value={value}\n autoComplete=\"off\"\n />\n <FormHelperText error>\n <MarkdownContent content={t('passwordWidget.content')} />\n </FormHelperText>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBO,MAAM,cAAA,GAAiB,CAC5B,KAAA,KACG;AACH,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAE7D,EAAA,MAAM;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAA;AAAM,GAClB,GAAI,KAAA;AAEJ,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,EAAA,EAAI,KAAA;AAAA,QACJ,KAAA,EAAO,KAAA;AAAA,QACP,kBAAA,EAAkB,KAAA;AAAA,QAClB,UAAU,CAAA,CAAA,KAAK;AACb,UAAA,QAAA,CAAS,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,QACzB,CAAA;AAAA,QACA,KAAA;AAAA,QACA,YAAA,EAAa;AAAA;AAAA,KACf;AAAA,oBACA,GAAA,CAAC,cAAA,EAAA,EAAe,KAAA,EAAK,IAAA,EACnB,QAAA,kBAAA,GAAA,CAAC,mBAAgB,OAAA,EAAS,CAAA,CAAE,wBAAwB,CAAA,EAAG,CAAA,EACzD;AAAA,GAAA,EACF,CAAA;AAEJ;;"}
|
|
@@ -20,7 +20,7 @@ function processSchema(key, value, schema, formState) {
|
|
|
20
20
|
return [];
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
if (definitionInSchema["ui:widget"] === "password" || definitionInSchema["ui:field"]?.
|
|
23
|
+
if (definitionInSchema["ui:widget"] === "password" || definitionInSchema["ui:field"]?.toLowerCase() === "secret") {
|
|
24
24
|
return [[name, "******"]];
|
|
25
25
|
}
|
|
26
26
|
if (definitionInSchema.enum && definitionInSchema.enumNames) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReviewState.esm.js","sources":["../../../../src/next/components/ReviewState/ReviewState.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 { StructuredMetadataTable } from '@backstage/core-components';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { isJsonObject, formatKey, findSchemaForKey } from './util';\n\n/**\n * The props for the {@link ReviewState} component.\n * @alpha\n */\nexport type ReviewStateProps = {\n schemas: ParsedTemplateSchema[];\n formState: JsonObject;\n};\n\nfunction processSchema(\n key: string,\n value: JsonValue | undefined,\n schema: ParsedTemplateSchema,\n formState: JsonObject,\n): [string, JsonValue | undefined][] {\n const parsedSchema = new JSONSchema(schema.mergedSchema);\n const definitionInSchema = parsedSchema.getSchema({\n pointer: `#/${key}`,\n data: formState,\n });\n\n const name =\n definitionInSchema?.['ui:backstage']?.review?.name ??\n definitionInSchema?.title ??\n formatKey(key);\n\n if (definitionInSchema) {\n const backstageReviewOptions = definitionInSchema['ui:backstage']?.review;\n if (backstageReviewOptions) {\n if (backstageReviewOptions.mask) {\n return [[name, backstageReviewOptions.mask]];\n }\n if (backstageReviewOptions.show === false) {\n return [];\n }\n }\n\n if (\n definitionInSchema['ui:widget'] === 'password' ||\n definitionInSchema['ui:field']?.
|
|
1
|
+
{"version":3,"file":"ReviewState.esm.js","sources":["../../../../src/next/components/ReviewState/ReviewState.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 { StructuredMetadataTable } from '@backstage/core-components';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { isJsonObject, formatKey, findSchemaForKey } from './util';\n\n/**\n * The props for the {@link ReviewState} component.\n * @alpha\n */\nexport type ReviewStateProps = {\n schemas: ParsedTemplateSchema[];\n formState: JsonObject;\n};\n\nfunction processSchema(\n key: string,\n value: JsonValue | undefined,\n schema: ParsedTemplateSchema,\n formState: JsonObject,\n): [string, JsonValue | undefined][] {\n const parsedSchema = new JSONSchema(schema.mergedSchema);\n const definitionInSchema = parsedSchema.getSchema({\n pointer: `#/${key}`,\n data: formState,\n });\n\n const name =\n definitionInSchema?.['ui:backstage']?.review?.name ??\n definitionInSchema?.title ??\n formatKey(key);\n\n if (definitionInSchema) {\n const backstageReviewOptions = definitionInSchema['ui:backstage']?.review;\n if (backstageReviewOptions) {\n if (backstageReviewOptions.mask) {\n return [[name, backstageReviewOptions.mask]];\n }\n if (backstageReviewOptions.show === false) {\n return [];\n }\n }\n\n if (\n definitionInSchema['ui:widget'] === 'password' ||\n definitionInSchema['ui:field']?.toLowerCase() === 'secret'\n ) {\n return [[name, '******']];\n }\n\n if (definitionInSchema.enum && definitionInSchema.enumNames) {\n return [\n [\n name,\n definitionInSchema.enumNames[\n definitionInSchema.enum.indexOf(value)\n ] || value,\n ],\n ];\n }\n\n if (backstageReviewOptions?.explode !== false && isJsonObject(value)) {\n // Recurse nested objects\n return Object.entries(value).flatMap(([nestedKey, nestedValue]) =>\n processSchema(`${key}/${nestedKey}`, nestedValue, schema, formState),\n );\n }\n }\n\n return [[name, value]];\n}\n\n/**\n * The component used by the {@link Stepper} to render the review step.\n * @alpha\n */\nexport const ReviewState = (props: ReviewStateProps) => {\n const reviewData = Object.fromEntries(\n Object.entries(props.formState)\n .flatMap(([key, value]) => {\n const schema = findSchemaForKey(key, props.schemas, props.formState);\n return schema\n ? processSchema(key, value, schema, props.formState)\n : [[formatKey(key), value]];\n })\n .filter(prop => prop.length > 0),\n );\n return (\n <StructuredMetadataTable\n metadata={reviewData}\n options={{ titleFormat: key => key }}\n />\n );\n};\n"],"names":["JSONSchema"],"mappings":";;;;;AA8BA,SAAS,aAAA,CACP,GAAA,EACA,KAAA,EACA,MAAA,EACA,SAAA,EACmC;AACnC,EAAA,MAAM,YAAA,GAAe,IAAIA,OAAA,CAAW,MAAA,CAAO,YAAY,CAAA;AACvD,EAAA,MAAM,kBAAA,GAAqB,aAAa,SAAA,CAAU;AAAA,IAChD,OAAA,EAAS,KAAK,GAAG,CAAA,CAAA;AAAA,IACjB,IAAA,EAAM;AAAA,GACP,CAAA;AAED,EAAA,MAAM,IAAA,GACJ,qBAAqB,cAAc,CAAA,EAAG,QAAQ,IAAA,IAC9C,kBAAA,EAAoB,KAAA,IACpB,SAAA,CAAU,GAAG,CAAA;AAEf,EAAA,IAAI,kBAAA,EAAoB;AACtB,IAAA,MAAM,sBAAA,GAAyB,kBAAA,CAAmB,cAAc,CAAA,EAAG,MAAA;AACnE,IAAA,IAAI,sBAAA,EAAwB;AAC1B,MAAA,IAAI,uBAAuB,IAAA,EAAM;AAC/B,QAAA,OAAO,CAAC,CAAC,IAAA,EAAM,sBAAA,CAAuB,IAAI,CAAC,CAAA;AAAA,MAC7C;AACA,MAAA,IAAI,sBAAA,CAAuB,SAAS,KAAA,EAAO;AACzC,QAAA,OAAO,EAAC;AAAA,MACV;AAAA,IACF;AAEA,IAAA,IACE,kBAAA,CAAmB,WAAW,CAAA,KAAM,UAAA,IACpC,mB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AA,IAC9B,CAAC,CAAA,CACA,MAAA,CAAO,CAAA,IAAA,KAAQ,IAAA,CAAK,SAAS,CAAC;AAAA,GACnC;AACA,EAAA,uBACE,GAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,UAAA;AAAA,MACV,OAAA,EAAS,EAAE,WAAA,EAAa,CAAA,GAAA,KAAO,GAAA;AAAI;AAAA,GACrC;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.esm.js","sources":["../../../../src/next/components/ReviewState/util.ts"],"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 */\n\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { startCase } from 'lodash';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\n\nexport function isJsonObject(value?: JsonValue): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n// Helper function to format a key into a human-readable string\nexport function formatKey(key: string): string {\n const parts = key.split('/');\n return parts\n .filter(Boolean)\n .map(part => startCase(part))\n .join(' > ');\n}\n\nexport function findSchemaForKey(\n key: string,\n schemas: ParsedTemplateSchema[],\n formState: Partial<{ [key: string]: JsonValue }>,\n): ParsedTemplateSchema | null {\n for (const step of schemas) {\n /*\n To determine if a key is defined in a schema we need to call getSchema\n with an empty form state. Otherwise, it will never return undefined as it\n will fallback to a default schema based on the form state. \n\n An exception to this is when your schema is dynamic i.e. using dependencies \n because the form state is required for generating the schema. In this case,\n we add only the dependencies data to the getSchema call.\n */\n\n const schema = step.mergedSchema;\n\n // Declare data to be a subset of formState\n const data: typeof formState = {};\n\n if (schema.dependencies && isJsonObject(schema.dependencies)) {\n for (const dep in schema.dependencies) {\n if (formState.hasOwnProperty(dep)) {\n data[dep] = formState[dep]; // Add each dependency key from formState\n }\n }\n }\n\n const draft = new JSONSchema(schema);\n const res = draft.getSchema({\n pointer: `#/${key}`,\n data,\n });\n\n if (!!res) {\n return step;\n }\n }\n\n return null; // Return null if the key isn't found in any schema\n}\n"],"names":["JSONSchema"],"mappings":";;;AAqBO,SAAS,aAAa,KAAA,EAAwC;AACnE,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAGO,SAAS,UAAU,GAAA,EAAqB;AAC7C,EAAA,MAAM,KAAA,GAAQ,GAAA,CAAI,KAAA,CAAM,GAAG,CAAA;AAC3B,EAAA,OAAO,KAAA,CACJ,MAAA,CAAO,OAAO,CAAA,CACd,GAAA,CAAI,CAAA,IAAA,KAAQ,SAAA,CAAU,IAAI,CAAC,CAAA,CAC3B,IAAA,CAAK,KAAK,CAAA;AACf;AAEO,SAAS,gBAAA,CACd,GAAA,EACA,OAAA,EACA,SAAA,EAC6B;AAC7B,EAAA,KAAA,MAAW,QAAQ,OAAA,EAAS;AAW1B,IAAA,MAAM,SAAS,IAAA,CAAK,YAAA;AAGpB,IAAA,MAAM,OAAyB,EAAC;AAEhC,IAAA,IAAI,MAAA,CAAO,YAAA,IAAgB,YAAA,CAAa,MAAA,CAAO,YAAY,CAAA,EAAG;AAC5D,MAAA,KAAA,MAAW,GAAA,IAAO,OAAO,YAAA,EAAc;AACrC,QAAA,IAAI,SAAA,CAAU,cAAA,CAAe,GAAG,CAAA,EAAG;AACjC,UAAA,IAAA,CAAK,GAAG,CAAA,GAAI,SAAA,CAAU,GAAG,CAAA;AAAA,QAC3B;AAAA,MACF;AAAA,IACF;AAEA,IAAA,MAAM,KAAA,GAAQ,IAAIA,OAAA,CAAW,MAAM,CAAA;AACnC,IAAA,MAAM,GAAA,GAAM,MAAM,SAAA,CAAU;AAAA,MAC1B,OAAA,EAAS,KAAK,GAAG,CAAA,CAAA;AAAA,MACjB;AAAA,KACD,CAAA;AAED,IAAA,IAAI,CAAC,CAAC,GAAA,EAAK;AACT,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF;AAEA,EAAA,OAAO,IAAA;AACT
|
|
1
|
+
{"version":3,"file":"util.esm.js","sources":["../../../../src/next/components/ReviewState/util.ts"],"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 */\n\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { startCase } from 'lodash';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\n\nexport function isJsonObject(value?: JsonValue): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n// Helper function to format a key into a human-readable string\nexport function formatKey(key: string): string {\n const parts = key.split('/');\n return parts\n .filter(Boolean)\n .map(part => startCase(part))\n .join(' > ');\n}\n\nexport function findSchemaForKey(\n key: string,\n schemas: ParsedTemplateSchema[],\n formState: Partial<{ [key: string]: JsonValue }>,\n): ParsedTemplateSchema | null {\n for (const step of schemas) {\n /*\n To determine if a key is defined in a schema we need to call getSchema\n with an empty form state. Otherwise, it will never return undefined as it\n will fallback to a default schema based on the form state. \n\n An exception to this is when your schema is dynamic i.e. using dependencies \n because the form state is required for generating the schema. In this case,\n we add only the dependencies data to the getSchema call.\n */\n\n const schema = step.mergedSchema;\n\n // Declare data to be a subset of formState\n const data: typeof formState = {};\n\n if (schema.dependencies && isJsonObject(schema.dependencies)) {\n for (const dep in schema.dependencies) {\n if (formState.hasOwnProperty(dep)) {\n data[dep] = formState[dep]; // Add each dependency key from formState\n }\n }\n }\n\n const draft = new JSONSchema(schema);\n const res = draft.getSchema({\n pointer: `#/${key}`,\n data,\n });\n\n if (!!res) {\n return step;\n }\n }\n\n return null; // Return null if the key isn't found in any schema\n}\n"],"names":["JSONSchema"],"mappings":";;;AAqBO,SAAS,aAAa,KAAA,EAAwC;AACnE,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAGO,SAAS,UAAU,GAAA,EAAqB;AAC7C,EAAA,MAAM,KAAA,GAAQ,GAAA,CAAI,KAAA,CAAM,GAAG,CAAA;AAC3B,EAAA,OAAO,KAAA,CACJ,MAAA,CAAO,OAAO,CAAA,CACd,GAAA,CAAI,CAAA,IAAA,KAAQ,SAAA,CAAU,IAAI,CAAC,CAAA,CAC3B,IAAA,CAAK,KAAK,CAAA;AACf;AAEO,SAAS,gBAAA,CACd,GAAA,EACA,OAAA,EACA,SAAA,EAC6B;AAC7B,EAAA,KAAA,MAAW,QAAQ,OAAA,EAAS;AAW1B,IAAA,MAAM,SAAS,IAAA,CAAK,YAAA;AAGpB,IAAA,MAAM,OAAyB,EAAC;AAEhC,IAAA,IAAI,MAAA,CAAO,YAAA,IAAgB,YAAA,CAAa,MAAA,CAAO,YAAY,CAAA,EAAG;AAC5D,MAAA,KAAA,MAAW,GAAA,IAAO,OAAO,YAAA,EAAc;AACrC,QAAA,IAAI,SAAA,CAAU,cAAA,CAAe,GAAG,CAAA,EAAG;AACjC,UAAA,IAAA,CAAK,GAAG,CAAA,GAAI,SAAA,CAAU,GAAG,CAAA;AAAA,QAC3B;AAAA,MACF;AAAA,IACF;AAEA,IAAA,MAAM,KAAA,GAAQ,IAAIA,OAAA,CAAW,MAAM,CAAA;AACnC,IAAA,MAAM,GAAA,GAAM,MAAM,SAAA,CAAU;AAAA,MAC1B,OAAA,EAAS,KAAK,GAAG,CAAA,CAAA;AAAA,MACjB;AAAA,KACD,CAAA;AAED,IAAA,IAAI,CAAC,CAAC,GAAA,EAAK;AACT,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF;AAEA,EAAA,OAAO,IAAA;AACT;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScaffolderField.esm.js","sources":["../../../../src/next/components/ScaffolderField/ScaffolderField.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 type CSSProperties,\n type PropsWithChildren,\n type ReactElement,\n} from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Box } from '@backstage/ui';\n\nimport { useScaffolderTheme } from '../Form/ScaffolderThemeContext';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\nconst buiDescriptionStyle: CSSProperties = {\n fontSize: 'var(--bui-font-size-2)',\n color: 'var(--bui-fg-secondary)',\n margin: 0,\n};\n\n/**\n * Props for the {@link ScaffolderField} component\n * @alpha\n */\nexport interface ScaffolderFieldProps {\n rawDescription?: string;\n errors?: ReactElement;\n rawErrors?: string[];\n help?: ReactElement;\n rawHelp?: string;\n required?: boolean;\n disabled?: boolean;\n displayLabel?: boolean;\n}\n\nconst MuiScaffolderField = (props: PropsWithChildren<ScaffolderFieldProps>) => {\n const {\n children,\n displayLabel = true,\n rawErrors = [],\n errors,\n help,\n rawDescription,\n required,\n disabled,\n } = props;\n const classes = useStyles();\n return (\n <FormControl\n fullWidth\n error={rawErrors.length ? true : false}\n required={required}\n disabled={disabled}\n >\n {children}\n {displayLabel && rawDescription ? (\n <MarkdownContent\n content={rawDescription}\n linkTarget=\"_blank\"\n className={classes.markdownDescription}\n />\n ) : null}\n {errors}\n {help}\n </FormControl>\n );\n};\n\nconst BuiScaffolderField = (props: PropsWithChildren<ScaffolderFieldProps>) => {\n const { children, displayLabel = true, errors, help, rawDescription } = props;\n\n return (\n <Box mb=\"3\">\n {children}\n {displayLabel && rawDescription ? (\n <div style={buiDescriptionStyle}>\n <MarkdownContent content={rawDescription} linkTarget=\"_blank\" />\n </div>\n ) : null}\n {errors}\n {help}\n </Box>\n );\n};\n\n/**\n * A component to wrap up a input field which helps with formatting and supporting markdown\n * on the field types\n * @alpha\n */\nexport const ScaffolderField = (\n props: PropsWithChildren<ScaffolderFieldProps>,\n) => {\n const theme = useScaffolderTheme();\n\n if (theme === 'bui') {\n return <BuiScaffolderField {...props} />;\n }\n\n return <MuiScaffolderField {...props} />;\n};\n"],"names":[],"mappings":";;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,mBAAA,EAAqB;AAAA,IACnB,QAAA,EAAU,KAAA,CAAM,UAAA,CAAW,OAAA,CAAQ,QAAA;AAAA,IACnC,MAAA,EAAQ,CAAA;AAAA,IACR,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,SAAA;AAAA,IAC1B,gBAAA,EAAkB;AAAA,MAChB,MAAA,EAAQ,CAAA;AAAA,MACR,SAAA,EAAW;AAAA;AAAA;AACb;AAEJ,CA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AA,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,cAAA,EAAgB,UAAA,EAAW,QAAA,EAAS,GAChE,CAAA,GACE,IAAA;AAAA,IACH,MAAA;AAAA,IACA;AAAA,GAAA,EACH,CAAA;AAEJ,CAAA;AAOO,MAAM,eAAA,GAAkB,CAC7B,KAAA,KACG;AACH,EAAA,MAAM,QAAQ,kBAAA,EAAmB;AAEjC,EAAA,IAAI,UAAU,KAAA,EAAO;AACnB,IAAA,uBAAO,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA;AAAA,EACxC;AAEA,EAAA,uBAAO,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA;AACxC
|
|
1
|
+
{"version":3,"file":"ScaffolderField.esm.js","sources":["../../../../src/next/components/ScaffolderField/ScaffolderField.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 type CSSProperties,\n type PropsWithChildren,\n type ReactElement,\n} from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Box } from '@backstage/ui';\n\nimport { useScaffolderTheme } from '../Form/ScaffolderThemeContext';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\nconst buiDescriptionStyle: CSSProperties = {\n fontSize: 'var(--bui-font-size-2)',\n color: 'var(--bui-fg-secondary)',\n margin: 0,\n};\n\n/**\n * Props for the {@link ScaffolderField} component\n * @alpha\n */\nexport interface ScaffolderFieldProps {\n rawDescription?: string;\n errors?: ReactElement;\n rawErrors?: string[];\n help?: ReactElement;\n rawHelp?: string;\n required?: boolean;\n disabled?: boolean;\n displayLabel?: boolean;\n}\n\nconst MuiScaffolderField = (props: PropsWithChildren<ScaffolderFieldProps>) => {\n const {\n children,\n displayLabel = true,\n rawErrors = [],\n errors,\n help,\n rawDescription,\n required,\n disabled,\n } = props;\n const classes = useStyles();\n return (\n <FormControl\n fullWidth\n error={rawErrors.length ? true : false}\n required={required}\n disabled={disabled}\n >\n {children}\n {displayLabel && rawDescription ? (\n <MarkdownContent\n content={rawDescription}\n linkTarget=\"_blank\"\n className={classes.markdownDescription}\n />\n ) : null}\n {errors}\n {help}\n </FormControl>\n );\n};\n\nconst BuiScaffolderField = (props: PropsWithChildren<ScaffolderFieldProps>) => {\n const { children, displayLabel = true, errors, help, rawDescription } = props;\n\n return (\n <Box mb=\"3\">\n {children}\n {displayLabel && rawDescription ? (\n <div style={buiDescriptionStyle}>\n <MarkdownContent content={rawDescription} linkTarget=\"_blank\" />\n </div>\n ) : null}\n {errors}\n {help}\n </Box>\n );\n};\n\n/**\n * A component to wrap up a input field which helps with formatting and supporting markdown\n * on the field types\n * @alpha\n */\nexport const ScaffolderField = (\n props: PropsWithChildren<ScaffolderFieldProps>,\n) => {\n const theme = useScaffolderTheme();\n\n if (theme === 'bui') {\n return <BuiScaffolderField {...props} />;\n }\n\n return <MuiScaffolderField {...props} />;\n};\n"],"names":[],"mappings":";;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,mBAAA,EAAqB;AAAA,IACnB,QAAA,EAAU,KAAA,CAAM,UAAA,CAAW,OAAA,CAAQ,QAAA;AAAA,IACnC,MAAA,EAAQ,CAAA;AAAA,IACR,KAAA,EAAO,KAA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,EAAG,GAAA,EACL,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,YAAA,IAAgB,cAAA,mBACf,GAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAO,mBAAA,EACV,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,cAAA,EAAgB,UAAA,EAAW,QAAA,EAAS,GAChE,CAAA,GACE,IAAA;AAAA,IACH,MAAA;AAAA,IACA;AAAA,GAAA,EACH,CAAA;AAEJ,CAAA;AAOO,MAAM,eAAA,GAAkB,CAC7B,KAAA,KACG;AACH,EAAA,MAAM,QAAQ,kBAAA,EAAmB;AAEjC,EAAA,IAAI,UAAU,KAAA,EAAO;AACnB,IAAA,uBAAO,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA;AAAA,EACxC;AAEA,EAAA,uBAAO,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA;AACxC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScaffolderPageContextMenu.esm.js","sources":["../../../../src/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.tsx"],"sourcesContent":["/*\n * Copyright 2020 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\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport IconButton from '@material-ui/core/IconButton';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MenuList from '@material-ui/core/MenuList';\nimport Popover from '@material-ui/core/Popover';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport Description from '@material-ui/icons/Description';\nimport Edit from '@material-ui/icons/Edit';\nimport List from '@material-ui/icons/List';\nimport Functions from '@material-ui/icons/Functions';\nimport MoreVert from '@material-ui/icons/MoreVert';\nimport { SyntheticEvent, useState } from 'react';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { templateManagementPermission } from '@backstage/plugin-scaffolder-common/alpha';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles(theme => ({\n button: {\n color: theme.page.fontColor,\n },\n}));\n\n/**\n * @alpha\n */\nexport type ScaffolderPageContextMenuProps = {\n onEditorClicked?: () => void;\n onActionsClicked?: () => void;\n onTasksClicked?: () => void;\n onCreateClicked?: () => void;\n onTemplatingExtensionsClicked?: () => void;\n};\n\n/**\n * @alpha\n */\nexport function ScaffolderPageContextMenu(\n props: ScaffolderPageContextMenuProps,\n) {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const {\n onEditorClicked,\n onActionsClicked,\n onTasksClicked,\n onCreateClicked,\n onTemplatingExtensionsClicked,\n } = props;\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement>();\n\n const { allowed: canManageTemplates } = usePermission({\n permission: templateManagementPermission,\n });\n\n if (\n !(\n onEditorClicked ||\n onActionsClicked ||\n onTasksClicked ||\n onCreateClicked ||\n onTemplatingExtensionsClicked\n )\n ) {\n return null;\n }\n\n const onOpen = (event: SyntheticEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const onClose = () => {\n setAnchorEl(undefined);\n };\n\n return (\n <>\n <IconButton\n id=\"long-menu\"\n aria-label={t('scaffolderPageContextMenu.moreLabel')}\n aria-controls=\"long-menu\"\n aria-expanded={!!anchorEl}\n aria-haspopup=\"true\"\n role=\"button\"\n onClick={onOpen}\n data-testid=\"menu-button\"\n color=\"inherit\"\n className={classes.button}\n >\n <MoreVert />\n </IconButton>\n <Popover\n aria-labelledby=\"long-menu\"\n open={Boolean(anchorEl)}\n onClose={onClose}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n >\n <MenuList>\n {onCreateClicked && (\n <MenuItem onClick={onCreateClicked}>\n <ListItemIcon>\n <CreateComponentIcon fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={t('scaffolderPageContextMenu.createLabel')}\n />\n </MenuItem>\n )}\n {onEditorClicked && canManageTemplates && (\n <MenuItem onClick={onEditorClicked}>\n <ListItemIcon>\n <Edit fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={t('scaffolderPageContextMenu.editorLabel')}\n />\n </MenuItem>\n )}\n {onTemplatingExtensionsClicked && (\n <MenuItem onClick={onTemplatingExtensionsClicked}>\n <ListItemIcon>\n <Functions fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={t(\n 'scaffolderPageContextMenu.templatingExtensionsLabel',\n )}\n />\n </MenuItem>\n )}\n {onActionsClicked && (\n <MenuItem onClick={onActionsClicked}>\n <ListItemIcon>\n <Description fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={t('scaffolderPageContextMenu.actionsLabel')}\n />\n </MenuItem>\n )}\n {onTasksClicked && (\n <MenuItem onClick={onTasksClicked}>\n <ListItemIcon>\n <List fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={t('scaffolderPageContextMenu.tasksLabel')}\n />\n </MenuItem>\n )}\n </MenuList>\n </Popover>\n </>\n );\n}\n"],"names":["Description"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,MAAA,EAAQ;AAAA,IACN,KAAA,EAAO,MAAM,IAAA,CAAK;AAAA;AAEtB,CAAA,CAAE,CAAA;AAgBK,SAAS,0BACd,KA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AAAA,4BACA,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,CAAA;AAAA,kBACP;AAAA;AACF;AAAA;AACF,WAAA,EACF,CAAA;AAAA,UAED,gBAAA,oBACC,IAAA,CAAC,QAAA,EAAA,EAAS,OAAA,EAAS,gBAAA,EACjB,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,YAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAACA,eAAA,EAAA,EAAY,QAAA,EAAS,SAAQ,CAAA,EAChC,CAAA;AAAA,4BACA,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,EAAE,wCAAwC;AAAA;AAAA;AACrD,WAAA,EACF,CAAA;AAAA,UAED,cAAA,oBACC,IAAA,CAAC,QAAA,EAAA,EAAS,OAAA,EAAS,cAAA,EACjB,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,YAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,QAAA,EAAS,SAAQ,CAAA,EACzB,CAAA;AAAA,4BACA,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,EAAE,sCAAsC;AAAA;AAAA;AACnD,WAAA,EACF;AAAA,SAAA,EAEJ;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ
|
|
1
|
+
{"version":3,"file":"ScaffolderPageContextMenu.esm.js","sources":["../../../../src/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.tsx"],"sourcesContent":["/*\n * Copyright 2020 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\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport IconButton from '@material-ui/core/IconButton';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MenuList from '@material-ui/core/MenuList';\nimport Popover from '@material-ui/core/Popover';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport Description from '@material-ui/icons/Description';\nimport Edit from '@material-ui/icons/Edit';\nimport List from '@material-ui/icons/List';\nimport Functions from '@material-ui/icons/Functions';\nimport MoreVert from '@material-ui/icons/MoreVert';\nimport { SyntheticEvent, useState } from 'react';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { templateManagementPermission } from '@backstage/plugin-scaffolder-common/alpha';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles(theme => ({\n button: {\n color: theme.page.fontColor,\n },\n}));\n\n/**\n * @alpha\n */\nexport type ScaffolderPageContextMenuProps = {\n onEditorClicked?: () => void;\n onActionsClicked?: () => void;\n onTasksClicked?: () => void;\n onCreateClicked?: () => void;\n onTemplatingExtensionsClicked?: () => void;\n};\n\n/**\n * @alpha\n */\nexport function ScaffolderPageContextMenu(\n props: ScaffolderPageContextMenuProps,\n) {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const {\n onEditorClicked,\n onActionsClicked,\n onTasksClicked,\n onCreateClicked,\n onTemplatingExtensionsClicked,\n } = props;\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement>();\n\n const { allowed: canManageTemplates } = usePermission({\n permission: templateManagementPermission,\n });\n\n if (\n !(\n onEditorClicked ||\n onActionsClicked ||\n onTasksClicked ||\n onCreateClicked ||\n onTemplatingExtensionsClicked\n )\n ) {\n return null;\n }\n\n const onOpen = (event: SyntheticEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const onClose = () => {\n setAnchorEl(undefined);\n };\n\n return (\n <>\n <IconButton\n id=\"long-menu\"\n aria-label={t('scaffolderPageContextMenu.moreLabel')}\n aria-controls=\"long-menu\"\n aria-expanded={!!anchorEl}\n aria-haspopup=\"true\"\n role=\"button\"\n onClick={onOpen}\n data-testid=\"menu-button\"\n color=\"inherit\"\n className={classes.button}\n >\n <MoreVert />\n </IconButton>\n <Popover\n aria-labelledby=\"long-menu\"\n open={Boolean(anchorEl)}\n onClose={onClose}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n >\n <MenuList>\n {onCreateClicked && (\n <MenuItem onClick={onCreateClicked}>\n <ListItemIcon>\n <CreateComponentIcon fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={t('scaffolderPageContextMenu.createLabel')}\n />\n </MenuItem>\n )}\n {onEditorClicked && canManageTemplates && (\n <MenuItem onClick={onEditorClicked}>\n <ListItemIcon>\n <Edit fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={t('scaffolderPageContextMenu.editorLabel')}\n />\n </MenuItem>\n )}\n {onTemplatingExtensionsClicked && (\n <MenuItem onClick={onTemplatingExtensionsClicked}>\n <ListItemIcon>\n <Functions fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={t(\n 'scaffolderPageContextMenu.templatingExtensionsLabel',\n )}\n />\n </MenuItem>\n )}\n {onActionsClicked && (\n <MenuItem onClick={onActionsClicked}>\n <ListItemIcon>\n <Description fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={t('scaffolderPageContextMenu.actionsLabel')}\n />\n </MenuItem>\n )}\n {onTasksClicked && (\n <MenuItem onClick={onTasksClicked}>\n <ListItemIcon>\n <List fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText\n primary={t('scaffolderPageContextMenu.tasksLabel')}\n />\n </MenuItem>\n )}\n </MenuList>\n </Popover>\n </>\n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A;AAAA,UAED,6BAAA,oBACC,IAAA,CAAC,QAAA,EAAA,EAAS,OAAA,EAAS,6BAAA,EACjB,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,YAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,QAAA,EAAS,SAAQ,CAAA,EAC9B,CAAA;AAAA,4BACA,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,CAAA;AAAA,kBACP;AAAA;AACF;AAAA;AACF,WAAA,EACF,CAAA;AAAA,UAED,gBAAA,oBACC,IAAA,CAAC,QAAA,EAAA,EAAS,OAAA,EAAS,gBAAA,EACjB,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,YAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAACA,eAAA,EAAA,EAAY,QAAA,EAAS,SAAQ,CAAA,EAChC,CAAA;AAAA,4BACA,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,EAAE,wCAAwC;AAAA;AAAA;AACrD,WAAA,EACF,CAAA;AAAA,UAED,cAAA,oBACC,IAAA,CAAC,QAAA,EAAA,EAAS,OAAA,EAAS,cAAA,EACjB,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,YAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,QAAA,EAAS,SAAQ,CAAA,EACzB,CAAA;AAAA,4BACA,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,EAAE,sCAAsC;AAAA;AAAA;AACnD,WAAA,EACF;AAAA,SAAA,EAEJ;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecretWidget.esm.js","sources":["../../../../src/next/components/SecretWidget/SecretWidget.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 */\n\nimport { WidgetProps } from '@rjsf/utils';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport TextField from '@material-ui/core/TextField';\nimport { ChangeEvent, useMemo, useState } from 'react';\nimport debounce from 'lodash/debounce';\n\n/**\n * Secret Widget for overriding the default password input widget\n * @alpha\n */\nexport const SecretWidget = (\n props: Pick<\n WidgetProps,\n 'name' | 'onChange' | 'schema' | 'required' | 'disabled'\n >,\n) => {\n const { setSecrets, secrets } = useTemplateSecrets();\n const {\n name,\n onChange,\n schema: { title, minLength, maxLength },\n required,\n disabled,\n } = props;\n\n const [localValue, setLocalValue] = useState(secrets[name] ?? '');\n\n // Memoize the debounced function so it persists across re-renders\n const debouncedSetSecrets = useMemo(\n () =>\n debounce((value: string) => {\n setSecrets({ [name]: value });\n }, 300),\n [setSecrets, name],\n );\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n setLocalValue(newValue);\n onChange(Array(newValue.length).fill('*').join(''));\n debouncedSetSecrets(newValue);\n };\n\n return (\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={handleChange}\n value={localValue}\n type=\"password\"\n autoComplete=\"off\"\n required={required}\n disabled={disabled}\n inputProps={{\n minLength,\n maxLength,\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,YAAA,GAAe,CAC1B,KAAA,KAIG;AACH,EAAA,MAAM,EAAE,UAAA,EAAY,OAAA,EAAQ,GAAI,kBAAA,EAAmB;AACnD,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAA,EAAO,SAAA,EAAW,SAAA,EAAU;AAAA,IACtC,QAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,MAAM,CAAC,YAAY,aAAa,CAAA,GAAI,SAAS,OAAA,CAAQ,IAAI,KAAK,EAAE,CAAA;AAGhE,EAAA,MAAM,mBAAA,GAAsB,OAAA;AAAA,IAC1B,MACE,QAAA,CAAS,CAAC,KAAA,KAAkB;AAC1B,MAAA,UAAA,CAAW,EAAE,CAAC,IAAI,GAAG,OAAO,CAAA;AAAA,IAC9B,GAAG,GAAG,CAAA;AAAA,IACR,CAAC,YAAY,IAAI;AAAA,GACnB;AAEA,EAAA,MAAM,YAAA,GAAe,CAAC,CAAA,KAAqC;AACzD,IAAA,MAAM,QAAA,GAAW,EAAE,MAAA,CAAO,KAAA;AAC1B,IAAA,aAAA,CAAc,QAAQ,CAAA;AACtB,IAAA,QAAA,CAAS,KAAA,CAAM,SAAS,MAAM,CAAA,CAAE,KAAK,GAAG,CAAA,CAAE,IAAA,CAAK,EAAE,CAAC,CAAA;AAClD,IAAA,mBAAA,CAAoB,QAAQ,CAAA;AAAA,EAC9B,CAAA;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,EAAA,EAAI,KAAA;AAAA,MACJ,KAAA,EAAO,KAAA;AAAA,MACP,kBAAA,EAAkB,KAAA;AAAA,MAClB,QAAA,EAAU,YAAA;AAAA,MACV,KAAA,EAAO,UAAA;AAAA,MACP,IAAA,EAAK,UAAA;AAAA,MACL,YAAA,EAAa,KAAA;AAAA,MACb,QAAA;AAAA,MACA,QAAA;AAAA,MACA,UAAA,EAAY;AAAA,QACV,SAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ
|
|
1
|
+
{"version":3,"file":"SecretWidget.esm.js","sources":["../../../../src/next/components/SecretWidget/SecretWidget.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 */\n\nimport { WidgetProps } from '@rjsf/utils';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport TextField from '@material-ui/core/TextField';\nimport { ChangeEvent, useMemo, useState } from 'react';\nimport debounce from 'lodash/debounce';\n\n/**\n * Secret Widget for overriding the default password input widget\n * @alpha\n */\nexport const SecretWidget = (\n props: Pick<\n WidgetProps,\n 'name' | 'onChange' | 'schema' | 'required' | 'disabled'\n >,\n) => {\n const { setSecrets, secrets } = useTemplateSecrets();\n const {\n name,\n onChange,\n schema: { title, minLength, maxLength },\n required,\n disabled,\n } = props;\n\n const [localValue, setLocalValue] = useState(secrets[name] ?? '');\n\n // Memoize the debounced function so it persists across re-renders\n const debouncedSetSecrets = useMemo(\n () =>\n debounce((value: string) => {\n setSecrets({ [name]: value });\n }, 300),\n [setSecrets, name],\n );\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n setLocalValue(newValue);\n onChange(Array(newValue.length).fill('*').join(''));\n debouncedSetSecrets(newValue);\n };\n\n return (\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={handleChange}\n value={localValue}\n type=\"password\"\n autoComplete=\"off\"\n required={required}\n disabled={disabled}\n inputProps={{\n minLength,\n maxLength,\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,YAAA,GAAe,CAC1B,KAAA,KAIG;AACH,EAAA,MAAM,EAAE,UAAA,EAAY,OAAA,EAAQ,GAAI,kBAAA,EAAmB;AACnD,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AA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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 { ErrorListProps, RJSFValidationError } from '@rjsf/utils';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Paper from '@material-ui/core/Paper';\nimport { Theme, createStyles, makeStyles } from '@material-ui/core/styles';\nimport ErrorIcon from '@material-ui/icons/Error';\nimport startCase from 'lodash/startCase';\n\nconst useStyles = makeStyles((_theme: Theme) =>\n createStyles({\n list: {\n width: '100%',\n },\n text: {\n textWrap: 'wrap',\n },\n }),\n);\n\n/**\n * Shows a list of errors found in the form\n *\n * @public\n */\nexport const ErrorListTemplate = ({ errors, schema }: ErrorListProps) => {\n const classes = useStyles();\n\n function formatErrorMessage(error: RJSFValidationError) {\n if (error.property && error.message) {\n const propertyName = error.property.startsWith('.')\n ? error.property.substring(1)\n : error.property;\n if (schema.properties && propertyName in schema.properties) {\n const property = schema.properties[propertyName];\n\n if (typeof property === 'object' && 'title' in property) {\n return `'${property.title}' ${error.message}`;\n }\n }\n // fall back to property name\n return `'${startCase(propertyName)}' ${error.message}`;\n }\n // fall back if property does not exist\n return error.stack;\n }\n\n return (\n <Paper>\n <List dense className={classes.list}>\n {errors.map((error, index) => (\n <ListItem key={index}>\n <ListItemIcon>\n <ErrorIcon color=\"error\" />\n </ListItemIcon>\n <ListItemText\n classes={{ primary: classes.text }}\n primary={formatErrorMessage(error)}\n />\n </ListItem>\n ))}\n </List>\n </Paper>\n );\n};\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BAAO,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,0BACjB,QAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,YAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,KAAA,EAAM,SAAQ,CAAA,EAC3B,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,EAAE,OAAA,EAAS,OAAA,CAAQ,IAAA,EAAK;AAAA,QACjC,OAAA,EAAS,mBAAmB,KAAK;AAAA;AAAA;AACnC,GAAA,EAAA,EAPa,KAQf,CACD,CAAA,EACH,CAAA,EACF,CAAA;AAEJ
|
|
1
|
+
{"version":3,"file":"errorListTemplate.esm.js","sources":["../../../../../src/next/components/Stepper/ErrorListTemplate/errorListTemplate.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 { ErrorListProps, RJSFValidationError } from '@rjsf/utils';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Paper from '@material-ui/core/Paper';\nimport { Theme, createStyles, makeStyles } from '@material-ui/core/styles';\nimport ErrorIcon from '@material-ui/icons/Error';\nimport startCase from 'lodash/startCase';\n\nconst useStyles = makeStyles((_theme: Theme) =>\n createStyles({\n list: {\n width: '100%',\n },\n text: {\n textWrap: 'wrap',\n },\n }),\n);\n\n/**\n * Shows a list of errors found in the form\n *\n * @public\n */\nexport const ErrorListTemplate = ({ errors, schema }: ErrorListProps) => {\n const classes = useStyles();\n\n function formatErrorMessage(error: RJSFValidationError) {\n if (error.property && error.message) {\n const propertyName = error.property.startsWith('.')\n ? error.property.substring(1)\n : error.property;\n if (schema.properties && propertyName in schema.properties) {\n const property = schema.properties[propertyName];\n\n if (typeof property === 'object' && 'title' in property) {\n return `'${property.title}' ${error.message}`;\n }\n }\n // fall back to property name\n return `'${startCase(propertyName)}' ${error.message}`;\n }\n // fall back if property does not exist\n return error.stack;\n }\n\n return (\n <Paper>\n <List dense className={classes.list}>\n {errors.map((error, index) => (\n <ListItem key={index}>\n <ListItemIcon>\n <ErrorIcon color=\"error\" />\n </ListItemIcon>\n <ListItemText\n classes={{ primary: classes.text }}\n primary={formatErrorMessage(error)}\n />\n </ListItem>\n ))}\n </List>\n </Paper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAyBA,MAAM,SAAA,GAAY,UAAA;AAAA,EAAW,CAAC,WAC5B,YAAA,CAAa;AAAA,IACX,IAAA,EAAM;AAAA,MACJ,KAAA,EAAO;AAAA,KACT;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,QAAA,EAAU;AAAA;AACZ,GACD;AACH,CAAA;AAOO,MAAM,iBAAA,GAAoB,CAAC,EAAE,MAAA,EAAQ,QAAO,KAAsB;AACvE,EAAA,MAAM,UAAU,SAAA,EAAU;AAE1B,EAAA,SAAS,mBAAmB,KAAA,EAA4B;AACtD,IAAA,IAAI,KAAA,CAAM,QAAA,IAAY,KAAA,CAAM,OAAA,EAAS;AACnC,MAAA,MAAM,YAAA,GAAe,KAAA,CAAM,QAAA,CAAS,UAAA,CAAW,GAAG,CAAA,GAC9C,KAAA,CAAM,QAAA,CAAS,SAAA,CAAU,CAAC,CAAA,GAC1B,KAAA,CAAM,QAAA;AACV,MAAA,IAAI,MAAA,CAAO,UAAA,IAAc,YAAA,IAAgB,MAAA,CAAO,UAAA,EAAY;AAC1D,QAAA,MAAM,QAAA,GAAW,MAAA,CAAO,UAAA,CAAW,YAAY,CAAA;AAE/C,QAAA,IAAI,OAAO,QAAA,KAAa,QAAA,IAAY,OAAA,IAAW,QAAA,EAAU;AACvD,UAAA,OAAO,CAAA,CAAA,EAAI,QAAA,CAAS,KAAK,CAAA,EAAA,EAAK,MAAM,OAAO,CAAA,CAAA;AAAA,QAC7C;AAAA,MACF;AAEA,MAAA,OAAO,IAAI,SAAA,CAAU,YAAY,CAAC,CAAA,EAAA,EAAK,MAAM,OAAO,CAAA,CAAA;AAAA,IACtD;AAEA,IAAA,OAAO,KAAA,CAAM,KAAA;AAAA,EACf;AAEA,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,OAAK,IAAA,EAAC,SAAA,EAAW,OAAA,CAAQ,IAAA,EAC5B,iBAAO,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,0BACjB,QAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,YAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,KAAA,EAAM,SAAQ,CAAA,EAC3B,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,EAAE,OAAA,EAAS,OAAA,CAAQ,IAAA,EAAK;AAAA,QACjC,OAAA,EAAS,mBAAmB,KAAK;AAAA;AAAA;AACnC,GAAA,EAAA,EAPa,KAQf,CACD,CAAA,EACH,CAAA,EACF,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionField.esm.js","sources":["../../../../../src/next/components/Stepper/FieldOverrides/DescriptionField.tsx"],"sourcesContent":["/*\n * Copyright 2021 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\nimport { MarkdownContent } from '@backstage/core-components';\nimport { FieldProps } from '@rjsf/utils';\n\nexport const DescriptionField = ({ description }: FieldProps) =>\n description && <MarkdownContent content={description} linkTarget=\"_blank\" />;\n"],"names":[],"mappings":";;;AAmBO,MAAM,gBAAA,GAAmB,CAAC,EAAE,WAAA,EAAY,KAC7C,WAAA,oBAAe,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,WAAA,EAAa,UAAA,EAAW,QAAA,EAAS
|
|
1
|
+
{"version":3,"file":"DescriptionField.esm.js","sources":["../../../../../src/next/components/Stepper/FieldOverrides/DescriptionField.tsx"],"sourcesContent":["/*\n * Copyright 2021 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\nimport { MarkdownContent } from '@backstage/core-components';\nimport { FieldProps } from '@rjsf/utils';\n\nexport const DescriptionField = ({ description }: FieldProps) =>\n description && <MarkdownContent content={description} linkTarget=\"_blank\" />;\n"],"names":[],"mappings":";;;AAmBO,MAAM,gBAAA,GAAmB,CAAC,EAAE,WAAA,EAAY,KAC7C,WAAA,oBAAe,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,WAAA,EAAa,UAAA,EAAW,QAAA,EAAS;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.esm.js","sources":["../../../../src/next/components/Stepper/Stepper.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 { useAnalytics, useApiHolder } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport {\n FieldExtensionOptions,\n FormProps,\n LayoutOptions,\n ReviewStepProps,\n TemplateParameterSchema,\n} from '@backstage/plugin-scaffolder-react';\nimport { JsonValue } from '@backstage/types';\nimport { Button } from '@backstage/ui';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport MuiStep from '@material-ui/core/Step';\nimport MuiStepLabel from '@material-ui/core/StepLabel';\nimport MuiStepper from '@material-ui/core/Stepper';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { type IChangeEvent } from '@rjsf/core';\nimport { ErrorSchema } from '@rjsf/utils';\nimport { customizeValidator } from '@rjsf/validator-ajv8';\nimport ajvErrors from 'ajv-errors';\nimport { merge } from 'lodash';\nimport {\n ComponentType,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { useFormDataFromQuery, useTemplateSchema } from '../../hooks';\nimport { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps';\nimport { Form } from '../Form';\nimport { PasswordWidget } from '../PasswordWidget/PasswordWidget';\nimport { ReviewState, type ReviewStateProps } from '../ReviewState';\nimport {\n createAsyncValidators,\n type FormValidation,\n} from './createAsyncValidators';\nimport { ErrorListTemplate } from './ErrorListTemplate';\nimport * as FieldOverrides from './FieldOverrides';\nimport { hasErrors } from './utils';\n\nconst validator = customizeValidator();\najvErrors(validator.ajv);\n\n/** @alpha */\nexport type BackstageTemplateStepperClassKey =\n | 'backButton'\n | 'footer'\n | 'formWrapper';\n\nconst useStyles = makeStyles(\n theme => ({\n backButton: {\n marginRight: theme.spacing(1),\n },\n footer: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'right',\n marginTop: theme.spacing(2),\n },\n formWrapper: {\n padding: theme.spacing(2),\n },\n }),\n { name: 'BackstageTemplateStepper' },\n);\n\n/**\n * The Props for {@link Stepper} component\n * @alpha\n */\nexport type StepperProps = {\n manifest: TemplateParameterSchema;\n extensions: FieldExtensionOptions<any, any>[];\n /**\n * @deprecated This was only ever used for analytics tracking purposes, which\n * is now handled in the `<Workflow />` component. Passing it in will have no\n * effect.\n */\n templateName?: string;\n formProps?: FormProps;\n initialState?: Record<string, JsonValue>;\n onCreate: (values: Record<string, JsonValue>) => Promise<void>;\n components?: {\n ReviewStepComponent?: ComponentType<ReviewStepProps>;\n ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;\n backButtonText?: ReactNode;\n createButtonText?: ReactNode;\n reviewButtonText?: ReactNode;\n };\n layouts?: LayoutOptions[];\n};\n\n/**\n * The `Stepper` component is the Wizard that is rendered when a user selects a template\n * @alpha\n */\nexport const Stepper = (stepperProps: StepperProps) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const { layouts = [], components = {}, onCreate, ...props } = stepperProps;\n const {\n ReviewStateComponent = ReviewState,\n ReviewStepComponent,\n backButtonText = t('stepper.backButtonText'),\n createButtonText = t('stepper.createButtonText'),\n reviewButtonText = t('stepper.reviewButtonText'),\n } = components;\n const analytics = useAnalytics();\n const { presentation, steps } = useTemplateSchema(props.manifest);\n const apiHolder = useApiHolder();\n const [activeStep, setActiveStep] = useState(0);\n const [isValidating, setIsValidating] = useState(false);\n const [initialState] = useFormDataFromQuery(props.initialState);\n const [stepsState, setStepsState] =\n useState<Record<string, JsonValue>>(initialState);\n\n const [errors, setErrors] = useState<undefined | FormValidation>();\n const styles = useStyles();\n const formWrapperRef = useRef<HTMLDivElement>(null);\n\n const backLabel =\n presentation?.buttonLabels?.backButtonText ?? backButtonText;\n const createLabel =\n presentation?.buttonLabels?.createButtonText ?? createButtonText;\n const reviewLabel =\n presentation?.buttonLabels?.reviewButtonText ?? reviewButtonText;\n\n const extensions = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, component }) => [name, component]),\n );\n }, [props.extensions]);\n\n const fields = useMemo(\n () => ({ ...FieldOverrides, ...extensions }),\n [extensions],\n );\n\n const validators = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, validation }) => [name, validation]),\n );\n }, [props.extensions]);\n\n const validation = useMemo(() => {\n return createAsyncValidators(steps[activeStep]?.mergedSchema, validators, {\n apiHolder,\n });\n }, [steps, activeStep, validators, apiHolder]);\n\n const handleBack = useCallback(() => {\n setActiveStep(prevActiveStep => prevActiveStep - 1);\n }, [setActiveStep]);\n\n const currentStep = useTransformSchemaToProps(steps[activeStep], { layouts });\n\n const {\n formContext: propFormContext,\n uiSchema: propUiSchema,\n liveOmit: _shouldLiveOmit,\n omitExtraData: _shouldOmitExtraData,\n ...restFormProps\n } = props.formProps ?? {};\n\n const handleChange = useCallback(\n (e: IChangeEvent) => {\n setStepsState(current => {\n return { ...current, ...e.formData };\n });\n },\n [setStepsState],\n );\n\n const handleNext = useCallback(\n async ({ formData = {} }: { formData?: Record<string, JsonValue> }) => {\n // The validation should never throw, as the validators are wrapped in a try/catch.\n // This makes it fine to set and unset state without try/catch.\n setErrors(undefined);\n setIsValidating(true);\n\n const returnedValidation = await validation(formData);\n\n setStepsState(current => ({\n ...current,\n ...formData,\n }));\n\n setIsValidating(false);\n\n if (hasErrors(returnedValidation)) {\n setErrors(returnedValidation);\n } else {\n setErrors(undefined);\n setActiveStep(prevActiveStep => {\n const stepNum = prevActiveStep + 1;\n analytics.captureEvent('click', `Next Step (${stepNum})`);\n return stepNum;\n });\n }\n },\n [validation, analytics],\n );\n\n useEffect(() => {\n const getScrollableParent = (\n element: HTMLElement | null,\n ): HTMLElement | null => {\n if (!element) return null;\n const { overflowY } = window.getComputedStyle(element);\n const isScrollable = overflowY === 'auto' || overflowY === 'scroll';\n if (isScrollable && element.scrollHeight > element.clientHeight) {\n return element;\n }\n return getScrollableParent(element.parentElement);\n };\n\n const scrollTarget = getScrollableParent(formWrapperRef.current);\n\n if (scrollTarget && typeof scrollTarget.scrollTo === 'function') {\n scrollTarget.scrollTo({ top: 0, behavior: 'auto' });\n } else {\n window.scrollTo({ top: 0, behavior: 'auto' });\n }\n }, [activeStep]);\n\n const mergedUiSchema = merge({}, propUiSchema, currentStep?.uiSchema);\n\n const [isCreating, setIsCreating] = useState(false);\n\n const handleCreate = useCallback(async () => {\n setIsCreating(true);\n analytics.captureEvent('click', `${createLabel}`);\n try {\n await onCreate(stepsState);\n } finally {\n setIsCreating(false);\n }\n }, [analytics, createLabel, onCreate, stepsState]);\n\n return (\n <>\n {isValidating && <LinearProgress variant=\"indeterminate\" />}\n <MuiStepper\n activeStep={activeStep}\n alternativeLabel\n variant=\"elevation\"\n style={{ overflowX: 'auto' }}\n >\n {steps.map((step, index) => {\n const isAllowedLabelClick = activeStep > index;\n return (\n <MuiStep key={index}>\n <MuiStepLabel\n aria-label={t('stepper.stepIndexLabel', { index: index + 1 })}\n style={{ cursor: isAllowedLabelClick ? 'pointer' : 'default' }}\n onClick={() => {\n if (isAllowedLabelClick) setActiveStep(index);\n }}\n >\n {step.title}\n </MuiStepLabel>\n </MuiStep>\n );\n })}\n <MuiStep>\n <MuiStepLabel>{reviewLabel}</MuiStepLabel>\n </MuiStep>\n </MuiStepper>\n <div className={styles.formWrapper} ref={formWrapperRef}>\n {/* eslint-disable-next-line no-nested-ternary */}\n {activeStep < steps.length ? (\n <Form\n key={activeStep}\n validator={validator}\n extraErrors={errors as unknown as ErrorSchema}\n formData={stepsState}\n formContext={{ ...propFormContext, formData: stepsState }}\n schema={currentStep.schema}\n uiSchema={mergedUiSchema}\n onSubmit={handleNext}\n fields={fields}\n showErrorList=\"top\"\n templates={{ ErrorListTemplate }}\n onChange={handleChange}\n widgets={{ password: PasswordWidget }}\n experimental_defaultFormStateBehavior={{\n allOf: 'populateDefaults',\n }}\n {...restFormProps}\n >\n <div className={styles.footer}>\n <Button\n variant=\"tertiary\"\n onPress={handleBack}\n className={styles.backButton}\n isDisabled={activeStep < 1 || isValidating}\n >\n {backLabel}\n </Button>\n <Button variant=\"primary\" type=\"submit\" isDisabled={isValidating}>\n {activeStep === steps.length - 1\n ? reviewLabel\n : t('stepper.nextButtonText')}\n </Button>\n </div>\n </Form>\n ) : // TODO: potentially move away from this pattern, deprecate?\n ReviewStepComponent ? (\n <ReviewStepComponent\n disableButtons={isValidating}\n formData={stepsState}\n handleBack={handleBack}\n handleReset={() => {}}\n steps={steps}\n handleCreate={handleCreate}\n />\n ) : (\n <>\n <ReviewStateComponent formState={stepsState} schemas={steps} />\n <div className={styles.footer}>\n <Button\n variant=\"tertiary\"\n onPress={handleBack}\n className={styles.backButton}\n isDisabled={activeStep < 1}\n >\n {backLabel}\n </Button>\n <Button\n variant=\"primary\"\n isDisabled={isCreating}\n onPress={handleCreate}\n >\n {createLabel}\n </Button>\n </div>\n </>\n )}\n </div>\n </>\n );\n};\n"],"names":["FieldOverrides","validation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,YAAY,kBAAA,EAAmB;AACrC,SAAA,CAAU,UAAU,GAAG,CAAA;AAQvB,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,UAAA,EAAY;AAAA,MACV,WAAA,EAAa,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,KAC9B;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe,KAAA;AAAA,MACf,cAAA,EAAgB,OAAA;AAAA,MAChB,SAAA,EAAW,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,KAC5B;AA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AAA,EACjD,QAAA,EAAA,UAAA,KAAe,MAAM,MAAA,GAAS,CAAA,GAC3B,WAAA,GACA,CAAA,CAAE,wBAAwB,CAAA,EAChC;AAAA,SAAA,EACF;AAAA,OAAA;AAAA,MAhCK;AAAA,KAiCP;AAAA;AAAA,MAEF,mBAAA,mBACE,GAAA;AAAA,QAAC,mBAAA;AAAA,QAAA;AAAA,UACC,cAAA,EAAgB,YAAA;AAAA,UAChB,QAAA,EAAU,UAAA;AAAA,UACV,UAAA;AAAA,UACA,aAAa,MAAM;AAAA,UAAC,CAAA;AAAA,UACpB,KAAA;AAAA,UACA;AAAA;AAAA,0BAGF,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,SAAA,EAAW,UAAA,EAAY,OAAA,EAAS,KAAA,EAAO,CAAA;AAAA,wBAC7D,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,MAAA,EACrB,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,UAAA;AAAA,cACR,OAAA,EAAS,UAAA;AAAA,cACT,WAAW,MAAA,CAAO,UAAA;AAAA,cAClB,YAAY,UAAA,GAAa,CAAA;AAAA,cAExB,QAAA,EAAA;AAAA;AAAA,WACH;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,SAAA;AAAA,cACR,UAAA,EAAY,UAAA;AAAA,cACZ,OAAA,EAAS,YAAA;AAAA,cAER,QAAA,EAAA;AAAA;AAAA;AACH,SAAA,EACF;AAAA,OAAA,EACF;AAAA,KAAA,EAEJ;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"Stepper.esm.js","sources":["../../../../src/next/components/Stepper/Stepper.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 { useAnalytics, useApiHolder } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport {\n FieldExtensionOptions,\n FormProps,\n LayoutOptions,\n ReviewStepProps,\n TemplateParameterSchema,\n} from '@backstage/plugin-scaffolder-react';\nimport { JsonValue } from '@backstage/types';\nimport { Button } from '@backstage/ui';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport MuiStep from '@material-ui/core/Step';\nimport MuiStepLabel from '@material-ui/core/StepLabel';\nimport MuiStepper from '@material-ui/core/Stepper';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { type IChangeEvent } from '@rjsf/core';\nimport { ErrorSchema } from '@rjsf/utils';\nimport { customizeValidator } from '@rjsf/validator-ajv8';\nimport ajvErrors from 'ajv-errors';\nimport { merge } from 'lodash';\nimport {\n ComponentType,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\nimport { useFormDataFromQuery, useTemplateSchema } from '../../hooks';\nimport { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps';\nimport { Form } from '../Form';\nimport { PasswordWidget } from '../PasswordWidget/PasswordWidget';\nimport { ReviewState, type ReviewStateProps } from '../ReviewState';\nimport {\n createAsyncValidators,\n type FormValidation,\n} from './createAsyncValidators';\nimport { ErrorListTemplate } from './ErrorListTemplate';\nimport * as FieldOverrides from './FieldOverrides';\nimport { hasErrors } from './utils';\n\nconst validator = customizeValidator();\najvErrors(validator.ajv);\n\n/** @alpha */\nexport type BackstageTemplateStepperClassKey =\n | 'backButton'\n | 'footer'\n | 'formWrapper';\n\nconst useStyles = makeStyles(\n theme => ({\n backButton: {\n marginRight: theme.spacing(1),\n },\n footer: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'right',\n marginTop: theme.spacing(2),\n },\n formWrapper: {\n padding: theme.spacing(2),\n },\n }),\n { name: 'BackstageTemplateStepper' },\n);\n\n/**\n * The Props for {@link Stepper} component\n * @alpha\n */\nexport type StepperProps = {\n manifest: TemplateParameterSchema;\n extensions: FieldExtensionOptions<any, any>[];\n /**\n * @deprecated This was only ever used for analytics tracking purposes, which\n * is now handled in the `<Workflow />` component. Passing it in will have no\n * effect.\n */\n templateName?: string;\n formProps?: FormProps;\n initialState?: Record<string, JsonValue>;\n onCreate: (values: Record<string, JsonValue>) => Promise<void>;\n components?: {\n ReviewStepComponent?: ComponentType<ReviewStepProps>;\n ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;\n backButtonText?: ReactNode;\n createButtonText?: ReactNode;\n reviewButtonText?: ReactNode;\n };\n layouts?: LayoutOptions[];\n};\n\n/**\n * The `Stepper` component is the Wizard that is rendered when a user selects a template\n * @alpha\n */\nexport const Stepper = (stepperProps: StepperProps) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n const { layouts = [], components = {}, onCreate, ...props } = stepperProps;\n const {\n ReviewStateComponent = ReviewState,\n ReviewStepComponent,\n backButtonText = t('stepper.backButtonText'),\n createButtonText = t('stepper.createButtonText'),\n reviewButtonText = t('stepper.reviewButtonText'),\n } = components;\n const analytics = useAnalytics();\n const { presentation, steps } = useTemplateSchema(props.manifest);\n const apiHolder = useApiHolder();\n const [activeStep, setActiveStep] = useState(0);\n const [isValidating, setIsValidating] = useState(false);\n const [initialState] = useFormDataFromQuery(props.initialState);\n const [stepsState, setStepsState] =\n useState<Record<string, JsonValue>>(initialState);\n\n const [errors, setErrors] = useState<undefined | FormValidation>();\n const styles = useStyles();\n const formWrapperRef = useRef<HTMLDivElement>(null);\n\n const backLabel =\n presentation?.buttonLabels?.backButtonText ?? backButtonText;\n const createLabel =\n presentation?.buttonLabels?.createButtonText ?? createButtonText;\n const reviewLabel =\n presentation?.buttonLabels?.reviewButtonText ?? reviewButtonText;\n\n const extensions = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, component }) => [name, component]),\n );\n }, [props.extensions]);\n\n const fields = useMemo(\n () => ({ ...FieldOverrides, ...extensions }),\n [extensions],\n );\n\n const validators = useMemo(() => {\n return Object.fromEntries(\n props.extensions.map(({ name, validation }) => [name, validation]),\n );\n }, [props.extensions]);\n\n const validation = useMemo(() => {\n return createAsyncValidators(steps[activeStep]?.mergedSchema, validators, {\n apiHolder,\n });\n }, [steps, activeStep, validators, apiHolder]);\n\n const handleBack = useCallback(() => {\n setActiveStep(prevActiveStep => prevActiveStep - 1);\n }, [setActiveStep]);\n\n const currentStep = useTransformSchemaToProps(steps[activeStep], { layouts });\n\n const {\n formContext: propFormContext,\n uiSchema: propUiSchema,\n liveOmit: _shouldLiveOmit,\n omitExtraData: _shouldOmitExtraData,\n ...restFormProps\n } = props.formProps ?? {};\n\n const handleChange = useCallback(\n (e: IChangeEvent) => {\n setStepsState(current => {\n return { ...current, ...e.formData };\n });\n },\n [setStepsState],\n );\n\n const handleNext = useCallback(\n async ({ formData = {} }: { formData?: Record<string, JsonValue> }) => {\n // The validation should never throw, as the validators are wrapped in a try/catch.\n // This makes it fine to set and unset state without try/catch.\n setErrors(undefined);\n setIsValidating(true);\n\n const returnedValidation = await validation(formData);\n\n setStepsState(current => ({\n ...current,\n ...formData,\n }));\n\n setIsValidating(false);\n\n if (hasErrors(returnedValidation)) {\n setErrors(returnedValidation);\n } else {\n setErrors(undefined);\n setActiveStep(prevActiveStep => {\n const stepNum = prevActiveStep + 1;\n analytics.captureEvent('click', `Next Step (${stepNum})`);\n return stepNum;\n });\n }\n },\n [validation, analytics],\n );\n\n useEffect(() => {\n const getScrollableParent = (\n element: HTMLElement | null,\n ): HTMLElement | null => {\n if (!element) return null;\n const { overflowY } = window.getComputedStyle(element);\n const isScrollable = overflowY === 'auto' || overflowY === 'scroll';\n if (isScrollable && element.scrollHeight > element.clientHeight) {\n return element;\n }\n return getScrollableParent(element.parentElement);\n };\n\n const scrollTarget = getScrollableParent(formWrapperRef.current);\n\n if (scrollTarget && typeof scrollTarget.scrollTo === 'function') {\n scrollTarget.scrollTo({ top: 0, behavior: 'auto' });\n } else {\n window.scrollTo({ top: 0, behavior: 'auto' });\n }\n }, [activeStep]);\n\n const mergedUiSchema = merge({}, propUiSchema, currentStep?.uiSchema);\n\n const [isCreating, setIsCreating] = useState(false);\n\n const handleCreate = useCallback(async () => {\n setIsCreating(true);\n analytics.captureEvent('click', `${createLabel}`);\n try {\n await onCreate(stepsState);\n } finally {\n setIsCreating(false);\n }\n }, [analytics, createLabel, onCreate, stepsState]);\n\n return (\n <>\n {isValidating && <LinearProgress variant=\"indeterminate\" />}\n <MuiStepper\n activeStep={activeStep}\n alternativeLabel\n variant=\"elevation\"\n style={{ overflowX: 'auto' }}\n >\n {steps.map((step, index) => {\n const isAllowedLabelClick = activeStep > index;\n return (\n <MuiStep key={index}>\n <MuiStepLabel\n aria-label={t('stepper.stepIndexLabel', { index: index + 1 })}\n style={{ cursor: isAllowedLabelClick ? 'pointer' : 'default' }}\n onClick={() => {\n if (isAllowedLabelClick) setActiveStep(index);\n }}\n >\n {step.title}\n </MuiStepLabel>\n </MuiStep>\n );\n })}\n <MuiStep>\n <MuiStepLabel>{reviewLabel}</MuiStepLabel>\n </MuiStep>\n </MuiStepper>\n <div className={styles.formWrapper} ref={formWrapperRef}>\n {/* eslint-disable-next-line no-nested-ternary */}\n {activeStep < steps.length ? (\n <Form\n key={activeStep}\n validator={validator}\n extraErrors={errors as unknown as ErrorSchema}\n formData={stepsState}\n formContext={{ ...propFormContext, formData: stepsState }}\n schema={currentStep.schema}\n uiSchema={mergedUiSchema}\n onSubmit={handleNext}\n fields={fields}\n showErrorList=\"top\"\n templates={{ ErrorListTemplate }}\n onChange={handleChange}\n widgets={{ password: PasswordWidget }}\n experimental_defaultFormStateBehavior={{\n allOf: 'populateDefaults',\n }}\n {...restFormProps}\n >\n <div className={styles.footer}>\n <Button\n variant=\"tertiary\"\n onPress={handleBack}\n className={styles.backButton}\n isDisabled={activeStep < 1 || isValidating}\n >\n {backLabel}\n </Button>\n <Button variant=\"primary\" type=\"submit\" isDisabled={isValidating}>\n {activeStep === steps.length - 1\n ? reviewLabel\n : t('stepper.nextButtonText')}\n </Button>\n </div>\n </Form>\n ) : // TODO: potentially move away from this pattern, deprecate?\n ReviewStepComponent ? (\n <ReviewStepComponent\n disableButtons={isValidating}\n formData={stepsState}\n handleBack={handleBack}\n handleReset={() => {}}\n steps={steps}\n handleCreate={handleCreate}\n />\n ) : (\n <>\n <ReviewStateComponent formState={stepsState} schemas={steps} />\n <div className={styles.footer}>\n <Button\n variant=\"tertiary\"\n onPress={handleBack}\n className={styles.backButton}\n isDisabled={activeStep < 1}\n >\n {backLabel}\n </Button>\n <Button\n variant=\"primary\"\n isDisabled={isCreating}\n onPress={handleCreate}\n >\n {createLabel}\n </Button>\n </div>\n </>\n )}\n </div>\n </>\n );\n};\n"],"names":["FieldOverrides","validation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,YAAY,kBAAA,EAAmB;AACrC,SAAA,CAAU,UAAU,GAAG,CAAA;AAQvB,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,UAAA,EAAY;AAAA,MACV,WAAA,EAAa,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,KAC9B;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe,KAAA;AAAA,MACf,cAAA,EAAgB,OAAA;AAAA,MAChB,SAAA,EAAW,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,KAC5B;AAAA,IACA,WAAA,EAAa;AAAA,MACX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AAe,MAAM,MAAA,GAAS,CAAA,GAC3B,WAAA,GACA,CAAA,CAAE,wBAAwB,CAAA,EAChC;AAAA,SAAA,EACF;AAAA,OAAA;AAAA,MAhCK;AAAA,KAiCP;AAAA;AAAA,MAEF,mBAAA,mBACE,GAAA;AAAA,QAAC,mBAAA;AAAA,QAAA;AAAA,UACC,cAAA,EAAgB,YAAA;AAAA,UAChB,QAAA,EAAU,UAAA;AAAA,UACV,UAAA;AAAA,UACA,aAAa,MAAM;AAAA,UAAC,CAAA;AAAA,UACpB,KAAA;AAAA,UACA;AAAA;AAAA,0BAGF,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,SAAA,EAAW,UAAA,EAAY,OAAA,EAAS,KAAA,EAAO,CAAA;AAAA,wBAC7D,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,MAAA,EACrB,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,UAAA;AAAA,cACR,OAAA,EAAS,UAAA;AAAA,cACT,WAAW,MAAA,CAAO,UAAA;AAAA,cAClB,YAAY,UAAA,GAAa,CAAA;AAAA,cAExB,QAAA,EAAA;AAAA;AAAA,WACH;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,SAAA;AAAA,cACR,UAAA,EAAY,UAAA;AAAA,cACZ,OAAA,EAAS,YAAA;AAAA,cAER,QAAA,EAAA;AAAA;AAAA;AACH,SAAA,EACF;AAAA,OAAA,EACF;AAAA,KAAA,EAEJ;AAAA,GAAA,EACF,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAsyncValidators.esm.js","sources":["../../../../src/next/components/Stepper/createAsyncValidators.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\nimport { FieldValidation } from '@rjsf/utils';\nimport type { JsonObject, JsonValue } from '@backstage/types';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport {\n Draft07 as JSONSchema,\n JsonError,\n JsonSchema,\n} from 'json-schema-library';\nimport { createFieldValidation, extractSchemaFromStep } from '../../lib';\nimport {\n CustomFieldValidator,\n FieldExtensionUiSchema,\n} from '@backstage/plugin-scaffolder-react';\nimport { isObject } from './utils';\n\n/** @alpha */\nexport type FormValidation = {\n [name: string]: FieldValidation | FormValidation;\n};\n\nconst isJsonError = (\n value: JsonError | JsonSchema,\n): value is { type: 'error'; message: string } =>\n 'type' in value && value.type === 'error';\n\n/** @alpha */\nexport const createAsyncValidators = (\n rootSchema: JsonObject,\n validators: Record<\n string,\n undefined | CustomFieldValidator<unknown, unknown>\n >,\n context: {\n apiHolder: ApiHolder;\n },\n) => {\n async function validate(\n formData: JsonObject,\n pathPrefix: string = '#',\n current: JsonObject = formData,\n ): Promise<FormValidation> {\n const parsedSchema = new JSONSchema(rootSchema);\n const formValidation: FormValidation = {};\n\n const validateForm = async (\n validatorName: string,\n key: string,\n value: JsonValue | undefined,\n schema: JsonObject,\n uiSchema: FieldExtensionUiSchema<unknown, unknown>,\n ) => {\n const validator = validators[validatorName];\n if (validator) {\n const fieldValidation = createFieldValidation();\n try {\n await validator(value, fieldValidation, {\n ...context,\n formData,\n schema,\n uiSchema,\n });\n } catch (ex) {\n fieldValidation.addError(ex.message);\n }\n formValidation[key] = fieldValidation;\n }\n };\n\n for (const [key, value] of Object.entries(current)) {\n const pointer = `${pathPrefix}/${key}`;\n const definitionInSchema = parsedSchema.getSchema({\n pointer,\n data: formData,\n });\n\n if (!definitionInSchema) {\n continue;\n }\n\n if (isJsonError(definitionInSchema)) {\n throw new Error(definitionInSchema.message);\n }\n\n const { schema, uiSchema } = extractSchemaFromStep(\n definitionInSchema as JsonObject,\n );\n\n const hasItems = definitionInSchema && definitionInSchema.items;\n\n const doValidateItem = async (\n propValue: JsonObject,\n itemSchema: JsonObject,\n itemUiSchema: FieldExtensionUiSchema<unknown, unknown>,\n ) => {\n await validateForm(\n propValue['ui:field'] as string,\n key,\n value,\n itemSchema,\n itemUiSchema,\n );\n };\n\n const doValidate = async (propValue: JsonObject) => {\n if ('ui:field' in propValue) {\n const { schema: itemsSchema, uiSchema: itemsUiSchema } =\n extractSchemaFromStep(definitionInSchema.items);\n await doValidateItem(propValue, itemsSchema, itemsUiSchema);\n }\n };\n\n const doValidateDependency = async (propValue: JsonObject) => {\n const { schema: itemsSchema, uiSchema: itemsUiSchema } =\n extractSchemaFromStep(propValue);\n await doValidateItem(propValue, itemsSchema, itemsUiSchema);\n\n const iterable = Array.isArray(value) ? value : [value];\n for (const item of iterable) {\n if (item && isObject(item)) {\n const keys = Object.keys(item);\n for (const k of keys) {\n if (itemsUiSchema[k] && 'ui:field' in itemsUiSchema[k]) {\n await validateForm(\n itemsUiSchema[k]['ui:field'],\n k,\n item[k],\n itemsSchema,\n itemsUiSchema,\n );\n }\n }\n }\n }\n };\n\n if ('ui:field' in definitionInSchema) {\n await doValidateItem(definitionInSchema, schema, uiSchema);\n } else if (hasItems && 'ui:field' in definitionInSchema.items) {\n await doValidate(definitionInSchema.items);\n } else if (hasItems && definitionInSchema.items.type === 'object') {\n const properties = (definitionInSchema.items?.properties ??\n []) as JsonObject[];\n for (const [, propValue] of Object.entries(properties)) {\n await doValidate(propValue);\n }\n\n const dependencies = (definitionInSchema.items?.dependencies ??\n []) as JsonObject[];\n for (const [, propValue] of Object.entries(dependencies)) {\n await doValidateDependency(propValue);\n }\n } else if (isObject(value)) {\n formValidation[key] = await validate(formData, pointer, value);\n }\n }\n\n return formValidation;\n }\n\n return async (formData: JsonObject) => {\n return await validate(formData);\n };\n};\n"],"names":["JSONSchema"],"mappings":";;;;AAoCA,MAAM,cAAc,CAClB,KAAA,KAEA,MAAA,IAAU,KAAA,IAAS,MAAM,IAAA,KAAS,OAAA;AAG7B,MAAM,qBAAA,GAAwB,CACnC,UAAA,EACA,UAAA,EAIA,OAAA,KAGG;AACH,EAAA,eAAe,QAAA,CACb,QAAA,EACA,UAAA,GAAqB,GAAA,EACrB,UAAsB,QAAA,EACG;AACzB,IAAA,MAAM,YAAA,GAAe,IAAIA,OAAA,CAAW,UAAU,CAAA;AAC9C,IAAA,MAAM,iBAAiC,EAAC;AAExC,IAAA,MAAM,eAAe,OACnB,aAAA,EACA,GAAA,EACA,KAAA,EACA,QACA,QAAA,KACG;AACH,MAAA,MAAM,SAAA,GAAY,WAAW,aAAa,CAAA;AAC1C,MAAA,IAAI,SAAA,EAAW;AACb,QAAA,MAAM,kBAAkB,qBAAA,EAAsB;AAC9C,QAAA,IAAI;AACF,UAAA,MAAM,SAAA,CAAU,OAAO,eAAA,EAAiB;AAAA,YACtC,GAAG,OAAA;AAAA,YACH,QAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA,WACD,CAAA;AAAA,QACH,SAAS,EAAA,EAAI;AACX,UAAA,eAAA,CAAgB,QAAA,CAAS,GAAG,OAAO,CAAA;AAAA,QACrC;AACA,QAAA,cAAA,CAAe,GAAG,CAAA,GAAI,eAAA;AAAA,MACxB;AAAA,IACF,CAAA;AAEA,IAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAA,EAAG;AAClD,MAAA,MAAM,OAAA,GAAU,CAAA,EAAG,UAAU,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA;AACpC,MAAA,MAAM,kBAAA,GAAqB,aAAa,SAAA,CAAU;AAAA,QAChD,OAAA;AAA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C;AAAA,MACF,CAAA,MAAA,IAAW,QAAA,CAAS,KAAK,CAAA,EAAG;AAC1B,QAAA,cAAA,CAAe,GAAG,CAAA,GAAI,MAAM,QAAA,CAAS,QAAA,EAAU,SAAS,KAAK,CAAA;AAAA,MAC/D;AAAA,IACF;AAEA,IAAA,OAAO,cAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,QAAA,KAAyB;AACrC,IAAA,OAAO,MAAM,SAAS,QAAQ,CAAA;AAAA,EAChC,CAAA;AACF
|
|
1
|
+
{"version":3,"file":"createAsyncValidators.esm.js","sources":["../../../../src/next/components/Stepper/createAsyncValidators.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\nimport { FieldValidation } from '@rjsf/utils';\nimport type { JsonObject, JsonValue } from '@backstage/types';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport {\n Draft07 as JSONSchema,\n JsonError,\n JsonSchema,\n} from 'json-schema-library';\nimport { createFieldValidation, extractSchemaFromStep } from '../../lib';\nimport {\n CustomFieldValidator,\n FieldExtensionUiSchema,\n} from '@backstage/plugin-scaffolder-react';\nimport { isObject } from './utils';\n\n/** @alpha */\nexport type FormValidation = {\n [name: string]: FieldValidation | FormValidation;\n};\n\nconst isJsonError = (\n value: JsonError | JsonSchema,\n): value is { type: 'error'; message: string } =>\n 'type' in value && value.type === 'error';\n\n/** @alpha */\nexport const createAsyncValidators = (\n rootSchema: JsonObject,\n validators: Record<\n string,\n undefined | CustomFieldValidator<unknown, unknown>\n >,\n context: {\n apiHolder: ApiHolder;\n },\n) => {\n async function validate(\n formData: JsonObject,\n pathPrefix: string = '#',\n current: JsonObject = formData,\n ): Promise<FormValidation> {\n const parsedSchema = new JSONSchema(rootSchema);\n const formValidation: FormValidation = {};\n\n const validateForm = async (\n validatorName: string,\n key: string,\n value: JsonValue | undefined,\n schema: JsonObject,\n uiSchema: FieldExtensionUiSchema<unknown, unknown>,\n ) => {\n const validator = validators[validatorName];\n if (validator) {\n const fieldValidation = createFieldValidation();\n try {\n await validator(value, fieldValidation, {\n ...context,\n formData,\n schema,\n uiSchema,\n });\n } catch (ex) {\n fieldValidation.addError(ex.message);\n }\n formValidation[key] = fieldValidation;\n }\n };\n\n for (const [key, value] of Object.entries(current)) {\n const pointer = `${pathPrefix}/${key}`;\n const definitionInSchema = parsedSchema.getSchema({\n pointer,\n data: formData,\n });\n\n if (!definitionInSchema) {\n continue;\n }\n\n if (isJsonError(definitionInSchema)) {\n throw new Error(definitionInSchema.message);\n }\n\n const { schema, uiSchema } = extractSchemaFromStep(\n definitionInSchema as JsonObject,\n );\n\n const hasItems = definitionInSchema && definitionInSchema.items;\n\n const doValidateItem = async (\n propValue: JsonObject,\n itemSchema: JsonObject,\n itemUiSchema: FieldExtensionUiSchema<unknown, unknown>,\n ) => {\n await validateForm(\n propValue['ui:field'] as string,\n key,\n value,\n itemSchema,\n itemUiSchema,\n );\n };\n\n const doValidate = async (propValue: JsonObject) => {\n if ('ui:field' in propValue) {\n const { schema: itemsSchema, uiSchema: itemsUiSchema } =\n extractSchemaFromStep(definitionInSchema.items);\n await doValidateItem(propValue, itemsSchema, itemsUiSchema);\n }\n };\n\n const doValidateDependency = async (propValue: JsonObject) => {\n const { schema: itemsSchema, uiSchema: itemsUiSchema } =\n extractSchemaFromStep(propValue);\n await doValidateItem(propValue, itemsSchema, itemsUiSchema);\n\n const iterable = Array.isArray(value) ? value : [value];\n for (const item of iterable) {\n if (item && isObject(item)) {\n const keys = Object.keys(item);\n for (const k of keys) {\n if (itemsUiSchema[k] && 'ui:field' in itemsUiSchema[k]) {\n await validateForm(\n itemsUiSchema[k]['ui:field'],\n k,\n item[k],\n itemsSchema,\n itemsUiSchema,\n );\n }\n }\n }\n }\n };\n\n if ('ui:field' in definitionInSchema) {\n await doValidateItem(definitionInSchema, schema, uiSchema);\n } else if (hasItems && 'ui:field' in definitionInSchema.items) {\n await doValidate(definitionInSchema.items);\n } else if (hasItems && definitionInSchema.items.type === 'object') {\n const properties = (definitionInSchema.items?.properties ??\n []) as JsonObject[];\n for (const [, propValue] of Object.entries(properties)) {\n await doValidate(propValue);\n }\n\n const dependencies = (definitionInSchema.items?.dependencies ??\n []) as JsonObject[];\n for (const [, propValue] of Object.entries(dependencies)) {\n await doValidateDependency(propValue);\n }\n } else if (isObject(value)) {\n formValidation[key] = await validate(formData, pointer, value);\n }\n }\n\n return formValidation;\n }\n\n return async (formData: JsonObject) => {\n return await validate(formData);\n };\n};\n"],"names":["JSONSchema"],"mappings":";;;;AAoCA,MAAM,cAAc,CAClB,KAAA,KAEA,MAAA,IAAU,KAAA,IAAS,MAAM,IAAA,KAAS,OAAA;AAG7B,MAAM,qBAAA,GAAwB,CACnC,UAAA,EACA,UAAA,EAIA,OAAA,KAGG;AACH,EAAA,eAAe,QAAA,CACb,QAAA,EACA,UAAA,GAAqB,GAAA,EACrB,UAAsB,QAAA,EACG;AACzB,IAAA,MAAM,YAAA,GAAe,IAAIA,OAAA,CAAW,UAAU,CAAA;AAC9C,IAAA,MAAM,iBAAiC,EAAC;AAExC,IAAA,MAAM,eAAe,OACnB,aAAA,EACA,GAAA,EACA,KAAA,EACA,QACA,QAAA,KACG;AACH,MAAA,MAAM,SAAA,GAAY,WAAW,aAAa,CAAA;AAC1C,MAAA,IAAI,SAAA,EAAW;AACb,QAAA,MAAM,kBAAkB,qBAAA,EAAsB;AAC9C,QAAA,IAAI;AACF,UAAA,MAAM,SAAA,CAAU,OAAO,eAAA,EAAiB;AAAA,YACtC,GAAG,OAAA;AAAA,YACH,QAAA;AAAA,YACA,MAAA;AAAA,YAC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,CAAM,SAAS,QAAA,EAAU;AACjE,QAAA,MAAM,UAAA,GAAc,kBAAA,CAAmB,KAAA,EAAO,UAAA,IAC5C,EAAC;AACH,QAAA,KAAA,MAAW,GAAG,SAAS,KAAK,MAAA,CAAO,OAAA,CAAQ,UAAU,CAAA,EAAG;AACtD,UAAA,MAAM,WAAW,SAAS,CAAA;AAAA,QAC5B;AAEA,QAAA,MAAM,YAAA,GAAgB,kBAAA,CAAmB,KAAA,EAAO,YAAA,IAC9C,EAAC;AACH,QAAA,KAAA,MAAW,GAAG,SAAS,KAAK,MAAA,CAAO,OAAA,CAAQ,YAAY,CAAA,EAAG;AACxD,UAAA,MAAM,qBAAqB,SAAS,CAAA;AAAA,QACtC;AAAA,MACF,CAAA,MAAA,IAAW,QAAA,CAAS,KAAK,CAAA,EAAG;AAC1B,QAAA,cAAA,CAAe,GAAG,CAAA,GAAI,MAAM,QAAA,CAAS,QAAA,EAAU,SAAS,KAAK,CAAA;AAAA,MAC/D;AAAA,IACF;AAEA,IAAA,OAAO,cAAA;AAAA,EACT;AAEA,EAAA,OAAO,OAAO,QAAA,KAAyB;AACrC,IAAA,OAAO,MAAM,SAAS,QAAQ,CAAA;AAAA,EAChC,CAAA;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.esm.js","sources":["../../../../src/next/components/Stepper/utils.ts"],"sourcesContent":["/*\n * Copyright 2023 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 type { JsonObject, JsonValue } from '@backstage/types';\nimport type { FieldValidation } from '@rjsf/utils';\nimport { FormValidation } from './createAsyncValidators';\n\nfunction isFieldValidation(error: any): error is FieldValidation {\n return !!error && '__errors' in error;\n}\n\nexport function hasErrors(errors?: FormValidation): boolean {\n if (!errors) {\n return false;\n }\n\n for (const error of Object.values(errors)) {\n if (isFieldValidation(error)) {\n if ((error.__errors ?? []).length > 0) {\n return true;\n }\n\n continue;\n }\n\n if (hasErrors(error)) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function isObject(value: JsonValue | undefined): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"],"names":[],"mappings":"AAmBA,SAAS,kBAAkB,KAAA,EAAsC;AAC/D,EAAA,OAAO,CAAC,CAAC,KAAA,IAAS,UAAA,IAAc,KAAA;AAClC;AAEO,SAAS,UAAU,MAAA,EAAkC;AAC1D,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,KAAA,MAAW,KAAA,IAAS,MAAA,CAAO,MAAA,CAAO,MAAM,CAAA,EAAG;AACzC,IAAA,IAAI,iBAAA,CAAkB,KAAK,CAAA,EAAG;AAC5B,MAAA,IAAA,CAAK,KAAA,CAAM,QAAA,IAAY,EAAC,EAAG,SAAS,CAAA,EAAG;AACrC,QAAA,OAAO,IAAA;AAAA,MACT;AAEA,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,SAAA,CAAU,KAAK,CAAA,EAAG;AACpB,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF;AAEA,EAAA,OAAO,KAAA;AACT;AAEO,SAAS,SAAS,KAAA,EAAmD;AAC1E,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E
|
|
1
|
+
{"version":3,"file":"utils.esm.js","sources":["../../../../src/next/components/Stepper/utils.ts"],"sourcesContent":["/*\n * Copyright 2023 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 type { JsonObject, JsonValue } from '@backstage/types';\nimport type { FieldValidation } from '@rjsf/utils';\nimport { FormValidation } from './createAsyncValidators';\n\nfunction isFieldValidation(error: any): error is FieldValidation {\n return !!error && '__errors' in error;\n}\n\nexport function hasErrors(errors?: FormValidation): boolean {\n if (!errors) {\n return false;\n }\n\n for (const error of Object.values(errors)) {\n if (isFieldValidation(error)) {\n if ((error.__errors ?? []).length > 0) {\n return true;\n }\n\n continue;\n }\n\n if (hasErrors(error)) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function isObject(value: JsonValue | undefined): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"],"names":[],"mappings":"AAmBA,SAAS,kBAAkB,KAAA,EAAsC;AAC/D,EAAA,OAAO,CAAC,CAAC,KAAA,IAAS,UAAA,IAAc,KAAA;AAClC;AAEO,SAAS,UAAU,MAAA,EAAkC;AAC1D,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,KAAA,MAAW,KAAA,IAAS,MAAA,CAAO,MAAA,CAAO,MAAM,CAAA,EAAG;AACzC,IAAA,IAAI,iBAAA,CAAkB,KAAK,CAAA,EAAG;AAC5B,MAAA,IAAA,CAAK,KAAA,CAAM,QAAA,IAAY,EAAC,EAAG,SAAS,CAAA,EAAG;AACrC,QAAA,OAAO,IAAA;AAAA,MACT;AAEA,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,SAAA,CAAU,KAAK,CAAA,EAAG;AACpB,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF;AAEA,EAAA,OAAO,KAAA;AACT;AAEO,SAAS,SAAS,KAAA,EAAmD;AAC1E,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskLogStream.esm.js","sources":["../../../../src/next/components/TaskLogStream/TaskLogStream.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { LogViewer } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useDownloadLogs } from '../../hooks/useDownloadLogs';\n\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n height: '100%',\n position: 'relative',\n minHeight: 240,\n },\n});\n\n/**\n * The text of the event stream\n *\n * @alpha\n */\nexport const TaskLogStream = (props: { logs: { [k: string]: string[] } }) => {\n const styles = useStyles();\n\n const onDownloadLogs = useDownloadLogs(props.logs);\n\n return (\n <div className={styles.root}>\n <LogViewer\n onDownloadLog={onDownloadLogs}\n text={Object.values(props.logs)\n .map(l => l.join('\\n'))\n .filter(Boolean)\n .join('\\n')}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AAmBA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,IAAA,EAAM;AAAA,IACJ,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,MAAA;AAAA,IACR,QAAA,EAAU,UAAA;AAAA,IACV,SAAA,EAAW;AAAA;AAEf,CAAC,CAAA;AAOM,MAAM,aAAA,GAAgB,CAAC,KAAA,KAA+C;AAC3E,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,MAAM,cAAA,GAAiB,eAAA,CAAgB,KAAA,CAAM,IAAI,CAAA;AAEjD,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,IAAA,EACrB,QAAA,kBAAA,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAe,cAAA;AAAA,MACf,MAAM,MAAA,CAAO,MAAA,CAAO,KAAA,CAAM,IAAI,EAC3B,GAAA,CAAI,CAAA,CAAA,KAAK,CAAA,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,CACrB,OAAO,OAAO,CAAA,CACd,KAAK,IAAI;AAAA;AAAA,GACd,EACF,CAAA;AAEJ
|
|
1
|
+
{"version":3,"file":"TaskLogStream.esm.js","sources":["../../../../src/next/components/TaskLogStream/TaskLogStream.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { LogViewer } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useDownloadLogs } from '../../hooks/useDownloadLogs';\n\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n height: '100%',\n position: 'relative',\n minHeight: 240,\n },\n});\n\n/**\n * The text of the event stream\n *\n * @alpha\n */\nexport const TaskLogStream = (props: { logs: { [k: string]: string[] } }) => {\n const styles = useStyles();\n\n const onDownloadLogs = useDownloadLogs(props.logs);\n\n return (\n <div className={styles.root}>\n <LogViewer\n onDownloadLog={onDownloadLogs}\n text={Object.values(props.logs)\n .map(l => l.join('\\n'))\n .filter(Boolean)\n .join('\\n')}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AAmBA,MAAM,YAAY,UAAA,CAAW;AAAA,EAC3B,IAAA,EAAM;AAAA,IACJ,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,MAAA;AAAA,IACR,QAAA,EAAU,UAAA;AAAA,IACV,SAAA,EAAW;AAAA;AAEf,CAAC,CAAA;AAOM,MAAM,aAAA,GAAgB,CAAC,KAAA,KAA+C;AAC3E,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,MAAM,cAAA,GAAiB,eAAA,CAAgB,KAAA,CAAM,IAAI,CAAA;AAEjD,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,IAAA,EACrB,QAAA,kBAAA,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAe,cAAA;AAAA,MACf,MAAM,MAAA,CAAO,MAAA,CAAO,KAAA,CAAM,IAAI,EAC3B,GAAA,CAAI,CAAA,CAAA,KAAK,CAAA,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,CACrB,OAAO,OAAO,CAAA,CACd,KAAK,IAAI;AAAA;AAAA,GACd,EACF,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepIcon.esm.js","sources":["../../../../src/next/components/TaskSteps/StepIcon.tsx"],"sourcesContent":["/*\n * Copyright 2023 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\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { StepIconProps } from '@material-ui/core/StepIcon';\nimport { makeStyles } from '@material-ui/core/styles';\nimport RemoveCircleOutline from '@material-ui/icons/RemoveCircleOutline';\nimport PanoramaFishEyeIcon from '@material-ui/icons/PanoramaFishEye';\nimport classNames from 'classnames';\nimport CheckCircleOutline from '@material-ui/icons/CheckCircleOutline';\nimport ErrorOutline from '@material-ui/icons/ErrorOutline';\n\nconst useStepIconStyles = makeStyles(theme => ({\n root: {\n color: theme.palette.text.disabled,\n },\n completed: {\n color: theme.palette.status.ok,\n },\n error: {\n color: theme.palette.status.error,\n },\n}));\n\nexport const StepIcon = (props: StepIconProps & { skipped: boolean }) => {\n const classes = useStepIconStyles();\n const { active, completed, error, skipped } = props;\n\n const getMiddle = () => {\n if (active) {\n return <CircularProgress size=\"20px\" />;\n }\n if (completed) {\n return <CheckCircleOutline />;\n }\n\n if (error) {\n return <ErrorOutline />;\n }\n\n if (skipped) {\n return <RemoveCircleOutline />;\n }\n\n return <PanoramaFishEyeIcon />;\n };\n\n return (\n <div\n className={classNames(classes.root, {\n [classes.completed]: completed,\n [classes.error]: error,\n })}\n >\n {getMiddle()}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAyBA,MAAM,iBAAA,GAAoB,WAAW,CAAA,KAAA,MAAU;AAAA,EAC7C,IAAA,EAAM;AAAA,IACJ,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK;AAAA,GAC5B;AAAA,EACA,SAAA,EAAW;AAAA,IACT,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,GAC9B;AAAA,EACA,KAAA,EAAO;AAAA,IACL,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA;AAEhC,CAAA,CAAE,CAAA;AAEK,MAAM,QAAA,GAAW,CAAC,KAAA,KAAgD;AACvE,EAAA,MAAM,UAAU,iBAAA,EAAkB;AAClC,EAAA,MAAM,EAAE,MAAA,EAAQ,SAAA,EAAW,KAAA,EAAO,SAAQ,GAAI,KAAA;AAE9C,EAAA,MAAM,YAAY,MAAM;AACtB,IAAA,IAAI,MAAA,EAAQ;AACV,MAAA,uBAAO,GAAA,CAAC,gBAAA,EAAA,EAAiB,IAAA,EAAK,MAAA,EAAO,CAAA;AAAA,IACvC;AACA,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,2BAAQ,kBAAA,EAAA,EAAmB,CAAA;AAAA,IAC7B;AAEA,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,2BAAQ,YAAA,EAAA,EAAa,CAAA;AAAA,IACvB;AAEA,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,2BAAQ,mBAAA,EAAA,EAAoB,CAAA;AAAA,IAC9B;AAEA,IAAA,2BAAQ,mBAAA,EAAA,EAAoB,CAAA;AAAA,EAC9B,CAAA;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,UAAA,CAAW,OAAA,CAAQ,IAAA,EAAM;AAAA,QAClC,CAAC,OAAA,CAAQ,SAAS,GAAG,SAAA;AAAA,QACrB,CAAC,OAAA,CAAQ,KAAK,GAAG;AAAA,OAClB,CAAA;AAAA,MAEA,QAAA,EAAA,SAAA;AAAU;AAAA,GACb;AAEJ
|
|
1
|
+
{"version":3,"file":"StepIcon.esm.js","sources":["../../../../src/next/components/TaskSteps/StepIcon.tsx"],"sourcesContent":["/*\n * Copyright 2023 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\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { StepIconProps } from '@material-ui/core/StepIcon';\nimport { makeStyles } from '@material-ui/core/styles';\nimport RemoveCircleOutline from '@material-ui/icons/RemoveCircleOutline';\nimport PanoramaFishEyeIcon from '@material-ui/icons/PanoramaFishEye';\nimport classNames from 'classnames';\nimport CheckCircleOutline from '@material-ui/icons/CheckCircleOutline';\nimport ErrorOutline from '@material-ui/icons/ErrorOutline';\n\nconst useStepIconStyles = makeStyles(theme => ({\n root: {\n color: theme.palette.text.disabled,\n },\n completed: {\n color: theme.palette.status.ok,\n },\n error: {\n color: theme.palette.status.error,\n },\n}));\n\nexport const StepIcon = (props: StepIconProps & { skipped: boolean }) => {\n const classes = useStepIconStyles();\n const { active, completed, error, skipped } = props;\n\n const getMiddle = () => {\n if (active) {\n return <CircularProgress size=\"20px\" />;\n }\n if (completed) {\n return <CheckCircleOutline />;\n }\n\n if (error) {\n return <ErrorOutline />;\n }\n\n if (skipped) {\n return <RemoveCircleOutline />;\n }\n\n return <PanoramaFishEyeIcon />;\n };\n\n return (\n <div\n className={classNames(classes.root, {\n [classes.completed]: completed,\n [classes.error]: error,\n })}\n >\n {getMiddle()}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAyBA,MAAM,iBAAA,GAAoB,WAAW,CAAA,KAAA,MAAU;AAAA,EAC7C,IAAA,EAAM;AAAA,IACJ,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK;AAAA,GAC5B;AAAA,EACA,SAAA,EAAW;AAAA,IACT,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,GAC9B;AAAA,EACA,KAAA,EAAO;AAAA,IACL,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA;AAEhC,CAAA,CAAE,CAAA;AAEK,MAAM,QAAA,GAAW,CAAC,KAAA,KAAgD;AACvE,EAAA,MAAM,UAAU,iBAAA,EAAkB;AAClC,EAAA,MAAM,EAAE,MAAA,EAAQ,SAAA,EAAW,KAAA,EAAO,SAAQ,GAAI,KAAA;AAE9C,EAAA,MAAM,YAAY,MAAM;AACtB,IAAA,IAAI,MAAA,EAAQ;AACV,MAAA,uBAAO,GAAA,CAAC,gBAAA,EAAA,EAAiB,IAAA,EAAK,MAAA,EAAO,CAAA;AAAA,IACvC;AACA,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,2BAAQ,kBAAA,EAAA,EAAmB,CAAA;AAAA,IAC7B;AAEA,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,2BAAQ,YAAA,EAAA,EAAa,CAAA;AAAA,IACvB;AAEA,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,2BAAQ,mBAAA,EAAA,EAAoB,CAAA;AAAA,IAC9B;AAEA,IAAA,2BAAQ,mBAAA,EAAA,EAAoB,CAAA;AAAA,EAC9B,CAAA;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,UAAA,CAAW,OAAA,CAAQ,IAAA,EAAM;AAAA,QAClC,CAAC,OAAA,CAAQ,SAAS,GAAG,SAAA;AAAA,QACrB,CAAC,OAAA,CAAQ,KAAK,GAAG;AAAA,OAClB,CAAA;AAAA,MAEA,QAAA,EAAA,SAAA;AAAU;AAAA,GACb;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepTime.esm.js","sources":["../../../../src/next/components/TaskSteps/StepTime.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { useCallback, useState } from 'react';\nimport useInterval from 'react-use/esm/useInterval';\nimport { DateTime, Interval } from 'luxon';\nimport humanizeDuration from 'humanize-duration';\nimport Typography from '@material-ui/core/Typography';\nimport { useMountEffect } from '@react-hookz/web';\n\nexport const StepTime = (props: {\n step: {\n id: string;\n name: string;\n startedAt?: string;\n endedAt?: string;\n };\n}) => {\n const [time, setTime] = useState('');\n const { step } = props;\n\n const getDelay = () => {\n if (step.startedAt && step.endedAt && time) {\n return null;\n }\n if (step.startedAt && step.endedAt) {\n return 1;\n }\n return 1000;\n };\n\n const calculate = useCallback(() => {\n if (!step.startedAt) {\n setTime('');\n return;\n }\n\n const end = step.endedAt\n ? DateTime.fromISO(step.endedAt)\n : DateTime.local();\n\n const startedAt = DateTime.fromISO(step.startedAt);\n const formatted = Interval.fromDateTimes(startedAt, end)\n .toDuration()\n .valueOf();\n\n setTime(humanizeDuration(formatted, { round: true }));\n }, [step.endedAt, step.startedAt]);\n\n useMountEffect(calculate);\n useInterval(calculate, getDelay());\n\n return <Typography variant=\"caption\">{time}</Typography>;\n};\n"],"names":[],"mappings":";;;;;;;;AAsBO,MAAM,QAAA,GAAW,CAAC,KAAA,KAOnB;AACJ,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,EAAE,CAAA;AACnC,EAAA,MAAM,EAAE,MAAK,GAAI,KAAA;AAEjB,EAAA,MAAM,WAAW,MAAM;AACrB,IAAA,IAAI,IAAA,CAAK,SAAA,IAAa,IAAA,CAAK,OAAA,IAAW,IAAA,EAAM;AAC1C,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,IAAI,IAAA,CAAK,SAAA,IAAa,IAAA,CAAK,OAAA,EAAS;AAClC,MAAA,OAAO,CAAA;AAAA,IACT;AACA,IAAA,OAAO,GAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,SAAA,GAAY,YAAY,MAAM;AAClC,IAAA,IAAI,CAAC,KAAK,SAAA,EAAW;AACnB,MAAA,OAAA,CAAQ,EAAE,CAAA;AACV,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,GAAA,GAAM,KAAK,OAAA,GACb,QAAA,CAAS,QAAQ,IAAA,CAAK,OAAO,CAAA,GAC7B,QAAA,CAAS,KAAA,EAAM;AAEnB,IAAA,MAAM,SAAA,GAAY,QAAA,CAAS,OAAA,CAAQ,IAAA,CAAK,SAAS,CAAA;AACjD,IAAA,MAAM,SAAA,GAAY,SAAS,aAAA,CAAc,SAAA,EAAW,GAAG,CAAA,CACpD,UAAA,GACA,OAAA,EAAQ;AAEX,IAAA,OAAA,CAAQ,iBAAiB,SAAA,EAAW,EAAE,KAAA,EAAO,IAAA,EAAM,CAAC,CAAA;AAAA,EACtD,GAAG,CAAC,IAAA,CAAK,OAAA,EAAS,IAAA,CAAK,SAAS,CAAC,CAAA;AAEjC,EAAA,cAAA,CAAe,SAAS,CAAA;AACxB,EAAA,WAAA,CAAY,SAAA,EAAW,UAAU,CAAA;AAEjC,EAAA,uBAAO,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,SAAA,EAAW,QAAA,EAAA,IAAA,EAAK,CAAA;AAC7C
|
|
1
|
+
{"version":3,"file":"StepTime.esm.js","sources":["../../../../src/next/components/TaskSteps/StepTime.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { useCallback, useState } from 'react';\nimport useInterval from 'react-use/esm/useInterval';\nimport { DateTime, Interval } from 'luxon';\nimport humanizeDuration from 'humanize-duration';\nimport Typography from '@material-ui/core/Typography';\nimport { useMountEffect } from '@react-hookz/web';\n\nexport const StepTime = (props: {\n step: {\n id: string;\n name: string;\n startedAt?: string;\n endedAt?: string;\n };\n}) => {\n const [time, setTime] = useState('');\n const { step } = props;\n\n const getDelay = () => {\n if (step.startedAt && step.endedAt && time) {\n return null;\n }\n if (step.startedAt && step.endedAt) {\n return 1;\n }\n return 1000;\n };\n\n const calculate = useCallback(() => {\n if (!step.startedAt) {\n setTime('');\n return;\n }\n\n const end = step.endedAt\n ? DateTime.fromISO(step.endedAt)\n : DateTime.local();\n\n const startedAt = DateTime.fromISO(step.startedAt);\n const formatted = Interval.fromDateTimes(startedAt, end)\n .toDuration()\n .valueOf();\n\n setTime(humanizeDuration(formatted, { round: true }));\n }, [step.endedAt, step.startedAt]);\n\n useMountEffect(calculate);\n useInterval(calculate, getDelay());\n\n return <Typography variant=\"caption\">{time}</Typography>;\n};\n"],"names":[],"mappings":";;;;;;;;AAsBO,MAAM,QAAA,GAAW,CAAC,KAAA,KAOnB;AACJ,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,EAAE,CAAA;AACnC,EAAA,MAAM,EAAE,MAAK,GAAI,KAAA;AAEjB,EAAA,MAAM,WAAW,MAAM;AACrB,IAAA,IAAI,IAAA,CAAK,SAAA,IAAa,IAAA,CAAK,OAAA,IAAW,IAAA,EAAM;AAC1C,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,IAAI,IAAA,CAAK,SAAA,IAAa,IAAA,CAAK,OAAA,EAAS;AAClC,MAAA,OAAO,CAAA;AAAA,IACT;AACA,IAAA,OAAO,GAAA;AAAA,EACT,CAAA;AAEA,EAAA,MAAM,SAAA,GAAY,YAAY,MAAM;AAClC,IAAA,IAAI,CAAC,KAAK,SAAA,EAAW;AACnB,MAAA,OAAA,CAAQ,EAAE,CAAA;AACV,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,GAAA,GAAM,KAAK,OAAA,GACb,QAAA,CAAS,QAAQ,IAAA,CAAK,OAAO,CAAA,GAC7B,QAAA,CAAS,KAAA,EAAM;AAEnB,IAAA,MAAM,SAAA,GAAY,QAAA,CAAS,OAAA,CAAQ,IAAA,CAAK,SAAS,CAAA;AACjD,IAAA,MAAM,SAAA,GAAY,SAAS,aAAA,CAAc,SAAA,EAAW,GAAG,CAAA,CACpD,UAAA,GACA,OAAA,EAAQ;AAEX,IAAA,OAAA,CAAQ,iBAAiB,SAAA,EAAW,EAAE,KAAA,EAAO,IAAA,EAAM,CAAC,CAAA;AAAA,EACtD,GAAG,CAAC,IAAA,CAAK,OAAA,EAAS,IAAA,CAAK,SAAS,CAAC,CAAA;AAEjC,EAAA,cAAA,CAAe,SAAS,CAAA;AACxB,EAAA,WAAA,CAAY,SAAA,EAAW,UAAU,CAAA;AAEjC,EAAA,uBAAO,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,SAAA,EAAW,QAAA,EAAA,IAAA,EAAK,CAAA;AAC7C;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskBorder.esm.js","sources":["../../../../src/next/components/TaskSteps/TaskBorder.tsx"],"sourcesContent":["/*\n * Copyright 2023 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\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n failed: {\n backgroundColor: theme.palette.error.main,\n },\n success: {\n backgroundColor: theme.palette.success.main,\n },\n}));\n\n/**\n * The visual progress of the task event stream\n */\nexport const TaskBorder = (props: {\n isComplete: boolean;\n isError: boolean;\n}) => {\n const styles = useStyles();\n\n if (!props.isComplete) {\n return <LinearProgress variant=\"indeterminate\" />;\n }\n\n return (\n <LinearProgress\n variant=\"determinate\"\n classes={{ bar: props.isError ? styles.failed : styles.success }}\n value={100}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAmBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,MAAA,EAAQ;AAAA,IACN,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,KAAA,CAAM;AAAA,GACvC;AAAA,EACA,OAAA,EAAS;AAAA,IACP,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,OAAA,CAAQ;AAAA;AAE3C,CAAA,CAAE,CAAA;AAKK,MAAM,UAAA,GAAa,CAAC,KAAA,KAGrB;AACJ,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,IAAI,CAAC,MAAM,UAAA,EAAY;AACrB,IAAA,uBAAO,GAAA,CAAC,cAAA,EAAA,EAAe,OAAA,EAAQ,eAAA,EAAgB,CAAA;AAAA,EACjD;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAQ,aAAA;AAAA,MACR,OAAA,EAAS,EAAE,GAAA,EAAK,KAAA,CAAM,UAAU,MAAA,CAAO,MAAA,GAAS,OAAO,OAAA,EAAQ;AAAA,MAC/D,KAAA,EAAO;AAAA;AAAA,GACT;AAEJ
|
|
1
|
+
{"version":3,"file":"TaskBorder.esm.js","sources":["../../../../src/next/components/TaskSteps/TaskBorder.tsx"],"sourcesContent":["/*\n * Copyright 2023 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\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n failed: {\n backgroundColor: theme.palette.error.main,\n },\n success: {\n backgroundColor: theme.palette.success.main,\n },\n}));\n\n/**\n * The visual progress of the task event stream\n */\nexport const TaskBorder = (props: {\n isComplete: boolean;\n isError: boolean;\n}) => {\n const styles = useStyles();\n\n if (!props.isComplete) {\n return <LinearProgress variant=\"indeterminate\" />;\n }\n\n return (\n <LinearProgress\n variant=\"determinate\"\n classes={{ bar: props.isError ? styles.failed : styles.success }}\n value={100}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAmBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,MAAA,EAAQ;AAAA,IACN,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,KAAA,CAAM;AAAA,GACvC;AAAA,EACA,OAAA,EAAS;AAAA,IACP,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,OAAA,CAAQ;AAAA;AAE3C,CAAA,CAAE,CAAA;AAKK,MAAM,UAAA,GAAa,CAAC,KAAA,KAGrB;AACJ,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,IAAI,CAAC,MAAM,UAAA,EAAY;AACrB,IAAA,uBAAO,GAAA,CAAC,cAAA,EAAA,EAAe,OAAA,EAAQ,eAAA,EAAgB,CAAA;AAAA,EACjD;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAQ,aAAA;AAAA,MACR,OAAA,EAAS,EAAE,GAAA,EAAK,KAAA,CAAM,UAAU,MAAA,CAAO,MAAA,GAAS,OAAO,OAAA,EAAQ;AAAA,MAC/D,KAAA,EAAO;AAAA;AAAA,GACT;AAEJ;;"}
|