playbook_ui_docs 14.15.0.pre.rc.4 → 14.16.0.pre.rc.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/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_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_form/docs/_form_form_with_validate.html.erb +1 -1
- 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_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_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_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_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_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/dist/playbook-doc.js +1 -1
- metadata +18 -2
@@ -41,7 +41,7 @@ const DrawerBorders = () => {
|
|
41
41
|
onClose={toggleBRightDrawer}
|
42
42
|
opened={openedBRightDrawer}
|
43
43
|
overlay={false}
|
44
|
-
placement="
|
44
|
+
placement="right"
|
45
45
|
size="lg"
|
46
46
|
>
|
47
47
|
This is a Drawer with border right
|
@@ -52,7 +52,7 @@ const DrawerBorders = () => {
|
|
52
52
|
onClose={toggleBLeftDrawer}
|
53
53
|
opened={openedBLeftDrawer}
|
54
54
|
overlay={false}
|
55
|
-
placement="
|
55
|
+
placement="right"
|
56
56
|
size="lg"
|
57
57
|
>
|
58
58
|
This is a Drawer with border left
|
@@ -63,7 +63,7 @@ const DrawerBorders = () => {
|
|
63
63
|
onClose={toggleBFullDrawer}
|
64
64
|
opened={openedBFullDrawer}
|
65
65
|
overlay={false}
|
66
|
-
placement="
|
66
|
+
placement="right"
|
67
67
|
size="lg"
|
68
68
|
>
|
69
69
|
This is a Drawer with border full
|
@@ -1,42 +1,25 @@
|
|
1
|
-
import React
|
2
|
-
import { Button,
|
3
|
-
|
4
|
-
const useDrawer = (visible = false) => {
|
5
|
-
const [opened, setOpened] = useState(visible);
|
6
|
-
const toggle = () => setOpened(!opened);
|
7
|
-
|
8
|
-
return [opened, toggle];
|
9
|
-
};
|
10
|
-
|
11
|
-
const DrawerBreakpoints = () => {
|
12
|
-
const [smallDrawerOpened, toggleSmallDrawer] = useDrawer();
|
1
|
+
import React from "react"
|
2
|
+
import { Button, Body } from "playbook-ui"
|
13
3
|
|
4
|
+
const DrawerMenu = () => {
|
14
5
|
return (
|
15
6
|
<>
|
16
|
-
<
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
opened={smallDrawerOpened}
|
31
|
-
overlay={false}
|
32
|
-
placement={"right"}
|
33
|
-
size={"lg"}
|
34
|
-
>
|
35
|
-
Open because small breakpoint
|
36
|
-
</Drawer>
|
37
|
-
</Flex>
|
7
|
+
<Body>
|
8
|
+
The breakpoint prop determines when the Drawer is always visible. Above
|
9
|
+
the specified breakpoint, the Drawer remains open on the page. Below it,
|
10
|
+
only the trigger element is shown, allowing you to toggle the drawer
|
11
|
+
open and closed. To see this in action, click the button below and
|
12
|
+
resize your window.
|
13
|
+
</Body>
|
14
|
+
<Button
|
15
|
+
link='https://8njdkc.csb.app/'
|
16
|
+
marginTop='md'
|
17
|
+
newWindow
|
18
|
+
>
|
19
|
+
Open Doc Example in New Tab
|
20
|
+
</Button>
|
38
21
|
</>
|
39
|
-
)
|
40
|
-
}
|
22
|
+
)
|
23
|
+
}
|
41
24
|
|
42
|
-
export default
|
25
|
+
export default DrawerMenu
|
@@ -8,8 +8,8 @@ const DrawerMenu = () => {
|
|
8
8
|
const mediaQuery = window.matchMedia("(max-width: 600px)")
|
9
9
|
setIsSmallScreen(mediaQuery.matches)
|
10
10
|
const handler = (e) => setIsSmallScreen(e.matches)
|
11
|
-
mediaQuery.addEventListener(
|
12
|
-
return () => mediaQuery.removeEventListener(
|
11
|
+
mediaQuery.addEventListener("change", handler)
|
12
|
+
return () => mediaQuery.removeEventListener("change", handler)
|
13
13
|
}, [])
|
14
14
|
|
15
15
|
return (
|
@@ -22,17 +22,17 @@ const DrawerMenu = () => {
|
|
22
22
|
/>
|
23
23
|
</Button>
|
24
24
|
<Drawer
|
25
|
-
breakpoint=
|
25
|
+
breakpoint='md'
|
26
26
|
placement='bottom'
|
27
27
|
size='full'
|
28
28
|
triggerId='menuButton'
|
29
29
|
withinElement
|
30
30
|
>
|
31
|
-
<Nav
|
31
|
+
<Nav
|
32
32
|
highlight={false}
|
33
33
|
link='#'
|
34
|
-
orientation={isSmallScreen ?
|
35
|
-
padding={isSmallScreen ?
|
34
|
+
orientation={isSmallScreen ? "vertical" : "horizontal"}
|
35
|
+
padding={isSmallScreen ? "none" : "sm"}
|
36
36
|
>
|
37
37
|
<NavItem link='#'
|
38
38
|
text='About'
|
@@ -35,7 +35,7 @@
|
|
35
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
|
-
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true } %>
|
38
|
+
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true, validation_message: "Please, select a date.", allow_input: true } %>
|
39
39
|
<%= form.star_rating_field :example_star_rating_validation, props: { variant: "interactive", label: true, required: true } %>
|
40
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 } %>
|
41
41
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%
|
2
|
+
names = [
|
3
|
+
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
4
|
+
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
5
|
+
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
6
|
+
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
7
|
+
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
8
|
+
]
|
9
|
+
%>
|
10
|
+
|
11
|
+
<%= pb_rails("typeahead", props: {
|
12
|
+
html_options: { style: { maxWidth: "240px" }},
|
13
|
+
id: "typeahead-form-pill",
|
14
|
+
is_multi: true,
|
15
|
+
options: names,
|
16
|
+
label: "Wrapped Within Typeahead",
|
17
|
+
pills: true,
|
18
|
+
wrapped: true,
|
19
|
+
}) %>
|
20
|
+
|
21
|
+
<%= pb_rails("caption", props: { text: "Form Pill Wrapped Text" }) %>
|
22
|
+
<%= pb_rails("card", props: { max_width: "xs" }) do %>
|
23
|
+
<%= pb_rails("form_pill", props: {
|
24
|
+
name: "Princess Amelia Mignonette Grimaldi Thermopolis Renaldo",
|
25
|
+
avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
|
26
|
+
tabindex: 0,
|
27
|
+
wrapped: true,
|
28
|
+
}) %>
|
29
|
+
<%= pb_rails("form_pill", props: {
|
30
|
+
icon: "badge-check",
|
31
|
+
text: "icon and a very long tag to show wrapped text",
|
32
|
+
tabindex: 0,
|
33
|
+
wrapped: true,
|
34
|
+
}) %>
|
35
|
+
<%= pb_rails("form_pill", props: {
|
36
|
+
text: "form pill long tag no tooltip show wrapped text",
|
37
|
+
tabindex: 0,
|
38
|
+
wrapped: true,
|
39
|
+
}) %>
|
40
|
+
<% end %>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Card, Caption, FormPill, Typeahead } from 'playbook-ui'
|
3
|
+
|
4
|
+
const names = [
|
5
|
+
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
6
|
+
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
7
|
+
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
8
|
+
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
9
|
+
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
10
|
+
]
|
11
|
+
|
12
|
+
const FormPillWrapped = (props) => {
|
13
|
+
return (
|
14
|
+
<>
|
15
|
+
<Typeahead
|
16
|
+
htmlOptions={{ style: { maxWidth: "240px" } }}
|
17
|
+
isMulti
|
18
|
+
label="Wrapped Within Typeahead"
|
19
|
+
options={names}
|
20
|
+
wrapped
|
21
|
+
{...props}
|
22
|
+
/>
|
23
|
+
<Caption text="Form Pill Wrapped Text"/>
|
24
|
+
<Card maxWidth="xs">
|
25
|
+
<FormPill
|
26
|
+
avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
|
27
|
+
name="Princess Amelia Mignonette Grimaldi Thermopolis Renaldo"
|
28
|
+
onClick={() => alert('Click!')}
|
29
|
+
tabIndex={0}
|
30
|
+
wrapped
|
31
|
+
/>
|
32
|
+
<FormPill
|
33
|
+
icon="badge-check"
|
34
|
+
onClick={() => {alert('Click!')}}
|
35
|
+
tabIndex={0}
|
36
|
+
text="icon and a very long tag to show wrapped text"
|
37
|
+
wrapped
|
38
|
+
/>
|
39
|
+
<FormPill
|
40
|
+
onClick={() => {alert('Click!')}}
|
41
|
+
tabIndex={0}
|
42
|
+
text="form pill with a very long tag to show wrapped text"
|
43
|
+
wrapped
|
44
|
+
/>
|
45
|
+
</Card>
|
46
|
+
</>
|
47
|
+
)
|
48
|
+
}
|
49
|
+
|
50
|
+
export default FormPillWrapped
|
@@ -4,6 +4,7 @@ examples:
|
|
4
4
|
- form_pill_user: Form Pill User
|
5
5
|
- form_pill_size: Form Pill Size
|
6
6
|
- form_pill_truncated_text: Truncated Text
|
7
|
+
- form_pill_wrapped: Wrapped Text
|
7
8
|
- form_pill_tag: Form Pill Tag
|
8
9
|
- form_pill_example: Example
|
9
10
|
- form_pill_icon: Form Pill Icon
|
@@ -13,6 +14,7 @@ examples:
|
|
13
14
|
- form_pill_user: Form Pill User
|
14
15
|
- form_pill_size: Form Pill Size
|
15
16
|
- form_pill_truncated_text: Truncated Text
|
17
|
+
- form_pill_wrapped: Wrapped Text
|
16
18
|
- form_pill_tag: Form Pill Tag
|
17
19
|
- form_pill_example: Example
|
18
20
|
- form_pill_icon: Form Pill Icon
|
@@ -5,3 +5,4 @@ export { default as FormPillExample } from './_form_pill_example.jsx'
|
|
5
5
|
export { default as FormPillIcon } from './_form_pill_icon.jsx'
|
6
6
|
export { default as FormPillColors } from './_form_pill_colors.jsx'
|
7
7
|
export { default as FormPillTruncatedText } from './_form_pill_truncated_text.jsx'
|
8
|
+
export { default as FormPillWrapped } from './_form_pill_wrapped.jsx'
|
@@ -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'
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import { useForm } from "react-hook-form"
|
3
|
+
import { Radio, Flex, Body } from "playbook-ui"
|
4
|
+
|
5
|
+
const RadioReactHook = () => {
|
6
|
+
const { register, watch } = useForm({
|
7
|
+
defaultValues: {
|
8
|
+
size: "Small",
|
9
|
+
},
|
10
|
+
})
|
11
|
+
|
12
|
+
const selectedSize = watch("size", "Small")
|
13
|
+
|
14
|
+
return (
|
15
|
+
<Flex orientation="row">
|
16
|
+
<Flex
|
17
|
+
align="start"
|
18
|
+
orientation="column"
|
19
|
+
paddingRight="lg"
|
20
|
+
>
|
21
|
+
<Radio
|
22
|
+
alignment="left"
|
23
|
+
label="Small"
|
24
|
+
marginBottom='sm'
|
25
|
+
name="size"
|
26
|
+
value="Small"
|
27
|
+
{...register("size")}
|
28
|
+
/>
|
29
|
+
<br />
|
30
|
+
<Radio
|
31
|
+
alignment="left"
|
32
|
+
label="Medium"
|
33
|
+
marginBottom='sm'
|
34
|
+
name="size"
|
35
|
+
value="Medium"
|
36
|
+
{...register("size")}
|
37
|
+
/>
|
38
|
+
<br />
|
39
|
+
<Radio
|
40
|
+
alignment="left"
|
41
|
+
label="Large"
|
42
|
+
marginBottom='sm'
|
43
|
+
name="size"
|
44
|
+
value="Large"
|
45
|
+
{...register("size")}
|
46
|
+
/>
|
47
|
+
</Flex>
|
48
|
+
<Flex
|
49
|
+
align="start"
|
50
|
+
orientation="column"
|
51
|
+
>
|
52
|
+
<Body
|
53
|
+
text={`Selected Size: ${selectedSize}`}
|
54
|
+
/>
|
55
|
+
</Flex>
|
56
|
+
</Flex>
|
57
|
+
)
|
58
|
+
}
|
59
|
+
|
60
|
+
export default RadioReactHook
|
@@ -0,0 +1 @@
|
|
1
|
+
You can pass react hook props to the radio kit.
|
@@ -16,6 +16,7 @@ examples:
|
|
16
16
|
- radio_alignment: Alignment
|
17
17
|
- radio_disabled: Disabled
|
18
18
|
- radio_custom_children: Custom Children
|
19
|
+
- radio_react_hook: React Hook Form
|
19
20
|
|
20
21
|
swift:
|
21
22
|
- radio_default_swift: Default
|
@@ -26,4 +27,4 @@ examples:
|
|
26
27
|
- radio_spacing_swift: Spacing
|
27
28
|
- radio_padding_swift: Padding
|
28
29
|
- radio_subtitle_swift: Subtitle
|
29
|
-
- radio_props_swift: ""
|
30
|
+
- radio_props_swift: ""
|
@@ -4,3 +4,4 @@ export { default as RadioError } from './_radio_error.jsx'
|
|
4
4
|
export { default as RadioAlignment } from './_radio_alignment.jsx'
|
5
5
|
export { default as RadioDisabled } from './_radio_disabled.jsx'
|
6
6
|
export { default as RadioCustomChildren } from './_radio_custom_children.jsx'
|
7
|
+
export { default as RadioReactHook } from './_radio_react_hook.jsx'
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import React, { useState } from "react"
|
2
|
+
import { useForm } from "react-hook-form"
|
3
|
+
import { Button, Body, Select } from "playbook-ui"
|
4
|
+
|
5
|
+
const SelectReactHook = (props) => {
|
6
|
+
const { register, handleSubmit, formState: { errors } } = useForm({
|
7
|
+
defaultValues: {
|
8
|
+
food: '',
|
9
|
+
},
|
10
|
+
})
|
11
|
+
|
12
|
+
const [submittedData, setSubmittedData] = useState({
|
13
|
+
food: '',
|
14
|
+
})
|
15
|
+
|
16
|
+
const onSubmit = (data) => {
|
17
|
+
setSubmittedData(data)
|
18
|
+
}
|
19
|
+
|
20
|
+
const options = [
|
21
|
+
{
|
22
|
+
value: 1,
|
23
|
+
text: 'Burgers',
|
24
|
+
},
|
25
|
+
{
|
26
|
+
value: 2,
|
27
|
+
text: 'Pizza',
|
28
|
+
},
|
29
|
+
{
|
30
|
+
value: 3,
|
31
|
+
text: 'Tacos',
|
32
|
+
},
|
33
|
+
]
|
34
|
+
|
35
|
+
return (
|
36
|
+
<>
|
37
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
38
|
+
<Select
|
39
|
+
{...props}
|
40
|
+
{...register("food", { required: true })}
|
41
|
+
error={errors.food ? "Please select a food." : null}
|
42
|
+
label="Favorite Food"
|
43
|
+
options={options}
|
44
|
+
/>
|
45
|
+
<br />
|
46
|
+
<Button htmlType="submit"
|
47
|
+
marginTop="sm"
|
48
|
+
text="Submit"
|
49
|
+
/>
|
50
|
+
</form>
|
51
|
+
<Body padding="xs"
|
52
|
+
text={`Food: ${submittedData.food}`}
|
53
|
+
/>
|
54
|
+
</>
|
55
|
+
)
|
56
|
+
}
|
57
|
+
|
58
|
+
export default SelectReactHook
|
@@ -0,0 +1 @@
|
|
1
|
+
You can pass react-hook-form props to a select kit. You can use `register` which will make the value available for both the form validation and submission.
|
@@ -10,3 +10,4 @@ export { default as SelectInline } from './_select_inline.jsx'
|
|
10
10
|
export { default as SelectInlineShowArrow } from './_select_inline_show_arrow.jsx'
|
11
11
|
export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
|
12
12
|
export { default as SelectMultiple } from './_select_multiple.jsx'
|
13
|
+
export { default as SelectReactHook } from './_select_react_hook.jsx'
|
@@ -1,10 +1,9 @@
|
|
1
1
|
<%= pb_rails("title", props: {
|
2
|
+
margin_bottom: "md"
|
2
3
|
}) do %>
|
3
4
|
Default Title
|
4
5
|
<% end %>
|
5
6
|
|
6
|
-
<br/>
|
7
|
-
|
8
7
|
<%= pb_rails("title", props: { text: "Title 1", tag: "h1", size: 1 }) %>
|
9
8
|
<%= pb_rails("title", props: { text: "Title 2", tag: "h2", size: 2 }) %>
|
10
9
|
<%= pb_rails("title", props: { text: "Title 3", tag: "h3", size: 3 }) %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%= pb_rails("title", props: { text: "Display Size xs", tag: "h1", display_size: "xs" }) %>
|
2
|
+
<%= pb_rails("title", props: { text: "Display Size sm", tag: "h1", display_size: "sm" }) %>
|
3
|
+
<%= pb_rails("title", props: { text: "Display Size md", tag: "h1", display_size: "md" }) %>
|
4
|
+
<%= pb_rails("title", props: { text: "Display Size lg", tag: "h1", display_size: "lg" }) %>
|
5
|
+
<%= pb_rails("title", props: { text: "Display Size xl", tag: "h1", display_size: "xl" }) %>
|
6
|
+
<%= pb_rails("title", props: { text: "Display Size xxl", tag: "h1", display_size: "xxl" }) %>
|
7
|
+
<%= pb_rails("title", props: { text: "This is a size of display", tag: "h1", size: "display"}) %>
|