Skip to content

Commit

Permalink
chore(v11): update carbon-components imports & format
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-blum committed Sep 13, 2024
1 parent fae71fb commit 99a578d
Show file tree
Hide file tree
Showing 61 changed files with 159 additions and 192 deletions.
2 changes: 1 addition & 1 deletion packages/component-list/src/libraries/security.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import * as securityComponentList from '@carbon/ibm-security';
import * as carbonComponentList from 'carbon-components-react';
import * as carbonComponentList from '@carbon/react';
import { getSecurityPrefix } from '../../../web-extension/src/globals/prefixSelectors.js';
import { buildReactComponentList } from '../helpers.js';

Expand Down
4 changes: 2 additions & 2 deletions packages/web-extension/src/globals/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {
AlignHorizontalLeft,
AlignHorizontalCenter,
AlignHorizontalRight,
FitToWidth
} from "@carbon/icons-react";
FitToWidth,
} from '@carbon/icons-react';

const positions = {
'Full width': FitToWidth,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-extension/src/globals/prefixSelectors.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pkg from '@carbon/ibm-products/es/global/js/package-settings';
import dotcomSettings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings';
import { getComponentNamespace as getSecurityPrefix } from '@carbon/ibm-security/es/globals/namespace';
import carbonSettings from 'carbon-components/es/globals/js/settings';
import carbonSettings from '@carbon/web-components/es/globals/settings';

const {
devtoolsAttribute: cloudCognitiveDevtoolsAttribute,
Expand Down
5 changes: 3 additions & 2 deletions packages/web-extension/src/globals/setPrefix.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
/* eslint-disable no-import-assign */
import * as settings from '@carbon/web-components/es/globals/settings.js';
settings.carbonPrefix = settings.prefix;
settings.prefix = 'bx-dev';
settings.prefix = `${settings.prefix}-dev`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { getStorage } from '@carbon/devtools-utilities/src/getStorage';
import { storageItemChanged } from '@carbon/devtools-utilities/src/storageItemChanged';
// import { defaults } from '../../../globals/defaults';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* stylelint-disable a11y/media-prefers-reduced-motion */
@use 'sass:map';
@use 'sass:math';
@use '@carbon/react/scss/breakpoint';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { getStorage } from '@carbon/devtools-utilities/src/getStorage';
import { storageItemChanged } from '@carbon/devtools-utilities/src/storageItemChanged';
import { positions } from '../../../../globals/options';
Expand Down
2 changes: 1 addition & 1 deletion packages/web-extension/src/inject/components/Grid/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { storageItemChanged } from '@carbon/devtools-utilities/src/storageItemChanged';
import { getStorage } from '@carbon/devtools-utilities/src/getStorage';
import { gridVersions } from '../../../globals/options';
Expand Down
21 changes: 13 additions & 8 deletions packages/web-extension/src/inject/components/Grid/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* stylelint-disable a11y/media-prefers-reduced-motion */
@use 'sass:math';
@use '../../vars.scss' as *;
@use '@carbon/react/scss/colors';
Expand Down Expand Up @@ -122,9 +123,10 @@
// gutter
&--outer {
[class*='#{$prefix}--col-']::before {
box-shadow:
math.div(grid.$grid-gutter, 2) 0 0 rgba($grid-outer-color, $grid-outer-opacity),
math.div(grid.$grid-gutter, -2) 0 0 rgba($grid-outer-color, $grid-outer-opacity);
box-shadow: math.div(grid.$grid-gutter, 2) 0 0
rgba($grid-outer-color, $grid-outer-opacity),
math.div(grid.$grid-gutter, -2) 0 0
rgba($grid-outer-color, $grid-outer-opacity);
}
}

Expand All @@ -141,11 +143,14 @@
// gutter + column border
&--outer.#{$prefix}--grid-2x--inner-border {
[class*='#{$prefix}--col-']::before {
box-shadow:
math.div(grid.$grid-gutter, 2) 0 0 rgba($grid-outer-color, $grid-outer-opacity),
math.div(grid.$grid-gutter, -2) 0 0 rgba($grid-outer-color, $grid-outer-opacity),
$grid-inner-border-size 0 0 rgba($grid-inner-border-color, $grid-inner-border-opacity),
($grid-inner-border-size * -1) 0 0 rgba($grid-inner-border-color, $grid-inner-border-opacity);
box-shadow: math.div(grid.$grid-gutter, 2) 0 0
rgba($grid-outer-color, $grid-outer-opacity),
math.div(grid.$grid-gutter, -2) 0 0
rgba($grid-outer-color, $grid-outer-opacity),
$grid-inner-border-size 0 0
rgba($grid-inner-border-color, $grid-inner-border-opacity),
($grid-inner-border-size * -1) 0 0
rgba($grid-inner-border-color, $grid-inner-border-opacity);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { getStorage } from '@carbon/devtools-utilities/src/getStorage';
import { storageItemChanged } from '@carbon/devtools-utilities/src/storageItemChanged';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { findAllDomShadow } from '@carbon/devtools-utilities/src/shadowDom';
import { randomId } from '@carbon/devtools-utilities/src/randomId';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $highlight-opacity: 0.5;
opacity: 1;

span {
// @include type.type-style('fluid-paragraph-01');
@include type.type-style('fluid-paragraph-01', true);

display: inline-block;
margin: auto;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import {
positionTooltip,
showHideTooltip,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';

const { prefix } = settings;
const devtoolClass = `${prefix}--devtools`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { addHighlight } from '../../Highlight';
import {
positionTooltip,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@use '@carbon/react/scss/spacing';
@use '@carbon/react/scss/theme';


.#{$specs-prefix} {
&-color-tooltip {
&__color {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { addHighlight } from '../../Highlight';
import {
positionTooltip,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { breakpoints, rem } from '@carbon/layout';
import { carbonPrefix } from '../../../../globals';
import { addHighlight } from '../../Highlight';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';

const { prefix } = settings;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* stylelint-disable a11y/media-prefers-reduced-motion */
@use '../../../vars.scss' as *;

.#{$specs-prefix} {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { addHighlight } from '../../Highlight';
import { getComponentName } from '@carbon/devtools-utilities/src/getComponentName';
import { aspectRatios, svgMarkup } from '../../../../globals/options';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { addHighlight } from '../../Highlight';
import {
positionTooltip,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* stylelint-disable a11y/media-prefers-reduced-motion */
@use '../../../vars.scss' as *;
@use '@carbon/react/scss/type';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { getStorage } from '@carbon/devtools-utilities/src/getStorage';
import { storageItemChanged } from '@carbon/devtools-utilities/src/storageItemChanged';
import { randomId } from '@carbon/devtools-utilities/src/randomId';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { setPx } from '@carbon/devtools-utilities/src/setPx';

const { prefix } = settings;
Expand Down
7 changes: 3 additions & 4 deletions packages/web-extension/src/inject/index.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* stylelint-disable no-invalid-position-at-import-rule */
@use 'sass:map';

@use "./vars.scss" as *;
@use "@carbon/react/scss/colors";
@use './vars.scss' as *;
@use '@carbon/react/scss/colors';
@use '@carbon/react/scss/breakpoint';
@use '@carbon/react/scss/fonts';
@use "@carbon/react/scss/grid";
@use '@carbon/react/scss/grid';
@use '@carbon/react/scss/motion';
@use '@carbon/react/scss/spacing';
@use '@carbon/react/scss/themes';
Expand Down
6 changes: 3 additions & 3 deletions packages/web-extension/src/inject/vars.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use "@carbon/react/scss/config";
@use "@carbon/react/scss/motion";
@use "@carbon/react/scss/colors";
@use '@carbon/react/scss/config';
@use '@carbon/react/scss/motion';
@use '@carbon/react/scss/colors';

$prefix: '#{config.$prefix}-dev';
$carbonPrefix: config.$prefix;
Expand Down
8 changes: 4 additions & 4 deletions packages/web-extension/src/options/components/Footer/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import settings from 'carbon-components/es/globals/js/settings';
import { Link } from "@carbon/react";
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { Link } from '@carbon/react';
import React from 'react';

import packageJSON from '../../../../package.json';
Expand All @@ -21,7 +21,7 @@ const packages = [
{ name, version },
{
name: 'carbon',
version: getMajorVersion('carbon-components'),
version: getMajorVersion('@carbon/react'),
},
{
name: CLOUD_COGNITIVE,
Expand All @@ -30,7 +30,7 @@ const packages = [

{
name: 'ibm.com library',
version: getMajorVersion('@carbon/ibmdotcom-react'),
version: getMajorVersion('@carbon/ibmdotcom-web-components'),
},
{
name: 'ibm security',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import settings from 'carbon-components/es/globals/js/settings';
import {
Select,
SelectItem,
Toggle
} from "@carbon/react";
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { Select, SelectItem, Toggle } from '@carbon/react';
import { setStorage } from '@carbon/devtools-utilities/src/setStorage';
import { configuration } from '../';
import { themes } from '@carbon/themes';
Expand Down
7 changes: 2 additions & 5 deletions packages/web-extension/src/options/components/Grid/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import settings from 'carbon-components/es/globals/js/settings';
import {
Select,
SelectItem
} from "@carbon/react";
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { Select, SelectItem } from '@carbon/react';
import { configuration } from '../';
import { gridVersions } from '../../../globals/options';
import { defaults } from '../../../globals/defaults';
Expand Down
6 changes: 3 additions & 3 deletions packages/web-extension/src/options/components/Reset/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import settings from 'carbon-components/es/globals/js/settings';
import { Button } from "@carbon/react";
import { CheckmarkOutline } from "@carbon/icons-react";
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { Button } from '@carbon/react';
import { CheckmarkOutline } from '@carbon/icons-react';
import { configuration } from '../';

const { prefix } = settings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React from 'react';
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import {
StructuredListWrapper,
StructuredListHead,
StructuredListBody,
StructuredListRow,
StructuredListCell,
} from '@carbon/react';
import {
MacShift,
Cursor_1
} from "@carbon/icons-react";
import { MacShift, Cursor_1 } from '@carbon/icons-react';

const { prefix } = settings;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@include type.type-style('code-01');

display: flex;
padding: calc(0.5 * 0.5rem) calc(1 * 0.5rem);
padding: calc(0.5 * 0.5rem) calc(1 * 0.5rem);
border-radius: calc(0.25 * 0.5rem);
margin-right: calc(0.5 * 0.5rem);
background-color: theme.$layer-01;
Expand Down
17 changes: 9 additions & 8 deletions packages/web-extension/src/options/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import React, { useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
import settings from 'carbon-components/es/globals/js/settings';
import {
Accordion,
AccordionItem
} from '@carbon/react';
import React, { useState, useEffect, StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import { Accordion, AccordionItem } from '@carbon/react';
import { Footer, General, Grid, Shortcuts, Reset } from './components';
import { storageChanged } from '@carbon/devtools-utilities/src/storageChanged';
import { getStorage } from '@carbon/devtools-utilities/src/getStorage';
Expand Down Expand Up @@ -60,4 +57,8 @@ function Options() {

const body = document.querySelector('body');
body.innerHTML = '<div id="app"></div>' + body.innerHTML;
ReactDOM.render(<Options />, document.getElementById('app'));
createRoot(document.getElementById('app')).render(
<StrictMode>
<Options />
</StrictMode>
);
6 changes: 3 additions & 3 deletions packages/web-extension/src/options/index.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@use "sass:math";
@use 'sass:math';

// Import Carbon Tokens
@use "@carbon/react/scss/config" as *;
@use '@carbon/react/scss/config' as *;
@use '@carbon/react/scss/breakpoint';
@use '@carbon/react/scss/fonts';
@use "@carbon/react/scss/grid";
@use '@carbon/react/scss/grid';
@use '@carbon/react/scss/motion';
@use '@carbon/react/scss/spacing';
@use '@carbon/react/scss/themes';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Sprout } from "@carbon/icons-react";
import { Sprout } from '@carbon/icons-react';

function ComingSoon() {
return (
Expand Down
4 changes: 2 additions & 2 deletions packages/web-extension/src/popup/components/Empty/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import packageJSON from '../../../../package.json';
import { Link } from "@carbon/react";
import { Link } from '@carbon/react';

const { prefix } = settings;

Expand Down
6 changes: 3 additions & 3 deletions packages/web-extension/src/popup/components/Empty/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use "@carbon/react/scss/config" as *;
@use "@carbon/react/scss/spacing";
@use "@carbon/react/scss/type";
@use '@carbon/react/scss/config' as *;
@use '@carbon/react/scss/spacing';
@use '@carbon/react/scss/type';

@mixin empty {
.#{$prefix}--popup-empty {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import settings from 'carbon-components/es/globals/js/settings';
import * as settings from '@carbon/web-components/es/globals/settings.js';
import {
Checkbox,
FormGroup,
NumberInput,
ContentSwitcher,
Switch,
FormLabel
FormLabel,
} from '@carbon/react';
import { setStorage } from '@carbon/devtools-utilities/src/setStorage';
import { getStorage } from '@carbon/devtools-utilities/src/getStorage';
Expand Down
Loading

0 comments on commit 99a578d

Please sign in to comment.