@dfds-ui/forms 2.2.0-alpha.9bb1ab0f → 2.2.0-alpha.a1ae8508

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 (81) hide show
  1. package/assistive-text/AssistiveText.js +5 -4
  2. package/asterisk/Asterisk.js +12 -4
  3. package/checkbox/Checkbox.d.ts +14 -13
  4. package/checkbox/Checkbox.js +47 -39
  5. package/checkbox/CheckboxContext.js +5 -4
  6. package/checkbox/CheckboxGroup.js +43 -28
  7. package/cjs/assistive-text/AssistiveText.js +6 -5
  8. package/cjs/asterisk/Asterisk.js +7 -6
  9. package/cjs/checkbox/Checkbox.d.ts +14 -13
  10. package/cjs/checkbox/Checkbox.js +42 -39
  11. package/cjs/checkbox/CheckboxContext.js +7 -8
  12. package/cjs/checkbox/CheckboxGroup.js +36 -26
  13. package/cjs/counter/Counter.d.ts +2 -1
  14. package/cjs/counter/Counter.js +66 -63
  15. package/cjs/enhanced/EnhancedField.d.ts +1 -1
  16. package/cjs/enhanced/EnhancedField.js +34 -31
  17. package/cjs/error-text/ErrorText.js +6 -5
  18. package/cjs/field-wrap/FieldWrap.js +36 -28
  19. package/cjs/help-icon/HelpIcon.js +9 -8
  20. package/cjs/label/Label.js +6 -4
  21. package/cjs/password-field/PasswordField.d.ts +1 -1
  22. package/cjs/password-field/PasswordField.js +8 -8
  23. package/cjs/radio/Radio.d.ts +3 -2
  24. package/cjs/radio/Radio.js +31 -30
  25. package/cjs/radio/RadioContext.js +7 -8
  26. package/cjs/radio/RadioGroup.js +37 -27
  27. package/cjs/rating/Rating.d.ts +3 -4
  28. package/cjs/rating/Rating.js +89 -71
  29. package/cjs/select-field/AsyncSelectField.d.ts +3 -4
  30. package/cjs/select-field/AsyncSelectField.js +52 -51
  31. package/cjs/select-field/CreatableSelectField.d.ts +3 -4
  32. package/cjs/select-field/CreatableSelectField.js +105 -94
  33. package/cjs/select-field/NativeSelectField.d.ts +1 -1
  34. package/cjs/select-field/NativeSelectField.js +24 -23
  35. package/cjs/select-field/SelectField.d.ts +3 -4
  36. package/cjs/select-field/SelectField.js +116 -102
  37. package/cjs/switch/Switch.d.ts +3 -2
  38. package/cjs/switch/Switch.js +45 -38
  39. package/cjs/switch/SwitchContext.js +7 -8
  40. package/cjs/switch/SwitchGroup.js +24 -15
  41. package/cjs/tel-field/TelField.d.ts +2 -30
  42. package/cjs/tel-field/TelField.js +101 -86
  43. package/cjs/text-field/TextField.d.ts +2 -27
  44. package/cjs/text-field/TextField.js +57 -53
  45. package/cjs/textarea-field/TextareaField.d.ts +2 -15
  46. package/cjs/textarea-field/TextareaField.js +28 -26
  47. package/counter/Counter.d.ts +2 -1
  48. package/counter/Counter.js +72 -66
  49. package/enhanced/EnhancedField.d.ts +1 -1
  50. package/enhanced/EnhancedField.js +40 -31
  51. package/error-text/ErrorText.js +5 -4
  52. package/field-wrap/FieldWrap.js +42 -29
  53. package/help-icon/HelpIcon.js +8 -7
  54. package/label/Label.js +13 -6
  55. package/package.json +10 -10
  56. package/password-field/PasswordField.d.ts +1 -1
  57. package/password-field/PasswordField.js +15 -11
  58. package/radio/Radio.d.ts +3 -2
  59. package/radio/Radio.js +36 -30
  60. package/radio/RadioContext.js +5 -4
  61. package/radio/RadioGroup.js +37 -28
  62. package/rating/Rating.d.ts +3 -4
  63. package/rating/Rating.js +90 -72
  64. package/select-field/AsyncSelectField.d.ts +3 -4
  65. package/select-field/AsyncSelectField.js +61 -53
  66. package/select-field/CreatableSelectField.d.ts +3 -4
  67. package/select-field/CreatableSelectField.js +104 -94
  68. package/select-field/NativeSelectField.d.ts +1 -1
  69. package/select-field/NativeSelectField.js +29 -22
  70. package/select-field/SelectField.d.ts +3 -4
  71. package/select-field/SelectField.js +113 -100
  72. package/switch/Switch.d.ts +3 -2
  73. package/switch/Switch.js +57 -44
  74. package/switch/SwitchContext.js +5 -4
  75. package/switch/SwitchGroup.js +24 -16
  76. package/tel-field/TelField.d.ts +2 -30
  77. package/tel-field/TelField.js +112 -92
  78. package/text-field/TextField.d.ts +2 -27
  79. package/text-field/TextField.js +64 -55
  80. package/textarea-field/TextareaField.d.ts +2 -15
  81. package/textarea-field/TextareaField.js +31 -26
@@ -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);
@@ -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
  };
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { Locale } from '@dfds-ui/react-components';
3
3
  import { BaseFieldProps } from '../types';
4
4
  export type TelFieldProps = BaseFieldProps & {
5
+ ref?: React.Ref<TelFieldElement>;
5
6
  /**
6
7
  * Class name to be added to the TelField.
7
8
  */
@@ -34,34 +35,5 @@ export type TelFieldProps = BaseFieldProps & {
34
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;
42
- /**
43
- * Default value for the phone number
44
- */
45
- defaultValue?: string;
46
- /**
47
- * Default locale. Will set the matching country in the dropdown
48
- */
49
- defaultLocale?: Locale;
50
- /**
51
- * Show trunk values (the local area code shown in parenthesis)
52
- */
53
- showTrunkValues?: boolean;
54
- /**
55
- * Makes value splitted so easier to convert to object
56
- */
57
- splitValues?: boolean;
58
- /**
59
- * Callback when value changes
60
- */
61
- onChange?: (newValue: string) => void;
62
- /**
63
- * Callback when blur
64
- */
65
- onBlur?: () => void;
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;