@bitrise/bitkit 12.81.0 → 12.83.0
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/package.json +6 -6
- package/src/Components/DatePicker/DatePicker.tsx +2 -2
- package/src/Components/Form/Checkbox/Checkbox.theme.ts +5 -3
- package/src/Components/Form/DateInput/DateInput.tsx +50 -0
- package/src/Components/Form/Radio/Radio.theme.ts +5 -0
- package/src/Components/Table/CheckableRow.tsx +52 -0
- package/src/Components/Table/SelectableRow.tsx +8 -3
- package/src/index.ts +6 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitrise/bitkit",
|
|
3
3
|
"description": "Bitrise React component library",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.83.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"react-dom": "^18.2.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@babel/core": "^7.23.
|
|
51
|
-
"@babel/preset-env": "^7.23.
|
|
50
|
+
"@babel/core": "^7.23.9",
|
|
51
|
+
"@babel/preset-env": "^7.23.9",
|
|
52
52
|
"@babel/preset-react": "^7.23.3",
|
|
53
53
|
"@babel/preset-typescript": "^7.23.3",
|
|
54
54
|
"@bitrise/eslint-plugin": "^2.3.3",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@storybook/react-webpack5": "^7.6.10",
|
|
65
65
|
"@storybook/theming": "^7.6.10",
|
|
66
66
|
"@testing-library/dom": "^9.3.4",
|
|
67
|
-
"@testing-library/jest-dom": "^6.
|
|
67
|
+
"@testing-library/jest-dom": "^6.3.0",
|
|
68
68
|
"@testing-library/react": "^14.1.2",
|
|
69
69
|
"@testing-library/user-event": "^14.5.2",
|
|
70
70
|
"@types/jest": "^29.5.11",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@types/react-dom": "^18.2.18",
|
|
74
74
|
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
|
75
75
|
"@typescript-eslint/parser": "^6.19.1",
|
|
76
|
-
"axios": "^1.6.
|
|
76
|
+
"axios": "^1.6.6",
|
|
77
77
|
"eslint": "^8.56.0",
|
|
78
78
|
"eslint-plugin-import": "^2.29.1",
|
|
79
79
|
"eslint-plugin-jest": "^27.6.3",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"jsdom": "^24.0.0",
|
|
90
90
|
"prettier": "^3.2.4",
|
|
91
91
|
"react-hook-form": "^7.49.3",
|
|
92
|
-
"release-it": "^17.0.
|
|
92
|
+
"release-it": "^17.0.3",
|
|
93
93
|
"storybook": "^7.6.10",
|
|
94
94
|
"ts-jest": "^29.1.2",
|
|
95
95
|
"typescript": "^5.3.3"
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { DateTime } from 'luxon';
|
|
3
3
|
import FocusLock from 'react-focus-lock';
|
|
4
|
-
import { PopoverAnchor } from '@chakra-ui/react';
|
|
5
4
|
import { useObjectMemo } from '../../utils/utils';
|
|
6
5
|
import Popover from '../Popover/Popover';
|
|
7
6
|
import PopoverContent from '../Popover/PopoverContent';
|
|
8
7
|
import Box from '../Box/Box';
|
|
9
8
|
import useResponsive from '../../hooks/useResponsive';
|
|
10
9
|
import Button from '../Button/Button';
|
|
10
|
+
import PopoverTrigger from '../Popover/PopoverTrigger';
|
|
11
11
|
import DatePickerMonth from './DatePickerMonth';
|
|
12
12
|
import { DatePickerContext } from './DatePicker.context';
|
|
13
13
|
import DatePickerMonthSelector from './DatePickerMonthSelector';
|
|
@@ -183,7 +183,7 @@ const DatePicker = (props: DatePickerProps) => {
|
|
|
183
183
|
|
|
184
184
|
return (
|
|
185
185
|
<Popover modifiers={[]} isOpen={visible} onClose={onClose} isLazy lazyBehavior="unmount">
|
|
186
|
-
<
|
|
186
|
+
<PopoverTrigger>{children}</PopoverTrigger>
|
|
187
187
|
<PopoverContent aria-label="select date range">
|
|
188
188
|
<FocusLock returnFocus>
|
|
189
189
|
<DatePickerContext value={ctx}>
|
|
@@ -29,15 +29,17 @@ const CheckboxTheme = {
|
|
|
29
29
|
backgroundColor: 'neutral.80',
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
-
_disabled: {
|
|
33
|
-
backgroundColor: 'neutral.93',
|
|
34
|
-
},
|
|
35
32
|
_hover: {
|
|
36
33
|
borderColor: 'neutral.70',
|
|
37
34
|
},
|
|
38
35
|
_focusVisible: {
|
|
39
36
|
boxShadow: 'formFocus',
|
|
40
37
|
},
|
|
38
|
+
_disabled: {
|
|
39
|
+
cursor: 'not-allowed',
|
|
40
|
+
backgroundColor: 'neutral.93',
|
|
41
|
+
borderColor: 'neutral.90',
|
|
42
|
+
},
|
|
41
43
|
},
|
|
42
44
|
label: {
|
|
43
45
|
userSelect: 'none',
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { forwardRef } from '@chakra-ui/react';
|
|
3
|
+
import DatePicker from '../../DatePicker/DatePicker';
|
|
4
|
+
import IconButton from '../../IconButton/IconButton';
|
|
5
|
+
import Input, { InputProps } from '../Input/Input';
|
|
6
|
+
|
|
7
|
+
export type DateInputProps = Omit<InputProps, 'value' | 'onChange' | 'placeholder'> & {
|
|
8
|
+
onCalendarClick?(): void;
|
|
9
|
+
value?: string;
|
|
10
|
+
onChange?(value: string): void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const DateInput = forwardRef<DateInputProps, 'div'>((props, ref) => {
|
|
14
|
+
const { onCalendarClick, value, onChange, ...rest } = props;
|
|
15
|
+
const [isDatePickerVisible, setIsDatePickerVisible] = useState(false);
|
|
16
|
+
|
|
17
|
+
const rightButton = (
|
|
18
|
+
<IconButton
|
|
19
|
+
iconName="Calendar"
|
|
20
|
+
onClick={() => setIsDatePickerVisible(true)}
|
|
21
|
+
variant="tertiary"
|
|
22
|
+
aria-label="Show date picker"
|
|
23
|
+
_active={{ background: 'transparent' }}
|
|
24
|
+
_hover={{ background: 'transparent' }}
|
|
25
|
+
color="icon.tertiary"
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<DatePicker
|
|
31
|
+
variant="default"
|
|
32
|
+
onApply={(day) => onChange?.(day?.toLocaleString() || '')}
|
|
33
|
+
onClose={() => setIsDatePickerVisible(false)}
|
|
34
|
+
visible={isDatePickerVisible}
|
|
35
|
+
mode="day"
|
|
36
|
+
>
|
|
37
|
+
<Input
|
|
38
|
+
{...rest}
|
|
39
|
+
onChange={(e) => onChange?.(e.target.value)}
|
|
40
|
+
placeholder="dd/mm/yyyy"
|
|
41
|
+
ref={ref}
|
|
42
|
+
rightAddon={rightButton}
|
|
43
|
+
rightAddonPlacement="inside"
|
|
44
|
+
value={value}
|
|
45
|
+
/>
|
|
46
|
+
</DatePicker>
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export default DateInput;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { LinkBox, LinkOverlay } from '@chakra-ui/react';
|
|
3
|
+
import Checkbox from '../Form/Checkbox/Checkbox';
|
|
4
|
+
import Tooltip, { TooltipProps } from '../Tooltip/Tooltip';
|
|
5
|
+
import Td from './Td';
|
|
6
|
+
import Tr, { RowProps } from './Tr';
|
|
7
|
+
|
|
8
|
+
export interface CheckableRowProps extends RowProps {
|
|
9
|
+
id: string;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
label: ReactNode;
|
|
12
|
+
name: string;
|
|
13
|
+
tooltipProps?: Omit<TooltipProps, 'children'>;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const CheckableRow = (props: CheckableRowProps) => {
|
|
18
|
+
const { children, id, isDisabled, label, name, tooltipProps, value, ...rest } = props;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<LinkBox
|
|
22
|
+
as={Tr}
|
|
23
|
+
transform="scale(1)"
|
|
24
|
+
_hover={{
|
|
25
|
+
td: { background: 'neutral.95' },
|
|
26
|
+
':has(input:checked)': {
|
|
27
|
+
td: { background: 'purple.93' },
|
|
28
|
+
},
|
|
29
|
+
}}
|
|
30
|
+
sx={{
|
|
31
|
+
':has(input:checked)': {
|
|
32
|
+
td: { background: 'purple.95' },
|
|
33
|
+
},
|
|
34
|
+
}}
|
|
35
|
+
{...rest}
|
|
36
|
+
>
|
|
37
|
+
<Td>
|
|
38
|
+
<Tooltip isDisabled={!tooltipProps} placement="right" shouldWrapChildren {...tooltipProps}>
|
|
39
|
+
<Checkbox id={id} isDisabled={isDisabled} name={name} value={value} zIndex="1" />
|
|
40
|
+
</Tooltip>
|
|
41
|
+
</Td>
|
|
42
|
+
<Td>
|
|
43
|
+
<LinkOverlay as="label" cursor={isDisabled ? 'not-allowed' : 'pointer'} htmlFor={id}>
|
|
44
|
+
{label}
|
|
45
|
+
</LinkOverlay>
|
|
46
|
+
</Td>
|
|
47
|
+
{children}
|
|
48
|
+
</LinkBox>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default CheckableRow;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { LinkBox, LinkOverlay } from '@chakra-ui/react';
|
|
3
3
|
import Radio from '../Form/Radio/Radio';
|
|
4
|
+
import Tooltip, { TooltipProps } from '../Tooltip/Tooltip';
|
|
4
5
|
import Td from './Td';
|
|
5
6
|
import Tr, { RowProps } from './Tr';
|
|
6
7
|
|
|
7
8
|
export interface SelectableRowProps extends RowProps {
|
|
8
9
|
id: string;
|
|
10
|
+
isDisabled?: boolean;
|
|
9
11
|
label: ReactNode;
|
|
12
|
+
tooltipProps?: Omit<TooltipProps, 'children'>;
|
|
10
13
|
value: string;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
const SelectableRow = (props: SelectableRowProps) => {
|
|
14
|
-
const { children, id, label, value, ...rest } = props;
|
|
17
|
+
const { children, id, isDisabled, label, tooltipProps, value, ...rest } = props;
|
|
15
18
|
|
|
16
19
|
return (
|
|
17
20
|
<LinkBox
|
|
@@ -31,10 +34,12 @@ const SelectableRow = (props: SelectableRowProps) => {
|
|
|
31
34
|
{...rest}
|
|
32
35
|
>
|
|
33
36
|
<Td>
|
|
34
|
-
<
|
|
37
|
+
<Tooltip isDisabled={!tooltipProps} placement="right" shouldWrapChildren {...tooltipProps}>
|
|
38
|
+
<Radio id={id} isDisabled={isDisabled} value={value} zIndex="1" />
|
|
39
|
+
</Tooltip>
|
|
35
40
|
</Td>
|
|
36
41
|
<Td>
|
|
37
|
-
<LinkOverlay as="label" cursor=
|
|
42
|
+
<LinkOverlay as="label" cursor={isDisabled ? 'not-allowed' : 'pointer'} htmlFor={id}>
|
|
38
43
|
{label}
|
|
39
44
|
</LinkOverlay>
|
|
40
45
|
</Td>
|
package/src/index.ts
CHANGED
|
@@ -283,6 +283,9 @@ export { default as ClickableRow } from './Components/Table/ClickableRow';
|
|
|
283
283
|
export type { SelectableRowProps } from './Components/Table/SelectableRow';
|
|
284
284
|
export { default as SelectableRow } from './Components/Table/SelectableRow';
|
|
285
285
|
|
|
286
|
+
export type { CheckableRowProps } from './Components/Table/CheckableRow';
|
|
287
|
+
export { default as CheckableRow } from './Components/Table/CheckableRow';
|
|
288
|
+
|
|
286
289
|
export type { TagProps } from './Components/Tag/Tag';
|
|
287
290
|
export { default as Tag } from './Components/Tag/Tag';
|
|
288
291
|
|
|
@@ -327,3 +330,6 @@ export { default as ProgressIndicator } from './Components/ProgressIndicator/Pro
|
|
|
327
330
|
export type { FilterProps } from './Components/Filter/Filter';
|
|
328
331
|
export { default as Filter } from './Components/Filter/Filter';
|
|
329
332
|
export * from './Components/Filter/Filter.types';
|
|
333
|
+
|
|
334
|
+
export type { DateInputProps } from './Components/Form/DateInput/DateInput';
|
|
335
|
+
export { default as DateInput } from './Components/Form/DateInput/DateInput';
|