playbook_ui 15.0.0.pre.alpha.PLAY2467contactkitinternational10329 → 15.0.0.pre.alpha.play1986inlineloadingsolidvariant10321

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f20e205eef51d77bf9ce4b5694d675e30bfbe4ef8107c96b016868302ccaba3
4
- data.tar.gz: 89c8ffe59230989390b0cb8031a47b3191bd5463b190f62465b10679a2dbf531
3
+ metadata.gz: db6853982084088c352fbaebcc9d4815525ef2e1d5b3f1bb4afd6c5b18debf49
4
+ data.tar.gz: 9953ba7ead3e65d4357fb88933055ec5b7cb65d342c93bca21485615ce3b29cd
5
5
  SHA512:
6
- metadata.gz: 6c25d0d330b79ffdc47501616db7bdbe0577c48ce9fa5d33b8ea7d6058c9ce98674d72664ca312f6d79ddaf59b662701b8a136bb0ca589447c4ea8b72bbf97a8
7
- data.tar.gz: f42561f7ad3f69134d46779d00d75c0aff2998c042a0c6ef5839131c80f788559de516772297a606049a2827222b863d0b434febf32ca28d0aadca4cb8e7b0c4
6
+ metadata.gz: e5c749fac180a2f02edeacd6b41e36b8bfb917dc6f60cb6fac3ef2e70947a87adf64526cbf96fefeeb26e73d973f650970cb0101d3c4e16b77e5ec45aa7bf041
7
+ data.tar.gz: bbd0144bb4d40303864e5f804d78a1aa2eb6f585c7d66809c15a097d03de7ddcb5d12a2083e293694738873d292cbbac668ccc00c5a0342c69a49f6182a33023
@@ -17,7 +17,6 @@ const contactTypeMap: { [key: string]: string } = {
17
17
  'work': 'phone-office',
18
18
  'work-cell': 'phone-laptop',
19
19
  'wrong-phone': 'phone-slash',
20
- 'international': 'globe',
21
20
  }
22
21
 
23
22
  const envelopeIcon = getAllIcons()["envelope"].icon as unknown as { [key: string]: SVGElement }
@@ -25,10 +24,6 @@ const envelopeIcon = getAllIcons()["envelope"].icon as unknown as { [key: string
25
24
  const formatContact = (contactString: string, contactType: string) => {
26
25
  if (contactType === 'email') return contactString
27
26
 
28
- // International phone numbers are unformatted
29
- if (contactType === 'international') return contactString
30
-
31
- // Format US numbers
32
27
  const cleaned = contactString.replace(/\D/g, '')
33
28
  const phoneNumber = cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/)
34
29
 
@@ -29,8 +29,6 @@ module Playbook
29
29
  "phone-slash"
30
30
  when "extension"
31
31
  "phone-plus"
32
- when "international"
33
- "globe"
34
32
  else # "unknown" || "other"
35
33
  "phone"
36
34
  end
@@ -41,8 +39,6 @@ module Playbook
41
39
  contact_value
42
40
  elsif contact_type == "extension" && contact_value.match(/^\d{4}$/)
43
41
  contact_value
44
- elsif contact_type == "international"
45
- contact_value
46
42
  else
47
43
  number_to_phone(formatted_value, area_code: true)
48
44
  end
@@ -66,12 +66,6 @@ test('returns correct icon', () => {
66
66
  contactValue="1234"
67
67
  data={{ testid: 'test-extension' }}
68
68
  />
69
- <Contact
70
- contactDetail="International"
71
- contactType="international"
72
- contactValue="+44 20 7946 0958"
73
- data={{ testid: 'test-international' }}
74
- />
75
69
  <Contact
76
70
  contactDetail=""
77
71
  contactType=""
@@ -89,11 +83,10 @@ test('returns correct icon', () => {
89
83
  expect(screen.getByTestId('test-wrong-phone').querySelector('.pb_custom_icon')).toBeInTheDocument()
90
84
  expect(screen.getByTestId('test-wrong-type').querySelector('.pb_custom_icon')).toBeInTheDocument()
91
85
  expect(screen.getByTestId('test-extension').querySelector('.pb_custom_icon')).toBeInTheDocument()
92
- expect(screen.getByTestId('test-international').querySelector('.pb_custom_icon')).toBeInTheDocument()
93
86
  expect(screen.getByTestId('test-empty').querySelector('.pb_custom_icon')).toBeInTheDocument()
94
87
  })
95
88
 
96
- test("not compliant values return null in US phone related contact types", () => {
89
+ test("not compliant values return null in phone related contact types", () => {
97
90
  const notCompliantValues = [
98
91
  "349-185-998223",
99
92
  "349-1858",
@@ -136,16 +129,3 @@ test("not compliant values return null in US phone related contact types", () =>
136
129
  )
137
130
  })
138
131
  })
139
-
140
- test('international contact type preserves original format', () => {
141
- render(
142
- <Contact
143
- contactType="international"
144
- contactValue="+44 20 7946 0958"
145
- data={{ testid: 'test-international-format' }}
146
- />
147
- )
148
-
149
- const kit = screen.getByTestId('test-international-format')
150
- expect(kit).toHaveTextContent('+44 20 7946 0958')
151
- })
@@ -13,7 +13,7 @@
13
13
  }) %>
14
14
 
15
15
  <%= pb_rails("contact", props: {
16
- contact_type: "work",
16
+ contact_type: "wrong number",
17
17
  contact_value: "3245627482",
18
18
  }) %>
19
19
 
@@ -21,18 +21,3 @@
21
21
  contact_type: "work-cell",
22
22
  contact_value: "349-185-9988",
23
23
  }) %>
24
-
25
- <%= pb_rails("contact", props: {
26
- contact_type: "wrong-phone",
27
- contact_value: "2124396666",
28
- }) %>
29
-
30
- <%= pb_rails("contact", props: {
31
- contact_type: "extension",
32
- contact_value: "1233",
33
- }) %>
34
-
35
- <%= pb_rails("contact", props: {
36
- contact_type: "international",
37
- contact_value: "+44 7700 900461",
38
- }) %>
@@ -28,21 +28,6 @@ const ContactDefault = (props) => {
28
28
  contactValue="3245627482"
29
29
  {...props}
30
30
  />
31
- <Contact
32
- contactType="wrong-phone"
33
- contactValue="2124396666"
34
- {...props}
35
- />
36
- <Contact
37
- contactType='extension'
38
- contactValue="1234"
39
- {...props}
40
- />
41
- <Contact
42
- contactType="international"
43
- contactValue="+44 7700 900461"
44
- {...props}
45
- />
46
31
  </div>
47
32
  )
48
33
  }
@@ -26,9 +26,3 @@
26
26
  contact_value: "1233",
27
27
  contact_detail: "Ext",
28
28
  }) %>
29
-
30
- <%= pb_rails("contact", props: {
31
- contact_type: "international",
32
- contact_value: "+44 7700 900461",
33
- contact_detail: "International",
34
- }) %>
@@ -33,12 +33,6 @@ const ContactDefault = (props) => {
33
33
  contactValue="1234"
34
34
  {...props}
35
35
  />
36
- <Contact
37
- contactDetail="International"
38
- contactType="international"
39
- contactValue="+44 7700 900461"
40
- {...props}
41
- />
42
36
  </div>
43
37
  )
44
38
  }
@@ -16,6 +16,7 @@ type LoadingInlineProps = {
16
16
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
17
17
  id?: string,
18
18
  text?: string,
19
+ variant?: "dotted" | "solid" ,
19
20
  }
20
21
 
21
22
  const LoadingInline = (props: LoadingInlineProps) => {
@@ -28,6 +29,7 @@ const LoadingInline = (props: LoadingInlineProps) => {
28
29
  htmlOptions = {},
29
30
  id,
30
31
  text = ' Loading',
32
+ variant = 'dotted',
31
33
  } = props
32
34
 
33
35
  const ariaProps = buildAriaProps(aria)
@@ -54,7 +56,7 @@ const LoadingInline = (props: LoadingInlineProps) => {
54
56
  <Icon
55
57
  aria={{ label: 'loading icon' }}
56
58
  fixedWidth
57
- icon="spinner"
59
+ icon={variant === 'dotted' ? 'spinner' : variant === 'solid' ? 'spinner-solid' : undefined}
58
60
  pulse
59
61
  />
60
62
  {text}
@@ -0,0 +1,5 @@
1
+ <%= pb_rails("loading_inline", props: {text: "Dotted Spinner", variant: "dotted"}) %>
2
+
3
+ <br/>
4
+
5
+ <%= pb_rails("loading_inline", props: {text: "Solid Spinner", variant: "solid"}) %>
@@ -0,0 +1,24 @@
1
+ import React from 'react'
2
+ import { LoadingInline } from 'playbook-ui'
3
+
4
+ const LoadingInlineVariant = (props) => {
5
+ return (
6
+ <div>
7
+ <LoadingInline
8
+ text=" Dotted Spinner"
9
+ variant="dotted"
10
+ {...props}
11
+ />
12
+
13
+ <br />
14
+
15
+ <LoadingInline
16
+ text=" Solid Spinner"
17
+ variant="solid"
18
+ {...props}
19
+ />
20
+ </div>
21
+ )
22
+ }
23
+
24
+ export default LoadingInlineVariant
@@ -3,9 +3,11 @@ examples:
3
3
  rails:
4
4
  - loading_inline_default: Default
5
5
  - loading_inline_custom: Custom Text
6
+ - loading_inline_variant: Variant
6
7
 
7
8
 
8
9
 
9
10
  react:
10
11
  - loading_inline_default: Default
11
12
  - loading_inline_custom: Custom Text
13
+ - loading_inline_variant: Variant
@@ -1,2 +1,3 @@
1
1
  export { default as LoadingInlineDefault } from './_loading_inline_default.jsx'
2
2
  export { default as LoadingInlineCustom } from './_loading_inline_custom.jsx'
3
+ export { default as LoadingInlineVariant } from './_loading_inline_variant.jsx'
@@ -1,6 +1,6 @@
1
1
  <%= pb_content_tag do %>
2
2
 
3
3
  <%= pb_rails("body", props: { color: "light", dark: object.dark }) do %>
4
- <%= pb_rails("icon", props: { aria: { label: "loading icon" }, fixed_width: true, icon: "spinner", pulse: true }) %> <%= object.text %>
4
+ <%= pb_rails("icon", props: { aria: { label: "loading icon" }, fixed_width: true, icon: object.spinner_icon, pulse: true }) %> <%= object.text %>
5
5
  <% end %>
6
6
  <% end %>
@@ -8,10 +8,21 @@ module Playbook
8
8
  default: "left"
9
9
  prop :dark, type: Playbook::Props::Boolean, default: false
10
10
  prop :text, type: Playbook::Props::String, default: "Loading"
11
+ prop :variant, type: Playbook::Props::Enum,
12
+ values: %w[dotted solid],
13
+ default: "dotted"
11
14
 
12
15
  def classname
13
16
  generate_classname("pb_loading_inline_kit", align)
14
17
  end
18
+
19
+ def spinner_icon
20
+ if variant == "dotted"
21
+ "spinner"
22
+ elsif variant == "solid"
23
+ "spinner-solid"
24
+ end
25
+ end
15
26
  end
16
27
  end
17
28
  end