playbook_ui_docs 14.1.0.pre.alpha.PA1477timestampkit3536 → 14.1.0.pre.alpha.PA1477timestampkit3601

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) 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/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.html.erb +2 -2
  24. data/dist/playbook-doc.js +1 -1
  25. metadata +14 -3
  26. /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: a9a56199c55751b0622186a61c0072d89817f864fecd9cf1181b13d2555c84bf
4
- data.tar.gz: c88fde11c878878b9b14e115b9fcbfcdb63bea5d5f2c296aa422b1aa09164221
3
+ metadata.gz: f4fffe3685bd39602858926aaabda9ad24f5aae62ae94e95c93e2ad64caa607e
4
+ data.tar.gz: 256e0c7c0eb8d622c5e62457c1a0f687a0970d542edcb2e27c418f0852e341bd
5
5
  SHA512:
6
- metadata.gz: feb420d2480a3dfe7acc94e307ac4f98c613fa20957af19d990dc40d770c46aadcac3799c9cb30000c05d21bae6c4253f619868150ef0fcab35a4f7c5eb6b348
7
- data.tar.gz: 98f2d9232423d8d2ff37a4607123f8caa31e7ae3b5d951707c100e48fc60defad52497a0e063de1ca0689be93f8d0796c40fbc4362d1e15f199ee5d071224ad4
6
+ metadata.gz: c16cc5610ee2b7eca6e606c4121562c6b38a947f431e03b83ba4c54c10c330b5503fd1418ab63e6311d2647c20b52f37eaa61a937fa115ca86f300bcb16cc0b0
7
+ data.tar.gz: 4ab33015f8e2d087f8ee6e2223c17a9a6658bcd4799e74ee7085943e4090357a75d483b02d55306705434c4ddaa5d0ce90eef9af5de594a639f29291d69bfa1d
@@ -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'
@@ -8,7 +8,7 @@
8
8
  <br>
9
9
 
10
10
  <%= pb_rails("timestamp", props: {
11
- timestamp: DateTime.now,
11
+ timestamp: DateTime.now - 3.months,
12
12
  variant: "elapsed",
13
13
  show_user: false
14
14
  }) %>
@@ -16,7 +16,7 @@
16
16
  <br>
17
17
 
18
18
  <%= pb_rails("timestamp", props: {
19
- timestamp: DateTime.now,
19
+ timestamp: DateTime.now - 320.days,
20
20
  variant: "elapsed",
21
21
  show_user: false,
22
22
  hide_updated: true