diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb04497cec83..bf693319a3b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' - name: Run yarn dedupe @@ -23,7 +23,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' - name: Install dependencies @@ -36,7 +36,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' - name: Install dependencies @@ -51,7 +51,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' - uses: actions/cache@v2.1.6 @@ -67,7 +67,7 @@ jobs: run: yarn build --ignore '@carbon/sketch' - name: Check generated styles run: | - yarn carbon-cli check --ignore '**/@(node_modules|examples|components|react|fixtures)/**' 'packages/**/*.scss' + yarn carbon-cli check --ignore '**/@(node_modules|examples|components|react|fixtures|compat)/**' 'packages/**/*.scss' - name: Run tests run: yarn test --ci @@ -77,7 +77,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' - uses: actions/cache@v2.1.6 @@ -113,7 +113,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' - uses: actions/cache@v2.1.6 diff --git a/.github/workflows/deploy-react-storybook.yml b/.github/workflows/deploy-react-storybook.yml index 477c1c3fd66f..118234f0f50e 100644 --- a/.github/workflows/deploy-react-storybook.yml +++ b/.github/workflows/deploy-react-storybook.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@main - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' - name: Install dependencies diff --git a/.github/workflows/deploy-vanilla-devenv.yml b/.github/workflows/deploy-vanilla-devenv.yml index 697788e55166..e4a33abb801f 100644 --- a/.github/workflows/deploy-vanilla-devenv.yml +++ b/.github/workflows/deploy-vanilla-devenv.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@main - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' - name: Install dependencies diff --git a/.github/workflows/nightly-release.yml b/.github/workflows/nightly-release.yml index 402f86977879..218610f88849 100644 --- a/.github/workflows/nightly-release.yml +++ b/.github/workflows/nightly-release.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@main - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' - name: Install dependencies diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b475e8ddb0eb..3e5819804f1c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v1 - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' registry-url: 'https://registry.npmjs.org' diff --git a/.github/workflows/sync-generated-files.yml b/.github/workflows/sync-generated-files.yml index dc2f4dcaec22..7cc6ff913889 100644 --- a/.github/workflows/sync-generated-files.yml +++ b/.github/workflows/sync-generated-files.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Use Node.js 14.x - uses: actions/setup-node@v2.2.0 + uses: actions/setup-node@v2.3.0 with: node-version: '14.x' - name: Install dependencies diff --git a/.yarn/cache/@cypress-listr-verbose-renderer-npm-0.4.1-87829e7b0f-0169c2b30f.zip b/.yarn/cache/@cypress-listr-verbose-renderer-npm-0.4.1-87829e7b0f-0169c2b30f.zip deleted file mode 100644 index 2f7a9af25368..000000000000 Binary files a/.yarn/cache/@cypress-listr-verbose-renderer-npm-0.4.1-87829e7b0f-0169c2b30f.zip and /dev/null differ diff --git a/.yarn/cache/@es-joy-jsdoccomment-npm-0.10.2-99ab396701-5790d13b74.zip b/.yarn/cache/@es-joy-jsdoccomment-npm-0.10.2-99ab396701-5790d13b74.zip new file mode 100644 index 000000000000..28c11adab769 Binary files /dev/null and b/.yarn/cache/@es-joy-jsdoccomment-npm-0.10.2-99ab396701-5790d13b74.zip differ diff --git a/.yarn/cache/@es-joy-jsdoccomment-npm-0.8.0-alpha.2-d987641165-cb6b06a836.zip b/.yarn/cache/@es-joy-jsdoccomment-npm-0.8.0-alpha.2-d987641165-cb6b06a836.zip deleted file mode 100644 index 90bbf7a7139f..000000000000 Binary files a/.yarn/cache/@es-joy-jsdoccomment-npm-0.8.0-alpha.2-d987641165-cb6b06a836.zip and /dev/null differ diff --git a/.yarn/cache/@rollup-plugin-node-resolve-npm-13.0.0-c6322a1c60-c0237e65f5.zip b/.yarn/cache/@rollup-plugin-node-resolve-npm-13.0.0-c6322a1c60-c0237e65f5.zip new file mode 100644 index 000000000000..edb81241b5bd Binary files /dev/null and b/.yarn/cache/@rollup-plugin-node-resolve-npm-13.0.0-c6322a1c60-c0237e65f5.zip differ diff --git a/.yarn/cache/cli-truncate-npm-2.1.0-72184d3467-bf1e4e6195.zip b/.yarn/cache/cli-truncate-npm-2.1.0-72184d3467-bf1e4e6195.zip new file mode 100644 index 000000000000..f8c20f365145 Binary files /dev/null and b/.yarn/cache/cli-truncate-npm-2.1.0-72184d3467-bf1e4e6195.zip differ diff --git a/.yarn/cache/comment-parser-npm-1.1.5-8a063d6f6a-e669d6328a.zip b/.yarn/cache/comment-parser-npm-1.1.5-8a063d6f6a-e669d6328a.zip deleted file mode 100644 index 5c447a7f7c27..000000000000 Binary files a/.yarn/cache/comment-parser-npm-1.1.5-8a063d6f6a-e669d6328a.zip and /dev/null differ diff --git a/.yarn/cache/comment-parser-npm-1.2.1-2743575765-3057a7304c.zip b/.yarn/cache/comment-parser-npm-1.2.1-2743575765-3057a7304c.zip new file mode 100644 index 000000000000..3c7abf77ad16 Binary files /dev/null and b/.yarn/cache/comment-parser-npm-1.2.1-2743575765-3057a7304c.zip differ diff --git a/.yarn/cache/cypress-npm-7.2.0-a9ae77146a-f2b66f1368.zip b/.yarn/cache/cypress-npm-8.0.0-2ee8bff904-6f8444843d.zip similarity index 72% rename from .yarn/cache/cypress-npm-7.2.0-a9ae77146a-f2b66f1368.zip rename to .yarn/cache/cypress-npm-8.0.0-2ee8bff904-6f8444843d.zip index 2dea296941aa..6c197b6a4c43 100644 Binary files a/.yarn/cache/cypress-npm-7.2.0-a9ae77146a-f2b66f1368.zip and b/.yarn/cache/cypress-npm-8.0.0-2ee8bff904-6f8444843d.zip differ diff --git a/.yarn/cache/eslint-plugin-jsdoc-npm-35.3.0-5a1b07e5aa-09141f7407.zip b/.yarn/cache/eslint-plugin-jsdoc-npm-35.3.0-5a1b07e5aa-09141f7407.zip deleted file mode 100644 index 1c55e145ea2f..000000000000 Binary files a/.yarn/cache/eslint-plugin-jsdoc-npm-35.3.0-5a1b07e5aa-09141f7407.zip and /dev/null differ diff --git a/.yarn/cache/eslint-plugin-jsdoc-npm-36.0.3-6a37308396-f15e1d2e1e.zip b/.yarn/cache/eslint-plugin-jsdoc-npm-36.0.3-6a37308396-f15e1d2e1e.zip new file mode 100644 index 000000000000..c65d44f747a7 Binary files /dev/null and b/.yarn/cache/eslint-plugin-jsdoc-npm-36.0.3-6a37308396-f15e1d2e1e.zip differ diff --git a/.yarn/cache/figures-npm-3.1.0-cfd377c3ad-fcd7999c83.zip b/.yarn/cache/figures-npm-3.1.0-cfd377c3ad-fcd7999c83.zip deleted file mode 100644 index b8867a4fc39a..000000000000 Binary files a/.yarn/cache/figures-npm-3.1.0-cfd377c3ad-fcd7999c83.zip and /dev/null differ diff --git a/.yarn/cache/figures-npm-3.2.0-85d357e955-85a6ad29e9.zip b/.yarn/cache/figures-npm-3.2.0-85d357e955-85a6ad29e9.zip new file mode 100644 index 000000000000..eac0ef722622 Binary files /dev/null and b/.yarn/cache/figures-npm-3.2.0-85d357e955-85a6ad29e9.zip differ diff --git a/.yarn/cache/jsdoc-type-pratt-parser-npm-1.0.0-alpha.23-54067d727f-a174d04aee.zip b/.yarn/cache/jsdoc-type-pratt-parser-npm-1.0.0-alpha.23-54067d727f-a174d04aee.zip deleted file mode 100644 index 41a48842e658..000000000000 Binary files a/.yarn/cache/jsdoc-type-pratt-parser-npm-1.0.0-alpha.23-54067d727f-a174d04aee.zip and /dev/null differ diff --git a/.yarn/cache/jsdoc-type-pratt-parser-npm-1.0.4-d9563f414a-f80df71fc5.zip b/.yarn/cache/jsdoc-type-pratt-parser-npm-1.0.4-d9563f414a-f80df71fc5.zip new file mode 100644 index 000000000000..73b8002c3ffc Binary files /dev/null and b/.yarn/cache/jsdoc-type-pratt-parser-npm-1.0.4-d9563f414a-f80df71fc5.zip differ diff --git a/.yarn/cache/listr2-npm-3.10.0-b9e3e588d3-9dc1a89697.zip b/.yarn/cache/listr2-npm-3.10.0-b9e3e588d3-9dc1a89697.zip new file mode 100644 index 000000000000..8a9751a642ee Binary files /dev/null and b/.yarn/cache/listr2-npm-3.10.0-b9e3e588d3-9dc1a89697.zip differ diff --git a/.yarn/cache/log-update-npm-4.0.0-9d0554261c-ae2f85bbab.zip b/.yarn/cache/log-update-npm-4.0.0-9d0554261c-ae2f85bbab.zip new file mode 100644 index 000000000000..66a2c50de738 Binary files /dev/null and b/.yarn/cache/log-update-npm-4.0.0-9d0554261c-ae2f85bbab.zip differ diff --git a/.yarn/cache/slice-ansi-npm-3.0.0-d9999864af-5ec6d022d1.zip b/.yarn/cache/slice-ansi-npm-3.0.0-d9999864af-5ec6d022d1.zip new file mode 100644 index 000000000000..0129e70bff8a Binary files /dev/null and b/.yarn/cache/slice-ansi-npm-3.0.0-d9999864af-5ec6d022d1.zip differ diff --git a/config/eslint-config-carbon/package.json b/config/eslint-config-carbon/package.json index e4e234dd1b4f..8b07935969d9 100644 --- a/config/eslint-config-carbon/package.json +++ b/config/eslint-config-carbon/package.json @@ -39,7 +39,7 @@ "eslint-plugin-cypress": "^2.11.3", "eslint-plugin-import": "^2.23.4", "eslint-plugin-jest": "^24.3.6", - "eslint-plugin-jsdoc": "^35.3.0", + "eslint-plugin-jsdoc": "^36.0.3", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "^7.24.0", diff --git a/config/eslint-config-carbon/plugins/react.js b/config/eslint-config-carbon/plugins/react.js index 772bd1865ec8..2dbc3da652b3 100644 --- a/config/eslint-config-carbon/plugins/react.js +++ b/config/eslint-config-carbon/plugins/react.js @@ -51,6 +51,7 @@ module.exports = { { files: ['*-story.js'], rules: { + 'react/display-name': 0, 'react/prop-types': 0, }, }, diff --git a/docs/guides/setup/windows.md b/docs/guides/setup/windows.md index eb7bc5434735..6f1f5ddcd5ab 100644 --- a/docs/guides/setup/windows.md +++ b/docs/guides/setup/windows.md @@ -31,11 +31,18 @@ but can be unexpected. WSL) - `sudo umount /mnt/c` - `sudo mount -t drvfs C: /mnt/c -o metadata` -12. Change directories into your projects folder +12. Increase Linux OS limits to avoid errors in build process (limited by WSL by + default). + - https://muhammadtriwibowo.medium.com/set-permanently-ulimit-n-open-files-in-ubuntu-4d61064429a + - `ulimit -l 65536` -> Increases the maximum amount of locked memory + available to OS + - `ulimit -n 1048576` -> Increases the maximum amount of files that can be + in an open state +13. Change directories into your projects folder `cd /mnt/c/Users/{username}/projects` (Only an example, use whatever you'd like) -13. Clone our repo +14. Clone our repo `git clone https://github.com/carbon-design-system/carbon.git` -14. In the root folder of your freshly cloned repo install and build +15. In the root folder of your freshly cloned repo install and build - `yarn install` - `yarn build` diff --git a/docs/migration/11.x-color.md b/docs/migration/11.x-color.md new file mode 100644 index 000000000000..39949f8bb075 --- /dev/null +++ b/docs/migration/11.x-color.md @@ -0,0 +1,135 @@ +## Color tokens + + + +**Note:** The Carbon v11 release is currently in beta release. Be on the lookout +for the public preview release available in the coming months. + + + +**Status key:** + +**New:** a net new color token to the system in v11. It has no v10 counterpart. + +**Updated name:** the v10 name has been updated to in v11 to replace the number +ending with a usage adjective. It just a name change the role stays the same +between v10 and v11. + +**Split:** V10 token has been split into multiple v11 tokens for more specific +usage. + +**No change:** token name has no change between versions. + +**Depreciated:** v10 token was removed in v11 + +| **V10 token name** | **V11 token name** | **Status** | +| ------------------ | ------------------------- | ------------------- | +| visited-link | link-visited | Updated name | +| ui-background | background | Updated name | +| ui-05 | layer-selected-inverse | Updated name | +| ui-05 | border-inverse | Updated name | +| ui-04 | border-strong-01 | Split, Updated name | +| ui-04 | toggle-off | Split, Updated name | +| ui-03 | layer-accent-01 | Split, Updated name | +| ui-03 | border-subtle-01 | Split, Updated name | +| ui-02 | layer-02 | Updated name | +| ui-01 | layer-01 | Updated name | +| text-error | text-error | Updated name | +| text-05 | text-helper | Updated name | +| text-04 | text-on-color | Updated name | +| text-03 | text-placeholder | Updated name | +| text-02 | text-secondary | Updated name | +| text-01 | text-primary | Updated name | +| support-04 | support-info | Updated name | +| support-03 | support-warning | Updated name | +| support-02 | support-success | Updated name | +| support-01 | support-error | Updated name | +| skeleton-02 | skeleton-element | Updated name | +| skeleton-01 | skeleton-background | Updated name | +| selected-ui | background-selected | Split, Updated name | +| selected-ui | layer-selected-01 | Split, Updated name | +| selected-light-ui | layer-selected-02 | Updated name | +| overlay-01 | overlay | Updated name | +| link-02 | link-secondary | Updated name | +| link-01 | link-primary | Updated name | +| inverse-support-04 | support-info-inverse | Updated name | +| inverse-support-03 | support-warning-inverse | Updated name | +| inverse-support-02 | support-success-inverse | Updated name | +| inverse-support-01 | support-error-inverse | Updated name | +| inverse-link | link-inverse | Updated name | +| inverse-hover-ui | background-inverse-hover | Updated name | +| inverse-focus-ui | focus-inverse | Updated name | +| inverse-02 | background-inverse | Updated name | +| inverse-01 | text-inverse | Split, Updated name | +| inverse-01 | icon-inverse | Split, Updated name | +| inverse-01 | focus-inset | Split, Updated name | +| interactive-04 | interactive | Updated name | +| interactive-04 | border-interactive | Updated name | +| interactive-03 | button-tertiary | Updated name | +| interactive-02 | button-secondary | Updated name | +| interactive-01 | background-brand | Updated name | +| interactive-01 | button-primary | Updated name | +| icon-03 | icon-on-color | Updated name | +| icon-02 | icon-secondary | Updated name | +| icon-01 | icon-primary | Updated name | +| hover-ui | background-hover | Updated name | +| hover-ui | layer-hover-01 | Split, Updated name | +| hover-ui | field-hover-01 | Split, Updated name | +| hover-ui | field-hover-02 | Split, Updated name | +| hover-tertiary | button-tertiary-hover | Updated name | +| hover-selected-ui | background-selected-hover | Split, Updated name | +| hover-selected-ui | layer-selected-hover-01 | Split, Updated name | +| hover-selected-ui | layer-accent-hover-01 | Split, Updated name | +| hover-secondary | button-secondary-hover | Updated name | +| hover-primary-text | link-primary-hover | Updated name | +| hover-primary | button-primary-hover | Updated name | +| hover-light-ui | layer-hover-02 | Updated name | +| hover-danger | button-danger-hover | Updated name | +| highlight | highlight | No change | +| focus | focus | No change | +| field-02 | field-02 | No change | +| field-01 | field-01 | No change | +| disabled-03 | layer-selected-disabled | Split, Updated name | +| disabled-03 | text-on-color-disabled | Split, Updated name | +| disabled-03 | icon-on-color-disabled | Split, Updated name | +| disabled-02 | text-disabled | Split, Updated name | +| disabled-02 | icon-disabled | Split, Updated name | +| disabled-02 | button-disabled | Split, Updated name | +| disabled-01 | layer-disabled-01 | Split | +| disabled-01 | field-disabled-01 | Split | +| disabled-01 | border-disabled-01 | Split | +| disabled-01 | field-disabled-02 | Split | +| disabled-01 | border-disabled-03 | Split | +| decorative-01 | border-subtle-02 | Updated name | +| danger-02 | button-danger-secondary | Updated name | +| danger / danger-01 | button-danger-primary | Updated name | +| button-separator | button-separator | No change | +| active-ui | background-active | Split, Updated name | +| active-ui | layer-active-01 | Split, Updated name | +| active-ui | layer-accent-active-01 | Split, Updated name | +| active-ui | border-subtle-selected-01 | Split, Updated name | +| active-tertiary | button-tertiary-active | Updated name | +| active-secondary | button-secondary-active | Updated name | +| active-primary | button-primary-active | Updated name | +| active-light-ui | layer-active-02 | Updated name | +| active-danger | button-danger-active | Updated name | +| - | border-subtle-00 | New | +| - | layer-selected-hover-02 | New | +| - | layer-accent-02 | New | +| - | layer-accent-hover-02 | New | +| - | layer-accent-active-02 | New | +| - | border-strong-02 | New | +| - | border-subtle-selected-02 | New | +| - | layer-03 | New | +| - | layer-hover-03 | New | +| - | layer-active-03 | New | +| - | layer-selected-03 | New | +| - | layer-selected-hover-03 | New | +| - | layer-accent-03 | New | +| - | layer-accent-hover-03 | New | +| - | layer-accent-active-03 | New | +| - | field-03 | New | +| - | field-hover-03 | New | +| - | border-strong-03 | New | +| - | border-subtle-03 | New | +| - | border-subtle-selected-03 | New | diff --git a/docs/migration/11.x-grid.md b/docs/migration/11.x-grid.md index e9fcbc1f0dad..1d47319288df 100644 --- a/docs/migration/11.x-grid.md +++ b/docs/migration/11.x-grid.md @@ -1,22 +1,178 @@ # Grid + + + +## Table of Contents + +- [Overview](#overview) +- [Changes](#changes) + - [Configuration](#configuration) + - [Grid](#grid) + - [Row](#row) + - [Column](#column) + - [Breakpoints](#breakpoints) + - [Offset](#offset) + + + **Note: everything in this file is a work-in-progress and will be changed.** +## Overview + +The `@carbon/grid` package has been modified to use a CSS Grid based +implementation, rather than the previous flexbox implementation. + +The grid continues to be integrated into `carbon-components` as well as the new +`@carbon/styles` package. There is no need to install additional packages if you +are using `carbon-components` or `@carbon/styles` already. + ## Changes -| Filename | v10 | v11 | -| ------------------- | ------------------------ | ---------------------------------------- | -| `scss/12.scss` | | Removed | -| `scss/_mixins.scss` | | | -| `scss/_mixins.scss` | `$carbon--aspect-ratios` | Removed, use styles package instead | -| `scss/_mixins.scss` | `@mixin carbon--grid` | | -| `scss/_prefix.scss` | | Removed, use `scss/_config.scss` instead | -| `scss/grid.scss` | | | -| `scss/index.scss` | | | - -Notes - -- The grid now uses 16 columns by default, there is no longer a 12 column mode -- Configure Sass Modules is now done through a `_config.scss` file (for things - like `$prefix`) -- Breakpoints are now defined in `@carbon/grid` +| Filename | v10 | v11 | +| ------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| `scss/12.scss` | | Removed | +| `scss/_mixins.scss` | | | +| `scss/_mixins.scss` | `$carbon--aspect-ratios` | Removed, use styles package instead | +| `scss/_mixins.scss` | `@mixin carbon--grid` | Removed, used mixin from `_css-grid.scss` instead | +| `scss/_prefix.scss` | | Removed, use `scss/_config.scss` instead | +| `scss/grid.scss` | | Renamed to `_css-grid.scss` | +| | | `mixin css-grid` | +| | | `mixin subgrid` | +| | `.#{$prefix}--grid` | `.#{$prefix}--css-grid` | +| | `.#{$prefix}--grid--narrow` | `.#{$prefix}--css-grid--narrow` | +| | `.#{$prefix}--grid--condensed` | `.#{$prefix}--css-grid--condensed` | +| | `.#{$prefix}--row` | Removed, columns should be direct children of grid containers | +| | `.#{$prefix}--col` | `.#{$prefix}--col-span-1` (1-16 available) | +| | `.#{$prefix}--col-#{$breakpoint}-#{$columns}` (e.g. `bx--col-sm-2`) | `.#{$prefix}--#{$breakpoint}:col-span#{$columns}` (e.g. `bx--sm:col-span-2`) | +| | `.#{$prefix}--no-gutter` | `.#{$prefix}--css-grid--no-gutter` | +| | `.#{$prefix}--grid--full-width` | `.#{$prefix}--css-grid--full-width` | +| | `.#{$prefix}--offset-#{$breakpoint}-#{$columns}` (e.g. `bx--offset-sm-3`) | `.#{$prefix}--#{$breakpoint}:col-(start/end)-#{$columns}` (e.g. `bx--sm:col-start-4 bx--sm:col-end-5` and `bx--sm:col-start-4 bx--sm:col-end-5`) | +| | | `.#{$prefix}--hang` | +| | | `.#{$prefix}--gutter` | +| | `.#{$prefix}--hang--left` | `.#{$prefix}--gutter-start` | +| | `.#{$prefix}--hang--right` | `.#{$prefix}--gutter-end` | +| | `.#{$prefix}--hang--start` | `.#{$prefix}--gutter-start` | +| | `.#{$prefix}--hang--end` | `.#{$prefix}--gutter-end` | +| | | `.#{$prefix}--justify-items-start` | +| | | `.#{$prefix}--justify-items-end` | +| | | `.#{$prefix}--justify-items-center` | +| | | `.#{$prefix}--align-items-start` | +| | | `.#{$prefix}--align-items-end` | +| | | `.#{$prefix}--align-items-center` | +| `scss/index.scss` | | | + +### Configuration + +Configuring Sass Modules is now done through a `_config.scss` file (for things +like `$prefix`) + +### Grid + +The base grid definition now includes 16 columns by default. The new +`.#{$prefix}--css-grid` class should be used. + +```diff +-
++
+
+
+
+
+
+
+
+``` + +### Row + +Rows are no longer needed and have been removed. Columns can be placed as direct +children of a grid container. + +```diff +
+-
+
+
+
+
+-
+
+``` + +### Column + +The auto-column functionality has changed. In v10 columns would automatically +expand to fill the available space inside the grid container. A grid with only +two columns, each would span 50% width or 6 columns. + +In v11, each column by default spans one single column as defined by the parent +grid's parameters. + +The default track sizing functions of the grid columns are defined by the +inherited `grid-template-columns` css custom property. This declares that there +should be `--cds-grid-columns` number of columns, and each column should by +default span a `minmax()` of `0` columns minimum, or a maximum of +`--cds-grid-column-size` (`1fr`). + +The values of these custom properties can be changed to modify the default +behavior of columns. + +If you relied on this auto-column behavior, you will now instead need to +explicitly define your column sizing via the `.#{$prefix}--col-span-*` classes. +When migrating, remember the base grid definition now includes 16 columns by +default instead of 12. + +```diff +
+-
+-
+-
+-
++
++
++
++
+
+``` + +### Breakpoints + +The ability to specify different column widths at different breakpoints is still +available. The class names have changed slightly. + +```diff +
+-
++
+

Small: Span 2 of 4

+

Medium: Span 4 of 8

+

Large: Span 6 of 16

+
+
+``` + +> Note: Breakpoints are now defined in `@carbon/grid` + +### Offset + +Offset columns are now explicitly defined via a starting and ending column, +instead of the column size and offset amount. These classes map directly to the +`grid-column-start` and `grid-column-end` properties and their values in regard +to the grid column definition/template. + +```diff +
+-
++
+ +-
++
+ +-
++
+ +-
++
+
+``` diff --git a/packages/carbon-react/.storybook/Welcome/welcome.scss b/packages/carbon-react/.storybook/Welcome/welcome.scss index 79d250880d62..8ae24175c9d9 100644 --- a/packages/carbon-react/.storybook/Welcome/welcome.scss +++ b/packages/carbon-react/.storybook/Welcome/welcome.scss @@ -1,4 +1,3 @@ -// @import '~carbon-components/scss/globals/scss/typography'; @use '@carbon/styles/scss/theme'; @use '@carbon/styles/scss/type'; @@ -19,7 +18,7 @@ .welcome__heading { @include type.type-style('productive-heading-07'); - color: var(--cds-inverse-01); + color: theme.$text-inverse; } .welcome__heading--subtitle { diff --git a/packages/carbon-react/.storybook/styles.scss b/packages/carbon-react/.storybook/styles.scss index 57ceb93e2e68..cb2c6a9b733c 100644 --- a/packages/carbon-react/.storybook/styles.scss +++ b/packages/carbon-react/.storybook/styles.scss @@ -15,6 +15,7 @@ $feature-flags: ( @use '../index.scss' as styles; @use '../scss/components/button'; +@use '../scss/components/tag'; // For now, including all weights for testing @include arabic.all; @@ -22,19 +23,19 @@ $feature-flags: ( @include mono.all; :root { - @include styles.theme(styles.$white, button.$white); + @include styles.theme(styles.$white, button.$white, tag.$white); } [data-carbon-theme='g10'] { - @include styles.theme(styles.$g10, button.$g10); + @include styles.theme(styles.$g10, button.$g10, tag.$g10); } [data-carbon-theme='g90'] { - @include styles.theme(styles.$g90, button.$g90); + @include styles.theme(styles.$g90, button.$g90, tag.$g90); } [data-carbon-theme='g100'] { - @include styles.theme(styles.$g100, button.$g100); + @include styles.theme(styles.$g100, button.$g100, tag.$g100); } html[lang='en'] body { diff --git a/packages/carbon-react/scss/components/_tag.scss b/packages/carbon-react/scss/components/_tag.scss new file mode 100644 index 000000000000..eb889113ae5a --- /dev/null +++ b/packages/carbon-react/scss/components/_tag.scss @@ -0,0 +1,8 @@ +// +// Copyright IBM Corp. 2018, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@forward '@carbon/styles/scss/components/tag'; diff --git a/packages/carbon-react/src/components/ComboBox/ComboBox.stories.js b/packages/carbon-react/src/components/ComboBox/ComboBox.stories.js new file mode 100644 index 000000000000..0b997e2db9d7 --- /dev/null +++ b/packages/carbon-react/src/components/ComboBox/ComboBox.stories.js @@ -0,0 +1,56 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * 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 React from 'react'; +import { ComboBox } from 'carbon-components-react'; + +const items = [ + { + id: 'option-0', + text: + 'An example option that is really long to show what should be done to handle long text', + }, + { + id: 'option-1', + text: 'Option 1', + }, + { + id: 'option-2', + text: 'Option 2', + }, + { + id: 'option-3', + text: 'Option 3', + }, + { + id: 'option-4', + text: 'Option 4', + }, + { + id: 'option-5', + text: 'Option 5', + }, +]; + +export default { + title: 'Components/ComboBox', + component: ComboBox, +}; + +export const Combobox = () => ( +
+ {}} + id="carbon-combobox" + items={items} + itemToString={(item) => (item ? item.text : '')} + placeholder="Filter..." + titleText="ComboBox title" + helperText="Combobox helper text" + /> +
+); diff --git a/packages/carbon-react/src/components/ComboBox/index.js b/packages/carbon-react/src/components/ComboBox/index.js new file mode 100644 index 000000000000..812f8f64edae --- /dev/null +++ b/packages/carbon-react/src/components/ComboBox/index.js @@ -0,0 +1,8 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +export { ComboBox } from 'carbon-components-react'; diff --git a/packages/carbon-react/src/components/Dropdown/Dropdown.stories.js b/packages/carbon-react/src/components/Dropdown/Dropdown.stories.js new file mode 100644 index 000000000000..06fb5251c320 --- /dev/null +++ b/packages/carbon-react/src/components/Dropdown/Dropdown.stories.js @@ -0,0 +1,80 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * 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 React from 'react'; +import { Dropdown, DropdownSkeleton } from 'carbon-components-react'; + +const items = [ + { + id: 'option-0', + text: 'Lorem, ipsum dolor sit amet consectetur adipisicing elit.', + }, + { + id: 'option-1', + text: 'Option 1', + }, + { + id: 'option-2', + text: 'Option 2', + }, + { + id: 'option-3', + text: 'Option 3', + }, + { + id: 'option-4', + text: 'Option 4', + }, + { + id: 'option-5', + text: 'Option 5', + }, +]; + +export default { + title: 'Components/Dropdown', + + parameters: { + component: Dropdown, + + subcomponents: { + DropdownSkeleton, + }, + }, +}; + +export const Default = () => ( +
+ (item ? item.text : '')} + /> +
+); + +export const Inline = () => ( +
+ (item ? item.text : '')} + /> +
+); + +export const Skeleton = () => ( +
+ +
+); diff --git a/packages/carbon-react/src/components/Dropdown/index.js b/packages/carbon-react/src/components/Dropdown/index.js new file mode 100644 index 000000000000..c91a3883d825 --- /dev/null +++ b/packages/carbon-react/src/components/Dropdown/index.js @@ -0,0 +1,8 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +export { Dropdown } from 'carbon-components-react'; diff --git a/packages/carbon-react/src/components/MultiSelect/MultiSelect.stories.js b/packages/carbon-react/src/components/MultiSelect/MultiSelect.stories.js new file mode 100644 index 000000000000..70b0afc23cb2 --- /dev/null +++ b/packages/carbon-react/src/components/MultiSelect/MultiSelect.stories.js @@ -0,0 +1,96 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * 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 React from 'react'; +import { MultiSelect } from 'carbon-components-react'; + +const items = [ + { + id: 'downshift-1-item-0', + text: 'Option 1', + }, + { + id: 'downshift-1-item-1', + text: 'Option 2', + }, + { + id: 'downshift-1-item-2', + text: 'Option 3', + }, + { + id: 'downshift-1-item-3', + text: 'Option 4', + }, + { + id: 'downshift-1-item-4', + text: + 'An example option that is really long to show what should be done to handle long text', + }, + { + id: 'downshift-1-item-5', + text: 'Option 5', + }, +]; + +export default { + title: 'Components/MultiSelect', + + parameters: { + component: MultiSelect, + subcomponents: { + 'MultiSelect.Filterable': MultiSelect.Filterable, + }, + }, +}; + +export const Default = () => { + return ( +
+ (item ? item.text : '')} + selectionFeedback="top-after-reopen" + /> +
+ ); +}; + +export const WithInitialSelectedItems = () => { + return ( +
+ (item ? item.text : '')} + initialSelectedItems={[items[0], items[1]]} + selectionFeedback="top-after-reopen" + /> +
+ ); +}; + +export const _Filterable = () => { + return ( +
+ (item ? item.text : '')} + placeholder="Filter" + selectionFeedback="top-after-reopen" + /> +
+ ); +}; diff --git a/packages/carbon-react/src/components/MultiSelect/index.js b/packages/carbon-react/src/components/MultiSelect/index.js new file mode 100644 index 000000000000..f324a71eea03 --- /dev/null +++ b/packages/carbon-react/src/components/MultiSelect/index.js @@ -0,0 +1,8 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +export { MultiSelect } from 'carbon-components-react'; diff --git a/packages/carbon-react/src/components/Tag/Tag.stories.js b/packages/carbon-react/src/components/Tag/Tag.stories.js new file mode 100644 index 000000000000..210cb6c976b6 --- /dev/null +++ b/packages/carbon-react/src/components/Tag/Tag.stories.js @@ -0,0 +1,47 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * 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 React from 'react'; +import { Tag } from 'carbon-components-react'; + +export default { + title: 'Components/Tag', + parameters: { + component: Tag, + }, +}; + +export const Default = () => { + return ( + <> + + {'Tag content'} + + + {'Tag content'} + + + {'Tag content'} + + + {'Tag content'} + + + {'Tag content'} + + + {'Tag content'} + + + {'Tag content'} + + + {'Tag content'} + + + ); +}; diff --git a/packages/carbon-react/src/components/Tag/index.js b/packages/carbon-react/src/components/Tag/index.js new file mode 100644 index 000000000000..5cf3e720b86f --- /dev/null +++ b/packages/carbon-react/src/components/Tag/index.js @@ -0,0 +1,8 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +export { Tag } from 'carbon-components-react'; diff --git a/packages/cli/src/commands/ci-check.js b/packages/cli/src/commands/ci-check.js index fb4ba5ba12ed..465f551fa1da 100644 --- a/packages/cli/src/commands/ci-check.js +++ b/packages/cli/src/commands/ci-check.js @@ -21,7 +21,7 @@ async function check(args, env) { stdio: 'inherit', }; const tasks = [ - `yarn carbon-cli check --ignore '**/@(node_modules|examples|components|react|fixtures)/**' 'packages/**/*.scss'`, + `yarn carbon-cli check --ignore '**/@(node_modules|examples|components|react|fixtures|compat)/**' 'packages/**/*.scss'`, `cross-env BABEL_ENV=test yarn test --ci --maxWorkers 2 --reporters=default --reporters=jest-junit`, `cross-env BABEL_ENV=test yarn test:e2e --ci --maxWorkers 2 --reporters=default --reporters=jest-junit`, `cross-env PERCY_TOKEN=dd3392142006a6483c8f524697f39f052755fa9dc087ff4437cac3d64227abdd yarn run percy exec -- yarn workspace carbon-components-react test:e2e`, diff --git a/packages/components/src/components/modal/_modal.scss b/packages/components/src/components/modal/_modal.scss index 76c27b111e2d..98283795a1bd 100644 --- a/packages/components/src/components/modal/_modal.scss +++ b/packages/components/src/components/modal/_modal.scss @@ -55,7 +55,8 @@ .#{$prefix}--dropdown, .#{$prefix}--dropdown-list, .#{$prefix}--number input[type='number'], - .#{$prefix}--date-picker__input { + .#{$prefix}--date-picker__input, + .#{$prefix}--multi-select { background-color: $field-02; } } diff --git a/packages/feature-flags/package.json b/packages/feature-flags/package.json index 76ee87e547d1..8ba89eb9f9b2 100644 --- a/packages/feature-flags/package.json +++ b/packages/feature-flags/package.json @@ -33,10 +33,14 @@ "watch": "yarn clean && node tasks/build.js && rollup -c -w" }, "devDependencies": { + "@babel/core": "^7.14.6", "@babel/generator": "^7.14.5", + "@babel/preset-env": "^7.14.7", "@babel/template": "^7.14.5", "@babel/types": "^7.14.5", "@carbon/scss-generator": "^10.13.0", + "@rollup/plugin-babel": "^5.3.0", + "@rollup/plugin-node-resolve": "^13.0.0", "change-case": "^4.1.2", "fs-extra": "^9.0.1", "js-yaml": "^3.14.0", @@ -44,5 +48,10 @@ "rollup": "^2.46.0", "rollup-plugin-strip-banner": "^2.0.0" }, - "sideEffects": false + "sideEffects": false, + "babel": { + "presets": [ + "@babel/env" + ] + } } diff --git a/packages/feature-flags/rollup.config.js b/packages/feature-flags/rollup.config.js index 53775d49c099..361fdf0eadf2 100644 --- a/packages/feature-flags/rollup.config.js +++ b/packages/feature-flags/rollup.config.js @@ -6,6 +6,8 @@ */ import path from 'path'; +import resolve from '@rollup/plugin-node-resolve'; +import babel from '@rollup/plugin-babel'; import stripBanner from 'rollup-plugin-strip-banner'; const BANNER = `/** @@ -19,6 +21,8 @@ const BANNER = `/** const baseConfig = { external: [], plugins: [ + resolve(), + babel({ babelHelpers: 'bundled' }), stripBanner(), { renderChunk(code) { diff --git a/packages/react/__tests__/PublicAPI-test.js b/packages/react/__tests__/PublicAPI-test.js index dc2d28489108..3f688a56813d 100644 --- a/packages/react/__tests__/PublicAPI-test.js +++ b/packages/react/__tests__/PublicAPI-test.js @@ -124,6 +124,8 @@ beforeEach(() => { * the components that we export and their corresponding API. */ test('Public API should only change with a semver change', () => { + jest.mock('../src/internal/deprecateFieldOnObject'); + const CarbonReact = require('../src'); const PublicAPI = new Map(); diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index a78ea9f33be3..5cff6abca646 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -4331,6 +4331,249 @@ Map { }, "render": [Function], }, + "ControlledPasswordInput" => Object { + "$$typeof": Symbol(react.forward_ref), + "defaultProps": Object { + "className": "\${prefix}--text__input", + "disabled": false, + "helperText": "", + "invalid": false, + "invalidText": "", + "light": false, + "onChange": [Function], + "onClick": [Function], + "size": "", + }, + "propTypes": Object { + "className": Object { + "type": "string", + }, + "defaultValue": Object { + "args": Array [ + Array [ + Object { + "type": "string", + }, + Object { + "type": "number", + }, + ], + ], + "type": "oneOfType", + }, + "disabled": Object { + "type": "bool", + }, + "helperText": Object { + "type": "node", + }, + "hideLabel": Object { + "type": "bool", + }, + "hidePasswordLabel": Object { + "type": "string", + }, + "id": Object { + "isRequired": true, + "type": "string", + }, + "invalid": Object { + "type": "bool", + }, + "invalidText": Object { + "type": "node", + }, + "labelText": Object { + "isRequired": true, + "type": "node", + }, + "light": Object { + "type": "bool", + }, + "onChange": Object { + "type": "func", + }, + "onClick": Object { + "type": "func", + }, + "placeholder": Object { + "type": "string", + }, + "showPasswordLabel": Object { + "type": "string", + }, + "size": Object { + "type": "string", + }, + "tooltipAlignment": Object { + "args": Array [ + Array [ + "start", + "center", + "end", + ], + ], + "type": "oneOf", + }, + "tooltipPosition": Object { + "args": Array [ + Array [ + "top", + "right", + "bottom", + "left", + ], + ], + "type": "oneOf", + }, + "value": Object { + "args": Array [ + Array [ + Object { + "type": "string", + }, + Object { + "type": "number", + }, + ], + ], + "type": "oneOfType", + }, + }, + "render": [Function], + }, + "PasswordInput" => Object { + "$$typeof": Symbol(react.forward_ref), + "defaultProps": Object { + "className": "\${prefix}--text__input", + "disabled": false, + "helperText": "", + "invalid": false, + "invalidText": "", + "light": false, + "onChange": [Function], + "onClick": [Function], + "size": "", + }, + "propTypes": Object { + "className": Object { + "type": "string", + }, + "defaultValue": Object { + "args": Array [ + Array [ + Object { + "type": "string", + }, + Object { + "type": "number", + }, + ], + ], + "type": "oneOfType", + }, + "disabled": Object { + "type": "bool", + }, + "helperText": Object { + "type": "node", + }, + "hideLabel": Object { + "type": "bool", + }, + "hidePasswordLabel": Object { + "type": "string", + }, + "id": Object { + "isRequired": true, + "type": "string", + }, + "inline": Object { + "type": "bool", + }, + "invalid": Object { + "type": "bool", + }, + "invalidText": Object { + "type": "node", + }, + "labelText": Object { + "isRequired": true, + "type": "node", + }, + "light": Object { + "type": "bool", + }, + "onChange": Object { + "type": "func", + }, + "onClick": Object { + "type": "func", + }, + "onTogglePasswordVisibility": Object { + "type": "func", + }, + "placeholder": Object { + "type": "string", + }, + "showPasswordLabel": Object { + "type": "string", + }, + "size": Object { + "type": "string", + }, + "tooltipAlignment": Object { + "args": Array [ + Array [ + "start", + "center", + "end", + ], + ], + "type": "oneOf", + }, + "tooltipPosition": Object { + "args": Array [ + Array [ + "top", + "right", + "bottom", + "left", + ], + ], + "type": "oneOf", + }, + "type": Object { + "args": Array [ + Array [ + "password", + "text", + ], + ], + "type": "oneOf", + }, + "value": Object { + "args": Array [ + Array [ + Object { + "type": "string", + }, + Object { + "type": "number", + }, + ], + ], + "type": "oneOfType", + }, + "warn": Object { + "type": "bool", + }, + "warnText": Object { + "type": "node", + }, + }, + "render": [Function], + }, "PrimaryButton" => Object {}, "ProgressIndicator" => Object { "defaultProps": Object { diff --git a/packages/react/docs/migration/11.x-namespaced-exports.md b/packages/react/docs/migration/11.x-namespaced-exports.md new file mode 100644 index 000000000000..b34408159e58 --- /dev/null +++ b/packages/react/docs/migration/11.x-namespaced-exports.md @@ -0,0 +1,44 @@ +# Namespaced exports + + + + +## Table of Contents + +- [Overview](#overview) +- [Process](#process) +- [Changes:](#changes) + + + +## Overview + +In v10.x there were a few exported components that were only exposed under the +namespace of another component. These have been deprecated, and a new export has +been made available for each so these can be imported directly. In v11.x the +namespaced exports will be removed. + +## Process + +1. Update imports for the components listed in the table below. + +```diff +- import { TextInput } from 'carbon-components-react'; ++ import { PasswordInput } from 'carbon-components-react'; +``` + +2. Update usages of the components listed in the table below, they no longer + need the namespace + +```diff +- ++ +``` + +## Changes: + +| v10.x | v11.x | +| ----------------------------------- | ------------------------- | +| `TextInput.ControlledPasswordInput` | `ControlledPasswordInput` | +| `TextInput.PasswordInput` | `PasswordInput` | +| `MultiSelect.Filterable` | `FilterableMultiSelect` | diff --git a/packages/react/docs/migration/migrate-to-8.x.md b/packages/react/docs/migration/migrate-to-8.x.md new file mode 100644 index 000000000000..46d70826f436 --- /dev/null +++ b/packages/react/docs/migration/migrate-to-8.x.md @@ -0,0 +1,11 @@ +# 8.x Migration + +**Note: everything in this file is a work-in-progress and will be changed.** + +## Components + +| Component | v10 | +| --------- | ------------------------------------------------------ | +| `Grid` | [Migrate](../../src/components/Grid/migrate-to-8.x.md) | +| `Row` | Removed | +| `Column` | [Migrate](../../src/components/Grid/migrate-to-8.x.md) | diff --git a/packages/react/package.json b/packages/react/package.json index c304e468018f..e8a9fa620f79 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -106,7 +106,7 @@ "core-js": "^3.6.5", "cross-env": "^5.2.0", "css-loader": "^3.4.2", - "cypress": "^7.2.0", + "cypress": "^8.0.0", "cypress-real-events": "^1.3.0", "fast-sass-loader": "^1.5.0", "gzip-size": "^6.0.0", diff --git a/packages/react/src/__tests__/index-test.js b/packages/react/src/__tests__/index-test.js index 4ad9a349281b..8ba8e2097c99 100644 --- a/packages/react/src/__tests__/index-test.js +++ b/packages/react/src/__tests__/index-test.js @@ -35,6 +35,7 @@ describe('Carbon Components React', () => { "ComposedModal", "Content", "ContentSwitcher", + "ControlledPasswordInput", "Copy", "CopyButton", "DangerButton", @@ -96,6 +97,7 @@ describe('Carbon Components React', () => { "Pagination", "PaginationNav", "PaginationSkeleton", + "PasswordInput", "PrimaryButton", "ProgressIndicator", "ProgressIndicatorSkeleton", diff --git a/packages/react/src/components/FilterableMultiSelect/index.js b/packages/react/src/components/FilterableMultiSelect/index.js new file mode 100644 index 000000000000..e24ee932dcc1 --- /dev/null +++ b/packages/react/src/components/FilterableMultiSelect/index.js @@ -0,0 +1 @@ +export FilterableMultiSelect from '../MultiSelect/FilterableMultiSelect'; diff --git a/packages/react/src/components/Grid/migrate-to-8.x.md b/packages/react/src/components/Grid/migrate-to-8.x.md new file mode 100644 index 000000000000..864b0b081497 --- /dev/null +++ b/packages/react/src/components/Grid/migrate-to-8.x.md @@ -0,0 +1,25 @@ +# Migrate grid to 8.x + +To get a sense of what's changed in the grid implementation, read through the +[`@carbon/grid` migration documentation](docs/migration/11.x-grid.md). The most +notable item to mention is that the implementation uses CSS Grid instead of +flexbox. + +## `` + +- The prop interface for `` is primarily the same. +- When a `` is a child of another ``, the child will always be + automatically defined as a subgrid. More info can be found in the subgrid + story in the `@carbon/react` storybook. +- The grid now defaults to 16 columns instead of 12. + +## `` + +- This has been removed. Columns can now be direct children of a ``. + +## `` + +- The prop interface for `` is primarily the same. +- `` components without a `sm`, `md`, `lg`, etc. prop no longer + automatically expand to fill the remaining space of the grid. `` by + default spans only 1 column on the grid. diff --git a/packages/react/src/components/Modal/Modal-story.js b/packages/react/src/components/Modal/Modal-story.js index 69cc41674d31..61351855588c 100644 --- a/packages/react/src/components/Modal/Modal-story.js +++ b/packages/react/src/components/Modal/Modal-story.js @@ -19,6 +19,8 @@ import { import Modal from '../Modal'; import Button from '../Button'; import Select from '../Select'; +import MultiSelect from '../MultiSelect'; +import Dropdown from '../Dropdown'; import SelectItem from '../SelectItem'; import TextInput from '../TextInput'; import mdx from './Modal.mdx'; @@ -161,6 +163,30 @@ export const Default = () => { + + (item ? item.text : '')} + /> ); }; diff --git a/packages/react/src/components/Modal/Modal.mdx b/packages/react/src/components/Modal/Modal.mdx index 4b41dcfd1014..99b0b9afcc70 100644 --- a/packages/react/src/components/Modal/Modal.mdx +++ b/packages/react/src/components/Modal/Modal.mdx @@ -214,17 +214,17 @@ With ``, you can control the buttons with the following code. kind="secondary" onClick={() => { (Run some action...) setOpen(false); }}> Another button - + ``` diff --git a/packages/react/src/components/MultiSelect/MultiSelect-story.js b/packages/react/src/components/MultiSelect/MultiSelect-story.js index b1c532f34572..97303f5660ae 100644 --- a/packages/react/src/components/MultiSelect/MultiSelect-story.js +++ b/packages/react/src/components/MultiSelect/MultiSelect-story.js @@ -17,6 +17,7 @@ import { import { withReadme } from 'storybook-readme'; import readme from './README.md'; import MultiSelect from '../MultiSelect'; +import FilterableMultiSelect from '../MultiSelect/FilterableMultiSelect'; import Checkbox from '../Checkbox'; import mdx from './MultiSelect.mdx'; @@ -116,7 +117,7 @@ export default { page: mdx, }, subcomponents: { - 'MultiSelect.Filterable': MultiSelect.Filterable, + FilterableMultiSelect, }, }, }; @@ -190,7 +191,7 @@ export const _Filterable = withReadme(readme, () => { return (
- (item ? item.text : '')} diff --git a/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js b/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js index 61bb0707d19d..4c4474840704 100644 --- a/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js +++ b/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js @@ -7,7 +7,7 @@ import React from 'react'; import { mount } from 'enzyme'; -import MultiSelect from '../../MultiSelect'; +import FilterableMultiSelect from '../../MultiSelect/FilterableMultiSelect'; import { assertMenuOpen, assertMenuClosed, @@ -21,10 +21,12 @@ const openMenu = (wrapper) => { wrapper.find(`[role="combobox"]`).simulate('click'); }; -describe('MultiSelect.Filterable', () => { +describe('FilterableMultiSelect', () => { let mockProps; beforeEach(() => { + // jest.mock('../../../internal/deprecateFieldOnObject'); + mockProps = { id: 'test-filterable-multiselect', disabled: false, @@ -37,23 +39,23 @@ describe('MultiSelect.Filterable', () => { }); it('should render', () => { - const wrapper = mount(); + const wrapper = mount(); expect(wrapper).toMatchSnapshot(); }); it('should display all items when the menu is open initially', () => { - const wrapper = mount(); + const wrapper = mount(); openMenu(wrapper); expect(wrapper.find(listItemName).length).toBe(mockProps.items.length); }); it('should initially have the menu open when open prop is provided', () => { - const wrapper = mount(); + const wrapper = mount(); assertMenuOpen(wrapper, mockProps); }); it('should open the menu with a down arrow', () => { - const wrapper = mount(); + const wrapper = mount(); const menuIconNode = findMenuIconNode(wrapper); menuIconNode.simulate('keyDown', { key: 'ArrowDown' }); @@ -61,7 +63,7 @@ describe('MultiSelect.Filterable', () => { }); it('should let the user toggle the menu by the menu icon', () => { - const wrapper = mount(); + const wrapper = mount(); findMenuIconNode(wrapper).simulate('click'); assertMenuOpen(wrapper, mockProps); findMenuIconNode(wrapper).simulate('click'); @@ -69,7 +71,7 @@ describe('MultiSelect.Filterable', () => { }); it('should not close the menu after a user makes a selection', () => { - const wrapper = mount(); + const wrapper = mount(); openMenu(wrapper); const firstListItem = wrapper.find(listItemName).at(0); @@ -79,7 +81,7 @@ describe('MultiSelect.Filterable', () => { }); it('should filter a list of items by the input value', () => { - const wrapper = mount(); + const wrapper = mount(); openMenu(wrapper); expect(wrapper.find(listItemName).length).toBe(mockProps.items.length); @@ -93,7 +95,7 @@ describe('MultiSelect.Filterable', () => { it('should call `onChange` with each update to selected items', () => { const wrapper = mount( - + ); openMenu(wrapper); @@ -128,7 +130,7 @@ describe('MultiSelect.Filterable', () => { it('should let items stay at their position after selecting', () => { const wrapper = mount( - + ); openMenu(wrapper); @@ -149,7 +151,7 @@ describe('MultiSelect.Filterable', () => { }); it('should not clear input value after a user makes a selection', () => { - const wrapper = mount(); + const wrapper = mount(); openMenu(wrapper); wrapper diff --git a/packages/react/src/components/MultiSelect/__tests__/MultiSelect-test.js b/packages/react/src/components/MultiSelect/__tests__/MultiSelect-test.js index 69274c14bc32..7d512303d656 100644 --- a/packages/react/src/components/MultiSelect/__tests__/MultiSelect-test.js +++ b/packages/react/src/components/MultiSelect/__tests__/MultiSelect-test.js @@ -14,6 +14,9 @@ import MultiSelect from '../'; import { generateItems, generateGenericItem } from '../../ListBox/test-helpers'; describe('MultiSelect', () => { + beforeEach(() => { + jest.mock('../../../internal/deprecateFieldOnObject'); + }); afterEach(cleanup); describe.skip('automated accessibility tests', () => { diff --git a/packages/react/src/components/MultiSelect/__tests__/__snapshots__/FilterableMultiSelect-test.js.snap b/packages/react/src/components/MultiSelect/__tests__/__snapshots__/FilterableMultiSelect-test.js.snap index 28d3d3e6b560..92728708ec62 100644 --- a/packages/react/src/components/MultiSelect/__tests__/__snapshots__/FilterableMultiSelect-test.js.snap +++ b/packages/react/src/components/MultiSelect/__tests__/__snapshots__/FilterableMultiSelect-test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`MultiSelect.Filterable should render 1`] = ` - - + `; diff --git a/packages/react/src/components/MultiSelect/index.js b/packages/react/src/components/MultiSelect/index.js index 112c85925dc6..c61b45aec598 100644 --- a/packages/react/src/components/MultiSelect/index.js +++ b/packages/react/src/components/MultiSelect/index.js @@ -4,6 +4,7 @@ * 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 { deprecateFieldOnObject } from '../../internal/deprecateFieldOnObject'; import MultiSelect from './MultiSelect'; import FilterableMultiSelect from './FilterableMultiSelect'; @@ -11,4 +12,8 @@ import FilterableMultiSelect from './FilterableMultiSelect'; FilterableMultiSelect.displayName = 'MultiSelect.Filterable'; MultiSelect.Filterable = FilterableMultiSelect; +if (__DEV__) { + deprecateFieldOnObject(MultiSelect, 'Filterable', FilterableMultiSelect); +} + export default MultiSelect; diff --git a/packages/react/src/components/PasswordInput/index.js b/packages/react/src/components/PasswordInput/index.js new file mode 100644 index 000000000000..1f07aa31bc41 --- /dev/null +++ b/packages/react/src/components/PasswordInput/index.js @@ -0,0 +1,2 @@ +export ControlledPasswordInput from '../TextInput/ControlledPasswordInput'; +export PasswordInput from '../TextInput/PasswordInput'; diff --git a/packages/react/src/components/TextInput/TextInput-story.js b/packages/react/src/components/TextInput/TextInput-story.js index 10b6f7610129..51b58a98d4b7 100644 --- a/packages/react/src/components/TextInput/TextInput-story.js +++ b/packages/react/src/components/TextInput/TextInput-story.js @@ -8,7 +8,7 @@ import React, { useState } from 'react'; import { action } from '@storybook/addon-actions'; import { withKnobs, boolean, select, text } from '@storybook/addon-knobs'; -import TextInput from '../TextInput'; +import { TextInput } from '../../index'; import TextInputSkeleton from '../TextInput/TextInput.Skeleton'; import FluidForm from '../FluidForm/FluidForm'; import mdx from './TextInput.mdx'; diff --git a/packages/react/src/components/TextInput/index.js b/packages/react/src/components/TextInput/index.js index 58347c19513b..a4bad4443c14 100644 --- a/packages/react/src/components/TextInput/index.js +++ b/packages/react/src/components/TextInput/index.js @@ -4,8 +4,23 @@ * 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 { deprecateFieldOnObject } from '../../internal/deprecateFieldOnObject'; export * from './TextInput.Skeleton'; -export ControlledPasswordInput from './ControlledPasswordInput'; -export PasswordInput from './PasswordInput'; -export default from './TextInput'; +import ControlledPasswordInput from './ControlledPasswordInput'; +import PasswordInput from './PasswordInput'; +import TextInput from './TextInput'; + +TextInput.ControlledPasswordInput = ControlledPasswordInput; +TextInput.PasswordInput = PasswordInput; + +if (__DEV__) { + deprecateFieldOnObject( + TextInput, + 'ControlledPasswordInput', + ControlledPasswordInput + ); + deprecateFieldOnObject(TextInput, 'PasswordInput', PasswordInput); +} + +export default TextInput; diff --git a/packages/react/src/index.js b/packages/react/src/index.js index 2f92fb3ff5a7..449904a87a84 100644 --- a/packages/react/src/index.js +++ b/packages/react/src/index.js @@ -4,7 +4,6 @@ * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ - export Accordion from './components/Accordion'; export AccordionItem from './components/AccordionItem'; export { AspectRatio } from './components/AspectRatio'; @@ -86,6 +85,10 @@ export OverflowMenu from './components/OverflowMenu'; export OverflowMenuItem from './components/OverflowMenuItem'; export Pagination from './components/Pagination'; export PaginationNav from './components/PaginationNav'; +export { + ControlledPasswordInput, + PasswordInput, +} from './components/PasswordInput'; export PrimaryButton from './components/PrimaryButton'; export { ProgressIndicator, diff --git a/packages/react/src/internal/__mocks__/deprecateFieldOnObject.js b/packages/react/src/internal/__mocks__/deprecateFieldOnObject.js new file mode 100644 index 000000000000..a1888682b4a7 --- /dev/null +++ b/packages/react/src/internal/__mocks__/deprecateFieldOnObject.js @@ -0,0 +1,10 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +module.exports = { + deprecateFieldOnObject: jest.fn(), +}; diff --git a/packages/react/src/internal/deprecateFieldOnObject.js b/packages/react/src/internal/deprecateFieldOnObject.js new file mode 100644 index 000000000000..43090160295b --- /dev/null +++ b/packages/react/src/internal/deprecateFieldOnObject.js @@ -0,0 +1,32 @@ +/** + * Copyright IBM Corp. 2016, 2018 + * + * 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 { warning } from '../internal/warning'; + +const didWarnAboutDeprecation = {}; + +function deprecateFieldOnObject(object, field, Component, message) { + Object.defineProperty(object, field, { + enumerable: true, + get() { + if (!didWarnAboutDeprecation[field]) { + warning( + false, + message || + `The ${field} field has been deprecated on the ${object.displayName} object. ` + + `Please import and use ${ + Component.displayName || Component.name || 'the field' + } directly.` + ); + didWarnAboutDeprecation[field] = true; + } + + return Component; + }, + }); +} + +export { deprecateFieldOnObject }; diff --git a/packages/styles/__tests__/compat-test.js b/packages/styles/__tests__/compat-test.js new file mode 100644 index 000000000000..b13b4d8c6642 --- /dev/null +++ b/packages/styles/__tests__/compat-test.js @@ -0,0 +1,67 @@ +/** + * Copyright IBM Corp. 2018, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + * + * @jest-environment node + */ + +'use strict'; + +const { SassRenderer } = require('@carbon/test-utils/scss'); + +const { render } = SassRenderer.create(__dirname); + +describe('@carbon/styles/scss/compat', () => { + it('should export white, g10, g90, and g100 themes', async () => { + const { unwrap } = await render(` + @use 'sass:map'; + @use 'sass:meta'; + @use '../scss/compat/themes'; + + $_: get('variables', map.keys(meta.module-variables('themes'))); + `); + const themes = unwrap('variables').sort(); + expect(themes).toEqual(['white', 'g10', 'g90', 'g100'].sort()); + }); + + it('should export v10 tokens as Sass Variables', async () => { + const { unwrap } = await render(` + @use '../scss/config' with ( $prefix: 'cds' ); + @use '../scss/compat/themes'; + @use '../scss/compat/theme' with ( + $theme: themes.$white, + ); + + $_: get('theme', themes.$white); + $_: get('variable', theme.$interactive-01); + `); + const theme = unwrap('theme'); + const variable = unwrap('variable'); + + expect(variable).toEqual( + `var(--cds-interactive-01, ${theme['interactive-01']})` + ); + }); + + it('should export v11 tokens that match the fallback theme', async () => { + const { unwrap } = await render(` + @use '../scss/config' with ( $prefix: 'cds' ); + @use '../scss/themes'; + @use '../scss/compat/themes' as compat; + @use '../scss/compat/theme' with ( + $fallback: themes.$g100, + $theme: compat.$g100, + ); + + $_: get('theme', themes.$g100); + $_: get('variable', theme.$background); + `); + + const theme = unwrap('theme'); + const variable = unwrap('variable'); + + expect(variable).toEqual(`var(--cds-background, ${theme['background']})`); + }); +}); diff --git a/packages/styles/docs/sass.md b/packages/styles/docs/sass.md index ce116f897831..d9163303eec8 100644 --- a/packages/styles/docs/sass.md +++ b/packages/styles/docs/sass.md @@ -48,6 +48,7 @@ between version updates. | :------------------------------------- | :--------------------------------------------------------- | | [`scss/breakpoint`](#breakpoint) | Helper functions and mixins for working with breakpoints | | [`scss/colors`](#colors) | Access colors from every swatch in the IBM Design Language | +| [`scss/compat/`](#compatibility) | Helper themes and tokens for migrating from v10 to v11 | | [`scss/config`](#config) | Configure various options for the package | | [`scss/feature-flags`](#feature-flags) | Configure various feature flags for experiments | | [`scss/grid`](#grid) | Access and use the CSS Grid built-in to Carbon | @@ -68,10 +69,25 @@ between version updates. ## Colors +The colors package will give you access to each swatch from the IBM Design +Language. You can refer to any color by its swatch and grade. + +```scss +@use '@carbon/styles/scss/colors'; + +.my-selector { + background-color: colors.$blue-50; +} +``` + | Import | Filepath | | :----------------------------------- | :------------------ | | `@use '@carbon/styles/scss/colors';` | `scss/_colors.scss` | +To see all the colors available to be imported, checkout our +[colors](https://github.com/carbon-design-system/carbon/tree/main/packages/colors) +docs. + ## Config | Import | Filepath | @@ -154,10 +170,23 @@ grid, there are a few mixins that can be used. ## Motion +The motion package provides helper functions, mixins, and duration tokens to add +motion into your project. + +```scss +@use '@carbon/styles/scss/motion' as *; + +.my-selector { + transition: transform $duration-fast-02 motion(standard, productive); +} +``` + | Import | Filepath | | :----------------------------------- | :------------------ | | `@use '@carbon/styles/scss/motion';` | `scss/_motion.scss` | +For more information, checkout our [motion](#todo) docs. + ## Reset | Import | Filepath | @@ -252,10 +281,23 @@ options: ## Type +The type package entrypoint allows you to specifically bring type tokens into +your project. The type package includes various type tokens and mixins. + +```scss +@use '@carbon/styles/scss/type'; + +.my-selector { + @include type.style(type.$productive-heading-01); +} +``` + | Import | Filepath | | :--------------------------------- | :---------------- | | `@use '@carbon/styles/scss/type';` | `scss/_type.scss` | +For more information, check out our [type](#todo) docs. + ## Components All of the styles for the components in the Carbon Design System live in the @@ -290,6 +332,48 @@ like to see changed. For example, if you wanted to change the component token | :---------------------------------------------------- | :---------- | | `@use '@carbon/styles/scss/utilities/focus-outline';` | | +## Compatibility + +| Import | Filepath | +| :------------------------------------------ | :------------------------- | +| `@use '@carbon/styles/scss/compat/themes';` | `scss/compat/_themes.scss` | +| `@use '@carbon/styles/scss/compat/theme';` | `scss/compat/_theme.scss` | + +The compatibility entrypoints for themes and theme provide access to the v10 +tokens along with the v11 tokens. To make sure that the tokens that you're using +from v10 have the correct value in v11, you will need to include the theme that +you're using from `scss/compat/themes` and set that as your theme. + +```scss +@use '@carbon/styles/scss/compat/themes' as compat; +@use '@carbon/styles/scss/themes'; +@use '@carbon/styles/scss/compat/theme' with ( + $fallback: themes.$g100, + $theme: compat.$g100, +); +``` + +It's important that you specify the `$fallback` theme as a value from the +`scss/themes` entrypoint. This will guarantee that all tokens that you are using +from v11 will match the theme of the tokens that you are using from v10. + +You can directly reference a token from the `scss/compat/theme` entrypoint. This +entrypoint will also re-export all available v11 tokens and mixins from +`scss/theme`. + +```scss +@use '@carbon/styles/scss/compat/theme'; + +body { + // You can use both v10 and v11 tokens + background: theme.$background; + color: theme.$text-01; +} +``` + +_Note: all tokens from v10 are deprecated in v11. They will be removed in the +next major release of Carbon_ + ## Configuration You will need to configure Sass to be able to lookup packages from your diff --git a/packages/styles/scss/__tests__/theme-test.js b/packages/styles/scss/__tests__/theme-test.js index 04ff17dfef6d..244b21093666 100644 --- a/packages/styles/scss/__tests__/theme-test.js +++ b/packages/styles/scss/__tests__/theme-test.js @@ -36,7 +36,6 @@ describe('@carbon/styles/scss/theme', () => { Array [ "fallback", "theme", - "use-fallback-value", "background", "background-active", "background-selected", @@ -145,28 +144,6 @@ Array [ "border-subtle", "border-subtle-selected", "border-strong", - "interactive-01", - "interactive-04", - "decorative-01", - "hover-row", - "ui-01", - "ui-02", - "ui-05", - "disabled-01", - "disabled-02", - "hover-field", - "hover-ui", - "selected-ui", - "hover-selected-ui", - "hover-light-ui", - "active-light-ui", - "text-01", - "text-02", - "text-04", - "text-05", - "icon-01", - "icon-02", - "link-01", ] `); }); diff --git a/packages/styles/scss/_theme.scss b/packages/styles/scss/_theme.scss index 83537cd12da8..00df15b4efd3 100644 --- a/packages/styles/scss/_theme.scss +++ b/packages/styles/scss/_theme.scss @@ -9,9 +9,15 @@ @use '@carbon/themes/scss/modules/config' with ( $prefix: $prefix, ); -@use '@carbon/themes/scss/modules/tokens'; -@forward '@carbon/themes/scss/modules/theme'; +@use './compat/themes' as compat; +@use './themes'; + +@forward '@carbon/themes/scss/modules/theme' with ( + $fallback: themes.$white !default, + $theme: compat.$white !default, +); @forward '@carbon/themes/scss/modules/tokens'; +@use '@carbon/themes/scss/modules/tokens'; @use './utilities/custom-property'; @use './utilities/layer-set' with ( $layer-sets: ( @@ -99,27 +105,3 @@ $field-hover: custom-property.get-var('field-hover'); $border-subtle: custom-property.get-var('border-subtle'); $border-subtle-selected: custom-property.get-var('border-subtle-selected'); $border-strong: custom-property.get-var('border-strong'); - -// TODO remove -$interactive-01: #0f62fe; -$interactive-04: #0f62fe; -$decorative-01: #e0e0e0; -$hover-row: #636363; -$ui-01: #f4f4f4; -$ui-02: #ffffff; -$ui-05: #161616; -$disabled-01: #f4f4f4; -$disabled-02: #c6c6c6; -$hover-field: #e5e5e5; -$hover-ui: #e5e5e5; -$selected-ui: #e0e0e0; -$hover-selected-ui: #cacaca; -$hover-light-ui: #e5e5e5; -$active-light-ui: #c6c6c6; -$text-01: #161616; -$text-02: #525252; -$text-04: #ffffff; -$text-05: #6f6f6f; -$icon-01: #f4f4f4; -$icon-02: #525252; -$link-01: #0f62fe; diff --git a/packages/styles/scss/compat/_theme.scss b/packages/styles/scss/compat/_theme.scss new file mode 100644 index 000000000000..e8304438c5f5 --- /dev/null +++ b/packages/styles/scss/compat/_theme.scss @@ -0,0 +1,9 @@ +// +// Copyright IBM Corp. 2018, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@forward '../theme'; +@forward '@carbon/themes/scss/compat/tokens'; diff --git a/packages/styles/scss/compat/_themes.scss b/packages/styles/scss/compat/_themes.scss new file mode 100644 index 000000000000..49eeadca08f6 --- /dev/null +++ b/packages/styles/scss/compat/_themes.scss @@ -0,0 +1,8 @@ +// +// Copyright IBM Corp. 2018, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@forward '@carbon/themes/scss/compat/themes' show $white, $g10, $g90, $g100; diff --git a/packages/styles/scss/components/__tests__/combo-box-test.js b/packages/styles/scss/components/__tests__/combo-box-test.js new file mode 100644 index 000000000000..185ae5b07a9b --- /dev/null +++ b/packages/styles/scss/components/__tests__/combo-box-test.js @@ -0,0 +1,27 @@ +/** + * Copyright IBM Corp. 2018, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + * + * @jest-environment node + */ + +'use strict'; + +const { SassRenderer } = require('@carbon/test-utils/scss'); + +const { render } = SassRenderer.create(__dirname); + +describe('scss/components/combo-box', () => { + test('Public API', async () => { + const { unwrap } = await render(` + @use 'sass:map'; + @use 'sass:meta'; + @use '../combo-box'; + + $_: get('mixin', meta.mixin-exists('combo-box', 'combo-box')); + `); + expect(unwrap('mixin')).toBe(true); + }); +}); diff --git a/packages/styles/scss/components/__tests__/dropdown-test.js b/packages/styles/scss/components/__tests__/dropdown-test.js new file mode 100644 index 000000000000..e392215303f2 --- /dev/null +++ b/packages/styles/scss/components/__tests__/dropdown-test.js @@ -0,0 +1,27 @@ +/** + * Copyright IBM Corp. 2018, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + * + * @jest-environment node + */ + +'use strict'; + +const { SassRenderer } = require('@carbon/test-utils/scss'); + +const { render } = SassRenderer.create(__dirname); + +describe('scss/components/dropdown', () => { + test('Public API', async () => { + const { unwrap } = await render(` + @use 'sass:map'; + @use 'sass:meta'; + @use '../dropdown'; + + $_: get('mixin', meta.mixin-exists('dropdown', 'dropdown')); + `); + expect(unwrap('mixin')).toBe(true); + }); +}); diff --git a/packages/styles/scss/components/__tests__/list-box-test.js b/packages/styles/scss/components/__tests__/list-box-test.js new file mode 100644 index 000000000000..302aa57d14fe --- /dev/null +++ b/packages/styles/scss/components/__tests__/list-box-test.js @@ -0,0 +1,36 @@ +/** + * Copyright IBM Corp. 2018, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + * + * @jest-environment node + */ + +'use strict'; + +const { SassRenderer } = require('@carbon/test-utils/scss'); + +const { render } = SassRenderer.create(__dirname); + +describe('scss/components/list-box', () => { + test('Public API', async () => { + const { unwrap } = await render(` + @use 'sass:map'; + @use 'sass:meta'; + @use '../list-box'; + + $_: get('mixin', meta.mixin-exists('list-box', 'list-box')); + $_: get('variables', map.keys(meta.module-variables('list-box'))); + `); + expect(unwrap('mixin')).toBe(true); + expect(unwrap('variables')).toMatchInlineSnapshot(` + Array [ + "list-box-width", + "list-box-height", + "list-box-inline-height", + "list-box-menu-width", + ] + `); + }); +}); diff --git a/packages/styles/scss/components/__tests__/multiselect-test.js b/packages/styles/scss/components/__tests__/multiselect-test.js new file mode 100644 index 000000000000..9aff71f0a068 --- /dev/null +++ b/packages/styles/scss/components/__tests__/multiselect-test.js @@ -0,0 +1,27 @@ +/** + * Copyright IBM Corp. 2018, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + * + * @jest-environment node + */ + +'use strict'; + +const { SassRenderer } = require('@carbon/test-utils/scss'); + +const { render } = SassRenderer.create(__dirname); + +describe('scss/components/multiselect', () => { + test('Public API', async () => { + const { unwrap } = await render(` + @use 'sass:map'; + @use 'sass:meta'; + @use '../multiselect'; + + $_: get('mixin', meta.mixin-exists('multiselect', 'multiselect')); + `); + expect(unwrap('mixin')).toBe(true); + }); +}); diff --git a/packages/styles/scss/components/__tests__/tag-test.js b/packages/styles/scss/components/__tests__/tag-test.js new file mode 100644 index 000000000000..e9a25d746089 --- /dev/null +++ b/packages/styles/scss/components/__tests__/tag-test.js @@ -0,0 +1,25 @@ +/** + * Copyright IBM Corp. 2018, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + * + * @jest-environment node + */ + +'use strict'; + +const { SassRenderer } = require('@carbon/test-utils/scss'); + +const { render } = SassRenderer.create(__dirname); + +describe('scss/components/tag', () => { + test('Public API', async () => { + const { unwrap } = await render(` + @use 'sass:meta'; + @use '../tag/tag'; + $_: get('mixin', meta.mixin-exists('tag', 'tag')); + `); + expect(unwrap('mixin')).toBe(true); + }); +}); diff --git a/packages/styles/scss/components/_index.scss b/packages/styles/scss/components/_index.scss index b139ac1ed5bd..35a6c7e67454 100644 --- a/packages/styles/scss/components/_index.scss +++ b/packages/styles/scss/components/_index.scss @@ -28,6 +28,7 @@ @use 'data-table/expandable'; @use 'data-table/skeleton'; @use 'data-table/sort'; +@use 'tag'; @use "slider"; @use 'text-area'; @use 'text-input'; @@ -44,3 +45,7 @@ @use 'progress-indicator'; @use 'tabs'; @use 'ui-shell'; +@use 'list-box'; +@use 'combo-box'; +@use 'dropdown'; +@use 'multiselect'; diff --git a/packages/styles/scss/components/code-snippet/_code-snippet.scss b/packages/styles/scss/components/code-snippet/_code-snippet.scss index 5c7c849c4762..532c28d2fb1f 100644 --- a/packages/styles/scss/components/code-snippet/_code-snippet.scss +++ b/packages/styles/scss/components/code-snippet/_code-snippet.scss @@ -5,13 +5,12 @@ // LICENSE file in the root directory of this source tree. // -@use 'mixins' as *; -@use '../copy-button'; @use '../../config' as *; @use '../../motion' as *; @use '../../spacing' as *; -@use '../../theme' as *; +@use '../../compat/theme' as *; @use '../../type' as *; +@use '../copy-button'; @use '../../utilities/convert' as *; @use '../../utilities/focus-outline' as *; @use '../../utilities/high-contrast-mode' as *; @@ -19,6 +18,7 @@ @use '../../utilities/skeleton' as *; @use '../../utilities/tooltip' as *; @use '../../utilities/z-index' as *; +@use 'mixins' as *; /// @type Color /// @access public diff --git a/packages/styles/scss/components/combo-box/_combo-box.scss b/packages/styles/scss/components/combo-box/_combo-box.scss new file mode 100644 index 000000000000..1ec82cc6b41f --- /dev/null +++ b/packages/styles/scss/components/combo-box/_combo-box.scss @@ -0,0 +1,45 @@ +// +// Copyright IBM Corp. 2016, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@use '../list-box'; +@use '../../config' as *; +@use '../../theme' as *; + +/// Combo box styles +/// @access public +/// @group combo-box +@mixin combo-box { + .#{$prefix}--combo-box:hover { + background-color: $field; + } + + // V11: Possibly deprecate + .#{$prefix}--combo-box.#{$prefix}--list-box--light:hover { + background-color: $field-02; + } + + .#{$prefix}--combo-box .#{$prefix}--text-input::-ms-clear { + display: none; + } + + .#{$prefix}--combo-box.#{$prefix}--list-box--expanded + .#{$prefix}--text-input { + border-bottom-color: $border-subtle; + } + + .#{$prefix}--combo-box .#{$prefix}--list-box__field, + .#{$prefix}--combo-box.#{$prefix}--list-box[data-invalid] + .#{$prefix}--list-box__field, + .#{$prefix}--combo-box.#{$prefix}--list-box--warning + .#{$prefix}--list-box__field, + .#{$prefix}--combo-box.#{$prefix}--list-box--disabled.#{$prefix}--list-box[data-invalid] + .#{$prefix}--list-box__field, + .#{$prefix}--combo-box.#{$prefix}--list-box--disabled.#{$prefix}--list-box--warning + .#{$prefix}--list-box__field { + padding: 0; + } +} diff --git a/packages/styles/scss/components/combo-box/_index.scss b/packages/styles/scss/components/combo-box/_index.scss new file mode 100644 index 000000000000..944ed681931e --- /dev/null +++ b/packages/styles/scss/components/combo-box/_index.scss @@ -0,0 +1,11 @@ +// +// Copyright IBM Corp. 2018, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@forward 'combo-box'; +@use 'combo-box'; + +@include combo-box.combo-box; diff --git a/packages/styles/scss/components/data-table/expandable/_data-table-expandable.scss b/packages/styles/scss/components/data-table/expandable/_data-table-expandable.scss index a8e24e51b32d..94da558cbeda 100644 --- a/packages/styles/scss/components/data-table/expandable/_data-table-expandable.scss +++ b/packages/styles/scss/components/data-table/expandable/_data-table-expandable.scss @@ -8,7 +8,7 @@ @use '../../../config' as *; @use '../../../motion' as *; @use '../../../spacing' as *; -@use '../../../theme' as *; +@use '../../../compat/theme' as *; @use '../../../utilities/button-reset'; @use '../../../utilities/convert' as *; @use '../../../utilities/focus-outline' as *; diff --git a/packages/styles/scss/components/date-picker/_date-picker.scss b/packages/styles/scss/components/date-picker/_date-picker.scss index 98eda3df8e6e..69e77bd38473 100644 --- a/packages/styles/scss/components/date-picker/_date-picker.scss +++ b/packages/styles/scss/components/date-picker/_date-picker.scss @@ -8,7 +8,7 @@ @use '../../colors' as *; @use '../../config' as *; @use '../../motion' as *; -@use '../../theme' as *; +@use '../../compat/theme' as *; @use '../../spacing' as *; @use '../../type' as *; @use '../form/form'; diff --git a/packages/styles/scss/components/date-picker/_flatpickr.scss b/packages/styles/scss/components/date-picker/_flatpickr.scss index aaa3b250771a..762db5edb616 100644 --- a/packages/styles/scss/components/date-picker/_flatpickr.scss +++ b/packages/styles/scss/components/date-picker/_flatpickr.scss @@ -7,7 +7,7 @@ // @use '../../config' as *; @use '../../motion' as *; -@use '../../theme' as *; +@use '../../compat/theme' as *; @use '../../spacing' as *; @use '../../type' as *; @use '../../utilities/box-shadow' as *; diff --git a/packages/styles/scss/components/dropdown/_dropdown.scss b/packages/styles/scss/components/dropdown/_dropdown.scss new file mode 100644 index 000000000000..4cf3750c0338 --- /dev/null +++ b/packages/styles/scss/components/dropdown/_dropdown.scss @@ -0,0 +1,493 @@ +// +// Copyright IBM Corp. 2016, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@use '../list-box'; +@use '../../config' as *; +@use '../../motion' as *; +@use '../../spacing' as *; +@use '../../compat/theme' as *; +@use '../../type' as *; +@use '../../utilities/box-shadow' as *; +@use '../../utilities/convert' as *; +@use '../../utilities/focus-outline' as *; +@use '../../utilities/high-contrast-mode' as *; +@use '../../utilities/skeleton' as *; +@use '../../utilities/z-index' as *; + +/// Dropdown styles +/// @access public +/// @group dropdown +@mixin dropdown { + .#{$prefix}--dropdown__wrapper--inline { + display: inline-grid; + align-items: center; + grid-gap: rem(24px); + grid-template: auto auto / auto min-content; + + .#{$prefix}--label { + @include type-style('body-short-01'); + } + + .#{$prefix}--label, + .#{$prefix}--form__helper-text, + .#{$prefix}--form-requirement { + margin: 0; + } + + .#{$prefix}--form-requirement { + grid-column: 2; + } + } + + .#{$prefix}--dropdown { + @include reset; + @include focus-outline('reset'); + + position: relative; + display: block; + width: 100%; + height: rem(40px); + border: none; + border-bottom: 1px solid $border-strong; + background-color: $field; + color: $text-primary; + cursor: pointer; + list-style: none; + outline: 2px solid transparent; + transition: background-color $duration-fast-01 motion(standard, productive); + + &:hover { + background-color: $field-hover; + } + } + + // Menu's triggering element updated to button with Downshift v5 upgrade + .#{$prefix}--dropdown .#{$prefix}--list-box__field { + text-align: left; + } + + // TODO V11: Remove xl selector + .#{$prefix}--dropdown--xl, + .#{$prefix}--dropdown--lg { + height: rem(48px); + max-height: rem(48px); + } + + // TODO V11: Remove xl selector + .#{$prefix}--dropdown--xl .#{$prefix}--dropdown__arrow, + .#{$prefix}--dropdown--lg .#{$prefix}--dropdown__arrow { + top: rem(16px); + } + + .#{$prefix}--dropdown--sm { + height: rem(32px); + max-height: rem(32px); + } + + .#{$prefix}--dropdown--sm .#{$prefix}--dropdown__arrow { + top: rem(8px); + } + + .#{$prefix}--dropdown--open { + border-bottom-color: $border-subtle; + } + + .#{$prefix}--dropdown--invalid { + @include focus-outline('invalid'); + + .#{$prefix}--dropdown-text { + padding-right: rem(56px); + } + + + .#{$prefix}--form-requirement { + display: inline-block; + max-height: rem(200px); + color: $text-error; + } + } + + .#{$prefix}--dropdown__invalid-icon { + position: absolute; + top: 50%; + right: $spacing-08; + fill: $support-error; + transform: translateY(-50%); + } + + .#{$prefix}--dropdown--open:hover { + background-color: $field; + } + + .#{$prefix}--dropdown--open:focus { + outline: 1px solid transparent; + } + + .#{$prefix}--dropdown--open .#{$prefix}--dropdown-list { + @include box-shadow; + + // 40px item height * 5.5 items shown + max-height: rem(220px); + transition: max-height $duration-fast-02 motion(entrance, productive); + } + + // V11: Possibly deprecate + .#{$prefix}--dropdown--light { + background-color: $field-02; + + &:hover { + background-color: $hover-light-ui; + } + } + + .#{$prefix}--dropdown--up .#{$prefix}--dropdown-list { + bottom: 2rem; + } + + .#{$prefix}--dropdown__arrow { + position: absolute; + top: rem(13px); + right: 1rem; + fill: $icon-primary; + pointer-events: none; + transform-origin: 50% 45%; + transition: transform $duration-fast-02 motion(standard, productive); + } + + button.#{$prefix}--dropdown-text { + width: 100%; + border: none; + // button-reset mixin contradicts with bx--dropdown-text styles + background: none; + color: $text-primary; + text-align: left; + + &:focus { + @include focus-outline('outline'); + } + } + + .#{$prefix}--dropdown-text { + @include type-style('body-short-01'); + + display: block; + overflow: hidden; + // Account for the border in `.bx--dropdown` + height: calc(100% + 1px); + // 2rem + SVG width + padding-right: rem(42px); + padding-left: $spacing-05; + text-overflow: ellipsis; + white-space: nowrap; + } + + .#{$prefix}--dropdown-list { + @include reset; + @include focus-outline('reset'); + @include box-shadow; + @include type-style('body-short-01'); + + position: absolute; + z-index: z('dropdown'); + display: flex; + width: 100%; + max-height: 0; + flex-direction: column; + background-color: $layer; + list-style: none; + // NOTE: IE, Edge, and Safari do not support two value `overflow` shorthand. + overflow-x: hidden; + overflow-y: auto; + transition: max-height $duration-fast-02 motion(standard, productive); + } + + // V11: Possibly deprecate + .#{$prefix}--dropdown--light .#{$prefix}--dropdown-list { + background-color: $field-02; + } + + .#{$prefix}--dropdown:not(.#{$prefix}--dropdown--open) + .#{$prefix}--dropdown-item { + visibility: hidden; + } + + .#{$prefix}--dropdown-item { + position: relative; + opacity: 0; + transition: visibility $duration-fast-01 motion(standard, productive), + opacity $duration-fast-01 motion(standard, productive), + background-color $duration-fast-01 motion(standard, productive); + visibility: inherit; + + &:hover { + background-color: $layer-hover; + + + .#{$prefix}--dropdown-item .#{$prefix}--dropdown-link { + border-color: transparent; + } + } + + &:active { + background-color: $layer-selected; + } + + &:first-of-type .#{$prefix}--dropdown-link { + border-top-color: transparent; + } + } + + .#{$prefix}--dropdown-item:last-of-type .#{$prefix}--dropdown-link { + border-bottom: none; + } + + .#{$prefix}--dropdown-link { + @include focus-outline('reset'); + + display: block; + overflow: hidden; + height: rem(40px); + padding: rem(11px) 0; + border: 1px solid transparent; + border-top-color: $border-subtle; + margin: 0 $spacing-05; + color: $text-secondary; + font-weight: normal; + line-height: 1rem; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + + &:hover { + border-color: transparent; + color: $text-01; + } + } + + // V11: Possibly deprecate + .#{$prefix}--dropdown--light .#{$prefix}--dropdown-link { + border-top-color: $decorative-01; + } + + .#{$prefix}--dropdown--sm .#{$prefix}--dropdown-link { + height: rem(32px); + padding-top: rem(7px); + padding-bottom: rem(7px); + } + + .#{$prefix}--dropdown--xl .#{$prefix}--dropdown-link { + height: rem(48px); + padding-top: rem(15px); + padding-bottom: rem(15px); + } + + .#{$prefix}--dropdown--focused, + .#{$prefix}--dropdown-link:focus { + @include focus-outline('outline'); + + padding: rem(11px) rem(16px); + margin: 0; + } + + // We don't want to apply focus styles via focus selector when using the aria-activedescendant structure + .#{$prefix}--dropdown-list[aria-activedescendant] + .#{$prefix}--dropdown-link:focus { + // Copied from .bx--dropdown-link styles + padding: rem(11px) 0; + margin: 0 $spacing-05; + outline: none; + } + + // Need added weight for item that is :focused and .bx--dropdown--focused + .#{$prefix}--dropdown-list[aria-activedescendant] + .#{$prefix}--dropdown--focused:focus { + // copied from default focus styles + @include focus-outline('outline'); + + padding: rem(11px) rem(16px); + margin: 0; + } + + // Don't want to allow multiple elements have a "selected" style. Not sure why active + // had unique styles initially but creating an overwrite for the latest HTML markup for + // backwards compatibility. For the next major release it would be possible to clean up + // the HTML structure to prevent the user of :active and :focus styles which is creating + // these duplicated styles in the list. The Carbon 10 version of dropdown is already + // supporting 2 very different HTML structures. + .#{$prefix}--dropdown-list[aria-activedescendant] + .#{$prefix}--dropdown-item:active { + background-color: inherit; + } + + .#{$prefix}--dropdown-item:hover .#{$prefix}--dropdown-link { + border-bottom-color: $layer-hover; + } + + .#{$prefix}--dropdown--open .#{$prefix}--dropdown__arrow { + transform: rotate(-180deg); + } + + .#{$prefix}--dropdown--open.#{$prefix}--dropdown--xl + .#{$prefix}--dropdown-list { + // 48px item height * 5.5 items shown + max-height: rem(264px); + } + + .#{$prefix}--dropdown--open.#{$prefix}--dropdown--sm + .#{$prefix}--dropdown-list { + // 32px item height * 5.5 items shown + max-height: rem(176px); + } + + .#{$prefix}--dropdown--open .#{$prefix}--dropdown-item { + opacity: 1; + } + + .#{$prefix}--dropdown--disabled { + border-bottom-color: transparent; + + &:hover { + background-color: $field; + } + + &:focus { + outline: none; + } + + // TODO: remove in v11 + .#{$prefix}--dropdown-text, + .#{$prefix}--list-box__label { + color: $text-disabled; + } + + // TODO: remove in v11 + .#{$prefix}--dropdown__arrow, + .#{$prefix}--list-box__menu-icon svg { + fill: $icon-disabled; + } + + // V11: Possibly deprecate + &.#{$prefix}--dropdown--light:hover { + background-color: $field-02; + } + } + + .#{$prefix}--dropdown--disabled .#{$prefix}--list-box__field, + .#{$prefix}--dropdown--disabled .#{$prefix}--list-box__menu-icon { + cursor: not-allowed; + } + + .#{$prefix}--dropdown--auto-width { + width: auto; + max-width: rem(400px); + } + + .#{$prefix}--dropdown--inline { + display: inline-block; + width: auto; + border-bottom-color: transparent; + background-color: transparent; + justify-self: start; + transition: background $duration-fast-01 motion(entrance, productive); + + &:hover { + background-color: $field-hover; + } + + &.#{$prefix}--dropdown--disabled { + background-color: transparent; + } + + .#{$prefix}--dropdown__arrow { + top: rem(8px); + right: rem(8px); + } + } + + .#{$prefix}--dropdown--inline.#{$prefix}--dropdown--open { + background-color: transparent; + } + + .#{$prefix}--dropdown--inline .#{$prefix}--dropdown-text { + display: inline-block; + overflow: visible; + height: rem(32px); + padding: rem(7px) $spacing-07 rem(7px) $spacing-04; + color: $text-primary; + } + + .#{$prefix}--dropdown--inline.#{$prefix}--dropdown--disabled + .#{$prefix}--dropdown-text { + color: $text-disabled; + } + + .#{$prefix}--dropdown--inline.#{$prefix}--dropdown--disabled:focus + .#{$prefix}--dropdown-text { + outline: 0; + } + + .#{$prefix}--dropdown--inline.#{$prefix}--dropdown--invalid + .#{$prefix}--dropdown__invalid-icon { + right: rem(32px); + } + + .#{$prefix}--dropdown--inline.#{$prefix}--dropdown--invalid + .#{$prefix}--dropdown-text { + padding-right: rem(56px); + } + + .#{$prefix}--dropdown--inline.#{$prefix}--dropdown--open:focus + .#{$prefix}--dropdown-list { + @include box-shadow; + } + + .#{$prefix}--dropdown--inline .#{$prefix}--dropdown-link { + font-weight: normal; + } + + .#{$prefix}--dropdown--show-selected .#{$prefix}--dropdown--selected { + display: block; + background-color: $layer-hover; + color: $text-primary; + + &:hover { + background-color: $layer-selected; + } + + .#{$prefix}--dropdown-link { + border-top-color: transparent; + } + + + .#{$prefix}--dropdown-item .#{$prefix}--dropdown-link { + border-top-color: transparent; + } + + .#{$prefix}--list-box__menu-item__selected-icon { + display: block; + } + } + + // Skeleton State + .#{$prefix}--dropdown-v2.#{$prefix}--skeleton, + .#{$prefix}--dropdown.#{$prefix}--skeleton { + @include skeleton; + } + + // Windows HCM fix + // stylelint-disable-next-line no-duplicate-selectors + .#{$prefix}--dropdown .#{$prefix}--list-box__field { + @include high-contrast-mode('outline'); + } + + .#{$prefix}--list-box__menu-item__option { + @include high-contrast-mode { + outline: none; + } + } + + .#{$prefix}--list-box__menu-item__selected-icon { + @include high-contrast-mode('icon-fill'); + } +} diff --git a/packages/styles/scss/components/dropdown/_index.scss b/packages/styles/scss/components/dropdown/_index.scss new file mode 100644 index 000000000000..933aadd8b218 --- /dev/null +++ b/packages/styles/scss/components/dropdown/_index.scss @@ -0,0 +1,11 @@ +// +// Copyright IBM Corp. 2018, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@forward 'dropdown'; +@use 'dropdown'; + +@include dropdown.dropdown; diff --git a/packages/styles/scss/components/list-box/_index.scss b/packages/styles/scss/components/list-box/_index.scss new file mode 100644 index 000000000000..2a19f693f111 --- /dev/null +++ b/packages/styles/scss/components/list-box/_index.scss @@ -0,0 +1,11 @@ +// +// Copyright IBM Corp. 2018, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@forward 'list-box'; +@use 'list-box'; + +@include list-box.list-box; diff --git a/packages/styles/scss/components/list-box/_list-box.scss b/packages/styles/scss/components/list-box/_list-box.scss new file mode 100644 index 000000000000..7708c724fb59 --- /dev/null +++ b/packages/styles/scss/components/list-box/_list-box.scss @@ -0,0 +1,821 @@ +// +// Copyright IBM Corp. 2016, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@use '../button/tokens' as *; +@use '../text-input'; +@use '../tag'; +@use '../tag/mixins' as *; +@use '../../config' as *; +@use '../../colors' as *; +@use '../../compat/theme' as *; +@use '../../type' as *; +@use '../../spacing' as *; +@use '../../motion' as *; +@use '../../utilities/box-shadow' as *; +@use '../../utilities/button-reset'; +@use '../../utilities/convert' as *; +@use '../../utilities/focus-outline' as *; +@use '../../utilities/high-contrast-mode' as *; +@use '../../utilities/z-index' as *; + +/// @type Number +/// @access public +/// @group list-box +$list-box-width: 100%; + +/// @type Number +/// @access public +/// @group list-box +$list-box-height: rem(40px); + +/// @type Number +/// @access public +/// @group list-box +$list-box-inline-height: $list-box-height; + +/// @type Number +/// @access public +/// @group list-box +$list-box-menu-width: rem(300px); + +/// List box styles +/// @access public +/// @group list-box +@mixin list-box { + // The overall container element for a `list-box`. Has two variants, + // `disabled` and `inline`. + .#{$prefix}--list-box__wrapper--inline { + display: inline-grid; + align-items: center; + grid-gap: rem(4px); + grid-template: auto auto / auto auto; + + .#{$prefix}--label { + @include type-style('body-short-01'); + } + + .#{$prefix}--label, + .#{$prefix}--form__helper-text, + .#{$prefix}--form-requirement { + margin: 0; + } + + .#{$prefix}--form__helper-text { + max-width: none; + } + + .#{$prefix}--form-requirement { + grid-column: 2; + } + } + + .#{$prefix}--list-box { + @include reset; + + position: relative; + width: $list-box-width; + height: rem(40px); + max-height: rem(40px); + border: none; + border-bottom: 1px solid $border-strong; + background-color: $field; + color: $text-primary; + cursor: pointer; + transition: all $duration-fast-01 motion(standard, productive); + + &:hover { + background-color: $field-hover; + } + } + + // TODO V11: Remove xl selector + .#{$prefix}--list-box--xl, + .#{$prefix}--list-box--lg { + height: rem(48px); + max-height: rem(48px); + } + + .#{$prefix}--list-box--sm { + height: rem(32px); + max-height: rem(32px); + } + + .#{$prefix}--list-box--expanded { + border-bottom-color: $border-subtle; + } + + .#{$prefix}--list-box--expanded:hover { + background-color: $field; + } + + // V11: Possibly deprecate + .#{$prefix}--list-box--expanded:hover.#{$prefix}--list-box--light:hover { + background-color: $field-02; + } + + .#{$prefix}--list-box .#{$prefix}--text-input { + min-width: 0; + height: 100%; + } + + // invalid states + .#{$prefix}--list-box__invalid-icon { + position: absolute; + top: 50%; + right: $spacing-08; + fill: $support-error; + transform: translateY(-50%); + } + + .#{$prefix}--list-box__invalid-icon--warning { + fill: $support-warning; + } + + .#{$prefix}--list-box__invalid-icon--warning path[fill] { + fill: $black-100; + opacity: 1; + } + + .#{$prefix}--list-box[data-invalid] .#{$prefix}--list-box__field, + .#{$prefix}--list-box.#{$prefix}--list-box--warning + .#{$prefix}--list-box__field { + padding-right: $spacing-10; + border-bottom: 0; + } + + .#{$prefix}--list-box[data-invalid].#{$prefix}--list-box--inline + .#{$prefix}--list-box__field { + padding-right: rem(56px); + } + + // V11: Possibly deprecate + // Light variation for 'list-box' + .#{$prefix}--list-box--light { + background-color: $field-02; + + &:hover { + background-color: $hover-light-ui; + } + } + + // V11: Possibly deprecate + .#{$prefix}--list-box--light .#{$prefix}--list-box__menu { + background: $field-02; + } + + // V11: Possibly deprecate + .#{$prefix}--list-box--light .#{$prefix}--list-box__menu-item__option { + border-top-color: $decorative-01; + } + + .#{$prefix}--list-box--light.#{$prefix}--list-box--expanded { + border-bottom-color: transparent; + } + + // Disabled state for `list-box` + .#{$prefix}--list-box--disabled:hover { + background-color: $field; + } + + // V11: Possibly deprecate + .#{$prefix}--list-box--light.#{$prefix}--list-box--disabled { + background-color: $field-02; + } + + .#{$prefix}--list-box--disabled, + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__field, + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__field:focus { + border-bottom-color: transparent; + outline: none; + } + + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__label, + .#{$prefix}--list-box--disabled.#{$prefix}--list-box--inline + .#{$prefix}--list-box__label { + color: $text-disabled; + } + + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__menu-icon > svg, + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__selection > svg { + fill: $icon-disabled; + } + + .#{$prefix}--list-box--disabled, + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__field, + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__menu-icon { + cursor: not-allowed; + } + + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__menu-item, + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__menu-item:hover, + .#{$prefix}--list-box--disabled + .#{$prefix}--list-box__menu-item--highlighted { + color: $text-disabled; + text-decoration: none; + } + + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__selection:hover { + cursor: not-allowed; + } + + // disabled && invalid + .#{$prefix}--list-box--disabled.#{$prefix}--list-box[data-invalid] + .#{$prefix}--list-box__field { + padding-right: $spacing-09; + } + + .#{$prefix}--list-box--disabled.#{$prefix}--list-box[data-invalid].#{$prefix}--list-box--inline + .#{$prefix}--list-box__field { + padding-right: $spacing-07; + } + + // Inline variant for a `list-box` + .#{$prefix}--list-box.#{$prefix}--list-box--inline { + border-width: 0; + background-color: transparent; + + &:hover { + background-color: $field-hover; + } + } + + .#{$prefix}--list-box.#{$prefix}--list-box--inline.#{$prefix}--list-box--expanded { + border-bottom-width: 0; + } + + .#{$prefix}--list-box.#{$prefix}--list-box--inline.#{$prefix}--list-box--expanded + .#{$prefix}--list-box__field[aria-expanded='true'] { + border-width: 0; + } + + .#{$prefix}--list-box.#{$prefix}--list-box--inline.#{$prefix}--list-box--expanded:hover, + .#{$prefix}--list-box.#{$prefix}--list-box--inline.#{$prefix}--list-box--disabled:hover { + background-color: transparent; + } + + .#{$prefix}--list-box.#{$prefix}--list-box--inline + .#{$prefix}--list-box__field { + padding: 0 $spacing-07 0 $spacing-03; + } + + .#{$prefix}--list-box.#{$prefix}--list-box--inline + .#{$prefix}--list-box__menu-icon { + right: $spacing-03; + } + + .#{$prefix}--list-box.#{$prefix}--list-box--inline + .#{$prefix}--list-box__invalid-icon { + right: $spacing-07; + } + + .#{$prefix}--list-box--inline .#{$prefix}--list-box__label { + color: $text-primary; + } + + .#{$prefix}--list-box--inline .#{$prefix}--list-box__field { + height: 100%; + } + + .#{$prefix}--dropdown--inline .#{$prefix}--list-box__field { + max-width: rem(480px); + } + + .#{$prefix}--dropdown--inline .bx--list-box__menu { + min-width: rem(288px); + max-width: rem(480px); + } + + // The field we use for input, showing selection, etc. + .#{$prefix}--list-box__field { + @include button-reset.reset; + + position: relative; + display: inline-flex; + overflow: hidden; + // Account for the border in `.bx--list-box` + height: calc(100% + 1px); + align-items: center; + padding: 0 $spacing-09 0 $spacing-05; + cursor: pointer; + outline: none; + text-overflow: ellipsis; + vertical-align: top; + white-space: nowrap; + } + + .#{$prefix}--list-box__field:focus { + @include focus-outline('outline'); + } + + .#{$prefix}--list-box__field[disabled] { + color: $text-disabled; + outline: none; + } + + // populated input field + .#{$prefix}--list-box__field .#{$prefix}--text-input { + padding-right: rem(72px); + } + + // invalid && populated input field + .#{$prefix}--list-box[data-invalid] + .#{$prefix}--list-box__field + .#{$prefix}--text-input, + .#{$prefix}--list-box--warning + .#{$prefix}--list-box__field + .#{$prefix}--text-input { + // to account for clear input button outline + padding-right: rem(98px); + } + + .#{$prefix}--list-box[data-invalid] + .#{$prefix}--list-box__field + .#{$prefix}--text-input + + .#{$prefix}--list-box__invalid-icon, + .#{$prefix}--list-box--warning + .#{$prefix}--list-box__field + .#{$prefix}--text-input + + .#{$prefix}--list-box__invalid-icon { + // to account for clear input button outline + right: rem(66px); + } + + // empty input field + .#{$prefix}--list-box__field .#{$prefix}--text-input--empty { + padding-right: $spacing-09; + } + + // invalid && empty input field + .#{$prefix}--list-box[data-invalid] + .#{$prefix}--list-box__field + .#{$prefix}--text-input--empty, + .#{$prefix}--list-box--warning + .#{$prefix}--list-box__field + .#{$prefix}--text-input--empty { + padding-right: carbon--mini-units(9); + } + + .#{$prefix}--list-box[data-invalid] + .#{$prefix}--list-box__field + .#{$prefix}--text-input--empty + + .#{$prefix}--list-box__invalid-icon, + .#{$prefix}--list-box--warning + .#{$prefix}--list-box__field + .#{$prefix}--text-input--empty + + .#{$prefix}--list-box__invalid-icon { + // to account for clear input button outline + right: rem(40px); + } + + // Label for a `list-box__field` + .#{$prefix}--list-box__label { + @include type-style('body-short-01'); + + overflow: hidden; + color: $text-primary; + text-overflow: ellipsis; + user-select: none; + white-space: nowrap; + } + + // Menu status inside of a `list-box__field` + .#{$prefix}--list-box__menu-icon { + @include button-reset.reset($width: false); + + position: absolute; + right: $spacing-05; + display: flex; + width: rem(24px); + height: rem(24px); + align-items: center; + justify-content: center; + cursor: pointer; + outline: none; + transition: transform $duration-fast-01 motion(standard, productive); + } + + .#{$prefix}--list-box__menu-icon > svg { + fill: $icon-primary; + } + + .#{$prefix}--list-box__menu-icon--open { + width: rem(24px); + justify-content: center; + transform: rotate(180deg); + } + + // Selection indicator for a `list-box__field` + .#{$prefix}--list-box__selection { + @include button-reset.reset($width: false); + + position: absolute; + top: 50%; + /* to preserve .5rem space between icons according to spec top/transform used to center the combobox clear selection icon in IE11 */ + right: rem(36px); + display: flex; + width: rem(24px); + height: rem(24px); + align-items: center; + justify-content: center; + cursor: pointer; + transform: translateY(-50%); + transition: background-color $duration-fast-01 motion(standard, productive); + user-select: none; + + &:focus { + @include focus-outline('outline'); + + &:hover { + @include focus-outline('outline'); + } + } + } + + .#{$prefix}--list-box__selection > svg { + fill: $icon-primary; + } + + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__selection:focus { + outline: none; + } + + // Modifier for a selection to show that multiple selections have been made + .#{$prefix}--list-box__selection--multi { + @include type-style('label-01'); + + position: static; + top: auto; + display: flex; + width: auto; + height: rem(24px); + align-items: center; + justify-content: space-between; + padding: rem(8px); + // Align with hover circle of X button + padding-right: rem(2px); + margin-right: rem(10px); + background-color: $background-inverse; + border-radius: rem(12px); + color: $text-inverse; + line-height: 0; + transform: none; + } + + .#{$prefix}--list-box__selection--multi > svg { + width: rem(20px); + height: rem(20px); + padding: rem(2px); + margin-left: rem(4px); + fill: $icon-inverse; + + &:hover { + background-color: $button-secondary-hover; + border-radius: 50%; + } + } + + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__selection--multi { + @include tag-theme($text-disabled, $field-disabled); + + > svg { + fill: $icon-disabled; + + &:hover { + background-color: initial; + } + } + } + + .#{$prefix}--list-box__selection--multi:hover { + outline: none; + } + + // Descendant of a `list-box` that displays a list of options to select + .#{$prefix}--list-box__menu { + @include box-shadow(); + + position: absolute; + z-index: z('dropdown'); + right: 0; + left: 0; + width: $list-box-width; + background-color: $layer; + overflow-y: auto; + transition: max-height $duration-fast-02 motion(standard, productive); + + &:focus { + // remove default browser focus in firefox + @include focus-outline('border'); + } + } + + .#{$prefix}--list-box + .#{$prefix}--list-box__field[aria-expanded='false'] + + .#{$prefix}--list-box__menu { + max-height: 0; + } + + .#{$prefix}--list-box--expanded .#{$prefix}--list-box__menu { + // 40px item height * 5.5 items shown + max-height: rem(220px); + } + + // TODO V11: Remove xl selector + .#{$prefix}--list-box--expanded.#{$prefix}--list-box--xl + .#{$prefix}--list-box__menu, + .#{$prefix}--list-box--expanded.#{$prefix}--list-box--lg + .#{$prefix}--list-box__menu { + // 48px item height * 5.5 items shown + max-height: rem(264px); + } + + .#{$prefix}--list-box--expanded.#{$prefix}--list-box--sm + .#{$prefix}--list-box__menu { + // 32px item height * 5.5 items shown + max-height: rem(176px); + } + + // Descendant of a `list-box__menu` that represents a selection for a control + .#{$prefix}--list-box__menu-item { + @include type-style('body-short-01'); + + position: relative; + height: rem(40px); + color: $text-secondary; + cursor: pointer; + transition: background $duration-fast-01 motion(standard, productive); + user-select: none; + + &:hover { + background-color: $layer-hover; + } + + &:active { + background-color: $layer-selected; + } + } + + // V11: Possibly deprecate + .#{$prefix}--list-box--light .#{$prefix}--list-box__menu-item:hover { + background-color: $hover-light-ui; + } + + .#{$prefix}--list-box--sm .#{$prefix}--list-box__menu-item { + height: rem(32px); + } + + // TODO V11: Remove xl selector + .#{$prefix}--list-box--xl .#{$prefix}--list-box__menu-item, + .#{$prefix}--list-box--lg .#{$prefix}--list-box__menu-item { + height: rem(48px); + } + + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__menu-item:hover { + background-color: transparent; + } + + // V11: Possibly deprecate + .#{$prefix}--list-box--light .#{$prefix}--list-box__menu-item:active { + // To Do: What should this variable be? + // background-color: $selected-light-ui; + } + + .#{$prefix}--list-box--disabled + .#{$prefix}--list-box__menu-item__option:hover { + border-top-color: $border-subtle; + } + + .#{$prefix}--list-box__menu-item:first-of-type + .#{$prefix}--list-box__menu-item__option { + border-top-color: transparent; + } + + .#{$prefix}--list-box__menu-item:hover + .#{$prefix}--list-box__menu-item__option { + color: $text-primary; + } + + .#{$prefix}--list-box__menu-item:hover + + .#{$prefix}--list-box__menu-item + .#{$prefix}--list-box__menu-item__option { + border-top-color: transparent; + } + + .#{$prefix}--list-box--disabled + .#{$prefix}--list-box__menu-item:hover + + .#{$prefix}--list-box__menu-item + .#{$prefix}--list-box__menu-item__option { + border-top-color: $border-subtle; + } + + .#{$prefix}--list-box__menu-item__option { + @include focus-outline('reset'); + + display: block; + overflow: hidden; + height: rem(40px); + padding: rem(11px) 0; + padding-right: $spacing-06; + border-top: 1px solid transparent; + border-top-color: $border-subtle; + border-bottom: 1px solid transparent; + margin: 0 $spacing-05; + color: $text-secondary; + font-weight: normal; + line-height: 1rem; + text-decoration: none; + text-overflow: ellipsis; + transition: border-color $duration-fast-01 motion(standard, productive), + color $duration-fast-01 motion(standard, productive); + white-space: nowrap; + + &:focus { + @include focus-outline('outline'); + + padding: rem(11px) rem(16px); + border-color: transparent; + margin: 0; + } + + &:hover { + border-color: transparent; + color: $text-primary; + } + } + + .#{$prefix}--list-box--sm .#{$prefix}--list-box__menu-item__option { + height: rem(32px); + padding-top: rem(7px); + padding-bottom: rem(7px); + } + + // TODO V11: Remove xl selector + .#{$prefix}--list-box--xl .#{$prefix}--list-box__menu-item__option, + .#{$prefix}--list-box--lg .#{$prefix}--list-box__menu-item__option { + height: rem(48px); + padding-top: rem(15px); + padding-bottom: rem(15px); + } + + .#{$prefix}--list-box--disabled + .#{$prefix}--list-box__menu-item:hover + .#{$prefix}--list-box__menu-item__option, + .#{$prefix}--list-box--disabled .#{$prefix}--list-box__menu-item__option { + color: $text-disabled; + } + + .#{$prefix}--list-box.#{$prefix}--list-box--inline + .#{$prefix}--list-box__menu-item__option { + margin: 0 $spacing-03; + + &:focus { + padding-right: $spacing-03; + padding-left: $spacing-03; + margin: 0; + } + } + + .#{$prefix}--list-box__menu-item--highlighted { + border-color: transparent; + background-color: $layer-hover; + color: $text-primary; + } + + .#{$prefix}--list-box__menu-item--highlighted + .#{$prefix}--list-box__menu-item__option, + .#{$prefix}--list-box__menu-item--highlighted + + .#{$prefix}--list-box__menu-item + .#{$prefix}--list-box__menu-item__option { + border-top-color: transparent; + } + + .#{$prefix}--list-box__menu-item--highlighted + .#{$prefix}--list-box__menu-item__option { + color: $text-primary; + } + + .#{$prefix}--list-box__menu-item--active { + border-bottom-color: $layer-selected; + background-color: $layer-selected; + color: $text-primary; + } + + // V11: Possibly deprecate + .#{$prefix}--list-box--light .#{$prefix}--list-box__menu-item--active { + // To Do: What should this token be? + // border-bottom-color: $selected-light-ui; + // background-color: $selected-light-ui; + } + + .#{$prefix}--list-box__menu-item--active:hover, + .#{$prefix}--list-box__menu-item--active.#{$prefix}--list-box__menu-item--highlighted { + border-bottom-color: $layer-selected; + background-color: $layer-selected; + } + + .#{$prefix}--list-box__menu-item--active + .#{$prefix}--list-box__menu-item__option { + color: $text-primary; + } + + // Hide top border if previous list item is selected + .#{$prefix}--list-box__menu-item--active + + .#{$prefix}--list-box__menu-item + > .#{$prefix}--list-box__menu-item__option { + border-top-color: transparent; + } + + .#{$prefix}--list-box__menu-item__selected-icon { + position: absolute; + top: 50%; + right: rem(16px); + display: none; + fill: $icon-primary; + transform: translateY(-50%); + } + + .#{$prefix}--list-box--inline + .#{$prefix}--list-box__menu-item__selected-icon { + right: rem(8px); + } + + .#{$prefix}--list-box__menu-item--active + .#{$prefix}--list-box__menu-item__selected-icon { + display: block; + } + + .#{$prefix}--list-box__menu-item .#{$prefix}--checkbox-label { + width: 100%; + } + + .#{$prefix}--list-box__menu-item .#{$prefix}--checkbox-label-text { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + // Dropdown top orientation modifiers + .#{$prefix}--list-box--up .#{$prefix}--list-box__menu { + bottom: 2.5rem; + } + + .#{$prefix}--list-box--up.#{$prefix}--dropdown--sm + .#{$prefix}--list-box__menu, + .#{$prefix}--list-box--up.#{$prefix}--list-box--sm + .#{$prefix}--list-box__menu, + .#{$prefix}--list-box--up + .#{$prefix}--list-box--sm + .#{$prefix}--list-box__menu { + bottom: 2rem; + } + + // TODO V11: Remove xl selector + .#{$prefix}--list-box--up.#{$prefix}--dropdown--xl + .#{$prefix}--list-box__menu, + .#{$prefix}--list-box--up.#{$prefix}--list-box--xl + .#{$prefix}--list-box__menu, + .#{$prefix}--list-box--up.#{$prefix}--dropdown--lg + .#{$prefix}--list-box__menu, + .#{$prefix}--list-box--up.#{$prefix}--list-box--lg + .#{$prefix}--list-box__menu, + .#{$prefix}--list-box--up + .#{$prefix}--list-box--lg + .#{$prefix}--list-box__menu { + bottom: 3rem; + } + + // Tweaks for descendants + // When handling input, we need to target nodes that specifically opt-in to + // the type text in order to make sure the text input is styled + // correctly. + // TODO: remove [role='combobox'] in v11 + .#{$prefix}--list-box input[role='combobox'], + .#{$prefix}--list-box input[type='text'] { + min-width: 0; + background-color: inherit; + } + + // Windows HCM fix + .#{$prefix}--list-box__field, + .#{$prefix}--list-box__menu, + .#{$prefix}--multi-select .#{$prefix}--tag--filter { + @include high-contrast-mode('outline'); + } + + .#{$prefix}--list-box__field:focus, + .#{$prefix}--multi-select .#{$prefix}--tag__close-icon:focus, + .#{$prefix}--list-box__menu-item--highlighted + .#{$prefix}--list-box__menu-item__option { + @include high-contrast-mode('focus'); + } + + .#{$prefix}--list-box__menu-icon > svg, + .#{$prefix}--list-box__selection > svg, + .#{$prefix}--list-box__selection--multi > svg { + @include high-contrast-mode('icon-fill'); + } +} diff --git a/packages/styles/scss/components/multiselect/_index.scss b/packages/styles/scss/components/multiselect/_index.scss new file mode 100644 index 000000000000..cbeac0ee0bc5 --- /dev/null +++ b/packages/styles/scss/components/multiselect/_index.scss @@ -0,0 +1,11 @@ +// +// Copyright IBM Corp. 2018, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@forward 'multiselect'; +@use 'multiselect'; + +@include multiselect.multiselect; diff --git a/packages/styles/scss/components/multiselect/_multiselect.scss b/packages/styles/scss/components/multiselect/_multiselect.scss new file mode 100644 index 000000000000..978954ae00f4 --- /dev/null +++ b/packages/styles/scss/components/multiselect/_multiselect.scss @@ -0,0 +1,103 @@ +// +// Copyright IBM Corp. 2016, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@use '../list-box'; +@use '../../config' as *; +@use '../../motion' as *; +@use '../../spacing' as *; +@use '../../theme' as *; +@use '../../utilities/convert' as *; +@use '../../utilities/focus-outline' as *; + +/// Multi select styles +/// @access public +/// @group multi-select +@mixin multiselect { + .#{$prefix}--multi-select .#{$prefix}--tag { + min-width: auto; + margin: 0 $spacing-03 0 0; + } + + .#{$prefix}--multi-select--filterable .#{$prefix}--tag { + margin: 0 $spacing-03 0 $spacing-05; + } + + .#{$prefix}--multi-select .#{$prefix}--list-box__menu { + min-width: auto; + } + + .#{$prefix}--multi-select + .#{$prefix}--list-box__menu-item__option + .#{$prefix}--checkbox-wrapper { + display: flex; + width: 100%; + height: 100%; + align-items: center; + } + + .#{$prefix}--multi-select + .#{$prefix}--list-box__menu-item__option + .#{$prefix}--checkbox-label { + display: inline-block; + overflow: hidden; + width: 100%; + padding-left: rem(28px); + text-overflow: ellipsis; + white-space: nowrap; + } + + .#{$prefix}--multi-select + .#{$prefix}--list-box__menu-item__option + > .#{$prefix}--form-item { + flex-direction: row; + margin: 0; + } + + .#{$prefix}--multi-select + .#{$prefix}--list-box__menu-item + .#{$prefix}--checkbox:checked + ~ .#{$prefix}--checkbox-label-text { + color: $text-primary; + } + + .#{$prefix}--multi-select--filterable { + transition: outline-color $duration-fast-01 motion(standard, productive); + } + + .#{$prefix}--multi-select--filterable.#{$prefix}--combo-box + .#{$prefix}--text-input { + border: rem(2px) solid transparent; + background-clip: padding-box; + outline: none; + } + + .#{$prefix}--multi-select--filterable--input-focused { + @include focus-outline('outline'); + } + + .#{$prefix}--multi-select--filterable.#{$prefix}--multi-select--selected + .#{$prefix}--text-input { + padding-left: 0; + } + + .#{$prefix}--multi-select--filterable.#{$prefix}--list-box--disabled:hover + .#{$prefix}--text-input { + background-color: $field; + } + + .#{$prefix}--multi-select--filterable + .#{$prefix}--list-box__selection--multi { + margin: 0 0 0 $spacing-05; + } + + .#{$prefix}--multi-select--filterable.#{$prefix}--multi-select--inline, + .#{$prefix}--multi-select--filterable.#{$prefix}--multi-select--inline + .#{$prefix}--text-input { + border-bottom: 0; + background-color: transparent; + } +} diff --git a/packages/styles/scss/components/number-input/_number-input.scss b/packages/styles/scss/components/number-input/_number-input.scss index 5b9d2104cf99..f2e709458ecf 100644 --- a/packages/styles/scss/components/number-input/_number-input.scss +++ b/packages/styles/scss/components/number-input/_number-input.scss @@ -9,7 +9,7 @@ @use '../../config' as *; @use '../../motion' as *; @use '../../spacing' as *; -@use '../../theme' as *; +@use '../../compat/theme' as *; @use '../../type' as *; @use '../../utilities/skeleton' as *; @use '../../utilities/button-reset'; diff --git a/packages/styles/scss/components/overflow-menu/_overflow-menu.scss b/packages/styles/scss/components/overflow-menu/_overflow-menu.scss index e9bb40f2f05b..f218a92b9029 100644 --- a/packages/styles/scss/components/overflow-menu/_overflow-menu.scss +++ b/packages/styles/scss/components/overflow-menu/_overflow-menu.scss @@ -8,7 +8,7 @@ @use '../../config' as *; @use '../../motion' as *; @use '../../spacing' as *; -@use '../../theme' as *; +@use '../../compat/theme' as *; @use '../../type' as *; @use '../button/tokens' as button; @use '../../utilities/box-shadow' as *; diff --git a/packages/styles/scss/components/radio-button/_radio-button.scss b/packages/styles/scss/components/radio-button/_radio-button.scss index 5182108af1e1..337b36b19213 100644 --- a/packages/styles/scss/components/radio-button/_radio-button.scss +++ b/packages/styles/scss/components/radio-button/_radio-button.scss @@ -9,7 +9,7 @@ // Radio //----------------------------- -@use '../../theme' as *; +@use '../../compat/theme' as *; @use '../../type'; @use '../form'; @use '../../utilities/focus-outline' as *; diff --git a/packages/styles/scss/components/search/_search.scss b/packages/styles/scss/components/search/_search.scss index 90c7669ab860..551ebbc9bc96 100644 --- a/packages/styles/scss/components/search/_search.scss +++ b/packages/styles/scss/components/search/_search.scss @@ -9,7 +9,7 @@ // Search //----------------------------- -@use '../../theme' as *; +@use '../../compat/theme' as *; @use '../../config' as *; @use '../../type'; @use '../../motion' as *; diff --git a/packages/styles/scss/components/structured-list/_structured-list.scss b/packages/styles/scss/components/structured-list/_structured-list.scss index da276b6a2a52..08a64f15cc9d 100644 --- a/packages/styles/scss/components/structured-list/_structured-list.scss +++ b/packages/styles/scss/components/structured-list/_structured-list.scss @@ -9,7 +9,7 @@ @use '../../feature-flags' as *; @use "../../type" as *; @use '../../motion'; -@use '../../theme' as *; +@use '../../compat/theme' as *; @use "../../utilities/focus-outline" as *; @use "../../utilities/skeleton" as *; @use "../../utilities/high-contrast-mode" as *; diff --git a/packages/styles/scss/components/tag/_index.scss b/packages/styles/scss/components/tag/_index.scss new file mode 100644 index 000000000000..30e0fc791dbd --- /dev/null +++ b/packages/styles/scss/components/tag/_index.scss @@ -0,0 +1,12 @@ +// +// Copyright IBM Corp. 2018, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@forward 'tag'; +@forward 'tokens'; +@use 'tag'; + +@include tag.tag; diff --git a/packages/styles/scss/components/tag/_mixins.scss b/packages/styles/scss/components/tag/_mixins.scss new file mode 100644 index 000000000000..3e292524143d --- /dev/null +++ b/packages/styles/scss/components/tag/_mixins.scss @@ -0,0 +1,21 @@ +// +// Copyright IBM Corp. 2016, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// +@use '../../config' as *; + +/// @access private +/// @group tag +@mixin tag-theme($bg-color, $text-color, $filter-hover-color: $bg-color) { + background-color: $bg-color; + color: $text-color; + + &.#{$prefix}--tag--interactive, + .#{$prefix}--tag__close-icon { + &:hover { + background-color: $filter-hover-color; + } + } +} diff --git a/packages/styles/scss/components/tag/_tag.scss b/packages/styles/scss/components/tag/_tag.scss new file mode 100644 index 000000000000..afae0067527d --- /dev/null +++ b/packages/styles/scss/components/tag/_tag.scss @@ -0,0 +1,268 @@ +// +// Copyright IBM Corp. 2016, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@use '../../theme' as *; +@use '../../utilities/button-reset'; +@use '../../type' as *; +@use '../../motion' as *; +@use '../../config' as *; +@use '../../utilities/component-tokens' as *; +@use '../../utilities/convert' as *; +@use '../../utilities/high-contrast-mode' as *; +@use '../../spacing' as *; +@use './tokens' as *; +@use './mixins' as *; +@use '../../utilities/skeleton'; + +/// Tag styles +/// @access public +/// @group tag +@mixin tag { + .#{$prefix}--tag { + @include type-style('label-01'); + @include tag-theme($tag-background-gray, $tag-color-gray, $tag-hover-gray); + + display: inline-flex; + // ensures tag stays pill shaped; + min-width: rem(32px); + // restricts size of contained elements + max-width: 100%; + min-height: rem(24px); + align-items: center; + justify-content: center; + padding: $spacing-02 $spacing-03; + margin: $spacing-02; + border-radius: rem(15px); + cursor: default; + vertical-align: middle; + word-break: break-word; + + &:not(:first-child) { + margin-left: 0; + } + } + + .#{$prefix}--tag--red { + @include tag-theme($tag-background-red, $tag-color-red, $tag-hover-red); + } + + .#{$prefix}--tag--magenta { + @include tag-theme( + $tag-background-magenta, + $tag-color-magenta, + $tag-hover-magenta + ); + } + + .#{$prefix}--tag--purple { + @include tag-theme( + $tag-background-purple, + $tag-color-purple, + $tag-hover-purple + ); + } + + .#{$prefix}--tag--blue { + @include tag-theme($tag-background-blue, $tag-color-blue, $tag-hover-blue); + } + + .#{$prefix}--tag--cyan { + @include tag-theme($tag-background-cyan, $tag-color-cyan, $tag-hover-cyan); + } + + .#{$prefix}--tag--teal { + @include tag-theme($tag-background-teal, $tag-color-teal, $tag-hover-teal); + } + + .#{$prefix}--tag--green { + @include tag-theme( + $tag-background-green, + $tag-color-green, + $tag-hover-green + ); + } + + .#{$prefix}--tag--gray { + @include tag-theme($tag-background-gray, $tag-color-gray, $tag-hover-gray); + } + + .#{$prefix}--tag--cool-gray { + @include tag-theme( + $tag-background-cool-gray, + $tag-color-cool-gray, + $tag-hover-cool-gray + ); + } + + .#{$prefix}--tag--warm-gray { + @include tag-theme( + $tag-background-warm-gray, + $tag-color-warm-gray, + $tag-hover-warm-gray + ); + } + + .#{$prefix}--tag--high-contrast { + @include tag-theme( + $background-inverse, + $text-inverse, + $background-inverse-hover + ); + } + + .#{$prefix}--tag--disabled, + .#{$prefix}--tag--filter.#{$prefix}--tag--disabled, + .#{$prefix}--tag--interactive.#{$prefix}--tag--disabled { + @include tag-theme($layer-disabled, $text-disabled); + + &:hover { + cursor: not-allowed; + } + } + + .#{$prefix}--tag__label { + overflow: hidden; + max-width: 100%; + text-overflow: ellipsis; + white-space: nowrap; + } + + .#{$prefix}--tag--interactive:focus { + box-shadow: inset 0 0 0 1px $focus; + outline: none; + } + + .#{$prefix}--tag--interactive:hover { + cursor: pointer; + } + + // tags used for filtering + .#{$prefix}--tag--filter { + padding-top: 0; + padding-right: 0; + padding-bottom: 0; + cursor: pointer; + + &:hover { + outline: none; + } + } + + .#{$prefix}--tag--interactive { + transition: background-color $duration-fast-01 motion(entrance, productive); + } + + .#{$prefix}--tag__close-icon { + display: flex; + width: rem(24px); + height: rem(24px); + flex-shrink: 0; + align-items: center; + justify-content: center; + padding: 0; + border: 0; + margin: 0 0 0 rem(2px); + background-color: transparent; + border-radius: 50%; + color: currentColor; + cursor: pointer; + transition: background-color $duration-fast-01 motion(standard, productive), + box-shadow $duration-fast-01 motion(standard, productive); + svg { + fill: currentColor; + } + } + + .#{$prefix}--tag__custom-icon { + width: rem(16px); + height: rem(16px); + flex-shrink: 0; + padding: 0; + border: 0; + margin-right: $spacing-02; + background-color: transparent; + color: currentColor; + outline: none; + + svg { + fill: currentColor; + } + } + + .#{$prefix}--tag--disabled .#{$prefix}--tag__close-icon { + cursor: not-allowed; + } + + .#{$prefix}--tag__close-icon:focus { + border-radius: 50%; + box-shadow: inset 0 0 0 1px $focus; + outline: none; + } + + .#{$prefix}--tag--high-contrast .#{$prefix}--tag__close-icon:focus { + box-shadow: inset 0 0 0 1px $focus-inverse; + } + + .#{$prefix}--tag--filter.#{$prefix}--tag--disabled + .#{$prefix}--tag__close-icon:hover { + background-color: transparent; + } + + .#{$prefix}--tag--filter.#{$prefix}--tag--disabled svg { + fill: $icon-disabled; + } + + // small tags + .#{$prefix}--tag--sm { + min-height: rem(18px); + padding: 0 $spacing-03; + } + + .#{$prefix}--tag--sm.#{$prefix}--tag--filter { + padding-right: 0; + } + + .#{$prefix}--tag--sm .#{$prefix}--tag__close-icon { + width: rem(18px); + height: rem(18px); + margin-left: rem(5px); + } + + // Skeleton state + .#{$prefix}--tag.#{$prefix}--skeleton { + @include tag-theme( + $bg-color: $skeleton-background, + $text-color: $text-primary + ); + + overflow: hidden; + width: rem(60px); + + // Safari specific bug (#7672) + @media not all and (min-resolution: 0.001dpcm) { + @supports (-webkit-appearance: none) and (stroke-color: transparent) { + transform: translateZ(0); + } + } + } + + // Windows HCM fix + /* stylelint-disable */ + .#{$prefix}--tag { + @include high-contrast-mode('outline'); + } + + .#{$prefix}--tag__close-icon svg, + .#{$prefix}--tag__custom-icon svg { + @include high-contrast-mode('icon-fill'); + } + + .#{$prefix}--tag__close-icon:focus { + @include high-contrast-mode('focus'); + } + /* stylelint-enable */ +} diff --git a/packages/styles/scss/components/tag/_tokens.scss b/packages/styles/scss/components/tag/_tokens.scss new file mode 100644 index 000000000000..af569318c252 --- /dev/null +++ b/packages/styles/scss/components/tag/_tokens.scss @@ -0,0 +1,702 @@ +// +// Copyright IBM Corp. 2020 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@use 'sass:color'; +@use '../../colors'; +@use '../../theme' as *; +@use '../../themes'; +@use '../../utilities/component-tokens'; +@use '../../utilities/custom-property'; + +// prettier-ignore +$-tokens: ( + // red + 'tag-background-red': ( + fallback: colors.$red-20, + values: ( + ( + theme: themes.$white, + value: colors.$red-20, + ), + ( + theme: themes.$g10, + value: colors.$red-20, + ), + ( + theme: themes.$g90, + value: colors.$red-80, + ), + ( + theme: themes.$g100, + value: colors.$red-80, + ), + ), + ), + 'tag-color-red': ( + fallback: colors.$red-80, + values: ( + ( + theme: themes.$white, + value: colors.$red-80, + ), + ( + theme: themes.$g10, + value: colors.$red-80, + ), + ( + theme: themes.$g90, + value: colors.$red-30, + ), + ( + theme: themes.$g100, + value: colors.$red-30, + ), + ), + ), + 'tag-hover-red': ( + fallback: colors.$red-30, + values: ( + ( + theme: themes.$white, + value: colors.$red-30, + ), + ( + theme: themes.$g10, + value: colors.$red-30, + ), + ( + theme: themes.$g90, + value: colors.$red-70, + ), + ( + theme: themes.$g100, + value: colors.$red-70, + ), + ), + ), + + // magenta + 'tag-background-magenta': ( + fallback: colors.$magenta-20, + values: ( + ( + theme: themes.$white, + value: colors.$magenta-20, + ), + ( + theme: themes.$g10, + value: colors.$magenta-20, + ), + ( + theme: themes.$g90, + value: colors.$magenta-80, + ), + ( + theme: themes.$g100, + value: colors.$magenta-80, + ), + ), + ), + 'tag-color-magenta': ( + fallback: colors.$magenta-80, + values: ( + ( + theme: themes.$white, + value: colors.$magenta-80, + ), + ( + theme: themes.$g10, + value: colors.$magenta-80, + ), + ( + theme: themes.$g90, + value: colors.$magenta-30, + ), + ( + theme: themes.$g100, + value: colors.$magenta-30, + ), + ), + ), + 'tag-hover-magenta': ( + fallback: colors.$magenta-30, + values: ( + ( + theme: themes.$white, + value: colors.$magenta-30, + ), + ( + theme: themes.$g10, + value: colors.$magenta-30, + ), + ( + theme: themes.$g90, + value: colors.$magenta-70, + ), + ( + theme: themes.$g100, + value: colors.$magenta-70, + ), + ), + ), + + // purple + 'tag-background-purple': ( + fallback: colors.$purple-20, + values: ( + ( + theme: themes.$white, + value: colors.$purple-20, + ), + ( + theme: themes.$g10, + value: colors.$purple-20, + ), + ( + theme: themes.$g90, + value: colors.$purple-80, + ), + ( + theme: themes.$g100, + value: colors.$purple-80, + ), + ), + ), + 'tag-color-purple': ( + fallback: colors.$purple-80, + values: ( + ( + theme: themes.$white, + value: colors.$purple-80, + ), + ( + theme: themes.$g10, + value: colors.$purple-80, + ), + ( + theme: themes.$g90, + value: colors.$purple-30, + ), + ( + theme: themes.$g100, + value: colors.$purple-30, + ), + ), + ), + 'tag-hover-purple': ( + fallback: colors.$purple-30, + values: ( + ( + theme: themes.$white, + value: colors.$purple-30, + ), + ( + theme: themes.$g10, + value: colors.$purple-30, + ), + ( + theme: themes.$g90, + value: colors.$purple-70, + ), + ( + theme: themes.$g100, + value: colors.$purple-70, + ), + ), + ), + + // blue + 'tag-background-blue': ( + fallback: colors.$blue-20, + values: ( + ( + theme: themes.$white, + value: colors.$blue-20, + ), + ( + theme: themes.$g10, + value: colors.$blue-20, + ), + ( + theme: themes.$g90, + value: colors.$blue-80, + ), + ( + theme: themes.$g100, + value: colors.$blue-80, + ), + ), + ), + 'tag-color-blue': ( + fallback: colors.$blue-80, + values: ( + ( + theme: themes.$white, + value: colors.$blue-80, + ), + ( + theme: themes.$g10, + value: colors.$blue-80, + ), + ( + theme: themes.$g90, + value: colors.$blue-30, + ), + ( + theme: themes.$g100, + value: colors.$blue-30, + ), + ), + ), + 'tag-hover-blue': ( + fallback: colors.$blue-30, + values: ( + ( + theme: themes.$white, + value: colors.$blue-30, + ), + ( + theme: themes.$g10, + value: colors.$blue-30, + ), + ( + theme: themes.$g90, + value: colors.$blue-70, + ), + ( + theme: themes.$g100, + value: colors.$blue-70, + ), + ), + ), + + // cyan + 'tag-background-cyan': ( + fallback: colors.$cyan-20, + values: ( + ( + theme: themes.$white, + value: colors.$cyan-20, + ), + ( + theme: themes.$g10, + value: colors.$cyan-20, + ), + ( + theme: themes.$g90, + value: colors.$cyan-80, + ), + ( + theme: themes.$g100, + value: colors.$cyan-80, + ), + ), + ), + 'tag-color-cyan': ( + fallback: colors.$cyan-80, + values: ( + ( + theme: themes.$white, + value: colors.$cyan-80, + ), + ( + theme: themes.$g10, + value: colors.$cyan-80, + ), + ( + theme: themes.$g90, + value: colors.$cyan-30, + ), + ( + theme: themes.$g100, + value: colors.$cyan-30, + ), + ), + ), + 'tag-hover-cyan': ( + fallback: colors.$cyan-30, + values: ( + ( + theme: themes.$white, + value: colors.$cyan-30, + ), + ( + theme: themes.$g10, + value: colors.$cyan-30, + ), + ( + theme: themes.$g90, + value: colors.$cyan-70, + ), + ( + theme: themes.$g100, + value: colors.$cyan-70, + ), + ), + ), + + // teal + 'tag-background-teal': ( + fallback: colors.$teal-20, + values: ( + ( + theme: themes.$white, + value: colors.$teal-20, + ), + ( + theme: themes.$g10, + value: colors.$teal-20, + ), + ( + theme: themes.$g90, + value: colors.$teal-80, + ), + ( + theme: themes.$g100, + value: colors.$teal-80, + ), + ), + ), + 'tag-color-teal': ( + fallback: colors.$teal-80, + values: ( + ( + theme: themes.$white, + value: colors.$teal-80, + ), + ( + theme: themes.$g10, + value: colors.$teal-80, + ), + ( + theme: themes.$g90, + value: colors.$teal-30, + ), + ( + theme: themes.$g100, + value: colors.$teal-30, + ), + ), + ), + 'tag-hover-teal': ( + fallback: colors.$teal-30, + values: ( + ( + theme: themes.$white, + value: colors.$teal-30, + ), + ( + theme: themes.$g10, + value: colors.$teal-30, + ), + ( + theme: themes.$g90, + value: colors.$teal-70, + ), + ( + theme: themes.$g100, + value: colors.$teal-70, + ), + ), + ), + + // green + 'tag-background-green': ( + fallback: colors.$green-20, + values: ( + ( + theme: themes.$white, + value: colors.$green-20, + ), + ( + theme: themes.$g10, + value: colors.$green-20, + ), + ( + theme: themes.$g90, + value: colors.$green-80, + ), + ( + theme: themes.$g100, + value: colors.$green-80, + ), + ), + ), + 'tag-color-green': ( + fallback: colors.$green-80, + values: ( + ( + theme: themes.$white, + value: colors.$green-80, + ), + ( + theme: themes.$g10, + value: colors.$green-80, + ), + ( + theme: themes.$g90, + value: colors.$green-30, + ), + ( + theme: themes.$g100, + value: colors.$green-30, + ), + ), + ), + 'tag-hover-green': ( + fallback: colors.$green-30, + values: ( + ( + theme: themes.$white, + value: colors.$green-30, + ), + ( + theme: themes.$g10, + value: colors.$green-30, + ), + ( + theme: themes.$g90, + value: colors.$green-70, + ), + ( + theme: themes.$g100, + value: colors.$green-70, + ), + ), + ), + + // gray + 'tag-background-gray': ( + fallback: colors.$gray-20, + values: ( + ( + theme: themes.$white, + value: colors.$gray-20, + ), + ( + theme: themes.$g10, + value: colors.$gray-20, + ), + ( + theme: themes.$g90, + value: colors.$gray-80, + ), + ( + theme: themes.$g100, + value: colors.$gray-80, + ), + ), + ), + 'tag-color-gray': ( + fallback: colors.$gray-80, + values: ( + ( + theme: themes.$white, + value: colors.$gray-80, + ), + ( + theme: themes.$g10, + value: colors.$gray-80, + ), + ( + theme: themes.$g90, + value: colors.$gray-30, + ), + ( + theme: themes.$g100, + value: colors.$gray-30, + ), + ), + ), + 'tag-hover-gray': ( + fallback: colors.$gray-30, + values: ( + ( + theme: themes.$white, + value: colors.$gray-30, + ), + ( + theme: themes.$g10, + value: colors.$gray-30, + ), + ( + theme: themes.$g90, + value: colors.$gray-70, + ), + ( + theme: themes.$g100, + value: colors.$gray-70, + ), + ), + ), + + // cool-gray + 'tag-background-cool-gray': ( + fallback: colors.$cool-gray-20, + values: ( + ( + theme: themes.$white, + value: colors.$cool-gray-20, + ), + ( + theme: themes.$g10, + value: colors.$cool-gray-20, + ), + ( + theme: themes.$g90, + value: colors.$cool-gray-80, + ), + ( + theme: themes.$g100, + value: colors.$cool-gray-80, + ), + ), + ), + 'tag-color-cool-gray': ( + fallback: colors.$cool-gray-80, + values: ( + ( + theme: themes.$white, + value: colors.$cool-gray-80, + ), + ( + theme: themes.$g10, + value: colors.$cool-gray-80, + ), + ( + theme: themes.$g90, + value: colors.$cool-gray-30, + ), + ( + theme: themes.$g100, + value: colors.$cool-gray-30, + ), + ), + ), + 'tag-hover-cool-gray': ( + fallback: colors.$cool-gray-30, + values: ( + ( + theme: themes.$white, + value: colors.$cool-gray-30, + ), + ( + theme: themes.$g10, + value: colors.$cool-gray-30, + ), + ( + theme: themes.$g90, + value: colors.$cool-gray-70, + ), + ( + theme: themes.$g100, + value: colors.$cool-gray-70, + ), + ), + ), + + // warm-gray + 'tag-background-warm-gray': ( + fallback: colors.$warm-gray-20, + values: ( + ( + theme: themes.$white, + value: colors.$warm-gray-20, + ), + ( + theme: themes.$g10, + value: colors.$warm-gray-20, + ), + ( + theme: themes.$g90, + value: colors.$warm-gray-80, + ), + ( + theme: themes.$g100, + value: colors.$warm-gray-80, + ), + ), + ), + 'tag-color-warm-gray': ( + fallback: colors.$warm-gray-80, + values: ( + ( + theme: themes.$white, + value: colors.$warm-gray-80, + ), + ( + theme: themes.$g10, + value: colors.$warm-gray-80, + ), + ( + theme: themes.$g90, + value: colors.$warm-gray-30, + ), + ( + theme: themes.$g100, + value: colors.$warm-gray-30, + ), + ), + ), + 'tag-hover-warm-gray': ( + fallback: colors.$warm-gray-30, + values: ( + ( + theme: themes.$white, + value: colors.$warm-gray-30, + ), + ( + theme: themes.$g10, + value: colors.$warm-gray-30, + ), + ( + theme: themes.$g90, + value: colors.$warm-gray-70, + ), + ( + theme: themes.$g100, + value: colors.$warm-gray-70, + ), + ), + ), +); + +$tag-background-red: custom-property.get-var('tag-background-red'); +$tag-color-red: custom-property.get-var('tag-color-red'); +$tag-hover-red: custom-property.get-var('tag-hover-red'); +$tag-background-magenta: custom-property.get-var('tag-background-magenta'); +$tag-color-magenta: custom-property.get-var('tag-color-magenta'); +$tag-hover-magenta: custom-property.get-var('tag-hover-magenta'); +$tag-background-purple: custom-property.get-var('tag-background-purple'); +$tag-color-purple: custom-property.get-var('tag-color-purple'); +$tag-hover-purple: custom-property.get-var('tag-hover-purple'); +$tag-background-blue: custom-property.get-var('tag-background-blue'); +$tag-color-blue: custom-property.get-var('tag-color-blue'); +$tag-hover-blue: custom-property.get-var('tag-hover-blue'); +$tag-background-cyan: custom-property.get-var('tag-background-cyan'); +$tag-color-cyan: custom-property.get-var('tag-color-cyan'); +$tag-hover-cyan: custom-property.get-var('tag-hover-cyan'); +$tag-background-teal: custom-property.get-var('tag-background-teal'); +$tag-color-teal: custom-property.get-var('tag-color-teal'); +$tag-hover-teal: custom-property.get-var('tag-hover-teal'); +$tag-background-green: custom-property.get-var('tag-background-green'); +$tag-color-green: custom-property.get-var('tag-color-green'); +$tag-hover-green: custom-property.get-var('tag-hover-green'); +$tag-background-gray: custom-property.get-var('tag-background-gray'); +$tag-color-gray: custom-property.get-var('tag-color-gray'); +$tag-hover-gray: custom-property.get-var('tag-hover-gray'); +$tag-background-cool-gray: custom-property.get-var('tag-background-cool-gray'); +$tag-color-cool-gray: custom-property.get-var('tag-color-cool-gray'); +$tag-hover-cool-gray: custom-property.get-var('tag-color-cool-gray'); +$tag-background-warm-gray: custom-property.get-var('tag-background-warm-gray'); +$tag-color-warm-gray: custom-property.get-var('tag-color-warm-gray'); +$tag-hover-warm-gray: custom-property.get-var('tag-hover-warm-gray'); + +$white: component-tokens.get-tokens($-tokens, themes.$white); +$g10: component-tokens.get-tokens($-tokens, themes.$g10); +$g90: component-tokens.get-tokens($-tokens, themes.$g90); +$g100: component-tokens.get-tokens($-tokens, themes.$g100); diff --git a/packages/styles/scss/components/tile/_tile.scss b/packages/styles/scss/components/tile/_tile.scss index 887487fee6f1..4f716bc06f9a 100644 --- a/packages/styles/scss/components/tile/_tile.scss +++ b/packages/styles/scss/components/tile/_tile.scss @@ -8,7 +8,7 @@ @use '../../config' as *; @use '../../motion' as *; @use '../../spacing' as *; -@use '../../theme' as *; +@use '../../compat/theme' as *; @use '../../type' as *; @use '../button/tokens' as button; @use '../../utilities/focus-outline' as *; diff --git a/packages/styles/scss/components/treeview/_treeview.scss b/packages/styles/scss/components/treeview/_treeview.scss index 2dc18a7d6612..509e9d9cb43c 100644 --- a/packages/styles/scss/components/treeview/_treeview.scss +++ b/packages/styles/scss/components/treeview/_treeview.scss @@ -8,7 +8,7 @@ @use '../../config' as *; @use '../../motion' as *; @use '../../spacing' as *; -@use '../../theme' as *; +@use '../../compat/theme' as *; @use '../../type' as *; @use '../../utilities/convert' as *; @use '../../utilities/focus-outline' as *; diff --git a/packages/themes/__tests__/module-test.js b/packages/themes/__tests__/module-test.js index a6ce24d2a39c..2f426fc540f0 100644 --- a/packages/themes/__tests__/module-test.js +++ b/packages/themes/__tests__/module-test.js @@ -129,12 +129,12 @@ describe('@carbon/themes/scss', () => { test('$use-fallback-value', async () => { const { unwrap } = await render(` @use '../' as themes with ( - $use-fallback-value: true, + $use-fallback-value: false, ); $_: get('background', themes.$background); `); - expect(unwrap('background')).toBe('var(--cds-background, #ffffff)'); + expect(unwrap('background')).toBe('var(--cds-background)'); }); // Set prefix for CSS Custom Properties @@ -146,7 +146,7 @@ describe('@carbon/themes/scss', () => { $_: get('background', themes.$background); `); - expect(unwrap('background')).toEqual('var(--test-background)'); + expect(unwrap('background')).toEqual('var(--test-background, #ffffff)'); }); }); }); diff --git a/packages/themes/docs/sass.md b/packages/themes/docs/sass.md index 09ea344a4342..55616e2ac421 100644 --- a/packages/themes/docs/sass.md +++ b/packages/themes/docs/sass.md @@ -27,6 +27,8 @@ There are several entrypoints that you can use with `@carbon/themes`, including: | `@use '@carbon/themes/scss/modules/themes';` | Theme definitions for white, g10, g90, and g100 | | `@use '@carbon/themes/scss/modules/theme';` | Set the current theme, get token values from the theme | | `@use '@carbon/themes/scss/modules/tokens';` | Access theme tokens | +| `@use '@carbon/themes/scss/compat/themes';` | v10 Theme definitions for white, g10, g90, and g100 | +| `@use '@carbon/themes/scss/compat/tokens';` | v10 theme tokens | _Note: the white, g10, g90, and g100 themes are only available in the `scss/modules/themes` file and are not re-exported in `@carbon/themes`. To learn diff --git a/packages/themes/package.json b/packages/themes/package.json index 1c1a64964d95..63fdb304b37d 100644 --- a/packages/themes/package.json +++ b/packages/themes/package.json @@ -24,7 +24,7 @@ "access": "public" }, "scripts": { - "ci-check": "carbon-cli check \"scss/**/*.scss\" -i \"**/generated/**\"", + "ci-check": "carbon-cli check \"scss/**/*.scss\" -i \"**/generated/**\" -i \"**/compat/**\"", "clean": "rimraf es lib umd scss/generated", "build": "yarn clean && carbon-cli bundle src/index.js --name CarbonThemes && babel-node --presets '@babel/preset-env' tasks/build.js && carbon-cli check \"scss/*.scss\"" }, diff --git a/packages/themes/scss/compat/_themes.scss b/packages/themes/scss/compat/_themes.scss new file mode 100644 index 000000000000..4e9bcd947b07 --- /dev/null +++ b/packages/themes/scss/compat/_themes.scss @@ -0,0 +1,8 @@ +// +// Copyright IBM Corp. 2018, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@forward 'generated/themes'; diff --git a/packages/themes/scss/compat/_tokens.scss b/packages/themes/scss/compat/_tokens.scss new file mode 100644 index 000000000000..ade2391ec944 --- /dev/null +++ b/packages/themes/scss/compat/_tokens.scss @@ -0,0 +1,8 @@ +// +// Copyright IBM Corp. 2018, 2018 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +@forward 'generated/tokens'; diff --git a/packages/themes/scss/modules/_config.scss b/packages/themes/scss/modules/_config.scss index 040069c9f4bb..83468f96381a 100644 --- a/packages/themes/scss/modules/_config.scss +++ b/packages/themes/scss/modules/_config.scss @@ -6,3 +6,6 @@ // $prefix: 'cds' !default; + +/// Specify if a fallback value should be provided for the CSS Custom Property +$use-fallback-value: true !default; diff --git a/packages/themes/scss/modules/_themes.scss b/packages/themes/scss/modules/_themes.scss index 70170fb0a071..4e9bcd947b07 100644 --- a/packages/themes/scss/modules/_themes.scss +++ b/packages/themes/scss/modules/_themes.scss @@ -6,4 +6,3 @@ // @forward 'generated/themes'; -@use 'generated/themes'; diff --git a/packages/themes/tasks/build.js b/packages/themes/tasks/build.js index 0ac9edf0ea9f..54d8084944cc 100644 --- a/packages/themes/tasks/build.js +++ b/packages/themes/tasks/build.js @@ -19,6 +19,8 @@ const yaml = require('js-yaml'); const { formatTokenName, themes, tokens } = require('../lib'); const buildTokensFile = require('./builders/tokens'); const buildThemesFile = require('./builders/themes'); +const buildCompatThemesFile = require('./builders/compat/themes'); +const buildCompatTokensFile = require('./builders/compat/tokens'); const buildModulesThemesFile = require('./builders/modules-themes'); const buildModulesTokensFile = require('./builders/modules-tokens'); const buildMixinsFile = require('./builders/mixins'); @@ -64,6 +66,30 @@ async function build() { ); }, }, + { + filepath: path.resolve( + SCSS_DIR, + '..', + 'compat', + 'generated', + '_themes.scss' + ), + builder() { + return buildCompatThemesFile(); + }, + }, + { + filepath: path.resolve( + SCSS_DIR, + '..', + 'compat', + 'generated', + '_tokens.scss' + ), + builder() { + return buildCompatTokensFile(); + }, + }, { filepath: path.resolve( SCSS_DIR, @@ -95,10 +121,9 @@ async function build() { }, ]; - await fs.ensureDir(SCSS_DIR); - await fs.ensureDir(path.resolve(SCSS_DIR, '..', 'modules', 'generated')); - for (const { filepath, builder } of files) { + await fs.ensureFile(filepath); + const { code } = generate(builder()); await fs.writeFile(filepath, code); } diff --git a/packages/themes/tasks/builders/compat/shared.js b/packages/themes/tasks/builders/compat/shared.js new file mode 100644 index 000000000000..ff48b5c3a1a0 --- /dev/null +++ b/packages/themes/tasks/builders/compat/shared.js @@ -0,0 +1,128 @@ +/** + * Copyright IBM Corp. 2015, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +const { TokenFormat, group } = require('../../../src/next'); + +const denylist = new Set([ + 'background', + 'layer', + 'layerAccent', + 'layerAccentHover', + 'layerAccentActive', + 'field', + 'backgroundInverse', + 'backgroundBrand', + 'interactive', + + 'borderSubtle', + 'borderStrong', + 'borderInverse', + 'borderInteractive', + + 'textPrimary', + 'textSecondary', + 'textPlaceholder', + 'textHelper', + 'textOnColor', + 'textInverse', + + 'linkPrimary', + 'linkSecondary', + 'linkVisited', + 'linkInverse', + + 'iconPrimary', + 'iconSecondary', + 'iconOnColor', + 'iconInverse', + + 'supportError', + 'supportSuccess', + 'supportWarning', + 'supportInfo', + 'supportErrorInverse', + 'supportSuccessInverse', + 'supportWarningInverse', + 'supportInfoInverse', + + 'overlay', + 'toggleOff', + + 'buttonPrimary', + 'buttonSecondary', + 'buttonTertiary', + 'buttonDangerPrimary', + 'buttonDangerSecondary', + + 'backgroundActive', + 'layerActive', + + 'buttonDangerActive', + 'buttonPrimaryActive', + 'buttonSecondaryActive', + 'buttonTertiaryActive', + + 'focusInset', + 'focusInverse', + + 'backgroundHover', + 'layerHover', + 'fieldHover', + 'backgroundInverseHover', + 'linkPrimaryHover', + 'buttonDangerHover', + 'buttonPrimaryHover', + 'buttonSecondaryHover', + 'buttonTertiaryHover', + + 'backgroundSelected', + 'backgroundSelectedHover', + 'layerSelected', + 'layerSelectedHover', + 'layerSelectedInverse', + 'borderSubtleSelected', + + 'layerDisabled', + 'fieldDisabled', + 'borderDisabled', + + 'textDisabled', + 'buttonDisabled', + 'iconDisabled', + + 'textOnColorDisabled', + 'iconOnColorDisabled', + 'layerSelectedDisabled', + + 'skeletonBackground', + 'skeletonElement', + + // Deprecated + 'brand01', + 'brand02', + 'brand03', + 'active01', + // 'hoverField', + 'danger', +]); + +function shouldIncludeToken(token) { + if (denylist.has(token)) { + return false; + } + const id = TokenFormat.convert({ + name: token, + format: TokenFormat.formats.scss, + }); + return !group.getToken(id); +} + +module.exports = { + shouldIncludeToken, +}; diff --git a/packages/themes/tasks/builders/compat/themes.js b/packages/themes/tasks/builders/compat/themes.js new file mode 100644 index 000000000000..f630561d2832 --- /dev/null +++ b/packages/themes/tasks/builders/compat/themes.js @@ -0,0 +1,54 @@ +/** + * Copyright IBM Corp. 2015, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +const { types: t } = require('@carbon/scss-generator'); +const { TokenFormat } = require('../../../src/next'); +const { white, g10, g90, g100, tokens } = require('../../../src'); +const { FILE_BANNER, primitive } = require('../shared'); +const { shouldIncludeToken } = require('./shared'); + +function buildCompatFile() { + const themes = { + white, + g10, + g90, + g100, + }; + const variables = Object.entries(themes).flatMap(([key, theme]) => { + return [ + t.Newline(), + t.Comment(`/ Token values for the ${key} theme`), + t.Assignment({ + id: t.Identifier(key), + init: t.SassMap({ + properties: Object.entries(theme) + .filter(([token]) => { + return tokens.colors.includes(token) && shouldIncludeToken(token); + }) + .map(([token, value]) => { + const id = TokenFormat.convert({ + name: token, + format: TokenFormat.formats.scss, + }); + return t.SassMapProperty(t.Identifier(id), primitive(value)); + }), + }), + default: true, + }), + ]; + }); + + return t.StyleSheet([ + // Preamble + FILE_BANNER, + ...variables, + ]); +} + +module.exports = buildCompatFile; diff --git a/packages/themes/tasks/builders/compat/tokens.js b/packages/themes/tasks/builders/compat/tokens.js new file mode 100644 index 000000000000..c21813e75748 --- /dev/null +++ b/packages/themes/tasks/builders/compat/tokens.js @@ -0,0 +1,80 @@ +/** + * Copyright IBM Corp. 2015, 2018 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +const { types: t } = require('@carbon/scss-generator'); +const { TokenFormat } = require('../../../src/next'); +const { tokens } = require('../../../src'); +const { FILE_BANNER } = require('../shared'); +const { shouldIncludeToken } = require('./shared'); + +function buildCompatFile() { + const variables = tokens.colors + .filter(shouldIncludeToken) + .flatMap((token) => { + const id = TokenFormat.convert({ + name: token, + format: TokenFormat.formats.scss, + }); + + return [ + t.Newline(), + t.Comment(`/ CSS Custom Property for the ${id} token`), + t.Assignment({ + id: t.Identifier(id), + init: t.SassFunctionCall({ + id: t.Identifier('_get'), + params: [t.SassString(id)], + }), + default: true, + }), + ]; + }); + + return t.StyleSheet([ + // Preamble + FILE_BANNER, + t.Newline(), + + // Modules + t.SassModule('sass:map'), + t.SassModule('../../modules/config'), + t.SassModule('../../modules/theme'), + t.Newline(), + + t.Comment('/ Internal helper for generating CSS Custom Properties'), + t.SassFunction({ + id: t.Identifier('_get'), + params: [t.Identifier('token')], + body: t.BlockStatement([ + t.IfStatement({ + test: t.LogicalExpression({ + left: t.SassValue('config.$use-fallback-value'), + operator: '==', + right: t.SassBoolean(false), + }), + consequent: t.BlockStatement([ + t.AtReturn(t.SassValue('var(--#{config.$prefix}-#{$token})')), + ]), + alternate: t.BlockStatement([ + t.AtReturn( + t.SassValue( + 'var(--#{config.$prefix}-#{$token}, #{theme.get($token)})' + ) + ), + ]), + }), + ]), + }), + + // Variables + ...variables, + ]); +} + +module.exports = buildCompatFile; diff --git a/packages/themes/tasks/builders/modules-themes.js b/packages/themes/tasks/builders/modules-themes.js index 33114457cda9..8b974726e745 100644 --- a/packages/themes/tasks/builders/modules-themes.js +++ b/packages/themes/tasks/builders/modules-themes.js @@ -58,7 +58,108 @@ function buildThemesFile() { ]; }); + const mappings = new Map(); + for (const [key, value] of Object.entries(tokenMappings)) { + if (!mappings.has(value)) { + mappings.set(value, []); + } + + mappings.set(value, [...mappings.get(value), key]); + } + return t.StyleSheet([FILE_BANNER, t.Newline(), ...imports, ...variables]); } +const tokenMappings = { + background: 'ui-background', + layer: 'ui-01', + 'layer-accent': 'ui-03', + field: 'field-01', + 'background-inverse': 'inverse-02', + 'background-brand': 'interactive-01', + interactive: 'interactive-04', + + 'border-subtle': 'ui-03', + 'border-strong': 'ui-04', + 'border-inverse': 'ui-05', + 'border-interactive': 'interactive-04', + + 'text-primary': 'text-01', + 'text-secondary': 'text-02', + 'text-placeholder': 'text-03', + 'text-helper': 'text-05', + 'text-on-color': 'text-04', + 'text-inverse': 'inverse-01', + + 'link-primary': 'link-01', + 'link-secondary': 'link-02', + 'link-visited': 'visited-link', + 'link-inverse': 'inverse-link', + + 'icon-primary': 'icon-01', + 'icon-secondary': 'icon-02', + 'icon-on-color': 'icon-03', + 'icon-inverse': 'inverse-01', + + 'support-error': 'support-01', + 'support-success': 'support-02', + 'support-warning': 'support-03', + 'support-info': 'support-04', + 'support-error-inverse': 'inverse-support-01', + 'support-success-inverse': 'inverse-support-02', + 'support-warning-inverse': 'inverse-support-03', + 'support-info-inverse': 'inverse-support-04', + + overlay: 'overlay-01', + 'toggle-off': 'ui-04', + + 'button-primary': 'interactive-01', + 'button-secondary': 'interactive-02', + 'button-tertiary': 'interactive-03', + 'button-danger-primary': 'danger-01', + 'button-danger-secondary': 'danger-02', + + 'background-active': 'active-ui', + 'layer-active': 'active-ui', + + 'button-danger-active': 'active-danger', + 'button-primary-active': 'active-primary', + 'button-secondary-active': 'active-secondary', + 'button-tertiary-active': 'active-tertiary', + + 'focus-inset': 'inverse-01', + 'focus-inverse': 'inverse-focus-ui', + + 'background-hover': 'hover-ui', + 'layer-hover': 'hover-ui', + 'field-hover': 'hover-ui', + 'background-inverse-hover': 'inverse-hover-ui', + 'link-primary-hover': 'hover-primary-text', + 'button-danger-hover': 'hover-danger', + 'button-primary-hover': 'hover-primary', + 'button-secondary-hover': 'hover-secondary', + 'button-tertiary-hover': 'hover-tertiary', + + 'background-selected': 'selected-ui', + 'background-selected-hover': 'hover-selected-ui', + 'layer-selected': 'selected-ui', + 'layer-selected-hover': 'hover-selected-ui', + 'layer-selected-inverse': 'ui-05', + 'border-subtle-selected': 'active-ui', + + 'layer-disabled': 'disabled-01', + 'field-disabled': 'disabled-01', + 'border-disabled': 'disabled-01', + + 'text-disabled': 'disabled-02', + 'button-disabled': 'disabled-02', + 'icon-disabled': 'disabled-02', + + 'text-on-color-disabled': 'disabled-03', + 'icon-on-color-disabled': 'disabled-03', + 'layer-selected-disabled': 'disabled-03', + + 'skeleton-background': 'skeleton-01', + 'skeleton-element': 'skeleton-02', +}; module.exports = buildThemesFile; diff --git a/packages/themes/tasks/builders/modules-tokens.js b/packages/themes/tasks/builders/modules-tokens.js index 31665b55af40..777b04b670af 100644 --- a/packages/themes/tasks/builders/modules-tokens.js +++ b/packages/themes/tasks/builders/modules-tokens.js @@ -40,17 +40,6 @@ function buildThemeTokens() { t.SassModule('../theme'), t.Newline(), - // Fallback - t.Comment( - '/ Specify if a fallback value should be provided for the CSS Custom Property' - ), - t.Assignment({ - id: t.Identifier('use-fallback-value'), - init: t.SassBoolean(false), - default: true, - }), - t.Newline(), - t.Comment('/ Internal helper for generating CSS Custom Properties'), t.SassFunction({ id: t.Identifier('_get'), @@ -58,7 +47,7 @@ function buildThemeTokens() { body: t.BlockStatement([ t.IfStatement({ test: t.LogicalExpression({ - left: t.Identifier('use-fallback-value'), + left: t.SassValue('config.$use-fallback-value'), operator: '==', right: t.SassBoolean(false), }), diff --git a/yarn.lock b/yarn.lock index a50bc57f0aa4..2d917befe727 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1792,10 +1792,14 @@ __metadata: version: 0.0.0-use.local resolution: "@carbon/feature-flags@workspace:packages/feature-flags" dependencies: + "@babel/core": ^7.14.6 "@babel/generator": ^7.14.5 + "@babel/preset-env": ^7.14.7 "@babel/template": ^7.14.5 "@babel/types": ^7.14.5 "@carbon/scss-generator": ^10.13.0 + "@rollup/plugin-babel": ^5.3.0 + "@rollup/plugin-node-resolve": ^13.0.0 change-case: ^4.1.2 fs-extra: ^9.0.1 js-yaml: ^3.14.0 @@ -2347,18 +2351,6 @@ __metadata: languageName: node linkType: hard -"@cypress/listr-verbose-renderer@npm:^0.4.1": - version: 0.4.1 - resolution: "@cypress/listr-verbose-renderer@npm:0.4.1" - dependencies: - chalk: ^1.1.3 - cli-cursor: ^1.0.2 - date-fns: ^1.27.2 - figures: ^1.7.0 - checksum: 0169c2b30fd4623a7b2ff8354fe72583fbecc774f36321cd45bb84fb30859426093cb298f95ab71cae707792dc04fe2fa77cd57e66cfbdba9c8006b6b888c4a3 - languageName: node - linkType: hard - "@cypress/mount-utils@npm:1.0.1": version: 1.0.1 resolution: "@cypress/mount-utils@npm:1.0.1" @@ -2632,14 +2624,14 @@ __metadata: languageName: node linkType: hard -"@es-joy/jsdoccomment@npm:^0.8.0-alpha.2": - version: 0.8.0-alpha.2 - resolution: "@es-joy/jsdoccomment@npm:0.8.0-alpha.2" +"@es-joy/jsdoccomment@npm:0.10.2": + version: 0.10.2 + resolution: "@es-joy/jsdoccomment@npm:0.10.2" dependencies: - comment-parser: ^1.1.5 + comment-parser: 1.2.1 esquery: ^1.4.0 - jsdoc-type-pratt-parser: 1.0.0-alpha.23 - checksum: cb6b06a8369f171f8dd5b9a3f74def4524e0d80a9c14a402246ff69a2a964a2ca3448c04e3cf5f99d6151aafa13272a96bd8b98d6857f9b217159c711fe09de1 + jsdoc-type-pratt-parser: 1.0.4 + checksum: 5790d13b74cdc647ea2e3e7df7b7c593ed69d86682aecf54db6da5644c82f360867961579e4e85fbf648d6ccf286279f4adb4cafb355996c93e2dd2839ccf0d8 languageName: node linkType: hard @@ -4674,6 +4666,22 @@ __metadata: languageName: node linkType: hard +"@rollup/plugin-node-resolve@npm:^13.0.0": + version: 13.0.0 + resolution: "@rollup/plugin-node-resolve@npm:13.0.0" + dependencies: + "@rollup/pluginutils": ^3.1.0 + "@types/resolve": 1.17.1 + builtin-modules: ^3.1.0 + deepmerge: ^4.2.2 + is-module: ^1.0.0 + resolve: ^1.19.0 + peerDependencies: + rollup: ^2.42.0 + checksum: c0237e65f50d593efc176e07a2ddf734918bc7344f739fe2254a3bfaa4be37c6d4787d045ab79d741811d3658f7e8bbb1484e6aa25bbb9fe2a3c33472b3f371d + languageName: node + linkType: hard + "@rollup/plugin-replace@npm:^2.4.2": version: 2.4.2 resolution: "@rollup/plugin-replace@npm:2.4.2" @@ -7894,7 +7902,7 @@ __metadata: languageName: node linkType: hard -"ansi-escapes@npm:^4.2.1, ansi-escapes@npm:^4.3.1": +"ansi-escapes@npm:^4.2.1, ansi-escapes@npm:^4.3.0, ansi-escapes@npm:^4.3.1": version: 4.3.2 resolution: "ansi-escapes@npm:4.3.2" dependencies: @@ -10342,7 +10350,7 @@ __metadata: core-js: ^3.6.5 cross-env: ^5.2.0 css-loader: ^3.4.2 - cypress: ^7.2.0 + cypress: ^8.0.0 cypress-real-events: ^1.3.0 downshift: 5.2.1 fast-sass-loader: ^1.5.0 @@ -11135,6 +11143,16 @@ __metadata: languageName: node linkType: hard +"cli-truncate@npm:^2.1.0": + version: 2.1.0 + resolution: "cli-truncate@npm:2.1.0" + dependencies: + slice-ansi: ^3.0.0 + string-width: ^4.2.0 + checksum: bf1e4e6195392dc718bf9cd71f317b6300dc4a9191d052f31046b8773230ece4fa09458813bf0e3455a5e68c0690d2ea2c197d14a8b85a7b5e01c97f4b5feb5d + languageName: node + linkType: hard + "cli-width@npm:^1.0.1": version: 1.1.1 resolution: "cli-width@npm:1.1.1" @@ -11574,10 +11592,10 @@ __metadata: languageName: node linkType: hard -"comment-parser@npm:1.1.5, comment-parser@npm:^1.1.5": - version: 1.1.5 - resolution: "comment-parser@npm:1.1.5" - checksum: e669d6328a1244a2d7db5ae077dcdd4ef6ddfda752aed9c29d6b4690672d80c0002a7e3ce4fadbb5008c27704adb3153169533312262592834f37ccb5e8eed7c +"comment-parser@npm:1.2.1": + version: 1.2.1 + resolution: "comment-parser@npm:1.2.1" + checksum: 3057a7304c6a06148e7aeae79db7b8dc326ba80c4caf1ed41ab30bdc2d55191d2d65a9c2b5370a6c86f89d95d502013c64a8c691d681b22860fc8a7fcb2d8a3a languageName: node linkType: hard @@ -12586,11 +12604,10 @@ __metadata: languageName: node linkType: hard -"cypress@npm:^7.2.0": - version: 7.2.0 - resolution: "cypress@npm:7.2.0" +"cypress@npm:^8.0.0": + version: 8.0.0 + resolution: "cypress@npm:8.0.0" dependencies: - "@cypress/listr-verbose-renderer": ^0.4.1 "@cypress/request": ^2.88.5 "@cypress/xvfb": ^1.2.4 "@types/node": ^14.14.31 @@ -12602,21 +12619,24 @@ __metadata: cachedir: ^2.3.0 chalk: ^4.1.0 check-more-types: ^2.24.0 + cli-cursor: ^3.1.0 cli-table3: ~0.6.0 commander: ^5.1.0 common-tags: ^1.8.0 dayjs: ^1.10.4 - debug: 4.3.2 + debug: ^4.3.2 + enquirer: ^2.3.6 eventemitter2: ^6.4.3 execa: 4.1.0 executable: ^4.1.1 - extract-zip: ^1.7.0 + extract-zip: 2.0.1 + figures: ^3.2.0 fs-extra: ^9.1.0 getos: ^3.2.1 is-ci: ^3.0.0 is-installed-globally: ~0.4.0 lazy-ass: ^1.6.0 - listr: ^0.14.3 + listr2: ^3.8.3 lodash: ^4.17.21 log-symbols: ^4.0.0 minimist: ^1.2.5 @@ -12631,7 +12651,7 @@ __metadata: yauzl: ^2.10.0 bin: cypress: bin/cypress - checksum: f2b66f1368893e9c6761fddd5823ea85a8e3110744282e41171a616a262a2f689e113978ce41b2166a7dca503f3aec53f33151e78e300d30c38050a3514756f3 + checksum: 6f8444843de84fddca64d2dc09b20bad16edd578b61b830db9038793c0a8bf363b187abd9e35c55d1f12f76d7abb5adcc85a03d1556ff4178faa72d1a6a184e1 languageName: node linkType: hard @@ -12763,7 +12783,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:4.3.2, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1": +"debug@npm:4, debug@npm:4.3.2, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2": version: 4.3.2 resolution: "debug@npm:4.3.2" dependencies: @@ -14672,7 +14692,7 @@ __metadata: eslint-plugin-cypress: ^2.11.3 eslint-plugin-import: ^2.23.4 eslint-plugin-jest: ^24.3.6 - eslint-plugin-jsdoc: ^35.3.0 + eslint-plugin-jsdoc: ^36.0.3 eslint-plugin-jsx-a11y: ^6.4.1 eslint-plugin-prettier: ^3.4.0 eslint-plugin-react: ^7.24.0 @@ -14766,13 +14786,13 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-jsdoc@npm:^35.3.0": - version: 35.3.0 - resolution: "eslint-plugin-jsdoc@npm:35.3.0" +"eslint-plugin-jsdoc@npm:^36.0.3": + version: 36.0.3 + resolution: "eslint-plugin-jsdoc@npm:36.0.3" dependencies: - "@es-joy/jsdoccomment": ^0.8.0-alpha.2 - comment-parser: 1.1.5 - debug: ^4.3.1 + "@es-joy/jsdoccomment": 0.10.2 + comment-parser: 1.2.1 + debug: ^4.3.2 esquery: ^1.4.0 jsdoc-type-pratt-parser: ^1.0.4 lodash: ^4.17.21 @@ -14781,7 +14801,7 @@ __metadata: spdx-expression-parse: ^3.0.1 peerDependencies: eslint: ^6.0.0 || ^7.0.0 - checksum: 09141f74078bb7a4e814d98b42ab9dc5f72f406ca3eea3a622d19f2f8286339b1d219bb849502803d95a9beb43c0667b2635304e5d5750923ae420367e2fee8d + checksum: f15e1d2e1e4b5e5e3c09597e2866976c3cb4e71329c8eed3522f4fbff430d89942b6a752b37875e4fc772ffddc87609e7090a5e92f9fcbcc8ed8dba8e76d06ed languageName: node linkType: hard @@ -15511,21 +15531,7 @@ __metadata: languageName: node linkType: hard -"extract-zip@npm:^1.6.6, extract-zip@npm:^1.6.7, extract-zip@npm:^1.7.0": - version: 1.7.0 - resolution: "extract-zip@npm:1.7.0" - dependencies: - concat-stream: ^1.6.2 - debug: ^2.6.9 - mkdirp: ^0.5.4 - yauzl: ^2.10.0 - bin: - extract-zip: cli.js - checksum: 011bab660d738614555773d381a6ba4815d98c1cfcdcdf027e154ebcc9fc8c9ef637b3ea5c9b2144013100071ee41722ed041fc9aacc60f6198ef747cac0c073 - languageName: node - linkType: hard - -"extract-zip@npm:^2.0.0, extract-zip@npm:^2.0.1": +"extract-zip@npm:2.0.1, extract-zip@npm:^2.0.0, extract-zip@npm:^2.0.1": version: 2.0.1 resolution: "extract-zip@npm:2.0.1" dependencies: @@ -15542,6 +15548,20 @@ __metadata: languageName: node linkType: hard +"extract-zip@npm:^1.6.6, extract-zip@npm:^1.6.7": + version: 1.7.0 + resolution: "extract-zip@npm:1.7.0" + dependencies: + concat-stream: ^1.6.2 + debug: ^2.6.9 + mkdirp: ^0.5.4 + yauzl: ^2.10.0 + bin: + extract-zip: cli.js + checksum: 011bab660d738614555773d381a6ba4815d98c1cfcdcdf027e154ebcc9fc8c9ef637b3ea5c9b2144013100071ee41722ed041fc9aacc60f6198ef747cac0c073 + languageName: node + linkType: hard + "extsprintf@npm:1.3.0": version: 1.3.0 resolution: "extsprintf@npm:1.3.0" @@ -15780,12 +15800,12 @@ __metadata: languageName: node linkType: hard -"figures@npm:^3.0.0": - version: 3.1.0 - resolution: "figures@npm:3.1.0" +"figures@npm:^3.0.0, figures@npm:^3.2.0": + version: 3.2.0 + resolution: "figures@npm:3.2.0" dependencies: escape-string-regexp: ^1.0.5 - checksum: fcd7999c8328a939ae1b6b190701e4cbbe34a91968034df453ff0296dfcaa844d01561cb20253fb2f3fa64adcdf63f4c93420ff25cfbacc872a776c5ea739b68 + checksum: 85a6ad29e9aca80b49b817e7c89ecc4716ff14e3779d9835af554db91bac41c0f289c418923519392a1e582b4d10482ad282021330cd045bb7b80c84152f2a2b languageName: node linkType: hard @@ -21171,10 +21191,10 @@ __metadata: languageName: node linkType: hard -"jsdoc-type-pratt-parser@npm:1.0.0-alpha.23": - version: 1.0.0-alpha.23 - resolution: "jsdoc-type-pratt-parser@npm:1.0.0-alpha.23" - checksum: a174d04aeed52c621cb6075caf0a0efc8b0802346df915d5ac91cc1665b8b860daa0b9585cccd7430fcb50b6ccb1ba1d1328a306819819ab26dca18191686f7e +"jsdoc-type-pratt-parser@npm:1.0.4": + version: 1.0.4 + resolution: "jsdoc-type-pratt-parser@npm:1.0.4" + checksum: f80df71fc5d90714a035283136485c518dca74f1aa263e66d7ea79d563dd04fe73602156a6683f32a6218bc9d0d15d1a767a7d3e8b67227ec663183296250330 languageName: node linkType: hard @@ -22158,6 +22178,23 @@ __metadata: languageName: node linkType: hard +"listr2@npm:^3.8.3": + version: 3.10.0 + resolution: "listr2@npm:3.10.0" + dependencies: + cli-truncate: ^2.1.0 + colorette: ^1.2.2 + log-update: ^4.0.0 + p-map: ^4.0.0 + rxjs: ^6.6.7 + through: ^2.3.8 + wrap-ansi: ^7.0.0 + peerDependencies: + enquirer: ">= 2.3.0 < 3" + checksum: 9dc1a896972462642fe55817b946174b4f6d067cfe1d9a323517e235ed745773526797f20ef65b346d244356690f929c763d06243e511c4ba6abdcffeb009efc + languageName: node + linkType: hard + "listr@npm:0.14.3, listr@npm:^0.14.3": version: 0.14.3 resolution: "listr@npm:0.14.3" @@ -22789,6 +22826,18 @@ __metadata: languageName: node linkType: hard +"log-update@npm:^4.0.0": + version: 4.0.0 + resolution: "log-update@npm:4.0.0" + dependencies: + ansi-escapes: ^4.3.0 + cli-cursor: ^3.1.0 + slice-ansi: ^4.0.0 + wrap-ansi: ^6.2.0 + checksum: ae2f85bbabc1906034154fb7d4c4477c79b3e703d22d78adee8b3862fa913942772e7fa11713e3d96fb46de4e3cabefbf5d0a544344f03b58d3c4bff52aa9eb2 + languageName: node + linkType: hard + "log-utils@npm:^0.2.1": version: 0.2.1 resolution: "log-utils@npm:0.2.1" @@ -29566,7 +29615,7 @@ resolve@^2.0.0-next.3: languageName: node linkType: hard -"rxjs@npm:^6.3.3, rxjs@npm:^6.4.0, rxjs@npm:^6.6.0, rxjs@npm:^6.6.6": +"rxjs@npm:^6.3.3, rxjs@npm:^6.4.0, rxjs@npm:^6.6.0, rxjs@npm:^6.6.6, rxjs@npm:^6.6.7": version: 6.6.7 resolution: "rxjs@npm:6.6.7" dependencies: @@ -30540,6 +30589,17 @@ resolve@^2.0.0-next.3: languageName: node linkType: hard +"slice-ansi@npm:^3.0.0": + version: 3.0.0 + resolution: "slice-ansi@npm:3.0.0" + dependencies: + ansi-styles: ^4.0.0 + astral-regex: ^2.0.0 + is-fullwidth-code-point: ^3.0.0 + checksum: 5ec6d022d12e016347e9e3e98a7eb2a592213a43a65f1b61b74d2c78288da0aded781f665807a9f3876b9daa9ad94f64f77d7633a0458876c3a4fdc4eb223f24 + languageName: node + linkType: hard + "slice-ansi@npm:^4.0.0": version: 4.0.0 resolution: "slice-ansi@npm:4.0.0"