@codebit-programando-solucoes/codebit-web-antd 1.1.48 → 1.1.50

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.
Files changed (2) hide show
  1. package/dist/index.cjs +7 -8
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -779,6 +779,7 @@ var __webpack_exports__ = {};
779
779
  document.documentElement.classList.remove('dark-theme');
780
780
  target.classList.remove('dark-theme');
781
781
  }
782
+ document.documentElement.style.colorScheme = isDarkMode ? 'dark' : 'light';
782
783
  document.documentElement.style.setProperty('--color-primary', resolvedColors.primary[isDarkMode ? 'dark' : 'light']);
783
784
  }, [
784
785
  isDarkMode,
@@ -1169,11 +1170,6 @@ var __webpack_exports__ = {};
1169
1170
  const ThemeToggle = ()=>{
1170
1171
  const config = (0, external_react_.useContext)(CodebitThemeContext);
1171
1172
  if (!config) throw new Error('ThemeToggle must be used within CodebitThemeContext');
1172
- (0, external_react_.useEffect)(()=>{
1173
- document.documentElement.style.colorScheme = config.isDarkMode ? 'dark' : 'light';
1174
- }, [
1175
- config.isDarkMode
1176
- ]);
1177
1173
  return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Switch, {
1178
1174
  theme: config.isDarkMode ? 'dark' : 'light',
1179
1175
  checked: config.isDarkMode,
@@ -1691,10 +1687,13 @@ var __webpack_exports__ = {};
1691
1687
  };
1692
1688
  const togglePlay = async ()=>{
1693
1689
  if (!audioRef.current || !hasSource) return;
1694
- if (audioRef.current.paused) {
1690
+ if (audioRef.current.paused) try {
1695
1691
  await audioRef.current.play();
1696
1692
  setIsPlaying(true);
1697
- } else {
1693
+ } catch {
1694
+ setIsPlaying(false);
1695
+ }
1696
+ else {
1698
1697
  audioRef.current.pause();
1699
1698
  setIsPlaying(false);
1700
1699
  }
@@ -1714,7 +1713,6 @@ var __webpack_exports__ = {};
1714
1713
  if (audioRef.current && audioUrl) {
1715
1714
  audioRef.current.pause();
1716
1715
  audioRef.current.currentTime = 0;
1717
- audioRef.current.src = audioUrl;
1718
1716
  audioRef.current.load();
1719
1717
  }
1720
1718
  setIsPlaying(false);
@@ -1788,6 +1786,7 @@ var __webpack_exports__ = {};
1788
1786
  }),
1789
1787
  /*#__PURE__*/ (0, jsx_runtime.jsx)("audio", {
1790
1788
  ref: audioRef,
1789
+ src: audioUrl,
1791
1790
  onTimeUpdate: (e)=>{
1792
1791
  if (!isPlaying) return;
1793
1792
  const audioElement = e.target;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebit-programando-solucoes/codebit-web-antd",
3
- "version": "1.1.48",
3
+ "version": "1.1.50",
4
4
  "main": "./dist/index.cjs",
5
5
  "type": "module",
6
6
  "types": "./src/index.d.ts",