playbook_ui_docs 15.4.0 → 15.5.0.pre.rc.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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.html.erb +4 -0
  3. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.jsx +43 -0
  4. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.md +1 -0
  5. data/app/pb_kits/playbook/pb_date_range_inline/docs/_description.md +1 -1
  6. data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +3 -2
  7. data/app/pb_kits/playbook/pb_date_range_inline/docs/index.js +1 -0
  8. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_current_year.html.erb +12 -0
  9. data/app/pb_kits/playbook/pb_date_stacked/docs/{_date_stacked_not_current_year.jsx → _date_stacked_current_year.jsx} +6 -5
  10. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_current_year.md +1 -0
  11. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.html.erb +1 -1
  12. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.jsx +1 -1
  13. data/app/pb_kits/playbook/pb_date_stacked/docs/_description.md +1 -1
  14. data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +2 -2
  15. data/app/pb_kits/playbook/pb_date_stacked/docs/index.js +1 -1
  16. data/app/pb_kits/playbook/pb_flex/docs/_flex_item_example.jsx +1 -0
  17. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.html.erb +21 -0
  18. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.jsx +113 -0
  19. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.md +1 -0
  20. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.html.erb +30 -0
  21. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.jsx +117 -0
  22. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.md +1 -0
  23. data/app/pb_kits/playbook/pb_nav/docs/example.yml +4 -0
  24. data/app/pb_kits/playbook/pb_nav/docs/index.js +3 -1
  25. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default_rails.md +7 -0
  26. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +10 -2
  27. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline_rails.md +1 -0
  28. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +19 -11
  29. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +5 -1
  30. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +1 -1
  31. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky_rails.md +1 -0
  32. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -2
  33. data/dist/playbook-doc.js +1 -19
  34. metadata +17 -4
  35. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year.html.erb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 130f7dac8c44112c08c8028407b2678a4da68ef938375dbcedd7027809cac610
4
- data.tar.gz: 5dd483f36bc3d436b8bc35cdbfeb5ced060d1d82ac2d0602c5d2958df869e376
3
+ metadata.gz: 3251b709fdb1f49c81517f7ef6e60d3c8d83ce4da554b6f646e03ea94966d4fd
4
+ data.tar.gz: '070835678f96480adb51ec83b0b4bae26b07ff9760a57ca7be485955d6699d35'
5
5
  SHA512:
6
- metadata.gz: ad1f55066a19cd7a806afdc5a3ecaf45d49ad44c30ddca62bd95efa994c5793499a5ebd5a484d7e77bb100dd049314e84861a78eff8c48c9f22705a15dba2280
7
- data.tar.gz: 582c9b64f5163a5d1b72923debf7ac203d92f5caeb2351fdbf1ab24b8c6664117a30a4b423959deaf4d27ee12e726dee1cae66ab47f811d5f33a3fd3d83249d8
6
+ metadata.gz: b211e59843101d9837123ff1397be65a1e5c5f62716e1701685c5afb7f0a0ef56cd92dfeb0dc5bab369c90c05e6732f6b13ff2f3a8016b96d13d27878d351577
7
+ data.tar.gz: 1601b6e0bf78c791c880ef18e5dffd7d1c1140d009c54592c3311f38d8f2e64eae124075dd27116e456eb75471825895c58e1312ceaa98cb9479e60ffdbdd6d6
@@ -0,0 +1,4 @@
1
+ <%= pb_rails("date_range_inline", props: { start_date: Date.new(Date.current.year, 10, 31), end_date: Date.new(Date.current.year, 12, 7), size: "xs", show_current_year: true }) %>
2
+ <%= pb_rails("date_range_inline", props: { start_date: Date.new(Date.current.year, 10, 31), end_date: Date.new(Date.current.year, 12, 7), show_current_year: true }) %>
3
+ <%= pb_rails("date_range_inline", props: { start_date: Date.new(Date.current.year, 10, 31), end_date: Date.new(Date.current.year, 12, 7), align: "center", icon: true, size: "xs", show_current_year: true }) %>
4
+ <%= pb_rails("date_range_inline", props: { start_date: Date.new(Date.current.year, 10, 31), end_date: Date.new(Date.current.year, 12, 7), align: "center", icon: true, show_current_year: true }) %>
@@ -0,0 +1,43 @@
1
+ import React from 'react'
2
+ import DateRangeInline from '../_date_range_inline'
3
+
4
+ const DateRangeInlineShowCurrentYear = (props) => {
5
+ return (
6
+ <div>
7
+ <DateRangeInline
8
+ endDate={new Date(`7 Dec ${new Date().getFullYear()}`)}
9
+ showCurrentYear
10
+ size="xs"
11
+ startDate={new Date(`31 Oct ${new Date().getFullYear()}`)}
12
+ {...props}
13
+ />
14
+ <DateRangeInline
15
+ endDate={new Date(`7 Dec ${new Date().getFullYear()}`)}
16
+ showCurrentYear
17
+ size="sm"
18
+ startDate={new Date(`31 Oct ${new Date().getFullYear()}`)}
19
+ {...props}
20
+ />
21
+ <DateRangeInline
22
+ align="center"
23
+ endDate={new Date(`7 Dec ${new Date().getFullYear()}`)}
24
+ icon
25
+ showCurrentYear
26
+ size="xs"
27
+ startDate={new Date(`31 Oct ${new Date().getFullYear()}`)}
28
+ {...props}
29
+ />
30
+ <DateRangeInline
31
+ align="center"
32
+ endDate={new Date(`7 Dec ${new Date().getFullYear()}`)}
33
+ icon
34
+ showCurrentYear
35
+ size="sm"
36
+ startDate={new Date(`31 Oct ${new Date().getFullYear()}`)}
37
+ {...props}
38
+ />
39
+ </div>
40
+ )
41
+ }
42
+
43
+ export default DateRangeInlineShowCurrentYear
@@ -0,0 +1 @@
1
+ By default, the Date Range Inline kit does NOT display the year if it is the current year. If you want to display the current year you can do so by setting `showCurrentYear`/`show_current_year` to true as shown here.
@@ -1 +1 @@
1
- Use to display a date range. Year will not show if it is the current year.
1
+ Use to display a date range.
@@ -2,11 +2,12 @@ examples:
2
2
 
3
3
  rails:
4
4
  - date_range_inline_default: Default
5
-
5
+ - date_range_inline_show_current_year: Show Current Year
6
6
 
7
7
  react:
8
8
  - date_range_inline_default: Default
9
-
9
+ - date_range_inline_show_current_year: Show Current Year
10
+
10
11
  swift:
11
12
  - date_range_inline_default_swift: Default
12
13
  - date_range_inline_props_swift: ""
@@ -1 +1,2 @@
1
1
  export { default as DateRangeInlineDefault } from './_date_range_inline_default.jsx'
2
+ export { default as DateRangeInlineShowCurrentYear } from './_date_range_inline_show_current_year.jsx'
@@ -0,0 +1,12 @@
1
+ <%= pb_rails("date_stacked", props: {
2
+ date: DateTime.now,
3
+ show_current_year: true
4
+ }) %>
5
+
6
+ <br>
7
+
8
+ <%= pb_rails("date_stacked", props: {
9
+ date: DateTime.now,
10
+ show_current_year: true,
11
+ size: "md"
12
+ }) %>
@@ -1,12 +1,13 @@
1
1
  import React from 'react'
2
2
  import DateStacked from '../_date_stacked'
3
3
 
4
- const DateStackedNotCurrentYear = (props) => {
4
+ const DateStackedCurrentYear = (props) => {
5
5
  return (
6
6
  <div>
7
7
 
8
8
  <DateStacked
9
- date={new Date('20 Mar 2018')}
9
+ date={new Date()}
10
+ showCurrentYear
10
11
  size="sm"
11
12
  {...props}
12
13
  />
@@ -14,13 +15,13 @@ const DateStackedNotCurrentYear = (props) => {
14
15
  <br />
15
16
 
16
17
  <DateStacked
17
- date={new Date('20 Mar 2018')}
18
+ date={new Date()}
19
+ showCurrentYear
18
20
  size="md"
19
21
  {...props}
20
22
  />
21
-
22
23
  </div>
23
24
  )
24
25
  }
25
26
 
26
- export default DateStackedNotCurrentYear
27
+ export default DateStackedCurrentYear
@@ -0,0 +1 @@
1
+ By default, the Date Stacked kit does NOT display the year if it is the current year. If you want to display the current year you can do so by setting `showCurrentYear`/`show_current_year` to true as shown here.
@@ -2,4 +2,4 @@
2
2
 
3
3
  <br>
4
4
 
5
- <%= pb_rails("date_stacked", props: { date: DateTime.now, size: "md"}) %>
5
+ <%= pb_rails("date_stacked", props: { date: Date.new(2018, 03, 20), size: "md"}) %>
@@ -15,7 +15,7 @@ const DateStackedDefault = (props) => {
15
15
  <br />
16
16
 
17
17
  <DateStacked
18
- date={new Date()}
18
+ date={new Date('20 Mar 2018')}
19
19
  size="md"
20
20
  {...props}
21
21
  />
@@ -1 +1 @@
1
- Use to display the date, stacking month and day. Year will not show if it is the current year.
1
+ Use to display the date, stacking month and day.
@@ -2,7 +2,7 @@ examples:
2
2
 
3
3
  rails:
4
4
  - date_stacked_default: Default
5
- - date_stacked_not_current_year: Not Current Year
5
+ - date_stacked_current_year: Show Current Year
6
6
  - date_stacked_reverse: Day & Month Reverse
7
7
  - date_stacked_sizes: Sizes
8
8
  - date_stacked_align: Alignment
@@ -11,7 +11,7 @@ examples:
11
11
 
12
12
  react:
13
13
  - date_stacked_default: Default
14
- - date_stacked_not_current_year: Not Current Year
14
+ - date_stacked_current_year: Show Current Year
15
15
  - date_stacked_reverse: Day & Month Reverse
16
16
  - date_stacked_sizes: Sizes
17
17
  - date_stacked_bold: Bold
@@ -1,6 +1,6 @@
1
1
  export { default as DateStackedBold } from './_date_stacked_bold.jsx'
2
2
  export { default as DateStackedDefault } from './_date_stacked_default.jsx'
3
- export { default as DateStackedNotCurrentYear } from './_date_stacked_not_current_year.jsx'
3
+ export { default as DateStackedCurrentYear } from './_date_stacked_current_year.jsx'
4
4
  export { default as DateStackedReverse } from './_date_stacked_reverse.jsx'
5
5
  export { default as DateStackedSizes } from './_date_stacked_sizes.jsx'
6
6
  export { default as DateStackedAlign } from './_date_stacked_align.jsx'
@@ -15,6 +15,7 @@ const FlexItemExample = (props) => {
15
15
  <FlexItem
16
16
  displayFlex
17
17
  gap="xs"
18
+ htmlOptions={{style: {padding:"2px"}}}
18
19
  {...props}
19
20
  >
20
21
  <FlexItem>
@@ -0,0 +1,21 @@
1
+ <%= pb_rails("caption", props: { margin_bottom: "sm", text: "Default Variant" }) %>
2
+ <%= pb_rails("nav", props: { orientation: "horizontal" }) do %>
3
+ <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
4
+ <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
5
+ <%= pb_rails("nav/item", props: { text: "Service ", link: "#", disabled: true }) %>
6
+ <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
7
+ <% end %>
8
+ <%= pb_rails("caption", props: { margin_bottom: "sm", margin_top:"lg", text: "Subtle Variant" }) %>
9
+ <%= pb_rails("nav", props: { orientation: "horizontal", variant: "subtle" }) do %>
10
+ <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
11
+ <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
12
+ <%= pb_rails("nav/item", props: { text: "Service ", link: "#", disabled: true }) %>
13
+ <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
14
+ <% end %>
15
+ <%= pb_rails("caption", props: { margin_bottom: "sm", margin_top:"lg", text: "Bold Variant" }) %>
16
+ <%= pb_rails("nav", props: { orientation: "horizontal", variant: "bold" }) do %>
17
+ <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
18
+ <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
19
+ <%= pb_rails("nav/item", props: { text: "Service ", link: "#", disabled: true }) %>
20
+ <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
21
+ <% end %>
@@ -0,0 +1,113 @@
1
+ import React from 'react'
2
+
3
+ import Nav from '../_nav'
4
+ import NavItem from '../_item'
5
+ import Caption from '../../pb_caption/_caption'
6
+
7
+ const HorizontalNavDisabled = (props) => {
8
+ return (
9
+ <>
10
+ <Caption marginBottom="sm">Default Variant</Caption>
11
+ <Nav
12
+ link="#"
13
+ orientation="horizontal"
14
+ {...props}
15
+ >
16
+ <NavItem
17
+ link="#"
18
+ text="About"
19
+ {...props}
20
+ />
21
+ <NavItem
22
+ active
23
+ link="#"
24
+ text="Case Studies"
25
+ {...props}
26
+ />
27
+ <NavItem
28
+ disabled
29
+ link="#"
30
+ text="Service"
31
+ {...props}
32
+ />
33
+ <NavItem
34
+ link="#"
35
+ text="Contacts"
36
+ {...props}
37
+ />
38
+ </Nav>
39
+ <Caption
40
+ marginBottom="sm"
41
+ marginTop="lg"
42
+ >
43
+ Subtle Variant
44
+ </Caption>
45
+ <Nav
46
+ link="#"
47
+ orientation="horizontal"
48
+ variant="subtle"
49
+ {...props}
50
+ >
51
+ <NavItem
52
+ link="#"
53
+ text="About"
54
+ {...props}
55
+ />
56
+ <NavItem
57
+ active
58
+ link="#"
59
+ text="Case Studies"
60
+ {...props}
61
+ />
62
+ <NavItem
63
+ disabled
64
+ link="#"
65
+ text="Service"
66
+ {...props}
67
+ />
68
+ <NavItem
69
+ link="#"
70
+ text="Contacts"
71
+ {...props}
72
+ />
73
+ </Nav>
74
+ <Caption
75
+ marginBottom="sm"
76
+ marginTop="lg"
77
+ >
78
+ Bold Variant
79
+ </Caption>
80
+ <Nav
81
+ link="#"
82
+ orientation="horizontal"
83
+ variant="bold"
84
+ {...props}
85
+ >
86
+ <NavItem
87
+ link="#"
88
+ text="About"
89
+ {...props}
90
+ />
91
+ <NavItem
92
+ active
93
+ link="#"
94
+ text="Case Studies"
95
+ {...props}
96
+ />
97
+ <NavItem
98
+ disabled
99
+ link="#"
100
+ text="Service"
101
+ {...props}
102
+ />
103
+ <NavItem
104
+ link="#"
105
+ text="Contacts"
106
+ {...props}
107
+ />
108
+ </Nav>
109
+ </>
110
+ )
111
+ }
112
+
113
+ export default HorizontalNavDisabled
@@ -0,0 +1 @@
1
+ Use the `disabled` prop on a `navItem`/`nav_item` within a horizontal nav to set it as disabled. This will render the UI as disabled, prevent clicks and not allow for tabIndex to access the item.
@@ -0,0 +1,30 @@
1
+ <%= pb_rails("flex", props: { justify: "between" }) do %>
2
+ <%= pb_rails("flex", props: { orientation:"column", wrap: true }) do %>
3
+ <%= pb_rails("caption", props: { margin_bottom: "sm", text: "Default Variant" }) %>
4
+ <%= pb_rails("nav") do %>
5
+ <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
6
+ <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
7
+ <%= pb_rails("nav/item", props: { text: "Service ", link: "#", disabled: true }) %>
8
+ <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
9
+ <% end %>
10
+ <% end %>
11
+ <%= pb_rails("flex", props: { orientation:"column", wrap: true }) do %>
12
+ <%= pb_rails("caption", props: { margin_bottom: "sm", text: "Subtle Variant" }) %>
13
+ <%= pb_rails("nav", props:{variant: "subtle"}) do %>
14
+ <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
15
+ <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
16
+ <%= pb_rails("nav/item", props: { text: "Service ", link: "#", disabled: true }) %>
17
+ <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
18
+ <% end %>
19
+ <% end %>
20
+ <%= pb_rails("flex", props: { orientation:"column", wrap: true }) do %>
21
+ <%= pb_rails("caption", props: { margin_bottom: "sm", text: "Bold Variant" }) %>
22
+ <%= pb_rails("nav", props:{variant: "bold"}) do %>
23
+ <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
24
+ <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
25
+ <%= pb_rails("nav/item", props: { text: "Service ", link: "#", disabled: true }) %>
26
+ <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
27
+ <% end %>
28
+ <% end %>
29
+
30
+ <% end %>
@@ -0,0 +1,117 @@
1
+ import React from 'react'
2
+
3
+ import Nav from '../_nav'
4
+ import NavItem from '../_item'
5
+ import Caption from '../../pb_caption/_caption'
6
+ import Flex from '../../pb_flex/_flex'
7
+
8
+ const VerticalNavDisabled = (props) => {
9
+ return (
10
+ <Flex justify="between"
11
+ wrap
12
+ >
13
+ <Flex orientation="column">
14
+ <Caption marginBottom="sm">Default Variant</Caption>
15
+ <Nav
16
+ link="#"
17
+ {...props}
18
+ >
19
+ <NavItem
20
+ link="#"
21
+ text="About"
22
+ {...props}
23
+ />
24
+ <NavItem
25
+ active
26
+ link="#"
27
+ text="Case Studies"
28
+ {...props}
29
+ />
30
+ <NavItem
31
+ disabled
32
+ link="#"
33
+ text="Service"
34
+ {...props}
35
+ />
36
+ <NavItem
37
+ link="#"
38
+ text="Contacts"
39
+ {...props}
40
+ />
41
+ </Nav>
42
+ </Flex>
43
+ <Flex orientation="column">
44
+ <Caption
45
+ marginBottom="sm"
46
+ >
47
+ Subtle Variant
48
+ </Caption>
49
+ <Nav
50
+ link="#"
51
+ variant="subtle"
52
+ {...props}
53
+ >
54
+ <NavItem
55
+ link="#"
56
+ text="About"
57
+ {...props}
58
+ />
59
+ <NavItem
60
+ active
61
+ link="#"
62
+ text="Case Studies"
63
+ {...props}
64
+ />
65
+ <NavItem
66
+ disabled
67
+ link="#"
68
+ text="Service"
69
+ {...props}
70
+ />
71
+ <NavItem
72
+ link="#"
73
+ text="Contacts"
74
+ {...props}
75
+ />
76
+ </Nav>
77
+ </Flex>
78
+ <Flex orientation="column">
79
+ <Caption
80
+ marginBottom="sm"
81
+ >
82
+ Bold Variant
83
+ </Caption>
84
+ <Nav
85
+ link="#"
86
+ variant="bold"
87
+ {...props}
88
+ >
89
+ <NavItem
90
+ link="#"
91
+ text="About"
92
+ {...props}
93
+ />
94
+ <NavItem
95
+ active
96
+ link="#"
97
+ text="Case Studies"
98
+ {...props}
99
+ />
100
+ <NavItem
101
+ disabled
102
+ link="#"
103
+ text="Service"
104
+ {...props}
105
+ />
106
+ <NavItem
107
+ link="#"
108
+ text="Contacts"
109
+ {...props}
110
+ />
111
+ </Nav>
112
+ </Flex>
113
+ </Flex>
114
+ )
115
+ }
116
+
117
+ export default VerticalNavDisabled
@@ -0,0 +1 @@
1
+ Use the `disabled` prop on a `navItem`/`nav_item` within a vertical nav to set it as disabled. This will render the UI as disabled, prevent clicks and not allow for tabIndex to access the item.
@@ -18,6 +18,8 @@ examples:
18
18
  - subtle_horizontal_nav: Subtle Horizontal Nav
19
19
  - bold_horizontal_nav: Bold Horizontal Nav
20
20
  - horizontal_nav_extendedunderline: Horizontal Nav With Extended Underline
21
+ - horizontal_nav_disabled: Horizontal Nav With Disabled Item
22
+ - vertical_nav_disabled: Vertical Nav With Disabled Item
21
23
  - block_nav: Block
22
24
  - block_no_title_nav: Without Title
23
25
  - new_tab: Open in a New Tab
@@ -44,6 +46,8 @@ examples:
44
46
  - subtle_horizontal_nav: Subtle Horizontal Nav
45
47
  - bold_horizontal_nav: Bold Horizontal Nav
46
48
  - horizontal_nav_extendedunderline: Horizontal Nav With Extended Underline
49
+ - horizontal_nav_disabled: Horizontal Nav With Disabled Item
50
+ - vertical_nav_disabled: Vertical Nav With Disabled Item
47
51
  - block_nav: Block
48
52
  - block_no_title_nav: Without Title
49
53
  - new_tab: Open in a New Tab
@@ -20,4 +20,6 @@ export { default as NavWithFontControl } from "./_nav_with_font_control.jsx"
20
20
  export { default as NavWithSpacingControl } from "./_nav_with_spacing_control.jsx"
21
21
  export { default as CollapsibleNavItemSpacing } from "./_collapsible_nav_item_spacing.jsx"
22
22
  export { default as CollapsibleNavNoIcon } from "./_collapsible_nav_no_icon.jsx"
23
- export { default as HorizontalNavExtendedunderline } from './_horizontal_nav_extendedunderline.jsx'
23
+ export { default as HorizontalNavExtendedunderline } from './_horizontal_nav_extendedunderline.jsx'
24
+ export { default as HorizontalNavDisabled } from './_horizontal_nav_disabled.jsx'
25
+ export { default as VerticalNavDisabled } from './_vertical_nav_disabled.jsx'
@@ -0,0 +1,7 @@
1
+ The Rails RichTextEditor is a React-Rendered-Rails component that uses [Tiptap](https://tiptap.dev/) and requires the following packages to be installed in your project:
2
+
3
+ - `@tiptap/react`
4
+ - `@tiptap/starter-kit`
5
+ - `@tiptap/extension-link`
6
+
7
+ Once installed, the editor is initialized automatically when you use the component. Unlike the [React Advanced RichTextEditor](https://playbook.powerapp.cloud/kits/rich_text_editor/react#advanced-default) variant, [custom extensions](https://playbook.powerapp.cloud/kits/rich_text_editor/react#advanced-extra-extensions) are not currently supported. The doc examples below showcase some preset prop-enabled Rails RichTextEditor customizations.
@@ -1,3 +1,11 @@
1
- <%= pb_rails("rich_text_editor", props: {focus: true}) %>
1
+ <%= pb_rails("rich_text_editor", props: {
2
+ id: "focus-editor-1",
3
+ focus: true,
4
+ value: "Click inside to see the toolbar. Click outside to hide it."
5
+ }) %>
2
6
  <br>
3
- <%= pb_rails("rich_text_editor", props: {focus: true}) %>
7
+ <%= pb_rails("rich_text_editor", props: {
8
+ id: "focus-editor-2",
9
+ focus: true,
10
+ value: "When the optional focus prop is set to true, the toolbar will only show once you click in to the RichTextEditor."
11
+ }) %>
@@ -0,0 +1 @@
1
+ When the optional `inline` prop is set to true, the editor borders and the toolbar will only be visible when hovered or focused on.
@@ -1,30 +1,38 @@
1
+ <%= pb_rails("rich_text_editor", props: {
2
+ id: "content-preview-editor",
3
+ margin_bottom: "md",
4
+ value: "Add text here, format it, and press \"Preview Output\" to see what your stylized output will look like on the page."
5
+ }) %>
6
+
7
+ <%= pb_rails("button", props: { id: "preview-button", text: "Preview Output", variant: "secondary" }) %>
1
8
 
2
- <%= pb_rails("rich_text_editor", props: { id: "content-preview-editor" }) %>
3
9
  <div id="card-obfuscation" style="display:none">
4
10
  <%= pb_rails("card", props: { margin_top: "md", max_width: "md", padding: "sm" }) do %>
5
- <div id="content-preview" class="trix-content">
11
+ <div id="content-preview" class="tiptap-content">
6
12
  </div>
7
13
  <% end %>
8
14
  </div>
9
- <%= pb_rails("button", props: { id: "preview-button", variant: "secondary", margin_top: "md" }) do %>
10
- <span>Preview Output</span>
11
- <% end %>
12
15
 
13
16
  <script>
14
17
  document.addEventListener('DOMContentLoaded', () => {
15
18
  function handleButtonClick() {
19
+ // Find the specific TipTap editor container by ID
16
20
  const editorContainer = [...document.querySelectorAll('[data-pb-react-props]')]
17
21
  .find(element => element.getAttribute('data-pb-react-props')?.includes('"id":"content-preview-editor"'))
18
22
 
19
- const editorElement = editorContainer?.querySelector('trix-editor')
20
- const inputId = editorElement?.getAttribute('input')
21
- const inputElement = inputId && document.getElementById(inputId)
22
-
23
- const editorContent = inputElement?.value || ''
23
+ if (!editorContainer) {
24
+ console.log('Editor container not found')
25
+ return
26
+ }
27
+
28
+ // Find the TipTap editor content
29
+ const tiptapEditor = editorContainer.querySelector('.ProseMirror')
24
30
  const previewArea = document.getElementById('content-preview')
25
31
  const cardDiv = document.getElementById('card-obfuscation')
26
32
 
27
- if (previewArea && cardDiv) {
33
+ if (tiptapEditor && previewArea && cardDiv) {
34
+ // Get the HTML content from the TipTap editor
35
+ const editorContent = tiptapEditor.innerHTML || ''
28
36
  previewArea.innerHTML = editorContent
29
37
  cardDiv.style.display = 'block'
30
38
  }
@@ -1 +1,5 @@
1
- <%= pb_rails("rich_text_editor", props: {simple: true, id: "simple"}) %>
1
+ <%= pb_rails("rich_text_editor", props: {
2
+ id: "simple-editor",
3
+ simple: true,
4
+ value: "Add your text here. Use the simple toolbar above to format your text."
5
+ }) %>