@heliosgraphics/ui 2.0.0-alpha.90 → 2.0.0-alpha.92
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/Flex/Flex.tsx +11 -12
- package/components/Flex/Flex.types.ts +2 -2
- package/components/Segments/Segments.tsx +1 -6
- package/components/Segments/components/SegmentButton/SegmentButton.meta.ts +4 -0
- package/components/Segments/components/SegmentButton/SegmentButton.tsx +13 -16
- package/components/Segments/components/SegmentButton/SegmentButton.types.ts +2 -0
- package/components/shared/ResultList/ResultList.meta.ts +4 -0
- package/components/shared/ResultList/ResultList.tsx +2 -3
- package/components/shared/ResultList/ResultList.types.ts +1 -0
- package/package.json +1 -1
- /package/{css → components/Setup/css}/core.colors-helpers.css +0 -0
- /package/{css → components/Setup/css}/core.colors.css +0 -0
- /package/{css → components/Setup/css}/core.scale.css +0 -0
- /package/{css → components/Setup/css}/core.setup.css +0 -0
- /package/{css → components/Setup/css}/core.typography.css +0 -0
- /package/{css → components/Setup/css}/feat.atomics.css +0 -0
- /package/{css → components/Setup/css}/feat.markdown.css +0 -0
- /package/{css → components/Setup/css}/feat.responsive.css +0 -0
package/components/Flex/Flex.tsx
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { memo } from "react"
|
|
2
2
|
import { getFlexUtility, getSafeFlexProps } from "../Flex/Flex.utils"
|
|
3
3
|
import type { FlexProps } from "./Flex.types"
|
|
4
4
|
|
|
5
|
-
export const Flex = memo(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export const Flex = memo((props: FlexProps) => {
|
|
6
|
+
const { ref, ...restProps } = props
|
|
7
|
+
const flexClasses: string = getFlexUtility(restProps)
|
|
8
|
+
const safeProps = getSafeFlexProps(restProps)
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
10
|
+
return (
|
|
11
|
+
<div {...safeProps} className={flexClasses} onClick={restProps.onClick} ref={ref}>
|
|
12
|
+
{restProps.children}
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HTMLAttributes, MouseEventHandler, PropsWithChildren,
|
|
1
|
+
import type { HTMLAttributes, MouseEventHandler, PropsWithChildren, Ref } from "react"
|
|
2
2
|
import type { HeliosScaleType, HeliosRadiusType } from "../../types/scale"
|
|
3
3
|
import type { HeliosEmphasisType } from "../../types/intentions"
|
|
4
4
|
|
|
@@ -25,7 +25,7 @@ export interface FlexBaseProps {
|
|
|
25
25
|
padding?: ResponsiveScaleType
|
|
26
26
|
paddingX?: HeliosScaleType
|
|
27
27
|
paddingY?: HeliosScaleType
|
|
28
|
-
ref?:
|
|
28
|
+
ref?: Ref<HTMLDivElement>
|
|
29
29
|
withBackground?: HeliosEmphasisType
|
|
30
30
|
withRadius?: ResponsiveRadiusType
|
|
31
31
|
xAlign?: "start" | "end" | "center"
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
type FC,
|
|
5
|
-
type Ref,
|
|
6
5
|
useState,
|
|
7
6
|
useRef,
|
|
8
7
|
useEffect,
|
|
@@ -19,10 +18,6 @@ import { SegmentButton } from "./components/SegmentButton"
|
|
|
19
18
|
import type { SegmentsProps } from "./Segments.types"
|
|
20
19
|
import type { SegmentButtonProps } from "./components/SegmentButton/SegmentButton.types"
|
|
21
20
|
|
|
22
|
-
type SegmentButtonWithRef = SegmentButtonProps & {
|
|
23
|
-
ref?: Ref<HTMLButtonElement>
|
|
24
|
-
}
|
|
25
|
-
|
|
26
21
|
export const Segments: FC<SegmentsProps> = ({ children, isFullWidth, isSmall }) => {
|
|
27
22
|
const validChildren: ReactElement<SegmentButtonProps>[] = Children.toArray(children).filter(
|
|
28
23
|
(child): child is ReactElement<SegmentButtonProps> => isValidElement(child) && child.type === SegmentButton,
|
|
@@ -74,7 +69,7 @@ export const Segments: FC<SegmentsProps> = ({ children, isFullWidth, isSmall })
|
|
|
74
69
|
return (
|
|
75
70
|
<Flex className={segmentedControlClasses} isYCentered={true} gap={2} isInline={!isFullWidth} ref={containerRef}>
|
|
76
71
|
{validChildren.map((child: ReactElement<SegmentButtonProps>, index: number) =>
|
|
77
|
-
cloneElement<
|
|
72
|
+
cloneElement<SegmentButtonProps>(child, {
|
|
78
73
|
key: child.props.value,
|
|
79
74
|
isActive: child.props.value === activeValue,
|
|
80
75
|
onClick: () => {
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import styles from "./SegmentButton.module.css"
|
|
2
|
-
import { forwardRef } from "react"
|
|
3
2
|
import { getClasses } from "@heliosgraphics/utils"
|
|
4
3
|
import { Icon } from "../../../Icon"
|
|
5
4
|
import type { HeliosIconType } from "../../../../types/icons"
|
|
6
5
|
import type { SegmentButtonProps } from "./SegmentButton.types"
|
|
7
6
|
|
|
8
|
-
export const SegmentButton =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})
|
|
7
|
+
export const SegmentButton = ({ isActive, value, icon, iconLeft, iconRight, onClick, ref }: SegmentButtonProps) => {
|
|
8
|
+
const segmentButtonClasses: string = getClasses(styles.segmentButton, {
|
|
9
|
+
[styles.segmentButtonActive]: isActive,
|
|
10
|
+
})
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
const iconL: HeliosIconType | undefined = iconLeft || icon
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
14
|
+
return (
|
|
15
|
+
<button ref={ref} className={segmentButtonClasses} onClick={onClick} data-ui-component="SegmentButton">
|
|
16
|
+
{iconL && <Icon icon={iconL} size={16} />}
|
|
17
|
+
{value}
|
|
18
|
+
{iconRight && <Icon icon={iconRight} size={16} />}
|
|
19
|
+
</button>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Ref } from "react"
|
|
1
2
|
import type { HeliosIconType } from "../../../../types/icons"
|
|
2
3
|
|
|
3
4
|
export interface SegmentButtonProps {
|
|
@@ -6,5 +7,6 @@ export interface SegmentButtonProps {
|
|
|
6
7
|
iconRight?: HeliosIconType
|
|
7
8
|
isActive?: boolean
|
|
8
9
|
onClick?: () => void
|
|
10
|
+
ref?: Ref<HTMLButtonElement>
|
|
9
11
|
value: string
|
|
10
12
|
}
|
|
@@ -4,11 +4,10 @@ import { Flex } from "../../Flex"
|
|
|
4
4
|
import { Icon } from "../../Icon"
|
|
5
5
|
import { Text } from "../../Text"
|
|
6
6
|
import styles from "./ResultList.module.css"
|
|
7
|
-
import { forwardRef } from "react"
|
|
8
7
|
import type { ChangeEvent } from "react"
|
|
9
8
|
import type { ResultListProps } from "./ResultList.types"
|
|
10
9
|
|
|
11
|
-
export const ResultList =
|
|
10
|
+
export const ResultList = ({ items, isHidden, ref }: ResultListProps) => {
|
|
12
11
|
if (!items?.length || isHidden) return null
|
|
13
12
|
|
|
14
13
|
const resultListClasses: string = getClasses(styles.resultList, "elevation-lg")
|
|
@@ -63,4 +62,4 @@ export const ResultList = forwardRef<HTMLOListElement, ResultListProps>(({ items
|
|
|
63
62
|
})}
|
|
64
63
|
</ol>
|
|
65
64
|
)
|
|
66
|
-
}
|
|
65
|
+
}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|