@selfdecode/sd-component-library 2.42.27 → 2.42.31

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.
Files changed (25) hide show
  1. package/lib/269d4dbd2027234c18668478378a32a4.svg +3 -0
  2. package/lib/components/complex/navbar/partials/navbar-v2/partials/interfaces.d.ts +16 -0
  3. package/lib/components/complex/navbar/partials/navbar-v2/partials/navbar-mobile-v2/partials/navbar-mobile-unfolded-navigation/interfaces.d.ts +1 -1
  4. package/lib/components/complex/navbar/partials/navbar-v2/presentational/interfaces.d.ts +4 -0
  5. package/lib/components/complex/navbar/presentational/constants-v3.d.ts +1 -0
  6. package/lib/components/complex/navbar/presentational/interfaces.d.ts +12 -0
  7. package/lib/components/complex/navbar/presentational/language-mapping.d.ts +1 -0
  8. package/lib/components/icons/globe-icon/globe.svg +3 -0
  9. package/lib/components/icons/globe-icon/index.d.ts +1 -0
  10. package/lib/components/icons/index.d.ts +7 -6
  11. package/lib/components/tabs/tab-bar/partials/tab/interfaces.d.ts +5 -1
  12. package/lib/components/tabs/tab-bar/partials/tab/tab.d.ts +1 -1
  13. package/lib/components/tabs/tabbed-view/interfaces.d.ts +5 -1
  14. package/lib/components/tabs/tabbed-view/tabbed-view.d.ts +1 -1
  15. package/lib/components/texts/base-text/index.d.ts +1 -2
  16. package/lib/components/texts/base-text/interfaces.d.ts +5 -1
  17. package/lib/components/texts/no-translate/index.d.ts +1 -0
  18. package/lib/components/texts/no-translate/no-translate.d.ts +3 -0
  19. package/lib/components/texts/responsive-text/interfaces.d.ts +1 -1
  20. package/lib/components/tooltips/react-element-tooltip/index.d.ts +1 -0
  21. package/lib/components/tooltips/react-element-tooltip/interfaces.d.ts +17 -0
  22. package/lib/components/tooltips/react-element-tooltip/react-element-tooltip.d.ts +7 -0
  23. package/lib/index.d.ts +1 -0
  24. package/lib/index.js +1 -1
  25. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
2
+ <path id="Icon_material-language" data-name="Icon material-language" d="M12.99,3A10,10,0,1,0,23,13,10,10,0,0,0,12.99,3Zm6.93,6H16.97a15.649,15.649,0,0,0-1.38-3.56A8.03,8.03,0,0,1,19.92,9ZM13,5.04A14.087,14.087,0,0,1,14.91,9H11.09A14.087,14.087,0,0,1,13,5.04ZM5.26,15a7.822,7.822,0,0,1,0-4H8.64a16.515,16.515,0,0,0-.14,2,16.515,16.515,0,0,0,.14,2Zm.82,2H9.03a15.649,15.649,0,0,0,1.38,3.56A7.987,7.987,0,0,1,6.08,17ZM9.03,9H6.08a7.987,7.987,0,0,1,4.33-3.56A15.649,15.649,0,0,0,9.03,9ZM13,20.96A14.087,14.087,0,0,1,11.09,17h3.82A14.087,14.087,0,0,1,13,20.96ZM15.34,15H10.66a14.713,14.713,0,0,1-.16-2,14.585,14.585,0,0,1,.16-2h4.68a14.585,14.585,0,0,1,.16,2A14.713,14.713,0,0,1,15.34,15Zm.25,5.56A15.649,15.649,0,0,0,16.97,17h2.95a8.03,8.03,0,0,1-4.33,3.56ZM17.36,15a16.515,16.515,0,0,0,.14-2,16.515,16.515,0,0,0-.14-2h3.38a7.822,7.822,0,0,1,0,4Z" transform="translate(-3 -3)" />
3
+ </svg>
@@ -4,6 +4,10 @@ export declare type NavItem = {
4
4
  * The text to be shown in the link
5
5
  */
6
6
  title: string;
7
+ /**
8
+ * Optional mobile title
9
+ */
10
+ mobileTitle?: string;
7
11
  /**
8
12
  * The links that should be displayed when:
9
13
  * - in desktop view, the user hovers this NavItem
@@ -22,6 +26,14 @@ export declare type NavItem = {
22
26
  * An SVG Component to be placed to the left of the title
23
27
  */
24
28
  Icon?: FC<SVGProps<SVGSVGElement>>;
29
+ /**
30
+ * Whether or not to hide arrow
31
+ */
32
+ hideArrow?: boolean;
33
+ /**
34
+ * Whether to include icon in mobile navbar menu
35
+ */
36
+ mobileShowIcon?: boolean;
25
37
  };
26
38
  export declare type NavMenuItem = {
27
39
  /**
@@ -59,4 +71,8 @@ export declare type NavMenuItem = {
59
71
  * What to do instead of redirecting to a url.
60
72
  */
61
73
  onClick?: () => void;
74
+ /**
75
+ * Whether item is currenly selected (and hence should be highlighted)
76
+ */
77
+ isSelected?: boolean;
62
78
  };
@@ -2,7 +2,7 @@ import { NavbarMobileV2PresentationalProps } from "../../presentational/interfac
2
2
  /**
3
3
  * Defines the NavigationUnfolded component's properties.
4
4
  */
5
- export declare type NavbarMobileUnfoldedNavigationProps = Pick<NavbarMobileV2PresentationalProps, "itemsInCart" | "onClickCartIcon" | "unsubscribedUser" | "accountNavItem" | "navItems" | "hideSearch"> & {
5
+ export declare type NavbarMobileUnfoldedNavigationProps = Pick<NavbarMobileV2PresentationalProps, "itemsInCart" | "onClickCartIcon" | "unsubscribedUser" | "accountNavItem" | "navItems" | "hideSearch" | "languageNavItem"> & {
6
6
  /**
7
7
  * Callback function to be called when the X icon button is clicked
8
8
  */
@@ -18,4 +18,8 @@ export declare type NavbarV2PresentationalProps = Pick<NavbarProps, "history" |
18
18
  * rendered when hovering on the PersonalAreaItem component
19
19
  */
20
20
  accountNavItem: NavItem;
21
+ /**
22
+ * A language selector item
23
+ */
24
+ languageNavItem: NavItem;
21
25
  };
@@ -2,3 +2,4 @@ import { NavItem } from "../partials/navbar-v2/partials/interfaces";
2
2
  export declare const geneticsNavItem: NavItem;
3
3
  export declare const labsNavItem: NavItem;
4
4
  export declare const getMyAccountNavItem: (isPractitioner: boolean, onLogout?: (() => void) | undefined) => NavItem;
5
+ export declare const getLanguageNavItem: (selectedLangCode: string, langCodes: string[], onLanguageSwitch: (langCode: string) => void) => NavItem;
@@ -87,4 +87,16 @@ export declare type NavbarProps = {
87
87
  * }
88
88
  */
89
89
  onLogout?: () => void;
90
+ /**
91
+ * User current selected language code
92
+ */
93
+ selectedLangCode: string;
94
+ /**
95
+ * List of selectable language codes
96
+ */
97
+ langCodes: string[];
98
+ /**
99
+ * What to do on language switch
100
+ */
101
+ onLanguageSwitch: (langCode: string) => void;
90
102
  };
@@ -0,0 +1 @@
1
+ export declare const getNativeLanguageName: (langCode: string) => string | undefined;
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
2
+ <path id="Icon_material-language" data-name="Icon material-language" d="M12.99,3A10,10,0,1,0,23,13,10,10,0,0,0,12.99,3Zm6.93,6H16.97a15.649,15.649,0,0,0-1.38-3.56A8.03,8.03,0,0,1,19.92,9ZM13,5.04A14.087,14.087,0,0,1,14.91,9H11.09A14.087,14.087,0,0,1,13,5.04ZM5.26,15a7.822,7.822,0,0,1,0-4H8.64a16.515,16.515,0,0,0-.14,2,16.515,16.515,0,0,0,.14,2Zm.82,2H9.03a15.649,15.649,0,0,0,1.38,3.56A7.987,7.987,0,0,1,6.08,17ZM9.03,9H6.08a7.987,7.987,0,0,1,4.33-3.56A15.649,15.649,0,0,0,9.03,9ZM13,20.96A14.087,14.087,0,0,1,11.09,17h3.82A14.087,14.087,0,0,1,13,20.96ZM15.34,15H10.66a14.713,14.713,0,0,1-.16-2,14.585,14.585,0,0,1,.16-2h4.68a14.585,14.585,0,0,1,.16,2A14.713,14.713,0,0,1,15.34,15Zm.25,5.56A15.649,15.649,0,0,0,16.97,17h2.95a8.03,8.03,0,0,1-4.33,3.56ZM17.36,15a16.515,16.515,0,0,0,.14-2,16.515,16.515,0,0,0-.14-2h3.38a7.822,7.822,0,0,1,0,4Z" transform="translate(-3 -3)" />
3
+ </svg>
@@ -0,0 +1 @@
1
+ export { ReactComponent as GlobeIcon } from "./globe.svg";
@@ -1,17 +1,18 @@
1
+ export { BorderedPlainWarningCircleIcon } from "./bordered-plain-warning-circle-icon";
1
2
  export { CartIcon } from "./cart-icon";
2
3
  export { CrossIcon } from "./cross-icon";
3
4
  export { GeneticsIcon } from "./genetics-icon";
5
+ export { GlobeIcon } from "./globe-icon";
4
6
  export { HamburgerIcon } from "./hamburger-icon";
7
+ export { PlainWarningCircleIcon } from "./plain-warning-circle-icon";
5
8
  export { ProfileIcon } from "./profile-icon";
9
+ export { RescanIcon } from "./rescan-icon";
10
+ export { RoundBorderedStar } from "./round-bordered-star";
6
11
  export { SDLogoNoTextIcon } from "./sd-logo-no-text-icon";
7
12
  export { SDLogoWhiteIcon } from "./sd-logo-white-icon";
13
+ export { SDNavbarIcon } from "./sd-navbar-icon";
8
14
  export { SearchIcon } from "./search-icon";
9
15
  export { ShortDownArrowIcon } from "./short-dropdown-arrow-icon";
10
- export { VialIcon } from "./vial-icon";
11
- export { RescanIcon } from "./rescan-icon";
12
- export { SDNavbarIcon } from "./sd-navbar-icon";
13
16
  export { StarIcon } from "./star-icon";
17
+ export { VialIcon } from "./vial-icon";
14
18
  export { WarningCircleIcon } from "./warning-circle-icon";
15
- export { BorderedPlainWarningCircleIcon } from "./bordered-plain-warning-circle-icon";
16
- export { PlainWarningCircleIcon } from "./plain-warning-circle-icon";
17
- export { RoundBorderedStar } from "./round-bordered-star";
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  export interface TabProps<T> {
3
3
  /**
4
4
  * Tab width.
@@ -56,4 +56,8 @@ export interface TabProps<T> {
56
56
  * Color of the ribbon in active state.
57
57
  */
58
58
  activeRibbonColor?: string;
59
+ /**
60
+ * Provide a custom component to render instead of label/icon
61
+ */
62
+ tabHeaderComponent?: React.ReactNode;
59
63
  }
@@ -4,4 +4,4 @@ export declare const Ribbon: ({ active, activeColor }: {
4
4
  active?: boolean | undefined;
5
5
  activeColor?: string | undefined;
6
6
  }) => JSX.Element;
7
- export declare function Tab<T>({ width, label, secondaryText, icon, id, onClick, selected, activeColor, color, tabPadding, bg, activeBg, activeRibbonColor, borderRadius, }: TabProps<T>): JSX.Element;
7
+ export declare function Tab<T>({ width, label, secondaryText, icon, id, onClick, selected, activeColor, color, tabPadding, bg, activeBg, activeRibbonColor, borderRadius, tabHeaderComponent, }: TabProps<T>): JSX.Element;
@@ -4,7 +4,7 @@ import { TabProps } from "../tab-bar/partials/tab/interfaces";
4
4
  /**
5
5
  * Configuration for each tab and the corresponding view
6
6
  */
7
- export interface TabViewConfig extends Pick<TabProps<string>, "label" | "width" | "color" | "activeColor" | "bg" | "activeBg" | "borderRadius" | "activeRibbonColor"> {
7
+ export interface TabViewConfig extends Pick<TabProps<string>, "label" | "width" | "color" | "activeColor" | "bg" | "activeBg" | "borderRadius" | "activeRibbonColor" | "tabHeaderComponent"> {
8
8
  /**
9
9
  * Component to be rendered when the tab is active
10
10
  */
@@ -30,4 +30,8 @@ export interface TabbedViewProps<ThemeType extends Theme = RequiredTheme> {
30
30
  * Padding around the content
31
31
  */
32
32
  contentPadding?: ResponsiveValue<number | string, ThemeType>;
33
+ /**
34
+ * Padding of each tab to be set up externally
35
+ */
36
+ tabPadding?: string[];
33
37
  }
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { TabbedViewProps } from "./interfaces";
3
- export declare function TabbedView({ tabs, color, activeColor, contentPadding, }: TabbedViewProps): JSX.Element;
3
+ export declare function TabbedView({ tabs, color, activeColor, contentPadding, tabPadding, }: TabbedViewProps): JSX.Element;
@@ -1,3 +1,2 @@
1
- import { BaseTextProps as Props } from "./interfaces";
2
1
  export { BaseText } from "./base-text";
3
- export declare type BaseTextProps = Props;
2
+ export type { BaseTextProps } from "./interfaces";
@@ -12,7 +12,11 @@ interface CommonBaseTextProps extends Pick<BaseComponentProps, "m" | "mt" | "mr"
12
12
  /**
13
13
  * The width of the text component
14
14
  */
15
- width?: Array<string>;
15
+ width?: string | string[];
16
+ /**
17
+ * The height of the text component
18
+ */
19
+ height?: string | string[];
16
20
  /**
17
21
  * The color of the text
18
22
  */
@@ -0,0 +1 @@
1
+ export { NoTranslate } from "./no-translate";
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { TextProps } from "rebass";
3
+ export declare const NoTranslate: (props: TextProps) => JSX.Element;
@@ -2,7 +2,7 @@ import { BaseTextProps } from "../base-text";
2
2
  /**
3
3
  * Props we want from the base text.
4
4
  */
5
- declare type PropsFromBaseText = Pick<BaseTextProps, "children" | "color" | "display" | "cursor" | "textAlign" | "textDecoration" | "textTransform" | "letterSpacing" | "lineHeight" | "backgroundColor" | "width" | "onClick" | "m" | "mt" | "mr" | "mb" | "ml">;
5
+ declare type PropsFromBaseText = Pick<BaseTextProps, "children" | "color" | "display" | "cursor" | "textAlign" | "textDecoration" | "textTransform" | "letterSpacing" | "lineHeight" | "backgroundColor" | "width" | "height" | "onClick" | "m" | "mt" | "mr" | "mb" | "ml">;
6
6
  /**
7
7
  * SelfDecode's combinations of fontSize and fontWeight.
8
8
  */
@@ -0,0 +1 @@
1
+ export { ReactElementTooltip } from "./react-element-tooltip";
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { BaseInfoTooltipProps } from "../base-info-tooltip";
3
+ /**
4
+ * Additional props we want to add
5
+ */
6
+ declare type SameProps = Partial<BaseInfoTooltipProps>;
7
+ export interface ReactElementTooltipProps extends SameProps {
8
+ /**
9
+ * Only this prop is required
10
+ */
11
+ children: React.ReactNode;
12
+ /**
13
+ * Limit the width, if it overflows
14
+ */
15
+ maxWidth?: string;
16
+ }
17
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { BoxProps } from "rebass";
3
+ import { ReactElementTooltipProps } from "./interfaces";
4
+ /**
5
+ * PrimaryInfoTooltip component.
6
+ */
7
+ export declare const ReactElementTooltip: React.ForwardRefExoticComponent<ReactElementTooltipProps & React.RefAttributes<React.FC<BoxProps>>>;
package/lib/index.d.ts CHANGED
@@ -173,6 +173,7 @@ export { BaseInfoTooltip } from "./components/tooltips/base-info-tooltip";
173
173
  export { PrimaryInfoTooltip } from "./components/tooltips/primary-info-tooltip";
174
174
  export { StarTooltip } from "./components/tooltips/star-tooltip";
175
175
  export { RadioInfoButtonTooltip } from "./components/tooltips/radio-info-button-tooltip";
176
+ export { ReactElementTooltip } from "./components/tooltips/react-element-tooltip";
176
177
  export { Footer } from "./components/complex/footer";
177
178
  export { Navbar } from "./components/complex/navbar";
178
179
  export { Anchor } from "./components/utils/anchor";