Skip to content

Commit

Permalink
Rename TagInput component
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed Oct 12, 2023
1 parent 4f809f3 commit 80ed7a0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ooni-components",
"version": "1.0.0-alpha.20",
"version": "1.0.0-alpha.21",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -103,7 +103,7 @@
"lint": "eslint --ignore-path .gitignore --ignore-pattern '/components/icons/*' .",
"release": "yarn run build && yarn publish --new-version $npm_package_version",
"release:win": "yarn run build && yarn publish --new-version %npm_package_version%",
"release:alpha": "yarn publish --tag alpha",
"release:alpha": "yarn run build && yarn publish --tag alpha --new-version $npm_package_version",
"eslint": "esw src/**",
"eslint-watch": "esw -w --changed src/**",
"eslint-watch-quiet": "esw -w --quiet --changed src/**",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,30 @@ interface Option {
readonly value: string
}

export interface SelectProps extends Omit<SP, 'value' | 'onChange'> {
export interface MultiSelectCreatableProps
extends Omit<SP, 'value' | 'onChange'> {
label?: string
placeholder?: string
value: MultiValue<Option>
onChange: (obj: MultiValue<Option>) => void
error: string
error?: string
}

const createOption = (label: string) => ({
label,
value: label,
})

const TagInput = forwardRef(
const MultiSelectCreatable = forwardRef(
(
{ label, name, value: initialValue, onChange, error, ...rest }: SelectProps,
{
label,
name,
value: initialValue,
onChange,
error,
...rest
}: MultiSelectCreatableProps,
ref,
) => {
const [inputValue, setInputValue] = React.useState('')
Expand Down Expand Up @@ -121,4 +129,4 @@ const TagInput = forwardRef(
},
)

export default TagInput
export default MultiSelectCreatable
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ export { default as Image } from './components/Image'
export { default as Select } from './components/Select'
export { default as Checkbox } from './components/Checkbox'
export { default as Label } from './components/Label'
export { default as TagInput } from './components/TagInput'
export { default as MultiSelectCreatable } from './components/MultiSelectCreatable'
export { default as MultiSelect } from './components/MultiSelect'
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import React from 'react'
import { Meta, StoryObj } from '@storybook/react'
import { Meta } from '@storybook/react'
import { action } from '@storybook/addon-actions'

import Box from '../src/components/Box'
import TagInput from '../src/components/TagInput'
import MultiSelectCreatable from '../src/components/MultiSelectCreatable'

const meta: Meta = {
title: 'Components/TagInput',
component: TagInput,
title: 'Components/MultiSelectCreatable',
component: MultiSelectCreatable,
}

export default meta

export const Default = () => {
return (
<Box>
<TagInput
<MultiSelectCreatable
id="tags"
name="tags"
label="Tags"
my={3}
value={[{ label: 'orange', value: 'orange' }]}
onChange={(val) => console.log(val)}
/>
</Box>
)
Expand Down

0 comments on commit 80ed7a0

Please sign in to comment.