playbook_ui 16.0.0 → 16.1.0.pre.alpha.PLAY2684iconbuttonvariant14251
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +12 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_custom.jsx +71 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_custom.md +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading_rails.html.erb +64 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading_rails.md +18 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +51 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +34 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +19 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_responsive.jsx +30 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_responsive.md +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +41 -0
- data/app/pb_kits/playbook/pb_button/_button.tsx +5 -0
- data/app/pb_kits/playbook/pb_button/button.html.erb +12 -8
- data/app/pb_kits/playbook/pb_button/button.rb +5 -0
- data/app/pb_kits/playbook/pb_button/button.test.js +105 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant.html.erb +21 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant.jsx +180 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant_rails.md +1 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant_react.md +1 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +1 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +17 -0
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +10 -1
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +2 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.html.erb +6 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.jsx +17 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +14 -5
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.md +1 -0
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +8 -6
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +6 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +83 -13
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_rails.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_react.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.html.erb +52 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.jsx +72 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height.jsx +33 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.html.erb +20 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.md +8 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_react.md +8 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +6 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +3 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.html.erb +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.jsx +33 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +12 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +15 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +94 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +5 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +15 -10
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +4 -0
- data/app/pb_kits/playbook/pb_dropdown/index.js +191 -83
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +3 -0
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +18 -1
- data/app/pb_kits/playbook/pb_dropdown/utilities/clickOutsideHelper.tsx +6 -0
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +2 -2
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +16 -9
- data/app/pb_kits/playbook/pb_filter/filter.rb +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +7 -1
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +9 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +5 -5
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +4 -4
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +4 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +6 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +7 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +638 -542
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.md +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_input_display.html.erb +74 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_input_display.jsx +87 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_input_display.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +3 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +4 -7
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_disabled.html.erb +135 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_disabled.jsx +147 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_disabled.md +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +35 -31
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.test.jsx +402 -27
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +1 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.html.erb +30 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.jsx +1 -1
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.md +1 -1
- data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +51 -7
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.rb +1 -0
- data/app/pb_kits/playbook/pb_nav/_item.tsx +5 -3
- data/app/pb_kits/playbook/pb_nav/_nav.scss +82 -3
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_disabled_item.html.erb +24 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_disabled_item.jsx +87 -0
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +2 -6
- data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/item.rb +1 -1
- data/app/pb_kits/playbook/pb_nav/navTypes.ts +1 -0
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +40 -7
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx +1 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.html.erb +7 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.jsx +24 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +2 -0
- data/app/pb_kits/playbook/pb_passphrase/passphrase.test.jsx +30 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.html.erb +5 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.jsx +14 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +34 -3
- data/app/pb_kits/playbook/pb_radio/_radio.scss +8 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +82 -20
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.jsx +44 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_required_indicator.jsx +36 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx +28 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.html.erb +10 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +22 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +5 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.test.js +33 -18
- data/app/pb_kits/playbook/pb_table/docs/_sections.yml +68 -0
- data/app/pb_kits/playbook/pb_table/index.ts +29 -27
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +10 -10
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +39 -11
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.html.erb +3 -3
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.jsx +3 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.md +1 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_input_options.html.erb +39 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_input_options.md +3 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_required_indicator.html.erb +5 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_required_indicator.jsx +25 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_textarea/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_textarea/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_textarea/index.ts +12 -5
- data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +30 -14
- data/app/pb_kits/playbook/pb_textarea/textarea.rb +36 -0
- data/app/pb_kits/playbook/pb_textarea/textarea.test.js +18 -1
- data/app/pb_kits/playbook/pb_time_picker/_time_picker.tsx +97 -11
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.jsx +5 -2
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.html.erb +6 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.jsx +16 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_time_picker/time_picker.rb +3 -0
- data/app/pb_kits/playbook/pb_time_picker/time_picker.test.jsx +47 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +53 -2
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +413 -324
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +2 -0
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +4 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.html.erb +16 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.jsx +23 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +22 -21
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +3 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +7 -1
- data/app/pb_kits/playbook/tokens/_colors.scss +3 -0
- data/app/pb_kits/playbook/tokens/_colors_accessible.scss +250 -0
- data/app/pb_kits/playbook/tokens/exports/_colors.module.scss +10 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/borderRadius.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/bottom.test.js +60 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/cursor.test.js +42 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/dark.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/gap.test.js +87 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/globalProps.integration.test.js +936 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/height.test.js +68 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/htmlOptions.test.js +510 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/left.test.js +60 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/lineHeight.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/margin.test.js +95 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/numberSpacing.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/overflow.test.js +68 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/padding.test.js +95 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/position.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/right.test.js +60 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/shadow.test.js +33 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/textAlign.test.js +41 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/top.test.js +60 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/verticalAlign.test.js +40 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/width.test.js +66 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/zIndex.test.js +50 -0
- data/dist/chunks/{_pb_line_graph-ByQFYuFO.js → _pb_line_graph-CC2Ywwix.js} +1 -1
- data/dist/chunks/_typeahead-CRnlQrT9.js +1 -0
- data/dist/chunks/{globalProps-D6R2eJnp.js → globalProps-DYr2qrIf.js} +1 -1
- data/dist/chunks/lib-DgqmX9CF.js +29 -0
- data/dist/chunks/vendor.js +4 -4
- data/dist/menu.yml +3 -3
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +2 -2
- data/dist/reset.css +1 -1
- data/lib/playbook/align_content.rb +13 -3
- data/lib/playbook/align_items.rb +13 -3
- data/lib/playbook/align_self.rb +13 -3
- data/lib/playbook/display.rb +5 -0
- data/lib/playbook/flex.rb +13 -3
- data/lib/playbook/flex_direction.rb +13 -3
- data/lib/playbook/flex_grow.rb +13 -3
- data/lib/playbook/flex_shrink.rb +13 -3
- data/lib/playbook/flex_wrap.rb +13 -3
- data/lib/playbook/forms/builder/form_field_builder.rb +1 -1
- data/lib/playbook/forms/builder/phone_number_field.rb +9 -0
- data/lib/playbook/forms/builder/typeahead_field.rb +15 -1
- data/lib/playbook/forms/builder.rb +2 -2
- data/lib/playbook/justify_content.rb +13 -3
- data/lib/playbook/justify_self.rb +13 -3
- data/lib/playbook/order.rb +13 -3
- data/lib/playbook/spacing.rb +39 -9
- data/lib/playbook/text_align.rb +13 -3
- data/lib/playbook/truncate.rb +1 -1
- data/lib/playbook/version.rb +2 -2
- data/lib/playbook/vertical_align.rb +13 -3
- data/lib/playbook/z_index.rb +5 -0
- metadata +93 -6
- data/dist/chunks/_typeahead-Bl8_gWmz.js +0 -1
- data/dist/chunks/lib-C8h70OzX.js +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab2cde0d75aff91801d5829718217383694151be5ecc31116500afd2516a2a20
|
|
4
|
+
data.tar.gz: 77fef9735e80a12e5e8981a12039aba3b5888389056287700e9e8be692699dac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc53b32790ab4cdd59006656a7fc7f9e4afeed729d4c1840dbbecffbd9d8ef3a73b203d92b80b70524652400c42354a6d772af1c35b90e026d91d7629c4552f4
|
|
7
|
+
data.tar.gz: 9cef9da296a73ba5d676a05ca52191a984248bf88eb790b26d5d6de02a66cc72e7a377fe945cb1f9d21d018161c14df0f82eea4d4d4d1aa9a38d76f1961bca49
|
|
@@ -66,8 +66,18 @@ const TableCellRenderer = ({
|
|
|
66
66
|
// Find the "owning" colDefinition by accessor. Needed for multi column logic
|
|
67
67
|
const colDef = findColumnDefByAccessor(columnDefinitions ?? [], column.id)
|
|
68
68
|
const cellAlignment = colDef?.columnStyling?.cellAlignment ?? "right"
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
|
|
70
|
+
// Support function-based styling for conditional rendering
|
|
71
|
+
const cellFontColorValue = colDef?.columnStyling?.fontColor
|
|
72
|
+
const cellFontColor = typeof cellFontColorValue === 'function'
|
|
73
|
+
? cellFontColorValue(row)
|
|
74
|
+
: cellFontColorValue
|
|
75
|
+
|
|
76
|
+
const cellBackgroundColorValue = colDef?.columnStyling?.cellBackgroundColor
|
|
77
|
+
const cellBackgroundColor = typeof cellBackgroundColorValue === 'function'
|
|
78
|
+
? cellBackgroundColorValue(row)
|
|
79
|
+
: cellBackgroundColorValue
|
|
80
|
+
|
|
71
81
|
const paddingValue = colDef?.columnStyling?.cellPadding ?? customRowStyle?.cellPadding
|
|
72
82
|
const paddingClass = paddingValue ? `p_${paddingValue}` : undefined
|
|
73
83
|
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<% if content.present? %>
|
|
12
12
|
<% content.presence %>
|
|
13
13
|
<% else %>
|
|
14
|
-
<%= pb_rails("advanced_table/table_header", props: { table_id: object.id, column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, show_actions_bar: object.show_actions_bar }) %>
|
|
15
|
-
<%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling }) %>
|
|
14
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: object.id, column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, show_actions_bar: object.show_actions_bar, inline_row_loading: object.inline_row_loading, persist_toggle_expansion_button: object.persist_toggle_expansion_button, table_data: object.table_data }) %>
|
|
15
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading }) %>
|
|
16
16
|
<% end %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<% end %>
|
|
@@ -33,6 +33,10 @@ module Playbook
|
|
|
33
33
|
default: false
|
|
34
34
|
prop :row_styling, type: Playbook::Props::Array,
|
|
35
35
|
default: []
|
|
36
|
+
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
prop :persist_toggle_expansion_button, type: Playbook::Props::Boolean,
|
|
39
|
+
default: false
|
|
36
40
|
|
|
37
41
|
def classname
|
|
38
42
|
additional_classes = [
|
|
@@ -920,6 +920,39 @@ test("columnStyling.backgroundColor works as excpected", () => {
|
|
|
920
920
|
expect(firstEnrollmentCell).toHaveStyle({ backgroundColor: colors.error_subtle });
|
|
921
921
|
});
|
|
922
922
|
|
|
923
|
+
test("columnStyling.cellBackgroundColor works as expected with function", () => {
|
|
924
|
+
const styledColumnDefs = [
|
|
925
|
+
{
|
|
926
|
+
accessor: "year",
|
|
927
|
+
label: "Year",
|
|
928
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
accessor: "newEnrollments",
|
|
932
|
+
label: "New Enrollments",
|
|
933
|
+
columnStyling:{
|
|
934
|
+
cellBackgroundColor: (row) => row.original.newEnrollments > 15 ? colors.success_subtle : colors.error_subtle,
|
|
935
|
+
fontColor: (row) => row.original.newEnrollments > 15 ? colors.success : colors.error,
|
|
936
|
+
},
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
accessor: "scheduledMeetings",
|
|
940
|
+
label: "Scheduled Meetings",
|
|
941
|
+
},
|
|
942
|
+
];
|
|
943
|
+
|
|
944
|
+
render(
|
|
945
|
+
<AdvancedTable
|
|
946
|
+
columnDefinitions={styledColumnDefs}
|
|
947
|
+
data={{ testid: testId }}
|
|
948
|
+
tableData={MOCK_DATA}
|
|
949
|
+
/>
|
|
950
|
+
);
|
|
951
|
+
|
|
952
|
+
const firstEnrollmentCell = screen.getAllByText("20")[0].closest("td");
|
|
953
|
+
expect(firstEnrollmentCell).toHaveStyle({ backgroundColor: colors.success_subtle, color: colors.success });
|
|
954
|
+
});
|
|
955
|
+
|
|
923
956
|
test("columnStyling.headerBackgroundColor works as excpected", () => {
|
|
924
957
|
const styledColumnDefs = [
|
|
925
958
|
{
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import AdvancedTable from '../_advanced_table'
|
|
3
|
+
import colors from '../../tokens/exports/_colors.module.scss'
|
|
4
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
|
5
|
+
import Flex from '../../pb_flex/_flex'
|
|
6
|
+
import Title from '../../pb_title/_title'
|
|
7
|
+
import Body from '../../pb_body/_body'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const AdvancedTableColumnStylingBackgroundCustom = (props) => {
|
|
11
|
+
const columnDefinitions = [
|
|
12
|
+
{
|
|
13
|
+
accessor: "year",
|
|
14
|
+
label: "Year",
|
|
15
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
16
|
+
customRenderer: (row, value) => (
|
|
17
|
+
<Flex flexDirection="column">
|
|
18
|
+
<Title size={4}
|
|
19
|
+
text={value}
|
|
20
|
+
/>
|
|
21
|
+
<Body text="lorem ipsum" />
|
|
22
|
+
<Body text="lorem ipsum" />
|
|
23
|
+
</Flex>
|
|
24
|
+
),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
accessor: "newEnrollments",
|
|
28
|
+
label: "New Enrollments",
|
|
29
|
+
columnStyling:{
|
|
30
|
+
cellBackgroundColor: (row) => row.original.newEnrollments > 15 ? colors.success_subtle : colors.error_subtle,
|
|
31
|
+
fontColor: (row) => row.original.newEnrollments > 15 ? colors.success : colors.error,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
accessor: "scheduledMeetings",
|
|
36
|
+
label: "Scheduled Meetings",
|
|
37
|
+
columnStyling:{
|
|
38
|
+
cellBackgroundColor: (row) => row.original.scheduledMeetings >= 15 ? colors.info_subtle : colors.warning_subtle
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
accessor: "attendanceRate",
|
|
43
|
+
label: "Attendance Rate",
|
|
44
|
+
columnStyling:{cellBackgroundColor: colors.info, headerBackgroundColor: colors.info, fontColor: colors.white, headerFontColor: colors.white},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
accessor: "completedClasses",
|
|
48
|
+
label: "Completed Classes",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
accessor: "classCompletionRate",
|
|
52
|
+
label: "Class Completion Rate",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
accessor: "graduatedStudents",
|
|
56
|
+
label: "Graduated Students",
|
|
57
|
+
},
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div>
|
|
62
|
+
<AdvancedTable
|
|
63
|
+
columnDefinitions={columnDefinitions}
|
|
64
|
+
tableData={MOCK_DATA}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default AdvancedTableColumnStylingBackgroundCustom
|
|
@@ -6,9 +6,9 @@ In the first Advanced Table in this code example, 2021 has an empty children arr
|
|
|
6
6
|
This prop is set to `false` by default.
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### persistToggleExpansionButton
|
|
10
10
|
The `persistToggleExpansionButton` is a boolean prop that renders the toggle-all icon in the top left header cell for complex datasets with empty `children` arrays and advanced querying logic explained in the preceeding doc example. Your logic may require an additional query helper file to update data specifically from requerying via toggle all buttons.
|
|
11
11
|
|
|
12
12
|
In the second and third Advanced Tables in this code example, all 3 rows have empty children arrays. The second Advanced Table demonstrates that the toggle all button does not render (prior to an initial row expansion) without `persistToggleExpansionButton` in place. The third Advanced Table shows the toggle all button due to `persistToggleExpansionButton`.
|
|
13
13
|
|
|
14
|
-
This prop is set to false by default and should only be used in conjunction with `inlineRowLoading`.
|
|
14
|
+
This prop is set to `false` by default and should only be used in conjunction with `inlineRowLoading`.
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading_rails.html.erb
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<% column_definitions = [
|
|
2
|
+
{
|
|
3
|
+
accessor: "year",
|
|
4
|
+
label: "Year",
|
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
accessor: "newEnrollments",
|
|
9
|
+
label: "New Enrollments",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
accessor: "scheduledMeetings",
|
|
13
|
+
label: "Scheduled Meetings",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
accessor: "attendanceRate",
|
|
17
|
+
label: "Attendance Rate",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
accessor: "completedClasses",
|
|
21
|
+
label: "Completed Classes",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
accessor: "classCompletionRate",
|
|
25
|
+
label: "Class Completion Rate",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
accessor: "graduatedStudents",
|
|
29
|
+
label: "Graduated Students",
|
|
30
|
+
}
|
|
31
|
+
] %>
|
|
32
|
+
|
|
33
|
+
<%= pb_rails("caption", props: { text: "Inline Row Loading - Demonstrated in Row 1 (Rows 2 and 3 have data)" }) %>
|
|
34
|
+
|
|
35
|
+
<%= pb_rails("advanced_table", props: {
|
|
36
|
+
id: "inline-loading-table-1",
|
|
37
|
+
table_data: @table_data_inline_loading,
|
|
38
|
+
column_definitions: column_definitions,
|
|
39
|
+
enable_toggle_expansion: "all",
|
|
40
|
+
inline_row_loading: true,
|
|
41
|
+
margin_bottom: "md"
|
|
42
|
+
}) %>
|
|
43
|
+
|
|
44
|
+
<%= pb_rails("caption", props: { text: "Inline Row Loading with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is not rendered" }) %>
|
|
45
|
+
|
|
46
|
+
<%= pb_rails("advanced_table", props: {
|
|
47
|
+
id: "inline-loading-table-2",
|
|
48
|
+
table_data: @table_data_inline_loading_empty_children,
|
|
49
|
+
column_definitions: column_definitions,
|
|
50
|
+
enable_toggle_expansion: "all",
|
|
51
|
+
inline_row_loading: true,
|
|
52
|
+
margin_bottom: "md"
|
|
53
|
+
}) %>
|
|
54
|
+
|
|
55
|
+
<%= pb_rails("caption", props: { text: "Inline Row Loading and Persist Toggle Expansion Button with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is rendered" }) %>
|
|
56
|
+
|
|
57
|
+
<%= pb_rails("advanced_table", props: {
|
|
58
|
+
id: "inline-loading-table-3",
|
|
59
|
+
table_data: @table_data_inline_loading_empty_children,
|
|
60
|
+
column_definitions: column_definitions,
|
|
61
|
+
enable_toggle_expansion: "all",
|
|
62
|
+
inline_row_loading: true,
|
|
63
|
+
persist_toggle_expansion_button: true
|
|
64
|
+
}) %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
### inline_row_loading
|
|
2
|
+
By default, the kit assumes that the initial dataset is complete, rendering expansion controls only when children are present. If, however, you want to implement lazy-loading patterns where children are fetched only when a parent is expanded, use the `inline_row_loading` prop.
|
|
3
|
+
|
|
4
|
+
When `inline_row_loading` is set to `true`:
|
|
5
|
+
- Expansion controls are rendered for rows with empty `children` arrays (you must pass `children: []` to any row that will have children loaded later)
|
|
6
|
+
- When such a row is expanded, an inline loading indicator appears until the child data is loaded
|
|
7
|
+
- This enables lazy-loading patterns without one-off hacks
|
|
8
|
+
|
|
9
|
+
In the first table above, row "2021" has an empty `children` array. Click to expand it and see the inline loading state. Rows 2 and 3 have actual child data.
|
|
10
|
+
|
|
11
|
+
This prop is set to `false` by default.
|
|
12
|
+
|
|
13
|
+
### persist_toggle_expansion_button
|
|
14
|
+
The `persist_toggle_expansion_button` is a boolean prop that renders the toggle-all icon in the top left header cell for complex datasets with empty `children` arrays and advanced querying logic explained in the preceding doc example. Your logic may require an additional query helper file to update data specifically from requerying via toggle all buttons.
|
|
15
|
+
|
|
16
|
+
In the second and third Advanced Tables in this code example, all 3 rows have empty children arrays. The second Advanced Table demonstrates that the toggle all button does not render (prior to an initial row expansion) without `persist_toggle_expansion_button` in place. The third Advanced Table shows the toggle all button due to `persist_toggle_expansion_button`.
|
|
17
|
+
|
|
18
|
+
This prop is set to `false` by default and should only be used in conjunction with `inline_row_loading`.
|
|
@@ -2,4 +2,4 @@ the `enableSorting` prop is a boolean prop set to false by default. If true, the
|
|
|
2
2
|
|
|
3
3
|
### sortIcon
|
|
4
4
|
|
|
5
|
-
An optional prop, `sortIcon` allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when sort direction is desc, and the second value will replace the default icon when sort direction is asc. `sortIcon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the sort state. Default for this prop is `["arrow-up-short
|
|
5
|
+
An optional prop, `sortIcon` allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when sort direction is desc, and the second value will replace the default icon when sort direction is asc. `sortIcon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the sort state. Default for this prop is `["arrow-up-wide-short", "arrow-down-short-wide"]`. All strings must be valid FA icons.
|
|
@@ -29,6 +29,7 @@ examples:
|
|
|
29
29
|
- advanced_table_background_control_rails: Column Styling Background Color
|
|
30
30
|
- advanced_table_background_colors_rails: Column Styling Individual Cell Background Color
|
|
31
31
|
- advanced_table_column_border_color_rails: Column Group Border Color
|
|
32
|
+
- advanced_table_inline_row_loading_rails: Inline Row Loading
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
react:
|
|
@@ -77,6 +78,7 @@ examples:
|
|
|
77
78
|
- advanced_table_column_styling: Column Styling
|
|
78
79
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
|
79
80
|
- advanced_table_column_styling_background: Column Styling Background Color
|
|
81
|
+
- advanced_table_column_styling_background_custom: Column Styling Background Color (Custom)
|
|
80
82
|
- advanced_table_column_styling_background_multi: Column Styling Background Color with Multiple Headers
|
|
81
83
|
- advanced_table_padding_control: Padding Control using Column Styling
|
|
82
84
|
- advanced_table_column_border_color: Column Group Border Color
|
|
@@ -47,4 +47,5 @@ export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced
|
|
|
47
47
|
export { default as AdvancedTablePaddingControl } from './_advanced_table_padding_control.jsx'
|
|
48
48
|
export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
|
|
49
49
|
export { default as AdvancedTableColumnStylingBackground } from './_advanced_table_column_styling_background.jsx'
|
|
50
|
-
export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advanced_table_column_styling_background_multi.jsx'
|
|
50
|
+
export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advanced_table_column_styling_background_multi.jsx'
|
|
51
|
+
export { default as AdvancedTableColumnStylingBackgroundCustom } from './_advanced_table_column_styling_background_custom.jsx'
|
|
@@ -25,6 +25,8 @@ module Playbook
|
|
|
25
25
|
default: false
|
|
26
26
|
prop :row_styling, type: Playbook::Props::Array,
|
|
27
27
|
default: []
|
|
28
|
+
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
29
|
+
default: false
|
|
28
30
|
|
|
29
31
|
def flatten_columns(columns)
|
|
30
32
|
columns.flat_map do |col|
|
|
@@ -69,7 +71,24 @@ module Playbook
|
|
|
69
71
|
end
|
|
70
72
|
|
|
71
73
|
# Additional class and data attributes needed for toggle logic
|
|
72
|
-
output << pb_rails("advanced_table/table_row", props: { table_id: table_id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id })
|
|
74
|
+
output << pb_rails("advanced_table/table_row", props: { table_id: table_id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id, inline_row_loading: inline_row_loading })
|
|
75
|
+
|
|
76
|
+
# Render inline loading row when inline_row_loading is enabled and row has empty children
|
|
77
|
+
if inline_row_loading
|
|
78
|
+
children = row_children_for(row)
|
|
79
|
+
if children.is_a?(::Array) && children.empty?
|
|
80
|
+
max_depth = cell_accessors_length(column_definitions)
|
|
81
|
+
if current_depth < max_depth
|
|
82
|
+
loading_row_data_attributes = {
|
|
83
|
+
advanced_table_content: "#{new_ancestor_ids.join('-')}-loading",
|
|
84
|
+
row_depth: current_depth + 1,
|
|
85
|
+
row_parent: "#{table_id}_#{row.object_id}",
|
|
86
|
+
inline_loading_row: true,
|
|
87
|
+
}
|
|
88
|
+
output << render_inline_loading_row(leaf_columns.length, current_depth, loading_row_data_attributes)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
73
92
|
|
|
74
93
|
if row[:children].present?
|
|
75
94
|
row[:children].each do |child_row|
|
|
@@ -104,6 +123,37 @@ module Playbook
|
|
|
104
123
|
""
|
|
105
124
|
end
|
|
106
125
|
|
|
126
|
+
# 3 helper methods for inline row loading
|
|
127
|
+
def render_inline_loading_row(column_count, depth, data_attributes)
|
|
128
|
+
padding_left = depth.zero? ? "0.5em" : "#{(depth + 1) * 2}em"
|
|
129
|
+
|
|
130
|
+
content_tag(:tr, class: "toggle-content inline-loading-row", data: data_attributes) do
|
|
131
|
+
content_tag(:td, colspan: column_count, style: "padding-left: #{padding_left}") do
|
|
132
|
+
pb_rails("loading_inline")
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def row_children_for(row)
|
|
138
|
+
if row.respond_to?(:children)
|
|
139
|
+
row.children
|
|
140
|
+
elsif row.respond_to?(:[])
|
|
141
|
+
row[:children] || row["children"]
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def cell_accessors_length(col_defs)
|
|
146
|
+
first_col = col_defs.first
|
|
147
|
+
return 0 unless first_col
|
|
148
|
+
|
|
149
|
+
accessors = if first_col.respond_to?(:cellAccessors)
|
|
150
|
+
first_col.cellAccessors
|
|
151
|
+
elsif first_col.respond_to?(:[])
|
|
152
|
+
first_col[:cellAccessors] || first_col["cellAccessors"]
|
|
153
|
+
end
|
|
154
|
+
accessors&.length || 0
|
|
155
|
+
end
|
|
156
|
+
|
|
107
157
|
private
|
|
108
158
|
|
|
109
159
|
def has_grouped_headers?
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<%= object.render_select_all_checkbox %>
|
|
15
15
|
<% end %>
|
|
16
16
|
<% end %>
|
|
17
|
-
<% if object.
|
|
17
|
+
<% if object.show_toggle_all_button? %>
|
|
18
18
|
<% if loading %>
|
|
19
19
|
<div class="<%= object.loading ? 'loading-toggle-icon' : '' %>"></div>
|
|
20
20
|
<% else %>
|
|
@@ -19,6 +19,12 @@ module Playbook
|
|
|
19
19
|
default: false
|
|
20
20
|
prop :show_actions_bar, type: Playbook::Props::Boolean,
|
|
21
21
|
default: true
|
|
22
|
+
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
prop :persist_toggle_expansion_button, type: Playbook::Props::Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
prop :table_data, type: Playbook::Props::Array,
|
|
27
|
+
default: []
|
|
22
28
|
|
|
23
29
|
def classname
|
|
24
30
|
additional_classes = []
|
|
@@ -135,6 +141,20 @@ module Playbook
|
|
|
135
141
|
original_def.dig(:column_styling, :header_font_color)
|
|
136
142
|
end
|
|
137
143
|
|
|
144
|
+
# Check if any row in the table has children
|
|
145
|
+
def has_any_sub_rows?
|
|
146
|
+
return false if table_data.blank?
|
|
147
|
+
|
|
148
|
+
table_data.any? { |row| row_has_children?(row) }
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Determines if the toggle-all button should be shown in the header based on inline row loading and persist toggle expansion button props
|
|
152
|
+
def show_toggle_all_button?
|
|
153
|
+
return false unless enable_toggle_expansion == "header" || enable_toggle_expansion == "all"
|
|
154
|
+
|
|
155
|
+
has_any_sub_rows? || (inline_row_loading && persist_toggle_expansion_button)
|
|
156
|
+
end
|
|
157
|
+
|
|
138
158
|
# Check if header has custom background color
|
|
139
159
|
def has_custom_header_background_color?(cell)
|
|
140
160
|
cell[:header_background_color].present?
|
|
@@ -317,6 +337,20 @@ module Playbook
|
|
|
317
337
|
end
|
|
318
338
|
nil
|
|
319
339
|
end
|
|
340
|
+
|
|
341
|
+
# 2 inline row loading helper methods
|
|
342
|
+
def row_has_children?(row)
|
|
343
|
+
children = row_children_for(row)
|
|
344
|
+
children.present? && children.is_a?(::Array) && !children.empty?
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
def row_children_for(row)
|
|
348
|
+
if row.respond_to?(:children)
|
|
349
|
+
row.children
|
|
350
|
+
elsif row.respond_to?(:[])
|
|
351
|
+
row[:children] || row["children"]
|
|
352
|
+
end
|
|
353
|
+
end
|
|
320
354
|
end
|
|
321
355
|
end
|
|
322
356
|
end
|
|
@@ -33,6 +33,8 @@ module Playbook
|
|
|
33
33
|
default: false
|
|
34
34
|
prop :immediate_parent_row_id, type: Playbook::Props::String,
|
|
35
35
|
default: ""
|
|
36
|
+
prop :inline_row_loading, type: Playbook::Props::Boolean,
|
|
37
|
+
default: false
|
|
36
38
|
|
|
37
39
|
def data
|
|
38
40
|
Hash(prop(:data)).merge(table_data_attributes)
|
|
@@ -186,6 +188,23 @@ module Playbook
|
|
|
186
188
|
end
|
|
187
189
|
end
|
|
188
190
|
|
|
191
|
+
# Determines if the row should show an expand button (true if row has children or inline_row_loading true and row has empty children array)
|
|
192
|
+
def show_expand_button?
|
|
193
|
+
children = row_children
|
|
194
|
+
return true if children.present?
|
|
195
|
+
return true if inline_row_loading && children.is_a?(::Array) && children.empty?
|
|
196
|
+
|
|
197
|
+
false
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def row_children
|
|
201
|
+
if row.respond_to?(:children)
|
|
202
|
+
row.children
|
|
203
|
+
elsif row.respond_to?(:[])
|
|
204
|
+
row[:children] || row["children"]
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
189
208
|
private
|
|
190
209
|
|
|
191
210
|
def custom_renderer_value(column, index)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Background from '../../pb_background/_background'
|
|
3
|
+
|
|
4
|
+
const BackgroundResponsive = (props) => (
|
|
5
|
+
<>
|
|
6
|
+
<Background
|
|
7
|
+
alt="colorful background"
|
|
8
|
+
backgroundColor={{ xs: "primary", sm: "warning", md: "success", lg: "error", xl: "category_1" }}
|
|
9
|
+
className="background lazyload"
|
|
10
|
+
padding="xl"
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
<br/>
|
|
14
|
+
<Background
|
|
15
|
+
alt="colorful background"
|
|
16
|
+
className="background lazyload"
|
|
17
|
+
imageUrl={{
|
|
18
|
+
xs: "https://unsplash.it/500/400/?image=633",
|
|
19
|
+
sm: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80",
|
|
20
|
+
md: "https://unsplash.it/500/400/?image=633",
|
|
21
|
+
lg: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80",
|
|
22
|
+
xl: "https://unsplash.it/500/400/?image=633"
|
|
23
|
+
}}
|
|
24
|
+
padding="xl"
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
</>
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
export default BackgroundResponsive
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The `backgroundColor`, `backgroundSize`, `backgroundPosition`, `backgroundRepeat`, and `imageUrl` props support responsive sizes. To use them, pass an object to the prop containing your values relative to responsive break points. To test this here, resize your browser window to responsively change these Backgrounds' `backgroundColor` and `imageUrl`.
|
|
@@ -7,3 +7,4 @@ export { default as BackgroundStatusSubtle } from './_background_status_subtle.j
|
|
|
7
7
|
export { default as BackgroundCategory } from './_background_category.jsx'
|
|
8
8
|
export { default as BackgroundSize } from './_background_size.jsx'
|
|
9
9
|
export { default as BackgroundOverlay } from './_background_overlay.jsx'
|
|
10
|
+
export { default as BackgroundResponsive } from './_background_responsive.jsx'
|
|
@@ -112,4 +112,45 @@ $pb_button_sizes: (
|
|
|
112
112
|
@include pb_button_disabled_dark;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
|
|
116
|
+
// Icon-only button (icon prop set, no text) - square with equal padding
|
|
117
|
+
// Rails: uses .pb_button_icon_only class
|
|
118
|
+
// React: detects when pb_button_content has an empty text span
|
|
119
|
+
&.pb_button_icon_only,
|
|
120
|
+
&:has(.pb_button_content > span:empty) {
|
|
121
|
+
aspect-ratio: 1;
|
|
122
|
+
min-width: auto;
|
|
123
|
+
width: auto;
|
|
124
|
+
height: auto;
|
|
125
|
+
padding: $pb_button_v_padding !important;
|
|
126
|
+
min-height: ($pb_button_v_padding * 2) + $font_small;
|
|
127
|
+
|
|
128
|
+
&.pb_button_size_sm {
|
|
129
|
+
padding: $font_smaller !important;
|
|
130
|
+
min-height: ($font_smaller * 2) + $font_smaller;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&.pb_button_size_md {
|
|
134
|
+
padding: $font_small !important;
|
|
135
|
+
min-height: ($font_small * 2) + $font_small;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&.pb_button_size_lg {
|
|
139
|
+
padding: ($font_large - 2px) !important;
|
|
140
|
+
min-height: (($font_large - 2px) * 2) + ($font_large - 2px);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Remove margins from icons
|
|
144
|
+
.button_with_icon,
|
|
145
|
+
.button_with_icon_right {
|
|
146
|
+
margin-right: 0;
|
|
147
|
+
margin-left: 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Remove margins from Rails icon wrapper spans
|
|
151
|
+
> span {
|
|
152
|
+
margin-right: 0 !important;
|
|
153
|
+
margin-left: 0 !important;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
115
156
|
}
|
|
@@ -51,9 +51,13 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
|
51
51
|
type = 'inline',
|
|
52
52
|
variant = 'primary',
|
|
53
53
|
size = null,
|
|
54
|
+
text,
|
|
55
|
+
children,
|
|
54
56
|
} = props
|
|
55
57
|
|
|
56
58
|
const classNames = ['pb_button_kit']
|
|
59
|
+
// Icon-only: has icon, no text/children, and not a reaction button (reaction buttons have count)
|
|
60
|
+
const isIconOnly = icon && !text && !children && variant !== 'reaction'
|
|
57
61
|
|
|
58
62
|
if (variant) classNames.push(`pb_button_${variant}`)
|
|
59
63
|
if (type) classNames.push(`pb_button_${type}`)
|
|
@@ -63,6 +67,7 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
|
63
67
|
if (size) classNames.push(`pb_button_size_${size}`)
|
|
64
68
|
if (variant === 'reaction' && icon && !isValidEmoji(icon)) classNames.push('pb_button_reaction_default')
|
|
65
69
|
if (variant === 'reaction' && highlight) classNames.push('pb_button_active')
|
|
70
|
+
if (isIconOnly) classNames.push('pb_button_icon_only')
|
|
66
71
|
|
|
67
72
|
return classNames.join(' ')
|
|
68
73
|
}
|
|
@@ -16,17 +16,21 @@
|
|
|
16
16
|
<% end %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<% else %>
|
|
19
|
-
<% if
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
<% if !object.loading %>
|
|
20
|
+
<% if object.icon && !object.icon_right %>
|
|
21
|
+
<span>
|
|
22
|
+
<%= pb_rails("icon", props: { icon: "#{icon}", fixed_width: true, font_style: object.icon_font_family }.merge((object.icon_only? && content.blank?) ? {} : { margin_right: "xs" })) %>
|
|
23
|
+
</span>
|
|
24
|
+
<% end %>
|
|
23
25
|
<% end %>
|
|
24
26
|
<%= pb_rails("icon", props: { custom_icon: Playbook::Engine::root.join(spinner_path), pulse: true, fixed_width: true, classname: "loading-icon" }) %>
|
|
25
27
|
<span class="pb_button_content"><%= content.presence || object.text %></span>
|
|
26
|
-
<% if object.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
<% if !object.loading %>
|
|
29
|
+
<% if object.icon && object.icon_right %>
|
|
30
|
+
<span>
|
|
31
|
+
<%= pb_rails("icon", props: { icon: "#{icon}", fixed_width: true, font_style: object.icon_font_family }.merge((object.icon_only? && content.blank?) ? {} : { margin_left: "xs" })) %>
|
|
32
|
+
</span>
|
|
33
|
+
<% end %>
|
|
30
34
|
<% end %>
|
|
31
35
|
<% end %>
|
|
32
36
|
|