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