playbook_ui 14.17.0.pre.alpha.play1499backgroundkitoverlay7105 → 14.17.0.pre.alpha.play1906overlaykitaddopacityandgradient7201
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_background/_background.scss +0 -26
- data/app/pb_kits/playbook/pb_background/_background.tsx +4 -8
- data/app/pb_kits/playbook/pb_background/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_background/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
- 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 +68 -0
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -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_default.md +4 -2
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +39 -1
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +19 -7
- data/dist/chunks/{_typeahead-ySWHB-7p.js → _typeahead-HqfDnjRe.js} +1 -1
- data/dist/chunks/{_weekday_stacked-36N8xzXL.js → _weekday_stacked--YupDiur.js} +2 -2
- 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/version.rb +1 -1
- metadata +18 -18
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +0 -36
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +0 -1
- /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,110 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import Flex from '../../pb_flex/_flex'
|
3
|
+
import Caption from '../../pb_caption/_caption'
|
4
|
+
import Draggable from '../_draggable'
|
5
|
+
import { DraggableProvider } from '../context'
|
6
|
+
import Image from '../../pb_image/_image'
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
const dataLineVertical = [
|
11
|
+
{
|
12
|
+
id: "211",
|
13
|
+
url: "https://unsplash.it/500/400/?image=633",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
id: "212",
|
17
|
+
url: "https://unsplash.it/500/400/?image=634",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
id: "213",
|
21
|
+
url: "https://unsplash.it/500/400/?image=637",
|
22
|
+
},
|
23
|
+
];
|
24
|
+
|
25
|
+
const dataLineHorizontal = [
|
26
|
+
{
|
27
|
+
id: "2111",
|
28
|
+
url: "https://unsplash.it/500/400/?image=633",
|
29
|
+
},
|
30
|
+
{
|
31
|
+
id: "2122",
|
32
|
+
url: "https://unsplash.it/500/400/?image=634",
|
33
|
+
},
|
34
|
+
{
|
35
|
+
id: "2133",
|
36
|
+
url: "https://unsplash.it/500/400/?image=637",
|
37
|
+
},
|
38
|
+
];
|
39
|
+
|
40
|
+
const DraggableDropZones = (props) => {
|
41
|
+
const [initialLineVerticalState, setInitialLineVerticalState] = useState(dataLineVertical);
|
42
|
+
const [initialLineHorizontalState, setInitialLineHorizontalState] = useState(dataLineHorizontal);
|
43
|
+
|
44
|
+
return (
|
45
|
+
<>
|
46
|
+
<Caption marginBottom="xs"
|
47
|
+
marginTop="xl"
|
48
|
+
text="Vertical"
|
49
|
+
/>
|
50
|
+
<DraggableProvider
|
51
|
+
dropZone={{ type: "line", color: "purple" }}
|
52
|
+
initialItems={dataLineVertical}
|
53
|
+
onReorder={(items) => setInitialLineVerticalState(items)}
|
54
|
+
>
|
55
|
+
<Draggable.Container {...props}>
|
56
|
+
<Flex flexDirection="column"
|
57
|
+
height="367px"
|
58
|
+
>
|
59
|
+
{initialLineVerticalState.map(({ id, url }) => (
|
60
|
+
<Draggable.Item dragId={id}
|
61
|
+
key={id}
|
62
|
+
marginBottom="sm"
|
63
|
+
>
|
64
|
+
<Image alt={id}
|
65
|
+
size="md"
|
66
|
+
url={url}
|
67
|
+
/>
|
68
|
+
</Draggable.Item>
|
69
|
+
))}
|
70
|
+
</Flex>
|
71
|
+
</Draggable.Container>
|
72
|
+
</DraggableProvider>
|
73
|
+
<Caption marginBottom="xs"
|
74
|
+
marginTop="xl"
|
75
|
+
text="Horizontal"
|
76
|
+
/>
|
77
|
+
<Flex>
|
78
|
+
<DraggableProvider
|
79
|
+
dropZone={{ type: "line", direction: "horizontal" }}
|
80
|
+
initialItems={dataLineHorizontal}
|
81
|
+
onReorder={(items) => setInitialLineHorizontalState(items)}
|
82
|
+
>
|
83
|
+
<Draggable.Container
|
84
|
+
htmlOptions={{style:{ width: "285px"}}}
|
85
|
+
{...props}
|
86
|
+
>
|
87
|
+
<Flex alignItems="stretch"
|
88
|
+
flexDirection="row"
|
89
|
+
height="110px"
|
90
|
+
>
|
91
|
+
{initialLineHorizontalState.map(({ id, url }) => (
|
92
|
+
<Draggable.Item dragId={id}
|
93
|
+
key={id}
|
94
|
+
marginRight="sm"
|
95
|
+
>
|
96
|
+
<Image alt={id}
|
97
|
+
size="md"
|
98
|
+
url={url}
|
99
|
+
/>
|
100
|
+
</Draggable.Item>
|
101
|
+
))}
|
102
|
+
</Flex>
|
103
|
+
</Draggable.Container>
|
104
|
+
</DraggableProvider>
|
105
|
+
</Flex>
|
106
|
+
</>
|
107
|
+
);
|
108
|
+
};
|
109
|
+
|
110
|
+
export default DraggableDropZones;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
When using the "line" style, make sure to set the appropriate `direction` attribute within the `dropZone` prop based on the orientation of your draggable view. By default, this is set to "vertical," but it can also be adjusted to "horizontal." Note that the direction attribute only applies to the "line" style and does not affect other drop zone styles. The default `color` for "line" is "primary" and "purple" is the only alternative color option.
|
2
|
+
|
3
|
+
The length of the line is calculated based off of the width (for "vertical") or height (for "horizontal") of the parent container holding the draggable items.
|
4
|
+
|
5
|
+
Additionally, if the parent container of the `DraggableProvider`/`DraggableContainer` (or a subcontainer within) does not have a set height (for "vertical") or width (for "horizontal"), like the [Draggable Drop Zones doc example](https://playbook.powerapp.cloud/kits/draggable/react#draggable-drop-zones) does, elements on the page may jump up (for "vertical") or to the left (for "horizontal") when an item is actively being dragged. To prevent this, give a parent element a fixed height (for "vertical") or width (for "horizontal") as demonstrated in this doc example.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
|
3
3
|
import Flex from '../../pb_flex/_flex'
|
4
|
-
import { DraggableProvider } from '
|
4
|
+
import { DraggableProvider } from '../context'
|
5
5
|
import Avatar from '../../pb_avatar/_avatar'
|
6
6
|
import Body from '../../pb_body/_body'
|
7
7
|
import Table from '../../pb_table/_table'
|
@@ -2,4 +2,6 @@ The draggable kit can also be used in conjunction with the table kit to create d
|
|
2
2
|
|
3
3
|
- Wrap the Table with the `DraggableProvider` and manage state as shown.
|
4
4
|
- use the `draggableContainer` prop on the Table.Body to designate it as the Draggable Container
|
5
|
-
- use the `draggableItem` prop on the Table.Row to designate it as the Draggable Item. Make sure to also pass id to the `dragId` prop here.
|
5
|
+
- use the `draggableItem` prop on the Table.Row to designate it as the Draggable Item. Make sure to also pass id to the `dragId` prop here.
|
6
|
+
|
7
|
+
We recommending using the default `dropZone type` with the Table kit.
|
@@ -4,14 +4,17 @@ examples:
|
|
4
4
|
- draggable_with_list: Draggable with List Kit
|
5
5
|
- draggable_with_selectable_list: Draggable with SelectableList Kit
|
6
6
|
- draggable_with_cards: Draggable with Cards
|
7
|
-
-
|
7
|
+
- draggable_with_table: Draggable with Table
|
8
8
|
- draggable_multiple_containers: Dragging Across Multiple Containers
|
9
|
+
- draggable_drop_zones: Draggable Drop Zones
|
10
|
+
- draggable_drop_zones_colors: Draggable Drop Zones Colors
|
11
|
+
- draggable_drop_zones_line: Draggable Drop Zones Line
|
9
12
|
|
10
13
|
rails:
|
11
|
-
-
|
12
|
-
-
|
13
|
-
-
|
14
|
-
-
|
14
|
+
- draggable_default: Default
|
15
|
+
- draggable_with_list: Draggable with List Kit
|
16
|
+
- draggable_with_selectable_list: Draggable with SelectableList Kit
|
17
|
+
- draggable_with_cards: Draggable with Cards
|
15
18
|
- draggable_with_table: Draggable with Table
|
16
|
-
-
|
19
|
+
- draggable_multiple_containers: Dragging Across Multiple Containers
|
17
20
|
|
@@ -3,4 +3,7 @@ export { default as DraggableWithCards } from './_draggable_with_cards.jsx'
|
|
3
3
|
export { default as DraggableWithList } from './_draggable_with_list.jsx'
|
4
4
|
export { default as DraggableWithSelectableList } from './_draggable_with_selectable_list.jsx'
|
5
5
|
export { default as DraggableMultipleContainers } from './_draggable_multiple_containers.jsx'
|
6
|
-
export { default as
|
6
|
+
export { default as DraggableWithTable } from './_draggable_with_table.jsx'
|
7
|
+
export { default as DraggableDropZones } from './_draggable_drop_zones.jsx'
|
8
|
+
export { default as DraggableDropZonesColors } from './_draggable_drop_zones_colors.jsx'
|
9
|
+
export { default as DraggableDropZonesLine } from './_draggable_drop_zones_line.jsx'
|
@@ -128,6 +128,58 @@ const DraggableKitWithCard = () => {
|
|
128
128
|
);
|
129
129
|
};
|
130
130
|
|
131
|
+
const DraggableWithLineVertical = () => {
|
132
|
+
const [initialState, setInitialState] = useState(data);
|
133
|
+
return (
|
134
|
+
<div data-testid={testId}>
|
135
|
+
<DraggableProvider
|
136
|
+
dropZone={{ type: "line" }}
|
137
|
+
initialItems={data}
|
138
|
+
onReorder={(items) => setInitialState(items)}
|
139
|
+
>
|
140
|
+
<Draggable>
|
141
|
+
<Draggable.Container>
|
142
|
+
{initialState.map(({ id, text }) => (
|
143
|
+
<Draggable.Item
|
144
|
+
dragId={id}
|
145
|
+
key={id}
|
146
|
+
>
|
147
|
+
{text}
|
148
|
+
</Draggable.Item>
|
149
|
+
))}
|
150
|
+
</Draggable.Container>
|
151
|
+
</Draggable>
|
152
|
+
</DraggableProvider>
|
153
|
+
</div>
|
154
|
+
);
|
155
|
+
};
|
156
|
+
|
157
|
+
const DraggableWithLineHorizontal = () => {
|
158
|
+
const [initialState, setInitialState] = useState(data);
|
159
|
+
return (
|
160
|
+
<div data-testid={testId}>
|
161
|
+
<DraggableProvider
|
162
|
+
dropZone={{ type: "line", direction: "horizontal" }}
|
163
|
+
initialItems={data}
|
164
|
+
onReorder={(items) => setInitialState(items)}
|
165
|
+
>
|
166
|
+
<Draggable>
|
167
|
+
<Draggable.Container>
|
168
|
+
{initialState.map(({ id, text }) => (
|
169
|
+
<Draggable.Item
|
170
|
+
dragId={id}
|
171
|
+
key={id}
|
172
|
+
>
|
173
|
+
{text}
|
174
|
+
</Draggable.Item>
|
175
|
+
))}
|
176
|
+
</Draggable.Container>
|
177
|
+
</Draggable>
|
178
|
+
</DraggableProvider>
|
179
|
+
</div>
|
180
|
+
);
|
181
|
+
};
|
182
|
+
|
131
183
|
test("generated default kit and classname", () => {
|
132
184
|
render(<DefaultDraggableKit />);
|
133
185
|
const kit = screen.getByTestId(testId);
|
@@ -188,3 +240,19 @@ test("generated dragHandle with Card", () => {
|
|
188
240
|
const dragHandle = card.querySelector(".pb_custom_icon");
|
189
241
|
expect(dragHandle).toBeInTheDocument();
|
190
242
|
});
|
243
|
+
|
244
|
+
test("line dropZone with default direction applies 'line_vertical' class to container", () => {
|
245
|
+
render(<DraggableWithLineVertical />);
|
246
|
+
const kit = screen.getByTestId(testId);
|
247
|
+
const container = kit.querySelector(".pb_draggable_container");
|
248
|
+
|
249
|
+
expect(container).toHaveClass("line_vertical");
|
250
|
+
});
|
251
|
+
|
252
|
+
test("line dropZone with horizontal direction applies 'line_horizontal' class to container", () => {
|
253
|
+
render(<DraggableWithLineHorizontal />);
|
254
|
+
const kit = screen.getByTestId(testId);
|
255
|
+
const container = kit.querySelector(".pb_draggable_container");
|
256
|
+
|
257
|
+
expect(container).toHaveClass("line_horizontal");
|
258
|
+
});
|
@@ -31,7 +31,7 @@ const DraggableContainer = (props: DraggableContainerProps) => {
|
|
31
31
|
} = contextValues;
|
32
32
|
|
33
33
|
// Only get direction if dropZone is 'line'
|
34
|
-
const direction = dropZone === 'line' ? (contextValues.direction || 'vertical') :
|
34
|
+
const direction = dropZone === 'line' ? (contextValues.direction || 'vertical') : null;
|
35
35
|
|
36
36
|
const ariaProps = buildAriaProps(aria);
|
37
37
|
const dataProps = buildDataProps(data);
|
@@ -41,8 +41,9 @@ const DraggableContainer = (props: DraggableContainerProps) => {
|
|
41
41
|
const classes = classnames(
|
42
42
|
buildCss("pb_draggable_container"),
|
43
43
|
`${activeContainer === container ? "active" : ""}`,
|
44
|
-
//
|
45
|
-
|
44
|
+
// Line variant gets line_{direction} classname on container no matter what
|
45
|
+
dropZone === 'line' && direction === 'vertical' ? 'line_vertical' : '',
|
46
|
+
dropZone === 'line' && direction === 'horizontal' ? 'line_horizontal' : '',
|
46
47
|
globalProps(props),
|
47
48
|
className
|
48
49
|
);
|
@@ -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
|
|
@@ -1,7 +1,9 @@
|
|
1
|
-
Overlays optionally accept a `color`, which sets the "start" (opaque) color of a gradient mask. Because this overlay is intended to reveal underlying content, the "end" color is fixed to transparent.
|
1
|
+
Overlays optionally accept a `color`, which sets the "start" (opaque) color of a gradient mask. Because this overlay is intended to reveal underlying content, the "end" color is fixed to transparent.
|
2
2
|
|
3
3
|
The optional `layout` prop accepts the `position` and `size` of the overlay as a key:value pair.
|
4
4
|
|
5
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
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).
|
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).
|
8
|
+
|
9
|
+
By default, the overlay is rendered as a gradient. Setting the `gradient` prop to `false` renders the overlay as a solid color using the value provided by the `color` prop. You can adjust the transparency of the solid overlay by using the `opacity` prop.
|
@@ -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
|
+
})
|
@@ -6,8 +6,20 @@
|
|
6
6
|
&.table-lg {
|
7
7
|
thead, .pb_table_thead {
|
8
8
|
tr, .pb_table_tr {
|
9
|
-
th
|
9
|
+
th:not(:has(
|
10
|
+
[class*="pb_body_kit"],
|
11
|
+
[class*="pb_detail_kit"],
|
12
|
+
[class*="pb_title_kit"]
|
13
|
+
)),
|
14
|
+
.pb_table_th:not(:has(
|
15
|
+
[class*="pb_body_kit"],
|
16
|
+
[class*="pb_detail_kit"],
|
17
|
+
[class*="pb_title_kit"]
|
18
|
+
)) {
|
10
19
|
@include caption;
|
20
|
+
}
|
21
|
+
|
22
|
+
th, .pb_table_th {
|
11
23
|
border-bottom: 1px solid $border_light;
|
12
24
|
}
|
13
25
|
}
|
@@ -83,10 +95,10 @@
|
|
83
95
|
|
84
96
|
// flatten out corners for floating headerstyle variant to avoid small triangle of white/empty space
|
85
97
|
.header-floating > thead > tr:first-child > th:first-child,
|
86
|
-
.header-floating > .pb_table_thead > .pb_table_tr:first-child > .pb_table_th:first-child {
|
87
|
-
border-top-left-radius: 0 !important;
|
88
|
-
}
|
89
|
-
.header-floating > thead > tr:first-child > th:last-child,
|
90
|
-
.header-floating > .pb_table_thead > .pb_table_tr:first-child > .pb_table_th:last-child {
|
91
|
-
border-top-right-radius: 0 !important;
|
98
|
+
.header-floating > .pb_table_thead > .pb_table_tr:first-child > .pb_table_th:first-child {
|
99
|
+
border-top-left-radius: 0 !important;
|
100
|
+
}
|
101
|
+
.header-floating > thead > tr:first-child > th:last-child,
|
102
|
+
.header-floating > .pb_table_thead > .pb_table_tr:first-child > .pb_table_th:last-child {
|
103
|
+
border-top-right-radius: 0 !important;
|
92
104
|
}
|