playbook_ui 14.17.0.pre.alpha.play2065passphrasewithselect7295 → 14.17.0.pre.alpha.playcdntest7233

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +3 -23
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +1 -11
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +128 -60
  5. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +0 -3
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +2 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +2 -2
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +2 -6
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +2 -6
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -6
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -4
  14. data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +45 -19
  15. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +0 -1
  16. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +1 -2
  17. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +3 -23
  18. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +5 -15
  19. data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +6 -39
  20. data/app/pb_kits/playbook/pb_layout/_layout.scss +1 -70
  21. data/app/pb_kits/playbook/pb_layout/_layout.tsx +2 -29
  22. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +118 -322
  23. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +1 -1
  24. data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +43 -74
  25. data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +4 -21
  26. data/app/pb_kits/playbook/pb_overlay/_overlay.scss +22 -49
  27. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +4 -15
  28. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +7 -1
  29. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +0 -3
  30. data/app/pb_kits/playbook/pb_overlay/docs/index.js +0 -3
  31. data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +1 -39
  32. data/dist/chunks/{_typeahead-CHd0V9EL.js → _typeahead-C2GOKWtm.js} +2 -2
  33. data/dist/chunks/_weekday_stacked-CFGTPT0O.js +45 -0
  34. data/dist/chunks/{lib-BV_AF_eh.js → lib-BGzBzFZX.js} +3 -3
  35. data/dist/chunks/{pb_form_validation-nsvkJU2J.js → pb_form_validation-BvNy9Bd6.js} +1 -1
  36. data/dist/chunks/vendor.js +1 -1
  37. data/dist/playbook-doc.js +1 -1
  38. data/dist/playbook-rails-react-bindings.js +1 -1
  39. data/dist/playbook-rails.js +1 -1
  40. data/dist/playbook.css +1 -1
  41. data/lib/playbook/version.rb +1 -1
  42. metadata +6 -25
  43. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.jsx +0 -58
  44. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.md +0 -6
  45. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.jsx +0 -64
  46. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns_and_header.md +0 -8
  47. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +0 -55
  48. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +0 -3
  49. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +0 -33
  50. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +0 -3
  51. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +0 -97
  52. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +0 -54
  53. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +0 -3
  54. data/app/pb_kits/playbook/pb_copy_button/usePBCopy.ts +0 -45
  55. data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +0 -79
  56. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +0 -63
  57. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +0 -3
  58. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +0 -39
  59. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +0 -1
  60. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +0 -40
  61. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +0 -5
  62. data/dist/chunks/_weekday_stacked-BatiLk3-.js +0 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80adca99d2382dccb2127f505af545b8ac11a47c828ea2307145fde157b3ca21
4
- data.tar.gz: c7006296bae96b85063e72574f45b750a1eb548372853a31d469866da2b4ff89
3
+ metadata.gz: 876386e07608e48add16b3cac4356626c21d8ac34ad119992fa677533b09252b
4
+ data.tar.gz: d09e56e7d4a6e8e963579139cb4e0469b36591a38296eb42df18904a41a0676f
5
5
  SHA512:
6
- metadata.gz: 47b0288480e008f857dc8f41067c51707344035f8b487eab5bf317ec4d4194fbadbed7cc2c53ec6ea8cb2ef297bcebc4071ac8237bcfa1b0f638c7242982772d
7
- data.tar.gz: a1de55141eea889f3d1201b60b8060e3cf2dd4a706854c5ee783c5d6ea46b42862cf52be1d3b6447136b09ef18eb49c4b35df96f0a60d70688cc623ac8ce8d76
6
+ metadata.gz: 4e5241baf0769fef68aee63106f2299b4ab6ce69865091cb94a5caf6de83da2d0c96657aa38a17ce1bc51dc7e33b1f3758d2b18a5eefe29ed55478924f2a988d
7
+ data.tar.gz: a7f4b0b20f5f3b64dc5285e39bea36f9810c42a87ef687d32f0befbc210098ad934f79abb2bf0b0e66dfef40aee1720265d0c9011d34cdaa2136e1120c871572
@@ -1,4 +1,4 @@
1
- import React, { useContext, useEffect } from "react"
1
+ import React, { useContext } from "react"
2
2
  import classnames from "classnames"
3
3
  import { flexRender, Row, Cell } from "@tanstack/react-table"
4
4
 
@@ -32,21 +32,9 @@ export const RegularTableView = ({
32
32
  table,
33
33
  selectableRows,
34
34
  hasAnySubRows,
35
- stickyLeftColumn
35
+ isPinnedLeft = false,
36
36
  } = useContext(AdvancedTableContext)
37
37
 
38
-
39
- useEffect(() => {
40
- if (stickyLeftColumn && Array.isArray(stickyLeftColumn)) {
41
- stickyLeftColumn.forEach((columnId) => {
42
- const column = table.getColumn(columnId);
43
- if (column && column.getCanPin()) {
44
- column.pin('left');
45
- }
46
- });
47
- }
48
- },[stickyLeftColumn, table]);
49
-
50
38
  const columnPinning = table.getState().columnPinning || { left: [] };
51
39
  const columnDefinitions = table.options.meta?.columnDefinitions || [];
52
40
 
@@ -94,7 +82,7 @@ export const RegularTableView = ({
94
82
  {row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
95
83
  const isPinnedLeft = columnPinning.left.includes(cell.column.id);
96
84
  const isLastCell = cell.column.parent?.columns?.at(-1)?.id === cell.column.id;
97
- const { column } = cell;
85
+
98
86
  return (
99
87
  <td
100
88
  align="right"
@@ -102,17 +90,9 @@ export const RegularTableView = ({
102
90
  `${cell.id}-cell position_relative`,
103
91
  isChrome() ? "chrome-styles" : "",
104
92
  isPinnedLeft && 'pinned-left',
105
- stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft && 'sticky-left',
106
93
  isLastCell && 'last-cell',
107
94
  )}
108
95
  key={`${cell.id}-data`}
109
- style={{
110
- left: isPinnedLeft
111
- ? i === 1 //Accounting for set min-width for first column
112
- ? '180px'
113
- : `${column.getStart("left")}px`
114
- : undefined,
115
- }}
116
96
  >
117
97
  {collapsibleTrail && i === 0 && row.depth > 0 && renderCollapsibleTrail(row.depth)}
118
98
  <span id={`${cell.id}-span`}>
@@ -45,7 +45,6 @@ export const TableHeaderCell = ({
45
45
  selectableRows,
46
46
  hasAnySubRows,
47
47
  showActionsBar,
48
- stickyLeftColumn,
49
48
  inlineRowLoading,
50
49
  isActionBarVisible,
51
50
  } = useContext(AdvancedTableContext);
@@ -77,9 +76,7 @@ const cellClassName = classnames(
77
76
  `${isChrome() ? "chrome-styles" : ""}`,
78
77
  `${enableSorting ? "table-header-cells-active" : ""}`,
79
78
  { "pinned-left": responsive === "scroll" && isPinnedLeft },
80
- isLastHeaderCell ? "last-header-cell" : "",
81
- stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft ? 'sticky-left' : "",
82
-
79
+ isLastHeaderCell ? "last-header-cell" : ""
83
80
  );
84
81
 
85
82
  const cellId = `${loading ?
@@ -114,13 +111,6 @@ const isToggleExpansionEnabled =
114
111
  colSpan={header?.colSpan}
115
112
  id={cellId}
116
113
  key={`${header?.id}-header`}
117
- style={{
118
- left: isPinnedLeft
119
- ? header?.index === 1 //Accounting for set min-width for first column
120
- ? '180px'
121
- : `${header?.column.getStart("left")}px`
122
- : undefined,
123
- }}
124
114
  >
125
115
  {header?.isPlaceholder ? null : headerChildren && header?.index === 0 ? (
126
116
  <Flex alignItems="center">
@@ -8,7 +8,6 @@
8
8
  @import "../tokens/screen_sizes";
9
9
  @import "../tokens/shadows";
10
10
  @import "../tokens/positioning";
11
- @import "./scss_partials/advanced_table_sticky_mixin";
12
11
 
13
12
  .pb_advanced_table {
14
13
  $border-color: 1px solid $border_light;
@@ -94,8 +93,8 @@
94
93
  border-right: 1px solid $border_light !important;
95
94
  }
96
95
  .table-header-cells-custom {
97
- text-align: center;
98
- [class^="pb_checkbox_kit"] .pb_checkbox_label {
96
+ text-align:center;
97
+ [class^=pb_checkbox_kit] .pb_checkbox_label {
99
98
  padding-left: 0px;
100
99
  }
101
100
  }
@@ -105,7 +104,7 @@
105
104
  }
106
105
  // Right align header content of first data column in selectable row no subrow setup
107
106
  &.selectable-rows-enabled {
108
- tr {
107
+ tr {
109
108
  th:nth-child(2),
110
109
  .pb_flex_kit_orientation_row_justify_content_start_align_items_center_spacing_none.gap_none {
111
110
  justify-content: flex-end;
@@ -123,7 +122,7 @@
123
122
  }
124
123
 
125
124
  // Set fixed width for checkbox column
126
- &.table-header-cells-custom,
125
+ &.table-header-cells-custom,
127
126
  &.checkbox-cell.checkbox-cell-header {
128
127
  width: 40px !important;
129
128
  min-width: 40px !important;
@@ -146,7 +145,7 @@
146
145
  .checkbox-cell {
147
146
  display: flex;
148
147
  justify-content: center;
149
- [class^="pb_checkbox_kit"] .pb_checkbox_label {
148
+ [class^=pb_checkbox_kit] .pb_checkbox_label {
150
149
  padding-left: 0px;
151
150
  }
152
151
  }
@@ -174,7 +173,7 @@
174
173
  }
175
174
  }
176
175
  td {
177
- [class^="pb_text_input_kit"] .text_input_wrapper input {
176
+ [class^=pb_text_input_kit] .text_input_wrapper input {
178
177
  padding: 0 $space_xxs;
179
178
  font-size: 14px;
180
179
  text-align: right;
@@ -231,12 +230,12 @@
231
230
  max-height: 1920px;
232
231
  overflow-y: auto;
233
232
  }
234
-
233
+
235
234
  // Fullscreen
236
235
  &.advanced-table-allow-fullscreen {
237
236
  transition: all 0.3s ease;
238
237
  }
239
-
238
+
240
239
  &.advanced-table-fullscreen {
241
240
  background-color: $bg_light;
242
241
  box-sizing: border-box;
@@ -249,10 +248,7 @@
249
248
  z-index: $z_10;
250
249
 
251
250
  .pb_table {
252
- th,
253
- td,
254
- div,
255
- button {
251
+ th, td, div, button {
256
252
  font-size: calc(100%);
257
253
  }
258
254
  box-sizing: border-box;
@@ -270,7 +266,7 @@
270
266
  }
271
267
  }
272
268
  }
273
-
269
+
274
270
  .advanced-table-fullscreen-header {
275
271
  background-color: $white;
276
272
  height: 44px;
@@ -376,32 +372,78 @@
376
372
  width: 2px;
377
373
  }
378
374
 
379
- // Sticky Left Columns Styling
380
- &[class*="advanced-table-sticky-left-columns"] {
381
- overflow-x: scroll;
382
- .sticky-left {
383
- position: sticky !important;
384
- z-index: 2;
385
- background-color: $white;
386
- box-shadow: $shadow_deep;
387
- }
388
- @include advanced-table-sticky-mixin(
389
- $border_light,
390
- $white,
391
- lighten($silver, $opacity_7)
392
- );
393
- }
394
-
395
375
  // Responsive Styles
396
376
  @media only screen and (max-width: $screen-xl-min) {
397
377
  &[class*="advanced-table-responsive-scroll"] {
378
+ border-radius: 4px;
379
+ box-shadow: 1px 0 0 0px $border_light,
380
+ -1px 0 0 0px $border_light;
381
+ display: block;
398
382
  overflow-x: auto;
399
383
  width: 100%;
400
- @include advanced-table-sticky-mixin(
401
- $border_light,
402
- $white,
403
- lighten($silver, $opacity_7)
404
- );
384
+ [class^=pb_table].table-sm.table-card thead tr th:first-child,
385
+ [class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
386
+ border-left-width: 0px !important;
387
+ }
388
+ [class^=pb_table].table-sm.table-card thead tr th:last-child,
389
+ [class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:last-child {
390
+ border-right-width: 0px;
391
+ }
392
+ [class^=pb_table].table-sm.table-card tbody tr:last-child td:first-child,
393
+ [class^=pb_table].table-sm.table-card tbody tr:last-child td:last-child {
394
+ border-radius: 0 0 0 0;
395
+ }
396
+ .table-header-cells:first-child,
397
+ td:first-child,
398
+ .pb_table_td:first-child,
399
+ .checkbox-cell.checkbox-cell-header:first-child,
400
+ [class*="pinned-left"] {
401
+ background-color: $white;
402
+ box-shadow: $shadow_deep !important;
403
+ position: sticky !important;
404
+ left: 0;
405
+ z-index: 2;
406
+ }
407
+ .bg-silver td:first-child {
408
+ background-color: lighten($silver, $opacity_7);
409
+ }
410
+ .bg-white td:first-child {
411
+ background-color: $white;
412
+ }
413
+
414
+ .virtualized-table-row {
415
+ &.bg-silver td:first-child {
416
+ background-color: lighten($silver, $opacity_7);
417
+ }
418
+ &.bg-white td:first-child {
419
+ background-color: $white;
420
+ }
421
+ &.bg-row-selection td:first-child {
422
+ background-color: $info_subtle;
423
+ }
424
+ }
425
+
426
+ .row-selection-actions-card {
427
+ border-right-width: 0px;
428
+ border-left-width: 0px;
429
+ position: sticky;
430
+ top: 0;
431
+ left: 0;
432
+ border-radius: unset;
433
+ }
434
+ .checkbox-cell {
435
+ display: table-cell !important;
436
+ }
437
+ .sticky-header {
438
+ thead {
439
+ th:first-child {
440
+ box-shadow: 1px 0 10px -2px $border_light !important;
441
+ }
442
+ }
443
+ .pb_advanced_table_header {
444
+ box-shadow: none !important;
445
+ }
446
+ }
405
447
  }
406
448
  }
407
449
  @media only screen and (min-width: $screen-xl-min) {
@@ -438,9 +480,7 @@
438
480
  }
439
481
  }
440
482
 
441
- .table-header-cells:first-child,
442
- td:first-child,
443
- .pb_table_td:first-child {
483
+ .table-header-cells:first-child, td:first-child, .pb_table_td:first-child {
444
484
  box-shadow: 1px 0px 0px 0px $border_dark !important;
445
485
  }
446
486
 
@@ -448,14 +488,12 @@
448
488
  background-color: $border_dark !important;
449
489
  }
450
490
 
451
- .sort-button-icon,
452
- .header-sort-button > div,
453
- .pb_th_link {
491
+ .sort-button-icon, .header-sort-button > div, .pb_th_link {
454
492
  color: $white !important;
455
493
  }
456
494
 
457
495
  .gray-icon {
458
- color: $text_dk_light !important;
496
+ color: $text_dk_light !important;
459
497
  }
460
498
 
461
499
  .sticky-header {
@@ -498,33 +536,63 @@
498
536
  z-index: $z_10;
499
537
  }
500
538
 
501
- &[class*="advanced-table-sticky-left-columns"] {
502
- .sticky-left {
503
- background-color: $bg_dark;
504
- }
505
- @include advanced-table-sticky-mixin(
506
- $border_dark,
507
- $bg_dark_card,
508
- $bg_dark
509
- );
510
- }
511
-
512
539
  // Dark Mode Responsive Styles
513
540
  @media only screen and (max-width: $screen-xl-min) {
514
541
  &[class*="advanced-table-responsive-scroll"] {
542
+ border-radius: 4px;
543
+ box-shadow: 1px 0 0 0px $border_dark,
544
+ -1px 0 0 0px $border_dark;
545
+ display: block;
546
+ overflow-x: scroll;
547
+ width: 100%;
548
+ [class^=pb_table].table-sm.table-card thead tr th:first-child,
549
+ [class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
550
+ border-left-width: 0px;
551
+ }
552
+ [class^=pb_table].table-sm.table-card thead tr th:last-child,
553
+ [class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:last-child {
554
+ border-right-width: 0px;
555
+ }
556
+ [class^=pb_table].table-sm.table-card tbody tr:last-child td:first-child,
557
+ [class^=pb_table].table-sm.table-card tbody tr:last-child td:last-child {
558
+ border-radius: 0 0 0 0;
559
+ }
560
+ .table-header-cells:first-child,
561
+ td:first-child,
562
+ .pb_table_td:first-child,
563
+ .checkbox-cell.checkbox-cell-header:first-child,
564
+ [class*="pinned-left"] {
565
+ background: $bg_dark_card;
566
+ border-right: $border_dark;
567
+ box-shadow: $shadow_deep !important;
568
+ position: sticky !important;
569
+ }
570
+ .bg-silver td:first-child {
571
+ background-color: $bg_dark;
572
+ }
573
+ .bg-white td:first-child {
574
+ background-color: $bg_dark_card;
575
+ }
576
+
577
+ // Dark mode virtualized rows
578
+ .virtualized-table-row {
579
+ &.bg-silver td:first-child {
580
+ background-color: $bg_dark;
581
+ }
582
+ &.bg-white td:first-child {
583
+ background-color: $bg_dark_card;
584
+ }
585
+ }
586
+
515
587
  .sticky-header {
516
588
  thead {
517
589
  th:first-child {
518
- background: $bg_dark_card;
590
+ background: $bg_dark;
591
+ box-shadow: 1px 0 10px -2px $border_dark !important;
519
592
  }
520
593
  }
521
594
  }
522
- @include advanced-table-sticky-mixin(
523
- $border_dark,
524
- $bg_dark_card,
525
- $bg_dark
526
- );
527
595
  }
528
596
  }
529
597
  }
530
- }
598
+ }
@@ -87,7 +87,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
87
87
  showActionsBar = true,
88
88
  selectableRows,
89
89
  sortControl,
90
- stickyLeftColumn,
91
90
  tableData,
92
91
  tableOptions,
93
92
  tableProps,
@@ -234,7 +233,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
234
233
  'advanced-table-fullscreen': isFullscreen,
235
234
  'advanced-table-allow-fullscreen': allowFullScreen
236
235
  },
237
- {'advanced-table-sticky-left-columns': stickyLeftColumn && stickyLeftColumn.length > 0},
238
236
  globalProps(props),
239
237
  className
240
238
  );
@@ -293,7 +291,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
293
291
  setExpanded={setExpanded}
294
292
  showActionsBar={showActionsBar}
295
293
  sortControl={sortControl}
296
- stickyLeftColumn={stickyLeftColumn}
297
294
  subRowHeaders={tableOptions?.subRowHeaders}
298
295
  table={table}
299
296
  tableContainerRef={tableWrapperRef}
@@ -30,4 +30,4 @@
30
30
  }
31
31
  ] %>
32
32
 
33
- <%= pb_rails("advanced_table", props: { id: "table_props_table", table_data: @table_data, column_definitions: column_definitions, table_props: { vertical_border: true, container: false }}) %>
33
+ <%= pb_rails("advanced_table", props: { id: "table_props_table", table_data: @table_data, column_definitions: column_definitions, responsive: "none", table_props: { container: false, sticky: true }}) %>
@@ -37,13 +37,14 @@ const AdvancedTableTableProps = (props) => {
37
37
 
38
38
  const tableProps = {
39
39
  container: false,
40
- verticalBorder: true
40
+ sticky: true
41
41
  }
42
42
 
43
43
  return (
44
44
  <div>
45
45
  <AdvancedTable
46
46
  columnDefinitions={columnDefinitions}
47
+ responsive="none"
47
48
  tableData={MOCK_DATA}
48
49
  tableProps={tableProps}
49
50
  {...props}
@@ -1,3 +1,3 @@
1
- This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table/react) under the hood which comes with its own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `table_props` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table/react).
1
+ This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table) under the hood which comes with its own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `table_props` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table).
2
2
 
3
- This doc example showcases the use of two table props, including how to render the vertical borders between columns.
3
+ This doc example showcases how to set a sticky header for a nonresponsive table. To achieve sticky header AND responsive functionality, see the ["Table Props Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table#table-props-sticky-header) doc example below.
@@ -1,3 +1,3 @@
1
1
  This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table/react) under the hood which comes with its own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `tableProps` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table/react).
2
2
 
3
- This doc example showcases the use of two table props, including how to render the vertical borders between columns.
3
+ This doc example showcases how to set a sticky header for a nonresponsive table. To achieve sticky header AND responsive functionality, see the ["Table Props Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table/react#table-props-sticky-header) doc example below.
@@ -1,7 +1,3 @@
1
- Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `table_props` and giving the AdvancedTable a `max_height` using our [Max Height](https://playbook.powerapp.cloud/visual_guidelines/max_height) global prop.
1
+ Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `table_props` and giving the AdvancedTable a `max_height` using our [Max Height](https://playbook.powerapp.cloud/visual_guidelines/max_height) global prop. This behavior requires a `max_height` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
2
2
 
3
- **NOTE**: This behavior requires a `max_height` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
4
-
5
- Expand the table above to see this in action.
6
-
7
- A sticky header on a nonresponsive table is demonstrated in the ["Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table#sticky-header) doc example above.
3
+ A sticky header on a nonresponsive table is demonstrated in the ["Table Props"](https://playbook.powerapp.cloud/kits/advanced_table#table-props) doc example above.
@@ -1,7 +1,3 @@
1
- Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and giving the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/visual_guidelines/max_height) global prop.
1
+ Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and giving the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/visual_guidelines/max_height) global prop. This behavior requires a `maxHeight` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
2
2
 
3
- **NOTE**: This behavior requires a `maxHeight` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
4
-
5
- Expand the table above to see this in action.
6
-
7
- A sticky header on a nonresponsive table is demonstrated in the ["Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table/react#sticky-header) doc example above.
3
+ A sticky header on a nonresponsive table is demonstrated in the ["Table Props"](https://playbook.powerapp.cloud/kits/advanced_table/react#table-props) doc example above.
@@ -5,8 +5,7 @@ examples:
5
5
  - advanced_table_beta_subrow_headers: SubRow Headers
6
6
  - advanced_table_collapsible_trail_rails: Collapsible Trail
7
7
  - advanced_table_table_props: Table Props
8
- - advanced_table_sticky_header_rails: Sticky Header
9
- - advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
8
+ - advanced_table_table_props_sticky_header: Table Props Sticky Header
10
9
  - advanced_table_beta_sort: Enable Sorting
11
10
  - advanced_table_responsive: Responsive Tables
12
11
  - advanced_table_custom_cell_rails: Custom Components for Cells
@@ -26,10 +25,7 @@ examples:
26
25
  - advanced_table_collapsible_trail: Collapsible Trail
27
26
  - advanced_table_table_options: Table Options
28
27
  - advanced_table_table_props: Table Props
29
- - advanced_table_sticky_header: Sticky Header
30
- - advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
31
- - advanced_table_sticky_columns: Sticky Columns
32
- - advanced_table_sticky_columns_and_header: Sticky Columns with Sticky Header
28
+ - advanced_table_table_props_sticky_header: Table Props Sticky Header
33
29
  - advanced_table_inline_row_loading: Inline Row Loading
34
30
  - advanced_table_responsive: Responsive Tables
35
31
  - advanced_table_custom_cell: Custom Components for Cells
@@ -22,7 +22,4 @@ export { default as AdvancedTableSelectableRowsActions } from './_advanced_table
22
22
  export { default as AdvancedTableTablePropsStickyHeader } from './_advanced_table_table_props_sticky_header.jsx'
23
23
  export { default as AdvancedTableColumnHeadersCustomCell } from './_advanced_table_column_headers_custom_cell.jsx'
24
24
  export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_editing.jsx'
25
- export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen.jsx'
26
- export { default as AdvancedTableStickyColumns } from './_advanced_table_sticky_columns.jsx'
27
- export { default as AdvancedTableStickyHeader } from './_advanced_table_sticky_header.jsx'
28
- export { default as AdvancedTableStickyColumnsAndHeader } from './_advanced_table_sticky_columns_and_header.jsx'
25
+ export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen.jsx'
@@ -1,4 +1,5 @@
1
- import React from 'react'
1
+
2
+ import React, { useState } from 'react'
2
3
  import classnames from 'classnames'
3
4
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
4
5
  import { globalProps } from '../utilities/globalProps'
@@ -6,19 +7,16 @@ import { globalProps } from '../utilities/globalProps'
6
7
  import Button from '../pb_button/_button'
7
8
  import Tooltip from '../pb_tooltip/_tooltip'
8
9
 
9
- import usePBCopy from './usePBCopy'
10
-
11
10
  type CopyButtonProps = {
12
- aria?: { [key: string]: string }
13
- className?: string
14
- data?: { [key: string]: string }
15
- id?: string
16
- from?: string
17
- text?: string
18
- tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left'
19
- tooltipText?: string
20
- value?: string
21
- timeout?: number
11
+ aria?: { [key: string]: string },
12
+ className?: string,
13
+ data?: { [key: string]: string },
14
+ id?: string,
15
+ from?: string,
16
+ text?: string,
17
+ tooltipPlacement?: "top" | "right" | "bottom" | "left",
18
+ tooltipText?: string,
19
+ value?: string,
22
20
  }
23
21
 
24
22
  const CopyButton = (props: CopyButtonProps) => {
@@ -29,34 +27,62 @@ const CopyButton = (props: CopyButtonProps) => {
29
27
  from = '',
30
28
  id,
31
29
  text= 'Copy',
32
- timeout = 1000,
33
30
  tooltipPlacement= 'bottom',
34
31
  tooltipText = 'Copied!',
35
32
  value = '',
36
33
  } = props
37
34
 
38
- const [copied, copy] = usePBCopy({ value, from, timeout })
35
+ const [copied, setCopied] = useState(false)
39
36
 
40
37
  const ariaProps = buildAriaProps(aria)
41
38
  const dataProps = buildDataProps(data)
42
39
  const classes = classnames(buildCss('pb_copy_button_kit'), globalProps(props), className)
43
40
 
41
+ const copy = () => {
42
+ if (!from && !value) {
43
+ return
44
+ }
45
+
46
+ if (value) {
47
+ navigator.clipboard.writeText(value)
48
+ } else if (from) {
49
+ const copyElement = document.getElementById(from);
50
+ let copyText = copyElement?.innerText
51
+
52
+ if (copyElement instanceof HTMLTextAreaElement || copyElement instanceof HTMLInputElement) {
53
+ copyText = copyElement.value;
54
+ }
55
+
56
+ if (copyText) {
57
+ navigator.clipboard.writeText(copyText)
58
+ }
59
+ }
60
+
61
+ setCopied(true)
62
+
63
+ setTimeout(() => {
64
+ setCopied(false)
65
+ }, 1000);
66
+ }
67
+
44
68
  return (
45
- <div {...ariaProps}
69
+ <div
70
+ {...ariaProps}
46
71
  {...dataProps}
47
72
  className={classes}
48
73
  id={id}
49
74
  >
50
- <Tooltip
75
+ <Tooltip
51
76
  forceOpenTooltip={copied}
52
77
  placement={tooltipPlacement}
53
78
  showTooltip={false}
54
79
  text={tooltipText}
55
80
  >
56
- <Button icon="copy"
81
+ <Button
82
+ icon='copy'
57
83
  onClick={copy}
58
84
  >
59
- {text}
85
+ { text }
60
86
  </Button>
61
87
  </Tooltip>
62
88
  </div>
@@ -6,4 +6,3 @@ examples:
6
6
  react:
7
7
  - copy_button_default: Default
8
8
  - copy_button_from: Copy From
9
- - copy_button_hook: Copy Hook
@@ -1,3 +1,2 @@
1
1
  export { default as CopyButtonDefault } from './_copy_button_default.jsx'
2
- export { default as CopyButtonFrom } from './_copy_button_from.jsx'
3
- export { default as CopyButtonHook } from './_copy_button_hook.jsx'
2
+ export { default as CopyButtonFrom } from './_copy_button_from.jsx'