playbook_ui 13.30.0 → 13.31.0.pre.alpha.PLAY10863202

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +59 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.md +6 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +4 -4
  6. data/app/pb_kits/playbook/pb_background/background.html.erb +2 -11
  7. data/app/pb_kits/playbook/pb_body/body.html.erb +1 -6
  8. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +1 -6
  9. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +1 -6
  10. data/app/pb_kits/playbook/pb_caption/caption.html.erb +1 -6
  11. data/app/pb_kits/playbook/pb_card/_card.tsx +4 -3
  12. data/app/pb_kits/playbook/pb_card/card.html.erb +1 -7
  13. data/app/pb_kits/playbook/pb_collapsible/index.js +6 -1
  14. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default_swift.md +33 -0
  15. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_props_swift.md +18 -0
  16. data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +6 -1
  17. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default.jsx +4 -1
  18. data/app/pb_kits/playbook/pb_detail/detail.html.erb +1 -6
  19. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -6
  20. data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +1 -6
  21. data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +2 -5
  22. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -6
  23. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +2 -4
  24. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +84 -50
  25. data/app/pb_kits/playbook/pb_draggable/context/types.ts +31 -0
  26. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +15 -19
  27. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +5 -3
  28. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +5 -1
  29. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +11 -4
  30. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.md +8 -2
  31. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx +2 -2
  32. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +5 -1
  33. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx +6 -4
  34. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.md +5 -0
  35. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +142 -15
  36. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +6 -5
  37. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +18 -0
  38. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +228 -218
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +9 -0
  40. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +34 -0
  41. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
  42. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -1
  43. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +16 -12
  44. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +9 -0
  45. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +17 -2
  46. data/app/pb_kits/playbook/pb_dropdown/index.js +33 -4
  47. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +9 -3
  48. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_custom_icon.html.erb +32 -0
  49. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_custom_icon.jsx +48 -0
  50. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  51. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
  52. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +16 -11
  53. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +72 -0
  54. data/app/pb_kits/playbook/pb_flex/flex.html.erb +1 -5
  55. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +9 -0
  56. data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +1 -6
  57. data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +1 -5
  58. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +1 -5
  59. data/app/pb_kits/playbook/pb_icon/_icon.tsx +37 -6
  60. data/app/pb_kits/playbook/pb_icon/docs/_icon_default.html.erb +1 -1
  61. data/app/pb_kits/playbook/pb_icon/docs/_icon_default.jsx +2 -3
  62. data/app/pb_kits/playbook/pb_icon/icon.rb +21 -1
  63. data/app/pb_kits/playbook/pb_icon/icon_aliases.json +39 -0
  64. data/app/pb_kits/playbook/pb_list/_list.tsx +4 -4
  65. data/app/pb_kits/playbook/pb_list/_list_item.tsx +7 -3
  66. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.html.erb +1 -1
  67. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +1 -0
  68. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +3 -1
  69. data/app/pb_kits/playbook/pb_nav/item.html.erb +1 -1
  70. data/app/pb_kits/playbook/pb_nav/item.rb +1 -0
  71. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.html.erb +24 -0
  72. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +4 -4
  73. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.html.erb +11 -0
  74. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +4 -0
  75. data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +27 -0
  76. data/app/pb_kits/playbook/pb_overlay/overlay.rb +110 -0
  77. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +8 -23
  78. data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +7 -3
  79. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +3 -3
  80. data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
  81. data/app/pb_kits/playbook/pb_table/index.ts +4 -4
  82. data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +1 -1
  83. data/app/pb_kits/playbook/pb_table/subcomponents/_table_cell.tsx +1 -1
  84. data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +1 -1
  85. data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +1 -1
  86. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -1
  87. data/app/pb_kits/playbook/pb_table/table.test.js +2 -0
  88. data/app/pb_kits/playbook/pb_table/table_header.html.erb +16 -2
  89. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
  90. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
  91. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +45 -27
  92. data/app/pb_kits/playbook/pb_textarea/index.tsx +3 -3
  93. data/app/pb_kits/playbook/pb_time/_time.tsx +3 -3
  94. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
  95. data/app/pb_kits/playbook/pb_timeline/_item.tsx +12 -11
  96. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +9 -7
  97. data/app/pb_kits/playbook/pb_title/_title.tsx +2 -1
  98. data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +10 -10
  99. data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
  100. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +3 -3
  101. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +3 -4
  102. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +2 -0
  103. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +5 -4
  104. data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +12 -4
  105. data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +11 -7
  106. data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +8 -3
  107. data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +6 -1
  108. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +26 -21
  109. data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +21 -6
  110. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +13 -6
  111. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -3
  112. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +2 -0
  113. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +7 -1
  114. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -2
  115. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
  116. data/app/pb_kits/playbook/pb_typeahead/index.ts +33 -33
  117. data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
  118. data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +6 -6
  119. data/app/pb_kits/playbook/pb_user_badge/badges/million-dollar.tsx +236 -235
  120. data/app/pb_kits/playbook/pb_user_badge/badges/veteran.tsx +1 -1
  121. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +68 -63
  122. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +2 -2
  123. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -0
  124. data/dist/menu.yml +566 -472
  125. data/dist/playbook-rails.js +7 -7
  126. data/lib/playbook/version.rb +2 -2
  127. metadata +21 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11ed59c33255cb5af32fdc3180c3fa48f6ba570eb896e4409699a19e8d461cdc
4
- data.tar.gz: 61ed0816ffcf97e5383e7ab42497523610ec8b19907a175964adfc7c732702ea
3
+ metadata.gz: 38a78ffb832c26d9b4a513f4c0885a1b7c1eed316bc0e93a5796ad4dd114cb37
4
+ data.tar.gz: dae46521d8c237a8f63a2629248660050e4af8690ce28d5bc9c42b1d3be8f6ef
5
5
  SHA512:
6
- metadata.gz: ab9a4635ef513699914e2817e96faa8d7b2b756234453fc1aafedfb062f88926c163d1b373999d65cb718272da327e7fd798beba2a6cfd95f84ca2b458e55cf9
7
- data.tar.gz: 56798ee732587d6ae51b38671125c00364e2595084bf42ab632460c6b38d968e9961dc731187b656d5238e8616e37fafca86f1ec577c8662e545a9dc19552a08
6
+ metadata.gz: 5e83fa306341be3e71ebeac1469c66ede7baa1aff2f0327850249460e83ca9176fa69f13f5f40131006dfb7e819181039776ff7ad7bdbf1553c0f4c15e00d258
7
+ data.tar.gz: 6394ff34da19c883d673e67cf2dd62550cc65003c8629658995bbb21497b0fd95f497905f89742bdb2cb1c333e7a2de09e6a3b4c2a3aa4bb4fa6e77cbcdbd031
@@ -0,0 +1,59 @@
1
+ <%# Example sort method for demonstration purposes %>
2
+ <% if params["sort"] %>
3
+ <% sort_param = params["sort"].gsub(/_(asc|desc)\z/, "") %>
4
+ <% sort_direction = params["sort"].end_with?("_asc") ? 1 : -1 %>
5
+ <% @table_data.sort! do |a, b|
6
+ value_a = a[sort_param]
7
+ value_b = b[sort_param]
8
+
9
+ value_a = value_a.to_i if value_a.is_a?(String) && value_a.match?(/^\d+$/)
10
+ value_b = value_b.to_i if value_b.is_a?(String) && value_b.match?(/^\d+$/)
11
+
12
+ sort_direction * (value_a <=> value_b)
13
+ end %>
14
+ <% end %>
15
+
16
+ <%
17
+ column_definitions = [
18
+ {
19
+ accessor: "year",
20
+ label: "Year",
21
+ cellAccessors: ["quarter", "month", "day"],
22
+ sort_menu: [
23
+ { item: "Year", link: "?sort=year_asc#table-sort", active: params["sort"] == "year_asc", direction: "asc" },
24
+ { item: "Year", link: "?sort=year_desc#table-sort", active: params["sort"] == "year_desc", direction: "desc" }
25
+ ],
26
+ },
27
+ {
28
+ accessor: "newEnrollments",
29
+ label: "New Enrollments",
30
+ },
31
+ {
32
+ accessor: "scheduledMeetings",
33
+ label: "Scheduled Meetings",
34
+ },
35
+ {
36
+ accessor: "attendanceRate",
37
+ label: "Attendance Rate",
38
+ },
39
+ {
40
+ accessor: "completedClasses",
41
+ label: "Completed Classes",
42
+ },
43
+ {
44
+ accessor: "classCompletionRate",
45
+ label: "Class Completion Rate",
46
+ },
47
+ {
48
+ accessor: "graduatedStudents",
49
+ label: "Graduated Students",
50
+ }
51
+ ]
52
+
53
+ subrow_headers = ["Quarter", "Month", "Day"]
54
+ %>
55
+
56
+ <%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
57
+ <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
58
+ <%= pb_rails("advanced_table/table_body", props: { id: "subrow_headers", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
59
+ <% end %>
@@ -0,0 +1,6 @@
1
+ Optionally enable sorting by passing `sort_menu` to any `column_definition`(s). Sort options are determined by an array of `item` objects passed to the `sort_menu` prop.
2
+
3
+ </br>
4
+ <div class="pb_pill_kit_warning"><div class="pb_title_kit_size_4 pb_pill_text">Disclaimer</div></div>
5
+
6
+ This example uses a custom sort method that may need to be modified or replaced within your project.
@@ -2,14 +2,15 @@ examples:
2
2
  rails:
3
3
  - advanced_table_beta: Default (Required Props)
4
4
  - advanced_table_beta_subrow_headers: SubRow Headers
5
+ - advanced_table_beta_sort: Enable Sorting
5
6
  react:
6
7
  - advanced_table_default: Default (Required Props)
7
8
  - advanced_table_loading: Loading State
8
- - advanced_table_sort: enable Sorting
9
+ - advanced_table_sort: Enable Sorting
9
10
  - advanced_table_sort_control: Sort Control
10
11
  - advanced_table_expanded_control: Expanded Control
11
12
  - advanced_table_subrow_headers: SubRow Headers
12
13
  - advanced_table_collapsible_trail: Collapsible Trail
13
14
  - advanced_table_table_options: Table Options
14
15
  - advanced_table_table_props: Table Props
15
- - advanced_table_inline_row_loading: inline Row Loading
16
+ - advanced_table_inline_row_loading: Inline Row Loading
@@ -1,11 +1,11 @@
1
1
  <%= pb_content_tag do %>
2
- <%= pb_rails("table/table_row", props: {tag:"div"}) do %>
2
+ <%= pb_rails("table/table_row", props: { tag: "div" }) do %>
3
3
  <% object.column_definitions.each_with_index do |item, index| %>
4
- <%= pb_rails("table/table_header", props: { tag:"div", id:item[:accessor], classname:object.th_classname}) do %>
5
- <%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end", text_align:"end" }) do %>
4
+ <%= pb_rails("table/table_header", props: { tag: "div", id: item[:accessor], classname: object.th_classname, sort_menu: item[:sort_menu] }) do %>
5
+ <%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end", text_align: "end" }) do %>
6
6
  <% if index.zero? && (object.enable_toggle_expansion == "header" || object.enable_toggle_expansion == "all") %>
7
7
  <button class="gray-icon toggle-all-icon" onclick="expandAllRows(this)">
8
- <%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right:"xs" }) %>
8
+ <%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right: "xs" }) %>
9
9
  </button>
10
10
  <% end %>
11
11
  <%= item[:label] %>
@@ -1,23 +1,14 @@
1
1
  <% if object.image_url.present? %>
2
- <%= content_tag(object.tag,
3
- aria: object.aria,
4
- data: object.data,
5
- id: object.id,
6
- class: object.classname,
2
+ <%= pb_content_tag(object.tag,
7
3
  style: "background-image: url('#{object.image_url}');
8
4
  background-repeat: #{object.background_repeat};
9
5
  background-size: #{object.background_size};
10
6
  background-position: #{object.background_position};",
11
- **combined_html_options
12
7
  ) do %>
13
8
  <%= content.presence %>
14
9
  <% end %>
15
10
  <% else %>
16
- <%= content_tag(object.tag,
17
- aria: object.aria,
18
- data: object.data,
19
- id: object.id,
20
- class: object.classname,
11
+ <%= pb_content_tag(object.tag,
21
12
  style: object.custom_background_color
22
13
  ) do %>
23
14
  <%= content.presence %>
@@ -1,8 +1,3 @@
1
- <%= content_tag(object.tag,
2
- aria: object.aria,
3
- id: object.id,
4
- data: object.data,
5
- class: object.classname,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag(object.tag) do %>
7
2
  <%= object.content %>
8
3
  <% end %>
@@ -1,9 +1,4 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- aria: object.aria,
6
- **combined_html_options) do%>
1
+ <%= pb_content_tag do%>
7
2
  <%= content_tag(object.link ? 'a' : 'span', class: 'bread_crumb_item', href: object.link) do %>
8
3
  <%= content.presence %>
9
4
  <% end %>
@@ -1,8 +1,3 @@
1
- <%= content_tag(:nav,
2
- aria: object.aria,
3
- id: object.id,
4
- data: object.data,
5
- class: object.classname,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag(:nav) do %>
7
2
  <%= content.presence %>
8
3
  <% end %>
@@ -1,8 +1,3 @@
1
- <%= content_tag(object.tag,
2
- aria: object.aria,
3
- id: object.id,
4
- data: object.data,
5
- class: object.classname,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag(object.tag) do %>
7
2
  <%= content.presence || object.text %>
8
3
  <% end %>
@@ -20,6 +20,7 @@ type CardPropTypes = {
20
20
  children: React.ReactChild[] | React.ReactChild | number,
21
21
  className?: string,
22
22
  data?: {[key: string]: string},
23
+ dragId?: string,
23
24
  draggableItem?: boolean,
24
25
  dragHandle?: boolean,
25
26
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
@@ -85,11 +86,11 @@ const Card = (props: CardPropTypes): React.ReactElement => {
85
86
  children,
86
87
  className,
87
88
  data = {},
89
+ dragId,
88
90
  dragHandle = true,
89
91
  draggableItem = false,
90
92
  highlight = {},
91
93
  htmlOptions = {},
92
- id,
93
94
  selected = false,
94
95
  tag = 'div',
95
96
  } = props
@@ -126,8 +127,8 @@ const Card = (props: CardPropTypes): React.ReactElement => {
126
127
  <>
127
128
  {
128
129
  draggableItem ? (
129
- <Draggable.Item id={id}
130
- key={id}
130
+ <Draggable.Item dragId={dragId}
131
+ key={dragId}
131
132
  >
132
133
  <Tag
133
134
  {...ariaProps}
@@ -1,10 +1,4 @@
1
- <%= content_tag(object.tag,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- aria: object.aria,
6
- dark: object.dark,
7
- **combined_html_options) do %>
1
+ <%= pb_content_tag(object.tag) do %>
8
2
  <%= content.presence %>
9
3
  <% end %>
10
4
 
@@ -14,7 +14,12 @@ export default class PbCollapsible extends PbEnhancedElement {
14
14
  this.element.addEventListener('click', () => {
15
15
  this.toggleElement(this.target)
16
16
  })
17
- this.displayDownArrow()
17
+ // Check the initial state of the collapsible content and set the arrow accordingly
18
+ if (this.target.classList.contains('is-visible')) {
19
+ this.displayUpArrow()
20
+ } else {
21
+ this.displayDownArrow()
22
+ }
18
23
  // Listen for a custom event to toggle the collapsible
19
24
  document.addEventListener(`${this.target.id}`, () => {
20
25
  this.toggleElement(this.target)
@@ -0,0 +1,33 @@
1
+ ![Date-Time-Stacked-Default](https://github.com/powerhome/playbook/assets/54749071/b877dd01-32fa-49ff-af2d-1f8d819f6f39)
2
+
3
+ ```swift
4
+ VStack(alignment: .leading, spacing: Spacing.small) {
5
+ PBDateTimeStacked(
6
+ timeZoneIdentifier: "EDT",
7
+ isLowercase: true,
8
+ isMonthStacked: true,
9
+ isMonthBold: true
10
+ )
11
+ PBDateTimeStacked(
12
+ timeZoneIdentifier: "EDT",
13
+ isYearDisplayed: true,
14
+ isLowercase: true,
15
+ isMonthStacked: true,
16
+ isMonthBold: true,
17
+ isYearBold: true,
18
+ dateVariant: .standard
19
+ )
20
+ PBDateTimeStacked(
21
+ timeZoneIdentifier: "GMT+9",
22
+ isLowercase: true,
23
+ isMonthStacked: true,
24
+ isMonthBold: true
25
+ )
26
+ PBDateTimeStacked(
27
+ timeZoneIdentifier: "MDT",
28
+ isLowercase: true,
29
+ isMonthStacked: true,
30
+ isMonthBold: true
31
+ )
32
+ }
33
+ ```
@@ -0,0 +1,18 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **dateTime** | `Date` | Takes a date type to calculate the current date | `Date()` | |
5
+ | **timeDate** | `Date` | Takes a date type to calculate the current time | `Date()` | |
6
+ | **timeZoneIdentifier** | `String` | A string value that is used in a function to get the correct time in the corrresponding time zone. This value is also used to display the time zone next to the time | | |
7
+ | **isYearDisplayed** | `Bool` | Determines whether or not the year is displayed with the month and day | `false` | `true` `false` |
8
+ | **isLowercase** | `Bool` | Determines whether or not am/pm is capitalized | `false` | `true` `false` |
9
+ | **isMonthStacked** | `Bool` | Determines whether or not the value for month is stacked over the date | `false` | `true` `false` |
10
+ | **isMonthBold** | `Bool` | Determines whether or not the month is in bold | `false` | `true` `false` |
11
+ | **isYearBold** | `Bool` | Determines whether or not the year is in bold | `false` | `true` `false` |
12
+ | **dateAlignment** | `HorizontalAlignment` | Sets alignment of date | `.trailing` | `leading` `center` `trailing` |
13
+ | **timeAlignment** | `HorizontalAlignment` | Sets alignment of the time zone | `.leading` | `leading` `center` `trailing` |
14
+ | **dateVariant** | `Variant` | Allows user to choose the style in which the date is displayed | `.short(showIcon: false)` | `.short(showIcon: false)` `.dayDate(showYear: false)` `.standard` ` .withIcon(isStandard: true)` `.withIcon(isStandard: false)` |
15
+ | **timeVariant** | `Variant` | Allows user to choose the style in which the time is displayed | `.time` | `.time` `.iconTimeZone` `.withTimeZoneHeader` |
16
+ | **dateSize** | `String` | Allows user to choose the size of the date that is being displayed | `.title4` | `title4` `body` `caption` `large` `subcaption` |
17
+ | **timeStyle** | `PBFont` | Allows user to choose the size of the time that is being displayed | `.caption` | `body` `caption` `large` `subcaption`|
18
+ | **timeZoneStyle** | `PBFont` | Allows user to choose the size of the time zone that is being displayed | `.caption` | `body` `caption` `large` `subcaption`|
@@ -2,6 +2,11 @@ examples:
2
2
 
3
3
  rails:
4
4
  - date_time_stacked_default: Default
5
-
5
+
6
6
  react:
7
7
  - date_time_stacked_default: Default
8
+
9
+ swift:
10
+ - date_time_stacked_default_swift: Default
11
+ - date_time_stacked_props_swift: ""
12
+
@@ -4,7 +4,10 @@ import { DateYearStacked } from '../../'
4
4
  const DateYearStackedDefault = (props) => {
5
5
  return (
6
6
  <div>
7
- <DateYearStacked date={new Date()} />
7
+ <DateYearStacked
8
+ date={new Date()}
9
+ {...props}
10
+ />
8
11
  <DateYearStacked
9
12
  align="center"
10
13
  date={new Date()}
@@ -1,8 +1,3 @@
1
- <%= content_tag(object.tag,
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(object.tag) do %>
7
2
  <%= object.content %>
8
3
  <% end %>
@@ -1,10 +1,5 @@
1
1
  <div class="pb_dialog_wrapper_rails <%= object.full_height_style %>" data-overlay-click= <%= object.overlay_close %> >
2
- <%= content_tag(:dialog,
3
- aria: object.aria,
4
- data: object.data,
5
- id: object.id,
6
- class: object.classname,
7
- **combined_html_options) do %>
2
+ <%= pb_content_tag(:dialog) do %>
8
3
  <% if object.status === "" && object.title %>
9
4
  <%= pb_rails("dialog/dialog_header", props: { title: object.title, id: object.id }) %>
10
5
  <% end %>
@@ -1,8 +1,3 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- aria: object.aria,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag do %>
7
2
  <%= content.presence || object.text %>
8
3
  <% end %>
@@ -1,8 +1,5 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- aria: object.aria,
5
- **combined_html_options) do %>
1
+ <%= pb_content_tag(:div, class: "") do %>
2
+ <% 'excluded classname?' %>
6
3
  <% if object.confirm_button && object.cancel_button %>
7
4
  <div class="dialog-pseudo-footer"></div>
8
5
  <%= pb_rails("flex", props: { classname:object.classname, spacing:"between", padding_x:"sm", padding:"sm", padding_bottom:"sm" }) do %>
@@ -1,9 +1,4 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.sticky_header,
5
- aria: object.aria,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag(:div, class: object.sticky_header) do %>
7
2
  <%= pb_rails("flex", props: {classname:object.classname, spacing:"between", padding:"sm", align:"center"}) do %>
8
3
  <%= content.presence || object.title %>
9
4
 
@@ -1,11 +1,9 @@
1
1
  @import "../tokens/colors";
2
+ @import "../tokens/opacity";
2
3
 
3
4
  .pb_draggable_container {
4
5
  .is_dragging {
5
- opacity: 40%;
6
- }
7
- .active {
8
- opacity: 60%;
6
+ opacity: $opacity_4;
9
7
  }
10
8
  .pb_draggable_item:hover {
11
9
  cursor: grab;
@@ -1,90 +1,124 @@
1
- import React, { createContext, useState, useContext, useEffect } from "react";
1
+ import React, { createContext, useReducer, useContext, useEffect, useMemo } from "react";
2
+ import { InitialStateType, ActionType, DraggableProviderType } from "./types";
3
+
4
+ const initialState: InitialStateType = {
5
+ items: [],
6
+ dragData: { id: "", initialGroup: "" },
7
+ isDragging: "",
8
+ activeContainer: ""
9
+ };
10
+
11
+ const reducer = (state: InitialStateType, action: ActionType) => {
12
+ switch (action.type) {
13
+ case 'SET_ITEMS':
14
+ return { ...state, items: action.payload };
15
+ case 'SET_DRAG_DATA':
16
+ return { ...state, dragData: action.payload };
17
+ case 'SET_IS_DRAGGING':
18
+ return { ...state, isDragging: action.payload };
19
+ case 'SET_ACTIVE_CONTAINER':
20
+ return { ...state, activeContainer: action.payload };
21
+ case 'CHANGE_CATEGORY':
22
+ return {
23
+ ...state,
24
+ items: state.items.map(item =>
25
+ item.id === action.payload.itemId
26
+ ? { ...item, container: action.payload.container }
27
+ : item
28
+ )
29
+ };
30
+ case 'REORDER_ITEMS': {
31
+ const { dragId, targetId } = action.payload;
32
+ const newItems = [...state.items];
33
+ const draggedItem = newItems.find(item => item.id === dragId);
34
+ const draggedIndex = newItems.indexOf(draggedItem);
35
+ const targetIndex = newItems.findIndex(item => item.id === targetId);
36
+
37
+ newItems.splice(draggedIndex, 1);
38
+ newItems.splice(targetIndex, 0, draggedItem);
2
39
 
40
+ return { ...state, items: newItems };
41
+ }
42
+ default:
43
+ return state;
44
+ }
45
+ };
46
+
47
+ // Context and Provider
3
48
  const DragContext = createContext<any>({});
4
49
 
5
50
  export const DraggableContext = () => {
6
51
  return useContext(DragContext);
7
52
  };
8
53
 
9
- export const DraggableProvider = ({ children, initialItems, onReorder }: any) => {
10
- const [items, setItems] = useState([]);
11
- const [dragData, setDragData] = useState<{ [key: string]: any }>({});
12
- const [isDragging, setIsDragging] = useState("");
13
- const [activeContainer, setActiveContainer] = useState("");
54
+ export const DraggableProvider = ({
55
+ children,
56
+ initialItems,
57
+ onReorder,
58
+ onDragStart,
59
+ onDragEnter,
60
+ onDragEnd,
61
+ onDrop,
62
+ onDragOver
63
+ }: DraggableProviderType) => {
64
+ const [state, dispatch] = useReducer(reducer, initialState);
14
65
 
15
66
  useEffect(() => {
16
- setItems(initialItems);
67
+ dispatch({ type: 'SET_ITEMS', payload: initialItems });
17
68
  }, [initialItems]);
18
69
 
19
70
  useEffect(() => {
20
- onReorder(items);
21
- }, [items]);
71
+ onReorder(state.items);
72
+ }, [state.items]);
22
73
 
23
74
  const handleDragStart = (id: string, container: string) => {
24
- setDragData({ id: id, initialGroup: container });
25
- setIsDragging(id);
75
+ dispatch({ type: 'SET_DRAG_DATA', payload: { id: id, initialGroup: container } });
76
+ dispatch({ type: 'SET_IS_DRAGGING', payload: id });
77
+ if (onDragStart) onDragStart(id, container);
26
78
  };
27
79
 
28
80
  const handleDragEnter = (id: string, container: string) => {
29
- if (dragData?.id !== id) {
30
- const newItems = [...items];
31
- const draggedItem = newItems.find((item) => item.id === dragData.id);
32
- const draggedIndex = newItems.indexOf(draggedItem);
33
- const targetIndex = newItems.findIndex((item) => item.id === id);
34
-
35
- newItems.splice(draggedIndex, 1);
36
- newItems.splice(targetIndex, 0, draggedItem);
37
-
38
- setItems(newItems);
39
- setDragData({ id: dragData.id, initialGroup: container });
81
+ if (state.dragData.id !== id) {
82
+ dispatch({ type: 'REORDER_ITEMS', payload: { dragId: state.dragData.id, targetId: id } });
83
+ dispatch({ type: 'SET_DRAG_DATA', payload: { id: state.dragData.id, initialGroup: container } });
40
84
  }
85
+ if (onDragEnter) onDragEnter(id, container);
41
86
  };
42
87
 
43
88
  const handleDragEnd = () => {
44
- setIsDragging("");
45
- setActiveContainer("");
89
+ dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
90
+ dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
91
+ if (onDragEnd) onDragEnd();
46
92
  };
47
93
 
48
94
  const changeCategory = (itemId: string, container: string) => {
49
- const updatedItems = items.map((item) => {
50
- if (item.id === itemId) {
51
- return { ...item, container: container };
52
- }
53
- return item;
54
- });
55
-
56
- setItems(updatedItems);
95
+ dispatch({ type: 'CHANGE_CATEGORY', payload: { itemId, container } });
57
96
  };
58
97
 
59
98
  const handleDrop = (container: string) => {
60
- setIsDragging("");
61
- setActiveContainer("");
62
- const selected = dragData.id;
63
- changeCategory(selected, container);
99
+ dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
100
+ dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
101
+ changeCategory(state.dragData.id, container);
102
+ if (onDrop) onDrop(container);
64
103
  };
65
104
 
66
105
  const handleDragOver = (e: Event, container: string) => {
67
106
  e.preventDefault();
68
- setActiveContainer(container);
107
+ dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: container });
108
+ if (onDragOver) onDragOver(e, container);
69
109
  };
70
110
 
71
-
72
-
73
- const contextValue = {
74
- items,
75
- setItems,
76
- dragData,
77
- setDragData,
78
- isDragging,
79
- setIsDragging,
80
- activeContainer,
81
- setActiveContainer,
111
+ const contextValue = useMemo(() => ({
112
+ items: state.items,
113
+ dragData: state.dragData,
114
+ isDragging: state.isDragging,
115
+ activeContainer: state.activeContainer,
82
116
  handleDragStart,
83
117
  handleDragEnter,
84
118
  handleDragEnd,
85
119
  handleDrop,
86
- handleDragOver,
87
- };
120
+ handleDragOver
121
+ }), [state]);
88
122
 
89
123
  return (
90
124
  <DragContext.Provider value={contextValue}>{children}</DragContext.Provider>
@@ -0,0 +1,31 @@
1
+ export interface ItemType {
2
+ id: string;
3
+ container: string;
4
+ [key: string]: any;
5
+ }
6
+
7
+ export interface InitialStateType {
8
+ items: ItemType[];
9
+ dragData: { id: string; initialGroup: string };
10
+ isDragging: string;
11
+ activeContainer: string;
12
+ }
13
+
14
+ export type ActionType =
15
+ | { type: 'SET_ITEMS'; payload: ItemType[] }
16
+ | { type: 'SET_DRAG_DATA'; payload: { id: string; initialGroup: string } }
17
+ | { type: 'SET_IS_DRAGGING'; payload: string }
18
+ | { type: 'SET_ACTIVE_CONTAINER'; payload: string }
19
+ | { type: 'CHANGE_CATEGORY'; payload: { itemId: string; container: string } }
20
+ | { type: 'REORDER_ITEMS'; payload: { dragId: string; targetId: string } };
21
+
22
+ export interface DraggableProviderType {
23
+ children: React.ReactNode;
24
+ initialItems: ItemType[];
25
+ onReorder: (items: ItemType[]) => void;
26
+ onDragStart?: (id: string, container: string) => void;
27
+ onDragEnter?: (id: string, container: string) => void;
28
+ onDragEnd?: () => void;
29
+ onDrop?: (container: string) => void;
30
+ onDragOver?: (e: Event, container: string) => void;
31
+ }