playbook_ui 12.5.0.pre.alpha.datepicker1 → 12.5.0.pre.alpha.phonerails1
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_date_picker/_date_picker.scss +6 -9
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +45 -62
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +61 -47
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.html.erb +1 -15
- data/lib/playbook/version.rb +1 -1
- metadata +1 -39
- data/app/pb_kits/playbook/pb_awesome/_awesome.scss +0 -3
- data/app/pb_kits/playbook/pb_awesome/_awesome.tsx +0 -41
- data/app/pb_kits/playbook/pb_awesome/awesome.html.erb +0 -7
- data/app/pb_kits/playbook/pb_awesome/awesome.rb +0 -8
- data/app/pb_kits/playbook/pb_awesome/awesome.test.jsx +0 -17
- data/app/pb_kits/playbook/pb_awesome/docs/_awesome_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_awesome/docs/_awesome_default.jsx +0 -12
- data/app/pb_kits/playbook/pb_awesome/docs/example.yml +0 -9
- data/app/pb_kits/playbook/pb_awesome/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_cool/_cool.scss +0 -3
- data/app/pb_kits/playbook/pb_cool/_cool.tsx +0 -41
- data/app/pb_kits/playbook/pb_cool/cool.html.erb +0 -7
- data/app/pb_kits/playbook/pb_cool/cool.rb +0 -8
- data/app/pb_kits/playbook/pb_cool/cool.test.jsx +0 -17
- data/app/pb_kits/playbook/pb_cool/docs/_cool_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_cool/docs/_cool_default.jsx +0 -12
- data/app/pb_kits/playbook/pb_cool/docs/example.yml +0 -9
- data/app/pb_kits/playbook/pb_cool/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_coolness/_coolness.scss +0 -3
- data/app/pb_kits/playbook/pb_coolness/_coolness.tsx +0 -41
- data/app/pb_kits/playbook/pb_coolness/coolness.html.erb +0 -7
- data/app/pb_kits/playbook/pb_coolness/coolness.rb +0 -8
- data/app/pb_kits/playbook/pb_coolness/coolness.test.jsx +0 -17
- data/app/pb_kits/playbook/pb_coolness/docs/_coolness_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_coolness/docs/_coolness_default.jsx +0 -12
- data/app/pb_kits/playbook/pb_coolness/docs/example.yml +0 -9
- data/app/pb_kits/playbook/pb_coolness/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +0 -68
- data/app/pb_kits/playbook/pb_phone_number_input/PhoneNumberHelper.js +0 -12
- data/app/pb_kits/playbook/pb_test/_test.scss +0 -3
- data/app/pb_kits/playbook/pb_test/_test.tsx +0 -41
- data/app/pb_kits/playbook/pb_test/docs/_test_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_test/docs/_test_default.jsx +0 -12
- data/app/pb_kits/playbook/pb_test/docs/example.yml +0 -9
- data/app/pb_kits/playbook/pb_test/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_test/test.html.erb +0 -7
- data/app/pb_kits/playbook/pb_test/test.rb +0 -8
- data/app/pb_kits/playbook/pb_test/test.test.jsx +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e827c4077969ef2258c6c650173ef5c8227d81aca0a0201c19ae0e136de1decb
|
4
|
+
data.tar.gz: aec0d42668e214f8a32b4220704c76af66a2b55a43fbeb0efb28eb6832c45d9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed4ab9a7d46404031c54b2c4e22731d4260d00d2db11af3b280b03f92df607f1afd8a6f3b68d6b52aa6e8866605c5c7fa85c4598a4323b2dfbc6a9d5490ff196
|
7
|
+
data.tar.gz: 23d61876cc9d04ea7b378b9ecc896b5d4f0a8d04b336a2b3f0fbf81c24189cc8ac86cc2f0eb65b3760d2da51c9699798a8dbe38c20a98744c3076b6f450706ab
|
@@ -5,7 +5,8 @@
|
|
5
5
|
@import "./sass_partials/inline_styles";
|
6
6
|
@import "./sass_partials/month_and_year_styles";
|
7
7
|
@import "./sass_partials/time_selection_styles";
|
8
|
-
|
8
|
+
|
9
|
+
|
9
10
|
|
10
11
|
[class^=pb_date_picker_kit] {
|
11
12
|
.input_wrapper {
|
@@ -19,10 +20,8 @@
|
|
19
20
|
@import "./sass_partials/calendar_input_icon";
|
20
21
|
}
|
21
22
|
|
22
|
-
&:focus,
|
23
|
-
|
24
|
-
div.cal_icon_wrapper,
|
25
|
-
input.date_picker_input {
|
23
|
+
&:focus, :focus-within {
|
24
|
+
div.cal_icon_wrapper, input.text_input{
|
26
25
|
@include transition_default;
|
27
26
|
border-color: $primary;
|
28
27
|
}
|
@@ -34,20 +33,18 @@
|
|
34
33
|
@import "./sass_partials/header_styles";
|
35
34
|
@import "./sass_partials/overrides";
|
36
35
|
|
37
|
-
.
|
36
|
+
.text_input.flatpickr-input {
|
38
37
|
text-overflow: ellipsis;
|
39
38
|
padding-right: $space_xl + 10 !important;
|
40
39
|
}
|
41
|
-
|
42
40
|
// Calendar Shadow and Border
|
43
41
|
.flatpickr-calendar {
|
44
42
|
box-shadow: $shadow_deeper;
|
45
43
|
border: 1px solid $border_light;
|
46
44
|
}
|
47
|
-
|
48
45
|
// Hide Caret
|
49
46
|
&:before,
|
50
47
|
&:after {
|
51
48
|
content: none;
|
52
49
|
}
|
53
|
-
}
|
50
|
+
}
|
@@ -5,13 +5,13 @@ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
5
5
|
import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
|
6
6
|
|
7
7
|
import datePickerHelper from './date_picker_helper'
|
8
|
+
|
8
9
|
import Icon from '../pb_icon/_icon'
|
9
|
-
import
|
10
|
-
import Body from '../pb_body/_body'
|
10
|
+
import TextInput from '../pb_text_input/_text_input'
|
11
11
|
|
12
12
|
type DatePickerProps = {
|
13
13
|
allowInput?: boolean,
|
14
|
-
aria?: {
|
14
|
+
aria?: {[key: string]: string},
|
15
15
|
className?: string,
|
16
16
|
dark?: boolean,
|
17
17
|
data?: { [key: string]: string },
|
@@ -27,15 +27,15 @@ type DatePickerProps = {
|
|
27
27
|
hideLabel?: boolean,
|
28
28
|
id?: string,
|
29
29
|
inLine?: boolean,
|
30
|
-
inputAria?: {
|
31
|
-
inputData?: {
|
32
|
-
inputOnChange?: (
|
30
|
+
inputAria?: {[key: string]: string},
|
31
|
+
inputData?: {[key: string]: string},
|
32
|
+
inputOnChange?: (arg: string) => void,
|
33
33
|
inputValue?: any,
|
34
34
|
label?: string,
|
35
35
|
maxDate: string,
|
36
36
|
minDate: string,
|
37
37
|
name: string,
|
38
|
-
pickerId?: string,
|
38
|
+
pickerId?: ArrayLike<Node> | Node | string,
|
39
39
|
placeholder?: string,
|
40
40
|
positionElement?: HTMLElement | null,
|
41
41
|
scrollContainer?: string,
|
@@ -51,7 +51,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
51
51
|
if (props.plugins) deprecatedProps('Date Picker', ['plugins'])
|
52
52
|
|
53
53
|
const {
|
54
|
-
allowInput =
|
54
|
+
allowInput = false,
|
55
55
|
aria = {},
|
56
56
|
className,
|
57
57
|
dark = false,
|
@@ -68,8 +68,8 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
68
68
|
hideLabel = false,
|
69
69
|
id,
|
70
70
|
inLine = false,
|
71
|
-
inputAria
|
72
|
-
inputData
|
71
|
+
inputAria,
|
72
|
+
inputData,
|
73
73
|
inputOnChange,
|
74
74
|
inputValue,
|
75
75
|
label = 'Date Picker',
|
@@ -87,14 +87,11 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
87
87
|
selectionType = '',
|
88
88
|
showTimezone = false,
|
89
89
|
staticPosition = true,
|
90
|
-
yearRange = [1900, 2100],
|
90
|
+
yearRange = [ 1900, 2100 ],
|
91
91
|
} = props
|
92
92
|
|
93
93
|
const ariaProps = buildAriaProps(aria)
|
94
94
|
const dataProps = buildDataProps(data)
|
95
|
-
const inputAriaProps = buildAriaProps(inputAria)
|
96
|
-
const inputDataProps = buildDataProps(inputData)
|
97
|
-
|
98
95
|
const classes = classnames(
|
99
96
|
buildCss('pb_date_picker_kit'),
|
100
97
|
globalProps(props),
|
@@ -131,13 +128,13 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
131
128
|
|
132
129
|
const iconWrapperClass = () => {
|
133
130
|
let base = 'cal_icon_wrapper'
|
134
|
-
if (dark)
|
131
|
+
if (dark){
|
135
132
|
base += ' dark'
|
136
133
|
}
|
137
|
-
if (hideLabel)
|
134
|
+
if (hideLabel){
|
138
135
|
base += ' no_label_shift'
|
139
136
|
}
|
140
|
-
if (error)
|
137
|
+
if (error){
|
141
138
|
base += ' error'
|
142
139
|
}
|
143
140
|
return base
|
@@ -145,75 +142,61 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
145
142
|
|
146
143
|
return (
|
147
144
|
<div
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
145
|
+
{...ariaProps}
|
146
|
+
{...dataProps}
|
147
|
+
className={classes}
|
148
|
+
id={id}
|
152
149
|
>
|
153
|
-
<div
|
154
|
-
|
155
|
-
|
156
|
-
className="input_wrapper">
|
157
|
-
|
158
|
-
<Caption
|
159
|
-
className="pb_date_picker_kit_label"
|
160
|
-
text={hideLabel ? null : label}
|
161
|
-
/>
|
162
|
-
|
163
|
-
<div className="date_picker_input_wrapper">
|
164
|
-
<input
|
150
|
+
<div className="input_wrapper">
|
151
|
+
<TextInput
|
152
|
+
aria={inputAria}
|
165
153
|
autoComplete="off"
|
166
|
-
|
154
|
+
dark={dark}
|
155
|
+
data={inputData}
|
167
156
|
disabled={disableInput}
|
157
|
+
error={error}
|
168
158
|
id={pickerId}
|
159
|
+
label={hideLabel ? null : label}
|
169
160
|
name={name}
|
170
161
|
onChange={inputOnChange}
|
171
162
|
placeholder={placeholder}
|
172
163
|
value={inputValue}
|
173
|
-
|
174
|
-
|
175
|
-
{error && <Body
|
176
|
-
status="negative"
|
177
|
-
text={error}
|
178
|
-
variant={null}
|
179
|
-
/>
|
180
|
-
}
|
181
|
-
</div>
|
164
|
+
/>
|
182
165
|
|
183
|
-
{!hideIcon &&
|
166
|
+
{ !hideIcon &&
|
184
167
|
<div
|
185
|
-
|
186
|
-
|
168
|
+
className={iconWrapperClass()}
|
169
|
+
id={`cal-icon-${pickerId}`}
|
187
170
|
>
|
188
|
-
|
171
|
+
<Icon
|
189
172
|
className="cal_icon"
|
190
173
|
icon="calendar-alt"
|
191
|
-
|
192
|
-
|
174
|
+
/>
|
175
|
+
</div>
|
193
176
|
}
|
194
177
|
|
195
|
-
{hideIcon && inLine ?
|
178
|
+
{ hideIcon && inLine ?
|
196
179
|
<div>
|
197
180
|
<div
|
198
|
-
|
199
|
-
|
181
|
+
className={iconWrapperClass()}
|
182
|
+
id={`${pickerId}-icon-plus`}
|
200
183
|
>
|
201
184
|
<Icon
|
202
|
-
|
203
|
-
|
185
|
+
className="date-picker-plus-icon"
|
186
|
+
icon="plus"
|
204
187
|
/>
|
205
188
|
</div>
|
206
189
|
<div
|
207
|
-
|
208
|
-
|
190
|
+
className={iconWrapperClass()}
|
191
|
+
id={`${pickerId}-angle-down`}
|
209
192
|
>
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
193
|
+
<Icon
|
194
|
+
className="angle_down_icon"
|
195
|
+
icon="angle-down"
|
196
|
+
/>
|
214
197
|
</div>
|
215
|
-
</div>
|
216
|
-
|
198
|
+
</div>
|
199
|
+
: null }
|
217
200
|
</div>
|
218
201
|
</div>
|
219
202
|
)
|
@@ -4,7 +4,7 @@ module Playbook
|
|
4
4
|
module PbDatePicker
|
5
5
|
class DatePicker < Playbook::KitBase
|
6
6
|
prop :allow_input, type: Playbook::Props::Boolean,
|
7
|
-
default:
|
7
|
+
default: false
|
8
8
|
prop :dark, type: Playbook::Props::Boolean,
|
9
9
|
default: false
|
10
10
|
prop :default_date, type: Playbook::Props::String,
|
@@ -112,7 +112,6 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
112
112
|
// ===========================================================
|
113
113
|
|
114
114
|
flatpickr(`#${pickerId}`, {
|
115
|
-
allowInput,
|
116
115
|
closeOnSelect,
|
117
116
|
disableMobile: true,
|
118
117
|
dateFormat: getDateFormat(),
|
@@ -1,32 +1,32 @@
|
|
1
1
|
/* @flow */
|
2
|
-
import React, { useEffect, useRef, useState } from
|
3
|
-
import classnames from
|
4
|
-
import { buildAriaProps, buildCss, buildDataProps } from
|
5
|
-
import { globalProps } from
|
6
|
-
import intlTelInput from
|
7
|
-
import
|
8
|
-
import TextInput from
|
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
9
|
|
10
10
|
declare global {
|
11
11
|
interface Window {
|
12
|
-
intlTelInputGlobals: any
|
12
|
+
intlTelInputGlobals: any
|
13
13
|
}
|
14
14
|
}
|
15
15
|
|
16
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
|
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
30
|
}
|
31
31
|
|
32
32
|
enum ValidationError {
|
@@ -35,17 +35,20 @@ enum ValidationError {
|
|
35
35
|
}
|
36
36
|
|
37
37
|
const formatToGlobalCountryName = (countryName: string) => {
|
38
|
-
return countryName.split(
|
38
|
+
return countryName.split("(")[0].trim()
|
39
39
|
}
|
40
40
|
|
41
41
|
const formatAllCountries = () => {
|
42
42
|
let countryData = window.intlTelInputGlobals.getCountryData()
|
43
|
+
|
43
44
|
for (let i = 0; i < countryData.length; i++) {
|
44
45
|
let country = countryData[i]
|
45
46
|
country.name = formatToGlobalCountryName(country.name)
|
46
47
|
}
|
47
48
|
}
|
48
49
|
|
50
|
+
formatAllCountries()
|
51
|
+
|
49
52
|
const containOnlyNumbers = (value: string) => {
|
50
53
|
return /^(\++)*(\d+)$/.test(value)
|
51
54
|
}
|
@@ -56,25 +59,33 @@ const PhoneNumberInput = (props: PhoneNumberInputProps) => {
|
|
56
59
|
className,
|
57
60
|
data = {},
|
58
61
|
disabled = false,
|
59
|
-
id =
|
60
|
-
initialCountry =
|
61
|
-
isValid = () => {
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
id = "",
|
63
|
+
initialCountry = "",
|
64
|
+
isValid = () => {
|
65
|
+
void 0
|
66
|
+
},
|
67
|
+
label = "",
|
68
|
+
name = "",
|
69
|
+
onChange = () => {
|
70
|
+
void 0
|
71
|
+
},
|
65
72
|
onlyCountries = [],
|
66
73
|
preferredCountries = [],
|
67
|
-
value =
|
74
|
+
value = "",
|
68
75
|
} = props
|
69
76
|
|
70
77
|
const ariaProps = buildAriaProps(aria)
|
71
78
|
const dataProps = buildDataProps(data)
|
72
|
-
const classes = classnames(
|
79
|
+
const classes = classnames(
|
80
|
+
buildCss("pb_phone_number_input"),
|
81
|
+
globalProps(props),
|
82
|
+
className
|
83
|
+
)
|
73
84
|
|
74
85
|
const inputRef = useRef<HTMLInputElement>()
|
75
86
|
const [inputValue, setInputValue] = useState(value)
|
76
87
|
const [itiInit, setItiInit] = useState<any>()
|
77
|
-
const [error, setError] = useState(
|
88
|
+
const [error, setError] = useState("")
|
78
89
|
|
79
90
|
const validateTooLongNumber = (itiInit: any) => {
|
80
91
|
const error = itiInit.getValidationError()
|
@@ -83,7 +94,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps) => {
|
|
83
94
|
const countryName = itiInit.getSelectedCountryData().name
|
84
95
|
setError(`Invalid ${countryName} phone number (too long)`)
|
85
96
|
} else {
|
86
|
-
setError(
|
97
|
+
setError("")
|
87
98
|
}
|
88
99
|
}
|
89
100
|
|
@@ -98,7 +109,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps) => {
|
|
98
109
|
|
99
110
|
const validateOnlyNumbers = () => {
|
100
111
|
if (inputValue && !containOnlyNumbers(inputValue)) {
|
101
|
-
setError(
|
112
|
+
setError("Invalid phone number. Enter numbers only.")
|
102
113
|
}
|
103
114
|
}
|
104
115
|
|
@@ -114,29 +125,32 @@ const PhoneNumberInput = (props: PhoneNumberInputProps) => {
|
|
114
125
|
isValid(itiInit.isValidNumber())
|
115
126
|
}
|
116
127
|
|
128
|
+
// Separating Concerns as React Docs Recommend
|
129
|
+
// This also Fixes things for our react_component rendering on the Rails Side
|
117
130
|
useEffect(() => {
|
118
131
|
formatAllCountries()
|
132
|
+
}, [])
|
119
133
|
|
134
|
+
useEffect(() => {
|
120
135
|
const telInputInit = new intlTelInput(inputRef.current, {
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
136
|
+
utilsScript:
|
137
|
+
"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.19/js/utils.js",
|
138
|
+
separateDialCode: true,
|
139
|
+
preferredCountries,
|
140
|
+
allowDropdown: !disabled,
|
141
|
+
initialCountry,
|
142
|
+
onlyCountries,
|
143
|
+
})
|
144
|
+
|
145
|
+
inputRef.current.addEventListener("countrychange", () =>
|
146
|
+
validateTooLongNumber(telInputInit)
|
128
147
|
)
|
129
|
-
|
130
|
-
inputRef.current.addEventListener("countrychange", () => validateTooLongNumber(telInputInit))
|
148
|
+
|
131
149
|
setItiInit(telInputInit)
|
132
150
|
}, [])
|
133
151
|
|
134
152
|
return (
|
135
|
-
<div
|
136
|
-
{...ariaProps}
|
137
|
-
{...dataProps}
|
138
|
-
className={classes}
|
139
|
-
>
|
153
|
+
<div {...ariaProps} {...dataProps} className={classes}>
|
140
154
|
<TextInput
|
141
155
|
disabled={disabled}
|
142
156
|
error={error}
|
@@ -7,4 +7,7 @@ examples:
|
|
7
7
|
- phone_number_input_only_countries: Limited Countries
|
8
8
|
|
9
9
|
rails:
|
10
|
-
- phone_number_input_default: Default
|
10
|
+
- phone_number_input_default: Default
|
11
|
+
- phone_number_input_preferred_countries: Preferred Countries
|
12
|
+
- phone_number_input_initial_country: Initial Country
|
13
|
+
- phone_number_input_only_countries: Limited Countries
|
@@ -1,15 +1 @@
|
|
1
|
-
<%= react_component("PhoneNumberInput", object.phone_number_input_options) %>
|
2
|
-
|
3
|
-
<script>
|
4
|
-
const formatToGlobalCountryName = () => {
|
5
|
-
return countryName.split('(')[0].trim()
|
6
|
-
}
|
7
|
-
|
8
|
-
const formatAllCountries = () => {
|
9
|
-
let countryData = window.intlTelInputGlobals.getCountryData()
|
10
|
-
for (let i = 0; i < countryData.length; i++) {
|
11
|
-
let country = countryData[i]
|
12
|
-
country.name = formatToGlobalCountryName(country.name)
|
13
|
-
}
|
14
|
-
}
|
15
|
-
</script>
|
1
|
+
<%= react_component("PhoneNumberInput", object.phone_number_input_options) %>
|
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.5.0.pre.alpha.
|
4
|
+
version: 12.5.0.pre.alpha.phonerails1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -332,15 +332,6 @@ files:
|
|
332
332
|
- app/pb_kits/playbook/pb_avatar_action_button/docs/example.yml
|
333
333
|
- app/pb_kits/playbook/pb_avatar_action_button/docs/index.js
|
334
334
|
- app/pb_kits/playbook/pb_avatar_action_button/pb_avatar_action_button.test.js
|
335
|
-
- app/pb_kits/playbook/pb_awesome/_awesome.scss
|
336
|
-
- app/pb_kits/playbook/pb_awesome/_awesome.tsx
|
337
|
-
- app/pb_kits/playbook/pb_awesome/awesome.html.erb
|
338
|
-
- app/pb_kits/playbook/pb_awesome/awesome.rb
|
339
|
-
- app/pb_kits/playbook/pb_awesome/awesome.test.jsx
|
340
|
-
- app/pb_kits/playbook/pb_awesome/docs/_awesome_default.html.erb
|
341
|
-
- app/pb_kits/playbook/pb_awesome/docs/_awesome_default.jsx
|
342
|
-
- app/pb_kits/playbook/pb_awesome/docs/example.yml
|
343
|
-
- app/pb_kits/playbook/pb_awesome/docs/index.js
|
344
335
|
- app/pb_kits/playbook/pb_background/_background.scss
|
345
336
|
- app/pb_kits/playbook/pb_background/_background.tsx
|
346
337
|
- app/pb_kits/playbook/pb_background/background.html.erb
|
@@ -644,24 +635,6 @@ files:
|
|
644
635
|
- app/pb_kits/playbook/pb_contact/docs/_description.md
|
645
636
|
- app/pb_kits/playbook/pb_contact/docs/example.yml
|
646
637
|
- app/pb_kits/playbook/pb_contact/docs/index.js
|
647
|
-
- app/pb_kits/playbook/pb_cool/_cool.scss
|
648
|
-
- app/pb_kits/playbook/pb_cool/_cool.tsx
|
649
|
-
- app/pb_kits/playbook/pb_cool/cool.html.erb
|
650
|
-
- app/pb_kits/playbook/pb_cool/cool.rb
|
651
|
-
- app/pb_kits/playbook/pb_cool/cool.test.jsx
|
652
|
-
- app/pb_kits/playbook/pb_cool/docs/_cool_default.html.erb
|
653
|
-
- app/pb_kits/playbook/pb_cool/docs/_cool_default.jsx
|
654
|
-
- app/pb_kits/playbook/pb_cool/docs/example.yml
|
655
|
-
- app/pb_kits/playbook/pb_cool/docs/index.js
|
656
|
-
- app/pb_kits/playbook/pb_coolness/_coolness.scss
|
657
|
-
- app/pb_kits/playbook/pb_coolness/_coolness.tsx
|
658
|
-
- app/pb_kits/playbook/pb_coolness/coolness.html.erb
|
659
|
-
- app/pb_kits/playbook/pb_coolness/coolness.rb
|
660
|
-
- app/pb_kits/playbook/pb_coolness/coolness.test.jsx
|
661
|
-
- app/pb_kits/playbook/pb_coolness/docs/_coolness_default.html.erb
|
662
|
-
- app/pb_kits/playbook/pb_coolness/docs/_coolness_default.jsx
|
663
|
-
- app/pb_kits/playbook/pb_coolness/docs/example.yml
|
664
|
-
- app/pb_kits/playbook/pb_coolness/docs/index.js
|
665
638
|
- app/pb_kits/playbook/pb_currency/_currency.scss
|
666
639
|
- app/pb_kits/playbook/pb_currency/_currency.tsx
|
667
640
|
- app/pb_kits/playbook/pb_currency/currency.html.erb
|
@@ -781,7 +754,6 @@ files:
|
|
781
754
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_flatpickr_styles.scss
|
782
755
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_header_styles.scss
|
783
756
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss
|
784
|
-
- app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss
|
785
757
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_month_and_year_styles.scss
|
786
758
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss
|
787
759
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_time_selection_styles.scss
|
@@ -1584,7 +1556,6 @@ files:
|
|
1584
1556
|
- app/pb_kits/playbook/pb_person_contact/docs/index.js
|
1585
1557
|
- app/pb_kits/playbook/pb_person_contact/person_contact.html.erb
|
1586
1558
|
- app/pb_kits/playbook/pb_person_contact/person_contact.rb
|
1587
|
-
- app/pb_kits/playbook/pb_phone_number_input/PhoneNumberHelper.js
|
1588
1559
|
- app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss
|
1589
1560
|
- app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx
|
1590
1561
|
- app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.html.erb
|
@@ -1988,15 +1959,6 @@ files:
|
|
1988
1959
|
- app/pb_kits/playbook/pb_table/table.test.js
|
1989
1960
|
- app/pb_kits/playbook/pb_table/table_row.html.erb
|
1990
1961
|
- app/pb_kits/playbook/pb_table/table_row.rb
|
1991
|
-
- app/pb_kits/playbook/pb_test/_test.scss
|
1992
|
-
- app/pb_kits/playbook/pb_test/_test.tsx
|
1993
|
-
- app/pb_kits/playbook/pb_test/docs/_test_default.html.erb
|
1994
|
-
- app/pb_kits/playbook/pb_test/docs/_test_default.jsx
|
1995
|
-
- app/pb_kits/playbook/pb_test/docs/example.yml
|
1996
|
-
- app/pb_kits/playbook/pb_test/docs/index.js
|
1997
|
-
- app/pb_kits/playbook/pb_test/test.html.erb
|
1998
|
-
- app/pb_kits/playbook/pb_test/test.rb
|
1999
|
-
- app/pb_kits/playbook/pb_test/test.test.jsx
|
2000
1962
|
- app/pb_kits/playbook/pb_text_input/_text_input.scss
|
2001
1963
|
- app/pb_kits/playbook/pb_text_input/_text_input.tsx
|
2002
1964
|
- app/pb_kits/playbook/pb_text_input/add_on.html.erb
|
@@ -1,41 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
/* @flow */
|
4
|
-
|
5
|
-
import React from 'react'
|
6
|
-
import classnames from 'classnames'
|
7
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
8
|
-
import { globalProps } from '../utilities/globalProps'
|
9
|
-
|
10
|
-
type AwesomeProps = {
|
11
|
-
aria?: { [key: string]: string },
|
12
|
-
className?: string,
|
13
|
-
data?: { [key: string]: string },
|
14
|
-
id?: string,
|
15
|
-
}
|
16
|
-
|
17
|
-
const Awesome = (props: AwesomeProps) => {
|
18
|
-
const {
|
19
|
-
aria = {},
|
20
|
-
className,
|
21
|
-
data = {},
|
22
|
-
id,
|
23
|
-
} = props
|
24
|
-
|
25
|
-
const ariaProps = buildAriaProps(aria)
|
26
|
-
const dataProps = buildDataProps(data)
|
27
|
-
const classes = classnames(buildCss('pb_awesome'), globalProps(props), className)
|
28
|
-
|
29
|
-
return (
|
30
|
-
<div
|
31
|
-
{...ariaProps}
|
32
|
-
{...dataProps}
|
33
|
-
className={classes}
|
34
|
-
id={id}
|
35
|
-
>
|
36
|
-
{className}
|
37
|
-
</div>
|
38
|
-
)
|
39
|
-
}
|
40
|
-
|
41
|
-
export default Awesome
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { ensureAccessible, renderKit } from '../utilities/test-utils'
|
2
|
-
|
3
|
-
import { Awesome } from '../'
|
4
|
-
|
5
|
-
/* See these resources for more testing info:
|
6
|
-
- https://github.com/testing-library/jest-dom#usage for useage and examples
|
7
|
-
- https://jestjs.io/docs/en/using-matchers
|
8
|
-
*/
|
9
|
-
|
10
|
-
test('generated scaffold test - update me', () => {
|
11
|
-
const props = {
|
12
|
-
data: { testid: 'default' }
|
13
|
-
}
|
14
|
-
|
15
|
-
const kit = renderKit(Awesome , props)
|
16
|
-
expect(kit).toBeInTheDocument()
|
17
|
-
})
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= pb_rails("awesome") %>
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default as AwesomeDefault } from './_awesome_default.jsx'
|
@@ -1,41 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
/* @flow */
|
4
|
-
|
5
|
-
import React from 'react'
|
6
|
-
import classnames from 'classnames'
|
7
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
8
|
-
import { globalProps } from '../utilities/globalProps'
|
9
|
-
|
10
|
-
type CoolProps = {
|
11
|
-
aria?: { [key: string]: string },
|
12
|
-
className?: string,
|
13
|
-
data?: { [key: string]: string },
|
14
|
-
id?: string,
|
15
|
-
}
|
16
|
-
|
17
|
-
const Cool = (props: CoolProps) => {
|
18
|
-
const {
|
19
|
-
aria = {},
|
20
|
-
className,
|
21
|
-
data = {},
|
22
|
-
id,
|
23
|
-
} = props
|
24
|
-
|
25
|
-
const ariaProps = buildAriaProps(aria)
|
26
|
-
const dataProps = buildDataProps(data)
|
27
|
-
const classes = classnames(buildCss('pb_cool'), globalProps(props), className)
|
28
|
-
|
29
|
-
return (
|
30
|
-
<div
|
31
|
-
{...ariaProps}
|
32
|
-
{...dataProps}
|
33
|
-
className={classes}
|
34
|
-
id={id}
|
35
|
-
>
|
36
|
-
{className}
|
37
|
-
</div>
|
38
|
-
)
|
39
|
-
}
|
40
|
-
|
41
|
-
export default Cool
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { ensureAccessible, renderKit } from '../utilities/test-utils'
|
2
|
-
|
3
|
-
import { Cool } from '../'
|
4
|
-
|
5
|
-
/* See these resources for more testing info:
|
6
|
-
- https://github.com/testing-library/jest-dom#usage for useage and examples
|
7
|
-
- https://jestjs.io/docs/en/using-matchers
|
8
|
-
*/
|
9
|
-
|
10
|
-
test('generated scaffold test - update me', () => {
|
11
|
-
const props = {
|
12
|
-
data: { testid: 'default' }
|
13
|
-
}
|
14
|
-
|
15
|
-
const kit = renderKit(Cool , props)
|
16
|
-
expect(kit).toBeInTheDocument()
|
17
|
-
})
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= pb_rails("cool") %>
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default as CoolDefault } from './_cool_default.jsx'
|
@@ -1,41 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
/* @flow */
|
4
|
-
|
5
|
-
import React from 'react'
|
6
|
-
import classnames from 'classnames'
|
7
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
8
|
-
import { globalProps } from '../utilities/globalProps'
|
9
|
-
|
10
|
-
type CoolnessProps = {
|
11
|
-
aria?: { [key: string]: string },
|
12
|
-
className?: string,
|
13
|
-
data?: { [key: string]: string },
|
14
|
-
id?: string,
|
15
|
-
}
|
16
|
-
|
17
|
-
const Coolness = (props: CoolnessProps) => {
|
18
|
-
const {
|
19
|
-
aria = {},
|
20
|
-
className,
|
21
|
-
data = {},
|
22
|
-
id,
|
23
|
-
} = props
|
24
|
-
|
25
|
-
const ariaProps = buildAriaProps(aria)
|
26
|
-
const dataProps = buildDataProps(data)
|
27
|
-
const classes = classnames(buildCss('pb_coolness'), globalProps(props), className)
|
28
|
-
|
29
|
-
return (
|
30
|
-
<div
|
31
|
-
{...ariaProps}
|
32
|
-
{...dataProps}
|
33
|
-
className={classes}
|
34
|
-
id={id}
|
35
|
-
>
|
36
|
-
{className}
|
37
|
-
</div>
|
38
|
-
)
|
39
|
-
}
|
40
|
-
|
41
|
-
export default Coolness
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { ensureAccessible, renderKit } from '../utilities/test-utils'
|
2
|
-
|
3
|
-
import { Coolness } from '../'
|
4
|
-
|
5
|
-
/* See these resources for more testing info:
|
6
|
-
- https://github.com/testing-library/jest-dom#usage for useage and examples
|
7
|
-
- https://jestjs.io/docs/en/using-matchers
|
8
|
-
*/
|
9
|
-
|
10
|
-
test('generated scaffold test - update me', () => {
|
11
|
-
const props = {
|
12
|
-
data: { testid: 'default' }
|
13
|
-
}
|
14
|
-
|
15
|
-
const kit = renderKit(Coolness , props)
|
16
|
-
expect(kit).toBeInTheDocument()
|
17
|
-
})
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= pb_rails("coolness") %>
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default as CoolnessDefault } from './_coolness_default.jsx'
|
@@ -1,68 +0,0 @@
|
|
1
|
-
@import "../../pb_textarea/textarea_mixin";
|
2
|
-
|
3
|
-
[class^=pb_date_picker_kit] {
|
4
|
-
margin-bottom: $space_sm;
|
5
|
-
|
6
|
-
.pb_date_picker_kit_label {
|
7
|
-
margin-bottom: $space_xs;
|
8
|
-
display: block;
|
9
|
-
}
|
10
|
-
|
11
|
-
.date_picker_input_wrapper {
|
12
|
-
display: block;
|
13
|
-
|
14
|
-
input::placeholder,
|
15
|
-
.date_picker_input .placeholder {
|
16
|
-
@include pb_body_light;
|
17
|
-
}
|
18
|
-
|
19
|
-
input,
|
20
|
-
.date_picker_input {
|
21
|
-
max-height: 45px;
|
22
|
-
@include pb_textarea_light;
|
23
|
-
overflow: hidden;
|
24
|
-
}
|
25
|
-
|
26
|
-
input:hover,
|
27
|
-
.date_picker_input:hover {
|
28
|
-
background-color: rgba($focus_input_light, $opacity_5);
|
29
|
-
}
|
30
|
-
|
31
|
-
input:focus,
|
32
|
-
.date_picker_input:focus,
|
33
|
-
input:-webkit-autofill:focus,
|
34
|
-
.date_picker_input:-webkit-autofill:focus {
|
35
|
-
@include pb_textarea_focus;
|
36
|
-
@include transition_default;
|
37
|
-
border-color: $primary;
|
38
|
-
background-color: rgba($focus_input_light, $opacity_5);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
&.error {
|
43
|
-
.date_picker_input_wrapper {
|
44
|
-
[class*=pb_body_kit] {
|
45
|
-
margin-top: $space_xs / 2;
|
46
|
-
}
|
47
|
-
|
48
|
-
input,
|
49
|
-
.date_picker_input {
|
50
|
-
border-color: $error;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
&.inline {
|
56
|
-
.date_picker_input_wrapper input::placeholder,
|
57
|
-
.date_picker_input_wrapper .date_picker_input .placeholder {
|
58
|
-
opacity: 1;
|
59
|
-
}
|
60
|
-
|
61
|
-
&:not(:hover) {
|
62
|
-
.date_picker_input_wrapper input:not(:focus) {
|
63
|
-
background-color: transparent;
|
64
|
-
border-color: transparent;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
|
2
|
-
const PhoneNumberHelper = () => {
|
3
|
-
// window.addEventListener('DOMContentLoaded', () => {
|
4
|
-
for (let i = 0; i < window.intlTelInputGlobals.getCountryData().length; i++) {
|
5
|
-
let country = window.intlTelInputGlobals.getCountryData()[i]
|
6
|
-
country.name = country.name.split("(")[0].trim()
|
7
|
-
console.log(country.name)
|
8
|
-
}
|
9
|
-
// })
|
10
|
-
};
|
11
|
-
|
12
|
-
export default PhoneNumberHelper;
|
@@ -1,41 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
/* @flow */
|
4
|
-
|
5
|
-
import React from 'react'
|
6
|
-
import classnames from 'classnames'
|
7
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
8
|
-
import { globalProps } from '../utilities/globalProps'
|
9
|
-
|
10
|
-
type TestProps = {
|
11
|
-
aria?: { [key: string]: string },
|
12
|
-
className?: string,
|
13
|
-
data?: { [key: string]: string },
|
14
|
-
id?: string,
|
15
|
-
}
|
16
|
-
|
17
|
-
const Test = (props: TestProps) => {
|
18
|
-
const {
|
19
|
-
aria = {},
|
20
|
-
className,
|
21
|
-
data = {},
|
22
|
-
id,
|
23
|
-
} = props
|
24
|
-
|
25
|
-
const ariaProps = buildAriaProps(aria)
|
26
|
-
const dataProps = buildDataProps(data)
|
27
|
-
const classes = classnames(buildCss('pb_test'), globalProps(props), className)
|
28
|
-
|
29
|
-
return (
|
30
|
-
<div
|
31
|
-
{...ariaProps}
|
32
|
-
{...dataProps}
|
33
|
-
className={classes}
|
34
|
-
id={id}
|
35
|
-
>
|
36
|
-
{className}
|
37
|
-
</div>
|
38
|
-
)
|
39
|
-
}
|
40
|
-
|
41
|
-
export default Test
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= pb_rails("test") %>
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default as TestDefault } from './_test_default.jsx'
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { ensureAccessible, renderKit } from '../utilities/test-utils'
|
2
|
-
|
3
|
-
import { Test } from '../'
|
4
|
-
|
5
|
-
/* See these resources for more testing info:
|
6
|
-
- https://github.com/testing-library/jest-dom#usage for useage and examples
|
7
|
-
- https://jestjs.io/docs/en/using-matchers
|
8
|
-
*/
|
9
|
-
|
10
|
-
test('generated scaffold test - update me', () => {
|
11
|
-
const props = {
|
12
|
-
data: { testid: 'default' }
|
13
|
-
}
|
14
|
-
|
15
|
-
const kit = renderKit(Test , props)
|
16
|
-
expect(kit).toBeInTheDocument()
|
17
|
-
})
|