alinea
Version:
Headless git-based CMS
121 lines (115 loc) • 4.74 kB
JavaScript
import {
K,
L,
n,
o2 as o,
r,
y
} from "./chunk-VUACWPFC.js";
// node_modules/@headlessui/react/dist/internal/disabled.js
import n2, { createContext as r2, useContext as i } from "react";
var e = r2(void 0);
function a() {
return i(e);
}
// node_modules/@headlessui/react/dist/internal/id.js
import n3, { createContext as d, useContext as i2 } from "react";
var e2 = d(void 0);
function u() {
return i2(e2);
}
// node_modules/@headlessui/react/dist/components/description/description.js
import m, { createContext as T, useContext as u2, useMemo as c, useState as P } from "react";
var a2 = T(null);
a2.displayName = "DescriptionContext";
function f() {
let r3 = u2(a2);
if (r3 === null) {
let e3 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
throw Error.captureStackTrace && Error.captureStackTrace(e3, f), e3;
}
return r3;
}
function U() {
var r3, e3;
return (e3 = (r3 = u2(a2)) == null ? void 0 : r3.value) != null ? e3 : void 0;
}
function w() {
let [r3, e3] = P([]);
return [r3.length > 0 ? r3.join(" ") : void 0, c(() => function(t) {
let i3 = o((n4) => (e3((s) => [...s, n4]), () => e3((s) => {
let o2 = s.slice(), p = o2.indexOf(n4);
return p !== -1 && o2.splice(p, 1), o2;
}))), l = c(() => ({ register: i3, slot: t.slot, name: t.name, props: t.props, value: t.value }), [i3, t.slot, t.name, t.props, t.value]);
return m.createElement(a2.Provider, { value: l }, t.children);
}, [e3])];
}
var S = "p";
function C(r3, e3) {
let d2 = r(), t = a(), { id: i3 = `headlessui-description-${d2}`, ...l } = r3, n4 = f(), s = y(e3);
n(() => n4.register(i3), [i3, n4.register]);
let o2 = t || false, p = c(() => ({ ...n4.slot, disabled: o2 }), [n4.slot, o2]), D2 = { ref: s, ...n4.props, id: i3 };
return L()({ ourProps: D2, theirProps: l, slot: p, defaultTag: S, name: n4.name || "Description" });
}
var _ = K(C);
var H = Object.assign(_, {});
// node_modules/@headlessui/react/dist/components/label/label.js
import R, { createContext as k, useContext as h, useMemo as T2, useState as D } from "react";
var c2 = k(null);
c2.displayName = "LabelContext";
function P2() {
let r3 = h(c2);
if (r3 === null) {
let l = new Error("You used a <Label /> component, but it is not inside a relevant parent.");
throw Error.captureStackTrace && Error.captureStackTrace(l, P2), l;
}
return r3;
}
function I(r3) {
var a3, e3, o2;
let l = (e3 = (a3 = h(c2)) == null ? void 0 : a3.value) != null ? e3 : void 0;
return ((o2 = r3 == null ? void 0 : r3.length) != null ? o2 : 0) > 0 ? [l, ...r3].filter(Boolean).join(" ") : l;
}
function K2({ inherit: r3 = false } = {}) {
let l = I(), [a3, e3] = D([]), o2 = r3 ? [l, ...a3].filter(Boolean) : a3;
return [o2.length > 0 ? o2.join(" ") : void 0, T2(() => function(t) {
let s = o((i3) => (e3((p) => [...p, i3]), () => e3((p) => {
let u3 = p.slice(), d2 = u3.indexOf(i3);
return d2 !== -1 && u3.splice(d2, 1), u3;
}))), m2 = T2(() => ({ register: s, slot: t.slot, name: t.name, props: t.props, value: t.value }), [s, t.slot, t.name, t.props, t.value]);
return R.createElement(c2.Provider, { value: m2 }, t.children);
}, [e3])];
}
var N = "label";
function G(r3, l) {
var y2;
let a3 = r(), e3 = P2(), o2 = u(), g = a(), { id: t = `headlessui-label-${a3}`, htmlFor: s = o2 != null ? o2 : (y2 = e3.props) == null ? void 0 : y2.htmlFor, passive: m2 = false, ...i3 } = r3, p = y(l);
n(() => e3.register(t), [t, e3.register]);
let u3 = o((L2) => {
let b = L2.currentTarget;
if (b instanceof HTMLLabelElement && L2.preventDefault(), e3.props && "onClick" in e3.props && typeof e3.props.onClick == "function" && e3.props.onClick(L2), b instanceof HTMLLabelElement) {
let n4 = document.getElementById(b.htmlFor);
if (n4) {
let E = n4.getAttribute("disabled");
if (E === "true" || E === "") return;
let x = n4.getAttribute("aria-disabled");
if (x === "true" || x === "") return;
(n4 instanceof HTMLInputElement && (n4.type === "radio" || n4.type === "checkbox") || n4.role === "radio" || n4.role === "checkbox" || n4.role === "switch") && n4.click(), n4.focus({ preventScroll: true });
}
}
}), d2 = g || false, C2 = T2(() => ({ ...e3.slot, disabled: d2 }), [e3.slot, d2]), f2 = { ref: p, ...e3.props, id: t, htmlFor: s, onClick: u3 };
return m2 && ("onClick" in f2 && (delete f2.htmlFor, delete f2.onClick), "onClick" in i3 && delete i3.onClick), L()({ ourProps: f2, theirProps: i3, slot: C2, defaultTag: s ? N : "div", name: e3.name || "Label" });
}
var U2 = K(G);
var Q = Object.assign(U2, {});
export {
a,
u,
U,
w,
H,
P2 as P,
I,
K2 as K,
Q
};