playbook_ui 15.2.0 → 15.3.0.pre.alpha.PLAY2322popoverconditionalrender11766
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 +4 -4
- data/app/pb_kits/playbook/_playbook.scss +5 -5
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +18 -3
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +56 -14
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +12 -3
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +59 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +39 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +3 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +3 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.jsx +28 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +11 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row_rails.html.erb +51 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_rails.html.erb +40 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_rails.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_react.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data_inline_loading_empty_children.js +42 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/index.js +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +6 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +6 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +49 -5
- data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.html.erb +4 -4
- data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.jsx +4 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +6 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_loading.html.erb +7 -3
- data/app/pb_kits/playbook/pb_button/docs/_button_loading.jsx +29 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.jsx +1 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_quick_pick_styles.scss +11 -30
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +8 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +5 -3
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_description.md +2 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +4 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +10 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form/formHelper.js +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/_pb_bar_graph.tsx +8 -6
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_description.md +3 -0
- data/app/pb_kits/playbook/pb_pb_bar_graph/pb_bar_graph.rb +7 -10
- data/app/pb_kits/playbook/pb_pb_bar_graph/pbbargraph.test.jsx +73 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/_pb_circle_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_description.md +3 -0
- data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.rb +7 -10
- data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.test.jsx +47 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/_pb_gauge_chart.scss +3 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/_pb_gauge_chart.tsx +69 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_description.md +3 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.html.erb +12 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.jsx +24 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.md +5 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.html.erb +45 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.jsx +119 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.md +1 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.html.erb +5 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.jsx +17 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_disable_animation.html.erb +12 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_disable_animation.jsx +24 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.html.erb +23 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.jsx +37 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.html.erb +40 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.jsx +56 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_live_data.jsx +64 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.html.erb +27 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.jsx +40 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.md +1 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_sizing.html.erb +19 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_sizing.jsx +65 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_sizing.md +3 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_title.html.erb +14 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_title.jsx +27 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.html.erb +39 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.jsx +58 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.md +1 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/example.yml +29 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/index.js +11 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/pbGaugeGraphTheme.ts +91 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/pb_gauge_chart.html.erb +1 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/pb_gauge_chart.rb +25 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/pb_gauge_chart.test.jsx +80 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/_pb_line_graph.scss +3 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/_pb_line_graph.tsx +61 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_description.md +3 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.html.erb +34 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.jsx +52 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.md +5 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.html.erb +34 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.jsx +45 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.html.erb +47 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.jsx +64 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.md +3 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend.html.erb +24 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend.jsx +37 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_nonclickable.html.erb +39 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_nonclickable.jsx +45 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.html.erb +86 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.jsx +116 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.md +11 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/example.yml +20 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/pbLineGraphTheme.ts +125 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.html.erb +1 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.rb +25 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.test.jsx +110 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +130 -28
- data/app/pb_kits/playbook/pb_popover/_popover.scss +12 -0
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +43 -29
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.jsx +7 -0
- data/app/pb_kits/playbook/pb_popover/docs/hook/useSmallScreenIndicator.tsx +27 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +41 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +60 -20
- data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +36 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_attributes.jsx +38 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_attributes.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_focus.jsx +34 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_focus.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_inline.jsx +37 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_inline.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_simple.jsx +37 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_sticky.jsx +38 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_sticky.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_templates.jsx +69 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_templates.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +8 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.test.js +127 -1
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +250 -233
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +2 -2
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +35 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +71 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_options.html.erb +36 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_options.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.jsx +41 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/app/pb_kits/playbook/tokens/_positioning.scss +1 -0
- data/app/pb_kits/playbook/utilities/_positioning.scss +6 -1
- data/app/pb_kits/playbook/utilities/globalProps.ts +3 -1
- data/dist/chunks/{_line_graph-ByLTvO72.js → _line_graph-BxC7m53J.js} +1 -1
- data/dist/chunks/_typeahead-B1SiFvbF.js +6 -0
- data/dist/chunks/{_weekday_stacked-CB1Sm0pQ.js → _weekday_stacked-DxdwXyYM.js} +3 -3
- data/dist/chunks/{lib-izYrkvOQ.js → lib-CGxXTQ75.js} +2 -2
- data/dist/chunks/{pb_form_validation-Cah5Z5J3.js → pb_form_validation-DebqlUKZ.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +12 -0
- data/dist/playbook-doc.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/pb_forms_helper.rb +7 -6
- data/lib/playbook/version.rb +2 -2
- data/lib/playbook/z_index.rb +1 -1
- metadata +91 -7
- data/dist/chunks/_typeahead-DXZQU3hC.js +0 -6
| @@ -0,0 +1,69 @@ | |
| 1 | 
            +
            import React, {useState, useEffect} from 'react'
         | 
| 2 | 
            +
            import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
         | 
| 3 | 
            +
            import { useEditor, EditorContent } from "@tiptap/react"
         | 
| 4 | 
            +
            import StarterKit from "@tiptap/starter-kit"
         | 
| 5 | 
            +
            import Link from '@tiptap/extension-link'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            import Select from '../../pb_select/_select'
         | 
| 8 | 
            +
            import { changelog, release } from './templates.js'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            const RichTextEditorAdvancedTemplates = (props) => {
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            const [editorContent, setEditorContent] = useState('')
         | 
| 13 | 
            +
                
         | 
| 14 | 
            +
            const handleChange = (event) => {
         | 
| 15 | 
            +
                    setEditorContent(event.target.value)
         | 
| 16 | 
            +
            }
         | 
| 17 | 
            +
              const templatesOptions = [
         | 
| 18 | 
            +
                {
         | 
| 19 | 
            +
                  value: release,
         | 
| 20 | 
            +
                  text: 'Playbook Release',
         | 
| 21 | 
            +
                },
         | 
| 22 | 
            +
                {
         | 
| 23 | 
            +
                  value: changelog,
         | 
| 24 | 
            +
                  text: 'Changelog',
         | 
| 25 | 
            +
                },
         | 
| 26 | 
            +
              ]
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                const editor = useEditor({
         | 
| 29 | 
            +
                    extensions: [
         | 
| 30 | 
            +
                        StarterKit,
         | 
| 31 | 
            +
                        Link
         | 
| 32 | 
            +
                    ],
         | 
| 33 | 
            +
                    content: editorContent
         | 
| 34 | 
            +
                })
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                // Update editor content when editorContent state changes
         | 
| 37 | 
            +
                useEffect(() => {
         | 
| 38 | 
            +
                    if (editor && editorContent) {
         | 
| 39 | 
            +
                        editor.commands.setContent(editorContent)
         | 
| 40 | 
            +
                    }
         | 
| 41 | 
            +
                }, [editor, editorContent])
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                  if (!editor) {
         | 
| 44 | 
            +
                    return null
         | 
| 45 | 
            +
                  } 
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                  
         | 
| 48 | 
            +
             | 
| 49 | 
            +
             | 
| 50 | 
            +
              return (
         | 
| 51 | 
            +
                <div>
         | 
| 52 | 
            +
                    <Select
         | 
| 53 | 
            +
                        blankSelection="Select a template..."
         | 
| 54 | 
            +
                        label="Template"
         | 
| 55 | 
            +
                        onChange={handleChange}
         | 
| 56 | 
            +
                        options={templatesOptions}
         | 
| 57 | 
            +
                        {...props}
         | 
| 58 | 
            +
                    />
         | 
| 59 | 
            +
                    <RichTextEditor
         | 
| 60 | 
            +
                        advancedEditor={editor}
         | 
| 61 | 
            +
                        {...props}
         | 
| 62 | 
            +
                    >
         | 
| 63 | 
            +
                    <EditorContent editor={editor}/>
         | 
| 64 | 
            +
                    </RichTextEditor>
         | 
| 65 | 
            +
                </div>
         | 
| 66 | 
            +
              )
         | 
| 67 | 
            +
            }
         | 
| 68 | 
            +
             | 
| 69 | 
            +
            export default RichTextEditorAdvancedTemplates
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            Tiptap allows you to set content within the editor using the 'content' prop within useEditor. See the code snippet below to see how this can be done. 
         | 
| @@ -7,7 +7,7 @@ examples: | |
| 7 7 | 
             
              - rich_text_editor_focus: Focus
         | 
| 8 8 | 
             
              - rich_text_editor_sticky: Sticky
         | 
| 9 9 | 
             
              - rich_text_editor_templates: Templates
         | 
| 10 | 
            -
              - rich_text_editor_toolbar_bottom: Toolbar Bottom
         | 
| 10 | 
            +
              # - rich_text_editor_toolbar_bottom: Toolbar Bottom
         | 
| 11 11 | 
             
              - rich_text_editor_inline: Inline
         | 
| 12 12 | 
             
              - rich_text_editor_preview: Preview
         | 
| 13 13 |  | 
| @@ -17,11 +17,17 @@ examples: | |
| 17 17 | 
             
              - rich_text_editor_more_extensions: Advanced (Extra Extensions)
         | 
| 18 18 | 
             
              - rich_text_editor_toolbar_disabled: Advanced (Toolbar disabled)
         | 
| 19 19 | 
             
              - rich_text_editor_simple: Simple
         | 
| 20 | 
            +
              - rich_text_editor_advanced_simple: Advanced (Simple)
         | 
| 20 21 | 
             
              - rich_text_editor_attributes: Attributes
         | 
| 22 | 
            +
              - rich_text_editor_advanced_attributes: Advanced (Attributes)
         | 
| 21 23 | 
             
              - rich_text_editor_focus: Focus
         | 
| 24 | 
            +
              - rich_text_editor_advanced_focus: Advanced (Focus)
         | 
| 22 25 | 
             
              - rich_text_editor_sticky: Sticky
         | 
| 26 | 
            +
              - rich_text_editor_advanced_sticky: Advanced (Sticky)
         | 
| 23 27 | 
             
              - rich_text_editor_templates: Templates
         | 
| 24 | 
            -
              -  | 
| 28 | 
            +
              - rich_text_editor_advanced_templates: Advanced (Templates)
         | 
| 29 | 
            +
              # - rich_text_editor_toolbar_bottom: Toolbar Bottom
         | 
| 25 30 | 
             
              - rich_text_editor_inline: Inline
         | 
| 31 | 
            +
              - rich_text_editor_advanced_inline: Advanced (Inline)
         | 
| 26 32 | 
             
              - rich_text_editor_preview: Preview
         | 
| 27 33 | 
             
              - rich_text_editor_advanced_preview: Advanced Preview
         | 
| @@ -11,3 +11,9 @@ export { default as RichTextEditorAdvancedDefault } from './_rich_text_editor_ad | |
| 11 11 | 
             
            export { default as RichTextEditorMoreExtensions } from './_rich_text_editor_more_extensions.jsx'
         | 
| 12 12 | 
             
            export { default as RichTextEditorToolbarDisabled } from './_rich_text_editor_toolbar_disabled.jsx'
         | 
| 13 13 | 
             
            export { default as RichTextEditorAdvancedPreview } from './_rich_text_editor_advanced_preview.jsx'
         | 
| 14 | 
            +
            export { default as RichTextEditorAdvancedSimple } from './_rich_text_editor_advanced_simple.jsx'
         | 
| 15 | 
            +
            export { default as RichTextEditorAdvancedFocus } from './_rich_text_editor_advanced_focus.jsx'
         | 
| 16 | 
            +
            export { default as RichTextEditorAdvancedTemplates } from './_rich_text_editor_advanced_templates.jsx'
         | 
| 17 | 
            +
            export { default as RichTextEditorAdvancedAttributes } from './_rich_text_editor_advanced_attributes.jsx'
         | 
| 18 | 
            +
            export { default as RichTextEditorAdvancedSticky } from './_rich_text_editor_advanced_sticky.jsx'
         | 
| 19 | 
            +
            export { default as RichTextEditorAdvancedInline } from './_rich_text_editor_advanced_inline.jsx'
         | 
| @@ -1,5 +1,7 @@ | |
| 1 1 | 
             
            import React from 'react'
         | 
| 2 | 
            -
            import { render, screen } from '../utilities/test-utils'
         | 
| 2 | 
            +
            import { render, screen, fireEvent, waitFor } from '../utilities/test-utils'
         | 
| 3 | 
            +
            import { useEditor, EditorContent } from "@tiptap/react"
         | 
| 4 | 
            +
            import StarterKit from "@tiptap/starter-kit"
         | 
| 3 5 |  | 
| 4 6 | 
             
            import RichTextEditor from './_rich_text_editor'
         | 
| 5 7 |  | 
| @@ -62,3 +64,127 @@ test('returns "Dark" class name', () => { | |
| 62 64 | 
             
              const kit = screen.getByTestId(testId)
         | 
| 63 65 | 
             
              expect(kit).toHaveClass(`${kitClass} dark`)
         | 
| 64 66 | 
             
            })
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            // TipTap testing
         | 
| 69 | 
            +
            const TestAdvancedEditor = ({ toolbarOnFocus = false, ...props }) => {
         | 
| 70 | 
            +
              const editor = useEditor({
         | 
| 71 | 
            +
                extensions: [StarterKit],
         | 
| 72 | 
            +
                content: '<p>Test content</p>',
         | 
| 73 | 
            +
              })
         | 
| 74 | 
            +
             | 
| 75 | 
            +
              if (!editor) return null
         | 
| 76 | 
            +
             | 
| 77 | 
            +
              return (
         | 
| 78 | 
            +
                <RichTextEditor
         | 
| 79 | 
            +
                    advancedEditor={editor}
         | 
| 80 | 
            +
                    data={{ testid: testId }}
         | 
| 81 | 
            +
                    toolbarOnFocus={toolbarOnFocus}
         | 
| 82 | 
            +
                    {...props}
         | 
| 83 | 
            +
                >
         | 
| 84 | 
            +
                  <EditorContent editor={editor} />
         | 
| 85 | 
            +
                </RichTextEditor>
         | 
| 86 | 
            +
              )
         | 
| 87 | 
            +
            }
         | 
| 88 | 
            +
             | 
| 89 | 
            +
            describe('Advanced TipTap Editor works as expected', () => {
         | 
| 90 | 
            +
              test('renders advanced editor with toolbar', () => {
         | 
| 91 | 
            +
                render(<TestAdvancedEditor />)
         | 
| 92 | 
            +
                
         | 
| 93 | 
            +
                const kit = screen.getByTestId(testId)
         | 
| 94 | 
            +
                expect(kit).toHaveClass(kitClass)
         | 
| 95 | 
            +
                
         | 
| 96 | 
            +
                // Check for advanced container
         | 
| 97 | 
            +
                const advancedContainer = kit.querySelector('.pb_rich_text_editor_advanced_container')
         | 
| 98 | 
            +
                expect(advancedContainer).toBeInTheDocument()
         | 
| 99 | 
            +
                
         | 
| 100 | 
            +
                // Check for toolbar
         | 
| 101 | 
            +
                const toolbar = kit.querySelector('.toolbar')
         | 
| 102 | 
            +
                expect(toolbar).toBeInTheDocument()
         | 
| 103 | 
            +
              })
         | 
| 104 | 
            +
             | 
| 105 | 
            +
              test('renders advanced editor without toolbar when advancedEditorToolbar is false', () => {
         | 
| 106 | 
            +
                render(<TestAdvancedEditor advancedEditorToolbar={false} />)
         | 
| 107 | 
            +
                
         | 
| 108 | 
            +
                const kit = screen.getByTestId(testId)
         | 
| 109 | 
            +
                const toolbar = kit.querySelector('.toolbar')
         | 
| 110 | 
            +
                expect(toolbar).not.toBeInTheDocument()
         | 
| 111 | 
            +
              })
         | 
| 112 | 
            +
             | 
| 113 | 
            +
              test('shows/hides toolbar on focus when focus is enabled', async () => {
         | 
| 114 | 
            +
                render(<TestAdvancedEditor focus />)
         | 
| 115 | 
            +
                
         | 
| 116 | 
            +
                const kit = screen.getByTestId(testId)
         | 
| 117 | 
            +
                
         | 
| 118 | 
            +
                // Initially toolbar should be hidden
         | 
| 119 | 
            +
                let toolbar = kit.querySelector('.toolbar')
         | 
| 120 | 
            +
                expect(toolbar).not.toBeInTheDocument()
         | 
| 121 | 
            +
                
         | 
| 122 | 
            +
                const editorElement = kit.querySelector('.ProseMirror')
         | 
| 123 | 
            +
                // Focus the editor
         | 
| 124 | 
            +
                fireEvent.focus(editorElement)
         | 
| 125 | 
            +
                
         | 
| 126 | 
            +
                // Toolbar should now be visible
         | 
| 127 | 
            +
                await waitFor(() => {
         | 
| 128 | 
            +
                  toolbar = kit.querySelector('.toolbar')
         | 
| 129 | 
            +
                  expect(toolbar).toBeInTheDocument()
         | 
| 130 | 
            +
                })
         | 
| 131 | 
            +
              })
         | 
| 132 | 
            +
             | 
| 133 | 
            +
             | 
| 134 | 
            +
              test('supports simple prop with advanced editor', () => {
         | 
| 135 | 
            +
                render(<TestAdvancedEditor simple />)
         | 
| 136 | 
            +
                
         | 
| 137 | 
            +
                const kit = screen.getByTestId(testId)
         | 
| 138 | 
            +
                const toolbar = kit.querySelector('.toolbar')
         | 
| 139 | 
            +
                expect(toolbar).toBeInTheDocument()
         | 
| 140 | 
            +
                const toolbarDropdown = kit.querySelector('.editor_dropdown_button')
         | 
| 141 | 
            +
                expect(toolbarDropdown).not.toBeInTheDocument()
         | 
| 142 | 
            +
                expect(kit).toHaveClass(`${kitClass} simple`)
         | 
| 143 | 
            +
              })
         | 
| 144 | 
            +
             | 
| 145 | 
            +
                test('supports sticky prop with advanced editor', () => {
         | 
| 146 | 
            +
                render(<TestAdvancedEditor sticky />)
         | 
| 147 | 
            +
                
         | 
| 148 | 
            +
                const kit = screen.getByTestId(testId)
         | 
| 149 | 
            +
                const stickyToolbar = kit.querySelector('.pb_rich_text_editor_tiptap_toolbar_sticky')
         | 
| 150 | 
            +
                expect(stickyToolbar).toBeInTheDocument()
         | 
| 151 | 
            +
                expect(kit).toHaveClass(`${kitClass} sticky`)
         | 
| 152 | 
            +
              })
         | 
| 153 | 
            +
             | 
| 154 | 
            +
              test('applies aria-label when provided', () => {
         | 
| 155 | 
            +
                const ariaLabel = 'Rich Text Editor'
         | 
| 156 | 
            +
                render(<TestAdvancedEditor aria={{ label: ariaLabel }} />)
         | 
| 157 | 
            +
                
         | 
| 158 | 
            +
                const kit = screen.getByTestId(testId)
         | 
| 159 | 
            +
                expect(kit).toHaveAttribute('aria-label', ariaLabel)
         | 
| 160 | 
            +
              })
         | 
| 161 | 
            +
             | 
| 162 | 
            +
              test('supports inline prop with advanced editor', () => {
         | 
| 163 | 
            +
                render(<TestAdvancedEditor inline />)
         | 
| 164 | 
            +
                
         | 
| 165 | 
            +
                const kit = screen.getByTestId(testId)
         | 
| 166 | 
            +
                const toolbar = kit.querySelector('.toolbar')
         | 
| 167 | 
            +
                expect(toolbar).toBeInTheDocument()
         | 
| 168 | 
            +
                expect(kit).toHaveClass(`${kitClass} inline`)
         | 
| 169 | 
            +
              })
         | 
| 170 | 
            +
             | 
| 171 | 
            +
            describe('TipTap Editor Functionality', () => {
         | 
| 172 | 
            +
              test('can type and update content', async () => {
         | 
| 173 | 
            +
                render(<TestAdvancedEditor />)
         | 
| 174 | 
            +
                
         | 
| 175 | 
            +
                const kit = screen.getByTestId(testId)
         | 
| 176 | 
            +
                const editorContent = kit.querySelector('.ProseMirror')
         | 
| 177 | 
            +
                
         | 
| 178 | 
            +
                // Focus and type in the editor
         | 
| 179 | 
            +
                fireEvent.focus(editorContent)
         | 
| 180 | 
            +
                fireEvent.input(editorContent, { 
         | 
| 181 | 
            +
                  target: { textContent: 'New content' }
         | 
| 182 | 
            +
                })
         | 
| 183 | 
            +
                
         | 
| 184 | 
            +
                await waitFor(() => {
         | 
| 185 | 
            +
                  expect(editorContent).toHaveTextContent('New content')
         | 
| 186 | 
            +
                })
         | 
| 187 | 
            +
              })
         | 
| 188 | 
            +
            })
         | 
| 189 | 
            +
            })
         | 
| 190 | 
            +
             |