@bitrise/bitkit 12.47.0 → 12.48.1
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 +1 -1
- package/src/Components/Form/FileInput/FileInput.tsx +4 -4
- package/src/Components/Form/FilterSwitch/FilterSwitch.theme.ts +43 -0
- package/src/Components/Form/FilterSwitch/FilterSwitch.tsx +58 -0
- package/src/Components/Form/FilterSwitch/FilterSwitchGroup.tsx +25 -0
- package/src/index.ts +5 -0
- package/src/theme.ts +2 -0
package/package.json
CHANGED
|
@@ -95,16 +95,16 @@ const FileInput = forwardRef<FileInputProps, 'div'>((props, ref) => {
|
|
|
95
95
|
|
|
96
96
|
return (
|
|
97
97
|
<FormControl {...rest} isDisabled={isDisabled} isInvalid={isInputInvalid} ref={ref}>
|
|
98
|
-
<Box __css={style.container} data-disabled={isDisabled || undefined}>
|
|
98
|
+
<Box __css={style.container} data-disabled={isDisabled || undefined} gap="10px">
|
|
99
99
|
{selectedFileNames.length > 0 ? (
|
|
100
100
|
<>
|
|
101
|
-
<
|
|
101
|
+
<Box textOverflow="ellipsis" whiteSpace="nowrap" overflow="hidden">
|
|
102
102
|
<Text as="h6" size="2" fontWeight="bold">
|
|
103
103
|
Selected file
|
|
104
104
|
</Text>
|
|
105
105
|
<Text as="span">{selectedFileNames[0]}</Text>
|
|
106
|
-
</
|
|
107
|
-
<Button leftIconName="MinusRemove" size="small" variant="secondary" onClick={onRemoveClick}>
|
|
106
|
+
</Box>
|
|
107
|
+
<Button leftIconName="MinusRemove" size="small" variant="secondary" onClick={onRemoveClick} flexShrink={0}>
|
|
108
108
|
Remove
|
|
109
109
|
</Button>
|
|
110
110
|
</>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ComponentStyleConfig } from '@chakra-ui/theme';
|
|
2
|
+
|
|
3
|
+
const FilterSwitch: ComponentStyleConfig = {
|
|
4
|
+
baseStyle: () => {
|
|
5
|
+
return {
|
|
6
|
+
container: {
|
|
7
|
+
color: 'neutral.40',
|
|
8
|
+
background: 'neutral.95',
|
|
9
|
+
borderRadius: '4',
|
|
10
|
+
border: '1px solid',
|
|
11
|
+
borderColor: 'neutral.80',
|
|
12
|
+
paddingBlock: '6',
|
|
13
|
+
paddingInline: '12',
|
|
14
|
+
cursor: 'pointer',
|
|
15
|
+
position: 'relative',
|
|
16
|
+
textOverflow: 'ellipsis',
|
|
17
|
+
whiteSpace: 'nowrap',
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
_hover: {
|
|
20
|
+
background: 'neutral.100',
|
|
21
|
+
},
|
|
22
|
+
_active: {
|
|
23
|
+
color: 'purple.10',
|
|
24
|
+
background: 'neutral.100',
|
|
25
|
+
},
|
|
26
|
+
_checked: {
|
|
27
|
+
background: 'neutral.100',
|
|
28
|
+
color: 'purple.10',
|
|
29
|
+
cursor: 'default',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
label: {
|
|
33
|
+
margin: 0,
|
|
34
|
+
userSelect: 'none',
|
|
35
|
+
_focusVisible: {
|
|
36
|
+
boxShadow: 'outline',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default FilterSwitch;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RadioProps as ChakraRadioProps,
|
|
3
|
+
forwardRef,
|
|
4
|
+
chakra,
|
|
5
|
+
useRadio,
|
|
6
|
+
useMultiStyleConfig,
|
|
7
|
+
useRadioGroupContext,
|
|
8
|
+
} from '@chakra-ui/react';
|
|
9
|
+
import { omitThemingProps } from '@chakra-ui/styled-system';
|
|
10
|
+
|
|
11
|
+
type RadioInputProps = ChakraRadioProps['inputProps'] & {
|
|
12
|
+
'data-testid'?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export interface FilterSwitchProps extends Omit<ChakraRadioProps, 'inputProps'> {
|
|
16
|
+
inputProps?: RadioInputProps;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const FilterSwitch = forwardRef<FilterSwitchProps, 'input'>((props, ref) => {
|
|
20
|
+
const group = useRadioGroupContext();
|
|
21
|
+
const { value: valueProp } = props;
|
|
22
|
+
|
|
23
|
+
const styles = useMultiStyleConfig('FilterSwitch', { ...group, ...props });
|
|
24
|
+
|
|
25
|
+
const ownProps = omitThemingProps(props);
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
children,
|
|
29
|
+
inputProps: htmlInputProps,
|
|
30
|
+
isDisabled = group?.isDisabled,
|
|
31
|
+
isFocusable = group?.isFocusable,
|
|
32
|
+
...rest
|
|
33
|
+
} = ownProps;
|
|
34
|
+
|
|
35
|
+
const isChecked = group.value === valueProp;
|
|
36
|
+
|
|
37
|
+
const { name } = group;
|
|
38
|
+
|
|
39
|
+
const { getInputProps, getLabelProps, getRootProps, getCheckboxProps } = useRadio({
|
|
40
|
+
...rest,
|
|
41
|
+
isChecked,
|
|
42
|
+
isFocusable,
|
|
43
|
+
isDisabled,
|
|
44
|
+
onChange: group.onChange,
|
|
45
|
+
name,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<chakra.label {...getRootProps()} __css={styles.container}>
|
|
50
|
+
<chakra.input {...getInputProps(htmlInputProps, ref)} />
|
|
51
|
+
<chakra.span {...getCheckboxProps()} {...getLabelProps()} __css={styles.label}>
|
|
52
|
+
{children}
|
|
53
|
+
</chakra.span>
|
|
54
|
+
</chakra.label>
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export default FilterSwitch;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RadioGroup as ChakraRadioGroup, RadioGroupProps } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
export type { RadioGroupProps };
|
|
4
|
+
|
|
5
|
+
const FilterSwitchGroup = (props: RadioGroupProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<ChakraRadioGroup
|
|
8
|
+
display="flex"
|
|
9
|
+
{...props}
|
|
10
|
+
sx={{
|
|
11
|
+
label: {
|
|
12
|
+
_notFirst: {
|
|
13
|
+
borderLeftRadius: 0,
|
|
14
|
+
borderLeft: 'none',
|
|
15
|
+
},
|
|
16
|
+
_notLast: {
|
|
17
|
+
borderRightRadius: 0,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default FilterSwitchGroup;
|
package/src/index.ts
CHANGED
|
@@ -309,3 +309,8 @@ export { default as FileInput } from './Components/Form/FileInput/FileInput';
|
|
|
309
309
|
|
|
310
310
|
export type { ToggletipProps as ToggleTooltipProps } from './Components/Toggletip/Toggletip';
|
|
311
311
|
export { default as Toggletip } from './Components/Toggletip/Toggletip';
|
|
312
|
+
|
|
313
|
+
export type { FilterSwitchProps } from './Components/Form/FilterSwitch/FilterSwitch';
|
|
314
|
+
export { default as FilterSwitch } from './Components/Form/FilterSwitch/FilterSwitch';
|
|
315
|
+
|
|
316
|
+
export { default as FilterSwitchGroup } from './Components/Form/FilterSwitch/FilterSwitchGroup';
|
package/src/theme.ts
CHANGED
|
@@ -51,6 +51,7 @@ import sizes from './Foundations/Sizes/Sizes';
|
|
|
51
51
|
import typography from './Foundations/Typography/Typography';
|
|
52
52
|
import zIndices from './Foundations/Zindex/Zindex';
|
|
53
53
|
import Toggletip from './Components/Toggletip/Toggletip.theme';
|
|
54
|
+
import FilterSwitch from './Components/Form/FilterSwitch/FilterSwitch.theme';
|
|
54
55
|
|
|
55
56
|
const theme = {
|
|
56
57
|
config: {
|
|
@@ -100,6 +101,7 @@ const theme = {
|
|
|
100
101
|
Drawer,
|
|
101
102
|
Dropdown,
|
|
102
103
|
EmptyState,
|
|
104
|
+
FilterSwitch,
|
|
103
105
|
...Form,
|
|
104
106
|
Link,
|
|
105
107
|
List,
|