@sikka/hawa 0.8.12-next → 0.8.13-next
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -5
- package/dist/index.mjs +55 -35
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -199,6 +199,7 @@ declare function Toaster(props: ToasterProps): React__default.JSX.Element;
|
|
|
199
199
|
interface SwitchProps extends React$1.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> {
|
|
200
200
|
size?: "default" | "sm" | "lg";
|
|
201
201
|
label?: string;
|
|
202
|
+
roundedness?: "none" | "full" | "inherit";
|
|
202
203
|
}
|
|
203
204
|
declare const Switch: React$1.ForwardRefExoticComponent<SwitchProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
204
205
|
|
package/dist/index.d.ts
CHANGED
|
@@ -199,6 +199,7 @@ declare function Toaster(props: ToasterProps): React__default.JSX.Element;
|
|
|
199
199
|
interface SwitchProps extends React$1.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> {
|
|
200
200
|
size?: "default" | "sm" | "lg";
|
|
201
201
|
label?: string;
|
|
202
|
+
roundedness?: "none" | "full" | "inherit";
|
|
202
203
|
}
|
|
203
204
|
declare const Switch: React$1.ForwardRefExoticComponent<SwitchProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
204
205
|
|
package/dist/index.js
CHANGED
|
@@ -1717,9 +1717,10 @@ var thumbSize = {
|
|
|
1717
1717
|
lg: "hawa-h-[26px] hawa-w-[26px]"
|
|
1718
1718
|
};
|
|
1719
1719
|
var Switch = React15.forwardRef(function(_param, ref) {
|
|
1720
|
-
var className = _param.className, _param_size = _param.size, size = _param_size === void 0 ? "default" : _param_size, label = _param.label, props = _object_without_properties(_param, [
|
|
1720
|
+
var className = _param.className, _param_size = _param.size, size = _param_size === void 0 ? "default" : _param_size, _param_roundedness = _param.roundedness, roundedness = _param_roundedness === void 0 ? "inherit" : _param_roundedness, label = _param.label, props = _object_without_properties(_param, [
|
|
1721
1721
|
"className",
|
|
1722
1722
|
"size",
|
|
1723
|
+
"roundedness",
|
|
1723
1724
|
"label"
|
|
1724
1725
|
]);
|
|
1725
1726
|
var _React15_useState = _sliced_to_array(React15.useState(null), 2), parentDirection = _React15_useState[0], setParentDirection = _React15_useState[1];
|
|
@@ -1732,17 +1733,25 @@ var Switch = React15.forwardRef(function(_param, ref) {
|
|
|
1732
1733
|
setParentDirection(dir);
|
|
1733
1734
|
}
|
|
1734
1735
|
});
|
|
1736
|
+
var rootRoundednessStyles = {
|
|
1737
|
+
none: "hawa-rounded-none",
|
|
1738
|
+
full: "hawa-rounded-full",
|
|
1739
|
+
inherit: "hawa-rounded"
|
|
1740
|
+
};
|
|
1741
|
+
var thumbRoundednessStyles = {
|
|
1742
|
+
none: "hawa-rounded-none",
|
|
1743
|
+
full: "hawa-rounded-full",
|
|
1744
|
+
inherit: "hawa-rounded-inner"
|
|
1745
|
+
};
|
|
1735
1746
|
return /* @__PURE__ */ React15.createElement("div", {
|
|
1736
1747
|
className: "hawa-flex hawa-flex-row hawa-items-center",
|
|
1737
1748
|
ref: parentRef
|
|
1738
1749
|
}, /* @__PURE__ */ React15.createElement(SwitchPrimitives.Root, _object_spread_props(_object_spread({
|
|
1739
|
-
className: cn("hawa-relative hawa-cursor-pointer hawa-rounded
|
|
1740
|
-
className, rootSize[size])
|
|
1750
|
+
className: cn("hawa-relative hawa-cursor-pointer hawa-rounded hawa-bg-primary/20 hawa-outline-none data-[state=checked]:hawa-bg-primary", rootRoundednessStyles[roundedness], className, rootSize[size])
|
|
1741
1751
|
}, props), {
|
|
1742
1752
|
ref: ref
|
|
1743
1753
|
}), /* @__PURE__ */ React15.createElement(SwitchPrimitives.Thumb, {
|
|
1744
|
-
className: cn(thumbSize[size], "hawa-block hawa-rounded
|
|
1745
|
-
parentDirection === "rtl" ? "hawa--translate-x-0.5 data-[state=checked]:hawa--translate-x-[19px]" : "hawa-translate-x-0.5 data-[state=checked]:hawa-translate-x-[19px]")
|
|
1754
|
+
className: cn(thumbSize[size], "hawa-block hawa-rounded hawa-bg-white hawa-transition-transform hawa-duration-100 hawa-will-change-transform data-[state=checked]:hawa-bg-primary-foreground dark:hawa-bg-background", thumbRoundednessStyles[roundedness], parentDirection === "rtl" ? "hawa--translate-x-0.5 data-[state=checked]:hawa--translate-x-[19px]" : "hawa-translate-x-0.5 data-[state=checked]:hawa-translate-x-[19px]")
|
|
1746
1755
|
})), label && /* @__PURE__ */ React15.createElement("span", {
|
|
1747
1756
|
className: "hawa-mx-2 hawa-text-sm hawa-font-medium hawa-text-gray-900 dark:hawa-text-gray-300"
|
|
1748
1757
|
}, label));
|
package/dist/index.mjs
CHANGED
|
@@ -1083,43 +1083,63 @@ var thumbSize = {
|
|
|
1083
1083
|
sm: "hawa-h-[16px] hawa-w-[16px]",
|
|
1084
1084
|
lg: "hawa-h-[26px] hawa-w-[26px]"
|
|
1085
1085
|
};
|
|
1086
|
-
var Switch = React15.forwardRef(
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
SwitchPrimitives.Thumb,
|
|
1086
|
+
var Switch = React15.forwardRef(
|
|
1087
|
+
({ className, size = "default", roundedness = "inherit", label, ...props }, ref) => {
|
|
1088
|
+
const [parentDirection, setParentDirection] = React15.useState(
|
|
1089
|
+
null
|
|
1090
|
+
);
|
|
1091
|
+
const parentRef = React15.useRef(null);
|
|
1092
|
+
React15.useEffect(() => {
|
|
1093
|
+
const parentNode = parentRef.current?.parentNode;
|
|
1094
|
+
if (parentNode) {
|
|
1095
|
+
const dir = window.getComputedStyle(parentNode).direction;
|
|
1096
|
+
setParentDirection(dir);
|
|
1097
|
+
}
|
|
1098
|
+
});
|
|
1099
|
+
const rootRoundednessStyles = {
|
|
1100
|
+
none: "hawa-rounded-none",
|
|
1101
|
+
full: "hawa-rounded-full",
|
|
1102
|
+
inherit: "hawa-rounded"
|
|
1103
|
+
};
|
|
1104
|
+
const thumbRoundednessStyles = {
|
|
1105
|
+
none: "hawa-rounded-none",
|
|
1106
|
+
full: "hawa-rounded-full",
|
|
1107
|
+
inherit: "hawa-rounded-inner"
|
|
1108
|
+
};
|
|
1109
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1110
|
+
"div",
|
|
1112
1111
|
{
|
|
1113
|
-
className:
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1112
|
+
className: "hawa-flex hawa-flex-row hawa-items-center",
|
|
1113
|
+
ref: parentRef
|
|
1114
|
+
},
|
|
1115
|
+
/* @__PURE__ */ React15.createElement(
|
|
1116
|
+
SwitchPrimitives.Root,
|
|
1117
|
+
{
|
|
1118
|
+
className: cn(
|
|
1119
|
+
"hawa-relative hawa-cursor-pointer hawa-rounded hawa-bg-primary/20 hawa-outline-none data-[state=checked]:hawa-bg-primary",
|
|
1120
|
+
rootRoundednessStyles[roundedness],
|
|
1121
|
+
className,
|
|
1122
|
+
rootSize[size]
|
|
1123
|
+
),
|
|
1124
|
+
...props,
|
|
1125
|
+
ref
|
|
1126
|
+
},
|
|
1127
|
+
/* @__PURE__ */ React15.createElement(
|
|
1128
|
+
SwitchPrimitives.Thumb,
|
|
1129
|
+
{
|
|
1130
|
+
className: cn(
|
|
1131
|
+
thumbSize[size],
|
|
1132
|
+
"hawa-block hawa-rounded hawa-bg-white hawa-transition-transform hawa-duration-100 hawa-will-change-transform data-[state=checked]:hawa-bg-primary-foreground dark:hawa-bg-background",
|
|
1133
|
+
thumbRoundednessStyles[roundedness],
|
|
1134
|
+
parentDirection === "rtl" ? "hawa--translate-x-0.5 data-[state=checked]:hawa--translate-x-[19px]" : "hawa-translate-x-0.5 data-[state=checked]:hawa-translate-x-[19px]"
|
|
1135
|
+
)
|
|
1136
|
+
}
|
|
1118
1137
|
)
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
}
|
|
1138
|
+
),
|
|
1139
|
+
label && /* @__PURE__ */ React15.createElement("span", { className: "hawa-mx-2 hawa-text-sm hawa-font-medium hawa-text-gray-900 dark:hawa-text-gray-300" }, label)
|
|
1140
|
+
);
|
|
1141
|
+
}
|
|
1142
|
+
);
|
|
1123
1143
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
1124
1144
|
|
|
1125
1145
|
// components/elements/Radio.tsx
|