playbook_ui 15.3.0.pre.alpha.PLAY2407daterangeinlineshowcurrentyear12138 → 15.3.0.pre.alpha.PLAY2565formkitsubmitfix11681

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 (144) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +1 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +1 -3
  4. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +3 -18
  5. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +14 -71
  6. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +0 -3
  7. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +3 -12
  8. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -122
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +0 -4
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +1 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.md +1 -1
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.md +1 -1
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +1 -3
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +0 -2
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +1 -1
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +0 -1
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +0 -2
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.jsx +0 -28
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +2 -11
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +1 -9
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +1 -1
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +1 -4
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +2 -3
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +1 -1
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +1 -1
  26. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +1 -1
  27. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +0 -16
  28. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb +1 -1
  29. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -1
  30. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +20 -90
  31. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -31
  32. data/app/pb_kits/playbook/pb_background/background.html.erb +2 -10
  33. data/app/pb_kits/playbook/pb_background/docs/_background_category.md +1 -1
  34. data/app/pb_kits/playbook/pb_badge/_badge.tsx +1 -4
  35. data/app/pb_kits/playbook/pb_badge/badge.test.js +0 -13
  36. data/app/pb_kits/playbook/pb_card/docs/_card_background.md +1 -1
  37. data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
  38. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
  39. data/app/pb_kits/playbook/pb_card/docs/_card_light.md +1 -1
  40. data/app/pb_kits/playbook/pb_currency/_currency.tsx +7 -20
  41. data/app/pb_kits/playbook/pb_currency/currency.rb +8 -35
  42. data/app/pb_kits/playbook/pb_currency/currency.test.js +0 -47
  43. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
  44. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +1 -1
  45. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +0 -2
  46. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +4 -16
  47. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +1 -2
  48. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -2
  49. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_quick_pick_styles.scss +30 -11
  50. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +13 -20
  51. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.rb +4 -6
  52. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +0 -17
  53. data/app/pb_kits/playbook/pb_date_range_inline/docs/_description.md +1 -1
  54. data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +2 -3
  55. data/app/pb_kits/playbook/pb_date_range_inline/docs/index.js +0 -1
  56. data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
  57. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +0 -1
  58. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +6 -111
  59. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md +1 -1
  60. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -5
  61. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -5
  62. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +2 -148
  63. data/app/pb_kits/playbook/pb_filter/docs/_filter_max_width.md +1 -1
  64. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +1 -15
  65. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.html.erb +8 -9
  66. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_positions.html.erb +10 -11
  67. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -1
  68. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_rails.md +1 -1
  69. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_react.md +1 -1
  70. data/app/pb_kits/playbook/pb_icon/docs/_icon_color.md +1 -1
  71. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.md +1 -1
  72. data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.html.erb +14 -7
  73. data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.jsx +15 -6
  74. data/app/pb_kits/playbook/pb_layout/docs/_layout_collection.md +1 -1
  75. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_item_spacing.md +1 -1
  76. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.md +1 -1
  77. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +1 -1
  78. data/app/pb_kits/playbook/pb_pill/docs/_description.md +1 -1
  79. data/app/pb_kits/playbook/pb_popover/_popover.tsx +34 -69
  80. data/app/pb_kits/playbook/pb_popover/docs/example.yml +0 -1
  81. data/app/pb_kits/playbook/pb_popover/docs/index.js +0 -1
  82. data/app/pb_kits/playbook/pb_popover/popover.test.js +0 -80
  83. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_description.md +1 -1
  84. data/app/pb_kits/playbook/pb_section_separator/docs/_description.md +1 -1
  85. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +0 -29
  86. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius_rails.md +1 -1
  87. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius_react.md +1 -1
  88. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.md +1 -1
  89. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.md +1 -1
  90. data/app/pb_kits/playbook/pb_table/docs/_table_sm.md +1 -1
  91. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -2
  92. data/app/pb_kits/playbook/pb_table/docs/index.js +0 -1
  93. data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -2
  94. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -7
  95. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +1 -105
  96. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +9 -23
  97. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -33
  98. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_options.html.erb +1 -67
  99. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.jsx +6 -68
  100. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.md +1 -1
  101. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
  102. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -2
  103. data/dist/chunks/{_line_graph-BRirnhGy.js → _line_graph-h5H-imfn.js} +1 -1
  104. data/dist/chunks/_typeahead-U8AjZIIW.js +6 -0
  105. data/dist/chunks/_weekday_stacked-CbCUYuuZ.js +37 -0
  106. data/dist/chunks/{lib-BXBHAZMY.js → lib-CGxXTQ75.js} +1 -1
  107. data/dist/chunks/{pb_form_validation-BZppqQZM.js → pb_form_validation-DebqlUKZ.js} +1 -1
  108. data/dist/chunks/vendor.js +1 -1
  109. data/dist/playbook-doc.js +2 -2
  110. data/dist/playbook-rails-react-bindings.js +1 -1
  111. data/dist/playbook-rails.js +1 -1
  112. data/dist/playbook.css +1 -1
  113. data/lib/playbook/version.rb +1 -1
  114. metadata +8 -35
  115. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header_rails.html.erb +0 -104
  116. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header_rails.md +0 -1
  117. data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data_inline_loading_empty_children.js +0 -42
  118. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.md +0 -1
  119. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_and_dropdown_range.jsx +0 -38
  120. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_and_dropdown_range.md +0 -14
  121. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.html.erb +0 -4
  122. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.jsx +0 -43
  123. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.md +0 -1
  124. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick.jsx +0 -18
  125. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick.md +0 -4
  126. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.jsx +0 -18
  127. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.md +0 -1
  128. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end.jsx +0 -19
  129. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end.md +0 -1
  130. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers.jsx +0 -38
  131. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers.md +0 -14
  132. data/app/pb_kits/playbook/pb_dropdown/quickpick/index.ts +0 -60
  133. data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.jsx +0 -68
  134. data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to_react.md +0 -1
  135. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible.html.erb +0 -63
  136. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible.jsx +0 -89
  137. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible_rails.md +0 -4
  138. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible_react.md +0 -3
  139. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.html.erb +0 -64
  140. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.jsx +0 -70
  141. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.md +0 -1
  142. data/dist/chunks/_typeahead-CFOqvZNu.js +0 -6
  143. data/dist/chunks/_weekday_stacked-DEkzyJsS.js +0 -37
  144. /data/app/pb_kits/playbook/pb_popover/docs/{_popover_append_to_rails.md → _popover_append_to.md} +0 -0
@@ -1,6 +1,5 @@
1
- `paginationProps` is an optional prop that can be used to further customize pagination for the AdvancedTable. This prop is an object with the following optional items:
1
+ `paginationProps` is an optional prop that can be used to further customize pagination for the AdvancedTable. This prop is an object with 2 optional items:
2
2
 
3
3
  - `pageIndex`: An optional prop to set which page is set to open on initial load. Default is '0'
4
4
  - `pageSize`: An optional prop to set total number of rows for each page before the Table paginates. Default is '20'
5
- - `range`: The range prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the range prop. See [here for more details](https://playbook.powerapp.cloud/kits/pagination/react#default). Default is set to '5'
6
- - `onPageChange`: A callback function that gives to access to the current page index.
5
+ - `range`: The range prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the range prop. See [here for more details](https://playbook.powerapp.cloud/kits/pagination/react#default). Default is set to '5'
@@ -1,7 +1,7 @@
1
1
  To achieve a sticky header AND sticky columns together, in addition to the `stickyLeftColumn` logic outlined above, you can:
2
2
 
3
3
  - Set `sticky: true` via `tableProps`
4
- - Give the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud//global_props/max_height) global prop.
4
+ - Give the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/visual_guidelines/max_height) global prop.
5
5
 
6
6
  **NOTE**: This behavior requires a `maxHeight` to work. The header is sticky within the table container, allowing for it to work along with the column stickiness.
7
7
 
@@ -1,4 +1,4 @@
1
- Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `table_props` and giving the AdvancedTable a `max_height` using our [Max Height](https://playbook.powerapp.cloud/global_props/max_height) global prop.
1
+ Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `table_props` and giving the AdvancedTable a `max_height` using our [Max Height](https://playbook.powerapp.cloud/visual_guidelines/max_height) global prop.
2
2
 
3
3
  **NOTE**: This behavior requires a `max_height` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
4
4
 
@@ -1,4 +1,4 @@
1
- Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and giving the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/global_props/max_height) global prop.
1
+ Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and giving the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/visual_guidelines/max_height) global prop.
2
2
 
3
3
  **NOTE**: This behavior requires a `maxHeight` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
4
4
 
@@ -76,22 +76,6 @@ const columnDefinitions = [
76
76
  {
77
77
  label: "Attendance",
78
78
  id: "attendance",
79
- header: () => (
80
- <Flex alignItems="center"
81
- justifyContent="center"
82
- >
83
- <Caption marginRight="xs">Attendance</Caption>
84
- <Tooltip placement="top"
85
- text="Whoa. I'm a Tooltip Too!"
86
- zIndex={10}
87
- >
88
- <Icon cursor="pointer"
89
- icon="info"
90
- size="xs"
91
- />
92
- </Tooltip>
93
- </Flex>
94
- ),
95
79
  columns: [
96
80
  {
97
81
  accessor: "attendanceRate",
@@ -12,7 +12,7 @@
12
12
  capture do
13
13
  pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do
14
14
  pb_rails("caption", props: { margin_right: "xs", text: "New Enrollments" }) +
15
- pb_rails("icon", props: { id: "tooltip-interact", icon: "info", size: "xs", cursor: "pointer" }) +
15
+ pb_rails("icon", props: { id: "tooltip-interact", icon: "info", size: "xs" }) +
16
16
  pb_rails("tooltip", props: {
17
17
  trigger_element_id: "tooltip-interact",
18
18
  tooltip_id: "example-custom-tooltip",
@@ -11,7 +11,6 @@ examples:
11
11
  - advanced_table_responsive: Responsive Tables
12
12
  - advanced_table_custom_cell_rails: Custom Components for Cells
13
13
  - advanced_table_with_custom_header_rails: Custom Header Cell
14
- - advanced_table_with_custom_header_multi_header_rails: Custom Header with Multiple Headers
15
14
  - advanced_table_column_headers: Multi-Header Columns
16
15
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
17
16
  - advanced_table_column_headers_vertical_border: Multi-Header Columns with Vertical Borders
@@ -82,62 +82,32 @@ module Playbook
82
82
  end
83
83
  end
84
84
 
85
- # Get original column definition for custom rendering by accessor
85
+ # Get original column definition for custom rendering
86
86
  def find_original_column_def(accessor)
87
87
  find_column_def_by_accessor(column_definitions, accessor)
88
88
  end
89
89
 
90
- # Get original column definition for custom rendering by id
91
- def find_original_column_def_by_id(id)
92
- find_column_def_by_id(column_definitions, id)
93
- end
94
-
95
90
  # Check if a header cell has a custom renderer
96
91
  def has_header_renderer?(cell)
97
- original_def = find_original_column_def_for_cell(cell)
98
- original_def&.dig(:header).present?
99
- rescue
100
- false
92
+ return false unless cell[:accessor].present?
93
+
94
+ original_def = find_original_column_def(cell[:accessor])
95
+ original_def && original_def[:header].present?
101
96
  end
102
97
 
103
98
  # Render custom header content
104
99
  def render_header(cell)
105
100
  return cell[:label] unless has_header_renderer?(cell)
106
101
 
107
- original_def = find_original_column_def_for_cell(cell)
108
- return cell[:label] unless original_def
109
-
102
+ original_def = find_original_column_def(cell[:accessor])
110
103
  custom_renderer = original_def[:header]
111
- return cell[:label] unless custom_renderer
112
104
 
113
105
  # Call the custom renderer with the cell data and label
114
- begin
115
- result = custom_renderer.call(cell, cell[:label])
116
- result.present? ? result.to_s : cell[:label]
117
- rescue
118
- cell[:label]
119
- end
106
+ custom_renderer.call(cell, cell[:label])
120
107
  end
121
108
 
122
109
  private
123
110
 
124
- # Find the original column definition for a cell
125
- def find_original_column_def_for_cell(cell)
126
- # Try accessor first (for leaf columns)
127
- if cell[:accessor].present?
128
- found = find_original_column_def(cell[:accessor])
129
- return found if found
130
- end
131
-
132
- # Try id if accessor lookup didn't find it (for grouped columns or leaf columns with id)
133
- if cell[:id].present?
134
- found = find_original_column_def_by_id(cell[:id])
135
- return found if found
136
- end
137
-
138
- nil
139
- end
140
-
141
111
  def compute_max_depth(columns)
142
112
  columns.map do |col|
143
113
  col[:columns] ? 1 + compute_max_depth(col[:columns]) : 1
@@ -148,24 +118,21 @@ module Playbook
148
118
  total_columns = columns.size
149
119
  columns.each_with_index do |col, index|
150
120
  is_last = index == total_columns - 1
151
- nested_columns = col[:columns]
152
- if nested_columns
153
- colspan = compute_leaf_columns(nested_columns)
154
- cell_hash = {
121
+ if col[:columns]
122
+ colspan = compute_leaf_columns(col[:columns])
123
+ rows[current_depth] << {
155
124
  label: col[:label],
156
125
  colspan: colspan,
157
126
  is_last_in_group: is_last && current_depth.positive?,
158
127
  }
159
- cell_hash[:id] = col[:id] if col[:id].present?
160
- rows[current_depth] << cell_hash
161
128
 
162
- process_columns(nested_columns, rows, current_depth + 1, max_depth)
129
+ process_columns(col[:columns], rows, current_depth + 1, max_depth)
163
130
  else
164
- raw_styling = col[:column_styling] || {}
165
- header_alignment = raw_styling[:header_alignment]
131
+ raw_styling = col[:column_styling] || {}
132
+ header_alignment = raw_styling[:header_alignment]
166
133
 
167
134
  colspan = 1
168
- cell_hash = {
135
+ rows[current_depth] << {
169
136
  label: col[:label],
170
137
  colspan: colspan,
171
138
  accessor: col[:accessor],
@@ -173,8 +140,6 @@ module Playbook
173
140
  is_last_in_group: is_last && current_depth.positive?,
174
141
  header_alignment: header_alignment,
175
142
  }
176
- cell_hash[:id] = col[:id] if col[:id].present?
177
- rows[current_depth] << cell_hash
178
143
  end
179
144
  end
180
145
  end
@@ -189,15 +154,11 @@ module Playbook
189
154
  max_depth = compute_max_depth(column_definitions)
190
155
 
191
156
  column_definitions.map do |col|
192
- if col[:columns]
193
- nested_columns = col[:columns]
194
- wrapped = {
157
+ if col.key?(:columns)
158
+ {
195
159
  label: col[:label],
196
- columns: wrap_leaf_columns(nested_columns),
160
+ columns: wrap_leaf_columns(col[:columns]),
197
161
  }
198
- wrapped[:id] = col[:id] if col[:id].present?
199
- wrapped[:header] = col[:header] if col[:header].present?
200
- wrapped
201
162
  else
202
163
  # For leaf columns, wrap with empty labels up to max depth to get proper structure
203
164
  wrap_leaf_column(col, max_depth)
@@ -212,7 +173,6 @@ module Playbook
212
173
  sort_menu: col[:sort_menu] || nil,
213
174
  column_styling: col[:column_styling] || {},
214
175
  }
215
- wrapped[:id] = col[:id] if col[:id].present?
216
176
  (max_depth - 1).times do
217
177
  wrapped = { label: "", columns: [wrapped] }
218
178
  end
@@ -220,41 +180,11 @@ module Playbook
220
180
  end
221
181
 
222
182
  def find_column_def_by_accessor(defs, target_accessor)
223
- return nil if target_accessor.blank?
224
-
225
183
  defs.each do |col|
226
- col_accessor = col[:accessor]
227
- next if col_accessor.blank?
228
-
229
- return col if col_accessor.to_s == target_accessor.to_s
230
-
231
- nested_columns = col[:columns]
232
- if nested_columns.is_a?(Array)
233
- found = find_column_def_by_accessor(nested_columns, target_accessor)
234
- return found if found
235
- end
236
- end
237
- nil
238
- end
239
-
240
- def find_column_def_by_id(defs, target_id)
241
- return nil if target_id.blank?
242
-
243
- defs.each do |col|
244
- col_id = col[:id]
245
-
246
- return col if col_id.present? && col_id.to_s == target_id.to_s
247
-
248
- # Recursively search nested columns, even if current col has no id or doesn't match
249
- nested_columns = col[:columns]
250
-
251
- next unless nested_columns.present?
252
-
253
- # Convert to array if needed (for edge cases where is_a?(Array) might fail)
254
- array_columns = Array(nested_columns)
184
+ return col if col[:accessor] == target_accessor
255
185
 
256
- if array_columns.any?
257
- found = find_column_def_by_id(array_columns, target_id)
186
+ if col[:columns].is_a?(Array)
187
+ found = find_column_def_by_accessor(col[:columns], target_accessor)
258
188
  return found if found
259
189
  end
260
190
  end
@@ -79,44 +79,15 @@ module Playbook
79
79
  cell_background_color(column).present?
80
80
  end
81
81
 
82
- def cell_font_color(column)
83
- return nil unless column[:accessor].present?
84
-
85
- orig_def = find_column_def_by_accessor(column_definitions, column[:accessor])
86
- if orig_def && orig_def[:column_styling].is_a?(Hash) && orig_def[:column_styling][:font_color].present?
87
- font_color = orig_def[:column_styling][:font_color]
88
- if font_color.respond_to?(:call)
89
- font_color.call(row)
90
- else
91
- font_color
92
- end
93
- end
94
- end
95
-
96
82
  # Uses a regular table/table_cell component if there is no custom background color; if there is a cell_background_color uses a background component with tag "td"
97
83
  def cell_component_info(column, index, bg_color, font_color)
98
- column_font_color = cell_font_color(column)
99
- effective_font_color = column_font_color || font_color
100
-
101
84
  if has_custom_background_color?(column)
102
85
  custom_bg_color = cell_background_color(column)
103
86
  component_name = "background"
104
- component_props = {
105
- background_color: custom_bg_color,
106
- tag: "td",
107
- classname: td_classname(column, index),
108
- }
109
- component_props[:html_options] = { style: { color: effective_font_color } } if effective_font_color.present?
87
+ component_props = { background_color: custom_bg_color, tag: "td", classname: td_classname(column, index) }
110
88
  else
111
89
  component_name = "table/table_cell"
112
- style_hash = { "background-color": bg_color }
113
- style_hash[:color] = effective_font_color if effective_font_color.present?
114
- component_props = {
115
- html_options: {
116
- style: style_hash,
117
- },
118
- classname: td_classname(column, index),
119
- }
90
+ component_props = { html_options: { style: { "background-color": bg_color, color: font_color } }, classname: td_classname(column, index) }
120
91
  end
121
92
 
122
93
  { name: component_name, props: component_props }
@@ -1,11 +1,3 @@
1
- <%
2
- html_options_style = ""
3
- if object.html_options[:style].is_a?(Hash)
4
- html_options_style = object.html_options[:style].map { |k, v| "#{k.to_s.tr('_', '-')}: #{v}" }.join("; ")
5
- elsif object.html_options[:style].is_a?(String)
6
- html_options_style = object.html_options[:style]
7
- end
8
- %>
9
1
  <% if object.image_url.present? %>
10
2
  <%= pb_content_tag(object.tag,
11
3
  style: "background-image: url('#{object.image_url}');
@@ -17,8 +9,8 @@
17
9
  <% end %>
18
10
  <% else %>
19
11
  <%= pb_content_tag(object.tag,
20
- style: "#{object.custom_background_color}#{html_options_style.present? ? "; #{html_options_style}" : ""}"
12
+ style: object.custom_background_color
21
13
  ) do %>
22
14
  <%= content.presence %>
23
15
  <% end %>
24
- <% end %>
16
+ <% end %>
@@ -1 +1 @@
1
- Category colors can be passed into the background kit. Values `category_1` to `category_21` are accepted. List of all category and status colors can be viewed <a href="https://playbook.powerapp.cloud/tokens/colors" target="_blank">here</a>.
1
+ Category colors can be passed into the background kit. Values `category_1` to `category_21` are accepted. List of all category and status colors can be viewed <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">here</a>.
@@ -20,12 +20,11 @@ type BadgeProps = {
20
20
  onTouchEnd?: React.TouchEventHandler<HTMLSpanElement>,
21
21
  },
22
22
  data?: {[key: string]: string},
23
- htmlOptions?: {[key: string]: string | number | boolean | (() => void) | ((event: any) => void) | any},
23
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
24
24
  id?: string,
25
25
  removeIcon?: boolean,
26
26
  removeOnClick?: React.MouseEventHandler<HTMLSpanElement>,
27
27
  rounded?: boolean,
28
- tabIndex?: number,
29
28
  text?: string,
30
29
  variant?: "error" | "info" | "neutral" | "notification" | "notificationError" | "primary" | "success" | "warning",
31
30
  } & GlobalProps
@@ -40,7 +39,6 @@ const Badge = (props: BadgeProps): React.ReactElement => {
40
39
  removeIcon = false,
41
40
  removeOnClick,
42
41
  rounded = false,
43
- tabIndex,
44
42
  text,
45
43
  variant = 'neutral',
46
44
  } = props
@@ -63,7 +61,6 @@ const Badge = (props: BadgeProps): React.ReactElement => {
63
61
  {...htmlProps}
64
62
  className={css}
65
63
  id={id}
66
- tabIndex={tabIndex}
67
64
  >
68
65
  <span>
69
66
  {text}
@@ -112,16 +112,3 @@ test('displays notification variants', () => {
112
112
  cleanup()
113
113
  })
114
114
  })
115
-
116
- test('should allow tabIndex to be set', () => {
117
- render(
118
- <Badge
119
- data={{ testid: testId }}
120
- tabIndex={0}
121
- text="+1"
122
- />
123
- )
124
-
125
- const kit = screen.getByTestId(testId)
126
- expect(kit).toHaveAttribute('tabIndex', '0')
127
- })
@@ -1 +1 @@
1
- Add a background color by passing the color name to background. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/tokens/colors" target="_blank">here</a> under Product Colors and Status: Subtle Variations.
1
+ Add a background color by passing the color name to background. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">here</a> under Product Colors and Status: Subtle Variations.
@@ -1 +1 @@
1
- Card headers pass category, product, status and background colors only. List of all category, product, status and background colors can be viewed <a href="https://playbook.powerapp.cloud/token/colors" target="_blank">here</a>.
1
+ Card headers pass category, product, status and background colors only. List of all category, product, status and background colors can be viewed <a href="https://playbook.powerapp.cloud/visual_guidelines/colors" target="_blank">here</a>.
@@ -1 +1 @@
1
- Card highlight can pass status, product, and category colors. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/token/colors" target="_blank">here</a>.
1
+ Card highlight can pass status, product, and category colors. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/visual_guidelines/colors" target="_blank">here</a>.
@@ -1 +1 @@
1
- Card can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/global_props/max_width" target="_blank">visual guidelines.</a>
1
+ Card can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">visual guidelines.</a>
@@ -11,7 +11,7 @@ import Title from '../pb_title/_title'
11
11
  type CurrencyProps = {
12
12
  abbreviate?: boolean,
13
13
  align?: 'center' | 'left' | 'right',
14
- amount: string | number,
14
+ amount: string,
15
15
  aria?: {[key:string]:string},
16
16
  className?: string,
17
17
  dark?: boolean,
@@ -59,19 +59,6 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
59
59
  commaSeparator = false,
60
60
  } = props
61
61
 
62
- // Convert numeric input to string format
63
- const convertAmount = (input: string | number): string => {
64
- if (typeof input === 'number') {
65
- if (input === 0 && !nullDisplay) {
66
- return ""
67
- }
68
- return input.toFixed(2)
69
- }
70
- return input
71
- }
72
-
73
- const currencyAmount = convertAmount(amount)
74
-
75
62
  const emphasizedClass = emphasized ? '' : '_deemphasized'
76
63
 
77
64
  let variantClass
@@ -81,7 +68,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
81
68
  variantClass = '_bold'
82
69
  }
83
70
 
84
- const [whole, decimal = '00'] = currencyAmount.split('.')
71
+ const [whole, decimal = '00'] = amount.split('.')
85
72
  const ariaProps = buildAriaProps(aria)
86
73
  const dataProps = buildDataProps(data)
87
74
  const htmlProps = buildHtmlProps(htmlOptions)
@@ -105,19 +92,19 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
105
92
  return isAmount ? num.slice(0, -1) : isUnit ? num.slice(-1) : ''
106
93
  }
107
94
 
108
- const getMatchingDecimalAmount = decimals === "matching" ? currencyAmount : whole
95
+ const getMatchingDecimalAmount = decimals === "matching" ? amount : whole
109
96
  const getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
110
97
 
111
98
  const formatAmount = (amount: string) => {
112
99
  if (!commaSeparator) return amount;
113
-
100
+
114
101
  const [wholePart, decimalPart] = amount.split('.');
115
102
  const formattedWhole = new Intl.NumberFormat('en-US').format(parseInt(wholePart));
116
103
  return decimalPart ? `${formattedWhole}.${decimalPart}` : formattedWhole;
117
104
  }
118
105
 
119
106
  const swapNegative = size === "sm" && symbol !== ""
120
- const handleNegative = currencyAmount.startsWith("-") && swapNegative ? "-" : ""
107
+ const handleNegative = amount.startsWith("-") && swapNegative ? "-" : ""
121
108
  const getAbsoluteAmount = (amountString: string) => amountString.replace(/^-/,'')
122
109
  const getAbbrOrFormatAmount = abbreviate ? getAbbreviatedValue('amount') : formatAmount(getMatchingDecimalAmount)
123
110
  const getAmount = swapNegative ? getAbsoluteAmount(getAbbrOrFormatAmount) : getAbbrOrFormatAmount
@@ -165,7 +152,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
165
152
  >
166
153
  {handleNegative}{symbol}
167
154
  </Body>
168
-
155
+
169
156
  <Title
170
157
  className="pb_currency_value"
171
158
  dark={dark}
@@ -173,7 +160,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
173
160
  >
174
161
  {getAmount}
175
162
  </Title>
176
-
163
+
177
164
  <Body
178
165
  className="unit"
179
166
  color="light"
@@ -17,7 +17,8 @@ module Playbook
17
17
  prop :symbol, type: Playbook::Props::String,
18
18
  default: "$"
19
19
 
20
- prop :amount, required: true
20
+ prop :amount, type: Playbook::Props::String,
21
+ required: true
21
22
 
22
23
  prop :unit, type: Playbook::Props::String,
23
24
  required: false
@@ -91,7 +92,7 @@ module Playbook
91
92
  end
92
93
 
93
94
  def negative_sign
94
- currency_amount.starts_with?("-") && swap_negative ? "-" : ""
95
+ amount.starts_with?("-") && swap_negative ? "-" : ""
95
96
  end
96
97
 
97
98
  def body_props
@@ -116,32 +117,10 @@ module Playbook
116
117
  end
117
118
  end
118
119
 
119
- def currency_amount
120
- @currency_amount ||= convert_amount(amount)
121
- end
122
-
123
120
  private
124
121
 
125
- # Convert numeric input to string format
126
- def convert_amount(input)
127
- if input.is_a?(Numeric)
128
- if input.zero? && null_display.nil?
129
- ""
130
- else
131
- format("%.2f", input)
132
- end
133
- # Handle string representations of zero
134
- elsif input.to_s.strip.match?(/^-?0+(\.0+)?$/) && null_display.nil?
135
- ""
136
- else
137
- input.to_s
138
- end
139
- end
140
-
141
122
  def whole_value
142
- return "" if currency_amount.blank?
143
-
144
- value = currency_amount.split(".").first
123
+ value = amount.split(".").first
145
124
  if comma_separator
146
125
  number_with_delimiter(value.gsub(",", ""))
147
126
  else
@@ -150,9 +129,7 @@ module Playbook
150
129
  end
151
130
 
152
131
  def decimal_value
153
- return "00" if currency_amount.blank?
154
-
155
- currency_amount.split(".")[1] || "00"
132
+ amount.split(".")[1] || "00"
156
133
  end
157
134
 
158
135
  def units_element
@@ -170,9 +147,7 @@ module Playbook
170
147
  end
171
148
 
172
149
  def abbreviated_value(index = 0..-2)
173
- return "" if currency_amount.blank?
174
-
175
- value = currency_amount.split(".").first.gsub(",", "").to_i
150
+ value = amount.split(".").first.gsub(",", "").to_i
176
151
  abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "")
177
152
  abbreviated_num[index]
178
153
  end
@@ -199,11 +174,9 @@ module Playbook
199
174
 
200
175
  if decimals == "matching"
201
176
  if comma_separator
202
- return "" if currency_amount.blank?
203
-
204
- number_with_delimiter(currency_amount.gsub(",", ""))
177
+ number_with_delimiter(amount.gsub(",", ""))
205
178
  else
206
- currency_amount
179
+ amount
207
180
  end
208
181
  else
209
182
  whole_value
@@ -133,50 +133,3 @@ test('handles negative amounts correctly', () => {
133
133
  expect(screen.getByTestId('test-negative-no-symbol')).toHaveTextContent('-400.50')
134
134
  expect(screen.getByTestId('test-negative-medium-size')).toHaveTextContent('$-500.55')
135
135
  })
136
-
137
- test('handles numeric amounts correctly', () => {
138
- render(
139
- <>
140
- <Currency
141
- amount={320}
142
- data={{ testid: 'test-numeric-default' }}
143
- />
144
- <Currency
145
- abbreviate
146
- amount={3200000}
147
- data={{ testid: 'test-numeric-millions' }}
148
- />
149
- <Currency
150
- amount={123456.78}
151
- commaSeparator
152
- data={{ testid: 'test-numeric-comma-decimals' }}
153
- />
154
- <Currency
155
- amount={400.50}
156
- data={{ testid: 'test-numeric-no-symbol' }}
157
- symbol=""
158
- />
159
- <Currency
160
- amount={500.55}
161
- data={{ testid: 'test-numeric-medium-size' }}
162
- size="md"
163
- />
164
- <Currency
165
- amount={-600.70}
166
- data={{ testid: 'test-numeric-negative' }}
167
- />
168
- <Currency
169
- amount={0.00}
170
- data={{ testid: 'test-numeric-null' }}
171
- />
172
- </>
173
- )
174
-
175
- expect(screen.getByTestId('test-numeric-default')).toHaveTextContent('$320')
176
- expect(screen.getByTestId('test-numeric-millions')).toHaveTextContent('$3.2M')
177
- expect(screen.getByTestId('test-numeric-comma-decimals')).toHaveTextContent('$123,456.78')
178
- expect(screen.getByTestId('test-numeric-no-symbol')).toHaveTextContent('400.50')
179
- expect(screen.getByTestId('test-numeric-medium-size')).toHaveTextContent('$500.55')
180
- expect(screen.getByTestId('test-numeric-negative')).toHaveTextContent('-$600.70')
181
- expect(screen.getByTestId('test-numeric-null')).toHaveTextContent('$.00')
182
- })
@@ -7,7 +7,7 @@
7
7
  }) %>
8
8
 
9
9
  <%= pb_rails("currency", props: {
10
- amount: 342,
10
+ amount: "342",
11
11
  label: "Light",
12
12
  margin_bottom: "md",
13
13
  size: "sm",
@@ -14,7 +14,7 @@ const CurrencyVariants = (props) => {
14
14
  {...props}
15
15
  />
16
16
  <Currency
17
- amount={342}
17
+ amount="342"
18
18
  label="Light"
19
19
  marginBottom="md"
20
20
  size="sm"
@@ -85,8 +85,6 @@ module Playbook
85
85
  default: ""
86
86
  prop :sync_end_with, type: Playbook::Props::String,
87
87
  default: ""
88
- prop :cursor, type: Playbook::Props::String,
89
- default: "pointer"
90
88
 
91
89
  def classname
92
90
  default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"