playbook_ui 14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4032 → 14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4073
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_advanced_table/index.js +60 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +1 -9
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +30 -7
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +9 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.md +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/intlTelInput.scss +849 -931
- data/dist/chunks/{_typeahead-CZYZ22U4.js → _typeahead-CY44rh9x.js} +1 -1
- data/dist/chunks/{_weekday_stacked-QgUMeKrB.js → _weekday_stacked-NcRanohJ.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/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e66c8286d8ecf72cb72ba05016e62b9af7853a17eb794b6f63850def5343fbc
|
4
|
+
data.tar.gz: f4c96694caf2db55ee62b603903ec1fbfa0a3e4b8deb3bf00debf687ddf98d35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cfebc74a346cb2395a08063f54683f6ba50e4f7818112db223af3bc9d365c4c09d451201d0d0d6a2d0b314f575b819e18b2a343c7aa1d838c779691338fc27a
|
7
|
+
data.tar.gz: c7f938931e124a2063f3a86b1d137f75c7bd55aef89ad8069fbf48b9f07069430091958d8bed3f9694e74f810cc2196f8d49257512e03473556f9ac3f0e4e4f5
|
@@ -13,9 +13,20 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
13
13
|
get target() {
|
14
14
|
return document.querySelector(CONTENT_SELECTOR.replace("id", this.element.id))
|
15
15
|
}
|
16
|
+
|
17
|
+
static expandedRows = new Set()
|
18
|
+
static isCollapsing = false
|
16
19
|
|
17
20
|
connect() {
|
18
21
|
this.element.addEventListener('click', () => {
|
22
|
+
if (!PbAdvancedTable.isCollapsing) {
|
23
|
+
const isExpanded = this.element.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
24
|
+
if (!isExpanded) {
|
25
|
+
PbAdvancedTable.expandedRows.add(this.element.id)
|
26
|
+
} else {
|
27
|
+
PbAdvancedTable.expandedRows.delete(this.element.id)
|
28
|
+
}
|
29
|
+
}
|
19
30
|
this.toggleElement(this.target)
|
20
31
|
})
|
21
32
|
}
|
@@ -75,4 +86,53 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
75
86
|
this.element.querySelector(UP_ARROW_SELECTOR).style.display = 'inline-block'
|
76
87
|
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display = 'none'
|
77
88
|
}
|
89
|
+
|
90
|
+
static handleToggleAllHeaders(element) {
|
91
|
+
const table = element.closest('.pb_table')
|
92
|
+
const firstLevelButtons = table.querySelectorAll('.pb_advanced_table_body > .pb_table_tr [data-advanced-table]')
|
93
|
+
|
94
|
+
const expandedRows = Array.from(firstLevelButtons).filter(button =>
|
95
|
+
button.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
96
|
+
)
|
97
|
+
|
98
|
+
if (expandedRows.length === firstLevelButtons.length) {
|
99
|
+
expandedRows.forEach(button => {
|
100
|
+
button.click()
|
101
|
+
})
|
102
|
+
this.expandedRows.clear()
|
103
|
+
} else {
|
104
|
+
firstLevelButtons.forEach(button => {
|
105
|
+
if (!this.expandedRows.has(button.id)) {
|
106
|
+
button.click()
|
107
|
+
}
|
108
|
+
})
|
109
|
+
}
|
110
|
+
}
|
111
|
+
static handleToggleAllSubRows(element, rowDepth) {
|
112
|
+
const parentElement = element.closest(".toggle-content")
|
113
|
+
const subrowButtons = parentElement.querySelectorAll('.depth-sub-row-' + rowDepth + ' [data-advanced-table]')
|
114
|
+
|
115
|
+
const expandedSubRows = Array.from(subrowButtons).filter(button =>
|
116
|
+
button.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
117
|
+
)
|
118
|
+
|
119
|
+
if (expandedSubRows.length === subrowButtons.length) {
|
120
|
+
expandedSubRows.forEach(button => {
|
121
|
+
button.click()
|
122
|
+
})
|
123
|
+
} else {
|
124
|
+
subrowButtons.forEach(button => {
|
125
|
+
if (!this.expandedRows.has(button.id)) {
|
126
|
+
button.click()
|
127
|
+
}
|
128
|
+
})
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
window.expandAllRows = (element) => {
|
134
|
+
PbAdvancedTable.handleToggleAllHeaders(element)
|
78
135
|
}
|
136
|
+
window.expandAllSubRows = (element, rowDepth) => {
|
137
|
+
PbAdvancedTable.handleToggleAllSubRows(element, rowDepth)
|
138
|
+
}
|
@@ -13,12 +13,4 @@
|
|
13
13
|
<% end %>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
16
|
-
<% end %>
|
17
|
-
|
18
|
-
<script type="text/javascript">
|
19
|
-
var expandAllRows = (element) => {
|
20
|
-
element.closest('.pb_table').querySelectorAll('.pb_advanced_table_body > .pb_table_tr [data-advanced-table]').forEach((button) => {
|
21
|
-
button.dispatchEvent(new Event('click'));
|
22
|
-
});
|
23
|
-
};
|
24
|
-
</script>
|
16
|
+
<% end %>
|
@@ -23,12 +23,4 @@
|
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
|
-
<% end %>
|
27
|
-
|
28
|
-
<script type="text/javascript">
|
29
|
-
var expandAllSubRows = (element, rowDepth) => {
|
30
|
-
element.closest(".toggle-content").querySelectorAll('.depth-sub-row-' + rowDepth + ' [data-advanced-table]').forEach((button) => {
|
31
|
-
button.dispatchEvent(new Event('click'));
|
32
|
-
});
|
33
|
-
};
|
34
|
-
</script>
|
26
|
+
<% end %>
|
@@ -18,6 +18,23 @@ $flag-min-resolution: 192dpi;
|
|
18
18
|
display: none;
|
19
19
|
}
|
20
20
|
|
21
|
+
.iti__selected-dial-code {
|
22
|
+
font-family: $font_family_base;
|
23
|
+
font-size: $font_base;
|
24
|
+
line-height: 1.5;
|
25
|
+
letter-spacing: $lspace_normal;
|
26
|
+
font-weight: $regular;
|
27
|
+
font-style: normal;
|
28
|
+
text-rendering: optimizeLegibility;
|
29
|
+
-moz-font-feature-settings: "liga" on;
|
30
|
+
color: $charcoal;
|
31
|
+
}
|
32
|
+
|
33
|
+
.iti--allow-dropdown .iti__country-container:not(:has(+ input[disabled])):not(:has(+ input[readonly])) .iti__selected-country-primary:hover,
|
34
|
+
.iti--allow-dropdown .iti__country-container:not(:has(+ input[disabled])):not(:has(+ input[readonly])) .iti__selected-country:has(+ .iti__dropdown-content:hover) .iti__selected-country-primary {
|
35
|
+
background-color: transparent;
|
36
|
+
}
|
37
|
+
|
21
38
|
input::placeholder {
|
22
39
|
color: $focus_input_light;
|
23
40
|
}
|
@@ -45,7 +62,9 @@ $flag-min-resolution: 192dpi;
|
|
45
62
|
display: flex;
|
46
63
|
justify-content: center;
|
47
64
|
align-items: center;
|
48
|
-
|
65
|
+
.iti__flag {
|
66
|
+
margin-right: 0;
|
67
|
+
}
|
49
68
|
}
|
50
69
|
|
51
70
|
.iti__selected-country {
|
@@ -58,7 +77,7 @@ $flag-min-resolution: 192dpi;
|
|
58
77
|
align-items: center;
|
59
78
|
border-width: 0;
|
60
79
|
|
61
|
-
padding: 0 $space_xxs 0 $
|
80
|
+
padding: 0 $space_xxs 0 $space_xs;
|
62
81
|
border-radius: $space_xxs;
|
63
82
|
|
64
83
|
&[aria-expanded="true"] {
|
@@ -88,12 +107,12 @@ $flag-min-resolution: 192dpi;
|
|
88
107
|
}
|
89
108
|
|
90
109
|
.iti__flag {
|
91
|
-
background-image: url("https://unpkg.com/
|
110
|
+
background-image: url("https://unpkg.com/intl-tel-input@24.6.0/build/img/flags.png");
|
92
111
|
border-radius: 1px;
|
93
112
|
}
|
94
113
|
|
95
114
|
.iti__flag.iti__globe {
|
96
|
-
background-image: url("https://unpkg.com/intl-tel-input@
|
115
|
+
background-image: url("https://unpkg.com/intl-tel-input@24.6.0/build/img/globe.png");
|
97
116
|
background-position: center;
|
98
117
|
height: 20px;
|
99
118
|
background-size: 20px 20px;
|
@@ -126,7 +145,7 @@ $flag-min-resolution: 192dpi;
|
|
126
145
|
position: relative;
|
127
146
|
vertical-align: top;
|
128
147
|
width: $space_xxs + 1px;
|
129
|
-
top: $space_xs
|
148
|
+
top: $space_xs + 2px;
|
130
149
|
transform: rotate($transform-rotate-deg);
|
131
150
|
color: $slate;
|
132
151
|
}
|
@@ -230,11 +249,15 @@ $flag-min-resolution: 192dpi;
|
|
230
249
|
background-color: rgba($white, 0.025) !important;
|
231
250
|
}
|
232
251
|
}
|
233
|
-
}
|
234
252
|
|
253
|
+
.iti__selected-dial-code {
|
254
|
+
color: $white;
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
235
258
|
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: $flag-min-resolution) {
|
236
259
|
.iti__flag {
|
237
|
-
background-image: url("https://unpkg.com/
|
260
|
+
background-image: url("https://unpkg.com/intl-tel-input@24.6.0/build/img/flags@2x.png");
|
238
261
|
}
|
239
262
|
}
|
240
263
|
}
|
@@ -213,16 +213,24 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
213
213
|
// This also Fixes things for our react_component rendering on the Rails Side
|
214
214
|
useEffect(formatAllCountries, [])
|
215
215
|
|
216
|
+
// If an initial country is not specified, the "globe" icon will show
|
217
|
+
// Always set a country
|
218
|
+
const fallbackCountry =
|
219
|
+
preferredCountries.length > 0 ? preferredCountries[0] :
|
220
|
+
onlyCountries.length > 0 ? onlyCountries.sort()[0] :
|
221
|
+
"af";
|
222
|
+
|
216
223
|
useEffect(() => {
|
217
224
|
const telInputInit = intlTelInput(inputRef.current, {
|
218
225
|
separateDialCode: true,
|
219
226
|
countryOrder: preferredCountries,
|
220
227
|
allowDropdown: !disabled,
|
221
228
|
autoInsertDialCode: false,
|
222
|
-
initialCountry,
|
229
|
+
initialCountry: initialCountry || fallbackCountry,
|
223
230
|
onlyCountries,
|
224
231
|
countrySearch: false,
|
225
232
|
fixDropdownWidth: false,
|
233
|
+
formatAsYouType: false,
|
226
234
|
})
|
227
235
|
|
228
236
|
inputRef.current.addEventListener("countrychange", (evt: Event) => {
|
data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.md
CHANGED
@@ -1 +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
|
1
|
+
Preferred countries will display in the order they are listed with the first country preselected, and all non-preferred countries listed alphabetically below in the remaining dropdown.
|