@entur/form 7.0.43 → 7.1.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.
@@ -1,6 +1,10 @@
1
1
  import React from 'react';
2
2
  import './BaseFormControl.scss';
3
- import { VariantType } from './VariantProvider';
3
+ import { VariantType } from '@entur/utils';
4
+ /** @deprecated use variant="information" instead */
5
+ declare const info = "info";
6
+ /** @deprecated use variant="negative" instead */
7
+ declare const error = "error";
4
8
  export type BaseFormControlProps = {
5
9
  /** Et skjemaelement med `eds-form-control`-klassen */
6
10
  children: React.ReactNode;
@@ -15,7 +19,7 @@ export type BaseFormControlProps = {
15
19
  /** Tekst eller ikon som vises etter skjema-elementet */
16
20
  append?: React.ReactNode;
17
21
  /** Valideringsvariant */
18
- variant?: VariantType;
22
+ variant?: VariantType | typeof error | typeof info;
19
23
  /**Størrelsen på skjemaelementet
20
24
  * @default "medium"
21
25
  */
@@ -45,3 +49,4 @@ export type BaseFormControlProps = {
45
49
  ariaAlertOnFeedback?: boolean;
46
50
  };
47
51
  export declare const BaseFormControl: React.ForwardRefExoticComponent<BaseFormControlProps & React.RefAttributes<HTMLDivElement>>;
52
+ export {};
@@ -1,15 +1,20 @@
1
1
  import React from 'react';
2
- import { VariantType } from './VariantProvider';
2
+ import { VariantType } from '@entur/utils';
3
3
  import './FeedbackText.scss';
4
+ /** @deprecated use variant="information" instead */
5
+ declare const info = "info";
6
+ /** @deprecated use variant="negative" instead */
7
+ declare const error = "error";
4
8
  export type FeedbackTextProps = {
5
9
  /** Teksten som vises */
6
10
  children: React.ReactNode;
7
11
  /** Skjuler ikonet */
8
12
  hideIcon?: boolean;
9
- /** Feedbackvarianten */
10
- variant: VariantType;
13
+ /** Feedbackvarianten*/
14
+ variant: VariantType | typeof error | typeof info;
11
15
  /** Ekstra klassenavn */
12
16
  className?: string;
13
17
  [key: string]: any;
14
18
  };
15
19
  export declare const FeedbackText: React.FC<FeedbackTextProps>;
20
+ export {};
@@ -1,11 +1,15 @@
1
1
  import React from 'react';
2
- import { VariantType } from './VariantProvider';
3
2
  import './TextArea.scss';
3
+ import { VariantType } from '@entur/utils';
4
+ /** @deprecated use variant="information" instead */
5
+ declare const info = "info";
6
+ /** @deprecated use variant="negative" instead */
7
+ declare const error = "error";
4
8
  export type TextAreaProps = {
5
9
  /** Ekstra klassenavn */
6
10
  className?: string;
7
11
  /** Valideringsvariant */
8
- variant?: VariantType;
12
+ variant?: VariantType | typeof error | typeof info;
9
13
  /** Deaktiverer tekstområdet */
10
14
  disabled?: boolean;
11
15
  /** Setter tekstområdet i read-only modus */
@@ -25,7 +29,7 @@ export declare const TextArea: React.ForwardRefExoticComponent<{
25
29
  /** Ekstra klassenavn */
26
30
  className?: string | undefined;
27
31
  /** Valideringsvariant */
28
- variant?: VariantType | undefined;
32
+ variant?: "info" | "error" | VariantType | undefined;
29
33
  /** Deaktiverer tekstområdet */
30
34
  disabled?: boolean | undefined;
31
35
  /** Setter tekstområdet i read-only modus */
@@ -41,3 +45,4 @@ export declare const TextArea: React.ForwardRefExoticComponent<{
41
45
  */
42
46
  disableLabelAnimation?: boolean | undefined;
43
47
  } & React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.RefAttributes<HTMLTextAreaElement>>;
48
+ export {};
@@ -1,6 +1,10 @@
1
1
  import React from 'react';
2
- import { VariantType } from './VariantProvider';
2
+ import { VariantType } from '@entur/utils';
3
3
  import './TextField.scss';
4
+ /** @deprecated use variant="information" instead */
5
+ declare const info = "info";
6
+ /** @deprecated use variant="negative" instead */
7
+ declare const error = "error";
4
8
  export type TextFieldProps = {
5
9
  /** Tekst eller ikon som kommer før inputfeltet */
6
10
  prepend?: React.ReactNode;
@@ -14,8 +18,8 @@ export type TextFieldProps = {
14
18
  labelTooltip?: React.ReactNode;
15
19
  /** Varselmelding, som vil komme under TextField */
16
20
  feedback?: string;
17
- /** Hvilken valideringsfarge som vises */
18
- variant?: VariantType;
21
+ /** Hvilken valideringsfarge som vises*/
22
+ variant?: VariantType | typeof error | typeof info;
19
23
  /** Deaktiver inputfeltet */
20
24
  disabled?: boolean;
21
25
  /** Setter inputfeltet i read-only modus */
@@ -51,8 +55,8 @@ export declare const TextField: React.ForwardRefExoticComponent<{
51
55
  labelTooltip?: React.ReactNode;
52
56
  /** Varselmelding, som vil komme under TextField */
53
57
  feedback?: string | undefined;
54
- /** Hvilken valideringsfarge som vises */
55
- variant?: VariantType | undefined;
58
+ /** Hvilken valideringsfarge som vises*/
59
+ variant?: "info" | "error" | VariantType | undefined;
56
60
  /** Deaktiver inputfeltet */
57
61
  disabled?: boolean | undefined;
58
62
  /** Setter inputfeltet i read-only modus */
@@ -75,3 +79,4 @@ export declare const TextField: React.ForwardRefExoticComponent<{
75
79
  onClear?: (() => void) | undefined;
76
80
  ariaAlertOnFeedback?: boolean | undefined;
77
81
  } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "label"> & React.RefAttributes<HTMLInputElement>>;
82
+ export {};
@@ -1,7 +1,12 @@
1
1
  import React from 'react';
2
- export type VariantType = 'success' | 'error' | 'warning' | 'info';
2
+ import { VariantType } from '@entur/utils';
3
+ /** @deprecated use variant="information" instead */
4
+ declare const info = "info";
5
+ /** @deprecated use variant="negative" instead */
6
+ declare const error = "error";
3
7
  export type VariantProviderProps = {
4
- variant?: VariantType;
8
+ variant?: VariantType | typeof error | typeof info;
5
9
  };
6
10
  export declare const VariantProvider: React.FC<VariantProviderProps>;
7
- export declare const useVariant: () => VariantType | null;
11
+ export declare const useVariant: () => VariantType | typeof error | typeof info | null;
12
+ export {};
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var utils = require('@entur/utils');
6
- var tooltip = require('@entur/tooltip');
7
6
  var classNames = require('classnames');
8
7
  var React = require('react');
9
8
  var icons = require('@entur/icons');
10
9
  var typography = require('@entur/typography');
10
+ var tooltip = require('@entur/tooltip');
11
11
  var tokens = require('@entur/tokens');
12
12
 
13
13
  function _interopNamespaceDefault(e) {
@@ -57,27 +57,38 @@ function _objectWithoutPropertiesLoose(source, excluded) {
57
57
  }
58
58
 
59
59
  var _excluded$g = ["children", "hideIcon", "variant", "className"];
60
+ /** @deprecated use variant="information" instead */
61
+ var info = 'info';
62
+ /** @deprecated use variant="negative" instead */
63
+ var error$1 = 'error';
60
64
  var AlertIcon = function AlertIcon(_ref) {
61
65
  var variant = _ref.variant;
62
66
  var iconClass = "eds-feedback-text__icon eds-feedback-text__icon--" + variant;
63
67
  switch (variant) {
64
68
  case 'success':
65
- return React.createElement(icons.ValidationCheckIcon, {
69
+ return React.createElement(icons.ValidationSuccessFilledIcon, {
66
70
  "aria-label": "Suksessmelding",
67
71
  className: iconClass
68
72
  });
69
- case 'error':
70
- return React.createElement(icons.ValidationErrorIcon, {
73
+ case 'negative':
74
+ return React.createElement(icons.ValidationErrorFilledIcon, {
71
75
  "aria-label": "Feilmelding",
72
76
  className: iconClass
73
77
  });
74
- case 'info':
78
+ case 'information':
75
79
  return null;
76
80
  case 'warning':
77
- return React.createElement(icons.ValidationExclamationIcon, {
81
+ return React.createElement(icons.ValidationExclamationFilledIcon, {
78
82
  "aria-label": "Varselmelding",
79
83
  className: iconClass
80
84
  });
85
+ case error$1:
86
+ return React.createElement(icons.ValidationErrorFilledIcon, {
87
+ "aria-label": "Feilmelding",
88
+ className: iconClass
89
+ });
90
+ case info:
91
+ return null;
81
92
  default:
82
93
  return null;
83
94
  }
@@ -91,7 +102,7 @@ var FeedbackText = function FeedbackText(_ref2) {
91
102
  rest = _objectWithoutPropertiesLoose(_ref2, _excluded$g);
92
103
  return React.createElement(typography.SubLabel, _extends({
93
104
  className: classNames('eds-feedback-text', {
94
- 'eds-feedback-text--info': variant === 'info'
105
+ 'eds-feedback-text--information': variant === info || variant === 'information'
95
106
  }, className)
96
107
  }, rest), !hideIcon && React.createElement(AlertIcon, {
97
108
  variant: variant
@@ -160,6 +171,8 @@ var useVariant = function useVariant() {
160
171
  };
161
172
 
162
173
  var _excluded$e = ["children", "className", "disabled", "readOnly", "variant", "prepend", "append", "size", "isFilled", "label", "required", "labelTooltip", "feedback", "labelId", "labelProps", "style", "disableLabelAnimation", "ariaAlertOnFeedback"];
174
+ /** @deprecated use variant="negative" instead */
175
+ var error = 'error';
163
176
  var BaseFormControl = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
164
177
  var children = _ref.children,
165
178
  className = _ref.className,
@@ -190,7 +203,7 @@ var BaseFormControl = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
190
203
  return React.createElement(InputGroupContextProvider, null, React.createElement("div", _extends({
191
204
  className: classNames('eds-form-control-wrapper', className, "eds-form-control-wrapper--size-" + size, {
192
205
  'eds-form-control-wrapper--success': currentVariant === 'success',
193
- 'eds-form-control-wrapper--error': currentVariant === 'error',
206
+ 'eds-form-control-wrapper--negative': currentVariant === 'negative' || currentVariant === error,
194
207
  'eds-form-control-wrapper--disabled': disabled,
195
208
  'eds-form-control-wrapper--readonly': readOnly,
196
209
  'eds-form-control-wrapper--is-filled': isFilled