@heliosgraphics/ui 2.0.0-alpha.82 → 2.0.0-alpha.83

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.
@@ -23,12 +23,13 @@ export const Alert: FC<AlertProps> = ({ children, onClose, title, icon, color, a
23
23
  })
24
24
 
25
25
  return (
26
- <Flex className={alertClasses} padding={6} gap={6} data-ui-component="Alert">
26
+ <Flex className={alertClasses} padding={6} gap={6} role="alert" aria-live="polite" data-ui-component="Alert">
27
27
  {!!onClose && (
28
28
  <ButtonGroup className={styles.alertButtonGroup}>
29
29
  <Button
30
30
  isIconOnly={true}
31
31
  value="Close"
32
+ aria-label="Close"
32
33
  color={resolvedColor}
33
34
  appearance={appearance}
34
35
  size="tiny"
@@ -15,7 +15,11 @@ export const Breadcrumb: FC<BreadcrumbProps> = ({ items }) => {
15
15
 
16
16
  return (
17
17
  <Fragment key={key}>
18
- <AComponent href={item.href} onClick={item.onClick}>
18
+ <AComponent
19
+ href={item.href}
20
+ onClick={item.onClick}
21
+ {...(item.isActive && { "aria-current": "page" as const })}
22
+ >
19
23
  <Text
20
24
  type="div"
21
25
  fontStyle={item?.isActive ? "italic" : "normal"}
@@ -24,7 +28,7 @@ export const Breadcrumb: FC<BreadcrumbProps> = ({ items }) => {
24
28
  {item.name}
25
29
  </Text>
26
30
  </AComponent>
27
- {!isLast && <Icon icon="arrow-right" size={12} emphasis="tertiary" />}
31
+ {!isLast && <Icon icon="arrow-right" size={12} emphasis="tertiary" aria-hidden={true} />}
28
32
  </Fragment>
29
33
  )
30
34
  })}
@@ -147,6 +147,7 @@ export const Button: FC<ButtonProps> = ({
147
147
  data-ui-size={size}
148
148
  aria-disabled={isDisabled || isLoading}
149
149
  aria-busy={isLoading}
150
+ aria-label={isIconOnly ? value : undefined}
150
151
  tabIndex={isDisabled ? -1 : (tabIndex ?? 0)}
151
152
  role={role}
152
153
  {...(onClick && { onClick: handleClick })}
@@ -166,7 +167,6 @@ export const Button: FC<ButtonProps> = ({
166
167
  accept={accept}
167
168
  multiple={multiple}
168
169
  tabIndex={-1}
169
- role={role}
170
170
  onChange={onChange}
171
171
  defaultValue={isIconOnly || isFileType ? "" : value}
172
172
  />
@@ -18,6 +18,7 @@ export const Checkbox: FC<CheckboxProps> = ({
18
18
  isSmall,
19
19
  description,
20
20
  isDisabled,
21
+ isRequired,
21
22
  onChange,
22
23
  label,
23
24
  }) => {
@@ -38,7 +39,15 @@ export const Checkbox: FC<CheckboxProps> = ({
38
39
  <div className={checkboxClasses}>
39
40
  <label className={checkboxLabelClasses} htmlFor={checkboxId}>
40
41
  <span className={styles.checkbox__mark}>
41
- <input type="checkbox" checked={isChecked} onChange={onChange} disabled={isDisabled} id={checkboxId} />
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
+ />
42
51
  <Icon icon="check" size={isSmall ? 14 : 18} className={styles.checkbox__checkboxIcon} />
43
52
  <div className={styles.checkbox__checkboxMark} />
44
53
  </span>
@@ -11,7 +11,7 @@ export const Details: FC<DetailsProps> = ({ children, label, isOpen }) => {
11
11
  <Text type="small" fontWeight="medium">
12
12
  {label}
13
13
  </Text>
14
- <Icon icon="caret-down" size={20} emphasis="tertiary" />
14
+ <Icon icon="caret-down" size={20} emphasis="tertiary" aria-hidden={true} />
15
15
  </summary>
16
16
  <div>{children}</div>
17
17
  </details>
@@ -88,7 +88,7 @@ export const Dialog: FC<DialogProps> = ({ title, children, isNarrow, isOpen, isC
88
88
  {title}
89
89
  </Heading>
90
90
  <ButtonGroup>
91
- <Button icon="x" intent="neutral" value="" onClick={onClose} size="small" isIconOnly={true} />
91
+ <Button icon="x" intent="neutral" value="Close dialog" onClick={onClose} size="small" isIconOnly={true} />
92
92
  </ButtonGroup>
93
93
  </Flex>
94
94
  )}
@@ -26,7 +26,7 @@ export const Dot: FC<DotProps> = ({ colorAccent, size = 8, color = "blue" }) =>
26
26
 
27
27
  return (
28
28
  <div className={styles.dot} style={dotStyle}>
29
- <svg width="100%" height="100%" viewBox="0 0 20 20">
29
+ <svg width="100%" height="100%" viewBox="0 0 20 20" aria-hidden={true}>
30
30
  {colorAccent ? (
31
31
  <>
32
32
  <linearGradient id={dotId}>
@@ -76,7 +76,9 @@ export const Dropdown: FC<DropdownProps> = ({ children, items, isDisabled, posit
76
76
 
77
77
  return (
78
78
  <div className={dropdownClasses} onMouseEnter={mouseEnter} onMouseLeave={mouseLeave}>
79
- <div onClick={onSetVisible}>{renderChildren}</div>
79
+ <div onClick={onSetVisible} aria-expanded={isVisible} aria-haspopup="listbox">
80
+ {renderChildren}
81
+ </div>
80
82
  <nav
81
83
  className={navClasses}
82
84
  style={{
@@ -22,6 +22,7 @@ export const Icon: FC<IconProps> = memo(({ icon, className, emphasis, size }) =>
22
22
  <div
23
23
  className={iconClasses}
24
24
  style={iconSizeStyle}
25
+ aria-hidden={true}
25
26
  data-ui-component="Icon"
26
27
  dangerouslySetInnerHTML={{ __html: icons[icon] || "" }}
27
28
  />
@@ -32,6 +32,7 @@ export const MenuItem: FC<MenuItemProps> = ({
32
32
  isBetween={true}
33
33
  gap={4}
34
34
  isYCentered={true}
35
+ {...(isActive && { "aria-current": "page" as const })}
35
36
  >
36
37
  <Flex isYCentered={true} gap={4}>
37
38
  {icon && (
@@ -44,7 +44,14 @@ export const Pill: FC<PillProps> = memo(
44
44
  const pillTextSize = isSmall ? "tiny" : "small"
45
45
 
46
46
  return (
47
- <Flex {...(onClick && { onClick })} className={pillClasses} isCentered={true} gap={2} data-ui-component="Pill">
47
+ <Flex
48
+ {...(onClick && { onClick })}
49
+ className={pillClasses}
50
+ isCentered={true}
51
+ gap={2}
52
+ aria-label={isLabelHidden ? label : undefined}
53
+ data-ui-component="Pill"
54
+ >
48
55
  {icon && <Icon size={PILL_ICON_SIZE[size] || 16} icon={icon} />}
49
56
  {!isLabelHidden && (
50
57
  <Text type={pillTextSize} whiteSpace="nowrap" {...(isMono && { fontFamily: "mono" })} fontWeight="medium">
@@ -17,6 +17,7 @@ export const Radio: FC<RadioProps> = ({
17
17
  isSmall,
18
18
  description,
19
19
  isDisabled,
20
+ isRequired,
20
21
  onChange,
21
22
  label,
22
23
  name,
@@ -44,6 +45,8 @@ export const Radio: FC<RadioProps> = ({
44
45
  checked={isChecked}
45
46
  onChange={onChange}
46
47
  disabled={isDisabled}
48
+ required={isRequired}
49
+ aria-label={isLabelHidden ? label : undefined}
47
50
  id={radioId}
48
51
  name={name}
49
52
  value={value}
@@ -29,7 +29,13 @@ export const Select: FC<SelectProps> = ({
29
29
  <Flex isColumn={true} className={selectClasses}>
30
30
  <InputLabel label={label} id={htmlFor} isHidden={!!isLabelHidden} isDisabled={!!isDisabled} />
31
31
  <Flex>
32
- <select className={styles.select__select} onChange={onChange} id={htmlFor} value={selectedValue}>
32
+ <select
33
+ className={styles.select__select}
34
+ onChange={onChange}
35
+ id={htmlFor}
36
+ value={selectedValue}
37
+ aria-label={isLabelHidden ? label : undefined}
38
+ >
33
39
  {items?.map((item, key) => {
34
40
  return (
35
41
  <option key={key} value={item.value} disabled={item.isDisabled}>
@@ -12,6 +12,9 @@ export const Shimmer: FC<ShimmerProps> = ({ isRounded, paddingTop, paddingBottom
12
12
  return (
13
13
  <div
14
14
  className={styles.shimmer}
15
+ role="status"
16
+ aria-busy={true}
17
+ aria-label="Loading"
15
18
  style={{
16
19
  height: height + "px",
17
20
  paddingTop: (paddingTop ?? 0) + "px",
@@ -39,7 +39,10 @@ export const Toggle: FC<ToggleProps> = ({
39
39
  <label className={toggleLabelClasses} htmlFor={toggleId}>
40
40
  <input
41
41
  type="checkbox"
42
+ role="switch"
42
43
  checked={isChecked}
44
+ aria-checked={isChecked}
45
+ aria-label={isLabelHidden ? label : undefined}
43
46
  onChange={onChange}
44
47
  required={isRequired}
45
48
  disabled={isDisabled}
@@ -98,8 +98,16 @@ const TooltipComponent: FC<TooltipProps> = ({ children = null, position = "botto
98
98
  }
99
99
  }
100
100
 
101
+ const handleKeyDown = (event: KeyboardEvent): void => {
102
+ if (event.key === "Escape") {
103
+ popover.hidePopover()
104
+ setIsOpen(false)
105
+ }
106
+ }
107
+
101
108
  trigger.addEventListener("mouseenter", handleMouseEnter)
102
109
  trigger.addEventListener("mouseleave", handleMouseLeave)
110
+ trigger.addEventListener("keydown", handleKeyDown)
103
111
 
104
112
  globalThis.addEventListener("resize", positionTooltip)
105
113
  globalThis.addEventListener("scroll", positionTooltip, true)
@@ -107,6 +115,7 @@ const TooltipComponent: FC<TooltipProps> = ({ children = null, position = "botto
107
115
  return (): void => {
108
116
  trigger.removeEventListener("mouseenter", handleMouseEnter)
109
117
  trigger.removeEventListener("mouseleave", handleMouseLeave)
118
+ trigger.removeEventListener("keydown", handleKeyDown)
110
119
  globalThis.removeEventListener("resize", positionTooltip)
111
120
  globalThis.removeEventListener("scroll", positionTooltip, true)
112
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heliosgraphics/ui",
3
- "version": "2.0.0-alpha.82",
3
+ "version": "2.0.0-alpha.83",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "author": "Chris Puska <chris@puska.org>",