playbook_ui 13.12.0.pre.alpha.play1051testhighcharts1580 → 13.12.0.pre.alpha.play10281596

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +5 -1
  3. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +6 -2
  4. data/app/pb_kits/playbook/pb_background/_background.tsx +9 -5
  5. data/app/pb_kits/playbook/pb_badge/_badge.tsx +5 -1
  6. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +39 -39
  7. data/app/pb_kits/playbook/pb_body/_body.tsx +5 -1
  8. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.tsx +5 -1
  9. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.tsx +5 -2
  10. data/app/pb_kits/playbook/pb_button/_button.tsx +8 -1
  11. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.tsx +5 -1
  12. data/app/pb_kits/playbook/pb_caption/_caption.tsx +6 -1
  13. data/app/pb_kits/playbook/pb_card/_card.tsx +5 -1
  14. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +7 -2
  15. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +71 -71
  16. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +5 -3
  17. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +5 -1
  18. data/app/pb_kits/playbook/pb_contact/_contact.tsx +5 -1
  19. data/app/pb_kits/playbook/pb_currency/_currency.tsx +5 -1
  20. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +208 -210
  21. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +207 -209
  22. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.tsx +5 -1
  23. data/app/pb_kits/playbook/pb_date/_date.tsx +12 -7
  24. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +5 -1
  25. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +5 -1
  26. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +15 -4
  27. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +12 -5
  28. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +5 -1
  29. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +5 -1
  30. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +15 -4
  31. data/app/pb_kits/playbook/pb_detail/_detail.tsx +5 -1
  32. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +11 -3
  33. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.tsx +8 -3
  34. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx +5 -1
  35. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.tsx +8 -1
  36. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +6 -2
  37. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +6 -1
  38. data/app/pb_kits/playbook/pb_flex/_flex.tsx +6 -1
  39. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +6 -1
  40. data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +5 -1
  41. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +7 -1
  42. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +54 -62
  43. data/app/pb_kits/playbook/pb_hashtag/_hashtag.tsx +5 -1
  44. data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +5 -0
  45. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +10 -3
  46. data/app/pb_kits/playbook/pb_icon/_icon.tsx +7 -1
  47. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +5 -1
  48. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +5 -1
  49. data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +5 -1
  50. data/app/pb_kits/playbook/pb_image/_image.tsx +6 -1
  51. data/app/pb_kits/playbook/pb_label_pill/_label_pill.tsx +5 -1
  52. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +6 -2
  53. data/app/pb_kits/playbook/pb_layout/_layout.tsx +6 -1
  54. data/app/pb_kits/playbook/pb_legend/_legend.tsx +5 -1
  55. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +6 -1
  56. data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +5 -1
  57. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +44 -44
  58. data/app/pb_kits/playbook/pb_list/_list.tsx +7 -2
  59. data/app/pb_kits/playbook/pb_list/_list_item.tsx +5 -1
  60. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +5 -1
  61. data/app/pb_kits/playbook/pb_map/_map.tsx +6 -1
  62. data/app/pb_kits/playbook/pb_message/_message.tsx +5 -1
  63. data/app/pb_kits/playbook/pb_message/_message_mention.tsx +5 -1
  64. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +5 -1
  65. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +5 -1
  66. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_default_swift.md +11 -0
  67. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_props_swift.md +7 -0
  68. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_reverse_swift.md +13 -0
  69. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_size_swift.md +11 -0
  70. data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +6 -0
  71. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +5 -1
  72. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md +15 -0
  73. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md +5 -0
  74. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md +15 -0
  75. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md +15 -0
  76. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +6 -0
  77. data/app/pb_kits/playbook/pb_nav/_item.tsx +7 -2
  78. data/app/pb_kits/playbook/pb_nav/_nav.tsx +5 -1
  79. data/app/pb_kits/playbook/pb_online_status/_online_status.tsx +5 -1
  80. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +6 -2
  81. data/app/pb_kits/playbook/pb_person/_person.tsx +5 -0
  82. data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +5 -1
  83. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +8 -2
  84. data/app/pb_kits/playbook/pb_pill/_pill.tsx +5 -1
  85. data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -1
  86. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +5 -1
  87. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +9 -3
  88. data/app/pb_kits/playbook/pb_progress_step/_progress_step.tsx +5 -1
  89. data/app/pb_kits/playbook/pb_progress_step/_progress_step_item.tsx +6 -2
  90. data/app/pb_kits/playbook/pb_radio/_radio.tsx +5 -1
  91. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +7 -1
  92. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +5 -1
  93. data/app/pb_kits/playbook/pb_select/_select.tsx +6 -1
  94. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +6 -2
  95. data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +5 -0
  96. data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +5 -0
  97. data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +11 -3
  98. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +5 -1
  99. data/app/pb_kits/playbook/pb_source/_source.tsx +5 -1
  100. data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +5 -1
  101. data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +14 -2
  102. data/app/pb_kits/playbook/pb_stat_value/_stat_value.tsx +6 -0
  103. data/app/pb_kits/playbook/pb_table/_table.tsx +5 -1
  104. data/app/pb_kits/playbook/pb_table/_table_row.tsx +5 -1
  105. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +5 -1
  106. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on_swift.md +35 -0
  107. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md +29 -0
  108. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled_swift.md +13 -0
  109. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error_swift.md +24 -0
  110. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_props_swift.md +13 -0
  111. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +7 -0
  112. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +5 -2
  113. data/app/pb_kits/playbook/pb_time/_time.tsx +9 -2
  114. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +5 -1
  115. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +6 -2
  116. data/app/pb_kits/playbook/pb_timeline/_item.tsx +9 -2
  117. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +5 -1
  118. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +5 -1
  119. data/app/pb_kits/playbook/pb_title/_title.tsx +5 -1
  120. data/app/pb_kits/playbook/pb_title_count/_title_count.tsx +5 -1
  121. data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +16 -3
  122. data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +5 -0
  123. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default_swift.md +11 -0
  124. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name_swift.md +10 -0
  125. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_props_swift.md +6 -0
  126. data/app/pb_kits/playbook/pb_toggle/docs/example.yml +4 -0
  127. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +5 -1
  128. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +38 -38
  129. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +7 -2
  130. data/app/pb_kits/playbook/pb_user/_user.tsx +5 -1
  131. data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +5 -1
  132. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +5 -1
  133. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +5 -1
  134. data/app/pb_kits/playbook/utilities/props.ts +16 -0
  135. data/dist/playbook-rails.js +6 -6
  136. data/lib/playbook/version.rb +1 -1
  137. metadata +18 -2
@@ -6,6 +6,7 @@ import {
6
6
  buildAriaProps,
7
7
  buildCss,
8
8
  buildDataProps,
9
+ buildHtmlProps,
9
10
  } from "../../utilities/props";
10
11
  import { globalProps, GlobalProps } from "../../utilities/globalProps";
11
12
  import { LightboxContext } from "../_lightbox_context";
@@ -23,6 +24,7 @@ type LightboxHeaderProps = {
23
24
  className?: string;
24
25
  closeable?: boolean;
25
26
  data?: { [key: string]: string | number };
27
+ htmlOptions?: { [key: string]: string | number | boolean | Function };
26
28
  icon?: string;
27
29
  id?: string;
28
30
  onClickRight?: () => void;
@@ -38,6 +40,7 @@ const LightboxHeader = (props: LightboxHeaderProps): React.ReactElement => {
38
40
  children,
39
41
  className,
40
42
  data = {},
43
+ htmlOptions = {},
41
44
  onClickRight,
42
45
  spacing = "between",
43
46
  text,
@@ -48,7 +51,8 @@ const LightboxHeader = (props: LightboxHeaderProps): React.ReactElement => {
48
51
  } = props;
49
52
 
50
53
  const ariaProps = buildAriaProps(aria);
51
- const dataProps = buildDataProps(data);
54
+ const dataProps = buildDataProps(data)
55
+ const htmlProps = buildHtmlProps(htmlOptions);
52
56
  const api: any = useContext(LightboxContext);
53
57
  const headerCSS = buildCss("lightbox_header");
54
58
  const headerSpacing = globalProps(props, { paddingY: "sm" });
@@ -112,6 +116,7 @@ const LightboxHeader = (props: LightboxHeaderProps): React.ReactElement => {
112
116
  <Flex
113
117
  {...ariaProps}
114
118
  {...dataProps}
119
+ {...htmlProps}
115
120
  className={classnames(headerCSS, headerSpacing, className)}
116
121
  spacing={spacing}
117
122
  >
@@ -1,7 +1,7 @@
1
1
  import React, { Fragment, useMemo, useRef, useState, useEffect } from 'react'
2
2
  import { useKbdControls } from './hooks/useKbdControls'
3
3
  import classnames from 'classnames'
4
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
4
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
5
5
  import { globalProps } from '../utilities/globalProps'
6
6
  import LightboxHeader from './Header/_lightbox_header'
7
7
  import { LightboxContext } from './_lightbox_context'
@@ -15,6 +15,7 @@ type LightboxType = {
15
15
  currentPhotoIndex?: number,
16
16
  data?: {[key: string]: string | number},
17
17
  description?: string | any,
18
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
18
19
  id?: string,
19
20
  photos: [],
20
21
  initialPhoto?: number,
@@ -35,6 +36,7 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
35
36
  currentPhotoIndex,
36
37
  data = {},
37
38
  description,
39
+ htmlOptions = {},
38
40
  id = '',
39
41
  initialPhoto = 0,
40
42
  photos,
@@ -60,6 +62,7 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
60
62
 
61
63
  const ariaProps = buildAriaProps(aria)
62
64
  const dataProps = buildDataProps(data)
65
+ const htmlProps = buildHtmlProps(htmlOptions)
63
66
  const classes = classnames(
64
67
  buildCss('pb_lightbox_kit'),
65
68
  globalProps(props),
@@ -96,6 +99,7 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
96
99
  <div
97
100
  {...ariaProps}
98
101
  {...dataProps}
102
+ {...htmlProps}
99
103
  className={classes}
100
104
  id={id}
101
105
  ref={lightboxRef}
@@ -1,42 +1,43 @@
1
- /* eslint-disable */
2
1
  import React, { useState, useEffect } from "react";
3
2
  import classnames from "classnames";
4
3
  import { globalProps } from "../utilities/globalProps";
5
- import { buildAriaProps, buildDataProps } from "../utilities/props";
4
+ import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
6
5
 
7
6
  import HighchartsReact from "highcharts-react-official";
7
+ import Highcharts from "highcharts";
8
8
  import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
9
9
  import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
10
10
  import mapColors from "../pb_dashboard/pbChartsColorsHelper";
11
11
 
12
12
  type LineGraphProps = {
13
- align?: "left" | "right" | "center",
14
- axisTitle?: string,
15
- dark?: Boolean,
16
- xAxisCategories: [],
17
- yAxisMin: number,
18
- yAxisMax: number,
19
- className?: string,
13
+ align?: "left" | "right" | "center";
14
+ axisTitle?: string;
15
+ dark?: Boolean;
16
+ xAxisCategories: [];
17
+ yAxisMin: number;
18
+ yAxisMax: number;
19
+ className?: string;
20
20
  chartData: {
21
- name: string,
22
- data: number[],
23
- }[],
24
- gradient?: boolean,
25
- id: string,
26
- pointStart: number,
27
- subTitle?: string,
28
- title: string,
29
- type?: string,
30
- legend?: boolean,
31
- toggleLegendClick?: boolean,
32
- height?: string,
33
- colors: string[],
34
- layout?: "horizontal" | "vertical" | "proximate",
35
- verticalAlign?: "top" | "middle" | "bottom",
36
- x?: number,
37
- y?: number,
38
- aria?: { [key: string]: string },
39
- data?: { [key: string]: string },
21
+ name: string;
22
+ data: number[];
23
+ }[];
24
+ gradient?: boolean;
25
+ htmlOptions?: {[key: string]: string | number | boolean | Function};
26
+ id: string;
27
+ pointStart: number;
28
+ subTitle?: string;
29
+ title: string;
30
+ type?: string;
31
+ legend?: boolean;
32
+ toggleLegendClick?: boolean;
33
+ height?: string;
34
+ colors: string[];
35
+ layout?: "horizontal" | "vertical" | "proximate";
36
+ verticalAlign?: "top" | "middle" | "bottom";
37
+ x?: number;
38
+ y?: number;
39
+ aria?: { [key: string]: string };
40
+ data?: { [key: string]: string };
40
41
  };
41
42
 
42
43
  const LineGraph = ({
@@ -47,6 +48,7 @@ const LineGraph = ({
47
48
  dark = false,
48
49
  gradient = false,
49
50
  type = "line",
51
+ htmlOptions = {},
50
52
  id,
51
53
  legend = false,
52
54
  toggleLegendClick = true,
@@ -66,8 +68,17 @@ const LineGraph = ({
66
68
  colors = [],
67
69
  ...props
68
70
  }: LineGraphProps) => {
69
- const ariaProps = buildAriaProps(aria);
70
- const dataProps = buildDataProps(data);
71
+
72
+ const ariaProps = buildAriaProps(aria)
73
+ const dataProps = buildDataProps(data)
74
+ const htmlProps = buildHtmlProps(htmlOptions)
75
+
76
+ const setupTheme = () => {
77
+ dark
78
+ ? Highcharts.setOptions(highchartsDarkTheme)
79
+ : Highcharts.setOptions(highchartsTheme);
80
+ };
81
+ setupTheme();
71
82
 
72
83
  const staticOptions = {
73
84
  title: {
@@ -101,7 +112,7 @@ const LineGraph = ({
101
112
  colors:
102
113
  colors !== undefined && colors.length > 0
103
114
  ? mapColors(colors)
104
- : highchartsTheme(window.Highcharts).colors,
115
+ : highchartsTheme.colors,
105
116
  plotOptions: {
106
117
  series: {
107
118
  pointStart: pointStart,
@@ -120,32 +131,21 @@ const LineGraph = ({
120
131
  }
121
132
 
122
133
  const [options, setOptions] = useState({});
123
- const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
124
134
 
125
135
  useEffect(() => {
126
136
  setOptions({ ...staticOptions });
127
-
128
- const interval = setInterval(() => {
129
- if (window.Highcharts) {
130
- clearInterval(interval)
131
- dark
132
- ? window.Highcharts.setOptions(highchartsDarkTheme(window.Highcharts))
133
- : window.Highcharts.setOptions(highchartsTheme(window.Highcharts))
134
- setIsHighchartsLoaded(true)
135
- }
136
- }, 0)
137
137
  }, [chartData]);
138
138
 
139
139
  return (
140
- isHighchartsLoaded &&
141
140
  <HighchartsReact
142
141
  containerProps={{
143
142
  className: classnames(globalProps(props), className),
144
143
  id: id,
145
144
  ...ariaProps,
146
145
  ...dataProps,
146
+ ...htmlProps
147
147
  }}
148
- highcharts={window.Highcharts}
148
+ highcharts={Highcharts}
149
149
  options={options}
150
150
  />
151
151
  );
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import classnames from "classnames";
3
- import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
3
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
4
4
  import { globalProps } from "../utilities/globalProps";
5
5
 
6
6
  type ListProps = {
@@ -10,6 +10,7 @@ type ListProps = {
10
10
  children: React.ReactNode[] | React.ReactNode;
11
11
  dark?: boolean;
12
12
  data?: object;
13
+ htmlOptions?: {[key: string]: string | number | boolean | Function};
13
14
  id?: string;
14
15
  layout?: "" | "left" | "right";
15
16
  ordered?: boolean;
@@ -29,6 +30,7 @@ const List = (props: ListProps) => {
29
30
  className,
30
31
  dark = false,
31
32
  data = {},
33
+ htmlOptions = {},
32
34
  id,
33
35
  layout = "",
34
36
  ordered = false,
@@ -53,7 +55,8 @@ const List = (props: ListProps) => {
53
55
  }
54
56
  );
55
57
  const ariaProps = buildAriaProps(aria);
56
- const dataProps = buildDataProps(data);
58
+ const dataProps = buildDataProps(data)
59
+ const htmlProps = buildHtmlProps(htmlOptions);
57
60
  const classes = classnames(
58
61
  buildCss("pb_list_kit", layoutClass[layout], size, {
59
62
  dark: dark,
@@ -71,6 +74,7 @@ const List = (props: ListProps) => {
71
74
  <ol
72
75
  {...ariaProps}
73
76
  {...dataProps}
77
+ {...htmlProps}
74
78
  className={className}
75
79
  id={id}
76
80
  role={role}
@@ -82,6 +86,7 @@ const List = (props: ListProps) => {
82
86
  <ul
83
87
  {...ariaProps}
84
88
  {...dataProps}
89
+ {...htmlProps}
85
90
  className={className}
86
91
  id={id}
87
92
  role={role}
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
3
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { globalProps } from '../utilities/globalProps'
5
5
 
6
6
  type ListItemProps = {
@@ -8,6 +8,7 @@ type ListItemProps = {
8
8
  children: React.ReactNode[] | React.ReactNode,
9
9
  className?: string,
10
10
  data?: object,
11
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
11
12
  id?: string,
12
13
  tabIndex?: number,
13
14
  }
@@ -18,12 +19,14 @@ const ListItem = (props: ListItemProps) => {
18
19
  children,
19
20
  className,
20
21
  data = {},
22
+ htmlOptions = {},
21
23
  id,
22
24
  tabIndex,
23
25
  } = props
24
26
 
25
27
  const ariaProps = buildAriaProps(aria)
26
28
  const dataProps = buildDataProps(data)
29
+ const htmlProps = buildHtmlProps(htmlOptions)
27
30
  const classes = classnames(
28
31
  buildCss('pb_item_kit'),
29
32
  globalProps(props),
@@ -35,6 +38,7 @@ const ListItem = (props: ListItemProps) => {
35
38
  <li
36
39
  {...ariaProps}
37
40
  {...dataProps}
41
+ {...htmlProps}
38
42
  className={classes}
39
43
  id={id}
40
44
  tabIndex={tabIndex}
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
4
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
5
5
  import { globalProps } from '../utilities/globalProps'
6
6
 
7
7
  import Body from '../pb_body/_body'
@@ -12,6 +12,7 @@ type LoadingInlineProps = {
12
12
  aria?: { [key: string]: string },
13
13
  className?: string,
14
14
  data?: { [key: string]: string },
15
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
15
16
  id?: string,
16
17
  }
17
18
 
@@ -21,11 +22,13 @@ const LoadingInline = (props: LoadingInlineProps) => {
21
22
  aria = {},
22
23
  className,
23
24
  data = {},
25
+ htmlOptions = {},
24
26
  id,
25
27
  } = props
26
28
 
27
29
  const ariaProps = buildAriaProps(aria)
28
30
  const dataProps = buildDataProps(data)
31
+ const htmlProps = buildHtmlProps(htmlOptions)
29
32
  const classes = classnames(
30
33
  buildCss(`pb_loading_inline_kit_${align}`),
31
34
  globalProps(props),
@@ -36,6 +39,7 @@ const LoadingInline = (props: LoadingInlineProps) => {
36
39
  <div
37
40
  {...ariaProps}
38
41
  {...dataProps}
42
+ {...htmlProps}
39
43
  className={classes}
40
44
  id={id}
41
45
  >
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
3
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { globalProps, GlobalProps } from '../utilities/globalProps'
5
5
 
6
6
  import MapControls from './_map_controls';
@@ -10,6 +10,7 @@ type MapProps = {
10
10
  children?: React.ReactChild[] | React.ReactNode,
11
11
  className?: string,
12
12
  data?: { [key: string]: string },
13
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
13
14
  id?: string,
14
15
  zoomBtns?: boolean,
15
16
  flyTo?: boolean,
@@ -24,6 +25,7 @@ const Map = (props: MapProps) => {
24
25
  children,
25
26
  className,
26
27
  data = {},
28
+ htmlOptions = {},
27
29
  id,
28
30
  zoomBtns = false,
29
31
  flyTo = false,
@@ -34,12 +36,15 @@ const Map = (props: MapProps) => {
34
36
 
35
37
  const ariaProps = buildAriaProps(aria)
36
38
  const dataProps = buildDataProps(data)
39
+ const htmlProps = buildHtmlProps(htmlOptions)
40
+
37
41
  const classes = classnames(buildCss('pb_map'), globalProps(props), className)
38
42
 
39
43
  return (
40
44
  <div
41
45
  {...ariaProps}
42
46
  {...dataProps}
47
+ {...htmlProps}
43
48
  className={classes}
44
49
  id={id}
45
50
  >
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
7
7
  import { globalProps } from '../utilities/globalProps'
8
8
 
9
9
  import Avatar from '../pb_avatar/_avatar'
@@ -21,6 +21,7 @@ type MessageProps = {
21
21
  children?: React.ReactChild[] | React.ReactChild,
22
22
  className?: string,
23
23
  data?: object,
24
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
24
25
  id?: string,
25
26
  label?: string,
26
27
  message: string,
@@ -39,6 +40,7 @@ const Message = (props: MessageProps) => {
39
40
  children,
40
41
  className,
41
42
  data = {},
43
+ htmlOptions = {},
42
44
  id,
43
45
  label,
44
46
  message,
@@ -49,6 +51,7 @@ const Message = (props: MessageProps) => {
49
51
  } = props
50
52
  const ariaProps = buildAriaProps(aria)
51
53
  const dataProps = buildDataProps(data)
54
+ const htmlProps = buildHtmlProps(htmlOptions)
52
55
  const shouldDisplayAvatar = avatarUrl || avatarName
53
56
  const baseClassName = shouldDisplayAvatar
54
57
  ? 'pb_message_kit_avatar'
@@ -64,6 +67,7 @@ const Message = (props: MessageProps) => {
64
67
  <div
65
68
  {...ariaProps}
66
69
  {...dataProps}
70
+ {...htmlProps}
67
71
  className={classes}
68
72
  id={id}
69
73
  >
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
3
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { globalProps } from '../utilities/globalProps'
5
5
 
6
6
  type MessageMentionProps = {
@@ -8,6 +8,7 @@ type MessageMentionProps = {
8
8
  children?: React.ReactChild[] | React.ReactChild,
9
9
  className?: string,
10
10
  data?: object,
11
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
11
12
  id?: string,
12
13
  variant: 'user' | 'self',
13
14
  }
@@ -18,11 +19,13 @@ const MessageMention = (props: MessageMentionProps) => {
18
19
  children,
19
20
  className,
20
21
  data = {},
22
+ htmlOptions = {},
21
23
  id,
22
24
  variant = 'user',
23
25
  } = props
24
26
  const ariaProps = buildAriaProps(aria)
25
27
  const dataProps = buildDataProps(data)
28
+ const htmlProps = buildHtmlProps(htmlOptions)
26
29
  const classes = classnames(
27
30
  buildCss('pb_message_mention', variant),
28
31
  globalProps(props),
@@ -33,6 +36,7 @@ const MessageMention = (props: MessageMentionProps) => {
33
36
  <div
34
37
  {...ariaProps}
35
38
  {...dataProps}
39
+ {...htmlProps}
36
40
  className={classes}
37
41
  id={id}
38
42
  >
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect, useRef } from "react"
2
2
  import classnames from "classnames"
3
3
  import { globalProps, GlobalProps } from "../utilities/globalProps"
4
- import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props"
4
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props"
5
5
  import Checkbox from "../pb_checkbox/_checkbox"
6
6
  import Radio from "../pb_radio/_radio"
7
7
  import Body from "../pb_body/_body"
@@ -24,6 +24,7 @@ type MultiLevelSelectProps = {
24
24
  aria?: { [key: string]: string }
25
25
  className?: string
26
26
  data?: { [key: string]: string }
27
+ htmlOptions?: {[key: string]: string | number | boolean | Function}
27
28
  id?: string
28
29
  inputDisplay?: "pills" | "none"
29
30
  inputName?: string
@@ -40,6 +41,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
40
41
  aria = {},
41
42
  className,
42
43
  data = {},
44
+ htmlOptions = {},
43
45
  id,
44
46
  inputDisplay = "pills",
45
47
  inputName,
@@ -53,6 +55,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
53
55
 
54
56
  const ariaProps = buildAriaProps(aria)
55
57
  const dataProps = buildDataProps(data)
58
+ const htmlProps = buildHtmlProps(htmlOptions)
56
59
  const classes = classnames(
57
60
  buildCss("pb_multi_level_select"),
58
61
  globalProps(props),
@@ -418,6 +421,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
418
421
  <div
419
422
  {...ariaProps}
420
423
  {...dataProps}
424
+ {...htmlProps}
421
425
  className={classes}
422
426
  id={id}
423
427
  >
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
7
7
  import { globalProps } from '../utilities/globalProps'
8
8
 
9
9
  import Avatar from '../pb_avatar/_avatar'
@@ -13,6 +13,7 @@ type MultipleUsersProps = {
13
13
  className?: string,
14
14
  dark?: boolean,
15
15
  data?: { [key: string]: string },
16
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
16
17
  id?: string,
17
18
  maxDisplayedUsers?: number,
18
19
  reverse?: boolean,
@@ -26,6 +27,7 @@ const MultipleUsers = (props: MultipleUsersProps): React.ReactElement => {
26
27
  className,
27
28
  dark = false,
28
29
  data = {},
30
+ htmlOptions = {},
29
31
  id,
30
32
  maxDisplayedUsers = 4,
31
33
  reverse = false,
@@ -41,6 +43,7 @@ const MultipleUsers = (props: MultipleUsersProps): React.ReactElement => {
41
43
  const avatarSizeClass = size === 'xxs' ? 'xxs' : 'xs'
42
44
  const ariaProps = buildAriaProps(aria)
43
45
  const dataProps = buildDataProps(data)
46
+ const htmlProps = buildHtmlProps(htmlOptions)
44
47
  const classes = classnames(
45
48
  buildCss('pb_multiple_users_kit', reverseClass),
46
49
  globalProps(props),
@@ -56,6 +59,7 @@ const MultipleUsers = (props: MultipleUsersProps): React.ReactElement => {
56
59
  <div
57
60
  {...ariaProps}
58
61
  {...dataProps}
62
+ {...htmlProps}
59
63
  className={classes}
60
64
  id={id}
61
65
  >
@@ -0,0 +1,11 @@
1
+ ![mulitple-users-default](https://github.com/powerhome/playbook/assets/92755007/73dffd55-14f7-468e-b6ea-4e700980183d)
2
+
3
+ ```swift
4
+
5
+ let twoUsers = [andrew, picAndrew]
6
+
7
+ PBDoc(title: "xSmall") {
8
+ PBMultipleUsers(users: twoUsers, size: .xSmall)
9
+ }
10
+
11
+ ```
@@ -0,0 +1,7 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **Users** | `[PBUser]` | Sets the user's avatars | | |
5
+ | **Size** | `AvatarSize` | Changes the size of the avatars | `.small` | `.xSmall` `.small` |
6
+ | **Reversed** | `Bool` | Changes the order of the avatars | `false` | `true` `false` |
7
+ | **Max Displayed Users** | `Int` | Limits the number of avatars displayed | `4` | |
@@ -0,0 +1,13 @@
1
+ ![multiple-users-reverse](https://github.com/powerhome/playbook/assets/92755007/be3f6f7d-f699-40f2-bbb6-8a99144a8744)
2
+
3
+ ```swift
4
+
5
+ let multipleUsers = [andrew, picAndrew, andrew, andrew]
6
+ let twoUsers = [andrew, picAndrew]
7
+
8
+ VStack(alignment: .leading, spacing: Spacing.small) {
9
+ PBMultipleUsers(users: multipleUsers, size: .small, reversed: true)
10
+ PBMultipleUsers(users: twoUsers, size: .small, reversed: true)
11
+ }
12
+
13
+ ```
@@ -0,0 +1,11 @@
1
+ ![mulitple-users-size](https://github.com/powerhome/playbook/assets/92755007/5c15b862-fb32-4e0a-a826-bc25b1db555e)
2
+
3
+ ```swift
4
+
5
+ let multipleUsers = [andrew, picAndrew, andrew, andrew]
6
+
7
+ PBDoc(title: "Small") {
8
+ PBMultipleUsers(users: multipleUsers, size: .small)
9
+ }
10
+
11
+ ```
@@ -10,3 +10,9 @@ examples:
10
10
  - multiple_users_default: Default
11
11
  - multiple_users_reverse: Reverse
12
12
  - multiple_users_size: Size
13
+
14
+ swift:
15
+ - multiple_users_default_swift: Default
16
+ - multiple_users_reverse_swift: Reverse
17
+ - multiple_users_size_swift: Small
18
+ - multiple_users_props_swift: ""
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { globalProps } from '../utilities/globalProps'
5
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
6
6
 
7
7
  import Avatar from '../pb_avatar/_avatar'
8
8
  import Badge from '../pb_badge/_badge'
@@ -12,6 +12,7 @@ type MultipleUsersStackedProps = {
12
12
  className?: string,
13
13
  dark?: boolean,
14
14
  data?: { [key: string]: string },
15
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
15
16
  id?: string,
16
17
  users: Array<{ [key: string]: string }>,
17
18
  }
@@ -22,6 +23,7 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
22
23
  className,
23
24
  dark = false,
24
25
  data = {},
26
+ htmlOptions = {},
25
27
  id,
26
28
  users,
27
29
  } = props
@@ -33,6 +35,7 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
33
35
  }
34
36
  const ariaProps = buildAriaProps(aria)
35
37
  const dataProps = buildDataProps(data)
38
+ const htmlProps = buildHtmlProps(htmlOptions)
36
39
  const classes = classnames(buildCss(
37
40
  'pb_multiple_users_stacked_kit',
38
41
  { single: onlyOne }), globalProps(props), className)
@@ -85,6 +88,7 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
85
88
  <div
86
89
  {...ariaProps}
87
90
  {...dataProps}
91
+ {...htmlProps}
88
92
  className={classes}
89
93
  id={id}
90
94
  >
@@ -0,0 +1,15 @@
1
+ ![mulitple-users-stacked-default](https://github.com/powerhome/playbook/assets/92755007/180e1275-3eb6-4b28-b1ef-bdde45ab3c2e)
2
+
3
+ ```swift
4
+
5
+ let oneUser = [andrew]
6
+ let twoUsers = [andrew, picAndrew]
7
+ let multipleUsers = [andrew, picAndrew, andrew, andrew]
8
+
9
+ HStack(spacing: Spacing.xSmall) {
10
+ PBMultipleUsersStacked(users: oneUser, size: .default)
11
+ PBMultipleUsersStacked(users: twoUsers, size: .default)
12
+ PBMultipleUsersStacked(users: multipleUsers, size: .default)
13
+ }
14
+
15
+ ```
@@ -0,0 +1,5 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **Users** | `[PBUser]` | Sets the user's avatars | | |
5
+ | **Size** | `Size` | Changes the size of the avatars | `.small` | `.default` `.small` `.xSmall` |