playbook_ui 14.1.0.pre.alpha.pbntr373enablekitsforradio3595 → 14.2.0.pre.alpha.PLAY15063618
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_avatar_action_button/_avatar_action_button.scss +2 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +1 -1
- 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/dist/chunks/_typeahead-Cq7RLPBA.js +22 -0
- data/dist/chunks/{_weekday_stacked-U-4S3-tB.js → _weekday_stacked-Cykj5kLZ.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/lib/playbook/version.rb +2 -2
- metadata +4 -5
- data/app/pb_kits/playbook/pb_radio/docs/_radio_children.jsx +0 -51
- data/dist/chunks/_typeahead-CTLaD81v.js +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8d3dca1c0f2c197c091448ad9e991ca875c1c9f0cf689357f798c8521749d63
|
4
|
+
data.tar.gz: 7a9ecdd1736ee1e29238bcb23b56041baead70da068eceac78f181495e5ed483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02dc18bfae0107af6202c571169f840bd6139773149e96e1c6e2cbb10c04427ce3f0ee82f9c6358c04974e31d7b20db110f0ba9963e5a30b1bf48b3a66b00e9e
|
7
|
+
data.tar.gz: d6404b2cb0f485a4d2dbcc8fb4f82cc6221ad9380f05ea1148f3367c638a5ac96cb6a3139eb2ee4cbe95f5724d43aedf06ccb99914b2b95361748eb040484f0f
|
@@ -35,8 +35,8 @@
|
|
35
35
|
&[class*=_#{$name}] {
|
36
36
|
|
37
37
|
$avatar_size: map-get($avatar-sizes, $name);
|
38
|
-
$icon_size:
|
39
|
-
$border_size:
|
38
|
+
$icon_size: $avatar_size / 2;
|
39
|
+
$border_size: $icon_size / 10;
|
40
40
|
|
41
41
|
position: relative;
|
42
42
|
width: $avatar_size * 1.25;
|
@@ -16,7 +16,7 @@ $pb_button_styles: (
|
|
16
16
|
flex-grow: 0;
|
17
17
|
width: $pb_button_size;
|
18
18
|
height: $pb_button_size;
|
19
|
-
border-radius:
|
19
|
+
border-radius: $pb_button_size / 2;
|
20
20
|
line-height: $pb_button_size;
|
21
21
|
flex-basis: $pb_button_size;
|
22
22
|
min-width: $pb_button_size;
|
@@ -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'
|