playbook_ui 13.13.0.pre.alpha.play10821727 → 13.14.0.pre.alpha.PLAY1109bugdisplaypropblocksfontcolor1784

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/index.js +13 -1
  3. data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +5 -5
  4. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +3 -3
  5. data/app/pb_kits/playbook/pb_background/_background.tsx +9 -9
  6. data/app/pb_kits/playbook/pb_badge/_badge.tsx +2 -2
  7. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +3 -3
  8. data/app/pb_kits/playbook/pb_body/_body.tsx +5 -4
  9. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.tsx +4 -3
  10. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.tsx +3 -3
  11. data/app/pb_kits/playbook/pb_button/_button.tsx +37 -40
  12. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.tsx +3 -3
  13. data/app/pb_kits/playbook/pb_caption/_caption.tsx +1 -1
  14. data/app/pb_kits/playbook/pb_card/_card.tsx +2 -2
  15. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +0 -1
  16. data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +4 -5
  17. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +3 -3
  18. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +9 -9
  19. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +1 -1
  20. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +7 -5
  21. data/app/pb_kits/playbook/pb_collapsible/_helper_functions.ts +2 -2
  22. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +4 -5
  23. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +12 -16
  24. data/app/pb_kits/playbook/pb_contact/_contact.tsx +3 -3
  25. data/app/pb_kits/playbook/pb_currency/_currency.tsx +2 -2
  26. data/app/pb_kits/playbook/pb_dashboard/pbChartsColorsHelper.ts +1 -1
  27. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +57 -4
  28. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +57 -4
  29. data/app/pb_kits/playbook/pb_dashboard/themeTypes.ts +16 -20
  30. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.tsx +1 -1
  31. data/app/pb_kits/playbook/pb_date/_date.tsx +7 -7
  32. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +4 -1
  33. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +3 -0
  34. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +11 -10
  35. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom.html.erb +29 -0
  36. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom.jsx +34 -0
  37. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom.md +7 -0
  38. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.html.erb +28 -0
  39. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.jsx +34 -0
  40. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.md +1 -0
  41. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.jsx +2 -2
  42. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +4 -0
  43. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -0
  44. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +69 -3
  45. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +2 -2
  46. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +2 -2
  47. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +8 -8
  48. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +2 -2
  49. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +1 -1
  50. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +2 -2
  51. data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.test.js +3 -6
  52. data/app/pb_kits/playbook/pb_detail/_detail.scss +2 -2
  53. data/app/pb_kits/playbook/pb_detail/_detail.tsx +4 -4
  54. data/app/pb_kits/playbook/pb_detail/detail.rb +1 -1
  55. data/app/pb_kits/playbook/pb_detail/detail.test.jsx +2 -2
  56. data/app/pb_kits/playbook/pb_dialog/_close_icon.tsx +2 -2
  57. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +34 -42
  58. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.tsx +1 -1
  59. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.tsx +5 -4
  60. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx +4 -4
  61. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.jsx +4 -8
  62. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.jsx +4 -8
  63. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_scrollable.jsx +2 -4
  64. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.jsx +1 -1
  65. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.tsx +5 -5
  66. data/app/pb_kits/playbook/pb_enhanced_element/element_observer.ts +1 -1
  67. data/app/pb_kits/playbook/pb_enhanced_element/index.ts +1 -1
  68. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +1 -1
  69. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +1 -1
  70. data/app/pb_kits/playbook/pb_flex/_flex.tsx +1 -1
  71. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +1 -1
  72. data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +1 -1
  73. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -1
  74. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +1 -1
  75. data/app/pb_kits/playbook/pb_hashtag/_hashtag.tsx +1 -1
  76. data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +1 -1
  77. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +1 -1
  78. data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
  79. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +1 -1
  80. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +1 -1
  81. data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +1 -1
  82. data/app/pb_kits/playbook/pb_image/_image.tsx +1 -1
  83. data/app/pb_kits/playbook/pb_label_pill/_label_pill.tsx +1 -1
  84. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +1 -1
  85. data/app/pb_kits/playbook/pb_layout/_layout.tsx +1 -1
  86. data/app/pb_kits/playbook/pb_legend/_legend.tsx +1 -1
  87. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +1 -1
  88. data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +1 -1
  89. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +1 -1
  90. data/app/pb_kits/playbook/pb_list/_list.tsx +1 -1
  91. data/app/pb_kits/playbook/pb_list/_list_item.tsx +1 -1
  92. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +1 -1
  93. data/app/pb_kits/playbook/pb_map/_map.tsx +1 -1
  94. data/app/pb_kits/playbook/pb_message/_message.tsx +1 -1
  95. data/app/pb_kits/playbook/pb_message/_message_mention.tsx +1 -1
  96. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -1
  97. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +1 -1
  98. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +1 -1
  99. data/app/pb_kits/playbook/pb_nav/_item.tsx +1 -1
  100. data/app/pb_kits/playbook/pb_nav/_nav.tsx +1 -1
  101. data/app/pb_kits/playbook/pb_online_status/_online_status.tsx +1 -1
  102. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +1 -1
  103. data/app/pb_kits/playbook/pb_person/_person.tsx +1 -1
  104. data/app/pb_kits/playbook/pb_person/docs/_person_default_swift.md +8 -0
  105. data/app/pb_kits/playbook/pb_person/docs/_person_props_swift.md +5 -0
  106. data/app/pb_kits/playbook/pb_person/docs/example.yml +4 -0
  107. data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +1 -1
  108. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +1 -1
  109. data/app/pb_kits/playbook/pb_pill/_pill.tsx +1 -1
  110. data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
  111. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +1 -1
  112. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +1 -1
  113. data/app/pb_kits/playbook/pb_progress_step/_progress_step.tsx +1 -1
  114. data/app/pb_kits/playbook/pb_progress_step/_progress_step_item.tsx +1 -1
  115. data/app/pb_kits/playbook/pb_radio/_radio.tsx +1 -1
  116. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +1 -1
  117. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +1 -1
  118. data/app/pb_kits/playbook/pb_select/_select.tsx +1 -1
  119. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +1 -1
  120. data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +1 -1
  121. data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +1 -1
  122. data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +1 -1
  123. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +1 -1
  124. data/app/pb_kits/playbook/pb_source/_source.tsx +1 -1
  125. data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +105 -53
  126. data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +185 -63
  127. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_background_options.html.erb +2 -0
  128. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_background_options.jsx +25 -0
  129. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.html.erb +3 -0
  130. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.jsx +31 -0
  131. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.html.erb +6 -8
  132. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.jsx +19 -6
  133. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.html.erb +4 -1
  134. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx +30 -5
  135. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.html.erb +6 -0
  136. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.jsx +58 -0
  137. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.html.erb +16 -0
  138. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.jsx +60 -0
  139. data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +12 -5
  140. data/app/pb_kits/playbook/pb_star_rating/docs/index.js +8 -0
  141. data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +54 -26
  142. data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +86 -6
  143. data/app/pb_kits/playbook/pb_star_rating/star_rating.test.js +34 -34
  144. data/app/pb_kits/playbook/pb_star_rating/stars/primary_star.svg +3 -0
  145. data/app/pb_kits/playbook/pb_star_rating/stars/star_outline.svg +3 -0
  146. data/app/pb_kits/playbook/pb_star_rating/stars/subtle_dark_star.svg +3 -0
  147. data/app/pb_kits/playbook/pb_star_rating/stars/subtle_star.svg +3 -0
  148. data/app/pb_kits/playbook/pb_star_rating/stars/yellow_star.svg +3 -0
  149. data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +1 -1
  150. data/app/pb_kits/playbook/pb_stat_value/_stat_value.tsx +1 -1
  151. data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
  152. data/app/pb_kits/playbook/pb_table/_table_row.tsx +1 -1
  153. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
  154. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +1 -1
  155. data/app/pb_kits/playbook/pb_time/_time.tsx +1 -1
  156. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
  157. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +1 -1
  158. data/app/pb_kits/playbook/pb_timeline/_item.tsx +1 -1
  159. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
  160. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +1 -1
  161. data/app/pb_kits/playbook/pb_title/_title.tsx +1 -1
  162. data/app/pb_kits/playbook/pb_title_count/_title_count.tsx +1 -1
  163. data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +1 -1
  164. data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
  165. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +1 -1
  166. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -1
  167. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -1
  168. data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
  169. data/app/pb_kits/playbook/pb_user/docs/_user_horizontal_swift.md +37 -0
  170. data/app/pb_kits/playbook/pb_user/docs/_user_props_table.md +10 -0
  171. data/app/pb_kits/playbook/pb_user/docs/_user_size_swift.md +35 -0
  172. data/app/pb_kits/playbook/pb_user/docs/_user_text_only_swift.md +27 -0
  173. data/app/pb_kits/playbook/pb_user/docs/_user_vertical_size_swift.md +35 -0
  174. data/app/pb_kits/playbook/pb_user/docs/example.yml +7 -0
  175. data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +1 -1
  176. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +1 -1
  177. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +1 -1
  178. data/app/pb_kits/playbook/utilities/props.ts +2 -2
  179. data/dist/playbook-rails.js +6 -6
  180. data/lib/playbook/version.rb +2 -2
  181. metadata +28 -3
  182. data/app/pb_kits/playbook/tokens/exports/exports.d.ts +0 -1
@@ -19,9 +19,14 @@ type pluginDataType = {
19
19
  rangesButtons: [] | any,
20
20
  }
21
21
 
22
+ type customQuickPickDatesType = {
23
+ override: boolean,
24
+ dates: { label: string, value: string[] | { timePeriod: string, amount: number } }[],
25
+ }
26
+
22
27
  let activeLabel = ""
23
28
 
24
- const quickPickPlugin = (thisRangesEndToday: boolean) => {
29
+ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: customQuickPickDatesType | undefined) => {
25
30
  return function (fp: FpTypes & any): any {
26
31
  const today = new Date()
27
32
  const yesterday = DateTime.getYesterdayDate(new Date())
@@ -46,8 +51,38 @@ const quickPickPlugin = (thisRangesEndToday: boolean) => {
46
51
  const lastYearStartDate = DateTime.getPreviousYearStartDate(new Date())
47
52
  const lastYearEndDate = DateTime.getPreviousYearEndDate(new Date())
48
53
 
49
- // variable that holds the ranges available
50
- const ranges = {
54
+ const calculateDateRange = (timePeriod: string, amount: number): Date[] => {
55
+ const endDate = new Date();
56
+ let startDate = new Date();
57
+
58
+ switch (timePeriod) {
59
+ case 'days':
60
+ startDate.setDate(endDate.getDate() - amount);
61
+ break;
62
+ case 'weeks':
63
+ startDate.setDate(endDate.getDate() - (amount * 7));
64
+ break;
65
+ case 'months':
66
+ startDate.setMonth(endDate.getMonth() - amount);
67
+ break;
68
+ case 'quarters':
69
+ startDate.setMonth(endDate.getMonth() - (amount * 3));
70
+ break;
71
+ case 'years':
72
+ startDate.setFullYear(endDate.getFullYear() - amount);
73
+ break;
74
+ default:
75
+ throw new Error('Invalid time period');
76
+ }
77
+ return [startDate, endDate];
78
+ };
79
+
80
+
81
+ type rangesType = {
82
+ [key: string]: Date[]
83
+ };
84
+
85
+ let ranges: rangesType = {
51
86
  'Today': [today, today],
52
87
  'Yesterday': [yesterday, yesterday],
53
88
  'This week': [thisWeekStartDate, thisWeekEndDate],
@@ -58,16 +93,47 @@ const quickPickPlugin = (thisRangesEndToday: boolean) => {
58
93
  'Last month': [lastMonthStartDate, lastMonthEndDate],
59
94
  'Last quarter': [lastQuarterStartDate, lastQuarterEndDate],
60
95
  'Last year': [lastYearStartDate, lastYearEndDate]
96
+ };
97
+
98
+
99
+ if (customQuickPickDates && Object.keys(customQuickPickDates).length !== 0) {
100
+ if (customQuickPickDates.dates.length && customQuickPickDates.override === false) {
101
+ customQuickPickDates.dates.forEach((item) => {
102
+ if (Array.isArray(item.value)) {
103
+ ranges[item.label] = item.value.map((dateStr: string) => new Date(dateStr));
104
+ } else {
105
+ ranges[item.label] = calculateDateRange(
106
+ item.value.timePeriod,
107
+ item.value.amount
108
+ )
109
+ }
110
+ })
111
+ } else if(customQuickPickDates.dates.length && customQuickPickDates.override !== false) {
112
+ ranges = {}
113
+ customQuickPickDates.dates.forEach((item) => {
114
+ if (Array.isArray(item.value)) {
115
+ ranges[item.label] = item.value.map((dateStr: string) => new Date(dateStr));
116
+ } else {
117
+ ranges[item.label] = calculateDateRange(
118
+ item.value.timePeriod,
119
+ item.value.amount
120
+ )
121
+ }
122
+ })
123
+ }
61
124
  }
62
125
 
126
+
63
127
  // creating the ul element for the nav dropdown and giving it classnames
64
128
  const rangesNav = document.createElement('ul');
65
129
 
130
+
66
131
  // creating the pluginData object that will hold the properties of this plugin
67
132
  const pluginData: pluginDataType = {
68
133
  ranges: ranges,
69
134
  rangesNav: rangesNav,
70
135
  rangesButtons: [],
136
+
71
137
  };
72
138
 
73
139
  /**
@@ -16,7 +16,7 @@ type DateRangeInlineProps = {
16
16
  align?: "left" | "center" | "vertical";
17
17
  size?: "sm" | "xs";
18
18
  dark?: boolean;
19
- htmlOptions?: {[key: string]: string | number | boolean | (() => any)};
19
+ htmlOptions?: {[key: string]: string | number | boolean | Function};
20
20
  icon?: boolean;
21
21
  startDate?: Date;
22
22
  endDate?: Date;
@@ -34,7 +34,7 @@ const dateTimeIso = (dateValue: Date) => {
34
34
  return DateTime.toIso(dateValue);
35
35
  };
36
36
 
37
- const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
37
+ const DateRangeInline = (props: DateRangeInlineProps) => {
38
38
  const {
39
39
  icon = false,
40
40
  dark = false,
@@ -15,12 +15,12 @@ type DateRangeStackedProps = {
15
15
  data?: string,
16
16
  dark?: boolean,
17
17
  endDate: Date,
18
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
18
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
19
19
  id?: string,
20
20
  startDate: Date,
21
21
  }
22
22
 
23
- const DateRangeStacked = (props: DateRangeStackedProps): React.ReactElement => {
23
+ const DateRangeStacked = (props: DateRangeStackedProps) => {
24
24
  const {
25
25
  className,
26
26
  dark = false,
@@ -15,7 +15,7 @@ type DateStackedProps = {
15
15
  dark?: boolean;
16
16
  data?: string;
17
17
  date: Date;
18
- htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
18
+ htmlOptions?: { [key: string]: string | number | boolean | Function };
19
19
  size?: "sm" | "md";
20
20
  id?: string;
21
21
  reverse?: boolean;
@@ -26,7 +26,7 @@ const sizes: {sm: 4, md: 3} = {
26
26
  md: 3,
27
27
  };
28
28
 
29
- const DateStacked = (props: DateStackedProps): React.ReactElement => {
29
+ const DateStacked = (props: DateStackedProps) => {
30
30
  const {
31
31
  align = "left",
32
32
  bold = false,
@@ -56,9 +56,9 @@ const DateStacked = (props: DateStackedProps): React.ReactElement => {
56
56
  <>
57
57
  {bold == false ? (
58
58
  <div
59
- {...dataProps}
60
- {...htmlProps}
61
- className={classes}
59
+ {...dataProps}
60
+ {...htmlProps}
61
+ className={classes}
62
62
  >
63
63
  <div className="pb_date_stacked_day_month">
64
64
  <Caption text={DateTime.toMonth(date).toUpperCase()} />
@@ -72,9 +72,9 @@ const DateStacked = (props: DateStackedProps): React.ReactElement => {
72
72
  </div>
73
73
  ) : (
74
74
  <div
75
- {...dataProps}
76
- {...htmlProps}
77
- className={classes}
75
+ {...dataProps}
76
+ {...htmlProps}
77
+ className={classes}
78
78
  >
79
79
  <div className="pb_date_stacked_day_month">
80
80
  <Title
@@ -14,7 +14,7 @@ type DateTimeProps = {
14
14
  className?: string,
15
15
  data?: { [key: string]: string; },
16
16
  datetime: Date,
17
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
17
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
18
18
  id?: string,
19
19
  size?: "sm" | "md",
20
20
  showDayOfWeek: boolean,
@@ -22,7 +22,7 @@ type DateTimeProps = {
22
22
  timeZone?: string
23
23
  }
24
24
 
25
- const DateTime = (props: DateTimeProps): React.ReactElement => {
25
+ const DateTime = (props: DateTimeProps) => {
26
26
  const {
27
27
  align = 'left',
28
28
  aria = {},
@@ -11,7 +11,7 @@ import TimeStacked from '../pb_time_stacked/_time_stacked'
11
11
  import DateStacked from '../pb_date_stacked/_date_stacked'
12
12
 
13
13
  type DateTimeStackedProps = {
14
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
14
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
15
15
  id?: string,
16
16
  date: Date,
17
17
  datetime: Date,
@@ -14,11 +14,11 @@ type DateYearStackedProps = {
14
14
  dark?: boolean,
15
15
  data?: string,
16
16
  date: Date,
17
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
17
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
18
18
  id?: string,
19
19
  }
20
20
 
21
- const DateYearStacked = (props: DateYearStackedProps): React.ReactElement => {
21
+ const DateYearStacked = (props: DateYearStackedProps) => {
22
22
  const {
23
23
  align = 'left',
24
24
  className,
@@ -21,8 +21,7 @@ describe("DateYearStacked Kit", () => {
21
21
  render(
22
22
  <DateYearStacked
23
23
  data={{ testid: testId }}
24
- date={new Date(Date.now())}
25
- />
24
+ date={new Date(Date.now())} />
26
25
  );
27
26
 
28
27
  const kit = screen.getByTestId(testId);
@@ -33,8 +32,7 @@ describe("DateYearStacked Kit", () => {
33
32
  render(
34
33
  <DateYearStacked
35
34
  data={{ testid: testId }}
36
- date={new Date(Date.now())}
37
- />
35
+ date={new Date(Date.now())} />
38
36
  );
39
37
 
40
38
  const kit = screen.getByTestId(testId);
@@ -46,8 +44,7 @@ describe("DateYearStacked Kit", () => {
46
44
  render(
47
45
  <DateYearStacked
48
46
  data={{ testid: testId }}
49
- date={new Date(Date.now())}
50
- />
47
+ date={new Date(Date.now())} />
51
48
  );
52
49
 
53
50
  const kit = screen.getByTestId(testId);
@@ -6,13 +6,13 @@
6
6
  @include pb_detail;
7
7
 
8
8
  @each $color_name, $color_value in $pb_detail_colors {
9
- &[class*=_#{$color_name}] {
9
+ &[class*=color_#{$color_name}] {
10
10
  @include pb_detail($color_value);
11
11
  }
12
12
  }
13
13
 
14
14
  @each $dark_color_name, $dark_color_value in $pb_dark_detail_colors{
15
- &[class*=_#{$dark_color_name}][class*=dark]{
15
+ &[class*=color_#{$dark_color_name}][class*=dark]{
16
16
  @include pb_detail($dark_color_value)
17
17
  }
18
18
  }
@@ -17,7 +17,7 @@ type DetailProps = {
17
17
  text?: string,
18
18
  } & GlobalProps
19
19
 
20
- const Detail = (props: DetailProps): React.ReactElement => {
20
+ const Detail = (props: DetailProps) => {
21
21
  const {
22
22
  aria = {},
23
23
  bold = false,
@@ -31,12 +31,12 @@ const Detail = (props: DetailProps): React.ReactElement => {
31
31
  text= ''
32
32
  } = props
33
33
 
34
- const ariaProps: {[key: string]: string} = buildAriaProps(aria)
35
- const dataProps: {[key: string]: string} = buildDataProps(data)
34
+ const ariaProps: {[key: string]: any} = buildAriaProps(aria)
35
+ const dataProps: {[key: string]: any} = buildDataProps(data)
36
36
  const htmlProps = buildHtmlProps(htmlOptions);
37
37
  const isBold = bold ? "bold" : null
38
38
  const classes = classnames(
39
- buildCss('pb_detail_kit', color),
39
+ buildCss('pb_detail_kit', `color`, color),
40
40
  isBold,
41
41
  globalProps(props),
42
42
  className
@@ -14,7 +14,7 @@ module Playbook
14
14
  prop :text
15
15
 
16
16
  def classname
17
- generate_classname("pb_detail_kit", color) + is_bold
17
+ generate_classname("pb_detail_kit", "color", color) + is_bold
18
18
  end
19
19
 
20
20
  def content
@@ -12,7 +12,7 @@ test('returns namespaced class name', () => {
12
12
  )
13
13
 
14
14
  const kit = screen.getByTestId('primary-test')
15
- expect(kit).toHaveClass('pb_detail_kit_light')
15
+ expect(kit).toHaveClass('pb_detail_kit_color_light')
16
16
  })
17
17
 
18
18
  test('with colors', () => {
@@ -28,7 +28,7 @@ test('with colors', () => {
28
28
  )
29
29
 
30
30
  const kit = screen.getByTestId(testId)
31
- expect(kit).toHaveClass(`pb_detail_kit_${color}`)
31
+ expect(kit).toHaveClass(`pb_detail_kit_color_${color}`)
32
32
  })
33
33
  })
34
34
 
@@ -2,10 +2,10 @@ import React from 'react'
2
2
  import Icon from '../pb_icon/_icon'
3
3
 
4
4
  type CloseIconProps = {
5
- onClose: () => void,
5
+ onClose: () => any,
6
6
  }
7
7
 
8
- export const CloseIcon = (props: CloseIconProps): React.ReactElement => {
8
+ export const CloseIcon = (props: CloseIconProps) => {
9
9
  const { onClose } = props
10
10
  return (
11
11
  <div
@@ -25,8 +25,8 @@ type DialogProps = {
25
25
  className?: string;
26
26
  closeable: boolean;
27
27
  confirmButton?: string;
28
- data?: {[key: string]: string},
29
- htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
28
+ data?: object;
29
+ htmlOptions?: { [key: string]: string | number | boolean | Function };
30
30
  id?: string;
31
31
  fullHeight?: boolean;
32
32
  loading?: boolean;
@@ -45,7 +45,7 @@ type DialogProps = {
45
45
  trigger?: string;
46
46
  };
47
47
 
48
- const Dialog = (props: DialogProps): React.ReactElement => {
48
+ const Dialog = (props: DialogProps) => {
49
49
  const {
50
50
  aria = {},
51
51
  cancelButton,
@@ -59,9 +59,9 @@ const Dialog = (props: DialogProps): React.ReactElement => {
59
59
  loading = false,
60
60
  fullHeight = false,
61
61
  opened,
62
- onCancel,
63
- onConfirm,
64
- onClose,
62
+ onCancel = () => {},
63
+ onConfirm = () => {},
64
+ onClose = () => {},
65
65
  placement = "center",
66
66
  portalClassName,
67
67
  shouldCloseOnOverlayClick = true,
@@ -168,22 +168,22 @@ const Dialog = (props: DialogProps): React.ReactElement => {
168
168
  return (
169
169
  <DialogContext.Provider value={api}>
170
170
  <div
171
- {...ariaProps}
172
- {...dataProps}
173
- {...htmlProps}
174
- className={classes}
171
+ {...ariaProps}
172
+ {...dataProps}
173
+ {...htmlProps}
174
+ className={classes}
175
175
  >
176
176
  <Modal
177
- ariaHideApp={false}
178
- className={dialogClassNames}
179
- closeTimeoutMS={200}
180
- contentLabel="Minimal Modal Example"
181
- id={id}
182
- isOpen={modalIsOpened}
183
- onRequestClose={onClose}
184
- overlayClassName={overlayClassNames}
185
- portalClassName={portalClassName}
186
- shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
177
+ ariaHideApp={false}
178
+ className={dialogClassNames}
179
+ closeTimeoutMS={200}
180
+ contentLabel="Minimal Modal Example"
181
+ id={id}
182
+ isOpen={modalIsOpened}
183
+ onRequestClose={onClose}
184
+ overlayClassName={overlayClassNames}
185
+ portalClassName={portalClassName}
186
+ shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
187
187
  >
188
188
  <>
189
189
  {title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
@@ -193,41 +193,33 @@ const Dialog = (props: DialogProps): React.ReactElement => {
193
193
  className="dialog_status_text_align"
194
194
  padding="md"
195
195
  >
196
- <Flex align="center"
197
- orientation="column"
198
- >
196
+ <Flex align="center" orientation="column">
199
197
  <IconCircle
200
- icon={sweetAlertStatus[status].icon}
201
- size={sweetAlertStatus[status].size}
202
- variant={sweetAlertStatus[status].variant}
198
+ icon={sweetAlertStatus[status].icon}
199
+ size={sweetAlertStatus[status].size}
200
+ variant={sweetAlertStatus[status].variant}
203
201
  />
204
- <Title marginTop="sm"
205
- size={3}
206
- >
202
+ <Title marginTop="sm" size={3}>
207
203
  {title}
208
204
  </Title>
209
- <Body marginTop="xs"
210
- text={text}
211
- />
205
+ <Body marginTop="xs" text={text} />
212
206
  </Flex>
213
207
  </Dialog.Body>
214
208
  )}
215
209
  {cancelButton && confirmButton ? (
216
210
  <Dialog.Footer>
217
211
  <Button
218
- htmlType="button"
219
- loading={loading}
220
- onClick={onConfirm}
221
- variant="primary"
222
- >
212
+ loading={loading}
213
+ onClick={onConfirm}
214
+ htmlType="button"
215
+ variant="primary">
223
216
  {confirmButton}
224
217
  </Button>
225
218
  <Button
226
- htmlType="button"
227
- id="cancel-button"
228
- onClick={onCancel}
229
- variant="link"
230
- >
219
+ id="cancel-button"
220
+ onClick={onCancel}
221
+ variant="link"
222
+ htmlType="button">
231
223
  {cancelButton}
232
224
  </Button>
233
225
  </Dialog.Footer>
@@ -10,7 +10,7 @@ type DialogBodyProps = {
10
10
  }
11
11
 
12
12
  // Body component
13
- const DialogBody = (props: DialogBodyProps): React.ReactElement => {
13
+ const DialogBody = (props: DialogBodyProps) => {
14
14
  const { children, className } = props
15
15
  const bodyCSS = buildCss("dialog_body")
16
16
  const bodySpacing = globalProps(props)
@@ -13,7 +13,7 @@ type DialogFooterProps = {
13
13
  children: React.ReactChild[] | React.ReactChild | string,
14
14
  className?: string,
15
15
  data?: {[key: string]: string},
16
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
16
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
17
17
  id?: string,
18
18
  padding?: string,
19
19
  paddingBottom?: string,
@@ -23,7 +23,7 @@ type DialogFooterProps = {
23
23
  } & GlobalProps
24
24
 
25
25
  // Footer component
26
- const DialogFooter = (props: DialogFooterProps): React.ReactElement => {
26
+ const DialogFooter = (props: DialogFooterProps) => {
27
27
  const {
28
28
  children,
29
29
  className,
@@ -38,12 +38,13 @@ const DialogFooter = (props: DialogFooterProps): React.ReactElement => {
38
38
 
39
39
  return (
40
40
  <div
41
- {...htmlProps}
41
+ {...htmlProps}
42
42
  >
43
43
  {separator &&
44
44
  <SectionSeparator />
45
45
  }
46
- <div className="dialog-pseudo-footer" />
46
+ <div className="dialog-pseudo-footer">
47
+ </div>
47
48
  <Flex
48
49
  className={classnames(footerCSS, footerSpacing, className)}
49
50
  spacing={spacing}
@@ -13,8 +13,8 @@ type DialogHeaderProps = {
13
13
  children: React.ReactNode[] | React.ReactNode | string,
14
14
  className?: string,
15
15
  closeable?: boolean,
16
- data?: {[key: string]: string},
17
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
16
+ data?: object,
17
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
18
18
  id?: string,
19
19
  padding?: string,
20
20
  separator?: boolean,
@@ -23,7 +23,7 @@ type DialogHeaderProps = {
23
23
  title?: string,
24
24
  } & GlobalProps
25
25
 
26
- const DialogHeader = (props: DialogHeaderProps): React.ReactElement => {
26
+ const DialogHeader = (props: DialogHeaderProps) => {
27
27
  const {
28
28
  aria = {},
29
29
  children,
@@ -56,7 +56,7 @@ const DialogHeader = (props: DialogHeaderProps): React.ReactElement => {
56
56
  {children}
57
57
  {closeable &&
58
58
  <CloseIcon
59
- onClose={api.onClose}
59
+ onClose={api.onClose}
60
60
  />
61
61
  }
62
62
 
@@ -49,18 +49,15 @@ const DialogFullHeight = () => {
49
49
  <Flex wrap>
50
50
  <Button id="sm"
51
51
  marginRight="md"
52
- onClick={toggleHeaderSeparatorDialog}
53
- >
52
+ onClick={toggleHeaderSeparatorDialog}>
54
53
  {"Small Dialog"}
55
54
  </Button>
56
55
  <Button marginRight="md"
57
- onClick={toggleFooterSeparatorDialog}
58
- >
56
+ onClick={toggleFooterSeparatorDialog}>
59
57
  {"Medium Dialog"}
60
58
  </Button>
61
59
  <Button marginRight="md"
62
- onClick={toggleBothSeparatorsDialog}
63
- >
60
+ onClick={toggleBothSeparatorsDialog}>
64
61
  {"Large Dialog"}
65
62
  </Button>
66
63
  </Flex>
@@ -92,8 +89,7 @@ const DialogFullHeight = () => {
92
89
  <Dialog.Footer>
93
90
  <Button onClick={toggle}>{"Send My Issue"}</Button>
94
91
  <Button onClick={toggle}
95
- variant="link"
96
- >
92
+ variant="link">
97
93
  {"Back"}
98
94
  </Button>
99
95
  </Dialog.Footer>
@@ -48,18 +48,15 @@ const DialogFullHeightPlacement = () => {
48
48
  <Flex wrap>
49
49
  <Button id="sm"
50
50
  marginRight="md"
51
- onClick={toggleHeaderSeparatorDialog}
52
- >
51
+ onClick={toggleHeaderSeparatorDialog}>
53
52
  {"Left Dialog"}
54
53
  </Button>
55
54
  <Button marginRight="xl"
56
- onClick={toggleFooterSeparatorDialog}
57
- >
55
+ onClick={toggleFooterSeparatorDialog}>
58
56
  {"Center Dialog"}
59
57
  </Button>
60
58
  <Button marginRight="xl"
61
- onClick={toggleBothSeparatorsDialog}
62
- >
59
+ onClick={toggleBothSeparatorsDialog}>
63
60
  {"Right Dialog"}
64
61
  </Button>
65
62
  </Flex>
@@ -91,8 +88,7 @@ const DialogFullHeightPlacement = () => {
91
88
  <Dialog.Footer>
92
89
  <Button onClick={toggle}>{"Send My Issue"}</Button>
93
90
  <Button onClick={toggle}
94
- variant="link"
95
- >
91
+ variant="link">
96
92
  {"Back"}
97
93
  </Button>
98
94
  </Dialog.Footer>
@@ -16,12 +16,10 @@ const DialogScrollable = () => {
16
16
  return (
17
17
  <>
18
18
  <Button marginRight="md"
19
- onClick={toggleDialog1}
20
- >{'Open Dialog'}
19
+ onClick={toggleDialog1}>{'Open Dialog'}
21
20
  </Button>
22
21
  <Button marginRight="md"
23
- onClick={toggleDialog2}
24
- >{'Open Full Height Dialog'}
22
+ onClick={toggleDialog2}>{'Open Full Height Dialog'}
25
23
  </Button>
26
24
  <Dialog
27
25
  cancelButton="Cancel"
@@ -84,7 +84,7 @@ const DialogStatus = () => {
84
84
  <Flex
85
85
  rowGap="xs"
86
86
  wrap
87
- >
87
+ >
88
88
  <Button
89
89
  marginRight="md"
90
90
  onClick={toggleDefaultAlert}
@@ -7,13 +7,13 @@ type DistributionBarProps = {
7
7
  className?: string,
8
8
  colors: [],
9
9
  data?: string,
10
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
10
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
11
11
  id?: string,
12
12
  size?: "lg" | "sm",
13
13
  widths?: number[],
14
14
  }
15
15
 
16
- const normalizeCharacters = (widths: number[]) => {
16
+ const normalizeCharacters = (widths: number[]) => {
17
17
  return widths.map((width) => {
18
18
  return parseInt(width.toString().replace(/[^0-9.]/gi, ''))
19
19
  })
@@ -33,7 +33,7 @@ const barValues = (normalizedValues: number[], colors: []) => {
33
33
  })
34
34
  }
35
35
 
36
- const DistributionBar = (props: DistributionBarProps): React.ReactElement => {
36
+ const DistributionBar = (props: DistributionBarProps) => {
37
37
  const {
38
38
  htmlOptions = {},
39
39
  size = 'lg',
@@ -45,8 +45,8 @@ const DistributionBar = (props: DistributionBarProps): React.ReactElement => {
45
45
 
46
46
  return (
47
47
  <div
48
- className={classnames(`pb_distribution_bar_${size}`, globalProps(props))}
49
- {...htmlProps}
48
+ className={classnames(`pb_distribution_bar_${size}`, globalProps(props))}
49
+ {...htmlProps}
50
50
  >
51
51
  {barValues(normalizedValues, colors)}
52
52
  </div>