playbook_ui 14.25.0.pre.rc.0 → 14.25.0.pre.rc.2

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +4 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +1 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +56 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +60 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +3 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.jsx +57 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.md +1 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
  11. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +10 -1
  12. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +2 -0
  13. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.html.erb +24 -0
  14. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.md +3 -0
  15. data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +1 -0
  16. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +2 -2
  17. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +22 -0
  18. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +43 -0
  19. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +1 -0
  20. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  21. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
  22. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +2 -1
  23. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -1
  24. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +6 -0
  25. data/app/pb_kits/playbook/pb_pagination/_pagination.test.jsx +212 -0
  26. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +8 -1
  27. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control.jsx +112 -0
  28. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control_react.md +3 -0
  29. data/app/pb_kits/playbook/pb_pagination/docs/example.yml +1 -0
  30. data/app/pb_kits/playbook/pb_pagination/docs/index.js +1 -0
  31. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +11 -1
  32. data/dist/chunks/{_line_graph-D7DgMqnT.js → _line_graph-qk_BN_J0.js} +1 -1
  33. data/dist/chunks/{_typeahead-BzYZCpJO.js → _typeahead-ZLTFtAoW.js} +1 -1
  34. data/dist/chunks/{_weekday_stacked-CJIFKKe7.js → _weekday_stacked-BurOZ5v9.js} +3 -3
  35. data/dist/chunks/vendor.js +1 -1
  36. data/dist/menu.yml +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/lib/playbook/version.rb +1 -1
  41. metadata +17 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7acc2e53df8398198aa9fed4b39f2dc04a954918e790a904220898da123e15e8
4
- data.tar.gz: 606391f77a95f67235606bdf5113c7f2fb1c749ff7bb99999fff120f358f7d85
3
+ metadata.gz: 7a6f59648099444a5091e76198b14956ef740f7667bf995ad5142ffc276c5422
4
+ data.tar.gz: a41f31b440d1bb9b1558060fe7e6e707d1d1f8a4a3f66e840733f51014cbcd7f
5
5
  SHA512:
6
- metadata.gz: 4f381cbe31526cc2e7fe5c0f90402e169e88d6bca29b6257a200460ca24539db770651df305094d9ac4b0db2ffb39d435308f0b4af4e91ce3a57fa69c51a78a6
7
- data.tar.gz: b2d994c35bd502f6221e469c7a65da5911222b835672bbfa955d8b12f9612e47dd4bd9b20c4f08e6e57a2c2163e0b4c415f1ac516b62eef772ca9540487cb7fb
6
+ metadata.gz: 721c906257c87fed7f8fb020b7220aa732d58cc87edcc21683237bf41dfa0aa6862ddb919ddd46e977cffc9d334cf8a5dd98fcf50e8b0868d0397e1acf324413
7
+ data.tar.gz: 5a8f31d4ba90f1221175b239de49975d74461420c6171b9e86434514564f27ddc0624ea2365d01eb481a72027ae1c807ba700b405e88f48f903df67fee1d738e
@@ -58,7 +58,9 @@ const TableCellRenderer = ({
58
58
  // Find the “owning” colDefinition by accessor. Needed for multi column logic
59
59
  const colDef = findColumnDefByAccessor(columnDefinitions ?? [], column.id)
60
60
  const cellAlignment = colDef?.columnStyling?.cellAlignment ?? "right"
61
-
61
+ const paddingValue = colDef?.columnStyling?.cellPadding ?? customRowStyle?.cellPadding
62
+ const paddingClass = paddingValue ? `p_${paddingValue}` : undefined
63
+
62
64
  return (
63
65
  <td
64
66
  align={cellAlignment}
@@ -68,6 +70,7 @@ const TableCellRenderer = ({
68
70
  isPinnedLeft && 'pinned-left',
69
71
  stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft && 'sticky-left',
70
72
  isLastCell && 'last-cell',
73
+ paddingClass
71
74
  )}
72
75
  key={`${cell.id}-data`}
73
76
  style={{
@@ -113,7 +113,6 @@ export const TableHeaderCell = ({
113
113
  return visibleSiblings.at(-1) === header.column;
114
114
  })();
115
115
 
116
-
117
116
  const cellClassName = classnames(
118
117
  "table-header-cells",
119
118
  `${showActionsBar && isActionBarVisible && "header-cells-with-actions"}`,
@@ -122,7 +121,7 @@ const cellClassName = classnames(
122
121
  { "pinned-left": responsive === "scroll" && isPinnedLeft },
123
122
  isLastHeaderCell ? "last-header-cell" : "",
124
123
  stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft ? 'sticky-left' : "",
125
-
124
+ colDef?.columnStyling?.headerPadding && `p_${colDef?.columnStyling?.headerPadding}`
126
125
  );
127
126
 
128
127
  const cellId = `${loading ?
@@ -651,6 +651,36 @@ test("columnStyling.cellAlignment sets each <td> align attribute as expected", (
651
651
  expect(firstEnrollmentCell).toHaveAttribute("align", "left");
652
652
  });
653
653
 
654
+ test("columnStyling.cellPadding sets cell padding", () => {
655
+ const styledColumnDefs = [
656
+ {
657
+ accessor: "year",
658
+ label: "Year",
659
+ cellAccessors: ["quarter", "month", "day"],
660
+ },
661
+ {
662
+ accessor: "newEnrollments",
663
+ label: "New Enrollments",
664
+ columnStyling: { cellPadding: "none" },
665
+ },
666
+ {
667
+ accessor: "scheduledMeetings",
668
+ label: "Scheduled Meetings",
669
+ },
670
+ ];
671
+
672
+ render(
673
+ <AdvancedTable
674
+ columnDefinitions={styledColumnDefs}
675
+ data={{ testid: testId }}
676
+ tableData={MOCK_DATA}
677
+ />
678
+ );
679
+
680
+ const firstEnrollmentCell = screen.getAllByText("20")[0].closest("td");
681
+ expect(firstEnrollmentCell).toHaveClass('p_none')
682
+ });
683
+
654
684
  test("renders virtualized table rows and header", () => {
655
685
  render(
656
686
  <AdvancedTable
@@ -694,6 +724,32 @@ test("rowStyling prop works as expected", () => {
694
724
  expect(row1).toHaveStyle({backgroundColor: colors.white, color: colors.black})
695
725
  })
696
726
 
727
+ test("rowStyling prop to allow padding control", () => {
728
+ const rowStyling = [
729
+ {
730
+ rowId: "1",
731
+ cellPadding: "lg"
732
+ },
733
+ ];
734
+
735
+ render(
736
+ <AdvancedTable
737
+ columnDefinitions={columnDefinitions}
738
+ data={{ testid: testId }}
739
+ rowStyling={rowStyling}
740
+ tableData={MOCK_DATA_WITH_ID}
741
+ />
742
+ )
743
+
744
+ const kit = screen.getByTestId(testId)
745
+ const tableBody = kit.querySelector('tbody')
746
+ const row1 = tableBody.querySelector('tr:nth-child(1)')
747
+ const cells = row1.querySelectorAll("td");
748
+ cells.forEach((cell) => {
749
+ expect(cell.classList.contains("p_lg")).toBe(true);
750
+ });
751
+ })
752
+
697
753
  test("Sort icon renders with enableSort on individual columns", () => {
698
754
  render(
699
755
  <AdvancedTable
@@ -0,0 +1,60 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import Background from '../../pb_background/_background'
4
+ import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
5
+
6
+ const AdvancedTablePaddingControl = (props) => {
7
+ const columnDefinitions = [
8
+ {
9
+ accessor: "year",
10
+ label: "Year",
11
+ cellAccessors: ["quarter", "month", "day"],
12
+ },
13
+ {
14
+ accessor: "newEnrollments",
15
+ label: "New Enrollments",
16
+ columnStyling:{cellPadding: "none"},
17
+ customRenderer: (row, value) => (
18
+ <Background
19
+ backgroundColor={row.original.newEnrollments > 20 ? "success_secondary" : "warning_secondary"}
20
+ padding="xs"
21
+ >
22
+ {value}
23
+ </Background>
24
+ ),
25
+
26
+ },
27
+ {
28
+ accessor: "scheduledMeetings",
29
+ label: "Scheduled Meetings",
30
+ },
31
+ {
32
+ accessor: "attendanceRate",
33
+ label: "Attendance Rate",
34
+ },
35
+ {
36
+ accessor: "completedClasses",
37
+ label: "Completed Classes",
38
+ },
39
+ {
40
+ accessor: "classCompletionRate",
41
+ label: "Class Completion Rate",
42
+ },
43
+ {
44
+ accessor: "graduatedStudents",
45
+ label: "Graduated Students",
46
+ },
47
+ ]
48
+
49
+ return (
50
+ <div>
51
+ <AdvancedTable
52
+ columnDefinitions={columnDefinitions}
53
+ tableData={MOCK_DATA}
54
+ {...props}
55
+ />
56
+ </div>
57
+ )
58
+ }
59
+
60
+ export default AdvancedTablePaddingControl
@@ -0,0 +1,3 @@
1
+ `columnStyling` can also be used to control padding on all cells in a given column via the use of the `cellPadding` key/value pair. `cellPadding` lets you use 'xxs', 'xs', 'sm', 'md', 'lg', 'xl' and 'none'.
2
+
3
+ This control can be used in conjunction with the `customRenderer` item within each columnDefinition to achieve custom background colors for individual cells as seen here.
@@ -0,0 +1,57 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
4
+
5
+ const AdvancedTablePaddingControlPerRow = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ },
12
+ {
13
+ accessor: "newEnrollments",
14
+ label: "New Enrollments",
15
+ },
16
+ {
17
+ accessor: "scheduledMeetings",
18
+ label: "Scheduled Meetings",
19
+ },
20
+ {
21
+ accessor: "attendanceRate",
22
+ label: "Attendance Rate",
23
+ },
24
+ {
25
+ accessor: "completedClasses",
26
+ label: "Completed Classes",
27
+ },
28
+ {
29
+ accessor: "classCompletionRate",
30
+ label: "Class Completion Rate",
31
+ },
32
+ {
33
+ accessor: "graduatedStudents",
34
+ label: "Graduated Students",
35
+ },
36
+ ]
37
+
38
+ const rowStyling = [
39
+ {
40
+ rowId: "1",
41
+ cellPadding:"md"
42
+ },
43
+ ];
44
+
45
+ return (
46
+ <div>
47
+ <AdvancedTable
48
+ columnDefinitions={columnDefinitions}
49
+ rowStyling={rowStyling}
50
+ tableData={MOCK_DATA}
51
+ {...props}
52
+ />
53
+ </div>
54
+ )
55
+ }
56
+
57
+ export default AdvancedTablePaddingControlPerRow
@@ -0,0 +1 @@
1
+ `rowStyling` can also be used to control padding on all cells in a given row via the use of the `cellPadding` key/value pair as shown here. `cellPadding` lets you use 'xxs', 'xs', 'sm', 'md', 'lg', 'xl' and 'none'.
@@ -68,8 +68,10 @@ examples:
68
68
  - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
69
69
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
70
70
  - advanced_table_row_styling: Row Styling
71
+ - advanced_table_padding_control_per_row: Padding Control using Row Styling
71
72
  - advanced_table_column_styling: Column Styling
72
73
  - advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
74
+ - advanced_table_padding_control: Padding Control using Column Styling
73
75
  - advanced_table_column_border_color: Column Group Border Color
74
76
  - advanced_table_fullscreen: Fullscreen
75
77
  - advanced_table_infinite_scroll: Infinite Scroll
@@ -43,4 +43,6 @@ export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_c
43
43
  export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
44
44
  export { default as AdvancedTableWithCustomHeaderMultiHeader } from './_advanced_table_with_custom_header_multi_header.jsx'
45
45
  export { default as AdvancedTableSortPerColumn } from './_advanced_table_sort_per_column.jsx'
46
- export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
46
+ export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
47
+ export { default as AdvancedTablePaddingControl } from './_advanced_table_padding_control.jsx'
48
+ export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
@@ -1,5 +1,14 @@
1
1
  <%= pb_content_tag do %>
2
- <%= pb_rails("button", props: {type: object.type, loading: object.loading, link: object.link, new_window:object.new_window, variant: object.variant, target: object.target, disabled: object.disabled, dark: object.dark}) do %>
2
+ <%= pb_rails("button", props: {
3
+ type: object.type,
4
+ loading: object.loading,
5
+ link: object.link,
6
+ new_window: object.new_window,
7
+ variant: object.variant,
8
+ target: object.target,
9
+ disabled: object.disabled,
10
+ dark: object.dark
11
+ }.merge(object.input_options)) do %>
3
12
  <%= pb_rails("icon", props: {icon: object.icon, fixed_width: true, dark: object.dark}) %>
4
13
  <% end %>
5
14
  <% end %>
@@ -21,6 +21,8 @@ module Playbook
21
21
  prop :size, type: Playbook::Props::Enum,
22
22
  values: %w[default sm],
23
23
  default: "default"
24
+ prop :input_options, type: Playbook::Props::HashProp,
25
+ default: {}
24
26
 
25
27
  def classname
26
28
  generate_classname("pb_circle_icon_button_kit") + size_class
@@ -0,0 +1,24 @@
1
+ <%= pb_rails("circle_icon_button", props: {
2
+ icon: "plus",
3
+ input_options: {
4
+ data: { "test-id": "add-button", remote: true },
5
+ }
6
+ }) %>
7
+ <br/>
8
+ <%= pb_rails("circle_icon_button", props: {
9
+ icon: "pen",
10
+ variant: "secondary",
11
+ input_options: {
12
+ data: { "test-id": "edit-button" },
13
+ classname: "custom-secondary-button-class"
14
+ }
15
+ }) %>
16
+ <br/>
17
+ <%= pb_rails("circle_icon_button", props: {
18
+ icon: "user",
19
+ variant: "link",
20
+ input_options: {
21
+ data: { "test-id": "user-button" },
22
+ id: "user-button-id"
23
+ }
24
+ }) %>
@@ -0,0 +1,3 @@
1
+ Use the `input_options` prop to pass additional attributes directly to the internal Playbook Button component. While the wrapper div has access to the standard `data` prop from KitBase, `input_options` allows you to attach attributes specifically to the internal button element.
2
+
3
+ This is particularly useful when you need data attributes or other HTML attributes to apply to the button itself.
@@ -5,6 +5,7 @@ examples:
5
5
  - circle_icon_button_link: Link
6
6
  - circle_icon_button_loading: Loading
7
7
  - circle_icon_button_size: Size
8
+ - circle_icon_button_input_options: Input Options
8
9
 
9
10
  react:
10
11
  - circle_icon_button_default: Default
@@ -52,7 +52,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
52
52
  } = props;
53
53
 
54
54
  const returnedIcon = icon || iconMap[status]
55
- const iconClass = icon ? "custom_icon" : ""
55
+ const iconClass = icon && icon !== "none" ? "custom_icon" : ""
56
56
 
57
57
  const css = classnames(
58
58
  `pb_fixed_confirmation_toast_kit_${status}`,
@@ -92,7 +92,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
92
92
  onClick={handleClick}
93
93
  {...htmlProps}
94
94
  >
95
- {returnedIcon && (
95
+ {returnedIcon && icon !== "none" && (
96
96
  <Icon
97
97
  className="pb_icon"
98
98
  fixedWidth
@@ -0,0 +1,22 @@
1
+ <%= pb_rails("fixed_confirmation_toast", props: {
2
+ text: "Error Message",
3
+ status: "error",
4
+ icon: "none",
5
+ closeable: true
6
+ })%>
7
+
8
+ <br><br>
9
+
10
+ <%= pb_rails("fixed_confirmation_toast", props: {
11
+ text: "Items Successfully Moved",
12
+ status: "success",
13
+ icon: "none"
14
+ })%>
15
+
16
+ <br><br>
17
+
18
+ <%= pb_rails("fixed_confirmation_toast", props: {
19
+ text: "Scan to Assign Selected Items",
20
+ status: "neutral",
21
+ icon: "none"
22
+ })%>
@@ -0,0 +1,43 @@
1
+ import React from 'react'
2
+
3
+ import FixedConfirmationToast from '../_fixed_confirmation_toast'
4
+
5
+ const FixedConfirmationToastNoIcon = (props) => {
6
+ return (
7
+ <div>
8
+ <div>
9
+ <FixedConfirmationToast
10
+ closeable
11
+ icon="none"
12
+ status="error"
13
+ text="Error Message"
14
+ {...props}
15
+ />
16
+ </div>
17
+
18
+ <br />
19
+
20
+ <div>
21
+ <FixedConfirmationToast
22
+ icon="none"
23
+ status="success"
24
+ text="Items Successfully Moved"
25
+ {...props}
26
+ />
27
+ </div>
28
+
29
+ <br />
30
+
31
+ <div>
32
+ <FixedConfirmationToast
33
+ icon="none"
34
+ status="neutral"
35
+ text="Scan to Assign Selected Items"
36
+ {...props}
37
+ />
38
+ </div>
39
+ </div>
40
+ )
41
+ }
42
+
43
+ export default FixedConfirmationToastNoIcon
@@ -0,0 +1 @@
1
+ Setting `icon` prop to "none" will render the fixed confirmation toast without the left side icon.
@@ -8,6 +8,7 @@ examples:
8
8
  - fixed_confirmation_toast_auto_close: Click to Show Auto Close
9
9
  - fixed_confirmation_toast_children: Children
10
10
  - fixed_confirmation_toast_custom_icon: Custom Icon
11
+ - fixed_confirmation_toast_no_icon: No Icon
11
12
 
12
13
  react:
13
14
  - fixed_confirmation_toast_default: Default
@@ -17,6 +18,7 @@ examples:
17
18
  - fixed_confirmation_toast_auto_close: Click to Show Auto Close
18
19
  - fixed_confirmation_toast_children: Children
19
20
  - fixed_confirmation_toast_custom_icon: Custom Icon
21
+ - fixed_confirmation_toast_no_icon: No Icon
20
22
 
21
23
  swift:
22
24
  - fixed_confirmation_toast_default_swift: Default
@@ -5,3 +5,4 @@ export { default as FixedConfirmationToastPositions } from './_fixed_confirmatio
5
5
  export { default as FixedConfirmationToastAutoClose } from './_fixed_confirmation_toast_auto_close.jsx'
6
6
  export { default as FixedConfirmationToastChildren } from './_fixed_confirmation_toast_children.jsx'
7
7
  export { default as FixedConfirmationToastCustomIcon } from './_fixed_confirmation_toast_custom_icon.jsx'
8
+ export { default as FixedConfirmationToastNoIcon } from './_fixed_confirmation_toast_no_icon.jsx'
@@ -1,6 +1,7 @@
1
1
  <%= pb_content_tag do %>
2
+ <% if object.icon_value && object.icon_value != "none" %>
2
3
  <%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
3
-
4
+ <% end %>
4
5
  <% if content %>
5
6
  <%= content %>
6
7
  <% elsif object.show_text? %>
@@ -56,7 +56,7 @@ module Playbook
56
56
  end
57
57
 
58
58
  def icon_class
59
- icon.present? ? " custom_icon" : ""
59
+ icon.present? && icon != "none" ? " custom_icon" : ""
60
60
  end
61
61
 
62
62
  def classname
@@ -56,6 +56,12 @@ test('renders custom icon when provided', () => {
56
56
  expect(container.querySelector('.custom_icon')).toBeInTheDocument();
57
57
  });
58
58
 
59
+ test("renders no icon when icon prop is 'none'", () => {
60
+ const { container } = render(<FixedConfirmationToast icon="none" />);
61
+ expect(container.querySelector('.pb_icon')).not.toBeInTheDocument();
62
+ expect(container.querySelector('.custom_icon')).not.toBeInTheDocument();
63
+ });
64
+
59
65
  test('renders correctly with multiLine prop', () => {
60
66
  const { container } = render(<FixedConfirmationToast multiLine />);
61
67
  expect(container.querySelector('._multi_line')).toBeInTheDocument();