{"size": 1785, "ext": "js", "max_stars_repo_path": "pkg/webui/components/form/field/stories/file-input.stories.js", "max_stars_repo_name": "mastermind88/lorawan-stack", "max_stars_repo_stars_event_min_datetime": "2022-02-21T20:17:56.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T20:17:56.000Z", "max_issues_repo_path": "pkg/webui/components/form/field/stories/file-input.stories.js", "max_issues_repo_name": "mastermind88/lorawan-stack", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "pkg/webui/components/form/field/stories/file-input.stories.js", "max_forks_repo_name": "mastermind88/lorawan-stack", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.875, "max_line_length": 94, "alphanum_fraction": 0.6918767507}
// Copyright © 2021 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* eslint-disable react/prop-types */

import React from 'react'
import { withInfo } from '@storybook/addon-info'

import FileInput from '@ttn-lw/components/file-input'
import Form from '@ttn-lw/components/form'

import { FieldsWrapperExample, info } from './shared'

export default {
  title: 'Fields/FileInput',
  decorators: [withInfo(info)],
}

export const Default = () => (
  <FieldsWrapperExample
    initialValues={{
      default: '',
      withValue: 'base64-value-goes-here',
      error: '',
    }}
  >
    <Form.Field name="default" title="Default" component={FileInput} />
    <Form.Field
      name="description"
      title="With Description"
      description="A file input field."
      component={FileInput}
    />
    <Form.Field name="withValue" title="With initially attached file" component={FileInput} />
    <Form.Field name="error" title="With error" component={FileInput} />
    <Form.Field
      name="warning"
      title="With warning"
      component={FileInput}
      warning="A file input field."
    />
    <Form.Field name="disabled" title="Disabled" component={FileInput} disabled />
  </FieldsWrapperExample>
)
