playbook_ui 13.31.0.pre.alpha.PLAY10863204 → 13.31.0.pre.alpha.play1262iconstyles3171

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_background/background.html.erb +11 -2
  3. data/app/pb_kits/playbook/pb_body/body.html.erb +6 -1
  4. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +6 -1
  5. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +6 -1
  6. data/app/pb_kits/playbook/pb_caption/caption.html.erb +6 -1
  7. data/app/pb_kits/playbook/pb_card/card.html.erb +7 -1
  8. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +1 -1
  9. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default.jsx +1 -4
  10. data/app/pb_kits/playbook/pb_detail/detail.html.erb +6 -1
  11. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +6 -1
  12. data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +6 -1
  13. data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +5 -2
  14. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +6 -1
  15. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +1 -15
  16. data/app/pb_kits/playbook/pb_draggable/context/types.ts +0 -5
  17. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +19 -14
  18. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +3 -5
  19. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.md +3 -7
  20. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +5 -3
  21. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.md +5 -3
  22. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +1 -3
  23. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +0 -2
  24. data/app/pb_kits/playbook/pb_dropdown/index.js +4 -33
  25. data/app/pb_kits/playbook/pb_flex/flex.html.erb +5 -1
  26. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +0 -9
  27. data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +6 -1
  28. data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +5 -1
  29. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +5 -1
  30. data/app/pb_kits/playbook/pb_icon/_icon.scss +223 -1
  31. data/app/pb_kits/playbook/pb_icon/_icon.tsx +99 -7
  32. data/app/pb_kits/playbook/pb_icon/icon.rb +22 -16
  33. data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +2 -2
  34. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +23 -8
  35. data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
  36. data/app/pb_kits/playbook/pb_table/index.ts +4 -4
  37. data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +1 -1
  38. data/app/pb_kits/playbook/pb_table/subcomponents/_table_cell.tsx +1 -1
  39. data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +1 -1
  40. data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +1 -1
  41. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -1
  42. data/app/pb_kits/playbook/pb_table/table.test.js +0 -2
  43. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
  44. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
  45. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +27 -45
  46. data/app/pb_kits/playbook/pb_textarea/index.tsx +3 -3
  47. data/app/pb_kits/playbook/pb_time/_time.tsx +3 -3
  48. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
  49. data/app/pb_kits/playbook/pb_timeline/_item.tsx +1 -1
  50. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
  51. data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +10 -10
  52. data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
  53. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +2 -2
  54. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +2 -1
  55. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +0 -2
  56. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -3
  57. data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +4 -4
  58. data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +7 -11
  59. data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +3 -8
  60. data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +1 -6
  61. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +19 -18
  62. data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +6 -6
  63. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +6 -6
  64. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +3 -3
  65. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +0 -2
  66. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -2
  67. data/app/pb_kits/playbook/pb_typeahead/index.ts +31 -31
  68. data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
  69. data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +6 -6
  70. data/app/pb_kits/playbook/pb_user_badge/badges/million-dollar.tsx +235 -236
  71. data/app/pb_kits/playbook/pb_user_badge/badges/veteran.tsx +1 -1
  72. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +63 -68
  73. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +2 -2
  74. data/dist/menu.yml +472 -566
  75. data/dist/playbook-rails.js +6 -6
  76. data/lib/playbook/version.rb +1 -1
  77. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb0b0eeaa6db40584611bedb1796a2f95dbf7693f4cce865be1ed5c87d1d8819
4
- data.tar.gz: 3617a015115e540c14349aa3c5b0e741edb566e8ce5bcd72803f255e7e4f6beb
3
+ metadata.gz: aa8ace32b190d02c2ea57b6d1bd177c128839e736d35e38f5c5514c6fe45838f
4
+ data.tar.gz: 7298df1115a49f330fd4c4eb67204011693c9f1fa34fcf5ada26051857f8a2af
5
5
  SHA512:
6
- metadata.gz: 895e69139eb0eb62e0037cbc89ff412c748d2f2154a0433a86318df38f526b3036e6643b390ba58772d9d06447297b80d52b64753706db6156e7a28454e3d782
7
- data.tar.gz: '0093caf11bc2960351ae3045e2db58cacbf46352d5062d0abdc0112e29b5520ebfdef2d534f6d3158a91a4ed42852885549eb71b53014d4fcf8cf6f169b8e2bd'
6
+ metadata.gz: a551b8ee5a70651d40c057340fd6de6fb80a8bf2be4f50966f1476049dd4df7e1704d598c3465e314a2a50c3b2a164ecf0a51324dabce8e10ff95fa3140840d8
7
+ data.tar.gz: 7fa81d473e8d499571e1d03a6e3d33054a1da8e5e7ef8a0ca5577fea8193a7690dcb94e38e9db2c7c097a262f1bdac1260a53ea6d3732f5e67757f2db2d2ff94
@@ -1,14 +1,23 @@
1
1
  <% if object.image_url.present? %>
2
- <%= pb_content_tag(object.tag,
2
+ <%= content_tag(object.tag,
3
+ aria: object.aria,
4
+ data: object.data,
5
+ id: object.id,
6
+ class: object.classname,
3
7
  style: "background-image: url('#{object.image_url}');
4
8
  background-repeat: #{object.background_repeat};
5
9
  background-size: #{object.background_size};
6
10
  background-position: #{object.background_position};",
11
+ **combined_html_options
7
12
  ) do %>
8
13
  <%= content.presence %>
9
14
  <% end %>
10
15
  <% else %>
11
- <%= pb_content_tag(object.tag,
16
+ <%= content_tag(object.tag,
17
+ aria: object.aria,
18
+ data: object.data,
19
+ id: object.id,
20
+ class: object.classname,
12
21
  style: object.custom_background_color
13
22
  ) do %>
14
23
  <%= content.presence %>
@@ -1,3 +1,8 @@
1
- <%= pb_content_tag(object.tag) do %>
1
+ <%= content_tag(object.tag,
2
+ aria: object.aria,
3
+ id: object.id,
4
+ data: object.data,
5
+ class: object.classname,
6
+ **combined_html_options) do %>
2
7
  <%= object.content %>
3
8
  <% end %>
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag do%>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ aria: object.aria,
6
+ **combined_html_options) do%>
2
7
  <%= content_tag(object.link ? 'a' : 'span', class: 'bread_crumb_item', href: object.link) do %>
3
8
  <%= content.presence %>
4
9
  <% end %>
@@ -1,3 +1,8 @@
1
- <%= pb_content_tag(:nav) do %>
1
+ <%= content_tag(:nav,
2
+ aria: object.aria,
3
+ id: object.id,
4
+ data: object.data,
5
+ class: object.classname,
6
+ **combined_html_options) do %>
2
7
  <%= content.presence %>
3
8
  <% end %>
@@ -1,3 +1,8 @@
1
- <%= pb_content_tag(object.tag) do %>
1
+ <%= content_tag(object.tag,
2
+ aria: object.aria,
3
+ id: object.id,
4
+ data: object.data,
5
+ class: object.classname,
6
+ **combined_html_options) do %>
2
7
  <%= content.presence || object.text %>
3
8
  <% end %>
@@ -1,4 +1,10 @@
1
- <%= pb_content_tag(object.tag) do %>
1
+ <%= content_tag(object.tag,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ aria: object.aria,
6
+ dark: object.dark,
7
+ **combined_html_options) do %>
2
8
  <%= content.presence %>
3
9
  <% end %>
4
10
 
@@ -28,7 +28,7 @@ exports[`html structure is correct 1`] = `
28
28
  style="vertical-align: middle; color: rgb(193, 205, 214);"
29
29
  >
30
30
  <i
31
- class="pb_icon_kit far fa-fw fa-lg fa-chevron-down"
31
+ class="pb_icon_kit far far fa-lg fa-fw fa-fw fa-lg fa-chevron-down"
32
32
  />
33
33
  <span
34
34
  aria-label="chevron-down icon"
@@ -4,10 +4,7 @@ import { DateYearStacked } from '../../'
4
4
  const DateYearStackedDefault = (props) => {
5
5
  return (
6
6
  <div>
7
- <DateYearStacked
8
- date={new Date()}
9
- {...props}
10
- />
7
+ <DateYearStacked date={new Date()} />
11
8
  <DateYearStacked
12
9
  align="center"
13
10
  date={new Date()}
@@ -1,3 +1,8 @@
1
- <%= pb_content_tag(object.tag) do %>
1
+ <%= content_tag(object.tag,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
2
7
  <%= object.content %>
3
8
  <% end %>
@@ -1,5 +1,10 @@
1
1
  <div class="pb_dialog_wrapper_rails <%= object.full_height_style %>" data-overlay-click= <%= object.overlay_close %> >
2
- <%= pb_content_tag(:dialog) do %>
2
+ <%= content_tag(:dialog,
3
+ aria: object.aria,
4
+ data: object.data,
5
+ id: object.id,
6
+ class: object.classname,
7
+ **combined_html_options) do %>
3
8
  <% if object.status === "" && object.title %>
4
9
  <%= pb_rails("dialog/dialog_header", props: { title: object.title, id: object.id }) %>
5
10
  <% end %>
@@ -1,3 +1,8 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ aria: object.aria,
6
+ **combined_html_options) do %>
2
7
  <%= content.presence || object.text %>
3
8
  <% end %>
@@ -1,5 +1,8 @@
1
- <%= pb_content_tag(:div, class: "") do %>
2
- <% 'excluded classname?' %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ aria: object.aria,
5
+ **combined_html_options) do %>
3
6
  <% if object.confirm_button && object.cancel_button %>
4
7
  <div class="dialog-pseudo-footer"></div>
5
8
  <%= pb_rails("flex", props: { classname:object.classname, spacing:"between", padding_x:"sm", padding:"sm", padding_bottom:"sm" }) do %>
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag(:div, class: object.sticky_header) do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.sticky_header,
5
+ aria: object.aria,
6
+ **combined_html_options) do %>
2
7
  <%= pb_rails("flex", props: {classname:object.classname, spacing:"between", padding:"sm", align:"center"}) do %>
3
8
  <%= content.presence || object.title %>
4
9
 
@@ -51,16 +51,7 @@ export const DraggableContext = () => {
51
51
  return useContext(DragContext);
52
52
  };
53
53
 
54
- export const DraggableProvider = ({
55
- children,
56
- initialItems,
57
- onReorder,
58
- onDragStart,
59
- onDragEnter,
60
- onDragEnd,
61
- onDrop,
62
- onDragOver
63
- }: DraggableProviderType) => {
54
+ export const DraggableProvider = ({ children, initialItems, onReorder }: DraggableProviderType) => {
64
55
  const [state, dispatch] = useReducer(reducer, initialState);
65
56
 
66
57
  useEffect(() => {
@@ -74,7 +65,6 @@ export const DraggableProvider = ({
74
65
  const handleDragStart = (id: string, container: string) => {
75
66
  dispatch({ type: 'SET_DRAG_DATA', payload: { id: id, initialGroup: container } });
76
67
  dispatch({ type: 'SET_IS_DRAGGING', payload: id });
77
- if (onDragStart) onDragStart(id, container);
78
68
  };
79
69
 
80
70
  const handleDragEnter = (id: string, container: string) => {
@@ -82,13 +72,11 @@ export const DraggableProvider = ({
82
72
  dispatch({ type: 'REORDER_ITEMS', payload: { dragId: state.dragData.id, targetId: id } });
83
73
  dispatch({ type: 'SET_DRAG_DATA', payload: { id: state.dragData.id, initialGroup: container } });
84
74
  }
85
- if (onDragEnter) onDragEnter(id, container);
86
75
  };
87
76
 
88
77
  const handleDragEnd = () => {
89
78
  dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
90
79
  dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
91
- if (onDragEnd) onDragEnd();
92
80
  };
93
81
 
94
82
  const changeCategory = (itemId: string, container: string) => {
@@ -99,13 +87,11 @@ export const DraggableProvider = ({
99
87
  dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
100
88
  dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
101
89
  changeCategory(state.dragData.id, container);
102
- if (onDrop) onDrop(container);
103
90
  };
104
91
 
105
92
  const handleDragOver = (e: Event, container: string) => {
106
93
  e.preventDefault();
107
94
  dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: container });
108
- if (onDragOver) onDragOver(e, container);
109
95
  };
110
96
 
111
97
  const contextValue = useMemo(() => ({
@@ -23,9 +23,4 @@ export interface ItemType {
23
23
  children: React.ReactNode;
24
24
  initialItems: ItemType[];
25
25
  onReorder: (items: ItemType[]) => void;
26
- onDragStart?: (id: string, container: string) => void;
27
- onDragEnter?: (id: string, container: string) => void;
28
- onDragEnd?: () => void;
29
- onDrop?: (container: string) => void;
30
- onDragOver?: (e: Event, container: string) => void;
31
26
  }
@@ -1,19 +1,23 @@
1
1
  import React, { useState } from "react";
2
- import { Flex, Image, Draggable, DraggableProvider } from "../../";
2
+ import { SelectableList, Draggable, DraggableProvider } from "../../";
3
3
 
4
4
  // Initial items to be dragged
5
5
  const data = [
6
6
  {
7
- id: "21",
8
- url: "https://unsplash.it/500/400/?image=633",
7
+ id: "1",
8
+ text: "Task 1",
9
9
  },
10
10
  {
11
- id: "22",
12
- url: "https://unsplash.it/500/400/?image=634",
11
+ id: "2",
12
+ text: "Task 2",
13
13
  },
14
14
  {
15
- id: "23",
16
- url: "https://unsplash.it/500/400/?image=637",
15
+ id: "3",
16
+ text: "Task 3",
17
+ },
18
+ {
19
+ id: "4",
20
+ text: "Task 4",
17
21
  },
18
22
  ];
19
23
 
@@ -26,19 +30,20 @@ const DraggableDefault = (props) => {
26
30
  onReorder={(items) => setInitialState(items)}
27
31
  >
28
32
  <Draggable.Container {...props}>
29
- <Flex>
30
- {initialState.map(({ id, url }) => (
33
+ <SelectableList variant="checkbox">
34
+ {initialState.map(({ id, text }) => (
31
35
  <Draggable.Item dragId={id}
32
36
  key={id}
33
37
  >
34
- <Image alt={id}
35
- margin="xs"
36
- size="md"
37
- url={url}
38
+ <SelectableList.Item
39
+ label={text}
40
+ name={id}
41
+ value={id}
42
+ {...props}
38
43
  />
39
44
  </Draggable.Item>
40
45
  ))}
41
- </Flex>
46
+ </SelectableList>
42
47
  </Draggable.Container>
43
48
  </DraggableProvider>
44
49
  </>
@@ -1,6 +1,4 @@
1
- The Draggable kit gives you a full subcomponent structure that allows it to be used with almost any kits.
1
+ To use the Draggable kit, you must use the DraggableProvider and pass in `initialItems`. The `onReorder` is a function that returns the data as it changes as items are reordered. Use this to manage state as shown.
2
2
 
3
- `DraggableProvider` = This provider manages all settings that allows drag and drop to function and must be used as the outermost wrapper. It has 2 REQUIRED props: `initialItems` (initial data) and `onReorder` (function that returns mutated data as items are reordered via drag and drop). Devs must manage state as shown.
4
-
5
- `Draggable.Container` = This specifies the container within which items can be dropped.
6
- `Draggable.Item` = This specifies the items that can be dragged and dropped. `dragId` is a REQUIRED prop for Draggable.Item.
3
+ The `Draggable.Container` specifies the container within which items can be dropped.
4
+ The `Draggable.Item` specifies the items that can be dragged and dropped. `dragId` is a REQUIRED prop for Draggable.Item.
@@ -1,9 +1,5 @@
1
- For a simplified version of the Draggable API for the Card kit, you can do the following:
2
-
3
- Use `DraggableProvider` and manage state as shown.
4
-
5
- `Draggable.Container` creates the container within which the cards can be dragged and dropped.
6
-
7
- The Card kit is optimized to work with the draggable kit. To enable drag, use the `draggableItem` and `dragId` props on the Card kit as shown. An additional optional boolean prop (set to true by default) of `dragHandle` is also available to show the drag handle icon.
1
+ For a simplified version of the Draggable API for the Card kit, You can use the the Card kit as the Draggable Item by using the `draggableItem` prop. The dragHandle is added by default but this can be opted out of by setting `dragHandle` to false on the Card kit.
8
2
 
3
+ In addition to the above `dragId` is a REQUIRED prop to be passedd to the Card kit when implementing dragging.
9
4
 
5
+ The dev must manage state as shown.
@@ -1,5 +1,7 @@
1
- For a simplified version of the Draggable API for the List kit, you can do the following:
1
+ For a simplified version of the Draggable API for the List kit, use the DraggableProvider to wrap the List kit and use the `enableDrag` prop.
2
2
 
3
- Use `DraggableProvider` and manage state as shown.
3
+ In addition to the above `dragId` is a REQUIRED prop to be passed to the List kit when implementing dragging.
4
4
 
5
- The List kit is optimized to work with the draggable kit. To enable drag, use the `enableDrag` prop on List kit AND `dragId` prop on ListItem. An additional optional boolean prop (set to true by default) of `dragHandle` is also available on List kit to show the drag handle icon.
5
+ The dev must manage state as shown.
6
+
7
+ The dragHandle is added by default but this can be opted out of by setting `dragHandle` to false on the List kit.
@@ -1,5 +1,7 @@
1
- For a simplified version of the Draggable API for the SelectableList kit, you can do the following:
1
+ For a simplified version of the Draggable API for the SelectableList kit, use the DraggableProvider to wrap the SelectableList kit and use the `enableDrag` prop.
2
2
 
3
- Use `DraggableProvider` and manage state as shown.
3
+ In addition to the above `dragId` is a REQUIRED prop to be passed to the SelectableList kit when implementing dragging.
4
4
 
5
- The SelectableList kit is optimized to work with the draggable kit. To enable drag, use the `enableDrag` prop on SelectableList kit AND `dragId` prop on SelectableList.Item. An additional optional boolean prop (set to true by default) of `dragHandle` is also available on SelectableList kit to show the drag handle icon.
5
+ The dev must manage state as shown.
6
+
7
+ The dragHandle is added by default but this can be opted out of by setting `dragHandle` to false on the SelectableList kit.
@@ -8,9 +8,7 @@
8
8
  <%= pb_rails("caption", props: {text: object.label, margin_bottom:"xs"}) %>
9
9
  <% end %>
10
10
  <div class="dropdown_wrapper<%= error_class %>" style="position: relative">
11
- <input type="hidden" name="<%= object.name %>" id="dropdown-selected-option" value="" />
12
- <input id="dropdown-form-validation" name="<%= object.name %>_form_validation" value="" style="display: none" <%= object.required ? "required" : ""%> />
13
-
11
+ <input type="hidden" name="<%= object.name %>" id="dropdown-selected-option" value=""/>
14
12
  <% if content.present? %>
15
13
  <%= content.presence %>
16
14
  <%= pb_rails("body", props: { status: "negative", text: object.error }) %>
@@ -8,8 +8,6 @@ module Playbook
8
8
  prop :label, type: Playbook::Props::String
9
9
  prop :name, type: Playbook::Props::String
10
10
  prop :error, type: Playbook::Props::String
11
- prop :required, type: Playbook::Props::Boolean,
12
- default: false
13
11
 
14
12
  def data
15
13
  Hash(prop(:data)).merge(pb_dropdown: true)
@@ -8,22 +8,16 @@ const DOWN_ARROW_SELECTOR = "#dropdown_open_icon";
8
8
  const UP_ARROW_SELECTOR = "#dropdown_close_icon";
9
9
  const OPTION_SELECTOR = "[data-dropdown-option-label]";
10
10
  const CUSTOM_DISPLAY_SELECTOR = "[data-dropdown-custom-trigger]";
11
- const INPUT_FORM_VALIDATION = "#dropdown-form-validation";
12
11
 
13
12
  export default class PbDropdown extends PbEnhancedElement {
14
13
  static get selector() {
15
14
  return DROPDOWN_SELECTOR;
16
15
  }
17
16
 
18
- get target() {
19
- return this.element.parentNode.querySelector(CONTAINER_SELECTOR);
20
- }
21
-
22
17
  connect() {
23
18
  this.keyboardHandler = new PbDropdownKeyboard(this);
24
19
  this.bindEventListeners();
25
20
  this.updateArrowDisplay(false);
26
- this.handleFormValidation();
27
21
  }
28
22
 
29
23
  bindEventListeners() {
@@ -44,13 +38,9 @@ export default class PbDropdown extends PbEnhancedElement {
44
38
  handleOptionClick(event) {
45
39
  const option = event.target.closest(OPTION_SELECTOR);
46
40
  const hiddenInput = this.element.querySelector("#dropdown-selected-option");
47
- const inputFormValidation = this.element.querySelector(INPUT_FORM_VALIDATION);
48
-
49
41
  if (option) {
50
42
  const value = option.dataset.dropdownOptionLabel;
51
43
  hiddenInput.value = JSON.parse(value).id;
52
- inputFormValidation.value = JSON.parse(value).id;
53
- this.clearFormValidation(inputFormValidation);
54
44
  this.onOptionSelected(value, option);
55
45
  }
56
46
  }
@@ -113,6 +103,10 @@ export default class PbDropdown extends PbEnhancedElement {
113
103
  selectedOption.classList.add("pb_dropdown_option_selected");
114
104
  }
115
105
 
106
+ get target() {
107
+ return this.element.parentNode.querySelector(CONTAINER_SELECTOR);
108
+ }
109
+
116
110
  showElement(elem) {
117
111
  elem.classList.remove("close");
118
112
  elem.classList.add("open");
@@ -156,27 +150,4 @@ export default class PbDropdown extends PbEnhancedElement {
156
150
  upArrow.style.display = isOpen ? "inline-block" : "none";
157
151
  }
158
152
  }
159
-
160
- handleFormValidation() {
161
- const inputFormValidation = this.element.querySelector(INPUT_FORM_VALIDATION);
162
-
163
- inputFormValidation.addEventListener("invalid", function (event) {
164
- if (inputFormValidation.hasAttribute("required") && inputFormValidation.value === "") {
165
- event.preventDefault();
166
- inputFormValidation.closest(".dropdown_wrapper").classList.add("error");
167
- }
168
- }, true);
169
- }
170
-
171
- clearFormValidation(input) {
172
- if (input.checkValidity()) {
173
- const dropdownWrapperElement = input.closest(".dropdown_wrapper");
174
- dropdownWrapperElement.classList.remove("error");
175
-
176
- const errorLabelElement = dropdownWrapperElement.querySelector(".pb_body_kit_negative");
177
- if (errorLabelElement) {
178
- errorLabelElement.remove();
179
- }
180
- }
181
- }
182
153
  }
@@ -1,3 +1,7 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ **combined_html_options) do %>
2
6
  <%= content.presence %>
3
7
  <% end %>
@@ -13,14 +13,6 @@
13
13
  ]
14
14
  %>
15
15
 
16
- <%
17
- example_dropdown_options = [
18
- { label: 'United States', value: 'United States', id: 'us' },
19
- { label: 'Canada', value: 'Canada', id: 'ca' },
20
- { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
21
- ]
22
- %>
23
-
24
16
  <%= pb_form_with(scope: :example, method: :get, url: "", validate: true) do |form| %>
25
17
  <%= form.text_field :example_text_field, props: { label: true, required: true } %>
26
18
  <%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field" } %>
@@ -30,7 +22,6 @@
30
22
  <%= form.password_field :example_password_field, props: { label: true, required: true } %>
31
23
  <%= form.url_field :example_url_field, props: { label: true, required: true } %>
32
24
  <%= form.text_area :example_text_area, props: { label: true, required: true } %>
33
- <%= form.dropdown_field :example_dropdown, props: { label: true, options: example_dropdown_options, required: true } %>
34
25
  <%= form.select :example_select, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true } %>
35
26
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
36
27
  <%= form.check_box :example_checkbox, props: { text: "Example Checkbox", label: true, required: true } %>
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag(:span) do %>
1
+ <%= content_tag(:span,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
2
7
  <%= link_to object.url, target: object.link_option do %>
3
8
  <%= pb_rails("badge", props: { dark: object.dark, variant: "primary", text: object.hashtag_text }) %>
4
9
  <% end %>
@@ -1,4 +1,8 @@
1
- <%= pb_content_tag(:span) do %>
1
+ <%= content_tag(:span,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ **combined_html_options) do %>
2
6
  <mark>
3
7
  <%= content.presence || object.text %>
4
8
  </mark>
@@ -1,4 +1,8 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ **combined_html_options) do %>
2
6
  <%= pb_rails("home_address_street/#{emphasis}_emphasis", props: object.send("#{emphasis}_emphasis_props")) %>
3
7
  <% end %>
4
8