Skip to content

Commit

Permalink
docs: fix storybook inputField error [LIBS-674] (#1602)
Browse files Browse the repository at this point in the history
  • Loading branch information
amcgee authored Sep 23, 2024
1 parent fc45bbb commit 6006c4e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions components/input/src/input-field/input-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Box } from '@dhis2-ui/box'
import { Field } from '@dhis2-ui/field'
import PropTypes from 'prop-types'
import React from 'react'
import { Input } from '../input/index.js'
import { Input, inputTypes } from '../input/index.js'

class InputField extends React.Component {
render() {
Expand Down Expand Up @@ -123,7 +123,7 @@ const InputFieldProps = {
step: PropTypes.string,
tabIndex: PropTypes.string,
/** Type of input */
type: Input.propTypes.type,
type: PropTypes.oneOf(inputTypes),
/** Applies 'valid' appearance for validation feedback. Mutually exclusive with `error` and `warning` props */
valid: sharedPropTypes.statusPropType,
/** Text below input for validation feedback. Receives styles depending on validation status */
Expand Down
1 change: 1 addition & 0 deletions components/input/src/input/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { Input } from './input.js'
export { inputTypes } from './inputTypes.js'
17 changes: 2 additions & 15 deletions components/input/src/input/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import cx from 'classnames'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import css from 'styled-jsx/css'
import { inputTypes } from './inputTypes.js'

const styles = css`
.input {
Expand Down Expand Up @@ -235,21 +236,7 @@ Input.propTypes = {
step: PropTypes.string,
tabIndex: PropTypes.string,
/** The native input `type` attribute */
type: PropTypes.oneOf([
'text',
'number',
'password',
'email',
'url',
'tel',
'date',
'datetime',
'datetime-local',
'month',
'week',
'time',
'search',
]),
type: PropTypes.oneOf(inputTypes),
/** Applies 'valid' appearance for validation feedback. Mutually exclusive with `error` and `warning` props */
valid: sharedPropTypes.statusPropType,
/** Value in the input. Can be used to control the component (recommended). Passed to event handler callbacks in object */
Expand Down
15 changes: 15 additions & 0 deletions components/input/src/input/inputTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export const inputTypes = [
'text',
'number',
'password',
'email',
'url',
'tel',
'date',
'datetime',
'datetime-local',
'month',
'week',
'time',
'search',
]
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"setup": "./scripts/setup.js",
"build": "./scripts/build-world.sh",
"build:lib": "./scripts/build.js",
"build:docs": "./scripts/build-docs.js",
"build:api": "./scripts/generate-api-docs.js",
"cy:start": "yarn build:lib && STORYBOOK_TESTING=1 yarn start",
"cy:open": "wait-on 'http://localhost:5000' && cypress open",
Expand Down

0 comments on commit 6006c4e

Please sign in to comment.