playbook_ui 11.7.0 → 11.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +32 -1
  3. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +12 -2
  4. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.tsx +3 -3
  5. data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +17 -2
  6. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.jsx +1 -0
  7. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.jsx +103 -0
  8. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.md +2 -0
  9. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.jsx +102 -0
  10. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.md +5 -0
  11. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_sizes.jsx +4 -1
  12. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_stacked_alert.jsx +4 -1
  13. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.jsx +4 -1
  14. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +2 -0
  15. data/app/pb_kits/playbook/pb_dialog/docs/index.js +2 -0
  16. data/app/pb_kits/playbook/pb_filter/docs/_filter_close_popover.jsx +2 -1
  17. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +14 -23
  18. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +4 -1
  19. data/app/pb_kits/playbook/pb_filter/docs/_filter_min_width.html.erb +7 -12
  20. data/app/pb_kits/playbook/pb_filter/docs/_filter_min_width.jsx +2 -2
  21. data/app/pb_kits/playbook/pb_filter/docs/_filter_no_background.html.erb +13 -21
  22. data/app/pb_kits/playbook/pb_filter/docs/_filter_no_background.jsx +3 -1
  23. data/app/pb_kits/playbook/pb_filter/docs/_filter_no_sort.html.erb +7 -11
  24. data/app/pb_kits/playbook/pb_filter/docs/_filter_no_sort.jsx +2 -1
  25. data/app/pb_kits/playbook/pb_filter/docs/_filter_only.html.erb +7 -11
  26. data/app/pb_kits/playbook/pb_filter/docs/_filter_only.jsx +2 -1
  27. data/app/pb_kits/playbook/pb_filter/docs/_filter_placement.html.erb +7 -11
  28. data/app/pb_kits/playbook/pb_filter/docs/_filter_placement.jsx +2 -1
  29. data/app/pb_kits/playbook/pb_filter/docs/_filter_single.html.erb +7 -11
  30. data/app/pb_kits/playbook/pb_filter/docs/_filter_single.jsx +2 -1
  31. data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +26 -0
  32. data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnail.tsx +1 -2
  33. data/app/pb_kits/playbook/pb_lightbox/Carousel/index.tsx +2 -4
  34. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +83 -67
  35. data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +18 -14
  36. data/app/pb_kits/playbook/pb_lightbox/docs/_description.md +1 -0
  37. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_compound_component.jsx +10 -2
  38. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_compound_component.md +1 -1
  39. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_custom_header.jsx +95 -0
  40. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_custom_header.md +1 -0
  41. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.jsx +1 -2
  42. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.md +1 -1
  43. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_multiple.jsx +3 -2
  44. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_multiple.md +2 -0
  45. data/app/pb_kits/playbook/pb_lightbox/docs/example.yml +1 -0
  46. data/app/pb_kits/playbook/pb_lightbox/docs/index.js +1 -0
  47. data/app/pb_kits/playbook/pb_lightbox/lightbox.scss +25 -29
  48. data/app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx +1 -5
  49. data/app/pb_kits/playbook/pb_list/docs/_description.md +5 -3
  50. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.jsx +69 -62
  51. data/app/pb_kits/playbook/pb_table/docs/_table_icon_buttons.html.erb +4 -4
  52. data/app/pb_kits/playbook/pb_table/docs/_table_icon_buttons.jsx +16 -7
  53. data/app/pb_kits/playbook/pb_table/docs/_table_one_action.html.erb +3 -3
  54. data/app/pb_kits/playbook/pb_table/docs/_table_one_action.jsx +3 -3
  55. data/app/pb_kits/playbook/pb_table/docs/_table_two_actions.html.erb +6 -6
  56. data/app/pb_kits/playbook/pb_table/docs/_table_two_actions.jsx +3 -3
  57. data/app/pb_kits/playbook/pb_table/docs/_table_two_plus_actions.html.erb +3 -3
  58. data/app/pb_kits/playbook/pb_table/docs/_table_two_plus_actions.jsx +3 -3
  59. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.jsx +7 -2
  60. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.jsx +7 -2
  61. data/lib/playbook/version.rb +2 -2
  62. metadata +10 -3
  63. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header_icon.tsx +0 -27
@@ -1,5 +1,6 @@
1
1
  <%=
2
2
  pb_rails("filter", props: {
3
+ min_width: "375px",
3
4
  id: "3",
4
5
  background: false,
5
6
  filters: [
@@ -16,17 +17,12 @@
16
17
  }) do
17
18
  %>
18
19
  <%
19
- example_collection = [
20
- OpenStruct.new(name: "Alabama", value: 1),
21
- OpenStruct.new(name: "Alaska", value: 2),
22
- OpenStruct.new(name: "Arizona", value: 3),
23
- OpenStruct.new(name: "Arkansas", value: 4),
24
- OpenStruct.new(name: "California", value: 5),
25
- OpenStruct.new(name: "Colorado", value: 6),
26
- OpenStruct.new(name: "Connecticut", value: 7),
27
- OpenStruct.new(name: "Delaware", value: 8),
28
- OpenStruct.new(name: "Florida", value: 9),
29
- OpenStruct.new(name: "Georgia", value: 10),
20
+ example_collection = [
21
+ OpenStruct.new(name: "USA", value: 1),
22
+ OpenStruct.new(name: "Canada", value: 2),
23
+ OpenStruct.new(name: "Brazil", value: 3),
24
+ OpenStruct.new(name: "Philippines", value: 4),
25
+ OpenStruct.new(name: "A galaxy far far away, like really far away...", value: 5)
30
26
  ]
31
27
  %>
32
28
 
@@ -45,6 +41,7 @@
45
41
 
46
42
  <%=
47
43
  pb_rails("filter", props: {
44
+ min_width: "375px",
48
45
  id: "4",
49
46
  background: false,
50
47
  filters: [
@@ -61,16 +58,11 @@
61
58
  %>
62
59
  <%
63
60
  example_collection = [
64
- OpenStruct.new(name: "Alabama", value: 1),
65
- OpenStruct.new(name: "Alaska", value: 2),
66
- OpenStruct.new(name: "Arizona", value: 3),
67
- OpenStruct.new(name: "Arkansas", value: 4),
68
- OpenStruct.new(name: "California", value: 5),
69
- OpenStruct.new(name: "Colorado", value: 6),
70
- OpenStruct.new(name: "Connecticut", value: 7),
71
- OpenStruct.new(name: "Delaware", value: 8),
72
- OpenStruct.new(name: "Florida", value: 9),
73
- OpenStruct.new(name: "Georgia", value: 10),
61
+ OpenStruct.new(name: "USA", value: 1),
62
+ OpenStruct.new(name: "Canada", value: 2),
63
+ OpenStruct.new(name: "Brazil", value: 3),
64
+ OpenStruct.new(name: "Philippines", value: 4),
65
+ OpenStruct.new(name: "A galaxy far far away, like really far away...", value: 5)
74
66
  ]
75
67
  %>
76
68
  <%= pb_rails("form", props: { form_system_options: { scope: :example, method: :get } }) do |form| %>
@@ -7,7 +7,7 @@ const FilterNoBackground = (props) => {
7
7
  { value: 'Canada' },
8
8
  { value: 'Brazil' },
9
9
  { value: 'Philippines' },
10
- { value: 'A Galaxy Far Far Away Like Really Far Away' },
10
+ { value: 'A galaxy far far away, like really far away...' },
11
11
  ]
12
12
  return (
13
13
  <>
@@ -17,6 +17,7 @@ const FilterNoBackground = (props) => {
17
17
  'Full Name': 'John Wick',
18
18
  'City': 'Las Vegas',
19
19
  }}
20
+ minWidth="375px"
20
21
  results={3}
21
22
  sortOptions={{
22
23
  popularity: 'Popularity',
@@ -64,6 +65,7 @@ const FilterNoBackground = (props) => {
64
65
  'Full Name': 'John Wick',
65
66
  'City': 'Las Vegas',
66
67
  }}
68
+ minWidth="375px"
67
69
  results={3}
68
70
  sortOptions={{
69
71
  popularity: 'Popularity',
@@ -1,5 +1,6 @@
1
1
  <%=
2
2
  pb_rails("filter", props: {
3
+ min_width: "375px",
3
4
  id: "nosort",
4
5
  filters: [
5
6
  { name: "name", value: "John Wick" }
@@ -9,17 +10,12 @@
9
10
  }) do
10
11
  %>
11
12
  <%
12
- example_collection = [
13
- OpenStruct.new(name: "Alabama", value: 1),
14
- OpenStruct.new(name: "Alaska", value: 2),
15
- OpenStruct.new(name: "Arizona", value: 3),
16
- OpenStruct.new(name: "Arkansas", value: 4),
17
- OpenStruct.new(name: "California", value: 5),
18
- OpenStruct.new(name: "Colorado", value: 6),
19
- OpenStruct.new(name: "Connecticut", value: 7),
20
- OpenStruct.new(name: "Delaware", value: 8),
21
- OpenStruct.new(name: "Florida", value: 9),
22
- OpenStruct.new(name: "Georgia", value: 10),
13
+ example_collection = [
14
+ OpenStruct.new(name: "USA", value: 1),
15
+ OpenStruct.new(name: "Canada", value: 2),
16
+ OpenStruct.new(name: "Brazil", value: 3),
17
+ OpenStruct.new(name: "Philippines", value: 4),
18
+ OpenStruct.new(name: "A galaxy far far away, like really far away...", value: 5)
23
19
  ]
24
20
  %>
25
21
 
@@ -7,13 +7,14 @@ const FilterNoSort = (props) => {
7
7
  { value: 'Canada' },
8
8
  { value: 'Brazil' },
9
9
  { value: 'Philippines' },
10
- { value: 'A Galaxy Far Far Away Like Really Far Away' },
10
+ { value: 'A galaxy far far away, like really far away...' },
11
11
  ]
12
12
  return (
13
13
  <Filter
14
14
  filters={{
15
15
  'Full Name': 'John Wick',
16
16
  }}
17
+ minWidth="375px"
17
18
  results={546}
18
19
  sortValue={[{ name: 'popularity', dir: 'desc' }]}
19
20
  {...props}
@@ -1,5 +1,6 @@
1
1
  <%=
2
2
  pb_rails("filter", props: {
3
+ min_width: "375px",
3
4
  id: "fo",
4
5
  filters: [
5
6
  { name: "name", value: "John Wick" }
@@ -8,17 +9,12 @@
8
9
  }) do
9
10
  %>
10
11
  <%
11
- example_collection = [
12
- OpenStruct.new(name: "Alabama", value: 1),
13
- OpenStruct.new(name: "Alaska", value: 2),
14
- OpenStruct.new(name: "Arizona", value: 3),
15
- OpenStruct.new(name: "Arkansas", value: 4),
16
- OpenStruct.new(name: "California", value: 5),
17
- OpenStruct.new(name: "Colorado", value: 6),
18
- OpenStruct.new(name: "Connecticut", value: 7),
19
- OpenStruct.new(name: "Delaware", value: 8),
20
- OpenStruct.new(name: "Florida", value: 9),
21
- OpenStruct.new(name: "Georgia", value: 10),
12
+ example_collection = [
13
+ OpenStruct.new(name: "USA", value: 1),
14
+ OpenStruct.new(name: "Canada", value: 2),
15
+ OpenStruct.new(name: "Brazil", value: 3),
16
+ OpenStruct.new(name: "Philippines", value: 4),
17
+ OpenStruct.new(name: "A galaxy far far away, like really far away...", value: 5)
22
18
  ]
23
19
  %>
24
20
  <%= pb_rails("form", props: { form_system_options: { scope: :example, method: :get } }) do |form| %>
@@ -7,11 +7,12 @@ const FilterOnly = (props) => {
7
7
  { value: 'Canada' },
8
8
  { value: 'Brazil' },
9
9
  { value: 'Philippines' },
10
- { value: 'A Galaxy Far Far Away Like Really Far Away' },
10
+ { value: 'A galaxy far far away, like really far away...' },
11
11
  ]
12
12
  return (
13
13
  <Filter
14
14
  filters={{ 'Full Name': 'John Wick' }}
15
+ minWidth="375px"
15
16
  {...props}
16
17
  >
17
18
  <TextInput
@@ -1,5 +1,6 @@
1
1
  <%=
2
2
  pb_rails("filter", props: {
3
+ min_width: "375px",
3
4
  id: "pla",
4
5
  filters: [
5
6
  { name: "name", value: "John Wick" }
@@ -9,17 +10,12 @@
9
10
  }) do
10
11
  %>
11
12
  <%
12
- example_collection = [
13
- OpenStruct.new(name: "Alabama", value: 1),
14
- OpenStruct.new(name: "Alaska", value: 2),
15
- OpenStruct.new(name: "Arizona", value: 3),
16
- OpenStruct.new(name: "Arkansas", value: 4),
17
- OpenStruct.new(name: "California", value: 5),
18
- OpenStruct.new(name: "Colorado", value: 6),
19
- OpenStruct.new(name: "Connecticut", value: 7),
20
- OpenStruct.new(name: "Delaware", value: 8),
21
- OpenStruct.new(name: "Florida", value: 9),
22
- OpenStruct.new(name: "Georgia", value: 10),
13
+ example_collection = [
14
+ OpenStruct.new(name: "USA", value: 1),
15
+ OpenStruct.new(name: "Canada", value: 2),
16
+ OpenStruct.new(name: "Brazil", value: 3),
17
+ OpenStruct.new(name: "Philippines", value: 4),
18
+ OpenStruct.new(name: "A galaxy far far away, like really far away...", value: 5)
23
19
  ]
24
20
  %>
25
21
  <%= pb_rails("form", props: { form_system_options: { scope: :example, method: :get } }) do |form| %>
@@ -11,13 +11,14 @@ const FilterPlacement = (props) => {
11
11
  { value: 'Canada' },
12
12
  { value: 'Brazil' },
13
13
  { value: 'Philippines' },
14
- { value: 'A Galaxy Far Far Away Like Really Far Away' },
14
+ { value: 'A galaxy far far away, like really far away...' },
15
15
  ]
16
16
  return (
17
17
 
18
18
  <>
19
19
  <Filter
20
20
  double
21
+ minWidth="375px"
21
22
  onSortChange={SortingChangeCallback}
22
23
  placement={"right"}
23
24
  results={1}
@@ -1,5 +1,6 @@
1
1
  <%=
2
2
  pb_rails("filter", props: {
3
+ min_width: "375px",
3
4
  id: "2",
4
5
  filters: [
5
6
  { name: "name", value: "John Wick" }
@@ -14,17 +15,12 @@
14
15
  }) do
15
16
  %>
16
17
  <%
17
- example_collection = [
18
- OpenStruct.new(name: "Alabama", value: 1),
19
- OpenStruct.new(name: "Alaska", value: 2),
20
- OpenStruct.new(name: "Arizona", value: 3),
21
- OpenStruct.new(name: "Arkansas", value: 4),
22
- OpenStruct.new(name: "California", value: 5),
23
- OpenStruct.new(name: "Colorado", value: 6),
24
- OpenStruct.new(name: "Connecticut", value: 7),
25
- OpenStruct.new(name: "Delaware", value: 8),
26
- OpenStruct.new(name: "Florida", value: 9),
27
- OpenStruct.new(name: "Georgia", value: 10),
18
+ example_collection = [
19
+ OpenStruct.new(name: "USA", value: 1),
20
+ OpenStruct.new(name: "Canada", value: 2),
21
+ OpenStruct.new(name: "Brazil", value: 3),
22
+ OpenStruct.new(name: "Philippines", value: 4),
23
+ OpenStruct.new(name: "A galaxy far far away, like really far away...", value: 5)
28
24
  ]
29
25
  %>
30
26
 
@@ -13,13 +13,14 @@ const FilterSingle = (props) => {
13
13
  { value: 'Canada' },
14
14
  { value: 'Brazil' },
15
15
  { value: 'Philippines' },
16
- { value: 'A Galaxy Far Far Away Like Really Far Away' },
16
+ { value: 'A galaxy far far away, like really far away...' },
17
17
  ]
18
18
  return (
19
19
  <Filter
20
20
  filters={{
21
21
  'Full Name': 'John Wick',
22
22
  }}
23
+ minWidth="375px"
23
24
  results={546}
24
25
  sortOptions={{
25
26
  popularity: 'Popularity',
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { noop } from 'lodash'
4
4
  import React, { useState } from 'react'
5
+ import CircleIconButton from '../../pb_circle_icon_button/_circle_icon_button'
5
6
 
6
7
  import Slide from './Slide'
7
8
 
@@ -47,6 +48,8 @@ const onTouchEnd = () => {
47
48
  }
48
49
  }
49
50
 
51
+ const arrowLeft = () => setIndex(current > 0 ? current - 1 : 0)
52
+ const arrowRight = () => setIndex(current < urls.length - 1 ? current + 1 : urls.length - 1)
50
53
 
51
54
 
52
55
  const handleZoom = (isZooming: boolean) => setZooming(isZooming)
@@ -57,12 +60,35 @@ const onTouchEnd = () => {
57
60
  onTouchMove={onTouchMove}
58
61
  onTouchEnd={onTouchEnd}
59
62
  >
63
+ {
64
+ urls.length > 1 && (
65
+ <CircleIconButton
66
+ className='carousel-arrow-left'
67
+ dark={true}
68
+ icon="chevron-left"
69
+ onClick={arrowLeft}
70
+ variant="link"
71
+ />
72
+ )
73
+ }
60
74
  <Slide
61
75
  onClick={() => onChange(current)}
62
76
  onZoom={handleZoom}
63
77
  url={urls[current]}
64
78
  zooming={zooming}
65
79
  />
80
+ {
81
+ urls.length > 1 && (
82
+ <CircleIconButton
83
+ className='carousel-arrow-right'
84
+ dark={true}
85
+ icon="chevron-right"
86
+ onClick={arrowRight}
87
+ variant="link"
88
+ />
89
+ )
90
+ }
91
+
66
92
  </div>
67
93
  )
68
94
  }
@@ -1,5 +1,4 @@
1
1
  import React from 'react'
2
- import { noop } from 'lodash'
3
2
  import classnames from 'classnames'
4
3
  import Image from '../../pb_image/_image'
5
4
 
@@ -17,7 +16,7 @@ export default function Thumbnail({
17
16
  alt,
18
17
  width,
19
18
  url,
20
- onClick = noop,
19
+ onClick = ()=>{},
21
20
  buttonRef,
22
21
  }: ThumbnailType): React.ReactElement {
23
22
  const activeClasses = classnames('Thumbnail', { active })
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable jsx-control-statements/jsx-use-if-tag */
2
- import { noop } from 'lodash'
3
2
  import React, { useEffect } from 'react'
4
3
  import Slides from './Slides'
5
4
  import Thumbnails from './Thumbnails'
@@ -8,7 +7,6 @@ type CarouselType = {
8
7
  initialPhoto?: string,
9
8
  onClose?: () => void,
10
9
  icon?: string,
11
- iconSize?: number,
12
10
  currentIndex: number,
13
11
  photos: {
14
12
  url: string,
@@ -22,8 +20,8 @@ type CarouselType = {
22
20
  export default function Carousel({
23
21
  currentIndex,
24
22
  photos,
25
- onClick = noop,
26
- onChange = noop,
23
+ onClick = ()=>{},
24
+ onChange = ()=>{},
27
25
  setIndex,
28
26
  }: CarouselType): React.ReactElement {
29
27
  useEffect(() => {
@@ -1,31 +1,36 @@
1
1
  /* eslint-disable react/no-multi-comp */
2
2
  /* @flow */
3
- import React, { useContext } from 'react'
4
- import classnames from 'classnames'
5
- import { buildAriaProps, buildCss, buildDataProps } from '../../utilities/props'
6
- import { globalProps, GlobalProps } from '../../utilities/globalProps'
7
- import { LightboxContext } from '../_lightbox_context'
8
- import { LightboxHeaderIcon } from './_lightbox_header_icon'
9
- import { IconSizes } from '../../pb_icon/_icon'
3
+ import React, { useContext } from "react";
4
+ import classnames from "classnames";
5
+ import {
6
+ buildAriaProps,
7
+ buildCss,
8
+ buildDataProps,
9
+ } from "../../utilities/props";
10
+ import { globalProps, GlobalProps } from "../../utilities/globalProps";
11
+ import { LightboxContext } from "../_lightbox_context";
10
12
 
11
- import Caption from '../../pb_caption/_caption'
12
- import Flex from '../../pb_flex/_flex'
13
- import FlexItem from '../../pb_flex/_flex_item'
14
- import Title from '../../pb_title/_title'
13
+ import CircleIconButton from "../../pb_circle_icon_button/_circle_icon_button";
14
+ import Caption from "../../pb_caption/_caption";
15
+ import Flex from "../../pb_flex/_flex";
16
+ import FlexItem from "../../pb_flex/_flex_item";
17
+ import Title from "../../pb_title/_title";
18
+ import Button from "../../pb_button/_button";
15
19
 
16
20
  type LightboxHeaderProps = {
17
- aria?: {[key: string]: string},
18
- children?: React.ReactNode[] | React.ReactNode | string,
19
- className?: string,
20
- closeable?: boolean,
21
- data?: {[key: string]: string | number},
22
- icon?: string,
23
- iconSize?: IconSizes,
24
- id?: string,
25
- text?: string,
26
- textRight?: string,
27
- title?: string,
28
- } & GlobalProps
21
+ aria?: { [key: string]: string };
22
+ children?: React.ReactNode[] | React.ReactNode | string;
23
+ className?: string;
24
+ closeable?: boolean;
25
+ data?: { [key: string]: string | number };
26
+ icon?: string;
27
+ id?: string;
28
+ onClickRight?: () => void;
29
+ onClose?: () => void;
30
+ text?: string;
31
+ navRight?: string;
32
+ title?: string;
33
+ } & GlobalProps;
29
34
 
30
35
  const LightboxHeader = (props: LightboxHeaderProps): React.ReactElement => {
31
36
  const {
@@ -33,77 +38,88 @@ const LightboxHeader = (props: LightboxHeaderProps): React.ReactElement => {
33
38
  children,
34
39
  className,
35
40
  data = {},
36
- spacing = 'between',
41
+ onClickRight,
42
+ spacing = "between",
37
43
  text,
38
- textRight = 'All Photos',
44
+ navRight,
39
45
  title,
40
46
  closeable = true,
41
- icon = 'times',
42
- iconSize = '2x',
43
- } = props
47
+ icon = "times",
48
+ } = props;
44
49
 
45
- const ariaProps = buildAriaProps(aria)
46
- const dataProps = buildDataProps(data)
47
- const api: any = useContext(LightboxContext)
48
- const headerCSS = buildCss('lightbox_header')
49
- const headerSpacing = globalProps(props, { paddingY: 'sm' })
50
+ const ariaProps = buildAriaProps(aria);
51
+ const dataProps = buildDataProps(data);
52
+ const api: any = useContext(LightboxContext);
53
+ const headerCSS = buildCss("lightbox_header");
54
+ const headerSpacing = globalProps(props, { paddingY: "sm" });
50
55
 
51
- const handleOnLightboxClose = () => api.onClose()
56
+ const handleOnLightboxClose = () => api.onClose();
52
57
 
53
58
  const HeaderBody = () => (
54
59
  <React.Fragment>
55
- <FlexItem flex="1">
56
- <LightboxHeaderIcon
57
- icon={icon}
58
- iconSize={iconSize}
59
- onClose={handleOnLightboxClose}
60
+ <FlexItem flex="1" marginLeft="sm">
61
+ <CircleIconButton
62
+ onClick={handleOnLightboxClose}
63
+ dark={true}
64
+ variant="link"
65
+ icon={icon}
60
66
  />
61
67
  </FlexItem>
62
- {(title && text) && (
68
+ {title && text && (
63
69
  <FlexItem flex="5">
64
70
  <Flex justify="center">
65
- <Flex
66
- align="center"
67
- orientation="column"
68
- >
69
- <Title
70
- dark
71
- paddingBottom="xs"
72
- size={4}
73
- text={title}
74
- />
75
- <Caption dark>{text}</Caption>
71
+ <Flex align="center" orientation="column">
72
+ {typeof title === "string" ? (
73
+ <Title dark paddingBottom="xxs" size={4} text={title} />
74
+ ) : (
75
+ <Flex justify="center"
76
+ className="custom-header"
77
+ >
78
+ {title}
79
+ </Flex>
80
+ )}
81
+
82
+ {typeof text === "string" ? (
83
+ <Caption dark>{text}</Caption>
84
+ ) : (
85
+ <Flex justify="center"
86
+ className="custom-header"
87
+ >
88
+ {text}
89
+ </Flex>
90
+ )}
76
91
  </Flex>
77
92
  </Flex>
78
93
  </FlexItem>
79
- ) }
94
+ )}
80
95
  <FlexItem flex="1">
81
96
  <Flex justify="end">
82
- <Title
83
- dark
84
- marginRight="md"
85
- marginTop="xs"
86
- size={4}
87
- text={textRight}
97
+ <Button
98
+ className="nav-right-btn"
99
+ htmlType="button"
100
+ onClick={onClickRight}
101
+ dark
102
+ variant="link"
103
+ text={navRight}
88
104
  />
89
105
  </Flex>
90
106
  </FlexItem>
91
107
  </React.Fragment>
92
- )
108
+ );
93
109
 
94
110
  return (
95
111
  <div className="carousel-header">
96
112
  <Flex
97
- {...ariaProps}
98
- {...dataProps}
99
- className={classnames(headerCSS, headerSpacing, className)}
100
- spacing={spacing}
113
+ {...ariaProps}
114
+ {...dataProps}
115
+ className={classnames(headerCSS, headerSpacing, className)}
116
+ spacing={spacing}
101
117
  >
102
- {closeable && <HeaderBody/>}
118
+ {closeable && <HeaderBody />}
103
119
  {children}
104
120
  </Flex>
105
121
  </div>
106
- )
107
- }
122
+ );
123
+ };
108
124
 
109
- export default LightboxHeader
125
+ export default LightboxHeader;
@@ -1,11 +1,10 @@
1
- import React, { Fragment, useMemo, useRef, useState } from 'react'
1
+ import React, { Fragment, useMemo, useRef, useState, useEffect } from 'react'
2
2
  import { useKbdControls } from './hooks/useKbdControls'
3
3
  import classnames from 'classnames'
4
4
  import { buildAriaProps, buildCss, buildDataProps } 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'
8
- import { IconSizes } from '../pb_icon/_icon'
9
8
 
10
9
  import Carousel from './Carousel/index'
11
10
 
@@ -14,17 +13,17 @@ type LightboxType = {
14
13
  children: React.ReactNode[] | React.ReactNode | string,
15
14
  className?: string,
16
15
  data?: {[key: string]: string | number},
17
- description?: string,
16
+ description?: string | any,
18
17
  id?: string,
19
18
  photos: [],
20
19
  initialPhoto?: number,
21
- onClose: () => void,
20
+ onChange?: (index: number)=> {},
21
+ onClickRight?: () => void,
22
+ onClose?: () => void,
22
23
  icon: string,
23
- iconSize: IconSizes,
24
- showCount?: boolean,
25
- textRight?: string,
24
+ navRight?: string,
26
25
  trigger?: string,
27
- title?: string,
26
+ title?: string | any,
28
27
  }
29
28
 
30
29
  const Lightbox = (props: LightboxType): React.ReactNode => {
@@ -37,15 +36,20 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
37
36
  id = '',
38
37
  initialPhoto = 0,
39
38
  photos,
39
+ onChange = ()=>{},
40
40
  onClose,
41
+ onClickRight,
41
42
  icon = 'times',
42
- iconSize = '2x',
43
- showCount = true,
44
- textRight = 'All Photos',
43
+ navRight,
45
44
  title,
46
45
  } = props
46
+
47
47
  const [activePhoto, setActivePhoto] = useState(initialPhoto)
48
48
 
49
+ useEffect(() => {
50
+ onChange(activePhoto)
51
+ },[activePhoto])
52
+
49
53
  const ariaProps = buildAriaProps(aria)
50
54
  const dataProps = buildDataProps(data)
51
55
  const classes = classnames(
@@ -77,7 +81,6 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
77
81
 
78
82
  const lightboxRef: any = useRef()
79
83
 
80
- const headerTextRight = showCount ? `${activePhoto + 1} / ${photos.length}` : textRight
81
84
 
82
85
  return (
83
86
  <Fragment>
@@ -92,9 +95,10 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
92
95
  <div className="carousel">
93
96
  <Lightbox.Header
94
97
  icon={icon}
95
- iconSize={iconSize}
98
+ onClose={onClose}
99
+ onClickRight={onClickRight}
96
100
  text={description}
97
- textRight={headerTextRight}
101
+ navRight={navRight}
98
102
  title={title}
99
103
  />
100
104
  {children}
@@ -0,0 +1 @@
1
+ The Lightbox kit is a popup window overlay that will appear on top of your webpage and cover the entirety of the screen. It can be used to display a group of images that the user can swipe through, zoom into and view. The button in the top left of the header can be used to close the overlay and exit back to your webpage. Click the images in the examples below to see Lightbox in action.