@dfds-ui/forms 2.2.0-alpha.853cab6b → 2.2.0-alpha.88cbd504

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 (109) hide show
  1. package/assistive-text/AssistiveText.d.ts +1 -1
  2. package/assistive-text/AssistiveText.js +5 -4
  3. package/asterisk/Asterisk.d.ts +1 -1
  4. package/asterisk/Asterisk.js +12 -4
  5. package/checkbox/Checkbox.d.ts +18 -17
  6. package/checkbox/Checkbox.js +47 -39
  7. package/checkbox/CheckboxContext.d.ts +3 -3
  8. package/checkbox/CheckboxContext.js +5 -4
  9. package/checkbox/CheckboxGroup.d.ts +1 -1
  10. package/checkbox/CheckboxGroup.js +43 -28
  11. package/cjs/assistive-text/AssistiveText.d.ts +1 -1
  12. package/cjs/assistive-text/AssistiveText.js +6 -5
  13. package/cjs/asterisk/Asterisk.d.ts +1 -1
  14. package/cjs/asterisk/Asterisk.js +7 -6
  15. package/cjs/checkbox/Checkbox.d.ts +18 -17
  16. package/cjs/checkbox/Checkbox.js +42 -39
  17. package/cjs/checkbox/CheckboxContext.d.ts +3 -3
  18. package/cjs/checkbox/CheckboxContext.js +7 -8
  19. package/cjs/checkbox/CheckboxGroup.d.ts +1 -1
  20. package/cjs/checkbox/CheckboxGroup.js +36 -26
  21. package/cjs/counter/Counter.d.ts +4 -3
  22. package/cjs/counter/Counter.js +66 -63
  23. package/cjs/enhanced/EnhancedField.d.ts +4 -4
  24. package/cjs/enhanced/EnhancedField.js +34 -31
  25. package/cjs/error-text/ErrorText.d.ts +1 -1
  26. package/cjs/error-text/ErrorText.js +6 -5
  27. package/cjs/field-wrap/FieldWrap.d.ts +1 -1
  28. package/cjs/field-wrap/FieldWrap.js +36 -28
  29. package/cjs/help-icon/HelpIcon.d.ts +1 -1
  30. package/cjs/help-icon/HelpIcon.js +9 -8
  31. package/cjs/label/Label.d.ts +1 -1
  32. package/cjs/label/Label.js +6 -4
  33. package/cjs/password-field/PasswordField.d.ts +2 -2
  34. package/cjs/password-field/PasswordField.js +8 -8
  35. package/cjs/radio/Radio.d.ts +7 -6
  36. package/cjs/radio/Radio.js +31 -30
  37. package/cjs/radio/RadioContext.d.ts +3 -3
  38. package/cjs/radio/RadioContext.js +7 -8
  39. package/cjs/radio/RadioGroup.d.ts +1 -1
  40. package/cjs/radio/RadioGroup.js +37 -27
  41. package/cjs/rating/Rating.d.ts +5 -6
  42. package/cjs/rating/Rating.js +89 -71
  43. package/cjs/select-field/AsyncSelectField.d.ts +5 -102
  44. package/cjs/select-field/AsyncSelectField.js +52 -51
  45. package/cjs/select-field/CreatableSelectField.d.ts +5 -135
  46. package/cjs/select-field/CreatableSelectField.js +105 -94
  47. package/cjs/select-field/NativeSelectField.d.ts +2 -2
  48. package/cjs/select-field/NativeSelectField.js +24 -23
  49. package/cjs/select-field/SelectField.d.ts +12 -50
  50. package/cjs/select-field/SelectField.js +116 -102
  51. package/cjs/switch/Switch.d.ts +4 -3
  52. package/cjs/switch/Switch.js +45 -38
  53. package/cjs/switch/SwitchContext.d.ts +3 -3
  54. package/cjs/switch/SwitchContext.js +7 -8
  55. package/cjs/switch/SwitchGroup.d.ts +1 -1
  56. package/cjs/switch/SwitchGroup.js +24 -15
  57. package/cjs/tel-field/TelField.d.ts +4 -32
  58. package/cjs/tel-field/TelField.js +101 -86
  59. package/cjs/text-field/TextField.d.ts +3 -28
  60. package/cjs/text-field/TextField.js +57 -53
  61. package/cjs/textarea-field/TextareaField.d.ts +5 -18
  62. package/cjs/textarea-field/TextareaField.js +28 -26
  63. package/cjs/types/field.d.ts +1 -1
  64. package/cjs/types/size.d.ts +1 -1
  65. package/counter/Counter.d.ts +4 -3
  66. package/counter/Counter.js +72 -66
  67. package/enhanced/EnhancedField.d.ts +4 -4
  68. package/enhanced/EnhancedField.js +40 -31
  69. package/error-text/ErrorText.d.ts +1 -1
  70. package/error-text/ErrorText.js +5 -4
  71. package/field-wrap/FieldWrap.d.ts +1 -1
  72. package/field-wrap/FieldWrap.js +42 -29
  73. package/help-icon/HelpIcon.d.ts +1 -1
  74. package/help-icon/HelpIcon.js +8 -7
  75. package/label/Label.d.ts +1 -1
  76. package/label/Label.js +13 -6
  77. package/package.json +10 -10
  78. package/password-field/PasswordField.d.ts +2 -2
  79. package/password-field/PasswordField.js +15 -11
  80. package/radio/Radio.d.ts +7 -6
  81. package/radio/Radio.js +36 -30
  82. package/radio/RadioContext.d.ts +3 -3
  83. package/radio/RadioContext.js +5 -4
  84. package/radio/RadioGroup.d.ts +1 -1
  85. package/radio/RadioGroup.js +37 -28
  86. package/rating/Rating.d.ts +5 -6
  87. package/rating/Rating.js +90 -72
  88. package/select-field/AsyncSelectField.d.ts +5 -102
  89. package/select-field/AsyncSelectField.js +61 -53
  90. package/select-field/CreatableSelectField.d.ts +5 -135
  91. package/select-field/CreatableSelectField.js +104 -94
  92. package/select-field/NativeSelectField.d.ts +2 -2
  93. package/select-field/NativeSelectField.js +29 -22
  94. package/select-field/SelectField.d.ts +12 -50
  95. package/select-field/SelectField.js +113 -100
  96. package/switch/Switch.d.ts +4 -3
  97. package/switch/Switch.js +57 -44
  98. package/switch/SwitchContext.d.ts +3 -3
  99. package/switch/SwitchContext.js +5 -4
  100. package/switch/SwitchGroup.d.ts +1 -1
  101. package/switch/SwitchGroup.js +24 -16
  102. package/tel-field/TelField.d.ts +4 -32
  103. package/tel-field/TelField.js +112 -92
  104. package/text-field/TextField.d.ts +3 -28
  105. package/text-field/TextField.js +64 -55
  106. package/textarea-field/TextareaField.d.ts +5 -18
  107. package/textarea-field/TextareaField.js +31 -26
  108. package/types/field.d.ts +1 -1
  109. package/types/size.d.ts +1 -1
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import { SwitchProps } from './Switch';
3
- declare type SwitchContextProps = Required<Pick<SwitchProps, 'size' | 'error'>> & {
3
+ type SwitchContextProps = Required<Pick<SwitchProps, 'size' | 'error'>> & {
4
4
  children?: React.ReactNode;
5
5
  };
6
6
  export declare const SwitchContext: React.Context<SwitchContextProps | undefined>;
7
- export declare const SwitchContextProvider: React.FC<{
7
+ export declare const SwitchContextProvider: ({ children, value, }: {
8
8
  value: SwitchContextProps;
9
9
  children?: React.ReactNode;
10
- }>;
10
+ }) => React.JSX.Element;
11
11
  declare const useSwitchContext: () => SwitchContextProps | undefined;
12
12
  export default useSwitchContext;
@@ -1,5 +1,5 @@
1
1
  import React, { createContext, useContext } from 'react';
2
- import { jsx as ___EmotionJSX } from "@emotion/react";
2
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
3
3
  export var SwitchContext = /*#__PURE__*/createContext(undefined);
4
4
  export var SwitchContextProvider = function SwitchContextProvider(_ref) {
5
5
  var children = _ref.children,
@@ -8,9 +8,10 @@ export var SwitchContextProvider = function SwitchContextProvider(_ref) {
8
8
  size: 'medium',
9
9
  error: false
10
10
  } : _ref$value;
11
- return ___EmotionJSX(SwitchContext.Provider, {
12
- value: value
13
- }, children);
11
+ return _jsx(SwitchContext.Provider, {
12
+ value: value,
13
+ children: children
14
+ });
14
15
  };
15
16
  var useSwitchContext = function useSwitchContext() {
16
17
  var context = useContext(SwitchContext);
@@ -1,7 +1,7 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { BaseFieldProps } from '../types';
3
3
  import { SwitchProps } from './Switch';
4
- export declare type SwitchGroupProps = Pick<BaseFieldProps, 'label' | 'errorMessage' | 'hideAsterisk' | 'required'> & {
4
+ export type SwitchGroupProps = Pick<BaseFieldProps, 'label' | 'errorMessage' | 'hideAsterisk' | 'required'> & {
5
5
  /**
6
6
  * JSX enclosed by the group.
7
7
  */
@@ -5,7 +5,7 @@ import { Label } from '../label/Label';
5
5
  import { SwitchContextProvider } from './SwitchContext';
6
6
  import { FlexBox } from '@dfds-ui/react-components/flexbox';
7
7
  import ErrorText from '../error-text/ErrorText';
8
- import { jsx as ___EmotionJSX } from "@emotion/react";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
9
9
  var _ref = process.env.NODE_ENV === "production" ? {
10
10
  name: "1qz4298",
11
11
  styles: "display:flex;flex-direction:column;border:none;padding:0;margin:0"
@@ -16,9 +16,10 @@ var _ref = process.env.NODE_ENV === "production" ? {
16
16
  };
17
17
  var SwitchGroupContainer = function SwitchGroupContainer(_ref2) {
18
18
  var children = _ref2.children;
19
- return ___EmotionJSX("fieldset", {
20
- css: _ref
21
- }, children);
19
+ return _jsx("fieldset", {
20
+ css: _ref,
21
+ children: children
22
+ });
22
23
  };
23
24
  export var SwitchGroup = function SwitchGroup(_ref3) {
24
25
  var _ref3$size = _ref3.size,
@@ -28,16 +29,23 @@ export var SwitchGroup = function SwitchGroup(_ref3) {
28
29
  required = _ref3.required,
29
30
  hideAsterisk = _ref3.hideAsterisk,
30
31
  children = _ref3.children;
31
- return ___EmotionJSX(SwitchGroupContainer, null, ___EmotionJSX(SwitchContextProvider, {
32
- value: {
33
- size: size,
34
- error: !!errorMessage
35
- }
36
- }, ___EmotionJSX(Label, {
37
- required: required,
38
- hideAsterisk: hideAsterisk,
39
- visualSize: size
40
- }, label), ___EmotionJSX(FlexBox, {
41
- directionColumn: true
42
- }, children)), errorMessage && ___EmotionJSX(ErrorText, null, errorMessage));
32
+ return _jsxs(SwitchGroupContainer, {
33
+ children: [_jsxs(SwitchContextProvider, {
34
+ value: {
35
+ size: size,
36
+ error: !!errorMessage
37
+ },
38
+ children: [_jsx(Label, {
39
+ required: required,
40
+ hideAsterisk: hideAsterisk,
41
+ visualSize: size,
42
+ children: label
43
+ }), _jsx(FlexBox, {
44
+ directionColumn: true,
45
+ children: children
46
+ })]
47
+ }), errorMessage && _jsx(ErrorText, {
48
+ children: errorMessage
49
+ })]
50
+ });
43
51
  };
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { Locale } from '@dfds-ui/react-components';
3
3
  import { BaseFieldProps } from '../types';
4
- export declare type TelFieldProps = BaseFieldProps & {
4
+ export type TelFieldProps = BaseFieldProps & {
5
+ ref?: React.Ref<TelFieldElement>;
5
6
  /**
6
7
  * Class name to be added to the TelField.
7
8
  */
@@ -31,37 +32,8 @@ export declare type TelFieldProps = BaseFieldProps & {
31
32
  */
32
33
  onBlur?: () => void;
33
34
  };
34
- export declare type TelFieldElement = {
35
+ export type TelFieldElement = {
35
36
  focus?: () => void;
36
37
  };
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" | "fr-MA" | "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>>;
38
+ export declare const TelField: ({ name, label, errorMessage, defaultValue, defaultLocale, required, hideAsterisk, showTrunkValues, splitValues, onChange, onBlur, ref, ...rest }: TelFieldProps) => React.JSX.Element;
67
39
  export default TelField;