playbook_ui 14.24.0.pre.alpha.testingwithoutlazyload9529 → 14.24.0.pre.rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +6 -7
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +1 -4
  5. data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +25 -24
  6. data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +10 -10
  7. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +13 -11
  8. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +4 -7
  9. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +1 -1
  10. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +2 -112
  11. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +7 -13
  12. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
  13. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -12
  14. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -90
  15. data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +0 -16
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +1 -1
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +1 -1
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -7
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -6
  20. data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +11 -4
  21. data/app/pb_kits/playbook/pb_advanced_table/index.js +125 -108
  22. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +1 -7
  23. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -5
  24. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +4 -10
  25. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
  26. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +5 -22
  27. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -1
  28. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -12
  29. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +1 -1
  30. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +1 -2
  31. data/app/pb_kits/playbook/pb_checkbox/index.js +26 -218
  32. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +1 -10
  33. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +0 -2
  34. data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +0 -1
  35. data/app/pb_kits/playbook/pb_date/_date.tsx +3 -5
  36. data/app/pb_kits/playbook/pb_date/date.html.erb +6 -6
  37. data/app/pb_kits/playbook/pb_date/date.rb +0 -2
  38. data/app/pb_kits/playbook/pb_date/docs/example.yml +0 -2
  39. data/app/pb_kits/playbook/pb_date/docs/index.js +0 -1
  40. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -17
  41. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +0 -6
  42. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +0 -1
  43. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +1 -1
  44. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -3
  45. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -2
  46. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +0 -24
  47. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -11
  48. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +2 -2
  49. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +0 -2
  50. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +0 -1
  51. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +1 -2
  52. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -1
  53. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +0 -6
  54. data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +9 -18
  55. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -3
  56. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -1
  57. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -3
  58. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +1 -12
  59. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_rails.md +1 -3
  60. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +1 -3
  61. data/app/pb_kits/playbook/pb_pagination/docs/example.yml +0 -1
  62. data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -1
  63. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +1 -11
  64. data/app/pb_kits/playbook/pb_select/select.rb +2 -4
  65. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +0 -1
  66. data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +1 -49
  67. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.scss +0 -0
  68. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +202 -0
  69. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_continuous.jsx +69 -0
  70. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_default.jsx +71 -0
  71. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_multi_beacon.jsx +110 -0
  72. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_beacon.jsx +76 -0
  73. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_overlay.jsx +76 -0
  74. data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_styled.jsx +76 -0
  75. data/app/pb_kits/playbook/pb_walkthrough/docs/example.yml +10 -0
  76. data/app/pb_kits/playbook/pb_walkthrough/docs/index.js +6 -0
  77. data/app/pb_kits/playbook/pb_walkthrough/walkthrough.test.jsx +34 -0
  78. data/dist/chunks/{_line_graph-qk_BN_J0.js → _line_graph-BfCo79KE.js} +1 -1
  79. data/dist/chunks/{_typeahead-ZLTFtAoW.js → _typeahead-Db4YQA5c.js} +2 -2
  80. data/dist/chunks/_weekday_stacked-DhFTG-Jt.js +61 -0
  81. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  82. data/dist/chunks/{lib-CY5ZPzic.js → lib-DnQyMxO1.js} +2 -2
  83. data/dist/chunks/{pb_form_validation-D3b0JKHH.js → pb_form_validation-kl-4Jv4t.js} +1 -1
  84. data/dist/chunks/vendor.js +1 -1
  85. data/dist/menu.yml +11 -4
  86. data/dist/playbook-doc.js +2 -2
  87. data/dist/playbook-rails-react-bindings.js +1 -1
  88. data/dist/playbook-rails.js +1 -1
  89. data/dist/playbook.css +1 -1
  90. data/lib/playbook/version.rb +2 -2
  91. metadata +19 -36
  92. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +0 -43
  93. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +0 -64
  94. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +0 -60
  95. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +0 -3
  96. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.jsx +0 -57
  97. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.md +0 -1
  98. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.jsx +0 -55
  99. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.md +0 -6
  100. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.jsx +0 -80
  101. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.md +0 -1
  102. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +0 -107
  103. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.md +0 -1
  104. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.html.erb +0 -24
  105. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.md +0 -3
  106. data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.html.erb +0 -4
  107. data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.jsx +0 -17
  108. data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.md +0 -1
  109. data/app/pb_kits/playbook/pb_dropdown/_dropdown_mixin.scss +0 -36
  110. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options.jsx +0 -90
  111. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md +0 -4
  112. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +0 -22
  113. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +0 -43
  114. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +0 -1
  115. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.html.erb +0 -75
  116. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.jsx +0 -94
  117. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.md +0 -3
  118. data/app/pb_kits/playbook/pb_pagination/_pagination.test.jsx +0 -212
  119. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control.jsx +0 -112
  120. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control_react.md +0 -3
  121. data/dist/chunks/_weekday_stacked-rU5SIBAO.js +0 -37
@@ -1,24 +0,0 @@
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
- }) %>
@@ -1,3 +0,0 @@
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.
@@ -1,4 +0,0 @@
1
- <%= pb_rails("date", props: {
2
- date: Date.today,
3
- show_current_year: true
4
- }) %>
@@ -1,17 +0,0 @@
1
- import React from 'react'
2
-
3
- import FormattedDate from '../../pb_date/_date'
4
-
5
- const DateWithShowCurrentYear = (props) => {
6
- return (
7
- <>
8
- <FormattedDate
9
- showCurrentYear
10
- value={new Date()}
11
- {...props}
12
- />
13
- </>
14
- )
15
- }
16
-
17
- export default DateWithShowCurrentYear
@@ -1 +0,0 @@
1
- By default, the Date kit does NOT display the year if it is the current year. If you want to display the current year you can do so by setting `showCurrentYear`/`show_current_year` to true as shown here.
@@ -1,36 +0,0 @@
1
- @import "../tokens/colors";
2
-
3
- // activeStyle fontColor sass map to go through text colors + set of custom colors
4
- $custom-font-colors: (
5
- primary: $primary
6
- );
7
-
8
- $merged-font-colors: map-merge($text_colors, $custom-font-colors);
9
-
10
- $font-colors: ();
11
-
12
- @each $key, $val in $merged-font-colors {
13
- $font-colors: map-merge($font-colors, ($key: $val));
14
- }
15
-
16
- @mixin apply-font-color($color) {
17
- color: $color;
18
-
19
- [class^="pb_body"],
20
- [class^="pb_title_kit"],
21
- a {
22
- color: $color !important;
23
- }
24
- }
25
-
26
- // activeStyle backgroundColor map (set of custom colors)
27
- $custom-background-colors: (
28
- "bg_light": $bg_light,
29
- "white": $white,
30
- );
31
-
32
- $background-colors: ();
33
-
34
- @each $key, $val in $custom-background-colors {
35
- $background-colors: map-merge($background-colors, ($key: $val));
36
- }
@@ -1,90 +0,0 @@
1
- import React from 'react'
2
- import Dropdown from '../_dropdown'
3
-
4
- const DropdownCustomActiveStyleOptions = (props) => {
5
-
6
-
7
- const options = [
8
- {
9
- label: "United States",
10
- value: "unitedStates",
11
- id: "us"
12
- },
13
- {
14
- label: "Canada",
15
- value: "canada",
16
- id: "ca"
17
- },
18
- {
19
- label: "Pakistan",
20
- value: "pakistan",
21
- id: "pk"
22
- }
23
- ];
24
-
25
-
26
- return (
27
- <div>
28
- <Dropdown
29
- activeStyle={{
30
- backgroundColor: "bg_light",
31
- fontColor: "primary",
32
- }}
33
- label="Background Color: bg_light; Font Color: primary"
34
- marginBottom="sm"
35
- options={options}
36
- {...props}
37
- >
38
- <Dropdown.Trigger/>
39
- <Dropdown.Container>
40
- {options.map((option) => (
41
- <Dropdown.Option key={option.id}
42
- option={option}
43
- />
44
- ))}
45
- </Dropdown.Container>
46
- </Dropdown>
47
- <Dropdown
48
- activeStyle={{
49
- backgroundColor: "white",
50
- fontColor: "primary",
51
- }}
52
- label="Background Color: white; Font Color: primary"
53
- marginBottom="sm"
54
- options={options}
55
- {...props}
56
- />
57
- <Dropdown
58
- activeStyle={{
59
- backgroundColor: "bg_light",
60
- fontColor: "text_lt_default",
61
- }}
62
- autocomplete
63
- label="Background Color: bg_light; Font Color: text_lt_default"
64
- marginBottom="sm"
65
- options={options}
66
- {...props}
67
- />
68
- <Dropdown
69
- activeStyle={{
70
- fontColor: "text_lt_lighter",
71
- }}
72
- label="Font Color: text_lt_lighter"
73
- marginBottom="sm"
74
- options={options}
75
- {...props}
76
- >
77
- <Dropdown.Trigger/>
78
- <Dropdown.Container>
79
- {options.map((option) => (
80
- <Dropdown.Option key={option.id}
81
- option={option}
82
- />
83
- ))}
84
- </Dropdown.Container>
85
- </Dropdown>
86
- </div>
87
- )
88
- }
89
-
90
- export default DropdownCustomActiveStyleOptions
@@ -1,4 +0,0 @@
1
- The `activeStyle` prop can be used to customize the appearance of the dropdown selection indicator. It accepts an object with the following keys: `backgroundColor` sets the background color of the selected item (and its hover state); `fontColor` sets the font color of the selected item.
2
-
3
- `backgroundColor` **Type**: String | **Values**: bg_light | white | **Default**: (no selection) is primary
4
- `fontColor` **Type**: String | **Values**: primary | all [Playbook Text Colors](https://playbook.powerapp.cloud/visual_guidelines/colors) | **Default**: (no selection) is white
@@ -1,22 +0,0 @@
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
- })%>
@@ -1,43 +0,0 @@
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
@@ -1 +0,0 @@
1
- Setting `icon` prop to "none" will render the fixed confirmation toast without the left side icon.
@@ -1,75 +0,0 @@
1
- <% treeData = [{
2
- label: "Power Home Remodeling",
3
- value: "powerHomeRemodeling",
4
- id: "100",
5
- expanded: true,
6
- children: [
7
- {
8
- label: "People",
9
- value: "people",
10
- id: "101",
11
- children: [
12
- {
13
- label: "Talent Acquisition",
14
- value: "talentAcquisition",
15
- id: "102",
16
- },
17
- {
18
- label: "Business Affairs",
19
- value: "businessAffairs",
20
- id: "103",
21
- children: [
22
- {
23
- label: "Initiatives",
24
- value: "initiatives",
25
- id: "104",
26
- },
27
- {
28
- label: "Learning & Development",
29
- value: "learningAndDevelopment",
30
- id: "105",
31
- },
32
- ],
33
- },
34
- {
35
- label: "People Experience",
36
- value: "peopleExperience",
37
- id: "106",
38
- },
39
- ],
40
- },
41
- {
42
- label: "Contact Center",
43
- value: "contactCenter",
44
- id: "107",
45
- children: [
46
- {
47
- label: "Appointment Management",
48
- value: "appointmentManagement",
49
- id: "108",
50
- },
51
- {
52
- label: "Customer Service",
53
- value: "customerService",
54
- id: "109",
55
- },
56
- {
57
- label: "Energy",
58
- value: "energy",
59
- id: "110",
60
- },
61
- ],
62
- },
63
- ],
64
- }] %>
65
-
66
- <% # Pre-selected node IDs to demonstrate the functionality %>
67
- <% preSelectedIds = ["102", "104", "109"] %>
68
-
69
- <%= pb_rails("multi_level_select", props: {
70
- id: "multi-level-select-show-checked-children-rails",
71
- name: "my_array",
72
- tree_data: treeData,
73
- selected_ids: preSelectedIds,
74
- show_checked_children: false
75
- }) %>
@@ -1,94 +0,0 @@
1
- import React from "react";
2
- import MultiLevelSelect from "../_multi_level_select";
3
-
4
- const treeData = [
5
- {
6
- label: "Power Home Remodeling",
7
- value: "powerHomeRemodeling",
8
- id: "powerhome1",
9
- expanded: true,
10
- children: [
11
- {
12
- label: "People",
13
- value: "people",
14
- id: "people1",
15
- children: [
16
- {
17
- label: "Talent Acquisition",
18
- value: "talentAcquisition",
19
- id: "talent1",
20
- },
21
- {
22
- label: "Business Affairs",
23
- value: "businessAffairs",
24
- id: "business1",
25
- children: [
26
- {
27
- label: "Initiatives",
28
- value: "initiatives",
29
- id: "initiative1",
30
- },
31
- {
32
- label: "Learning & Development",
33
- value: "learningAndDevelopment",
34
- id: "development1",
35
- },
36
- ],
37
- },
38
- {
39
- label: "People Experience",
40
- value: "peopleExperience",
41
- id: "experience1",
42
- },
43
- ],
44
- },
45
- {
46
- label: "Contact Center",
47
- value: "contactCenter",
48
- id: "contact1",
49
- children: [
50
- {
51
- label: "Appointment Management",
52
- value: "appointmentManagement",
53
- id: "appointment1",
54
- },
55
- {
56
- label: "Customer Service",
57
- value: "customerService",
58
- id: "customer1",
59
- },
60
- {
61
- label: "Energy",
62
- value: "energy",
63
- id: "energy1",
64
- },
65
- ],
66
- },
67
- ],
68
- },
69
- ];
70
-
71
- // Pre-selected node IDs to demonstrate the functionality
72
- const preSelectedIds = ["talent1", "initiative1", "customer1"];
73
-
74
- const MultiLevelSelectShowCheckedChildren = (props) => {
75
- return (
76
- <div>
77
- <MultiLevelSelect
78
- id='multiselect-checked-children'
79
- onSelect={(selectedNodes) =>
80
- console.log(
81
- "Selected Items",
82
- selectedNodes
83
- )
84
- }
85
- selectedIds={preSelectedIds}
86
- showCheckedChildren={false}
87
- treeData={treeData}
88
- {...props}
89
- />
90
- </div>
91
- )
92
- };
93
-
94
- export default MultiLevelSelectShowCheckedChildren;
@@ -1,3 +0,0 @@
1
- If you wish to control the auto-expansion of nodes with selected descendants in your multi-level select, you can utilize `showCheckedChildren/show_checked_children`. This prop (set to 'true' by default) controls whether items will be expanded on first render. When set to true, a node with selected descendants will automatically render as expanded so the selected nodes are visible. If you do NOT wish for this to be the case, you can set this prop to false.
2
-
3
- The prop will still honor any `expanded` attribute set up within your tree data.
@@ -1,212 +0,0 @@
1
- import React from 'react'
2
- import { ensureAccessible, renderKit, render, fireEvent, screen } from '../utilities/test-utils'
3
- import Pagination from './_pagination'
4
-
5
- const defaultProps = {
6
- data: { testid: 'pagination-test' },
7
- total: 10,
8
- current: 1,
9
- range: 5,
10
- }
11
-
12
- describe('Pagination Component', () => {
13
- test('returns namespaced class name', () => {
14
- const kit = renderKit(Pagination, defaultProps)
15
- expect(kit).toBeInTheDocument()
16
- expect(kit).toHaveClass('pb_paginate')
17
- })
18
-
19
- it("should be accessible", async () => {
20
- ensureAccessible(Pagination, defaultProps)
21
- })
22
-
23
- test('renders with default props', () => {
24
- render(<Pagination {...defaultProps} />)
25
-
26
- const pagination = screen.getByTestId('pagination-test')
27
- expect(pagination).toBeInTheDocument()
28
- expect(pagination).toHaveClass('pb_paginate')
29
- })
30
-
31
- test('renders pagination buttons correctly', () => {
32
- render(<Pagination {...defaultProps} />)
33
-
34
- expect(screen.getByText('1')).toBeInTheDocument()
35
- expect(screen.getByText('2')).toBeInTheDocument()
36
- expect(screen.getByText('3')).toBeInTheDocument()
37
- expect(screen.getByText('4')).toBeInTheDocument()
38
- expect(screen.getByText('5')).toBeInTheDocument()
39
-
40
- // Check for navigation arrows by looking for the li elements with specific classes
41
- const leftArrow = document.querySelector('.pagination-left')
42
- const rightArrow = document.querySelector('.pagination-right')
43
- expect(leftArrow).toBeInTheDocument()
44
- expect(rightArrow).toBeInTheDocument()
45
- })
46
-
47
- test('highlights current page as active', () => {
48
- render(<Pagination {...defaultProps}
49
- current={3}
50
- />)
51
-
52
- const activePage = screen.getByText('3')
53
- expect(activePage).toHaveClass('active')
54
- })
55
-
56
- test('calls onChange when page is clicked', () => {
57
- const mockOnChange = jest.fn()
58
- render(<Pagination {...defaultProps}
59
- onChange={mockOnChange}
60
- />)
61
-
62
- const pageButton = screen.getByText('3')
63
- fireEvent.click(pageButton)
64
-
65
- expect(mockOnChange).toHaveBeenCalledWith(3)
66
- })
67
-
68
- test('disables left arrow on first page', () => {
69
- render(<Pagination {...defaultProps}
70
- current={1}
71
- />)
72
-
73
- const leftArrow = document.querySelector('.pagination-left')
74
- expect(leftArrow).toHaveClass('disabled')
75
- })
76
-
77
- test('disables right arrow on last page', () => {
78
- render(<Pagination {...defaultProps}
79
- current={10}
80
- />)
81
-
82
- const rightArrow = document.querySelector('.pagination-right')
83
- expect(rightArrow).toHaveClass('disabled')
84
- })
85
-
86
- test('does not render when total is 1 or less', () => {
87
- const { container } = render(<Pagination {...defaultProps}
88
- total={1}
89
- />)
90
-
91
- expect(container.firstChild).toBeNull()
92
- })
93
-
94
- test('renders with custom className', () => {
95
- render(<Pagination {...defaultProps}
96
- className="custom-class"
97
- />)
98
-
99
- const pagination = screen.getByTestId('pagination-test')
100
- expect(pagination).toHaveClass('custom-class')
101
- })
102
-
103
- test('renders with custom id', () => {
104
- render(<Pagination {...defaultProps}
105
- id="custom-id"
106
- />)
107
-
108
- const pagination = screen.getByTestId('pagination-test')
109
- expect(pagination).toHaveAttribute('id', 'custom-id')
110
- })
111
-
112
- test('renders with custom range', () => {
113
- render(<Pagination {...defaultProps}
114
- range={3}
115
- />)
116
-
117
- expect(screen.getByText('1')).toBeInTheDocument()
118
- expect(screen.getByText('2')).toBeInTheDocument()
119
- expect(screen.getByText('3')).toBeInTheDocument()
120
- expect(screen.getByText('9')).toBeInTheDocument()
121
- expect(screen.getByText('10')).toBeInTheDocument()
122
- })
123
-
124
- test('handles large number of pages correctly', () => {
125
- render(<Pagination {...defaultProps}
126
- current={50}
127
- range={5}
128
- total={100}
129
- />)
130
-
131
- const pagination = screen.getByTestId('pagination-test')
132
- expect(pagination).toBeInTheDocument()
133
- expect(pagination).toHaveClass('pb_paginate')
134
-
135
-
136
- expect(screen.getByText('48')).toBeInTheDocument()
137
- expect(screen.getByText('49')).toBeInTheDocument()
138
- expect(screen.getByText('50')).toBeInTheDocument()
139
- expect(screen.getByText('51')).toBeInTheDocument()
140
- expect(screen.getByText('52')).toBeInTheDocument()
141
- })
142
-
143
- test('syncs with external current prop changes', () => {
144
- const { rerender } = render(<Pagination {...defaultProps}
145
- current={1}
146
- />)
147
-
148
- expect(screen.getByText('1')).toHaveClass('active')
149
-
150
- rerender(<Pagination {...defaultProps}
151
- current={3}
152
- />)
153
-
154
- expect(screen.getByText('3')).toHaveClass('active')
155
- expect(screen.getByText('1')).not.toHaveClass('active')
156
- })
157
-
158
- test('validates current prop is within valid range', () => {
159
- const { rerender } = render(<Pagination {...defaultProps}
160
- current={1}
161
- />)
162
-
163
- rerender(<Pagination {...defaultProps}
164
- current={0}
165
- />)
166
-
167
- expect(screen.getByText('1')).toHaveClass('active')
168
-
169
- rerender(<Pagination {...defaultProps}
170
- current={15}
171
- />)
172
-
173
- expect(screen.getByText('1')).toHaveClass('active')
174
- })
175
-
176
- test('handles htmlOptions props', () => {
177
- const htmlOptions = { 'data-test': 'test-value' }
178
- render(<Pagination {...defaultProps}
179
- htmlOptions={htmlOptions}
180
- />)
181
-
182
- const pagination = screen.getByTestId('pagination-test')
183
- expect(pagination).toHaveAttribute('data-test', 'test-value')
184
- })
185
-
186
- test('renders first and last page buttons when range is small', () => {
187
- render(<Pagination {...defaultProps}
188
- current={10}
189
- range={3}
190
- total={20}
191
- />)
192
-
193
- expect(screen.getByText('1')).toBeInTheDocument()
194
- expect(screen.getByText('20')).toBeInTheDocument()
195
-
196
- expect(screen.getByText('9')).toBeInTheDocument()
197
- expect(screen.getByText('10')).toBeInTheDocument()
198
- expect(screen.getByText('11')).toBeInTheDocument()
199
- })
200
-
201
- test('renders second and second-to-last page buttons when needed', () => {
202
- render(<Pagination {...defaultProps}
203
- current={10}
204
- range={3}
205
- total={20}
206
- />)
207
-
208
- expect(screen.getByText('2')).toBeInTheDocument()
209
-
210
- expect(screen.getByText('19')).toBeInTheDocument()
211
- })
212
- })