rockin 0.0.42 → 0.0.44
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/dist/{chunk-GL2CQ5TR.js → chunk-23GWTX3S.js} +15 -4
- package/dist/{chunk-4ILCWFOE.js → chunk-53MRWZE4.js} +1 -1
- package/dist/{chunk-YA5PSI7E.js → chunk-VFN3HOYP.js} +15 -3
- package/dist/hooks/index.js +3 -3
- package/dist/index.d.ts +41 -4
- package/dist/index.js +6 -4
- package/dist/layout.js +1 -1
- package/dist/lib/index.d.ts +3 -120
- package/dist/lib/index.js +3 -1
- package/dist/preferences-CvWGOnty.d.ts +158 -0
- package/dist/provider.js +2 -2
- package/dist/ui/bridge.js +1 -1
- package/dist/ui/carousel.js +71 -1
- package/dist/ui/code-block.js +2 -2
- package/dist/ui/drawer-dialog.js +3 -3
- package/dist/ui/farmer/div.js +3 -3
- package/dist/ui/image.js +286 -66
- package/dist/ui/index.d.ts +495 -11
- package/dist/ui/index.js +4 -3
- package/dist/ui/list.js +32 -10
- package/dist/ui/sonner.js +2 -2
- package/dist/ui/theme-switcher.js +2 -2
- package/dist/ui/theme-toggle.js +2 -2
- package/dist/ui/ui-agent.js +81 -0
- package/package.json +1 -1
package/dist/ui/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export { Bubble, BubbleContent, BubbleGroup, BubbleReactions } from "./bubble.js
|
|
|
10
10
|
export { Button, buttonVariants } from "./button.js"
|
|
11
11
|
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants } from "./button-group.js"
|
|
12
12
|
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./card.js"
|
|
13
|
-
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel } from "./carousel.js"
|
|
13
|
+
export { Carousel, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, useCarousel } from "./carousel.js"
|
|
14
14
|
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent } from "./chart.js"
|
|
15
15
|
export { Checkbox } from "./checkbox.js"
|
|
16
16
|
export { CodeBlock } from "./code-block.js"
|
|
@@ -29,7 +29,7 @@ export { default as AnimatedDiv } from "./farmer/div.js"
|
|
|
29
29
|
export { BlogCardAnimation, Bottom, FadeContainer, ListItemVariant, Top, activityItemAnimation, fromLeftChildren, fromLeftVariant, fromRightVariant, fromTopVariant, hamFastFadeContainer, headingFromLeft, kanbanOrderCardAnimation, kanbanOrderCardLayoutTransition, kanbanOrderCardReducedMotionAnimation, mobileNavItemSideways, opacityVariant, popUp, popUpFromBottomForText, searchBarSlideAnimation, svgVariant } from "./farmer/variants.js"
|
|
30
30
|
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./field.js"
|
|
31
31
|
export { DEFAULT_I18N, DEFAULT_OPERATORS, Filters, FiltersContent, createFilter, createFilterGroup } from "./filters.js"
|
|
32
|
-
export { Image } from "./image.js"
|
|
32
|
+
export { Image, ImageFallback, ImagePlaceholder, ImageProvider, ImageRoot, ImageSource } from "./image.js"
|
|
33
33
|
export { Input } from "./input.js"
|
|
34
34
|
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea } from "./input-group.js"
|
|
35
35
|
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, REGEXP_ONLY_DIGITS } from "./input-otp.js"
|
|
@@ -37,7 +37,7 @@ export { Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup,
|
|
|
37
37
|
export { BlobSpeech, JellyAction, JellyBlob, JellyBlobMascot, JellyBlobMascotDemo, JellyEmpty, JellyGroup, JellyLink, JellyMascot, JellyMini, useJellyMood } from "./jelly.js"
|
|
38
38
|
export { Kbd, KbdGroup } from "./kbd.js"
|
|
39
39
|
export { Label } from "./label.js"
|
|
40
|
-
export { List, ListGroup, ListItem, ListLabel, createListController, listItemVariants } from "./list.js"
|
|
40
|
+
export { List, ListGroup, ListItem, ListLabel, createListController, listItemVariants, listPrimitive } from "./list.js"
|
|
41
41
|
export { Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader } from "./message.js"
|
|
42
42
|
export { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility } from "./message-scroller.js"
|
|
43
43
|
export { NumberStepper, RollingNumber } from "./numberstepper.js"
|
|
@@ -59,3 +59,4 @@ export { Textarea } from "./textarea.js"
|
|
|
59
59
|
export { ThemeSwitcher } from "./theme-switcher.js"
|
|
60
60
|
export { ThemeToggle } from "./theme-toggle.js"
|
|
61
61
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js"
|
|
62
|
+
export { UiAgent } from "./ui-agent.js"
|
package/dist/ui/list.js
CHANGED
|
@@ -64,20 +64,20 @@ var list = definePrimitive({
|
|
|
64
64
|
}
|
|
65
65
|
const { orientation } = store.get();
|
|
66
66
|
if (orientation === "grid") return spatial(event, ctx);
|
|
67
|
-
const { items, from, rtl } = ctx;
|
|
68
|
-
if (!
|
|
69
|
-
if (event.key === "Home") return
|
|
70
|
-
if (event.key === "End") return
|
|
67
|
+
const { items: items2, from, rtl } = ctx;
|
|
68
|
+
if (!items2.length) return;
|
|
69
|
+
if (event.key === "Home") return items2[0].key;
|
|
70
|
+
if (event.key === "End") return items2[items2.length - 1].key;
|
|
71
71
|
let step = steps[orientation][event.key];
|
|
72
72
|
if (step === void 0) return;
|
|
73
73
|
if (orientation === "horizontal" && rtl) step = -step;
|
|
74
|
-
const index =
|
|
74
|
+
const index = items2.findIndex((item) => item.key === from.key);
|
|
75
75
|
let next = index + step;
|
|
76
|
-
if (next < 0 || next >=
|
|
76
|
+
if (next < 0 || next >= items2.length) {
|
|
77
77
|
if (!options().loop) return from.key;
|
|
78
|
-
next = (next +
|
|
78
|
+
next = (next + items2.length) % items2.length;
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return items2[next].key;
|
|
81
81
|
};
|
|
82
82
|
const roving = createRovingFocus(
|
|
83
83
|
context,
|
|
@@ -100,8 +100,25 @@ var list = definePrimitive({
|
|
|
100
100
|
const highlight = (key) => {
|
|
101
101
|
if (store.get().highlighted !== key) store.set({ highlighted: key });
|
|
102
102
|
};
|
|
103
|
+
const enabled = () => roving.items().filter((item) => !item.props?.disabled);
|
|
104
|
+
const items = () => enabled().map((item) => ({
|
|
105
|
+
value: item.key,
|
|
106
|
+
label: (item.el.getAttribute("aria-label") ?? item.el.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 80)
|
|
107
|
+
}));
|
|
103
108
|
return {
|
|
104
109
|
focus: (value) => roving.focus(value),
|
|
110
|
+
items,
|
|
111
|
+
open(target) {
|
|
112
|
+
const wanted = items().find(
|
|
113
|
+
(item) => item.value === target || item.label.toLowerCase().includes(target.toLowerCase())
|
|
114
|
+
);
|
|
115
|
+
if (!wanted) {
|
|
116
|
+
throw new Error(
|
|
117
|
+
`No item "${target}". Items: ${items().map((item) => item.label).join(", ")}`
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
enabled().find((item) => item.key === wanted.value)?.el.click();
|
|
121
|
+
},
|
|
105
122
|
internal: {
|
|
106
123
|
roving,
|
|
107
124
|
keydown(event, el) {
|
|
@@ -259,7 +276,11 @@ var list = definePrimitive({
|
|
|
259
276
|
});
|
|
260
277
|
}
|
|
261
278
|
})
|
|
262
|
-
})
|
|
279
|
+
}),
|
|
280
|
+
agent: {
|
|
281
|
+
actions: ["open", "focus"],
|
|
282
|
+
items: (api) => api.items()
|
|
283
|
+
}
|
|
263
284
|
});
|
|
264
285
|
var Parts = createParts(list, {
|
|
265
286
|
root: "div",
|
|
@@ -353,5 +374,6 @@ export {
|
|
|
353
374
|
ListItem,
|
|
354
375
|
ListLabel,
|
|
355
376
|
createListController,
|
|
356
|
-
listItemVariants
|
|
377
|
+
listItemVariants,
|
|
378
|
+
list as listPrimitive
|
|
357
379
|
};
|
package/dist/ui/sonner.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "../chunk-ILKXRTV2.js";
|
|
5
5
|
import {
|
|
6
6
|
useTheme
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-VFN3HOYP.js";
|
|
8
|
+
import "../chunk-23GWTX3S.js";
|
|
9
9
|
|
|
10
10
|
// src/ui/theme-switcher.tsx
|
|
11
11
|
import { Display, Moon, Sun } from "@gravity-ui/icons";
|
package/dist/ui/theme-toggle.js
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/ui/ui-agent.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
var stateAttrs = [
|
|
6
|
+
"data-highlighted",
|
|
7
|
+
"data-active",
|
|
8
|
+
"data-open",
|
|
9
|
+
"data-pressed",
|
|
10
|
+
"data-disabled",
|
|
11
|
+
"data-pointer-hidden",
|
|
12
|
+
"aria-current",
|
|
13
|
+
"aria-expanded",
|
|
14
|
+
"aria-selected",
|
|
15
|
+
"aria-checked",
|
|
16
|
+
"aria-disabled"
|
|
17
|
+
];
|
|
18
|
+
var localHosts = /^(localhost|127\.0\.0\.1|\[::1\]|0\.0\.0\.0)$|\.(local|localhost)$/;
|
|
19
|
+
function brief(el) {
|
|
20
|
+
if (!el || el === document.body) return null;
|
|
21
|
+
const name = (el.getAttribute("aria-label") ?? el.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 60);
|
|
22
|
+
const state = stateAttrs.filter((attr) => el.hasAttribute(attr)).map((attr) => {
|
|
23
|
+
const value = el.getAttribute(attr);
|
|
24
|
+
return value ? `${attr}=${value}` : attr;
|
|
25
|
+
});
|
|
26
|
+
if (el === document.activeElement) state.push("focused");
|
|
27
|
+
return {
|
|
28
|
+
tag: el.tagName.toLowerCase(),
|
|
29
|
+
slot: el.getAttribute("data-slot") ?? void 0,
|
|
30
|
+
role: el.getAttribute("role") ?? void 0,
|
|
31
|
+
name: name || void 0,
|
|
32
|
+
state: state.length ? state : void 0
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function isLocal() {
|
|
36
|
+
return process.env.NODE_ENV === "development" || localHosts.test(window.location.hostname);
|
|
37
|
+
}
|
|
38
|
+
function UiAgent({ prod = false }) {
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
if (!prod && !isLocal()) return;
|
|
41
|
+
let cancelled = false;
|
|
42
|
+
import("@ui-sdk/react/agent").then(({ createAgent }) => {
|
|
43
|
+
if (cancelled || window.agent) return;
|
|
44
|
+
const agent = createAgent();
|
|
45
|
+
window.agent = agent;
|
|
46
|
+
window.ui = {
|
|
47
|
+
snap: () => agent.snapshot().filter((entry) => !entry.offPage).map(({ ref, component, label, actions, ...rest }) => ({
|
|
48
|
+
ref,
|
|
49
|
+
component,
|
|
50
|
+
label,
|
|
51
|
+
actions,
|
|
52
|
+
..."value" in rest ? { value: rest.value } : {},
|
|
53
|
+
..."open" in rest ? { open: rest.open } : {},
|
|
54
|
+
..."checked" in rest ? { checked: rest.checked } : {}
|
|
55
|
+
})),
|
|
56
|
+
focus: () => brief(document.activeElement),
|
|
57
|
+
state: (selector, limit = 20) => Array.from(document.querySelectorAll(selector)).slice(0, limit).map(brief).filter((item) => item !== null),
|
|
58
|
+
keys: (...keys) => {
|
|
59
|
+
for (const key of keys) {
|
|
60
|
+
const target = document.activeElement ?? document.body;
|
|
61
|
+
target.dispatchEvent(
|
|
62
|
+
new KeyboardEvent("keydown", {
|
|
63
|
+
key,
|
|
64
|
+
bubbles: true,
|
|
65
|
+
cancelable: true
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return brief(document.activeElement);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
return () => {
|
|
74
|
+
cancelled = true;
|
|
75
|
+
};
|
|
76
|
+
}, [prod]);
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
UiAgent
|
|
81
|
+
};
|