playbook_ui 12.8.0.pre.alpha.PLAY625phonenumberdark301 → 12.8.0.pre.alpha.PLAY645typescriptprogresstep297
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_phone_number_input/_phone_number_input.scss +1 -62
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +14 -16
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.jsx +4 -6
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_initial_country.jsx +6 -8
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.jsx +1 -2
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.jsx +1 -2
- data/app/pb_kits/playbook/pb_progress_step/{_progress_step.jsx → _progress_step.tsx} +15 -7
- data/app/pb_kits/playbook/pb_progress_step/{_progress_step_item.jsx → _progress_step_item.tsx} +18 -11
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.jsx +2 -2
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tracker.jsx +1 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tracker_click_events.jsx +1 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.jsx +2 -2
- data/app/pb_kits/playbook/pb_progress_step/progress_step.test.js +109 -0
- data/lib/playbook/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 283def9e075a0980a2b2087d7e5e97b8c423077dede9ac0a233c92578235289e
|
4
|
+
data.tar.gz: 1e29b357dfb18242784e2603cda7b99faceb8894c7706fef39229dcb0bd4d701
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b631d82e34a76b54112e9e5967d79eff4d1d755122c8d6463118473eb98be618c19d83da7f62d8e6cbfe8b01c8a75d417a89af96ac8836246d8ab29f18961c5d
|
7
|
+
data.tar.gz: dfc3653b07313fdb9304a8ef3b914caded472bfcf5de3347a1d556874056029b88d8fbdb096f75a8ac973a359cfb48fc4b87c6c6c724a05dc533e02b14f00903
|
@@ -4,7 +4,6 @@ $transform-rotate-deg: 135deg;
|
|
4
4
|
$input-max-width: 284px;
|
5
5
|
$dropdown-min-width: 340px;
|
6
6
|
$flag-min-resolution: 192dpi;
|
7
|
-
$bg-dark-country-item: #e2eaf4;
|
8
7
|
|
9
8
|
.pb_phone_number_input {
|
10
9
|
input::placeholder {
|
@@ -48,7 +47,7 @@ $bg-dark-country-item: #e2eaf4;
|
|
48
47
|
background-color: $hover_light;
|
49
48
|
|
50
49
|
.iti__country-name, .iti__dial-code {
|
51
|
-
color: $primary
|
50
|
+
color: $primary
|
52
51
|
}
|
53
52
|
}
|
54
53
|
|
@@ -130,66 +129,6 @@ $bg-dark-country-item: #e2eaf4;
|
|
130
129
|
.iti__divider {
|
131
130
|
border-bottom: 1px solid $border_light;
|
132
131
|
}
|
133
|
-
|
134
|
-
&.dark {
|
135
|
-
.iti--allow-dropdown .iti__flag-container {
|
136
|
-
background-color: rgba($white, 0);
|
137
|
-
|
138
|
-
&:hover {
|
139
|
-
background-color: rgba($white, 0);
|
140
|
-
|
141
|
-
&+ .text_input {
|
142
|
-
background-color: rgba($white, 0.15);
|
143
|
-
}
|
144
|
-
|
145
|
-
.iti__selected-flag {
|
146
|
-
background-color: rgba($white, 0);
|
147
|
-
}
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
.iti__selected-flag {
|
152
|
-
background-color: rgba($white, 0);
|
153
|
-
color: $white;
|
154
|
-
}
|
155
|
-
|
156
|
-
.iti__country-list {
|
157
|
-
background-color: $bg_dark; //$card_dark
|
158
|
-
border: 1px solid $border_dark;
|
159
|
-
|
160
|
-
.iti__highlight {
|
161
|
-
background-color: $bg-dark-country-item;
|
162
|
-
}
|
163
|
-
}
|
164
|
-
|
165
|
-
.iti__divider {
|
166
|
-
border-bottom: 1px solid $border_dark;
|
167
|
-
}
|
168
|
-
|
169
|
-
.iti__arrow.iti__arrow--up::before {
|
170
|
-
color: $slate;
|
171
|
-
}
|
172
|
-
|
173
|
-
.iti__country.iti__highlight {
|
174
|
-
.iti__country-name {
|
175
|
-
color: $text_lt_default;
|
176
|
-
}
|
177
|
-
|
178
|
-
.iti__dial-code {
|
179
|
-
color: $text_lt_light;
|
180
|
-
}
|
181
|
-
|
182
|
-
&.iti__active::after {
|
183
|
-
color: $text_lt_default;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
.dropdown_open {
|
188
|
-
.text_input {
|
189
|
-
background-color: rgba($white, 0.025) !important;
|
190
|
-
}
|
191
|
-
}
|
192
|
-
}
|
193
132
|
|
194
133
|
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: $flag-min-resolution) {
|
195
134
|
.iti__flag {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* @flow */
|
1
2
|
import React, { useEffect, useRef, useState } from 'react'
|
2
3
|
import classnames from 'classnames'
|
3
4
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
@@ -14,20 +15,19 @@ declare global {
|
|
14
15
|
}
|
15
16
|
|
16
17
|
type PhoneNumberInputProps = {
|
17
|
-
aria?: { [key: string]: string }
|
18
|
-
className?: string
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
value?: string,
|
18
|
+
aria?: { [key: string]: string }
|
19
|
+
className?: string
|
20
|
+
data?: { [key: string]: string }
|
21
|
+
disabled?: boolean
|
22
|
+
id?: string
|
23
|
+
initialCountry?: string
|
24
|
+
isValid?: (valid: boolean) => void
|
25
|
+
label?: string
|
26
|
+
name?: string
|
27
|
+
onChange?: (e: React.FormEvent<HTMLInputElement>) => void
|
28
|
+
onlyCountries: string[]
|
29
|
+
preferredCountries?: string[]
|
30
|
+
value?: string
|
31
31
|
}
|
32
32
|
|
33
33
|
enum ValidationError {
|
@@ -58,7 +58,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps) => {
|
|
58
58
|
const {
|
59
59
|
aria = {},
|
60
60
|
className,
|
61
|
-
dark = false,
|
62
61
|
data = {},
|
63
62
|
disabled = false,
|
64
63
|
id = "",
|
@@ -155,7 +154,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps) => {
|
|
155
154
|
<div {...ariaProps} {...dataProps} className={classes}>
|
156
155
|
<TextInput
|
157
156
|
className={dropDownIsOpen ? 'dropdown_open' : ''}
|
158
|
-
dark={dark}
|
159
157
|
disabled={disabled}
|
160
158
|
error={error}
|
161
159
|
id={id}
|
@@ -1,12 +1,10 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { PhoneNumberInput } from '../../'
|
3
3
|
|
4
|
-
const PhoneNumberInputDefault = (
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
{...props} />
|
9
|
-
</>
|
4
|
+
const PhoneNumberInputDefault = () => (
|
5
|
+
<>
|
6
|
+
<PhoneNumberInput id='default' />
|
7
|
+
</>
|
10
8
|
)
|
11
9
|
|
12
10
|
export default PhoneNumberInputDefault
|
data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_initial_country.jsx
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { PhoneNumberInput } from '../../'
|
3
3
|
|
4
|
-
const PhoneNumberInitialCountry = (
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
/>
|
11
|
-
</>
|
4
|
+
const PhoneNumberInitialCountry = () => (
|
5
|
+
<>
|
6
|
+
<PhoneNumberInput id='initial'
|
7
|
+
initialCountry='br'
|
8
|
+
/>
|
9
|
+
</>
|
12
10
|
)
|
13
11
|
|
14
12
|
export default PhoneNumberInitialCountry
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { PhoneNumberInput } from '../../'
|
3
3
|
|
4
|
-
const PhoneNumberInputOnlyCountries = (
|
4
|
+
const PhoneNumberInputOnlyCountries = () => (
|
5
5
|
<>
|
6
6
|
<PhoneNumberInput
|
7
7
|
id='only'
|
8
8
|
onlyCountries={['us', 'br']}
|
9
|
-
{...props}
|
10
9
|
/>
|
11
10
|
</>
|
12
11
|
)
|
data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.jsx
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { PhoneNumberInput } from '../../'
|
3
3
|
|
4
|
-
const PhoneNumberInputPreferredCountries = (
|
4
|
+
const PhoneNumberInputPreferredCountries = () => (
|
5
5
|
<>
|
6
6
|
<PhoneNumberInput
|
7
7
|
id='preferred'
|
8
8
|
preferredCountries={['us', 'br', 'ph', 'gb']}
|
9
|
-
{...props}
|
10
9
|
/>
|
11
10
|
</>
|
12
11
|
)
|
@@ -1,15 +1,14 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
|
-
import { buildCss } from '../utilities/props'
|
3
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
4
|
import { globalProps } from '../utilities/globalProps'
|
7
5
|
|
8
6
|
type ProgressStepProps = {
|
7
|
+
aria?: { [key: string]: string },
|
9
8
|
className?: string,
|
10
|
-
data?: string,
|
9
|
+
data?: { [key: string]: string },
|
11
10
|
id?: string,
|
12
|
-
children?:
|
11
|
+
children?: React.ReactChild[] | React.ReactChild,
|
13
12
|
orientation?: "horizontal" | "vertical",
|
14
13
|
icon?: boolean,
|
15
14
|
showIcon?: boolean,
|
@@ -17,16 +16,21 @@ type ProgressStepProps = {
|
|
17
16
|
color?: string,
|
18
17
|
}
|
19
18
|
|
20
|
-
const ProgressStep = (props: ProgressStepProps) => {
|
19
|
+
const ProgressStep = (props: ProgressStepProps): React.ReactElement => {
|
21
20
|
const {
|
21
|
+
aria = {},
|
22
22
|
className,
|
23
23
|
children,
|
24
24
|
color,
|
25
|
+
data = {},
|
25
26
|
orientation = 'horizontal',
|
26
27
|
icon = false,
|
27
28
|
showIcon = false,
|
28
29
|
variant,
|
29
30
|
} = props
|
31
|
+
|
32
|
+
const ariaProps = buildAriaProps(aria)
|
33
|
+
const dataProps = buildDataProps(data)
|
30
34
|
const iconStyle = icon === true || showIcon === true ? 'icon' : ''
|
31
35
|
const progressStepCss = buildCss(
|
32
36
|
'pb_progress_step_kit',
|
@@ -37,7 +41,11 @@ const ProgressStep = (props: ProgressStepProps) => {
|
|
37
41
|
)
|
38
42
|
|
39
43
|
return (
|
40
|
-
<ul
|
44
|
+
<ul
|
45
|
+
{...ariaProps}
|
46
|
+
{...dataProps}
|
47
|
+
className={classnames(progressStepCss, globalProps(props), className)}
|
48
|
+
>
|
41
49
|
{children}
|
42
50
|
</ul>
|
43
51
|
)
|
data/app/pb_kits/playbook/pb_progress_step/{_progress_step_item.jsx → _progress_step_item.tsx}
RENAMED
@@ -1,29 +1,35 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
|
6
|
-
import { buildCss } from '../utilities/props'
|
4
|
+
import { buildCss, buildDataProps } from '../utilities/props'
|
7
5
|
|
8
6
|
import Icon from '../pb_icon/_icon'
|
9
7
|
|
10
8
|
type ProgressStepItemProps = {
|
11
9
|
className?: string,
|
10
|
+
data?: { [key: string]: string },
|
12
11
|
status?: "complete" | "active" | "inactive" | "hidden",
|
13
|
-
children?: React.
|
12
|
+
children?: React.ReactChild[] | React.ReactChild,
|
14
13
|
icon?: string,
|
15
14
|
}
|
16
15
|
|
17
|
-
const ProgressStepItem = ({
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
const ProgressStepItem = (props: ProgressStepItemProps): React.ReactElement => {
|
17
|
+
const {
|
18
|
+
className,
|
19
|
+
data = {},
|
20
|
+
status = 'inactive',
|
21
|
+
children,
|
22
|
+
icon = 'check',
|
23
|
+
} = props
|
24
|
+
|
23
25
|
const progressStepItem = buildCss('pb_progress_step_item', status)
|
26
|
+
const dataProps = buildDataProps(data)
|
24
27
|
|
25
28
|
return (
|
26
|
-
<li
|
29
|
+
<li
|
30
|
+
{...dataProps}
|
31
|
+
className={classnames(progressStepItem, className)}
|
32
|
+
>
|
27
33
|
<div className="box">
|
28
34
|
<div className="circle">
|
29
35
|
<Icon icon={icon} />
|
@@ -33,4 +39,5 @@ const ProgressStepItem = ({
|
|
33
39
|
</li>
|
34
40
|
)
|
35
41
|
}
|
42
|
+
|
36
43
|
export default ProgressStepItem
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
|
3
|
-
import ProgressStep from '../_progress_step.
|
4
|
-
import ProgressStepItem from '../_progress_step_item.
|
3
|
+
import ProgressStep from '../_progress_step.tsx'
|
4
|
+
import ProgressStepItem from '../_progress_step_item.tsx'
|
5
5
|
|
6
6
|
const ProgressStepDefault = (props) => (
|
7
7
|
<div>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
|
3
|
-
import ProgressStep from '../_progress_step.
|
4
|
-
import ProgressStepItem from '../_progress_step_item.
|
3
|
+
import ProgressStep from '../_progress_step.tsx'
|
4
|
+
import ProgressStepItem from '../_progress_step_item.tsx'
|
5
5
|
|
6
6
|
const ProgressStepVertical = (props) => (
|
7
7
|
<div>
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import ProgressStep from './_progress_step.tsx'
|
5
|
+
import ProgressStepItem from './_progress_step_item.tsx'
|
6
|
+
|
7
|
+
const testId = 'progressStepId'
|
8
|
+
const step1Id = 'step1Id'
|
9
|
+
const step2Id = 'step2Id'
|
10
|
+
const step3Id = 'step3Id'
|
11
|
+
|
12
|
+
const ProgressStepTest = () => {
|
13
|
+
return (
|
14
|
+
<>
|
15
|
+
<ProgressStep
|
16
|
+
aria={{ label: testId }}
|
17
|
+
className={'custom-class'}
|
18
|
+
data={{ testid: testId }}
|
19
|
+
>
|
20
|
+
<ProgressStepItem
|
21
|
+
data={{ testid: step1Id }}
|
22
|
+
status="complete"
|
23
|
+
>
|
24
|
+
{'Step 1'}
|
25
|
+
</ProgressStepItem>
|
26
|
+
<ProgressStepItem
|
27
|
+
data={{ testid: step2Id }}
|
28
|
+
status="active"
|
29
|
+
>
|
30
|
+
{'Step 2'}
|
31
|
+
</ProgressStepItem>
|
32
|
+
<ProgressStepItem
|
33
|
+
data={{ testid: step3Id }}
|
34
|
+
status="inactive"
|
35
|
+
>
|
36
|
+
{'Step 3'}
|
37
|
+
</ProgressStepItem>
|
38
|
+
</ProgressStep>
|
39
|
+
</>
|
40
|
+
)
|
41
|
+
}
|
42
|
+
|
43
|
+
test('should render custom class and data', () => {
|
44
|
+
render(<ProgressStepTest/>)
|
45
|
+
|
46
|
+
const kit = screen.getByTestId(testId)
|
47
|
+
expect(kit).toHaveClass('custom-class')
|
48
|
+
})
|
49
|
+
|
50
|
+
test('should render aria-label', () => {
|
51
|
+
render(<ProgressStepTest />)
|
52
|
+
|
53
|
+
const kit = screen.getByTestId(testId)
|
54
|
+
expect(kit).toHaveAttribute('aria-label', testId)
|
55
|
+
})
|
56
|
+
|
57
|
+
test('should render the horizontal variant', () => {
|
58
|
+
render(<ProgressStepTest />)
|
59
|
+
|
60
|
+
const kit = screen.getByTestId(testId)
|
61
|
+
expect(kit).toHaveClass('pb_progress_step_kit_horizontal')
|
62
|
+
})
|
63
|
+
|
64
|
+
test('should render the vertical variant', () => {
|
65
|
+
render(
|
66
|
+
<ProgressStep
|
67
|
+
aria={{ label: testId }}
|
68
|
+
data={{ testid: testId }}
|
69
|
+
orientation="vertical"
|
70
|
+
>
|
71
|
+
<ProgressStepItem status="complete">{'Step 1'}</ProgressStepItem>
|
72
|
+
<ProgressStepItem status="active">{'Step 2'}</ProgressStepItem>
|
73
|
+
<ProgressStepItem status="inactive">{'Step 3'}</ProgressStepItem>
|
74
|
+
</ProgressStep>
|
75
|
+
)
|
76
|
+
|
77
|
+
const kit = screen.getByTestId(testId)
|
78
|
+
expect(kit).toHaveClass('pb_progress_step_kit_vertical')
|
79
|
+
})
|
80
|
+
|
81
|
+
test('should render the tracker variant', () => {
|
82
|
+
render(
|
83
|
+
<ProgressStep
|
84
|
+
aria={{ label: testId }}
|
85
|
+
data={{ testid: testId }}
|
86
|
+
variant="tracker"
|
87
|
+
>
|
88
|
+
<ProgressStepItem status="complete">{'Step 1'}</ProgressStepItem>
|
89
|
+
<ProgressStepItem status="active">{'Step 2'}</ProgressStepItem>
|
90
|
+
<ProgressStepItem status="inactive">{'Step 3'}</ProgressStepItem>
|
91
|
+
</ProgressStep>
|
92
|
+
)
|
93
|
+
|
94
|
+
const kit = screen.getByTestId(testId)
|
95
|
+
expect(kit).toHaveClass('pb_progress_step_kit_horizontal_tracker')
|
96
|
+
})
|
97
|
+
|
98
|
+
|
99
|
+
test('should render the children elements', () => {
|
100
|
+
render(<ProgressStepTest />)
|
101
|
+
|
102
|
+
const step1Kit = screen.getByTestId(step1Id)
|
103
|
+
const step2Kit = screen.getByTestId(step2Id)
|
104
|
+
const step3Kit = screen.getByTestId(step3Id)
|
105
|
+
|
106
|
+
expect(step1Kit).toHaveClass('pb_progress_step_item_complete')
|
107
|
+
expect(step2Kit).toHaveClass('pb_progress_step_item_active')
|
108
|
+
expect(step3Kit).toHaveClass('pb_progress_step_item_inactive')
|
109
|
+
})
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.8.0.pre.alpha.
|
4
|
+
version: 12.8.0.pre.alpha.PLAY645typescriptprogresstep297
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -1666,9 +1666,9 @@ files:
|
|
1666
1666
|
- app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb
|
1667
1667
|
- app/pb_kits/playbook/pb_progress_simple/progress_simple.rb
|
1668
1668
|
- app/pb_kits/playbook/pb_progress_simple/progress_simple.test.js
|
1669
|
-
- app/pb_kits/playbook/pb_progress_step/_progress_step.jsx
|
1670
1669
|
- app/pb_kits/playbook/pb_progress_step/_progress_step.scss
|
1671
|
-
- app/pb_kits/playbook/pb_progress_step/
|
1670
|
+
- app/pb_kits/playbook/pb_progress_step/_progress_step.tsx
|
1671
|
+
- app/pb_kits/playbook/pb_progress_step/_progress_step_item.tsx
|
1672
1672
|
- app/pb_kits/playbook/pb_progress_step/docs/_description.md
|
1673
1673
|
- app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.html.erb
|
1674
1674
|
- app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.html.erb
|
@@ -1683,6 +1683,7 @@ files:
|
|
1683
1683
|
- app/pb_kits/playbook/pb_progress_step/docs/index.js
|
1684
1684
|
- app/pb_kits/playbook/pb_progress_step/progress_step.html.erb
|
1685
1685
|
- app/pb_kits/playbook/pb_progress_step/progress_step.rb
|
1686
|
+
- app/pb_kits/playbook/pb_progress_step/progress_step.test.js
|
1686
1687
|
- app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb
|
1687
1688
|
- app/pb_kits/playbook/pb_progress_step/progress_step_item.rb
|
1688
1689
|
- app/pb_kits/playbook/pb_radio/_radio.scss
|