@mortenbrudvik/waveui 0.12.0 → 0.14.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 +362 -60
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.colors.cjs +2 -0
- package/dist/components/data-display/Avatar.colors.cjs.map +1 -0
- package/dist/components/data-display/Avatar.colors.mjs +45 -0
- package/dist/components/data-display/Avatar.colors.mjs.map +1 -0
- package/dist/components/data-display/Avatar.context.cjs +1 -1
- package/dist/components/data-display/Avatar.context.cjs.map +1 -1
- package/dist/components/data-display/Avatar.context.mjs +4 -2
- package/dist/components/data-display/Avatar.context.mjs.map +1 -1
- package/dist/components/data-display/Avatar.mjs +103 -96
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/Avatar.sizes.cjs +2 -0
- package/dist/components/data-display/Avatar.sizes.cjs.map +1 -0
- package/dist/components/data-display/Avatar.sizes.mjs +41 -0
- package/dist/components/data-display/Avatar.sizes.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.context.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.context.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.context.mjs +9 -0
- package/dist/components/data-display/AvatarGroup.context.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.mjs +65 -122
- package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.partition.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.partition.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.partition.mjs +14 -0
- package/dist/components/data-display/AvatarGroup.partition.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.parts.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.parts.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.parts.mjs +178 -0
- package/dist/components/data-display/AvatarGroup.parts.mjs.map +1 -0
- package/dist/components/data-display/InteractionTag.cjs +1 -1
- package/dist/components/data-display/InteractionTag.cjs.map +1 -1
- package/dist/components/data-display/InteractionTag.mjs +36 -33
- package/dist/components/data-display/InteractionTag.mjs.map +1 -1
- package/dist/components/data-display/List.cjs +1 -1
- package/dist/components/data-display/List.cjs.map +1 -1
- package/dist/components/data-display/List.mjs +245 -195
- package/dist/components/data-display/List.mjs.map +1 -1
- package/dist/components/data-display/List.registry.cjs.map +1 -1
- package/dist/components/data-display/List.registry.mjs.map +1 -1
- package/dist/components/data-display/Persona.cjs +1 -1
- package/dist/components/data-display/Persona.cjs.map +1 -1
- package/dist/components/data-display/Persona.mjs +96 -37
- package/dist/components/data-display/Persona.mjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.cjs +1 -1
- package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.mjs +42 -28
- package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +111 -108
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/layout/Card.cjs +1 -1
- package/dist/components/layout/Card.cjs.map +1 -1
- package/dist/components/layout/Card.context.cjs +2 -0
- package/dist/components/layout/Card.context.cjs.map +1 -0
- package/dist/components/layout/Card.context.mjs +14 -0
- package/dist/components/layout/Card.context.mjs.map +1 -0
- package/dist/components/layout/Card.mjs +138 -92
- package/dist/components/layout/Card.mjs.map +1 -1
- package/dist/components/layout/Card.preview.cjs +2 -0
- package/dist/components/layout/Card.preview.cjs.map +1 -0
- package/dist/components/layout/Card.preview.mjs +22 -0
- package/dist/components/layout/Card.preview.mjs.map +1 -0
- package/dist/components/layout/Carousel.button.cjs +2 -0
- package/dist/components/layout/Carousel.button.cjs.map +1 -0
- package/dist/components/layout/Carousel.button.mjs +34 -0
- package/dist/components/layout/Carousel.button.mjs.map +1 -0
- package/dist/components/layout/Carousel.cjs +1 -1
- package/dist/components/layout/Carousel.cjs.map +1 -1
- package/dist/components/layout/Carousel.context.cjs +2 -0
- package/dist/components/layout/Carousel.context.cjs.map +1 -0
- package/dist/components/layout/Carousel.context.mjs +24 -0
- package/dist/components/layout/Carousel.context.mjs.map +1 -0
- package/dist/components/layout/Carousel.drag.cjs +2 -0
- package/dist/components/layout/Carousel.drag.cjs.map +1 -0
- package/dist/components/layout/Carousel.drag.mjs +79 -0
- package/dist/components/layout/Carousel.drag.mjs.map +1 -0
- package/dist/components/layout/Carousel.groups.cjs +2 -0
- package/dist/components/layout/Carousel.groups.cjs.map +1 -0
- package/dist/components/layout/Carousel.groups.mjs +23 -0
- package/dist/components/layout/Carousel.groups.mjs.map +1 -0
- package/dist/components/layout/Carousel.mjs +288 -150
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/Carousel.styles.cjs +2 -0
- package/dist/components/layout/Carousel.styles.cjs.map +1 -0
- package/dist/components/layout/Carousel.styles.mjs +30 -0
- package/dist/components/layout/Carousel.styles.mjs.map +1 -0
- package/dist/components/layout/Overflow.cjs +1 -1
- package/dist/components/layout/Overflow.cjs.map +1 -1
- package/dist/components/layout/Overflow.mjs +240 -192
- package/dist/components/layout/Overflow.mjs.map +1 -1
- package/dist/components/layout/Overflow.store.cjs +2 -0
- package/dist/components/layout/Overflow.store.cjs.map +1 -0
- package/dist/components/layout/Overflow.store.mjs +209 -0
- package/dist/components/layout/Overflow.store.mjs.map +1 -0
- package/dist/components/layout/TabList.cjs +1 -1
- package/dist/components/layout/TabList.cjs.map +1 -1
- package/dist/components/layout/TabList.mjs +163 -124
- package/dist/components/layout/TabList.mjs.map +1 -1
- package/dist/components/navigation/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
- package/dist/components/navigation/Breadcrumb.mjs +239 -84
- package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.cjs +1 -1
- package/dist/components/overlays/Dialog.slots.cjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.mjs +19 -15
- package/dist/components/overlays/Dialog.slots.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.context.cjs +2 -0
- package/dist/components/overlays/TeachingPopover.context.cjs.map +1 -0
- package/dist/components/overlays/TeachingPopover.context.mjs +51 -0
- package/dist/components/overlays/TeachingPopover.context.mjs.map +1 -0
- package/dist/components/overlays/TeachingPopover.mjs +15 -185
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.parts.cjs +2 -0
- package/dist/components/overlays/TeachingPopover.parts.cjs.map +1 -0
- package/dist/components/overlays/TeachingPopover.parts.mjs +398 -0
- package/dist/components/overlays/TeachingPopover.parts.mjs.map +1 -0
- package/dist/components/overlays/TeachingPopover.root.cjs +2 -0
- package/dist/components/overlays/TeachingPopover.root.cjs.map +1 -0
- package/dist/components/overlays/TeachingPopover.root.mjs +150 -0
- package/dist/components/overlays/TeachingPopover.root.mjs.map +1 -0
- package/dist/components/overlays/TeachingPopover.stack.cjs +2 -0
- package/dist/components/overlays/TeachingPopover.stack.cjs.map +1 -0
- package/dist/components/overlays/TeachingPopover.stack.mjs +86 -0
- package/dist/components/overlays/TeachingPopover.stack.mjs.map +1 -0
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.mjs +540 -311
- package/dist/components/table/DataGrid.mjs.map +1 -1
- package/dist/components/table/Table.cjs +1 -1
- package/dist/components/table/Table.cjs.map +1 -1
- package/dist/components/table/Table.mjs +183 -60
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/Table.shared.cjs +2 -0
- package/dist/components/table/Table.shared.cjs.map +1 -0
- package/dist/components/table/Table.shared.mjs +65 -0
- package/dist/components/table/Table.shared.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2299 -213
- package/dist/index.d.ts +2299 -213
- package/dist/index.mjs +135 -127
- package/dist/lib/breadcrumb.cjs +2 -0
- package/dist/lib/breadcrumb.cjs.map +1 -0
- package/dist/lib/breadcrumb.mjs +26 -0
- package/dist/lib/breadcrumb.mjs.map +1 -0
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +143 -95
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/events.cjs +1 -1
- package/dist/lib/events.cjs.map +1 -1
- package/dist/lib/events.mjs +35 -8
- package/dist/lib/events.mjs.map +1 -1
- package/dist/lib/icons.cjs +1 -1
- package/dist/lib/icons.cjs.map +1 -1
- package/dist/lib/icons.mjs +34 -20
- package/dist/lib/icons.mjs.map +1 -1
- package/dist/lib/initials.cjs +2 -0
- package/dist/lib/initials.cjs.map +1 -0
- package/dist/lib/initials.mjs +21 -0
- package/dist/lib/initials.mjs.map +1 -0
- package/dist/lib/table.cjs +2 -0
- package/dist/lib/table.cjs.map +1 -0
- package/dist/lib/table.mjs +16 -0
- package/dist/lib/table.mjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +102 -0
|
@@ -1,163 +1,62 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../lib/cn.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
3
|
+
import { flattenChildren as t, isElementOfType as n } from "../../lib/children.mjs";
|
|
4
|
+
import { reportMissingContext as r, warnOnce as i } from "../../lib/dev.mjs";
|
|
5
|
+
import { overflowClassNames as a, overflowDividerClassNames as o, overflowItemClassNames as s } from "../../lib/classNames.mjs";
|
|
6
|
+
import { useEventCallback as c } from "../../hooks/useEventCallback.mjs";
|
|
7
|
+
import { FOCUSABLE_SELECTOR as l, getFirstTabbable as u, isFocusable as d } from "../../lib/focus.mjs";
|
|
8
|
+
import { useMergedRefs as f } from "../../hooks/useMergedRefs.mjs";
|
|
9
|
+
import { mergeProps as p } from "../../lib/mergeProps.mjs";
|
|
10
|
+
import { usePreserveFocus as m } from "../../hooks/usePreserveFocus.mjs";
|
|
11
|
+
import { isCloneableElement as h, unwrapFragment as g } from "../../lib/renderTrigger.mjs";
|
|
12
|
+
import { NO_GROUPS as _, NO_IDS as v, OverflowStore as y, hasResizeObserver as b, sameIds as x } from "./Overflow.store.mjs";
|
|
13
|
+
import * as S from "react";
|
|
14
|
+
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
8
15
|
//#region src/components/layout/Overflow.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return s.useReducer((e) => e + 1, 0)[1];
|
|
16
|
+
function T() {
|
|
17
|
+
return S.useReducer((e) => e + 1, 0)[1];
|
|
12
18
|
}
|
|
13
|
-
|
|
14
|
-
return typeof ResizeObserver < "u";
|
|
15
|
-
}
|
|
16
|
-
function p(e, t) {
|
|
17
|
-
return e === t ? 0 : e.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
18
|
-
}
|
|
19
|
-
var m = {
|
|
20
|
-
childList: !0,
|
|
21
|
-
subtree: !0
|
|
22
|
-
};
|
|
23
|
-
function h(e, t) {
|
|
24
|
-
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
25
|
-
}
|
|
26
|
-
function g(e) {
|
|
27
|
-
r(`Overflow:duplicate:${e}`, `Overflow: several items share the itemId "${e}". Item ids must be unique within an Overflow; items with the same itemId are hidden and shown together.`);
|
|
28
|
-
}
|
|
29
|
-
var _ = () => {};
|
|
30
|
-
function v(e) {
|
|
31
|
-
let t = 0, n = 0, r = e.ownerDocument.defaultView;
|
|
32
|
-
if (r) {
|
|
33
|
-
let i = r.getComputedStyle(e);
|
|
34
|
-
t = (parseFloat(i.paddingLeft) || 0) + (parseFloat(i.paddingRight) || 0), n = parseFloat(i.columnGap) || 0;
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
available: e.clientWidth - t,
|
|
38
|
-
gap: n
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
var y = class {
|
|
42
|
-
container = null;
|
|
43
|
-
button = null;
|
|
44
|
-
buttonWidth = 0;
|
|
45
|
-
items = /* @__PURE__ */ new Map();
|
|
46
|
-
itemIdCounts = /* @__PURE__ */ new Map();
|
|
47
|
-
widths = /* @__PURE__ */ new WeakMap();
|
|
48
|
-
listeners = /* @__PURE__ */ new Set();
|
|
49
|
-
hidden = u;
|
|
50
|
-
pinned = !1;
|
|
51
|
-
order = [];
|
|
52
|
-
connected = !1;
|
|
53
|
-
observer = null;
|
|
54
|
-
reorderObserver = null;
|
|
55
|
-
removeResizeListener = null;
|
|
56
|
-
subscribe = (e) => (this.listeners.add(e), () => {
|
|
57
|
-
this.listeners.delete(e);
|
|
58
|
-
});
|
|
59
|
-
getSnapshot = () => this.hidden;
|
|
60
|
-
getServerSnapshot = () => u;
|
|
61
|
-
getPinned = () => this.pinned;
|
|
62
|
-
getServerPinned = () => !1;
|
|
63
|
-
connect = () => {
|
|
64
|
-
if (this.connected = !0, f()) {
|
|
65
|
-
this.observer = new ResizeObserver(() => this.measure());
|
|
66
|
-
for (let e of this.observedElements()) this.observer.observe(e);
|
|
67
|
-
} else if (typeof window < "u") {
|
|
68
|
-
let e = () => this.measure();
|
|
69
|
-
window.addEventListener("resize", e), this.removeResizeListener = () => window.removeEventListener("resize", e);
|
|
70
|
-
}
|
|
71
|
-
return typeof MutationObserver < "u" && (this.reorderObserver = new MutationObserver(() => this.checkOrder()), this.container && this.reorderObserver.observe(this.container, m)), this.measure(), () => {
|
|
72
|
-
this.connected = !1, this.observer?.disconnect(), this.observer = null, this.reorderObserver?.disconnect(), this.reorderObserver = null, this.removeResizeListener?.(), this.removeResizeListener = null;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
setContainer = (e) => {
|
|
76
|
-
e !== this.container && (this.container && this.observer?.unobserve(this.container), this.container = e, e && this.observer?.observe(e), this.reorderObserver && (this.reorderObserver.disconnect(), e && this.reorderObserver.observe(e, m)), this.measure());
|
|
77
|
-
};
|
|
78
|
-
checkOrder = () => {
|
|
79
|
-
let e = this.order;
|
|
80
|
-
for (let t = 1; t < e.length; t++) if (p(e[t - 1], e[t]) > 0) {
|
|
81
|
-
this.measure();
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
setButton = (e) => {
|
|
86
|
-
e !== this.button && (this.button && this.observer?.unobserve(this.button), this.button = e, e && this.observer?.observe(e), this.measure());
|
|
87
|
-
};
|
|
88
|
-
registerItem(e, t) {
|
|
89
|
-
return this.items.set(e, t), this.observer?.observe(e), this.measure(), () => {
|
|
90
|
-
this.items.get(e) === t && (this.items.delete(e), this.observer?.unobserve(e), this.measure());
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
registerItemId = (e) => {
|
|
94
|
-
if (!t) return _;
|
|
95
|
-
let n = this.itemIdCounts, r = (n.get(e) ?? 0) + 1;
|
|
96
|
-
return n.set(e, r), r > 1 && g(e), () => {
|
|
97
|
-
let t = (n.get(e) ?? 1) - 1;
|
|
98
|
-
t > 0 ? n.set(e, t) : n.delete(e);
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
observedElements() {
|
|
102
|
-
let e = Array.from(this.items.keys());
|
|
103
|
-
return this.container && e.push(this.container), this.button && e.push(this.button), e;
|
|
104
|
-
}
|
|
105
|
-
measure() {
|
|
106
|
-
let e = this.container;
|
|
107
|
-
if (!this.connected || !e) return;
|
|
108
|
-
let t = Array.from(this.items).filter(([t]) => t.isConnected && e.contains(t)).sort(([e], [t]) => p(e, t));
|
|
109
|
-
this.order = t.map(([e]) => e);
|
|
110
|
-
for (let [e] of t) e.hasAttribute("data-overflow-hidden") || this.widths.set(e, e.offsetWidth);
|
|
111
|
-
this.button?.isConnected && (this.buttonWidth = this.button.offsetWidth);
|
|
112
|
-
let { available: n, gap: r } = v(e), i = t.map(([e]) => this.widths.get(e) ?? 0), a = i.reduce((e, t, n) => e + t + (n > 0 ? r : 0), 0), o = u, s = !1;
|
|
113
|
-
if (a > n) {
|
|
114
|
-
let e = n - (this.buttonWidth > 0 ? this.buttonWidth + r : 0), a = 0, c = t.length;
|
|
115
|
-
for (let n = 0; n < t.length; n++) {
|
|
116
|
-
let t = a + i[n] + (n > 0 ? r : 0);
|
|
117
|
-
if (n > 0 && t > e) {
|
|
118
|
-
c = n;
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
a = t;
|
|
122
|
-
}
|
|
123
|
-
o = t.slice(c).map(([, e]) => e), s = o.length > 0 && i[0] + this.buttonWidth > n;
|
|
124
|
-
}
|
|
125
|
-
let c = !h(o, this.hidden);
|
|
126
|
-
if (c || s !== this.pinned) {
|
|
127
|
-
c && (this.hidden = o.length > 0 ? o : u), this.pinned = s;
|
|
128
|
-
for (let e of Array.from(this.listeners)) e();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}, b = s.createContext(null), x = {
|
|
19
|
+
var E = S.createContext(null), D = {
|
|
132
20
|
store: /* @__PURE__ */ new y(),
|
|
133
|
-
hiddenIds:
|
|
134
|
-
hiddenSet: /* @__PURE__ */ new Set()
|
|
21
|
+
hiddenIds: v,
|
|
22
|
+
hiddenSet: /* @__PURE__ */ new Set(),
|
|
23
|
+
groupVisibility: _,
|
|
24
|
+
direction: "end",
|
|
25
|
+
orientation: "horizontal",
|
|
26
|
+
hasHiddenItems: !1
|
|
135
27
|
};
|
|
136
|
-
function
|
|
137
|
-
return
|
|
28
|
+
function O(e) {
|
|
29
|
+
return S.useContext(E) || (r(e, "Overflow"), D);
|
|
138
30
|
}
|
|
139
|
-
function
|
|
140
|
-
let { hiddenIds: e } =
|
|
141
|
-
return
|
|
31
|
+
function k() {
|
|
32
|
+
let { hiddenIds: e } = O("useOverflowMenu");
|
|
33
|
+
return S.useMemo(() => ({
|
|
142
34
|
hiddenIds: [...e],
|
|
143
35
|
count: e.length
|
|
144
36
|
}), [e]);
|
|
145
37
|
}
|
|
146
|
-
function
|
|
147
|
-
let { hiddenSet: t } =
|
|
38
|
+
function A(e) {
|
|
39
|
+
let { hiddenSet: t } = O("useIsOverflowItemVisible");
|
|
148
40
|
return !t.has(e);
|
|
149
41
|
}
|
|
150
|
-
function
|
|
42
|
+
function j(e) {
|
|
43
|
+
let { groupVisibility: t } = O("useIsOverflowGroupVisible");
|
|
44
|
+
return t[e] ?? "visible";
|
|
45
|
+
}
|
|
46
|
+
function M() {
|
|
47
|
+
return O("useHasHiddenItems").hasHiddenItems;
|
|
48
|
+
}
|
|
49
|
+
function N(e) {
|
|
151
50
|
return e.nodeType === Node.ELEMENT_NODE;
|
|
152
51
|
}
|
|
153
|
-
function
|
|
52
|
+
function P(e, t, n) {
|
|
154
53
|
for (let r of n) r.type === "childList" && r.target === t && (r.removedNodes.forEach((t) => {
|
|
155
|
-
|
|
54
|
+
N(t) && e.unobserve(t);
|
|
156
55
|
}), r.addedNodes.forEach((n) => {
|
|
157
|
-
|
|
56
|
+
N(n) && n.parentNode === t && e.observe(n);
|
|
158
57
|
}));
|
|
159
58
|
}
|
|
160
|
-
var
|
|
59
|
+
var F = class {
|
|
161
60
|
element = null;
|
|
162
61
|
value = !1;
|
|
163
62
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -174,7 +73,7 @@ var D = class {
|
|
|
174
73
|
this.teardown?.(), this.teardown = null, this.element = null;
|
|
175
74
|
}
|
|
176
75
|
observe(e) {
|
|
177
|
-
let t = () => this.check(), n = [], r =
|
|
76
|
+
let t = () => this.check(), n = [], r = b() ? new ResizeObserver(t) : null;
|
|
178
77
|
if (r) {
|
|
179
78
|
r.observe(e);
|
|
180
79
|
for (let t of Array.from(e.children)) r.observe(t);
|
|
@@ -182,7 +81,7 @@ var D = class {
|
|
|
182
81
|
} else typeof window < "u" && (window.addEventListener("resize", t), n.push(() => window.removeEventListener("resize", t)));
|
|
183
82
|
if (typeof MutationObserver < "u") {
|
|
184
83
|
let i = new MutationObserver((n) => {
|
|
185
|
-
r &&
|
|
84
|
+
r && P(r, e, n), t();
|
|
186
85
|
});
|
|
187
86
|
i.observe(e, {
|
|
188
87
|
childList: !0,
|
|
@@ -200,71 +99,220 @@ var D = class {
|
|
|
200
99
|
}
|
|
201
100
|
}
|
|
202
101
|
};
|
|
203
|
-
function
|
|
102
|
+
function I(e) {
|
|
204
103
|
return typeof e == "object" && !!e && "current" in e;
|
|
205
104
|
}
|
|
206
|
-
function
|
|
207
|
-
let [t] =
|
|
208
|
-
return
|
|
105
|
+
function L(e) {
|
|
106
|
+
let [t] = S.useState(() => new F()), n = S.useSyncExternalStore(t.subscribe, t.getSnapshot, t.getServerSnapshot), r = T();
|
|
107
|
+
return S.useLayoutEffect(() => {
|
|
209
108
|
let n = t.subscribe(r);
|
|
210
|
-
t.setElement(
|
|
211
|
-
}),
|
|
109
|
+
t.setElement(I(e) ? e.current : e), n();
|
|
110
|
+
}), S.useLayoutEffect(() => () => t.disconnect(), [t]), n;
|
|
111
|
+
}
|
|
112
|
+
var R = {
|
|
113
|
+
horizontal: "items-center",
|
|
114
|
+
vertical: "flex-col items-start"
|
|
115
|
+
}, z = {
|
|
116
|
+
horizontal: "flex shrink-0 items-center self-stretch",
|
|
117
|
+
vertical: "flex shrink-0 flex-col items-start self-stretch"
|
|
118
|
+
}, B = {
|
|
119
|
+
end: {
|
|
120
|
+
horizontal: "sticky -end-1 flex shrink-0 items-center self-stretch ps-1 data-[overflow-pinned]:bg-background data-[overflow-pinned]:pe-1",
|
|
121
|
+
vertical: "sticky -bottom-1 flex shrink-0 items-center self-stretch pt-1 data-[overflow-pinned]:bg-background data-[overflow-pinned]:pb-1"
|
|
122
|
+
},
|
|
123
|
+
"before-hidden": {
|
|
124
|
+
horizontal: "sticky -end-1 flex shrink-0 items-center self-stretch data-[overflow-pinned]:bg-background data-[overflow-pinned]:pe-1",
|
|
125
|
+
vertical: "sticky -bottom-1 flex shrink-0 items-center self-stretch data-[overflow-pinned]:bg-background data-[overflow-pinned]:pb-1"
|
|
126
|
+
}
|
|
127
|
+
}, V = "wave-overflow-button";
|
|
128
|
+
function H(e) {
|
|
129
|
+
return d(e) ? e : u(e) ?? Array.from(e.querySelectorAll(l)).find(d) ?? null;
|
|
130
|
+
}
|
|
131
|
+
function U(e, t) {
|
|
132
|
+
let n = new Set(t), r = e.findIndex(({ id: e }) => n.has(e)), i = r < 0 ? [...e].reverse() : [
|
|
133
|
+
...e.filter(({ id: e }) => n.has(e)),
|
|
134
|
+
...e.slice(0, r).reverse(),
|
|
135
|
+
...e.slice(r).filter(({ id: e }) => !n.has(e))
|
|
136
|
+
];
|
|
137
|
+
for (let { element: e } of i) {
|
|
138
|
+
let t = H(e);
|
|
139
|
+
if (t) return t;
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
function W({ store: e, hiddenIds: t, buttonRef: n, ...r }) {
|
|
144
|
+
let i = S.useRef(null), a = f(n, i), o = S.useRef(v);
|
|
145
|
+
return S.useLayoutEffect(() => {
|
|
146
|
+
o.current = t;
|
|
147
|
+
}), m(i, () => U(e.getItemElements(), o.current)), /* @__PURE__ */ C("div", {
|
|
148
|
+
ref: a,
|
|
149
|
+
...r
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
W.displayName = "OverflowButtonSlot";
|
|
153
|
+
function G(e, r, i) {
|
|
154
|
+
let a = t(e).map(({ key: e, node: t }) => S.isValidElement(t) ? S.cloneElement(t, { key: e }) : t);
|
|
155
|
+
if (!r) return {
|
|
156
|
+
nodes: a,
|
|
157
|
+
missing: !1
|
|
158
|
+
};
|
|
159
|
+
let o = i === void 0 ? -1 : a.findIndex((e) => n(e, q) && e.props.itemId === i);
|
|
160
|
+
return a.splice(o < 0 ? a.length : o, 0, r), {
|
|
161
|
+
nodes: a,
|
|
162
|
+
missing: i !== void 0 && o < 0
|
|
163
|
+
};
|
|
212
164
|
}
|
|
213
|
-
var
|
|
214
|
-
let [
|
|
215
|
-
|
|
216
|
-
|
|
165
|
+
var K = ({ overflowButton: t, buttonPosition: n = "end", overflowDirection: r = "end", orientation: o = "horizontal", minimumVisible: s = 0, hasHiddenItems: l = !1, onOverflowChange: u, children: d, className: p, ref: m, ...h }) => {
|
|
166
|
+
let [g] = S.useState(() => new y()), _ = S.useSyncExternalStore(g.subscribe, g.getSnapshot, g.getServerSnapshot), b = S.useSyncExternalStore(g.subscribe, g.getMeasured, g.getServerFlag), D = S.useSyncExternalStore(g.subscribe, g.getButtonCovers, g.getServerFlag), O = S.useSyncExternalStore(g.subscribe, g.getGroups, g.getServerGroups), k = S.useCallback((e) => g.setContainer(e), [g]), A = S.useCallback((e) => g.setButton(e), [g]), j = f(m, k), M = T();
|
|
167
|
+
S.useLayoutEffect(() => {
|
|
168
|
+
g.setConfig({
|
|
169
|
+
direction: r,
|
|
170
|
+
orientation: o,
|
|
171
|
+
minimumVisible: s,
|
|
172
|
+
hasHiddenItems: l
|
|
173
|
+
});
|
|
174
|
+
}, [
|
|
175
|
+
g,
|
|
176
|
+
r,
|
|
177
|
+
o,
|
|
178
|
+
s,
|
|
179
|
+
l
|
|
180
|
+
]), S.useLayoutEffect(() => {
|
|
181
|
+
let e = g.subscribe(M), t = g.connect();
|
|
217
182
|
return e(), t;
|
|
218
|
-
}, [
|
|
219
|
-
|
|
183
|
+
}, [g, M]), S.useLayoutEffect(() => {
|
|
184
|
+
g.checkOrder();
|
|
220
185
|
});
|
|
221
|
-
let
|
|
222
|
-
store:
|
|
223
|
-
hiddenIds:
|
|
224
|
-
hiddenSet:
|
|
186
|
+
let N = S.useMemo(() => new Set(_), [_]), P = S.useMemo(() => [..._], [_]), F = _.length, I = S.useMemo(() => ({
|
|
187
|
+
store: g,
|
|
188
|
+
hiddenIds: _,
|
|
189
|
+
hiddenSet: N,
|
|
190
|
+
groupVisibility: O,
|
|
191
|
+
direction: r,
|
|
192
|
+
orientation: o,
|
|
193
|
+
hasHiddenItems: F > 0
|
|
225
194
|
}), [
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
195
|
+
g,
|
|
196
|
+
_,
|
|
197
|
+
N,
|
|
198
|
+
O,
|
|
199
|
+
r,
|
|
200
|
+
o,
|
|
201
|
+
F
|
|
202
|
+
]), L = c(u), z = S.useRef(v), H = t !== void 0;
|
|
203
|
+
S.useEffect(() => {
|
|
204
|
+
let e = g.getSnapshot();
|
|
205
|
+
x(e, _) && g.isSettled(H) && (x(e, z.current) || (z.current = e, L([...e], {
|
|
206
|
+
visibleItems: g.getVisibleIds(),
|
|
207
|
+
groupVisibility: Object.assign(Object.create(null), g.getGroups())
|
|
208
|
+
})));
|
|
209
|
+
}, [
|
|
210
|
+
g,
|
|
211
|
+
_,
|
|
212
|
+
H,
|
|
213
|
+
L
|
|
214
|
+
]);
|
|
215
|
+
let U = (F > 0 || l && !b) && t ? /* @__PURE__ */ C(W, {
|
|
216
|
+
store: g,
|
|
217
|
+
hiddenIds: _,
|
|
218
|
+
buttonRef: A,
|
|
219
|
+
role: h.role === "list" ? "listitem" : void 0,
|
|
220
|
+
"data-overflow-button": "",
|
|
221
|
+
"data-overflow-pinned": D ? "" : void 0,
|
|
222
|
+
className: e(a.overflowButton, B[n][o]),
|
|
223
|
+
children: t(F, P)
|
|
224
|
+
}, V) : null, K = n === "before-hidden" ? G(d, U, _[0]) : null, q = K?.missing ?? !1;
|
|
225
|
+
return S.useEffect(() => {
|
|
226
|
+
q && i("Overflow:button-position", "Overflow: buttonPosition=\"before-hidden\" puts the button before the first hidden item only when that item is a child of the Overflow (Fragments and arrays are opened), not one rendered by another component; the button is rendered after the items instead.");
|
|
227
|
+
}, [q]), /* @__PURE__ */ C(E.Provider, {
|
|
228
|
+
value: I,
|
|
229
|
+
children: /* @__PURE__ */ w("div", {
|
|
230
|
+
ref: j,
|
|
231
|
+
className: e(a.root, "flex overflow-hidden p-1", R[o], p),
|
|
232
|
+
"data-orientation": o,
|
|
233
|
+
"data-overflow-direction": r,
|
|
234
|
+
"data-button-position": n,
|
|
235
|
+
...h,
|
|
236
|
+
children: [K ? K.nodes : d, K ? null : U]
|
|
243
237
|
})
|
|
244
238
|
});
|
|
245
239
|
};
|
|
246
|
-
|
|
247
|
-
var
|
|
248
|
-
let { store:
|
|
249
|
-
|
|
250
|
-
let
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
240
|
+
K.displayName = "Overflow";
|
|
241
|
+
var q = ({ itemId: t, priority: n, pinned: r = !1, groupId: a, asChild: o = !1, children: c, className: l, style: u, ref: d, "aria-hidden": m, inert: _, ...v }) => {
|
|
242
|
+
let { store: y, hiddenSet: b } = O("OverflowItem"), x = b.has(t);
|
|
243
|
+
S.useEffect(() => y.registerItemId(t), [y, t]);
|
|
244
|
+
let w = o ? g(c) : void 0, T = h(w) ? w : null, { ref: E, ...D } = (T ? T.props : null) ?? {}, k = o && T === null && c != null;
|
|
245
|
+
S.useEffect(() => {
|
|
246
|
+
k && i("Overflow.Item:as-child-children", "Overflow.Item: asChild expects a single React element child (not text or several elements); the children are rendered inside a <div> instead.");
|
|
247
|
+
}, [k]);
|
|
248
|
+
let A = S.useCallback((e) => e ? y.registerItem(e, t) : void 0, [y, t]), j = S.useRef(null), M = f(d, A, j, E);
|
|
249
|
+
S.useLayoutEffect(() => {
|
|
250
|
+
j.current && y.setItemMeta(j.current, n, r, a);
|
|
251
|
+
});
|
|
252
|
+
let N = e(s.root, "shrink-0", l);
|
|
253
|
+
if (T) {
|
|
254
|
+
let e = x ? {
|
|
255
|
+
"aria-hidden": !0,
|
|
256
|
+
inert: !0,
|
|
257
|
+
"data-overflow-hidden": ""
|
|
258
|
+
} : {};
|
|
259
|
+
!x && m !== void 0 && (e["aria-hidden"] = m), !x && _ !== void 0 && (e.inert = _);
|
|
260
|
+
let t = p({
|
|
261
|
+
...v,
|
|
262
|
+
...e,
|
|
263
|
+
className: N,
|
|
264
|
+
style: u
|
|
265
|
+
}, D, { oursWin: [
|
|
266
|
+
"aria-hidden",
|
|
267
|
+
"inert",
|
|
268
|
+
"data-overflow-hidden"
|
|
269
|
+
] }), n = t.style;
|
|
270
|
+
return S.cloneElement(T, {
|
|
271
|
+
...t,
|
|
272
|
+
ref: M,
|
|
273
|
+
style: x ? {
|
|
274
|
+
...n,
|
|
275
|
+
display: "none"
|
|
276
|
+
} : n
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
return /* @__PURE__ */ C("div", {
|
|
280
|
+
ref: M,
|
|
281
|
+
className: N,
|
|
282
|
+
...v,
|
|
283
|
+
style: x ? {
|
|
284
|
+
...u,
|
|
285
|
+
display: "none"
|
|
286
|
+
} : u,
|
|
287
|
+
"aria-hidden": x ? !0 : m,
|
|
288
|
+
inert: x ? !0 : _,
|
|
289
|
+
"data-overflow-hidden": x ? "" : void 0,
|
|
290
|
+
children: c
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
q.displayName = "OverflowItem";
|
|
294
|
+
var J = ({ groupId: t, children: n, className: r, style: i, ref: a, "aria-hidden": s, inert: c, ...l }) => {
|
|
295
|
+
let { store: u, groupVisibility: d, orientation: p } = O("OverflowDivider"), m = d[t] === "hidden", h = S.useCallback((e) => e ? u.registerDivider(e, t) : void 0, [u, t]), g = f(a, h);
|
|
296
|
+
return /* @__PURE__ */ C("div", {
|
|
297
|
+
ref: g,
|
|
298
|
+
className: e(o.root, z[p], r),
|
|
299
|
+
...l,
|
|
300
|
+
style: m ? {
|
|
256
301
|
...i,
|
|
257
302
|
display: "none"
|
|
258
303
|
} : i,
|
|
259
|
-
"aria-hidden":
|
|
260
|
-
inert:
|
|
261
|
-
"data-overflow-hidden":
|
|
304
|
+
"aria-hidden": m ? !0 : s,
|
|
305
|
+
inert: m ? !0 : c,
|
|
306
|
+
"data-overflow-hidden": m ? "" : void 0,
|
|
262
307
|
children: n
|
|
263
308
|
});
|
|
264
309
|
};
|
|
265
|
-
|
|
266
|
-
var
|
|
310
|
+
J.displayName = "OverflowDivider";
|
|
311
|
+
var Y = /* @__PURE__ */ Object.assign(K, {
|
|
312
|
+
Item: q,
|
|
313
|
+
Divider: J
|
|
314
|
+
});
|
|
267
315
|
//#endregion
|
|
268
|
-
export {
|
|
316
|
+
export { Y as Overflow, J as OverflowDivider, q as OverflowItem, M as useHasHiddenItems, j as useIsOverflowGroupVisible, A as useIsOverflowItemVisible, L as useIsOverflowing, k as useOverflowMenu };
|
|
269
317
|
|
|
270
318
|
//# sourceMappingURL=Overflow.mjs.map
|