react-image-accordion 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc.json +14 -14
- package/.storybook/main.js +10 -10
- package/.storybook/preview.js +8 -8
- package/LICENSE +21 -21
- package/README.md +151 -151
- package/dist/index.es.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +65 -65
- package/rollup.config.js +38 -38
- package/src/components/Accordion/App.css +222 -207
- package/src/components/Accordion/React-image-accordion.js +22 -22
- package/src/components/Accordion/UseImageAccordion.js +131 -131
- package/src/components/Accordion/index.js +2 -2
- package/src/index.js +2 -2
- package/src/stories/MockAccordion.json +66 -66
- package/src/stories/UseImageAccordion.stories.js +20 -20
- package/src/stories/sprite.svg +48 -48
- package/src/svg/bitcoin-svgrepo-com.svg +0 -6
- package/src/svg/chrome-svgrepo-com.svg +0 -6
- package/src/svg/compare-svgrepo-com.svg +0 -6
- package/src/svg/document-check-svgrepo-com.svg +0 -7
- package/src/svg/document-file-with-line-svgrepo-com.svg +0 -6
- package/src/svg/gui-regex-svgrepo-com.svg +0 -6
- package/src/svg/image-svgrepo-com.svg +0 -6
- package/src/svg/npm-svgrepo-com.svg +0 -7
- package/src/svg/twitter-social-tweet-svgrepo-com.svg +0 -6
package/.babelrc.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"sourceType": "unambiguous",
|
|
3
|
-
"presets": [
|
|
4
|
-
[
|
|
5
|
-
"@babel/preset-env",
|
|
6
|
-
{
|
|
7
|
-
"targets": {
|
|
8
|
-
"chrome": 100
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"@babel/preset-react"
|
|
13
|
-
],
|
|
14
|
-
"plugins": []
|
|
1
|
+
{
|
|
2
|
+
"sourceType": "unambiguous",
|
|
3
|
+
"presets": [
|
|
4
|
+
[
|
|
5
|
+
"@babel/preset-env",
|
|
6
|
+
{
|
|
7
|
+
"targets": {
|
|
8
|
+
"chrome": 100
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"@babel/preset-react"
|
|
13
|
+
],
|
|
14
|
+
"plugins": []
|
|
15
15
|
}
|
package/.storybook/main.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"stories": ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
3
|
-
"addons": ["@storybook/addon-links", "@storybook/addon-essentials", "@storybook/addon-interactions", "@storybook/addon-mdx-gfm"],
|
|
4
|
-
"framework": {
|
|
5
|
-
name: "@storybook/react-webpack5",
|
|
6
|
-
options: {}
|
|
7
|
-
},
|
|
8
|
-
docs: {
|
|
9
|
-
autodocs: true
|
|
10
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
"stories": ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
3
|
+
"addons": ["@storybook/addon-links", "@storybook/addon-essentials", "@storybook/addon-interactions", "@storybook/addon-mdx-gfm"],
|
|
4
|
+
"framework": {
|
|
5
|
+
name: "@storybook/react-webpack5",
|
|
6
|
+
options: {}
|
|
7
|
+
},
|
|
8
|
+
docs: {
|
|
9
|
+
autodocs: true
|
|
10
|
+
}
|
|
11
11
|
};
|
package/.storybook/preview.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export const parameters = {
|
|
2
|
-
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
3
|
-
controls: {
|
|
4
|
-
matchers: {
|
|
5
|
-
color: /(background|color)$/i,
|
|
6
|
-
date: /Date$/,
|
|
7
|
-
},
|
|
8
|
-
},
|
|
1
|
+
export const parameters = {
|
|
2
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
3
|
+
controls: {
|
|
4
|
+
matchers: {
|
|
5
|
+
color: /(background|color)$/i,
|
|
6
|
+
date: /Date$/,
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
9
|
}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Masoud Naji
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Masoud Naji
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
# React Image Accordion
|
|
2
|
-
|
|
3
|
-
A simple and customizable React component that creates an image accordion with smooth animation, inspired by Kevin Powell's tutorial on [YouTube](https://www.youtube.com/watch?v=WJERnXiFFug&t=0s&ab_channel=KevinPowell).
|
|
4
|
-
|
|
5
|
-
The image accordion is a modern design pattern that can be used to display images and accompanying information in an interactive and engaging way. This component makes it easy to incorporate this pattern into your React projects.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
Use the package manager [npm](https://www.npmjs.com/) to install react-image-accordion.
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm i react-image-accordion
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
To use the component in your React application, import it and pass the necessary props:
|
|
22
|
-
|
|
23
|
-
```jsx
|
|
24
|
-
import {ReactImageAccordion} from 'react-image-accordion';
|
|
25
|
-
|
|
26
|
-
function MyComponent() {
|
|
27
|
-
const accordionData = [
|
|
28
|
-
{
|
|
29
|
-
id: 1,
|
|
30
|
-
title: "Boating",
|
|
31
|
-
image: "https://picsum.photos/400/600",
|
|
32
|
-
alt: "first panel image",
|
|
33
|
-
content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
|
|
34
|
-
svg: "aa (1).svg",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: 2,
|
|
38
|
-
title: "Fishing",
|
|
39
|
-
image: "https://picsum.photos/400/600",
|
|
40
|
-
alt: "second panel image",
|
|
41
|
-
content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
|
|
42
|
-
svg: "aa (2).svg",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: 3,
|
|
46
|
-
title: "Swimming",
|
|
47
|
-
image: "https://picsum.photos/400/600",
|
|
48
|
-
alt: "third panel image",
|
|
49
|
-
content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
|
|
50
|
-
svg: "aa (3).svg",
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
id: 4,
|
|
54
|
-
title: "Kayaking",
|
|
55
|
-
image: "https://picsum.photos/400/600",
|
|
56
|
-
alt: "fourth panel image",
|
|
57
|
-
content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
|
|
58
|
-
svg: "aa (4).svg",
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
id: 5,
|
|
62
|
-
title: "Scuba diving",
|
|
63
|
-
image: "https://picsum.photos/400/600",
|
|
64
|
-
alt: "fifth panel image",
|
|
65
|
-
content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
|
|
66
|
-
svg: "aa (5).svg",
|
|
67
|
-
},
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<ReactImageAccordion
|
|
72
|
-
accordionData={accordionData}
|
|
73
|
-
AccordionWidth={AccordionWidth}
|
|
74
|
-
AccordionHeight={AccordionHeight}
|
|
75
|
-
ContentSize=[ContentSize]
|
|
76
|
-
onClick={}
|
|
77
|
-
ShowButton={true/false}
|
|
78
|
-
/>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-

|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-

|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
| Property | type | Default | Description |
|
|
93
|
-
| ---------------- |:-------------:|:----------:|:-----------------------:|
|
|
94
|
-
| accordionData | json data | json file | Source File json |
|
|
95
|
-
| AccordionWidth | css /optional| 50rem | Accordion Width |
|
|
96
|
-
| AccordionHeight | css /optional| 30rem | Accordion Height |
|
|
97
|
-
| ContentSize |Array /optional|[0,1,2,3,4]*| Content font size |
|
|
98
|
-
| onClick | onCLick | | onClick ATC event |
|
|
99
|
-
| ShowButton | boolean | false | show or hid button |
|
|
100
|
-
|
|
101
|
-
*[0,1,2,3,4]
|
|
102
|
-
```
|
|
103
|
-
"@media (max-width: 480px)": {
|
|
104
|
-
fontSize: ContentSize[0] || "0.65rem",
|
|
105
|
-
},
|
|
106
|
-
"@media (min-width: 481px) and (max-width: 768px)": {
|
|
107
|
-
fontSize: ContentSize[1] || "0.8rem",
|
|
108
|
-
},
|
|
109
|
-
"@media (min-width: 769px) and (max-width: 1024px)": {
|
|
110
|
-
fontSize: ContentSize[2] || "1rem",
|
|
111
|
-
},
|
|
112
|
-
"@media (min-width: 1025px) and (max-width: 1200px)": {
|
|
113
|
-
fontSize: ContentSize[3] || "1.2rem",
|
|
114
|
-
},
|
|
115
|
-
"@media (min-width: 1201px)": {
|
|
116
|
-
fontSize: ContentSize[4] || "1.5rem",
|
|
117
|
-
},
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Sample Code
|
|
121
|
-
```React Code
|
|
122
|
-
import MockDocument from "./MOCK_DATA.json";
|
|
123
|
-
import { ReactImageAccordion } from "json-pretty-textarea";
|
|
124
|
-
export const test = () => {
|
|
125
|
-
return (
|
|
126
|
-
<ReactImageAccordion
|
|
127
|
-
accordionData= {MockAccordion}
|
|
128
|
-
AccordionWidth= "40rem"
|
|
129
|
-
AccordionHeight= "30rem"
|
|
130
|
-
ContentSize={[".5rem", ".5rem", ".6rem", ".7rem", "1.1rem"]}
|
|
131
|
-
ShowButton= {false},
|
|
132
|
-
onClick= {(e) => console.log(e.id, e.title)},
|
|
133
|
-
/>
|
|
134
|
-
);
|
|
135
|
-
};
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
***
|
|
140
|
-
## StoryBook Sample
|
|
141
|
-
[StoryBook]https://react-image-accordion.netlify.app/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
## Contributing
|
|
145
|
-
For major changes, please open an issue first to discuss what you would like to change.
|
|
146
|
-
|
|
147
|
-
Please make sure to update tests as appropriate.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
## License
|
|
151
|
-
[MIT](https://choosealicense.com/licenses/mit/)
|
|
1
|
+
# React Image Accordion
|
|
2
|
+
|
|
3
|
+
A simple and customizable React component that creates an image accordion with smooth animation, inspired by Kevin Powell's tutorial on [YouTube](https://www.youtube.com/watch?v=WJERnXiFFug&t=0s&ab_channel=KevinPowell).
|
|
4
|
+
|
|
5
|
+
The image accordion is a modern design pattern that can be used to display images and accompanying information in an interactive and engaging way. This component makes it easy to incorporate this pattern into your React projects.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Use the package manager [npm](https://www.npmjs.com/) to install react-image-accordion.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm i react-image-accordion
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
To use the component in your React application, import it and pass the necessary props:
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
import {ReactImageAccordion} from 'react-image-accordion';
|
|
25
|
+
|
|
26
|
+
function MyComponent() {
|
|
27
|
+
const accordionData = [
|
|
28
|
+
{
|
|
29
|
+
id: 1,
|
|
30
|
+
title: "Boating",
|
|
31
|
+
image: "https://picsum.photos/400/600",
|
|
32
|
+
alt: "first panel image",
|
|
33
|
+
content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
|
|
34
|
+
svg: "aa (1).svg",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 2,
|
|
38
|
+
title: "Fishing",
|
|
39
|
+
image: "https://picsum.photos/400/600",
|
|
40
|
+
alt: "second panel image",
|
|
41
|
+
content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
|
|
42
|
+
svg: "aa (2).svg",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 3,
|
|
46
|
+
title: "Swimming",
|
|
47
|
+
image: "https://picsum.photos/400/600",
|
|
48
|
+
alt: "third panel image",
|
|
49
|
+
content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
|
|
50
|
+
svg: "aa (3).svg",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 4,
|
|
54
|
+
title: "Kayaking",
|
|
55
|
+
image: "https://picsum.photos/400/600",
|
|
56
|
+
alt: "fourth panel image",
|
|
57
|
+
content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
|
|
58
|
+
svg: "aa (4).svg",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 5,
|
|
62
|
+
title: "Scuba diving",
|
|
63
|
+
image: "https://picsum.photos/400/600",
|
|
64
|
+
alt: "fifth panel image",
|
|
65
|
+
content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
|
|
66
|
+
svg: "aa (5).svg",
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<ReactImageAccordion
|
|
72
|
+
accordionData={accordionData}
|
|
73
|
+
AccordionWidth={AccordionWidth}
|
|
74
|
+
AccordionHeight={AccordionHeight}
|
|
75
|
+
ContentSize=[ContentSize]
|
|
76
|
+
onClick={}
|
|
77
|
+
ShowButton={true/false}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+

|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+

|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
| Property | type | Default | Description |
|
|
93
|
+
| ---------------- |:-------------:|:----------:|:-----------------------:|
|
|
94
|
+
| accordionData | json data | json file | Source File json |
|
|
95
|
+
| AccordionWidth | css /optional| 50rem | Accordion Width |
|
|
96
|
+
| AccordionHeight | css /optional| 30rem | Accordion Height |
|
|
97
|
+
| ContentSize |Array /optional|[0,1,2,3,4]*| Content font size |
|
|
98
|
+
| onClick | onCLick | | onClick ATC event |
|
|
99
|
+
| ShowButton | boolean | false | show or hid button |
|
|
100
|
+
|
|
101
|
+
*[0,1,2,3,4]
|
|
102
|
+
```
|
|
103
|
+
"@media (max-width: 480px)": {
|
|
104
|
+
fontSize: ContentSize[0] || "0.65rem",
|
|
105
|
+
},
|
|
106
|
+
"@media (min-width: 481px) and (max-width: 768px)": {
|
|
107
|
+
fontSize: ContentSize[1] || "0.8rem",
|
|
108
|
+
},
|
|
109
|
+
"@media (min-width: 769px) and (max-width: 1024px)": {
|
|
110
|
+
fontSize: ContentSize[2] || "1rem",
|
|
111
|
+
},
|
|
112
|
+
"@media (min-width: 1025px) and (max-width: 1200px)": {
|
|
113
|
+
fontSize: ContentSize[3] || "1.2rem",
|
|
114
|
+
},
|
|
115
|
+
"@media (min-width: 1201px)": {
|
|
116
|
+
fontSize: ContentSize[4] || "1.5rem",
|
|
117
|
+
},
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Sample Code
|
|
121
|
+
```React Code
|
|
122
|
+
import MockDocument from "./MOCK_DATA.json";
|
|
123
|
+
import { ReactImageAccordion } from "json-pretty-textarea";
|
|
124
|
+
export const test = () => {
|
|
125
|
+
return (
|
|
126
|
+
<ReactImageAccordion
|
|
127
|
+
accordionData= {MockAccordion}
|
|
128
|
+
AccordionWidth= "40rem"
|
|
129
|
+
AccordionHeight= "30rem"
|
|
130
|
+
ContentSize={[".5rem", ".5rem", ".6rem", ".7rem", "1.1rem"]}
|
|
131
|
+
ShowButton= {false},
|
|
132
|
+
onClick= {(e) => console.log(e.id, e.title)},
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
***
|
|
140
|
+
## StoryBook Sample
|
|
141
|
+
[StoryBook]https://react-image-accordion.netlify.app/
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## Contributing
|
|
145
|
+
For major changes, please open an issue first to discuss what you would like to change.
|
|
146
|
+
|
|
147
|
+
Please make sure to update tests as appropriate.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
package/dist/index.es.js
CHANGED
|
@@ -27,7 +27,7 @@ function styleInject(css, ref) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var css_248z = "*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nhtml {\n color-scheme: dark;\n}\n\nbody {\n display: grid;\n justify-content: center;\n align-content: center;\n min-height: 100vh;\n\n margin: 0;\n font-family: system-ui;\n font-size: 1.125rem;\n line-height: 1.6;\n}\n\nimg {\n max-width: 100%;\n display: block;\n}\n\n.wrapper {\n /* max-width: 50rem; */\n margin-inline: auto;\n padding-inline: 1rem;\n}\n\n.
|
|
30
|
+
var css_248z = "*,\r\n*::before,\r\n*::after {\r\n box-sizing: border-box;\r\n}\r\n\r\nhtml {\r\n color-scheme: dark;\r\n}\r\n\r\nbody {\r\n display: grid;\r\n justify-content: center;\r\n align-content: center;\r\n min-height: 100vh;\r\n\r\n margin: 0;\r\n font-family: system-ui;\r\n font-size: 1.125rem;\r\n line-height: 1.6;\r\n}\r\n\r\nimg {\r\n max-width: 100%;\r\n display: block;\r\n}\r\n\r\n.wrapper {\r\n /* max-width: 50rem; */\r\n margin-inline: auto;\r\n padding-inline: 1rem;\r\n}\r\n\r\n.accordionImage {\r\n --_button-size: 3rem;\r\n --_panel-padding: 0.75rem;\r\n --_panel-gap: 1rem;\r\n\r\n display: flex;\r\n flex-direction: column;\r\n gap: 1rem;\r\n}\r\n\r\n@media (min-width: 45em) {\r\n .accordionImage {\r\n flex-direction: row;\r\n height: 30rem;\r\n }\r\n}\r\n\r\n.accordionImage * {\r\n margin: 0;\r\n}\r\n\r\n.accordion-panel {\r\n position: relative;\r\n isolation: isolate;\r\n flex-basis: calc((var(--_panel-padding) * 2) + var(--_button-size));\r\n overflow: hidden;\r\n padding: var(--_panel-padding);\r\n padding-right: calc(var(--_panel-padding) * 4);\r\n border-radius: calc(((var(--_panel-padding) * 2) + var(--_button-size)) / 2);\r\n cursor: pointer;\r\n}\r\n\r\n@media (prefers-reduced-motion: no-preference) {\r\n .accordion-panel {\r\n transition: flex-basis 500ms, flex-grow 500ms;\r\n }\r\n}\r\n\r\n.accordion-panel:nth-child(1) {\r\n --_panel-color: red;\r\n}\r\n.accordion-panel:nth-child(2) {\r\n --_panel-color: blue;\r\n}\r\n.accordion-panel:nth-child(3) {\r\n --_panel-color: green;\r\n}\r\n.accordion-panel:nth-child(4) {\r\n --_panel-color: yellow;\r\n}\r\n.accordion-panel:nth-child(5) {\r\n --_panel-color: orange;\r\n}\r\n.accordion-panel:nth-child(6) {\r\n --_panel-color: purple;\r\n}\r\n.accordion-panel:nth-child(7) {\r\n --_panel-color: pink;\r\n}\r\n.accordion-panel:nth-child(8) {\r\n --_panel-color: brown;\r\n}\r\n.accordion-panel:nth-child(9) {\r\n --_panel-color: cyan;\r\n}\r\n.accordion-panel:nth-child(10) {\r\n --_panel-color: magenta;\r\n}\r\n\r\n.accordion-panel:has([aria-expanded=\"true\"]) {\r\n flex-basis: clamp(15rem, 40vh, 20rem);\r\n flex-grow: 1;\r\n}\r\n\r\n.accordion-trigger {\r\n outline: 0 !important;\r\n}\r\n\r\n.accordion-panel:focus-within {\r\n outline: 3px solid var(--_panel-color);\r\n outline-offset: 4px;\r\n}\r\n\r\n.accordion-content > p {\r\n transform: translateY(2rem);\r\n opacity: 0;\r\n margin-left: calc(var(--_button-size) + var(--_panel-gap));\r\n color: rgb(255, 255, 255) !important;\r\n}\r\n\r\n@media (prefers-reduced-motion: no-preference) {\r\n .accordion-panel:has([aria-expanded=\"true\"]) .accordion-content > p {\r\n transition: transform 500ms 500ms, opacity 500ms 500ms;\r\n }\r\n}\r\n\r\n.accordion-panel:has([aria-expanded=\"true\"]) .accordion-content > p {\r\n transform: translateY(0);\r\n opacity: 1;\r\n}\r\n\r\n.accordion-title {\r\n font-size: 1.5rem;\r\n font-weight: 700;\r\n position: relative;\r\n isolation: isolate;\r\n display: grid;\r\n align-items: center;\r\n color: rgb(255, 255, 255) !important;\r\n}\r\n\r\n.accordion-panel:has([aria-expanded=\"false\"]) .accordion-Link {\r\n display: none;\r\n}\r\n\r\n@media (max-width: 44.999em) {\r\n .accordion-panel {\r\n width: 100%;\r\n }\r\n\r\n .accordion-trigger {\r\n width: 100%;\r\n height: var(--_button-size);\r\n }\r\n\r\n .accordion-title {\r\n font-size: small;\r\n width: 100%;\r\n text-align: left;\r\n }\r\n .accordion-title::after {\r\n content: \"\";\r\n position: absolute;\r\n\r\n left: calc((var(--_panel-gap) + var(--_button-size)) * -1);\r\n width: calc(100% + (var(--_button-size) * 2));\r\n height: var(--_button-size);\r\n background: hsl(0 0% 0% /0.55);\r\n z-index: -1;\r\n border-radius: 100vw;\r\n }\r\n}\r\n\r\n.accordion-Link {\r\n all: revert;\r\n display: block;\r\n position: absolute;\r\n left: -0.1rem;\r\n bottom: 0;\r\n margin: 0.75rem;\r\n width: 10rem;\r\n height: var(--_button-size);\r\n background: hsl(0 0% 0% /0.55);\r\n border-radius: 100vw;\r\n padding: 0.75rem;\r\n font-weight: bolder;\r\n}\r\n\r\n.accordion-image {\r\n position: absolute;\r\n inset: 0;\r\n width: 100%;\r\n height: 100%;\r\n object-fit: cover;\r\n z-index: -1;\r\n transition: filer 500ms;\r\n}\r\n\r\n.accordion-panel:has([aria-expanded=\"true\"]) .accordion-image {\r\n filter: brightness(0.5);\r\n}\r\n.accordion-trigger {\r\n display: flex;\r\n align-items: center;\r\n flex-direction: row-reverse;\r\n gap: var(--_panel-gap);\r\n background: transparent;\r\n border: 0;\r\n padding: 0;\r\n}\r\n.accordion-icon {\r\n fill: var(--_panel-color);\r\n background: hsl(0 0% 0% /0.55);\r\n width: var(--_button-size);\r\n aspect-ratio: 1/1;\r\n padding: 0.75rem;\r\n border-radius: 50%;\r\n z-index: 10;\r\n}\r\n";
|
|
31
31
|
styleInject(css_248z);
|
|
32
32
|
|
|
33
33
|
function UseImageAccordion({
|
|
@@ -93,7 +93,7 @@ function UseImageAccordion({
|
|
|
93
93
|
}, /*#__PURE__*/React.createElement("style", {
|
|
94
94
|
scoped: true
|
|
95
95
|
}, HeightStyle), /*#__PURE__*/React.createElement("div", {
|
|
96
|
-
className: "
|
|
96
|
+
className: "accordionImage AccHeight"
|
|
97
97
|
}, accordionData.map(item => /*#__PURE__*/React.createElement("div", {
|
|
98
98
|
key: item.id,
|
|
99
99
|
className: "accordion-panel",
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ function styleInject(css, ref) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
var css_248z = "*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nhtml {\n color-scheme: dark;\n}\n\nbody {\n display: grid;\n justify-content: center;\n align-content: center;\n min-height: 100vh;\n\n margin: 0;\n font-family: system-ui;\n font-size: 1.125rem;\n line-height: 1.6;\n}\n\nimg {\n max-width: 100%;\n display: block;\n}\n\n.wrapper {\n /* max-width: 50rem; */\n margin-inline: auto;\n padding-inline: 1rem;\n}\n\n.
|
|
38
|
+
var css_248z = "*,\r\n*::before,\r\n*::after {\r\n box-sizing: border-box;\r\n}\r\n\r\nhtml {\r\n color-scheme: dark;\r\n}\r\n\r\nbody {\r\n display: grid;\r\n justify-content: center;\r\n align-content: center;\r\n min-height: 100vh;\r\n\r\n margin: 0;\r\n font-family: system-ui;\r\n font-size: 1.125rem;\r\n line-height: 1.6;\r\n}\r\n\r\nimg {\r\n max-width: 100%;\r\n display: block;\r\n}\r\n\r\n.wrapper {\r\n /* max-width: 50rem; */\r\n margin-inline: auto;\r\n padding-inline: 1rem;\r\n}\r\n\r\n.accordionImage {\r\n --_button-size: 3rem;\r\n --_panel-padding: 0.75rem;\r\n --_panel-gap: 1rem;\r\n\r\n display: flex;\r\n flex-direction: column;\r\n gap: 1rem;\r\n}\r\n\r\n@media (min-width: 45em) {\r\n .accordionImage {\r\n flex-direction: row;\r\n height: 30rem;\r\n }\r\n}\r\n\r\n.accordionImage * {\r\n margin: 0;\r\n}\r\n\r\n.accordion-panel {\r\n position: relative;\r\n isolation: isolate;\r\n flex-basis: calc((var(--_panel-padding) * 2) + var(--_button-size));\r\n overflow: hidden;\r\n padding: var(--_panel-padding);\r\n padding-right: calc(var(--_panel-padding) * 4);\r\n border-radius: calc(((var(--_panel-padding) * 2) + var(--_button-size)) / 2);\r\n cursor: pointer;\r\n}\r\n\r\n@media (prefers-reduced-motion: no-preference) {\r\n .accordion-panel {\r\n transition: flex-basis 500ms, flex-grow 500ms;\r\n }\r\n}\r\n\r\n.accordion-panel:nth-child(1) {\r\n --_panel-color: red;\r\n}\r\n.accordion-panel:nth-child(2) {\r\n --_panel-color: blue;\r\n}\r\n.accordion-panel:nth-child(3) {\r\n --_panel-color: green;\r\n}\r\n.accordion-panel:nth-child(4) {\r\n --_panel-color: yellow;\r\n}\r\n.accordion-panel:nth-child(5) {\r\n --_panel-color: orange;\r\n}\r\n.accordion-panel:nth-child(6) {\r\n --_panel-color: purple;\r\n}\r\n.accordion-panel:nth-child(7) {\r\n --_panel-color: pink;\r\n}\r\n.accordion-panel:nth-child(8) {\r\n --_panel-color: brown;\r\n}\r\n.accordion-panel:nth-child(9) {\r\n --_panel-color: cyan;\r\n}\r\n.accordion-panel:nth-child(10) {\r\n --_panel-color: magenta;\r\n}\r\n\r\n.accordion-panel:has([aria-expanded=\"true\"]) {\r\n flex-basis: clamp(15rem, 40vh, 20rem);\r\n flex-grow: 1;\r\n}\r\n\r\n.accordion-trigger {\r\n outline: 0 !important;\r\n}\r\n\r\n.accordion-panel:focus-within {\r\n outline: 3px solid var(--_panel-color);\r\n outline-offset: 4px;\r\n}\r\n\r\n.accordion-content > p {\r\n transform: translateY(2rem);\r\n opacity: 0;\r\n margin-left: calc(var(--_button-size) + var(--_panel-gap));\r\n color: rgb(255, 255, 255) !important;\r\n}\r\n\r\n@media (prefers-reduced-motion: no-preference) {\r\n .accordion-panel:has([aria-expanded=\"true\"]) .accordion-content > p {\r\n transition: transform 500ms 500ms, opacity 500ms 500ms;\r\n }\r\n}\r\n\r\n.accordion-panel:has([aria-expanded=\"true\"]) .accordion-content > p {\r\n transform: translateY(0);\r\n opacity: 1;\r\n}\r\n\r\n.accordion-title {\r\n font-size: 1.5rem;\r\n font-weight: 700;\r\n position: relative;\r\n isolation: isolate;\r\n display: grid;\r\n align-items: center;\r\n color: rgb(255, 255, 255) !important;\r\n}\r\n\r\n.accordion-panel:has([aria-expanded=\"false\"]) .accordion-Link {\r\n display: none;\r\n}\r\n\r\n@media (max-width: 44.999em) {\r\n .accordion-panel {\r\n width: 100%;\r\n }\r\n\r\n .accordion-trigger {\r\n width: 100%;\r\n height: var(--_button-size);\r\n }\r\n\r\n .accordion-title {\r\n font-size: small;\r\n width: 100%;\r\n text-align: left;\r\n }\r\n .accordion-title::after {\r\n content: \"\";\r\n position: absolute;\r\n\r\n left: calc((var(--_panel-gap) + var(--_button-size)) * -1);\r\n width: calc(100% + (var(--_button-size) * 2));\r\n height: var(--_button-size);\r\n background: hsl(0 0% 0% /0.55);\r\n z-index: -1;\r\n border-radius: 100vw;\r\n }\r\n}\r\n\r\n.accordion-Link {\r\n all: revert;\r\n display: block;\r\n position: absolute;\r\n left: -0.1rem;\r\n bottom: 0;\r\n margin: 0.75rem;\r\n width: 10rem;\r\n height: var(--_button-size);\r\n background: hsl(0 0% 0% /0.55);\r\n border-radius: 100vw;\r\n padding: 0.75rem;\r\n font-weight: bolder;\r\n}\r\n\r\n.accordion-image {\r\n position: absolute;\r\n inset: 0;\r\n width: 100%;\r\n height: 100%;\r\n object-fit: cover;\r\n z-index: -1;\r\n transition: filer 500ms;\r\n}\r\n\r\n.accordion-panel:has([aria-expanded=\"true\"]) .accordion-image {\r\n filter: brightness(0.5);\r\n}\r\n.accordion-trigger {\r\n display: flex;\r\n align-items: center;\r\n flex-direction: row-reverse;\r\n gap: var(--_panel-gap);\r\n background: transparent;\r\n border: 0;\r\n padding: 0;\r\n}\r\n.accordion-icon {\r\n fill: var(--_panel-color);\r\n background: hsl(0 0% 0% /0.55);\r\n width: var(--_button-size);\r\n aspect-ratio: 1/1;\r\n padding: 0.75rem;\r\n border-radius: 50%;\r\n z-index: 10;\r\n}\r\n";
|
|
39
39
|
styleInject(css_248z);
|
|
40
40
|
|
|
41
41
|
function UseImageAccordion({
|
|
@@ -101,7 +101,7 @@ function UseImageAccordion({
|
|
|
101
101
|
}, /*#__PURE__*/React__default["default"].createElement("style", {
|
|
102
102
|
scoped: true
|
|
103
103
|
}, HeightStyle), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
104
|
-
className: "
|
|
104
|
+
className: "accordionImage AccHeight"
|
|
105
105
|
}, accordionData.map(item => /*#__PURE__*/React__default["default"].createElement("div", {
|
|
106
106
|
key: item.id,
|
|
107
107
|
className: "accordion-panel",
|
package/package.json
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-image-accordion",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Accordion component for React",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.es.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"storybook": "storybook dev -p 6006",
|
|
10
|
-
"build-storybook": "storybook build",
|
|
11
|
-
"build-lib": "rollup -c"
|
|
12
|
-
},
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+ssh://git@github.com:masoud-naji/Accordion.git"
|
|
16
|
-
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
"react",
|
|
19
|
-
"accordion",
|
|
20
|
-
"react-accordion",
|
|
21
|
-
"accordion-component",
|
|
22
|
-
"react-accordion-component",
|
|
23
|
-
"react-component",
|
|
24
|
-
"accordion-react-component"
|
|
25
|
-
],
|
|
26
|
-
"author": "Masoud Naji",
|
|
27
|
-
"license": "MIT",
|
|
28
|
-
"bugs": {
|
|
29
|
-
"url": "https://github.com/masoud-naji/Accordion"
|
|
30
|
-
},
|
|
31
|
-
"homepage": "https://github.com/masoud-naji/Accordion",
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@babel/core": "^7.18.2",
|
|
34
|
-
"@babel/preset-env": "^7.21.4",
|
|
35
|
-
"@babel/preset-react": "^7.18.6",
|
|
36
|
-
"@rollup/plugin-babel": "^5.3.1",
|
|
37
|
-
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
38
|
-
"@storybook/addon-actions": "^7.0.7",
|
|
39
|
-
"@storybook/addon-essentials": "^7.0.7",
|
|
40
|
-
"@storybook/addon-interactions": "^7.0.7",
|
|
41
|
-
"@storybook/addon-links": "^7.0.7",
|
|
42
|
-
"@storybook/addon-mdx-gfm": "^7.0.7",
|
|
43
|
-
"@storybook/react": "^7.0.7",
|
|
44
|
-
"@storybook/react-webpack5": "^7.0.7",
|
|
45
|
-
"@storybook/testing-library": "^0.1.0",
|
|
46
|
-
"babel-loader": "^8.2.5",
|
|
47
|
-
"react": "^18.1.0",
|
|
48
|
-
"react-dom": "^18.1.0",
|
|
49
|
-
"rollup": "^2.79.1",
|
|
50
|
-
"rollup-plugin-babel": "^4.4.0",
|
|
51
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
52
|
-
"rollup-plugin-postcss": "^3.1.8",
|
|
53
|
-
"storybook": "^7.0.7"
|
|
54
|
-
},
|
|
55
|
-
"peerDependencies": {
|
|
56
|
-
"react": "^18.1.0",
|
|
57
|
-
"react-dom": "^18.1.0"
|
|
58
|
-
},
|
|
59
|
-
"dependencies": {
|
|
60
|
-
"@rollup/plugin-terser": "^0.4.1",
|
|
61
|
-
"react-image-accordion": "^1.1.6",
|
|
62
|
-
"rollup-plugin-local-resolve": "^1.0.7",
|
|
63
|
-
"rollup-plugin-terser": "^7.0.2"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-image-accordion",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Accordion component for React",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.es.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"storybook": "storybook dev -p 6006",
|
|
10
|
+
"build-storybook": "storybook build",
|
|
11
|
+
"build-lib": "rollup -c"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+ssh://git@github.com:masoud-naji/Accordion.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"react",
|
|
19
|
+
"accordion",
|
|
20
|
+
"react-accordion",
|
|
21
|
+
"accordion-component",
|
|
22
|
+
"react-accordion-component",
|
|
23
|
+
"react-component",
|
|
24
|
+
"accordion-react-component"
|
|
25
|
+
],
|
|
26
|
+
"author": "Masoud Naji",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/masoud-naji/Accordion"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/masoud-naji/Accordion",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@babel/core": "^7.18.2",
|
|
34
|
+
"@babel/preset-env": "^7.21.4",
|
|
35
|
+
"@babel/preset-react": "^7.18.6",
|
|
36
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
37
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
38
|
+
"@storybook/addon-actions": "^7.0.7",
|
|
39
|
+
"@storybook/addon-essentials": "^7.0.7",
|
|
40
|
+
"@storybook/addon-interactions": "^7.0.7",
|
|
41
|
+
"@storybook/addon-links": "^7.0.7",
|
|
42
|
+
"@storybook/addon-mdx-gfm": "^7.0.7",
|
|
43
|
+
"@storybook/react": "^7.0.7",
|
|
44
|
+
"@storybook/react-webpack5": "^7.0.7",
|
|
45
|
+
"@storybook/testing-library": "^0.1.0",
|
|
46
|
+
"babel-loader": "^8.2.5",
|
|
47
|
+
"react": "^18.1.0",
|
|
48
|
+
"react-dom": "^18.1.0",
|
|
49
|
+
"rollup": "^2.79.1",
|
|
50
|
+
"rollup-plugin-babel": "^4.4.0",
|
|
51
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
52
|
+
"rollup-plugin-postcss": "^3.1.8",
|
|
53
|
+
"storybook": "^7.0.7"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react": "^18.1.0",
|
|
57
|
+
"react-dom": "^18.1.0"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@rollup/plugin-terser": "^0.4.1",
|
|
61
|
+
"react-image-accordion": "^1.1.6",
|
|
62
|
+
"rollup-plugin-local-resolve": "^1.0.7",
|
|
63
|
+
"rollup-plugin-terser": "^7.0.2"
|
|
64
|
+
}
|
|
65
|
+
}
|