playbook_ui 6.5.2 → 6.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -4
  3. data/app/pb_kits/playbook/index.js +1 -0
  4. data/app/pb_kits/playbook/packs/examples.js +2 -0
  5. data/app/pb_kits/playbook/packs/site_styles/docs/_kit_doc.scss +6 -0
  6. data/app/pb_kits/playbook/pb_date/date.rb +2 -1
  7. data/app/pb_kits/playbook/pb_date/docs/_date_default.html.erb +8 -1
  8. data/app/pb_kits/playbook/pb_date/docs/_date_timezone.html.erb +51 -0
  9. data/app/pb_kits/playbook/pb_date/docs/_date_timezone.md +6 -0
  10. data/app/pb_kits/playbook/pb_date/docs/_description.md +2 -0
  11. data/app/pb_kits/playbook/pb_date/docs/example.yml +1 -0
  12. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +17 -8
  13. data/app/pb_kits/playbook/pb_time/_time.html.erb +23 -17
  14. data/app/pb_kits/playbook/pb_time/_time.jsx +20 -11
  15. data/app/pb_kits/playbook/pb_time/_time.scss +16 -8
  16. data/app/pb_kits/playbook/pb_time/docs/_time_align.html.erb +18 -0
  17. data/app/pb_kits/playbook/pb_time/docs/_time_align.jsx +3 -3
  18. data/app/pb_kits/playbook/pb_time/docs/_time_dark.html.erb +70 -0
  19. data/app/pb_kits/playbook/pb_time/docs/_time_dark.jsx +1 -6
  20. data/app/pb_kits/playbook/pb_time/docs/_time_default.html.erb +47 -3
  21. data/app/pb_kits/playbook/pb_time/docs/_time_default.jsx +33 -4
  22. data/app/pb_kits/playbook/pb_time/docs/_time_sizes.html.erb +11 -0
  23. data/app/pb_kits/playbook/pb_time/docs/_time_sizes.jsx +19 -0
  24. data/app/pb_kits/playbook/pb_time/docs/_time_timestamp.html.erb +2 -1
  25. data/app/pb_kits/playbook/pb_time/docs/_time_timestamp.jsx +0 -7
  26. data/app/pb_kits/playbook/pb_time/docs/_time_timezone.html.erb +42 -0
  27. data/app/pb_kits/playbook/pb_time/docs/_time_timezone.jsx +12 -14
  28. data/app/pb_kits/playbook/pb_time/docs/example.yml +7 -2
  29. data/app/pb_kits/playbook/pb_time/docs/index.js +1 -0
  30. data/app/pb_kits/playbook/pb_time/time.rb +14 -2
  31. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +60 -0
  32. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +20 -3
  33. data/app/pb_kits/playbook/pb_typeahead/components/Control.jsx +30 -0
  34. data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.jsx +13 -0
  35. data/app/pb_kits/playbook/pb_typeahead/components/MenuList.jsx +12 -0
  36. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx +51 -0
  37. data/app/pb_kits/playbook/pb_typeahead/components/Option.jsx +34 -0
  38. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.jsx +13 -0
  39. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.jsx +13 -0
  40. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default.jsx +22 -0
  41. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.jsx +29 -0
  42. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +84 -0
  43. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_summary.jsx +45 -0
  44. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +101 -0
  45. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_summary.jsx +27 -0
  46. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +8 -2
  47. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +4 -0
  48. data/app/pb_kits/playbook/tokens/_typography.scss +3 -3
  49. data/lib/playbook/version.rb +1 -1
  50. metadata +24 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 189a578c049c4d3de980ed42c9f15390a0c2e75eb001a30ef49952c0bdcfb708
4
- data.tar.gz: 5e13504ed89a6452cf39ce141d2f9a2859b4e3c5a56b545c64e72b10d156f61c
3
+ metadata.gz: 4166fb156350ec274aaf4be4faa24d97b7f846e6c58d9089aef4f7b260474efb
4
+ data.tar.gz: c1a9c2d1fd0268af9ec5e9f0d3391a789c6bc8ff77c31b729259a6b13d928e7c
5
5
  SHA512:
6
- metadata.gz: 9cb88a7b04c68efa695d9794036ce648beebd22802437f6663cbb6e102589000ce24827fde7eb93fc0faa61b9a9c4a93dba77a4fe7c1c8b6d035954d4d11d23f
7
- data.tar.gz: 1c6118da84bc1ab07fc64c9b19f60370ff59ea45aa636bb46ae02c770d15b519b3c609fa443ec535cef6ac162a90fa9550efeb2482264b5cc0d1f9f53f32778c
6
+ metadata.gz: 5331a285fcd6b9182da191e9a90f5f9e63e5e5255eec1224114bf8c7d2ad9db54861c625d911ce29924bffdc1a7ce9d197b77385e87ebe4a1872fb017f4fa5f8
7
+ data.tar.gz: cc6ba2e649843b2c017b30a92a7c26dbf33e21944aa29feadadbd51a068efd9789797eee928cb650c7f1a5ad40aba6708f0d4cbee218c43143bb21e5bfd188e8
data/README.md CHANGED
@@ -35,10 +35,9 @@ To run the tests, do `bin/test`. To launch a shell in the container run `make sh
35
35
 
36
36
  See [docs/upgrade-guide](./docs/upgrade-guide)
37
37
 
38
- ### Nitro & Releases
38
+ ### Releases
39
39
 
40
- * [Integrating Playbook Kits into Nitro Components](https://github.com/powerhome/playbook/wiki/Integrating-Playbook-Kits-into-Nitro-Components)
41
- * [Creating Releases](https://github.com/powerhome/playbook/wiki/Releasing-a-New-Version)
40
+ * [Playbook Releases](https://github.com/powerhome/playbook/wiki/Playbook-Releases)
42
41
 
43
42
  ### Development Environment
44
43
 
@@ -63,4 +62,4 @@ See [docs/upgrade-guide](./docs/upgrade-guide)
63
62
  5. When finished, inside of the directory you want to test with playbook, run `yarn unlink playbook-ui`.
64
63
  6. Inside of your Playbook repository, run `yarn unlink`.
65
64
 
66
- Keep in mind: Styles are brought in from playbook through the rails gem, so you will not be able to test scss updates with yarn linking.
65
+ Keep in mind: Styles are brought in from playbook through the rails gem, so you will not be able to test scss updates with yarn linking.
@@ -80,6 +80,7 @@ export Title from './pb_title/_title.jsx'
80
80
  export TitleCount from './pb_title_count/_title_count.jsx'
81
81
  export TitleDetail from './pb_title_detail/_title_detail.jsx'
82
82
  export Toggle from './pb_toggle/_toggle.jsx'
83
+ export Typeahead from './pb_typeahead/_typeahead.jsx'
83
84
  export User from './pb_user/_user.jsx'
84
85
  export UserBadge from './pb_user_badge/_user_badge.jsx'
85
86
  export WeekdayStacked from './pb_weekday_stacked/_weekday_stacked.jsx'
@@ -88,6 +88,7 @@ import * as TimeRangeInline from 'pb_time_range_inline/docs'
88
88
  import * as Title from 'pb_title/docs'
89
89
  import * as TitleCount from 'pb_title_count/docs'
90
90
  import * as TitleDetail from 'pb_title_detail/docs'
91
+ import * as Typeahead from 'pb_typeahead/docs'
91
92
  import * as Toggle from 'pb_toggle/docs'
92
93
  import * as User from 'pb_user/docs'
93
94
  import * as UserBadge from 'pb_user_badge/docs'
@@ -169,6 +170,7 @@ WebpackerReact.setup({
169
170
  ...Title,
170
171
  ...TitleCount,
171
172
  ...TitleDetail,
173
+ ...Typeahead,
172
174
  ...Toggle,
173
175
  ...User,
174
176
  ...UserBadge,
@@ -52,6 +52,12 @@
52
52
  top: 0;
53
53
  left: 0;
54
54
  }
55
+
56
+ code {
57
+ background-color: rgba($text_lt_lighter, 0.35);
58
+ border-radius: 5px;
59
+ padding: 2px;
60
+ }
55
61
  }
56
62
 
57
63
  .pb--codeControls {
@@ -13,6 +13,7 @@ module Playbook
13
13
  prop :size, type: Playbook::Props::Enum,
14
14
  values: %w[lg sm xs],
15
15
  default: "sm"
16
+ prop :timezone, default: "America/New_York"
16
17
 
17
18
  def classname
18
19
  generate_classname("pb_date_kit")
@@ -33,7 +34,7 @@ module Playbook
33
34
  private
34
35
 
35
36
  def pb_date_time
36
- Playbook::PbKit::PbDateTime.new(date)
37
+ Playbook::PbKit::PbDateTime.new(date, timezone)
37
38
  end
38
39
  end
39
40
  end
@@ -12,6 +12,13 @@
12
12
  <br>
13
13
 
14
14
  <%= pb_rails("date", props: {
15
- date: "2012-08-02T15:49:29Z",
15
+ date: DateTime.now,
16
+ timezone: "Asia/Tokyo"
17
+ }) %>
18
+
19
+ <br>
20
+
21
+ <%= pb_rails("date", props: {
22
+ date: Date.new(2010, 11, 12),
16
23
  size: "xs"
17
24
  }) %>
@@ -0,0 +1,51 @@
1
+ <%= pb_rails("caption", props: { text: "East Coast (Default)"}) %>
2
+ <%= pb_rails("date", props: {
3
+ date: DateTime.now,
4
+ timezone: "America/New_York"
5
+ }) %>
6
+
7
+ <br>
8
+
9
+ <%= pb_rails("caption", props: { text: "West Coast"}) %>
10
+ <%= pb_rails("date", props: {
11
+ date: DateTime.now,
12
+ timezone: "America/Los_Angeles"
13
+ }) %>
14
+
15
+ <br>
16
+
17
+ <%= pb_rails("caption", props: { text: "Toyko, Japan"}) %>
18
+ <%= pb_rails("date", props: {
19
+ date: DateTime.now,
20
+ timezone: "Asia/Tokyo"
21
+ }) %>
22
+
23
+ <br>
24
+
25
+ <%= pb_rails("caption", props: { text: "Anti-pattern example"}) %>
26
+
27
+ <%= pb_rails("date", props: {
28
+ date: Date.today,
29
+ timezone: "Australia/Sydney"
30
+ }) %>
31
+ <%= pb_rails("body", props: { text: "Date.today ignores Timezone"}) %>
32
+
33
+ <br>
34
+
35
+ <%= pb_rails("caption", props: { text: "DateTime respects Timezone"}) %>
36
+
37
+ <%= pb_rails("date", props: {
38
+ date: DateTime.now,
39
+ timezone: "Australia/Sydney"
40
+ }) %>
41
+
42
+ <%= pb_rails("body", props: { text: "'.now' in Australia is tomorrow (if you're EST after 10am)"}) %>
43
+
44
+ <br>
45
+
46
+ <%= pb_rails("caption", props: { text: "String Dates"}) %>
47
+ <%= pb_rails("date", props: {
48
+ date: "2012-08-02T00:49:29Z",
49
+ }) %>
50
+
51
+ <%= pb_rails("body", props: { text: "Defaults to UTC, then changes due to EST Timezone."}) %>
@@ -0,0 +1,6 @@
1
+ Depending on the data you send to the `date` prop you might have unexpected results due to ruby `Date` and `DateTime` classes.
2
+
3
+ Don't care about timezones? Use `Date`.
4
+
5
+ If you need a date that recognizes a timezone, especially when paired with the [Time kit](/kits/time), leverage `DateTime`.
6
+
@@ -1 +1,3 @@
1
1
  Use to display the date. Year will not display if it is the current year.
2
+
3
+ `DateTime` defaults to the "America/New_York" timezone. `Date` ignores timezone.
@@ -2,6 +2,7 @@ examples:
2
2
 
3
3
  rails:
4
4
  - date_default: Default
5
+ - date_timezone: Timezones
5
6
 
6
7
 
7
8
  react:
@@ -13,17 +13,22 @@
13
13
  margin-bottom: $space_sm;
14
14
  display: block;
15
15
 
16
- input::placeholder {
16
+ input::placeholder,
17
+ .text_input .placeholder {
17
18
  @include pb_body_light;
18
19
  }
19
20
 
20
- input {
21
+ input,
22
+ .text_input {
21
23
  @include pb_textarea_light;
22
24
  @include pb_title_4;
23
25
  overflow: hidden;
24
26
  }
25
27
 
26
- input:focus, input:-webkit-autofill:focus {
28
+ input:focus,
29
+ .text_input:focus,
30
+ input:-webkit-autofill:focus,
31
+ .text_input:-webkit-autofill:focus {
27
32
  @include pb_textarea_focus;
28
33
  -webkit-box-shadow: 0 0 0px 1000px $focus_input_light inset;
29
34
  transition: background-color 5000s ease-in-out 0s;
@@ -34,18 +39,22 @@
34
39
  .text_input_wrapper {
35
40
  margin-bottom: 1rem;
36
41
 
37
- input::placeholder {
42
+ input::placeholder,
43
+ .text_input .placeholder {
38
44
  @include pb_body_light_dark;
39
45
  }
40
46
 
41
- input {
47
+ input, .text_input {
42
48
  @include pb_textarea_dark;
43
49
  @include pb_title_4;
44
50
  @include pb_title_dark;
45
51
  overflow: hidden;
46
52
  }
47
53
 
48
- input:focus, input:-webkit-autofill:focus {
54
+ input:focus,
55
+ .text_input:focus,
56
+ input:-webkit-autofill:focus,
57
+ .text_input:-webkit-autofill:focus {
49
58
  @include pb_textarea_focus_dark;
50
59
  -webkit-box-shadow: 0 0 0px 1000px $focus_input_dark inset;
51
60
  transition: background-color 5000s ease-in-out 0s;
@@ -54,7 +63,7 @@
54
63
 
55
64
  &.error {
56
65
  .text_input_wrapper {
57
- input {
66
+ input, .text_input {
58
67
  border-color: $error_dark;
59
68
  }
60
69
  }
@@ -66,7 +75,7 @@
66
75
  [class*=pb_body_kit] {
67
76
  margin-top: $space_xs / 2;
68
77
  }
69
- input {
78
+ input, .text_input {
70
79
  border-color: $error;
71
80
  }
72
81
  }
@@ -2,32 +2,38 @@
2
2
  id: object.id,
3
3
  data: object.data,
4
4
  class: object.classname) do %>
5
- <% if object.size == "lg" %>
6
- <%= pb_rails("title", props: { tag: "span", text: object.format_time_string, size: 3 }) %>
7
- <%= content_tag(:span) do %>
5
+ <%
6
+ # convert deprecated prop values
7
+ size = object.size
8
+ size = "sm" if object.size == "xs"
9
+ size = "md" if object.size == "lg"
10
+ %>
11
+ <% if size == "md" %>
12
+ <% if object.show_icon %>
13
+ <%= pb_rails("body", props: { color: "light", tag: "span"}) do %>
14
+ <%= pb_rails("icon", props: { icon: "clock", fixed_width: true, size: "lg" }) %>
15
+ <% end %>
16
+ <% end %>
17
+ <%= pb_rails("caption", props: { tag: "span", text: object.format_time_string, size: "lg" }) %>
18
+ <% if object.show_timezone %>
8
19
  <%= content_tag(:span, class: "pb_time_timezone") do %>
9
20
  <%= object.pb_date_time.to_timezone.upcase %>
10
21
  <% end %>
11
22
  <% end %>
12
- <% elsif object.size == "sm" %>
13
- <%= pb_rails("body", props: { tag: "span", text: object.format_time_string }) do %>
14
- <%= pb_rails("icon", props: { icon: "clock", fixed_width: true }) %>
15
- <%= content_tag(:time, datetime: object.pb_date_time.to_iso) do %>
16
- <%= content_tag(:span) do %>
17
- <%= object.format_time_string %>
18
- <%= content_tag(:span, class: "pb_time_timezone") do %>
19
- <%= object.pb_date_time.to_timezone.upcase %>
20
- <% end %>
21
- <% end %>
23
+ <% else %>
24
+ <% if object.show_icon %>
25
+ <%= pb_rails("body", props: { color: "light", tag: "span"}) do %>
26
+ <%= pb_rails("icon", props: { icon: "clock", fixed_width: true }) %>
22
27
  <% end %>
23
28
  <% end %>
24
- <% else %>
25
- <%= pb_rails("body", props: { tag: "span", text: object.format_time_string }) do %>
29
+ <%= pb_rails("body", props: { color: "light", tag: "span", text: object.format_time_string }) do %>
26
30
  <%= content_tag(:time, datetime: object.pb_date_time.to_iso) do %>
27
31
  <%= content_tag(:span) do %>
28
32
  <%= object.format_time_string %>
29
- <%= content_tag(:span, class: "pb_time_timezone") do %>
30
- <%= object.pb_date_time.to_timezone.upcase %>
33
+ <% if object.show_timezone %>
34
+ <%= content_tag(:span, class: "pb_time_timezone") do %>
35
+ <%= object.pb_date_time.to_timezone.upcase %>
36
+ <% end %>
31
37
  <% end %>
32
38
  <% end %>
33
39
  <% end %>
@@ -7,20 +7,22 @@ import DateTime from '../pb_kit/dateTime.js'
7
7
  import { buildCss } from '../utilities/props'
8
8
  import { globalProps } from '../utilities/globalProps.js'
9
9
 
10
- import { Body, Icon, Title } from '../'
10
+ import { Body, Caption, Icon } from '../'
11
11
 
12
12
  type TimeProps = {
13
13
  align?: 'left' | 'center' | 'right',
14
14
  className?: string | array<string>,
15
15
  data?: string,
16
16
  date: string,
17
+ dark?: boolean,
17
18
  id?: string,
18
- size?: 'lg' | 'sm' | 'xs',
19
+ showIcon?: boolean,
20
+ size?: 'md' | 'sm',
19
21
  timeZone?: string,
20
22
  }
21
23
 
22
24
  const Time = (props: TimeProps) => {
23
- const { align, className, date, size, timeZone } = props
25
+ const { align, className, date, showIcon, size, timeZone } = props
24
26
  const classes = classnames(
25
27
  className,
26
28
  buildCss('pb_time_kit', align, size),
@@ -32,23 +34,30 @@ const Time = (props: TimeProps) => {
32
34
  return (
33
35
  <div className={classes}>
34
36
  <span className="pb_body_kit">
35
- <If condition={size === 'sm'}>
36
- <Icon
37
- fixedWidth
38
- icon="clock"
39
- />
37
+ <If condition={showIcon}>
38
+ <Body
39
+ color="light"
40
+ tag="span"
41
+ >
42
+ <Icon
43
+ fixedWidth
44
+ icon="clock"
45
+ size={size === 'md' ? 'lg' : 'sm'}
46
+ />
47
+ </Body>
40
48
  {' '}
41
49
  </If>
42
50
  <time dateTime={date}>
43
51
  <span>
44
- <If condition={size !== 'lg'}>
52
+ <If condition={size !== 'md'}>
45
53
  <Body
54
+ color="light"
46
55
  tag="span"
47
56
  text={dateTimestamp.toTimeWithMeridian()}
48
57
  />
49
58
  <Else />
50
- <Title
51
- size={3}
59
+ <Caption
60
+ size="lg"
52
61
  tag="span"
53
62
  text={dateTimestamp.toTimeWithMeridian()}
54
63
  />
@@ -2,9 +2,11 @@
2
2
  @import "../tokens/typography";
3
3
  @import "../pb_icon/icon";
4
4
  @import "../pb_body/body";
5
- @import "../pb_title/title";
5
+ @import "../pb_caption/caption";
6
6
 
7
7
  [class^=pb_time_kit] {
8
+ letter-spacing: $lspace_looser;
9
+ text-transform: uppercase;
8
10
  &[class*=_center] {
9
11
  text-align: center;
10
12
  }
@@ -18,27 +20,33 @@
18
20
  }
19
21
 
20
22
  [class^=pb_time_timezone] {
21
- font-size: $font-small;
22
- font-weight: $regular;
23
- color: $text-lt-light;
23
+ color: $text_lt_light;
24
+ font-weight: $bold;
24
25
 
25
26
  &::before {
26
27
  content: " ";
27
28
  }
28
29
  }
29
30
 
30
- &[class*=_lg] {
31
+ &[class*=_md] {
32
+ [class^=pb_caption_kit] {
33
+ color: $text_lt_default;
34
+ letter-spacing: $lspace_tight;
35
+ text-transform: capitalize;
36
+ }
31
37
  [class^=pb_time_timezone] {
38
+ color: $text_lt_light;
32
39
  font-size: $font-large !important;
33
- color: $text-lt-light;
40
+ font-weight: $regular;
41
+ letter-spacing: $lspace_tight;
34
42
  }
35
43
  }
36
44
 
37
45
  &.dark {
38
- & > * [class^=pb_title_kit] {
46
+ [class^=pb_caption_kit] {
39
47
  color: $text_dk_default;
40
48
  }
41
- & > * [class^=pb_body_kit] {
49
+ [class^=pb_body_kit] {
42
50
  color: $text_dk_light;
43
51
  }
44
52
  }
@@ -0,0 +1,18 @@
1
+ <%= pb_rails("time", props: {
2
+ time: DateTime.now,
3
+ align: "left"
4
+ }) %>
5
+
6
+ <br>
7
+
8
+ <%= pb_rails("time", props: {
9
+ time: Time.now,
10
+ align: "center"
11
+ }) %>
12
+
13
+ <br>
14
+
15
+ <%= pb_rails("time", props: {
16
+ time: Time.now,
17
+ align: "right"
18
+ }) %>
@@ -6,19 +6,19 @@ const TimeAlign = () => {
6
6
  <div>
7
7
  <Time
8
8
  date={new Date()}
9
- size="lg"
9
+ size="md"
10
10
  />
11
11
  <br />
12
12
  <Time
13
13
  align="center"
14
14
  date={new Date()}
15
- size="lg"
15
+ size="md"
16
16
  />
17
17
  <br />
18
18
  <Time
19
19
  align="right"
20
20
  date={new Date()}
21
- size="lg"
21
+ size="md"
22
22
  />
23
23
  </div>
24
24
  )