playbook_ui 16.6.0.pre.alpha.RTEPOC15805 → 16.6.0.pre.alpha.emptystatepresets15848

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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_empty_state/__mocks__/assetUrl.ts +1 -0
  3. data/app/pb_kits/playbook/pb_empty_state/_empty_state.tsx +22 -9
  4. data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_presets.html.erb +14 -0
  5. data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_presets.jsx +27 -0
  6. data/app/pb_kits/playbook/pb_empty_state/docs/default_image/this_is_fine.svg +21 -0
  7. data/app/pb_kits/playbook/pb_empty_state/docs/default_image/travolta_lost.gif +0 -0
  8. data/app/pb_kits/playbook/pb_empty_state/docs/example.yml +2 -0
  9. data/app/pb_kits/playbook/pb_empty_state/docs/index.js +1 -0
  10. data/app/pb_kits/playbook/pb_empty_state/empty_state.html.erb +3 -1
  11. data/app/pb_kits/playbook/pb_empty_state/empty_state.rb +43 -0
  12. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +1 -1
  13. data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +43 -262
  14. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +0 -2
  15. data/app/pb_kits/playbook/pb_rich_text_editor/kit.schema.json +9 -18
  16. data/app/pb_kits/playbook/tokens/exports/exports.d.ts +5 -1
  17. data/dist/chunks/vendor.js +1 -1
  18. data/dist/menu.yml +2 -1
  19. data/dist/playbook.css +1 -1
  20. data/lib/playbook/version.rb +1 -1
  21. metadata +7 -9
  22. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_default.html.erb +0 -1
  23. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_default.md +0 -12
  24. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_simple.html.erb +0 -9
  25. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_simple.md +0 -8
  26. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +0 -162
  27. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +0 -71
  28. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor_rails.js +0 -202
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfb690dbbba85b30da33be0eb084cf300f6847ad953e629f73e532555cb4483b
4
- data.tar.gz: d6d91db903e58cfa5cfcb33d5807d83d762237a79c5558492b23ed853664a1cc
3
+ metadata.gz: f403796e53bc3b998e1c127a73fec5be5d4ecdff23f011d4bdf66777e5d8549f
4
+ data.tar.gz: 27bc94414daabd7e53b42d503e86aaedfbc3edff2332d8a17506d3c8823bd0bd
5
5
  SHA512:
6
- metadata.gz: 9ed26edb44d0abae16688ce39f747bf506af5733d6097d2c2525f19effd8760fbc7d688550b5ba59aca0d7171a358568bb3f00584084e88cbe820cd86e8a01b6
7
- data.tar.gz: 688fc44f6ea83e627637fce0aa191eaba27aef8afded9fb0937a7df448a6b790683d1e383fc1747193f2e9932e6c24fbec6c084c44ceec2b867f8d50bd165f66
6
+ metadata.gz: 1e215435bd8d6420d587f0db1043b603f272ef79020bee8e3f0abf597daac8473b6d0a9481dfb901a7bb364a56109f975b40f557436d6decba7652db5006b8e4
7
+ data.tar.gz: 50a69d0bc34bf5fbb44ee650b4158fe1e4dd8b51b84a51243ef7b3a2c428e82ccf0943a399dc2a6b5c50c20480260b4c4b5b79c1bf18a9624fc47e1809eaec64
@@ -0,0 +1 @@
1
+ export default "https://pb-empty-state.test/mock-asset"
@@ -12,6 +12,8 @@ import Flex from "../pb_flex/_flex"
12
12
  import FlexItem from "../pb_flex/_flex_item"
13
13
  import Image from "../pb_image/_image"
14
14
  import computer from "./docs/default_image/utils"
15
+ import thisIsFineImageUrl from "./docs/default_image/this_is_fine.svg?url"
16
+ import travoltaLostImageUrl from "./docs/default_image/travolta_lost.gif?url"
15
17
 
16
18
  type EventHandler = (React.MouseEventHandler<HTMLElement>)
17
19
 
@@ -23,6 +25,7 @@ type EmptyStateProps = {
23
25
  description?: string,
24
26
  header?: string,
25
27
  id?: string,
28
+ /** Built-in illustrations: `default`, `this_is_fine`, `travolta_lost`, or a custom image URL */
26
29
  image?: string,
27
30
  linkButton?: string,
28
31
  onLinkButtonClick?: EventHandler,
@@ -134,6 +137,22 @@ const EmptyState = (props: EmptyStateProps) => {
134
137
  return `data:image/svg+xml,${encodedSvg}`
135
138
  }
136
139
 
140
+ const resolvePresetImage = (): { alt: string, url: string } | null => {
141
+ if (!image) return null
142
+ if (image === "default") {
143
+ return { alt: "Empty state illustration", url: getSvgAsDataUrl() }
144
+ }
145
+ if (image === "this_is_fine") {
146
+ return { alt: "This is fine illustration", url: thisIsFineImageUrl }
147
+ }
148
+ if (image === "travolta_lost") {
149
+ return { alt: "Confused reaction illustration", url: travoltaLostImageUrl }
150
+ }
151
+ return { alt: "Empty state image", url: image }
152
+ }
153
+
154
+ const presetImage = resolvePresetImage()
155
+
137
156
  const layout = (
138
157
  <div {...ariaProps}
139
158
  {...dataProps}
@@ -148,17 +167,11 @@ const EmptyState = (props: EmptyStateProps) => {
148
167
  vertical="center"
149
168
  >
150
169
 
151
- { image && image === 'default' ? (
152
- <Image
153
- alt="test"
154
- htmlOptions={{ width: configs.imageWidth, height: "auto", alignment: "start" }}
155
- url={getSvgAsDataUrl()}
156
- />
157
- ) : image && image ? (
170
+ { presetImage ? (
158
171
  <Image
159
- alt="test"
172
+ alt={presetImage.alt}
160
173
  htmlOptions={{ width: configs.imageWidth, height: "auto", alignment: "start" }}
161
- url={image}
174
+ url={presetImage.url}
162
175
  />
163
176
  ) : null}
164
177
 
@@ -0,0 +1,14 @@
1
+ <%= pb_rails("flex", props: { align: "start", justify: "start", orientation: "column", gap: "xl" }) do %>
2
+ <%= pb_rails("empty_state", props: {
3
+ description: "This error was unexpected. Please try again in a moment.",
4
+ header: "Something went wrong",
5
+ image: "this_is_fine",
6
+ primary_button: "Back to home",
7
+ }) %>
8
+ <%= pb_rails("empty_state", props: {
9
+ description: "We could not load this resource. Check the URL or try again later.",
10
+ header: "We are not sure what happened",
11
+ image: "travolta_lost",
12
+ link_button: "Contact support",
13
+ }) %>
14
+ <% end %>
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+ import EmptyState from '../_empty_state'
3
+ import Flex from '../../pb_flex/_flex'
4
+
5
+ const EmptyStatePresets = (props) => (
6
+ <Flex align="start"
7
+ gap="xl"
8
+ orientation="column"
9
+ >
10
+ <EmptyState
11
+ {...props}
12
+ description="This error was unexpected. Please try again in a moment."
13
+ header="Something went wrong"
14
+ image="this_is_fine"
15
+ primaryButton="Back to home"
16
+ />
17
+ <EmptyState
18
+ {...props}
19
+ description="We could not load this resource. Check the URL or try again later."
20
+ header="We are not sure what happened"
21
+ image="travolta_lost"
22
+ linkButton="Contact support"
23
+ />
24
+ </Flex>
25
+ )
26
+
27
+ export default EmptyStatePresets
@@ -0,0 +1,21 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="This-Is-Fine--Streamline-Memes" height="48" width="48">
2
+ <desc>
3
+ This Is Fine Streamline Element: https://streamlinehq.com
4
+ </desc>
5
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M26.114 37.139c1.314 -0.422 1.896 -0.882 2.638 -2.15" stroke-width="1"></path>
6
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M11.726 44.394c0 -2.35 0.052 -5.692 0.305 -9.019m11.61 -16.063c1.866 0.475 3.82 1.753 4.843 4.157" stroke-width="1"></path>
7
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M26.578 32.669c2.365 -1.31 6.05 -2.796 8.844 -2.614m-5.034 13.948c-0.078 -1.642 -0.558 -5.164 -0.789 -6.72 4.062 1.425 9.68 1.069 9.68 -2.758 0 -0.116 0.005 -0.337 0 -0.449" stroke-width="1"></path>
8
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M27.653 36.382c0.576 0.348 1.237 0.651 1.946 0.9" stroke-width="1"></path>
9
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M34.17 32.74a3.224 2.638 -11.758 1 0 6.312 -1.314 3.224 2.638 -11.758 1 0 -6.312 1.314" stroke-width="1"></path>
10
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M23.04 15.784a2.442 2.442 0 0 1 0.7 3.383c-1.22 1.856 -2.515 3.357 -4.302 4.265 -1.793 0.91 -3.746 1.053 -5.9 0.932a2.442 2.442 0 0 1 -2.303 -2.575c0.076 -1.347 1.223 -1.64 2.57 -1.565 1.836 0.103 3.096 0.07 3.75 -0.261 0.66 -0.335 1.83 -1.544 2.879 -3.14 0.74 -1.128 1.479 -1.78 2.606 -1.039Z" clip-rule="evenodd" stroke-width="1"></path>
11
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="m13.938 20.219 -0.234 -3.244a2.712 2.712 0 0 1 1.276 -2.5v0a2.712 2.712 0 0 1 3.212 0.263l2.275 1.986" stroke-width="1"></path>
12
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M20.388 16.662c-1.114 -0.27 -2.606 -0.078 -4.06 0.617 -1.035 0.494 -1.883 1.163 -2.463 1.881l0.07 0.977c2.046 0.297 3.364 0.077 4.565 -0.914 0.591 -0.575 1.285 -1.414 1.934 -2.4l0.05 -0.076 -0.096 -0.085Z" stroke-width="1"></path>
13
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M16.563 30.91a3.615 4.69 0 1 0 7.23 0 3.615 4.69 0 1 0 -7.23 0" stroke-width="1"></path>
14
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M25.161 27.393a3.615 3.908 0 1 0 7.23 0 3.615 3.908 0 1 0 -7.23 0" stroke-width="1"></path>
15
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M12.744 24.327c-0.696 1.224 -1.644 2.243 -2.558 3.225 -1.676 1.802 -3.237 3.478 -2.908 6.065 0.456 3.596 4.147 3.122 5.753 0.66 1.838 -2.817 2.145 -7.709 0.577 -9.891a27.982 27.982 0 0 1 -0.57 -0.027 2.769 2.769 0 0 1 -0.294 -0.032Z" stroke-width="1"></path>
16
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M15.732 40.583s-0.488 2.834 0 4.006" stroke-width="1"></path>
17
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M17.98 40.779c-0.257 1.792 -0.088 2.584 0.488 3.81" stroke-width="1"></path>
18
+ <path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M3.54 44.274C2.694 43.428 1 39.054 1 35.46c1.407 1.407 2.931 1.563 3.517 1.466 -0.977 -1.433 -2.93 -5.16 -2.93 -8.599 1.563 1.563 3.32 1.953 4.004 1.953C4.29 28 2.172 22.405 4.127 18.262c0 0 1.27 2.639 3.029 3.616C6.765 20.118 14.19 7.71 9.89 3.41c8.109 0 19.835 3.615 21.692 13.874 1.042 -0.488 3.185 -2.052 3.42 -4.397 2.188 3.518 1.888 8.696 1.465 10.846 1.798 -1.173 3.094 -3.55 3.517 -4.592 2.614 3.02 3.953 6.401 2.741 11.567 2.033 -1.172 3.655 -3.91 4.274 -4.528 0.032 3.387 -2.56 14.81 -5.842 18.093" stroke-width="1"></path>
19
+ <path fill="#000000" fill-rule="evenodd" d="M29.376 26.341a1.432 1.432 0 1 0 0 2.864 1.432 1.432 0 0 0 0 -2.864Z" clip-rule="evenodd" stroke-width="1"></path>
20
+ <path fill="#000000" fill-rule="evenodd" d="M20.598 29.478a1.432 1.432 0 1 0 0 2.864 1.432 1.432 0 0 0 0 -2.864Z" clip-rule="evenodd" stroke-width="1"></path>
21
+ </svg>
@@ -1,12 +1,14 @@
1
1
  examples:
2
2
  rails:
3
3
  - empty_state_default: Default
4
+ - empty_state_presets: Illustration presets
4
5
  - empty_state_size: Size
5
6
  - empty_state_orientation: Orientation
6
7
  - empty_state_alignment: Alignment
7
8
 
8
9
  react:
9
10
  - empty_state_default: Default
11
+ - empty_state_presets: Illustration presets
10
12
  - empty_state_size: Size
11
13
  - empty_state_orientation: Orientation
12
14
  - empty_state_alignment: Alignment
@@ -1,4 +1,5 @@
1
1
  export { default as EmptyStateDefault } from './_empty_state_default.jsx'
2
+ export { default as EmptyStatePresets } from './_empty_state_presets.jsx'
2
3
  export { default as EmptyStateOrientation } from './_empty_state_orientation.jsx'
3
4
  export { default as EmptyStateSize } from './_empty_state_size.jsx'
4
5
  export { default as EmptyStateAlignment } from './_empty_state_alignment.jsx'
@@ -1,6 +1,8 @@
1
1
  <%= pb_content_tag do %>
2
2
  <%= pb_rails("flex", props: { align: flex_align, orientation: config[:flex_direction], padding_left: padding_size, padding_right: padding_size, vertical: "center", classname: config[:scss_class], max_width: "100%" }) do %>
3
- <%= pb_rails("image", props: { url: image == "default" ? default_image_data_uri : image, alt: "Empty State Image", html_options: { width: config[:image_width], height: "auto", alignment: "start" } }) %>
3
+ <% if resolved_image_url.present? %>
4
+ <%= pb_rails("image", props: { url: resolved_image_url, alt: image_alt_text, html_options: { width: config[:image_width], height: "auto", alignment: "start" } }) %>
5
+ <% end %>
4
6
  <%= pb_rails("flex/flex_item") do %>
5
7
  <%= pb_rails("title", props: { text: object.header, size: config[:title_size], padding_bottom: config[:title_padding], text_align: alignment }) %>
6
8
  <% if size == "sm" %>
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "base64"
4
+
3
5
  module Playbook
4
6
  module PbEmptyState
5
7
  class EmptyState < Playbook::KitBase
@@ -104,6 +106,47 @@ module Playbook
104
106
  "data:image/svg+xml,#{encoded}"
105
107
  end
106
108
 
109
+ def resolved_image_url
110
+ case image
111
+ when "default"
112
+ default_image_data_uri
113
+ when "this_is_fine"
114
+ svg_preset_data_uri("this_is_fine.svg")
115
+ when "travolta_lost"
116
+ gif_preset_data_uri("travolta_lost.gif")
117
+ when nil, ""
118
+ nil
119
+ else
120
+ image
121
+ end
122
+ end
123
+
124
+ def image_alt_text
125
+ case image
126
+ when "this_is_fine"
127
+ "This is fine illustration"
128
+ when "travolta_lost"
129
+ "Confused reaction illustration"
130
+ when "default"
131
+ "Empty state illustration"
132
+ else
133
+ "Empty state image"
134
+ end
135
+ end
136
+
137
+ def svg_preset_data_uri(filename)
138
+ path = File.join(__dir__, "docs", "default_image", filename)
139
+ svg = File.read(path)
140
+ "data:image/svg+xml,#{ERB::Util.url_encode(svg)}"
141
+ end
142
+
143
+ def gif_preset_data_uri(filename)
144
+ path = File.join(__dir__, "docs", "default_image", filename)
145
+ binary = File.binread(path)
146
+ b64 = Base64.strict_encode64(binary)
147
+ "data:image/gif;base64,#{b64}"
148
+ end
149
+
107
150
  def padding_size
108
151
  size == "sm" ? "xs" : "xl"
109
152
  end
@@ -142,7 +142,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
142
142
  // Determine if toolbar should be shown
143
143
  const shouldShowToolbar = focus && advancedEditor ? showToolbarOnFocus : advancedEditorToolbar
144
144
 
145
- const labelFor = advancedEditor ? fieldId : (id ? id : (inputOptions?.id ? `${inputOptions.id}_trix` : undefined))
145
+ const labelFor = advancedEditor ? fieldId : (id ? id : (inputOptions.id ? `${inputOptions.id}_trix` : undefined))
146
146
 
147
147
  return (
148
148
  <div
@@ -8,53 +8,38 @@
8
8
  @import "../tokens/transition";
9
9
  @import "previewer_mixin";
10
10
 
11
- // Rails TipTap root: flex/grid children default to min-width: auto, so the toolbar’s
12
- // intrinsic width can force horizontal page/dialog scroll. Pin the kit to the parent width.
13
- [data-pb-rte-tiptap="true"] {
14
- box-sizing: border-box;
15
- display: block;
16
- max-width: 100%;
17
- min-width: 0;
18
- width: 100%;
19
- }
20
-
21
- .pb_rich_text_editor_kit {
22
- box-sizing: border-box;
23
- max-width: 100%;
24
- min-width: 0;
25
-
26
- &.inline {
27
- .toolbar {
28
- opacity: 0;
29
- transition: all 0.3s ease-in-out 0s;
30
- }
31
-
32
- &:focus-within .toolbar {
33
- opacity: 100;
34
- }
35
-
36
- .ProseMirror {
37
- border: 1px solid transparent;
38
- transition: all 0.3s ease-in-out 0s;
39
- }
40
-
41
- &:focus-within .ProseMirror {
42
- border: 1px solid $input_border_default;
43
- border-top: none;
44
- }
45
-
46
- &:hover {
47
- .toolbar {
48
- opacity: 100;
49
- }
50
-
51
- .ProseMirror {
52
- border: 1px solid $input_border_default;
53
- border-top: none;
11
+ [class^="pb_rich_text_editor_kit"] {
12
+ &.inline {
13
+ .toolbar {
14
+ opacity: 0;
15
+ transition: all 0.3s ease-in-out 0s;
16
+ }
17
+
18
+ &:focus-within .toolbar {
19
+ opacity: 100;
20
+ }
21
+
22
+ .ProseMirror {
23
+ border: 1px solid transparent;
24
+ transition: all 0.3s ease-in-out 0s;
25
+ }
26
+
27
+ &:focus-within .ProseMirror {
28
+ border: 1px solid $input_border_default;
29
+ border-top: none;
30
+ }
31
+
32
+ &:hover {
33
+ .toolbar {
34
+ opacity: 100;
35
+ }
36
+
37
+ .ProseMirror {
38
+ border: 1px solid $input_border_default;
39
+ border-top: none;
40
+ }
41
+ }
54
42
  }
55
- }
56
- }
57
-
58
43
  .toolbar_button {
59
44
  display: flex;
60
45
  align-items: center;
@@ -88,76 +73,18 @@
88
73
  }
89
74
  }
90
75
 
91
- // Active state for toolbar (Rails kit uses pb_button_kit pb_button_link; override link variant when active)
92
- .toolbar button.pb_button_kit.is-active {
93
- color: $primary;
94
- background-color: $bg_light;
95
- }
96
-
97
76
  .pb_rich_text_editor_tiptap_toolbar_sticky {
98
77
  position: sticky;
99
78
  top: 0;
100
79
  z-index: 10;
101
80
  }
102
-
103
- .rte-editor-wrap {
104
- box-sizing: border-box;
105
- max-width: 100%;
106
- min-width: 0;
107
- }
108
-
109
- .pb_rich_text_editor_advanced_container {
110
- max-width: 100%;
111
- min-width: 0;
112
- }
113
-
114
81
  .toolbar {
115
82
  border-radius: $border_rad_heaviest $border_rad_heaviest 0 0;
116
83
  border: 1px solid $input_border_default;
117
84
  overflow-x: auto;
118
- // Single horizontal row + scroll in narrow modals/sidebars (wrap used to stack controls vertically).
119
85
  &_block {
120
- align-items: center;
121
- display: flex;
122
- flex-wrap: nowrap;
123
86
  gap: $space_xs;
124
- min-width: 0;
125
- overflow-x: auto;
126
- -webkit-overflow-scrolling: touch;
127
- }
128
-
129
- // React: keep one horizontal scroll on .toolbar (avoid nested scroll + trailing history cluster).
130
- &:not(.rte-rails-toolbar-layout) {
131
- > .pb_flex_kit.pb_flex_kit_justify_content_between {
132
- box-sizing: border-box;
133
- column-gap: $space_sm;
134
- flex-wrap: nowrap;
135
- justify-content: flex-start;
136
- min-width: 100%;
137
- width: max-content;
138
- }
139
-
140
- > .pb_flex_kit > .pb_flex_item_kit.toolbar_block {
141
- flex: 0 0 auto;
142
- min-width: 0;
143
- overflow-x: visible;
144
- }
145
-
146
- > .pb_flex_kit > .pb_flex_item_kit:last-child {
147
- flex: 0 0 auto;
148
- }
149
87
  }
150
-
151
- // Vertical section separators use ::before/::after with height: 100%. With
152
- // align-items: center on .toolbar_block the kit’s cross size was 0, so the
153
- // lines disappeared (master only had gap on .toolbar_block, default stretch).
154
- .pb_section_separator_kit.pb_section_separator_vertical {
155
- align-self: center;
156
- flex-shrink: 0;
157
- height: $space_xl;
158
- }
159
-
160
- // React ToolbarDropdown — match master (fixed width trigger; prod playbook.cloud).
161
88
  .editor-dropdown-button {
162
89
  background: transparent;
163
90
  border: none;
@@ -166,115 +93,23 @@
166
93
  font-weight: $light;
167
94
  padding: ($space_xs - 1) 0px;
168
95
  width: $space_xl * 3;
169
-
170
96
  &:focus-visible {
171
97
  box-shadow: unset;
172
98
  }
173
99
  }
174
-
175
- &.rte-rails-toolbar-layout {
176
- max-width: 100%;
177
- min-width: 0;
178
-
179
- .rte-rails-toolbar-row {
180
- align-items: center;
181
- box-sizing: border-box;
182
- column-gap: $space_sm;
183
- display: flex;
184
- flex-wrap: nowrap;
185
- justify-content: flex-start;
186
- min-width: 100%;
187
- padding: $space_xxs $space_sm;
188
- width: max-content;
189
- }
190
-
191
- .rte-toolbar-left {
192
- align-items: center;
193
- display: flex;
194
- flex: 0 0 auto;
195
- flex-wrap: nowrap;
196
- gap: $space_xs;
197
- min-width: 0;
198
- overflow-x: visible;
199
- }
200
-
201
- .rte-toolbar-right {
202
- align-items: center;
203
- display: flex;
204
- flex: 0 0 auto;
205
- gap: $space_xs;
206
- }
207
-
208
- // Align dropdown trigger with icon row (React wraps Popover + SectionSeparator in one flex line).
209
- .pb_popover_reference_wrapper {
210
- align-items: center;
211
- display: inline-flex;
212
- }
213
-
214
- // Override master’s fixed-width React trigger: Rails block-style label + icons needs flexible width.
215
- .editor-dropdown-button {
216
- justify-content: flex-start;
217
- letter-spacing: normal;
218
- line-height: 1;
219
- max-width: 100%;
220
- min-height: unset;
221
- padding: ($space_xs - 1) $space_xs;
222
- text-align: left;
223
- width: auto;
224
-
225
- .pb_button_content {
226
- align-items: center;
227
- display: inline-flex;
228
- line-height: 1;
229
- }
230
-
231
- .pb_button_content > .pb_flex_kit {
232
- align-items: center;
233
- }
234
-
235
- .rte-block-style-trigger-inner {
236
- align-items: center;
237
- }
238
-
239
- .rte-block-style-trigger-icon,
240
- .rte-block-style-chevron {
241
- display: inline-flex;
242
- flex-shrink: 0;
243
- line-height: 0;
244
-
245
- .pb_icon_kit {
246
- align-items: center;
247
- display: flex;
248
- line-height: 0;
249
- }
250
-
251
- svg {
252
- display: block;
253
- }
254
- }
255
-
256
- .rte-block-style-trigger-label {
257
- align-items: center;
258
- display: inline-flex;
259
- line-height: 1.2;
260
- }
261
-
262
- &:focus-visible {
263
- box-shadow: unset;
264
- }
265
- }
266
- }
267
100
  }
268
101
 
269
- // TipTap content — match master (prod playbook React tab).
270
102
  .ProseMirror {
271
103
  background: $white;
272
104
  border: 1px solid $input_border_default;
273
105
  border-radius: $border_rad_heaviest;
274
106
  height: 100%;
275
- line-height: $lh_loose;
276
107
  padding: 1rem 1.5rem 1.5rem 1.5rem;
108
+ line-height: $lh_loose;
277
109
  @include transition_default;
110
+ :first-child {
111
+ margin-top: 0;
112
+ }
278
113
 
279
114
  h4,
280
115
  h5,
@@ -326,32 +161,9 @@
326
161
  ul {
327
162
  @include preview_tiptap_ul;
328
163
  }
329
-
330
- // After heading mixins: first block should not pick up extra top margin (wins over `p { margin-top: 1rem }`).
331
- > :first-child {
332
- margin-top: 0;
333
- }
334
- }
335
-
336
- // Toolbar + editor stack: toolbar keeps its border; editor has no top stroke (classic layout).
337
- // Avoid relying on a wrapper-only frame — partial deploys then looked “borderless” because
338
- // ProseMirror had been forced to border: none.
339
- .pb_rich_text_editor_advanced_container.toolbar-active {
340
- .ProseMirror {
341
- border-top: none;
342
- border-top-left-radius: initial;
343
- border-top-right-radius: initial;
344
- }
345
164
  }
346
165
  }
347
166
 
348
- // Rails-only: outer kit sets `data-pb-rte-tiptap` — roomier padding + wrapping for vanilla TipTap in forms/dialogs.
349
- [data-pb-rte-tiptap="true"] .pb_rich_text_editor_kit .ProseMirror {
350
- overflow-wrap: anywhere;
351
- padding: 1.25rem 1.5rem 1.5rem 1.5rem;
352
- word-break: break-word;
353
- }
354
-
355
167
  .pb_tiptap_toolbar_dropdown_list_item {
356
168
  &.is-active,
357
169
  &:active {
@@ -376,51 +188,20 @@
376
188
  }
377
189
  }
378
190
  }
379
-
380
- // Rails RTE: block-style menu uses Nav (popover) instead of React NavItem class hook.
381
- .pb_rich_text_editor_kit .pb_popover_tooltip .pb_nav_list_item_link.is-active {
382
- background-color: $bg_light;
383
- border-radius: unset !important;
384
- color: $primary;
385
-
386
- .pb_nav_list_item_text,
387
- .pb_nav_list_item_icon_left {
388
- color: $primary !important;
389
- }
390
- }
391
-
392
- .pb_rich_text_editor_kit .pb_popover_tooltip .pb_nav_list_kit_item:hover .pb_nav_list_item_link:not(.is-active) {
393
- background-color: $neutral_subtle;
394
- border-radius: unset !important;
395
-
396
- .pb_nav_list_item_text,
397
- .pb_nav_list_item_icon_left {
398
- background-color: unset;
399
- color: $text_lt_light !important;
400
- }
401
- }
402
-
403
- // No toolbar: ring the whole control.
404
- .pb_rich_text_editor_advanced_container:not(.toolbar-active) {
191
+ .pb_rich_text_editor_advanced_container {
405
192
  transition: box-shadow 0.3s ease-in-out, border-radius 0.3s ease-in-out;
406
193
  &:focus-visible,
407
194
  &:focus-within {
408
- border-radius: $border_rad_heaviest;
409
- box-shadow: 0 0 0 1px $input_border_state;
410
195
  outline: unset;
196
+ box-shadow: 0 0 0 1px $input_border_state;
197
+ border-radius: $border_rad_heaviest;
411
198
  transition: box-shadow 0.3s ease-in-out, border-radius 0.3s ease-in-out;
412
199
  }
413
- }
414
-
415
- // Toolbar + editor: use border color (not an outer box-shadow) so the bottom isn’t doubled.
416
- .pb_rich_text_editor_advanced_container.toolbar-active {
417
- &:focus-within {
418
- .toolbar {
419
- border-color: $input_border_state;
420
- }
421
-
422
- .ProseMirror {
423
- border-color: $input_border_state;
200
+ &.toolbar-active {
201
+ .ProseMirror {
202
+ border-top: none;
203
+ border-top-left-radius: initial;
204
+ border-top-right-radius: initial;
424
205
  }
425
206
  }
426
207
  }
@@ -1,8 +1,6 @@
1
1
  examples:
2
2
 
3
3
  rails:
4
- - rich_text_editor_rails_default: "Rails (TipTap)"
5
- - rich_text_editor_rails_simple: "Rails (TipTap — Simple toolbar)"
6
4
 
7
5
  react:
8
6
  - rich_text_editor_advanced_default: Advanced Default