playbook_ui_docs 15.3.0.pre.alpha.PLAY2565formkitsubmitfix11681 → 15.3.0.pre.alpha.PLAY2568richtexteditortiptaprails11790

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bba1f9b8ae412f2303274ac7a52b952213605dbe2c77721a69558a1e80228d8e
4
- data.tar.gz: b8326328deb9f409ef075ed7322224db6e616af4e986baf408372b19993c7011
3
+ metadata.gz: c1358de176cde4e1b99df47749f8c77913c37cd9bd0066a4862c7cb9fcdd2398
4
+ data.tar.gz: bc24c83b8c64c106ca7dd118bc4a1289ff614c9484340b296c976a02005813db
5
5
  SHA512:
6
- metadata.gz: 67e96b8d88f0a7db6b6a3e763856f7b67a7bc55e4bb6cd8fc79e781c8630ae0b0f40c8bbdb61f76f0fb2260cb45ca49dfb33659cfe67d09fbb8fe28844c67e21
7
- data.tar.gz: 6b0b26a22109b5e268f90b8390526f154c78a636dcc6d1e0797ab54e6a17c1799081df5bfc4ef3a17dcb69be961a3199095a8110a22158d395f622a24e8bb5b7
6
+ metadata.gz: 5d46b7cd075bfa15f6d47b0e381811add8a1abbe1491386f503fbe57c5cdd15eeea37528264cacb8f4239061153c95a86f0166105195bb46ac973a7ae39fd765
7
+ data.tar.gz: f9ab3f7097660093c16ddbe23ca2f5d571dd35544183cf82e84487d980686af1b687acc3a5c68e50ca1feb7dd6ab86d469aaefa8b5a2ac68e08dbbea9a1b65c7
@@ -1,6 +1,8 @@
1
1
  import React from "react"
2
2
  import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import Caption from '../../pb_caption/_caption'
3
4
  import { MOCK_DATA_INLINE_LOADING } from "./_mock_data_inline_loading"
5
+ import { MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN } from "./_mock_data_inline_loading_empty_children"
4
6
 
5
7
  const AdvancedTableInlineRowLoading = (props) => {
6
8
  const columnDefinitions = [
@@ -41,16 +43,42 @@ const AdvancedTableInlineRowLoading = (props) => {
41
43
 
42
44
  return (
43
45
  <div>
46
+ <Caption text="Inline Row Loading - Demonstrated in Row 1 (Rows 2 and 3 have data)" />
44
47
  <AdvancedTable
45
48
  columnDefinitions={columnDefinitions}
46
49
  enableToggleExpansion="all"
47
50
  inlineRowLoading
51
+ marginBottom="md"
48
52
  tableData={MOCK_DATA_INLINE_LOADING}
49
53
  {...props}
50
54
  >
51
55
  <AdvancedTable.Header />
52
56
  <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
53
57
  </AdvancedTable>
58
+ <Caption text="Inline Row Loading with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is not rendered" />
59
+ <AdvancedTable
60
+ columnDefinitions={columnDefinitions}
61
+ enableToggleExpansion="all"
62
+ inlineRowLoading
63
+ marginBottom="md"
64
+ tableData={MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN}
65
+ {...props}
66
+ >
67
+ <AdvancedTable.Header />
68
+ <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
69
+ </AdvancedTable>
70
+ <Caption text="Inline Row Loading and Persist Toggle Expansion Button with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is rendered" />
71
+ <AdvancedTable
72
+ columnDefinitions={columnDefinitions}
73
+ enableToggleExpansion="all"
74
+ inlineRowLoading
75
+ persistToggleExpansionButton
76
+ tableData={MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN}
77
+ {...props}
78
+ >
79
+ <AdvancedTable.Header />
80
+ <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
81
+ </AdvancedTable>
54
82
  </div>
55
83
  )
56
84
  }
@@ -1,5 +1,14 @@
1
+ ### inlineRowLoading
1
2
  As a default, the kit assumes that the initial dataset is complete, and it renders all expansion buttons/controls based on that data; if no children are present, no expansion controls are rendered. If, however, you want to change the initial dataset to omit some or all of its children (to improve load times of a complex dataset, perhaps), and you implement a querying logic that loads children only when its parent is expanded, then you must use the `inlineRowLoading` prop to ensure your expansion controls are rendered even though your child data is not yet loaded. You must also pass an empty `children` array to any node that will have children to ensure its parent maintains its ability to expand. If this prop is called AND your data contains empty `children` arrays, the kit will render expansion controls on any row with empty children, and then add an inline loading state within the expanded subrow until those child row(s) are returned to the page [by your query logic].
2
3
 
3
- In this code example, 2021 has an empty children array. Toggle it open to see the inline loading state. Once the correct data loads, this state will be replaced with the correct data rows.
4
+ In the first Advanced Table in this code example, 2021 has an empty children array. Toggle it open to see the inline loading state. Once the correct data loads, this state will be replaced with the correct data rows.
4
5
 
5
- This prop is set to `false` by default.
6
+ This prop is set to `false` by default.
7
+
8
+
9
+ ### persistToggleExpansion
10
+ The `persistToggleExpansionButton` is a boolean prop that renders the toggle-all icon in the top left header cell for complex datasets with empty `children` arrays and advanced querying logic explained in the preceeding doc example. Your logic may require an additional query helper file to update data specifically from requerying via toggle all buttons.
11
+
12
+ In the second and third Advanced Tables in this code example, all 3 rows have empty children arrays. The second Advanced Table demonstrates that the toggle all button does not render (prior to an initial row expansion) without `persistToggleExpansionButton` in place. The third Advanced Table shows the toggle all button due to `persistToggleExpansionButton`.
13
+
14
+ This prop is set to false by default and should only be used in conjunction with `inlineRowLoading`.
@@ -0,0 +1,42 @@
1
+ export const MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN = [
2
+ {
3
+ year: "2021",
4
+ quarter: null,
5
+ month: null,
6
+ day: null,
7
+ newEnrollments: "20",
8
+ scheduledMeetings: "10",
9
+ attendanceRate: "51%",
10
+ completedClasses: "3",
11
+ classCompletionRate: "33%",
12
+ graduatedStudents: "19",
13
+ children: [],
14
+ },
15
+ {
16
+ year: "2022",
17
+ quarter: null,
18
+ month: null,
19
+ day: null,
20
+ newEnrollments: "25",
21
+ scheduledMeetings: "17",
22
+ attendanceRate: "75%",
23
+ completedClasses: "5",
24
+ classCompletionRate: "45%",
25
+ graduatedStudents: "32",
26
+ children: [],
27
+ },
28
+ {
29
+ year: "2023",
30
+ quarter: null,
31
+ month: null,
32
+ day: null,
33
+ newEnrollments: "10",
34
+ scheduledMeetings: "15",
35
+ attendanceRate: "65%",
36
+ completedClasses: "4",
37
+ classCompletionRate: "49%",
38
+ graduatedStudents: "29",
39
+ children: [],
40
+ },
41
+ ]
42
+
@@ -0,0 +1,127 @@
1
+ <%= pb_rails("caption", props: { text: "Advanced Default" }) %>
2
+ <%= pb_rails("rich_text_editor", props: {
3
+ rails_advanced_editor: true,
4
+ margin_bottom: "md",
5
+ placeholder: "Start typing your content here...",
6
+ value: "Add your text here. You can format your text, add links, quotes, and bullets. This is the <strong>TipTap-based</strong> rich text editor rendered through Rails which requires a direct import of Tiptap into the tsx file.",
7
+ }) %>
8
+
9
+ <%= pb_rails("caption", props: { text: "AdvancedToolbar disabled" }) %>
10
+ <%= pb_rails("rich_text_editor", props: {
11
+ rails_advanced_editor: true,
12
+ advanced_editor_toolbar: false,
13
+ margin_bottom: "md",
14
+ value: "<p>This advanced editor has the toolbar disabled, showing only the content area.</p>"
15
+ }) %>
16
+
17
+ <%= pb_rails("caption", props: { text: "Advanced Simple" }) %>
18
+ <%= pb_rails("rich_text_editor", props: {
19
+ rails_advanced_editor: true,
20
+ margin_bottom: "md",
21
+ simple: true,
22
+ value: "<p>This is a <strong>simple</strong> version of the advanced editor with fewer toolbar options.</p>"
23
+ }) %>
24
+
25
+ <%= pb_rails("caption", props: { text: "Advanced Attributes" }) %>
26
+ <%= pb_rails("rich_text_editor", props: {
27
+ aria: { label: "rich-textarea" },
28
+ data: { key: "value", key2: "value2" },
29
+ name: "textarea-label",
30
+ rails_advanced_editor: true,
31
+ margin_bottom: "md",
32
+ value: "<p>This advanced editor has attributes, aria, and data attributes.</p>"
33
+ }) %>
34
+
35
+ <%= pb_rails("caption", props: { text: "Advanced Focus" }) %>
36
+ <%= pb_rails("rich_text_editor", props: {
37
+ rails_advanced_editor: true,
38
+ focus: true,
39
+ margin_bottom: "md",
40
+ value: "<p>This advanced editor shows the toolbar only when focused.</p>"
41
+ }) %>
42
+
43
+ <%= pb_rails("caption", props: { text: "Advanced Sticky" }) %>
44
+ <%= pb_rails("rich_text_editor", props: {
45
+ rails_advanced_editor: true,
46
+ sticky: true,
47
+ margin_bottom: "md",
48
+ value: "<p>In this example, when you scroll down, the rich text editor's toolbar will scroll along with the page and it will no longer be visible at the top of the page. Dummy text to enable scroll.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare lorem ut pellentesque tempor. Vivamus ut ex vestibulum velit rich text editor eleifend fringilla. Sed non metus dictum, elementum mauris wysiwyg html editor non, sagittis odio. Nullam pellentesque leo sit amet ante suscipit wysiwyg html editor sagittis. Donec tempus vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus rich text editor mi eu consequat. Nullam tincidunt erat et placerat mattis. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus mi eu consequat. Nullam tincidunt erat et placerat mattis.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare lorem ut pellentesque tempor. Vivamus ut ex vestibulum velit rich text editor eleifend fringilla. Sed non metus dictum, elementum mauris wysiwyg html editor non, sagittis odio. Nullam pellentesque leo sit amet ante suscipit wysiwyg html editor sagittis. Donec tempus vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus rich text editor mi eu consequat. Nullam tincidunt erat et placerat mattis. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus mi eu consequat. Nullam tincidunt erat et placerat mattis.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare lorem ut pellentesque tempor. Vivamus ut ex vestibulum velit rich text editor eleifend fringilla. Sed non metus dictum, elementum mauris wysiwyg html editor non, sagittis odio. Nullam pellentesque leo sit amet ante suscipit wysiwyg html editor sagittis. Donec tempus vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna.</p>"
49
+ }) %>
50
+
51
+ <%= pb_rails("caption", props: { text: "Advanced Templates" }) %>
52
+ <%= pb_rails("body", props: { margin_bottom: "md", text: "Not getting into this on POC feels like more of a nice to have" }) %>
53
+
54
+ <%= pb_rails("caption", props: { text: "Advanced Inline" }) %>
55
+ <%= pb_rails("rich_text_editor", props: {
56
+ rails_advanced_editor: true,
57
+ inline: true,
58
+ margin_bottom: "md",
59
+ value: "<p>This advanced editor has an inline toolbar, showing all the formatting options.</p>"
60
+ }) %>
61
+
62
+ <%= pb_rails("caption", props: { text: "Advanced Preview" }) %>
63
+ <%= pb_rails("rich_text_editor", props: {
64
+ id: "advanced-preview-editor",
65
+ rails_advanced_editor: true,
66
+ margin_bottom: "md",
67
+ value: "Add text here, format it, and press \"Preview Output\" to see what your stylized output will look like on the page."
68
+ }) %>
69
+
70
+ <%= pb_rails("button", props: { id: "advanced-preview-button", text: "Preview Output", variant: "secondary" }) %>
71
+
72
+ <div id="advanced-card-obfuscation" style="display:none">
73
+ <%= pb_rails("card", props: { margin_top: "md", max_width: "md", padding: "sm" }) do %>
74
+ <div id="advanced-content-preview" class="tiptap-content">
75
+ </div>
76
+ <% end %>
77
+ </div>
78
+
79
+ <script>
80
+ document.addEventListener('DOMContentLoaded', () => {
81
+ function handleAdvancedButtonClick() {
82
+ // Find the specific TipTap editor container by ID
83
+ const editorContainer = [...document.querySelectorAll('[data-pb-react-props]')]
84
+ .find(element => element.getAttribute('data-pb-react-props')?.includes('"id":"advanced-preview-editor"'))
85
+
86
+ if (!editorContainer) {
87
+ console.log('Editor container not found')
88
+ return
89
+ }
90
+
91
+ // Find the TipTap editor content
92
+ const tiptapEditor = editorContainer.querySelector('.ProseMirror')
93
+ const previewArea = document.getElementById('advanced-content-preview')
94
+ const cardDiv = document.getElementById('advanced-card-obfuscation')
95
+
96
+ console.log('Found elements:', { tiptapEditor, previewArea, cardDiv })
97
+
98
+ if (tiptapEditor && previewArea && cardDiv) {
99
+ // Get the HTML content from the TipTap editor
100
+ const editorContent = tiptapEditor.innerHTML || ''
101
+ console.log('Editor content:', editorContent)
102
+ previewArea.innerHTML = editorContent
103
+ cardDiv.style.display = 'block'
104
+ } else {
105
+ console.log('Missing elements:', { tiptapEditor: !!tiptapEditor, previewArea: !!previewArea, cardDiv: !!cardDiv })
106
+ }
107
+ }
108
+
109
+ document.getElementById('advanced-preview-button')?.addEventListener('click', handleAdvancedButtonClick)
110
+ })
111
+ </script>
112
+
113
+
114
+ <%= pb_rails("caption", props: { margin_top: "md", text: "Bonus: Advanced Extra Extensions (couldnt help thinking about this a little)" }) %>
115
+ <%= pb_rails("body", props: { margin_bottom: "md", text: "Possibly possible: I tried to set up a tip_tap_options prop via which any extensions would need to be passed through after being impoted directly to an external propject. Look at code example for hypothetical use." }) %>
116
+ <% tip_tap_options = {
117
+ extensions: [] # Extensions would be passed here as actual TipTap extension objects. Not sure if would work right away or if rich_text_editor.tsx would need to account for them.
118
+ } %>
119
+ <%= pb_rails("rich_text_editor", props: {
120
+ rails_advanced_editor: true,
121
+ tip_tap_options: tip_tap_options,
122
+ margin_bottom: "md",
123
+ value: "HYPOTHETICALLY extensions can be added via tip_tap_options.extensions array.",
124
+ }) %>
125
+
126
+ <%= pb_rails("caption", props: { text: "Alt thought: some sort of stimulus or enhanced element based RTE that imports TipTap directly into Rails?" }) %>
127
+ <%= pb_rails("body", props: {text: "If anything, may serve as an extension of the EXTENSIONS/tip_tap_options configuration. Not sure if works solo." }) %>
@@ -0,0 +1 @@
1
+ This is a POC for a react-rendered-rails version of the Advanced RTE, which necessarily requires we import Tiptap as an internal dependency since it is not compatible with Rails. Because of that, I'm not sure how we will be able to truly leverage Tiptap extensions/customizability to its full potential. We should be able to provide certain props/prop combos like we do now and provide them as options for customized editors - may require a few more doc examples and methods in the controller than we currently have but once it exists should be usable (for example, if there are usecases or examples of things like horizontal bar, highlight, etc. in Nitro or documented we can build those into the kit HUB request style.)
@@ -1,6 +1,7 @@
1
1
  examples:
2
2
 
3
3
  rails:
4
+ - rich_text_editor_advanced_default: Advanced Default
4
5
  - rich_text_editor_default: Default
5
6
  - rich_text_editor_simple: Simple
6
7
  - rich_text_editor_attributes: Attributes