playbook_ui 13.15.0.pre.alpha.1132globalpropdatepickerspacing1929 → 13.16.0.pre.alpha.PLAY11641991

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +3 -2
  3. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +1 -43
  4. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -2
  5. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +1 -15
  6. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +40 -33
  7. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +4 -4
  8. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +2 -1
  9. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +44 -30
  10. data/app/pb_kits/playbook/pb_flex/_flex.tsx +4 -4
  11. data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +3 -2
  12. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +7 -4
  13. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +10 -10
  14. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +10 -9
  15. data/app/pb_kits/playbook/pb_icon/_icon.tsx +28 -16
  16. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.html.erb +5 -11
  17. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.jsx +44 -18
  18. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.md +7 -12
  19. data/app/pb_kits/playbook/pb_icon/icon.html.erb +6 -4
  20. data/app/pb_kits/playbook/pb_icon/icon.rb +10 -10
  21. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +3 -2
  22. data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +3 -2
  23. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +51 -50
  24. data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +20 -19
  25. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +4 -3
  26. data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -4
  27. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +20 -20
  28. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +4 -4
  29. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorButton.tsx +19 -17
  30. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorTypes.ts +1 -1
  31. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +23 -21
  32. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +18 -10
  33. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +46 -23
  34. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarHistory.tsx +8 -8
  35. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarNodes.tsx +7 -7
  36. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +17 -15
  37. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +9 -7
  38. data/app/pb_kits/playbook/pb_select/_select.scss +13 -4
  39. data/app/pb_kits/playbook/pb_select/_select.tsx +7 -4
  40. data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.html.erb +24 -0
  41. data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.jsx +38 -0
  42. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  43. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  44. data/app/pb_kits/playbook/pb_select/select.rb +6 -1
  45. data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +25 -24
  46. data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +27 -26
  47. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +2 -1
  48. data/app/pb_kits/playbook/pb_source/_source.tsx +15 -15
  49. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -0
  50. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -4
  51. data/app/pb_kits/playbook/pb_text_input/text_input.rb +1 -5
  52. data/dist/playbook-rails.js +4 -4
  53. data/lib/playbook/version.rb +2 -2
  54. metadata +4 -2
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { ReactSVGElement } from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { GlobalProps, globalProps } from '../utilities/globalProps'
@@ -27,7 +27,7 @@ type IconProps = {
27
27
  data?: {[key: string]: string},
28
28
  fixedWidth?: boolean,
29
29
  flip?: "horizontal" | "vertical" | "both" | "none",
30
- icon: string,
30
+ icon: string | ReactSVGElement,
31
31
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
32
32
  id?: string,
33
33
  inverse?: boolean,
@@ -57,7 +57,7 @@ const Icon = (props: IconProps) => {
57
57
  fixedWidth = true,
58
58
  flip = "none",
59
59
  htmlOptions = {},
60
- icon,
60
+ icon = "",
61
61
  id,
62
62
  inverse = false,
63
63
  listItem = false,
@@ -79,19 +79,19 @@ const Icon = (props: IconProps) => {
79
79
  [`fa-${size}`]: size,
80
80
  [`fa-pull-${pull}`]: pull,
81
81
  [`fa-rotate-${rotation}`]: rotation,
82
-
83
82
  }
84
83
 
85
- // Lets check and see if the icon prop is referring to a custom Power icon...
86
- // If so, then set fa-icon to "custom"
87
- // this ensures the JS will not do any further operations
88
- // faClasses[`fa-${icon}`] = customIcon ? 'custom' : icon
89
- if (!customIcon) faClasses[`fa-${icon}`] = icon
90
-
84
+ const iconURL = typeof(icon) === 'string' && icon.includes('.svg') ? icon : null
85
+ const iconElement: ReactSVGElement | null = typeof(icon) === "object" ? icon : null
86
+
87
+ const isFA = !iconElement && !customIcon && !iconURL
88
+
89
+ if (isFA) faClasses[`fa-${icon}`] = icon as string
90
+
91
91
  const classes = classnames(
92
92
  flipMap[flip],
93
93
  'pb_icon_kit',
94
- customIcon ? '' : fontStyle,
94
+ (iconElement || customIcon) ? '' : fontStyle,
95
95
  faClasses,
96
96
  globalProps(props),
97
97
  className
@@ -110,11 +110,11 @@ const Icon = (props: IconProps) => {
110
110
 
111
111
  // Add a conditional here to show only the SVG if custom
112
112
  const displaySVG = (customIcon: any) => {
113
- if (customIcon)
113
+ if (iconElement || customIcon)
114
114
  return (
115
115
  <>
116
116
  {
117
- React.cloneElement(customIcon, {
117
+ React.cloneElement(iconElement || customIcon, {
118
118
  ...dataProps,
119
119
  ...htmlProps,
120
120
  className: classes,
@@ -123,7 +123,7 @@ const Icon = (props: IconProps) => {
123
123
  }
124
124
  </>
125
125
  )
126
- else if (isValidEmoji(icon))
126
+ else if (isValidEmoji(icon as string))
127
127
  return (
128
128
  <>
129
129
  <span
@@ -136,7 +136,19 @@ const Icon = (props: IconProps) => {
136
136
  </span>
137
137
  </>
138
138
  )
139
-
139
+ else if (iconURL)
140
+ return (
141
+ <>
142
+ <span
143
+ {...dataProps}
144
+ {...htmlProps}
145
+ className={classesEmoji}
146
+ id={id}
147
+ >
148
+ <img src={iconURL} />
149
+ </span>
150
+ </>
151
+ )
140
152
  else
141
153
  return (
142
154
  <>
@@ -161,4 +173,4 @@ const Icon = (props: IconProps) => {
161
173
  )
162
174
  }
163
175
 
164
- export default Icon
176
+ export default Icon
@@ -2,15 +2,9 @@
2
2
  <div class="icon-wrapper">
3
3
 
4
4
  <% svg_url = "https://upload.wikimedia.org/wikipedia/commons/3/3b/Wrench_font_awesome.svg" %>
5
- <p><%= pb_rails("icon", props: { custom_icon: svg_url } ) %></p>
6
- <p><%= pb_rails("icon", props: { rotation: 90, custom_icon: svg_url, size: "2x" } ) %></p>
7
- <p><%= pb_rails("icon", props: { spin: true, custom_icon: svg_url, size: "3x" } ) %></p>
8
- <p><%= pb_rails("icon", props: { size: "5x", custom_icon: svg_url } ) %></p>
9
- <p><%= pb_rails("icon", props: { flip: "horizontal", size: "5x", custom_icon: svg_url } ) %></p>
10
-
11
- <%= pb_rails("body", props: {
12
- text: "Custom icons are compatible with other icon props (size, rotation,
13
- spin, flip, etc). Their SVG fill colors will be inherited from
14
- parent element's css color properties."
15
- } ) %>
5
+ <p><%= pb_rails("icon", props: { icon: svg_url } ) %></p>
6
+ <p><%= pb_rails("icon", props: { rotation: 90, icon: svg_url, size: "2x" } ) %></p>
7
+ <p><%= pb_rails("icon", props: { spin: true, icon: svg_url, size: "3x" } ) %></p>
8
+ <p><%= pb_rails("icon", props: { size: "5x", icon: svg_url } ) %></p>
9
+ <p><%= pb_rails("icon", props: { flip: "horizontal", size: "5x", icon: svg_url } ) %></p>
16
10
  </div>
@@ -1,33 +1,59 @@
1
1
  import React from 'react'
2
2
  import { Icon } from '../../'
3
3
 
4
- // import Icons as config from 'power-icons'
5
4
  const config = {
6
- moon: (
7
- <svg
8
- ariaHidden="true"
9
- focusable="false"
10
- role="img"
11
- viewBox="0 0 512 512"
5
+ icon: (
6
+ <svg viewBox="0 -256 1792 1792"
12
7
  xmlns="http://www.w3.org/2000/svg"
13
8
  >
14
- <path
15
- d="M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm16 352c0 8.8-7.2 16-16 16H288l-12.8 9.6L208 428v-60H64c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16h384c8.8 0 16 7.2 16 16v288zM336 184h-56v-56c0-8.8-7.2-16-16-16h-16c-8.8 0-16 7.2-16 16v56h-56c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16h56v56c0 8.8 7.2 16 16 16h16c8.8 0 16-7.2 16-16v-56h56c8.8 0 16-7.2 16-16v-16c0-8.8-7.2-16-16-16z"
16
- fill="currentColor"
17
- />
9
+ <g transform="matrix(1,0,0,-1,53.152542,1217.0847)">
10
+ <path d="m 384,64 q 0,26 -19,45 -19,19 -45,19 -26,0 -45,-19 -19,-19 -19,-45 0,-26 19,-45 19,-19 45,-19 26,0 45,19 19,19 19,45 z m 644,420 -682,-682 q -37,-37 -90,-37 -52,0 -91,37 L 59,-90 Q 21,-54 21,0 21,53 59,91 L 740,772 Q 779,674 854.5,598.5 930,523 1028,484 z m 634,435 q 0,-39 -23,-106 Q 1592,679 1474.5,595.5 1357,512 1216,512 1031,512 899.5,643.5 768,775 768,960 q 0,185 131.5,316.5 131.5,131.5 316.5,131.5 58,0 121.5,-16.5 63.5,-16.5 107.5,-46.5 16,-11 16,-28 0,-17 -16,-28 L 1152,1120 V 896 l 193,-107 q 5,3 79,48.5 74,45.5 135.5,81 61.5,35.5 70.5,35.5 15,0 23.5,-10 8.5,-10 8.5,-25 z" />
11
+ </g>
18
12
  </svg>
19
13
  ),
20
14
  }
21
15
 
22
16
  const IconCustom = (props) => {
23
17
  return (
24
- <div>
25
- <Icon
26
- customIcon={config.moon}
27
- size="7x"
28
- {...props}
29
- />
30
- </div>
18
+ <React.Fragment>
19
+ <p>
20
+ <Icon
21
+ icon={config.icon}
22
+ {...props}
23
+ />
24
+ </p>
25
+ <p>
26
+ <Icon
27
+ icon={config.icon}
28
+ rotation={90}
29
+ size="2x"
30
+ {...props}
31
+ />
32
+ </p>
33
+ <p>
34
+ <Icon
35
+ icon={config.icon}
36
+ size="3x"
37
+ spin
38
+ {...props}
39
+ />
40
+ </p>
41
+ <p>
42
+ <Icon
43
+ icon={config.icon}
44
+ size="5x"
45
+ {...props}
46
+ />
47
+ </p>
48
+ <p>
49
+ <Icon
50
+ flip="horizontal"
51
+ icon={config.icon}
52
+ size="5x"
53
+ {...props}
54
+ />
55
+ </p>
56
+ </React.Fragment>
31
57
  )
32
58
  }
33
59
 
@@ -1,19 +1,14 @@
1
1
  # Tips for Custom Icons
2
2
 
3
- When using custom icons it is important to introduce a "clean" SVG. In order to ensure these custom icons perform as intended within your kit(s), ensure these things have been modified from the original SVG markup:
4
-
5
- Attributes must be React compatible e.g. <code>xmlns:xlink</code> should be <code>xmlnsXlink</code> and so on. <strong>There should be no hyphenated attributes and no semi-colons!.</strong>
6
-
7
- Fill colors with regards to <code>g</code> or <code>path</code> nodes, e.g. <code>fill="black"</code>, should be replaced with <code>currentColor</code> ala <code>fill="currentColor"</code>. Your mileage may vary depending on the complexity of your SVG.
8
-
9
- Pay attention to your custom icon's dimensions and `viewBox` attribute. It is best to use a `viewBox="0 0 512 512"` starting point __when designing instead of trying to retrofit the viewbox afterwards__!
10
-
11
- You must source *your own SVG into component/view* you are working on. This can easily be done in programmatic and maintainable ways.
12
-
13
3
  ### React
14
4
 
15
- So long as you have a valid React `<SVG>` node, you can send it as the `customIcon` prop and the kit will take care of the rest.
5
+ - Providing a valid React `<SVG>` element to the `icon` prop results in an `<SVG>` node within the working view.
6
+ - Sending the absolute path to your SVG (e.g. `/my/path/to/icon.svg`) results in an `img` node with the `src` attribute set to the provided path:
7
+
8
+ ```html
9
+ <img src="host.com/my/path/to/icon.svg" />
10
+ ```
16
11
 
17
12
  ### Rails
18
13
 
19
- Some Rails applications use only webpack(er) which means using `image_url` will be successful over `image_path` in most cases especially development where Webpack Dev Server is serving assets over HTTP. Rails applications still using Asset Pipeline may use `image_path` or `image_url`. Of course, YMMV depending on any custom configurations in your Rails application.
14
+ Sending the absolute path to the `icon` prop results in an `<SVG>` tag within the working view.
@@ -1,7 +1,9 @@
1
- <% if object.custom_icon %>
2
- <%= object.render_svg(object.custom_icon) %>
3
- <% elsif object.valid_emoji(object.icon) %>
4
- <span class="pb_icon_kit_emoji"><%= object.icon.html_safe %></span>
1
+ <% if object.is_svg? %>
2
+ <%= object.render_svg %>
3
+ <% elsif object.valid_emoji? %>
4
+ <span class="pb_icon_kit_emoji">
5
+ <%= object.icon.html_safe %>
6
+ </span>
5
7
  <% else %>
6
8
  <%= content_tag(:i, nil,
7
9
  id: object.id,
@@ -38,7 +38,7 @@ module Playbook
38
38
  prop :spin, type: Playbook::Props::Boolean,
39
39
  default: false
40
40
 
41
- def valid_emoji(icon)
41
+ def valid_emoji?
42
42
  emoji_regex = /\p{Emoji}/
43
43
  emoji_regex.match?(icon)
44
44
  end
@@ -79,15 +79,15 @@ module Playbook
79
79
  )
80
80
  end
81
81
 
82
- def render_svg(path)
83
- if File.extname(path) == ".svg"
84
- doc = Nokogiri::XML(URI.open(path)) # rubocop:disable Security/Open
85
- svg = doc.at_css "svg"
86
- svg["class"] = "pb_custom_icon " + object.custom_icon_classname
87
- raw doc
88
- else
89
- raise("Custom icon must be an svg. Please check your path and file type.")
90
- end
82
+ def render_svg
83
+ doc = Nokogiri::XML(URI.open(icon || custom_icon)) # rubocop:disable Security/Open
84
+ svg = doc.at_css "svg"
85
+ svg["class"] = "pb_custom_icon " + object.custom_icon_classname
86
+ raw doc
87
+ end
88
+
89
+ def is_svg?
90
+ (icon || custom_icon).include?(".svg")
91
91
  end
92
92
 
93
93
  private
@@ -9,11 +9,12 @@ import Caption from '../pb_caption/_caption'
9
9
  import Flex from '../pb_flex/_flex'
10
10
  import IconCircle from '../pb_icon_circle/_icon_circle'
11
11
  import Title from '../pb_title/_title'
12
+ import { GenericObject } from '../types'
12
13
 
13
14
  type IconStatValueProps = {
14
15
  aria?: { [key: string]: string },
15
16
  className?: string,
16
- data?: object,
17
+ data?: GenericObject,
17
18
  dark?: boolean,
18
19
  icon: string,
19
20
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
@@ -34,7 +35,7 @@ type IconStatValueProps = {
34
35
  | "green",
35
36
  }
36
37
 
37
- const IconStatValue = (props: IconStatValueProps) => {
38
+ const IconStatValue = (props: IconStatValueProps): React.ReactElement => {
38
39
  const {
39
40
  aria = {},
40
41
  className,
@@ -6,20 +6,21 @@ import { globalProps } from '../utilities/globalProps'
6
6
 
7
7
  import Body from '../pb_body/_body'
8
8
  import Icon from '../pb_icon/_icon'
9
+ import { GenericObject } from '../types'
9
10
 
10
11
  type IconValueProps = {
11
12
  align?: "left" | "center" | "right",
12
13
  aria?: { [key: string]: string; },
13
14
  className?: string,
14
15
  dark?: boolean,
15
- data?: object,
16
+ data?: GenericObject,
16
17
  icon: string,
17
18
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
18
19
  id?: string,
19
20
  text: string,
20
21
  }
21
22
 
22
- const IconValue = (props: IconValueProps) => {
23
+ const IconValue = (props: IconValueProps): React.ReactElement => {
23
24
  const {
24
25
  align = 'left',
25
26
  aria = {},
@@ -13,25 +13,26 @@ import Flex from '../pb_flex/_flex'
13
13
  import Icon from '../pb_icon/_icon'
14
14
  import PbReactPopover from '../pb_popover/_popover'
15
15
  import TextInput from '../pb_text_input/_text_input'
16
+ import { GenericObject } from "../types"
16
17
 
17
18
  type PassphraseProps = {
18
19
  aria?: { [key: string]: string },
19
20
  confirmation?: boolean,
20
21
  className?: string,
21
- data?: object,
22
+ data?: GenericObject,
22
23
  dark?: boolean,
23
24
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
24
25
  id?: string,
25
- inputProps?: {},
26
+ inputProps?: GenericObject,
26
27
  label?: string,
27
- onChange: (inputValue: String) => void,
28
+ onChange: (inputValue: string) => void,
28
29
  showTipsBelow?: "always" | "xs" | "sm" | "md" | "lg" | "xl",
29
30
  tips?: Array<string>,
30
31
  uncontrolled?: boolean,
31
32
  value: string,
32
33
  }
33
34
 
34
- const Passphrase = (props: PassphraseProps) => {
35
+ const Passphrase = (props: PassphraseProps): React.ReactElement => {
35
36
  const {
36
37
  aria = {},
37
38
  className,
@@ -42,7 +43,7 @@ const Passphrase = (props: PassphraseProps) => {
42
43
  id,
43
44
  inputProps = {},
44
45
  label = confirmation ? "Confirm Passphrase" : "Passphrase",
45
- onChange = () => { },
46
+ onChange = () => undefined,
46
47
  showTipsBelow = "always",
47
48
  tips = [],
48
49
  uncontrolled = false,
@@ -84,60 +85,60 @@ const Passphrase = (props: PassphraseProps) => {
84
85
  globalProps(props),
85
86
  className
86
87
  )
87
- const dataProps = buildDataProps(data)
88
- const htmlProps = buildHtmlProps(htmlOptions)
88
+ const dataProps = buildDataProps(data)
89
+ const htmlProps = buildHtmlProps(htmlOptions)
89
90
 
90
91
  const popoverReference = (
91
92
  <CircleIconButton
92
- className={tipClass}
93
- dark={dark}
94
- icon="info-circle"
95
- onClick={toggleShowPopover}
96
- variant="link"
93
+ className={tipClass}
94
+ dark={dark}
95
+ icon="info-circle"
96
+ onClick={toggleShowPopover}
97
+ variant="link"
97
98
  />
98
99
  )
99
100
 
100
101
  return (
101
102
  <div
102
- {...ariaProps}
103
- {...dataProps}
104
- {...htmlProps}
105
- className={classes}
106
- id={id}
103
+ {...ariaProps}
104
+ {...dataProps}
105
+ {...htmlProps}
106
+ className={classes}
107
+ id={id}
107
108
  >
108
109
  <label>
109
110
  <Flex align="baseline">
110
111
  <Caption
111
- className="passphrase-label"
112
- text={label}
112
+ className="passphrase-label"
113
+ text={label}
113
114
  />
114
115
  {tips.length > 0 && !confirmation &&
115
116
  <PbReactPopover
116
- className="passphrase-tips"
117
- closeOnClick="outside"
118
- placement="right"
119
- reference={popoverReference}
120
- shouldClosePopover={handleShouldClosePopover}
121
- show={showPopover}
117
+ className="passphrase-tips"
118
+ closeOnClick="outside"
119
+ placement="right"
120
+ reference={popoverReference}
121
+ shouldClosePopover={handleShouldClosePopover}
122
+ show={showPopover}
122
123
  >
123
124
  <Flex
124
- align="center"
125
- orientation="column"
125
+ align="center"
126
+ orientation="column"
126
127
  >
127
128
  <Caption
128
- marginBottom="xs"
129
- text="Tips for a good passphrase"
129
+ marginBottom="xs"
130
+ text="Tips for a good passphrase"
130
131
  />
131
132
  <div>
132
133
  {tips.map((tip, i) => (
133
134
  <Caption
134
- key={i}
135
- marginBottom="xs"
136
- size="xs"
135
+ key={i}
136
+ marginBottom="xs"
137
+ size="xs"
137
138
  >
138
139
  <Icon
139
- icon="shield-check"
140
- marginRight="xs"
140
+ icon="shield-check"
141
+ marginRight="xs"
141
142
  />
142
143
  {tip}
143
144
  </Caption>
@@ -149,30 +150,30 @@ const Passphrase = (props: PassphraseProps) => {
149
150
  </Flex>
150
151
  <div className="passphrase-text-input-wrapper">
151
152
  <TextInput
152
- className="passphrase-text-input"
153
- dark={dark}
154
- marginBottom="xs"
155
- onChange={handleChange}
156
- placeholder="Enter a passphrase..."
157
- type={showPassphrase ? "text" : "password"}
158
- value={displayValue}
159
- {...inputProps}
153
+ className="passphrase-text-input"
154
+ dark={dark}
155
+ marginBottom="xs"
156
+ onChange={handleChange}
157
+ placeholder="Enter a passphrase..."
158
+ type={showPassphrase ? "text" : "password"}
159
+ value={displayValue}
160
+ {...inputProps}
160
161
  />
161
162
  <span
162
- className="show-passphrase-icon"
163
- onClick={toggleShowPassphrase}
163
+ className="show-passphrase-icon"
164
+ onClick={toggleShowPassphrase}
164
165
  >
165
166
  <Body
166
- className={showPassphrase ? "hide-icon" : ""}
167
- color="light"
168
- dark={dark}
167
+ className={showPassphrase ? "hide-icon" : ""}
168
+ color="light"
169
+ dark={dark}
169
170
  >
170
171
  <Icon icon="eye-slash" />
171
172
  </Body>
172
173
  <Body
173
- className={showPassphrase ? "" : "hide-icon"}
174
- color="light"
175
- dark={dark}
174
+ className={showPassphrase ? "" : "hide-icon"}
175
+ color="light"
176
+ dark={dark}
176
177
  >
177
178
  <Icon icon="eye" />
178
179
  </Body>
@@ -7,6 +7,7 @@ import { globalProps } from '../utilities/globalProps'
7
7
  import Caption from '../pb_caption/_caption'
8
8
  import Contact from '../pb_contact/_contact'
9
9
  import Person from '../pb_person/_person'
10
+ import { GenericObject } from '../types'
10
11
 
11
12
  type ContactItem = {
12
13
  contactType: string,
@@ -17,7 +18,7 @@ type ContactItem = {
17
18
  type PersonContactProps = {
18
19
  aria?: { [key: string]: string },
19
20
  className?: string | string[],
20
- data?: object,
21
+ data?: GenericObject,
21
22
  firstName: string,
22
23
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
23
24
  id?: string,
@@ -25,7 +26,7 @@ type PersonContactProps = {
25
26
  contacts?: ContactItem[],
26
27
  }
27
28
 
28
- const PersonContact = (props: PersonContactProps) => {
29
+ const PersonContact = (props: PersonContactProps): React.ReactElement => {
29
30
  const {
30
31
  aria = {},
31
32
  className,
@@ -60,35 +61,35 @@ const PersonContact = (props: PersonContactProps) => {
60
61
 
61
62
  return (
62
63
  <div
63
- {...ariaProps}
64
- {...dataProps}
65
- {...htmlProps}
66
- className={classes}
67
- id={id}
64
+ {...ariaProps}
65
+ {...dataProps}
66
+ {...htmlProps}
67
+ className={classes}
68
+ id={id}
68
69
  >
69
70
  <Person
70
- firstName={firstName}
71
- lastName={lastName}
71
+ firstName={firstName}
72
+ lastName={lastName}
72
73
  />
73
74
  {validContacts().map((contactObject, index) => (
74
75
  <Contact
75
- contactDetail={contactObject.contactDetail}
76
- contactType={contactObject.contactType}
77
- contactValue={contactObject.contactValue}
78
- key={`valid-contact-${index}`}
76
+ contactDetail={contactObject.contactDetail}
77
+ contactType={contactObject.contactType}
78
+ contactValue={contactObject.contactValue}
79
+ key={`valid-contact-${index}`}
79
80
  />
80
81
  ))}
81
82
  {wrongContacts().map((contactObject, index) => (
82
83
  <div key={`wrong-contact-caption-wrapper-${index}`}>
83
84
  <Caption
84
- className="wrong_numbers"
85
- key={`wrong-contact-caption-${index}`}
86
- text="wrong number"
85
+ className="wrong_numbers"
86
+ key={`wrong-contact-caption-${index}`}
87
+ text="wrong number"
87
88
  />
88
89
  <Contact
89
- contactType={contactObject.contactType}
90
- contactValue={contactObject.contactValue}
91
- key={`wrong-contact-${index}`}
90
+ contactType={contactObject.contactType}
91
+ contactValue={contactObject.contactValue}
92
+ key={`wrong-contact-${index}`}
92
93
  />
93
94
  </div>
94
95
  ))}
@@ -62,6 +62,7 @@ const formatAllCountries = () => {
62
62
  formatAllCountries()
63
63
 
64
64
  const containOnlyNumbers = (value: string) => {
65
+ // eslint-disable-next-line no-useless-escape
65
66
  return /^[()+\-\ .\d]*$/g.test(value)
66
67
  }
67
68
 
@@ -259,9 +260,9 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
259
260
  if (required) textInputProps.required = true
260
261
 
261
262
  return (
262
- <div
263
- {...wrapperProps}
264
- {...htmlProps}
263
+ <div
264
+ {...wrapperProps}
265
+ {...htmlProps}
265
266
  >
266
267
  <TextInput
267
268
  ref={
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/no-multi-comp */
1
2
  import React, { useEffect, useState } from "react";
2
3
  import ReactDOM from "react-dom";
3
4
  import {
@@ -54,7 +55,7 @@ const popoverModifiers = ({
54
55
  offset,
55
56
  }: {
56
57
  modifiers: Modifier<any> & any;
57
- offset: {};
58
+ offset: boolean;
58
59
  }) => {
59
60
  return offset ? modifiers.concat([POPOVER_MODIFIERS.offset]) : modifiers;
60
61
  };
@@ -143,7 +144,7 @@ const Popover = (props: PbPopoverProps) => {
143
144
  );
144
145
  };
145
146
 
146
- const PbReactPopover = (props: PbPopoverProps) => {
147
+ const PbReactPopover = (props: PbPopoverProps): React.ReactElement => {
147
148
  const [targetId] = useState(_uniqueId('id-'))
148
149
  const {
149
150
  className,
@@ -226,9 +227,10 @@ const PbReactPopover = (props: PbPopoverProps) => {
226
227
  <PopperReference>
227
228
  {({ ref }) => (
228
229
  <span
229
- id={"reference-" + targetId}
230
230
  className="pb_popover_reference_wrapper"
231
- ref={ref}>
231
+ id={"reference-" + targetId}
232
+ ref={ref}
233
+ >
232
234
  <reference.type {...reference.props} />
233
235
  </span>
234
236
  )}