playbook_ui 15.0.0 → 15.1.0.pre.alpha.PLAY2425textinputaccessibility10907

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +3 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +24 -11
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +7 -7
  5. data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +7 -2
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +67 -13
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +2 -2
  8. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +0 -1
  9. data/app/pb_kits/playbook/pb_card/_card.scss +12 -4
  10. data/app/pb_kits/playbook/pb_card/_card.tsx +3 -3
  11. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +10 -0
  12. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.html.erb +3 -0
  13. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.jsx +8 -0
  14. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +2 -0
  15. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +1 -0
  16. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +1 -0
  17. data/app/pb_kits/playbook/pb_contact/_contact.tsx +5 -0
  18. data/app/pb_kits/playbook/pb_contact/contact.rb +4 -0
  19. data/app/pb_kits/playbook/pb_contact/contact.test.js +21 -1
  20. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.html.erb +16 -1
  21. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.jsx +15 -0
  22. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.md +5 -0
  23. data/app/pb_kits/playbook/pb_contact/docs/_contact_with_detail.html.erb +6 -0
  24. data/app/pb_kits/playbook/pb_contact/docs/_contact_with_detail.jsx +6 -0
  25. data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +4 -0
  26. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +6 -4
  27. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +48 -4
  28. data/app/pb_kits/playbook/pb_dialog/_close_icon.tsx +5 -1
  29. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +6 -8
  30. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -1
  31. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +2 -2
  32. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +9 -0
  33. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +3 -3
  34. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
  35. data/app/pb_kits/playbook/pb_icon/_icon.tsx +13 -2
  36. data/app/pb_kits/playbook/pb_icon/icon.rb +9 -1
  37. data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +1 -0
  38. data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +2 -1
  39. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.html.erb +1 -1
  40. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +3 -1
  41. data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.html.erb +5 -0
  42. data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.jsx +24 -0
  43. data/app/pb_kits/playbook/pb_loading_inline/docs/example.yml +2 -0
  44. data/app/pb_kits/playbook/pb_loading_inline/docs/index.js +1 -0
  45. data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +1 -1
  46. data/app/pb_kits/playbook/pb_loading_inline/loading_inline.rb +11 -0
  47. data/app/pb_kits/playbook/pb_nav/_item.tsx +19 -5
  48. data/app/pb_kits/playbook/pb_nav/_nav.scss +27 -0
  49. data/app/pb_kits/playbook/pb_nav/_nav.test.js +16 -0
  50. data/app/pb_kits/playbook/pb_nav/_nav.tsx +5 -0
  51. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_extendedunderline.html.erb +6 -0
  52. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_extendedunderline.jsx +39 -0
  53. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_extendedunderline.md +1 -0
  54. data/app/pb_kits/playbook/pb_nav/docs/example.yml +2 -0
  55. data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
  56. data/app/pb_kits/playbook/pb_nav/item.html.erb +6 -2
  57. data/app/pb_kits/playbook/pb_nav/nav.rb +6 -1
  58. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_breached.html.erb +3 -3
  59. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_common.html.erb +3 -3
  60. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb +3 -3
  61. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.html.erb +3 -3
  62. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_strength_change.html.erb +3 -3
  63. data/app/pb_kits/playbook/pb_pb_bar_graph/_pb_bar_graph.scss +0 -0
  64. data/app/pb_kits/playbook/pb_pb_bar_graph/_pb_bar_graph.tsx +62 -0
  65. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors.html.erb +35 -0
  66. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors.jsx +49 -0
  67. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors_rails.md +1 -0
  68. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors_react.md +2 -0
  69. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.html.erb +38 -0
  70. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.jsx +51 -0
  71. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.html.erb +46 -0
  72. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.jsx +62 -0
  73. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.md +3 -0
  74. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_horizontal.html.erb +47 -0
  75. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_horizontal.jsx +60 -0
  76. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend.html.erb +25 -0
  77. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend.jsx +36 -0
  78. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_non_clickable.jsx +44 -0
  79. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.html.erb +100 -0
  80. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.jsx +126 -0
  81. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_negative_numbers.html.erb +32 -0
  82. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_negative_numbers.jsx +48 -0
  83. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_secondary_y_axis.html.erb +68 -0
  84. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_secondary_y_axis.jsx +81 -0
  85. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.html.erb +31 -0
  86. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.jsx +42 -0
  87. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.md +2 -0
  88. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.html.erb +35 -0
  89. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.jsx +51 -0
  90. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/example.yml +27 -0
  91. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/index.js +11 -0
  92. data/app/pb_kits/playbook/pb_pb_bar_graph/pbBarGraphTheme.ts +106 -0
  93. data/app/pb_kits/playbook/pb_pb_bar_graph/pb_bar_graph.html.erb +1 -0
  94. data/app/pb_kits/playbook/pb_pb_bar_graph/pb_bar_graph.rb +28 -0
  95. data/app/pb_kits/playbook/pb_pb_bar_graph/pbbargraph.test.jsx +31 -0
  96. data/app/pb_kits/playbook/pb_pb_circle_chart/_pb_circle_chart.scss +3 -0
  97. data/app/pb_kits/playbook/pb_pb_circle_chart/_pb_circle_chart.tsx +62 -0
  98. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.html.erb +31 -0
  99. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.jsx +81 -0
  100. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.html.erb +25 -0
  101. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.jsx +40 -0
  102. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.md +5 -0
  103. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.html.erb +27 -0
  104. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.jsx +39 -0
  105. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.md +5 -0
  106. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.html.erb +93 -0
  107. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.jsx +131 -0
  108. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.md +14 -0
  109. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_labels.html.erb +42 -0
  110. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_labels.jsx +58 -0
  111. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_legend.html.erb +24 -0
  112. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_legend.jsx +38 -0
  113. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.html.erb +22 -0
  114. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +33 -0
  115. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_inner_sizes.html.erb +118 -0
  116. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_inner_sizes.jsx +144 -0
  117. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_live_data.jsx +60 -0
  118. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_rounded.html.erb +24 -0
  119. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_rounded.jsx +42 -0
  120. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_with_title.html.erb +38 -0
  121. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_with_title.jsx +52 -0
  122. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/example.yml +29 -0
  123. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/index.js +11 -0
  124. data/app/pb_kits/playbook/pb_pb_circle_chart/pbCircleChartTheme.ts +88 -0
  125. data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.html.erb +1 -0
  126. data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.rb +28 -0
  127. data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.test.jsx +51 -0
  128. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +2 -2
  129. data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +13 -5
  130. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_children.html.erb +23 -0
  131. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_children.jsx +45 -7
  132. data/app/pb_kits/playbook/pb_section_separator/section_separator.html.erb +4 -1
  133. data/app/pb_kits/playbook/pb_section_separator/section_separator.test.js +165 -0
  134. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +17 -6
  135. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_autocomplete.html.erb +41 -0
  136. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_autocomplete.jsx +80 -0
  137. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_autocomplete.md +1 -0
  138. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.html.erb +8 -4
  139. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +5 -0
  140. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.md +1 -0
  141. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +3 -0
  142. data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
  143. data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +3 -1
  144. data/app/pb_kits/playbook/pb_text_input/text_input.rb +8 -3
  145. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +38 -0
  146. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +24 -8
  147. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align.html.erb +0 -10
  148. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align.jsx +0 -9
  149. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align.md +1 -0
  150. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.html.erb +3 -17
  151. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.jsx +0 -15
  152. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.md +1 -0
  153. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.html.erb +0 -2
  154. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.jsx +0 -2
  155. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.md +5 -0
  156. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_current_year.html.erb +12 -0
  157. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_current_year.jsx +25 -0
  158. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_current_year.md +1 -0
  159. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_date.html.erb +4 -0
  160. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_date.jsx +17 -0
  161. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_date.md +1 -0
  162. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_time.html.erb +18 -0
  163. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_time.jsx +44 -0
  164. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_time.md +1 -0
  165. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.html.erb +0 -14
  166. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.jsx +0 -14
  167. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.md +1 -0
  168. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.html.erb +0 -4
  169. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.jsx +0 -4
  170. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated.jsx +0 -1
  171. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated.md +5 -0
  172. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_current_year.html.erb +16 -0
  173. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_current_year.jsx +30 -0
  174. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_current_year.md +1 -0
  175. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_date.html.erb +16 -0
  176. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_date.jsx +30 -0
  177. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_date.md +1 -0
  178. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_time.html.erb +26 -0
  179. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_time.jsx +41 -0
  180. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_time.md +1 -0
  181. data/app/pb_kits/playbook/pb_timestamp/docs/example.yml +18 -6
  182. data/app/pb_kits/playbook/pb_timestamp/docs/index.js +6 -0
  183. data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +29 -7
  184. data/app/pb_kits/playbook/pb_timestamp/timestamp.test.js +69 -4
  185. data/dist/chunks/{_line_graph-CIyKqNGy.js → _line_graph-BnK1i7QI.js} +1 -1
  186. data/dist/chunks/_typeahead-pbS3fEzb.js +6 -0
  187. data/dist/chunks/_weekday_stacked-x-syST1P.js +37 -0
  188. data/dist/chunks/componentRegistry-DzmmLR2x.js +1 -0
  189. data/dist/chunks/{lib-DgtxnJqa.js → lib-QZuu1ltS.js} +2 -2
  190. data/dist/chunks/{pb_form_validation-_NsOWfBS.js → pb_form_validation-CleM960_.js} +1 -1
  191. data/dist/chunks/vendor.js +1 -1
  192. data/dist/menu.yml +15 -1
  193. data/dist/playbook-doc.js +2 -2
  194. data/dist/playbook-rails-react-bindings.js +1 -1
  195. data/dist/playbook-rails.js +1 -1
  196. data/dist/playbook.css +1 -1
  197. data/lib/playbook/engine.rb +0 -1
  198. data/lib/playbook/forms/builder/form_field_builder.rb +37 -2
  199. data/lib/playbook/kit_base.rb +23 -2
  200. data/lib/playbook/version.rb +2 -2
  201. metadata +112 -28
  202. data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +0 -65
  203. data/app/pb_kits/playbook/pb_timestamp/docs/_time_stamp_default.md +0 -1
  204. data/dist/chunks/_typeahead-B-mDRLxH.js +0 -6
  205. data/dist/chunks/_weekday_stacked-B_lp1Spt.js +0 -37
@@ -0,0 +1,165 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+
4
+ import SectionSeparator from './_section_separator'
5
+
6
+ const testId = "section-separator-kit"
7
+
8
+ describe("Section Separator Kit", () => {
9
+ test("renders basic section separator with default props", () => {
10
+ render(
11
+ <SectionSeparator
12
+ data={{ testid: testId }}
13
+ />
14
+ )
15
+
16
+ const kit = screen.getByTestId(testId)
17
+ expect(kit).toHaveClass("pb_section_separator_kit pb_section_separator_card pb_section_separator_horizontal pb_section_separator_solid pb_section_separator_color_default")
18
+ })
19
+
20
+ test("renders with text prop", () => {
21
+ const text = "Section Title"
22
+ render(
23
+ <SectionSeparator
24
+ data={{ testid: testId }}
25
+ text={text}
26
+ />
27
+ )
28
+
29
+ const kit = screen.getByTestId(testId)
30
+ const textElement = screen.getByText(text)
31
+
32
+ expect(kit).toHaveClass("pb_section_separator_kit")
33
+ expect(textElement).toBeInTheDocument()
34
+ })
35
+
36
+ test("renders with children", () => {
37
+ const childText = "Custom Content"
38
+ render(
39
+ <SectionSeparator
40
+ data={{ testid: testId }}
41
+ >
42
+ <span>{childText}</span>
43
+ </SectionSeparator>
44
+ )
45
+
46
+ const kit = screen.getByTestId(testId)
47
+ const childElement = screen.getByText(childText)
48
+
49
+ expect(kit).toHaveClass("pb_section_separator_kit")
50
+ expect(childElement).toBeInTheDocument()
51
+ })
52
+
53
+ test("renders vertical orientation", () => {
54
+ render(
55
+ <SectionSeparator
56
+ data={{ testid: testId }}
57
+ orientation="vertical"
58
+ />
59
+ )
60
+
61
+ const kit = screen.getByTestId(testId)
62
+ expect(kit).toHaveClass("pb_section_separator_kit pb_section_separator_card pb_section_separator_vertical pb_section_separator_solid pb_section_separator_color_default")
63
+ })
64
+
65
+ test("renders background variant", () => {
66
+ render(
67
+ <SectionSeparator
68
+ data={{ testid: testId }}
69
+ variant="background"
70
+ />
71
+ )
72
+
73
+ const kit = screen.getByTestId(testId)
74
+ expect(kit).toHaveClass("pb_section_separator_kit pb_section_separator_background pb_section_separator_horizontal pb_section_separator_solid pb_section_separator_color_default")
75
+ })
76
+
77
+ test("renders dashed line style", () => {
78
+ render(
79
+ <SectionSeparator
80
+ data={{ testid: testId }}
81
+ lineStyle="dashed"
82
+ />
83
+ )
84
+
85
+ const kit = screen.getByTestId(testId)
86
+ expect(kit).toHaveClass("pb_section_separator_kit pb_section_separator_card pb_section_separator_horizontal pb_section_separator_dashed pb_section_separator_color_default")
87
+ })
88
+
89
+ test("renders primary color", () => {
90
+ render(
91
+ <SectionSeparator
92
+ color="primary"
93
+ data={{ testid: testId }}
94
+ />
95
+ )
96
+
97
+ const kit = screen.getByTestId(testId)
98
+ expect(kit).toHaveClass("pb_section_separator_kit pb_section_separator_card pb_section_separator_horizontal pb_section_separator_solid pb_section_separator_color_primary")
99
+ })
100
+
101
+ test("renders dark mode", () => {
102
+ render(
103
+ <SectionSeparator
104
+ dark
105
+ data={{ testid: testId }}
106
+ />
107
+ )
108
+
109
+ const kit = screen.getByTestId(testId)
110
+ expect(kit).toHaveClass("pb_section_separator_kit pb_section_separator_card pb_section_separator_horizontal pb_section_separator_solid pb_section_separator_color_default")
111
+ })
112
+
113
+ test("renders with custom className", () => {
114
+ const customClass = "custom-class"
115
+ render(
116
+ <SectionSeparator
117
+ className={customClass}
118
+ data={{ testid: testId }}
119
+ />
120
+ )
121
+
122
+ const kit = screen.getByTestId(testId)
123
+ expect(kit).toHaveClass("pb_section_separator_kit pb_section_separator_card pb_section_separator_horizontal pb_section_separator_solid pb_section_separator_color_default custom-class")
124
+ })
125
+
126
+ test("renders vertical with children", () => {
127
+ const childText = "Vertical Content"
128
+ render(
129
+ <SectionSeparator
130
+ data={{ testid: testId }}
131
+ orientation="vertical"
132
+ >
133
+ <span>{childText}</span>
134
+ </SectionSeparator>
135
+ )
136
+
137
+ const kit = screen.getByTestId(testId)
138
+ const childElement = screen.getByText(childText)
139
+
140
+ expect(kit).toHaveClass("pb_section_separator_kit pb_section_separator_card pb_section_separator_vertical pb_section_separator_solid pb_section_separator_color_default")
141
+ expect(childElement).toBeInTheDocument()
142
+ })
143
+
144
+ test("renders all props combined", () => {
145
+ const text = "Combined Props"
146
+ render(
147
+ <SectionSeparator
148
+ color="primary"
149
+ dark
150
+ data={{ testid: testId }}
151
+ lineStyle="dashed"
152
+ orientation="vertical"
153
+ variant="background"
154
+ >
155
+ <span>{text}</span>
156
+ </SectionSeparator>
157
+ )
158
+
159
+ const kit = screen.getByTestId(testId)
160
+ const childElement = screen.getByText(text)
161
+
162
+ expect(kit).toHaveClass("pb_section_separator_kit pb_section_separator_background pb_section_separator_vertical pb_section_separator_dashed pb_section_separator_color_primary")
163
+ expect(childElement).toBeInTheDocument()
164
+ })
165
+ })
@@ -36,6 +36,7 @@ type TextInputProps = {
36
36
  alignment?: "right" | "left",
37
37
  border?: boolean,
38
38
  },
39
+ autoComplete?: boolean | string,
39
40
  } & GlobalProps
40
41
 
41
42
  const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>) => {
@@ -59,6 +60,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
59
60
  type = 'text',
60
61
  value = '',
61
62
  children = null,
63
+ autoComplete = true,
62
64
  } = props
63
65
 
64
66
  const ariaProps = buildAriaProps(aria)
@@ -138,10 +140,15 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
138
140
  formattedValue = value
139
141
  }
140
142
 
143
+ const errorId = error ? `${id}-error` : undefined
144
+
141
145
  const textInput = (
142
146
  childInput ? React.cloneElement(children, { className: "text_input" }) :
143
147
  (<input
144
148
  {...domSafeProps(props)}
149
+ aria-describedby={errorId}
150
+ aria-invalid={!!error}
151
+ autoComplete={typeof autoComplete === "string" ? autoComplete : ( autoComplete ? undefined : "off" )}
145
152
  className="text_input"
146
153
  disabled={disabled}
147
154
  id={id}
@@ -199,16 +206,20 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
199
206
  {...htmlProps}
200
207
  className={css}
201
208
  >
202
- {label &&
203
- <Caption
204
- className="pb_text_input_kit_label"
205
- text={label}
206
- />
207
- }
209
+ {label && (
210
+ <label htmlFor={id}>
211
+ <Caption className="pb_text_input_kit_label"
212
+ text={label}
213
+ />
214
+ </label>
215
+ )}
208
216
  <div className={`${addOnCss} text_input_wrapper`}>
209
217
  {render}
210
218
 
211
219
  {error && <Body
220
+ aria={{ atomic: "true", live: "polite" }}
221
+ htmlOptions={{ role: "alert" }}
222
+ id={errorId}
212
223
  status="negative"
213
224
  text={error}
214
225
  variant={null}
@@ -0,0 +1,41 @@
1
+ <%= pb_rails("text_input", props: {
2
+ autocomplete: false,
3
+ label: "autocomplete='off'",
4
+ name: "firstName",
5
+ placeholder: "Enter first name",
6
+ }) %>
7
+
8
+ <%= pb_rails("text_input", props: {
9
+ label: "no autocomplete attribute (let browser decide- basically 'on')",
10
+ name: "lastName",
11
+ placeholder: "Enter last name"
12
+ }) %>
13
+
14
+ <%= pb_rails("text_input", props: {
15
+ autocomplete: true,
16
+ label: "autocomplete='on'",
17
+ name: "phone",
18
+ type: "phone",
19
+ placeholder: "Enter phone number"
20
+ }) %>
21
+
22
+ <%= pb_rails("body", props: { margin_bottom: "sm" }) do %>
23
+ The following have the same autocomplete attributes (email), but have
24
+ different name attributes (email and emailAlt). Many browsers will
25
+ open autocomplete based on name attributes instead of autocomplete:
26
+ <% end %>
27
+
28
+ <%= pb_rails("text_input", props: {
29
+ autocomplete: "email",
30
+ label: "autocomplete='email' name='email'",
31
+ name: "email",
32
+ placeholder: "Enter email address"
33
+ }) %>
34
+
35
+ <%= pb_rails("text_input", props: {
36
+ autocomplete: "email",
37
+ label: "autocomplete='email' name='emailAlt'",
38
+ name: "emailAlt",
39
+ type: "email",
40
+ placeholder: "Enter email address"
41
+ }) %>
@@ -0,0 +1,80 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import TextInput from '../../pb_text_input/_text_input'
4
+ import Body from '../../pb_body/_body'
5
+
6
+
7
+ const TextInputAutocomplete = (props) => {
8
+ const [formFields, setFormFields] = useState({
9
+ firstName: "",
10
+ lastName: "",
11
+ phone: "",
12
+ emailTest: "",
13
+ email: "",
14
+ });
15
+
16
+ const handleOnChangeFormField = ({ target }) => {
17
+ const { name, value } = target;
18
+ setFormFields({ ...formFields, [name]: value });
19
+ };
20
+
21
+ return (
22
+ <div>
23
+ <TextInput
24
+ autoComplete={false}
25
+ label="autocomplete='off'"
26
+ name="firstName"
27
+ onChange={handleOnChangeFormField}
28
+ placeholder="Enter first name"
29
+ value={formFields.firstName}
30
+ {...props}
31
+ />
32
+ <TextInput
33
+ label="no autocomplete attribute (let browser decide- basically 'on')"
34
+ name="lastName"
35
+ onChange={handleOnChangeFormField}
36
+ placeholder="Enter last name"
37
+ value={formFields.lastName}
38
+ {...props}
39
+ />
40
+ <TextInput
41
+ autoComplete
42
+ label="autocomplete='on'"
43
+ name="phone"
44
+ onChange={handleOnChangeFormField}
45
+ placeholder="Enter phone number"
46
+ type="phone"
47
+ value={formFields.phone}
48
+ {...props}
49
+ />
50
+ <Body marginBottom="sm">
51
+ The following have the same autocomplete attributes (email), but have
52
+ different name attributes (email and emailAlt). Many browsers will
53
+ open autocomplete based on name attributes instead of autocomplete:
54
+ </Body>
55
+ <TextInput
56
+ autoComplete="email"
57
+ label="autocomplete='email' name='email'"
58
+ name="email"
59
+ onChange={handleOnChangeFormField}
60
+ placeholder="Enter email address"
61
+ type="email"
62
+ value={formFields.email}
63
+ {...props}
64
+ />
65
+ <TextInput
66
+ autoComplete="email"
67
+ label="autocomplete='email' name='emailAlt'"
68
+ marginTop="sm"
69
+ name="emailTest"
70
+ onChange={handleOnChangeFormField}
71
+ placeholder="Enter email address"
72
+ type="email"
73
+ value={formFields.emailTest}
74
+ {...props}
75
+ />
76
+ </div>
77
+ );
78
+ };
79
+
80
+ export default TextInputAutocomplete;
@@ -0,0 +1 @@
1
+ Set this prop to `false` or `"off"` to remove autocomplete from text inputs. You can also set it to a string, but browsers will often defer to other attributes like `name`.
@@ -9,23 +9,27 @@
9
9
 
10
10
  <%= pb_rails("text_input", props: {
11
11
  label: "Last Name",
12
- placeholder: "Enter last name"
12
+ placeholder: "Enter last name",
13
+ id: "last-name"
13
14
  }) %>
14
15
 
15
16
  <%= pb_rails("text_input", props: {
16
17
  label: "Phone Number",
17
18
  type: "phone",
18
- placeholder: "Enter phone number"
19
+ placeholder: "Enter phone number",
20
+ id: "phone"
19
21
  }) %>
20
22
 
21
23
  <%= pb_rails("text_input", props: {
22
24
  label: "Email Address",
23
25
  type: "email",
24
- placeholder: "Enter email address"
26
+ placeholder: "Enter email address",
27
+ id: "email"
25
28
  }) %>
26
29
 
27
30
  <%= pb_rails("text_input", props: {
28
31
  label: "Zip Code",
29
32
  type: "number",
30
- placeholder: "Enter zip code"
33
+ placeholder: "Enter zip code",
34
+ id: "zip"
31
35
  }) %>
@@ -38,6 +38,7 @@ const TextInputDefault = (props) => {
38
38
  {...props}
39
39
  />
40
40
  <TextInput
41
+ id="last-name"
41
42
  label="Last Name"
42
43
  name="lastName"
43
44
  onChange={handleOnChangeFormField}
@@ -46,6 +47,7 @@ const TextInputDefault = (props) => {
46
47
  {...props}
47
48
  />
48
49
  <TextInput
50
+ id="phone"
49
51
  label="Phone Number"
50
52
  name="phone"
51
53
  onChange={handleOnChangeFormField}
@@ -55,6 +57,7 @@ const TextInputDefault = (props) => {
55
57
  {...props}
56
58
  />
57
59
  <TextInput
60
+ id="email"
58
61
  label="Email Address"
59
62
  name="email"
60
63
  onChange={handleOnChangeFormField}
@@ -64,6 +67,7 @@ const TextInputDefault = (props) => {
64
67
  {...props}
65
68
  />
66
69
  <TextInput
70
+ id="zip"
67
71
  label="Zip Code"
68
72
  name="zip"
69
73
  onChange={handleOnChangeFormField}
@@ -84,6 +88,7 @@ const TextInputDefault = (props) => {
84
88
  <br />
85
89
 
86
90
  <TextInput
91
+ id="first-name"
87
92
  label="First Name"
88
93
  onChange={handleOnChangeFirstName}
89
94
  placeholder="Enter first name"
@@ -0,0 +1 @@
1
+ Add an `id` to your Text Input so that clicking the label will move focus directly to the input.
@@ -9,6 +9,8 @@ examples:
9
9
  - text_input_no_label: No Label
10
10
  - text_input_options: Input Options
11
11
  - text_input_mask: Mask
12
+ - text_input_autocomplete: Autocomplete
13
+
12
14
  react:
13
15
  - text_input_default: Default
14
16
  - text_input_error: With Error
@@ -19,6 +21,7 @@ examples:
19
21
  - text_input_no_label: No Label
20
22
  - text_input_mask: Mask
21
23
  - text_input_sanitize: Sanitized Masked Input
24
+ - text_input_autocomplete: Autocomplete
22
25
 
23
26
 
24
27
  swift:
@@ -7,3 +7,4 @@ export { default as TextInputInline } from './_text_input_inline.jsx'
7
7
  export { default as TextInputNoLabel } from './_text_input_no_label.jsx'
8
8
  export { default as TextInputMask } from './_text_input_mask.jsx'
9
9
  export { default as TextInputSanitize } from './_text_input_sanitize.jsx'
10
+ export { default as TextInputAutocomplete } from './_text_input_autocomplete.jsx'
@@ -1,6 +1,8 @@
1
1
  <%= pb_content_tag(:div, id: nil ) do %>
2
2
  <% if object.label.present? %>
3
+ <label for="<%= object.input_options[:id] || object.id %>" >
3
4
  <%= pb_rails("caption", props: { text: object.label, dark: object.dark, classname: "pb_text_input_kit_label" }) %>
5
+ </label>
4
6
  <% end %>
5
7
  <%= content_tag(:div, class: "#{add_on_class} text_input_wrapper") do %>
6
8
  <% if content.present? %>
@@ -15,7 +17,7 @@
15
17
  <% else %>
16
18
  <%= input_tag %>
17
19
  <% end %>
18
- <%= pb_rails("body", props: {dark: object.dark, status: "negative", text: object.error}) if object.error %>
20
+ <%= pb_rails("body", props: {dark: object.dark, status: "negative", text: object.error, id: object.error_id, aria: { atomic: "true", live: "polite" }, html_options: { role: "alert" }}) if object.error %>
19
21
  <% end %>
20
22
  <% end %>
21
23
 
@@ -15,8 +15,7 @@ module Playbook
15
15
  "cvv" => '\d{3,4}',
16
16
  }.freeze
17
17
 
18
- prop :autocomplete, type: Playbook::Props::Boolean,
19
- default: true
18
+ prop :autocomplete, default: true
20
19
  prop :disabled, type: Playbook::Props::Boolean,
21
20
  default: false
22
21
  prop :error
@@ -65,11 +64,17 @@ module Playbook
65
64
  "#{object.id}-sanitized" if id.present?
66
65
  end
67
66
 
67
+ def error_id
68
+ "#{id}-error" if error.present?
69
+ end
70
+
68
71
  private
69
72
 
70
73
  def all_input_options
71
74
  {
72
- autocomplete: autocomplete ? nil : "off",
75
+ 'aria-describedby': error.present? ? error_id : nil,
76
+ 'aria-invalid': error.present?,
77
+ autocomplete: autocomplete == true ? nil : (autocomplete.presence || "off"),
73
78
  class: "text_input #{input_options.dig(:classname) || ''}",
74
79
  data: validation_data,
75
80
  disabled: disabled,
@@ -306,3 +306,41 @@ test('returns masked CVV value', () => {
306
306
 
307
307
  expect(input.value).toBe('')
308
308
  })
309
+
310
+ test('adds autocomplete string attribute', () => {
311
+ render(
312
+ <TextInput
313
+ autoComplete="family-name"
314
+ data={{ testid: testId }}
315
+ />
316
+ )
317
+
318
+ const kit = screen.getByTestId(testId)
319
+ const input = within(kit).getByRole('textbox')
320
+ expect(input).toHaveAttribute("autocomplete", "family-name")
321
+ })
322
+
323
+ test('adds autocomplete "off" attribute', () => {
324
+ render(
325
+ <TextInput
326
+ autoComplete={false}
327
+ data={{ testid: testId }}
328
+ />
329
+ )
330
+
331
+ const kit = screen.getByTestId(testId)
332
+ const input = within(kit).getByRole('textbox')
333
+ expect(input).toHaveAttribute("autocomplete", "off")
334
+ })
335
+
336
+ test('does not add autocomplete attribute otherwise', () => {
337
+ render(
338
+ <TextInput
339
+ data={{ testid: testId }}
340
+ />
341
+ )
342
+
343
+ const kit = screen.getByTestId(testId)
344
+ const input = within(kit).getByRole('textbox')
345
+ expect(input).not.toHaveAttribute("autocomplete")
346
+ })
@@ -18,9 +18,11 @@ type TimestampProps = {
18
18
  timezone: string,
19
19
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
20
20
  id?: string,
21
+ showCurrentYear?: boolean,
21
22
  showDate?: boolean,
22
23
  showUser?: boolean,
23
24
  hideUpdated?: boolean,
25
+ showTime?: boolean,
24
26
  showTimezone?: boolean,
25
27
  unstyled?: boolean,
26
28
  variant?: "default" | "elapsed" | "updated"
@@ -37,9 +39,11 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
37
39
  text,
38
40
  timezone,
39
41
  timestamp,
42
+ showCurrentYear = false,
40
43
  showDate = true,
41
44
  showUser = false,
42
45
  hideUpdated = false,
46
+ showTime = true,
43
47
  showTimezone = false,
44
48
  unstyled = false,
45
49
  variant = 'default',
@@ -55,7 +59,6 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
55
59
  )
56
60
 
57
61
  const currentYear = new Date().getFullYear().toString()
58
- const dateDisplay = `${DateTime.toMonth(timestamp, timezone)} ${DateTime.toDay(timestamp, timezone)}`
59
62
  const shouldShowUser = showUser == true && text.length > 0
60
63
  const shouldShowTimezone = showTimezone == true && timezone.length > 0
61
64
  const updatedText = hideUpdated ? "" : "Last updated"
@@ -70,16 +73,26 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
70
73
  return timeDisplay
71
74
  }
72
75
 
76
+ const baseDateDisplay = () => {
77
+ let display = `${DateTime.toMonth(timestamp, timezone)} ${DateTime.toDay(timestamp, timezone)}`
78
+ if (DateTime.toYear(timestamp, timezone).toString() !== currentYear || showCurrentYear) {
79
+ display = `${display}, ${DateTime.toYear(timestamp, timezone)}`
80
+ }
81
+ return display
82
+ }
83
+
73
84
  const fullDateDisplay = () => {
74
- let fullDisplay = `${DateTime.toMonth(timestamp, timezone)} ${DateTime.toDay(timestamp, timezone)}`
75
- if (DateTime.toYear(timestamp, timezone).toString() !== currentYear) {
76
- fullDisplay = `${fullDisplay}, ${DateTime.toYear(timestamp, timezone)}`
77
- }
78
- return `${fullDisplay} ${' \u00b7 '} ${fullTimeDisplay()}`
85
+ const fullDisplay = baseDateDisplay()
86
+ return showTime ? `${fullDisplay} ${' \u00b7 '} ${fullTimeDisplay()}` : fullDisplay
79
87
  }
80
88
 
81
89
  const formatUpdatedString = () => {
82
- return `Last updated ${userDisplay} on ${dateDisplay} at ${timeDisplay}`
90
+ const finalUpdatedString = []
91
+ if (shouldShowUser) finalUpdatedString.push(`by ${text}`)
92
+ if (showDate && !showTime) finalUpdatedString.push(`on ${baseDateDisplay()}`)
93
+ if (showDate && showTime) finalUpdatedString.push(`on ${baseDateDisplay()} at ${timeDisplay}`)
94
+ if (showTime && !showDate) finalUpdatedString.push(`at ${timeDisplay}`)
95
+ return `Last updated ${finalUpdatedString.join(' ')}`
83
96
  }
84
97
 
85
98
  const formatElapsedString = () => {
@@ -93,7 +106,10 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
93
106
  case 'elapsed':
94
107
  return formatElapsedString()
95
108
  default:
96
- return showDate ? timestamp ? fullDateDisplay() : text : fullTimeDisplay()
109
+ if (showDate && showTime) return timestamp ? fullDateDisplay() : text
110
+ if (showDate && !showTime) return baseDateDisplay()
111
+ if (!showDate && showTime) return fullTimeDisplay()
112
+ return text
97
113
  }
98
114
  }
99
115
 
@@ -8,7 +8,6 @@
8
8
 
9
9
  <%= pb_rails("timestamp", props: {
10
10
  timestamp: DateTime.now,
11
- show_date: true,
12
11
  align: "left"
13
12
  }) %>
14
13
 
@@ -16,7 +15,6 @@
16
15
 
17
16
  <%= pb_rails("timestamp", props: {
18
17
  timestamp: DateTime.now + 4.years,
19
- show_date: true,
20
18
  align: "left"
21
19
  }) %>
22
20
 
@@ -24,7 +22,6 @@
24
22
 
25
23
  <%= pb_rails("timestamp", props: {
26
24
  timestamp: DateTime.now - 1.year,
27
- show_date: true,
28
25
  align: "left"
29
26
  }) %>
30
27
 
@@ -40,7 +37,6 @@
40
37
 
41
38
  <%= pb_rails("timestamp", props: {
42
39
  timestamp: DateTime.now,
43
- show_date: true,
44
40
  align: "center"
45
41
  }) %>
46
42
 
@@ -48,7 +44,6 @@
48
44
 
49
45
  <%= pb_rails("timestamp", props: {
50
46
  timestamp: DateTime.now + 4.years,
51
- show_date: true,
52
47
  align: "center"
53
48
  }) %>
54
49
 
@@ -56,7 +51,6 @@
56
51
 
57
52
  <%= pb_rails("timestamp", props: {
58
53
  timestamp: DateTime.now - 1.year,
59
- show_date: true,
60
54
  align: "center"
61
55
  }) %>
62
56
 
@@ -64,7 +58,6 @@
64
58
 
65
59
  <%= pb_rails("timestamp", props: {
66
60
  timestamp: DateTime.now,
67
- show_date: false,
68
61
  align: "right"
69
62
  }) %>
70
63
 
@@ -72,7 +65,6 @@
72
65
 
73
66
  <%= pb_rails("timestamp", props: {
74
67
  timestamp: DateTime.now,
75
- show_date: true,
76
68
  align: "right"
77
69
  }) %>
78
70
 
@@ -80,7 +72,6 @@
80
72
 
81
73
  <%= pb_rails("timestamp", props: {
82
74
  timestamp: DateTime.now + 4.years,
83
- show_date: true,
84
75
  align: "right"
85
76
  }) %>
86
77
 
@@ -88,6 +79,5 @@
88
79
 
89
80
  <%= pb_rails("timestamp", props: {
90
81
  timestamp: DateTime.now - 1.year,
91
- show_date: true,
92
82
  align: "right"
93
83
  }) %>