@codeleap/web 3.25.0 → 3.25.2

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 +58 -92
  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,14 +0,0 @@
1
- import { WebInputFile } from '@codeleap/common'
2
- import { HTMLProps } from '../../types'
3
-
4
- export type FileInputRef = {
5
- openFilePicker: () => Promise<WebInputFile[]>
6
- clear: () => void
7
- }
8
-
9
- export type FileInputProps =
10
- Omit<HTMLProps<'input'>, 'type' | 'ref'> &
11
- {
12
- onFileSelect?: (files: WebInputFile[]) => void
13
- autoClear?: boolean
14
- }
@@ -1,15 +0,0 @@
1
- import { ComponentCommonProps } from '../../types'
2
- import { IconComposition } from './styles'
3
- import { AppIcon, StyledProp } from '@codeleap/styles'
4
- import { CSSProperties } from 'react'
5
-
6
- export type IconProps =
7
- ComponentCommonProps &
8
- {
9
- name: AppIcon
10
- style?: StyledProp<IconComposition>
11
- size?: string | number
12
- color?: string
13
- renderEmptySpace?: boolean
14
- forceStyle?: CSSProperties
15
- }
@@ -1,16 +0,0 @@
1
- import React from 'react'
2
- import { LoadingOverlayComposition } from './styles'
3
- import { ViewProps } from '../View'
4
- import { ActivityIndicatorProps } from '../ActivityIndicator'
5
- import { ComponentCommonProps } from '../../types/utility'
6
- import { StyledProp } from '@codeleap/styles'
7
-
8
- export type LoadingOverlayProps =
9
- Omit<ViewProps, 'style'> &
10
- ComponentCommonProps &
11
- {
12
- visible?: boolean
13
- style?: StyledProp<LoadingOverlayComposition>
14
- indicatorProps?: ActivityIndicatorProps
15
- children?: React.ReactNode
16
- }
@@ -1,55 +0,0 @@
1
- import { AnyFunction, PropsOf } from '@codeleap/common'
2
- import React from 'react'
3
- import { OverlayProps } from '../Overlay'
4
- import { ModalComposition } from './styles'
5
- import { ActionIconProps } from '../ActionIcon'
6
- import { TouchableProps } from '../Touchable'
7
- import { AppIcon, ICSS, StyledProp } from '@codeleap/styles'
8
-
9
- export type ModalProps =
10
- {
11
- visible?: boolean
12
- children?: React.ReactNode
13
- title?: React.ReactNode | string
14
- description?: React.ReactNode | string
15
- renderModalBody?: (props: ModalBodyProps) => React.ReactElement
16
- toggle?: AnyFunction
17
- style?: StyledProp<ModalComposition>
18
- accessible?: boolean
19
- showClose?: boolean
20
- closable?: boolean
21
- dismissOnBackdrop?: boolean
22
- scroll?: boolean
23
- header?: React.ReactElement
24
- footer?: React.ReactNode
25
- withOverlay?: boolean
26
- closeIconName?: AppIcon
27
- keepMounted?: boolean
28
- renderHeader?: (props: ModalHeaderProps) => React.ReactElement
29
- debugName?: string
30
- closeButtonProps?: Partial<ActionIconProps>
31
- closeOnEscape?: boolean
32
- onClose?: () => void
33
- overlayProps?: Partial<OverlayProps>
34
- zIndex?: number
35
- withScrollContainer?: boolean
36
- scrollLock?: boolean
37
- backdropProps?: Partial<TouchableProps>
38
- alterHistory?: boolean
39
- modalId?: string
40
- autoIndex?: boolean
41
- }
42
-
43
- export type ModalBodyProps = {
44
- id: string
45
- style: ICSS
46
- children?: React.ReactNode
47
- }
48
-
49
- export type ModalHeaderProps =
50
- Partial<Omit<ModalProps, 'children'>> &
51
- {
52
- id: string
53
- styles: PropsOf<ModalComposition>
54
- onPressClose: () => void
55
- }
@@ -1,29 +0,0 @@
1
- import { yup, FormTypes } from '@codeleap/common'
2
- import { NumberIncrementComposition } from './styles'
3
- import { InputBaseProps } from '../InputBase'
4
- import { PatternFormatProps as PFProps, NumericFormatProps as NFProps } from 'react-number-format'
5
- import { FormatInputValueFunction } from 'react-number-format/types/types'
6
- import { StyledProp } from '@codeleap/styles'
7
-
8
- export type NumberIncrementProps =
9
- Pick<InputBaseProps, 'debugName' | 'disabled' | 'label'> &
10
- {
11
- value: number
12
- onValueChange: (value: number) => void
13
- onChangeText?: (value: number) => void
14
- validate?: FormTypes.ValidatorWithoutForm<string> | yup.SchemaOf<string>
15
- style?: StyledProp<NumberIncrementComposition>
16
- max?: number
17
- min?: number
18
- step?: number
19
- editable?: boolean
20
- prefix?: NFProps['prefix']
21
- suffix?: NFProps['suffix']
22
- separator?: NFProps['thousandSeparator']
23
- format?: PFProps['format']
24
- mask?: PFProps['mask']
25
- hasSeparator?: boolean
26
- _error?: string
27
- formatter?: FormatInputValueFunction
28
- placeholder?: string
29
- }
@@ -1,13 +0,0 @@
1
- import { StyledProp } from '@codeleap/styles'
2
- import { ViewProps } from '../View'
3
- import { OverlayComposition } from './styles'
4
- import { AnyFunction } from '@codeleap/common'
5
-
6
- export type OverlayProps =
7
- Omit<ViewProps, 'style'> &
8
- {
9
- debugName: string
10
- visible?: boolean
11
- style?: StyledProp<OverlayComposition>
12
- onPress?: AnyFunction
13
- }
@@ -1,35 +0,0 @@
1
- import { StylesOf } from '@codeleap/common'
2
- import { Settings } from 'react-slick'
3
- import { PagerComposition } from './styles'
4
- import React, { ReactNode, ReactElement } from 'react'
5
- import { ViewProps } from '../View'
6
- import { ComponentCommonProps } from '../../types'
7
- import { StyledProp } from '@codeleap/styles'
8
-
9
- export type PagerRef = {
10
- goTo: (page: number) => void
11
- }
12
-
13
- export type PagerProps =
14
- Omit<Settings, 'style'> &
15
- ComponentCommonProps &
16
- {
17
- style?: StyledProp<PagerComposition>
18
- page?: number
19
- children: ReactNode
20
- onChange?: (page: number) => void
21
- renderPageWrapper?: React.FC
22
- footer?: ReactElement
23
- dotsProps?: DotsProps
24
- pageWrapperProps?: ViewProps
25
- dotsDisabled?: boolean
26
- disableSwipe?: boolean
27
- }
28
-
29
- export type DotsProps =
30
- Pick<PagerProps, 'page' | 'dotsDisabled'> &
31
- {
32
- childArray: ReactNode[]
33
- onPress?: (index: number) => void
34
- styles: StylesOf<PagerComposition>
35
- }
@@ -1,173 +0,0 @@
1
- import { TypeGuards } from '@codeleap/common'
2
- import { View } from '../View'
3
- import { Button } from '../Button'
4
- import { useMediaQuery, usePagination, useStylesFor, WebStyleRegistry } from '../../lib'
5
- import { PaginationButtonsProps } from './types'
6
- import { AnyRecord, AppIcon, AppTheme, IJSX, StyledComponentProps, Theme, useCompositionStyles, useTheme } from '@codeleap/styles'
7
-
8
- export * from './styles'
9
- export * from './types'
10
-
11
- export const PaginationButtons = (props: PaginationButtonsProps) => {
12
- const allProps = {
13
- ...PaginationButtons.defaultProps,
14
- ...props,
15
- }
16
-
17
- const {
18
- shouldAbbreviate,
19
- displayLeftArrow,
20
- displayRightArrow,
21
- disabled,
22
- style,
23
- itemProps,
24
- controlLeftIconName,
25
- controlRightIconName,
26
- leftArrowButtonProps,
27
- rightArrowButtonProps,
28
- abbreviationSymbol,
29
- isMobile,
30
- ...paginationProps
31
- } = allProps
32
-
33
- const theme = useTheme(store => store?.current) as AppTheme<Theme>
34
-
35
- const { boundaries = 2 } = paginationProps
36
-
37
- const query = theme?.media?.down('tabletSmall' as never)
38
-
39
- const _isMobile = useMediaQuery(query, { getInitialValueInEffect: false })
40
- const isMobileQuery = TypeGuards.isBoolean(isMobile) ? isMobile : _isMobile
41
-
42
- const centeredElementIndex = isMobileQuery ? 3 : boundaries + 1
43
-
44
- const {
45
- range,
46
- first,
47
- next,
48
- previous,
49
- setPage,
50
- page,
51
- status,
52
- } = usePagination({
53
- abbreviationSymbol,
54
- isMobile: isMobileQuery,
55
- displayLeftArrow,
56
- displayRightArrow,
57
- shouldAbbreviate,
58
- ...paginationProps,
59
- })
60
-
61
- const styles = useStylesFor(PaginationButtons.styleRegistryName, style)
62
-
63
- const compositionStyles = useCompositionStyles(['button', 'arrowLeftButton', 'arrowRightButton'], styles)
64
-
65
- const fetchPreviousPage = () => {
66
- props?.onFetchPreviousPage?.()
67
- previous?.()
68
- }
69
-
70
- const fetchNextPage = () => {
71
- props?.onFetchNextPage?.()
72
- next?.()
73
- }
74
-
75
- const fetchPage = (page: number) => {
76
- setPage?.(page)
77
- }
78
-
79
- const onPressItem = ({ item, isArrowLeft, isArrowRight }: { item: string | number; isArrowLeft: boolean; isArrowRight: boolean }) => {
80
- if (item === abbreviationSymbol) {
81
- return null
82
- }
83
-
84
- if (isArrowLeft) {
85
- if (displayLeftArrow) {
86
- return fetchPreviousPage()
87
- } else {
88
- return first()
89
- }
90
- }
91
-
92
- if (displayRightArrow && isArrowRight) {
93
- return fetchNextPage()
94
- }
95
-
96
- props?.onPressItem?.(item)
97
- fetchPage(Number(item))
98
- }
99
-
100
- return (
101
- <View style={styles.wrapper}>
102
- {displayLeftArrow ? (
103
- <Button
104
- icon={controlLeftIconName}
105
- onPress={() => onPressItem({ item: null, isArrowLeft: true, isArrowRight: false })}
106
- {...leftArrowButtonProps}
107
- style={compositionStyles.arrowLeftButton}
108
- />
109
- ) : null}
110
-
111
- {range?.map?.((item, index) => {
112
- if (props?.renderItem) {
113
- return props?.renderItem?.(item, index)
114
- }
115
-
116
- let selected = null
117
-
118
- switch (status) {
119
- case 'initial':
120
- selected = page === index + 1
121
- break
122
- case 'abreviated':
123
- selected = index === centeredElementIndex - 1
124
- break
125
- case 'end':
126
- selected = page - (Number(item) - index) === index
127
- }
128
-
129
- return (
130
- <Button
131
- text={String(item)}
132
- selected={selected}
133
- onPress={() => onPressItem({ item, isArrowLeft: false, isArrowRight: false })}
134
- disabled={disabled}
135
- {...itemProps}
136
- style={compositionStyles.button}
137
- />
138
- )
139
-
140
- })}
141
-
142
- {displayRightArrow ? (
143
- <Button
144
- icon={controlRightIconName}
145
- onPress={() => onPressItem({ item: null, isArrowLeft: false, isArrowRight: true })}
146
- {...rightArrowButtonProps}
147
- style={compositionStyles.arrowRightButton}
148
- />
149
- ) : null}
150
- </View>
151
- )
152
- }
153
-
154
- PaginationButtons.styleRegistryName = 'PaginationButtons'
155
- PaginationButtons.elements = ['wrapper', 'button', 'arrowLeftButton', 'arrowRightButton']
156
- PaginationButtons.rootElement = 'wrapper'
157
-
158
- PaginationButtons.withVariantTypes = <S extends AnyRecord>(styles: S) => {
159
- return PaginationButtons as (props: StyledComponentProps<PaginationButtonsProps, typeof styles>) => IJSX
160
- }
161
-
162
- PaginationButtons.defaultProps = {
163
- shouldAbbreviate: true,
164
- displayLeftArrow: true,
165
- displayRightArrow: true,
166
- disabled: false,
167
- isMobile: null,
168
- abbreviationSymbol: '...',
169
- controlLeftIconName: 'chevron-left' as AppIcon,
170
- controlRightIconName: 'chevron-right' as AppIcon,
171
- } as Partial<PaginationButtonsProps>
172
-
173
- WebStyleRegistry.registerComponent(PaginationButtons)
@@ -1,7 +0,0 @@
1
- import { ButtonComposition } from '../Button'
2
-
3
- export type PaginationButtonsComposition =
4
- 'wrapper' |
5
- `button${Capitalize<ButtonComposition>}` |
6
- `arrowLeftButton${Capitalize<ButtonComposition>}` |
7
- `arrowRightButton${Capitalize<ButtonComposition>}`
@@ -1,26 +0,0 @@
1
- import { AnyFunction } from '@codeleap/common'
2
- import { PaginationButtonsComposition } from './styles'
3
- import { ButtonProps } from '../Button'
4
- import { PaginationParams } from '../../lib'
5
- import { AppIcon, StyledProp } from '@codeleap/styles'
6
-
7
- export type PaginationButtonsProps =
8
- PaginationParams &
9
- {
10
- onFetchNextPage?: AnyFunction
11
- onFetchPreviousPage?: AnyFunction
12
- renderItem?: (item: string | number, index: number) => JSX.Element
13
- onPressItem?: (item: string | number) => void
14
- shouldAbbreviate?: boolean
15
- abbreviationSymbol?: string
16
- disabled?: boolean
17
- displayLeftArrow?: boolean
18
- displayRightArrow?: boolean
19
- isMobile?: boolean
20
- itemProps?: Partial<ButtonProps>
21
- controlLeftIconName?: AppIcon
22
- controlRightIconName?: AppIcon
23
- leftArrowButtonProps?: Partial<ButtonProps>
24
- rightArrowButtonProps?: Partial<ButtonProps>
25
- style?: StyledProp<PaginationButtonsComposition>
26
- }
@@ -1,69 +0,0 @@
1
- import React from 'react'
2
- import { TypeGuards } from '@codeleap/common'
3
- import { ActivityIndicator } from '../ActivityIndicator'
4
- import { Text } from '../Text'
5
- import { View } from '../View'
6
- import { useStylesFor } from '../../lib/hooks/useStylesFor'
7
- import { PaginationIndicatorProps } from './types'
8
- import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
9
- import { AnyRecord, IJSX, StyledComponentProps, useNestedStylesByKey } from '@codeleap/styles'
10
-
11
- export * from './styles'
12
- export * from './types'
13
-
14
- export const PaginationIndicator = (props: PaginationIndicatorProps) => {
15
- const {
16
- hasMore,
17
- isFetching,
18
- noMoreItemsText,
19
- activityIndicator,
20
- style,
21
- indicatorProps,
22
- debugName,
23
- } = {
24
- ...PaginationIndicator.defaultProps,
25
- ...props,
26
- }
27
-
28
- const styles = useStylesFor(PaginationIndicator.styleRegistryName, style)
29
-
30
- const loaderStyles = useNestedStylesByKey('loader', styles)
31
-
32
- if (isFetching) {
33
- return activityIndicator || (
34
- <View style={styles.wrapper}>
35
- <ActivityIndicator debugName={debugName} {...indicatorProps} style={loaderStyles} />
36
- </View>
37
- )
38
- }
39
-
40
- if (!hasMore) {
41
- if (TypeGuards.isString(noMoreItemsText) || TypeGuards.isNumber(noMoreItemsText)) {
42
- return (
43
- <View style={styles.wrapper}>
44
- <Text
45
- debugName={debugName}
46
- style={styles.text}
47
- text={String(noMoreItemsText)}
48
- />
49
- </View>
50
- )
51
- }
52
-
53
- return noMoreItemsText
54
- }
55
-
56
- return null
57
- }
58
-
59
- PaginationIndicator.styleRegistryName = 'PaginationIndicator'
60
- PaginationIndicator.elements = ['wrapper', 'text', 'loader']
61
- PaginationIndicator.rootElement = 'wrapper'
62
-
63
- PaginationIndicator.withVariantTypes = <S extends AnyRecord>(styles: S) => {
64
- return PaginationIndicator as (props: StyledComponentProps<PaginationIndicatorProps, typeof styles>) => IJSX
65
- }
66
-
67
- PaginationIndicator.defaultProps = {} as Partial<PaginationIndicatorProps>
68
-
69
- WebStyleRegistry.registerComponent(PaginationIndicator)
@@ -1,3 +0,0 @@
1
- import { ActivityIndicatorComposition } from '../ActivityIndicator'
2
-
3
- export type PaginationIndicatorComposition = 'text' | `loader${Capitalize<ActivityIndicatorComposition>}` | 'wrapper'
@@ -1,18 +0,0 @@
1
- import React from 'react'
2
- import { ActivityIndicatorProps } from '../ActivityIndicator'
3
- import { TextProps } from '../Text'
4
- import { ComponentCommonProps } from '../../types'
5
- import { PaginationIndicatorComposition } from './styles'
6
- import { StyledProp } from '@codeleap/styles'
7
-
8
- export type PaginationIndicatorProps =
9
- ComponentCommonProps &
10
- {
11
- isFetching?: boolean
12
- noMoreItemsText: JSX.Element | string | number
13
- hasMore?: boolean
14
- activityIndicator?: JSX.Element
15
- style?: StyledProp<PaginationIndicatorComposition>
16
- indicatorProps?: Partial<ActivityIndicatorProps>
17
- textProps?: Partial<TextProps<'p'>>
18
- }
@@ -1,10 +0,0 @@
1
- export type ProgressBarComposition =
2
- 'wrapper' |
3
- 'progress' |
4
- 'indicator' |
5
- 'text' |
6
- 'icon' |
7
- 'leftIcon' |
8
- 'leftText' |
9
- 'rightIcon' |
10
- 'rightText'
@@ -1,26 +0,0 @@
1
- import { ProgressBarComposition } from './styles'
2
- import { ProgressProps, ProgressIndicatorProps } from '@radix-ui/react-progress'
3
- import { ProgressPropsRoot } from '..'
4
- import { AppIcon, StyledProp } from '@codeleap/styles'
5
- import { TextProps } from '../../Text/types'
6
- import { IconProps } from '../../Icon/types'
7
- import { ViewProps } from '../../View'
8
-
9
- export type ProgressBarProps =
10
- Omit<ViewProps, 'style'> &
11
- Omit<ProgressPropsRoot, 'style'> &
12
- {
13
- style?: StyledProp<ProgressBarComposition>
14
- progressIndicatorProps?: ProgressIndicatorProps
15
- progressRootProps?: ProgressProps
16
- leftIcon?: AppIcon
17
- leftIconProps?: Partial<IconProps>
18
- rightIcon?: AppIcon
19
- rightIconProps?: Partial<IconProps>
20
- text?: string
21
- textProps?: Partial<TextProps>
22
- leftText?: TextProps['text'] | JSX.Element
23
- leftTextProps?: Partial<TextProps>
24
- rightText?: TextProps['text'] | JSX.Element
25
- rightTextProps?: Partial<TextProps>
26
- }
@@ -1,29 +0,0 @@
1
- import { FormTypes, StylesOf } from '@codeleap/common'
2
- import { InputBaseProps } from '../InputBase'
3
- import { ReactNode } from 'react'
4
- import { StyledProp } from '@codeleap/styles'
5
- import { RadioInputComposition } from './styles'
6
-
7
- type WrapperProps = InputBaseProps
8
-
9
- type RadioOption<T> = FormTypes.Options<T>[number] & {
10
- disabled?: boolean
11
- }
12
-
13
- export type RadioInputProps<T extends string|number> = Omit<WrapperProps, 'style'> & {
14
- options: RadioOption<T>[]
15
- value: T
16
- onValueChange(value: T): void
17
- label: ReactNode
18
- style?: StyledProp<RadioInputComposition>
19
- }
20
-
21
- export type RadioOptionProps<T extends string|number> = {
22
- item: RadioOption<T>
23
- selected: boolean
24
- onSelect(): void
25
- styles?: StylesOf<RadioInputComposition>
26
- debugName?: string
27
- disabled?: boolean
28
- separator?: boolean
29
- }
@@ -1,44 +0,0 @@
1
- import React from 'react'
2
- import { StylesOf } from '@codeleap/common'
3
- import { TextProps } from '../Text'
4
- import { TouchableProps } from '../Touchable'
5
- import { SegmentedControlComposition } from './styles'
6
- import { MotionProps, AnimationProps, ForwardRefComponent } from 'framer-motion'
7
- import { IconProps } from '../Icon'
8
- import { AppIcon, StyledProp } from '@codeleap/styles'
9
-
10
- export type SegmentedControlProps<T = string> = {
11
- options: SegmentedControlOptionProps[]
12
- value?: T
13
- style?: StyledProp<SegmentedControlComposition>
14
- onValueChange?: (v: any) => void
15
- bubbleProps?: React.HTMLAttributes<HTMLDivElement> & MotionProps
16
- label?: string
17
- touchableProps?: Partial<TouchableProps>
18
- debugName?: string
19
- disabled?: boolean
20
- animationProps?: AnimationProps
21
- transitionDuration?: number
22
- RenderAnimatedView?: ForwardRefComponent<HTMLDivElement, any>
23
- textProps?: TextProps
24
- iconProps?: Partial<IconProps>
25
- debounce?: number
26
- debounceEnabled?: boolean
27
- }
28
-
29
- export type OptionRef = TouchableProps['ref']
30
-
31
- export type SegmentedControlOptionProps =
32
- TouchableProps &
33
- {
34
- selected?: boolean
35
- label: string
36
- styles?: StylesOf<SegmentedControlComposition>
37
- value?: any
38
- textProps?: TextProps
39
- iconProps?: Partial<IconProps>
40
- icon?: AppIcon
41
- largestWidth?: {
42
- width: number
43
- }
44
- }
@@ -1,29 +0,0 @@
1
- import { StyledProp } from '@codeleap/styles'
2
- import { InputBaseProps } from '../InputBase'
3
- import { SliderComposition } from './styles'
4
- import { SliderProps as PrimitiveSliderProps } from '@radix-ui/react-slider'
5
- import { CSSProperties } from 'react'
6
-
7
- export type SliderProps =
8
- Partial<Omit<PrimitiveSliderProps, 'value' | 'onValueChange' | 'style'>> &
9
- Pick<InputBaseProps, 'disabled' | 'debugName' | 'description' | 'label'> &
10
- {
11
- indicatorLabel?: {
12
- order?: number[]
13
- separator?: string
14
- transformer?: (value: number[], defaultValue: PrimitiveSliderProps['defaultValue']) => string
15
- }
16
- value: number | number[]
17
- onValueChange: (val: number | number[]) => void
18
- style?: StyledProp<SliderComposition>
19
- trackMarks?: Record<number, string>
20
- trackMarkComponent?: React.ComponentType<TrackMarkProps>
21
- onPressThumbSetValue?: boolean
22
- onPressThumb?: (value: number | number[], thumbIndex: number) => void
23
- }
24
-
25
- export type TrackMarkProps = {
26
- index: number
27
- content?: string | React.ReactNode
28
- style?: CSSProperties
29
- }
@@ -1,13 +0,0 @@
1
- import { StyledProp } from '@codeleap/styles'
2
- import { InputBaseProps } from '../InputBase'
3
- import { SwitchComposition } from './styles'
4
-
5
- export type SwitchProps =
6
- Pick<InputBaseProps, 'debugName' | 'disabled' | 'label'> &
7
- {
8
- style?: StyledProp<SwitchComposition>
9
- value: boolean
10
- onValueChange: (value: boolean) => void
11
- onChange?: (value: boolean) => void
12
- switchOnLeft?: boolean
13
- }