@vertz/ui-primitives 0.2.24 → 0.2.25
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/shared/{chunk-kskxxc2q.js → chunk-1dx23qnr.js} +5 -1
- package/dist/shared/chunk-5964gmv0.js +416 -0
- package/dist/shared/{chunk-f0wy7k56.js → chunk-9ydd4pn3.js} +6 -0
- package/dist/shared/chunk-bc2qqkhr.js +194 -0
- package/dist/src/accordion/accordion-composed.js +1 -1
- package/dist/src/accordion/accordion.js +1 -1
- package/dist/src/index.d.ts +132 -99
- package/dist/src/index.js +1 -0
- package/dist/src/list/list-composed.d.ts +34 -0
- package/dist/src/list/list-composed.js +6 -0
- package/dist/src/pagination/pagination-composed.js +1 -1
- package/package.json +3 -3
- package/dist/shared/chunk-4gyg71bn.js +0 -178
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertz/ui-primitives",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.25",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Headless UI primitives for Vertz — Accordion, Dialog, Select, and more",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@floating-ui/dom": "^1.7.5",
|
|
39
|
-
"@vertz/ui": "^0.2.
|
|
39
|
+
"@vertz/ui": "^0.2.24"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@happy-dom/global-registrator": "^20.7.0",
|
|
43
|
-
"@vertz/ui-compiler": "^0.2.
|
|
43
|
+
"@vertz/ui-compiler": "^0.2.24",
|
|
44
44
|
"bunup": "^0.16.31",
|
|
45
45
|
"happy-dom": "^20.7.0",
|
|
46
46
|
"typescript": "^5.7.0"
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn
|
|
3
|
-
} from "./chunk-q7xbcj9q.js";
|
|
4
|
-
|
|
5
|
-
// src/pagination/pagination-composed.tsx
|
|
6
|
-
import { computed } from "@vertz/ui";
|
|
7
|
-
import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
8
|
-
function generatePaginationRange(current, total, siblings) {
|
|
9
|
-
const range = [];
|
|
10
|
-
const left = Math.max(2, current - siblings);
|
|
11
|
-
const right = Math.min(total - 1, current + siblings);
|
|
12
|
-
range.push(1);
|
|
13
|
-
if (left > 2) {
|
|
14
|
-
range.push("...");
|
|
15
|
-
}
|
|
16
|
-
for (let idx = left;idx <= right; idx++) {
|
|
17
|
-
if (idx !== 1 && idx !== total) {
|
|
18
|
-
range.push(idx);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
if (right < total - 1) {
|
|
22
|
-
range.push("...");
|
|
23
|
-
}
|
|
24
|
-
if (total > 1) {
|
|
25
|
-
range.push(total);
|
|
26
|
-
}
|
|
27
|
-
return range;
|
|
28
|
-
}
|
|
29
|
-
function PageButton(__props) {
|
|
30
|
-
const __mfDepth = __pushMountFrame();
|
|
31
|
-
try {
|
|
32
|
-
if (__props.page === __props.currentPage) {
|
|
33
|
-
const __mfResult0 = (() => {
|
|
34
|
-
const __el0 = __element("button");
|
|
35
|
-
__el0.setAttribute("type", "button");
|
|
36
|
-
__attr(__el0, "class", () => cn(__props.classes?.linkActive));
|
|
37
|
-
__el0.setAttribute("aria-current", "page");
|
|
38
|
-
__enterChildren(__el0);
|
|
39
|
-
__append(__el0, __child(() => String(__props.page)));
|
|
40
|
-
__exitChildren();
|
|
41
|
-
return __el0;
|
|
42
|
-
})();
|
|
43
|
-
__flushMountFrame();
|
|
44
|
-
return __mfResult0;
|
|
45
|
-
}
|
|
46
|
-
const __mfResult1 = (() => {
|
|
47
|
-
const __el1 = __element("button");
|
|
48
|
-
__el1.setAttribute("type", "button");
|
|
49
|
-
__attr(__el1, "class", () => cn(__props.classes?.link));
|
|
50
|
-
__on(__el1, "click", () => __props.onPageChange(__props.page));
|
|
51
|
-
__enterChildren(__el1);
|
|
52
|
-
__append(__el1, __child(() => String(__props.page)));
|
|
53
|
-
__exitChildren();
|
|
54
|
-
return __el1;
|
|
55
|
-
})();
|
|
56
|
-
__flushMountFrame();
|
|
57
|
-
return __mfResult1;
|
|
58
|
-
} catch (__mfErr) {
|
|
59
|
-
__discardMountFrame(__mfDepth);
|
|
60
|
-
throw __mfErr;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function ComposedPaginationRoot(__props) {
|
|
64
|
-
const __mfDepth = __pushMountFrame();
|
|
65
|
-
try {
|
|
66
|
-
const range = computed(() => generatePaginationRange(__props.currentPage, __props.totalPages, __props.siblingCount ?? 1));
|
|
67
|
-
const pageItems = [];
|
|
68
|
-
for (const page of range.value) {
|
|
69
|
-
if (page === "...") {
|
|
70
|
-
pageItems.push((() => {
|
|
71
|
-
const __el0 = __element("li");
|
|
72
|
-
__attr(__el0, "class", () => cn(__props.classes?.item));
|
|
73
|
-
__enterChildren(__el0);
|
|
74
|
-
__append(__el0, (() => {
|
|
75
|
-
const __el1 = __element("span");
|
|
76
|
-
__el1.setAttribute("aria-hidden", "true");
|
|
77
|
-
__attr(__el1, "class", () => cn(__props.classes?.ellipsis));
|
|
78
|
-
__enterChildren(__el1);
|
|
79
|
-
__append(__el1, __child(() => __props.ellipsisContent ?? "..."));
|
|
80
|
-
__exitChildren();
|
|
81
|
-
return __el1;
|
|
82
|
-
})());
|
|
83
|
-
__exitChildren();
|
|
84
|
-
return __el0;
|
|
85
|
-
})());
|
|
86
|
-
} else {
|
|
87
|
-
pageItems.push((() => {
|
|
88
|
-
const __el2 = __element("li");
|
|
89
|
-
__attr(__el2, "class", () => cn(__props.classes?.item));
|
|
90
|
-
__enterChildren(__el2);
|
|
91
|
-
__append(__el2, PageButton({ get page() {
|
|
92
|
-
return page;
|
|
93
|
-
}, get currentPage() {
|
|
94
|
-
return __props.currentPage;
|
|
95
|
-
}, get onPageChange() {
|
|
96
|
-
return __props.onPageChange;
|
|
97
|
-
}, get classes() {
|
|
98
|
-
return __props.classes;
|
|
99
|
-
} }));
|
|
100
|
-
__exitChildren();
|
|
101
|
-
return __el2;
|
|
102
|
-
})());
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
const __mfResult0 = (() => {
|
|
106
|
-
const __el3 = __element("nav");
|
|
107
|
-
__el3.setAttribute("aria-label", "Pagination");
|
|
108
|
-
__attr(__el3, "class", () => cn(__props.classes?.nav, __props.className ?? __props.class));
|
|
109
|
-
__enterChildren(__el3);
|
|
110
|
-
__append(__el3, (() => {
|
|
111
|
-
const __el4 = __element("ul");
|
|
112
|
-
__attr(__el4, "class", () => cn(__props.classes?.list));
|
|
113
|
-
__enterChildren(__el4);
|
|
114
|
-
__append(__el4, (() => {
|
|
115
|
-
const __el5 = __element("li");
|
|
116
|
-
__attr(__el5, "class", () => cn(__props.classes?.item));
|
|
117
|
-
__enterChildren(__el5);
|
|
118
|
-
__append(__el5, (() => {
|
|
119
|
-
const __el6 = __element("button");
|
|
120
|
-
__el6.setAttribute("type", "button");
|
|
121
|
-
__attr(__el6, "class", () => cn(__props.classes?.navButton));
|
|
122
|
-
{
|
|
123
|
-
const __v = { paddingLeft: "0.375rem", paddingRight: "0.625rem" };
|
|
124
|
-
if (__v != null && __v !== false)
|
|
125
|
-
__el6.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
126
|
-
}
|
|
127
|
-
__el6.setAttribute("aria-label", "Previous page");
|
|
128
|
-
__attr(__el6, "disabled", () => __props.currentPage <= 1);
|
|
129
|
-
__on(__el6, "click", () => __props.onPageChange(__props.currentPage - 1));
|
|
130
|
-
__enterChildren(__el6);
|
|
131
|
-
__append(__el6, __child(() => __props.prevContent ?? "Previous"));
|
|
132
|
-
__exitChildren();
|
|
133
|
-
return __el6;
|
|
134
|
-
})());
|
|
135
|
-
__exitChildren();
|
|
136
|
-
return __el5;
|
|
137
|
-
})());
|
|
138
|
-
__insert(__el4, pageItems);
|
|
139
|
-
__append(__el4, (() => {
|
|
140
|
-
const __el7 = __element("li");
|
|
141
|
-
__attr(__el7, "class", () => cn(__props.classes?.item));
|
|
142
|
-
__enterChildren(__el7);
|
|
143
|
-
__append(__el7, (() => {
|
|
144
|
-
const __el8 = __element("button");
|
|
145
|
-
__el8.setAttribute("type", "button");
|
|
146
|
-
__attr(__el8, "class", () => cn(__props.classes?.navButton));
|
|
147
|
-
{
|
|
148
|
-
const __v = { paddingLeft: "0.625rem", paddingRight: "0.375rem" };
|
|
149
|
-
if (__v != null && __v !== false)
|
|
150
|
-
__el8.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
151
|
-
}
|
|
152
|
-
__el8.setAttribute("aria-label", "Next page");
|
|
153
|
-
__attr(__el8, "disabled", () => __props.currentPage >= __props.totalPages);
|
|
154
|
-
__on(__el8, "click", () => __props.onPageChange(__props.currentPage + 1));
|
|
155
|
-
__enterChildren(__el8);
|
|
156
|
-
__append(__el8, __child(() => __props.nextContent ?? "Next"));
|
|
157
|
-
__exitChildren();
|
|
158
|
-
return __el8;
|
|
159
|
-
})());
|
|
160
|
-
__exitChildren();
|
|
161
|
-
return __el7;
|
|
162
|
-
})());
|
|
163
|
-
__exitChildren();
|
|
164
|
-
return __el4;
|
|
165
|
-
})());
|
|
166
|
-
__exitChildren();
|
|
167
|
-
return __el3;
|
|
168
|
-
})();
|
|
169
|
-
__flushMountFrame();
|
|
170
|
-
return __mfResult0;
|
|
171
|
-
} catch (__mfErr) {
|
|
172
|
-
__discardMountFrame(__mfDepth);
|
|
173
|
-
throw __mfErr;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
var ComposedPagination = ComposedPaginationRoot;
|
|
177
|
-
|
|
178
|
-
export { ComposedPagination };
|