playbook_ui 9.7.0.pre.alpha.a11y.btn → 9.10.0.pre.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_background/background.rb +0 -1
  3. data/app/pb_kits/playbook/pb_button/_button.jsx +19 -8
  4. data/app/pb_kits/playbook/pb_button/button.rb +4 -6
  5. data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.html.erb +1 -1
  6. data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.jsx +1 -1
  7. data/app/pb_kits/playbook/pb_button/docs/_button_link.html.erb +3 -3
  8. data/app/pb_kits/playbook/pb_button/docs/_button_link.jsx +0 -3
  9. data/app/pb_kits/playbook/pb_button/docs/_button_loading.html.erb +3 -3
  10. data/app/pb_kits/playbook/pb_button/docs/_button_loading.jsx +0 -3
  11. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +9 -10
  12. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +4 -2
  13. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.rb +7 -9
  14. data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.rb +2 -2
  15. data/app/pb_kits/playbook/pb_filter/filter.rb +1 -1
  16. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +4 -2
  17. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +7 -0
  18. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.html.erb +2 -1
  19. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.jsx +2 -1
  20. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.md +1 -1
  21. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +7 -1
  22. data/app/pb_kits/playbook/pb_flex/flex.rb +4 -4
  23. data/app/pb_kits/playbook/pb_form/form.rb +1 -1
  24. data/app/pb_kits/playbook/pb_form_group/_form_group.jsx +3 -1
  25. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +8 -0
  26. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.html.erb +13 -0
  27. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.jsx +43 -0
  28. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.md +1 -0
  29. data/app/pb_kits/playbook/pb_form_group/docs/example.yml +2 -0
  30. data/app/pb_kits/playbook/pb_form_group/docs/index.js +1 -1
  31. data/app/pb_kits/playbook/pb_form_group/form_group.rb +10 -1
  32. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.rb +0 -1
  33. data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +12 -9
  34. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_breached.html.erb +1 -0
  35. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_breached.jsx +24 -0
  36. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_breached.md +3 -0
  37. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_default.jsx +1 -0
  38. data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +2 -0
  39. data/app/pb_kits/playbook/pb_passphrase/docs/index.js +1 -0
  40. data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +2 -0
  41. data/app/pb_kits/playbook/pb_passphrase/passphrase.test.jsx +12 -0
  42. data/app/pb_kits/playbook/pb_passphrase/useHaveIBeenPwned.js +52 -0
  43. data/app/pb_kits/playbook/pb_passphrase/useZxcvbn.js +58 -0
  44. data/app/pb_kits/playbook/pb_progress_pills/progress_pills.rb +2 -1
  45. data/app/pb_kits/playbook/pb_progress_step/progress_step.rb +1 -1
  46. data/app/pb_kits/playbook/pb_progress_step/progress_step_item.rb +1 -1
  47. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +2 -2
  48. data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.rb +1 -1
  49. data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.rb +1 -1
  50. data/app/pb_kits/playbook/pb_stat_change/stat_change.rb +8 -12
  51. data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +1 -1
  52. data/app/pb_kits/playbook/pb_user_badge/user_badge.rb +1 -1
  53. data/lib/playbook/forms/builder/action_area.rb +2 -2
  54. data/lib/playbook/forms/builder/collection_select_field.rb +2 -2
  55. data/lib/playbook/forms/builder/select_field.rb +1 -1
  56. data/lib/playbook/kit_resolver.rb +1 -1
  57. data/lib/playbook/markdown/template_handler.rb +4 -2
  58. data/lib/playbook/pb_doc_helper.rb +4 -2
  59. data/lib/playbook/props.rb +1 -4
  60. data/lib/playbook/props/base.rb +1 -2
  61. data/lib/playbook/version.rb +1 -1
  62. metadata +30 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d02c19ea477725a33c15757d8254c21348c16e9d8e5b82b85ec08ffb7e3ac4e
4
- data.tar.gz: 75fd3538c8760afa2dcf2818bef4e91451ca0f985044223bdd118f33c740b568
3
+ metadata.gz: 7b36c79f834fafef501c48ece8fc72990708ab4323f3c172527d9a9a31bb9fa4
4
+ data.tar.gz: ddc237d11376abb37c4e0d8630fbf06f4f2510dd0bdadefebc364bdf4b4e735a
5
5
  SHA512:
6
- metadata.gz: 70a500505fe763ab166a92613bb5d3fbf6c6c7b88d53e1727003346c8f5d0e312e629167c840ec17272a63a2cf7f0b15b7657b3b89cd0065c68eb0683a08368e
7
- data.tar.gz: 4a1e51d54b520cb7c40f32df8fca6e2f20760b9eb09cf40092b66b50a90a14b6744e50bcaccf5cbc604708861128db5fee6e4efd777eeecfc4ed9f56ac5cb900
6
+ metadata.gz: 71667f6a96f25e9fee0bd7d741b38c09eeced8c397c1126fafc1b3525b984d6a717e6332d2690818df67c0eb7da370429bbc50481f17c820256121d9972f48ae
7
+ data.tar.gz: 953083fe2726a16fbbd33b7b550c1136230b6dec1043e0fd4f3c6ed47c52249c47b98a9da5e889cec15c05b11a42257f32cc1824d62e6109a8ad0009c1824f5e
@@ -12,7 +12,6 @@ module Playbook
12
12
  values: %w[h1 h2 h3 h4 h5 h6 p div span],
13
13
  default: "div"
14
14
 
15
-
16
15
  def classname
17
16
  generate_classname("pb_background_kit", image_classname, background_color_classname, separator: " ")
18
17
  end
@@ -2,14 +2,16 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
- import { buildAriaProps, buildDataProps } from '../utilities/props'
5
+ import { buildDataProps } from '../utilities/props'
6
6
  import { globalProps } from '../utilities/globalProps.js'
7
7
 
8
8
  import Icon from '../pb_icon/_icon.jsx'
9
9
 
10
10
  type EventHandler = (SyntheticInputEvent<HTMLInputElement>) => void
11
11
  type ButtonPropTypes = {
12
- aria?: object,
12
+ aria?: {
13
+ label: string,
14
+ },
13
15
  children?: array<React.ReactChild>,
14
16
  className?: string | array<string>,
15
17
  data?: object,
@@ -53,9 +55,20 @@ const buttonClassName = (props: ButtonPropTypes) => {
53
55
  return className
54
56
  }
55
57
 
58
+ const buttonAriaProps = (props: ButtonPropTypes) => {
59
+ const { aria } = props
60
+ if (typeof aria !== 'object') return {}
61
+ const { label } = aria
62
+
63
+ const ariaProps = {}
64
+
65
+ if (label !== null) ariaProps['aria-label'] = label
66
+
67
+ return ariaProps
68
+ }
69
+
56
70
  const Button = (props: ButtonPropTypes) => {
57
71
  const {
58
- aria = {},
59
72
  children,
60
73
  className,
61
74
  data = {},
@@ -71,7 +84,7 @@ const Button = (props: ButtonPropTypes) => {
71
84
  value,
72
85
  } = props
73
86
 
74
- const ariaProps = buildAriaProps(aria)
87
+ const buttonAria = buttonAriaProps(props)
75
88
  const dataProps = buildDataProps(data)
76
89
  const css = classnames(
77
90
  buttonClassName(props),
@@ -101,12 +114,11 @@ const Button = (props: ButtonPropTypes) => {
101
114
  return (
102
115
  <If condition={link !== null}>
103
116
  <a
104
- {...ariaProps}
117
+ {...buttonAria}
105
118
  {...dataProps}
106
119
  className={css}
107
120
  href={link}
108
121
  id={id}
109
- role="link"
110
122
  target={newWindow ? '_blank' : null}
111
123
  >
112
124
  <If condition={loading}>{loadingIcon}</If>
@@ -114,13 +126,12 @@ const Button = (props: ButtonPropTypes) => {
114
126
  </a>
115
127
  <Else />
116
128
  <button
117
- {...ariaProps}
129
+ {...buttonAria}
118
130
  {...dataProps}
119
131
  className={css}
120
132
  disabled={disabled}
121
133
  id={id}
122
134
  onClick={onClick}
123
- role="button"
124
135
  type={htmlType}
125
136
  value={value}
126
137
  >
@@ -21,12 +21,11 @@ module Playbook
21
21
 
22
22
  def options
23
23
  {
24
- aria: aria,
25
- class: classname,
24
+ id: id,
26
25
  data: data,
26
+ class: classname,
27
27
  disabled: disabled,
28
- id: id,
29
- role: "button",
28
+ aria: aria,
30
29
  type: type,
31
30
  value: value,
32
31
  }.compact
@@ -35,8 +34,7 @@ module Playbook
35
34
  def link_options
36
35
  options.merge(
37
36
  href: link,
38
- role: "link",
39
- target: new_window ? "_blank" : "_self",
37
+ target: new_window ? "_blank" : "_self"
40
38
  )
41
39
  end
42
40
 
@@ -1 +1 @@
1
- <%= pb_rails("button", props: { text: "Button with ARIA", aria: {label: "Go to Google"}, tag: "a", link: "http://google.com" }) %>
1
+ <%= pb_rails("button", props: { text: "Button with ARIA", aria: {label: "button"}, tag: "a", link: "http://google.com" }) %>
@@ -4,7 +4,7 @@ import { Button } from '../../'
4
4
  const ButtonAccessibility = (props) => (
5
5
  <div>
6
6
  <Button
7
- aria={{ label: 'Go to Google' }}
7
+ aria={{ label: 'button' }}
8
8
  link="https://google.com"
9
9
  tag="a"
10
10
  text="Button with ARIA"
@@ -1,3 +1,3 @@
1
- <%= pb_rails("button", props: { text: "A Tag Button", aria: { label: "Link to Google" }, tag: "a", link: "http://google.com" }) %>
2
- <%= pb_rails("button", props: { text: "Open in new Window", aria: { label: "Link to Google in new window" }, new_window: true, link: "http://google.com" }) %>
3
- <%= pb_rails("button", props: { text: "A Tag Button Disabled", aria: { label: "Disabled link to Google" }, disabled: true, link: "http://google.com" }) %>
1
+ <%= pb_rails("button", props: { text: "A Tag Button", tag: "a", link: "http://google.com" }) %>
2
+ <%= pb_rails("button", props: { text: "Open in new Window", new_window: true, link: "http://google.com" }) %>
3
+ <%= pb_rails("button", props: { text: "A Tag Button Disabled", disabled: true, link: "http://google.com" }) %>
@@ -4,14 +4,12 @@ import { Button } from '../../'
4
4
  const ButtonLink = (props) => (
5
5
  <div>
6
6
  <Button
7
- aria={{ label: 'Link to Google' }}
8
7
  link="https://google.com"
9
8
  text="A Tag Button"
10
9
  {...props}
11
10
  />
12
11
  {' '}
13
12
  <Button
14
- aria={{ label: 'Link to Google in new window' }}
15
13
  link="https://google.com"
16
14
  newWindow
17
15
  text="Open in New Window"
@@ -19,7 +17,6 @@ const ButtonLink = (props) => (
19
17
  />
20
18
  {' '}
21
19
  <Button
22
- aria={{ label: 'Disabled link to Google' }}
23
20
  disabled
24
21
  link="https://google.com"
25
22
  text="A Tag Button Disabled"
@@ -1,3 +1,3 @@
1
- <%= pb_rails("button", props: { aria: { label: "Loading" }, text: "Button Primary", loading: true }) %>
2
- <%= pb_rails("button", props: { aria: { label: "Loading" }, text: "Button Primary", variant: "secondary", loading: true }) %>
3
- <%= pb_rails("button", props: { aria: { label: "Loading" }, text: "Button Primary", variant: "link", loading: true }) %>
1
+ <%= pb_rails("button", props: { text: "Button Primary", loading: true }) %>
2
+ <%= pb_rails("button", props: { text: "Button Primary", variant: "secondary", loading: true }) %>
3
+ <%= pb_rails("button", props: { text: "Button Primary", variant: "link", loading: true }) %>
@@ -4,14 +4,12 @@ import { Button } from '../../'
4
4
  const ButtonLoading = (props) => (
5
5
  <div>
6
6
  <Button
7
- aria={{ label: 'Loading' }}
8
7
  loading
9
8
  text="Button Primary"
10
9
  {...props}
11
10
  />
12
11
  {' '}
13
12
  <Button
14
- aria={{ label: 'Loading' }}
15
13
  loading
16
14
  text="Button Secondary"
17
15
  variant="secondary"
@@ -19,7 +17,6 @@ const ButtonLoading = (props) => (
19
17
  />
20
18
  {' '}
21
19
  <Button
22
- aria={{ label: 'Loading' }}
23
20
  loading
24
21
  text="A Tag Button Disabled"
25
22
  variant="link"
@@ -6,37 +6,36 @@ module Playbook
6
6
  prop :chart_data, type: Playbook::Props::Array,
7
7
  default: []
8
8
  prop :style, type: Playbook::Props::Enum,
9
- values: %w[pie],
10
- default: "pie"
9
+ values: %w[pie],
10
+ default: "pie"
11
11
 
12
12
  prop :data_labels, type: Playbook::Props::Boolean, default: false
13
13
  prop :min_point_size, type: Playbook::Props::Numeric
14
14
  prop :max_point_size, type: Playbook::Props::Numeric
15
15
  prop :inner_size, type: Playbook::Props::Enum,
16
- values: %w[sm md lg none],
17
- default: "md"
16
+ values: %w[sm md lg none],
17
+ default: "md"
18
18
  prop :z_min, type: Playbook::Props::Numeric
19
19
  prop :start_angle, type: Playbook::Props::Numeric
20
20
  prop :header_format
21
- prop :data_label_html, default: '<div>{point.name}</div>'
21
+ prop :data_label_html, default: "<div>{point.name}</div>"
22
22
  prop :tooltip_html, default: '<span style="font-weight: bold; color:{point.color};">●</span>
23
23
  {point.name}: ' + '<b>{point.y}
24
24
  </b>'
25
25
  prop :use_html, type: Playbook::Props::Boolean, default: false
26
26
  prop :legend, type: Playbook::Props::Boolean, default: false
27
- prop :title, default: ''
27
+ prop :title, default: ""
28
28
  prop :rounded, type: Playbook::Props::Boolean, default: false
29
29
  prop :colors, type: Playbook::Props::Array,
30
30
  default: []
31
31
 
32
-
33
32
  def chart_type
34
33
  style == "variablepie" ? "variablepie" : "pie"
35
34
  end
36
35
 
37
36
  def chart_data_formatted
38
- chart_data.map{ |hash| hash[:y] = hash.delete :value}
39
- return chart_data
37
+ chart_data.map { |hash| hash[:y] = hash.delete :value }
38
+ chart_data
40
39
  end
41
40
 
42
41
  def inner_size_format
@@ -57,7 +56,7 @@ module Playbook
57
56
  end
58
57
 
59
58
  def rounded_border_color
60
- rounded == true ? 'null' : nil
59
+ rounded == true ? "null" : nil
61
60
  end
62
61
 
63
62
  def chart_options
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Playbook
2
4
  module PbCircleIconButton
3
5
  class CircleIconButton < Playbook::KitBase
@@ -8,11 +10,11 @@ module Playbook
8
10
  values: %w[primary secondary link],
9
11
  default: "primary"
10
12
  prop :disabled, type: Playbook::Props::Boolean,
11
- default: false
13
+ default: false
12
14
  prop :icon, required: true
13
15
  prop :link
14
16
  prop :new_window, type: Playbook::Props::Boolean,
15
- default: false
17
+ default: false
16
18
  def classname
17
19
  generate_classname("pb_circle_icon_button_kit")
18
20
  end
@@ -5,13 +5,13 @@ module Playbook
5
5
  class DateStacked < Playbook::KitBase
6
6
  prop :date, type: Playbook::Props::Date, required: true
7
7
  prop :align, type: Playbook::Props::Enum,
8
- values: %w[left center right],
9
- default: "left"
8
+ values: %w[left center right],
9
+ default: "left"
10
10
  prop :size, type: Playbook::Props::Enum,
11
11
  values: %w[sm md],
12
12
  default: "sm"
13
13
  prop :reverse, type: Playbook::Props::Boolean,
14
- default: false
14
+ default: false
15
15
  prop :dark, type: Playbook::Props::Boolean,
16
16
  default: false
17
17
 
@@ -20,20 +20,20 @@ module Playbook
20
20
  end
21
21
 
22
22
  def title_size
23
- size == "md" ? 3: 4
23
+ size == "md" ? 3 : 4
24
24
  end
25
25
 
26
26
  def day
27
27
  day = Playbook::PbKit::PbDateTime.new(date)
28
28
  content_tag(:time, datetime: day.to_iso) do
29
- "#{day.to_day}"
29
+ day.to_day.to_s
30
30
  end
31
31
  end
32
32
 
33
33
  def month
34
34
  month = Playbook::PbKit::PbDateTime.new(date)
35
35
  content_tag(:time, datetime: month.to_iso) do
36
- "#{month.to_month}"
36
+ month.to_month.to_s
37
37
  end
38
38
  end
39
39
 
@@ -42,9 +42,8 @@ module Playbook
42
42
  year = Playbook::PbKit::PbDateTime.new(date).to_year.to_i
43
43
  if current_year != year
44
44
  content_tag(:time, datetime: year) do
45
- "#{year}"
45
+ year.to_s
46
46
  end
47
- else
48
47
  end
49
48
  end
50
49
 
@@ -57,7 +56,6 @@ module Playbook
57
56
  def dark_class
58
57
  dark ? "dark" : nil
59
58
  end
60
-
61
59
  end
62
60
  end
63
61
  end
@@ -7,9 +7,9 @@ module Playbook
7
7
  values: %w[lg sm],
8
8
  default: "lg"
9
9
  prop :widths, type: Playbook::Props::NumberArray,
10
- default: [1]
10
+ default: [1]
11
11
  prop :colors, type: Playbook::Props::Array,
12
- default: []
12
+ default: []
13
13
 
14
14
  def classname
15
15
  generate_classname("pb_distribution_bar", size)
@@ -3,7 +3,7 @@
3
3
  module Playbook
4
4
  module PbFilter
5
5
  class Filter < Playbook::KitBase
6
- prop :filters, type: Playbook::Props::HashArray, default: [{name: ''}]
6
+ prop :filters, type: Playbook::Props::HashArray, default: [{ name: "" }]
7
7
  prop :sort_menu, type: Playbook::Props::HashArray, default: [{}]
8
8
  prop :results, type: Playbook::Props::Numeric
9
9
  prop :template, type: Playbook::Props::Enum,
@@ -17,15 +17,17 @@ type FixedConfirmationToastProps = {
17
17
  closeable?: boolean,
18
18
  data?: string,
19
19
  id?: string,
20
- status?: "success" | "error" | "neutral" | "tip",
20
+ multiLine?: boolean,
21
+ status?: 'success' | 'error' | 'neutral' | 'tip',
21
22
  text: string,
22
23
  }
23
24
 
24
25
  const FixedConfirmationToast = (props: FixedConfirmationToastProps) => {
25
26
  const [showToast, toggleToast] = useState(true)
26
- const { className, closeable = false, status = 'neutral', text } = props
27
+ const { className, closeable = false, multiLine = false, status = 'neutral', text } = props
27
28
  const css = classnames(
28
29
  `pb_fixed_confirmation_toast_kit_${status}`,
30
+ { '_multi_line': multiLine },
29
31
  globalProps(props),
30
32
  className
31
33
  )
@@ -47,6 +47,13 @@ $confirmation_toast_colors: (
47
47
  .pb_icon {
48
48
  color: $white;
49
49
  }
50
+
51
+ &[class*=_multi_line] .pb_fixed_confirmation_toast_text {
52
+ color: $white;
53
+ margin: 0 $space_md 0 $space_md;
54
+ max-width: 100%;
55
+ white-space: break-spaces;
56
+ }
50
57
  }
51
58
  }
52
59
  }
@@ -1,4 +1,5 @@
1
1
  <%= pb_rails("fixed_confirmation_toast", props: {
2
- text: "Scan to Assign Selected Items.\nClick here to generate report",
2
+ multi_line: true,
3
+ text: "Scan to Assign Selected Items. Click here to generate report",
3
4
  status: "tip",
4
5
  }) %>
@@ -5,8 +5,9 @@ const FixedConfirmationToastMultiLine = (props) => {
5
5
  return (
6
6
  <div>
7
7
  <FixedConfirmationToast
8
+ multiLine
8
9
  status="tip"
9
- text={'Scan to Assign Selected Items.\n Click here to generate report'}
10
+ text="Scan to Assign Selected Items. Click here to generate report"
10
11
  {...props}
11
12
  />
12
13
  </div>
@@ -1,2 +1,2 @@
1
1
 
2
- Multi-line is used when the given text will not fit on one line. Using Multi Line allows the height of the confirmation toast to grow.
2
+ Multi-line is used when the given text will not fit on one line. Using Multi Line allows the height of the confirmation toast to grow. Simply resize the screen to see the fixed confirmation toast wrap the text.
@@ -7,6 +7,8 @@ module Playbook
7
7
  values: %w[success error neutral tip],
8
8
  default: "neutral"
9
9
  prop :text, type: Playbook::Props::String
10
+ prop :multi_line, type: Playbook::Props::Boolean,
11
+ default: false
10
12
  prop :closeable, type: Playbook::Props::Boolean,
11
13
  default: false
12
14
 
@@ -18,6 +20,10 @@ module Playbook
18
20
  closeable.present? ? " remove_toast" : ""
19
21
  end
20
22
 
23
+ def multi_line_class
24
+ multi_line.present? ? "multi_line" : nil
25
+ end
26
+
21
27
  def icon_value
22
28
  case status
23
29
  when "success"
@@ -32,7 +38,7 @@ module Playbook
32
38
  end
33
39
 
34
40
  def classname
35
- generate_classname("pb_fixed_confirmation_toast_kit", status) + close_class
41
+ generate_classname("pb_fixed_confirmation_toast_kit", status, multi_line_class) + close_class
36
42
  end
37
43
  end
38
44
  end