playbook_ui 14.13.0 → 14.14.0.pre.alpha.PBNTR866finalizecssendlessscroll6462
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 +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +127 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +55 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/TablePagination.tsx +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +275 -0
- data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +143 -3
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +66 -0
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +195 -0
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +45 -99
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +73 -0
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +52 -0
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/TableContainerStyles.ts +80 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +129 -7
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +153 -298
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +8 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_custom_cell.jsx +75 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +50 -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_rails.md +3 -1
- 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.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_infinite_scroll.json +152002 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +58 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +64 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +17 -8
- data/app/pb_kits/playbook/pb_checkbox/checkbox.test.js +16 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_react_hook.jsx +69 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_react_hook.md +1 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_currency/_currency.tsx +46 -31
- data/app/pb_kits/playbook/pb_currency/currency.html.erb +15 -8
- data/app/pb_kits/playbook/pb_currency/currency.rb +17 -2
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.html.erb +22 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.jsx +34 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_currency/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +4 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.jsx +90 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +7 -4
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +6 -3
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +32 -8
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +8 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +33 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +0 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +20 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +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.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/example.yml +5 -0
- data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +20 -12
- data/app/pb_kits/playbook/pb_drawer/drawer.rb +49 -1
- data/app/pb_kits/playbook/pb_drawer/index.js +257 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +2 -1
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +71 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +1 -2
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.jsx +17 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.html.erb +27 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.jsx +61 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +5 -3
- data/app/pb_kits/playbook/pb_icon_button/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +3 -0
- data/app/pb_kits/playbook/pb_icon_button/icon_button.test.jsx +39 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +1 -6
- data/app/pb_kits/playbook/pb_nav/item.html.erb +7 -19
- data/app/pb_kits/playbook/pb_nav/nav.html.erb +3 -8
- data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +1 -6
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +13 -0
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +11 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.html.erb +11 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.jsx +37 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_rails.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_react.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.html.erb +11 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.jsx +37 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional_react.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_overlay/index.js +61 -0
- data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +5 -3
- data/app/pb_kits/playbook/pb_overlay/overlay.rb +16 -1
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +12 -0
- data/app/pb_kits/playbook/pb_overlay/subcomponents/_overlay_token.tsx +48 -10
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -6
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.scss +6 -1
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +7 -5
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.jsx +7 -0
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.md +1 -0
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width.html.erb +1 -0
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width.jsx +18 -0
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width_rails.md +1 -0
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width_react.md +1 -0
- data/app/pb_kits/playbook/pb_progress_pills/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_progress_pills/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_progress_pills/progress_pills.html.erb +2 -7
- data/app/pb_kits/playbook/pb_progress_pills/progress_pills.rb +6 -0
- data/app/pb_kits/playbook/pb_progress_pills/progress_pills.test.js +26 -1
- data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +1 -5
- data/app/pb_kits/playbook/pb_progress_step/progress_step.html.erb +1 -5
- data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +3 -7
- data/app/pb_kits/playbook/pb_radio/radio.html.erb +6 -11
- data/app/pb_kits/playbook/pb_select/index.js +38 -0
- data/app/pb_kits/playbook/pb_select/select.rb +8 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.html.erb +47 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.jsx +88 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.html.erb +51 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +96 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.jsx +101 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_table/index.ts +41 -9
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +4 -0
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +29 -2
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +31 -3
- data/app/pb_kits/playbook/pb_table/table_body.html.erb +13 -7
- data/app/pb_kits/playbook/pb_table/table_body.rb +2 -0
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +14 -7
- data/app/pb_kits/playbook/pb_table/table_row.rb +14 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +14 -0
- data/app/pb_kits/playbook/pb_text_input/index.js +9 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +5 -2
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +0 -3
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.html.erb +39 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.md +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.html.erb +26 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +282 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +2 -2
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +10 -2
- data/dist/chunks/_typeahead-B1p_cPQJ.js +36 -0
- data/dist/chunks/_weekday_stacked-DTN9JLqd.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/{lib-DjpLC8uO.js → lib-Fr78pbpF.js} +2 -2
- data/dist/chunks/{pb_form_validation-S56UaHZl.js → pb_form_validation-CN51bfsD.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +3 -10
- data/dist/playbook-doc.js +1 -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/forms/builder/time_zone_select_field.rb +19 -0
- data/lib/playbook/forms/builder.rb +1 -0
- data/lib/playbook/version.rb +2 -2
- metadata +75 -24
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +0 -66
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +0 -98
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +0 -28
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.rb +0 -42
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.html.erb +0 -19
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.jsx +0 -26
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.html.erb +0 -10
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.jsx +0 -17
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_on_click.jsx +0 -19
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_onclick.html.erb +0 -16
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb +0 -35
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.jsx +0 -42
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb +0 -13
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/example.yml +0 -15
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/index.js +0 -4
- data/app/pb_kits/playbook/pb_avatar_action_button/pb_avatar_action_button.test.js +0 -31
- data/dist/chunks/_typeahead-btjo1UN5.js +0 -36
- data/dist/chunks/_weekday_stacked-DeYS_l8v.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
- /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible_with_custom_click.md → _table_with_collapsible_with_custom_click_react.md} +0 -0
@@ -0,0 +1,257 @@
|
|
1
|
+
import PbEnhancedElement from "../pb_enhanced_element"
|
2
|
+
|
3
|
+
export default class PbDrawer extends PbEnhancedElement {
|
4
|
+
static get selector() {
|
5
|
+
return ".pb_drawer_wrapper"
|
6
|
+
}
|
7
|
+
|
8
|
+
connect() {
|
9
|
+
this.handleToggleClick = this.handleToggleClick.bind(this)
|
10
|
+
this.handleOutsideClick = this.handleOutsideClick.bind(this)
|
11
|
+
this.handleResize = this.handleResize.bind(this)
|
12
|
+
|
13
|
+
this._toggleTriggers = Array.from(document.querySelectorAll("[data-open-drawer]"))
|
14
|
+
this._toggleTriggers.forEach(el => {
|
15
|
+
el.addEventListener("click", this.handleToggleClick)
|
16
|
+
})
|
17
|
+
|
18
|
+
this._wrappers = Array.from(document.querySelectorAll(".pb_drawer_wrapper"))
|
19
|
+
this._wrappers.forEach(el => {
|
20
|
+
el.addEventListener("mousedown", this.handleOutsideClick)
|
21
|
+
})
|
22
|
+
|
23
|
+
this._withinElementDrawers = Array.from(
|
24
|
+
document.querySelectorAll(".pb_drawer_within_element_rails[data-breakpoint]")
|
25
|
+
)
|
26
|
+
|
27
|
+
window.addEventListener("resize", this.handleResize)
|
28
|
+
this.handleResize()
|
29
|
+
}
|
30
|
+
|
31
|
+
disconnect() {
|
32
|
+
this._toggleTriggers.forEach(el => {
|
33
|
+
el.removeEventListener("click", this.handleToggleClick)
|
34
|
+
})
|
35
|
+
this._wrappers.forEach(el => {
|
36
|
+
el.removeEventListener("mousedown", this.handleOutsideClick)
|
37
|
+
})
|
38
|
+
window.removeEventListener("resize", this.handleResize)
|
39
|
+
}
|
40
|
+
|
41
|
+
getOverlay(wrapper) {
|
42
|
+
if (wrapper.id && wrapper.id.startsWith("drawer-wrapper-")) {
|
43
|
+
const overlayId = wrapper.id.replace("drawer-wrapper-", "drawer-overlay-")
|
44
|
+
return document.getElementById(overlayId)
|
45
|
+
}
|
46
|
+
return wrapper.querySelector(".pb_drawer_overlay") || wrapper.querySelector(".pb_drawer_no_overlay")
|
47
|
+
}
|
48
|
+
|
49
|
+
handleToggleClick(event) {
|
50
|
+
const trigger = event.currentTarget
|
51
|
+
const drawerId = trigger.dataset.openDrawer
|
52
|
+
const dialog = document.getElementById(drawerId)
|
53
|
+
if (!dialog) return
|
54
|
+
|
55
|
+
if (dialog.classList.contains("pb_drawer_within_element_rails")) {
|
56
|
+
if (dialog.classList.contains("open")) {
|
57
|
+
this.closeWithinElementDrawer(dialog)
|
58
|
+
dialog.dataset.manualOpen = "false"
|
59
|
+
} else {
|
60
|
+
this.openWithinElementDrawer(dialog)
|
61
|
+
dialog.dataset.manualOpen = "true"
|
62
|
+
}
|
63
|
+
return
|
64
|
+
}
|
65
|
+
|
66
|
+
const wrapperId = `drawer-wrapper-${drawerId}`
|
67
|
+
const wrapper = document.getElementById(wrapperId)
|
68
|
+
if (!wrapper) return
|
69
|
+
|
70
|
+
if (wrapper !== this.element) return
|
71
|
+
|
72
|
+
if (wrapper.classList.contains("open")) {
|
73
|
+
this.closeDrawer(wrapper, dialog)
|
74
|
+
wrapper.dataset.manualOpen = "false"
|
75
|
+
} else {
|
76
|
+
this.openDrawer(wrapper, dialog)
|
77
|
+
wrapper.dataset.manualOpen = "true"
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
openWithinElementDrawer(dialog) {
|
82
|
+
if (dialog.classList.contains("open")) return
|
83
|
+
dialog.style.maxHeight = "0px"
|
84
|
+
dialog.offsetHeight
|
85
|
+
dialog.classList.add("open")
|
86
|
+
// Get trigger's height and add it to the final height
|
87
|
+
const trigger = document.querySelector(`[data-open-drawer="${dialog.id}"]`)
|
88
|
+
const triggerHeight = trigger ? trigger.offsetHeight : 0
|
89
|
+
const finalHeight = (dialog.scrollHeight + triggerHeight) + "px"
|
90
|
+
dialog.style.maxHeight = finalHeight
|
91
|
+
dialog.addEventListener("transitionend", function handleOpenEnd(e) {
|
92
|
+
if (e.propertyName === "max-height") {
|
93
|
+
dialog.style.maxHeight = "none"
|
94
|
+
dialog.removeEventListener("transitionend", handleOpenEnd)
|
95
|
+
}
|
96
|
+
})
|
97
|
+
}
|
98
|
+
|
99
|
+
closeWithinElementDrawer(dialog) {
|
100
|
+
if (!dialog.classList.contains("open")) return
|
101
|
+
const currentHeight = dialog.scrollHeight
|
102
|
+
dialog.style.maxHeight = currentHeight + "px"
|
103
|
+
dialog.offsetHeight
|
104
|
+
dialog.classList.remove("open")
|
105
|
+
dialog.style.maxHeight = "0px"
|
106
|
+
dialog.addEventListener("transitionend", function handleCloseEnd(e) {
|
107
|
+
if (e.propertyName === "max-height") {
|
108
|
+
dialog.removeEventListener("transitionend", handleCloseEnd)
|
109
|
+
dialog.style.maxHeight = "0px"
|
110
|
+
}
|
111
|
+
})
|
112
|
+
}
|
113
|
+
|
114
|
+
openDrawer(wrapper, dialog) {
|
115
|
+
const behavior = wrapper.dataset.behavior
|
116
|
+
const size = wrapper.dataset.size
|
117
|
+
const placement = wrapper.dataset.placement
|
118
|
+
this.handlePushOpen(behavior, size, placement)
|
119
|
+
|
120
|
+
wrapper.style.display = ""
|
121
|
+
const overlay = this.getOverlay(wrapper)
|
122
|
+
if (overlay) overlay.style.display = ""
|
123
|
+
|
124
|
+
wrapper.classList.add("open")
|
125
|
+
dialog.classList.add("open")
|
126
|
+
}
|
127
|
+
|
128
|
+
closeDrawer(wrapper, dialog) {
|
129
|
+
const behavior = wrapper.dataset.behavior
|
130
|
+
this.handlePushClose(behavior)
|
131
|
+
|
132
|
+
if (wrapper.className.includes("open")) wrapper.style.display = "none"
|
133
|
+
const overlay = this.getOverlay(wrapper)
|
134
|
+
if (overlay && wrapper.className.includes("open")) overlay.style.display = "none"
|
135
|
+
|
136
|
+
wrapper.classList.remove("open")
|
137
|
+
dialog.classList.remove("open")
|
138
|
+
}
|
139
|
+
|
140
|
+
handleOutsideClick(event) {
|
141
|
+
const wrapper = event.currentTarget
|
142
|
+
const dialog = wrapper.querySelector(".pb_drawer")
|
143
|
+
const overlay = this.getOverlay(wrapper)
|
144
|
+
|
145
|
+
if (dialog && dialog.classList.contains("pb_drawer_within_element_rails")) {
|
146
|
+
return
|
147
|
+
}
|
148
|
+
|
149
|
+
if (wrapper.dataset.overlayClick === "overlay_close" && event.target === overlay) {
|
150
|
+
this.closeDrawer(wrapper, dialog)
|
151
|
+
event.stopPropagation()
|
152
|
+
return
|
153
|
+
}
|
154
|
+
|
155
|
+
const dialogRect = dialog.getBoundingClientRect()
|
156
|
+
const clickedOutside =
|
157
|
+
event.clientX < dialogRect.left ||
|
158
|
+
event.clientX > dialogRect.right ||
|
159
|
+
event.clientY < dialogRect.top ||
|
160
|
+
event.clientY > dialogRect.bottom
|
161
|
+
|
162
|
+
if (clickedOutside) {
|
163
|
+
this.closeDrawer(wrapper, dialog)
|
164
|
+
event.stopPropagation()
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
handleResize() {
|
169
|
+
const breakpointValues = {
|
170
|
+
none: 0,
|
171
|
+
xs: 575,
|
172
|
+
sm: 768,
|
173
|
+
md: 992,
|
174
|
+
lg: 1200,
|
175
|
+
xl: 1400,
|
176
|
+
}
|
177
|
+
|
178
|
+
// Process wrappers
|
179
|
+
this._wrappers.forEach(wrapper => {
|
180
|
+
const bp = wrapper.dataset.breakpoint || "none"
|
181
|
+
if (bp === "none") return
|
182
|
+
|
183
|
+
const threshold = breakpointValues[bp] || 0
|
184
|
+
const dialog = wrapper.querySelector(".pb_drawer")
|
185
|
+
const trigger = dialog ? document.querySelector(`[data-open-drawer="${dialog.id}"]`) : null
|
186
|
+
|
187
|
+
if (window.innerWidth >= threshold) {
|
188
|
+
if (!wrapper.classList.contains("open")) {
|
189
|
+
this.openDrawer(wrapper, dialog)
|
190
|
+
}
|
191
|
+
if (trigger) trigger.style.display = "none"
|
192
|
+
} else {
|
193
|
+
if (trigger) trigger.style.display = ""
|
194
|
+
if (wrapper.classList.contains("open") && wrapper.dataset.manualOpen !== "true") {
|
195
|
+
this.closeDrawer(wrapper, dialog)
|
196
|
+
}
|
197
|
+
}
|
198
|
+
})
|
199
|
+
|
200
|
+
// Process within element drawers
|
201
|
+
this._withinElementDrawers.forEach(drawer => {
|
202
|
+
const bp = drawer.dataset.breakpoint || "none"
|
203
|
+
if (bp === "none") return
|
204
|
+
|
205
|
+
const threshold = breakpointValues[bp] || 0
|
206
|
+
const trigger = document.querySelector(`[data-open-drawer="${drawer.id}"]`)
|
207
|
+
|
208
|
+
if (window.innerWidth >= threshold) {
|
209
|
+
if (!drawer.classList.contains("open")) {
|
210
|
+
this.openWithinElementDrawer(drawer)
|
211
|
+
}
|
212
|
+
if (trigger) trigger.style.display = "none"
|
213
|
+
} else {
|
214
|
+
if (trigger) trigger.style.display = ""
|
215
|
+
if (drawer.classList.contains("open") && drawer.dataset.manualOpen !== "true") {
|
216
|
+
this.closeWithinElementDrawer(drawer)
|
217
|
+
}
|
218
|
+
}
|
219
|
+
})
|
220
|
+
}
|
221
|
+
|
222
|
+
handlePushOpen(behavior, size, placement) {
|
223
|
+
if (behavior !== "push") return
|
224
|
+
|
225
|
+
const sizeMap = {
|
226
|
+
xl: "365px",
|
227
|
+
lg: "300px",
|
228
|
+
md: "250px",
|
229
|
+
sm: "200px",
|
230
|
+
xs: "64px",
|
231
|
+
full: "100%",
|
232
|
+
}
|
233
|
+
|
234
|
+
const body = document.querySelector("body")
|
235
|
+
if (!body) return
|
236
|
+
|
237
|
+
if (placement === "left") {
|
238
|
+
body.style.cssText = `margin-left: ${sizeMap[size]} !important; margin-right: '' !important;`
|
239
|
+
} else if (placement === "right") {
|
240
|
+
body.style.cssText = `margin-right: ${sizeMap[size]} !important; margin-left: '' !important;`
|
241
|
+
}
|
242
|
+
body.classList.add("PBDrawer__Body--open")
|
243
|
+
}
|
244
|
+
|
245
|
+
handlePushClose(behavior) {
|
246
|
+
if (behavior !== "push") return
|
247
|
+
|
248
|
+
const body = document.querySelector("body")
|
249
|
+
if (!body) return
|
250
|
+
|
251
|
+
if (body.classList.contains("PBDrawer__Body--open")) {
|
252
|
+
body.classList.add("PBDrawer__Body--close")
|
253
|
+
}
|
254
|
+
body.style.cssText = ""
|
255
|
+
body.classList.remove("PBDrawer__Body--open")
|
256
|
+
}
|
257
|
+
}
|
@@ -46,6 +46,7 @@
|
|
46
46
|
%>
|
47
47
|
<%= form.date_picker :example_date_picker_1, props: { label: true } %>
|
48
48
|
<%= form.star_rating_field :example_star_rating, props: { variant: "interactive", label: true } %>
|
49
|
+
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true } %>
|
49
50
|
|
50
51
|
<%= form.actions do |action| %>
|
51
52
|
<%= action.submit %>
|
@@ -32,11 +32,12 @@
|
|
32
32
|
<%= form.url_field :example_url_field_validation, props: { label: true, required: true } %>
|
33
33
|
<%= form.text_area :example_text_area_validation, props: { label: true, required: true } %>
|
34
34
|
<%= form.dropdown_field :example_dropdown_validation, props: { label: true, options: example_dropdown_options, required: true } %>
|
35
|
-
<%= form.select :example_select_validation, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true } %>
|
35
|
+
<%= form.select :example_select_validation, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true, validation_message: "Please, select an option." } %>
|
36
36
|
<%= form.collection_select :example_collection_select_validation, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
|
37
37
|
<%= form.check_box :example_checkbox, props: { text: "Example Checkbox", label: true, required: true } %>
|
38
38
|
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true } %>
|
39
39
|
<%= form.star_rating_field :example_star_rating_validation, props: { variant: "interactive", label: true, required: true } %>
|
40
|
+
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true, blank_selection: "Select a Time Zone...", required: true } %>
|
40
41
|
|
41
42
|
<%= form.actions do |action| %>
|
42
43
|
<%= action.submit %>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
|
2
|
+
import React from 'react'
|
3
|
+
import classnames from 'classnames'
|
4
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
5
|
+
import { globalProps } from '../utilities/globalProps'
|
6
|
+
|
7
|
+
import Button from '../pb_button/_button'
|
8
|
+
import Icon from '../pb_icon/_icon'
|
9
|
+
import { IconSizes } from "../pb_icon/_icon"
|
10
|
+
|
11
|
+
type IconButtonProps = {
|
12
|
+
aria?: { [key: string]: string },
|
13
|
+
className?: string,
|
14
|
+
data?: { [key: string]: string },
|
15
|
+
htmlType?: 'submit' | 'reset' | 'button' | undefined,
|
16
|
+
icon?: string,
|
17
|
+
id?: string,
|
18
|
+
link?: string,
|
19
|
+
newWindow?: boolean,
|
20
|
+
size?: IconSizes,
|
21
|
+
target?: string,
|
22
|
+
variant?: 'default' | 'link',
|
23
|
+
}
|
24
|
+
|
25
|
+
const IconButton = (props: IconButtonProps) => {
|
26
|
+
const {
|
27
|
+
aria = {},
|
28
|
+
className,
|
29
|
+
data = {},
|
30
|
+
htmlType = 'button',
|
31
|
+
icon = 'bars',
|
32
|
+
id,
|
33
|
+
link,
|
34
|
+
newWindow = false,
|
35
|
+
size = "2x",
|
36
|
+
target,
|
37
|
+
variant = "default",
|
38
|
+
} = props
|
39
|
+
|
40
|
+
const ariaProps = buildAriaProps(aria)
|
41
|
+
const dataProps = buildDataProps(data)
|
42
|
+
const classes = classnames(buildCss('pb_icon_button_kit', variant), globalProps(props), className)
|
43
|
+
|
44
|
+
return (
|
45
|
+
<div
|
46
|
+
{...ariaProps}
|
47
|
+
{...dataProps}
|
48
|
+
className={classes}
|
49
|
+
id={id}
|
50
|
+
>
|
51
|
+
<Button
|
52
|
+
borderRadius="lg"
|
53
|
+
htmlType={htmlType}
|
54
|
+
link={link}
|
55
|
+
newWindow={newWindow}
|
56
|
+
target={target}
|
57
|
+
>
|
58
|
+
<Icon
|
59
|
+
className="icon_button_icon"
|
60
|
+
fixedWidth
|
61
|
+
icon={icon}
|
62
|
+
paddingX="xxs"
|
63
|
+
paddingY="xs"
|
64
|
+
size={size}
|
65
|
+
/>
|
66
|
+
</Button>
|
67
|
+
</div>
|
68
|
+
)
|
69
|
+
}
|
70
|
+
|
71
|
+
export default IconButton
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { IconButton } from 'playbook-ui'
|
3
|
+
|
4
|
+
const IconButtonDefault = (props) => (
|
5
|
+
<div>
|
6
|
+
<IconButton
|
7
|
+
{...props}
|
8
|
+
/>
|
9
|
+
<IconButton
|
10
|
+
{...props}
|
11
|
+
marginTop="md"
|
12
|
+
variant="link"
|
13
|
+
/>
|
14
|
+
</div>
|
15
|
+
)
|
16
|
+
|
17
|
+
export default IconButtonDefault
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= pb_rails("flex", props: { align: "center"}) do %>
|
2
|
+
<%= pb_rails("icon_button", props: {size: "lg"}) %> <span>Large</span>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= pb_rails("flex", props: { align: "center" }) do %>
|
6
|
+
<%= pb_rails("icon_button", props: {size: "sm"}) %> <span>Small</span>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%= pb_rails("flex", props: { align: "center" }) do %>
|
10
|
+
<%= pb_rails("icon_button", props: {size: "xs"}) %> <span>XSmall</span>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= pb_rails("flex", props: { align: "center", margin_top: "md" }) do %>
|
14
|
+
<%= pb_rails("icon_button", props: {size: "1x"}) %> <span>1x</span>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= pb_rails("flex", props: { align: "center" }) do %>
|
18
|
+
<%= pb_rails("icon_button", props: {size: "2x"}) %> <span>2x</span>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<%= pb_rails("flex", props: { align: "center" }) do %>
|
22
|
+
<%= pb_rails("icon_button", props: {size: "3x"}) %> <span>3x</span>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= pb_rails("flex", props: { align: "center" }) do %>
|
26
|
+
<%= pb_rails("icon_button", props: {size: "4x"}) %> <span>4x</span>
|
27
|
+
<% end %>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { IconButton, Flex } from 'playbook-ui'
|
3
|
+
|
4
|
+
const IconButtonSizes = (props) => (
|
5
|
+
<div>
|
6
|
+
<Flex align="center">
|
7
|
+
<IconButton
|
8
|
+
{...props}
|
9
|
+
size="lg"
|
10
|
+
/>
|
11
|
+
<span>Large</span>
|
12
|
+
</Flex>
|
13
|
+
<Flex align="center">
|
14
|
+
<IconButton
|
15
|
+
{...props}
|
16
|
+
size="sm"
|
17
|
+
/>
|
18
|
+
<span>Small</span>
|
19
|
+
</Flex>
|
20
|
+
<Flex align="center">
|
21
|
+
<IconButton
|
22
|
+
{...props}
|
23
|
+
size="xs"
|
24
|
+
/>
|
25
|
+
<span>XSmall</span>
|
26
|
+
</Flex>
|
27
|
+
<Flex
|
28
|
+
align="center"
|
29
|
+
marginTop="md"
|
30
|
+
>
|
31
|
+
<IconButton
|
32
|
+
{...props}
|
33
|
+
size="1x"
|
34
|
+
/>
|
35
|
+
<span>1x</span>
|
36
|
+
</Flex>
|
37
|
+
<Flex align="center">
|
38
|
+
<IconButton
|
39
|
+
{...props}
|
40
|
+
size="2x"
|
41
|
+
/>
|
42
|
+
<span>2x</span>
|
43
|
+
</Flex>
|
44
|
+
<Flex align="center">
|
45
|
+
<IconButton
|
46
|
+
{...props}
|
47
|
+
size="3x"
|
48
|
+
/>
|
49
|
+
<span>3x</span>
|
50
|
+
</Flex>
|
51
|
+
<Flex align="center">
|
52
|
+
<IconButton
|
53
|
+
{...props}
|
54
|
+
size="4x"
|
55
|
+
/>
|
56
|
+
<span>4x</span>
|
57
|
+
</Flex>
|
58
|
+
</div>
|
59
|
+
)
|
60
|
+
|
61
|
+
export default IconButtonSizes
|
@@ -14,6 +14,9 @@ module Playbook
|
|
14
14
|
prop :variant, type: Playbook::Props::Enum,
|
15
15
|
values: %w[default link],
|
16
16
|
default: "default"
|
17
|
+
prop :size, type: Playbook::Props::Enum,
|
18
|
+
values: %w[1x 2x 3x 4x 5x 6x 7x 8x 9x 10x xs sm lg],
|
19
|
+
default: "2x"
|
17
20
|
def classname
|
18
21
|
generate_classname("pb_icon_button_kit", variant)
|
19
22
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { ensureAccessible, renderKit } from '../utilities/test-utils'
|
2
|
+
|
3
|
+
import { IconButton } from 'playbook-ui'
|
4
|
+
|
5
|
+
const props = {
|
6
|
+
data: { testid: 'default', icon: 'plus' }
|
7
|
+
}
|
8
|
+
|
9
|
+
test('default test', () => {
|
10
|
+
const kit = renderKit(IconButton, props)
|
11
|
+
|
12
|
+
expect(kit).toBeInTheDocument()
|
13
|
+
expect(kit).toHaveClass('pb_icon_button_kit_default')
|
14
|
+
|
15
|
+
const iconElement = kit.querySelector('.icon_button_icon')
|
16
|
+
expect(iconElement).toBeInTheDocument()
|
17
|
+
})
|
18
|
+
|
19
|
+
it("should be accessible", async () => {
|
20
|
+
ensureAccessible(IconButton, props)
|
21
|
+
})
|
22
|
+
|
23
|
+
test('passes link variant prop', () => {
|
24
|
+
const kit = renderKit(IconButton, { ...props, variant: "link" })
|
25
|
+
expect(kit).toBeInTheDocument()
|
26
|
+
expect(kit).toHaveClass('pb_icon_button_kit_link')
|
27
|
+
})
|
28
|
+
|
29
|
+
test('should set button type to "submit" when htmlType prop is passed', () => {
|
30
|
+
const kit = renderKit(IconButton, { ...props, htmlType: 'submit' })
|
31
|
+
const buttonElement = kit.querySelector('button')
|
32
|
+
expect(buttonElement).toHaveAttribute('type', 'submit')
|
33
|
+
})
|
34
|
+
|
35
|
+
test('passes custom classname', () => {
|
36
|
+
const kit = renderKit(IconButton, { ...props, className: "extra_class" })
|
37
|
+
expect(kit).toBeInTheDocument()
|
38
|
+
expect(kit).toHaveClass('pb_icon_button_kit_default extra_class')
|
39
|
+
})
|
@@ -1,15 +1,9 @@
|
|
1
1
|
<% if object.collapsible %>
|
2
2
|
<%= pb_rails("collapsible", props: { name: "collapsible-nav-example", classname: object.collapsible_nav_classname }) do %>
|
3
3
|
<%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs", dark: object.dark, classname:object.margin_classes }) do %>
|
4
|
-
<%=
|
5
|
-
|
6
|
-
|
7
|
-
data: object.data,
|
8
|
-
dark: object.dark,
|
9
|
-
id: object.id,
|
10
|
-
href: object.link && object.link,
|
11
|
-
target: object.link && object.target,
|
12
|
-
**combined_html_options
|
4
|
+
<%= pb_content_tag( object.tag,
|
5
|
+
href: object.link && object.link,
|
6
|
+
target: object.link && object.target
|
13
7
|
) do %>
|
14
8
|
<% if object.image_url %>
|
15
9
|
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper_collapsible" }) %>
|
@@ -20,22 +14,16 @@
|
|
20
14
|
<span class="pb_nav_list_item_text_collapsible">
|
21
15
|
<%= object.text %>
|
22
16
|
</span>
|
23
|
-
<% end %>
|
17
|
+
<% end %>
|
24
18
|
<% end %>
|
25
19
|
<%= pb_rails("collapsible/collapsible_content", props: {collapsed: object.collapsed}) do %>
|
26
20
|
<%= content.presence %>
|
27
21
|
<% end %>
|
28
22
|
<% end %>
|
29
23
|
<% else %>
|
30
|
-
<%=
|
31
|
-
|
32
|
-
|
33
|
-
**combined_html_options,
|
34
|
-
data: object.data,
|
35
|
-
dark: object.dark,
|
36
|
-
id: object.id,
|
37
|
-
href: object.link && object.link,
|
38
|
-
target: object.link && object.target
|
24
|
+
<%= pb_content_tag( object.tag,
|
25
|
+
href: object.link && object.link,
|
26
|
+
target: object.link && object.target
|
39
27
|
) do %>
|
40
28
|
<% if object.image_url %>
|
41
29
|
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
|
@@ -1,12 +1,7 @@
|
|
1
|
-
<%=
|
2
|
-
aria: object.aria,
|
3
|
-
class: object.classname,
|
4
|
-
data: object.data,
|
5
|
-
id: object.id,
|
6
|
-
**combined_html_options) do %>
|
1
|
+
<%= pb_content_tag(:nav) do %>
|
7
2
|
<% if object.title %>
|
8
|
-
<%=
|
9
|
-
<%=
|
3
|
+
<%= pb_content_tag do %>
|
4
|
+
<%= pb_content_tag(:a) do %>
|
10
5
|
<%= pb_rails("caption", props: { text: object.title, dark: dark }) %>
|
11
6
|
<% end %>
|
12
7
|
<% end %>
|
@@ -69,4 +69,17 @@ $overlay_colors: (
|
|
69
69
|
pointer-events: none;
|
70
70
|
z-index: 1;
|
71
71
|
}
|
72
|
+
|
73
|
+
&.overlay-hide-scrollbar {
|
74
|
+
& [class*="overflow_x_auto"],
|
75
|
+
& [class*="overflow_y_auto"],
|
76
|
+
& [class*="overflow_auto"] {
|
77
|
+
&::-webkit-scrollbar {
|
78
|
+
display: none !important;
|
79
|
+
}
|
80
|
+
|
81
|
+
-ms-overflow-style: none !important;
|
82
|
+
scrollbar-width: none !important;
|
83
|
+
}
|
84
|
+
}
|
72
85
|
}
|