@parrot-co/parrot-ui 0.0.98 → 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/main.js CHANGED
@@ -641,18 +641,21 @@ const $5a6f28f3fd58ff6e$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, ($parcel$int
641
641
  const space = (0, $eae337549f49a5a2$export$450c36e0b0e62ccd)();
642
642
  const buttonGroupProps = (0, $7f70742e736041ff$export$749e21be8b14b968)();
643
643
  const theme = (0, $f2fd0cbe11b7f0dd$export$93d4e7f90805808f)();
644
- const { color: color = theme?.color ?? "violet", variant: variant = "solid", append: append, prepend: prepend, size: size = "md", children: children, as: as = "button", className: className, isLoading: isLoading, radius: radius = "full", isToggle: isToggle, activeColor: activeColor = "violet", activeVariant: activeVariant = "solid", idleColor: idleColor = "gray", idleVariant: idleVariant = "outline", isIconButton: isIconButton, style: style, ...otherProps } = {
644
+ const { color: color = theme?.color ?? "violet", variant: variant = "solid", append: append, prepend: prepend, size: size = "md", children: children, as: as = "button", className: className, isLoading: isLoading, radius: radius = "full", isToggle: isToggle, activeColor: activeColor = theme?.color, activeVariant: activeVariant = "solid", idleColor: idleColor = "gray", idleVariant: idleVariant = "outline", isIconButton: isIconButton, style: style, ...otherProps } = {
645
645
  ...buttonGroupProps,
646
646
  ...props
647
647
  };
648
- const state = (0, $8zHUo$reactstately.useToggleState)({
648
+ const state = isToggle ? (0, $8zHUo$reactstately.useToggleState)({
649
649
  ...otherProps
650
- });
650
+ }) : {};
651
651
  const buttonRef = (0, ($parcel$interopDefault($8zHUo$react))).useRef(null);
652
- const { buttonProps: buttonProps, isPressed: isPressed } = (0, $8zHUo$reactaria.useToggleButton)({
652
+ const { buttonProps: buttonProps, isPressed: isPressed } = isToggle ? (0, $8zHUo$reactaria.useToggleButton)({
653
+ ...otherProps,
654
+ elementType: as
655
+ }, state, buttonRef) : (0, $8zHUo$reactaria.useButton)({
653
656
  ...otherProps,
654
657
  elementType: as
655
- }, state, buttonRef);
658
+ }, buttonRef);
656
659
  function getColor() {
657
660
  if (!state.isSelected && isToggle) return {
658
661
  color: idleColor,
@@ -677,6 +680,7 @@ const $5a6f28f3fd58ff6e$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, ($parcel$int
677
680
  "aria-busy": isLoading,
678
681
  "data-color": getColor().color,
679
682
  "data-variant": getColor().variant,
683
+ "data-selected": state.isSelected,
680
684
  className: (0, $62f1c614c0962470$export$a274e22fb40f762e)((0, $4af7da5c7dd0b9c2$export$2db1d02db18b2d82)("size", size), className, "p-button", space.classNames),
681
685
  ref: (0, $62f1c614c0962470$export$c9058316764c140e)(ref, buttonRef),
682
686
  form: otherProps.form,