playbook_ui 7.0.1.pre.alpha12 → 7.0.1.pre.alpha14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -6
  3. data/app/pb_kits/playbook/_playbook.scss +1 -0
  4. data/app/pb_kits/playbook/data/menu.yml +1 -1
  5. data/app/pb_kits/playbook/index.js +3 -0
  6. data/app/pb_kits/playbook/packs/examples.js +6 -0
  7. data/app/pb_kits/playbook/packs/site_styles/docs/_kit_doc.scss +22 -6
  8. data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +5 -1
  9. data/app/pb_kits/playbook/pb_background/_background.html.erb +14 -0
  10. data/app/pb_kits/playbook/pb_background/_background.jsx +64 -0
  11. data/app/pb_kits/playbook/pb_background/_background.scss +15 -0
  12. data/app/pb_kits/playbook/pb_background/background.rb +36 -0
  13. data/app/pb_kits/playbook/pb_background/docs/_background_default.html.erb +41 -0
  14. data/app/pb_kits/playbook/pb_background/docs/_background_default.jsx +75 -0
  15. data/app/pb_kits/playbook/pb_background/docs/example.yml +8 -0
  16. data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
  17. data/app/pb_kits/playbook/pb_badge/_badge.jsx +4 -2
  18. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +1 -1
  19. data/app/pb_kits/playbook/pb_button/_button.jsx +5 -1
  20. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +5 -1
  21. data/app/pb_kits/playbook/pb_caption/_caption.jsx +2 -2
  22. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +5 -2
  23. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +3 -1
  24. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_options.html.erb +10 -0
  25. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +1 -0
  26. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.html.erb +1 -1
  27. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +130 -0
  28. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.scss +1 -1
  29. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +39 -0
  30. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +29 -0
  31. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +28 -0
  32. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +117 -0
  33. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +53 -0
  34. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +30 -0
  35. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +45 -0
  36. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +30 -0
  37. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +45 -0
  38. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +11 -0
  39. data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +9 -0
  40. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +5 -1
  41. data/app/pb_kits/playbook/pb_contact/_contact.jsx +5 -1
  42. data/app/pb_kits/playbook/pb_currency/_currency.jsx +5 -1
  43. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +5 -1
  44. data/app/pb_kits/playbook/pb_date/date.rb +2 -1
  45. data/app/pb_kits/playbook/pb_date/docs/_date_default.html.erb +8 -1
  46. data/app/pb_kits/playbook/pb_date/docs/_date_timezone.html.erb +51 -0
  47. data/app/pb_kits/playbook/pb_date/docs/_date_timezone.md +6 -0
  48. data/app/pb_kits/playbook/pb_date/docs/_description.md +2 -0
  49. data/app/pb_kits/playbook/pb_date/docs/example.yml +1 -0
  50. data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +7 -4
  51. data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +0 -4
  52. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +3 -3
  53. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +8 -10
  54. data/app/pb_kits/playbook/pb_date_picker/docs/{_date_picker_read_only.html.erb → _date_picker_allow_input.html.erb} +1 -1
  55. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_allow_input.jsx +13 -0
  56. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_allow_input.md +1 -0
  57. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx +34 -0
  58. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.md +3 -0
  59. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +3 -2
  60. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -1
  61. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_calendar_input_icon.scss +1 -0
  62. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.jsx +5 -1
  63. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +2 -2
  64. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.jsx +5 -1
  65. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +2 -2
  66. data/app/pb_kits/playbook/pb_flex/_flex.jsx +2 -2
  67. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +1 -1
  68. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +6 -1
  69. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +3 -2
  70. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +1 -1
  71. data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +1 -1
  72. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +2 -2
  73. data/app/pb_kits/playbook/pb_icon/_icon.jsx +2 -2
  74. data/app/pb_kits/playbook/pb_icon_value/_icon_value.jsx +5 -1
  75. data/app/pb_kits/playbook/pb_image/_image.jsx +5 -1
  76. data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +5 -1
  77. data/app/pb_kits/playbook/pb_layout/_layout.jsx +4 -4
  78. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +1 -1
  79. data/app/pb_kits/playbook/pb_list/_list.jsx +3 -2
  80. data/app/pb_kits/playbook/pb_list/_list_item.jsx +3 -2
  81. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +5 -1
  82. data/app/pb_kits/playbook/pb_message/_message.jsx +5 -1
  83. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +5 -2
  84. data/app/pb_kits/playbook/pb_nav/_nav.jsx +2 -2
  85. data/app/pb_kits/playbook/pb_person/_person.jsx +5 -1
  86. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +5 -1
  87. data/app/pb_kits/playbook/pb_popover/_popover.jsx +5 -1
  88. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +4 -4
  89. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +1 -1
  90. data/app/pb_kits/playbook/pb_radio/_radio.html.erb +1 -1
  91. data/app/pb_kits/playbook/pb_radio/docs/_radio_options.html.erb +9 -0
  92. data/app/pb_kits/playbook/pb_radio/docs/example.yml +1 -0
  93. data/app/pb_kits/playbook/pb_radio/radio.rb +2 -4
  94. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +1 -1
  95. data/app/pb_kits/playbook/pb_select/_select.scss +1 -1
  96. data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +2 -2
  97. data/app/pb_kits/playbook/pb_stat_value/_stat_value.jsx +3 -3
  98. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.jsx +6 -1
  99. data/app/pb_kits/playbook/pb_table/_table.jsx +2 -2
  100. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +1 -1
  101. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +17 -8
  102. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +1 -1
  103. data/app/pb_kits/playbook/pb_time/_time.html.erb +23 -17
  104. data/app/pb_kits/playbook/pb_time/_time.jsx +22 -13
  105. data/app/pb_kits/playbook/pb_time/_time.scss +16 -8
  106. data/app/pb_kits/playbook/pb_time/docs/_time_align.html.erb +18 -0
  107. data/app/pb_kits/playbook/pb_time/docs/_time_align.jsx +3 -3
  108. data/app/pb_kits/playbook/pb_time/docs/_time_default.html.erb +47 -3
  109. data/app/pb_kits/playbook/pb_time/docs/_time_default.jsx +33 -4
  110. data/app/pb_kits/playbook/pb_time/docs/_time_sizes.html.erb +11 -0
  111. data/app/pb_kits/playbook/pb_time/docs/_time_sizes.jsx +19 -0
  112. data/app/pb_kits/playbook/pb_time/docs/_time_timestamp.html.erb +3 -1
  113. data/app/pb_kits/playbook/pb_time/docs/_time_timestamp.jsx +0 -7
  114. data/app/pb_kits/playbook/pb_time/docs/_time_timezone.html.erb +38 -0
  115. data/app/pb_kits/playbook/pb_time/docs/_time_timezone.jsx +12 -14
  116. data/app/pb_kits/playbook/pb_time/docs/example.yml +6 -2
  117. data/app/pb_kits/playbook/pb_time/docs/index.js +1 -0
  118. data/app/pb_kits/playbook/pb_time/time.rb +14 -2
  119. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.jsx +1 -1
  120. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx +3 -3
  121. data/app/pb_kits/playbook/pb_timestamp/_timestamp.jsx +1 -1
  122. data/app/pb_kits/playbook/pb_title/_title.jsx +5 -1
  123. data/app/pb_kits/playbook/pb_title_count/_title_count.jsx +5 -1
  124. data/app/pb_kits/playbook/pb_title_detail/_title_detail.jsx +1 -1
  125. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +3 -3
  126. data/app/pb_kits/playbook/pb_toggle/_toggle.scss +41 -43
  127. data/app/pb_kits/playbook/pb_toggle/docs/example.yml +0 -2
  128. data/app/pb_kits/playbook/pb_toggle/docs/index.js +0 -1
  129. data/app/pb_kits/playbook/pb_toggle/toggle.rb +2 -2
  130. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +60 -0
  131. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +20 -3
  132. data/app/pb_kits/playbook/pb_typeahead/components/Control.jsx +30 -0
  133. data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.jsx +13 -0
  134. data/app/pb_kits/playbook/pb_typeahead/components/MenuList.jsx +12 -0
  135. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx +51 -0
  136. data/app/pb_kits/playbook/pb_typeahead/components/Option.jsx +34 -0
  137. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.jsx +13 -0
  138. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.jsx +13 -0
  139. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default.jsx +22 -0
  140. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.jsx +29 -0
  141. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +84 -0
  142. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_summary.jsx +45 -0
  143. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +101 -0
  144. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_summary.jsx +27 -0
  145. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +8 -2
  146. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +4 -0
  147. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +5 -2
  148. data/app/pb_kits/playbook/plugins/pb_chart.js +1 -1
  149. data/app/pb_kits/playbook/tokens/_typography.scss +3 -3
  150. data/lib/generators/kit/templates/kit_jsx.erb.tt +1 -1
  151. data/lib/playbook/version.rb +1 -1
  152. metadata +50 -8
  153. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_read_only.jsx +0 -13
  154. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_read_only.md +0 -1
  155. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_size.html.erb +0 -11
  156. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_size.jsx +0 -44
@@ -0,0 +1,53 @@
1
+ import React, { useState } from 'react'
2
+ import { Button, CircleChart } from '../../'
3
+
4
+ const CircleChartLiveData = () => {
5
+ const [data, setData] = useState([
6
+ {
7
+ name: 'Waiting for Calls',
8
+ value: 41,
9
+ },
10
+ {
11
+ name: 'On Call',
12
+ value: 49,
13
+ },
14
+ {
15
+ name: 'After call',
16
+ value: 10,
17
+ },
18
+ ])
19
+
20
+ const data2 = [
21
+ {
22
+ name: 'Waiting for Calls',
23
+ value: 48,
24
+ },
25
+ {
26
+ name: 'On Call',
27
+ value: 12,
28
+ },
29
+ {
30
+ name: 'After call',
31
+ value: 140,
32
+ },
33
+ ]
34
+
35
+ const updateValue = () => {
36
+ setData(data2)
37
+ }
38
+
39
+ return (
40
+ <div>
41
+ <Button
42
+ onClick={updateValue}
43
+ text="Update Value"
44
+ />
45
+ <CircleChart
46
+ chartData={data}
47
+ id="circle-chart-live-data"
48
+ />
49
+ </div>
50
+ )
51
+ }
52
+
53
+ export default CircleChartLiveData
@@ -0,0 +1,30 @@
1
+ import React from 'react'
2
+ import { CircleChart } from '../../'
3
+
4
+ const dataRounded = [
5
+ {
6
+ name: 'Waiting for Calls',
7
+ value: 41,
8
+ },
9
+ {
10
+ name: 'On Call',
11
+ value: 49,
12
+ },
13
+ {
14
+ name: 'After call',
15
+ value: 10,
16
+ },
17
+ ]
18
+
19
+ const CircleChartRounded = () => (
20
+ <div>
21
+ <CircleChart
22
+ chartData={dataRounded}
23
+ id="default-test-rounded"
24
+ innerSize="lg"
25
+ rounded
26
+ />
27
+ </div>
28
+ )
29
+
30
+ export default CircleChartRounded
@@ -0,0 +1,45 @@
1
+ import React from 'react'
2
+ import { CircleChart } from '../../'
3
+
4
+ const dataWithLabels = [
5
+ {
6
+ name: 'Facebook',
7
+ value: 2498,
8
+ },
9
+ {
10
+ name: 'YouTube',
11
+ value: 2000,
12
+ },
13
+ {
14
+ name: 'WhatsApp',
15
+ value: 2000,
16
+ },
17
+ {
18
+ name: 'Facebook Messenger',
19
+ value: 1300,
20
+ },
21
+ {
22
+ name: 'WeChat',
23
+ value: 1165,
24
+ },
25
+ {
26
+ name: 'Instagram',
27
+ value: 1000,
28
+ },
29
+ {
30
+ name: 'Tik Tok',
31
+ value: 800,
32
+ },
33
+ ]
34
+
35
+ const CircleChartWithLabels = () => (
36
+ <div>
37
+ <CircleChart
38
+ chartData={dataWithLabels}
39
+ dataLabels
40
+ id="with-labels-example"
41
+ />
42
+ </div>
43
+ )
44
+
45
+ export default CircleChartWithLabels
@@ -0,0 +1,30 @@
1
+ import React from 'react'
2
+ import { CircleChart } from '../../'
3
+
4
+ const dataWithLegend = [{
5
+ name: 'Bugs',
6
+ value: 8,
7
+
8
+ },
9
+ {
10
+ name: 'Chores',
11
+ value: 1,
12
+
13
+ },
14
+ {
15
+ name: 'Stories',
16
+ value: 12,
17
+ },
18
+ ]
19
+
20
+ const CircleChartWithLegendKit = () => (
21
+ <div>
22
+ <CircleChart
23
+ chartData={dataWithLegend}
24
+ id="with-legend-example"
25
+ legend
26
+ />
27
+ </div>
28
+ )
29
+
30
+ export default CircleChartWithLegendKit
@@ -0,0 +1,45 @@
1
+ import React from 'react'
2
+ import { CircleChart } from '../../'
3
+
4
+ const dataWithTitle = [
5
+ {
6
+ name: 'Facebook',
7
+ value: 2498,
8
+ },
9
+ {
10
+ name: 'YouTube',
11
+ value: 2000,
12
+ },
13
+ {
14
+ name: 'WhatsApp',
15
+ value: 2000,
16
+ },
17
+ {
18
+ name: 'Facebook Messenger',
19
+ value: 1300,
20
+ },
21
+ {
22
+ name: 'WeChat',
23
+ value: 1165,
24
+ },
25
+ {
26
+ name: 'Instagram',
27
+ value: 1000,
28
+ },
29
+ {
30
+ name: 'Tik Tok',
31
+ value: 800,
32
+ },
33
+ ]
34
+
35
+ const CircleChartWithLegendKit = () => (
36
+ <div>
37
+ <CircleChart
38
+ chartData={dataWithTitle}
39
+ id="with-title-example"
40
+ title="Active Users on Social Media"
41
+ />
42
+ </div>
43
+ )
44
+
45
+ export default CircleChartWithLegendKit
@@ -10,4 +10,15 @@ examples:
10
10
  - circle_chart_with_title: Title
11
11
  - circle_chart_inner_sizes: Inner Circle Size Options
12
12
 
13
+ react:
14
+ - circle_chart_default: Default Style
15
+ - circle_chart_live_data: Live Data
16
+ - circle_chart_rounded: Rounded Corners
17
+ - circle_chart_block: Accepts Any Block
18
+ - circle_chart_colors: Color Overrides
19
+ - circle_chart_with_labels: Data Labels
20
+ - circle_chart_with_legend_kit: Legend
21
+ - circle_chart_with_title: Title
22
+ - circle_chart_inner_sizes: Inner Circle Size Options
23
+
13
24
 
@@ -0,0 +1,9 @@
1
+ export { default as CircleChartDefault } from './_circle_chart_default.jsx'
2
+ export { default as CircleChartLiveData } from './_circle_chart_live_data.jsx'
3
+ export { default as CircleChartRounded } from './_circle_chart_rounded.jsx'
4
+ export { default as CircleChartBlock } from './_circle_chart_block.jsx'
5
+ export { default as CircleChartColors } from './_circle_chart_colors.jsx'
6
+ export { default as CircleChartWithLabels } from './_circle_chart_with_labels.jsx'
7
+ export { default as CircleChartWithLegendKit } from './_circle_chart_with_legend_kit.jsx'
8
+ export { default as CircleChartWithTitle } from './_circle_chart_with_title.jsx'
9
+ export { default as CircleChartInnerSizes } from './_circle_chart_inner_sizes.jsx'
@@ -46,7 +46,11 @@ const CircleIconButton = (props: CircleIconButtonProps) => {
46
46
 
47
47
  const ariaProps = buildAriaProps(aria)
48
48
  const dataProps = buildDataProps(data)
49
- const classes = classnames(buildCss('pb_circle_icon_button_kit'), className, globalProps(props))
49
+ const classes = classnames(
50
+ buildCss('pb_circle_icon_button_kit'),
51
+ globalProps(props),
52
+ className
53
+ )
50
54
 
51
55
  return (
52
56
  <div
@@ -58,7 +58,11 @@ const Contact = (props: ContactProps) => {
58
58
  id } = props
59
59
  const ariaProps = buildAriaProps(aria)
60
60
  const dataProps = buildDataProps(data)
61
- const classes = classnames(buildCss('pb_contact_kit'), className, globalProps(props))
61
+ const classes = classnames(
62
+ buildCss('pb_contact_kit'),
63
+ globalProps(props),
64
+ className
65
+ )
62
66
 
63
67
  return (
64
68
  <div
@@ -45,7 +45,11 @@ const Currency = (props: CurrencyProps) => {
45
45
  const [whole, decimal = '00'] = amount.split('.')
46
46
  const ariaProps = buildAriaProps(aria)
47
47
  const dataProps = buildDataProps(data)
48
- const classes = classnames(buildCss('pb_currency_kit', align, size, { dark: dark }), className, globalProps(props))
48
+ const classes = classnames(
49
+ buildCss('pb_currency_kit', align, size, { dark }),
50
+ globalProps(props),
51
+ className
52
+ )
49
53
 
50
54
  return (
51
55
  <div
@@ -41,7 +41,11 @@ const DashboardValue = (props: DashboardValueProps) => {
41
41
 
42
42
  const ariaProps = buildAriaProps(aria)
43
43
  const dataProps = buildDataProps(data)
44
- const classes = classnames(buildCss('pb_dashboard_value_kit', align), className, globalProps(props))
44
+ const classes = classnames(
45
+ buildCss('pb_dashboard_value_kit', align),
46
+ globalProps(props),
47
+ className
48
+ )
45
49
 
46
50
  return (
47
51
  <div
@@ -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:
@@ -8,6 +8,7 @@ import { Icon, TextInput } from '../'
8
8
  import datePickerHelper from './date_picker_helper.js'
9
9
 
10
10
  type DatePickerProps = {
11
+ allowInput?: Boolean,
11
12
  aria?: object,
12
13
  className?: String,
13
14
  dark?: Boolean,
@@ -29,14 +30,15 @@ type DatePickerProps = {
29
30
  minDate: String,
30
31
  mode?: String,
31
32
  name: String,
33
+ onChange: (String) => void,
32
34
  pickerId?: String,
33
35
  placeholder?: String,
34
- readOnly?: Boolean,
35
36
  type?: String,
36
37
  yearRange?: Array,
37
38
  }
38
39
  const DatePicker = (props: DatePickerProps) => {
39
40
  const {
41
+ allowInput = false,
40
42
  aria = {},
41
43
  className,
42
44
  dark = false,
@@ -58,9 +60,9 @@ const DatePicker = (props: DatePickerProps) => {
58
60
  minDate,
59
61
  mode = 'single',
60
62
  name,
63
+ onChange = () => {},
61
64
  pickerId,
62
65
  placeholder,
63
- readOnly = false,
64
66
  type,
65
67
  yearRange = [ 1900, 2100 ],
66
68
  } = props
@@ -69,13 +71,14 @@ const DatePicker = (props: DatePickerProps) => {
69
71
  const dataProps = buildDataProps(data)
70
72
  const classes = classnames(
71
73
  buildCss('pb_date_picker_kit'),
72
- className,
73
74
  globalProps(props),
74
75
  error ? 'error' : null,
76
+ className
75
77
  )
76
78
 
77
79
  useEffect(() => {
78
80
  datePickerHelper({
81
+ allowInput: allowInput,
79
82
  defaultDate: defaultDate,
80
83
  disableDate: disableDate,
81
84
  disableRange: disableRange,
@@ -85,8 +88,8 @@ const DatePicker = (props: DatePickerProps) => {
85
88
  maxDate: maxDate,
86
89
  minDate: minDate,
87
90
  mode: mode,
91
+ onChange: onChange,
88
92
  pickerId: pickerId,
89
- readOnly: readOnly,
90
93
  yearRange: yearRange,
91
94
  })
92
95
  }, [])