playbook_ui 7.3.0.pre.alpha3 → 7.3.0.pre.alpha8
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 -1
- data/app/pb_kits/playbook/data/menu.yml +1 -1
- data/app/pb_kits/playbook/index.js +2 -1
- data/app/pb_kits/playbook/pb_list/_list.jsx +9 -2
- data/app/pb_kits/playbook/pb_selectable_list/_item.jsx +92 -0
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.html.erb +11 -0
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.jsx +47 -0
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss +17 -0
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list_item.html.erb +18 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_checkbox.html.erb +13 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_checkbox.jsx +34 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_radio.html.erb +13 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_radio.jsx +38 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/example.yml +12 -0
- data/app/pb_kits/playbook/pb_selectable_list/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.rb +24 -0
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +29 -0
- data/app/pb_kits/playbook/vendor.js +0 -3
- data/lib/playbook/version.rb +2 -1
- metadata +16 -17
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.html.erb +0 -9
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.jsx +0 -142
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +0 -17
- data/app/pb_kits/playbook/pb_collapsible/child_kits/_collapsible_content.html.erb +0 -7
- data/app/pb_kits/playbook/pb_collapsible/child_kits/_collapsible_main.html.erb +0 -16
- data/app/pb_kits/playbook/pb_collapsible/collapsible.rb +0 -15
- data/app/pb_kits/playbook/pb_collapsible/collapsible_content.rb +0 -21
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.rb +0 -24
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_dark.html.erb +0 -10
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_dark.jsx +0 -17
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.html.erb +0 -10
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +0 -17
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +0 -9
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_collapsible/index.js +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e3e60d3152719e9078450a2e66bc9eedbf6e71db1a2cfe9abd998a865fdc448
|
4
|
+
data.tar.gz: 5ef613bebcb8d926bd434614999601ef6c2b8c069aa8ecc790e4868792b2f9ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56ba60a4fe222051010e57a1df2c17c890dfc87cca02f82bb6b22d301c7d06bf78dde9ff58d0aa925f5ebcde9464af015a00941ba4b5a5d51335caa444f5bc0a
|
7
|
+
data.tar.gz: 7bede8f9d4d12fd0c9c17e0c9874dd8485cbba9c5ff9a71ee4c29709928652e582f4a96d6c44f40fabc270db9da772a6557685b3b1da8e547b2090c5e497ce12
|
@@ -12,7 +12,6 @@
|
|
12
12
|
@import 'pb_checkbox/checkbox';
|
13
13
|
@import 'pb_circle_chart/circle_chart';
|
14
14
|
@import 'pb_circle_icon_button/circle_icon_button';
|
15
|
-
@import 'pb_collapsible/collapsible';
|
16
15
|
@import 'pb_contact/contact';
|
17
16
|
@import 'pb_currency/currency';
|
18
17
|
@import 'pb_dashboard_value/dashboard_value';
|
@@ -63,6 +62,7 @@
|
|
63
62
|
@import 'pb_selectable_card/selectable_card';
|
64
63
|
@import 'pb_selectable_card_icon/selectable_card_icon';
|
65
64
|
@import 'pb_selectable_icon/selectable_icon';
|
65
|
+
@import 'pb_selectable_list/selectable_list';
|
66
66
|
@import 'pb_source/source';
|
67
67
|
@import 'pb_star_rating/star_rating';
|
68
68
|
@import 'pb_stat_change/stat_change';
|
@@ -13,7 +13,6 @@ kits:
|
|
13
13
|
- circle_icon_button
|
14
14
|
- card
|
15
15
|
- checkbox
|
16
|
-
- collapsible
|
17
16
|
- charts_and_graphs:
|
18
17
|
- bar_graph
|
19
18
|
- circle_chart
|
@@ -35,6 +34,7 @@ kits:
|
|
35
34
|
- selectable_card
|
36
35
|
- selectable_card_icon
|
37
36
|
- selectable_icon
|
37
|
+
- selectable_list
|
38
38
|
- text_input
|
39
39
|
- textarea
|
40
40
|
- typeahead
|
@@ -15,7 +15,6 @@ export Card from './pb_card/_card.jsx'
|
|
15
15
|
export Checkbox from './pb_checkbox/_checkbox.jsx'
|
16
16
|
export CircleChart from './pb_circle_chart/_circle_chart.jsx'
|
17
17
|
export CircleIconButton from './pb_circle_icon_button/_circle_icon_button.jsx'
|
18
|
-
export Collapsible from './pb_collapsible/_collapsible.jsx'
|
19
18
|
export Contact from './pb_contact/_contact.jsx'
|
20
19
|
export Currency from './pb_currency/_currency.jsx'
|
21
20
|
export DashboardValue from './pb_dashboard_value/_dashboard_value.jsx'
|
@@ -69,6 +68,8 @@ export Select from './pb_select/_select.jsx'
|
|
69
68
|
export SelectableCard from './pb_selectable_card/_selectable_card.jsx'
|
70
69
|
export SelectableCardIcon from './pb_selectable_card_icon/_selectable_card_icon.jsx'
|
71
70
|
export SelectableIcon from './pb_selectable_icon/_selectable_icon.jsx'
|
71
|
+
export SelectableList from './pb_selectable_list/_selectable_list.jsx'
|
72
|
+
export SelectableListItem from './pb_selectable_list/_item.jsx'
|
72
73
|
export Source from './pb_source/_source.jsx'
|
73
74
|
export StarRating from './pb_star_rating/_star_rating.jsx'
|
74
75
|
export StatChange from './pb_stat_change/_stat_change.jsx'
|
@@ -17,7 +17,9 @@ type ListProps = {
|
|
17
17
|
ordered: boolean,
|
18
18
|
role?: string,
|
19
19
|
tabIndex?: string,
|
20
|
+
text?: string,
|
20
21
|
size?: string,
|
22
|
+
variant?: string,
|
21
23
|
xpadding: boolean,
|
22
24
|
}
|
23
25
|
|
@@ -36,6 +38,8 @@ const List = (props: ListProps) => {
|
|
36
38
|
size = '',
|
37
39
|
tabIndex,
|
38
40
|
xpadding = false,
|
41
|
+
variant,
|
42
|
+
text,
|
39
43
|
} = props
|
40
44
|
|
41
45
|
const layoutClass = {
|
@@ -44,6 +48,9 @@ const List = (props: ListProps) => {
|
|
44
48
|
default: '',
|
45
49
|
}
|
46
50
|
|
51
|
+
const childrenWithProps = React.Children.map(children, (child) => {
|
52
|
+
return React.cloneElement(child, { text, variant })
|
53
|
+
})
|
47
54
|
const ariaProps = buildAriaProps(aria)
|
48
55
|
const dataProps = buildDataProps(data)
|
49
56
|
const classes = classnames(
|
@@ -70,7 +77,7 @@ const List = (props: ListProps) => {
|
|
70
77
|
role={role}
|
71
78
|
tabIndex={tabIndex}
|
72
79
|
>
|
73
|
-
{
|
80
|
+
{childrenWithProps}
|
74
81
|
</ol>
|
75
82
|
<Else />
|
76
83
|
<ul
|
@@ -81,7 +88,7 @@ const List = (props: ListProps) => {
|
|
81
88
|
role={role}
|
82
89
|
tabIndex={tabIndex}
|
83
90
|
>
|
84
|
-
{
|
91
|
+
{childrenWithProps}
|
85
92
|
</ul>
|
86
93
|
</If>
|
87
94
|
</div>
|
@@ -0,0 +1,92 @@
|
|
1
|
+
/* @flow */
|
2
|
+
import React, { Node } from 'react'
|
3
|
+
import classnames from 'classnames'
|
4
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
5
|
+
import { globalProps } from '../utilities/globalProps.js'
|
6
|
+
import { Checkbox, ListItem, Radio } from '..'
|
7
|
+
|
8
|
+
type SelectableListItemProps = {
|
9
|
+
aria?: object,
|
10
|
+
children: array<Node> | Node,
|
11
|
+
checked?: boolean,
|
12
|
+
className?: string,
|
13
|
+
data?: object,
|
14
|
+
defaultChecked?: boolean,
|
15
|
+
id?: string,
|
16
|
+
label?: string,
|
17
|
+
text?: string,
|
18
|
+
name?: string,
|
19
|
+
value?: string,
|
20
|
+
variant?: string,
|
21
|
+
onChange: (boolean)=>void,
|
22
|
+
}
|
23
|
+
|
24
|
+
const SelectableListItem = ({
|
25
|
+
aria = {},
|
26
|
+
checked = false,
|
27
|
+
children,
|
28
|
+
className,
|
29
|
+
data = {},
|
30
|
+
defaultChecked,
|
31
|
+
id,
|
32
|
+
label,
|
33
|
+
text,
|
34
|
+
name = '',
|
35
|
+
value = '',
|
36
|
+
variant,
|
37
|
+
onChange = () => {},
|
38
|
+
...props
|
39
|
+
}: SelectableListItemProps) => {
|
40
|
+
const ariaProps = buildAriaProps(aria)
|
41
|
+
const dataProps = buildDataProps(data)
|
42
|
+
const classes = classnames(
|
43
|
+
buildCss('pb_selectable_list_item_kit'),
|
44
|
+
globalProps(props),
|
45
|
+
className
|
46
|
+
)
|
47
|
+
|
48
|
+
return (
|
49
|
+
<ListItem {...props}>
|
50
|
+
<div
|
51
|
+
{...ariaProps}
|
52
|
+
{...dataProps}
|
53
|
+
className={classes}
|
54
|
+
htmlFor={id}
|
55
|
+
>
|
56
|
+
<Choose>
|
57
|
+
<When condition={variant == 'checkbox'}>
|
58
|
+
<Checkbox
|
59
|
+
checked={checked}
|
60
|
+
id={id}
|
61
|
+
name={name}
|
62
|
+
onChange={onChange}
|
63
|
+
// eslint suppressor, text is needed to display on screen
|
64
|
+
text={label || (text && false)}
|
65
|
+
type="checkbox"
|
66
|
+
value={value}
|
67
|
+
{...props}
|
68
|
+
/>
|
69
|
+
{children}
|
70
|
+
</When>
|
71
|
+
<When condition={variant == 'radio'}>
|
72
|
+
<Radio
|
73
|
+
defaultChecked={defaultChecked}
|
74
|
+
id={id}
|
75
|
+
label={label}
|
76
|
+
name={name}
|
77
|
+
onChange={onChange}
|
78
|
+
type="radio"
|
79
|
+
value={value}
|
80
|
+
{...props}
|
81
|
+
/>
|
82
|
+
{children}
|
83
|
+
</When>
|
84
|
+
<Otherwise>{children}</Otherwise>
|
85
|
+
</Choose>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
</ListItem>
|
89
|
+
)
|
90
|
+
}
|
91
|
+
|
92
|
+
export default SelectableListItem
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id) do %>
|
6
|
+
<%= pb_rails("list") do %>
|
7
|
+
<% object.items.each do |item| %>
|
8
|
+
<%= pb_rails("selectable_list/selectable_list_item", props: item.merge(variant: object.variant) )%>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/* @flow */
|
2
|
+
import React from 'react'
|
3
|
+
import classnames from 'classnames'
|
4
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
5
|
+
import { globalProps } from '../utilities/globalProps.js'
|
6
|
+
import { List } from '..'
|
7
|
+
import SelectableListItem from './_item.jsx'
|
8
|
+
|
9
|
+
type SelectableListProps = {
|
10
|
+
aria?: object,
|
11
|
+
children?: Node,
|
12
|
+
className?: string,
|
13
|
+
data?: object,
|
14
|
+
id?: string,
|
15
|
+
variant?: 'checkbox' | 'radio',
|
16
|
+
}
|
17
|
+
|
18
|
+
const SelectableList = (props: SelectableListProps) => {
|
19
|
+
const {
|
20
|
+
aria = {},
|
21
|
+
children,
|
22
|
+
className,
|
23
|
+
data = {},
|
24
|
+
id,
|
25
|
+
} = props
|
26
|
+
|
27
|
+
const ariaProps = buildAriaProps(aria)
|
28
|
+
const classes = classnames(buildCss('pb_selectable_list_kit'), globalProps(props), className)
|
29
|
+
const dataProps = buildDataProps(data)
|
30
|
+
|
31
|
+
return (
|
32
|
+
<div
|
33
|
+
{...ariaProps}
|
34
|
+
{...dataProps}
|
35
|
+
className={classes}
|
36
|
+
id={id}
|
37
|
+
>
|
38
|
+
<List {...props}>
|
39
|
+
{children}
|
40
|
+
</List>
|
41
|
+
</div>
|
42
|
+
)
|
43
|
+
}
|
44
|
+
|
45
|
+
SelectableList.Item = SelectableListItem
|
46
|
+
|
47
|
+
export default SelectableList
|
@@ -0,0 +1,17 @@
|
|
1
|
+
@import "../tokens/colors";
|
2
|
+
@import "../tokens/spacing";
|
3
|
+
|
4
|
+
[class^=pb_selectable_list]{
|
5
|
+
margin-bottom: 0px;
|
6
|
+
[class^=pb_item_kit] {
|
7
|
+
&:hover {
|
8
|
+
background-color: $bg_light;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
[class^=pb_radio_kit] {
|
12
|
+
margin-left: $space_xs;
|
13
|
+
}
|
14
|
+
[class^=pb_checkbox_kit] {
|
15
|
+
margin-left: $space_xs;
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= content_tag(:li,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id) do %>
|
6
|
+
<% puts object.variant %>
|
7
|
+
<% if object.variant == "radio"%>
|
8
|
+
<%= pb_rails("radio", props: { text: object.text, checked: object.checked } ) %>
|
9
|
+
<% if object.children.present? %>
|
10
|
+
<%= capture(&object.children) %>
|
11
|
+
<% end %>
|
12
|
+
<% else %>
|
13
|
+
<%= pb_rails("checkbox", props: { text: object.text, checked: object.checked } ) %>
|
14
|
+
<% if object.children.present? %>
|
15
|
+
<%= capture(&object.children) %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= pb_rails("selectable_list",
|
2
|
+
props: {
|
3
|
+
variant: "checkbox",
|
4
|
+
items: [
|
5
|
+
{ text: "Monday", name: "custum1" },
|
6
|
+
{ text: "Tuesday", name: "custum2", checked: true },
|
7
|
+
{ text: "Wednesday", name: "custum3" },
|
8
|
+
{ text: "Thursday", name: "custum4" },
|
9
|
+
{ text: "Friday", name: "custum5" },
|
10
|
+
]
|
11
|
+
}
|
12
|
+
)
|
13
|
+
%>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { SelectableList } from '../..'
|
3
|
+
|
4
|
+
const SelectableListDefault = () => {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<SelectableList variant="checkbox">
|
8
|
+
<SelectableList.Item
|
9
|
+
label="Monday"
|
10
|
+
name="custom1"
|
11
|
+
/>
|
12
|
+
<SelectableList.Item
|
13
|
+
checked
|
14
|
+
label="Tuesday"
|
15
|
+
name="custom2"
|
16
|
+
/>
|
17
|
+
<SelectableList.Item
|
18
|
+
label="Wednesday"
|
19
|
+
name="custom3"
|
20
|
+
/>
|
21
|
+
<SelectableList.Item
|
22
|
+
label="Thursday"
|
23
|
+
name="custom4"
|
24
|
+
/>
|
25
|
+
<SelectableList.Item
|
26
|
+
label="Friday"
|
27
|
+
name="custom5"
|
28
|
+
/>
|
29
|
+
</SelectableList>
|
30
|
+
</div>
|
31
|
+
)
|
32
|
+
}
|
33
|
+
|
34
|
+
export default SelectableListDefault
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= pb_rails("selectable_list",
|
2
|
+
props: {
|
3
|
+
variant: "radio",
|
4
|
+
items: [
|
5
|
+
{ text: "Monday", name: "custum1" },
|
6
|
+
{ text: "Tuesday", name: "custum2", checked: true },
|
7
|
+
{ text: "Wednesday", name: "custum3" },
|
8
|
+
{ text: "Thursday", name: "custum4" },
|
9
|
+
{ text: "Friday", name: "custum5" },
|
10
|
+
]
|
11
|
+
}
|
12
|
+
)
|
13
|
+
%>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { SelectableList } from '../..'
|
3
|
+
|
4
|
+
const SelectableListDefault = () => {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<SelectableList variant="radio">
|
8
|
+
<SelectableList.Item
|
9
|
+
defaultChecked={false}
|
10
|
+
label="Monday"
|
11
|
+
name="custom1"
|
12
|
+
/>
|
13
|
+
<SelectableList.Item
|
14
|
+
defaultChecked
|
15
|
+
label="Tuesday"
|
16
|
+
name="custom1"
|
17
|
+
/>
|
18
|
+
<SelectableList.Item
|
19
|
+
defaultChecked={false}
|
20
|
+
label="Wednesday"
|
21
|
+
name="custom1"
|
22
|
+
/>
|
23
|
+
<SelectableList.Item
|
24
|
+
defaultChecked={false}
|
25
|
+
label="Thursday"
|
26
|
+
name="custom1"
|
27
|
+
/>
|
28
|
+
<SelectableList.Item
|
29
|
+
defaultChecked={false}
|
30
|
+
label="Friday"
|
31
|
+
name="custom1"
|
32
|
+
/>
|
33
|
+
</SelectableList>
|
34
|
+
</div>
|
35
|
+
)
|
36
|
+
}
|
37
|
+
|
38
|
+
export default SelectableListDefault
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbSelectableList
|
5
|
+
class SelectableList
|
6
|
+
include Playbook::Props
|
7
|
+
|
8
|
+
partial "pb_selectable_list/selectable_list"
|
9
|
+
|
10
|
+
prop :variant, type: Playbook::Props::Enum,
|
11
|
+
values: %w[radio checkbox],
|
12
|
+
default: "radio"
|
13
|
+
|
14
|
+
prop :text, type: Playbook::Props::String
|
15
|
+
|
16
|
+
prop :items, type: Playbook::Props::Array,
|
17
|
+
default: []
|
18
|
+
|
19
|
+
def classname
|
20
|
+
generate_classname("pb_selectable_list_kit")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbSelectableList
|
5
|
+
class SelectableListItem
|
6
|
+
include Playbook::Props
|
7
|
+
|
8
|
+
prop :tabindex
|
9
|
+
|
10
|
+
prop :checked, type: Playbook::Props::Boolean,
|
11
|
+
default: false
|
12
|
+
prop :name, type: Playbook::Props::String,
|
13
|
+
default: "radio_name"
|
14
|
+
prop :text, type: Playbook::Props::String
|
15
|
+
prop :value, type: Playbook::Props::String,
|
16
|
+
default: "radio_text"
|
17
|
+
|
18
|
+
prop :variant, type: Playbook::Props::Enum,
|
19
|
+
values: %w[radio checkbox],
|
20
|
+
default: "radio"
|
21
|
+
|
22
|
+
partial "pb_selectable_list/selectable_list_item"
|
23
|
+
|
24
|
+
def classname
|
25
|
+
generate_classname("pb_selectable_list_item_kit")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.3.0.pre.
|
4
|
+
version: 7.3.0.pre.alpha8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -625,21 +625,6 @@ files:
|
|
625
625
|
- app/pb_kits/playbook/pb_circle_icon_button/docs/_footer.md
|
626
626
|
- app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml
|
627
627
|
- app/pb_kits/playbook/pb_circle_icon_button/docs/index.js
|
628
|
-
- app/pb_kits/playbook/pb_collapsible/_collapsible.html.erb
|
629
|
-
- app/pb_kits/playbook/pb_collapsible/_collapsible.jsx
|
630
|
-
- app/pb_kits/playbook/pb_collapsible/_collapsible.scss
|
631
|
-
- app/pb_kits/playbook/pb_collapsible/child_kits/_collapsible_content.html.erb
|
632
|
-
- app/pb_kits/playbook/pb_collapsible/child_kits/_collapsible_main.html.erb
|
633
|
-
- app/pb_kits/playbook/pb_collapsible/collapsible.rb
|
634
|
-
- app/pb_kits/playbook/pb_collapsible/collapsible_content.rb
|
635
|
-
- app/pb_kits/playbook/pb_collapsible/collapsible_main.rb
|
636
|
-
- app/pb_kits/playbook/pb_collapsible/docs/_collapsible_dark.html.erb
|
637
|
-
- app/pb_kits/playbook/pb_collapsible/docs/_collapsible_dark.jsx
|
638
|
-
- app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.html.erb
|
639
|
-
- app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx
|
640
|
-
- app/pb_kits/playbook/pb_collapsible/docs/example.yml
|
641
|
-
- app/pb_kits/playbook/pb_collapsible/docs/index.js
|
642
|
-
- app/pb_kits/playbook/pb_collapsible/index.js
|
643
628
|
- app/pb_kits/playbook/pb_contact/_contact.html.erb
|
644
629
|
- app/pb_kits/playbook/pb_contact/_contact.jsx
|
645
630
|
- app/pb_kits/playbook/pb_contact/_contact.scss
|
@@ -1477,6 +1462,19 @@ files:
|
|
1477
1462
|
- app/pb_kits/playbook/pb_selectable_icon/docs/example.yml
|
1478
1463
|
- app/pb_kits/playbook/pb_selectable_icon/docs/index.js
|
1479
1464
|
- app/pb_kits/playbook/pb_selectable_icon/selectable_icon.rb
|
1465
|
+
- app/pb_kits/playbook/pb_selectable_list/_item.jsx
|
1466
|
+
- app/pb_kits/playbook/pb_selectable_list/_selectable_list.html.erb
|
1467
|
+
- app/pb_kits/playbook/pb_selectable_list/_selectable_list.jsx
|
1468
|
+
- app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss
|
1469
|
+
- app/pb_kits/playbook/pb_selectable_list/_selectable_list_item.html.erb
|
1470
|
+
- app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_checkbox.html.erb
|
1471
|
+
- app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_checkbox.jsx
|
1472
|
+
- app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_radio.html.erb
|
1473
|
+
- app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_radio.jsx
|
1474
|
+
- app/pb_kits/playbook/pb_selectable_list/docs/example.yml
|
1475
|
+
- app/pb_kits/playbook/pb_selectable_list/docs/index.js
|
1476
|
+
- app/pb_kits/playbook/pb_selectable_list/selectable_list.rb
|
1477
|
+
- app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb
|
1480
1478
|
- app/pb_kits/playbook/pb_source/_source.html.erb
|
1481
1479
|
- app/pb_kits/playbook/pb_source/_source.jsx
|
1482
1480
|
- app/pb_kits/playbook/pb_source/_source.scss
|
@@ -1885,7 +1883,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1885
1883
|
- !ruby/object:Gem::Version
|
1886
1884
|
version: 1.3.1
|
1887
1885
|
requirements: []
|
1888
|
-
|
1886
|
+
rubyforge_project:
|
1887
|
+
rubygems_version: 2.7.3
|
1889
1888
|
signing_key:
|
1890
1889
|
specification_version: 4
|
1891
1890
|
summary: Playbook Design System
|
@@ -1,142 +0,0 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
|
-
import classnames from 'classnames'
|
4
|
-
import { get } from 'lodash'
|
5
|
-
import { Flex, FlexItem } from '../'
|
6
|
-
import React, { useState } from 'react'
|
7
|
-
import AnimateHeight from 'react-animate-height'
|
8
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
9
|
-
import { globalProps } from '../utilities/globalProps.js'
|
10
|
-
|
11
|
-
type CollapsibleProps = {
|
12
|
-
children: React.ChildrenArray<React.Element<typeof Main | Content>>,
|
13
|
-
aria?: object,
|
14
|
-
className?: string,
|
15
|
-
data?: object,
|
16
|
-
id?: string,
|
17
|
-
}
|
18
|
-
|
19
|
-
type CollapsibleMainProps = {
|
20
|
-
children: array<React.ReactNode> | React.ReactNode,
|
21
|
-
className?: string,
|
22
|
-
padding?: string,
|
23
|
-
}
|
24
|
-
|
25
|
-
type CollapsibleContentProps = {
|
26
|
-
children: array<React.ReactNode> | React.ReactNode | string,
|
27
|
-
className?: string,
|
28
|
-
padding?: string,
|
29
|
-
}
|
30
|
-
|
31
|
-
const Main = (props: CollapsibleMainProps) => {
|
32
|
-
const { children, className, padding = 'sm' } = props
|
33
|
-
const mainCSS = buildCss('pb_collapsible_main_kit')
|
34
|
-
const mainSpacing = globalProps(props, { padding })
|
35
|
-
|
36
|
-
return (
|
37
|
-
<div className={classnames(mainCSS, className, mainSpacing)}>
|
38
|
-
{children}
|
39
|
-
</div>
|
40
|
-
)
|
41
|
-
}
|
42
|
-
|
43
|
-
const Content = (props: CollapsibleContentProps) => {
|
44
|
-
const { children, className, padding = 'md' } = props
|
45
|
-
const contentCSS = buildCss('pb_collapsible_content_kit')
|
46
|
-
const contentSpacing = globalProps(props, { padding })
|
47
|
-
|
48
|
-
return (
|
49
|
-
<div className={classnames(contentCSS, className, contentSpacing)}>
|
50
|
-
{children}
|
51
|
-
</div>
|
52
|
-
)
|
53
|
-
}
|
54
|
-
|
55
|
-
const Collapsible = (props: CollapsibleProps) => {
|
56
|
-
const {
|
57
|
-
aria = {},
|
58
|
-
className,
|
59
|
-
children = [],
|
60
|
-
data = {},
|
61
|
-
id,
|
62
|
-
} = props
|
63
|
-
|
64
|
-
const ariaProps = buildAriaProps(aria)
|
65
|
-
const dataProps = buildDataProps(data)
|
66
|
-
const classes = classnames(buildCss('pb_collapsible'), className, globalProps(props))
|
67
|
-
|
68
|
-
const [height, setHeight] = useState(0)
|
69
|
-
const toggleExpand = () => {
|
70
|
-
setHeight(height === 0 ? 'auto' : 0)
|
71
|
-
}
|
72
|
-
|
73
|
-
const collapsibleChildren =
|
74
|
-
typeof children === 'object' && children.length ? children : [children]
|
75
|
-
|
76
|
-
const subComponentTags = (tagName) => {
|
77
|
-
return collapsibleChildren.filter((c) => (
|
78
|
-
get(c, 'type.name') === tagName
|
79
|
-
)).map((child, i) => {
|
80
|
-
return React.cloneElement(child, { key: `${tagName.toLowerCase()}-${i}` })
|
81
|
-
})
|
82
|
-
}
|
83
|
-
|
84
|
-
const renderChevron = (height) => {
|
85
|
-
const direction = height === 0 ? 'down' : 'up'
|
86
|
-
|
87
|
-
return (
|
88
|
-
<div
|
89
|
-
key={direction}
|
90
|
-
style={{ verticalAlign: 'middle' }}
|
91
|
-
>
|
92
|
-
<i className={`far fa-2x fa-chevron-${direction} fa-fw`} />
|
93
|
-
</div>
|
94
|
-
)
|
95
|
-
}
|
96
|
-
|
97
|
-
const renderMain = () => {
|
98
|
-
const mainTags = subComponentTags('Main')
|
99
|
-
|
100
|
-
return (
|
101
|
-
<div onClick={toggleExpand}>
|
102
|
-
<Flex
|
103
|
-
spacing="between"
|
104
|
-
vertical="center"
|
105
|
-
>
|
106
|
-
<FlexItem>{mainTags}</FlexItem>
|
107
|
-
<FlexItem>{renderChevron(height)}</FlexItem>
|
108
|
-
</Flex>
|
109
|
-
</div>
|
110
|
-
|
111
|
-
)
|
112
|
-
}
|
113
|
-
|
114
|
-
const renderContent = () => {
|
115
|
-
const nonMainChildren = collapsibleChildren.filter((child) => (get(child, 'type.name') !== 'Main'))
|
116
|
-
return (
|
117
|
-
<AnimateHeight
|
118
|
-
duration={500}
|
119
|
-
height={height}
|
120
|
-
id="bottom-section"
|
121
|
-
>
|
122
|
-
{nonMainChildren}
|
123
|
-
</AnimateHeight>
|
124
|
-
)
|
125
|
-
}
|
126
|
-
|
127
|
-
return (
|
128
|
-
<div
|
129
|
-
{...ariaProps}
|
130
|
-
{...dataProps}
|
131
|
-
className={classes}
|
132
|
-
id={id}
|
133
|
-
>
|
134
|
-
{renderMain()}
|
135
|
-
{renderContent()}
|
136
|
-
</div>
|
137
|
-
)
|
138
|
-
}
|
139
|
-
Collapsible.Main = Main
|
140
|
-
Collapsible.Content = Content
|
141
|
-
|
142
|
-
export default Collapsible
|
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
[class^=pb_collapsible_kit] {
|
3
|
-
|
4
|
-
.toggle-content {
|
5
|
-
display: none;
|
6
|
-
height: 0;
|
7
|
-
padding-bottom: 0 !important;
|
8
|
-
padding-top: 0 !important;
|
9
|
-
overflow: hidden;
|
10
|
-
transition: height 500ms, padding 500ms ease-in-out;
|
11
|
-
}
|
12
|
-
|
13
|
-
.toggle-content.is-visible {
|
14
|
-
display: block;
|
15
|
-
height: auto;
|
16
|
-
}
|
17
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<%= content_tag(:div,
|
2
|
-
id: object.id,
|
3
|
-
data: object.data,
|
4
|
-
class: object.classname,
|
5
|
-
aria: object.aria) do %>
|
6
|
-
|
7
|
-
<%= pb_rails("flex", props: {vertical: "center", spacing: "between"}) do %>
|
8
|
-
<%= pb_rails("flex/flex_item") do %>
|
9
|
-
<%= capture(&object.children) %>
|
10
|
-
<% end %>
|
11
|
-
<%= pb_rails("flex/flex_item") do %>
|
12
|
-
<i class="far fa-chevron-down fa-2x"></i>
|
13
|
-
<i class="far fa-chevron-up fa-2x" style="display: none"></i>
|
14
|
-
<% end %>
|
15
|
-
<% end %>
|
16
|
-
<% end %>
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module PbCollapsible
|
5
|
-
class CollapsibleContent
|
6
|
-
include Playbook::Props
|
7
|
-
|
8
|
-
partial "pb_collapsible/child_kits/collapsible_content"
|
9
|
-
|
10
|
-
def data
|
11
|
-
Hash(values[:data]).merge(
|
12
|
-
collapsible_content: true
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def classname
|
17
|
-
generate_classname("pb_collapsible_content_kit", "toggle-content", padding, separator: " ")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module PbCollapsible
|
5
|
-
class CollapsibleMain
|
6
|
-
include Playbook::Props
|
7
|
-
|
8
|
-
partial "pb_collapsible/child_kits/collapsible_main"
|
9
|
-
|
10
|
-
def data
|
11
|
-
Hash(values[:data]).merge(
|
12
|
-
collapsible_main: true
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def classname
|
17
|
-
generate_classname("pb_collapsible_main_kit", padding, separator: " ")
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%= pb_rails("collapsible", props: { dark: true }) do %>
|
2
|
-
<%= pb_rails("collapsible/collapsible_main", props: { padding: "sm", name: "dark-example" }) do %>
|
3
|
-
<%= pb_rails("body", props: { text: "Main Section", dark: true}) %>
|
4
|
-
<% end %>
|
5
|
-
<%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %>
|
6
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at.
|
7
|
-
<br><br>
|
8
|
-
Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa.
|
9
|
-
<% end %>
|
10
|
-
<% end %>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { Collapsible } from '../..'
|
3
|
-
|
4
|
-
const CollapsibleDark = () => (
|
5
|
-
<div>
|
6
|
-
<Collapsible>
|
7
|
-
<Collapsible.Main>
|
8
|
-
<div>{'Main Section'}</div>
|
9
|
-
</Collapsible.Main>
|
10
|
-
<Collapsible.Content>
|
11
|
-
<div>{'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit viverra. Duis et vestibulum metus. Sed consequat ut ante non vehicula. Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo auctor eget. Curabitur in metus nec nunc rhoncus faucibus vitae ac elit. Nulla facilisi. Vestibulum quis pretium nulla. Nulla ut accumsan velit. Duis varius urna sed sem tempor, sit amet fermentum nibh auctor. Praesent lorem arcu, egestas non ante quis, placerat pellentesque lectus.Vestibulum lacinia ipsum quis venenatis tristique. Vivamus suscipit, libero eu fringilla egestas, orci urna commodo arcu, vel gravida turpis ipsum molestie nibh. Donec cursus eu ante sagittis ultrices. Phasellus id sagittis risus. Mauris dapibus neque faucibus, tempor ligula vel, cursus ante. Donec faucibus gravida porta. Nullam egestas est quis aliquam feugiat. Sed eget metus diam. Cras eget placerat libero.'}</div>
|
12
|
-
</Collapsible.Content>
|
13
|
-
</Collapsible>
|
14
|
-
</div>
|
15
|
-
)
|
16
|
-
|
17
|
-
export default CollapsibleDark
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%= pb_rails("collapsible", props: { name: "default-example" }) do %>
|
2
|
-
<%= pb_rails("collapsible/collapsible_main", props: { padding: "sm", name: "default-main" }) do %>
|
3
|
-
<%= pb_rails("body", props: { text: "Main Section"}) %>
|
4
|
-
<% end %>
|
5
|
-
<%= pb_rails("collapsible/collapsible_content", props: { padding: "md" }) do %>
|
6
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at.
|
7
|
-
<br><br>
|
8
|
-
Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa.
|
9
|
-
<% end %>
|
10
|
-
<% end %>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { Collapsible } from '../..'
|
3
|
-
|
4
|
-
const CollapsibleDefault = () => (
|
5
|
-
<div>
|
6
|
-
<Collapsible>
|
7
|
-
<Collapsible.Main>
|
8
|
-
<div>{'Main Section'}</div>
|
9
|
-
</Collapsible.Main>
|
10
|
-
<Collapsible.Content>
|
11
|
-
<div>{'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit viverra. Duis et vestibulum metus. Sed consequat ut ante non vehicula. Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo auctor eget. Curabitur in metus nec nunc rhoncus faucibus vitae ac elit. Nulla facilisi. Vestibulum quis pretium nulla. Nulla ut accumsan velit. Duis varius urna sed sem tempor, sit amet fermentum nibh auctor. Praesent lorem arcu, egestas non ante quis, placerat pellentesque lectus.Vestibulum lacinia ipsum quis venenatis tristique. Vivamus suscipit, libero eu fringilla egestas, orci urna commodo arcu, vel gravida turpis ipsum molestie nibh. Donec cursus eu ante sagittis ultrices. Phasellus id sagittis risus. Mauris dapibus neque faucibus, tempor ligula vel, cursus ante. Donec faucibus gravida porta. Nullam egestas est quis aliquam feugiat. Sed eget metus diam. Cras eget placerat libero.'}</div>
|
12
|
-
</Collapsible.Content>
|
13
|
-
</Collapsible>
|
14
|
-
</div>
|
15
|
-
)
|
16
|
-
|
17
|
-
export default CollapsibleDefault
|
@@ -1,82 +0,0 @@
|
|
1
|
-
import PbEnhancedElement from '../pb_enhanced_element'
|
2
|
-
|
3
|
-
const MAIN_SELECTOR = '[data-collapsible-main]'
|
4
|
-
const CONTENT_SELECTOR = '[data-collapsible-content]'
|
5
|
-
const DOWN_ARROW_SELECTOR = '.fa-chevron-down'
|
6
|
-
const UP_ARROW_SELECTOR = '.fa-chevron-up'
|
7
|
-
|
8
|
-
export default class PbCollapsible extends PbEnhancedElement {
|
9
|
-
static get selector() {
|
10
|
-
return MAIN_SELECTOR
|
11
|
-
}
|
12
|
-
|
13
|
-
connect() {
|
14
|
-
this.element.addEventListener('click', () => {
|
15
|
-
this.toggle(this.target)
|
16
|
-
})
|
17
|
-
this.displayDownArrow()
|
18
|
-
}
|
19
|
-
|
20
|
-
get target() {
|
21
|
-
return this.element.parentNode.querySelector(CONTENT_SELECTOR)
|
22
|
-
}
|
23
|
-
|
24
|
-
// Show an element
|
25
|
-
show(elem) {
|
26
|
-
// Get the natural height of the element
|
27
|
-
const getHeight = () => {
|
28
|
-
elem.style.display = 'block' // Make it visible
|
29
|
-
const height = elem.scrollHeight + 'px' // Get it's height
|
30
|
-
elem.style.display = '' // Hide it again
|
31
|
-
return height
|
32
|
-
}
|
33
|
-
|
34
|
-
const height = getHeight() // Get the natural height
|
35
|
-
elem.classList.add('is-visible') // Make the element visible
|
36
|
-
elem.style.height = height // Update the max-height
|
37
|
-
|
38
|
-
// Once the transition is complete, remove the inline max-height so the content can scale responsively
|
39
|
-
window.setTimeout(() => {
|
40
|
-
elem.style.height = ''
|
41
|
-
}, 500)
|
42
|
-
}
|
43
|
-
// Hide an element
|
44
|
-
hide(elem) {
|
45
|
-
// Give the element a height to change from
|
46
|
-
elem.style.height = elem.scrollHeight + 'px'
|
47
|
-
// Set the height back to 0
|
48
|
-
window.setTimeout(() => {
|
49
|
-
elem.style.height = '0'
|
50
|
-
elem.style.paddingTop = '0'
|
51
|
-
elem.style.paddingBottom = '0'
|
52
|
-
}, 1)
|
53
|
-
|
54
|
-
// When the transition is complete, hide it
|
55
|
-
window.setTimeout(() => {
|
56
|
-
elem.classList.remove('is-visible')
|
57
|
-
}, 500)
|
58
|
-
}
|
59
|
-
|
60
|
-
// Toggle element visibility
|
61
|
-
toggle(elem) {
|
62
|
-
// If the element is visible, hide it
|
63
|
-
if (elem.classList.contains('is-visible')) {
|
64
|
-
this.hide(elem)
|
65
|
-
this.displayDownArrow()
|
66
|
-
return
|
67
|
-
}
|
68
|
-
// Otherwise, show it
|
69
|
-
this.show(elem)
|
70
|
-
this.displayUpArrow()
|
71
|
-
}
|
72
|
-
|
73
|
-
displayDownArrow() {
|
74
|
-
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display = 'inline-block'
|
75
|
-
this.element.querySelector(UP_ARROW_SELECTOR).style.display = 'none'
|
76
|
-
}
|
77
|
-
|
78
|
-
displayUpArrow() {
|
79
|
-
this.element.querySelector(UP_ARROW_SELECTOR).style.display = 'inline-block'
|
80
|
-
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display = 'none'
|
81
|
-
}
|
82
|
-
}
|