playbook_ui 15.4.0.pre.alpha.play254712379 → 15.4.0.pre.alpha.testing6712538

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 (136) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +2 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +1 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +3 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +1 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_editing.jsx +3 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +2 -1
  8. data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +21 -8
  9. data/app/pb_kits/playbook/pb_copy_button/copy_button.html.erb +6 -2
  10. data/app/pb_kits/playbook/pb_copy_button/copy_button.rb +3 -0
  11. data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +24 -0
  12. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.html.erb +9 -0
  13. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.jsx +24 -0
  14. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_rails.md +1 -0
  15. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_react.md +1 -0
  16. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.html.erb +2 -2
  17. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx +1 -2
  18. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.html.erb +2 -2
  19. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx +2 -0
  20. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +2 -0
  21. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +1 -0
  22. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.md +1 -0
  23. data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_rails.md +1 -0
  24. data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_react.md +1 -0
  25. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +10 -0
  26. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +10 -0
  27. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.md +1 -0
  28. data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_rails.md +1 -0
  29. data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_react.md +1 -0
  30. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +7 -0
  31. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +7 -0
  32. data/app/pb_kits/playbook/pb_currency/docs/_description.md +2 -2
  33. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +3 -0
  34. data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -0
  35. data/app/pb_kits/playbook/pb_date_time/date_time.rb +1 -0
  36. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +4 -0
  37. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +14 -0
  38. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +1 -0
  39. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +1 -0
  40. data/app/pb_kits/playbook/pb_date_time/docs/example.yml +3 -1
  41. data/app/pb_kits/playbook/pb_date_time/docs/index.js +1 -0
  42. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +3 -0
  43. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +2 -2
  44. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +2 -0
  45. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +33 -0
  46. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +4 -0
  47. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +22 -0
  48. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +1 -0
  49. data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +3 -1
  50. data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +1 -0
  51. data/app/pb_kits/playbook/pb_dropdown/index.js +31 -13
  52. data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_alignment.jsx +2 -1
  53. data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_default.jsx +2 -1
  54. data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_orientation.jsx +2 -1
  55. data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_size.jsx +2 -1
  56. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +4 -1
  57. data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.jsx +1 -1
  58. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors.jsx +1 -1
  59. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.jsx +1 -1
  60. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.jsx +1 -1
  61. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_horizontal.jsx +1 -1
  62. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend.jsx +1 -1
  63. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_non_clickable.jsx +1 -2
  64. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.jsx +1 -1
  65. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_negative_numbers.jsx +1 -1
  66. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_secondary_y_axis.jsx +1 -1
  67. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.jsx +1 -2
  68. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.jsx +1 -2
  69. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.jsx +2 -1
  70. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.jsx +2 -1
  71. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.jsx +1 -1
  72. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.jsx +2 -1
  73. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_labels.jsx +1 -1
  74. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_legend.jsx +1 -1
  75. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +1 -1
  76. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_inner_sizes.jsx +1 -1
  77. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_live_data.jsx +2 -1
  78. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_rounded.jsx +1 -1
  79. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_with_title.jsx +1 -1
  80. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.jsx +1 -1
  81. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.jsx +2 -1
  82. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.jsx +2 -1
  83. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.jsx +2 -1
  84. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.jsx +2 -1
  85. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.jsx +2 -1
  86. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.jsx +1 -1
  87. data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.jsx +4 -1
  88. data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +3 -1
  89. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +1 -1
  90. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +8 -61
  91. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +2 -10
  92. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +11 -19
  93. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +1 -5
  94. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +1 -1
  95. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -2
  96. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +7 -16
  97. data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +3 -1
  98. data/app/pb_kits/playbook/pb_table/_table.tsx +28 -26
  99. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +4 -1
  100. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
  101. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -0
  102. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +2 -1
  103. data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +1 -1
  104. data/app/pb_kits/playbook/utilities/_truncate.scss +2 -0
  105. data/app/pb_kits/playbook/utilities/globalProps.ts +26 -8
  106. data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +18 -0
  107. data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +18 -0
  108. data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +18 -0
  109. data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +18 -0
  110. data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +18 -0
  111. data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +18 -0
  112. data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +18 -0
  113. data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +18 -0
  114. data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +18 -0
  115. data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +18 -0
  116. data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +18 -0
  117. data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +18 -0
  118. data/dist/chunks/_typeahead-kRdz5zPn.js +6 -0
  119. data/dist/chunks/lib-CgpqUb6l.js +29 -0
  120. data/dist/chunks/vendor.js +37 -1
  121. data/dist/playbook-rails-react-bindings.js +1 -1
  122. data/dist/playbook-rails.js +1 -1
  123. data/dist/playbook.css +1 -1
  124. data/lib/playbook/version.rb +1 -1
  125. metadata +21 -13
  126. data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +0 -58
  127. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default_rails.md +0 -7
  128. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline_rails.md +0 -1
  129. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky_rails.md +0 -1
  130. data/dist/chunks/_line_graph-8BUASxIP.js +0 -1
  131. data/dist/chunks/_typeahead-DESMSfUO.js +0 -24
  132. data/dist/chunks/_weekday_stacked-EQMaMJvC.js +0 -37
  133. data/dist/chunks/componentRegistry-DzmmLR2x.js +0 -1
  134. data/dist/chunks/lib-CzQFzKzw.js +0 -29
  135. data/dist/chunks/pb_form_validation-Bf9TK15t.js +0 -1
  136. data/dist/playbook-doc.js +0 -1
@@ -33,6 +33,8 @@ export default class PbDropdown extends PbEnhancedElement {
33
33
  this.formPillProps = this.element.dataset.formPillProps
34
34
  ? JSON.parse(this.element.dataset.formPillProps)
35
35
  : {};
36
+ const baseInput = this.element.querySelector(DROPDOWN_INPUT);
37
+ this.wasOriginallyRequired = baseInput && baseInput.hasAttribute("required");
36
38
  this.setDefaultValue();
37
39
  this.bindEventListeners();
38
40
  this.bindSearchInput();
@@ -356,17 +358,6 @@ export default class PbDropdown extends PbEnhancedElement {
356
358
  }
357
359
 
358
360
  clearFormValidation(input) {
359
- if (input.checkValidity()) {
360
- const dropdownWrapperElement = input.closest(".dropdown_wrapper");
361
- dropdownWrapperElement.classList.remove("error");
362
-
363
- const errorLabelElement = dropdownWrapperElement.querySelector(
364
- ".pb_body_kit_negative"
365
- );
366
- if (errorLabelElement) {
367
- errorLabelElement.remove();
368
- }
369
- }
370
361
  if (this.isMultiSelect) {
371
362
  if (this.selectedOptions.size > 0) {
372
363
  const dropdownWrapperElement = input.closest(".dropdown_wrapper");
@@ -377,6 +368,19 @@ export default class PbDropdown extends PbEnhancedElement {
377
368
  if (errorLabelElement) {
378
369
  errorLabelElement.remove();
379
370
  }
371
+ return;
372
+ }
373
+ }
374
+
375
+ if (input.checkValidity()) {
376
+ const dropdownWrapperElement = input.closest(".dropdown_wrapper");
377
+ dropdownWrapperElement.classList.remove("error");
378
+
379
+ const errorLabelElement = dropdownWrapperElement.querySelector(
380
+ ".pb_body_kit_negative"
381
+ );
382
+ if (errorLabelElement) {
383
+ errorLabelElement.remove();
380
384
  }
381
385
  }
382
386
  }
@@ -585,7 +589,9 @@ export default class PbDropdown extends PbEnhancedElement {
585
589
  // for multi_select, for each selectedOption, create a hidden input
586
590
  const name = baseInput.getAttribute("name");
587
591
  this.selectedOptions.forEach((raw) => {
588
- const id = JSON.parse(raw).id;
592
+ const optionData = JSON.parse(raw);
593
+ // Use id if available, otherwise fall back to value
594
+ const id = optionData.id || optionData.value;
589
595
  const inp = document.createElement("input");
590
596
  inp.type = "hidden";
591
597
  inp.name = name;
@@ -593,7 +599,19 @@ export default class PbDropdown extends PbEnhancedElement {
593
599
  inp.dataset.generated = "true";
594
600
  baseInput.insertAdjacentElement("afterend", inp);
595
601
  });
596
- baseInput.value = "";
602
+
603
+ // For multi-select, remove required from base input when there are selections
604
+ // The generated inputs handle the form submission with actual values
605
+ // Restore required attribute when there are no selections (if it was originally required)
606
+ if (this.selectedOptions.size > 0) {
607
+ baseInput.value = "";
608
+ baseInput.removeAttribute("required");
609
+ } else {
610
+ baseInput.value = "";
611
+ if (this.wasOriginallyRequired) {
612
+ baseInput.setAttribute("required", "");
613
+ }
614
+ }
597
615
  }
598
616
 
599
617
  handleBackspaceClear() {
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
- import { EmptyState, Flex } from 'playbook-ui'
2
+ import EmptyState from '../_empty_state'
3
+ import Flex from '../../pb_flex/_flex'
3
4
 
4
5
  const EmptyStateAlignment = (props) => (
5
6
  <Flex align="center"
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
- import { EmptyState, Flex } from 'playbook-ui'
2
+ import EmptyState from '../_empty_state'
3
+ import Flex from '../../pb_flex/_flex'
3
4
 
4
5
  const EmptyStateDefault = (props) => (
5
6
  <Flex align="center"
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
- import { EmptyState, Flex } from 'playbook-ui'
2
+ import EmptyState from '../_empty_state'
3
+ import Flex from '../../pb_flex/_flex'
3
4
 
4
5
  const EmptyStateOrientation = (props) => (
5
6
  <Flex align="center"
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
- import { EmptyState, Flex } from 'playbook-ui'
2
+ import EmptyState from '../_empty_state'
3
+ import Flex from '../../pb_flex/_flex'
3
4
 
4
5
  const EmptyStateSize = (props) => (
5
6
  <Flex align="center"
@@ -1,5 +1,8 @@
1
1
  import React from 'react'
2
- import { Card, Caption, FormPill, Typeahead } from 'playbook-ui'
2
+ import Card from '../../pb_card/_card'
3
+ import Caption from '../../pb_caption/_caption'
4
+ import FormPill from '../_form_pill'
5
+ import Typeahead from '../../pb_typeahead/_typeahead'
3
6
 
4
7
  const names = [
5
8
  { label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { LoadingInline } from 'playbook-ui'
2
+ import LoadingInline from '../_loading_inline'
3
3
 
4
4
  const LoadingInlineVariant = (props) => {
5
5
  return (
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
  import colors from '../../tokens/exports/_colors.module.scss'
4
4
 
5
5
  const chartData = [{
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
  const chartData = [{
5
5
  name: 'Installation',
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
  const chartData = [{
5
5
  name: 'Number of Installations',
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
 
5
5
  const chartOptions = {
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
 
5
5
  const chartData = [{
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
3
-
2
+ import PbBarGraph from '../_pb_bar_graph'
4
3
 
5
4
  const chartData = [{
6
5
  name: 'Number of Installations',
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
  import Title from "../../pb_title/_title"
4
4
 
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
 
5
5
  const chartData = [{
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
  import colors from '../../tokens/exports/_colors.module.scss'
5
5
  import typography from '../../tokens/exports/_typography.module.scss'
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
3
-
2
+ import PbBarGraph from '../_pb_bar_graph'
4
3
 
5
4
  const chartData = [{
6
5
  name: 'Number of Installations',
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
3
-
2
+ import PbBarGraph from '../_pb_bar_graph'
4
3
 
5
4
  const chartData = [{
6
5
  name: 'Installation',
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { PbCircleChart, Title } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
+ import Title from "../../pb_title/_title";
3
4
 
4
5
  const data= [
5
6
  {
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { PbCircleChart, colors } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
+ import colors from '../../tokens/exports/_colors.module.scss';
3
4
 
4
5
  const data= [
5
6
  {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const data = [
5
5
  {
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { PbCircleChart, Title } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
+ import Title from "../../pb_title/_title";
3
4
 
4
5
  const dataFirst = [
5
6
  {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const data = [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const data = [{
5
5
  name: 'Bugs',
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const chartOptions = {
5
5
  series: [
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const dataFirst = [
5
5
  {
@@ -1,5 +1,6 @@
1
1
  import React, { useState } from "react";
2
- import { PbCircleChart, Button } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
+ import Button from "../../pb_button/_button";
3
4
 
4
5
  const chartData = [
5
6
  {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const data= [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const data= [
5
5
  {
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
- import { colors } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
4
 
5
5
  const data = [{ name: "Name", y: 67 }]
6
6
 
@@ -7,7 +7,8 @@ import Caption from '../../pb_caption/_caption'
7
7
  import Body from '../../pb_body/_body'
8
8
  import SectionSeparator from '../../pb_section_separator/_section_separator'
9
9
  import Title from '../../pb_title/_title'
10
- import { colors, typography } from 'playbook-ui'
10
+ import colors from '../../tokens/exports/_colors.module.scss'
11
+ import typography from '../../tokens/exports/_typography.module.scss'
11
12
 
12
13
  const data = [{ name: "Name", y: 10 }];
13
14
 
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
- import { colors, typography } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
+ import typography from '../../tokens/exports/_typography.module.scss'
4
5
 
5
6
  const data = [{ name: "Capacity", y: 75 }]
6
7
 
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
- import { colors, typography } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
+ import typography from '../../tokens/exports/_typography.module.scss'
4
5
 
5
6
  const chartOptions = {
6
7
  title: {
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
- import { colors, typography } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
+ import typography from '../../tokens/exports/_typography.module.scss'
4
5
 
5
6
  const data = [{ name: "Rating", y: 4.5 }]
6
7
 
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
- import { colors, typography } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
+ import typography from '../../tokens/exports/_typography.module.scss'
4
5
 
5
6
 
6
7
  const data1 = [
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import PbLineGraph from '../../pb_pb_line_graph/_pb_line_graph'
3
- import { colors } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
4
 
5
5
  const data = [{
6
6
  name: 'Installation',
@@ -1,5 +1,8 @@
1
1
  import React, { useState } from "react";
2
- import { PbReactPopover, CircleIconButton, Body, Flex } from "playbook-ui";
2
+ import PbReactPopover from "../_popover";
3
+ import Body from "../../pb_body/_body";
4
+ import Flex from "../../pb_flex/_flex";
5
+ import CircleIconButton from "../../pb_circle_icon_button/_circle_icon_button";
3
6
 
4
7
  const PopoverAppendTo = (props) => {
5
8
  const [showParentPopover, setShowParentPopover] = useState(false);
@@ -1,6 +1,8 @@
1
1
  import React from "react"
2
2
  import { useForm } from "react-hook-form"
3
- import { Radio, Flex, Body } from "playbook-ui"
3
+ import Radio from "../_radio"
4
+ import Body from "../../pb_body/_body"
5
+ import Flex from "../../pb_flex/_flex"
4
6
 
5
7
  const RadioReactHook = () => {
6
8
  const { register, watch } = useForm({
@@ -96,7 +96,7 @@ const EditorToolbar = ({ editor, extensions, simple, sticky }: any): React.React
96
96
  <SectionSeparator orientation="vertical" />
97
97
  <ToolbarNodes editor={editor} />
98
98
  {
99
- extensions && extensions.length > 0 && (
99
+ extensions && (
100
100
  <>
101
101
  <MoreExtensionsDropdown extensions={extensions}/>
102
102
  </>
@@ -2,10 +2,6 @@ import React, { useEffect, useState, useRef } from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { TrixEditor } from 'react-trix'
4
4
 
5
- import { useEditor, EditorContent } from '@tiptap/react'
6
- import StarterKit from '@tiptap/starter-kit'
7
- import Link from '@tiptap/extension-link'
8
-
9
5
  import inlineFocus from './inlineFocus'
10
6
  import useFocus from './useFocus'
11
7
  import { globalProps, GlobalProps } from '../utilities/globalProps'
@@ -52,8 +48,7 @@ type RichTextEditorProps = {
52
48
  sticky?: boolean,
53
49
  template: string,
54
50
  value?: string,
55
- maxWidth?: string,
56
- railsEditor?: boolean
51
+ maxWidth?: string
57
52
  } & GlobalProps
58
53
 
59
54
  const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
@@ -86,27 +81,6 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
86
81
  [showToolbarOnFocus, setShowToolbarOnFocus] = useState(false),
87
82
  containerRef = useRef<HTMLDivElement>(null)
88
83
 
89
- const isRails = !advancedEditor && props.railsEditor === true
90
-
91
- // TipTap editor for Rails (hook always runs per React rules, but only used when isRails is true)
92
- const railsTipTapEditor = useEditor({
93
- extensions: [StarterKit, Link],
94
- content: value || '',
95
- onUpdate: ({ editor }) => {
96
- if (!isRails) return
97
-
98
- const html = editor.getHTML()
99
- const text = editor.getText()
100
- onChange(html, text)
101
-
102
- // Update hidden input for TipTap Rails form submission
103
- const hiddenInput = document.getElementById(`hidden-input-${props.id || 'rich-text-editor'}`)
104
- if (hiddenInput) {
105
- (hiddenInput as HTMLInputElement).value = html ?? ''
106
- }
107
- },
108
- }, [isRails, value])
109
-
110
84
  const htmlProps = buildHtmlProps(htmlOptions)
111
85
 
112
86
  const handleOnEditorReady = (editorInstance: Editor) => {
@@ -166,8 +140,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
166
140
  }
167
141
 
168
142
  useEffect(() => {
169
- const tiptapEditor = advancedEditor || railsTipTapEditor
170
- if (!tiptapEditor || !focus) return
143
+ if (!advancedEditor || !focus) return
171
144
 
172
145
  const handleFocus = () => setShowToolbarOnFocus(true)
173
146
 
@@ -176,7 +149,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
176
149
  setShowToolbarOnFocus(false)
177
150
  }
178
151
 
179
- const editorElement = tiptapEditor?.view?.dom
152
+ const editorElement = advancedEditor?.view?.dom
180
153
  if (editorElement) {
181
154
  editorElement.addEventListener('focus', handleFocus)
182
155
  }
@@ -189,7 +162,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
189
162
  }
190
163
  document.removeEventListener('mousedown', handleClickOutside)
191
164
  }
192
- }, [advancedEditor, railsTipTapEditor, focus])
165
+ }, [advancedEditor, focus])
193
166
 
194
167
  //============= end focus prop with advanced editor=================
195
168
 
@@ -200,17 +173,6 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
200
173
  editor.insertHTML(template)
201
174
  }, [editor, template])
202
175
 
203
- // Handle value prop changes for Rails TipTap editor
204
- useEffect(() => {
205
- if (!railsTipTapEditor) return
206
- const currentContent = railsTipTapEditor.getHTML()
207
- const newValue = value || ''
208
-
209
- if (currentContent !== newValue) {
210
- railsTipTapEditor.commands.setContent(newValue)
211
- }
212
- }, [railsTipTapEditor, value])
213
-
214
176
  useEffect(() => {
215
177
  if (!editor?.element) return
216
178
  editor.element.addEventListener('click', ({ target }: Event) => {
@@ -238,11 +200,8 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
238
200
  className
239
201
  )
240
202
 
241
- // Get the TipTap editor instance (either passed from React or auto-initialized for Rails)
242
- const tipTapEditor = advancedEditor || (isRails ? railsTipTapEditor : null)
243
-
244
203
  // Determine if toolbar should be shown
245
- const shouldShowToolbar = focus && tipTapEditor ? showToolbarOnFocus : advancedEditorToolbar
204
+ const shouldShowToolbar = focus && advancedEditor ? showToolbarOnFocus : advancedEditorToolbar
246
205
 
247
206
  return (
248
207
  <div
@@ -253,32 +212,20 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
253
212
  ref={focus ? containerRef : undefined}
254
213
  >
255
214
  {
256
- // Render TipTap editor if indicated (React with advancedEditor or Rails by default (railsEditor is true), otherwise Trix
257
- tipTapEditor ? (
215
+ advancedEditor ? (
258
216
  <div
259
217
  className={classnames("pb_rich_text_editor_advanced_container", {
260
218
  ["toolbar-active"]: shouldShowToolbar,
261
219
  })}
262
220
  >
263
221
  {shouldShowToolbar && (
264
- <EditorToolbar editor={tipTapEditor}
222
+ <EditorToolbar editor={advancedEditor}
265
223
  extensions={extensions}
266
224
  simple={simple}
267
225
  sticky={sticky}
268
226
  />
269
227
  )}
270
- {/* EditorContent for Rails railsTipTapEditor, children for React TipTap advancedEditor */}
271
- {railsTipTapEditor ? <EditorContent editor={tipTapEditor} /> : <>{children}</>}
272
-
273
- {/* Set up hidden input for TipTap Rails form submission */}
274
- {railsTipTapEditor && (
275
- <input
276
- id={`hidden-input-${props.id || 'rich-text-editor'}`}
277
- name={name || 'content'}
278
- type="hidden"
279
- value={tipTapEditor?.getHTML() ?? ''}
280
- />
281
- )}
228
+ { children }
282
229
  </div>
283
230
  ) : (
284
231
  <TrixEditor
@@ -1,11 +1,3 @@
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
- }) %>
1
+ <%= pb_rails("rich_text_editor", props: {focus: true}) %>
6
2
  <br>
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
- }) %>
3
+ <%= pb_rails("rich_text_editor", props: {focus: true}) %>
@@ -1,38 +1,30 @@
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" }) %>
8
1
 
2
+ <%= pb_rails("rich_text_editor", props: { id: "content-preview-editor" }) %>
9
3
  <div id="card-obfuscation" style="display:none">
10
4
  <%= pb_rails("card", props: { margin_top: "md", max_width: "md", padding: "sm" }) do %>
11
- <div id="content-preview" class="tiptap-content">
5
+ <div id="content-preview" class="trix-content">
12
6
  </div>
13
7
  <% end %>
14
8
  </div>
9
+ <%= pb_rails("button", props: { id: "preview-button", variant: "secondary", margin_top: "md" }) do %>
10
+ <span>Preview Output</span>
11
+ <% end %>
15
12
 
16
13
  <script>
17
14
  document.addEventListener('DOMContentLoaded', () => {
18
15
  function handleButtonClick() {
19
- // Find the specific TipTap editor container by ID
20
16
  const editorContainer = [...document.querySelectorAll('[data-pb-react-props]')]
21
17
  .find(element => element.getAttribute('data-pb-react-props')?.includes('"id":"content-preview-editor"'))
22
18
 
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')
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 || ''
30
24
  const previewArea = document.getElementById('content-preview')
31
25
  const cardDiv = document.getElementById('card-obfuscation')
32
26
 
33
- if (tiptapEditor && previewArea && cardDiv) {
34
- // Get the HTML content from the TipTap editor
35
- const editorContent = tiptapEditor.innerHTML || ''
27
+ if (previewArea && cardDiv) {
36
28
  previewArea.innerHTML = editorContent
37
29
  cardDiv.style.display = 'block'
38
30
  }
@@ -1,5 +1 @@
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
- }) %>
1
+ <%= pb_rails("rich_text_editor", props: {simple: true, id: "simple"}) %>