playbook_ui 14.14.0.pre.alpha.PBNTR866finalizecssendlessscroll6486 → 14.14.0.pre.alpha.PBNTR888selectvaliditymessage6348

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +3 -143
  3. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +99 -45
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +7 -123
  5. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +299 -153
  6. data/app/pb_kits/playbook/pb_drawer/_drawer.scss +8 -32
  7. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +1 -20
  8. data/app/pb_kits/playbook/pb_drawer/docs/example.yml +0 -5
  9. data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +12 -20
  10. data/app/pb_kits/playbook/pb_drawer/drawer.rb +1 -49
  11. data/app/pb_kits/playbook/pb_overlay/_overlay.scss +0 -13
  12. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +1 -7
  13. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +0 -3
  14. data/app/pb_kits/playbook/pb_overlay/docs/index.js +0 -1
  15. data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +3 -5
  16. data/app/pb_kits/playbook/pb_overlay/overlay.rb +1 -16
  17. data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +0 -12
  18. data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +3 -0
  19. data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +0 -2
  20. data/app/pb_kits/playbook/pb_tooltip/index.js +1 -1
  21. data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -10
  22. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -34
  23. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
  24. data/app/pb_kits/playbook/pb_typeahead/index.ts +8 -61
  25. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -13
  26. data/dist/chunks/_typeahead-PqkcDf1H.js +36 -0
  27. data/dist/chunks/_weekday_stacked-BrSrpj7J.js +45 -0
  28. data/dist/chunks/{lib-Dmay5Z6U.js → lib-D3us1bGD.js} +1 -1
  29. data/dist/chunks/{pb_form_validation-DdP7BnVX.js → pb_form_validation-BpihMSOQ.js} +1 -1
  30. data/dist/chunks/vendor.js +1 -1
  31. data/dist/menu.yml +2 -2
  32. data/dist/playbook-doc.js +1 -1
  33. data/dist/playbook-rails-react-bindings.js +1 -1
  34. data/dist/playbook-rails.js +1 -1
  35. data/dist/playbook.css +1 -1
  36. data/lib/playbook/version.rb +1 -1
  37. metadata +6 -40
  38. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +0 -127
  39. data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +0 -55
  40. data/app/pb_kits/playbook/pb_advanced_table/Components/TablePagination.tsx +0 -33
  41. data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +0 -275
  42. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +0 -66
  43. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +0 -195
  44. data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +0 -73
  45. data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +0 -52
  46. data/app/pb_kits/playbook/pb_advanced_table/Utilities/TableContainerStyles.ts +0 -80
  47. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +0 -50
  48. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_infinite_scroll.json +0 -152002
  49. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +0 -8
  50. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +0 -33
  51. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +0 -0
  52. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +0 -24
  53. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb +0 -21
  54. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md +0 -1
  55. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb +0 -49
  56. data/app/pb_kits/playbook/pb_drawer/index.js +0 -257
  57. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.html.erb +0 -11
  58. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.jsx +0 -37
  59. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_rails.md +0 -1
  60. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_react.md +0 -1
  61. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.html.erb +0 -11
  62. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.md +0 -1
  63. data/app/pb_kits/playbook/pb_overlay/index.js +0 -61
  64. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.html.erb +0 -39
  65. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.md +0 -3
  66. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.html.erb +0 -26
  67. data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
  68. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.html.erb +0 -45
  69. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.md +0 -5
  70. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.html.erb +0 -33
  71. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.md +0 -3
  72. data/dist/chunks/_typeahead-BBL6ThPp.js +0 -36
  73. data/dist/chunks/_weekday_stacked-CF_V6Rbs.js +0 -45
@@ -1,8 +0,0 @@
1
- <%= pb_rails("button", props: { text: "Push Drawer", margin_right: "sm", data: {"open-drawer": "drawer-3"} }) %>
2
-
3
- <%= pb_rails("drawer", props: {
4
- id:"drawer-3",
5
- behavior: "push"
6
- }) do %>
7
- Test me (Push Behavior)
8
- <% end %>
@@ -1,33 +0,0 @@
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
-
@@ -1,24 +0,0 @@
1
- <%= pb_rails("button", props: { padding: "xs", margin_right: "sm", data: {"open-drawer": "drawer-4"} }) do %>
2
- <%= pb_rails("icon", props: { icon: "bars", size: "2x" }) %>
3
- <% end %>
4
-
5
- <%= pb_rails("drawer", props: {
6
- id:"drawer-4",
7
- within_element: true,
8
- placement: "bottom",
9
- breakpoint: "md",
10
- size: "full"
11
- }) do %>
12
- <%= pb_rails("nav", props: { display: {xl: "none", lg: "none", md: "none", sm: "block" } }) do %>
13
- <%= pb_rails("nav/item", props: { text: "Photos", link: "#" }) %>
14
- <%= pb_rails("nav/item", props: { text: "Music", link: "#" }) %>
15
- <%= pb_rails("nav/item", props: { text: "Video", link: "#", active: true }) %>
16
- <%= pb_rails("nav/item", props: { text: "Files", link: "#" }) %>
17
- <% end %>
18
- <%= pb_rails("nav", props: { display: {md: "block", sm: "none", xs: "none" }, orientation: "horizontal" }) do %>
19
- <%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
20
- <%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
21
- <%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %>
22
- <%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
23
- <% end %>
24
- <% end %>
@@ -1,21 +0,0 @@
1
- <%= pb_rails("flex") do %>
2
- <%= pb_rails("button", props: { text: "No Overlay Drawer", margin_right: "sm", data: {"open-drawer": "drawer-10"} }) %>
3
-
4
- <%= pb_rails("drawer", props: {
5
- id:"drawer-10",
6
- overlay: false
7
- }) do %>
8
- Test me (No Overlay)
9
- <% end %>
10
-
11
-
12
- <%= pb_rails("button", props: { text: "Overlay Drawer", data: {"open-drawer": "drawer-11"} }) %>
13
-
14
- <%= pb_rails("drawer", props: {
15
- id:"drawer-11",
16
- placement: "right"
17
- }) do %>
18
- Test me (Has Overlay)
19
- <% end %>
20
- <% end %>
21
-
@@ -1 +0,0 @@
1
- Click the button to close the drawer when there is no overlay.
@@ -1,49 +0,0 @@
1
- <%= pb_rails("flex") do %>
2
- <%= pb_rails("button", props: { text: "XS Drawer", margin_right: "sm", data: {"open-drawer": "drawer-5"} }) %>
3
-
4
- <%= pb_rails("drawer", props: {
5
- id:"drawer-5",
6
- size: "xs"
7
- }) do %>
8
- XS
9
- <% end %>
10
-
11
- <%= pb_rails("button", props: { text: "SM Drawer", margin_right: "sm", data: {"open-drawer": "drawer-6"} }) %>
12
-
13
- <%= pb_rails("drawer", props: {
14
- id:"drawer-6",
15
- size: "sm",
16
- placement: "right"
17
- }) do %>
18
- This is a small drawer
19
- <% end %>
20
-
21
- <%= pb_rails("button", props: { text: "MD Drawer", margin_right: "sm", data: {"open-drawer": "drawer-7"} }) %>
22
-
23
- <%= pb_rails("drawer", props: {
24
- id:"drawer-7",
25
- size: "md"
26
- }) do %>
27
- This is a medium drawer
28
- <% end %>
29
-
30
- <%= pb_rails("button", props: { text: "LG Drawer", margin_right: "sm", data: {"open-drawer": "drawer-8"} }) %>
31
-
32
- <%= pb_rails("drawer", props: {
33
- id:"drawer-8",
34
- size: "lg",
35
- placement: "right"
36
- }) do %>
37
- This is a large drawer
38
- <% end %>
39
-
40
- <%= pb_rails("button", props: { text: "XL Drawer", margin_right: "sm", data: {"open-drawer": "drawer-9"} }) %>
41
-
42
- <%= pb_rails("drawer", props: {
43
- id:"drawer-9",
44
- size: "xl"
45
- }) do %>
46
- This is an extra large drawer
47
- <% end %>
48
- <% end %>
49
-
@@ -1,257 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
1
- <%= pb_rails("overlay", props: { layout: { "x": "xl" }, color: "card_light", scroll_bar_none: true }) do %>
2
- <%= pb_rails("flex", props: { column_gap: "lg", orientation: "row", overflow_x: "auto" }) do %>
3
- <% 15.times do %>
4
- <%= pb_rails("flex/flex_item") do %>
5
- <%= pb_rails("card") do %>
6
- Card content
7
- <% end %>
8
- <% end %>
9
- <% end %>
10
- <% end %>
11
- <% end %>
@@ -1,37 +0,0 @@
1
- import React from 'react'
2
- import {
3
- Overlay,
4
- Card,
5
- Flex,
6
- FlexItem,
7
- } from 'playbook-ui'
8
-
9
- const InlineCardsExample = () => {
10
- return (
11
- <Flex
12
- columnGap="lg"
13
- orientation="row"
14
- overflowX="auto"
15
- >
16
- {Array.from({ length: 15 }, (_, index) => (
17
- <FlexItem key={index}>
18
- <Card>{"Card Content"}</Card>
19
- </FlexItem>
20
- ))}
21
- </Flex>
22
- )
23
- }
24
-
25
- const OverlayHideScrollBar = () => (
26
- <>
27
- <Overlay
28
- color="card_light"
29
- layout={{"x": "xl"}}
30
- scrollBarNone
31
- >
32
- <InlineCardsExample />
33
- </Overlay>
34
- </>
35
- )
36
-
37
- export default OverlayHideScrollBar
@@ -1 +0,0 @@
1
- Pass the `scroll_bar_none` prop to hide the scrollbar from view. This is particularly helpful for small containers where the scrollbar may occupy too much space.
@@ -1 +0,0 @@
1
- Pass the `scrollBarNone` prop to hide the scrollbar from view. This is particularly helpful for small containers where the scrollbar may occupy too much space.
@@ -1,11 +0,0 @@
1
- <%= pb_rails("overlay", props: { layout: { "x": "xl" }, color: "card_light", dynamic: true }) do %>
2
- <%= pb_rails("flex", props: { column_gap: "lg", orientation: "row", overflow_x: "auto" }) do %>
3
- <% 15.times do %>
4
- <%= pb_rails("flex/flex_item") do %>
5
- <%= pb_rails("card") do %>
6
- Card content
7
- <% end %>
8
- <% end %>
9
- <% end %>
10
- <% end %>
11
- <% end %>
@@ -1 +0,0 @@
1
- Pass the `dynamic` prop to make the overlay render while the scrollbar isn't at either end on the scrollbar.
@@ -1,61 +0,0 @@
1
- import PbEnhancedElement from '../pb_enhanced_element'
2
-
3
- const OVERLAY_SELECTOR = '[data-pb-overlay]'
4
- const OVERLAY_SCROLL_ELEMENT = '[data-overlay-scroll-element]'
5
- const PREVIOUS_OVERLAY_CLASSNAME = '[data-previous-overlay-classname]'
6
- const SUBSEQUENT_OVERLAY_CLASSNAME = '[data-subsequent-overlay-classname]'
7
-
8
- export default class PbOverlay extends PbEnhancedElement {
9
- static get selector() {
10
- return OVERLAY_SELECTOR
11
- }
12
-
13
- get target() {
14
- return this.element.querySelector(OVERLAY_SCROLL_ELEMENT).children[0]
15
- }
16
-
17
- connect() {
18
- this.handleOverlayDynamic()
19
- }
20
-
21
- handleOverlayDynamic() {
22
- const isOverlayDynamic = this.element.dataset?.overlayDynamic
23
-
24
- if (isOverlayDynamic) {
25
- const previousOverlayElement = this.element.querySelector(PREVIOUS_OVERLAY_CLASSNAME)
26
- const previousOverlayClassname = previousOverlayElement?.dataset?.previousOverlayClassname
27
- const subsequentOverlayElement = this.element.querySelector(SUBSEQUENT_OVERLAY_CLASSNAME)
28
- const subsequentOverlayClassname = subsequentOverlayElement?.dataset?.subsequentOverlayClassname
29
-
30
- const handleScrollChange = (target) => {
31
- const { scrollLeft, scrollWidth, clientWidth } = target
32
- const isScrollAtStart = scrollLeft === 0
33
- const isScrollAtEnd = scrollLeft + clientWidth >= scrollWidth - 1
34
-
35
- if (isScrollAtStart) {
36
- previousOverlayElement.classList.remove(previousOverlayClassname)
37
- } else {
38
- previousOverlayElement.classList.add(previousOverlayClassname)
39
- }
40
-
41
- if (isScrollAtEnd) {
42
- subsequentOverlayElement.classList.remove(subsequentOverlayClassname)
43
- } else {
44
- subsequentOverlayElement.classList.add(subsequentOverlayClassname)
45
- }
46
- }
47
-
48
- this.target.addEventListener('scroll', (event) => {
49
- handleScrollChange(event.target)
50
- })
51
-
52
- handleScrollChange(this.target)
53
- }
54
- }
55
-
56
- disconnect() {
57
- if (this.element.dataset?.overlayDynamic) {
58
- this.target.removeEventListener('scroll')
59
- }
60
- }
61
- }
@@ -1,39 +0,0 @@
1
- <%= pb_rails("flex", props: { orientation: "row", gap: "md" }) do %>
2
- <%= pb_rails("flex/flex_item", props: {margin_top: "md"}) do %>
3
- <%= pb_rails("button", props: {classname: "tooltip-delay", text: "1s delay"}) %>
4
- <% end %>
5
-
6
- <%= pb_rails("flex/flex_item", props: {margin_top: "md"}) do %>
7
- <%= pb_rails("button", props: {classname: "tooltip-open-delay", text: "Open only"}) %>
8
- <% end %>
9
-
10
- <%= pb_rails("flex/flex_item", props: {margin_top: "md"}) do %>
11
- <%= pb_rails("button", props: {classname: "tooltip-close-delay", text: "Close only"}) %>
12
- <% end %>
13
-
14
- <%= pb_rails("tooltip", props: {
15
- trigger_element_selector: ".tooltip-delay",
16
- tooltip_id: "delay-tooltip",
17
- position: 'top',
18
- delay_open: 1000,
19
- delay_close: 1000
20
- }) do %>
21
- 1s open/close delay
22
- <% end %>
23
- <%= pb_rails("tooltip", props: {
24
- trigger_element_selector: ".tooltip-open-delay",
25
- tooltip_id: "open-tooltip",
26
- position: 'top',
27
- delay_open: 1000
28
- }) do %>
29
- 1s open delay
30
- <% end %>
31
- <%= pb_rails("tooltip", props: {
32
- trigger_element_selector: ".tooltip-close-delay",
33
- tooltip_id: "close-tooltip",
34
- position: 'top',
35
- delay_close: 1000
36
- }) do %>
37
- 1s close delay
38
- <% end %>
39
- <% end %>
@@ -1,3 +0,0 @@
1
- Waits for the specified time when the event listener runs before triggering the tooltip.
2
-
3
- The `delay_open` and `delay_close` accept numbers in milliseconds. 1 second is 1000 milliseconds.
@@ -1,26 +0,0 @@
1
- <%= pb_rails("flex", props: { gap: "md", wrap: true }) do %>
2
- <%= pb_rails("flex/flex_item") do %>
3
- <%= pb_rails("button", props: { text: "With Interaction", id: "tooltip-interaction"}) %>
4
-
5
- <%= pb_rails("tooltip", props: {
6
- trigger_element_selector: "#tooltip-interaction",
7
- tooltip_id: "tooltip-with-interaction",
8
- position: 'top',
9
- interaction: true
10
- }) do %>
11
- You can copy me
12
- <% end %>
13
- <% end %>
14
-
15
- <%= pb_rails("flex/flex_item") do %>
16
- <%= pb_rails("button", props: { text: "No Interaction", id: "tooltip-no-interaction"}) %>
17
-
18
- <%= pb_rails("tooltip", props: {
19
- trigger_element_selector: "#tooltip-no-interaction",
20
- tooltip_id: "tooltip-without-interaction",
21
- position: 'top',
22
- }) do %>
23
- I'm just a regular tooltip
24
- <% end %>
25
- <% end %>
26
- <% end %>