@companix/uikit 0.1.37 → 0.1.39
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/Popup/index.d.ts +2 -0
- package/dist/bundle.es23.js +22 -22
- package/dist/bundle.es25.js +13 -13
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/Popup/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export interface PopupLayotProps {
|
|
|
6
6
|
defaultOpen?: boolean;
|
|
7
7
|
disableEsc?: boolean;
|
|
8
8
|
onClosed?: () => void;
|
|
9
|
+
modal?: boolean;
|
|
10
|
+
container?: HTMLElement | null;
|
|
9
11
|
overlay?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
|
|
10
12
|
overlayRef?: React.Ref<HTMLDivElement>;
|
|
11
13
|
content?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
|
package/dist/bundle.es23.js
CHANGED
|
@@ -10,17 +10,17 @@ import { set as R, reset as ae, composeRefs as Q, isInput as ce, isMobileFirefox
|
|
|
10
10
|
import { usePreventScroll as de } from "./bundle.es72.js";
|
|
11
11
|
import { DRAG_CLASS as j, VELOCITY_THRESHOLD as ge, CLOSE_THRESHOLD as me, SCROLL_LOCK_TIMEOUT as pe, TRANSITIONS as Y, WINDOW_TOP_OFFSET as he } from "./bundle.es73.js";
|
|
12
12
|
const we = (m) => {
|
|
13
|
-
const { open: p, onOpenChange: l, onClosed: D, children: y, defaultOpen: S = !1, disableEsc: f } = m, [
|
|
13
|
+
const { open: p, onOpenChange: l, onClosed: D, children: y, defaultOpen: S = !1, disableEsc: f } = m, [M, P] = t.useState(!1), [T, v] = t.useState(!1), [_, A] = t.useState(!1), x = t.useRef(null), H = t.useRef(null), I = t.useRef(null), L = t.useRef(null), o = t.useRef(null), d = t.useRef(!1), h = t.useRef(0), b = t.useRef(!1), N = t.useRef(!S), e = t.useRef(null), O = t.useRef(e.current?.getBoundingClientRect().height || 0), g = t.useRef(0), C = t.useRef(0), w = p ?? !1, V = t.useCallback(
|
|
14
14
|
(r) => {
|
|
15
15
|
l(r);
|
|
16
16
|
},
|
|
17
17
|
[l]
|
|
18
18
|
);
|
|
19
19
|
de({
|
|
20
|
-
isDisabled: !w || T || _ || !
|
|
20
|
+
isDisabled: !w || T || _ || !M
|
|
21
21
|
});
|
|
22
22
|
const ee = (r) => {
|
|
23
|
-
e.current && !e.current.contains(r.target) || (O.current = e.current?.getBoundingClientRect().height || 0,
|
|
23
|
+
e.current && !e.current.contains(r.target) || (O.current = e.current?.getBoundingClientRect().height || 0, v(!0), I.current = /* @__PURE__ */ new Date(), le() && window.addEventListener("touchend", () => d.current = !1, { once: !0 }), r.target.setPointerCapture(r.pointerId), h.current = r.pageY);
|
|
24
24
|
}, z = (r, c) => {
|
|
25
25
|
let n = r;
|
|
26
26
|
const u = window.getSelection()?.toString(), i = e.current ? W(e.current) : null, a = /* @__PURE__ */ new Date();
|
|
@@ -48,7 +48,7 @@ const we = (m) => {
|
|
|
48
48
|
if (!d.current && !z(r.target, n)) return;
|
|
49
49
|
if (e.current.classList.add(j), d.current = !0, R(e.current, {
|
|
50
50
|
transition: "none"
|
|
51
|
-
}), R(
|
|
51
|
+
}), R(x.current, {
|
|
52
52
|
transition: "none"
|
|
53
53
|
}), n) {
|
|
54
54
|
const F = fe(c), U = Math.min(F * -1, 0) * 1;
|
|
@@ -59,7 +59,7 @@ const we = (m) => {
|
|
|
59
59
|
}
|
|
60
60
|
const k = 1 - a;
|
|
61
61
|
R(
|
|
62
|
-
|
|
62
|
+
x.current,
|
|
63
63
|
{
|
|
64
64
|
opacity: `${k}`,
|
|
65
65
|
transition: "none"
|
|
@@ -103,15 +103,15 @@ const we = (m) => {
|
|
|
103
103
|
e.current && (R(e.current, {
|
|
104
104
|
transform: "translate3d(0, 0, 0)",
|
|
105
105
|
transition: `transform ${Y.DURATION}s cubic-bezier(${Y.EASE.join(",")})`
|
|
106
|
-
}), R(
|
|
106
|
+
}), R(x.current, {
|
|
107
107
|
transition: `opacity ${Y.DURATION}s cubic-bezier(${Y.EASE.join(",")})`,
|
|
108
108
|
opacity: "1"
|
|
109
109
|
}));
|
|
110
110
|
}, re = () => {
|
|
111
|
-
!T || !e.current || (e.current.classList.remove(j), d.current = !1,
|
|
111
|
+
!T || !e.current || (e.current.classList.remove(j), d.current = !1, v(!1), L.current = /* @__PURE__ */ new Date());
|
|
112
112
|
}, ne = (r) => {
|
|
113
113
|
if (!T || !e.current) return;
|
|
114
|
-
e.current.classList.remove(j), d.current = !1,
|
|
114
|
+
e.current.classList.remove(j), d.current = !1, v(!1), L.current = /* @__PURE__ */ new Date();
|
|
115
115
|
const c = W(e.current);
|
|
116
116
|
if (!r || !z(r.target, !1) || !c || Number.isNaN(c) || I.current === null) return;
|
|
117
117
|
const n = L.current.getTime() - I.current.getTime(), u = h.current - r.pageY, i = Math.abs(u) / n;
|
|
@@ -135,7 +135,7 @@ const we = (m) => {
|
|
|
135
135
|
}
|
|
136
136
|
X();
|
|
137
137
|
};
|
|
138
|
-
return t.useEffect(() => (w && (R(document.documentElement, {
|
|
138
|
+
return t.useEffect(() => (w && (P(!0), R(document.documentElement, {
|
|
139
139
|
scrollBehavior: "auto"
|
|
140
140
|
}), H.current = /* @__PURE__ */ new Date()), () => {
|
|
141
141
|
ae(document.documentElement, "scrollBehavior");
|
|
@@ -144,7 +144,7 @@ const we = (m) => {
|
|
|
144
144
|
{
|
|
145
145
|
defaultOpen: S,
|
|
146
146
|
onOpenChange: (r) => {
|
|
147
|
-
r ?
|
|
147
|
+
r ? P(!0) : B(!0), V(r);
|
|
148
148
|
},
|
|
149
149
|
open: w,
|
|
150
150
|
modal: !0,
|
|
@@ -153,7 +153,7 @@ const we = (m) => {
|
|
|
153
153
|
{
|
|
154
154
|
value: {
|
|
155
155
|
drawerRef: e,
|
|
156
|
-
overlayRef:
|
|
156
|
+
overlayRef: x,
|
|
157
157
|
onPress: ee,
|
|
158
158
|
onRelease: ne,
|
|
159
159
|
onDrag: te,
|
|
@@ -172,14 +172,14 @@ const we = (m) => {
|
|
|
172
172
|
);
|
|
173
173
|
}, Re = t.forwardRef(
|
|
174
174
|
({ className: m, ...p }, l) => {
|
|
175
|
-
const { overlayRef: D, onRelease: y, shouldAnimate: S } = J(), f = Q(l, D),
|
|
176
|
-
(
|
|
175
|
+
const { overlayRef: D, onRelease: y, shouldAnimate: S } = J(), f = Q(l, D), M = t.useCallback(
|
|
176
|
+
(P) => y(P),
|
|
177
177
|
[y]
|
|
178
178
|
);
|
|
179
179
|
return /* @__PURE__ */ s(
|
|
180
180
|
E.Overlay,
|
|
181
181
|
{
|
|
182
|
-
onMouseUp:
|
|
182
|
+
onMouseUp: M,
|
|
183
183
|
ref: f,
|
|
184
184
|
"data-animate": S?.current ? "true" : "false",
|
|
185
185
|
className: G("popup-overlay drawer-overlay", m),
|
|
@@ -188,28 +188,28 @@ const we = (m) => {
|
|
|
188
188
|
);
|
|
189
189
|
}
|
|
190
190
|
), De = t.forwardRef(
|
|
191
|
-
({ onPointerDownOutside: m, style: p, onOpenAutoFocus: l, className: D, size: y, children: S, ...f },
|
|
191
|
+
({ onPointerDownOutside: m, style: p, onOpenAutoFocus: l, className: D, size: y, children: S, ...f }, M) => {
|
|
192
192
|
const {
|
|
193
|
-
drawerRef:
|
|
193
|
+
drawerRef: P,
|
|
194
194
|
onPress: T,
|
|
195
|
-
onRelease:
|
|
195
|
+
onRelease: v,
|
|
196
196
|
onDrag: _,
|
|
197
197
|
keyboardIsOpen: A,
|
|
198
|
-
shouldAnimate:
|
|
198
|
+
shouldAnimate: x,
|
|
199
199
|
onClosed: H,
|
|
200
200
|
disableEsc: I
|
|
201
|
-
} = J(), L = Q(
|
|
201
|
+
} = J(), L = Q(M, P), o = t.useRef(null), d = t.useRef(null), h = t.useRef(!1), b = (e, O = 0) => {
|
|
202
202
|
if (h.current) return !0;
|
|
203
203
|
const g = Math.abs(e.y), w = Math.abs(e.x) > g;
|
|
204
204
|
return !(e.y * 1 < 0) && g >= 0 && g <= O ? !w : (h.current = !0, !0);
|
|
205
205
|
}, N = (e) => {
|
|
206
|
-
o.current = null, h.current = !1,
|
|
206
|
+
o.current = null, h.current = !1, v(e);
|
|
207
207
|
};
|
|
208
208
|
return /* @__PURE__ */ q(
|
|
209
209
|
E.Content,
|
|
210
210
|
{
|
|
211
211
|
"data-direction": "bottom",
|
|
212
|
-
"data-animate":
|
|
212
|
+
"data-animate": x?.current ? "true" : "false",
|
|
213
213
|
className: G("popup drawer drawer-mobile", D),
|
|
214
214
|
style: { ...oe({ "--drawer-size": y ?? "50%" }), ...p },
|
|
215
215
|
...f,
|
|
@@ -232,7 +232,7 @@ const we = (m) => {
|
|
|
232
232
|
b({ x: g, y: O }, C) ? _(e) : (Math.abs(g) > C || Math.abs(O) > C) && (o.current = null);
|
|
233
233
|
},
|
|
234
234
|
onPointerUp: (e) => {
|
|
235
|
-
f.onPointerUp?.(e), o.current = null, h.current = !1,
|
|
235
|
+
f.onPointerUp?.(e), o.current = null, h.current = !1, v(e);
|
|
236
236
|
},
|
|
237
237
|
onPointerOut: (e) => {
|
|
238
238
|
f.onPointerOut?.(e), N(d.current);
|
package/dist/bundle.es25.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import C from "classnames";
|
|
3
3
|
import * as o from "@radix-ui/react-dialog";
|
|
4
4
|
import { VisuallyHidden as l } from "@radix-ui/react-visually-hidden";
|
|
5
|
-
import { RemoveListener as
|
|
6
|
-
const
|
|
7
|
-
const { open: i, onOpenChange: a, children:
|
|
8
|
-
p &&
|
|
5
|
+
import { RemoveListener as D } from "./bundle.es60.js";
|
|
6
|
+
const R = (t) => {
|
|
7
|
+
const { open: i, onOpenChange: a, children: c, onClosed: s, disableEsc: p, modal: m, container: d, overlay: n = {}, overlayRef: f, content: h = {}, contentRef: v } = t, y = (u) => {
|
|
8
|
+
p && u.preventDefault();
|
|
9
9
|
};
|
|
10
|
-
return /* @__PURE__ */ e(o.Root, { open: i, onOpenChange: a, children: /* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */ e(o.Overlay, { ...
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */ e(
|
|
10
|
+
return /* @__PURE__ */ e(o.Root, { open: i, onOpenChange: a, modal: m, children: /* @__PURE__ */ r(o.Portal, { container: d, children: [
|
|
11
|
+
/* @__PURE__ */ e(o.Overlay, { ...n, ref: f, className: C("popup-overlay", n.className) }),
|
|
12
|
+
/* @__PURE__ */ r(o.Content, { ...h, ref: v, onEscapeKeyDown: y, children: [
|
|
13
|
+
/* @__PURE__ */ e(D, { callback: s }),
|
|
14
14
|
/* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(o.Title, {}) }),
|
|
15
15
|
/* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(o.Description, {}) }),
|
|
16
|
-
|
|
16
|
+
c
|
|
17
17
|
] })
|
|
18
18
|
] }) });
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
R.Close = o.Close;
|
|
21
21
|
export {
|
|
22
|
-
|
|
22
|
+
R as PopupLayout
|
|
23
23
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ export { createToaster } from './Toaster';
|
|
|
97
97
|
export { Toast } from './Toaster/Toast';
|
|
98
98
|
export * from './types';
|
|
99
99
|
export type { CalendarProps } from './Calendar/Calendar';
|
|
100
|
-
export type { OptionsSource, UseOptionsResponse } from './Select/OptionsPopover';
|
|
100
|
+
export type { OptionsSource, OptionsPopover, UseOptionsResponse } from './Select/OptionsPopover';
|
|
101
101
|
export { createPopupRegistry, DialogShell, DrawerShell, MobileDrawerShell, usePopup } from './__helpers/createPopupRegistry';
|
|
102
102
|
export { createPopoversRegistry } from './__helpers/createPopoversRegistry';
|
|
103
103
|
export { createScope, createStaticScope } from './__helpers/createScope';
|