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.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.html.erb +13 -0
  3. data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.jsx +31 -12
  4. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.jsx +1 -5
  5. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.jsx +46 -0
  6. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
  7. data/app/pb_kits/playbook/pb_dialog/docs/index.js +1 -0
  8. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
  9. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -2
  10. data/app/pb_kits/playbook/pb_gantt_chart/docs/_gantt_chart_default.jsx +53 -0
  11. data/app/pb_kits/playbook/pb_gantt_chart/docs/example.yml +7 -0
  12. data/app/pb_kits/playbook/pb_gantt_chart/docs/index.js +1 -0
  13. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +19 -0
  14. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +1 -0
  15. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +62 -0
  16. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +1 -0
  17. data/app/pb_kits/playbook/pb_pagination/docs/data.js +23 -0
  18. data/app/pb_kits/playbook/pb_pagination/docs/example.yml +3 -1
  19. data/app/pb_kits/playbook/pb_pagination/docs/index.js +2 -0
  20. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_preview.jsx +73 -0
  21. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +1 -0
  22. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +2 -1
  23. data/dist/playbook-doc.js +1 -1
  24. metadata +17 -6
  25. /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: 406bc46bed7380d01b7a176998c6deac3b1455ded6c4fe6b60849239ad760d5b
4
- data.tar.gz: 3a664e6180357a7bed7dd9553b1fe2077f8b22da5645db510c9a8ec65973be07
3
+ metadata.gz: e020975eafc0c444c0044b72f095c8566896b6d2ae1a08a4ab2c244b52b06cf0
4
+ data.tar.gz: bc1bbcefe9ad0e6e45752f7a4de09c6b8a74756efd71acde3f69266cb8f719e4
5
5
  SHA512:
6
- metadata.gz: 963dd340fe50002142c443330a55c382c2f59b410a652c0c5b6f48149b17751c5b6bee93d661c7ee5da61949d0a6b7fbef62d6c8be2b190c5b5d5d1a2e7f1946
7
- data.tar.gz: 21baf141c6ae19e4c606713cfefdf324aed74d4852fc48ecff41af2b405544afb3c83750c82e97f73278a844c0bdf337cfbbed9895e1ae597c41678c2a287ab3
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
- <Badge
8
- rounded
9
- text="1"
10
- variant="notification"
11
- {...props}
12
- />
7
+ <div>
8
+ <Badge
9
+ rounded
10
+ text="1"
11
+ variant="notification"
12
+ {...props}
13
+ />
13
14
 
14
- &nbsp;
15
+ &nbsp;
15
16
 
16
- <Badge
17
- text="4"
18
- variant="notification"
19
- {...props}
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
+ &nbsp;
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={() => setIsLoading(!isLoading)}
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
@@ -22,6 +22,7 @@ examples:
22
22
  - dialog_stacked_alert: Stacked Button Alert
23
23
  - dialog_full_height: Full Height
24
24
  - dialog_full_height_placement: Full Height Placement
25
+ - dialog_loading: Loading
25
26
 
26
27
  swift:
27
28
  - dialog_default_swift: Simple
@@ -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
- # - form_pill_icon: Form Pill Icon
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
- # - form_pill_icon: Form Pill Icon
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,7 @@
1
+ examples:
2
+
3
+
4
+ react:
5
+ - gantt_chart_default: Default
6
+
7
+
@@ -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
+
@@ -3,4 +3,6 @@ examples:
3
3
  rails:
4
4
  - pagination_default: Default
5
5
 
6
-
6
+ react:
7
+ - pagination_default: Default
8
+ - pagination_page_change: Page Change
@@ -0,0 +1,2 @@
1
+ export { default as PaginationDefault } from './_pagination_default.jsx'
2
+ export { default as PaginationPageChange } from './_pagination_page_change.jsx'
@@ -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
@@ -24,3 +24,4 @@ examples:
24
24
  - rich_text_editor_toolbar_bottom: Toolbar Bottom
25
25
  - rich_text_editor_inline: Inline
26
26
  - rich_text_editor_preview: Preview
27
+ - rich_text_editor_advanced_preview: Advanced Preview
@@ -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'