@phillips/seldon 1.43.0 → 1.44.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.
@@ -0,0 +1,129 @@
1
+ const P = ["top", "right", "bottom", "left"], l = Math.min, m = Math.max, M = Math.round, O = Math.floor, S = (t) => ({
2
+ x: t,
3
+ y: t
4
+ }), p = {
5
+ left: "right",
6
+ right: "left",
7
+ bottom: "top",
8
+ top: "bottom"
9
+ }, a = {
10
+ start: "end",
11
+ end: "start"
12
+ };
13
+ function w(t, n, e) {
14
+ return m(t, l(n, e));
15
+ }
16
+ function j(t, n) {
17
+ return typeof t == "function" ? t(n) : t;
18
+ }
19
+ function u(t) {
20
+ return t.split("-")[0];
21
+ }
22
+ function g(t) {
23
+ return t.split("-")[1];
24
+ }
25
+ function h(t) {
26
+ return t === "x" ? "y" : "x";
27
+ }
28
+ function b(t) {
29
+ return t === "y" ? "height" : "width";
30
+ }
31
+ function x(t) {
32
+ return ["top", "bottom"].includes(u(t)) ? "y" : "x";
33
+ }
34
+ function d(t) {
35
+ return h(x(t));
36
+ }
37
+ function C(t, n, e) {
38
+ e === void 0 && (e = !1);
39
+ const r = g(t), o = d(t), i = b(o);
40
+ let c = o === "x" ? r === (e ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
41
+ return n.reference[i] > n.floating[i] && (c = f(c)), [c, f(c)];
42
+ }
43
+ function L(t) {
44
+ const n = f(t);
45
+ return [s(t), n, s(n)];
46
+ }
47
+ function s(t) {
48
+ return t.replace(/start|end/g, (n) => a[n]);
49
+ }
50
+ function A(t, n, e) {
51
+ const r = ["left", "right"], o = ["right", "left"], i = ["top", "bottom"], c = ["bottom", "top"];
52
+ switch (t) {
53
+ case "top":
54
+ case "bottom":
55
+ return e ? n ? o : r : n ? r : o;
56
+ case "left":
57
+ case "right":
58
+ return n ? i : c;
59
+ default:
60
+ return [];
61
+ }
62
+ }
63
+ function E(t, n, e, r) {
64
+ const o = g(t);
65
+ let i = A(u(t), e === "start", r);
66
+ return o && (i = i.map((c) => c + "-" + o), n && (i = i.concat(i.map(s)))), i;
67
+ }
68
+ function f(t) {
69
+ return t.replace(/left|right|bottom|top/g, (n) => p[n]);
70
+ }
71
+ function y(t) {
72
+ return {
73
+ top: 0,
74
+ right: 0,
75
+ bottom: 0,
76
+ left: 0,
77
+ ...t
78
+ };
79
+ }
80
+ function R(t) {
81
+ return typeof t != "number" ? y(t) : {
82
+ top: t,
83
+ right: t,
84
+ bottom: t,
85
+ left: t
86
+ };
87
+ }
88
+ function T(t) {
89
+ const {
90
+ x: n,
91
+ y: e,
92
+ width: r,
93
+ height: o
94
+ } = t;
95
+ return {
96
+ width: r,
97
+ height: o,
98
+ top: e,
99
+ left: n,
100
+ right: n + r,
101
+ bottom: e + o,
102
+ x: n,
103
+ y: e
104
+ };
105
+ }
106
+ export {
107
+ w as clamp,
108
+ S as createCoords,
109
+ j as evaluate,
110
+ y as expandPaddingObject,
111
+ O as floor,
112
+ g as getAlignment,
113
+ d as getAlignmentAxis,
114
+ C as getAlignmentSides,
115
+ b as getAxisLength,
116
+ L as getExpandedPlacements,
117
+ s as getOppositeAlignmentPlacement,
118
+ h as getOppositeAxis,
119
+ E as getOppositeAxisPlacements,
120
+ f as getOppositePlacement,
121
+ R as getPaddingObject,
122
+ u as getSide,
123
+ x as getSideAxis,
124
+ m as max,
125
+ l as min,
126
+ T as rectToClientRect,
127
+ M as round,
128
+ P as sides
129
+ };
@@ -0,0 +1,6 @@
1
+ function m(t, [a, n]) {
2
+ return Math.min(n, Math.max(a, t));
3
+ }
4
+ export {
5
+ m as clamp
6
+ };
@@ -0,0 +1,24 @@
1
+ import * as n from "react";
2
+ import { Primitive as p } from "../../react-primitive/dist/index.js";
3
+ import { jsx as o } from "react/jsx-runtime";
4
+ var v = "Arrow", e = n.forwardRef((r, i) => {
5
+ const { children: t, width: a = 10, height: s = 5, ...m } = r;
6
+ return /* @__PURE__ */ o(
7
+ p.svg,
8
+ {
9
+ ...m,
10
+ ref: i,
11
+ width: a,
12
+ height: s,
13
+ viewBox: "0 0 30 10",
14
+ preserveAspectRatio: "none",
15
+ children: r.asChild ? t : /* @__PURE__ */ o("polygon", { points: "0,0 30,0 15,10" })
16
+ }
17
+ );
18
+ });
19
+ e.displayName = v;
20
+ var h = e;
21
+ export {
22
+ e as Arrow,
23
+ h as Root
24
+ };
@@ -0,0 +1,220 @@
1
+ import * as s from "react";
2
+ import { useFloating as ye, offset as Ae, shift as ve, flip as Ce, size as be, arrow as Se, hide as Oe, limitShift as Re } from "../../../@floating-ui/react-dom/dist/floating-ui.react-dom.js";
3
+ import { Root as Ee } from "../../react-arrow/dist/index.js";
4
+ import { useComposedRefs as Z } from "../../react-compose-refs/dist/index.js";
5
+ import { createContextScope as Ne } from "../../react-context/dist/index.js";
6
+ import { Primitive as U } from "../../react-primitive/dist/index.js";
7
+ import { useCallbackRef as _e } from "../../react-use-callback-ref/dist/index.js";
8
+ import { useLayoutEffect as L } from "../../react-use-layout-effect/dist/index.js";
9
+ import { useSize as $e } from "../../react-use-size/dist/index.js";
10
+ import { jsx as f } from "react/jsx-runtime";
11
+ import { autoUpdate as He } from "../../../@floating-ui/dom/dist/floating-ui.dom.js";
12
+ var _ = "Popper", [q, Ge] = Ne(_), [We, G] = q(_), J = (e) => {
13
+ const { __scopePopper: i, children: n } = e, [t, a] = s.useState(null);
14
+ return /* @__PURE__ */ f(We, { scope: i, anchor: t, onAnchorChange: a, children: n });
15
+ };
16
+ J.displayName = _;
17
+ var K = "PopperAnchor", Q = s.forwardRef(
18
+ (e, i) => {
19
+ const { __scopePopper: n, virtualRef: t, ...a } = e, r = G(K, n), o = s.useRef(null), x = Z(i, o);
20
+ return s.useEffect(() => {
21
+ r.onAnchorChange((t == null ? void 0 : t.current) || o.current);
22
+ }), t ? null : /* @__PURE__ */ f(U.div, { ...a, ref: x });
23
+ }
24
+ );
25
+ Q.displayName = K;
26
+ var $ = "PopperContent", [Ie, Ye] = q($), V = s.forwardRef(
27
+ (e, i) => {
28
+ var M, X, D, F, k, B, T, j;
29
+ const {
30
+ __scopePopper: n,
31
+ side: t = "bottom",
32
+ sideOffset: a = 0,
33
+ align: r = "center",
34
+ alignOffset: o = 0,
35
+ arrowPadding: x = 0,
36
+ avoidCollisions: p = !0,
37
+ collisionBoundary: c = [],
38
+ collisionPadding: P = 0,
39
+ sticky: m = "partial",
40
+ hideWhenDetached: A = !1,
41
+ updatePositionStrategy: v = "optimized",
42
+ onPlaced: l,
43
+ ...d
44
+ } = e, C = G($, n), [h, b] = s.useState(null), S = Z(i, (y) => b(y)), [g, oe] = s.useState(null), u = $e(g), ne = (M = u == null ? void 0 : u.width) != null ? M : 0, H = (X = u == null ? void 0 : u.height) != null ? X : 0, ae = t + (r !== "center" ? "-" + r : ""), ie = typeof P == "number" ? P : { top: 0, right: 0, bottom: 0, left: 0, ...P }, W = Array.isArray(c) ? c : [c], se = W.length > 0, O = {
45
+ padding: ie,
46
+ boundary: W.filter(Xe),
47
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
48
+ altBoundary: se
49
+ }, { refs: pe, floatingStyles: I, placement: ce, isPositioned: R, middlewareData: w } = ye({
50
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
51
+ strategy: "fixed",
52
+ placement: ae,
53
+ whileElementsMounted: (...y) => He(...y, {
54
+ animationFrame: v === "always"
55
+ }),
56
+ elements: {
57
+ reference: C.anchor
58
+ },
59
+ middleware: [
60
+ Ae({ mainAxis: a + H, alignmentAxis: o }),
61
+ p && ve({
62
+ mainAxis: !0,
63
+ crossAxis: !1,
64
+ limiter: m === "partial" ? Re() : void 0,
65
+ ...O
66
+ }),
67
+ p && Ce({ ...O }),
68
+ be({
69
+ ...O,
70
+ apply: ({ elements: y, rects: z, availableWidth: ue, availableHeight: we }) => {
71
+ const { width: xe, height: Pe } = z.reference, N = y.floating.style;
72
+ N.setProperty("--radix-popper-available-width", `${ue}px`), N.setProperty("--radix-popper-available-height", `${we}px`), N.setProperty("--radix-popper-anchor-width", `${xe}px`), N.setProperty("--radix-popper-anchor-height", `${Pe}px`);
73
+ }
74
+ }),
75
+ g && Se({ element: g, padding: x }),
76
+ De({ arrowWidth: ne, arrowHeight: H }),
77
+ A && Oe({ strategy: "referenceHidden", ...O })
78
+ ]
79
+ }), [Y, de] = re(ce), E = _e(l);
80
+ L(() => {
81
+ R && (E == null || E());
82
+ }, [R, E]);
83
+ const le = (D = w.arrow) == null ? void 0 : D.x, fe = (F = w.arrow) == null ? void 0 : F.y, me = ((k = w.arrow) == null ? void 0 : k.centerOffset) !== 0, [he, ge] = s.useState();
84
+ return L(() => {
85
+ h && ge(window.getComputedStyle(h).zIndex);
86
+ }, [h]), /* @__PURE__ */ f(
87
+ "div",
88
+ {
89
+ ref: pe.setFloating,
90
+ "data-radix-popper-content-wrapper": "",
91
+ style: {
92
+ ...I,
93
+ transform: R ? I.transform : "translate(0, -200%)",
94
+ // keep off the page when measuring
95
+ minWidth: "max-content",
96
+ zIndex: he,
97
+ "--radix-popper-transform-origin": [
98
+ (B = w.transformOrigin) == null ? void 0 : B.x,
99
+ (T = w.transformOrigin) == null ? void 0 : T.y
100
+ ].join(" "),
101
+ // hide the content if using the hide middleware and should be hidden
102
+ // set visibility to hidden and disable pointer events so the UI behaves
103
+ // as if the PopperContent isn't there at all
104
+ ...((j = w.hide) == null ? void 0 : j.referenceHidden) && {
105
+ visibility: "hidden",
106
+ pointerEvents: "none"
107
+ }
108
+ },
109
+ dir: e.dir,
110
+ children: /* @__PURE__ */ f(
111
+ Ie,
112
+ {
113
+ scope: n,
114
+ placedSide: Y,
115
+ onArrowChange: oe,
116
+ arrowX: le,
117
+ arrowY: fe,
118
+ shouldHideArrow: me,
119
+ children: /* @__PURE__ */ f(
120
+ U.div,
121
+ {
122
+ "data-side": Y,
123
+ "data-align": de,
124
+ ...d,
125
+ ref: S,
126
+ style: {
127
+ ...d.style,
128
+ // if the PopperContent hasn't been placed yet (not all measurements done)
129
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
130
+ animation: R ? void 0 : "none"
131
+ }
132
+ }
133
+ )
134
+ }
135
+ )
136
+ }
137
+ );
138
+ }
139
+ );
140
+ V.displayName = $;
141
+ var ee = "PopperArrow", Me = {
142
+ top: "bottom",
143
+ right: "left",
144
+ bottom: "top",
145
+ left: "right"
146
+ }, te = s.forwardRef(function(i, n) {
147
+ const { __scopePopper: t, ...a } = i, r = Ye(ee, t), o = Me[r.placedSide];
148
+ return (
149
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
150
+ // doesn't report size as we'd expect on SVG elements.
151
+ // it reports their bounding box which is effectively the largest path inside the SVG.
152
+ /* @__PURE__ */ f(
153
+ "span",
154
+ {
155
+ ref: r.onArrowChange,
156
+ style: {
157
+ position: "absolute",
158
+ left: r.arrowX,
159
+ top: r.arrowY,
160
+ [o]: 0,
161
+ transformOrigin: {
162
+ top: "",
163
+ right: "0 0",
164
+ bottom: "center 0",
165
+ left: "100% 0"
166
+ }[r.placedSide],
167
+ transform: {
168
+ top: "translateY(100%)",
169
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
170
+ bottom: "rotate(180deg)",
171
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
172
+ }[r.placedSide],
173
+ visibility: r.shouldHideArrow ? "hidden" : void 0
174
+ },
175
+ children: /* @__PURE__ */ f(
176
+ Ee,
177
+ {
178
+ ...a,
179
+ ref: n,
180
+ style: {
181
+ ...a.style,
182
+ // ensures the element can be measured correctly (mostly for if SVG)
183
+ display: "block"
184
+ }
185
+ }
186
+ )
187
+ }
188
+ )
189
+ );
190
+ });
191
+ te.displayName = ee;
192
+ function Xe(e) {
193
+ return e !== null;
194
+ }
195
+ var De = (e) => ({
196
+ name: "transformOrigin",
197
+ options: e,
198
+ fn(i) {
199
+ var C, h, b, S, g;
200
+ const { placement: n, rects: t, middlewareData: a } = i, o = ((C = a.arrow) == null ? void 0 : C.centerOffset) !== 0, x = o ? 0 : e.arrowWidth, p = o ? 0 : e.arrowHeight, [c, P] = re(n), m = { start: "0%", center: "50%", end: "100%" }[P], A = ((b = (h = a.arrow) == null ? void 0 : h.x) != null ? b : 0) + x / 2, v = ((g = (S = a.arrow) == null ? void 0 : S.y) != null ? g : 0) + p / 2;
201
+ let l = "", d = "";
202
+ return c === "bottom" ? (l = o ? m : `${A}px`, d = `${-p}px`) : c === "top" ? (l = o ? m : `${A}px`, d = `${t.floating.height + p}px`) : c === "right" ? (l = `${-p}px`, d = o ? m : `${v}px`) : c === "left" && (l = `${t.floating.width + p}px`, d = o ? m : `${v}px`), { data: { x: l, y: d } };
203
+ }
204
+ });
205
+ function re(e) {
206
+ const [i, n = "center"] = e.split("-");
207
+ return [i, n];
208
+ }
209
+ var Je = J, Ke = Q, Qe = V, Ve = te;
210
+ export {
211
+ Ke as Anchor,
212
+ Ve as Arrow,
213
+ Qe as Content,
214
+ J as Popper,
215
+ Q as PopperAnchor,
216
+ te as PopperArrow,
217
+ V as PopperContent,
218
+ Je as Root,
219
+ Ge as createPopperScope
220
+ };