Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(StepGroup): StepGroup Implementation & Documentation #2131

Merged
merged 41 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bbad708
feat: add basic structure
saurabhdaware Apr 12, 2024
d781c8f
feat: add click
saurabhdaware Apr 12, 2024
87c8480
feat: code table test
saurabhdaware Apr 12, 2024
739223e
feat: finish base decision doc
saurabhdaware Apr 12, 2024
5dc29ad
feat: add alternate api
saurabhdaware Apr 12, 2024
d60c5db
feat: make props more prominent
saurabhdaware Apr 12, 2024
e6fab9c
feat: turn types into table
saurabhdaware Apr 12, 2024
8d17dbd
feat: add children
saurabhdaware Apr 12, 2024
1834b96
feat: add straight line StepItem
saurabhdaware Apr 15, 2024
1afdec4
feat: add dotted line
saurabhdaware Apr 16, 2024
bc15993
feat: save item index logic
saurabhdaware Apr 17, 2024
b7def80
feat: add first and last line trimming
saurabhdaware Apr 18, 2024
3bf171d
feat: make interactive
saurabhdaware Apr 18, 2024
6eb676f
fix: horizontal heights
saurabhdaware Apr 18, 2024
93c2059
feat: handle StepItemIndicator
saurabhdaware Apr 18, 2024
4e179df
feat: add dotted svgs
saurabhdaware Apr 18, 2024
35980d0
fix: handle dotted line in horizontal
saurabhdaware Apr 18, 2024
c5f6790
fix: naming of file
saurabhdaware Apr 18, 2024
f0f77e2
docs: add user based documentations
saurabhdaware Apr 19, 2024
b1fa830
feat: stepper docs
saurabhdaware Apr 19, 2024
219700e
feat: rename leading prop to marker
saurabhdaware Apr 19, 2024
c298e74
feat: add react router example
saurabhdaware Apr 19, 2024
33f4f78
export StepGroup from index.ts
saurabhdaware Apr 19, 2024
03e769a
feat: add jsdoc
saurabhdaware Apr 19, 2024
c10ae20
feat: add width prop
saurabhdaware Apr 19, 2024
1dabe94
docs: add StepItem playground story
saurabhdaware Apr 19, 2024
c71db77
fix: ts errors
saurabhdaware Apr 19, 2024
a472eb2
fix: resolve comments
saurabhdaware Apr 19, 2024
01247fb
fix: add visibility prop to omit from html filter
saurabhdaware Apr 19, 2024
b9e90cf
fix: dotted line
saurabhdaware Apr 24, 2024
e367201
fix: spacings and gaps in horizontal orientation
saurabhdaware Apr 24, 2024
244b855
fix: storybook sorting of marker prop
saurabhdaware Apr 24, 2024
3f65cd0
fix: trailing prop breaking in storybook orientation horizontal
saurabhdaware Apr 24, 2024
e671989
fix: spacing of items between dots
saurabhdaware Apr 24, 2024
88d64b2
fix: dots spacing without weird math
saurabhdaware Apr 24, 2024
d2ffa99
fix: spacing without token
saurabhdaware Apr 24, 2024
a143f35
fix: border styles type
saurabhdaware Apr 24, 2024
09dd8b8
fix: curved dotted lines
saurabhdaware Apr 25, 2024
d46ab20
fix: conflicts
saurabhdaware Apr 25, 2024
4b43ef9
fix: spacings in story
saurabhdaware Apr 25, 2024
8d2d96b
feat: add padding around to keep focus ring uncut
saurabhdaware Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/blade/src/components/Amount/Amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,11 @@ const _Amount = ({
</BaseText>
)}
{isStrikethrough && (
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore: the borderBottomColor error below is thrown here as well
<BaseBox
// @ts-expect-error - intentionally setting the border color to the color prop for this hacky strikethrough
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore- intentionally setting the border color to the color prop for this hacky strikethrough
borderBottomColor={amountValueColor}
borderBottomWidth={type === 'body' ? 'thin' : 'thicker'}
borderBottomStyle="solid"
Expand Down
55 changes: 49 additions & 6 deletions packages/blade/src/components/Box/BaseBox/baseBoxStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,30 @@ export const getElevationValue = (
getIn(theme, `elevation.${responsiveElevationValue!}`);
};

type GetBorderStyleValueReturnType =
| CSSObject['borderStyle']
| CSSObject['borderTopStyle']
| CSSObject['borderBottomStyle']
| CSSObject['borderLeftStyle']
| CSSObject['borderRightStyle'];
const getBorderStyleValue = (
borderStyle: BaseBoxProps['borderStyle'],
breakpoint?: keyof Breakpoints,
hasBorder?: boolean,
// Using any as return type because borderStyle's type is incompatible with borderBottomStyle. There are ways to fix it but anyway since its internal function. Taking an easy way out
saurabhdaware marked this conversation as resolved.
Show resolved Hide resolved
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): GetBorderStyleValueReturnType => {
if (borderStyle) {
return getResponsiveValue(borderStyle, breakpoint);
}

if (hasBorder) {
return 'solid';
}

return undefined;
};

const getAllProps = (
props: BaseBoxProps & { theme: Theme },
breakpoint?: keyof Breakpoints,
Expand Down Expand Up @@ -220,17 +244,36 @@ const getAllProps = (
props.theme,
breakpoint,
),
borderStyle: hasBorder ? 'solid' : undefined,
borderStyle: getBorderStyleValue(
props.borderStyle,
breakpoint,
Boolean(hasBorder),
) as CSSObject['borderStyle'],
cursor: getResponsiveValue(props.cursor, breakpoint),
// Since we only allow 'solid', we can use the same value for all borders if hasBorder is true
// If hasBorder is false, we need to check each border individually
...(!hasBorder && {
borderTopStyle: hasBorderTop ? 'solid' : undefined,
borderBottomStyle: hasBorderBottom ? 'solid' : undefined,
borderLeftStyle: hasBorderLeft ? 'solid' : undefined,
borderRightStyle: hasBorderRight ? 'solid' : undefined,
borderTopStyle: getBorderStyleValue(
props.borderTopStyle,
breakpoint,
Boolean(hasBorderTop),
) as CSSObject['borderTopStyle'],
borderBottomStyle: getBorderStyleValue(
props.borderBottomStyle,
breakpoint,
Boolean(hasBorderBottom),
) as CSSObject['borderBottomStyle'],
borderLeftStyle: getBorderStyleValue(
props.borderLeftStyle,
breakpoint,
Boolean(hasBorderLeft),
) as CSSObject['borderLeftStyle'],
borderRightStyle: getBorderStyleValue(
props.borderRightStyle,
breakpoint,
Boolean(hasBorderRight),
) as CSSObject['borderRightStyle'],
}),

touchAction: getResponsiveValue(props.touchAction, breakpoint),
userSelect: getResponsiveValue(props.userSelect, breakpoint),
pointerEvents: getResponsiveValue(props.pointerEvents),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ type CommonBoxVisualProps = MakeObjectResponsive<
| 'transform'
| 'transformOrigin'
| 'clipPath'
| 'borderStyle'
| 'borderTopStyle'
| 'borderBottomStyle'
| 'borderLeftStyle'
| 'borderRightStyle'
> & {
/**
* Sets the elevation for Box
Expand Down Expand Up @@ -218,7 +223,8 @@ type StyledPropsBlade = Partial<
| 'gridColumnEnd'
| 'gridArea'
> &
Pick<LayoutProps, 'display'>,
Pick<LayoutProps, 'display'> &
Pick<CommonBoxVisualProps, 'visibility'>,
'__brand__'
>
>;
Expand Down
5 changes: 5 additions & 0 deletions packages/blade/src/components/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,19 @@ const makeBoxProps = (
// Border
borderWidth: props.borderWidth,
borderColor: props.borderColor,
borderStyle: props.borderStyle,
borderTopWidth: props.borderTopWidth,
borderTopColor: props.borderTopColor,
borderTopStyle: props.borderTopStyle,
borderRightWidth: props.borderRightWidth,
borderRightColor: props.borderRightColor,
borderRightStyle: props.borderRightStyle,
borderBottomWidth: props.borderBottomWidth,
borderBottomColor: props.borderBottomColor,
borderBottomStyle: props.borderBottomStyle,
borderLeftWidth: props.borderLeftWidth,
borderLeftColor: props.borderLeftColor,
borderLeftStyle: props.borderLeftStyle,
borderRadius: props.borderRadius,
borderTopLeftRadius: props.borderTopLeftRadius,
borderTopRightRadius: props.borderTopRightRadius,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const makeStyledProps = (props: StyledPropsInputType): KeysRequired<StyledPropsB
right: props.right,
bottom: props.bottom,
left: props.left,
visibility: props.visibility,
};
};

Expand Down
2 changes: 1 addition & 1 deletion packages/blade/src/components/Icons/_Svg/Svg/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export type SvgProps = {
width: string;
fillOpacity?: number;
} & TestID &
Omit<StyledPropsBlade, 'order'>; // Order prop on SVG has different meaning so removing this prop from styledProps
Omit<StyledPropsBlade, 'order' | 'visibility'>; // Order prop on SVG has different meaning so removing this prop from styledProps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi visibility prop is getting into DOM:

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a transient prop $visibility?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a filter on Box to filter out some of these props. I added visibility there so it should be fixed now

7 changes: 5 additions & 2 deletions packages/blade/src/components/Indicator/Indicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type IndicatorCommonProps = {
*
* @default neutral
*/
color?: FeedbackColors;
color?: FeedbackColors | 'primary';

/**
* Size of the indicator
Expand Down Expand Up @@ -74,7 +74,10 @@ const Indicator = ({
const { theme } = useTheme();
const childrenString = getStringFromReactText(children);

const fillColor = theme.colors.feedback.background[color].intense;
const fillColor =
color === 'primary'
? theme.colors.surface.background.primary.intense
: theme.colors.feedback.background[color].intense;
const getDimension = useCallback((): Dimensions => {
switch (size) {
case 'small':
Expand Down
14 changes: 14 additions & 0 deletions packages/blade/src/components/StepGroup/StepGroup.native.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { StepGroupProps } from './types';
import { Text } from '~components/Typography';
import { throwBladeError } from '~utils/logger';

const StepGroup = (_props: StepGroupProps): React.ReactElement => {
throwBladeError({
message: 'StepGroup is not yet implemented for native',
moduleName: 'StepGroup',
});

return <Text>StepGroup Component is not available for Native mobile apps.</Text>;
};

export { StepGroup };