playbook_ui_docs 14.15.0.pre.rc.3 → 14.15.0.pre.rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_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/example.yml +2 -0
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.html.erb +45 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.md +5 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.html.erb +33 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.md +3 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/dist/playbook-doc.js +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77648dd1225c8141955ca7c0b992f35bc779088583a8ab014815ac545bff64cb
|
4
|
+
data.tar.gz: 254bc3bd1ced9a86a96824f06b7a1fd5ae900c88eb02a4e3aa074923533fe60d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 700d666345c9527ab81d2ed8cd6ff0cfa8a558687e8b71c6dccf4f66387351a2f32aa998b55b8d2efd95c36ea821c9a16041395dc2309e13984eb4ea5c837ac2
|
7
|
+
data.tar.gz: 87d5dbb6372a57f3efdc03784d96194d90d47fed001850bba0d34fe1e8864ae3c18fb3b7721b9299260873600fb6ac4ecc2ea0a6087a1e9c1e05bcb4fd5de4b9
|
@@ -0,0 +1,11 @@
|
|
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 %>
|
@@ -0,0 +1,37 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
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.
|
@@ -0,0 +1 @@
|
|
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.
|
@@ -4,9 +4,11 @@ examples:
|
|
4
4
|
- overlay_multi_directional: Multi-directional
|
5
5
|
- overlay_vertical_dynamic_multi_directional: Vertical Dynamic Multi-directional
|
6
6
|
- overlay_toggle: Toggle
|
7
|
+
- overlay_hide_scroll_bar: Hide Scroll Bar
|
7
8
|
|
8
9
|
rails:
|
9
10
|
- overlay_default: Default
|
10
11
|
- overlay_multi_directional: Multi-directional
|
11
12
|
- overlay_vertical_dynamic_multi_directional: Vertical Dynamic Multi-directional
|
12
13
|
- overlay_toggle: Toggle
|
14
|
+
- overlay_hide_scroll_bar: Hide Scroll Bar
|
@@ -2,3 +2,4 @@ export { default as OverlayDefault } from './_overlay_default.jsx'
|
|
2
2
|
export { default as OverlayMultiDirectional } from './_overlay_multi_directional.jsx'
|
3
3
|
export { default as OverlayToggle } from './_overlay_toggle.jsx'
|
4
4
|
export { default as OverlayVerticalDynamicMultiDirectional } from './_overlay_vertical_dynamic_multi_directional.jsx'
|
5
|
+
export { default as OverlayHideScrollBar } from './_overlay_hide_scroll_bar.jsx'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<%= pb_rails("select", props: {
|
2
|
+
id:"color_context_2",
|
3
|
+
label: "Choose a Color",
|
4
|
+
name: "color_name",
|
5
|
+
options: [
|
6
|
+
{ value: "red", value_text: "Red" },
|
7
|
+
{ value: "blue", value_text: "Blue" },
|
8
|
+
{ value: "green", value_text: "Green" }
|
9
|
+
],
|
10
|
+
}) %>
|
11
|
+
|
12
|
+
<%= pb_rails("typeahead", props: {
|
13
|
+
label: "Pick a Shade",
|
14
|
+
is_multi: false,
|
15
|
+
search_context_selector: "color_context_2",
|
16
|
+
options_by_context: {
|
17
|
+
"red": [
|
18
|
+
{ label: "Scarlet", value: "scarlet" },
|
19
|
+
{ label: "Mahogany", value: "mahogany" },
|
20
|
+
{ label: "Crimson", value: "crimson" }
|
21
|
+
],
|
22
|
+
"blue": [
|
23
|
+
{ label: "Sky Blue", value: "sky" },
|
24
|
+
{ label: "Cerulean", value: "cerulean" },
|
25
|
+
{ label: "Navy", value: "navy" }
|
26
|
+
],
|
27
|
+
"green": [
|
28
|
+
{ label: "Emerald", value: "emerald" },
|
29
|
+
{ label: "Mint", value: "mint" },
|
30
|
+
{ label: "Olive", value: "olive" }
|
31
|
+
]
|
32
|
+
},
|
33
|
+
id: "typeahead-dynamic-options",
|
34
|
+
}) %>
|
35
|
+
|
36
|
+
|
37
|
+
<%= javascript_tag defer: "defer" do %>
|
38
|
+
document.addEventListener("pb-typeahead-kit-typeahead-dynamic-options-result-option-select", function(event) {
|
39
|
+
console.log('Single Option selected')
|
40
|
+
console.dir(event.detail)
|
41
|
+
})
|
42
|
+
document.addEventListener("pb-typeahead-kit-typeahead-dynamic-options-result-clear", function() {
|
43
|
+
console.log('All options cleared')
|
44
|
+
})
|
45
|
+
<% end %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
You can also set up a typeahead to render options dynamically based on input from a select. To achieve this:
|
2
|
+
- The typeahead must have a unique `id`
|
3
|
+
- Use the `search_context_selector` prop on the typeahead. The value here must match the id of the select so the Typeahead knows where to read the current "context" from.
|
4
|
+
- Use `options_by_context` to pass in a hash whose keys match the possible values of your “context” select. Each key maps to an array of { label, value } objects. The typeahead automatically displays only the subset of options matching the current context.
|
5
|
+
- Additionally, the optional `clear_on_context_change` prop controls whether the typeahead clears or not when a change happens in the linked select. This prop is set to true by default so that whenever a selection is made in the select, the Typeahead automatically clears its current input/selection.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= pb_rails("select", props: {
|
2
|
+
id:"color_context",
|
3
|
+
label: "Choose a Color",
|
4
|
+
name: "color_name_2",
|
5
|
+
options: [
|
6
|
+
{ value: "red", value_text: "Red" },
|
7
|
+
{ value: "blue", value_text: "Blue" },
|
8
|
+
{ value: "green", value_text: "Green" }
|
9
|
+
],
|
10
|
+
}) %>
|
11
|
+
|
12
|
+
<%= pb_rails("typeahead", props: {
|
13
|
+
label: "Pick a Shade",
|
14
|
+
search_context_selector: "color_context",
|
15
|
+
options_by_context: {
|
16
|
+
"red": [
|
17
|
+
{ label: "Scarlet", value: "scarlet" },
|
18
|
+
{ label: "Mahogany", value: "mahogany" },
|
19
|
+
{ label: "Crimson", value: "crimson" }
|
20
|
+
],
|
21
|
+
"blue": [
|
22
|
+
{ label: "Sky Blue", value: "sky" },
|
23
|
+
{ label: "Cerulean", value: "cerulean" },
|
24
|
+
{ label: "Navy", value: "navy" }
|
25
|
+
],
|
26
|
+
"green": [
|
27
|
+
{ label: "Emerald", value: "emerald" },
|
28
|
+
{ label: "Mint", value: "mint" },
|
29
|
+
{ label: "Olive", value: "olive" }
|
30
|
+
]
|
31
|
+
},
|
32
|
+
search_term_minimum_length: 0,
|
33
|
+
}) %>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
The dynamic rendering of options for the typeahead can also be achieved with a pure Rails implementation (not react rendered). For this implementation, use all the props as above with the following additions:
|
2
|
+
|
3
|
+
- `search_term_minimum_length`: this sets the minimum input in the typeahead needed to display the dropdown. This is set to 3 by default. Set it to 0 for the dropdown to always display when the typeahead is interacted with.
|
@@ -12,6 +12,8 @@ examples:
|
|
12
12
|
- typeahead_margin_bottom: Margin Bottom
|
13
13
|
- typeahead_with_pills_color: With Pills (Custom Color)
|
14
14
|
- typeahead_truncated_text: Truncated Text
|
15
|
+
- typeahead_dynamic_options: Dynamic Options
|
16
|
+
- typeahead_dynamic_options_pure_rails: Dynamic Options (Pure Rails)
|
15
17
|
|
16
18
|
react:
|
17
19
|
- typeahead_default: Default
|