playbook_ui_docs 14.11.1.pre.alpha.hfhbrakemanplaybook5370 → 14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +2 -2
  3. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +1 -1
  4. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +3 -9
  5. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +5 -0
  6. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.html.erb +38 -0
  7. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +3 -0
  8. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +1 -0
  9. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -1
  10. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.html.erb +15 -0
  11. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.jsx +24 -0
  12. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.md +1 -0
  13. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +3 -1
  14. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
  15. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +8 -3
  16. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +74 -0
  17. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +3 -0
  18. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
  19. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +74 -0
  20. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +3 -0
  21. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.html.erb +47 -0
  22. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_rails.md +2 -0
  23. data/app/pb_kits/playbook/pb_table/docs/example.yml +3 -0
  24. data/dist/playbook-doc.js +1 -1
  25. metadata +15 -3
  26. /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible.md → _table_with_collapsible_react.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cec5b327027d185abd08e5306f4d55cd69463894c965c49b410fc4f5e87c264
4
- data.tar.gz: 2aa04f18b9ed1b6befdd50d8568d574cff1c86b88e9dc84035b5043a1e1680a2
3
+ metadata.gz: a0fcf72f15fec611ffdef65c393b28b96345892a8987de757593f0664c7d38da
4
+ data.tar.gz: 0a48735df26cbec4df95d2c1086ee5a0a8daefe077dc2990a13cdf6c9d4900a1
5
5
  SHA512:
6
- metadata.gz: 7bdfd5454a5ab5591e8a656b63b40192b03d9389dd4388279b317dbedd3bd933730736996d3aef33f0c36bbff7234d23265a9e63065f841fcb8318afccb2d7fa
7
- data.tar.gz: 0e09ff8694c3c0166393a0e73893b37da44fe33ef54a8c0028e3150de55d7b107277b78d89a5d8a2b17d0f9a3e8cc7a545353533398bdf7a8d3b884279606d84
6
+ metadata.gz: b6a84dbf9b1ef53e79ee628d152cf34b42f634ae9165395cded05afbbea8be88834edb16f1b87e4a3d4c9a0e3ba545c9e5da4d4a2b97381a8ee168718de5ab60
7
+ data.tar.gz: cac4d03797b8f9df6088c01d93e7983cb75ef2010ab6a847e09c804d6384e1d0d8865d3d8298ec7ca0545fea4fca2464ec8b4a8f353b5c217baa744e273ae8a5
@@ -1,3 +1,3 @@
1
- `sortControl` is an optional prop that can be used to gain greater control over the sort state of the Advanced Table. Tanstack handles sort itself, however it does provide for a way to handle the state manually if needed. Usecases for this include needing to store the sort state so it persists on page reload, set an initial sort state, etc.
1
+ `sortControl` is an optional prop that can be used to gain greater control over the sort state of the Advanced Table. Tanstack handles sort itself, however it does provide for a way to handle the state manually if needed. Usecases for this include needing to store the sort state so it persists on page reload, set an initial sort state, etc.
2
2
 
3
- The sort state must be an object with a single key/value pair, with the key being "desc" and the value being a boolean. The default for sort directino is `desc: true`.
3
+ The sort state must be an object with a single key/value pair, with the key being "desc" and the value being a boolean. The default for sort direction is `desc: true`.
@@ -2,4 +2,4 @@ The `defaultDate`/`default_date` prop has a null or empty string value by defaul
2
2
 
3
3
  If you use a Date object without UTC time standardization the Date Picker kit may misinterpret that date as yesterdays date (consequence of timezone differentials and the Javascript Date Object constructor). See [this GitHub issue for more information](https://github.com/powerhome/playbook/issues/1167) and the anti-pattern examples below.
4
4
 
5
-
5
+ You can leverage the `defaultDate`/`default_date` prop with custom logic in your filter or controller files where the determination of the default value changes based on user interaction. The page can load with an initial default date picker value or placeholder text, then after filter submission save the submitted values as the "new default" (via state or params).
@@ -6,14 +6,8 @@
6
6
 
7
7
  ] %>
8
8
 
9
- <%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
10
- <%= pb_rails("draggable/draggable_container") do %>
11
- <%= pb_rails("list", props: {ordered: false}) do %>
12
- <% initial_items.each do |item| %>
13
- <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %>
14
- <%= pb_rails("list/item") do %><%= item[:name] %><% end %>
15
- <% end %>
16
- <% end %>
17
- <% end %>
9
+ <%= pb_rails("list", props: { enable_drag: true, items: initial_items }) do %>
10
+ <% initial_items.each do |item| %>
11
+ <%= pb_rails("list/item", props:{drag_id: item[:id]}) do %><%= item[:name] %><% end %>
18
12
  <% end %>
19
13
  <% end %>
@@ -0,0 +1,5 @@
1
+ For a simplified version of the Draggable API for the List kit, you can do the following:
2
+
3
+ The List kit is optimized to work with the draggable kit. To enable drag, use the `enable_drag` prop on List kit with an array of the included items AND `drag_id` prop on ListItems. You will also need to include the `items` prop containing your array of listed items for the Draggable API.
4
+
5
+ An additional optional boolean prop (set to true by default) of `drag_handle` is also available on ListItem kit to show the drag handle icon.
@@ -0,0 +1,38 @@
1
+ <%= pb_rails("selectable_list",
2
+ props: {
3
+ enable_drag: true,
4
+ variant: "radio",
5
+ items: [
6
+ { drag_id: "41",
7
+ text: "Task 1",
8
+ input_options: {
9
+ value: "1",
10
+ name: "radio-name",
11
+ }
12
+ },
13
+ { drag_id: "42",
14
+ text: "Task 2",
15
+ checked: true,
16
+ input_options: {
17
+ value: "2",
18
+ name: "radio-name",
19
+ }
20
+ },
21
+ { drag_id: "43",
22
+ text: "Task 3",
23
+ input_options: {
24
+ value: "3",
25
+ name: "radio-name",
26
+ }
27
+ },
28
+ { drag_id: "44",
29
+ text: "Task 4",
30
+ input_options: {
31
+ value: "4",
32
+ name: "radio-name",
33
+ }
34
+ }
35
+ ]
36
+ }
37
+ )
38
+ %>
@@ -0,0 +1,3 @@
1
+ For a simplified version of the Draggable API for the SelectableList kit, you can do the following:
2
+
3
+ The SelectableList kit is optimized to work with the draggable kit. To enable drag, use the `enable_drag` prop on SelectableList kit AND `drag_id` prop within the SelectableList kit prop. An additional optional boolean prop (set to true by default) of `drag_handle` is also available on SelectableList kit to show the drag handle icon.
@@ -11,6 +11,7 @@ examples:
11
11
  rails:
12
12
  - draggable_default_rails: Default
13
13
  - draggable_with_list_rails: Draggable with List Kit
14
+ - draggable_with_selectable_list_rails: Draggable with SelectableList Kit
14
15
  - draggable_with_cards_rails: Draggable with Cards
15
16
 
16
17
 
@@ -1 +1 @@
1
- For the `subtle` variant, it is recommended that you set the `Separators` prop to `false` to remove the separator lines between the options for a more cleaner look.
1
+ For the `subtle` variant, it is recommended that you set the `Separators` prop to `false` to remove the separator lines between the options for a cleaner look.
@@ -0,0 +1,15 @@
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 %>
@@ -0,0 +1,24 @@
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;
@@ -0,0 +1 @@
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.
@@ -8,10 +8,12 @@ examples:
8
8
  - phone_number_input_validation: Form Validation
9
9
  - phone_number_input_clear_field: Clearing the Input Field
10
10
  - phone_number_input_access_input_element: Accessing the Input Element
11
+ - phone_number_input_format: Format as You Type
11
12
 
12
13
  rails:
13
14
  - phone_number_input_default: Default
14
15
  - phone_number_input_preferred_countries: Preferred Countries
15
16
  - phone_number_input_initial_country: Initial Country
16
17
  - phone_number_input_only_countries: Limited Countries
17
- - phone_number_input_validation: Form Validation
18
+ - phone_number_input_validation: Form Validation
19
+ - phone_number_input_format: Format as You Type
@@ -5,3 +5,4 @@ export { default as PhoneNumberInputOnlyCountries } from './_phone_number_input_
5
5
  export { default as PhoneNumberInputValidation } from './_phone_number_input_validation'
6
6
  export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
7
7
  export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
8
+ export { default as PhoneNumberInputFormat } from './_phone_number_input_format'
@@ -29,6 +29,7 @@ const RadioChildren = (props) => {
29
29
  marginBottom="none"
30
30
  minWidth="xs"
31
31
  options={options}
32
+ {...props}
32
33
  />
33
34
  </Radio>
34
35
  <Radio
@@ -40,10 +41,11 @@ const RadioChildren = (props) => {
40
41
  value="Typeahead"
41
42
  {...props}
42
43
  >
43
- <Typeahead
44
+ <Typeahead
44
45
  marginBottom="none"
45
46
  minWidth="xs"
46
47
  options={options}
48
+ {...props}
47
49
  />
48
50
  </Radio>
49
51
  <Radio
@@ -54,9 +56,12 @@ const RadioChildren = (props) => {
54
56
  value="Typography"
55
57
  {...props}
56
58
  >
57
- <Title text="Custom Typography" />
59
+ <Title
60
+ text="Custom Typography"
61
+ {...props}
62
+ />
58
63
  </Radio>
59
64
  </div>
60
65
  )
61
66
  }
62
- export default RadioChildren
67
+ export default RadioChildren
@@ -0,0 +1,74 @@
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 %>
@@ -0,0 +1,3 @@
1
+ The `sticky_left_column` and `sticky_right_column` props can be used together on the same table as needed.
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 props.
@@ -1,3 +1,3 @@
1
- The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
1
+ The `sticky_left_column` prop 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
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 `stickyLeftColumn`.
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_left_column`.
@@ -0,0 +1,74 @@
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 %>
@@ -0,0 +1,3 @@
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.
@@ -0,0 +1,47 @@
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
+
@@ -0,0 +1,2 @@
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.
@@ -5,6 +5,8 @@ examples:
5
5
  - table_lg: Large
6
6
  - table_sticky: Sticky Header
7
7
  - table_sticky_left_columns: Sticky Left Column
8
+ - table_sticky_right_columns: Sticky Right Column
9
+ - table_sticky_columns: Sticky Left and Right Columns
8
10
  - table_header: Table Header
9
11
  - table_alignment_row_rails: Row Alignment
10
12
  - table_alignment_column_rails: Cell Alignment
@@ -28,6 +30,7 @@ examples:
28
30
  - table_with_subcomponents_rails: Table with Sub Components (Table Elements)
29
31
  - table_with_subcomponents_as_divs: Table with Sub Components (Divs)
30
32
  - table_outer_padding: Outer Padding
33
+ - table_with_collapsible: Table with Collapsible
31
34
 
32
35
  react:
33
36
  - table_sm: Small