@aiready/components 0.14.4 → 0.14.6
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/charts/ForceDirectedGraph.js.map +1 -1
- package/dist/components/checkbox.js +3 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/separator.js +1 -0
- package/dist/components/separator.js.map +1 -1
- package/dist/components/switch.js +64 -42
- package/dist/components/switch.js.map +1 -1
- package/dist/hooks/useForceSimulation.js.map +1 -1
- package/dist/index.js +68 -43
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/charts/force-directed/useGraphInteractions.ts +2 -2
- package/src/charts/force-directed/useImperativeHandle.ts +1 -1
- package/src/components/__tests__/badge.test.tsx +38 -0
- package/src/components/__tests__/button.test.tsx +54 -0
- package/src/components/__tests__/card.test.tsx +56 -17
- package/src/components/__tests__/checkbox.test.tsx +28 -58
- package/src/components/__tests__/container.test.tsx +44 -51
- package/src/components/__tests__/grid.test.tsx +27 -134
- package/src/components/__tests__/input.test.tsx +35 -20
- package/src/components/__tests__/label.test.tsx +29 -35
- package/src/components/__tests__/modal.test.tsx +43 -72
- package/src/components/__tests__/select.test.tsx +51 -84
- package/src/components/__tests__/separator.test.tsx +23 -56
- package/src/components/__tests__/switch.test.tsx +28 -68
- package/src/components/__tests__/textarea.test.tsx +29 -77
- package/src/components/checkbox.tsx +3 -1
- package/src/components/separator.tsx +1 -0
- package/src/components/switch.tsx +62 -41
- package/src/hooks/useForceSimulation.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -631,6 +631,7 @@ var Separator = React2.forwardRef(
|
|
|
631
631
|
ref,
|
|
632
632
|
role: decorative ? "none" : "separator",
|
|
633
633
|
"aria-orientation": orientation,
|
|
634
|
+
"data-orientation": orientation,
|
|
634
635
|
className: cn(
|
|
635
636
|
"shrink-0 bg-border",
|
|
636
637
|
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
@@ -651,8 +652,10 @@ var Checkbox = React2.forwardRef(
|
|
|
651
652
|
type: "checkbox",
|
|
652
653
|
id: checkboxId,
|
|
653
654
|
ref,
|
|
655
|
+
role: "checkbox",
|
|
656
|
+
"aria-checked": props.checked ? "true" : "false",
|
|
654
657
|
className: cn(
|
|
655
|
-
"h-4 w-4 rounded border-gray-300 text-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
658
|
+
"peer h-4 w-4 rounded border-gray-300 text-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
656
659
|
className
|
|
657
660
|
),
|
|
658
661
|
...props
|
|
@@ -721,48 +724,70 @@ var RadioGroup = React2.forwardRef(
|
|
|
721
724
|
}
|
|
722
725
|
);
|
|
723
726
|
RadioGroup.displayName = "RadioGroup";
|
|
724
|
-
var Switch = React2.forwardRef(
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
727
|
+
var Switch = React2.forwardRef((props, ref) => {
|
|
728
|
+
const {
|
|
729
|
+
className,
|
|
730
|
+
label,
|
|
731
|
+
id,
|
|
732
|
+
checked,
|
|
733
|
+
onCheckedChange,
|
|
734
|
+
onChange,
|
|
735
|
+
disabled,
|
|
736
|
+
...restProps
|
|
737
|
+
} = props;
|
|
738
|
+
const switchId = id || React2.useId();
|
|
739
|
+
const isChecked = checked ?? false;
|
|
740
|
+
const { type: _type, ...buttonProps } = restProps;
|
|
741
|
+
const handleChange = (e) => {
|
|
742
|
+
onChange?.(e);
|
|
743
|
+
onCheckedChange?.(e.target.checked);
|
|
744
|
+
};
|
|
745
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
746
|
+
/* @__PURE__ */ jsxs(
|
|
747
|
+
"label",
|
|
748
|
+
{
|
|
749
|
+
htmlFor: switchId,
|
|
750
|
+
className: "relative inline-flex cursor-pointer items-center",
|
|
751
|
+
children: [
|
|
752
|
+
/* @__PURE__ */ jsx(
|
|
753
|
+
"input",
|
|
754
|
+
{
|
|
755
|
+
type: "checkbox",
|
|
756
|
+
id: switchId,
|
|
757
|
+
ref,
|
|
758
|
+
checked: isChecked,
|
|
759
|
+
onChange: handleChange,
|
|
760
|
+
className: "peer sr-only",
|
|
761
|
+
disabled
|
|
762
|
+
}
|
|
763
|
+
),
|
|
764
|
+
/* @__PURE__ */ jsx(
|
|
765
|
+
"button",
|
|
766
|
+
{
|
|
767
|
+
type: "button",
|
|
768
|
+
role: "switch",
|
|
769
|
+
"aria-checked": isChecked,
|
|
770
|
+
disabled,
|
|
771
|
+
className: cn(
|
|
772
|
+
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
773
|
+
'bg-gray-200 after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:border after:border-gray-300 after:bg-white after:transition-all after:content-[""] peer-checked:bg-primary peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-ring peer-focus:ring-offset-2 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
|
774
|
+
className
|
|
775
|
+
),
|
|
776
|
+
onClick: () => {
|
|
777
|
+
if (!disabled) {
|
|
778
|
+
const newChecked = !isChecked;
|
|
779
|
+
onCheckedChange?.(newChecked);
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
...buttonProps
|
|
783
|
+
}
|
|
784
|
+
)
|
|
785
|
+
]
|
|
786
|
+
}
|
|
787
|
+
),
|
|
788
|
+
label && /* @__PURE__ */ jsx("span", { className: "ml-3 text-sm font-medium text-foreground", children: label })
|
|
789
|
+
] });
|
|
790
|
+
});
|
|
766
791
|
Switch.displayName = "Switch";
|
|
767
792
|
var Textarea = React2.forwardRef(
|
|
768
793
|
({ className, ...props }, ref) => {
|