@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
|
@@ -8,30 +8,32 @@ export const Breadcrumb: FC<BreadcrumbProps> = ({ items }) => {
|
|
|
8
8
|
if (!items?.length) return null
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
|
-
<
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
<nav aria-label="Breadcrumb" data-ui-component="Breadcrumb">
|
|
12
|
+
<Flex isYCentered={true} gap={2} isWrapped={true}>
|
|
13
|
+
{items?.map((item, index) => {
|
|
14
|
+
const isLast: boolean = Boolean(index + 1 === items?.length)
|
|
15
|
+
const AComponent: ElementType = item.as || "a"
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
>
|
|
23
|
-
<Text
|
|
24
|
-
type="div"
|
|
25
|
-
fontStyle={item?.isActive ? "italic" : "normal"}
|
|
26
|
-
emphasis={item.isActive ? "secondary" : "primary"}
|
|
17
|
+
return (
|
|
18
|
+
<Fragment key={item.href ?? item.name}>
|
|
19
|
+
<AComponent
|
|
20
|
+
href={item.href}
|
|
21
|
+
onClick={item.onClick}
|
|
22
|
+
{...(item.isActive && { "aria-current": "page" as const })}
|
|
27
23
|
>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
<Text
|
|
25
|
+
type="div"
|
|
26
|
+
fontStyle={item?.isActive ? "italic" : "normal"}
|
|
27
|
+
emphasis={item.isActive ? "secondary" : "primary"}
|
|
28
|
+
>
|
|
29
|
+
{item.name}
|
|
30
|
+
</Text>
|
|
31
|
+
</AComponent>
|
|
32
|
+
{!isLast && <Icon icon="arrow-right" size={12} emphasis="tertiary" aria-hidden={true} />}
|
|
33
|
+
</Fragment>
|
|
34
|
+
)
|
|
35
|
+
})}
|
|
36
|
+
</Flex>
|
|
37
|
+
</nav>
|
|
36
38
|
)
|
|
37
39
|
}
|
|
@@ -6,200 +6,198 @@ import { Flex } from "../Flex"
|
|
|
6
6
|
import { Icon } from "../Icon"
|
|
7
7
|
import { Loading } from "../Loading"
|
|
8
8
|
import { Text } from "../Text"
|
|
9
|
-
import { useState, useId,
|
|
9
|
+
import { useState, useId, type KeyboardEvent, type MouseEvent, type FC, useMemo } from "react"
|
|
10
10
|
import { getColorClasses } from "../../utils/colors"
|
|
11
11
|
import { INTENTION_COLOR_MAP } from "../../constants/intentions"
|
|
12
12
|
import type { HeliosIconType } from "../../types/icons"
|
|
13
13
|
import type { HeliosColorType, HeliosAppearanceType } from "../../types/colors"
|
|
14
14
|
import type { ButtonProps } from "./Button.types"
|
|
15
15
|
|
|
16
|
-
const BUTTON_ICON_SIZE
|
|
16
|
+
const BUTTON_ICON_SIZE = {
|
|
17
17
|
tiny: 14,
|
|
18
18
|
small: 18,
|
|
19
19
|
normal: 24,
|
|
20
|
-
}
|
|
20
|
+
} as const satisfies Record<string, number>
|
|
21
21
|
|
|
22
|
-
const BUTTON_ICON_LABEL_SIZE
|
|
22
|
+
const BUTTON_ICON_LABEL_SIZE = {
|
|
23
23
|
tiny: 12,
|
|
24
24
|
small: 14,
|
|
25
25
|
normal: 16,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const Button: FC<ButtonProps> =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (isDisabled || isLoading) {
|
|
119
|
-
event.preventDefault()
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
onClick?.(event)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const handleKeyUp = (): void => {
|
|
127
|
-
setIsActive(false)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {
|
|
131
|
-
if (event.key !== "Enter" && event.key !== " ") return
|
|
26
|
+
} as const satisfies Record<string, number>
|
|
27
|
+
|
|
28
|
+
export const Button: FC<ButtonProps> = ({
|
|
29
|
+
accept,
|
|
30
|
+
appearance,
|
|
31
|
+
badge,
|
|
32
|
+
badgeIcon,
|
|
33
|
+
color,
|
|
34
|
+
flair,
|
|
35
|
+
icon,
|
|
36
|
+
iconLeft,
|
|
37
|
+
iconRight,
|
|
38
|
+
intent = "neutral",
|
|
39
|
+
isDisabled,
|
|
40
|
+
isIconOnly,
|
|
41
|
+
isLoading,
|
|
42
|
+
isRounded,
|
|
43
|
+
multiple,
|
|
44
|
+
onChange,
|
|
45
|
+
onClick,
|
|
46
|
+
role = "button",
|
|
47
|
+
size = "normal",
|
|
48
|
+
tabIndex,
|
|
49
|
+
type = "button",
|
|
50
|
+
value,
|
|
51
|
+
...restProps
|
|
52
|
+
}) => {
|
|
53
|
+
const [isActive, setIsActive] = useState<boolean>(false)
|
|
54
|
+
|
|
55
|
+
const buttonId = useId()
|
|
56
|
+
const isIconOnlyLoading: boolean = !!isIconOnly && !!isLoading
|
|
57
|
+
|
|
58
|
+
const localIconLeft: HeliosIconType | undefined = icon || iconLeft
|
|
59
|
+
const localIconRight: HeliosIconType | undefined = iconRight
|
|
60
|
+
|
|
61
|
+
const consideredColor: HeliosColorType = color ? color : INTENTION_COLOR_MAP[intent]
|
|
62
|
+
const consideredAppearance: HeliosAppearanceType = useMemo(
|
|
63
|
+
() => (appearance ? appearance : consideredColor === "gray" ? "light" : "dark"),
|
|
64
|
+
[appearance, consideredColor],
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
const colorClasses = getColorClasses(consideredColor, consideredAppearance)
|
|
68
|
+
const buttonClasses = getClasses(styles.button, "relative cursor-pointer", ...colorClasses, {
|
|
69
|
+
[styles.buttonLight]: consideredAppearance === "light",
|
|
70
|
+
|
|
71
|
+
[styles.buttonActive]: isActive,
|
|
72
|
+
[styles.buttonDisabled]: isDisabled,
|
|
73
|
+
[styles.buttonLoading]: isLoading,
|
|
74
|
+
|
|
75
|
+
[styles.buttonRounded]: isRounded,
|
|
76
|
+
[styles.buttonRound]: !isRounded && size !== "tiny",
|
|
77
|
+
[styles.buttonRoundTiny]: !isRounded && size === "tiny",
|
|
78
|
+
|
|
79
|
+
[styles.buttonSizeNormal]: !size || size === "normal",
|
|
80
|
+
[styles.buttonSizeSmall]: size === "small",
|
|
81
|
+
[styles.buttonSizeTiny]: size === "tiny",
|
|
82
|
+
|
|
83
|
+
[styles.buttonWithIconLeft]: localIconLeft,
|
|
84
|
+
[styles.buttonWithIconRight]: localIconRight,
|
|
85
|
+
[styles.buttonIconOnly]: isIconOnly,
|
|
86
|
+
[styles.buttonIconOnlyLoading]: isIconOnlyLoading,
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const buttonIconLeftClasses = getClasses("relative", styles.button__icon, {
|
|
90
|
+
[styles.button__iconLeft]: localIconLeft,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const buttonIconRightClasses = getClasses("relative", styles.button__icon, {
|
|
94
|
+
[styles.button__iconRight]: localIconRight,
|
|
95
|
+
[styles.button__iconRightLoading]: isLoading,
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
const buttonLoadingSize: 10 | 20 = size && size !== "normal" ? 10 : 20
|
|
99
|
+
const isFileType: boolean = type === "file"
|
|
100
|
+
const showFileLabel: boolean = isFileType && !isIconOnly
|
|
101
|
+
|
|
102
|
+
const baseInputClasses = getClasses(styles.button__baseElement, "sans fw-medium", {
|
|
103
|
+
tiny: size === "tiny" || size === "small",
|
|
104
|
+
"small ": size === "normal",
|
|
105
|
+
"radius-max": isRounded,
|
|
106
|
+
[styles.button__baseElementNormal]: size === "normal" && !isIconOnly,
|
|
107
|
+
[styles.button__baseElementSmall]: size === "small" && !isIconOnly,
|
|
108
|
+
[styles.button__baseElementTiny]: size === "tiny" && !isIconOnly,
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const buttonLabelClasses: string = getClasses(baseInputClasses, styles.button__label)
|
|
112
|
+
const buttonInputClasses: string = getClasses(baseInputClasses, styles.button__input, {
|
|
113
|
+
[styles.button__inputFile]: isFileType,
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const handleClick = (event: MouseEvent<HTMLDivElement>): void => {
|
|
117
|
+
if (isDisabled || isLoading) {
|
|
132
118
|
event.preventDefault()
|
|
133
|
-
|
|
134
|
-
if (isDisabled || isLoading || !buttonId) return
|
|
135
|
-
|
|
136
|
-
setIsActive(true)
|
|
137
|
-
document.getElementById(buttonId)?.click()
|
|
119
|
+
return
|
|
138
120
|
}
|
|
139
121
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
122
|
+
onClick?.(event)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const handleKeyUp = (): void => {
|
|
126
|
+
setIsActive(false)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {
|
|
130
|
+
if (event.key !== "Enter" && event.key !== " ") return
|
|
131
|
+
event.preventDefault()
|
|
132
|
+
|
|
133
|
+
if (isDisabled || isLoading || !buttonId) return
|
|
134
|
+
|
|
135
|
+
setIsActive(true)
|
|
136
|
+
document.getElementById(buttonId)?.click()
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<Flex
|
|
141
|
+
className={buttonClasses}
|
|
142
|
+
isInline={true}
|
|
143
|
+
isCentered={true}
|
|
144
|
+
onKeyDown={handleKeyDown}
|
|
145
|
+
onKeyUp={handleKeyUp}
|
|
146
|
+
data-ui-component="Button"
|
|
147
|
+
data-ui-size={size}
|
|
148
|
+
aria-disabled={isDisabled || isLoading}
|
|
149
|
+
aria-busy={isLoading}
|
|
150
|
+
aria-label={isIconOnly ? value : undefined}
|
|
151
|
+
tabIndex={isDisabled ? -1 : (tabIndex ?? 0)}
|
|
152
|
+
role={role}
|
|
153
|
+
{...(onClick && { onClick: handleClick })}
|
|
154
|
+
{...restProps}
|
|
155
|
+
>
|
|
156
|
+
{localIconLeft && !isIconOnlyLoading && (
|
|
157
|
+
<Flex className={buttonIconLeftClasses}>
|
|
158
|
+
<Icon icon={localIconLeft} size={BUTTON_ICON_SIZE[size] || 24} />
|
|
159
|
+
</Flex>
|
|
160
|
+
)}
|
|
161
|
+
<input
|
|
162
|
+
id={buttonId}
|
|
149
163
|
aria-disabled={isDisabled || isLoading}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
{
|
|
155
|
-
{
|
|
156
|
-
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
</Flex>
|
|
184
|
-
)}
|
|
185
|
-
{!!flair && (
|
|
186
|
-
<Flex className={styles.button__flair} isCentered={true}>
|
|
187
|
-
<Text type={size !== "normal" ? "micro" : "tiny"} fontFamily="mono">
|
|
188
|
-
{flair}
|
|
164
|
+
disabled={isDisabled || isLoading}
|
|
165
|
+
type={type}
|
|
166
|
+
className={buttonInputClasses}
|
|
167
|
+
accept={accept}
|
|
168
|
+
multiple={multiple}
|
|
169
|
+
tabIndex={-1}
|
|
170
|
+
onChange={onChange}
|
|
171
|
+
defaultValue={isIconOnly || isFileType ? "" : value}
|
|
172
|
+
/>
|
|
173
|
+
{showFileLabel && (
|
|
174
|
+
<label htmlFor={buttonId} className={buttonLabelClasses}>
|
|
175
|
+
{value}
|
|
176
|
+
</label>
|
|
177
|
+
)}
|
|
178
|
+
{isLoading && <Loading size={buttonLoadingSize} className={styles.button__loading} />}
|
|
179
|
+
{localIconRight && !isIconOnlyLoading && (
|
|
180
|
+
<Flex className={buttonIconRightClasses}>
|
|
181
|
+
<Icon icon={localIconRight} size={BUTTON_ICON_SIZE[size] || 24} />
|
|
182
|
+
</Flex>
|
|
183
|
+
)}
|
|
184
|
+
{!!flair && (
|
|
185
|
+
<Flex className={styles.button__flair} isCentered={true}>
|
|
186
|
+
<Text type={size !== "normal" ? "micro" : "tiny"} fontFamily="mono">
|
|
187
|
+
{flair}
|
|
188
|
+
</Text>
|
|
189
|
+
</Flex>
|
|
190
|
+
)}
|
|
191
|
+
{(!!badge || !!badgeIcon) && (
|
|
192
|
+
<Flex className={styles.button__badge} isCentered={true} gap={2}>
|
|
193
|
+
{badgeIcon && <Icon icon={badgeIcon} size={BUTTON_ICON_LABEL_SIZE[size] || 16} />}
|
|
194
|
+
{badge && (
|
|
195
|
+
<Text type="tiny" fontFamily="mono" emphasis="inherit">
|
|
196
|
+
{badge}
|
|
189
197
|
</Text>
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
<Text type="tiny" fontFamily="mono" emphasis="inherit">
|
|
197
|
-
{badge}
|
|
198
|
-
</Text>
|
|
199
|
-
)}
|
|
200
|
-
</Flex>
|
|
201
|
-
)}
|
|
202
|
-
</Flex>
|
|
203
|
-
)
|
|
204
|
-
},
|
|
205
|
-
)
|
|
198
|
+
)}
|
|
199
|
+
</Flex>
|
|
200
|
+
)}
|
|
201
|
+
</Flex>
|
|
202
|
+
)
|
|
203
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import { useId
|
|
3
|
+
import { useId } from "react"
|
|
4
4
|
import { getClasses } from "@heliosgraphics/utils"
|
|
5
5
|
import { getColorClasses } from "../../utils/colors"
|
|
6
6
|
import { Flex } from "../Flex"
|
|
@@ -10,66 +10,60 @@ import styles from "./Checkbox.module.css"
|
|
|
10
10
|
import type { FC } from "react"
|
|
11
11
|
import type { CheckboxProps } from "./Checkbox.types"
|
|
12
12
|
|
|
13
|
-
export const Checkbox: FC<CheckboxProps> =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const checkboxId: string = useId()
|
|
13
|
+
export const Checkbox: FC<CheckboxProps> = ({
|
|
14
|
+
color = "gray",
|
|
15
|
+
isChecked,
|
|
16
|
+
isVertical,
|
|
17
|
+
isLabelHidden = false,
|
|
18
|
+
isSmall,
|
|
19
|
+
description,
|
|
20
|
+
isDisabled,
|
|
21
|
+
isRequired,
|
|
22
|
+
onChange,
|
|
23
|
+
label,
|
|
24
|
+
}) => {
|
|
25
|
+
const checkboxId: string = useId()
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const colorClasses = getColorClasses(color, "dark")
|
|
28
|
+
const checkboxClasses = getClasses(styles.checkbox, ...colorClasses, {
|
|
29
|
+
[styles.checkboxDisabled]: isDisabled,
|
|
30
|
+
[styles.checkboxSmall]: isSmall,
|
|
31
|
+
})
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
const checkboxLabelClasses = getClasses(styles.checkbox__checkboxLabel, "flex gap-4", {
|
|
34
|
+
"flex-x-center flex-column": isVertical,
|
|
35
|
+
"flex-y-center": !isVertical,
|
|
36
|
+
})
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
>
|
|
62
|
-
{
|
|
38
|
+
return (
|
|
39
|
+
<div className={checkboxClasses} data-ui-component="Checkbox">
|
|
40
|
+
<label className={checkboxLabelClasses} htmlFor={checkboxId}>
|
|
41
|
+
<span className={styles.checkbox__mark}>
|
|
42
|
+
<input
|
|
43
|
+
type="checkbox"
|
|
44
|
+
checked={isChecked}
|
|
45
|
+
onChange={onChange}
|
|
46
|
+
disabled={isDisabled}
|
|
47
|
+
required={isRequired}
|
|
48
|
+
aria-label={isLabelHidden ? label : undefined}
|
|
49
|
+
id={checkboxId}
|
|
50
|
+
/>
|
|
51
|
+
<Icon icon="check" size={isSmall ? 14 : 18} className={styles.checkbox__checkboxIcon} />
|
|
52
|
+
<div className={styles.checkbox__checkboxMark} />
|
|
53
|
+
</span>
|
|
54
|
+
{!isLabelHidden && (
|
|
55
|
+
<Flex isColumn={true}>
|
|
56
|
+
<Text type={isSmall ? "tiny" : "small"} fontWeight="medium" emphasis={isDisabled ? "tertiary" : "inherit"}>
|
|
57
|
+
{label}
|
|
58
|
+
</Text>
|
|
59
|
+
{description && (
|
|
60
|
+
<Text type="tiny" emphasis="secondary">
|
|
61
|
+
{description}
|
|
63
62
|
</Text>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</label>
|
|
72
|
-
</div>
|
|
73
|
-
)
|
|
74
|
-
},
|
|
75
|
-
)
|
|
63
|
+
)}
|
|
64
|
+
</Flex>
|
|
65
|
+
)}
|
|
66
|
+
</label>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -24,7 +24,7 @@ export const Confirm: FC<ConfirmProps> = ({
|
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
|
-
<Dialog title={title} onClose={onCancel} isOpen={isOpen} isCentered={true}>
|
|
27
|
+
<Dialog title={title} onClose={onCancel} isOpen={isOpen} isCentered={true} role="alertdialog">
|
|
28
28
|
<Flex gap={12} isColumn={true} data-ui-component="Confirm">
|
|
29
29
|
{!!description && <Text type="paragraph">{description}</Text>}
|
|
30
30
|
<ButtonGroup align={buttonGroupAlign}>
|
|
@@ -37,6 +37,10 @@ export const meta: HeliosAttributeMeta<DialogBaseProps> = {
|
|
|
37
37
|
onClose: {
|
|
38
38
|
type: "(_?: unknown) => Promise<void> | void",
|
|
39
39
|
},
|
|
40
|
+
role: {
|
|
41
|
+
type: '"dialog" | "alertdialog"',
|
|
42
|
+
isOptional: true,
|
|
43
|
+
},
|
|
40
44
|
title: {
|
|
41
45
|
type: "string",
|
|
42
46
|
isOptional: true,
|