playbook_ui 14.17.0.pre.alpha.play1906overlaykitaddopacityandgradient7232 → 14.17.0.pre.alpha.playcdntest7233

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4eed786792f1c5eea97b75faecd6189cb039c81d91a3f999cb9caab3048b63e
4
- data.tar.gz: a88401324ebf090e25add4d906ac29e974536fc0800bedf80a3c74fb7e346524
3
+ metadata.gz: 876386e07608e48add16b3cac4356626c21d8ac34ad119992fa677533b09252b
4
+ data.tar.gz: d09e56e7d4a6e8e963579139cb4e0469b36591a38296eb42df18904a41a0676f
5
5
  SHA512:
6
- metadata.gz: a86ebc9438ea0abc1ad6dc17ccad0881ea85af8116da7dcc098f34555ecdbe4191ef2983fb458c1011ac8cc0a4941c0fafbc2a345babe4d9b286ad916f5e6bd3
7
- data.tar.gz: 2161ae14909692c4433b10399f95862a64685350fb43e03c1329574251291aaaf6bb0212d58f8b753c4c84b9570767293c6533554f0bad23663a9130b325fc18
6
+ metadata.gz: 4e5241baf0769fef68aee63106f2299b4ab6ce69865091cb94a5caf6de83da2d0c96657aa38a17ce1bc51dc7e33b1f3758d2b18a5eefe29ed55478924f2a988d
7
+ data.tar.gz: a7f4b0b20f5f3b64dc5285e39bea36f9810c42a87ef687d32f0befbc210098ad934f79abb2bf0b0e66dfef40aee1720265d0c9011d34cdaa2136e1120c871572
@@ -18,39 +18,34 @@ $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
25
21
  );
26
22
 
27
- @mixin overlay($direction, $size, $color, $apply_gradient: true) {
23
+ @mixin overlay($direction, $size, $color) {
28
24
  display: block;
29
25
  position: absolute;
30
26
  pointer-events: none;
31
27
  z-index: 1;
32
28
  content: "";
33
29
 
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;
30
+ @if $direction == "left" {
31
+ inset: 0 auto 0 0;
32
+ background: linear-gradient(to right, $color 0%, transparent 100%);
33
+ width: $size;
34
+ }
35
+ @if $direction == "right" {
36
+ inset: 0 0 0 auto;
37
+ background: linear-gradient(to left, $color 0%, transparent 100%);
38
+ width: $size;
39
+ }
40
+ @if $direction == "top" {
41
+ inset: 0 0 auto 0;
42
+ background: linear-gradient(to bottom, $color 0%, transparent 100%);
43
+ height: $size;
44
+ }
45
+ @if $direction == "bottom" {
46
+ inset: auto 0 0 0;
47
+ background: linear-gradient(to top, $color 0%, transparent 100%);
48
+ height: $size;
54
49
  }
55
50
  }
56
51
 
@@ -74,7 +69,7 @@ $overlay_colors: (
74
69
  pointer-events: none;
75
70
  z-index: 1;
76
71
  }
77
-
72
+
78
73
  &.overlay-hide-scrollbar {
79
74
  & [class*="overflow_x_auto"],
80
75
  & [class*="overflow_y_auto"],
@@ -82,31 +77,9 @@ $overlay_colors: (
82
77
  &::-webkit-scrollbar {
83
78
  display: none !important;
84
79
  }
85
-
80
+
86
81
  -ms-overflow-style: none !important;
87
82
  scrollbar-width: none !important;
88
83
  }
89
84
  }
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
- }
112
85
  }
@@ -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" | "black" | "white" | "success" | "error",
10
+ color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
11
11
  dynamic?: boolean,
12
12
  position: string,
13
13
  size: string,
@@ -18,16 +18,14 @@ 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" | "black" | "white" | "success" | "error",
21
+ color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
22
22
  data?: { [key: string]: string },
23
23
  dynamic?: false,
24
- gradient?: boolean,
25
24
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
26
25
  id?: string,
27
26
  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',
29
27
  scrollBarNone?: boolean,
30
-
28
+
31
29
  }
32
30
 
33
31
  const Overlay = (props: OverlayProps) => {
@@ -38,24 +36,15 @@ const Overlay = (props: OverlayProps) => {
38
36
  color = "card_light",
39
37
  data = {},
40
38
  dynamic = false,
41
- gradient = true,
42
39
  htmlOptions = {},
43
40
  id,
44
41
  layout = { "bottom": "full" },
45
- opacity,
46
42
  scrollBarNone = false,
47
43
  } = props
48
44
 
49
45
  const ariaProps = buildAriaProps(aria)
50
46
  const dataProps = buildDataProps(data)
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
- )
47
+ const classes = classnames(buildCss('pb_overlay'), { 'overlay-hide-scrollbar': scrollBarNone }, globalProps(props), className )
59
48
  const htmlProps = buildHtmlProps(htmlOptions)
60
49
  const dynamicInlineProps = globalInlineProps(props)
61
50
 
@@ -1 +1,7 @@
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.
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
+
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,9 +1,6 @@
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
7
4
  - overlay_multi_directional: Multi-directional
8
5
  - overlay_vertical_dynamic_multi_directional: Vertical Dynamic Multi-directional
9
6
  - overlay_toggle: Toggle
@@ -1,7 +1,4 @@
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'
5
2
  export { default as OverlayMultiDirectional } from './_overlay_multi_directional.jsx'
6
3
  export { default as OverlayToggle } from './_overlay_toggle.jsx'
7
4
  export { default as OverlayVerticalDynamicMultiDirectional } from './_overlay_vertical_dynamic_multi_directional.jsx'
@@ -71,46 +71,8 @@ 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
- })