@shoplflow/base 0.30.3 → 0.30.4
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 +62 -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 +62 -57
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1090,11 +1090,11 @@ declare const CheckboxStyleVariants: {
|
|
|
1090
1090
|
declare type CheckboxStyleVariantType = $Values<typeof CheckboxStyleVariants>;
|
|
1091
1091
|
interface CheckboxProps extends CheckboxOptionProps {
|
|
1092
1092
|
}
|
|
1093
|
-
interface CheckboxOptionProps extends StyleVariantProps<CheckboxStyleVariantType>, SelectedProps, DefaultSelectedProps, DisableProps, ButtonHTMLAttributes<HTMLButtonElement> {
|
|
1093
|
+
interface CheckboxOptionProps extends StyleVariantProps<CheckboxStyleVariantType>, SelectedProps, DefaultSelectedProps, DisableProps, Omit<InputHTMLAttributes<HTMLInputElement>, 'onMouseLeave' | 'onMouseEnter'>, Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onMouseLeave' | 'onMouseEnter'> {
|
|
1094
1094
|
}
|
|
1095
1095
|
|
|
1096
1096
|
declare const CHECKBOX_SYMBOL_KEY: unique symbol;
|
|
1097
|
-
declare const Checkbox:
|
|
1097
|
+
declare const Checkbox: React__default.ForwardRefExoticComponent<CheckboxProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
1098
1098
|
|
|
1099
1099
|
interface RadioProps extends RadioOptionProps {
|
|
1100
1100
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1090,11 +1090,11 @@ declare const CheckboxStyleVariants: {
|
|
|
1090
1090
|
declare type CheckboxStyleVariantType = $Values<typeof CheckboxStyleVariants>;
|
|
1091
1091
|
interface CheckboxProps extends CheckboxOptionProps {
|
|
1092
1092
|
}
|
|
1093
|
-
interface CheckboxOptionProps extends StyleVariantProps<CheckboxStyleVariantType>, SelectedProps, DefaultSelectedProps, DisableProps, ButtonHTMLAttributes<HTMLButtonElement> {
|
|
1093
|
+
interface CheckboxOptionProps extends StyleVariantProps<CheckboxStyleVariantType>, SelectedProps, DefaultSelectedProps, DisableProps, Omit<InputHTMLAttributes<HTMLInputElement>, 'onMouseLeave' | 'onMouseEnter'>, Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onMouseLeave' | 'onMouseEnter'> {
|
|
1094
1094
|
}
|
|
1095
1095
|
|
|
1096
1096
|
declare const CHECKBOX_SYMBOL_KEY: unique symbol;
|
|
1097
|
-
declare const Checkbox:
|
|
1097
|
+
declare const Checkbox: React__default.ForwardRefExoticComponent<CheckboxProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
1098
1098
|
|
|
1099
1099
|
interface RadioProps extends RadioOptionProps {
|
|
1100
1100
|
}
|
package/dist/index.js
CHANGED
|
@@ -2358,7 +2358,14 @@ var getStylesByStyleVariant = (styleVariant, isSelected, isHovered) => {
|
|
|
2358
2358
|
return "";
|
|
2359
2359
|
}
|
|
2360
2360
|
};
|
|
2361
|
-
var
|
|
2361
|
+
var StyledCheckHiddenInput = styled6.input`
|
|
2362
|
+
position: absolute;
|
|
2363
|
+
width: 0;
|
|
2364
|
+
height: 0;
|
|
2365
|
+
opacity: 0;
|
|
2366
|
+
visibility: hidden;
|
|
2367
|
+
`;
|
|
2368
|
+
var StyledCheckbox = styled6.label`
|
|
2362
2369
|
display: flex;
|
|
2363
2370
|
align-items: center;
|
|
2364
2371
|
justify-content: center;
|
|
@@ -2383,62 +2390,60 @@ var Container3 = styled6.button`
|
|
|
2383
2390
|
background-color: transparent;
|
|
2384
2391
|
`;
|
|
2385
2392
|
var CHECKBOX_SYMBOL_KEY = Symbol("SHOPLFLOW_CHECKBOX");
|
|
2386
|
-
var Checkbox = (
|
|
2387
|
-
|
|
2388
|
-
defaultSelected,
|
|
2389
|
-
isSelected,
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
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
|
-
};
|
|
2393
|
+
var Checkbox = forwardRef(
|
|
2394
|
+
(_a, ref) => {
|
|
2395
|
+
var _b = _a, { defaultSelected, isSelected, disabled, onMouseEnter, onMouseLeave, styleVar = "PRIMARY", id } = _b, rest = __objRest(_b, ["defaultSelected", "isSelected", "disabled", "onMouseEnter", "onMouseLeave", "styleVar", "id"]);
|
|
2396
|
+
const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
|
|
2397
|
+
const [isHovered, toggleHovered] = useState(false);
|
|
2398
|
+
const handleMouseLeave = (e) => {
|
|
2399
|
+
toggleHovered(false);
|
|
2400
|
+
onMouseLeave && onMouseLeave(e);
|
|
2401
|
+
};
|
|
2402
|
+
const handleMouseEnter = (e) => {
|
|
2403
|
+
toggleHovered(true);
|
|
2404
|
+
onMouseEnter && onMouseEnter(e);
|
|
2405
|
+
};
|
|
2406
|
+
const handleClick = () => {
|
|
2407
|
+
if (disabled) {
|
|
2408
|
+
return;
|
|
2409
|
+
}
|
|
2410
|
+
toggleSelected();
|
|
2411
|
+
};
|
|
2412
|
+
return /* @__PURE__ */ jsxs(
|
|
2413
|
+
Container3,
|
|
2414
|
+
{
|
|
2415
|
+
onClick: handleClick,
|
|
2416
|
+
onMouseLeave: handleMouseLeave,
|
|
2417
|
+
onMouseEnter: handleMouseEnter,
|
|
2418
|
+
disabled,
|
|
2419
|
+
type: "button",
|
|
2420
|
+
"data-shoplflow": "Checkbox",
|
|
2421
|
+
children: [
|
|
2422
|
+
/* @__PURE__ */ jsx(StyledCheckHiddenInput, __spreadProps(__spreadValues({ type: "checkbox", disabled, id }, rest), { ref })),
|
|
2423
|
+
/* @__PURE__ */ jsx(
|
|
2424
|
+
StyledCheckbox,
|
|
2425
|
+
{
|
|
2426
|
+
styleVar,
|
|
2427
|
+
htmlFor: "id",
|
|
2428
|
+
isHovered,
|
|
2429
|
+
isSelected: selected,
|
|
2430
|
+
disabled,
|
|
2431
|
+
children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", children: /* @__PURE__ */ jsx(
|
|
2432
|
+
"path",
|
|
2433
|
+
{
|
|
2434
|
+
fillRule: "evenodd",
|
|
2435
|
+
clipRule: "evenodd",
|
|
2436
|
+
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",
|
|
2437
|
+
fill: "white"
|
|
2438
|
+
}
|
|
2439
|
+
) })
|
|
2440
|
+
}
|
|
2441
|
+
)
|
|
2442
|
+
]
|
|
2443
|
+
}
|
|
2444
|
+
);
|
|
2445
|
+
}
|
|
2446
|
+
);
|
|
2442
2447
|
Checkbox[CHECKBOX_SYMBOL_KEY] = true;
|
|
2443
2448
|
var Checkbox_default = Checkbox;
|
|
2444
2449
|
|