@mieweb/ui 0.3.0-dev.63 → 0.3.0-dev.65
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-R4DM4635.cjs → chunk-FSBFQBNE.cjs} +86 -2
- package/dist/chunk-FSBFQBNE.cjs.map +1 -0
- package/dist/{chunk-CP7NPDQW.js → chunk-Q7NBJFEB.js} +87 -4
- package/dist/chunk-Q7NBJFEB.js.map +1 -0
- package/dist/hooks/index.cjs +14 -10
- package/dist/hooks/index.d.cts +37 -1
- package/dist/hooks/index.d.ts +37 -1
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +197 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -2
- package/dist/index.d.ts +82 -2
- package/dist/index.js +182 -3
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-CP7NPDQW.js.map +0 -1
- package/dist/chunk-R4DM4635.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -41,7 +41,7 @@ var chunkAUXHRAID_cjs = require('./chunk-AUXHRAID.cjs');
|
|
|
41
41
|
var chunkZGSPFVGL_cjs = require('./chunk-ZGSPFVGL.cjs');
|
|
42
42
|
var chunkLXHPW2ZF_cjs = require('./chunk-LXHPW2ZF.cjs');
|
|
43
43
|
var chunk4ZU53GNR_cjs = require('./chunk-4ZU53GNR.cjs');
|
|
44
|
-
var
|
|
44
|
+
var chunkFSBFQBNE_cjs = require('./chunk-FSBFQBNE.cjs');
|
|
45
45
|
var chunk2O7D6F67_cjs = require('./chunk-2O7D6F67.cjs');
|
|
46
46
|
var chunk6HFFWEM3_cjs = require('./chunk-6HFFWEM3.cjs');
|
|
47
47
|
var chunkNNEFAUHV_cjs = require('./chunk-NNEFAUHV.cjs');
|
|
@@ -8383,7 +8383,7 @@ function CommandPaletteProvider({
|
|
|
8383
8383
|
open();
|
|
8384
8384
|
}
|
|
8385
8385
|
}, [isOpen, open, close]);
|
|
8386
|
-
|
|
8386
|
+
chunkFSBFQBNE_cjs.useCommandK(toggle, enableShortcut);
|
|
8387
8387
|
React48__namespace.default.useEffect(() => {
|
|
8388
8388
|
if (!customEventName) return;
|
|
8389
8389
|
const handler = () => open();
|
|
@@ -13202,7 +13202,7 @@ function DocumentScanner({
|
|
|
13202
13202
|
const [error, setError] = React48__namespace.useState(null);
|
|
13203
13203
|
const [isWebcamOpen, setIsWebcamOpen] = React48__namespace.useState(false);
|
|
13204
13204
|
const [validationErrors, setValidationErrors] = React48__namespace.useState([]);
|
|
13205
|
-
const isMobile =
|
|
13205
|
+
const isMobile = chunkFSBFQBNE_cjs.useIsMobile();
|
|
13206
13206
|
const cameraInputRef = React48__namespace.useRef(null);
|
|
13207
13207
|
const {
|
|
13208
13208
|
files,
|
|
@@ -34608,7 +34608,7 @@ function SidebarProvider({
|
|
|
34608
34608
|
defaultExpandedGroup = null,
|
|
34609
34609
|
mobileBreakpoint = "(max-width: 1023px)"
|
|
34610
34610
|
}) {
|
|
34611
|
-
const isMobileViewport =
|
|
34611
|
+
const isMobileViewport = chunkFSBFQBNE_cjs.useMediaQuery(mobileBreakpoint);
|
|
34612
34612
|
const [isCollapsed, setIsCollapsed] = React48.useState(() => {
|
|
34613
34613
|
if (typeof window !== "undefined" && persistCollapsed) {
|
|
34614
34614
|
const stored = localStorage.getItem(storageKey);
|
|
@@ -37109,6 +37109,185 @@ function StripeSecureBadge({
|
|
|
37109
37109
|
}
|
|
37110
37110
|
);
|
|
37111
37111
|
}
|
|
37112
|
+
function discoverHeadings(container, selector, maxDepth) {
|
|
37113
|
+
const elements = Array.from(container.querySelectorAll(selector));
|
|
37114
|
+
const items = [];
|
|
37115
|
+
for (const el of elements) {
|
|
37116
|
+
if (!el.id) continue;
|
|
37117
|
+
const tagLevel = parseInt(el.tagName.charAt(1), 10);
|
|
37118
|
+
if (isNaN(tagLevel) || tagLevel > maxDepth) continue;
|
|
37119
|
+
items.push({
|
|
37120
|
+
id: el.id,
|
|
37121
|
+
title: el.textContent?.trim() || el.id,
|
|
37122
|
+
level: tagLevel
|
|
37123
|
+
});
|
|
37124
|
+
}
|
|
37125
|
+
return items;
|
|
37126
|
+
}
|
|
37127
|
+
function nestItems(flat) {
|
|
37128
|
+
if (flat.length === 0) return [];
|
|
37129
|
+
const root = [];
|
|
37130
|
+
const stack = [];
|
|
37131
|
+
for (const item of flat) {
|
|
37132
|
+
const node = { ...item, children: [] };
|
|
37133
|
+
while (stack.length > 0 && stack[stack.length - 1].level >= node.level) {
|
|
37134
|
+
stack.pop();
|
|
37135
|
+
}
|
|
37136
|
+
if (stack.length === 0) {
|
|
37137
|
+
root.push(node);
|
|
37138
|
+
} else {
|
|
37139
|
+
const parent = stack[stack.length - 1];
|
|
37140
|
+
if (!parent.children) parent.children = [];
|
|
37141
|
+
parent.children.push(node);
|
|
37142
|
+
}
|
|
37143
|
+
stack.push(node);
|
|
37144
|
+
}
|
|
37145
|
+
return root;
|
|
37146
|
+
}
|
|
37147
|
+
function TableOfContents({
|
|
37148
|
+
items: manualItems,
|
|
37149
|
+
selector = "h2, h3",
|
|
37150
|
+
contentRef,
|
|
37151
|
+
activeId: controlledActiveId,
|
|
37152
|
+
onActiveChange,
|
|
37153
|
+
maxDepth = 3,
|
|
37154
|
+
scrollOffset = 0,
|
|
37155
|
+
smooth = true,
|
|
37156
|
+
title,
|
|
37157
|
+
indentLines = true,
|
|
37158
|
+
hideWhenEmpty = true,
|
|
37159
|
+
scrollSpyOptions,
|
|
37160
|
+
className
|
|
37161
|
+
}) {
|
|
37162
|
+
const [discoveredItems, setDiscoveredItems] = React48__namespace.useState([]);
|
|
37163
|
+
const flatItems = manualItems ?? discoveredItems;
|
|
37164
|
+
const contentEl = contentRef?.current ?? null;
|
|
37165
|
+
React48__namespace.useEffect(() => {
|
|
37166
|
+
if (manualItems) return;
|
|
37167
|
+
const container = contentEl ?? document;
|
|
37168
|
+
let frameId = null;
|
|
37169
|
+
function discover() {
|
|
37170
|
+
const next = discoverHeadings(container, selector, maxDepth);
|
|
37171
|
+
setDiscoveredItems((prev) => {
|
|
37172
|
+
if (prev.length === next.length && prev.every(
|
|
37173
|
+
(p, i) => p.id === next[i].id && p.title === next[i].title && p.level === next[i].level
|
|
37174
|
+
)) {
|
|
37175
|
+
return prev;
|
|
37176
|
+
}
|
|
37177
|
+
return next;
|
|
37178
|
+
});
|
|
37179
|
+
}
|
|
37180
|
+
function scheduleDiscover() {
|
|
37181
|
+
if (frameId !== null) return;
|
|
37182
|
+
frameId = requestAnimationFrame(() => {
|
|
37183
|
+
frameId = null;
|
|
37184
|
+
discover();
|
|
37185
|
+
});
|
|
37186
|
+
}
|
|
37187
|
+
discover();
|
|
37188
|
+
const observer = new MutationObserver(scheduleDiscover);
|
|
37189
|
+
const target = container instanceof HTMLElement ? container : document.body;
|
|
37190
|
+
observer.observe(target, { childList: true, subtree: true });
|
|
37191
|
+
return () => {
|
|
37192
|
+
observer.disconnect();
|
|
37193
|
+
if (frameId !== null) cancelAnimationFrame(frameId);
|
|
37194
|
+
};
|
|
37195
|
+
}, [manualItems, selector, maxDepth, contentEl]);
|
|
37196
|
+
const ids = React48__namespace.useMemo(() => flatItems.map((i) => i.id), [flatItems]);
|
|
37197
|
+
const isControlled = controlledActiveId !== void 0;
|
|
37198
|
+
const { activeId: spyActiveId } = chunkFSBFQBNE_cjs.useScrollSpy({
|
|
37199
|
+
ids,
|
|
37200
|
+
root: contentRef,
|
|
37201
|
+
enabled: !isControlled && ids.length > 0,
|
|
37202
|
+
...scrollSpyOptions
|
|
37203
|
+
});
|
|
37204
|
+
const activeId = isControlled ? controlledActiveId : spyActiveId;
|
|
37205
|
+
React48__namespace.useEffect(() => {
|
|
37206
|
+
if (!isControlled && onActiveChange) {
|
|
37207
|
+
onActiveChange(spyActiveId);
|
|
37208
|
+
}
|
|
37209
|
+
}, [spyActiveId, isControlled, onActiveChange]);
|
|
37210
|
+
const handleClick = React48__namespace.useCallback(
|
|
37211
|
+
(e, id) => {
|
|
37212
|
+
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
37213
|
+
return;
|
|
37214
|
+
}
|
|
37215
|
+
e.preventDefault();
|
|
37216
|
+
const target = document.getElementById(id);
|
|
37217
|
+
if (!target) return;
|
|
37218
|
+
const scrollContainer = contentEl;
|
|
37219
|
+
const behavior = smooth ? "smooth" : "auto";
|
|
37220
|
+
if (scrollContainer) {
|
|
37221
|
+
const top = target.getBoundingClientRect().top - scrollContainer.getBoundingClientRect().top + scrollContainer.scrollTop - scrollOffset;
|
|
37222
|
+
scrollContainer.scrollTo({ top, behavior });
|
|
37223
|
+
} else {
|
|
37224
|
+
const top = target.getBoundingClientRect().top + window.scrollY - scrollOffset;
|
|
37225
|
+
window.scrollTo({ top, behavior });
|
|
37226
|
+
}
|
|
37227
|
+
window.history.pushState(null, "", `#${id}`);
|
|
37228
|
+
},
|
|
37229
|
+
[contentEl, scrollOffset, smooth]
|
|
37230
|
+
);
|
|
37231
|
+
const tree = React48__namespace.useMemo(() => nestItems(flatItems), [flatItems]);
|
|
37232
|
+
if (hideWhenEmpty && tree.length === 0) return null;
|
|
37233
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("nav", { "aria-label": "Table of contents", className: chunkOR5DRJCW_cjs.cn("text-sm", className), children: [
|
|
37234
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground mb-3 font-semibold", children: title }),
|
|
37235
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37236
|
+
TocList,
|
|
37237
|
+
{
|
|
37238
|
+
items: tree,
|
|
37239
|
+
activeId,
|
|
37240
|
+
onClickItem: handleClick,
|
|
37241
|
+
depth: 0,
|
|
37242
|
+
indentLines
|
|
37243
|
+
}
|
|
37244
|
+
)
|
|
37245
|
+
] });
|
|
37246
|
+
}
|
|
37247
|
+
function TocList({
|
|
37248
|
+
items,
|
|
37249
|
+
activeId,
|
|
37250
|
+
onClickItem,
|
|
37251
|
+
depth,
|
|
37252
|
+
indentLines
|
|
37253
|
+
}) {
|
|
37254
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
37255
|
+
"ul",
|
|
37256
|
+
{
|
|
37257
|
+
className: chunkOR5DRJCW_cjs.cn(
|
|
37258
|
+
"space-y-1",
|
|
37259
|
+
depth > 0 && indentLines && "border-border ml-3 border-l pl-3",
|
|
37260
|
+
depth > 0 && !indentLines && "ml-4"
|
|
37261
|
+
),
|
|
37262
|
+
children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
37263
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37264
|
+
"a",
|
|
37265
|
+
{
|
|
37266
|
+
href: `#${item.id}`,
|
|
37267
|
+
onClick: (e) => onClickItem(e, item.id),
|
|
37268
|
+
"aria-current": activeId === item.id ? "location" : void 0,
|
|
37269
|
+
className: chunkOR5DRJCW_cjs.cn(
|
|
37270
|
+
"block rounded-sm px-2 py-1 transition-colors duration-150",
|
|
37271
|
+
"hover:text-foreground",
|
|
37272
|
+
activeId === item.id ? "text-primary font-medium" : "text-muted-foreground"
|
|
37273
|
+
),
|
|
37274
|
+
children: item.title
|
|
37275
|
+
}
|
|
37276
|
+
),
|
|
37277
|
+
item.children && item.children.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
37278
|
+
TocList,
|
|
37279
|
+
{
|
|
37280
|
+
items: item.children,
|
|
37281
|
+
activeId,
|
|
37282
|
+
onClickItem,
|
|
37283
|
+
depth: depth + 1,
|
|
37284
|
+
indentLines
|
|
37285
|
+
}
|
|
37286
|
+
)
|
|
37287
|
+
] }, item.id))
|
|
37288
|
+
}
|
|
37289
|
+
);
|
|
37290
|
+
}
|
|
37112
37291
|
function TimelineProgress({
|
|
37113
37292
|
steps,
|
|
37114
37293
|
currentStep,
|
|
@@ -39068,39 +39247,43 @@ Object.defineProperty(exports, "validatePhoneNumber", {
|
|
|
39068
39247
|
});
|
|
39069
39248
|
Object.defineProperty(exports, "useCommandK", {
|
|
39070
39249
|
enumerable: true,
|
|
39071
|
-
get: function () { return
|
|
39250
|
+
get: function () { return chunkFSBFQBNE_cjs.useCommandK; }
|
|
39072
39251
|
});
|
|
39073
39252
|
Object.defineProperty(exports, "useIsDesktop", {
|
|
39074
39253
|
enumerable: true,
|
|
39075
|
-
get: function () { return
|
|
39254
|
+
get: function () { return chunkFSBFQBNE_cjs.useIsDesktop; }
|
|
39076
39255
|
});
|
|
39077
39256
|
Object.defineProperty(exports, "useIsLargeDesktop", {
|
|
39078
39257
|
enumerable: true,
|
|
39079
|
-
get: function () { return
|
|
39258
|
+
get: function () { return chunkFSBFQBNE_cjs.useIsLargeDesktop; }
|
|
39080
39259
|
});
|
|
39081
39260
|
Object.defineProperty(exports, "useIsMobile", {
|
|
39082
39261
|
enumerable: true,
|
|
39083
|
-
get: function () { return
|
|
39262
|
+
get: function () { return chunkFSBFQBNE_cjs.useIsMobile; }
|
|
39084
39263
|
});
|
|
39085
39264
|
Object.defineProperty(exports, "useIsMobileOrTablet", {
|
|
39086
39265
|
enumerable: true,
|
|
39087
|
-
get: function () { return
|
|
39266
|
+
get: function () { return chunkFSBFQBNE_cjs.useIsMobileOrTablet; }
|
|
39088
39267
|
});
|
|
39089
39268
|
Object.defineProperty(exports, "useIsSmallTablet", {
|
|
39090
39269
|
enumerable: true,
|
|
39091
|
-
get: function () { return
|
|
39270
|
+
get: function () { return chunkFSBFQBNE_cjs.useIsSmallTablet; }
|
|
39092
39271
|
});
|
|
39093
39272
|
Object.defineProperty(exports, "useIsTablet", {
|
|
39094
39273
|
enumerable: true,
|
|
39095
|
-
get: function () { return
|
|
39274
|
+
get: function () { return chunkFSBFQBNE_cjs.useIsTablet; }
|
|
39096
39275
|
});
|
|
39097
39276
|
Object.defineProperty(exports, "useKeyboardShortcut", {
|
|
39098
39277
|
enumerable: true,
|
|
39099
|
-
get: function () { return
|
|
39278
|
+
get: function () { return chunkFSBFQBNE_cjs.useKeyboardShortcut; }
|
|
39100
39279
|
});
|
|
39101
39280
|
Object.defineProperty(exports, "useMediaQuery", {
|
|
39102
39281
|
enumerable: true,
|
|
39103
|
-
get: function () { return
|
|
39282
|
+
get: function () { return chunkFSBFQBNE_cjs.useMediaQuery; }
|
|
39283
|
+
});
|
|
39284
|
+
Object.defineProperty(exports, "useScrollSpy", {
|
|
39285
|
+
enumerable: true,
|
|
39286
|
+
get: function () { return chunkFSBFQBNE_cjs.useScrollSpy; }
|
|
39104
39287
|
});
|
|
39105
39288
|
Object.defineProperty(exports, "useTheme", {
|
|
39106
39289
|
enumerable: true,
|
|
@@ -39470,6 +39653,7 @@ exports.StepIndicator = StepIndicator;
|
|
|
39470
39653
|
exports.StripeBadge = StripeBadge;
|
|
39471
39654
|
exports.StripeSecureBadge = StripeSecureBadge;
|
|
39472
39655
|
exports.SuggestedActions = SuggestedActions;
|
|
39656
|
+
exports.TableOfContents = TableOfContents;
|
|
39473
39657
|
exports.TimelineEventList = TimelineEventList;
|
|
39474
39658
|
exports.TimelineProgress = TimelineProgress;
|
|
39475
39659
|
exports.Toast = Toast;
|