• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zendeskgarden / react-components / 180f4396-9708-4f9d-9976-168ae8d5da2c

25 Jun 2024 09:12PM UTC coverage: 96.019% (-0.02%) from 96.043%
180f4396-9708-4f9d-9976-168ae8d5da2c

Pull #1842

circleci

geotrev
chore: force light mode, remove dark offsets, simplify tests
Pull Request #1842: feat(notifications): new light/dark mode colors

3336 of 3691 branches covered (90.38%)

Branch coverage included in aggregate %.

239 of 243 new or added lines in 24 files covered. (98.35%)

1 existing line in 1 file now uncovered.

10145 of 10349 relevant lines covered (98.03%)

213.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/packages/tables/src/elements/Row.tsx
1
/**
2
 * Copyright Zendesk, Inc.
3
 *
4
 * Use of this source code is governed under the Apache License, Version 2.0
5
 * found at http://www.apache.org/licenses/LICENSE-2.0.
6
 */
7

8
import React, { useState, useMemo, forwardRef } from 'react';
8✔
9
import PropTypes from 'prop-types';
8✔
10
import { composeEventHandlers } from '@zendeskgarden/container-utilities';
8✔
11
import { IRowProps } from '../types';
12
import { StyledRow } from '../styled';
8✔
13
import { useTableContext } from '../utils/useTableContext';
8✔
14

15
/**
16
 * @deprecated use `Table.Row` instead
17
 *
18
 * @extends HTMLAttributes<HTMLTableRowElement>
19
 */
20

21
export const Row = forwardRef<HTMLTableRowElement, IRowProps>(
27✔
22
  ({ onFocus, onBlur, isFocused: focused, ...otherProps }, ref) => {
23
    const [isFocused, setIsFocused] = useState(false);
22✔
24
    const { size, isReadOnly } = useTableContext();
22✔
25

26
    const computedFocused = useMemo(() => {
22✔
27
      if (typeof focused !== 'undefined') {
22!
UNCOV
28
        return focused;
×
29
      }
30

31
      if (isReadOnly) {
22✔
32
        return false;
2✔
33
      }
34

35
      return isFocused;
20✔
36
    }, [focused, isFocused, isReadOnly]);
37
    const onFocusCallback = useMemo(
22✔
38
      () =>
39
        composeEventHandlers(onFocus, () => {
19✔
40
          setIsFocused(true);
2✔
41
        }),
42
      [onFocus, setIsFocused]
43
    );
44

45
    const onBlurCallback = useMemo(
22✔
46
      () =>
47
        composeEventHandlers(onBlur, () => {
19✔
48
          setIsFocused(false);
1✔
49
        }),
50
      [onBlur, setIsFocused]
51
    );
52

53
    return (
54
      <StyledRow
55
        onFocus={onFocusCallback}
56
        onBlur={onBlurCallback}
57
        size={size}
58
        isReadOnly={isReadOnly}
59
        isFocused={computedFocused}
60
        ref={ref}
61
        {...otherProps}
62
      />
63
    );
64
  }
65
);
66

67
Row.displayName = 'Row';
8✔
68

69
Row.propTypes = {
8✔
70
  isStriped: PropTypes.bool,
71
  isFocused: PropTypes.bool,
72
  isHovered: PropTypes.bool,
73
  isSelected: PropTypes.bool
74
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc