kelt-ui-kit-react 1.5.6 → 1.5.7

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/form/Form.tsx +10 -4
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kelt-ui-kit-react",
3
3
  "type": "module",
4
- "version": "1.5.6",
4
+ "version": "1.5.7",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
package/src/form/Form.tsx CHANGED
@@ -16,6 +16,7 @@ import { TextArea } from "./textArea/TextArea";
16
16
  export type FormProps<
17
17
  T extends { [key: string]: string | number | boolean | Date | string[] }
18
18
  > = {
19
+ id?: string;
19
20
  className?: string;
20
21
  title?: string;
21
22
  hideSubmit?: boolean;
@@ -33,6 +34,7 @@ export const DynamicForm = forwardRef(
33
34
  initialForm,
34
35
  title,
35
36
  onSubmit,
37
+ id,
36
38
  children,
37
39
  autoComplete,
38
40
  onChange,
@@ -204,7 +206,7 @@ export const DynamicForm = forwardRef(
204
206
 
205
207
  {v.type === "select" ? (
206
208
  <Select
207
- id={v.name}
209
+ id={v.id ?? v.name}
208
210
  label={undefined}
209
211
  name={v.name}
210
212
  options={v.options ?? []}
@@ -223,7 +225,7 @@ export const DynamicForm = forwardRef(
223
225
  />
224
226
  ) : v.type === "textarea" ? (
225
227
  <TextArea
226
- id={v.name}
228
+ id={v.id ?? v.name}
227
229
  name={v.name}
228
230
  className="textarea-input"
229
231
  placeholder={v.placeholder ?? ""}
@@ -236,7 +238,7 @@ export const DynamicForm = forwardRef(
236
238
  />
237
239
  ) : (
238
240
  <Input
239
- id={v.name}
241
+ id={v.id ?? v.name}
240
242
  ref={(el) => (inputRefs.current[v.name] = el)}
241
243
  name={v.name}
242
244
  type={v.type}
@@ -264,7 +266,11 @@ export const DynamicForm = forwardRef(
264
266
  </div>
265
267
  <div className="d-flex justify-content-end form-footer">
266
268
  {!hideSubmit && (
267
- <Button disabled={btnDisabledSubmit} title={title || "submit"} />
269
+ <Button
270
+ id={`button-${id}`}
271
+ disabled={btnDisabledSubmit}
272
+ title={title || "submit"}
273
+ />
268
274
  )}
269
275
  </div>
270
276
  </form>