Skip to content

Commit

Permalink
fix(types): fix #input align prop
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Feb 8, 2021
1 parent 5c22a07 commit 3eda80c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ showTabs: true
| Properties | Description |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `value` | _(optional)_ the content value of the input. |
| `align` | _(optional)_ defines the `text-align` of the input. Defaults to `left`. |
| `align` | _(optional)_ defines the text alignment of the input. Can be `left`, `right` or `center`. Defaults to `left`. |
| `label` | _(optional)_ prepends the Form Label component. If no ID is provided, a random ID is created. |
| `label_direction` | _(optional)_ use `label_direction="vertical"` to change the label layout direction. Defaults to `horizontal` |
| `label_sr_only` | _(optional)_ use `true` to make the label only readable by screen readers. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default class InputMasked extends React.PureComponent {
PropTypes.bool
]),
placeholder_char: PropTypes.string,
align: PropTypes.oneOf(['left', 'center', 'right']),

on_change: PropTypes.func,
on_submit: PropTypes.func,
Expand All @@ -60,6 +61,7 @@ export default class InputMasked extends React.PureComponent {
pipe: null,
keep_char_positions: false,
placeholder_char: '_',
align: null,

on_change: null,
on_submit: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`InputMasked component have to match type="text" snapshot 1`] = `
<InputMasked
align="'left'"
currency_mask="currency_mask"
disabled={false}
id="input-masked"
Expand All @@ -26,7 +27,7 @@ exports[`InputMasked component have to match type="text" snapshot 1`] = `
value="test"
>
<Input
align={null}
align="'left'"
autocomplete="off"
class={null}
className="dnb-input-masked"
Expand Down Expand Up @@ -75,7 +76,7 @@ exports[`InputMasked component have to match type="text" snapshot 1`] = `
value="test"
>
<span
className="dnb-input dnb-input--text dnb-form-component dnb-input-masked"
className="dnb-input dnb-input--text dnb-form-component dnb-input-masked dnb-input__align--'left'"
>
<span
className="dnb-input__inner"
Expand Down
2 changes: 1 addition & 1 deletion packages/dnb-ui-lib/src/components/input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class Input extends React.PureComponent {
PropTypes.func,
PropTypes.node
]),
align: PropTypes.string,
align: PropTypes.oneOf(['left', 'center', 'right']),
selectall: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
stretch: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
disabled: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`Input component have to match type="search" snapshot 1`] = `
Object {
"displayName": "Input",
"props": Object {
"align": "align",
"align": "'left'",
"autocomplete": "autocomplete",
"children": "children",
"class": "class",
Expand Down Expand Up @@ -165,7 +165,7 @@ exports[`Input component have to match type="search" snapshot 1`] = `
Object {
"displayName": "Input",
"props": Object {
"align": "align",
"align": "'left'",
"autocomplete": "autocomplete",
"children": "children",
"class": "class",
Expand Down Expand Up @@ -262,7 +262,7 @@ exports[`Input component have to match type="search" snapshot 1`] = `
Object {
"displayName": "Input",
"props": Object {
"align": "align",
"align": "'left'",
"autocomplete": "autocomplete",
"children": "children",
"class": "class",
Expand Down Expand Up @@ -505,7 +505,7 @@ exports[`Input component have to match type="text" snapshot 1`] = `
Object {
"displayName": "Input",
"props": Object {
"align": "align",
"align": "'left'",
"autocomplete": "autocomplete",
"children": "children",
"class": "class",
Expand Down

0 comments on commit 3eda80c

Please sign in to comment.