@dfds-ui/forms 2.0.13-alpha.387f7b2c → 2.0.13-alpha.a1d8e406

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 (38) hide show
  1. package/cjs/assistive-text/AssistiveText.d.ts +8 -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 +9 -0
  13. package/cjs/field-wrap/index.d.ts +1 -0
  14. package/cjs/help-icon/HelpIcon.d.ts +7 -0
  15. package/cjs/index.d.ts +15 -0
  16. package/cjs/label/Label.d.ts +10 -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/NativeSelectField.d.ts +8 -0
  25. package/cjs/select-field/SelectField.d.ts +93 -0
  26. package/cjs/switch/Switch.d.ts +32 -0
  27. package/cjs/switch/SwitchContext.d.ts +11 -0
  28. package/cjs/switch/SwitchGroup.d.ts +10 -0
  29. package/cjs/switch/SwitchGroup.js +2 -3
  30. package/cjs/switch/index.d.ts +2 -0
  31. package/cjs/tel-field/TelField.d.ts +67 -0
  32. package/cjs/text-field/TextField.d.ts +55 -0
  33. package/cjs/textarea-field/TextareaField.d.ts +44 -0
  34. package/cjs/types/field.d.ts +52 -0
  35. package/cjs/types/index.d.ts +2 -0
  36. package/cjs/types/size.d.ts +1 -0
  37. package/package.json +7 -7
  38. package/switch/SwitchGroup.js +2 -3
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare type AssistiveTextProps = {
3
+ id?: string;
4
+ children: React.ReactNode;
5
+ className?: string;
6
+ };
7
+ export declare const AssistiveText: ({ id, className, children }: AssistiveTextProps) => JSX.Element;
8
+ export default AssistiveText;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ export declare type AsteriskProps = {
3
+ /**
4
+ * Class name to be assigned to the component
5
+ */
6
+ className?: string;
7
+ };
8
+ export declare const Asterisk: ({ ...props }: {
9
+ [x: string]: any;
10
+ }) => JSX.Element;
11
+ export default Asterisk;
@@ -0,0 +1,65 @@
1
+ import React, { ReactNode } from 'react';
2
+ declare type CheckboxSize = 'medium' | 'small';
3
+ export declare type CheckboxProps = {
4
+ /**
5
+ * Field name.
6
+ */
7
+ name: string;
8
+ /**
9
+ * Indicate that the checkbox is checked.
10
+ *
11
+ * Setting to either true or false will make this a controlled component.
12
+ */
13
+ checked?: boolean;
14
+ /**
15
+ * Indicate that the checkbox is defaultChecked.
16
+ */
17
+ defaultChecked?: boolean;
18
+ /**
19
+ * Class name to be assigned to the component.
20
+ */
21
+ className?: string;
22
+ /**
23
+ * Field label.
24
+ */
25
+ value?: string;
26
+ /**
27
+ * Indicates that the radio button is disabled.
28
+ */
29
+ disabled?: boolean;
30
+ /**
31
+ * Indicates an error in the field.
32
+ */
33
+ error?: boolean;
34
+ /**
35
+ * Additional help.
36
+ *
37
+ * **This is an experimental prop and the behavior might change.**
38
+ */
39
+ help?: string;
40
+ /**
41
+ * If true the checkbox will be rendered in indeterminate state (visual only).
42
+ */
43
+ indeterminate?: boolean;
44
+ /**
45
+ * Size variant.
46
+ */
47
+ visualSize?: CheckboxSize;
48
+ /**
49
+ * Controls the vertical alignment of the checkbox in relation to the label.
50
+ */
51
+ inputVerticalAlignment?: 'center' | 'top';
52
+ /**
53
+ * Callback when the checkbox is checked or unchecked.
54
+ */
55
+ onChange?: JSX.IntrinsicElements['input']['onChange'];
56
+ /**
57
+ * Callback when the label (or checkbox control) is clicked.
58
+ */
59
+ onLabelClick?: JSX.IntrinsicElements['label']['onClick'];
60
+ children?: ReactNode;
61
+ };
62
+ export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
63
+ /** @deprecated Use Checkbox */
64
+ export declare const CheckboxField: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
65
+ export {};
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { CheckboxProps } from './Checkbox';
3
+ declare type CheckboxContextProps = {
4
+ children?: React.ReactNode;
5
+ visualSize: NonNullable<CheckboxProps['visualSize']>;
6
+ error: CheckboxProps['error'];
7
+ };
8
+ export declare const CheckboxContext: React.Context<CheckboxContextProps | undefined>;
9
+ export declare const CheckboxContextProvider: React.FC<{
10
+ value: CheckboxContextProps;
11
+ }>;
12
+ declare const useCheckboxContext: () => CheckboxContextProps | undefined;
13
+ export default useCheckboxContext;
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { BaseFieldProps } from '../types';
3
+ import { CheckboxProps } from './Checkbox';
4
+ export declare type CheckboxGroupProps = Pick<BaseFieldProps, 'help' | 'label' | 'required' | 'hideAsterisk' | 'disabled' | 'errorMessage' | 'assistiveText'> & Pick<CheckboxProps, 'visualSize'> & {
5
+ children: ReactNode;
6
+ /**
7
+ * Indicates that the CheckboxGroup has an error.
8
+ *
9
+ * You can also set the `errorMessage` prop to indicate an error but setting `error` will trigger
10
+ * the visual indication regardless of the value of `errorMessage`. Setting `errorMessage` and setting
11
+ * `error` to `false` will however still render the visual indication.
12
+ */
13
+ error?: boolean;
14
+ /**
15
+ * Class name to be assigned to the component
16
+ */
17
+ className?: string;
18
+ column?: boolean;
19
+ };
20
+ export declare const CheckboxGroup: ({ visualSize, help, label, children, column, assistiveText, errorMessage, error, required, className, ...rest }: CheckboxGroupProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './Checkbox';
2
+ export * from './CheckboxGroup';
@@ -0,0 +1,66 @@
1
+ import React, { ReactNode } from 'react';
2
+ declare type Size = 's' | 'm';
3
+ export declare type CounterProps = {
4
+ /**
5
+ * Minimum value
6
+ */
7
+ minValue: number;
8
+ /**
9
+ * Maximum value
10
+ */
11
+ maxValue: number;
12
+ /**
13
+ * Disables the minus button
14
+ */
15
+ disableMin?: boolean;
16
+ /**
17
+ * Disables the plus button
18
+ */
19
+ disableMax?: boolean;
20
+ /**
21
+ * Class name
22
+ */
23
+ className?: string;
24
+ /**
25
+ * Disables input of counter
26
+ */
27
+ disableInput?: boolean;
28
+ /**
29
+ * Name of the input element
30
+ */
31
+ name?: string;
32
+ /**
33
+ * Initial value of the counter, if not specified it's set to `minValue`
34
+ */
35
+ value?: number;
36
+ /**
37
+ * Sets default value
38
+ */
39
+ defaultValue?: number;
40
+ /**
41
+ * Set aria label on plus/increase
42
+ */
43
+ increaseAriaLabel?: string;
44
+ /**
45
+ * Set aria label on minus/decrease
46
+ */
47
+ decreaseAriaLabel?: string;
48
+ /**
49
+ * Disable tool tips
50
+ */
51
+ disableToolTips?: boolean;
52
+ /**
53
+ * Callback when value changes
54
+ */
55
+ onChange?: (arg: number, event: React.MouseEvent<HTMLButtonElement, MouseEvent> | React.ChangeEvent<HTMLInputElement>) => void;
56
+ /**
57
+ * Label to display instead of the input element, see example below
58
+ */
59
+ text?: ReactNode;
60
+ /**
61
+ * Size of counter
62
+ */
63
+ size?: Size;
64
+ };
65
+ export declare const Counter: React.ForwardRefExoticComponent<CounterProps & React.RefAttributes<HTMLInputElement>>;
66
+ export {};
@@ -0,0 +1 @@
1
+ export { Counter } from './Counter';
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ declare type ReactInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
3
+ export declare type EnhancedInputProps<TValue> = Omit<EnhancedFieldProps, 'value'> & {
4
+ value?: TValue;
5
+ };
6
+ export declare type EnhancedFieldProps = Omit<ReactInputProps, 'size' | 'css'> & {
7
+ name?: string;
8
+ /**
9
+ * Label to be displayed
10
+ */
11
+ label?: React.ReactNode;
12
+ /**
13
+ * Icon to be displayed
14
+ */
15
+ icon?: React.ElementType;
16
+ className?: string;
17
+ onClick?: (e: React.MouseEvent<HTMLInputElement, MouseEvent>) => void;
18
+ };
19
+ export declare const EnhancedField: React.ForwardRefExoticComponent<Pick<EnhancedFieldProps, "max" | "required" | "type" | "key" | "id" | "height" | "width" | "name" | "color" | "translate" | "value" | "hidden" | "form" | "label" | "slot" | "style" | "title" | "dir" | "pattern" | "accessKey" | "draggable" | "lang" | "className" | "prefix" | "children" | "contentEditable" | "enterKeyHint" | "inputMode" | "tabIndex" | "disabled" | "multiple" | "icon" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "list" | "maxLength" | "min" | "minLength" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "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" | "readOnly" | "src" | "step" | "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"> & React.RefAttributes<HTMLInputElement>>;
20
+ export default EnhancedField;
@@ -0,0 +1 @@
1
+ export * from './EnhancedField';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare type ErrorTextProps = {
3
+ id?: string;
4
+ children: React.ReactNode;
5
+ className?: string;
6
+ };
7
+ export declare const ErrorText: ({ id, className, children }: ErrorTextProps) => JSX.Element;
8
+ export default ErrorText;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { BaseFieldProps, Size } from '../types';
3
+ export declare type FieldWrapProps = BaseFieldProps & {
4
+ size: Size;
5
+ children?: ReactNode;
6
+ extraAssistiveText?: string;
7
+ className?: string;
8
+ };
9
+ export declare const FieldWrap: ({ name, assistiveText, errorMessage, size, required, hideAsterisk, label, help, extraAssistiveText, className, children, }: FieldWrapProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './FieldWrap';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare type HelpIconProps = {
3
+ content: string;
4
+ className?: string;
5
+ };
6
+ export declare const HelpIcon: ({ content, className }: HelpIconProps) => JSX.Element;
7
+ export default HelpIcon;
package/cjs/index.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ export * from './checkbox';
2
+ export * from './enhanced';
3
+ export * from './error-text/ErrorText';
4
+ export * from './field-wrap';
5
+ export * from './label/Label';
6
+ export * from './password-field/PasswordField';
7
+ export * from './radio';
8
+ export * from './rating';
9
+ export * from './select-field/NativeSelectField';
10
+ export * from './select-field/SelectField';
11
+ export * from './switch/index';
12
+ export * from './tel-field/TelField';
13
+ export * from './text-field/TextField';
14
+ export * from './textarea-field/TextareaField';
15
+ export * from './counter/Counter';
@@ -0,0 +1,10 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { Size } from '../types';
3
+ export declare type LabelProps = {
4
+ children: ReactNode;
5
+ className?: string;
6
+ hideAsterisk?: boolean;
7
+ required?: boolean;
8
+ visualSize?: Size;
9
+ } & React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
10
+ export declare const Label: ({ visualSize, required, hideAsterisk, className, children, ...rest }: LabelProps) => JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TextFieldProps } from '../text-field/TextField';
3
+ export declare type PasswordFieldProps = Omit<TextFieldProps, 'icon' | 'inputType'>;
4
+ export declare const PasswordField: React.ForwardRefExoticComponent<PasswordFieldProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,51 @@
1
+ import React, { ReactNode } from 'react';
2
+ declare type RadioSize = 'medium' | 'small';
3
+ export declare type RadioStyleState = 'checked';
4
+ export declare type RadioProps = {
5
+ /**
6
+ * Field name.
7
+ */
8
+ name: string;
9
+ /**
10
+ * Indicate that the radio button is checked
11
+ */
12
+ checked?: boolean;
13
+ /**
14
+ *
15
+ */
16
+ defaultChecked?: boolean;
17
+ /**
18
+ * Field label.
19
+ */
20
+ label?: ReactNode;
21
+ /**
22
+ * Class name to be assigned to the component
23
+ */
24
+ className?: string;
25
+ /**
26
+ * Field label.
27
+ */
28
+ value?: string;
29
+ /**
30
+ * Indicates that the radio button is disabled.
31
+ */
32
+ disabled?: boolean;
33
+ /**
34
+ * Indicates an error in the field.
35
+ */
36
+ error?: boolean;
37
+ /**
38
+ * Size variant.
39
+ */
40
+ visualSize?: RadioSize;
41
+ /**
42
+ * Callback when the radio button is checked or unchecked
43
+ */
44
+ onChange?: JSX.IntrinsicElements['input']['onChange'];
45
+ Icon?: React.ComponentType;
46
+ styledAs?: RadioStyleState;
47
+ };
48
+ export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
49
+ /** @deprecated Use Radio */
50
+ export declare const RadioField: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
51
+ export {};
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { RadioProps } from './Radio';
3
+ declare type RadioContextProps = {
4
+ children?: React.ReactNode;
5
+ visualSize: NonNullable<RadioProps['visualSize']>;
6
+ error: RadioProps['error'];
7
+ };
8
+ export declare const RadioContext: React.Context<RadioContextProps | undefined>;
9
+ export declare const RadioContextProvider: React.FC<{
10
+ value: RadioContextProps;
11
+ }>;
12
+ declare const useRadioContext: () => RadioContextProps | undefined;
13
+ export default useRadioContext;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { BaseFieldProps } from '../types';
3
+ import { RadioProps } from './Radio';
4
+ export declare type RadioGroupProps = Pick<BaseFieldProps, 'help' | 'label' | 'required' | 'hideAsterisk' | 'disabled' | 'errorMessage'> & Pick<RadioProps, 'visualSize'> & {
5
+ children: ReactNode;
6
+ /**
7
+ * Class name to be assigned to the component
8
+ */
9
+ className?: string;
10
+ column?: boolean;
11
+ };
12
+ export declare const RadioGroup: ({ visualSize, label, children, column, errorMessage, help, required, hideAsterisk, className, }: RadioGroupProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './Radio';
2
+ export * from './RadioGroup';
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ import { FieldWrapProps } from '../field-wrap/FieldWrap';
3
+ import { Size } from '../types';
4
+ export declare type RatingProps = {
5
+ /**
6
+ * Amount of related checkboxes
7
+ */
8
+ rangeCardinality: number;
9
+ /**
10
+ * Name for the checkbox group
11
+ */
12
+ name: string;
13
+ /**
14
+ * Hint text on the left
15
+ */
16
+ leadingHint?: string;
17
+ /**
18
+ * Hint text on the right
19
+ */
20
+ trailingHint?: string;
21
+ /**
22
+ * Labels on top of the radio selectors, a string returning function called with the selector's index
23
+ */
24
+ scaleLabels?: (index: number) => string;
25
+ /**
26
+ * If used as a controlled component, this value sets the selected radio
27
+ */
28
+ value?: number;
29
+ /**
30
+ * Initial selected value
31
+ */
32
+ defaultValue?: number;
33
+ /**
34
+ * Callback when the user changes the selected value
35
+ */
36
+ onChange?: (index: number, event: React.ChangeEvent<HTMLInputElement>) => void;
37
+ disabled?: boolean;
38
+ showScaleLabels?: boolean;
39
+ /**
40
+ * When this property is `true`, it styles the radios to the left of the selected as `checked`
41
+ */
42
+ cumulative?: boolean;
43
+ Icon?: (index: number) => React.ComponentType;
44
+ };
45
+ export declare const Rating: React.ForwardRefExoticComponent<RatingProps & React.RefAttributes<HTMLInputElement>>;
46
+ export declare type RatingFieldProps = RatingProps & Omit<FieldWrapProps, 'size' | 'placeholder' | 'helpPlacement' | 'children'> & {
47
+ size: Exclude<Size, 'large'>;
48
+ };
49
+ /**
50
+ * The `RatingField` component will allow the user to provide feedback by ranking things on a specified scale.
51
+ */
52
+ export declare const RatingField: React.ForwardRefExoticComponent<RatingProps & Omit<FieldWrapProps, "children" | "size" | "placeholder" | "helpPlacement"> & {
53
+ size: Exclude<Size, 'large'>;
54
+ } & React.RefAttributes<HTMLInputElement>>;
55
+ export default RatingField;
@@ -0,0 +1 @@
1
+ export * from './Rating';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { BaseFieldProps, Size } from '../types';
3
+ export declare type NativeSelectFieldProps = BaseFieldProps & React.ComponentPropsWithRef<'select'> & {
4
+ className?: string;
5
+ visualSize?: Size;
6
+ };
7
+ export declare const NativeSelectField: React.ForwardRefExoticComponent<Pick<NativeSelectFieldProps, "required" | "key" | "id" | "name" | "color" | "translate" | "value" | "hidden" | "form" | "label" | "slot" | "style" | "title" | "dir" | "accessKey" | "draggable" | "lang" | "className" | "prefix" | "children" | "contentEditable" | "inputMode" | "tabIndex" | "disabled" | "multiple" | "size" | "help" | "autoComplete" | "autoFocus" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "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" | "css" | "hideAsterisk" | "assistiveText" | "errorMessage" | "visualSize" | "helpPlacement"> & React.RefAttributes<HTMLSelectElement>>;
8
+ export default NativeSelectField;
@@ -0,0 +1,93 @@
1
+ import React from 'react';
2
+ import Select, { createFilter, GroupBase, OptionsOrGroups, SingleValue } from 'react-select';
3
+ import { BaseFieldProps } from '../types';
4
+ export declare type BaseReactSelectProps = Omit<React.PropsWithRef<Select>, 'size' | 'css'>;
5
+ export declare type Size = 'small' | 'medium' | 'large';
6
+ export declare const ReactSelectWrapper: import("@emotion/styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ as?: React.ElementType<any> | undefined;
9
+ } & {
10
+ error?: boolean | undefined;
11
+ size?: string | undefined;
12
+ arrow?: boolean | undefined;
13
+ selected?: boolean | undefined;
14
+ }, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
15
+ export declare const Menu: (props: any) => JSX.Element;
16
+ export declare type SelectFieldProps<T = string> = BaseFieldProps & {
17
+ autoFocus?: boolean;
18
+ defaultValue?: SingleValue<T>;
19
+ className?: string;
20
+ components?: any;
21
+ value?: SingleValue<T>;
22
+ visualSize?: Size;
23
+ options?: OptionsOrGroups<T, GroupBase<T>>;
24
+ isSearchable?: boolean;
25
+ onSelect?: (value: SingleValue<T>) => void;
26
+ onChange?: (value: SingleValue<T>) => void;
27
+ onBlur?: (value: any) => void;
28
+ menuIsOpen?: boolean;
29
+ menuPlacement?: 'bottom' | 'auto' | 'top';
30
+ placeholder?: string;
31
+ prefix?: React.ReactNode;
32
+ suffix?: React.ReactNode;
33
+ assistiveText?: string;
34
+ errorMessage?: string;
35
+ /**
36
+ * Indicates that the Select can be cleared after selecting an Option.
37
+ *
38
+ * Setting this to true will display a small dismiss cross when a value is selected
39
+ */
40
+ isClearable?: boolean;
41
+ /**
42
+ * Configuration object passed to react-select createFilter function to create [custom filter
43
+ * logic](https://react-select.com/advanced#custom-filter-logic)
44
+ * @param ignoreCase - boolean (optional)
45
+ * @param ignoreAccents - boolean (optional)
46
+ * @param stringify (obj: any) => string (optional)
47
+ * @param trim - boolean (optional)
48
+ * @param matchForm - 'any' | 'start'
49
+ */
50
+ filterConfig?: Parameters<typeof createFilter>[0];
51
+ styles?: any;
52
+ };
53
+ declare function SelectFieldInner<T>({ components, name, label, defaultValue, value, placeholder, onSelect, onChange, isSearchable, onBlur, assistiveText, options, errorMessage, isClearable, disabled, visualSize, required, hideAsterisk, filterConfig, styles, help, helpPlacement, ...rest }: SelectFieldProps<T>, ref: React.ForwardedRef<any>): JSX.Element;
54
+ export declare const SelectField: <T>(props: BaseFieldProps & {
55
+ autoFocus?: boolean | undefined;
56
+ defaultValue?: SingleValue<T> | undefined;
57
+ className?: string | undefined;
58
+ components?: any;
59
+ value?: SingleValue<T> | undefined;
60
+ visualSize?: Size | undefined;
61
+ options?: OptionsOrGroups<T, GroupBase<T>> | undefined;
62
+ isSearchable?: boolean | undefined;
63
+ onSelect?: ((value: SingleValue<T>) => void) | undefined;
64
+ onChange?: ((value: SingleValue<T>) => void) | undefined;
65
+ onBlur?: ((value: any) => void) | undefined;
66
+ menuIsOpen?: boolean | undefined;
67
+ menuPlacement?: "auto" | "top" | "bottom" | undefined;
68
+ placeholder?: string | undefined;
69
+ prefix?: React.ReactNode;
70
+ suffix?: React.ReactNode;
71
+ assistiveText?: string | undefined;
72
+ errorMessage?: string | undefined;
73
+ /**
74
+ * Indicates that the Select can be cleared after selecting an Option.
75
+ *
76
+ * Setting this to true will display a small dismiss cross when a value is selected
77
+ */
78
+ isClearable?: boolean | undefined;
79
+ /**
80
+ * Configuration object passed to react-select createFilter function to create [custom filter
81
+ * logic](https://react-select.com/advanced#custom-filter-logic)
82
+ * @param ignoreCase - boolean (optional)
83
+ * @param ignoreAccents - boolean (optional)
84
+ * @param stringify (obj: any) => string (optional)
85
+ * @param trim - boolean (optional)
86
+ * @param matchForm - 'any' | 'start'
87
+ */
88
+ filterConfig?: Parameters<typeof createFilter>[0];
89
+ styles?: any;
90
+ } & {
91
+ ref?: React.ForwardedRef<any> | undefined;
92
+ }) => ReturnType<typeof SelectFieldInner>;
93
+ export default SelectField;
@@ -0,0 +1,32 @@
1
+ import React, { ChangeEvent } from 'react';
2
+ declare type Size = 'small' | 'medium';
3
+ export declare type SwitchProps = React.PropsWithRef<JSX.IntrinsicElements['label']> & {
4
+ /**
5
+ * Name of the input element
6
+ */
7
+ name?: string;
8
+ /**
9
+ * State of the switch
10
+ *
11
+ */
12
+ checked?: boolean;
13
+ /**
14
+ * Controls whether the input is disabled
15
+ */
16
+ disabled?: boolean;
17
+ /**
18
+ * Callback to fire when the state of the input changes
19
+ */
20
+ onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
21
+ /**
22
+ * Controls whether the input label should be displayed on the right of the input, displayed on the left by default
23
+ */
24
+ right?: boolean;
25
+ /**
26
+ * Visual size of the switch
27
+ */
28
+ size?: Size;
29
+ error?: boolean;
30
+ };
31
+ export declare const Switch: React.ForwardRefExoticComponent<Pick<SwitchProps, "error" | "key" | "name" | "right" | "disabled" | "size" | "checked" | "css" | keyof React.LabelHTMLAttributes<HTMLLabelElement>> & React.RefAttributes<HTMLInputElement>>;
32
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { SwitchProps } from './Switch';
3
+ declare type SwitchContextProps = Required<Pick<SwitchProps, 'size' | 'error'>> & {
4
+ children?: React.ReactNode;
5
+ };
6
+ export declare const SwitchContext: React.Context<SwitchContextProps | undefined>;
7
+ export declare const SwitchContextProvider: React.FC<{
8
+ value: SwitchContextProps;
9
+ }>;
10
+ declare const useSwitchContext: () => SwitchContextProps | undefined;
11
+ export default useSwitchContext;
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { BaseFieldProps } from '../types';
3
+ import { SwitchProps } from './Switch';
4
+ export declare type SwitchGroupProps = Pick<BaseFieldProps, 'label' | 'errorMessage' | 'hideAsterisk' | 'required'> & {
5
+ /**
6
+ * JSX enclosed by the group.
7
+ */
8
+ children: ReactNode;
9
+ } & Pick<SwitchProps, 'size'>;
10
+ export declare const SwitchGroup: ({ size, label, errorMessage, required, hideAsterisk, children, }: SwitchGroupProps) => JSX.Element;
@@ -18,12 +18,11 @@ var _ref = process.env.NODE_ENV === "production" ? {
18
18
  } : {
19
19
  name: "7bcvef-SwitchGroupContainer",
20
20
  styles: "display:flex;flex-direction:column;border:none;padding:0;margin:0;label:SwitchGroupContainer;",
21
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zd2l0Y2gvU3dpdGNoR3JvdXAudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWtCWSIsImZpbGUiOiIuLi8uLi8uLi9zcmMvc3dpdGNoL1N3aXRjaEdyb3VwLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCdcbmltcG9ydCB7IEJhc2VGaWVsZFByb3BzIH0gZnJvbSAnLi4vdHlwZXMnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcbmltcG9ydCB7IFN3aXRjaFByb3BzIH0gZnJvbSAnLi9Td2l0Y2gnXG5pbXBvcnQgeyBMYWJlbCB9IGZyb20gJy4uL2xhYmVsL0xhYmVsJ1xuaW1wb3J0IHsgU3dpdGNoQ29udGV4dFByb3ZpZGVyIH0gZnJvbSAnLi9Td2l0Y2hDb250ZXh0J1xuaW1wb3J0IHsgRmxleEJveCB9IGZyb20gJ0BkZmRzLXVpL3JlYWN0LWNvbXBvbmVudHMvZmxleGJveCdcbmltcG9ydCBFcnJvclRleHQgZnJvbSAnLi4vZXJyb3ItdGV4dC9FcnJvclRleHQnXG5cbmV4cG9ydCB0eXBlIFN3aXRjaEdyb3VwUHJvcHMgPSBQaWNrPEJhc2VGaWVsZFByb3BzLCAnbGFiZWwnIHwgJ2Vycm9yTWVzc2FnZScgfCAnaGlkZUFzdGVyaXNrJyB8ICdyZXF1aXJlZCc+ICYge1xuICAvKipcbiAgICogSlNYIGVuY2xvc2VkIGJ5IHRoZSBncm91cC5cbiAgICovXG4gIGNoaWxkcmVuOiBSZWFjdE5vZGVcbn0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vck1lc3NhZ2V9PC9FcnJvclRleHQ+fVxuICAgIDwvU3dpdGNoR3JvdXBDb250YWluZXI+XG4gIClcbn1cbiJdfQ== */",
22
22
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
23
  };
24
24
  const SwitchGroupContainer = ({
25
- children,
26
- errorMessage
25
+ children
27
26
  }) => (0, _react2.jsx)("fieldset", {
28
27
  css: _ref
29
28
  }, children);
@@ -0,0 +1,2 @@
1
+ export * from './Switch';
2
+ export * from './SwitchGroup';
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { Locale } from '@dfds-ui/react-components';
3
+ import { BaseFieldProps } from '../types';
4
+ export declare type TelFieldProps = BaseFieldProps & {
5
+ /**
6
+ * Class name to be added to the TelField.
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Default value for the phone number
11
+ */
12
+ defaultValue?: string;
13
+ /**
14
+ * Default locale. Will set the matching country in the dropdown
15
+ */
16
+ defaultLocale?: Locale;
17
+ /**
18
+ * Show trunk values (the local area code shown in parenthesis)
19
+ */
20
+ showTrunkValues?: boolean;
21
+ /**
22
+ * Makes value splitted so easier to convert to object
23
+ */
24
+ splitValues?: boolean;
25
+ /**
26
+ * Callback when value changes
27
+ */
28
+ onChange?: (newValue: string) => void;
29
+ /**
30
+ * Callback when blur
31
+ */
32
+ onBlur?: () => void;
33
+ };
34
+ export declare type TelFieldElement = {
35
+ focus?: () => void;
36
+ };
37
+ export declare const TelField: React.ForwardRefExoticComponent<BaseFieldProps & {
38
+ /**
39
+ * Class name to be added to the TelField.
40
+ */
41
+ className?: string | undefined;
42
+ /**
43
+ * Default value for the phone number
44
+ */
45
+ defaultValue?: string | undefined;
46
+ /**
47
+ * Default locale. Will set the matching country in the dropdown
48
+ */
49
+ defaultLocale?: "en" | "nl-BE" | "bg-BG" | "pt-BR" | "en-CA" | "zh-CN" | "cs-CZ" | "da-DK" | "et-EE" | "fi-FI" | "fr-BE" | "fr-FR" | "de-DE" | "hu-HU" | "it-IT" | "ja-JP" | "lv-LV" | "lt-LT" | "nl-NL" | "nb-NO" | "pl-PL" | "ro-RO" | "ru-RU" | "sk-SK" | "ko-KR" | "es-ES" | "sv-SE" | "tr-TR" | "en-GB" | "en-US" | undefined;
50
+ /**
51
+ * Show trunk values (the local area code shown in parenthesis)
52
+ */
53
+ showTrunkValues?: boolean | undefined;
54
+ /**
55
+ * Makes value splitted so easier to convert to object
56
+ */
57
+ splitValues?: boolean | undefined;
58
+ /**
59
+ * Callback when value changes
60
+ */
61
+ onChange?: ((newValue: string) => void) | undefined;
62
+ /**
63
+ * Callback when blur
64
+ */
65
+ onBlur?: (() => void) | undefined;
66
+ } & React.RefAttributes<TelFieldElement>>;
67
+ export default TelField;
@@ -0,0 +1,55 @@
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
+ step?: number | 'any';
28
+ };
29
+ export declare const TextField: React.ForwardRefExoticComponent<BaseFieldProps & {
30
+ autoFocus?: boolean | undefined;
31
+ defaultValue?: string | undefined;
32
+ prefix?: React.ReactNode;
33
+ suffix?: React.ReactNode;
34
+ icon?: React.ElementType<any> | undefined;
35
+ /**
36
+ * Element to be placed after the input element.
37
+ *
38
+ * Useful for adding a button next to the TextField.
39
+ */
40
+ adornment?: React.ReactNode;
41
+ className?: string | undefined;
42
+ value?: string | undefined;
43
+ visualSize?: Size | undefined;
44
+ onChange?: ((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
45
+ onFocus?: ((event: React.FocusEvent<HTMLInputElement>) => void) | undefined;
46
+ onBlur?: ((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
47
+ inputType?: "number" | "search" | "file" | "password" | "url" | "time" | "text" | "tel" | "email" | "date" | undefined;
48
+ autoComplete?: string | undefined;
49
+ minValue?: string | undefined;
50
+ maxValue?: string | undefined;
51
+ maxLength?: number | undefined;
52
+ minLength?: number | undefined;
53
+ step?: number | "any" | undefined;
54
+ } & React.RefAttributes<HTMLInputElement>>;
55
+ 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
+ * Field name.
8
+ */
9
+ name: string;
10
+ /**
11
+ * Field label.
12
+ */
13
+ label?: ReactNode;
14
+ /**
15
+ * Indicates if the field is required. Will add an asterisk to the label unless `hideAsterisk` is set to `true`.
16
+ */
17
+ required?: boolean;
18
+ /**
19
+ * If set to `true` the asterisk will never be shown.
20
+ */
21
+ hideAsterisk?: boolean;
22
+ /**
23
+ * Hint for the field. For Input elements this maps to the `placeholder` attribute.
24
+ */
25
+ placeholder?: string;
26
+ /**
27
+ * Indicates that the field is disabled.
28
+ */
29
+ disabled?: boolean;
30
+ /**
31
+ * Sets an error message (if assistive text applies it will be replaced by this).
32
+ */
33
+ errorMessage?: string;
34
+ /**
35
+ * Assistive text describing the field.
36
+ *
37
+ * NB! If space is needed for alignment you can use a space char (' ') here.
38
+ */
39
+ assistiveText?: string;
40
+ /**
41
+ * Additional help.
42
+ *
43
+ * **This is an experimental prop and the behavior might change.**
44
+ */
45
+ help?: string;
46
+ /**
47
+ * Controls the placement of the help icon.
48
+ *
49
+ * **This is an experimental prop and the behavior might change.**
50
+ */
51
+ helpPlacement?: 'top' | 'right';
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.13-alpha.387f7b2c",
6
+ "version": "2.0.13-alpha.a1d8e406",
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.13-alpha.387f7b2c",
21
- "@dfds-ui/icons": "2.0.13-alpha.387f7b2c",
22
- "@dfds-ui/react-components": "2.0.13-alpha.387f7b2c",
23
- "@dfds-ui/theme": "2.0.13-alpha.387f7b2c",
24
- "@dfds-ui/typography": "2.0.13-alpha.387f7b2c"
20
+ "@dfds-ui/hooks": "2.0.13-alpha.a1d8e406",
21
+ "@dfds-ui/icons": "2.0.13-alpha.a1d8e406",
22
+ "@dfds-ui/react-components": "2.0.13-alpha.a1d8e406",
23
+ "@dfds-ui/theme": "2.0.13-alpha.a1d8e406",
24
+ "@dfds-ui/typography": "2.0.13-alpha.a1d8e406"
25
25
  },
26
- "gitHead": "387f7b2ce9dcdb55d365191b83a14a0c2e63c005",
26
+ "gitHead": "a1d8e40616f0367183a714bee0b2a5b5e96c7d4a",
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  }
@@ -12,12 +12,11 @@ var _ref = process.env.NODE_ENV === "production" ? {
12
12
  } : {
13
13
  name: "7bcvef-SwitchGroupContainer",
14
14
  styles: "display:flex;flex-direction:column;border:none;padding:0;margin:0;label:SwitchGroupContainer;",
15
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zd2l0Y2gvU3dpdGNoR3JvdXAudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWtCWSIsImZpbGUiOiIuLi8uLi9zcmMvc3dpdGNoL1N3aXRjaEdyb3VwLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCdcbmltcG9ydCB7IEJhc2VGaWVsZFByb3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Y29uc3QgU3dpdGNoR3JvdXAgPSAoe1xuICBzaXplID0gJ21lZGl1bScsXG4gIGxhYmVsLFxuICBlcnJvck1lc3NhZ2UsXG4gIHJlcXVpcmVkLFxuICBoaWRlQXN0ZXJpc2ssXG4gIGNoaWxkcmVuLFxufTogU3dpdGNoR3JvdXBQcm9wcykgPT4ge1xuICByZXR1cm4gKFxuICAgIDxTd2l0Y2hHcm91cENvbnRhaW5lcj5cbiAgICAgIDxTd2l0Y2hDb250ZXh0UHJvdmlkZXIgdmFsdWU9e3sgc2l6ZSwgZXJyb3I6ICEhZXJyb3JNZXNzYWdlIH19PlxuICAgICAgICA8TGFiZWwgcmVxdWlyZWQ9e3JlcXVpcmVkfSBoaWRlQXN0ZXJpc2s9e2hpZGVBc3Rlcmlza30gdmlzdWFsU2l6ZT17c2l6ZX0+XG4gICAgICAgICAge2xhYmVsfVxuICAgICAgICA8L0xhYmVsPlxuICAgICAgICA8RmxleEJveCBkaXJlY3Rpb25Db2x1bW4+e2NoaWxkcmVufTwvRmxleEJveD5cbiAgICAgIDwvU3dpdGNoQ29udGV4dFByb3ZpZGVyPlxuICAgICAge2Vycm9yTWVzc2FnZSAmJiA8RXJyb3JUZXh0PntlcnJvck1lc3NhZ2V9PC9FcnJvclRleHQ+fVxuICAgIDwvU3dpdGNoR3JvdXBDb250YWluZXI+XG4gIClcbn1cbiJdfQ== */",
16
16
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
17
17
  };
18
18
  var SwitchGroupContainer = function SwitchGroupContainer(_ref2) {
19
- var children = _ref2.children,
20
- errorMessage = _ref2.errorMessage;
19
+ var children = _ref2.children;
21
20
  return ___EmotionJSX("fieldset", {
22
21
  css: _ref
23
22
  }, children);