@livo-tv/blocks 0.0.1 → 1.0.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/README.md +6 -6
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# @livo/blocks
|
|
1
|
+
# @livo-tv/blocks
|
|
2
2
|
|
|
3
3
|
Shared UI components for [Livo](https://github.com/livo-tv) applications.
|
|
4
4
|
|
|
5
|
-
The main entry is a Client Component boundary (`"use client"`). Import avatar helpers from `@livo/blocks/avatar` in React Server Components.
|
|
5
|
+
The main entry is a Client Component boundary (`"use client"`). Import avatar helpers from `@livo-tv/blocks/avatar` in React Server Components.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
pnpm add @livo/blocks
|
|
10
|
+
pnpm add @livo-tv/blocks
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Optional peers:
|
|
@@ -21,7 +21,7 @@ Optional peers:
|
|
|
21
21
|
Scan the built package so utilities are not purged:
|
|
22
22
|
|
|
23
23
|
```css
|
|
24
|
-
@source "../../node_modules/@livo/blocks/dist/*.{js,cjs,mjs}";
|
|
24
|
+
@source "../../node_modules/@livo-tv/blocks/dist/*.{js,cjs,mjs}";
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Consumers must define the same shadcn CSS variables (`--primary`, `--background`, `--muted`, …) that Livo frontends already ship.
|
|
@@ -29,7 +29,7 @@ Consumers must define the same shadcn CSS variables (`--primary`, `--background`
|
|
|
29
29
|
## Video
|
|
30
30
|
|
|
31
31
|
```tsx
|
|
32
|
-
import { VideoPlayer } from "@livo/blocks";
|
|
32
|
+
import { VideoPlayer } from "@livo-tv/blocks";
|
|
33
33
|
|
|
34
34
|
<VideoPlayer
|
|
35
35
|
src={playbackUrl}
|
|
@@ -44,7 +44,7 @@ The package is reporting-agnostic. Wire `onError` / `onFirstPlay` in the app.
|
|
|
44
44
|
## Avatar
|
|
45
45
|
|
|
46
46
|
```tsx
|
|
47
|
-
import { AvatarEditorDialog } from "@livo/blocks";
|
|
47
|
+
import { AvatarEditorDialog } from "@livo-tv/blocks";
|
|
48
48
|
|
|
49
49
|
<AvatarEditorDialog
|
|
50
50
|
value={preview}
|
package/dist/index.cjs
CHANGED
|
@@ -2068,8 +2068,12 @@ function AvatarEditorDialog({
|
|
|
2068
2068
|
}) {
|
|
2069
2069
|
const [isOpen, setIsOpen] = React3.useState(false);
|
|
2070
2070
|
const [editedValue, setEditedValue] = React3.useState(value ?? null);
|
|
2071
|
+
const [displaySrc, setDisplaySrc] = React3.useState(value ?? null);
|
|
2071
2072
|
const [isSaving, setIsSaving] = React3.useState(false);
|
|
2072
2073
|
const [feedback, setFeedback] = React3.useState(null);
|
|
2074
|
+
React3.useEffect(() => {
|
|
2075
|
+
setDisplaySrc(value ?? null);
|
|
2076
|
+
}, [value]);
|
|
2073
2077
|
const isMobile = useMediaQuery("(max-width: 640px)");
|
|
2074
2078
|
const caption = (placeholder ?? "").trim();
|
|
2075
2079
|
const handleOpenChange = React3.useCallback(
|
|
@@ -2090,6 +2094,7 @@ function AvatarEditorDialog({
|
|
|
2090
2094
|
if (onSave) {
|
|
2091
2095
|
const result = await onSave(editedValue);
|
|
2092
2096
|
if (result) {
|
|
2097
|
+
setDisplaySrc(editedValue);
|
|
2093
2098
|
onChange?.(editedValue);
|
|
2094
2099
|
setFeedback({ type: "success", message: successMessage });
|
|
2095
2100
|
setTimeout(() => {
|
|
@@ -2100,6 +2105,7 @@ function AvatarEditorDialog({
|
|
|
2100
2105
|
setFeedback({ type: "error", message: errorMessage });
|
|
2101
2106
|
}
|
|
2102
2107
|
} else {
|
|
2108
|
+
setDisplaySrc(editedValue);
|
|
2103
2109
|
onChange?.(editedValue);
|
|
2104
2110
|
setFeedback({ type: "success", message: successMessage });
|
|
2105
2111
|
setTimeout(() => {
|
|
@@ -2127,9 +2133,9 @@ function AvatarEditorDialog({
|
|
|
2127
2133
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2128
2134
|
SafeImage,
|
|
2129
2135
|
{
|
|
2130
|
-
src:
|
|
2136
|
+
src: displaySrc,
|
|
2131
2137
|
alt: "Avatar",
|
|
2132
|
-
className: "absolute object-cover",
|
|
2138
|
+
className: "absolute inset-0 h-full w-full object-cover",
|
|
2133
2139
|
fallback: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2134
2140
|
"div",
|
|
2135
2141
|
{
|