@codeleap/web 3.1.1 → 3.2.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.
Files changed (41) hide show
  1. package/package.json +13 -10
  2. package/src/components/ActionIcon/index.tsx +24 -15
  3. package/src/components/ActivityIndicator/index.tsx +39 -46
  4. package/src/components/ActivityIndicator/styles.ts +7 -11
  5. package/src/components/Button/index.tsx +17 -21
  6. package/src/components/Checkbox/index.tsx +103 -96
  7. package/src/components/Collapse/index.tsx +4 -3
  8. package/src/components/Drawer/index.tsx +25 -17
  9. package/src/components/FileInput.tsx +60 -32
  10. package/src/components/Icon/index.tsx +6 -5
  11. package/src/components/InputBase/index.tsx +9 -4
  12. package/src/components/InputBase/types.ts +1 -0
  13. package/src/components/List/index.tsx +3 -0
  14. package/src/components/LoadingOverlay/index.tsx +36 -23
  15. package/src/components/Modal/index.tsx +260 -88
  16. package/src/components/Modal/styles.ts +3 -4
  17. package/src/components/NumberIncrement/index.tsx +2 -0
  18. package/src/components/Overlay/index.tsx +11 -10
  19. package/src/components/Pager/index.tsx +166 -0
  20. package/src/components/Pager/styles.ts +14 -0
  21. package/src/components/RadioInput/index.tsx +21 -19
  22. package/src/components/Scroll/index.tsx +6 -3
  23. package/src/components/SegmentedControl/SegmentedControlOption.tsx +78 -0
  24. package/src/components/SegmentedControl/index.tsx +161 -0
  25. package/src/components/SegmentedControl/styles.ts +26 -0
  26. package/src/components/Select/index.tsx +13 -11
  27. package/src/components/Select/types.ts +23 -23
  28. package/src/components/Slider/index.tsx +77 -72
  29. package/src/components/Switch/index.tsx +96 -93
  30. package/src/components/Text/index.tsx +18 -33
  31. package/src/components/TextInput/index.tsx +14 -8
  32. package/src/components/Tooltip/index.tsx +1 -1
  33. package/src/components/Touchable/index.tsx +16 -18
  34. package/src/components/View/index.tsx +49 -25
  35. package/src/components/View/styles.ts +0 -1
  36. package/src/components/components.ts +2 -2
  37. package/src/components/defaultStyles.ts +16 -3
  38. package/src/lib/OSAlert.tsx +1 -1
  39. package/src/types/utility.ts +31 -2
  40. package/src/components/Link/index.tsx +0 -69
  41. package/src/components/Link/styles.ts +0 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/web",
3
- "version": "3.1.1",
3
+ "version": "3.2.1",
4
4
  "main": "src/index.ts",
5
5
  "repository": {
6
6
  "url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
@@ -10,8 +10,10 @@
10
10
  "license": "UNLICENSED",
11
11
  "devDependencies": {
12
12
  "@codeleap/config": "*",
13
- "@emotion/react": "11.10.6",
14
- "@types/react-window": "1.8.5"
13
+ "@types/react-slick": "^0.23.10",
14
+ "@types/react-window": "1.8.5",
15
+ "@emotion/react": "link:../../apps/web/node_modules/@emotion/react",
16
+ "react": "link:../../apps/web/node_modules/react"
15
17
  },
16
18
  "scripts": {
17
19
  "build": "rm -rf ./dist && tsc --build",
@@ -23,26 +25,27 @@
23
25
  "js-cookie": "^3.0.1",
24
26
  "rc-slider": "^9.7.5",
25
27
  "react-autosize-textarea": "^7.1.0",
26
- "react-number-format": "^5.2.1",
27
28
  "react-input-mask": "^2.0.4",
29
+ "react-number-format": "^5.2.1",
30
+ "react-select": "^5.7.3",
31
+ "react-slick": "^0.29.0",
28
32
  "react-toastify": "^8.2.0",
29
33
  "react-virtualized-auto-sizer": "^1.0.6",
30
34
  "react-window": "1.8.5",
35
+ "slick-carousel": "^1.8.1",
31
36
  "url-parse": "^1.5.10",
32
- "uuid": "^8.3.2",
33
- "react-select": "^5.7.3"
37
+ "uuid": "^8.3.2"
34
38
  },
35
39
  "peerDependencies": {
36
40
  "@codeleap/common": "*",
37
- "@emotion/css": "11.9.0",
38
- "@emotion/react": "11.10.6",
39
41
  "@reach/router": "^1.3.4",
40
- "axios": "^1.1.3",
42
+ "axios": "1.3.5",
41
43
  "gatsby-plugin-intl": "^0.3.3",
42
44
  "react": "18.1.0",
43
45
  "react-dom": "18.1.0",
44
46
  "react-helmet": "^6.1.0",
45
47
  "react-select": "*",
46
- "typescript": "4.5.4"
48
+ "typescript": "4.5.4",
49
+ "@emotion/react": "11.10.6"
47
50
  }
48
51
  }
@@ -1,25 +1,27 @@
1
- import React from 'react'
2
- import { ComponentVariants, TypeGuards, useDefaultComponentStyle } from '@codeleap/common'
1
+ /** @jsx jsx */
2
+ import { jsx, CSSObject } from '@emotion/react'
3
+
4
+ import { ComponentVariants, PropsOf, TypeGuards, useDefaultComponentStyle } from '@codeleap/common'
3
5
  import { StylesOf } from '../../types'
4
6
  import { Icon, IconProps } from '../Icon'
5
- import { Touchable, TouchableProps } from '../Touchable'
7
+ import { Touchable } from '../Touchable'
6
8
  import { View } from '../View'
7
9
  import { ActionIconComposition, ActionIconPresets } from './styles'
8
10
 
9
11
  export type ActionIconProps = {
10
- disabled?: boolean
11
12
  iconProps?: Partial<IconProps>
12
13
  icon?: IconProps['name']
13
14
  name?: IconProps['name']
15
+ action?: () => void
14
16
  styles?: StylesOf<ActionIconComposition>
15
- } & Omit<TouchableProps, 'styles' | 'variants'> & ComponentVariants<typeof ActionIconPresets>
17
+ } & Omit<PropsOf<typeof Touchable>, 'styles' | 'variants'> & ComponentVariants<typeof ActionIconPresets>
16
18
 
17
- export const ActionIcon:React.FC<ActionIconProps> = (props) => {
19
+ export const ActionIcon = (props:ActionIconProps) => {
18
20
  const { icon, name, iconProps, onPress, variants, styles, children, disabled, ...touchableProps } = props
19
-
21
+
20
22
  const variantStyles = useDefaultComponentStyle<'u:ActionIcon', typeof ActionIconPresets>('u:ActionIcon', {
21
- variants,
22
- styles
23
+ variants,
24
+ styles,
23
25
  })
24
26
 
25
27
  const isPressable = TypeGuards.isFunction(onPress) && !disabled
@@ -31,25 +33,32 @@ export const ActionIcon:React.FC<ActionIconProps> = (props) => {
31
33
 
32
34
  if (onPress) onPress?.()
33
35
  }
34
-
36
+
35
37
  return (
36
- <WrapperComponent
38
+ // @ts-ignore
39
+ <WrapperComponent
37
40
  onPress={handlePress}
38
41
  css={[
39
42
  variantStyles.wrapper,
40
43
  disabled && variantStyles['wrapper:disabled'],
41
- isPressable && variantStyles['wrapper:cursor']
44
+ isPressable && variantStyles['wrapper:cursor'],
42
45
  ]}
43
46
  disabled={disabled}
47
+ {
48
+ ...(isPressable && {
49
+ onPress: handlePress,
50
+ })
51
+ }
44
52
  {...touchableProps}
45
53
  >
46
- <Icon
47
- name={icon ?? name}
54
+ <Icon
55
+ name={icon ?? name}
56
+ {...iconProps}
57
+ // @ts-ignore
48
58
  css={[
49
59
  variantStyles.icon,
50
60
  disabled && variantStyles['icon:disabled'],
51
61
  ]}
52
- {...iconProps}
53
62
  />
54
63
  {children}
55
64
  </WrapperComponent>
@@ -1,78 +1,71 @@
1
1
  import { View } from '../View'
2
- import { CSSObject, keyframes } from '@emotion/react'
2
+ import React from 'react'
3
3
  import {
4
4
  useDefaultComponentStyle,
5
5
  ComponentVariants,
6
6
  ActivityIndicatorStyles,
7
7
  ActivityIndicatorComposition,
8
+ StylesOf,
8
9
  TypeGuards,
9
10
  } from '@codeleap/common'
10
- import { StylesOf } from '../../types/utility'
11
11
  import { ActivityIndicatorPresets } from './styles'
12
+ import { CSSInterpolation } from '@emotion/css'
13
+ import { ComponentWithDefaultProps } from '../../types'
12
14
 
13
15
  export * from './styles'
14
16
 
15
- const spin = keyframes`
16
- from {
17
- transform: rotate(0deg);
18
- }
19
- to {
20
- transform: rotate(360deg);
21
- }
22
- `
23
-
24
17
  export type ActivityIndicatorProps = {
25
- animating?: boolean
26
- hidesWhenStopped?: boolean
18
+ style?: React.CSSProperties
27
19
  styles?: StylesOf<ActivityIndicatorComposition>
28
- css?: CSSObject
20
+ css?: CSSInterpolation | CSSInterpolation[]
21
+ component?: React.ComponentType<Omit<ActivityIndicatorProps & {ref?: React.Ref<any>}, 'component'>>
29
22
  size?: number
30
23
  } & ComponentVariants<typeof ActivityIndicatorStyles>
31
24
 
32
- export const ActivityIndicator: React.FC<ActivityIndicatorProps> = (props) => {
25
+ export const ActivityIndicator = React.forwardRef<typeof View, ActivityIndicatorProps>((activityIndicatorProps, ref) => {
26
+ const allProps = {
27
+ ...ActivityIndicator.defaultProps,
28
+ ...activityIndicatorProps,
29
+ }
30
+
33
31
  const {
34
- animating = true,
35
- hidesWhenStopped = true,
36
- variants,
37
- responsiveVariants,
38
- styles,
39
- size = null,
40
- ...viewProps
41
- } = props
32
+ style = {},
33
+ styles = {},
34
+ component: Component,
35
+ variants = [],
36
+ responsiveVariants = {},
37
+ size,
38
+ ...props
39
+ } = allProps
42
40
 
43
41
  const variantStyles = useDefaultComponentStyle<'u:ActivityIndicator', typeof ActivityIndicatorPresets>(
44
42
  'u:ActivityIndicator',
45
43
  {
44
+ variants,
46
45
  styles,
47
46
  responsiveVariants,
48
- variants,
49
- }
47
+ },
50
48
  )
51
49
 
52
- const _size = TypeGuards.isNumber(size) && {
53
- height: size,
54
- width: size,
55
- borderWidth: size * 0.25,
56
- }
50
+ const _size = React.useMemo(() => {
51
+ return TypeGuards.isNumber(size) ? {
52
+ width: size,
53
+ height: size,
54
+ } : {}
55
+ }, [size])
57
56
 
58
57
  return (
59
- <View
60
- {...viewProps}
61
- css={[
62
- variantStyles.wrapper,
63
- (!animating && hidesWhenStopped) && { visibility: 'hidden' },
64
- _size,
65
- ]}
66
- >
67
- <View css={{ ...variantStyles.circle, ...variantStyles.backCircle }} />
68
- <View
69
- css={{
70
- ...variantStyles.circle,
71
- ...variantStyles.frontCircle,
72
- animation: `${spin} 1s infinite`,
73
- animationPlayState: animating ? 'running' : 'paused',
74
- }}
58
+ <View css={[variantStyles.wrapper, style, _size]}>
59
+ <Component
60
+ ref={ref}
61
+ css={[variantStyles.wrapper, _size]}
62
+ {...props}
75
63
  />
76
64
  </View>
77
65
  )
66
+ }) as ComponentWithDefaultProps<ActivityIndicatorProps>
67
+
68
+ ActivityIndicator.defaultProps = {
69
+ component: View,
70
+ size: null,
78
71
  }
@@ -1,11 +1,7 @@
1
- import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
-
3
- export type ActivityIndicatorComposition =
4
- | 'wrapper'
5
- | 'backCircle'
6
- | 'frontCircle'
7
- | 'circle'
8
-
9
- const createActivityIndicatorStyle = createDefaultVariantFactory<ActivityIndicatorComposition>()
10
-
11
- export const ActivityIndicatorPresets = includePresets((styles) => createActivityIndicatorStyle(() => ({ wrapper: styles })))
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
+
3
+ export type ActivityIndicatorComposition = 'wrapper'
4
+
5
+ const createActivityIndicatorStyle = createDefaultVariantFactory<ActivityIndicatorComposition>()
6
+
7
+ export const ActivityIndicatorPresets = includePresets((styles) => createActivityIndicatorStyle(() => ({ wrapper: styles })))
@@ -1,5 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react'
3
+
3
4
  import {
4
5
  useDefaultComponentStyle,
5
6
  ButtonStyles,
@@ -8,19 +9,21 @@ import {
8
9
  ButtonParts,
9
10
  optionalObject,
10
11
  AnyFunction,
12
+ EnhancedTheme,
13
+ ComponentStyleMap,
14
+ CommonVariantObject,
15
+ AppTheme,
11
16
  } from '@codeleap/common'
12
- import React, { ComponentPropsWithRef } from 'react'
17
+ import React from 'react'
13
18
  import { StylesOf } from '../../types/utility'
14
19
  import { Text } from '../Text'
15
20
  import { Touchable, TouchableProps } from '../Touchable'
16
21
  import { Icon } from '../Icon'
17
- import { ActivityIndicator } from '../ActivityIndicator'
18
22
  import { IconPlaceholder, useNestedStylesByKey } from '@codeleap/common'
19
23
  import { LoadingOverlay } from '../LoadingOverlay'
24
+ import { ActivityIndicator } from '../ActivityIndicator'
20
25
 
21
- type NativeButtonProps = ComponentPropsWithRef<'button'>
22
-
23
- export type ButtonProps = NativeButtonProps &
26
+ export type ButtonProps =
24
27
  ComponentVariants<typeof ButtonStyles> & {
25
28
  text?: string
26
29
  rightIcon?: IconPlaceholder
@@ -28,11 +31,11 @@ export type ButtonProps = NativeButtonProps &
28
31
  onPress?: AnyFunction
29
32
  styles?: StylesOf<ButtonComposition>
30
33
  loading?: boolean
31
- debugName?: string
34
+ debugName: string
32
35
  debounce?: number
33
- } & Partial<TouchableProps<any>>
36
+ } & Partial<TouchableProps<'button'>>
34
37
 
35
- export const Button: React.FC<ButtonProps> = (buttonProps) => {
38
+ export const Button = (buttonProps:ButtonProps) => {
36
39
  const {
37
40
  variants = [],
38
41
  responsiveVariants = {},
@@ -47,6 +50,7 @@ export const Button: React.FC<ButtonProps> = (buttonProps) => {
47
50
  debounce = 600,
48
51
  ...props
49
52
  } = buttonProps
53
+
50
54
  const [pressed, setPressed] = React.useState(false)
51
55
  const variantStyles = useDefaultComponentStyle('Button', {
52
56
  responsiveVariants,
@@ -54,7 +58,7 @@ export const Button: React.FC<ButtonProps> = (buttonProps) => {
54
58
  styles,
55
59
  })
56
60
 
57
- function handlePress(e: Parameters<ButtonProps['onPress']>[0]) {
61
+ function handlePress(e?: Parameters<ButtonProps['onPress']>[0]) {
58
62
  if (!pressed) {
59
63
  props?.onClick?.(e)
60
64
 
@@ -82,14 +86,13 @@ export const Button: React.FC<ButtonProps> = (buttonProps) => {
82
86
  css={getStyles('wrapper')}
83
87
  component='button'
84
88
  debugComponent='Button'
85
-
86
- onPress={handlePress}
87
89
  {...props}
90
+ onPress={null}
91
+ onClick={handlePress}
88
92
  >
89
93
  <LoadingOverlay
90
94
  visible={loading}
91
95
  styles={loaderStyle}
92
-
93
96
  />
94
97
  {!loading && (
95
98
  <Icon
@@ -101,9 +104,7 @@ export const Button: React.FC<ButtonProps> = (buttonProps) => {
101
104
  {children || (
102
105
  <Text
103
106
  text={text}
104
- styles={{
105
- text: getStyles('text'),
106
- }}
107
+ css={getStyles('text')}
107
108
  />
108
109
  )}
109
110
 
@@ -112,12 +113,7 @@ export const Button: React.FC<ButtonProps> = (buttonProps) => {
112
113
  style={{ ...iconStyle, ...getStyles('rightIcon') }}
113
114
 
114
115
  />
115
- {loading && <ActivityIndicator styles={{
116
- 'wrapper': getStyles('loaderWrapper'),
117
- 'backCircle': getStyles('loaderBackCircle'),
118
- 'frontCircle': getStyles('loaderFrontCircle'),
119
- 'circle': getStyles('loaderCircle'),
120
- }} css={getStyles('loader')}/>}
116
+ {loading && <ActivityIndicator css={{ display: 'none' }} />}
121
117
  </Touchable>
122
118
  )
123
119
  }
@@ -1,4 +1,5 @@
1
- import * as React from 'react'
1
+ /** @jsx jsx */
2
+ import { jsx, CSSObject } from '@emotion/react'
2
3
  import {
3
4
  ComponentVariants,
4
5
  useDefaultComponentStyle,
@@ -13,11 +14,11 @@ import { Icon } from '../Icon'
13
14
  import { motion } from 'framer-motion'
14
15
 
15
16
  export * from './styles'
16
-
17
+
17
18
  export type CheckboxProps = Pick<
18
19
  InputBaseProps,
19
20
  'debugName' | 'disabled' | 'label'
20
- > & {
21
+ > & {
21
22
  variants?: ComponentVariants<typeof CheckboxPresets>['variants']
22
23
  styles?: StylesOf<CheckboxComposition>
23
24
  value: boolean
@@ -29,110 +30,116 @@ export type CheckboxProps = Pick<
29
30
  const reversedOrder = [...InputBaseDefaultOrder].reverse()
30
31
 
31
32
  export const Checkbox = (props: CheckboxProps) => {
32
- const {
33
- inputBaseProps,
34
- others
35
- } = selectInputBaseProps(props)
33
+ const {
34
+ inputBaseProps,
35
+ others,
36
+ } = selectInputBaseProps(props)
37
+
38
+ const {
39
+ variants = [],
40
+ style = {},
41
+ styles = {},
42
+ value,
43
+ disabled,
44
+ debugName,
45
+ onValueChange,
46
+ checkboxOnLeft,
47
+ } = others
48
+
49
+ const variantStyles = useDefaultComponentStyle<'u:Checkbox', typeof CheckboxPresets>('u:Checkbox', {
50
+ variants,
51
+ styles,
52
+ rootElement: 'wrapper',
53
+ })
54
+
55
+ const boxAnimation = useAnimatedVariantStyles({
56
+ variantStyles,
57
+ animatedProperties: ['box:unchecked', 'box:disabled', 'box:checked', 'box:disabled-checked', 'box:disabled-unchecked'],
58
+ updater: () => {
59
+ 'worklet'
60
+ let disabledStyle = {}
61
+ if (disabled) {
62
+ disabledStyle = value ? variantStyles['box:disabled-checked'] : variantStyles['box:disabled-unchecked']
63
+ }
64
+ const style = value ? variantStyles['box:checked'] : variantStyles['box:unchecked']
36
65
 
37
- const {
38
- variants = [],
39
- style = {},
40
- styles = {},
41
- value,
42
- disabled,
43
- debugName,
44
- onValueChange,
45
- checkboxOnLeft,
46
- } = others
66
+ return {
67
+ ...style,
68
+ ...disabledStyle,
69
+ }
47
70
 
48
- const variantStyles = useDefaultComponentStyle<'u:Checkbox', typeof CheckboxPresets>('u:Checkbox', {
49
- variants,
50
- styles,
51
- rootElement: 'wrapper',
52
- })
53
-
54
- const boxAnimation = useAnimatedVariantStyles({
55
- variantStyles,
56
- animatedProperties: ['box:unchecked','box:disabled', 'box:checked', 'box:disabled-checked', 'box:disabled-unchecked'],
57
- updater: () =>{
58
- 'worklet'
59
- let disabledStyle = {}
60
- if(disabled){
61
- disabledStyle = value ? variantStyles['box:disabled-checked'] : variantStyles['box:disabled-unchecked']
62
- }
63
- const style = value ? variantStyles['box:checked'] : variantStyles['box:unchecked']
71
+ },
72
+ dependencies: [value, disabled],
73
+ })
64
74
 
65
- return {
66
- ...style,
67
- ...disabledStyle
68
- }
69
-
70
- },
71
- dependencies: [value, disabled],
72
- })
75
+ const checkmarkWrapperAnimation = useAnimatedVariantStyles({
76
+ variantStyles,
77
+ animatedProperties: [
78
+ 'checkmarkWrapper:unchecked',
79
+ 'checkmarkWrapper:disabled',
80
+ 'checkmarkWrapper:checked',
81
+ 'checkmarkWrapper:disabled-unchecked',
82
+ 'checkmarkWrapper:disabled-checked',
83
+ ],
84
+ updater: () => {
85
+ 'worklet'
86
+ let disabledStyle = {}
87
+ if (disabled) {
88
+ disabledStyle = value ? variantStyles['checkmarkWrapper:disabled-checked'] : variantStyles['checkmarkWrapper:disabled-unchecked']
89
+ }
90
+ const style = value ? variantStyles['checkmarkWrapper:checked'] : variantStyles['checkmarkWrapper:unchecked']
91
+ return {
92
+ ...style,
93
+ ...disabledStyle,
94
+ }
73
95
 
74
- const checkmarkWrapperAnimation = useAnimatedVariantStyles({
75
- variantStyles,
76
- animatedProperties: ['checkmarkWrapper:unchecked','checkmarkWrapper:disabled', 'checkmarkWrapper:checked', 'checkmarkWrapper:disabled-unchecked', 'checkmarkWrapper:disabled-checked'],
77
- updater: () =>{
78
- 'worklet'
79
- let disabledStyle = {}
80
- if(disabled){
81
- disabledStyle = value ? variantStyles['checkmarkWrapper:disabled-checked'] : variantStyles['checkmarkWrapper:disabled-unchecked']
82
- }
83
- const style = value ? variantStyles['checkmarkWrapper:checked'] : variantStyles['checkmarkWrapper:unchecked']
84
- return {
85
- ...style,
86
- ...disabledStyle
87
- }
88
-
89
- },
90
- dependencies: [value, disabled],
91
- })
96
+ },
97
+ dependencies: [value, disabled],
98
+ })
92
99
 
93
- const _checkboxOnLeft = checkboxOnLeft ?? variantStyles['__props']?.checkboxOnLeft
100
+ const _checkboxOnLeft = checkboxOnLeft ?? variantStyles.__props?.checkboxOnLeft
94
101
 
95
- const handleChange = () => {
96
- if (disabled) return
97
- if(onValueChange) onValueChange?.(!value)
98
- }
102
+ const handleChange = () => {
103
+ if (disabled) return
104
+ if (onValueChange) onValueChange?.(!value)
105
+ }
99
106
 
100
- return <InputBase
101
- {...inputBaseProps}
102
- debugName={debugName}
103
- styles={{
104
- ...variantStyles,
105
- innerWrapper: [
106
- variantStyles.innerWrapper,
107
- ],
108
- }}
109
- order={_checkboxOnLeft ? reversedOrder : InputBaseDefaultOrder}
110
- style={style}
107
+ return <InputBase
108
+ {...inputBaseProps}
109
+ debugName={debugName}
110
+ styles={{
111
+ ...variantStyles,
112
+ innerWrapper: [
113
+ variantStyles.innerWrapper,
114
+ ],
115
+ }}
116
+ order={_checkboxOnLeft ? reversedOrder : InputBaseDefaultOrder}
117
+ style={style}
118
+ >
119
+ <motion.div
120
+ css={[
121
+ variantStyles.box,
122
+ disabled && variantStyles['box:disabled'],
123
+ ]}
124
+ initial={false}
125
+ animate={boxAnimation}
126
+ transition={variantStyles['box:transition']}
127
+ onClick={handleChange}
111
128
  >
112
- <motion.div
129
+ <motion.div
113
130
  css={[
114
- variantStyles.box,
115
- disabled && variantStyles['box:disabled'],
131
+ variantStyles.checkmarkWrapper,
132
+ disabled && variantStyles['checkmarkWrapper:disabled'],
116
133
  ]}
117
134
  initial={false}
118
- animate={boxAnimation}
119
- transition={variantStyles['box:transition']}
120
- onClick={handleChange}
135
+ animate={checkmarkWrapperAnimation}
136
+ transition={variantStyles['checkmarkWrapper:transition']}
121
137
  >
122
- <motion.div
123
- css={[
124
- variantStyles.checkmarkWrapper,
125
- disabled && variantStyles['checkmarkWrapper:disabled'],
126
- ]}
127
- initial={false}
128
- animate={checkmarkWrapperAnimation}
129
- transition={variantStyles['checkmarkWrapper:transition']}
130
- >
131
- <Icon
132
- name={'checkbox-checkmark' as any}
133
- css={[variantStyles.checkmark, disabled && variantStyles['checkmark:disabled']]}
134
- />
135
- </motion.div>
138
+ <Icon
139
+ name={'checkbox-checkmark' as any}
140
+ css={[variantStyles.checkmark, disabled && variantStyles['checkmark:disabled']]}
141
+ />
136
142
  </motion.div>
137
- </InputBase>
143
+ </motion.div>
144
+ </InputBase>
138
145
  }
@@ -5,6 +5,7 @@ import { capitalize, TypeGuards } from '@codeleap/common'
5
5
  import { Scroll } from '../Scroll'
6
6
  import { View, ViewProps } from '../View'
7
7
  import { ElementType } from 'react'
8
+ import { NativeHTMLElement } from '../../types'
8
9
 
9
10
  export type CollapseAxis = 'horizontal' | 'vertical'
10
11
 
@@ -51,7 +52,7 @@ export function getCollapseStyles<
51
52
  } as unknown as Return
52
53
  }
53
54
 
54
- export type CollapseProps<T extends ElementType = 'div'> = ViewProps<T> & {
55
+ export type CollapseProps<T extends NativeHTMLElement = 'div'> = ViewProps<T> & {
55
56
  open: boolean
56
57
  scroll?: boolean
57
58
  size?: string | number
@@ -59,7 +60,7 @@ export type CollapseProps<T extends ElementType = 'div'> = ViewProps<T> & {
59
60
  animation?: string
60
61
  }
61
62
 
62
- export const Collapse:React.FC<CollapseProps> = ({
63
+ export const Collapse = ({
63
64
  open,
64
65
  size = 1000,
65
66
  scroll = false,
@@ -67,7 +68,7 @@ export const Collapse:React.FC<CollapseProps> = ({
67
68
  direction,
68
69
  animation,
69
70
  ...props
70
- }) => {
71
+ }:CollapseProps) => {
71
72
 
72
73
  const Component = scroll ? Scroll : View
73
74
  const styles = getCollapseStyles({