playbook_ui 13.16.0.pre.alpha.PLAY11642006 → 13.16.0.pre.alpha.nodejsupgrade2036

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_reset.scss +2 -2
  3. data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +2 -2
  4. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_flatpickr_styles.scss +1 -1
  5. data/app/pb_kits/playbook/pb_icon/_icon.tsx +17 -29
  6. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.html.erb +11 -5
  7. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.jsx +18 -44
  8. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.md +12 -7
  9. data/app/pb_kits/playbook/pb_icon/icon.html.erb +4 -6
  10. data/app/pb_kits/playbook/pb_icon/icon.rb +10 -10
  11. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +1 -1
  12. data/app/pb_kits/playbook/pb_layout/_layout.tsx +2 -1
  13. data/app/pb_kits/playbook/pb_layout/layout.test.js +8 -4
  14. data/app/pb_kits/playbook/pb_legend/_legend.tsx +6 -6
  15. data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +4 -4
  16. data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnail.tsx +1 -1
  17. data/app/pb_kits/playbook/pb_lightbox/Carousel/index.tsx +3 -3
  18. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +30 -22
  19. data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +5 -5
  20. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +4 -4
  21. data/app/pb_kits/playbook/pb_list/_list.tsx +15 -15
  22. data/app/pb_kits/playbook/pb_list/_list_item.tsx +1 -1
  23. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +9 -9
  24. data/app/pb_kits/playbook/pb_map/_map.tsx +8 -8
  25. data/app/pb_kits/playbook/pb_map/_map_controls.tsx +15 -7
  26. data/app/pb_kits/playbook/pb_map/_map_custom_button.tsx +4 -2
  27. data/app/pb_kits/playbook/pb_message/_message.tsx +1 -1
  28. data/app/pb_kits/playbook/pb_message/_message_mention.tsx +6 -6
  29. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +46 -42
  30. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +20 -20
  31. data/app/pb_kits/playbook/pb_nav/_item.tsx +56 -47
  32. data/app/pb_kits/playbook/pb_nav/_nav.tsx +15 -15
  33. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +1 -1
  34. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -2
  35. data/dist/playbook-rails.js +14 -6
  36. data/dist/reset.css +1 -2
  37. data/lib/playbook/version.rb +1 -1
  38. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: becba3d632ca153d413d36656e837e7bd1fcba2f357027f264888a4a4dea26ef
4
- data.tar.gz: 1bd3f93f4bde74704c72fb10e81db5cd9a1495754decd07a8059a76f8f6f3a5f
3
+ metadata.gz: f937c16ec89f7321ee4dd0cee5ea44d006a51dffd38c7c51c779a47bc2b82a48
4
+ data.tar.gz: 2894e6b6bfee6d6cd9df09dd175dfb6a224ee16fa92968a4fef9b3198f9e76ee
5
5
  SHA512:
6
- metadata.gz: 9162fdd9881beb55aa2d67617008f990398cdb47619ba0b0493495993142ebf401e707105c7dc041cd1cdeff088a7a7c0c69a9d122cbf6fa2535c9a3577b60aa
7
- data.tar.gz: cb78ba7dae05f19fa60d591ef1141edda4b20eee5b78f48d771c74be287d42d8f8668578dbabccae0c9654069f109467d7f31abcace58653ee84e6b2b5adcf9b
6
+ metadata.gz: f6986c123c083160f78a96ca26d1cd503b2666495faef6db4ede8b53238437ee0d8b80f4054506644d78971ab454c41cc87d49bf3d3918e52cb5290a81bc6947
7
+ data.tar.gz: 2a273bcd342ae5bdb733b65cf4c087a46550009e50e96e52d382ba3e3c71a78b8928e8ba35e937ade8ccdead815fa9b53eacbbd60a8d977fd45695639559cc33
@@ -1,5 +1,5 @@
1
- @import "./tokens/typography";
2
- @import "./tokens/colors";
1
+ @import "tokens/typography";
2
+ @import "tokens/colors";
3
3
 
4
4
  * {
5
5
  box-sizing: border-box;
@@ -1,5 +1,5 @@
1
- @import "./tokens/colors";
2
- @import "./tokens/spacing";
1
+ @import "tokens/colors";
2
+ @import "tokens/spacing";
3
3
 
4
4
  [class^=pb_collapsible_kit] {
5
5
  padding: $space_md;
@@ -1,5 +1,5 @@
1
1
  // Manual Import -- Flatpickr Styles
2
- @import "./tokens/typography";
2
+ @import "tokens/typography";
3
3
 
4
4
  .flatpickr-calendar {
5
5
  background: transparent;
@@ -1,4 +1,4 @@
1
- import React, { ReactSVGElement } from 'react'
1
+ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { GlobalProps, globalProps } from '../utilities/globalProps'
@@ -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 | ReactSVGElement,
30
+ icon: string,
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,
@@ -69,12 +69,9 @@ const Icon = (props: IconProps) => {
69
69
  spin = false,
70
70
  } = props
71
71
 
72
- const iconURL = typeof(icon) === 'string' && icon.includes('.svg') ? icon : null
73
- const iconElement: ReactSVGElement | null = typeof(icon) === "object" ? icon : null
74
-
75
72
  const faClasses = {
76
73
  'fa-border': border,
77
- 'fa-fw': (iconElement) ? false : fixedWidth,
74
+ 'fa-fw': fixedWidth,
78
75
  'fa-inverse': inverse,
79
76
  'fa-li': listItem,
80
77
  'fa-pulse': pulse,
@@ -82,16 +79,19 @@ const Icon = (props: IconProps) => {
82
79
  [`fa-${size}`]: size,
83
80
  [`fa-pull-${pull}`]: pull,
84
81
  [`fa-rotate-${rotation}`]: rotation,
85
- }
86
82
 
87
- const isFA = !iconElement && !customIcon && !iconURL
88
-
89
- if (isFA) faClasses[`fa-${icon}`] = icon as string
83
+ }
90
84
 
85
+ // Lets check and see if the icon prop is referring to a custom Power icon...
86
+ // If so, then set fa-icon to "custom"
87
+ // this ensures the JS will not do any further operations
88
+ // faClasses[`fa-${icon}`] = customIcon ? 'custom' : icon
89
+ if (!customIcon) faClasses[`fa-${icon}`] = icon
90
+
91
91
  const classes = classnames(
92
92
  flipMap[flip],
93
93
  'pb_icon_kit',
94
- (iconElement || customIcon) ? '' : fontStyle,
94
+ customIcon ? '' : fontStyle,
95
95
  faClasses,
96
96
  globalProps(props),
97
97
  className
@@ -110,11 +110,11 @@ const Icon = (props: IconProps) => {
110
110
 
111
111
  // Add a conditional here to show only the SVG if custom
112
112
  const displaySVG = (customIcon: any) => {
113
- if (iconElement || customIcon)
113
+ if (customIcon)
114
114
  return (
115
115
  <>
116
116
  {
117
- React.cloneElement(iconElement || customIcon, {
117
+ React.cloneElement(customIcon, {
118
118
  ...dataProps,
119
119
  ...htmlProps,
120
120
  className: classes,
@@ -123,7 +123,7 @@ const Icon = (props: IconProps) => {
123
123
  }
124
124
  </>
125
125
  )
126
- else if (isValidEmoji(icon as string))
126
+ else if (isValidEmoji(icon))
127
127
  return (
128
128
  <>
129
129
  <span
@@ -136,19 +136,7 @@ const Icon = (props: IconProps) => {
136
136
  </span>
137
137
  </>
138
138
  )
139
- else if (iconURL)
140
- return (
141
- <>
142
- <span
143
- {...dataProps}
144
- {...htmlProps}
145
- className={classesEmoji}
146
- id={id}
147
- >
148
- <img src={iconURL} />
149
- </span>
150
- </>
151
- )
139
+
152
140
  else
153
141
  return (
154
142
  <>
@@ -173,4 +161,4 @@ const Icon = (props: IconProps) => {
173
161
  )
174
162
  }
175
163
 
176
- export default Icon
164
+ export default Icon
@@ -2,9 +2,15 @@
2
2
  <div class="icon-wrapper">
3
3
 
4
4
  <% svg_url = "https://upload.wikimedia.org/wikipedia/commons/3/3b/Wrench_font_awesome.svg" %>
5
- <p><%= pb_rails("icon", props: { icon: svg_url } ) %></p>
6
- <p><%= pb_rails("icon", props: { rotation: 90, icon: svg_url, size: "2x" } ) %></p>
7
- <p><%= pb_rails("icon", props: { spin: true, icon: svg_url, size: "3x" } ) %></p>
8
- <p><%= pb_rails("icon", props: { size: "5x", icon: svg_url } ) %></p>
9
- <p><%= pb_rails("icon", props: { flip: "horizontal", size: "5x", icon: svg_url } ) %></p>
5
+ <p><%= pb_rails("icon", props: { custom_icon: svg_url } ) %></p>
6
+ <p><%= pb_rails("icon", props: { rotation: 90, custom_icon: svg_url, size: "2x" } ) %></p>
7
+ <p><%= pb_rails("icon", props: { spin: true, custom_icon: svg_url, size: "3x" } ) %></p>
8
+ <p><%= pb_rails("icon", props: { size: "5x", custom_icon: svg_url } ) %></p>
9
+ <p><%= pb_rails("icon", props: { flip: "horizontal", size: "5x", custom_icon: svg_url } ) %></p>
10
+
11
+ <%= pb_rails("body", props: {
12
+ text: "Custom icons are compatible with other icon props (size, rotation,
13
+ spin, flip, etc). Their SVG fill colors will be inherited from
14
+ parent element's css color properties."
15
+ } ) %>
10
16
  </div>
@@ -1,59 +1,33 @@
1
1
  import React from 'react'
2
2
  import { Icon } from '../../'
3
3
 
4
+ // import Icons as config from 'power-icons'
4
5
  const config = {
5
- icon: (
6
- <svg viewBox="0 -256 1792 1792"
6
+ moon: (
7
+ <svg
8
+ ariaHidden="true"
9
+ focusable="false"
10
+ role="img"
11
+ viewBox="0 0 512 512"
7
12
  xmlns="http://www.w3.org/2000/svg"
8
13
  >
9
- <g transform="matrix(1,0,0,-1,53.152542,1217.0847)">
10
- <path d="m 384,64 q 0,26 -19,45 -19,19 -45,19 -26,0 -45,-19 -19,-19 -19,-45 0,-26 19,-45 19,-19 45,-19 26,0 45,19 19,19 19,45 z m 644,420 -682,-682 q -37,-37 -90,-37 -52,0 -91,37 L 59,-90 Q 21,-54 21,0 21,53 59,91 L 740,772 Q 779,674 854.5,598.5 930,523 1028,484 z m 634,435 q 0,-39 -23,-106 Q 1592,679 1474.5,595.5 1357,512 1216,512 1031,512 899.5,643.5 768,775 768,960 q 0,185 131.5,316.5 131.5,131.5 316.5,131.5 58,0 121.5,-16.5 63.5,-16.5 107.5,-46.5 16,-11 16,-28 0,-17 -16,-28 L 1152,1120 V 896 l 193,-107 q 5,3 79,48.5 74,45.5 135.5,81 61.5,35.5 70.5,35.5 15,0 23.5,-10 8.5,-10 8.5,-25 z" />
11
- </g>
14
+ <path
15
+ d="M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm16 352c0 8.8-7.2 16-16 16H288l-12.8 9.6L208 428v-60H64c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16h384c8.8 0 16 7.2 16 16v288zM336 184h-56v-56c0-8.8-7.2-16-16-16h-16c-8.8 0-16 7.2-16 16v56h-56c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16h56v56c0 8.8 7.2 16 16 16h16c8.8 0 16-7.2 16-16v-56h56c8.8 0 16-7.2 16-16v-16c0-8.8-7.2-16-16-16z"
16
+ fill="currentColor"
17
+ />
12
18
  </svg>
13
19
  ),
14
20
  }
15
21
 
16
22
  const IconCustom = (props) => {
17
23
  return (
18
- <React.Fragment>
19
- <p>
20
- <Icon
21
- icon={config.icon}
22
- {...props}
23
- />
24
- </p>
25
- <p>
26
- <Icon
27
- icon={config.icon}
28
- rotation={90}
29
- size="2x"
30
- {...props}
31
- />
32
- </p>
33
- <p>
34
- <Icon
35
- icon={config.icon}
36
- size="3x"
37
- spin
38
- {...props}
39
- />
40
- </p>
41
- <p>
42
- <Icon
43
- icon={config.icon}
44
- size="5x"
45
- {...props}
46
- />
47
- </p>
48
- <p>
49
- <Icon
50
- flip="horizontal"
51
- icon={config.icon}
52
- size="5x"
53
- {...props}
54
- />
55
- </p>
56
- </React.Fragment>
24
+ <div>
25
+ <Icon
26
+ customIcon={config.moon}
27
+ size="7x"
28
+ {...props}
29
+ />
30
+ </div>
57
31
  )
58
32
  }
59
33
 
@@ -1,14 +1,19 @@
1
1
  # Tips for Custom Icons
2
2
 
3
- ### React
3
+ When using custom icons it is important to introduce a "clean" SVG. In order to ensure these custom icons perform as intended within your kit(s), ensure these things have been modified from the original SVG markup:
4
+
5
+ Attributes must be React compatible e.g. <code>xmlns:xlink</code> should be <code>xmlnsXlink</code> and so on. <strong>There should be no hyphenated attributes and no semi-colons!.</strong>
6
+
7
+ Fill colors with regards to <code>g</code> or <code>path</code> nodes, e.g. <code>fill="black"</code>, should be replaced with <code>currentColor</code> ala <code>fill="currentColor"</code>. Your mileage may vary depending on the complexity of your SVG.
4
8
 
5
- - Providing a valid React `<SVG>` element to the `icon` prop results in an `<SVG>` node within the working view.
6
- - Sending the absolute path to your SVG (e.g. `/my/path/to/icon.svg`) results in an `img` node with the `src` attribute set to the provided path:
9
+ Pay attention to your custom icon's dimensions and `viewBox` attribute. It is best to use a `viewBox="0 0 512 512"` starting point __when designing instead of trying to retrofit the viewbox afterwards__!
10
+
11
+ You must source *your own SVG into component/view* you are working on. This can easily be done in programmatic and maintainable ways.
12
+
13
+ ### React
7
14
 
8
- ```html
9
- <img src="host.com/my/path/to/icon.svg" />
10
- ```
15
+ So long as you have a valid React `<SVG>` node, you can send it as the `customIcon` prop and the kit will take care of the rest.
11
16
 
12
17
  ### Rails
13
18
 
14
- Sending the absolute path to the `icon` prop results in an `<SVG>` tag within the working view.
19
+ Some Rails applications use only webpack(er) which means using `image_url` will be successful over `image_path` in most cases especially development where Webpack Dev Server is serving assets over HTTP. Rails applications still using Asset Pipeline may use `image_path` or `image_url`. Of course, YMMV depending on any custom configurations in your Rails application.
@@ -1,9 +1,7 @@
1
- <% if object.is_svg? %>
2
- <%= object.render_svg %>
3
- <% elsif object.valid_emoji? %>
4
- <span class="pb_icon_kit_emoji">
5
- <%= object.icon.html_safe %>
6
- </span>
1
+ <% if object.custom_icon %>
2
+ <%= object.render_svg(object.custom_icon) %>
3
+ <% elsif object.valid_emoji(object.icon) %>
4
+ <span class="pb_icon_kit_emoji"><%= object.icon.html_safe %></span>
7
5
  <% else %>
8
6
  <%= content_tag(:i, nil,
9
7
  id: object.id,
@@ -38,7 +38,7 @@ module Playbook
38
38
  prop :spin, type: Playbook::Props::Boolean,
39
39
  default: false
40
40
 
41
- def valid_emoji?
41
+ def valid_emoji(icon)
42
42
  emoji_regex = /\p{Emoji}/
43
43
  emoji_regex.match?(icon)
44
44
  end
@@ -79,15 +79,15 @@ module Playbook
79
79
  )
80
80
  end
81
81
 
82
- def render_svg
83
- doc = Nokogiri::XML(URI.open(icon || custom_icon)) # rubocop:disable Security/Open
84
- svg = doc.at_css "svg"
85
- svg["class"] = "pb_custom_icon " + object.custom_icon_classname
86
- raw doc
87
- end
88
-
89
- def is_svg?
90
- (icon || custom_icon.to_s).include?(".svg")
82
+ def render_svg(path)
83
+ if File.extname(path) == ".svg"
84
+ doc = Nokogiri::XML(URI.open(path)) # rubocop:disable Security/Open
85
+ svg = doc.at_css "svg"
86
+ svg["class"] = "pb_custom_icon " + object.custom_icon_classname
87
+ raw doc
88
+ else
89
+ raise("Custom icon must be an svg. Please check your path and file type.")
90
+ end
91
91
  end
92
92
 
93
93
  private
@@ -15,7 +15,7 @@ type LabelValueProps = {
15
15
  aria?: { [key: string]: string };
16
16
  className?: string;
17
17
  dark?: boolean;
18
- data?: object;
18
+ data?: Record<string, unknown>;
19
19
  date?: Date;
20
20
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
21
21
  id?: string;
@@ -10,7 +10,7 @@ type LayoutPropTypes = {
10
10
  className?: string,
11
11
  collapse?: "xs" | "sm" | "md" | "lg" | "xl",
12
12
  dark?: boolean,
13
- data?: object,
13
+ data?: Record<string, unknown>,
14
14
  full?: boolean,
15
15
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
16
16
  position?: "left" | "right",
@@ -168,6 +168,7 @@ const Layout = (props: LayoutPropTypes) => {
168
168
  layoutCss,
169
169
  layoutCollapseCss,
170
170
  className,
171
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
171
172
  //@ts-ignore
172
173
  globalProps(filteredProps)
173
174
  )}
@@ -16,7 +16,8 @@ test("render all color variants", () => {
16
16
  testValues.forEach((variant) => {
17
17
  const { getByTestId } = render(
18
18
  <LayoutTest data={{ testid: `test-${variant}` }}
19
- variant={variant} />
19
+ variant={variant}
20
+ />
20
21
  )
21
22
  expect(getByTestId(`test-${variant}`)).toHaveClass(
22
23
  `pb_layout_kit_sidebar_size_md_left_${
@@ -33,7 +34,8 @@ test("render transparent class", () => {
33
34
 
34
35
  const { getByTestId } = render(
35
36
  <LayoutTest data={{ testid: `test-${id}` }}
36
- variant={id} />
37
+ variant={id}
38
+ />
37
39
  )
38
40
  expect(getByTestId(`test-${id}`)).toHaveClass(
39
41
  `pb_layout_kit_sidebar_size_md_left_${id}`
@@ -47,7 +49,8 @@ test("render all sizes variants", () => {
47
49
  testValues.forEach((size) => {
48
50
  const { getByTestId } = render(
49
51
  <LayoutTest data={{ testid: `test-${size}` }}
50
- size={size} />
52
+ size={size}
53
+ />
51
54
  )
52
55
  expect(getByTestId(`test-${size}`)).toHaveClass(
53
56
  `pb_layout_kit_sidebar_size_${size}_left_light`
@@ -84,7 +87,8 @@ test("render all layout variants", () => {
84
87
  testValues.forEach(({ layout, expected }) => {
85
88
  const { getByTestId } = render(
86
89
  <Layout data={{ testid: `test-${layout}` }}
87
- layout={layout}>
90
+ layout={layout}
91
+ >
88
92
  <Layout.Body>
89
93
  <Card>{"Card content"}</Card>
90
94
  </Layout.Body>
@@ -12,7 +12,7 @@ type LegendProps = {
12
12
  className?: string,
13
13
  color?: string,
14
14
  dark?: boolean,
15
- data?: object,
15
+ data?: Record<string, unknown>,
16
16
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
17
17
  id?: string,
18
18
  prefixText?: string,
@@ -64,11 +64,11 @@ const Legend = (props: LegendProps) => {
64
64
  {
65
65
  prefixText && (
66
66
  <Title
67
- dark={dark}
68
- size={4}
69
- tag="span"
70
- text={` ${prefixText} `}
71
- />
67
+ dark={dark}
68
+ size={4}
69
+ tag="span"
70
+ text={` ${prefixText} `}
71
+ />
72
72
  )
73
73
  }
74
74
  {` ${text} `}
@@ -56,15 +56,15 @@ const arrowRight = () => setIndex(current < urls.length - 1 ? current + 1 : urls
56
56
  return (
57
57
  <div
58
58
  className="Slides"
59
- onTouchStart={onTouchStart}
59
+ onTouchEnd={onTouchEnd}
60
60
  onTouchMove={onTouchMove}
61
- onTouchEnd={onTouchEnd}
61
+ onTouchStart={onTouchStart}
62
62
  >
63
63
  {
64
64
  urls.length > 1 && (
65
65
  <CircleIconButton
66
66
  className='carousel-arrow-left'
67
- dark={true}
67
+ dark
68
68
  icon="chevron-left"
69
69
  onClick={arrowLeft}
70
70
  variant="link"
@@ -81,7 +81,7 @@ const arrowRight = () => setIndex(current < urls.length - 1 ? current + 1 : urls
81
81
  urls.length > 1 && (
82
82
  <CircleIconButton
83
83
  className='carousel-arrow-right'
84
- dark={true}
84
+ dark
85
85
  icon="chevron-right"
86
86
  onClick={arrowRight}
87
87
  variant="link"
@@ -16,7 +16,7 @@ export default function Thumbnail({
16
16
  alt,
17
17
  width,
18
18
  url,
19
- onClick = ()=>{},
19
+ onClick,
20
20
  buttonRef,
21
21
  }: ThumbnailType): React.ReactElement {
22
22
  const activeClasses = classnames('Thumbnail', { active })
@@ -20,8 +20,8 @@ type CarouselType = {
20
20
  export default function Carousel({
21
21
  currentIndex,
22
22
  photos,
23
- onClick = ()=>{},
24
- onChange = ()=>{},
23
+ onClick,
24
+ onChange = () => undefined,
25
25
  setIndex,
26
26
  }: CarouselType): React.ReactElement {
27
27
  useEffect(() => {
@@ -39,10 +39,10 @@ export default function Carousel({
39
39
  return (
40
40
  <div className="Lightbox">
41
41
  <Slides
42
- setIndex={setIndex}
43
42
  current={currentIndex}
44
43
  onChange={handleChange}
45
44
  onClick={onClick}
45
+ setIndex={setIndex}
46
46
  urls={photos.map((photo) => photo.url)}
47
47
  />
48
48
  {photos.length > 1 ? (
@@ -61,23 +61,31 @@ const LightboxHeader = (props: LightboxHeaderProps): React.ReactElement => {
61
61
 
62
62
  const HeaderBody = () => (
63
63
  <React.Fragment>
64
- <FlexItem flex="1" marginLeft="sm">
64
+ <FlexItem flex="1"
65
+ marginLeft="sm"
66
+ >
65
67
  <CircleIconButton
66
- onClick={handleOnLightboxClose}
67
- dark={true}
68
- variant="link"
69
- icon={icon}
68
+ dark
69
+ icon={icon}
70
+ onClick={handleOnLightboxClose}
71
+ variant="link"
70
72
  />
71
73
  </FlexItem>
72
74
  {title && text && (
73
75
  <FlexItem flex="5">
74
76
  <Flex justify="center">
75
- <Flex align="center" orientation="column">
77
+ <Flex align="center"
78
+ orientation="column"
79
+ >
76
80
  {typeof title === "string" ? (
77
- <Title dark paddingBottom="xxs" size={4} text={title} />
81
+ <Title dark
82
+ paddingBottom="xxs"
83
+ size={4}
84
+ text={title}
85
+ />
78
86
  ) : (
79
- <Flex justify="center"
80
- className="custom-header"
87
+ <Flex className="custom-header"
88
+ justify="center"
81
89
  >
82
90
  {title}
83
91
  </Flex>
@@ -86,8 +94,8 @@ const LightboxHeader = (props: LightboxHeaderProps): React.ReactElement => {
86
94
  {typeof text === "string" ? (
87
95
  <Caption dark>{text}</Caption>
88
96
  ) : (
89
- <Flex justify="center"
90
- className="custom-header"
97
+ <Flex className="custom-header"
98
+ justify="center"
91
99
  >
92
100
  {text}
93
101
  </Flex>
@@ -99,12 +107,12 @@ const LightboxHeader = (props: LightboxHeaderProps): React.ReactElement => {
99
107
  <FlexItem flex="1">
100
108
  <Flex justify="end">
101
109
  <Button
102
- className="nav-right-btn"
103
- htmlType="button"
104
- onClick={onClickRight}
105
- dark
106
- variant="link"
107
- text={navRight}
110
+ className="nav-right-btn"
111
+ dark
112
+ htmlType="button"
113
+ onClick={onClickRight}
114
+ text={navRight}
115
+ variant="link"
108
116
  />
109
117
  </Flex>
110
118
  </FlexItem>
@@ -114,11 +122,11 @@ const LightboxHeader = (props: LightboxHeaderProps): React.ReactElement => {
114
122
  return (
115
123
  <div className="carousel-header">
116
124
  <Flex
117
- {...ariaProps}
118
- {...dataProps}
119
- {...htmlProps}
120
- className={classnames(headerCSS, headerSpacing, className)}
121
- spacing={spacing}
125
+ {...ariaProps}
126
+ {...dataProps}
127
+ {...htmlProps}
128
+ className={classnames(headerCSS, headerSpacing, className)}
129
+ spacing={spacing}
122
130
  >
123
131
  {closeable && <HeaderBody />}
124
132
  {children}
@@ -19,7 +19,7 @@ type LightboxType = {
19
19
  id?: string,
20
20
  photos: [],
21
21
  initialPhoto?: number,
22
- onChange?: (index: number)=> {},
22
+ onChange?: (index: number)=> void,
23
23
  onClickRight?: () => void,
24
24
  onClose?: () => void,
25
25
  icon: string,
@@ -40,7 +40,7 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
40
40
  id = '',
41
41
  initialPhoto = 0,
42
42
  photos,
43
- onChange = ()=>{},
43
+ onChange = () => undefined,
44
44
  onClose,
45
45
  onClickRight,
46
46
  icon = 'times',
@@ -107,18 +107,18 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
107
107
  <div className="carousel">
108
108
  <Lightbox.Header
109
109
  icon={icon}
110
- onClose={onClose}
110
+ navRight={navRight}
111
111
  onClickRight={onClickRight}
112
+ onClose={onClose}
112
113
  text={description}
113
- navRight={navRight}
114
114
  title={title}
115
115
  />
116
116
  {children}
117
117
  <Carousel
118
- setIndex={setActivePhoto}
119
118
  currentIndex={activePhoto}
120
119
  onChange={handleOnSlide}
121
120
  photos={photosMap}
121
+ setIndex={setActivePhoto}
122
122
  />
123
123
  </div>
124
124
  </div>
@@ -12,7 +12,7 @@ import mapColors from "../pb_dashboard/pbChartsColorsHelper";
12
12
  type LineGraphProps = {
13
13
  align?: "left" | "right" | "center";
14
14
  axisTitle?: string;
15
- dark?: Boolean;
15
+ dark?: boolean;
16
16
  xAxisCategories: [];
17
17
  yAxisMin: number;
18
18
  yAxisMax: number;
@@ -138,15 +138,15 @@ const LineGraph = ({
138
138
 
139
139
  return (
140
140
  <HighchartsReact
141
- containerProps={{
141
+ containerProps={{
142
142
  className: classnames(globalProps(props), className),
143
143
  id: id,
144
144
  ...ariaProps,
145
145
  ...dataProps,
146
146
  ...htmlProps
147
147
  }}
148
- highcharts={Highcharts}
149
- options={options}
148
+ highcharts={Highcharts}
149
+ options={options}
150
150
  />
151
151
  );
152
152
  };