@julseb-lib/react 0.0.16 → 0.0.20
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.cjs.js +87 -87
- package/dist/index.es.js +1831 -1876
- package/dist/index.umd.js +86 -86
- package/dist/lib/components/Accordion/AccordionButton.tsx +2 -2
- package/dist/lib/components/Accordion/AccordionContent.tsx +2 -2
- package/dist/lib/components/Autocomplete/Autocomplete.tsx +1 -1
- package/dist/lib/components/Breadcrumbs/BreadcrumbItem.tsx +2 -2
- package/dist/lib/components/Datepicker/Calendar.tsx +2 -2
- package/dist/lib/components/Datepicker/Datepicker.tsx +1 -1
- package/dist/lib/components/Footer/FooterLogo.tsx +2 -2
- package/dist/lib/components/Header/HeaderLogo.tsx +2 -2
- package/dist/lib/components/Header/HeaderNav.tsx +13 -18
- package/dist/lib/components/Header/HeaderNavLink.tsx +6 -2
- package/dist/lib/components/Header/HeaderSearch.tsx +2 -2
- package/dist/lib/components/Header/types.ts +0 -1
- package/dist/lib/components/Helmet/Helmet.tsx +2 -2
- package/dist/lib/components/Input/Input.tsx +1 -1
- package/dist/lib/components/InputComponents/components/InputButton.tsx +2 -2
- package/dist/lib/components/InputComponents/components/InputContainer.tsx +2 -2
- package/dist/lib/components/InputComponents/components/InputIcon.tsx +2 -2
- package/dist/lib/components/InputComponents/components/InputPrefix.tsx +2 -2
- package/dist/lib/components/InputComponents/components/InputRightContainer.tsx +2 -2
- package/dist/lib/components/InputComponents/components/InputSuffix.tsx +2 -2
- package/dist/lib/components/InputComponents/components/InputValidationHelper.tsx +5 -5
- package/dist/lib/components/InputComponents/components/InputValidationIcon.tsx +2 -2
- package/dist/lib/components/InputComponents/components/InputWrapper.tsx +2 -2
- package/dist/lib/components/InputComponents/types.ts +2 -13
- package/dist/lib/components/InputContainer/HelperBottom.tsx +96 -0
- package/dist/lib/components/InputContainer/InputContainer.tsx +12 -90
- package/dist/lib/components/InputContainer/styles.tsx +3 -3
- package/dist/lib/components/InputContainer/subtypes.ts +10 -0
- package/dist/lib/components/InputContainer/types.ts +2 -13
- package/dist/lib/components/InputCounter/InputCounter.tsx +1 -1
- package/dist/lib/components/InputImage/EmptyContainer.tsx +2 -2
- package/dist/lib/components/InputImage/HoverContainer.tsx +2 -2
- package/dist/lib/components/InputImage/InputImage.tsx +5 -3
- package/dist/lib/components/InputImage/types.ts +1 -0
- package/dist/lib/components/InputPhone/InputPhone.tsx +1 -1
- package/dist/lib/components/InputPin/InputPin.tsx +1 -1
- package/dist/lib/components/InputSlider/InputSlider.tsx +1 -1
- package/dist/lib/components/LibIcon/LibIcon.tsx +2 -2
- package/dist/lib/components/MarkdownEditor/MarkdownEditor.tsx +1 -1
- package/dist/lib/components/MarkdownEditor/MdEditorButtons/EditorButtonTitles.tsx +2 -2
- package/dist/lib/components/MarkdownEditor/MdEditorButtons/EditorButtons.tsx +2 -2
- package/dist/lib/components/PageLayout/PageLayout.tsx +2 -2
- package/dist/lib/components/ProgressCircle/Circle.tsx +2 -2
- package/dist/lib/components/ProgressCircle/Value.tsx +2 -2
- package/dist/lib/components/Rating/Rating.tsx +1 -1
- package/dist/lib/components/ResetScroll/ResetScroll.tsx +1 -1
- package/dist/lib/components/Select/Select.tsx +1 -1
- package/dist/lib/components/Slideshow/SlideshowButton.tsx +2 -2
- package/dist/lib/components/Slideshow/SlideshowPagination.tsx +2 -2
- package/dist/lib/components/Timepicker/Timepicker.tsx +1 -1
- package/dist/lib/types/component-items.ts +31 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { Plus, ChevronDown } from "../../icons"
|
|
|
8
8
|
import { StyledAccordionButton, StyledAccordionIcon } from "./styles"
|
|
9
9
|
import type { ILibAccordionButton } from "./subtypes"
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export const AccordionButton = ({
|
|
12
12
|
"data-testid": testid,
|
|
13
13
|
className,
|
|
14
14
|
variant = "basic",
|
|
@@ -16,7 +16,7 @@ export function AccordionButton({
|
|
|
16
16
|
isOpen,
|
|
17
17
|
setIsOpen,
|
|
18
18
|
title,
|
|
19
|
-
}: ILibAccordionButton) {
|
|
19
|
+
}: ILibAccordionButton) => {
|
|
20
20
|
const iconProps = {
|
|
21
21
|
"data-testid":
|
|
22
22
|
testid &&
|
|
@@ -5,13 +5,13 @@ import { capitalize } from "@julseb-lib/utils"
|
|
|
5
5
|
import { StyledAccordionContent } from "./styles"
|
|
6
6
|
import type { ILibAccordionContent } from "./subtypes"
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export const AccordionContent = ({
|
|
9
9
|
"data-testid": testid,
|
|
10
10
|
className,
|
|
11
11
|
children,
|
|
12
12
|
isOpen,
|
|
13
13
|
variant = "basic",
|
|
14
|
-
}: ILibAccordionContent) {
|
|
14
|
+
}: ILibAccordionContent) => {
|
|
15
15
|
return (
|
|
16
16
|
<StyledAccordionContent
|
|
17
17
|
data-testid={testid && `${testid}.AccordionContent`}
|
|
@@ -54,7 +54,7 @@ import type { ILibAutocomplete } from "./types"
|
|
|
54
54
|
* @prop label?: string
|
|
55
55
|
* @prop labelComment?: string
|
|
56
56
|
* @prop helper?: string
|
|
57
|
-
* @prop helperBottom?: string | { text: string; textColor?: Any color from the library; fontStyle?: CssFontStyle; icon?: string | JSX.Element; iconColor?: Any color from the library; iconSize?: number }
|
|
57
|
+
* @prop helperBottom?: string | { text: string => only if element is not defined; element: ReactChildren => only if text is not defined; textColor?: Any color from the library; fontStyle?: CssFontStyle; icon?: string | JSX.Element; iconColor?: Any color from the library; iconSize?: number }
|
|
58
58
|
* @prop validation?: { status: LibValidationStatus; message?: string; iconNotPassed?: LibIcon; iconNotPassedSize?: number; iconPassed?: LibIcon; iconPassedSize?: number; iconBaseUrl?: string }
|
|
59
59
|
* @prop iconBaseUrl?: string
|
|
60
60
|
* @prop inputBackground?: "light" | "dark"
|
|
@@ -4,12 +4,12 @@ import { Link } from "react-router-dom"
|
|
|
4
4
|
import { uuid } from "@julseb-lib/utils"
|
|
5
5
|
import type { ILibBreadcrumbItem } from "./subtypes"
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export const BreadcrumbItem = ({
|
|
8
8
|
"data-testid": testid,
|
|
9
9
|
className,
|
|
10
10
|
item,
|
|
11
11
|
index,
|
|
12
|
-
}: ILibBreadcrumbItem) {
|
|
12
|
+
}: ILibBreadcrumbItem) => {
|
|
13
13
|
if (item.to)
|
|
14
14
|
return (
|
|
15
15
|
<Link
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "./styles"
|
|
19
19
|
import type { ILibDatepicker } from "./types"
|
|
20
20
|
|
|
21
|
-
export
|
|
21
|
+
export const Calendar = ({
|
|
22
22
|
"data-testid": testid,
|
|
23
23
|
className,
|
|
24
24
|
minDate,
|
|
@@ -52,7 +52,7 @@ export function Calendar({
|
|
|
52
52
|
> & {
|
|
53
53
|
isOpen: boolean
|
|
54
54
|
setIsOpen: DispatchState<boolean>
|
|
55
|
-
}) {
|
|
55
|
+
}) => {
|
|
56
56
|
const [currentMonth, setCurrentMonth] = useState(new Date().getMonth())
|
|
57
57
|
const [currentYear, setCurrentYear] = useState(new Date().getFullYear())
|
|
58
58
|
|
|
@@ -41,7 +41,7 @@ import type { ILibDatepicker } from "./types"
|
|
|
41
41
|
* @prop label?: string
|
|
42
42
|
* @prop labelComment?: string
|
|
43
43
|
* @prop helper?: string
|
|
44
|
-
* @prop helperBottom?: string | { text: string; textColor?: Any color from the library; fontStyle?: CssFontStyle; icon?: string | JSX.Element; iconColor?: Any color from the library; iconSize?: number }
|
|
44
|
+
* @prop helperBottom?: string | { text: string => only if element is not defined; element: ReactChildren => only if text is not defined; textColor?: Any color from the library; fontStyle?: CssFontStyle; icon?: string | JSX.Element; iconColor?: Any color from the library; iconSize?: number }
|
|
45
45
|
* @prop validation?: { status: LibValidationStatus; message?: string; iconNotPassed?: LibIcon; iconNotPassedSize?: number; iconPassed?: LibIcon; iconPassedSize?: number; iconBaseUrl?: string }
|
|
46
46
|
* @prop iconBaseUrl?: string
|
|
47
47
|
* @prop inputBackground?: "light" | "dark"
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { LogoText, LogoImg } from "./styles"
|
|
4
4
|
import type { ILibFooterLogo } from "./subtypes"
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export const FooterLogo = ({
|
|
7
7
|
"data-testid": testid,
|
|
8
8
|
className,
|
|
9
9
|
logo,
|
|
10
|
-
}: ILibFooterLogo) {
|
|
10
|
+
}: ILibFooterLogo) => {
|
|
11
11
|
const { text, img, alt = "Logo", width = 100, height = 30 } = logo as any
|
|
12
12
|
|
|
13
13
|
if (text || typeof logo === "string")
|
|
@@ -4,13 +4,13 @@ import { Link } from "react-router-dom"
|
|
|
4
4
|
import { Logo, LogoImg } from "./styles"
|
|
5
5
|
import type { ILibHeaderLogo } from "./subtypes"
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export const HeaderLogo = ({
|
|
8
8
|
"data-testid": testid,
|
|
9
9
|
className,
|
|
10
10
|
logo,
|
|
11
11
|
children,
|
|
12
12
|
isOpen,
|
|
13
|
-
}: ILibHeaderLogo) {
|
|
13
|
+
}: ILibHeaderLogo) => {
|
|
14
14
|
const {
|
|
15
15
|
to = "/",
|
|
16
16
|
href,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*=============================================== HeaderNav ===============================================*/
|
|
2
2
|
|
|
3
|
-
import { useRef,
|
|
3
|
+
import { useRef, type ReactNode } from "react"
|
|
4
4
|
import classNames from "classnames"
|
|
5
5
|
import { uuid } from "@julseb-lib/utils"
|
|
6
6
|
import { useMaxWidth, useClickOutside } from "../../"
|
|
@@ -8,9 +8,9 @@ import { HeaderNavLink } from "./HeaderNavLink"
|
|
|
8
8
|
import { HeaderSearch } from "./HeaderSearch"
|
|
9
9
|
import { Nav } from "./styles"
|
|
10
10
|
import type { ILibHeaderNav } from "./subtypes"
|
|
11
|
-
import { LibHeaderLink } from "../../types"
|
|
11
|
+
import type { LibHeaderLink } from "../../types"
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export const HeaderNav = ({
|
|
14
14
|
"data-testid": testid,
|
|
15
15
|
className,
|
|
16
16
|
search,
|
|
@@ -24,7 +24,7 @@ export function HeaderNav({
|
|
|
24
24
|
burgerRef,
|
|
25
25
|
handleClose,
|
|
26
26
|
nav,
|
|
27
|
-
}: ILibHeaderNav) {
|
|
27
|
+
}: ILibHeaderNav) => {
|
|
28
28
|
const isMobile = useMaxWidth(600)
|
|
29
29
|
|
|
30
30
|
const el = useRef<HTMLDivElement>(null)
|
|
@@ -64,20 +64,15 @@ export function HeaderNav({
|
|
|
64
64
|
/>
|
|
65
65
|
)}
|
|
66
66
|
|
|
67
|
-
{links
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
key={uuid()}
|
|
77
|
-
/>
|
|
78
|
-
)
|
|
79
|
-
)
|
|
80
|
-
: null}
|
|
67
|
+
{links &&
|
|
68
|
+
links.map(link => (
|
|
69
|
+
<HeaderNavLink
|
|
70
|
+
data-testid={testid}
|
|
71
|
+
className={className}
|
|
72
|
+
link={link as LibHeaderLink | JSX.Element}
|
|
73
|
+
key={uuid()}
|
|
74
|
+
/>
|
|
75
|
+
))}
|
|
81
76
|
|
|
82
77
|
{children && children}
|
|
83
78
|
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
/*=============================================== HeaderNavLink ===============================================*/
|
|
2
3
|
|
|
4
|
+
import { isValidElement } from "react"
|
|
3
5
|
import { NavLink } from "react-router-dom"
|
|
4
6
|
import type { ILibHeaderNavLink } from "./subtypes"
|
|
5
7
|
|
|
6
|
-
export
|
|
8
|
+
export const HeaderNavLink = ({
|
|
7
9
|
"data-testid": testid,
|
|
8
10
|
link,
|
|
9
11
|
className,
|
|
10
|
-
}: ILibHeaderNavLink) {
|
|
12
|
+
}: ILibHeaderNavLink) => {
|
|
13
|
+
if (isValidElement(link)) return link
|
|
14
|
+
|
|
11
15
|
if (link.to)
|
|
12
16
|
return (
|
|
13
17
|
<NavLink
|
|
@@ -6,12 +6,12 @@ import { Input } from "../../"
|
|
|
6
6
|
import { SearchForm } from "./styles"
|
|
7
7
|
import type { ILibHeaderSearch } from "./subtypes"
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export const HeaderSearch = ({
|
|
10
10
|
"data-testid": testid,
|
|
11
11
|
className,
|
|
12
12
|
search,
|
|
13
13
|
handleClose,
|
|
14
|
-
}: ILibHeaderSearch) {
|
|
14
|
+
}: ILibHeaderSearch) => {
|
|
15
15
|
if (!search) return null
|
|
16
16
|
|
|
17
17
|
const {
|
|
@@ -20,7 +20,7 @@ const helmetData = new HelmetData({})
|
|
|
20
20
|
* @prop language?: string
|
|
21
21
|
* @prop children?: ReactChildren
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export const Helmet = ({
|
|
24
24
|
title,
|
|
25
25
|
favicon,
|
|
26
26
|
description,
|
|
@@ -32,7 +32,7 @@ export function Helmet({
|
|
|
32
32
|
language = "en",
|
|
33
33
|
children,
|
|
34
34
|
...rest
|
|
35
|
-
}: ILibHelmet) {
|
|
35
|
+
}: ILibHelmet) => {
|
|
36
36
|
return (
|
|
37
37
|
<Meta helmetData={helmetData} {...rest}>
|
|
38
38
|
<title>{title}</title>
|
|
@@ -63,7 +63,7 @@ const InputFunction = forwardRef<
|
|
|
63
63
|
* @prop label?: string
|
|
64
64
|
* @prop labelComment?: string
|
|
65
65
|
* @prop helper?: string
|
|
66
|
-
* @prop helperBottom?: string | { text: string; textColor?: Any color from the library; fontStyle?: CssFontStyle; icon?: string | JSX.Element; iconColor?: Any color from the library; iconSize?: number }
|
|
66
|
+
* @prop helperBottom?: string | { text: string => only if element is not defined; element: ReactChildren => only if text is not defined; textColor?: Any color from the library; fontStyle?: CssFontStyle; icon?: string | JSX.Element; iconColor?: Any color from the library; iconSize?: number }
|
|
67
67
|
* @prop validation?: { status: LibValidationStatus; message?: string; iconNotPassed?: LibIcon; iconNotPassedSize?: number; iconPassed?: LibIcon; iconPassedSize?: number; iconBaseUrl?: string }
|
|
68
68
|
* @prop iconBaseUrl?: string
|
|
69
69
|
* @prop inputBackground?: "light" | "dark"
|
|
@@ -19,7 +19,7 @@ import type { ILibInputButton } from "../types"
|
|
|
19
19
|
* @prop validationStatus: boolean | undefined | undefined
|
|
20
20
|
* @prop className: string | undefined
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export const InputButton = ({
|
|
23
23
|
"data-testid": testid,
|
|
24
24
|
"aria-label": ariaLabel,
|
|
25
25
|
onClick,
|
|
@@ -31,7 +31,7 @@ export function InputButton({
|
|
|
31
31
|
inputBackground,
|
|
32
32
|
validationStatus,
|
|
33
33
|
className,
|
|
34
|
-
}: ILibInputButton) {
|
|
34
|
+
}: ILibInputButton) => {
|
|
35
35
|
return (
|
|
36
36
|
<StyledInputButton
|
|
37
37
|
aria-label={ariaLabel}
|
|
@@ -20,7 +20,7 @@ import type { ILibInputContainer } from "../../InputContainer/types"
|
|
|
20
20
|
* @prop style: CSSProperties | undefined
|
|
21
21
|
* @prop iconBaseUrl: string | undefined
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export const InputContainer = ({
|
|
24
24
|
"data-testid": testid,
|
|
25
25
|
id,
|
|
26
26
|
label,
|
|
@@ -36,7 +36,7 @@ export function InputContainer({
|
|
|
36
36
|
hasListOpen,
|
|
37
37
|
iconBaseUrl,
|
|
38
38
|
style,
|
|
39
|
-
}: ILibInputContainer) {
|
|
39
|
+
}: ILibInputContainer) => {
|
|
40
40
|
if (
|
|
41
41
|
!label &&
|
|
42
42
|
!labelComment &&
|
|
@@ -17,7 +17,7 @@ import type { ILibInputIconContainer } from "../types"
|
|
|
17
17
|
* @prop inputBackground: "light" | "dark" | undefined
|
|
18
18
|
* @prop inputVariant: "rounded" | "pill" | undefined
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export const InputIcon = ({
|
|
21
21
|
"data-testid": testid,
|
|
22
22
|
className,
|
|
23
23
|
icon,
|
|
@@ -27,7 +27,7 @@ export function InputIcon({
|
|
|
27
27
|
inputBackground,
|
|
28
28
|
disabled,
|
|
29
29
|
inputVariant,
|
|
30
|
-
}: ILibInputIconContainer) {
|
|
30
|
+
}: ILibInputIconContainer) => {
|
|
31
31
|
if (!icon) return null
|
|
32
32
|
|
|
33
33
|
return (
|
|
@@ -11,12 +11,12 @@ import type { ILibInputPrefix } from "../types"
|
|
|
11
11
|
* @prop inputBackground: "light" | "dark" | undefined
|
|
12
12
|
* @prop prefix: string | JSX.Element | undefined
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export const InputPrefix = ({
|
|
15
15
|
"data-testid": testid,
|
|
16
16
|
className,
|
|
17
17
|
prefix,
|
|
18
18
|
inputBackground,
|
|
19
|
-
}: ILibInputPrefix) {
|
|
19
|
+
}: ILibInputPrefix) => {
|
|
20
20
|
if (!prefix) return null
|
|
21
21
|
|
|
22
22
|
return (
|
|
@@ -13,14 +13,14 @@ import type { ILibInputRightContainer } from "../types"
|
|
|
13
13
|
* @prop withBorder: boolean | undefined
|
|
14
14
|
* @prop children?: ReactChildren
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export const InputRightContainer = ({
|
|
17
17
|
"data-testid": testid,
|
|
18
18
|
className,
|
|
19
19
|
children,
|
|
20
20
|
disabled,
|
|
21
21
|
withPadding,
|
|
22
22
|
withBorder,
|
|
23
|
-
}: ILibInputRightContainer) {
|
|
23
|
+
}: ILibInputRightContainer) => {
|
|
24
24
|
return (
|
|
25
25
|
<StyledInputRightContainer
|
|
26
26
|
data-testid={testid && `${testid}.RightContainer`}
|
|
@@ -11,12 +11,12 @@ import type { ILibInputSuffix } from "../types"
|
|
|
11
11
|
* @prop inputBackground: "light" | "dark" | undefined
|
|
12
12
|
* @prop prefix: string | JSX.Element | undefined
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export const InputSuffix = ({
|
|
15
15
|
"data-testid": testid,
|
|
16
16
|
className,
|
|
17
17
|
suffix,
|
|
18
18
|
inputBackground,
|
|
19
|
-
}: ILibInputSuffix) {
|
|
19
|
+
}: ILibInputSuffix) => {
|
|
20
20
|
if (!suffix) return null
|
|
21
21
|
|
|
22
22
|
return (
|
|
@@ -6,7 +6,7 @@ import { CloseCircle, CheckCircle } from "../../../icons"
|
|
|
6
6
|
import {
|
|
7
7
|
HelperBottomContainer,
|
|
8
8
|
HelperBottomIconContainer,
|
|
9
|
-
|
|
9
|
+
StyledHelperBottom,
|
|
10
10
|
} from "../../InputContainer/styles"
|
|
11
11
|
import type { ILibInputValidationHelper } from "../types"
|
|
12
12
|
|
|
@@ -17,11 +17,11 @@ import type { ILibInputValidationHelper } from "../types"
|
|
|
17
17
|
* @prop className: string | undefined
|
|
18
18
|
* @prop validation: { status: LibValidationStatus; message?: string; iconNotPassed?: LibIcon; iconNotPassedSize?: number; iconPassed?: LibIcon; iconPassedSize?: number; iconBaseUrl?: string }
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export const InputValidationHelper = ({
|
|
21
21
|
"data-testid": testid,
|
|
22
22
|
className,
|
|
23
23
|
validation,
|
|
24
|
-
}: ILibInputValidationHelper) {
|
|
24
|
+
}: ILibInputValidationHelper) => {
|
|
25
25
|
const {
|
|
26
26
|
status,
|
|
27
27
|
message,
|
|
@@ -81,7 +81,7 @@ export function InputValidationHelper({
|
|
|
81
81
|
/>
|
|
82
82
|
</HelperBottomIconContainer>
|
|
83
83
|
|
|
84
|
-
<
|
|
84
|
+
<StyledHelperBottom
|
|
85
85
|
data-testid={testid && `${testid}.ValidationHelper.Text`}
|
|
86
86
|
className={className && "ValidationTextBottom"}
|
|
87
87
|
$hasIcon
|
|
@@ -92,7 +92,7 @@ export function InputValidationHelper({
|
|
|
92
92
|
}
|
|
93
93
|
>
|
|
94
94
|
{message}
|
|
95
|
-
</
|
|
95
|
+
</StyledHelperBottom>
|
|
96
96
|
</HelperBottomContainer>
|
|
97
97
|
)
|
|
98
98
|
}
|
|
@@ -15,12 +15,12 @@ const DEFAULT_ICON_SIZE = 16
|
|
|
15
15
|
* @prop inputBackground: "light" | "dark" | undefined
|
|
16
16
|
* @prop validation: { status: LibValidationStatus; message?: string; iconNotPassed?: LibIcon; iconNotPassedSize?: number; iconPassed?: LibIcon; iconPassedSize?: number; iconBaseUrl?: string }
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export const InputValidationIcon = ({
|
|
19
19
|
"data-testid": testid,
|
|
20
20
|
className,
|
|
21
21
|
validation,
|
|
22
22
|
inputBackground,
|
|
23
|
-
}: ILibInputValidationIcon) {
|
|
23
|
+
}: ILibInputValidationIcon) => {
|
|
24
24
|
const commonIconProps = {
|
|
25
25
|
className: className && "ValidationIcon",
|
|
26
26
|
size: DEFAULT_ICON_SIZE,
|
|
@@ -17,7 +17,7 @@ import type { ILibInputWrapper } from "../types"
|
|
|
17
17
|
* @prop validationStatus: boolean | undefined
|
|
18
18
|
* @prop children?: ReactChildren
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export const InputWrapper = ({
|
|
21
21
|
"data-testid": testid,
|
|
22
22
|
className,
|
|
23
23
|
hasContainer,
|
|
@@ -27,7 +27,7 @@ export function InputWrapper({
|
|
|
27
27
|
inputBackground,
|
|
28
28
|
inputVariant,
|
|
29
29
|
validationStatus,
|
|
30
|
-
}: ILibInputWrapper) {
|
|
30
|
+
}: ILibInputWrapper) => {
|
|
31
31
|
return (
|
|
32
32
|
<StyledInputWrapper
|
|
33
33
|
data-testid={hasContainer && testid ? `${testid}.Wrapper` : testid}
|
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
import type { CSSProperties, MouseEventHandler } from "react"
|
|
4
4
|
import type {
|
|
5
5
|
ReactChildren,
|
|
6
|
-
CssFontStyle,
|
|
7
6
|
LibInputListDirection,
|
|
8
|
-
LibAllColors,
|
|
9
7
|
LibIcon,
|
|
10
8
|
LibInputBackground,
|
|
11
9
|
LibInputVariant,
|
|
12
10
|
LibValidationStatus,
|
|
13
11
|
RequireAtLeastOne,
|
|
14
12
|
LibInputPrefixAndSuffix,
|
|
13
|
+
LibHelperBottom,
|
|
15
14
|
} from "../../types"
|
|
16
15
|
|
|
17
16
|
/*====================== Validation ======================*/
|
|
@@ -109,17 +108,7 @@ export interface ILibInputContainer {
|
|
|
109
108
|
label: string | undefined
|
|
110
109
|
labelComment: string | undefined
|
|
111
110
|
helper: string | undefined
|
|
112
|
-
helperBottom:
|
|
113
|
-
| string
|
|
114
|
-
| {
|
|
115
|
-
text: string
|
|
116
|
-
textColor?: LibAllColors
|
|
117
|
-
fontStyle?: CssFontStyle
|
|
118
|
-
icon?: LibIcon
|
|
119
|
-
iconColor?: LibAllColors
|
|
120
|
-
iconSize?: number
|
|
121
|
-
}
|
|
122
|
-
| undefined
|
|
111
|
+
helperBottom: LibHelperBottom | undefined
|
|
123
112
|
validation: LibValidationHelper | undefined
|
|
124
113
|
children?: ReactChildren
|
|
125
114
|
value: any | undefined
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*=============================================== HelperBottom ===============================================*/
|
|
2
|
+
|
|
3
|
+
import type { FC } from "react"
|
|
4
|
+
import { LibIcon } from "../LibIcon"
|
|
5
|
+
import { getIconSizeFromFont } from "../../lib-utils"
|
|
6
|
+
import {
|
|
7
|
+
StyledHelperBottom,
|
|
8
|
+
HelperBottomContainer,
|
|
9
|
+
HelperBottomIconContainer,
|
|
10
|
+
} from "./styles"
|
|
11
|
+
import type { ILibHelperBottom } from "./subtypes"
|
|
12
|
+
|
|
13
|
+
export const HelperBottom: FC<ILibHelperBottom> = ({
|
|
14
|
+
"data-testid": testid,
|
|
15
|
+
className,
|
|
16
|
+
helperBottom,
|
|
17
|
+
iconBaseUrl,
|
|
18
|
+
}) => {
|
|
19
|
+
if (typeof helperBottom === "string") {
|
|
20
|
+
return <StyledHelperBottom>{helperBottom}</StyledHelperBottom>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (typeof helperBottom === "object") {
|
|
24
|
+
const {
|
|
25
|
+
element,
|
|
26
|
+
text,
|
|
27
|
+
textColor,
|
|
28
|
+
fontStyle,
|
|
29
|
+
icon,
|
|
30
|
+
iconColor = "primary",
|
|
31
|
+
iconSize = getIconSizeFromFont("small") as number,
|
|
32
|
+
linkColor,
|
|
33
|
+
} = helperBottom
|
|
34
|
+
|
|
35
|
+
if (element)
|
|
36
|
+
return (
|
|
37
|
+
<StyledHelperBottom linkColor={linkColor}>
|
|
38
|
+
{element}
|
|
39
|
+
</StyledHelperBottom>
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
if (icon)
|
|
43
|
+
return (
|
|
44
|
+
<HelperBottomContainer
|
|
45
|
+
data-testid={testid && `${testid}.HelperBottomContainer`}
|
|
46
|
+
className={className && "HelperBottomContainer"}
|
|
47
|
+
>
|
|
48
|
+
<HelperBottomIconContainer
|
|
49
|
+
data-testid={
|
|
50
|
+
testid && `${testid}.HelperBottom.IconContainer`
|
|
51
|
+
}
|
|
52
|
+
className={className && "BottomIconContainer"}
|
|
53
|
+
$iconSize={iconSize}
|
|
54
|
+
>
|
|
55
|
+
<LibIcon
|
|
56
|
+
data-testid={
|
|
57
|
+
testid &&
|
|
58
|
+
`${testid}.HelperBottom.IconContainer.Icon`
|
|
59
|
+
}
|
|
60
|
+
className={className && "HelperBottomIcon"}
|
|
61
|
+
icon={icon}
|
|
62
|
+
color={iconColor}
|
|
63
|
+
size={iconSize || getIconSizeFromFont("small")}
|
|
64
|
+
baseUrl={iconBaseUrl}
|
|
65
|
+
/>
|
|
66
|
+
</HelperBottomIconContainer>
|
|
67
|
+
|
|
68
|
+
<StyledHelperBottom
|
|
69
|
+
data-testid={testid && `${testid}.HelperBottom.Text`}
|
|
70
|
+
className={className && "HelperBottomText"}
|
|
71
|
+
color={textColor}
|
|
72
|
+
linkColor={linkColor}
|
|
73
|
+
$fontStyle={fontStyle}
|
|
74
|
+
$iconSize={iconSize}
|
|
75
|
+
$hasIcon
|
|
76
|
+
>
|
|
77
|
+
{helperBottom.text}
|
|
78
|
+
</StyledHelperBottom>
|
|
79
|
+
</HelperBottomContainer>
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<StyledHelperBottom
|
|
84
|
+
data-testid={testid && `${testid}.HelperBottom`}
|
|
85
|
+
className={className && "HelperBottom"}
|
|
86
|
+
color={textColor}
|
|
87
|
+
$fontStyle={fontStyle}
|
|
88
|
+
$hasIcon={false}
|
|
89
|
+
>
|
|
90
|
+
{text}
|
|
91
|
+
</StyledHelperBottom>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return null
|
|
96
|
+
}
|