@bouko/react 2.7.8 → 2.8.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.
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ style?: string;
3
+ progress: number;
4
+ };
5
+ declare const ProgressBar: ({ style, progress }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export default ProgressBar;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "@bouko/style";
3
+ const ProgressBar = ({ style, progress }) => (_jsx("div", { className: cn(styles.container, style), children: _jsx("div", { className: styles.filled, style: { width: (progress * 100) + "%" } }) }));
4
+ const styles = {
5
+ container: "flex grow h-1 rounded-full bg-gray-800/70 overflow-hidden",
6
+ filled: "h-full bg-accent"
7
+ };
8
+ export default ProgressBar;
@@ -0,0 +1,4 @@
1
+ import type { RefObject } from "react";
2
+ export type DivRef = RefObject<HTMLDivElement | null>;
3
+ export type AudioRef = RefObject<HTMLAudioElement | null>;
4
+ export declare function withAudio(ref: AudioRef, fn: (el: HTMLAudioElement) => void): void;
@@ -0,0 +1,6 @@
1
+ export function withAudio(ref, fn) {
2
+ const el = ref.current;
3
+ if (!el)
4
+ return;
5
+ return fn(el);
6
+ }
@@ -3,3 +3,4 @@ export { default as useContainer } from "./element/container";
3
3
  export { default as useResize } from "./element/resize";
4
4
  export { default as useInterval } from "./clock/interval";
5
5
  export { default as useSound } from "./audio/sound";
6
+ export { withAudio } from "./element/with-audio";
@@ -3,3 +3,4 @@ export { default as useContainer } from "./element/container";
3
3
  export { default as useResize } from "./element/resize";
4
4
  export { default as useInterval } from "./clock/interval";
5
5
  export { default as useSound } from "./audio/sound";
6
+ export { withAudio } from "./element/with-audio";
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { default as MultipleChoice } from "./components/multiple-choice";
5
5
  export { default as Attachment } from "./components/attachment";
6
6
  export { default as CheckBox } from "./components/checkbox";
7
7
  export { default as FadeCarousel } from "./components/fade-carousel";
8
+ export { default as ProgressBar } from "./components/progress";
8
9
  export * from "./components";
9
10
  export * from "./components/search-bar";
10
11
  export * from "./core/types";
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ export { default as MultipleChoice } from "./components/multiple-choice";
5
5
  export { default as Attachment } from "./components/attachment";
6
6
  export { default as CheckBox } from "./components/checkbox";
7
7
  export { default as FadeCarousel } from "./components/fade-carousel";
8
+ export { default as ProgressBar } from "./components/progress";
8
9
  export * from "./components";
9
10
  export * from "./components/search-bar";
10
11
  export * from "./core/types";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "2.7.8",
4
+ "version": "2.8.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",