`;
diff --git a/web-components/packages/carbon-web-components/.storybook/main.js b/web-components/packages/carbon-web-components/.storybook/main.js
index 3e45df0723d0..5dae036b0d90 100644
--- a/web-components/packages/carbon-web-components/.storybook/main.js
+++ b/web-components/packages/carbon-web-components/.storybook/main.js
@@ -156,7 +156,10 @@ module.exports = {
implementation: sass,
webpackImporter: false,
sassOptions: {
- includePaths: [path.resolve(__dirname, '..', 'node_modules')],
+ includePaths: [
+ path.resolve(__dirname, '..', 'node_modules'),
+ path.resolve(__dirname, '../../../', 'node_modules'),
+ ],
},
},
},
diff --git a/web-components/packages/carbon-web-components/docs/styling-story.mdx b/web-components/packages/carbon-web-components/docs/styling-story.mdx
index a597b5cc24dd..40d1bd3dbb94 100644
--- a/web-components/packages/carbon-web-components/docs/styling-story.mdx
+++ b/web-components/packages/carbon-web-components/docs/styling-story.mdx
@@ -4,9 +4,12 @@ import { Meta } from '@storybook/addon-docs/blocks';
# Using custom styles in components
-As Shadow DOM (one of the Web Components specs that `carbon-web-components` uses) promises, styles that `carbon-web-components` defines does not affect styles in your application, or vice versa.
+As Shadow DOM (one of the Web Components specs that `carbon-web-components`
+uses) promises, styles that `carbon-web-components` defines does not affect
+styles in your application, or vice versa.
-However, in cases where your application or a Carbon-derived style guide wants to change the styles of our components, there are a few options.
+However, in cases where your application or a Carbon-derived style guide wants
+to change the styles of our components, there are a few options.
@@ -20,14 +23,19 @@ However, in cases where your application or a Carbon-derived style guide wants t
## Using CSS Custom Properties
-Changes to CSS Custom Properties of the Carbon theme are reflected in the color scheme of `carbon-web-components` components:
+Changes to CSS Custom Properties of the Carbon theme are reflected in the color
+scheme of `carbon-web-components` components:
+ sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin">
For example, if you add CSS like below:
@@ -37,7 +45,8 @@ footer {
}
```
-The color of the button in the code below changes to the one in the `g100` theme:
+The color of the button in the code below changes to the one in the `g100`
+theme:
```html
```
-The names of CSS Custom Properties you can use are the Carbon theme tokens prefixed with `--cds-`. The list of Carbon theme tokens can be found at [here](https://github.com/carbon-design-system/carbon/blob/v10.7.0/packages/themes/scss/generated/_themes.scss#L14-L454).
+The names of CSS Custom Properties you can use are the Carbon theme tokens
+prefixed with `--cds-`. The list of Carbon theme tokens can be found at
+[here](https://github.com/carbon-design-system/carbon/blob/v10.7.0/packages/themes/scss/generated/_themes.scss#L14-L454).
-With CSS Custom Properties approach, you can switch the entire theme under the specific element by:
+With CSS Custom Properties approach, you can switch the entire theme under the
+specific element by:
```css
-@import 'carbon-components/scss/globals/scss/css--helpers';
-@import 'carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/themes/mixins';
+@use '@carbon/styles/scss/utilities';
+@use '@carbon/styles/scss/vendor/@carbon/elements/scss/themes/mixins';
footer {
- @include carbon--theme($carbon--theme--g100, true); // Emits all theme tokens in CSS Custom Properties
+ @include carbon--theme(
+ $carbon--theme--g100,
+ true
+ ); // Emits all theme tokens in CSS Custom Properties
}
```
## Dependency injection
-You can let our custom elements modules load alternate `CSSResult` module. Below example uses [Webpack `NormalModuleReplacementPlugin`](https://webpack.js.org/plugins/normal-module-replacement-plugin/) to let our custom elements modules load RTL version of `CSSResult` module that is shipped alongside with default `CSSResult` modules, instead of loading the default version:
+You can let our custom elements modules load alternate `CSSResult` module. Below
+example uses
+[Webpack `NormalModuleReplacementPlugin`](https://webpack.js.org/plugins/normal-module-replacement-plugin/)
+to let our custom elements modules load RTL version of `CSSResult` module that
+is shipped alongside with default `CSSResult` modules, instead of loading the
+default version:
```javascript
const reCssBundle = /\.css\.js$/i;
@@ -81,14 +101,20 @@ module.exports = {
+ sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin">
## Creating derived components with different style
-You can create a derived class of our component and override [static `styles` property](https://lit-element.polymer-project.org/guide/styles#static-styles), like:
+You can create a derived class of our component and override
+[static `styles` property](https://lit-element.polymer-project.org/guide/styles#static-styles),
+like:
```javascript
import { css, customElement } from 'lit-element';
@@ -108,11 +134,18 @@ class MyDropdown extends BXDropdown {
+ sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin">
## CSS Shadow Parts
-In the future, we'd like to support [CSS Shadow Parts](https://www.w3.org/TR/css-shadow-parts-1/) too, so you can use your application's CSS to affect `carbon-web-components` styles in a more flexible manner.
+In the future, we'd like to support
+[CSS Shadow Parts](https://www.w3.org/TR/css-shadow-parts-1/) too, so you can
+use your application's CSS to affect `carbon-web-components` styles in a more
+flexible manner.
diff --git a/web-components/packages/carbon-web-components/docs/styling.md b/web-components/packages/carbon-web-components/docs/styling.md
index a23cacd71f1e..e89c6ab82bbc 100644
--- a/web-components/packages/carbon-web-components/docs/styling.md
+++ b/web-components/packages/carbon-web-components/docs/styling.md
@@ -1,8 +1,11 @@
# Using custom styles in components
-As Shadow DOM (one of the Web Components specs that `@carbon/web-components` uses) promises, styles that `@carbon/web-components` defines does not affect styles in your application, or vice versa.
+As Shadow DOM (one of the Web Components specs that `carbon-web-components`
+uses) promises, styles that `carbon-web-components` defines does not affect
+styles in your application, or vice versa.
-However, in cases where your application or a Carbon-derived style guide wants to change the styles of our components, there are a few options.
+However, in cases where your application or a Carbon-derived style guide wants
+to change the styles of our components, there are a few options.
@@ -16,7 +19,8 @@ However, in cases where your application or a Carbon-derived style guide wants t
## Using CSS Custom Properties
-Changes to CSS Custom Properties of the Carbon theme are reflected in the color scheme of `carbon-web-components` components:
+Changes to CSS Custom Properties of the Carbon theme are reflected in the color
+scheme of `carbon-web-components` components:
[![Edit carbon-web-components with custom style](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/carbon-design-system/carbon-web-components/tree/main/examples/codesandbox/styling/theme-zoning)
@@ -28,7 +32,8 @@ footer {
}
```
-The color of the button in the code below changes to the one in the `g100` theme:
+The color of the button in the code below changes to the one in the `g100`
+theme:
```html
```
-The names of CSS Custom Properties you can use are the Carbon theme tokens prefixed with `--cds-`. The list of Carbon theme tokens can be found at [here](https://github.com/carbon-design-system/carbon/blob/v10.7.0/packages/themes/scss/generated/_themes.scss#L14-L454).
+The names of CSS Custom Properties you can use are the Carbon theme tokens
+prefixed with `--cds-`. The list of Carbon theme tokens can be found at
+[here](https://github.com/carbon-design-system/carbon/blob/v10.7.0/packages/themes/scss/generated/_themes.scss#L14-L454).
-With CSS Custom Properties approach, you can switch the entire theme under the specific element by:
+With CSS Custom Properties approach, you can switch the entire theme under the
+specific element by:
```css
-@import 'carbon-components/scss/globals/scss/css--helpers';
-@import 'carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/themes/mixins';
+@use '@carbon/styles/scss/utilities';
+@use '@carbon/styles/scss/vendor/@carbon/elements/scss/themes/mixins';
footer {
- @include carbon--theme($carbon--theme--g100, true); // Emits all theme tokens in CSS Custom Properties
+ @include carbon--theme(
+ $carbon--theme--g100,
+ true
+ ); // Emits all theme tokens in CSS Custom Properties
}
```
-Some components such as `Notification` and `Tag` have specific tokens per theme that need to emitted in the styles. You can do this for example by adding the following:
+Some components such as `Notification` and `Tag` have specific tokens per theme
+that need to emitted in the styles. You can do this for example by adding the
+following:
```css
-@import 'carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/themes/mixins';
-@import 'carbon-components/scss/globals/scss/component-tokens';
+@use '@carbon/styles/scss/vendor/@carbon/elements/scss/themes/mixins';
+@use '@carbon/styles/scss/component-tokens';
@import 'carbon-components/src/components/tag/tag';
.dds-theme-zone-g90 {
@include carbon--theme($carbon--theme--g90, true) {
@@ -64,7 +77,12 @@ Some components such as `Notification` and `Tag` have specific tokens per theme
## Dependency injection
-You can let our custom elements modules load alternate `CSSResult` module. Below example uses [Webpack `NormalModuleReplacementPlugin`](https://webpack.js.org/plugins/normal-module-replacement-plugin/) to let our custom elements modules load RTL version of `CSSResult` module that is shipped alongside with default `CSSResult` modules, instead of loading the default version:
+You can let our custom elements modules load alternate `CSSResult` module. Below
+example uses
+[Webpack `NormalModuleReplacementPlugin`](https://webpack.js.org/plugins/normal-module-replacement-plugin/)
+to let our custom elements modules load RTL version of `CSSResult` module that
+is shipped alongside with default `CSSResult` modules, instead of loading the
+default version:
[![Edit carbon-web-components with custom style](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/carbon-design-system/carbon-web-components/tree/main/examples/codesandbox/rtl)
@@ -87,7 +105,9 @@ module.exports = {
## Creating derived components with different style
-You can create a derived class of our component and override [static `styles` property](https://lit-element.polymer-project.org/guide/styles#static-styles), like:
+You can create a derived class of our component and override
+[static `styles` property](https://lit-element.polymer-project.org/guide/styles#static-styles),
+like:
[![Edit carbon-web-components with custom style](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/carbon-design-system/carbon-web-components/tree/main/examples/codesandbox/styling/custom-style)
@@ -109,4 +129,7 @@ class MyDropdown extends BXDropdown {
## CSS Shadow Parts
-In the future, we'd like to support [CSS Shadow Parts](https://www.w3.org/TR/css-shadow-parts-1/) too, so you can use your application's CSS to affect `carbon-web-components` styles in a more flexible manner.
+In the future, we'd like to support
+[CSS Shadow Parts](https://www.w3.org/TR/css-shadow-parts-1/) too, so you can
+use your application's CSS to affect `carbon-web-components` styles in a more
+flexible manner.
diff --git a/web-components/packages/carbon-web-components/examples/codesandbox/styling/theme-zoning/index.html b/web-components/packages/carbon-web-components/examples/codesandbox/styling/theme-zoning/index.html
index 3f6490c1618e..1e8eca9c9355 100644
--- a/web-components/packages/carbon-web-components/examples/codesandbox/styling/theme-zoning/index.html
+++ b/web-components/packages/carbon-web-components/examples/codesandbox/styling/theme-zoning/index.html
@@ -11,21 +11,32 @@
carbon-web-components example
-
-
+
+
- [Platform]
+ [Platform]Link 1Link 2Link 3
- Sub-link 1
- Sub-link 2
- Sub-link 3
+ Sub-link 1
+ Sub-link 2
+ Sub-link 3
@@ -33,23 +44,30 @@
- If you inspect the style of <footer> in this example, you'll find some Carbon theme custom
- properties there are changed to ones of g100 theme, and see the background color as well as the color
- of <bx-btn> reflect such change.
+ If you inspect the style of <footer> in this
+ example, you'll find some Carbon theme custom properties there are
+ changed to ones of g100 theme, and see the background
+ color as well as the color of <bx-btn> reflect
+ such change.
- As Shadow DOM (one of the Web Components specs that carbon-web-components uses) promises, styles that
- carbon-web-components defines do not affect styles in your application.
+ As Shadow DOM (one of the Web Components specs that
+ carbon-web-components uses) promises, styles that
+ carbon-web-components defines do not affect styles in
+ your application.
@@ -59,7 +77,11 @@
Have questions?Nope!
- Enter an issue
+ Enter an issue
diff --git a/web-components/packages/carbon-web-components/examples/codesandbox/styling/theme-zoning/src/index.scss b/web-components/packages/carbon-web-components/examples/codesandbox/styling/theme-zoning/src/index.scss
index 161d1bdc4f86..0ab11085d2d6 100644
--- a/web-components/packages/carbon-web-components/examples/codesandbox/styling/theme-zoning/src/index.scss
+++ b/web-components/packages/carbon-web-components/examples/codesandbox/styling/theme-zoning/src/index.scss
@@ -1,11 +1,11 @@
//
-// Copyright IBM Corp. 2020, 2022
+// Copyright IBM Corp. 2020, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//
-@import 'carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/themes/mixins';
+@use '@carbon/styles/scss/vendor/@carbon/elements/scss/themes/mixins';
html {
height: 100%;
diff --git a/web-components/packages/carbon-web-components/gulp-tasks/build/modules/css.js b/web-components/packages/carbon-web-components/gulp-tasks/build/modules/css.js
index 5b973b8ccef3..6e6337f1e478 100644
--- a/web-components/packages/carbon-web-components/gulp-tasks/build/modules/css.js
+++ b/web-components/packages/carbon-web-components/gulp-tasks/build/modules/css.js
@@ -49,10 +49,16 @@ const buildModulesCSS = ({ banner, dir }) =>
)
.pipe(
sass({
- includePaths: ['node_modules'],
+ includePaths: ['node_modules', '../../node_modules'],
})
)
- .pipe(postcss([fixHostPseudo(), autoprefixer(), ...(dir === 'rtl' ? [rtlcss] : [])]))
+ .pipe(
+ postcss([
+ fixHostPseudo(),
+ autoprefixer(),
+ ...(dir === 'rtl' ? [rtlcss] : []),
+ ])
+ )
.pipe(cleanCSS())
.pipe(
through2.obj((file, enc, done) => {
@@ -60,7 +66,10 @@ const buildModulesCSS = ({ banner, dir }) =>
import { css } from 'lit';
export default css([${JSON.stringify(String(file.contents))}]);
`);
- file.path = replaceExtension(file.path, dir === 'rtl' ? '.rtl.css.js' : '.css.js');
+ file.path = replaceExtension(
+ file.path,
+ dir === 'rtl' ? '.rtl.css.js' : '.css.js'
+ );
done(null, file);
})
)
@@ -74,7 +83,10 @@ const buildModulesCSS = ({ banner, dir }) =>
* @returns {Promise} Stream
*/
async function css() {
- const banner = await readFileAsync(path.resolve(__dirname, '../../../tools/license.js'), 'utf8');
+ const banner = await readFileAsync(
+ path.resolve(__dirname, '../../../tools/license.js'),
+ 'utf8'
+ );
await Promise.all([
promisifyStream(() => buildModulesCSS({ banner })),
promisifyStream(() => buildModulesCSS({ banner, dir: 'rtl' })),
diff --git a/web-components/packages/carbon-web-components/package.json b/web-components/packages/carbon-web-components/package.json
index 3705c02280da..10ab80fe998e 100644
--- a/web-components/packages/carbon-web-components/package.json
+++ b/web-components/packages/carbon-web-components/package.json
@@ -68,7 +68,7 @@
],
"dependencies": {
"@babel/runtime": "^7.16.3",
- "carbon-components": "10.58.3",
+ "@carbon/styles": "^1.19.0",
"flatpickr": "4.6.13",
"lit": "^2.6.0",
"lodash-es": "^4.17.21"
@@ -93,7 +93,9 @@
"@carbon/icons": "^10.48.0",
"@open-wc/semantic-dom-diff": "~0.18.0",
"@percy-io/in-percy": "^0.1.11",
- "@percy/storybook": "^4.3.4",
+ "@percy/cli": "^1.8.1",
+ "@percy/cypress": "^3.1.1",
+ "@percy/dom": "^1.0.5",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.0.3",
"@rollup/plugin-node-resolve": "^8.4.0",
@@ -171,7 +173,6 @@
"karma-sourcemap-loader": "^0.3.8",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "^4.0.2",
- "lint-staged": "^12.3.8",
"magic-string": "^0.27.0",
"mini-css-extract-plugin": "~2.7.0",
"mkdirp": "^0.5.0",
@@ -193,7 +194,7 @@
"rollup-plugin-multi-input": "^1.3.1",
"rollup-plugin-terser": "^7.0.2",
"rtlcss": "^3.0.0",
- "sass": "~1.57.0",
+ "sass": "~1.40.0",
"sass-loader": "^10.0.0",
"strip-comments": "^1.0.0",
"style-loader": "^2.0.0",
diff --git a/web-components/packages/carbon-web-components/src/components/accordion/accordion-item.ts b/web-components/packages/carbon-web-components/src/components/accordion/accordion-item.ts
index 1155266b784f..0cddaf3cac38 100644
--- a/web-components/packages/carbon-web-components/src/components/accordion/accordion-item.ts
+++ b/web-components/packages/carbon-web-components/src/components/accordion/accordion-item.ts
@@ -7,11 +7,11 @@
* LICENSE file in the root directory of this source tree.
*/
-import settings from 'carbon-components/es/globals/js/settings';
import { classMap } from 'lit/directives/class-map.js';
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
import ChevronRight16 from '@carbon/icons/lib/chevron--right/16';
+import { prefix } from '../../globals/settings';
import FocusMixin from '../../globals/mixins/focus';
import Handle from '../../globals/internal/handle';
import { ACCORDION_ITEM_BREAKPOINT } from './defs';
@@ -19,8 +19,6 @@ import styles from './accordion.scss';
export { ACCORDION_ITEM_BREAKPOINT };
-const { prefix } = settings;
-
/**
* Observes resize of the given element with the given resize observer.
*
@@ -43,11 +41,11 @@ const observeResize = (observer: ResizeObserver, elem: Element) => {
/**
* Accordion item.
*
- * @element bx-accordion-item
- * @fires bx-accordion-item-beingtoggled
+ * @element cds-accordion-item
+ * @fires cds-accordion-item-beingtoggled
* The custom event fired before this accordion item is being toggled upon a user gesture.
* Cancellation of this event stops the user-initiated action of toggling this accordion item.
- * @fires bx-accordion-item-toggled - The custom event fired after this accordion item is toggled upon a user gesture.
+ * @fires cds-accordion-item-toggled - The custom event fired after this accordion item is toggled upon a user gesture.
* @csspart expando The expando button.
* @csspart expando-icon The expando icon.
* @csspart title The title.
diff --git a/web-components/packages/carbon-web-components/src/components/accordion/accordion-story.ts b/web-components/packages/carbon-web-components/src/components/accordion/accordion-story.ts
index 1ea46ed65767..e5237e00264f 100644
--- a/web-components/packages/carbon-web-components/src/components/accordion/accordion-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/accordion/accordion-story.ts
@@ -10,14 +10,15 @@
import { html } from 'lit';
import { action } from '@storybook/addon-actions';
import { boolean, select, text } from '@storybook/addon-knobs';
+import { prefix } from '../../globals/settings';
import { ACCORDION_SIZE } from './accordion';
import './accordion-item';
import storyDocs from './accordion-story.mdx';
const sizes = {
- 'Regular size': null,
[`Small size (${ACCORDION_SIZE.SMALL})`]: ACCORDION_SIZE.SMALL,
- [`XL size (${ACCORDION_SIZE.EXTRA_LARGE})`]: ACCORDION_SIZE.EXTRA_LARGE,
+ [`Medium size (${ACCORDION_SIZE.MEDIUM})`]: ACCORDION_SIZE.MEDIUM,
+ [`Large size (${ACCORDION_SIZE.LARGE})`]: ACCORDION_SIZE.LARGE,
};
const noop = () => {};
@@ -31,7 +32,9 @@ export const Default = (args) => {
onBeforeToggle = noop,
onToggle = noop,
size,
- } = args?.['bx-accordion'] ?? {};
+ alignment,
+ isFlush,
+ } = args?.[`${prefix}-accordion`] ?? {};
const handleBeforeToggle = (event: CustomEvent) => {
onBeforeToggle(event);
if (disableToggle) {
@@ -40,11 +43,13 @@ export const Default = (args) => {
};
return html`
-
-
+
@@ -54,16 +59,16 @@ export const Default = (args) => {
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
-
-
+
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
-
-
+
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
@@ -71,8 +76,8 @@ export const Default = (args) => {
aliquip ex ea commodo consequat.
${titleText}
-
-
+
+
`;
};
@@ -83,17 +88,23 @@ export default {
parameters: {
...storyDocs.parameters,
knobs: {
- 'bx-accordion': () => ({
+ [`${prefix}-accordion`]: () => ({
open: boolean('Open the section (open)', false),
titleText: text('The title (title-text)', 'Section title'),
size: select('Accordion size (size)', sizes, null),
+ alignment: select(
+ 'Accordion alignment (alignment)',
+ ['start', 'end'],
+ 'end'
+ ),
+ isFlush: boolean('isFlush', false),
disabled: boolean('Disable accordion item (disabled)', false),
disableToggle: boolean(
- 'Disable user-initiated toggle action (Call event.preventDefault() in bx-accordion-beingtoggled event)',
+ `Disable user-initiated toggle action (Call event.preventDefault() in ${prefix}-accordion-beingtoggled event)`,
false
),
- onBeforeToggle: action('bx-accordion-item-beingtoggled'),
- onToggle: action('bx-accordion-item-toggled'),
+ onBeforeToggle: action(`${prefix}-accordion-item-beingtoggled`),
+ onToggle: action(`${prefix}-accordion-item-toggled`),
}),
},
},
diff --git a/web-components/packages/carbon-web-components/src/components/accordion/accordion.scss b/web-components/packages/carbon-web-components/src/components/accordion/accordion.scss
index 832910b32f17..505f0481066f 100644
--- a/web-components/packages/carbon-web-components/src/components/accordion/accordion.scss
+++ b/web-components/packages/carbon-web-components/src/components/accordion/accordion.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2019, 2022
+// Copyright IBM Corp. 2019, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,7 +7,11 @@
$css--plex: true !default;
-@import 'carbon-components/scss/components/accordion/accordion';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/spacing' as *;
+@use '@carbon/styles/scss/type' as *;
+@use '@carbon/styles/scss/utilities/convert' as *;
+@use '@carbon/styles/scss/components/accordion';
:host(#{$prefix}-accordion) {
@extend .#{$prefix}--accordion;
@@ -21,22 +25,33 @@ $css--plex: true !default;
.#{$prefix}--accordion__heading {
padding-top: calc(
- (#{$container-03} - #{map-get($body-long-01, 'line-height')}rem) / 2
+ (#{$spacing-08} - #{map-get($body-long-01, 'line-height')}rem) / 2
);
- min-height: $container-03;
+ min-height: $spacing-08;
}
- &[size='sm'] {
- .#{$prefix}--accordion__heading {
- min-height: rem(32px);
- padding: rem(5px) 0;
+ .#{$prefix}--accordion__content {
+ @extend .#{$prefix}--accordion__content;
+
+ ::slotted(p) {
+ @include type-style('body-01');
}
}
- &[size='xl'] {
- .#{$prefix}--accordion__heading {
- min-height: rem(48px);
- }
+ &[size='sm'] {
+ @extend .#{$prefix}--accordion--sm;
+ }
+
+ &[size='lg'] {
+ @extend .#{$prefix}--accordion--lg;
+ }
+
+ &[alignment='start'] {
+ @extend .#{$prefix}--accordion--start;
+ }
+
+ &[isFlush] {
+ @extend .#{$prefix}--accordion--flush;
}
}
@@ -44,11 +59,11 @@ $css--plex: true !default;
@extend .#{$prefix}--accordion__item--active;
.#{$prefix}--accordion__content {
- padding-right: $carbon--spacing-05;
+ padding-right: $spacing-05;
}
.#{$prefix}-ce--accordion__content--sm {
- padding-right: $carbon--spacing-09;
+ padding-right: $spacing-09;
}
.#{$prefix}-ce--accordion__content--md {
diff --git a/web-components/packages/carbon-web-components/src/components/accordion/accordion.ts b/web-components/packages/carbon-web-components/src/components/accordion/accordion.ts
index c07c4d77cb57..765244e74bb3 100644
--- a/web-components/packages/carbon-web-components/src/components/accordion/accordion.ts
+++ b/web-components/packages/carbon-web-components/src/components/accordion/accordion.ts
@@ -9,27 +9,37 @@
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import { forEach } from '../../globals/internal/collection-helpers';
-import { ACCORDION_SIZE } from './defs';
+import { ACCORDION_SIZE, ACCORDION_ALIGNMENT } from './defs';
import styles from './accordion.scss';
-export { ACCORDION_SIZE };
-
-const { prefix } = settings;
+export { ACCORDION_SIZE, ACCORDION_ALIGNMENT };
/**
* Accordion container.
*
- * @element bx-accordion
+ * @element cds-accordion
*/
@customElement(`${prefix}-accordion`)
class BXAccordion extends LitElement {
/**
- * Accordion size.
+ * Accordion size should be sm, md, lg.
+ */
+ @property({ reflect: true })
+ size = ACCORDION_SIZE.MEDIUM;
+
+ /**
+ * Specify the alignment of the accordion heading title and chevron
*/
@property({ reflect: true })
- size = ACCORDION_SIZE.REGULAR;
+ alignment = ACCORDION_ALIGNMENT.END;
+
+ /**
+ * Specify whether Accordion text should be flush, default is false, does not work with align="start"
+ */
+ @property({ type: Boolean, reflect: true })
+ isFlush = false;
connectedCallback() {
if (!this.hasAttribute('role')) {
@@ -50,6 +60,33 @@ class BXAccordion extends LitElement {
}
);
}
+ if (changedProperties.has('alignment')) {
+ // Propagate `alignment` attribute to descendants until `:host-context()` gets supported in all major browsers
+ forEach(
+ this.querySelectorAll(
+ (this.constructor as typeof BXAccordion).selectorAccordionItems
+ ),
+ (elem) => {
+ elem.setAttribute('alignment', this.alignment);
+ }
+ );
+ }
+ if (
+ changedProperties.has('isFlush') ||
+ changedProperties.has('alignment')
+ ) {
+ // Propagate `isFlush` attribute to descendants until `:host-context()` gets supported in all major browsers
+ forEach(
+ this.querySelectorAll(
+ (this.constructor as typeof BXAccordion).selectorAccordionItems
+ ),
+ (elem) => {
+ this.isFlush && this.alignment !== 'start'
+ ? elem.setAttribute('isFlush', '')
+ : elem.removeAttribute('isFlush');
+ }
+ );
+ }
}
render() {
diff --git a/web-components/packages/carbon-web-components/src/components/accordion/defs.ts b/web-components/packages/carbon-web-components/src/components/accordion/defs.ts
index 75d4ee800b55..98500cf681db 100644
--- a/web-components/packages/carbon-web-components/src/components/accordion/defs.ts
+++ b/web-components/packages/carbon-web-components/src/components/accordion/defs.ts
@@ -1,7 +1,7 @@
/**
* @license
*
- * Copyright IBM Corp. 2020
+ * Copyright IBM Corp. 2020, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
@@ -23,21 +23,36 @@ export enum ACCORDION_ITEM_BREAKPOINT {
}
/**
- * Button size.
+ * Accordion size.
*/
export enum ACCORDION_SIZE {
/**
- * Regular size.
+ * Small size.
*/
- REGULAR = '',
+ SMALL = 'sm',
/**
- * Small size.
+ * Medium size.
*/
- SMALL = 'sm',
+ MEDIUM = 'md',
+
+ /**
+ * Large size.
+ */
+ LARGE = 'lg',
+}
+
+/**
+ * Specify the alignment of the accordion heading title and chevron.
+ */
+export enum ACCORDION_ALIGNMENT {
+ /**
+ * Alignment to the start
+ */
+ START = 'start',
/**
- * X-Large size.
+ * Alignment to the end
*/
- EXTRA_LARGE = 'xl',
+ END = 'END',
}
diff --git a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-item.ts b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-item.ts
index b19bbc54bbf0..03f14e8c93e0 100644
--- a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-item.ts
+++ b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-item.ts
@@ -9,15 +9,13 @@
import { LitElement, html } from 'lit';
import { customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import styles from './breadcrumb.scss';
-const { prefix } = settings;
-
/**
* Breadcrumb item.
*
- * @element bx-breadcrumb-item
+ * @element cds-breadcrumb-item
*/
@customElement(`${prefix}-breadcrumb-item`)
class BXBreadcrumbItem extends LitElement {
diff --git a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-link.ts b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-link.ts
index 360664dbaf13..cea065930d03 100644
--- a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-link.ts
+++ b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-link.ts
@@ -8,16 +8,14 @@
*/
import { customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import BXLink from '../link/link';
import styles from './breadcrumb.scss';
-const { prefix } = settings;
-
/**
* Link in breadcrumb.
*
- * @element bx-breadcrumb-link
+ * @element cds-breadcrumb-link
*/
@customElement(`${prefix}-breadcrumb-link`)
class BXBreadcrumbLink extends BXLink {
diff --git a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-overflow-menu.ts b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-overflow-menu.ts
index 245a2722773c..b151bc6cb8b7 100644
--- a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-overflow-menu.ts
+++ b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-overflow-menu.ts
@@ -9,17 +9,15 @@
import { html } from 'lit';
import { customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import OverflowMenuHorizontal16 from '@carbon/icons/lib/overflow-menu--horizontal/16';
import BXOverflowMenu from '../overflow-menu/overflow-menu';
import styles from './breadcrumb.scss';
-const { prefix } = settings;
-
/**
* Overflow menu in breadcrumb.
*
- * @element bx-breadcrumb-overflow-menu
+ * @element cds-breadcrumb-overflow-menu
*/
@customElement(`${prefix}-breadcrumb-overflow-menu`)
class BXBreadcrumbOverflowMenu extends BXOverflowMenu {
diff --git a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-story.ts b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-story.ts
index 492392f05fc3..0efde22f4d93 100644
--- a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb-story.ts
@@ -12,23 +12,24 @@ import './breadcrumb';
import './breadcrumb-item';
import './breadcrumb-link';
import './breadcrumb-overflow-menu';
+import '../overflow-menu/overflow-menu-body';
import storyDocs from './breadcrumb-story.mdx';
export const Default = () =>
html`
-
-
- Breadcrumb 1
-
-
- Breadcrumb 2
-
-
- Breadcrumb 3
+
+ Breadcrumb 1
+
+
+ Breadcrumb 2
+
+
+ Breadcrumb 3
-
-
+
+
`;
Default.storyName = 'Default';
@@ -41,27 +42,27 @@ export default {
};
export const withOverflowMenu = () => html`
-
-
- Breadcrumb 1
-
-
- Breadcrumb 2
-
-
-
-
- Option 1
- Option 2
-
-
-
-
- Breadcrumb 3
+
+ Breadcrumb 1
+
+
+ Breadcrumb 2
+
+
+
+
+ Option 1
+ Option 2
+
+
+
+
+ Breadcrumb 3
-
-
+
+
`;
withOverflowMenu.storyName = 'with Overflow Menu';
diff --git a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb.scss b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb.scss
index aeccbbcdff40..6dee805f56f4 100644
--- a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb.scss
+++ b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb.scss
@@ -7,8 +7,11 @@
$css--plex: true !default;
-@import 'carbon-components/scss/components/link/link';
-@import 'carbon-components/scss/components/breadcrumb/breadcrumb';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/theme' as *;
+@use '@carbon/styles/scss/motion' as *;
+@use '@carbon/styles/scss/utilities' as *;
+@use '@carbon/styles/scss/components/breadcrumb';
@import '../overflow-menu/overflow-menu';
:host(#{$prefix}-breadcrumb) {
@@ -17,13 +20,6 @@ $css--plex: true !default;
:host(#{$prefix}-breadcrumb-item) {
@extend .#{$prefix}--breadcrumb-item;
-
- // TODO: see if we can remove this ::after section after v11 upgrade
- &::after {
- margin-left: $spacing-03;
- color: $text-primary;
- content: '/';
- }
}
:host(#{$prefix}-breadcrumb-overflow-menu) {
@@ -51,7 +47,7 @@ $css--plex: true !default;
background: $link-primary-hover;
content: '';
opacity: 0;
- transition: opacity $duration--fast-01 motion(standard, productive);
+ transition: opacity $duration-fast-01 motion(standard, productive);
}
}
@@ -62,7 +58,7 @@ $css--plex: true !default;
:host(#{$prefix}-breadcrumb-overflow-menu) svg {
position: relative;
- fill: $link-01;
+ fill: $link-primary;
transform: translateY(4px);
}
@@ -77,9 +73,9 @@ $css--plex: true !default;
:host(#{$prefix}-breadcrumb-link) {
outline: none;
- // Re-define the ruleset so this wins over `.bx--link:visited`, etc.
+ // Re-define the ruleset so this wins over `.#{$prefix}--link:visited`, etc.
.#{$prefix}--link--disabled {
- color: $disabled-02;
+ color: $text-disabled;
}
.#{$prefix}--link__icon[hidden] {
@@ -88,7 +84,7 @@ $css--plex: true !default;
}
:host(#{$prefix}-breadcrumb-link[aria-current='page']) .#{$prefix}--link {
- color: $text-01;
+ color: $text-primary;
cursor: auto;
&:hover {
diff --git a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb.ts b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb.ts
index c6fbee8721a0..0d77653c62d3 100644
--- a/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb.ts
+++ b/web-components/packages/carbon-web-components/src/components/breadcrumb/breadcrumb.ts
@@ -9,15 +9,13 @@
import { LitElement, html } from 'lit';
import { customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import styles from './breadcrumb.scss';
-const { prefix } = settings;
-
/**
* Breadcrumb.
*
- * @element bx-breadcrumb
+ * @element cds-breadcrumb
*/
@customElement(`${prefix}-breadcrumb`)
class BXBreadcrumb extends LitElement {
diff --git a/web-components/packages/carbon-web-components/src/components/button/button-skeleton.ts b/web-components/packages/carbon-web-components/src/components/button/button-skeleton.ts
index 97582e9affad..db73356b0e1b 100644
--- a/web-components/packages/carbon-web-components/src/components/button/button-skeleton.ts
+++ b/web-components/packages/carbon-web-components/src/components/button/button-skeleton.ts
@@ -7,16 +7,14 @@
* LICENSE file in the root directory of this source tree.
*/
-import settings from 'carbon-components/es/globals/js/settings';
import { classMap } from 'lit/directives/class-map.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import { html } from 'lit';
import { customElement } from 'lit/decorators.js';
+import { prefix } from '../../globals/settings';
import BXButton from './button';
import styles from './button.scss';
-const { prefix } = settings;
-
/**
* Button skeleton.
*/
diff --git a/web-components/packages/carbon-web-components/src/components/button/button-story.ts b/web-components/packages/carbon-web-components/src/components/button/button-story.ts
index 2bb870493f48..6d62b6050136 100644
--- a/web-components/packages/carbon-web-components/src/components/button/button-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/button/button-story.ts
@@ -15,6 +15,7 @@ import { ifDefined } from 'lit/directives/if-defined.js';
// In our dev env, we auto-generate the file and re-map below path to to point to the generated file.
// @ts-ignore
import Add16 from '@carbon/web-components/es/icons/add/16';
+import { prefix } from '../../globals/settings';
import { BUTTON_KIND, BUTTON_SIZE, BUTTON_ICON_LAYOUT } from './button';
import './button-skeleton';
import textNullable from '../../../.storybook/knob-text-nullable';
@@ -60,9 +61,9 @@ export const Default = (args) => {
target,
type,
onClick,
- } = args?.['bx-btn'] ?? {};
+ } = args?.[`${prefix}-btn`] ?? {};
return html`
- {
type="${ifDefined(type)}"
@click=${onClick}>
Button
-
+
`;
};
Default.parameters = {
knobs: {
- 'bx-btn': () => ({
+ [`${prefix}-btn`]: () => ({
kind: select('Button kind (kind)', kinds, BUTTON_KIND.PRIMARY),
disabled: boolean('Disabled (disabled)', false),
size: select('Button size (size)', sizes, null),
@@ -97,9 +98,9 @@ Default.parameters = {
export const icon = (args) => {
const { kind, disabled, size, href, isExpressive, onClick } =
- args?.['bx-btn'] ?? {};
+ args?.[`${prefix}-btn`] ?? {};
return html`
- {
?isExpressive="${isExpressive}"
@click=${onClick}>
${Add16({ slot: 'icon' })}
-
+
`;
};
@@ -115,9 +116,9 @@ icon.parameters = Default.parameters;
export const textAndIcon = (args) => {
const { kind, disabled, size, href, iconLayout, isExpressive, onClick } =
- args?.['bx-btn'] ?? {};
+ args?.[`${prefix}-btn`] ?? {};
return html`
- {
href=${ifDefined(href || undefined)}
@click=${onClick}>
Button ${Add16({ slot: 'icon' })}
-
+
`;
};
@@ -134,7 +135,7 @@ textAndIcon.storyName = 'Text and icon';
textAndIcon.parameters = {
knobs: {
- 'bx-btn': () => ({
+ [`${prefix}-btn`]: () => ({
iconLayout: select('Icon layout (icon-layout)', iconLayouts, null),
kind: select('Button kind (kind)', kinds, BUTTON_KIND.PRIMARY),
disabled: boolean('Disabled (disabled)', false),
@@ -148,15 +149,15 @@ textAndIcon.parameters = {
export const skeleton = (args) => {
const { disabled, size, href, isExpressive, onClick } =
- args?.['bx-btn-skeleton'];
+ args?.[`${prefix}-btn-skeleton`];
return html`
-
-
+
`;
};
@@ -165,7 +166,7 @@ skeleton.parameters = {
skip: true,
},
knobs: {
- 'bx-btn-skeleton': () => ({
+ [`${prefix}-btn-skeleton`]: () => ({
kind: select('Button kind (kind)', kinds, BUTTON_KIND.PRIMARY),
disabled: boolean('Disabled (disabled)', false),
size: select('Button size (size)', sizes, null),
diff --git a/web-components/packages/carbon-web-components/src/components/button/button.scss b/web-components/packages/carbon-web-components/src/components/button/button.scss
index ee5a9d7a9465..2b53f7697c48 100644
--- a/web-components/packages/carbon-web-components/src/components/button/button.scss
+++ b/web-components/packages/carbon-web-components/src/components/button/button.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2019, 2022
+// Copyright IBM Corp. 2019, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,7 +7,9 @@
$css--plex: true !default;
-@import 'carbon-components/scss/components/button/button';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/utilities/convert' as *;
+@use '@carbon/styles/scss/components/button';
:host(#{$prefix}-btn),
:host(#{$prefix}-modal-footer-button) {
diff --git a/web-components/packages/carbon-web-components/src/components/button/button.ts b/web-components/packages/carbon-web-components/src/components/button/button.ts
index f5aecb0c4788..e0467347e495 100644
--- a/web-components/packages/carbon-web-components/src/components/button/button.ts
+++ b/web-components/packages/carbon-web-components/src/components/button/button.ts
@@ -7,11 +7,11 @@
* LICENSE file in the root directory of this source tree.
*/
-import settings from 'carbon-components/es/globals/js/settings';
import { classMap } from 'lit/directives/class-map.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
+import { prefix } from '../../globals/settings';
import FocusMixin from '../../globals/mixins/focus';
import { BUTTON_KIND, BUTTON_SIZE, BUTTON_ICON_LAYOUT } from './defs';
import styles from './button.scss';
@@ -20,12 +20,10 @@ import HostListenerMixin from '../../globals/mixins/host-listener';
export { BUTTON_KIND, BUTTON_SIZE, BUTTON_ICON_LAYOUT };
-const { prefix } = settings;
-
/**
* Button.
*
- * @element bx-btn
+ * @element cds-btn
* @csspart button The button.
*/
@customElement(`${prefix}-btn`)
diff --git a/web-components/packages/carbon-web-components/src/components/checkbox/checkbox-story.ts b/web-components/packages/carbon-web-components/src/components/checkbox/checkbox-story.ts
index 4b9ba9b1ff68..65629ca94935 100644
--- a/web-components/packages/carbon-web-components/src/components/checkbox/checkbox-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/checkbox/checkbox-story.ts
@@ -11,6 +11,7 @@ import { html } from 'lit';
import { action } from '@storybook/addon-actions';
import { boolean } from '@storybook/addon-knobs';
import { ifDefined } from 'lit/directives/if-defined.js';
+import { prefix } from '../../globals/settings';
import textNullable from '../../../.storybook/knob-text-nullable';
import './checkbox';
import storyDocs from './checkbox-story.mdx';
@@ -25,17 +26,29 @@ export const Default = (args) => {
name,
value,
onChange,
- } = args?.['bx-checkbox'] ?? {};
+ } = args?.[`${prefix}-checkbox`] ?? {};
return html`
-
+
`;
};
@@ -46,7 +59,7 @@ export default {
parameters: {
...storyDocs.parameters,
knobs: {
- 'bx-checkbox': () => ({
+ [`${prefix}-checkbox`]: () => ({
checked: boolean('Checked (checked)', false),
disabled: boolean('Disabled (disabled)', false),
hideLabel: boolean('Hide label (hide-label)', false),
@@ -54,7 +67,7 @@ export default {
labelText: textNullable('Label text (label-text)', 'Checkbox'),
name: textNullable('Name (name)', ''),
value: textNullable('Value (value)', ''),
- onChange: action('bx-checkbox-changed'),
+ onChange: action(`${prefix}-checkbox-changed`),
}),
},
},
diff --git a/web-components/packages/carbon-web-components/src/components/checkbox/checkbox.scss b/web-components/packages/carbon-web-components/src/components/checkbox/checkbox.scss
index 193275540005..d73782e23c81 100644
--- a/web-components/packages/carbon-web-components/src/components/checkbox/checkbox.scss
+++ b/web-components/packages/carbon-web-components/src/components/checkbox/checkbox.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2019, 2022
+// Copyright IBM Corp. 2019, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,9 +7,10 @@
$css--plex: true !default;
-@import 'carbon-components/scss/globals/scss/css--helpers';
-@import 'carbon-components/scss/components/form/form';
-@import 'carbon-components/scss/components/checkbox/checkbox';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/utilities';
+@use '@carbon/styles/scss/components/form';
+@use '@carbon/styles/scss/components/checkbox';
:host(#{$prefix}-checkbox) {
@extend .#{$prefix}--form-item;
diff --git a/web-components/packages/carbon-web-components/src/components/checkbox/checkbox.ts b/web-components/packages/carbon-web-components/src/components/checkbox/checkbox.ts
index 7c7d838b43be..cfd3f0cc1fcb 100644
--- a/web-components/packages/carbon-web-components/src/components/checkbox/checkbox.ts
+++ b/web-components/packages/carbon-web-components/src/components/checkbox/checkbox.ts
@@ -11,18 +11,16 @@ import { classMap } from 'lit/directives/class-map.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import { LitElement, html } from 'lit';
import { property, customElement, query } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import FocusMixin from '../../globals/mixins/focus';
import FormMixin from '../../globals/mixins/form';
import styles from './checkbox.scss';
-const { prefix } = settings;
-
/**
* Check box.
*
- * @element bx-checkbox
- * @fires bx-checkbox-changed - The custom event fired after this changebox changes its checked state.
+ * @element cds-checkbox
+ * @fires cds-checkbox-changed - The custom event fired after this changebox changes its checked state.
* @csspart input The checkbox.
* @csspart label The label.
*/
diff --git a/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet-skeleton.ts b/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet-skeleton.ts
index ca8c666c4087..a500d1fe9830 100644
--- a/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet-skeleton.ts
+++ b/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet-skeleton.ts
@@ -9,12 +9,10 @@
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import { CODE_SNIPPET_TYPE } from './code-snippet';
import styles from './code-snippet.scss';
-const { prefix } = settings;
-
/**
* Skeleton of code snippet.
*/
diff --git a/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet-story.ts b/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet-story.ts
index 7846a81f28d4..147dfd61c5d3 100644
--- a/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet-story.ts
@@ -8,10 +8,11 @@
*/
import { html } from 'lit';
+import { ifDefined } from 'lit/directives/if-defined.js';
import { action } from '@storybook/addon-actions';
import { number, select } from '@storybook/addon-knobs';
+import { prefix } from '../../globals/settings';
import textNullable from '../../../.storybook/knob-text-nullable';
-import { ifDefined } from 'lit/directives/if-defined.js';
import { CODE_SNIPPET_COLOR_SCHEME } from './code-snippet';
import storyDocs from './code-snippet-story.mdx';
import './code-snippet-skeleton';
@@ -23,7 +24,7 @@ const colorSchemes = {
};
const defaultKnobs = {
- 'bx-code-snippet': () => ({
+ [`${prefix}-code-snippet`]: () => ({
codeAssistiveText: textNullable(
'Assistive text for the code portion (code-assistive-text)',
''
@@ -53,21 +54,21 @@ export const singleLine = (args) => {
copyButtonFeedbackTimeout,
colorScheme,
onClick,
- } = args?.['bx-code-snippet'] ?? {};
+ } = args?.[`${prefix}-code-snippet`] ?? {};
const children = `
node -v Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, veritatis voluptate id incidunt molestiae
officia possimus, quasi itaque alias, architecto hic, dicta fugit? Debitis delectus quidem explicabo vitae
laboriosam!
`;
return html`
- ${children}${children}
`;
};
@@ -88,7 +89,7 @@ export const multiLine = (args) => {
expandButtonText,
colorScheme,
onClick,
- } = args?.['bx-code-snippet'] ?? {};
+ } = args?.[`${prefix}-code-snippet`] ?? {};
const children = `
@mixin grid-container {
width: 100%;
@@ -114,7 +115,7 @@ $z-indexes: (
`.trim();
// prettier-ignore
return html`
- ${children}
+ >${children}
`;
};
@@ -132,8 +133,8 @@ multiLine.storyName = 'Multi line';
multiLine.parameters = {
knobs: {
- 'bx-code-snippet': () => ({
- ...defaultKnobs['bx-code-snippet'](),
+ [`${prefix}-code-snippet`]: () => ({
+ ...defaultKnobs[`${prefix}-code-snippet`](),
collapseButtonText: textNullable(
'The text for the collapse button (collapse-button-text)',
''
@@ -154,9 +155,9 @@ export const inline = (args) => {
copyButtonFeedbackTimeout,
colorScheme,
onClick,
- } = args?.['bx-code-snippet'] ?? {};
+ } = args?.[`${prefix}-code-snippet`] ?? {};
return html`
- {
copy-button-feedback-timeout="${copyButtonFeedbackTimeout}"
color-scheme="${ifDefined(colorScheme)}"
@click="${onClick}"
- >node -vnode -v
`;
};
@@ -176,7 +177,7 @@ inline.parameters = {
};
export const skeletonSingleLine = () =>
- html` `;
+ html` `;
skeletonSingleLine.storyName = 'Skeleton single line';
@@ -187,7 +188,7 @@ skeletonSingleLine.parameters = {
};
export const skeletonMultiLine = () =>
- html` `;
+ html` `;
skeletonMultiLine.storyName = 'Skeleton multi line';
diff --git a/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet.scss b/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet.scss
index f139aaa28567..91a4f6b1067f 100644
--- a/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet.scss
+++ b/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2019, 2022
+// Copyright IBM Corp. 2019, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,9 +7,17 @@
$css--plex: true !default;
-@import 'carbon-components/scss/globals/scss/helper-mixins';
-@import 'carbon-components/scss/components/code-snippet/code-snippet';
-@import 'carbon-components/scss/components/copy-button/copy-button';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/theme' as *;
+@use '@carbon/styles/scss/type' as *;
+@use '@carbon/styles/scss/spacing' as *;
+@use '@carbon/styles/scss/motion' as *;
+@use '@carbon/styles/scss/utilities' as *;
+@use '@carbon/styles/scss/components/code-snippet/code-snippet' as *;
+@use '@carbon/styles/scss/components/copy-button/copy-button';
+
+// https://github.com/carbon-design-system/carbon/issues/11408
+@include code-snippet;
:host(#{$prefix}-code-snippet),
:host(#{$prefix}-code-snippet-skeleton) {
@@ -18,12 +26,12 @@ $css--plex: true !default;
outline: none;
&::after {
- background-color: $ui-01;
+ background-color: $layer-01;
background-image: none;
- mask-image: linear-gradient(to right, transparent 0%, $ui-01 100%);
+ mask-image: linear-gradient(to right, transparent 0%, $layer-01 100%);
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
background-color: transparent;
- background-image: linear-gradient(to right, transparent, $ui-01);
+ background-image: linear-gradient(to right, transparent, $layer-01);
}
}
@@ -49,26 +57,27 @@ $css--plex: true !default;
white-space: nowrap;
@include type-style('code-01');
- padding-right: $spacing-xs;
+ padding-right: $spacing-03;
}
}
-:host(#{$prefix}-code-snippet[color-scheme='light']) {
- background-color: $ui-02;
+// TODO: deprecate light color scheme
+// :host(#{$prefix}-code-snippet[color-scheme='light']) {
+// background-color: $layer-02;
- button.#{$prefix}--btn.#{$prefix}--snippet-btn--expand {
- background-color: $ui-02;
- }
+// button.#{$prefix}--btn.#{$prefix}--snippet-btn--expand {
+// background-color: $layer-02;
+// }
- &:hover {
- background-color: $hover-ui-light;
- }
+// &:hover {
+// background-color: $hover-ui-light;
+// }
- .#{$prefix}--snippet-button:hover,
- button.#{$prefix}--btn.#{$prefix}--snippet-btn--expand:hover {
- background-color: $hover-ui-light;
- }
-}
+// .#{$prefix}--snippet-button:hover,
+// button.#{$prefix}--btn.#{$prefix}--snippet-btn--expand:hover {
+// background-color: $hover-ui-light;
+// }
+// }
:host(#{$prefix}-code-snippet[type='multi']),
:host(#{$prefix}-code-snippet-skeleton[type='multi']) {
@@ -84,12 +93,12 @@ $css--plex: true !default;
bottom: rem(16px);
width: 100%;
height: rem(16px);
- background-color: $ui-01;
+ background-color: $layer-01;
background-image: none;
- mask-image: linear-gradient(to bottom, transparent 0%, $ui-01 100%);
+ mask-image: linear-gradient(to bottom, transparent 0%, $layer-01 100%);
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
background-color: transparent;
- background-image: linear-gradient(to bottom, transparent, $ui-01);
+ background-image: linear-gradient(to bottom, transparent, $layer-01);
}
}
@@ -101,7 +110,7 @@ $css--plex: true !default;
padding-bottom: 0;
max-height: rem(238px);
min-height: rem(56px);
- transition: max-height $duration--moderate-01 motion(standard, productive);
+ transition: max-height $duration-moderate-01 motion(standard, productive);
pre {
overflow: hidden;
@@ -122,7 +131,7 @@ $css--plex: true !default;
.#{$prefix}-ce--snippet-container--expanded {
max-height: rem(1500px);
- transition: max-height $duration--moderate-01 motion(standard, productive);
+ transition: max-height $duration-moderate-01 motion(standard, productive);
pre {
overflow-x: auto;
diff --git a/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet.ts b/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet.ts
index 9babfc941693..4c1cd189faa4 100644
--- a/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet.ts
+++ b/web-components/packages/carbon-web-components/src/components/code-snippet/code-snippet.ts
@@ -11,7 +11,7 @@ import { classMap } from 'lit/directives/class-map.js';
import { LitElement, html, TemplateResult } from 'lit';
import { property, customElement, query } from 'lit/decorators.js';
import ChevronDown16 from '@carbon/icons/lib/chevron--down/16';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import FocusMixin from '../../globals/mixins/focus';
import {
_createHandleFeedbackTooltip as createHandleCopyButtonFeedbackTooltip,
@@ -22,8 +22,6 @@ import styles from './code-snippet.scss';
export { CODE_SNIPPET_COLOR_SCHEME, CODE_SNIPPET_TYPE };
-const { prefix } = settings;
-
/**
* @param values The values to render.
* @param values.children The child nodes.
@@ -82,7 +80,7 @@ const renderCode = ({
/**
* Basic code snippet.
*
- * @element bx-code-snippet
+ * @element cds-code-snippet
*/
@customElement(`${prefix}-code-snippet`)
class BXCodeSnippet extends FocusMixin(LitElement) {
diff --git a/web-components/packages/carbon-web-components/src/components/combo-box/combo-box-item.ts b/web-components/packages/carbon-web-components/src/components/combo-box/combo-box-item.ts
index 0bbcc866a76f..45c307b28752 100644
--- a/web-components/packages/carbon-web-components/src/components/combo-box/combo-box-item.ts
+++ b/web-components/packages/carbon-web-components/src/components/combo-box/combo-box-item.ts
@@ -7,17 +7,15 @@
* LICENSE file in the root directory of this source tree.
*/
-import settings from 'carbon-components/es/globals/js/settings';
import { customElement } from 'lit/decorators.js';
+import { prefix } from '../../globals/settings';
import BXDropdownItem from '../dropdown/dropdown-item';
import styles from './combo-box.scss';
-const { prefix } = settings;
-
/**
* Combo box item.
*
- * @element bx-combo-box-item
+ * @element cds-combo-box-item
*/
@customElement(`${prefix}-combo-box-item`)
class BXComboBoxItem extends BXDropdownItem {
diff --git a/web-components/packages/carbon-web-components/src/components/combo-box/combo-box-story.ts b/web-components/packages/carbon-web-components/src/components/combo-box/combo-box-story.ts
index 58e6b141de9b..97908ce36163 100644
--- a/web-components/packages/carbon-web-components/src/components/combo-box/combo-box-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/combo-box/combo-box-story.ts
@@ -18,6 +18,7 @@ import {
} from './combo-box';
import './combo-box-item';
import storyDocs from './combo-box-story.mdx';
+import { prefix } from '../../globals/settings';
const colorSchemes = {
[`Regular`]: null,
@@ -55,7 +56,7 @@ export const Default = (args) => {
onBeforeToggle,
onSelect,
onToggle,
- } = args?.['bx-combo-box'] ?? {};
+ } = args?.[`${prefix}-combo-box`] ?? {};
const handleBeforeSelect = (event: CustomEvent) => {
if (onBeforeSelect) {
onBeforeSelect(event);
@@ -73,7 +74,7 @@ export const Default = (args) => {
}
};
return html`
- {
value=${value}
trigger-content=${triggerContent}
type=${ifDefined(type)}
- @bx-combo-box-beingselected=${handleBeforeSelect}
- @bx-combo-box-beingtoggled=${handleBeforeToggle}
- @bx-combo-box-selected=${onSelect}
- @bx-combo-box-toggled=${onToggle}>
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
-
+ @cds-combo-box-beingselected=${handleBeforeSelect}
+ @cds-combo-box-beingtoggled=${handleBeforeToggle}
+ @cds-combo-box-selected=${onSelect}
+ @cds-combo-box-toggled=${onToggle}>
+ Option 1
+ Option 2
+ Option 3
+ Option 4
+ Option 5
+ Option 6
+ Option 7
+ Option 8
+
`;
};
+Default.decorators = [
+ (story) => html`
${story()}
`,
+];
+
Default.storyName = 'Default';
export default {
@@ -108,7 +113,7 @@ export default {
parameters: {
...storyDocs.parameters,
knobs: {
- 'bx-combo-box': () => ({
+ [`${prefix}-combo-box`]: () => ({
open: boolean('Open (open)', false),
colorScheme: select('Color scheme (color-scheme)', colorSchemes, null),
disabled: boolean('Disabled (disabled)', false),
@@ -124,17 +129,17 @@ export default {
validityMessage: text('The validity message (validity-message)', ''),
value: text('The value of the selected item (value)', ''),
disableSelection: boolean(
- 'Disable user-initiated selection change (Call event.preventDefault() in bx-combo-box-beingselected event)',
+ `Disable user-initiated selection change (Call event.preventDefault() in ${prefix}-combo-box-beingselected event)`,
false
),
disableToggle: boolean(
- 'Disable user-initiated toggle of open state (Call event.preventDefault() in bx-combo-box-beingtoggled event)',
+ `Disable user-initiated toggle of open state (Call event.preventDefault() in ${prefix}-combo-box-beingtoggled event)`,
false
),
- onBeforeSelect: action('bx-combo-box-beingselected'),
- onBeforeToggle: action('bx-combo-box-beingtoggled'),
- onSelect: action('bx-combo-box-selected'),
- onToggle: action('bx-combo-box-toggled'),
+ onBeforeSelect: action(`${prefix}-combo-box-beingselected`),
+ onBeforeToggle: action(`${prefix}-combo-box-beingtoggled`),
+ onSelect: action(`${prefix}-combo-box-selected`),
+ onToggle: action(`${prefix}-combo-box-toggled`),
}),
},
},
diff --git a/web-components/packages/carbon-web-components/src/components/combo-box/combo-box.scss b/web-components/packages/carbon-web-components/src/components/combo-box/combo-box.scss
index 0e4247ad6faa..d2ef0cc50b80 100644
--- a/web-components/packages/carbon-web-components/src/components/combo-box/combo-box.scss
+++ b/web-components/packages/carbon-web-components/src/components/combo-box/combo-box.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2019, 2022
+// Copyright IBM Corp. 2019, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,9 +7,12 @@
$css--plex: true !default;
-@import 'carbon-components/scss/components/combo-box/combo-box';
-@import 'carbon-components/scss/components/form/form';
-@import 'carbon-components/scss/components/text-input/text-input';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/theme' as *;
+@use '@carbon/styles/scss/utilities' as *;
+@use '@carbon/styles/scss/components/combo-box/combo-box';
+@use '@carbon/styles/scss/components/form';
+@use '@carbon/styles/scss/components/text-input/text-input';
:host(#{$prefix}-combo-box) {
outline: none;
@@ -79,7 +82,7 @@ $css--plex: true !default;
:host(#{$prefix}-combo-box-item[disabled])
.#{$prefix}--list-box__menu-item__option {
- color: $disabled-02;
+ color: $text-disabled;
text-decoration: none;
}
@@ -92,7 +95,7 @@ $css--plex: true !default;
@extend .#{$prefix}--list-box__menu-item--highlighted;
.#{$prefix}--list-box__menu-item__option {
- color: $text-01;
+ color: $text-primary;
}
.#{$prefix}--list-box__menu-item__selected-icon {
diff --git a/web-components/packages/carbon-web-components/src/components/combo-box/combo-box.ts b/web-components/packages/carbon-web-components/src/components/combo-box/combo-box.ts
index 8f306405baf5..f512fee41943 100644
--- a/web-components/packages/carbon-web-components/src/components/combo-box/combo-box.ts
+++ b/web-components/packages/carbon-web-components/src/components/combo-box/combo-box.ts
@@ -7,10 +7,10 @@
* LICENSE file in the root directory of this source tree.
*/
-import settings from 'carbon-components/es/globals/js/settings';
import { TemplateResult, html } from 'lit';
import { property, customElement, query } from 'lit/decorators.js';
import Close16 from '@carbon/icons/lib/close/16';
+import { prefix } from '../../globals/settings';
import { findIndex, forEach } from '../../globals/internal/collection-helpers';
import BXDropdown, { DROPDOWN_KEYBOARD_ACTION } from '../dropdown/dropdown';
import BXComboBoxItem from './combo-box-item';
@@ -22,20 +22,18 @@ export {
DROPDOWN_TYPE,
} from '../dropdown/dropdown';
-const { prefix } = settings;
-
/**
* Combo box.
*
- * @element bx-combo-box
- * @fires bx-combo-box-beingselected
+ * @element cds-combo-box
+ * @fires cds-combo-box-beingselected
* The custom event fired before a combo box item is selected upon a user gesture.
* Cancellation of this event stops changing the user-initiated selection.
- * @fires bx-combo-box-beingtoggled
+ * @fires cds-combo-box-beingtoggled
* The custom event fired before the open state of this combo box is toggled upon a user gesture.
* Cancellation of this event stops the user-initiated toggling.
- * @fires bx-combo-box-selected - The custom event fired after a combo box item is selected upon a user gesture.
- * @fires bx-combo-box-toggled - The custom event fired after the open state of this combo box is toggled upon a user gesture.
+ * @fires cds-combo-box-selected - The custom event fired after a combo box item is selected upon a user gesture.
+ * @fires cds-combo-box-toggled - The custom event fired after the open state of this combo box is toggled upon a user gesture.
*/
@customElement(`${prefix}-combo-box`)
class BXComboBox extends BXDropdown {
diff --git a/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher-item.ts b/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher-item.ts
index e21e25c41efe..3e613b4bd012 100644
--- a/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher-item.ts
+++ b/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher-item.ts
@@ -11,16 +11,14 @@ import { classMap } from 'lit/directives/class-map.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import FocusMixin from '../../globals/mixins/focus';
import styles from './content-switcher.scss';
-const { prefix } = settings;
-
/**
* Content switcher button.
*
- * @element bx-content-switcher-item
+ * @element cds-content-switcher-item
*/
@customElement(`${prefix}-content-switcher-item`)
class BXContentSwitcherItem extends FocusMixin(LitElement) {
@@ -53,7 +51,7 @@ class BXContentSwitcherItem extends FocusMixin(LitElement) {
target!: string;
/**
- * The `value` attribute that is set to the parent `` when this content switcher item is selected.
+ * The `value` attribute that is set to the parent `` when this content switcher item is selected.
*/
@property()
value = '';
diff --git a/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher-story.ts b/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher-story.ts
index 60e2e7829b30..16a9228a5dff 100644
--- a/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher-story.ts
@@ -15,14 +15,14 @@ import { ifDefined } from 'lit/directives/if-defined.js';
import { CONTENT_SWITCHER_SIZE } from './content-switcher';
import './content-switcher-item';
import storyDocs from './content-switcher-story.mdx';
+import { prefix } from '../../globals/settings';
const noop = () => {};
const sizes = {
- 'Regular size': null,
- [`Small size (${CONTENT_SWITCHER_SIZE.SMALL})`]: CONTENT_SWITCHER_SIZE.SMALL,
- [`XL size (${CONTENT_SWITCHER_SIZE.EXTRA_LARGE})`]:
- CONTENT_SWITCHER_SIZE.EXTRA_LARGE,
+ 'Medium (md - default)': null,
+ [`Small (${CONTENT_SWITCHER_SIZE.SMALL})`]: CONTENT_SWITCHER_SIZE.SMALL,
+ [`Large (${CONTENT_SWITCHER_SIZE.LARGE})`]: CONTENT_SWITCHER_SIZE.LARGE,
};
export const Default = (args) => {
@@ -32,7 +32,7 @@ export const Default = (args) => {
onBeforeSelect = noop,
onSelect = noop,
size,
- } = args?.['bx-content-switcher'] ?? {};
+ } = args?.[`${prefix}-content-switcher`] ?? {};
const handleBeforeSelected = (event: CustomEvent) => {
onBeforeSelect(event);
if (disableSelection) {
@@ -40,23 +40,21 @@ export const Default = (args) => {
}
};
return html`
-
- Option 1
- Option 2First section
- Option 3Second section
- Option 4
- Option 5Third section
-
+
`;
};
@@ -67,15 +65,15 @@ export default {
parameters: {
...storyDocs.parameters,
knobs: {
- 'bx-content-switcher': () => ({
+ [`${prefix}-content-switcher`]: () => ({
value: textNullable('The value of the selected item (value)', ''),
size: select('Button size (size)', sizes, null),
disableSelection: boolean(
- 'Disable user-initiated selection change (Call event.preventDefault() in bx-content-switcher-beingselected event)',
+ `Disable user-initiated selection change (Call event.preventDefault() in ${prefix}-content-switcher-beingselected event)`,
false
),
- onBeforeSelect: action('bx-content-switcher-beingselected'),
- onSelect: action('bx-content-switcher-selected'),
+ onBeforeSelect: action(`${prefix}-content-switcher-beingselected`),
+ onSelect: action(`${prefix}-content-switcher-selected`),
}),
},
},
diff --git a/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher.scss b/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher.scss
index 3c294a9b4031..650e28ce2076 100644
--- a/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher.scss
+++ b/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2019, 2022
+// Copyright IBM Corp. 2019, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,7 +7,13 @@
$css--plex: true !default;
-@import 'carbon-components/scss/components/content-switcher/content-switcher';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/theme' as *;
+@use '@carbon/styles/scss/utilities/convert' as *;
+@use '@carbon/styles/scss/components/content-switcher/content-switcher' as *;
+
+// https://github.com/carbon-design-system/carbon/issues/11408
+@include content-switcher;
:host(#{$prefix}-content-switcher) {
@extend .#{$prefix}--content-switcher;
@@ -17,8 +23,8 @@ $css--plex: true !default;
@extend .#{$prefix}--content-switcher--sm;
}
-:host(#{$prefix}-content-switcher[size='xl']) {
- @extend .#{$prefix}--content-switcher--xl;
+:host(#{$prefix}-content-switcher[size='lg']) {
+ @extend .#{$prefix}--content-switcher--lg;
}
:host(#{$prefix}-content-switcher-item) {
@@ -40,7 +46,7 @@ $css--plex: true !default;
display: block;
height: rem(16px);
width: rem(1px);
- background-color: $content-switcher-divider;
+ background-color: $border-subtle;
position: absolute;
z-index: 2;
left: 0;
@@ -55,8 +61,8 @@ $css--plex: true !default;
}
&:disabled {
- border-top-color: $ui-05;
- border-bottom-color: $ui-05;
+ border-top-color: $border-inverse;
+ border-bottom-color: $border-inverse;
}
}
}
@@ -70,7 +76,7 @@ $css--plex: true !default;
.#{$prefix}--content-switcher-btn {
border-top-left-radius: rem(4px);
border-bottom-left-radius: rem(4px);
- border-left: rem(1px) solid $ui-05;
+ border-left: rem(1px) solid $border-inverse;
&::before {
content: none;
@@ -85,7 +91,7 @@ $css--plex: true !default;
.#{$prefix}--content-switcher-btn {
border-top-right-radius: rem(4px);
border-bottom-right-radius: rem(4px);
- border-right: rem(1px) solid $ui-05;
+ border-right: rem(1px) solid $border-inverse;
&.#{$prefix}--content-switcher--selected {
border-right: none;
diff --git a/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher.ts b/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher.ts
index 9f65841adfa5..51e265efd84a 100644
--- a/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher.ts
+++ b/web-components/packages/carbon-web-components/src/components/content-switcher/content-switcher.ts
@@ -9,7 +9,7 @@
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import { forEach, indexOf } from '../../globals/internal/collection-helpers';
import { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE } from './defs';
import BXSwitch from './content-switcher-item';
@@ -17,8 +17,6 @@ import styles from './content-switcher.scss';
export { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE };
-const { prefix } = settings;
-
/**
* @param index The index
* @param length The length of the array.
@@ -37,11 +35,11 @@ const capIndex = (index: number, length: number) => {
/**
* Content switcher.
*
- * @element bx-content-switcher
- * @fires bx-content-switcher-beingselected
+ * @element cds-content-switcher
+ * @fires cds-content-switcher-beingselected
* The custom event fired before a content switcher item is selected upon a user gesture.
* Cancellation of this event stops changing the user-initiated selection.
- * @fires bx-content-switcher-selected - The custom event fired after a a content switcher item is selected upon a user gesture.
+ * @fires cds-content-switcher-selected - The custom event fired after a a content switcher item is selected upon a user gesture.
*/
@customElement(`${prefix}-content-switcher`)
class BXContentSwitcher extends LitElement {
@@ -59,7 +57,7 @@ class BXContentSwitcher extends LitElement {
: indexOf(items, (target as Element).closest(selectorItem)!);
const nextIndex = index < 0 ? index : index + 1;
forEach(this.querySelectorAll(selectorItem), (elem, i) => {
- // Specifies child `` to hide its divider instead of using CSS,
+ // Specifies child `` to hide its divider instead of using CSS,
// until `:host-context()` gets supported in all major browsers
(elem as BXSwitch).hideDivider = i === nextIndex;
});
diff --git a/web-components/packages/carbon-web-components/src/components/content-switcher/defs.ts b/web-components/packages/carbon-web-components/src/components/content-switcher/defs.ts
index 2496b8c09e58..6ffc8e0ba9c4 100644
--- a/web-components/packages/carbon-web-components/src/components/content-switcher/defs.ts
+++ b/web-components/packages/carbon-web-components/src/components/content-switcher/defs.ts
@@ -1,7 +1,7 @@
/**
* @license
*
- * Copyright IBM Corp. 2020
+ * Copyright IBM Corp. 2020, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
@@ -31,6 +31,12 @@ export enum CONTENT_SWITCHER_SIZE {
*/
SMALL = 'sm',
+ /**
+ * Large size.
+ */
+ LARGE = 'lg',
+
+ // TODO: deprecate
/**
* X-Large size.
*/
diff --git a/web-components/packages/carbon-web-components/src/components/copy-button/copy-button-story.ts b/web-components/packages/carbon-web-components/src/components/copy-button/copy-button-story.ts
index 132a105bb022..2ec136b70870 100644
--- a/web-components/packages/carbon-web-components/src/components/copy-button/copy-button-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/copy-button/copy-button-story.ts
@@ -14,16 +14,17 @@ import textNullable from '../../../.storybook/knob-text-nullable';
import { ifDefined } from 'lit/directives/if-defined.js';
import './copy-button';
import storyDocs from './copy-button-story.mdx';
+import { prefix } from '../../globals/settings';
export const Default = (args) => {
const { buttonAssistiveText, feedbackText, feedbackTimeout, onClick } =
- args?.['bx-copy-button'] ?? {};
+ args?.[`${prefix}-copy-button`] ?? {};
return html`
-
+ @click="${onClick}">
`;
};
@@ -34,7 +35,7 @@ export default {
parameters: {
...storyDocs.parameters,
knobs: {
- 'bx-copy-button': () => ({
+ [`${prefix}-copy-button`]: () => ({
buttonAssistiveText: textNullable(
'Assistive text for the button (button-assistive-text)',
''
diff --git a/web-components/packages/carbon-web-components/src/components/copy-button/copy-button.scss b/web-components/packages/carbon-web-components/src/components/copy-button/copy-button.scss
index d7e744825f5d..7c5e65beca67 100644
--- a/web-components/packages/carbon-web-components/src/components/copy-button/copy-button.scss
+++ b/web-components/packages/carbon-web-components/src/components/copy-button/copy-button.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2019, 2022
+// Copyright IBM Corp. 2019, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,15 +7,10 @@
$css--plex: true !default;
-@import 'carbon-components/scss/components/code-snippet/code-snippet';
-@import 'carbon-components/scss/components/copy-button/copy-button';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/components/copy-button/index';
:host(#{$prefix}-copy-button) {
display: inline-flex;
outline: none;
-
- .#{$prefix}--snippet-button .#{$prefix}--btn--copy__feedback {
- left: 50%;
- right: auto;
- }
}
diff --git a/web-components/packages/carbon-web-components/src/components/copy-button/copy-button.ts b/web-components/packages/carbon-web-components/src/components/copy-button/copy-button.ts
index 904ea66bee91..e8d47891619d 100644
--- a/web-components/packages/carbon-web-components/src/components/copy-button/copy-button.ts
+++ b/web-components/packages/carbon-web-components/src/components/copy-button/copy-button.ts
@@ -12,14 +12,12 @@ import { ifDefined } from 'lit/directives/if-defined.js';
import { LitElement, html, TemplateResult } from 'lit';
import { property, customElement } from 'lit/decorators.js';
import Copy16 from '@carbon/icons/lib/copy/16';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import FocusMixin from '../../globals/mixins/focus';
import styles from './copy-button.scss';
-const { prefix } = settings;
-
/**
- * Note: For `` only. The API is subject to change/removal.
+ * Note: For `` only. The API is subject to change/removal.
*
* @param update The callback function that dictates how to update the DOM with new feedback tooltip state.
* @returns A function that shows the feedback tooltip for the given duration.
@@ -42,7 +40,7 @@ export const _createHandleFeedbackTooltip = (
};
/**
- * Note: For `` only. The API is subject to change/removal.
+ * Note: For `` only. The API is subject to change/removal.
*
* @param properties The properties to render.
* @returns The template result for copy button from the given properties.
@@ -52,7 +50,7 @@ export const _renderButton = ({
assistiveText,
feedbackText,
showFeedback = false,
- className = `${prefix}--snippet-button`,
+ className = `${prefix}--copy-btn`,
children = html`
${Copy16({ class: `${prefix}--snippet__icon` })}
`,
@@ -67,7 +65,8 @@ export const _renderButton = ({
}) => {
const feedbackClasses = classMap({
[`${prefix}--btn--copy__feedback`]: true,
- [`${prefix}--btn--copy__feedback--displayed`]: showFeedback,
+ [`${prefix}--assistive-text`]: true,
+ [`${prefix}--copy-btn--animating`]: showFeedback,
});
return html`
@@ -289,14 +287,14 @@ class BXPagination extends FocusMixin(HostListenerMixin(LitElement)) {
}
/**
- * The name of the custom event fired after the current page is changed from ``.
+ * The name of the custom event fired after the current page is changed from ``.
*/
static get eventChangePage() {
return `${prefix}-pages-select-changed`;
}
/**
- * The name of the custom event fired after the number of rows per page is changed from ``.
+ * The name of the custom event fired after the number of rows per page is changed from ``.
*/
static get eventChangePageSize() {
return `${prefix}-page-sizes-select-changed`;
diff --git a/web-components/packages/carbon-web-components/src/components/progress-indicator/defs.ts b/web-components/packages/carbon-web-components/src/components/progress-indicator/defs.ts
index 35eb7bd109b2..f743d45456b5 100644
--- a/web-components/packages/carbon-web-components/src/components/progress-indicator/defs.ts
+++ b/web-components/packages/carbon-web-components/src/components/progress-indicator/defs.ts
@@ -1,7 +1,7 @@
/**
* @license
*
- * Copyright IBM Corp. 2020
+ * Copyright IBM Corp. 2020, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
@@ -12,9 +12,9 @@
*/
export enum PROGRESS_STEP_STAT {
/**
- * One for future execution.
+ * Complete one.
*/
- QUEUED = 'queued',
+ COMPLETE = 'complete',
/**
* One that is being executed now.
@@ -22,9 +22,9 @@ export enum PROGRESS_STEP_STAT {
CURRENT = 'current',
/**
- * Complete one.
+ * One for future execution.
*/
- COMPLETE = 'complete',
+ INCOMPLETE = 'incomplete',
/**
* Invalid one.
diff --git a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator-skeleton.ts b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator-skeleton.ts
index 9f0cfb2be186..90b021c889c2 100644
--- a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator-skeleton.ts
+++ b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator-skeleton.ts
@@ -9,13 +9,11 @@
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import { forEach } from '../../globals/internal/collection-helpers';
import BXProgressStepSkeleton from './progress-step-skeleton';
import styles from './progress-indicator.scss';
-const { prefix } = settings;
-
/**
* Skeleton of progress indicator.
*/
diff --git a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator-story.ts b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator-story.ts
index 607ffa711547..9c94745e53fd 100644
--- a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator-story.ts
@@ -8,50 +8,46 @@
*/
import { html } from 'lit';
+import { ifDefined } from 'lit/directives/if-defined.js';
import { boolean } from '@storybook/addon-knobs';
import textNullable from '../../../.storybook/knob-text-nullable';
-import { ifDefined } from 'lit/directives/if-defined.js';
import './progress-indicator';
import './progress-step';
import './progress-indicator-skeleton';
import './progress-step-skeleton';
import storyDocs from './progress-indicator-story.mdx';
+import { prefix } from '../../globals/settings';
export const Default = (args) => {
- const { vertical } = args?.['bx-progress-indicator'] ?? {};
- const { iconLabel, labelText, secondaryLabelText } =
- args?.['bx-progress-step'] ?? {};
+ const { vertical } = args?.[`${prefix}-progress-indicator`] ?? {};
+ const { iconLabel, secondaryLabelText } =
+ args?.[`${prefix}-progress-step`] ?? {};
return html`
-
-
+
-
+
-
+
-
+
-
+
-
+ label-text="Fifth step"
+ state="incomplete">
+
`;
};
@@ -59,12 +55,11 @@ Default.storyName = 'Default';
Default.parameters = {
knobs: {
- 'bx-progress-indicator': () => ({
+ [`${prefix}-progress-indicator`]: () => ({
vertical: boolean('Vertical (vertical)', false),
}),
- 'bx-progress-step': () => ({
+ [`${prefix}-progress-step`]: () => ({
iconLabel: textNullable('Icon label (icon-label)', ''),
- labelText: textNullable('Primary label text (label-text)', 'Label'),
secondaryLabelText: textNullable(
'Secondary label text (secondary-label-text)',
'Secondary label'
@@ -74,13 +69,13 @@ Default.parameters = {
};
export const skeleton = (args) => {
- const { vertical } = args?.['bx-progress-indicator-skeleton'];
+ const { vertical } = args?.[`${prefix}-progress-indicator-skeleton`];
return html`
-
-
-
-
-
+
+
+
+
+
`;
};
@@ -89,7 +84,7 @@ skeleton.parameters = {
skip: true,
},
knobs: {
- 'bx-progress-indicator-skeleton': () => ({
+ [`${prefix}-progress-indicator-skeleton`]: () => ({
vertical: boolean('Vertical (vertical)', false),
}),
},
diff --git a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator.scss b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator.scss
index f1b9fda399da..344baf486dd5 100644
--- a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator.scss
+++ b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2019, 2022
+// Copyright IBM Corp. 2019, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,7 +7,14 @@
$css--plex: true !default;
-@import 'carbon-components/scss/components/progress-indicator/progress-indicator';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/spacing' as *;
+@use '@carbon/styles/scss/theme' as *;
+@use '@carbon/styles/scss/utilities/skeleton' as *;
+@use '@carbon/styles/scss/components/progress-indicator/progress-indicator' as *;
+
+// https://github.com/carbon-design-system/carbon/issues/11408
+@include progress-indicator;
:host(#{$prefix}-progress-indicator),
:host(#{$prefix}-progress-indicator-skeleton) {
@@ -26,8 +33,8 @@ $css--plex: true !default;
outline: none;
- // Carbon core style has hard-coded width whose value is the same as `.bx--progress-step`.
- // We override it so changing width of `` automatically changes the width here.
+ // Carbon core style has hard-coded width whose value is the same as `.#{$prefix}--progress-step`.
+ // We override it so changing width of `<#{$prefix}-progress-step>` automatically changes the width here.
// https://github.com/carbon-design-system/carbon-web-components/issues/325
.#{$prefix}--progress-line {
width: 100%;
@@ -41,7 +48,7 @@ $css--plex: true !default;
:host(#{$prefix}-progress-step[vertical]),
:host(#{$prefix}-progress-step-skeleton[vertical]) {
display: list-item;
- min-height: 6rem;
+ min-height: $spacing-12;
width: initial;
min-width: initial;
@@ -83,16 +90,24 @@ $css--plex: true !default;
:host(#{$prefix}-progress-step[state='current']) {
@extend .#{$prefix}--progress-step--current;
+
+ svg {
+ fill: $interactive;
+ }
}
:host(#{$prefix}-progress-step[state='complete']) {
@extend .#{$prefix}--progress-step--complete;
svg {
- fill: $interactive-01;
+ fill: $interactive;
}
}
+:host(#{$prefix}-progress-step[state='incomplete']) {
+ @extend .#{$prefix}--progress-step--incomplete;
+}
+
:host(#{$prefix}-progress-step-skeleton) .#{$prefix}--progress-label {
@include skeleton;
@@ -102,10 +117,10 @@ $css--plex: true !default;
:host(#{$prefix}-progress-step-skeleton) {
svg {
- fill: $ui-05;
+ fill: $layer-selected-inverse;
}
.#{$prefix}--progress-line {
- background-color: $ui-03;
+ background-color: $layer-accent-01;
}
}
diff --git a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator.ts b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator.ts
index 188b9745a476..3036a126b0e8 100644
--- a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator.ts
+++ b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-indicator.ts
@@ -9,17 +9,15 @@
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import { forEach } from '../../globals/internal/collection-helpers';
import BXProgressStep from './progress-step';
import styles from './progress-indicator.scss';
-const { prefix } = settings;
-
/**
* Progress indicator.
*
- * @element bx-progress-indicator
+ * @element cds-progress-indicator
*/
@customElement(`${prefix}-progress-indicator`)
class BXProgressIndicator extends LitElement {
diff --git a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-step-skeleton.ts b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-step-skeleton.ts
index 1494df4463de..41c63ee86e83 100644
--- a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-step-skeleton.ts
+++ b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-step-skeleton.ts
@@ -9,11 +9,9 @@
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import styles from './progress-indicator.scss';
-const { prefix } = settings;
-
/**
* Skeleton of progress step.
*/
diff --git a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-step.ts b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-step.ts
index 61f394f21364..ee64bd6d8233 100644
--- a/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-step.ts
+++ b/web-components/packages/carbon-web-components/src/components/progress-indicator/progress-step.ts
@@ -7,58 +7,33 @@
* LICENSE file in the root directory of this source tree.
*/
-import { LitElement, html, svg, SVGTemplateResult } from 'lit';
+import { LitElement, html, svg } from 'lit';
import { property, customElement } from 'lit/decorators.js';
import CheckmarkOutline16 from '@carbon/icons/lib/checkmark--outline/16';
+import CircleDash16 from '@carbon/icons/lib/circle-dash/16';
+import Incomplete16 from '@carbon/icons/lib/incomplete/16';
import Warning16 from '@carbon/icons/lib/warning/16';
-import settings from 'carbon-components/es/globals/js/settings';
-import spread from '../../globals/directives/spread';
+import { prefix } from '../../globals/settings';
import FocusMixin from '../../globals/mixins/focus';
import { PROGRESS_STEP_STAT } from './defs';
import styles from './progress-indicator.scss';
export { PROGRESS_STEP_STAT };
-const { prefix } = settings;
-
/**
* Icons, keyed by state.
*/
const icons = {
- [PROGRESS_STEP_STAT.QUEUED]: ({
- children,
- attrs = {},
- }: {
- children?: SVGTemplateResult;
- attrs?: { [key: string]: string };
- } = {}) =>
- svg`
-
- `,
- [PROGRESS_STEP_STAT.CURRENT]: ({
- children,
- attrs = {},
- }: {
- children?: SVGTemplateResult;
- attrs?: { [key: string]: string };
- } = {}) =>
- svg`
-
- `,
[PROGRESS_STEP_STAT.COMPLETE]: CheckmarkOutline16,
+ [PROGRESS_STEP_STAT.INCOMPLETE]: CircleDash16,
[PROGRESS_STEP_STAT.INVALID]: Warning16,
+ [PROGRESS_STEP_STAT.CURRENT]: Incomplete16,
};
/**
* Progress step.
*
- * @element bx-progress-step
+ * @element cds-progress-step
* @slot secondary-label-text - The secondary progress label.
*/
@customElement(`${prefix}-progress-step`)
@@ -91,7 +66,7 @@ class BXProgressStep extends FocusMixin(LitElement) {
* The progress state.
*/
@property()
- state = PROGRESS_STEP_STAT.QUEUED;
+ state = PROGRESS_STEP_STAT.INCOMPLETE;
/**
* `true` if the progress step should be vertical.
diff --git a/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-group.ts b/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-group.ts
index 82f7219306fc..9f2305a78375 100644
--- a/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-group.ts
+++ b/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-group.ts
@@ -9,7 +9,7 @@
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import FormMixin from '../../globals/mixins/form';
import HostListenerMixin from '../../globals/mixins/host-listener';
import HostListener from '../../globals/decorators/host-listener';
@@ -20,13 +20,11 @@ import styles from './radio-button.scss';
export { RADIO_BUTTON_ORIENTATION };
-const { prefix } = settings;
-
/**
* Radio button group.
*
- * @element bx-radio-button-group
- * @fires bx-radio-button-group-changed - The custom event fired after this radio button group changes its selected item.
+ * @element cds-radio-button-group
+ * @fires cds-radio-button-group-changed - The custom event fired after this radio button group changes its selected item.
*/
@customElement(`${prefix}-radio-button-group`)
class BXRadioButtonGroup extends FormMixin(HostListenerMixin(LitElement)) {
diff --git a/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-skeleton.ts b/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-skeleton.ts
index e34d3b71bb7f..ebb6b3889fcb 100644
--- a/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-skeleton.ts
+++ b/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-skeleton.ts
@@ -9,11 +9,9 @@
import { LitElement, html } from 'lit';
import { customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import styles from './radio-button.scss';
-const { prefix } = settings;
-
/**
* Skeleton of radio button.
*/
diff --git a/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-story.ts b/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-story.ts
index 1c7a1377278d..1d299271a932 100644
--- a/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/radio-button/radio-button-story.ts
@@ -8,10 +8,11 @@
*/
import { html } from 'lit';
+import { ifDefined } from 'lit/directives/if-defined.js';
import { action } from '@storybook/addon-actions';
import { boolean, select } from '@storybook/addon-knobs';
import textNullable from '../../../.storybook/knob-text-nullable';
-import { ifDefined } from 'lit/directives/if-defined.js';
+import { prefix } from '../../globals/settings';
import { RADIO_BUTTON_ORIENTATION } from './radio-button-group';
import { RADIO_BUTTON_LABEL_POSITION } from './radio-button';
import './radio-button-skeleton';
@@ -33,29 +34,29 @@ const labelPositions = {
export const Default = (args) => {
const { disabled, labelPosition, orientation, name, value, onChange } =
- args?.['bx-radio-button-group'] ?? {};
- const { hideLabel, labelText } = args?.['bx-radio-button'] ?? {};
+ args?.[`${prefix}-radio-button-group`] ?? {};
+ const { hideLabel, labelText } = args?.[`${prefix}-radio-button`] ?? {};
return html`
-
-
+
-
+
-
+
-
+ value="staging">
+
`;
};
@@ -63,7 +64,7 @@ Default.storyName = 'Default';
Default.parameters = {
knobs: {
- 'bx-radio-button-group': () => ({
+ [`${prefix}-radio-button-group`]: () => ({
disabled: boolean('Disabled (disabled)', false),
labelPosition: select(
'Label position (label-position)',
@@ -77,9 +78,9 @@ Default.parameters = {
),
name: textNullable('Name (name)', 'radio-group'),
value: textNullable('Value (value)', ''),
- onChange: action('bx-radio-button-group-changed'),
+ onChange: action(`${prefix}-radio-button-group-changed`),
}),
- 'bx-radio-button': () => ({
+ [`${prefix}-radio-button`]: () => ({
hideLabel: boolean('Hide label (hide-label)', false),
labelText: textNullable('Label text (label-text)', 'Radio button'),
}),
@@ -87,7 +88,7 @@ Default.parameters = {
};
export const skeleton = () =>
- html` `;
+ html` `;
skeleton.parameters = {
percy: {
diff --git a/web-components/packages/carbon-web-components/src/components/radio-button/radio-button.scss b/web-components/packages/carbon-web-components/src/components/radio-button/radio-button.scss
index ddd87ef8537d..069e373e9573 100644
--- a/web-components/packages/carbon-web-components/src/components/radio-button/radio-button.scss
+++ b/web-components/packages/carbon-web-components/src/components/radio-button/radio-button.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2019, 2022
+// Copyright IBM Corp. 2019, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,9 +7,15 @@
$css--plex: true !default;
-@import 'carbon-components/scss/globals/scss/css--helpers';
-@import 'carbon-components/scss/components/form/form';
-@import 'carbon-components/scss/components/radio-button/radio-button';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/theme' as *;
+@use '@carbon/styles/scss/spacing' as *;
+@use '@carbon/styles/scss/utilities';
+@use '@carbon/styles/scss/components/form';
+@use '@carbon/styles/scss/components/radio-button/radio-button' as *;
+
+// https://github.com/carbon-design-system/carbon/issues/11408
+@include radio-button;
:host(#{$prefix}-radio-button-group) {
@extend .#{$prefix}--radio-button-group;
@@ -40,15 +46,15 @@ $css--plex: true !default;
:host(#{$prefix}-radio-button[disabled]) {
.#{$prefix}--radio-button__label {
- color: $disabled;
+ color: $text-disabled;
cursor: not-allowed;
}
.#{$prefix}--radio-button__appearance {
- border-color: $disabled;
+ border-color: $border-disabled;
&::before {
- background-color: $disabled;
+ background-color: $border-disabled;
}
}
}
@@ -60,6 +66,6 @@ $css--plex: true !default;
.#{$prefix}--radio-button__appearance {
margin-right: 0;
- margin-left: $carbon--spacing-03;
+ margin-left: $spacing-03;
}
}
diff --git a/web-components/packages/carbon-web-components/src/components/radio-button/radio-button.ts b/web-components/packages/carbon-web-components/src/components/radio-button/radio-button.ts
index cfab6181c372..ea4075f4b275 100644
--- a/web-components/packages/carbon-web-components/src/components/radio-button/radio-button.ts
+++ b/web-components/packages/carbon-web-components/src/components/radio-button/radio-button.ts
@@ -10,7 +10,7 @@
import { classMap } from 'lit/directives/class-map.js';
import { LitElement, html } from 'lit';
import { property, customElement, query } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import { ifDefined } from 'lit/directives/if-defined.js';
import HostListener from '../../globals/decorators/host-listener';
import FocusMixin from '../../globals/mixins/focus';
@@ -24,8 +24,6 @@ import styles from './radio-button.scss';
export { RADIO_BUTTON_LABEL_POSITION };
-const { prefix } = settings;
-
/**
* Map of navigation direction by key for horizontal alignment.
*/
@@ -103,8 +101,8 @@ class RadioButtonDelegate implements ManagedRadioButtonDelegate {
/**
* Radio button.
*
- * @element bx-radio-button
- * @fires bx-radio-button-changed - The custom event fired after this radio button changes its checked state.
+ * @element cds-radio-button
+ * @fires cds-radio-button-changed - The custom event fired after this radio button changes its checked state.
*/
@customElement(`${prefix}-radio-button`)
class BXRadioButton extends HostListenerMixin(FocusMixin(LitElement)) {
diff --git a/web-components/packages/carbon-web-components/src/components/search/search-skeleton.ts b/web-components/packages/carbon-web-components/src/components/search/search-skeleton.ts
index 6ef5ad63ff07..992bbecfe60b 100644
--- a/web-components/packages/carbon-web-components/src/components/search/search-skeleton.ts
+++ b/web-components/packages/carbon-web-components/src/components/search/search-skeleton.ts
@@ -9,12 +9,10 @@
import { LitElement, html } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import { INPUT_SIZE } from '../input/input';
import styles from './search.scss';
-const { prefix } = settings;
-
/**
* Skeleton of search.
*/
diff --git a/web-components/packages/carbon-web-components/src/components/search/search-story.ts b/web-components/packages/carbon-web-components/src/components/search/search-story.ts
index da78e7842268..f9be49c4f18f 100644
--- a/web-components/packages/carbon-web-components/src/components/search/search-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/search/search-story.ts
@@ -8,14 +8,15 @@
*/
import { html } from 'lit';
+import { ifDefined } from 'lit/directives/if-defined.js';
import { action } from '@storybook/addon-actions';
import { boolean, select } from '@storybook/addon-knobs';
import textNullable from '../../../.storybook/knob-text-nullable';
-import { ifDefined } from 'lit/directives/if-defined.js';
import { INPUT_SIZE } from '../input/input';
import { SEARCH_COLOR_SCHEME } from './search';
import './search-skeleton';
import storyDocs from './search-story.mdx';
+import { prefix } from '../../globals/settings';
const colorSchemes = {
[`Regular`]: null,
@@ -25,7 +26,7 @@ const colorSchemes = {
const sizes = {
'Regular size': null,
[`Small size (${INPUT_SIZE.SMALL})`]: INPUT_SIZE.SMALL,
- [`Extra large size (${INPUT_SIZE.EXTRA_LARGE})`]: INPUT_SIZE.EXTRA_LARGE,
+ [`Large size (${INPUT_SIZE.LARGE})`]: INPUT_SIZE.LARGE,
};
export const Default = (args) => {
@@ -40,9 +41,9 @@ export const Default = (args) => {
type,
value,
onInput,
- } = args?.['bx-search'] ?? {};
+ } = args?.[`${prefix}-search`] ?? {};
return html`
- {
size="${ifDefined(size)}"
type="${ifDefined(type)}"
value="${ifDefined(value)}"
- @bx-search-input="${onInput}">
+ @cds-search-input="${onInput}">
`;
};
@@ -60,7 +61,7 @@ Default.storyName = 'Default';
Default.parameters = {
knobs: {
- 'bx-search': () => ({
+ [`${prefix}-search`]: () => ({
closeButtonAssistiveText: textNullable(
'The label text for the close button (close-button-assistive-text)',
'Clear search input'
@@ -70,15 +71,16 @@ Default.parameters = {
labelText: textNullable('Label text (label-text)', 'Search'),
name: textNullable('Name (name)', ''),
placeholder: textNullable('Placeholder text (placeholder)', ''),
- size: select('Searh size (size)', sizes, null),
+ size: select('Search size (size)', sizes, null),
type: textNullable('The type of the (type)', ''),
value: textNullable('Value (value)', ''),
- onInput: action('bx-search-input'),
+ onInput: action(`${prefix}-search-input`),
}),
},
};
-export const skeleton = () => html` `;
+export const skeleton = () =>
+ html` `;
skeleton.parameters = {
percy: {
diff --git a/web-components/packages/carbon-web-components/src/components/search/search.scss b/web-components/packages/carbon-web-components/src/components/search/search.scss
index 61382d74e624..54327cb9a8e1 100644
--- a/web-components/packages/carbon-web-components/src/components/search/search.scss
+++ b/web-components/packages/carbon-web-components/src/components/search/search.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2019, 2022
+// Copyright IBM Corp. 2019, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,9 +7,13 @@
$css--plex: true !default;
-@import 'carbon-components/scss/globals/scss/helper-mixins';
-@import 'carbon-components/scss/components/form/form';
-@import 'carbon-components/scss/components/search/search';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/utilities' as *;
+@use '@carbon/styles/scss/components/form';
+@use '@carbon/styles/scss/components/search' as *;
+
+// https://github.com/carbon-design-system/carbon/issues/11408
+@include search;
:host(#{$prefix}-search),
:host(#{$prefix}-search-skeleton) {
@@ -32,10 +36,11 @@ $css--plex: true !default;
@extend .#{$prefix}--search--lg;
}
-:host(#{$prefix}-search[size='xl']),
-:host(#{$prefix}-search-skeleton[size='xl']) {
- @extend .#{$prefix}--search--xl;
-}
+// TODO: deprecate
+// :host(#{$prefix}-search[size='xl']),
+// :host(#{$prefix}-search-skeleton[size='xl']) {
+// @extend .#{$prefix}--search--xl;
+// }
:host(#{$prefix}-search[color-scheme='light']) {
@extend .#{$prefix}--search--light;
diff --git a/web-components/packages/carbon-web-components/src/components/search/search.ts b/web-components/packages/carbon-web-components/src/components/search/search.ts
index 25bc8222ea50..fe3412bc125e 100644
--- a/web-components/packages/carbon-web-components/src/components/search/search.ts
+++ b/web-components/packages/carbon-web-components/src/components/search/search.ts
@@ -13,7 +13,7 @@ import { property, customElement } from 'lit/decorators.js';
import Close16 from '@carbon/icons/lib/close/16';
import Close20 from '@carbon/icons/lib/close/20';
import Search16 from '@carbon/icons/lib/search/16';
-import settings from 'carbon-components/es/globals/js/settings';
+import { prefix } from '../../globals/settings';
import ifNonEmpty from '../../globals/directives/if-non-empty';
import FocusMixin from '../../globals/mixins/focus';
import FormMixin from '../../globals/mixins/form';
@@ -23,18 +23,16 @@ import styles from './search.scss';
export { SEARCH_COLOR_SCHEME };
-const { prefix } = settings;
-
/**
* Search box.
*
- * @element bx-search
+ * @element cds-search
* @csspart search-icon The search icon.
* @csspart label-text The label text.
* @csspart input The input box.
* @csspart close-button The close button.
* @csspart close-icon The close icon.
- * @fires bx-search-input - The custom event fired after the search content is changed upon a user gesture.
+ * @fires cds-search-input - The custom event fired after the search content is changed upon a user gesture.
*/
@customElement(`${prefix}-search`)
class BXSearch extends FocusMixin(FormMixin(LitElement)) {
diff --git a/web-components/packages/carbon-web-components/src/components/select/select-item-group.ts b/web-components/packages/carbon-web-components/src/components/select/select-item-group.ts
index 85ae342750a3..2d5b5986ac64 100644
--- a/web-components/packages/carbon-web-components/src/components/select/select-item-group.ts
+++ b/web-components/packages/carbon-web-components/src/components/select/select-item-group.ts
@@ -9,14 +9,12 @@
import { LitElement } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
-
-const { prefix } = settings;
+import { prefix } from '../../globals/settings';
/**
* An option group in select box.
*
- * @element bx-select-item-group
+ * @element cds-select-item-group
*/
@customElement(`${prefix}-select-item-group`)
class BXSelectItemGroup extends LitElement {
diff --git a/web-components/packages/carbon-web-components/src/components/select/select-item.ts b/web-components/packages/carbon-web-components/src/components/select/select-item.ts
index 6f74d2c4ecf7..b6d08c7ec184 100644
--- a/web-components/packages/carbon-web-components/src/components/select/select-item.ts
+++ b/web-components/packages/carbon-web-components/src/components/select/select-item.ts
@@ -9,14 +9,12 @@
import { LitElement } from 'lit';
import { property, customElement } from 'lit/decorators.js';
-import settings from 'carbon-components/es/globals/js/settings';
-
-const { prefix } = settings;
+import { prefix } from '../../globals/settings';
/**
* An option in select box.
*
- * @element bx-select-item
+ * @element cds-select-item
*/
@customElement(`${prefix}-select-item`)
class BXSelectItem extends LitElement {
diff --git a/web-components/packages/carbon-web-components/src/components/select/select-story.ts b/web-components/packages/carbon-web-components/src/components/select/select-story.ts
index b9844e1180a7..ac1b16fecd6e 100644
--- a/web-components/packages/carbon-web-components/src/components/select/select-story.ts
+++ b/web-components/packages/carbon-web-components/src/components/select/select-story.ts
@@ -8,13 +8,14 @@
*/
import { html } from 'lit';
+import { ifDefined } from 'lit/directives/if-defined.js';
import { action } from '@storybook/addon-actions';
import { boolean, select } from '@storybook/addon-knobs';
import textNullable from '../../../.storybook/knob-text-nullable';
// Below path will be there when an application installs `carbon-web-components` package.
// In our dev env, we auto-generate the file and re-map below path to to point to the generated file.
// @ts-ignore
-import { ifDefined } from 'lit/directives/if-defined.js';
+import { prefix } from '../../globals/settings';
import { INPUT_COLOR_SCHEME, INPUT_SIZE } from '../input/input';
import './select';
import storyDocs from './select-story.mdx';
@@ -44,20 +45,20 @@ export const Default = (args) => {
validityMessage,
value,
children = html`
-
- Option 1
- Option 2
-
-
- Option 3
- Option 4
- Option 5
-
+
+ Option 1
+ Option 2
+
+
+ Option 3
+ Option 4
+ Option 5
+
`,
onInput,
- } = args?.['bx-select'] ?? {};
+ } = args?.[`${prefix}-select`] ?? {};
return html`
- {
size="${ifDefined(size)}"
validity-message="${ifDefined(validityMessage)}"
value="${ifDefined(value)}"
- @bx-select-selected="${ifDefined(onInput)}">
+ @cds-select-selected="${ifDefined(onInput)}">
${children}
-
+
`;
};
Default.parameters = {
knobs: {
- 'bx-select': () => ({
+ [`${prefix}-select`]: () => ({
colorScheme: select('Color scheme (color-scheme)', colorSchemes, null),
disabled: boolean('Disabled (disabled)', false),
helperText: textNullable(
@@ -96,7 +97,7 @@ Default.parameters = {
''
),
value: textNullable('The value of the selected item (value)', ''),
- onInput: action('bx-select-selected'),
+ onInput: action(`${prefix}-select-selected`),
}),
},
};
diff --git a/web-components/packages/carbon-web-components/src/components/select/select.scss b/web-components/packages/carbon-web-components/src/components/select/select.scss
index c9d6dfb95f14..b7d8d7fec7e5 100644
--- a/web-components/packages/carbon-web-components/src/components/select/select.scss
+++ b/web-components/packages/carbon-web-components/src/components/select/select.scss
@@ -1,5 +1,5 @@
//
-// Copyright IBM Corp. 2020, 2022
+// Copyright IBM Corp. 2020, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
@@ -7,7 +7,8 @@
$css--plex: true !default;
-@import 'carbon-components/scss/components/select/select';
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/components/select';
:host(#{$prefix}-select) {
@extend .#{$prefix}--select;
diff --git a/web-components/packages/carbon-web-components/src/components/select/select.ts b/web-components/packages/carbon-web-components/src/components/select/select.ts
index 4b0c8253e46b..82b59956c167 100644
--- a/web-components/packages/carbon-web-components/src/components/select/select.ts
+++ b/web-components/packages/carbon-web-components/src/components/select/select.ts
@@ -10,9 +10,9 @@
import { LitElement, html } from 'lit';
import { property, customElement, query } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
-import settings from 'carbon-components/es/globals/js/settings';
import ChevronDown16 from '@carbon/icons/lib/chevron--down/16';
import WarningFilled16 from '@carbon/icons/lib/warning--filled/16';
+import { prefix } from '../../globals/settings';
import { FORM_ELEMENT_COLOR_SCHEME } from '../../globals/shared-enums';
import { ifDefined } from 'lit/directives/if-defined.js';
import FormMixin from '../../globals/mixins/form';
@@ -23,12 +23,10 @@ import styles from './select.scss';
export { FORM_ELEMENT_COLOR_SCHEME as SELECT_COLOR_SCHEME } from '../../globals/shared-enums';
-const { prefix } = settings;
-
/**
* Select box.
*
- * @element bx-select
+ * @element cds-select
* @slot helper-text - The helper text.
* @slot label-text - The label text.
* @slot validity-message - The validity message. If present and non-empty, this input shows the UI of its invalid state.
@@ -74,10 +72,10 @@ class BXSelect extends ValidityMixin(FormMixin(LitElement)) {
}
/**
- * Handles DOM mutation of `` or `` put in ``, or their changes.
- * In such event, `` creates the corresponding `