@shoplflow/base 0.30.3 → 0.30.5
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.cjs +63 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +63 -57
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2383,7 +2383,14 @@ var getStylesByStyleVariant = (styleVariant, isSelected, isHovered) => {
|
|
|
2383
2383
|
return "";
|
|
2384
2384
|
}
|
|
2385
2385
|
};
|
|
2386
|
-
var
|
|
2386
|
+
var StyledCheckHiddenInput = styled6__default.default.input`
|
|
2387
|
+
position: absolute;
|
|
2388
|
+
width: 0;
|
|
2389
|
+
height: 0;
|
|
2390
|
+
opacity: 0;
|
|
2391
|
+
visibility: hidden;
|
|
2392
|
+
`;
|
|
2393
|
+
var StyledCheckbox = styled6__default.default.label`
|
|
2387
2394
|
display: flex;
|
|
2388
2395
|
align-items: center;
|
|
2389
2396
|
justify-content: center;
|
|
@@ -2408,62 +2415,61 @@ var Container3 = styled6__default.default.button`
|
|
|
2408
2415
|
background-color: transparent;
|
|
2409
2416
|
`;
|
|
2410
2417
|
exports.CHECKBOX_SYMBOL_KEY = Symbol("SHOPLFLOW_CHECKBOX");
|
|
2411
|
-
var Checkbox = (
|
|
2412
|
-
|
|
2413
|
-
defaultSelected,
|
|
2414
|
-
isSelected,
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
};
|
|
2418
|
+
var Checkbox = React3.forwardRef(
|
|
2419
|
+
(_a, ref) => {
|
|
2420
|
+
var _b = _a, { defaultSelected, isSelected, disabled, onMouseEnter, onClick, onMouseLeave, styleVar = "PRIMARY", id } = _b, rest = __objRest(_b, ["defaultSelected", "isSelected", "disabled", "onMouseEnter", "onClick", "onMouseLeave", "styleVar", "id"]);
|
|
2421
|
+
const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
|
|
2422
|
+
const [isHovered, toggleHovered] = React3.useState(false);
|
|
2423
|
+
const handleMouseLeave = (e) => {
|
|
2424
|
+
toggleHovered(false);
|
|
2425
|
+
onMouseLeave && onMouseLeave(e);
|
|
2426
|
+
};
|
|
2427
|
+
const handleMouseEnter = (e) => {
|
|
2428
|
+
toggleHovered(true);
|
|
2429
|
+
onMouseEnter && onMouseEnter(e);
|
|
2430
|
+
};
|
|
2431
|
+
const handleClick = (e) => {
|
|
2432
|
+
if (disabled) {
|
|
2433
|
+
return;
|
|
2434
|
+
}
|
|
2435
|
+
onClick && onClick(e);
|
|
2436
|
+
toggleSelected();
|
|
2437
|
+
};
|
|
2438
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2439
|
+
Container3,
|
|
2440
|
+
{
|
|
2441
|
+
onClick: handleClick,
|
|
2442
|
+
onMouseLeave: handleMouseLeave,
|
|
2443
|
+
onMouseEnter: handleMouseEnter,
|
|
2444
|
+
disabled,
|
|
2445
|
+
type: "button",
|
|
2446
|
+
"data-shoplflow": "Checkbox",
|
|
2447
|
+
children: [
|
|
2448
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledCheckHiddenInput, __spreadProps(__spreadValues({ type: "checkbox", disabled, id }, rest), { ref })),
|
|
2449
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2450
|
+
StyledCheckbox,
|
|
2451
|
+
{
|
|
2452
|
+
styleVar,
|
|
2453
|
+
htmlFor: "id",
|
|
2454
|
+
isHovered,
|
|
2455
|
+
isSelected: selected,
|
|
2456
|
+
disabled,
|
|
2457
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2458
|
+
"path",
|
|
2459
|
+
{
|
|
2460
|
+
fillRule: "evenodd",
|
|
2461
|
+
clipRule: "evenodd",
|
|
2462
|
+
d: "M9.78822 0.297596C10.1761 -0.0955083 10.8093 -0.0997053 11.2024 0.288222C11.5653 0.646308 11.5968 1.21334 11.2943 1.60765L11.2118 1.7024L5.31714 7.7024C4.95248 8.07193 4.37282 8.09687 3.97909 7.77976L3.88476 7.69335L0.779404 4.42669C0.396475 4.02871 0.408672 3.39567 0.806647 3.01274C1.17401 2.65926 1.74167 2.64247 2.12801 2.95499L2.2206 3.03998L4.614 5.567L9.78822 0.297596Z",
|
|
2463
|
+
fill: "white"
|
|
2464
|
+
}
|
|
2465
|
+
) })
|
|
2466
|
+
}
|
|
2467
|
+
)
|
|
2468
|
+
]
|
|
2469
|
+
}
|
|
2470
|
+
);
|
|
2471
|
+
}
|
|
2472
|
+
);
|
|
2467
2473
|
Checkbox[exports.CHECKBOX_SYMBOL_KEY] = true;
|
|
2468
2474
|
exports.Checkbox = Checkbox;
|
|
2469
2475
|
|