Skip to content

Commit d5b3372

Browse files
committed
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-lib into feature/approval-policy-exceptions
2 parents 63617f5 + 5fb8550 commit d5b3372

File tree

21 files changed

+474
-189
lines changed

21 files changed

+474
-189
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.10.16-beta-2",
3+
"version": "1.10.17",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const ROUTES = {
114114
ATTRIBUTES_USER: 'attributes/user',
115115
GET: 'get',
116116
UPDATE: 'update',
117+
PATCH: 'patch',
117118
ENVIRONMENT_LIST_MIN: 'env/autocomplete',
118119
CLUSTER: 'cluster',
119120
API_RESOURCE: 'k8s/api-resources',

src/Shared/Components/ConfirmationModal/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ export { default as ConfirmationModal, BaseConfirmationModal } from './Confirmat
1818
export { DeleteConfirmationModal } from './DeleteConfirmationModal'
1919
export { ForceDeleteConfirmationModal } from './ForceDeleteConfirmationModal'
2020
export { CannotDeleteModal } from './CannotDeleteModal'
21-
export { ConfirmationModalVariantType, type ConfirmationModalProps } from './types'
21+
export { ConfirmationModalVariantType, type ConfirmationModalProps, type DeleteConfirmationModalProps } from './types'
2222
export { ConfirmationModalProvider } from './ConfirmationModalContext'
2323
export { getConfirmationLabel } from './utils'

src/Shared/Components/DatePicker/constants.ts

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -145,62 +145,3 @@ export const DATE_PICKER_IDS = {
145145
MONTH: 'month_picker',
146146
TIME: 'time_picker',
147147
}
148-
149-
export const reactSelectStyles = {
150-
container: (base) => ({
151-
...base,
152-
height: '36px',
153-
}),
154-
control: (base, state) => ({
155-
...base,
156-
boxShadow: 'none',
157-
minHeight: '36px',
158-
cursor: 'pointer',
159-
borderColor: 'var(--N200)',
160-
backgroundColor: 'var(--bg-secondary)',
161-
162-
...(state.isDisabled
163-
? {
164-
borderColor: 'var(--N200)',
165-
backgroundColor: 'var(--N100)',
166-
cursor: 'not-allowed',
167-
}
168-
: {}),
169-
170-
'&:hover': {
171-
borderColor: 'var(--N400)',
172-
},
173-
'&:focus, &:focus-within': {
174-
borderColor: 'var(--B500)',
175-
outline: 'none',
176-
},
177-
}),
178-
valueContainer: (base) => ({
179-
...base,
180-
padding: 0,
181-
width: '180px',
182-
}),
183-
input: (base) => ({
184-
...base,
185-
padding: 0,
186-
margin: 0,
187-
}),
188-
dropdownIndicator: (base, state) => ({
189-
...base,
190-
transition: 'all .2s ease',
191-
transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'rotate(0deg)',
192-
padding: 0,
193-
}),
194-
option: (base) => ({
195-
...base,
196-
fontSize: '13px',
197-
cursor: 'pointer',
198-
}),
199-
menuList: (base) => ({
200-
...base,
201-
position: 'relative',
202-
paddingBottom: '0px',
203-
maxHeight: '250px',
204-
width: '200px',
205-
}),
206-
}

src/Shared/Components/ReactSelect/constants.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import { components, DropdownIndicatorProps, StylesConfig } from 'react-select'
1818
import { ReactComponent as DropDownIcon } from '@Icons/ic-chevron-down.svg'
19+
import { NO_MATCHING_RESULT, TYPE_3_CHARACTERS_TO_SEE_MATCHING_RESULTS } from '@Shared/constants'
1920

2021
export const CommonGroupedDropdownStyles: StylesConfig = {
2122
container: (base, state) => ({
@@ -189,9 +190,21 @@ export const AppSelectorDropdownIndicator = (props: DropdownIndicatorProps) => {
189190
)
190191
}
191192

193+
/**
194+
*
195+
* @returns {string}
196+
* @description Returns the no matching result text for the select component.
197+
*/
198+
export const getNoMatchingResultText = () => NO_MATCHING_RESULT
199+
200+
/**
201+
* @param inputObj
202+
* @returns {string}
203+
* @description Returns the no options message for the select component.
204+
*/
192205
export const AppSelectorNoOptionsMessage = (inputObj: { inputValue: string }): string => {
193206
if (inputObj && (inputObj.inputValue === '' || inputObj.inputValue.length < 3)) {
194-
return 'Type 3 chars to see matching results'
207+
return TYPE_3_CHARACTERS_TO_SEE_MATCHING_RESULTS
195208
}
196-
return 'No matching results'
209+
return getNoMatchingResultText()
197210
}

src/Shared/Components/SelectPicker/SelectPicker.component.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import {
1818
GroupHeadingProps,
1919
MultiValueProps,
2020
OptionProps,
21-
ValueContainerProps,
2221
Props as ReactSelectProps,
22+
ValueContainerProps,
2323
} from 'react-select'
2424
import CreatableSelect from 'react-select/creatable'
2525
import { ReactElement, useCallback, useMemo, useRef, useState } from 'react'
@@ -28,23 +28,24 @@ import { ConditionalWrap } from '@Common/Helper'
2828
import Tippy from '@tippyjs/react'
2929
import { deriveBorderRadiusAndBorderClassFromConfig, isNullOrUndefined } from '@Shared/Helpers'
3030
import { getCommonSelectStyle, getSelectPickerOptionByValue } from './utils'
31+
32+
import { SelectPickerOptionType, SelectPickerProps, SelectPickerVariantType } from './type'
33+
import FormFieldWrapper from '../FormFieldWrapper/FormFieldWrapper'
34+
import { getFormFieldAriaAttributes } from '../FormFieldWrapper'
3135
import {
32-
SelectPickerMultiValueLabel,
33-
SelectPickerMultiValueRemove,
36+
renderLoadingMessage,
3437
SelectPickerClearIndicator,
3538
SelectPickerControl,
3639
SelectPickerDropdownIndicator,
3740
SelectPickerGroupHeading,
41+
SelectPickerInput,
3842
SelectPickerMenuList,
43+
SelectPickerMultiValueLabel,
44+
SelectPickerMultiValueRemove,
3945
SelectPickerOption,
4046
SelectPickerValueContainer,
41-
SelectPickerInput,
4247
} from './common'
43-
import { SelectPickerOptionType, SelectPickerProps, SelectPickerVariantType } from './type'
4448
import { GenericSectionErrorState } from '../GenericSectionErrorState'
45-
import FormFieldWrapper from '../FormFieldWrapper/FormFieldWrapper'
46-
import { getFormFieldAriaAttributes } from '../FormFieldWrapper'
47-
import './selectPicker.scss'
4849

4950
/**
5051
* Generic component for select picker
@@ -180,6 +181,7 @@ import './selectPicker.scss'
180181
* />
181182
* ```
182183
*/
184+
183185
const SelectPicker = <OptionValue, IsMulti extends boolean>({
184186
error,
185187
icon,
@@ -268,6 +270,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
268270
)
269271

270272
// Used to show the create new option for creatable select and the option(s) doesn't have the input value
273+
271274
const isValidNewOption = (_inputValue: string) => {
272275
const trimmedInput = _inputValue?.trim()
273276

@@ -459,6 +462,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
459462
MultiValueRemove: SelectPickerMultiValueRemove,
460463
GroupHeading: renderGroupHeading,
461464
NoOptionsMessage: renderNoOptionsMessage,
465+
LoadingMessage: renderLoadingMessage,
462466
Input: SelectPickerInput,
463467
...(shouldHideMenu && {
464468
Menu: () => null,

src/Shared/Components/SelectPicker/SelectPickerTextArea.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import { InputActionMeta, SelectInstance, SingleValue } from 'react-select'
2020
import { ReactSelectInputAction } from '@Common/Constants'
2121
import { useThrottledEffect } from '@Common/Helper'
2222

23-
import SelectPicker from './SelectPicker.component'
2423
import { SelectPickerOptionType, SelectPickerTextAreaProps } from './type'
24+
import SelectPicker from './SelectPicker.component'
2525

2626
export const SelectPickerTextArea = ({
2727
value,

src/Shared/Components/SelectPicker/common.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ export const SelectPickerDropdownIndicator = <OptionValue,>(
7575

7676
return (
7777
<components.DropdownIndicator {...props}>
78-
{isLoading ? <Progressing /> : <ICCaretDown className={isDisabled ? 'scn-3' : 'scn-6'} />}
78+
{isLoading ? (
79+
<Progressing fillColor="var(--N500)" />
80+
) : (
81+
<ICCaretDown className={isDisabled ? 'scn-3' : 'scn-6'} />
82+
)}
7983
</components.DropdownIndicator>
8084
)
8185
}
@@ -421,3 +425,7 @@ export const SelectPickerGroupHeading = <OptionValue,>({
421425
</components.GroupHeading>
422426
)
423427
}
428+
429+
export const renderLoadingMessage = () => (
430+
<p className="m-0 cn-7 fs-13 fw-4 lh-20 py-6 px-8 dc__loading-dots">Loading</p>
431+
)

src/Shared/Hooks/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ export * from './UseDownload'
2020
export * from './useForm'
2121
export * from './useStickyEvent'
2222
export * from './useOneTimePrompt'
23+
export * from './useUserPreferences'

0 commit comments

Comments
 (0)