playbook_ui 14.16.0 → 14.17.0.pre.alpha.PBNTR766tablenestedcollapsiblerowsborderdoubling7256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/types.ts +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +104 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +168 -85
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +10 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +20 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.html.erb +39 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +19 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +38 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +49 -37
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +39 -0
- data/app/pb_kits/playbook/pb_background/_background.scss +26 -0
- data/app/pb_kits/playbook/pb_background/_background.tsx +5 -3
- data/app/pb_kits/playbook/pb_background/background.test.js +5 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +35 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +5 -5
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +14 -7
- data/app/pb_kits/playbook/pb_contact/contact.test.js +7 -7
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +34 -34
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -11
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -7
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss +28 -24
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +2 -2
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +1 -1
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +58 -17
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +3 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +50 -48
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +110 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +9 -6
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +71 -3
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +3 -3
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +3 -4
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +2 -3
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +40 -2
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +15 -5
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +20 -5
- data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -9
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_value/icon_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_label_value/label_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.scss +127 -0
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +47 -7
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +394 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
- data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_layout/layout.test.js +4 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +121 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +79 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +74 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +1 -1
- data/app/pb_kits/playbook/pb_link/link.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +2 -1
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +5 -3
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +49 -22
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +15 -4
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +63 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +3 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +1 -7
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +39 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +40 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +5 -0
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +3 -0
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +39 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +29 -11
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +4 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +2 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
- data/app/pb_kits/playbook/pb_stat_change/stat_change.test.js +8 -4
- data/app/pb_kits/playbook/pb_table/_table.tsx +4 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.jsx +50 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.jsx +59 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +84 -0
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +89 -1
- data/app/pb_kits/playbook/pb_table/styles/_striped.scss +3 -3
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +5 -0
- data/app/pb_kits/playbook/pb_table/table.rb +13 -1
- data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
- data/app/pb_kits/playbook/pb_table/table_header.rb +13 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +183 -56
- data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +2 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
- data/app/pb_kits/playbook/pb_typeahead/index.ts +2 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
- data/app/pb_kits/playbook/pb_user/user.html.erb +1 -6
- data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +1 -6
- data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
- data/app/pb_kits/playbook/utilities/object.test.js +149 -1
- data/app/pb_kits/playbook/utilities/object.ts +124 -42
- data/dist/chunks/_typeahead-BY6AFq1l.js +22 -0
- data/dist/chunks/_weekday_stacked-DvC4wBNS.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/lib-BGzBzFZX.js +29 -0
- data/dist/chunks/{pb_form_validation-DMajaRt3.js → pb_form_validation-BvNy9Bd6.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- 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/kit_base.rb +4 -4
- data/lib/playbook/version.rb +2 -2
- metadata +51 -22
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
- data/dist/chunks/_typeahead-BuTZG1Jn.js +0 -22
- data/dist/chunks/_weekday_stacked-oT22q75-.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
- data/dist/chunks/lib-Co5y3V4K.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.md → _advanced_table_selectable_rows_no_subrows_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.md → _advanced_table_selectable_rows_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.md} +0 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import classnames from 'classnames'
|
3
|
+
|
4
|
+
import { buildCss } from '../../utilities/props'
|
5
|
+
import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/globalProps'
|
6
|
+
|
7
|
+
import Avatar from "../../pb_avatar/_avatar";
|
8
|
+
import Body from "../../pb_body/_body";
|
9
|
+
import Flex from "../../pb_flex/_flex";
|
10
|
+
import Badge from "../../pb_badge/_badge";
|
11
|
+
import Detail from "../../pb_detail/_detail";
|
12
|
+
import Background from "../../pb_background/_background";
|
13
|
+
|
14
|
+
type LayoutParticipantProps = {
|
15
|
+
className?: string,
|
16
|
+
name?: string,
|
17
|
+
territory?: string,
|
18
|
+
points?: string,
|
19
|
+
rank?: string,
|
20
|
+
avatar?: string,
|
21
|
+
winner?: boolean,
|
22
|
+
self?: boolean,
|
23
|
+
} & GlobalProps
|
24
|
+
|
25
|
+
export const Participant = (props: LayoutParticipantProps) => {
|
26
|
+
const { className, name = 'To be determined...', territory = '', points, rank, avatar, winner, self, hasLastWinnerAndSelf } = props
|
27
|
+
const dynamicInlineProps = globalInlineProps(props)
|
28
|
+
const isLastWinnerAndSelf = hasLastWinnerAndSelf && self && winner
|
29
|
+
const classes = classnames(buildCss('layout_participant', winner ? 'winner' : '', self ? 'self' : '', isLastWinnerAndSelf ? 'last' : ''), globalProps(props), className)
|
30
|
+
return (
|
31
|
+
<Background
|
32
|
+
backgroundColor={winner ? "success_subtle" : "white"}
|
33
|
+
className={classes}
|
34
|
+
padding="xs"
|
35
|
+
style={dynamicInlineProps}
|
36
|
+
>
|
37
|
+
<Flex justify="between">
|
38
|
+
<Avatar
|
39
|
+
imageUrl={avatar}
|
40
|
+
marginRight="sm"
|
41
|
+
name={name}
|
42
|
+
size="sm"
|
43
|
+
/>
|
44
|
+
<Body flexGrow={1}>
|
45
|
+
<Flex justify="between">
|
46
|
+
<Body
|
47
|
+
color={winner && !isLastWinnerAndSelf ? "success" : "default"}
|
48
|
+
truncate={1}
|
49
|
+
>
|
50
|
+
{winner ? <strong>{name}{self ? ' (You)' : ''}</strong> : name + (self && !isLastWinnerAndSelf ? ' (You)' : '')}
|
51
|
+
</Body>
|
52
|
+
<Body
|
53
|
+
color={winner && !isLastWinnerAndSelf ? "success" : "light"}
|
54
|
+
display="flex"
|
55
|
+
>
|
56
|
+
{points && (<>
|
57
|
+
<strong>{points}</strong>
|
58
|
+
<Detail
|
59
|
+
color={winner && !isLastWinnerAndSelf ? "success" : "light"}
|
60
|
+
text="pts"
|
61
|
+
/>
|
62
|
+
</>)}
|
63
|
+
</Body>
|
64
|
+
</Flex>
|
65
|
+
<Body color="light">
|
66
|
+
{territory}
|
67
|
+
|
68
|
+
<Badge
|
69
|
+
text={rank}
|
70
|
+
variant={winner && !isLastWinnerAndSelf ? "success" : self ? "notification" : "neutral"}
|
71
|
+
/>
|
72
|
+
</Body>
|
73
|
+
</Body>
|
74
|
+
</Flex>
|
75
|
+
</Background>
|
76
|
+
)
|
77
|
+
}
|
78
|
+
|
79
|
+
export default Participant
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import classnames from 'classnames'
|
3
|
+
|
4
|
+
import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/globalProps'
|
5
|
+
|
6
|
+
type LayoutRoundLabelProps = {
|
7
|
+
children: React.ReactNode[] | React.ReactNode,
|
8
|
+
className?: string,
|
9
|
+
} & GlobalProps
|
10
|
+
|
11
|
+
export const RoundLabel = (props: LayoutRoundLabelProps) => {
|
12
|
+
const { children, className } = props
|
13
|
+
const dynamicInlineProps = globalInlineProps(props)
|
14
|
+
return (
|
15
|
+
<div
|
16
|
+
className={classnames('layout_round_label', className)}
|
17
|
+
style={dynamicInlineProps}
|
18
|
+
>
|
19
|
+
{children}
|
20
|
+
</div>
|
21
|
+
)
|
22
|
+
}
|
23
|
+
|
24
|
+
type LayoutRoundProps = {
|
25
|
+
children: React.ReactNode[] | React.ReactNode,
|
26
|
+
className?: string,
|
27
|
+
numberOfRounds: number,
|
28
|
+
lastRoundWithSelf: number,
|
29
|
+
} & GlobalProps
|
30
|
+
|
31
|
+
export const Round = (props: LayoutRoundProps) => {
|
32
|
+
const { children, className, numberOfRounds, lastRoundWithSelf } = props
|
33
|
+
const dynamicInlineProps = globalInlineProps(props)
|
34
|
+
const numberOfChildren = Array.isArray(children) ? children.length : 0
|
35
|
+
|
36
|
+
const childrenWithProps = Array.isArray(children)
|
37
|
+
? children.map((child, index) =>
|
38
|
+
React.isValidElement(child)
|
39
|
+
? React.cloneElement(child, {
|
40
|
+
numberOfRounds,
|
41
|
+
numberOfGames: numberOfChildren,
|
42
|
+
isOdd: index % 2 === 0,
|
43
|
+
key: `child_${index}`,
|
44
|
+
lastRoundWithSelf
|
45
|
+
})
|
46
|
+
: child
|
47
|
+
)
|
48
|
+
: React.isValidElement(children)
|
49
|
+
? React.cloneElement(children, {
|
50
|
+
numberOfRounds,
|
51
|
+
numberOfGames: numberOfChildren,
|
52
|
+
lastRoundWithSelf
|
53
|
+
})
|
54
|
+
: children
|
55
|
+
|
56
|
+
const rightConnectors = Array.from({ length: numberOfChildren / 2 }, (_, index) => (
|
57
|
+
<div
|
58
|
+
className="right_connector"
|
59
|
+
key={`right_connector_${index}`}
|
60
|
+
/>
|
61
|
+
))
|
62
|
+
|
63
|
+
return (
|
64
|
+
<>
|
65
|
+
<div
|
66
|
+
className={classnames('layout_round', globalProps(props), className)}
|
67
|
+
style={dynamicInlineProps}
|
68
|
+
>
|
69
|
+
{childrenWithProps}
|
70
|
+
</div>
|
71
|
+
<div className="connector_container">{rightConnectors}</div>
|
72
|
+
</>
|
73
|
+
)
|
74
|
+
}
|
@@ -73,7 +73,7 @@ test('adds icon', () => {
|
|
73
73
|
|
74
74
|
const kit = screen.getByTestId('icon-test')
|
75
75
|
|
76
|
-
const icon = kit.querySelector('.
|
76
|
+
const icon = kit.querySelector('.pb_custom_icon')
|
77
77
|
expect(icon).toBeInTheDocument();
|
78
78
|
})
|
79
79
|
|
@@ -87,7 +87,7 @@ test('adds icon right', () => {
|
|
87
87
|
|
88
88
|
const kit = screen.getByTestId('icon-right-test')
|
89
89
|
|
90
|
-
const icon = kit.querySelector('.
|
90
|
+
const icon = kit.querySelector('.pb_custom_icon')
|
91
91
|
expect(icon).toBeInTheDocument();
|
92
92
|
})
|
93
93
|
|
@@ -7,11 +7,12 @@ import {
|
|
7
7
|
buildDataProps,
|
8
8
|
buildHtmlProps,
|
9
9
|
} from "../utilities/props";
|
10
|
+
import { cloneDeep } from "../utilities/object";
|
11
|
+
|
10
12
|
import Icon from "../pb_icon/_icon";
|
11
13
|
import FormPill from "../pb_form_pill/_form_pill";
|
12
14
|
import Body from "../pb_body/_body";
|
13
15
|
import Caption from "../pb_caption/_caption";
|
14
|
-
import { cloneDeep } from "lodash";
|
15
16
|
import MultiLevelSelectOptions from "./multi_level_select_options";
|
16
17
|
import MultiLevelSelectContext from "./context";
|
17
18
|
|
@@ -95,11 +95,13 @@ test('should not have a left border', () => {
|
|
95
95
|
test('should have a right icon', () => {
|
96
96
|
render(<NavDefault iconRight="angle-down" />)
|
97
97
|
const kit = screen.getByTestId(itemTestId)
|
98
|
-
|
98
|
+
const icon = kit.querySelector(".pb_custom_icon.pb_nav_list_item_icon_right")
|
99
|
+
expect(icon).toBeInTheDocument()
|
99
100
|
})
|
100
101
|
|
101
102
|
test('should have a left icon', () => {
|
102
|
-
render(<NavDefault iconLeft="
|
103
|
+
render(<NavDefault iconLeft="angle-up" />)
|
103
104
|
const kit = screen.getByTestId(itemTestId)
|
104
|
-
|
105
|
+
const icon = kit.querySelector(".pb_custom_icon.pb_nav_list_item_icon_left")
|
106
|
+
expect(icon).toBeInTheDocument()
|
105
107
|
})
|
@@ -18,34 +18,39 @@ $overlay_colors: (
|
|
18
18
|
card_dark: $card_dark,
|
19
19
|
bg_dark: $bg_dark,
|
20
20
|
bg_light: $bg_light,
|
21
|
+
black: $black,
|
22
|
+
white: $white,
|
23
|
+
success: $success,
|
24
|
+
error: $error
|
21
25
|
);
|
22
26
|
|
23
|
-
@mixin overlay($direction, $size, $color) {
|
27
|
+
@mixin overlay($direction, $size, $color, $apply_gradient: true) {
|
24
28
|
display: block;
|
25
29
|
position: absolute;
|
26
30
|
pointer-events: none;
|
27
31
|
z-index: 1;
|
28
32
|
content: "";
|
29
33
|
|
30
|
-
@if $
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
34
|
+
@if $apply_gradient {
|
35
|
+
@if $direction == "left" {
|
36
|
+
inset: 0 auto 0 0;
|
37
|
+
background: linear-gradient(to right, $color 0%, transparent 100%);
|
38
|
+
width: $size;
|
39
|
+
} @else if $direction == "right" {
|
40
|
+
inset: 0 0 0 auto;
|
41
|
+
background: linear-gradient(to left, $color 0%, transparent 100%);
|
42
|
+
width: $size;
|
43
|
+
} @else if $direction == "top" {
|
44
|
+
inset: 0 0 auto 0;
|
45
|
+
background: linear-gradient(to bottom, $color 0%, transparent 100%);
|
46
|
+
height: $size;
|
47
|
+
} @else if $direction == "bottom" {
|
48
|
+
inset: auto 0 0 0;
|
49
|
+
background: linear-gradient(to top, $color 0%, transparent 100%);
|
50
|
+
height: $size;
|
51
|
+
}
|
52
|
+
} @else {
|
53
|
+
background: $color;
|
49
54
|
}
|
50
55
|
}
|
51
56
|
|
@@ -69,7 +74,7 @@ $overlay_colors: (
|
|
69
74
|
pointer-events: none;
|
70
75
|
z-index: 1;
|
71
76
|
}
|
72
|
-
|
77
|
+
|
73
78
|
&.overlay-hide-scrollbar {
|
74
79
|
& [class*="overflow_x_auto"],
|
75
80
|
& [class*="overflow_y_auto"],
|
@@ -77,9 +82,31 @@ $overlay_colors: (
|
|
77
82
|
&::-webkit-scrollbar {
|
78
83
|
display: none !important;
|
79
84
|
}
|
80
|
-
|
85
|
+
|
81
86
|
-ms-overflow-style: none !important;
|
82
87
|
scrollbar-width: none !important;
|
83
88
|
}
|
84
89
|
}
|
90
|
+
|
91
|
+
&.no_gradient {
|
92
|
+
@each $color_name, $color in $overlay_colors {
|
93
|
+
.overlay_#{$color_name} {
|
94
|
+
@each $name, $size in $overlay_sizes {
|
95
|
+
@each $position in $overlay_positions {
|
96
|
+
&_#{$position}_#{$name} {
|
97
|
+
@include overlay($position, $size, $color, false);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
@each $key, $value in $opacity {
|
105
|
+
&.#{$key} {
|
106
|
+
[class^=overlay] {
|
107
|
+
opacity: $value;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
85
112
|
}
|
@@ -7,7 +7,7 @@ import OverlayToken from './subcomponents/_overlay_token'
|
|
7
7
|
|
8
8
|
export type OverlayChildrenProps = {
|
9
9
|
children: React.ReactNode[] | React.ReactNode,
|
10
|
-
color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
|
10
|
+
color: "card_light" | "bg_light" | "card_dark" | "bg_dark" | "black" | "white" | "success" | "error",
|
11
11
|
dynamic?: boolean,
|
12
12
|
position: string,
|
13
13
|
size: string,
|
@@ -18,14 +18,16 @@ type OverlayProps = {
|
|
18
18
|
aria?: { [key: string]: string },
|
19
19
|
className?: string,
|
20
20
|
children: React.ReactNode[] | React.ReactNode,
|
21
|
-
color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
|
21
|
+
color: "card_light" | "bg_light" | "card_dark" | "bg_dark" | "black" | "white" | "success" | "error",
|
22
22
|
data?: { [key: string]: string },
|
23
23
|
dynamic?: false,
|
24
|
+
gradient?: boolean,
|
24
25
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
|
25
26
|
id?: string,
|
26
27
|
layout: { [key: string]: string },
|
28
|
+
opacity: 'opacity_1' | 'opacity_2' | 'opacity_3' | 'opacity_4' | 'opacity_5' | 'opacity_6' | 'opacity_7' | 'opacity_8' | 'opacity_9' | 'opacity_10',
|
27
29
|
scrollBarNone?: boolean,
|
28
|
-
|
30
|
+
|
29
31
|
}
|
30
32
|
|
31
33
|
const Overlay = (props: OverlayProps) => {
|
@@ -36,15 +38,24 @@ const Overlay = (props: OverlayProps) => {
|
|
36
38
|
color = "card_light",
|
37
39
|
data = {},
|
38
40
|
dynamic = false,
|
41
|
+
gradient = true,
|
39
42
|
htmlOptions = {},
|
40
43
|
id,
|
41
44
|
layout = { "bottom": "full" },
|
45
|
+
opacity,
|
42
46
|
scrollBarNone = false,
|
43
47
|
} = props
|
44
48
|
|
45
49
|
const ariaProps = buildAriaProps(aria)
|
46
50
|
const dataProps = buildDataProps(data)
|
47
|
-
const classes = classnames(
|
51
|
+
const classes = classnames(
|
52
|
+
buildCss('pb_overlay'),
|
53
|
+
{ 'overlay-hide-scrollbar': scrollBarNone },
|
54
|
+
globalProps(props),
|
55
|
+
gradient === false ? 'no_gradient' : '',
|
56
|
+
opacity,
|
57
|
+
className
|
58
|
+
)
|
48
59
|
const htmlProps = buildHtmlProps(htmlOptions)
|
49
60
|
const dynamicInlineProps = globalInlineProps(props)
|
50
61
|
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Overlay from '../../pb_overlay/_overlay'
|
4
|
+
import Image from '../../pb_image/_image'
|
5
|
+
import Flex from '../../pb_flex/_flex'
|
6
|
+
|
7
|
+
const OverlayColor = () => (
|
8
|
+
<Flex
|
9
|
+
justify="around"
|
10
|
+
wrap
|
11
|
+
>
|
12
|
+
<Overlay
|
13
|
+
color="black"
|
14
|
+
marginBottom="xxs"
|
15
|
+
>
|
16
|
+
<Image
|
17
|
+
alt="picture of a misty forest"
|
18
|
+
display="block"
|
19
|
+
size="xl"
|
20
|
+
url="https://unsplash.it/500/400/?image=634"
|
21
|
+
/>
|
22
|
+
</Overlay>
|
23
|
+
<Overlay
|
24
|
+
color="black"
|
25
|
+
gradient={false}
|
26
|
+
marginBottom="xxs"
|
27
|
+
opacity="opacity_4"
|
28
|
+
>
|
29
|
+
<Image
|
30
|
+
alt="picture of a misty forest"
|
31
|
+
display="block"
|
32
|
+
size="xl"
|
33
|
+
url="https://unsplash.it/500/400/?image=634"
|
34
|
+
/>
|
35
|
+
</Overlay>
|
36
|
+
<Overlay
|
37
|
+
color="error"
|
38
|
+
marginBottom="xxs"
|
39
|
+
>
|
40
|
+
<Image
|
41
|
+
alt="picture of a misty forest"
|
42
|
+
display="block"
|
43
|
+
size="xl"
|
44
|
+
url="https://unsplash.it/500/400/?image=634"
|
45
|
+
/>
|
46
|
+
</Overlay>
|
47
|
+
<Overlay
|
48
|
+
color="error"
|
49
|
+
gradient={false}
|
50
|
+
marginBottom="xxs"
|
51
|
+
opacity="opacity_4"
|
52
|
+
>
|
53
|
+
<Image
|
54
|
+
alt="picture of a misty forest"
|
55
|
+
display="block"
|
56
|
+
size="xl"
|
57
|
+
url="https://unsplash.it/500/400/?image=634"
|
58
|
+
/>
|
59
|
+
</Overlay>
|
60
|
+
</Flex>
|
61
|
+
)
|
62
|
+
|
63
|
+
export default OverlayColor
|
@@ -0,0 +1,3 @@
|
|
1
|
+
The `color` prop is used to change the color of the solid or gradient mask. Gradient overlays always start opaque and fade to transparent.
|
2
|
+
|
3
|
+
NOTE: Images are set to `display: block` to remove the default inline spacing caused by line height. This ensures the image fully fills the container without unexpected gaps.
|
@@ -1,7 +1 @@
|
|
1
|
-
Overlays
|
2
|
-
|
3
|
-
The optional `layout` prop accepts the `position` and `size` of the overlay as a key:value pair.
|
4
|
-
|
5
|
-
The `position` key accepts `bottom` (default), `top`, `y` (for both top and bottom) `right`, `left`, or `x` (for both left and right), which sets the side(s) where the `color` overlay starts. The direction of the overlay is always toward the opposite side of the position. For example, the default position of `bottom` starts the overlay on the bottom edge of your container and extends it toward the opposite side: the top.
|
6
|
-
|
7
|
-
The `size` value is `full` (100%) by default, but accepts our [spacing tokens](https://playbook.powerapp.cloud/visual_guidelines/spacing) or a percentage value as a string, and literally translates to how much of the container is covered by the overlay(s).
|
1
|
+
Overlays help shift focus by dimming or masking background content. This kit supports gradient and solid color modes, with adjustable opacity to suit the context.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Overlay from '../../pb_overlay/_overlay'
|
4
|
+
import Image from '../../pb_image/_image'
|
5
|
+
import Flex from '../../pb_flex/_flex'
|
6
|
+
|
7
|
+
const OverlayGradientOpacity = () => (
|
8
|
+
<Flex
|
9
|
+
justify="around"
|
10
|
+
wrap
|
11
|
+
>
|
12
|
+
<Overlay
|
13
|
+
gradient={false}
|
14
|
+
marginBottom="xxs"
|
15
|
+
opacity="opacity_2"
|
16
|
+
>
|
17
|
+
<Image
|
18
|
+
alt="picture of a misty forest"
|
19
|
+
display="block"
|
20
|
+
maxWidth="100%"
|
21
|
+
url="https://unsplash.it/500/400/?image=634"
|
22
|
+
/>
|
23
|
+
</Overlay>
|
24
|
+
<Overlay
|
25
|
+
gradient={false}
|
26
|
+
marginBottom="xxs"
|
27
|
+
opacity="opacity_8"
|
28
|
+
>
|
29
|
+
<Image
|
30
|
+
alt="picture of a misty forest"
|
31
|
+
display="block"
|
32
|
+
maxWidth="100%"
|
33
|
+
url="https://unsplash.it/500/400/?image=634"
|
34
|
+
/>
|
35
|
+
</Overlay>
|
36
|
+
</Flex>
|
37
|
+
)
|
38
|
+
|
39
|
+
export default OverlayGradientOpacity
|
@@ -0,0 +1 @@
|
|
1
|
+
By default, the overlay is rendered as a gradient. Setting the `gradient` prop to `false` renders the overlay as a solid color. You can adjust the transparency of the solid overlay by using the `opacity` prop.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Overlay from '../../pb_overlay/_overlay'
|
4
|
+
import Table from '../../pb_table/_table'
|
5
|
+
|
6
|
+
|
7
|
+
const TableExample = () => {
|
8
|
+
return (
|
9
|
+
<Table size="sm">
|
10
|
+
<thead>
|
11
|
+
<tr>
|
12
|
+
<th>{'Column 1'}</th>
|
13
|
+
<th>{'Column 2'}</th>
|
14
|
+
<th>{'Column 3'}</th>
|
15
|
+
<th>{'Column 4'}</th>
|
16
|
+
<th>{'Column 5'}</th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
<tbody>
|
20
|
+
{Array.from({ length: 7 }, (_, index) => (
|
21
|
+
<tr key={index}>
|
22
|
+
{Array.from({ length: 5 }, (_, columnIndex) => (
|
23
|
+
<td key={columnIndex}>{`Value ${columnIndex + 1}`}</td>
|
24
|
+
))}
|
25
|
+
</tr>
|
26
|
+
))}
|
27
|
+
</tbody>
|
28
|
+
</Table>
|
29
|
+
)
|
30
|
+
}
|
31
|
+
|
32
|
+
const OverlayLayout = () => (
|
33
|
+
<>
|
34
|
+
<Overlay layout={{ y: "xl" }}>
|
35
|
+
<TableExample />
|
36
|
+
</Overlay>
|
37
|
+
</>
|
38
|
+
)
|
39
|
+
|
40
|
+
export default OverlayLayout
|
@@ -0,0 +1,5 @@
|
|
1
|
+
The optional `layout` prop accepts the `position` and `size` of the overlay as a key:value pair.
|
2
|
+
|
3
|
+
The `position` key accepts `bottom` (default), `top`, `y` (for both top and bottom) `right`, `left`, or `x` (for both left and right), which sets the side(s) where the `color` overlay starts. The direction of the overlay is always toward the opposite side of the position. For example, the default position of `bottom` starts the overlay on the bottom edge of your container and extends it toward the opposite side: the top.
|
4
|
+
|
5
|
+
The `size` value is `full` (100%) by default, but accepts our [spacing tokens](https://playbook.powerapp.cloud/visual_guidelines/spacing) or a percentage value as a string, and literally translates to how much of the container is covered by the overlay(s).
|
@@ -1,6 +1,9 @@
|
|
1
1
|
examples:
|
2
2
|
react:
|
3
3
|
- overlay_default: Default
|
4
|
+
- overlay_gradient_opacity: Gradient & Opacity
|
5
|
+
- overlay_color: Color
|
6
|
+
- overlay_layout: Layout
|
4
7
|
- overlay_multi_directional: Multi-directional
|
5
8
|
- overlay_vertical_dynamic_multi_directional: Vertical Dynamic Multi-directional
|
6
9
|
- overlay_toggle: Toggle
|
@@ -1,4 +1,7 @@
|
|
1
1
|
export { default as OverlayDefault } from './_overlay_default.jsx'
|
2
|
+
export { default as OverlayGradientOpacity } from './_overlay_gradient_opacity.jsx'
|
3
|
+
export { default as OverlayColor } from './_overlay_color.jsx'
|
4
|
+
export { default as OverlayLayout } from './_overlay_layout.jsx'
|
2
5
|
export { default as OverlayMultiDirectional } from './_overlay_multi_directional.jsx'
|
3
6
|
export { default as OverlayToggle } from './_overlay_toggle.jsx'
|
4
7
|
export { default as OverlayVerticalDynamicMultiDirectional } from './_overlay_vertical_dynamic_multi_directional.jsx'
|
@@ -71,8 +71,46 @@ test('should add overlay-hide-scrollbar class when scrollBarNone is true', () =>
|
|
71
71
|
data: { testid: testId },
|
72
72
|
scrollBarNone: true
|
73
73
|
}
|
74
|
-
|
74
|
+
|
75
75
|
render(<Overlay {...props} />)
|
76
76
|
const kit = screen.getByTestId(testId)
|
77
77
|
expect(kit).toHaveClass('overlay-hide-scrollbar')
|
78
78
|
})
|
79
|
+
|
80
|
+
test('should have no_gradient class if gradient prop is false', () => {
|
81
|
+
const props = {
|
82
|
+
children,
|
83
|
+
data: { testid: testId },
|
84
|
+
id: testId,
|
85
|
+
gradient: false
|
86
|
+
}
|
87
|
+
|
88
|
+
render(<Overlay {...props} />)
|
89
|
+
const kit = screen.getByTestId(testId)
|
90
|
+
expect(kit).toHaveClass('no_gradient')
|
91
|
+
})
|
92
|
+
|
93
|
+
test('should not have no_gradient class if gradient is not passed', () => {
|
94
|
+
const props = {
|
95
|
+
children,
|
96
|
+
data: { testid: testId },
|
97
|
+
id: testId
|
98
|
+
}
|
99
|
+
|
100
|
+
render(<Overlay {...props} />)
|
101
|
+
const kit = screen.getByTestId(testId)
|
102
|
+
expect(kit).not.toHaveClass('no_gradient')
|
103
|
+
})
|
104
|
+
|
105
|
+
test('should have the correct opacity class if opacity prop is passed', () => {
|
106
|
+
const props = {
|
107
|
+
children,
|
108
|
+
data: { testid: testId },
|
109
|
+
id: testId,
|
110
|
+
opacity: "opacity_5"
|
111
|
+
}
|
112
|
+
|
113
|
+
render(<Overlay {...props} />)
|
114
|
+
const kit = screen.getByTestId(testId)
|
115
|
+
expect(kit).toHaveClass('opacity_5')
|
116
|
+
})
|