@telia/teddy 0.0.16 → 0.0.17
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/components/badge/badge.js +2 -2
- package/dist/components/card/card.d.ts +6 -0
- package/dist/components/card/card.js +27 -20
- package/dist/style.css +45 -41
- package/dist/utils/layout/index.d.ts +1863 -0
- package/dist/utils/layout/index.js +1 -0
- package/package.json +15 -14
|
@@ -27,12 +27,12 @@ function getIcon(variant) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
const Badge = React__default.forwardRef(
|
|
30
|
-
({ className, variant, asChild, children, ...props }, forwardRef) => {
|
|
30
|
+
({ className, variant, hideIcon, asChild, children, ...props }, forwardRef) => {
|
|
31
31
|
const classes = clsx([styles[`${rootClassName}`]], [styles[`${rootClassName}--${variant}`]], className);
|
|
32
32
|
const Comp = asChild ? Slot : "span";
|
|
33
33
|
const iconName = getIcon(variant);
|
|
34
34
|
return /* @__PURE__ */ jsxs(Comp, { ...props, ref: forwardRef, className: classes, children: [
|
|
35
|
-
!
|
|
35
|
+
!hideIcon && iconName && /* @__PURE__ */ jsx(Icon, { name: iconName }),
|
|
36
36
|
/* @__PURE__ */ jsx(Slottable, { children })
|
|
37
37
|
] });
|
|
38
38
|
}
|
|
@@ -45,6 +45,10 @@ type ButtonProps = Omit<React.ComponentPropsWithoutRef<typeof PrimitiveButton>,
|
|
|
45
45
|
* Link
|
|
46
46
|
* -----------------------------------------------------------------------------------------------*/
|
|
47
47
|
type LinkProps = React.ComponentPropsWithoutRef<typeof PrimitiveLink>;
|
|
48
|
+
/** -------------------------------------------------------------------------------------------------
|
|
49
|
+
* Line
|
|
50
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
51
|
+
type LineProps = Omit<React.ComponentPropsWithoutRef<typeof Box>, 'asChild' | 'as' | 'children'>;
|
|
48
52
|
declare const Card: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLDivElement>> & {
|
|
49
53
|
Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
54
|
Heading: React.ForwardRefExoticComponent<HeadingProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
@@ -82,6 +86,7 @@ declare const Card: React.ForwardRefExoticComponent<RootProps & React.RefAttribu
|
|
|
82
86
|
variant: "text" | "navigation" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
|
|
83
87
|
} & React.RefAttributes<HTMLAnchorElement>, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
84
88
|
Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLDivElement>>;
|
|
89
|
+
Line: React.ForwardRefExoticComponent<LineProps & React.RefAttributes<HTMLDivElement>>;
|
|
85
90
|
variantOptions: readonly ["purple-light", "purple-dark", "gray", "white", "beige"];
|
|
86
91
|
insetOptions: readonly ["top", "bottom", "left", "right", "all", "top-right-left", "bottom-left-right", "top-left", "top-right", "bottom-left", "bottom-right", "top-bottom", "left-right"];
|
|
87
92
|
};
|
|
@@ -93,6 +98,7 @@ type CardProps = {
|
|
|
93
98
|
Image: ImageProps;
|
|
94
99
|
Slot: SlotProps;
|
|
95
100
|
Link: LinkProps;
|
|
101
|
+
Line: LineProps;
|
|
96
102
|
};
|
|
97
103
|
export { Card };
|
|
98
104
|
export type { CardProps };
|
|
@@ -9,27 +9,29 @@ import { Heading as Heading$1 } from "../heading/heading.js";
|
|
|
9
9
|
import { Button as Button$1 } from "../button/button.js";
|
|
10
10
|
import { Link as Link$1 } from "../link/link.js";
|
|
11
11
|
import { TextSpacing } from "../text-spacing/text-spacing.js";
|
|
12
|
+
import { teddySpacing50 } from "../../tokens/spacing/variables.js";
|
|
12
13
|
const styles = {
|
|
13
|
-
"teddy-card": "_teddy-
|
|
14
|
-
"teddy-card__slot": "_teddy-
|
|
15
|
-
"teddy-card__slot--bottom": "_teddy-card__slot--
|
|
16
|
-
"teddy-card__slot--center": "_teddy-card__slot--
|
|
17
|
-
"teddy-card__action": "_teddy-
|
|
18
|
-
"teddy-card__action--disabled": "_teddy-card__action--
|
|
19
|
-
"teddy-card--border": "_teddy-card--
|
|
20
|
-
"teddy-
|
|
21
|
-
"teddy-card--purple-
|
|
22
|
-
"teddy-card--
|
|
23
|
-
"teddy-card--
|
|
24
|
-
"teddy-card--
|
|
25
|
-
"teddy-
|
|
26
|
-
"teddy-
|
|
27
|
-
"teddy-
|
|
28
|
-
"teddy-
|
|
29
|
-
"teddy-card__image
|
|
30
|
-
"teddy-card__image--inset-
|
|
31
|
-
"teddy-card__image--inset-
|
|
32
|
-
"teddy-card__image--inset-
|
|
14
|
+
"teddy-card": "_teddy-card_1h4hf_3",
|
|
15
|
+
"teddy-card__slot": "_teddy-card__slot_1h4hf_13",
|
|
16
|
+
"teddy-card__slot--bottom": "_teddy-card__slot--bottom_1h4hf_16",
|
|
17
|
+
"teddy-card__slot--center": "_teddy-card__slot--center_1h4hf_19",
|
|
18
|
+
"teddy-card__action": "_teddy-card__action_1h4hf_40",
|
|
19
|
+
"teddy-card__action--disabled": "_teddy-card__action--disabled_1h4hf_40",
|
|
20
|
+
"teddy-card--border": "_teddy-card--border_1h4hf_46",
|
|
21
|
+
"teddy-card__line": "_teddy-card__line_1h4hf_49",
|
|
22
|
+
"teddy-card--purple-light": "_teddy-card--purple-light_1h4hf_53",
|
|
23
|
+
"teddy-card--purple-dark": "_teddy-card--purple-dark_1h4hf_67",
|
|
24
|
+
"teddy-card--white": "_teddy-card--white_1h4hf_86",
|
|
25
|
+
"teddy-card--gray": "_teddy-card--gray_1h4hf_100",
|
|
26
|
+
"teddy-card--beige": "_teddy-card--beige_1h4hf_114",
|
|
27
|
+
"teddy-card__image--as-background": "_teddy-card__image--as-background_1h4hf_128",
|
|
28
|
+
"teddy-card__heading": "_teddy-card__heading_1h4hf_131",
|
|
29
|
+
"teddy-card--background-image": "_teddy-card--background-image_1h4hf_134",
|
|
30
|
+
"teddy-card__image": "_teddy-card__image_1h4hf_128",
|
|
31
|
+
"teddy-card__image--inset-top": "_teddy-card__image--inset-top_1h4hf_149",
|
|
32
|
+
"teddy-card__image--inset-bottom": "_teddy-card__image--inset-bottom_1h4hf_152",
|
|
33
|
+
"teddy-card__image--inset-left": "_teddy-card__image--inset-left_1h4hf_155",
|
|
34
|
+
"teddy-card__image--inset-right": "_teddy-card__image--inset-right_1h4hf_158"
|
|
33
35
|
};
|
|
34
36
|
const rootClassName = "teddy-card";
|
|
35
37
|
const actionElementIdentifier = `${rootClassName}__action`;
|
|
@@ -188,6 +190,10 @@ const Link = React__default.forwardRef(
|
|
|
188
190
|
}
|
|
189
191
|
);
|
|
190
192
|
Link.displayName = "Card.Link";
|
|
193
|
+
const Line = React__default.forwardRef(({ className, ...props }, forwardRef) => {
|
|
194
|
+
const classes = clsx([styles[`${rootClassName}__line`]], className);
|
|
195
|
+
return /* @__PURE__ */ jsx(Box, { width: "100%", p: "0", m: `${teddySpacing50} 0`, ...props, ref: forwardRef, className: classes, asChild: true, children: /* @__PURE__ */ jsx("hr", {}) });
|
|
196
|
+
});
|
|
191
197
|
const Card = Object.assign(Root, {
|
|
192
198
|
Root,
|
|
193
199
|
Heading,
|
|
@@ -196,6 +202,7 @@ const Card = Object.assign(Root, {
|
|
|
196
202
|
Button,
|
|
197
203
|
Link,
|
|
198
204
|
Slot,
|
|
205
|
+
Line,
|
|
199
206
|
variantOptions,
|
|
200
207
|
insetOptions
|
|
201
208
|
});
|
package/dist/style.css
CHANGED
|
@@ -658,29 +658,29 @@
|
|
|
658
658
|
margin-bottom: 0;
|
|
659
659
|
}@layer heading, button, card;
|
|
660
660
|
@layer card {
|
|
661
|
-
._teddy-
|
|
661
|
+
._teddy-card_1h4hf_3 {
|
|
662
662
|
border-radius: var(--teddy-border-radius-md);
|
|
663
663
|
padding: var(--teddy-spacing-250);
|
|
664
664
|
position: relative;
|
|
665
665
|
}
|
|
666
666
|
@media (prefers-reduced-motion: no-preference) {
|
|
667
|
-
._teddy-
|
|
667
|
+
._teddy-card_1h4hf_3 {
|
|
668
668
|
transition: background-color var(--teddy-motion-duration-300) ease;
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
|
-
._teddy-
|
|
671
|
+
._teddy-card__slot_1h4hf_13 {
|
|
672
672
|
transform: translateY(-50%);
|
|
673
673
|
}
|
|
674
|
-
._teddy-card__slot--
|
|
674
|
+
._teddy-card__slot--bottom_1h4hf_16 {
|
|
675
675
|
transform: translateY(50%);
|
|
676
676
|
}
|
|
677
|
-
._teddy-card__slot--
|
|
677
|
+
._teddy-card__slot--center_1h4hf_19 {
|
|
678
678
|
transform: translate(-50%, -50%);
|
|
679
679
|
}
|
|
680
|
-
._teddy-card__slot--
|
|
680
|
+
._teddy-card__slot--bottom_1h4hf_16._teddy-card__slot--center_1h4hf_19 {
|
|
681
681
|
transform: translate(-50%, 50%);
|
|
682
682
|
}
|
|
683
|
-
._teddy-
|
|
683
|
+
._teddy-card_1h4hf_3::before {
|
|
684
684
|
content: "";
|
|
685
685
|
display: block;
|
|
686
686
|
position: absolute;
|
|
@@ -691,106 +691,110 @@
|
|
|
691
691
|
box-shadow: var(--teddy-shadow-md);
|
|
692
692
|
}
|
|
693
693
|
@media (prefers-reduced-motion: no-preference) {
|
|
694
|
-
._teddy-
|
|
694
|
+
._teddy-card_1h4hf_3::before {
|
|
695
695
|
transition: opacity var(--teddy-motion-duration-300) ease;
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
._teddy-
|
|
698
|
+
._teddy-card_1h4hf_3:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
699
699
|
cursor: pointer;
|
|
700
700
|
}
|
|
701
|
-
._teddy-
|
|
701
|
+
._teddy-card_1h4hf_3:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)):hover:not(:has(button:hover), :has(a:hover))::before, ._teddy-card_1h4hf_3:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)):has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40))::before {
|
|
702
702
|
opacity: 1;
|
|
703
703
|
}
|
|
704
|
-
._teddy-card--
|
|
704
|
+
._teddy-card--border_1h4hf_46 {
|
|
705
705
|
border: var(--teddy-border-width-xs) solid transparent;
|
|
706
706
|
}
|
|
707
|
-
._teddy-
|
|
707
|
+
._teddy-card__line_1h4hf_49 {
|
|
708
|
+
border: 0;
|
|
709
|
+
border-top: var(--teddy-border-width-xs) solid var(--teddy-color-border-weak);
|
|
710
|
+
}
|
|
711
|
+
._teddy-card--purple-light_1h4hf_53 {
|
|
708
712
|
background-color: var(--teddy-color-background-interactive-primary-negative);
|
|
709
713
|
color: var(--teddy-color-text-default);
|
|
710
714
|
border-color: var(--teddy-color-background-interactive-primary-negative);
|
|
711
715
|
}
|
|
712
|
-
._teddy-card--purple-
|
|
716
|
+
._teddy-card--purple-light_1h4hf_53:hover:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
713
717
|
background-color: var(--teddy-color-background-interactive-primary-negative-hover);
|
|
714
718
|
}
|
|
715
|
-
._teddy-card--purple-
|
|
719
|
+
._teddy-card--purple-light_1h4hf_53:active:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
716
720
|
background-color: var(--teddy-color-background-interactive-primary-negative-active);
|
|
717
721
|
}
|
|
718
|
-
._teddy-card--purple-
|
|
722
|
+
._teddy-card--purple-light_1h4hf_53:has(._teddy-card__action--disabled_1h4hf_40) {
|
|
719
723
|
background-color: var(--teddy-color-background-interactive-disabled);
|
|
720
724
|
}
|
|
721
|
-
._teddy-card--purple-
|
|
725
|
+
._teddy-card--purple-dark_1h4hf_67 {
|
|
722
726
|
background-color: var(--teddy-color-brand-deep-purple);
|
|
723
727
|
color: var(--teddy-color-text-default-negative);
|
|
724
728
|
border-color: var(--teddy-color-brand-deep-purple);
|
|
725
729
|
}
|
|
726
|
-
._teddy-card--purple-
|
|
730
|
+
._teddy-card--purple-dark_1h4hf_67:hover:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
727
731
|
background-color: var(--teddy-color-background-interactive-transparent-negative-hover);
|
|
728
732
|
}
|
|
729
|
-
._teddy-card--purple-
|
|
733
|
+
._teddy-card--purple-dark_1h4hf_67:active:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
730
734
|
background-color: var(--teddy-color-background-interactive-transparent-negative-active);
|
|
731
735
|
}
|
|
732
|
-
._teddy-card--purple-
|
|
736
|
+
._teddy-card--purple-dark_1h4hf_67:has(._teddy-card__action--disabled_1h4hf_40) {
|
|
733
737
|
color: var(--teddy-color-text-default);
|
|
734
738
|
background-color: var(--teddy-color-background-interactive-disabled);
|
|
735
739
|
}
|
|
736
|
-
._teddy-card--purple-
|
|
740
|
+
._teddy-card--purple-dark_1h4hf_67:has(._teddy-card__action--disabled_1h4hf_40) ._teddy-card__action_1h4hf_40 {
|
|
737
741
|
color: var(--teddy-color-text-weak);
|
|
738
742
|
background-color: var(--teddy-color-background-interactive-disabled);
|
|
739
743
|
}
|
|
740
|
-
._teddy-card--
|
|
744
|
+
._teddy-card--white_1h4hf_86 {
|
|
741
745
|
background-color: var(--teddy-color-brand-white);
|
|
742
746
|
color: var(--teddy-color-text-default);
|
|
743
747
|
border-color: var(--teddy-color-border-interactive-subtle);
|
|
744
748
|
}
|
|
745
|
-
._teddy-card--
|
|
749
|
+
._teddy-card--white_1h4hf_86:hover:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
746
750
|
background-color: var(--teddy-color-background-interactive-transparent-hover);
|
|
747
751
|
}
|
|
748
|
-
._teddy-card--
|
|
752
|
+
._teddy-card--white_1h4hf_86:active:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
749
753
|
background-color: var(--teddy-color-background-interactive-transparent-active);
|
|
750
754
|
}
|
|
751
|
-
._teddy-card--
|
|
755
|
+
._teddy-card--white_1h4hf_86:has(._teddy-card__action--disabled_1h4hf_40) {
|
|
752
756
|
background-color: var(--teddy-color-background-interactive-disabled);
|
|
753
757
|
}
|
|
754
|
-
._teddy-card--
|
|
758
|
+
._teddy-card--gray_1h4hf_100 {
|
|
755
759
|
background-color: var(--teddy-color-background-secondary);
|
|
756
760
|
color: var(--teddy-color-text-default);
|
|
757
761
|
border-color: var(--teddy-color-border-interactive-subtle);
|
|
758
762
|
}
|
|
759
|
-
._teddy-card--
|
|
763
|
+
._teddy-card--gray_1h4hf_100:hover:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
760
764
|
background-color: var(--teddy-color-gray-100);
|
|
761
765
|
}
|
|
762
|
-
._teddy-card--
|
|
766
|
+
._teddy-card--gray_1h4hf_100:active:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
763
767
|
background-color: var(--teddy-color-gray-200);
|
|
764
768
|
}
|
|
765
|
-
._teddy-card--
|
|
769
|
+
._teddy-card--gray_1h4hf_100:has(._teddy-card__action--disabled_1h4hf_40) {
|
|
766
770
|
background-color: var(--teddy-color-background-interactive-disabled);
|
|
767
771
|
}
|
|
768
|
-
._teddy-card--
|
|
772
|
+
._teddy-card--beige_1h4hf_114 {
|
|
769
773
|
background-color: var(--teddy-color-beige-100);
|
|
770
774
|
color: var(--teddy-color-text-default);
|
|
771
775
|
border-color: var(--teddy-color-beige-300);
|
|
772
776
|
}
|
|
773
|
-
._teddy-card--
|
|
777
|
+
._teddy-card--beige_1h4hf_114:hover:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
774
778
|
background-color: var(--teddy-color-beige-200);
|
|
775
779
|
}
|
|
776
|
-
._teddy-card--
|
|
780
|
+
._teddy-card--beige_1h4hf_114:active:has(._teddy-card__action_1h4hf_40:not(._teddy-card__action--disabled_1h4hf_40)) {
|
|
777
781
|
background-color: var(--teddy-color-beige-300);
|
|
778
782
|
}
|
|
779
|
-
._teddy-card--
|
|
783
|
+
._teddy-card--beige_1h4hf_114:has(._teddy-card__action--disabled_1h4hf_40) {
|
|
780
784
|
background-color: var(--teddy-color-background-interactive-disabled);
|
|
781
785
|
}
|
|
782
|
-
._teddy-
|
|
786
|
+
._teddy-card_1h4hf_3:has(._teddy-card__image--as-background_1h4hf_128) {
|
|
783
787
|
background-color: transparent;
|
|
784
788
|
}
|
|
785
|
-
._teddy-
|
|
789
|
+
._teddy-card__heading_1h4hf_131 {
|
|
786
790
|
color: inherit;
|
|
787
791
|
}
|
|
788
|
-
._teddy-card--background-
|
|
792
|
+
._teddy-card--background-image_1h4hf_134 {
|
|
789
793
|
background-repeat: no-repeat;
|
|
790
794
|
background-size: cover;
|
|
791
795
|
background-position: center;
|
|
792
796
|
}
|
|
793
|
-
._teddy-
|
|
797
|
+
._teddy-card__image_1h4hf_128 {
|
|
794
798
|
height: auto;
|
|
795
799
|
vertical-align: middle;
|
|
796
800
|
font-style: italic;
|
|
@@ -800,19 +804,19 @@
|
|
|
800
804
|
border-radius: inherit;
|
|
801
805
|
padding-bottom: var(--teddy-spacing-200);
|
|
802
806
|
}
|
|
803
|
-
._teddy-card__image--inset-
|
|
807
|
+
._teddy-card__image--inset-top_1h4hf_149 {
|
|
804
808
|
margin-top: calc(var(--teddy-spacing-250) * -1);
|
|
805
809
|
}
|
|
806
|
-
._teddy-card__image--inset-
|
|
810
|
+
._teddy-card__image--inset-bottom_1h4hf_152 {
|
|
807
811
|
margin-bottom: calc(var(--teddy-spacing-250) * -1);
|
|
808
812
|
}
|
|
809
|
-
._teddy-card__image--inset-
|
|
813
|
+
._teddy-card__image--inset-left_1h4hf_155 {
|
|
810
814
|
margin-left: calc(var(--teddy-spacing-250) * -1);
|
|
811
815
|
}
|
|
812
|
-
._teddy-card__image--inset-
|
|
816
|
+
._teddy-card__image--inset-right_1h4hf_158 {
|
|
813
817
|
margin-right: calc(var(--teddy-spacing-250) * -1);
|
|
814
818
|
}
|
|
815
|
-
._teddy-card__image--inset-
|
|
819
|
+
._teddy-card__image--inset-left_1h4hf_155 ._teddy-card__image--inset-right_1h4hf_158 {
|
|
816
820
|
width: calc(100% + var(--teddy-spacing-250) * 2);
|
|
817
821
|
}
|
|
818
822
|
}@layer heading, button, card, notification;
|