diff --git a/.changeset/two-cows-reply.md b/.changeset/two-cows-reply.md new file mode 100644 index 00000000000..dd9b01aff66 --- /dev/null +++ b/.changeset/two-cows-reply.md @@ -0,0 +1,5 @@ +--- +'@razorpay/blade': patch +--- + +fix(blade): allow consumers to align chips in chipgroup diff --git a/packages/blade/src/components/Chip/AnimatedChip.web.tsx b/packages/blade/src/components/Chip/AnimatedChip.web.tsx index 724fb9f7c93..f65897bc7ba 100644 --- a/packages/blade/src/components/Chip/AnimatedChip.web.tsx +++ b/packages/blade/src/components/Chip/AnimatedChip.web.tsx @@ -14,7 +14,7 @@ const AnimatedChip = styled(BaseBox)((props) => { ); return { ...getAnimatedChipStyles(props), - width: 'fit-content', + width: '100%', transform: `scale(${props.isPressed ? '0.92' : '1'})`, transitionDuration: duration, transitionTimingFunction: easing, diff --git a/packages/blade/src/components/Chip/Chip.tsx b/packages/blade/src/components/Chip/Chip.tsx index 01fa949c773..38b217da706 100644 --- a/packages/blade/src/components/Chip/Chip.tsx +++ b/packages/blade/src/components/Chip/Chip.tsx @@ -39,7 +39,19 @@ type OnChange = ({ }) => void; const _Chip: React.ForwardRefRenderFunction = ( - { isDisabled, value, children, icon: Icon, color, testID, _motionMeta, ...rest }, + { + isDisabled, + value, + children, + icon: Icon, + color, + testID, + _motionMeta, + width, + maxWidth, + minWidth, + ...rest + }, ref, ) => { const { theme } = useTheme(); @@ -72,7 +84,6 @@ const _Chip: React.ForwardRefRenderFunction = ( const useChip = groupProps?.selectionType === 'single' ? useRadio : useCheckbox; const _size = groupProps?.size || 'small'; const chipColor = color ?? groupProps?.color ?? 'primary'; - const handleChange: OnChange = ({ isChecked, value }) => { if (isChecked) { groupProps?.state?.addValue(value!); @@ -147,6 +158,9 @@ const _Chip: React.ForwardRefRenderFunction = ( {...makeAnalyticsAttribute(rest)} display={(isReactNative() ? 'flex' : 'inline-flex') as never} ref={getOuterMotionRef({ _motionMeta, ref })} + width={width} + maxWidth={maxWidth} + minWidth={minWidth} > = ( onKeyDown={handleKeyboardPressedIn} onKeyUp={handleKeyboardPressedOut} inputProps={isReactNative() ? inputProps : {}} - style={{ cursor: _isDisabled ? 'not-allowed' : 'pointer' }} + style={{ + cursor: _isDisabled ? 'not-allowed' : 'pointer', + width: '100%', + }} > - + = ( } height={makeSize(chipHeightTokens[_size])} gap="spacing.3" + width="100%" > {Icon ? ( diff --git a/packages/blade/src/components/Chip/ChipGroup.stories.tsx b/packages/blade/src/components/Chip/ChipGroup.stories.tsx index 2485699e105..a82899b937b 100644 --- a/packages/blade/src/components/Chip/ChipGroup.stories.tsx +++ b/packages/blade/src/components/Chip/ChipGroup.stories.tsx @@ -727,3 +727,82 @@ chipRef.parameters = { exclude: ['icon'], }, }; + +export const CutomLayoutInChipGroup: StoryFn = () => { + const chipArray = [ + { + value: '100', + label: '₹100', + }, + { + value: '500', + label: '₹500', + }, + { + value: '1000', + label: '₹1000', + }, + { + value: '2000', + label: '₹2000', + }, + { + value: '5000', + label: '₹5000', + }, + { + value: '10000', + label: '₹10000', + }, + { + value: '20000', + label: '₹20000', + }, + { + value: '50000', + label: '₹50000', + }, + { + value: '100000', + label: '₹100000', + }, + { + value: '200000', + label: '₹200000', + }, + ]; + + return ( + + + {chipArray.map((chip, index) => ( + + {chip.label} + + ))} + + + + {chipArray.map((chip, index) => ( + + {chip.label} + + ))} + + + + ); +}; + +CutomLayoutInChipGroup.storyName = 'ChipGroup with Custom layout'; diff --git a/packages/blade/src/components/Chip/ChipGroup.tsx b/packages/blade/src/components/Chip/ChipGroup.tsx index af2b0504781..83fb0c5f04e 100644 --- a/packages/blade/src/components/Chip/ChipGroup.tsx +++ b/packages/blade/src/components/Chip/ChipGroup.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { chipGroupGapTokens, chipGroupLabelSizeTokens } from './chipTokens'; +import { chipGroupLabelSizeTokens, chipGroupGapTokens } from './chipTokens'; import { ChipGroupProvider } from './ChipGroupContext'; import { useChipGroup } from './useChipGroup'; import type { ChipGroupProps } from './types'; @@ -96,18 +96,15 @@ const _ChipGroup = ( {accessibilityLabel} - - {React.Children.map(children, (child, index) => { - return ( - - {child} - - ); - })} + + {children} should prioritize Chip's isDisabled prop instead of ChipGroup - - - Apple - - + Apple + @@ -329,208 +326,200 @@ exports[` should prioritize Chip's isDisabled prop instead of ChipGroup - - - Mango - - + Mango + @@ -649,223 +638,220 @@ exports[` should render chip 1`] = ` - - - Apple - - + Apple + @@ -873,208 +859,200 @@ exports[` should render chip 1`] = ` - - - Mango - - + Mango + @@ -1193,323 +1171,320 @@ exports[` should render chip with icon 1`] = ` - - - - - - + + - - - - - Apple - + } + fillRule={0} + propList={ + [ + "fill", + "fillRule", + ] + } + /> + + + + Apple + @@ -1517,308 +1492,300 @@ exports[` should render chip with icon 1`] = ` - - - - - - + + - - - - - Mango - + } + fillRule={0} + propList={ + [ + "fill", + "fillRule", + ] + } + /> + + + + Mango + @@ -1937,223 +1904,220 @@ exports[` should set disabled state with isDisabled 1`] = ` - - - Apple - - + Apple + @@ -2161,208 +2125,200 @@ exports[` should set disabled state with isDisabled 1`] = ` - - - Mango - - + Mango + diff --git a/packages/blade/src/components/Chip/__tests__/__snapshots__/Chip.ssr.test.tsx.snap b/packages/blade/src/components/Chip/__tests__/__snapshots__/Chip.ssr.test.tsx.snap index bcf1fad3d18..39cd293b920 100644 --- a/packages/blade/src/components/Chip/__tests__/__snapshots__/Chip.ssr.test.tsx.snap +++ b/packages/blade/src/components/Chip/__tests__/__snapshots__/Chip.ssr.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[` should render with icon 1`] = `"

Select fruits

"`; +exports[` should render with icon 1`] = `"

Select fruits

"`; exports[` should render with icon 2`] = ` .c0.c0.c0.c0.c0 { @@ -24,20 +24,30 @@ exports[` should render with icon 2`] = ` -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -} - -.c4.c4.c4.c4.c4 { margin-bottom: 8px; - margin-right: 8px; + row-gap: 8px; + -webkit-column-gap: 8px; + column-gap: 8px; } -.c5.c5.c5.c5.c5 { +.c4.c4.c4.c4.c4 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; } +.c6.c6.c6.c6.c6 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + width: 100%; +} + .c7.c7.c7.c7.c7 { display: -webkit-box; display: -webkit-flex; @@ -77,6 +87,7 @@ exports[` should render with icon 2`] = ` padding-right: 12px; padding-left: 12px; height: 28px; + width: 100%; gap: 8px; background-color: hsla(0,0%,100%,1); border-radius: 9999px; @@ -118,9 +129,7 @@ exports[` should render with icon 2`] = ` text-align: left; text-overflow: ellipsis; max-width: 420px; - width: -webkit-fit-content; - width: -moz-fit-content; - width: fit-content; + width: 100%; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); @@ -146,7 +155,7 @@ exports[` should render with icon 2`] = ` transition-duration: 160ms; } -.c6.c6.c6.c6.c6 { +.c5.c5.c5.c5.c5 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -343,173 +352,163 @@ exports[` should render with icon 2`] = ` >
-
- -
+
+
-
- -
+
+ diff --git a/packages/blade/src/components/Chip/__tests__/__snapshots__/Chip.web.test.tsx.snap b/packages/blade/src/components/Chip/__tests__/__snapshots__/Chip.web.test.tsx.snap index a4a32e803ca..f888a4746a9 100644 --- a/packages/blade/src/components/Chip/__tests__/__snapshots__/Chip.web.test.tsx.snap +++ b/packages/blade/src/components/Chip/__tests__/__snapshots__/Chip.web.test.tsx.snap @@ -22,20 +22,30 @@ exports[` should accept data-analytics-* 1`] = ` -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -} - -.c4.c4.c4.c4.c4 { margin-bottom: 8px; - margin-right: 8px; + row-gap: 8px; + -webkit-column-gap: 8px; + column-gap: 8px; } -.c5.c5.c5.c5.c5 { +.c4.c4.c4.c4.c4 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; } +.c6.c6.c6.c6.c6 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + width: 100%; +} + .c7.c7.c7.c7.c7 { display: -webkit-box; display: -webkit-flex; @@ -75,6 +85,7 @@ exports[` should accept data-analytics-* 1`] = ` padding-right: 12px; padding-left: 12px; height: 28px; + width: 100%; gap: 8px; background-color: hsla(0,0%,100%,1); border-radius: 9999px; @@ -109,9 +120,7 @@ exports[` should accept data-analytics-* 1`] = ` text-align: left; text-overflow: ellipsis; max-width: 420px; - width: -webkit-fit-content; - width: -moz-fit-content; - width: fit-content; + width: 100%; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); @@ -137,7 +146,7 @@ exports[` should accept data-analytics-* 1`] = ` transition-duration: 160ms; } -.c6.c6.c6.c6.c6 { +.c5.c5.c5.c5.c5 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -333,111 +342,101 @@ exports[` should accept data-analytics-* 1`] = ` >
-
- -
+
+
-
- -
+
+ @@ -468,20 +467,30 @@ exports[` should render chip 1`] = ` -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -} - -.c4.c4.c4.c4.c4 { margin-bottom: 8px; - margin-right: 8px; + row-gap: 8px; + -webkit-column-gap: 8px; + column-gap: 8px; } -.c5.c5.c5.c5.c5 { +.c4.c4.c4.c4.c4 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; } +.c6.c6.c6.c6.c6 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + width: 100%; +} + .c7.c7.c7.c7.c7 { display: -webkit-box; display: -webkit-flex; @@ -521,6 +530,7 @@ exports[` should render chip 1`] = ` padding-right: 12px; padding-left: 12px; height: 28px; + width: 100%; gap: 8px; background-color: hsla(0,0%,100%,1); border-radius: 9999px; @@ -555,9 +565,7 @@ exports[` should render chip 1`] = ` text-align: left; text-overflow: ellipsis; max-width: 420px; - width: -webkit-fit-content; - width: -moz-fit-content; - width: fit-content; + width: 100%; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); @@ -583,7 +591,7 @@ exports[` should render chip 1`] = ` transition-duration: 160ms; } -.c6.c6.c6.c6.c6 { +.c5.c5.c5.c5.c5 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -778,109 +786,99 @@ exports[` should render chip 1`] = ` >
-
- -
+
+
-
- -
+
+ @@ -911,20 +909,30 @@ exports[` should render chip with icon 1`] = ` -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -} - -.c4.c4.c4.c4.c4 { margin-bottom: 8px; - margin-right: 8px; + row-gap: 8px; + -webkit-column-gap: 8px; + column-gap: 8px; } -.c5.c5.c5.c5.c5 { +.c4.c4.c4.c4.c4 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; } +.c6.c6.c6.c6.c6 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + width: 100%; +} + .c7.c7.c7.c7.c7 { display: -webkit-box; display: -webkit-flex; @@ -964,6 +972,7 @@ exports[` should render chip with icon 1`] = ` padding-right: 12px; padding-left: 12px; height: 28px; + width: 100%; gap: 8px; background-color: hsla(0,0%,100%,1); border-radius: 9999px; @@ -1005,9 +1014,7 @@ exports[` should render chip with icon 1`] = ` text-align: left; text-overflow: ellipsis; max-width: 420px; - width: -webkit-fit-content; - width: -moz-fit-content; - width: fit-content; + width: 100%; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); @@ -1033,7 +1040,7 @@ exports[` should render chip with icon 1`] = ` transition-duration: 160ms; } -.c6.c6.c6.c6.c6 { +.c5.c5.c5.c5.c5 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -1228,173 +1235,163 @@ exports[` should render chip with icon 1`] = ` >
-
- -
+
+
-
- -
+
+ @@ -1425,20 +1422,30 @@ exports[` should set disabled state with isDisabled 1`] = ` -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -} - -.c4.c4.c4.c4.c4 { margin-bottom: 8px; - margin-right: 8px; + row-gap: 8px; + -webkit-column-gap: 8px; + column-gap: 8px; } -.c5.c5.c5.c5.c5 { +.c4.c4.c4.c4.c4 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; } +.c6.c6.c6.c6.c6 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + width: 100%; +} + .c7.c7.c7.c7.c7 { display: -webkit-box; display: -webkit-flex; @@ -1478,6 +1485,7 @@ exports[` should set disabled state with isDisabled 1`] = ` padding-right: 12px; padding-left: 12px; height: 28px; + width: 100%; gap: 8px; background-color: hsla(0,0%,100%,0); border-radius: 9999px; @@ -1511,6 +1519,7 @@ exports[` should set disabled state with isDisabled 1`] = ` padding-right: 12px; padding-left: 12px; height: 28px; + width: 100%; gap: 8px; background-color: hsla(0,0%,100%,1); border-radius: 9999px; @@ -1545,9 +1554,7 @@ exports[` should set disabled state with isDisabled 1`] = ` text-align: left; text-overflow: ellipsis; max-width: 420px; - width: -webkit-fit-content; - width: -moz-fit-content; - width: fit-content; + width: 100%; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); @@ -1583,9 +1590,7 @@ exports[` should set disabled state with isDisabled 1`] = ` text-align: left; text-overflow: ellipsis; max-width: 420px; - width: -webkit-fit-content; - width: -moz-fit-content; - width: fit-content; + width: 100%; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); @@ -1619,7 +1624,7 @@ exports[` should set disabled state with isDisabled 1`] = ` transition-duration: 160ms; } -.c6.c6.c6.c6.c6 { +.c5.c5.c5.c5.c5 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -1925,110 +1930,100 @@ exports[` should set disabled state with isDisabled 1`] = ` >
-
- -
+
+
-
- -
+
+ diff --git a/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.native.test.tsx.snap b/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.native.test.tsx.snap index b8c53c3825c..3e659411475 100644 --- a/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.native.test.tsx.snap +++ b/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.native.test.tsx.snap @@ -231,222 +231,219 @@ exports[` selectionType="multiple" should render with selectionType />
- - - Apple - - + Apple + @@ -454,207 +451,199 @@ exports[` selectionType="multiple" should render with selectionType - - - Mango - - + Mango + @@ -662,207 +651,199 @@ exports[` selectionType="multiple" should render with selectionType - - - Orange - - + Orange + @@ -1108,223 +1089,220 @@ exports[` selectionType="single" should render with selectionType=" /> - - - Apple - - + Apple + @@ -1332,208 +1310,200 @@ exports[` selectionType="single" should render with selectionType=" - - - Mango - - + Mango + @@ -1541,208 +1511,200 @@ exports[` selectionType="single" should render with selectionType=" - - - Orange - - + Orange + diff --git a/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.ssr.test.tsx.snap b/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.ssr.test.tsx.snap index 87d0bad877b..d0196ba6aef 100644 --- a/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.ssr.test.tsx.snap +++ b/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.ssr.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[` should render with selectionType="single" 1`] = `"

Select fruits

Select flowers

"`; +exports[` should render with selectionType="single" 1`] = `"

Select fruits

Select flowers

"`; exports[` should render with selectionType="single" 2`] = ` .c0.c0.c0.c0.c0 { @@ -24,20 +24,30 @@ exports[` should render with selectionType="single" 2`] = ` -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -} - -.c4.c4.c4.c4.c4 { margin-bottom: 8px; - margin-right: 8px; + row-gap: 8px; + -webkit-column-gap: 8px; + column-gap: 8px; } -.c5.c5.c5.c5.c5 { +.c4.c4.c4.c4.c4 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; } +.c6.c6.c6.c6.c6 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + width: 100%; +} + .c7.c7.c7.c7.c7 { display: -webkit-box; display: -webkit-flex; @@ -77,6 +87,7 @@ exports[` should render with selectionType="single" 2`] = ` padding-right: 12px; padding-left: 12px; height: 28px; + width: 100%; gap: 8px; background-color: hsla(0,0%,100%,1); border-radius: 9999px; @@ -111,9 +122,7 @@ exports[` should render with selectionType="single" 2`] = ` text-align: left; text-overflow: ellipsis; max-width: 420px; - width: -webkit-fit-content; - width: -moz-fit-content; - width: fit-content; + width: 100%; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); @@ -139,7 +148,7 @@ exports[` should render with selectionType="single" 2`] = ` transition-duration: 160ms; } -.c6.c6.c6.c6.c6 { +.c5.c5.c5.c5.c5 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -340,162 +349,147 @@ exports[` should render with selectionType="single" 2`] = ` >
-
- -
+
+
-
- -
+
+
-
- -
+
+ @@ -532,159 +526,144 @@ exports[` should render with selectionType="single" 2`] = ` >
-
- -
+
+
-
- -
+
+
-
- -
+
+ diff --git a/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.web.test.tsx.snap b/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.web.test.tsx.snap index 8522163c0fa..0044e1d84df 100644 --- a/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.web.test.tsx.snap +++ b/packages/blade/src/components/Chip/__tests__/__snapshots__/ChipGroup.web.test.tsx.snap @@ -42,20 +42,30 @@ exports[` selectionType="multiple" should render with selectionType -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -} - -.c7.c7.c7.c7.c7 { margin-bottom: 8px; - margin-right: 8px; + row-gap: 8px; + -webkit-column-gap: 8px; + column-gap: 8px; } -.c8.c8.c8.c8.c8 { +.c7.c7.c7.c7.c7 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; } +.c9.c9.c9.c9.c9 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + width: 100%; +} + .c10.c10.c10.c10.c10 { display: -webkit-box; display: -webkit-flex; @@ -95,6 +105,7 @@ exports[` selectionType="multiple" should render with selectionType padding-right: 12px; padding-left: 12px; height: 28px; + width: 100%; gap: 8px; background-color: hsla(0,0%,100%,1); border-radius: 9999px; @@ -129,9 +140,7 @@ exports[` selectionType="multiple" should render with selectionType text-align: left; text-overflow: ellipsis; max-width: 420px; - width: -webkit-fit-content; - width: -moz-fit-content; - width: fit-content; + width: 100%; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); @@ -157,7 +166,7 @@ exports[` selectionType="multiple" should render with selectionType transition-duration: 160ms; } -.c9.c9.c9.c9.c9 { +.c8.c8.c8.c8.c8 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -404,159 +413,144 @@ exports[` selectionType="multiple" should render with selectionType >
-
- -
+
+
-
- -
+
+
-
- -
+
+ @@ -607,20 +601,30 @@ exports[` selectionType="single" should render with selectionType=" -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -} - -.c7.c7.c7.c7.c7 { margin-bottom: 8px; - margin-right: 8px; + row-gap: 8px; + -webkit-column-gap: 8px; + column-gap: 8px; } -.c8.c8.c8.c8.c8 { +.c7.c7.c7.c7.c7 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; } +.c9.c9.c9.c9.c9 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + width: 100%; +} + .c10.c10.c10.c10.c10 { display: -webkit-box; display: -webkit-flex; @@ -660,6 +664,7 @@ exports[` selectionType="single" should render with selectionType=" padding-right: 12px; padding-left: 12px; height: 28px; + width: 100%; gap: 8px; background-color: hsla(0,0%,100%,1); border-radius: 9999px; @@ -694,9 +699,7 @@ exports[` selectionType="single" should render with selectionType=" text-align: left; text-overflow: ellipsis; max-width: 420px; - width: -webkit-fit-content; - width: -moz-fit-content; - width: fit-content; + width: 100%; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); @@ -722,7 +725,7 @@ exports[` selectionType="single" should render with selectionType=" transition-duration: 160ms; } -.c9.c9.c9.c9.c9 { +.c8.c8.c8.c8.c8 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -969,162 +972,147 @@ exports[` selectionType="single" should render with selectionType=" >
-
- -
+
+
-
- -
+
+
-
- -
+
+ diff --git a/packages/blade/src/components/Chip/types.ts b/packages/blade/src/components/Chip/types.ts index d53bd8534ea..a7f58cfd43a 100644 --- a/packages/blade/src/components/Chip/types.ts +++ b/packages/blade/src/components/Chip/types.ts @@ -4,6 +4,7 @@ import type { IconComponent } from '~components/Icons'; import type { DataAnalyticsAttribute, StringChildrenType, TestID } from '~utils/types'; import type { DotNotationToken } from '~utils/lodashButBetter/get'; import type { MotionMetaProp } from '~components/BaseMotion'; +import type { BaseBoxProps } from '~components/Box/BaseBox/types/propsTypes'; type ChipCommonProps = { /** @@ -29,6 +30,18 @@ type ChipCommonProps = { * Use `onChange` to update its value */ value?: string; + /** + * width prop sets the width of the Chip + */ + width?: BaseBoxProps['width']; + /** + * maxWidth prop sets the maxWidth of the Chip + */ + maxWidth?: BaseBoxProps['maxWidth']; + /** + * min prop sets the minWidth of the Chip + */ + minWidth?: BaseBoxProps['minWidth']; } & TestID & DataAnalyticsAttribute & StyledPropsBlade & @@ -226,6 +239,9 @@ type AnimatedChipProps = { isDesktop?: boolean; theme: Theme; children: React.ReactNode; + width?: BaseBoxProps['width']; + maxWidth?: BaseBoxProps['maxWidth']; + minWidth?: BaseBoxProps['minWidth']; }; type StyledChipWrapperProps = {