@sb1/ffe-form-react 18.0.4 → 19.0.0

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 (86) hide show
  1. package/es/BaseRadioButton.js +35 -95
  2. package/es/Checkbox.js +43 -49
  3. package/es/Input.js +25 -26
  4. package/es/InputGroup.js +91 -109
  5. package/es/InputTextLike.js +25 -19
  6. package/es/Label.js +27 -28
  7. package/es/PhoneNumber.js +48 -158
  8. package/es/RadioBlock.js +37 -98
  9. package/es/RadioButton.js +26 -22
  10. package/es/RadioButtonInputGroup.js +44 -97
  11. package/es/RadioSwitch.js +38 -64
  12. package/es/TextArea.js +25 -16
  13. package/es/ToggleSwitch.js +36 -98
  14. package/es/Tooltip.js +29 -75
  15. package/es/i18n/en.js +6 -6
  16. package/es/i18n/i18n.js +4 -4
  17. package/es/i18n/nb.js +6 -6
  18. package/es/i18n/nn.js +6 -6
  19. package/es/index.js +14 -17
  20. package/es/message/BaseFieldMessage.js +49 -0
  21. package/es/message/ErrorFieldMessage.js +28 -0
  22. package/es/message/InfoFieldMessage.js +28 -0
  23. package/es/message/SuccessFieldMessage.js +28 -0
  24. package/es/message/index.js +3 -0
  25. package/es/types.js +1 -0
  26. package/lib/BaseRadioButton.js +63 -103
  27. package/lib/Checkbox.js +72 -56
  28. package/lib/Input.js +32 -34
  29. package/lib/InputGroup.js +121 -119
  30. package/lib/InputTextLike.js +32 -27
  31. package/lib/Label.js +34 -35
  32. package/lib/PhoneNumber.js +79 -165
  33. package/lib/RadioBlock.js +65 -106
  34. package/lib/RadioButton.js +33 -29
  35. package/lib/RadioButtonInputGroup.js +51 -104
  36. package/lib/RadioSwitch.js +44 -73
  37. package/lib/TextArea.js +32 -24
  38. package/lib/ToggleSwitch.js +67 -106
  39. package/lib/Tooltip.js +59 -86
  40. package/lib/i18n/en.js +8 -12
  41. package/lib/i18n/i18n.js +12 -14
  42. package/lib/i18n/nb.js +8 -12
  43. package/lib/i18n/nn.js +8 -12
  44. package/lib/index.js +32 -117
  45. package/lib/message/BaseFieldMessage.js +56 -0
  46. package/lib/message/ErrorFieldMessage.js +35 -0
  47. package/lib/message/InfoFieldMessage.js +35 -0
  48. package/lib/message/SuccessFieldMessage.js +35 -0
  49. package/lib/message/index.js +9 -0
  50. package/lib/types.js +2 -0
  51. package/package.json +5 -4
  52. package/types/BaseRadioButton.d.ts +14 -0
  53. package/types/Checkbox.d.ts +13 -0
  54. package/types/Input.d.ts +8 -0
  55. package/types/InputGroup.d.ts +36 -0
  56. package/types/InputTextLike.d.ts +5 -0
  57. package/types/Label.d.ts +9 -0
  58. package/types/PhoneNumber.d.ts +40 -0
  59. package/types/RadioBlock.d.ts +18 -0
  60. package/types/RadioButton.d.ts +7 -0
  61. package/types/RadioButtonInputGroup.d.ts +48 -0
  62. package/types/RadioSwitch.d.ts +23 -0
  63. package/types/TextArea.d.ts +4 -0
  64. package/types/ToggleSwitch.d.ts +16 -0
  65. package/types/Tooltip.d.ts +6 -0
  66. package/types/i18n/en.d.ts +8 -0
  67. package/types/i18n/i18n.d.ts +24 -0
  68. package/types/i18n/nb.d.ts +8 -0
  69. package/types/i18n/nn.d.ts +8 -0
  70. package/types/index.d.ts +14 -212
  71. package/types/message/BaseFieldMessage.d.ts +11 -0
  72. package/types/message/ErrorFieldMessage.d.ts +6 -0
  73. package/types/message/InfoFieldMessage.d.ts +6 -0
  74. package/types/message/SuccessFieldMessage.d.ts +6 -0
  75. package/types/message/index.d.ts +3 -0
  76. package/types/types.d.ts +11 -0
  77. package/es/BaseFieldMessage.js +0 -67
  78. package/es/ErrorFieldMessage.js +0 -21
  79. package/es/InfoFieldMessage.js +0 -9
  80. package/es/SuccessFieldMessage.js +0 -9
  81. package/es/index.d.js +0 -5
  82. package/lib/BaseFieldMessage.js +0 -73
  83. package/lib/ErrorFieldMessage.js +0 -28
  84. package/lib/InfoFieldMessage.js +0 -16
  85. package/lib/SuccessFieldMessage.js +0 -16
  86. package/lib/index.d.js +0 -6
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { TooltipProps } from './Tooltip';
3
+ export interface BaseRadioButtonProps extends Omit<React.ComponentPropsWithoutRef<'input'>, 'value'> {
4
+ /** Additional props passed to the label element */
5
+ labelProps?: React.ComponentProps<'label'>;
6
+ /** The selected value of the radio button set */
7
+ selectedValue?: boolean | string | number | null;
8
+ /** The value of the radio button */
9
+ value: boolean | string | number;
10
+ /** Tooltip providing further detail about the choice */
11
+ tooltip?: string;
12
+ tooltipProps?: TooltipProps;
13
+ }
14
+ export declare const BaseRadioButton: React.ForwardRefExoticComponent<BaseRadioButtonProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export interface CheckboxProps extends Omit<React.ComponentPropsWithoutRef<'input'>, 'children'> {
3
+ /** Removes vertical margins from the checkbox */
4
+ noMargins?: boolean;
5
+ /** If you plan to render the checkbox without a visible label */
6
+ hiddenLabel?: boolean;
7
+ inline?: boolean;
8
+ children: React.ReactNode | ((labelProps: {
9
+ className: string;
10
+ htmlFor: string;
11
+ }) => React.ReactNode);
12
+ }
13
+ export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface InputProps extends React.ComponentPropsWithoutRef<'input'> {
3
+ /** Input fields default to `display: block;`. Set this to `true` to apply the inline modifier. */
4
+ inline?: boolean;
5
+ /** Make the text right aligned */
6
+ textRightAlign?: boolean;
7
+ }
8
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { TooltipProps } from './Tooltip';
3
+ type ChildrenExtraProps = {
4
+ id: string;
5
+ 'aria-invalid': 'true' | 'false';
6
+ 'aria-describedby': string | undefined;
7
+ };
8
+ export interface InputGroupProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
9
+ /** The id that will be used on the input child if you don't want a generated one */
10
+ inputId?: string;
11
+ /** The id used on the label in this component. Could be necessary if your component needs a aria-labelledby. */
12
+ labelId?: string;
13
+ /** Unless you only have one element in your `InputGroup` you will have to use the function-as-a-child pattern. */
14
+ children: NonNullable<React.ReactNode> | ((extraProps: ChildrenExtraProps) => React.ReactNode);
15
+ /** Reserve space for showing `fieldMessage`s so content below don't move
16
+ * vertically if an errormessage shows up. Note that this will only reserve
17
+ * space for one line of content, so keep messages short.
18
+ */
19
+ extraMargin?: boolean;
20
+ /** Use the ErrorFieldMessage component if you need more flexibility in how the content is rendered. */
21
+ fieldMessage?: string | React.ReactElement<{
22
+ id: string;
23
+ }>;
24
+ /** To just render a static, always visible tooltip, use this. */
25
+ description?: string;
26
+ /** Use the Label component if you need more flexibility in how the content is rendered. */
27
+ label?: string | React.ReactElement<{
28
+ id: string;
29
+ htmlFor: string;
30
+ }>;
31
+ onTooltipToggle?: TooltipProps['onClick'];
32
+ /** Use the Tooltip component if you need more flexibility in how the content is rendered. */
33
+ tooltip?: React.ReactNode;
34
+ }
35
+ export declare const InputGroup: React.FC<InputGroupProps>;
36
+ export {};
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface InputTextLikeProps extends React.ComponentPropsWithoutRef<'input'> {
3
+ ariaLabel: string;
4
+ }
5
+ export declare const InputTextLike: React.ForwardRefExoticComponent<InputTextLikeProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface LabelProps extends React.ComponentPropsWithoutRef<'label'> {
3
+ /**
4
+ * Labels default to `display: inline-block;` to have tooltips appear immediately to the right.
5
+ * Set this to `true` if you don't use tooltips and need the label to be `display: block;`.
6
+ */
7
+ block?: boolean;
8
+ }
9
+ export declare const Label: React.FC<LabelProps>;
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ export interface PhoneNumberProps {
3
+ number?: string;
4
+ countryCode?: string;
5
+ onCountryCodeChange?: React.ChangeEventHandler<HTMLInputElement>;
6
+ onNumberChange?: React.ChangeEventHandler<HTMLInputElement>;
7
+ onCountryCodeBlur?: React.FocusEventHandler<HTMLInputElement>;
8
+ onNumberBlur?: React.FocusEventHandler<HTMLInputElement>;
9
+ locale?: 'nn' | 'nb' | 'en';
10
+ disabled?: boolean;
11
+ /** String or ErrorFieldMessage component with message */
12
+ countryCodeFieldMessage?: string | React.ReactElement<{
13
+ id: string;
14
+ }>;
15
+ /** String or ErrorFieldMessage component with message */
16
+ numberFieldMessage?: string | React.ReactElement<{
17
+ id: string;
18
+ }>;
19
+ /** String or ErrorFieldMessage component with message,
20
+ * this should should be set when both countryCode and number is in an invalid state.
21
+ * If both countryCodeFieldMessage and numberFieldMessage is set and not this prop,
22
+ * the component will throw an Error.
23
+ */
24
+ countryCodeAndNumberFieldMessage?: string | React.ReactElement<{
25
+ id: string;
26
+ }>;
27
+ className?: string;
28
+ /** Reserve space for showing `fieldMessage`s so content below don't move
29
+ * vertically if an errormessage shows up. Note that this will only reserve
30
+ * space for one line of content, so keep messages short.
31
+ */
32
+ extraMargin?: boolean;
33
+ /** Ref-setting function, or ref created by useRef, passed to the country code input element */
34
+ countryCodeRef?: React.Ref<HTMLInputElement>;
35
+ /** Ref-setting function, or ref created by useRef, passed to the number input element */
36
+ numberRef?: React.Ref<HTMLInputElement>;
37
+ /** If True label is changed from "Phone number" to "Mobile number" */
38
+ isMobileNumber?: boolean;
39
+ }
40
+ export declare const PhoneNumber: React.FC<PhoneNumberProps>;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ export interface RadioBlockProps extends React.ComponentPropsWithoutRef<'input'> {
3
+ /** Whether or not the radio block is selected */
4
+ checked?: boolean;
5
+ /** The always visible label of the radio block */
6
+ label: React.ReactNode;
7
+ /** Additional class names applied to the label element */
8
+ labelClass?: string;
9
+ /** The name of the radio button set */
10
+ name: string;
11
+ /** The selected value of the radio button set */
12
+ selectedValue?: string;
13
+ /** Whether or not children are always visible */
14
+ showChildren?: boolean;
15
+ /** The value of the radio block */
16
+ value: string;
17
+ }
18
+ export declare const RadioBlock: React.ForwardRefExoticComponent<RadioBlockProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { BaseRadioButtonProps } from './BaseRadioButton';
3
+ export interface RadioButtonProps extends BaseRadioButtonProps {
4
+ /** Indicates whether the radio button is rendered inline or as a block */
5
+ inline?: boolean;
6
+ }
7
+ export declare const RadioButton: React.FC<RadioButtonProps>;
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ export interface RadioButtonInputGroupProps extends Omit<React.ComponentPropsWithoutRef<'fieldset'>, 'children' | 'onChange'> {
3
+ /**
4
+ * Function receiving props relevant to each radio button as an object
5
+ * argument. Expected to return a set of radio buttons, which should get
6
+ * these properties applied to them.
7
+ * */
8
+ children: (inputProps: {
9
+ inline?: boolean;
10
+ name: string;
11
+ onChange: React.ChangeEventHandler<HTMLInputElement>;
12
+ selectedValue?: boolean | string | number | null;
13
+ }) => React.ReactNode;
14
+ /** Additional class names applied to the fieldset */
15
+ className?: string;
16
+ /** To just render a static, always visible tooltip, use this. */
17
+ description?: React.ReactNode;
18
+ /** Reserve space for showing `fieldMessage`s so content below don't move
19
+ * vertically if an errormessage shows up. Note that this will only reserve
20
+ * space for one line of content, so keep messages short.
21
+ */
22
+ extraMargin?: boolean;
23
+ /** String or ErrorFieldMessage component with message */
24
+ fieldMessage?: React.ReactNode;
25
+ /**
26
+ * Indicates whether the radio buttons inside this radio button group is
27
+ * rendered inline or as a block.
28
+ * */
29
+ inline?: boolean;
30
+ /**
31
+ * The text describing the radio button set. Note that if you don't use this
32
+ * prop but provide your own label you should make sure your solution passes
33
+ * acessibility validation using a tool such as aXe DevTools.
34
+ */
35
+ label?: React.ReactNode;
36
+ /** The name of the radio button, required to avoid missing name */
37
+ name: string;
38
+ /** Change handler, receives value of selected radio button */
39
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
40
+ /** The currently selected value */
41
+ selectedValue?: string | boolean | number | null;
42
+ /**
43
+ * String or Tooltip component with further detail about the radio button
44
+ * set
45
+ * */
46
+ tooltip?: React.ReactNode;
47
+ }
48
+ export declare const RadioButtonInputGroup: React.FC<RadioButtonInputGroupProps>;
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ type Value = boolean | string | number;
3
+ export interface RadioSwitchProps extends Omit<React.ComponentPropsWithoutRef<'input'>, 'value'> {
4
+ /** Additional class names applied to both radio buttons */
5
+ className?: string;
6
+ /** The label of the choice to the left */
7
+ leftLabel: string;
8
+ /** The value of the choice to the left */
9
+ leftValue: Value /** Ref-setting function, or ref created by useRef, passed to the input element */;
10
+ leftInnerRef?: React.Ref<HTMLInputElement>;
11
+ /** The label of the choice to the right */
12
+ rightLabel: string;
13
+ /** The value of the choice to the right */
14
+ rightValue: Value;
15
+ /** Ref-setting function, or ref created by useRef, passed to the input element */
16
+ rightInnerRef?: React.Ref<HTMLInputElement>;
17
+ /** The selected value of the radio button set */
18
+ selectedValue?: Value | null;
19
+ /** Condensed modifier. Use in condensed designs */
20
+ condensed?: boolean;
21
+ }
22
+ export declare const RadioSwitch: React.FC<RadioSwitchProps>;
23
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export interface TextAreaProps extends React.ComponentPropsWithoutRef<'textarea'> {
3
+ }
4
+ export declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ export interface ToggleSwitchProps extends React.ComponentPropsWithoutRef<'input'> {
3
+ /** A second line of text in the label */
4
+ locale?: 'nb' | 'nn' | 'en';
5
+ /** On/Off text language */
6
+ description?: string;
7
+ /** Custom text to specify the on-option */
8
+ onText?: string;
9
+ /** Custom text to specify the off-option */
10
+ offText?: string;
11
+ /** Hide On & Off labels next to switch */
12
+ hideOnOff?: boolean;
13
+ /** Override the value attribute of the input with a custom one */
14
+ value?: string;
15
+ }
16
+ export declare const ToggleSwitch: React.FC<ToggleSwitchProps>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface TooltipProps extends Pick<React.ComponentProps<'button'>, 'aria-controls' | 'aria-label' | 'children' | 'className' | 'onClick' | 'tabIndex'> {
3
+ containerProps?: React.ComponentPropsWithoutRef<'div'>;
4
+ isOpen?: boolean;
5
+ }
6
+ export declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ readonly COUNTRY_CODE: "Country code";
3
+ readonly PHONE_NUMBER: "Phone number";
4
+ readonly MOBILE_NUMBER: "Mobile number";
5
+ readonly ON: "On";
6
+ readonly OFF: "Off";
7
+ };
8
+ export default _default;
@@ -0,0 +1,24 @@
1
+ declare const _default: {
2
+ readonly nb: {
3
+ readonly COUNTRY_CODE: "Landskode";
4
+ readonly PHONE_NUMBER: "Telefonnummer";
5
+ readonly MOBILE_NUMBER: "Mobilnummer";
6
+ readonly ON: "På";
7
+ readonly OFF: "Av";
8
+ };
9
+ readonly nn: {
10
+ readonly COUNTRY_CODE: "Landskode";
11
+ readonly PHONE_NUMBER: "Telefonnummer";
12
+ readonly MOBILE_NUMBER: "Mobilnummer";
13
+ readonly ON: "På";
14
+ readonly OFF: "Av";
15
+ };
16
+ readonly en: {
17
+ readonly COUNTRY_CODE: "Country code";
18
+ readonly PHONE_NUMBER: "Phone number";
19
+ readonly MOBILE_NUMBER: "Mobile number";
20
+ readonly ON: "On";
21
+ readonly OFF: "Off";
22
+ };
23
+ };
24
+ export default _default;
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ readonly COUNTRY_CODE: "Landskode";
3
+ readonly PHONE_NUMBER: "Telefonnummer";
4
+ readonly MOBILE_NUMBER: "Mobilnummer";
5
+ readonly ON: "På";
6
+ readonly OFF: "Av";
7
+ };
8
+ export default _default;
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ readonly COUNTRY_CODE: "Landskode";
3
+ readonly PHONE_NUMBER: "Telefonnummer";
4
+ readonly MOBILE_NUMBER: "Mobilnummer";
5
+ readonly ON: "På";
6
+ readonly OFF: "Av";
7
+ };
8
+ export default _default;
package/types/index.d.ts CHANGED
@@ -1,212 +1,14 @@
1
- import * as React from 'react';
2
-
3
- export interface CheckboxProps
4
- extends Omit<React.ComponentPropsWithoutRef<'input'>, 'children'> {
5
- noMargins?: boolean;
6
- hiddenLabel?: boolean;
7
- id?: string;
8
- inline?: boolean;
9
- children?:
10
- | NonNullable<React.ReactNode>
11
- | ((labelProps: {
12
- className: string;
13
- htmlFor: string;
14
- }) => React.ReactNode);
15
- }
16
-
17
- export interface BaseFieldMessageProps extends React.ComponentProps<'div'> {
18
- children: React.ReactNode;
19
- className?: string;
20
- element?: string;
21
- role?: 'status' | 'alert' | 'none';
22
- }
23
-
24
- export interface InputProps extends React.ComponentProps<'input'> {
25
- className?: string;
26
- inline?: boolean;
27
- textRightAlign?: boolean;
28
- }
29
-
30
- export interface InputTextLikeProps extends React.ComponentProps<'input'> {
31
- ariaLabel: string;
32
- className?: string;
33
- }
34
-
35
- export interface PhoneNumberProps {
36
- number?: string;
37
- countryCode?: string;
38
- onCountryCodeChange?: React.ChangeEventHandler<HTMLInputElement>;
39
- onNumberChange?: React.ChangeEventHandler<HTMLInputElement>;
40
- onCountryCodeBlur?: React.FocusEventHandler<HTMLInputElement>;
41
- onNumberBlur?: React.FocusEventHandler<HTMLInputElement>;
42
- locale?: string;
43
- disabled?: boolean;
44
- countryCodeFieldMessage?: string | React.ReactNode;
45
- numberFieldMessage?: string | React.ReactNode;
46
- countryCodeAndNumberFieldMessage?: string | React.ReactNode;
47
- className?: string;
48
- extraMargin?: boolean;
49
- countryCodeRef?: React.Ref<HTMLInputElement>;
50
- numberRef?: React.Ref<HTMLInputElement>;
51
- isMobileNumber?: boolean;
52
- }
53
-
54
- export interface LabelProps extends React.ComponentProps<'label'> {
55
- block?: boolean;
56
- children: React.ReactNode;
57
- className?: string;
58
- htmlFor?: string;
59
- }
60
-
61
- export interface InputGroupProps
62
- extends Omit<React.ComponentProps<'div'>, 'children'> {
63
- inputId?: string;
64
- /** Unless you only have one element in your `InputGroup` you will have to use the function-as-a-child pattern. */
65
- children:
66
- | React.ReactNode
67
- | ((extraProps: {
68
- id: string;
69
- 'aria-invalid': 'true' | 'false';
70
- 'aria-describedby': string;
71
- }) => React.ReactNode);
72
- className?: string;
73
- extraMargin?: boolean;
74
- fieldMessage?: string | React.ReactNode;
75
- description?: string;
76
- label?: string | React.ReactNode;
77
- labelId?: string;
78
- onTooltipToggle?: (e: React.MouseEvent | undefined) => void;
79
- tooltip?: React.ReactNode;
80
- }
81
-
82
- export interface TooltipProps extends React.ComponentProps<'span'> {
83
- 'aria-controls'?: string;
84
- children?: React.ReactNode;
85
- className?: string;
86
- isOpen?: boolean;
87
- onClick?: (e: React.MouseEvent | undefined) => void;
88
- tabIndex?: number;
89
- ref?: React.ForwardedRef<HTMLButtonElement>;
90
- }
91
-
92
- export interface RadioBlockProps extends React.ComponentProps<'input'> {
93
- checked?: boolean;
94
- children?: React.ReactNode;
95
- className?: string;
96
- innerRef?: React.Ref<HTMLInputElement>;
97
- label: string | React.ReactNode;
98
- labelClass?: string;
99
- name: string;
100
- selectedValue?: boolean | string | number | null;
101
- showChildren?: boolean;
102
- value: string;
103
- }
104
-
105
- // As value has a different type than InputHTMLAttributes<T> we have to weaken it
106
- interface WeakInputAttributes extends React.ComponentProps<'input'> {
107
- value: any;
108
- }
109
-
110
- export interface RadioButtonProps extends WeakInputAttributes {
111
- checked?: boolean;
112
- children: React.ReactNode;
113
- className?: string;
114
- labelProps?: {};
115
- inline?: boolean;
116
- innerRef?: React.Ref<HTMLElement>;
117
- name: string;
118
- selectedValue?: boolean | string | number | null;
119
- tooltip?: string;
120
- tooltipProps?: TooltipProps;
121
- value: boolean | string | number;
122
- }
123
-
124
- // As onChange has a different type than React.FieldsetHTMLAttributes<T> we have to weaken it
125
- interface WeakFieldSetAttributes extends React.ComponentProps<'fieldset'> {
126
- onChange?: any;
127
- }
128
-
129
- export interface RadioButtonInputGroupProps
130
- extends Omit<WeakFieldSetAttributes, 'children'> {
131
- children:
132
- | React.ReactNode
133
- | ((inputProps: {
134
- 'aria-invalid'?: 'true' | 'false';
135
- inline?: boolean;
136
- name: string;
137
- onChange: (...args: any) => any;
138
- selectedValue?: boolean | string | number | null;
139
- }) => React.ReactNode);
140
- className?: string;
141
- description?: string | React.ReactNode;
142
- extraMargin?: boolean;
143
- fieldMessage?: string | React.ReactNode;
144
- inline?: boolean;
145
- label?: string | React.ReactNode;
146
- name: string;
147
- onChange?: React.ChangeEventHandler<HTMLInputElement>;
148
- selectedValue?: string | boolean | number | null;
149
- tooltip?: string | React.ReactNode;
150
- }
151
-
152
- export interface RadioSwitchProps extends React.ComponentProps<'input'> {
153
- checked?: boolean;
154
- className?: string;
155
- labelProps?: {};
156
- leftLabel: string;
157
- leftValue: boolean | string | number;
158
- leftInnerRef?: React.Ref<HTMLInputElement>;
159
- rightLabel: string;
160
- rightValue: boolean | string | number;
161
- rightInnerRef?: React.Ref<HTMLInputElement>;
162
- name: string;
163
- selectedValue?: boolean | string | number | null;
164
- tooltip?: string;
165
- tooltipProps?: TooltipProps;
166
- condensed?: boolean;
167
- }
168
-
169
- export interface TextAreaProps extends React.ComponentProps<'textarea'> {
170
- className?: string;
171
- }
172
-
173
- export interface ToggleSwitchProps extends React.ComponentProps<'input'> {
174
- children: React.ReactNode;
175
- className?: string;
176
- locale?: 'nb' | 'nn' | 'en';
177
- id?: string;
178
- description?: string;
179
- onText?: string;
180
- offText?: string;
181
- hideOnOff?: boolean;
182
- value?: string;
183
- }
184
-
185
- declare class Checkbox extends React.Component<CheckboxProps, any> {}
186
- declare class ErrorFieldMessage extends React.Component<
187
- BaseFieldMessageProps,
188
- any
189
- > {}
190
- declare class InfoFieldMessage extends React.Component<
191
- BaseFieldMessageProps,
192
- any
193
- > {}
194
- declare class SuccessFieldMessage extends React.Component<
195
- BaseFieldMessageProps,
196
- any
197
- > {}
198
- declare class Input extends React.Component<InputProps, any> {}
199
- declare class InputTextLike extends React.Component<InputTextLikeProps, any> {}
200
- declare class PhoneNumber extends React.Component<PhoneNumberProps, any> {}
201
- declare class Label extends React.Component<LabelProps, any> {}
202
- declare class InputGroup extends React.Component<InputGroupProps, any> {}
203
- declare class Tooltip extends React.Component<TooltipProps, any> {}
204
- declare class ToggleSwitch extends React.Component<ToggleSwitchProps, any> {}
205
- declare class RadioBlock extends React.Component<RadioBlockProps, any> {}
206
- declare class RadioButton extends React.Component<RadioButtonProps, any> {}
207
- declare class RadioButtonInputGroup extends React.Component<
208
- RadioButtonInputGroupProps,
209
- any
210
- > {}
211
- declare class RadioSwitch extends React.Component<RadioSwitchProps, any> {}
212
- declare class TextArea extends React.Component<TextAreaProps, any> {}
1
+ export { ErrorFieldMessage, ErrorFieldMessageProps, InfoFieldMessage, InfoFieldMessageProps, SuccessFieldMessage, SuccessFieldMessageProps, } from './message';
2
+ export { Checkbox, CheckboxProps } from './Checkbox';
3
+ export { Input, InputProps } from './Input';
4
+ export { InputTextLike, InputTextLikeProps } from './InputTextLike';
5
+ export { InputGroup, InputGroupProps } from './InputGroup';
6
+ export { Label, LabelProps } from './Label';
7
+ export { PhoneNumber, PhoneNumberProps } from './PhoneNumber';
8
+ export { RadioBlock, RadioBlockProps } from './RadioBlock';
9
+ export { RadioButton, RadioButtonProps } from './RadioButton';
10
+ export { RadioButtonInputGroup, RadioButtonInputGroupProps, } from './RadioButtonInputGroup';
11
+ export { RadioSwitch, RadioSwitchProps } from './RadioSwitch';
12
+ export { TextArea, TextAreaProps } from './TextArea';
13
+ export { Tooltip, TooltipProps } from './Tooltip';
14
+ export { ToggleSwitch, ToggleSwitchProps } from './ToggleSwitch';
@@ -0,0 +1,11 @@
1
+ import React, { ElementType } from 'react';
2
+ import { ComponentWithoutRefAsPropParams } from '../types';
3
+ export type BaseFieldMessageProps<As extends ElementType = any> = ComponentWithoutRefAsPropParams<As> & {
4
+ type: 'success' | 'info' | 'error';
5
+ role: 'status' | 'alert' | 'none';
6
+ };
7
+ /**
8
+ * Internal factory component
9
+ * @ignore
10
+ */
11
+ export declare const BaseFieldMessage: React.FC<BaseFieldMessageProps>;
@@ -0,0 +1,6 @@
1
+ import React, { ElementType } from 'react';
2
+ import { BaseFieldMessageProps } from './BaseFieldMessage';
3
+ export type ErrorFieldMessageProps<As extends ElementType = any> = Omit<BaseFieldMessageProps<As>, 'type' | 'role'> & {
4
+ role?: BaseFieldMessageProps['role'];
5
+ };
6
+ export declare const ErrorFieldMessage: React.FC<ErrorFieldMessageProps>;
@@ -0,0 +1,6 @@
1
+ import React, { ElementType } from 'react';
2
+ import { BaseFieldMessageProps } from './BaseFieldMessage';
3
+ export type InfoFieldMessageProps<As extends ElementType = any> = Omit<BaseFieldMessageProps<As>, 'type' | 'role'> & {
4
+ role?: BaseFieldMessageProps['role'];
5
+ };
6
+ export declare const InfoFieldMessage: React.FC<InfoFieldMessageProps>;
@@ -0,0 +1,6 @@
1
+ import React, { ElementType } from 'react';
2
+ import { BaseFieldMessageProps } from './BaseFieldMessage';
3
+ export type SuccessFieldMessageProps<As extends ElementType = any> = Omit<BaseFieldMessageProps<As>, 'type' | 'role'> & {
4
+ role?: BaseFieldMessageProps['role'];
5
+ };
6
+ export declare const SuccessFieldMessage: React.FC<SuccessFieldMessageProps>;
@@ -0,0 +1,3 @@
1
+ export { ErrorFieldMessage, ErrorFieldMessageProps } from './ErrorFieldMessage';
2
+ export { InfoFieldMessage, InfoFieldMessageProps } from './InfoFieldMessage';
3
+ export { SuccessFieldMessage, SuccessFieldMessageProps, } from './SuccessFieldMessage';
@@ -0,0 +1,11 @@
1
+ import { ComponentPropsWithRef, ComponentPropsWithoutRef, ElementType, ForwardedRef } from 'react';
2
+ export type DistributiveOmit<T, Omitted extends PropertyKey> = T extends any ? Omit<T, Omitted> : never;
3
+ export type ComponentWithoutRefAsPropParams<As extends ElementType = any> = {
4
+ as?: As;
5
+ } & DistributiveOmit<ComponentPropsWithoutRef<ElementType extends As ? 'div' : As>, 'as'>;
6
+ export type ComponentWithRefAsPropParams<As extends ElementType> = {
7
+ as?: As;
8
+ } & DistributiveOmit<ComponentPropsWithRef<ElementType extends As ? 'div' : As>, 'as' & {
9
+ ref: ForwardedRef<any>;
10
+ }>;
11
+ export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;