playbook_ui 14.1.0.pre.alpha.pbntr373enablekitsforradio3595 → 14.1.0
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/_playbook.scss +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +3 -3
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_badge/_badge.scss +0 -9
- data/app/pb_kits/playbook/pb_badge/_badge.tsx +3 -8
- data/app/pb_kits/playbook/pb_badge/badge.rb +1 -1
- data/app/pb_kits/playbook/pb_badge/badge.test.js +11 -17
- data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.html.erb +0 -13
- data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.jsx +12 -31
- data/app/pb_kits/playbook/pb_button/_button.tsx +1 -4
- data/app/pb_kits/playbook/pb_button/button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_button/button.rb +0 -4
- data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +2 -2
- data/app/pb_kits/playbook/pb_dialog/_close_icon.tsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -3
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +1 -20
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +0 -4
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.jsx +5 -1
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_filter/filter.rb +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +0 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +25 -43
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +2 -6
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +4 -4
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +0 -4
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +2 -0
- data/app/pb_kits/playbook/pb_pagination/_pagination.scss +13 -49
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +7 -0
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +5 -10
- data/app/pb_kits/playbook/pb_radio/_radio.scss +2 -2
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +50 -100
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_radio/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +76 -50
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_star_rating/index.js +41 -78
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +2 -4
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +0 -17
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_display.tsx +2 -0
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_interactive.tsx +1 -0
- data/app/pb_kits/playbook/pb_time/_time.tsx +8 -12
- data/app/pb_kits/playbook/pb_time/time.html.erb +3 -3
- data/app/pb_kits/playbook/pb_time/time.rb +0 -4
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -1
- data/app/pb_kits/playbook/utilities/globalProps.ts +3 -20
- data/dist/chunks/_typeahead-D6PRvP-1.js +22 -0
- data/dist/chunks/_weekday_stacked-DbdEuIzh.js +45 -0
- data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
- data/dist/chunks/{lib-DErGXNy3.js → lib-BE0Z3F7x.js} +2 -2
- data/dist/chunks/{pb_form_validation-BC6kh7Hu.js → pb_form_validation-TzZQ0Flx.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +0 -4
- 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/classnames.rb +0 -1
- data/lib/playbook/spacing.rb +2 -31
- data/lib/playbook/version.rb +2 -2
- metadata +13 -36
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.jsx +0 -46
- data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.scss +0 -3
- data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +0 -72
- data/app/pb_kits/playbook/pb_gantt_chart/docs/_gantt_chart_default.jsx +0 -53
- data/app/pb_kits/playbook/pb_gantt_chart/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_gantt_chart/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_gantt_chart/gantt_chart.test.jsx +0 -19
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +0 -164
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +0 -19
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +0 -1
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +0 -62
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +0 -1
- data/app/pb_kits/playbook/pb_pagination/docs/data.js +0 -23
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_radio/docs/_radio_children.jsx +0 -51
- data/app/pb_kits/playbook/pb_rich_text_editor/_previewer_mixin.scss +0 -132
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_preview.jsx +0 -73
- data/app/pb_kits/playbook/tokens/_container.scss +0 -21
- data/app/pb_kits/playbook/utilities/_min_width.scss +0 -45
- data/app/pb_kits/playbook/utilities/icons/allicons.tsx +0 -59
- data/app/pb_kits/playbook/utilities/icons/clock.svg +0 -9
- data/app/pb_kits/playbook/utilities/icons/spinner.svg +0 -3
- data/app/pb_kits/playbook/utilities/icons/times.svg +0 -3
- data/dist/chunks/_typeahead-CTLaD81v.js +0 -22
- data/dist/chunks/_weekday_stacked-U-4S3-tB.js +0 -45
- data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
- /data/app/pb_kits/playbook/pb_pagination/docs/{_pagination_default_rails.md → _pagination_default.md} +0 -0
@@ -46,7 +46,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
46
46
|
} = props
|
47
47
|
|
48
48
|
const iconClass = icon ? "_icon" : ""
|
49
|
-
const closeIconSize = size === "small" ? "xs" : "sm"
|
50
49
|
const css = classnames(
|
51
50
|
`pb_form_pill_kit_${color}${iconClass}`,
|
52
51
|
globalProps(props),
|
@@ -70,7 +69,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
70
69
|
<Avatar
|
71
70
|
imageUrl={avatarUrl}
|
72
71
|
name={name}
|
73
|
-
size="
|
72
|
+
size="xs"
|
74
73
|
status={null}
|
75
74
|
/>
|
76
75
|
<Title
|
@@ -85,7 +84,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
85
84
|
<Avatar
|
86
85
|
imageUrl={avatarUrl}
|
87
86
|
name={name}
|
88
|
-
size="
|
87
|
+
size="xs"
|
89
88
|
status={null}
|
90
89
|
/>
|
91
90
|
<Title
|
@@ -95,7 +94,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
95
94
|
/>
|
96
95
|
<Icon
|
97
96
|
className="pb_form_pill_icon"
|
98
|
-
color={color}
|
99
97
|
icon={icon}
|
100
98
|
/>
|
101
99
|
</>
|
@@ -104,7 +102,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
104
102
|
<>
|
105
103
|
<Icon
|
106
104
|
className="pb_form_pill_icon"
|
107
|
-
color={color}
|
108
105
|
icon={icon}
|
109
106
|
/>
|
110
107
|
<Title
|
@@ -129,7 +126,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
129
126
|
<Icon
|
130
127
|
fixedWidth
|
131
128
|
icon="times"
|
132
|
-
size={closeIconSize}
|
133
129
|
/>
|
134
130
|
</div>
|
135
131
|
</div>
|
@@ -5,11 +5,11 @@ examples:
|
|
5
5
|
- form_pill_size: Form Pill Size
|
6
6
|
- form_pill_tag: Form Pill Tag
|
7
7
|
- form_pill_example: Example
|
8
|
-
- form_pill_icon: Form Pill Icon
|
8
|
+
# - form_pill_icon: Form Pill Icon
|
9
9
|
|
10
10
|
react:
|
11
11
|
- form_pill_user: Form Pill User
|
12
12
|
- form_pill_size: Form Pill Size
|
13
13
|
- form_pill_tag: Form Pill Tag
|
14
14
|
- form_pill_example: Example
|
15
|
-
- form_pill_icon: Form Pill Icon
|
15
|
+
# - form_pill_icon: Form Pill Icon
|
@@ -1,19 +1,19 @@
|
|
1
1
|
<%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, tabindex: object.tabindex, **combined_html_options) do %>
|
2
2
|
<% if object.name.present? %>
|
3
|
-
<%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "
|
3
|
+
<%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xs" }) %>
|
4
4
|
<%= pb_rails("title", props: { text: object.name, size: 4, classname: "pb_form_pill_text" }) %>
|
5
5
|
<% if object.icon.present? %>
|
6
|
-
<%= pb_rails("icon", props: { classname: "pb_form_pill_icon",
|
6
|
+
<%= pb_rails("icon", props: { classname: "pb_form_pill_icon", icon: object.icon }) %>
|
7
7
|
<% end %>
|
8
8
|
<% elsif object.text.present? %>
|
9
9
|
<% if object.icon.present? %>
|
10
|
-
<%= pb_rails("icon", props: { classname: "pb_form_pill_icon",
|
10
|
+
<%= pb_rails("icon", props: { classname: "pb_form_pill_icon", icon: object.icon }) %>
|
11
11
|
<% end %>
|
12
12
|
<% if object.text.present? %>
|
13
13
|
<%= pb_rails("title", props: { text: object.text, size: 4, classname: "pb_form_pill_tag" }) %>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
16
16
|
<%= pb_rails("body", props: { classname: "pb_form_pill_close" }) do %>
|
17
|
-
<%= pb_rails("icon", props: { icon: 'times', fixed_width: true
|
17
|
+
<%= pb_rails("icon", props: { icon: 'times' , fixed_width: true }) %>
|
18
18
|
<% end %>
|
19
19
|
<% end %>
|
@@ -28,7 +28,7 @@ type IconProps = {
|
|
28
28
|
data?: {[key: string]: string},
|
29
29
|
fixedWidth?: boolean,
|
30
30
|
flip?: "horizontal" | "vertical" | "both" | "none",
|
31
|
-
icon
|
31
|
+
icon: string | ReactSVGElement,
|
32
32
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
33
33
|
id?: string,
|
34
34
|
inverse?: boolean,
|
@@ -469,6 +469,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
469
469
|
<FormPill
|
470
470
|
key={index}
|
471
471
|
onClick={(event: any) => handlePillClose(event, item)}
|
472
|
+
size="small"
|
472
473
|
text={item.label}
|
473
474
|
/>
|
474
475
|
))
|
@@ -481,6 +482,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
481
482
|
<FormPill
|
482
483
|
key={index}
|
483
484
|
onClick={(event: any) => handlePillClose(event, item)}
|
485
|
+
size="small"
|
484
486
|
text={item.label}
|
485
487
|
/>
|
486
488
|
))
|
@@ -3,45 +3,36 @@
|
|
3
3
|
@import "../tokens/border_radius";
|
4
4
|
@import "../tokens/shadows";
|
5
5
|
|
6
|
-
|
7
6
|
$pagination_padding: 7px 13px 6px 13px;
|
8
7
|
$top_bottom_radius: 0px;
|
9
8
|
|
10
|
-
@mixin hover-state {
|
11
|
-
background-color: $active_light !important;
|
12
|
-
color: $primary;
|
13
|
-
border-radius: $border_rad_light;
|
14
|
-
}
|
15
|
-
|
16
9
|
.pb_pagination {
|
17
10
|
display: inline-block;
|
18
11
|
border-radius: $border_rad_light;
|
19
12
|
border: $border_rad_lightest solid $border_light;
|
20
13
|
background-color: $white;
|
21
|
-
padding: $
|
22
|
-
li
|
14
|
+
padding: $space_xxs 0px !important;
|
15
|
+
li {
|
23
16
|
display: inline;
|
24
|
-
> a, li > span
|
17
|
+
> a, li > span {
|
25
18
|
padding: $pagination_padding;
|
26
19
|
text-decoration: none;
|
27
20
|
}}
|
28
|
-
li:first-child > a, li:first-child > span
|
29
|
-
background-color: $white;
|
21
|
+
li:first-child > a, li:first-child > span {
|
30
22
|
padding: $pagination_padding;
|
31
23
|
border-right: $border_rad_lightest solid $border_light;
|
32
24
|
z-index: 2;
|
33
25
|
border-top-right-radius: $top_bottom_radius;
|
34
26
|
border-bottom-right-radius: $top_bottom_radius;
|
35
|
-
cursor: pointer;
|
36
27
|
}
|
37
|
-
li:last-child > a, li:last-child > span
|
28
|
+
li:last-child > a, li:last-child > span {
|
38
29
|
padding: $pagination_padding;
|
39
30
|
border-left: $border_rad_lightest solid $border_light;
|
40
31
|
z-index: 2;
|
41
32
|
border-top-left-radius: $top_bottom_radius;
|
42
33
|
border-bottom-left-radius: $top_bottom_radius;
|
43
34
|
}
|
44
|
-
a
|
35
|
+
a {
|
45
36
|
color: $text_lt_default;
|
46
37
|
font-size: $text_small;
|
47
38
|
font-weight: $regular;
|
@@ -49,7 +40,9 @@ $top_bottom_radius: 0px;
|
|
49
40
|
transition: all $transition_default ease-out;
|
50
41
|
|
51
42
|
&:hover {
|
52
|
-
|
43
|
+
background-color: $active_light;
|
44
|
+
color: $primary;
|
45
|
+
border-radius: $border_rad_light;
|
53
46
|
}
|
54
47
|
|
55
48
|
&:focus-visible {
|
@@ -59,8 +52,8 @@ $top_bottom_radius: 0px;
|
|
59
52
|
transition: none;
|
60
53
|
}
|
61
54
|
}
|
62
|
-
.active > span
|
63
|
-
background-color: $primary
|
55
|
+
.active > span {
|
56
|
+
background-color: $primary;
|
64
57
|
border-radius: $border_rad_light;
|
65
58
|
color: #fff;
|
66
59
|
padding: $pagination_padding;
|
@@ -69,37 +62,8 @@ $top_bottom_radius: 0px;
|
|
69
62
|
font-weight: $bold;
|
70
63
|
font-size: $text_small;
|
71
64
|
}
|
72
|
-
.disabled {
|
73
|
-
|
74
|
-
opacity: 0.5;
|
75
|
-
color: grey;
|
76
|
-
|
77
|
-
& > span {
|
78
|
-
padding: $pagination_padding;
|
79
|
-
font-size: $text_small;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
.pagination-right,
|
84
|
-
.pagination-left {
|
85
|
-
background-color: $white;
|
86
|
-
border-top: none;
|
87
|
-
border-bottom: none;
|
88
|
-
cursor: pointer;
|
89
|
-
padding: 7px 11px 6px;
|
65
|
+
.disabled > span {
|
66
|
+
padding: $pagination_padding;
|
90
67
|
font-size: $text_small;
|
91
|
-
|
92
|
-
&:hover {
|
93
|
-
@include hover-state;
|
94
|
-
}
|
95
|
-
}
|
96
|
-
.pagination-left {
|
97
|
-
border-left: none;
|
98
|
-
margin-right: $space_xxs;
|
99
|
-
}
|
100
|
-
|
101
|
-
.pagination-right {
|
102
|
-
border-right: none;
|
103
|
-
margin-left: $space_xxs;
|
104
68
|
}
|
105
69
|
}
|
@@ -60,6 +60,7 @@ $flag-min-resolution: 192dpi;
|
|
60
60
|
}
|
61
61
|
|
62
62
|
.iti__flag {
|
63
|
+
background-image: url("https://intl-tel-input.com/intl-tel-input/img/flags.png");
|
63
64
|
border-radius: 1px;
|
64
65
|
}
|
65
66
|
|
@@ -196,4 +197,10 @@ $flag-min-resolution: 192dpi;
|
|
196
197
|
}
|
197
198
|
}
|
198
199
|
}
|
200
|
+
|
201
|
+
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: $flag-min-resolution) {
|
202
|
+
.iti__flag {
|
203
|
+
background-image: url("https://intl-tel-input.com/intl-tel-input/img/flags.png");
|
204
|
+
}
|
205
|
+
}
|
199
206
|
}
|
@@ -21,8 +21,6 @@ import classnames from "classnames";
|
|
21
21
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
22
22
|
import { uniqueId } from 'lodash';
|
23
23
|
|
24
|
-
type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth'>
|
25
|
-
|
26
24
|
type PbPopoverProps = {
|
27
25
|
aria?: { [key: string]: string };
|
28
26
|
className?: string;
|
@@ -34,7 +32,7 @@ type PbPopoverProps = {
|
|
34
32
|
reference: PopperReference & any;
|
35
33
|
show?: boolean;
|
36
34
|
shouldClosePopover?: (arg0: boolean) => void;
|
37
|
-
} &
|
35
|
+
} & GlobalProps & Omit<PopperProps<any>, 'children'>
|
38
36
|
& { children?: React.ReactChild[] | React.ReactChild }
|
39
37
|
|
40
38
|
// Prop enabled default modifiers here
|
@@ -82,13 +80,10 @@ const Popover = (props: PbPopoverProps) => {
|
|
82
80
|
targetId,
|
83
81
|
} = props;
|
84
82
|
|
85
|
-
const items = globalProps(props).split(' ')
|
86
|
-
const filteredItems = items.filter(item => !item.includes('min_width'))
|
87
|
-
const filteredGlobalProps = filteredItems.join(' ')
|
88
83
|
const popoverSpacing =
|
89
|
-
|
84
|
+
globalProps(props).includes("dark") || !globalProps(props)
|
90
85
|
? "p_sm"
|
91
|
-
:
|
86
|
+
: globalProps(props);
|
92
87
|
const overflowHandling = maxHeight || maxWidth ? "overflow_handling" : "";
|
93
88
|
const zIndexStyle = zIndex ? { zIndex: zIndex } : {};
|
94
89
|
const widthHeightStyles = () => {
|
@@ -105,7 +100,7 @@ const Popover = (props: PbPopoverProps) => {
|
|
105
100
|
const htmlProps = buildHtmlProps(htmlOptions);
|
106
101
|
const classes = classnames(
|
107
102
|
buildCss("pb_popover_kit"),
|
108
|
-
|
103
|
+
globalProps(props),
|
109
104
|
className
|
110
105
|
);
|
111
106
|
|
@@ -255,4 +250,4 @@ const PbReactPopover = (props: PbPopoverProps): React.ReactElement => {
|
|
255
250
|
);
|
256
251
|
};
|
257
252
|
|
258
|
-
export default PbReactPopover;
|
253
|
+
export default PbReactPopover;
|
@@ -8,7 +8,7 @@
|
|
8
8
|
display: inline-flex;
|
9
9
|
cursor: pointer;
|
10
10
|
|
11
|
-
.pb_radio_button{
|
11
|
+
.pb_radio_button {
|
12
12
|
width: 22px;
|
13
13
|
min-width: 22px;
|
14
14
|
height: 22px;
|
@@ -18,7 +18,7 @@
|
|
18
18
|
margin-right: $space_xs;
|
19
19
|
transition: background $transition_default ease, box-shadow $transition_default ease, border-color $transition_default ease;
|
20
20
|
}
|
21
|
-
|
21
|
+
|
22
22
|
@media (hover:hover) {
|
23
23
|
&:hover .pb_radio_button {
|
24
24
|
background-color: $bg_light;
|
@@ -1,27 +1,28 @@
|
|
1
|
-
|
1
|
+
/*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
|
2
|
+
|
3
|
+
import React, { forwardRef } from 'react'
|
2
4
|
import Body from '../pb_body/_body'
|
3
|
-
import Flex from '../pb_flex/_flex'
|
4
5
|
import classnames from 'classnames'
|
5
6
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
6
7
|
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
7
8
|
|
8
9
|
type RadioProps = {
|
9
|
-
aria?: {
|
10
|
+
aria?: {[key: string]: string},
|
10
11
|
alignment?: string,
|
11
12
|
checked?: boolean,
|
12
13
|
children?: React.ReactChild[] | React.ReactChild,
|
13
14
|
className?: string,
|
14
15
|
dark?: boolean,
|
15
|
-
data?: {
|
16
|
+
data?: {[key: string]: string},
|
16
17
|
disabled?: boolean,
|
17
18
|
error?: boolean,
|
18
|
-
htmlOptions?: {
|
19
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
19
20
|
id?: string,
|
20
21
|
label: string,
|
21
22
|
name?: string,
|
22
23
|
value?: string,
|
23
24
|
text?: string,
|
24
|
-
onChange: (event: React.FormEvent<HTMLInputElement> | null)
|
25
|
+
onChange: (event: React.FormEvent<HTMLInputElement> | null)=>void,
|
25
26
|
} & GlobalProps
|
26
27
|
|
27
28
|
const Radio = ({
|
@@ -30,9 +31,9 @@ const Radio = ({
|
|
30
31
|
children,
|
31
32
|
className,
|
32
33
|
dark = false,
|
34
|
+
data = {},
|
33
35
|
disabled = false,
|
34
36
|
error = false,
|
35
|
-
data = {},
|
36
37
|
htmlOptions = {},
|
37
38
|
id,
|
38
39
|
label,
|
@@ -41,103 +42,52 @@ const Radio = ({
|
|
41
42
|
value = 'radio_text',
|
42
43
|
onChange = () => { void 0 },
|
43
44
|
...props
|
44
|
-
}: RadioProps ) => {
|
45
|
-
const
|
46
|
-
|
47
|
-
const
|
48
|
-
const dataProps = buildDataProps(data);
|
49
|
-
const htmlProps = buildHtmlProps(htmlOptions);
|
45
|
+
}: RadioProps, ref: any) => {
|
46
|
+
const ariaProps = buildAriaProps(aria)
|
47
|
+
const dataProps = buildDataProps(data)
|
48
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
50
49
|
const classes = classnames(
|
51
|
-
buildCss('pb_radio_kit', alignment),
|
52
|
-
dark ? 'dark' : null,
|
53
|
-
error ? 'error' : null,
|
50
|
+
buildCss('pb_radio_kit', alignment ),
|
51
|
+
dark ? 'dark': null, error ? 'error': null,
|
54
52
|
globalProps(props),
|
55
|
-
className
|
56
|
-
);
|
57
|
-
|
58
|
-
const classesCustom = classnames(
|
59
|
-
dark ? 'dark' : null,
|
60
|
-
error ? 'error' : null,
|
61
|
-
globalProps(props),
|
62
|
-
className
|
63
|
-
);
|
64
|
-
|
65
|
-
const isCustomChild = children && isValidElement(children) && children.type !== 'input';
|
53
|
+
className)
|
66
54
|
|
67
55
|
const displayRadio = (props: RadioProps & any) => {
|
68
|
-
if (
|
69
|
-
return
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
85
|
-
};
|
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 === 'children-wrapper' ||
|
92
|
-
target.closest('#children-wrapper')
|
93
|
-
) {
|
94
|
-
radioRef.current?.click();
|
95
|
-
}
|
96
|
-
}
|
97
|
-
};
|
56
|
+
if (children)
|
57
|
+
return (children)
|
58
|
+
else
|
59
|
+
return (
|
60
|
+
<input
|
61
|
+
disabled={disabled}
|
62
|
+
id={id}
|
63
|
+
name={name}
|
64
|
+
onChange={onChange}
|
65
|
+
ref={ref}
|
66
|
+
text={text}
|
67
|
+
type="radio"
|
68
|
+
value={value}
|
69
|
+
{...props}
|
70
|
+
/>
|
71
|
+
)}
|
98
72
|
|
99
73
|
return (
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
<span className="pb_radio_button" />
|
119
|
-
</label>
|
120
|
-
<div id="children-wrapper"> {children} </div>
|
121
|
-
</Flex>
|
122
|
-
) : (
|
123
|
-
<label
|
124
|
-
{...ariaProps}
|
125
|
-
{...dataProps}
|
126
|
-
{...htmlProps}
|
127
|
-
className={classes}
|
128
|
-
htmlFor={id}
|
129
|
-
>
|
130
|
-
<>{displayRadio(props)}</>
|
131
|
-
<span className="pb_radio_button" />
|
132
|
-
<Body
|
133
|
-
dark={dark}
|
134
|
-
status={error ? 'negative' : null}
|
135
|
-
text={label}
|
136
|
-
variant={null}
|
137
|
-
/>
|
138
|
-
</label>
|
139
|
-
)
|
140
|
-
);
|
141
|
-
};
|
74
|
+
<label
|
75
|
+
{...ariaProps}
|
76
|
+
{...dataProps}
|
77
|
+
{...htmlProps}
|
78
|
+
className={classes}
|
79
|
+
htmlFor={id}
|
80
|
+
>
|
81
|
+
<>{displayRadio(props)}</>
|
82
|
+
<span className="pb_radio_button" />
|
83
|
+
<Body
|
84
|
+
dark={dark}
|
85
|
+
status={error ? 'negative' : null}
|
86
|
+
text={label}
|
87
|
+
variant={null}
|
88
|
+
/>
|
89
|
+
</label>
|
90
|
+
)
|
91
|
+
}
|
142
92
|
|
143
|
-
export default forwardRef(Radio)
|
93
|
+
export default forwardRef(Radio)
|
@@ -3,4 +3,3 @@ 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 RadioChildren } from './_radio_children.jsx'
|