playbook_ui 9.3.0.alpha.inline3 → 9.4.0.pre.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) 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_date_picker/_date_picker.jsx +1 -6
  4. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +0 -3
  5. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +45 -11
  6. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +17 -6
  7. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.rb +12 -5
  8. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.html.erb +5 -0
  9. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.jsx +38 -0
  10. data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +3 -1
  11. data/app/pb_kits/playbook/pb_date_stacked/docs/index.js +1 -0
  12. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +32 -16
  13. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +23 -4
  14. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +12 -8
  15. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +9 -2
  16. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +35 -0
  17. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.html.erb +8 -1
  18. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.jsx +19 -1
  19. data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +1 -1
  20. data/app/pb_kits/playbook/pb_flex/_flex.jsx +9 -7
  21. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +3 -4
  22. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +7 -3
  23. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +0 -3
  24. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +0 -3
  25. data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +2 -2
  26. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -9
  27. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -13
  28. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx +11 -21
  29. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.jsx +4 -17
  30. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default.jsx +0 -1
  31. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.jsx +3 -8
  32. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +4 -4
  33. data/lib/playbook/version.rb +1 -1
  34. metadata +6 -3
  35. data/app/pb_kits/playbook/pb_typeahead/components/Input.jsx +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 354862f897edc053e27311b331ef01bb927323b9006af47752f1e51ae5e6eeca
4
- data.tar.gz: 38946538f1a04c0c2df4b5e0d7e5cfeeeecf3bea46e3af26abb4852456429553
3
+ metadata.gz: 296e300fbad4165862a5e90a0c0547bac04ce6f8c751e855df8ce1c66922a7b0
4
+ data.tar.gz: c9cb628349bda60acc99bb903a45d54166b8f56b46793e8933c02c7b003fa1bb
5
5
  SHA512:
6
- metadata.gz: fd7e15aab84fd9ac50f52bee181437b79d7d67c3df141c2c40d1349b1c568e9e235aa42308455cb18bd0073131786323182853ef2fe046040efb16c5bd93cb46
7
- data.tar.gz: d0619331fbaec43977d07d10f9f6aa3ed89b3de0ac5f9a8e1572844b8696c4ae4fbd55513f087d830c1f6ef092f2be24f2c757ae95d88f16dec0555741ff7580
6
+ metadata.gz: 189cb41e0c3d0b1bc98b9c533eb2f3600486adcbdc32b57e891e1ee00ded94f8b4476a2f773da06f29cf2711c8f4379692938d973449309fa0e39ffbe465b736
7
+ data.tar.gz: 6e4f0849cf6d2ec1e93e074d1c2a06ef3ad92f3599911395cd3b73a27c82399afc146e969721dc28836f56f67e2e9357dd59da9295247fd446dd32bc0e8ce5d7
@@ -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
  }
@@ -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
@@ -9,6 +9,7 @@ import { globalProps } from '../utilities/globalProps.js'
9
9
 
10
10
  type DateStackedProps = {
11
11
  align?: "left" | "center" | "right",
12
+ bold?: boolean,
12
13
  className?: string | array<string>,
13
14
  dark?: boolean,
14
15
  data?: string,
@@ -26,6 +27,7 @@ const sizes = {
26
27
  const DateStacked = (props: DateStackedProps) => {
27
28
  const {
28
29
  align = 'left',
30
+ bold = false,
29
31
  reverse = false,
30
32
  className,
31
33
  dark = false,
@@ -46,19 +48,51 @@ const DateStacked = (props: DateStackedProps) => {
46
48
  const inputYear = dateTimestamp.toYear().toString()
47
49
 
48
50
  return (
49
- <div className={classes}>
50
- <div className="pb_date_stacked_day_month">
51
- <Caption text={dateTimestamp.toMonth().toUpperCase()} />
52
- <Title
53
- dark={dark}
54
- size={sizes[size]}
55
- text={dateTimestamp.toDay()}
56
- />
57
- </div>
58
- <If condition={currentYear != inputYear}>
59
- <Caption size="xs">{inputYear}</Caption>
51
+
52
+ <div>
53
+ <If condition={bold == false}>
54
+
55
+ <div className={classes}>
56
+ <div className="pb_date_stacked_day_month">
57
+ <Caption text={dateTimestamp.toMonth().toUpperCase()} />
58
+ <Title
59
+ dark={dark}
60
+ size={sizes[size]}
61
+ text={dateTimestamp.toDay()}
62
+ />
63
+ </div>
64
+ <If condition={currentYear != inputYear}>
65
+ <Caption size="xs">{inputYear}</Caption>
66
+ </If>
67
+ </div>
68
+ <Else />
69
+ <>
70
+ <div className={classes}>
71
+ <div className="pb_date_stacked_day_month">
72
+
73
+ <Title
74
+ bold
75
+ dark={dark}
76
+ size="4"
77
+ text={dateTimestamp.toMonth()}
78
+ />
79
+ <Title
80
+ bold
81
+ dark={dark}
82
+ size="4"
83
+ text={dateTimestamp.toDay()}
84
+ />
85
+ <If condition={currentYear != inputYear}>
86
+ <Title size="4">{inputYear}</Title>
87
+ </If>
88
+ </div>
89
+
90
+ </div>
91
+
92
+ </>
60
93
  </If>
61
94
  </div>
95
+
62
96
  )
63
97
  }
64
98
 
@@ -3,11 +3,22 @@
3
3
  data: object.data,
4
4
  class: object.classname) do %>
5
5
 
6
- <div class="pb_date_stacked_day_month">
7
- <%= pb_rails("caption", props: { text: object.month }) %>
8
- <%= pb_rails("title", props: { text: object.day , size: object.title_size }) do %>
9
- <% end %>
10
- </div>
11
- <%= pb_rails("caption", props: { text: object.year, size:"xs" }) %>
6
+ <% if object.bold == false %>
7
+
8
+ <div class="pb_date_stacked_day_month">
9
+ <%= pb_rails("caption", props: { text: object.month }) %>
10
+ <%= pb_rails("title", props: { text: object.day , size: object.title_size }) do %><% end %>
11
+ <%= pb_rails("caption", props: { text: object.year, size:"xs" }) %>
12
+ </div>
13
+
14
+ <% else %>
15
+ <div class="pb_date_stacked_day_month">
16
+ <%= pb_rails("title", props: { text: object.month, size: 4 }) %>
17
+ <%= pb_rails("title", props: { text: object.day, size: 4 }) do %><% end %>
18
+ <%= pb_rails("title", props: { text: object.year, size:4 }) %>
19
+
20
+ </div>
21
+
22
+ <% end %>
12
23
 
13
24
  <% end %>
@@ -14,9 +14,11 @@ module Playbook
14
14
  default: false
15
15
  prop :dark, type: Playbook::Props::Boolean,
16
16
  default: false
17
+ prop :bold, type: Playbook::Props::Boolean,
18
+ default: false
17
19
 
18
20
  def classname
19
- generate_classname("pb_date_stacked_kit", align, size, reverse_class, dark_class)
21
+ generate_classname("pb_date_stacked_kit", align, size, bold, reverse_class, dark_class)
20
22
  end
21
23
 
22
24
  def title_size
@@ -31,10 +33,7 @@ module Playbook
31
33
  end
32
34
 
33
35
  def month
34
- month = Playbook::PbKit::PbDateTime.new(date)
35
- content_tag(:time, datetime: month.to_iso) do
36
- "#{month.to_month}"
37
- end
36
+ pb_date_time.to_month.capitalize
38
37
  end
39
38
 
40
39
  def year
@@ -48,8 +47,16 @@ module Playbook
48
47
  end
49
48
  end
50
49
 
50
+ def bold_class
51
+ bold ? "bold" : nil
52
+ end
53
+
51
54
  private
52
55
 
56
+ def pb_date_time
57
+ Playbook::PbKit::PbDateTime.new(date)
58
+ end
59
+
53
60
  def reverse_class
54
61
  reverse ? "reverse" : nil
55
62
  end
@@ -0,0 +1,5 @@
1
+ <%= pb_rails("date_stacked", props: { date: DateTime.now, align: "left", bold: true }) %>
2
+ <br>
3
+ <%= pb_rails("date_stacked", props: { date: Date.new(2018, 03, 20), align: "center", bold: true }) %>
4
+ <br>
5
+ <%= pb_rails("date_stacked", props: { date: DateTime.now, align: "right", bold: true }) %>
@@ -0,0 +1,38 @@
1
+ import React from 'react'
2
+ import DateStacked from '../_date_stacked.jsx'
3
+
4
+ const DateStackedBold = (props) => {
5
+ return (
6
+ <div>
7
+ <DateStacked
8
+ align="left"
9
+ bold
10
+ date={new Date()}
11
+ {...props}
12
+ />
13
+
14
+ <br />
15
+
16
+ <DateStacked
17
+ align="center"
18
+ bold
19
+ date={new Date('20 Mar 2018')}
20
+ {...props}
21
+ />
22
+
23
+ <br />
24
+
25
+ <DateStacked
26
+ align="right"
27
+ bold
28
+ date={new Date()}
29
+ {...props}
30
+ />
31
+
32
+ <br />
33
+
34
+ </div>
35
+ )
36
+ }
37
+
38
+ export default DateStackedBold
@@ -6,10 +6,12 @@ examples:
6
6
  - date_stacked_reverse: Day & Month Reverse
7
7
  - date_stacked_sizes: Sizes
8
8
  - date_stacked_align: Alignment
9
+ - date_stacked_bold: Bold
10
+
9
11
 
10
12
  react:
11
13
  - date_stacked_default: Default
12
14
  - date_stacked_not_current_year: Not Current Year
13
15
  - date_stacked_reverse: Day & Month Reverse
14
16
  - date_stacked_sizes: Sizes
15
- - date_stacked_align: Alignment
17
+ - date_stacked_bold: Bold
@@ -1,3 +1,4 @@
1
+ export { default as DateStackedBold } from './_date_stacked_bold.jsx'
1
2
  export { default as DateStackedDefault } from './_date_stacked_default.jsx'
2
3
  export { default as DateStackedNotCurrentYear } from './_date_stacked_not_current_year.jsx'
3
4
  export { default as DateStackedReverse } from './_date_stacked_reverse.jsx'
@@ -1,43 +1,59 @@
1
+
1
2
  /* @flow */
2
3
 
3
4
  import React from 'react'
4
- import { DateStacked, Flex, FlexItem, TimeStacked } from '../'
5
- import { buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps.js'
5
+ import { buildCss } from '../utilities/props'
6
+ import { deprecatedProps, globalProps } from '../utilities/globalProps.js'
7
+
8
+ import { DateStacked, Flex, FlexItem, SectionSeparator, TimeStacked } from '../'
7
9
 
8
10
  type DateTimeStackedProps = {
9
- data?: string,
10
11
  id?: string,
11
- date: date,
12
+ date: string,
13
+ datetime: string,
12
14
  dark: boolean,
15
+ timeZone?: string,
13
16
  }
14
17
 
15
18
  const DateTimeStacked = (props: DateTimeStackedProps) => {
16
- const { date, data = {}, dark } = props,
17
- dataProps = buildDataProps(data)
19
+ if (props.date) deprecatedProps('Date Time Stacked', ['date'])
20
+
21
+ const {
22
+ date,
23
+ datetime,
24
+ dark,
25
+ timeZone = 'America/New_York',
26
+ } = props
27
+
28
+ const classes = buildCss('pb_date_time_stacked_kit', globalProps(props))
18
29
 
19
30
  return (
20
31
  <Flex
21
- className={globalProps(props)}
22
- orientation="row"
23
- vertical="center"
24
- {...dataProps}
32
+ inline="flex-container"
33
+ vertical="stretch"
34
+ {...props}
25
35
  >
26
36
  <FlexItem>
27
37
  <DateStacked
28
38
  align="right"
39
+ bold
29
40
  dark={dark}
30
- date={date}
31
- reverse
32
- size="sm"
41
+ date={date || datetime}
42
+ timeZone={timeZone}
33
43
  />
34
44
  </FlexItem>
45
+
46
+ <SectionSeparator
47
+ className="date-time-padding"
48
+ orientation="vertical"
49
+ />
35
50
  <FlexItem>
36
51
  <TimeStacked
37
- className="pb_date_time_stacked_kit"
52
+ className={classes}
38
53
  dark={dark}
54
+ date={date || datetime}
39
55
  tag="caption"
40
- time={date}
56
+ timeZone={timeZone}
41
57
  />
42
58
  </FlexItem>
43
59
  </Flex>
@@ -1,6 +1,25 @@
1
- @import "../pb_title/title";
2
- @import "../pb_body/body";
1
+ [class^=pb_date_time_stacked] {
2
+
3
+ [class^=padding_month] {
4
+ padding-bottom: ($space_xs + 2) !important;
5
+ }
6
+
7
+ [class^=padding_day] {
8
+ padding-bottom: ($space_xs + 2) !important;
9
+ }
10
+
11
+ &[class*=_dark] {
12
+ & > * [class^=pb_title_kit] {
13
+ color: $text_dk_default;
14
+ }
15
+ & > * [class^=pb_caption_kit] {
16
+ color: $text_dk_light;
17
+ }
18
+ }
3
19
 
4
- .pb_date_time_stacked_kit {
5
- padding-left: $space-xs;
6
20
  }
21
+ .date-time-padding {
22
+ padding-right: ($space_xs / 2);
23
+ padding-left: ($space_xs / 2);
24
+ }
25
+
@@ -1,13 +1,17 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname) do %>
5
- <%= pb_rails("flex", props: { orientation: "row", vertical: "center" }) do %>
6
- <%= pb_rails("flex/flex_item") do %>
7
- <%= pb_rails("date_stacked", props: { align: "right", date: object.date, reverse: true, size: "sm", dark: object.dark }) %>
4
+ class: object.classname,
5
+ aria: object.aria) do %>
6
+
7
+ <%= pb_rails("flex", props: {classname: "flex-container", vertical: "stretch"}) do %>
8
+ <%= pb_rails("body", props: {classname: "flex-item"}) do %>
9
+ <%= pb_rails("date_stacked", props: { date: object.date_time_value, size: "sm", align: "right", bold: true, dark: object.dark }) %>
8
10
  <% end %>
9
- <%= pb_rails("flex/flex_item") do %>
10
- <%= pb_rails("time_stacked", props: { classname: "pb_date_time_stacked_kit", time: object.date, tag: "caption" }) %>
11
+ <%= pb_rails("section_separator", props: { orientation: "vertical", classname: "date-time-padding" }) %>
12
+ <%= pb_rails("body", props: {classname: "flex-item"}) do %>
13
+ <%= pb_rails("time_stacked", props: { time: object.date_time_value, dark: object.dark, timezone: object.timezone }) %>
11
14
  <% end %>
12
- <% end %>
13
- <% end %>
15
+ <% end %>
16
+
17
+ <% end %>
@@ -3,10 +3,17 @@
3
3
  module Playbook
4
4
  module PbDateTimeStacked
5
5
  class DateTimeStacked < Playbook::KitBase
6
- prop :date, type: Playbook::Props::Date,
6
+ prop :date, deprecated: true
7
+ prop :date_time, type: Playbook::Props::Date,
7
8
  default: ::DateTime.current
8
9
  prop :dark, type: Playbook::Props::Boolean,
9
10
  default: false
11
+ prop :timezone, type: Playbook::Props::String,
12
+ default: "America/New_York"
13
+
14
+ def date_time_value
15
+ date || date_time
16
+ end
10
17
  end
11
18
  end
12
- end
19
+ end
@@ -0,0 +1,35 @@
1
+ import { ensureAccessible, renderKit } from '../utilities/test-utils'
2
+ import { DateTimeStacked } from '../'
3
+
4
+ /* eslint-disable jsx-control-statements/jsx-jcs-no-undef */
5
+
6
+ const props = {
7
+ data: { testid: 'datetimestacked' },
8
+ datetime: new Date('Wed Mar 31 2021 12:00:00 GMT-0500'),
9
+ }
10
+
11
+ test('Kit renders date time', () => {
12
+ const kit = renderKit(DateTimeStacked, props)
13
+ expect(kit).toBeInTheDocument()
14
+ })
15
+
16
+ it('Should be accessible', async () => {
17
+ ensureAccessible(DateTimeStacked, props)
18
+ })
19
+
20
+ test('renders time in default timezone', () => {
21
+ const kit = renderKit(DateTimeStacked, props)
22
+ expect(kit).toHaveTextContent(/Mar311:00pEDT/i)
23
+ })
24
+
25
+ test('renders time in timezone', () => {
26
+ props.timeZone = 'Asia/Tokyo'
27
+ const kit = renderKit(DateTimeStacked, props)
28
+ expect(kit).toHaveTextContent(/Mar312:00aJST/i)
29
+ })
30
+
31
+ test('renders time in timezone', () => {
32
+ props.timeZone = 'America/Denver'
33
+ const kit = renderKit(DateTimeStacked, props)
34
+ expect(kit).toHaveTextContent(/Mar3111:00aMDT/i)
35
+ })
@@ -1 +1,8 @@
1
- <%= pb_rails("date_time_stacked") %>
1
+ <%= pb_rails("date_time_stacked", props: { date_time: DateTime.now }) %>
2
+ <br>
3
+ <%= pb_rails("date_time_stacked", props: { date_time: Date.new(2018, 03, 20) }) %>
4
+ <br>
5
+ <%= pb_rails("date_time_stacked", props: { date_time: DateTime.now, timezone: "Asia/Tokyo" }) %>
6
+ <br>
7
+ <%= pb_rails("date_time_stacked", props: { date_time: DateTime.now, timezone: "America/Denver" }) %>
8
+
@@ -4,10 +4,28 @@ import { DateTimeStacked } from '../../'
4
4
  const DateTimeStackedDefault = (props) => (
5
5
  <div>
6
6
  <DateTimeStacked
7
- date={new Date()}
7
+ datetime={new Date()}
8
8
  {...props}
9
9
  />
10
+ <br />
11
+ <DateTimeStacked
12
+ datetime={new Date()}
13
+ timeZone="Asia/Tokyo"
14
+
15
+ {...props}
16
+ />
17
+ <br />
18
+ <DateTimeStacked
19
+ datetime={new Date()}
20
+ timeZone="America/Denver"
21
+
22
+ {...props}
23
+ />
24
+
10
25
  </div>
11
26
  )
12
27
 
13
28
  export default DateTimeStackedDefault
29
+
30
+ // *Development Note* - We are reviewing this kit for a potential name change due to naming collisions when `new Date()` is used.
31
+ // To avoid this bug, please use name spacing as shown in the code examples. ie `import { Date as AliasedComponentName } from '../../'
@@ -9,7 +9,7 @@ import { Dialog } from '../'
9
9
  - https://jestjs.io/docs/en/using-matchers
10
10
  */
11
11
 
12
- test('generated scaffold test - update me', () => {
12
+ test('Kit renders Dialog', () => {
13
13
  const testId = 'test1'
14
14
 
15
15
  render(
@@ -1,12 +1,13 @@
1
1
  /* @flow */
2
2
 
3
- import React, { forwardRef } from 'react'
3
+ import React from 'react'
4
4
  import classnames from 'classnames'
5
- import { buildCss } from '../utilities/props'
5
+ import { buildCss, buildDataProps } from '../utilities/props'
6
6
  import { globalProps } from '../utilities/globalProps.js'
7
7
  type FlexProps = {
8
8
  children: array<React.ReactNode> | React.ReactNode,
9
9
  className?: string,
10
+ data?: object,
10
11
  horizontal?: "left" | "center" | "right" | "stretch" | "none",
11
12
  justify?: "start" | "center" | "end" | "around" | "between" | "evenly" | "none",
12
13
  id?: string,
@@ -22,12 +23,12 @@ type FlexProps = {
22
23
  wrap?: boolean,
23
24
  }
24
25
 
25
- const Flex = (props: FlexProps, ref: React.ElementRef<"div">) => {
26
+ const Flex = (props: FlexProps) => {
26
27
  const {
27
28
  align = 'none',
28
29
  children,
29
30
  className,
30
- id,
31
+ data = {},
31
32
  inline = false,
32
33
  horizontal = 'left',
33
34
  justify = 'none',
@@ -52,6 +53,8 @@ const Flex = (props: FlexProps, ref: React.ElementRef<"div">) => {
52
53
  const columnGapClass = columnGap !== 'none' ? `columnGap_${columnGap}` : ''
53
54
  const wrapClass = wrap === true ? 'wrap' : ''
54
55
  const reverseClass = reverse === true ? 'reverse' : ''
56
+ const dataProps = buildDataProps(data)
57
+
55
58
  return (
56
59
  <div
57
60
  className={classnames(
@@ -71,12 +74,11 @@ const Flex = (props: FlexProps, ref: React.ElementRef<"div">) => {
71
74
  globalProps(props),
72
75
  className
73
76
  )}
74
- id={id}
75
- ref={ref}
77
+ {...dataProps}
76
78
  >
77
79
  {children}
78
80
  </div>
79
81
  )
80
82
  }
81
83
 
82
- export default forwardRef(Flex)
84
+ export default Flex
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
2
 
3
- import React, { forwardRef, useEffect, useRef } from 'react'
3
+ import React, { useEffect, useRef } from 'react'
4
4
  import classnames from 'classnames'
5
5
  import useFocus from './useFocus.js'
6
6
  import Trix from 'trix'
@@ -22,7 +22,7 @@ type RichTextEditorProps = {
22
22
  value?: string,
23
23
  }
24
24
 
25
- const RichTextEditor = (props: RichTextEditorProps, ref: React.ElementRef<"input">) => {
25
+ const RichTextEditor = (props: RichTextEditorProps) => {
26
26
  const {
27
27
  aria = {},
28
28
  className,
@@ -120,7 +120,6 @@ const RichTextEditor = (props: RichTextEditorProps, ref: React.ElementRef<"input
120
120
  <input
121
121
  id={id}
122
122
  name={name}
123
- ref={ref}
124
123
  type="hidden"
125
124
  value={value}
126
125
  />
@@ -134,4 +133,4 @@ const RichTextEditor = (props: RichTextEditorProps, ref: React.ElementRef<"input
134
133
  )
135
134
  }
136
135
 
137
- export default forwardRef(RichTextEditor)
136
+ export default RichTextEditor
@@ -38,9 +38,13 @@ const SectionSeparator = (props: SectionSeparatorProps) => {
38
38
  className={classes}
39
39
  id={id}
40
40
  >
41
- <span>
42
- <Caption text={text} />
43
- </span>
41
+
42
+ <If condition={text}>
43
+ <span>
44
+ <Caption text={text} />
45
+ </span>
46
+ </If>
47
+
44
48
  </div>
45
49
  )
46
50
  }
@@ -19,7 +19,6 @@ type TextInputProps = {
19
19
  id?: string,
20
20
  name: string,
21
21
  label: string,
22
- onBlur: (String) => void,
23
22
  onChange: (String) => void,
24
23
  placeholder: string,
25
24
  required?: boolean,
@@ -42,7 +41,6 @@ const TextInput = (
42
41
  id,
43
42
  name,
44
43
  label,
45
- onBlur = () => {},
46
44
  onChange = () => {},
47
45
  placeholder,
48
46
  required,
@@ -81,7 +79,6 @@ const TextInput = (
81
79
  disabled={disabled}
82
80
  id={id}
83
81
  name={name}
84
- onBlur={onBlur}
85
82
  onChange={onChange}
86
83
  placeholder={placeholder}
87
84
  ref={ref}
@@ -24,7 +24,6 @@ type TextareaProps = {
24
24
  required?: boolean,
25
25
  rows?: number,
26
26
  resize: 'none' | 'both' | 'horizontal' | 'vertical' | 'auto',
27
- onBlur?: InputCallback<HTMLTextAreaElement>,
28
27
  onChange?: InputCallback<HTMLTextAreaElement>,
29
28
  }
30
29
 
@@ -38,7 +37,6 @@ const Textarea = ({
38
37
  label,
39
38
  maxCharacters,
40
39
  name,
41
- onBlur = () => {},
42
40
  onChange = () => {},
43
41
  placeholder,
44
42
  required,
@@ -77,7 +75,6 @@ const Textarea = ({
77
75
  className="pb_textarea_kit"
78
76
  disabled={disabled}
79
77
  name={name}
80
- onBlur={onBlur}
81
78
  onChange={onChange}
82
79
  placeholder={placeholder}
83
80
  ref={ref}
@@ -3,10 +3,10 @@
3
3
  data: object.data,
4
4
  class: object.classname) do %>
5
5
 
6
- <%= pb_rails("body", props: { color: "light", classname: "pb_time_stacked time-spacing" }) do %>
6
+ <%= pb_rails("body", props: { color: "light", dark: object.dark, classname: "pb_time_stacked time-spacing" }) do %>
7
7
  <time>
8
8
  <%= object.format_time_string %>
9
- <%= pb_rails("caption", props: { color: "light", tag: "span", text: object.pb_date_time.to_timezone.upcase, classname: "pb_time_stacked" }) %>
9
+ <%= pb_rails("caption", props: { color: "light", tag: "span", text: object.pb_date_time.to_timezone.upcase, dark: object.dark, classname: "pb_time_stacked" }) %>
10
10
  </time>
11
11
  <% end %>
12
12
  <% end %>
@@ -3,14 +3,12 @@
3
3
  import React from 'react'
4
4
  import Select from 'react-select'
5
5
  import AsyncSelect from 'react-select/async'
6
- import CreateableSelect from 'react-select/creatable'
7
6
  import { get } from 'lodash'
8
7
  import { globalProps } from '../utilities/globalProps.js'
9
8
 
10
9
  import Control from './components/Control'
11
10
  import ClearIndicator from './components/ClearIndicator'
12
11
  import IndicatorsContainer from './components/IndicatorsContainer'
13
- // import Input from './components/Input'
14
12
  import MenuList from './components/MenuList'
15
13
  import MultiValue from './components/MultiValue'
16
14
  import Option from './components/Option'
@@ -28,7 +26,6 @@ import { noop } from '../utilities/props'
28
26
 
29
27
  type Props = {
30
28
  async?: boolean,
31
- createable?: boolean,
32
29
  dark?: boolean,
33
30
  label?: string,
34
31
  loadOptions?: noop | string,
@@ -44,14 +41,12 @@ type Props = {
44
41
 
45
42
  const Typeahead = (props: Props) => {
46
43
  const selectProps = {
47
- badges: false,
48
44
  cacheOptions: true,
49
45
  components: {
50
46
  Control,
51
47
  ClearIndicator,
52
48
  IndicatorsContainer,
53
49
  IndicatorSeparator: null,
54
- // Input,
55
50
  MenuList,
56
51
  MultiValue,
57
52
  Option,
@@ -63,8 +58,6 @@ const Typeahead = (props: Props) => {
63
58
  isClearable: true,
64
59
  isSearchable: true,
65
60
  name,
66
- onCreate: () => {},
67
- plusIcon: false,
68
61
  ...props,
69
62
  }
70
63
 
@@ -72,8 +65,7 @@ const Typeahead = (props: Props) => {
72
65
  if (typeof(props.getOptionLabel) === 'string') selectProps.getOptionLabel = get(window, props.getOptionLabel)
73
66
  if (typeof(props.getOptionValue) === 'string') selectProps.getOptionValue = get(window, props.getOptionValue)
74
67
 
75
- let Tag = props.async ? AsyncSelect : Select
76
- if (props.createable) Tag = CreateableSelect
68
+ const Tag = props.async ? AsyncSelect : Select
77
69
 
78
70
  const handleOnChange = (data, { action, option, removedValue }) => {
79
71
  if (action === 'select-option') {
@@ -154,17 +154,4 @@
154
154
  box-sizing: border-box;
155
155
  }
156
156
  }
157
- .placeholder+.input-wrapper .typeahead-plus-icon {
158
- display: none;
159
- }
160
- .typeahead-kit-select__control--is-focused .typeahead-plus-icon {
161
- display: none;
162
- }
163
- .typeahead-plus-icon {
164
- color: $text_lt_lighter;
165
- }
166
- [class^=pb_badge_kit] span {
167
- line-height: 16.5px;
168
- letter-spacing: normal;
169
- }
170
157
  }
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import { components } from 'react-select'
5
5
 
6
- import { Badge, FormPill } from '../../'
6
+ import { FormPill } from '../../'
7
7
 
8
8
  type Props = {
9
9
  data: object,
@@ -15,7 +15,6 @@ type Props = {
15
15
  const MultiValue = (props: Props) => {
16
16
  const { removeProps } = props
17
17
  const { imageUrl, label } = props.data
18
- const { badges } = props.selectProps
19
18
 
20
19
  const formPillProps = {
21
20
  marginRight: 'xs',
@@ -29,28 +28,19 @@ const MultiValue = (props: Props) => {
29
28
  className="text_input_multivalue_container"
30
29
  {...props}
31
30
  >
32
- <If condition={badges}>
33
- <Badge
31
+ <If condition={imageUrl}>
32
+ <FormPill
33
+ avatarUrl={imageUrl}
34
34
  closeProps={removeProps}
35
- removeIcon
36
- text={label}
37
- variant="primary"
35
+ marginRight="xs"
36
+ name={label}
38
37
  />
39
38
  <Else />
40
- <If condition={imageUrl}>
41
- <FormPill
42
- avatarUrl={imageUrl}
43
- closeProps={removeProps}
44
- marginRight="xs"
45
- name={label}
46
- />
47
- <Else />
48
- <FormPill
49
- closeProps={removeProps}
50
- marginRight="xs"
51
- text={label}
52
- />
53
- </If>
39
+ <FormPill
40
+ closeProps={removeProps}
41
+ marginRight="xs"
42
+ text={label}
43
+ />
54
44
  </If>
55
45
  </components.MultiValueContainer>
56
46
  )
@@ -1,26 +1,13 @@
1
1
  /* @flow */
2
2
 
3
3
  import React from 'react'
4
- import { Flex, Icon } from '../../'
5
4
  import { components } from 'react-select'
6
5
 
7
6
  const Placeholder = (props: any) => (
8
- <>
9
- <Flex
10
- align="center"
11
- className="placeholder"
12
- >
13
- <components.IndicatorsContainer
14
- {...props}
15
- />
16
- <If condition={props.selectProps.plusIcon}>
17
- <Icon
18
- className="typeahead-plus-icon"
19
- icon="plus"
20
- />
21
- </If>
22
- </Flex>
23
- </>
7
+ <components.IndicatorsContainer
8
+ className="placeholder"
9
+ {...props}
10
+ />
24
11
  )
25
12
 
26
13
  export default Placeholder
@@ -13,7 +13,6 @@ const options = [
13
13
  const TypeaheadDefault = (props) => {
14
14
  return (
15
15
  <Typeahead
16
- // badges
17
16
  label="Colors"
18
17
  options={options}
19
18
  {...props}
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import { Typeahead } from '../..'
5
5
 
6
- const initOptions = [
6
+ const options = [
7
7
  { label: 'Windows', value: '#FFA500' },
8
8
  { label: 'Siding', value: '#FF0000' },
9
9
  { label: 'Doors', value: '#00FF00' },
@@ -11,18 +11,13 @@ const initOptions = [
11
11
  ]
12
12
 
13
13
  const TypeaheadWithPills = (props) => {
14
- // const [values, setValues] = useState([])
15
14
  return (
16
15
  <>
17
16
  <Typeahead
18
- badges
19
- createable
20
17
  isMulti
21
18
  label="Colors"
22
- // onChange={(value) => console.log(value)}
23
- options={initOptions}
24
- placeholder="Placeholder"
25
- plusIcon
19
+ options={options}
20
+ placeholder=""
26
21
  {...props}
27
22
  />
28
23
  </>
@@ -7,8 +7,8 @@ examples:
7
7
  - typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
8
8
 
9
9
  react:
10
- # - typeahead_default: Default
10
+ - typeahead_default: Default
11
11
  - typeahead_with_pills: With Pills
12
- # - typeahead_with_pills_async: With Pills (Async Data)
13
- # - typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
14
- # - typeahead_with_pills_async_custom_options: With Pills (Async Data w/ Custom Options)
12
+ - typeahead_with_pills_async: With Pills (Async Data)
13
+ - typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
14
+ - typeahead_with_pills_async_custom_options: With Pills (Async Data w/ Custom Options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- VERSION = "9.3.0.alpha.inline3"
4
+ VERSION = "9.4.0.pre.alpha1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.3.0.alpha.inline3
4
+ version: 9.4.0.pre.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -809,6 +809,8 @@ files:
809
809
  - app/pb_kits/playbook/pb_date_stacked/date_stacked.rb
810
810
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_align.html.erb
811
811
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_align.jsx
812
+ - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.html.erb
813
+ - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.jsx
812
814
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.html.erb
813
815
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.jsx
814
816
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year.html.erb
@@ -838,6 +840,7 @@ files:
838
840
  - app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss
839
841
  - app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb
840
842
  - app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb
843
+ - app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
841
844
  - app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.html.erb
842
845
  - app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.jsx
843
846
  - app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml
@@ -1940,7 +1943,6 @@ files:
1940
1943
  - app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.jsx
1941
1944
  - app/pb_kits/playbook/pb_typeahead/components/Control.jsx
1942
1945
  - app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.jsx
1943
- - app/pb_kits/playbook/pb_typeahead/components/Input.jsx
1944
1946
  - app/pb_kits/playbook/pb_typeahead/components/MenuList.jsx
1945
1947
  - app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
1946
1948
  - app/pb_kits/playbook/pb_typeahead/components/Option.jsx
@@ -2108,7 +2110,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2108
2110
  - !ruby/object:Gem::Version
2109
2111
  version: 1.3.1
2110
2112
  requirements: []
2111
- rubygems_version: 3.1.4
2113
+ rubyforge_project:
2114
+ rubygems_version: 2.7.3
2112
2115
  signing_key:
2113
2116
  specification_version: 4
2114
2117
  summary: Playbook Design System
@@ -1,27 +0,0 @@
1
- /* @flow */
2
-
3
- import React from 'react'
4
- import { components } from 'react-select'
5
- import { Flex, Icon } from '../../'
6
-
7
- const Input = (props: any) => (
8
- <>
9
- <Flex
10
- align="center"
11
- className="input-wrapper"
12
- >
13
- <If condition={props.selectProps.plusIcon}>
14
- <Icon
15
- className="typeahead-plus-icon"
16
- icon="plus"
17
- />
18
- </If>
19
- <components.Input
20
- className="input"
21
- {...props}
22
- />
23
- </Flex>
24
- </>
25
- )
26
-
27
- export default Input