playbook_ui 14.13.0 → 14.14.0.pre.alpha.play1868dependencyremovallodash6286

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 (138) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +3 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +6 -5
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +8 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_custom_cell.jsx +75 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +3 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +33 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +3 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
  14. data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +58 -0
  15. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +64 -0
  16. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +1 -0
  17. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -0
  18. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
  19. data/app/pb_kits/playbook/pb_card/_card.tsx +2 -1
  20. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +17 -8
  21. data/app/pb_kits/playbook/pb_checkbox/checkbox.test.js +16 -0
  22. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_react_hook.jsx +69 -0
  23. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_react_hook.md +1 -0
  24. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -1
  25. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
  26. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +3 -1
  27. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb +2 -2
  28. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +4 -1
  29. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.jsx +90 -0
  30. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +5 -0
  31. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -0
  32. data/app/pb_kits/playbook/pb_draggable/docs/index.js +2 -1
  33. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +7 -4
  34. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +6 -3
  35. data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +4 -4
  36. data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -2
  37. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
  38. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
  39. data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +71 -0
  40. data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +1 -2
  41. data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.jsx +17 -0
  42. data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.html.erb +27 -0
  43. data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.jsx +61 -0
  44. data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +5 -3
  45. data/app/pb_kits/playbook/pb_icon_button/docs/index.js +2 -0
  46. data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -1
  47. data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +3 -0
  48. data/app/pb_kits/playbook/pb_icon_button/icon_button.test.jsx +39 -0
  49. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +1 -6
  50. data/app/pb_kits/playbook/pb_nav/item.html.erb +7 -19
  51. data/app/pb_kits/playbook/pb_nav/nav.html.erb +3 -8
  52. data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +1 -6
  53. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +4 -0
  54. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.jsx +37 -0
  55. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional_react.md +1 -0
  56. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +1 -0
  57. data/app/pb_kits/playbook/pb_overlay/docs/index.js +1 -0
  58. data/app/pb_kits/playbook/pb_overlay/subcomponents/_overlay_token.tsx +48 -10
  59. data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -6
  60. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.scss +6 -1
  61. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +7 -5
  62. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.html.erb +1 -0
  63. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.jsx +7 -0
  64. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.md +1 -0
  65. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width.html.erb +1 -0
  66. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width.jsx +18 -0
  67. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width_rails.md +1 -0
  68. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width_react.md +1 -0
  69. data/app/pb_kits/playbook/pb_progress_pills/docs/example.yml +2 -0
  70. data/app/pb_kits/playbook/pb_progress_pills/docs/index.js +1 -0
  71. data/app/pb_kits/playbook/pb_progress_pills/progress_pills.html.erb +2 -7
  72. data/app/pb_kits/playbook/pb_progress_pills/progress_pills.rb +6 -0
  73. data/app/pb_kits/playbook/pb_progress_pills/progress_pills.test.js +26 -1
  74. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +1 -5
  75. data/app/pb_kits/playbook/pb_progress_step/progress_step.html.erb +1 -5
  76. data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +3 -7
  77. data/app/pb_kits/playbook/pb_radio/radio.html.erb +6 -11
  78. data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.html.erb +47 -0
  79. data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.jsx +88 -0
  80. data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.md +1 -0
  81. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx +1 -1
  82. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.html.erb +51 -0
  83. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click_rails.md +2 -0
  84. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +96 -0
  85. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.jsx +101 -0
  86. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.md +1 -0
  87. data/app/pb_kits/playbook/pb_table/docs/example.yml +5 -0
  88. data/app/pb_kits/playbook/pb_table/docs/index.js +3 -1
  89. data/app/pb_kits/playbook/pb_table/index.ts +41 -9
  90. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +4 -0
  91. data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +29 -2
  92. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +31 -3
  93. data/app/pb_kits/playbook/pb_table/table_body.html.erb +13 -7
  94. data/app/pb_kits/playbook/pb_table/table_body.rb +2 -0
  95. data/app/pb_kits/playbook/pb_table/table_row.html.erb +14 -7
  96. data/app/pb_kits/playbook/pb_table/table_row.rb +14 -1
  97. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +14 -0
  98. data/app/pb_kits/playbook/pb_text_input/index.js +9 -0
  99. data/app/pb_kits/playbook/pb_text_input/text_input.rb +5 -2
  100. data/app/pb_kits/playbook/pb_tooltip/index.js +1 -1
  101. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +5 -4
  102. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +2 -1
  103. data/app/pb_kits/playbook/utilities/object.ts +82 -1
  104. data/dist/chunks/_typeahead-CHxdYnAw.js +36 -0
  105. data/dist/chunks/_weekday_stacked-D2tZHCNS.js +45 -0
  106. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  107. data/dist/chunks/{lib-DjpLC8uO.js → lib-CrrD678a.js} +3 -3
  108. data/dist/chunks/{pb_form_validation-S56UaHZl.js → pb_form_validation-BbWhQeoO.js} +1 -1
  109. data/dist/chunks/vendor.js +1 -1
  110. data/dist/menu.yml +1 -8
  111. data/dist/playbook-doc.js +1 -1
  112. data/dist/playbook-rails-react-bindings.js +1 -1
  113. data/dist/playbook-rails.js +1 -1
  114. data/dist/playbook.css +1 -1
  115. data/lib/playbook/forms/builder/time_zone_select_field.rb +19 -0
  116. data/lib/playbook/forms/builder.rb +1 -0
  117. data/lib/playbook/version.rb +2 -2
  118. metadata +40 -24
  119. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +0 -66
  120. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +0 -98
  121. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +0 -28
  122. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.rb +0 -42
  123. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.html.erb +0 -19
  124. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.jsx +0 -26
  125. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.html.erb +0 -10
  126. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.jsx +0 -17
  127. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_on_click.jsx +0 -19
  128. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_onclick.html.erb +0 -16
  129. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb +0 -35
  130. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.jsx +0 -42
  131. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb +0 -13
  132. data/app/pb_kits/playbook/pb_avatar_action_button/docs/example.yml +0 -15
  133. data/app/pb_kits/playbook/pb_avatar_action_button/docs/index.js +0 -4
  134. data/app/pb_kits/playbook/pb_avatar_action_button/pb_avatar_action_button.test.js +0 -31
  135. data/dist/chunks/_typeahead-btjo1UN5.js +0 -36
  136. data/dist/chunks/_weekday_stacked-DeYS_l8v.js +0 -45
  137. data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
  138. /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible_with_custom_click.md → _table_with_collapsible_with_custom_click_react.md} +0 -0
@@ -0,0 +1,90 @@
1
+ import React, { useState } from "react";
2
+ import { Flex, Table, Body, Avatar, DraggableProvider } from "playbook-ui";
3
+
4
+ // Initial items to be dragged
5
+ const data = [
6
+ {
7
+ id: "1",
8
+ task: "Task 1",
9
+ assignee_name: "Terry Miles",
10
+ assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
11
+ },
12
+ {
13
+ id: "2",
14
+ task: "Task 2",
15
+ assignee_name: "Sophia Miles",
16
+ assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
17
+ },
18
+ {
19
+ id: "3",
20
+ task: "Task 3",
21
+ assignee_name: "Alice Jones",
22
+ assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
23
+ },
24
+ {
25
+ id: "4",
26
+ task: "Task 4",
27
+ assignee_name: "Mike James",
28
+ assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
29
+ },
30
+ {
31
+ id: "5",
32
+ task: "Task 5",
33
+ assignee_name: "James Guy",
34
+ assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
35
+ }
36
+ ];
37
+
38
+ const DraggableWithTableReact = (props) => {
39
+ const [initialState, setInitialState] = useState(data);
40
+
41
+ return (
42
+ <>
43
+ <DraggableProvider initialItems={data}
44
+ onReorder={(items) => setInitialState(items)}
45
+ >
46
+ <Table
47
+ responsive="none"
48
+ size="sm"
49
+ {...props}
50
+ >
51
+ <Table.Head>
52
+ <Table.Row>
53
+ <Table.Header>{"id"}</Table.Header>
54
+ <Table.Header>{"name"}</Table.Header>
55
+ <Table.Header>{"task number"}</Table.Header>
56
+ </Table.Row>
57
+ </Table.Head>
58
+ <Table.Body draggableContainer>
59
+ {initialState.map(({ id, task, assignee_name, assignee_img }) => (
60
+ <Table.Row
61
+ dragId={id}
62
+ draggableItem
63
+ key={id}
64
+ >
65
+ <Table.Cell>{id}</Table.Cell>
66
+ <Table.Cell>
67
+ <Flex align="center">
68
+ <Avatar
69
+ imageUrl={assignee_img}
70
+ size="xs"
71
+ />
72
+ <Body
73
+ paddingLeft="xxs"
74
+ text={assignee_name}
75
+ {...props}
76
+ />
77
+ </Flex>
78
+ </Table.Cell>
79
+ <Table.Cell>{task}</Table.Cell>
80
+ </Table.Row>
81
+ ))}
82
+ </Table.Body>
83
+ </Table>
84
+ </DraggableProvider>
85
+ </>
86
+
87
+ );
88
+ };
89
+
90
+ export default DraggableWithTableReact;
@@ -0,0 +1,5 @@
1
+ The draggable kit can also be used in conjunction with the table kit to create draggable table rows. To do this:
2
+
3
+ - Wrap the Table with the `DraggableProvider` and manage state as shown.
4
+ - use the `draggableContainer` prop on the Table.Body to designate it as the Draggable Container
5
+ - use the `draggableItem` prop on the Table.Row to designate it as the Draggable Item. Make sure to also pass id to the `dragId` prop here.
@@ -4,7 +4,9 @@ examples:
4
4
  - draggable_with_list: Draggable with List Kit
5
5
  - draggable_with_selectable_list: Draggable with SelectableList Kit
6
6
  - draggable_with_cards: Draggable with Cards
7
+ - draggable_with_table_react: Draggable with Table
7
8
  - draggable_multiple_containers: Dragging Across Multiple Containers
9
+
8
10
  rails:
9
11
  - draggable_default_rails: Default
10
12
  - draggable_with_list_rails: Draggable with List Kit
@@ -2,4 +2,5 @@ export { default as DraggableDefault } from './_draggable_default.jsx'
2
2
  export { default as DraggableWithCards } from './_draggable_with_cards.jsx'
3
3
  export { default as DraggableWithList } from './_draggable_with_list.jsx'
4
4
  export { default as DraggableWithSelectableList } from './_draggable_with_selectable_list.jsx'
5
- export { default as DraggableMultipleContainers } from './_draggable_multiple_containers.jsx'
5
+ export { default as DraggableMultipleContainers } from './_draggable_multiple_containers.jsx'
6
+ export { default as DraggableWithTableReact } from './_draggable_with_table_react.jsx'
@@ -17,10 +17,11 @@ type DraggableContainerProps = {
17
17
  data?: { [key: string]: string };
18
18
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
19
19
  id?: string;
20
+ tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div' | 'tr' | 'th' | 'td' | 'thead' | 'col' | 'tbody',
20
21
  };
21
22
 
22
23
  const DraggableContainer = (props: DraggableContainerProps) => {
23
- const { aria = {}, children, className, container, data = {}, htmlOptions = {}, id } = props;
24
+ const { aria = {}, children, className, container, data = {}, htmlOptions = {}, id, tag="div" } = props;
24
25
 
25
26
  const { handleDragOver, handleDrop, activeContainer } = DraggableContext();
26
27
 
@@ -28,6 +29,8 @@ const DraggableContainer = (props: DraggableContainerProps) => {
28
29
  const dataProps = buildDataProps(data);
29
30
  const htmlProps = buildHtmlProps(htmlOptions);
30
31
 
32
+ const Tag: React.ReactElement | any = `${tag}`;
33
+
31
34
  const classes = classnames(
32
35
  buildCss("pb_draggable_container"),
33
36
  `${activeContainer === container ? "active" : ""}`,
@@ -36,18 +39,18 @@ const DraggableContainer = (props: DraggableContainerProps) => {
36
39
  );
37
40
 
38
41
  return (
39
- <div
42
+ <Tag
40
43
  {...ariaProps}
41
44
  {...dataProps}
42
45
  {...htmlProps}
43
46
  className={classes}
44
47
  id={id}
45
48
  key={container}
46
- onDragOver={(e) => handleDragOver(e, container)}
49
+ onDragOver={(e: Event) => handleDragOver(e, container)}
47
50
  onDrop={() => handleDrop(container)}
48
51
  >
49
52
  {children}
50
- </div>
53
+ </Tag>
51
54
  );
52
55
  };
53
56
 
@@ -18,10 +18,11 @@ type DraggableItemProps = {
18
18
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
19
19
  id?: string;
20
20
  dragId?: string;
21
+ tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div' | 'tr' | 'th' | 'td' | 'thead' | 'col' | 'tbody',
21
22
  };
22
23
 
23
24
  const DraggableItem = (props: DraggableItemProps) => {
24
- const { aria = {}, children, className, container, data = {}, htmlOptions = {}, id, dragId } = props;
25
+ const { aria = {}, children, className, container, data = {}, htmlOptions = {}, id, dragId, tag="div" } = props;
25
26
 
26
27
  const { isDragging, handleDragStart, handleDragEnter, handleDragEnd } =
27
28
  DraggableContext();
@@ -30,6 +31,8 @@ const DraggableItem = (props: DraggableItemProps) => {
30
31
  const dataProps = buildDataProps(data);
31
32
  const htmlProps = buildHtmlProps(htmlOptions);
32
33
 
34
+ const Tag: React.ReactElement | any = `${tag}`;
35
+
33
36
  const classes = classnames(
34
37
  buildCss("pb_draggable_item"),
35
38
  `${isDragging === dragId ? "is_dragging" : ""}`,
@@ -38,7 +41,7 @@ const DraggableItem = (props: DraggableItemProps) => {
38
41
  );
39
42
 
40
43
  return (
41
- <div
44
+ <Tag
42
45
  {...ariaProps}
43
46
  {...dataProps}
44
47
  {...htmlProps}
@@ -51,7 +54,7 @@ const DraggableItem = (props: DraggableItemProps) => {
51
54
  onDragStart={() => handleDragStart(dragId, container)}
52
55
  >
53
56
  {children}
54
- </div>
57
+ </Tag>
55
58
  );
56
59
  };
57
60
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { isEmpty, map, omitBy } from 'lodash'
2
+ import { isEmpty, map, omitBy } from '../../utilities/object'
3
3
 
4
4
  import Body from '../../pb_body/_body'
5
5
  import Caption from '../../pb_caption/_caption'
@@ -40,13 +40,13 @@ const CurrentFilters = ({ dark, filters }: CurrentFiltersProps): React.ReactElem
40
40
  className="filter"
41
41
  key={`filter-${name}`}
42
42
  >
43
- { value === true ?
43
+ { value === true ?
44
44
  <Title
45
45
  dark={dark}
46
46
  size={4}
47
47
  tag="h4"
48
48
  text={name}
49
- /> :
49
+ /> :
50
50
  <div>
51
51
  <Caption
52
52
  dark={dark}
@@ -58,7 +58,7 @@ const CurrentFilters = ({ dark, filters }: CurrentFiltersProps): React.ReactElem
58
58
  tag="h4"
59
59
  text={value}
60
60
  />
61
- </div>
61
+ </div>
62
62
  }
63
63
  </div>
64
64
  ))}
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { isEmpty } from 'lodash'
2
+ import { isEmpty } from '../../utilities/object'
3
3
 
4
4
  import Flex from '../../pb_flex/_flex'
5
5
 
@@ -46,7 +46,7 @@ const FilterSingle = ({
46
46
  paddingRight="lg"
47
47
  vertical="center"
48
48
  >
49
- { children &&
49
+ { children &&
50
50
  <>
51
51
  <FiltersPopover
52
52
  dark={dark}
@@ -46,6 +46,7 @@
46
46
  %>
47
47
  <%= form.date_picker :example_date_picker_1, props: { label: true } %>
48
48
  <%= form.star_rating_field :example_star_rating, props: { variant: "interactive", label: true } %>
49
+ <%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true } %>
49
50
 
50
51
  <%= form.actions do |action| %>
51
52
  <%= action.submit %>
@@ -37,6 +37,7 @@
37
37
  <%= form.check_box :example_checkbox, props: { text: "Example Checkbox", label: true, required: true } %>
38
38
  <%= form.date_picker :example_date_picker_2, props: { label: true, required: true } %>
39
39
  <%= form.star_rating_field :example_star_rating_validation, props: { variant: "interactive", label: true, required: true } %>
40
+ <%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true, blank_selection: "Select a Time Zone...", required: true } %>
40
41
 
41
42
  <%= form.actions do |action| %>
42
43
  <%= action.submit %>
@@ -0,0 +1,71 @@
1
+
2
+ import React from 'react'
3
+ import classnames from 'classnames'
4
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
+ import { globalProps } from '../utilities/globalProps'
6
+
7
+ import Button from '../pb_button/_button'
8
+ import Icon from '../pb_icon/_icon'
9
+ import { IconSizes } from "../pb_icon/_icon"
10
+
11
+ type IconButtonProps = {
12
+ aria?: { [key: string]: string },
13
+ className?: string,
14
+ data?: { [key: string]: string },
15
+ htmlType?: 'submit' | 'reset' | 'button' | undefined,
16
+ icon?: string,
17
+ id?: string,
18
+ link?: string,
19
+ newWindow?: boolean,
20
+ size?: IconSizes,
21
+ target?: string,
22
+ variant?: 'default' | 'link',
23
+ }
24
+
25
+ const IconButton = (props: IconButtonProps) => {
26
+ const {
27
+ aria = {},
28
+ className,
29
+ data = {},
30
+ htmlType = 'button',
31
+ icon = 'bars',
32
+ id,
33
+ link,
34
+ newWindow = false,
35
+ size = "2x",
36
+ target,
37
+ variant = "default",
38
+ } = props
39
+
40
+ const ariaProps = buildAriaProps(aria)
41
+ const dataProps = buildDataProps(data)
42
+ const classes = classnames(buildCss('pb_icon_button_kit', variant), globalProps(props), className)
43
+
44
+ return (
45
+ <div
46
+ {...ariaProps}
47
+ {...dataProps}
48
+ className={classes}
49
+ id={id}
50
+ >
51
+ <Button
52
+ borderRadius="lg"
53
+ htmlType={htmlType}
54
+ link={link}
55
+ newWindow={newWindow}
56
+ target={target}
57
+ >
58
+ <Icon
59
+ className="icon_button_icon"
60
+ fixedWidth
61
+ icon={icon}
62
+ paddingX="xxs"
63
+ paddingY="xs"
64
+ size={size}
65
+ />
66
+ </Button>
67
+ </div>
68
+ )
69
+ }
70
+
71
+ export default IconButton
@@ -1,3 +1,2 @@
1
1
  <%= pb_rails("icon_button") %>
2
- </br>
3
- <%= pb_rails("icon_button", props: {variant: "link"}) %>
2
+ <%= pb_rails("icon_button", props: {variant: "link", margin_top: "md" }) %>
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import { IconButton } from 'playbook-ui'
3
+
4
+ const IconButtonDefault = (props) => (
5
+ <div>
6
+ <IconButton
7
+ {...props}
8
+ />
9
+ <IconButton
10
+ {...props}
11
+ marginTop="md"
12
+ variant="link"
13
+ />
14
+ </div>
15
+ )
16
+
17
+ export default IconButtonDefault
@@ -0,0 +1,27 @@
1
+ <%= pb_rails("flex", props: { align: "center"}) do %>
2
+ <%= pb_rails("icon_button", props: {size: "lg"}) %> <span>Large</span>
3
+ <% end %>
4
+
5
+ <%= pb_rails("flex", props: { align: "center" }) do %>
6
+ <%= pb_rails("icon_button", props: {size: "sm"}) %> <span>Small</span>
7
+ <% end %>
8
+
9
+ <%= pb_rails("flex", props: { align: "center" }) do %>
10
+ <%= pb_rails("icon_button", props: {size: "xs"}) %> <span>XSmall</span>
11
+ <% end %>
12
+
13
+ <%= pb_rails("flex", props: { align: "center", margin_top: "md" }) do %>
14
+ <%= pb_rails("icon_button", props: {size: "1x"}) %> <span>1x</span>
15
+ <% end %>
16
+
17
+ <%= pb_rails("flex", props: { align: "center" }) do %>
18
+ <%= pb_rails("icon_button", props: {size: "2x"}) %> <span>2x</span>
19
+ <% end %>
20
+
21
+ <%= pb_rails("flex", props: { align: "center" }) do %>
22
+ <%= pb_rails("icon_button", props: {size: "3x"}) %> <span>3x</span>
23
+ <% end %>
24
+
25
+ <%= pb_rails("flex", props: { align: "center" }) do %>
26
+ <%= pb_rails("icon_button", props: {size: "4x"}) %> <span>4x</span>
27
+ <% end %>
@@ -0,0 +1,61 @@
1
+ import React from 'react'
2
+ import { IconButton, Flex } from 'playbook-ui'
3
+
4
+ const IconButtonSizes = (props) => (
5
+ <div>
6
+ <Flex align="center">
7
+ <IconButton
8
+ {...props}
9
+ size="lg"
10
+ />
11
+ <span>Large</span>
12
+ </Flex>
13
+ <Flex align="center">
14
+ <IconButton
15
+ {...props}
16
+ size="sm"
17
+ />
18
+ <span>Small</span>
19
+ </Flex>
20
+ <Flex align="center">
21
+ <IconButton
22
+ {...props}
23
+ size="xs"
24
+ />
25
+ <span>XSmall</span>
26
+ </Flex>
27
+ <Flex
28
+ align="center"
29
+ marginTop="md"
30
+ >
31
+ <IconButton
32
+ {...props}
33
+ size="1x"
34
+ />
35
+ <span>1x</span>
36
+ </Flex>
37
+ <Flex align="center">
38
+ <IconButton
39
+ {...props}
40
+ size="2x"
41
+ />
42
+ <span>2x</span>
43
+ </Flex>
44
+ <Flex align="center">
45
+ <IconButton
46
+ {...props}
47
+ size="3x"
48
+ />
49
+ <span>3x</span>
50
+ </Flex>
51
+ <Flex align="center">
52
+ <IconButton
53
+ {...props}
54
+ size="4x"
55
+ />
56
+ <span>4x</span>
57
+ </Flex>
58
+ </div>
59
+ )
60
+
61
+ export default IconButtonSizes
@@ -2,6 +2,8 @@ examples:
2
2
 
3
3
  rails:
4
4
  - icon_button_default: Default
5
-
6
-
7
-
5
+ - icon_button_sizes: Sizes
6
+
7
+ react:
8
+ - icon_button_default: Default
9
+ - icon_button_sizes: Sizes
@@ -0,0 +1,2 @@
1
+ export { default as IconButtonDefault } from './_icon_button_default.jsx'
2
+ export { default as IconButtonSizes } from './_icon_button_sizes.jsx'
@@ -8,7 +8,7 @@
8
8
  <%= pb_rails("icon", props: { icon: object.icon,
9
9
  fixed_width: true,
10
10
  dark: object.dark,
11
- size: "2x",
11
+ size: object.size,
12
12
  color: "text_lt_default",
13
13
  classname: "icon_button_icon",
14
14
  padding_x: "xxs", padding_y: "xs" }) %>
@@ -14,6 +14,9 @@ module Playbook
14
14
  prop :variant, type: Playbook::Props::Enum,
15
15
  values: %w[default link],
16
16
  default: "default"
17
+ prop :size, type: Playbook::Props::Enum,
18
+ values: %w[1x 2x 3x 4x 5x 6x 7x 8x 9x 10x xs sm lg],
19
+ default: "2x"
17
20
  def classname
18
21
  generate_classname("pb_icon_button_kit", variant)
19
22
  end
@@ -0,0 +1,39 @@
1
+ import { ensureAccessible, renderKit } from '../utilities/test-utils'
2
+
3
+ import { IconButton } from 'playbook-ui'
4
+
5
+ const props = {
6
+ data: { testid: 'default', icon: 'plus' }
7
+ }
8
+
9
+ test('default test', () => {
10
+ const kit = renderKit(IconButton, props)
11
+
12
+ expect(kit).toBeInTheDocument()
13
+ expect(kit).toHaveClass('pb_icon_button_kit_default')
14
+
15
+ const iconElement = kit.querySelector('.icon_button_icon')
16
+ expect(iconElement).toBeInTheDocument()
17
+ })
18
+
19
+ it("should be accessible", async () => {
20
+ ensureAccessible(IconButton, props)
21
+ })
22
+
23
+ test('passes link variant prop', () => {
24
+ const kit = renderKit(IconButton, { ...props, variant: "link" })
25
+ expect(kit).toBeInTheDocument()
26
+ expect(kit).toHaveClass('pb_icon_button_kit_link')
27
+ })
28
+
29
+ test('should set button type to "submit" when htmlType prop is passed', () => {
30
+ const kit = renderKit(IconButton, { ...props, htmlType: 'submit' })
31
+ const buttonElement = kit.querySelector('button')
32
+ expect(buttonElement).toHaveAttribute('type', 'submit')
33
+ })
34
+
35
+ test('passes custom classname', () => {
36
+ const kit = renderKit(IconButton, { ...props, className: "extra_class" })
37
+ expect(kit).toBeInTheDocument()
38
+ expect(kit).toHaveClass('pb_icon_button_kit_default extra_class')
39
+ })
@@ -1,8 +1,3 @@
1
- <%= content_tag(:div,
2
- aria: object.aria,
3
- data: object.data,
4
- id: object.id,
5
- class: object.classname,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
7
2
  <%= react_component("MultiLevelSelect", object.multi_level_select_options) %>
8
3
  <% end %>
@@ -1,15 +1,9 @@
1
1
  <% if object.collapsible %>
2
2
  <%= pb_rails("collapsible", props: { name: "collapsible-nav-example", classname: object.collapsible_nav_classname }) do %>
3
3
  <%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs", dark: object.dark, classname:object.margin_classes }) do %>
4
- <%= content_tag(object.tag,
5
- aria: object.aria,
6
- class: object.classname,
7
- data: object.data,
8
- dark: object.dark,
9
- id: object.id,
10
- href: object.link && object.link,
11
- target: object.link && object.target,
12
- **combined_html_options
4
+ <%= pb_content_tag( object.tag,
5
+ href: object.link && object.link,
6
+ target: object.link && object.target
13
7
  ) do %>
14
8
  <% if object.image_url %>
15
9
  <%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper_collapsible" }) %>
@@ -20,22 +14,16 @@
20
14
  <span class="pb_nav_list_item_text_collapsible">
21
15
  <%= object.text %>
22
16
  </span>
23
- <% end %>
17
+ <% end %>
24
18
  <% end %>
25
19
  <%= pb_rails("collapsible/collapsible_content", props: {collapsed: object.collapsed}) do %>
26
20
  <%= content.presence %>
27
21
  <% end %>
28
22
  <% end %>
29
23
  <% else %>
30
- <%= content_tag(object.tag,
31
- aria: object.aria,
32
- class: object.classname,
33
- **combined_html_options,
34
- data: object.data,
35
- dark: object.dark,
36
- id: object.id,
37
- href: object.link && object.link,
38
- target: object.link && object.target
24
+ <%= pb_content_tag( object.tag,
25
+ href: object.link && object.link,
26
+ target: object.link && object.target
39
27
  ) do %>
40
28
  <% if object.image_url %>
41
29
  <%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
@@ -1,12 +1,7 @@
1
- <%= content_tag(:nav,
2
- aria: object.aria,
3
- class: object.classname,
4
- data: object.data,
5
- id: object.id,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag(:nav) do %>
7
2
  <% if object.title %>
8
- <%= content_tag(:div, class: "pb_nav_list_title") do %>
9
- <%= content_tag(:a, class: "pb_nav_list_item_link_text", href: object.link) do %>
3
+ <%= pb_content_tag do %>
4
+ <%= pb_content_tag(:a) do %>
10
5
  <%= pb_rails("caption", props: { text: object.title, dark: dark }) %>
11
6
  <% end %>
12
7
  <% end %>
@@ -1,7 +1,2 @@
1
- <%= content_tag(:div,
2
- aria: object.aria.merge!(label: object.status),
3
- class: object.classname,
4
- data: object.data,
5
- id: object.id,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
7
2
  <% end %>
@@ -8,6 +8,7 @@ import OverlayToken from './subcomponents/_overlay_token'
8
8
  export type OverlayChildrenProps = {
9
9
  children: React.ReactNode[] | React.ReactNode,
10
10
  color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
11
+ dynamic?: boolean,
11
12
  position: string,
12
13
  size: string,
13
14
  }
@@ -18,6 +19,7 @@ type OverlayProps = {
18
19
  children: React.ReactNode[] | React.ReactNode,
19
20
  color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
20
21
  data?: { [key: string]: string },
22
+ dynamic?: false,
21
23
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
22
24
  id?: string,
23
25
  layout: { [key: string]: string },
@@ -30,6 +32,7 @@ const Overlay = (props: OverlayProps) => {
30
32
  children,
31
33
  color = "card_light",
32
34
  data = {},
35
+ dynamic = false,
33
36
  htmlOptions = {},
34
37
  id,
35
38
  layout = { "bottom": "full" },
@@ -69,6 +72,7 @@ const Overlay = (props: OverlayProps) => {
69
72
  }) : OverlayToken({
70
73
  children,
71
74
  color,
75
+ dynamic: dynamic,
72
76
  position: getPosition(),
73
77
  size: getSize()
74
78
  })