playbook_ui 15.3.0.pre.alpha.PLAY2322popoverconditionalrender11766 → 15.3.0.pre.alpha.PLAY2565formkitsubmitfix11681

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 (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +1 -3
  3. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +3 -18
  4. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +14 -56
  5. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +0 -3
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +3 -12
  7. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -59
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.jsx +0 -28
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +2 -11
  10. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_quick_pick_styles.scss +30 -11
  11. data/app/pb_kits/playbook/pb_popover/_popover.scss +0 -12
  12. data/app/pb_kits/playbook/pb_popover/_popover.tsx +29 -43
  13. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.jsx +0 -7
  14. data/dist/chunks/{_line_graph-BxC7m53J.js → _line_graph-h5H-imfn.js} +1 -1
  15. data/dist/chunks/_typeahead-U8AjZIIW.js +6 -0
  16. data/dist/chunks/{_weekday_stacked-DxdwXyYM.js → _weekday_stacked-CbCUYuuZ.js} +2 -2
  17. data/dist/chunks/vendor.js +1 -1
  18. data/dist/playbook-doc.js +1 -1
  19. data/dist/playbook-rails-react-bindings.js +1 -1
  20. data/dist/playbook-rails.js +1 -1
  21. data/dist/playbook.css +1 -1
  22. data/lib/playbook/version.rb +1 -1
  23. metadata +5 -7
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data_inline_loading_empty_children.js +0 -42
  25. data/app/pb_kits/playbook/pb_popover/docs/hook/useSmallScreenIndicator.tsx +0 -27
  26. data/dist/chunks/_typeahead-B1SiFvbF.js +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f59d7e7c4376efeb5b93d1b598f303d41137dbf51803939bfc58fe39bf2111c
4
- data.tar.gz: 7a6940c220be0ca9d18b3e2cd9a283539d66df7ee26245320d22e676b8244d93
3
+ metadata.gz: e57165e0f6855d1e877e88b67b0cfc62dffcca56c75494c4919a2774443a3f4e
4
+ data.tar.gz: c13a71137883d0c2277e488a8a0163f88768e01a22d75c9d0f1bcd157ca473b9
5
5
  SHA512:
6
- metadata.gz: f0aff746453cdd793520c58b60da087f0ed804622f33c98b25869cfdb19bb6a601ba4488772991c9edadf3e5bfbcfa1a8be38a883280f229ef62d0c761e7a4c6
7
- data.tar.gz: 807933083868d271c5d7ae0f2b3d0519ca4d35feb9ad1890cbcc3c0cd84c4e24690ee76151bafe2271eefc2683bf03f0ee396738951e77f1ec9307736135c583
6
+ metadata.gz: e40cbc1a718b7157b85199fbd02852055a6dfa954d351af3a3299a84311b3185b8bbc93de30b9000b2161d97ae1bdd79f8a519ce3524d9907e506b095ed3c9b7
7
+ data.tar.gz: e06abbce30f98797e15dc84498c72d3d370275df49cb93f490fa8a9cdda3cc5844efe471a2fdb37ad969db0801bc6f6fb6c0f476204eae726b50b30042f1f296
@@ -30,7 +30,6 @@ type TableHeaderCellProps = {
30
30
  headerChildren?: React.ReactNode | React.ReactNode[]
31
31
  isPinnedLeft?: boolean
32
32
  loading?: boolean
33
- persistToggleExpansionButton?: boolean
34
33
  sortIcon?: string | string[]
35
34
  table?: Table<GenericObject>
36
35
  } & GlobalProps
@@ -59,7 +58,6 @@ export const TableHeaderCell = ({
59
58
  selectableRows,
60
59
  hasAnySubRows,
61
60
  showActionsBar,
62
- persistToggleExpansionButton,
63
61
  stickyLeftColumn,
64
62
  inlineRowLoading,
65
63
  isActionBarVisible,
@@ -222,7 +220,7 @@ const isToggleExpansionEnabled =
222
220
  />
223
221
  )
224
222
  }
225
- {isToggleExpansionEnabled && ((hasAnySubRows) || (inlineRowLoading && persistToggleExpansionButton)) && !expandByDepth && (
223
+ {isToggleExpansionEnabled && hasAnySubRows && !expandByDepth && (
226
224
  <ToggleIconButton onClick={handleExpandOrCollapse} />
227
225
  )}
228
226
  {isToggleExpansionEnabled && hasAnySubRows && expandByDepth && (
@@ -9,9 +9,6 @@ interface UseTableActionsProps {
9
9
  setExpanded: (expanded: GenericObject) => void;
10
10
  onToggleExpansionClick?: (arg: Row<GenericObject>) => void;
11
11
  onRowSelectionChange?: (rowSelection: any) => void;
12
- inlineRowLoading?: boolean;
13
- localPagination?: { pageIndex: number; pageSize: number };
14
- setLocalPagination?: (pagination: { pageIndex: number; pageSize: number }) => void;
15
12
  }
16
13
 
17
14
  export function useTableActions({
@@ -19,10 +16,7 @@ export function useTableActions({
19
16
  expanded,
20
17
  setExpanded,
21
18
  onToggleExpansionClick,
22
- onRowSelectionChange,
23
- inlineRowLoading = false,
24
- localPagination,
25
- setLocalPagination
19
+ onRowSelectionChange
26
20
  }: UseTableActionsProps) {
27
21
 
28
22
  // State to achieve 1 second delay before fetching more rows
@@ -44,17 +38,8 @@ export function useTableActions({
44
38
 
45
39
  // Handle pagination
46
40
  const onPageChange = useCallback((page: number) => {
47
- if (inlineRowLoading && setLocalPagination && localPagination) {
48
- // Use manual pagination state for inlineRowLoading
49
- setLocalPagination({
50
- ...localPagination,
51
- pageIndex: page - 1
52
- });
53
- } else {
54
- // Use tanstack's built-in pagination
55
- table.setPageIndex(page - 1);
56
- }
57
- }, [table, inlineRowLoading, setLocalPagination, localPagination]);
41
+ table.setPageIndex(page - 1);
42
+ }, [table]);
58
43
 
59
44
  // Handle scroll detection for infinite scroll/virtualization
60
45
  const fetchMoreOnBottomReached = useCallback((
@@ -35,7 +35,6 @@ interface UseTableStateProps {
35
35
  onRowSelectionChange?: (arg: RowSelectionState) => void;
36
36
  columnVisibilityControl?: GenericObject;
37
37
  rowStyling?: GenericObject;
38
- inlineRowLoading?: boolean;
39
38
  }
40
39
 
41
40
  export function useTableState({
@@ -54,8 +53,7 @@ export function useTableState({
54
53
  tableOptions,
55
54
  columnVisibilityControl,
56
55
  pinnedRows,
57
- rowStyling,
58
- inlineRowLoading = false
56
+ rowStyling
59
57
  }: UseTableStateProps) {
60
58
 
61
59
  // Create a local state for expanded and setExpanded if expandedControl not used
@@ -66,12 +64,6 @@ export function useTableState({
66
64
  const [localRowPinning, setLocalRowPinning] = useState<RowPinningState>({
67
65
  top: [],
68
66
  });
69
- // Manage local state to preserve current page index when inlineRowLoading is enabled so it does not boot table to page 1
70
- // We can extend this for more usecases, but for now scoping it only for inlineRowLoading
71
- const [localPagination, setLocalPagination] = useState({
72
- pageIndex: paginationProps?.pageIndex ?? 0,
73
- pageSize: paginationProps?.pageSize ?? 20,
74
- });
75
67
  // Determine whether to use the prop or the local state
76
68
  const expanded = expandedControl ? expandedControl.value : localExpanded;
77
69
  const setExpanded = expandedControl ? expandedControl.onChange : setLocalExpanded;
@@ -141,7 +133,6 @@ export function useTableState({
141
133
  ...(selectableRows && { rowSelection }),
142
134
  ...(columnVisibility && { columnVisibility }),
143
135
  ...(pinnedRows && { rowPinning }),
144
- ...(inlineRowLoading && { pagination: localPagination }),
145
136
  },
146
137
  }), [
147
138
  expanded,
@@ -151,36 +142,23 @@ export function useTableState({
151
142
  rowSelection,
152
143
  columnVisibility,
153
144
  rowPinning,
154
- inlineRowLoading,
155
- localPagination
156
145
  ]);
157
146
 
158
147
  // Pagination configuration
159
148
  const paginationInitializer = useMemo(() => {
160
149
  if (!pagination) return {};
161
150
 
162
- if (inlineRowLoading) {
163
- // Use manual pagination state when inlineRowLoading is enabled (see https://tanstack.com/table/latest/docs/guide/pagination#client-side-pagination)
164
- return {
165
- getPaginationRowModel: getPaginationRowModel(),
166
- paginateExpandedRows: false,
167
- onPaginationChange: setLocalPagination,
168
- autoResetPageIndex: false, // This is what prevent auto-reset of page index
169
- };
170
- } else {
171
- // Use normal pagination initialization for non- inlineRowLoading usecases
172
- return {
173
- getPaginationRowModel: getPaginationRowModel(),
174
- paginateExpandedRows: false,
175
- initialState: {
176
- pagination: {
177
- pageIndex: paginationProps?.pageIndex ?? 0,
178
- pageSize: paginationProps?.pageSize ?? 20,
179
- },
151
+ return {
152
+ getPaginationRowModel: getPaginationRowModel(),
153
+ paginateExpandedRows: false,
154
+ initialState: {
155
+ pagination: {
156
+ pageIndex: paginationProps?.pageIndex ?? 0,
157
+ pageSize: paginationProps?.pageSize ?? 20,
180
158
  },
181
- };
182
- }
183
- }, [pagination, paginationProps, inlineRowLoading]);
159
+ },
160
+ };
161
+ }, [pagination, paginationProps]);
184
162
 
185
163
  // Initialize the table
186
164
  const table = useReactTable({
@@ -228,27 +206,9 @@ export function useTableState({
228
206
  // Set pagination state when pagination is enabled
229
207
  useEffect(() => {
230
208
  if (pagination && paginationProps?.pageSize) {
231
- if (inlineRowLoading) {
232
- // Update local pagination state for inlineRowLoading
233
- setLocalPagination(prev => ({
234
- ...prev,
235
- pageSize: paginationProps.pageSize
236
- }));
237
- } else {
238
- table.setPageSize(paginationProps.pageSize);
239
- }
240
- }
241
- }, [pagination, paginationProps?.pageSize, table, inlineRowLoading]);
242
-
243
- // Update local pagination when paginationProps change and inlineRowLoading is enabled
244
- useEffect(() => {
245
- if (pagination && inlineRowLoading && paginationProps) {
246
- setLocalPagination({
247
- pageIndex: paginationProps.pageIndex ?? localPagination.pageIndex,
248
- pageSize: paginationProps.pageSize ?? localPagination.pageSize,
249
- });
209
+ table.setPageSize(paginationProps.pageSize);
250
210
  }
251
- }, [pagination, inlineRowLoading, paginationProps?.pageIndex, paginationProps?.pageSize]);
211
+ }, [pagination, paginationProps?.pageSize, table]);
252
212
 
253
213
  // Check if table has any sub-rows
254
214
  const hasAnySubRows = table.getRowModel().rows.some(row => row.subRows && row.subRows.length > 0);
@@ -287,8 +247,6 @@ export function useTableState({
287
247
  rowSelection,
288
248
  fullData,
289
249
  totalFetched,
290
- isFetching,
291
- localPagination,
292
- setLocalPagination
250
+ isFetching
293
251
  };
294
252
  }
@@ -39,7 +39,6 @@ export const TableHeader = ({
39
39
  hasAnySubRows,
40
40
  showActionsBar,
41
41
  selectableRows,
42
- persistToggleExpansionButton,
43
42
  responsive,
44
43
  headerRef,
45
44
  virtualizedRows,
@@ -93,7 +92,6 @@ export const TableHeader = ({
93
92
  isPinnedLeft={isPinnedLeft}
94
93
  key={`${header.id}-header`}
95
94
  loading={loading}
96
- persistToggleExpansionButton={persistToggleExpansionButton}
97
95
  sortIcon={sortIcon}
98
96
  table={table}
99
97
  />
@@ -138,7 +136,6 @@ export const TableHeader = ({
138
136
  isVirtualized
139
137
  key={`${header.id}-header-virtualized`}
140
138
  loading={loading}
141
- persistToggleExpansionButton={persistToggleExpansionButton}
142
139
  sortIcon={sortIcon}
143
140
  table={table}
144
141
  />
@@ -63,7 +63,6 @@ type AdvancedTableProps = {
63
63
  scrollBarNone?: boolean,
64
64
  selectableRows?: boolean,
65
65
  showActionsBar?: boolean,
66
- persistToggleExpansionButton?: boolean,
67
66
  sortControl?: GenericObject
68
67
  tableData: GenericObject[]
69
68
  tableOptions?: GenericObject
@@ -110,7 +109,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
110
109
  scrollBarNone= false,
111
110
  showActionsBar = true,
112
111
  selectableRows,
113
- persistToggleExpansionButton = false,
114
112
  sortControl,
115
113
  stickyLeftColumn,
116
114
  tableData,
@@ -136,9 +134,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
136
134
  updateLoadingStateRowCount,
137
135
  fullData,
138
136
  totalFetched,
139
- isFetching,
140
- localPagination,
141
- setLocalPagination
137
+ isFetching
142
138
  } = useTableState({
143
139
  tableData,
144
140
  columnDefinitions,
@@ -156,8 +152,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
156
152
  onRowSelectionChange,
157
153
  columnVisibilityControl,
158
154
  pinnedRows,
159
- rowStyling,
160
- inlineRowLoading
155
+ rowStyling
161
156
  });
162
157
 
163
158
  // Initialize table actions
@@ -170,10 +165,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
170
165
  expanded,
171
166
  setExpanded,
172
167
  onToggleExpansionClick,
173
- onRowSelectionChange,
174
- inlineRowLoading,
175
- localPagination,
176
- setLocalPagination
168
+ onRowSelectionChange
177
169
  });
178
170
 
179
171
  // Set table row count for loading state
@@ -357,7 +349,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
357
349
  loading={loading}
358
350
  onCustomSortClick={onCustomSortClick}
359
351
  onExpandByDepthClick={onExpandByDepthClick}
360
- persistToggleExpansionButton={persistToggleExpansionButton}
361
352
  pinnedRows={pinnedRows}
362
353
  responsive={responsive}
363
354
  rowStyling={rowStyling}
@@ -108,48 +108,6 @@ const MOCK_DATA_WITH_ID = [
108
108
  },
109
109
  ]
110
110
 
111
- const MOCK_DATA_NO_SUBROWS = [
112
- {
113
- year: "2021",
114
- quarter: null,
115
- month: null,
116
- day: null,
117
- newEnrollments: "20",
118
- scheduledMeetings: "10",
119
- attendanceRate: "51%",
120
- completedClasses: "3",
121
- classCompletionRate: "33%",
122
- graduatedStudents: "19",
123
- children: [],
124
- },
125
- {
126
- year: "2022",
127
- quarter: null,
128
- month: null,
129
- day: null,
130
- newEnrollments: "25",
131
- scheduledMeetings: "17",
132
- attendanceRate: "75%",
133
- completedClasses: "5",
134
- classCompletionRate: "45%",
135
- graduatedStudents: "32",
136
- children: [],
137
- },
138
- {
139
- year: "2023",
140
- quarter: null,
141
- month: null,
142
- day: null,
143
- newEnrollments: "30",
144
- scheduledMeetings: "22",
145
- attendanceRate: "80%",
146
- completedClasses: "7",
147
- classCompletionRate: "55%",
148
- graduatedStudents: "45",
149
- children: [],
150
- },
151
- ]
152
-
153
111
  const columnDefinitions = [
154
112
  {
155
113
  accessor: "year",
@@ -551,23 +509,6 @@ test("inlineRowLoading prop renders inline loading if true", () => {
551
509
  expect(inlineLoading).toBeInTheDocument()
552
510
  })
553
511
 
554
- test("persistToggleExpansionButton prop shows header toggle when inlineRowLoading is true", () => {
555
- render(
556
- <AdvancedTable
557
- columnDefinitions={columnDefinitions}
558
- data={{ testid: testId }}
559
- enableToggleExpansion="all"
560
- inlineRowLoading
561
- persistToggleExpansionButton
562
- tableData={MOCK_DATA_NO_SUBROWS}
563
- />
564
- )
565
-
566
- const kit = screen.getByTestId(testId)
567
- const headerToggleButton = kit.querySelector(".gray-icon.toggle-all-icon")
568
- expect(headerToggleButton).toBeInTheDocument()
569
- })
570
-
571
512
  test("responsive prop functions as expected", () => {
572
513
  render(
573
514
  <AdvancedTable
@@ -1,8 +1,6 @@
1
1
  import React from "react"
2
2
  import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
- import Caption from '../../pb_caption/_caption'
4
3
  import { MOCK_DATA_INLINE_LOADING } from "./_mock_data_inline_loading"
5
- import { MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN } from "./_mock_data_inline_loading_empty_children"
6
4
 
7
5
  const AdvancedTableInlineRowLoading = (props) => {
8
6
  const columnDefinitions = [
@@ -43,42 +41,16 @@ const AdvancedTableInlineRowLoading = (props) => {
43
41
 
44
42
  return (
45
43
  <div>
46
- <Caption text="Inline Row Loading - Demonstrated in Row 1 (Rows 2 and 3 have data)" />
47
44
  <AdvancedTable
48
45
  columnDefinitions={columnDefinitions}
49
46
  enableToggleExpansion="all"
50
47
  inlineRowLoading
51
- marginBottom="md"
52
48
  tableData={MOCK_DATA_INLINE_LOADING}
53
49
  {...props}
54
50
  >
55
51
  <AdvancedTable.Header />
56
52
  <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
57
53
  </AdvancedTable>
58
- <Caption text="Inline Row Loading with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is not rendered" />
59
- <AdvancedTable
60
- columnDefinitions={columnDefinitions}
61
- enableToggleExpansion="all"
62
- inlineRowLoading
63
- marginBottom="md"
64
- tableData={MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN}
65
- {...props}
66
- >
67
- <AdvancedTable.Header />
68
- <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
69
- </AdvancedTable>
70
- <Caption text="Inline Row Loading and Persist Toggle Expansion Button with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is rendered" />
71
- <AdvancedTable
72
- columnDefinitions={columnDefinitions}
73
- enableToggleExpansion="all"
74
- inlineRowLoading
75
- persistToggleExpansionButton
76
- tableData={MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN}
77
- {...props}
78
- >
79
- <AdvancedTable.Header />
80
- <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
81
- </AdvancedTable>
82
54
  </div>
83
55
  )
84
56
  }
@@ -1,14 +1,5 @@
1
- ### inlineRowLoading
2
1
  As a default, the kit assumes that the initial dataset is complete, and it renders all expansion buttons/controls based on that data; if no children are present, no expansion controls are rendered. If, however, you want to change the initial dataset to omit some or all of its children (to improve load times of a complex dataset, perhaps), and you implement a querying logic that loads children only when its parent is expanded, then you must use the `inlineRowLoading` prop to ensure your expansion controls are rendered even though your child data is not yet loaded. You must also pass an empty `children` array to any node that will have children to ensure its parent maintains its ability to expand. If this prop is called AND your data contains empty `children` arrays, the kit will render expansion controls on any row with empty children, and then add an inline loading state within the expanded subrow until those child row(s) are returned to the page [by your query logic].
3
2
 
4
- In the first Advanced Table in this code example, 2021 has an empty children array. Toggle it open to see the inline loading state. Once the correct data loads, this state will be replaced with the correct data rows.
3
+ In this code example, 2021 has an empty children array. Toggle it open to see the inline loading state. Once the correct data loads, this state will be replaced with the correct data rows.
5
4
 
6
- This prop is set to `false` by default.
7
-
8
-
9
- ### persistToggleExpansion
10
- The `persistToggleExpansionButton` is a boolean prop that renders the toggle-all icon in the top left header cell for complex datasets with empty `children` arrays and advanced querying logic explained in the preceeding doc example. Your logic may require an additional query helper file to update data specifically from requerying via toggle all buttons.
11
-
12
- In the second and third Advanced Tables in this code example, all 3 rows have empty children arrays. The second Advanced Table demonstrates that the toggle all button does not render (prior to an initial row expansion) without `persistToggleExpansionButton` in place. The third Advanced Table shows the toggle all button due to `persistToggleExpansionButton`.
13
-
14
- This prop is set to false by default and should only be used in conjunction with `inlineRowLoading`.
5
+ This prop is set to `false` by default.
@@ -9,20 +9,29 @@ $pb_card_border_radius: $border_rad_heavier;
9
9
 
10
10
  // used to display dropdown on the left of the calender
11
11
  .quick-pick-drop-down {
12
- width: 100%;
12
+ width: auto;
13
+ display: grid;
13
14
  }
14
15
 
15
16
  .quick-pick-ul {
17
+ padding: $space_xs 0px;
16
18
  margin: 0;
17
19
  list-style: none;
18
20
  }
19
21
 
20
22
  .nav-item {
21
23
  list-style: none;
24
+ border-radius: 6px;
25
+ border-bottom: 0;
26
+ margin: $space_xs $space_sm;
22
27
  }
23
28
 
24
29
  .nav-item-link {
25
30
  text-decoration: none;
31
+ border-width: $pb_card_border_width;
32
+ border-style: solid;
33
+ border-color: $border_light;
34
+ border-radius: $pb_card_border_radius;
26
35
  padding: $space_xs 14px;
27
36
  transition-property: color, background-color;
28
37
  transition-duration: 0.15s;
@@ -31,21 +40,15 @@ $pb_card_border_radius: $border_rad_heavier;
31
40
  color: $charcoal;
32
41
  font-size: $font_default;
33
42
  font-weight: $regular;
34
- text-align: left;
35
- border-bottom: 1px solid $border_light;
36
43
  &.active {
37
- color: $white;
38
- background-color: $primary;
39
- &:hover {
40
- background-color: $product_1_background;
41
- color: $white;
42
- }
44
+ border-width: 2px;
45
+ border-color: $primary;
43
46
  }
44
47
  @media (hover:hover) {
45
48
  &:hover {
46
49
  cursor: pointer;
47
- background-color: $bg_light;
48
- color: $primary;
50
+ box-shadow: $shadow-deep;
51
+ border-color: $slate;
49
52
  }
50
53
  }
51
54
  }
@@ -54,3 +57,19 @@ $pb_card_border_radius: $border_rad_heavier;
54
57
  .quick-pick-drop-down > .flatpickr-months, .quick-pick-drop-down > .flatpickr-innerContainer {
55
58
  display: none;
56
59
  }
60
+
61
+ @media only screen and (max-width: 767px) {
62
+ .quick-pick-ul {
63
+ padding: $space_xs $space_xs;
64
+ display: grid;
65
+ grid-template-columns: 1fr 1fr;
66
+ }
67
+
68
+ .nav-item {
69
+ margin: $space_xxs $space_xs;
70
+ }
71
+
72
+ .nav-item-link {
73
+ padding: $space_xs $space_xxs;
74
+ }
75
+ }
@@ -56,15 +56,3 @@
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
- }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react/no-multi-comp */
2
- import React, { useEffect, useRef, useState } from "react";
2
+ import React, { useEffect, useState } from "react";
3
3
  import ReactDOM from "react-dom";
4
4
  import {
5
5
  Popper,
@@ -89,7 +89,7 @@ const Popover = (props: PbPopoverProps) => {
89
89
  const popoverSpacing =
90
90
  filteredGlobalProps.includes("dark") || !filteredGlobalProps
91
91
  ? "p_sm"
92
- : filteredGlobalProps
92
+ : filteredGlobalProps
93
93
  const overflowHandling = maxHeight || maxWidth ? "overflow_handling" : "";
94
94
  const zIndexStyle = zIndex ? { zIndex: zIndex } : {};
95
95
  const widthHeightStyles = () => {
@@ -170,56 +170,42 @@ const PbReactPopover = (props: PbPopoverProps): React.ReactElement => {
170
170
  minHeight,
171
171
  minWidth,
172
172
  width,
173
- closeOnClick,
174
- shouldClosePopover = noop,
175
173
  } = props;
176
174
 
177
- // Store latest callback in a ref to avoid re-runs
178
- const shouldClosePopoverRef = useRef(shouldClosePopover);
179
-
180
- // Update ref on change
181
175
  useEffect(() => {
182
- shouldClosePopoverRef.current = shouldClosePopover;
183
- }, [shouldClosePopover]);
176
+ const { closeOnClick, shouldClosePopover = noop } = props;
184
177
 
185
- useEffect(() => {
186
178
  if (!closeOnClick) return;
187
179
 
188
- // Function to handle popover event listener and targetId.
189
- // Ensure that whenever the component is conditionally rendered
190
- // that the old listener is removed and the new listener is
191
- // updated with the targetId.
192
- const handleClick = (e: MouseEvent) => {
193
- const target = e.target as HTMLElement
194
-
195
- const targetIsPopover =
196
- target.closest("#" + targetId) !== null;
197
- const targetIsReference =
198
- target.closest("#reference-" + targetId) !== null;
180
+ document.body.addEventListener(
181
+ "click",
182
+ (e: MouseEvent) => {
183
+ const target = e.target as HTMLElement
199
184
 
200
- const shouldClose = () => {
201
- setTimeout(() => shouldClosePopoverRef.current(true), 0);
202
- }
185
+ const targetIsPopover =
186
+ target.closest("#" + targetId) !== null;
187
+ const targetIsReference =
188
+ target.closest("#reference-" + targetId) !== null;
203
189
 
204
- switch (closeOnClick) {
205
- case "outside":
206
- if (!targetIsPopover && !targetIsReference) shouldClose();
207
- break;
208
- case "inside":
209
- if (targetIsPopover) shouldClose();
210
- break;
211
- case "any":
212
- if (targetIsPopover || !targetIsPopover && !targetIsReference) shouldClose();
213
- break;
214
- }
215
- };
190
+ const shouldClose = () => {
191
+ setTimeout(() => shouldClosePopover(true), 0);
192
+ }
216
193
 
217
- document.body.addEventListener("click", handleClick, { capture: true });
218
-
219
- return () => {
220
- document.body.removeEventListener("click", handleClick, { capture: true });
221
- };
222
- }, [targetId, closeOnClick]);
194
+ switch (closeOnClick) {
195
+ case "outside":
196
+ if (!targetIsPopover && !targetIsReference) shouldClose();
197
+ break;
198
+ case "inside":
199
+ if (targetIsPopover) shouldClose();
200
+ break;
201
+ case "any":
202
+ if (targetIsPopover || !targetIsPopover && !targetIsReference) shouldClose();
203
+ break;
204
+ }
205
+ },
206
+ { capture: true }
207
+ );
208
+ }, []);
223
209
 
224
210
  const popoverComponent = (
225
211
  <Popover
@@ -3,14 +3,11 @@ 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'
8
6
 
9
7
  const PopoverClose = (props) => {
10
8
  const [showInsidePopover, setInsideShowPopover] = useState(false)
11
9
  const [showOutsidePopover, setOutsideShowPopover] = useState(false)
12
10
  const [showAnyPopover, setAnyShowPopover] = useState(false)
13
- const isPwa = useSmallScreenIndicator()
14
11
 
15
12
  const handleInsideShouldClosePopover = (shouldClosePopover) => {
16
13
  setInsideShowPopover(!shouldClosePopover)
@@ -62,10 +59,6 @@ const PopoverClose = (props) => {
62
59
  />
63
60
  )
64
61
 
65
- if (isPwa) {
66
- return null
67
- }
68
-
69
62
  return (
70
63
  <Flex spacing="between">
71
64
  <PbReactPopover