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(Text): add text to Accordion, Button, Checkbox, Combobox, Contentswitcher #9493

Merged
5 changes: 3 additions & 2 deletions packages/react/src/components/Accordion/AccordionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { settings } from 'carbon-components';
import cx from 'classnames';
import PropTypes from 'prop-types';
import React, { useState } from 'react';
import { Text } from '../Text';
import { match, keys } from '../../internal/keyboard';
import { useId } from '../../internal/useId';
import deprecate from '../../prop-types/deprecate.js';
Expand Down Expand Up @@ -86,9 +87,9 @@ function AccordionItem({
<ChevronRight16 className={`${prefix}--accordion__arrow`} />
<div className={`${prefix}--accordion__title`}>{title}</div>
</Expando>
<div id={id} className={`${prefix}--accordion__content`}>
<Text as="div" id={id} className={`${prefix}--accordion__content`}>
dakahn marked this conversation as resolved.
Show resolved Hide resolved
{children}
</div>
</Text>
</li>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ exports[`Accordion should render 1`] = `
</button>
<div
class="bx--accordion__content"
dir="auto"
id="accordion-item-1"
>
Panel A
Expand Down Expand Up @@ -74,6 +75,7 @@ exports[`Accordion should render 1`] = `
</button>
<div
class="bx--accordion__content"
dir="auto"
id="accordion-item-2"
>
Panel B
Expand Down Expand Up @@ -111,6 +113,7 @@ exports[`Accordion should render 1`] = `
</button>
<div
class="bx--accordion__content"
dir="auto"
id="accordion-item-3"
>
Panel C
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,19 @@ exports[`AccordionItem should render 1`] = `
</div>
</button>
</defaultRenderExpando>
<div
<Text
as="div"
className="bx--accordion__content"
id="accordion-item-1"
>
Lorem ipsum.
</div>
<div
className="bx--accordion__content"
dir="auto"
id="accordion-item-1"
>
Lorem ipsum.
</div>
</Text>
</li>
</AccordionItem>
`;
1 change: 1 addition & 0 deletions packages/react/src/components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ const Button = React.forwardRef(function Button(
component = 'a';
otherProps = anchorProps;
}

return React.createElement(
component,
{
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/components/Checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import { Text } from '../Text';
import { useFeatureFlag } from '../FeatureFlags';
import { settings } from 'carbon-components';

Expand Down Expand Up @@ -65,7 +66,7 @@ const Checkbox = React.forwardRef(function Checkbox(
}}
/>
<label htmlFor={id} className={labelClasses} title={title || null}>
<span className={innerLabelClasses}>{labelText}</span>
<Text className={innerLabelClasses}>{labelText}</Text>
</label>
</div>
);
Expand Down
9 changes: 5 additions & 4 deletions packages/react/src/components/ComboBox/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import cx from 'classnames';
import Downshift from 'downshift';
import PropTypes from 'prop-types';
import React, { useEffect, useState, useRef } from 'react';
import { Text } from '../Text';
import { settings } from 'carbon-components';
import {
Checkmark16,
Expand Down Expand Up @@ -281,9 +282,9 @@ const ComboBox = React.forwardRef((props, ref) => {
return (
<div className={wrapperClasses}>
{titleText && (
<label className={titleClasses} {...labelProps}>
<Text as="label" className={titleClasses} {...labelProps}>
{titleText}
</label>
</Text>
)}
<ListBox
className={className}
Expand Down Expand Up @@ -379,9 +380,9 @@ const ComboBox = React.forwardRef((props, ref) => {
</ListBox.Menu>
</ListBox>
{helperText && !invalid && !warn && (
<div id={comboBoxHelperId} className={helperClasses}>
<Text as="div" id={comboBoxHelperId} className={helperClasses}>
{helperText}
</div>
</Text>
)}
</div>
);
Expand Down