playbook_ui 10.16.0 → 10.19.0.pre.popover.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 +4 -0
- data/app/pb_kits/playbook/pb_background/background.test.js +22 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +3 -0
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +3 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.html.erb +26 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +37 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.md +2 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_body/_body.jsx +1 -1
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +2 -1
- data/app/pb_kits/playbook/pb_body/body.rb +1 -1
- data/app/pb_kits/playbook/pb_body/body.test.js +29 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.html.erb +5 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +5 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.md +6 -0
- data/app/pb_kits/playbook/pb_button/_button.jsx +3 -3
- data/app/pb_kits/playbook/pb_button/_button.scss +17 -0
- data/app/pb_kits/playbook/pb_button/button.rb +6 -3
- data/app/pb_kits/playbook/pb_button/button.test.js +13 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +26 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.md +1 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +21 -8
- data/app/pb_kits/playbook/pb_caption/_caption.scss +14 -8
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +27 -0
- data/app/pb_kits/playbook/pb_caption/caption.rb +6 -4
- data/app/pb_kits/playbook/pb_caption/caption.test.js +29 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.html.erb +3 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.jsx +25 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.md +6 -0
- data/app/pb_kits/playbook/pb_caption/docs/example.yml +7 -4
- data/app/pb_kits/playbook/pb_caption/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_card/_card.jsx +1 -3
- data/app/pb_kits/playbook/pb_card/_card.scss +0 -6
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -8
- data/app/pb_kits/playbook/pb_card/card.html.erb +2 -0
- data/app/pb_kits/playbook/pb_card/card.rb +0 -8
- data/app/pb_kits/playbook/pb_card/docs/_card_background.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_content.html.erb +3 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_content.jsx +9 -2
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +4 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.md +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +3 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +13 -4
- data/app/pb_kits/playbook/pb_docs/kit_example.rb +4 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +4 -0
- data/app/pb_kits/playbook/pb_flex/_flex.jsx +4 -0
- data/app/pb_kits/playbook/pb_flex/_flex.scss +17 -1
- data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +6 -2
- data/app/pb_kits/playbook/pb_flex/_flex_item.scss +22 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item.html.erb +12 -1
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item.md +2 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_align_self.html.erb +89 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_align_self.jsx +210 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_align_self.md +5 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_example.jsx +27 -0
- data/app/pb_kits/playbook/pb_flex/docs/_flex_item_example.md +2 -0
- data/app/pb_kits/playbook/pb_flex/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_flex/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_flex/flex.rb +14 -1
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +16 -1
- data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +3 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.html.erb +12 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.jsx +19 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.md +2 -0
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +2 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +4 -0
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +2 -2
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.md +1 -0
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.rb +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.rb +2 -0
- data/app/pb_kits/playbook/pb_image/_image.jsx +4 -1
- data/app/pb_kits/playbook/pb_image/_image.scss +24 -8
- data/app/pb_kits/playbook/pb_image/docs/_transition_image.html.erb +54 -0
- data/app/pb_kits/playbook/pb_image/docs/_transition_image.jsx +77 -0
- data/app/pb_kits/playbook/pb_image/docs/_transition_image.md +1 -0
- data/app/pb_kits/playbook/pb_image/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_image/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_image/image.html.erb +1 -1
- data/app/pb_kits/playbook/pb_image/image.rb +8 -1
- data/app/pb_kits/playbook/pb_image/image.test.js +9 -4
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +4 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.html.erb +26 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx +37 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.md +2 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +3 -0
- data/app/pb_kits/playbook/pb_list/list.rb +2 -0
- data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +22 -0
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +17 -1
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +9 -2
- data/app/pb_kits/playbook/pb_nav/docs/_bold_horizontal_nav.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_horizontal_nav.jsx +39 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_vertical_nav.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_vertical_nav.jsx +39 -0
- data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_subtle_nav.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_nav/nav.rb +1 -1
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +2 -4
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
- data/app/pb_kits/playbook/pb_popover/docs/_popover_scroll_height.jsx +3 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx +1 -0
- data/app/pb_kits/playbook/pb_popover/index.js +4 -9
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
- data/app/pb_kits/playbook/pb_select/select.rb +3 -0
- data/app/pb_kits/playbook/pb_source/source.rb +3 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +63 -14
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.html.erb +21 -2
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.jsx +12 -3
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -0
- data/app/pb_kits/playbook/pb_title/_title.jsx +6 -4
- data/app/pb_kits/playbook/pb_title/_title.scss +5 -5
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +17 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.html.erb +4 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.jsx +37 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.md +6 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_light.html.erb +4 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_light.md +3 -0
- data/app/pb_kits/playbook/pb_title/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_title/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_title/title.html.erb +4 -2
- data/app/pb_kits/playbook/pb_title/title.rb +5 -4
- data/app/pb_kits/playbook/pb_title/title.test.js +29 -0
- data/app/pb_kits/playbook/plugins/pb_chart.js +16 -24
- data/app/pb_kits/playbook/tokens/_colors.scss +3 -1
- data/app/pb_kits/playbook/utilities/_cursor.scss +3 -0
- data/app/pb_kits/playbook/utilities/_display.scss +23 -0
- data/app/pb_kits/playbook/utilities/_line_height.scss +11 -0
- data/app/pb_kits/playbook/utilities/_shadow.scss +11 -0
- data/app/pb_kits/playbook/utilities/globalProps.js +25 -1
- data/lib/playbook/classnames.rb +4 -0
- data/lib/playbook/cursor.rb +29 -0
- data/lib/playbook/display.rb +29 -0
- data/lib/playbook/engine.rb +0 -1
- data/lib/playbook/kit_base.rb +8 -0
- data/lib/playbook/line_height.rb +29 -0
- data/lib/playbook/markdown/helper.rb +2 -2
- data/lib/playbook/pb_doc_helper.rb +4 -0
- data/lib/playbook/props/base.rb +2 -2
- data/lib/playbook/shadow.rb +29 -0
- data/lib/playbook/version.rb +2 -2
- data/lib/playbook.rb +3 -0
- metadata +62 -23
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.html.erb +0 -1
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.jsx +0 -17
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.md +0 -3
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.html.erb +0 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.jsx +0 -19
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.md +0 -3
@@ -1,7 +1,10 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
|
-
|
4
|
-
|
3
|
+
- caption_light: Default
|
4
|
+
- caption_block: Block
|
5
|
+
- caption_colors: Colors
|
6
|
+
|
5
7
|
react:
|
6
|
-
|
7
|
-
|
8
|
+
- caption_light: Default
|
9
|
+
- caption_block: Block
|
10
|
+
- caption_colors: Colors
|
@@ -20,7 +20,6 @@ type CardPropTypes = {
|
|
20
20
|
},
|
21
21
|
padding?: string,
|
22
22
|
selected?: boolean,
|
23
|
-
shadow?: "none" | "deep" | "deeper" | "deepest",
|
24
23
|
tag?: "div" | "section" | "footer" | "header" | "article" | "aside" | "main" | "nav",
|
25
24
|
}
|
26
25
|
|
@@ -75,14 +74,13 @@ const Card = (props: CardPropTypes) => {
|
|
75
74
|
data = {},
|
76
75
|
highlight = {},
|
77
76
|
selected = false,
|
78
|
-
shadow = 'none',
|
79
77
|
tag = 'div',
|
80
78
|
padding = 'md',
|
81
79
|
} = props
|
82
80
|
const borderCSS = borderNone == true ? 'border_none' : ''
|
83
81
|
const selectedCSS = selected == true ? 'selected' : 'deselected'
|
84
82
|
const backgroundCSS = background == 'none' ? '' : `background_${background}`
|
85
|
-
const cardCss = buildCss('pb_card_kit', selectedCSS,
|
83
|
+
const cardCss = buildCss('pb_card_kit', selectedCSS, borderCSS, `border_radius_${borderRadius}`, backgroundCSS, {
|
86
84
|
[`highlight_${highlight.position}`]: highlight.position,
|
87
85
|
[`highlight_${highlight.color}`]: highlight.color,
|
88
86
|
})
|
@@ -11,14 +11,7 @@ $pb_card_highlight_colors: map-merge(map-merge($status_colors, $product_colors),
|
|
11
11
|
$pb_card_highlight_size: 4px;
|
12
12
|
$pb_card_header_colors: map-merge($category_colors, $product_colors);
|
13
13
|
$pb_card_header_border_radius: $border_rad_heavy;
|
14
|
-
|
15
|
-
none: 0,
|
16
|
-
xs: $space_xs,
|
17
|
-
sm: $space_sm,
|
18
|
-
md: $space_md,
|
19
|
-
lg: $space_lg,
|
20
|
-
xl: $space_xl,
|
21
|
-
);
|
14
|
+
|
22
15
|
$additional_colors: (
|
23
16
|
"dark": $bg_dark,
|
24
17
|
"light": $bg_light,
|
@@ -4,9 +4,6 @@ module Playbook
|
|
4
4
|
module PbCard
|
5
5
|
class Card < Playbook::KitBase
|
6
6
|
prop :selected, type: Playbook::Props::Boolean, default: false
|
7
|
-
prop :shadow, type: Playbook::Props::Enum,
|
8
|
-
values: %w[none deep deeper deepest],
|
9
|
-
default: "none"
|
10
7
|
prop :highlight, type: Playbook::Props::Hash,
|
11
8
|
default: {}
|
12
9
|
prop :tag, type: Playbook::Props::Enum,
|
@@ -24,7 +21,6 @@ module Playbook
|
|
24
21
|
def classname
|
25
22
|
generate_classname("pb_card_kit",
|
26
23
|
selected_class,
|
27
|
-
shadow_class,
|
28
24
|
border_class,
|
29
25
|
border_radius_class,
|
30
26
|
background_class,
|
@@ -46,10 +42,6 @@ module Playbook
|
|
46
42
|
selected ? "selected" : "deselected"
|
47
43
|
end
|
48
44
|
|
49
|
-
def shadow_class
|
50
|
-
shadow != "none" ? "shadow_#{shadow}" : nil
|
51
|
-
end
|
52
|
-
|
53
45
|
def highlight_position_class
|
54
46
|
highlight[:position].present? ? "highlight_#{highlight[:position]}" : nil
|
55
47
|
end
|
@@ -5,9 +5,16 @@ import Card from '../_card'
|
|
5
5
|
const CardContent = (props) => {
|
6
6
|
return (
|
7
7
|
<div>
|
8
|
-
<Card
|
8
|
+
<Card
|
9
|
+
cursor="pointer"
|
10
|
+
{...props}
|
11
|
+
>
|
12
|
+
{'Card content'}
|
13
|
+
</Card>
|
9
14
|
<br />
|
10
|
-
<Card
|
15
|
+
<Card
|
16
|
+
{...props}
|
17
|
+
>
|
11
18
|
{`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.
|
12
19
|
|
13
20
|
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.`}
|
@@ -1,3 +1,5 @@
|
|
1
1
|
The `defaultDate`/`default_date` prop has a null or empty string value by default. You can pass an ISO date string (preferred rails method) or date object (preferred JS method) if you want a default value on page load. Use Ruby UTC DateTime objects and convert them to ISO date strings with `DateTime.now.utc.iso8601`.
|
2
2
|
|
3
|
-
If you use a Date object without UTC time standardization the Date Picker kit may misinterpret that date as yesterdays date (consequence of timezone differentials and the Javascript Date Object constructor). See [this GitHub issue for more information](https://github.com/powerhome/playbook/issues/1167) and the anti-pattern examples below.
|
3
|
+
If you use a Date object without UTC time standardization the Date Picker kit may misinterpret that date as yesterdays date (consequence of timezone differentials and the Javascript Date Object constructor). See [this GitHub issue for more information](https://github.com/powerhome/playbook/issues/1167) and the anti-pattern examples below.
|
4
|
+
|
5
|
+
|
@@ -2,10 +2,19 @@ import { ensureAccessible, renderKit } from '../utilities/test-utils'
|
|
2
2
|
import { DateTimeStacked } from '../'
|
3
3
|
|
4
4
|
/* eslint-disable jsx-control-statements/jsx-jcs-no-undef */
|
5
|
+
const currentDate = new Date()
|
6
|
+
|
7
|
+
const datetime = new Date('Wed Mar 31 2021 12:00:00 GMT-0500'),
|
8
|
+
monthName = datetime.toLocaleString('en-US', { month: 'short' }),
|
9
|
+
day = datetime.getDate(),
|
10
|
+
fullYear = datetime.getFullYear(),
|
11
|
+
optionalYear = currentDate.getFullYear() !== fullYear ? fullYear : ''
|
12
|
+
|
13
|
+
const monthDayYear = `${monthName}${day}${optionalYear}`
|
5
14
|
|
6
15
|
const props = {
|
7
16
|
data: { testid: 'datetimestacked' },
|
8
|
-
datetime
|
17
|
+
datetime,
|
9
18
|
}
|
10
19
|
|
11
20
|
test('Kit renders date time', () => {
|
@@ -19,17 +28,17 @@ it('Should be accessible', async () => {
|
|
19
28
|
|
20
29
|
test('renders time in default timezone', () => {
|
21
30
|
const kit = renderKit(DateTimeStacked, props)
|
22
|
-
expect(kit).toHaveTextContent(
|
31
|
+
expect(kit).toHaveTextContent(`${monthDayYear}1:00pEDT`)
|
23
32
|
})
|
24
33
|
|
25
34
|
test('renders time in timezone', () => {
|
26
35
|
props.timeZone = 'Asia/Tokyo'
|
27
36
|
const kit = renderKit(DateTimeStacked, props)
|
28
|
-
expect(kit).toHaveTextContent(
|
37
|
+
expect(kit).toHaveTextContent(`${monthDayYear}2:00aJST`)
|
29
38
|
})
|
30
39
|
|
31
40
|
test('renders time in timezone', () => {
|
32
41
|
props.timeZone = 'America/Denver'
|
33
42
|
const kit = renderKit(DateTimeStacked, props)
|
34
|
-
expect(kit).toHaveTextContent(
|
43
|
+
expect(kit).toHaveTextContent(`${monthDayYear}11:00aMDT`)
|
35
44
|
})
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Style/HashLikeCase
|
4
|
+
|
3
5
|
module Playbook
|
4
6
|
module PbFixedConfirmationToast
|
5
7
|
class FixedConfirmationToast < Playbook::KitBase
|
@@ -53,3 +55,5 @@ module Playbook
|
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
58
|
+
|
59
|
+
# rubocop:enable Style/HashLikeCase
|
@@ -21,6 +21,7 @@ type FlexProps = {
|
|
21
21
|
rowGap?: "xs" | "sm" | "md" | "lg" | "xl" | "none",
|
22
22
|
columnGap?: "xs" | "sm" | "md" | "lg" | "xl" | "none",
|
23
23
|
wrap?: boolean,
|
24
|
+
alignSelf?: "start" | "end" | "center" | "stretch" | "none"
|
24
25
|
}
|
25
26
|
|
26
27
|
const Flex = (props: FlexProps) => {
|
@@ -40,6 +41,7 @@ const Flex = (props: FlexProps) => {
|
|
40
41
|
reverse = false,
|
41
42
|
vertical = 'top',
|
42
43
|
wrap = false,
|
44
|
+
alignSelf = 'none',
|
43
45
|
} = props
|
44
46
|
const orientationClass =
|
45
47
|
orientation !== undefined ? `orientation_${orientation}` : ''
|
@@ -53,6 +55,7 @@ const Flex = (props: FlexProps) => {
|
|
53
55
|
const columnGapClass = columnGap !== 'none' ? `columnGap_${columnGap}` : ''
|
54
56
|
const wrapClass = wrap === true ? 'wrap' : ''
|
55
57
|
const reverseClass = reverse === true ? 'reverse' : ''
|
58
|
+
const alignSelfClass = alignSelf !== 'none' ? `align_self_${alignSelf}` : ''
|
56
59
|
const dataProps = buildDataProps(data)
|
57
60
|
|
58
61
|
return (
|
@@ -70,6 +73,7 @@ const Flex = (props: FlexProps) => {
|
|
70
73
|
gapClass,
|
71
74
|
rowGapClass,
|
72
75
|
columnGapClass,
|
76
|
+
alignSelfClass
|
73
77
|
),
|
74
78
|
globalProps(props),
|
75
79
|
className
|
@@ -77,7 +77,6 @@ $gapTypes: (
|
|
77
77
|
align-items: flex-start;
|
78
78
|
}
|
79
79
|
|
80
|
-
|
81
80
|
&[class*=align_items_right],
|
82
81
|
&[class*=align_items_bottom],
|
83
82
|
&[class*=align_items_end] {
|
@@ -96,6 +95,23 @@ $gapTypes: (
|
|
96
95
|
align-items: baseline;
|
97
96
|
}
|
98
97
|
|
98
|
+
// Alignment: Align Self - Rails & React
|
99
|
+
&[class*=align_self_start] {
|
100
|
+
align-self: flex-start;
|
101
|
+
}
|
102
|
+
|
103
|
+
&[class*=align_self_end] {
|
104
|
+
align-self: flex-end;
|
105
|
+
}
|
106
|
+
|
107
|
+
&[class*=align_self_center] {
|
108
|
+
align-self: center;
|
109
|
+
}
|
110
|
+
|
111
|
+
&[class*=align_self_stretch] {
|
112
|
+
align-self: stretch;
|
113
|
+
}
|
114
|
+
|
99
115
|
// Spacing
|
100
116
|
&[class*=spacing_around],
|
101
117
|
&[class*=justify_content_around] {
|
@@ -12,21 +12,25 @@ type FlexItemPropTypes = {
|
|
12
12
|
className: string,
|
13
13
|
overflow?: "auto" | "hidden" | "initial" | "inherit" | "scroll" | "visible",
|
14
14
|
order?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'first' | 'none',
|
15
|
+
alignSelf?: "start" | "end" | "center" | "stretch",
|
16
|
+
displayFlex: boolean
|
15
17
|
}
|
16
18
|
|
17
19
|
const FlexItem = (props: FlexItemPropTypes) => {
|
18
|
-
const { children, className, fixedSize, grow, overflow = null, shrink, flex = 'none', order = 'none' } = props
|
20
|
+
const { children, className, fixedSize, grow, overflow = null, shrink, flex = 'none', order = 'none', alignSelf = null, displayFlex } = props
|
19
21
|
const growClass = grow === true ? 'grow' : ''
|
22
|
+
const displayFlexClass = displayFlex === true ? `display_flex_${displayFlex}` : ''
|
20
23
|
const flexClass = flex !== 'none' ? `flex_${flex}` : ''
|
21
24
|
const overflowClass = overflow ? `overflow_${overflow}` : ''
|
22
25
|
const shrinkClass = shrink === true ? 'shrink' : ''
|
26
|
+
const alignSelfClass = alignSelf ? `align_self_${alignSelf}` : ''
|
23
27
|
const fixedStyle =
|
24
28
|
fixedSize !== undefined ? { flexBasis: `${fixedSize}` } : null
|
25
29
|
const orderClass = order !== 'none' ? `order_${order}` : null
|
26
30
|
|
27
31
|
return (
|
28
32
|
<div
|
29
|
-
className={classnames(buildCss('pb_flex_item_kit', growClass, shrinkClass, flexClass), overflowClass, orderClass, globalProps(props), className)}
|
33
|
+
className={classnames(buildCss('pb_flex_item_kit', growClass, shrinkClass, flexClass, displayFlexClass), overflowClass, orderClass, alignSelfClass, globalProps(props), className)}
|
30
34
|
style={fixedStyle}
|
31
35
|
>
|
32
36
|
{children}
|
@@ -12,6 +12,28 @@
|
|
12
12
|
flex-shrink: 1;
|
13
13
|
}
|
14
14
|
|
15
|
+
// Display Flex - Rails & React
|
16
|
+
&[class*=display_flex] {
|
17
|
+
display: flex;
|
18
|
+
}
|
19
|
+
|
20
|
+
// Alignment: Align Self - Rails & React
|
21
|
+
&[class*=align_self_start] {
|
22
|
+
align-self: flex-start;
|
23
|
+
}
|
24
|
+
|
25
|
+
&[class*=align_self_end] {
|
26
|
+
align-self: flex-end;
|
27
|
+
}
|
28
|
+
|
29
|
+
&[class*=align_self_center] {
|
30
|
+
align-self: center;
|
31
|
+
}
|
32
|
+
|
33
|
+
&[class*=align_self_stretch] {
|
34
|
+
align-self: stretch;
|
35
|
+
}
|
36
|
+
|
15
37
|
//Order Items
|
16
38
|
@for $i from 0 through 12 {
|
17
39
|
&[class*=order_#{$i}]{
|
@@ -1,5 +1,16 @@
|
|
1
|
-
<%= pb_rails("title", props: {size: 4, text: "
|
1
|
+
<%= pb_rails("title", props: {size: 4, text: "Display Flex"}) %>
|
2
2
|
<br/>
|
3
|
+
<div class="flex-doc-example">
|
4
|
+
<%= pb_rails("flex/flex_item",props: { gap:"sm", display_flex: true }) do %>
|
5
|
+
<%= pb_rails("flex/flex_item") do %>We<% end %>
|
6
|
+
<%= pb_rails("flex/flex_item") do %>Are<% end %>
|
7
|
+
<%= pb_rails("flex/flex_item") do %>Being<% end %>
|
8
|
+
<%= pb_rails("flex/flex_item") do %>Flexed<% end %>
|
9
|
+
<% end %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<br/><br/>
|
13
|
+
|
3
14
|
<div class="flex-doc-example">
|
4
15
|
<%= pb_rails("flex",props: { gap:"sm" }) do %>
|
5
16
|
<%= pb_rails("flex/flex_item", props: { grow: true }) do %>I'm growing<% end %>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
##### Props
|
2
2
|
|
3
|
+
* `display_flex` | **Type**: Boolean
|
3
4
|
* `flex` | **Type**: String | **Values**: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
|
4
5
|
* `fixed_size` | **Type**: String | **Values**: Any CSS px or % value
|
5
6
|
* `grow` | **Type**: Boolean
|
@@ -10,3 +11,4 @@
|
|
10
11
|
- Setting Flex to 1 is equal to setting the grow & shrink prop to true
|
11
12
|
- Setting Flex to 0 is equal to setting the grow & shrink prop to false
|
12
13
|
- If grow & shrink are true, grow will take precedence an the flex item will take up as much space as possible, then if other elements are added shrink would allow other items to squish inside the flex container
|
14
|
+
- display_flex will either be true or false. If true, then the class will be applied to the kit
|
@@ -0,0 +1,89 @@
|
|
1
|
+
<%= pb_rails("title", props: {size: 4, text: "Row"}) %>
|
2
|
+
<br/>
|
3
|
+
<div class="flex-doc-example">
|
4
|
+
<%= pb_rails("flex") do %>
|
5
|
+
<%= pb_rails("flex/flex_item", props: {padding:"sm", align_self:"start"}) do %>1<% end %>
|
6
|
+
<%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>2<% end %>
|
7
|
+
<%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>3<% end %>
|
8
|
+
<%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>4<% end %>
|
9
|
+
<% end %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<br/><br/>
|
13
|
+
|
14
|
+
<div class="flex-doc-example">
|
15
|
+
<%= pb_rails("flex") do %>
|
16
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm", align_self:"end"}) do %>1<% end %>
|
17
|
+
<%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>2<% end %>
|
18
|
+
<%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>3<% end %>
|
19
|
+
<%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>4<% end %>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<br/><br/>
|
24
|
+
|
25
|
+
<div class="flex-doc-example">
|
26
|
+
<%= pb_rails("flex") do %>
|
27
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm", align_self: "center"}) do %>1<% end %>
|
28
|
+
<%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>2<% end %>
|
29
|
+
<%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>3<% end %>
|
30
|
+
<%= pb_rails("flex/flex_item", props:{padding:"lg"}) do %>4<% end %>
|
31
|
+
<% end %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<br/><br/>
|
35
|
+
|
36
|
+
<div class="flex-doc-example">
|
37
|
+
<%= pb_rails("flex") do %>
|
38
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm", align_self:"stretch"}) do %>1<% end %>
|
39
|
+
<%= pb_rails("flex/flex_item", props:{padding:"md"}) do %>2<% end %>
|
40
|
+
<%= pb_rails("flex/flex_item", props:{padding:"md"}) do %>3<% end %>
|
41
|
+
<%= pb_rails("flex/flex_item", props:{padding:"md"}) do %>4<% end %>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<br/><br/>
|
46
|
+
|
47
|
+
<%= pb_rails("title", props: {size: 4, text: "Column"}) %>
|
48
|
+
<br/>
|
49
|
+
<div class="flex-doc-example">
|
50
|
+
<%= pb_rails("flex", props: {orientation: "column"}) do %>
|
51
|
+
<%= pb_rails("flex/flex_item", props: {padding:"sm", align_self:"start"}) do %>1<% end %>
|
52
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>2<% end %>
|
53
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>3<% end %>
|
54
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %>
|
55
|
+
<% end %>
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<br/><br/>
|
59
|
+
|
60
|
+
<div class="flex-doc-example">
|
61
|
+
<%= pb_rails("flex", props: {orientation: "column"}) do %>
|
62
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm", align_self: "end"}) do %>1<% end %>
|
63
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>2<% end %>
|
64
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>3<% end %>
|
65
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %>
|
66
|
+
<% end %>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<br/><br/>
|
70
|
+
|
71
|
+
<div class="flex-doc-example">
|
72
|
+
<%= pb_rails("flex", props: {orientation: "column"}) do %>
|
73
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm", align_self:"center"}) do %>1<% end %>
|
74
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>2<% end %>
|
75
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>3<% end %>
|
76
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %>
|
77
|
+
<% end %>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
<br/><br/>
|
81
|
+
|
82
|
+
<div class="flex-doc-example">
|
83
|
+
<%= pb_rails("flex", props: {orientation: "column"}) do %>
|
84
|
+
<%= pb_rails("flex/flex_item", props:{padding: "sm", align_self:"stretch"}) do %>1<% end %>
|
85
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>2<% end %>
|
86
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>3<% end %>
|
87
|
+
<%= pb_rails("flex/flex_item", props:{padding:"sm"}) do %>4<% end %>
|
88
|
+
<% end %>
|
89
|
+
</div>
|