@heliosgraphics/ui 2.0.0-alpha.93 → 2.0.0-alpha.95
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/components/Breadcrumb/Breadcrumb.tsx +25 -23
- package/components/Button/Button.tsx +177 -179
- package/components/Checkbox/Checkbox.tsx +54 -60
- package/components/Confirm/Confirm.tsx +1 -1
- package/components/Dialog/Dialog.meta.ts +4 -0
- package/components/Dialog/Dialog.module.css +47 -37
- package/components/Dialog/Dialog.tsx +12 -47
- package/components/Dialog/Dialog.types.ts +1 -0
- package/components/Donut/Donut.tsx +4 -6
- package/components/Dropdown/Dropdown.module.css +20 -10
- package/components/Dropdown/Dropdown.tsx +7 -4
- package/components/Flex/Flex.meta.ts +2 -0
- package/components/Flex/Flex.tsx +3 -3
- package/components/Flex/Flex.types.ts +3 -1
- package/components/Flex/Flex.utils.ts +36 -1
- package/components/Flex/index.ts +0 -2
- package/components/Heading/Heading.tsx +3 -3
- package/components/Heading/components/H1/H1.tsx +2 -1
- package/components/Heading/components/H2/H2.tsx +2 -1
- package/components/Heading/components/H3/H3.tsx +2 -1
- package/components/Heading/components/H4/H4.tsx +2 -1
- package/components/Heading/components/H5/H5.tsx +2 -1
- package/components/Heading/components/H6/H6.tsx +2 -1
- package/components/Icon/Icon.tsx +3 -3
- package/components/Input/Input.tsx +5 -2
- package/components/Layout/components/LayoutAside/components/LayoutAsideContent/LayoutAsideContent.tsx +0 -2
- package/components/Layout/components/LayoutAside/components/LayoutAsideFooter/LayoutAsideFooter.tsx +0 -2
- package/components/Loading/Loading.tsx +8 -4
- package/components/Masonry/Masonry.meta.ts +1 -5
- package/components/Masonry/Masonry.tsx +27 -14
- package/components/Masonry/Masonry.types.ts +4 -4
- package/components/Menu/components/MenuFilter/MenuFilter.tsx +0 -2
- package/components/Overlay/Overlay.module.css +42 -18
- package/components/Overlay/Overlay.tsx +8 -3
- package/components/Pie/Pie.tsx +1 -0
- package/components/Pill/Pill.tsx +2 -2
- package/components/Progress/Progress.meta.ts +4 -0
- package/components/Progress/Progress.tsx +8 -2
- package/components/Progress/Progress.types.ts +1 -0
- package/components/Radio/Radio.tsx +57 -63
- package/components/Range/Range.meta.ts +26 -0
- package/components/Range/Range.module.css +68 -0
- package/components/Range/Range.tsx +47 -0
- package/components/Range/Range.types.ts +13 -0
- package/components/Range/index.ts +1 -0
- package/components/Segments/components/SegmentButton/SegmentButton.tsx +2 -1
- package/components/Select/Select.meta.ts +4 -0
- package/components/Select/Select.tsx +2 -0
- package/components/Select/Select.types.ts +1 -0
- package/components/Separator/Separator.tsx +25 -20
- package/components/Separator/components/VerticalSeparator/VerticalSeparator.tsx +1 -1
- package/components/Setup/Setup.tsx +0 -13
- package/components/Setup/css/feat.responsive.css +402 -0
- package/components/Slider/Slider.meta.ts +4 -0
- package/components/Slider/Slider.tsx +2 -2
- package/components/Slider/Slider.types.ts +1 -0
- package/components/Spacer/Spacer.tsx +3 -3
- package/components/Tabs/Tabs.tsx +19 -5
- package/components/Text/Text.tsx +3 -3
- package/components/Text/components/Div/Div.tsx +2 -1
- package/components/Text/components/Micro/Micro.tsx +2 -1
- package/components/Text/components/P/P.tsx +2 -1
- package/components/Text/components/Small/Small.tsx +2 -1
- package/components/Text/components/Tiny/Tiny.tsx +2 -1
- package/components/Tile/Tile.tsx +10 -1
- package/components/Tooltip/Tooltip.module.css +13 -0
- package/components/Tooltip/Tooltip.tsx +5 -3
- package/components/Tooltip/Tooltip.types.ts +1 -0
- package/components/Tooltip/components/TooltipContent/TooltipContent.tsx +11 -2
- package/components/Tooltip/components/TooltipTrigger/TooltipTrigger.tsx +4 -2
- package/components/shared/ResultList/ResultList.tsx +2 -2
- package/constants/components.ts +4 -2
- package/constants/meta.ts +9 -9
- package/globals.d.ts +12 -0
- package/index.ts +1 -0
- package/package.json +9 -8
|
@@ -12,23 +12,49 @@
|
|
|
12
12
|
border-radius: var(--radius-lg) 0 0 var(--radius-lg);
|
|
13
13
|
touch-action: pan-y;
|
|
14
14
|
transform: translateX(-50%);
|
|
15
|
+
|
|
16
|
+
opacity: 0;
|
|
17
|
+
transition:
|
|
18
|
+
opacity var(--speed-lg) ease-in-out,
|
|
19
|
+
transform var(--speed-lg) ease-in-out,
|
|
20
|
+
overlay var(--speed-lg) ease-in-out allow-discrete,
|
|
21
|
+
display var(--speed-lg) ease-in-out allow-discrete;
|
|
15
22
|
}
|
|
16
23
|
|
|
17
|
-
.
|
|
18
|
-
|
|
24
|
+
.dialog[open] {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
transform: translateX(-50%);
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
@starting-style {
|
|
30
|
+
.dialog[open] {
|
|
31
|
+
opacity: 0;
|
|
32
|
+
transform: translateX(-50%) translateY(6px);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dialogNarrow {
|
|
37
|
+
width: 420px;
|
|
23
38
|
}
|
|
24
39
|
|
|
25
40
|
.dialogCentered {
|
|
26
41
|
top: 50%;
|
|
27
42
|
|
|
28
|
-
animation: dialogCenterFadeIn var(--speed-lg) ease-in-out;
|
|
29
43
|
transform: translateX(-50%) translateY(-50%);
|
|
30
44
|
}
|
|
31
45
|
|
|
46
|
+
.dialogCentered[open] {
|
|
47
|
+
opacity: 1;
|
|
48
|
+
transform: translateX(-50%) translateY(-50%);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@starting-style {
|
|
52
|
+
.dialogCentered[open] {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transform: translateX(-50%) translateY(calc(-50% + 6px));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
32
58
|
.dialog__content {
|
|
33
59
|
position: relative;
|
|
34
60
|
z-index: var(--z-index-1);
|
|
@@ -48,9 +74,24 @@
|
|
|
48
74
|
.dialog::backdrop {
|
|
49
75
|
--ui-bg-backdrop: rgba(80, 80, 80, 0.5);
|
|
50
76
|
|
|
51
|
-
animation: backdropFadeIn var(--speed-sm) ease-in-out;
|
|
52
77
|
background-color: var(--ui-bg-backdrop);
|
|
53
78
|
backdrop-filter: blur(2px);
|
|
79
|
+
|
|
80
|
+
opacity: 0;
|
|
81
|
+
transition:
|
|
82
|
+
opacity var(--speed-sm) ease-in-out,
|
|
83
|
+
overlay var(--speed-sm) ease-in-out allow-discrete,
|
|
84
|
+
display var(--speed-sm) ease-in-out allow-discrete;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.dialog[open]::backdrop {
|
|
88
|
+
opacity: 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@starting-style {
|
|
92
|
+
.dialog[open]::backdrop {
|
|
93
|
+
opacity: 0;
|
|
94
|
+
}
|
|
54
95
|
}
|
|
55
96
|
|
|
56
97
|
@media (max-width: 576px) {
|
|
@@ -68,34 +109,3 @@
|
|
|
68
109
|
width: calc(100% - 16px);
|
|
69
110
|
}
|
|
70
111
|
}
|
|
71
|
-
|
|
72
|
-
@keyframes dialogFadeIn {
|
|
73
|
-
0% {
|
|
74
|
-
opacity: 0;
|
|
75
|
-
transform: translateX(-50%) translateY(6px);
|
|
76
|
-
}
|
|
77
|
-
100% {
|
|
78
|
-
opacity: 1;
|
|
79
|
-
transform: translateX(-50%) translateY(0);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@keyframes dialogCenterFadeIn {
|
|
84
|
-
0% {
|
|
85
|
-
opacity: 0;
|
|
86
|
-
transform: translateX(-50%) translateY(calc(-50% + 6px));
|
|
87
|
-
}
|
|
88
|
-
100% {
|
|
89
|
-
opacity: 1;
|
|
90
|
-
transform: translateX(-50%) translateY(-50%);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@keyframes backdropFadeIn {
|
|
95
|
-
0% {
|
|
96
|
-
opacity: 0;
|
|
97
|
-
}
|
|
98
|
-
100% {
|
|
99
|
-
opacity: 1;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -9,53 +9,25 @@ import { Flex } from "../Flex"
|
|
|
9
9
|
import { getClasses } from "@heliosgraphics/utils"
|
|
10
10
|
import type { DialogProps } from "./Dialog.types"
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export const Dialog: FC<DialogProps> = ({
|
|
13
|
+
title,
|
|
14
|
+
children,
|
|
15
|
+
isNarrow,
|
|
16
|
+
isOpen,
|
|
17
|
+
isCentered,
|
|
18
|
+
onClose,
|
|
19
|
+
noPadding,
|
|
20
|
+
role,
|
|
21
|
+
}) => {
|
|
16
22
|
const dialogRef = useRef<HTMLDialogElement | null>(null)
|
|
17
23
|
const triggerRef = useRef<Element | null>(null)
|
|
18
24
|
|
|
19
|
-
const resetScroll = (): void => {
|
|
20
|
-
globalThis?.requestAnimationFrame(() => {
|
|
21
|
-
document.body.setAttribute(ATTRIBUTE_SCROLL, "")
|
|
22
|
-
dialogRef?.current?.scrollTo?.(0, 0)
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const resetDocumentStyle = (scrollPosition: number): void => {
|
|
27
|
-
globalThis?.requestAnimationFrame(() => {
|
|
28
|
-
document.body.style.position = ""
|
|
29
|
-
document.body.style.height = ""
|
|
30
|
-
document.body.style.top = ""
|
|
31
|
-
document.body.classList.remove(POSITION_FIXED_CLASS)
|
|
32
|
-
|
|
33
|
-
return globalThis?.scrollTo?.(0, scrollPosition)
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
return (): void => {
|
|
39
|
-
const localPos: string = document?.body?.getAttribute(ATTRIBUTE_SCROLL) ?? "0"
|
|
40
|
-
const scrollPosition: number = parseInt(localPos) ?? 0
|
|
41
|
-
|
|
42
|
-
resetDocumentStyle(scrollPosition)
|
|
43
|
-
resetScroll()
|
|
44
|
-
}
|
|
45
|
-
}, [title, isOpen])
|
|
46
|
-
|
|
47
25
|
useEffect(() => {
|
|
48
26
|
dialogRef?.current?.scrollTo?.(0, 0)
|
|
49
27
|
|
|
50
28
|
if (isOpen) {
|
|
51
29
|
triggerRef.current = document.activeElement
|
|
52
30
|
|
|
53
|
-
const localPosition: number = document?.documentElement?.scrollTop ?? 0
|
|
54
|
-
|
|
55
|
-
document.body.classList.add(POSITION_FIXED_CLASS)
|
|
56
|
-
document.body.style.top = `-${localPosition}px`
|
|
57
|
-
document.body.setAttribute(ATTRIBUTE_SCROLL, localPosition.toString())
|
|
58
|
-
|
|
59
31
|
dialogRef?.current?.showModal?.()
|
|
60
32
|
|
|
61
33
|
const dialog = dialogRef.current
|
|
@@ -76,14 +48,7 @@ export const Dialog: FC<DialogProps> = ({ title, children, isNarrow, isOpen, isC
|
|
|
76
48
|
}
|
|
77
49
|
triggerRef.current = null
|
|
78
50
|
}
|
|
79
|
-
} else
|
|
80
|
-
const localPos: string = document?.body?.getAttribute(ATTRIBUTE_SCROLL) ?? "0"
|
|
81
|
-
const scrollPosition: number = parseInt(localPos) ?? 0
|
|
82
|
-
|
|
83
|
-
document.body.classList.remove(POSITION_FIXED_CLASS)
|
|
84
|
-
|
|
85
|
-
resetDocumentStyle(scrollPosition)
|
|
86
|
-
|
|
51
|
+
} else {
|
|
87
52
|
dialogRef?.current?.close?.()
|
|
88
53
|
}
|
|
89
54
|
|
|
@@ -108,7 +73,7 @@ export const Dialog: FC<DialogProps> = ({ title, children, isNarrow, isOpen, isC
|
|
|
108
73
|
})
|
|
109
74
|
|
|
110
75
|
return (
|
|
111
|
-
<dialog ref={dialogRef} className={dialogClasses} onClick={onDialogClose} data-ui-component="Dialog">
|
|
76
|
+
<dialog ref={dialogRef} className={dialogClasses} onClick={onDialogClose} role={role} data-ui-component="Dialog">
|
|
112
77
|
{!!title && (
|
|
113
78
|
<Flex isBetween={true} isYCentered={true} padding={8} className={dialogFlexClasses}>
|
|
114
79
|
<Heading level={5} fontWeight="medium">
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getClasses } from "@heliosgraphics/utils"
|
|
1
2
|
import { getDonutBorderSize } from "./Donut.utils"
|
|
2
3
|
import { Flex } from "../Flex"
|
|
3
4
|
import styles from "./Donut.module.css"
|
|
@@ -12,18 +13,14 @@ export const Donut: FC<DonutProps> = ({ children, size, percentage = 0, color })
|
|
|
12
13
|
const dashSize = 100 - percentage
|
|
13
14
|
const donutColor: string = `hsl(var(--${color}-hue), var(--${color}-saturation), 50%)`
|
|
14
15
|
|
|
16
|
+
const donutClasses: string = getClasses(styles.donut, "relative")
|
|
15
17
|
const donutContainerStyle: object = {
|
|
16
18
|
height: size + "px",
|
|
17
19
|
width: size + "px",
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
return (
|
|
21
|
-
<Flex
|
|
22
|
-
style={donutContainerStyle}
|
|
23
|
-
className={`${styles.donut} relative`}
|
|
24
|
-
isCentered={true}
|
|
25
|
-
data-ui-component="Donut"
|
|
26
|
-
>
|
|
23
|
+
<Flex style={donutContainerStyle} className={donutClasses} isCentered={true} data-ui-component="Donut">
|
|
27
24
|
<Flex className="absolute top-0 left-0 z-50" style={donutContainerStyle} isCentered={true}>
|
|
28
25
|
{children}
|
|
29
26
|
</Flex>
|
|
@@ -36,6 +33,7 @@ export const Donut: FC<DonutProps> = ({ children, size, percentage = 0, color })
|
|
|
36
33
|
role="img"
|
|
37
34
|
aria-label={`Donut chart: ${percentage}%`}
|
|
38
35
|
>
|
|
36
|
+
<title>{`${percentage}%`}</title>
|
|
39
37
|
<circle
|
|
40
38
|
fill="none"
|
|
41
39
|
strokeWidth={borderSize}
|
|
@@ -48,30 +48,40 @@
|
|
|
48
48
|
position: absolute;
|
|
49
49
|
z-index: var(--z-index-8);
|
|
50
50
|
|
|
51
|
+
display: none;
|
|
51
52
|
min-width: 240px;
|
|
52
53
|
opacity: 0;
|
|
53
54
|
|
|
54
55
|
transition:
|
|
56
|
+
display 96ms ease-in-out allow-discrete,
|
|
55
57
|
transform 96ms ease-in-out,
|
|
56
58
|
opacity 96ms ease-in-out;
|
|
57
59
|
pointer-events: none;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
+
.dropdown__navActive {
|
|
63
|
+
display: block;
|
|
64
|
+
opacity: 1;
|
|
62
65
|
|
|
63
|
-
transform: translateY(0)
|
|
66
|
+
transform: translateY(0);
|
|
64
67
|
|
|
65
68
|
pointer-events: all;
|
|
66
|
-
}
|
|
67
69
|
|
|
68
|
-
@
|
|
69
|
-
0% {
|
|
70
|
+
@starting-style {
|
|
70
71
|
opacity: 0;
|
|
71
|
-
/* transform: translateY(-8px); */
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.dropdownBottomLeft .dropdown__navActive,
|
|
76
|
+
.dropdownBottomRight .dropdown__navActive {
|
|
77
|
+
@starting-style {
|
|
78
|
+
transform: translateY(-6px);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.dropdownTopLeft .dropdown__navActive,
|
|
83
|
+
.dropdownTopRight .dropdown__navActive {
|
|
84
|
+
@starting-style {
|
|
85
|
+
transform: translateY(6px);
|
|
76
86
|
}
|
|
77
87
|
}
|
|
@@ -22,6 +22,7 @@ export const Dropdown: FC<DropdownProps> = ({ children, items, isDisabled, posit
|
|
|
22
22
|
const hoverStateRef = useRef<boolean>(false)
|
|
23
23
|
const resultListRef = useRef<HTMLOListElement | null>(null)
|
|
24
24
|
const hideTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
25
|
+
const isMountedRef = useRef<boolean>(true)
|
|
25
26
|
|
|
26
27
|
const [isVisible, setVisible] = useState<boolean>(false)
|
|
27
28
|
const [isHovering, setHovering] = useState<boolean>(false)
|
|
@@ -34,8 +35,12 @@ export const Dropdown: FC<DropdownProps> = ({ children, items, isDisabled, posit
|
|
|
34
35
|
}, [isVisible, items?.length])
|
|
35
36
|
|
|
36
37
|
useEffect(() => {
|
|
38
|
+
isMountedRef.current = true
|
|
39
|
+
|
|
37
40
|
return (): void => {
|
|
41
|
+
isMountedRef.current = false
|
|
38
42
|
if (hideTimeoutRef.current) globalThis.clearTimeout(hideTimeoutRef.current)
|
|
43
|
+
hideTimeoutRef.current = null
|
|
39
44
|
}
|
|
40
45
|
}, [])
|
|
41
46
|
|
|
@@ -62,7 +67,7 @@ export const Dropdown: FC<DropdownProps> = ({ children, items, isDisabled, posit
|
|
|
62
67
|
const mouseLeave = (_event: MouseEvent<HTMLDivElement>): void => {
|
|
63
68
|
setHovering(false)
|
|
64
69
|
hideTimeoutRef.current = setTimeout(() => {
|
|
65
|
-
if (!hoverStateRef.current) setVisible(false)
|
|
70
|
+
if (isMountedRef.current && !hoverStateRef.current) setVisible(false)
|
|
66
71
|
hideTimeoutRef.current = null
|
|
67
72
|
}, ANIMATION_FAST)
|
|
68
73
|
}
|
|
@@ -81,9 +86,7 @@ export const Dropdown: FC<DropdownProps> = ({ children, items, isDisabled, posit
|
|
|
81
86
|
|
|
82
87
|
const onSetVisible = (): void => setVisible(!isVisible)
|
|
83
88
|
|
|
84
|
-
const navClasses: string = getClasses(styles.dropdown__nav,
|
|
85
|
-
[styles.dropdown__navActive]: isVisible,
|
|
86
|
-
})
|
|
89
|
+
const navClasses: string = getClasses(styles.dropdown__nav, isVisible && styles.dropdown__navActive)
|
|
87
90
|
|
|
88
91
|
const itemsWithClose = useMemo(
|
|
89
92
|
() =>
|
|
@@ -34,6 +34,8 @@ export const meta: HeliosAttributeMeta<FlexBaseProps> = {
|
|
|
34
34
|
isYCentered: { type: "boolean", isOptional: true },
|
|
35
35
|
onClick: { type: "HeliosOnClickType", isOptional: true },
|
|
36
36
|
padding: { type: "ResponsiveScaleType", isOptional: true },
|
|
37
|
+
paddingBlock: { type: "ResponsiveScaleType", isOptional: true },
|
|
38
|
+
paddingInline: { type: "ResponsiveScaleType", isOptional: true },
|
|
37
39
|
paddingX: { type: "HeliosScale", isOptional: true },
|
|
38
40
|
paddingY: { type: "HeliosScale", isOptional: true },
|
|
39
41
|
ref: { type: "RefObject<HTMLDivElement>", isOptional: true },
|
package/components/Flex/Flex.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { memo } from "react"
|
|
2
1
|
import { getFlexUtility, getSafeFlexProps } from "../Flex/Flex.utils"
|
|
3
2
|
import type { FlexProps } from "./Flex.types"
|
|
3
|
+
import type { FC } from "react"
|
|
4
4
|
|
|
5
|
-
export const Flex =
|
|
5
|
+
export const Flex: FC<FlexProps> = (props) => {
|
|
6
6
|
const { ref, ...restProps } = props
|
|
7
7
|
const flexClasses: string = getFlexUtility(restProps)
|
|
8
8
|
const safeProps = getSafeFlexProps(restProps)
|
|
@@ -12,4 +12,4 @@ export const Flex = memo((props: FlexProps) => {
|
|
|
12
12
|
{restProps.children}
|
|
13
13
|
</div>
|
|
14
14
|
)
|
|
15
|
-
}
|
|
15
|
+
}
|
|
@@ -8,7 +8,7 @@ export type ResponsiveRadiusType = HeliosRadiusType | [HeliosRadiusType, HeliosR
|
|
|
8
8
|
export interface FlexBaseProps {
|
|
9
9
|
className?: string
|
|
10
10
|
elevation?: "small" | "medium" | "large"
|
|
11
|
-
gap?:
|
|
11
|
+
gap?: ResponsiveScaleType
|
|
12
12
|
grow?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
|
|
13
13
|
isAround?: boolean
|
|
14
14
|
isBetween?: boolean
|
|
@@ -23,6 +23,8 @@ export interface FlexBaseProps {
|
|
|
23
23
|
isYCentered?: boolean
|
|
24
24
|
onClick?: MouseEventHandler<HTMLDivElement>
|
|
25
25
|
padding?: ResponsiveScaleType
|
|
26
|
+
paddingBlock?: ResponsiveScaleType
|
|
27
|
+
paddingInline?: ResponsiveScaleType
|
|
26
28
|
paddingX?: HeliosScaleType
|
|
27
29
|
paddingY?: HeliosScaleType
|
|
28
30
|
ref?: Ref<HTMLDivElement>
|
|
@@ -42,7 +42,21 @@ export const getFlexUtility = (props?: FlexProps): string => {
|
|
|
42
42
|
flexClasses.add(responsivePadding)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
if (props.gap)
|
|
45
|
+
if (props.gap) {
|
|
46
|
+
const responsiveGap: string = getResponsiveScale(props.gap, "gap")
|
|
47
|
+
flexClasses.add(responsiveGap)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (props.paddingBlock) {
|
|
51
|
+
const responsivePaddingBlock: string = getResponsiveScale(props.paddingBlock, "py")
|
|
52
|
+
flexClasses.add(responsivePaddingBlock)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (props.paddingInline) {
|
|
56
|
+
const responsivePaddingInline: string = getResponsiveScale(props.paddingInline, "px")
|
|
57
|
+
flexClasses.add(responsivePaddingInline)
|
|
58
|
+
}
|
|
59
|
+
|
|
46
60
|
if (props.paddingY) flexClasses.add(`py-${props.paddingY}`)
|
|
47
61
|
if (props.paddingX) flexClasses.add(`px-${props.paddingX}`)
|
|
48
62
|
|
|
@@ -54,6 +68,25 @@ export const getFlexUtility = (props?: FlexProps): string => {
|
|
|
54
68
|
return Array.from(flexClasses).join(" ")
|
|
55
69
|
}
|
|
56
70
|
|
|
71
|
+
export const getResponsiveScale = (value?: ResponsiveScaleType, prefix: string = "p"): string => {
|
|
72
|
+
if (!value) return ""
|
|
73
|
+
|
|
74
|
+
const isArray: boolean = Boolean(value && value instanceof Array)
|
|
75
|
+
const classes = new Set<string>()
|
|
76
|
+
|
|
77
|
+
if (!isArray) return `${prefix}-${value}`
|
|
78
|
+
|
|
79
|
+
for (let index: number = 0; index < 3; index++) {
|
|
80
|
+
const element = (value as [HeliosScaleType, HeliosScaleType, HeliosScaleType])[index]
|
|
81
|
+
|
|
82
|
+
if (index === 0) classes.add(`mobile:${prefix}-${element ?? 0}`)
|
|
83
|
+
if (index === 1) classes.add(`tablet:${prefix}-${element ?? 0}`)
|
|
84
|
+
if (index === 2) classes.add(`${prefix}-${element ?? 0}`)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return Array.from(classes).join(" ")
|
|
88
|
+
}
|
|
89
|
+
|
|
57
90
|
export const getPadding = (paddingValue?: ResponsiveScaleType): string => {
|
|
58
91
|
if (!paddingValue) return ""
|
|
59
92
|
|
|
@@ -111,6 +144,8 @@ export const getSafeFlexProps = (props: any): Partial<FlexProps> => {
|
|
|
111
144
|
isXCentered: _isXCentered,
|
|
112
145
|
isYCentered: _isYCentered,
|
|
113
146
|
padding: _padding,
|
|
147
|
+
paddingBlock: _paddingBlock,
|
|
148
|
+
paddingInline: _paddingInline,
|
|
114
149
|
paddingX: _paddingX,
|
|
115
150
|
paddingY: _paddingY,
|
|
116
151
|
withBackground: _withBackground,
|
package/components/Flex/index.ts
CHANGED
|
@@ -9,9 +9,9 @@ import { H5 } from "./components/H5"
|
|
|
9
9
|
import { H6 } from "./components/H6"
|
|
10
10
|
import styles from "./Heading.module.css"
|
|
11
11
|
import type { HeadingProps } from "./Heading.types"
|
|
12
|
-
import {
|
|
12
|
+
import type { FC, CSSProperties } from "react"
|
|
13
13
|
|
|
14
|
-
export const Heading: FC<HeadingProps> =
|
|
14
|
+
export const Heading: FC<HeadingProps> = (props) => {
|
|
15
15
|
const { level, lineClamp, style, className, ...rest } = props
|
|
16
16
|
|
|
17
17
|
const headingClasses: string = getClasses(className, styles.heading, {
|
|
@@ -60,4 +60,4 @@ export const Heading: FC<HeadingProps> = memo((props) => {
|
|
|
60
60
|
default:
|
|
61
61
|
return null
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { getClasses } from "@heliosgraphics/utils"
|
|
1
2
|
import type { FC } from "react"
|
|
2
3
|
import type { H1Props } from "./H1.types"
|
|
3
4
|
|
|
4
5
|
export const H1: FC<H1Props> = (props) => {
|
|
5
|
-
return <h1 {...props} className={
|
|
6
|
+
return <h1 {...props} className={getClasses("h1", props.className)} data-ui-component="Heading.H1" />
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { getClasses } from "@heliosgraphics/utils"
|
|
1
2
|
import type { FC } from "react"
|
|
2
3
|
import type { H2Props } from "./H2.types"
|
|
3
4
|
|
|
4
5
|
export const H2: FC<H2Props> = (props) => {
|
|
5
|
-
return <h2 {...props} className={
|
|
6
|
+
return <h2 {...props} className={getClasses("h2", props.className)} data-ui-component="Heading.H2" />
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { getClasses } from "@heliosgraphics/utils"
|
|
1
2
|
import type { FC } from "react"
|
|
2
3
|
import type { H3Props } from "./H3.types"
|
|
3
4
|
|
|
4
5
|
export const H3: FC<H3Props> = (props) => {
|
|
5
|
-
return <h3 {...props} className={
|
|
6
|
+
return <h3 {...props} className={getClasses("h3", props.className)} data-ui-component="Heading.H3" />
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { getClasses } from "@heliosgraphics/utils"
|
|
1
2
|
import type { FC } from "react"
|
|
2
3
|
import type { H4Props } from "./H4.types"
|
|
3
4
|
|
|
4
5
|
export const H4: FC<H4Props> = (props) => {
|
|
5
|
-
return <h4 {...props} className={
|
|
6
|
+
return <h4 {...props} className={getClasses("h4", props.className)} data-ui-component="Heading.H4" />
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { getClasses } from "@heliosgraphics/utils"
|
|
1
2
|
import type { FC } from "react"
|
|
2
3
|
import type { H5Props } from "./H5.types"
|
|
3
4
|
|
|
4
5
|
export const H5: FC<H5Props> = (props) => {
|
|
5
|
-
return <h5 {...props} className={
|
|
6
|
+
return <h5 {...props} className={getClasses("h5", props.className)} data-ui-component="Heading.H5" />
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { getClasses } from "@heliosgraphics/utils"
|
|
1
2
|
import type { FC } from "react"
|
|
2
3
|
import type { H6Props } from "./H6.types"
|
|
3
4
|
|
|
4
5
|
export const H6: FC<H6Props> = (props) => {
|
|
5
|
-
return <h6 {...props} className={
|
|
6
|
+
return <h6 {...props} className={getClasses("h6", props.className)} data-ui-component="Heading.H6" />
|
|
6
7
|
}
|
package/components/Icon/Icon.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getClasses } from "@heliosgraphics/utils"
|
|
2
2
|
import { icons } from "@heliosgraphics/icons"
|
|
3
3
|
import styles from "./Icon.module.css"
|
|
4
|
-
import {
|
|
4
|
+
import type { FC } from "react"
|
|
5
5
|
import type { IconProps } from "./Icon.types"
|
|
6
6
|
|
|
7
|
-
export const Icon: FC<IconProps> =
|
|
7
|
+
export const Icon: FC<IconProps> = ({ icon, className, emphasis, size }) => {
|
|
8
8
|
const iconSizeStyle = {
|
|
9
9
|
height: size + "px",
|
|
10
10
|
minHeight: size + "px",
|
|
@@ -27,4 +27,4 @@ export const Icon: FC<IconProps> = memo(({ icon, className, emphasis, size }) =>
|
|
|
27
27
|
dangerouslySetInnerHTML={{ __html: icons[icon] || "" }}
|
|
28
28
|
/>
|
|
29
29
|
)
|
|
30
|
-
}
|
|
30
|
+
}
|
|
@@ -14,7 +14,9 @@ import type { InputProps } from "./Input.types"
|
|
|
14
14
|
import type { ResultItem } from "../shared/ResultList"
|
|
15
15
|
|
|
16
16
|
export const Input: FC<InputProps> = ({
|
|
17
|
+
className,
|
|
17
18
|
helperText,
|
|
19
|
+
id,
|
|
18
20
|
isDisabled,
|
|
19
21
|
autoComplete,
|
|
20
22
|
autoFocus,
|
|
@@ -36,7 +38,8 @@ export const Input: FC<InputProps> = ({
|
|
|
36
38
|
type = "text",
|
|
37
39
|
value,
|
|
38
40
|
}) => {
|
|
39
|
-
const
|
|
41
|
+
const generatedId: string = useId()
|
|
42
|
+
const htmlFor: string = id || generatedId
|
|
40
43
|
const helperId: string = `${htmlFor}-helper`
|
|
41
44
|
|
|
42
45
|
const filteredItems: Array<ResultItem> =
|
|
@@ -51,7 +54,7 @@ export const Input: FC<InputProps> = ({
|
|
|
51
54
|
|
|
52
55
|
const showingResults: boolean = Boolean(!!filteredItems?.length && showResults)
|
|
53
56
|
|
|
54
|
-
const inputClasses: string = getClasses(styles.input, "relative flex flex-column", {
|
|
57
|
+
const inputClasses: string = getClasses(styles.input, "relative flex flex-column", className, {
|
|
55
58
|
[styles.inputDisabled]: isDisabled,
|
|
56
59
|
[styles.inputShowingResults]: showingResults,
|
|
57
60
|
})
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
1
3
|
import { getClasses } from "@heliosgraphics/utils"
|
|
4
|
+
import { useId, type FC } from "react"
|
|
2
5
|
import styles from "./Loading.module.css"
|
|
3
|
-
import { memo, type FC } from "react"
|
|
4
6
|
import type { LoadingProps } from "./Loading.types"
|
|
5
7
|
|
|
6
|
-
export const Loading: FC<LoadingProps> =
|
|
8
|
+
export const Loading: FC<LoadingProps> = ({ className, size, emphasis }) => {
|
|
9
|
+
const titleId: string = useId()
|
|
7
10
|
const rSize = size / 2
|
|
8
11
|
const cSize = rSize + 2
|
|
9
12
|
const dashSize = size + cSize
|
|
@@ -24,9 +27,10 @@ export const Loading: FC<LoadingProps> = memo(({ className, size, emphasis }) =>
|
|
|
24
27
|
height={size + 4}
|
|
25
28
|
width={size + 4}
|
|
26
29
|
role="status"
|
|
27
|
-
aria-
|
|
30
|
+
aria-labelledby={titleId}
|
|
28
31
|
data-ui-component="Loading"
|
|
29
32
|
>
|
|
33
|
+
<title id={titleId}>Loading</title>
|
|
30
34
|
<circle
|
|
31
35
|
fill="none"
|
|
32
36
|
strokeWidth={4}
|
|
@@ -48,4 +52,4 @@ export const Loading: FC<LoadingProps> = memo(({ className, size, emphasis }) =>
|
|
|
48
52
|
/>
|
|
49
53
|
</svg>
|
|
50
54
|
)
|
|
51
|
-
}
|
|
55
|
+
}
|
|
@@ -19,10 +19,6 @@ export const meta: HeliosAttributeMeta<MasonryBaseProps> = {
|
|
|
19
19
|
type: "[number, number, number]",
|
|
20
20
|
},
|
|
21
21
|
gap: {
|
|
22
|
-
type: "[
|
|
23
|
-
},
|
|
24
|
-
useBalancedLayout: {
|
|
25
|
-
type: "boolean",
|
|
26
|
-
isOptional: true,
|
|
22
|
+
type: "[HeliosScaleType, HeliosScaleType, HeliosScaleType]",
|
|
27
23
|
},
|
|
28
24
|
}
|