playbook_ui 14.9.0.pre.alpha.play17004992 → 14.9.0.pre.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +17 -61
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.html.erb +1 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -3
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -2
  8. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +3 -5
  9. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -3
  10. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +0 -15
  11. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -0
  12. data/app/pb_kits/playbook/pb_background/_background.tsx +2 -8
  13. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +49 -53
  14. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.html.erb +36 -29
  15. data/app/pb_kits/playbook/pb_body/_body.scss +13 -14
  16. data/app/pb_kits/playbook/pb_body/_body_mixins.scss +16 -22
  17. data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.jsx +0 -6
  18. data/app/pb_kits/playbook/pb_button/_button.scss +0 -6
  19. data/app/pb_kits/playbook/pb_button/_button.tsx +3 -1
  20. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +0 -15
  21. data/app/pb_kits/playbook/pb_button/button.rb +1 -1
  22. data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +0 -1
  23. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +0 -8
  24. data/app/pb_kits/playbook/pb_button/docs/_button_default.md +1 -1
  25. data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +1 -2
  26. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -1
  27. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +2 -2
  28. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +4 -0
  29. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +7 -84
  30. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +4 -11
  31. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +2 -2
  32. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +2 -2
  33. data/app/pb_kits/playbook/pb_currency/_currency.tsx +3 -7
  34. data/app/pb_kits/playbook/pb_currency/currency.html.erb +2 -2
  35. data/app/pb_kits/playbook/pb_currency/currency.rb +1 -17
  36. data/app/pb_kits/playbook/pb_currency/currency.test.js +3 -40
  37. data/app/pb_kits/playbook/pb_currency/docs/example.yml +0 -2
  38. data/app/pb_kits/playbook/pb_currency/docs/index.js +0 -1
  39. data/app/pb_kits/playbook/pb_drawer/_drawer.scss +0 -1
  40. data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +45 -159
  41. data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -1
  42. data/app/pb_kits/playbook/pb_drawer/docs/index.js +0 -1
  43. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +0 -1
  44. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +1 -0
  45. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +4 -0
  46. data/app/pb_kits/playbook/pb_dropdown/utilities/subComponentHelper.tsx +2 -13
  47. data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +0 -5
  48. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +2 -7
  49. data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +2 -8
  50. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +2 -2
  51. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +1 -1
  52. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +12 -63
  53. data/app/pb_kits/playbook/pb_image/_image.tsx +1 -3
  54. data/app/pb_kits/playbook/pb_layout/_layout.tsx +3 -6
  55. data/app/pb_kits/playbook/pb_link/_link.scss +3 -3
  56. data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +1 -11
  57. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +2 -16
  58. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  59. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +1 -3
  60. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +2 -2
  61. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +3 -5
  62. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +2 -3
  63. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.rb +0 -5
  64. data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +1 -4
  65. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +1 -3
  66. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +4 -4
  67. data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_default.html.erb +1 -2
  68. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
  69. data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +36 -44
  70. data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +4 -4
  71. data/app/pb_kits/playbook/pb_table/_table.tsx +25 -109
  72. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -5
  73. data/app/pb_kits/playbook/pb_table/docs/index.js +0 -6
  74. data/app/pb_kits/playbook/pb_table/index.ts +26 -100
  75. data/app/pb_kits/playbook/pb_table/styles/_all.scss +0 -3
  76. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -106
  77. data/app/pb_kits/playbook/pb_table/table.html.erb +1 -1
  78. data/app/pb_kits/playbook/pb_table/table.rb +2 -17
  79. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +3 -35
  80. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -1
  81. data/app/pb_kits/playbook/pb_text_input/docs/index.js +0 -1
  82. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +2 -139
  83. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +0 -47
  84. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +0 -59
  85. data/app/pb_kits/playbook/pb_title/_title.scss +5 -6
  86. data/app/pb_kits/playbook/pb_title/_title_mixin.scss +0 -13
  87. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -3
  88. data/app/pb_kits/playbook/pb_typeahead/index.ts +3 -29
  89. data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
  90. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +0 -4
  91. data/app/pb_kits/playbook/tokens/_titles.scss +8 -0
  92. data/app/pb_kits/playbook/utilities/_hover.scss +2 -11
  93. data/app/pb_kits/playbook/utilities/_max_width.scss +9 -29
  94. data/app/pb_kits/playbook/utilities/_min_width.scss +2 -6
  95. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +1 -1
  96. data/app/pb_kits/playbook/utilities/globalProps.ts +4 -39
  97. data/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js +0 -15
  98. data/dist/chunks/_typeahead-D0PihN_3.js +22 -0
  99. data/dist/chunks/_weekday_stacked-uMIX8f-A.js +45 -0
  100. data/dist/chunks/{lib-CuCy3_xO.js → lib-BC6ESsxG.js} +3 -3
  101. data/dist/chunks/{pb_form_validation-D37k10a0.js → pb_form_validation-B_Z9rEbg.js} +1 -1
  102. data/dist/chunks/vendor.js +1 -1
  103. data/dist/menu.yml +1 -322
  104. data/dist/playbook-doc.js +1 -1
  105. data/dist/playbook-rails-react-bindings.js +1 -1
  106. data/dist/playbook-rails.js +1 -1
  107. data/dist/playbook.css +1 -1
  108. data/lib/playbook/classnames.rb +0 -4
  109. data/lib/playbook/forms/builder/typeahead_field.rb +0 -13
  110. data/lib/playbook/hover.rb +1 -7
  111. data/lib/playbook/kit_base.rb +1 -16
  112. data/lib/playbook/spacing.rb +0 -21
  113. data/lib/playbook/version.rb +2 -2
  114. metadata +6 -42
  115. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell_rails.html.erb +0 -53
  116. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell_rails.md +0 -5
  117. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -50
  118. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.md +0 -1
  119. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +0 -57
  120. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +0 -5
  121. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_pagination_mock_data.json +0 -5600
  122. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +0 -4
  123. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +0 -16
  124. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +0 -31
  125. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +0 -6
  126. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.html.erb +0 -95
  127. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +0 -87
  128. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +0 -2
  129. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx +0 -75
  130. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.md +0 -1
  131. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.jsx +0 -108
  132. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.md +0 -2
  133. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +0 -94
  134. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.md +0 -0
  135. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.jsx +0 -83
  136. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +0 -3
  137. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.jsx +0 -120
  138. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +0 -1
  139. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +0 -35
  140. data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +0 -4
  141. data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +0 -18
  142. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +0 -88
  143. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +0 -64
  144. data/app/pb_kits/playbook/tokens/_height.scss +0 -19
  145. data/app/pb_kits/playbook/tokens/exports/_height.module.scss +0 -37
  146. data/app/pb_kits/playbook/utilities/_height.scss +0 -33
  147. data/app/pb_kits/playbook/utilities/_width.scss +0 -45
  148. data/dist/chunks/_typeahead-l1kq1p9m.js +0 -22
  149. data/dist/chunks/_weekday_stacked-B28kYXl9.js +0 -45
  150. data/lib/playbook/height.rb +0 -29
  151. data/lib/playbook/max_height.rb +0 -29
  152. data/lib/playbook/min_height.rb +0 -29
@@ -1,106 +1,32 @@
1
1
  import PbEnhancedElement from '../pb_enhanced_element'
2
2
 
3
3
  export default class PbTable extends PbEnhancedElement {
4
- private stickyLeftColumns: string[] = [];
5
- private handleStickyColumnsRef: () => void;
6
-
7
- static get selector(): string {
8
- return '.table-responsive-collapse'
9
- }
10
-
11
- connect(): void {
12
- const tables = document.querySelectorAll('.table-responsive-collapse');
13
- // Each Table
14
- [].forEach.call(tables, (table: HTMLTableElement) => {
15
- // Header Titles
16
- const headers: string[] = [];
17
- [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
18
- const colSpan = header.colSpan
19
- for (let i = 0; i < colSpan; i++) {
20
- headers.push(header.textContent.replace(/\r?\n|\r/, ''));
21
- }
22
- });
23
- // for each row in tbody
24
- [].forEach.call(table.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => {
25
- // for each cell
26
- [].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => {
27
- // apply the attribute
28
- cell.setAttribute('data-title', headers[headerIndex])
29
- })
30
- })
31
- });
32
-
33
- // New sticky columns logic
34
- this.initStickyColumns();
35
- }
36
-
37
- private initStickyColumns(): void {
38
- // Find tables with sticky-left-column class
39
- const tables = document.querySelectorAll('.sticky-left-column');
40
-
41
- tables.forEach((table) => {
42
- // Extract sticky left column IDs by looking at the component's class
43
- const classList = Array.from(table.classList);
44
-
45
- // Look for classes in the format sticky-left-column-{ids}
46
- const stickyColumnClass = classList.find(cls => cls.startsWith('sticky-columns-'));
47
- if (stickyColumnClass) {
48
- // Extract the IDs from the class name
49
- this.stickyLeftColumns = stickyColumnClass
50
- .replace('sticky-columns-', '')
51
- .split('-');
52
-
53
- if (this.stickyLeftColumns.length > 0) {
54
- this.handleStickyColumnsRef = this.handleStickyColumns.bind(this);
55
- this.handleStickyColumns();
56
- window.addEventListener('resize', this.handleStickyColumnsRef);
57
- }
4
+ static get selector(): string {
5
+ return '.table-responsive-collapse'
6
+ }
7
+
8
+ connect(): void {
9
+ const tables = document.querySelectorAll('.table-responsive-collapse');
10
+
11
+ // Each Table
12
+ [].forEach.call(tables, (table: HTMLTableElement) => {
13
+ // Header Titles
14
+ const headers: string[] = [];
15
+ [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
16
+ const colSpan = header.colSpan
17
+ for (let i = 0; i < colSpan; i++) {
18
+ headers.push(header.textContent.replace(/\r?\n|\r/, ''));
58
19
  }
59
20
  });
60
- }
61
-
62
- private handleStickyColumns(): void {
63
- let accumulatedWidth = 0;
64
21
 
65
- this.stickyLeftColumns.forEach((colId, index) => {
66
- const isLastColumn = index === this.stickyLeftColumns.length - 1;
67
- const header = document.querySelector(`th[id="${colId}"]`);
68
- const cells = document.querySelectorAll(`td[id="${colId}"]`);
69
-
70
- if (header) {
71
- header.classList.add('sticky');
72
- (header as HTMLElement).style.left = `${accumulatedWidth}px`;
73
-
74
- if (!isLastColumn) {
75
- header.classList.add('with-border');
76
- header.classList.remove('sticky-shadow');
77
- } else {
78
- header.classList.remove('with-border');
79
- header.classList.add('sticky-shadow');
80
- }
81
-
82
- accumulatedWidth += (header as HTMLElement).offsetWidth;
83
- }
84
-
85
- cells.forEach((cell) => {
86
- cell.classList.add('sticky');
87
- (cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
88
-
89
- if (!isLastColumn) {
90
- cell.classList.add('with-border');
91
- cell.classList.remove('sticky-shadow');
92
- } else {
93
- cell.classList.remove('with-border');
94
- cell.classList.add('sticky-shadow');
95
- }
96
- });
97
- });
98
- }
99
-
100
- // Cleanup method to remove event listener
101
- disconnect(): void {
102
- if (this.handleStickyColumnsRef) {
103
- window.removeEventListener('resize', this.handleStickyColumnsRef);
104
- }
105
- }
106
- }
22
+ // for each row in tbody
23
+ [].forEach.call(table.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => {
24
+ // for each cell
25
+ [].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => {
26
+ // apply the attribute
27
+ cell.setAttribute('data-title', headers[headerIndex])
28
+ })
29
+ })
30
+ })
31
+ }
32
+ }
@@ -20,6 +20,3 @@
20
20
  @import "table_header";
21
21
  @import "striped";
22
22
  @import "outer_padding";
23
- @import "sticky_columns";
24
- @import "scroll";
25
- @import "collapsible";
@@ -7,21 +7,14 @@ import {
7
7
  buildHtmlProps,
8
8
  } from "../../utilities/props";
9
9
  import { globalProps } from "../../utilities/globalProps";
10
- import Collapsible from "../../pb_collapsible/_collapsible";
11
- import useCollapsible from "../../pb_collapsible/useCollapsible";
12
10
 
13
11
  type TableRowPropTypes = {
14
12
  aria?: { [key: string]: string };
15
13
  children: React.ReactNode[] | React.ReactNode;
16
14
  className: string;
17
- collapsible?: boolean;
18
- collapsibleContent?: React.ReactNode[] | React.ReactNode;
19
- collapsibleSideHighlight?: boolean;
20
15
  data?: { [key: string]: string };
21
- dark?: boolean;
22
16
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
23
17
  id?: string;
24
- toggleCellId?: string;
25
18
  sideHighlightColor: string;
26
19
  tag?: "table" | "div";
27
20
  };
@@ -30,15 +23,10 @@ const TableRow = (props: TableRowPropTypes): React.ReactElement => {
30
23
  const {
31
24
  aria = {},
32
25
  children,
33
- collapsible,
34
- collapsibleContent,
35
- collapsibleSideHighlight = true,
36
26
  className,
37
27
  data = {},
38
- dark = false,
39
28
  htmlOptions = {},
40
29
  id,
41
- toggleCellId,
42
30
  sideHighlightColor = "none",
43
31
  tag = "table",
44
32
  } = props;
@@ -48,110 +36,17 @@ const TableRow = (props: TableRowPropTypes): React.ReactElement => {
48
36
  const htmlProps = buildHtmlProps(htmlOptions);
49
37
  const sideHighlightClass =
50
38
  sideHighlightColor != "" ? `side_highlight_${sideHighlightColor}` : null;
51
-
52
- const [isCollapsed, setIsCollapsed] = useCollapsible(true);
53
-
54
- const collapsibleRow = collapsible && isCollapsed === true ? "collapsible_table_row" : null;
55
39
  const classes = classnames(
56
40
  buildCss("pb_table_row_kit", sideHighlightClass),
57
41
  "pb_table_tr",
58
- collapsibleRow,
59
42
  globalProps(props),
60
43
  className
61
44
  );
62
45
  const isTableTag = tag === "table";
63
46
 
64
- // const [isCollapsed, setIsCollapsed] = useCollapsible(true);
65
-
66
- const colSpan = React.Children.count(children);
67
-
68
- const handleRowClick = (event: React.MouseEvent) => {
69
- if (toggleCellId) {
70
- const target = event.target as HTMLElement;
71
- const clickedCell = target.closest(`#${toggleCellId}`);
72
- const isIconClick =
73
- target instanceof SVGElement &&
74
- (target.matches("svg.pb_custom_icon") || target.closest("svg.pb_custom_icon"));
75
-
76
- if (clickedCell || isIconClick) {
77
- setIsCollapsed(!isCollapsed);
78
- }
79
- } else {
80
- setIsCollapsed(!isCollapsed);
81
- }
82
- };
83
-
84
47
  return (
85
48
  <>
86
- {collapsible ? (
87
- isTableTag ? (
88
- <>
89
- <tr
90
- {...ariaProps}
91
- {...dataProps}
92
- {...htmlProps}
93
- className={classes}
94
- id={id}
95
- onClick={(e)=>handleRowClick(e)}
96
- style={{ cursor: toggleCellId ? "default" : "pointer" }}
97
- >
98
- {children}
99
- </tr>
100
- <tr>
101
- <Collapsible
102
- collapsed={isCollapsed}
103
- dark={dark}
104
- htmlOptions={{ colSpan: colSpan }}
105
- padding="none"
106
- tag="td"
107
- >
108
- <tr/>
109
- <Collapsible.Content
110
- className={collapsibleSideHighlight ? `table_collapsible_side_highlight` : ''}
111
- dark={dark}
112
- margin="none"
113
- padding="none"
114
- >
115
- {collapsibleContent}
116
- </Collapsible.Content>
117
- </Collapsible>
118
- </tr>
119
- </>
120
- ) : (
121
- <>
122
- <div
123
- {...ariaProps}
124
- {...dataProps}
125
- {...htmlProps}
126
- className={classes}
127
- id={id}
128
- onClick={handleRowClick}
129
- style={{ cursor: "pointer" }}
130
- >
131
- {children}
132
- </div>
133
- <tr>
134
- <Collapsible
135
- collapsed={isCollapsed}
136
- dark={dark}
137
- htmlOptions={{ colSpan: colSpan }}
138
- padding="none"
139
- tag="td"
140
- >
141
- <tr/>
142
- <Collapsible.Content
143
- className={collapsibleSideHighlight ? `table_collapsible_side_highlight` : ''}
144
- dark={dark}
145
- margin="none"
146
- padding="none"
147
- >
148
- {collapsibleContent}
149
- </Collapsible.Content>
150
- </Collapsible>
151
- </tr>
152
- </>
153
- )
154
- ) : isTableTag ? (
49
+ {isTableTag ? (
155
50
  <tr
156
51
  {...ariaProps}
157
52
  {...dataProps}
@@ -18,4 +18,4 @@
18
18
  <%= content.presence %>
19
19
  <% end %>
20
20
  <% end %>
21
- <% end %>
21
+ <% end %>
@@ -23,8 +23,6 @@ module Playbook
23
23
  prop :text
24
24
  prop :sticky, type: Playbook::Props::Boolean,
25
25
  default: false
26
- prop :sticky_left_column, type: Playbook::Props::Array,
27
- default: []
28
26
  prop :vertical_border, type: Playbook::Props::Boolean,
29
27
  default: false
30
28
  prop :striped, type: Playbook::Props::Boolean,
@@ -39,8 +37,8 @@ module Playbook
39
37
  def classname
40
38
  generate_classname(
41
39
  "pb_table", "table-#{size}", single_line_class, dark_class,
42
- disable_hover_class, container_class, data_table_class, sticky_class, sticky_left_column_class,
43
- collapse_class, vertical_border_class, striped_class, outer_padding_class,
40
+ disable_hover_class, container_class, data_table_class, sticky_class, collapse_class,
41
+ vertical_border_class, striped_class, outer_padding_class,
44
42
  "table-responsive-#{responsive}", separator: " "
45
43
  )
46
44
  end
@@ -75,19 +73,6 @@ module Playbook
75
73
  sticky ? "sticky-header" : nil
76
74
  end
77
75
 
78
- def sticky_left_column_class
79
- if sticky_left_column.empty?
80
- nil
81
- else
82
- sticky_col_classname = "sticky-left-column sticky-columns"
83
- sticky_left_column.each do |id|
84
- sticky_col_classname += "-#{id}"
85
- end
86
-
87
- sticky_col_classname
88
- end
89
- end
90
-
91
76
  def striped_class
92
77
  striped ? "striped" : nil
93
78
  end
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, ChangeEvent } from 'react'
1
+ import React, { forwardRef } from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { globalProps, GlobalProps, domSafeProps } from '../utilities/globalProps'
@@ -10,8 +10,6 @@ import Caption from '../pb_caption/_caption'
10
10
  import Body from '../pb_body/_body'
11
11
  import Icon from '../pb_icon/_icon'
12
12
 
13
- import { INPUTMASKS } from './inputMask'
14
-
15
13
  type TextInputProps = {
16
14
  aria?: { [key: string]: string },
17
15
  className?: string,
@@ -24,7 +22,6 @@ type TextInputProps = {
24
22
  inline?: boolean,
25
23
  name: string,
26
24
  label: string,
27
- mask?: 'currency' | 'zipCode' | 'postalCode' | 'ssn',
28
25
  onChange: (e: React.FormEvent<HTMLInputElement>) => void,
29
26
  placeholder: string,
30
27
  required?: boolean,
@@ -50,7 +47,6 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
50
47
  htmlOptions = {},
51
48
  id,
52
49
  inline = false,
53
- mask = null,
54
50
  name,
55
51
  label,
56
52
  onChange = () => { void 0 },
@@ -94,33 +90,6 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
94
90
  />
95
91
  )
96
92
 
97
- const isMaskedInput = mask && mask in INPUTMASKS
98
-
99
- const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
100
- if (isMaskedInput) {
101
- const inputValue = e.target.value
102
-
103
- let cursorPosition = e.target.selectionStart;
104
- const isAtEnd = cursorPosition === inputValue.length;
105
-
106
- const formattedValue = INPUTMASKS[mask].format(inputValue)
107
- e.target.value = formattedValue
108
-
109
- // Keep cursor position
110
- if (!isAtEnd) {
111
- // Account for extra characters (e.g., commas added/removed in currency)
112
- if (formattedValue.length - inputValue.length === 1) {
113
- cursorPosition = cursorPosition + 1
114
- } else if (mask === "currency" && formattedValue.length - inputValue.length === -1) {
115
- cursorPosition = cursorPosition - 1
116
- }
117
- e.target.selectionStart = e.target.selectionEnd = cursorPosition
118
- }
119
- }
120
-
121
- onChange(e)
122
- }
123
-
124
93
  const childInput = children ? children.type === "input" : undefined
125
94
 
126
95
  const textInput = (
@@ -132,9 +101,8 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
132
101
  id={id}
133
102
  key={id}
134
103
  name={name}
135
- onChange={isMaskedInput ? handleChange : onChange}
136
- pattern={isMaskedInput ? INPUTMASKS[mask]?.pattern : undefined}
137
- placeholder={placeholder || (isMaskedInput ? INPUTMASKS[mask]?.placeholder : undefined)}
104
+ onChange={onChange}
105
+ placeholder={placeholder}
138
106
  ref={ref}
139
107
  required={required}
140
108
  type={type}
@@ -16,7 +16,6 @@ examples:
16
16
  - text_input_add_on: Add On
17
17
  - text_input_inline: Inline
18
18
  - text_input_no_label: No Label
19
- - text_input_mask: Mask
20
19
 
21
20
  swift:
22
21
  - text_input_default_swift: Default
@@ -5,4 +5,3 @@ export { default as TextInputDisabled } from './_text_input_disabled.jsx'
5
5
  export { default as TextInputAddOn } from './_text_input_add_on.jsx'
6
6
  export { default as TextInputInline } from './_text_input_inline.jsx'
7
7
  export { default as TextInputNoLabel } from './_text_input_no_label.jsx'
8
- export { default as TextInputMask } from './_text_input_mask.jsx'
@@ -1,5 +1,5 @@
1
- import React, { useState } from 'react'
2
- import { render, screen, fireEvent, within } from '../utilities/test-utils'
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
3
 
4
4
  import TextInput from './_text_input'
5
5
 
@@ -89,140 +89,3 @@ test('returns additional class name', () => {
89
89
  const kit = screen.getByTestId(testId)
90
90
  expect(kit).toHaveClass(`${kitClass} mb_lg`)
91
91
  })
92
-
93
-
94
- const TextInputCurrencyMask = (props) => {
95
- const [currency, setValue] = useState('')
96
- const handleOnChange = ({ target }) => {
97
- setValue(target.value)
98
- }
99
-
100
- return (
101
- <TextInput
102
- mask="currency"
103
- onChange={handleOnChange}
104
- value={currency}
105
- {...props}
106
- />
107
- )
108
- }
109
-
110
- test('returns masked currency value', () => {
111
- render(
112
- <TextInputCurrencyMask
113
- data={{ testid: testId }}
114
- />
115
- )
116
-
117
- const kit = screen.getByTestId(testId)
118
-
119
- const input = within(kit).getByRole('textbox');
120
-
121
- fireEvent.change(input, { target: { value: '123456' } });
122
-
123
- expect(input.value).toBe('$1,234.56')
124
-
125
- fireEvent.change(input, { target: { value: '1' } });
126
-
127
- expect(input.value).toBe('$0.01')
128
-
129
- fireEvent.change(input, { target: { value: '' } });
130
-
131
- expect(input.value).toBe('')
132
- })
133
-
134
- const TextInputZipCodeMask = (props) => {
135
- const [zipCode, setValue] = useState('')
136
- const handleOnChange = ({ target }) => {
137
- setValue(target.value)
138
- }
139
-
140
- return (
141
- <TextInput
142
- mask="zipCode"
143
- onChange={handleOnChange}
144
- value={zipCode}
145
- {...props}
146
- />
147
- )
148
- }
149
-
150
- test('returns masked zip code value', () => {
151
- render(
152
- <TextInputZipCodeMask
153
- data={{ testid: testId }}
154
- />
155
- )
156
-
157
- const kit = screen.getByTestId(testId)
158
-
159
- const input = within(kit).getByRole('textbox');
160
-
161
- fireEvent.change(input, { target: { value: '123456' } });
162
-
163
- expect(input.value).toBe('12345')
164
- })
165
-
166
- const TextInputPostalCodeMask = (props) => {
167
- const [postalCode, setValue] = useState('')
168
- const handleOnChange = ({ target }) => {
169
- setValue(target.value)
170
- }
171
-
172
- return (
173
- <TextInput
174
- mask="postalCode"
175
- onChange={handleOnChange}
176
- value={postalCode}
177
- {...props}
178
- />
179
- )
180
- }
181
-
182
- test('returns masked postal code value', () => {
183
- render(
184
- <TextInputPostalCodeMask
185
- data={{ testid: testId }}
186
- />
187
- )
188
-
189
- const kit = screen.getByTestId(testId)
190
-
191
- const input = within(kit).getByRole('textbox');
192
-
193
- fireEvent.change(input, { target: { value: '123456789' } });
194
-
195
- expect(input.value).toBe('12345-6789')
196
- })
197
-
198
- const TextInputSSNMask = (props) => {
199
- const [ssn, setValue] = useState('')
200
- const handleOnChange = ({ target }) => {
201
- setValue(target.value)
202
- }
203
-
204
- return (
205
- <TextInput
206
- mask="ssn"
207
- onChange={handleOnChange}
208
- value={ssn}
209
- {...props}
210
- />
211
- )
212
- }
213
-
214
- test('returns masked ssn value', () => {
215
- render(
216
- <TextInputSSNMask
217
- data={{ testid: testId }}
218
- />
219
- )
220
-
221
- const kit = screen.getByTestId(testId)
222
-
223
- const input = within(kit).getByRole('textbox');
224
-
225
- fireEvent.change(input, { target: { value: '123456789' } });
226
-
227
- expect(input.value).toBe('123-45-6789')
228
- })
@@ -41,50 +41,3 @@
41
41
  }) %>
42
42
  <% end %>
43
43
  <% end %>
44
-
45
- <br /><br /><br />
46
-
47
- <%= pb_rails("timeline", props: {orientation: "vertical", show_date: true}) do %>
48
- <%= pb_rails("timeline/item") do |item| %>
49
-
50
- <% item.label do %>
51
- <%= pb_rails("timeline/label") do %>
52
- <%= pb_rails("title", props: { text: "Any Kit", size: 4 }) %>
53
- <% end %>
54
- <% end %>
55
-
56
- <% item.step do %>
57
- <%= pb_rails("timeline/step", props: { icon: 'user', icon_color: 'royal' }) %>
58
- <% end %>
59
-
60
- <% item.detail do %>
61
- <%= pb_rails("title_detail", props: {
62
- title: "Jackson Heights",
63
- detail: "37-27 74th Street"
64
- }) %>
65
- <% end %>
66
- <% end %>
67
-
68
- <%= pb_rails("timeline/item", props: {icon: "map-marker-alt", icon_color: "purple", date: Date.today+1, line_style: "dotted" }) do |item| %>
69
- <%= pb_rails("title_detail", props: {
70
- title: "Society Hill",
71
- detail: "72 E St Astoria"
72
- }) %>
73
- <% end %>
74
-
75
- <%= pb_rails("timeline/item") do |item| %>
76
-
77
- <% item.step do %>
78
- <%= pb_rails("timeline/step") do %>
79
- <%= pb_rails("pill", props: { text: "3" , variant: "success" }) %>
80
- <% end %>
81
- <% end %>
82
-
83
- <% item.detail do %>
84
- <%= pb_rails("title_detail", props: {
85
- title: "Greenpoint",
86
- detail: "81 Gate St Brooklyn"
87
- }) %>
88
- <% end %>
89
- <% end %>
90
- <% end %>
@@ -62,65 +62,6 @@ const TimelineWithChildren = (props) => (
62
62
  </Timeline.Detail>
63
63
  </Timeline.Item>
64
64
  </Timeline>
65
-
66
- <br />
67
- <br />
68
- <br />
69
-
70
- <Timeline orientation="vertical"
71
- showDate
72
- {...props}
73
- >
74
- <Timeline.Item lineStyle="solid"
75
- {...props}
76
- >
77
- <Timeline.Label>
78
- <Title size={4}
79
- text='Any Kit'
80
- />
81
- </Timeline.Label>
82
- <Timeline.Step icon="user"
83
- iconColor="royal"
84
- />
85
- <Timeline.Detail>
86
- <TitleDetail detail="37-27 74th Street"
87
- title="Jackson Heights"
88
- {...props}
89
- />
90
- </Timeline.Detail>
91
- </Timeline.Item>
92
-
93
- <Timeline.Item lineStyle="dotted"
94
- {...props}
95
- >
96
- <Timeline.Label date={new Date(new Date().setDate(new Date().getDate() + 1))} />
97
- <Timeline.Step icon="map-marker-alt"
98
- iconColor="purple"
99
- />
100
- <Timeline.Detail>
101
- <TitleDetail detail="72 E St Astoria"
102
- title="Society Hill"
103
- {...props}
104
- />
105
- </Timeline.Detail>
106
- </Timeline.Item>
107
-
108
- <Timeline.Item lineStyle="solid"
109
- {...props}
110
- >
111
- <Timeline.Step>
112
- <Pill text="3"
113
- variant="success"
114
- />
115
- </Timeline.Step>
116
- <Timeline.Detail>
117
- <TitleDetail detail="81 Gate St Brooklyn"
118
- title="Greenpoint"
119
- {...props}
120
- />
121
- </Timeline.Detail>
122
- </Timeline.Item>
123
- </Timeline>
124
65
  </div>
125
66
  )
126
67