@bitrise/bitkit 10.11.2 → 10.12.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": "10.11.2",
4
+ "version": "10.12.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -124,3 +124,12 @@ export const InsideDialog = () => {
124
124
  </Provider>
125
125
  );
126
126
  };
127
+ export const WithIcon = () => {
128
+ return (
129
+ <Dropdown iconName="Calendar" defaultValue="daily">
130
+ <DropdownOption value="daily">Daily</DropdownOption>
131
+ <DropdownOption value="weekly">Weekly</DropdownOption>
132
+ <DropdownOption value="monthly">Monthly</DropdownOption>
133
+ </Dropdown>
134
+ );
135
+ };
@@ -86,6 +86,7 @@ const DropdownTheme = {
86
86
  height: '32',
87
87
  paddingLeft: '12',
88
88
  paddingRight: '12',
89
+ gap: '0.375rem',
89
90
  },
90
91
  },
91
92
  medium: {
@@ -94,6 +95,7 @@ const DropdownTheme = {
94
95
  height: '48',
95
96
  paddingLeft: '16',
96
97
  paddingRight: '16',
98
+ gap: '0.625rem',
97
99
  },
98
100
  },
99
101
  },
@@ -19,7 +19,7 @@ import {
19
19
  useMultiStyleConfig,
20
20
  } from '@chakra-ui/react';
21
21
  import { FloatingFocusManager } from '@floating-ui/react-dom-interactions';
22
- import Icon from '../Icon/Icon';
22
+ import Icon, { TypeIconName } from '../Icon/Icon';
23
23
  import { DropdownEventArgs, DropdownProvider, useDropdownContext, useDropdownStyles } from './Dropdown.context';
24
24
  import { DropdownOption, DropdownGroup, DropdownDetailedOption, DropdownOptionProps } from './DropdownOption';
25
25
  import DropdownButton from './DropdownButton';
@@ -101,6 +101,7 @@ export interface DropdownProps<T> extends ChakraProps {
101
101
  'aria-label'?: string;
102
102
  search?: ReactNode;
103
103
  children?: ReactNode;
104
+ iconName?: TypeIconName;
104
105
  }
105
106
 
106
107
  function useOptionListWithIndexes({ children }: { children: ReactNode }) {
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, ReactNode } from 'react';
2
2
  import { chakra, ChakraProps } from '@chakra-ui/react';
3
- import Icon from '../Icon/Icon';
3
+ import Icon, { TypeIconName } from '../Icon/Icon';
4
4
  import { useDropdownStyles } from './Dropdown.context';
5
5
 
6
6
  interface DropdownButtonProps extends ChakraProps {
@@ -10,17 +10,19 @@ interface DropdownButtonProps extends ChakraProps {
10
10
  formLabel?: ReactNode;
11
11
  size: 'medium' | 'small';
12
12
  children?: ReactNode;
13
+ iconName?: TypeIconName;
13
14
  }
14
15
  const DropdownButton = forwardRef<HTMLButtonElement, DropdownButtonProps>(
15
- ({ size, blurHandler, formLabel, readOnly, placeholder, children, ...rest }, ref) => {
16
+ ({ size, blurHandler, formLabel, readOnly, placeholder, children, iconName, ...rest }, ref) => {
16
17
  const { field, icon } = useDropdownStyles();
17
18
  const iconSize = size === 'medium' ? '24' : '16';
18
19
  return (
19
20
  <chakra.button aria-readonly={readOnly} type="button" ref={ref} onBlur={blurHandler} __css={field} {...rest}>
21
+ {iconName && <Icon aria-hidden="true" __css={icon} name={iconName} size={iconSize} />}
20
22
  <chakra.span overflow="hidden" textOverflow="ellipsis" whiteSpace="nowrap" flexGrow={1}>
21
23
  {formLabel || placeholder}
22
24
  </chakra.span>
23
- <Icon aria-hidden="true" __css={icon} name="DropdownArrows" fontSize={iconSize} size={iconSize} />
25
+ <Icon aria-hidden="true" __css={icon} name="DropdownArrows" size={iconSize} />
24
26
  </chakra.button>
25
27
  );
26
28
  },