@hive-ui/sibling-box 0.1.0

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/index.mjs ADDED
@@ -0,0 +1,63 @@
1
+ import { Box, buildBoxStyles } from "@hive-ui/box";
2
+ import { css, styled } from "@hive-ui/css-library";
3
+ import { forwardRef } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/SiblingBox.tsx
6
+ const siblingBoxStyleProps = new Set([
7
+ "_activeSibling",
8
+ "_boxChild",
9
+ "_checkedAndActiveSibling",
10
+ "_checkedAndDisabledSibling",
11
+ "_checkedAndFocusSibling",
12
+ "_checkedAndHoverSibling",
13
+ "_checkedAndInvalidSibling",
14
+ "_checkedAndInvalidAndDisabledSibling",
15
+ "_checkedAndInvalidAndHoverSibling",
16
+ "_checkedSibling",
17
+ "_checkedSiblingAndBoxChild",
18
+ "_disabledSibling",
19
+ "_focusSibling",
20
+ "_hoverSibling",
21
+ "_invalidSibling",
22
+ "_invalidAndHoverSibling",
23
+ "_invalidAndDisabledSibling",
24
+ "type"
25
+ ]);
26
+ const StyledSiblingBox = styled(Box, { shouldForwardProp: (propName) => !siblingBoxStyleProps.has(propName) })(({ _activeSibling, _boxChild, _checkedAndActiveSibling, _checkedAndDisabledSibling, _checkedAndFocusSibling, _checkedAndHoverSibling, _checkedAndInvalidSibling, _checkedAndInvalidAndDisabledSibling, _checkedAndInvalidAndHoverSibling, _checkedSibling, _checkedSiblingAndBoxChild, _disabledSibling, _focusSibling, _hoverSibling, _invalidSibling, _invalidAndHoverSibling, _invalidAndDisabledSibling, type = "checkbox", theme }) => {
27
+ const getSiblingStyles = (styles) => styles == null ? void 0 : buildBoxStyles(theme, styles);
28
+ return css({
29
+ [`input[type=${type}]:active + label &`]: getSiblingStyles(_activeSibling),
30
+ [`input[type=${type}]:checked + label &, input[type=${type}][aria-checked=mixed] + label &`]: getSiblingStyles(_checkedSibling),
31
+ [`input[type=${type}]:checked:active + label &, input[type=${type}][aria-checked=mixed]:active + label &`]: getSiblingStyles(_checkedAndActiveSibling),
32
+ [`input[type=${type}]:checked + label & > *, input[type=${type}][aria-checked=mixed] + label & > *`]: getSiblingStyles(_checkedSiblingAndBoxChild),
33
+ [`input[type=${type}]:checked:disabled + label &, input[type=${type}][aria-checked=mixed]:disabled + label &`]: getSiblingStyles(_checkedAndDisabledSibling),
34
+ [`input[type=${type}]:checked:focus + label &, input[type=${type}][aria-checked=mixed]:focus + label &`]: getSiblingStyles(_checkedAndFocusSibling),
35
+ [`input[type=${type}]:checked:hover:not(:disabled) + label &, input[type=${type}][aria-checked=mixed]:hover:not(:disabled) + label &`]: getSiblingStyles(_checkedAndHoverSibling),
36
+ [`input[type=${type}][aria-invalid=true]:checked + label &`]: getSiblingStyles(_checkedAndInvalidSibling),
37
+ [`input[type=${type}][aria-invalid=true]:checked:disabled + label &`]: getSiblingStyles(_checkedAndInvalidAndDisabledSibling),
38
+ [`input[type=${type}][aria-invalid=true]:checked:hover:not(:disabled) + label &`]: getSiblingStyles(_checkedAndInvalidAndHoverSibling),
39
+ [`input[type=${type}] + label & > *`]: getSiblingStyles(_boxChild),
40
+ [`input[type=${type}]:disabled + label &`]: getSiblingStyles(_disabledSibling),
41
+ [`input[type=${type}]:focus + label &`]: getSiblingStyles(_focusSibling),
42
+ [`input[type=${type}]:hover:not(:disabled):not(:checked) + label &`]: getSiblingStyles(_hoverSibling),
43
+ [`input[type=${type}][aria-invalid=true] + label &`]: getSiblingStyles(_invalidSibling),
44
+ [`input[type=${type}][aria-invalid=true]:hover:not(:disabled) + label &`]: getSiblingStyles(_invalidAndHoverSibling),
45
+ [`input[type=${type}][aria-invalid=true]:disabled + label &`]: getSiblingStyles(_invalidAndDisabledSibling)
46
+ });
47
+ });
48
+ const SiblingBox = forwardRef(({ element = "SIBLING_BOX", "aria-hidden": ariaHidden = "true", alignItems = "center", display = "inline-flex", flexShrink = 0, justifyContent = "center", transition = "all 120ms", ...props }, ref) => {
49
+ return /* @__PURE__ */ jsx(StyledSiblingBox, {
50
+ as: "span",
51
+ alignItems,
52
+ "aria-hidden": ariaHidden,
53
+ display,
54
+ element,
55
+ flexShrink,
56
+ justifyContent,
57
+ ref,
58
+ transition,
59
+ ...props
60
+ });
61
+ });
62
+ //#endregion
63
+ export { SiblingBox };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@hive-ui/sibling-box",
3
+ "version": "0.1.0",
4
+ "description": "Hive UI Sibling Box Primative",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "type": "module",
9
+ "exports": {
10
+ ".": "./dist/index.mjs",
11
+ "./package.json": "./package.json"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "scripts": {
17
+ "build": "vp pack",
18
+ "dev": "vp pack --watch",
19
+ "test": "vp test",
20
+ "check": "vp check",
21
+ "prepublishOnly": "vp run build"
22
+ },
23
+ "dependencies": {
24
+ "@hive-ui/box": "^0.1.0",
25
+ "@hive-ui/style-props": "^0.1.0",
26
+ "@hive-ui/css-library": "^0.1.0"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^25.6.2",
30
+ "@typescript/native-preview": "7.0.0-dev.20260509.2",
31
+ "bumpp": "^11.1.0",
32
+ "typescript": "^6.0.3",
33
+ "vite-plus": "^0.1.20",
34
+ "vitest": "npm:@voidzero-dev/vite-plus-test@^0.1.20"
35
+ },
36
+ "peerDependencies": {
37
+ "react": "19.2.6"
38
+ }
39
+ }