playbook_ui 14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4037 → 14.5.0.pre.alpha.PLAY15814066
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_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_card/_card.tsx +5 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -1
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -2
- data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +3 -6
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +7 -2
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +12 -61
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +6 -15
- 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 +0 -2
- data/app/pb_kits/playbook/pb_phone_number_input/types.d.ts +1 -4
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +3 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +39 -2
- data/dist/chunks/_typeahead-D8vYsn7T.js +22 -0
- data/dist/chunks/{_weekday_stacked-BxOdmCPF.js → _weekday_stacked-CaNCkN7U.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/kit_base.rb +17 -0
- data/lib/playbook/version.rb +1 -1
- metadata +4 -4
- data/dist/chunks/_typeahead-CvmA5XOD.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: 16e2ee529fe689d2f505e3daeac5e4d71a2f33a29d8807153811992ea08f84d0
|
4
|
+
data.tar.gz: 8e263f4310c0ab98566668459a775d778064a98fffff801a831a178597350c2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1647e85a66a4ca5899ba11b6da51a1362aea04de67c1abbbc00a3cb981305e9206c4d38a247157aef0292a4c2a9de21216b52ef32423d36929480568213bfcc0
|
7
|
+
data.tar.gz: bac1ad6e22af011cc37f94d4b7c2ad32198e71bdee31e8c0c40005b1c3b252474dcce80cc49946b3a138f8a084f034f83dbe34bc63d25974b1ec8577827f178f
|
@@ -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 %>
|
@@ -5,7 +5,7 @@ import { get } from 'lodash'
|
|
5
5
|
import classnames from 'classnames'
|
6
6
|
|
7
7
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
8
|
-
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
8
|
+
import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
|
9
9
|
import type { ProductColors, CategoryColors, BackgroundColors } from '../types/colors'
|
10
10
|
|
11
11
|
import Icon from '../pb_icon/_icon'
|
@@ -49,6 +49,7 @@ type CardBodyProps = {
|
|
49
49
|
padding?: string,
|
50
50
|
} & GlobalProps
|
51
51
|
|
52
|
+
|
52
53
|
// Header component
|
53
54
|
const Header = (props: CardHeaderProps) => {
|
54
55
|
const { children, className, headerColor = 'category_1', headerColorStriped = false } = props
|
@@ -107,6 +108,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
107
108
|
|
108
109
|
// coerce to array
|
109
110
|
const cardChildren = React.Children.toArray(children)
|
111
|
+
const inlineStyles = globalInlineProps(props);
|
110
112
|
|
111
113
|
const subComponentTags = (tagName: string) => {
|
112
114
|
return cardChildren.filter((c: string) => (
|
@@ -135,6 +137,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
135
137
|
{...dataProps}
|
136
138
|
{...htmlProps}
|
137
139
|
className={classnames(cardCss, globalProps(props), className)}
|
140
|
+
style={inlineStyles}
|
138
141
|
>
|
139
142
|
{subComponentTags('Header')}
|
140
143
|
{
|
@@ -163,6 +166,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
163
166
|
{...dataProps}
|
164
167
|
{...htmlProps}
|
165
168
|
className={classnames(cardCss, globalProps(props), className)}
|
169
|
+
style={inlineStyles}
|
166
170
|
>
|
167
171
|
{subComponentTags('Header')}
|
168
172
|
{nonHeaderChildren}
|
@@ -6,7 +6,7 @@ import classnames from "classnames";
|
|
6
6
|
import Modal from "react-modal";
|
7
7
|
|
8
8
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
9
|
-
import { globalProps } from "../utilities/globalProps";
|
9
|
+
import { globalProps, globalInlineProps } from "../utilities/globalProps";
|
10
10
|
|
11
11
|
import Body from "../pb_body/_body";
|
12
12
|
import Button from "../pb_button/_button";
|
@@ -91,6 +91,8 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
91
91
|
beforeClose: "pb_dialog_overlay_before_close",
|
92
92
|
};
|
93
93
|
|
94
|
+
const inlineStyles = globalInlineProps(props);
|
95
|
+
|
94
96
|
const classes = classnames(
|
95
97
|
buildCss("pb_dialog_wrapper"),
|
96
98
|
globalProps(props),
|
@@ -184,6 +186,7 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
184
186
|
overlayClassName={overlayClassNames}
|
185
187
|
portalClassName={portalClassName}
|
186
188
|
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick && !loading}
|
189
|
+
style={{ content: inlineStyles }}
|
187
190
|
>
|
188
191
|
<>
|
189
192
|
{title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
|
@@ -192,6 +195,7 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
192
195
|
<Dialog.Body
|
193
196
|
className="dialog_status_text_align"
|
194
197
|
padding="md"
|
198
|
+
|
195
199
|
>
|
196
200
|
<Flex align="center"
|
197
201
|
orientation="column"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import { buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
4
|
-
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
4
|
+
import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
|
5
5
|
import { GenericObject, Sizes } from '../types'
|
6
6
|
|
7
7
|
type FlexProps = {
|
@@ -61,6 +61,7 @@ const Flex = (props: FlexProps): React.ReactElement => {
|
|
61
61
|
const alignSelfClass = alignSelf !== 'none' ? `align_self_${alignSelf}` : ''
|
62
62
|
const dataProps = buildDataProps(data)
|
63
63
|
const htmlProps = buildHtmlProps(htmlOptions)
|
64
|
+
const inlineStyles = globalInlineProps(props)
|
64
65
|
|
65
66
|
|
66
67
|
return (
|
@@ -83,6 +84,7 @@ const Flex = (props: FlexProps): React.ReactElement => {
|
|
83
84
|
globalProps(props),
|
84
85
|
className
|
85
86
|
)}
|
87
|
+
style={inlineStyles}
|
86
88
|
{...dataProps}
|
87
89
|
{...htmlProps}
|
88
90
|
>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import { buildCss, buildHtmlProps } from '../utilities/props'
|
4
|
-
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
4
|
+
import { globalProps, GlobalProps, globalInlineProps} from '../utilities/globalProps'
|
5
5
|
type FlexItemPropTypes = {
|
6
6
|
children: React.ReactNode[] | React.ReactNode,
|
7
7
|
fixedSize?: string,
|
@@ -35,14 +35,20 @@ const FlexItem = (props: FlexItemPropTypes): React.ReactElement => {
|
|
35
35
|
const fixedStyle =
|
36
36
|
fixedSize !== undefined ? { flexBasis: `${fixedSize}` } : null
|
37
37
|
const orderClass = order !== 'none' ? `order_${order}` : null
|
38
|
+
const inlineStyles = globalInlineProps(props)
|
39
|
+
const combinedStyles = {
|
40
|
+
...fixedStyle,
|
41
|
+
...inlineStyles
|
42
|
+
}
|
38
43
|
|
39
44
|
const htmlProps = buildHtmlProps(htmlOptions)
|
40
45
|
|
46
|
+
|
41
47
|
return (
|
42
48
|
<div
|
43
49
|
{...htmlProps}
|
44
50
|
className={classnames(buildCss('pb_flex_item_kit', growClass, shrinkClass, flexClass, displayFlexClass), orderClass, alignSelfClass, globalProps(props), className)}
|
45
|
-
style={
|
51
|
+
style={combinedStyles}
|
46
52
|
>
|
47
53
|
{children}
|
48
54
|
</div>
|
@@ -20,8 +20,13 @@ module Playbook
|
|
20
20
|
generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, display_flex_class) + align_self_class
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
|
23
|
+
def inline_styles
|
24
|
+
styles = []
|
25
|
+
styles << "flex-basis: #{fixed_size};" if fixed_size.present?
|
26
|
+
styles << "height: #{height};" if height.present?
|
27
|
+
styles << "min-height: #{min_height};" if min_height.present?
|
28
|
+
styles << "max-height: #{max_height};" if max_height.present?
|
29
|
+
styles.join(" ")
|
25
30
|
end
|
26
31
|
|
27
32
|
private
|
@@ -6,30 +6,6 @@ $dropdown-min-width: 340px;
|
|
6
6
|
$flag-min-resolution: 192dpi;
|
7
7
|
|
8
8
|
.pb_phone_number_input {
|
9
|
-
.iti {
|
10
|
-
width: 100%;
|
11
|
-
}
|
12
|
-
|
13
|
-
.iti__flag {
|
14
|
-
margin-right: 6px;
|
15
|
-
}
|
16
|
-
|
17
|
-
.iti__a11y-text {
|
18
|
-
display: none;
|
19
|
-
}
|
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
9
|
input::placeholder {
|
34
10
|
color: $focus_input_light;
|
35
11
|
}
|
@@ -39,7 +15,7 @@ $flag-min-resolution: 192dpi;
|
|
39
15
|
border-color: $primary !important;
|
40
16
|
}
|
41
17
|
|
42
|
-
.iti__selected-
|
18
|
+
.iti__selected-flag:focus-visible {
|
43
19
|
outline-style: none;
|
44
20
|
}
|
45
21
|
}
|
@@ -53,26 +29,7 @@ $flag-min-resolution: 192dpi;
|
|
53
29
|
border-bottom: 1px solid $border_light !important;
|
54
30
|
}
|
55
31
|
|
56
|
-
.iti__selected-
|
57
|
-
display: flex;
|
58
|
-
justify-content: center;
|
59
|
-
align-items: center;
|
60
|
-
margin-right: 10px;
|
61
|
-
.iti__flag {
|
62
|
-
margin-right: 0;
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
.iti__selected-country {
|
67
|
-
position: absolute;
|
68
|
-
z-index: 2;
|
69
|
-
top: 0;
|
70
|
-
display: flex;
|
71
|
-
height: 100%;
|
72
|
-
justify-content: center;
|
73
|
-
align-items: center;
|
74
|
-
border-width: 0;
|
75
|
-
|
32
|
+
.iti__selected-flag {
|
76
33
|
padding: 0 $space_xxs 0 $space_sm;
|
77
34
|
border-radius: $space_xxs;
|
78
35
|
|
@@ -94,11 +51,11 @@ $flag-min-resolution: 192dpi;
|
|
94
51
|
}
|
95
52
|
}
|
96
53
|
|
97
|
-
.iti--allow-dropdown .
|
54
|
+
.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag {
|
98
55
|
background-color: $focus_input_light;
|
99
56
|
}
|
100
57
|
|
101
|
-
.
|
58
|
+
.iti__flag-container:hover + .text_input {
|
102
59
|
background-color: $focus_input_light;
|
103
60
|
}
|
104
61
|
|
@@ -107,14 +64,11 @@ $flag-min-resolution: 192dpi;
|
|
107
64
|
border-radius: 1px;
|
108
65
|
}
|
109
66
|
|
110
|
-
.
|
111
|
-
|
112
|
-
background-position: center;
|
113
|
-
height: 20px;
|
114
|
-
background-size: 20px 20px;
|
67
|
+
.iti--separate-dial-code {
|
68
|
+
width: 100%;
|
115
69
|
}
|
116
70
|
|
117
|
-
.iti--
|
71
|
+
.iti--separate-dial-code .iti__selected-flag {
|
118
72
|
background-color: rgba($white, $opacity_1);
|
119
73
|
}
|
120
74
|
|
@@ -141,14 +95,14 @@ $flag-min-resolution: 192dpi;
|
|
141
95
|
position: relative;
|
142
96
|
vertical-align: top;
|
143
97
|
width: $space_xxs + 1px;
|
144
|
-
top: $space_xs
|
98
|
+
top: $space_xs + 2px;
|
145
99
|
transform: rotate($transform-rotate-deg);
|
146
100
|
color: $slate;
|
147
101
|
}
|
148
102
|
|
149
103
|
.iti__arrow.iti__arrow--up::before {
|
150
104
|
transform: rotate(-($transform-rotate-deg/3));
|
151
|
-
top: $space_xs +
|
105
|
+
top: $space_xs + 4px;
|
152
106
|
color: $primary_action;
|
153
107
|
}
|
154
108
|
|
@@ -182,13 +136,10 @@ $flag-min-resolution: 192dpi;
|
|
182
136
|
.iti__dropdown-content {
|
183
137
|
border-radius: $space_xs;
|
184
138
|
border: 1px solid $border_light !important;
|
185
|
-
position: absolute;
|
186
|
-
z-index: 2;
|
187
|
-
top: 100%;
|
188
139
|
}
|
189
140
|
|
190
141
|
&.dark {
|
191
|
-
.iti--allow-dropdown .
|
142
|
+
.iti--allow-dropdown .iti__flag-container {
|
192
143
|
background-color: rgba($white, 0);
|
193
144
|
|
194
145
|
&:hover {
|
@@ -198,13 +149,13 @@ $flag-min-resolution: 192dpi;
|
|
198
149
|
background-color: rgba($white, 0.15);
|
199
150
|
}
|
200
151
|
|
201
|
-
.iti__selected-
|
152
|
+
.iti__selected-flag {
|
202
153
|
background-color: rgba($white, 0);
|
203
154
|
}
|
204
155
|
}
|
205
156
|
}
|
206
157
|
|
207
|
-
.iti__selected-
|
158
|
+
.iti__selected-flag {
|
208
159
|
background-color: rgba($white, 0);
|
209
160
|
color: $white;
|
210
161
|
}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import React, { forwardRef, useEffect, useRef, useState, useImperativeHandle } from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
|
4
|
-
import intlTelInput from 'intl-tel-input
|
4
|
+
import intlTelInput from 'intl-tel-input'
|
5
|
+
import 'intl-tel-input/build/js/utils.js'
|
5
6
|
|
6
7
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
7
8
|
import { globalProps } from '../utilities/globalProps'
|
@@ -49,7 +50,7 @@ const formatToGlobalCountryName = (countryName: string) => {
|
|
49
50
|
}
|
50
51
|
|
51
52
|
const formatAllCountries = () => {
|
52
|
-
const countryData =
|
53
|
+
const countryData = window.intlTelInputGlobals.getCountryData()
|
53
54
|
|
54
55
|
for (let i = 0; i < countryData.length; i++) {
|
55
56
|
const country = countryData[i]
|
@@ -213,24 +214,14 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
213
214
|
// This also Fixes things for our react_component rendering on the Rails Side
|
214
215
|
useEffect(formatAllCountries, [])
|
215
216
|
|
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
|
-
|
223
217
|
useEffect(() => {
|
224
218
|
const telInputInit = intlTelInput(inputRef.current, {
|
225
219
|
separateDialCode: true,
|
226
|
-
|
220
|
+
preferredCountries,
|
227
221
|
allowDropdown: !disabled,
|
228
222
|
autoInsertDialCode: false,
|
229
|
-
initialCountry
|
230
|
-
onlyCountries
|
231
|
-
countrySearch: false,
|
232
|
-
fixDropdownWidth: false,
|
233
|
-
formatAsYouType: false,
|
223
|
+
initialCountry,
|
224
|
+
onlyCountries
|
234
225
|
})
|
235
226
|
|
236
227
|
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 a section separator within the remaining dropdown.
|
@@ -21,7 +21,7 @@ import classnames from "classnames";
|
|
21
21
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
22
22
|
import { uniqueId } from 'lodash';
|
23
23
|
|
24
|
-
type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth'>
|
24
|
+
type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth' | 'maxHeight' | 'minHeight'>
|
25
25
|
|
26
26
|
type PbPopoverProps = {
|
27
27
|
aria?: { [key: string]: string };
|
@@ -170,12 +170,24 @@ type ZIndex = {
|
|
170
170
|
zIndex?: ZIndexType,
|
171
171
|
} | ZIndexResponsiveType
|
172
172
|
|
173
|
+
type Height = {
|
174
|
+
height?: string
|
175
|
+
}
|
176
|
+
|
177
|
+
type MaxHeight = {
|
178
|
+
maxHeight?: string
|
179
|
+
}
|
180
|
+
|
181
|
+
type MinHeight = {
|
182
|
+
minHeight?: string
|
183
|
+
}
|
184
|
+
|
173
185
|
// keep this as the last type definition
|
174
186
|
export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
175
187
|
BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
|
176
188
|
FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
|
177
189
|
LineHeight & Margin & MinWidth & MaxWidth & NumberSpacing & Order & Overflow & Padding &
|
178
|
-
Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left;
|
190
|
+
Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left & Height & MaxHeight & MinHeight;
|
179
191
|
|
180
192
|
const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
|
181
193
|
const keys: string[] = Object.keys(prop)
|
@@ -498,7 +510,22 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
498
510
|
} else {
|
499
511
|
return verticalAlign ? `vertical_align_${verticalAlign} ` : ''
|
500
512
|
}
|
501
|
-
}
|
513
|
+
},
|
514
|
+
|
515
|
+
}
|
516
|
+
|
517
|
+
const PROP_INLINE_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => {[key: string]: any}} = {
|
518
|
+
heightProps: ({ height }: Height) => {
|
519
|
+
return height ? { height } : {};
|
520
|
+
},
|
521
|
+
|
522
|
+
maxHeightProps: ({ maxHeight }: MaxHeight) => {
|
523
|
+
return maxHeight ? { maxHeight } : {};
|
524
|
+
},
|
525
|
+
|
526
|
+
minHeightProps: ({ minHeight }: MinHeight) => {
|
527
|
+
return minHeight ? { minHeight } : {};
|
528
|
+
},
|
502
529
|
}
|
503
530
|
|
504
531
|
type DefaultProps = {[key: string]: string} | Record<string, unknown>
|
@@ -510,6 +537,16 @@ export const globalProps = (props: GlobalProps, defaultProps: DefaultProps = {})
|
|
510
537
|
}).filter((value) => value?.length > 0).join(" ")
|
511
538
|
}
|
512
539
|
|
540
|
+
// New function for inline styles
|
541
|
+
export const globalInlineProps = (props: GlobalProps): React.CSSProperties => {
|
542
|
+
const styles = Object.keys(PROP_INLINE_CATEGORIES).reduce((acc, key) => {
|
543
|
+
const result = PROP_INLINE_CATEGORIES[key](props);
|
544
|
+
return { ...acc, ...(typeof result === 'object' ? result : {}) }; // Ensure result is an object before spreading
|
545
|
+
}, {});
|
546
|
+
|
547
|
+
return styles; // Return the styles object directly
|
548
|
+
}
|
549
|
+
|
513
550
|
|
514
551
|
export const deprecatedProps = (): void => {
|
515
552
|
// if (process.env.NODE_ENV === 'development') {
|