@scm-manager/ui-forms 2.42.4-20230303-075421 → 2.42.4-20230303-084047

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.
@@ -1,4 +1,4 @@
1
- @scm-manager/ui-forms:build: cache hit, replaying output ff28bc841eecb81a
1
+ @scm-manager/ui-forms:build: cache hit, replaying output 3f05d57fa85ee2eb
2
2
  @scm-manager/ui-forms:build: $ tsup ./src/index.ts -d build --format esm,cjs --dts
3
3
  @scm-manager/ui-forms:build: CLI Building entry: ./src/index.ts
4
4
  @scm-manager/ui-forms:build: CLI Using tsconfig: tsconfig.json
@@ -6,10 +6,10 @@
6
6
  @scm-manager/ui-forms:build: CLI Target: node14
7
7
  @scm-manager/ui-forms:build: ESM Build start
8
8
  @scm-manager/ui-forms:build: CJS Build start
9
- @scm-manager/ui-forms:build: CJS build/index.js 34.78 KB
10
- @scm-manager/ui-forms:build: CJS ⚡️ Build success in 353ms
11
- @scm-manager/ui-forms:build: ESM build/index.mjs 30.11 KB
12
- @scm-manager/ui-forms:build: ESM ⚡️ Build success in 396ms
9
+ @scm-manager/ui-forms:build: CJS build/index.js 37.31 KB
10
+ @scm-manager/ui-forms:build: CJS ⚡️ Build success in 165ms
11
+ @scm-manager/ui-forms:build: ESM build/index.mjs 32.38 KB
12
+ @scm-manager/ui-forms:build: ESM ⚡️ Build success in 187ms
13
13
  @scm-manager/ui-forms:build: DTS Build start
14
- @scm-manager/ui-forms:build: DTS ⚡️ Build success in 32566ms
15
- @scm-manager/ui-forms:build: DTS build/index.d.ts 25.09 KB
14
+ @scm-manager/ui-forms:build: DTS ⚡️ Build success in 15802ms
15
+ @scm-manager/ui-forms:build: DTS build/index.d.ts 21.58 KB
package/build/index.d.ts CHANGED
@@ -8,15 +8,44 @@ declare type Props$9<FormType extends Record<string, unknown>, DefaultValues ext
8
8
  children: ((renderProps: RenderProps$3<FormType>) => React__default.ReactNode | React__default.ReactNode[]) | React__default.ReactNode;
9
9
  translationPath: [namespace: string, prefix: string];
10
10
  onSubmit: SubmitHandler<FormType>;
11
- defaultValues: Omit<DefaultValues, keyof HalRepresentation>;
11
+ defaultValues: DefaultValues;
12
12
  readOnly?: boolean;
13
13
  submitButtonTestId?: string;
14
+ /**
15
+ * Renders a button which resets the form to its default.
16
+ * This reflects the default browser behavior for a form *reset*.
17
+ *
18
+ * @since 2.43.0
19
+ */
20
+ withDiscardChanges?: boolean;
21
+ /**
22
+ * Renders a button which acts as if a user manually updated all fields to supplied values.
23
+ * The default use-case for this is to clear forms and this is also how the button is labelled.
24
+ * You can also use it to reset the form to an original state, but it is then advised to change the button label
25
+ * to *Reset to Defaults* by defining the *reset* translation in the form's translation object's root.
26
+ *
27
+ * > *Important Note:* This mechanism cannot be used to change the number of items in lists,
28
+ * > neither on the root level nor nested.
29
+ * > It is therefore advised not to use this property when lists or nested forms are involved.
30
+ *
31
+ * @since 2.43.0
32
+ */
33
+ withResetTo?: DefaultValues;
34
+ /**
35
+ * Message to display after a successful submit if no translation key is defined.
36
+ *
37
+ * If this is not supplied and the root level `submit-success-notification` translation key is not set,
38
+ * no message is displayed at all.
39
+ *
40
+ * @since 2.43.0
41
+ */
42
+ successMessageFallback?: string;
14
43
  };
15
44
  /**
16
45
  * @beta
17
46
  * @since 2.41.0
18
47
  */
19
- declare function Form$1<FormType extends Record<string, unknown>, DefaultValues extends FormType>({ children, onSubmit, defaultValues, translationPath, readOnly, submitButtonTestId, }: Props$9<FormType, DefaultValues>): JSX.Element;
48
+ declare function Form$1<FormType extends Record<string, unknown>, DefaultValues extends FormType = FormType>({ children, onSubmit, defaultValues, translationPath, readOnly, withResetTo, withDiscardChanges, successMessageFallback, submitButtonTestId, }: Props$9<FormType, DefaultValues>): JSX.Element;
20
49
 
21
50
  declare const Input: React__default.ForwardRefExoticComponent<{
22
51
  variant?: "danger" | undefined;
@@ -27,19 +56,18 @@ declare type InputFieldProps = {
27
56
  label: string;
28
57
  helpText?: string;
29
58
  error?: string;
30
- type?: "text" | "password" | "email" | "tel";
31
- } & Omit<React__default.ComponentProps<typeof Input>, "type">;
59
+ } & React__default.ComponentProps<typeof Input>;
32
60
  /**
33
61
  * @see https://bulma.io/documentation/form/input/
34
62
  */
35
- declare const InputField: React__default.ForwardRefExoticComponent<Pick<InputFieldProps, "className" | "children" | "hidden" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "label" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "type" | "value" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "testId" | "enterKeyHint" | "error" | "helpText" | "variant"> & React__default.RefAttributes<HTMLInputElement>>;
63
+ declare const InputField: React__default.ForwardRefExoticComponent<Pick<InputFieldProps, "label" | "key" | "testId" | keyof React__default.InputHTMLAttributes<HTMLInputElement> | "error" | "helpText" | "variant"> & React__default.RefAttributes<HTMLInputElement>>;
36
64
 
37
65
  declare type Props$8<T extends Record<string, unknown>> = Omit<ComponentProps<typeof InputField>, "error" | "label" | "defaultChecked" | "required" | keyof ControllerRenderProps> & {
38
66
  rules?: ComponentProps<typeof Controller>["rules"];
39
67
  name: Path<T>;
40
68
  label?: string;
41
69
  };
42
- declare function ControlledInputField$1<T extends Record<string, unknown>>({ name, label, helpText, rules, testId, defaultValue, readOnly, ...props }: Props$8<T>): JSX.Element;
70
+ declare function ControlledInputField$1<T extends Record<string, unknown>>({ name, label, helpText, rules, testId, defaultValue, readOnly, className, ...props }: Props$8<T>): JSX.Element;
43
71
 
44
72
  declare const CheckboxField: React__default.ForwardRefExoticComponent<Pick<{
45
73
  label: string;
@@ -52,7 +80,7 @@ declare type Props$7<T extends Record<string, unknown>> = Omit<ComponentProps<ty
52
80
  label?: string;
53
81
  rules?: Pick<RegisterOptions, "deps">;
54
82
  };
55
- declare function ControlledInputField<T extends Record<string, unknown>>({ name, label, helpText, rules, testId, defaultChecked, readOnly, ...props }: Props$7<T>): JSX.Element;
83
+ declare function ControlledInputField<T extends Record<string, unknown>>({ name, label, helpText, rules, testId, defaultChecked, readOnly, className, ...props }: Props$7<T>): JSX.Element;
56
84
 
57
85
  declare type Props$6<T extends Record<string, unknown>> = Omit<ComponentProps<typeof InputField>, "error" | "label" | "defaultChecked" | "required" | keyof ControllerRenderProps> & {
58
86
  rules?: ComponentProps<typeof Controller>["rules"];
@@ -88,7 +116,7 @@ declare type Props$4<T extends Record<string, unknown>> = Omit<ComponentProps<ty
88
116
  name: Path<T>;
89
117
  label?: string;
90
118
  };
91
- declare function ControlledSelectField<T extends Record<string, unknown>>({ name, label, helpText, rules, testId, defaultValue, readOnly, ...props }: Props$4<T>): JSX.Element;
119
+ declare function ControlledSelectField<T extends Record<string, unknown>>({ name, label, helpText, rules, testId, defaultValue, readOnly, className, ...props }: Props$4<T>): JSX.Element;
92
120
 
93
121
  declare type ArrayItemType<T> = T extends Array<infer U> ? U : unknown;
94
122
  declare type RenderProps$2<T extends Record<string, unknown>, PATH extends Path<T>> = {
@@ -138,14 +166,14 @@ declare type Props$1<FormType extends Record<string, unknown>, DefaultValues ext
138
166
  */
139
167
  declare function AddListEntryForm<FormType extends Record<string, unknown>, DefaultValues extends FormType>({ children, defaultValues, submit, disableSubmitWhenDirty, }: Props$1<FormType, DefaultValues>): JSX.Element | null;
140
168
 
141
- declare type Props<T extends HalRepresentation> = Pick<ComponentProps<typeof Form$1<T, T>>, "translationPath" | "children"> & {
169
+ declare type Props<T extends HalRepresentation> = Omit<ComponentProps<typeof Form$1<T>>, "onSubmit" | "defaultValues" | "readOnly" | "successMessageFallback"> & {
142
170
  link: string;
143
171
  };
144
172
  /**
145
173
  * @beta
146
174
  * @since 2.41.0
147
175
  */
148
- declare function ConfigurationForm<T extends HalRepresentation>({ link, translationPath, children }: Props<T>): JSX.Element;
176
+ declare function ConfigurationForm<T extends HalRepresentation>({ link, children, ...formProps }: Props<T>): JSX.Element;
149
177
 
150
178
  declare type QueryKeyPair = [singular: string, plural: string];
151
179
  declare type LinkOrHalLink = string | [entity: HalRepresentation, link: string] | HalRepresentation;
package/build/index.js CHANGED
@@ -54,6 +54,32 @@ function useScmFormContext() {
54
54
  // src/Form.tsx
55
55
  var import_react_i18next = require("react-i18next");
56
56
  var import_ui_buttons = require("@scm-manager/ui-buttons");
57
+ var import_styled_components = __toESM(require("styled-components"));
58
+
59
+ // src/helpers.ts
60
+ function prefixWithoutIndices(path) {
61
+ return path.replace(/(\.\d+)/g, "");
62
+ }
63
+ function setValues(newValues, setValue, path = "") {
64
+ for (const [key, val] of Object.entries(newValues)) {
65
+ if (val !== null && typeof val === "object") {
66
+ if (Array.isArray(val)) {
67
+ val.forEach((subVal, idx) => setValues(subVal, setValue, path ? `${path}.${key}.${idx}` : `${key}.${idx}`));
68
+ } else {
69
+ setValues(val, setValue, path ? `${path}.${key}` : key);
70
+ }
71
+ } else {
72
+ const fullPath = path ? `${path}.${key}` : key;
73
+ setValue(fullPath, val, { shouldValidate: !fullPath.endsWith("Confirmation"), shouldDirty: true });
74
+ }
75
+ }
76
+ }
77
+
78
+ // src/Form.tsx
79
+ var ButtonsContainer = import_styled_components.default.div`
80
+ display: flex;
81
+ gap: 0.75rem;
82
+ `;
57
83
  var SuccessNotification = ({ label, hide }) => {
58
84
  if (!label) {
59
85
  return null;
@@ -71,13 +97,16 @@ function Form({
71
97
  defaultValues,
72
98
  translationPath,
73
99
  readOnly,
100
+ withResetTo,
101
+ withDiscardChanges,
102
+ successMessageFallback,
74
103
  submitButtonTestId
75
104
  }) {
76
105
  const form = (0, import_react_hook_form.useForm)({
77
106
  mode: "onChange",
78
107
  defaultValues
79
108
  });
80
- const { formState, handleSubmit, reset } = form;
109
+ const { formState, handleSubmit, reset, setValue } = form;
81
110
  const [ns, prefix] = translationPath;
82
111
  const { t } = (0, import_react_i18next.useTranslation)(ns, { keyPrefix: prefix });
83
112
  const [defaultTranslate] = (0, import_react_i18next.useTranslation)("commons", { keyPrefix: "form" });
@@ -95,9 +124,16 @@ function Form({
95
124
  const [error, setError] = (0, import_react2.useState)();
96
125
  const [showSuccessNotification, setShowSuccessNotification] = (0, import_react2.useState)(false);
97
126
  const submitButtonLabel = t("submit", { defaultValue: defaultTranslate("submit") });
127
+ const resetButtonLabel = t("reset", { defaultValue: defaultTranslate("reset") });
128
+ const discardChangesButtonLabel = t("discardChanges", { defaultValue: defaultTranslate("discardChanges") });
98
129
  const successNotification = translateWithFallback("submit-success-notification", {
99
- defaultValue: defaultTranslate("submit-success-notification")
130
+ defaultValue: successMessageFallback
100
131
  });
132
+ const overwriteValues = (0, import_react2.useCallback)(() => {
133
+ if (withResetTo) {
134
+ setValues(withResetTo, setValue);
135
+ }
136
+ }, [setValue, withResetTo]);
101
137
  (0, import_react2.useEffect)(() => {
102
138
  if (isSubmitSuccessful) {
103
139
  setShowSuccessNotification(true);
@@ -131,21 +167,31 @@ function Form({
131
167
  formId: prefix
132
168
  }, /* @__PURE__ */ import_react2.default.createElement("form", {
133
169
  onSubmit: handleSubmit(submit),
134
- id: prefix
170
+ onReset: () => reset(),
171
+ id: prefix,
172
+ noValidate: true
135
173
  }), showSuccessNotification ? /* @__PURE__ */ import_react2.default.createElement(SuccessNotification, {
136
174
  label: successNotification,
137
175
  hide: () => setShowSuccessNotification(false)
138
176
  }) : null, typeof children === "function" ? children(form) : children, error ? /* @__PURE__ */ import_react2.default.createElement(import_ui_components.ErrorNotification, {
139
177
  error
140
178
  }) : null, !readOnly ? /* @__PURE__ */ import_react2.default.createElement(import_ui_components.Level, {
141
- right: /* @__PURE__ */ import_react2.default.createElement(import_ui_buttons.Button, {
179
+ right: /* @__PURE__ */ import_react2.default.createElement(ButtonsContainer, null, /* @__PURE__ */ import_react2.default.createElement(import_ui_buttons.Button, {
142
180
  type: "submit",
143
181
  variant: "primary",
144
182
  testId: submitButtonTestId ?? "submit-button",
145
183
  disabled: !isDirty || !isValid,
146
184
  isLoading: isSubmitting,
147
185
  form: prefix
148
- }, submitButtonLabel)
186
+ }, submitButtonLabel), withDiscardChanges ? /* @__PURE__ */ import_react2.default.createElement(import_ui_buttons.Button, {
187
+ type: "reset",
188
+ form: prefix,
189
+ testId: `${prefix}-discard-changes-button`
190
+ }, discardChangesButtonLabel) : null, withResetTo ? /* @__PURE__ */ import_react2.default.createElement(import_ui_buttons.Button, {
191
+ form: prefix,
192
+ onClick: overwriteValues,
193
+ testId: `${prefix}-reset-button`
194
+ }, resetButtonLabel) : null)
149
195
  }) : null);
150
196
  }
151
197
  var Form_default = Form;
@@ -153,22 +199,10 @@ var Form_default = Form;
153
199
  // src/FormRow.tsx
154
200
  var import_react3 = __toESM(require("react"));
155
201
  var import_classnames = __toESM(require("classnames"));
156
- var import_styled_components = __toESM(require("styled-components"));
157
- var FormRowDiv = import_styled_components.default.div`
158
- .field {
159
- margin-left: 0;
160
- }
161
-
162
- gap: 1rem;
163
-
164
- &:not(:last-child) {
165
- margin-bottom: 1rem;
166
- }
167
- `;
168
202
  var FormRow = import_react3.default.forwardRef(
169
- ({ className, children, hidden, ...rest }, ref) => hidden ? null : /* @__PURE__ */ import_react3.default.createElement(FormRowDiv, {
203
+ ({ className, children, hidden, ...rest }, ref) => hidden ? null : /* @__PURE__ */ import_react3.default.createElement("div", {
170
204
  ref,
171
- className: (0, import_classnames.default)("is-flex is-flex-wrap-wrap", className),
205
+ className: (0, import_classnames.default)("columns", className),
172
206
  ...rest
173
207
  }, children)
174
208
  );
@@ -288,12 +322,8 @@ var ScmNestedFormPathContextProvider = ({ children, path }) => {
288
322
  }, children);
289
323
  };
290
324
 
291
- // src/helpers.ts
292
- function prefixWithoutIndices(path) {
293
- return path.replace(/(\.\d+)/g, "");
294
- }
295
-
296
325
  // src/input/ControlledInputField.tsx
326
+ var import_classnames7 = __toESM(require("classnames"));
297
327
  function ControlledInputField({
298
328
  name,
299
329
  label,
@@ -302,6 +332,7 @@ function ControlledInputField({
302
332
  testId,
303
333
  defaultValue,
304
334
  readOnly,
335
+ className,
305
336
  ...props
306
337
  }) {
307
338
  const { control, t, readOnly: formReadonly, formId } = useScmFormContext();
@@ -318,6 +349,7 @@ function ControlledInputField({
318
349
  render: ({ field, fieldState }) => /* @__PURE__ */ import_react12.default.createElement(InputField_default, {
319
350
  readOnly: readOnly ?? formReadonly,
320
351
  required: rules == null ? void 0 : rules.required,
352
+ className: (0, import_classnames7.default)("column", className),
321
353
  ...props,
322
354
  ...field,
323
355
  form: formId,
@@ -391,6 +423,7 @@ var CheckboxField = import_react14.default.forwardRef(({ className, ...props },
391
423
  var CheckboxField_default = CheckboxField;
392
424
 
393
425
  // src/checkbox/ControlledCheckboxField.tsx
426
+ var import_classnames8 = __toESM(require("classnames"));
394
427
  function ControlledInputField2({
395
428
  name,
396
429
  label,
@@ -399,6 +432,7 @@ function ControlledInputField2({
399
432
  testId,
400
433
  defaultChecked,
401
434
  readOnly,
435
+ className,
402
436
  ...props
403
437
  }) {
404
438
  const { control, t, readOnly: formReadonly, formId } = useScmFormContext();
@@ -415,7 +449,8 @@ function ControlledInputField2({
415
449
  render: ({ field }) => /* @__PURE__ */ import_react15.default.createElement(CheckboxField_default, {
416
450
  form: formId,
417
451
  readOnly: readOnly ?? formReadonly,
418
- defaultChecked: field.value,
452
+ checked: field.value,
453
+ className: (0, import_classnames8.default)("column", className),
419
454
  ...props,
420
455
  ...field,
421
456
  label: labelTranslation,
@@ -429,6 +464,7 @@ var ControlledCheckboxField_default = ControlledInputField2;
429
464
  // src/input/ControlledSecretConfirmationField.tsx
430
465
  var import_react16 = __toESM(require("react"));
431
466
  var import_react_hook_form4 = require("react-hook-form");
467
+ var import_classnames9 = __toESM(require("classnames"));
432
468
  function ControlledSecretConfirmationField({
433
469
  name,
434
470
  label,
@@ -454,6 +490,16 @@ function ControlledSecretConfirmationField({
454
490
  const confirmationHelpTextTranslation = confirmationHelpText || t(`${prefixedNameWithoutIndices}.confirmation.helpText`);
455
491
  const confirmationErrorMessageTranslation = confirmationErrorMessage || t(`${prefixedNameWithoutIndices}.confirmation.errorMessage`);
456
492
  const secretValue = watch(nameWithPrefix);
493
+ const validateConfirmField = (0, import_react16.useCallback)(
494
+ (value) => secretValue === value || confirmationErrorMessageTranslation,
495
+ [confirmationErrorMessageTranslation, secretValue]
496
+ );
497
+ const confirmFieldRules = (0, import_react16.useMemo)(
498
+ () => ({
499
+ validate: validateConfirmField
500
+ }),
501
+ [validateConfirmField]
502
+ );
457
503
  return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_react_hook_form4.Controller, {
458
504
  control,
459
505
  name: nameWithPrefix,
@@ -463,7 +509,7 @@ function ControlledSecretConfirmationField({
463
509
  deps: [`${nameWithPrefix}Confirmation`]
464
510
  },
465
511
  render: ({ field, fieldState }) => /* @__PURE__ */ import_react16.default.createElement(InputField_default, {
466
- className,
512
+ className: (0, import_classnames9.default)("column", className),
467
513
  readOnly: readOnly ?? formReadonly,
468
514
  ...props,
469
515
  ...field,
@@ -479,8 +525,8 @@ function ControlledSecretConfirmationField({
479
525
  control,
480
526
  name: `${nameWithPrefix}Confirmation`,
481
527
  defaultValue,
482
- render: ({ field, fieldState }) => /* @__PURE__ */ import_react16.default.createElement(InputField_default, {
483
- className,
528
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ import_react16.default.createElement(InputField_default, {
529
+ className: (0, import_classnames9.default)("column", className),
484
530
  type: "password",
485
531
  readOnly: readOnly ?? formReadonly,
486
532
  disabled: props.disabled,
@@ -488,12 +534,10 @@ function ControlledSecretConfirmationField({
488
534
  form: formId,
489
535
  label: confirmationLabelTranslation,
490
536
  helpText: confirmationHelpTextTranslation,
491
- error: fieldState.error ? fieldState.error.message || t(`${prefixedNameWithoutIndices}.confirmation.error.${fieldState.error.type}`) : void 0,
537
+ error: error ? error.message || t(`${prefixedNameWithoutIndices}.confirmation.error.${error.type}`) : void 0,
492
538
  testId: confirmationTestId ?? `input-${nameWithPrefix}-confirmation`
493
539
  }),
494
- rules: {
495
- validate: (value) => secretValue === value || confirmationErrorMessageTranslation
496
- }
540
+ rules: confirmFieldRules
497
541
  }));
498
542
  }
499
543
 
@@ -506,11 +550,11 @@ var import_react18 = __toESM(require("react"));
506
550
 
507
551
  // src/select/Select.tsx
508
552
  var import_react17 = __toESM(require("react"));
509
- var import_classnames7 = __toESM(require("classnames"));
553
+ var import_classnames10 = __toESM(require("classnames"));
510
554
  var import_ui_components5 = require("@scm-manager/ui-components");
511
555
  var Select = import_react17.default.forwardRef(
512
556
  ({ variant, children, className, options, testId, ...props }, ref) => /* @__PURE__ */ import_react17.default.createElement("div", {
513
- className: (0, import_classnames7.default)("select", { "is-multiple": props.multiple }, createVariantClass(variant), className)
557
+ className: (0, import_classnames10.default)("select", { "is-multiple": props.multiple }, createVariantClass(variant), className)
514
558
  }, /* @__PURE__ */ import_react17.default.createElement("select", {
515
559
  ref,
516
560
  ...props,
@@ -540,6 +584,7 @@ var SelectField = import_react18.default.forwardRef(
540
584
  id: selectId,
541
585
  variant,
542
586
  ref,
587
+ className: "is-full-width",
543
588
  ...props
544
589
  })), error ? /* @__PURE__ */ import_react18.default.createElement(FieldMessage_default, {
545
590
  variant
@@ -549,6 +594,7 @@ var SelectField = import_react18.default.forwardRef(
549
594
  var SelectField_default = SelectField;
550
595
 
551
596
  // src/select/ControlledSelectField.tsx
597
+ var import_classnames11 = __toESM(require("classnames"));
552
598
  function ControlledSelectField({
553
599
  name,
554
600
  label,
@@ -557,6 +603,7 @@ function ControlledSelectField({
557
603
  testId,
558
604
  defaultValue,
559
605
  readOnly,
606
+ className,
560
607
  ...props
561
608
  }) {
562
609
  const { control, t, readOnly: formReadonly, formId } = useScmFormContext();
@@ -574,6 +621,7 @@ function ControlledSelectField({
574
621
  form: formId,
575
622
  readOnly: readOnly ?? formReadonly,
576
623
  required: rules == null ? void 0 : rules.required,
624
+ className: (0, import_classnames11.default)("column", className),
577
625
  ...props,
578
626
  ...field,
579
627
  label: labelTranslation,
@@ -642,7 +690,7 @@ var ControlledList_default = ControlledList;
642
690
  // src/table/ControlledTable.tsx
643
691
  var import_react22 = __toESM(require("react"));
644
692
  var import_ui_buttons3 = require("@scm-manager/ui-buttons");
645
- var import_classnames8 = __toESM(require("classnames"));
693
+ var import_classnames12 = __toESM(require("classnames"));
646
694
  var import_react_i18next3 = require("react-i18next");
647
695
  function ControlledTable({
648
696
  withDelete,
@@ -660,7 +708,7 @@ function ControlledTable({
660
708
  return null;
661
709
  }
662
710
  return /* @__PURE__ */ import_react22.default.createElement("table", {
663
- className: (0, import_classnames8.default)("table content is-hoverable", className)
711
+ className: (0, import_classnames12.default)("table content is-hoverable", className)
664
712
  }, /* @__PURE__ */ import_react22.default.createElement("thead", null, /* @__PURE__ */ import_react22.default.createElement("tr", null, import_react22.default.Children.map(children, (child) => /* @__PURE__ */ import_react22.default.createElement("th", null, t(`${prefixedNameWithoutIndices}.${child.props.name}.label`))), withDelete && !readOnly ? /* @__PURE__ */ import_react22.default.createElement("th", {
665
713
  className: "has-text-right"
666
714
  }, actionHeaderLabel) : null)), /* @__PURE__ */ import_react22.default.createElement("tbody", null, fields.map((value, index) => /* @__PURE__ */ import_react22.default.createElement(ScmFormPathContextProvider, {
@@ -749,7 +797,8 @@ function AddListEntryForm({
749
797
  path: ""
750
798
  }, /* @__PURE__ */ import_react24.default.createElement("form", {
751
799
  id: nameWithPrefix,
752
- onSubmit: form.handleSubmit(onSubmit)
800
+ onSubmit: form.handleSubmit(onSubmit),
801
+ noValidate: true
753
802
  }), typeof children === "function" ? children(form) : children, /* @__PURE__ */ import_react24.default.createElement("div", {
754
803
  className: "level-right"
755
804
  }, /* @__PURE__ */ import_react24.default.createElement(import_ui_buttons4.Button, {
@@ -765,16 +814,19 @@ var AddListEntryForm_default = AddListEntryForm;
765
814
  var import_ui_api = require("@scm-manager/ui-api");
766
815
  var import_ui_components7 = require("@scm-manager/ui-components");
767
816
  var import_react25 = __toESM(require("react"));
768
- function ConfigurationForm({ link, translationPath, children }) {
817
+ var import_react_i18next5 = require("react-i18next");
818
+ function ConfigurationForm({ link, children, ...formProps }) {
769
819
  const { initialConfiguration, isReadOnly, update, isLoading } = (0, import_ui_api.useConfigLink)(link);
820
+ const [t] = (0, import_react_i18next5.useTranslation)("commons", { keyPrefix: "form" });
770
821
  if (isLoading || !initialConfiguration) {
771
822
  return /* @__PURE__ */ import_react25.default.createElement(import_ui_components7.Loading, null);
772
823
  }
773
824
  return /* @__PURE__ */ import_react25.default.createElement(Form_default, {
774
825
  onSubmit: update,
775
- translationPath,
776
826
  defaultValues: initialConfiguration,
777
- readOnly: isReadOnly
827
+ readOnly: isReadOnly,
828
+ successMessageFallback: t("submit-success-notification"),
829
+ ...formProps
778
830
  }, children);
779
831
  }
780
832
  var ConfigurationForm_default = ConfigurationForm;