Skip to content

Commit

Permalink
refactor(togglegroupfield): migrate to ui-widgets
Browse files Browse the repository at this point in the history
BREAKING CHANGE: move the ToggleGroupField component from ui-core to
ui-widgets.
  • Loading branch information
varl committed Mar 9, 2020
1 parent 726b607 commit db55448
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
1 change: 0 additions & 1 deletion packages/core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,4 @@ export { Modal } from './Modal/Modal.js'
export { MultiSelectField } from './MultiSelectField/MultiSelectField.js'
export { SingleSelectField } from './SingleSelectField/SingleSelectField.js'
export { SwitchField } from './SwitchField/SwitchField.js'
export { ToggleGroupField } from './ToggleGroupField/ToggleGroupField.js'
export { TextAreaField } from './TextAreaField/TextAreaField.js'
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import propTypes from '@dhis2/prop-types'
import React from 'react'

import { ToggleGroup } from '../ToggleGroup/ToggleGroup.js'
import { Field } from '../Field/Field.js'
import { FieldSet } from '../FieldSet/FieldSet.js'
import { Legend } from '../Legend/Legend.js'
import { Help } from '../Help/Help.js'
import { statusPropType } from '../common-prop-types.js'
import { ToggleGroup, Field, FieldSet, Legend, Help } from '@dhis2/ui-core'

export const statusPropType = propTypes.mutuallyExclusive(
['valid', 'warning', 'error'],
propTypes.bool
)

/**
* @module
* @param {ToggleGroupField.PropTypes} props
* @returns {React.Component}
*
* @example import { ToggleGroupField } from '@dhis2/ui-core'
* @example import { ToggleGroupField } from '@dhis2/ui'
*
* @see Live demo: {@link /demo/?path=/story/togglegroupfield--default|Storybook}
* @example import { ToggleGroupField } from '@dhis2/ui-widgets'
*/
const ToggleGroupField = ({
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { storiesOf } from '@storybook/react'
import React from 'react'
import { storiesOf } from '@storybook/react'

import { Checkbox } from '@dhis2/ui-core'

import { ToggleGroupField } from './ToggleGroupField.js'
import { Checkbox } from '../index.js'

storiesOf('ToggleGroupField', module).add('With label and required', () => (
<ToggleGroupField
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { storiesOf } from '@storybook/react'
import React from 'react'
import { storiesOf } from '@storybook/react'

import { Checkbox, Radio, Switch } from '@dhis2/ui-core'

import { ToggleGroupField } from './ToggleGroupField.js'
import { Checkbox, Radio, Switch } from '../index.js'

const logger = ({ name, value, checked }) =>
console.info(`name: ${name}, value: ${value}, checked: ${checked}`)
Expand Down
2 changes: 2 additions & 0 deletions packages/widgets/src/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export { HeaderBar } from './HeaderBar'
export { OrganisationUnitTree } from './OrganisationUnitTree'

export { ToggleGroupField } from './ToggleGroupField/ToggleGroupField.js'

0 comments on commit db55448

Please sign in to comment.