playbook_ui 9.9.0.alpha.inline1 → 9.10.0

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_badge/_badge.jsx +1 -26
  3. data/app/pb_kits/playbook/pb_button/_button.jsx +8 -19
  4. data/app/pb_kits/playbook/pb_button/button.rb +6 -4
  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 +3 -0
  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 +3 -0
  11. data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +1 -6
  12. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +0 -3
  13. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -12
  14. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +0 -19
  15. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_user.html.erb +5 -4
  16. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_user.jsx +6 -2
  17. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +0 -2
  18. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +0 -1
  19. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
  20. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +0 -5
  21. data/app/pb_kits/playbook/pb_passphrase/useZxcvbn.js +3 -3
  22. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +0 -10
  23. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss +0 -61
  24. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +0 -4
  25. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +0 -2
  26. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +2 -9
  27. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.md +1 -1
  28. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +0 -3
  29. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +0 -8
  30. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -2
  31. data/app/pb_kits/playbook/pb_text_input/docs/index.js +0 -1
  32. data/app/pb_kits/playbook/pb_text_input/text_input.rb +1 -7
  33. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +2 -11
  34. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -23
  35. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx +11 -23
  36. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.jsx +4 -17
  37. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -4
  38. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +5 -7
  39. data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +1 -1
  40. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +2 -18
  41. data/lib/playbook/version.rb +1 -1
  42. metadata +6 -17
  43. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_size.html.erb +0 -13
  44. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_size.jsx +0 -25
  45. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.html.erb +0 -6
  46. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.jsx +0 -16
  47. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.html.erb +0 -4
  48. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.jsx +0 -14
  49. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_inline.html.erb +0 -5
  50. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_inline.jsx +0 -22
  51. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_inline.html.erb +0 -36
  52. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_inline.jsx +0 -43
  53. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_multi_kit.html.erb +0 -35
  54. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_multi_kit.jsx +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aad061e395898f02d246cad01fc3ca3c158c910c058c546fdff62258f99ceced
4
- data.tar.gz: fb468e1242133f77abb769f74805a44c6a3caa88fb40dd10cf48791b98683466
3
+ metadata.gz: b9945857d72557eecdaac3f4cff4f8d02d7941118ea741fa43eb13a7fb8af86f
4
+ data.tar.gz: 9a8c82315215fce86c9b34e6418f9a44a4656d7afebc2a0e15a2ec94ba4fdf0b
5
5
  SHA512:
6
- metadata.gz: e23d91eb54be1797a2cfb44c35941b3c0302d7bb02cb880ee61a21710a540014a0c4a0bc9b82c3b09d47d38d0b030a702f33a2d3b54fdf0ceec805d674958545
7
- data.tar.gz: e04139cbbbf7a5e9b93e47ec464583715fae88a10463047c08da99ffae60986832117ae533c880de82cf54989bfe2914191dc1d87cf37763f8426c2bca571662
6
+ metadata.gz: f2da5e8f1f95b18fd53919a99c18ff28e2039eb5dd2cb1ce30939db84f1abf46358279a63993e71eb5c2151bfb3812797b49984fab77537ffe5cdf82bc9623d7
7
+ data.tar.gz: cf5b9ff8408fb77863c81bb1ddaf4668835f5a97cd926729e743c6845e3c4a283c7148355186c24dcbfb2316b5d0800ef0ada9747387a112828701f27bfef32f
@@ -3,7 +3,6 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { globalProps } from '../utilities/globalProps.js'
6
- import { Icon } from '../'
7
6
 
8
7
  import {
9
8
  buildAriaProps,
@@ -14,15 +13,8 @@ import {
14
13
  type BadgeProps = {
15
14
  aria?: object,
16
15
  className?: string,
17
- closeProps?: {
18
- onClick?: EventHandler,
19
- onMouseDown?: EventHandler,
20
- onTouchEnd?: EventHandler,
21
- },
22
16
  data?: object,
23
17
  id?: string,
24
- removeIcon?: Boolean,
25
- removeOnClick?: EventHandler,
26
18
  rounded?: boolean,
27
19
  text?: string,
28
20
  variant?: "error" | "info" | "neutral" | "primary" | "success" | "warning",
@@ -31,11 +23,8 @@ const Badge = (props: BadgeProps) => {
31
23
  const {
32
24
  aria = {},
33
25
  className,
34
- closeProps = {},
35
26
  data = {},
36
27
  id,
37
- removeIcon = false,
38
- removeOnClick = () => {},
39
28
  rounded = false,
40
29
  text,
41
30
  variant = 'neutral',
@@ -55,21 +44,7 @@ const Badge = (props: BadgeProps) => {
55
44
  className={css}
56
45
  id={id}
57
46
  >
58
- <span>
59
- {text}
60
- <If condition={removeIcon}>
61
- <span
62
- onClick={removeOnClick}
63
- style={{ cursor: 'pointer' }}
64
- {...closeProps}
65
- >
66
- <Icon
67
- fixedWidth
68
- icon="times"
69
- />
70
- </span>
71
- </If>
72
- </span>
47
+ <span>{text}</span>
73
48
  </div>
74
49
  )
75
50
  }
@@ -2,16 +2,14 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
- import { buildDataProps } from '../utilities/props'
5
+ import { buildAriaProps, 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?: {
13
- label: string,
14
- },
12
+ aria?: object,
15
13
  children?: array<React.ReactChild>,
16
14
  className?: string | array<string>,
17
15
  data?: object,
@@ -55,20 +53,9 @@ const buttonClassName = (props: ButtonPropTypes) => {
55
53
  return className
56
54
  }
57
55
 
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
-
70
56
  const Button = (props: ButtonPropTypes) => {
71
57
  const {
58
+ aria = {},
72
59
  children,
73
60
  className,
74
61
  data = {},
@@ -84,7 +71,7 @@ const Button = (props: ButtonPropTypes) => {
84
71
  value,
85
72
  } = props
86
73
 
87
- const buttonAria = buttonAriaProps(props)
74
+ const ariaProps = buildAriaProps(aria)
88
75
  const dataProps = buildDataProps(data)
89
76
  const css = classnames(
90
77
  buttonClassName(props),
@@ -114,11 +101,12 @@ const Button = (props: ButtonPropTypes) => {
114
101
  return (
115
102
  <If condition={link !== null}>
116
103
  <a
117
- {...buttonAria}
104
+ {...ariaProps}
118
105
  {...dataProps}
119
106
  className={css}
120
107
  href={link}
121
108
  id={id}
109
+ role="link"
122
110
  target={newWindow ? '_blank' : null}
123
111
  >
124
112
  <If condition={loading}>{loadingIcon}</If>
@@ -126,12 +114,13 @@ const Button = (props: ButtonPropTypes) => {
126
114
  </a>
127
115
  <Else />
128
116
  <button
129
- {...buttonAria}
117
+ {...ariaProps}
130
118
  {...dataProps}
131
119
  className={css}
132
120
  disabled={disabled}
133
121
  id={id}
134
122
  onClick={onClick}
123
+ role="button"
135
124
  type={htmlType}
136
125
  value={value}
137
126
  >
@@ -21,11 +21,12 @@ module Playbook
21
21
 
22
22
  def options
23
23
  {
24
- id: id,
25
- data: data,
24
+ aria: aria,
26
25
  class: classname,
26
+ data: data,
27
27
  disabled: disabled,
28
- aria: aria,
28
+ id: id,
29
+ role: "button",
29
30
  type: type,
30
31
  value: value,
31
32
  }.compact
@@ -34,7 +35,8 @@ module Playbook
34
35
  def link_options
35
36
  options.merge(
36
37
  href: link,
37
- target: new_window ? "_blank" : "_self"
38
+ role: "link",
39
+ target: new_window ? "_blank" : "_self",
38
40
  )
39
41
  end
40
42
 
@@ -1 +1 @@
1
- <%= pb_rails("button", props: { text: "Button with ARIA", aria: {label: "button"}, tag: "a", link: "http://google.com" }) %>
1
+ <%= pb_rails("button", props: { text: "Button with ARIA", aria: {label: "Go to Google"}, 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: 'button' }}
7
+ aria={{ label: 'Go to Google' }}
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", 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" }) %>
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" }) %>
@@ -4,12 +4,14 @@ import { Button } from '../../'
4
4
  const ButtonLink = (props) => (
5
5
  <div>
6
6
  <Button
7
+ aria={{ label: 'Link to Google' }}
7
8
  link="https://google.com"
8
9
  text="A Tag Button"
9
10
  {...props}
10
11
  />
11
12
  {' '}
12
13
  <Button
14
+ aria={{ label: 'Link to Google in new window' }}
13
15
  link="https://google.com"
14
16
  newWindow
15
17
  text="Open in New Window"
@@ -17,6 +19,7 @@ const ButtonLink = (props) => (
17
19
  />
18
20
  {' '}
19
21
  <Button
22
+ aria={{ label: 'Disabled link to Google' }}
20
23
  disabled
21
24
  link="https://google.com"
22
25
  text="A Tag Button Disabled"
@@ -1,3 +1,3 @@
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 }) %>
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 }) %>
@@ -4,12 +4,14 @@ import { Button } from '../../'
4
4
  const ButtonLoading = (props) => (
5
5
  <div>
6
6
  <Button
7
+ aria={{ label: 'Loading' }}
7
8
  loading
8
9
  text="Button Primary"
9
10
  {...props}
10
11
  />
11
12
  {' '}
12
13
  <Button
14
+ aria={{ label: 'Loading' }}
13
15
  loading
14
16
  text="Button Secondary"
15
17
  variant="secondary"
@@ -17,6 +19,7 @@ const ButtonLoading = (props) => (
17
19
  />
18
20
  {' '}
19
21
  <Button
22
+ aria={{ label: 'Loading' }}
20
23
  loading
21
24
  text="A Tag Button Disabled"
22
25
  variant="link"
@@ -25,8 +25,6 @@ type DatePickerProps = {
25
25
  id?: String,
26
26
  inputAria?: object,
27
27
  inputData?: object,
28
- inputOnChange?: (String) => void,
29
- inputValue?: any,
30
28
  label?: String,
31
29
  maxDate: String,
32
30
  minDate: String,
@@ -57,8 +55,6 @@ const DatePicker = (props: DatePickerProps) => {
57
55
  id,
58
56
  inputAria,
59
57
  inputData,
60
- inputOnChange,
61
- inputValue,
62
58
  label = 'Date Picker',
63
59
  maxDate,
64
60
  minDate,
@@ -118,6 +114,7 @@ const DatePicker = (props: DatePickerProps) => {
118
114
  className={classes}
119
115
  id={id}
120
116
  >
117
+ {className}
121
118
  <div className="input_wrapper">
122
119
  <TextInput
123
120
  aria={inputAria}
@@ -129,9 +126,7 @@ const DatePicker = (props: DatePickerProps) => {
129
126
  id={pickerId}
130
127
  label={hideLabel ? null : label}
131
128
  name={name}
132
- onChange={inputOnChange}
133
129
  placeholder={placeholder}
134
- value={inputValue}
135
130
  />
136
131
  <If condition={!hideIcon}>
137
132
  <div
@@ -166,9 +166,6 @@ const datePickerHelper = (config) => {
166
166
  picker.input.style.caretColor = 'transparent'
167
167
  picker.input.style.cursor = 'pointer'
168
168
  }
169
-
170
- // Fix event bubbling bug on wrapper
171
- document.querySelector(`#${pickerId}`).parentElement.addEventListener('click', (e) => e.stopPropagation())
172
169
  }
173
170
 
174
171
  export default datePickerHelper
@@ -14,7 +14,6 @@ type FormPillProps = {
14
14
  onClick?: EventHandler,
15
15
  avatar?: boolean,
16
16
  avatarUrl?: string,
17
- size?: string,
18
17
  closeProps?: {
19
18
  onClick?: EventHandler,
20
19
  onMouseDown?: EventHandler,
@@ -22,20 +21,11 @@ type FormPillProps = {
22
21
  },
23
22
  }
24
23
  const FormPill = (props: FormPillProps) => {
25
- const {
26
- className,
27
- text,
28
- name,
29
- onClick = () => {},
30
- avatarUrl,
31
- closeProps = {},
32
- size = '',
33
- } = props
24
+ const { className, text, name, onClick = () => {}, avatarUrl, closeProps = {} } = props
34
25
  const css = classnames(
35
26
  `pb_form_pill_kit_${'primary'}`,
36
27
  globalProps(props),
37
- className,
38
- size === 'small' ? 'small' : null,
28
+ className
39
29
  )
40
30
  return (
41
31
  <div className={css}>
@@ -51,23 +51,4 @@ $form_pill_colors: (
51
51
  }
52
52
  }
53
53
  }
54
- &.small {
55
- height: fit-content;
56
- height: -moz-fit-content;
57
- .pb_form_pill_text, .pb_form_pill_close, .pb_form_pill_tag {
58
- font-size: 16px;
59
- font-weight: 400;
60
- }
61
- .pb_form_pill_text, .pb_form_pill_tag {
62
- line-height: 1.7;
63
- padding-left: $space_xs;
64
- padding-right: 2px;
65
- }
66
- [class^=pb_avatar_kit], [class^=pb_avatar_kit] .avatar_wrapper {
67
- width: 20px;
68
- height: 20px;
69
- flex-basis: 20px;
70
- &::before { line-height: 21px; }
71
- }
72
- }
73
54
  }
@@ -1,11 +1,12 @@
1
1
  <%= pb_rails("form_pill", props: {
2
2
  name: "Anna Black",
3
3
  avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
4
- }) %>
5
4
 
6
- <br />
7
- <br />
5
+ }) %>
6
+
7
+ <br>
8
+ <br>
8
9
 
9
10
  <%= pb_rails("form_pill", props: {
10
11
  name: "Anna Black",
11
- }) %>
12
+ }) %>
@@ -8,14 +8,18 @@ const FormPillDefault = (props) => {
8
8
  <FormPill
9
9
  avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
10
10
  name="Anna Black"
11
- onClick={() => alert('Click!')}
11
+ onClick={() => {
12
+ alert('Click!')
13
+ }}
12
14
  {...props}
13
15
  />
14
16
  <br />
15
17
  <br />
16
18
  <FormPill
17
19
  name="Anna Black"
18
- onClick={() => alert('Click!')}
20
+ onClick={() => {
21
+ alert('Click!')
22
+ }}
19
23
  {...props}
20
24
  />
21
25
  </div>
@@ -2,11 +2,9 @@ examples:
2
2
 
3
3
  rails:
4
4
  - form_pill_user: Form Pill User
5
- - form_pill_size: Form Pill Size
6
5
  - form_pill_tag: Form Pill Tag
7
6
 
8
7
 
9
8
  react:
10
9
  - form_pill_user: Form Pill User
11
- - form_pill_size: Form Pill Size
12
10
  - form_pill_tag: Form Pill Tag
@@ -1,3 +1,2 @@
1
1
  export { default as FormPillUser } from './_form_pill_user.jsx'
2
- export { default as FormPillSize } from './_form_pill_size.jsx'
3
2
  export { default as FormPillTag } from './_form_pill_tag.jsx'
@@ -1,7 +1,7 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname + object.size_class) do %>
4
+ class: object.classname) do %>
5
5
  <% if object.name.present? %>
6
6
  <%= pb_rails("avatar", props: {
7
7
  name: object.name,
@@ -6,7 +6,6 @@ module Playbook
6
6
  prop :avatar_url
7
7
  prop :name
8
8
  prop :text
9
- prop :size
10
9
 
11
10
  def classname
12
11
  generate_classname("pb_form_pill_kit", "primary", name, text)
@@ -15,10 +14,6 @@ module Playbook
15
14
  def display_text
16
15
  name.downcase
17
16
  end
18
-
19
- def size_class
20
- size == "small" ? " small" : ""
21
- end
22
17
  end
23
18
  end
24
19
  end
@@ -15,9 +15,9 @@ export default function useZxcvbn(options) {
15
15
 
16
16
  useEffect(() => {
17
17
  if (confirmation) return
18
-
19
- setResult(calculator(passphrase))
20
- const str = result.score
18
+ const newResult = calculator(passphrase)
19
+ setResult(newResult)
20
+ const str = newResult.score
21
21
 
22
22
  const noPassphrase = passphrase.length <= 0
23
23
  const commonPassphrase = common || isPwned