Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Form component #773

Merged
merged 105 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
75141e5
use changesets
KhudaDad414 Jul 4, 2023
f851c53
add ADR
KhudaDad414 Jul 4, 2023
ffcf603
restore line
KhudaDad414 Jul 4, 2023
0fec23d
regenerate package-json
KhudaDad414 Jul 4, 2023
7ff109c
add linux-support
KhudaDad414 Jul 4, 2023
ae0ac8d
Version Packages (#14)
KhudaDad414 Jul 4, 2023
b3ec359
use original publish workflow
KhudaDad414 Jul 4, 2023
ee43893
remove check
KhudaDad414 Jul 4, 2023
fa35c6f
version packages (#15)
KhudaDad414 Jul 4, 2023
5a33a20
remove tests
KhudaDad414 Jul 4, 2023
9c7e1f3
remove extra line
KhudaDad414 Jul 4, 2023
33fb4e6
reset version
KhudaDad414 Jul 4, 2023
6c5c6d0
add docker publish
KhudaDad414 Jul 4, 2023
31dc032
remove semantic release
KhudaDad414 Jul 4, 2023
1af2fe5
regenerate package-lock
KhudaDad414 Jul 4, 2023
12f93d9
version packages (#16)
KhudaDad414 Jul 4, 2023
8501eb9
remove empty env
KhudaDad414 Jul 4, 2023
11147a5
version packages (#17)
KhudaDad414 Jul 4, 2023
5304e4b
testing
KhudaDad414 Jul 4, 2023
61e65f2
version packages (#18)
KhudaDad414 Jul 4, 2023
5435cb6
add correct tag
KhudaDad414 Jul 4, 2023
79894f3
version packages (#19)
KhudaDad414 Jul 4, 2023
a9ed0d9
final touches
KhudaDad414 Jul 4, 2023
71c35cd
regenerate package-lock
KhudaDad414 Jul 4, 2023
c4745c4
Merge remote-tracking branch 'upstream/master'
KhudaDad414 Jul 4, 2023
9a6fa2f
regenerate package-lock
KhudaDad414 Jul 4, 2023
85e1c02
Trigger Build
KhudaDad414 Jul 4, 2023
d9168b4
remove ADR
KhudaDad414 Jul 5, 2023
f5ef498
Create pitch.yml
KhudaDad414 Jul 5, 2023
b50bfc5
Merge branch 'upstream-master'
KhudaDad414 Jul 6, 2023
53dcb10
regenerate package-lock
KhudaDad414 Jul 6, 2023
89b2c30
use correct package name
KhudaDad414 Jul 6, 2023
00f0893
rectify package
KhudaDad414 Jul 6, 2023
c923b1c
Merge branch 'master' into master
KhudaDad414 Jul 6, 2023
5774a70
Merge branch 'master' into master
KhudaDad414 Jul 7, 2023
2d9133d
initial commit
KhudaDad414 Aug 9, 2023
dac4c32
SingleSelect added
KhudaDad414 Aug 16, 2023
06acb16
refactor for clarity
KhudaDad414 Aug 17, 2023
fa72778
Merge remote-tracking branch 'upstream/master' into form-component
KhudaDad414 Aug 17, 2023
1c019cf
Merge remote-tracking branch 'upstream/master' into form-component
KhudaDad414 Aug 17, 2023
cbb288a
add changeset.
KhudaDad414 Aug 17, 2023
3747008
add TextInput component.
KhudaDad414 Aug 17, 2023
05d4364
add changeset.
KhudaDad414 Aug 17, 2023
a2533aa
initial commit
KhudaDad414 Sep 1, 2023
1b926f6
add changeset
KhudaDad414 Sep 1, 2023
54a10ba
removed un-used imports
KhudaDad414 Sep 1, 2023
5eb8bcf
remove unused imports
KhudaDad414 Sep 1, 2023
e98a757
regenerate package-lock.json
KhudaDad414 Sep 4, 2023
a84344a
Merge branch 'upstream-master' into form-component
KhudaDad414 Sep 4, 2023
64d5609
update package.json
KhudaDad414 Sep 4, 2023
77627f5
revert-lockfile
KhudaDad414 Sep 4, 2023
f4d1ac5
Merge branch 'master' into form-component
KhudaDad414 Sep 4, 2023
d6ddfcf
revert styles
KhudaDad414 Sep 5, 2023
c5f349d
regenerate package-lock
KhudaDad414 Sep 5, 2023
0d0bdfe
fix lint issues
KhudaDad414 Sep 5, 2023
9f91a5f
add TextArea
KhudaDad414 Oct 10, 2023
d2ae2e3
add TextInput
KhudaDad414 Oct 10, 2023
730c9a3
edit form component
KhudaDad414 Oct 10, 2023
8e0bb5d
Merge branch 'upstream-master' into form-component
KhudaDad414 Oct 10, 2023
4791ae3
Merge branch 'upstream-master' into form-component
KhudaDad414 Oct 10, 2023
8e54b93
final touches
KhudaDad414 Oct 10, 2023
abb8e52
add changeset
KhudaDad414 Oct 10, 2023
785d17b
add tooltip
KhudaDad414 Oct 10, 2023
352d778
rename Dropdown
KhudaDad414 Oct 24, 2023
8489dd5
Merge branch 'master' into form-component
Amzani Oct 24, 2023
4ce05dd
move files
KhudaDad414 Oct 24, 2023
3e5ba1a
ignore css output
KhudaDad414 Oct 24, 2023
4d85772
ignore css output
KhudaDad414 Oct 24, 2023
26e24ac
add Fieldset component.
KhudaDad414 Oct 24, 2023
eed36b2
add more stories
KhudaDad414 Oct 24, 2023
db11ef8
add Field story
KhudaDad414 Oct 24, 2023
6f6bca3
Merge branch 'master' into form-component
KhudaDad414 Oct 24, 2023
58ce064
add IconButton stories
KhudaDad414 Oct 24, 2023
1701686
rename Fieldset
KhudaDad414 Oct 24, 2023
da1a3ad
fix sonar errors
KhudaDad414 Oct 24, 2023
9045073
add area-label to form
KhudaDad414 Oct 24, 2023
05875ff
resolve build error
KhudaDad414 Oct 24, 2023
db61a36
Merge branch 'master' into form-component
Amzani Oct 27, 2023
002b387
Merge branch 'master' into form-component
Amzani Nov 2, 2023
1291d01
use storybook/addon-a11y for accessibility testing
KhudaDad414 Nov 27, 2023
cc4b8aa
add accessibility labels
KhudaDad414 Nov 27, 2023
3ac98e2
Update packages/ui/components/Form/Inputs/TextInput.tsx
KhudaDad414 Nov 27, 2023
ab960b3
Update apps/design-system/src/components/Form/Form.stories.tsx
KhudaDad414 Nov 27, 2023
225451f
Update apps/design-system/src/components/Form/Form.stories.tsx
KhudaDad414 Nov 27, 2023
16464e6
Update apps/design-system/src/components/Form/Form.stories.tsx
KhudaDad414 Nov 27, 2023
9ee7681
Update packages/ui/components/Form/Fields/Field.tsx
KhudaDad414 Nov 27, 2023
c8983c1
Merge branch 'master' into form-component
KhudaDad414 Nov 27, 2023
7818d86
Merge branch 'master' into form-component
KhudaDad414 Dec 4, 2023
f1fe7b4
Merge branch 'master' into form-component
KhudaDad414 Dec 12, 2023
a73a4c8
Merge branch 'master' into form-component
KhudaDad414 Dec 18, 2023
ec29ce5
Merge remote-tracking branch 'upstream/master' into form-component
KhudaDad414 Mar 5, 2024
03bcad5
regenerate package-lock
KhudaDad414 Mar 6, 2024
aeb9f83
upgrade turbo
KhudaDad414 Mar 6, 2024
7e016c5
Merge branch 'master' into form-component
Amzani Mar 14, 2024
c0589c6
Merge branch 'master' into form-component
Amzani Mar 14, 2024
0a43430
Merge branch 'master' into form-component
Amzani Mar 15, 2024
0cf43f0
Merge branch 'master' into form-component
KhudaDad414 Mar 21, 2024
0a285e5
Merge branch 'master' into form-component
KhudaDad414 Apr 29, 2024
4c79f64
regenerate package-lock.json
KhudaDad414 Apr 29, 2024
f8ca590
Update apps/design-system/src/components/Form/Dropdown.stories.tsx
KhudaDad414 Apr 30, 2024
3b07b30
Update apps/design-system/src/components/Form/TextInput.stories.tsx
KhudaDad414 Apr 30, 2024
734a8c3
Merge branch 'master' into form-component
KhudaDad414 Apr 30, 2024
e57c1f5
fix cursor
KhudaDad414 May 1, 2024
7ec312d
Merge branch 'master' into form-component
KhudaDad414 May 15, 2024
e19cb74
fix test merge issues.
KhudaDad414 May 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/few-parrots-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@asyncapi/studio-ui": minor
---

Add Form component.
5 changes: 5 additions & 0 deletions .changeset/rare-donuts-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@asyncapi/studio-ui": minor
---

Added TextArea component.
5 changes: 5 additions & 0 deletions .changeset/silly-jobs-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@asyncapi/studio-ui": minor
---

Add Dropdown component.
5 changes: 5 additions & 0 deletions .changeset/young-hounds-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
"@asyncapi/studio-ui": minor
---

Add TextInput component.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ build
dist
.turbo
.env
apps/design-system/src/styles/tailwind.output.css
2 changes: 1 addition & 1 deletion apps/design-system/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ storybook-static

npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn-error.log*
16 changes: 12 additions & 4 deletions apps/design-system/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import '@asyncapi/studio-ui/styles.css'
import '../src/styles/tailwind.output.css'

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
backgrounds: {
default: 'dark',
values: [
{ name: 'light', value: '#ffffff' },
{ name: 'dark', value: '#0F172A' },
{
name: 'dark',
value: "#0F172A"
},
{
name: 'light',
value: "#e2e8f0"
},
],
},
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
}
6 changes: 5 additions & 1 deletion apps/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^13.5.0",
"@tippyjs/react": "^4.2.6",
"concurrently": "^8.2.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.8.0",
Expand All @@ -20,7 +21,9 @@
"generate:assets": "echo \"No assets to configure\"",
"test": "echo \"No tests\"",
"eject": "react-scripts eject",
"dev": "storybook dev -p 6006 --no-open",
"dev": "concurrently 'npm run watch:*'",
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
"watch:storybook": "storybook dev -p 6006 --no-open",
"watch:tailwind": "npx tailwindcss -i ./src/styles/tailwind.css -o ./src/styles/tailwind.output.css --watch",
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
"build": "storybook build"
},
Expand Down Expand Up @@ -64,6 +67,7 @@
"remark-gfm": "^3.0.1",
"storybook": "^7.0.20",
"tailwind-config": "workspace:*",
"tailwindcss": "^3.4.3",
"ts-loader": "^9.4.3",
"typescript": "^5.0.2",
"webpack": "^5.69.0"
Expand Down
102 changes: 102 additions & 0 deletions apps/design-system/src/components/Form/Dropdown.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import { Dropdown, DropdownOption } from '@asyncapi/studio-ui'
import type { Meta, StoryObj } from "@storybook/react"
/* eslint-disable import/no-anonymous-default-export */


const meta: Meta<typeof Dropdown> = {
component: Dropdown,
parameters: {
layout: "fullscreen",
backgrounds: {
default: "light",
},
},
}
export default meta

const options: DropdownOption[] = [
{
type: "group",
label: "MQTT",
options: [
{
label: "MQTT 3",
value: "mqtt3",
},
{
label: "MQTT 5",
value: "mqtt5",
},
],
},
{
type: "separator",
},
{
label: "MQTT",
value: "mqtt",
},
{
label: "AMQP 0-9-1",
value: "amqp0",
},
{
label: "AMQP 1",
value: "amqp1",
},
{
label: "KAFKA",
value: "kafka",
},
{
label: "HTTP",
value: "http",
},
{
label: "Socket.io",
value: "socket.io",
},
]
type Story = StoryObj<typeof Dropdown>
export const Default: Story = {
args: {
options,
placeholder: "Select a protocol...",
isDisabled: false,
},
}

export const Disabled: Story = {
args: {
...Default.args,
isDisabled: true,
},
}

export const WithSelectedValue: Story = {
args: {
...Default.args,
value: "mqtt",
},
}

export const EmptyOptions: Story = {
args: {
options: [],
placeholder: "No protocols available...",
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
isDisabled: false,
},
}

const longOptions: DropdownOption[] = [...Array(50)].map((_, i) => ({
label: `Option ${i + 1}`,
value: `option${i + 1}`,
}))

export const LongList: Story = {
args: {
options: longOptions,
placeholder: "Select an option...",
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
isDisabled: false,
},
}
38 changes: 38 additions & 0 deletions apps/design-system/src/components/Form/Field.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Field, Form, TextInput } from '@asyncapi/studio-ui'
import type { Meta } from "@storybook/react"
/* eslint-disable import/no-anonymous-default-export */


const meta: Meta<typeof Field> = {
component: Field,
parameters: {
layout: "fullscreen",
backgrounds: {
default: "dark",
},
},
}
export default meta

export const Default = () => (
<Form>
<Field className="grow" label="Schema Registry Vendor" name="vendor">
<TextInput value="Confluent" placeholder="" />
</Field>
</Form>
)

export const NoLabel = () => (
<Form>
<Field className="grow" name={"vendor"}>
<TextInput value="Confluent" placeholder="Enter vendor..." />
</Field>
</Form>
);
export const WithTooltip = () => (
<Form>
<Field className="grow" label="Schema Registry Vendor" name={"vendor"} tooltip="This is a vendor tooltip">
<TextInput value="Confluent" placeholder="" />
</Field>
</Form>
);
23 changes: 23 additions & 0 deletions apps/design-system/src/components/Form/Fieldset.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Fieldset, ChipInput } from '@asyncapi/studio-ui'
import type { Meta } from "@storybook/react"
/* eslint-disable import/no-anonymous-default-export */


const meta: Meta<typeof Fieldset> = {
component: Fieldset,
parameters: {
layout: "fullscreen",
backgrounds: {
default: "dark",
},
},
}
export default meta

export const Default = () => (
<Fieldset title="Tags" className='m-4'>
<div>
<ChipInput name={''} id={''} chips={["production", "platform"]} onChange={()=> {return}} />
</div>
</Fieldset>
)
102 changes: 102 additions & 0 deletions apps/design-system/src/components/Form/Form.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import React from 'react'
import type { Meta } from "@storybook/react"
import {
TextArea,
Field,
Form,
Group,
Fieldset,
IconButton,
TextInput,
Label,
Dropdown,
ChipInput,
} from "@asyncapi/studio-ui"
import { AddIcon, TrashIcon } from "@asyncapi/studio-ui/icons"

const meta: Meta<typeof Form> = {
component: Form,
parameters: {
layout: "fullscreen"
},
}

export default meta

const singleSelectOptions = [
{ label: "HTTP", value: "http" },
{ label: "Kafka", value: "kafka" },
{ label: "Websocket", value: "websocket" },
{ label: "AMQP", value: "amqp" },
{ label: "MQTT", value: "mqtt" },
{ label: "Google PubSub", value: "googlepubsub" },
{ label: "IBM MQ", value: "ibmmq" },
{ label: "NATS", value: "nats" },
{ label: "Pulsar", value: "pulsar" },
]
KhudaDad414 marked this conversation as resolved.
Show resolved Hide resolved
const renderSecurityInput = () => (
<div className="flex gap-3">
<Dropdown options={[{ label: "User/Password", value: "user/password" }]} value="user/password" />
<TextInput placeholder="Type something here..." className="grow" />
<TrashIcon className="w-6 h-6 text-gray-500" />
</div>
);
export const Default = () => (
<Form
title="User Registration"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title="User Registration"
title="User Registration" aria-label="User Registration Form"

Adding aria-label for accessibility.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>
<div className="flex flex-col gap-4">
<Field name="summary">
<TextArea placeholder="Type a short summary description..." rows={1}/>
</Field>
<Field name="description">
<TextArea rows={5} value='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque posuere fermentum urna, eu condimentum mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque posuere fermentum urna, eu condimentum mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque posuere fermentum urna, eu condimentum mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque posuere fermentum urna, eu condimentum mauris.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque posuere fermentum urna, eu condimentum mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque posuere fermentum urna, eu condimentum mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque posuere fermentum urna, eu condimentum mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque posuere fermentum urna, eu condimentum mauris' placeholder={'Type a description...'}/>
</Field>
</div>
<Fieldset title="Connection Details">
<div className="flex gap-3">
<Field name="protocol" label="Protocol">
<Dropdown options={singleSelectOptions} placeholder="Select a protocol..." />
</Field>
<Field name="host" label="Host" className="grow" tooltip='Server host url.'>
<TextInput value='kafka.in.mycompany.com:{port}/production' placeholder="" className='w-full' />
</Field>
</div>
<div className="flex gap-3">
<Field className="grow" label="Schema Registry URL" name={"schema"}>
<TextInput value="https://registry.mycompay.com" placeholder="" />
</Field>
<Field className="grow" label="Schema Registry Vendor" name={"vendor"}>
<TextInput value="Confluent" placeholder="" />
</Field>
</div>
<Label label={"Security"} />
<Group>
<div className="flex flex-col gap-3">
{renderSecurityInput()}
<TextInput placeholder="Type something here..." />
</div>
</Group>
<Group>
<div className="flex flex-col gap-3">
{renderSecurityInput()}
<TextInput placeholder="Type something here..." />
</div>
</Group>
<IconButton text="Add Security Requirements" icon={AddIcon} />
</Fieldset>
<Fieldset title="Tags">
<div>
<ChipInput name={''} id={''} chips={["production", "platform"]} onChange={()=> {return}} />
</div>
</Fieldset>
<Fieldset title="External Documentation">
<Field name="url" label="URL">
<TextInput placeholder="https://www.mycompany.com/private/docs/production-kafka-broker" />
</Field>
<Field name="description" label='Description'>
<TextArea value='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque posuere fermentum urna,' placeholder='' />
</Field>
</Fieldset>
</Form>
)
32 changes: 32 additions & 0 deletions apps/design-system/src/components/Form/Group.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Dropdown, Group, TextInput } from '@asyncapi/studio-ui'
import { TrashIcon } from '@asyncapi/studio-ui/icons'

import type { Meta } from "@storybook/react"
/* eslint-disable import/no-anonymous-default-export */


const meta: Meta<typeof Group> = {
component: Group,
parameters: {
layout: "fullscreen",
backgrounds: {
default: "dark",
},
},
}
export default meta



export const Default = () => (
<Group className='m-3'>
<div className="flex flex-col gap-3">
<div className="flex gap-3">
<Dropdown options={[{ label: "User/Password", value: "user/password" }]} value="user/password" />
<TextInput placeholder="Type something here..." className="grow" />
<TrashIcon className="w-6 h-6 text-gray-500" />
</div>
<TextInput placeholder="Type something here..." />
</div>
</Group>
)
Loading
Loading