Skip to content

Commit

Permalink
chore: run yarn format
Browse files Browse the repository at this point in the history
  • Loading branch information
tay1orjones committed Oct 28, 2024
1 parent c0f94d8 commit 3920859
Show file tree
Hide file tree
Showing 79 changed files with 448 additions and 349 deletions.
3 changes: 1 addition & 2 deletions docs/guides/icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ update PR:
`--modifiers`. All icons with `--modifiers` are listed as variants of the
same icon.
3. make desired edits on the icon's `aliases` list.
4. commit changes, preferably with a commit message "[icon name] metadata
update".
4. commit changes, preferably with a commit message "[icon name] metadata update".
5. create a new branch, suggested branch name is `yourname-metadata-iconName`
6. create the PR from your branch, or click on `Propose file change` if you are
in browser.
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/support.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ started in case you get stuck.
- “Could you share more about what you’ve already tried?”
- “Can you share more about your usecase?”
- “Can you add a repro (reproduction) using Stackblitz?”
- “After searching through [FILL IN RESOURCE HERE], I was able to find this and
thought it might be helpful... Let me know if that works.”
- “After searching through [FILL IN RESOURCE HERE], I was able to find this and thought
it might be helpful... Let me know if that works.”

### What does "ongoing support" mean regarding GitHub?

Expand Down
12 changes: 8 additions & 4 deletions packages/grid/scss/_css-grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@
// Condensed
.#{$prefix}--css-grid--condensed {
--cds-grid-gutter: #{$grid-gutter-condensed};
--cds-grid-column-hang: #{math.div($grid-gutter, 2) -
math.div($grid-gutter-condensed, 2)};
--cds-grid-column-hang: #{math.div($grid-gutter, 2) - math.div(
$grid-gutter-condensed,
2
)};
}

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -193,8 +195,10 @@
.#{$prefix}--subgrid--condensed {
--cds-grid-gutter-start: #{math.div($grid-gutter-condensed, 2)};
--cds-grid-gutter-end: #{math.div($grid-gutter-condensed, 2)};
--cds-grid-column-hang: #{math.div($grid-gutter, 2) -
math.div($grid-gutter-condensed, 2)};
--cds-grid-column-hang: #{math.div($grid-gutter, 2) - math.div(
$grid-gutter-condensed,
2
)};
}

// -----------------------------------------------------------------------------
Expand Down
5 changes: 2 additions & 3 deletions packages/icon-build-helpers/src/builders/vanilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ async function builder(metadata, { output }) {
for (const m of modules) {
files[m.filepath] = m.source;
input[m.filepath] = m.filepath;
files[
'index.js'
] += `\nexport { default as ${m.moduleName} } from '${m.filepath}';`;
files['index.js'] +=
`\nexport { default as ${m.moduleName} } from '${m.filepath}';`;
}

const bundle = await rollup({
Expand Down
5 changes: 2 additions & 3 deletions packages/icon-build-helpers/src/builders/vue/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ async function builder(metadata, { output }) {
for (const m of modules) {
files[m.filepath] = m.source;
input[m.filepath] = m.filepath;
files[
'index.js'
] += `\nexport { default as ${m.moduleName} } from '${m.filepath}';`;
files['index.js'] +=
`\nexport { default as ${m.moduleName} } from '${m.filepath}';`;
}

const bundle = await rollup({
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Button/ButtonBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useId } from '../../internal/useId';
import { ButtonBaseProps, ButtonProps } from './Button';

const ButtonBase = React.forwardRef(function ButtonBase<
T extends React.ElementType
T extends React.ElementType,
>(
{
as,
Expand Down
12 changes: 6 additions & 6 deletions packages/react/src/components/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,12 @@ const ComboBox = forwardRef(
typeahead
? autocompleteCustomFilter({ item: itemToString(item), inputValue })
: shouldFilterItem
? shouldFilterItem({
item,
itemToString,
inputValue,
})
: defaultShouldFilterItem()
? shouldFilterItem({
item,
itemToString,
inputValue,
})
: defaultShouldFilterItem()
);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Heading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type SectionProps<E extends ElementType> = PolymorphicProps<
>;

export const Section = React.forwardRef(function Section<
E extends ElementType = 'section'
E extends ElementType = 'section',
>(
{
as: BaseComponent = 'section' as E,
Expand Down
135 changes: 67 additions & 68 deletions packages/react/src/components/InlineCheckbox/InlineCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,79 +12,78 @@ import { usePrefix } from '../../internal/usePrefix';
import { useMergedRefs } from '../../internal/useMergedRefs';

/** @type any */
const InlineCheckbox = React.forwardRef(function InlineCheckbox(
props,
forwardRef
) {
const {
['aria-label']: ariaLabel,
ariaLabel: deprecatedAriaLabel,
checked = false,
disabled,
id,
indeterminate,
name,
onChange = () => {},
onClick,
onKeyDown,
title,
} = props;
const prefix = usePrefix();
const inputRef = useRef(null);
const ref = useMergedRefs([inputRef, forwardRef]);
const inputProps = {
checked,
className: `${prefix}--checkbox`,
disabled,
id,
name,
onClick: onClick ? onClickCheckBoxInput : onClick,
onChange: (evt) => {
onChange(evt.target.checked, id, evt);
},
onKeyDown,
ref,
type: 'checkbox',
};

if (indeterminate) {
inputProps.checked = false;
}

useEffect(() => {
if (inputRef?.current) {
inputRef.current.indeterminate = indeterminate;
}
}, [indeterminate]);
const InlineCheckbox = React.forwardRef(
function InlineCheckbox(props, forwardRef) {
const {
['aria-label']: ariaLabel,
ariaLabel: deprecatedAriaLabel,
checked = false,
disabled,
id,
indeterminate,
name,
onChange = () => {},
onClick,
onKeyDown,
title,
} = props;
const prefix = usePrefix();
const inputRef = useRef(null);
const ref = useMergedRefs([inputRef, forwardRef]);
const inputProps = {
checked,
className: `${prefix}--checkbox`,
disabled,
id,
name,
onClick: onClick ? onClickCheckBoxInput : onClick,
onChange: (evt) => {
onChange(evt.target.checked, id, evt);
},
onKeyDown,
ref,
type: 'checkbox',
};

function onClickCheckBoxInput(evt) {
// If the previous "indeterminate" is true, change "checked" to false. If it is not undefined, we're working on `TableSelectAll`
if (indeterminate) {
evt.target.checked = false;
inputProps.checked = false;
}
onClick(evt);
}

return (
<div className={`${prefix}--checkbox--inline`}>
<input {...inputProps} />
{
/* eslint-disable jsx-a11y/label-has-for,jsx-a11y/label-has-associated-control,jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions */
<label
htmlFor={id}
className={`${prefix}--checkbox-label`}
title={title}
onClick={(evt) => {
evt.stopPropagation();
}}>
<span className={`${prefix}--visually-hidden`}>
{deprecatedAriaLabel || ariaLabel}
</span>
</label>
useEffect(() => {
if (inputRef?.current) {
inputRef.current.indeterminate = indeterminate;
}
</div>
);
});
}, [indeterminate]);

function onClickCheckBoxInput(evt) {
// If the previous "indeterminate" is true, change "checked" to false. If it is not undefined, we're working on `TableSelectAll`
if (indeterminate) {
evt.target.checked = false;
}
onClick(evt);
}

return (
<div className={`${prefix}--checkbox--inline`}>
<input {...inputProps} />
{
/* eslint-disable jsx-a11y/label-has-for,jsx-a11y/label-has-associated-control,jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions */
<label
htmlFor={id}
className={`${prefix}--checkbox-label`}
title={title}
onClick={(evt) => {
evt.stopPropagation();
}}>
<span className={`${prefix}--visually-hidden`}>
{deprecatedAriaLabel || ariaLabel}
</span>
</label>
}
</div>
);
}
);

InlineCheckbox.propTypes = {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Layer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface LayerComponent {
}

const LayerRenderFunction = React.forwardRef(function Layer<
T extends React.ElementType
T extends React.ElementType,
>(
{
as = 'div' as T,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export interface FilterableMultiSelectProps<ItemType>
}

const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect<
ItemType
ItemType,
>(
{
autoAlign = false,
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(function Search(
onExpand && isExpanded
? true
: onExpand && !isExpanded
? false
: undefined
? false
: undefined
}
aria-controls={onExpand ? uniqueId : undefined}>
<CustomSearchIcon icon={renderIcon} />
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1606,8 +1606,8 @@ class Slider extends PureComponent<SliderProps> {
twoHandles
? ariaLabelInputUpper
: ariaLabelInput
? ariaLabelInput
: undefined
? ariaLabelInput
: undefined
}
disabled={disabled}
required={required}
Expand Down
57 changes: 28 additions & 29 deletions packages/react/src/components/Stack/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,36 +71,35 @@ export interface StackProps extends React.HTMLAttributes<HTMLElement> {
* - https://paste.twilio.design/layout/stack/
* - https://github.com/Workday/canvas-kit/blob/f2f599654876700f483a1d8c5de82a41315c76f1/modules/labs-react/layout/lib/Stack.tsx
*/
const Stack = React.forwardRef<React.ReactNode, StackProps>(function Stack(
props,
ref
) {
const {
as: BaseComponent = 'div',
children,
className: customClassName,
gap,
orientation = 'vertical',
...rest
} = props;
const prefix = usePrefix();
const className = cx(customClassName, {
[`${prefix}--stack-${orientation}`]: true,
[`${prefix}--stack-scale-${gap}`]: typeof gap === 'number',
});
const style = {};

if (typeof gap === 'string') {
style[`--${prefix}-stack-gap`] = gap;
const Stack = React.forwardRef<React.ReactNode, StackProps>(
function Stack(props, ref) {
const {
as: BaseComponent = 'div',
children,
className: customClassName,
gap,
orientation = 'vertical',
...rest
} = props;
const prefix = usePrefix();
const className = cx(customClassName, {
[`${prefix}--stack-${orientation}`]: true,
[`${prefix}--stack-scale-${gap}`]: typeof gap === 'number',
});
const style = {};

if (typeof gap === 'string') {
style[`--${prefix}-stack-gap`] = gap;
}

return (
// eslint-disable-next-line react/forbid-component-props
<BaseComponent {...rest} ref={ref} className={className} style={style}>
{children}
</BaseComponent>
);
}

return (
// eslint-disable-next-line react/forbid-component-props
<BaseComponent {...rest} ref={ref} className={className} style={style}>
{children}
</BaseComponent>
);
});
);

Stack.propTypes = {
/**
Expand Down
11 changes: 5 additions & 6 deletions packages/react/src/components/Stack/VStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import React from 'react';

import { Stack, StackProps } from './Stack';

const VStack = React.forwardRef<React.ReactNode, StackProps>(function VStack(
props,
ref
) {
return <Stack {...props} ref={ref} orientation="vertical" />;
});
const VStack = React.forwardRef<React.ReactNode, StackProps>(
function VStack(props, ref) {
return <Stack {...props} ref={ref} orientation="vertical" />;
}
);

export { VStack };
2 changes: 1 addition & 1 deletion packages/react/src/components/Toggletip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export type ToggleTipButtonProps<T extends React.ElementType> =
* clicks and keyboard interactions.
*/
export const ToggletipButton = React.forwardRef(function ToggletipButton<
T extends React.ElementType
T extends React.ElementType,
>(
{
children,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/UIShell/SideNavLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export interface SideNavLinkComponent {
}

const SideNavLink: SideNavLinkComponent = forwardRef(function SideNavLink<
E extends ElementType = 'a'
E extends ElementType = 'a',
>(
{
children,
Expand Down
Loading

0 comments on commit 3920859

Please sign in to comment.