playbook_ui 12.17.0.pre.alpha.lightboxcurrentPhotoIndex582 → 12.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +0 -8
- data/app/pb_kits/playbook/pb_lightbox/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_lightbox/docs/index.js +0 -1
- data/lib/playbook/version.rb +1 -1
- metadata +7 -9
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_current_photo.jsx +0 -121
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_current_photo.md +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfed6f95e6594050c37a607fb9cad4b2cb4d4273e5783f31d2ef3d95ac8738f2
|
4
|
+
data.tar.gz: ad22ab4499b111356d7f9533afd9069bb10be334cbdb01f4d2e93ad034a3d93e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95349ca92cf7040d34fcc7d166e32513bf34d973e1dbc2b406a2523b60ea010a390a9e28ae8cd86c7747e48acf84b71fc550a9bed7f4832babb92f96d8d26c8b
|
7
|
+
data.tar.gz: f74e854a1c37a6d6050e4a8913ebb3c550633a6eb894f013f8a96b188cb0cad29f7fd39cc8723a0727e47fee1ab0342c850fda11a69ff86f09647e563156d5b7
|
@@ -12,7 +12,6 @@ type LightboxType = {
|
|
12
12
|
aria?: {[key: string]: string},
|
13
13
|
children: React.ReactNode[] | React.ReactNode | string,
|
14
14
|
className?: string,
|
15
|
-
currentPhotoIndex?: number,
|
16
15
|
data?: {[key: string]: string | number},
|
17
16
|
description?: string | any,
|
18
17
|
id?: string,
|
@@ -32,7 +31,6 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
|
|
32
31
|
aria = {},
|
33
32
|
children,
|
34
33
|
className,
|
35
|
-
currentPhotoIndex,
|
36
34
|
data = {},
|
37
35
|
description,
|
38
36
|
id = '',
|
@@ -52,12 +50,6 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
|
|
52
50
|
onChange(activePhoto)
|
53
51
|
},[activePhoto])
|
54
52
|
|
55
|
-
useEffect(() => {
|
56
|
-
currentPhotoIndex !== undefined && currentPhotoIndex !== null && (
|
57
|
-
setActivePhoto(currentPhotoIndex)
|
58
|
-
)
|
59
|
-
},[currentPhotoIndex])
|
60
|
-
|
61
53
|
const ariaProps = buildAriaProps(aria)
|
62
54
|
const dataProps = buildDataProps(data)
|
63
55
|
const classes = classnames(
|
@@ -2,4 +2,3 @@ export { default as LightboxDefault } from './_lightbox_default.jsx'
|
|
2
2
|
export { default as LightboxMultiple } from './_lightbox_multiple.jsx'
|
3
3
|
export { default as LightboxCompoundComponent } from './_lightbox_compound_component.jsx'
|
4
4
|
export { default as LightboxCustomHeader } from './_lightbox_custom_header'
|
5
|
-
export { default as LightboxCurrentPhoto } from './_lightbox_current_photo'
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.17.
|
4
|
+
version: 12.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
8
8
|
- Power Devs
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -1332,8 +1332,6 @@ files:
|
|
1332
1332
|
- app/pb_kits/playbook/pb_lightbox/docs/_description.md
|
1333
1333
|
- app/pb_kits/playbook/pb_lightbox/docs/_lightbox_compound_component.jsx
|
1334
1334
|
- app/pb_kits/playbook/pb_lightbox/docs/_lightbox_compound_component.md
|
1335
|
-
- app/pb_kits/playbook/pb_lightbox/docs/_lightbox_current_photo.jsx
|
1336
|
-
- app/pb_kits/playbook/pb_lightbox/docs/_lightbox_current_photo.md
|
1337
1335
|
- app/pb_kits/playbook/pb_lightbox/docs/_lightbox_custom_header.jsx
|
1338
1336
|
- app/pb_kits/playbook/pb_lightbox/docs/_lightbox_custom_header.md
|
1339
1337
|
- app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.jsx
|
@@ -2474,7 +2472,7 @@ homepage: http://playbook.powerapp.cloud
|
|
2474
2472
|
licenses:
|
2475
2473
|
- ISC
|
2476
2474
|
metadata: {}
|
2477
|
-
post_install_message:
|
2475
|
+
post_install_message:
|
2478
2476
|
rdoc_options: []
|
2479
2477
|
require_paths:
|
2480
2478
|
- lib
|
@@ -2485,12 +2483,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2485
2483
|
version: '0'
|
2486
2484
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2487
2485
|
requirements:
|
2488
|
-
- - "
|
2486
|
+
- - ">="
|
2489
2487
|
- !ruby/object:Gem::Version
|
2490
|
-
version:
|
2488
|
+
version: '0'
|
2491
2489
|
requirements: []
|
2492
2490
|
rubygems_version: 3.3.7
|
2493
|
-
signing_key:
|
2491
|
+
signing_key:
|
2494
2492
|
specification_version: 4
|
2495
2493
|
summary: Playbook Design System
|
2496
2494
|
test_files: []
|
@@ -1,121 +0,0 @@
|
|
1
|
-
/* @flow */
|
2
|
-
/* eslint-disable jsx-control-statements/jsx-use-if-tag */
|
3
|
-
import React, { useState } from 'react'
|
4
|
-
import { Flex, Image, Button, Body, FlexItem } from '../../'
|
5
|
-
import Lightbox from '../_lightbox.tsx'
|
6
|
-
|
7
|
-
const LightboxCurrentPhoto = (props) => {
|
8
|
-
const photos = [
|
9
|
-
'https://images.unsplash.com/photo-1638727228877-d2a79ab75e68?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2668&q=80',
|
10
|
-
'https://images.unsplash.com/photo-1526657782461-9fe13402a841?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1984&q=80',
|
11
|
-
'https://images.unsplash.com/photo-1523057530100-383d7fbc77a1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2669&q=80',
|
12
|
-
'https://images.unsplash.com/photo-1638727228877-d2a79ab75e68?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2668&q=80',
|
13
|
-
'https://images.unsplash.com/photo-1526657782461-9fe13402a841?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1984&q=80',
|
14
|
-
'https://images.unsplash.com/photo-1523057530100-383d7fbc77a1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2669&q=80',
|
15
|
-
'https://images.unsplash.com/photo-1638727228877-d2a79ab75e68?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2668&q=80',
|
16
|
-
'https://images.unsplash.com/photo-1526657782461-9fe13402a841?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1984&q=80',
|
17
|
-
'https://images.unsplash.com/photo-1523057530100-383d7fbc77a1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2669&q=80',
|
18
|
-
'https://images.unsplash.com/photo-1638727228877-d2a79ab75e68?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2668&q=80',
|
19
|
-
'https://images.unsplash.com/photo-1526657782461-9fe13402a841?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1984&q=80',
|
20
|
-
'https://images.unsplash.com/photo-1523057530100-383d7fbc77a1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2669&q=80',
|
21
|
-
'https://images.unsplash.com/photo-1638727228877-d2a79ab75e68?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2668&q=80',
|
22
|
-
'https://images.unsplash.com/photo-1526657782461-9fe13402a841?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1984&q=80',
|
23
|
-
'https://images.unsplash.com/photo-1523057530100-383d7fbc77a1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2669&q=80',
|
24
|
-
'https://images.unsplash.com/photo-1638727228877-d2a79ab75e68?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2668&q=80',
|
25
|
-
'https://images.unsplash.com/photo-1526657782461-9fe13402a841?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1984&q=80',
|
26
|
-
'https://images.unsplash.com/photo-1523057530100-383d7fbc77a1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2669&q=80',
|
27
|
-
'https://images.unsplash.com/photo-1523057530100-383d7fbc77a1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2669&q=80',
|
28
|
-
'https://images.unsplash.com/photo-1638727228877-d2a79ab75e68?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2668&q=80',
|
29
|
-
'https://images.unsplash.com/photo-1526657782461-9fe13402a841?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1984&q=80',
|
30
|
-
'https://images.unsplash.com/photo-1523057530100-383d7fbc77a1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2669&q=80',
|
31
|
-
]
|
32
|
-
const [light, toggleLight] = useState(false)
|
33
|
-
//Setting state with the index of the current slide exposed by the onChange prop
|
34
|
-
const [active, setActive] = useState(0)
|
35
|
-
//Setting state for the current photo to pass to the kit
|
36
|
-
const [currentPhoto, setCurrentPhoto] = useState(active)
|
37
|
-
|
38
|
-
const handleCloseLightbox = () => {
|
39
|
-
toggleLight(!light)
|
40
|
-
}
|
41
|
-
|
42
|
-
const onPhotoClick = () => {
|
43
|
-
toggleLight(!light)
|
44
|
-
}
|
45
|
-
|
46
|
-
const exampleStyles = {
|
47
|
-
width: "100%",
|
48
|
-
overflow: "auto"
|
49
|
-
}
|
50
|
-
|
51
|
-
return (
|
52
|
-
<div className="lightbox_doc_example_custom">
|
53
|
-
{light ? (
|
54
|
-
<>
|
55
|
-
<Flex alignItems="center"
|
56
|
-
className='custom_lightbox_sidebar'
|
57
|
-
justifyContent="center"
|
58
|
-
>
|
59
|
-
<Flex margin='lg'
|
60
|
-
orientation='column'
|
61
|
-
>
|
62
|
-
<Body marginBottom='md'>
|
63
|
-
This UI is for demonstration purposes only to demonstrate how external buttons can be used to change the slides.
|
64
|
-
</Body>
|
65
|
-
<FlexItem alignSelf="center">
|
66
|
-
<Flex justifyContent="center">
|
67
|
-
<Button
|
68
|
-
onClick={()=> setCurrentPhoto(active > 0 ? active - 1 : 0)}
|
69
|
-
>
|
70
|
-
Back
|
71
|
-
</Button>
|
72
|
-
<Button marginLeft='sm'
|
73
|
-
onClick={() => setCurrentPhoto(active < photos.length - 1 ? active + 1 : photos.length - 1)}
|
74
|
-
>
|
75
|
-
Next
|
76
|
-
</Button>
|
77
|
-
</Flex>
|
78
|
-
</FlexItem>
|
79
|
-
</Flex>
|
80
|
-
</Flex>
|
81
|
-
<Lightbox
|
82
|
-
currentPhotoIndex={currentPhoto}
|
83
|
-
icon="times"
|
84
|
-
onChange={(index) => setActive(index)}
|
85
|
-
onClose={handleCloseLightbox}
|
86
|
-
photos={photos}
|
87
|
-
{...props}
|
88
|
-
/>
|
89
|
-
</>
|
90
|
-
) : (
|
91
|
-
<div
|
92
|
-
className="PhotoViewer"
|
93
|
-
style={exampleStyles}
|
94
|
-
>
|
95
|
-
<Flex>
|
96
|
-
{photos.map((photo, index) => {
|
97
|
-
return (
|
98
|
-
<div
|
99
|
-
key={index}
|
100
|
-
onClick={() => onPhotoClick(index)}
|
101
|
-
>
|
102
|
-
<Image
|
103
|
-
cursor="pointer"
|
104
|
-
marginRight="xl"
|
105
|
-
rounded
|
106
|
-
size="lg"
|
107
|
-
url={photo}
|
108
|
-
/>
|
109
|
-
|
110
|
-
<div className="overlay" />
|
111
|
-
</div>
|
112
|
-
)
|
113
|
-
})}
|
114
|
-
</Flex>
|
115
|
-
</div>
|
116
|
-
)}
|
117
|
-
</div>
|
118
|
-
)
|
119
|
-
}
|
120
|
-
|
121
|
-
export default LightboxCurrentPhoto
|
@@ -1 +0,0 @@
|
|
1
|
-
The `currentPhotoIndex` prop allows the user to pass a number to the lightbox that will set the current slide by index. This can be leveraged if the user wants to change slides using custom buttons. To do this, the user must also make use of the current slide's index that is exposed by the `onChange` prop.
|