@furystack/shades-common-components 4.0.7 → 4.0.9

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 (36) hide show
  1. package/dist/components/button.js +3 -1
  2. package/dist/components/button.js.map +1 -1
  3. package/dist/components/command-palette/command-palette-manager.js.map +1 -1
  4. package/dist/components/data-grid/header.js +0 -5
  5. package/dist/components/data-grid/header.js.map +1 -1
  6. package/dist/components/fab.js +2 -0
  7. package/dist/components/fab.js.map +1 -1
  8. package/dist/components/form.js +88 -0
  9. package/dist/components/form.js.map +1 -0
  10. package/dist/components/grid.js +2 -2
  11. package/dist/components/grid.js.map +1 -1
  12. package/dist/components/index.js +1 -0
  13. package/dist/components/index.js.map +1 -1
  14. package/dist/components/inputs/input.js +90 -18
  15. package/dist/components/inputs/input.js.map +1 -1
  16. package/dist/components/suggest/suggest-manager.js.map +1 -1
  17. package/dist/services/noty-service.js.map +1 -1
  18. package/dist/services/theme-provider-service.js.map +1 -1
  19. package/package.json +7 -7
  20. package/src/components/button.tsx +3 -1
  21. package/src/components/data-grid/header.tsx +0 -5
  22. package/src/components/fab.tsx +2 -0
  23. package/src/components/form.tsx +106 -0
  24. package/src/components/grid.tsx +2 -2
  25. package/src/components/index.ts +1 -0
  26. package/src/components/inputs/input.tsx +122 -25
  27. package/tsconfig.tsbuildinfo +1 -1
  28. package/types/components/button.d.ts.map +1 -1
  29. package/types/components/data-grid/header.d.ts.map +1 -1
  30. package/types/components/fab.d.ts.map +1 -1
  31. package/types/components/form.d.ts +38 -0
  32. package/types/components/form.d.ts.map +1 -0
  33. package/types/components/index.d.ts +1 -0
  34. package/types/components/index.d.ts.map +1 -1
  35. package/types/components/inputs/input.d.ts +20 -0
  36. package/types/components/inputs/input.d.ts.map +1 -1
@@ -1,5 +1,13 @@
1
1
  import type { PartialElement } from '@furystack/shades';
2
2
  import type { Palette } from '../../services';
3
+ export type ValidInputValidationResult = {
4
+ isValid: true;
5
+ };
6
+ export type InvalidInputValidationResult = {
7
+ isValid: false;
8
+ message: string;
9
+ };
10
+ export type InputValidationResult = ValidInputValidationResult | InvalidInputValidationResult;
3
11
  export interface TextInputProps extends PartialElement<HTMLInputElement> {
4
12
  /**
5
13
  * Callback that will be called when the input value changes
@@ -25,29 +33,41 @@ export interface TextInputProps extends PartialElement<HTMLInputElement> {
25
33
  * The default color of the input (Error color will be used in case of invalid input value)
26
34
  */
27
35
  defaultColor?: keyof Palette;
36
+ /**
37
+ * Callback for retrieving the custom validation result
38
+ *
39
+ * @returns The custom validation state
40
+ */
41
+ getValidationResult?: (options: {
42
+ state: TextInputState;
43
+ }) => InputValidationResult;
28
44
  /**
29
45
  * Optional callback for the helper text
30
46
  */
31
47
  getHelperText?: (options: {
32
48
  state: TextInputState;
49
+ validationResult?: InputValidationResult;
33
50
  }) => JSX.Element | string;
34
51
  /**
35
52
  * Optional callback for retrieving an icon element on the left side of the input field
36
53
  */
37
54
  getStartIcon?: (options: {
38
55
  state: TextInputState;
56
+ validationResult?: InputValidationResult;
39
57
  }) => JSX.Element | string;
40
58
  /**
41
59
  * Optional callback for retrieving an icon element on the right side of the input field
42
60
  */
43
61
  getEndIcon?: (options: {
44
62
  state: TextInputState;
63
+ validationResult?: InputValidationResult;
45
64
  }) => JSX.Element | string;
46
65
  }
47
66
  export type TextInputState = {
48
67
  value: string;
49
68
  focused: boolean;
50
69
  validity: ValidityState;
70
+ element: JSX.Element<TextInputProps>;
51
71
  };
52
72
  export declare const Input: (props: TextInputProps, children: import("@furystack/shades").ChildrenList) => JSX.Element<any>;
53
73
  //# sourceMappingURL=input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAIvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,MAAM,WAAW,cAAe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