@orchestrator-ui/orchestrator-ui-components 6.8.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +5 -2
  3. package/.turbo/turbo-test.log +9 -10
  4. package/CHANGELOG.md +19 -0
  5. package/dist/index.d.ts +164 -4306
  6. package/dist/index.js +1739 -5747
  7. package/dist/index.js.map +1 -1
  8. package/package.json +4 -8
  9. package/src/components/WfoPydanticForm/Footer.tsx +33 -6
  10. package/src/components/WfoPydanticForm/RenderFormErrors.tsx +2 -1
  11. package/src/components/WfoPydanticForm/Row.tsx +3 -1
  12. package/src/components/WfoPydanticForm/fields/WfoInteger.tsx +5 -1
  13. package/src/components/WfoPydanticForm/fields/WfoSummary.tsx +3 -5
  14. package/src/components/WfoPydanticForm/fields/styles.ts +72 -0
  15. package/src/components/WfoSearchPage/WfoSearch/WfoSearch.tsx +42 -54
  16. package/src/components/WfoSearchPage/utils.ts +9 -1
  17. package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +10 -27
  18. package/src/components/WfoWorkflowSteps/WfoStep/WfoStepForm.tsx +1 -1
  19. package/src/components/index.ts +0 -1
  20. package/src/configuration/version.ts +1 -1
  21. package/src/contexts/OrchestratorConfigContext.tsx +0 -1
  22. package/src/hooks/useSearch.ts +12 -2
  23. package/src/hooks/useSearchPagination.ts +4 -0
  24. package/src/messages/en-GB.json +5 -3
  25. package/src/pages/processes/WfoStartProcessPage.tsx +5 -107
  26. package/src/rtk/endpoints/index.ts +0 -2
  27. package/src/rtk/endpoints/search.ts +13 -4
  28. package/src/types/index.ts +0 -1
  29. package/src/types/search.ts +7 -0
  30. package/src/types/types.ts +0 -1
  31. package/src/components/WfoForms/AutoFieldLoader.tsx +0 -118
  32. package/src/components/WfoForms/AutoFields.tsx +0 -49
  33. package/src/components/WfoForms/CreateForm.tsx +0 -75
  34. package/src/components/WfoForms/UserInputForm.tsx +0 -697
  35. package/src/components/WfoForms/UserInputFormStyling.ts +0 -80
  36. package/src/components/WfoForms/UserInputFormWizard.tsx +0 -127
  37. package/src/components/WfoForms/formFields/AcceptField.tsx +0 -243
  38. package/src/components/WfoForms/formFields/AcceptFieldStyling.ts +0 -35
  39. package/src/components/WfoForms/formFields/BoolField.tsx +0 -77
  40. package/src/components/WfoForms/formFields/BoolFieldStyling.ts +0 -64
  41. package/src/components/WfoForms/formFields/ConnectedSelectField.tsx +0 -19
  42. package/src/components/WfoForms/formFields/CustomerField.tsx +0 -77
  43. package/src/components/WfoForms/formFields/DateField.tsx +0 -72
  44. package/src/components/WfoForms/formFields/DividerField.tsx +0 -29
  45. package/src/components/WfoForms/formFields/ErrorField.tsx +0 -40
  46. package/src/components/WfoForms/formFields/ErrorsField.tsx +0 -34
  47. package/src/components/WfoForms/formFields/LabelField.tsx +0 -43
  48. package/src/components/WfoForms/formFields/ListAddField.tsx +0 -95
  49. package/src/components/WfoForms/formFields/ListDelField.tsx +0 -95
  50. package/src/components/WfoForms/formFields/ListField.tsx +0 -117
  51. package/src/components/WfoForms/formFields/ListItemField.tsx +0 -40
  52. package/src/components/WfoForms/formFields/ListSelectField.tsx +0 -95
  53. package/src/components/WfoForms/formFields/LocationCodeField.tsx +0 -60
  54. package/src/components/WfoForms/formFields/LongTextField.tsx +0 -68
  55. package/src/components/WfoForms/formFields/NestField.tsx +0 -107
  56. package/src/components/WfoForms/formFields/NumField.tsx +0 -85
  57. package/src/components/WfoForms/formFields/OptGroupField.tsx +0 -74
  58. package/src/components/WfoForms/formFields/RadioField.tsx +0 -87
  59. package/src/components/WfoForms/formFields/SelectField/SelectField.tsx +0 -177
  60. package/src/components/WfoForms/formFields/SelectField/index.ts +0 -1
  61. package/src/components/WfoForms/formFields/SelectField/styles.ts +0 -52
  62. package/src/components/WfoForms/formFields/SubmitField.tsx +0 -50
  63. package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +0 -74
  64. package/src/components/WfoForms/formFields/SummaryField.tsx +0 -104
  65. package/src/components/WfoForms/formFields/SummaryFieldStyling.ts +0 -44
  66. package/src/components/WfoForms/formFields/TextField.tsx +0 -81
  67. package/src/components/WfoForms/formFields/commonStyles.ts +0 -32
  68. package/src/components/WfoForms/formFields/deprecated/ContactPersonAutocomplete.tsx +0 -99
  69. package/src/components/WfoForms/formFields/deprecated/ContactPersonAutocompleteStyles.ts +0 -41
  70. package/src/components/WfoForms/formFields/deprecated/ContactPersonNameField.tsx +0 -263
  71. package/src/components/WfoForms/formFields/deprecated/FileUploadField.tsx +0 -151
  72. package/src/components/WfoForms/formFields/deprecated/ImsNodeIdField.tsx +0 -109
  73. package/src/components/WfoForms/formFields/deprecated/ImsPortIdField.tsx +0 -233
  74. package/src/components/WfoForms/formFields/deprecated/ImsPortIdFieldStyling.ts +0 -17
  75. package/src/components/WfoForms/formFields/deprecated/IpNetworkField.tsx +0 -105
  76. package/src/components/WfoForms/formFields/deprecated/IpPrefixTableField.tsx +0 -390
  77. package/src/components/WfoForms/formFields/deprecated/IpPrefixTableFieldStyling.ts +0 -117
  78. package/src/components/WfoForms/formFields/deprecated/SplitPrefix.tsx +0 -138
  79. package/src/components/WfoForms/formFields/deprecated/SplitPrefixStyling.ts +0 -11
  80. package/src/components/WfoForms/formFields/deprecated/SubscriptionField.tsx +0 -263
  81. package/src/components/WfoForms/formFields/deprecated/SubscriptionFieldStyling.ts +0 -33
  82. package/src/components/WfoForms/formFields/deprecated/TimestampField.tsx +0 -110
  83. package/src/components/WfoForms/formFields/deprecated/VlanField.tsx +0 -300
  84. package/src/components/WfoForms/formFields/deprecated/index.ts +0 -15
  85. package/src/components/WfoForms/formFields/deprecated/types.ts +0 -74
  86. package/src/components/WfoForms/formFields/deprecated/utils.ts +0 -1
  87. package/src/components/WfoForms/formFields/index.ts +0 -30
  88. package/src/components/WfoForms/formFields/listFieldStyling.ts +0 -86
  89. package/src/components/WfoForms/formFields/types.ts +0 -41
  90. package/src/components/WfoForms/formFields/utils.spec.ts +0 -296
  91. package/src/components/WfoForms/formFields/utils.ts +0 -69
  92. package/src/components/WfoForms/index.ts +0 -5
  93. package/src/components/WfoWorkflowSteps/WfoStep/WfoStepFormOld.tsx +0 -67
  94. package/src/hooks/deprecated/useGetSurfSubcriptionDropdownOptions.ts +0 -37
  95. package/src/hooks/deprecated/useIsTaggedPort.ts +0 -25
  96. package/src/rtk/endpoints/deprecated/index.ts +0 -1
  97. package/src/rtk/endpoints/deprecated/surfSubscriptionDropdownOptions.ts +0 -53
  98. package/src/rtk/endpoints/formFields.ts +0 -131
  99. package/src/rtk/endpoints/ipam.ts +0 -54
  100. package/src/types/deprecated/SurfSubscriptionDropdownOptionsFilterParams.ts +0 -10
  101. package/src/types/deprecated/index.ts +0 -1
@@ -1,177 +0,0 @@
1
- /*
2
- * Copyright 2019-2023 SURF.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- *
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS,
10
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- * See the License for the specific language governing permissions and
12
- * limitations under the License.
13
- *
14
- */
15
- import React, { useEffect } from 'react';
16
- import ReactSelect from 'react-select';
17
-
18
- import { get } from 'lodash';
19
- import { useTranslations } from 'next-intl';
20
- import { joinName, useField, useForm } from 'uniforms';
21
-
22
- import { EuiFormRow, EuiText } from '@elastic/eui';
23
-
24
- import { useWithOrchestratorTheme } from '@/hooks';
25
- import type { Option } from '@/types';
26
-
27
- import { ListField, ListFieldProps } from '../ListField';
28
- import { ListItemField } from '../ListItemField';
29
- import { ListSelectField } from '../ListSelectField';
30
- import { FieldProps } from '../types';
31
- import { getSelectFieldStyles } from './styles';
32
-
33
- export type SelectFieldProps = FieldProps<
34
- string | string[],
35
- { allowedValues?: string[]; transform?(value: string): string }
36
- >;
37
-
38
- /*
39
-
40
- */
41
- export function UnconnectedSelectField({
42
- allowedValues = [],
43
- disabled,
44
- fieldType,
45
- id,
46
- label,
47
- description,
48
- name,
49
- onChange,
50
- placeholder,
51
- readOnly,
52
- transform,
53
- value,
54
- error,
55
- showInlineError,
56
- errorMessage,
57
- ...props
58
- }: SelectFieldProps) {
59
- const t = useTranslations('pydanticForms');
60
-
61
- const nameArray = joinName(null, name);
62
- let parentName = joinName(nameArray.slice(0, -1));
63
-
64
- // We can't call useField conditionally so we call it for ourselves if there is no parent
65
- if (parentName === '') {
66
- parentName = name;
67
- }
68
- const parent = useField(parentName, {}, { absoluteName: true })[0];
69
- const { model } = useForm();
70
-
71
- if (parentName !== name) {
72
- if (
73
- parent.fieldType === Array &&
74
- (parent as ListFieldProps).uniqueItems
75
- ) {
76
- const allValues: string[] = get(model, parentName, []);
77
- const chosenValues = allValues.filter(
78
- (_item, index) =>
79
- index.toString() !== nameArray[nameArray.length - 1],
80
- );
81
-
82
- allowedValues = allowedValues.filter(
83
- (value) => !chosenValues.includes(value),
84
- );
85
- }
86
- }
87
- const options = allowedValues.map((value: string) => ({
88
- label: transform ? transform(value) : value,
89
- text: transform ? transform(value) : value,
90
- value: value,
91
- }));
92
-
93
- const selectedValue = options.find(
94
- (option: Option) => option.value === value,
95
- );
96
-
97
- // React select allows callbacks to supply style for innercomponents: https://react-select.com/styles#inner-components
98
- const { reactSelectInnerComponentStyles, formRowStyle } =
99
- useWithOrchestratorTheme(getSelectFieldStyles);
100
-
101
- useEffect(() => {
102
- if (selectedValue && selectedValue.value !== 'undefined') {
103
- onChange(selectedValue.value);
104
- }
105
- // Adding the missing dependencies to the dependency array leads to an infinite loop
106
- // eslint-disable-next-line react-hooks/exhaustive-deps
107
- }, []);
108
-
109
- if (fieldType === Array) {
110
- // Avoid circular import with our own ListSelectField (instead of recursively trying to use SelectField)
111
- return (
112
- <ListField name={name}>
113
- <ListItemField name="$">
114
- <ListSelectField
115
- {...{
116
- allowedValues,
117
- disabled,
118
- fieldType,
119
- id,
120
- label,
121
- description,
122
- name,
123
- onChange,
124
- placeholder,
125
- readOnly,
126
- transform,
127
- value,
128
- error,
129
- showInlineError,
130
- errorMessage,
131
- }}
132
- fieldType={fieldType}
133
- name=""
134
- transform={transform}
135
- allowedValues={allowedValues}
136
- {...props}
137
- />
138
- </ListItemField>
139
- </ListField>
140
- );
141
- } else {
142
- return (
143
- <section>
144
- <EuiFormRow
145
- css={formRowStyle}
146
- label={label}
147
- labelAppend={<EuiText size="m">{description}</EuiText>}
148
- error={showInlineError ? errorMessage : false}
149
- isInvalid={error}
150
- id={id}
151
- fullWidth
152
- >
153
- <ReactSelect<Option, false>
154
- id={id}
155
- inputId={`${id}.search`}
156
- name={name}
157
- onChange={(option) => {
158
- if (!readOnly) {
159
- // @ts-expect-error - null needs to be passed in some cases to remove something (eg. a fw endpoint in an l2vpn)
160
- onChange(option?.value ?? null);
161
- }
162
- }}
163
- styles={reactSelectInnerComponentStyles}
164
- options={options}
165
- value={selectedValue}
166
- isSearchable={true}
167
- isClearable={true}
168
- placeholder={
169
- placeholder || t('widgets.select.placeholder')
170
- }
171
- isDisabled={disabled || readOnly}
172
- />
173
- </EuiFormRow>
174
- </section>
175
- );
176
- }
177
- }
@@ -1 +0,0 @@
1
- export * from './SelectField';
@@ -1,52 +0,0 @@
1
- import { getCommonFormFieldStyles } from '@/components/WfoForms/formFields/commonStyles';
2
- import { WfoTheme } from '@/hooks';
3
-
4
- export const getSelectFieldStyles = (wfoTheme: WfoTheme) => {
5
- const { theme } = wfoTheme;
6
- const { formRowStyle } = getCommonFormFieldStyles(wfoTheme);
7
-
8
- const reactSelectInnerComponentStyles = {
9
- option: (
10
- baseStyles: object,
11
- state: { isSelected: boolean; isDisabled: boolean },
12
- ) => ({
13
- ...baseStyles,
14
- borderBottom: theme.border.thin,
15
- borderColor: theme.colors.lightShade,
16
- backgroundColor: theme.colors.lightestShade,
17
- color: state.isSelected
18
- ? theme.colors.primaryText
19
- : theme.colors.text,
20
- }),
21
- control: (baseStyles: object, state: { isFocused: boolean }) => {
22
- return {
23
- ...baseStyles,
24
- backgroundColor: state.isFocused
25
- ? theme.colors.emptyShade
26
- : theme.colors.lightestShade,
27
- color: theme.colors.text,
28
- border: `1px solid ${theme.colors.lightShade}`,
29
- };
30
- },
31
- input: (baseStyles: object) => ({
32
- ...baseStyles,
33
- color: theme.colors.text,
34
- }),
35
- singleValue: (baseStyles: object, state: { isDisabled: boolean }) => {
36
- const opacity = state.isDisabled ? 0.3 : 1;
37
- const transition = 'opacity 300ms';
38
- return {
39
- ...baseStyles,
40
- opacity,
41
- transition,
42
- color: theme.colors.text,
43
- };
44
- },
45
- menu: (baseStyles: object) => ({
46
- ...baseStyles,
47
- backgroundColor: theme.colors.lightestShade,
48
- }),
49
- };
50
-
51
- return { reactSelectInnerComponentStyles, formRowStyle };
52
- };
@@ -1,50 +0,0 @@
1
- /*
2
- * Copyright 2019-2023 SURF.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- *
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS,
10
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- * See the License for the specific language governing permissions and
12
- * limitations under the License.
13
- *
14
- */
15
- import React from 'react';
16
-
17
- import { filterDOMProps, useForm } from 'uniforms';
18
-
19
- import { FieldProps } from '@/components';
20
-
21
- export type SubmitFieldProps = FieldProps<
22
- null,
23
- object,
24
- HTMLInputElement,
25
- HTMLInputElement
26
- >;
27
-
28
- // onChange not used on purpose
29
- export const SubmitField = ({
30
- disabled,
31
- inputRef,
32
- readOnly,
33
- value,
34
- ...props
35
- }: SubmitFieldProps) => {
36
- const { error, state } = useForm();
37
-
38
- return (
39
- <input
40
- disabled={
41
- disabled === undefined ? !!(error || state.disabled) : disabled
42
- }
43
- readOnly={readOnly}
44
- ref={inputRef}
45
- type="submit"
46
- {...(value ? { value } : {})}
47
- {...filterDOMProps(props)}
48
- />
49
- );
50
- };
@@ -1,74 +0,0 @@
1
- /*
2
- * Copyright 2019-2024 SURF.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- *
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS,
10
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- * See the License for the specific language governing permissions and
12
- * limitations under the License.
13
- *
14
- */
15
- import React from 'react';
16
-
17
- import { connectField, filterDOMProps } from 'uniforms';
18
-
19
- import { EuiFormRow, EuiText } from '@elastic/eui';
20
-
21
- import { WfoLoading, WfoSubscriptionDetailSection } from '@/components';
22
- import { useGetSubscriptionDetailQuery } from '@/rtk';
23
-
24
- import { FieldProps } from './types';
25
-
26
- export type SubscriptionSummaryFieldProps = FieldProps<string>;
27
-
28
- interface SubscriptionSummaryDisplayProps {
29
- subscriptionId: string;
30
- }
31
-
32
- export const SubscriptionSummaryDisplay = ({
33
- subscriptionId,
34
- }: SubscriptionSummaryDisplayProps) => {
35
- const { data } = useGetSubscriptionDetailQuery({
36
- subscriptionId,
37
- });
38
- const subscriptionDetail = data?.subscription;
39
-
40
- if (!subscriptionDetail) {
41
- return <WfoLoading />;
42
- }
43
-
44
- return (
45
- <WfoSubscriptionDetailSection subscriptionDetail={subscriptionDetail} />
46
- );
47
- };
48
-
49
- const SubscriptionSummary = ({
50
- id,
51
- value,
52
- description,
53
- ...props
54
- }: SubscriptionSummaryFieldProps) => {
55
- if (!value) {
56
- return null;
57
- }
58
-
59
- return (
60
- <section {...filterDOMProps(props)}>
61
- <EuiFormRow
62
- id={id}
63
- labelAppend={<EuiText size="m">{description}</EuiText>}
64
- fullWidth
65
- >
66
- <SubscriptionSummaryDisplay subscriptionId={value} />
67
- </EuiFormRow>
68
- </section>
69
- );
70
- };
71
-
72
- export const SubscriptionSummaryField = connectField(SubscriptionSummary, {
73
- kind: 'leaf',
74
- });
@@ -1,104 +0,0 @@
1
- /*
2
- * Copyright 2019-2023 SURF.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- *
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS,
10
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- * See the License for the specific language governing permissions and
12
- * limitations under the License.
13
- *
14
- */
15
- import React from 'react';
16
-
17
- import { FieldProps, connectField, filterDOMProps } from 'uniforms';
18
-
19
- import { EuiFlexItem, EuiFormRow, EuiText } from '@elastic/eui';
20
-
21
- import { summaryFieldStyles } from '@/components/WfoForms/formFields/SummaryFieldStyling';
22
- import { getCommonFormFieldStyles } from '@/components/WfoForms/formFields/commonStyles';
23
- import { useWithOrchestratorTheme } from '@/hooks';
24
-
25
- export type SummaryFieldProps = FieldProps<
26
- null,
27
- {
28
- description?: string;
29
- data?: { headers: string[]; labels: string[]; columns: string[][] };
30
- }
31
- >;
32
-
33
- // onChange not used on purpose
34
- function Summary({
35
- id,
36
- label,
37
- description,
38
- data,
39
- ...props
40
- }: SummaryFieldProps) {
41
- const { summaryFieldStyle } = useWithOrchestratorTheme(summaryFieldStyles);
42
- const { formRowStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
43
-
44
- if (!data) {
45
- return null;
46
- }
47
-
48
- const { headers, labels, columns } = data;
49
-
50
- const extraColumnsData = columns.filter((_, index) => index !== 0);
51
- const rows = columns[0].map((row, index) => (
52
- <tr key={index}>
53
- {labels && <td className={`label`}>{labels[index]}</td>}
54
- <td className={`value`}>
55
- {typeof row === 'string' && row.includes('<!doctype html>') ? (
56
- <div
57
- className="emailMessage"
58
- dangerouslySetInnerHTML={{ __html: row }}
59
- ></div>
60
- ) : (
61
- row
62
- )}
63
- </td>
64
- {extraColumnsData &&
65
- extraColumnsData.map((_, idx) => (
66
- <td className={`value`} key={idx}>
67
- {extraColumnsData[idx][index]}
68
- </td>
69
- ))}
70
- </tr>
71
- ));
72
-
73
- const tableHeader =
74
- !headers || headers.length === 0 ? null : (
75
- <tr>
76
- {labels && <th />}
77
- {headers.map((header, idx) => (
78
- <th key={idx}>{header}</th>
79
- ))}
80
- </tr>
81
- );
82
-
83
- return (
84
- <EuiFlexItem css={[summaryFieldStyle, formRowStyle]}>
85
- <section {...filterDOMProps(props)}>
86
- <EuiFormRow
87
- label={label}
88
- labelAppend={<EuiText size="m">{description}</EuiText>}
89
- id={id}
90
- fullWidth
91
- >
92
- <section className="table-summary">
93
- <table id={`${id}-table`}>
94
- <thead>{tableHeader}</thead>
95
- <tbody>{rows}</tbody>
96
- </table>
97
- </section>
98
- </EuiFormRow>
99
- </section>
100
- </EuiFlexItem>
101
- );
102
- }
103
-
104
- export const SummaryField = connectField(Summary, { kind: 'leaf' });
@@ -1,44 +0,0 @@
1
- import { css } from '@emotion/react';
2
-
3
- import { WfoTheme } from '@/hooks';
4
-
5
- export const summaryFieldStyles = ({ theme }: WfoTheme) => {
6
- const summaryFieldStyle = css({
7
- 'div.emailMessage': {
8
- td: {
9
- color: theme.colors.textParagraph,
10
- },
11
- p: {
12
- color: theme.colors.textParagraph,
13
- },
14
- html: {
15
- marginLeft: '-10px',
16
- },
17
- },
18
- 'section.table-summary': {
19
- marginTop: '20px',
20
- width: '100%',
21
- td: {
22
- padding: '10px',
23
- verticalAlign: 'top',
24
- },
25
- 'td:not(:first-child):not(:last-child)': {
26
- borderRight: `1px solid ${theme.colors.borderBasePlain}`,
27
- },
28
- '.label': {
29
- fontWeight: 'bold',
30
- color: theme.colors.backgroundBaseSubdued,
31
- backgroundColor: theme.colors.primary,
32
- borderRight: `2px solid ${theme.colors.borderBasePlain}`,
33
- borderBottom: `1px solid ${theme.colors.borderBasePlain}`,
34
- },
35
- '.value': {
36
- backgroundColor: theme.colors.backgroundBasePrimary,
37
- borderBottom: `1px solid ${theme.colors.borderBasePlain}`,
38
- },
39
- },
40
- });
41
- return {
42
- summaryFieldStyle: summaryFieldStyle,
43
- };
44
- };
@@ -1,81 +0,0 @@
1
- /*
2
- * Copyright 2019-2023 SURF.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- *
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS,
10
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- * See the License for the specific language governing permissions and
12
- * limitations under the License.
13
- *
14
- */
15
- import React from 'react';
16
-
17
- import { connectField, filterDOMProps } from 'uniforms';
18
-
19
- import { EuiFieldText, EuiFormRow, EuiText } from '@elastic/eui';
20
-
21
- import { FieldProps } from '@/components';
22
- import { getCommonFormFieldStyles } from '@/components/WfoForms/formFields/commonStyles';
23
- import { useWithOrchestratorTheme } from '@/hooks';
24
- import { getFormFieldsBaseStyle } from '@/theme';
25
-
26
- export type TextFieldProps = FieldProps<string>;
27
-
28
- function Text({
29
- autoComplete,
30
- disabled,
31
- id,
32
- label,
33
- description,
34
- name,
35
- onChange,
36
- placeholder,
37
- readOnly,
38
- type,
39
- value,
40
- error,
41
- showInlineError,
42
- errorMessage,
43
- ...props
44
- }: TextFieldProps) {
45
- const { formRowStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
46
- const { formFieldBaseStyle } = useWithOrchestratorTheme(
47
- getFormFieldsBaseStyle,
48
- );
49
-
50
- return (
51
- <section {...filterDOMProps(props)}>
52
- <EuiFormRow
53
- css={formRowStyle}
54
- label={label}
55
- labelAppend={<EuiText size="m">{description}</EuiText>}
56
- error={showInlineError ? errorMessage : false}
57
- isInvalid={error}
58
- id={id}
59
- fullWidth
60
- >
61
- <EuiFieldText
62
- css={formFieldBaseStyle}
63
- autoComplete={autoComplete}
64
- disabled={disabled}
65
- name={name}
66
- isInvalid={error}
67
- onChange={(event) => onChange(event.target.value)}
68
- placeholder={placeholder}
69
- readOnly={readOnly}
70
- type={type}
71
- value={value ?? ''}
72
- fullWidth
73
- />
74
- </EuiFormRow>
75
- </section>
76
- );
77
- }
78
-
79
- Text.defaultProps = { type: 'text' };
80
-
81
- export const TextField = connectField(Text, { kind: 'leaf' });
@@ -1,32 +0,0 @@
1
- import { css } from '@emotion/react';
2
-
3
- import { WfoTheme } from '@/hooks';
4
-
5
- export const getCommonFormFieldStyles = ({ theme }: WfoTheme) => {
6
- const formRowStyle = css({
7
- marginBottom: theme.base * 2,
8
-
9
- '.euiText': {
10
- color: theme.colors.text,
11
- },
12
- '.euiFormLabel': {
13
- color: theme.colors.text,
14
- cursor: 'text',
15
- '&.euiFormLabel-isFocused': {
16
- color: theme.colors.primaryText,
17
- },
18
- },
19
- '.euiFormRow__labelWrapper': {
20
- display: 'flex',
21
- flexDirection: 'column',
22
- },
23
- });
24
-
25
- const errorStyle = css({
26
- color: theme.colors.dangerText,
27
- });
28
- return {
29
- errorStyle,
30
- formRowStyle,
31
- };
32
- };