playbook_ui 12.18.0 → 12.19.0.pre.alpha.PLAY699zindexresponsive650

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 066fe5069146426c6fb9111de27a23e19513b840bc5c0173fe862f05c9a6ad3a
4
- data.tar.gz: b72f2e69c675d622a6dbdebec865da68d2914cadafa00b2f729319cb66b9e442
3
+ metadata.gz: 79e97a67011051e8187bac717ed8b2cc199f71e734a3d239384343489dc52c0b
4
+ data.tar.gz: 0c8a7f21df4e5190feee41f12a69513721bff189a83d9d41184bd25930effb6e
5
5
  SHA512:
6
- metadata.gz: ac985c76a200cc24cfb19fc1c7cf58f0ff7d1d514c5f1d3b25f49e191498a283096d57b046a3fdafbece5f51373c1bb3c92b03fe2b5c62557243b6b38813eb49
7
- data.tar.gz: bc02a9551e56ff2ba4ac05d4afa7cf9b488abe1d5b3293347798ceb8b563bea793fe6f64b1925eb70d4da1d649b6556e18e7586501feb12d73eb2850baf2bbce
6
+ metadata.gz: 854df41d949dee72464fc27f20827fc741399c06af493e40f49e18e55e61d0e419f5a70a061f9be357f9f466e981f39b7b3b95f89da7a46d6ae85820f93fcd3c
7
+ data.tar.gz: '09057a46d7390ad744d988ec907ddb53e4e1fd0d3afd8945b04c1c59e5b3c77c98beca823c3341e5ce054649ba487647ce42cc5f003fd99bc63bb6cdeb917981'
@@ -11,8 +11,12 @@ export default class PbTable extends PbEnhancedElement {
11
11
  // Each Table
12
12
  [].forEach.call(tables, (table: HTMLTableElement) => {
13
13
  // Header Titles
14
- var headers = [].map.call(table.querySelectorAll('th'), (header: Element) => {
15
- return header.textContent.replace(/\r?\n|\r/, '')
14
+ let headers: string[] = [];
15
+ [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
16
+ let colSpan = header.colSpan
17
+ for (let i = 0; i < colSpan; i++) {
18
+ headers.push(header.textContent.replace(/\r?\n|\r/, ''));
19
+ }
16
20
  });
17
21
 
18
22
  // for each row in tbody
@@ -6,7 +6,7 @@ import {
6
6
  offset,
7
7
  Placement,
8
8
  safePolygon,
9
- shift,
9
+ shift,
10
10
  useFloating,
11
11
  useHover,
12
12
  useInteractions,
@@ -17,9 +17,6 @@ import { GlobalProps, globalProps } from "../utilities/globalProps"
17
17
  import { buildAriaProps, buildDataProps } from "../utilities/props"
18
18
  import Flex from "../pb_flex/_flex"
19
19
 
20
-
21
-
22
-
23
20
  type TooltipProps = {
24
21
  aria?: { [key: string]: string },
25
22
  className?: string | string[],
@@ -29,8 +26,8 @@ type TooltipProps = {
29
26
  icon?: string,
30
27
  interaction?: boolean,
31
28
  placement?: Placement,
29
+ position?: "absolute" | "fixed";
32
30
  text: string,
33
- zIndex?: Pick<GlobalProps, "ZIndex">,
34
31
  } & GlobalProps
35
32
 
36
33
  const Tooltip = (props: TooltipProps): React.ReactElement => {
@@ -43,6 +40,7 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
43
40
  icon = null,
44
41
  interaction = false,
45
42
  placement: preferredPlacement = "top",
43
+ position = "absolute",
46
44
  text,
47
45
  zIndex,
48
46
  ...rest
@@ -50,24 +48,26 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
50
48
 
51
49
  const dataProps: { [key: string]: any } = buildDataProps(data)
52
50
  const ariaProps: { [key: string]: any } = buildAriaProps(aria)
53
-
51
+
54
52
  const css = classnames(
55
53
  globalProps({...rest}),
56
54
  className,
57
55
  )
58
56
  const [open, setOpen] = useState(false)
59
57
  const arrowRef = useRef(null)
60
- const {
61
58
 
59
+
60
+ const {
62
61
  context,
63
62
  floating,
64
- middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },
63
+ middlewareData: { arrow: { x: arrowX, y: arrowY } = {}, },
65
64
  placement,
66
65
  reference,
67
66
  strategy,
68
67
  x,
69
68
  y,
70
69
  } = useFloating({
70
+ strategy: position,
71
71
  middleware: [
72
72
  arrow({
73
73
  element: arrowRef,
@@ -87,6 +87,7 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
87
87
  placement: preferredPlacement
88
88
  })
89
89
 
90
+
90
91
  const { getFloatingProps } = useInteractions([
91
92
  useHover(context, {
92
93
  delay,
@@ -142,7 +143,7 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
142
143
  className="arrow_bg"
143
144
  ref={arrowRef}
144
145
  style={{
145
- position: strategy,
146
+ position: "absolute",
146
147
  left: arrowX != null ? `${arrowX}px` : "",
147
148
  top: arrowY != null ? `${arrowY}px` : "",
148
149
  [staticSide]: "-5px",
@@ -154,4 +155,4 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
154
155
  )
155
156
  }
156
157
 
157
- export default Tooltip
158
+ export default Tooltip
@@ -65,3 +65,32 @@ test("closes on mouseleave", async () => {
65
65
 
66
66
  cleanup();
67
67
  });
68
+
69
+ test("has default position absolute", async () => {
70
+ render(<TooltipTest />);
71
+
72
+ fireEvent.mouseEnter(screen.getByRole("tooltip_trigger"));
73
+ await waitFor(() => {
74
+ expect(screen.queryByRole("tooltip")).toHaveStyle({"position": "absolute"});
75
+ cleanup();
76
+ })
77
+
78
+ cleanup();
79
+ });
80
+
81
+ test("has position fixed", async () => {
82
+ render(
83
+ <Tooltip
84
+ data={{ testid: "fixed-position-test" }}
85
+ position="fixed"
86
+ />
87
+ );
88
+
89
+ fireEvent.mouseEnter(screen.getByRole("tooltip_trigger"));
90
+ await waitFor(() => {
91
+ expect(screen.queryByRole("tooltip")).toHaveStyle({"position": "fixed"});
92
+ cleanup();
93
+ })
94
+
95
+ cleanup();
96
+ });
@@ -68,7 +68,7 @@ $background_colors: (
68
68
 
69
69
  /* Card colors ------------------*/
70
70
  $card_light: $white !default;
71
- $card_dark: rgba($white, $opacity_1) !default;
71
+ $card_dark: mix(white, $bg_dark, 10%) !default;
72
72
  $card_colors: (
73
73
  card_light: $card_light,
74
74
  card_dark: $card_dark
@@ -109,16 +109,18 @@ $focus_input_colors: (
109
109
 
110
110
  /* Border colors ----------------------*/
111
111
  $border_light: #E4E8F0 !default;
112
- $border_dark: rgba($white, $opacity_1) !default;
112
+ $border_dark: mix(white, $bg_dark, 20%) !default;
113
113
  $border_colors: (
114
114
  border_light: $border_light,
115
115
  border_dark: $border_dark
116
116
  );
117
117
 
118
118
  /* Shadow colors ----------------------*/
119
- $shadow: rgba(#3C6AAC, $opacity_2) !default;
119
+ $shadow: rgba(#3C6AAC, $opacity_2) !default;
120
+ $shadow_dark: $bg_dark !default;
120
121
  $shadow_colors: (
121
122
  shadow: $shadow,
123
+ shadow_dark: $shadow_dark,
122
124
  );
123
125
 
124
126
  /* Text colors ------------------------*/
@@ -48,3 +48,17 @@
48
48
  .z_index_10 {
49
49
  z-index: 1000;
50
50
  }
51
+
52
+ $zIndex_values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
53
+
54
+ @each $size, $size_value in $breakpoints_grid {
55
+ @each $zIndex_value in $zIndex_values {
56
+ $min_size: map-get($size_value, "min");
57
+ $max_size: map-get($size_value, "max");
58
+ .z_index_#{$size}_#{$zIndex_value} {
59
+ @include break_on($min_size, $max_size) {
60
+ z-index: #{$zIndex_value * 100} !important;
61
+ }
62
+ }
63
+ }
64
+ }
@@ -113,9 +113,11 @@ type Shadow = {
113
113
 
114
114
  type Space = "spaceBetween" | "spaceAround" | "spaceEvenly"
115
115
 
116
+ type ZIndexType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
117
+ type ZIndexResponsiveType = {[key: string]: ZIndexType}
116
118
  type ZIndex = {
117
- zIndex?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10,
118
- }
119
+ zIndex?: ZIndexType,
120
+ } | ZIndexResponsiveType
119
121
 
120
122
  // keep this as the last type definition
121
123
  export type GlobalProps = AlignContent & AlignItems & AlignSelf &
@@ -178,9 +180,19 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
178
180
  css += maxWidth ? `max_width_${maxWidth } ` : ''
179
181
  return css
180
182
  },
181
- zIndexProps: ({ zIndex }: ZIndex) => {
183
+ zIndexProps: (zIndex: ZIndex) => {
182
184
  let css = ''
183
- css += zIndex ? `z_index_${zIndex } ` : ''
185
+ Object.entries(zIndex).forEach((zIndexEntry) => {
186
+ if (zIndexEntry[0] == "zIndex") {
187
+ if (typeof zIndexEntry[1] == "number") {
188
+ css += `z_index_${zIndexEntry[1]} `
189
+ } else if (typeof zIndexEntry[1] == "object") {
190
+ Object.entries(zIndexEntry[1]).forEach((zIndexObj) => {
191
+ css += `z_index_${zIndexObj[0]}_${zIndexObj[1]} `
192
+ })
193
+ }
194
+ }
195
+ })
184
196
  return css
185
197
  },
186
198
  shadowProps: ({ shadow }: Shadow) => {
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "12.17.1"
5
- VERSION = "12.18.0"
4
+ PREVIOUS_VERSION = "12.19.0"
5
+ VERSION = "12.19.0.pre.alpha.PLAY699zindexresponsive650"
6
6
  end
@@ -16,16 +16,29 @@ module Playbook
16
16
  }
17
17
  end
18
18
 
19
- private
19
+ def screen_size_values
20
+ %w[xs sm md lg xl]
21
+ end
20
22
 
21
23
  def z_index_props
22
- selected_index_props = z_index_options.keys.select { |sk| try(sk) }
23
- return nil unless selected_index_props.present?
24
+ selected_props = z_index_options.keys.select { |sk| try(sk) }
25
+ return nil unless selected_props.present?
26
+
27
+ responsive = selected_props.present? && try(:z_index).is_a?(::Hash)
28
+ css = ""
29
+ if responsive
30
+ z_index_value = send(:z_index)
31
+ z_index_value.each do |key, value|
32
+ css += "z_index_#{key}_#{value} " if screen_size_values.include?(key.to_s) && z_index_values.include?(value.to_s)
33
+ end
34
+ else
35
+ selected_props.each do |k|
36
+ z_index_value = send(k)
37
+ css += "z_index_#{z_index_value} " if z_index_values.include? z_index_value
38
+ end
39
+ end
24
40
 
25
- selected_index_props.map do |k|
26
- index_value = send(k)
27
- "z_index_#{index_value}" if z_index_values.include? index_value
28
- end.compact.join(" ")
41
+ css unless css.blank?
29
42
  end
30
43
  end
31
44
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.18.0
4
+ version: 12.19.0.pre.alpha.PLAY699zindexresponsive650
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
8
8
  - Power Devs
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-03 00:00:00.000000000 Z
12
+ date: 2023-05-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -2485,7 +2485,7 @@ homepage: http://playbook.powerapp.cloud
2485
2485
  licenses:
2486
2486
  - ISC
2487
2487
  metadata: {}
2488
- post_install_message:
2488
+ post_install_message:
2489
2489
  rdoc_options: []
2490
2490
  require_paths:
2491
2491
  - lib
@@ -2496,12 +2496,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
2496
2496
  version: '0'
2497
2497
  required_rubygems_version: !ruby/object:Gem::Requirement
2498
2498
  requirements:
2499
- - - ">="
2499
+ - - ">"
2500
2500
  - !ruby/object:Gem::Version
2501
- version: '0'
2501
+ version: 1.3.1
2502
2502
  requirements: []
2503
2503
  rubygems_version: 3.3.7
2504
- signing_key:
2504
+ signing_key:
2505
2505
  specification_version: 4
2506
2506
  summary: Playbook Design System
2507
2507
  test_files: []