playbook_ui 17.0.0 → 17.1.0.pre.alpha.phase118730

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 (174) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +1 -13
  4. data/app/pb_kits/playbook/pb_avatar/avatar.test.js +0 -1
  5. data/app/pb_kits/playbook/pb_background/_background.scss +24 -18
  6. data/app/pb_kits/playbook/pb_background/_background.tsx +0 -1
  7. data/app/pb_kits/playbook/pb_background/background.rb +1 -1
  8. data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +3 -2
  9. data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +1 -1
  10. data/app/pb_kits/playbook/pb_background/docs/_background_image.md +1 -1
  11. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +1 -1
  12. data/app/pb_kits/playbook/pb_background/docs/_background_responsive.jsx +2 -2
  13. data/app/pb_kits/playbook/pb_background/docs/_background_size.jsx +3 -3
  14. data/app/pb_kits/playbook/pb_button/docs/_button_reaction.html.erb +1 -1
  15. data/app/pb_kits/playbook/pb_button/docs/_button_reaction.jsx +1 -1
  16. data/app/pb_kits/playbook/pb_button/docs/_button_reaction.md +1 -1
  17. data/app/pb_kits/playbook/pb_card/card.rb +1 -1
  18. data/app/pb_kits/playbook/pb_card/kit.schema.json +2 -0
  19. data/app/pb_kits/playbook/pb_container/_container.scss +3 -0
  20. data/app/pb_kits/playbook/pb_container/_container.tsx +47 -0
  21. data/app/pb_kits/playbook/pb_container/container.html.erb +3 -0
  22. data/app/pb_kits/playbook/pb_container/container.rb +15 -0
  23. data/app/pb_kits/playbook/pb_container/container.test.jsx +28 -0
  24. data/app/pb_kits/playbook/pb_container/docs/_container_default.html.erb +3 -0
  25. data/app/pb_kits/playbook/pb_container/docs/_container_default.jsx +12 -0
  26. data/app/pb_kits/playbook/pb_container/docs/_container_global_props.html.erb +10 -0
  27. data/app/pb_kits/playbook/pb_container/docs/_container_global_props.jsx +18 -0
  28. data/app/pb_kits/playbook/pb_container/docs/_container_global_props.md +1 -0
  29. data/app/pb_kits/playbook/pb_container/docs/_container_tag.html.erb +7 -0
  30. data/app/pb_kits/playbook/pb_container/docs/_container_tag.jsx +25 -0
  31. data/app/pb_kits/playbook/pb_container/docs/_container_tag.md +5 -0
  32. data/app/pb_kits/playbook/pb_container/docs/_description.md +1 -0
  33. data/app/pb_kits/playbook/pb_container/docs/_playground.json +57 -0
  34. data/app/pb_kits/playbook/pb_container/docs/_playground.overrides.json +54 -0
  35. data/app/pb_kits/playbook/pb_container/docs/example.yml +12 -0
  36. data/app/pb_kits/playbook/pb_container/docs/index.js +3 -0
  37. data/app/pb_kits/playbook/pb_container/kit.schema.json +52 -0
  38. data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +79 -0
  39. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +41 -0
  40. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.html.erb +1 -1
  41. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.jsx +1 -4
  42. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_required_indicator.html.erb +1 -1
  43. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_required_indicator.jsx +1 -1
  44. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -2
  45. data/app/pb_kits/playbook/pb_dialog/docs/index.js +0 -1
  46. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +24 -6
  47. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +1 -1
  48. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +1 -4
  49. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +32 -0
  50. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +7 -3
  51. data/app/pb_kits/playbook/pb_dropdown/subcomponents/MultiSelectTriggerDisplay.tsx +4 -2
  52. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_error.html.erb +1 -1
  53. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_error.jsx +1 -6
  54. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_button.jsx +51 -34
  55. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_date_picker.jsx +28 -18
  56. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_default.jsx +47 -25
  57. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.jsx +69 -40
  58. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +7 -0
  59. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.html.erb +6 -7
  60. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.md +1 -1
  61. data/app/pb_kits/playbook/pb_icon/icon.html.erb +1 -1
  62. data/app/pb_kits/playbook/pb_icon/icon.rb +41 -17
  63. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_emoji.html.erb +3 -3
  64. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_emoji.jsx +2 -2
  65. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_emoji.md +1 -1
  66. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +1 -1
  67. data/app/pb_kits/playbook/pb_image/_image.scss +22 -16
  68. data/app/pb_kits/playbook/pb_image/_image.tsx +0 -2
  69. data/app/pb_kits/playbook/pb_image/docs/_playground.json +1 -1
  70. data/app/pb_kits/playbook/pb_image/docs/_playground.overrides.json +1 -1
  71. data/app/pb_kits/playbook/pb_image/docs/_transition_image.html.erb +3 -2
  72. data/app/pb_kits/playbook/pb_image/docs/_transition_image.jsx +4 -4
  73. data/app/pb_kits/playbook/pb_image/image.html.erb +1 -1
  74. data/app/pb_kits/playbook/pb_image/image.rb +1 -1
  75. data/app/pb_kits/playbook/pb_image/image.test.js +4 -4
  76. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.md +1 -1
  77. data/app/pb_kits/playbook/pb_multi_level_select/index.js +779 -59
  78. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +117 -1
  79. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +50 -20
  80. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.test.jsx +365 -0
  81. data/app/pb_kits/playbook/pb_multi_level_select/tree_helpers.js +266 -0
  82. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +7 -17
  83. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +1 -2
  84. data/app/pb_kits/playbook/pb_phone_number_input/index.ts +515 -0
  85. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.html.erb +15 -1
  86. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +17 -8
  87. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +298 -0
  88. data/app/pb_kits/playbook/pb_pill/_pill.scss +49 -0
  89. data/app/pb_kits/playbook/pb_pill/_pill.test.jsx +71 -0
  90. data/app/pb_kits/playbook/pb_pill/_pill.tsx +4 -1
  91. data/app/pb_kits/playbook/pb_pill/docs/_pill_notification.html.erb +14 -0
  92. data/app/pb_kits/playbook/pb_pill/docs/_pill_notification.jsx +57 -0
  93. data/app/pb_kits/playbook/pb_pill/docs/_pill_notification.md +1 -0
  94. data/app/pb_kits/playbook/pb_pill/docs/_playground.json +26 -0
  95. data/app/pb_kits/playbook/pb_pill/docs/_playground.overrides.json +25 -1
  96. data/app/pb_kits/playbook/pb_pill/docs/example.yml +2 -0
  97. data/app/pb_kits/playbook/pb_pill/docs/index.js +1 -0
  98. data/app/pb_kits/playbook/pb_pill/kit.schema.json +8 -0
  99. data/app/pb_kits/playbook/pb_pill/pill.rb +13 -1
  100. data/app/pb_kits/playbook/pb_select/_select.scss +6 -0
  101. data/app/pb_kits/playbook/pb_select/docs/_playground.json +13 -1
  102. data/app/pb_kits/playbook/pb_select/docs/_playground.overrides.json +9 -0
  103. data/app/pb_kits/playbook/pb_select/docs/_select_error.html.erb +1 -1
  104. data/app/pb_kits/playbook/pb_select/docs/_select_error.jsx +2 -7
  105. data/app/pb_kits/playbook/pb_selectable_card_icon/docs/_selectable_card_icon_custom.html.erb +3 -3
  106. data/app/pb_kits/playbook/pb_selectable_card_icon/docs/_selectable_card_icon_custom.md +1 -1
  107. data/app/pb_kits/playbook/pb_table/_table.tsx +4 -0
  108. data/app/pb_kits/playbook/pb_table/docs/_playground.json +2 -0
  109. data/app/pb_kits/playbook/pb_table/docs/_playground.overrides.json +1 -1
  110. data/app/pb_kits/playbook/pb_table/docs/_sections.yml +1 -0
  111. data/app/pb_kits/playbook/pb_table/docs/_table_contrast_border.html.erb +71 -0
  112. data/app/pb_kits/playbook/pb_table/docs/_table_contrast_border.jsx +93 -0
  113. data/app/pb_kits/playbook/pb_table/docs/_table_contrast_border.md +1 -0
  114. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  115. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  116. data/app/pb_kits/playbook/pb_table/kit.schema.json +8 -0
  117. data/app/pb_kits/playbook/pb_table/styles/_all.scss +2 -1
  118. data/app/pb_kits/playbook/pb_table/styles/_contrast_border.scss +87 -0
  119. data/app/pb_kits/playbook/pb_table/styles/_desktop_collapse.scss +2 -2
  120. data/app/pb_kits/playbook/pb_table/styles/_headers.scss +3 -3
  121. data/app/pb_kits/playbook/pb_table/styles/_hover.scss +2 -2
  122. data/app/pb_kits/playbook/pb_table/styles/_mobile.scss +2 -2
  123. data/app/pb_kits/playbook/pb_table/styles/_mobile_collapse.scss +2 -2
  124. data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +2 -2
  125. data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +2 -2
  126. data/app/pb_kits/playbook/pb_table/styles/_structure.scss +1 -1
  127. data/app/pb_kits/playbook/pb_table/styles/_table-card.scss +2 -2
  128. data/app/pb_kits/playbook/pb_table/styles/_tablet_collapse.scss +2 -2
  129. data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +9 -9
  130. data/app/pb_kits/playbook/pb_table/table.rb +7 -1
  131. data/app/pb_kits/playbook/pb_table/table.test.js +5 -0
  132. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.html.erb +1 -1
  133. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.jsx +1 -8
  134. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.html.erb +1 -1
  135. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.jsx +1 -7
  136. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_error_state.jsx +2 -6
  137. data/app/pb_kits/playbook/tokens/_colors.scss +7 -3
  138. data/app/pb_kits/playbook/tokens/_height.scss +5 -1
  139. data/app/pb_kits/playbook/utilities/globalProps.ts +17 -9
  140. data/app/pb_kits/playbook/utilities/test/globalProps/height.test.js +10 -7
  141. data/dist/chunks/StickyLayoutHelper-UJixHS26.js +1 -0
  142. data/dist/chunks/_detail-BdVys5ew.js +6 -0
  143. data/dist/chunks/_pb_line_graph-ip060KbT.js +1 -0
  144. data/dist/chunks/_table-GiaQc6AM.js +1 -0
  145. data/dist/chunks/_typeahead-szmex0ft.js +1 -0
  146. data/dist/chunks/componentRegistry-CGTe01aG.js +1 -0
  147. data/dist/chunks/globalProps-B9_dv5tf.js +6 -0
  148. data/dist/chunks/lib-DyhMVlQI.js +24 -0
  149. data/dist/chunks/time_picker_helper-57h8jbk9.js +1 -0
  150. data/dist/chunks/vendor.js +3 -7
  151. data/dist/menu.yml +17 -10
  152. data/dist/playbook-rails-react-bindings.js +1 -1
  153. data/dist/playbook-rails.js +1 -1
  154. data/dist/playbook.css +1 -1
  155. data/lib/playbook/height.rb +2 -2
  156. data/lib/playbook/max_height.rb +2 -2
  157. data/lib/playbook/min_height.rb +2 -2
  158. data/lib/playbook/pb_forms_global_props_helper.rb +3 -3
  159. data/lib/playbook/tokens/colors.json +4 -2
  160. data/lib/playbook/version.rb +2 -2
  161. metadata +39 -15
  162. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.html.erb +0 -71
  163. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.jsx +0 -57
  164. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_rails.md +0 -1
  165. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_react.md +0 -1
  166. data/dist/chunks/StickyLayoutHelper-DCzCcWUN.js +0 -1
  167. data/dist/chunks/_detail-BKKHcGcj.js +0 -5
  168. data/dist/chunks/_pb_line_graph-B3q4LKEz.js +0 -1
  169. data/dist/chunks/_table-Bkla2kcQ.js +0 -1
  170. data/dist/chunks/_typeahead-CULhE-SU.js +0 -1
  171. data/dist/chunks/componentRegistry-DRSp5D_e.js +0 -1
  172. data/dist/chunks/globalProps-zGbN4oBH.js +0 -6
  173. data/dist/chunks/lib-LNv9xZ-1.js +0 -29
  174. data/dist/chunks/time_picker_helper-Bx8nzyM8.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a0a3a991932ffc02ce86b727b56b252fbf4bb0bc93f232fbbad6941c63e56d5
4
- data.tar.gz: 342f580343e5a39ef86663eba4d1fb8bce4ddcc699d3d7b52c9a7e1d16404f95
3
+ metadata.gz: 8e02326bade04d79c6ea03a77d490d7611648882615ae1bc68de3948677cf201
4
+ data.tar.gz: 076de95937944edfd18a5e69e86da52932a249ba00fa5fdc9dda61871c81ee65
5
5
  SHA512:
6
- metadata.gz: 878f0f3aa7a1930e43394ae899c2708d9d7d3596f4ebb014c588f1095921c9cb7575f77f33dfb207286bb93c2c3b2185b9b244df1addd71aa6347835c0560560
7
- data.tar.gz: 71ddab4024b085f462b341b2daf4158aac4cc81a5289025f5cf1782ba4c72560e2b75d6054a61faae3eb5d3cd1cf46ae24e8d579bcd313fe0578a5ac06692efb
6
+ metadata.gz: 7f9af4cbba2f83018f31df1f004a6ac8f8e0660263fcd230fe882097801da15cda2a7f5e8827f36830542914b3520e24d66b4be18fce8374bd74360603b46cba
7
+ data.tar.gz: 707900ab2522bfce052e9da53f0005936724f7a73acd25e70611b3467ec115a9aee17b8383176de48488c6d1518a75bd52cfe10bd3b87ba386977c407f9fb8b3
@@ -12,6 +12,7 @@
12
12
  @import 'pb_circle_icon_button/circle_icon_button';
13
13
  @import 'pb_collapsible/collapsible';
14
14
  @import 'pb_contact/contact';
15
+ @import 'pb_container/container';
15
16
  @import 'pb_copy_button/copy_button';
16
17
  @import 'pb_currency/currency';
17
18
  @import 'pb_dashboard_value/dashboard_value';
@@ -4,6 +4,7 @@ import { flexRender, Cell, Row } from "@tanstack/react-table"
4
4
  import { VirtualItem } from "@tanstack/react-virtual"
5
5
 
6
6
  import { GenericObject } from "../../types"
7
+ import { debounce } from "../../utilities/object"
7
8
 
8
9
  import { isChrome } from "../Utilities/BrowserCheck"
9
10
  import { getVirtualizedRowStyle } from "../Utilities/TableContainerStyles"
@@ -77,19 +78,6 @@ export const VirtualizedTableView = ({
77
78
  return widths;
78
79
  };
79
80
 
80
- // Debounce function to prevent too many updates during resize
81
- const debounce = <T extends (...args: any[]) => any>(func: T, wait: number): ((...args: Parameters<T>) => void) => {
82
- let timeout: ReturnType<typeof setTimeout>;
83
- return function executedFunction(...args: Parameters<T>) {
84
- const later = () => {
85
- clearTimeout(timeout);
86
- func(...args);
87
- };
88
- clearTimeout(timeout);
89
- timeout = setTimeout(later, wait);
90
- };
91
- };
92
-
93
81
  // Update column widths when component mounts and when sorting changes
94
82
  useLayoutEffect(() => {
95
83
  // Apply widths after a small delay to ensure header is rendered
@@ -24,7 +24,6 @@ test('loads the given image url and name', () => {
24
24
 
25
25
  expect(kit).toHaveClass('pb_avatar_kit_size_md')
26
26
  expect(kit).toHaveAttribute('data-initials', initials)
27
- expect(image).toHaveAttribute('data-src', imageUrl)
28
27
  expect(image).toHaveAttribute('src', imageUrl)
29
28
  expect(image).toHaveAttribute('alt', imageAlt)
30
29
  })
@@ -30,30 +30,15 @@ $background_colors: map-merge($additional_colors, $merge_kits7);
30
30
  }
31
31
 
32
32
  &.fade {
33
- opacity: 0;
34
- &.lazyloaded {
35
- opacity: 1;
36
- transition: opacity 400ms ease-in;
37
- }
33
+ animation: pb_background_fade 400ms ease-in forwards;
38
34
  }
39
35
 
40
36
  &.blur {
41
- filter: blur(5px);
42
- &.lazyloaded {
43
- -webkit-filter: blur(0);
44
- filter: blur(0);
45
- transition: filter 400ms ease-in;
46
- }
37
+ animation: pb_background_blur 400ms ease-in forwards;
47
38
  }
48
39
 
49
40
  &.scale {
50
- opacity: 0;
51
- transform: scale(0.9);
52
- &.lazyloaded {
53
- opacity: 1;
54
- transform: scale(1);
55
- transition: 700ms ease-in;
56
- }
41
+ animation: pb_background_scale 700ms ease-in forwards;
57
42
  }
58
43
 
59
44
  &.imageoverlay {
@@ -82,3 +67,24 @@ $background_colors: map-merge($additional_colors, $merge_kits7);
82
67
  }
83
68
  }
84
69
  }
70
+
71
+ @keyframes pb_background_fade {
72
+ from { opacity: 0; }
73
+ to { opacity: 1; }
74
+ }
75
+
76
+ @keyframes pb_background_blur {
77
+ from { filter: blur(5px); }
78
+ to { filter: blur(0); }
79
+ }
80
+
81
+ @keyframes pb_background_scale {
82
+ from {
83
+ opacity: 0;
84
+ transform: scale(0.9);
85
+ }
86
+ to {
87
+ opacity: 1;
88
+ transform: scale(1);
89
+ }
90
+ }
@@ -127,7 +127,6 @@ const Background = (props: BackgroundProps): React.ReactElement => {
127
127
  // Build CSS classes and styles using responsive values.
128
128
  const classes = classnames(
129
129
  buildCss('pb_background_kit'),
130
- 'lazyload',
131
130
  globalProps(props),
132
131
  transition,
133
132
  {
@@ -115,7 +115,7 @@ module Playbook
115
115
 
116
116
  def image_classname
117
117
  background_class = custom_color.present? ? "pb_background_custom_color" : "pb_background_color_#{background_color}"
118
- background_class_lazy = image_url.present? ? " lazyload #{transition}" : ""
118
+ background_class_lazy = image_url.present? && transition.present? ? " #{transition}" : ""
119
119
  "#{background_class}#{background_class_lazy}"
120
120
  end
121
121
  end
@@ -51,8 +51,9 @@
51
51
 
52
52
  const updateTransition = (transition) => {
53
53
  const imageTransition = document.querySelector('.background-image')
54
- imageTransition.classList.remove("fade", "blur", "scale", "lazyloaded")
55
- imageTransition.classList.add(transition, "lazyload")
54
+ imageTransition.classList.remove("fade", "blur", "scale")
55
+ void imageTransition.offsetWidth
56
+ imageTransition.classList.add(transition)
56
57
  }
57
58
  (transitionDropdown).addEventListener('change', function() {
58
59
  updateTransition(option)
@@ -29,7 +29,7 @@ const BackgroundImage = (props) => {
29
29
  <>
30
30
  <Background
31
31
  alt="colorful background"
32
- className="background lazyload"
32
+ className="background"
33
33
  imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
34
34
  transition={transition}
35
35
  {...props}
@@ -1 +1 @@
1
- To add a lazyload on the background image simply use the `transition` prop and one of the three string options `"fade"`, `"blur"`, or `"scale"`.
1
+ To add a transition on the background image, use the `transition` prop with `"fade"`, `"blur"`, or `"scale"`.
@@ -9,7 +9,7 @@ const BackgroundOverlay = (props) => {
9
9
  <Background
10
10
  alt="colorful background"
11
11
  backgroundColor="category_21"
12
- className="background lazyload"
12
+ className="background"
13
13
  imageOverlay="opacity_2"
14
14
  imageUrl="https://unsplash.it/500/400/?image=633"
15
15
  {...props}
@@ -6,14 +6,14 @@ const BackgroundResponsive = (props) => (
6
6
  <Background
7
7
  alt="colorful background"
8
8
  backgroundColor={{ xs: "primary", sm: "warning", md: "success", lg: "error", xl: "category_1" }}
9
- className="background lazyload"
9
+ className="background"
10
10
  padding="xl"
11
11
  {...props}
12
12
  />
13
13
  <br/>
14
14
  <Background
15
15
  alt="colorful background"
16
- className="background lazyload"
16
+ className="background"
17
17
  imageUrl={{
18
18
  xs: "https://unsplash.it/500/400/?image=633",
19
19
  sm: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80",
@@ -6,7 +6,7 @@ const BackgroundSize = (props) => (
6
6
  <Background
7
7
  alt="colorful background"
8
8
  backgroundSize="auto"
9
- className="background lazyload"
9
+ className="background"
10
10
  imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
11
11
  padding="xl"
12
12
  {...props}
@@ -15,7 +15,7 @@ const BackgroundSize = (props) => (
15
15
  <Background
16
16
  alt="colorful background"
17
17
  backgroundSize="cover"
18
- className="background lazyload"
18
+ className="background"
19
19
  imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
20
20
  padding="xl"
21
21
  {...props}
@@ -25,7 +25,7 @@ const BackgroundSize = (props) => (
25
25
  alt="colorful background"
26
26
  backgroundRepeat="no-repeat"
27
27
  backgroundSize="contain"
28
- className="background lazyload"
28
+ className="background"
29
29
  imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
30
30
  padding="xl"
31
31
  {...props}
@@ -1,4 +1,4 @@
1
- <%= pb_rails("button", props: { count: 153, highlight: false, icon: "&#127881;", classname: "count", id: "reaction-button-highlight", variant: "reaction" }) %>
1
+ <%= pb_rails("button", props: { count: 153, highlight: false, icon: "🎉", classname: "count", id: "reaction-button-highlight", variant: "reaction" }) %>
2
2
  <%= pb_rails("button", props: { count: 5, icon: "1️⃣", variant: "reaction", margin_left: "lg" }) %>
3
3
  <%= pb_rails("button", props: { variant: "reaction", margin_left: "lg" }) %>
4
4
  <%= pb_rails("button", props: { icon: "user", variant: "reaction", margin_left: "lg" }) %>
@@ -11,7 +11,7 @@ return (
11
11
  <Button
12
12
  count={highlightActive ? (reactionCount + 1) : reactionCount}
13
13
  highlight = {highlightActive}
14
- icon="&#127881;"
14
+ icon="🎉"
15
15
  onClick={()=> setHighlightActive(!highlightActive)}
16
16
  tabIndex={0}
17
17
  variant="reaction"
@@ -1,3 +1,3 @@
1
- The `reaction` variant accepts any HTML Emoji or it's hexa/decimal ref (see [here](https://www.w3schools.com/charsets/ref_emoji.asp)) as a string within the `icon` prop. If nothing is passed to the icon prop, the default reaction button will be displayed as seen in the third example. The default reaction button will also be rendered if a Fontawesome icon (not an Emoji) is passed to the `icon` prop of a `reaction` variant, but the default "smiley +" icon will be replaced with the named icon.
1
+ The `reaction` variant accepts any emoji as a string within the `icon` prop. If nothing is passed to the icon prop, the default reaction button will be displayed as seen in the third example. The default reaction button will also be rendered if a Fontawesome icon (not an Emoji) is passed to the `icon` prop of a `reaction` variant, but the default "smiley +" icon will be replaced with the named icon.
2
2
 
3
3
  Reaction buttons also accept two additional (optional) props: `count`, which accepts a number (i.e., a count of reactions) to be displayed next to the Emoji; and `highlight`, which is a boolean that if true, displays the 'active' state for the button. Click the first reaction button to see this in action!
@@ -15,7 +15,7 @@ module Playbook
15
15
  values: %w[xs sm md lg xl none rounded],
16
16
  default: "md"
17
17
  prop :background, type: Playbook::Props::Enum,
18
- values: %w[white light dark product_1_background product_1_highlight product_2_background product_2_highlight product_3_background product_3_highlight product_4_background product_4_highlight product_5_background product_5_highlight product_6_background product_6_highlight product_7_background product_7_highlight product_8_background product_8_highlight product_9_background product_9_highlight product_10_background product_10_highlight product_11_background product_11_highlight windows siding doors solar roofing gutters insulation none success_subtle warning_subtle error_subtle info_subtle neutral_subtle],
18
+ values: %w[white light dark product_1_background product_1_highlight product_2_background product_2_highlight product_3_background product_3_highlight product_4_background product_4_highlight product_5_background product_5_highlight product_6_background product_6_highlight product_7_background product_7_highlight product_8_background product_8_highlight product_9_background product_9_highlight product_10_background product_10_highlight product_11_background product_11_highlight product_12_background product_12_highlight windows siding doors solar roofing gutters insulation none success_subtle warning_subtle error_subtle info_subtle neutral_subtle],
19
19
  default: "none"
20
20
  prop :drag_id, type: Playbook::Props::String
21
21
  prop :draggable_item, type: Playbook::Props::Boolean,
@@ -39,6 +39,8 @@
39
39
  "product_10_highlight",
40
40
  "product_11_background",
41
41
  "product_11_highlight",
42
+ "product_12_background",
43
+ "product_12_highlight",
42
44
  "windows",
43
45
  "siding",
44
46
  "doors",
@@ -0,0 +1,3 @@
1
+ .pb_container_kit {
2
+
3
+ }
@@ -0,0 +1,47 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
5
+
6
+ type ContainerProps = {
7
+ aria?: { [key: string]: string },
8
+ children?: React.ReactNode,
9
+ className?: string,
10
+ data?: { [key: string]: string },
11
+ htmlOptions?: { [key: string]: string | number | boolean | (() => void) | ((event: any) => void) | any },
12
+ tag?: "div" | "span" | "a" | "button" | "option" | "table" | "tbody" | "thead" | "tfoot" | "tr" | "td" | "th" | "img" | "section" | "article" | "main" | "header" | "footer" | "nav" | "aside"
13
+ id?: string,
14
+ } & GlobalProps
15
+
16
+ const Container = (props: ContainerProps): React.ReactElement => {
17
+ const {
18
+ aria = {},
19
+ children,
20
+ className,
21
+ data = {},
22
+ htmlOptions = {},
23
+ tag = 'div',
24
+ id,
25
+ } = props
26
+
27
+ const ariaProps = buildAriaProps(aria)
28
+ const dataProps = buildDataProps(data)
29
+ const htmlProps = buildHtmlProps(htmlOptions)
30
+ const classes = classnames(buildCss('pb_container_kit'), globalProps(props), className)
31
+
32
+ const Tag = tag
33
+
34
+ return (
35
+ <Tag
36
+ {...ariaProps}
37
+ {...dataProps}
38
+ {...htmlProps}
39
+ className={classes}
40
+ id={id}
41
+ >
42
+ {children}
43
+ </Tag>
44
+ )
45
+ }
46
+
47
+ export default Container
@@ -0,0 +1,3 @@
1
+ <%= pb_content_tag(object.tag) do %>
2
+ <%= content.presence %>
3
+ <% end %>
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbContainer
5
+ class Container < ::Playbook::KitBase
6
+ prop :tag, type: Playbook::Props::Enum,
7
+ values: %w[div span a button option table tbody thead tfoot tr td th img section article main header footer nav aside],
8
+ default: "div"
9
+
10
+ def classname
11
+ generate_classname("pb_container_kit")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,28 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+
4
+ import { Container } from 'playbook-ui'
5
+
6
+ /* See these resources for more testing info:
7
+ - https://github.com/testing-library/jest-dom#usage for useage and examples
8
+ - https://jestjs.io/docs/en/using-matchers
9
+ */
10
+
11
+ test('Container renders with default props', () => {
12
+ const props = {
13
+ children: 'Container Content'
14
+ }
15
+
16
+ render(<Container {...props}>{props.children}</Container>)
17
+ expect(screen.getByText(props.children)).toBeInTheDocument()
18
+ })
19
+
20
+ test('Container renders with custom tag', () => {
21
+ const props = {
22
+ tag: 'span',
23
+ children: 'Container Content'
24
+ }
25
+
26
+ render(<Container {...props}>{props.children}</Container>)
27
+ expect(screen.getByText(props.children)).toBeInTheDocument()
28
+ })
@@ -0,0 +1,3 @@
1
+ <%= pb_rails("container") do %>
2
+ Hello, I am a div container
3
+ <% end %>
@@ -0,0 +1,12 @@
1
+ import React from 'react'
2
+ import Container from '../../pb_container/_container'
3
+
4
+ const ContainerDefault = (props) => (
5
+ <Container
6
+ {...props}
7
+ >
8
+ Hello, I am a div container
9
+ </Container>
10
+ )
11
+
12
+ export default ContainerDefault
@@ -0,0 +1,10 @@
1
+ <%= pb_rails("container", props: {
2
+ border: "default",
3
+ border_radius: "lg",
4
+ hover: { shadow: "deepest" },
5
+ max_width: "sm",
6
+ padding: "md",
7
+ shadow: "deep"
8
+ }) do %>
9
+ Hello, I am a styled container
10
+ <% end %>
@@ -0,0 +1,18 @@
1
+ import React from 'react'
2
+ import Container from '../../pb_container/_container'
3
+
4
+ const ContainerGlobalProps = (props) => (
5
+ <Container
6
+ border="default"
7
+ borderRadius="lg"
8
+ hover={{ shadow: "deepest" }}
9
+ maxWidth="sm"
10
+ padding="md"
11
+ shadow="deep"
12
+ {...props}
13
+ >
14
+ Hello, I am a styled container
15
+ </Container>
16
+ )
17
+
18
+ export default ContainerGlobalProps
@@ -0,0 +1 @@
1
+ Use Container with global props instead of using a `div` and and having to write a SCSS file. This example shows usage of padding, border, borderRadius, hover, shadow, and maxWidth as props. See our [global props page](https://playbook.powerapp.cloud/global_props) for the full list of available options.
@@ -0,0 +1,7 @@
1
+ <%= pb_rails("container", props: { tag: "span" }) do %>
2
+ Hello, I am a span container
3
+ <% end %>
4
+ <br />
5
+ <%= pb_rails("container", props: { html_options: { href: "https://playbook.powerapp.cloud/", target: "_blank" }, tag: "a" }) do %>
6
+ Hello, I am an a container
7
+ <% end %>
@@ -0,0 +1,25 @@
1
+ import React from 'react'
2
+ import Container from '../../pb_container/_container'
3
+
4
+ const ContainerTag = (props) => {
5
+ return (
6
+ <>
7
+ <Container
8
+ tag="span"
9
+ {...props}
10
+ >
11
+ Hello, I am a span container
12
+ </Container>
13
+ <br />
14
+ <Container
15
+ htmlOptions={{ href: "https://playbook.powerapp.cloud/", target: "_blank" }}
16
+ tag="a"
17
+ {...props}
18
+ >
19
+ Hello, I am an a container
20
+ </Container>
21
+ </>
22
+ )
23
+ }
24
+
25
+ export default ContainerTag
@@ -0,0 +1,5 @@
1
+ Use the `tag` prop to change the HTML element rendered. Container uses `div` by default. Available tags are:
2
+
3
+ `div` `span` `a` `button` `option` `table` `tbody` `thead` `tfoot` `tr` `td` `th` `img` `section` `article` `main` `header` `footer` `nav` `aside`
4
+
5
+ Use `htmlOptions`/`html_options` to add any HTML attributes to the kit. For example, we add `href` here so the `a` tag is a working link.
@@ -0,0 +1 @@
1
+ Use Container in place of a custom `div` and SCSS file. Apply global props for spacing, border, radius, shadow, and more.
@@ -0,0 +1,57 @@
1
+ {
2
+ "template": "<Container{{props}}>\n {{children}}\n</Container>",
3
+ "propTargets": {},
4
+ "defaults": {
5
+ "tag": "div"
6
+ },
7
+ "groups": [
8
+ {
9
+ "name": "Layout",
10
+ "props": [
11
+ "tag"
12
+ ]
13
+ }
14
+ ],
15
+ "presets": [
16
+ {
17
+ "name": "Default",
18
+ "props": {},
19
+ "children": "Hello, I am a div container"
20
+ },
21
+ {
22
+ "name": "Span",
23
+ "props": {
24
+ "tag": "span"
25
+ },
26
+ "children": "Hello, I am a span container"
27
+ },
28
+ {
29
+ "name": "Global Props",
30
+ "props": {
31
+ "border": "default",
32
+ "borderRadius": "lg",
33
+ "hover": {
34
+ "shadow": "deepest"
35
+ },
36
+ "maxWidth": "sm",
37
+ "padding": "md",
38
+ "shadow": "deep"
39
+ },
40
+ "children": "Hello, I am a styled container"
41
+ }
42
+ ],
43
+ "conditionals": {},
44
+ "hints": {
45
+ "link_tag": {
46
+ "when": {
47
+ "tag": "a"
48
+ },
49
+ "message": "Use htmlOptions to add href and other HTML attributes when tag is a.",
50
+ "type": "info"
51
+ }
52
+ },
53
+ "children": {
54
+ "editable": true,
55
+ "default": "Hello, I am a div container"
56
+ }
57
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "template": "<Container{{props}}>\n {{children}}\n</Container>",
3
+ "children": {
4
+ "editable": true,
5
+ "default": "Hello, I am a div container"
6
+ },
7
+ "defaults": {
8
+ "tag": "div"
9
+ },
10
+ "groups": [
11
+ {
12
+ "name": "Layout",
13
+ "props": ["tag"]
14
+ }
15
+ ],
16
+ "presets": [
17
+ {
18
+ "name": "Default",
19
+ "props": {},
20
+ "children": "Hello, I am a div container"
21
+ },
22
+ {
23
+ "name": "Span",
24
+ "props": {
25
+ "tag": "span"
26
+ },
27
+ "children": "Hello, I am a span container"
28
+ },
29
+ {
30
+ "name": "Global Props",
31
+ "props": {
32
+ "border": "default",
33
+ "borderRadius": "lg",
34
+ "hover": {
35
+ "shadow": "deepest"
36
+ },
37
+ "maxWidth": "sm",
38
+ "padding": "md",
39
+ "shadow": "deep"
40
+ },
41
+ "children": "Hello, I am a styled container"
42
+ }
43
+ ],
44
+ "conditionals": {},
45
+ "hints": {
46
+ "link_tag": {
47
+ "when": {
48
+ "tag": "a"
49
+ },
50
+ "message": "Use htmlOptions to add href and other HTML attributes when tag is a.",
51
+ "type": "info"
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,12 @@
1
+ examples:
2
+
3
+ rails:
4
+ - container_default: Default
5
+ - container_tag: Tag
6
+ - container_global_props: Global Props
7
+
8
+
9
+ react:
10
+ - container_default: Default
11
+ - container_tag: Tag
12
+ - container_global_props: Global Props
@@ -0,0 +1,3 @@
1
+ export { default as ContainerDefault } from './_container_default.jsx'
2
+ export { default as ContainerTag } from './_container_tag.jsx'
3
+ export { default as ContainerGlobalProps } from './_container_global_props.jsx'
@@ -0,0 +1,52 @@
1
+ {
2
+ "$schema": "https://playbook.powerapp.cloud/schemas/kit-schema.json",
3
+ "name": "Container",
4
+ "description": "Container component",
5
+ "platforms": [
6
+ "react",
7
+ "rails"
8
+ ],
9
+ "props": {
10
+ "tag": {
11
+ "type": "enum",
12
+ "platforms": [
13
+ "react",
14
+ "rails"
15
+ ],
16
+ "values": [
17
+ "div",
18
+ "span",
19
+ "a",
20
+ "button",
21
+ "option",
22
+ "table",
23
+ "tbody",
24
+ "thead",
25
+ "tfoot",
26
+ "tr",
27
+ "td",
28
+ "th",
29
+ "img",
30
+ "section",
31
+ "article",
32
+ "main",
33
+ "header",
34
+ "footer",
35
+ "nav",
36
+ "aside"
37
+ ],
38
+ "default": "div"
39
+ }
40
+ },
41
+ "globalProps": true,
42
+ "usage": {
43
+ "react": {
44
+ "import": "import { Container } from 'playbook-ui'",
45
+ "example": "<Container tag=\"div\"></Container>"
46
+ },
47
+ "rails": {
48
+ "import": null,
49
+ "example": "<%= pb_rails(\"container\", props: { tag: \"div\" }) %>"
50
+ }
51
+ }
52
+ }