@codeleap/web 3.25.0 → 3.25.3

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 (150) hide show
  1. package/package.json +1 -2
  2. package/src/components/ActionIcon/index.tsx +52 -51
  3. package/src/components/ActionIcon/styles.ts +5 -1
  4. package/src/components/ActivityIndicator/index.tsx +55 -34
  5. package/src/components/ActivityIndicator/styles.ts +6 -0
  6. package/src/components/Badge/index.tsx +80 -43
  7. package/src/components/Badge/styles.ts +11 -1
  8. package/src/components/Button/index.tsx +89 -46
  9. package/src/components/Button/styles.ts +5 -0
  10. package/src/components/Checkbox/index.tsx +97 -83
  11. package/src/components/Checkbox/styles.ts +5 -1
  12. package/src/components/Collapse/index.tsx +83 -41
  13. package/src/components/Collapse/styles.ts +6 -3
  14. package/src/components/ColorPicker/index.tsx +48 -95
  15. package/src/components/ColorPicker/styles.ts +11 -11
  16. package/src/components/ColorPicker/types.ts +12 -26
  17. package/src/components/CropPicker/index.tsx +104 -100
  18. package/src/components/CropPicker/styles.ts +7 -0
  19. package/src/components/CropPicker/types.ts +17 -8
  20. package/src/{lib/hooks/useCropPicker.ts → components/CropPicker/useCropPicker.tsx} +15 -68
  21. package/src/components/CropPicker/utils.ts +51 -0
  22. package/src/components/DatePicker/{components → defaultComponents}/Header.tsx +17 -9
  23. package/src/components/DatePicker/{components → defaultComponents}/OuterInput.tsx +7 -6
  24. package/src/components/DatePicker/index.tsx +124 -110
  25. package/src/components/DatePicker/styles.ts +12 -1
  26. package/src/components/DatePicker/types.ts +33 -16
  27. package/src/components/Drawer/index.tsx +125 -133
  28. package/src/components/Drawer/styles.ts +5 -0
  29. package/src/components/Dropzone/index.tsx +63 -87
  30. package/src/components/Dropzone/styles.ts +6 -0
  31. package/src/components/Dropzone/types.ts +37 -29
  32. package/src/components/EmptyPlaceholder/index.tsx +83 -63
  33. package/src/components/EmptyPlaceholder/styles.ts +5 -0
  34. package/src/components/FileInput.tsx +91 -0
  35. package/src/components/Grid/index.tsx +41 -40
  36. package/src/components/Grid/styles.ts +9 -2
  37. package/src/components/Grid/types.ts +12 -10
  38. package/src/components/Icon/index.tsx +47 -45
  39. package/src/components/Icon/styles.ts +8 -0
  40. package/src/components/InputBase/index.tsx +42 -71
  41. package/src/components/InputBase/styles.ts +47 -37
  42. package/src/components/InputBase/types.ts +7 -19
  43. package/src/components/InputBase/utils.ts +23 -3
  44. package/src/components/List/ListLayout.tsx +37 -20
  45. package/src/components/List/PaginationIndicator.tsx +102 -0
  46. package/src/components/List/index.tsx +41 -36
  47. package/src/components/List/styles.ts +11 -5
  48. package/src/components/List/types.ts +20 -30
  49. package/src/components/List/useInfiniteScroll.ts +159 -0
  50. package/src/components/LoadingOverlay/index.tsx +33 -31
  51. package/src/components/LoadingOverlay/styles.ts +8 -3
  52. package/src/components/Modal/index.tsx +160 -98
  53. package/src/components/Modal/styles.ts +5 -0
  54. package/src/components/NumberIncrement/index.tsx +98 -67
  55. package/src/components/NumberIncrement/styles.ts +5 -0
  56. package/src/components/Overlay/index.tsx +35 -37
  57. package/src/components/Overlay/styles.ts +5 -3
  58. package/src/components/Pager/index.tsx +81 -65
  59. package/src/components/Pager/styles.ts +9 -3
  60. package/src/components/Progress/Bar/index.tsx +50 -45
  61. package/src/components/Progress/Bar/styles.tsx +7 -0
  62. package/src/components/Progress/Bar/types.tsx +30 -0
  63. package/src/components/Progress/Circle/index.tsx +48 -45
  64. package/src/components/Progress/Circle/styles.ts +8 -1
  65. package/src/components/Progress/Circle/types.ts +22 -10
  66. package/src/components/RadioInput/index.tsx +124 -78
  67. package/src/components/RadioInput/styles.ts +6 -0
  68. package/src/components/Scroll/index.tsx +32 -0
  69. package/src/components/Scroll/styles.ts +8 -0
  70. package/src/components/SearchInput/index.tsx +10 -10
  71. package/src/components/SectionFilters/index.tsx +36 -47
  72. package/src/components/SectionFilters/styles.ts +5 -1
  73. package/src/components/SectionFilters/types.ts +13 -14
  74. package/src/components/SegmentedControl/SegmentedControlOption.tsx +84 -0
  75. package/src/components/SegmentedControl/index.tsx +89 -111
  76. package/src/components/SegmentedControl/styles.ts +21 -7
  77. package/src/components/Select/index.tsx +57 -91
  78. package/src/components/Select/styles.ts +36 -19
  79. package/src/components/Select/types.ts +13 -17
  80. package/src/components/Slider/index.tsx +93 -85
  81. package/src/components/Slider/styles.ts +6 -13
  82. package/src/components/Switch/index.tsx +74 -63
  83. package/src/components/Switch/styles.ts +6 -1
  84. package/src/components/Tag/index.tsx +44 -39
  85. package/src/components/Tag/styles.ts +9 -1
  86. package/src/components/Tag/types.ts +10 -10
  87. package/src/components/Text/index.tsx +48 -37
  88. package/src/components/Text/styles.ts +8 -0
  89. package/src/components/Text/types.ts +8 -8
  90. package/src/components/TextEditor/index.tsx +28 -49
  91. package/src/components/TextEditor/styles.ts +8 -1
  92. package/src/components/TextEditor/types.ts +6 -11
  93. package/src/components/TextInput/index.tsx +96 -58
  94. package/src/components/TextInput/mask.tsx +50 -2
  95. package/src/components/TextInput/styles.ts +8 -3
  96. package/src/components/Tooltip/index.tsx +84 -61
  97. package/src/components/Tooltip/styles.ts +10 -3
  98. package/src/components/Touchable/index.tsx +86 -43
  99. package/src/components/Touchable/styles.ts +6 -0
  100. package/src/components/View/index.tsx +50 -36
  101. package/src/components/View/styles.ts +6 -0
  102. package/src/components/View/types.ts +15 -14
  103. package/src/components/components.ts +3 -2
  104. package/src/components/defaultStyles.ts +79 -0
  105. package/src/index.ts +0 -1
  106. package/src/lib/hooks/index.ts +0 -5
  107. package/src/lib/hooks/useBreakpointMatch.ts +7 -8
  108. package/src/lib/hooks/useMediaQuery.ts +3 -4
  109. package/src/lib/hooks/usePagination.ts +63 -79
  110. package/src/lib/index.ts +0 -1
  111. package/src/lib/utils/index.ts +0 -1
  112. package/src/lib/utils/test.ts +2 -2
  113. package/src/components/ActionIcon/types.ts +0 -15
  114. package/src/components/ActivityIndicator/types.ts +0 -12
  115. package/src/components/Badge/types.ts +0 -28
  116. package/src/components/Button/types.ts +0 -25
  117. package/src/components/Checkbox/types.ts +0 -15
  118. package/src/components/Collapse/types.ts +0 -11
  119. package/src/components/Drawer/types.ts +0 -23
  120. package/src/components/EmptyPlaceholder/types.ts +0 -32
  121. package/src/components/FileInput/index.tsx +0 -72
  122. package/src/components/FileInput/types.ts +0 -14
  123. package/src/components/Icon/types.ts +0 -15
  124. package/src/components/LoadingOverlay/types.ts +0 -16
  125. package/src/components/Modal/types.ts +0 -55
  126. package/src/components/NumberIncrement/types.ts +0 -29
  127. package/src/components/Overlay/types.ts +0 -13
  128. package/src/components/Pager/types.ts +0 -35
  129. package/src/components/PaginationButtons/index.tsx +0 -173
  130. package/src/components/PaginationButtons/styles.ts +0 -7
  131. package/src/components/PaginationButtons/types.ts +0 -26
  132. package/src/components/PaginationIndicator/index.tsx +0 -69
  133. package/src/components/PaginationIndicator/styles.ts +0 -3
  134. package/src/components/PaginationIndicator/types.ts +0 -18
  135. package/src/components/Progress/Bar/styles.ts +0 -10
  136. package/src/components/Progress/Bar/types.ts +0 -26
  137. package/src/components/RadioInput/types.ts +0 -29
  138. package/src/components/SegmentedControl/types.ts +0 -44
  139. package/src/components/Slider/types.ts +0 -29
  140. package/src/components/Switch/types.ts +0 -13
  141. package/src/components/TextInput/types.ts +0 -85
  142. package/src/components/Tooltip/types.ts +0 -46
  143. package/src/components/Touchable/types.ts +0 -22
  144. package/src/lib/WebStyleRegistry.ts +0 -51
  145. package/src/lib/hooks/useFileInput.ts +0 -15
  146. package/src/lib/hooks/useInfiniteScroll.ts +0 -77
  147. package/src/lib/hooks/useRefresh.ts +0 -87
  148. package/src/lib/hooks/useStylesFor.ts +0 -13
  149. package/src/lib/utils/cache.ts +0 -9
  150. /package/src/components/DatePicker/{components → defaultComponents}/index.tsx +0 -0
@@ -1,81 +1,99 @@
1
- import { CircularProgressbarWithChildren, buildStyles } from 'react-circular-progressbar'
2
- import { TypeGuards } from '@codeleap/common'
1
+ import {
2
+ CircularProgressbarWithChildren,
3
+ buildStyles,
4
+ } from 'react-circular-progressbar'
5
+ import { View, Text, Icon } from '../../components'
6
+ import { TypeGuards, useDefaultComponentStyle } from '@codeleap/common'
7
+ import { ProgressCirclePresets } from './styles'
3
8
  import { ProgressCircleProps } from './types'
4
9
  import { formatProgress as _formatProgress } from '../utils'
5
10
  import { useMemo } from '@codeleap/common'
6
- import { useStylesFor } from '../../../lib/hooks/useStylesFor'
7
- import { AnyRecord, IJSX, StyledComponentProps } from '@codeleap/styles'
8
- import { WebStyleRegistry } from '../../../lib/WebStyleRegistry'
9
- import { Text } from '../../Text'
10
- import { Icon } from '../../Icon'
11
- import { View } from '../../View'
12
- import { CSSProperties } from 'react'
13
11
 
14
12
  export * from './styles'
15
13
  export * from './types'
16
14
 
15
+ const defaultProps: Partial<ProgressCircleProps> = {
16
+ progress: 0,
17
+ variants: [],
18
+ responsiveVariants: {},
19
+ styles: {},
20
+ showProgress: false,
21
+ formatProgress: _formatProgress,
22
+ size: null,
23
+ }
24
+
17
25
  export const ProgressCircle = (props: ProgressCircleProps) => {
26
+ const allProps = {
27
+ ...ProgressCircle.defaultProps,
28
+ ...props,
29
+ }
30
+
18
31
  const {
19
32
  text,
20
33
  progress,
21
34
  icon,
22
35
  iconProps,
36
+ variants,
37
+ styles,
23
38
  debugName,
24
39
  showProgress,
40
+ responsiveVariants,
25
41
  circleProps,
26
42
  children,
27
43
  formatProgress,
28
44
  circleStyles,
29
- style,
30
45
  textProps,
31
46
  size: propSize,
32
47
  ...rest
33
- } = {
34
- ...ProgressCircle.defaultProps,
35
- ...props,
36
- }
48
+ } = allProps
37
49
 
38
- const styles = useStylesFor(ProgressCircle.styleRegistryName, style)
50
+ const variantStyles = useDefaultComponentStyle<
51
+ 'u:ProgressCircle',
52
+ typeof ProgressCirclePresets
53
+ >('u:ProgressCircle', {
54
+ variants,
55
+ responsiveVariants,
56
+ styles,
57
+ rootElement: 'wrapper',
58
+ })
39
59
 
40
60
  const wrapperSize = useMemo(() => {
41
61
  if (TypeGuards.isNumber(propSize)) return propSize
42
- // @ts-expect-error icss type
43
- const value = styles.circle?.size ?? styles.circle?.width ?? styles.circle?.height
62
+ const { size, width, height } = variantStyles.circle
63
+ const value = size ?? width ?? height
44
64
  return value ?? 0
45
- }, [styles.circle])
46
-
47
- const lineStyle = styles.line as CSSProperties
65
+ }, [variantStyles.circle])
48
66
 
49
67
  return (
50
- <View debugName={debugName} {...rest} style={styles.wrapper}>
68
+ <View debugName={debugName} css={variantStyles.wrapper} {...rest}>
51
69
  <CircularProgressbarWithChildren
52
70
  value={progress}
71
+ css={[
72
+ variantStyles.circle,
73
+ { width: wrapperSize, height: wrapperSize },
74
+ ]}
53
75
  styles={buildStyles({
54
- pathColor: lineStyle?.borderColor,
55
- trailColor: lineStyle?.backgroundColor,
76
+ pathColor: variantStyles.line?.borderColor,
77
+ trailColor: variantStyles.line?.backgroundColor,
56
78
  strokeLinecap: 'butt',
57
79
  ...circleStyles,
58
80
  })}
59
81
  {...circleProps}
60
- // @ts-expect-error
61
- css={[styles.circle, { width: wrapperSize, height: wrapperSize }]}
62
82
  >
63
83
  {children}
64
-
65
84
  {!TypeGuards.isNil(icon) ? (
66
85
  <Icon
67
86
  name={icon}
87
+ style={variantStyles.icon}
68
88
  debugName={`innerIcon-${debugName}`}
69
89
  {...iconProps}
70
- style={styles.icon}
71
90
  />
72
91
  ) : null}
73
-
74
92
  {TypeGuards.isString(text) || showProgress ? (
75
93
  <Text
94
+ style={variantStyles.text}
76
95
  text={showProgress ? formatProgress(progress) : String(text)}
77
96
  {...textProps}
78
- style={styles.text}
79
97
  />
80
98
  ) : text}
81
99
  </CircularProgressbarWithChildren>
@@ -83,19 +101,4 @@ export const ProgressCircle = (props: ProgressCircleProps) => {
83
101
  )
84
102
  }
85
103
 
86
- ProgressCircle.styleRegistryName = 'ProgressCircle'
87
- ProgressCircle.elements = ['wrapper', 'line', 'circle', 'text', 'icon', 'text']
88
- ProgressCircle.rootElement = 'wrapper'
89
-
90
- ProgressCircle.withVariantTypes = <S extends AnyRecord>(styles: S) => {
91
- return ProgressCircle as (props: StyledComponentProps<ProgressCircleProps, typeof styles>) => IJSX
92
- }
93
-
94
- ProgressCircle.defaultProps = {
95
- progress: 0,
96
- showProgress: false,
97
- formatProgress: _formatProgress,
98
- size: null,
99
- } as Partial<ProgressCircleProps>
100
-
101
- WebStyleRegistry.registerComponent(ProgressCircle)
104
+ ProgressCircle.defaultProps = defaultProps
@@ -1 +1,8 @@
1
- export type ProgressCircleComposition = 'wrapper' | 'line' | 'circle' | 'text' | 'icon'
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
+ import 'react-circular-progressbar/dist/styles.css'
3
+
4
+ export type ProgressCircleComposition = 'wrapper' | 'line' | 'circle' | 'text' | 'icon' | 'text'
5
+
6
+ const createProgressCircleStyle = createDefaultVariantFactory<ProgressCircleComposition>()
7
+
8
+ export const ProgressCirclePresets = includePresets((styles) => createProgressCircleStyle(() => ({ wrapper: styles })))
@@ -1,20 +1,32 @@
1
- import { PropsOf } from '@codeleap/common'
2
- import { IconProps, ProgressCircleComposition, ViewProps, TextProps } from '../../components'
1
+ import { ComponentVariants, IconPlaceholder, PropsOf, StylesOf } from '@codeleap/common'
2
+ import {
3
+ IconProps,
4
+ ProgressCircleComposition,
5
+ ProgressCirclePresets,
6
+ View,
7
+ TextProps as _TextProps,
8
+ } from '../../components'
3
9
  import { ProgressPropsRoot } from '..'
4
10
  import { CircularProgressbarWithChildren, buildStyles } from 'react-circular-progressbar'
5
- import { AppIcon, StyledProp } from '@codeleap/styles'
11
+ import { ElementType } from 'react'
6
12
 
7
- export type ProgressCircleProps =
8
- Omit<ViewProps, 'style'> &
9
- Omit<ProgressPropsRoot, 'style'> &
10
- {
11
- style?: StyledProp<ProgressCircleComposition>
13
+ type TextProps = _TextProps<ElementType>
14
+
15
+ export type ProgressCircleProps = Omit<
16
+ PropsOf<typeof View>,
17
+ 'styles' | 'variants' | 'children'
18
+ > &
19
+ ComponentVariants<typeof ProgressCirclePresets> &
20
+ ProgressPropsRoot & {
21
+ styles?: StylesOf<ProgressCircleComposition>
12
22
  circleProps?: PropsOf<typeof CircularProgressbarWithChildren>
13
23
  circleStyles?: Parameters<typeof buildStyles>[0]
14
24
  children?: React.ReactNode
15
25
  size?: number
16
- text?: string | JSX.Element
26
+
27
+ text?: TextProps['text'] | JSX.Element
17
28
  textProps?: Partial<TextProps>
18
- icon?: AppIcon
29
+
30
+ icon?: IconPlaceholder
19
31
  iconProps?: Partial<IconProps>
20
32
  }
@@ -1,19 +1,47 @@
1
- import React from 'react'
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react'
3
+
4
+ import React, { ReactNode } from 'react'
2
5
  import { Text } from '../Text'
3
6
  import { Touchable } from '../Touchable'
4
- import { TypeGuards } from '@codeleap/common'
7
+ import {
8
+ ComponentVariants,
9
+ FormTypes,
10
+ StylesOf,
11
+ TypeGuards,
12
+ useDefaultComponentStyle,
13
+ } from '@codeleap/common'
5
14
  import { View } from '../View'
6
- import { InputBase, selectInputBaseProps } from '../InputBase'
7
- import { RadioOptionProps, RadioInputProps } from './types'
8
- import { AnyRecord, IJSX, mergeStyles, StyledComponentProps } from '@codeleap/styles'
9
- import { useStylesFor } from '../../lib/hooks/useStylesFor'
10
- import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
11
- import { RadioInputComposition } from './styles'
15
+ import { RadioInputComposition, RadioInputPresets } from './styles'
16
+ import { InputBase, InputBaseProps, selectInputBaseProps } from '../InputBase'
12
17
 
13
18
  export * from './styles'
14
- export * from './types'
15
19
 
16
- const Option = <T extends string | number>(props: RadioOptionProps<T>) => {
20
+ type WrapperProps = InputBaseProps
21
+
22
+ type RadioOption<T> = FormTypes.Options<T>[number] & {
23
+ disabled?: boolean
24
+ }
25
+
26
+ export type RadioGroupProps<T extends string|number> = WrapperProps & {
27
+ options: RadioOption<T>[]
28
+ value: T
29
+ onValueChange(value: T): void
30
+ label: ReactNode
31
+ styles?: StylesOf<RadioInputComposition>
32
+ } & ComponentVariants<typeof RadioInputPresets>
33
+
34
+ type OptionProps<T extends string|number> = {
35
+ item: RadioOption<T>
36
+ selected: boolean
37
+ onSelect(): void
38
+ styles?: StylesOf<RadioInputComposition>
39
+ debugName?: string
40
+ disabled?: boolean
41
+ separator?: boolean
42
+ }
43
+
44
+ const Option = <T extends string|number>(props: OptionProps<T>) => {
17
45
  const {
18
46
  debugName,
19
47
  item,
@@ -24,89 +52,107 @@ const Option = <T extends string | number>(props: RadioOptionProps<T>) => {
24
52
  separator = false,
25
53
  } = props
26
54
 
27
- const isDisabled = disabled || item?.disabled
28
-
29
- const getStyle = (key: RadioInputComposition) => {
30
- let style = null
31
-
32
- if (isDisabled && selected) style = styles[`${key}:selectedDisabled`]
33
- else if (isDisabled) style = styles[`${key}:disabled`]
34
- else if (selected) style = styles[`${key}:selected`]
35
-
36
- return mergeStyles([styles[key], style])
55
+ const isDisabled = disabled || item.disabled
56
+
57
+ const getStyle = (key) => {
58
+ if (isDisabled && selected) {
59
+ return styles[`${key}:selectedDisabled`]
60
+ }
61
+ if (isDisabled) {
62
+ return styles[`${key}:disabled`]
63
+ }
64
+ if (selected) {
65
+ return styles[`${key}:selected`]
66
+ }
67
+ return styles[key]
37
68
  }
38
69
 
39
- return (
40
- <React.Fragment>
41
- <Touchable
42
- debugName={`${debugName} option ${item.value}`}
43
- style={getStyle('optionWrapper')}
44
- onPress={onSelect}
45
- disabled={isDisabled}
46
- >
47
- <View style={getStyle('optionIndicator')}>
48
- <View style={getStyle('optionIndicatorInner')} />
49
- </View>
70
+ const label = TypeGuards.isString(item.label) ? <Text
71
+ css={[
72
+ styles.optionLabel,
73
+ getStyle('optionLabel'),
74
+ ]}
75
+ text={item.label}
76
+ /> : item.label
77
+
78
+ return <React.Fragment>
79
+ <Touchable
80
+ debugName={`${debugName} option ${item.value}`}
81
+ css={[
82
+ styles.optionWrapper,
83
+ getStyle('optionWrapper'),
84
+ ]}
85
+ onPress={onSelect}
86
+ disabled={isDisabled}
87
+ >
88
+ <View
89
+ css={[
90
+ styles.optionIndicator,
91
+ getStyle('optionIndicator'),
92
+ ]}
50
93
 
51
- {TypeGuards.isString(item.label) ? <Text style={getStyle('optionLabel')} text={item.label} /> : item.label}
52
- </Touchable>
94
+ >
95
+ <View
96
+ css={[
97
+ styles.optionIndicatorInner,
98
+ getStyle('optionIndicatorInner'),
99
+ ]}
100
+ />
101
+ </View>
102
+ {label}
53
103
 
54
- {separator ? <View style={styles.optionSeparator} /> : null}
55
- </React.Fragment>
56
- )
104
+ </Touchable>
105
+ {separator && <View style={styles.optionSeparator} />}
106
+ </React.Fragment>
57
107
  }
58
108
 
59
- export const RadioInput = <T extends string | number>(props: RadioInputProps<T>) => {
109
+ export const RadioGroup = <T extends string|number>(
110
+ props: RadioGroupProps<T>,
111
+ ) => {
60
112
  const {
61
113
  inputBaseProps,
62
- others: radioInputProps,
63
- } = selectInputBaseProps({
64
- ...RadioInput.defaultProps,
65
- ...props,
66
- })
114
+ others,
115
+ } = selectInputBaseProps(props)
67
116
 
68
117
  const {
69
118
  options,
70
119
  value,
71
120
  onValueChange,
72
- style,
121
+ responsiveVariants = {},
122
+ variants = [],
123
+ styles,
73
124
  disabled,
74
125
  debugName,
75
- } = radioInputProps
76
-
77
- const styles = useStylesFor(RadioInput.styleRegistryName, style)
78
-
79
- return (
80
- <InputBase
81
- {...inputBaseProps}
82
- disabled={disabled}
83
- style={styles}
84
- debugName={debugName}
85
- >
86
- {options?.map((item, idx) => (
87
- <Option
88
- debugName={debugName}
89
- item={item}
90
- key={idx}
91
- disabled={disabled}
92
- styles={styles}
93
- selected={value === item?.value}
94
- onSelect={() => onValueChange(item?.value)}
95
- separator={idx < options?.length - 1}
96
- />
97
- ))}
98
- </InputBase>
99
- )
100
- }
126
+ } = others
101
127
 
102
- RadioInput.styleRegistryName = 'RadioInput'
103
- RadioInput.elements = [...InputBase.elements, 'option']
104
- RadioInput.rootElement = 'wrapper'
128
+ const variantStyles = useDefaultComponentStyle<'u:RadioInput', typeof RadioInputPresets>('u:RadioInput', {
129
+ responsiveVariants,
130
+ variants,
131
+ styles,
132
+ })
105
133
 
106
- RadioInput.withVariantTypes = <S extends AnyRecord, T extends string | number>(styles: S) => {
107
- return RadioInput as (props: StyledComponentProps<RadioInputProps<T>, typeof styles>) => IJSX
134
+ return <InputBase
135
+ {...inputBaseProps}
136
+ disabled={disabled}
137
+ styles={{
138
+ ...variantStyles,
139
+ innerWrapper: [
140
+ variantStyles.innerWrapper,
141
+ ],
142
+ }}
143
+ debugName={debugName}
144
+ >
145
+ {options?.map((item, idx) => (
146
+ <Option
147
+ debugName={debugName}
148
+ item={item}
149
+ key={idx}
150
+ disabled={disabled}
151
+ styles={variantStyles}
152
+ selected={value === item.value}
153
+ onSelect={() => onValueChange(item.value)}
154
+ separator={idx < options.length - 1}
155
+ />
156
+ ))}
157
+ </InputBase>
108
158
  }
109
-
110
- RadioInput.defaultProps = {} as Partial<RadioInputProps<string | number>>
111
-
112
- WebStyleRegistry.registerComponent(RadioInput)
@@ -1,3 +1,4 @@
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
1
2
  import { IconLessInputBaseParts } from '../InputBase'
2
3
 
3
4
  type OptionParts = 'wrapper' | 'label' | 'indicator' | 'indicatorInner' | 'separator'
@@ -6,3 +7,8 @@ type OptionStates = 'selected' | 'disabled' | 'selectedDisabled'
6
7
  type OptionComposition = `${OptionParts}:${OptionStates}` | OptionParts
7
8
 
8
9
  export type RadioInputComposition = IconLessInputBaseParts | `${IconLessInputBaseParts}:disabled` | `option${Capitalize<OptionComposition>}`
10
+
11
+ const createRadioStyle =
12
+ createDefaultVariantFactory<RadioInputComposition>()
13
+
14
+ export const RadioInputPresets = includePresets(style => createRadioStyle(() => ({ wrapper: style })))
@@ -0,0 +1,32 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react'
3
+ import {
4
+ ElementType,
5
+ forwardRef,
6
+ ReactElement,
7
+ Ref,
8
+ } from 'react'
9
+ import { NativeHTMLElement } from '../../types'
10
+ import { View, ViewProps } from '../View'
11
+
12
+ export const ScrollCP = <T extends NativeHTMLElement = 'div'>(
13
+ props: ViewProps<T>,
14
+ ref: Ref<any>,
15
+ ) => {
16
+
17
+ return (
18
+ // @ts-ignore
19
+ <View
20
+ {...props}
21
+ ref={ref}
22
+ scroll
23
+ />
24
+
25
+ )
26
+ }
27
+
28
+ export * from './styles'
29
+
30
+ export const Scroll = forwardRef(ScrollCP) as <T extends NativeHTMLElement = 'div'>(
31
+ props: ViewProps<T>
32
+ ) => JSX.Element
@@ -0,0 +1,8 @@
1
+ import { createDefaultVariantFactory, includePresets } from "@codeleap/common";
2
+ import { ViewComposition } from "../View";
3
+
4
+ export type ScrollCompostion = ViewComposition
5
+
6
+ const createScrollStyle = createDefaultVariantFactory<ScrollCompostion>()
7
+
8
+ export const ScrollPresets = includePresets((styles) => createScrollStyle(() => ({ wrapper: styles })))
@@ -1,14 +1,14 @@
1
+ import { AnyFunction, IconPlaceholder, TypeGuards } from '@codeleap/common'
1
2
  import React, { useState } from 'react'
2
3
  import { TextInput, TextInputProps } from '../TextInput'
3
- import { AnyFunction, TypeGuards } from '@codeleap/common'
4
- import { AppIcon } from '@codeleap/styles'
4
+ import { ComponentWithDefaultProps } from '../../types/utility'
5
5
 
6
6
  export type SearchInputProps = {
7
7
  placeholder: string
8
8
  clearable?: boolean
9
9
  debugName: string
10
- clearIcon?: AppIcon
11
- searchIcon?: AppIcon
10
+ clearIcon?: IconPlaceholder
11
+ searchIcon?: IconPlaceholder
12
12
  debounce?: number
13
13
  onSearchChange: (search: string) => void
14
14
  onTypingChange?: (isTyping: boolean) => void
@@ -17,7 +17,7 @@ export type SearchInputProps = {
17
17
  defaultValue?: string
18
18
  } & Partial<TextInputProps>
19
19
 
20
- export const SearchInput = (props: SearchInputProps) => {
20
+ export const SearchInput: ComponentWithDefaultProps<SearchInputProps> = (props) => {
21
21
  const {
22
22
  debugName,
23
23
  onSearchChange,
@@ -30,7 +30,7 @@ export const SearchInput = (props: SearchInputProps) => {
30
30
  debounce,
31
31
  value,
32
32
  onValueChange,
33
- defaultValue,
33
+ defaultValue = '',
34
34
  ...rest
35
35
  } = {
36
36
  ...SearchInput.defaultProps,
@@ -44,6 +44,7 @@ export const SearchInput = (props: SearchInputProps) => {
44
44
 
45
45
  const handleChangeSearch = (value: string) => {
46
46
  setSearch(value)
47
+
47
48
  if (TypeGuards.isNil(debounce)) {
48
49
  onSearchChange?.(value)
49
50
  } else {
@@ -91,7 +92,6 @@ export const SearchInput = (props: SearchInputProps) => {
91
92
  SearchInput.defaultProps = {
92
93
  debounce: null,
93
94
  clearable: true,
94
- clearIcon: 'x' as AppIcon,
95
- searchIcon: 'search' as AppIcon,
96
- defaultValue: '',
97
- } as Partial<SearchInputProps>
95
+ clearIcon: 'x' as IconPlaceholder,
96
+ searchIcon: 'search' as IconPlaceholder,
97
+ }