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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_background/background.html.erb +11 -2
- data/app/pb_kits/playbook/pb_body/body.html.erb +6 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +6 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +6 -1
- data/app/pb_kits/playbook/pb_caption/caption.html.erb +6 -1
- data/app/pb_kits/playbook/pb_card/card.html.erb +7 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +1 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default.jsx +1 -4
- data/app/pb_kits/playbook/pb_detail/detail.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +5 -2
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +6 -1
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +1 -15
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +0 -5
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +19 -14
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +3 -5
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.md +3 -7
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +5 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.md +5 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +1 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +0 -2
- data/app/pb_kits/playbook/pb_dropdown/index.js +4 -33
- data/app/pb_kits/playbook/pb_flex/flex.html.erb +5 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +0 -9
- data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +6 -1
- data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +5 -1
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +5 -1
- data/app/pb_kits/playbook/pb_icon/_icon.scss +223 -1
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +99 -7
- data/app/pb_kits/playbook/pb_icon/icon.rb +22 -16
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +2 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +23 -8
- data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/index.ts +4 -4
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_cell.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/table.test.js +0 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +27 -45
- data/app/pb_kits/playbook/pb_textarea/index.tsx +3 -3
- data/app/pb_kits/playbook/pb_time/_time.tsx +3 -3
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +1 -1
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
- data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +10 -10
- data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +2 -2
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +2 -1
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +0 -2
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -3
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +4 -4
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +7 -11
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +3 -8
- data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +1 -6
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +19 -18
- data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +6 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +6 -6
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +3 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -2
- data/app/pb_kits/playbook/pb_typeahead/index.ts +31 -31
- data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +6 -6
- data/app/pb_kits/playbook/pb_user_badge/badges/million-dollar.tsx +235 -236
- data/app/pb_kits/playbook/pb_user_badge/badges/veteran.tsx +1 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +63 -68
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +2 -2
- data/dist/menu.yml +472 -566
- data/dist/playbook-rails.js +6 -6
- data/lib/playbook/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa8ace32b190d02c2ea57b6d1bd177c128839e736d35e38f5c5514c6fe45838f
|
4
|
+
data.tar.gz: 7298df1115a49f330fd4c4eb67204011693c9f1fa34fcf5ada26051857f8a2af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a551b8ee5a70651d40c057340fd6de6fb80a8bf2be4f50966f1476049dd4df7e1704d598c3465e314a2a50c3b2a164ecf0a51324dabce8e10ff95fa3140840d8
|
7
|
+
data.tar.gz: 7fa81d473e8d499571e1d03a6e3d33054a1da8e5e7ef8a0ca5577fea8193a7690dcb94e38e9db2c7c097a262f1bdac1260a53ea6d3732f5e67757f2db2d2ff94
|
@@ -1,14 +1,23 @@
|
|
1
1
|
<% if object.image_url.present? %>
|
2
|
-
<%=
|
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
|
-
<%=
|
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,4 +1,9 @@
|
|
1
|
-
<%=
|
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 %>
|
@@ -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,5 +1,10 @@
|
|
1
1
|
<div class="pb_dialog_wrapper_rails <%= object.full_height_style %>" data-overlay-click= <%= object.overlay_close %> >
|
2
|
-
<%=
|
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,5 +1,8 @@
|
|
1
|
-
<%=
|
2
|
-
|
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
|
-
<%=
|
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 {
|
2
|
+
import { SelectableList, Draggable, DraggableProvider } from "../../";
|
3
3
|
|
4
4
|
// Initial items to be dragged
|
5
5
|
const data = [
|
6
6
|
{
|
7
|
-
id: "
|
8
|
-
|
7
|
+
id: "1",
|
8
|
+
text: "Task 1",
|
9
9
|
},
|
10
10
|
{
|
11
|
-
id: "
|
12
|
-
|
11
|
+
id: "2",
|
12
|
+
text: "Task 2",
|
13
13
|
},
|
14
14
|
{
|
15
|
-
id: "
|
16
|
-
|
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
|
-
|
30
|
-
{initialState.map(({ id,
|
33
|
+
<SelectableList variant="checkbox">
|
34
|
+
{initialState.map(({ id, text }) => (
|
31
35
|
<Draggable.Item dragId={id}
|
32
36
|
key={id}
|
33
37
|
>
|
34
|
-
<
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
+
<SelectableList.Item
|
39
|
+
label={text}
|
40
|
+
name={id}
|
41
|
+
value={id}
|
42
|
+
{...props}
|
38
43
|
/>
|
39
44
|
</Draggable.Item>
|
40
45
|
))}
|
41
|
-
|
46
|
+
</SelectableList>
|
42
47
|
</Draggable.Container>
|
43
48
|
</DraggableProvider>
|
44
49
|
</>
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
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
|
-
`
|
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,
|
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,
|
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
|
-
|
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
|
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,
|
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
|
-
|
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
|
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
|
}
|
@@ -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
|
-
<%=
|
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
|
-
<%=
|
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
|
|