Skip to content

Commit

Permalink
Merge branch 'main' into fix/slider-label
Browse files Browse the repository at this point in the history
  • Loading branch information
abbeyhrt authored Dec 9, 2021
2 parents 9296d97 + 82039e4 commit 3b19d44
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 26 deletions.
13 changes: 13 additions & 0 deletions packages/react/src/components/Search/next/Search.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ export const Default = () => (
/>
);

export const Disabled = () => (
<Search
disabled
size="lg"
defaultValue="A default value"
labelText="Search"
closeButtonLabelText="Clear search input"
id="search-1"
onChange={() => {}}
onKeyDown={() => {}}
/>
);

export const Expandable = () => (
<ExpandableSearch
size="lg"
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Tooltip/Tooltip-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export default {

export const DefaultBottom = () => (
<div style={containerStyles}>
<Tooltip {...props.withIcon()} tooltipBodyId="tooltip-body">
<p id="tooltip-body">
<Tooltip {...props.withIcon()}>
<p>
This is some tooltip text. This box shows the maximum amount of text
that should appear inside. If more room is needed please use a modal
instead.
Expand Down
8 changes: 6 additions & 2 deletions packages/react/src/components/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,9 @@ class Tooltip extends Component {
className={`${prefix}--tooltip__trigger`}
{...properties}
ref={refProp}
aria-describedby={tooltipBodyId}>
aria-describedby={
tooltipBodyId || properties['aria-describedby']
}>
<IconCustomElement {...iconProperties} />
</div>
</div>
Expand All @@ -681,7 +683,9 @@ class Tooltip extends Component {
className={triggerClasses}
ref={refProp}
{...properties}
aria-describedby={tooltipBodyId}>
aria-describedby={
tooltipBodyId || properties['aria-describedby']
}>
{triggerText}
</div>
)}
Expand Down
4 changes: 2 additions & 2 deletions packages/styles/scss/components/button/_tokens.scss
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,11 @@ $button-disabled: (
),
(
theme: themes.$g90,
value: #6f6f6f,
value: rgba(141, 141, 141, 0.3),
),
(
theme: themes.$g100,
value: #525252,
value: rgba(141, 141, 141, 0.3),
),
),
) !default;
Expand Down
8 changes: 4 additions & 4 deletions packages/themes/src/next/g10.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
white,
whiteHover,
} from '@carbon/colors';
import { adjustLightness } from '../tools';
import { adjustLightness, adjustAlpha } from '../tools';

// Background
export const background = gray10;
Expand Down Expand Up @@ -137,18 +137,18 @@ export const borderInverse = gray100;
export const borderInteractive = blue60;

// border
export const borderDisabled = white;
export const borderDisabled = gray30;

// Text
export const textPrimary = gray100;
export const textSecondary = gray70;
export const textPlaceholder = gray40;
export const textPlaceholder = adjustAlpha(textPrimary, 0.4);
export const textHelper = gray60;
export const textError = red60;
export const textInverse = white;
export const textOnColor = white;
export const textOnColorDisabled = gray50;
export const textDisabled = gray30;
export const textDisabled = adjustAlpha(textPrimary, 0.25);

// Link
export const linkPrimary = blue60;
Expand Down
12 changes: 6 additions & 6 deletions packages/themes/src/next/g100.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
// Tools
rgba,
} from '@carbon/colors';
import { adjustLightness } from '../tools';
import { adjustLightness, adjustAlpha } from '../tools';

// Background
export const background = gray100;
Expand Down Expand Up @@ -144,18 +144,18 @@ export const borderInverse = gray10;
export const borderInteractive = blue50;

// border
export const borderDisabled = gray90;
export const borderDisabled = adjustAlpha(gray50, 0.5);

// Text
export const textPrimary = gray10;
export const textSecondary = gray30;
export const textPlaceholder = gray60;
export const textPlaceholder = adjustAlpha(textPrimary, 0.4);
export const textHelper = gray40;
export const textError = red30;
export const textInverse = gray100;
export const textOnColor = white;
export const textOnColorDisabled = gray40;
export const textDisabled = gray70;
export const textOnColorDisabled = adjustAlpha(textOnColor, 0.25);
export const textDisabled = adjustAlpha(textPrimary, 0.25);

// Link
export const linkPrimary = blue40;
Expand All @@ -169,7 +169,7 @@ export const iconPrimary = gray10;
export const iconSecondary = gray30;
export const iconInverse = gray100;
export const iconOnColor = white;
export const iconOnColorDisabled = gray40;
export const iconOnColorDisabled = adjustAlpha(iconOnColor, 0.25);
export const iconDisabled = gray70;

// Support
Expand Down
12 changes: 6 additions & 6 deletions packages/themes/src/next/g90.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
// Tools
rgba,
} from '@carbon/colors';
import { adjustLightness } from '../tools';
import { adjustLightness, adjustAlpha } from '../tools';

// Background
export const background = gray90;
Expand Down Expand Up @@ -143,18 +143,18 @@ export const borderInverse = gray10;
export const borderInteractive = blue50;

// border
export const borderDisabled = gray80;
export const borderDisabled = adjustAlpha(gray50, 0.5);

// Text
export const textPrimary = gray10;
export const textSecondary = gray30;
export const textPlaceholder = gray50;
export const textPlaceholder = adjustAlpha(textPrimary, 0.4);
export const textHelper = gray30;
export const textError = red30;
export const textInverse = gray100;
export const textOnColor = white;
export const textOnColorDisabled = gray40;
export const textDisabled = gray60;
export const textOnColorDisabled = adjustAlpha(textOnColor, 0.25);
export const textDisabled = adjustAlpha(textPrimary, 0.25);

// Link
export const linkPrimary = blue40;
Expand All @@ -168,7 +168,7 @@ export const iconPrimary = gray10;
export const iconSecondary = gray30;
export const iconInverse = gray100;
export const iconOnColor = white;
export const iconOnColorDisabled = gray40;
export const iconOnColorDisabled = adjustAlpha(iconOnColor, 0.25);
export const iconDisabled = gray60;

// Support
Expand Down
8 changes: 4 additions & 4 deletions packages/themes/src/next/white.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
white,
whiteHover,
} from '@carbon/colors';
import { adjustLightness } from '../tools';
import { adjustLightness, adjustAlpha } from '../tools';

// Background
export const background = white;
Expand Down Expand Up @@ -136,18 +136,18 @@ export const borderInverse = gray100;
export const borderInteractive = blue60;

// border
export const borderDisabled = gray10;
export const borderDisabled = gray30;

// Text
export const textPrimary = gray100;
export const textSecondary = gray70;
export const textPlaceholder = gray40;
export const textPlaceholder = adjustAlpha(textPrimary, 0.4);
export const textHelper = gray60;
export const textError = red60;
export const textInverse = white;
export const textOnColor = white;
export const textOnColorDisabled = gray50;
export const textDisabled = gray30;
export const textDisabled = adjustAlpha(textPrimary, 0.25);

// Link
export const linkPrimary = blue60;
Expand Down
12 changes: 12 additions & 0 deletions packages/themes/src/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,15 @@ export function adjustLightness(token, shift) {
.hex()
.toLowerCase();
}

/**
* Adjust a given token's alpha by a specified amount
* Example: token = rgba(10, 10, 10, 1.0);
* adjustAlpha(token, 0.3) === rgba(10, 10, 10, 0.3);
* @param {string} token
* @param {float} alpha
* @returns {string}
*/
export function adjustAlpha(token, alpha) {
return Color(token).rgb().alpha(alpha).string();
}

0 comments on commit 3b19d44

Please sign in to comment.