@bitrise/bitkit 13.151.1-alpha.0 → 13.153.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "13.151.1-alpha.0",
4
+ "version": "13.153.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -249,6 +249,7 @@ const Dropdown = forwardRef<Element, DropdownProps<string | null>>(
249
249
  (
250
250
  {
251
251
  'aria-label': ariaLabel,
252
+ badge,
252
253
  buttonProps = {},
253
254
  'data-testid': dataTestid,
254
255
  defaultValue,
@@ -339,7 +340,12 @@ const Dropdown = forwardRef<Element, DropdownProps<string | null>>(
339
340
  {name && formValue && <input name={name} type="hidden" value={formValue} />}
340
341
  <DropdownProvider context={dropdownCtx} styles={dropdownStyles}>
341
342
  <FormControl {...props} isDisabled={disabled} isInvalid={isError} isRequired={required}>
342
- <FormLabel infoTooltipLabel={infoTooltipLabel} infoTooltipProps={infoTooltipProps} htmlFor={buttonId}>
343
+ <FormLabel
344
+ badge={badge}
345
+ infoTooltipLabel={infoTooltipLabel}
346
+ infoTooltipProps={infoTooltipProps}
347
+ htmlFor={buttonId}
348
+ >
343
349
  {label}
344
350
  </FormLabel>
345
351
  <DropdownButton
@@ -3,6 +3,7 @@ import { ChakraProps } from '@chakra-ui/react';
3
3
  import { UseFloatingProps } from '@floating-ui/react-dom-interactions';
4
4
  import { TypeIconName } from '../Icon/Icon';
5
5
  import { TooltipProps } from '../Tooltip/Tooltip';
6
+ import { FormLabelProps } from '../Form/FormLabel';
6
7
 
7
8
  type DropdownInstance<T> = { value: T; name?: string };
8
9
 
@@ -10,6 +11,7 @@ type DropdownChangeEventHandler<T> = (ev: { target: DropdownInstance<T> }) => vo
10
11
 
11
12
  export interface DropdownProps<T> extends ChakraProps {
12
13
  'aria-label'?: string;
14
+ badge?: FormLabelProps['badge'];
13
15
  buttonProps?: ChakraProps;
14
16
  children?: ReactNode;
15
17
  'data-testid'?: string;
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from 'react';
1
2
  import { FormLabelProps as ChakraFormLabelProps, FormLabel as ChakraFormLabel, forwardRef } from '@chakra-ui/react';
2
3
  import Text from '../Text/Text';
3
4
  import Tooltip, { TooltipProps } from '../Tooltip/Tooltip';
@@ -5,6 +6,7 @@ import Box from '../Box/Box';
5
6
  import Icon from '../Icon/Icon';
6
7
 
7
8
  export interface FormLabelProps extends ChakraFormLabelProps {
9
+ badge?: ReactNode;
8
10
  children?: string;
9
11
  infoTooltipLabel?: string;
10
12
  infoTooltipProps?: TooltipProps;
@@ -14,7 +16,7 @@ export interface FormLabelProps extends ChakraFormLabelProps {
14
16
  }
15
17
 
16
18
  const FormLabel = forwardRef<FormLabelProps, 'label'>((props, ref) => {
17
- const { infoTooltipLabel, infoTooltipProps, maxLength, valueLength, withCounter, ...rest } = props;
19
+ const { badge, infoTooltipLabel, infoTooltipProps, maxLength, valueLength, withCounter, ...rest } = props;
18
20
 
19
21
  const showLabel = rest.children || !!infoTooltipLabel || (withCounter && maxLength);
20
22
 
@@ -40,7 +42,10 @@ const FormLabel = forwardRef<FormLabelProps, 'label'>((props, ref) => {
40
42
  <Icon color="icon/tertiary" name="Info" size="16" />
41
43
  </Tooltip>
42
44
  )}
43
- {withCounter && maxLength && (
45
+ <Box as="span" alignSelf="flex-end" marginInlineStart="auto">
46
+ {badge}
47
+ </Box>
48
+ {!badge && withCounter && maxLength && (
44
49
  <Text
45
50
  as="span"
46
51
  color="text/secondary"
@@ -19,7 +19,7 @@ import {
19
19
  } from '@chakra-ui/react';
20
20
  import Icon, { TypeIconName } from '../../Icon/Icon';
21
21
  import { TooltipProps } from '../../Tooltip/Tooltip';
22
- import FormLabel from '../FormLabel';
22
+ import FormLabel, { FormLabelProps } from '../FormLabel';
23
23
 
24
24
  type UsedFormControlProps = Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'>;
25
25
  type UsedChakraInputProps = Pick<
@@ -41,6 +41,7 @@ type UsedChakraInputProps = Pick<
41
41
  | 'step'
42
42
  >;
43
43
  export interface InputProps extends UsedFormControlProps, UsedChakraInputProps {
44
+ badge?: FormLabelProps['badge'];
44
45
  'data-testid'?: string;
45
46
  errorText?: ReactNode;
46
47
  infoTooltipLabel?: string;
@@ -72,6 +73,7 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
72
73
  const {
73
74
  autoComplete,
74
75
  autoFocus,
76
+ badge,
75
77
  'data-testid': dataTestid,
76
78
  defaultValue,
77
79
  errorText,
@@ -165,6 +167,7 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
165
167
  return (
166
168
  <FormControl {...formControlProps}>
167
169
  <FormLabel
170
+ badge={badge}
168
171
  infoTooltipLabel={infoTooltipLabel}
169
172
  infoTooltipProps={infoTooltipProps}
170
173
  maxLength={maxLength}
@@ -11,11 +11,12 @@ import Icon from '../../Icon/Icon';
11
11
  import Box from '../../Box/Box';
12
12
  import Tag from '../../Tag/Tag';
13
13
  import Text from '../../Text/Text';
14
- import FormLabel from '../FormLabel';
14
+ import FormLabel, { FormLabelProps } from '../FormLabel';
15
15
  import { TooltipProps } from '../../Tooltip/Tooltip';
16
16
 
17
17
  type UsedFormControlProps = Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'>;
18
18
  export interface TagsInputProps extends UsedFormControlProps {
19
+ badge?: FormLabelProps['badge'];
19
20
  label?: string;
20
21
  placeholder?: string;
21
22
  value: string[];
@@ -32,6 +33,7 @@ export interface TagsInputProps extends UsedFormControlProps {
32
33
  }
33
34
 
34
35
  const TagsInput = ({
36
+ badge,
35
37
  errorText,
36
38
  helperText,
37
39
  infoTooltipLabel,
@@ -83,7 +85,7 @@ const TagsInput = ({
83
85
  return (
84
86
  <FormControl {...rest} isInvalid={isInvalid} isReadOnly={isReadOnly}>
85
87
  <Box alignItems="center" display={label || maxCount ? 'flex' : 'none'} gap="4" marginBlockEnd="4">
86
- <FormLabel infoTooltipLabel={infoTooltipLabel} infoTooltipProps={infoTooltipProps} htmlFor={id}>
88
+ <FormLabel badge={badge} infoTooltipLabel={infoTooltipLabel} infoTooltipProps={infoTooltipProps} htmlFor={id}>
87
89
  {label}
88
90
  </FormLabel>
89
91
 
@@ -27,6 +27,7 @@ type UsedChakraTextProps = Pick<
27
27
  >;
28
28
 
29
29
  export interface TextareaProps extends UsedFormControlProps, UsedChakraTextProps {
30
+ badge?: FormLabelProps['badge'];
30
31
  'data-testid'?: string;
31
32
  errorText?: string;
32
33
  infoTooltipLabel?: string;
@@ -48,6 +49,7 @@ const Textarea = forwardRef<TextareaProps, 'div'>((props, ref) => {
48
49
  const {
49
50
  autoComplete,
50
51
  autoFocus,
52
+ badge,
51
53
  'data-testid': dataTestid,
52
54
  errorText,
53
55
  helperText,
@@ -102,6 +104,7 @@ const Textarea = forwardRef<TextareaProps, 'div'>((props, ref) => {
102
104
  return (
103
105
  <FormControl {...formControlProps}>
104
106
  <FormLabel
107
+ badge={badge}
105
108
  infoTooltipLabel={infoTooltipLabel}
106
109
  infoTooltipProps={infoTooltipProps}
107
110
  maxLength={maxLength}
@@ -11,10 +11,11 @@ import {
11
11
  import Box from '../Box/Box';
12
12
  import Icon from '../Icon/Icon';
13
13
  import ProgressSpinner from '../ProgressSpinner/ProgressSpinner';
14
- import FormLabel from '../Form/FormLabel';
14
+ import FormLabel, { FormLabelProps } from '../Form/FormLabel';
15
15
  import { TooltipProps } from '../Tooltip/Tooltip';
16
16
 
17
17
  export interface SelectProps extends Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'> {
18
+ badge?: FormLabelProps['badge'];
18
19
  'data-testid'?: string;
19
20
  errorText?: string;
20
21
  helperText?: string;
@@ -33,6 +34,7 @@ export interface SelectProps extends Omit<FormControlProps, 'label' | 'onBlur' |
33
34
 
34
35
  const Select = forwardRef<SelectProps, 'div'>((props, ref) => {
35
36
  const {
37
+ badge,
36
38
  children,
37
39
  'data-testid': dataTestid,
38
40
  defaultValue,
@@ -87,7 +89,7 @@ const Select = forwardRef<SelectProps, 'div'>((props, ref) => {
87
89
 
88
90
  return (
89
91
  <FormControl {...formControlProps}>
90
- <FormLabel infoTooltipLabel={infoTooltipLabel} infoTooltipProps={infoTooltipProps}>
92
+ <FormLabel badge={badge} infoTooltipLabel={infoTooltipLabel} infoTooltipProps={infoTooltipProps}>
91
93
  {label}
92
94
  </FormLabel>
93
95
  <Box sx={style.selectContainer}>
package/src/index.ts CHANGED
@@ -358,6 +358,9 @@ export { default as DataWidgetItem } from './Components/DataWidget/DataWidgetIte
358
358
  export type { LabelProps } from './Components/Label/Label';
359
359
  export { default as Label } from './Components/Label/Label';
360
360
 
361
+ export type { FormLabelProps } from './Components/Form/FormLabel';
362
+ export { default as FormLabel } from './Components/Form/FormLabel';
363
+
361
364
  export {
362
365
  default as SettingsCard,
363
366
  SettingsCardData,