playbook_ui 12.18.0 → 12.19.0

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: 0f60bb863c6a7be595fe8ffcaa866a7796a0bb896732cf7ba5990d40444e6405
4
+ data.tar.gz: a3e06332bf074ce75e69c35184fd624b26ee9bfd02efcfad057dbafbcac3c608
5
5
  SHA512:
6
- metadata.gz: ac985c76a200cc24cfb19fc1c7cf58f0ff7d1d514c5f1d3b25f49e191498a283096d57b046a3fdafbece5f51373c1bb3c92b03fe2b5c62557243b6b38813eb49
7
- data.tar.gz: bc02a9551e56ff2ba4ac05d4afa7cf9b488abe1d5b3293347798ceb8b563bea793fe6f64b1925eb70d4da1d649b6556e18e7586501feb12d73eb2850baf2bbce
6
+ metadata.gz: c30ebfe71f1649440d65fda7871d6c6b4d11a0ced08299f38b5de90bd9f0c3108e3179e54fcbe3a064ef0b0411a11eb76382fcb9e464b2cc5c88e7c57224b33d
7
+ data.tar.gz: dda14920f8aa81dc398a665fee7b51d4bbedf537669f297fe76b3f04df0b813b47229cff6e809571bf62bbaa00909e9956b6e77d1895e338a956b4d3bf6d947d
@@ -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 ------------------------*/
@@ -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.18.0"
5
+ VERSION = "12.19.0"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-03 00:00:00.000000000 Z
12
+ date: 2023-05-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack