playbook_ui 15.3.0.pre.alpha.PLAY2012currencyallownonstring11972 → 15.3.0.pre.alpha.PLAY2322popoverconditionalrender11766

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +0 -15
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +1 -4
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +2 -3
  5. data/app/pb_kits/playbook/pb_currency/_currency.tsx +7 -20
  6. data/app/pb_kits/playbook/pb_currency/currency.rb +8 -35
  7. data/app/pb_kits/playbook/pb_currency/currency.test.js +0 -47
  8. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
  9. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +1 -1
  10. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +0 -2
  11. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.md +1 -1
  12. data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.html.erb +14 -7
  13. data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.jsx +15 -6
  14. data/app/pb_kits/playbook/pb_popover/_popover.scss +12 -0
  15. data/app/pb_kits/playbook/pb_popover/_popover.tsx +5 -26
  16. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.jsx +7 -0
  17. data/app/pb_kits/playbook/pb_popover/docs/example.yml +0 -1
  18. data/app/pb_kits/playbook/pb_popover/docs/hook/useSmallScreenIndicator.tsx +27 -0
  19. data/app/pb_kits/playbook/pb_popover/docs/index.js +0 -1
  20. data/app/pb_kits/playbook/pb_popover/popover.test.js +0 -80
  21. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +0 -29
  22. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -2
  23. data/app/pb_kits/playbook/pb_table/docs/index.js +0 -1
  24. data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -2
  25. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +0 -41
  26. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +9 -23
  27. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_options.html.erb +1 -67
  28. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.jsx +6 -68
  29. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
  30. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -2
  31. data/dist/chunks/{_line_graph-CqE0-dq5.js → _line_graph-BxC7m53J.js} +1 -1
  32. data/dist/chunks/_typeahead-B1SiFvbF.js +6 -0
  33. data/dist/chunks/{_weekday_stacked-DFwAiApZ.js → _weekday_stacked-DxdwXyYM.js} +2 -2
  34. data/dist/chunks/vendor.js +1 -1
  35. data/dist/playbook-doc.js +2 -2
  36. data/dist/playbook-rails-react-bindings.js +1 -1
  37. data/dist/playbook-rails.js +1 -1
  38. data/dist/playbook.css +1 -1
  39. data/lib/playbook/version.rb +1 -1
  40. metadata +7 -16
  41. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.md +0 -1
  42. data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.jsx +0 -68
  43. data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to_react.md +0 -1
  44. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible.html.erb +0 -63
  45. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible.jsx +0 -89
  46. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible_rails.md +0 -4
  47. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible_react.md +0 -3
  48. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.html.erb +0 -64
  49. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.jsx +0 -70
  50. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.md +0 -1
  51. data/dist/chunks/_typeahead-3ZAbZUqU.js +0 -6
  52. /data/app/pb_kits/playbook/pb_popover/docs/{_popover_append_to_rails.md → _popover_append_to.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42d45c331ca506d6fccb7e7314717f32162b05f1a731f2116b967a9ec778d033
4
- data.tar.gz: 26dd29ee31ee473718cdce8a5650650b548567f9f032743094e101021540b49c
3
+ metadata.gz: 3f59d7e7c4376efeb5b93d1b598f303d41137dbf51803939bfc58fe39bf2111c
4
+ data.tar.gz: 7a6940c220be0ca9d18b3e2cd9a283539d66df7ee26245320d22e676b8244d93
5
5
  SHA512:
6
- metadata.gz: b29d46b6fad0bee27efc45f4a24af0d4e3771e92b162c96ad88c46dabf5802bfe4998d7d062128746a802b596d5fae29ec00b80434e33c49673477acd7c5aa54
7
- data.tar.gz: 39734ec58552ba6b7ffc907ee0cb9ddb2158dbca3183cc35218d377e4d22f268d5c7cf4191b2f676837e54a893cb09301a99f58ea4efae4aa9aac97da2db0d19
6
+ metadata.gz: f0aff746453cdd793520c58b60da087f0ed804622f33c98b25869cfdb19bb6a601ba4488772991c9edadf3e5bfbcfa1a8be38a883280f229ef62d0c761e7a4c6
7
+ data.tar.gz: 807933083868d271c5d7ae0f2b3d0519ca4d35feb9ad1890cbcc3c0cd84c4e24690ee76151bafe2271eefc2683bf03f0ee396738951e77f1ec9307736135c583
@@ -250,21 +250,6 @@ export function useTableState({
250
250
  }
251
251
  }, [pagination, inlineRowLoading, paginationProps?.pageIndex, paginationProps?.pageSize]);
252
252
 
253
- // Call the callback with the new page index when localPagination.pageIndex changes (with inlineRowLoading)
254
- useEffect(() => {
255
- if (pagination && inlineRowLoading && paginationProps?.onPageChange) {
256
- paginationProps.onPageChange(localPagination.pageIndex);
257
- }
258
- }, [localPagination.pageIndex, pagination, inlineRowLoading, paginationProps]);
259
-
260
- // Call the callback with the new page index when localPagination.pageIndex changes (without inlineRowLoading)
261
- useEffect(() => {
262
- if (pagination && !inlineRowLoading && paginationProps?.onPageChange) {
263
- const currentPageIndex = table.getState().pagination.pageIndex;
264
- paginationProps.onPageChange(currentPageIndex);
265
- }
266
- }, [table.getState().pagination.pageIndex, pagination, inlineRowLoading, paginationProps]);
267
-
268
253
  // Check if table has any sub-rows
269
254
  const hasAnySubRows = table.getRowModel().rows.some(row => row.subRows && row.subRows.length > 0);
270
255
  const selectedRowsLength = Object.keys(table.getState().rowSelection).length;
@@ -38,10 +38,7 @@ const AdvancedTablePaginationWithProps = (props) => {
38
38
  const paginationProps = {
39
39
  pageIndex: 1,
40
40
  pageSize: 10,
41
- range: 2,
42
- onPageChange: (pageIndex) => {
43
- console.log('Current page index:', pageIndex);
44
- }
41
+ range: 2
45
42
  }
46
43
 
47
44
  return (
@@ -1,6 +1,5 @@
1
- `paginationProps` is an optional prop that can be used to further customize pagination for the AdvancedTable. This prop is an object with the following optional items:
1
+ `paginationProps` is an optional prop that can be used to further customize pagination for the AdvancedTable. This prop is an object with 2 optional items:
2
2
 
3
3
  - `pageIndex`: An optional prop to set which page is set to open on initial load. Default is '0'
4
4
  - `pageSize`: An optional prop to set total number of rows for each page before the Table paginates. Default is '20'
5
- - `range`: The range prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the range prop. See [here for more details](https://playbook.powerapp.cloud/kits/pagination/react#default). Default is set to '5'
6
- - `onPageChange`: A callback function that gives to access to the current page index.
5
+ - `range`: The range prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the range prop. See [here for more details](https://playbook.powerapp.cloud/kits/pagination/react#default). Default is set to '5'
@@ -11,7 +11,7 @@ import Title from '../pb_title/_title'
11
11
  type CurrencyProps = {
12
12
  abbreviate?: boolean,
13
13
  align?: 'center' | 'left' | 'right',
14
- amount: string | number,
14
+ amount: string,
15
15
  aria?: {[key:string]:string},
16
16
  className?: string,
17
17
  dark?: boolean,
@@ -59,19 +59,6 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
59
59
  commaSeparator = false,
60
60
  } = props
61
61
 
62
- // Convert numeric input to string format
63
- const convertAmount = (input: string | number): string => {
64
- if (typeof input === 'number') {
65
- if (input === 0 && !nullDisplay) {
66
- return ""
67
- }
68
- return input.toFixed(2)
69
- }
70
- return input
71
- }
72
-
73
- const currencyAmount = convertAmount(amount)
74
-
75
62
  const emphasizedClass = emphasized ? '' : '_deemphasized'
76
63
 
77
64
  let variantClass
@@ -81,7 +68,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
81
68
  variantClass = '_bold'
82
69
  }
83
70
 
84
- const [whole, decimal = '00'] = currencyAmount.split('.')
71
+ const [whole, decimal = '00'] = amount.split('.')
85
72
  const ariaProps = buildAriaProps(aria)
86
73
  const dataProps = buildDataProps(data)
87
74
  const htmlProps = buildHtmlProps(htmlOptions)
@@ -105,19 +92,19 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
105
92
  return isAmount ? num.slice(0, -1) : isUnit ? num.slice(-1) : ''
106
93
  }
107
94
 
108
- const getMatchingDecimalAmount = decimals === "matching" ? currencyAmount : whole
95
+ const getMatchingDecimalAmount = decimals === "matching" ? amount : whole
109
96
  const getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
110
97
 
111
98
  const formatAmount = (amount: string) => {
112
99
  if (!commaSeparator) return amount;
113
-
100
+
114
101
  const [wholePart, decimalPart] = amount.split('.');
115
102
  const formattedWhole = new Intl.NumberFormat('en-US').format(parseInt(wholePart));
116
103
  return decimalPart ? `${formattedWhole}.${decimalPart}` : formattedWhole;
117
104
  }
118
105
 
119
106
  const swapNegative = size === "sm" && symbol !== ""
120
- const handleNegative = currencyAmount.startsWith("-") && swapNegative ? "-" : ""
107
+ const handleNegative = amount.startsWith("-") && swapNegative ? "-" : ""
121
108
  const getAbsoluteAmount = (amountString: string) => amountString.replace(/^-/,'')
122
109
  const getAbbrOrFormatAmount = abbreviate ? getAbbreviatedValue('amount') : formatAmount(getMatchingDecimalAmount)
123
110
  const getAmount = swapNegative ? getAbsoluteAmount(getAbbrOrFormatAmount) : getAbbrOrFormatAmount
@@ -165,7 +152,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
165
152
  >
166
153
  {handleNegative}{symbol}
167
154
  </Body>
168
-
155
+
169
156
  <Title
170
157
  className="pb_currency_value"
171
158
  dark={dark}
@@ -173,7 +160,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
173
160
  >
174
161
  {getAmount}
175
162
  </Title>
176
-
163
+
177
164
  <Body
178
165
  className="unit"
179
166
  color="light"
@@ -17,7 +17,8 @@ module Playbook
17
17
  prop :symbol, type: Playbook::Props::String,
18
18
  default: "$"
19
19
 
20
- prop :amount, required: true
20
+ prop :amount, type: Playbook::Props::String,
21
+ required: true
21
22
 
22
23
  prop :unit, type: Playbook::Props::String,
23
24
  required: false
@@ -91,7 +92,7 @@ module Playbook
91
92
  end
92
93
 
93
94
  def negative_sign
94
- currency_amount.starts_with?("-") && swap_negative ? "-" : ""
95
+ amount.starts_with?("-") && swap_negative ? "-" : ""
95
96
  end
96
97
 
97
98
  def body_props
@@ -116,32 +117,10 @@ module Playbook
116
117
  end
117
118
  end
118
119
 
119
- def currency_amount
120
- @currency_amount ||= convert_amount(amount)
121
- end
122
-
123
120
  private
124
121
 
125
- # Convert numeric input to string format
126
- def convert_amount(input)
127
- if input.is_a?(Numeric)
128
- if input.zero? && null_display.nil?
129
- ""
130
- else
131
- format("%.2f", input)
132
- end
133
- # Handle string representations of zero
134
- elsif input.to_s.strip.match?(/^-?0+(\.0+)?$/) && null_display.nil?
135
- ""
136
- else
137
- input.to_s
138
- end
139
- end
140
-
141
122
  def whole_value
142
- return "" if currency_amount.blank?
143
-
144
- value = currency_amount.split(".").first
123
+ value = amount.split(".").first
145
124
  if comma_separator
146
125
  number_with_delimiter(value.gsub(",", ""))
147
126
  else
@@ -150,9 +129,7 @@ module Playbook
150
129
  end
151
130
 
152
131
  def decimal_value
153
- return "00" if currency_amount.blank?
154
-
155
- currency_amount.split(".")[1] || "00"
132
+ amount.split(".")[1] || "00"
156
133
  end
157
134
 
158
135
  def units_element
@@ -170,9 +147,7 @@ module Playbook
170
147
  end
171
148
 
172
149
  def abbreviated_value(index = 0..-2)
173
- return "" if currency_amount.blank?
174
-
175
- value = currency_amount.split(".").first.gsub(",", "").to_i
150
+ value = amount.split(".").first.gsub(",", "").to_i
176
151
  abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "")
177
152
  abbreviated_num[index]
178
153
  end
@@ -199,11 +174,9 @@ module Playbook
199
174
 
200
175
  if decimals == "matching"
201
176
  if comma_separator
202
- return "" if currency_amount.blank?
203
-
204
- number_with_delimiter(currency_amount.gsub(",", ""))
177
+ number_with_delimiter(amount.gsub(",", ""))
205
178
  else
206
- currency_amount
179
+ amount
207
180
  end
208
181
  else
209
182
  whole_value
@@ -133,50 +133,3 @@ test('handles negative amounts correctly', () => {
133
133
  expect(screen.getByTestId('test-negative-no-symbol')).toHaveTextContent('-400.50')
134
134
  expect(screen.getByTestId('test-negative-medium-size')).toHaveTextContent('$-500.55')
135
135
  })
136
-
137
- test('handles numeric amounts correctly', () => {
138
- render(
139
- <>
140
- <Currency
141
- amount={320}
142
- data={{ testid: 'test-numeric-default' }}
143
- />
144
- <Currency
145
- abbreviate
146
- amount={3200000}
147
- data={{ testid: 'test-numeric-millions' }}
148
- />
149
- <Currency
150
- amount={123456.78}
151
- commaSeparator
152
- data={{ testid: 'test-numeric-comma-decimals' }}
153
- />
154
- <Currency
155
- amount={400.50}
156
- data={{ testid: 'test-numeric-no-symbol' }}
157
- symbol=""
158
- />
159
- <Currency
160
- amount={500.55}
161
- data={{ testid: 'test-numeric-medium-size' }}
162
- size="md"
163
- />
164
- <Currency
165
- amount={-600.70}
166
- data={{ testid: 'test-numeric-negative' }}
167
- />
168
- <Currency
169
- amount={0.00}
170
- data={{ testid: 'test-numeric-null' }}
171
- />
172
- </>
173
- )
174
-
175
- expect(screen.getByTestId('test-numeric-default')).toHaveTextContent('$320')
176
- expect(screen.getByTestId('test-numeric-millions')).toHaveTextContent('$3.2M')
177
- expect(screen.getByTestId('test-numeric-comma-decimals')).toHaveTextContent('$123,456.78')
178
- expect(screen.getByTestId('test-numeric-no-symbol')).toHaveTextContent('400.50')
179
- expect(screen.getByTestId('test-numeric-medium-size')).toHaveTextContent('$500.55')
180
- expect(screen.getByTestId('test-numeric-negative')).toHaveTextContent('-$600.70')
181
- expect(screen.getByTestId('test-numeric-null')).toHaveTextContent('$.00')
182
- })
@@ -7,7 +7,7 @@
7
7
  }) %>
8
8
 
9
9
  <%= pb_rails("currency", props: {
10
- amount: 342,
10
+ amount: "342",
11
11
  label: "Light",
12
12
  margin_bottom: "md",
13
13
  size: "sm",
@@ -14,7 +14,7 @@ const CurrencyVariants = (props) => {
14
14
  {...props}
15
15
  />
16
16
  <Currency
17
- amount={342}
17
+ amount="342"
18
18
  label="Light"
19
19
  marginBottom="md"
20
20
  size="sm"
@@ -85,8 +85,6 @@ module Playbook
85
85
  default: ""
86
86
  prop :sync_end_with, type: Playbook::Props::String,
87
87
  default: ""
88
- prop :cursor, type: Playbook::Props::String,
89
- default: "pointer"
90
88
 
91
89
  def classname
92
90
  default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
@@ -1 +1 @@
1
- Customize your icon circle by passing one of our seven base colors to the `variant` prop: `royal` `orange` `purple` `teal` `red` `yellow` `green`
1
+ Customize your icon circle by passing one of our seven base colors to the `variant` prop: `royal` `blue` `orange` `purple` `teal` `red` `yellow` `green`
@@ -3,41 +3,48 @@
3
3
  text: "Mercury",
4
4
  unit: "AU",
5
5
  value: 0.39,
6
- variant:"royal"
6
+ variant:"blue"
7
7
  }) %>
8
8
  <br>
9
9
  <%= pb_rails("icon_stat_value", props: { icon: "planet-ringed",
10
10
  text: "Venus",
11
11
  unit: "AU",
12
12
  value: 0.723,
13
- variant:"purple"
13
+ variant:"royal"
14
14
  }) %>
15
15
  <br>
16
16
  <%= pb_rails("icon_stat_value", props: { icon: "planet-moon",
17
17
  text: "Earth",
18
18
  unit: "AU",
19
19
  value: 1.0,
20
- variant:"teal"
20
+ variant:"purple"
21
21
  }) %>
22
22
  <br>
23
23
  <%= pb_rails("icon_stat_value", props: { icon: "solar-system",
24
24
  text: "Mars",
25
25
  unit: "AU",
26
26
  value: 1.524,
27
- variant:"red"
27
+ variant:"teal"
28
28
  }) %>
29
29
  <br>
30
30
  <%= pb_rails("icon_stat_value", props: { icon: "globe-americas",
31
- text: "Jupiter",
31
+ text: "Jupitar",
32
32
  unit: "AU",
33
33
  value: 5.203,
34
- variant:"yellow"
34
+ variant:"red"
35
35
  }) %>
36
36
  <br>
37
37
  <%= pb_rails("icon_stat_value", props: { icon: "globe-africa",
38
38
  text: "Saturn",
39
39
  unit: "AU",
40
40
  value: 9.539,
41
+ variant:"yellow"
42
+ }) %>
43
+ <br>
44
+ <%= pb_rails("icon_stat_value", props: { icon: "globe",
45
+ text: "Uranus",
46
+ unit: "AU",
47
+ value: 19.18,
41
48
  variant:"green"
42
49
  }) %>
43
50
  <br>
@@ -46,4 +53,4 @@
46
53
  unit: "AU",
47
54
  value: 19.18,
48
55
  variant:"orange"
49
- }) %>
56
+ }) %>
@@ -9,7 +9,7 @@ const IconStatValueColor = (props) => {
9
9
  text="Mercury"
10
10
  unit="AU"
11
11
  value={0.39}
12
- variant="royal"
12
+ variant="blue"
13
13
  {...props}
14
14
  />
15
15
  <br />
@@ -18,7 +18,7 @@ const IconStatValueColor = (props) => {
18
18
  text="Venus"
19
19
  unit="AU"
20
20
  value={0.723}
21
- variant="purple"
21
+ variant="royal"
22
22
  {...props}
23
23
  />
24
24
  <br />
@@ -27,7 +27,7 @@ const IconStatValueColor = (props) => {
27
27
  text="Earth"
28
28
  unit="AU"
29
29
  value={1.0}
30
- variant="teal"
30
+ variant="purple"
31
31
  {...props}
32
32
  />
33
33
  <br />
@@ -36,16 +36,16 @@ const IconStatValueColor = (props) => {
36
36
  text="Mars"
37
37
  unit="AU"
38
38
  value={1.524}
39
- variant="red"
39
+ variant="teal"
40
40
  {...props}
41
41
  />
42
42
  <br />
43
43
  <IconStatValue
44
44
  icon="globe-americas"
45
- text="Jupiter"
45
+ text="Jupitar"
46
46
  unit="AU"
47
47
  value={5.203}
48
- variant="yellow"
48
+ variant="red"
49
49
  {...props}
50
50
  />
51
51
  <br />
@@ -54,6 +54,15 @@ const IconStatValueColor = (props) => {
54
54
  text="Saturn"
55
55
  unit="AU"
56
56
  value={9.539}
57
+ variant="yellow"
58
+ {...props}
59
+ />
60
+ <br />
61
+ <IconStatValue
62
+ icon="globe"
63
+ text="Uranus"
64
+ unit="AU"
65
+ value={19.18}
57
66
  variant="green"
58
67
  {...props}
59
68
  />
@@ -56,3 +56,15 @@
56
56
  .pb_popover_reference_wrapper {
57
57
  display: inline-block;
58
58
  }
59
+
60
+ // Temporary code to replicate bug - DO NOT MERGE
61
+ @media (max-width: 619px) {
62
+ :root {
63
+ --is-pwa: 1;
64
+ }
65
+ }
66
+ @media (min-width: 620px) {
67
+ :root {
68
+ --is-pwa: 0;
69
+ }
70
+ }
@@ -24,7 +24,6 @@ import { uniqueId } from '../utilities/object';
24
24
  type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth' | 'maxHeight' | 'minHeight'>
25
25
 
26
26
  type PbPopoverProps = {
27
- appendTo?: string;
28
27
  aria?: { [key: string]: string };
29
28
  className?: string;
30
29
  closeOnClick?: "outside" | "inside" | "any";
@@ -63,25 +62,6 @@ const popoverModifiers = ({
63
62
  return offset ? modifiers.concat([POPOVER_MODIFIERS.offset]) : modifiers;
64
63
  };
65
64
 
66
- const getAppendTarget = (
67
- appendTo: string | undefined,
68
- targetId: string
69
- ): HTMLElement => {
70
- if (!appendTo || appendTo === "body") return document.body;
71
-
72
- if (appendTo === "parent") {
73
- const referenceWrapper = document.querySelector(`#reference-${targetId}`);
74
- if (referenceWrapper?.parentElement) {
75
- return referenceWrapper.parentElement;
76
- }
77
- }
78
-
79
- const selectorMatch = document.querySelector(appendTo);
80
- if (selectorMatch instanceof HTMLElement) return selectorMatch;
81
-
82
- return document.body;
83
- };
84
-
85
65
  const Popover = (props: PbPopoverProps) => {
86
66
  const {
87
67
  aria = {},
@@ -133,7 +113,7 @@ const Popover = (props: PbPopoverProps) => {
133
113
 
134
114
  return (
135
115
  <Popper
136
- modifiers={popoverModifiers({ modifiers, offset: offset || false })}
116
+ modifiers={popoverModifiers({ modifiers, offset })}
137
117
  placement={placement}
138
118
  referenceElement={referenceElement}
139
119
  >
@@ -174,7 +154,6 @@ const Popover = (props: PbPopoverProps) => {
174
154
  const PbReactPopover = (props: PbPopoverProps): React.ReactElement => {
175
155
  const [targetId] = useState(uniqueId('id-'))
176
156
  const {
177
- appendTo,
178
157
  className,
179
158
  children,
180
159
  modifiers = [],
@@ -281,10 +260,10 @@ const PbReactPopover = (props: PbPopoverProps): React.ReactElement => {
281
260
  {show &&
282
261
  (usePortal ? (
283
262
  <>
284
- {ReactDOM.createPortal(
285
- popoverComponent,
286
- getAppendTarget(appendTo, targetId)
287
- )}
263
+ {ReactDOM.createPortal(
264
+ popoverComponent,
265
+ document.querySelector(portal)
266
+ )}
288
267
  </>
289
268
  ) : (
290
269
  { popoverComponent }
@@ -3,11 +3,14 @@ import React, { useState } from 'react'
3
3
  import Button from '../../pb_button/_button'
4
4
  import Flex from '../../pb_flex/_flex'
5
5
  import PbReactPopover from '../../pb_popover/_popover'
6
+ // Temporary code to replicate bug - DO NOT MERGE (Revert example when done)
7
+ import useSmallScreenIndicator from './hook/useSmallScreenIndicator'
6
8
 
7
9
  const PopoverClose = (props) => {
8
10
  const [showInsidePopover, setInsideShowPopover] = useState(false)
9
11
  const [showOutsidePopover, setOutsideShowPopover] = useState(false)
10
12
  const [showAnyPopover, setAnyShowPopover] = useState(false)
13
+ const isPwa = useSmallScreenIndicator()
11
14
 
12
15
  const handleInsideShouldClosePopover = (shouldClosePopover) => {
13
16
  setInsideShowPopover(!shouldClosePopover)
@@ -59,6 +62,10 @@ const PopoverClose = (props) => {
59
62
  />
60
63
  )
61
64
 
65
+ if (isPwa) {
66
+ return null
67
+ }
68
+
62
69
  return (
63
70
  <Flex spacing="between">
64
71
  <PbReactPopover
@@ -15,4 +15,3 @@ examples:
15
15
  - popover_z_index: Set Z-Index
16
16
  - popover_scroll_height: Scroll and Height Settings
17
17
  - popover_actionable_content: With Actionable Content
18
- - popover_append_to: Append To
@@ -0,0 +1,27 @@
1
+ // Temporary code to replicate bug - DO NOT MERGE
2
+ import { useEffect, useState } from "react";
3
+
4
+ const useSmallScreenIndicator = (): boolean => {
5
+ const [isPwa, setIsPwa] = useState(false);
6
+
7
+ useEffect(() => {
8
+ const update = () => {
9
+ const value = getComputedStyle(document.documentElement)
10
+ .getPropertyValue("--is-pwa")
11
+ .trim();
12
+ setIsPwa(value === "1");
13
+ };
14
+
15
+ update();
16
+
17
+ // Observes changes using ResizeObserver
18
+ const observer = new ResizeObserver(update);
19
+ observer.observe(document.documentElement);
20
+
21
+ return () => observer.disconnect();
22
+ }, []);
23
+
24
+ return isPwa;
25
+ };
26
+
27
+ export default useSmallScreenIndicator;
@@ -4,4 +4,3 @@ export { default as PopoverClose } from './_popover_close.jsx'
4
4
  export { default as PopoverZIndex } from './_popover_z_index.jsx'
5
5
  export { default as PopoverScrollHeight } from './_popover_scroll_height.jsx'
6
6
  export { default as PopoverActionableContent } from './_popover_actionable_content.jsx'
7
- export { default as PopoverAppendTo } from './_popover_append_to.jsx'