playbook_ui 12.16.0.pre.alpha.tooltippositionprop566 → 12.16.0

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: 1aa71e42598e3d4a2cc59995711033c0b2aabe7bb25a7c11254955f7c679a2ca
4
- data.tar.gz: a2e6816d1ab2faa4bb7b650e8445ec7797edcd753267c68aa4a136ce7220935b
3
+ metadata.gz: '09b7fe35bd640bdcbba17570366775211743d1f85c44a5dcb00db8013936743a'
4
+ data.tar.gz: 1a1a2f1936efa02380ca89c963f98f6aff52288a929430ff67c7b1e71e2e61da
5
5
  SHA512:
6
- metadata.gz: 11ac217ec0bfb4c58e087eaad581d77559b810589896f37bc96ab505c2aa2df6bcf0b4486ef646b681b241e8cbaf85efceee78685dd821f57d0555555d59b899
7
- data.tar.gz: 6dae5b2762529cfab815e82c7b0be2d9455bd2a2809732ad1860b1db948626db4e7dba0b9b9108e73528e873dc1dbd92da82976bf735996780d93fe251c9939f
6
+ metadata.gz: 20f0ff15258af1f924fe0ca2233e296fa5b6ce1678c6151f3289daab6f0580b9bcd2b4647f98a1a926230f9ac6af6ec1e634f3e82a55ad5bf38e752074b193da
7
+ data.tar.gz: ac0008d312f15ddefaf2f012684a4bcd2f05a33c54c95f913421fe5784dbc85c6efaf2ba52b7b9b96259e1dc318e3f4482677cd900b3166d59d7b7d8a6fc73bf
@@ -41,7 +41,7 @@ const CardBackground = (props) => {
41
41
  marginBottom="sm"
42
42
  {...props}
43
43
  >
44
- <Body text="Light"/>
44
+ <Body text="Light" />
45
45
  </Card>
46
46
 
47
47
 
@@ -1,299 +1,12 @@
1
- <% if !local_prop_data.present? %>
2
- <div data-action="toggle" data-togglable="prop_example" class="pb--propsTable">
1
+ <div data-action="toggle" data-togglable="prop_example" class="pb--propsTable">
3
2
  <%= pb_rails("title", props: { text: "Available Props", size: 3, margin_bottom: "sm" }) %>
4
- <%= pb_rails("card", props: { padding: "none" }) do %>
5
- <%= pb_rails("card/card_body", props: { padding: "sm" }) do %>
6
- <%= pb_rails("nav", props: { orientation: "horizontal", variant: "subtle" }) do %>
7
- <%= pb_rails("nav/item", props: { text: "Global Props", link: "#", active: true }) %>
8
- <% end %>
9
- <% end %>
10
- <%= pb_rails("section_separator") %>
11
- <%= pb_rails("card/card_body", props: {}) do %>
12
- <%= pb_rails("table", props: {container: false, disable_hover: true }) do %>
13
- <thead>
14
- <tr>
15
- <th>Props</th>
16
- <th>Type</th>
17
- <th>Values</th>
18
- <th>Default</th>
19
- </tr>
20
- </thead>
21
- <tbody>
22
- <% global_prop_data.each do |key, value|%>
23
- <tr>
24
- <td>
25
- <%= pb_rails("title", props: { text: key, tag: "h4", size: 4 }) %>
26
- </td>
27
- <td>
28
- <%= pb_rails("card", props: {
29
- classname: "card",
30
- padding: "xxs",
31
- background: "light",
32
- border_none: true,
33
- border_radius: "sm"
34
- }) do %>
35
- <%= pb_rails("body", props: {
36
- classname: "kearning"
37
- }) do %>
38
- <%= value[:type].downcase %>
39
- <% end %>
40
- <% end %>
41
- </td>
42
- <td>
43
- <% if value[:values].present? %>
44
- <% value[:values].each do |item| %>
45
- <% if item != nil %>
46
- <%= pb_rails("card", props: {
47
- flex_direction: "row",
48
- classname: "card",
49
- padding: "xxs",
50
- background: "light",
51
- border_none: true,
52
- border_radius: "sm",
53
- margin: "xxs"
54
- }) do %>
55
- <%= pb_rails("body", props: {
56
- classname: "kearning"
57
- }) do %>
58
- <%= item %>
59
- <% end %>
60
- <% end %>
61
- <% end %>
62
- <% end %>
63
- <% end %>
64
- </td>
65
- <td>
66
- <% if value[:default].present? || value[:default].is_a?(TrueClass) || value[:default].is_a?(FalseClass) %>
67
- <%= pb_rails("card", props: {
68
- classname: "card",
69
- padding: "xxs",
70
- background: "light",
71
- border_none: true,
72
- border_radius: "sm"
73
- }) do %>
74
- <%= pb_rails("body", props: {
75
- classname: "kearning"
76
- }) do %>
77
- <%= value[:default] %>
78
- <% end %>
79
- <% end %>
80
- <% end %>
81
- </td>
82
- </tr>
83
- <% end %>
84
- </tbody>
85
- <% end %>
86
- <% end %>
87
- <% end %>
88
- </div>
89
- <% else %>
90
- <div data-action="toggle" data-togglable="prop_example" class="pb--propsTable">
91
- <%= pb_rails("title", props: { text: "Available Props", size: 3, margin_bottom: "sm" }) %>
92
- <%= pb_rails("card", props: { padding: "none" }) do %>
93
- <%= pb_rails("card/card_body", props: { padding: "sm" }) do %>
94
- <%= pb_rails("nav", props: { orientation: "horizontal", variant: "subtle" }) do %>
95
- <% if local_prop_data.present? %>
96
- <%= pb_rails("nav/item", props: { text: "Kit Props", link: "#", active: true, id: "local-button-active", classname: "local-active" }) %>
97
- <% end %>
98
- <% if local_prop_data.present? %>
99
- <%= pb_rails("nav/item", props: { text: "Kit Props", link: "#", id: "local-button", classname: "global-active" }) %>
100
- <% end %>
101
- <%= pb_rails("nav/item", props: { text: "Global Props", link: "#", active: true, id: "global-button-active", classname: "global-active" }) %>
102
- <%= pb_rails("nav/item", props: { text: "Global Props", link: "#", id: "global-button", classname: "local-active" }) %>
103
- <% end %>
104
- <% end %>
105
- <%= pb_rails("section_separator") %>
106
- <%= pb_rails("card/card_body", props: {}) do %>
107
- <%= pb_rails("table", props: {container: false, disable_hover: true, id: "global-prop-table", classname: "global-active"}) do %>
108
- <thead>
109
- <tr>
110
- <th>Props</th>
111
- <th>Type</th>
112
- <th>Values</th>
113
- <th>Default</th>
114
- </tr>
115
- </thead>
116
- <tbody>
117
- <% global_prop_data.each do |key, value|%>
118
- <tr>
119
- <td>
120
- <%= pb_rails("title", props: { text: key, tag: "h4", size: 4 }) %>
121
- </td>
122
- <td>
123
- <%= pb_rails("card", props: {
124
- classname: "card",
125
- padding: "xxs",
126
- background: "light",
127
- border_none: true,
128
- border_radius: "sm"
129
- }) do %>
130
- <%= pb_rails("body", props: {
131
- classname: "kearning"
132
- }) do %>
133
- <%= value[:type].downcase %>
134
- <% end %>
135
- <% end %>
136
- </td>
137
- <td>
138
- <% if value[:values].present? %>
139
- <% value[:values].each do |item| %>
140
- <% if item != nil %>
141
- <%= pb_rails("card", props: {
142
- flex_direction: "row",
143
- classname: "card",
144
- padding: "xxs",
145
- background: "light",
146
- border_none: true,
147
- border_radius: "sm",
148
- margin: "xxs"
149
- }) do %>
150
- <%= pb_rails("body", props: {
151
- classname: "kearning"
152
- }) do %>
153
- <%= item %>
154
- <% end %>
155
- <% end %>
156
- <% end %>
157
- <% end %>
158
- <% end %>
159
- </td>
160
- <td>
161
- <% if value[:default].present? || value[:default].is_a?(TrueClass) || value[:default].is_a?(FalseClass) %>
162
- <%= pb_rails("card", props: {
163
- classname: "card",
164
- padding: "xxs",
165
- background: "light",
166
- border_none: true,
167
- border_radius: "sm"
168
- }) do %>
169
- <%= pb_rails("body", props: {
170
- classname: "kearning"
171
- }) do %>
172
- <%= value[:default] %>
173
- <% end %>
174
- <% end %>
175
- <% end %>
176
- </td>
177
- </tr>
178
- <% end %>
179
- </tbody>
180
- <% end %>
181
- <%= pb_rails("table", props: {container: false, disable_hover: true, id: "local-prop-table", classname: "local-active"}) do %>
182
- <thead>
183
- <tr>
184
- <th>Props</th>
185
- <th>Type</th>
186
- <th>Values</th>
187
- <th>Default</th>
188
- </tr>
189
- </thead>
190
- <tbody>
191
- <% local_prop_data.each do |key, value|%>
192
- <tr>
193
- <td>
194
- <%= pb_rails("title", props: { text: key, tag: "h4", size: 4 }) %>
195
- </td>
196
- <td>
197
- <%= pb_rails("card", props: {
198
- classname: "card",
199
- padding: "xxs",
200
- background: "light",
201
- border_none: true,
202
- border_radius: "sm"
203
- }) do %>
204
- <%= pb_rails("body", props: {
205
- classname: "kearning"
206
- }) do %>
207
- <%= value[:type].downcase %>
208
- <% end %>
209
- <% end %>
210
- </td>
211
- <td>
212
- <% if value[:values].present? %>
213
- <% value[:values].each do |item| %>
214
- <% if item != nil %>
215
- <%= pb_rails("card", props: {
216
- flex_direction: "row",
217
- classname: "card",
218
- padding: "xxs",
219
- background: "light",
220
- border_none: true,
221
- border_radius: "sm",
222
- margin: "xxs"
223
- }) do %>
224
- <%= pb_rails("body", props: {
225
- classname: "kearning"
226
- }) do %>
227
- <%= item %>
228
- <% end %>
229
- <% end %>
230
- <% end %>
231
- <% end %>
232
- <% end %>
233
- </td>
234
- <td>
235
- <% if value[:default].present? || value[:default].is_a?(TrueClass) || value[:default].is_a?(FalseClass) %>
236
- <%= pb_rails("card", props: {
237
- classname: "card",
238
- padding: "xxs",
239
- background: "light",
240
- border_none: true,
241
- border_radius: "sm"
242
- }) do %>
243
- <%= pb_rails("body", props: {
244
- classname: "kearning"
245
- }) do %>
246
- <%= value[:default] %>
247
- <% end %>
248
- <% end %>
249
- <% end %>
250
- </td>
251
- </tr>
252
- <% end %>
253
- </tbody>
3
+ <%= pb_rails("card", props: { padding: "none" }) do %>
4
+ <%= pb_rails("list", props: { xpadding: true }) do %>
5
+ <% kit_props.each do |key, _def| %>
6
+ <%= pb_rails("list/item") do %>
7
+ <%= key %>
254
8
  <% end %>
255
9
  <% end %>
256
10
  <% end %>
257
- </div>
258
- <% end %>
259
-
260
- <script>
261
-
262
- const globalNavAndTable = document.querySelectorAll('.global-active');
263
- const localNavAndTable = document.querySelectorAll('.local-active');
264
-
265
- globalNavAndTable.forEach(element => {
266
- element.style.display = 'none';
267
- });
268
-
269
- const globalButton = document.getElementById("global-button");
270
- if (globalButton) {
271
- globalButton.addEventListener("click", showGlobal);
272
- }
273
-
274
- const localButton = document.getElementById("local-button");
275
- if (localButton) {
276
- localButton.addEventListener("click", showLocal);
277
- }
278
-
279
- function showGlobal() {
280
- localNavAndTable.forEach(element => {
281
- element.style.display = 'none';
282
- });
283
-
284
- globalNavAndTable.forEach(element => {
285
- element.style.display = 'table';
286
- });
287
- }
288
-
289
- function showLocal() {
290
- localNavAndTable.forEach(element => {
291
- element.style.display = 'table';
292
- });
293
-
294
- globalNavAndTable.forEach(element => {
295
- element.style.display = 'none';
296
- });
297
- }
298
-
299
- </script>
11
+ <% end %>
12
+ </div>
@@ -5,48 +5,6 @@ module Playbook
5
5
  class KitApi < Playbook::KitBase
6
6
  prop :kit, type: Playbook::Props::String, required: true
7
7
 
8
- def kit_local_props
9
- local = []
10
- kit_props.each do |key, value|
11
- value.kit != Playbook::KitBase && local.push({ key: key, value: value })
12
- end
13
- local
14
- end
15
-
16
- def local_prop_data
17
- local_props = {}
18
-
19
- kit_local_props.each do |key, _value|
20
- name = key[:value].instance_variable_get(:@name)
21
- type = key[:value].class.to_s.split("::").last
22
- default = key[:value].instance_variable_get(:@default)
23
- values = key[:value].instance_variable_get(:@values)
24
- local_props[name.to_sym] = { "type": type, "default": default, "values": values }
25
- end
26
- local_props
27
- end
28
-
29
- def kit_global_props
30
- global = []
31
- kit_props.each do |key, value|
32
- value.kit == Playbook::KitBase && global.push({ key: key, value: value })
33
- end
34
- global
35
- end
36
-
37
- def global_prop_data
38
- global_props = {}
39
-
40
- kit_global_props.each do |key, _value|
41
- name = key[:value].instance_variable_get(:@name)
42
- type = key[:value].class.to_s.split("::").last
43
- default = key[:value].instance_variable_get(:@default)
44
- values = key[:value].instance_variable_get(:@values)
45
- global_props[name.to_sym] = { "type": type, "default": default, "values": values }
46
- end
47
- global_props
48
- end
49
-
50
8
  def kit_props
51
9
  kit_class.props
52
10
  end
@@ -1,5 +1,3 @@
1
- <% example_html = ERB.new(example).result %>
2
-
3
1
  <%= pb_rails("card", props: { classname: "pb--doc", padding: "none", dark: dark }) do %>
4
2
  <div class="pb--kit-example">
5
3
  <%= pb_rails("caption", props: { text: example_title, dark: dark }) %>
@@ -15,13 +13,6 @@
15
13
  <div id="code-wrapper">
16
14
  <div class="pb--codeControls">
17
15
  <ul>
18
- <% if type == "rails" %>
19
- <li>
20
- <a href="#" id="copy-<%= example_key %>-trigger" onclick="copyOnClick(`<%= example_html %>`, `copy-<%= example_key %>`)">
21
- Copy HTML
22
- </a>
23
- </li>
24
- <% end %>
25
16
  <li>
26
17
  <a href="#" id="toggle-open" data-toggle="code_example">Code Example</a>
27
18
  </li>
@@ -35,11 +26,3 @@
35
26
  </div>
36
27
  <% end %>
37
28
  <% end %>
38
-
39
- <script>
40
- function copyOnClick(content, elementID) {
41
- copyContent(content)
42
- }
43
-
44
- </script>
45
-
@@ -33,29 +33,12 @@ module Playbook
33
33
  def source
34
34
  @source ||= begin
35
35
  extension = type == "react" ? "jsx" : "html.erb"
36
- stringified_code = read_kit_file("_#{example_key}.#{extension}")
37
- sanitize_code(stringified_code)
36
+ read_kit_file("_#{example_key}.#{extension}")
38
37
  end
39
38
  end
40
39
 
41
40
  private
42
41
 
43
- def sanitize_code(stringified_code)
44
- stringified_code = stringified_code.gsub('"../.."', '"playbook-ui"')
45
- .gsub('"../../"', '"playbook-ui"')
46
- .gsub("'../../'", "'playbook-ui'")
47
- .gsub("'../..'", "'playbook-ui'")
48
- .gsub(%r{from "../.*}, "from 'playbook-ui'")
49
- .gsub(%r{from '../.*}, "from 'playbook-ui'")
50
- stringified_code = dark ? stringified_code.gsub("{...props}", "dark") : stringified_code.gsub(/\s*{...props}\s*\n/, "\n")
51
- if stringified_code.include?("props: { ")
52
- stringified_code = stringified_code.gsub("props: {", "props: {dark: true,") if type == "rails" && dark
53
- elsif type == "rails" && dark
54
- stringified_code = stringified_code.gsub("props: {", "props: {\n dark: true,")
55
- end
56
- stringified_code
57
- end
58
-
59
42
  def read_kit_file(*args)
60
43
  path = ::Playbook.kit_path(kit, "docs", *args)
61
44
  path.exist? ? path.read : ""
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import Image from '../_image'
4
4
 
5
- const DefaultImage = (props) => {
5
+ const DefaultImage = (props: any) => {
6
6
  return (
7
7
  <>
8
8
  <br />
@@ -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,6 +17,9 @@ 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
+
20
23
  type TooltipProps = {
21
24
  aria?: { [key: string]: string },
22
25
  className?: string | string[],
@@ -26,8 +29,8 @@ type TooltipProps = {
26
29
  icon?: string,
27
30
  interaction?: boolean,
28
31
  placement?: Placement,
29
- position: "absolute" | "fixed";
30
32
  text: string,
33
+ zIndex?: Pick<GlobalProps, "ZIndex">,
31
34
  } & GlobalProps
32
35
 
33
36
  const Tooltip = (props: TooltipProps): React.ReactElement => {
@@ -40,7 +43,6 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
40
43
  icon = null,
41
44
  interaction = false,
42
45
  placement: preferredPlacement = "top",
43
- position = "absolute",
44
46
  text,
45
47
  zIndex,
46
48
  ...rest
@@ -48,26 +50,24 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
48
50
 
49
51
  const dataProps: { [key: string]: any } = buildDataProps(data)
50
52
  const ariaProps: { [key: string]: any } = buildAriaProps(aria)
51
-
53
+
52
54
  const css = classnames(
53
55
  globalProps({...rest}),
54
56
  className,
55
57
  )
56
58
  const [open, setOpen] = useState(false)
57
59
  const arrowRef = useRef(null)
58
-
59
-
60
60
  const {
61
+
61
62
  context,
62
63
  floating,
63
- middlewareData: { arrow: { x: arrowX, y: arrowY } = {}, },
64
+ middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },
64
65
  placement,
65
66
  reference,
66
67
  strategy,
67
68
  x,
68
69
  y,
69
70
  } = useFloating({
70
- strategy: position,
71
71
  middleware: [
72
72
  arrow({
73
73
  element: arrowRef,
@@ -87,7 +87,6 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
87
87
  placement: preferredPlacement
88
88
  })
89
89
 
90
-
91
90
  const { getFloatingProps } = useInteractions([
92
91
  useHover(context, {
93
92
  delay,
@@ -143,7 +142,7 @@ const Tooltip = (props: TooltipProps): React.ReactElement => {
143
142
  className="arrow_bg"
144
143
  ref={arrowRef}
145
144
  style={{
146
- position: "absolute",
145
+ position: strategy,
147
146
  left: arrowX != null ? `${arrowX}px` : "",
148
147
  top: arrowY != null ? `${arrowY}px` : "",
149
148
  [staticSide]: "-5px",
@@ -65,32 +65,3 @@ 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
- });
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "12.16.0"
5
- VERSION = "12.16.0.pre.alpha.tooltippositionprop566"
4
+ PREVIOUS_VERSION = "12.15.0"
5
+ VERSION = "12.16.0"
6
6
  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.16.0.pre.alpha.tooltippositionprop566
4
+ version: 12.16.0
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-04-27 00:00:00.000000000 Z
12
+ date: 2023-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -1221,7 +1221,7 @@ files:
1221
1221
  - app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
1222
1222
  - app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
1223
1223
  - app/pb_kits/playbook/pb_image/docs/_default_image.html.erb
1224
- - app/pb_kits/playbook/pb_image/docs/_default_image.jsx
1224
+ - app/pb_kits/playbook/pb_image/docs/_default_image.tsx
1225
1225
  - app/pb_kits/playbook/pb_image/docs/_description.md
1226
1226
  - app/pb_kits/playbook/pb_image/docs/_rounded_image.html.erb
1227
1227
  - app/pb_kits/playbook/pb_image/docs/_rounded_image.jsx
@@ -2468,7 +2468,7 @@ homepage: http://playbook.powerapp.cloud
2468
2468
  licenses:
2469
2469
  - ISC
2470
2470
  metadata: {}
2471
- post_install_message:
2471
+ post_install_message:
2472
2472
  rdoc_options: []
2473
2473
  require_paths:
2474
2474
  - lib
@@ -2479,12 +2479,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
2479
2479
  version: '0'
2480
2480
  required_rubygems_version: !ruby/object:Gem::Requirement
2481
2481
  requirements:
2482
- - - ">"
2482
+ - - ">="
2483
2483
  - !ruby/object:Gem::Version
2484
- version: 1.3.1
2484
+ version: '0'
2485
2485
  requirements: []
2486
2486
  rubygems_version: 3.3.7
2487
- signing_key:
2487
+ signing_key:
2488
2488
  specification_version: 4
2489
2489
  summary: Playbook Design System
2490
2490
  test_files: []