-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/update-docs-site-to-react-18
- Loading branch information
Showing
60 changed files
with
334 additions
and
67 deletions.
There are no files selected for viewing
Binary file added
BIN
+12.1 KB
...test.ts-snapshots/InlineAutocomplete-Custom-Rendering-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.9 KB
...ete.test.ts-snapshots/InlineAutocomplete-Custom-Rendering-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.9 KB
...t.ts-snapshots/InlineAutocomplete-Custom-Rendering-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
...tocomplete.test.ts-snapshots/InlineAutocomplete-Custom-Rendering-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.1 KB
...test.ts-snapshots/InlineAutocomplete-Custom-Rendering-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
...est.ts-snapshots/InlineAutocomplete-Custom-Rendering-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
....ts-snapshots/InlineAutocomplete-Custom-Rendering-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.1 KB
...ocomplete.test.ts-snapshots/InlineAutocomplete-Custom-Rendering-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
...est.ts-snapshots/InlineAutocomplete-Custom-Rendering-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.1 KB
...complete.test.ts-snapshots/InlineAutocomplete-Default-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.9 KB
...Autocomplete.test.ts-snapshots/InlineAutocomplete-Default-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.9 KB
...plete.test.ts-snapshots/InlineAutocomplete-Default-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
.../InlineAutocomplete.test.ts-snapshots/InlineAutocomplete-Default-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.1 KB
...complete.test.ts-snapshots/InlineAutocomplete-Default-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
...omplete.test.ts-snapshots/InlineAutocomplete-Default-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
...lete.test.ts-snapshots/InlineAutocomplete-Default-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.1 KB
...InlineAutocomplete.test.ts-snapshots/InlineAutocomplete-Default-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
...omplete.test.ts-snapshots/InlineAutocomplete-Default-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...plete.test.ts-snapshots/InlineAutocomplete-Playground-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.8 KB
...ocomplete.test.ts-snapshots/InlineAutocomplete-Playground-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.8 KB
...te.test.ts-snapshots/InlineAutocomplete-Playground-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...lineAutocomplete.test.ts-snapshots/InlineAutocomplete-Playground-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...plete.test.ts-snapshots/InlineAutocomplete-Playground-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13 KB
...lete.test.ts-snapshots/InlineAutocomplete-Playground-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...e.test.ts-snapshots/InlineAutocomplete-Playground-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13 KB
...ineAutocomplete.test.ts-snapshots/InlineAutocomplete-Playground-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+13 KB
...lete.test.ts-snapshots/InlineAutocomplete-Playground-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+12 KB
...lete.test.ts-snapshots/InlineAutocomplete-Single-Line-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.8 KB
...complete.test.ts-snapshots/InlineAutocomplete-Single-Line-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.9 KB
...e.test.ts-snapshots/InlineAutocomplete-Single-Line-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.9 KB
...ineAutocomplete.test.ts-snapshots/InlineAutocomplete-Single-Line-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+12 KB
...lete.test.ts-snapshots/InlineAutocomplete-Single-Line-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+12 KB
...ete.test.ts-snapshots/InlineAutocomplete-Single-Line-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+12 KB
....test.ts-snapshots/InlineAutocomplete-Single-Line-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+12 KB
...neAutocomplete.test.ts-snapshots/InlineAutocomplete-Single-Line-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+12 KB
...ete.test.ts-snapshots/InlineAutocomplete-Single-Line-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.44 KB
...StyledOcticon.test.ts-snapshots/StyledOcticon-Default-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.48 KB
...nts/StyledOcticon.test.ts-snapshots/StyledOcticon-Default-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.38 KB
...ledOcticon.test.ts-snapshots/StyledOcticon-Default-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.4 KB
...components/StyledOcticon.test.ts-snapshots/StyledOcticon-Default-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.44 KB
...StyledOcticon.test.ts-snapshots/StyledOcticon-Default-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.4 KB
...tyledOcticon.test.ts-snapshots/StyledOcticon-Default-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.39 KB
...edOcticon.test.ts-snapshots/StyledOcticon-Default-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.4 KB
...omponents/StyledOcticon.test.ts-snapshots/StyledOcticon-Default-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.4 KB
...tyledOcticon.test.ts-snapshots/StyledOcticon-Default-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.44 KB
...ledOcticon.test.ts-snapshots/StyledOcticon-Playground-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.48 KB
.../StyledOcticon.test.ts-snapshots/StyledOcticon-Playground-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.38 KB
...Octicon.test.ts-snapshots/StyledOcticon-Playground-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.4 KB
...ponents/StyledOcticon.test.ts-snapshots/StyledOcticon-Playground-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.44 KB
...ledOcticon.test.ts-snapshots/StyledOcticon-Playground-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.4 KB
...edOcticon.test.ts-snapshots/StyledOcticon-Playground-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.39 KB
...cticon.test.ts-snapshots/StyledOcticon-Playground-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.4 KB
...onents/StyledOcticon.test.ts-snapshots/StyledOcticon-Playground-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.4 KB
...edOcticon.test.ts-snapshots/StyledOcticon-Playground-light-tritanopia-linux.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import {test, expect} from '@playwright/test' | ||
import {visit} from '../test-helpers/storybook' | ||
import {themes} from '../test-helpers/themes' | ||
|
||
test.describe('InlineAutocomplete', () => { | ||
test.describe('Default', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-forms-inlineautocomplete--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`InlineAutocomplete.Default.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-forms-inlineautocomplete--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('Playground', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-forms-inlineautocomplete--playground', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`InlineAutocomplete.Playground.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-forms-inlineautocomplete--playground', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('Custom Rendering', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-forms-inlineautocomplete-features--custom-rendering', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`InlineAutocomplete.Custom Rendering.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-forms-inlineautocomplete-features--custom-rendering', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('Single Line', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-forms-inlineautocomplete-features--single-line', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`InlineAutocomplete.Single Line.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-forms-inlineautocomplete-features--single-line', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import {test, expect} from '@playwright/test' | ||
import {visit} from '../test-helpers/storybook' | ||
import {themes} from '../test-helpers/themes' | ||
|
||
test.describe('StyledOcticon', () => { | ||
test.describe('Default', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-styledocticon--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`StyledOcticon.Default.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-styledocticon--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('Playground', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-styledocticon--playground', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`StyledOcticon.Playground.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-styledocticon--playground', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
src/Octicon/StyledOcticon.stories.tsx → src/StyledOcticon/StyledOcticon.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/drafts/InlineAutocomplete/InlineAutocomplete.features.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import React, {useState} from 'react' | ||
import {Meta} from '@storybook/react' | ||
import {ActionList, Avatar, ActionListItemProps, Textarea, TextInput, FormControl} from '../..' | ||
import InlineAutocomplete, {ShowSuggestionsEvent, Suggestions} from '.' | ||
|
||
export default { | ||
title: 'Components/Forms/InlineAutocomplete/Features', | ||
component: InlineAutocomplete, | ||
} as Meta<typeof InlineAutocomplete> | ||
|
||
interface User { | ||
login: string | ||
name: string | ||
avatar: string | ||
type: 'user' | 'organization' | ||
} | ||
|
||
const sampleUsers: User[] = [ | ||
{login: 'monalisa', name: 'Monalisa Octocat', avatar: 'https://avatars.githubusercontent.com/github', type: 'user'}, | ||
{login: 'primer', name: 'Primer', avatar: 'https://avatars.githubusercontent.com/primer', type: 'organization'}, | ||
{login: 'github', name: 'GitHub', avatar: 'https://avatars.githubusercontent.com/github', type: 'organization'}, | ||
] | ||
|
||
const filteredUsers = (query: string) => | ||
sampleUsers.filter( | ||
user => | ||
user.login.toLowerCase().includes(query.toLowerCase()) || user.name.toLowerCase().includes(query.toLowerCase()), | ||
) | ||
|
||
export const SingleLine = ({loading, tabInserts}: ArgProps) => { | ||
const [suggestions, setSuggestions] = useState<Suggestions | null>(null) | ||
|
||
const onShowSuggestions = (event: ShowSuggestionsEvent) => { | ||
if (loading) { | ||
setSuggestions('loading') | ||
return | ||
} | ||
|
||
setSuggestions(filteredUsers(event.query).map(user => user.login)) | ||
} | ||
|
||
return ( | ||
<FormControl> | ||
<FormControl.Label>Inline Autocomplete Demo</FormControl.Label> | ||
<FormControl.Caption>Try typing '@' to show user suggestions.</FormControl.Caption> | ||
<InlineAutocomplete | ||
triggers={[{triggerChar: '@'}]} | ||
suggestions={suggestions} | ||
onShowSuggestions={onShowSuggestions} | ||
onHideSuggestions={() => setSuggestions(null)} | ||
tabInsertsSuggestions={tabInserts} | ||
> | ||
<TextInput sx={{lineHeight: 1.2}} /> | ||
</InlineAutocomplete> | ||
</FormControl> | ||
) | ||
} | ||
|
||
const UserSuggestion = ({user, ...props}: {user: User} & ActionListItemProps) => ( | ||
<ActionList.Item {...props}> | ||
<ActionList.LeadingVisual> | ||
<Avatar src={user.avatar} square={user.type === 'organization'} /> | ||
</ActionList.LeadingVisual> | ||
{user.name} <ActionList.Description>{user.login}</ActionList.Description> | ||
</ActionList.Item> | ||
) | ||
|
||
type ArgProps = { | ||
loading: boolean | ||
tabInserts: boolean | ||
} | ||
|
||
export const CustomRendering = ({loading, tabInserts}: ArgProps) => { | ||
const [suggestions, setSuggestions] = useState<Suggestions | null>(null) | ||
|
||
const onShowSuggestions = (event: ShowSuggestionsEvent) => { | ||
if (loading) { | ||
setSuggestions('loading') | ||
return | ||
} | ||
|
||
setSuggestions( | ||
filteredUsers(event.query).map(user => ({ | ||
value: user.login, | ||
render: props => <UserSuggestion user={user} {...props} />, | ||
})), | ||
) | ||
} | ||
|
||
const onHideSuggestions = () => setSuggestions(null) | ||
|
||
return ( | ||
<FormControl> | ||
<FormControl.Label>Inline Autocomplete Demo</FormControl.Label> | ||
<FormControl.Caption>Try typing '@' to show user suggestions.</FormControl.Caption> | ||
<InlineAutocomplete | ||
triggers={[{triggerChar: '@'}]} | ||
suggestions={suggestions} | ||
onShowSuggestions={onShowSuggestions} | ||
onHideSuggestions={onHideSuggestions} | ||
tabInsertsSuggestions={tabInserts} | ||
> | ||
<Textarea /> | ||
</InlineAutocomplete> | ||
</FormControl> | ||
) | ||
} |
Oops, something went wrong.