playbook_ui 4.17.0 → 4.18.0

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/data/menu.yml +2 -1
  4. data/app/pb_kits/playbook/index.js +1 -0
  5. data/app/pb_kits/playbook/packs/examples.js +2 -0
  6. data/app/pb_kits/playbook/packs/samples.js +2 -0
  7. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.html.erb +1 -0
  8. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +3 -0
  9. data/app/pb_kits/playbook/pb_label_value/_label_value.html.erb +1 -0
  10. data/app/pb_kits/playbook/pb_label_value/_label_value.jsx +22 -3
  11. data/app/pb_kits/playbook/pb_layout/_layout.jsx +6 -4
  12. data/app/pb_kits/playbook/pb_logistic/_logistic.html.erb +1 -0
  13. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +26 -4
  14. data/app/pb_kits/playbook/pb_message/_message.html.erb +1 -0
  15. data/app/pb_kits/playbook/pb_message/_message.jsx +25 -7
  16. data/app/pb_kits/playbook/pb_message/docs/_message_default.jsx +1 -2
  17. data/app/pb_kits/playbook/pb_message/message.rb +1 -1
  18. data/app/pb_kits/playbook/pb_person/_person.html.erb +9 -2
  19. data/app/pb_kits/playbook/pb_person/_person.jsx +34 -10
  20. data/app/pb_kits/playbook/pb_person/docs/_person_default.html.erb +5 -1
  21. data/app/pb_kits/playbook/pb_person_contact/_person_contact.html.erb +1 -0
  22. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +57 -5
  23. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_with_wrong_numbers.jsx +32 -0
  24. data/app/pb_kits/playbook/pb_person_contact/docs/example.yml +2 -0
  25. data/app/pb_kits/playbook/pb_person_contact/docs/index.js +1 -0
  26. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.html.erb +1 -0
  27. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx +29 -5
  28. data/app/pb_kits/playbook/pb_section_separator/_section_separator.html.erb +1 -0
  29. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +22 -13
  30. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_text.jsx +3 -1
  31. data/app/pb_kits/playbook/pb_timeline/_item.html.erb +28 -0
  32. data/app/pb_kits/playbook/pb_timeline/_item.jsx +54 -0
  33. data/app/pb_kits/playbook/pb_timeline/_timeline.html.erb +6 -0
  34. data/app/pb_kits/playbook/pb_timeline/_timeline.jsx +43 -0
  35. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +271 -0
  36. data/app/pb_kits/playbook/pb_timeline/docs/_description.md +3 -0
  37. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_default.html.erb +43 -0
  38. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_default.jsx +73 -0
  39. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_vertical.html.erb +43 -0
  40. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_vertical.jsx +73 -0
  41. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.html.erb +44 -0
  42. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.jsx +85 -0
  43. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +13 -0
  44. data/app/pb_kits/playbook/pb_timeline/docs/index.js +3 -0
  45. data/app/pb_kits/playbook/pb_timeline/item.rb +25 -0
  46. data/app/pb_kits/playbook/pb_timeline/timeline.rb +27 -0
  47. data/app/views/playbook/samples/registration/index.html.erb +316 -0
  48. data/app/views/playbook/samples/registration/index.jsx +476 -0
  49. data/lib/playbook/version.rb +1 -1
  50. metadata +23 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c60678bea5dfbd0876ea029d5ee3ee8acddec0ffb70c76dbdf98834c2502af5
4
- data.tar.gz: 96100434503a2403c3fcf50dea881b520a2d3ff14f93afd5542e7f149f9a31cf
3
+ metadata.gz: be9bba608156b09d59f0fce484b089d45895fbc8d8c899f002de676cbe8754fa
4
+ data.tar.gz: f356fb9ccc68b15659839bd865d9e603d7df902e4bbbbda1a219900d389a73b7
5
5
  SHA512:
6
- metadata.gz: 473b7c3b876ca669ab9a2ce799c661af6fd4689843548535d62cf16ff88e699e9330076d0dd3c35b9d935ac6a71f926572d43426a2c17f6dca34c3b3f2feb7b7
7
- data.tar.gz: 9892a24ec8caa7570080db1cb329a83440a18c8a557e27df14c0421afd07ce9a1490af3aa10fd2ad2fccfb6573f3310145359248a6897da1c946253b1086d3f4
6
+ metadata.gz: caf7accc56bc9ad9bd611ab68315ea0386b85673a7143cfdb546aa0c15fc8f62d58ce76832fa0ffc1766f07fc1254b160709563450a3b4a1ea78d8eb5237763f
7
+ data.tar.gz: d599aeacd3127cdaaa8aca96cfe98216d75528b3ff8fe8cb4ecd0e43db8772c53097fb4039687827c8305032b4cf789ef0ca80bf091e3b980896c965f0578284
@@ -67,6 +67,7 @@
67
67
  @import 'pb_text_input/text_input';
68
68
  @import 'pb_textarea/textarea';
69
69
  @import 'pb_time/time';
70
+ @import 'pb_timeline/timeline';
70
71
  @import 'pb_time_range_inline/time_range_inline';
71
72
  @import 'pb_timestamp/timestamp';
72
73
  @import 'pb_title_count/title_count';
@@ -1,6 +1,6 @@
1
1
  samples:
2
2
  - dashboards
3
- - something
3
+ - registration
4
4
  kits:
5
5
  - avatar
6
6
  - avatar_action_button
@@ -57,6 +57,7 @@ kits:
57
57
  - star_rating
58
58
  - stat_change
59
59
  - table
60
+ - timeline
60
61
  - tooltip
61
62
  - typography:
62
63
  - body
@@ -70,6 +70,7 @@ export TableRow from './pb_table/_table_row.jsx'
70
70
  export Textarea from './pb_textarea/_textarea.jsx'
71
71
  export TextInput from './pb_text_input/_text_input.jsx'
72
72
  export Time from './pb_time/_time.jsx'
73
+ export Timeline from './pb_timeline/_timeline.jsx'
73
74
  export TimeStacked from './pb_time_stacked/_time_stacked.jsx'
74
75
  export Timestamp from './pb_timestamp/_timestamp.jsx'
75
76
  export TimeRangeInline from './pb_time_range_inline/_time_range_inline.jsx'
@@ -79,6 +79,7 @@ import * as Table from 'pb_table/docs'
79
79
  import * as Textarea from 'pb_textarea/docs'
80
80
  import * as TextInput from 'pb_text_input/docs'
81
81
  import * as Time from 'pb_time/docs'
82
+ import * as Timeline from 'pb_timeline/docs'
82
83
  import * as TimeStacked from 'pb_time_stacked/docs'
83
84
  import * as Timestamp from 'pb_timestamp/docs'
84
85
  import * as TimeRangeInline from 'pb_time_range_inline/docs'
@@ -157,6 +158,7 @@ WebpackerReact.setup({
157
158
  ...Textarea,
158
159
  ...TextInput,
159
160
  ...Time,
161
+ ...Timeline,
160
162
  ...TimeStacked,
161
163
  ...Timestamp,
162
164
  ...TimeRangeInline,
@@ -11,5 +11,7 @@ import WebpackerReact from 'webpacker-react'
11
11
  // Generated file from kit generator.
12
12
 
13
13
  import Dashboards from '../../../views/playbook/samples/dashboards/index.jsx'
14
+ import Registration from '../../../views/playbook/samples/registration/index.jsx'
14
15
 
15
16
  WebpackerReact.setup({ Dashboards })
17
+ WebpackerReact.setup({ Registration })
@@ -1,4 +1,5 @@
1
1
  <%= content_tag(:div,
2
+ aria: object.aria,
2
3
  id: object.id,
3
4
  data: object.data,
4
5
  class: object.classname) do %>
@@ -15,6 +15,7 @@ type AvatarActionButtonProps = {
15
15
  aria: Object,
16
16
  className?: String,
17
17
  data?: Object,
18
+ id?: String,
18
19
  imageUrl?: String,
19
20
  linkUrl?: String,
20
21
  name?: String,
@@ -28,6 +29,7 @@ const AvatarActionButton = ({
28
29
  aria = {},
29
30
  className,
30
31
  data = {},
32
+ id,
31
33
  imageUrl,
32
34
  linkUrl,
33
35
  name,
@@ -55,6 +57,7 @@ const AvatarActionButton = ({
55
57
  {...ariaProps}
56
58
  {...dataProps}
57
59
  className={classnames(css, className)}
60
+ id={id}
58
61
  >
59
62
  <a
60
63
  href={linkUrl}
@@ -1,4 +1,5 @@
1
1
  <%= content_tag(:div,
2
+ aria: object.aria,
2
3
  id: object.id,
3
4
  data: object.data,
4
5
  class: object.classname) do %>
@@ -2,18 +2,32 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
+ import { buildAriaProps, buildDataProps } from '../utilities/props'
5
6
  import { Body, Caption } from '../'
6
7
  import { spacing } from '../utilities/spacing.js'
7
8
 
8
9
  type LabelValueProps = {
10
+ aria?: object,
9
11
  className?: String,
12
+ dark?: Boolean,
13
+ data?: object,
14
+ id?: String,
10
15
  label: String,
11
16
  value: String,
12
- dark?: Boolean,
13
17
  }
14
18
 
15
19
  const LabelValue = (props: LabelValueProps) => {
16
- const { className, label, value, dark = false } = props
20
+ const {
21
+ aria = {},
22
+ className,
23
+ dark = false,
24
+ data = {},
25
+ id,
26
+ label,
27
+ value } = props
28
+
29
+ const ariaProps = buildAriaProps(aria)
30
+ const dataProps = buildDataProps(data)
17
31
  const themeStyle = dark === true ? '_dark' : ''
18
32
  const css = classnames(
19
33
  ['pb_label_value_kit' + themeStyle, className],
@@ -21,7 +35,12 @@ const LabelValue = (props: LabelValueProps) => {
21
35
  )
22
36
 
23
37
  return (
24
- <div className={css}>
38
+ <div
39
+ {...ariaProps}
40
+ {...dataProps}
41
+ className={css}
42
+ id={id}
43
+ >
25
44
  <Caption text={label} />
26
45
  <Body text={value} />
27
46
  </div>
@@ -33,15 +33,17 @@ type LayoutBodyProps = {
33
33
  }
34
34
 
35
35
  // Side component
36
- const Side = ({ children, className }: LayoutSideProps) => {
36
+ const Side = (props: LayoutSideProps) => {
37
+ const { children, className } = props
37
38
  return (
38
- <div className={classnames('layout_sidebar', className)}>{children}</div>
39
+ <div className={classnames('layout_sidebar', className, spacing(props))}>{children}</div>
39
40
  )
40
41
  }
41
42
 
42
43
  // Body component
43
- const Body = ({ children, className }: LayoutBodyProps) => {
44
- return <div className={classnames('layout_body', className)}>{children}</div>
44
+ const Body = (props: LayoutBodyProps) => {
45
+ const { children, className } = props
46
+ return <div className={classnames('layout_body', className, spacing(props))}>{children}</div>
45
47
  }
46
48
 
47
49
  // Main componenet
@@ -1,4 +1,5 @@
1
1
  <%= content_tag(:div,
2
+ aria: object.aria,
2
3
  id: object.id,
3
4
  data: object.data,
4
5
  class: object.classname) do %>
@@ -3,6 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import DateTime from '../pb_kit/dateTime.js'
6
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
7
  import { Body, Caption, Icon, Title } from '../'
7
8
  import { spacing } from '../utilities/spacing.js'
8
9
 
@@ -14,19 +15,40 @@ const dateString = (value: DateTime) => {
14
15
  }
15
16
 
16
17
  type LogisticProps = {
18
+ aria?: object,
19
+ className?: String,
17
20
  dark?: Boolean,
21
+ data?: object,
18
22
  date: String,
23
+ id?: String,
19
24
  link?: String,
20
- projectName: String,
21
- projectNumber: Number,
25
+ projectName?: String,
26
+ projectNumber?: Number,
22
27
  }
23
28
 
24
29
  const Logistic = (props: LogisticProps) => {
25
- const { dark = false, date, link, projectName, projectNumber } = props
30
+ const { aria = {},
31
+ className,
32
+ dark = false,
33
+ data = {},
34
+ date,
35
+ id,
36
+ link,
37
+ projectName,
38
+ projectNumber } = props
39
+
40
+ const ariaProps = buildAriaProps(aria)
41
+ const dataProps = buildDataProps(data)
26
42
  const formattedDate = new DateTime({ value: date })
43
+ const classes = classnames(buildCss('pb_logistic_kit', { dark: dark }), className, spacing(props))
27
44
 
28
45
  return (
29
- <div className={classnames('pb_logistic_kit', spacing(props))}>
46
+ <div
47
+ {...ariaProps}
48
+ {...dataProps}
49
+ className={classes}
50
+ id={id}
51
+ >
30
52
  <Body color="light">
31
53
  <Caption text="Project" />
32
54
  <Icon
@@ -1,4 +1,5 @@
1
1
  <%= content_tag(:div,
2
+ aria: object.aria,
2
3
  id: object.id,
3
4
  data: object.data,
4
5
  class: object.classname) do %>
@@ -3,12 +3,17 @@
3
3
  import React from 'react'
4
4
  import { Avatar, Body, Caption } from '../'
5
5
  import classnames from 'classnames'
6
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
7
  import { spacing } from '../utilities/spacing.js'
7
8
 
8
9
  type MessageProps = {
10
+ aria: object,
9
11
  avatarName?: String,
10
12
  avatarStatus?: String,
11
13
  avatarUrl?: String,
14
+ className?: String,
15
+ data?: object,
16
+ id?: String,
12
17
  label?: String,
13
18
  message: String,
14
19
  timestamp?: String,
@@ -16,20 +21,33 @@ type MessageProps = {
16
21
 
17
22
  const Message = (props: MessageProps) => {
18
23
  const {
19
- avatarName = '',
20
- avatarUrl = '',
21
- label = '',
22
- message = '',
23
- timestamp = '',
24
+ aria = {},
25
+ avatarName,
24
26
  avatarStatus = null,
27
+ avatarUrl,
28
+ className,
29
+ data = {},
30
+ id,
31
+ label,
32
+ message,
33
+ timestamp,
25
34
  } = props
35
+ const ariaProps = buildAriaProps(aria)
36
+ const dataProps = buildDataProps(data)
26
37
  const shouldDisplayAvatar = avatarUrl || avatarName
27
- const classes = shouldDisplayAvatar
38
+ const baseClassName = shouldDisplayAvatar
28
39
  ? 'pb_message_kit_avatar'
29
40
  : 'pb_message_kit'
30
41
 
42
+ const classes = classnames(buildCss(baseClassName), className, spacing(props))
43
+
31
44
  return (
32
- <div className={classnames(classes, spacing(props))}>
45
+ <div
46
+ {...ariaProps}
47
+ {...dataProps}
48
+ className={classes}
49
+ id={id}
50
+ >
33
51
  <If condition={shouldDisplayAvatar}>
34
52
  <Avatar
35
53
  imageUrl={avatarUrl}
@@ -4,7 +4,6 @@ import { Message } from '../../'
4
4
  const MessageDefault = () => {
5
5
  return (
6
6
  <div>
7
-
8
7
  <Message
9
8
  avatarName="Mike Bishop"
10
9
  avatarStatus="online"
@@ -31,7 +30,7 @@ const MessageDefault = () => {
31
30
  <Message
32
31
  avatarName="Lisa Thompson"
33
32
  avatarUrl="https://randomuser.me/api/portraits/women/39.jpg"
34
- message="To processs your order, I will need your full name."
33
+ message="To process your order, I will need your full name."
35
34
  timestamp="4 hours ago"
36
35
  />
37
36
 
@@ -25,7 +25,7 @@ module Playbook
25
25
  private
26
26
 
27
27
  def avatar_class
28
- avatar_name ? "avatar" : nil
28
+ valid? ? "avatar" : nil
29
29
  end
30
30
  end
31
31
  end
@@ -1,7 +1,14 @@
1
1
  <%= content_tag(:div,
2
+ aria: object.aria,
2
3
  id: object.id,
3
4
  data: object.data,
4
5
  class: object.classname) do %>
5
- <%= pb_rails("body", props: { tag: "span", classname: "pb_person_first", children: -> { object.first_name } }) %>
6
- <%= pb_rails("title", props: { text: object.last_name, size: 4 }) if object.last_name %>
6
+ <%= pb_rails("body", props: {
7
+ tag: "span",
8
+ classname: "pb_person_first",
9
+ children: -> { object.first_name
10
+ } }) %>
11
+ <%= pb_rails("title", props: {
12
+ text: object.last_name,
13
+ size: 4 }) if object.last_name %>
7
14
  <% end %>
@@ -4,32 +4,56 @@ import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { spacing } from '../utilities/spacing.js'
6
6
 
7
+ import {
8
+ buildAriaProps,
9
+ buildCss,
10
+ buildDataProps,
11
+ } from '../utilities/props'
12
+
7
13
  import { Body, Title } from '../'
8
14
 
9
15
  type PersonProps = {
16
+ aria?: object,
10
17
  className?: String | Array<String>,
11
- dark?: Boolean,
18
+ data?: object,
12
19
  firstName: String,
20
+ id?: String,
13
21
  lastName: String,
14
22
  }
15
23
 
16
24
  const Person = (props: PersonProps) => {
17
- const { className, dark = false, firstName, lastName } = props
25
+ const {
26
+ aria = {},
27
+ className,
28
+ data = {},
29
+ firstName,
30
+ id,
31
+ lastName } = props
32
+
33
+ const ariaProps = buildAriaProps(aria)
34
+ const dataProps = buildDataProps(data)
35
+ const classes = classnames(buildCss('pb_person_kit'), className, spacing(props))
36
+
18
37
  return (
19
- <div className={classnames('pb_person_kit', className, spacing(props))}>
38
+ <div
39
+ {...ariaProps}
40
+ {...dataProps}
41
+ className={classes}
42
+ id={id}
43
+ >
20
44
  <Body
21
45
  className="pb_person_first"
22
- dark={dark}
23
46
  tag="span"
24
47
  >
25
48
  {firstName}
26
49
  </Body>
27
- <Title
28
- className="pb_person_first"
29
- dark={dark}
30
- size={4}
31
- text={` ${lastName}`}
32
- />
50
+ <If condition={lastName}>
51
+ <Title
52
+ className="pb_person_first"
53
+ size={4}
54
+ text={` ${lastName}`}
55
+ />
56
+ </If>
33
57
  </div>
34
58
  )
35
59
  }
@@ -1 +1,5 @@
1
- <%= pb_rails("person", props: { first_name: "Kyle", last_name: "Fadigan" }) %>
1
+ <%= pb_rails("person",
2
+ props: {
3
+ first_name: "Kyle",
4
+ last_name: "Fadigan"
5
+ }) %>
@@ -1,4 +1,5 @@
1
1
  <%= content_tag(:div,
2
+ aria: object.aria,
2
3
  id: object.id,
3
4
  data: object.data,
4
5
  class: object.classname) do %>
@@ -2,9 +2,16 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
+
6
+ import {
7
+ buildAriaProps,
8
+ buildCss,
9
+ buildDataProps,
10
+ } from '../utilities/props'
11
+
5
12
  import { spacing } from '../utilities/spacing.js'
6
13
 
7
- import { Contact, Person } from '../'
14
+ import { Caption, Contact, Person } from '../'
8
15
 
9
16
  type ContactItem = {
10
17
  contactType: String,
@@ -13,30 +20,75 @@ type ContactItem = {
13
20
  }
14
21
 
15
22
  type PersonContactProps = {
23
+ aria?: object,
16
24
  className?: String | Array<String>,
17
25
  dark?: Boolean,
26
+ data?: object,
18
27
  firstName: String,
28
+ id?: String,
19
29
  lastName: String,
20
30
  contacts?: Array<ContactItem>,
21
31
  }
22
32
 
23
33
  const PersonContact = (props: PersonContactProps) => {
24
- const { className, firstName, lastName, contacts } = props
34
+ const {
35
+ aria = {},
36
+ className,
37
+ contacts = [],
38
+ data = {},
39
+ firstName,
40
+ id,
41
+ lastName,
42
+ } = props
43
+
44
+ const ariaProps = buildAriaProps(aria)
45
+ const dataProps = buildDataProps(data)
46
+ const classes = classnames(buildCss('pb_person_contact_kit'), className, spacing(props))
47
+
48
+ const wrongContacts = () => (
49
+ contacts.filter((contactObject) => (
50
+ contactObject.contactType === 'wrong-phone'
51
+ ))
52
+ )
53
+
54
+ const validContacts = () => (
55
+ contacts.filter((contactObject) => (
56
+ contactObject.contactType !== 'wrong-phone'
57
+ ))
58
+ )
25
59
 
26
60
  return (
27
- <div className={classnames('pb_person_contact_kit', className, spacing(props))}>
61
+ <div
62
+ {...ariaProps}
63
+ {...dataProps}
64
+ className={classes}
65
+ id={id}
66
+ >
28
67
  <Person
29
68
  firstName={firstName}
30
69
  lastName={lastName}
31
70
  />
32
- {contacts.map((contactObject, index) => (
71
+ {validContacts().map((contactObject, index) => (
33
72
  <Contact
34
73
  contactDetail={contactObject.contactDetail}
35
74
  contactType={contactObject.contactType}
36
75
  contactValue={contactObject.contactValue}
37
76
  key={index}
38
77
  />
39
- ))}
78
+ ))}
79
+ {wrongContacts().map((contactObject, index) => (
80
+ <>
81
+ <Caption
82
+ className="wrong_numbers"
83
+ text="wrong number"
84
+ />
85
+ <Contact
86
+ contactType={contactObject.contactType}
87
+ contactValue={contactObject.contactValue}
88
+ key={index}
89
+ />
90
+ </>
91
+ ))}
40
92
  </div>
41
93
  )
42
94
  }