playbook_ui 13.15.0.pre.alpha.PLAY11311893 → 13.15.0.pre.alpha.play1141iconkitusinglibrary1956

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +40 -33
  3. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +4 -4
  4. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +44 -30
  5. data/app/pb_kits/playbook/pb_flex/_flex.tsx +4 -4
  6. data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +3 -2
  7. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +7 -4
  8. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +10 -10
  9. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +10 -9
  10. data/app/pb_kits/playbook/pb_icon/_icon.tsx +21 -5
  11. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +3 -2
  12. data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +3 -2
  13. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +51 -50
  14. data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +20 -19
  15. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +4 -3
  16. data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -4
  17. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +20 -20
  18. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +4 -4
  19. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorButton.tsx +19 -17
  20. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorTypes.ts +1 -1
  21. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +23 -21
  22. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +18 -10
  23. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +46 -23
  24. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarHistory.tsx +8 -8
  25. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarNodes.tsx +7 -7
  26. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +17 -15
  27. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +9 -7
  28. data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +25 -24
  29. data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +27 -26
  30. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +2 -1
  31. data/app/pb_kits/playbook/pb_source/_source.tsx +15 -15
  32. data/dist/playbook-rails.js +4 -4
  33. data/lib/playbook/version.rb +1 -1
  34. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18291ca0456980f9a06e2b9c3a910f801022cdf274409cb2cab0934aa8be8776
4
- data.tar.gz: 2f0d3114f36aadb7baf289ff5409a338128892a719a3fa5181e1ad4930c9df1a
3
+ metadata.gz: 68f62d23e4cbda324af481e7101e9663b86138dd86b3458639240af7e78256f7
4
+ data.tar.gz: 7b6dd2d5c7f139208d3c3e1d0c4cdc2c6e264c84d7119d6ceb414baede5453bf
5
5
  SHA512:
6
- metadata.gz: 122b812d9296134396d95761119769934f705cc2ccff6c4fbaddfdda3b62b2b9b1dc4dda5961113c4cfa9c2e388c1ed63b0973d7c55fc8383ea021693d9c0ea0
7
- data.tar.gz: 0f2977528ef40e2169bdb398a5e47aa9d3afafb0356eb8543dec4bbed9d8f8e038985bfe749835da77ff3db799ffaa2a0047496ac1a7c3a05855394e8cab1e36
6
+ metadata.gz: 383d35c678e65accee31851e57bc179d471887e68af41bbd28a46d13e951a1248a0d1d02dc97ae96628b13ea732a06b022f52943c37a28c9078dfe50036103f2
7
+ data.tar.gz: 00d53a7eca9ad1c5d6ad97379083aa12d0e6cdd5ddf6e4ba3983c2b2fda472e1d9e991d39b63f2fa7c80ac38c4ba74b6d2544b37cd1318287420bb715735bb81
@@ -32,6 +32,10 @@ type DatePickerConfig = {
32
32
  } & Pick<BaseOptions, "allowInput" | "defaultDate" | "enableTime" | "maxDate" | "minDate" | "mode" | "plugins" | "position" | "positionElement" >
33
33
 
34
34
  const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HTMLElement) => {
35
+ const noop = () => {
36
+ // intentionally left empty as a no-op placeholder
37
+ }
38
+
35
39
  const {
36
40
  allowInput,
37
41
  closeOnSelect = true,
@@ -45,8 +49,8 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
45
49
  maxDate,
46
50
  minDate,
47
51
  mode,
48
- onChange = () => {},
49
- onClose = () => {},
52
+ onChange = noop,
53
+ onClose = noop,
50
54
  pickerId,
51
55
  plugins,
52
56
  position = "auto",
@@ -72,20 +76,11 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
72
76
  return defaultDate
73
77
  }
74
78
  }
75
- const disabledParser = () => {
76
- const disabledArray=[]
77
-
78
- disableDate && disableDate.length > 0 && disabledArray.push(...disableDate)
79
- disableRange && disableRange.length > 0 && disabledArray.push(...disableRange)
80
- disableWeekdays && disableWeekdays.length > 0 && disabledArray.push(...disabledWeekDays())
81
-
82
- return disabledArray
83
- }
84
79
 
85
80
  const disabledWeekDays = () => {
86
81
  return (
87
82
  [
88
- (date:any) => {
83
+ (date: any) => {
89
84
  const weekdayObj: {
90
85
  [day: string]: number
91
86
  } = {
@@ -110,6 +105,16 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
110
105
  ]
111
106
  )
112
107
  }
108
+
109
+ const disabledParser = () => {
110
+ const disabledArray=[]
111
+
112
+ disableDate && disableDate.length > 0 && disabledArray.push(...disableDate)
113
+ disableRange && disableRange.length > 0 && disabledArray.push(...disableRange)
114
+ disableWeekdays && disableWeekdays.length > 0 && disabledArray.push(...disabledWeekDays())
115
+
116
+ return disabledArray
117
+ }
113
118
  const calendarResizer = () => {
114
119
  const cal = document.querySelector(`#cal-${pickerId}.open`) as HTMLElement
115
120
  const parentInput = cal.parentElement
@@ -125,28 +130,46 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
125
130
 
126
131
  const setPlugins = (thisRangesEndToday: boolean, customQuickPickDates: any) => {
127
132
  const pluginList = []
128
-
133
+
129
134
  // month and week selection
130
135
  if (selectionType === "month" || plugins.length > 0) {
131
136
  pluginList.push(monthSelectPlugin({ shorthand: true, dateFormat: 'F Y', altFormat: 'F Y' }))
132
137
  } else if ( selectionType === "week") {
133
138
  pluginList.push(weekSelect())
134
-
139
+
135
140
  } else if (selectionType === "quickpick") {
136
141
  //------- QUICKPICK VARIANT PLUGIN -------------//
137
142
  pluginList.push(quickPickPlugin(thisRangesEndToday, customQuickPickDates))
138
143
  }
139
-
144
+
140
145
  // time selection
141
146
  if (enableTime) pluginList.push(timeSelectPlugin({ caption: timeCaption, showTimezone: showTimezone}))
142
-
147
+
143
148
  return pluginList
144
149
  }
145
-
150
+
146
151
  const getDateFormat = () => {
147
152
  return enableTime ? `${format} ${timeFormat}` : format
148
153
  }
149
154
 
155
+ // Attach / detach to / from scroll events
156
+ const initialPicker = document.querySelector<HTMLElement & { [x: string]: any }>(`#${pickerId}`)._flatpickr
157
+ const scrollEvent = () => {
158
+ initialPicker._positionCalendar()
159
+ }
160
+ function attachToScroll(scrollParent: string | HTMLElement) {
161
+ document.querySelectorAll(scrollParent as string)[0]?.addEventListener("scroll", scrollEvent, { passive: true })
162
+ }
163
+ function detachFromScroll(scrollParent: string | HTMLElement = document.body) {
164
+ document.querySelectorAll(scrollParent as string)[0]?.removeEventListener("scroll", scrollEvent)
165
+ }
166
+
167
+ // two way binding
168
+ const initialDropdown = document.querySelector<HTMLElement & { [x: string]: any }>(`#year-${pickerId}`)
169
+ const yearChangeHook = () => {
170
+ initialDropdown.value = initialPicker.currentYear
171
+ }
172
+
150
173
  // ===========================================================
151
174
  // | Flatpickr initializer w/ config |
152
175
  // ===========================================================
@@ -193,17 +216,6 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
193
216
  const picker = document.querySelector<HTMLElement & { [x: string]: any }>(`#${pickerId}`)._flatpickr
194
217
  picker.innerContainer.parentElement.id = `cal-${pickerId}`
195
218
 
196
- // Attach / detach to / from scroll events
197
- const scrollEvent = () => {
198
- picker._positionCalendar()
199
- }
200
- function attachToScroll(scrollParent: string | HTMLElement) {
201
- document.querySelectorAll(scrollParent as string)[0]?.addEventListener("scroll", scrollEvent, { passive: true })
202
- }
203
- function detachFromScroll(scrollParent: string | HTMLElement = document.body) {
204
- document.querySelectorAll(scrollParent as string)[0]?.removeEventListener("scroll", scrollEvent)
205
- }
206
-
207
219
  // replace year selector with dropdown
208
220
  picker.yearElements[0].parentElement.innerHTML = `<select class="numInput cur-year" type="number" tabIndex="-1" aria-label="Year" id="year-${pickerId}"></select>`
209
221
 
@@ -242,11 +254,6 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
242
254
  })
243
255
  }
244
256
 
245
- // two way binding
246
- const yearChangeHook = () => {
247
- dropdown.value = picker.currentYear
248
- }
249
-
250
257
  // Adding dropdown icons to year and month selects
251
258
  dropdown.insertAdjacentHTML('afterend', '<i class="far fa-angle-down year-dropdown-icon" id="test-id"></i>')
252
259
  if (picker.monthElements[0].parentElement) {
@@ -53,8 +53,8 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
53
53
 
54
54
  const calculateDateRange = (timePeriod: string, amount: number): Date[] => {
55
55
  const endDate = new Date();
56
- let startDate = new Date();
57
-
56
+ const startDate = new Date();
57
+
58
58
  switch (timePeriod) {
59
59
  case 'days':
60
60
  startDate.setDate(endDate.getDate() - amount);
@@ -76,7 +76,7 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
76
76
  }
77
77
  return [startDate, endDate];
78
78
  };
79
-
79
+
80
80
 
81
81
  type rangesType = {
82
82
  [key: string]: Date[]
@@ -95,7 +95,7 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
95
95
  'Last year': [lastYearStartDate, lastYearEndDate]
96
96
  };
97
97
 
98
-
98
+
99
99
  if (customQuickPickDates && Object.keys(customQuickPickDates).length !== 0) {
100
100
  if (customQuickPickDates.dates.length && customQuickPickDates.override === false) {
101
101
  customQuickPickDates.dates.forEach((item) => {
@@ -2,7 +2,8 @@ import React, { useEffect, useState } from "react";
2
2
  import classnames from "classnames";
3
3
 
4
4
  import { globalProps } from "../utilities/globalProps";
5
- import { buildHtmlProps } from '../utilities/props'
5
+ import { buildHtmlProps } from "../utilities/props";
6
+ import { VoidCallback } from "../types";
6
7
 
7
8
  import Icon from "../pb_icon/_icon";
8
9
  import Title from "../pb_title/_title";
@@ -15,23 +16,23 @@ const iconMap = {
15
16
  };
16
17
 
17
18
  type FixedConfirmationToastProps = {
18
- autoClose?: number,
19
- children?: React.ReactChild[] | React.ReactChild,
20
- className?: string,
21
- closeable?: boolean,
22
- data?: string,
23
- horizontal?: "right" | "left" | "center",
24
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
25
- id?: string,
26
- multiLine?: boolean,
27
- onClose?: () => void,
28
- open?: boolean,
29
- status?: "success" | "error" | "neutral" | "tip",
30
- text?: string,
31
- vertical?: "top" | "bottom",
32
- }
19
+ autoClose?: number;
20
+ children?: React.ReactChild[] | React.ReactChild;
21
+ className?: string;
22
+ closeable?: boolean;
23
+ data?: string;
24
+ horizontal?: "right" | "left" | "center";
25
+ htmlOptions?: { [key: string]: string | number | boolean | (VoidCallback) };
26
+ id?: string;
27
+ multiLine?: boolean;
28
+ onClose?: VoidCallback;
29
+ open?: boolean;
30
+ status?: "success" | "error" | "neutral" | "tip";
31
+ text?: string;
32
+ vertical?: "top" | "bottom";
33
+ };
33
34
 
34
- const FixedConfirmationToast = (props: FixedConfirmationToastProps) => {
35
+ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.ReactElement => {
35
36
  const [showToast, toggleToast] = useState(true);
36
37
  const {
37
38
  autoClose = 0,
@@ -41,7 +42,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps) => {
41
42
  horizontal,
42
43
  htmlOptions = {},
43
44
  multiLine = false,
44
- onClose = () => { },
45
+ onClose = () => undefined,
45
46
  open = true,
46
47
  status = "neutral",
47
48
  text,
@@ -65,7 +66,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps) => {
65
66
  onClose();
66
67
  }, autoClose);
67
68
  }
68
- }
69
+ };
69
70
 
70
71
  useEffect(() => {
71
72
  toggleToast(open);
@@ -80,22 +81,35 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps) => {
80
81
  return (
81
82
  <>
82
83
  {showToast && (
83
- <div className={css} onClick={handleClick} {...htmlProps}>
84
- {icon && <Icon className="pb_icon" fixedWidth icon={icon} />}
84
+ <div
85
+ className={css}
86
+ onClick={handleClick}
87
+ {...htmlProps}
88
+ >
89
+ {icon && (
90
+ <Icon
91
+ className="pb_icon"
92
+ fixedWidth
93
+ icon={icon}
94
+ />
95
+ )}
85
96
 
86
- {
87
- children && children ||
88
- text && (
97
+ {(children && children) ||
98
+ (text && (
89
99
  <Title
90
- className="pb_fixed_confirmation_toast_text"
91
- size={4}
92
- text={text}
100
+ className="pb_fixed_confirmation_toast_text"
101
+ size={4}
102
+ text={text}
93
103
  />
94
- )
95
- }
104
+ ))}
96
105
 
97
106
  {closeable && (
98
- <Icon className="pb_icon" cursor="pointer" fixedWidth={false} icon="times" />
107
+ <Icon
108
+ className="pb_icon"
109
+ cursor="pointer"
110
+ fixedWidth={false}
111
+ icon="times"
112
+ />
99
113
  )}
100
114
  </div>
101
115
  )}
@@ -2,12 +2,12 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { GlobalProps, globalProps } from '../utilities/globalProps'
5
- import { Sizes } from '../types'
5
+ import { GenericObject, Sizes } from '../types'
6
6
 
7
7
  type FlexProps = {
8
8
  children: React.ReactChild[] | React.ReactNode,
9
9
  className?: string,
10
- data?: object,
10
+ data?: GenericObject,
11
11
  horizontal?: "left" | "center" | "right" | "stretch" | "none",
12
12
  justify?: "start" | "center" | "end" | "around" | "between" | "evenly" | "none",
13
13
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
@@ -25,7 +25,7 @@ type FlexProps = {
25
25
  alignSelf?: "start" | "end" | "center" | "stretch" | "none"
26
26
  } & GlobalProps
27
27
 
28
- const Flex = (props: FlexProps) => {
28
+ const Flex = (props: FlexProps): React.ReactElement => {
29
29
  const {
30
30
  align = 'none',
31
31
  children,
@@ -45,7 +45,7 @@ const Flex = (props: FlexProps) => {
45
45
  wrap = false,
46
46
  alignSelf = 'none',
47
47
  } = props
48
-
48
+
49
49
  const orientationClass =
50
50
  orientation !== undefined ? `orientation_${orientation}` : ''
51
51
  const justifyClass =
@@ -2,18 +2,19 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { globalProps } from '../utilities/globalProps'
5
+ import { GenericObject } from '../types'
5
6
 
6
7
  type FormGroupProps = {
7
8
  aria?: {[key: string]: string},
8
9
  children?: Node,
9
10
  className?: string,
10
- data?: object,
11
+ data?: GenericObject,
11
12
  fullWidth?: boolean,
12
13
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
13
14
  id?: string,
14
15
  }
15
16
 
16
- const FormGroup = (props: FormGroupProps) => {
17
+ const FormGroup = (props: FormGroupProps): React.ReactElement => {
17
18
  const {
18
19
  aria = {},
19
20
  className,
@@ -22,16 +22,16 @@ type FormPillProps = {
22
22
  onClick?: React.MouseEventHandler<HTMLSpanElement>,
23
23
  onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
24
24
  onTouchEnd?: React.TouchEventHandler<HTMLSpanElement>,
25
- },
25
+ },
26
26
  } & GlobalProps
27
- const FormPill = (props: FormPillProps) => {
27
+ const FormPill = (props: FormPillProps): React.ReactElement => {
28
28
  const {
29
29
  className,
30
30
  htmlOptions = {},
31
31
  id,
32
32
  text,
33
33
  name,
34
- onClick = () => {},
34
+ onClick = () => undefined,
35
35
  avatarUrl,
36
36
  closeProps = {},
37
37
  size = '',
@@ -48,7 +48,10 @@ const FormPill = (props: FormPillProps) => {
48
48
  const htmlProps = buildHtmlProps(htmlOptions)
49
49
 
50
50
  return (
51
- <div className={css} id={id} {...htmlProps}>
51
+ <div className={css}
52
+ id={id}
53
+ {...htmlProps}
54
+ >
52
55
  {name &&
53
56
  <>
54
57
  <Avatar
@@ -12,12 +12,13 @@ import typography from "../tokens/exports/_typography.scss";
12
12
 
13
13
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
14
14
  import { globalProps } from "../utilities/globalProps";
15
+ import { GenericObject } from "../types";
15
16
 
16
17
  type GaugeProps = {
17
18
  aria: { [key: string]: string };
18
19
  className?: string;
19
20
  chartData?: { name: string; value: number[] | number }[];
20
- dark?: Boolean;
21
+ dark?: boolean;
21
22
  data?: { [key: string]: string };
22
23
  disableAnimation?: boolean;
23
24
  fullCircle?: boolean;
@@ -33,13 +34,12 @@ type GaugeProps = {
33
34
  title?: string;
34
35
  tooltipHtml?: string;
35
36
  colors: string[];
36
- minorTickInterval: any;
37
+ minorTickInterval?: number;
37
38
  circumference: number[];
38
39
  };
39
40
 
40
41
  const Gauge = ({
41
42
  aria = {},
42
- className,
43
43
  chartData,
44
44
  dark = false,
45
45
  data = {},
@@ -61,9 +61,9 @@ const Gauge = ({
61
61
  minorTickInterval = null,
62
62
  circumference = fullCircle ? [0, 360] : [-100, 100],
63
63
  ...props
64
- }: GaugeProps) => {
64
+ }: GaugeProps): React.ReactElement => {
65
65
  const ariaProps = buildAriaProps(aria);
66
- const dataProps = buildDataProps(data)
66
+ const dataProps = buildDataProps(data)
67
67
  const htmlProps = buildHtmlProps(htmlOptions);
68
68
  highchartsMore(Highcharts);
69
69
  solidGauge(Highcharts);
@@ -89,7 +89,7 @@ const Gauge = ({
89
89
  const [options, setOptions] = useState({});
90
90
 
91
91
  useEffect(() => {
92
- const formattedChartData = chartData.map((obj: any) => {
92
+ const formattedChartData = chartData.map((obj: GenericObject) => {
93
93
  obj.y = obj.value;
94
94
  delete obj.value;
95
95
  return obj;
@@ -185,20 +185,20 @@ const Gauge = ({
185
185
  .querySelectorAll(".fix")
186
186
  .forEach((fix) => fix.setAttribute("y", "38"));
187
187
  }
188
-
188
+ // eslint-disable-next-line react-hooks/exhaustive-deps
189
189
  }, [chartData]);
190
190
 
191
191
  return (
192
192
  <HighchartsReact
193
- containerProps={{
193
+ containerProps={{
194
194
  className: classnames(css, globalProps(props)),
195
195
  id: id,
196
196
  ...ariaProps,
197
197
  ...dataProps,
198
198
  ...htmlProps,
199
199
  }}
200
- highcharts={Highcharts}
201
- options={options}
200
+ highcharts={Highcharts}
201
+ options={options}
202
202
  />
203
203
  );
204
204
  };
@@ -8,6 +8,7 @@ import Body from '../pb_body/_body'
8
8
  import Hashtag from '../pb_hashtag/_hashtag'
9
9
  import Title from '../pb_title/_title'
10
10
  import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
11
+ import { GenericObject } from '../types'
11
12
 
12
13
  type HomeAddressStreetProps = {
13
14
  aria?: { [key: string]: string },
@@ -28,7 +29,7 @@ type HomeAddressStreetProps = {
28
29
  territory: string,
29
30
  }
30
31
 
31
- const HomeAddressStreet = (props: HomeAddressStreetProps) => {
32
+ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement => {
32
33
  const {
33
34
  address,
34
35
  addressCont,
@@ -58,17 +59,17 @@ const HomeAddressStreet = (props: HomeAddressStreetProps) => {
58
59
  className
59
60
  )
60
61
 
61
- const dataProps: { [key: string]: any } = buildDataProps(data)
62
- const ariaProps: { [key: string]: any } = buildAriaProps(aria)
62
+ const dataProps: GenericObject = buildDataProps(data)
63
+ const ariaProps: GenericObject = buildAriaProps(aria)
63
64
  const htmlProps = buildHtmlProps(htmlOptions)
64
65
  return (
65
- <div
66
- className={classes(className, dark)}
67
- {...ariaProps}
68
- {...dataProps}
69
- {...htmlProps}
66
+ <div
67
+ className={classes(className, dark)}
68
+ {...ariaProps}
69
+ {...dataProps}
70
+ {...htmlProps}
70
71
  >
71
- {emphasis == 'street' &&
72
+ {emphasis == 'street' &&
72
73
  <div>
73
74
  <Title
74
75
  className="pb_home_address_street_address"
@@ -27,7 +27,7 @@ type IconProps = {
27
27
  data?: {[key: string]: string},
28
28
  fixedWidth?: boolean,
29
29
  flip?: "horizontal" | "vertical" | "both" | "none",
30
- icon: string,
30
+ icon: any,
31
31
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
32
32
  id?: string,
33
33
  inverse?: boolean,
@@ -57,7 +57,7 @@ const Icon = (props: IconProps) => {
57
57
  fixedWidth = true,
58
58
  flip = "none",
59
59
  htmlOptions = {},
60
- icon,
60
+ icon = "",
61
61
  id,
62
62
  inverse = false,
63
63
  listItem = false,
@@ -82,12 +82,15 @@ const Icon = (props: IconProps) => {
82
82
 
83
83
  }
84
84
 
85
+ const iconString = typeof icon === 'string'
86
+ const IconFunction = icon
87
+
85
88
  // Lets check and see if the icon prop is referring to a custom Power icon...
86
89
  // If so, then set fa-icon to "custom"
87
90
  // this ensures the JS will not do any further operations
88
91
  // faClasses[`fa-${icon}`] = customIcon ? 'custom' : icon
89
- if (!customIcon) faClasses[`fa-${icon}`] = icon
90
-
92
+ if (!customIcon && iconString) faClasses[`fa-${icon}`] = icon
93
+
91
94
  const classes = classnames(
92
95
  flipMap[flip],
93
96
  'pb_icon_kit',
@@ -123,6 +126,19 @@ const Icon = (props: IconProps) => {
123
126
  }
124
127
  </>
125
128
  )
129
+ else if (!iconString)
130
+ return (
131
+ <>
132
+ <span
133
+ {...dataProps}
134
+ {...htmlProps}
135
+ className="pbiconhere"
136
+ id={id}
137
+ >
138
+ <IconFunction />
139
+ </span>
140
+ </>
141
+ )
126
142
  else if (isValidEmoji(icon))
127
143
  return (
128
144
  <>
@@ -161,4 +177,4 @@ const Icon = (props: IconProps) => {
161
177
  )
162
178
  }
163
179
 
164
- export default Icon
180
+ export default Icon
@@ -9,11 +9,12 @@ import Caption from '../pb_caption/_caption'
9
9
  import Flex from '../pb_flex/_flex'
10
10
  import IconCircle from '../pb_icon_circle/_icon_circle'
11
11
  import Title from '../pb_title/_title'
12
+ import { GenericObject } from '../types'
12
13
 
13
14
  type IconStatValueProps = {
14
15
  aria?: { [key: string]: string },
15
16
  className?: string,
16
- data?: object,
17
+ data?: GenericObject,
17
18
  dark?: boolean,
18
19
  icon: string,
19
20
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
@@ -34,7 +35,7 @@ type IconStatValueProps = {
34
35
  | "green",
35
36
  }
36
37
 
37
- const IconStatValue = (props: IconStatValueProps) => {
38
+ const IconStatValue = (props: IconStatValueProps): React.ReactElement => {
38
39
  const {
39
40
  aria = {},
40
41
  className,
@@ -6,20 +6,21 @@ import { globalProps } from '../utilities/globalProps'
6
6
 
7
7
  import Body from '../pb_body/_body'
8
8
  import Icon from '../pb_icon/_icon'
9
+ import { GenericObject } from '../types'
9
10
 
10
11
  type IconValueProps = {
11
12
  align?: "left" | "center" | "right",
12
13
  aria?: { [key: string]: string; },
13
14
  className?: string,
14
15
  dark?: boolean,
15
- data?: object,
16
+ data?: GenericObject,
16
17
  icon: string,
17
18
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
18
19
  id?: string,
19
20
  text: string,
20
21
  }
21
22
 
22
- const IconValue = (props: IconValueProps) => {
23
+ const IconValue = (props: IconValueProps): React.ReactElement => {
23
24
  const {
24
25
  align = 'left',
25
26
  aria = {},