@sb1/ffe-form-react 9.1.3 → 9.1.4

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.
@@ -31,7 +31,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
31
31
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
32
32
 
33
33
  import React from 'react';
34
- import { bool, node, string } from 'prop-types';
34
+ import { bool, node, string, oneOf } from 'prop-types';
35
35
  import { v4 as uuidv4 } from 'uuid';
36
36
  import classNames from 'classnames';
37
37
  import i18n from './i18n/i18n';
@@ -112,7 +112,7 @@ ToggleSwitch.propTypes = {
112
112
  className: string,
113
113
 
114
114
  /** A second line of text in the label */
115
- locale: string,
115
+ locale: oneOf(['nb', 'nn', 'en']),
116
116
 
117
117
  /** On/Off text language */
118
118
  description: string,
@@ -125,7 +125,7 @@ ToggleSwitch.propTypes = {
125
125
  className: _propTypes.string,
126
126
 
127
127
  /** A second line of text in the label */
128
- locale: _propTypes.string,
128
+ locale: (0, _propTypes.oneOf)(['nb', 'nn', 'en']),
129
129
 
130
130
  /** On/Off text language */
131
131
  description: _propTypes.string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-form-react",
3
- "version": "9.1.3",
3
+ "version": "9.1.4",
4
4
  "description": "React component for form elements in ffe",
5
5
  "license": "MIT",
6
6
  "author": "SpareBank 1",
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "ae59240d69e351f9ecb8b78ee095a80c9d3e6e4b"
48
+ "gitHead": "6030a57eafac2e4bde2bd946bc8d3f233b70ff8e"
49
49
  }
package/types/index.d.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  export interface CheckboxProps
4
- extends React.InputHTMLAttributes<HTMLInputElement> {
4
+ extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'children'> {
5
5
  noMargins?: boolean;
6
6
  hiddenLabel?: boolean;
7
7
  id?: string;
8
8
  inline?: boolean;
9
- children?: React.ReactNode;
9
+ children?:
10
+ | React.ReactNode
11
+ | ((labelProps: {
12
+ className: string;
13
+ htmlFor: string;
14
+ }) => React.ReactNode);
10
15
  }
11
16
 
12
17
  export interface BaseFieldMessageProps
@@ -168,13 +173,14 @@ export interface TextAreaProps
168
173
  export interface ToggleSwitchProps
169
174
  extends React.InputHTMLAttributes<HTMLInputElement> {
170
175
  children: React.ReactNode;
171
- className: string;
172
- id: string;
173
- description: string;
174
- onText: string;
175
- offText: string;
176
- hideOnOff: boolean;
177
- value: string;
176
+ className?: string;
177
+ locale?: 'nb' | 'nn' | 'en';
178
+ id?: string;
179
+ description?: string;
180
+ onText?: string;
181
+ offText?: string;
182
+ hideOnOff?: boolean;
183
+ value?: string;
178
184
  }
179
185
 
180
186
  declare class Checkbox extends React.Component<CheckboxProps, any> {}