iryx-ui 0.19.1 → 0.21.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 +2 -2
- package/dist/component-names.d.ts +2 -2
- package/dist/component-names.js +3 -1
- package/dist/components/Carousel.js +5 -0
- package/dist/components/Carousel.vue.d.ts +74 -0
- package/dist/components/Carousel.vue_vue_type_script_setup_true_lang.js +220 -0
- package/dist/components/Rating.js +5 -0
- package/dist/components/Rating.vue.d.ts +57 -0
- package/dist/components/Rating.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +124 -120
- package/dist/index.d.ts +2 -0
- package/dist/index.js +127 -125
- package/dist/marketing/SiteFooter.js +5 -0
- package/dist/marketing/SiteFooter.vue.d.ts +53 -0
- package/dist/marketing/SiteFooter.vue_vue_type_script_setup_true_lang.js +87 -0
- package/dist/marketing/SiteHeader.js +5 -0
- package/dist/marketing/SiteHeader.vue.d.ts +86 -0
- package/dist/marketing/SiteHeader.vue_vue_type_script_setup_true_lang.js +122 -0
- package/dist/marketing/index.d.ts +2 -0
- package/dist/marketing/index.js +8 -4
- package/dist/marketing.d.ts +2 -0
- package/dist/marketing.js +5 -3
- package/dist/theme/carousel.d.ts +65 -0
- package/dist/theme/carousel.js +22 -0
- package/dist/theme/form.d.ts +3 -3
- package/dist/theme/rating.d.ts +122 -0
- package/dist/theme/rating.js +49 -0
- package/dist/theme/site-footer.d.ts +80 -0
- package/dist/theme/site-footer.js +30 -0
- package/dist/theme/site-header.d.ts +74 -0
- package/dist/theme/site-header.js +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,8 +104,8 @@ export default defineNuxtConfig({
|
|
|
104
104
|
</ISection>
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
`ITestimonialCard` and `
|
|
107
|
+
Nine so far: `IHero`, `ISection`, `IPricingTable`, `IPricingCard`, `IFeatureCard`,
|
|
108
|
+
`ITestimonialCard`, `IBrowserFrame`, `ISiteHeader` and `ISiteFooter`. Importing the subpath also declares
|
|
109
109
|
them on Vue's `GlobalComponents`; a project that never imports it is untouched.
|
|
110
110
|
|
|
111
111
|
## Three ways to take the styling back
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Consumed by the Vue plugin (global registration) and the Nuxt module
|
|
4
4
|
* (auto-imports). Keep in sync with `src/components/index.ts`.
|
|
5
5
|
*/
|
|
6
|
-
export declare const componentNames: readonly ["Accordion", "Alert", "App", "AppShell", "AspectRatio", "AuthProviders", "Avatar", "AvatarGroup", "Badge", "BarChart", "Banner", "Breadcrumb", "Button", "ButtonGroup", "Calendar", "Card", "ChartLegend", "Checkbox", "ColorPicker", "Combobox", "Collapsible", "CommandPalette", "Container", "ConfirmDialog", "ContextMenu", "DateField", "DatePicker", "DateRangePicker", "Dialog", "DonutChart", "Drawer", "DropdownMenu", "Editable", "EmptyState", "FileUpload", "Form", "FormField", "HoverCard", "Icon", "Input", "Kbd", "Label", "LineChart", "NavigationMenu", "NumberInput", "Menubar", "PageHeader", "Pagination", "PasswordInput", "PinInput", "Popover", "Progress", "RadioGroup", "ScrollArea", "ScrollFade", "Select", "Separator", "Sidebar", "SignaturePad", "Skeleton", "Slider", "Sparkline", "Splitter", "Stat", "Stepper", "Switch", "Table", "Tabs", "TagsInput", "Textarea", "Toaster", "Toggle", "ToggleGroup", "TimeField", "Timeline", "Toolbar", "Tooltip", "Tree"];
|
|
6
|
+
export declare const componentNames: readonly ["Accordion", "Alert", "App", "AppShell", "AspectRatio", "AuthProviders", "Avatar", "AvatarGroup", "Badge", "BarChart", "Banner", "Breadcrumb", "Button", "ButtonGroup", "Calendar", "Card", "Carousel", "ChartLegend", "Checkbox", "ColorPicker", "Combobox", "Collapsible", "CommandPalette", "Container", "ConfirmDialog", "ContextMenu", "DateField", "DatePicker", "DateRangePicker", "Dialog", "DonutChart", "Drawer", "DropdownMenu", "Editable", "EmptyState", "FileUpload", "Form", "FormField", "HoverCard", "Icon", "Input", "Kbd", "Label", "LineChart", "NavigationMenu", "NumberInput", "Menubar", "PageHeader", "Pagination", "PasswordInput", "PinInput", "Popover", "Progress", "RadioGroup", "Rating", "ScrollArea", "ScrollFade", "Select", "Separator", "Sidebar", "SignaturePad", "Skeleton", "Slider", "Sparkline", "Splitter", "Stat", "Stepper", "Switch", "Table", "Tabs", "TagsInput", "Textarea", "Toaster", "Toggle", "ToggleGroup", "TimeField", "Timeline", "Toolbar", "Tooltip", "Tree"];
|
|
7
7
|
export type ComponentName = (typeof componentNames)[number];
|
|
8
8
|
/**
|
|
9
9
|
* Names of every block exported from `iryx-ui/marketing`.
|
|
@@ -11,5 +11,5 @@ export type ComponentName = (typeof componentNames)[number];
|
|
|
11
11
|
* runs at build time and must not pull `.vue` files into Node.
|
|
12
12
|
* Keep in sync with `src/marketing/index.ts`.
|
|
13
13
|
*/
|
|
14
|
-
export declare const marketingComponentNames: readonly ["BrowserFrame", "FeatureCard", "Hero", "PricingCard", "PricingTable", "Section", "TestimonialCard"];
|
|
14
|
+
export declare const marketingComponentNames: readonly ["BrowserFrame", "FeatureCard", "Hero", "PricingCard", "PricingTable", "Section", "SiteFooter", "SiteHeader", "TestimonialCard"];
|
|
15
15
|
export type MarketingComponentName = (typeof marketingComponentNames)[number];
|
package/dist/component-names.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
//#region src/component-names.ts
|
|
2
|
-
var e = /* @__PURE__ */ "Accordion.Alert.App.AppShell.AspectRatio.AuthProviders.Avatar.AvatarGroup.Badge.BarChart.Banner.Breadcrumb.Button.ButtonGroup.Calendar.Card.ChartLegend.Checkbox.ColorPicker.Combobox.Collapsible.CommandPalette.Container.ConfirmDialog.ContextMenu.DateField.DatePicker.DateRangePicker.Dialog.DonutChart.Drawer.DropdownMenu.Editable.EmptyState.FileUpload.Form.FormField.HoverCard.Icon.Input.Kbd.Label.LineChart.NavigationMenu.NumberInput.Menubar.PageHeader.Pagination.PasswordInput.PinInput.Popover.Progress.RadioGroup.ScrollArea.ScrollFade.Select.Separator.Sidebar.SignaturePad.Skeleton.Slider.Sparkline.Splitter.Stat.Stepper.Switch.Table.Tabs.TagsInput.Textarea.Toaster.Toggle.ToggleGroup.TimeField.Timeline.Toolbar.Tooltip.Tree".split("."), t = [
|
|
2
|
+
var e = /* @__PURE__ */ "Accordion.Alert.App.AppShell.AspectRatio.AuthProviders.Avatar.AvatarGroup.Badge.BarChart.Banner.Breadcrumb.Button.ButtonGroup.Calendar.Card.Carousel.ChartLegend.Checkbox.ColorPicker.Combobox.Collapsible.CommandPalette.Container.ConfirmDialog.ContextMenu.DateField.DatePicker.DateRangePicker.Dialog.DonutChart.Drawer.DropdownMenu.Editable.EmptyState.FileUpload.Form.FormField.HoverCard.Icon.Input.Kbd.Label.LineChart.NavigationMenu.NumberInput.Menubar.PageHeader.Pagination.PasswordInput.PinInput.Popover.Progress.RadioGroup.Rating.ScrollArea.ScrollFade.Select.Separator.Sidebar.SignaturePad.Skeleton.Slider.Sparkline.Splitter.Stat.Stepper.Switch.Table.Tabs.TagsInput.Textarea.Toaster.Toggle.ToggleGroup.TimeField.Timeline.Toolbar.Tooltip.Tree".split("."), t = [
|
|
3
3
|
"BrowserFrame",
|
|
4
4
|
"FeatureCard",
|
|
5
5
|
"Hero",
|
|
6
6
|
"PricingCard",
|
|
7
7
|
"PricingTable",
|
|
8
8
|
"Section",
|
|
9
|
+
"SiteFooter",
|
|
10
|
+
"SiteHeader",
|
|
9
11
|
"TestimonialCard"
|
|
10
12
|
];
|
|
11
13
|
//#endregion
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ClassValue } from '../class-value';
|
|
2
|
+
export interface CarouselProps<Item = unknown> {
|
|
3
|
+
/** What to lay out. Each one is rendered through the default slot. */
|
|
4
|
+
items?: Item[];
|
|
5
|
+
/**
|
|
6
|
+
* How many fit across, at the widest. Below `sm` it is always one, and
|
|
7
|
+
* `'auto'` leaves the width to the slide's own content.
|
|
8
|
+
*/
|
|
9
|
+
perView?: 1 | 2 | 3 | 4 | 'auto';
|
|
10
|
+
gap?: 'none' | 'sm' | 'md' | 'lg';
|
|
11
|
+
/** Show the previous and next buttons. */
|
|
12
|
+
arrows?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Let a mouse drag the track. Touch and trackpad pan it natively either way.
|
|
15
|
+
*/
|
|
16
|
+
draggable?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* How far a drag has to travel before it moves on, as a fraction of a slide.
|
|
19
|
+
* A quarter by default: enough that a nudge does not count, little enough
|
|
20
|
+
* that the track goes where it was pushed. `1` demands a whole slide.
|
|
21
|
+
*/
|
|
22
|
+
dragThreshold?: number;
|
|
23
|
+
/** Show the row of dots under the track. */
|
|
24
|
+
dots?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Accessible name for the carousel — "Customer stories", "Screenshots".
|
|
27
|
+
* A carousel with no name is a scroll region a screen reader cannot place.
|
|
28
|
+
*/
|
|
29
|
+
label?: string;
|
|
30
|
+
/** Accessible names for the buttons — override for non-English sites. */
|
|
31
|
+
previousLabel?: string;
|
|
32
|
+
nextLabel?: string;
|
|
33
|
+
/** Skip built-in classes; you take over styling entirely. */
|
|
34
|
+
unstyled?: boolean;
|
|
35
|
+
class?: ClassValue;
|
|
36
|
+
/** Override classes per element, e.g. `{ dot: 'size-3' }`. */
|
|
37
|
+
ui?: {
|
|
38
|
+
root?: string;
|
|
39
|
+
track?: string;
|
|
40
|
+
item?: string;
|
|
41
|
+
viewport?: string;
|
|
42
|
+
control?: string;
|
|
43
|
+
dots?: string;
|
|
44
|
+
dot?: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
declare const __VLS_export: <Item>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
48
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(CarouselProps<Item> & {
|
|
49
|
+
active?: number;
|
|
50
|
+
}) & {
|
|
51
|
+
"onUpdate:active"?: ((value: number) => any) | undefined;
|
|
52
|
+
}> & (typeof globalThis extends {
|
|
53
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
54
|
+
} ? P : {});
|
|
55
|
+
expose: (exposed: {}) => void;
|
|
56
|
+
attrs: any;
|
|
57
|
+
slots: {
|
|
58
|
+
default?: (props: {
|
|
59
|
+
item: Item;
|
|
60
|
+
index: number;
|
|
61
|
+
active: boolean;
|
|
62
|
+
}) => any;
|
|
63
|
+
};
|
|
64
|
+
emit: (event: "update:active", value: number) => void;
|
|
65
|
+
}>) => import("vue").VNode & {
|
|
66
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
67
|
+
};
|
|
68
|
+
declare const _default: typeof __VLS_export;
|
|
69
|
+
export default _default;
|
|
70
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
71
|
+
[K in keyof T]: T[K];
|
|
72
|
+
} : {
|
|
73
|
+
[K in keyof T as K]: T[K];
|
|
74
|
+
}) & {};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { useIryxUiConfig as e } from "../config.js";
|
|
2
|
+
import t from "./Icon.js";
|
|
3
|
+
import n from "./Button.js";
|
|
4
|
+
import { useScrollEdges as r } from "../composables/scroll-fade.js";
|
|
5
|
+
import { carouselTheme as i } from "../theme/carousel.js";
|
|
6
|
+
import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, mergeModels as f, nextTick as p, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as g, openBlock as _, ref as v, renderList as y, renderSlot as b, unref as x, useModel as S, watch as C, withCtx as w, withModifiers as ee } from "vue";
|
|
7
|
+
import { ArrowLeft01Icon as te, ArrowRight01Icon as ne } from "@hugeicons/core-free-icons";
|
|
8
|
+
//#region src/components/Carousel.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
+
var T = ["aria-label"], E = ["aria-label"], D = ["aria-label", "data-state"], O = [
|
|
10
|
+
"aria-label",
|
|
11
|
+
"aria-current",
|
|
12
|
+
"data-state",
|
|
13
|
+
"onClick"
|
|
14
|
+
], k = /*@__PURE__*/ d({
|
|
15
|
+
__name: "Carousel",
|
|
16
|
+
props: /*@__PURE__*/ f({
|
|
17
|
+
items: {},
|
|
18
|
+
perView: { default: 1 },
|
|
19
|
+
gap: {},
|
|
20
|
+
arrows: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: void 0
|
|
23
|
+
},
|
|
24
|
+
draggable: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: void 0
|
|
27
|
+
},
|
|
28
|
+
dragThreshold: { default: .25 },
|
|
29
|
+
dots: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: void 0
|
|
32
|
+
},
|
|
33
|
+
label: { default: "Carousel" },
|
|
34
|
+
previousLabel: { default: "Previous" },
|
|
35
|
+
nextLabel: { default: "Next" },
|
|
36
|
+
unstyled: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: void 0
|
|
39
|
+
},
|
|
40
|
+
class: { type: [
|
|
41
|
+
String,
|
|
42
|
+
Boolean,
|
|
43
|
+
null,
|
|
44
|
+
Array
|
|
45
|
+
] },
|
|
46
|
+
ui: {}
|
|
47
|
+
}, {
|
|
48
|
+
active: { default: 0 },
|
|
49
|
+
activeModifiers: {}
|
|
50
|
+
}),
|
|
51
|
+
emits: ["update:active"],
|
|
52
|
+
setup(d) {
|
|
53
|
+
let f = d, k = S(d, "active"), A = e(), j = o(() => f.unstyled ?? A.unstyled), M = o(() => i({ gap: f.gap }));
|
|
54
|
+
function N(e, t) {
|
|
55
|
+
return j.value ? [f.ui?.[e], t] : M.value[e]({ class: [f.ui?.[e], t] });
|
|
56
|
+
}
|
|
57
|
+
let P = v(), { atStart: re, atEnd: ie, overflowing: ae } = r(P, v("horizontal")), oe = o(() => ({
|
|
58
|
+
none: 0,
|
|
59
|
+
sm: .5,
|
|
60
|
+
md: 1,
|
|
61
|
+
lg: 1.5
|
|
62
|
+
})[f.gap ?? "md"]);
|
|
63
|
+
function F(e) {
|
|
64
|
+
let t = oe.value * (e - 1) / e;
|
|
65
|
+
return `calc(${100 / e}% - ${t}rem)`;
|
|
66
|
+
}
|
|
67
|
+
let I = o(() => {
|
|
68
|
+
if (f.perView !== "auto") return {
|
|
69
|
+
"--iryx-carousel-item": F(f.perView),
|
|
70
|
+
"--iryx-carousel-item-sm": F(Math.min(f.perView, 2))
|
|
71
|
+
};
|
|
72
|
+
}), L = o(() => f.items?.length ?? 0), R = v(), z = o(() => R.value ?? Math.max(L.value, 1)), B;
|
|
73
|
+
function V() {
|
|
74
|
+
let e = P.value;
|
|
75
|
+
if (!e) return;
|
|
76
|
+
if (!e.clientWidth) {
|
|
77
|
+
R.value = void 0;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
let t = e.scrollWidth - e.clientWidth + 1, n = [...e.children].filter((n) => n.offsetLeft - e.offsetLeft <= t).length;
|
|
81
|
+
R.value = Math.max(n, 1);
|
|
82
|
+
}
|
|
83
|
+
C(P, (e) => {
|
|
84
|
+
if (B?.disconnect(), B = void 0, e && (V(), !(typeof ResizeObserver > "u"))) {
|
|
85
|
+
B = new ResizeObserver(V), B.observe(e);
|
|
86
|
+
for (let t of e.children) B.observe(t);
|
|
87
|
+
}
|
|
88
|
+
}, { immediate: !0 }), C(L, () => p(V)), g(() => B?.disconnect());
|
|
89
|
+
let H = v(), U;
|
|
90
|
+
function W(e) {
|
|
91
|
+
let t = P.value, n = t?.children[e];
|
|
92
|
+
!t || !n || (H.value = e, k.value = e, t.scrollTo({ left: n.offsetLeft - t.offsetLeft }), clearTimeout(U), U = setTimeout(() => H.value = void 0, 1e3));
|
|
93
|
+
}
|
|
94
|
+
function G(e) {
|
|
95
|
+
W(Math.min(Math.max(k.value + e, 0), z.value - 1));
|
|
96
|
+
}
|
|
97
|
+
function K() {
|
|
98
|
+
let e = P.value;
|
|
99
|
+
if (!e) return k.value;
|
|
100
|
+
let t = [...e.children], n = e.scrollLeft + e.offsetLeft;
|
|
101
|
+
return t.reduce((e, r, i) => Math.abs(r.offsetLeft - n) < Math.abs(t[e].offsetLeft - n) ? i : e, 0);
|
|
102
|
+
}
|
|
103
|
+
C(k, (e) => {
|
|
104
|
+
H.value === void 0 && e !== K() && W(e);
|
|
105
|
+
});
|
|
106
|
+
function se() {
|
|
107
|
+
if (!P.value) return;
|
|
108
|
+
V();
|
|
109
|
+
let e = Math.min(K(), z.value - 1);
|
|
110
|
+
if (H.value !== void 0) {
|
|
111
|
+
e === H.value && (H.value = void 0, clearTimeout(U));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
k.value = e;
|
|
115
|
+
}
|
|
116
|
+
let q = v(!1), J = 0, Y = 0, X = 0, Z = 0;
|
|
117
|
+
function ce(e) {
|
|
118
|
+
let t = P.value;
|
|
119
|
+
!(f.draggable ?? !0) || e.pointerType === "touch" || !t || (q.value = !0, Z = 0, J = e.clientX, Y = t.scrollLeft, X = k.value, t.setPointerCapture(e.pointerId), t.style.scrollBehavior = "auto");
|
|
120
|
+
}
|
|
121
|
+
function Q(e) {
|
|
122
|
+
let t = [...e.children], n = (t[1]?.offsetLeft ?? 0) - (t[0]?.offsetLeft ?? 0);
|
|
123
|
+
if (n <= 0) return k.value;
|
|
124
|
+
let r = (e.scrollLeft - Y) / n, i = Math.trunc(r), a = Math.abs(r - i) >= Math.min(Math.max(f.dragThreshold, 0), 1) ? Math.sign(r) : 0;
|
|
125
|
+
return Math.min(Math.max(X + i + a, 0), z.value - 1);
|
|
126
|
+
}
|
|
127
|
+
function le(e) {
|
|
128
|
+
let t = P.value;
|
|
129
|
+
if (!q.value || !t) return;
|
|
130
|
+
let n = e.clientX - J;
|
|
131
|
+
Z = Math.max(Z, Math.abs(n)), t.scrollLeft = Y - n;
|
|
132
|
+
}
|
|
133
|
+
function $(e) {
|
|
134
|
+
let t = P.value;
|
|
135
|
+
if (!q.value || !t) return;
|
|
136
|
+
q.value = !1, t.releasePointerCapture(e.pointerId), t.style.scrollBehavior = "";
|
|
137
|
+
let n = Q(t);
|
|
138
|
+
p(() => W(n));
|
|
139
|
+
}
|
|
140
|
+
function ue(e) {
|
|
141
|
+
Z > 4 && (e.preventDefault(), e.stopPropagation(), Z = 0);
|
|
142
|
+
}
|
|
143
|
+
function de(e) {
|
|
144
|
+
e.key === "ArrowRight" ? (e.preventDefault(), G(1)) : e.key === "ArrowLeft" && (e.preventDefault(), G(-1));
|
|
145
|
+
}
|
|
146
|
+
let fe = o(() => (f.arrows ?? !0) && ae.value), pe = o(() => (f.dots ?? !0) && z.value > 1);
|
|
147
|
+
return (e, r) => (_(), c("div", {
|
|
148
|
+
role: "group",
|
|
149
|
+
"aria-roledescription": "carousel",
|
|
150
|
+
"aria-label": f.label,
|
|
151
|
+
class: m(N("root", f.class))
|
|
152
|
+
}, [l("div", { class: m(N("viewport")) }, [l("div", {
|
|
153
|
+
ref_key: "track",
|
|
154
|
+
ref: P,
|
|
155
|
+
tabindex: "0",
|
|
156
|
+
role: "group",
|
|
157
|
+
"aria-label": f.label,
|
|
158
|
+
class: m(N("track", q.value ? "snap-none scroll-auto cursor-grabbing select-none" : f.draggable ?? !0 ? "cursor-grab" : void 0)),
|
|
159
|
+
onScroll: se,
|
|
160
|
+
onKeydown: de,
|
|
161
|
+
onPointerdown: ce,
|
|
162
|
+
onPointermove: le,
|
|
163
|
+
onPointerup: $,
|
|
164
|
+
onPointercancel: $,
|
|
165
|
+
onClickCapture: ue,
|
|
166
|
+
onDragstart: r[0] ||= ee(() => {}, ["prevent"])
|
|
167
|
+
}, [(_(!0), c(a, null, y(f.items, (t, n) => (_(), c("div", {
|
|
168
|
+
key: n,
|
|
169
|
+
role: "group",
|
|
170
|
+
"aria-roledescription": "slide",
|
|
171
|
+
"aria-label": `${n + 1} of ${L.value}`,
|
|
172
|
+
"data-state": n === k.value ? "active" : "inactive",
|
|
173
|
+
style: h(I.value),
|
|
174
|
+
class: m(N("item", f.perView === "auto" ? "w-auto" : "w-full sm:w-[var(--iryx-carousel-item-sm)] lg:w-[var(--iryx-carousel-item)]"))
|
|
175
|
+
}, [b(e.$slots, "default", {
|
|
176
|
+
item: t,
|
|
177
|
+
index: n,
|
|
178
|
+
active: n === k.value
|
|
179
|
+
})], 14, D))), 128))], 42, E), fe.value ? (_(), c(a, { key: 0 }, [l("div", { class: m(N("control", "left-2")) }, [u(n, {
|
|
180
|
+
variant: "outline",
|
|
181
|
+
size: "sm",
|
|
182
|
+
square: "",
|
|
183
|
+
"aria-label": f.previousLabel,
|
|
184
|
+
disabled: x(re),
|
|
185
|
+
onClick: r[1] ||= (e) => G(-1)
|
|
186
|
+
}, {
|
|
187
|
+
default: w(() => [u(t, {
|
|
188
|
+
icon: x(te),
|
|
189
|
+
"data-icon": ""
|
|
190
|
+
}, null, 8, ["icon"])]),
|
|
191
|
+
_: 1
|
|
192
|
+
}, 8, ["aria-label", "disabled"])], 2), l("div", { class: m(N("control", "right-2")) }, [u(n, {
|
|
193
|
+
variant: "outline",
|
|
194
|
+
size: "sm",
|
|
195
|
+
square: "",
|
|
196
|
+
"aria-label": f.nextLabel,
|
|
197
|
+
disabled: x(ie),
|
|
198
|
+
onClick: r[2] ||= (e) => G(1)
|
|
199
|
+
}, {
|
|
200
|
+
default: w(() => [u(t, {
|
|
201
|
+
icon: x(ne),
|
|
202
|
+
"data-icon": ""
|
|
203
|
+
}, null, 8, ["icon"])]),
|
|
204
|
+
_: 1
|
|
205
|
+
}, 8, ["aria-label", "disabled"])], 2)], 64)) : s("", !0)], 2), pe.value ? (_(), c("div", {
|
|
206
|
+
key: 0,
|
|
207
|
+
class: m(N("dots"))
|
|
208
|
+
}, [(_(!0), c(a, null, y(z.value, (e, t) => (_(), c("button", {
|
|
209
|
+
key: t,
|
|
210
|
+
type: "button",
|
|
211
|
+
"aria-label": `Go to slide ${t + 1}`,
|
|
212
|
+
"aria-current": t === k.value,
|
|
213
|
+
"data-state": t === k.value ? "active" : "inactive",
|
|
214
|
+
class: m(N("dot")),
|
|
215
|
+
onClick: (e) => W(t)
|
|
216
|
+
}, null, 10, O))), 128))], 2)) : s("", !0)], 10, T));
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
//#endregion
|
|
220
|
+
export { k as default };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ClassValue } from '../class-value';
|
|
2
|
+
import type { IconLike } from '../composables/icon';
|
|
3
|
+
export interface RatingProps {
|
|
4
|
+
/** How many icons to show. */
|
|
5
|
+
max?: number;
|
|
6
|
+
/** Let the reader set the value. Without it this is a read-only score. */
|
|
7
|
+
interactive?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Smallest step the reader can choose, e.g. `0.5` for half stars. Display is
|
|
10
|
+
* continuous either way — a score of 3.7 fills seven tenths of the fourth.
|
|
11
|
+
*/
|
|
12
|
+
step?: number;
|
|
13
|
+
size?: 'sm' | 'md' | 'lg';
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** The icon to repeat. Any Hugeicons export, or a component that renders an SVG. */
|
|
16
|
+
icon?: IconLike;
|
|
17
|
+
/**
|
|
18
|
+
* Accessible name for the control, since a row of stars has no text of its
|
|
19
|
+
* own — "Overall rating", "Rate this reply".
|
|
20
|
+
*/
|
|
21
|
+
label?: string;
|
|
22
|
+
/** Print the score beside the icons, e.g. `4.5`. */
|
|
23
|
+
showValue?: boolean;
|
|
24
|
+
/** Skip built-in classes; you take over styling entirely. */
|
|
25
|
+
unstyled?: boolean;
|
|
26
|
+
class?: ClassValue;
|
|
27
|
+
/** Override classes per element, e.g. `{ fill: 'text-primary' }`. */
|
|
28
|
+
ui?: {
|
|
29
|
+
root?: string;
|
|
30
|
+
items?: string;
|
|
31
|
+
item?: string;
|
|
32
|
+
empty?: string;
|
|
33
|
+
fill?: string;
|
|
34
|
+
label?: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
type __VLS_Props = RatingProps;
|
|
38
|
+
type __VLS_ModelProps = {
|
|
39
|
+
modelValue?: number;
|
|
40
|
+
};
|
|
41
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
42
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
43
|
+
"update:modelValue": (value: number) => any;
|
|
44
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
45
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
46
|
+
}>, {
|
|
47
|
+
icon: IconLike;
|
|
48
|
+
label: string;
|
|
49
|
+
disabled: boolean;
|
|
50
|
+
unstyled: boolean;
|
|
51
|
+
max: number;
|
|
52
|
+
step: number;
|
|
53
|
+
showValue: boolean;
|
|
54
|
+
interactive: boolean;
|
|
55
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
56
|
+
declare const _default: typeof __VLS_export;
|
|
57
|
+
export default _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useIryxUiConfig as e } from "../config.js";
|
|
2
|
+
import t from "./Icon.js";
|
|
3
|
+
import { ratingTheme as n } from "../theme/rating.js";
|
|
4
|
+
import { Fragment as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, mergeModels as u, mergeProps as d, normalizeClass as f, normalizeStyle as p, openBlock as m, renderList as h, toDisplayString as g, useModel as _ } from "vue";
|
|
5
|
+
import { StarIcon as v } from "@hugeicons/core-free-icons";
|
|
6
|
+
//#region src/components/Rating.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var y = ["aria-hidden"], b = ["onClick"], x = /*@__PURE__*/ l({
|
|
8
|
+
__name: "Rating",
|
|
9
|
+
props: /*@__PURE__*/ u({
|
|
10
|
+
max: { default: 5 },
|
|
11
|
+
interactive: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: void 0
|
|
14
|
+
},
|
|
15
|
+
step: { default: 1 },
|
|
16
|
+
size: {},
|
|
17
|
+
disabled: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: void 0
|
|
20
|
+
},
|
|
21
|
+
icon: { default: () => v },
|
|
22
|
+
label: { default: "Rating" },
|
|
23
|
+
showValue: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: void 0
|
|
26
|
+
},
|
|
27
|
+
unstyled: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: void 0
|
|
30
|
+
},
|
|
31
|
+
class: { type: [
|
|
32
|
+
String,
|
|
33
|
+
Boolean,
|
|
34
|
+
null,
|
|
35
|
+
Array
|
|
36
|
+
] },
|
|
37
|
+
ui: {}
|
|
38
|
+
}, {
|
|
39
|
+
modelValue: { default: 0 },
|
|
40
|
+
modelModifiers: {}
|
|
41
|
+
}),
|
|
42
|
+
emits: ["update:modelValue"],
|
|
43
|
+
setup(l) {
|
|
44
|
+
let u = l, v = _(l, "modelValue"), x = e(), S = i(() => u.unstyled ?? x.unstyled), C = i(() => n({
|
|
45
|
+
size: u.size,
|
|
46
|
+
interactive: u.interactive ?? !1,
|
|
47
|
+
disabled: u.disabled ?? !1
|
|
48
|
+
}));
|
|
49
|
+
function w(e, t) {
|
|
50
|
+
return S.value ? [u.ui?.[e], t] : C.value[e]({ class: [u.ui?.[e], t] });
|
|
51
|
+
}
|
|
52
|
+
let T = i(() => Math.min(Math.max(v.value, 0), u.max));
|
|
53
|
+
function E(e) {
|
|
54
|
+
let t = Math.min(Math.max(T.value - e, 0), 1);
|
|
55
|
+
return Math.round(t * 1e4) / 100;
|
|
56
|
+
}
|
|
57
|
+
let D = i(() => Number(T.value.toFixed(2)).toString());
|
|
58
|
+
function O(e) {
|
|
59
|
+
if (u.disabled || !u.interactive) return;
|
|
60
|
+
let t = Math.round(e / u.step) * u.step;
|
|
61
|
+
v.value = Math.min(Math.max(t, u.step), u.max);
|
|
62
|
+
}
|
|
63
|
+
let k = i(() => u.interactive ? {
|
|
64
|
+
role: "slider",
|
|
65
|
+
tabindex: u.disabled ? -1 : 0,
|
|
66
|
+
"aria-label": u.label,
|
|
67
|
+
"aria-valuemin": 0,
|
|
68
|
+
"aria-valuemax": u.max,
|
|
69
|
+
"aria-valuenow": T.value,
|
|
70
|
+
"aria-valuetext": `${D.value} out of ${u.max}`,
|
|
71
|
+
"aria-disabled": u.disabled || void 0
|
|
72
|
+
} : {
|
|
73
|
+
role: "img",
|
|
74
|
+
"aria-label": `${u.label}: ${D.value} out of ${u.max}`
|
|
75
|
+
});
|
|
76
|
+
function A(e) {
|
|
77
|
+
if (!u.interactive) return;
|
|
78
|
+
let t = {
|
|
79
|
+
ArrowRight: u.step,
|
|
80
|
+
ArrowUp: u.step,
|
|
81
|
+
ArrowLeft: -u.step,
|
|
82
|
+
ArrowDown: -u.step
|
|
83
|
+
};
|
|
84
|
+
e.key in t ? (e.preventDefault(), O(T.value + t[e.key])) : e.key === "Home" ? (e.preventDefault(), O(u.step)) : e.key === "End" && (e.preventDefault(), O(u.max));
|
|
85
|
+
}
|
|
86
|
+
return (e, n) => (m(), o("div", d(k.value, {
|
|
87
|
+
class: w("root", u.class),
|
|
88
|
+
onKeydown: A
|
|
89
|
+
}), [s("div", {
|
|
90
|
+
class: f(w("items")),
|
|
91
|
+
"aria-hidden": u.interactive ? void 0 : "true"
|
|
92
|
+
}, [(m(!0), o(r, null, h(u.max, (e) => (m(), o("span", {
|
|
93
|
+
key: e,
|
|
94
|
+
class: f(w("item")),
|
|
95
|
+
onClick: (t) => O(e)
|
|
96
|
+
}, [c(t, {
|
|
97
|
+
icon: u.icon,
|
|
98
|
+
class: f(w("empty"))
|
|
99
|
+
}, null, 8, ["icon", "class"]), s("span", {
|
|
100
|
+
class: f(w("fill")),
|
|
101
|
+
style: p({ width: `${E(e - 1)}%` })
|
|
102
|
+
}, [c(t, { icon: u.icon }, null, 8, ["icon"])], 6)], 10, b))), 128))], 10, y), u.showValue ? (m(), o("span", {
|
|
103
|
+
key: 0,
|
|
104
|
+
class: f(w("label")),
|
|
105
|
+
"aria-hidden": "true"
|
|
106
|
+
}, g(D.value), 3)) : a("", !0)], 16));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
//#endregion
|
|
110
|
+
export { x as default };
|
|
@@ -14,6 +14,7 @@ export { default as Button } from './Button.vue';
|
|
|
14
14
|
export { default as ButtonGroup } from './ButtonGroup.vue';
|
|
15
15
|
export { default as Calendar } from './Calendar.vue';
|
|
16
16
|
export { default as Card } from './Card.vue';
|
|
17
|
+
export { default as Carousel } from './Carousel.vue';
|
|
17
18
|
export { default as ChartLegend } from './ChartLegend.vue';
|
|
18
19
|
export { default as Checkbox } from './Checkbox.vue';
|
|
19
20
|
export { default as Collapsible } from './Collapsible.vue';
|
|
@@ -51,6 +52,7 @@ export { default as PinInput } from './PinInput.vue';
|
|
|
51
52
|
export { default as Popover } from './Popover.vue';
|
|
52
53
|
export { default as Progress } from './Progress.vue';
|
|
53
54
|
export { default as RadioGroup } from './RadioGroup.vue';
|
|
55
|
+
export { default as Rating } from './Rating.vue';
|
|
54
56
|
export { default as ScrollArea } from './ScrollArea.vue';
|
|
55
57
|
export { default as ScrollFade } from './ScrollFade.vue';
|
|
56
58
|
export { default as Select } from './Select.vue';
|