playbook_ui_docs 14.1.0 → 14.2.0.pre.alpha.PLAY15063618
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.html.erb +13 -0
- data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.jsx +31 -12
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.jsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.jsx +46 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_gantt_chart/docs/_gantt_chart_default.jsx +53 -0
- data/app/pb_kits/playbook/pb_gantt_chart/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_gantt_chart/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +19 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +62 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/data.js +23 -0
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_preview.jsx +73 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +2 -1
- data/dist/playbook-doc.js +1 -1
- metadata +17 -6
- /data/app/pb_kits/playbook/pb_pagination/docs/{_pagination_default.md → _pagination_default_rails.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e020975eafc0c444c0044b72f095c8566896b6d2ae1a08a4ab2c244b52b06cf0
|
4
|
+
data.tar.gz: bc1bbcefe9ad0e6e45752f7a4de09c6b8a74756efd71acde3f69266cb8f719e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ae26f9a0a421ba0484564a9029855b9fb81ad431a0339d99641860f76c0a0af15af66ff856641bd7d226e7e512d7acf7f4d9f06521073d244d0e26d778838c0
|
7
|
+
data.tar.gz: d5546df827dc9c12696859d1178004a84ada7006e2a81822f9181b65acfd3bb9bd7b52d08df7d9803261564b5c5f5f58c55eb0c2f2b17f01eb5d0048ac0d7ad1
|
@@ -10,3 +10,16 @@
|
|
10
10
|
variant: "notification"
|
11
11
|
}) %>
|
12
12
|
</div>
|
13
|
+
|
14
|
+
<div>
|
15
|
+
<%= pb_rails("badge", props: {
|
16
|
+
text: "1",
|
17
|
+
variant: "notification_error",
|
18
|
+
rounded: true
|
19
|
+
}) %>
|
20
|
+
|
21
|
+
<%= pb_rails("badge", props: {
|
22
|
+
text: "4",
|
23
|
+
variant: "notification_error"
|
24
|
+
}) %>
|
25
|
+
</div>
|
@@ -4,20 +4,39 @@ import Badge from '../_badge'
|
|
4
4
|
const BadgeNotification = (props) => {
|
5
5
|
return (
|
6
6
|
<>
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
<div>
|
8
|
+
<Badge
|
9
|
+
rounded
|
10
|
+
text="1"
|
11
|
+
variant="notification"
|
12
|
+
{...props}
|
13
|
+
/>
|
13
14
|
|
14
|
-
|
15
|
+
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
<Badge
|
18
|
+
text="4"
|
19
|
+
variant="notification"
|
20
|
+
{...props}
|
21
|
+
/>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div>
|
25
|
+
<Badge
|
26
|
+
rounded
|
27
|
+
text="1"
|
28
|
+
variant="notificationError"
|
29
|
+
{...props}
|
30
|
+
/>
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
<Badge
|
35
|
+
text="4"
|
36
|
+
variant="notificationError"
|
37
|
+
{...props}
|
38
|
+
/>
|
39
|
+
</div>
|
21
40
|
</>
|
22
41
|
)
|
23
42
|
}
|
@@ -5,21 +5,17 @@ const DialogDefault = () => {
|
|
5
5
|
const [isOpen, setIsOpen] = useState(false)
|
6
6
|
const close = () => setIsOpen(false)
|
7
7
|
const open = () => setIsOpen(true)
|
8
|
-
const [isLoading, setIsLoading] = useState(false)
|
9
8
|
|
10
9
|
return (
|
11
10
|
<>
|
12
11
|
<Button onClick={open}>{'Open Dialog'}</Button>
|
13
12
|
<Dialog
|
14
13
|
cancelButton="Cancel Button"
|
15
|
-
className="wrapper"
|
16
14
|
confirmButton="Okay"
|
17
|
-
loading={isLoading}
|
18
15
|
onCancel={close}
|
19
16
|
onClose={close}
|
20
|
-
onConfirm={
|
17
|
+
onConfirm={close}
|
21
18
|
opened={isOpen}
|
22
|
-
portalClassName="portal"
|
23
19
|
size="sm"
|
24
20
|
text="Hello Body Text, Nice to meet ya."
|
25
21
|
title="Header Title is the Title Prop"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Button, Dialog } from 'playbook-ui'
|
3
|
+
|
4
|
+
const DialogLoading = () => {
|
5
|
+
const [isOpen, setIsOpen] = useState(false)
|
6
|
+
const close = () => {
|
7
|
+
if (!isLoading) {
|
8
|
+
setIsOpen(false)
|
9
|
+
}
|
10
|
+
}
|
11
|
+
const open = () => setIsOpen(true)
|
12
|
+
const [isLoading, setIsLoading] = useState(false)
|
13
|
+
const submit = async () => {
|
14
|
+
setIsLoading(true)
|
15
|
+
|
16
|
+
try {
|
17
|
+
await new Promise((r) => setTimeout(r, 3000))
|
18
|
+
setIsOpen(false)
|
19
|
+
} catch (error) {
|
20
|
+
console.error("An error occurred.")
|
21
|
+
} finally {
|
22
|
+
setIsLoading(false)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
return (
|
27
|
+
<>
|
28
|
+
<Button onClick={open}>{'Open Dialog'}</Button>
|
29
|
+
<Dialog
|
30
|
+
cancelButton="Cancel"
|
31
|
+
className="wrapper"
|
32
|
+
confirmButton="Okay"
|
33
|
+
loading={isLoading}
|
34
|
+
onCancel={close}
|
35
|
+
onClose={close}
|
36
|
+
onConfirm={submit}
|
37
|
+
opened={isOpen}
|
38
|
+
size="sm"
|
39
|
+
text="Make a 3 second request?"
|
40
|
+
title="Loading Example"
|
41
|
+
/>
|
42
|
+
</>
|
43
|
+
)
|
44
|
+
}
|
45
|
+
|
46
|
+
export default DialogLoading
|
@@ -8,3 +8,4 @@ export { default as DialogStatus } from './_dialog_status.jsx'
|
|
8
8
|
export { default as DialogStackedAlert } from './_dialog_stacked_alert.jsx'
|
9
9
|
export { default as DialogFullHeight } from './_dialog_full_height.jsx'
|
10
10
|
export { default as DialogFullHeightPlacement } from './_dialog_full_height_placement.jsx'
|
11
|
+
export { default as DialogLoading } from './_dialog_loading.jsx'
|
@@ -35,6 +35,7 @@
|
|
35
35
|
<%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
|
36
36
|
<%= form.check_box :example_checkbox, props: { text: "Example Checkbox", label: true, required: true } %>
|
37
37
|
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true } %>
|
38
|
+
<%= form.star_rating_field :example_star_rating, props: { variant: "interactive", label: true, required: true } %>
|
38
39
|
|
39
40
|
<%= form.actions do |action| %>
|
40
41
|
<%= action.submit %>
|
@@ -5,11 +5,11 @@ examples:
|
|
5
5
|
- form_pill_size: Form Pill Size
|
6
6
|
- form_pill_tag: Form Pill Tag
|
7
7
|
- form_pill_example: Example
|
8
|
-
|
8
|
+
- form_pill_icon: Form Pill Icon
|
9
9
|
|
10
10
|
react:
|
11
11
|
- form_pill_user: Form Pill User
|
12
12
|
- form_pill_size: Form Pill Size
|
13
13
|
- form_pill_tag: Form Pill Tag
|
14
14
|
- form_pill_example: Example
|
15
|
-
|
15
|
+
- form_pill_icon: Form Pill Icon
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { GanttChart } from "playbook-ui";
|
3
|
+
|
4
|
+
const mockOptions = {
|
5
|
+
title: {
|
6
|
+
text: "Simple Gantt Chart",
|
7
|
+
},
|
8
|
+
|
9
|
+
xAxis: [
|
10
|
+
{
|
11
|
+
min: Date.UTC(2014, 10, 17),
|
12
|
+
max: Date.UTC(2014, 10, 30),
|
13
|
+
},
|
14
|
+
],
|
15
|
+
|
16
|
+
series: [
|
17
|
+
{
|
18
|
+
name: "Project 1",
|
19
|
+
data: [
|
20
|
+
{
|
21
|
+
name: "Start prototype",
|
22
|
+
start: Date.UTC(2014, 10, 18),
|
23
|
+
end: Date.UTC(2014, 10, 25),
|
24
|
+
},
|
25
|
+
{
|
26
|
+
name: "Develop",
|
27
|
+
start: Date.UTC(2014, 10, 20),
|
28
|
+
end: Date.UTC(2014, 10, 25),
|
29
|
+
},
|
30
|
+
{
|
31
|
+
name: "Run acceptance tests",
|
32
|
+
start: Date.UTC(2014, 10, 23),
|
33
|
+
end: Date.UTC(2014, 10, 26),
|
34
|
+
},
|
35
|
+
{
|
36
|
+
name: "Test prototype",
|
37
|
+
start: Date.UTC(2014, 10, 27),
|
38
|
+
end: Date.UTC(2014, 10, 29),
|
39
|
+
},
|
40
|
+
],
|
41
|
+
},
|
42
|
+
],
|
43
|
+
};
|
44
|
+
|
45
|
+
const GanttChartDefault = (props) => (
|
46
|
+
<div>
|
47
|
+
<GanttChart customOptions={mockOptions}
|
48
|
+
{...props}
|
49
|
+
/>
|
50
|
+
</div>
|
51
|
+
);
|
52
|
+
|
53
|
+
export default GanttChartDefault;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as GanttChartDefault } from './_gantt_chart_default.jsx'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Pagination from '../_pagination'
|
4
|
+
|
5
|
+
const PaginationDefault = (props) => {
|
6
|
+
|
7
|
+
return (
|
8
|
+
<>
|
9
|
+
<Pagination
|
10
|
+
current={1}
|
11
|
+
range={5}
|
12
|
+
total={10}
|
13
|
+
{...props}
|
14
|
+
/>
|
15
|
+
</>
|
16
|
+
)
|
17
|
+
}
|
18
|
+
|
19
|
+
export default PaginationDefault
|
@@ -0,0 +1 @@
|
|
1
|
+
The `range` prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the `range` prop.
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Table, Pagination } from 'playbook-ui'
|
3
|
+
|
4
|
+
|
5
|
+
import { data } from "./data";
|
6
|
+
|
7
|
+
const PaginationPageChange = (props) => {
|
8
|
+
|
9
|
+
const [activePage, setActivePage] = useState(1);
|
10
|
+
const rowsPerPage = 3;
|
11
|
+
const totalPages = Math.ceil(data.length / rowsPerPage);
|
12
|
+
|
13
|
+
const onPageChange = (pageNumber) => {
|
14
|
+
setActivePage(pageNumber);
|
15
|
+
};
|
16
|
+
|
17
|
+
const currentData = data.slice(
|
18
|
+
(activePage - 1) * rowsPerPage,
|
19
|
+
activePage * rowsPerPage
|
20
|
+
);
|
21
|
+
|
22
|
+
|
23
|
+
return (
|
24
|
+
<div className="App">
|
25
|
+
<Table
|
26
|
+
marginBottom="xs"
|
27
|
+
responsive="none"
|
28
|
+
size="sm"
|
29
|
+
{...props}
|
30
|
+
>
|
31
|
+
<Table.Head>
|
32
|
+
<Table.Row>
|
33
|
+
<Table.Header>{"Column 1"}</Table.Header>
|
34
|
+
<Table.Header>{"Column 2"}</Table.Header>
|
35
|
+
<Table.Header>{"Column 3"}</Table.Header>
|
36
|
+
<Table.Header>{"Column 4"}</Table.Header>
|
37
|
+
<Table.Header>{"Column 5"}</Table.Header>
|
38
|
+
</Table.Row>
|
39
|
+
</Table.Head>
|
40
|
+
<Table.Body>
|
41
|
+
{currentData.map((row, index) => (
|
42
|
+
<Table.Row key={index}>
|
43
|
+
{row.map((cell, cellIndex) => (
|
44
|
+
<Table.Cell key={cellIndex}>{cell}</Table.Cell>
|
45
|
+
))}
|
46
|
+
</Table.Row>
|
47
|
+
))}
|
48
|
+
</Table.Body>
|
49
|
+
</Table>
|
50
|
+
|
51
|
+
<Pagination
|
52
|
+
current={1}
|
53
|
+
onChange={onPageChange}
|
54
|
+
range={5}
|
55
|
+
total={totalPages}
|
56
|
+
{...props}
|
57
|
+
/>
|
58
|
+
</div>
|
59
|
+
)
|
60
|
+
}
|
61
|
+
|
62
|
+
export default PaginationPageChange
|
@@ -0,0 +1 @@
|
|
1
|
+
You can use the `onChange` prop to control the data of your table. This prop is callback function that will allow you control the state.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
export const data = [
|
2
|
+
["Value 1", "Value 2", "Value 3", "Value 4", "Value 5"],
|
3
|
+
["Value 6", "Value 7", "Value 8", "Value 9", "Value 10"],
|
4
|
+
["Value 11", "Value 12", "Value 13", "Value 14", "Value 15"],
|
5
|
+
["Value 16", "Value 17", "Value 18", "Value 19", "Value 20"],
|
6
|
+
["Value 21", "Value 22", "Value 23", "Value 24", "Value 25"],
|
7
|
+
["Value 26", "Value 27", "Value 28", "Value 29", "Value 30"],
|
8
|
+
["Value 31", "Value 32", "Value 33", "Value 34", "Value 35"],
|
9
|
+
["Value 36", "Value 37", "Value 38", "Value 39", "Value 40"],
|
10
|
+
["Value 41", "Value 42", "Value 43", "Value 44", "Value 45"],
|
11
|
+
["Value 46", "Value 47", "Value 48", "Value 49", "Value 50"],
|
12
|
+
["Value 51", "Value 52", "Value 53", "Value 54", "Value 55"],
|
13
|
+
["Value 56", "Value 57", "Value 58", "Value 59", "Value 60"],
|
14
|
+
["Value 61", "Value 62", "Value 63", "Value 64", "Value 65"],
|
15
|
+
["Value 66", "Value 67", "Value 68", "Value 69", "Value 70"],
|
16
|
+
["Value 71", "Value 72", "Value 73", "Value 74", "Value 75"],
|
17
|
+
["Value 76", "Value 77", "Value 78", "Value 79", "Value 80"],
|
18
|
+
["Value 81", "Value 82", "Value 83", "Value 84", "Value 85"],
|
19
|
+
["Value 86", "Value 87", "Value 88", "Value 89", "Value 90"],
|
20
|
+
["Value 91", "Value 92", "Value 93", "Value 94", "Value 95"],
|
21
|
+
["Value 96", "Value 97", "Value 98", "Value 99", "Value 100"],
|
22
|
+
];
|
23
|
+
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Button, Card, RichTextEditor } from 'playbook-ui'
|
3
|
+
import { useEditor, EditorContent } from "@tiptap/react"
|
4
|
+
import StarterKit from "@tiptap/starter-kit"
|
5
|
+
import Link from '@tiptap/extension-link'
|
6
|
+
|
7
|
+
|
8
|
+
const RichTextEditorAdvancedPreview = (props) => {
|
9
|
+
|
10
|
+
const editor = useEditor({
|
11
|
+
extensions: [
|
12
|
+
StarterKit,
|
13
|
+
Link
|
14
|
+
],
|
15
|
+
content: "Add text here, format it, and press \"Preview Output\" to see what your stylized output will look like on the page."
|
16
|
+
})
|
17
|
+
|
18
|
+
const [showPreview, setShowPreview] = useState(false)
|
19
|
+
const [previewText, setPreviewText] = useState(<div />)
|
20
|
+
|
21
|
+
const handleChange = () => {
|
22
|
+
if (editor) {
|
23
|
+
setPreviewText(editor.getHTML())
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
const handleClick = () => {
|
28
|
+
handleChange()
|
29
|
+
setShowPreview(true)
|
30
|
+
}
|
31
|
+
if (!editor) {
|
32
|
+
return null
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
return (
|
37
|
+
<div>
|
38
|
+
<RichTextEditor
|
39
|
+
advancedEditor={editor}
|
40
|
+
id="content-advanced-preview-editor"
|
41
|
+
onChange={handleChange}
|
42
|
+
{...props}
|
43
|
+
>
|
44
|
+
<EditorContent editor={editor}/>
|
45
|
+
</RichTextEditor>
|
46
|
+
{showPreview && (
|
47
|
+
<Card
|
48
|
+
marginTop="md"
|
49
|
+
maxWidth="md"
|
50
|
+
>
|
51
|
+
<div
|
52
|
+
className="tiptap-content"
|
53
|
+
// eslint-disable-next-line react/no-danger
|
54
|
+
dangerouslySetInnerHTML={{ __html: previewText }}
|
55
|
+
id="advanced-preview-content"
|
56
|
+
/>
|
57
|
+
</Card>
|
58
|
+
)}
|
59
|
+
{!showPreview && (
|
60
|
+
<div />
|
61
|
+
)}
|
62
|
+
<Button
|
63
|
+
id="preview-button"
|
64
|
+
marginTop="md"
|
65
|
+
onClick={handleClick}
|
66
|
+
text="Preview Output"
|
67
|
+
variant="secondary"
|
68
|
+
/>
|
69
|
+
</div>
|
70
|
+
)
|
71
|
+
}
|
72
|
+
|
73
|
+
export default RichTextEditorAdvancedPreview
|
@@ -9,4 +9,5 @@ export { default as RichTextEditorInline } from './_rich_text_editor_inline.jsx'
|
|
9
9
|
export { default as RichTextEditorPreview } from './_rich_text_editor_preview.jsx'
|
10
10
|
export { default as RichTextEditorAdvancedDefault } from './_rich_text_editor_advanced_default.jsx'
|
11
11
|
export { default as RichTextEditorMoreExtensions } from './_rich_text_editor_more_extensions.jsx'
|
12
|
-
export { default as RichTextEditorToolbarDisabled } from './_rich_text_editor_toolbar_disabled.jsx'
|
12
|
+
export { default as RichTextEditorToolbarDisabled } from './_rich_text_editor_toolbar_disabled.jsx'
|
13
|
+
export { default as RichTextEditorAdvancedPreview } from './_rich_text_editor_advanced_preview.jsx'
|