playbook_ui 7.0.1.pre.alpha14 → 7.0.1.pre.alpha15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/playbook/application_controller.rb +0 -2
  3. data/app/pb_kits/playbook/_playbook.scss +1 -1
  4. data/app/pb_kits/playbook/data/menu.yml +5 -4
  5. data/app/pb_kits/playbook/index.js +4 -1
  6. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.html.erb +1 -12
  7. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +1 -1
  8. data/app/pb_kits/playbook/pb_body/body.rb +1 -1
  9. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +1 -0
  10. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +3 -3
  11. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.scss +82 -90
  12. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar_dark.scss +57 -0
  13. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar_mixins.scss +27 -0
  14. data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.rb +4 -2
  15. data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_default.html.erb +17 -7
  16. data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_default.jsx +32 -9
  17. data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_secondary.html.erb +18 -7
  18. data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_secondary.jsx +37 -9
  19. data/app/pb_kits/playbook/pb_button_toolbar/docs/example.yml +3 -7
  20. data/app/pb_kits/playbook/pb_button_toolbar/docs/index.js +0 -2
  21. data/app/pb_kits/playbook/pb_caption/_caption.html.erb +7 -5
  22. data/app/pb_kits/playbook/pb_caption/docs/_caption_block.html.erb +11 -0
  23. data/app/pb_kits/playbook/pb_caption/docs/_caption_block.jsx +28 -0
  24. data/app/pb_kits/playbook/pb_caption/docs/example.yml +2 -0
  25. data/app/pb_kits/playbook/pb_caption/docs/index.js +1 -0
  26. data/app/pb_kits/playbook/pb_date_picker/_date_picker.html.erb +1 -2
  27. data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +1 -3
  28. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +3 -2
  29. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +34 -32
  30. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.html.erb +1 -2
  31. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.jsx +1 -2
  32. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +1 -0
  33. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_format.html.erb +4 -0
  34. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_format.jsx +4 -0
  35. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_input.html.erb +9 -9
  36. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_input.jsx +8 -8
  37. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_input.md +3 -1
  38. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range.html.erb +1 -0
  39. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range.jsx +1 -0
  40. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -4
  41. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +0 -2
  42. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.html.erb +8 -14
  43. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx +122 -39
  44. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss +33 -2
  45. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.rb +44 -9
  46. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default.html.erb +14 -1
  47. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default.jsx +45 -1
  48. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.html.erb +1 -8
  49. data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.rb +7 -0
  50. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.html.erb +3 -2
  51. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +29 -15
  52. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +10 -0
  53. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close.html.erb +21 -0
  54. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close.jsx +38 -0
  55. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default.html.erb +2 -1
  56. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default.jsx +1 -2
  57. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.html.erb +1 -1
  58. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.jsx +1 -1
  59. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line_dark.html.erb +1 -1
  60. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line_dark.jsx +1 -1
  61. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  62. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
  63. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +7 -1
  64. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js +18 -0
  65. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +9 -6
  66. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  67. data/app/pb_kits/playbook/pb_form/docs/_form_simple_form.html.erb +3 -3
  68. data/app/pb_kits/playbook/pb_form/docs/_form_simple_form_validate.html.erb +3 -3
  69. data/app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb +7 -2
  70. data/app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb +1 -0
  71. data/app/pb_kits/playbook/pb_line_graph/_line_graph.html.erb +1 -13
  72. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +1 -1
  73. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +7 -6
  74. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_with_wrong_numbers.jsx +1 -0
  75. data/app/pb_kits/playbook/pb_popover/_popover.scss +6 -4
  76. data/app/pb_kits/playbook/pb_popover/index.js +3 -1
  77. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +3 -0
  78. data/app/pb_kits/playbook/pb_progress_step/_progress_step.scss +168 -33
  79. data/app/pb_kits/playbook/pb_progress_step/_progress_step_item.html.erb +3 -1
  80. data/app/pb_kits/playbook/pb_progress_step/_progress_step_item.jsx +10 -8
  81. data/app/pb_kits/playbook/pb_progress_step/docs/_description.md +1 -1
  82. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.html.erb +14 -16
  83. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.jsx +6 -3
  84. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tracker.html.erb +17 -1
  85. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tracker.jsx +17 -1
  86. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.jsx +10 -3
  87. data/app/pb_kits/playbook/pb_progress_step/progress_step.rb +11 -1
  88. data/app/pb_kits/playbook/pb_progress_step/progress_step_item.rb +1 -1
  89. data/app/pb_kits/playbook/pb_table/docs/_table_action_middle.html.erb +34 -0
  90. data/app/pb_kits/playbook/pb_table/docs/_table_action_middle.jsx +68 -0
  91. data/app/pb_kits/playbook/pb_table/docs/_table_action_middle.md +2 -0
  92. data/app/pb_kits/playbook/pb_table/docs/_table_icon_buttons.html.erb +61 -0
  93. data/app/pb_kits/playbook/pb_table/docs/_table_icon_buttons.jsx +89 -0
  94. data/app/pb_kits/playbook/pb_table/docs/_table_icon_buttons.md +1 -0
  95. data/app/pb_kits/playbook/pb_table/docs/_table_one_action.html.erb +34 -0
  96. data/app/pb_kits/playbook/pb_table/docs/_table_one_action.jsx +68 -0
  97. data/app/pb_kits/playbook/pb_table/docs/_table_one_action.md +2 -0
  98. data/app/pb_kits/playbook/pb_table/docs/_table_two_actions.html.erb +43 -0
  99. data/app/pb_kits/playbook/pb_table/docs/_table_two_actions.jsx +80 -0
  100. data/app/pb_kits/playbook/pb_table/docs/_table_two_actions.md +1 -0
  101. data/app/pb_kits/playbook/pb_table/docs/_table_two_plus_actions.html.erb +34 -0
  102. data/app/pb_kits/playbook/pb_table/docs/_table_two_plus_actions.jsx +63 -0
  103. data/app/pb_kits/playbook/pb_table/docs/_table_two_plus_actions.md +1 -0
  104. data/app/pb_kits/playbook/pb_table/docs/example.yml +12 -0
  105. data/app/pb_kits/playbook/pb_table/docs/index.js +6 -0
  106. data/app/pb_kits/playbook/pb_time/_time.html.erb +17 -20
  107. data/app/pb_kits/playbook/pb_time/_time.jsx +40 -27
  108. data/app/pb_kits/playbook/pb_time/_time.scss +4 -24
  109. data/app/pb_kits/playbook/pb_time/docs/_time_align.jsx +4 -1
  110. data/app/pb_kits/playbook/pb_time/docs/_time_default.html.erb +11 -11
  111. data/app/pb_kits/playbook/pb_time/docs/_time_default.jsx +13 -1
  112. data/app/pb_kits/playbook/pb_time/docs/_time_sizes.jsx +4 -1
  113. data/app/pb_kits/playbook/pb_time/docs/_time_timestamp.jsx +3 -1
  114. data/app/pb_kits/playbook/pb_time/docs/_time_timezone.jsx +7 -2
  115. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.scss +5 -5
  116. data/app/pb_kits/playbook/pb_title_detail/_title_detail.jsx +4 -4
  117. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_options.html.erb +10 -0
  118. data/app/pb_kits/playbook/pb_toggle/docs/example.yml +1 -0
  119. data/app/pb_kits/playbook/pb_toggle/toggle.rb +5 -2
  120. data/app/pb_kits/playbook/pb_typeahead/_typeahead.html.erb +24 -20
  121. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +19 -1
  122. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx +8 -1
  123. data/app/pb_kits/playbook/pb_typeahead/components/Option.jsx +21 -13
  124. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default.html.erb +1 -1
  125. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_context_dark.html.erb +1 -1
  126. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.html.erb +25 -0
  127. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.jsx +0 -3
  128. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.md +8 -0
  129. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.html.erb +30 -0
  130. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.md +11 -0
  131. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb +25 -0
  132. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +0 -3
  133. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.md +1 -0
  134. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +3 -0
  135. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +24 -1
  136. data/app/pb_kits/playbook/react_rails_kits.js +6 -0
  137. data/app/pb_kits/playbook/tokens/_colors.scss +22 -23
  138. data/app/pb_kits/playbook/tokens/_typography.scss +4 -4
  139. data/app/pb_kits/playbook/tokens/index.scss +11 -0
  140. data/app/pb_kits/playbook/vendor.js +8 -0
  141. data/lib/generators/kit/kit_generator.rb +1 -1
  142. data/lib/playbook/engine.rb +1 -0
  143. data/lib/playbook/version.rb +1 -1
  144. data/lib/tasks/changelog.rake +14 -0
  145. data/lib/tasks/pb_release.rake +14 -3
  146. metadata +35 -81
  147. data/app/controllers/playbook/guides_controller.rb +0 -11
  148. data/app/controllers/playbook/pages_controller.rb +0 -99
  149. data/app/controllers/playbook/samples_controller.rb +0 -40
  150. data/app/pb_kits/playbook/packs/application.js +0 -55
  151. data/app/pb_kits/playbook/packs/examples.js +0 -182
  152. data/app/pb_kits/playbook/packs/main.scss +0 -12
  153. data/app/pb_kits/playbook/packs/samples.js +0 -21
  154. data/app/pb_kits/playbook/packs/site_styles/_samples.scss +0 -72
  155. data/app/pb_kits/playbook/packs/site_styles/_scaffold.scss +0 -43
  156. data/app/pb_kits/playbook/packs/site_styles/_site-style.scss +0 -146
  157. data/app/pb_kits/playbook/packs/site_styles/docs/_all.scss +0 -10
  158. data/app/pb_kits/playbook/packs/site_styles/docs/_bg_light_doc_example.scss +0 -7
  159. data/app/pb_kits/playbook/packs/site_styles/docs/_code_snippet.scss +0 -531
  160. data/app/pb_kits/playbook/packs/site_styles/docs/_color_utilities.scss +0 -92
  161. data/app/pb_kits/playbook/packs/site_styles/docs/_flex_examples.scss +0 -15
  162. data/app/pb_kits/playbook/packs/site_styles/docs/_kit_doc.scss +0 -148
  163. data/app/pb_kits/playbook/packs/site_styles/docs/_kits_examples.scss +0 -15
  164. data/app/pb_kits/playbook/packs/site_styles/docs/_markdown.scss +0 -88
  165. data/app/pb_kits/playbook/packs/site_styles/docs/_spacing_tokens.scss +0 -72
  166. data/app/pb_kits/playbook/pb_background/_background.html.erb +0 -14
  167. data/app/pb_kits/playbook/pb_background/_background.jsx +0 -64
  168. data/app/pb_kits/playbook/pb_background/_background.scss +0 -15
  169. data/app/pb_kits/playbook/pb_background/background.rb +0 -36
  170. data/app/pb_kits/playbook/pb_background/docs/_background_default.html.erb +0 -41
  171. data/app/pb_kits/playbook/pb_background/docs/_background_default.jsx +0 -75
  172. data/app/pb_kits/playbook/pb_background/docs/example.yml +0 -8
  173. data/app/pb_kits/playbook/pb_background/docs/index.js +0 -1
  174. data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_vertical.html.erb +0 -11
  175. data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_vertical.jsx +0 -29
  176. data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_vertical_secondary.html.erb +0 -11
  177. data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_vertical_secondary.jsx +0 -34
  178. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_allow_input.html.erb +0 -4
  179. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_allow_input.jsx +0 -13
  180. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_allow_input.md +0 -1
  181. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_dark.html.erb +0 -4
  182. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_dark.jsx +0 -13
  183. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_summary.jsx +0 -45
  184. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_summary.jsx +0 -27
  185. data/app/views/layouts/playbook/_mobile_hamburger.html.erb +0 -2
  186. data/app/views/layouts/playbook/_nav.html.erb +0 -37
  187. data/app/views/layouts/playbook/_sidebar.html.erb +0 -51
  188. data/app/views/layouts/playbook/application.html.erb +0 -26
  189. data/app/views/layouts/playbook/fullscreen.html.slim +0 -10
  190. data/app/views/layouts/playbook/grid.html.slim +0 -10
  191. data/app/views/layouts/playbook/samples.html.erb +0 -19
  192. data/app/views/playbook/guides/create_kit.html.slim +0 -16
  193. data/app/views/playbook/guides/create_kit/_file_naming.html.md +0 -2
  194. data/app/views/playbook/guides/create_kit/_generator.html.md +0 -6
  195. data/app/views/playbook/guides/create_kit/_kit_examples.html.md +0 -2
  196. data/app/views/playbook/guides/create_kit/_kit_rails.html.md +0 -2
  197. data/app/views/playbook/guides/create_kit/_kit_react.html.md +0 -2
  198. data/app/views/playbook/guides/create_kit/_layout.html.md +0 -2
  199. data/app/views/playbook/guides/create_kit/_view_objects.html.md +0 -2
  200. data/app/views/playbook/guides/create_kit/_writing_sass.md +0 -10
  201. data/app/views/playbook/guides/use_nitro.html.slim +0 -6
  202. data/app/views/playbook/guides/use_nitro/_local.html.md +0 -2
  203. data/app/views/playbook/guides/use_nitro/_nitro_components.html.md +0 -2
  204. data/app/views/playbook/guides/use_nitro/_versions.html.md +0 -2
  205. data/app/views/playbook/pages/fullscreen.html.slim +0 -10
  206. data/app/views/playbook/pages/grid.html.slim +0 -2
  207. data/app/views/playbook/pages/home.html.slim +0 -4
  208. data/app/views/playbook/pages/kit_category_show.html.erb +0 -14
  209. data/app/views/playbook/pages/kit_show.html.erb +0 -33
  210. data/app/views/playbook/pages/kits.html.erb +0 -12
  211. data/app/views/playbook/pages/principals/_getting_started.html.md +0 -30
  212. data/app/views/playbook/pages/principles.html.slim +0 -3
  213. data/app/views/playbook/pages/tokens.html.slim +0 -15
  214. data/app/views/playbook/pages/tokens/_pb_doc_spacing.html.slim +0 -61
  215. data/app/views/playbook/pages/utilities.html.slim +0 -116
  216. data/app/views/playbook/pages/utilities/_pb_doc_color.html.slim +0 -15
  217. data/app/views/playbook/samples/collection_detail/index.html.erb +0 -169
  218. data/app/views/playbook/samples/collection_detail/index.jsx +0 -372
  219. data/app/views/playbook/samples/dashboards/index.html.erb +0 -81
  220. data/app/views/playbook/samples/dashboards/index.jsx +0 -130
  221. data/app/views/playbook/samples/filter_table/index.html.erb +0 -348
  222. data/app/views/playbook/samples/filter_table/index.jsx +0 -433
  223. data/app/views/playbook/samples/registration/index.html.erb +0 -316
  224. data/app/views/playbook/samples/registration/index.jsx +0 -476
  225. data/app/views/playbook/samples/sample_show.html.erb +0 -36
@@ -4,18 +4,22 @@ import { DatePicker } from '../../'
4
4
  const DatePickerFormat = () => (
5
5
  <div>
6
6
  <DatePicker
7
+ defaultDate={new Date()}
7
8
  format="m-d-Y"
8
9
  pickerId="date-picker-format1"
9
10
  />
10
11
  <DatePicker
12
+ defaultDate={new Date()}
11
13
  format="m/d/y"
12
14
  pickerId="date-picker-format2"
13
15
  />
14
16
  <DatePicker
17
+ defaultDate={new Date()}
15
18
  format="n-j-y"
16
19
  pickerId="date-picker-format3"
17
20
  />
18
21
  <DatePicker
22
+ defaultDate={new Date()}
19
23
  format="Y-d-m"
20
24
  pickerId="date-picker-format4"
21
25
  />
@@ -1,26 +1,26 @@
1
1
  <%= pb_rails("date_picker", props: {
2
2
  input_aria: { label: "input-field" },
3
3
  input_data: { key: "value", key2: "value2" },
4
+ label: "Aria, Name, and Data Attributes",
4
5
  name: "date-field",
5
6
  picker_id: "date-picker-input1",
6
- type: "date"
7
7
  }) %>
8
8
 
9
9
  <%= pb_rails("date_picker", props: {
10
- default_date: "blank",
10
+ label: "Custom Placeholder",
11
11
  picker_id: "date-picker-input2",
12
- placeholder: "Select Date",
12
+ placeholder: "custom-placeholder",
13
13
  }) %>
14
14
 
15
15
  <%= pb_rails("date_picker", props: {
16
- default_date: "blank",
17
- disable_input: true,
16
+ label: "Blank Placeholder",
18
17
  picker_id: "date-picker-input3",
19
- placeholder: "Disabled Input"
18
+ placeholder: ""
20
19
  }) %>
21
20
 
22
21
  <%= pb_rails("date_picker", props: {
23
- dark: true,
24
- hide_label: true,
25
- picker_id: "date-picker-input4"
22
+ disable_input: true,
23
+ label: "Disable Input",
24
+ picker_id: "date-picker-input4",
25
+ placeholder: "Disabled Input"
26
26
  }) %>
@@ -6,25 +6,25 @@ const DatePickerInput = () => (
6
6
  <DatePicker
7
7
  inputAria={{ label: 'input-field' }}
8
8
  inputData={{ key: 'value', key2: 'value2' }}
9
+ label="Aria, Name, and Data Attributes"
9
10
  name="date-field"
10
11
  pickerId="date-picker-input1"
11
- type="date"
12
12
  />
13
13
  <DatePicker
14
- defaultDate="blank"
14
+ label="Custom Placeholder"
15
15
  pickerId="date-picker-input2"
16
- placeholder="Select Date"
16
+ placeholder="custom-placeholder"
17
17
  />
18
18
  <DatePicker
19
- defaultDate="blank"
20
- disableInput
19
+ label="Blank Placeholder"
21
20
  pickerId="date-picker-input3"
22
- placeholder="Disabled Input"
21
+ placeholder=""
23
22
  />
24
23
  <DatePicker
25
- dark
26
- hideLabel
24
+ disableInput
25
+ label="Disable Input"
27
26
  pickerId="date-picker-input4"
27
+ placeholder="Disabled Input"
28
28
  />
29
29
  </div>
30
30
  )
@@ -1,3 +1,5 @@
1
1
  The date picker is built with the text input kit. Text input props you pass to the date picker kit will be forwarded to the input, with a few exceptions. The `value` attribute is automatically handled and bound to whatever date string is contained by the input field. You cannot pass a custom value prop. `id` props passed to the date picker kit will be assigned to it's parent/wrapper div. The `pickerId` prop is passed directly to the input and is required to instatiate the date picker.
2
2
 
3
- You must use `inputAria` or `input_aria` and `inputData` or `input_data` props if you wish to pass data or aria attributes to the text input kit. If you use `data` or `aria` props they will be passed to the date picker kit itself instead. Also be aware the default behavior of text input aria and data props is to pass those props to attributes on the wrapping div not on the input itself.
3
+ You must use `inputAria` or `input_aria` and `inputData` or `input_data` props if you wish to pass data or aria attributes to the text input kit. If you use `data` or `aria` props they will be passed to the date picker kit itself instead. Also be aware the default behavior of text input aria and data props is to pass those props to attributes on the wrapping div not on the input itself.
4
+
5
+ The placeholder prop has a default string value: "Select Date". You can replace this with your own string or an empty string if you'd prefer it blank.
@@ -1,4 +1,5 @@
1
1
  <%= pb_rails("date_picker", props: {
2
+ default_date: [(Date.today).httpdate, (Date.today + 7).httpdate],
2
3
  mode: "range",
3
4
  picker_id: "date-picker-range"
4
5
  }) %>
@@ -4,6 +4,7 @@ import { DatePicker } from '../../'
4
4
  const DatePickerRange = () => (
5
5
  <div>
6
6
  <DatePicker
7
+ defaultDate={[new Date(), new Date().fp_incr(6)]}
7
8
  mode="range"
8
9
  pickerId="date-picker-range"
9
10
  />
@@ -12,9 +12,7 @@ examples:
12
12
  - date_picker_min_max: Min Max
13
13
  - date_picker_error: Error
14
14
  - date_picker_hooks: Hooks
15
- # - date_picker_allow_input: Allow Input
16
15
  - date_picker_year_range: Year Range
17
- - date_picker_dark: Dark
18
16
 
19
17
 
20
18
  react:
@@ -30,7 +28,5 @@ examples:
30
28
  - date_picker_min_max: Min Max
31
29
  - date_picker_error: Error
32
30
  - date_picker_hooks: Hooks
33
- # - date_picker_allow_input: Allow Input
34
31
  - date_picker_year_range: Year Range
35
- - date_picker_dark: Dark
36
32
 
@@ -10,6 +10,4 @@ export { default as DatePickerDisabled } from './_date_picker_disabled.jsx'
10
10
  export { default as DatePickerMinMax } from './_date_picker_min_max.jsx'
11
11
  export { default as DatePickerError } from './_date_picker_error.jsx'
12
12
  export { default as DatePickerHooks } from './_date_picker_hooks.jsx'
13
- // export { default as DatePickerAllowInput } from './_date_picker_allow_input.jsx'
14
13
  export { default as DatePickerYearRange } from './_date_picker_year_range.jsx'
15
- export { default as DatePickerDark } from './_date_picker_dark.jsx'
@@ -2,21 +2,15 @@
2
2
  id: object.id,
3
3
  data: object.data,
4
4
  class: object.classname) do %>
5
+ <div class="pb_date_range_inline_wrapper">
6
+ <% if object.icon == true %>
7
+ <%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, color: object.icon_color, text: pb_rails("icon", props: { icon: "calendar-alt", fixed_width: true, size: object.size, classname: "pb_date_range_inline_icon" }) }) %>
8
+ <% end %>
5
9
 
6
- <%= pb_rails("body", props: { tag: "span", color: "light" }) do %>
7
- <%= pb_rails("icon", props: { icon: "calendar-alt", fixed_width: true }) %>
8
- <% end %>
10
+ <%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, text: object.start_date_display }) %>
9
11
 
10
- <%= pb_rails("body", props: { tag: "span"}) do %>
11
- <%= object.start_date_display %>
12
- <% end %>
13
-
14
- <%= pb_rails("body", props: { tag: "span", color: "light" }) do %>
15
- <%= pb_rails("icon", props: { icon: "long-arrow-right", fixed_width: true }) %>
16
- <% end %>
17
-
18
- <%= pb_rails("body", props: { tag: "span"}) do %>
19
- <%= object.end_date_display %>
20
- <% end %>
12
+ <%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, color: object.icon_color, text: pb_rails("icon", props: { icon: "long-arrow-right", fixed_width: true, size: object.size, classname: "pb_date_range_inline_arrow"}) }) %>
21
13
 
14
+ <%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, text: object.end_date_display }) %>
15
+ </div>
22
16
  <% end %>
@@ -2,21 +2,30 @@
2
2
 
3
3
  import React from 'react'
4
4
  import DateTime from '../pb_kit/dateTime.js'
5
- import { Body, Icon } from '../'
5
+ import { Body, Caption, Icon } from '../'
6
6
  import classnames from 'classnames'
7
7
  import { globalProps } from '../utilities/globalProps.js'
8
+ import { buildCss } from '../utilities/props'
8
9
 
9
10
  type DateRangeInlineProps = {
10
11
  className?: string,
11
- data?: string,
12
- endDate?: date,
13
12
  id?: string,
13
+ data?: string,
14
+ align?: "left" | "center" | "vertical",
15
+ size?: "sm" | "xs",
16
+ dark?: boolean,
17
+ icon?: boolean,
14
18
  startDate?: date,
19
+ endDate?: date
15
20
  }
16
21
 
17
- const dateTimestamp = (dateValue) => {
22
+ const dateTimestamp = (dateValue, includeYear) => {
18
23
  const date = new DateTime({ value: dateValue })
19
- return `${date.toDay()} ${date.toMonth()} ${date.toYear()}`
24
+ if (includeYear) {
25
+ return `${date.toMonth()} ${date.toDay()}, ${date.toYear()}`
26
+ } else {
27
+ return `${date.toMonth()} ${date.toDay()}`
28
+ }
20
29
  }
21
30
 
22
31
  const dateTimeIso = (dateValue) => {
@@ -25,41 +34,115 @@ const dateTimeIso = (dateValue) => {
25
34
  }
26
35
 
27
36
  const DateRangeInline = (props: DateRangeInlineProps) => {
28
- const { endDate, startDate } = props
37
+ const {
38
+ icon = false,
39
+ dark = false,
40
+ size = 'sm',
41
+ align = 'left',
42
+ startDate,
43
+ endDate,
44
+ className,
45
+ } = props
46
+
47
+ const iconContent = () => {
48
+ return (
49
+ <If condition={icon}>
50
+ <Body
51
+ color="light"
52
+ tag="span"
53
+ >
54
+ <Icon
55
+ className="pb_date_range_inline_icon"
56
+ dark={dark}
57
+ fixedWidth
58
+ icon="calendar-alt"
59
+ size={size}
60
+ tag="span"
61
+ />
62
+ </Body>
63
+ </If>
64
+ )
65
+ }
66
+
67
+ const dateInCurrentYear = () => {
68
+ const currentDate = new Date()
69
+ return startDate.getFullYear() == endDate.getFullYear() && startDate.getFullYear() == currentDate.getFullYear()
70
+ }
71
+
72
+ const dateRangeClasses = buildCss('pb_date_range_inline_kit', align)
73
+
74
+ const renderTime = (date) => {
75
+ return (
76
+ <time dateTime={dateTimeIso(date)}>
77
+ <Choose>
78
+ <When condition={dateInCurrentYear()}>
79
+ {` ${dateTimestamp(date, false)} `}
80
+ </When>
81
+ <Otherwise>
82
+ {` ${dateTimestamp(date, true)} `}
83
+ </Otherwise>
84
+ </Choose>
85
+ </time>
86
+ )
87
+ }
88
+
29
89
  return (
30
- <div className={classnames('pb_date_range_inline', globalProps(props))}>
31
- <Body
32
- color="light"
33
- tag="span"
34
- >
35
- <Icon
36
- fixedWidth
37
- icon="calendar-alt"
38
- />
39
- </Body>
40
- <Body tag="span">
41
- <time dateTime={dateTimeIso(startDate)}>
42
- {` ${dateTimestamp(
43
- startDate
44
- )} `}
45
- </time>
46
- </Body>
47
- <Body
48
- color="light"
49
- tag="span"
50
- >
51
- <Icon
52
- fixedWidth
53
- icon="long-arrow-right"
54
- />
55
- </Body>
56
- <Body tag="span">
57
- <time dateTime={dateTimeIso(endDate)}>
58
- {` ${dateTimestamp(
59
- endDate
60
- )} `}
61
- </time>
62
- </Body>
90
+ <div className={classnames(dateRangeClasses, globalProps(props), className)}>
91
+ <div className="pb_date_range_inline_wrapper">
92
+ <If condition={size == 'xs'}>
93
+ {iconContent()}
94
+ <Caption
95
+ dark={dark}
96
+ tag="span"
97
+ >
98
+ {renderTime(startDate)}
99
+ </Caption>
100
+ <Caption
101
+ dark={dark}
102
+ tag="span"
103
+ >
104
+ <Icon
105
+ className="pb_date_range_inline_arrow"
106
+ fixedWidth
107
+ icon="long-arrow-right"
108
+ />
109
+ </Caption>
110
+ <Caption
111
+ dark={dark}
112
+ tag="span"
113
+ >
114
+ {renderTime(endDate)}
115
+ </Caption>
116
+ </If>
117
+
118
+ <If condition={size == 'sm'}>
119
+ {iconContent()}
120
+ <Body
121
+ dark={dark}
122
+ tag="span"
123
+ >
124
+ {renderTime(startDate)}
125
+ </Body>
126
+ <Body
127
+ color="light"
128
+ dark={dark}
129
+ tag="span"
130
+ >
131
+ <Icon
132
+ className="pb_date_range_inline_arrow"
133
+ dark={dark}
134
+ fixedWidth
135
+ icon="long-arrow-right"
136
+ />
137
+ </Body>
138
+ <Body
139
+ dark={dark}
140
+ tag="span"
141
+ >
142
+ {renderTime(endDate)}
143
+ </Body>
144
+ </If>
145
+ </div>
63
146
  </div>
64
147
  )
65
148
  }
@@ -1,3 +1,34 @@
1
- .pb_date_range_inline {
2
-
1
+ [class^=pb_date_range_inline_kit] {
2
+ &[class*=_center] {
3
+ & > [class^=pb_caption],
4
+ & > [class^=pb_body] {
5
+ text-align: center;
6
+ }
7
+ & > [class*=pb_date_range_inline_wrapper] {
8
+ justify-content: center;
9
+ }
10
+ }
11
+ &[class*=_right] {
12
+ & > [class^=pb_caption],
13
+ & > [class^=pb_body] {
14
+ text-align: right;
15
+ }
16
+ & > [class*=pb_date_range_inline_wrapper] {
17
+ justify-content: flex-end;
18
+ }
19
+ }
20
+ [class^=pb_date_range_inline_wrapper] {
21
+ display: flex;
22
+ align-items: center;
23
+ [class*=pb_date_range_inline_arrow] {
24
+ margin-left: $space_xs/2;
25
+ margin-right: $space_xs/2;
26
+ }
27
+ [class*=pb_date_range_inline_timezone] {
28
+ margin-left: $space_xs/2;
29
+ }
30
+ [class*=pb_date_range_inline_icon] {
31
+ margin-right: $space_xs/2;
32
+ }
33
+ }
3
34
  }
@@ -11,24 +11,59 @@ module Playbook
11
11
 
12
12
  prop :end_date, type: Playbook::Props::Date, required: true
13
13
  prop :start_date, type: Playbook::Props::Date, required: true
14
+ prop :icon, required: false
15
+ prop :dark, type: Playbook::Props::Boolean,
16
+ default: false
17
+ prop :size, type: Playbook::Props::Enum,
18
+ values: %w[xs sm],
19
+ default: "sm"
20
+ prop :align, type: Playbook::Props::Enum,
21
+ values: %w[left center right],
22
+ default: "left"
14
23
 
15
24
  def classname
16
- generate_classname("pb_date_range_inline_kit")
25
+ generate_classname("pb_date_range_inline_kit", dark_class, align)
17
26
  end
18
27
 
19
- def end_date_display
20
- date_time = Playbook::PbKit::PbDateTime.new(end_date)
21
- content_tag(:time, datetime: date_time.to_iso) do
22
- "#{date_time.to_day} #{date_time.to_month_downcase} #{date_time.to_year}"
28
+ def text_kit
29
+ case size
30
+ when "xs"
31
+ "caption"
32
+ when "sm"
33
+ "body"
23
34
  end
24
35
  end
25
36
 
26
- def start_date_display
27
- date_time = Playbook::PbKit::PbDateTime.new(start_date)
28
- content_tag(:time, datetime: date_time.to_iso) do
29
- "#{date_time.to_day} #{date_time.to_month_downcase} #{date_time.to_year}"
37
+ def icon_color
38
+ size == "sm" ? "light" : nil
39
+ end
40
+
41
+ def dates_in_current_year?
42
+ current_year = Time.current.year
43
+ start_date.year == current_year && end_date.year == current_year
44
+ end
45
+
46
+ def time_display(time)
47
+ content_tag(:time, datetime: time.to_iso) do
48
+ if dates_in_current_year?
49
+ "#{time.to_month_downcase} #{time.to_day}"
50
+ else
51
+ "#{time.to_month_downcase} #{time.to_day}, #{time.to_year}"
52
+ end
30
53
  end
31
54
  end
55
+
56
+ def end_date_display
57
+ time_display(Playbook::PbKit::PbDateTime.new(end_date))
58
+ end
59
+
60
+ def start_date_display
61
+ time_display(Playbook::PbKit::PbDateTime.new(start_date))
62
+ end
63
+
64
+ def dark_class
65
+ dark ? "dark" : nil
66
+ end
32
67
  end
33
68
  end
34
69
  end