@aurora-ds/components 0.25.0 → 0.25.1
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/cjs/index.js +13 -135
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +13 -135
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -490,7 +490,7 @@ const DEFAULT_TRANSITION_DURATION_MS = 150;
|
|
|
490
490
|
* Get avatar sizes configuration based on the theme
|
|
491
491
|
* @param theme
|
|
492
492
|
*/
|
|
493
|
-
const getAvatarSizes
|
|
493
|
+
const getAvatarSizes = (theme) => ({
|
|
494
494
|
small: { size: BUTTON_SIZE - 8, fontSize: 'xs', overlap: `-${theme.spacing.md}` },
|
|
495
495
|
medium: { size: BUTTON_SIZE, fontSize: 'sm', overlap: `-${theme.spacing.md}` },
|
|
496
496
|
large: { size: BUTTON_SIZE + 8, fontSize: 'sm', overlap: `-${theme.spacing.lg}` },
|
|
@@ -500,7 +500,7 @@ const getAvatarSizes$1 = (theme) => ({
|
|
|
500
500
|
* Avatar styles using createStyles from @aurora-ds/theme
|
|
501
501
|
*/
|
|
502
502
|
const AVATAR_STYLES = createStyles((theme) => {
|
|
503
|
-
const AVATAR_SIZES = getAvatarSizes
|
|
503
|
+
const AVATAR_SIZES = getAvatarSizes(theme);
|
|
504
504
|
return {
|
|
505
505
|
root: ({ hasImage = false, clickable = false, size = 'medium', color, borderColor, backgroundColor }) => {
|
|
506
506
|
const sizeConfig = AVATAR_SIZES[size];
|
|
@@ -552,7 +552,7 @@ const Avatar = ({ image, label, onClick, size = 'medium', color, borderColor, ba
|
|
|
552
552
|
// hooks
|
|
553
553
|
const theme = useTheme();
|
|
554
554
|
// variables
|
|
555
|
-
const AVATAR_SIZES = getAvatarSizes
|
|
555
|
+
const AVATAR_SIZES = getAvatarSizes(theme);
|
|
556
556
|
const hasImage = !!image;
|
|
557
557
|
const clickable = !!onClick;
|
|
558
558
|
const handleKeyDown = (event) => {
|
|
@@ -565,16 +565,6 @@ const Avatar = ({ image, label, onClick, size = 'medium', color, borderColor, ba
|
|
|
565
565
|
};
|
|
566
566
|
Avatar.displayName = 'Avatar';
|
|
567
567
|
|
|
568
|
-
/**
|
|
569
|
-
* Get avatar sizes configuration based on the theme
|
|
570
|
-
* @param theme
|
|
571
|
-
*/
|
|
572
|
-
const getAvatarSizes = (theme) => ({
|
|
573
|
-
small: { size: BUTTON_SIZE - 8, fontSize: 'xs', overlap: `-${theme.spacing.md}` },
|
|
574
|
-
medium: { size: BUTTON_SIZE, fontSize: 'sm', overlap: `-${theme.spacing.md}` },
|
|
575
|
-
large: { size: BUTTON_SIZE + 8, fontSize: 'sm', overlap: `-${theme.spacing.lg}` },
|
|
576
|
-
});
|
|
577
|
-
|
|
578
568
|
/**
|
|
579
569
|
* AvatarGroup styles using createStyles from @aurora-ds/theme
|
|
580
570
|
*/
|
|
@@ -621,7 +611,7 @@ const AvatarGroup = ({ children, limit, size = 'medium' }) => {
|
|
|
621
611
|
// hooks
|
|
622
612
|
const theme = useTheme();
|
|
623
613
|
// variables
|
|
624
|
-
const AVATAR_SIZES = getAvatarSizes
|
|
614
|
+
const AVATAR_SIZES = getAvatarSizes(theme);
|
|
625
615
|
const childArray = Children.toArray(children);
|
|
626
616
|
const displayedChildren = limit ? childArray.slice(0, limit) : childArray;
|
|
627
617
|
const moreCount = limit && childArray.length > limit ? childArray.length - limit : 0;
|
|
@@ -654,7 +644,7 @@ const Skeleton = ({ width, height, borderRadius }) => {
|
|
|
654
644
|
};
|
|
655
645
|
Skeleton.displayName = 'Skeleton';
|
|
656
646
|
|
|
657
|
-
const getButtonSizeStyles
|
|
647
|
+
const getButtonSizeStyles = () => ({
|
|
658
648
|
small: {
|
|
659
649
|
height: BUTTON_SIZE - 8,
|
|
660
650
|
padding: {
|
|
@@ -685,7 +675,7 @@ const getButtonSizeStyles$1 = () => ({
|
|
|
685
675
|
* Get button variant styles based on the theme
|
|
686
676
|
* @param theme
|
|
687
677
|
*/
|
|
688
|
-
const getButtonVariantStyles
|
|
678
|
+
const getButtonVariantStyles = (theme) => {
|
|
689
679
|
// Shared base styles
|
|
690
680
|
const transparentBase = {
|
|
691
681
|
backgroundColor: colors.transparent,
|
|
@@ -763,8 +753,8 @@ const getButtonVariantStyles$1 = (theme) => {
|
|
|
763
753
|
* ```
|
|
764
754
|
*/
|
|
765
755
|
const BUTTON_STYLES = createStyles((theme) => {
|
|
766
|
-
const variantStyles = getButtonVariantStyles
|
|
767
|
-
const sizeStyles = getButtonSizeStyles
|
|
756
|
+
const variantStyles = getButtonVariantStyles(theme);
|
|
757
|
+
const sizeStyles = getButtonSizeStyles();
|
|
768
758
|
return {
|
|
769
759
|
root: ({ variant = 'contained', active = false, textColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor, size = 'medium' }) => {
|
|
770
760
|
const sizeConfig = sizeStyles[size];
|
|
@@ -806,100 +796,6 @@ const BUTTON_STYLES = createStyles((theme) => {
|
|
|
806
796
|
};
|
|
807
797
|
});
|
|
808
798
|
|
|
809
|
-
const getButtonSizeStyles = () => ({
|
|
810
|
-
small: {
|
|
811
|
-
height: BUTTON_SIZE - 8,
|
|
812
|
-
padding: {
|
|
813
|
-
vertical: 'xs',
|
|
814
|
-
horizontal: 'sm'
|
|
815
|
-
},
|
|
816
|
-
fontSize: 'sm'
|
|
817
|
-
},
|
|
818
|
-
medium: {
|
|
819
|
-
height: BUTTON_SIZE,
|
|
820
|
-
padding: {
|
|
821
|
-
vertical: 'sm',
|
|
822
|
-
horizontal: 'md'
|
|
823
|
-
},
|
|
824
|
-
fontSize: 'sm'
|
|
825
|
-
},
|
|
826
|
-
large: {
|
|
827
|
-
height: BUTTON_SIZE + 8,
|
|
828
|
-
padding: {
|
|
829
|
-
vertical: 'sm',
|
|
830
|
-
horizontal: 'lg'
|
|
831
|
-
},
|
|
832
|
-
fontSize: 'md'
|
|
833
|
-
}
|
|
834
|
-
});
|
|
835
|
-
|
|
836
|
-
/**
|
|
837
|
-
* Get button variant styles based on the theme
|
|
838
|
-
* @param theme
|
|
839
|
-
*/
|
|
840
|
-
const getButtonVariantStyles = (theme) => {
|
|
841
|
-
// Shared base styles
|
|
842
|
-
const transparentBase = {
|
|
843
|
-
backgroundColor: colors.transparent,
|
|
844
|
-
color: theme.colors.primary,
|
|
845
|
-
};
|
|
846
|
-
const surfaceStates = {
|
|
847
|
-
hover: { backgroundColor: theme.colors.surfaceHover },
|
|
848
|
-
pressed: { backgroundColor: theme.colors.surfaceActive },
|
|
849
|
-
};
|
|
850
|
-
const baseDisabled = {
|
|
851
|
-
color: theme.colors.disabledText,
|
|
852
|
-
cursor: 'not-allowed',
|
|
853
|
-
opacity: theme.opacity.high
|
|
854
|
-
};
|
|
855
|
-
return {
|
|
856
|
-
contained: {
|
|
857
|
-
default: {
|
|
858
|
-
backgroundColor: theme.colors.primary,
|
|
859
|
-
color: theme.colors.onPrimary,
|
|
860
|
-
border: 'none',
|
|
861
|
-
},
|
|
862
|
-
hover: { backgroundColor: theme.colors.primaryHover },
|
|
863
|
-
pressed: { backgroundColor: theme.colors.primaryActive },
|
|
864
|
-
disabled: { ...baseDisabled, backgroundColor: theme.colors.disabled },
|
|
865
|
-
textColor: 'onPrimary',
|
|
866
|
-
},
|
|
867
|
-
outlined: {
|
|
868
|
-
default: {
|
|
869
|
-
...transparentBase,
|
|
870
|
-
border: `1px solid ${theme.colors.primary}`,
|
|
871
|
-
},
|
|
872
|
-
...surfaceStates,
|
|
873
|
-
disabled: { ...baseDisabled, backgroundColor: 'transparent', borderColor: theme.colors.disabled },
|
|
874
|
-
textColor: 'primary',
|
|
875
|
-
},
|
|
876
|
-
text: {
|
|
877
|
-
default: { ...transparentBase, border: 'none' },
|
|
878
|
-
...surfaceStates,
|
|
879
|
-
disabled: { ...baseDisabled, backgroundColor: 'transparent' },
|
|
880
|
-
textColor: 'primary',
|
|
881
|
-
},
|
|
882
|
-
destructive: {
|
|
883
|
-
default: {
|
|
884
|
-
backgroundColor: theme.colors.error,
|
|
885
|
-
color: theme.colors.onError,
|
|
886
|
-
border: 'none',
|
|
887
|
-
},
|
|
888
|
-
hover: { backgroundColor: theme.colors.errorHover },
|
|
889
|
-
pressed: { backgroundColor: theme.colors.error },
|
|
890
|
-
disabled: { ...baseDisabled, backgroundColor: theme.colors.disabled },
|
|
891
|
-
textColor: 'onError',
|
|
892
|
-
},
|
|
893
|
-
link: {
|
|
894
|
-
default: { ...transparentBase, border: 'none', textDecoration: 'underline', textDecorationColor: 'transparent', textUnderlineOffset: '3px' },
|
|
895
|
-
hover: { backgroundColor: 'transparent', textDecorationColor: 'currentColor' },
|
|
896
|
-
pressed: { backgroundColor: 'transparent', textDecorationColor: 'currentColor', color: theme.colors.linkActive },
|
|
897
|
-
disabled: { ...baseDisabled, backgroundColor: 'transparent', textDecoration: 'none' },
|
|
898
|
-
textColor: 'link',
|
|
899
|
-
},
|
|
900
|
-
};
|
|
901
|
-
};
|
|
902
|
-
|
|
903
799
|
/**
|
|
904
800
|
* Button component
|
|
905
801
|
*
|
|
@@ -925,7 +821,7 @@ const Button = ({ label, startIcon, endIcon, variant = 'contained', active = fal
|
|
|
925
821
|
};
|
|
926
822
|
Button.displayName = 'Button';
|
|
927
823
|
|
|
928
|
-
const getIconButtonSizeStyles
|
|
824
|
+
const getIconButtonSizeStyles = () => ({
|
|
929
825
|
small: {
|
|
930
826
|
size: BUTTON_SIZE - 8,
|
|
931
827
|
padding: 'xs',
|
|
@@ -944,8 +840,8 @@ const getIconButtonSizeStyles$1 = () => ({
|
|
|
944
840
|
});
|
|
945
841
|
|
|
946
842
|
const ICON_BUTTON_STYLES = createStyles((theme) => {
|
|
947
|
-
const variantStyles = getButtonVariantStyles
|
|
948
|
-
const sizeStyles = getIconButtonSizeStyles
|
|
843
|
+
const variantStyles = getButtonVariantStyles(theme);
|
|
844
|
+
const sizeStyles = getIconButtonSizeStyles();
|
|
949
845
|
return {
|
|
950
846
|
root: ({ variant = 'contained', active = false, size = 'medium', textColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor }) => {
|
|
951
847
|
const sizeConfig = sizeStyles[size];
|
|
@@ -989,24 +885,6 @@ const ICON_BUTTON_STYLES = createStyles((theme) => {
|
|
|
989
885
|
};
|
|
990
886
|
});
|
|
991
887
|
|
|
992
|
-
const getIconButtonSizeStyles = () => ({
|
|
993
|
-
small: {
|
|
994
|
-
size: BUTTON_SIZE - 8,
|
|
995
|
-
padding: 'xs',
|
|
996
|
-
iconSize: 'md'
|
|
997
|
-
},
|
|
998
|
-
medium: {
|
|
999
|
-
size: BUTTON_SIZE,
|
|
1000
|
-
padding: 'sm',
|
|
1001
|
-
iconSize: 'lg'
|
|
1002
|
-
},
|
|
1003
|
-
large: {
|
|
1004
|
-
size: BUTTON_SIZE + 8,
|
|
1005
|
-
padding: 'sm',
|
|
1006
|
-
iconSize: 'xl'
|
|
1007
|
-
}
|
|
1008
|
-
});
|
|
1009
|
-
|
|
1010
888
|
/**
|
|
1011
889
|
* IconButton component
|
|
1012
890
|
*
|
|
@@ -1030,8 +908,8 @@ const IconButton = ({ icon, variant = 'contained', active = false, type = 'butto
|
|
|
1030
908
|
IconButton.displayName = 'IconButton';
|
|
1031
909
|
|
|
1032
910
|
const BUTTON_TOGGLE_STYLES = createStyles((theme) => {
|
|
1033
|
-
const variantStyles = getButtonVariantStyles
|
|
1034
|
-
const sizeStyles = getIconButtonSizeStyles
|
|
911
|
+
const variantStyles = getButtonVariantStyles(theme);
|
|
912
|
+
const sizeStyles = getIconButtonSizeStyles();
|
|
1035
913
|
const textVariant = variantStyles.text;
|
|
1036
914
|
return {
|
|
1037
915
|
root: ({ active = false, size = 'medium', activeTextColor = 'primary', inactiveTextColor = 'textSecondary', textColor, backgroundColor, hoverBackgroundColor, activeBackgroundColor }) => {
|