playbook_ui 14.13.0.pre.alpha.PLAY1856doc6166 → 14.13.0.pre.alpha.PLAY1873rails86087
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/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +66 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +98 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +28 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.rb +42 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.html.erb +19 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.jsx +26 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.html.erb +10 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.jsx +17 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_on_click.jsx +19 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_onclick.html.erb +16 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb +35 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.jsx +42 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb +13 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/example.yml +15 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/pb_avatar_action_button.test.js +31 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +1 -4
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -7
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +3 -6
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +36 -71
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +6 -6
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +6 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +19 -7
- data/app/pb_kits/playbook/pb_nav/nav.html.erb +8 -3
- data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +6 -1
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +6 -1
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.scss +1 -2
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.jsx +0 -7
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_table/index.ts +9 -41
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +0 -4
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +2 -29
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +3 -31
- data/app/pb_kits/playbook/pb_table/table_body.html.erb +7 -13
- data/app/pb_kits/playbook/pb_table/table_body.rb +0 -2
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +7 -14
- data/app/pb_kits/playbook/pb_table/table_row.rb +1 -14
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +0 -14
- data/app/pb_kits/playbook/pb_text_input/index.js +0 -9
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -5
- data/dist/chunks/{_typeahead-CAIQfP7X.js → _typeahead-DQTwAd_2.js} +4 -4
- data/dist/chunks/_weekday_stacked-ei-exO-N.js +45 -0
- data/dist/chunks/{lib-D3us1bGD.js → lib-WQEeEj3t.js} +1 -1
- data/dist/chunks/{pb_form_validation-BpihMSOQ.js → pb_form_validation-Cq64l4zn.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +7 -0
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +25 -17
- data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +0 -58
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +0 -64
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.jsx +0 -90
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +0 -5
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.html.erb +0 -51
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click_rails.md +0 -2
- data/dist/chunks/_weekday_stacked-Dq02Kbeo.js +0 -45
- /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible_with_custom_click_react.md → _table_with_collapsible_with_custom_click.md} +0 -0
@@ -1,77 +1,42 @@
|
|
1
|
-
import React, { useState
|
2
|
-
import { Button, Drawer,
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Button, Drawer, Flex } from "playbook-ui";
|
3
3
|
|
4
|
-
const
|
5
|
-
const [
|
6
|
-
const
|
4
|
+
const useDrawer = (visible = false) => {
|
5
|
+
const [opened, setOpened] = useState(visible);
|
6
|
+
const toggle = () => setOpened(!opened);
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
return () => mediaQuery.removeEventListener('change', updateScreen)
|
14
|
-
}, [])
|
8
|
+
return [opened, toggle];
|
9
|
+
};
|
10
|
+
|
11
|
+
const DrawerBreakpoints = () => {
|
12
|
+
const [smallDrawerOpened, toggleSmallDrawer] = useDrawer();
|
15
13
|
|
16
14
|
return (
|
17
|
-
|
18
|
-
<
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
padding={isSmallScreen ? "none" : "sm"}
|
37
|
-
variant='bold'
|
15
|
+
<>
|
16
|
+
<Flex wrap>
|
17
|
+
<Button
|
18
|
+
id="sm"
|
19
|
+
marginRight="md"
|
20
|
+
onClick={toggleSmallDrawer}
|
21
|
+
>
|
22
|
+
{"Will open at small breakpoint"}
|
23
|
+
</Button>
|
24
|
+
</Flex>
|
25
|
+
<Flex>
|
26
|
+
<Drawer
|
27
|
+
behavior={"push"}
|
28
|
+
breakpoint="sm"
|
29
|
+
onClose={toggleSmallDrawer}
|
30
|
+
opened={smallDrawerOpened}
|
31
|
+
overlay={false}
|
32
|
+
placement={"right"}
|
33
|
+
size={"lg"}
|
38
34
|
>
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
iconLeft='city'
|
46
|
-
iconRight={["plus", "minus"]}
|
47
|
-
key={index}
|
48
|
-
link='#'
|
49
|
-
text={text}
|
50
|
-
>
|
51
|
-
<NavItem fontSize='small'
|
52
|
-
link='#'
|
53
|
-
marginY='none'
|
54
|
-
text='City'
|
55
|
-
/>
|
56
|
-
<NavItem
|
57
|
-
fontSize='small'
|
58
|
-
link='#'
|
59
|
-
marginY='none'
|
60
|
-
text='People'
|
61
|
-
/>
|
62
|
-
<NavItem
|
63
|
-
fontSize='small'
|
64
|
-
link='#'
|
65
|
-
marginY='none'
|
66
|
-
text='Business'
|
67
|
-
/>
|
68
|
-
</NavItem>
|
69
|
-
)
|
70
|
-
})}
|
71
|
-
</Nav>
|
72
|
-
</Drawer>
|
73
|
-
</div>
|
74
|
-
)
|
75
|
-
}
|
35
|
+
Open because small breakpoint
|
36
|
+
</Drawer>
|
37
|
+
</Flex>
|
38
|
+
</>
|
39
|
+
);
|
40
|
+
};
|
76
41
|
|
77
|
-
export default
|
42
|
+
export default DrawerBreakpoints;
|
@@ -8,8 +8,8 @@ const DrawerMenu = () => {
|
|
8
8
|
const mediaQuery = window.matchMedia("(max-width: 600px)")
|
9
9
|
setIsSmallScreen(mediaQuery.matches)
|
10
10
|
const handler = (e) => setIsSmallScreen(e.matches)
|
11
|
-
mediaQuery.addEventListener(
|
12
|
-
return () => mediaQuery.removeEventListener(
|
11
|
+
mediaQuery.addEventListener('change', handler)
|
12
|
+
return () => mediaQuery.removeEventListener('change', handler)
|
13
13
|
}, [])
|
14
14
|
|
15
15
|
return (
|
@@ -22,17 +22,17 @@ const DrawerMenu = () => {
|
|
22
22
|
/>
|
23
23
|
</Button>
|
24
24
|
<Drawer
|
25
|
-
breakpoint=
|
25
|
+
breakpoint="md"
|
26
26
|
placement='bottom'
|
27
27
|
size='full'
|
28
28
|
triggerId='menuButton'
|
29
29
|
withinElement
|
30
30
|
>
|
31
|
-
<Nav
|
31
|
+
<Nav
|
32
32
|
highlight={false}
|
33
33
|
link='#'
|
34
|
-
orientation={isSmallScreen ?
|
35
|
-
padding={isSmallScreen ?
|
34
|
+
orientation={isSmallScreen ? 'vertical' : 'horizontal'}
|
35
|
+
padding={isSmallScreen ? 'none' : 'sm'}
|
36
36
|
>
|
37
37
|
<NavItem link='#'
|
38
38
|
text='About'
|
@@ -1,9 +1,15 @@
|
|
1
1
|
<% if object.collapsible %>
|
2
2
|
<%= pb_rails("collapsible", props: { name: "collapsible-nav-example", classname: object.collapsible_nav_classname }) do %>
|
3
3
|
<%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs", dark: object.dark, classname:object.margin_classes }) do %>
|
4
|
-
<%=
|
5
|
-
|
6
|
-
|
4
|
+
<%= content_tag(object.tag,
|
5
|
+
aria: object.aria,
|
6
|
+
class: object.classname,
|
7
|
+
data: object.data,
|
8
|
+
dark: object.dark,
|
9
|
+
id: object.id,
|
10
|
+
href: object.link && object.link,
|
11
|
+
target: object.link && object.target,
|
12
|
+
**combined_html_options
|
7
13
|
) do %>
|
8
14
|
<% if object.image_url %>
|
9
15
|
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper_collapsible" }) %>
|
@@ -14,16 +20,22 @@
|
|
14
20
|
<span class="pb_nav_list_item_text_collapsible">
|
15
21
|
<%= object.text %>
|
16
22
|
</span>
|
17
|
-
<% end %>
|
23
|
+
<% end %>
|
18
24
|
<% end %>
|
19
25
|
<%= pb_rails("collapsible/collapsible_content", props: {collapsed: object.collapsed}) do %>
|
20
26
|
<%= content.presence %>
|
21
27
|
<% end %>
|
22
28
|
<% end %>
|
23
29
|
<% else %>
|
24
|
-
<%=
|
25
|
-
|
26
|
-
|
30
|
+
<%= content_tag(object.tag,
|
31
|
+
aria: object.aria,
|
32
|
+
class: object.classname,
|
33
|
+
**combined_html_options,
|
34
|
+
data: object.data,
|
35
|
+
dark: object.dark,
|
36
|
+
id: object.id,
|
37
|
+
href: object.link && object.link,
|
38
|
+
target: object.link && object.target
|
27
39
|
) do %>
|
28
40
|
<% if object.image_url %>
|
29
41
|
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
|
@@ -1,7 +1,12 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:nav,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<% if object.title %>
|
3
|
-
<%=
|
4
|
-
<%=
|
8
|
+
<%= content_tag(:div, class: "pb_nav_list_title") do %>
|
9
|
+
<%= content_tag(:a, class: "pb_nav_list_item_link_text", href: object.link) do %>
|
5
10
|
<%= pb_rails("caption", props: { text: object.title, dark: dark }) %>
|
6
11
|
<% end %>
|
7
12
|
<% end %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<div class="pb_popover_tooltip hide" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
|
3
8
|
<div class="pb_popover_body <%= object.width_height_class_helper %> <%= object.popover_spacing_helper %>" style="<%= object.width_height_helper %>">
|
4
9
|
<%= content.presence %>
|
@@ -31,7 +31,6 @@ examples:
|
|
31
31
|
- table_with_subcomponents_as_divs: Table with Sub Components (Divs)
|
32
32
|
- table_outer_padding: Outer Padding
|
33
33
|
- table_with_collapsible: Table with Collapsible
|
34
|
-
- table_with_collapsible_with_custom_click: Table with Collapsible with Custom Click
|
35
34
|
- table_with_collapsible_with_custom_content_rails: Table with Collapsible with Custom Content
|
36
35
|
- table_with_collapsible_with_nested_rows_rails: Table with Collapsible with Nested Rows
|
37
36
|
- table_with_collapsible_with_nested_table_rails: Table with Collapsible with Nested Table
|
@@ -2,7 +2,6 @@ import PbEnhancedElement from '../pb_enhanced_element'
|
|
2
2
|
|
3
3
|
const TABLE_WRAPPER_SELECTOR = "[data-pb-table-wrapper]";
|
4
4
|
const TABLE_COLLAPSIBLE_WRAPPER_SELECTOR = "[data-pb-table-collapsible-wrapper]";
|
5
|
-
const TABLE_COLLAPSIBLE_CELL_SELECTOR = "[data-pb-table-collapsible-cell-id]";
|
6
5
|
|
7
6
|
export default class PbTable extends PbEnhancedElement {
|
8
7
|
stickyLeftColumns: string[] = [];
|
@@ -159,49 +158,18 @@ export default class PbTable extends PbEnhancedElement {
|
|
159
158
|
}
|
160
159
|
|
161
160
|
handleCollapsibleClick() {
|
162
|
-
const cells = this.element.querySelectorAll(TABLE_COLLAPSIBLE_CELL_SELECTOR);
|
163
161
|
const collapsibleElements = this.element.querySelectorAll(TABLE_COLLAPSIBLE_WRAPPER_SELECTOR);
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
svgChild.id = cellId; // Assign cellId to SVG child
|
173
|
-
Array.from(svgChild.children).forEach((pathChild) => {
|
174
|
-
pathChild.id = cellId; // Assign cellId to path child
|
175
|
-
});
|
176
|
-
});
|
177
|
-
}
|
178
|
-
});
|
179
|
-
cell.addEventListener('click', (event) => {
|
180
|
-
if ((event.target as HTMLElement).id) {
|
181
|
-
document.dispatchEvent(new CustomEvent(`collapsed-toggle${(event.currentTarget as HTMLElement).id}`));
|
182
|
-
|
183
|
-
const toggleElements = this.element.querySelectorAll(`.collapsible_border_toggle${(event.currentTarget as HTMLElement).id}`);
|
184
|
-
toggleElements.forEach((element) => {
|
185
|
-
element.classList.toggle('no-border');
|
186
|
-
element.classList.toggle('border-active');
|
187
|
-
});
|
188
|
-
}
|
162
|
+
collapsibleElements.forEach((collapsibleElement) => {
|
163
|
+
collapsibleElement.addEventListener('click', (event) => {
|
164
|
+
document.dispatchEvent(new CustomEvent(`collapsed-toggle${(event.currentTarget as HTMLElement).id}`))
|
165
|
+
|
166
|
+
const toggleElements = this.element.querySelectorAll(`.collapsible_border_toggle${(event.currentTarget as HTMLElement).id}`);
|
167
|
+
toggleElements.forEach(element => {
|
168
|
+
element.classList.toggle('no-border');
|
169
|
+
element.classList.toggle('border-active');
|
189
170
|
});
|
190
|
-
});
|
191
|
-
|
192
|
-
} else {
|
193
|
-
collapsibleElements.forEach((collapsibleElement) => {
|
194
|
-
collapsibleElement.addEventListener('click', (event) => {
|
195
|
-
document.dispatchEvent(new CustomEvent(`collapsed-toggle${(event.currentTarget as HTMLElement).id}`))
|
196
|
-
|
197
|
-
const toggleElements = this.element.querySelectorAll(`.collapsible_border_toggle${(event.currentTarget as HTMLElement).id}`);
|
198
|
-
toggleElements.forEach(element => {
|
199
|
-
element.classList.toggle('no-border');
|
200
|
-
element.classList.toggle('border-active');
|
201
|
-
});
|
202
|
-
})
|
203
171
|
})
|
204
|
-
}
|
172
|
+
})
|
205
173
|
}
|
206
174
|
|
207
175
|
handleCollapsibleRow() {
|
@@ -7,14 +7,11 @@ import {
|
|
7
7
|
} from "../../utilities/props";
|
8
8
|
import { globalProps } from "../../utilities/globalProps";
|
9
9
|
|
10
|
-
import Draggable from "../../pb_draggable/_draggable"
|
11
|
-
|
12
10
|
type TableBodyPropTypes = {
|
13
11
|
aria?: { [key: string]: string };
|
14
12
|
children: React.ReactNode[] | React.ReactNode;
|
15
13
|
className: string;
|
16
14
|
data?: { [key: string]: string };
|
17
|
-
draggableContainer?: boolean;
|
18
15
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
19
16
|
id?: string;
|
20
17
|
tag?: "table" | "div";
|
@@ -26,7 +23,6 @@ const TableBody = (props: TableBodyPropTypes): React.ReactElement => {
|
|
26
23
|
children,
|
27
24
|
className,
|
28
25
|
data = {},
|
29
|
-
draggableContainer = false,
|
30
26
|
htmlOptions = {},
|
31
27
|
id,
|
32
28
|
tag = "table",
|
@@ -41,30 +37,7 @@ const TableBody = (props: TableBodyPropTypes): React.ReactElement => {
|
|
41
37
|
return (
|
42
38
|
<>
|
43
39
|
{isTableTag ? (
|
44
|
-
|
45
|
-
<Draggable.Container
|
46
|
-
{...ariaProps}
|
47
|
-
{...dataProps}
|
48
|
-
{...htmlProps}
|
49
|
-
className={classes}
|
50
|
-
id={id}
|
51
|
-
tag="tbody"
|
52
|
-
>
|
53
|
-
{children}
|
54
|
-
</Draggable.Container>
|
55
|
-
) : (
|
56
|
-
<tbody
|
57
|
-
{...ariaProps}
|
58
|
-
{...dataProps}
|
59
|
-
{...htmlProps}
|
60
|
-
className={classes}
|
61
|
-
id={id}
|
62
|
-
>
|
63
|
-
{children}
|
64
|
-
</tbody>
|
65
|
-
)
|
66
|
-
) : draggableContainer ? (
|
67
|
-
<Draggable.Container
|
40
|
+
<tbody
|
68
41
|
{...ariaProps}
|
69
42
|
{...dataProps}
|
70
43
|
{...htmlProps}
|
@@ -72,7 +45,7 @@ const TableBody = (props: TableBodyPropTypes): React.ReactElement => {
|
|
72
45
|
id={id}
|
73
46
|
>
|
74
47
|
{children}
|
75
|
-
</
|
48
|
+
</tbody>
|
76
49
|
) : (
|
77
50
|
<div
|
78
51
|
{...ariaProps}
|
@@ -9,7 +9,6 @@ import {
|
|
9
9
|
import { globalProps } from "../../utilities/globalProps";
|
10
10
|
import Collapsible from "../../pb_collapsible/_collapsible";
|
11
11
|
import useCollapsible from "../../pb_collapsible/useCollapsible";
|
12
|
-
import Draggable from "../../pb_draggable/_draggable";
|
13
12
|
|
14
13
|
type TableRowPropTypes = {
|
15
14
|
aria?: { [key: string]: string };
|
@@ -20,8 +19,6 @@ type TableRowPropTypes = {
|
|
20
19
|
collapsibleSideHighlight?: boolean;
|
21
20
|
data?: { [key: string]: string };
|
22
21
|
dark?: boolean;
|
23
|
-
dragId?: string;
|
24
|
-
draggableItem?: boolean;
|
25
22
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
26
23
|
id?: string;
|
27
24
|
toggleCellId?: string;
|
@@ -39,8 +36,6 @@ const TableRow = (props: TableRowPropTypes): React.ReactElement => {
|
|
39
36
|
className,
|
40
37
|
data = {},
|
41
38
|
dark = false,
|
42
|
-
dragId,
|
43
|
-
draggableItem = false,
|
44
39
|
htmlOptions = {},
|
45
40
|
id,
|
46
41
|
toggleCellId,
|
@@ -157,38 +152,15 @@ const TableRow = (props: TableRowPropTypes): React.ReactElement => {
|
|
157
152
|
</>
|
158
153
|
)
|
159
154
|
) : isTableTag ? (
|
160
|
-
|
161
|
-
<Draggable.Item
|
162
|
-
{...ariaProps}
|
163
|
-
{...dataProps}
|
164
|
-
{...htmlProps}
|
165
|
-
className={classes}
|
166
|
-
dragId={dragId}
|
167
|
-
tag="tr"
|
168
|
-
>
|
169
|
-
{children}
|
170
|
-
</Draggable.Item>
|
171
|
-
) : (
|
172
|
-
<tr
|
173
|
-
{...ariaProps}
|
174
|
-
{...dataProps}
|
175
|
-
{...htmlProps}
|
176
|
-
className={classes}
|
177
|
-
id={id}
|
178
|
-
>
|
179
|
-
{children}
|
180
|
-
</tr>
|
181
|
-
)
|
182
|
-
) : draggableItem ? (
|
183
|
-
<Draggable.Item
|
155
|
+
<tr
|
184
156
|
{...ariaProps}
|
185
157
|
{...dataProps}
|
186
158
|
{...htmlProps}
|
187
159
|
className={classes}
|
188
|
-
|
160
|
+
id={id}
|
189
161
|
>
|
190
162
|
{children}
|
191
|
-
</
|
163
|
+
</tr>
|
192
164
|
) : (
|
193
165
|
<div
|
194
166
|
{...ariaProps}
|
@@ -1,17 +1,11 @@
|
|
1
1
|
<% if object.tag == "table" %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
class: object.classname,
|
10
|
-
data: object.data,
|
11
|
-
id: object.id,
|
12
|
-
**combined_html_options) do %>
|
13
|
-
<%= content.presence %>
|
14
|
-
<% end %>
|
2
|
+
<%= content_tag(:tbody,
|
3
|
+
aria: object.aria,
|
4
|
+
class: object.classname,
|
5
|
+
data: object.data,
|
6
|
+
id: object.id,
|
7
|
+
**combined_html_options) do %>
|
8
|
+
<%= content.presence %>
|
15
9
|
<% end %>
|
16
10
|
<% else %>
|
17
11
|
<%= content_tag(:div,
|
@@ -5,7 +5,6 @@
|
|
5
5
|
data: object.data.merge(id: object.id),
|
6
6
|
id: object.id,
|
7
7
|
'data-pb-table-collapsible-wrapper' => true,
|
8
|
-
'data-pb-table-collapsible-cell-id' => object.toggle_cell_id,
|
9
8
|
**combined_html_options) do %>
|
10
9
|
<%= content.presence %>
|
11
10
|
<% end %>
|
@@ -19,19 +18,13 @@
|
|
19
18
|
<% end %>
|
20
19
|
</tr>
|
21
20
|
<% elsif object.tag == "table" %>
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
class: object.classname,
|
30
|
-
data: object.data,
|
31
|
-
id: object.id,
|
32
|
-
**combined_html_options) do %>
|
33
|
-
<%= content.presence %>
|
34
|
-
<% end %>
|
21
|
+
<%= content_tag(:tr,
|
22
|
+
aria: object.aria,
|
23
|
+
class: object.classname,
|
24
|
+
data: object.data,
|
25
|
+
id: object.id,
|
26
|
+
**combined_html_options) do %>
|
27
|
+
<%= content.presence %>
|
35
28
|
<% end %>
|
36
29
|
<% else %>
|
37
30
|
<%= content_tag(:div,
|
@@ -13,14 +13,9 @@ module Playbook
|
|
13
13
|
prop :collapsible_content
|
14
14
|
prop :collapsible_side_highlight, type: Playbook::Props::Boolean,
|
15
15
|
default: true
|
16
|
-
prop :toggle_cell_id, type: Playbook::Props::String
|
17
|
-
prop :draggable_item, type: Playbook::Props::Boolean,
|
18
|
-
default: false
|
19
|
-
prop :drag_id, type: Playbook::Props::String,
|
20
|
-
default: nil
|
21
16
|
|
22
17
|
def classname
|
23
|
-
generate_classname("pb_table_row_kit", side_highlight_class) + tag_class
|
18
|
+
generate_classname("pb_table_row_kit", side_highlight_class) + tag_class
|
24
19
|
end
|
25
20
|
|
26
21
|
def side_highlight_class
|
@@ -30,14 +25,6 @@ module Playbook
|
|
30
25
|
def tag_class
|
31
26
|
" pb_table_tr"
|
32
27
|
end
|
33
|
-
|
34
|
-
def collapsible_cell_class
|
35
|
-
if toggle_cell_id
|
36
|
-
" collapsible_cell"
|
37
|
-
else
|
38
|
-
""
|
39
|
-
end
|
40
|
-
end
|
41
28
|
end
|
42
29
|
end
|
43
30
|
end
|
@@ -27,20 +27,6 @@
|
|
27
27
|
placeholder: "123-45-6789"
|
28
28
|
}) %>
|
29
29
|
|
30
|
-
<%= pb_rails("text_input", props: {
|
31
|
-
label: "Credit Card",
|
32
|
-
mask: "credit_card",
|
33
|
-
margin_bottom: "md",
|
34
|
-
placeholder: "1234 5678 9012 3456"
|
35
|
-
}) %>
|
36
|
-
|
37
|
-
<%= pb_rails("text_input", props: {
|
38
|
-
label: "CVV",
|
39
|
-
mask: "cvv",
|
40
|
-
margin_bottom: "md",
|
41
|
-
placeholder: "123"
|
42
|
-
}) %>
|
43
|
-
|
44
30
|
<%= pb_rails("title" , props: {
|
45
31
|
text: "Hidden Input Under The Hood",
|
46
32
|
padding_bottom: "sm"
|
@@ -27,8 +27,6 @@ export default class PbTextInput extends PbEnhancedElement {
|
|
27
27
|
ssn: 'ssn',
|
28
28
|
postal_code: 'postalCode',
|
29
29
|
zip_code: 'zipCode',
|
30
|
-
credit_card: 'creditCard',
|
31
|
-
cvv: 'cvv',
|
32
30
|
}[maskType];
|
33
31
|
|
34
32
|
if (maskKey && INPUTMASKS[maskKey]) {
|
@@ -47,9 +45,6 @@ export default class PbTextInput extends PbEnhancedElement {
|
|
47
45
|
case "currency":
|
48
46
|
sanitizedInput.value = sanitizeCurrency(formattedValue);
|
49
47
|
break;
|
50
|
-
case "credit_card":
|
51
|
-
sanitizedInput.value = sanitizeCreditCard(formattedValue);
|
52
|
-
break;
|
53
48
|
default:
|
54
49
|
sanitizedInput.value = formattedValue;
|
55
50
|
}
|
@@ -68,10 +63,6 @@ function sanitizeCurrency(input) {
|
|
68
63
|
return input.replace(/[$,]/g, "");
|
69
64
|
}
|
70
65
|
|
71
|
-
function sanitizeCreditCard(input) {
|
72
|
-
return input.replace(/\D/g, "");
|
73
|
-
}
|
74
|
-
|
75
66
|
function setCursorPosition(inputElement, cursorPosition, rawValue, formattedValue) {
|
76
67
|
const difference = formattedValue.length - rawValue.length;
|
77
68
|
const newPosition = Math.max(0, cursorPosition + difference);
|