90 lines
2.9 KiB
JavaScript
90 lines
2.9 KiB
JavaScript
'use client'
|
|
"use strict";
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
|
|
// src/control-box.tsx
|
|
var control_box_exports = {};
|
|
__export(control_box_exports, {
|
|
ControlBox: () => ControlBox,
|
|
default: () => control_box_default
|
|
});
|
|
module.exports = __toCommonJS(control_box_exports);
|
|
var import_system = require("@chakra-ui/system");
|
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
var ControlBox = (props) => {
|
|
const {
|
|
type = "checkbox",
|
|
_hover,
|
|
_invalid,
|
|
_disabled,
|
|
_focus,
|
|
_checked,
|
|
_child = { opacity: 0 },
|
|
_checkedAndChild = { opacity: 1 },
|
|
_checkedAndDisabled,
|
|
_checkedAndFocus,
|
|
_checkedAndHover,
|
|
children,
|
|
...rest
|
|
} = props;
|
|
const checkedAndDisabled = `input[type=${type}]:checked:disabled + &`;
|
|
const checkedAndHover = `input[type=${type}]:checked:hover:not(:disabled) + &`;
|
|
const checkedAndFocus = `input[type=${type}]:checked:focus + &`;
|
|
const disabled = `input[type=${type}]:disabled + &`;
|
|
const focus = `input[type=${type}]:focus + &`;
|
|
const hover = `input[type=${type}]:hover:not(:disabled):not(:checked) + &`;
|
|
const checked = `input[type=${type}]:checked + &, input[type=${type}][aria-checked=mixed] + &`;
|
|
const invalid = `input[type=${type}][aria-invalid=true] + &`;
|
|
const child = `& > *`;
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
import_system.chakra.div,
|
|
{
|
|
...rest,
|
|
"aria-hidden": true,
|
|
__css: {
|
|
display: "inline-flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
transitionProperty: "common",
|
|
transitionDuration: "fast",
|
|
flexShrink: 0,
|
|
[focus]: _focus,
|
|
[hover]: _hover,
|
|
[disabled]: _disabled,
|
|
[invalid]: _invalid,
|
|
[checkedAndDisabled]: _checkedAndDisabled,
|
|
[checkedAndFocus]: _checkedAndFocus,
|
|
[checkedAndHover]: _checkedAndHover,
|
|
[child]: _child,
|
|
[checked]: {
|
|
..._checked,
|
|
[child]: _checkedAndChild
|
|
}
|
|
},
|
|
children
|
|
}
|
|
);
|
|
};
|
|
ControlBox.displayName = "ControlBox";
|
|
var control_box_default = ControlBox;
|
|
// Annotate the CommonJS export names for ESM import in node:
|
|
0 && (module.exports = {
|
|
ControlBox
|
|
});
|
|
//# sourceMappingURL=control-box.js.map
|