@kartverket/backstage-plugin-risk-scorecard 1.1.0 → 1.2.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.
Files changed (120) hide show
  1. package/dist/PluginRoot.esm.js +21 -0
  2. package/dist/PluginRoot.esm.js.map +1 -0
  3. package/dist/components/common/Dropdown.esm.js +79 -0
  4. package/dist/components/common/Dropdown.esm.js.map +1 -0
  5. package/dist/components/common/EditButton.esm.js +16 -0
  6. package/dist/components/common/EditButton.esm.js.map +1 -0
  7. package/dist/components/common/Icons.esm.js +27 -0
  8. package/dist/components/common/Icons.esm.js.map +1 -0
  9. package/dist/components/common/Input.esm.js +44 -0
  10. package/dist/components/common/Input.esm.js.map +1 -0
  11. package/dist/components/common/Select.esm.js +85 -0
  12. package/dist/components/common/Select.esm.js.map +1 -0
  13. package/dist/components/common/Spinner.esm.js +11 -0
  14. package/dist/components/common/Spinner.esm.js.map +1 -0
  15. package/dist/components/common/Textfield.esm.js +64 -0
  16. package/dist/components/common/Textfield.esm.js.map +1 -0
  17. package/dist/components/common/mixins.esm.js +9 -0
  18. package/dist/components/common/mixins.esm.js.map +1 -0
  19. package/dist/components/common/typography.esm.js +59 -0
  20. package/dist/components/common/typography.esm.js.map +1 -0
  21. package/dist/components/riScDialog/RiScDialog.esm.js +70 -0
  22. package/dist/components/riScDialog/RiScDialog.esm.js.map +1 -0
  23. package/dist/components/riScInfo/RiScInfo.esm.js +43 -0
  24. package/dist/components/riScInfo/RiScInfo.esm.js.map +1 -0
  25. package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js +165 -0
  26. package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js.map +1 -0
  27. package/dist/components/riScPlugin/RiScPlugin.esm.js +102 -0
  28. package/dist/components/riScPlugin/RiScPlugin.esm.js.map +1 -0
  29. package/dist/components/riskMatrix/AggregatedCost.esm.js +29 -0
  30. package/dist/components/riskMatrix/AggregatedCost.esm.js.map +1 -0
  31. package/dist/components/riskMatrix/EstimatedRiskInfoDialog.esm.js +19 -0
  32. package/dist/components/riskMatrix/EstimatedRiskInfoDialog.esm.js.map +1 -0
  33. package/dist/components/riskMatrix/RiskMatrix.esm.js +67 -0
  34. package/dist/components/riskMatrix/RiskMatrix.esm.js.map +1 -0
  35. package/dist/components/riskMatrix/RiskMatrixScenarioCount.esm.js +86 -0
  36. package/dist/components/riskMatrix/RiskMatrixScenarioCount.esm.js.map +1 -0
  37. package/dist/components/riskMatrix/Tabs.esm.js +40 -0
  38. package/dist/components/riskMatrix/Tabs.esm.js.map +1 -0
  39. package/dist/components/riskMatrix/aggregatedCostStyle.esm.js +16 -0
  40. package/dist/components/riskMatrix/aggregatedCostStyle.esm.js.map +1 -0
  41. package/dist/components/riskMatrix/estimatedRiskInfoDialogStyle.esm.js +17 -0
  42. package/dist/components/riskMatrix/estimatedRiskInfoDialogStyle.esm.js.map +1 -0
  43. package/dist/components/riskMatrix/riskMatrixStyle.esm.js +73 -0
  44. package/dist/components/riskMatrix/riskMatrixStyle.esm.js.map +1 -0
  45. package/dist/components/riskMatrix/tabsStyle.esm.js +15 -0
  46. package/dist/components/riskMatrix/tabsStyle.esm.js.map +1 -0
  47. package/dist/components/scenarioDrawer/ScenarioDrawer.esm.js +145 -0
  48. package/dist/components/scenarioDrawer/ScenarioDrawer.esm.js.map +1 -0
  49. package/dist/components/scenarioDrawer/components/ActionBox.esm.js +77 -0
  50. package/dist/components/scenarioDrawer/components/ActionBox.esm.js.map +1 -0
  51. package/dist/components/scenarioDrawer/components/ActionFormSection.esm.js +120 -0
  52. package/dist/components/scenarioDrawer/components/ActionFormSection.esm.js.map +1 -0
  53. package/dist/components/scenarioDrawer/components/ActionsSection.esm.js +28 -0
  54. package/dist/components/scenarioDrawer/components/ActionsSection.esm.js.map +1 -0
  55. package/dist/components/scenarioDrawer/components/DeleteConfirmation.esm.js +18 -0
  56. package/dist/components/scenarioDrawer/components/DeleteConfirmation.esm.js.map +1 -0
  57. package/dist/components/scenarioDrawer/components/RiskFormSection.esm.js +73 -0
  58. package/dist/components/scenarioDrawer/components/RiskFormSection.esm.js.map +1 -0
  59. package/dist/components/scenarioDrawer/components/RiskSection.esm.js +56 -0
  60. package/dist/components/scenarioDrawer/components/RiskSection.esm.js.map +1 -0
  61. package/dist/components/scenarioDrawer/components/ScopeFormSection.esm.js +72 -0
  62. package/dist/components/scenarioDrawer/components/ScopeFormSection.esm.js.map +1 -0
  63. package/dist/components/scenarioDrawer/components/ScopeSection.esm.js +33 -0
  64. package/dist/components/scenarioDrawer/components/ScopeSection.esm.js.map +1 -0
  65. package/dist/components/scenarioDrawer/scenarioDrawerComponents.esm.js +10 -0
  66. package/dist/components/scenarioDrawer/scenarioDrawerComponents.esm.js.map +1 -0
  67. package/dist/components/scenarioTable/ScenarioTable.esm.js +79 -0
  68. package/dist/components/scenarioTable/ScenarioTable.esm.js.map +1 -0
  69. package/dist/components/scenarioTable/ScenarioTableRow.esm.js +57 -0
  70. package/dist/components/scenarioTable/ScenarioTableRow.esm.js.map +1 -0
  71. package/dist/components/scenarioTable/ScenarioTableStyles.esm.js +71 -0
  72. package/dist/components/scenarioTable/ScenarioTableStyles.esm.js.map +1 -0
  73. package/dist/components/scenarioWizard/ScenarioWizard.esm.js +176 -0
  74. package/dist/components/scenarioWizard/ScenarioWizard.esm.js.map +1 -0
  75. package/dist/components/scenarioWizard/components/ActionEdit.esm.js +111 -0
  76. package/dist/components/scenarioWizard/components/ActionEdit.esm.js.map +1 -0
  77. package/dist/components/scenarioWizard/components/CloseConfirmation.esm.js +20 -0
  78. package/dist/components/scenarioWizard/components/CloseConfirmation.esm.js.map +1 -0
  79. package/dist/components/scenarioWizard/components/ConsequenceTable.esm.js +70 -0
  80. package/dist/components/scenarioWizard/components/ConsequenceTable.esm.js.map +1 -0
  81. package/dist/components/scenarioWizard/components/ProbabilityTable.esm.js +42 -0
  82. package/dist/components/scenarioWizard/components/ProbabilityTable.esm.js.map +1 -0
  83. package/dist/components/scenarioWizard/steps/ActionsStep.esm.js +37 -0
  84. package/dist/components/scenarioWizard/steps/ActionsStep.esm.js.map +1 -0
  85. package/dist/components/scenarioWizard/steps/RiskStep.esm.js +64 -0
  86. package/dist/components/scenarioWizard/steps/RiskStep.esm.js.map +1 -0
  87. package/dist/components/scenarioWizard/steps/ScenarioStep.esm.js +75 -0
  88. package/dist/components/scenarioWizard/steps/ScenarioStep.esm.js.map +1 -0
  89. package/dist/components/scenarioWizard/wizardStyles.esm.js +32 -0
  90. package/dist/components/scenarioWizard/wizardStyles.esm.js.map +1 -0
  91. package/dist/contexts/RiScContext.esm.js +265 -0
  92. package/dist/contexts/RiScContext.esm.js.map +1 -0
  93. package/dist/contexts/ScenarioContext.esm.js +275 -0
  94. package/dist/contexts/ScenarioContext.esm.js.map +1 -0
  95. package/dist/index.esm.js +2 -3
  96. package/dist/index.esm.js.map +1 -1
  97. package/dist/plugin.esm.js +21 -0
  98. package/dist/plugin.esm.js.map +1 -0
  99. package/dist/risc_schema_en_v4_0.json.esm.js +287 -0
  100. package/dist/risc_schema_en_v4_0.json.esm.js.map +1 -0
  101. package/dist/routes.esm.js +18 -0
  102. package/dist/routes.esm.js.map +1 -0
  103. package/dist/utils/DTOs.esm.js +73 -0
  104. package/dist/utils/DTOs.esm.js.map +1 -0
  105. package/dist/utils/constants.esm.js +17 -0
  106. package/dist/utils/constants.esm.js.map +1 -0
  107. package/dist/utils/hooks.esm.js +144 -0
  108. package/dist/utils/hooks.esm.js.map +1 -0
  109. package/dist/utils/style.esm.js +109 -0
  110. package/dist/utils/style.esm.js.map +1 -0
  111. package/dist/{esm/index-c11a7a42.esm.js → utils/translations.esm.js} +73 -85
  112. package/dist/utils/translations.esm.js.map +1 -0
  113. package/dist/utils/types.esm.js +31 -0
  114. package/dist/utils/types.esm.js.map +1 -0
  115. package/dist/utils/utilityfunctions.esm.js +86 -0
  116. package/dist/utils/utilityfunctions.esm.js.map +1 -0
  117. package/package.json +16 -12
  118. package/dist/esm/index-99d0fef8.esm.js +0 -3481
  119. package/dist/esm/index-99d0fef8.esm.js.map +0 -1
  120. package/dist/esm/index-c11a7a42.esm.js.map +0 -1
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { Routes, Route } from 'react-router-dom';
3
+ import { CacheProvider } from '@emotion/react';
4
+ import createCache from '@emotion/cache';
5
+ import { RiScPlugin } from './components/riScPlugin/RiScPlugin.esm.js';
6
+ import { ScenarioProvider } from './contexts/ScenarioContext.esm.js';
7
+ import { riScRouteRef, scenarioRouteRef } from './routes.esm.js';
8
+ import { RiScProvider } from './contexts/RiScContext.esm.js';
9
+
10
+ const emotionInsertionPoint = document.createElement("meta");
11
+ emotionInsertionPoint.setAttribute("name", "emotion-insertion-point");
12
+ document.querySelector("head")?.appendChild(emotionInsertionPoint);
13
+ const cache = createCache({
14
+ key: "css",
15
+ insertionPoint: emotionInsertionPoint
16
+ });
17
+ const ProvidedPlugin = () => /* @__PURE__ */ React.createElement(CacheProvider, { value: cache }, /* @__PURE__ */ React.createElement(RiScProvider, null, /* @__PURE__ */ React.createElement(ScenarioProvider, null, /* @__PURE__ */ React.createElement(RiScPlugin, null))));
18
+ const PluginRoot = () => /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: "/", element: /* @__PURE__ */ React.createElement(ProvidedPlugin, null) }), /* @__PURE__ */ React.createElement(Route, { path: riScRouteRef.path, element: /* @__PURE__ */ React.createElement(ProvidedPlugin, null) }), /* @__PURE__ */ React.createElement(Route, { path: scenarioRouteRef.path, element: /* @__PURE__ */ React.createElement(ProvidedPlugin, null) }));
19
+
20
+ export { PluginRoot };
21
+ //# sourceMappingURL=PluginRoot.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PluginRoot.esm.js","sources":["../src/PluginRoot.tsx"],"sourcesContent":["import React from 'react';\nimport { Route, Routes } from 'react-router-dom';\nimport { CacheProvider } from '@emotion/react';\nimport createCache from '@emotion/cache';\nimport { RiScPlugin } from './components/riScPlugin/RiScPlugin';\nimport { ScenarioProvider } from './contexts/ScenarioContext';\nimport { riScRouteRef, scenarioRouteRef } from './routes';\nimport { RiScProvider } from './contexts/RiScContext';\n\nconst emotionInsertionPoint = document.createElement('meta');\nemotionInsertionPoint.setAttribute('name', 'emotion-insertion-point');\ndocument.querySelector('head')?.appendChild(emotionInsertionPoint);\n\nconst cache = createCache({\n key: 'css',\n insertionPoint: emotionInsertionPoint,\n});\n\nconst ProvidedPlugin = () => (\n <CacheProvider value={cache}>\n <RiScProvider>\n <ScenarioProvider>\n <RiScPlugin />\n </ScenarioProvider>\n </RiScProvider>\n </CacheProvider>\n);\n\nexport const PluginRoot = () => (\n <Routes>\n <Route path=\"/\" element={<ProvidedPlugin />} />\n <Route path={riScRouteRef.path} element={<ProvidedPlugin />} />\n <Route path={scenarioRouteRef.path} element={<ProvidedPlugin />} />\n </Routes>\n);\n"],"names":[],"mappings":";;;;;;;;;AASA,MAAM,qBAAA,GAAwB,QAAS,CAAA,aAAA,CAAc,MAAM,CAAA,CAAA;AAC3D,qBAAsB,CAAA,YAAA,CAAa,QAAQ,yBAAyB,CAAA,CAAA;AACpE,QAAA,CAAS,aAAc,CAAA,MAAM,CAAG,EAAA,WAAA,CAAY,qBAAqB,CAAA,CAAA;AAEjE,MAAM,QAAQ,WAAY,CAAA;AAAA,EACxB,GAAK,EAAA,KAAA;AAAA,EACL,cAAgB,EAAA,qBAAA;AAClB,CAAC,CAAA,CAAA;AAED,MAAM,cAAiB,GAAA,sBACpB,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,OAAO,KACpB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,gBACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,IAAA,CACd,CACF,CACF,CAAA,CAAA;AAGK,MAAM,UAAa,GAAA,sBACvB,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,sCACE,KAAM,EAAA,EAAA,IAAA,EAAK,GAAI,EAAA,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAe,CAAI,EAAA,CAAA,sCAC5C,KAAM,EAAA,EAAA,IAAA,EAAM,YAAa,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,IAAA,CAAA,EAAI,mBAC5D,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,IAAM,EAAA,gBAAA,CAAiB,IAAM,EAAA,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAe,GAAI,CACnE;;;;"}
@@ -0,0 +1,79 @@
1
+ import Box from '@material-ui/core/Box';
2
+ import Checkbox from '@material-ui/core/Checkbox';
3
+ import Chip from '@material-ui/core/Chip';
4
+ import FormControl from '@material-ui/core/FormControl';
5
+ import FormLabel from '@material-ui/core/FormLabel';
6
+ import ListItemIcon from '@material-ui/core/ListItemIcon';
7
+ import ListItemText from '@material-ui/core/ListItemText';
8
+ import MenuItem from '@material-ui/core/MenuItem';
9
+ import Select from '@material-ui/core/Select';
10
+ import React from 'react';
11
+ import { FormHelperText } from '@material-ui/core';
12
+ import { useInputFieldStyles, menuProps } from '../../utils/style.esm.js';
13
+
14
+ const Dropdown = ({
15
+ label,
16
+ options,
17
+ selectedValues,
18
+ handleChange,
19
+ error,
20
+ required,
21
+ variant = "outlined",
22
+ renderSelectedValue
23
+ }) => {
24
+ const { formLabel, formControl } = useInputFieldStyles();
25
+ const multiple = Array.isArray(selectedValues);
26
+ function getOptionsValue(option) {
27
+ return typeof option === "string" ? option : option.value;
28
+ }
29
+ function getOptionsRenderValue(option) {
30
+ return typeof option === "string" ? option : option.renderedValue;
31
+ }
32
+ function renderSelectedValueHandler(value) {
33
+ if (renderSelectedValue) {
34
+ return renderSelectedValue(value);
35
+ }
36
+ return value;
37
+ }
38
+ const onChange = (event) => handleChange(event.target.value);
39
+ const renderValue = (selected) => multiple ? /* @__PURE__ */ React.createElement(
40
+ Box,
41
+ {
42
+ sx: {
43
+ display: "flex",
44
+ flexWrap: "wrap",
45
+ marginBottom: 0,
46
+ paddingBottom: 0
47
+ }
48
+ },
49
+ selected.map((value) => /* @__PURE__ */ React.createElement(Chip, { key: value, label: renderSelectedValueHandler(value) }))
50
+ ) : selected;
51
+ return /* @__PURE__ */ React.createElement(FormControl, { className: formControl }, label && /* @__PURE__ */ React.createElement(FormLabel, { className: formLabel, required }, label), /* @__PURE__ */ React.createElement(
52
+ Select,
53
+ {
54
+ multiple,
55
+ value: selectedValues,
56
+ onChange,
57
+ variant,
58
+ MenuProps: menuProps,
59
+ renderValue,
60
+ error: !!error,
61
+ SelectDisplayProps: multiple ? {
62
+ style: {
63
+ paddingBottom: 8,
64
+ paddingTop: 16,
65
+ minHeight: 40
66
+ }
67
+ } : {}
68
+ },
69
+ options.map((name) => /* @__PURE__ */ React.createElement(MenuItem, { key: getOptionsValue(name), value: getOptionsValue(name) }, multiple && /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(
70
+ Checkbox,
71
+ {
72
+ checked: selectedValues.indexOf(getOptionsValue(name)) > -1
73
+ }
74
+ )), /* @__PURE__ */ React.createElement(ListItemText, { primary: getOptionsRenderValue(name) })))
75
+ ), error && /* @__PURE__ */ React.createElement(FormHelperText, { error: true }, error));
76
+ };
77
+
78
+ export { Dropdown };
79
+ //# sourceMappingURL=Dropdown.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.esm.js","sources":["../../../src/components/common/Dropdown.tsx"],"sourcesContent":["import Box from '@material-ui/core/Box';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Chip from '@material-ui/core/Chip';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormLabel from '@material-ui/core/FormLabel';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport React, { ChangeEvent } from 'react';\nimport { FormHelperText } from '@material-ui/core';\nimport { menuProps, useInputFieldStyles } from '../../utils/style';\n\ntype OptionsObject = {\n value: string;\n renderedValue: string;\n};\ninterface DropdownProps<T> {\n options: string[] | OptionsObject[];\n selectedValues: T;\n handleChange: (value: T) => void;\n error?: string | null;\n required?: boolean;\n label?: string;\n variant?: 'standard' | 'outlined' | 'filled';\n renderSelectedValue?: (selectedValue: string) => string;\n}\n\nexport const Dropdown = <T,>({\n label,\n options,\n selectedValues,\n handleChange,\n error,\n required,\n variant = 'outlined',\n renderSelectedValue,\n}: DropdownProps<T>) => {\n const { formLabel, formControl } = useInputFieldStyles();\n\n const multiple = Array.isArray(selectedValues);\n\n function getOptionsValue(option: DropdownProps<T>['options'][0]): string {\n return typeof option === 'string' ? option : option.value;\n }\n\n function getOptionsRenderValue(\n option: DropdownProps<T>['options'][0],\n ): string {\n return typeof option === 'string' ? option : option.renderedValue;\n }\n\n function renderSelectedValueHandler(value: string): string {\n if (renderSelectedValue) {\n return renderSelectedValue(value);\n }\n return value;\n }\n\n const onChange = (event: ChangeEvent<{ value: unknown }>) =>\n handleChange(event.target.value as T);\n\n const renderValue = (selected: any) =>\n multiple ? (\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'wrap',\n marginBottom: 0,\n paddingBottom: 0,\n }}\n >\n {selected.map((value: string) => (\n <Chip key={value} label={renderSelectedValueHandler(value)} />\n ))}\n </Box>\n ) : (\n selected\n );\n\n return (\n <FormControl className={formControl}>\n {label && (\n <FormLabel className={formLabel} required={required}>\n {label}\n </FormLabel>\n )}\n <Select\n multiple={multiple}\n value={selectedValues}\n onChange={onChange}\n variant={variant}\n MenuProps={menuProps}\n renderValue={renderValue}\n error={!!error}\n SelectDisplayProps={\n multiple\n ? {\n style: {\n paddingBottom: 8,\n paddingTop: 16,\n minHeight: 40,\n },\n }\n : {}\n }\n >\n {options.map(name => (\n <MenuItem key={getOptionsValue(name)} value={getOptionsValue(name)}>\n {multiple && (\n <ListItemIcon>\n <Checkbox\n checked={selectedValues.indexOf(getOptionsValue(name)) > -1}\n />\n </ListItemIcon>\n )}\n <ListItemText primary={getOptionsRenderValue(name)} />\n </MenuItem>\n ))}\n </Select>\n {error && <FormHelperText error>{error}</FormHelperText>}\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AA4BO,MAAM,WAAW,CAAK;AAAA,EAC3B,KAAA;AAAA,EACA,OAAA;AAAA,EACA,cAAA;AAAA,EACA,YAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAU,GAAA,UAAA;AAAA,EACV,mBAAA;AACF,CAAwB,KAAA;AACtB,EAAA,MAAM,EAAE,SAAA,EAAW,WAAY,EAAA,GAAI,mBAAoB,EAAA,CAAA;AAEvD,EAAM,MAAA,QAAA,GAAW,KAAM,CAAA,OAAA,CAAQ,cAAc,CAAA,CAAA;AAE7C,EAAA,SAAS,gBAAgB,MAAgD,EAAA;AACvE,IAAA,OAAO,OAAO,MAAA,KAAW,QAAW,GAAA,MAAA,GAAS,MAAO,CAAA,KAAA,CAAA;AAAA,GACtD;AAEA,EAAA,SAAS,sBACP,MACQ,EAAA;AACR,IAAA,OAAO,OAAO,MAAA,KAAW,QAAW,GAAA,MAAA,GAAS,MAAO,CAAA,aAAA,CAAA;AAAA,GACtD;AAEA,EAAA,SAAS,2BAA2B,KAAuB,EAAA;AACzD,IAAA,IAAI,mBAAqB,EAAA;AACvB,MAAA,OAAO,oBAAoB,KAAK,CAAA,CAAA;AAAA,KAClC;AACA,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAEA,EAAA,MAAM,WAAW,CAAC,KAAA,KAChB,YAAa,CAAA,KAAA,CAAM,OAAO,KAAU,CAAA,CAAA;AAEtC,EAAM,MAAA,WAAA,GAAc,CAAC,QAAA,KACnB,QACE,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,GAAA;AAAA,I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A;AAAA,QACC,SAAS,cAAe,CAAA,OAAA,CAAQ,eAAgB,CAAA,IAAI,CAAC,CAAI,GAAA,CAAA,CAAA;AAAA,OAAA;AAAA,KAE7D,mBAED,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,SAAS,qBAAsB,CAAA,IAAI,CAAG,EAAA,CACtD,CACD,CAAA;AAAA,KAEF,KAAS,oBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,KAAK,EAAA,IAAA,EAAA,EAAE,KAAM,CACzC,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { makeStyles, IconButton } from '@material-ui/core';
3
+ import EditIcon from '@mui/icons-material/Edit';
4
+
5
+ const useEditButtonStyle = makeStyles((theme) => ({
6
+ icon: {
7
+ color: theme.palette.type === "dark" ? "#fff" : "rgba(0, 0, 0, 0.54)"
8
+ }
9
+ }));
10
+ const EditButton = (props) => {
11
+ const { icon } = useEditButtonStyle();
12
+ return /* @__PURE__ */ React.createElement(IconButton, { size: "small", ...props }, /* @__PURE__ */ React.createElement(EditIcon, { className: icon, "aria-label": "Edit" }));
13
+ };
14
+
15
+ export { EditButton as default };
16
+ //# sourceMappingURL=EditButton.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditButton.esm.js","sources":["../../../src/components/common/EditButton.tsx"],"sourcesContent":["import React from 'react';\nimport {\n IconButton,\n IconButtonProps,\n Theme,\n makeStyles,\n} from '@material-ui/core';\nimport EditIcon from '@mui/icons-material/Edit';\n\nconst useEditButtonStyle = makeStyles((theme: Theme) => ({\n icon: {\n color: theme.palette.type === 'dark' ? '#fff' : 'rgba(0, 0, 0, 0.54)',\n },\n}));\n\nconst EditButton = (props: IconButtonProps) => {\n const { icon } = useEditButtonStyle();\n\n return (\n <IconButton size=\"small\" {...props}>\n <EditIcon className={icon} aria-label=\"Edit\" />\n </IconButton>\n );\n};\n\nexport default EditButton;\n"],"names":[],"mappings":";;;;AASA,MAAM,kBAAA,GAAqB,UAAW,CAAA,CAAC,KAAkB,MAAA;AAAA,EACvD,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,KAAS,SAAS,MAAS,GAAA,qBAAA;AAAA,GAClD;AACF,CAAE,CAAA,CAAA,CAAA;AAEI,MAAA,UAAA,GAAa,CAAC,KAA2B,KAAA;AAC7C,EAAM,MAAA,EAAE,IAAK,EAAA,GAAI,kBAAmB,EAAA,CAAA;AAEpC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,IAAK,EAAA,OAAA,EAAS,GAAG,KAAA,EAAA,kBAC1B,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,SAAW,EAAA,IAAA,EAAM,YAAW,EAAA,MAAA,EAAO,CAC/C,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import SvgIcon from '@mui/material/SvgIcon';
3
+
4
+ const PullRequestSvg = () => /* @__PURE__ */ React.createElement(
5
+ SvgIcon,
6
+ {
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ viewBox: "0 0 16 16",
9
+ sx: {
10
+ width: "24px",
11
+ height: "16px",
12
+ fill: "none",
13
+ transform: "translateY(2px)",
14
+ color: (theme) => theme.palette.mode === "dark" ? "white" : "rgba(0, 0, 0, 0.87)"
15
+ }
16
+ },
17
+ /* @__PURE__ */ React.createElement(
18
+ "path",
19
+ {
20
+ d: "M9.55625 0.065625C9.825 0.184375 10 0.453125 10 0.75V2.25H10.5C12.5719 2.25 14.25 3.92812 14.25 6V11.1156C15.2656 11.4344 16 12.3813 16 13.5C16 14.8813 14.8813 16 13.5 16C12.1187 16 11 14.8813 11 13.5C11 12.3813 11.7344 11.4344 12.75 11.1156V6C12.75 4.75625 11.7437 3.75 10.5 3.75H10V5.25C10 5.54688 9.825 5.81562 9.55625 5.93437C9.2875 6.05312 8.96875 6.00625 8.75 5.80625L6.25 3.55625C6.09062 3.4125 6.00313 3.2125 6.00313 3C6.00313 2.7875 6.09375 2.58437 6.25 2.44375L8.75 0.19375C8.96875 -0.00312501 9.2875 -0.053125 9.55625 0.065625ZM3.5 2.5C3.5 2.23478 3.39464 1.98043 3.20711 1.79289C3.01957 1.60536 2.76522 1.5 2.5 1.5C2.23478 1.5 1.98043 1.60536 1.79289 1.79289C1.60536 1.98043 1.5 2.23478 1.5 2.5C1.5 2.76522 1.60536 3.01957 1.79289 3.20711C1.98043 3.39464 2.23478 3.5 2.5 3.5C2.76522 3.5 3.01957 3.39464 3.20711 3.20711C3.39464 3.01957 3.5 2.76522 3.5 2.5ZM3.25 4.88438V11.1156C4.26562 11.4344 5 12.3813 5 13.5C5 14.8813 3.88125 16 2.5 16C1.11875 16 0 14.8813 0 13.5C0 12.3813 0.734375 11.4344 1.75 11.1156V4.88438C0.734375 4.56563 0 3.61875 0 2.5C0 1.11875 1.11875 0 2.5 0C3.88125 0 5 1.11875 5 2.5C5 3.61875 4.26562 4.56563 3.25 4.88438ZM3.5 13.5C3.5 13.2348 3.39464 12.9804 3.20711 12.7929C3.01957 12.6054 2.76522 12.5 2.5 12.5C2.23478 12.5 1.98043 12.6054 1.79289 12.7929C1.60536 12.9804 1.5 13.2348 1.5 13.5C1.5 13.7652 1.60536 14.0196 1.79289 14.2071C1.98043 14.3946 2.23478 14.5 2.5 14.5C2.76522 14.5 3.01957 14.3946 3.20711 14.2071C3.39464 14.0196 3.5 13.7652 3.5 13.5ZM13.5 14.5C13.7652 14.5 14.0196 14.3946 14.2071 14.2071C14.3946 14.0196 14.5 13.7652 14.5 13.5C14.5 13.2348 14.3946 12.9804 14.2071 12.7929C14.0196 12.6054 13.7652 12.5 13.5 12.5C13.2348 12.5 12.9804 12.6054 12.7929 12.7929C12.6054 12.9804 12.5 13.2348 12.5 13.5C12.5 13.7652 12.6054 14.0196 12.7929 14.2071C12.9804 14.3946 13.2348 14.5 13.5 14.5Z",
21
+ fill: "currentColor"
22
+ }
23
+ )
24
+ );
25
+
26
+ export { PullRequestSvg };
27
+ //# sourceMappingURL=Icons.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icons.esm.js","sources":["../../../src/components/common/Icons.tsx"],"sourcesContent":["import React from 'react';\nimport SvgIcon from '@mui/material/SvgIcon';\n\nexport const PullRequestSvg = () => (\n <SvgIcon\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 16\"\n sx={{\n width: '24px',\n height: '16px',\n fill: 'none',\n transform: 'translateY(2px)',\n color: theme =>\n theme.palette.mode === 'dark' ? 'white' : 'rgba(0, 0, 0, 0.87)',\n }}\n >\n <path\n d=\"M9.55625 0.065625C9.825 0.184375 10 0.453125 10 0.75V2.25H10.5C12.5719 2.25 14.25 3.92812 14.25 6V11.1156C15.2656 11.4344 16 12.3813 16 13.5C16 14.8813 14.8813 16 13.5 16C12.1187 16 11 14.8813 11 13.5C11 12.3813 11.7344 11.4344 12.75 11.1156V6C12.75 4.75625 11.7437 3.75 10.5 3.75H10V5.25C10 5.54688 9.825 5.81562 9.55625 5.93437C9.2875 6.05312 8.96875 6.00625 8.75 5.80625L6.25 3.55625C6.09062 3.4125 6.00313 3.2125 6.00313 3C6.00313 2.7875 6.09375 2.58437 6.25 2.44375L8.75 0.19375C8.96875 -0.00312501 9.2875 -0.053125 9.55625 0.065625ZM3.5 2.5C3.5 2.23478 3.39464 1.98043 3.20711 1.79289C3.01957 1.60536 2.76522 1.5 2.5 1.5C2.23478 1.5 1.98043 1.60536 1.79289 1.79289C1.60536 1.98043 1.5 2.23478 1.5 2.5C1.5 2.76522 1.60536 3.01957 1.79289 3.20711C1.98043 3.39464 2.23478 3.5 2.5 3.5C2.76522 3.5 3.01957 3.39464 3.20711 3.20711C3.39464 3.01957 3.5 2.76522 3.5 2.5ZM3.25 4.88438V11.1156C4.26562 11.4344 5 12.3813 5 13.5C5 14.8813 3.88125 16 2.5 16C1.11875 16 0 14.8813 0 13.5C0 12.3813 0.734375 11.4344 1.75 11.1156V4.88438C0.734375 4.56563 0 3.61875 0 2.5C0 1.11875 1.11875 0 2.5 0C3.88125 0 5 1.11875 5 2.5C5 3.61875 4.26562 4.56563 3.25 4.88438ZM3.5 13.5C3.5 13.2348 3.39464 12.9804 3.20711 12.7929C3.01957 12.6054 2.76522 12.5 2.5 12.5C2.23478 12.5 1.98043 12.6054 1.79289 12.7929C1.60536 12.9804 1.5 13.2348 1.5 13.5C1.5 13.7652 1.60536 14.0196 1.79289 14.2071C1.98043 14.3946 2.23478 14.5 2.5 14.5C2.76522 14.5 3.01957 14.3946 3.20711 14.2071C3.39464 14.0196 3.5 13.7652 3.5 13.5ZM13.5 14.5C13.7652 14.5 14.0196 14.3946 14.2071 14.2071C14.3946 14.0196 14.5 13.7652 14.5 13.5C14.5 13.2348 14.3946 12.9804 14.2071 12.7929C14.0196 12.6054 13.7652 12.5 13.5 12.5C13.2348 12.5 12.9804 12.6054 12.7929 12.7929C12.6054 12.9804 12.5 13.2348 12.5 13.5C12.5 13.7652 12.6054 14.0196 12.7929 14.2071C12.9804 14.3946 13.2348 14.5 13.5 14.5Z\"\n fill=\"currentColor\"\n />\n </SvgIcon>\n);\n"],"names":[],"mappings":";;;AAGO,MAAM,iBAAiB,sBAC5B,KAAA,CAAA,aAAA;AAAA,EAAC,OAAA;AAAA,EAAA;AAAA,IACC,KAAM,EAAA,4BAAA;AAAA,IACN,OAAQ,EAAA,WAAA;AAAA,IACR,EAAI,EAAA;AAAA,MACF,KAAO,EAAA,MAAA;AAAA,MACP,MAAQ,EAAA,MAAA;AAAA,MACR,IAAM,EAAA,MAAA;AAAA,MACN,SAAW,EAAA,iBAAA;AAAA,MACX,OAAO,CACL,KAAA,KAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,KAAS,SAAS,OAAU,GAAA,qBAAA;AAAA,KAC9C;AAAA,GAAA;AAAA,kBAEA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,CAAE,EAAA,6yDAAA;AAAA,MACF,IAAK,EAAA,cAAA;AAAA,KAAA;AAAA,GACP;AACF;;;;"}
@@ -0,0 +1,44 @@
1
+ import FormControl from '@mui/material/FormControl';
2
+ import FormHelperText from '@mui/material/FormHelperText';
3
+ import FormLabel from '@mui/material/FormLabel';
4
+ import TextField from '@mui/material/TextField';
5
+ import React, { forwardRef } from 'react';
6
+ import { formLabel, formHelperText } from './typography.esm.js';
7
+
8
+ const Input = forwardRef(
9
+ ({ label, sublabel, error, helperText, required, ...props }, ref) => {
10
+ return /* @__PURE__ */ React.createElement(
11
+ FormControl,
12
+ {
13
+ sx: { width: "100%", gap: "4px" },
14
+ error,
15
+ required
16
+ },
17
+ label && /* @__PURE__ */ React.createElement(FormLabel, { required, sx: formLabel }, label),
18
+ sublabel && /* @__PURE__ */ React.createElement(FormHelperText, { sx: formHelperText }, sublabel),
19
+ /* @__PURE__ */ React.createElement(
20
+ TextField,
21
+ {
22
+ id: "filled-multiline-static",
23
+ error,
24
+ multiline: true,
25
+ fullWidth: true,
26
+ variant: "outlined",
27
+ inputRef: ref,
28
+ InputProps: {
29
+ sx: (theme) => ({
30
+ "&.Mui-disabled": {
31
+ color: theme.palette.mode === "dark" ? "#FFFFFF80" : "#757575"
32
+ }
33
+ })
34
+ },
35
+ ...props
36
+ }
37
+ ),
38
+ helperText && /* @__PURE__ */ React.createElement(FormHelperText, null, helperText)
39
+ );
40
+ }
41
+ );
42
+
43
+ export { Input };
44
+ //# sourceMappingURL=Input.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.esm.js","sources":["../../../src/components/common/Input.tsx"],"sourcesContent":["import FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormLabel from '@mui/material/FormLabel';\nimport TextField, { TextFieldProps } from '@mui/material/TextField';\nimport React, { forwardRef } from 'react';\nimport { formHelperText, formLabel } from './typography';\n\ntype Props = TextFieldProps & {\n sublabel?: string;\n};\n\nexport const Input = forwardRef<HTMLInputElement, Props>(\n ({ label, sublabel, error, helperText, required, ...props }, ref) => {\n return (\n <FormControl\n sx={{ width: '100%', gap: '4px' }}\n error={error}\n required={required}\n >\n {label && (\n <FormLabel required={required} sx={formLabel}>\n {label}\n </FormLabel>\n )}\n {sublabel && (\n <FormHelperText sx={formHelperText}>{sublabel}</FormHelperText>\n )}\n <TextField\n id=\"filled-multiline-static\"\n error={error}\n multiline\n fullWidth\n variant=\"outlined\"\n inputRef={ref}\n InputProps={{\n sx: theme => ({\n '&.Mui-disabled': {\n color: theme.palette.mode === 'dark' ? '#FFFFFF80' : '#757575',\n },\n }),\n }}\n {...props}\n />\n {helperText && <FormHelperText>{helperText}</FormHelperText>}\n </FormControl>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;AAWO,MAAM,KAAQ,GAAA,UAAA;AAAA,EACnB,CAAC,EAAE,KAAA,EAAO,QAAU,EAAA,KAAA,EAAO,YAAY,QAAU,EAAA,GAAG,KAAM,EAAA,EAAG,GAAQ,KAAA;AACnE,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,EAAI,EAAA,EAAE,KAAO,EAAA,MAAA,EAAQ,KAAK,KAAM,EAAA;AAAA,QAChC,KAAA;AAAA,QACA,QAAA;AAAA,OAAA;AAAA,MAEC,yBACE,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAU,QAAoB,EAAA,EAAA,EAAI,aAChC,KACH,CAAA;AAAA,MAED,QACC,oBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,EAAA,EAAA,EAAI,kBAAiB,QAAS,CAAA;AAAA,sBAEhD,KAAA,CAAA,aAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACC,EAAG,EAAA,yBAAA;AAAA,UACH,KAAA;AAAA,UACA,SAAS,EAAA,IAAA;AAAA,UACT,SAAS,EAAA,IAAA;AAAA,UACT,OAAQ,EAAA,UAAA;AAAA,UACR,QAAU,EAAA,GAAA;AAAA,UACV,UAAY,EAAA;AAAA,YACV,IAAI,CAAU,KAAA,MAAA;AAAA,cACZ,gBAAkB,EAAA;AAAA,gBAChB,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,KAAS,SAAS,WAAc,GAAA,SAAA;AAAA,eACvD;AAAA,aACF,CAAA;AAAA,WACF;AAAA,UACC,GAAG,KAAA;AAAA,SAAA;AAAA,OACN;AAAA,MACC,UAAA,oBAAe,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,EAAgB,UAAW,CAAA;AAAA,KAC7C,CAAA;AAAA,GAEJ;AACF;;;;"}
@@ -0,0 +1,85 @@
1
+ import React from 'react';
2
+ import { useController } from 'react-hook-form';
3
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
4
+ import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
5
+ import Box from '@mui/material/Box';
6
+ import Chip from '@mui/material/Chip';
7
+ import FormControl from '@mui/material/FormControl';
8
+ import FormHelperText from '@mui/material/FormHelperText';
9
+ import FormLabel from '@mui/material/FormLabel';
10
+ import MUISelect from '@mui/material/Select';
11
+ import Checkbox from '@mui/material/Checkbox';
12
+ import MenuItem from '@mui/material/MenuItem';
13
+ import ListItemText from '@mui/material/ListItemText';
14
+ import { formLabel, formHelperText } from './typography.esm.js';
15
+
16
+ const Select = ({
17
+ label,
18
+ sublabel,
19
+ error,
20
+ helperText,
21
+ required,
22
+ control,
23
+ name,
24
+ multiple,
25
+ labelTranslationKey,
26
+ options,
27
+ ...props
28
+ }) => {
29
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
30
+ const { field } = useController({
31
+ name,
32
+ control,
33
+ rules: { required }
34
+ });
35
+ const renderValue = (values) => multiple ? /* @__PURE__ */ React.createElement(
36
+ Box,
37
+ {
38
+ sx: {
39
+ display: "flex",
40
+ flexWrap: "wrap",
41
+ marginBottom: 0,
42
+ paddingBottom: 0
43
+ }
44
+ },
45
+ values.map((value) => /* @__PURE__ */ React.createElement(
46
+ Chip,
47
+ {
48
+ key: value,
49
+ label: (
50
+ /* @ts-ignore Because ts can't typecheck strings against our keys */
51
+ labelTranslationKey ? t(`${labelTranslationKey}.${value}`) : value
52
+ )
53
+ }
54
+ ))
55
+ ) : options.find((option) => option.value === values)?.renderedValue;
56
+ const handleChecked = (fieldValue, optionValue) => {
57
+ if (Array.isArray(fieldValue)) return fieldValue.includes(optionValue);
58
+ return fieldValue === optionValue;
59
+ };
60
+ return /* @__PURE__ */ React.createElement(FormControl, { sx: { width: "100%", gap: "4px" } }, label && /* @__PURE__ */ React.createElement(FormLabel, { sx: formLabel, required }, label), sublabel && /* @__PURE__ */ React.createElement(FormHelperText, { sx: formHelperText }, sublabel), /* @__PURE__ */ React.createElement(
61
+ MUISelect,
62
+ {
63
+ MenuProps: {
64
+ disablePortal: true
65
+ },
66
+ variant: "outlined",
67
+ renderValue,
68
+ multiple,
69
+ SelectDisplayProps: multiple ? {
70
+ style: {
71
+ paddingBottom: 8,
72
+ paddingTop: 16,
73
+ minHeight: 40
74
+ }
75
+ } : {},
76
+ inputRef: field.ref,
77
+ ...field,
78
+ ...props
79
+ },
80
+ options.map((option) => /* @__PURE__ */ React.createElement(MenuItem, { key: option.value, value: option.value }, multiple && /* @__PURE__ */ React.createElement(Checkbox, { checked: handleChecked(field.value, option.value) }), /* @__PURE__ */ React.createElement(ListItemText, { primary: option.renderedValue })))
81
+ ), error && /* @__PURE__ */ React.createElement(FormHelperText, { error: true }, helperText));
82
+ };
83
+
84
+ export { Select };
85
+ //# sourceMappingURL=Select.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.esm.js","sources":["../../../src/components/common/Select.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Control,\n FieldValues,\n Path,\n PathValue,\n useController,\n} from 'react-hook-form';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport Box from '@mui/material/Box';\nimport Chip from '@mui/material/Chip';\nimport FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormLabel from '@mui/material/FormLabel';\nimport MUISelect, { SelectProps } from '@mui/material/Select';\nimport Checkbox from '@mui/material/Checkbox';\nimport MenuItem from '@mui/material/MenuItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport { formHelperText, formLabel } from './typography';\n\ntype Props<T extends FieldValues> = SelectProps & {\n sublabel?: string;\n helperText?: string;\n control?: Control<T, any>;\n name: Path<T>;\n labelTranslationKey?: string;\n options: { value: string | number; renderedValue: string | number }[];\n};\n\nexport const Select = <T extends FieldValues>({\n label,\n sublabel,\n error,\n helperText,\n required,\n control,\n name,\n multiple,\n labelTranslationKey,\n options,\n ...props\n}: Props<T>) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const { field } = useController({\n name,\n control,\n rules: { required },\n });\n\n // values er strengt tatt unknown, men da må vi bruke mye ts-ignore for å komme i mål\n const renderValue = (values: any) =>\n multiple ? (\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'wrap',\n marginBottom: 0,\n paddingBottom: 0,\n }}\n >\n {values.map((value: string) => (\n <Chip\n key={value}\n label={\n /* @ts-ignore Because ts can't typecheck strings against our keys */\n labelTranslationKey ? t(`${labelTranslationKey}.${value}`) : value\n }\n />\n ))}\n </Box>\n ) : (\n options.find(option => option.value === values)?.renderedValue\n );\n\n const handleChecked = (\n fieldValue: PathValue<T, (string | undefined) & Path<T>>,\n optionValue: Props<T>['options'][0]['value'],\n ) => {\n if (Array.isArray(fieldValue)) return fieldValue.includes(optionValue);\n return fieldValue === optionValue;\n };\n\n return (\n <FormControl sx={{ width: '100%', gap: '4px' }}>\n {label && (\n <FormLabel sx={formLabel} required={required}>\n {label}\n </FormLabel>\n )}\n {sublabel && (\n <FormHelperText sx={formHelperText}>{sublabel}</FormHelperText>\n )}\n\n <MUISelect\n MenuProps={{\n disablePortal: true,\n }}\n variant=\"outlined\"\n renderValue={renderValue}\n multiple={multiple}\n SelectDisplayProps={\n multiple\n ? {\n style: {\n paddingBottom: 8,\n paddingTop: 16,\n minHeight: 40,\n },\n }\n : {}\n }\n inputRef={field.ref}\n {...field}\n {...props}\n >\n {options.map(option => (\n <MenuItem key={option.value} value={option.value}>\n {multiple && (\n <Checkbox checked={handleChecked(field.value, option.value)} />\n )}\n <ListItemText primary={option.renderedValue} />\n </MenuItem>\n ))}\n </MUISelect>\n {error && <FormHelperText error>{helperText}</FormHelperText>}\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA8BO,MAAM,SAAS,CAAwB;AAAA,EAC5C,KAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,mBAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG,KAAA;AACL,CAAgB,KAAA;AACd,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAM,MAAA,EAAE,KAAM,EAAA,GAAI,aAAc,CAAA;AAAA,IAC9B,IAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA,EAAO,EAAE,QAAS,EAAA;AAAA,GACnB,CAAA,CAAA;AAGD,EAAM,MAAA,WAAA,GAAc,CAAC,MAAA,KACnB,QACE,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,OAAS,EAAA,MAAA;AAAA,QACT,QAAU,EAAA,MAAA;AAAA,QACV,YAAc,EAAA,CAAA;AAAA,QACd,aAAe,EAAA,CAAA;AAAA,OACjB;AAAA,KAAA;AAAA,IAEC,MAAA,CAAO,GAAI,CAAA,CAAC,KACX,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,KAAA;AAAA,QACL,KAAA;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AAI,CACX,MAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,GAAA,EAAK,MAAO,CAAA,KAAA,EAAO,KAAO,EAAA,MAAA,CAAO,KACxC,EAAA,EAAA,QAAA,oBACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,OAAS,EAAA,aAAA,CAAc,KAAM,CAAA,KAAA,EAAO,MAAO,CAAA,KAAK,CAAG,EAAA,CAAA,kBAE9D,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,OAAS,EAAA,MAAA,CAAO,aAAe,EAAA,CAC/C,CACD,CAAA;AAAA,KAEF,KAAS,oBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,KAAK,EAAA,IAAA,EAAA,EAAE,UAAW,CAC9C,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,11 @@
1
+ import { CircularProgress } from '@material-ui/core';
2
+ import React from 'react';
3
+ import { useSpinnerStyles } from '../../utils/style.esm.js';
4
+
5
+ const Spinner = ({ size }) => {
6
+ const { container, spinner } = useSpinnerStyles();
7
+ return /* @__PURE__ */ React.createElement("div", { className: container }, /* @__PURE__ */ React.createElement(CircularProgress, { className: spinner, size }));
8
+ };
9
+
10
+ export { Spinner };
11
+ //# sourceMappingURL=Spinner.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.esm.js","sources":["../../../src/components/common/Spinner.tsx"],"sourcesContent":["import { CircularProgress } from '@material-ui/core';\nimport React from 'react';\nimport { useSpinnerStyles } from '../../utils/style';\n\nexport const Spinner = ({ size }: { size?: string | number }) => {\n const { container, spinner } = useSpinnerStyles();\n return (\n <div className={container}>\n <CircularProgress className={spinner} size={size} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AAIO,MAAM,OAAU,GAAA,CAAC,EAAE,IAAA,EAAuC,KAAA;AAC/D,EAAA,MAAM,EAAE,SAAA,EAAW,OAAQ,EAAA,GAAI,gBAAiB,EAAA,CAAA;AAChD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,SAAW,EAAA,SAAA,EAAA,sCACb,gBAAiB,EAAA,EAAA,SAAA,EAAW,OAAS,EAAA,IAAA,EAAY,CACpD,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,64 @@
1
+ import { FormControl, FormLabel, FormHelperText, TextField as TextField$1 } from '@material-ui/core';
2
+ import React, { useState } from 'react';
3
+ import { useScenario } from '../../contexts/ScenarioContext.esm.js';
4
+ import { useInputFieldStyles, useFontStyles } from '../../utils/style.esm.js';
5
+
6
+ const TextField = ({
7
+ label,
8
+ subtitle,
9
+ value,
10
+ required,
11
+ minRows = 1,
12
+ handleChange,
13
+ validateInput,
14
+ errorMessage,
15
+ errorKey
16
+ }) => {
17
+ const [hasError, setHasError] = useState(false);
18
+ const { setFormError, removeFormError, formFieldHasErrors } = useScenario();
19
+ const { formLabel, formControl, root } = useInputFieldStyles();
20
+ const { labelSubtitle } = useFontStyles();
21
+ const onChange = (event) => {
22
+ if (handleChange) {
23
+ handleChange(event.target.value);
24
+ }
25
+ };
26
+ const onBlur = (event) => {
27
+ if (!validateInput && !required) {
28
+ return;
29
+ }
30
+ const isValid = validateInput ? validateInput(event.target.value) : true;
31
+ const requiredValid = required ? event.target.value.length > 0 : true;
32
+ const validationResult = isValid && requiredValid;
33
+ setHasError(!validationResult);
34
+ if (!errorKey) {
35
+ return;
36
+ }
37
+ if (validationResult) {
38
+ removeFormError(errorKey);
39
+ } else {
40
+ setFormError(errorKey);
41
+ }
42
+ };
43
+ const fieldError = hasError || (errorKey ? formFieldHasErrors(errorKey) : false);
44
+ return /* @__PURE__ */ React.createElement(FormControl, { className: formControl }, label && /* @__PURE__ */ React.createElement(FormLabel, { className: formLabel, required }, label), subtitle && /* @__PURE__ */ React.createElement(FormHelperText, { className: labelSubtitle }, subtitle), /* @__PURE__ */ React.createElement(
45
+ TextField$1,
46
+ {
47
+ disabled: !handleChange,
48
+ required: true,
49
+ id: "filled-multiline-static",
50
+ value,
51
+ multiline: true,
52
+ fullWidth: true,
53
+ minRows,
54
+ variant: "outlined",
55
+ onChange,
56
+ error: fieldError,
57
+ onBlur,
58
+ InputProps: { className: root }
59
+ }
60
+ ), fieldError && /* @__PURE__ */ React.createElement(FormHelperText, { error: true }, errorMessage));
61
+ };
62
+
63
+ export { TextField };
64
+ //# sourceMappingURL=Textfield.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textfield.esm.js","sources":["../../../src/components/common/Textfield.tsx"],"sourcesContent":["import {\n FormControl,\n FormHelperText,\n FormLabel,\n TextField as MUITextField,\n} from '@material-ui/core';\nimport React, { ChangeEvent, useState } from 'react';\nimport { useScenario } from '../../contexts/ScenarioContext';\nimport { useFontStyles, useInputFieldStyles } from '../../utils/style';\n\ntype ErrorProps = {\n errorKey?: string;\n errorMessage?: string;\n};\n\ntype TextFieldProps = {\n label?: string;\n subtitle?: string;\n value: string | number;\n error?: string | boolean | null;\n minRows?: number;\n handleChange?: (value: string) => void;\n} & (\n | ({\n validateInput: (value: string) => boolean;\n required?: boolean;\n } & ErrorProps)\n | ({\n required?: undefined;\n validateInput?: undefined;\n } & ErrorProps)\n | ({\n required: boolean;\n validateInput?: (value: string) => boolean;\n } & ErrorProps)\n);\n\nexport const TextField = ({\n label,\n subtitle,\n value,\n required,\n minRows = 1,\n handleChange,\n validateInput,\n errorMessage,\n errorKey,\n}: TextFieldProps) => {\n const [hasError, setHasError] = useState(false);\n const { setFormError, removeFormError, formFieldHasErrors } = useScenario();\n const { formLabel, formControl, root } = useInputFieldStyles();\n const { labelSubtitle } = useFontStyles();\n\n const onChange = (event: ChangeEvent<{ value: string }>) => {\n if (handleChange) {\n handleChange(event.target.value);\n }\n };\n\n const onBlur = (event: ChangeEvent<{ value: string }>) => {\n if (!validateInput && !required) {\n return;\n }\n\n const isValid = validateInput ? validateInput(event.target.value) : true;\n const requiredValid = required ? event.target.value.length > 0 : true;\n\n const validationResult = isValid && requiredValid;\n setHasError(!validationResult);\n\n if (!errorKey) {\n return;\n }\n\n if (validationResult) {\n removeFormError(errorKey);\n } else {\n setFormError(errorKey);\n }\n };\n\n const fieldError =\n hasError || (errorKey ? formFieldHasErrors(errorKey) : false);\n\n return (\n <FormControl className={formControl}>\n {label && (\n <FormLabel className={formLabel} required={required}>\n {label}\n </FormLabel>\n )}\n {subtitle && (\n <FormHelperText className={labelSubtitle}>{subtitle}</FormHelperText>\n )}\n <MUITextField\n disabled={!handleChange}\n required\n id=\"filled-multiline-static\"\n value={value}\n multiline\n fullWidth\n minRows={minRows}\n variant=\"outlined\"\n onChange={onChange}\n error={fieldError}\n onBlur={onBlur}\n InputProps={{ className: root }}\n />\n {fieldError && <FormHelperText error>{errorMessage}</FormHelperText>}\n </FormControl>\n );\n};\n"],"names":["MUITextField"],"mappings":";;;;;AAqCO,MAAM,YAAY,CAAC;AAAA,EACxB,KAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAU,GAAA,CAAA;AAAA,EACV,YAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AACF,CAAsB,KAAA;AACpB,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAC9C,EAAA,MAAM,EAAE,YAAA,EAAc,eAAiB,EAAA,kBAAA,KAAuB,WAAY,EAAA,CAAA;AAC1E,EAAA,MAAM,EAAE,SAAA,EAAW,WAAa,EAAA,IAAA,KAAS,mBAAoB,EAAA,CAAA;AAC7D,EAAM,MAAA,EAAE,aAAc,EAAA,GAAI,aAAc,EAAA,CAAA;AAExC,EAAM,MAAA,QAAA,GAAW,CAAC,KAA0C,KAAA;AAC1D,IAAA,IAAI,YAAc,EAAA;AAChB,MAAa,YAAA,CAAA,KAAA,CAAM,OAAO,KAAK,CAAA,CAAA;AAAA,KACjC;AAAA,GACF,CAAA;AAEA,EAAM,MAAA,MAAA,GAAS,CAAC,KAA0C,KAAA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UAAA;AAAA,MACR,QAAA;AAAA,MACA,KAAO,EAAA,UAAA;AAAA,MACP,MAAA;AAAA,MACA,UAAA,EAAY,EAAE,SAAA,EAAW,IAAK,EAAA;AAAA,KAAA;AAAA,KAE/B,UAAc,oBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,KAAK,EAAA,IAAA,EAAA,EAAE,YAAa,CACrD,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,9 @@
1
+ const dialogActions = {
2
+ gap: 1,
3
+ paddingTop: 0,
4
+ paddingX: 3,
5
+ paddingBottom: 2
6
+ };
7
+
8
+ export { dialogActions };
9
+ //# sourceMappingURL=mixins.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixins.esm.js","sources":["../../../src/components/common/mixins.ts"],"sourcesContent":["import { SxProps, Theme } from '@mui/material/styles';\n\nexport const dialogActions: SxProps<Theme> = {\n gap: 1,\n paddingTop: 0,\n paddingX: 3,\n paddingBottom: 2,\n};\n"],"names":[],"mappings":"AAEO,MAAM,aAAgC,GAAA;AAAA,EAC3C,GAAK,EAAA,CAAA;AAAA,EACL,UAAY,EAAA,CAAA;AAAA,EACZ,QAAU,EAAA,CAAA;AAAA,EACV,aAAe,EAAA,CAAA;AACjB;;;;"}
@@ -0,0 +1,59 @@
1
+ const heading1 = {
2
+ fontSize: "2rem",
3
+ fontWeight: 700
4
+ };
5
+ const heading2 = {
6
+ fontSize: "1.75rem",
7
+ fontWeight: 500
8
+ };
9
+ const heading3 = {
10
+ fontSize: "1.25rem",
11
+ fontWeight: 500
12
+ };
13
+ const body1 = {
14
+ fontSize: "1rem",
15
+ fontWeight: 500
16
+ };
17
+ const body2 = {
18
+ fontSize: "1rem",
19
+ fontWeight: 400,
20
+ whiteSpace: "pre-line"
21
+ };
22
+ const label = {
23
+ fontSize: "0.875rem",
24
+ fontWeight: 700,
25
+ textTransform: "uppercase",
26
+ paddingBottom: "0.4rem"
27
+ };
28
+ const label2 = {
29
+ fontSize: "0.875rem",
30
+ fontWeight: 700,
31
+ textTransform: "uppercase"
32
+ };
33
+ const formLabel = {
34
+ fontSize: "0.875rem",
35
+ fontWeight: 700,
36
+ textTransform: "uppercase",
37
+ color: "inherit"
38
+ };
39
+ const formHelperText = {
40
+ fontSize: "0.875rem",
41
+ fontWeight: 400,
42
+ color: "inherit",
43
+ margin: 0
44
+ };
45
+ const emptyState = {
46
+ fontSize: "1rem",
47
+ fontStyle: "italic"
48
+ };
49
+ const subtitle1 = {
50
+ fontSize: "1rem",
51
+ fontWeight: 700
52
+ };
53
+ const subtitle2 = {
54
+ fontSize: "1rem",
55
+ fontWeight: 400
56
+ };
57
+
58
+ export { body1, body2, emptyState, formHelperText, formLabel, heading1, heading2, heading3, label, label2, subtitle1, subtitle2 };
59
+ //# sourceMappingURL=typography.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.esm.js","sources":["../../../src/components/common/typography.ts"],"sourcesContent":["import { SxProps, Theme } from '@mui/material/styles';\n\nexport const heading1: SxProps<Theme> = {\n fontSize: '2rem',\n fontWeight: 700,\n};\n\nexport const heading2: SxProps<Theme> = {\n fontSize: '1.75rem',\n fontWeight: 500,\n};\n\nexport const heading3: SxProps<Theme> = {\n fontSize: '1.25rem',\n fontWeight: 500,\n};\n\nexport const body1: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 500,\n};\n\nexport const body2: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 400,\n whiteSpace: 'pre-line',\n};\n\nexport const label: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 700,\n textTransform: 'uppercase',\n paddingBottom: '0.4rem',\n};\n\nexport const label2: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 700,\n textTransform: 'uppercase',\n};\n\nexport const formLabel: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 700,\n textTransform: 'uppercase',\n color: 'inherit',\n};\n\nexport const formHelperText: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 400,\n color: 'inherit',\n margin: 0,\n};\n\nexport const emptyState: SxProps<Theme> = {\n fontSize: '1rem',\n fontStyle: 'italic',\n};\n\nexport const subtitle1: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 700,\n};\n\nexport const subtitle2: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 400,\n};\n\nexport const headerSubtitle: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 500,\n paddingBottom: '1rem',\n marginTop: '-0.2rem',\n};\n"],"names":[],"mappings":"AAEO,MAAM,QAA2B,GAAA;AAAA,EACtC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,QAA2B,GAAA;AAAA,EACtC,QAAU,EAAA,SAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,QAA2B,GAAA;AAAA,EACtC,QAAU,EAAA,SAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,KAAwB,GAAA;AAAA,EACnC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,KAAwB,GAAA;AAAA,EACnC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,UAAY,EAAA,UAAA;AACd,EAAA;AAEO,MAAM,KAAwB,GAAA;AAAA,EACnC,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,aAAe,EAAA,WAAA;AAAA,EACf,aAAe,EAAA,QAAA;AACjB,EAAA;AAEO,MAAM,MAAyB,GAAA;AAAA,EACpC,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,aAAe,EAAA,WAAA;AACjB,EAAA;AAEO,MAAM,SAA4B,GAAA;AAAA,EACvC,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,aAAe,EAAA,WAAA;AAAA,EACf,KAAO,EAAA,SAAA;AACT,EAAA;AAEO,MAAM,cAAiC,GAAA;AAAA,EAC5C,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,KAAO,EAAA,SAAA;AAAA,EACP,MAAQ,EAAA,CAAA;AACV,EAAA;AAEO,MAAM,UAA6B,GAAA;AAAA,EACxC,QAAU,EAAA,MAAA;AAAA,EACV,SAAW,EAAA,QAAA;AACb,EAAA;AAEO,MAAM,SAA4B,GAAA;AAAA,EACvC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,SAA4B,GAAA;AAAA,EACvC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd;;;;"}
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import { emptyRiSc } from '../../utils/utilityfunctions.esm.js';
3
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
4
+ import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
5
+ import { useRiScs } from '../../contexts/RiScContext.esm.js';
6
+ import { useForm } from 'react-hook-form';
7
+ import { Input } from '../common/Input.esm.js';
8
+ import Button from '@mui/material/Button';
9
+ import Dialog from '@mui/material/Dialog';
10
+ import DialogContent from '@mui/material/DialogContent';
11
+ import DialogTitle from '@mui/material/DialogTitle';
12
+ import DialogActions from '@mui/material/DialogActions';
13
+ import { dialogActions } from '../common/mixins.esm.js';
14
+
15
+ var RiScDialogStates = /* @__PURE__ */ ((RiScDialogStates2) => {
16
+ RiScDialogStates2[RiScDialogStates2["Closed"] = 0] = "Closed";
17
+ RiScDialogStates2[RiScDialogStates2["Edit"] = 1] = "Edit";
18
+ RiScDialogStates2[RiScDialogStates2["Create"] = 2] = "Create";
19
+ return RiScDialogStates2;
20
+ })(RiScDialogStates || {});
21
+ const RiScDialog = ({ onClose, dialogState }) => {
22
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
23
+ const { selectedRiSc, createNewRiSc, updateRiSc } = useRiScs();
24
+ const {
25
+ register,
26
+ handleSubmit,
27
+ formState: { isDirty, errors }
28
+ } = useForm({
29
+ defaultValues: dialogState === 1 /* Edit */ ? selectedRiSc.content : emptyRiSc(),
30
+ mode: "onBlur"
31
+ });
32
+ const titleTranslation = dialogState === 2 /* Create */ ? t("rosDialog.titleNew") : t("rosDialog.titleEdit");
33
+ const onSubmit = handleSubmit((data) => {
34
+ if (dialogState === 2 /* Create */) {
35
+ createNewRiSc(data);
36
+ } else {
37
+ updateRiSc(data);
38
+ }
39
+ onClose();
40
+ });
41
+ return /* @__PURE__ */ React.createElement(Dialog, { open: dialogState !== 0 /* Closed */, onClose }, /* @__PURE__ */ React.createElement(DialogTitle, null, titleTranslation), /* @__PURE__ */ React.createElement(
42
+ DialogContent,
43
+ {
44
+ sx: { display: "flex", flexDirection: "column", gap: "16px" }
45
+ },
46
+ /* @__PURE__ */ React.createElement(
47
+ Input,
48
+ {
49
+ required: true,
50
+ ...register("title", { required: true }),
51
+ error: errors.title !== void 0,
52
+ label: t("dictionary.title")
53
+ }
54
+ ),
55
+ /* @__PURE__ */ React.createElement(
56
+ Input,
57
+ {
58
+ required: true,
59
+ ...register("scope", { required: true }),
60
+ label: t("dictionary.scope"),
61
+ sublabel: t("rosDialog.scopeDescription"),
62
+ error: errors.scope !== void 0,
63
+ minRows: 4
64
+ }
65
+ )
66
+ ), /* @__PURE__ */ React.createElement(DialogActions, { sx: dialogActions }, /* @__PURE__ */ React.createElement(Button, { variant: "contained", onClick: onSubmit, disabled: !isDirty }, t("dictionary.save")), /* @__PURE__ */ React.createElement(Button, { variant: "outlined", onClick: onClose }, t("dictionary.cancel"))));
67
+ };
68
+
69
+ export { RiScDialog, RiScDialogStates };
70
+ //# sourceMappingURL=RiScDialog.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RiScDialog.esm.js","sources":["../../../src/components/riScDialog/RiScDialog.tsx"],"sourcesContent":["import React from 'react';\nimport { RiSc } from '../../utils/types';\nimport { emptyRiSc } from '../../utils/utilityfunctions';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { useRiScs } from '../../contexts/RiScContext';\nimport { useForm } from 'react-hook-form';\nimport { Input } from '../common/Input';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport DialogActions from '@mui/material/DialogActions';\nimport { dialogActions } from '../common/mixins';\n\nexport enum RiScDialogStates {\n Closed,\n Edit,\n Create,\n}\n\ninterface RiScDialogProps {\n onClose: () => void;\n dialogState: RiScDialogStates;\n}\n\nexport const RiScDialog = ({ onClose, dialogState }: RiScDialogProps) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const { selectedRiSc, createNewRiSc, updateRiSc } = useRiScs();\n\n const {\n register,\n handleSubmit,\n formState: { isDirty, errors },\n } = useForm<RiSc>({\n defaultValues:\n dialogState === RiScDialogStates.Edit\n ? selectedRiSc!.content\n : emptyRiSc(),\n mode: 'onBlur',\n });\n\n const titleTranslation =\n dialogState === RiScDialogStates.Create\n ? t('rosDialog.titleNew')\n : t('rosDialog.titleEdit');\n\n const onSubmit = handleSubmit((data: RiSc) => {\n if (dialogState === RiScDialogStates.Create) {\n createNewRiSc(data);\n } else {\n updateRiSc(data);\n }\n onClose();\n });\n\n return (\n <Dialog open={dialogState !== RiScDialogStates.Closed} onClose={onClose}>\n <DialogTitle>{titleTranslation}</DialogTitle>\n\n <DialogContent\n sx={{ display: 'flex', flexDirection: 'column', gap: '16px' }}\n >\n <Input\n required\n {...register('title', { required: true })}\n error={errors.title !== undefined}\n label={t('dictionary.title')}\n />\n <Input\n required\n {...register('scope', { required: true })}\n label={t('dictionary.scope')}\n sublabel={t('rosDialog.scopeDescription')}\n error={errors.scope !== undefined}\n minRows={4}\n />\n </DialogContent>\n\n <DialogActions sx={dialogActions}>\n <Button variant=\"contained\" onClick={onSubmit} disabled={!isDirty}>\n {t('dictionary.save')}\n </Button>\n <Button variant=\"outlined\" onClick={onClose}>\n {t('dictionary.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":["RiScDialogStates"],"mappings":";;;;;;;;;;;;;;AAeY,IAAA,gBAAA,qBAAAA,iBAAL,KAAA;AACL,EAAAA,iBAAA,CAAA,iBAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA,CAAA;AACA,EAAAA,iBAAA,CAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA,CAAA;AACA,EAAAA,iBAAA,CAAA,iBAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA,CAAA;AAHU,EAAAA,OAAAA,iBAAAA,CAAAA;AAAA,CAAA,EAAA,gBAAA,IAAA,EAAA,EAAA;AAWL,MAAM,UAAa,GAAA,CAAC,EAAE,OAAA,EAAS,aAAmC,KAAA;AACvE,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAA,MAAM,EAAE,YAAA,EAAc,aAAe,EAAA,UAAA,KAAe,QAAS,EAAA,CAAA;AAE7D,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,YAAA;AAAA,IACA,SAAA,EAAW,EAAE,OAAA,EAAS,MAAO,EAAA;AAAA,MAC3B,OAAc,CAAA;AAAA,IAChB,aACE,EAAA,WAAA,KAAgB,CACZ,cAAA,YAAA,CAAc,UACd,SAAU,EAAA;AAAA,IAChB,IAAM,EAAA,QAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,MAAM,mBACJ,WAAgB,KAAA,CAAA,gBACZ,EAAE,oBAAoB,CAAA,GACtB,EAAE,qBAAqB,CAAA,CAAA;AAE7B,EAAM,MAAA,QAAA,GAAW,YAAa,CAAA,CAAC,IAAe,KAAA;AAC5C,IAAA,IAAI,gBAA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