@byline/ui 6.8.0 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -5
- package/package.json +16 -7
- package/src/components/accordion/accordion.stories.tsx +121 -0
- package/src/components/animation/fade-in-lift.stories.tsx +80 -0
- package/src/components/avatar/avatar.stories.tsx +39 -0
- package/src/components/badge/badge.stories.tsx +41 -0
- package/src/components/button/button-group.stories.tsx +44 -0
- package/src/components/button/button-intents.stories.tsx +97 -0
- package/src/components/button/button-overrides.stories.tsx +59 -0
- package/src/components/button/button-test.stories.tsx +59 -0
- package/src/components/button/button-variants.stories.tsx +57 -0
- package/src/components/button/combo-buttons.stories.tsx +82 -0
- package/src/components/button/control-buttons.stories.tsx +60 -0
- package/src/components/button/copy-button.stories.tsx +50 -0
- package/src/components/button/icon-button.stories.tsx +140 -0
- package/src/components/card/card.stories.tsx +60 -0
- package/src/components/chips/chip.stories.tsx +120 -0
- package/src/components/container/container.stories.tsx +35 -0
- package/src/components/dropdown/dropdown.stories.tsx +108 -0
- package/src/components/hamburger/hamburger.stories.tsx +33 -0
- package/src/components/inputs/autocomplete.stories.tsx +189 -0
- package/src/components/inputs/calendar.stories.tsx +141 -0
- package/src/components/inputs/checkbox-group.stories.tsx +43 -0
- package/src/components/inputs/checkbox.stories.tsx +284 -0
- package/src/components/inputs/input.stories.tsx +189 -0
- package/src/components/inputs/radio-group.stories.tsx +73 -0
- package/src/components/inputs/select.stories.tsx +70 -0
- package/src/components/inputs/text-area.stories.tsx +45 -0
- package/src/components/notifications/alert.stories.tsx +75 -0
- package/src/components/notifications/toast.stories.tsx +40 -0
- package/src/components/pager/pagination.stories.tsx +189 -0
- package/src/components/scroll-area/scroll-area.stories.tsx +33 -0
- package/src/components/shimmer/shimmer.stories.tsx +24 -0
- package/src/components/table/table.stories.tsx +94 -0
- package/src/components/tabs/tabs.stories.tsx +47 -0
- package/src/components/tooltip/tooltip.stories.tsx +56 -0
- package/src/icons/icons.stories.tsx +67 -0
- package/src/icons/index.stories.tsx +24 -0
- package/src/loaders/loaders.stories.tsx +188 -0
- package/src/styles/base/colors.stories.tsx +671 -0
- package/src/styles/theme/theme.stories.tsx +40 -0
- package/src/styles/typography/article.stories.tsx +39 -0
- package/src/styles/typography/code.stories.tsx +73 -0
- package/src/styles/typography/default.stories.tsx +49 -0
- package/src/styles/typography/lists.stories.tsx +48 -0
- package/src/styles/typography/quote.stories.tsx +38 -0
- package/src/widgets/datepicker/datepicker.stories.tsx +42 -0
- package/src/widgets/drawer/drawer.stories.tsx +281 -0
- package/src/widgets/modal/modal.stories.tsx +63 -0
- package/src/widgets/search/search.stories.tsx +18 -0
- package/src/widgets/timeline/timeline.stories.tsx +50 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite'
|
|
2
|
+
|
|
3
|
+
export const Article = (): React.JSX.Element => {
|
|
4
|
+
return (
|
|
5
|
+
<div style={{ marginBottom: '48px' }}>
|
|
6
|
+
<article style={{ maxWidth: '700px', margin: '2rem auto' }} className="prose">
|
|
7
|
+
<h1>An Article</h1>
|
|
8
|
+
<p>
|
|
9
|
+
This is text that that has been placed in an article element. Text in articles as well as
|
|
10
|
+
within .dynamic-text class selectors will automatically increase in size on mobile devices
|
|
11
|
+
for better readability. This is a paragraph of text that we'll use for our typography
|
|
12
|
+
storybook page. This is a paragraph of text that we'll use for our typography
|
|
13
|
+
storybook page.
|
|
14
|
+
</p>
|
|
15
|
+
<blockquote>
|
|
16
|
+
This is some text inside a blockquote. Note that we've used em to size text in the
|
|
17
|
+
blockquote, so that it also changes size in the article.
|
|
18
|
+
</blockquote>
|
|
19
|
+
<p>
|
|
20
|
+
This is a paragraph of text that we'll use for our typography storybook page. This is
|
|
21
|
+
a paragraph of text that we'll use for our typography storybook page. This is a
|
|
22
|
+
paragraph of text that we'll use for our typography storybook page. This is a
|
|
23
|
+
paragraph of text that we'll use for our typography storybook page.
|
|
24
|
+
</p>
|
|
25
|
+
</article>
|
|
26
|
+
</div>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const meta: Meta = {
|
|
31
|
+
/* 👇 The title prop is optional.
|
|
32
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
33
|
+
* to learn how to generate automatic titles
|
|
34
|
+
*/
|
|
35
|
+
title: 'Typography',
|
|
36
|
+
component: Article,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default meta
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite'
|
|
2
|
+
import { Highlight, themes } from 'prism-react-renderer'
|
|
3
|
+
|
|
4
|
+
const code = `const x = 'foo';
|
|
5
|
+
function printFoo() {
|
|
6
|
+
console.log(x);
|
|
7
|
+
}
|
|
8
|
+
printFoo();`
|
|
9
|
+
|
|
10
|
+
type CodeIntrinsicProps = React.JSX.IntrinsicElements['pre']
|
|
11
|
+
interface CodeProps extends CodeIntrinsicProps {
|
|
12
|
+
className?: string
|
|
13
|
+
title?: string
|
|
14
|
+
code: string
|
|
15
|
+
language?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function CodeDemo({ code, className, language = 'jsx' }: CodeProps): React.JSX.Element {
|
|
19
|
+
return (
|
|
20
|
+
<Highlight theme={themes.nightOwl} code={code} language={language}>
|
|
21
|
+
{({ tokens, getLineProps, getTokenProps }) => (
|
|
22
|
+
<pre className={className}>
|
|
23
|
+
{tokens.map((line, i) => {
|
|
24
|
+
const lineProps = getLineProps({ line, key: i })
|
|
25
|
+
return (
|
|
26
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
|
|
27
|
+
<div {...lineProps} key={i} style={{ lineHeight: 1.3 }}>
|
|
28
|
+
<span style={{ marginLeft: '-8px', marginRight: '12px' }}>{i + 1}</span>
|
|
29
|
+
{line.map((token, key) => (
|
|
30
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
|
|
31
|
+
<span key={key} {...getTokenProps({ token })} />
|
|
32
|
+
))}
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
})}
|
|
36
|
+
</pre>
|
|
37
|
+
)}
|
|
38
|
+
</Highlight>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const Code = (): React.JSX.Element => {
|
|
43
|
+
return (
|
|
44
|
+
<div style={{ margin: '48px' }}>
|
|
45
|
+
<div style={{ maxWidth: '700px', margin: '2rem auto' }} className="prose">
|
|
46
|
+
<h1>Heading 1</h1>
|
|
47
|
+
<p>
|
|
48
|
+
This is an example of <code>inline code here</code> and text that we'll use for our
|
|
49
|
+
typography and code storybook page. This is a paragraph of text that we'll use for
|
|
50
|
+
our typography and code storybook page. Here is a code block...
|
|
51
|
+
</p>
|
|
52
|
+
<CodeDemo code={code} />
|
|
53
|
+
<p>
|
|
54
|
+
This is a paragraph of text that we'll use for our typography storybook page. This is
|
|
55
|
+
a paragraph of text that we'll use for our typography storybook page. This is a
|
|
56
|
+
paragraph of text that we'll use for our typography storybook page. This is a
|
|
57
|
+
paragraph of text that we'll use for our typography storybook page.
|
|
58
|
+
</p>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const meta: Meta = {
|
|
65
|
+
/* 👇 The title prop is optional.
|
|
66
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
67
|
+
* to learn how to generate automatic titles
|
|
68
|
+
*/
|
|
69
|
+
title: 'Typography',
|
|
70
|
+
component: Code,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default meta
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite'
|
|
2
|
+
|
|
3
|
+
export const Default = (): React.JSX.Element => {
|
|
4
|
+
return (
|
|
5
|
+
<div style={{ marginBottom: '48px' }}>
|
|
6
|
+
<div style={{ maxWidth: '700px', margin: '2rem auto' }} className="prose">
|
|
7
|
+
<h1>Heading 1 - With Some More Text to Test on Mobile</h1>
|
|
8
|
+
<p>
|
|
9
|
+
This is a paragraph of text that we'll use for our typography storybook page. This is
|
|
10
|
+
a paragraph of text that we'll use for our typography storybook page. This is a
|
|
11
|
+
paragraph of text that we'll use for our typography storybook page. This is a
|
|
12
|
+
paragraph of text that we'll use for our typography storybook page.
|
|
13
|
+
</p>
|
|
14
|
+
<h2>Heading 2 - With Some More Text to Test on Mobile</h2>
|
|
15
|
+
<p>
|
|
16
|
+
This is a paragraph of text that we'll use for our typography storybook page. This is
|
|
17
|
+
a paragraph of text that we'll use for our typography storybook page. This is a
|
|
18
|
+
paragraph of text that we'll use for our typography storybook page. This is a
|
|
19
|
+
paragraph of text that we'll use for our typography storybook page.
|
|
20
|
+
</p>
|
|
21
|
+
<h3>Heading 3 - With Some More Text to Test on Mobile</h3>
|
|
22
|
+
<p>
|
|
23
|
+
This is a paragraph of text that we'll use for our typography storybook page. This is
|
|
24
|
+
a paragraph of text that we'll use for our typography storybook page. This is a
|
|
25
|
+
paragraph of text that we'll use for our typography storybook page. This is a
|
|
26
|
+
paragraph of text that we'll use for our typography storybook page.
|
|
27
|
+
</p>
|
|
28
|
+
<h4>Heading 4 - With Some More Text to Test on Mobile</h4>
|
|
29
|
+
<p>
|
|
30
|
+
This is a paragraph of text that we'll use for our typography storybook page. This is
|
|
31
|
+
a paragraph of text that we'll use for our typography storybook page. This is a
|
|
32
|
+
paragraph of text that we'll use for our typography storybook page. This is a
|
|
33
|
+
paragraph of text that we'll use for our typography storybook page.
|
|
34
|
+
</p>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const meta: Meta = {
|
|
41
|
+
/* 👇 The title prop is optional.
|
|
42
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
43
|
+
* to learn how to generate automatic titles
|
|
44
|
+
*/
|
|
45
|
+
title: 'Typography',
|
|
46
|
+
component: Default,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default meta
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite'
|
|
2
|
+
|
|
3
|
+
export const Lists = (): React.JSX.Element => {
|
|
4
|
+
return (
|
|
5
|
+
<div style={{ marginBottom: '48px' }}>
|
|
6
|
+
<div style={{ maxWidth: '700px', margin: '2rem auto' }} className="prose">
|
|
7
|
+
<h1>Lists</h1>
|
|
8
|
+
<p>
|
|
9
|
+
This is a paragraph of text that we'll use for our typography storybook page. This is
|
|
10
|
+
a paragraph of text that we'll use for our typography storybook page. This is a
|
|
11
|
+
paragraph of text that we'll use for our typography storybook page. This is a
|
|
12
|
+
paragraph of text that we'll use for our typography storybook page.
|
|
13
|
+
</p>
|
|
14
|
+
<ol>
|
|
15
|
+
<li>One - item in a list here</li>
|
|
16
|
+
<li>Two - item in a list here</li>
|
|
17
|
+
<li>Three - item in a list here</li>
|
|
18
|
+
<li>Four - item in a list here</li>
|
|
19
|
+
<li>Five - item in a list here</li>
|
|
20
|
+
</ol>
|
|
21
|
+
<p>
|
|
22
|
+
This is a paragraph of text that we'll use for our typography storybook page. This is
|
|
23
|
+
a paragraph of text that we'll use for our typography storybook page. This is a
|
|
24
|
+
paragraph of text that we'll use for our typography storybook page. This is a
|
|
25
|
+
paragraph of text that we'll use for our typography storybook page.
|
|
26
|
+
</p>
|
|
27
|
+
<ul>
|
|
28
|
+
<li>Item - item in a list here</li>
|
|
29
|
+
<li>Item - item in a list here</li>
|
|
30
|
+
<li>Item - item in a list here</li>
|
|
31
|
+
<li>Item - item in a list here</li>
|
|
32
|
+
<li>Item - item in a list here</li>
|
|
33
|
+
</ul>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const meta: Meta = {
|
|
40
|
+
/* 👇 The title prop is optional.
|
|
41
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
42
|
+
* to learn how to generate automatic titles
|
|
43
|
+
*/
|
|
44
|
+
title: 'Typography',
|
|
45
|
+
component: Lists,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default meta
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite'
|
|
2
|
+
|
|
3
|
+
export const Quote = (): React.JSX.Element => {
|
|
4
|
+
return (
|
|
5
|
+
<div style={{ marginBottom: '48px' }}>
|
|
6
|
+
<div style={{ maxWidth: '700px', margin: '2rem auto' }} className="prose">
|
|
7
|
+
<h1>Heading 1</h1>
|
|
8
|
+
<p>
|
|
9
|
+
This is a paragraph of text that we'll use for our typography storybook page. This is
|
|
10
|
+
a paragraph of text that we'll use for our typography storybook page. This is a
|
|
11
|
+
paragraph of text that we'll use for our typography storybook page. This is a
|
|
12
|
+
paragraph of text that we'll use for our typography storybook page.
|
|
13
|
+
</p>
|
|
14
|
+
<blockquote>
|
|
15
|
+
This is some text inside a blockquote. We'll make this a little longer to see how it
|
|
16
|
+
looks when it wraps.
|
|
17
|
+
</blockquote>
|
|
18
|
+
<p>
|
|
19
|
+
This is a paragraph of text that we'll use for our typography storybook page. This is
|
|
20
|
+
a paragraph of text that we'll use for our typography storybook page. This is a
|
|
21
|
+
paragraph of text that we'll use for our typography storybook page. This is a
|
|
22
|
+
paragraph of text that we'll use for our typography storybook page.
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const meta: Meta = {
|
|
30
|
+
/* 👇 The title prop is optional.
|
|
31
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
32
|
+
* to learn how to generate automatic titles
|
|
33
|
+
*/
|
|
34
|
+
title: 'Typography',
|
|
35
|
+
component: Quote,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default meta
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DatePicker } from './datepicker.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Widgets/DatePicker',
|
|
5
|
+
component: DatePicker,
|
|
6
|
+
argTypes: {},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Default = (): React.JSX.Element => {
|
|
10
|
+
const handleDateChange = (value: Date | null): void => {
|
|
11
|
+
console.log('Selected date:', value)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div style={{ maxWidth: '270px', margin: '2rem auto' }}>
|
|
16
|
+
<div style={{ display: 'flex', flexDirection: 'column', marginBottom: '1.5rem' }}>
|
|
17
|
+
<span>Date and Time</span>
|
|
18
|
+
<DatePicker
|
|
19
|
+
onDateChange={handleDateChange}
|
|
20
|
+
id="published_on"
|
|
21
|
+
name="published_on"
|
|
22
|
+
yearsInPast={70}
|
|
23
|
+
variant="outlined"
|
|
24
|
+
helpText="Select published on date."
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div style={{ display: 'flex', flexDirection: 'column', marginBottom: '1.5rem' }}>
|
|
29
|
+
<span>Date</span>
|
|
30
|
+
<DatePicker
|
|
31
|
+
onDateChange={handleDateChange}
|
|
32
|
+
mode="date"
|
|
33
|
+
id="published_on"
|
|
34
|
+
name="published_on"
|
|
35
|
+
variant="outlined"
|
|
36
|
+
yearsInPast={70}
|
|
37
|
+
helpText="Select published on date."
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { Button } from '../../components/button/button.js'
|
|
4
|
+
import { IconButton } from '../../components/button/icon-button.js'
|
|
5
|
+
import { CloseIcon } from '../../icons/close-icon.js'
|
|
6
|
+
import { DatePicker } from '../datepicker/datepicker.js'
|
|
7
|
+
import { Drawer } from './drawer.js'
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Widgets/Drawer',
|
|
11
|
+
component: Drawer,
|
|
12
|
+
argTypes: {},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const Default = (): React.JSX.Element => {
|
|
16
|
+
const [isOpen, setIsOpen] = React.useState(false)
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<Button
|
|
21
|
+
onClick={() => {
|
|
22
|
+
setIsOpen(true)
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
Open Drawer
|
|
26
|
+
</Button>
|
|
27
|
+
<Drawer
|
|
28
|
+
id="first-drawer"
|
|
29
|
+
closeOnOverlayClick={true}
|
|
30
|
+
isOpen={isOpen}
|
|
31
|
+
onDismiss={() => setIsOpen(false)}
|
|
32
|
+
>
|
|
33
|
+
<Drawer.Container>
|
|
34
|
+
<Drawer.TopActions>
|
|
35
|
+
<button type="button" tabIndex={0} className="sr-only">
|
|
36
|
+
no action
|
|
37
|
+
</button>
|
|
38
|
+
<IconButton
|
|
39
|
+
aria-label="Close"
|
|
40
|
+
size="xs"
|
|
41
|
+
onClick={() => {
|
|
42
|
+
setIsOpen(false)
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<CloseIcon width="14px" height="14px" />
|
|
46
|
+
</IconButton>
|
|
47
|
+
</Drawer.TopActions>
|
|
48
|
+
<Drawer.Header
|
|
49
|
+
style={{
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
justifyContent: 'space-between',
|
|
53
|
+
marginBottom: '1rem',
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<h2>Drawer Actions Here</h2>
|
|
57
|
+
</Drawer.Header>
|
|
58
|
+
<Drawer.Content>
|
|
59
|
+
<p>Drawer content here...</p>
|
|
60
|
+
</Drawer.Content>
|
|
61
|
+
</Drawer.Container>
|
|
62
|
+
</Drawer>
|
|
63
|
+
</>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const TopOffset = (): React.JSX.Element => {
|
|
68
|
+
const [isOpen, setIsOpen] = React.useState(false)
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<Button
|
|
73
|
+
onClick={() => {
|
|
74
|
+
setIsOpen(true)
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
Open Drawer
|
|
78
|
+
</Button>
|
|
79
|
+
<Drawer
|
|
80
|
+
id="top-offset-drawer"
|
|
81
|
+
topOffset="60px"
|
|
82
|
+
closeOnOverlayClick={false}
|
|
83
|
+
isOpen={isOpen}
|
|
84
|
+
onDismiss={() => setIsOpen(false)}
|
|
85
|
+
>
|
|
86
|
+
<Drawer.Container>
|
|
87
|
+
<Drawer.TopActions>
|
|
88
|
+
<button type="button" tabIndex={0} className="sr-only">
|
|
89
|
+
no action
|
|
90
|
+
</button>
|
|
91
|
+
<IconButton
|
|
92
|
+
aria-label="Close"
|
|
93
|
+
size="xs"
|
|
94
|
+
onClick={() => {
|
|
95
|
+
setIsOpen(false)
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
<CloseIcon width="14px" height="14px" />
|
|
99
|
+
</IconButton>
|
|
100
|
+
</Drawer.TopActions>
|
|
101
|
+
<Drawer.Header
|
|
102
|
+
style={{
|
|
103
|
+
display: 'flex',
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
justifyContent: 'space-between',
|
|
106
|
+
marginBottom: '1rem',
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<h2>Drawer Actions Here</h2>
|
|
110
|
+
</Drawer.Header>
|
|
111
|
+
<Drawer.Content>
|
|
112
|
+
<p>Drawer content here...</p>
|
|
113
|
+
</Drawer.Content>
|
|
114
|
+
</Drawer.Container>
|
|
115
|
+
</Drawer>
|
|
116
|
+
</>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const Wide = (): React.JSX.Element => {
|
|
121
|
+
const [isOpen, setIsOpen] = React.useState(false)
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
<Button
|
|
126
|
+
onClick={() => {
|
|
127
|
+
setIsOpen(true)
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
Open Drawer
|
|
131
|
+
</Button>
|
|
132
|
+
<Drawer
|
|
133
|
+
id="first-drawer"
|
|
134
|
+
closeOnOverlayClick={false}
|
|
135
|
+
isOpen={isOpen}
|
|
136
|
+
width="wide"
|
|
137
|
+
onDismiss={() => setIsOpen(false)}
|
|
138
|
+
>
|
|
139
|
+
<Drawer.Container>
|
|
140
|
+
<Drawer.TopActions>
|
|
141
|
+
<button type="button" tabIndex={0} className="sr-only">
|
|
142
|
+
no action
|
|
143
|
+
</button>
|
|
144
|
+
<IconButton
|
|
145
|
+
aria-label="Close"
|
|
146
|
+
size="xs"
|
|
147
|
+
onClick={() => {
|
|
148
|
+
setIsOpen(false)
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
<CloseIcon width="14px" height="14px" svgClassName="white-icon" />
|
|
152
|
+
</IconButton>
|
|
153
|
+
</Drawer.TopActions>
|
|
154
|
+
<Drawer.Header
|
|
155
|
+
style={{
|
|
156
|
+
display: 'flex',
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
justifyContent: 'space-between',
|
|
159
|
+
marginBottom: '1rem',
|
|
160
|
+
}}
|
|
161
|
+
>
|
|
162
|
+
<h2>Drawer Actions Here</h2>
|
|
163
|
+
</Drawer.Header>
|
|
164
|
+
<Drawer.Content>
|
|
165
|
+
<p>Drawer content here...</p>
|
|
166
|
+
<div style={{ maxWidth: '300px', marginTop: '20px', margin: '0 auto' }}>
|
|
167
|
+
<DatePicker
|
|
168
|
+
id="datepicker-1"
|
|
169
|
+
name="datepicker-1"
|
|
170
|
+
label="Select Date"
|
|
171
|
+
required
|
|
172
|
+
initialValue={new Date()}
|
|
173
|
+
onDateChange={(date) => {
|
|
174
|
+
console.log('Selected date:', date)
|
|
175
|
+
}}
|
|
176
|
+
/>
|
|
177
|
+
</div>
|
|
178
|
+
</Drawer.Content>
|
|
179
|
+
</Drawer.Container>
|
|
180
|
+
</Drawer>
|
|
181
|
+
</>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export const Nested = (): React.JSX.Element => {
|
|
186
|
+
const [isOpen1, setIsOpen1] = React.useState(false)
|
|
187
|
+
const [isOpen2, setIsOpen2] = React.useState(false)
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<>
|
|
191
|
+
<Button
|
|
192
|
+
onClick={() => {
|
|
193
|
+
setIsOpen1(true)
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
Open Drawer 1
|
|
197
|
+
</Button>
|
|
198
|
+
<Drawer
|
|
199
|
+
id="first-drawer"
|
|
200
|
+
width="medium"
|
|
201
|
+
closeOnOverlayClick={true}
|
|
202
|
+
isOpen={isOpen1}
|
|
203
|
+
onDismiss={() => setIsOpen1(false)}
|
|
204
|
+
>
|
|
205
|
+
<Drawer.Container>
|
|
206
|
+
<Drawer.TopActions>
|
|
207
|
+
<button type="button" tabIndex={0} className="sr-only">
|
|
208
|
+
no action
|
|
209
|
+
</button>
|
|
210
|
+
<IconButton
|
|
211
|
+
aria-label="Close"
|
|
212
|
+
size="xs"
|
|
213
|
+
onClick={() => {
|
|
214
|
+
setIsOpen1(false)
|
|
215
|
+
}}
|
|
216
|
+
>
|
|
217
|
+
<CloseIcon width="14px" height="14px" svgClassName="white-icon" />
|
|
218
|
+
</IconButton>
|
|
219
|
+
</Drawer.TopActions>
|
|
220
|
+
<Drawer.Header
|
|
221
|
+
style={{
|
|
222
|
+
display: 'flex',
|
|
223
|
+
alignItems: 'center',
|
|
224
|
+
justifyContent: 'space-between',
|
|
225
|
+
marginBottom: '1rem',
|
|
226
|
+
}}
|
|
227
|
+
>
|
|
228
|
+
<h2>Drawer 1</h2>
|
|
229
|
+
</Drawer.Header>
|
|
230
|
+
<Drawer.Content>
|
|
231
|
+
<p>Drawer 1 actions here...</p>
|
|
232
|
+
<Button
|
|
233
|
+
onClick={() => {
|
|
234
|
+
setIsOpen2(true)
|
|
235
|
+
}}
|
|
236
|
+
>
|
|
237
|
+
Open Drawer 2
|
|
238
|
+
</Button>
|
|
239
|
+
<Drawer
|
|
240
|
+
id="second-drawer"
|
|
241
|
+
width="medium"
|
|
242
|
+
closeOnOverlayClick={true}
|
|
243
|
+
isOpen={isOpen2}
|
|
244
|
+
onDismiss={() => setIsOpen2(false)}
|
|
245
|
+
>
|
|
246
|
+
<Drawer.Container>
|
|
247
|
+
<Drawer.TopActions>
|
|
248
|
+
<button type="button" tabIndex={0} className="sr-only">
|
|
249
|
+
no action
|
|
250
|
+
</button>
|
|
251
|
+
<IconButton
|
|
252
|
+
aria-label="Close"
|
|
253
|
+
size="xs"
|
|
254
|
+
onClick={() => {
|
|
255
|
+
setIsOpen2(false)
|
|
256
|
+
}}
|
|
257
|
+
>
|
|
258
|
+
<CloseIcon width="14px" height="14px" svgClassName="white-icon" />
|
|
259
|
+
</IconButton>
|
|
260
|
+
</Drawer.TopActions>
|
|
261
|
+
<Drawer.Header
|
|
262
|
+
style={{
|
|
263
|
+
display: 'flex',
|
|
264
|
+
alignItems: 'center',
|
|
265
|
+
justifyContent: 'space-between',
|
|
266
|
+
marginBottom: '1rem',
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
<h2>Drawer 2</h2>
|
|
270
|
+
</Drawer.Header>
|
|
271
|
+
<Drawer.Content>
|
|
272
|
+
<p>Drawer content here...</p>
|
|
273
|
+
</Drawer.Content>
|
|
274
|
+
</Drawer.Container>
|
|
275
|
+
</Drawer>
|
|
276
|
+
</Drawer.Content>
|
|
277
|
+
</Drawer.Container>
|
|
278
|
+
</Drawer>
|
|
279
|
+
</>
|
|
280
|
+
)
|
|
281
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// biome-ignore lint/style/useImportType: <explanation>
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { Button } from '../../components/button/button.js'
|
|
5
|
+
import { IconButton } from '../../components/button/icon-button.js'
|
|
6
|
+
import { CloseIcon } from '../../icons/close-icon.js'
|
|
7
|
+
import { Modal, useModal } from './modal.js'
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Widgets/Modal',
|
|
11
|
+
component: Modal,
|
|
12
|
+
argTypes: {},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const Default = (): React.JSX.Element => {
|
|
16
|
+
const { onDismiss, onOpen, isOpen, setIsOpen } = useModal()
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div style={{ margin: '2rem 0' }}>
|
|
20
|
+
<Button
|
|
21
|
+
onClick={() => {
|
|
22
|
+
setIsOpen(true)
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
Open Modal
|
|
26
|
+
</Button>
|
|
27
|
+
<Modal isOpen={isOpen} onDismiss={onDismiss} closeOnOverlayClick={true}>
|
|
28
|
+
<Modal.Container style={{ maxWidth: '600px' }}>
|
|
29
|
+
<Modal.Header>
|
|
30
|
+
<h3>Modal Header</h3>
|
|
31
|
+
<IconButton
|
|
32
|
+
aria-label="Close"
|
|
33
|
+
size="xs"
|
|
34
|
+
onClick={() => {
|
|
35
|
+
setIsOpen(false)
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<CloseIcon width="16px" height="16px" svgClassName="white-icon" />
|
|
39
|
+
</IconButton>
|
|
40
|
+
</Modal.Header>
|
|
41
|
+
<Modal.Content>
|
|
42
|
+
<p style={{ paddingTop: '1rem' }}>
|
|
43
|
+
Modal content with some text here that should run a little longer. And longer here.
|
|
44
|
+
And the current theme is.
|
|
45
|
+
</p>
|
|
46
|
+
</Modal.Content>
|
|
47
|
+
<Modal.Actions>
|
|
48
|
+
<Button
|
|
49
|
+
size="sm"
|
|
50
|
+
intent="noeffect"
|
|
51
|
+
onClick={() => {
|
|
52
|
+
setIsOpen(false)
|
|
53
|
+
}}
|
|
54
|
+
data-autofocus
|
|
55
|
+
>
|
|
56
|
+
Close
|
|
57
|
+
</Button>
|
|
58
|
+
</Modal.Actions>
|
|
59
|
+
</Modal.Container>
|
|
60
|
+
</Modal>
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// biome-ignore lint/style/useImportType: <explanation>
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { Search } from './search.js'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Widgets/Search',
|
|
8
|
+
component: Search,
|
|
9
|
+
argTypes: {},
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Default = (): React.JSX.Element => {
|
|
13
|
+
return (
|
|
14
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
15
|
+
<Search variant="underlined" />
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
}
|