@bitrise/bitkit 13.6.0 → 13.8.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.6.0",
4
+ "version": "13.8.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -33,7 +33,7 @@
33
33
  "@chakra-ui/theme": "^3.3.1",
34
34
  "@chakra-ui/theme-tools": "^2.1.2",
35
35
  "@chakra-ui/utils": "^2.0.15",
36
- "@emotion/react": "^11.11.3",
36
+ "@emotion/react": "^11.11.4",
37
37
  "@emotion/styled": "^11.11.0",
38
38
  "@floating-ui/react-dom-interactions": "^0.8.1",
39
39
  "@fontsource/figtree": "^5.0.18",
@@ -42,8 +42,8 @@
42
42
  "luxon": "^3.4.4",
43
43
  "react": "^18.2.0",
44
44
  "react-dom": "^18.2.0",
45
- "react-focus-lock": "^2.11.1",
46
- "react-imask": "^7.4.0",
45
+ "react-focus-lock": "^2.11.2",
46
+ "react-imask": "^7.5.0",
47
47
  "react-markdown": "^9.0.1"
48
48
  },
49
49
  "peerDependencies": {
@@ -73,12 +73,12 @@
73
73
  "@testing-library/user-event": "^14.5.2",
74
74
  "@types/jest": "^29.5.12",
75
75
  "@types/luxon": "^3.4.2",
76
- "@types/react": "^18.2.58",
76
+ "@types/react": "^18.2.60",
77
77
  "@types/react-dom": "^18.2.19",
78
- "@typescript-eslint/eslint-plugin": "^7.0.2",
79
- "@typescript-eslint/parser": "^7.0.2",
78
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
79
+ "@typescript-eslint/parser": "^7.1.0",
80
80
  "axios": "^1.6.7",
81
- "eslint": "^8.56.0",
81
+ "eslint": "^8.57.0",
82
82
  "glob": "^10.3.10",
83
83
  "jest": "^29.7.0",
84
84
  "jest-environment-jsdom": "^29.7.0",
@@ -2,19 +2,22 @@ import { defineStyle, defineStyleConfig, SystemStyleInterpolation } from '@chakr
2
2
  import { rem } from '../../utils/utils';
3
3
  import { ButtonProps } from './Button';
4
4
 
5
+ const ignoreSsrWarning =
6
+ '/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */';
7
+
5
8
  const baseStyle = defineStyle((props) => {
6
- const style: any = {
9
+ const style: SystemStyleInterpolation = {
7
10
  borderRadius: '4',
8
11
  '.chakra-button__group[data-attached][data-orientation=horizontal] > &': {
9
12
  borderRadius: 0,
10
- ':first-child': {
13
+ [`:first-child${ignoreSsrWarning}`]: {
11
14
  borderLeftRadius: '4',
12
15
  },
13
16
  // Selects the last .chakra-button item even is there an another element after that (eg menu)
14
17
  '&:not(:has(~ .chakra-button))': {
15
18
  borderRightRadius: '4',
16
19
  },
17
- '&:not(:first-child)': {
20
+ [`&:not(:first-child)${ignoreSsrWarning}`]: {
18
21
  ...(props.variant.includes('primary')
19
22
  ? {
20
23
  _before: {
@@ -1,4 +1,9 @@
1
- import { Checkbox as ChakraCheckbox, CheckboxProps as ChakraCheckboxProps, forwardRef } from '@chakra-ui/react';
1
+ import {
2
+ Checkbox as ChakraCheckbox,
3
+ CheckboxProps as ChakraCheckboxProps,
4
+ CheckboxIconProps,
5
+ forwardRef,
6
+ } from '@chakra-ui/react';
2
7
  import Icon from '../../Icon/Icon';
3
8
 
4
9
  type CheckboxInputProps = ChakraCheckboxProps['inputProps'] & {
@@ -9,7 +14,7 @@ export interface CheckboxProps extends Omit<ChakraCheckboxProps, 'icon' | 'iconC
9
14
  inputProps?: CheckboxInputProps;
10
15
  }
11
16
 
12
- const CustomIcon = (props: any) => {
17
+ const CustomIcon = (props: CheckboxIconProps) => {
13
18
  // eslint-disable-next-line @typescript-eslint/naming-convention
14
19
  const { __css, isChecked, isIndeterminate } = props;
15
20
  if (!isChecked) {
@@ -157,7 +157,7 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
157
157
  (Optional)
158
158
  </Text>
159
159
  }
160
- requiredIndicator={null as any}
160
+ requiredIndicator={null}
161
161
  >
162
162
  {label}
163
163
  </FormLabel>
@@ -112,7 +112,7 @@ const Textarea = forwardRef<TextareaProps, 'div'>((props, ref) => {
112
112
  (Optional)
113
113
  </Text>
114
114
  }
115
- requiredIndicator={null as any}
115
+ requiredIndicator={null}
116
116
  >
117
117
  {label}
118
118
  </FormLabel>
@@ -83,7 +83,7 @@ const Select = forwardRef<SelectProps, 'div'>((props, ref) => {
83
83
  (Optional)
84
84
  </Text>
85
85
  }
86
- requiredIndicator={null as any}
86
+ requiredIndicator={null}
87
87
  >
88
88
  {label}
89
89
  </FormLabel>
@@ -1,5 +1,4 @@
1
1
  import Alert from './Alert/Alert.theme';
2
- import Accordion from './AccordionLegacy/Accordion.theme';
3
2
  import Avatar from './Avatar/Avatar.theme';
4
3
  import Badge from './Badge/Badge.theme';
5
4
  import Breadcrumb from './Breadcrumb/Breadcrumb.theme';
@@ -49,7 +48,6 @@ import FilterSwitch from './Filter/FilterSwitch/FilterSwitch.theme';
49
48
  import TagsInput from './Form/TagsInput/TagsInput.theme';
50
49
 
51
50
  const components = {
52
- Accordion,
53
51
  Avatar,
54
52
  Badge,
55
53
  Breadcrumb,
package/src/index.ts CHANGED
@@ -163,12 +163,6 @@ export { default as Accordion } from './Components/Accordion/Accordion';
163
163
  export type { AccordionItemProps } from './Components/Accordion/AccordionItem';
164
164
  export { default as AccordionItem } from './Components/Accordion/AccordionItem';
165
165
 
166
- export type { LegacyAccordionProps } from './Components/AccordionLegacy/LegacyAccordion';
167
- export { default as LegacyAccordion } from './Components/AccordionLegacy/LegacyAccordion';
168
-
169
- export type { LegacyAccordionItemProps } from './Components/AccordionLegacy/LegacyAccordionItem';
170
- export { default as LegacyAccordionItem } from './Components/AccordionLegacy/LegacyAccordionItem';
171
-
172
166
  export type { LightBoxProps } from './Components/LightBox/LightBox';
173
167
  export { default as LightBox } from './Components/LightBox/LightBox';
174
168
 
@@ -36,17 +36,3 @@ export function useDebounce<T>(value: T, delay?: number): T {
36
36
 
37
37
  return debouncedValue;
38
38
  }
39
-
40
- export function isObject(value: any): boolean {
41
- return typeof value === 'object' && value !== null && !Array.isArray(value);
42
- }
43
-
44
- export function getTokenValue(tokenString: string, tokenObject: any) {
45
- let returnValue = {};
46
- try {
47
- returnValue = tokenString.split('.').reduce((o, i) => o[i], tokenObject);
48
- } catch (e) {
49
- returnValue = {};
50
- }
51
- return isObject(returnValue) ? returnValue : {};
52
- }
@@ -1,163 +0,0 @@
1
- import { StyleFunctionProps, SystemStyleObject } from '@chakra-ui/styled-system';
2
- import type { ComponentStyleConfig } from '@chakra-ui/theme';
3
-
4
- type ColorObj = {
5
- [key: string]: {
6
- enabledButton: string;
7
- disabledButton: string;
8
- enabledIcon: string;
9
- disabledIcon: string;
10
- hover: string;
11
- border: string;
12
- };
13
- };
14
-
15
- type VariantObj = {
16
- [key: string]: {
17
- borderRadius: string;
18
- marginBottom: string;
19
- border?: string;
20
- };
21
- };
22
-
23
- const buttonStyle = {
24
- alignItems: 'center',
25
- borderBottom: '1px solid',
26
- display: 'flex',
27
- justifyContent: 'space-between',
28
- padding: '16',
29
- width: '100%',
30
- };
31
-
32
- const iconStyle = {
33
- height: '24',
34
- marginLeft: '16',
35
- width: '24',
36
- };
37
-
38
- const colors: ColorObj = {
39
- gray: {
40
- border: 'neutral.93',
41
- disabledButton: 'neutral.95',
42
- disabledIcon: 'currentColor',
43
- enabledButton: 'neutral.95',
44
- enabledIcon: 'currentColor',
45
- hover: 'purple.95',
46
- },
47
- orange: {
48
- border: 'orange.90',
49
- disabledButton: 'orange.93',
50
- disabledIcon: 'orange.80',
51
- enabledButton: 'orange.93',
52
- enabledIcon: 'orange.10',
53
- hover: 'orange.93',
54
- },
55
- white: {
56
- border: 'neutral.93',
57
- disabledButton: 'neutral.100',
58
- disabledIcon: 'currentColor',
59
- enabledButton: 'neutral.100',
60
- enabledIcon: 'currentColor',
61
- hover: 'purple.95',
62
- },
63
- };
64
-
65
- const variants: VariantObj = {
66
- flat: {
67
- borderRadius: '0',
68
- marginBottom: '16',
69
- },
70
- legacy: {
71
- borderRadius: '8',
72
- marginBottom: '16',
73
- },
74
- };
75
-
76
- const LegacyBaseStyle: ({
77
- colorScheme,
78
- variant,
79
- }: Pick<StyleFunctionProps, 'colorScheme' | 'variant'>) => SystemStyleObject = ({ colorScheme, variant }) => ({
80
- disabledButton: {
81
- ...buttonStyle,
82
- background: colors[colorScheme].disabledButton,
83
- borderColor: colors[colorScheme].border,
84
- borderRadius: variants[variant].borderRadius,
85
- cursor: 'default',
86
- },
87
- disabledIcon: {
88
- ...iconStyle,
89
- color: colors[colorScheme].disabledIcon,
90
- opacity: '0.4',
91
- transform: 'none',
92
- },
93
- enabledButton: {
94
- ...buttonStyle,
95
- _expanded: {
96
- borderBottomLeftRadius: '0',
97
- borderBottomRightRadius: '0',
98
- },
99
- _hover: {
100
- background: colors[colorScheme].hover,
101
- },
102
- background: colors[colorScheme].enabledButton,
103
- borderColor: colors[colorScheme].border,
104
- borderRadius: variants[variant].borderRadius,
105
- },
106
- enabledIcon: {
107
- ...iconStyle,
108
- color: colors[colorScheme].enabledIcon,
109
- },
110
- item: {
111
- _last: {
112
- marginBottom: 0,
113
- },
114
- border: variants[variant].border ?? '1px solid',
115
- borderColor: colors[colorScheme].border,
116
- borderRadius: variants[variant].borderRadius,
117
- marginBottom: variants[variant].marginBottom,
118
- },
119
- panel: {
120
- padding: '16',
121
- },
122
- });
123
-
124
- const BaseStyle: () => SystemStyleObject = () => ({
125
- button: {
126
- _active: {
127
- background: 'neutral.90',
128
- },
129
- _hover: {
130
- background: 'neutral.93',
131
- },
132
- alignItems: 'center',
133
- borderColor: 'neutral.93',
134
- display: 'flex',
135
- justifyContent: 'space-between',
136
- padding: '16',
137
- width: '100%',
138
- },
139
- icon: {
140
- height: '24',
141
- marginLeft: '16',
142
- width: '24',
143
- },
144
- item: {
145
- borderTop: '1px solid',
146
- borderTopColor: 'neutral.90',
147
- },
148
- panel: {
149
- padding: '16',
150
- },
151
- root: {
152
- borderBottom: '1px solid',
153
- borderBottomColor: 'neutral.90',
154
- },
155
- });
156
-
157
- const AccordionTheme: ComponentStyleConfig = {
158
- baseStyle: ({ colorScheme, variant }) => {
159
- return variant === 'legacy' || variant === 'flat' ? LegacyBaseStyle({ colorScheme, variant }) : BaseStyle();
160
- },
161
- };
162
-
163
- export default AccordionTheme;
@@ -1,62 +0,0 @@
1
- import { Children } from 'react';
2
- import {
3
- Accordion as ChakraAccordion,
4
- AccordionProps as ChakraAccordionProps,
5
- UseAccordionProps,
6
- usePrefersReducedMotion,
7
- } from '@chakra-ui/react';
8
-
9
- type ExpandedIndex = NonNullable<UseAccordionProps['index']>;
10
-
11
- export interface LegacyAccordionProps extends Omit<ChakraAccordionProps, 'onChange'> {
12
- colorScheme?: 'white' | 'gray' | 'orange';
13
- variant?: 'flat' | 'legacy';
14
- onChange?: (ids: string[], indexes: number[]) => void;
15
- }
16
-
17
- const getItemIds = (props: LegacyAccordionProps) => {
18
- const ids: string[] = [];
19
- const items = Children.toArray(props.children);
20
- items.forEach((item: any, index: number) => {
21
- ids[index] = item?.props?.id;
22
- });
23
- return ids;
24
- };
25
-
26
- /**
27
- * Accordions display a list of high-level options that can expand/collapse to reveal more information.
28
- */
29
- const LegacyAccordion = (props: LegacyAccordionProps) => {
30
- const prefersReducedMotion = usePrefersReducedMotion({ ssr: false });
31
- const { children, colorScheme, onChange, variant, ...rest } = props;
32
- const itemIds = getItemIds(props);
33
-
34
- const onAccordionChange = (indexes: ExpandedIndex) => {
35
- if (onChange) {
36
- const indexArray = Object.values(indexes).sort();
37
- onChange(
38
- indexArray.map((i: number) => itemIds[i]),
39
- indexArray,
40
- );
41
- }
42
- };
43
-
44
- return (
45
- <ChakraAccordion
46
- allowMultiple
47
- colorScheme={colorScheme}
48
- onChange={onAccordionChange}
49
- reduceMotion={prefersReducedMotion}
50
- variant={variant}
51
- {...rest}
52
- >
53
- {children}
54
- </ChakraAccordion>
55
- );
56
- };
57
-
58
- LegacyAccordion.defaultProps = {
59
- colorScheme: 'white',
60
- variant: 'legacy',
61
- };
62
- export default LegacyAccordion;
@@ -1,34 +0,0 @@
1
- import { isValidElement, ReactNode } from 'react';
2
- import {
3
- AccordionButton,
4
- AccordionIcon,
5
- AccordionItem as ChakraAccordionItem,
6
- AccordionItemProps as ChakraAccordionItemProps,
7
- AccordionPanel,
8
- AccordionPanelProps,
9
- useAccordionStyles,
10
- } from '@chakra-ui/react';
11
- import Text from '../Text/Text';
12
-
13
- export interface LegacyAccordionItemProps extends AccordionPanelProps {
14
- buttonContent: ReactNode;
15
- children?: ReactNode;
16
- id?: ChakraAccordionItemProps['id'];
17
- }
18
-
19
- const LegacyAccordionItem = (props: LegacyAccordionItemProps) => {
20
- const { buttonContent, children, id, ...rest } = props;
21
- const styles = useAccordionStyles();
22
-
23
- return (
24
- <ChakraAccordionItem id={id} sx={styles.item}>
25
- <AccordionButton sx={children ? styles.enabledButton : styles.disabledButton}>
26
- {isValidElement(buttonContent) ? buttonContent : <Text as="span">{buttonContent}</Text>}
27
- <AccordionIcon sx={children ? styles.enabledIcon : styles.disabledIcon} />
28
- </AccordionButton>
29
- {!!children && <AccordionPanel {...rest}>{children}</AccordionPanel>}
30
- </ChakraAccordionItem>
31
- );
32
- };
33
-
34
- export default LegacyAccordionItem;