this.gui 1.0.15 → 1.0.16
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/README.md +0 -39
- package/dist/style.css +1 -1
- package/dist/this-gui.es.js +3751 -1882
- package/dist/this-gui.umd.js +34 -22
- package/package.json +14 -12
- package/src/App.jsx +50 -21
- package/src/SiteBuilder.jsx +39 -0
- package/src/index.mdx +10 -0
- package/src/main.jsx +11 -14
- package/src/scripts/verifyLayouts.js +175 -0
- package/src/scripts/verifyTemplates.js +154 -0
- package/src/stories/Atoms/Alert/Alert.css +196 -14
- package/src/stories/Atoms/Alert/Alert.jsx +43 -28
- package/src/stories/Atoms/Alert/Alert.stories.jsx +154 -28
- package/src/stories/Atoms/Audio/Audio.css +246 -16
- package/src/stories/Atoms/Audio/Audio.jsx +204 -29
- package/src/stories/Atoms/Audio/Audio.stories.jsx +178 -28
- package/src/stories/Atoms/Badge/Badge.css +234 -15
- package/src/stories/Atoms/Badge/Badge.jsx +44 -31
- package/src/stories/Atoms/Badge/Badge.stories.jsx +108 -29
- package/src/stories/Atoms/Button/Button.css +106 -45
- package/src/stories/Atoms/Button/Button.jsx +31 -82
- package/src/stories/Atoms/Button/Button.stories.jsx +170 -40
- package/src/stories/Atoms/Caption/Caption.css +156 -16
- package/src/stories/Atoms/Caption/Caption.jsx +62 -31
- package/src/stories/Atoms/Caption/Caption.stories.jsx +194 -28
- package/src/stories/Atoms/Checkbox/Checkbox.css +168 -15
- package/src/stories/Atoms/Checkbox/Checkbox.jsx +73 -31
- package/src/stories/Atoms/Checkbox/Checkbox.stories.jsx +98 -27
- package/src/stories/Atoms/Container/Container.css +75 -15
- package/src/stories/Atoms/Container/Container.jsx +41 -28
- package/src/stories/Atoms/Container/Container.stories.jsx +92 -29
- package/src/stories/Atoms/Divider/Divider.css +131 -13
- package/src/stories/Atoms/Divider/Divider.jsx +54 -33
- package/src/stories/Atoms/Divider/Divider.stories.jsx +93 -29
- package/src/stories/Atoms/Heading/Heading.css +99 -16
- package/src/stories/Atoms/Heading/Heading.jsx +57 -29
- package/src/stories/Atoms/Heading/Heading.stories.jsx +117 -28
- package/src/stories/Atoms/Icon/Icon.css +219 -27
- package/src/stories/Atoms/Icon/Icon.jsx +67 -38
- package/src/stories/Atoms/Icon/Icon.stories.jsx +156 -51
- package/src/stories/Atoms/Image/Image.css +231 -15
- package/src/stories/Atoms/Image/Image.jsx +166 -32
- package/src/stories/Atoms/Image/Image.stories.jsx +319 -28
- package/src/stories/Atoms/Label/Label.css +158 -16
- package/src/stories/Atoms/Label/Label.jsx +61 -31
- package/src/stories/Atoms/Label/Label.stories.jsx +167 -28
- package/src/stories/Atoms/Link/Link.css +58 -16
- package/src/stories/Atoms/Link/Link.jsx +73 -32
- package/src/stories/Atoms/Link/Link.stories.jsx +141 -29
- package/src/stories/Atoms/Loader/Loader.css +93 -16
- package/src/stories/Atoms/Loader/Loader.jsx +47 -30
- package/src/stories/Atoms/Loader/Loader.stories.jsx +86 -28
- package/src/stories/Atoms/Logo/Logo.css +94 -0
- package/src/stories/Atoms/Logo/Logo.jsx +53 -0
- package/src/stories/Atoms/Logo/Logo.stories.jsx +120 -0
- package/src/stories/Atoms/Paragraph/Paragraph.css +167 -16
- package/src/stories/Atoms/Paragraph/Paragraph.jsx +67 -31
- package/src/stories/Atoms/Paragraph/Paragraph.stories.jsx +130 -28
- package/src/stories/Atoms/ProgressBar/ProgressBar.css +115 -17
- package/src/stories/Atoms/ProgressBar/ProgressBar.jsx +30 -31
- package/src/stories/Atoms/ProgressBar/ProgressBar.stories.jsx +72 -27
- package/src/stories/Atoms/RadioButton/RadioButton.css +118 -17
- package/src/stories/Atoms/RadioButton/RadioButton.jsx +77 -31
- package/src/stories/Atoms/RadioButton/RadioButton.stories.jsx +99 -27
- package/src/stories/Atoms/Range/Range.css +169 -0
- package/src/stories/Atoms/Range/Range.jsx +87 -0
- package/src/stories/Atoms/Range/Range.stories.jsx +110 -0
- package/src/stories/Atoms/Select/Select.css +74 -16
- package/src/stories/Atoms/Select/Select.jsx +62 -30
- package/src/stories/Atoms/Select/Select.stories.jsx +95 -27
- package/src/stories/Atoms/Slider/Slider.css +77 -16
- package/src/stories/Atoms/Slider/Slider.jsx +119 -31
- package/src/stories/Atoms/Slider/Slider.stories.jsx +77 -28
- package/src/stories/Atoms/Snackbar/Snackbar.css +297 -13
- package/src/stories/Atoms/Snackbar/Snackbar.jsx +62 -31
- package/src/stories/Atoms/Snackbar/Snackbar.stories.jsx +63 -26
- package/src/stories/Atoms/Spacer/Spacer.css +101 -16
- package/src/stories/Atoms/Spacer/Spacer.jsx +26 -32
- package/src/stories/Atoms/Spacer/Spacer.stories.jsx +50 -30
- package/src/stories/Atoms/Spinner/Spinner.css +97 -16
- package/src/stories/Atoms/Spinner/Spinner.jsx +50 -26
- package/src/stories/Atoms/Spinner/Spinner.stories.jsx +47 -30
- package/src/stories/Atoms/Tag/Tag.css +97 -14
- package/src/stories/Atoms/Tag/Tag.jsx +58 -24
- package/src/stories/Atoms/Tag/Tag.stories.jsx +55 -29
- package/src/stories/Atoms/TextArea/TextArea.css +84 -15
- package/src/stories/Atoms/TextArea/TextArea.jsx +107 -31
- package/src/stories/Atoms/TextArea/TextArea.stories.jsx +24 -30
- package/src/stories/Atoms/TextInput/TextInput.css +89 -17
- package/src/stories/Atoms/TextInput/TextInput.jsx +118 -27
- package/src/stories/Atoms/TextInput/TextInput.stories.jsx +52 -25
- package/src/stories/Atoms/Toggle/Toggle.css +105 -17
- package/src/stories/Atoms/Toggle/Toggle.jsx +55 -28
- package/src/stories/Atoms/Toggle/Toggle.stories.jsx +23 -30
- package/src/stories/Atoms/Tooltip/Tooltip.css +367 -14
- package/src/stories/Atoms/Tooltip/Tooltip.jsx +32 -28
- package/src/stories/Atoms/Tooltip/Tooltip.stories.jsx +41 -31
- package/src/stories/Atoms/Video/Video.css +27 -18
- package/src/stories/Atoms/Video/Video.jsx +65 -29
- package/src/stories/Atoms/Video/Video.stories.jsx +29 -30
- package/src/stories/Atoms/index.js +5 -2
- package/src/stories/Atoms/meta_Atoms.js +3 -1
- package/src/stories/Layouts/Accordion/Accordion.css +16 -0
- package/src/stories/Layouts/Accordion/Accordion.jsx +31 -0
- package/src/stories/Layouts/Accordion/Accordion.stories.jsx +28 -0
- package/src/stories/Layouts/DropdownMenu/DropdownMenu.css +16 -0
- package/src/stories/Layouts/DropdownMenu/DropdownMenu.jsx +31 -0
- package/src/stories/Layouts/DropdownMenu/DropdownMenu.stories.jsx +28 -0
- package/src/stories/Layouts/Flexbox/Flexbox.css +16 -0
- package/src/stories/Layouts/Flexbox/Flexbox.jsx +11 -0
- package/src/stories/Layouts/Flexbox/Flexbox.stories.jsx +28 -0
- package/src/stories/Layouts/Footer/Footer.css +16 -0
- package/src/stories/Layouts/Footer/Footer.jsx +31 -0
- package/src/stories/Layouts/Footer/Footer.stories.jsx +28 -0
- package/src/stories/Layouts/Grid/Grid.jsx +2 -4
- package/src/stories/Layouts/Grid/Grid.stories.jsx +20 -18
- package/src/stories/Layouts/Header/Header.css +16 -0
- package/src/stories/Layouts/Header/Header.jsx +31 -0
- package/src/stories/Layouts/Header/Header.stories.jsx +28 -0
- package/src/stories/Layouts/HeroBanner/HeroBanner.css +16 -0
- package/src/stories/Layouts/HeroBanner/HeroBanner.jsx +31 -0
- package/src/stories/Layouts/HeroBanner/HeroBanner.stories.jsx +28 -0
- package/src/stories/Layouts/HeroImageVideo/HeroImageVideo.css +16 -0
- package/src/stories/Layouts/HeroImageVideo/HeroImageVideo.jsx +31 -0
- package/src/stories/Layouts/HeroImageVideo/HeroImageVideo.stories.jsx +28 -0
- package/src/stories/Layouts/Pagination/Pagination.css +16 -0
- package/src/stories/Layouts/Pagination/Pagination.jsx +31 -0
- package/src/stories/Layouts/Pagination/Pagination.stories.jsx +28 -0
- package/src/stories/Layouts/Section/Section.css +16 -0
- package/src/stories/Layouts/Section/Section.jsx +31 -0
- package/src/stories/Layouts/Section/Section.stories.jsx +28 -0
- package/src/stories/Layouts/Sidebar/Sidebar.css +16 -0
- package/src/stories/Layouts/Sidebar/Sidebar.jsx +71 -0
- package/src/stories/Layouts/Sidebar/Sidebar.stories.jsx +28 -0
- package/src/stories/Layouts/Tabs/Tabs.css +16 -0
- package/src/stories/Layouts/Tabs/Tabs.jsx +31 -0
- package/src/stories/Layouts/Tabs/Tabs.stories.jsx +28 -0
- package/src/stories/Layouts/index.js +31 -0
- package/src/stories/Layouts/meta_Layouts.js +31 -0
- package/src/stories/Molecules/Navbar/Navbar.css +63 -59
- package/src/stories/Molecules/Navbar/Navbar.jsx +43 -48
- package/src/stories/Molecules/Navbar/Navbar.stories.jsx +58 -8
- package/src/stories/Molecules/SearchBar/SearchBar.css +66 -1
- package/src/stories/Molecules/SearchBar/SearchBar.jsx +59 -11
- package/src/stories/Molecules/SearchBar/SearchBar.stories.jsx +16 -7
- package/src/stories/Molecules/SelectTheme/SelectTheme.jsx +16 -38
- package/src/stories/Molecules/SelectTheme/SelectTheme.stories.jsx +1 -2
- package/src/stories/Molecules/Sidebar/Sidebar.css +65 -2
- package/src/stories/Molecules/Sidebar/Sidebar.jsx +66 -11
- package/src/stories/Molecules/Sidebar/Sidebar.stories.jsx +20 -5
- package/src/stories/Templates/AdminDashboard/AdminDashboard.css +7 -0
- package/src/stories/Templates/AdminDashboard/AdminDashboard.jsx +24 -0
- package/src/stories/Templates/AdminDashboard/AdminDashboard.stories.jsx +20 -0
- package/src/stories/Templates/CallToAction/CallToAction.css +7 -0
- package/src/stories/Templates/CallToAction/CallToAction.jsx +24 -0
- package/src/stories/Templates/CallToAction/CallToAction.stories.jsx +20 -0
- package/src/stories/Templates/FeaturesList/FeaturesList.css +7 -0
- package/src/stories/Templates/FeaturesList/FeaturesList.jsx +24 -0
- package/src/stories/Templates/FeaturesList/FeaturesList.stories.jsx +20 -0
- package/src/stories/Templates/FormSection/FormSection.css +7 -0
- package/src/stories/Templates/FormSection/FormSection.jsx +24 -0
- package/src/stories/Templates/FormSection/FormSection.stories.jsx +20 -0
- package/src/stories/Templates/HeroSection/HeroSection.css +7 -0
- package/src/stories/Templates/HeroSection/HeroSection.jsx +24 -0
- package/src/stories/Templates/HeroSection/HeroSection.stories.jsx +20 -0
- package/src/stories/Templates/LocationInfo/LocationInfo.css +7 -0
- package/src/stories/Templates/LocationInfo/LocationInfo.jsx +24 -0
- package/src/stories/Templates/LocationInfo/LocationInfo.stories.jsx +20 -0
- package/src/stories/Templates/ProductPage/ProductPage.css +7 -0
- package/src/stories/Templates/ProductPage/ProductPage.jsx +24 -0
- package/src/stories/Templates/ProductPage/ProductPage.stories.jsx +20 -0
- package/src/stories/Templates/RegistrationPage/RegistrationPage.css +7 -0
- package/src/stories/Templates/RegistrationPage/RegistrationPage.jsx +24 -0
- package/src/stories/Templates/RegistrationPage/RegistrationPage.stories.jsx +20 -0
- package/src/stories/Templates/ShoppingCart/ShoppingCart.css +7 -0
- package/src/stories/Templates/ShoppingCart/ShoppingCart.jsx +24 -0
- package/src/stories/Templates/ShoppingCart/ShoppingCart.stories.jsx +20 -0
- package/src/stories/Templates/SidebarTopNav/SidebarTopNav.css +7 -0
- package/src/stories/Templates/SidebarTopNav/SidebarTopNav.jsx +24 -0
- package/src/stories/Templates/SidebarTopNav/SidebarTopNav.stories.jsx +20 -0
- package/src/stories/Templates/SignInPage/SignInPage.css +7 -0
- package/src/stories/Templates/SignInPage/SignInPage.jsx +24 -0
- package/src/stories/Templates/SignInPage/SignInPage.stories.jsx +20 -0
- package/src/stories/Templates/SocialMediaLinks/SocialMediaLinks.css +7 -0
- package/src/stories/Templates/SocialMediaLinks/SocialMediaLinks.jsx +24 -0
- package/src/stories/Templates/SocialMediaLinks/SocialMediaLinks.stories.jsx +20 -0
- package/src/stories/Templates/Testimonials/Testimonials.css +7 -0
- package/src/stories/Templates/Testimonials/Testimonials.jsx +24 -0
- package/src/stories/Templates/Testimonials/Testimonials.stories.jsx +20 -0
- package/src/stories/Templates/index.js +33 -0
- package/src/stories/Templates/{Templates.js → meta_Templates.js} +3 -1
- package/src/stories/assets/logo.png +0 -0
- package/src/stories/assets/logo.svg +106 -0
- package/src/stories/assets/test.svg +3 -0
- package/src/themes/README.md +301 -0
- package/src/themes/ThemeProvider.jsx +47 -22
- package/src/themes/styles/dracula/dark.css +0 -0
- package/src/themes/styles/dracula/light.css +0 -0
- package/src/themes/styles/github/dark.css +0 -0
- package/src/themes/styles/github/light.css +0 -0
- package/src/themes/styles/neurons/dark.css +247 -0
- package/src/themes/styles/neurons/light.css +280 -0
- package/dist/github-3688a83a.js +0 -5
- package/dist/gothic-94a7ecd6.js +0 -5
- package/dist/newsprint-32bf94d9.js +0 -5
- package/dist/night-4a954853.js +0 -5
- package/dist/pixyll-94de4610.js +0 -5
- package/dist/whitey-db68723e.js +0 -5
- package/src/MDXEditor.jsx +0 -32
- package/src/stories/Atoms/RangeInput/RangeInput.css +0 -29
- package/src/stories/Atoms/RangeInput/RangeInput.jsx +0 -41
- package/src/stories/Atoms/RangeInput/RangeInput.stories.jsx +0 -41
- package/src/stories/Components.md +0 -189
- package/src/stories/Layouts/Layout.js +0 -28
- package/src/styles/Header.modules.css +0 -32
- package/src/styles/global.css +0 -59
- package/src/themes/Themes.js +0 -44
- package/src/themes/dark.js +0 -22
- package/src/themes/light.js +0 -22
- package/src/themes/typ/Readme.md +0 -4
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-700.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-700italic.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-italic.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-regular.woff2 +0 -0
- package/src/themes/typ/github.css +0 -416
- package/src/themes/typ/gothic/GUST e-foundry License.txt +0 -29
- package/src/themes/typ/gothic/didact-gothic-c-ext.woff2 +0 -0
- package/src/themes/typ/gothic/didact-gothic-c.woff2 +0 -0
- package/src/themes/typ/gothic/texgyreadventor-bold.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-bolditalic.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-italic.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-regular.woff +0 -0
- package/src/themes/typ/gothic.css +0 -410
- package/src/themes/typ/newsprint/pt-serif-v11-latin-700.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-700italic.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-italic.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-regular.woff2 +0 -0
- package/src/themes/typ/newsprint.css +0 -622
- package/src/themes/typ/night/codeblock.dark.css +0 -113
- package/src/themes/typ/night/credit.html +0 -1
- package/src/themes/typ/night/cursor.png +0 -0
- package/src/themes/typ/night/cursor@2x.png +0 -0
- package/src/themes/typ/night/mermaid.dark.css +0 -7
- package/src/themes/typ/night/sourcemode.dark.css +0 -38
- package/src/themes/typ/night.css +0 -1032
- package/src/themes/typ/pixyll/lato-v14-latin-300.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-300italic.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-900.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-900italic.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-300.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-300italic.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-700.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-700italic.woff +0 -0
- package/src/themes/typ/pixyll.css +0 -528
- package/src/themes/typ/whitey.css +0 -299
- /package/src/stories/Molecules/{Molecules.js → meta_Molecules.js} +0 -0
- /package/src/stories/Organisms/{Organisms.js → meta_Organisms.js} +0 -0
|
@@ -1,29 +1,259 @@
|
|
|
1
|
+
/* src/stories/Atoms/Audio/Audio.css */
|
|
1
2
|
|
|
3
|
+
/* Base Audio Player Styles */
|
|
2
4
|
.audio {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
background-color:
|
|
6
|
-
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
background-color: rgba(245, 245, 245, 0.3); /* Subtle grey with low opacity */
|
|
8
|
+
padding: var(--spacing-sm, 8px);
|
|
9
|
+
border-radius: var(--border-radius, 6px);
|
|
10
|
+
gap: var(--spacing-sm, 8px);
|
|
11
|
+
max-width: 300px; /* Default for medium size */
|
|
12
|
+
border: 1px solid var(--border-color, #dddddd); /* Added border */
|
|
13
|
+
position: relative;
|
|
14
|
+
transition: background-color var(--transition-speed, 0.3s);
|
|
7
15
|
}
|
|
8
16
|
|
|
9
|
-
.audio
|
|
10
|
-
background-color:
|
|
11
|
-
border-color: #1e88e5;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.audio--secondary {
|
|
15
|
-
background-color: #fff;
|
|
16
|
-
border-color: #ccc;
|
|
17
|
+
.audio:hover {
|
|
18
|
+
background-color: rgba(245, 245, 245, 0.5);
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
/* Size Variants */
|
|
19
22
|
.audio--small {
|
|
20
|
-
|
|
23
|
+
max-width: 200px;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
.audio--medium {
|
|
24
|
-
|
|
27
|
+
max-width: 300px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Color Classes */
|
|
31
|
+
.audio--classy-color-1 {
|
|
32
|
+
--icon-color: var(--classy-color-1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.audio--classy-color-2 {
|
|
36
|
+
--icon-color: var(--classy-color-2);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.audio--classy-color-3 {
|
|
40
|
+
--icon-color: var(--classy-color-3);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.audio--classy-color-4 {
|
|
44
|
+
--icon-color: var(--classy-color-4);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.audio--classy-color-5 {
|
|
48
|
+
--icon-color: var(--classy-color-5);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.audio--small-switch-color-1 {
|
|
52
|
+
--icon-color: var(--small-switch-color-1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.audio--small-switch-color-2 {
|
|
56
|
+
--icon-color: var(--small-switch-color-2);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.audio--natural-color-1 {
|
|
60
|
+
--icon-color: var(--natural-color-1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.audio--natural-color-2 {
|
|
64
|
+
--icon-color: var(--natural-color-2);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.audio--natural-color-3 {
|
|
68
|
+
--icon-color: var(--natural-color-3);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.audio--grey-friend-1 {
|
|
72
|
+
--icon-color: var(--grey-friend-1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.audio--grey-friend-2 {
|
|
76
|
+
--icon-color: var(--grey-friend-2);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.audio--shade-1 {
|
|
80
|
+
--icon-color: var(--shade-1);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.audio--shade-2 {
|
|
84
|
+
--icon-color: var(--shade-2);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.audio--shade-3 {
|
|
88
|
+
--icon-color: var(--shade-3);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.audio--shade-4 {
|
|
92
|
+
--icon-color: var(--shade-4);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Play/Pause and Mute Buttons */
|
|
96
|
+
.audio__play-pause,
|
|
97
|
+
.audio__mute {
|
|
98
|
+
background-color: rgba(128, 128, 128, 0.2); /* Slightly darker grey */
|
|
99
|
+
border: none;
|
|
100
|
+
border-radius: 50%;
|
|
101
|
+
padding: var(--spacing-xs, 6px);
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
transition: background-color var(--transition-speed, 0.3s);
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: center;
|
|
107
|
+
color: var(--icon-color, #344b47); /* Default icon color */
|
|
25
108
|
}
|
|
26
109
|
|
|
27
|
-
.
|
|
28
|
-
|
|
110
|
+
.audio__play-pause:hover,
|
|
111
|
+
.audio__mute:hover {
|
|
112
|
+
background-color: rgba(128, 128, 128, 0.4); /* Darker on hover */
|
|
29
113
|
}
|
|
114
|
+
|
|
115
|
+
/* Time Display and Seek Slider */
|
|
116
|
+
.audio__seek {
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
gap: var(--spacing-xs, 4px);
|
|
120
|
+
flex: 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.audio__seek-slider {
|
|
124
|
+
width: 100%;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
appearance: none;
|
|
127
|
+
height: 4px;
|
|
128
|
+
background: var(--grey-friend-2, #96b1ac);
|
|
129
|
+
border-radius: 2px;
|
|
130
|
+
outline: none;
|
|
131
|
+
transition: background var(--transition-speed, 0.3s);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.audio__seek-slider::-webkit-slider-thumb {
|
|
135
|
+
appearance: none;
|
|
136
|
+
width: 12px;
|
|
137
|
+
height: 12px;
|
|
138
|
+
background: var(--icon-color, #344b47);
|
|
139
|
+
border-radius: 50%;
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
margin-top: -4px; /* Center the thumb */
|
|
142
|
+
transition: background var(--transition-speed, 0.3s);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.audio__seek-slider::-moz-range-thumb {
|
|
146
|
+
width: 12px;
|
|
147
|
+
height: 12px;
|
|
148
|
+
background: var(--icon-color, #344b47);
|
|
149
|
+
border-radius: 50%;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
transition: background var(--transition-speed, 0.3s);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.audio__seek-slider:hover {
|
|
155
|
+
background: var(--grey-friend-1, #344b47);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.audio__seek-slider:hover::-webkit-slider-thumb,
|
|
159
|
+
.audio__seek-slider:hover::-moz-range-thumb {
|
|
160
|
+
background: var(--icon-color, #344b47);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.audio__time {
|
|
164
|
+
font-size: var(--font-size-small, 0.9em);
|
|
165
|
+
color: var(--icon-color, #344b47); /* Inherit icon color */
|
|
166
|
+
white-space: nowrap;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Volume Container */
|
|
170
|
+
.audio__volume-container {
|
|
171
|
+
position: relative;
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* Volume Slider */
|
|
177
|
+
.audio__volume-slider {
|
|
178
|
+
position: absolute;
|
|
179
|
+
bottom: -30px;
|
|
180
|
+
left: 50%;
|
|
181
|
+
transform: translateX(-50%);
|
|
182
|
+
width: 100px;
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
appearance: none;
|
|
185
|
+
height: 4px;
|
|
186
|
+
background: var(--grey-friend-2, #96b1ac);
|
|
187
|
+
border-radius: 2px;
|
|
188
|
+
outline: none;
|
|
189
|
+
transition: opacity var(--transition-speed, 0.3s);
|
|
190
|
+
opacity: 0;
|
|
191
|
+
pointer-events: none;
|
|
192
|
+
z-index: 10;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.audio__volume-slider.visible {
|
|
196
|
+
opacity: 1;
|
|
197
|
+
pointer-events: auto;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.audio__volume-slider::-webkit-slider-thumb {
|
|
201
|
+
appearance: none;
|
|
202
|
+
width: 12px;
|
|
203
|
+
height: 12px;
|
|
204
|
+
background: var(--icon-color, #344b47);
|
|
205
|
+
border-radius: 50%;
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
transition: background var(--transition-speed, 0.3s);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.audio__volume-slider::-moz-range-thumb {
|
|
211
|
+
width: 12px;
|
|
212
|
+
height: 12px;
|
|
213
|
+
background: var(--icon-color, #344b47);
|
|
214
|
+
border-radius: 50%;
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
transition: background var(--transition-speed, 0.3s);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.audio__volume-slider:hover {
|
|
220
|
+
background: var(--grey-friend-1, #344b47);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.audio__volume-slider:hover::-webkit-slider-thumb,
|
|
224
|
+
.audio__volume-slider:hover::-moz-range-thumb {
|
|
225
|
+
background: var(--icon-color, #344b47);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Show Volume Slider on Hover or When Toggled */
|
|
229
|
+
.audio:hover .audio__volume-slider,
|
|
230
|
+
.audio__volume-slider.visible {
|
|
231
|
+
opacity: 1;
|
|
232
|
+
pointer-events: auto;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* Responsive Adjustments */
|
|
236
|
+
@media (max-width: 768px) {
|
|
237
|
+
.audio--small {
|
|
238
|
+
max-width: 150px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.audio--medium {
|
|
242
|
+
max-width: 250px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.audio {
|
|
246
|
+
flex-direction: column;
|
|
247
|
+
align-items: flex-start;
|
|
248
|
+
gap: var(--spacing-xs, 4px);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.audio__seek {
|
|
252
|
+
width: 100%;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.audio__volume-slider {
|
|
256
|
+
bottom: -35px;
|
|
257
|
+
width: 80px;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
@@ -1,41 +1,216 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
1
|
+
// src/stories/Atoms/Audio/Audio.jsx
|
|
2
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { FaPlay, FaPause, FaVolumeUp, FaVolumeMute } from 'react-icons/fa';
|
|
4
5
|
import './Audio.css';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export const Audio = ({
|
|
8
|
+
src,
|
|
9
|
+
autoPlay = false,
|
|
10
|
+
loop = false,
|
|
11
|
+
muted = false,
|
|
12
|
+
size = 'medium',
|
|
13
|
+
color = 'classy-color-1',
|
|
14
|
+
className = '',
|
|
15
|
+
style = {},
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const audioRef = useRef(null);
|
|
19
|
+
const [isPlaying, setIsPlaying] = useState(autoPlay);
|
|
20
|
+
const [isMuted, setIsMuted] = useState(muted);
|
|
21
|
+
const [volume, setVolume] = useState(muted ? 0 : 1);
|
|
22
|
+
const [currentTime, setCurrentTime] = useState(0);
|
|
23
|
+
const [duration, setDuration] = useState(0);
|
|
24
|
+
const [showVolumeSlider, setShowVolumeSlider] = useState(false);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const audio = audioRef.current;
|
|
28
|
+
if (audio) {
|
|
29
|
+
audio.volume = volume;
|
|
30
|
+
audio.muted = isMuted;
|
|
31
|
+
if (autoPlay) {
|
|
32
|
+
audio.play().catch(() => setIsPlaying(false));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, [volume, isMuted, autoPlay]);
|
|
36
|
+
|
|
37
|
+
const togglePlayPause = () => {
|
|
38
|
+
const audio = audioRef.current;
|
|
39
|
+
if (!audio) return;
|
|
40
|
+
|
|
41
|
+
if (isPlaying) {
|
|
42
|
+
audio.pause();
|
|
43
|
+
} else {
|
|
44
|
+
audio.play().catch(() => setIsPlaying(false));
|
|
45
|
+
}
|
|
46
|
+
setIsPlaying(!isPlaying);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const handleTimeUpdate = () => {
|
|
50
|
+
const audio = audioRef.current;
|
|
51
|
+
if (audio) {
|
|
52
|
+
setCurrentTime(audio.currentTime);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleLoadedMetadata = () => {
|
|
57
|
+
const audio = audioRef.current;
|
|
58
|
+
if (audio) {
|
|
59
|
+
setDuration(audio.duration);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const handleVolumeChange = (e) => {
|
|
64
|
+
const newVolume = parseFloat(e.target.value);
|
|
65
|
+
setVolume(newVolume);
|
|
66
|
+
setIsMuted(newVolume === 0);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const toggleMute = () => {
|
|
70
|
+
setIsMuted(!isMuted);
|
|
71
|
+
setVolume(!isMuted ? 0 : 1);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const handleSeekChange = (e) => {
|
|
75
|
+
const seekTime = parseFloat(e.target.value);
|
|
76
|
+
const audio = audioRef.current;
|
|
77
|
+
if (audio) {
|
|
78
|
+
audio.currentTime = seekTime;
|
|
79
|
+
setCurrentTime(seekTime);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const formatTime = (time) => {
|
|
84
|
+
if (isNaN(time)) return '00:00';
|
|
85
|
+
const minutes = Math.floor(time / 60);
|
|
86
|
+
const seconds = Math.floor(time % 60);
|
|
87
|
+
const paddedSeconds = seconds < 10 ? `0${seconds}` : seconds;
|
|
88
|
+
return `${minutes}:${paddedSeconds}`;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Combined handler to toggle mute and show volume slider
|
|
92
|
+
const handleMuteAndShowSlider = (e) => {
|
|
93
|
+
toggleMute();
|
|
94
|
+
setShowVolumeSlider((prev) => !prev);
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Close volume slider when clicking outside
|
|
99
|
+
const handleClickOutside = (e) => {
|
|
100
|
+
if (!e.target.closest('.audio__volume-container')) {
|
|
101
|
+
setShowVolumeSlider(false);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (showVolumeSlider) {
|
|
107
|
+
document.addEventListener('click', handleClickOutside);
|
|
108
|
+
} else {
|
|
109
|
+
document.removeEventListener('click', handleClickOutside);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return () => {
|
|
113
|
+
document.removeEventListener('click', handleClickOutside);
|
|
114
|
+
};
|
|
115
|
+
}, [showVolumeSlider]);
|
|
116
|
+
|
|
117
|
+
const variantClass = `audio--${size}`;
|
|
118
|
+
const colorClass = `audio--${color}`;
|
|
119
|
+
const combinedClassName = `audio ${variantClass} ${colorClass} ${className}`.trim();
|
|
120
|
+
|
|
11
121
|
return (
|
|
12
122
|
<div
|
|
13
|
-
className={
|
|
123
|
+
className={combinedClassName}
|
|
124
|
+
style={style}
|
|
14
125
|
{...props}
|
|
15
126
|
>
|
|
16
|
-
|
|
127
|
+
<audio
|
|
128
|
+
ref={audioRef}
|
|
129
|
+
src={src}
|
|
130
|
+
loop={loop}
|
|
131
|
+
onTimeUpdate={handleTimeUpdate}
|
|
132
|
+
onLoadedMetadata={handleLoadedMetadata}
|
|
133
|
+
onEnded={() => setIsPlaying(false)}
|
|
134
|
+
>
|
|
135
|
+
Your browser does not support the audio element.
|
|
136
|
+
</audio>
|
|
137
|
+
<button
|
|
138
|
+
className="audio__play-pause"
|
|
139
|
+
onClick={togglePlayPause}
|
|
140
|
+
aria-label={isPlaying ? 'Pause' : 'Play'}
|
|
141
|
+
>
|
|
142
|
+
{isPlaying ? <FaPause /> : <FaPlay />}
|
|
143
|
+
</button>
|
|
144
|
+
<div className="audio__seek">
|
|
145
|
+
<input
|
|
146
|
+
type="range"
|
|
147
|
+
className="audio__seek-slider"
|
|
148
|
+
min="0"
|
|
149
|
+
max={duration}
|
|
150
|
+
step="0.1"
|
|
151
|
+
value={currentTime}
|
|
152
|
+
onChange={handleSeekChange}
|
|
153
|
+
aria-label="Seek Slider"
|
|
154
|
+
/>
|
|
155
|
+
<div className="audio__time">
|
|
156
|
+
<span>{formatTime(currentTime)}</span> / <span>{formatTime(duration)}</span>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
<div className="audio__volume-container">
|
|
160
|
+
<button
|
|
161
|
+
className="audio__mute"
|
|
162
|
+
onClick={handleMuteAndShowSlider}
|
|
163
|
+
aria-label={isMuted ? 'Unmute' : 'Mute'}
|
|
164
|
+
>
|
|
165
|
+
{isMuted ? <FaVolumeMute /> : <FaVolumeUp />}
|
|
166
|
+
</button>
|
|
167
|
+
<input
|
|
168
|
+
type="range"
|
|
169
|
+
className={`audio__volume-slider ${showVolumeSlider ? 'visible' : ''}`}
|
|
170
|
+
min="0"
|
|
171
|
+
max="1"
|
|
172
|
+
step="0.01"
|
|
173
|
+
value={isMuted ? 0 : volume}
|
|
174
|
+
onChange={handleVolumeChange}
|
|
175
|
+
aria-label="Volume Slider"
|
|
176
|
+
/>
|
|
177
|
+
</div>
|
|
17
178
|
</div>
|
|
18
179
|
);
|
|
19
180
|
};
|
|
20
181
|
|
|
21
182
|
Audio.propTypes = {
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
183
|
+
/** Source URL of the audio file */
|
|
184
|
+
src: PropTypes.string.isRequired,
|
|
185
|
+
/** Autoplay the audio on load */
|
|
186
|
+
autoPlay: PropTypes.bool,
|
|
187
|
+
/** Loop the audio playback */
|
|
188
|
+
loop: PropTypes.bool,
|
|
189
|
+
/** Mute the audio by default */
|
|
190
|
+
muted: PropTypes.bool,
|
|
191
|
+
/** Size of the audio player */
|
|
192
|
+
size: PropTypes.oneOf(['small', 'medium']),
|
|
193
|
+
/** Color from the global palettes */
|
|
194
|
+
color: PropTypes.oneOf([
|
|
195
|
+
'classy-color-1',
|
|
196
|
+
'classy-color-2',
|
|
197
|
+
'classy-color-3',
|
|
198
|
+
'classy-color-4',
|
|
199
|
+
'classy-color-5',
|
|
200
|
+
'small-switch-color-1',
|
|
201
|
+
'small-switch-color-2',
|
|
202
|
+
'natural-color-1',
|
|
203
|
+
'natural-color-2',
|
|
204
|
+
'natural-color-3',
|
|
205
|
+
'grey-friend-1',
|
|
206
|
+
'grey-friend-2',
|
|
207
|
+
'shade-1',
|
|
208
|
+
'shade-2',
|
|
209
|
+
'shade-3',
|
|
210
|
+
'shade-4',
|
|
211
|
+
]),
|
|
212
|
+
/** Additional CSS classes */
|
|
213
|
+
className: PropTypes.string,
|
|
214
|
+
/** Inline styles */
|
|
215
|
+
style: PropTypes.object,
|
|
216
|
+
};
|