playbook_ui 15.6.0.pre.alpha.PLAY2611selectinputoptions12951 → 15.6.0.pre.alpha.PLAY2686contactkittextonly13049
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_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +2 -2
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +10 -8
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +0 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -3
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +51 -24
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +53 -19
- data/app/pb_kits/playbook/pb_contact/contact.rb +11 -1
- data/app/pb_kits/playbook/pb_contact/contact.test.js +76 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.html.erb +33 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.jsx +46 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_rails.md +2 -0
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_react.md +2 -0
- data/app/pb_kits/playbook/pb_contact/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_contact/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +24 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +181 -3
- data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +316 -15
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +1 -1
- data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.tsx +3 -3
- data/app/pb_kits/playbook/pb_table/_table.tsx +187 -33
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.jsx +134 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.md +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.html.erb +101 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +33 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.jsx +180 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.html.erb +122 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.md +3 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_table/table.html.erb +68 -12
- data/app/pb_kits/playbook/pb_table/table.rb +22 -3
- data/app/pb_kits/playbook/pb_table/table.test.js +143 -0
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +3 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.html.erb +60 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.jsx +118 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md +1 -1
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_timeline/item.rb +2 -0
- data/app/pb_kits/playbook/pb_timeline/label.html.erb +2 -1
- data/app/pb_kits/playbook/pb_timeline/label.rb +2 -0
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +3 -0
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +51 -0
- data/app/pb_kits/playbook/tokens/_colors.scss +2 -1
- data/app/pb_kits/playbook/utilities/deprecated.ts +73 -0
- data/dist/chunks/_typeahead-CHwm9MTE.js +6 -0
- data/dist/chunks/lib-Cugvy62C.js +29 -0
- data/dist/chunks/vendor.js +3 -3
- 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/pb_kit_helper.rb +35 -0
- data/lib/playbook/version.rb +1 -1
- metadata +20 -4
- data/dist/chunks/_typeahead-BXM7QUuy.js +0 -6
- data/dist/chunks/lib-CgpqUb6l.js +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a30081dbc5a14dfeec79933dd490fe553502036499c58f64de1d148a0fba985e
|
|
4
|
+
data.tar.gz: b6cf7dd45fd95b0cc39435dd440bb3829648799a28295ca0fd5b0f7d324a07d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae9a12d8598e97d2326f6d8b6c65950a2316e511d1e22de76709c4fb416b3f67a61e02dbc895138b64ec80c2f68bfd26be27a2e0aaa1a07f439c4be7a3e87c63
|
|
7
|
+
data.tar.gz: 97507923ae090f97a814c18cbd242e3746f7481fd797e0f3b809ccc34c3a784644e9b5d5b5ac8c8ef407bc712f17d67f1e2c778c82c0abc1ac28aa070fa79285
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Card headers pass category, product, status and background colors only. List of all category, product, status and background colors can be viewed <a href="https://playbook.powerapp.cloud/
|
|
1
|
+
Card headers pass category, product, status and background colors only. List of all category, product, status and background colors can be viewed <a href="https://playbook.powerapp.cloud/tokens/colors" target="_blank">here</a>.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Card highlight can pass status, product, and category colors. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/
|
|
1
|
+
Card highlight can pass status, product, and category colors. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/tokens/colors" target="_blank">here</a>.
|
|
@@ -25,11 +25,11 @@ exports[`html structure is correct 1`] = `
|
|
|
25
25
|
>
|
|
26
26
|
<div
|
|
27
27
|
class="icon_wrapper"
|
|
28
|
-
style="vertical-align: middle;
|
|
28
|
+
style="vertical-align: middle;"
|
|
29
29
|
>
|
|
30
30
|
<svg
|
|
31
31
|
aria-label="chevron-down icon"
|
|
32
|
-
class="pb_custom_icon svg-inline--fa svg_lg svg_fw"
|
|
32
|
+
class="pb_custom_icon svg-inline--fa color_text_lt_lighter svg_lg svg_fw"
|
|
33
33
|
color="currentColor"
|
|
34
34
|
fill="none"
|
|
35
35
|
height="auto"
|
|
@@ -27,12 +27,12 @@ type colorMap = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const colorMap = {
|
|
30
|
-
default:
|
|
31
|
-
light: "
|
|
32
|
-
lighter: "
|
|
33
|
-
link: "
|
|
34
|
-
error: "
|
|
35
|
-
success: "
|
|
30
|
+
default:"text_lt_default",
|
|
31
|
+
light: "text_lt_light",
|
|
32
|
+
lighter: "text_lt_lighter",
|
|
33
|
+
link: "primary",
|
|
34
|
+
error: "error",
|
|
35
|
+
success: "text_dk_success_sm",
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const CollapsibleIcon = ({
|
|
@@ -68,9 +68,10 @@ const CollapsibleIcon = ({
|
|
|
68
68
|
className="icon_wrapper"
|
|
69
69
|
key={icon ? showIcon(icon)[0] : "chevron-down"}
|
|
70
70
|
onClick={(e) => handleIconClick(e)}
|
|
71
|
-
style={{ verticalAlign: "middle"
|
|
71
|
+
style={{ verticalAlign: "middle"}}
|
|
72
72
|
>
|
|
73
73
|
<Icon
|
|
74
|
+
color={color}
|
|
74
75
|
icon={icon ? showIcon(icon)[0] : "chevron-down"}
|
|
75
76
|
size={iconSize}
|
|
76
77
|
/>
|
|
@@ -80,9 +81,10 @@ const CollapsibleIcon = ({
|
|
|
80
81
|
className="icon_wrapper"
|
|
81
82
|
key={icon ? showIcon(icon)[1] : "chevron-up"}
|
|
82
83
|
onClick={(e) => handleIconClick(e)}
|
|
83
|
-
style={{ verticalAlign: "middle"
|
|
84
|
+
style={{ verticalAlign: "middle" }}
|
|
84
85
|
>
|
|
85
86
|
<Icon
|
|
87
|
+
color={color}
|
|
86
88
|
icon={icon ? showIcon(icon)[1] : "chevron-up"}
|
|
87
89
|
size={iconSize}
|
|
88
90
|
/>
|
|
@@ -22,7 +22,6 @@ const CollapsibleState = (props) => {
|
|
|
22
22
|
<Collapsible
|
|
23
23
|
collapsed={isCollapsed}
|
|
24
24
|
icon={["plus", "minus"]}
|
|
25
|
-
iconColor='white'
|
|
26
25
|
padding="none"
|
|
27
26
|
>
|
|
28
27
|
<Collapsible.Main padding="sm"
|
|
@@ -41,7 +40,6 @@ const CollapsibleState = (props) => {
|
|
|
41
40
|
<Collapsible
|
|
42
41
|
collapsed={isCollapsed}
|
|
43
42
|
icon={["plus", "minus"]}
|
|
44
|
-
iconColor='white'
|
|
45
43
|
padding="none"
|
|
46
44
|
>
|
|
47
45
|
<Collapsible.Main padding="sm"
|
|
@@ -60,7 +58,6 @@ const CollapsibleState = (props) => {
|
|
|
60
58
|
<Collapsible
|
|
61
59
|
collapsed={isCollapsed}
|
|
62
60
|
icon={["plus", "minus"]}
|
|
63
|
-
iconColor='white'
|
|
64
61
|
padding="none"
|
|
65
62
|
>
|
|
66
63
|
<Collapsible.Main padding="sm"
|
|
@@ -61,7 +61,9 @@ type ContactProps = {
|
|
|
61
61
|
data?: { [key: string]: string }
|
|
62
62
|
dark?: boolean
|
|
63
63
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) }
|
|
64
|
+
iconEnabled?: boolean
|
|
64
65
|
id?: string
|
|
66
|
+
unstyled?: boolean
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
const Contact = (props: ContactProps): React.ReactElement => {
|
|
@@ -74,7 +76,9 @@ const Contact = (props: ContactProps): React.ReactElement => {
|
|
|
74
76
|
data = {},
|
|
75
77
|
dark = false,
|
|
76
78
|
htmlOptions = {},
|
|
79
|
+
iconEnabled = true,
|
|
77
80
|
id,
|
|
81
|
+
unstyled = false,
|
|
78
82
|
} = props
|
|
79
83
|
const ariaProps = buildAriaProps(aria)
|
|
80
84
|
const dataProps = buildDataProps(data)
|
|
@@ -85,6 +89,51 @@ const Contact = (props: ContactProps): React.ReactElement => {
|
|
|
85
89
|
className
|
|
86
90
|
)
|
|
87
91
|
|
|
92
|
+
const formattedValue = formatContact(contactValue, contactType)
|
|
93
|
+
const content = (
|
|
94
|
+
<>
|
|
95
|
+
{iconEnabled && (contactType === 'email' ? (
|
|
96
|
+
<Icon
|
|
97
|
+
className="svg-inline--fa envelope"
|
|
98
|
+
customIcon={envelopeIcon}
|
|
99
|
+
dark={dark}
|
|
100
|
+
fixedWidth
|
|
101
|
+
/>
|
|
102
|
+
) : (
|
|
103
|
+
<Icon
|
|
104
|
+
dark={dark}
|
|
105
|
+
fixedWidth
|
|
106
|
+
icon={contactTypeMap[contactType] || 'phone'}
|
|
107
|
+
/>
|
|
108
|
+
))}
|
|
109
|
+
{iconEnabled ? ` ${formattedValue} ` : formattedValue}
|
|
110
|
+
{contactDetail && (
|
|
111
|
+
<Caption
|
|
112
|
+
dark={dark}
|
|
113
|
+
size="xs"
|
|
114
|
+
tag="span"
|
|
115
|
+
text={contactDetail}
|
|
116
|
+
/>
|
|
117
|
+
)}
|
|
118
|
+
</>
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
// When unstyled, render just the content without Body wrapper
|
|
122
|
+
if (unstyled) {
|
|
123
|
+
return (
|
|
124
|
+
<span
|
|
125
|
+
{...ariaProps}
|
|
126
|
+
{...dataProps}
|
|
127
|
+
{...htmlProps}
|
|
128
|
+
className={classes}
|
|
129
|
+
id={id}
|
|
130
|
+
>
|
|
131
|
+
{content}
|
|
132
|
+
</span>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Default styled mode with Body wrapper
|
|
88
137
|
return (
|
|
89
138
|
<div
|
|
90
139
|
{...ariaProps}
|
|
@@ -95,33 +144,11 @@ const Contact = (props: ContactProps): React.ReactElement => {
|
|
|
95
144
|
>
|
|
96
145
|
<Body
|
|
97
146
|
className="pb_contact_kit"
|
|
98
|
-
color=
|
|
147
|
+
color="light"
|
|
99
148
|
dark={dark}
|
|
100
149
|
tag="span"
|
|
101
150
|
>
|
|
102
|
-
|
|
103
|
-
<Icon
|
|
104
|
-
className="svg-inline--fa envelope"
|
|
105
|
-
customIcon={envelopeIcon}
|
|
106
|
-
dark={dark}
|
|
107
|
-
fixedWidth
|
|
108
|
-
/>
|
|
109
|
-
) : (
|
|
110
|
-
<Icon
|
|
111
|
-
dark={dark}
|
|
112
|
-
fixedWidth
|
|
113
|
-
icon={contactTypeMap[contactType] || 'phone'}
|
|
114
|
-
/>
|
|
115
|
-
)}
|
|
116
|
-
{` ${formatContact(contactValue, contactType)} `}
|
|
117
|
-
{contactDetail && (
|
|
118
|
-
<Caption
|
|
119
|
-
dark={dark}
|
|
120
|
-
size="xs"
|
|
121
|
-
tag="span"
|
|
122
|
-
text={contactDetail}
|
|
123
|
-
/>
|
|
124
|
-
)}
|
|
151
|
+
{content}
|
|
125
152
|
</Body>
|
|
126
153
|
</div>
|
|
127
154
|
)
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
<%=
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
<% if object.unstyled %>
|
|
2
|
+
<%= content_tag :span, class: object.classname, id: object.id, data: object.data, aria: object.aria, **object.html_options do %>
|
|
3
|
+
<% if icon_enabled %>
|
|
4
|
+
<% if contact_type == "email" %>
|
|
5
|
+
<%= pb_rails("icon", props: {
|
|
6
|
+
custom_icon: Playbook::Engine::root.join(envelope_path),
|
|
7
|
+
fixed_width: true,
|
|
8
|
+
dark: object.dark
|
|
9
|
+
}) %>
|
|
10
|
+
<% else %>
|
|
11
|
+
<%= pb_rails("icon", props: {
|
|
12
|
+
icon: object.contact_icon,
|
|
13
|
+
fixed_width: true,
|
|
14
|
+
dark: object.dark
|
|
15
|
+
}) %>
|
|
16
|
+
<% end %>
|
|
17
|
+
<%= " #{object.formatted_contact_value}" if object.contact_value %>
|
|
14
18
|
<% else %>
|
|
15
|
-
<%=
|
|
16
|
-
icon: object.contact_icon,
|
|
17
|
-
fixed_width: true,
|
|
18
|
-
dark: object.dark
|
|
19
|
-
}) %>
|
|
19
|
+
<%= object.formatted_contact_value if object.contact_value %>
|
|
20
20
|
<% end %>
|
|
21
|
-
<%= object.formatted_contact_value if object.contact_value %>
|
|
22
21
|
|
|
23
22
|
<%= pb_rails("caption", props: {
|
|
24
23
|
text: object.contact_detail,
|
|
@@ -27,4 +26,39 @@
|
|
|
27
26
|
dark: object.dark
|
|
28
27
|
}) if object.contact_detail %>
|
|
29
28
|
<% end %>
|
|
29
|
+
<% else %>
|
|
30
|
+
<%= pb_content_tag do %>
|
|
31
|
+
<%= pb_rails("body", props: {
|
|
32
|
+
tag: "span",
|
|
33
|
+
classname: "pb_contact_kit",
|
|
34
|
+
color: "light",
|
|
35
|
+
dark: object.dark
|
|
36
|
+
}) do %>
|
|
37
|
+
<% if icon_enabled %>
|
|
38
|
+
<% if contact_type == "email" %>
|
|
39
|
+
<%= pb_rails("icon", props: {
|
|
40
|
+
custom_icon: Playbook::Engine::root.join(envelope_path),
|
|
41
|
+
fixed_width: true,
|
|
42
|
+
dark: object.dark
|
|
43
|
+
}) %>
|
|
44
|
+
<% else %>
|
|
45
|
+
<%= pb_rails("icon", props: {
|
|
46
|
+
icon: object.contact_icon,
|
|
47
|
+
fixed_width: true,
|
|
48
|
+
dark: object.dark
|
|
49
|
+
}) %>
|
|
50
|
+
<% end %>
|
|
51
|
+
<%= " #{object.formatted_contact_value}" if object.contact_value %>
|
|
52
|
+
<% else %>
|
|
53
|
+
<%= object.formatted_contact_value if object.contact_value %>
|
|
54
|
+
<% end %>
|
|
55
|
+
|
|
56
|
+
<%= pb_rails("caption", props: {
|
|
57
|
+
text: object.contact_detail,
|
|
58
|
+
tag: 'span',
|
|
59
|
+
size: 'xs',
|
|
60
|
+
dark: object.dark
|
|
61
|
+
}) if object.contact_detail %>
|
|
62
|
+
<% end %>
|
|
63
|
+
<% end %>
|
|
30
64
|
<% end %>
|
|
@@ -8,6 +8,8 @@ module Playbook
|
|
|
8
8
|
prop :contact_type
|
|
9
9
|
prop :contact_value
|
|
10
10
|
prop :contact_detail
|
|
11
|
+
prop :icon_enabled, type: Playbook::Props::Boolean, default: true
|
|
12
|
+
prop :unstyled, type: Playbook::Props::Boolean, default: false
|
|
11
13
|
|
|
12
14
|
def classname
|
|
13
15
|
generate_classname("pb_contact_kit")
|
|
@@ -44,7 +46,15 @@ module Playbook
|
|
|
44
46
|
elsif contact_type == "international"
|
|
45
47
|
contact_value
|
|
46
48
|
else
|
|
47
|
-
|
|
49
|
+
# Check if number has leading 1 (US country code)
|
|
50
|
+
# Format like "+1 (212) 555-1234"
|
|
51
|
+
intl_code = ""
|
|
52
|
+
cleaned_number = formatted_value
|
|
53
|
+
if cleaned_number.length == 11 && cleaned_number.start_with?("1")
|
|
54
|
+
intl_code = "+1 "
|
|
55
|
+
cleaned_number = cleaned_number.sub(/^1/, "")
|
|
56
|
+
end
|
|
57
|
+
"#{intl_code}#{number_to_phone(cleaned_number, area_code: true)}"
|
|
48
58
|
end
|
|
49
59
|
end
|
|
50
60
|
|
|
@@ -149,3 +149,79 @@ test('international contact type preserves original format', () => {
|
|
|
149
149
|
const kit = screen.getByTestId('test-international-format')
|
|
150
150
|
expect(kit).toHaveTextContent('+44 20 7946 0958')
|
|
151
151
|
})
|
|
152
|
+
|
|
153
|
+
test('iconEnabled prop hides icon when false', () => {
|
|
154
|
+
render(
|
|
155
|
+
<>
|
|
156
|
+
<Contact
|
|
157
|
+
contactType="home"
|
|
158
|
+
contactValue="2125551234"
|
|
159
|
+
data={{ testid: 'test-with-icon' }}
|
|
160
|
+
iconEnabled
|
|
161
|
+
/>
|
|
162
|
+
<Contact
|
|
163
|
+
contactType="home"
|
|
164
|
+
contactValue="2125551234"
|
|
165
|
+
data={{ testid: 'test-without-icon' }}
|
|
166
|
+
iconEnabled={false}
|
|
167
|
+
/>
|
|
168
|
+
</>
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
// With icon enabled, should have icon
|
|
172
|
+
expect(screen.getByTestId('test-with-icon').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
|
173
|
+
|
|
174
|
+
// Without icon, should not have icon
|
|
175
|
+
expect(screen.getByTestId('test-without-icon').querySelector('.pb_custom_icon')).not.toBeInTheDocument()
|
|
176
|
+
|
|
177
|
+
// But should still have the formatted phone number
|
|
178
|
+
expect(screen.getByTestId('test-without-icon')).toHaveTextContent('(212) 555-1234')
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
test('unstyled prop renders without Body wrapper', () => {
|
|
182
|
+
render(
|
|
183
|
+
<>
|
|
184
|
+
<Contact
|
|
185
|
+
contactType="home"
|
|
186
|
+
contactValue="2125551234"
|
|
187
|
+
data={{ testid: 'test-styled' }}
|
|
188
|
+
/>
|
|
189
|
+
<Contact
|
|
190
|
+
contactType="home"
|
|
191
|
+
contactValue="2125551234"
|
|
192
|
+
data={{ testid: 'test-unstyled' }}
|
|
193
|
+
unstyled
|
|
194
|
+
/>
|
|
195
|
+
</>
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
// Styled version should have Body wrapper with pb_contact_kit class
|
|
199
|
+
const styled = screen.getByTestId('test-styled')
|
|
200
|
+
const styledBody = styled.querySelector('span.pb_contact_kit')
|
|
201
|
+
expect(styledBody).toBeInTheDocument()
|
|
202
|
+
expect(styledBody).toHaveTextContent('(212) 555-1234')
|
|
203
|
+
|
|
204
|
+
// Unstyled version should be a span without Body wrapper
|
|
205
|
+
const unstyled = screen.getByTestId('test-unstyled')
|
|
206
|
+
expect(unstyled.tagName).toBe('SPAN')
|
|
207
|
+
expect(unstyled.querySelector('span.pb_contact_kit')).not.toBeInTheDocument()
|
|
208
|
+
expect(unstyled).toHaveTextContent('(212) 555-1234')
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
test('unstyled and iconEnabled work together', () => {
|
|
212
|
+
render(
|
|
213
|
+
<Contact
|
|
214
|
+
contactType="home"
|
|
215
|
+
contactValue="2125551234"
|
|
216
|
+
data={{ testid: 'test-unstyled-no-icon' }}
|
|
217
|
+
iconEnabled={false}
|
|
218
|
+
unstyled
|
|
219
|
+
/>
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
const kit = screen.getByTestId('test-unstyled-no-icon')
|
|
223
|
+
expect(kit.tagName).toBe('SPAN')
|
|
224
|
+
expect(kit.querySelector('.pb_custom_icon')).not.toBeInTheDocument()
|
|
225
|
+
expect(kit.querySelector('.pb_body_kit')).not.toBeInTheDocument()
|
|
226
|
+
expect(kit).toHaveTextContent('(212) 555-1234')
|
|
227
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<%= pb_rails("body", props: { color: "default" }) do %>
|
|
2
|
+
<%= pb_rails("contact", props: {
|
|
3
|
+
contact_value: "2125551234",
|
|
4
|
+
icon_enabled: false,
|
|
5
|
+
unstyled: true
|
|
6
|
+
}) %>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<%= pb_rails("body", props: { color: "light" }) do %>
|
|
10
|
+
<%= pb_rails("contact", props: {
|
|
11
|
+
contact_value: "12125551234",
|
|
12
|
+
icon_enabled: false,
|
|
13
|
+
unstyled: true
|
|
14
|
+
}) %>
|
|
15
|
+
<% end %>
|
|
16
|
+
|
|
17
|
+
<%= pb_rails("body", props: { color: "lighter" }) do %>
|
|
18
|
+
<%= pb_rails("contact", props: {
|
|
19
|
+
contact_value: "4155551234",
|
|
20
|
+
icon_enabled: false,
|
|
21
|
+
unstyled: true
|
|
22
|
+
}) %>
|
|
23
|
+
<% end %>
|
|
24
|
+
|
|
25
|
+
<%= pb_rails("body", props: { color: "default" }) do %>
|
|
26
|
+
<%= pb_rails("contact", props: {
|
|
27
|
+
contact_type: "extension",
|
|
28
|
+
contact_value: "1234",
|
|
29
|
+
icon_enabled: false,
|
|
30
|
+
unstyled: true
|
|
31
|
+
}) %>
|
|
32
|
+
<% end %>
|
|
33
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Contact from "../../pb_contact/_contact"
|
|
3
|
+
import Body from "../../pb_body/_body"
|
|
4
|
+
|
|
5
|
+
const ContactUnstyled = (props) => {
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<Body color="default">
|
|
9
|
+
<Contact
|
|
10
|
+
contactValue="2125551234"
|
|
11
|
+
iconEnabled={false}
|
|
12
|
+
unstyled
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
</Body>
|
|
16
|
+
<Body color="light">
|
|
17
|
+
<Contact
|
|
18
|
+
contactValue="12125551234"
|
|
19
|
+
iconEnabled={false}
|
|
20
|
+
unstyled
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
</Body>
|
|
24
|
+
<Body color="lighter">
|
|
25
|
+
<Contact
|
|
26
|
+
contactValue="4155551234"
|
|
27
|
+
iconEnabled={false}
|
|
28
|
+
unstyled
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
</Body>
|
|
32
|
+
<Body color="default">
|
|
33
|
+
<Contact
|
|
34
|
+
contactType="extension"
|
|
35
|
+
contactValue="1234"
|
|
36
|
+
iconEnabled={false}
|
|
37
|
+
unstyled
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
</Body>
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default ContactUnstyled
|
|
46
|
+
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Use the Contact kit with `icon_enabled: false` and `unstyled: true` to display phone numbers with full typography control. When `unstyled: true`, the Contact kit renders just the formatted text without a Body wrapper, allowing you to wrap it in your own Typography kit to control the color and styling.
|
|
2
|
+
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Use the Contact kit with `iconEnabled={false}` and `unstyled` to display phone numbers with full typography control. With `unstyled`, the Contact kit renders just the formatted text without a Body wrapper, allowing you to wrap it in your own Typography kit to control the color and styling.
|
|
2
|
+
|
|
@@ -3,11 +3,13 @@ examples:
|
|
|
3
3
|
rails:
|
|
4
4
|
- contact_default: Default
|
|
5
5
|
- contact_with_detail: Detail Indicator
|
|
6
|
+
- contact_unstyled: Unstyled
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
react:
|
|
9
10
|
- contact_default: Default
|
|
10
11
|
- contact_with_detail: Detail Indicator
|
|
12
|
+
- contact_unstyled: Unstyled
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
swift:
|
|
@@ -251,4 +251,28 @@ describe('DatePicker Kit', () => {
|
|
|
251
251
|
expect(input).toHaveValue(DateTime.getYearStartDate(new Date()).formatDate() + " to " + new Date().formatDate())
|
|
252
252
|
})
|
|
253
253
|
})
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
test('displays defaultDate when it is later than maxDate', async () => {
|
|
257
|
+
const testId = 'datepicker-out-of-range-after'
|
|
258
|
+
const futureDateString = '01/15/2020'
|
|
259
|
+
const maxDateString = '01/10/2020'
|
|
260
|
+
|
|
261
|
+
render(
|
|
262
|
+
<DatePicker
|
|
263
|
+
data={{ testid: testId }}
|
|
264
|
+
defaultDate={futureDateString}
|
|
265
|
+
format="m/d/Y"
|
|
266
|
+
maxDate={maxDateString}
|
|
267
|
+
pickerId="date-picker-out-of-range-after"
|
|
268
|
+
/>
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
const kit = screen.getByTestId(testId)
|
|
272
|
+
const input = within(kit).getByPlaceholderText('Select Date')
|
|
273
|
+
|
|
274
|
+
await waitFor(() => {
|
|
275
|
+
expect(input).toHaveValue('01/15/2020')
|
|
276
|
+
}, { timeout: 5000 })
|
|
277
|
+
})
|
|
254
278
|
})
|