@szymonpiatek/designsystem 0.0.14 → 0.0.15

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.cts CHANGED
@@ -131,7 +131,7 @@ interface ButtonProps {
131
131
 
132
132
  declare const CloseButton: react.ForwardRefExoticComponent<CloseButtonProps & react.RefAttributes<HTMLButtonElement>>;
133
133
 
134
- interface CloseButtonProps extends Omit<ButtonProps, 'startIcon' | 'endIcon' | 'children' | 'shape' | 'variant'> {
134
+ interface CloseButtonProps extends Omit<ButtonProps, 'startIcon' | 'endIcon' | 'children' | 'shape'> {
135
135
  'aria-label'?: string;
136
136
  }
137
137
 
@@ -1266,7 +1266,7 @@ declare const PaginationEllipsis: {
1266
1266
  declare const PaginationButton: react.ForwardRefExoticComponent<PaginationButtonProps & react.RefAttributes<HTMLButtonElement>>;
1267
1267
 
1268
1268
  type PaginationButtonSize = 'sm' | 'md' | 'lg' | 'xl';
1269
- type PaginationButtonVariant = 'page' | 'nav';
1269
+ type PaginationButtonVariant = ButtonVariant;
1270
1270
  interface PaginationButtonProps {
1271
1271
  onClick?: MouseEventHandler<HTMLButtonElement>;
1272
1272
  isActive?: boolean;
@@ -1274,7 +1274,7 @@ interface PaginationButtonProps {
1274
1274
  size?: PaginationButtonSize;
1275
1275
  variant?: PaginationButtonVariant;
1276
1276
  'aria-label': string;
1277
- children: React.ReactNode;
1277
+ children: ReactNode;
1278
1278
  }
1279
1279
 
1280
1280
  declare function CommandPalette({ open, onClose, groups, placeholder, emptyLabel, onSelect, }: CommandPaletteProps): react.ReactPortal | null;
@@ -1310,6 +1310,7 @@ interface CartButtonProps {
1310
1310
  count?: number;
1311
1311
  size?: CartButtonSize;
1312
1312
  shape?: ButtonShape;
1313
+ variant?: ButtonVariant;
1313
1314
  label?: string;
1314
1315
  disabled?: boolean;
1315
1316
  onClick?: MouseEventHandler<HTMLButtonElement>;
package/dist/index.d.ts CHANGED
@@ -131,7 +131,7 @@ interface ButtonProps {
131
131
 
132
132
  declare const CloseButton: react.ForwardRefExoticComponent<CloseButtonProps & react.RefAttributes<HTMLButtonElement>>;
133
133
 
134
- interface CloseButtonProps extends Omit<ButtonProps, 'startIcon' | 'endIcon' | 'children' | 'shape' | 'variant'> {
134
+ interface CloseButtonProps extends Omit<ButtonProps, 'startIcon' | 'endIcon' | 'children' | 'shape'> {
135
135
  'aria-label'?: string;
136
136
  }
137
137
 
@@ -1266,7 +1266,7 @@ declare const PaginationEllipsis: {
1266
1266
  declare const PaginationButton: react.ForwardRefExoticComponent<PaginationButtonProps & react.RefAttributes<HTMLButtonElement>>;
1267
1267
 
1268
1268
  type PaginationButtonSize = 'sm' | 'md' | 'lg' | 'xl';
1269
- type PaginationButtonVariant = 'page' | 'nav';
1269
+ type PaginationButtonVariant = ButtonVariant;
1270
1270
  interface PaginationButtonProps {
1271
1271
  onClick?: MouseEventHandler<HTMLButtonElement>;
1272
1272
  isActive?: boolean;
@@ -1274,7 +1274,7 @@ interface PaginationButtonProps {
1274
1274
  size?: PaginationButtonSize;
1275
1275
  variant?: PaginationButtonVariant;
1276
1276
  'aria-label': string;
1277
- children: React.ReactNode;
1277
+ children: ReactNode;
1278
1278
  }
1279
1279
 
1280
1280
  declare function CommandPalette({ open, onClose, groups, placeholder, emptyLabel, onSelect, }: CommandPaletteProps): react.ReactPortal | null;
@@ -1310,6 +1310,7 @@ interface CartButtonProps {
1310
1310
  count?: number;
1311
1311
  size?: CartButtonSize;
1312
1312
  shape?: ButtonShape;
1313
+ variant?: ButtonVariant;
1313
1314
  label?: string;
1314
1315
  disabled?: boolean;
1315
1316
  onClick?: MouseEventHandler<HTMLButtonElement>;
package/dist/index.js CHANGED
@@ -654,25 +654,28 @@ var Button = forwardRef(
654
654
  )
655
655
  );
656
656
  Button.displayName = "Button";
657
- var StyledButton2 = styled(Button)(({ theme }) => ({
657
+ var StyledButton2 = styled(Button)(({ theme, $variant }) => ({
658
658
  border: "none",
659
659
  borderRadius: "0.375rem",
660
- color: theme.palette.text.secondary,
661
- "&:hover:not(:disabled)": {
662
- backgroundColor: theme.palette.action.hover,
663
- color: theme.palette.text.primary
664
- },
665
- "&:active:not(:disabled)": {
666
- filter: "none",
667
- backgroundColor: theme.palette.action.selected
668
- }
660
+ ...$variant === "ghost" || $variant === "text" ? {
661
+ color: theme.palette.text.secondary,
662
+ "&:hover:not(:disabled)": {
663
+ backgroundColor: theme.palette.action.hover,
664
+ color: theme.palette.text.primary
665
+ },
666
+ "&:active:not(:disabled)": {
667
+ filter: "none",
668
+ backgroundColor: theme.palette.action.selected
669
+ }
670
+ } : {}
669
671
  }));
670
672
  var CloseButton = forwardRef(
671
- ({ "aria-label": ariaLabel = "Zamknij", size = "sm", ...props }, ref) => /* @__PURE__ */ jsx(
673
+ ({ "aria-label": ariaLabel = "Zamknij", size = "sm", variant = "ghost", ...props }, ref) => /* @__PURE__ */ jsx(
672
674
  StyledButton2,
673
675
  {
674
676
  ref,
675
- variant: "ghost",
677
+ variant,
678
+ $variant: variant,
676
679
  shape: "square",
677
680
  size,
678
681
  startIcon: /* @__PURE__ */ jsx(CloseIcon, { "aria-hidden": true, style: { fontSize: "inherit" } }),
@@ -9750,41 +9753,80 @@ var sizeOverrides = {
9750
9753
  lg: { minWidth: "2.5rem", height: "2.5rem" },
9751
9754
  xl: { minWidth: "3rem", height: "3rem" }
9752
9755
  };
9753
- var activeStyles = (theme) => ({
9754
- backgroundColor: theme.palette.primary.main,
9755
- color: theme.palette.primary.contrastText,
9756
- fontWeight: 700,
9757
- "&:hover:not(:disabled)": { backgroundColor: theme.palette.primary.dark },
9758
- "&:active:not(:disabled)": { filter: "none" }
9759
- });
9760
- var idleStyles = (theme) => ({
9761
- backgroundColor: "transparent",
9762
- color: theme.palette.text.primary,
9763
- fontWeight: 400,
9764
- "&:hover:not(:disabled)": { backgroundColor: alpha(theme.palette.primary.main, 0.08) },
9765
- "&:active:not(:disabled)": { backgroundColor: alpha(theme.palette.primary.main, 0.16) }
9766
- });
9767
- var StyledButton3 = styled(Button)(
9768
- ({ theme, $isActive, $btnSize }) => ({
9756
+ var activeStyles = (theme, variant) => {
9757
+ if (variant === "secondary") {
9758
+ return {
9759
+ backgroundColor: theme.palette.secondary.main,
9760
+ color: theme.palette.secondary.contrastText,
9761
+ fontWeight: 700,
9762
+ "&:hover:not(:disabled)": { backgroundColor: theme.palette.secondary.dark },
9763
+ "&:active:not(:disabled)": { filter: "none" }
9764
+ };
9765
+ }
9766
+ if (variant === "danger") {
9767
+ return {
9768
+ backgroundColor: theme.palette.error.main,
9769
+ color: theme.palette.error.contrastText,
9770
+ fontWeight: 700,
9771
+ "&:hover:not(:disabled)": { backgroundColor: theme.palette.error.dark },
9772
+ "&:active:not(:disabled)": { filter: "none" }
9773
+ };
9774
+ }
9775
+ if (variant === "primary") {
9776
+ return {
9777
+ fontWeight: 700,
9778
+ "&:active:not(:disabled)": { filter: "none" }
9779
+ };
9780
+ }
9781
+ return {
9782
+ backgroundColor: theme.palette.primary.main,
9783
+ color: theme.palette.primary.contrastText,
9784
+ fontWeight: 700,
9785
+ "&:hover:not(:disabled)": { backgroundColor: theme.palette.primary.dark },
9786
+ "&:active:not(:disabled)": { filter: "none" }
9787
+ };
9788
+ };
9789
+ var idleStyles = (theme, variant) => {
9790
+ if (variant !== "ghost" && variant !== "text") {
9791
+ return {};
9792
+ }
9793
+ return {
9794
+ backgroundColor: "transparent",
9795
+ color: theme.palette.text.primary,
9769
9796
  border: "none",
9770
- borderRadius: theme.shape.borderRadius,
9771
- padding: "0 0.25rem",
9772
- lineHeight: 1,
9773
- ...sizeOverrides[$btnSize],
9774
- ...$isActive ? activeStyles(theme) : idleStyles(theme)
9775
- })
9776
- );
9797
+ fontWeight: 400,
9798
+ "&:hover:not(:disabled)": { backgroundColor: alpha(theme.palette.primary.main, 0.08) },
9799
+ "&:active:not(:disabled)": { backgroundColor: alpha(theme.palette.primary.main, 0.16) }
9800
+ };
9801
+ };
9802
+ var StyledButton3 = styled(Button)(({ theme, $isActive, $btnSize, $variant }) => ({
9803
+ border: "none",
9804
+ borderRadius: theme.shape.borderRadius,
9805
+ padding: "0 0.25rem",
9806
+ lineHeight: 1,
9807
+ ...sizeOverrides[$btnSize],
9808
+ ...$isActive ? activeStyles(theme, $variant) : idleStyles(theme, $variant)
9809
+ }));
9777
9810
  var PaginationButton = forwardRef(
9778
- ({ onClick, isActive = false, disabled = false, size = "md", children, "aria-label": ariaLabel }, ref) => /* @__PURE__ */ jsx(
9811
+ ({
9812
+ onClick,
9813
+ isActive = false,
9814
+ disabled = false,
9815
+ size = "md",
9816
+ variant = "ghost",
9817
+ children,
9818
+ "aria-label": ariaLabel
9819
+ }, ref) => /* @__PURE__ */ jsx(
9779
9820
  StyledButton3,
9780
9821
  {
9781
9822
  ref,
9782
- variant: "ghost",
9823
+ variant,
9783
9824
  size,
9784
9825
  disabled,
9785
9826
  onClick,
9786
9827
  $isActive: isActive,
9787
9828
  $btnSize: size,
9829
+ $variant: variant,
9788
9830
  "aria-label": ariaLabel,
9789
9831
  "aria-current": isActive ? "page" : void 0,
9790
9832
  children
@@ -10263,12 +10305,22 @@ var Badge2 = styled("span")(({ theme }) => ({
10263
10305
  lineHeight: 1
10264
10306
  }));
10265
10307
  var CartButton = forwardRef(
10266
- ({ count, size = "sm", shape, label = "Koszyk", disabled, onClick, className, "aria-label": ariaLabel }, ref) => /* @__PURE__ */ jsxs(Root36, { className, children: [
10308
+ ({
10309
+ count,
10310
+ size = "sm",
10311
+ shape,
10312
+ variant = "ghost",
10313
+ label = "Koszyk",
10314
+ disabled,
10315
+ onClick,
10316
+ className,
10317
+ "aria-label": ariaLabel
10318
+ }, ref) => /* @__PURE__ */ jsxs(Root36, { className, children: [
10267
10319
  /* @__PURE__ */ jsx(
10268
10320
  Button,
10269
10321
  {
10270
10322
  ref,
10271
- variant: "ghost",
10323
+ variant,
10272
10324
  size,
10273
10325
  shape,
10274
10326
  disabled,
@@ -12530,23 +12582,34 @@ var VoucherCard = forwardRef(
12530
12582
  ] })
12531
12583
  );
12532
12584
  VoucherCard.displayName = "VoucherCard";
12533
- var StyledButton4 = styled(Button)(({ theme, $active }) => ({
12534
- border: `1px solid ${$active ? theme.palette.error.main : theme.palette.divider}`,
12535
- background: $active ? `${theme.palette.error.main}14` : "transparent",
12536
- color: $active ? theme.palette.error.main : theme.palette.text.secondary,
12537
- "&:hover:not(:disabled)": {
12538
- color: theme.palette.error.main,
12539
- borderColor: theme.palette.error.main,
12540
- backgroundColor: `${theme.palette.error.main}14`
12585
+ var StyledButton4 = styled(Button)(({
12586
+ theme,
12587
+ $active,
12588
+ $variant
12589
+ }) => {
12590
+ if ($variant !== "ghost" && $variant !== "text") {
12591
+ return {};
12541
12592
  }
12542
- }));
12593
+ return {
12594
+ border: $variant === "ghost" ? `1px solid ${$active ? theme.palette.error.main : theme.palette.divider}` : "none",
12595
+ background: $active ? `${theme.palette.error.main}14` : "transparent",
12596
+ color: $active ? theme.palette.error.main : theme.palette.text.secondary,
12597
+ "&:hover:not(:disabled)": {
12598
+ color: theme.palette.error.main,
12599
+ borderColor: $variant === "ghost" ? theme.palette.error.main : void 0,
12600
+ backgroundColor: `${theme.palette.error.main}14`
12601
+ }
12602
+ };
12603
+ });
12543
12604
  var WishlistButton = forwardRef(
12544
- ({ active = false, size = "md", label, ...props }, ref) => /* @__PURE__ */ jsx(
12605
+ ({ active = false, size = "md", variant = "ghost", label, ...props }, ref) => /* @__PURE__ */ jsx(
12545
12606
  StyledButton4,
12546
12607
  {
12547
12608
  ref,
12609
+ variant,
12548
12610
  shape: "circle",
12549
12611
  size,
12612
+ $variant: variant,
12550
12613
  startIcon: active ? /* @__PURE__ */ jsx(FavoriteIcon, { "aria-hidden": true, style: { fontSize: "inherit" } }) : /* @__PURE__ */ jsx(FavoriteBorderIcon, { "aria-hidden": true, style: { fontSize: "inherit" } }),
12551
12614
  "aria-label": label ?? (active ? "Usu\u0144 z listy \u017Cycze\u0144" : "Dodaj do listy \u017Cycze\u0144"),
12552
12615
  $active: active,