playbook_ui 14.25.0.pre.alpha.PLAY2467contactkitinternational10238 → 14.25.0.pre.alpha.play1986inlineloadingsolidvariant9963
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_contact/_contact.tsx +0 -5
- data/app/pb_kits/playbook/pb_contact/contact.rb +0 -4
- data/app/pb_kits/playbook/pb_contact/contact.test.js +1 -21
- data/app/pb_kits/playbook/pb_contact/docs/_contact_default.html.erb +1 -16
- data/app/pb_kits/playbook/pb_contact/docs/_contact_default.jsx +0 -15
- data/app/pb_kits/playbook/pb_contact/docs/_contact_with_detail.html.erb +0 -6
- data/app/pb_kits/playbook/pb_contact/docs/_contact_with_detail.jsx +0 -6
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +3 -1
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.html.erb +5 -0
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.jsx +24 -0
- data/app/pb_kits/playbook/pb_loading_inline/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_loading_inline/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +1 -1
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.rb +11 -0
- data/dist/chunks/{_weekday_stacked-CCRPiVBv.js → _weekday_stacked-BkvHv3ZO.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +5 -4
- data/app/pb_kits/playbook/pb_contact/docs/_contact_default.md +0 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0ee315a459262d17524d4034ee8ee267a36cb55a6bff5ab517eded1823079b82
         | 
| 4 | 
            +
              data.tar.gz: 214124df5701381babad6d1c668e2d821852a12ea69e76c654b80142005b86ef
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c809a3b70d4575e569eb8651e363753b1ddf1d8b655158d1c0028eeee1510007c2c029d4e425571b9dd27258573f07344b2b8bb4880cf0a1a48e98cdfdf8010a
         | 
| 7 | 
            +
              data.tar.gz: c36c53928fcc035ce43a88d6f3523b71895d49eae26ab8231984df5517a18724fa9801c0e130f20f31545e31c2ba3d666080b74ba7f53c73d1af83487aa77bad
         | 
| @@ -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  | 
| 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: " | 
| 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 | 
             
            }
         | 
| @@ -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= | 
| 59 | 
            +
                        icon={variant === 'dotted' ? 'spinner' : variant === 'solid' ? 'spinner-solid' : undefined}
         | 
| 58 60 | 
             
                        pulse
         | 
| 59 61 | 
             
                    />
         | 
| 60 62 | 
             
                    {text}
         | 
| @@ -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,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:  | 
| 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
         |