@dfds-ui/forms 2.0.20-alpha.4a92bbb9 → 2.0.20-alpha.7dd0f764

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 (39) hide show
  1. package/cjs/assistive-text/AssistiveText.d.ts +9 -0
  2. package/cjs/asterisk/Asterisk.d.ts +11 -0
  3. package/cjs/checkbox/Checkbox.d.ts +65 -0
  4. package/cjs/checkbox/CheckboxContext.d.ts +13 -0
  5. package/cjs/checkbox/CheckboxGroup.d.ts +20 -0
  6. package/cjs/checkbox/index.d.ts +2 -0
  7. package/cjs/counter/Counter.d.ts +66 -0
  8. package/cjs/counter/index.d.ts +1 -0
  9. package/cjs/enhanced/EnhancedField.d.ts +20 -0
  10. package/cjs/enhanced/index.d.ts +1 -0
  11. package/cjs/error-text/ErrorText.d.ts +8 -0
  12. package/cjs/field-wrap/FieldWrap.d.ts +10 -0
  13. package/cjs/field-wrap/index.d.ts +1 -0
  14. package/cjs/help-icon/HelpIcon.d.ts +8 -0
  15. package/cjs/index.d.ts +18 -0
  16. package/cjs/label/Label.d.ts +11 -0
  17. package/cjs/password-field/PasswordField.d.ts +4 -0
  18. package/cjs/radio/Radio.d.ts +51 -0
  19. package/cjs/radio/RadioContext.d.ts +13 -0
  20. package/cjs/radio/RadioGroup.d.ts +12 -0
  21. package/cjs/radio/index.d.ts +2 -0
  22. package/cjs/rating/Rating.d.ts +55 -0
  23. package/cjs/rating/index.d.ts +1 -0
  24. package/cjs/select-field/AsyncSelectField.d.ts +99 -0
  25. package/cjs/select-field/NativeSelectField.d.ts +8 -0
  26. package/cjs/select-field/SelectField.d.ts +93 -0
  27. package/cjs/switch/Switch.d.ts +32 -0
  28. package/cjs/switch/SwitchContext.d.ts +11 -0
  29. package/cjs/switch/SwitchGroup.d.ts +10 -0
  30. package/cjs/switch/index.d.ts +2 -0
  31. package/cjs/tel-field/TelField.d.ts +67 -0
  32. package/cjs/tel-field/TelField.js +16 -17
  33. package/cjs/text-field/TextField.d.ts +57 -0
  34. package/cjs/textarea-field/TextareaField.d.ts +44 -0
  35. package/cjs/types/field.d.ts +52 -0
  36. package/cjs/types/index.d.ts +2 -0
  37. package/cjs/types/size.d.ts +1 -0
  38. package/package.json +7 -7
  39. package/tel-field/TelField.js +17 -18
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { BaseFieldProps, Size } from '../types';
3
+ export declare type TextFieldProps = BaseFieldProps & {
4
+ autoFocus?: boolean;
5
+ defaultValue?: string;
6
+ prefix?: React.ReactNode;
7
+ suffix?: React.ReactNode;
8
+ icon?: React.ElementType;
9
+ /**
10
+ * Element to be placed after the input element.
11
+ *
12
+ * Useful for adding a button next to the TextField.
13
+ */
14
+ adornment?: React.ReactNode;
15
+ className?: string;
16
+ value?: string;
17
+ visualSize?: Size;
18
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
19
+ onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
20
+ onBlur?: (event: React.ChangeEvent<HTMLInputElement>) => void;
21
+ inputType?: 'email' | 'text' | 'tel' | 'time' | 'url' | 'date' | 'file' | 'number' | 'search' | 'password';
22
+ autoComplete?: string;
23
+ minValue?: string;
24
+ maxValue?: string;
25
+ maxLength?: number;
26
+ minLength?: number;
27
+ readOnly?: boolean;
28
+ step?: number | 'any';
29
+ };
30
+ export declare const TextField: React.ForwardRefExoticComponent<BaseFieldProps & {
31
+ autoFocus?: boolean | undefined;
32
+ defaultValue?: string | undefined;
33
+ prefix?: React.ReactNode;
34
+ suffix?: React.ReactNode;
35
+ icon?: React.ElementType<any> | undefined;
36
+ /**
37
+ * Element to be placed after the input element.
38
+ *
39
+ * Useful for adding a button next to the TextField.
40
+ */
41
+ adornment?: React.ReactNode;
42
+ className?: string | undefined;
43
+ value?: string | undefined;
44
+ visualSize?: Size | undefined;
45
+ onChange?: ((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
46
+ onFocus?: ((event: React.FocusEvent<HTMLInputElement>) => void) | undefined;
47
+ onBlur?: ((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
48
+ inputType?: "number" | "search" | "file" | "password" | "url" | "time" | "text" | "tel" | "email" | "date" | undefined;
49
+ autoComplete?: string | undefined;
50
+ minValue?: string | undefined;
51
+ maxValue?: string | undefined;
52
+ maxLength?: number | undefined;
53
+ minLength?: number | undefined;
54
+ readOnly?: boolean | undefined;
55
+ step?: number | "any" | undefined;
56
+ } & React.RefAttributes<HTMLInputElement>>;
57
+ export default TextField;
@@ -0,0 +1,44 @@
1
+ import React, { ChangeEvent } from 'react';
2
+ import { BaseFieldProps, Size } from '../types';
3
+ export declare const inputPaddings: {
4
+ small: {
5
+ vertical: number;
6
+ horizontal: number;
7
+ };
8
+ medium: {
9
+ vertical: number;
10
+ horizontal: number;
11
+ };
12
+ };
13
+ declare type FieldSize = Extract<Size, 'small' | 'medium'>;
14
+ export declare type TextareaFieldProps = BaseFieldProps & {
15
+ defaultValue?: string;
16
+ size?: FieldSize;
17
+ /**
18
+ * Set a limit to the amount of characters the user may add. This number is also displayed on the bottom counter by default.
19
+ */
20
+ maxValueLength?: number;
21
+ /**
22
+ * Whether to show the length counter at the bottom right
23
+ */
24
+ showLengthCounter?: boolean;
25
+ value?: string;
26
+ onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
27
+ rows?: number;
28
+ };
29
+ export declare const TextareaField: React.ForwardRefExoticComponent<BaseFieldProps & {
30
+ defaultValue?: string | undefined;
31
+ size?: FieldSize | undefined;
32
+ /**
33
+ * Set a limit to the amount of characters the user may add. This number is also displayed on the bottom counter by default.
34
+ */
35
+ maxValueLength?: number | undefined;
36
+ /**
37
+ * Whether to show the length counter at the bottom right
38
+ */
39
+ showLengthCounter?: boolean | undefined;
40
+ value?: string | undefined;
41
+ onChange?: ((event: React.ChangeEvent<HTMLTextAreaElement>) => void) | undefined;
42
+ rows?: number | undefined;
43
+ } & React.RefAttributes<HTMLTextAreaElement>>;
44
+ export {};
@@ -0,0 +1,52 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Generic FieldProps
4
+ */
5
+ export declare type BaseFieldProps = {
6
+ /**
7
+ * Assistive text describing the field.
8
+ *
9
+ * NB! If space is needed for alignment you can use a space char (' ') here.
10
+ */
11
+ assistiveText?: string;
12
+ /**
13
+ * Indicates that the field is disabled.
14
+ */
15
+ disabled?: boolean;
16
+ /**
17
+ * Sets an error message (if assistive text applies it will be replaced by this).
18
+ */
19
+ errorMessage?: string;
20
+ /**
21
+ * Additional help.
22
+ *
23
+ * **This is an experimental prop and the behavior might change.**
24
+ */
25
+ help?: string;
26
+ /**
27
+ * Controls the placement of the help icon.
28
+ *
29
+ * **This is an experimental prop and the behavior might change.**
30
+ */
31
+ helpPlacement?: 'top' | 'right';
32
+ /**
33
+ * If set to `true` the asterisk will never be shown.
34
+ */
35
+ hideAsterisk?: boolean;
36
+ /**
37
+ * Field label.
38
+ */
39
+ label?: ReactNode;
40
+ /**
41
+ * Field name.
42
+ */
43
+ name: string;
44
+ /**
45
+ * Hint for the field. For Input elements this maps to the `placeholder` attribute.
46
+ */
47
+ placeholder?: string;
48
+ /**
49
+ * Indicates if the field is required. Will add an asterisk to the label unless `hideAsterisk` is set to `true`.
50
+ */
51
+ required?: boolean;
52
+ };
@@ -0,0 +1,2 @@
1
+ export * from './field';
2
+ export * from './size';
@@ -0,0 +1 @@
1
+ export declare type Size = 'small' | 'medium' | 'large';
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Form components",
4
4
  "license": "MIT",
5
5
  "private": false,
6
- "version": "2.0.20-alpha.4a92bbb9",
6
+ "version": "2.0.20-alpha.7dd0f764",
7
7
  "sideEffects": false,
8
8
  "main": "./cjs/index.js",
9
9
  "module": "./index.js",
@@ -17,13 +17,13 @@
17
17
  "react-select": "^4.0.0"
18
18
  },
19
19
  "dependencies": {
20
- "@dfds-ui/hooks": "2.0.20-alpha.4a92bbb9",
21
- "@dfds-ui/icons": "2.0.20-alpha.4a92bbb9",
22
- "@dfds-ui/react-components": "2.0.20-alpha.4a92bbb9",
23
- "@dfds-ui/theme": "2.0.20-alpha.4a92bbb9",
24
- "@dfds-ui/typography": "2.0.20-alpha.4a92bbb9"
20
+ "@dfds-ui/hooks": "2.0.20-alpha.7dd0f764",
21
+ "@dfds-ui/icons": "2.0.20-alpha.7dd0f764",
22
+ "@dfds-ui/react-components": "2.0.20-alpha.7dd0f764",
23
+ "@dfds-ui/theme": "2.0.20-alpha.7dd0f764",
24
+ "@dfds-ui/typography": "2.0.20-alpha.7dd0f764"
25
25
  },
26
- "gitHead": "4a92bbb9e036654246e7b2eb0698de56bf1e86e9",
26
+ "gitHead": "7dd0f76447b46c8d71b59011d16aa9aa6cf86ff9",
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  }