playbook_ui 14.3.2 → 14.4.0.pre.alpha.PBNTR534filtermaxwidth3903
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +23 -4
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +17 -5
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +14 -6
- data/app/pb_kits/playbook/pb_contact/contact.rb +4 -0
- data/app/pb_kits/playbook/pb_contact/contact.test.js +1 -1
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +4 -3
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +4 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +6 -3
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_flatpickr_styles.scss +2 -3
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_header_styles.scss +6 -2
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +2 -0
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +1 -1
- data/app/pb_kits/playbook/pb_filter/filter.rb +1 -0
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +245 -23
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.html.erb +117 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.jsx +227 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.md +1 -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 +1 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
- data/app/pb_kits/playbook/pb_map/_map_controls.tsx +7 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +20 -5
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.html.erb +72 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.jsx +91 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_rails.md +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_react.md +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +2 -0
- 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 +4 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +97 -21
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js +166 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +45 -6
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_bubble.html.erb +73 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_bubble.jsx +86 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb +21 -1
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +12 -1
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +3 -1
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +10 -2
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +92 -33
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.html.erb +48 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +59 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.md +1 -0
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_radio/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_radio/index.js +17 -0
- data/app/pb_kits/playbook/pb_radio/radio.html.erb +35 -13
- data/app/pb_kits/playbook/pb_radio/radio.rb +3 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +12 -5
- data/app/pb_kits/playbook/pb_select/_select.tsx +5 -2
- data/app/pb_kits/playbook/pb_select/select.html.erb +1 -1
- data/app/pb_kits/playbook/pb_select/select.rb +4 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +0 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +30 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +7 -0
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +6 -5
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +26 -18
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_margin_bottom.html.erb +88 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_margin_bottom.jsx +60 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.html.erb +31 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.jsx +26 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_rails.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_react.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +10 -1
- data/app/pb_kits/playbook/tokens/_colors.scss +2 -0
- data/app/pb_kits/playbook/utilities/icons/allicons.tsx +123 -0
- data/app/pb_kits/playbook/utilities/icons/angle-down.svg +3 -0
- data/app/pb_kits/playbook/utilities/icons/envelope.svg +3 -0
- data/dist/chunks/_typeahead-C7ICra83.js +22 -0
- data/dist/chunks/_weekday_stacked-DwrIhNbf.js +45 -0
- data/dist/chunks/lib-CEpcaI8y.js +29 -0
- data/dist/chunks/{pb_form_validation-u2wnZ3oe.js → pb_form_validation-D9zkwt2b.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 +2 -2
- metadata +30 -9
- data/dist/chunks/_typeahead-DbAz2Okr.js +0 -22
- data/dist/chunks/_weekday_stacked-CZ5S17_d.js +0 -45
- data/dist/chunks/lib-D9uVVKnh.js +0 -16
@@ -22,6 +22,16 @@ const PaginationPageChange = (props) => {
|
|
22
22
|
|
23
23
|
return (
|
24
24
|
<div className="App">
|
25
|
+
<Pagination
|
26
|
+
current={activePage}
|
27
|
+
key={`pagination-top-${activePage}`}
|
28
|
+
marginBottom="xs"
|
29
|
+
onChange={onPageChange}
|
30
|
+
range={5}
|
31
|
+
total={totalPages}
|
32
|
+
{...props}
|
33
|
+
/>
|
34
|
+
|
25
35
|
<Table
|
26
36
|
marginBottom="xs"
|
27
37
|
responsive="none"
|
@@ -49,7 +59,8 @@ const PaginationPageChange = (props) => {
|
|
49
59
|
</Table>
|
50
60
|
|
51
61
|
<Pagination
|
52
|
-
current={
|
62
|
+
current={activePage}
|
63
|
+
key={`pagination-bottom-${activePage}`}
|
53
64
|
onChange={onPageChange}
|
54
65
|
range={5}
|
55
66
|
total={totalPages}
|
@@ -1 +1,3 @@
|
|
1
|
-
You can use the `onChange` prop to control the data of your table. This prop is callback function that will allow you control the state.
|
1
|
+
You can use the `onChange` prop to control the data of your table. This prop is callback function that will allow you control the state.
|
2
|
+
|
3
|
+
To ensure synchronization between multiple pagination components on a single page, use unique, dynamic keys for each pagination instance. Each Pagination component should have its own dynamic key that reflects the current active page: this example uses `pagination-top-${activePage}` and `pagination-bottom-${activePage}`.
|
@@ -12,6 +12,7 @@ import Icon from '../pb_icon/_icon'
|
|
12
12
|
import PbReactPopover from '../pb_popover/_popover'
|
13
13
|
import TextInput from '../pb_text_input/_text_input'
|
14
14
|
import { GenericObject } from "../types"
|
15
|
+
import { getAllIcons } from "../utilities/icons/allicons"
|
15
16
|
|
16
17
|
type PassphraseProps = {
|
17
18
|
aria?: { [key: string]: string },
|
@@ -96,6 +97,9 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
|
|
96
97
|
/>
|
97
98
|
)
|
98
99
|
|
100
|
+
const shieldIcon = getAllIcons()["shieldCheck"]
|
101
|
+
const eyeIcon = getAllIcons()["eye"]
|
102
|
+
|
99
103
|
return (
|
100
104
|
<div
|
101
105
|
{...ariaProps}
|
@@ -135,7 +139,8 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
|
|
135
139
|
size="xs"
|
136
140
|
>
|
137
141
|
<Icon
|
138
|
-
|
142
|
+
className="svg-inline--fa"
|
143
|
+
customIcon={shieldIcon.icon as unknown as { [key: string]: SVGElement }}
|
139
144
|
marginRight="xs"
|
140
145
|
/>
|
141
146
|
{tip}
|
@@ -173,7 +178,10 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
|
|
173
178
|
color="light"
|
174
179
|
dark={dark}
|
175
180
|
>
|
176
|
-
|
181
|
+
<Icon
|
182
|
+
className="svg-inline--fa"
|
183
|
+
customIcon={eyeIcon.icon as unknown as { [key: string]: SVGElement }}
|
184
|
+
/>
|
177
185
|
</Body>
|
178
186
|
</span>
|
179
187
|
</div>
|
@@ -1,28 +1,30 @@
|
|
1
|
-
/*eslint-disable react/no-multi-comp
|
1
|
+
/*eslint-disable react/no-multi-comp */
|
2
2
|
|
3
|
-
import React, { forwardRef } from 'react'
|
3
|
+
import React, { forwardRef, useRef } from 'react'
|
4
4
|
import Body from '../pb_body/_body'
|
5
|
+
import Flex from '../pb_flex/_flex'
|
5
6
|
import classnames from 'classnames'
|
6
7
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
7
8
|
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
8
9
|
|
9
10
|
type RadioProps = {
|
10
|
-
aria?: {[key: string]: string},
|
11
|
+
aria?: { [key: string]: string },
|
11
12
|
alignment?: string,
|
12
13
|
checked?: boolean,
|
13
14
|
children?: React.ReactChild[] | React.ReactChild,
|
15
|
+
customChildren?: boolean,
|
14
16
|
className?: string,
|
15
17
|
dark?: boolean,
|
16
|
-
data?: {[key: string]: string},
|
18
|
+
data?: { [key: string]: string },
|
17
19
|
disabled?: boolean,
|
18
20
|
error?: boolean,
|
19
|
-
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
21
|
+
htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
|
20
22
|
id?: string,
|
21
23
|
label: string,
|
22
24
|
name?: string,
|
23
25
|
value?: string,
|
24
26
|
text?: string,
|
25
|
-
onChange: (event: React.FormEvent<HTMLInputElement> | null)=>void,
|
27
|
+
onChange: (event: React.FormEvent<HTMLInputElement> | null) => void,
|
26
28
|
} & GlobalProps
|
27
29
|
|
28
30
|
const Radio = ({
|
@@ -30,10 +32,11 @@ const Radio = ({
|
|
30
32
|
alignment,
|
31
33
|
children,
|
32
34
|
className,
|
35
|
+
customChildren = false,
|
33
36
|
dark = false,
|
34
|
-
data = {},
|
35
37
|
disabled = false,
|
36
38
|
error = false,
|
39
|
+
data = {},
|
37
40
|
htmlOptions = {},
|
38
41
|
id,
|
39
42
|
label,
|
@@ -43,17 +46,28 @@ const Radio = ({
|
|
43
46
|
onChange = () => { void 0 },
|
44
47
|
...props
|
45
48
|
}: RadioProps, ref: any) => {
|
46
|
-
const
|
47
|
-
|
48
|
-
const
|
49
|
+
const radioRef = useRef(null);
|
50
|
+
|
51
|
+
const ariaProps = buildAriaProps(aria);
|
52
|
+
const dataProps = buildDataProps(data);
|
53
|
+
const htmlProps = buildHtmlProps(htmlOptions);
|
49
54
|
const classes = classnames(
|
50
|
-
buildCss('pb_radio_kit', alignment
|
51
|
-
dark ? 'dark'
|
55
|
+
buildCss('pb_radio_kit', alignment),
|
56
|
+
dark ? 'dark' : null,
|
57
|
+
error ? 'error' : null,
|
52
58
|
globalProps(props),
|
53
|
-
className
|
59
|
+
className
|
60
|
+
);
|
61
|
+
|
62
|
+
const classesCustom = classnames(
|
63
|
+
dark ? 'dark' : null,
|
64
|
+
error ? 'error' : null,
|
65
|
+
globalProps(props),
|
66
|
+
className
|
67
|
+
);
|
54
68
|
|
55
69
|
const displayRadio = (props: RadioProps & any) => {
|
56
|
-
if (children)
|
70
|
+
if (children && customChildren == false)
|
57
71
|
return (children)
|
58
72
|
else
|
59
73
|
return (
|
@@ -70,24 +84,69 @@ const Radio = ({
|
|
70
84
|
/>
|
71
85
|
)}
|
72
86
|
|
87
|
+
const handleContainerClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | undefined) => {
|
88
|
+
if (event) {
|
89
|
+
const target = event.target as HTMLElement;
|
90
|
+
if (
|
91
|
+
target.id === 'pb-radio-children-wrapper' ||
|
92
|
+
target.closest('#pb-radio-children-wrapper')
|
93
|
+
) {
|
94
|
+
radioRef.current?.click();
|
95
|
+
}
|
96
|
+
}
|
97
|
+
};
|
98
|
+
|
73
99
|
return (
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
100
|
+
customChildren ? (
|
101
|
+
<Flex
|
102
|
+
{...ariaProps}
|
103
|
+
{...dataProps}
|
104
|
+
{...htmlProps}
|
105
|
+
align='center'
|
106
|
+
className={classesCustom}
|
107
|
+
cursor='pointer'
|
108
|
+
htmlFor={id}
|
109
|
+
htmlOptions={{
|
110
|
+
onClick: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
|
111
|
+
handleContainerClick(event);
|
112
|
+
}) as unknown as () => void
|
113
|
+
}}
|
114
|
+
id="radio-container"
|
115
|
+
>
|
116
|
+
<label className={buildCss('pb_radio_kit', alignment)}>
|
117
|
+
<input
|
118
|
+
disabled={disabled}
|
119
|
+
id={id}
|
120
|
+
name={name}
|
121
|
+
onChange={onChange}
|
122
|
+
ref={radioRef}
|
123
|
+
type="radio"
|
124
|
+
value={value}
|
125
|
+
{...props}
|
126
|
+
/>
|
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
|
+
<span className="pb_radio_button" />
|
141
|
+
<Body
|
142
|
+
dark={dark}
|
143
|
+
status={error ? 'negative' : null}
|
144
|
+
text={label}
|
145
|
+
variant={null}
|
146
|
+
/>
|
147
|
+
</label>
|
148
|
+
)
|
149
|
+
);
|
150
|
+
};
|
92
151
|
|
93
|
-
export default forwardRef(Radio)
|
152
|
+
export default forwardRef(Radio);
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<%
|
2
|
+
options = [
|
3
|
+
{ label: "Orange", value: "Orange" },
|
4
|
+
{ label: "Red", value: "Red" },
|
5
|
+
{ label: "Green", value: "Green" },
|
6
|
+
{ label: "Blue", value: "Blue" },
|
7
|
+
]
|
8
|
+
%>
|
9
|
+
|
10
|
+
<%= pb_rails("radio", props: {
|
11
|
+
custom_children: true,
|
12
|
+
label: "Select",
|
13
|
+
name: "Group1",
|
14
|
+
value: "Select",
|
15
|
+
}) do %>
|
16
|
+
<%= pb_rails("select", props: {
|
17
|
+
min_width: "xs",
|
18
|
+
options: options,
|
19
|
+
}) %>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<%= pb_rails("radio", props: {
|
23
|
+
custom_children: true,
|
24
|
+
label: "Typeahead",
|
25
|
+
name: "Group1",
|
26
|
+
value: "Typeahead",
|
27
|
+
}) do %>
|
28
|
+
<%= pb_rails("typeahead", props: {
|
29
|
+
id: "typeahead-radio",
|
30
|
+
is_multi: false,
|
31
|
+
min_width: "xs",
|
32
|
+
options: options,
|
33
|
+
placeholder: "Select...",
|
34
|
+
})
|
35
|
+
%>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<%= pb_rails("radio", props: {
|
39
|
+
custom_children: true,
|
40
|
+
label: "Typography",
|
41
|
+
name: "Group1",
|
42
|
+
value: "Typography",
|
43
|
+
}) do %>
|
44
|
+
<%= pb_rails("title", props: {
|
45
|
+
text: "Custom Typography",
|
46
|
+
})
|
47
|
+
%>
|
48
|
+
<% end %>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import Radio from '../_radio'
|
3
|
+
import Select from '../../pb_select/_select'
|
4
|
+
import Typeahead from '../../pb_typeahead/_typeahead'
|
5
|
+
import Title from '../../pb_title/_title'
|
6
|
+
|
7
|
+
const RadioChildren = (props) => {
|
8
|
+
|
9
|
+
|
10
|
+
const options = [
|
11
|
+
{ label: 'Orange', value: 'Orange' },
|
12
|
+
{ label: 'Red', value: 'Red' },
|
13
|
+
{ label: 'Green', value: 'Green' },
|
14
|
+
{ label: 'Blue', value: 'Blue' },
|
15
|
+
]
|
16
|
+
|
17
|
+
return (
|
18
|
+
<div>
|
19
|
+
<Radio
|
20
|
+
customChildren
|
21
|
+
label="Select"
|
22
|
+
name="Group1"
|
23
|
+
tabIndex={0}
|
24
|
+
value="Select"
|
25
|
+
{...props}
|
26
|
+
>
|
27
|
+
<Select
|
28
|
+
minWidth="xs"
|
29
|
+
options={options}
|
30
|
+
/>
|
31
|
+
</Radio>
|
32
|
+
<Radio
|
33
|
+
customChildren
|
34
|
+
label="Typeahead"
|
35
|
+
name="Group1"
|
36
|
+
tabIndex={0}
|
37
|
+
value="Typeahead"
|
38
|
+
{...props}
|
39
|
+
>
|
40
|
+
<Typeahead
|
41
|
+
minWidth="xs"
|
42
|
+
options={options}
|
43
|
+
/>
|
44
|
+
</Radio>
|
45
|
+
<br />
|
46
|
+
<Radio
|
47
|
+
customChildren
|
48
|
+
defaultChecked={false}
|
49
|
+
label="Typography"
|
50
|
+
name="Group1"
|
51
|
+
value="Typography"
|
52
|
+
{...props}
|
53
|
+
>
|
54
|
+
<Title text="Custom Typography" />
|
55
|
+
</Radio>
|
56
|
+
</div>
|
57
|
+
)
|
58
|
+
}
|
59
|
+
export default RadioChildren
|
@@ -0,0 +1 @@
|
|
1
|
+
Use the `custom_children` prop to enable the use of kits instead of text labels.
|
@@ -7,6 +7,7 @@ examples:
|
|
7
7
|
- radio_options: With Options
|
8
8
|
- radio_alignment: Alignment
|
9
9
|
- radio_disabled: Disabled
|
10
|
+
- radio_custom_children: Custom Children
|
10
11
|
|
11
12
|
react:
|
12
13
|
- radio_default: Default
|
@@ -14,6 +15,7 @@ examples:
|
|
14
15
|
- radio_error: With Error
|
15
16
|
- radio_alignment: Alignment
|
16
17
|
- radio_disabled: Disabled
|
18
|
+
- radio_custom_children: Custom Children
|
17
19
|
|
18
20
|
swift:
|
19
21
|
- radio_default_swift: Default
|
@@ -3,3 +3,4 @@ export { default as RadioCustom } from './_radio_custom.jsx'
|
|
3
3
|
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
|
+
export { default as RadioCustomChildren } from './_radio_custom_children.jsx'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import PbEnhancedElement from "../pb_enhanced_element"
|
2
|
+
|
3
|
+
const RADIO_SELECTOR = "[data-pb-radio-children]"
|
4
|
+
const RADIO_WRAPPER_SELECTOR = "[data-pb-radio-children-wrapper]"
|
5
|
+
|
6
|
+
export default class PbRadio extends PbEnhancedElement {
|
7
|
+
static get selector() {
|
8
|
+
return RADIO_SELECTOR
|
9
|
+
}
|
10
|
+
|
11
|
+
connect() {
|
12
|
+
const radioWrapperElement = this.element.parentElement.querySelector(RADIO_WRAPPER_SELECTOR)
|
13
|
+
radioWrapperElement.addEventListener("click", () => {
|
14
|
+
this.element.querySelector("input[type='radio']").click()
|
15
|
+
})
|
16
|
+
}
|
17
|
+
}
|
@@ -1,18 +1,40 @@
|
|
1
|
-
|
1
|
+
<% if object.custom_children %>
|
2
|
+
<%= pb_rails("flex", props: {
|
2
3
|
aria: object.aria,
|
3
|
-
|
4
|
+
align: "center",
|
4
5
|
class: object.classname,
|
6
|
+
cursor: "pointer",
|
5
7
|
data: object.data,
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
**combined_html_options
|
9
|
+
}) do %>
|
10
|
+
<%= content_tag(:label,
|
11
|
+
'data-pb-radio-children': 'true',
|
12
|
+
checked: object.checked,
|
13
|
+
class: object.classname,
|
14
|
+
id: object.id,
|
15
|
+
value: object.value) do %>
|
16
|
+
<%= input %>
|
17
|
+
<span class="pb_radio_button"></span>
|
14
18
|
<% end %>
|
19
|
+
<div data-pb-radio-children-wrapper="true"> <%= content %> </div>
|
20
|
+
<% end %>
|
21
|
+
<% else %>
|
22
|
+
<%= content_tag(:label,
|
23
|
+
aria: object.aria,
|
24
|
+
checked: object.checked,
|
25
|
+
class: object.classname,
|
26
|
+
data: object.data,
|
27
|
+
id: object.id,
|
28
|
+
value: object.value,
|
29
|
+
**combined_html_options) do %>
|
30
|
+
|
31
|
+
<% if content.present? %>
|
32
|
+
<%= content %>
|
33
|
+
<% else %>
|
34
|
+
<%= radio_button_tag object.name, object.value, object.selected, object.input_options %>
|
35
|
+
<% end %>
|
15
36
|
|
16
|
-
|
17
|
-
|
18
|
-
<% end %>
|
37
|
+
<span class="pb_radio_button"></span>
|
38
|
+
<%= pb_rails("body", props: { status: object.body_status, text: object.text, dark: object.dark }) %>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
@@ -20,6 +20,8 @@ module Playbook
|
|
20
20
|
default: "Radio Text"
|
21
21
|
prop :value, type: Playbook::Props::String,
|
22
22
|
default: "radio_text"
|
23
|
+
prop :custom_children, type: Playbook::Props::Boolean,
|
24
|
+
default: false
|
23
25
|
|
24
26
|
def classname
|
25
27
|
generate_classname("pb_radio_kit") + error_class + alignment_class
|
@@ -34,7 +36,7 @@ module Playbook
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def input
|
37
|
-
radio_button_tag(name, value, checked, input_options.merge(disabled: disabled))
|
39
|
+
radio_button_tag(name, value, checked, input_options.merge(disabled: disabled || input_options[:disabled]))
|
38
40
|
end
|
39
41
|
|
40
42
|
private
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
2
|
|
3
|
+
import { getAllIcons } from "../../utilities/icons/allicons"
|
4
|
+
|
3
5
|
import Flex from '../../pb_flex/_flex'
|
4
6
|
import PbReactPopover from '../../pb_popover/_popover'
|
5
7
|
import Button from '../../pb_button/_button'
|
@@ -65,6 +67,7 @@ const toolbarDropdownItems = [
|
|
65
67
|
},
|
66
68
|
]
|
67
69
|
|
70
|
+
const angleDown = getAllIcons()["angleDown"].icon as unknown as { [key: string]: SVGElement }
|
68
71
|
|
69
72
|
const handleTogglePopover = () => {
|
70
73
|
setShowPopover(!showPopover)
|
@@ -92,8 +95,10 @@ for (const { text, isActive, icon } of toolbarDropdownItems) {
|
|
92
95
|
<Flex className={showPopover ? "fa-flip-vertical" : ""}
|
93
96
|
display="inline_flex"
|
94
97
|
>
|
95
|
-
<Icon
|
96
|
-
|
98
|
+
<Icon
|
99
|
+
className="svg-inline--fa"
|
100
|
+
customIcon={angleDown}
|
101
|
+
fixedWidth
|
97
102
|
margin-left="xs"
|
98
103
|
/>
|
99
104
|
</Flex>
|
@@ -125,8 +130,10 @@ const popoverReference = (
|
|
125
130
|
<Flex className={showPopover ? "fa-flip-vertical" : ""}
|
126
131
|
display="inline_flex"
|
127
132
|
>
|
128
|
-
<Icon
|
129
|
-
|
133
|
+
<Icon
|
134
|
+
className="svg-inline--fa"
|
135
|
+
customIcon={angleDown}
|
136
|
+
fixedWidth
|
130
137
|
margin-left="xs"
|
131
138
|
/>
|
132
139
|
</Flex>
|
@@ -169,4 +176,4 @@ const popoverReference = (
|
|
169
176
|
)
|
170
177
|
}
|
171
178
|
|
172
|
-
export default ToolbarDropdown
|
179
|
+
export default ToolbarDropdown
|
@@ -4,6 +4,7 @@ import classnames from 'classnames'
|
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
5
5
|
import { globalProps, GlobalProps, domSafeProps } from '../utilities/globalProps'
|
6
6
|
import type { InputCallback } from '../types'
|
7
|
+
import { getAllIcons } from "../utilities/icons/allicons"
|
7
8
|
|
8
9
|
import Body from '../pb_body/_body'
|
9
10
|
import Caption from '../pb_caption/_caption'
|
@@ -90,6 +91,8 @@ const Select = ({
|
|
90
91
|
compactClass
|
91
92
|
);
|
92
93
|
|
94
|
+
const angleDown = getAllIcons()["angleDown"].icon as unknown as { [key: string]: SVGElement }
|
95
|
+
|
93
96
|
const selectWrapperClass = classnames(buildCss('pb_select_kit_wrapper'), { error }, className)
|
94
97
|
const selectBody =(() =>{
|
95
98
|
if (children) return children
|
@@ -134,9 +137,9 @@ const Select = ({
|
|
134
137
|
{selectBody}
|
135
138
|
{ multiple !== true ?
|
136
139
|
<Icon
|
137
|
-
className="pb_select_kit_caret"
|
140
|
+
className="pb_select_kit_caret svg-inline--fa"
|
141
|
+
customIcon={angleDown}
|
138
142
|
fixedWidth
|
139
|
-
icon="angle-down"
|
140
143
|
/>
|
141
144
|
:
|
142
145
|
null
|
@@ -26,7 +26,7 @@
|
|
26
26
|
<%= pb_rails("body", props: { status: "negative", text: object.error }) %>
|
27
27
|
<% end %>
|
28
28
|
<% if object.multiple != true %>
|
29
|
-
<%= pb_rails("icon", props: {
|
29
|
+
<%= pb_rails("icon", props: { custom_icon: Playbook::Engine::root.join(angle_down_path), fixed_width: true, classname: "pb_select_kit_caret"}) %>
|
30
30
|
<% end %>
|
31
31
|
</label>
|
32
32
|
<% end %>
|
@@ -107,4 +107,34 @@ test('should pass className prop', () => {
|
|
107
107
|
|
108
108
|
const kit = screen.getByTestId('typeahead-test')
|
109
109
|
expect(kit).toHaveClass(className)
|
110
|
+
})
|
111
|
+
|
112
|
+
test('typeahead textinput has mb_sm class by default', () => {
|
113
|
+
render(
|
114
|
+
<Typeahead
|
115
|
+
data={{ testid: 'default-mb-test' }}
|
116
|
+
options={options}
|
117
|
+
/>
|
118
|
+
)
|
119
|
+
|
120
|
+
const kit = screen.getByTestId('default-mb-test')
|
121
|
+
expect(kit).toHaveClass("pb_typeahead_kit mb_sm")
|
122
|
+
const textInput = kit.querySelector(".pb_text_input_kit")
|
123
|
+
expect(textInput).toHaveClass("mb_none")
|
124
|
+
})
|
125
|
+
|
126
|
+
test('typeahead with colored pills', () => {
|
127
|
+
render(
|
128
|
+
<Typeahead
|
129
|
+
data={{ testid: 'pills-color-test' }}
|
130
|
+
defaultValue={[options[0]]}
|
131
|
+
isMulti
|
132
|
+
options={options}
|
133
|
+
pillColor="neutral"
|
134
|
+
/>
|
135
|
+
)
|
136
|
+
|
137
|
+
const kit = screen.getByTestId('pills-color-test')
|
138
|
+
const pill = kit.querySelector(".pb_form_pill_kit_neutral")
|
139
|
+
expect(pill).toBeInTheDocument()
|
110
140
|
})
|
@@ -45,12 +45,15 @@ type TypeaheadProps = {
|
|
45
45
|
getOptionLabel?: string | (() => any),
|
46
46
|
getOptionValue?: string | (() => any),
|
47
47
|
name?: string,
|
48
|
+
marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
49
|
+
pillColor?: "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",
|
48
50
|
} & GlobalProps
|
49
51
|
|
50
52
|
export type SelectValueType = {
|
51
53
|
label: string,
|
52
54
|
value: string,
|
53
55
|
imageUrl?: string,
|
56
|
+
pillColor?: string,
|
54
57
|
}
|
55
58
|
|
56
59
|
type TagOnChangeValues = {
|
@@ -76,6 +79,8 @@ const Typeahead = ({
|
|
76
79
|
htmlOptions = {},
|
77
80
|
id,
|
78
81
|
loadOptions = noop,
|
82
|
+
marginBottom = "sm",
|
83
|
+
pillColor,
|
79
84
|
...props
|
80
85
|
}: TypeaheadProps) => {
|
81
86
|
const selectProps = {
|
@@ -105,6 +110,7 @@ const Typeahead = ({
|
|
105
110
|
onCreateOption: null as null,
|
106
111
|
plusIcon: false,
|
107
112
|
onMultiValueClick: (_option: SelectValueType): any => undefined,
|
113
|
+
pillColor: pillColor,
|
108
114
|
...props,
|
109
115
|
}
|
110
116
|
|
@@ -134,6 +140,7 @@ const Typeahead = ({
|
|
134
140
|
const htmlProps = buildHtmlProps(htmlOptions)
|
135
141
|
const classes = classnames(
|
136
142
|
'pb_typeahead_kit react-select',
|
143
|
+
`mb_${marginBottom}`,
|
137
144
|
globalProps(props),
|
138
145
|
className
|
139
146
|
)
|