UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

150 lines (149 loc) 4.4 kB
(function() { try { var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}; e.SENTRY_RELEASE = { id: "3.7.8" }; var t = new e.Error().stack; t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "be1ef833-d77c-4671-a557-82daa25cde9e", e._sentryDebugIdIdentifier = "sentry-dbid-be1ef833-d77c-4671-a557-82daa25cde9e"); } catch {} })(); import { r as e } from "./rolldown-runtime-YBAZwyzS.js"; import { t } from "./react-Di3Pmpio.js"; import { t as n } from "./jsx-runtime-C8yjdFgZ.js"; import { O as r, g as i, l as a, s as o, u as s, y as c } from "./flex-CegveOzn.js"; import { i as l, n as u, o as d, s as f, t as p } from "./dist-CVz2SjQb.js"; import { t as m } from "./dist-BeI1dlr0.js"; import { t as h } from "./classnames-BRCgwycl.js"; import { t as g } from "./settings-item-Ie1tNhGr.js"; //#region ../../node_modules/.pnpm/@radix-ui+react-switch@1.2.6_@types+react-dom@19.2.3_@types+react@19.2.17__@types+react_c7e30651c33d0db1728ad3c2eef3094f/node_modules/@radix-ui/react-switch/dist/index.mjs var _ = /* @__PURE__ */ e(t(), 1), v = n(), y = "Switch", [b, x] = d(y), [S, C] = b(y), w = _.forwardRef((e, t) => { let { __scopeSwitch: n, name: i, checked: a, defaultChecked: o, required: s, disabled: c, value: d = "on", onCheckedChange: p, form: m, ...h } = e, [g, b] = _.useState(null), x = r(t, (e) => b(e)), C = _.useRef(!1), w = g ? m || !!g.closest("form") : !0, [T, E] = u({ prop: a, defaultProp: o == null ? !1 : o, onChange: p, caller: y }); return /* @__PURE__ */ (0, v.jsxs)(S, { scope: n, checked: T, disabled: c, children: [/* @__PURE__ */ (0, v.jsx)(f.button, { type: "button", role: "switch", "aria-checked": T, "aria-required": s, "data-state": k(T), "data-disabled": c ? "" : void 0, disabled: c, value: d, ...h, ref: x, onClick: l(e.onClick, (e) => { E((e) => !e), w && (C.current = e.isPropagationStopped(), C.current || e.stopPropagation()); }) }), w && /* @__PURE__ */ (0, v.jsx)(O, { control: g, bubbles: !C.current, name: i, value: d, checked: T, required: s, disabled: c, form: m, style: { transform: "translateX(-100%)" } })] }); }); w.displayName = y; var T = "SwitchThumb", E = _.forwardRef((e, t) => { let { __scopeSwitch: n, ...r } = e, i = C(T, n); return /* @__PURE__ */ (0, v.jsx)(f.span, { "data-state": k(i.checked), "data-disabled": i.disabled ? "" : void 0, ...r, ref: t }); }); E.displayName = T; var D = "SwitchBubbleInput", O = _.forwardRef(({ __scopeSwitch: e, control: t, checked: n, bubbles: i = !0, ...a }, o) => { let s = _.useRef(null), c = r(s, o), l = m(n), u = p(t); return _.useEffect(() => { let e = s.current; if (!e) return; let t = window.HTMLInputElement.prototype, r = Object.getOwnPropertyDescriptor(t, "checked").set; if (l !== n && r) { let t = new Event("click", { bubbles: i }); r.call(e, n), e.dispatchEvent(t); } }, [ l, n, i ]), /* @__PURE__ */ (0, v.jsx)("input", { type: "checkbox", "aria-hidden": !0, defaultChecked: n, ...a, tabIndex: -1, ref: c, style: { ...a.style, ...u, position: "absolute", pointerEvents: "none", opacity: 0, margin: 0 } }); }); O.displayName = D; function k(e) { return e ? "checked" : "unchecked"; } var A = w, j = E, M = { size: { type: "enum", className: "rt-r-size", values: [ "1", "2", "3" ], default: "2", responsive: !0 }, variant: { type: "enum", className: "rt-variant", values: [ "classic", "surface", "soft" ], default: "surface" }, ...c, ...i, ...o }, N = /* @__PURE__ */ e(h()), P = _.forwardRef((e, t) => { let { className: n, color: r, radius: i, ...o } = s(e, M, a); return _.createElement(A, { "data-accent-color": r, "data-radius": i, ...o, asChild: !1, ref: t, className: (0, N.default)("rt-reset", "rt-SwitchRoot", n) }, _.createElement(j, { className: (0, N.default)("rt-SwitchThumb", { "rt-high-contrast": e.highContrast }) })); }); P.displayName = "Switch"; //#endregion //#region ../debug/src/lib/ui/boolean-editor.tsx var F = (e) => /* @__PURE__ */ (0, v.jsx)(g, { label: e.label, children: /* @__PURE__ */ (0, v.jsx)(P, { checked: e.value, onCheckedChange: (t) => e.onChange(t) }) }); //#endregion export { F as BooleanEditor };