Skip to content

Commit f414425

Browse files
committed
fix: add fullWidth, description ellipsis 2 line and border less bg color
1 parent 185304b commit f414425

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
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": "0.2.2-beta-6",
3+
"version": "0.2.2-beta-7",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
206206
isSearchable,
207207
selectRef,
208208
shouldMenuAlignRight = false,
209+
fullWidth = false,
209210
...props
210211
}: SelectPickerProps<OptionValue, IsMulti>) => {
211212
const { inputId, required, isDisabled, controlShouldRenderValue = true, value } = props
@@ -326,7 +327,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
326327
)
327328

328329
return (
329-
<div className="flex column left top dc__gap-4">
330+
<div className={`flex column left top dc__gap-4 ${fullWidth ? 'w-100' : ''}`}>
330331
{/* Note: Common out for fields */}
331332
<div className="flex column left top dc__gap-6 w-100">
332333
{label && (

src/Shared/Components/SelectPicker/common.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const SelectPickerOption = <OptionValue, IsMulti extends boolean>({
152152
{/* Add support for custom ellipsis if required */}
153153
{showDescription && (
154154
<p
155-
className={`m-0 fs-12 fw-4 lh-18 cn-7 ${!disableDescriptionEllipsis ? 'dc__truncate' : ''}`}
155+
className={`m-0 fs-12 fw-4 lh-18 cn-7 ${!disableDescriptionEllipsis ? 'dc__ellipsis-right__2nd-line' : ''}`}
156156
>
157157
{description}
158158
</p>

src/Shared/Components/SelectPicker/type.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ export type SelectPickerProps<OptionValue = number | string, IsMulti extends boo
150150
* @default false
151151
*/
152152
shouldMenuAlignRight?: boolean
153+
/**
154+
* If true, the select spans to the max available width
155+
*
156+
* @default false
157+
*/
158+
fullWidth?: boolean
153159
} & (IsMulti extends true
154160
? {
155161
isMulti: IsMulti | boolean

src/Shared/Components/SelectPicker/utils.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ const getVariantOverrides = <OptionValue>(
3939
switch (variant) {
4040
case SelectPickerVariantType.BORDER_LESS:
4141
return {
42-
menu: () => ({
43-
width: '250px',
44-
}),
4542
control: () => ({
46-
backgroundColor: 'var(--N0)',
43+
backgroundColor: 'transparent',
4744
border: 'none',
4845
padding: 0,
4946
gap: '2px',
@@ -92,7 +89,7 @@ export const getCommonSelectStyle = <OptionValue, IsMulti extends boolean>({
9289
pointerEvents: 'auto',
9390
}),
9491
}),
95-
menu: (base, state) => ({
92+
menu: (base) => ({
9693
...base,
9794
overflow: 'hidden',
9895
marginBlock: '4px',
@@ -105,7 +102,6 @@ export const getCommonSelectStyle = <OptionValue, IsMulti extends boolean>({
105102
...(shouldMenuAlignRight && {
106103
right: 0,
107104
}),
108-
...(getVariantOverrides(variant)?.menu(base, state) || {}),
109105
}),
110106
menuList: (base) => ({
111107
...base,

0 commit comments

Comments
 (0)