playbook_ui 14.15.0.pre.rc.3 → 14.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +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 +123 -7
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +153 -299
- 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_mock_data_infinite_scroll.json +152002 -0
- data/app/pb_kits/playbook/pb_card/_card.tsx +2 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +4 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +2 -0
- data/app/pb_kits/playbook/pb_date_picker/index.ts +38 -0
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +19 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +3 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +20 -37
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +6 -6
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +5 -4
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +9 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +4 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.html.erb +40 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +50 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.md +3 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +7 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +7 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +13 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +72 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.jsx +91 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +6 -0
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +13 -0
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +7 -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/example.yml +2 -0
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_overlay/overlay.rb +7 -1
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +12 -0
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +85 -74
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +60 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.md +1 -0
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_radio/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_radio/radio.test.js +16 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +58 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.md +1 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_select/select.html.erb +3 -5
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -5
- data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb +1 -4
- data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb +1 -5
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +2 -2
- data/app/pb_kits/playbook/pb_title/_title.scss +32 -0
- data/app/pb_kits/playbook/pb_title/_title.tsx +10 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_default.html.erb +1 -2
- data/app/pb_kits/playbook/pb_title/docs/_title_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.html.erb +7 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.jsx +54 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.md +1 -0
- data/app/pb_kits/playbook/pb_title/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_title/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_title/title.rb +10 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +25 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +69 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.md +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +36 -2
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +5 -1
- 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/app/pb_kits/playbook/pb_typeahead/index.ts +61 -8
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +17 -2
- data/app/pb_kits/playbook/utilities/object.test.js +99 -0
- data/app/pb_kits/playbook/utilities/object.ts +29 -1
- data/dist/chunks/_typeahead-BhfaW1J9.js +36 -0
- data/dist/chunks/_weekday_stacked-CKRIELiF.js +45 -0
- data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
- data/dist/chunks/{lib-Fr78pbpF.js → lib-5OzNgeeu.js} +2 -2
- data/dist/chunks/{pb_form_validation-CN51bfsD.js → pb_form_validation-DGhKbZtO.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- 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/version.rb +1 -1
- metadata +42 -7
- data/dist/chunks/_typeahead-BGTMEmj7.js +0 -36
- data/dist/chunks/_weekday_stacked-De2TduOp.js +0 -45
- data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
@@ -0,0 +1,72 @@
|
|
1
|
+
<% treeData = [{
|
2
|
+
label: "Power Home Remodeling",
|
3
|
+
value: "Power Home Remodeling",
|
4
|
+
id: "100",
|
5
|
+
expanded: true,
|
6
|
+
children: [
|
7
|
+
{
|
8
|
+
label: "People",
|
9
|
+
value: "People",
|
10
|
+
id: "101",
|
11
|
+
expanded: true,
|
12
|
+
children: [
|
13
|
+
{
|
14
|
+
label: "Talent Acquisition",
|
15
|
+
value: "Talent Acquisition",
|
16
|
+
id: "102",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
label: "Business Affairs",
|
20
|
+
value: "Business Affairs",
|
21
|
+
id: "103",
|
22
|
+
children: [
|
23
|
+
{
|
24
|
+
label: "Initiatives",
|
25
|
+
value: "Initiatives",
|
26
|
+
id: "104",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
label: "Learning & Development",
|
30
|
+
value: "Learning & Development",
|
31
|
+
id: "105",
|
32
|
+
},
|
33
|
+
],
|
34
|
+
},
|
35
|
+
{
|
36
|
+
label: "People Experience",
|
37
|
+
value: "People Experience",
|
38
|
+
id: "106",
|
39
|
+
},
|
40
|
+
],
|
41
|
+
},
|
42
|
+
{
|
43
|
+
label: "Contact Center",
|
44
|
+
value: "Contact Center",
|
45
|
+
id: "107",
|
46
|
+
children: [
|
47
|
+
{
|
48
|
+
label: "Appointment Management",
|
49
|
+
value: "Appointment Management",
|
50
|
+
id: "108",
|
51
|
+
},
|
52
|
+
{
|
53
|
+
label: "Customer Service",
|
54
|
+
value: "Customer Service",
|
55
|
+
id: "109",
|
56
|
+
},
|
57
|
+
{
|
58
|
+
label: "Energy",
|
59
|
+
value: "Energy",
|
60
|
+
id: "110",
|
61
|
+
},
|
62
|
+
],
|
63
|
+
},
|
64
|
+
],
|
65
|
+
}] %>
|
66
|
+
|
67
|
+
<%= pb_rails("multi_level_select", props: {
|
68
|
+
disabled: true,
|
69
|
+
id: "multi-level-select-default-rails",
|
70
|
+
name: "my_array",
|
71
|
+
tree_data: treeData
|
72
|
+
}) %>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import MultiLevelSelect from "../_multi_level_select";
|
3
|
+
|
4
|
+
const treeData = [
|
5
|
+
{
|
6
|
+
label: "Power Home Remodeling",
|
7
|
+
value: "Power Home Remodeling",
|
8
|
+
id: "powerhome1",
|
9
|
+
expanded: true,
|
10
|
+
children: [
|
11
|
+
{
|
12
|
+
label: "People",
|
13
|
+
value: "People",
|
14
|
+
id: "people1",
|
15
|
+
expanded: true,
|
16
|
+
children: [
|
17
|
+
{
|
18
|
+
label: "Talent Acquisition",
|
19
|
+
value: "Talent Acquisition",
|
20
|
+
id: "talent1",
|
21
|
+
},
|
22
|
+
{
|
23
|
+
label: "Business Affairs",
|
24
|
+
value: "Business Affairs",
|
25
|
+
id: "business1",
|
26
|
+
children: [
|
27
|
+
{
|
28
|
+
label: "Initiatives",
|
29
|
+
value: "Initiatives",
|
30
|
+
id: "initiative1",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
label: "Learning & Development",
|
34
|
+
value: "Learning & Development",
|
35
|
+
id: "development1",
|
36
|
+
},
|
37
|
+
],
|
38
|
+
},
|
39
|
+
{
|
40
|
+
label: "People Experience",
|
41
|
+
value: "People Experience",
|
42
|
+
id: "experience1",
|
43
|
+
},
|
44
|
+
],
|
45
|
+
},
|
46
|
+
{
|
47
|
+
label: "Contact Center",
|
48
|
+
value: "Contact Center",
|
49
|
+
id: "contact1",
|
50
|
+
children: [
|
51
|
+
{
|
52
|
+
label: "Appointment Management",
|
53
|
+
value: "Appointment Management",
|
54
|
+
id: "appointment1",
|
55
|
+
},
|
56
|
+
{
|
57
|
+
label: "Customer Service",
|
58
|
+
value: "Customer Service",
|
59
|
+
id: "customer1",
|
60
|
+
},
|
61
|
+
{
|
62
|
+
label: "Energy",
|
63
|
+
value: "Energy",
|
64
|
+
id: "energy1",
|
65
|
+
},
|
66
|
+
],
|
67
|
+
},
|
68
|
+
],
|
69
|
+
},
|
70
|
+
];
|
71
|
+
|
72
|
+
const MultiLevelSelectDisabled = (props) => {
|
73
|
+
return (
|
74
|
+
<>
|
75
|
+
<MultiLevelSelect
|
76
|
+
disabled
|
77
|
+
id='multiselect-default'
|
78
|
+
onSelect={(selectedNodes) =>
|
79
|
+
console.log(
|
80
|
+
"Selected Items",
|
81
|
+
selectedNodes
|
82
|
+
)
|
83
|
+
}
|
84
|
+
treeData={treeData}
|
85
|
+
{...props}
|
86
|
+
/>
|
87
|
+
</>
|
88
|
+
)
|
89
|
+
};
|
90
|
+
|
91
|
+
export default MultiLevelSelectDisabled
|
@@ -8,6 +8,7 @@ examples:
|
|
8
8
|
- multi_level_select_with_form: With Form
|
9
9
|
- multi_level_select_color: With Pills (Custom Color)
|
10
10
|
- multi_level_select_reset: Reset Selection
|
11
|
+
- multi_level_select_disabled: Disabled
|
11
12
|
|
12
13
|
react:
|
13
14
|
- multi_level_select_default: Default
|
@@ -18,4 +19,4 @@ examples:
|
|
18
19
|
- multi_level_select_color: With Pills (Custom Color)
|
19
20
|
- multi_level_select_with_children: Checkboxes With Children
|
20
21
|
- multi_level_select_with_children_with_radios: Single Select With Children
|
21
|
-
|
22
|
+
- multi_level_select_disabled: Disabled
|
@@ -6,3 +6,4 @@ export { default as MultiLevelSelectSelectedIdsReact } from "./_multi_level_sele
|
|
6
6
|
export { default as MultiLevelSelectColor } from './_multi_level_select_color.jsx'
|
7
7
|
export { default as MultiLevelSelectWithChildren } from './_multi_level_select_with_children.jsx'
|
8
8
|
export { default as MultiLevelSelectWithChildrenWithRadios } from './_multi_level_select_with_children_with_radios.jsx'
|
9
|
+
export { default as MultiLevelSelectDisabled } from './_multi_level_select_disabled.jsx'
|
@@ -22,6 +22,10 @@ module Playbook
|
|
22
22
|
prop :pill_color, type: Playbook::Props::Enum,
|
23
23
|
values: %w[primary neutral success warning error info data_1 data_2 data_3 data_4 data_5 data_6 data_7 data_8 windows siding roofing doors gutters solar insulation accessories],
|
24
24
|
default: "primary"
|
25
|
+
prop :wrapped, type: Playbook::Props::Boolean,
|
26
|
+
default: false
|
27
|
+
prop :disabled, type: Playbook::Props::Boolean,
|
28
|
+
default: false
|
25
29
|
|
26
30
|
def classname
|
27
31
|
generate_classname("pb_multi_level_select")
|
@@ -29,6 +33,7 @@ module Playbook
|
|
29
33
|
|
30
34
|
def multi_level_select_options
|
31
35
|
{
|
36
|
+
disabled: disabled,
|
32
37
|
id: id,
|
33
38
|
inputDisplay: input_display,
|
34
39
|
name: name,
|
@@ -38,6 +43,7 @@ module Playbook
|
|
38
43
|
input_name: input_name,
|
39
44
|
variant: variant,
|
40
45
|
pillColor: pill_color,
|
46
|
+
wrapped: wrapped,
|
41
47
|
}
|
42
48
|
end
|
43
49
|
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
|
}
|
@@ -11,6 +11,7 @@ export type OverlayChildrenProps = {
|
|
11
11
|
dynamic?: boolean,
|
12
12
|
position: string,
|
13
13
|
size: string,
|
14
|
+
scrollBarNone?: boolean,
|
14
15
|
}
|
15
16
|
|
16
17
|
type OverlayProps = {
|
@@ -23,6 +24,8 @@ type OverlayProps = {
|
|
23
24
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
|
24
25
|
id?: string,
|
25
26
|
layout: { [key: string]: string },
|
27
|
+
scrollBarNone?: boolean,
|
28
|
+
|
26
29
|
}
|
27
30
|
|
28
31
|
const Overlay = (props: OverlayProps) => {
|
@@ -36,11 +39,12 @@ const Overlay = (props: OverlayProps) => {
|
|
36
39
|
htmlOptions = {},
|
37
40
|
id,
|
38
41
|
layout = { "bottom": "full" },
|
42
|
+
scrollBarNone = false,
|
39
43
|
} = props
|
40
44
|
|
41
45
|
const ariaProps = buildAriaProps(aria)
|
42
46
|
const dataProps = buildDataProps(data)
|
43
|
-
const classes = classnames(buildCss('pb_overlay'), globalProps(props), className)
|
47
|
+
const classes = classnames(buildCss('pb_overlay'), { 'overlay-hide-scrollbar': scrollBarNone }, globalProps(props), className )
|
44
48
|
const htmlProps = buildHtmlProps(htmlOptions)
|
45
49
|
const dynamicInlineProps = globalInlineProps(props)
|
46
50
|
|
@@ -68,12 +72,14 @@ const Overlay = (props: OverlayProps) => {
|
|
68
72
|
children,
|
69
73
|
color,
|
70
74
|
position: getPosition(),
|
75
|
+
scrollBarNone,
|
71
76
|
size: getSize()
|
72
77
|
}) : OverlayToken({
|
73
78
|
children,
|
74
79
|
color,
|
75
80
|
dynamic: dynamic,
|
76
81
|
position: getPosition(),
|
82
|
+
scrollBarNone,
|
77
83
|
size: getSize()
|
78
84
|
})
|
79
85
|
}
|
@@ -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'
|
@@ -10,9 +10,11 @@ module Playbook
|
|
10
10
|
default: { "bottom": "full" }
|
11
11
|
prop :dynamic, type: Playbook::Props::Boolean,
|
12
12
|
default: false
|
13
|
+
prop :scroll_bar_none, type: Playbook::Props::Boolean,
|
14
|
+
default: false
|
13
15
|
|
14
16
|
def classname
|
15
|
-
generate_classname("pb_overlay")
|
17
|
+
generate_classname("pb_overlay", hide_scroll_bar_class)
|
16
18
|
end
|
17
19
|
|
18
20
|
def position
|
@@ -114,6 +116,10 @@ module Playbook
|
|
114
116
|
data.merge!("data-overlay-dynamic" => true) if dynamic
|
115
117
|
data
|
116
118
|
end
|
119
|
+
|
120
|
+
def hide_scroll_bar_class
|
121
|
+
scroll_bar_none ? " overlay-hide-scrollbar" : ""
|
122
|
+
end
|
117
123
|
end
|
118
124
|
end
|
119
125
|
end
|
@@ -64,3 +64,15 @@ test('should render children', () => {
|
|
64
64
|
const kit = screen.getByTestId(testId)
|
65
65
|
expect(kit).toHaveTextContent(props.children)
|
66
66
|
})
|
67
|
+
|
68
|
+
test('should add overlay-hide-scrollbar class when scrollBarNone is true', () => {
|
69
|
+
const props = {
|
70
|
+
children,
|
71
|
+
data: { testid: testId },
|
72
|
+
scrollBarNone: true
|
73
|
+
}
|
74
|
+
|
75
|
+
render(<Overlay {...props} />)
|
76
|
+
const kit = screen.getByTestId(testId)
|
77
|
+
expect(kit).toHaveClass('overlay-hide-scrollbar')
|
78
|
+
})
|
@@ -19,7 +19,7 @@ import {
|
|
19
19
|
|
20
20
|
import classnames from "classnames";
|
21
21
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
22
|
-
import { uniqueId } from '
|
22
|
+
import { uniqueId } from '../utilities/object';
|
23
23
|
|
24
24
|
type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth' | 'maxHeight' | 'minHeight'>
|
25
25
|
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import React, { forwardRef, useRef } from 'react'
|
1
|
+
import React, { useRef, forwardRef } from 'react'
|
4
2
|
import Body from '../pb_body/_body'
|
5
3
|
import Flex from '../pb_flex/_flex'
|
6
4
|
import classnames from 'classnames'
|
@@ -10,7 +8,7 @@ import { globalProps, GlobalProps } from '../utilities/globalProps'
|
|
10
8
|
type RadioProps = {
|
11
9
|
aria?: { [key: string]: string },
|
12
10
|
alignment?: string,
|
13
|
-
checked?: boolean,
|
11
|
+
checked?: boolean, // removed default assignment here
|
14
12
|
children?: React.ReactChild[] | React.ReactChild,
|
15
13
|
customChildren?: boolean,
|
16
14
|
className?: string,
|
@@ -24,10 +22,10 @@ type RadioProps = {
|
|
24
22
|
name?: string,
|
25
23
|
value?: string,
|
26
24
|
text?: string,
|
27
|
-
onChange
|
25
|
+
onChange?: (event: React.FormEvent<HTMLInputElement> | null) => void,
|
28
26
|
} & GlobalProps
|
29
27
|
|
30
|
-
const Radio = ({
|
28
|
+
const Radio = forwardRef<HTMLInputElement, RadioProps>(({
|
31
29
|
aria = {},
|
32
30
|
alignment,
|
33
31
|
children,
|
@@ -43,110 +41,123 @@ const Radio = ({
|
|
43
41
|
name = 'radio_name',
|
44
42
|
text = 'Radio Text',
|
45
43
|
value = 'radio_text',
|
44
|
+
checked,
|
46
45
|
onChange = () => { void 0 },
|
47
46
|
...props
|
48
|
-
}
|
49
|
-
const
|
47
|
+
}, ref) => {
|
48
|
+
const internalRef = useRef<HTMLInputElement>(null)
|
49
|
+
const setRefs = (el: HTMLInputElement) => {
|
50
|
+
internalRef.current = el
|
51
|
+
if (typeof ref === 'function') {
|
52
|
+
ref(el)
|
53
|
+
} else if (ref) {
|
54
|
+
(ref as React.MutableRefObject<HTMLInputElement | null>).current = el
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
const ariaProps = buildAriaProps(aria)
|
59
|
+
const dataProps = buildDataProps(data)
|
60
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
50
61
|
|
51
|
-
const ariaProps = buildAriaProps(aria);
|
52
|
-
const dataProps = buildDataProps(data);
|
53
|
-
const htmlProps = buildHtmlProps(htmlOptions);
|
54
62
|
const classes = classnames(
|
55
63
|
buildCss('pb_radio_kit', alignment),
|
56
64
|
dark ? 'dark' : null,
|
57
65
|
error ? 'error' : null,
|
58
66
|
globalProps(props),
|
59
67
|
className
|
60
|
-
)
|
68
|
+
)
|
61
69
|
|
62
70
|
const classesCustom = classnames(
|
63
71
|
dark ? 'dark' : null,
|
64
72
|
error ? 'error' : null,
|
65
73
|
globalProps(props),
|
66
74
|
className
|
67
|
-
)
|
75
|
+
)
|
76
|
+
|
77
|
+
const checkedProps = checked !== undefined ? { checked } : {}
|
68
78
|
|
69
|
-
const displayRadio = (
|
70
|
-
if (children && customChildren
|
71
|
-
return
|
79
|
+
const displayRadio = (inputProps: any) => {
|
80
|
+
if (children && customChildren === false)
|
81
|
+
return children
|
72
82
|
else
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
return (
|
84
|
+
<input
|
85
|
+
{...checkedProps}
|
86
|
+
disabled={disabled}
|
87
|
+
id={id}
|
88
|
+
name={name}
|
89
|
+
onChange={onChange}
|
90
|
+
ref={setRefs}
|
91
|
+
type="radio"
|
92
|
+
value={value}
|
93
|
+
{...inputProps}
|
94
|
+
/>
|
95
|
+
)
|
96
|
+
}
|
86
97
|
|
87
98
|
const handleContainerClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | undefined) => {
|
88
99
|
if (event) {
|
89
|
-
const target = event.target as HTMLElement
|
100
|
+
const target = event.target as HTMLElement
|
90
101
|
if (
|
91
102
|
target.id === 'pb-radio-children-wrapper' ||
|
92
103
|
target.closest('#pb-radio-children-wrapper')
|
93
104
|
) {
|
94
|
-
|
105
|
+
internalRef.current?.click()
|
95
106
|
}
|
96
107
|
}
|
97
|
-
}
|
108
|
+
}
|
98
109
|
|
99
|
-
return (
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
>
|
116
|
-
<label className={buildCss('pb_radio_kit', alignment)}>
|
110
|
+
return customChildren ? (
|
111
|
+
<Flex
|
112
|
+
{...ariaProps}
|
113
|
+
{...dataProps}
|
114
|
+
{...htmlProps}
|
115
|
+
align="center"
|
116
|
+
className={classesCustom}
|
117
|
+
cursor="pointer"
|
118
|
+
htmlFor={id}
|
119
|
+
htmlOptions={{
|
120
|
+
onClick: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
|
121
|
+
handleContainerClick(event)
|
122
|
+
}) as unknown as () => void
|
123
|
+
}}
|
124
|
+
id="radio-container"
|
125
|
+
>
|
126
|
+
<label className={buildCss('pb_radio_kit', alignment)}>
|
117
127
|
<input
|
128
|
+
{...checkedProps}
|
118
129
|
disabled={disabled}
|
119
130
|
id={id}
|
120
131
|
name={name}
|
121
132
|
onChange={onChange}
|
122
|
-
ref={
|
133
|
+
ref={setRefs}
|
123
134
|
type="radio"
|
124
135
|
value={value}
|
125
136
|
{...props}
|
126
137
|
/>
|
127
|
-
<span className="pb_radio_button" />
|
128
|
-
</label>
|
129
|
-
<div id="pb-radio-children-wrapper"> {children} </div>
|
130
|
-
</Flex>
|
131
|
-
) : (
|
132
|
-
<label
|
133
|
-
{...ariaProps}
|
134
|
-
{...dataProps}
|
135
|
-
{...htmlProps}
|
136
|
-
className={classes}
|
137
|
-
htmlFor={id}
|
138
|
-
>
|
139
|
-
<>{displayRadio(props)}</>
|
140
138
|
<span className="pb_radio_button" />
|
141
|
-
<Body
|
142
|
-
dark={dark}
|
143
|
-
status={error ? 'negative' : null}
|
144
|
-
text={label}
|
145
|
-
variant={null}
|
146
|
-
/>
|
147
139
|
</label>
|
148
|
-
|
149
|
-
|
150
|
-
|
140
|
+
<div id="pb-radio-children-wrapper"> {children} </div>
|
141
|
+
</Flex>
|
142
|
+
) : (
|
143
|
+
<label
|
144
|
+
{...ariaProps}
|
145
|
+
{...dataProps}
|
146
|
+
{...htmlProps}
|
147
|
+
className={classes}
|
148
|
+
htmlFor={id}
|
149
|
+
>
|
150
|
+
{displayRadio(props)}
|
151
|
+
<span className="pb_radio_button" />
|
152
|
+
<Body
|
153
|
+
dark={dark}
|
154
|
+
status={error ? 'negative' : null}
|
155
|
+
text={label}
|
156
|
+
variant={null}
|
157
|
+
/>
|
158
|
+
</label>
|
159
|
+
)
|
160
|
+
})
|
151
161
|
|
152
|
-
|
162
|
+
Radio.displayName = "Radio"
|
163
|
+
export default Radio
|