playbook_ui 14.12.0.pre.alpha.testingwithfas5689 → 14.12.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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +2 -18
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +5 -27
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +2 -17
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +1 -23
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -29
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +4 -61
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +8 -13
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +3 -15
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +11 -11
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +3 -12
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +0 -9
- data/app/pb_kits/playbook/pb_button/button.html.erb +3 -2
- data/app/pb_kits/playbook/pb_button/button.rb +1 -1
- data/app/pb_kits/playbook/pb_card/card.html.erb +2 -21
- data/app/pb_kits/playbook/pb_card/card.rb +0 -7
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +1 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +1 -3
- data/app/pb_kits/playbook/pb_collapsible/collapsible.rb +0 -3
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +16 -24
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +0 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +2 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +0 -7
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +9 -3
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +183 -145
- data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +268 -158
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +45 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx +16 -9
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +19 -44
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +3 -21
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +21 -16
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx +19 -2
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_drawer/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_drawer/drawer.test.jsx +5 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +12 -7
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +14 -9
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +11 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +14 -8
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +2 -2
- data/app/pb_kits/playbook/pb_icon/icon.test.js +8 -8
- data/app/pb_kits/playbook/pb_list/item.html.erb +8 -30
- data/app/pb_kits/playbook/pb_list/item.rb +0 -7
- data/app/pb_kits/playbook/pb_list/list.html.erb +11 -31
- data/app/pb_kits/playbook/pb_list/list.rb +0 -4
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +1 -6
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +0 -4
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +0 -1
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +2 -2
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +12 -30
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +1 -20
- data/app/pb_kits/playbook/pb_radio/_radio.scss +8 -12
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +3 -8
- data/app/pb_kits/playbook/pb_select/_select.scss +5 -3
- data/app/pb_kits/playbook/pb_select/_select.tsx +1 -5
- data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
- data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +1 -9
- data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.jsx +1 -4
- data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_single_select.jsx +1 -4
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +3 -17
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.rb +0 -3
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +4 -11
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +0 -3
- data/app/pb_kits/playbook/pb_table/_table.tsx +3 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +8 -12
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_table/index.ts +88 -187
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +0 -12
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +5 -6
- data/app/pb_kits/playbook/pb_table/table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_table/table.rb +2 -17
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +1 -20
- data/app/pb_kits/playbook/pb_table/table_row.rb +0 -5
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +0 -4
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +3 -33
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +30 -30
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +2 -3
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +4 -12
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +1 -5
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +3 -8
- data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +1 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +6 -21
- data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +6 -13
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +3 -7
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -4
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +5 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
- data/dist/chunks/_typeahead-C2iCBqxQ.js +36 -0
- data/dist/chunks/_weekday_stacked-CWnbnW7m.js +45 -0
- data/dist/chunks/{lib-RmkltInK.js → lib-B7sgJtGS.js} +2 -2
- data/dist/chunks/{pb_form_validation-Bu-zi4X-.js → pb_form_validation-C5Cc0-1v.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +0 -6
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +11 -75
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx +0 -50
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.html.erb +0 -38
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.jsx +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.md +0 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +0 -78
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.jsx +0 -53
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.jsx +0 -52
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +0 -33
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_no_subrows.json +0 -42
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_with_id.json +0 -299
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames.html.erb +0 -13
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames_rails.md +0 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +0 -5
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.html.erb +0 -38
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +0 -3
- data/app/pb_kits/playbook/pb_drawer/context.ts +0 -11
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.jsx +0 -38
- data/app/pb_kits/playbook/pb_drawer/hooks/useBreakpoint.tsx +0 -60
- data/app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx +0 -21
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.scss +0 -78
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +0 -3
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +0 -16
- data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +0 -22
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.html.erb +0 -15
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.jsx +0 -24
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +0 -74
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +0 -74
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.html.erb +0 -47
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_rails.md +0 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.html.erb +0 -52
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.md +0 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.html.erb +0 -52
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.html.erb +0 -80
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +0 -1
- data/app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts +0 -22
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +0 -46
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask_rails.md +0 -3
- data/app/pb_kits/playbook/pb_text_input/index.js +0 -103
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +0 -19
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +0 -27
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.md +0 -1
- data/dist/chunks/_typeahead-BDhvNf6A.js +0 -36
- data/dist/chunks/_weekday_stacked-BhU_44Uo.js +0 -45
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_table_props_react.md → _advanced_table_table_props.md} +0 -0
- /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible_react.md → _table_with_collapsible.md} +0 -0
@@ -1,15 +0,0 @@
|
|
1
|
-
<%= pb_rails("phone_number_input", props: {
|
2
|
-
id: "phone_number_input",
|
3
|
-
format_as_you_type: true
|
4
|
-
}) %>
|
5
|
-
|
6
|
-
<%= pb_rails("button", props: {id: "clickable", text: "Save Phone Number"}) %>
|
7
|
-
|
8
|
-
<%= javascript_tag do %>
|
9
|
-
document.querySelector('#clickable').addEventListener('click', () => {
|
10
|
-
const formattedPhoneNumber = document.querySelector('#phone_number_input').value
|
11
|
-
const unformattedPhoneNumber = formattedPhoneNumber.replace(/\D/g, "")
|
12
|
-
|
13
|
-
alert(`Formatted: ${formattedPhoneNumber}. Unformatted: ${unformattedPhoneNumber}`)
|
14
|
-
})
|
15
|
-
<% end %>
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { PhoneNumberInput, Body } from "playbook-ui";
|
3
|
-
|
4
|
-
const PhoneNumberInputFormat = (props) => {
|
5
|
-
const [phoneNumber, setPhoneNumber] = useState("");
|
6
|
-
|
7
|
-
const handleOnChange = ({ number }) => {
|
8
|
-
setPhoneNumber(number);
|
9
|
-
};
|
10
|
-
|
11
|
-
return (
|
12
|
-
<>
|
13
|
-
<PhoneNumberInput
|
14
|
-
formatAsYouType
|
15
|
-
id="format"
|
16
|
-
onChange={handleOnChange}
|
17
|
-
{...props}
|
18
|
-
/>
|
19
|
-
{phoneNumber && <Body>Unformatted number: {phoneNumber}</Body>}
|
20
|
-
</>
|
21
|
-
);
|
22
|
-
};
|
23
|
-
|
24
|
-
export default PhoneNumberInputFormat;
|
@@ -1 +0,0 @@
|
|
1
|
-
NOTE: the `number` in the React `onChange` event will not include formatting (no spaces, dashes, and parentheses). For Rails, the `value` will include formatting and its value must be sanitized manually.
|
@@ -1,74 +0,0 @@
|
|
1
|
-
<%= pb_rails("table", props: { size: "md", responsive: "scroll", sticky_left_column: ["a"], sticky_right_column: ["b"] }) do %>
|
2
|
-
<thead>
|
3
|
-
<tr>
|
4
|
-
<th id="a">Column 1</th>
|
5
|
-
<th>Column 2</th>
|
6
|
-
<th>Column 3</th>
|
7
|
-
<th>Column 4</th>
|
8
|
-
<th>Column 5</th>
|
9
|
-
<th>Column 6</th>
|
10
|
-
<th>Column 7</th>
|
11
|
-
<th>Column 8</th>
|
12
|
-
<th>Column 9</th>
|
13
|
-
<th>Column 10</th>
|
14
|
-
<th>Column 11</th>
|
15
|
-
<th>Column 12</th>
|
16
|
-
<th>Column 13</th>
|
17
|
-
<th>Column 14</th>
|
18
|
-
<th id="b">Column 15</th>
|
19
|
-
</tr>
|
20
|
-
</thead>
|
21
|
-
<tbody>
|
22
|
-
<tr>
|
23
|
-
<td id="a">Value 1</td>
|
24
|
-
<td>Value 2</td>
|
25
|
-
<td>Value 3</td>
|
26
|
-
<td>Value 4</td>
|
27
|
-
<td>Value 5</td>
|
28
|
-
<td>Value 6</td>
|
29
|
-
<td>Value 7</td>
|
30
|
-
<td>Value 8</td>
|
31
|
-
<td>Value 9</td>
|
32
|
-
<td>Value 10</td>
|
33
|
-
<td>Value 11</td>
|
34
|
-
<td>Value 12</td>
|
35
|
-
<td>Value 13</td>
|
36
|
-
<td>Value 14</td>
|
37
|
-
<td id="b">Value 15</td>
|
38
|
-
</tr>
|
39
|
-
<tr>
|
40
|
-
<td id="a">Value 1</td>
|
41
|
-
<td>Value 2</td>
|
42
|
-
<td>Value 3</td>
|
43
|
-
<td>Value 4</td>
|
44
|
-
<td>Value 5</td>
|
45
|
-
<td>Value 6</td>
|
46
|
-
<td>Value 7</td>
|
47
|
-
<td>Value 8</td>
|
48
|
-
<td>Value 9</td>
|
49
|
-
<td>Value 10</td>
|
50
|
-
<td>Value 11</td>
|
51
|
-
<td>Value 12</td>
|
52
|
-
<td>Value 13</td>
|
53
|
-
<td>Value 14</td>
|
54
|
-
<td id="b">Value 15</td>
|
55
|
-
</tr>
|
56
|
-
<tr>
|
57
|
-
<td id="a">Value 1</td>
|
58
|
-
<td>Value 2</td>
|
59
|
-
<td>Value 3</td>
|
60
|
-
<td>Value 4</td>
|
61
|
-
<td>Value 5</td>
|
62
|
-
<td>Value 6</td>
|
63
|
-
<td>Value 7</td>
|
64
|
-
<td>Value 8</td>
|
65
|
-
<td>Value 9</td>
|
66
|
-
<td>Value 10</td>
|
67
|
-
<td>Value 11</td>
|
68
|
-
<td>Value 12</td>
|
69
|
-
<td>Value 13</td>
|
70
|
-
<td>Value 14</td>
|
71
|
-
<td id="b">Value 15</td>
|
72
|
-
</tr>
|
73
|
-
</tbody>
|
74
|
-
<% end %>
|
@@ -1,74 +0,0 @@
|
|
1
|
-
<%= pb_rails("table", props: { size: "md", responsive: "scroll", sticky_right_column: ["13", "14", "15"] }) do %>
|
2
|
-
<thead>
|
3
|
-
<tr>
|
4
|
-
<th>Column 1</th>
|
5
|
-
<th>Column 2</th>
|
6
|
-
<th>Column 3</th>
|
7
|
-
<th>Column 4</th>
|
8
|
-
<th>Column 5</th>
|
9
|
-
<th>Column 6</th>
|
10
|
-
<th>Column 7</th>
|
11
|
-
<th>Column 8</th>
|
12
|
-
<th>Column 9</th>
|
13
|
-
<th>Column 10</th>
|
14
|
-
<th>Column 11</th>
|
15
|
-
<th>Column 12</th>
|
16
|
-
<th id="13">Column 13</th>
|
17
|
-
<th id="14">Column 14</th>
|
18
|
-
<th id="15">Column 15</th>
|
19
|
-
</tr>
|
20
|
-
</thead>
|
21
|
-
<tbody>
|
22
|
-
<tr>
|
23
|
-
<td>Value 1</td>
|
24
|
-
<td>Value 2</td>
|
25
|
-
<td>Value 3</td>
|
26
|
-
<td>Value 4</td>
|
27
|
-
<td>Value 5</td>
|
28
|
-
<td>Value 6</td>
|
29
|
-
<td>Value 7</td>
|
30
|
-
<td>Value 8</td>
|
31
|
-
<td>Value 9</td>
|
32
|
-
<td>Value 10</td>
|
33
|
-
<td>Value 11</td>
|
34
|
-
<td>Value 12</td>
|
35
|
-
<td id="13">Value 13</td>
|
36
|
-
<td id="14">Value 14</td>
|
37
|
-
<td id="15">Value 15</td>
|
38
|
-
</tr>
|
39
|
-
<tr>
|
40
|
-
<td>Value 1</td>
|
41
|
-
<td>Value 2</td>
|
42
|
-
<td>Value 3</td>
|
43
|
-
<td>Value 4</td>
|
44
|
-
<td>Value 5</td>
|
45
|
-
<td>Value 6</td>
|
46
|
-
<td>Value 7</td>
|
47
|
-
<td>Value 8</td>
|
48
|
-
<td>Value 9</td>
|
49
|
-
<td>Value 10</td>
|
50
|
-
<td>Value 11</td>
|
51
|
-
<td>Value 12</td>
|
52
|
-
<td id="13">Value 13</td>
|
53
|
-
<td id="14">Value 14</td>
|
54
|
-
<td id="15">Value 15</td>
|
55
|
-
</tr>
|
56
|
-
<tr>
|
57
|
-
<td>Value 1</td>
|
58
|
-
<td>Value 2</td>
|
59
|
-
<td>Value 3</td>
|
60
|
-
<td>Value 4</td>
|
61
|
-
<td>Value 5</td>
|
62
|
-
<td>Value 6</td>
|
63
|
-
<td>Value 7</td>
|
64
|
-
<td>Value 8</td>
|
65
|
-
<td>Value 9</td>
|
66
|
-
<td>Value 10</td>
|
67
|
-
<td>Value 11</td>
|
68
|
-
<td>Value 12</td>
|
69
|
-
<td id="13">Value 13</td>
|
70
|
-
<td id="14">Value 14</td>
|
71
|
-
<td id="15">Value 15</td>
|
72
|
-
</tr>
|
73
|
-
</tbody>
|
74
|
-
<% end %>
|
@@ -1,3 +0,0 @@
|
|
1
|
-
The `sticky_right_column` prop works in the same way as the above `sticky_left_column` prop. It expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
|
2
|
-
|
3
|
-
Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the `sticky_right_column` prop.
|
@@ -1,47 +0,0 @@
|
|
1
|
-
<% content = capture do %>
|
2
|
-
<%= pb_rails("card", props: { border_none: true, border_radius: "none", padding: "md" }) do %>
|
3
|
-
<%= pb_rails("body", props: { text: "Nested content inside a Table Row" }) %>
|
4
|
-
<% end %>
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
<%= pb_rails("table", props: { size: "sm" }) do %>
|
8
|
-
<%= pb_rails("table/table_head") do %>
|
9
|
-
<%= pb_rails("table/table_row") do %>
|
10
|
-
<%= pb_rails("table/table_header", props: { text: "Column 1"}) %>
|
11
|
-
<%= pb_rails("table/table_header", props: { text: "Column 2"}) %>
|
12
|
-
<%= pb_rails("table/table_header", props: { text: "Column 3"}) %>
|
13
|
-
<%= pb_rails("table/table_header", props: { text: "Column 4"}) %>
|
14
|
-
<%= pb_rails("table/table_header", props: { text: "Column 5"}) %>
|
15
|
-
<%= pb_rails("table/table_header", props: { text: ""}) %>
|
16
|
-
<% end %>
|
17
|
-
<% end %>
|
18
|
-
<%= pb_rails("table/table_body") do %>
|
19
|
-
<%= pb_rails("table/table_row", props: { collapsible: true, collapsible_content: content, collapsible_side_highlight: true, id: "1" }) do %>
|
20
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
21
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
22
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
23
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
24
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
25
|
-
<%= pb_rails("table/table_cell", props: { text_align: "right"}) do %>
|
26
|
-
<%= pb_rails("icon", props: { icon: "chevron-down", fixed_width: true, color: "primary" }) %>
|
27
|
-
<% end %>
|
28
|
-
<% end %>
|
29
|
-
<%= pb_rails("table/table_row") do %>
|
30
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
31
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
32
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
33
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
34
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
35
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
36
|
-
<% end %>
|
37
|
-
<%= pb_rails("table/table_row") do %>
|
38
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
39
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
40
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
41
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
42
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
43
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
44
|
-
<% end %>
|
45
|
-
<% end %>
|
46
|
-
<% end %>
|
47
|
-
|
@@ -1,2 +0,0 @@
|
|
1
|
-
The `collapsible` prop can be used on any Table Row to add a collapsible area. Use the additional `collapsible_content` prop to add any content to the collapsible Row.
|
2
|
-
Please be aware that you will need to pass in an `id` to any table rows you want to be collapsible. Make sure every `id` is unique if you are using multipe collapsibles.
|
data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.html.erb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
<% content = capture do %>
|
2
|
-
<%= pb_rails("card", props: { border_none: true, border_radius: "none", padding: "md" }) do %>
|
3
|
-
<%= pb_rails("body", props: { text: "Expanded Custom Layout", padding_bottom: "sm" }) %>
|
4
|
-
<%= pb_rails("flex", props: { justify: "between" }) do %>
|
5
|
-
<%= pb_rails("image", props: { size: "sm", url: "https://unsplash.it/500/400/?image=634" }) %>
|
6
|
-
<%= pb_rails("image", props: { size: "sm", url: "https://unsplash.it/500/400/?image=634" }) %>
|
7
|
-
<%= pb_rails("image", props: { size: "sm", url: "https://unsplash.it/500/400/?image=634" }) %>
|
8
|
-
<%= pb_rails("image", props: { size: "sm", url: "https://unsplash.it/500/400/?image=634" }) %>
|
9
|
-
<% end %>
|
10
|
-
<% end %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<%= pb_rails("table", props: { size: "sm" }) do %>
|
14
|
-
<%= pb_rails("table/table_head") do %>
|
15
|
-
<%= pb_rails("table/table_row") do %>
|
16
|
-
<%= pb_rails("table/table_header", props: { text: "Column 1"}) %>
|
17
|
-
<%= pb_rails("table/table_header", props: { text: "Column 2"}) %>
|
18
|
-
<%= pb_rails("table/table_header", props: { text: "Column 3"}) %>
|
19
|
-
<%= pb_rails("table/table_header", props: { text: "Column 4"}) %>
|
20
|
-
<%= pb_rails("table/table_header", props: { text: "Column 5"}) %>
|
21
|
-
<%= pb_rails("table/table_header", props: { text: ""}) %>
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
24
|
-
<%= pb_rails("table/table_body") do %>
|
25
|
-
<%= pb_rails("table/table_row", props: { collapsible: true, collapsible_content: content, id: "2" }) do %>
|
26
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
27
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
28
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
29
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
30
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
31
|
-
<%= pb_rails("table/table_cell", props: { text_align: "right"}) do %>
|
32
|
-
<%= pb_rails("icon", props: { icon: "chevron-down", fixed_width: true, color: "primary" }) %>
|
33
|
-
<% end %>
|
34
|
-
<% end %>
|
35
|
-
<%= pb_rails("table/table_row") do %>
|
36
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
37
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
38
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
39
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
40
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
41
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
42
|
-
<% end %>
|
43
|
-
<%= pb_rails("table/table_row") do %>
|
44
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
45
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
46
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
47
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
48
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
49
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
50
|
-
<% end %>
|
51
|
-
<% end %>
|
52
|
-
<% end %>
|
data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.md
DELETED
File without changes
|
data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.html.erb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
<% content = capture do %>
|
2
|
-
<%= pb_rails("table", props: { container: false, border_radius: "none", size: "sm"}) do %>
|
3
|
-
<%= pb_rails("background", props: { tag: "tr" }) do %>
|
4
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
5
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
6
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
7
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
8
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
9
|
-
<% end %>
|
10
|
-
<% end %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<%= pb_rails("table", props: { size: "sm" }) do %>
|
14
|
-
<%= pb_rails("table/table_head") do %>
|
15
|
-
<%= pb_rails("table/table_row") do %>
|
16
|
-
<%= pb_rails("table/table_header", props: { text: "Column 1"}) %>
|
17
|
-
<%= pb_rails("table/table_header", props: { text: "Column 2"}) %>
|
18
|
-
<%= pb_rails("table/table_header", props: { text: "Column 3"}) %>
|
19
|
-
<%= pb_rails("table/table_header", props: { text: "Column 4"}) %>
|
20
|
-
<%= pb_rails("table/table_header", props: { text: "Column 5"}) %>
|
21
|
-
<%= pb_rails("table/table_header", props: { text: ""}) %>
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
24
|
-
<%= pb_rails("table/table_body") do %>
|
25
|
-
<%= pb_rails("table/table_row", props: { collapsible: true, collapsible_content: content, collapsible_side_highlight: false, id: "3" }) do %>
|
26
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
27
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
28
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
29
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
30
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
31
|
-
<%= pb_rails("table/table_cell", props: { text_align: "right"}) do %>
|
32
|
-
<%= pb_rails("icon", props: { icon: "chevron-down", fixed_width: true, color: "primary" }) %>
|
33
|
-
<% end %>
|
34
|
-
<% end %>
|
35
|
-
<%= pb_rails("table/table_row") do %>
|
36
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
37
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
38
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
39
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
40
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
41
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
42
|
-
<% end %>
|
43
|
-
<%= pb_rails("table/table_row") do %>
|
44
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
45
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
46
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
47
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
48
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
49
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
50
|
-
<% end %>
|
51
|
-
<% end %>
|
52
|
-
<% end %>
|
data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.html.erb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
<% content = capture do %>
|
2
|
-
<%= pb_rails("table", props: { container: false, border_radius: "none", size: "sm"}) do %>
|
3
|
-
<%= pb_rails("table/table_head") do %>
|
4
|
-
<%= pb_rails("background", props: { tag: "tr" }) do %>
|
5
|
-
<%= pb_rails("table/table_header") do %>Alt Header<% end %>
|
6
|
-
<%= pb_rails("table/table_header") do %>Alt Header<% end %>
|
7
|
-
<%= pb_rails("table/table_header") do %>Alt Header<% end %>
|
8
|
-
<%= pb_rails("table/table_header") do %>Alt Header<% end %>
|
9
|
-
<% end %>
|
10
|
-
<% end %>
|
11
|
-
<%= pb_rails("table/table_body") do %>
|
12
|
-
<%= pb_rails("table/table_row") do %>
|
13
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
14
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
15
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
16
|
-
<%= pb_rails("table/table_cell") do %>
|
17
|
-
<%= pb_rails("pill", props: { text: "Pill", variant: "primary" }) %>
|
18
|
-
<% end %>
|
19
|
-
<% end %>
|
20
|
-
<%= pb_rails("table/table_row") do %>
|
21
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
22
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
23
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
24
|
-
<%= pb_rails("table/table_cell") do %>
|
25
|
-
<%= pb_rails("pill", props: { text: "Pill", variant: "primary" }) %>
|
26
|
-
<% end %>
|
27
|
-
<% end %>
|
28
|
-
<%= pb_rails("table/table_row") do %>
|
29
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
30
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
31
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
32
|
-
<%= pb_rails("table/table_cell") do %>
|
33
|
-
<%= pb_rails("pill", props: { text: "Pill", variant: "primary" }) %>
|
34
|
-
<% end %>
|
35
|
-
<% end %>
|
36
|
-
<% end %>
|
37
|
-
<% end %>
|
38
|
-
<% end %>
|
39
|
-
|
40
|
-
|
41
|
-
<%= pb_rails("table", props: { size: "sm" }) do %>
|
42
|
-
<%= pb_rails("table/table_head") do %>
|
43
|
-
<%= pb_rails("table/table_row") do %>
|
44
|
-
<%= pb_rails("table/table_header", props: { text: "Column 1"}) %>
|
45
|
-
<%= pb_rails("table/table_header", props: { text: "Column 2"}) %>
|
46
|
-
<%= pb_rails("table/table_header", props: { text: "Column 3"}) %>
|
47
|
-
<%= pb_rails("table/table_header", props: { text: "Column 4"}) %>
|
48
|
-
<%= pb_rails("table/table_header", props: { text: "Column 5"}) %>
|
49
|
-
<%= pb_rails("table/table_header", props: { text: ""}) %>
|
50
|
-
<% end %>
|
51
|
-
<% end %>
|
52
|
-
<%= pb_rails("table/table_body") do %>
|
53
|
-
<%= pb_rails("table/table_row", props: { collapsible: true, collapsible_content: content, collapsible_side_highlight: false, id: "4" }) do %>
|
54
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
55
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
56
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
57
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
58
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
59
|
-
<%= pb_rails("table/table_cell", props: { text_align: "right"}) do %>
|
60
|
-
<%= pb_rails("icon", props: { icon: "chevron-down", fixed_width: true, color: "primary" }) %>
|
61
|
-
<% end %>
|
62
|
-
<% end %>
|
63
|
-
<%= pb_rails("table/table_row") do %>
|
64
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
65
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
66
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
67
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
68
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
69
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
70
|
-
<% end %>
|
71
|
-
<%= pb_rails("table/table_row") do %>
|
72
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
73
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
74
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
75
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
76
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
77
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
78
|
-
<% end %>
|
79
|
-
<% end %>
|
80
|
-
<% end %>
|
@@ -1 +0,0 @@
|
|
1
|
-
The `collapsible_content` can also be used to display nested Tables within each Row.
|
@@ -1,22 +0,0 @@
|
|
1
|
-
export const addDataTitle = () => {
|
2
|
-
const tables = document.querySelectorAll('.table-responsive-collapse');
|
3
|
-
// Each Table
|
4
|
-
[].forEach.call(tables, (table: HTMLTableElement) => {
|
5
|
-
// Header Titles
|
6
|
-
const headers: string[] = [];
|
7
|
-
[].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
|
8
|
-
const colSpan = header.colSpan
|
9
|
-
for (let i = 0; i < colSpan; i++) {
|
10
|
-
headers.push(header.textContent.replace(/\r?\n|\r/, ''));
|
11
|
-
}
|
12
|
-
});
|
13
|
-
// for each row in tbody
|
14
|
-
[].forEach.call(table.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => {
|
15
|
-
// for each cell
|
16
|
-
[].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => {
|
17
|
-
// apply the attribute
|
18
|
-
cell.setAttribute('data-title', headers[headerIndex])
|
19
|
-
})
|
20
|
-
})
|
21
|
-
});
|
22
|
-
}
|
@@ -1,46 +0,0 @@
|
|
1
|
-
<%= pb_rails("text_input", props: {
|
2
|
-
label: "Currency",
|
3
|
-
mask: "currency",
|
4
|
-
margin_bottom: "md",
|
5
|
-
name: "currency_name",
|
6
|
-
placeholder:"$0.00"
|
7
|
-
}) %>
|
8
|
-
|
9
|
-
<%= pb_rails("text_input", props: {
|
10
|
-
label: "ZIP Code",
|
11
|
-
mask: "zip_code",
|
12
|
-
margin_bottom: "md",
|
13
|
-
placeholder: "12345"
|
14
|
-
}) %>
|
15
|
-
|
16
|
-
<%= pb_rails("text_input", props: {
|
17
|
-
label: "Postal Code",
|
18
|
-
mask: "postal_code",
|
19
|
-
placeholder: "12345-6789",
|
20
|
-
margin_bottom: "md",
|
21
|
-
}) %>
|
22
|
-
|
23
|
-
<%= pb_rails("text_input", props: {
|
24
|
-
label: "SSN",
|
25
|
-
mask: "ssn",
|
26
|
-
margin_bottom: "md",
|
27
|
-
placeholder: "123-45-6789"
|
28
|
-
}) %>
|
29
|
-
|
30
|
-
<%= pb_rails("title" , props: {
|
31
|
-
text: "Hidden Input Under The Hood",
|
32
|
-
padding_bottom: "sm"
|
33
|
-
})%>
|
34
|
-
|
35
|
-
<%= pb_rails("text_input", props: {
|
36
|
-
label: "Currency",
|
37
|
-
mask: "currency",
|
38
|
-
margin_bottom: "md",
|
39
|
-
name: "currency_name",
|
40
|
-
id: "example-currency",
|
41
|
-
placeholder: "$0.00",
|
42
|
-
}) %>
|
43
|
-
|
44
|
-
<style>
|
45
|
-
#example-currency-sanitized {display: flex !important;}
|
46
|
-
</style>
|
@@ -1,103 +0,0 @@
|
|
1
|
-
export default class PbTextInput {
|
2
|
-
static start() {
|
3
|
-
const inputElements = document.querySelectorAll('[data-pb-input-mask="true"]');
|
4
|
-
|
5
|
-
inputElements.forEach((inputElement) => {
|
6
|
-
inputElement.addEventListener("input", (event) => {
|
7
|
-
const maskType = inputElement.getAttribute("mask");
|
8
|
-
const cursorPosition = inputElement.selectionStart;
|
9
|
-
|
10
|
-
let rawValue = event.target.value;
|
11
|
-
let formattedValue = rawValue;
|
12
|
-
|
13
|
-
// Apply formatting based on the mask type
|
14
|
-
switch (maskType) {
|
15
|
-
case "currency":
|
16
|
-
formattedValue = formatCurrency(rawValue);
|
17
|
-
break;
|
18
|
-
case "ssn":
|
19
|
-
formattedValue = formatSSN(rawValue);
|
20
|
-
break;
|
21
|
-
case "postal_code":
|
22
|
-
formattedValue = formatPostalCode(rawValue);
|
23
|
-
break;
|
24
|
-
case "zip_code":
|
25
|
-
formattedValue = formatZipCode(rawValue);
|
26
|
-
break;
|
27
|
-
}
|
28
|
-
|
29
|
-
// Update the sanitized input field in the same wrapper
|
30
|
-
const sanitizedInput = inputElement
|
31
|
-
.closest(".text_input_wrapper")
|
32
|
-
?.querySelector('[data="sanitized-pb-input"]');
|
33
|
-
|
34
|
-
if (sanitizedInput) {
|
35
|
-
switch (maskType) {
|
36
|
-
case "ssn":
|
37
|
-
sanitizedInput.value = sanitizeSSN(formattedValue);
|
38
|
-
break;
|
39
|
-
case "currency":
|
40
|
-
sanitizedInput.value = sanitizeCurrency(formattedValue);
|
41
|
-
break;
|
42
|
-
default:
|
43
|
-
sanitizedInput.value = formattedValue;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
inputElement.value = formattedValue;
|
48
|
-
setCursorPosition(inputElement, cursorPosition, rawValue, formattedValue);
|
49
|
-
});
|
50
|
-
});
|
51
|
-
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
function formatCurrency(value) {
|
56
|
-
const numericValue = value.replace(/[^0-9]/g, "").slice(0, 15);
|
57
|
-
|
58
|
-
if (!numericValue) return "";
|
59
|
-
|
60
|
-
const dollars = parseFloat((parseInt(numericValue) / 100).toFixed(2));
|
61
|
-
if (dollars === 0) return "";
|
62
|
-
|
63
|
-
return new Intl.NumberFormat("en-US", {
|
64
|
-
style: "currency",
|
65
|
-
currency: "USD",
|
66
|
-
maximumFractionDigits: 2,
|
67
|
-
}).format(dollars);
|
68
|
-
}
|
69
|
-
|
70
|
-
function formatSSN(value) {
|
71
|
-
const cleaned = value.replace(/\D/g, "").slice(0, 9);
|
72
|
-
return cleaned
|
73
|
-
.replace(/(\d{5})(?=\d)/, "$1-")
|
74
|
-
.replace(/(\d{3})(?=\d)/, "$1-");
|
75
|
-
}
|
76
|
-
|
77
|
-
function formatZipCode(value) {
|
78
|
-
return value.replace(/\D/g, "").slice(0, 5);
|
79
|
-
}
|
80
|
-
|
81
|
-
function formatPostalCode(value) {
|
82
|
-
const cleaned = value.replace(/\D/g, "").slice(0, 9);
|
83
|
-
return cleaned.replace(/(\d{5})(?=\d)/, "$1-");
|
84
|
-
}
|
85
|
-
|
86
|
-
function sanitizeSSN(input) {
|
87
|
-
return input.replace(/\D/g, "");
|
88
|
-
}
|
89
|
-
|
90
|
-
function sanitizeCurrency(input) {
|
91
|
-
return input.replace(/[$,]/g, "");
|
92
|
-
}
|
93
|
-
|
94
|
-
// function to set cursor position
|
95
|
-
function setCursorPosition(inputElement, cursorPosition, rawValue, formattedValue) {
|
96
|
-
const difference = formattedValue.length - rawValue.length;
|
97
|
-
|
98
|
-
const newPosition = Math.max(0, cursorPosition + difference);
|
99
|
-
|
100
|
-
requestAnimationFrame(() => {
|
101
|
-
inputElement.setSelectionRange(newPosition, newPosition);
|
102
|
-
});
|
103
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
names = [
|
3
|
-
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
4
|
-
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
5
|
-
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
6
|
-
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
7
|
-
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
8
|
-
]
|
9
|
-
%>
|
10
|
-
|
11
|
-
<%= pb_rails("typeahead", props: {
|
12
|
-
html_options: { style: { maxWidth: "240px" }},
|
13
|
-
id: "typeahead-form-pill",
|
14
|
-
is_multi: true,
|
15
|
-
options: names,
|
16
|
-
label: "Truncation Within Typeahead",
|
17
|
-
pills: true,
|
18
|
-
truncate: 1,
|
19
|
-
}) %>
|