playbook_ui 14.17.0 → 14.18.0.pre.alpha.PLAY2037selectinlinecareterror7490
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 +23 -3
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +67 -3
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +29 -19
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +365 -143
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +14 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +6 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.jsx +80 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb +58 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.jsx +66 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expand_by_depth.md +10 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.jsx +58 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.jsx +64 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +8 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +55 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +6 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +6 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +10 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +6 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +97 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_background/_background.scss +26 -0
- data/app/pb_kits/playbook/pb_background/_background.tsx +5 -3
- data/app/pb_kits/playbook/pb_background/background.test.js +5 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +35 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.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_circle_chart/_circle_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +2 -2
- data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +53 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.html.erb +2 -2
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +2 -2
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +38 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +2 -3
- data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +39 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +4 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +9 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.test.js +14 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.html.erb +28 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.jsx +42 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.md +1 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +19 -45
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +54 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +3 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.html.erb +14 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.md +3 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_copy_button/index.js +46 -20
- data/app/pb_kits/playbook/pb_copy_button/usePBCopy.ts +45 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +12 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +12 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +50 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.jsx +4 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.md +4 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.md +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.md +5 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.jsx +34 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.md +14 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +20 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +14 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +10 -0
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +10 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +2 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames.html.erb +117 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames_rails.md +9 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_dialog/index.js +106 -14
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.html.erb +43 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.html.erb +55 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +50 -48
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors_rails.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors_react.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +110 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_react.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.html.erb +42 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +12 -7
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.rb +9 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +68 -0
- data/app/pb_kits/playbook/pb_draggable/index.js +139 -142
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +5 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +4 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_within_turbo_frames.html.erb +41 -0
- data/app/pb_kits/playbook/pb_filter/docs/_filter_within_turbo_frames.md +1 -0
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_form_group/_error_state_mixin.scss +22 -18
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +23 -3
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +15 -5
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +39 -6
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +30 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +85 -0
- data/app/pb_kits/playbook/pb_layout/_layout.scss +70 -1
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +29 -2
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +322 -118
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +1 -1
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +74 -43
- data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +79 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +21 -4
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +52 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +110 -0
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +83 -22
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +39 -7
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +63 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +3 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +1 -7
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.jsx +49 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.jsx +81 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +39 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +40 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +5 -0
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +39 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +13 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +3 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.html.erb +10 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.jsx +20 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +8 -1
- 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 +19 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.html.erb +46 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.md +1 -0
- data/app/pb_kits/playbook/pb_popover/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_popover/index.ts +13 -1
- data/app/pb_kits/playbook/pb_popover/popover.rb +2 -0
- data/app/pb_kits/playbook/pb_select/_select.scss +10 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_error.html.erb +1 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_error.jsx +7 -2
- data/app/pb_kits/playbook/pb_table/_table.tsx +2 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +3 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +1 -1
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +19 -7
- data/app/pb_kits/playbook/pb_table/table.rb +13 -1
- data/app/pb_kits/playbook/pb_table/table_header.rb +13 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +13 -5
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.html.erb +1 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.jsx +9 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.jsx +94 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.md +1 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +8 -1
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.html.erb +5 -1
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.jsx +7 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_error_state.html.erb +8 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_error_state.jsx +6 -2
- data/dist/chunks/_typeahead-D8CsVBZO.js +22 -0
- data/dist/chunks/_weekday_stacked-D3oLTSkH.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/lib-BmTAc7Nc.js +29 -0
- data/dist/chunks/{pb_form_validation-BiHyZedy.js → pb_form_validation-BWjy4bFn.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -2
- data/dist/playbook-doc.js +19 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +92 -21
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +0 -5
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +0 -1
- data/dist/chunks/_typeahead-CPM091Hj.js +0 -22
- data/dist/chunks/_weekday_stacked-BzIANIYX.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
- data/dist/chunks/lib-Bg2KFzpz.js +0 -29
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.md} +0 -0
@@ -22,6 +22,7 @@ type CircleIconButtonProps = {
|
|
22
22
|
type?: 'button' | 'submit' | 'reset' | undefined,
|
23
23
|
target?: string
|
24
24
|
variant?: 'primary' | 'secondary' | 'link',
|
25
|
+
size?: 'default' | 'sm',
|
25
26
|
}
|
26
27
|
|
27
28
|
const CircleIconButton = (props: CircleIconButtonProps): React.ReactElement => {
|
@@ -41,13 +42,16 @@ const CircleIconButton = (props: CircleIconButtonProps): React.ReactElement => {
|
|
41
42
|
link,
|
42
43
|
newWindow,
|
43
44
|
variant,
|
45
|
+
size = 'default',
|
44
46
|
} = props
|
45
47
|
|
46
48
|
const ariaProps = buildAriaProps(aria)
|
47
49
|
const dataProps = buildDataProps(data)
|
48
50
|
const htmlProps = buildHtmlProps(htmlOptions)
|
51
|
+
const sizeClass = size === 'sm' ? 'size_small' : ''
|
49
52
|
const classes = classnames(
|
50
53
|
buildCss('pb_circle_icon_button_kit'),
|
54
|
+
sizeClass,
|
51
55
|
globalProps(props),
|
52
56
|
className
|
53
57
|
)
|
@@ -18,8 +18,16 @@ module Playbook
|
|
18
18
|
prop :new_window, type: Playbook::Props::Boolean,
|
19
19
|
default: false
|
20
20
|
prop :target
|
21
|
+
prop :size, type: Playbook::Props::Enum,
|
22
|
+
values: %w[default sm],
|
23
|
+
default: "default"
|
24
|
+
|
21
25
|
def classname
|
22
|
-
generate_classname("pb_circle_icon_button_kit")
|
26
|
+
generate_classname("pb_circle_icon_button_kit") + size_class
|
27
|
+
end
|
28
|
+
|
29
|
+
def size_class
|
30
|
+
size == "sm" ? " size_small" : ""
|
23
31
|
end
|
24
32
|
end
|
25
33
|
end
|
@@ -30,3 +30,17 @@ test('passes loading prop to button', () => {
|
|
30
30
|
|
31
31
|
expect(button).toBeInTheDocument()
|
32
32
|
})
|
33
|
+
|
34
|
+
test('adds size_small class when size is sm', () => {
|
35
|
+
render(
|
36
|
+
<CircleIconButton
|
37
|
+
data={{ testid: 'small-size-test' }}
|
38
|
+
icon="plus"
|
39
|
+
size="sm"
|
40
|
+
/>
|
41
|
+
)
|
42
|
+
|
43
|
+
const kit = screen.getByTestId('small-size-test')
|
44
|
+
|
45
|
+
expect(kit).toHaveClass('pb_circle_icon_button_kit size_small')
|
46
|
+
})
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%= pb_rails("flex", props: { orientation: "column", gap: "sm" }) do %>
|
2
|
+
<%= pb_rails("circle_icon_button", props: {
|
3
|
+
icon: "plus",
|
4
|
+
size: "sm",
|
5
|
+
variant: "primary"
|
6
|
+
}) %>
|
7
|
+
|
8
|
+
<%= pb_rails("circle_icon_button", props: {
|
9
|
+
icon: "pen",
|
10
|
+
loading: true,
|
11
|
+
size: "sm",
|
12
|
+
variant: "secondary"
|
13
|
+
}) %>
|
14
|
+
|
15
|
+
<%= pb_rails("circle_icon_button", props: {
|
16
|
+
disabled: true,
|
17
|
+
icon: "times",
|
18
|
+
size: "sm"
|
19
|
+
}) %>
|
20
|
+
|
21
|
+
<%= pb_rails("circle_icon_button", props: {
|
22
|
+
icon: "info",
|
23
|
+
link: "https://playbook.powerapp.cloud/",
|
24
|
+
size: "sm",
|
25
|
+
target: "child",
|
26
|
+
variant: "link"
|
27
|
+
}) %>
|
28
|
+
<% end %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import CircleIconButton from '../_circle_icon_button'
|
4
|
+
import Flex from '../../pb_flex/_flex'
|
5
|
+
|
6
|
+
const CircleIconButtonSize = (props) => (
|
7
|
+
<>
|
8
|
+
<Flex gap="sm"
|
9
|
+
orientation="column"
|
10
|
+
>
|
11
|
+
<CircleIconButton
|
12
|
+
icon="plus"
|
13
|
+
size="sm"
|
14
|
+
variant="primary"
|
15
|
+
{...props}
|
16
|
+
/>
|
17
|
+
<CircleIconButton
|
18
|
+
icon="pen"
|
19
|
+
loading
|
20
|
+
size="sm"
|
21
|
+
variant="secondary"
|
22
|
+
{...props}
|
23
|
+
/>
|
24
|
+
<CircleIconButton
|
25
|
+
disabled
|
26
|
+
icon="times"
|
27
|
+
size="sm"
|
28
|
+
{...props}
|
29
|
+
/>
|
30
|
+
<CircleIconButton
|
31
|
+
icon="info"
|
32
|
+
link="https://playbook.powerapp.cloud/"
|
33
|
+
size="sm"
|
34
|
+
target="child"
|
35
|
+
variant="link"
|
36
|
+
{...props}
|
37
|
+
/>
|
38
|
+
</Flex>
|
39
|
+
</>
|
40
|
+
)
|
41
|
+
|
42
|
+
export default CircleIconButtonSize
|
@@ -0,0 +1 @@
|
|
1
|
+
The `size` prop accepts "sm" as a value to make the Circle Icon Button 20px x 20px instead of the default 40px x 40px size.
|
@@ -4,9 +4,11 @@ examples:
|
|
4
4
|
- circle_icon_button_default: Default
|
5
5
|
- circle_icon_button_link: Link
|
6
6
|
- circle_icon_button_loading: Loading
|
7
|
+
- circle_icon_button_size: Size
|
7
8
|
|
8
9
|
react:
|
9
10
|
- circle_icon_button_default: Default
|
10
11
|
- circle_icon_button_click: Click Handler
|
11
12
|
- circle_icon_button_link: Link
|
12
13
|
- circle_icon_button_loading: Loading
|
14
|
+
- circle_icon_button_size: Size
|
@@ -2,3 +2,4 @@ export { default as CircleIconButtonDefault } from './_circle_icon_button_defaul
|
|
2
2
|
export { default as CircleIconButtonClick } from './_circle_icon_button_click.jsx'
|
3
3
|
export { default as CircleIconButtonLink } from './_circle_icon_button_link.jsx'
|
4
4
|
export { default as CircleIconButtonLoading } from './_circle_icon_button_loading.jsx'
|
5
|
+
export { default as CircleIconButtonSize } from './_circle_icon_button_size.jsx'
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
import React, { useState } from 'react'
|
1
|
+
import React from 'react'
|
3
2
|
import classnames from 'classnames'
|
4
3
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
5
4
|
import { globalProps } from '../utilities/globalProps'
|
@@ -7,16 +6,19 @@ import { globalProps } from '../utilities/globalProps'
|
|
7
6
|
import Button from '../pb_button/_button'
|
8
7
|
import Tooltip from '../pb_tooltip/_tooltip'
|
9
8
|
|
9
|
+
import usePBCopy from './usePBCopy'
|
10
|
+
|
10
11
|
type CopyButtonProps = {
|
11
|
-
aria?: { [key: string]: string }
|
12
|
-
className?: string
|
13
|
-
data?: { [key: string]: string }
|
14
|
-
id?: string
|
15
|
-
from?: string
|
16
|
-
text?: string
|
17
|
-
tooltipPlacement?:
|
18
|
-
tooltipText?: string
|
19
|
-
value?: string
|
12
|
+
aria?: { [key: string]: string }
|
13
|
+
className?: string
|
14
|
+
data?: { [key: string]: string }
|
15
|
+
id?: string
|
16
|
+
from?: string
|
17
|
+
text?: string
|
18
|
+
tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left'
|
19
|
+
tooltipText?: string
|
20
|
+
value?: string
|
21
|
+
timeout?: number
|
20
22
|
}
|
21
23
|
|
22
24
|
const CopyButton = (props: CopyButtonProps) => {
|
@@ -27,62 +29,34 @@ const CopyButton = (props: CopyButtonProps) => {
|
|
27
29
|
from = '',
|
28
30
|
id,
|
29
31
|
text= 'Copy',
|
32
|
+
timeout = 1000,
|
30
33
|
tooltipPlacement= 'bottom',
|
31
34
|
tooltipText = 'Copied!',
|
32
35
|
value = '',
|
33
36
|
} = props
|
34
37
|
|
35
|
-
const [copied,
|
38
|
+
const [copied, copy] = usePBCopy({ value, from, timeout })
|
36
39
|
|
37
40
|
const ariaProps = buildAriaProps(aria)
|
38
41
|
const dataProps = buildDataProps(data)
|
39
42
|
const classes = classnames(buildCss('pb_copy_button_kit'), globalProps(props), className)
|
40
43
|
|
41
|
-
const copy = () => {
|
42
|
-
if (!from && !value) {
|
43
|
-
return
|
44
|
-
}
|
45
|
-
|
46
|
-
if (value) {
|
47
|
-
navigator.clipboard.writeText(value)
|
48
|
-
} else if (from) {
|
49
|
-
const copyElement = document.getElementById(from);
|
50
|
-
let copyText = copyElement?.innerText
|
51
|
-
|
52
|
-
if (copyElement instanceof HTMLTextAreaElement || copyElement instanceof HTMLInputElement) {
|
53
|
-
copyText = copyElement.value;
|
54
|
-
}
|
55
|
-
|
56
|
-
if (copyText) {
|
57
|
-
navigator.clipboard.writeText(copyText)
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
|
-
setCopied(true)
|
62
|
-
|
63
|
-
setTimeout(() => {
|
64
|
-
setCopied(false)
|
65
|
-
}, 1000);
|
66
|
-
}
|
67
|
-
|
68
44
|
return (
|
69
|
-
<div
|
70
|
-
{...ariaProps}
|
45
|
+
<div {...ariaProps}
|
71
46
|
{...dataProps}
|
72
47
|
className={classes}
|
73
48
|
id={id}
|
74
49
|
>
|
75
|
-
<Tooltip
|
50
|
+
<Tooltip
|
76
51
|
forceOpenTooltip={copied}
|
77
52
|
placement={tooltipPlacement}
|
78
53
|
showTooltip={false}
|
79
54
|
text={tooltipText}
|
80
55
|
>
|
81
|
-
<Button
|
82
|
-
icon='copy'
|
56
|
+
<Button icon="copy"
|
83
57
|
onClick={copy}
|
84
58
|
>
|
85
|
-
{
|
59
|
+
{text}
|
86
60
|
</Button>
|
87
61
|
</Tooltip>
|
88
62
|
</div>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
2
|
+
import usePBCopy from '../../pb_copy_button/usePBCopy'
|
3
|
+
import Body from '../../pb_body/_body'
|
4
|
+
import Textarea from '../../pb_textarea/_textarea'
|
5
|
+
import Tooltip from '../../pb_tooltip/_tooltip'
|
6
|
+
|
7
|
+
const CopyButtonHook = ({...props}) => {
|
8
|
+
// This is how you can use the copy button hook to copy text to the clipboard
|
9
|
+
// eslint-disable-next-line no-unused-vars
|
10
|
+
const [copied, copyToClipboard] = usePBCopy({ from: 'hookbody' })
|
11
|
+
// I added a tooltip so it looks better in the ui
|
12
|
+
const [showTooltip, setShowTooltip] = useState(false)
|
13
|
+
|
14
|
+
const handleCopy = () => {
|
15
|
+
copyToClipboard()
|
16
|
+
setShowTooltip(true)
|
17
|
+
setTimeout(() => setShowTooltip(false), 1500)
|
18
|
+
}
|
19
|
+
|
20
|
+
useEffect(() => {
|
21
|
+
const el = document.getElementById('hookbody')
|
22
|
+
if (!el) return
|
23
|
+
|
24
|
+
el.addEventListener('click', handleCopy)
|
25
|
+
return () => {
|
26
|
+
el.removeEventListener('click', handleCopy)
|
27
|
+
}
|
28
|
+
}, [copyToClipboard])
|
29
|
+
|
30
|
+
return (
|
31
|
+
<div>
|
32
|
+
<Tooltip
|
33
|
+
delay={{ close: 1000 }}
|
34
|
+
forceOpenTooltip={showTooltip}
|
35
|
+
placement="top"
|
36
|
+
showTooltip={false}
|
37
|
+
text="Copied!"
|
38
|
+
>
|
39
|
+
<Body
|
40
|
+
cursor="pointer"
|
41
|
+
id="hookbody"
|
42
|
+
text="I'm a custom copy hook! Click this body to copy this text!"
|
43
|
+
/>
|
44
|
+
</Tooltip>
|
45
|
+
|
46
|
+
<Textarea
|
47
|
+
{...props}
|
48
|
+
placeholder="Paste here"
|
49
|
+
/>
|
50
|
+
</div>
|
51
|
+
)
|
52
|
+
}
|
53
|
+
|
54
|
+
export default CopyButtonHook
|
@@ -0,0 +1,3 @@
|
|
1
|
+
We provide a `usePBCopy` hook that you can import to your project. This hook will return a function that you can call to copy the text to the clipboard.
|
2
|
+
|
3
|
+
`usePBCopy({ from: 'your_id' })` will grab the `innerText` from `your_id` element, or `value` if it is an input element.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= pb_rails("body", props: { cursor: "pointer", data: { "external-copy-from": "hookbody"} }) do %>
|
2
|
+
<span id="hookbody">I'm a custom copy hook! Click this body to copy this text!</span>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= pb_rails("tooltip", props: {
|
6
|
+
trigger_element_selector: "#hookbody",
|
7
|
+
tooltip_id: "hookbody_tooltip",
|
8
|
+
position: 'top',
|
9
|
+
trigger_method: "click"
|
10
|
+
}) do %>
|
11
|
+
Copied!
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= pb_rails("textarea", props: { margin_top: "xs", placeholder: "Paste here" }) %>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
You can use any external control (like the text itself or an icon) to copy. To use this hook, set the `data-external-copy-from` attribute on the external control to the copying ID. This will grab the `innerText` from `your_id` element, or `value` if it is an input element. Alternatively, you can set a `data-external-copy-value` attribute and copy custom text.
|
2
|
+
|
3
|
+
See the code example for details.
|
@@ -1,2 +1,3 @@
|
|
1
1
|
export { default as CopyButtonDefault } from './_copy_button_default.jsx'
|
2
|
-
export { default as CopyButtonFrom } from './_copy_button_from.jsx'
|
2
|
+
export { default as CopyButtonFrom } from './_copy_button_from.jsx'
|
3
|
+
export { default as CopyButtonHook } from './_copy_button_hook.jsx'
|
@@ -1,6 +1,33 @@
|
|
1
1
|
import PbEnhancedElement from "../pb_enhanced_element"
|
2
2
|
|
3
|
-
|
3
|
+
function getTextFromElement(element) {
|
4
|
+
if (!element) return ''
|
5
|
+
return element.tagName.toLowerCase() === 'input'
|
6
|
+
? element.value
|
7
|
+
: element.innerText
|
8
|
+
}
|
9
|
+
|
10
|
+
function copyTextToClipboard(text) {
|
11
|
+
if (!text) return
|
12
|
+
navigator.clipboard.writeText(text)
|
13
|
+
.catch(err => console.error('Failed to copy text:', err))
|
14
|
+
}
|
15
|
+
|
16
|
+
function handleExternalControlCopyClick(element) {
|
17
|
+
const value = element.getAttribute('data-external-copy-value')
|
18
|
+
const fromId = element.getAttribute('data-external-copy-from')
|
19
|
+
|
20
|
+
if (value) {
|
21
|
+
copyTextToClipboard(value)
|
22
|
+
} else if (fromId) {
|
23
|
+
const fromElement = document.querySelector(`#${fromId}`)
|
24
|
+
copyTextToClipboard(getTextFromElement(fromElement))
|
25
|
+
} else {
|
26
|
+
console.warn('Failed to copy:', element)
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
export class PbCopyButton extends PbEnhancedElement {
|
4
31
|
static get selector() {
|
5
32
|
return '.pb_copy_button_kit'
|
6
33
|
}
|
@@ -20,28 +47,27 @@ export default class PbCopyButton extends PbEnhancedElement {
|
|
20
47
|
}
|
21
48
|
|
22
49
|
handleClick() {
|
50
|
+
const value = this.element.getAttribute('data-copy-value')
|
23
51
|
const fromId = this.element.getAttribute('data-from')
|
24
|
-
if (fromId) {
|
25
|
-
const fromElement = document.querySelector(`#${fromId}`)
|
26
|
-
if (fromElement) {
|
27
|
-
let contentToCopy = ''
|
28
|
-
if (fromElement.tagName.toLowerCase() === 'input') {
|
29
|
-
contentToCopy = fromElement.value
|
30
|
-
} else {
|
31
|
-
contentToCopy = fromElement.innerText
|
32
|
-
}
|
33
|
-
navigator.clipboard.writeText(contentToCopy)
|
34
|
-
.catch(err => console.error('Failed to copy text', err))
|
35
|
-
return
|
36
|
-
}
|
37
|
-
}
|
38
52
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
53
|
+
if (value) {
|
54
|
+
copyTextToClipboard(value)
|
55
|
+
} else if (fromId) {
|
56
|
+
const fromElement = document.querySelector(`#${fromId}`)
|
57
|
+
copyTextToClipboard(getTextFromElement(fromElement))
|
43
58
|
} else {
|
44
|
-
console.warn('No data-copy-value
|
59
|
+
console.warn('No data-copy-value or data-from attribute found')
|
45
60
|
}
|
46
61
|
}
|
47
62
|
}
|
63
|
+
|
64
|
+
export function addCopyEventListeners() {
|
65
|
+
const externalCopyElements = [
|
66
|
+
...document.querySelectorAll('div[data-external-copy-value]'),
|
67
|
+
...document.querySelectorAll('div[data-external-copy-from]')
|
68
|
+
]
|
69
|
+
|
70
|
+
externalCopyElements.forEach(element => {
|
71
|
+
element.addEventListener('click', () => handleExternalControlCopyClick(element))
|
72
|
+
})
|
73
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { useState, useRef, useEffect } from 'react'
|
2
|
+
|
3
|
+
type UsePBCopyProps = {
|
4
|
+
value?: string
|
5
|
+
from?: string
|
6
|
+
timeout?: number
|
7
|
+
}
|
8
|
+
|
9
|
+
export default function usePBCopy({
|
10
|
+
value = '',
|
11
|
+
from = '',
|
12
|
+
timeout = 0,
|
13
|
+
}: UsePBCopyProps) {
|
14
|
+
const [copied, setCopied] = useState(false)
|
15
|
+
const timerRef = useRef<number>()
|
16
|
+
|
17
|
+
const copy = () => {
|
18
|
+
if (!value && !from) return
|
19
|
+
|
20
|
+
if (value) {
|
21
|
+
navigator.clipboard.writeText(value)
|
22
|
+
} else {
|
23
|
+
const el = document.getElementById(from)
|
24
|
+
let text = el?.innerText
|
25
|
+
if (el instanceof HTMLTextAreaElement || el instanceof HTMLInputElement) {
|
26
|
+
text = el.value
|
27
|
+
}
|
28
|
+
if (text) navigator.clipboard.writeText(text)
|
29
|
+
}
|
30
|
+
|
31
|
+
setCopied(true)
|
32
|
+
window.clearTimeout(timerRef.current)
|
33
|
+
timerRef.current = window.setTimeout(() => {
|
34
|
+
setCopied(false)
|
35
|
+
}, timeout)
|
36
|
+
}
|
37
|
+
|
38
|
+
useEffect(() => {
|
39
|
+
return () => {
|
40
|
+
window.clearTimeout(timerRef.current)
|
41
|
+
}
|
42
|
+
}, [])
|
43
|
+
|
44
|
+
return [copied, copy] as const
|
45
|
+
}
|
@@ -50,6 +50,10 @@ type DatePickerProps = {
|
|
50
50
|
timeFormat?: string,
|
51
51
|
type?: string,
|
52
52
|
yearRange?: number[],
|
53
|
+
controlsStartId?: string,
|
54
|
+
controlsEndId?: string,
|
55
|
+
syncStartWith?: string,
|
56
|
+
syncEndWith?: string,
|
53
57
|
} & GlobalProps
|
54
58
|
|
55
59
|
const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
@@ -98,6 +102,10 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
98
102
|
staticPosition = true,
|
99
103
|
thisRangesEndToday = false,
|
100
104
|
yearRange = [1900, 2100],
|
105
|
+
controlsStartId,
|
106
|
+
controlsEndId,
|
107
|
+
syncStartWith,
|
108
|
+
syncEndWith,
|
101
109
|
} = props
|
102
110
|
|
103
111
|
const ariaProps = buildAriaProps(aria)
|
@@ -134,6 +142,10 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
134
142
|
staticPosition,
|
135
143
|
thisRangesEndToday,
|
136
144
|
yearRange,
|
145
|
+
controlsStartId,
|
146
|
+
controlsEndId,
|
147
|
+
syncStartWith,
|
148
|
+
syncEndWith,
|
137
149
|
required: false,
|
138
150
|
}, scrollContainer)
|
139
151
|
}, initializeOnce ? [] : undefined)
|
@@ -77,6 +77,14 @@ module Playbook
|
|
77
77
|
default: ""
|
78
78
|
prop :validation_message, type: Playbook::Props::String,
|
79
79
|
default: ""
|
80
|
+
prop :controls_start_id, type: Playbook::Props::String,
|
81
|
+
default: ""
|
82
|
+
prop :controls_end_id, type: Playbook::Props::String,
|
83
|
+
default: ""
|
84
|
+
prop :sync_start_with, type: Playbook::Props::String,
|
85
|
+
default: ""
|
86
|
+
prop :sync_end_with, type: Playbook::Props::String,
|
87
|
+
default: ""
|
80
88
|
|
81
89
|
def classname
|
82
90
|
default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
|
@@ -108,6 +116,10 @@ module Playbook
|
|
108
116
|
staticPosition: static_position,
|
109
117
|
thisRangesEndToday: this_ranges_end_today,
|
110
118
|
yearRange: year_range,
|
119
|
+
controlsStartId: controls_start_id,
|
120
|
+
controlsEndId: controls_end_id,
|
121
|
+
syncStartWith: sync_start_with,
|
122
|
+
syncEndWith: sync_end_with,
|
111
123
|
}.to_json.html_safe
|
112
124
|
end
|
113
125
|
|
@@ -32,7 +32,11 @@ type DatePickerConfig = {
|
|
32
32
|
thisRangesEndToday?: boolean,
|
33
33
|
timeCaption?: string,
|
34
34
|
timeFormat?: string,
|
35
|
-
yearRange: number[]
|
35
|
+
yearRange: number[],
|
36
|
+
controlsStartId?: string,
|
37
|
+
controlsEndId?: string,
|
38
|
+
syncStartWith?: string,
|
39
|
+
syncEndWith?: string,
|
36
40
|
} & Pick<BaseOptions, "allowInput" | "defaultDate" | "enableTime" | "maxDate" | "minDate" | "mode" | "plugins" | "position" | "positionElement" >
|
37
41
|
|
38
42
|
const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HTMLElement) => {
|
@@ -67,6 +71,10 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
67
71
|
timeCaption = 'Select Time',
|
68
72
|
timeFormat = 'at h:i K',
|
69
73
|
yearRange,
|
74
|
+
controlsStartId,
|
75
|
+
controlsEndId,
|
76
|
+
syncStartWith,
|
77
|
+
syncEndWith,
|
70
78
|
} = config
|
71
79
|
|
72
80
|
// ===========================================================
|
@@ -275,6 +283,47 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
275
283
|
})
|
276
284
|
}
|
277
285
|
|
286
|
+
// === Automatic Sync Logic for 3 input range pattern===
|
287
|
+
|
288
|
+
// If this is a quickpick that controls start and end
|
289
|
+
if (selectionType === "quickpick" && (controlsStartId || controlsEndId)) {
|
290
|
+
picker.config.onClose.push((selectedDates:string) => {
|
291
|
+
const [start, end] = selectedDates;
|
292
|
+
|
293
|
+
if (controlsStartId) {
|
294
|
+
const startPicker = (document.querySelector(`#${controlsStartId}`) as HTMLElement & { _flatpickr?: any })?._flatpickr;
|
295
|
+
startPicker?.setDate(start, true);
|
296
|
+
}
|
297
|
+
|
298
|
+
if (controlsEndId) {
|
299
|
+
const endPicker = (document.querySelector(`#${controlsEndId}`) as HTMLElement & { _flatpickr?: any })?._flatpickr;
|
300
|
+
endPicker?.setDate(end, true);
|
301
|
+
}
|
302
|
+
});
|
303
|
+
}
|
304
|
+
|
305
|
+
// If this is a start picker that syncs with a quickpick
|
306
|
+
if (syncStartWith) {
|
307
|
+
picker.config.onClose.push((selectedDates: string) => {
|
308
|
+
if (selectedDates?.length) {
|
309
|
+
const quickpick = (document.querySelector(`#${syncStartWith}`) as HTMLElement & { _flatpickr?: any })?._flatpickr;
|
310
|
+
quickpick?.clear();
|
311
|
+
}
|
312
|
+
});
|
313
|
+
}
|
314
|
+
|
315
|
+
// If this is an end picker that syncs with a quickpick
|
316
|
+
if (syncEndWith) {
|
317
|
+
picker.config.onClose.push((selectedDates: string) => {
|
318
|
+
if (selectedDates?.length) {
|
319
|
+
const quickpick = (document.querySelector(`#${syncEndWith}`) as HTMLElement & { _flatpickr?: any })?._flatpickr;
|
320
|
+
quickpick?.clear();
|
321
|
+
}
|
322
|
+
});
|
323
|
+
}
|
324
|
+
// === End of Automatic Sync Logic ===
|
325
|
+
|
326
|
+
|
278
327
|
// Adding dropdown icons to year and month select
|
279
328
|
dropdown.insertAdjacentHTML('afterend', `<i class="year-dropdown-icon">${angleDown}</i>`)
|
280
329
|
if (picker.monthElements[0].parentElement) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= pb_rails("date_picker", props: {
|
2
|
-
error: "Invalid date. Please pick a valid date.",
|
1
|
+
<%= pb_rails("date_picker", props: {
|
2
|
+
error: raw(pb_rails("icon", props: { icon: "warning" }) + " Invalid date. Please pick a valid date."),
|
3
3
|
picker_id: "date-picker-error"
|
4
4
|
}) %>
|
@@ -1,11 +1,14 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
|
3
3
|
import DatePicker from '../_date_picker'
|
4
|
+
import Icon from '../../pb_icon/_icon'
|
4
5
|
|
5
6
|
const DatePickerError = (props) => (
|
6
7
|
<div>
|
7
8
|
<DatePicker
|
8
|
-
error=
|
9
|
+
error={<>
|
10
|
+
<Icon icon="warning" /> Invalid date. Please pick a valid date.
|
11
|
+
</>}
|
9
12
|
pickerId="date-picker-error"
|
10
13
|
{...props}
|
11
14
|
/>
|
@@ -1,3 +1,7 @@
|
|
1
|
+
To use the `quickpick`:
|
2
|
+
- prop `mode` must be set to `range`
|
3
|
+
- prop `selection_type` must be set to `quickpick`
|
4
|
+
|
1
5
|
This date range variant uses hidden inputs to handle start and end dates. While they are not required props, it is advisable to specify a unique `start_date_id`, `start_date_name`, `end_date_id`, and `end_date_name` for each quick pick instance you place in a form and/or on a page.
|
2
6
|
|
3
7
|
Like all other date pickers, the quick pick does require a `picker_id`.
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Use `this_ranges_end_today`/`thisRangesEndToday` to set end date on all ranges that start with 'this' to today's date. For instance, by default 'This Year' will set end day to 12/31/(current year), but if the `this_ranges_end_today`/`thisRangesEndToday` prop is used, end date on that range will be today's date.
|
@@ -1 +1,5 @@
|
|
1
|
-
|
1
|
+
To use the `quickpick`:
|
2
|
+
- prop `mode` must be set to `range`
|
3
|
+
- prop `selectionType` must be set to `quickpick`
|
4
|
+
|
5
|
+
Use the `onClose` handler function to access the startDate and endDate values. Check the [`onClose` example](https://playbook.powerapp.cloud/kits/date_picker/react#onclose) for more information.
|