playbook_ui 8.0.0.pre.alpha4 → 8.2.0.pre.alpha1
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 +8 -7
- data/app/pb_kits/playbook/data/menu.yml +1 -0
- data/app/pb_kits/playbook/index.js +1 -0
- data/app/pb_kits/playbook/pb_card/card_header.rb +7 -7
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.jsx +84 -0
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +15 -0
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx +40 -0
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.jsx +59 -0
- data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +7 -0
- data/app/pb_kits/playbook/pb_collapsible/collapsible.rb +11 -0
- data/app/pb_kits/playbook/pb_collapsible/collapsible.test.js +50 -0
- data/app/pb_kits/playbook/pb_collapsible/collapsible_content.html.erb +7 -0
- data/app/pb_kits/playbook/pb_collapsible/collapsible_content.rb +17 -0
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +16 -0
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.rb +15 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.html.erb +10 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +19 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +9 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_collapsible/index.js +79 -0
- data/app/pb_kits/playbook/pb_dashboard/commonSettings.js +2 -2
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +6 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +1 -1
- data/app/pb_kits/playbook/pb_docs/kit_example.rb +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +2 -2
- data/app/pb_kits/playbook/pb_form/form.rb +11 -2
- data/app/pb_kits/playbook/pb_form/form_builder.rb +1 -1
- data/app/pb_kits/playbook/pb_form/form_builder/action_area.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form/form_with.html.erb +7 -14
- data/app/pb_kits/playbook/pb_form/form_with.rb +13 -6
- data/app/pb_kits/playbook/pb_nav/_item.jsx +2 -0
- data/app/pb_kits/playbook/pb_nav/_nav.jsx +2 -2
- data/app/pb_kits/playbook/pb_nav/item.html.erb +2 -2
- data/app/pb_kits/playbook/pb_nav/nav.html.erb +1 -1
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +1 -1
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.scss +5 -0
- data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_variants.html.erb +5 -0
- data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_variants.jsx +7 -0
- data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_variants.md +1 -1
- data/app/pb_kits/playbook/pb_progress_simple/progress_simple.rb +1 -1
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx +43 -26
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.scss +18 -0
- data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_default.html.erb +18 -5
- data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_default.jsx +10 -5
- data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +7 -3
- data/app/pb_kits/playbook/pb_time_stacked/time_stacked.rb +8 -30
- data/app/pb_kits/playbook/pb_time_stacked/time_stacked.test.js +33 -0
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +4 -3
- data/app/pb_kits/playbook/plugins/pb_chart.js +1 -1
- data/app/pb_kits/playbook/tokens/_border_radius.scss +0 -10
- data/app/pb_kits/playbook/tokens/_colors.scss +0 -25
- data/app/pb_kits/playbook/tokens/_line_height.scss +0 -9
- data/app/pb_kits/playbook/tokens/_opacity.scss +0 -9
- data/app/pb_kits/playbook/tokens/_positioning.scss +0 -9
- data/app/pb_kits/playbook/tokens/_screen_sizes.scss +0 -9
- data/app/pb_kits/playbook/tokens/_shadows.scss +0 -9
- data/app/pb_kits/playbook/tokens/_spacing.scss +0 -10
- data/app/pb_kits/playbook/tokens/_typography.scss +0 -25
- data/app/pb_kits/playbook/tokens/exports/_border_radius.scss +10 -0
- data/app/pb_kits/playbook/tokens/exports/_colors.scss +26 -0
- data/app/pb_kits/playbook/tokens/exports/_line_height.scss +10 -0
- data/app/pb_kits/playbook/tokens/exports/_opacity.scss +10 -0
- data/app/pb_kits/playbook/tokens/exports/_positioning.scss +10 -0
- data/app/pb_kits/playbook/tokens/exports/_screen_sizes.scss +10 -0
- data/app/pb_kits/playbook/tokens/exports/_shadows.scss +10 -0
- data/app/pb_kits/playbook/tokens/exports/_spacing.scss +10 -0
- data/app/pb_kits/playbook/tokens/exports/_typography.scss +24 -0
- data/app/pb_kits/playbook/vendor.js +3 -0
- data/dist/reset.css +1 -0
- data/lib/playbook/pb_doc_helper.rb +4 -0
- data/lib/playbook/props/base.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +39 -14
- data/app/pb_kits/playbook/pb_form/form.html.erb +0 -7
@@ -0,0 +1 @@
|
|
1
|
+
export { default as CollapsibleDefault } from './_collapsible_default.jsx'
|
@@ -0,0 +1,79 @@
|
|
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.toggleElement(this.target)
|
16
|
+
})
|
17
|
+
this.displayDownArrow()
|
18
|
+
}
|
19
|
+
|
20
|
+
get target() {
|
21
|
+
return this.element.parentNode.querySelector(CONTENT_SELECTOR)
|
22
|
+
}
|
23
|
+
|
24
|
+
showElement(elem) {
|
25
|
+
// Get the natural height of the element
|
26
|
+
const getHeight = () => {
|
27
|
+
elem.style.display = 'block'
|
28
|
+
const height = elem.scrollHeight + 'px' // Get it's height
|
29
|
+
elem.style.display = '' // Hide it again
|
30
|
+
return height
|
31
|
+
}
|
32
|
+
|
33
|
+
const height = getHeight()
|
34
|
+
elem.classList.add('is-visible')
|
35
|
+
elem.style.height = height // Update the max-height
|
36
|
+
|
37
|
+
// Once the transition is complete, remove the inline max-height so the content can scale responsively
|
38
|
+
window.setTimeout(() => {
|
39
|
+
elem.style.height = ''
|
40
|
+
}, 300)
|
41
|
+
}
|
42
|
+
|
43
|
+
hideElement(elem) {
|
44
|
+
// Give the element a height to change from
|
45
|
+
elem.style.height = elem.scrollHeight + 'px'
|
46
|
+
|
47
|
+
window.setTimeout(() => {
|
48
|
+
elem.style.height = '0'
|
49
|
+
elem.style.paddingTop = '0'
|
50
|
+
elem.style.paddingBottom = '0'
|
51
|
+
}, 1)
|
52
|
+
|
53
|
+
// When the transition is complete, hide it
|
54
|
+
window.setTimeout(() => {
|
55
|
+
elem.classList.remove('is-visible')
|
56
|
+
}, 300)
|
57
|
+
}
|
58
|
+
|
59
|
+
toggleElement(elem) {
|
60
|
+
if (elem.classList.contains('is-visible')) {
|
61
|
+
this.hideElement(elem)
|
62
|
+
this.displayDownArrow()
|
63
|
+
return
|
64
|
+
}
|
65
|
+
// Otherwise, show it
|
66
|
+
this.showElement(elem)
|
67
|
+
this.displayUpArrow()
|
68
|
+
}
|
69
|
+
|
70
|
+
displayDownArrow() {
|
71
|
+
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display = 'inline-block'
|
72
|
+
this.element.querySelector(UP_ARROW_SELECTOR).style.display = 'none'
|
73
|
+
}
|
74
|
+
|
75
|
+
displayUpArrow() {
|
76
|
+
this.element.querySelector(UP_ARROW_SELECTOR).style.display = 'inline-block'
|
77
|
+
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display = 'none'
|
78
|
+
}
|
79
|
+
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
import React from 'react'
|
4
4
|
import { DateStacked, Flex, FlexItem, TimeStacked } from '../'
|
5
|
+
import { buildDataProps } from '../utilities/props'
|
5
6
|
import { globalProps } from '../utilities/globalProps.js'
|
6
7
|
|
7
8
|
type DateTimeStackedProps = {
|
@@ -12,12 +13,15 @@ type DateTimeStackedProps = {
|
|
12
13
|
}
|
13
14
|
|
14
15
|
const DateTimeStacked = (props: DateTimeStackedProps) => {
|
15
|
-
const { date, dark } = props
|
16
|
+
const { date, data = {}, dark } = props,
|
17
|
+
dataProps = buildDataProps(data)
|
18
|
+
|
16
19
|
return (
|
17
20
|
<Flex
|
18
21
|
className={globalProps(props)}
|
19
22
|
orientation="row"
|
20
23
|
vertical="center"
|
24
|
+
{...dataProps}
|
21
25
|
>
|
22
26
|
<FlexItem>
|
23
27
|
<DateStacked
|
@@ -32,8 +36,8 @@ const DateTimeStacked = (props: DateTimeStackedProps) => {
|
|
32
36
|
<TimeStacked
|
33
37
|
className="pb_date_time_stacked_kit"
|
34
38
|
dark={dark}
|
35
|
-
date={date}
|
36
39
|
tag="caption"
|
40
|
+
time={date}
|
37
41
|
/>
|
38
42
|
</FlexItem>
|
39
43
|
</Flex>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<%= pb_rails("date_stacked", props: { align: "right", date: object.date, reverse: true, size: "sm", dark: object.dark }) %>
|
8
8
|
<% end %>
|
9
9
|
<%= pb_rails("flex/flex_item") do %>
|
10
|
-
<%= pb_rails("time_stacked", props: { classname: "pb_date_time_stacked_kit",
|
10
|
+
<%= pb_rails("time_stacked", props: { classname: "pb_date_time_stacked_kit", time: object.date, tag: "caption" }) %>
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
13
13
|
<% end %>
|
@@ -13,8 +13,8 @@
|
|
13
13
|
]
|
14
14
|
%>
|
15
15
|
|
16
|
-
<%= pb_rails("form", props: {
|
17
|
-
|
16
|
+
<%= pb_rails("form/form_with", props: {
|
17
|
+
scope: :example, method: :get, url: "",
|
18
18
|
validate: true
|
19
19
|
}) do |form| %>
|
20
20
|
<%= form.text_field :example_text_field, props: { label: true, required: true } %>
|
@@ -19,8 +19,17 @@ module Playbook
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def render_in(view_context, &
|
23
|
-
|
22
|
+
def render_in(view_context, &block)
|
23
|
+
form_kit.render_in(view_context, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def form_kit
|
29
|
+
@form_system ||= begin
|
30
|
+
::Playbook::KitResolver.resolve("form/#{form_system}")
|
31
|
+
.new(options: form_system_options, validate: validate, children: children)
|
32
|
+
end
|
24
33
|
end
|
25
34
|
end
|
26
35
|
end
|
@@ -21,7 +21,7 @@ module Playbook
|
|
21
21
|
prepend(DatePickerField)
|
22
22
|
|
23
23
|
def actions(&block)
|
24
|
-
@template.render_component ActionArea.new(submit_default_value: submit_default_value
|
24
|
+
@template.render_component ActionArea.new(submit_default_value: submit_default_value, children: block)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -1,18 +1,11 @@
|
|
1
|
-
<%= form_with(
|
2
|
-
aria: aria,
|
3
|
-
class: classname,
|
4
|
-
data: data,
|
5
|
-
builder: form_builder,
|
6
|
-
**options) do |form| %>
|
7
|
-
<% instance_exec form, &children %>
|
1
|
+
<%= form_with(form_options, &method(:render_form)) %>
|
8
2
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
<% end %>
|
3
|
+
<% if validate %>
|
4
|
+
<% content_for :pb_js do %>
|
5
|
+
<%= javascript_tag do %>
|
6
|
+
window.addEventListener('DOMContentLoaded', function() {
|
7
|
+
PbFormValidation.start()
|
8
|
+
})
|
16
9
|
<% end %>
|
17
10
|
<% end %>
|
18
11
|
<% end %>
|
@@ -14,16 +14,23 @@ module Playbook
|
|
14
14
|
prop(:data).merge("pb-form-validation" => validate)
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
{
|
17
|
+
def form_options
|
18
|
+
{
|
19
|
+
url: "",
|
20
|
+
id: id,
|
21
|
+
aria: aria,
|
22
|
+
class: classname,
|
23
|
+
data: data,
|
24
|
+
builder: ::Playbook::PbForm::FormWith::FormBuilder,
|
25
|
+
}.merge(options)
|
19
26
|
end
|
20
27
|
|
21
|
-
def
|
22
|
-
|
28
|
+
def render_form(builder)
|
29
|
+
view_context.capture(builder, &children)
|
23
30
|
end
|
24
31
|
|
25
|
-
def
|
26
|
-
|
32
|
+
def classname
|
33
|
+
[generate_classname("pb-form"), options[:class]].join(" ")
|
27
34
|
end
|
28
35
|
|
29
36
|
def render_in(view_context, &_block)
|
@@ -75,6 +75,7 @@ const NavItem = (props: NavItemProps) => {
|
|
75
75
|
key={iconLeft}
|
76
76
|
>
|
77
77
|
<Icon
|
78
|
+
aria={{ label: iconLeft }}
|
78
79
|
className="pb_nav_list_item_icon_left"
|
79
80
|
fixedWidth
|
80
81
|
icon={iconLeft}
|
@@ -90,6 +91,7 @@ const NavItem = (props: NavItemProps) => {
|
|
90
91
|
key={iconRight}
|
91
92
|
>
|
92
93
|
<Icon
|
94
|
+
aria={{ label: iconRight }}
|
93
95
|
className="pb_nav_list_item_icon_right"
|
94
96
|
fixedWidth
|
95
97
|
icon={iconRight}
|
@@ -48,7 +48,7 @@ const Nav = (props: NavProps) => {
|
|
48
48
|
)
|
49
49
|
|
50
50
|
return (
|
51
|
-
<
|
51
|
+
<nav
|
52
52
|
{...ariaProps}
|
53
53
|
{...dataProps}
|
54
54
|
className={cardCss}
|
@@ -69,7 +69,7 @@ const Nav = (props: NavProps) => {
|
|
69
69
|
</div>
|
70
70
|
</If>
|
71
71
|
<ul>{children}</ul>
|
72
|
-
</
|
72
|
+
</nav>
|
73
73
|
)
|
74
74
|
}
|
75
75
|
|
@@ -9,13 +9,13 @@
|
|
9
9
|
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
|
10
10
|
<% end %>
|
11
11
|
<% if object.icon_left %>
|
12
|
-
<%= pb_rails("icon", props: { icon: object.icon_left, classname: "pb_nav_list_item_icon_left", fixed_width: true}) %>
|
12
|
+
<%= pb_rails("icon", props: { aria: { label: object.icon_left }, icon: object.icon_left, classname: "pb_nav_list_item_icon_left", fixed_width: true}) %>
|
13
13
|
<% end %>
|
14
14
|
<span class="pb_nav_list_item_text">
|
15
15
|
<%= object.text %><%= content.presence %>
|
16
16
|
</span>
|
17
17
|
<% if object.icon_right %>
|
18
|
-
<%= pb_rails("icon", props: { icon: object.icon_right, classname: "pb_nav_list_item_icon_right", fixed_width: true}) %>
|
18
|
+
<%= pb_rails("icon", props: { aria: { label: object.icon_right }, icon: object.icon_right, classname: "pb_nav_list_item_icon_right", fixed_width: true}) %>
|
19
19
|
<% end %>
|
20
20
|
<% end %>
|
21
21
|
<% end %>
|
@@ -1 +1 @@
|
|
1
|
-
Progress Simple can pass colors - primary, green and
|
1
|
+
Progress Simple can pass colors - primary, green, red, and yellow. Variants names are `default`, `positive`, `negative`, and `warning`, respectively.
|
@@ -18,7 +18,7 @@ module Playbook
|
|
18
18
|
# could this possibly be [sm, md, lg]?
|
19
19
|
prop :width, default: "100%"
|
20
20
|
prop :variant, type: Playbook::Props::Enum,
|
21
|
-
values: %w[default positive negative],
|
21
|
+
values: %w[default positive negative warning],
|
22
22
|
default: "default"
|
23
23
|
|
24
24
|
def number_value
|
@@ -4,50 +4,67 @@ import React from 'react'
|
|
4
4
|
import classnames from 'classnames'
|
5
5
|
|
6
6
|
import DateTime from '../pb_kit/dateTime.js'
|
7
|
-
import { buildCss } from '../utilities/props'
|
8
|
-
import { Body, Caption } from '../'
|
7
|
+
import { buildCss, buildDataProps } from '../utilities/props'
|
9
8
|
import { deprecatedProps, globalProps } from '../utilities/globalProps.js'
|
10
9
|
|
10
|
+
import { Body, Caption } from '../'
|
11
|
+
|
11
12
|
type TimeStackedProps = {
|
12
13
|
align?: 'left' | 'center' | 'right',
|
13
14
|
className?: string | array<string>,
|
14
15
|
dark?: boolean,
|
15
|
-
data?:
|
16
|
-
date
|
16
|
+
data?: object,
|
17
|
+
date?: string,
|
17
18
|
id?: string,
|
18
|
-
|
19
|
+
time: number | Date,
|
20
|
+
timeZone?: string,
|
19
21
|
}
|
20
22
|
|
21
|
-
const
|
22
|
-
|
23
|
-
|
23
|
+
const TimeStackedDefault = (props: TimeStackedProps) => {
|
24
|
+
if (props.date) deprecatedProps('Time Stacked', ['date']) //date prop is deprecated, use time instead
|
25
|
+
|
26
|
+
const {
|
27
|
+
align = 'left',
|
28
|
+
className,
|
29
|
+
dark,
|
30
|
+
data = {},
|
31
|
+
date,
|
32
|
+
time,
|
33
|
+
timeZone,
|
34
|
+
} = props
|
35
|
+
|
24
36
|
const classes = classnames(
|
25
37
|
buildCss('pb_time_stacked_kit', align),
|
26
38
|
globalProps(props),
|
27
|
-
className
|
39
|
+
className
|
28
40
|
)
|
41
|
+
const dataProps = buildDataProps(data)
|
29
42
|
|
30
|
-
const dateTimestamp = new DateTime({ value: date })
|
43
|
+
const dateTimestamp = new DateTime({ value: date ? date : new Date(time), zone: timeZone })
|
31
44
|
|
32
45
|
return (
|
33
|
-
<div
|
34
|
-
|
35
|
-
|
36
|
-
|
46
|
+
<div
|
47
|
+
className={classes}
|
48
|
+
{...dataProps}
|
49
|
+
>
|
50
|
+
<Body
|
51
|
+
className={classnames('pb_time_stacked', 'time-spacing')}
|
52
|
+
color="light"
|
53
|
+
dark={dark}
|
37
54
|
>
|
38
|
-
<
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
</
|
55
|
+
<time>
|
56
|
+
{dateTimestamp.toTimeWithMeridian()}
|
57
|
+
<Caption
|
58
|
+
className="pb_time_stacked"
|
59
|
+
color="light"
|
60
|
+
dark={dark}
|
61
|
+
tag="span"
|
62
|
+
text={dateTimestamp.toTimezone()}
|
63
|
+
/>
|
64
|
+
</time>
|
65
|
+
</Body>
|
49
66
|
</div>
|
50
67
|
)
|
51
68
|
}
|
52
69
|
|
53
|
-
export default
|
70
|
+
export default TimeStackedDefault
|