playbook_ui 16.3.0 → 16.4.0.pre.alpha.PLAY2846reactadvancedtablecalcheaderpinnedrows15356

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 (148) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +17 -4
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +3 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +5 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +21 -9
  6. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +5 -2
  7. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +9 -11
  8. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +25 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowModelUtils.ts +100 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +65 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +12 -2
  12. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
  13. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +9 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +109 -2
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.jsx +50 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.md +1 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.html.erb +57 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.md +7 -0
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_parent_only.jsx +175 -0
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_parent_only.md +5 -0
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
  23. data/app/pb_kits/playbook/pb_advanced_table/index.js +130 -29
  24. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +6 -2
  25. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +21 -4
  26. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +115 -9
  27. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +3 -1
  28. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +12 -1
  29. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +4 -1
  30. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +9 -1
  31. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +6 -1
  32. data/app/pb_kits/playbook/pb_button/docs/_button_full_width_rails.md +19 -0
  33. data/app/pb_kits/playbook/pb_button/docs/_button_full_width_react.md +23 -0
  34. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +5 -0
  35. data/app/pb_kits/playbook/pb_collapsible/index.js +15 -26
  36. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +3 -1
  37. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +1 -1
  38. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.jsx +6 -3
  39. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.html.erb +3 -3
  40. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.jsx +6 -3
  41. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.html.erb +3 -3
  42. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.jsx +6 -3
  43. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +3 -0
  44. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -0
  45. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options_rails.html.erb +16 -0
  46. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options_rails.md +1 -0
  47. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.html.erb +224 -0
  48. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.md +7 -0
  49. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
  50. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +8 -1
  51. data/app/pb_kits/playbook/pb_dropdown/index.js +255 -46
  52. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +19 -14
  53. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +4 -0
  54. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +3 -0
  55. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin.html.erb +46 -0
  56. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin.jsx +42 -0
  57. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin_rails.md +1 -0
  58. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin_react.md +1 -0
  59. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  60. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +2 -1
  61. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +7 -1
  62. data/app/pb_kits/playbook/pb_icon/icon.rb +7 -1
  63. data/app/pb_kits/playbook/pb_list/_list_mixin.scss +4 -4
  64. data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +1 -1
  65. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +27 -16
  66. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_placeholder.html.erb +109 -0
  67. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_placeholder.jsx +127 -0
  68. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_placeholder.md +1 -0
  69. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +2 -0
  70. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -0
  71. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +3 -0
  72. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.test.jsx +27 -0
  73. data/app/pb_kits/playbook/pb_popover/docs/_popover_placement.jsx +81 -0
  74. data/app/pb_kits/playbook/pb_popover/docs/_popover_placement_react.md +1 -0
  75. data/app/pb_kits/playbook/pb_popover/docs/_popover_position.html.erb +128 -0
  76. data/app/pb_kits/playbook/pb_popover/docs/_popover_position_rails.md +1 -0
  77. data/app/pb_kits/playbook/pb_popover/docs/example.yml +2 -0
  78. data/app/pb_kits/playbook/pb_popover/docs/index.js +2 -1
  79. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +35 -134
  80. data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_editor.tsx +51 -0
  81. data/app/pb_kits/playbook/pb_rich_text_editor/_trix_editor.tsx +206 -0
  82. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +56 -0
  83. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.md +1 -0
  84. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +13 -21
  85. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +0 -10
  86. data/app/pb_kits/playbook/pb_rich_text_editor/inlineFocus.ts +5 -4
  87. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss +19 -1
  88. data/app/pb_kits/playbook/pb_table/_table.tsx +24 -21
  89. data/app/pb_kits/playbook/pb_table/docs/_sections.yml +1 -0
  90. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.html.erb +45 -0
  91. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md +39 -0
  92. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +2 -1
  93. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props.jsx +152 -0
  94. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props.md +17 -0
  95. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props_rails.html.erb +121 -0
  96. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props_rails.md +17 -0
  97. data/app/pb_kits/playbook/pb_table/docs/example.yml +3 -0
  98. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  99. data/app/pb_kits/playbook/pb_table/table.html.erb +17 -13
  100. data/app/pb_kits/playbook/pb_table/table.rb +8 -0
  101. data/app/pb_kits/playbook/pb_table/table.test.js +33 -0
  102. data/app/pb_kits/playbook/pb_textarea/_textarea.scss +4 -1
  103. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +105 -3
  104. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +20 -8
  105. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.md +3 -0
  106. data/app/pb_kits/playbook/utilities/_hover.scss +6 -3
  107. data/app/pb_kits/playbook/utilities/domHelpers.ts +50 -0
  108. data/dist/chunks/{_pb_line_graph-CKBPxTmM.js → _pb_line_graph-D6s5rymw.js} +1 -1
  109. data/dist/chunks/_typeahead-BNp_YiTh.js +1 -0
  110. data/dist/chunks/componentRegistry-DRSp5D_e.js +1 -0
  111. data/dist/chunks/{globalProps-DLCfJwiU.js → globalProps-Ds_6HBhX.js} +1 -1
  112. data/dist/chunks/lib-BaO72ugL.js +29 -0
  113. data/dist/chunks/vendor.js +5 -5
  114. data/dist/menu.yml +3 -2
  115. data/dist/playbook-rails-react-bindings.js +1 -1
  116. data/dist/playbook-rails.js +1 -1
  117. data/dist/playbook.css +1 -1
  118. data/lib/playbook/pb_forms_helper.rb +3 -0
  119. data/lib/playbook/version.rb +2 -2
  120. metadata +42 -32
  121. data/app/pb_kits/playbook/pb_button/docs/_button_full_width.md +0 -1
  122. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.html.erb +0 -5
  123. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.jsx +0 -15
  124. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +0 -1
  125. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +0 -3
  126. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.jsx +0 -17
  127. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.html.erb +0 -6
  128. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.jsx +0 -16
  129. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx +0 -28
  130. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md +0 -1
  131. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +0 -35
  132. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx +0 -45
  133. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.html.erb +0 -10
  134. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +0 -22
  135. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.md +0 -3
  136. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +0 -1
  137. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.jsx +0 -13
  138. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +0 -1
  139. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.jsx +0 -15
  140. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.html.erb +0 -115
  141. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.jsx +0 -42
  142. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.html.erb +0 -4
  143. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.jsx +0 -14
  144. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +0 -5
  145. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +0 -63
  146. data/dist/chunks/_typeahead-B7bktFm6.js +0 -1
  147. data/dist/chunks/componentRegistry-DzmmLR2x.js +0 -1
  148. data/dist/chunks/lib-QT_7rPYf.js +0 -29
@@ -0,0 +1,121 @@
1
+ <% users = [
2
+ { id: 1, name: "Jennifer", title: "Associate Scrum Master", department: "Business Technology", branch: "Philadelphia", start_date: Date.new(2025, 1, 1) },
3
+ { id: 2, name: "Nick", title: "UX Engineer II", department: "Business Technology", branch: "Philadelphia", start_date: Date.new(2025, 1, 2) },
4
+ { id: 3, name: "Nida", title: "Senior UX Engineer", department: "Business Technology", branch: "Philadelphia", start_date: Date.new(2025, 1, 3) },
5
+ { id: 4, name: "Justin", title: "Director of User Experience Engineering", department: "Business Technology", branch: "Philadelphia", start_date: Date.new(2025, 1, 4) },
6
+ { id: 5, name: "Edward", title: "UX Designer II", department: "Business Technology", branch: "Philadelphia", start_date: Date.new(2025, 1, 5) },
7
+ { id: 6, name: "Elisa", title: "UX Engineer", department: "Business Technology", branch: "Philadelphia", start_date: Date.new(2025, 1, 6) },
8
+ { id: 7, name: "Gary", title: "UX Engineer", department: "Business Technology", branch: "Philadelphia", start_date: Date.new(2025, 1, 7) },
9
+ { id: 8, name: "Barkley", title: "Nitro Quality Ninja", department: "Business Technology", branch: "Philadelphia", start_date: Date.new(2025, 1, 8) },
10
+ { id: 9, name: "Aaron", title: "Associate Nitro Quality Ninja", department: "Business Technology", branch: "Philadelphia", start_date: Date.new(2025, 1, 9) },
11
+ ] %>
12
+
13
+ <% filter_content =
14
+ pb_rails("text_input", props: {
15
+ label: "Territory ID",
16
+ placeholder: "Enter Territory ID"
17
+ }) +
18
+ pb_rails("typeahead", props: {
19
+ label: "Title",
20
+ options: [
21
+ { label: "Senior UX Engineer", value: "senior-ux-engineer" },
22
+ { label: "UX Engineer", value: "ux-engineer" },
23
+ { label: "UX Designer", value: "ux-designer" }
24
+ ]
25
+ }) +
26
+ pb_rails("select", props: {
27
+ blank_selection: "All Departments",
28
+ label: "Department",
29
+ options: [
30
+ { value: "Business Technology", text: "Business Technology" },
31
+ { value: "Customer Development", text: "Customer Development" },
32
+ { value: "Talent Acquisition", text: "Talent Acquisition" }
33
+ ]
34
+ }) +
35
+ pb_rails("dropdown", props: {
36
+ label: "Branch",
37
+ options: [
38
+ { label: "Philadelphia", value: "philadelphia" },
39
+ { label: "New York", value: "new-york" },
40
+ { label: "Austin", value: "austin" }
41
+ ]
42
+ }) +
43
+ pb_rails("date_picker", props: {
44
+ label: "Start Date",
45
+ padding_y: "sm",
46
+ picker_id: "startedOn"
47
+ }) +
48
+ pb_rails("flex", props: { spacing: "between" }) do
49
+ pb_rails("button", props: {
50
+ text: "Filter",
51
+ }) +
52
+ pb_rails("button", props: {
53
+ text: "Defaults",
54
+ variant: "secondary"
55
+ })
56
+ end
57
+ %>
58
+
59
+ <%= pb_rails("table", props: {
60
+ card_props: {
61
+ margin_x: {
62
+ xs: "sm",
63
+ sm: "sm",
64
+ md: "xl",
65
+ lg: "xl",
66
+ xl: "xl",
67
+ default: "xl",
68
+ }
69
+ },
70
+ variant: "with_filter",
71
+ title: "Table Title Here",
72
+ title_props: {
73
+ padding_left:{
74
+ xs: "sm",
75
+ sm: "sm",
76
+ md: "xl",
77
+ lg: "xl",
78
+ xl: "xl",
79
+ default: "xl",
80
+ }
81
+ },
82
+ filter_content: filter_content,
83
+ filter_props: {
84
+ id: "user-table-filters-1",
85
+ results: 9,
86
+ sort_menu: [
87
+ { item: "Start Date", link: "?q[sorts]=started_on+asc", active: true, direction: "asc" },
88
+ { item: "First Name", link: "?q[sorts]=name+asc", active: false },
89
+ { item: "Title", link: "?q[sorts]=title+asc", active: false },
90
+ { item: "Department", link: "?q[sorts]=department+asc", active: false },
91
+ { item: "Branch", link: "?q[sorts]=branch+asc", active: false },
92
+ { item: "Territory ID", link: "?q[sorts]=territory_id+asc", active: false },
93
+ ],
94
+ }
95
+ }) do %>
96
+ <%= pb_rails("table/table_head") do %>
97
+ <%= pb_rails("table/table_row") do %>
98
+ <%= pb_rails("table/table_header", props: { text: "Territory ID" }) %>
99
+ <%= pb_rails("table/table_header", props: { text: "Name" }) %>
100
+ <%= pb_rails("table/table_header", props: { text: "Title" }) %>
101
+ <%= pb_rails("table/table_header", props: { text: "Department" }) %>
102
+ <%= pb_rails("table/table_header", props: { text: "Branch" }) %>
103
+ <%= pb_rails("table/table_header", props: { text: "Start Date", text_align: "right" }) %>
104
+ <% end %>
105
+ <% end %>
106
+
107
+ <%= pb_rails("table/table_body") do %>
108
+ <% users.each do |user| %>
109
+ <%= pb_rails("table/table_row") do %>
110
+ <%= pb_rails("table/table_cell", props: { margin_x: { xs: "sm" }, number_spacing: "tabular" }) { user[:id].to_s } %>
111
+ <%= pb_rails("table/table_cell", props: { margin_x: { xs: "sm" } }) { user[:name] } %>
112
+ <%= pb_rails("table/table_cell", props: { margin_x: { xs: "sm" } }) { user[:title] } %>
113
+ <%= pb_rails("table/table_cell", props: { margin_x: { xs: "sm" } }) { user[:department] } %>
114
+ <%= pb_rails("table/table_cell", props: { margin_x: { xs: "sm" } }) { user[:branch] } %>
115
+ <%= pb_rails("table/table_cell", props: { margin_x: { xs: "sm" } }) do %>
116
+ <%= pb_rails("date", props: {alignment: "right", date: user[:start_date].to_s, show_current_year: true } ) %>
117
+ <% end %>
118
+ <% end %>
119
+ <% end %>
120
+ <% end %>
121
+ <% end %>
@@ -0,0 +1,17 @@
1
+ The `with_filter` variant also offers 2 additional optional props:
2
+
3
+ `card_props`: An object containing Card-specific props.
4
+ `title_props`: An object containing Title-specific props.
5
+
6
+ #### Default Card Props
7
+
8
+ The Table kit automatically sets these Card defaults (which you can override via `card_props`):
9
+
10
+ - `padding:"none"`
11
+
12
+ #### Default Title Props
13
+
14
+ The Table kit automatically sets these Title defaults (which you can override via `title_props`):
15
+
16
+ - `size:3`
17
+ - `paddingY:"md"`
@@ -41,7 +41,9 @@ examples:
41
41
  - table_with_header_style_borderless: Header Style Borderless
42
42
  - table_with_header_style_floating: Header Style Floating
43
43
  - table_with_filter_variant_rails: Variant with Filter
44
+ - table_with_filter_variant_external_filter_rails: Variant with Filter (External Filter)
44
45
  - table_with_filter_variant_with_pagination_rails: Variant with Filter and Pagination
46
+ - table_with_filter_with_card_title_props_rails: Variant with Filter (with Card and Title Props)
45
47
 
46
48
  react:
47
49
  - table_sm: Small
@@ -85,3 +87,4 @@ examples:
85
87
  - table_with_header_style_floating: Header Style Floating
86
88
  - table_with_filter_variant: Variant with Filter
87
89
  - table_with_filter_variant_with_pagination: Variant with Filter and Pagination
90
+ - table_with_filter_with_card_title_props: Variant with Filter (with Card and Title Props)
@@ -40,3 +40,4 @@ export { default as TableWithHeaderStyleBorderless } from './_table_with_header_
40
40
  export { default as TableWithHeaderStyleFloating } from './_table_with_header_style_floating.jsx'
41
41
  export { default as TableWithFilterVariant } from './_table_with_filter_variant.jsx'
42
42
  export { default as TableWithFilterVariantWithPagination } from './_table_with_filter_variant_with_pagination.jsx'
43
+ export { default as TableWithFilterWithCardTitleProps } from './_table_with_filter_with_card_title_props.jsx'
@@ -1,21 +1,25 @@
1
1
  <%# ------------ variant = 'withFilter' rendering ------------ %>
2
2
  <% if object.with_filter_variant? %>
3
- <%= pb_rails("title", props: {
4
- padding_left: { xs: "sm", sm: "sm", md: "xl", lg: "xl", xl: "xl", default: "xl" },
5
- padding_y: "md",
6
- size: 3,
7
- text: object.title
8
- }) if object.title.present? %>
9
- <%= pb_rails("card", props: {
10
- margin_x: { xs: "sm", sm: "sm", md: "xl", lg: "xl", xl: "xl", default: "xl" },
11
- padding: "none"
12
- }) do %>
3
+ <% default_card_props = {
4
+ padding: "none"
5
+ } %>
6
+ <% default_title_props = {
7
+ size: 3,
8
+ padding_y: "md"
9
+ } %>
10
+ <% merged_title_props = default_title_props.merge(object.title_props || {}) %>
11
+ <% merged_card_props = default_card_props.merge(object.card_props || {}) %>
12
+ <%= pb_rails("title", props: { text: object.title }.merge(merged_title_props)) if object.title.present? %>
13
+ <%= pb_rails("card", props: merged_card_props) do %>
13
14
  <%= pb_rails("flex", props: {
14
15
  align: "stretch",
15
16
  flex_direction: "column",
16
17
  gap: "none"
17
18
  }) do %>
18
- <% if object.filter_content.present? %>
19
+ <% has_filter = object.filter.present? || object.filter_content.present? %>
20
+ <% if object.filter.present? %>
21
+ <%= object.filter %>
22
+ <% elsif object.filter_content.present? %>
19
23
  <%
20
24
  default_filter_props = {
21
25
  background: false,
@@ -24,13 +28,13 @@
24
28
  popover_props: { width: "350px" },
25
29
  template: 'single'
26
30
  }
27
- merged_filter_props = default_filter_props.merge(object.filter_props)
31
+ merged_filter_props = default_filter_props.merge(object.filter_props || {})
28
32
  %>
29
33
  <%= pb_rails("filter", props: merged_filter_props) do %>
30
34
  <%= object.filter_content %>
31
35
  <% end %>
32
36
  <% end %>
33
- <%= pb_rails("section_separator") if object.filter_content.present? %>
37
+ <%= pb_rails("section_separator") if has_filter %>
34
38
  <% if object.pagination.present? %>
35
39
  <%= object.pagination %>
36
40
  <%= pb_rails("section_separator") %>
@@ -46,9 +46,17 @@ module Playbook
46
46
  prop :filter_props, type: Playbook::Props::HashProp,
47
47
  default: {}
48
48
  prop :filter_content
49
+ # Pre-rendered filter slot (e.g. output of capture { your_filter_helper }).
50
+ # When present, this is rendered as-is; filter_content and filter_props are ignored.
51
+ # Use this for manual filter submission or app-specific filter helpers.
52
+ prop :filter
49
53
  prop :pagination
50
54
  prop :title, type: Playbook::Props::String,
51
55
  default: nil
56
+ prop :card_props, type: Playbook::Props::HashProp,
57
+ default: {}
58
+ prop :title_props, type: Playbook::Props::HashProp,
59
+ default: {}
52
60
 
53
61
  def size_class
54
62
  variant === "with_filter" && size == "md" ? "sm" : size
@@ -327,3 +327,36 @@ test("renders default variant without Card wrapper", () => {
327
327
  expect(table).toBeInTheDocument()
328
328
  expect(table.closest('.pb_card_kit')).not.toBeInTheDocument()
329
329
  })
330
+
331
+ test("renders withFilter variant with cardProps and titleProps", () => {
332
+ const { container } = render(
333
+ <Table
334
+ cardProps={{ margin: "lg" }}
335
+ data={{testid: "with-filter-table-props"}}
336
+ title="Filter Table"
337
+ titleProps={{ paddingLeft: "lg" }}
338
+ variant="withFilter"
339
+ >
340
+ <Table.Head>
341
+ <Table.Row>
342
+ <Table.Header>{"Column 1"}</Table.Header>
343
+ </Table.Row>
344
+ </Table.Head>
345
+ <Table.Body>
346
+ <Table.Row>
347
+ <Table.Cell>{"Value 1"}</Table.Cell>
348
+ </Table.Row>
349
+ </Table.Body>
350
+ </Table>
351
+ )
352
+
353
+ const table = screen.getByTestId("with-filter-table-props")
354
+ expect(table).toBeInTheDocument()
355
+ const card = container.querySelector('.pb_card_kit')
356
+ expect(card).toBeInTheDocument()
357
+ expect(card).toHaveClass("m_lg")
358
+
359
+ const title = container.querySelector('.pb_title_kit')
360
+ expect(title).toBeInTheDocument()
361
+ expect(title).toHaveClass("pl_lg")
362
+ })
@@ -7,7 +7,10 @@
7
7
  .pb_textarea_kit {
8
8
  margin-bottom: $space_sm;
9
9
 
10
- .pb_caption_kit_md {
10
+ label {
11
+ display: block !important;
12
+ }
13
+ .pb_caption_kit_md_lighter {
11
14
  margin-bottom: $space_xs !important;
12
15
  display: block;
13
16
  }
@@ -137,6 +137,30 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(
137
137
  const [formSubmitted, setFormSubmitted] = useState(false)
138
138
  // State to track if user has made a selection (to disable defaultValue focus behavior)
139
139
  const [hasUserSelected, setHasUserSelected] = useState(false)
140
+ // Async loading state (used for aria-busy + optional external guards)
141
+ const [asyncLoading, setAsyncLoading] = useState(false)
142
+ const mountedRef = useRef(true)
143
+
144
+ // Watchdog + sequence to avoid stuck loading and stale request completion
145
+ const asyncLoadingTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(
146
+ null,
147
+ )
148
+ const asyncRequestSeqRef = useRef(0)
149
+
150
+ const clearAsyncLoadingTimeout = () => {
151
+ if (asyncLoadingTimeoutRef.current) {
152
+ clearTimeout(asyncLoadingTimeoutRef.current)
153
+ asyncLoadingTimeoutRef.current = null
154
+ }
155
+ }
156
+
157
+ useEffect(() => {
158
+ mountedRef.current = true
159
+ return () => {
160
+ mountedRef.current = false
161
+ clearAsyncLoadingTimeout()
162
+ }
163
+ }, [])
140
164
 
141
165
  // If preserveSearchInput is true, we need to control the input value
142
166
  const handleInputChange = preserveSearchInput
@@ -258,6 +282,84 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(
258
282
  }
259
283
  }
260
284
 
285
+ // Resolve loadOptions (string path to function) once
286
+ const resolvedLoadOptions =
287
+ isString(loadOptions) ? get(window, loadOptions) : loadOptions
288
+
289
+ // Wrap loadOptions to track async loading safely for BOTH callback + promise styles.
290
+ // Includes watchdog timeout + request sequencing to avoid stuck loading / stale clears.
291
+ const wrappedLoadOptions =
292
+ async
293
+ ? (inputValue: any, callback?: any) => {
294
+ const seq = ++asyncRequestSeqRef.current
295
+
296
+ if (mountedRef.current) setAsyncLoading(true)
297
+ clearAsyncLoadingTimeout()
298
+
299
+ // Start watchdog for ALL async calls (covers callback + promise + hung requests)
300
+ asyncLoadingTimeoutRef.current = setTimeout(() => {
301
+ if (!mountedRef.current) return
302
+ if (seq !== asyncRequestSeqRef.current) return
303
+ setAsyncLoading(false)
304
+ asyncLoadingTimeoutRef.current = null
305
+ }, 10000)
306
+
307
+ const wrappedCallback =
308
+ typeof callback === "function"
309
+ ? (options: any) => {
310
+ // Only clear if this is still the latest request
311
+ if (seq === asyncRequestSeqRef.current) {
312
+ clearAsyncLoadingTimeout()
313
+ if (mountedRef.current) setAsyncLoading(false)
314
+ }
315
+ return callback(options)
316
+ }
317
+ : undefined
318
+
319
+ let result
320
+ try {
321
+ // Preserve signature: if callback is provided, pass it through
322
+ result = wrappedCallback
323
+ ? resolvedLoadOptions(inputValue, wrappedCallback)
324
+ : resolvedLoadOptions(inputValue)
325
+ } catch (e) {
326
+ if (seq === asyncRequestSeqRef.current) {
327
+ clearAsyncLoadingTimeout()
328
+ if (mountedRef.current) setAsyncLoading(false)
329
+ }
330
+ throw e
331
+ }
332
+
333
+ // Promise-style completion
334
+ if (result && typeof (result as any).then === "function") {
335
+ return (result as Promise<any>)
336
+ .then((opts) => {
337
+ if (seq === asyncRequestSeqRef.current) {
338
+ clearAsyncLoadingTimeout()
339
+ if (mountedRef.current) setAsyncLoading(false)
340
+ }
341
+ return opts
342
+ })
343
+ .catch((e) => {
344
+ if (seq === asyncRequestSeqRef.current) {
345
+ clearAsyncLoadingTimeout()
346
+ if (mountedRef.current) setAsyncLoading(false)
347
+ }
348
+ throw e
349
+ })
350
+ }
351
+
352
+ // Callback-style will clear via wrappedCallback.
353
+ // Sync/no-callback/no-promise: clear immediately (and cancel watchdog)
354
+ if (!wrappedCallback && seq === asyncRequestSeqRef.current) {
355
+ clearAsyncLoadingTimeout()
356
+ if (mountedRef.current) setAsyncLoading(false)
357
+ }
358
+
359
+ return result
360
+ }
361
+ : resolvedLoadOptions
362
+
261
363
  const selectProps = {
262
364
  cacheOptions: true,
263
365
  components: {
@@ -272,9 +374,7 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(
272
374
  ValueContainer,
273
375
  ...components,
274
376
  },
275
- loadOptions: isString(loadOptions)
276
- ? get(window, loadOptions)
277
- : loadOptions,
377
+ loadOptions: wrappedLoadOptions,
278
378
  getOptionLabel: isString(getOptionLabel)
279
379
  ? get(window, getOptionLabel)
280
380
  : getOptionLabel,
@@ -481,7 +581,9 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(
481
581
  <div
482
582
  {...dataProps}
483
583
  {...htmlProps}
584
+ aria-busy={asyncLoading ? "true" : "false"}
484
585
  className={classnames(classes, inlineClass)}
586
+ data-pb-typeahead-loading={asyncLoading ? "true" : "false"}
485
587
  >
486
588
  <Tag
487
589
  classNamePrefix="typeahead-kit-select"
@@ -1,4 +1,3 @@
1
- /* eslint-disable react/no-danger */
2
1
  /* eslint-disable react/no-multi-comp */
3
2
 
4
3
  import React, { useState } from 'react'
@@ -38,14 +37,26 @@ const TypeaheadWithHighlight = (props) => {
38
37
  const [selectedUser, setSelectedUser] = useState()
39
38
 
40
39
  const formatOptionLabel = ({name, territory, title}, {inputValue}) => {
40
+ const escapeRegExp = (value = "") => (
41
+ value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
42
+ )
41
43
 
42
- const highlighted = (text) => {
44
+ const highlighted = (text = "") => {
43
45
  if (!inputValue.length) return text
44
- return text.replace(
45
- new RegExp(inputValue, 'gi'),
46
- (highlighted) => `<mark>${highlighted}</mark>`
47
- )
46
+
47
+ const escapedInputValue = escapeRegExp(inputValue)
48
+ const regex = new RegExp(`(${escapedInputValue})`, 'gi')
49
+ const parts = text.split(regex)
50
+
51
+ return parts.map((part, index) => {
52
+ if (part.toLowerCase() === inputValue.toLowerCase()) {
53
+ return <mark key={`${part}-${index}`}>{part}</mark>
54
+ }
55
+
56
+ return <React.Fragment key={`${part}-${index}`}>{part}</React.Fragment>
57
+ })
48
58
  }
59
+
49
60
  return (
50
61
  <Flex>
51
62
  <FlexItem>
@@ -61,11 +72,12 @@ const TypeaheadWithHighlight = (props) => {
61
72
  size={4}
62
73
  {...props}
63
74
  >
64
- <span dangerouslySetInnerHTML={{ __html: highlighted(name) }} /></Title>
75
+ {highlighted(name)}
76
+ </Title>
65
77
  <Body color="light"
66
78
  {...props}
67
79
  >
68
- <span dangerouslySetInnerHTML={{ __html: highlighted(title) }} />{" • "}
80
+ {highlighted(title)}{" • "}
69
81
  {territory}
70
82
  </Body>
71
83
  </FlexItem>
@@ -0,0 +1,3 @@
1
+ Use `formatOptionLabel` to customize each option row and highlight text that matches the current search input. Split each field (for example, `name` and `title`) by the typed value, then render matching parts inside `<mark>` so users can quickly see why a result matched.
2
+
3
+ See the code snippet below for more details.
@@ -21,7 +21,8 @@
21
21
  }
22
22
 
23
23
  @mixin hover-underline {
24
- .hover_underline:hover {
24
+ .hover_underline:hover,
25
+ .group_hover:hover .group_hover.hover_underline {
25
26
  text-decoration: underline;
26
27
  transition: text-decoration $transition-speed ease;
27
28
  }
@@ -29,11 +30,13 @@
29
30
 
30
31
  @mixin hover-color-classes($colors-list) {
31
32
  @each $name, $color in $colors-list {
32
- .hover_background-#{"" + $name}:hover {
33
+ .hover_background-#{"" + $name}:hover,
34
+ .group_hover:hover .group_hover.hover_background-#{"" + $name} {
33
35
  background-color: $color !important;
34
36
  transition: background-color $transition-speed ease;
35
37
  }
36
- .hover_color-#{"" + $name}:hover {
38
+ .hover_color-#{"" + $name}:hover,
39
+ .group_hover:hover .group_hover.hover_color-#{"" + $name} {
37
40
  color: $color !important;
38
41
  transition: color $transition-speed ease;
39
42
  }
@@ -0,0 +1,50 @@
1
+ type ToggleVisibilityOptions = {
2
+ isVisible: boolean,
3
+ onHide: () => void,
4
+ onShow: () => void,
5
+ }
6
+
7
+ type ArrowVisibilityOptions = {
8
+ rootElement: ParentNode,
9
+ downSelector: string,
10
+ upSelector: string,
11
+ showDownArrow: boolean,
12
+ displayValue?: string,
13
+ }
14
+
15
+ export const toggleVisibility = ({ isVisible, onHide, onShow }: ToggleVisibilityOptions): boolean => {
16
+ if (isVisible) {
17
+ onHide()
18
+ return false
19
+ }
20
+
21
+ onShow()
22
+ return true
23
+ }
24
+
25
+ export const getElementHeight = (element: HTMLElement, displayValue = 'block'): string => {
26
+ const originalDisplay = element.style.display
27
+ element.style.display = displayValue
28
+ const height = `${element.scrollHeight}px`
29
+ element.style.display = originalDisplay
30
+ return height
31
+ }
32
+
33
+ export const setArrowVisibility = ({
34
+ rootElement,
35
+ downSelector,
36
+ upSelector,
37
+ showDownArrow,
38
+ displayValue = 'inline-block',
39
+ }: ArrowVisibilityOptions): void => {
40
+ const downArrow = rootElement.querySelector<HTMLElement>(downSelector)
41
+ const upArrow = rootElement.querySelector<HTMLElement>(upSelector)
42
+
43
+ if (downArrow) {
44
+ downArrow.style.display = showDownArrow ? displayValue : 'none'
45
+ }
46
+
47
+ if (upArrow) {
48
+ upArrow.style.display = showDownArrow ? 'none' : displayValue
49
+ }
50
+ }
@@ -1 +1 @@
1
- import{jsx}from"react/jsx-runtime";import{useMemo}from"react";import{b as buildAriaProps,a as buildDataProps,c as buildHtmlProps,d as classnames,e as buildCss,g as globalProps}from"./globalProps-DLCfJwiU.js";import Highcharts from"highcharts";import HighchartsReact from"highcharts-react-official";import{t as typography,c as colors}from"./lib-QT_7rPYf.js";import highchartsMore from"highcharts/highcharts-more";import solidGauge from"highcharts/modules/solid-gauge";const barGraphTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},subtitle:{text:"",style:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_base}},chart:{type:"column"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7],credits:{enabled:false},legend:{enabled:false,itemStyle:{color:colors.text_lt_light,fill:colors.text_lt_light,fontSize:typography.text_smaller}},xAxis:{gridLineWidth:0,lineColor:colors.border_light,tickColor:colors.border_light,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_4}}},yAxis:{alternateGridColor:void 0,minorTickInterval:null,gridLineColor:colors.border_light,minorGridLineColor:colors.border_light,lineWidth:0,tickWidth:0,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}}}};const PbBarGraph=props=>{const{aria:aria={},data:data={},id:id,htmlOptions:htmlOptions={},options:options,className:className}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_bar_graph"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbBarGraph />",options);return{}}return Highcharts.merge({},barGraphTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbCircleChartTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},chart:{type:"pie"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},pointFormat:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},plotOptions:{pie:{dataLabels:{enabled:false,connectorShape:"straight",connectorWidth:3,format:"<div>{point.name}</div>",style:{fontFamily:typography.font_family_base,fontSize:typography.text_smaller,color:colors.text_lt_light,fontWeight:typography.regular,textOutline:"2px $white"}},innerSize:"50%",borderColor:"",borderWidth:null,colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7]}},legend:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemStyle:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_smaller},itemHoverStyle:{color:colors.text_lt_default},itemHiddenStyle:{color:colors.text_lt_lighter}},credits:{enabled:false}};const PbCircleChart=props=>{const{aria:aria={},className:className,data:data={},id:id,htmlOptions:htmlOptions={},options:options}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_circle_chart"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbCircleChart />",options);return{}}return Highcharts.merge({},pbCircleChartTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbGaugeGraphTheme={title:{text:"",style:{fontFamily:typography.font_family_base,fontSize:typography.text_larger}},chart:{type:"solidgauge",events:{render(){this.container;const arc=this.container.querySelector("path.gauge-pane");if(arc)arc.setAttribute("stroke-linejoin","round")}}},pane:{size:"90%",startAngle:-100,endAngle:100,background:[{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane",borderColor:colors.border_light,borderRadius:"50%"}]},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},pointFormat:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},yAxis:{min:0,max:100,lineWidth:0,tickPositions:[]},plotOptions:{solidgauge:{borderColor:colors.data_1,borderWidth:20,color:colors.data_1,radius:90,innerRadius:"90%",y:-26,dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:'<span class="fix">{y:,f}</span>',style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}},credits:{enabled:false}};const PbGaugeChart=props=>{const{aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},id:id,ref:ref,options:options={}}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_gauge_chart"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbLineGraph />",options);return{}}return Highcharts.merge({},pbGaugeGraphTheme,options)}),[options]);highchartsMore(Highcharts);solidGauge(Highcharts);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,ref:ref,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbLineGraphTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},subtitle:{text:"",style:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_base}},chart:{type:"line"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},plotOptions:{line:{dataLabels:{enabled:false}}},credits:{enabled:false},legend:{enabled:false,itemStyle:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_smaller},itemHoverStyle:{color:colors.text_lt_default},itemHiddenStyle:{color:colors.text_lt_lighter}},colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7],xAxis:{gridLineWidth:0,lineColor:colors.border_light,tickColor:colors.border_light,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_4}}},yAxis:{alternateGridColor:void 0,minorTickInterval:null,gridLineColor:colors.border_light,minorGridLineColor:colors.border_light,lineWidth:0,tickWidth:0,tickPixelInterval:50,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}}}};const PbLineGraph=props=>{const{aria:aria={},className:className,data:data={},id:id,htmlOptions:htmlOptions={},options:options}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_line_graph"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbLineGraph />",options);return{}}return Highcharts.merge({},pbLineGraphTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};export{PbBarGraph as P,PbCircleChart as a,PbGaugeChart as b,PbLineGraph as c};
1
+ import{jsx}from"react/jsx-runtime";import{useMemo}from"react";import{b as buildAriaProps,a as buildDataProps,c as buildHtmlProps,d as classnames,e as buildCss,g as globalProps}from"./globalProps-Ds_6HBhX.js";import Highcharts from"highcharts";import HighchartsReact from"highcharts-react-official";import{t as typography,c as colors}from"./lib-BaO72ugL.js";import highchartsMore from"highcharts/highcharts-more";import solidGauge from"highcharts/modules/solid-gauge";const barGraphTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},subtitle:{text:"",style:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_base}},chart:{type:"column"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7],credits:{enabled:false},legend:{enabled:false,itemStyle:{color:colors.text_lt_light,fill:colors.text_lt_light,fontSize:typography.text_smaller}},xAxis:{gridLineWidth:0,lineColor:colors.border_light,tickColor:colors.border_light,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_4}}},yAxis:{alternateGridColor:void 0,minorTickInterval:null,gridLineColor:colors.border_light,minorGridLineColor:colors.border_light,lineWidth:0,tickWidth:0,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}}}};const PbBarGraph=props=>{const{aria:aria={},data:data={},id:id,htmlOptions:htmlOptions={},options:options,className:className}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_bar_graph"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbBarGraph />",options);return{}}return Highcharts.merge({},barGraphTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbCircleChartTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},chart:{type:"pie"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},pointFormat:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},plotOptions:{pie:{dataLabels:{enabled:false,connectorShape:"straight",connectorWidth:3,format:"<div>{point.name}</div>",style:{fontFamily:typography.font_family_base,fontSize:typography.text_smaller,color:colors.text_lt_light,fontWeight:typography.regular,textOutline:"2px $white"}},innerSize:"50%",borderColor:"",borderWidth:null,colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7]}},legend:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemStyle:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_smaller},itemHoverStyle:{color:colors.text_lt_default},itemHiddenStyle:{color:colors.text_lt_lighter}},credits:{enabled:false}};const PbCircleChart=props=>{const{aria:aria={},className:className,data:data={},id:id,htmlOptions:htmlOptions={},options:options}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_circle_chart"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbCircleChart />",options);return{}}return Highcharts.merge({},pbCircleChartTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbGaugeGraphTheme={title:{text:"",style:{fontFamily:typography.font_family_base,fontSize:typography.text_larger}},chart:{type:"solidgauge",events:{render(){this.container;const arc=this.container.querySelector("path.gauge-pane");if(arc)arc.setAttribute("stroke-linejoin","round")}}},pane:{size:"90%",startAngle:-100,endAngle:100,background:[{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane",borderColor:colors.border_light,borderRadius:"50%"}]},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},pointFormat:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},yAxis:{min:0,max:100,lineWidth:0,tickPositions:[]},plotOptions:{solidgauge:{borderColor:colors.data_1,borderWidth:20,color:colors.data_1,radius:90,innerRadius:"90%",y:-26,dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:'<span class="fix">{y:,f}</span>',style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}},credits:{enabled:false}};const PbGaugeChart=props=>{const{aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},id:id,ref:ref,options:options={}}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_gauge_chart"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbLineGraph />",options);return{}}return Highcharts.merge({},pbGaugeGraphTheme,options)}),[options]);highchartsMore(Highcharts);solidGauge(Highcharts);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,ref:ref,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbLineGraphTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},subtitle:{text:"",style:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_base}},chart:{type:"line"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},plotOptions:{line:{dataLabels:{enabled:false}}},credits:{enabled:false},legend:{enabled:false,itemStyle:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_smaller},itemHoverStyle:{color:colors.text_lt_default},itemHiddenStyle:{color:colors.text_lt_lighter}},colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7],xAxis:{gridLineWidth:0,lineColor:colors.border_light,tickColor:colors.border_light,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_4}}},yAxis:{alternateGridColor:void 0,minorTickInterval:null,gridLineColor:colors.border_light,minorGridLineColor:colors.border_light,lineWidth:0,tickWidth:0,tickPixelInterval:50,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}}}};const PbLineGraph=props=>{const{aria:aria={},className:className,data:data={},id:id,htmlOptions:htmlOptions={},options:options}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_line_graph"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbLineGraph />",options);return{}}return Highcharts.merge({},pbLineGraphTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};export{PbBarGraph as P,PbCircleChart as a,PbGaugeChart as b,PbLineGraph as c};