playbook_ui 14.25.0.pre.alpha.dialogfix10277 → 14.25.0.pre.alpha.play1986inlineloadingsolidvariant9963
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/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +6 -6
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +65 -60
- data/app/pb_kits/playbook/pb_avatar/avatar.test.js +1 -1
- data/app/pb_kits/playbook/pb_background/_background.scss +3 -3
- data/app/pb_kits/playbook/pb_badge/_badge.scss +29 -135
- data/app/pb_kits/playbook/pb_body/_body.scss +35 -108
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +1 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.scss +30 -17
- data/app/pb_kits/playbook/pb_button/_button.scss +31 -39
- data/app/pb_kits/playbook/pb_button/_button.tsx +12 -12
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +1 -1
- data/app/pb_kits/playbook/pb_button/button.rb +18 -11
- data/app/pb_kits/playbook/pb_button/button.test.js +3 -3
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.scss +73 -82
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar_dark.scss +33 -32
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar_mixins.scss +1 -1
- data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.test.js +2 -2
- data/app/pb_kits/playbook/pb_caption/_caption.scss +17 -100
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +8 -1
- data/app/pb_kits/playbook/pb_card/_card.scss +79 -116
- data/app/pb_kits/playbook/pb_card/_card.tsx +11 -26
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_card/card.rb +7 -8
- data/app/pb_kits/playbook/pb_card/card_header.rb +2 -6
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +2 -11
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +7 -7
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.test.js +1 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +1 -1
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +4 -4
- data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_currency/_currency.scss +39 -124
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.scss +6 -16
- data/app/pb_kits/playbook/pb_date/_date.scss +18 -16
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +1 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss +12 -12
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +2 -2
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_time_selection_styles.scss +5 -6
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss +23 -29
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +1 -1
- data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.scss +1 -1
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +2 -2
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.scss +26 -66
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.rb +1 -1
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.test.js +2 -2
- data/app/pb_kits/playbook/pb_date_time/_date_time.scss +15 -8
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +7 -6
- data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.scss +14 -17
- data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.test.js +1 -1
- data/app/pb_kits/playbook/pb_detail/_detail.scss +21 -86
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +123 -330
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +7 -5
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +2 -16
- data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.scss +7 -10
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_drawer/_close_icon.tsx +25 -0
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +381 -0
- data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +231 -0
- data/app/pb_kits/playbook/pb_drawer/_drawer_context.tsx +3 -0
- data/app/pb_kits/playbook/pb_drawer/context.ts +11 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +8 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.jsx +41 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +33 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +78 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +3 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +26 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +20 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx +59 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +24 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +61 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +24 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb +21 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +54 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb +49 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx +99 -0
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +20 -0
- data/app/pb_kits/playbook/pb_drawer/docs/index.js +7 -0
- data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +20 -0
- data/app/pb_kits/playbook/pb_drawer/drawer.rb +56 -0
- data/app/pb_kits/playbook/pb_drawer/drawer.test.jsx +81 -0
- data/app/pb_kits/playbook/pb_drawer/hooks/useBreakpoint.tsx +60 -0
- data/app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx +21 -0
- data/app/pb_kits/playbook/pb_drawer/index.js +257 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/index.js +3 -3
- data/app/pb_kits/playbook/pb_empty_state/_empty_state.scss +4 -4
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +9 -20
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +1 -1
- data/app/pb_kits/playbook/pb_filter/_filter.scss +8 -8
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +29 -65
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +2 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex.scss +100 -106
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +25 -32
- data/app/pb_kits/playbook/pb_flex/_flex_item.scss +51 -146
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -19
- data/app/pb_kits/playbook/pb_flex/flex.rb +16 -16
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +6 -6
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +1 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +344 -381
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.test.jsx +4 -4
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +7 -8
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +2 -9
- data/app/pb_kits/playbook/pb_gauge/_gauge.scss +5 -5
- data/app/pb_kits/playbook/pb_hashtag/_hashtag.scss +1 -1
- data/app/pb_kits/playbook/pb_highlight/_highlight.scss +1 -1
- data/app/pb_kits/playbook/pb_home_address_street/home_adress_street.test.js +2 -2
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.scss +4 -4
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +39 -40
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.rb +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_value/_icon_value.scss +15 -16
- data/app/pb_kits/playbook/pb_image/_image.scss +36 -41
- data/app/pb_kits/playbook/pb_label_pill/_label_pill.scss +1 -1
- data/app/pb_kits/playbook/pb_label_value/_label_value.scss +2 -3
- data/app/pb_kits/playbook/pb_label_value/label_value.test.js +2 -2
- data/app/pb_kits/playbook/pb_layout/_layout.scss +305 -336
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +11 -14
- data/app/pb_kits/playbook/pb_layout/item.rb +7 -1
- data/app/pb_kits/playbook/pb_layout/layout.rb +25 -16
- data/app/pb_kits/playbook/pb_layout/layout.test.js +3 -3
- data/app/pb_kits/playbook/pb_legend/_legend.scss +16 -66
- data/app/pb_kits/playbook/pb_legend/legend.test.js +1 -1
- data/app/pb_kits/playbook/pb_lightbox/lightbox.scss +4 -4
- data/app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_link/_link.scss +19 -113
- data/app/pb_kits/playbook/pb_list/_list.scss +1 -1
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.scss +11 -13
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +3 -1
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.html.erb +5 -0
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.jsx +24 -0
- data/app/pb_kits/playbook/pb_loading_inline/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_loading_inline/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +1 -1
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.rb +11 -0
- data/app/pb_kits/playbook/pb_map/_map.scss +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_with_custom_button.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_with_plugin.jsx +1 -1
- data/app/pb_kits/playbook/pb_message/_message.scss +16 -21
- data/app/pb_kits/playbook/pb_message/_message.tsx +0 -1
- data/app/pb_kits/playbook/pb_message/_message_mixins.scss +12 -5
- data/app/pb_kits/playbook/pb_message/message.html.erb +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +3 -6
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +15 -16
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +1 -1
- data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_online_status/_online_status.scss +15 -19
- data/app/pb_kits/playbook/pb_online_status/_online_status.tsx +1 -1
- data/app/pb_kits/playbook/pb_online_status/online_status.rb +4 -5
- data/app/pb_kits/playbook/pb_online_status/online_status.test.js +2 -2
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +1 -1
- data/app/pb_kits/playbook/pb_overlay/overlay.rb +1 -1
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +2 -5
- data/app/pb_kits/playbook/pb_person/_person.scss +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +1 -1
- data/app/pb_kits/playbook/pb_pill/_pill.scss +21 -23
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.scss +13 -15
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.scss +33 -108
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.scss +1 -1
- data/app/pb_kits/playbook/pb_radio/_radio.scss +52 -71
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +1 -1
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +3 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss +4 -4
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +70 -81
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +1 -9
- data/app/pb_kits/playbook/pb_section_separator/_section_separator_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.jsx +1 -3
- data/app/pb_kits/playbook/pb_section_separator/section_separator.rb +1 -7
- data/app/pb_kits/playbook/pb_select/_select.scss +4 -4
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +2 -6
- data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.scss +8 -17
- data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.scss +29 -39
- data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +0 -2
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss +11 -8
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.test.js +3 -2
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +2 -2
- data/app/pb_kits/playbook/pb_source/_source.scss +8 -8
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +1 -1
- data/app/pb_kits/playbook/pb_star_rating/star_rating.test.js +1 -1
- data/app/pb_kits/playbook/pb_stat_value/_stat_value.scss +2 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +5 -5
- data/app/pb_kits/playbook/pb_textarea/_textarea.scss +6 -6
- data/app/pb_kits/playbook/pb_time/_time.scss +17 -44
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.scss +23 -44
- data/app/pb_kits/playbook/pb_time_range_inline/time_range_inline.rb +1 -1
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.scss +8 -5
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.scss +10 -16
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +4 -1
- data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +1 -1
- data/app/pb_kits/playbook/pb_timestamp/timestamp.test.js +2 -2
- data/app/pb_kits/playbook/pb_title/_title.scss +39 -44
- data/app/pb_kits/playbook/pb_title/_title.tsx +8 -17
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +2 -2
- data/app/pb_kits/playbook/pb_title/title.rb +10 -20
- data/app/pb_kits/playbook/pb_title/title.test.js +4 -4
- data/app/pb_kits/playbook/pb_title_count/_title_count.scss +8 -19
- data/app/pb_kits/playbook/pb_title_detail/_title_detail.scss +11 -10
- data/app/pb_kits/playbook/pb_toggle/_toggle.scss +1 -4
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +4 -3
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +3 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.html.erb +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.html.erb +22 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_without_pills.html.erb +2 -2
- data/app/pb_kits/playbook/pb_user/_user.scss +33 -83
- data/app/pb_kits/playbook/pb_user/user.test.js +1 -1
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.scss +8 -23
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.scss +10 -10
- data/app/pb_kits/playbook/pb_weekday_stacked/weekday_stacked.test.jsx +3 -3
- data/dist/chunks/{_line_graph-CApw7aQD.js → _line_graph-CiVc-Cod.js} +1 -1
- data/dist/chunks/{_typeahead-J1_avqdO.js → _typeahead-BQnvz-Ks.js} +1 -1
- data/dist/chunks/_weekday_stacked-BkvHv3ZO.js +37 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +6 -0
- data/dist/playbook-doc.js +2 -2
- 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 +1 -1
- metadata +36 -5
- data/dist/chunks/_weekday_stacked-Bugv1mOh.js +0 -37
@@ -0,0 +1,381 @@
|
|
1
|
+
@import "../tokens/positioning";
|
2
|
+
@import "../tokens/colors";
|
3
|
+
@import "../pb_card/card_mixin";
|
4
|
+
@import "../tokens/shadows";
|
5
|
+
@import "../tokens/border_radius";
|
6
|
+
@import "../tokens/spacing";
|
7
|
+
@import "../tokens/animation-curves";
|
8
|
+
@import "../tokens/positioning";
|
9
|
+
|
10
|
+
$gutter: $space_lg;
|
11
|
+
$xsmall: 64px;
|
12
|
+
$small: 200px;
|
13
|
+
$medium: 250px;
|
14
|
+
$large: 300px;
|
15
|
+
$xlarge: 365px;
|
16
|
+
$animation-duration: .25s;
|
17
|
+
$z-index: $z_7;
|
18
|
+
|
19
|
+
@keyframes modalFadeInLeft {
|
20
|
+
from {
|
21
|
+
transform: translateX(-100%);
|
22
|
+
}
|
23
|
+
to {
|
24
|
+
transform: translateX(0);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
@keyframes modalFadeOutLeft {
|
29
|
+
from {
|
30
|
+
transform: translateX(0);
|
31
|
+
}
|
32
|
+
to {
|
33
|
+
transform: translateX(-100%);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
@keyframes modalFadeInRight {
|
38
|
+
from {
|
39
|
+
transform: translateX(100%);
|
40
|
+
}
|
41
|
+
to {
|
42
|
+
transform: translateX(0);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
@keyframes modalFadeOutRight {
|
47
|
+
from {
|
48
|
+
transform: translateX(0);
|
49
|
+
}
|
50
|
+
to {
|
51
|
+
transform: translateX(100%);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
@keyframes modalFadeIn {
|
56
|
+
from {
|
57
|
+
transform: translateY(-100%);
|
58
|
+
}
|
59
|
+
to {
|
60
|
+
transform: translateY(0);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
@keyframes modalFadeOut {
|
65
|
+
from {
|
66
|
+
transform: translateY(0);
|
67
|
+
}
|
68
|
+
to {
|
69
|
+
transform: translateY(-100%);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
@keyframes overlayFade {
|
74
|
+
from {
|
75
|
+
opacity: 0;
|
76
|
+
transform: translateY(0);
|
77
|
+
}
|
78
|
+
to {
|
79
|
+
opacity: 1;
|
80
|
+
transform: translateY(0);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
@keyframes overlayFadeOut {
|
85
|
+
from {
|
86
|
+
opacity: 1;
|
87
|
+
}
|
88
|
+
to {
|
89
|
+
opacity: 0;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
@keyframes modalFadeDownIn {
|
94
|
+
from {
|
95
|
+
transform: translateY(-100%);
|
96
|
+
}
|
97
|
+
to {
|
98
|
+
transform: translateY(0);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
@keyframes modalFadeDownOut {
|
103
|
+
from {
|
104
|
+
transform: translateY(0);
|
105
|
+
}
|
106
|
+
to {
|
107
|
+
transform: translateY(-100%);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
@keyframes modalFadeUpIn {
|
112
|
+
from {
|
113
|
+
transform: translateY(100%);
|
114
|
+
}
|
115
|
+
to {
|
116
|
+
transform: translateY(0);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
@keyframes modalFadeUpOut {
|
121
|
+
from {
|
122
|
+
transform: translateY(0);
|
123
|
+
}
|
124
|
+
to {
|
125
|
+
transform: translateY(100%);
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
body.PBDrawer__Body--open {
|
130
|
+
transition: margin-left $animation-duration ease-in, margin-right $animation-duration ease-in;
|
131
|
+
}
|
132
|
+
|
133
|
+
body.PBDrawer__Body--close {
|
134
|
+
transition: margin-left $animation-duration ease-out, margin-right $animation-duration ease-out;
|
135
|
+
}
|
136
|
+
|
137
|
+
.pb_drawer_lg_left .pb_drawer {
|
138
|
+
transform: translateX(-100%);
|
139
|
+
}
|
140
|
+
|
141
|
+
.pb_drawer_lg_right .pb_drawer {
|
142
|
+
transform: translateX(100%);
|
143
|
+
}
|
144
|
+
|
145
|
+
.pb_drawer.pb_drawer_after_open {
|
146
|
+
pointer-events: auto;
|
147
|
+
transform: translate3d(0, 0, 0);
|
148
|
+
}
|
149
|
+
|
150
|
+
// Drawer Styles
|
151
|
+
.pb_drawer {
|
152
|
+
background-color: $white;
|
153
|
+
z-index: $z-index;
|
154
|
+
border: 0;
|
155
|
+
height: 100%;
|
156
|
+
overflow: auto;
|
157
|
+
animation-duration: $animation-duration;
|
158
|
+
outline: none;
|
159
|
+
|
160
|
+
&.pb_drawer_within_element_rails {
|
161
|
+
position: relative;
|
162
|
+
width: 100%;
|
163
|
+
display: block;
|
164
|
+
background-color: $white;
|
165
|
+
overflow: hidden;
|
166
|
+
|
167
|
+
// Use max-height for a smooth accordion-like animation
|
168
|
+
max-height: 0;
|
169
|
+
transition: max-height $animation-duration ease-in-out;
|
170
|
+
z-index: 1;
|
171
|
+
|
172
|
+
&.open {
|
173
|
+
max-height: 1000px;
|
174
|
+
}
|
175
|
+
|
176
|
+
&::before {
|
177
|
+
content: '';
|
178
|
+
position: absolute;
|
179
|
+
top: 0;
|
180
|
+
left: 0;
|
181
|
+
right: 0;
|
182
|
+
bottom: 0;
|
183
|
+
background-color: inherit;
|
184
|
+
z-index: -1;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
&.pb_drawer_within_element {
|
189
|
+
position: relative;
|
190
|
+
width: 100%;
|
191
|
+
display: block;
|
192
|
+
background-color: $white;
|
193
|
+
overflow: hidden;
|
194
|
+
transition: height $animation-duration ease-in-out;
|
195
|
+
height: var(--drawer-height);
|
196
|
+
z-index: 1;
|
197
|
+
|
198
|
+
&.pb_drawer_before_close {
|
199
|
+
height: 0;
|
200
|
+
}
|
201
|
+
|
202
|
+
&::before {
|
203
|
+
content: '';
|
204
|
+
position: absolute;
|
205
|
+
top: 0;
|
206
|
+
left: 0;
|
207
|
+
right: 0;
|
208
|
+
bottom: 0;
|
209
|
+
background-color: inherit;
|
210
|
+
z-index: -1;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
|
214
|
+
.toggle-content.is-visible {
|
215
|
+
display: block;
|
216
|
+
height: auto;
|
217
|
+
}
|
218
|
+
|
219
|
+
.drawer {
|
220
|
+
position: sticky;
|
221
|
+
will-change: transform;
|
222
|
+
top: 0;
|
223
|
+
background-color: $white;
|
224
|
+
z-index: $z_9;
|
225
|
+
}
|
226
|
+
|
227
|
+
&[class*="_left"] {
|
228
|
+
animation-name: modalFadeInLeft;
|
229
|
+
}
|
230
|
+
|
231
|
+
&[class*="_left"][class*="_before_close"] {
|
232
|
+
animation-name: modalFadeOutLeft;
|
233
|
+
animation-duration: $animation-duration;
|
234
|
+
transform: translateX(-100%);
|
235
|
+
}
|
236
|
+
|
237
|
+
&[class*="_right"] {
|
238
|
+
animation-name: modalFadeInRight;
|
239
|
+
justify-content: flex-end;
|
240
|
+
}
|
241
|
+
|
242
|
+
&[class*="_right"][class*="_before_close"] {
|
243
|
+
animation-name: modalFadeOutRight;
|
244
|
+
animation-duration: $animation-duration;
|
245
|
+
transform: translateX(100%);
|
246
|
+
}
|
247
|
+
|
248
|
+
&[class*="_bottom"] {
|
249
|
+
animation: none;
|
250
|
+
transform: none;
|
251
|
+
}
|
252
|
+
|
253
|
+
&[class*="_bottom"][class*="_before_close"] {
|
254
|
+
animation: none;
|
255
|
+
transform: none;
|
256
|
+
}
|
257
|
+
|
258
|
+
&[class*="_top"] {
|
259
|
+
animation-name: modalFadeUpIn;
|
260
|
+
}
|
261
|
+
|
262
|
+
&[class*="_top"][class*="_before_close"] {
|
263
|
+
animation-name: modalFadeUpOut;
|
264
|
+
animation-duration: $animation-duration;
|
265
|
+
}
|
266
|
+
|
267
|
+
|
268
|
+
&[class*="_xs_"] {
|
269
|
+
width: $xsmall;
|
270
|
+
max-width: $xsmall;
|
271
|
+
}
|
272
|
+
|
273
|
+
&[class*="_sm_"] {
|
274
|
+
width: $small;
|
275
|
+
max-width: $small;
|
276
|
+
}
|
277
|
+
|
278
|
+
&[class*="_md_"] {
|
279
|
+
width: $medium;
|
280
|
+
max-width: $medium;
|
281
|
+
}
|
282
|
+
|
283
|
+
&[class*="_lg_"] {
|
284
|
+
width: $large;
|
285
|
+
max-width: $large;
|
286
|
+
}
|
287
|
+
|
288
|
+
&[class*="_xl_"] {
|
289
|
+
width: $xlarge;
|
290
|
+
max-width: $xlarge;
|
291
|
+
}
|
292
|
+
|
293
|
+
&[class*="_full_"] {
|
294
|
+
width: 100%;
|
295
|
+
max-width: 100%;
|
296
|
+
}
|
297
|
+
|
298
|
+
&.drawer_border-full {
|
299
|
+
box-shadow: none;
|
300
|
+
border: 2px solid #f3f7fb;
|
301
|
+
}
|
302
|
+
|
303
|
+
&.drawer_border-right {
|
304
|
+
border-right: 2px solid #f3f7fb;
|
305
|
+
}
|
306
|
+
|
307
|
+
&.drawer_border-left {
|
308
|
+
border-left: 2px solid #f3f7fb;
|
309
|
+
}
|
310
|
+
|
311
|
+
&.no-background {
|
312
|
+
background-color: transparent;
|
313
|
+
}
|
314
|
+
|
315
|
+
&_close_icon {
|
316
|
+
cursor: pointer;
|
317
|
+
}
|
318
|
+
|
319
|
+
&_overlay {
|
320
|
+
position: fixed;
|
321
|
+
top: 0;
|
322
|
+
left: 0;
|
323
|
+
right: 0;
|
324
|
+
bottom: 0;
|
325
|
+
display: flex;
|
326
|
+
background-color: rgba($bg_dark, $opacity_4);
|
327
|
+
z-index: $z-index;
|
328
|
+
animation: overlayFade $animation-duration ease-in-out forwards;
|
329
|
+
|
330
|
+
&[class*="_left"]{
|
331
|
+
justify-content: flex-start;
|
332
|
+
}
|
333
|
+
|
334
|
+
&[class*="_center"]{
|
335
|
+
justify-content: center;
|
336
|
+
}
|
337
|
+
|
338
|
+
&[class*="_right"]{
|
339
|
+
justify-content: flex-end;
|
340
|
+
}
|
341
|
+
|
342
|
+
&_before_close {
|
343
|
+
animation: overlayFadeOut $animation-duration ease-in-out forwards;
|
344
|
+
opacity: 0;
|
345
|
+
// height: 0;
|
346
|
+
}
|
347
|
+
}
|
348
|
+
|
349
|
+
&_no_overlay {
|
350
|
+
position: fixed;
|
351
|
+
top: 0;
|
352
|
+
left: 0;
|
353
|
+
right: 0;
|
354
|
+
bottom: 0;
|
355
|
+
display: flex;
|
356
|
+
z-index: $z-index;
|
357
|
+
opacity: 1;
|
358
|
+
pointer-events: none;
|
359
|
+
|
360
|
+
&[class*="_right"]{
|
361
|
+
justify-content: flex-end;
|
362
|
+
}
|
363
|
+
|
364
|
+
&[class*="_left"]{
|
365
|
+
justify-content: flex-start;
|
366
|
+
}
|
367
|
+
|
368
|
+
&[class*="_center"]{
|
369
|
+
justify-content: center;
|
370
|
+
}
|
371
|
+
|
372
|
+
&_before_close {
|
373
|
+
height: 0;
|
374
|
+
}
|
375
|
+
}
|
376
|
+
|
377
|
+
|
378
|
+
&.pb_drawer_before_close {
|
379
|
+
transform: translateX(-100%);
|
380
|
+
}
|
381
|
+
}
|
@@ -0,0 +1,231 @@
|
|
1
|
+
import React, { useState, useEffect, useRef } from "react"
|
2
|
+
import classnames from "classnames"
|
3
|
+
|
4
|
+
import {
|
5
|
+
buildAriaProps,
|
6
|
+
buildCss,
|
7
|
+
buildDataProps,
|
8
|
+
buildHtmlProps,
|
9
|
+
} from "../utilities/props"
|
10
|
+
import { globalProps, globalInlineProps } from "../utilities/globalProps"
|
11
|
+
import { DrawerContext } from "./context"
|
12
|
+
import { useBreakpoint } from "./hooks/useBreakpoint"
|
13
|
+
|
14
|
+
type DrawerProps = {
|
15
|
+
aria?: { [key: string]: string }
|
16
|
+
behavior?: "floating" | "push"
|
17
|
+
border?: "full" | "none" | "right" | "left"
|
18
|
+
breakpoint?: "none" | "xs" | "sm" | "md" | "lg" | "xl"
|
19
|
+
children: React.ReactNode | React.ReactNode[] | string
|
20
|
+
className?: string
|
21
|
+
data?: { [key: string]: string }
|
22
|
+
htmlOptions?: { [key: string]: string | number | boolean | (() => void) }
|
23
|
+
id?: string
|
24
|
+
triggerId?: string
|
25
|
+
onClose?: () => void
|
26
|
+
opened: boolean
|
27
|
+
overlay: boolean
|
28
|
+
placement?: "left" | "right" | "top" | "bottom"
|
29
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | "full"
|
30
|
+
text?: string
|
31
|
+
withinElement?: boolean
|
32
|
+
}
|
33
|
+
|
34
|
+
const Drawer = (props: DrawerProps): React.ReactElement | null => {
|
35
|
+
const {
|
36
|
+
aria = {},
|
37
|
+
behavior = "floating",
|
38
|
+
border = "none",
|
39
|
+
breakpoint = "none",
|
40
|
+
className,
|
41
|
+
data = {},
|
42
|
+
htmlOptions = {},
|
43
|
+
id,
|
44
|
+
size = "md",
|
45
|
+
children,
|
46
|
+
triggerId,
|
47
|
+
opened,
|
48
|
+
onClose,
|
49
|
+
overlay = true,
|
50
|
+
placement = "left",
|
51
|
+
withinElement = false,
|
52
|
+
} = props
|
53
|
+
|
54
|
+
const drawerRef = useRef<HTMLDivElement>(null)
|
55
|
+
const [menuButtonOpened, setMenuButtonOpened] = useState(false)
|
56
|
+
const [shouldRender, setShouldRender] = useState(false)
|
57
|
+
const [isAnimating, setIsAnimating] = useState(false)
|
58
|
+
|
59
|
+
const { isOpenBreakpointOpen, isUserClosed, setIsUserClosed } = useBreakpoint(
|
60
|
+
{
|
61
|
+
breakpoint: breakpoint,
|
62
|
+
triggerId,
|
63
|
+
}
|
64
|
+
)
|
65
|
+
|
66
|
+
const modalIsOpened =
|
67
|
+
(isOpenBreakpointOpen && !isUserClosed) || menuButtonOpened || opened
|
68
|
+
|
69
|
+
useEffect(() => {
|
70
|
+
if (withinElement) return;
|
71
|
+
|
72
|
+
const sizeMap: { [key: string]: string } = {
|
73
|
+
xl: "365px",
|
74
|
+
lg: "300px",
|
75
|
+
md: "250px",
|
76
|
+
sm: "200px",
|
77
|
+
xs: "64px",
|
78
|
+
full: "100%",
|
79
|
+
};
|
80
|
+
const body = document.querySelector("body");
|
81
|
+
if (modalIsOpened && behavior === "push" && body) {
|
82
|
+
if (placement === "left") {
|
83
|
+
body.style.cssText = `margin-left: ${sizeMap[size]} !important; margin-right: '' !important;`;
|
84
|
+
} else if (placement === "right") {
|
85
|
+
body.style.cssText = `margin-right: ${sizeMap[size]} !important; margin-left: '' !important;`;
|
86
|
+
}
|
87
|
+
|
88
|
+
body.classList.add("PBDrawer__Body--open");
|
89
|
+
} else if (body) {
|
90
|
+
if (body.classList.contains("PBDrawer__Body--open")) {
|
91
|
+
body.classList.add("PBDrawer__Body--close");
|
92
|
+
}
|
93
|
+
body.style.cssText = "";
|
94
|
+
body.classList.remove("PBDrawer__Body--open");
|
95
|
+
}
|
96
|
+
}, [modalIsOpened]);
|
97
|
+
|
98
|
+
// Helper functions
|
99
|
+
const updateDrawerHeight = () => {
|
100
|
+
if (drawerRef.current) {
|
101
|
+
const height = drawerRef.current.scrollHeight;
|
102
|
+
drawerRef.current.style.setProperty('--drawer-height', `${height}px`);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
useEffect(() => {
|
107
|
+
if (modalIsOpened) {
|
108
|
+
setShouldRender(true)
|
109
|
+
if (withinElement) {
|
110
|
+
const timer = setTimeout(() => {
|
111
|
+
updateDrawerHeight()
|
112
|
+
setIsAnimating(true)
|
113
|
+
}, 10)
|
114
|
+
return () => clearTimeout(timer)
|
115
|
+
} else {
|
116
|
+
setIsAnimating(true)
|
117
|
+
}
|
118
|
+
} else {
|
119
|
+
setIsAnimating(false)
|
120
|
+
const timer = setTimeout(() => {
|
121
|
+
setShouldRender(false)
|
122
|
+
}, 250)
|
123
|
+
return () => clearTimeout(timer)
|
124
|
+
}
|
125
|
+
}, [modalIsOpened])
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
const handleMenuButtonClick = () => {
|
130
|
+
if (modalIsOpened) {
|
131
|
+
setMenuButtonOpened(false)
|
132
|
+
setIsUserClosed(true)
|
133
|
+
} else {
|
134
|
+
setMenuButtonOpened(true)
|
135
|
+
setIsUserClosed(false)
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
// Setup menu button click handler
|
140
|
+
useEffect(() => {
|
141
|
+
if (!triggerId) return;
|
142
|
+
|
143
|
+
const menuButton = document.getElementById(triggerId)
|
144
|
+
if (menuButton) {
|
145
|
+
menuButton.addEventListener("click", handleMenuButtonClick)
|
146
|
+
return () => menuButton.removeEventListener("click", handleMenuButtonClick)
|
147
|
+
}
|
148
|
+
}, [modalIsOpened])
|
149
|
+
|
150
|
+
const ariaProps = buildAriaProps(aria)
|
151
|
+
const dataProps = buildDataProps(data)
|
152
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
153
|
+
const dynamicInlineProps = globalInlineProps(props)
|
154
|
+
|
155
|
+
const drawerClasses = classnames(
|
156
|
+
"pb_drawer",
|
157
|
+
buildCss("pb_drawer", size as string, placement as string),
|
158
|
+
{
|
159
|
+
"drawer_border-full": border === "full",
|
160
|
+
"drawer_border-right": border === "right",
|
161
|
+
"drawer_border-left": border === "left",
|
162
|
+
pb_drawer_within_element: withinElement,
|
163
|
+
pb_drawer_after_open: isAnimating,
|
164
|
+
pb_drawer_before_close: !isAnimating && shouldRender,
|
165
|
+
},
|
166
|
+
withinElement ? "shadow_none" : "shadow_deepest",
|
167
|
+
globalProps(props),
|
168
|
+
className
|
169
|
+
)
|
170
|
+
|
171
|
+
const overlayClasses = classnames(
|
172
|
+
`pb_drawer${overlay ? "_overlay" : "_no_overlay"}`,
|
173
|
+
`drawer_content_${placement}`,
|
174
|
+
!overlay && "no-background",
|
175
|
+
{
|
176
|
+
pb_drawer_overlay_after_open: isAnimating,
|
177
|
+
pb_drawer_overlay_before_close: !isAnimating && shouldRender,
|
178
|
+
}
|
179
|
+
)
|
180
|
+
|
181
|
+
const api = {
|
182
|
+
onClose: () => {
|
183
|
+
if (triggerId) {
|
184
|
+
setMenuButtonOpened(false)
|
185
|
+
}
|
186
|
+
setIsUserClosed(true)
|
187
|
+
if (onClose) {
|
188
|
+
onClose()
|
189
|
+
}
|
190
|
+
},
|
191
|
+
}
|
192
|
+
|
193
|
+
const drawerContent = (
|
194
|
+
<div
|
195
|
+
className={drawerClasses}
|
196
|
+
onClick={(e) => e.stopPropagation()}
|
197
|
+
ref={drawerRef}
|
198
|
+
>
|
199
|
+
{children}
|
200
|
+
</div>
|
201
|
+
)
|
202
|
+
|
203
|
+
// Step 5: Only render when shouldRender is true
|
204
|
+
if (!shouldRender) return null
|
205
|
+
|
206
|
+
return (
|
207
|
+
<DrawerContext.Provider value={api}>
|
208
|
+
{withinElement ? (
|
209
|
+
drawerContent
|
210
|
+
) : (
|
211
|
+
<div
|
212
|
+
{...ariaProps}
|
213
|
+
{...dataProps}
|
214
|
+
{...htmlProps}
|
215
|
+
className={classnames(buildCss("pb_drawer_wrapper"), className)}
|
216
|
+
style={dynamicInlineProps}
|
217
|
+
>
|
218
|
+
<div
|
219
|
+
className={overlayClasses}
|
220
|
+
id={id}
|
221
|
+
onClick={overlay ? api.onClose : undefined}
|
222
|
+
>
|
223
|
+
{drawerContent}
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
)}
|
227
|
+
</DrawerContext.Provider>
|
228
|
+
)
|
229
|
+
}
|
230
|
+
|
231
|
+
export default Drawer
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import React, { useState } from "react"
|
2
|
+
|
3
|
+
import Button from '../../pb_button/_button'
|
4
|
+
import Drawer from '../../pb_drawer/_drawer'
|
5
|
+
import Flex from '../../pb_flex/_flex'
|
6
|
+
|
7
|
+
const useDrawer = (visible = false) => {
|
8
|
+
const [opened, setOpened] = useState(visible)
|
9
|
+
const toggle = () => setOpened(!opened)
|
10
|
+
|
11
|
+
return [opened, toggle]
|
12
|
+
}
|
13
|
+
|
14
|
+
const DrawerBehavior = () => {
|
15
|
+
const [drawerOpen, toggleDrawerOpen] = useDrawer()
|
16
|
+
|
17
|
+
return (
|
18
|
+
<>
|
19
|
+
<Flex wrap>
|
20
|
+
<Button id='sm'
|
21
|
+
marginRight='md'
|
22
|
+
onClick={toggleDrawerOpen}
|
23
|
+
>
|
24
|
+
{"Push Behavior"}
|
25
|
+
</Button>
|
26
|
+
</Flex>
|
27
|
+
<Flex>
|
28
|
+
<Drawer
|
29
|
+
behavior={"push"}
|
30
|
+
onClose={toggleDrawerOpen}
|
31
|
+
opened={drawerOpen}
|
32
|
+
size={"lg"}
|
33
|
+
>
|
34
|
+
Test me (Push Behavior)
|
35
|
+
</Drawer>
|
36
|
+
</Flex>
|
37
|
+
</>
|
38
|
+
)
|
39
|
+
}
|
40
|
+
|
41
|
+
export default DrawerBehavior
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= pb_rails("flex") do %>
|
2
|
+
<%= pb_rails("button", props: { text: "Drawer with border right", margin_right: "sm", data: {"open-drawer": "drawer-12"} }) %>
|
3
|
+
|
4
|
+
<%= pb_rails("drawer", props: {
|
5
|
+
id:"drawer-12",
|
6
|
+
overlay: false,
|
7
|
+
border: "right"
|
8
|
+
}) do %>
|
9
|
+
Test me (Border Right)
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
|
13
|
+
<%= pb_rails("button", props: { text: "Drawer with border left", margin_right: "sm", data: {"open-drawer": "drawer-13"} }) %>
|
14
|
+
|
15
|
+
<%= pb_rails("drawer", props: {
|
16
|
+
id:"drawer-13",
|
17
|
+
overlay: false,
|
18
|
+
border: "left"
|
19
|
+
}) do %>
|
20
|
+
Test me (Border Left)
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= pb_rails("button", props: { text: "Drawer with border full", data: {"open-drawer": "drawer-14"} }) %>
|
24
|
+
|
25
|
+
<%= pb_rails("drawer", props: {
|
26
|
+
id:"drawer-14",
|
27
|
+
overlay: false,
|
28
|
+
border: "full"
|
29
|
+
}) do %>
|
30
|
+
Test me (Border Full)
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
|