nuvox 0.1.2 → 0.1.4
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/CHANGELOG.md +117 -0
- package/dist/{chunk-3F7OVF4J.js → chunk-KKRVJF3Y.js} +37 -4
- package/dist/chunk-KKRVJF3Y.js.map +1 -0
- package/dist/index.cjs +36 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.cjs +75 -6
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.css +12 -2
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.js +40 -4
- package/dist/react/index.js.map +1 -1
- package/dist/themes/generated.css +4 -4
- package/package.json +1 -1
- package/dist/chunk-3F7OVF4J.js.map +0 -1
package/dist/react/index.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
resolveTableState,
|
|
35
35
|
rgbToHex,
|
|
36
36
|
rgbToHsl
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-KKRVJF3Y.js";
|
|
38
38
|
|
|
39
39
|
// src/theme-engine/resolveColor.ts
|
|
40
40
|
function rawColorToBrandVars(color) {
|
|
@@ -80,6 +80,12 @@ function withAccentOverride(color, children) {
|
|
|
80
80
|
import { useLayoutEffect, useRef } from "react";
|
|
81
81
|
import { createPortal } from "react-dom";
|
|
82
82
|
var TRACKED_ATTRIBUTES = ["data-theme", "data-accent"];
|
|
83
|
+
var portalAnchors = /* @__PURE__ */ new WeakMap();
|
|
84
|
+
function getPortalAnchor(portalNode) {
|
|
85
|
+
return portalAnchors.get(portalNode) ?? null;
|
|
86
|
+
}
|
|
87
|
+
var nextNestedStackOffset = 0;
|
|
88
|
+
var NESTED_OVERRIDE_BASE_Z_INDEX = 1150;
|
|
83
89
|
function ThemedPortal({ anchorRef, children, container }) {
|
|
84
90
|
const portalElRef = useRef(null);
|
|
85
91
|
if (!portalElRef.current && typeof document !== "undefined") {
|
|
@@ -91,6 +97,14 @@ function ThemedPortal({ anchorRef, children, container }) {
|
|
|
91
97
|
const portalEl = portalElRef.current;
|
|
92
98
|
if (!portalEl) return;
|
|
93
99
|
target.appendChild(portalEl);
|
|
100
|
+
if (anchorRef.current) {
|
|
101
|
+
portalAnchors.set(portalEl, anchorRef.current);
|
|
102
|
+
const enclosingPortal = anchorRef.current.closest("[data-nuvox-portal]");
|
|
103
|
+
if (enclosingPortal) {
|
|
104
|
+
portalEl.style.position = "relative";
|
|
105
|
+
portalEl.style.zIndex = String(NESTED_OVERRIDE_BASE_Z_INDEX + nextNestedStackOffset++);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
94
108
|
function syncAttribute(attr) {
|
|
95
109
|
const anchor2 = anchorRef.current;
|
|
96
110
|
if (!anchor2 || !portalEl) return;
|
|
@@ -15173,13 +15187,28 @@ function getOpenIntent(key) {
|
|
|
15173
15187
|
|
|
15174
15188
|
// src/theme-engine/useClickOutside.ts
|
|
15175
15189
|
import { useEffect as useEffect5 } from "react";
|
|
15190
|
+
function isNestedWithinRefs(target, refs) {
|
|
15191
|
+
if (!(target instanceof Element)) return false;
|
|
15192
|
+
let current = target;
|
|
15193
|
+
for (let depth = 0; depth < 20; depth++) {
|
|
15194
|
+
const portalNode = current.closest("[data-nuvox-portal]");
|
|
15195
|
+
if (!portalNode) return false;
|
|
15196
|
+
const anchor = getPortalAnchor(portalNode);
|
|
15197
|
+
if (!anchor) return false;
|
|
15198
|
+
if (refs.some((ref) => ref.current?.contains(anchor))) return true;
|
|
15199
|
+
current = anchor;
|
|
15200
|
+
}
|
|
15201
|
+
return false;
|
|
15202
|
+
}
|
|
15176
15203
|
function useClickOutside(isOpen, refs, onOutsideClick) {
|
|
15177
15204
|
useEffect5(() => {
|
|
15178
15205
|
if (!isOpen) return;
|
|
15179
15206
|
function onPointerDown(e) {
|
|
15180
15207
|
const target = e.target;
|
|
15181
15208
|
const isInside = refs.some((ref) => ref.current?.contains(target));
|
|
15182
|
-
if (
|
|
15209
|
+
if (isInside) return;
|
|
15210
|
+
if (isNestedWithinRefs(target, refs)) return;
|
|
15211
|
+
onOutsideClick();
|
|
15183
15212
|
}
|
|
15184
15213
|
document.addEventListener("pointerdown", onPointerDown, true);
|
|
15185
15214
|
return () => document.removeEventListener("pointerdown", onPointerDown, true);
|
|
@@ -15940,12 +15969,19 @@ function getKeyboardValue(key, current, state) {
|
|
|
15940
15969
|
if (key === "End") return state.max;
|
|
15941
15970
|
return null;
|
|
15942
15971
|
}
|
|
15943
|
-
function getRootClasses3(state, isRange, className) {
|
|
15972
|
+
function getRootClasses3(state, isRange, showValueLabel, className) {
|
|
15944
15973
|
return [
|
|
15945
15974
|
"nx-slider",
|
|
15946
15975
|
`nx-slider--${state.size}`,
|
|
15947
15976
|
isRange && "nx-slider--range",
|
|
15948
15977
|
state.isDisabled && "nx-slider--disabled",
|
|
15978
|
+
// The value-label bubble floats above the thumb (see
|
|
15979
|
+
// Slider.css) — with no room reserved for it, it overflows
|
|
15980
|
+
// .nx-slider's own box and lands on whatever's above it in
|
|
15981
|
+
// .nx-field, which for a slider with a `label` is the label
|
|
15982
|
+
// text itself. This adds the top margin the bubble actually
|
|
15983
|
+
// needs instead of relying on .nx-field's generic 4px gap.
|
|
15984
|
+
showValueLabel && "nx-slider--with-value-label",
|
|
15949
15985
|
className
|
|
15950
15986
|
].filter(Boolean).join(" ");
|
|
15951
15987
|
}
|
|
@@ -16076,7 +16112,7 @@ var SliderImpl = forwardRef20(function Slider({
|
|
|
16076
16112
|
}
|
|
16077
16113
|
const slider = /* @__PURE__ */ jsxs451("div", { className: "nx-field", style, children: [
|
|
16078
16114
|
label && /* @__PURE__ */ jsx525("span", { id: labelId, className: "nx-field__label", children: label }),
|
|
16079
|
-
/* @__PURE__ */ jsx525("div", { ref: forwardedRef, id: rootId, className: getRootClasses3(state, isRange, className), children: /* @__PURE__ */ jsxs451(
|
|
16115
|
+
/* @__PURE__ */ jsx525("div", { ref: forwardedRef, id: rootId, className: getRootClasses3(state, isRange, showValueLabel, className), children: /* @__PURE__ */ jsxs451(
|
|
16080
16116
|
"div",
|
|
16081
16117
|
{
|
|
16082
16118
|
ref: trackRef,
|