playbook_ui 12.3.1 → 12.4.0.pre.alpha.map1
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/_playbook.scss +1 -1
- data/app/pb_kits/playbook/data/menu.yml +1 -0
- data/app/pb_kits/playbook/index.js +5 -1
- data/app/pb_kits/playbook/pb_button/_button.tsx +2 -2
- data/app/pb_kits/playbook/pb_dashboard_value/{_dashboard_value.jsx → _dashboard_value.tsx} +12 -14
- data/app/pb_kits/playbook/pb_date_time_stacked/{_date_time_stacked.jsx → _date_time_stacked.tsx} +2 -6
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.jsx +5 -2
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +2 -0
- data/app/pb_kits/playbook/pb_map/_map.scss +114 -2
- data/app/pb_kits/playbook/pb_map/_map.tsx +42 -2
- data/app/pb_kits/playbook/pb_map/docs/_map_default.jsx +48 -24
- data/app/pb_kits/playbook/pb_map/docs/_map_default.md +4 -4
- data/app/pb_kits/playbook/pb_map/docs/_map_with_plugin.jsx +16 -14
- data/app/pb_kits/playbook/pb_map/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_map/pbMapTheme.ts +23 -0
- data/app/pb_kits/playbook/pb_person/{_person.jsx → _person.tsx} +6 -8
- data/app/pb_kits/playbook/pb_person/person.test.js +43 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +102 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +155 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.jsx +10 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_initial_country.jsx +12 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_initial_country.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.jsx +13 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.jsx +13 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +74 -0
- data/app/pb_kits/playbook/pb_phone_number_input/types.d.ts +1 -0
- data/app/pb_kits/playbook/pb_radio/_radio.scss +19 -11
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on.html.erb +7 -6
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on.jsx +8 -8
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +1 -1
- data/app/pb_kits/playbook/pb_title_count/{_title_count.jsx → _title_count.tsx} +7 -5
- data/app/pb_kits/playbook/pb_title_count/title_count.test.js +69 -0
- data/app/pb_kits/playbook/playbook-doc.js +2 -0
- data/app/pb_kits/playbook/tokens/_colors.scss +24 -24
- data/lib/playbook/version.rb +2 -2
- metadata +26 -9
- /data/app/pb_kits/playbook/pb_dashboard_value/{dashboardValueSettings.js → dashboardValueSettings.ts} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '../utilities/test-utils'
|
|
4
|
+
|
|
5
|
+
import Person from './_person'
|
|
6
|
+
|
|
7
|
+
test('renders person classname', () => {
|
|
8
|
+
render(
|
|
9
|
+
<Person
|
|
10
|
+
data={{ testid: 'classname-test' }}
|
|
11
|
+
firstName="Kyle"
|
|
12
|
+
lastName="Fadigan"
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
const kit = screen.getByTestId('classname-test')
|
|
17
|
+
expect(kit).toHaveClass("pb_person_kit");
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
test('it renders the component with the first name', () => {
|
|
22
|
+
render(
|
|
23
|
+
<Person
|
|
24
|
+
firstName="Kyle"
|
|
25
|
+
lastName="Fadigan"
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const kit = screen.getByText('Kyle')
|
|
30
|
+
expect(kit).toBeTruthy()
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('it renders the component with the last name', () => {
|
|
34
|
+
render(
|
|
35
|
+
<Person
|
|
36
|
+
firstName="Kyle"
|
|
37
|
+
lastName="Fadigan"
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
const kit = screen.getByText('Fadigan')
|
|
42
|
+
expect(kit).toBeTruthy()
|
|
43
|
+
})
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
@import "../tokens/colors";
|
|
2
|
+
|
|
3
|
+
.pb_phone_number_input {
|
|
4
|
+
input::placeholder {
|
|
5
|
+
color: $focus_input_light;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.iti__country {
|
|
9
|
+
padding: 5px 10px 5px 16px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.iti__selected-flag {
|
|
13
|
+
padding: 0 6px 0 16px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.iti__country.iti__highlight {
|
|
17
|
+
background-color: $hover_light;
|
|
18
|
+
|
|
19
|
+
.iti__country-name, .iti__dial-code {
|
|
20
|
+
color: $primary
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag {
|
|
25
|
+
background-color: $focus_input_light;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.iti__flag-container:hover + .text_input {
|
|
29
|
+
background-color: $focus_input_light;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.iti__flag {
|
|
33
|
+
background-image: url("https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.19/img/flags.png");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.iti--separate-dial-code .iti__selected-flag {
|
|
37
|
+
background-color: rgba($white, $opacity_1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.iti__arrow {
|
|
41
|
+
border-left: unset;
|
|
42
|
+
border-right: unset;
|
|
43
|
+
border-top: unset;
|
|
44
|
+
width: unset;
|
|
45
|
+
height: unset;
|
|
46
|
+
margin-bottom: $space_xxs;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.iti__arrow--up {
|
|
50
|
+
border-bottom: unset;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.iti__arrow::before {
|
|
54
|
+
border-style: solid;
|
|
55
|
+
border-width: 0.1em 0.1em 0 0;
|
|
56
|
+
content: '';
|
|
57
|
+
display: inline-block;
|
|
58
|
+
height: 0.6em;
|
|
59
|
+
left: 0.1em;
|
|
60
|
+
position: relative;
|
|
61
|
+
vertical-align: top;
|
|
62
|
+
width: 0.6em;
|
|
63
|
+
top: 10px;
|
|
64
|
+
transform: rotate(135deg);
|
|
65
|
+
font-size: 0.5em;
|
|
66
|
+
color: $slate;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.iti__arrow.iti__arrow--up::before {
|
|
70
|
+
transform: rotate(-45deg);
|
|
71
|
+
top: 12px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.iti__active::after {
|
|
75
|
+
float: right;
|
|
76
|
+
content: "";
|
|
77
|
+
margin-top: 5px;
|
|
78
|
+
transform: rotate(45deg);
|
|
79
|
+
height: 12px;
|
|
80
|
+
width: 6px;
|
|
81
|
+
border-bottom: 2px solid;
|
|
82
|
+
border-right: 2px solid;
|
|
83
|
+
border-radius: 1px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.iti__country-list {
|
|
87
|
+
min-width: 340px;
|
|
88
|
+
border-radius: $border_radius_md;
|
|
89
|
+
border: 1px solid $border_light;
|
|
90
|
+
box-shadow: $shadow_deep;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.iti__divider {
|
|
94
|
+
border-bottom: 1px solid $border_light;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
|
98
|
+
.iti__flag {
|
|
99
|
+
background-image: url("https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.19/img/flags@2x.png");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
3
|
+
import classnames from 'classnames'
|
|
4
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
5
|
+
import { globalProps } from '../utilities/globalProps'
|
|
6
|
+
import intlTelInput from 'intl-tel-input'
|
|
7
|
+
import 'intl-tel-input/build/css/intlTelInput.css'
|
|
8
|
+
import TextInput from '../pb_text_input/_text_input'
|
|
9
|
+
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
intlTelInputGlobals: any,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type PhoneNumberInputProps = {
|
|
17
|
+
aria?: { [key: string]: string },
|
|
18
|
+
className?: string,
|
|
19
|
+
data?: { [key: string]: string },
|
|
20
|
+
disabled?: boolean,
|
|
21
|
+
id?: string,
|
|
22
|
+
initialCountry?: string,
|
|
23
|
+
isValid?: (valid: boolean) => void,
|
|
24
|
+
label?: string,
|
|
25
|
+
name?: string,
|
|
26
|
+
onChange?: (e: React.FormEvent<HTMLInputElement>) => void,
|
|
27
|
+
onlyCountries: string[],
|
|
28
|
+
preferredCountries?: string[],
|
|
29
|
+
value?: string,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
enum ValidationError {
|
|
33
|
+
TooShort = 2,
|
|
34
|
+
TooLong = 3,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const formatToGlobalCountryName = (countryName: string) => {
|
|
38
|
+
return countryName.split('(')[0].trim()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const formatAllCountries = () => {
|
|
42
|
+
let countryData = window.intlTelInputGlobals.getCountryData()
|
|
43
|
+
for (let i = 0; i < countryData.length; i++) {
|
|
44
|
+
let country = countryData[i]
|
|
45
|
+
country.name = formatToGlobalCountryName(country.name)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const containOnlyNumbers = (value: string) => {
|
|
50
|
+
return /^(\++)*(\d+)$/.test(value)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const PhoneNumberInput = (props: PhoneNumberInputProps) => {
|
|
54
|
+
const {
|
|
55
|
+
aria = {},
|
|
56
|
+
className,
|
|
57
|
+
data = {},
|
|
58
|
+
disabled = false,
|
|
59
|
+
id = '',
|
|
60
|
+
initialCountry = '',
|
|
61
|
+
isValid = () => {void 0 },
|
|
62
|
+
label = '',
|
|
63
|
+
name = '',
|
|
64
|
+
onChange = () => { void 0 },
|
|
65
|
+
onlyCountries = [],
|
|
66
|
+
preferredCountries = [],
|
|
67
|
+
value = '',
|
|
68
|
+
} = props
|
|
69
|
+
|
|
70
|
+
const ariaProps = buildAriaProps(aria)
|
|
71
|
+
const dataProps = buildDataProps(data)
|
|
72
|
+
const classes = classnames(buildCss('pb_phone_number_input'), globalProps(props), className)
|
|
73
|
+
|
|
74
|
+
const inputRef = useRef<HTMLInputElement>()
|
|
75
|
+
const [inputValue, setInputValue] = useState(value)
|
|
76
|
+
const [itiInit, setItiInit] = useState<any>()
|
|
77
|
+
const [error, setError] = useState('')
|
|
78
|
+
|
|
79
|
+
const validateTooLongNumber = (itiInit: any) => {
|
|
80
|
+
const error = itiInit.getValidationError()
|
|
81
|
+
|
|
82
|
+
if (error === ValidationError.TooLong) {
|
|
83
|
+
const countryName = itiInit.getSelectedCountryData().name
|
|
84
|
+
setError(`Invalid ${countryName} phone number (too long)`)
|
|
85
|
+
} else {
|
|
86
|
+
setError('')
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const validateTooShortNumber = () => {
|
|
91
|
+
const error = itiInit.getValidationError()
|
|
92
|
+
|
|
93
|
+
if (error === ValidationError.TooShort) {
|
|
94
|
+
const countryName = itiInit.getSelectedCountryData().name
|
|
95
|
+
setError(`Invalid ${countryName} phone number (too short)`)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const validateOnlyNumbers = () => {
|
|
100
|
+
if (inputValue && !containOnlyNumbers(inputValue)) {
|
|
101
|
+
setError('Invalid phone number. Enter numbers only.')
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const validateErrors = () => {
|
|
106
|
+
validateTooShortNumber()
|
|
107
|
+
validateOnlyNumbers()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const handleOnChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
|
111
|
+
setInputValue(evt.target.value)
|
|
112
|
+
validateTooLongNumber(itiInit)
|
|
113
|
+
onChange(evt)
|
|
114
|
+
isValid(itiInit.isValidNumber())
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
formatAllCountries()
|
|
119
|
+
|
|
120
|
+
const telInputInit = new intlTelInput(inputRef.current, {
|
|
121
|
+
utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.19/js/utils.js',
|
|
122
|
+
separateDialCode: true,
|
|
123
|
+
preferredCountries,
|
|
124
|
+
allowDropdown: !disabled,
|
|
125
|
+
initialCountry,
|
|
126
|
+
onlyCountries,
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
inputRef.current.addEventListener("countrychange", () => validateTooLongNumber(telInputInit))
|
|
131
|
+
setItiInit(telInputInit)
|
|
132
|
+
}, [])
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<div
|
|
136
|
+
{...ariaProps}
|
|
137
|
+
{...dataProps}
|
|
138
|
+
className={classes}
|
|
139
|
+
>
|
|
140
|
+
<TextInput
|
|
141
|
+
disabled={disabled}
|
|
142
|
+
error={error}
|
|
143
|
+
id={id}
|
|
144
|
+
label={label}
|
|
145
|
+
name={name}
|
|
146
|
+
onBlur={() => validateErrors()}
|
|
147
|
+
onChange={handleOnChange}
|
|
148
|
+
ref={inputRef}
|
|
149
|
+
value={inputValue}
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default PhoneNumberInput
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
NOTE: Error state is handled by default, validating length (too long or too short) relative to the selected country’s phone format and enforcing numeric-only values for all countries.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Setting an initial country preselects that country within the input as well as the country dropdown.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { PhoneNumberInput } from '../../'
|
|
3
|
+
|
|
4
|
+
const PhoneNumberInputOnlyCountries = () => (
|
|
5
|
+
<>
|
|
6
|
+
<PhoneNumberInput
|
|
7
|
+
id='only'
|
|
8
|
+
onlyCountries={['us', 'br']}
|
|
9
|
+
/>
|
|
10
|
+
</>
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
export default PhoneNumberInputOnlyCountries
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Limiting countries removes all countries from the dropdown except your selections.
|
data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.jsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { PhoneNumberInput } from '../../'
|
|
3
|
+
|
|
4
|
+
const PhoneNumberInputPreferredCountries = () => (
|
|
5
|
+
<>
|
|
6
|
+
<PhoneNumberInput
|
|
7
|
+
id='preferred'
|
|
8
|
+
preferredCountries={['us', 'br', 'ph', 'gb']}
|
|
9
|
+
/>
|
|
10
|
+
</>
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
export default PhoneNumberInputPreferredCountries
|
data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Preferred countries will display in the order they are listed with the first country preselected, and all non-preferred countries listed alphabetically below a section separator within the remaining dropdown.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as PhoneNumberInputDefault } from './_phone_number_input_default'
|
|
2
|
+
export { default as PhoneNumberInputPreferredCountries } from './_phone_number_input_preferred_countries'
|
|
3
|
+
export { default as PhoneNumberInputInitialCountry } from './_phone_number_input_initial_country'
|
|
4
|
+
export { default as PhoneNumberInputOnlyCountries } from './_phone_number_input_only_countries'
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
|
3
|
+
import PhoneNumberInput from './_phone_number_input'
|
|
4
|
+
|
|
5
|
+
const testId = "phoneNumberInput"
|
|
6
|
+
|
|
7
|
+
test('should be disabled', () => {
|
|
8
|
+
const props = {
|
|
9
|
+
disabled: true,
|
|
10
|
+
id: testId,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
render(<PhoneNumberInput {...props} />)
|
|
14
|
+
const kit = screen.getByRole("textbox")
|
|
15
|
+
expect(kit).toBeDisabled()
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('should be enabled by default', () => {
|
|
19
|
+
const props = {
|
|
20
|
+
id: testId,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render(<PhoneNumberInput {...props} />)
|
|
24
|
+
const kit = screen.getByRole("textbox")
|
|
25
|
+
expect(kit).not.toBeDisabled()
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('should have label', () => {
|
|
29
|
+
const label = 'Phone Number'
|
|
30
|
+
const props = {
|
|
31
|
+
id: testId,
|
|
32
|
+
label,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
render(<PhoneNumberInput {...props} />)
|
|
36
|
+
const kit = screen.getByText(label)
|
|
37
|
+
expect(kit).toBeInTheDocument()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
test('should pass data prop', () => {
|
|
41
|
+
const props = {
|
|
42
|
+
data: { testid: testId },
|
|
43
|
+
id: testId,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
render(<PhoneNumberInput {...props} />)
|
|
47
|
+
const kit = screen.getByTestId(testId)
|
|
48
|
+
expect(kit).toBeInTheDocument()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test('should pass className prop', () => {
|
|
52
|
+
const className = 'custom-class-name'
|
|
53
|
+
const props = {
|
|
54
|
+
className,
|
|
55
|
+
data: { testid: testId },
|
|
56
|
+
id: testId,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
render(<PhoneNumberInput {...props} />)
|
|
60
|
+
const kit = screen.getByTestId(testId)
|
|
61
|
+
expect(kit).toHaveClass(className)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
test('should pass value prop', () => {
|
|
65
|
+
const value = '1234567890'
|
|
66
|
+
const props = {
|
|
67
|
+
id: testId,
|
|
68
|
+
value,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
render(<PhoneNumberInput {...props} />)
|
|
72
|
+
const kit = screen.getByRole("textbox")
|
|
73
|
+
expect(kit).toHaveDisplayValue(value)
|
|
74
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'intl-tel-input'
|
|
@@ -16,16 +16,13 @@
|
|
|
16
16
|
border-radius: 1000px;
|
|
17
17
|
border: 2px solid $border_light;
|
|
18
18
|
margin-right: $space_xs;
|
|
19
|
-
transition
|
|
20
|
-
transition-duration: $transition_short;
|
|
21
|
-
transition-timing-function: $easeIn;
|
|
19
|
+
transition: background $transition_default ease, box-shadow $transition_default ease, border-color $transition_default ease;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
@media (hover:hover) {
|
|
25
|
-
&:hover
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
23
|
+
&:hover .pb_radio_button {
|
|
24
|
+
background-color: $bg_light;
|
|
25
|
+
border-color: $border_light;
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
28
|
|
|
@@ -33,7 +30,12 @@
|
|
|
33
30
|
position: relative;
|
|
34
31
|
width: 0;
|
|
35
32
|
left: $offscreen;
|
|
36
|
-
&:
|
|
33
|
+
&:focus-visible {
|
|
34
|
+
& ~ .pb_radio_button {
|
|
35
|
+
box-shadow: 0px 0px 0px 2px $white, 0px 0px 0px 4px $primary;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
&:checked {
|
|
37
39
|
& ~ .pb_radio_button {
|
|
38
40
|
border: 6px solid $primary;
|
|
39
41
|
}
|
|
@@ -54,7 +56,12 @@
|
|
|
54
56
|
border-color: $border_dark;
|
|
55
57
|
}
|
|
56
58
|
input {
|
|
57
|
-
&:
|
|
59
|
+
&:focus-visible {
|
|
60
|
+
& ~ .pb_radio_button {
|
|
61
|
+
box-shadow: 0px 0px 0px 2px $bg_dark_card, 0px 0px 0px 4px $primary;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
&:checked {
|
|
58
65
|
& ~ .pb_radio_button {
|
|
59
66
|
border: 6px solid $primary;
|
|
60
67
|
}
|
|
@@ -62,9 +69,10 @@
|
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
@media (hover:hover) {
|
|
65
|
-
&:hover
|
|
72
|
+
&:hover {
|
|
66
73
|
.pb_radio_button {
|
|
67
|
-
|
|
74
|
+
background-color: rgba($white,.10);
|
|
75
|
+
border-color: $border_dark;
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
78
|
}
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
add_on: { icon: "user", alignment: 'right', border: true }
|
|
9
9
|
}) %>
|
|
10
10
|
|
|
11
|
+
|
|
12
|
+
<%= pb_rails("text_input", props: {
|
|
13
|
+
label: "Right-Aligned Add On With No Border",
|
|
14
|
+
add_on: { icon: "percent", alignment: 'right', border: false }
|
|
15
|
+
}) %>
|
|
16
|
+
|
|
11
17
|
<%= pb_rails("text_input", props: {
|
|
12
18
|
label: "Left-Aligned Add On With No Border",
|
|
13
19
|
add_on: { icon: "percent", alignment: 'left', border: false }
|
|
@@ -16,9 +22,4 @@
|
|
|
16
22
|
<%= pb_rails("text_input", props: {
|
|
17
23
|
label: "Left-Aligned Add On With Border",
|
|
18
24
|
add_on: { icon: "user", alignment: 'left', border: true }
|
|
19
|
-
}) %>
|
|
20
|
-
|
|
21
|
-
<%= pb_rails("text_input", props: {
|
|
22
|
-
label: "Right-Aligned Add On With No Border",
|
|
23
|
-
add_on: { icon: "percent", alignment: 'right', border: false }
|
|
24
|
-
}) %>
|
|
25
|
+
}) %>
|
|
@@ -51,19 +51,19 @@ const TextInputAddOn = (props) => {
|
|
|
51
51
|
</div>
|
|
52
52
|
<div>
|
|
53
53
|
<TextInput
|
|
54
|
-
addOn={{ icon: 'percent', alignment: '
|
|
55
|
-
label="
|
|
56
|
-
onChange={
|
|
57
|
-
value={
|
|
54
|
+
addOn={{ icon: 'percent', alignment: 'right', border: false }}
|
|
55
|
+
label="Right-Aligned Add On With No Border"
|
|
56
|
+
onChange={handleUpdateThirdInput}
|
|
57
|
+
value={thirdInput}
|
|
58
58
|
{...props}
|
|
59
59
|
/>
|
|
60
60
|
</div>
|
|
61
61
|
<div>
|
|
62
62
|
<TextInput
|
|
63
|
-
addOn={{ icon: 'percent', alignment: '
|
|
64
|
-
label="
|
|
65
|
-
onChange={
|
|
66
|
-
value={
|
|
63
|
+
addOn={{ icon: 'percent', alignment: 'left', border: false }}
|
|
64
|
+
label="Left-Aligned Add On With No Border"
|
|
65
|
+
onChange={handleUpdateSecondInput}
|
|
66
|
+
value={secondInput}
|
|
67
67
|
{...props}
|
|
68
68
|
/>
|
|
69
69
|
</div>
|
|
@@ -11,17 +11,17 @@ import Title from '../pb_title/_title'
|
|
|
11
11
|
|
|
12
12
|
type TitleCountProps = {
|
|
13
13
|
align: "center" | "left" | "right",
|
|
14
|
-
aria?:
|
|
14
|
+
aria?: { [key: string]: string },
|
|
15
15
|
className?: string,
|
|
16
|
-
count?:
|
|
16
|
+
count?: number,
|
|
17
17
|
dark?: boolean,
|
|
18
|
-
data?:
|
|
18
|
+
data?: { [key: string]: string },
|
|
19
19
|
id?: string,
|
|
20
20
|
title?: string,
|
|
21
21
|
size?: "lg" | "sm",
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const TitleCount = (props: TitleCountProps) => {
|
|
24
|
+
const TitleCount = (props: TitleCountProps): React.ReactElement => {
|
|
25
25
|
const {
|
|
26
26
|
align = 'left',
|
|
27
27
|
aria = {},
|
|
@@ -61,7 +61,9 @@ const TitleCount = (props: TitleCountProps) => {
|
|
|
61
61
|
color="light"
|
|
62
62
|
dark={dark}
|
|
63
63
|
>
|
|
64
|
-
|
|
64
|
+
{count &&
|
|
65
|
+
formatCount
|
|
66
|
+
}
|
|
65
67
|
</Body>
|
|
66
68
|
|
|
67
69
|
</div>
|