playbook_ui 7.0.0.pre.alpha9 → 7.0.0.pre.alpha10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -4
  3. data/app/pb_kits/playbook/_playbook.scss +1 -0
  4. data/app/pb_kits/playbook/data/menu.yml +1 -0
  5. data/app/pb_kits/playbook/index.js +3 -0
  6. data/app/pb_kits/playbook/pb_button/_button.jsx +1 -0
  7. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +1 -1
  8. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +3 -7
  9. data/app/pb_kits/playbook/pb_button/docs/_button_default_dark.jsx +3 -0
  10. data/app/pb_kits/playbook/pb_button/docs/_button_link.jsx +2 -0
  11. data/app/pb_kits/playbook/pb_button/docs/_button_loading.jsx +2 -0
  12. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_link.html.erb +2 -1
  13. data/app/pb_kits/playbook/pb_date/_date.html.erb +8 -32
  14. data/app/pb_kits/playbook/pb_date/_date.jsx +67 -76
  15. data/app/pb_kits/playbook/pb_date/_date.scss +0 -25
  16. data/app/pb_kits/playbook/pb_date/date.rb +10 -18
  17. data/app/pb_kits/playbook/pb_date/docs/_date_default.html.erb +17 -2
  18. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +28 -0
  19. data/app/pb_kits/playbook/pb_date/docs/example.yml +2 -5
  20. data/app/pb_kits/playbook/pb_date/docs/index.js +1 -3
  21. data/app/pb_kits/playbook/pb_date_picker/_date_picker.html.erb +39 -0
  22. data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +149 -0
  23. data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +33 -0
  24. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +85 -0
  25. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +165 -0
  26. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_allow_input.html.erb +4 -0
  27. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_allow_input.jsx +13 -0
  28. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_allow_input.md +1 -0
  29. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_dark.html.erb +4 -0
  30. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_dark.jsx +13 -0
  31. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.html.erb +1 -0
  32. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.jsx +12 -0
  33. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.html.erb +24 -0
  34. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.jsx +30 -0
  35. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_disabled.html.erb +43 -0
  36. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_disabled.jsx +48 -0
  37. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.html.erb +4 -0
  38. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.jsx +13 -0
  39. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_format.html.erb +19 -0
  40. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_format.jsx +25 -0
  41. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_format.md +1 -0
  42. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hide_icon.html.erb +4 -0
  43. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hide_icon.jsx +13 -0
  44. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.html.erb +37 -0
  45. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.jsx +37 -0
  46. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.md +1 -0
  47. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_input.html.erb +26 -0
  48. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_input.jsx +32 -0
  49. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_input.md +3 -0
  50. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_label.html.erb +9 -0
  51. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_label.jsx +17 -0
  52. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_label.md +1 -0
  53. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_min_max.html.erb +14 -0
  54. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_min_max.jsx +22 -0
  55. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range.html.erb +4 -0
  56. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range.jsx +13 -0
  57. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_year_range.html.erb +7 -0
  58. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_year_range.jsx +16 -0
  59. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_year_range.md +1 -0
  60. data/app/pb_kits/playbook/pb_date_picker/docs/_description.md +7 -0
  61. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +35 -0
  62. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +14 -0
  63. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_calendar_input_icon.scss +33 -0
  64. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_day_styles.scss +53 -0
  65. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_flatpickr_styles.scss +785 -0
  66. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_header_styles.scss +108 -0
  67. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss +44 -0
  68. data/app/pb_kits/playbook/pb_filter/_filter.scss +1 -1
  69. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
  70. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
  71. data/app/pb_kits/playbook/pb_form/docs/_form_simple_form.html.erb +2 -0
  72. data/app/pb_kits/playbook/pb_form/docs/_form_simple_form_validate.html.erb +2 -0
  73. data/app/pb_kits/playbook/pb_form/form_builder.rb +1 -0
  74. data/app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb +20 -0
  75. data/app/pb_kits/playbook/pb_progress_step/progress_step.rb +2 -2
  76. data/app/pb_kits/playbook/pb_progress_step/progress_step_item.rb +0 -1
  77. data/app/pb_kits/playbook/pb_table/table.rb +3 -3
  78. data/app/pb_kits/playbook/pb_text_input/_text_input.html.erb +1 -0
  79. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +21 -17
  80. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +17 -8
  81. data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -0
  82. data/app/pb_kits/playbook/pb_time/_time.html.erb +23 -17
  83. data/app/pb_kits/playbook/pb_time/_time.jsx +20 -11
  84. data/app/pb_kits/playbook/pb_time/_time.scss +16 -8
  85. data/app/pb_kits/playbook/pb_time/docs/_time_align.html.erb +18 -0
  86. data/app/pb_kits/playbook/pb_time/docs/_time_align.jsx +3 -3
  87. data/app/pb_kits/playbook/pb_time/docs/_time_dark.html.erb +70 -0
  88. data/app/pb_kits/playbook/pb_time/docs/_time_dark.jsx +1 -6
  89. data/app/pb_kits/playbook/pb_time/docs/_time_default.html.erb +47 -3
  90. data/app/pb_kits/playbook/pb_time/docs/_time_default.jsx +33 -4
  91. data/app/pb_kits/playbook/pb_time/docs/_time_sizes.html.erb +11 -0
  92. data/app/pb_kits/playbook/pb_time/docs/_time_sizes.jsx +19 -0
  93. data/app/pb_kits/playbook/pb_time/docs/_time_timestamp.html.erb +2 -1
  94. data/app/pb_kits/playbook/pb_time/docs/_time_timestamp.jsx +0 -7
  95. data/app/pb_kits/playbook/pb_time/docs/_time_timezone.html.erb +42 -0
  96. data/app/pb_kits/playbook/pb_time/docs/_time_timezone.jsx +12 -14
  97. data/app/pb_kits/playbook/pb_time/docs/example.yml +7 -2
  98. data/app/pb_kits/playbook/pb_time/docs/index.js +1 -0
  99. data/app/pb_kits/playbook/pb_time/time.rb +14 -2
  100. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +60 -0
  101. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +20 -3
  102. data/app/pb_kits/playbook/pb_typeahead/components/Control.jsx +30 -0
  103. data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.jsx +13 -0
  104. data/app/pb_kits/playbook/pb_typeahead/components/MenuList.jsx +12 -0
  105. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx +51 -0
  106. data/app/pb_kits/playbook/pb_typeahead/components/Option.jsx +34 -0
  107. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.jsx +13 -0
  108. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.jsx +13 -0
  109. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default.jsx +22 -0
  110. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.jsx +29 -0
  111. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +84 -0
  112. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_summary.jsx +45 -0
  113. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +101 -0
  114. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_summary.jsx +27 -0
  115. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +8 -2
  116. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +4 -0
  117. data/app/pb_kits/playbook/tokens/_typography.scss +4 -4
  118. data/app/pb_kits/playbook/vendor.js +6 -0
  119. data/lib/playbook/version.rb +1 -1
  120. metadata +71 -8
  121. data/app/pb_kits/playbook/pb_date/docs/_date_alignment.html.erb +0 -24
  122. data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +0 -32
  123. data/app/pb_kits/playbook/pb_date/docs/_date_default_react.jsx +0 -20
  124. data/app/pb_kits/playbook/pb_date/docs/_date_default_react.md +0 -3
  125. data/app/pb_kits/playbook/pb_date/docs/_date_variants.html.erb +0 -27
  126. data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a43c45f7c02be5a750af086ebfcefc86725299eb31719a0a2dd8a6a79e97fd8d
4
- data.tar.gz: 859745ed6bd9388339f3ed65fbec574d07f2d3b109b7e8c79353272dcd7f888e
3
+ metadata.gz: 194c10ec06ce124dbe76ef242188655e8858047a6390fbf32471f54aabdd9c10
4
+ data.tar.gz: f17c05ef7b24bf389b1d646559faaa89862d684b0ff3bb6c81fd6f7e81e1c43f
5
5
  SHA512:
6
- metadata.gz: 96f4466b2ef7b76c1a35cea42bc83bdad24749c7e0bcfcba2b14a3d71f7215ab21a1400ec222976a96171a8b95bb9c77d3638b245a56856902532bbbdf4cbd42
7
- data.tar.gz: 9e29349a5a6b132d926b48ea385458153886e3f5df9d1eb340d6d7d710ef7506745cd90a59e50c876bdd03c8a697f995c02504c94bf3ab1765ddb4a4e542565b
6
+ metadata.gz: b5eb92a1873b2e77da0083aa018dada538cd2642ec23135a4b299ed75d21a0fee7d76f41954862a214c9b201c62cce3da9c9f4dac567b8d3671e55a47e16a64e
7
+ data.tar.gz: fcd1e7d53968d610fff6919e56341621d3286b331181861bc286e6483e1580d0732ece53915ce0ecd1f2a5818f813aacd59f8a5d370de8e66d4802ee153708d5
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.
@@ -16,6 +16,7 @@
16
16
  @import 'pb_currency/currency';
17
17
  @import 'pb_dashboard_value/dashboard_value';
18
18
  @import 'pb_date/date';
19
+ @import 'pb_date_picker/date_picker';
19
20
  @import 'pb_date_range_inline/date_range_inline';
20
21
  @import 'pb_date_range_stacked/date_range_stacked';
21
22
  @import 'pb_date_stacked/date_stacked';
@@ -25,6 +25,7 @@ kits:
25
25
  - fixed_confirmation_toast
26
26
  - flex
27
27
  - forms:
28
+ - date_picker
28
29
  - file_upload
29
30
  - form
30
31
  - form_pill
@@ -18,6 +18,7 @@ export Contact from './pb_contact/_contact.jsx'
18
18
  export Currency from './pb_currency/_currency.jsx'
19
19
  export DashboardValue from './pb_dashboard_value/_dashboard_value.jsx'
20
20
  export Date from './pb_date/_date.jsx'
21
+ export DatePicker from './pb_date_picker/_date_picker.jsx'
21
22
  export DateRangeInline from './pb_date_range_inline/_date_range_inline.jsx'
22
23
  export DateRangeStacked from './pb_date_range_stacked/_date_range_stacked.jsx'
23
24
  export DateStacked from './pb_date_stacked/_date_stacked.jsx'
@@ -83,6 +84,7 @@ export Title from './pb_title/_title.jsx'
83
84
  export TitleCount from './pb_title_count/_title_count.jsx'
84
85
  export TitleDetail from './pb_title_detail/_title_detail.jsx'
85
86
  export Toggle from './pb_toggle/_toggle.jsx'
87
+ export Typeahead from './pb_typeahead/_typeahead.jsx'
86
88
  export User from './pb_user/_user.jsx'
87
89
  export UserBadge from './pb_user_badge/_user_badge.jsx'
88
90
  export WeekdayStacked from './pb_weekday_stacked/_weekday_stacked.jsx'
@@ -95,6 +97,7 @@ export dashboardValueSettings from './pb_dashboard_value/dashboardValueSettings'
95
97
 
96
98
  // Other JS/Plugins
97
99
  export pbChart from './plugins/pb_chart.js'
100
+ export datePickerHelper from './pb_date_picker/date_picker_helper.js'
98
101
  export PbTypeahead from './pb_typeahead'
99
102
  export PbPopover from './pb_popover'
100
103
  export PbTable from './pb_table'
@@ -97,6 +97,7 @@ const Button = (props: ButtonPropTypes) => {
97
97
  <span className="pb_button_content">
98
98
  <If condition={icon !== null}>
99
99
  <i className={`pb_icon_kit far fa-${icon} fa-fw`} />
100
+ {' '}
100
101
  </If>
101
102
  <span>{text || children}</span>
102
103
  </span>
@@ -148,7 +148,7 @@ $pb_button_border_width: 0px;
148
148
 
149
149
  // Dark Link =============
150
150
  @mixin pb_button_link_dark {
151
- @include pb_button($transparent, $primary_action);
151
+ @include pb_button($transparent, $white);
152
152
 
153
153
  @media (hover:hover) {
154
154
  &:hover {
@@ -4,26 +4,22 @@ import { Button } from '../../'
4
4
  const ButtonDefault = () => (
5
5
  <div>
6
6
  <Button
7
- dark
8
- marginRight="xl"
9
7
  onClick={() => alert('button clicked!')}
10
8
  text="Button Primary"
11
9
  />
10
+ {' '}
12
11
  <Button
13
12
  onClick={() => alert('button clicked!')}
14
13
  text="Button Secondary"
15
14
  variant="secondary"
16
15
  />
16
+ {' '}
17
17
  <Button
18
18
  onClick={() => alert('button clicked!')}
19
19
  text="Button Link"
20
20
  variant="link"
21
21
  />
22
- <Button
23
- disabled
24
- onClick={() => alert('button clicked!')}
25
- text="Button Disabled"
26
- />
22
+ {' '}
27
23
  <Button
28
24
  disabled
29
25
  onClick={() => alert('button clicked!')}
@@ -7,16 +7,19 @@ const ButtonDefaultDark = () => (
7
7
  dark
8
8
  text="Button Primary"
9
9
  />
10
+ {' '}
10
11
  <Button
11
12
  dark
12
13
  text="Button Secondary"
13
14
  variant="secondary"
14
15
  />
16
+ {' '}
15
17
  <Button
16
18
  dark
17
19
  text="Button Link"
18
20
  variant="link"
19
21
  />
22
+ {' '}
20
23
  <Button
21
24
  dark
22
25
  disabled
@@ -7,11 +7,13 @@ const ButtonLink = () => (
7
7
  link="https://google.com"
8
8
  text="A Tag Button"
9
9
  />
10
+ {' '}
10
11
  <Button
11
12
  link="https://google.com"
12
13
  newWindow
13
14
  text="Open in New Window"
14
15
  />
16
+ {' '}
15
17
  <Button
16
18
  disabled
17
19
  link="https://google.com"
@@ -7,11 +7,13 @@ const ButtonLoading = () => (
7
7
  loading
8
8
  text="Button Primary"
9
9
  />
10
+ {' '}
10
11
  <Button
11
12
  loading
12
13
  text="Button Secondary"
13
14
  variant="secondary"
14
15
  />
16
+ {' '}
15
17
  <Button
16
18
  loading
17
19
  text="A Tag Button Disabled"
@@ -3,8 +3,9 @@
3
3
  icon: "search",
4
4
  link: "https://google.com"
5
5
  }) %>
6
+ <br/>
6
7
  <%= pb_rails("circle_icon_button", props: {
7
- variant: "primary",
8
+ variant: "secondary",
8
9
  icon: "window",
9
10
  link: "https://google.com",
10
11
  new_window: true
@@ -1,38 +1,14 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname,
5
- aria: object.aria) do %>
6
-
7
- <!-- icon -->
8
- <% if object.show_icon %>
9
- <%= pb_rails("body", props: {
10
- color: "light",
11
- tag: "div",
12
- }) do %>
13
- <%= pb_rails("icon", props: { icon: "calendar-alt", fixed_width: true }) %>
14
- <% end %>
15
- <% end %>
16
-
17
- <!-- day_of_week -->
18
- <% if object.show_day_of_week %>
19
- <%= pb_rails("title", props: { tag: "div", text: object.date_day_of_week, size: 4 }) %>
20
- <%= pb_rails("body", props: {
21
- text: "•",
22
- color: "light",
23
- tag: "div",
24
- }) %>
25
- <% end %>
26
-
27
- <!-- month day, year -->
28
-
29
- <%# if not current year %>
30
- <% if object.year.to_s == DateTime.now.year.to_s %>
31
- <%= pb_rails("title", props: { tag: "div", text: "#{object.month} #{object.day}", size: 4 }) %>
32
- <%# if is current year %>
33
- <% else %>
34
- <%= pb_rails("title", props: { tag: "div", text: "#{object.month} #{object.day}, #{object.year}", size: 4 }) %>
4
+ class: object.classname) do %>
5
+ <% if object.size == "lg" %>
6
+ <%= pb_rails("title", props: { text: object.lg_date, size: 3 }) %>
7
+ <% elsif object.size == "sm" %>
8
+ <%= pb_rails("icon", props: { icon: "calendar", fixed_width: true }) %>
9
+ <%= pb_rails("title", props: { tag: "span", text: object.sm_date, size: 4 }) %>
10
+ <% else %>
11
+ <%= pb_rails("title", props: { text: object.xs_date, size: 4 }) %>
35
12
  <% end %>
36
-
37
13
  <% end %>
38
14
 
@@ -2,91 +2,82 @@
2
2
 
3
3
  import React from 'react'
4
4
  import DateTime from '../pb_kit/dateTime.js'
5
- import { Body, Icon, Title } from '../'
5
+ import { Icon } from '../'
6
6
  import classnames from 'classnames'
7
7
  import { globalProps } from '../utilities/globalProps.js'
8
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
9
8
 
10
- type PbDateProps = {
11
- aria: Object,
12
- date: string | date,
13
- className?: string,
14
- data?: Object,
15
- id?: string,
16
- showIcon?: boolean,
17
- showDayOfWeek?: boolean,
18
- alignment?: "left" | "center" | "right"
9
+ const defaultDateString = (value: DateTime) => {
10
+ const weekday = value.toWeekday().toUpperCase()
11
+ const month = value.toMonth().toUpperCase()
12
+ const day = value.toDay()
13
+
14
+ return `${weekday} · ${month} ${day}`
19
15
  }
20
16
 
21
- const PbDate = (props: PbDateProps) => {
22
- const {
23
- aria = {},
24
- alignment = 'left',
25
- className,
26
- date,
27
- data = {},
28
- id,
29
- showDayOfWeek = false,
30
- showIcon = false,
31
- } = props
17
+ const largeDateString = (value: DateTime) => {
18
+ const month = value.toMonth().toUpperCase()
19
+ const day = value.toDay()
20
+
21
+ return `${month} ${day}`
22
+ }
32
23
 
33
- const dateTimestamp = new DateTime({ value: date })
34
- const weekday = dateTimestamp.toWeekday()
35
- const month = dateTimestamp.toMonth()
36
- const day = dateTimestamp.toDay()
37
- const year = dateTimestamp.toYear()
38
- const currentYear = new Date().getFullYear().toString()
24
+ type DateSubcomponent = {
25
+ value: DateTime,
26
+ }
39
27
 
40
- const ariaProps = buildAriaProps(aria)
41
- const dataProps = buildDataProps(data)
28
+ const ExtraSmallDate = ({ value, ...props }: DateSubcomponent) => (
29
+ <h3 className={classnames('pb_title_kit_4', globalProps(props))}>
30
+ {defaultDateString(value)}
31
+ </h3>
32
+ )
42
33
 
43
- const classes = classnames(
44
- className,
45
- buildCss('pb_date_kit', alignment),
46
- globalProps(props)
47
- )
34
+ const SmallDate = ({ value, ...props }: DateSubcomponent) => (
35
+ <h3 className={classnames('pb_title_kit_4', globalProps(props))}>
36
+ <Icon
37
+ fixedWidth
38
+ icon="calendar"
39
+ />
40
+ {defaultDateString(value)}
41
+ </h3>
42
+ )
43
+
44
+ const LargeDate = ({ value, ...props }: DateSubcomponent) => (
45
+ <h3 className={classnames('pb_title_kit_3', globalProps(props))}>
46
+ {largeDateString(value)}
47
+ </h3>
48
+ )
49
+
50
+ type PbDateProps = {
51
+ size?: "xs" | "sm" | "lg",
52
+ value?: string,
53
+ className?: string
54
+ }
55
+
56
+ const PbDate = ({ size, value, className, ...props }: PbDateProps) => {
57
+ const date = new DateTime({ value: value })
58
+
59
+ if (size == 'xs')
60
+ return (
61
+ <ExtraSmallDate
62
+ {...props}
63
+ className={className}
64
+ value={date}
65
+ />
66
+ )
67
+ if (size == 'lg')
68
+ return (
69
+ <LargeDate
70
+ {...props}
71
+ className={className}
72
+ value={date}
73
+ />
74
+ )
48
75
  return (
49
- <div
50
- {...ariaProps}
51
- {...dataProps}
52
- className={classes}
53
- id={id}
54
- >
55
- <Title
56
- size={4}
57
- tag="h4"
58
- >
59
- <If condition={showIcon}>
60
- <Body
61
- color="light"
62
- tag="span"
63
- >
64
- <Icon
65
- fixedWidth
66
- icon="calendar-alt"
67
- />
68
- </Body>
69
- </If>
70
- <If condition={showDayOfWeek}>
71
- {weekday}
72
- <Body
73
- color="light"
74
- tag="span"
75
- text=" • "
76
- />
77
- </If>
78
- <span>
79
- {month}
80
- {' '}
81
- {day}
82
- </span>
83
- <If condition={currentYear != year}>
84
- <span>
85
- {` , ${year}`}
86
- </span>
87
- </If>
88
- </Title>
89
- </div>
76
+ <SmallDate
77
+ {...props}
78
+ className={className}
79
+ value={date}
80
+ />
90
81
  )
91
82
  }
92
83
 
@@ -1,27 +1,2 @@
1
1
  @import "../pb_icon/icon";
2
2
  @import "../pb_title/title";
3
-
4
- [class^=pb_date_kit] {
5
- display: flex;
6
- flex-direction: row;
7
- align-items: center;
8
- > div {
9
- margin-right: 4px !important;
10
- }
11
-
12
- &[class*=_center] {
13
- display: flex;
14
- flex-direction: row;
15
- align-items: center;
16
- justify-content: center;
17
- margin-right: 4px !important;
18
- }
19
-
20
- &[class*=_right] {
21
- display: flex;
22
- flex-direction: row;
23
- align-items: center;
24
- justify-content: flex-end;
25
- margin-left: 4px !important;
26
- }
27
- }
@@ -10,33 +10,25 @@ module Playbook
10
10
  partial "pb_date/date"
11
11
 
12
12
  prop :date, required: true
13
+ prop :size, type: Playbook::Props::Enum,
14
+ values: %w[lg sm xs],
15
+ default: "sm"
13
16
  prop :timezone, default: "America/New_York"
14
- prop :alignment, type: Playbook::Props::Enum,
15
- values: %w[left center right],
16
- default: "left"
17
- prop :show_icon, type: Playbook::Props::Boolean,
18
- default: false
19
- prop :show_day_of_week, type: Playbook::Props::Boolean,
20
- default: false
21
17
 
22
18
  def classname
23
- generate_classname("pb_date_kit", alignment)
19
+ generate_classname("pb_date_kit")
24
20
  end
25
21
 
26
- def date_day_of_week
27
- pb_date_time.to_day_of_week
22
+ def xs_date
23
+ "#{pb_date_time.to_day_of_week.upcase} &middot; #{pb_date_time.to_month.upcase} #{pb_date_time.to_day}".html_safe
28
24
  end
29
25
 
30
- def day
31
- pb_date_time.to_day
26
+ def lg_date
27
+ "#{pb_date_time.to_month.upcase} #{pb_date_time.to_day}"
32
28
  end
33
29
 
34
- def month
35
- pb_date_time.to_month.capitalize
36
- end
37
-
38
- def year
39
- pb_date_time.to_year
30
+ def sm_date
31
+ "#{pb_date_time.to_day_of_week.upcase} &middot; #{pb_date_time.to_month.upcase} #{pb_date_time.to_day}".html_safe
40
32
  end
41
33
 
42
34
  private