diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST_OR_ENHANCEMENT.yaml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST_OR_ENHANCEMENT.yaml index 0d60017597fb..3a9c6e04287a 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST_OR_ENHANCEMENT.yaml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST_OR_ENHANCEMENT.yaml @@ -25,7 +25,9 @@ body: id: justification attributes: label: Justification - description: 'Provide the business reasons for this request.' + description: 'Provide the business reasons for this request. Provide screenshots of what you are unable to accomplish that this enhancement would make possible.' + validations: + required: true - type: textarea id: metrics attributes: @@ -48,6 +50,13 @@ body: description: 'Do you want this work within a specific time period? Is it related to an upcoming release?' + - type: input + id: team + attributes: + label: Your team + description: 'Please provide the requesting team you are apart of. @mention design and development members from your team that should be aware of this request.' + validations: + required: true - type: input id: resources attributes: diff --git a/config/eslint-config-carbon/package.json b/config/eslint-config-carbon/package.json index 1d83ec2a16e7..887eedd2a918 100644 --- a/config/eslint-config-carbon/package.json +++ b/config/eslint-config-carbon/package.json @@ -1,7 +1,7 @@ { "name": "eslint-config-carbon", "description": "ESLint configuration for Carbon", - "version": "2.14.0-rc.0", + "version": "2.14.0", "license": "Apache-2.0", "main": "index.js", "repository": { diff --git a/config/jest-config-carbon/package.json b/config/jest-config-carbon/package.json index b665d1c118c0..06bdc5ba529f 100644 --- a/config/jest-config-carbon/package.json +++ b/config/jest-config-carbon/package.json @@ -2,7 +2,7 @@ "name": "jest-config-carbon", "private": true, "description": "Jest configuration and preset for Carbon", - "version": "1.4.0-rc.0", + "version": "1.4.0", "license": "Apache-2.0", "main": "index.js", "repository": { diff --git a/examples/codesandbox-styles/package.json b/examples/codesandbox-styles/package.json index ba604e5a5b46..de9ed8c9d46b 100644 --- a/examples/codesandbox-styles/package.json +++ b/examples/codesandbox-styles/package.json @@ -1,7 +1,7 @@ { "name": "codesandbox-styles", "private": true, - "version": "0.11.0-rc.0", + "version": "0.11.0", "scripts": { "develop": "vite" }, @@ -9,7 +9,7 @@ "vite": "^2.8.0" }, "dependencies": { - "@carbon/styles": "^1.8.0-rc.0", + "@carbon/styles": "^1.8.0", "sass": "^1.51.0" } } diff --git a/examples/codesandbox-with-sass-compilation/package.json b/examples/codesandbox-with-sass-compilation/package.json index 80762d32995f..50e6a8fbedeb 100644 --- a/examples/codesandbox-with-sass-compilation/package.json +++ b/examples/codesandbox-with-sass-compilation/package.json @@ -1,9 +1,9 @@ { "name": "codesandbox-with-sass-compilation", - "version": "0.9.0-rc.0", + "version": "0.9.0", "private": true, "dependencies": { - "@carbon/react": "^1.8.0-rc.0", + "@carbon/react": "^1.8.0", "react": "^17.0.0", "react-dom": "^17.0.0" }, diff --git a/examples/codesandbox/package.json b/examples/codesandbox/package.json index bf575e95cf52..e4338a60af21 100644 --- a/examples/codesandbox/package.json +++ b/examples/codesandbox/package.json @@ -1,9 +1,9 @@ { "name": "codesandbox", - "version": "0.9.0-rc.0", + "version": "0.9.0", "private": true, "dependencies": { - "@carbon/react": "^1.8.0-rc.0", + "@carbon/react": "^1.8.0", "react": "^17.0.0", "react-dom": "^17.0.0" }, diff --git a/examples/light-dark-mode/package.json b/examples/light-dark-mode/package.json index 44d83c3adf0f..34e318a1f76f 100644 --- a/examples/light-dark-mode/package.json +++ b/examples/light-dark-mode/package.json @@ -1,7 +1,7 @@ { "name": "examples-light-dark", "private": true, - "version": "0.6.0-rc.0", + "version": "0.6.0", "scripts": { "build": "next build", "dev": "next dev", @@ -9,7 +9,7 @@ "start": "next start" }, "dependencies": { - "@carbon/react": "^1.8.0-rc.0", + "@carbon/react": "^1.8.0", "next": "12.1.4", "react": "18.0.0", "react-dom": "18.0.0" diff --git a/examples/nextjs/package.json b/examples/nextjs/package.json index b61aef86eb34..ffa10c0d1aea 100644 --- a/examples/nextjs/package.json +++ b/examples/nextjs/package.json @@ -1,7 +1,7 @@ { "name": "examples-nextjs", "private": true, - "version": "0.8.0-rc.0", + "version": "0.8.0", "scripts": { "build": "next build", "dev": "next dev", @@ -9,7 +9,7 @@ "start": "next start" }, "dependencies": { - "@carbon/react": "^1.8.0-rc.0", + "@carbon/react": "^1.8.0", "next": "12.1.4", "react": "18.0.0", "react-dom": "18.0.0" diff --git a/examples/vite/package.json b/examples/vite/package.json index ae7e323e73df..6c9c0081db22 100644 --- a/examples/vite/package.json +++ b/examples/vite/package.json @@ -1,14 +1,14 @@ { "name": "vite", "private": true, - "version": "0.6.0-rc.0", + "version": "0.6.0", "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview" }, "dependencies": { - "@carbon/react": "^1.8.0-rc.0", + "@carbon/react": "^1.8.0", "react": "^17.0.0", "react-dom": "^17.0.0" }, diff --git a/packages/carbon-components-react/package.json b/packages/carbon-components-react/package.json index 80472b24a6d1..ea484c7a02b4 100644 --- a/packages/carbon-components-react/package.json +++ b/packages/carbon-components-react/package.json @@ -1,7 +1,7 @@ { "name": "carbon-components-react", "description": "The Carbon Design System is IBM’s open-source design system for products and experiences.", - "version": "8.8.0-rc.0", + "version": "8.8.0", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.js", @@ -39,8 +39,8 @@ "sass": "^1.33.0" }, "dependencies": { - "@carbon/react": "^1.8.0-rc.0", - "@carbon/styles": "^1.8.0-rc.0", + "@carbon/react": "^1.8.0", + "@carbon/styles": "^1.8.0", "@carbon/telemetry": "0.1.0" }, "devDependencies": { diff --git a/packages/carbon-components/package.json b/packages/carbon-components/package.json index 5fc604b1c860..ede7a30b1d35 100644 --- a/packages/carbon-components/package.json +++ b/packages/carbon-components/package.json @@ -1,7 +1,7 @@ { "name": "carbon-components", "description": "The Carbon Design System is IBM’s open-source design system for products and experiences.", - "version": "11.8.0-rc.0", + "version": "11.8.0", "license": "Apache-2.0", "repository": { "type": "git", @@ -40,7 +40,7 @@ "sass": "^1.33.0" }, "dependencies": { - "@carbon/styles": "^1.8.0-rc.0", + "@carbon/styles": "^1.8.0", "@carbon/telemetry": "0.1.0" }, "devDependencies": { diff --git a/packages/elements/package.json b/packages/elements/package.json index 22893030274e..29c030b2591c 100644 --- a/packages/elements/package.json +++ b/packages/elements/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/elements", "description": "A collection of design elements in code for the IBM Design Language", - "version": "11.6.0-rc.0", + "version": "11.6.0", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.js", @@ -36,12 +36,12 @@ }, "dependencies": { "@carbon/colors": "^11.3.0", - "@carbon/grid": "^11.4.0-rc.0", - "@carbon/icons": "^11.6.0-rc.0", - "@carbon/layout": "^11.4.0-rc.0", + "@carbon/grid": "^11.4.0", + "@carbon/icons": "^11.6.0", + "@carbon/layout": "^11.4.0", "@carbon/motion": "^11.2.0", - "@carbon/themes": "^11.5.0-rc.0", - "@carbon/type": "^11.5.0-rc.0" + "@carbon/themes": "^11.5.0", + "@carbon/type": "^11.5.0" }, "devDependencies": { "@carbon/cli": "^11.2.0", diff --git a/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap index aa26099afc26..8db103552f2e 100644 --- a/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -305,6 +305,7 @@ Array [ "textSecondary", "themes", "toggleOff", + "unstable_metadata", "unstable_tokens", "v10", "warmGray", diff --git a/packages/grid/package.json b/packages/grid/package.json index 2eefb0eae6a9..4c89d4face90 100644 --- a/packages/grid/package.json +++ b/packages/grid/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/grid", "description": "Grid for digital and software products using the Carbon Design System", - "version": "11.4.0-rc.0", + "version": "11.4.0", "license": "Apache-2.0", "repository": { "type": "git", @@ -32,7 +32,7 @@ "clean": "rimraf scss/_inlined scss/vendor" }, "dependencies": { - "@carbon/layout": "^11.4.0-rc.0" + "@carbon/layout": "^11.4.0" }, "devDependencies": { "@carbon/cli": "^11.2.0", diff --git a/packages/icons-react/package.json b/packages/icons-react/package.json index ed91bb5579d6..4a357cff82f3 100644 --- a/packages/icons-react/package.json +++ b/packages/icons-react/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/icons-react", "description": "React components for icons in digital and software products using the Carbon Design System", - "version": "11.6.0-rc.0", + "version": "11.6.0", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.js", @@ -42,7 +42,7 @@ }, "devDependencies": { "@carbon/icon-build-helpers": "^1.2.0", - "@carbon/icons": "^11.6.0-rc.0", + "@carbon/icons": "^11.6.0", "rimraf": "^3.0.2" }, "sideEffects": false diff --git a/packages/icons-vue/package.json b/packages/icons-vue/package.json index eb38382cbf31..0b16f2f164b1 100644 --- a/packages/icons-vue/package.json +++ b/packages/icons-vue/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/icons-vue", "description": "Vue components for icons in digital and software products using the Carbon Design System", - "version": "10.55.0-rc.0", + "version": "10.55.0", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.js", @@ -32,7 +32,7 @@ }, "devDependencies": { "@carbon/cli-reporter": "^10.5.0", - "@carbon/icons": "^11.6.0-rc.0", + "@carbon/icons": "^11.6.0", "fs-extra": "^10.0.0", "prettier": "^2.6.2", "rimraf": "^3.0.0", diff --git a/packages/icons/icons.yml b/packages/icons/icons.yml index 3ace85742f96..405191349527 100644 --- a/packages/icons/icons.yml +++ b/packages/icons/icons.yml @@ -4016,7 +4016,7 @@ sizes: - 32 - name: cloud--auditing - friendly_name: Cloud auditing + friendly_name: IBM Cloud® Activity Tracker aliases: - cloud - auditing @@ -8867,7 +8867,7 @@ sizes: - 32 - name: ibm-cloud--kubernetes-service - friendly_name: IBM Cloud® Kubernetes Services + friendly_name: IBM Cloud® Kubernetes Service aliases: - services - cloud diff --git a/packages/icons/package.json b/packages/icons/package.json index e9521dd1e62a..24deff2ac3e9 100644 --- a/packages/icons/package.json +++ b/packages/icons/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/icons", "description": "Icons for digital and software products using the Carbon Design System", - "version": "11.6.0-rc.0", + "version": "11.6.0", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.js", diff --git a/packages/layout/package.json b/packages/layout/package.json index e75bc38cfd68..87028fbf448f 100644 --- a/packages/layout/package.json +++ b/packages/layout/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/layout", "description": "Layout helpers for digital and software products using the Carbon Design System", - "version": "11.4.0-rc.0", + "version": "11.4.0", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.js", diff --git a/packages/pictograms-react/examples/storybook/yarn.lock b/packages/pictograms-react/examples/storybook/yarn.lock index 838606380a34..ba7be0d86cc8 100644 --- a/packages/pictograms-react/examples/storybook/yarn.lock +++ b/packages/pictograms-react/examples/storybook/yarn.lock @@ -2472,9 +2472,9 @@ browserslist@^4.5.2, browserslist@^4.6.0, browserslist@^4.6.1: node-releases "^1.1.23" buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + version "1.1.2" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== buffer-xor@^1.0.3: version "1.0.3" @@ -2794,10 +2794,10 @@ commander@2.17.x: resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== -commander@^2.19.0: - version "2.20.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" - integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== +commander@^2.19.0, commander@^2.20.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== commander@~2.19.0: version "2.19.0" @@ -6914,10 +6914,10 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@~0.5.10: - version "0.5.12" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599" - integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ== +source-map-support@~0.5.12: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -7235,13 +7235,13 @@ terser-webpack-plugin@^1.1.0, terser-webpack-plugin@^1.2.4: worker-farm "^1.7.0" terser@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-4.0.0.tgz#ef356f6f359a963e2cc675517f21c1c382877374" - integrity sha512-dOapGTU0hETFl1tCo4t56FN+2jffoKyER9qBGoUFyZ6y7WLoKT0bF+lAYi6B6YsILcGF3q1C2FBh8QcKSCgkgA== + version "4.8.1" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.1.tgz#a00e5634562de2239fd404c649051bf6fc21144f" + integrity sha512-4GnLC0x667eJG0ewJTa6z/yXrbLGv80D9Ru6HIpCQmO+Q4PfEtBFi0ObSckqwL6VyQv/7ENJieXHo2ANmdQwgw== dependencies: - commander "^2.19.0" + commander "^2.20.0" source-map "~0.6.1" - source-map-support "~0.5.10" + source-map-support "~0.5.12" text-table@0.2.0: version "0.2.0" diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index dc154b6235a1..b92246026eff 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -1269,7 +1269,12 @@ Map { "type": "string", }, "selectorsFloatingMenus": Object { - "type": "string", + "args": Array [ + Object { + "type": "string", + }, + ], + "type": "arrayOf", }, "size": Object { "args": Array [ @@ -8465,7 +8470,7 @@ Map { "type": "oneOf", }, "target": Object { - "type": "element", + "type": "object", }, "x": Object { "args": Array [ diff --git a/packages/react/package.json b/packages/react/package.json index 3296e5d18726..7085aefa6bf3 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/react", "description": "React components for the Carbon Design System", - "version": "1.8.0-rc.0", + "version": "1.8.0", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.js", @@ -44,9 +44,9 @@ "dependencies": { "@babel/runtime": "^7.18.3", "@carbon/feature-flags": "^0.8.0", - "@carbon/icons-react": "^11.6.0-rc.0", - "@carbon/layout": "^11.4.0-rc.0", - "@carbon/styles": "^1.8.0-rc.0", + "@carbon/icons-react": "^11.6.0", + "@carbon/layout": "^11.4.0", + "@carbon/styles": "^1.8.0", "@carbon/telemetry": "0.1.0", "classnames": "2.3.1", "copy-to-clipboard": "^3.3.1", @@ -73,7 +73,7 @@ "@babel/preset-env": "^7.18.2", "@babel/preset-react": "^7.17.12", "@carbon/test-utils": "^10.25.0", - "@carbon/themes": "^11.5.0-rc.0", + "@carbon/themes": "^11.5.0", "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-commonjs": "^21.0.0", "@rollup/plugin-node-resolve": "^13.0.0", diff --git a/packages/react/src/components/ComboBox/ComboBox-test.js b/packages/react/src/components/ComboBox/ComboBox-test.js index 2cd0991d5ce2..fda420019087 100644 --- a/packages/react/src/components/ComboBox/ComboBox-test.js +++ b/packages/react/src/components/ComboBox/ComboBox-test.js @@ -6,12 +6,10 @@ */ import React from 'react'; -import { mount } from 'enzyme'; import { render, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { findListBoxNode, - findMenuNode, assertMenuOpen, assertMenuClosed, generateItems, @@ -19,10 +17,9 @@ import { } from '../ListBox/test-helpers'; import ComboBox from '../ComboBox'; -const prefix = 'cds'; -const findInputNode = (wrapper) => wrapper.find(`.${prefix}--text-input`); -const openMenu = (wrapper) => { - wrapper.find(`[role="combobox"]`).simulate('click'); +const findInputNode = () => screen.getByRole('combobox'); +const openMenu = () => { + userEvent.click(findInputNode()); }; describe('ComboBox', () => { @@ -38,28 +35,23 @@ describe('ComboBox', () => { }; }); - it('should display the placeholder text when no items are selected and the control is not focused', () => { - const wrapper = mount(); - expect(findInputNode(wrapper).prop('value')).toBe(''); - expect(findInputNode(wrapper).prop('placeholder')).toBe( - mockProps.placeholder - ); - }); - it('should display the menu of items when a user clicks on the input', () => { - const wrapper = mount(); - findInputNode(wrapper).simulate('click'); + render(); - assertMenuOpen(wrapper, mockProps); + userEvent.click(findInputNode()); + + assertMenuOpen(mockProps); }); it('should call `onChange` each time an item is selected', () => { - const wrapper = mount(); + render(); expect(mockProps.onChange).not.toHaveBeenCalled(); for (let i = 0; i < mockProps.items.length; i++) { - openMenu(wrapper); - wrapper.find('ListBoxMenuItem').at(i).simulate('click'); + openMenu(); + + userEvent.click(screen.getAllByRole('option')[i]); + expect(mockProps.onChange).toHaveBeenCalledTimes(i + 1); expect(mockProps.onChange).toHaveBeenCalledWith({ selectedItem: mockProps.items[i], @@ -69,41 +61,40 @@ describe('ComboBox', () => { it('capture filter text events', () => { const onInputChange = jest.fn(); - const wrapper = mount( - - ); + render(); - findInputNode(wrapper).simulate('change', { - target: { value: 'something' }, - }); + userEvent.type(findInputNode(), 'something'); expect(onInputChange).toHaveBeenCalledWith('something'); }); it('should render custom item components', () => { - const wrapper = mount(); - wrapper.setProps({ - itemToElement: (item) =>
{item.text}
, + const itemToElement = jest.fn((item) => { + return
{item.text}
; }); - openMenu(wrapper); + render(); + openMenu(); - expect(wrapper.find(`.mock-item`).length).toBe(mockProps.items.length); + expect(itemToElement).toHaveBeenCalled(); }); it('should let the user select an option by clicking on the option node', () => { - const wrapper = mount(); - openMenu(wrapper); - wrapper.find('ListBoxMenuItem').at(0).simulate('click'); + render(); + openMenu(); + + userEvent.click(screen.getAllByRole('option')[0]); + expect(mockProps.onChange).toHaveBeenCalledTimes(1); expect(mockProps.onChange).toHaveBeenCalledWith({ selectedItem: mockProps.items[0], }); - assertMenuClosed(wrapper); + assertMenuClosed(); mockProps.onChange.mockClear(); - openMenu(wrapper); - wrapper.find('ListBoxMenuItem').at(1).simulate('click'); + openMenu(); + + userEvent.click(screen.getAllByRole('option')[1]); expect(mockProps.onChange).toHaveBeenCalledTimes(1); expect(mockProps.onChange).toHaveBeenCalledWith({ selectedItem: mockProps.items[1], @@ -112,12 +103,10 @@ describe('ComboBox', () => { describe('should display initially selected item found in `initialSelectedItem`', () => { it('using an object type for the `initialSelectedItem` prop', () => { - const wrapper = mount( + render( ); - expect(findInputNode(wrapper).prop('value')).toEqual( - mockProps.items[0].label - ); + expect(findInputNode()).toHaveDisplayValue(mockProps.items[0].label); }); it('using a string type for the `initialSelectedItem` prop', () => { @@ -127,22 +116,19 @@ describe('ComboBox', () => { items: ['1', '2', '3'], }; - const wrapper = mount( + render( ); - expect(findInputNode(wrapper).prop('value')).toEqual(mockProps.items[1]); + expect(findInputNode()).toHaveDisplayValue(mockProps.items[1]); }); }); describe('should display selected item found in `selectedItem`', () => { it('using an object type for the `selectedItem` prop', () => { - const wrapper = mount( - - ); - expect(findInputNode(wrapper).prop('value')).toEqual( - mockProps.items[0].label - ); + render(); + + expect(findInputNode()).toHaveDisplayValue(mockProps.items[0].label); }); it('using a string type for the `selectedItem` prop', () => { @@ -152,55 +138,37 @@ describe('ComboBox', () => { items: ['1', '2', '3'], }; - const wrapper = mount( - - ); + render(); - expect(findInputNode(wrapper).prop('value')).toEqual(mockProps.items[1]); + expect(findInputNode()).toHaveDisplayValue(mockProps.items[1]); }); }); describe('when disabled', () => { it('should not let the user edit the input node', () => { - const wrapper = mount(); - expect(findInputNode(wrapper).prop('disabled')).toBe(true); - expect(findInputNode(wrapper).prop('value')).toBe(''); - - findInputNode(wrapper).simulate('change', { - target: { - value: 'a', - }, - }); + render(); + + expect(findInputNode()).toHaveAttribute('disabled'); + + expect(findInputNode()).toHaveDisplayValue(''); + + userEvent.type(findInputNode(), 'a'); - expect(findInputNode(wrapper).prop('value')).toBe(''); + expect(findInputNode()).toHaveDisplayValue(''); }); it('should not let the user expand the menu', () => { - const wrapper = mount(); - openMenu(wrapper); - expect(findListBoxNode(wrapper).hasClass('bx--list-box--expanded')).toBe( - false - ); + render(); + openMenu(); + expect(findListBoxNode()).not.toHaveClass('cds--list-box--expanded'); }); }); describe('downshift quirks', () => { - it('should not trigger the menu when typing a space in input', () => { - const wrapper = mount(); - - openMenu(wrapper); - findInputNode(wrapper).simulate('change', { - target: { - value: ' ', - }, - }); - - expect(findMenuNode(wrapper).length).toBe(1); - }); - it('should set `inputValue` to an empty string if a false-y value is given', () => { - const wrapper = mount(); - expect(wrapper.find('input').instance().value).toBe(''); + render(); + + expect(findInputNode()).toHaveDisplayValue(''); }); it('should only render one listbox at a time when multiple comboboxes are present', () => { diff --git a/packages/react/src/components/ComposedModal/next/ComposedModal.js b/packages/react/src/components/ComposedModal/next/ComposedModal.js index 9ea219ce08d8..adba8b2543d2 100644 --- a/packages/react/src/components/ComposedModal/next/ComposedModal.js +++ b/packages/react/src/components/ComposedModal/next/ComposedModal.js @@ -329,7 +329,7 @@ ComposedModal.propTypes = { /** * Specify the CSS selectors that match the floating menus */ - selectorsFloatingMenus: PropTypes.string, + selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string), /** * Specify the size variant. diff --git a/packages/react/src/components/Dropdown/Dropdown-story.js b/packages/react/src/components/Dropdown/Dropdown-story.js deleted file mode 100644 index de14f72b7111..000000000000 --- a/packages/react/src/components/Dropdown/Dropdown-story.js +++ /dev/null @@ -1,206 +0,0 @@ -/** - * 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 { action } from '@storybook/addon-actions'; -import { - withKnobs, - boolean, - object, - select, - text, -} from '@storybook/addon-knobs'; -import Dropdown from '../Dropdown'; -import DropdownSkeleton from './Dropdown.Skeleton'; -import mdx from './Dropdown.mdx'; -import { - ChartBubble, - ChartColumnFloating, - ChartVennDiagram, -} from '@carbon/icons-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 - a disabled item', - disabled: true, - }, - { - id: 'option-4', - text: 'Option 4', - }, - { - id: 'option-5', - text: 'Option 5', - }, -]; - -const sizes = { - 'Small (sm)': 'sm', - 'Medium (md) - default': undefined, - 'Large (lg)': 'lg', -}; - -const directions = { - 'Bottom (default)': 'bottom', - 'Top ': 'top', -}; - -const types = { - Default: 'default', - Inline: 'inline', -}; - -const props = () => ({ - id: text('Dropdown ID (id)', 'carbon-dropdown-example'), - size: select('Field size (size)', sizes, undefined) || undefined, - direction: select('Dropdown direction (direction)', directions, 'bottom'), - label: text('Label (label)', 'Dropdown menu options'), - ariaLabel: text('Aria Label (ariaLabel)', 'Dropdown'), - disabled: boolean('Disabled (disabled)', false), - light: boolean('Light variant (light)', false), - titleText: text('Title (titleText)', 'Dropdown label'), - hideLabel: boolean('No title text shown (hideLabel)', false), - helperText: text('Helper text (helperText)', 'This is some helper text.'), - invalid: boolean('Show form validation UI (invalid)', false), - invalidText: text( - 'Form validation UI content (invalidText)', - 'A valid value is required' - ), - type: select('Type (type)', types, 'default'), - warn: boolean('Show warning state (warn)', false), - warnText: text( - 'Warning state text (warnText)', - 'This mode may perform worse on older machines' - ), - listBoxMenuIconTranslationIds: object( - 'Listbox menu icon translation IDs (for translateWithId callback)', - { - 'close.menu': 'Close menu', - 'open.menu': 'Open menu', - } - ), -}); - -export default { - title: 'Components/Dropdown', - component: Dropdown, - subcomponents: { - DropdownSkeleton, - }, - decorators: [withKnobs], - parameters: { - docs: { - page: mdx, - }, - }, -}; - -export const Default = () => ( -
- (item ? item.text : '')} - onChange={action('onChange')} - /> -
-); -export const RenderSelectedItem = () => ( -
- (item ? item.text : '')} - itemToElement={(item) => ( - <> - {React.createElement(item.icon)} - - {item.text} - - - )} - renderSelectedItem={(item) => ( - <> - {React.createElement(item.icon)} - - {item.text} - - - )} - onChange={action('onChange')} - /> -
-); - -export const Inline = () => ( -
- (item ? item.text : '')} - onChange={action('onChange')} - /> -
-); - -export const Playground = () => { - const { listBoxMenuIconTranslationIds, ...dropdownProps } = props(); - return ( -
- (item ? item.text : '')} - translateWithId={(id) => listBoxMenuIconTranslationIds[id]} - /> -
- ); -}; - -export const Skeleton = () => ( -
- -
-); diff --git a/packages/react/src/components/Dropdown/Dropdown-test.js b/packages/react/src/components/Dropdown/Dropdown-test.js index 6e8e26df10be..b4adc91c994e 100644 --- a/packages/react/src/components/Dropdown/Dropdown-test.js +++ b/packages/react/src/components/Dropdown/Dropdown-test.js @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import { cleanup, render } from '@testing-library/react'; import React from 'react'; -import { mount } from 'enzyme'; +import { render, screen, cleanup } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import { assertMenuOpen, assertMenuClosed, @@ -33,39 +33,38 @@ describe('Dropdown', () => { }; }); - it('should render', () => { - const wrapper = mount(); - expect(wrapper).toMatchSnapshot(); - }); - it('should initially render with the menu not open', () => { - const wrapper = mount(); - assertMenuClosed(wrapper); + render(); + assertMenuClosed(); }); it('should let the user open the menu by clicking on the control', () => { - const wrapper = mount(); - openMenu(wrapper); - assertMenuOpen(wrapper, mockProps); + render(); + openMenu(); + assertMenuOpen(mockProps); }); it('should render with strings as items', () => { - const wrapper = mount(); - openMenu(wrapper); - expect(wrapper).toMatchSnapshot(); + render(); + openMenu(); + + expect(screen.getByText('zar')).toBeInTheDocument(); + expect(screen.getByText('doz')).toBeInTheDocument(); }); it('should render custom item components', () => { - const wrapper = mount(); - wrapper.setProps({ - itemToElement: (item) =>
{item.label}
, + const itemToElement = jest.fn((item) => { + return
{item.label}
; }); - openMenu(wrapper); - expect(wrapper).toMatchSnapshot(); + + render(); + openMenu(); + + expect(itemToElement).toHaveBeenCalled(); }); it('should render selectedItem as an element', () => { - const wrapper = mount( + render( { /> ); // custom element should be rendered for the selected item - expect(wrapper.find('#a-custom-element-for-selected-item')).toHaveLength(1); + expect( + document.querySelector('#a-custom-element-for-selected-item') + ).toBeDefined(); // the title should use the normal itemToString method - expect(wrapper.find('button').instance()).toHaveAttribute( - 'title', - 'Item 1' - ); + + expect(screen.getByText('Item 1')).toBeInTheDocument(); }); describe('title', () => { - let wrapper; - let renderedLabel; - - beforeEach(() => { - wrapper = mount(); - renderedLabel = wrapper.find('label[className="cds--label"]'); - }); - it('renders a title', () => { - expect(renderedLabel.length).toBe(1); + render(); + expect(screen.getByText('Email Input')).toBeInTheDocument(); }); it('has the expected classes', () => { - expect(renderedLabel.hasClass(`${prefix}--label`)).toEqual(true); - }); - - it('should set title as expected', () => { - expect(renderedLabel.text()).toEqual('Email Input'); + render(); + expect(screen.getByText('Email Input')).toHaveClass(`${prefix}--label`); }); }); describe('helper', () => { it('renders a helper', () => { - const wrapper = mount( - - ); - const renderedHelper = wrapper.find(`.${prefix}--form__helper-text`); - expect(renderedHelper.length).toEqual(1); + render(); + expect(screen.getByText('Email Input')).toBeInTheDocument(); }); it('renders children as expected', () => { - const wrapper = mount( + render( @@ -131,43 +117,35 @@ describe('Dropdown', () => { {...mockProps} /> ); - const renderedHelper = wrapper.find(`.${prefix}--form__helper-text`); - expect(renderedHelper.props().children).toEqual( - - This helper text has a link. - - ); - }); - it('should set helper text as expected', () => { - const wrapper = mount(); - wrapper.setProps({ helperText: 'Helper text' }); - const renderedHelper = wrapper.find(`.${prefix}--form__helper-text`); - expect(renderedHelper.text()).toEqual('Helper text'); + expect(screen.getByRole('link')).toBeInTheDocument(); }); }); it('should specify light version as expected', () => { - const wrapper = mount(); - expect(wrapper.props().light).toEqual(false); - wrapper.setProps({ light: true }); - expect(wrapper.props().light).toEqual(true); + render(); + + expect(document.querySelector('.cds--list-box')).toHaveClass( + 'cds--dropdown--light' + ); }); it('should let the user select an option by clicking on the option node', () => { - const wrapper = mount(); - openMenu(wrapper); - wrapper.find('ListBoxMenuItem').at(0).simulate('click'); + render(); + openMenu(); + + userEvent.click(screen.getByText('Item 0')); expect(mockProps.onChange).toHaveBeenCalledTimes(1); expect(mockProps.onChange).toHaveBeenCalledWith({ selectedItem: mockProps.items[0], }); - assertMenuClosed(wrapper); + assertMenuClosed(); mockProps.onChange.mockClear(); - openMenu(wrapper); - wrapper.find('ListBoxMenuItem').at(1).simulate('click'); + openMenu(); + userEvent.click(screen.getByText('Item 1')); + expect(mockProps.onChange).toHaveBeenCalledTimes(1); expect(mockProps.onChange).toHaveBeenCalledWith({ selectedItem: mockProps.items[1], @@ -176,13 +154,11 @@ describe('Dropdown', () => { describe('should display initially selected item found in `initialSelectedItem`', () => { it('using an object type for the `initialSelectedItem` prop', () => { - const wrapper = mount( + render( ); - expect(wrapper.find(`span.${prefix}--list-box__label`).text()).toEqual( - mockProps.items[0].label - ); + expect(screen.getByText(mockProps.items[0].label)).toBeInTheDocument(); }); it('using a string type for the `initialSelectedItem` prop', () => { @@ -192,13 +168,11 @@ describe('Dropdown', () => { items: ['1', '2', '3'], }; - const wrapper = mount( + render( ); - expect(wrapper.find(`span.${prefix}--list-box__label`).text()).toEqual( - mockProps.items[1] - ); + expect(screen.getByText(mockProps.items[1])).toBeInTheDocument(); }); }); @@ -216,14 +190,9 @@ describe('Dropdown', () => { describe('DropdownSkeleton', () => { describe('Renders as expected', () => { it('Has the expected classes', () => { - const wrapper = mount(); - expect(wrapper.childAt(0).hasClass(`${prefix}--skeleton`)).toEqual(true); - expect(wrapper.childAt(0).hasClass(`${prefix}--dropdown-v2`)).toEqual( - true - ); - expect(wrapper.childAt(0).hasClass(`${prefix}--list-box--sm`)).toEqual( - true - ); + render(); + + expect(document.querySelector(`${prefix}--skeleton`)).toBeDefined(); }); }); }); diff --git a/packages/react/src/components/Dropdown/next/Dropdown.stories.js b/packages/react/src/components/Dropdown/Dropdown.stories.js similarity index 60% rename from packages/react/src/components/Dropdown/next/Dropdown.stories.js rename to packages/react/src/components/Dropdown/Dropdown.stories.js index e78168493da7..4fb7009bef49 100644 --- a/packages/react/src/components/Dropdown/next/Dropdown.stories.js +++ b/packages/react/src/components/Dropdown/Dropdown.stories.js @@ -1,14 +1,14 @@ /** * Copyright IBM Corp. 2016, 2018 - * + *dropdow.stor * 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 { default as Dropdown, DropdownSkeleton } from '../'; -import { Layer } from '../../Layer'; -import mdx from '../Dropdown.mdx'; +import { default as Dropdown, DropdownSkeleton } from './'; +import { Layer } from '../Layer'; +import mdx from './Dropdown.mdx'; export default { title: 'Components/Dropdown', @@ -17,9 +17,20 @@ export default { DropdownSkeleton, }, argTypes: { - size: { - options: ['sm', 'md', 'lg'], - control: { type: 'select' }, + items: { + table: { disable: true }, + }, + initialSelectedItem: { + table: { disable: true }, + }, + itemToElement: { + table: { disable: true }, + }, + className: { + table: { disable: true }, + }, + id: { + table: { disable: true }, }, }, parameters: { @@ -57,7 +68,7 @@ const items = [ }, ]; -export const Default = (args) => ( +export const Playground = (args) => (
(
); -export const Inline = (args) => ( +Playground.argTypes = { + invalid: { + control: { + type: 'boolean', + }, + defaultValue: false, + }, + invalidText: { + control: { + type: 'text', + }, + defaultValue: 'invalid selection', + }, + disabled: { + control: { + type: 'boolean', + }, + defaultValue: false, + }, + hideLabel: { + control: { + type: 'boolean', + }, + defaultValue: false, + }, + helperText: { + control: { + type: 'text', + }, + }, + label: { + control: { + type: 'text', + }, + defaultValue: 'this is an example label', + }, + warn: { + control: { + type: 'boolean', + }, + defaultValue: false, + }, + warnText: { + control: { + type: 'text', + }, + defaultValue: 'please notice the warning', + }, + titleText: { + control: { + type: 'text', + }, + defaultValue: 'this is an example title', + }, + size: { + options: ['sm', 'md', 'lg'], + control: { type: 'select' }, + }, + type: { + control: { type: 'select' }, + options: ['default', 'inline'], + defaultValue: 'default', + }, +}; + +export const Default = () => ( +
+ (item ? item.text : '')} + /> +
+); + +export const Inline = () => (
( type="inline" items={items} itemToString={(item) => (item ? item.text : '')} - {...args} />
); -export const WithLayer = (args) => ( +export const WithLayer = () => (
( label="Dropdown menu options" items={items} itemToString={(item) => (item ? item.text : '')} - {...args} /> ( label="Dropdown menu options" items={items} itemToString={(item) => (item ? item.text : '')} - {...args} /> ( label="Dropdown menu options" items={items} itemToString={(item) => (item ? item.text : '')} - {...args} />
); -export const InlineWithLayer = (args) => ( +export const InlineWithLayer = () => (
( type="inline" items={items} itemToString={(item) => (item ? item.text : '')} - {...args} /> ( type="inline" items={items} itemToString={(item) => (item ? item.text : '')} - {...args} /> ( type="inline" items={items} itemToString={(item) => (item ? item.text : '')} - {...args} />
); -export const Skeleton = (args) => ( +export const Skeleton = () => (
- +
); diff --git a/packages/react/src/components/Dropdown/__snapshots__/Dropdown-test.js.snap b/packages/react/src/components/Dropdown/__snapshots__/Dropdown-test.js.snap deleted file mode 100644 index 368e56917620..000000000000 --- a/packages/react/src/components/Dropdown/__snapshots__/Dropdown-test.js.snap +++ /dev/null @@ -1,663 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Dropdown should render 1`] = ` - -
- -
- - -
- -
- -
- -`; - -exports[`Dropdown should render custom item components 1`] = ` - -
- -
- - -
- -
-
- -
- Item 0 -
-
-
-
-
- -
-
- -
- Item 1 -
-
-
-
-
- -
-
- -
- Item 2 -
-
-
-
-
- -
-
- -
- Item 3 -
-
-
-
-
- -
-
- -
- Item 4 -
-
-
-
-
-
-
-
-
-
-
-`; - -exports[`Dropdown should render with strings as items 1`] = ` - -
- -
- - -
- -
-
- zar -
-
-
- -
-
- doz -
-
-
-
-
-
-
-
-
-`; diff --git a/packages/react/src/components/ListBox/test-helpers.js b/packages/react/src/components/ListBox/test-helpers.js index d454370cc55a..ad45c27f49e1 100644 --- a/packages/react/src/components/ListBox/test-helpers.js +++ b/packages/react/src/components/ListBox/test-helpers.js @@ -6,42 +6,64 @@ */ const prefix = 'cds'; +import userEvent from '@testing-library/user-event'; // Finding nodes in a ListBox -export const findListBoxNode = (wrapper) => - wrapper.find(`.${prefix}--list-box`); -export const findMenuNode = (wrapper) => - wrapper.find(`.${prefix}--list-box__menu`); -export const findMenuItemNode = (wrapper, index) => - wrapper.find('ListBoxMenuItem').at(index); -export const findMenuIconNode = (wrapper) => - wrapper.find(`.${prefix}--list-box__menu-icon`); -export const findFieldNode = (wrapper) => - wrapper.find(`.${prefix}--list-box__field`); -export const findComboboxNode = (wrapper) => - wrapper.find(`.${prefix}--list-box[role="combobox"]`); -export const findPopupNode = (wrapper) => - wrapper.find('[aria-haspopup="listbox"]').hostNodes(); +export const findListBoxNode = () => { + return document.querySelector('.cds--list-box'); +}; + +export const findMenuNode = () => { + return document.querySelector(`.${prefix}--list-box__menu`); +}; + +export const findMenuItemNode = (index) => { + const nodes = document.querySelectorAll(`.${prefix}--list-box__menu-item`); + if (nodes[index]) { + return nodes[index]; + } + throw new Error(`Unable to find node at index: ${index} in: ${nodes}`); +}; + +export const findMenuIconNode = () => { + return document.querySelector(`.${prefix}--list-box__menu-icon`); +}; + +export const findFieldNode = () => { + return document.querySelector(`.${prefix}--list-box__field`); +}; + +export const findComboboxNode = () => { + return document.querySelector(`.${prefix}--list-box[role="combobox"]`); +}; + +export const findPopupNode = () => { + return document.querySelector('[aria-haspopup="listbox"]'); +}; // Actions -export const openMenu = (wrapper) => findFieldNode(wrapper).simulate('click'); +export const openMenu = () => { + userEvent.click(findFieldNode()); +}; // Common assertions, useful for validating a11y props are set when needed -export const assertMenuOpen = (wrapper, mockProps) => { - expect(findMenuNode(wrapper).children().length).toBe(mockProps.items.length); - expect(findMenuIconNode(wrapper).prop('className')).toEqual( - expect.stringContaining(`${prefix}--list-box__menu-icon--open`) +export const assertMenuOpen = (mockProps) => { + expect(findMenuNode().childNodes.length).toBe(mockProps.items.length); + + expect(findMenuIconNode()).toHaveClass( + `${prefix}--list-box__menu-icon--open` ); - expect(findPopupNode(wrapper).prop('aria-expanded')).toBe(true); + + expect(findPopupNode()).toHaveAttribute('aria-expanded', 'true'); }; -export const assertMenuClosed = (wrapper) => { - expect(findMenuIconNode(wrapper).prop('className')).toEqual( - expect.stringContaining(`${prefix}--list-box__menu-icon`) - ); - expect(findMenuIconNode(wrapper).prop('className')).not.toEqual( - expect.stringContaining(`${prefix}--list-box__menu-icon--open`) + +export const assertMenuClosed = () => { + expect(findMenuIconNode()).toHaveClass(`${prefix}--list-box__menu-icon`); + + expect(findMenuIconNode()).not.toHaveClass( + `${prefix}--list-box__menu-icon--open` ); - expect(findPopupNode(wrapper).prop('aria-expanded')).toBe(false); + expect(findPopupNode()).toHaveAttribute('aria-expanded', 'false'); }; /** diff --git a/packages/react/src/components/Menu/Menu-test.js b/packages/react/src/components/Menu/Menu-test.js index e7c6e6786567..43974f5e89d2 100644 --- a/packages/react/src/components/Menu/Menu-test.js +++ b/packages/react/src/components/Menu/Menu-test.js @@ -6,134 +6,110 @@ */ import React from 'react'; -import Menu, { - MenuItem, - MenuRadioGroup, - MenuSelectableItem, - MenuDivider, -} from '../Menu'; -import { mount } from 'enzyme'; - -const prefix = 'cds'; +import Menu, { MenuItem } from '../Menu'; +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; describe('Menu', () => { describe('renders as expected', () => { - describe('menu', () => { - it("isn't rendered when closed", () => { - const wrapper = mount(); - expect(wrapper.getDOMNode()).toBe(null); - }); - - it('receives the expected classes when opened', () => { - const wrapper = mount(); - const container = wrapper.getDOMNode(); - - expect(container.classList.contains(`${prefix}--menu`)).toBe(true); - expect(container.classList.contains(`${prefix}--menu--open`)).toBe( - true - ); - }); + it('should place a className on the outermost element', () => { + render(); + + expect(document.querySelector('.custom-class')).toBeDefined(); }); - describe('option', () => { - it('receives the expected classes', () => { - const wrapper = mount(); - const container = wrapper.childAt(0).childAt(0); - - expect(container.hasClass(`${prefix}--menu-option`)).toBe(true); - }); - - it('renders props.label', () => { - const wrapper = mount(); - - expect(wrapper.find(`span.${prefix}--menu-option__label`).text()).toBe( - 'Copy' - ); - expect( - wrapper.find(`span.${prefix}--menu-option__label`).prop('title') - ).toBe('Copy'); - }); - - it('renders props.shortcut when provided', () => { - const wrapper = mount(); - - expect( - wrapper.find(`div.${prefix}--menu-option__info`).length - ).toBeGreaterThan(0); - expect(wrapper.find(`div.${prefix}--menu-option__info`).text()).toBe( - '⌘C' - ); - }); - - it('respects props.disabled', () => { - const wrapper = mount(); - const content = wrapper.find(`div.${prefix}--menu-option__content`); - - expect( - content.hasClass(`${prefix}--menu-option__content--disabled`) - ).toBe(true); - expect( - wrapper.find(`li.${prefix}--menu-option`).prop('aria-disabled') - ).toBe(true); - }); - - it('supports danger kind', () => { - const wrapper = mount(); - const option = wrapper.find(`.${prefix}--menu-option`); - - expect(option.hasClass(`${prefix}--menu-option--danger`)).toBe(true); - }); - - it('renders props.children as submenu', () => { - const wrapper = mount( - - - - - - - ); - - const level1 = wrapper.find(`li.${prefix}--menu-option`).at(0); - - expect(level1.find(`ul.${prefix}--menu`).length).toBeGreaterThan(0); - }); + it('should spread props onto ul', () => { + render(); + + expect(screen.getByRole('menu')).toHaveAttribute( + 'data-testid', + 'test-id' + ); }); - describe('radiogroup', () => { - it('children have role "menuitemradio"', () => { - const wrapper = mount( - - ); - const options = wrapper.find(`li.${prefix}--menu-option`); + it('have an id when one is provided', () => { + render(); - expect(options.every('li[role="menuitemradio"]')).toBe(true); - }); + expect(screen.getByRole('menu')).toHaveAttribute('id', 'test-id'); }); - describe('selectable', () => { - it('has role "menuitemcheckbox"', () => { - const wrapper = mount(); - const container = wrapper.childAt(0); + it('should call onClose on key down', () => { + const onClose = jest.fn(); + render( + + + + ); + + userEvent.type(screen.getByRole('menuitem'), '{enter}'); - expect(container.prop('role')).toBe('menuitemcheckbox'); - }); + expect(onClose).toHaveBeenCalled(); }); - describe('divider', () => { - it('receives the expected classes', () => { - const wrapper = mount(); - const container = wrapper.childAt(0); + it('should call onClose on click', () => { + const onClose = jest.fn(); + render( + + + + ); + + userEvent.click(screen.getByRole('menuitem')); + + expect(onClose).toHaveBeenCalled(); + }); + + it('should be open if open is supplied', () => { + render(); + + expect(screen.getByRole('menu')).toBeInTheDocument(); + }); + + it('should change size based on size prop', () => { + render(); + + expect(screen.getByRole('menu')).toHaveClass('cds--menu--lg'); + }); - expect(container.hasClass(`${prefix}--menu-divider`)).toBe(true); - }); + it('should append to target element', () => { + const el = document.createElement('div'); + document.body.appendChild(el); + el.classList.add('custom-class'); + render(); + + expect(document.querySelector('.custom-class')).toBeInTheDocument(); + document.body.removeChild(el); + }); + }); +}); + +describe('MenuItem', () => { + describe('renders as expected', () => { + it('should be disabled', () => { + render(); + + expect(screen.getByRole('menuitem')).toHaveAttribute( + 'aria-disabled', + 'true' + ); + + expect(screen.getByRole('menuitem')).toHaveClass( + 'cds--menu-option--disabled' + ); + }); + + it('should change kind based on prop', () => { + render(); + + expect(screen.getByRole('menuitem')).toHaveClass( + 'cds--menu-option--danger' + ); + }); - it('has role "separator"', () => { - const wrapper = mount(); - const container = wrapper.childAt(0); + it('should render label', () => { + render(); - expect(container.prop('role')).toBe('separator'); - }); + expect(screen.getByText('item')).toBeInTheDocument(); }); }); }); diff --git a/packages/react/src/components/Menu/Menu.js b/packages/react/src/components/Menu/Menu.js index 0734b81dfdd5..d9f694007b20 100644 --- a/packages/react/src/components/Menu/Menu.js +++ b/packages/react/src/components/Menu/Menu.js @@ -351,7 +351,7 @@ Menu.propTypes = { /** * Optionally pass an element the Menu should be appended to as a child. Defaults to document.body. */ - target: PropTypes.element, + target: PropTypes.object, /** * Specify the x position where this menu is rendered diff --git a/packages/react/src/components/MultiSelect/MultiSelect.stories.js b/packages/react/src/components/MultiSelect/MultiSelect.stories.js index b56d4e975ec4..1b7656b91560 100644 --- a/packages/react/src/components/MultiSelect/MultiSelect.stories.js +++ b/packages/react/src/components/MultiSelect/MultiSelect.stories.js @@ -21,6 +21,51 @@ export default { options: ['sm', 'md', 'lg'], control: { type: 'select' }, }, + downshiftProps: { + table: { disable: true }, + }, + compareItems: { + table: { disable: true }, + }, + sortItems: { + table: { disable: true }, + }, + initialSelectedItems: { + table: { disable: true }, + }, + id: { + table: { disable: true }, + }, + items: { + table: { disable: true }, + }, + local: { + table: { disable: true }, + }, + onChange: { + table: { disable: true }, + }, + onMenuChange: { + table: { disable: true }, + }, + itemToElement: { + table: { disable: true }, + }, + itemToString: { + table: { disable: true }, + }, + selectedItems: { + table: { disable: true }, + }, + open: { + table: { disable: true }, + }, + title: { + table: { disable: true }, + }, + translateWithId: { + table: { disable: true }, + }, }, }; @@ -52,7 +97,7 @@ const items = [ }, ]; -export const Default = (args) => { +export const Playground = (args) => { return (
{ ); }; -export const WithInitialSelectedItems = (args) => { +Playground.argTypes = { + selectionFeedback: { + options: ['top', 'fixed', 'top-after-reopen'], + control: { type: 'select' }, + }, + size: { + options: ['sm', 'md', 'lg'], + control: { type: 'select' }, + defaultValue: 'md', + }, + direction: { + options: ['top', 'bottom'], + control: { type: 'radio' }, + }, + type: { + options: ['inline', 'default'], + control: { type: 'radio' }, + defaultValue: 'default', + }, + titleText: { + control: { + type: 'text', + }, + defaultValue: 'This is a MultiSelect Title', + }, + disabled: { + control: { + type: 'boolean', + }, + defaultValue: false, + }, + hideLabel: { + control: { + type: 'boolean', + }, + defaultValue: false, + }, + invalid: { + control: { + type: 'boolean', + }, + defaultValue: false, + }, + light: { + control: { + type: 'boolean', + }, + defaultValue: false, + }, + warn: { + control: { + type: 'boolean', + }, + defaultValue: false, + }, + warnText: { + control: { + type: 'text', + }, + defaultValue: 'whoopsie!', + }, + invalidText: { + control: { + type: 'text', + }, + defaultValue: 'whoopsie!', + }, + label: { + control: { + type: 'text', + }, + defaultValue: 'This is a label', + }, + clearSelectionDescription: { + control: { + type: 'text', + }, + defaultValue: 'Total items selected: ', + }, + useTitleInItem: { + control: { + type: 'text', + }, + defaultValue: 'this is the item title', + }, + clearSelectionText: { + control: { + type: 'text', + }, + defaultValue: 'To clear selection, press Delete or Backspace,', + }, +}; + +export const Default = () => { + return ( +
+ (item ? item.text : '')} + selectionFeedback="top-after-reopen" + /> +
+ ); +}; + +export const WithInitialSelectedItems = () => { return (
{ itemToString={(item) => (item ? item.text : '')} initialSelectedItems={[items[0], items[1]]} selectionFeedback="top-after-reopen" - {...args} />
); }; -export const _Filterable = (args) => { +export const _Filterable = () => { return (
{ items={items} itemToString={(item) => (item ? item.text : '')} selectionFeedback="top-after-reopen" - {...args} />
); }; -export const WithLayer = (args) => { +export const WithLayer = () => { return (
{ items={items} itemToString={(item) => (item ? item.text : '')} selectionFeedback="top-after-reopen" - {...args} /> { items={items} itemToString={(item) => (item ? item.text : '')} selectionFeedback="top-after-reopen" - {...args} /> { items={items} itemToString={(item) => (item ? item.text : '')} selectionFeedback="top-after-reopen" - {...args} /> @@ -143,7 +292,7 @@ export const WithLayer = (args) => { ); }; -export const _FilterableWithLayer = (args) => { +export const _FilterableWithLayer = () => { return (
{ items={items} itemToString={(item) => (item ? item.text : '')} selectionFeedback="top-after-reopen" - {...args} /> { items={items} itemToString={(item) => (item ? item.text : '')} selectionFeedback="top-after-reopen" - {...args} /> { items={items} itemToString={(item) => (item ? item.text : '')} selectionFeedback="top-after-reopen" - {...args} /> diff --git a/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js b/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js index 633ffa3f5e76..ce474b6214f6 100644 --- a/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js +++ b/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js @@ -6,7 +6,8 @@ */ import React from 'react'; -import { mount } from 'enzyme'; +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import FilterableMultiSelect from '../FilterableMultiSelect'; import { assertMenuOpen, @@ -16,9 +17,8 @@ import { generateGenericItem, } from '../../ListBox/test-helpers'; -const listItemName = 'ListBoxMenuItem'; -const openMenu = (wrapper) => { - wrapper.find(`[role="combobox"]`).simulate('click'); +const openMenu = () => { + userEvent.click(screen.getByRole('combobox')); }; describe('FilterableMultiSelect', () => { @@ -36,76 +36,67 @@ describe('FilterableMultiSelect', () => { }; }); - it('should render', () => { - const wrapper = mount(); - expect(wrapper).toMatchSnapshot(); - }); - - it('should display all items when the menu is open initially', () => { - const wrapper = mount(); - openMenu(wrapper); - expect(wrapper.find(listItemName).length).toBe(mockProps.items.length); + it('should display all items when the menu is open', () => { + render(); + openMenu(); + expect(screen.getAllByRole('option').length).toBe(mockProps.items.length); }); it('should initially have the menu open when open prop is provided', () => { - const wrapper = mount(); - assertMenuOpen(wrapper, mockProps); + render(); + assertMenuOpen(mockProps); }); it('should open the menu with a down arrow', () => { - const wrapper = mount(); - const menuIconNode = findMenuIconNode(wrapper); + render(); + const menuIconNode = findMenuIconNode(); - menuIconNode.simulate('keyDown', { key: 'ArrowDown' }); - assertMenuOpen(wrapper, mockProps); + userEvent.type(menuIconNode, '{arrowdown}'); + expect(screen.getAllByRole('option').length).toBe(mockProps.items.length); }); it('should let the user toggle the menu by the menu icon', () => { - const wrapper = mount(); - findMenuIconNode(wrapper).simulate('click'); - assertMenuOpen(wrapper, mockProps); - findMenuIconNode(wrapper).simulate('click'); - assertMenuClosed(wrapper); + render(); + userEvent.click(findMenuIconNode()); + + assertMenuOpen(mockProps); + userEvent.click(findMenuIconNode()); + + assertMenuClosed(); }); it('should not close the menu after a user makes a selection', () => { - const wrapper = mount(); - openMenu(wrapper); + render(); + openMenu(); - const firstListItem = wrapper.find(listItemName).at(0); + userEvent.click(screen.getAllByRole('option')[0]); - firstListItem.simulate('click'); - assertMenuOpen(wrapper, mockProps); + assertMenuOpen(mockProps); }); it('should filter a list of items by the input value', () => { - const wrapper = mount(); - openMenu(wrapper); - expect(wrapper.find(listItemName).length).toBe(mockProps.items.length); + render(); + openMenu(); + expect(screen.getAllByRole('option').length).toBe(mockProps.items.length); - wrapper - .find('[placeholder="Placeholder..."]') - .at(1) - .simulate('change', { target: { value: '3' } }); + userEvent.type(screen.getByPlaceholderText('test'), '3'); - expect(wrapper.find(listItemName).length).toBe(1); + expect(screen.getAllByRole('option').length).toBe(1); }); it('should call `onChange` with each update to selected items', () => { - const wrapper = mount( - - ); - openMenu(wrapper); + render(); + openMenu(); // Select the first two items - wrapper.find(listItemName).at(0).simulate('click'); + userEvent.click(screen.getAllByRole('option')[0]); expect(mockProps.onChange).toHaveBeenCalledTimes(1); expect(mockProps.onChange).toHaveBeenCalledWith({ selectedItems: [mockProps.items[0]], }); - wrapper.find(listItemName).at(1).simulate('click'); + userEvent.click(screen.getAllByRole('option')[1]); expect(mockProps.onChange).toHaveBeenCalledTimes(2); expect(mockProps.onChange).toHaveBeenCalledWith({ @@ -113,13 +104,13 @@ describe('FilterableMultiSelect', () => { }); // Un-select the next two items - wrapper.find(listItemName).at(0).simulate('click'); + userEvent.click(screen.getAllByRole('option')[0]); expect(mockProps.onChange).toHaveBeenCalledTimes(3); expect(mockProps.onChange).toHaveBeenCalledWith({ selectedItems: [mockProps.items[0]], }); - wrapper.find(listItemName).at(0).simulate('click'); + userEvent.click(screen.getAllByRole('option')[0]); expect(mockProps.onChange).toHaveBeenCalledTimes(4); expect(mockProps.onChange).toHaveBeenCalledWith({ selectedItems: [], @@ -127,20 +118,18 @@ describe('FilterableMultiSelect', () => { }); it('should let items stay at their position after selecting', () => { - const wrapper = mount( - - ); - openMenu(wrapper); + render(); + openMenu(); // Select the first two items - wrapper.find(listItemName).at(1).simulate('click'); + userEvent.click(screen.getAllByRole('option')[1]); expect(mockProps.onChange).toHaveBeenCalledTimes(1); expect(mockProps.onChange).toHaveBeenCalledWith({ selectedItems: [mockProps.items[1]], }); - wrapper.find(listItemName).at(1).simulate('click'); + userEvent.click(screen.getAllByRole('option')[1]); expect(mockProps.onChange).toHaveBeenCalledTimes(2); expect(mockProps.onChange).toHaveBeenCalledWith({ @@ -149,18 +138,13 @@ describe('FilterableMultiSelect', () => { }); it('should not clear input value after a user makes a selection', () => { - const wrapper = mount(); - openMenu(wrapper); + render(); + openMenu(); - wrapper - .find('[placeholder="Placeholder..."]') - .at(1) - .simulate('change', { target: { value: '3' } }); + userEvent.type(screen.getByPlaceholderText('test'), '3'); - wrapper.find(listItemName).at(0).simulate('click'); + userEvent.click(screen.getAllByRole('option')[0]); - expect( - wrapper.find('[placeholder="Placeholder..."]').at(1).props().value - ).toEqual('3'); + expect(screen.getByPlaceholderText('test')).toHaveDisplayValue(3); }); }); 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 deleted file mode 100644 index 166398a5594e..000000000000 --- a/packages/react/src/components/MultiSelect/__tests__/__snapshots__/FilterableMultiSelect-test.js.snap +++ /dev/null @@ -1,187 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`FilterableMultiSelect should render 1`] = ` - - - -
- -
-
- - - - -
-
-
-
-
-
-
-`; diff --git a/packages/sketch/package.json b/packages/sketch/package.json index 79766798b639..46d84f9b9898 100644 --- a/packages/sketch/package.json +++ b/packages/sketch/package.json @@ -2,7 +2,7 @@ "name": "@carbon/sketch", "private": true, "description": "Tooling for generating a sketch plugin to bring code to design", - "version": "11.6.0-rc.0", + "version": "11.6.0", "license": "Apache-2.0", "repository": { "type": "git", @@ -30,9 +30,9 @@ "dependencies": { "@carbon/colors": "^11.3.0", "@carbon/icon-helpers": "^10.31.0", - "@carbon/icons": "^11.6.0-rc.0", - "@carbon/themes": "^11.5.0-rc.0", - "@carbon/type": "^11.5.0-rc.0", + "@carbon/icons": "^11.6.0", + "@carbon/themes": "^11.5.0", + "@carbon/type": "^11.5.0", "@skpm/builder": "^0.8.0", "color-string": "^1.5.3", "core-js": "^3.16.0", diff --git a/packages/styles/package.json b/packages/styles/package.json index ae45266c7e70..99108b09c67f 100644 --- a/packages/styles/package.json +++ b/packages/styles/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/styles", "description": "Styles for the Carbon Design System", - "version": "1.8.0-rc.0", + "version": "1.8.0", "license": "Apache-2.0", "repository": { "type": "git", @@ -34,11 +34,11 @@ "dependencies": { "@carbon/colors": "^11.3.0", "@carbon/feature-flags": "^0.8.0", - "@carbon/grid": "^11.4.0-rc.0", - "@carbon/layout": "^11.4.0-rc.0", + "@carbon/grid": "^11.4.0", + "@carbon/layout": "^11.4.0", "@carbon/motion": "^11.2.0", - "@carbon/themes": "^11.5.0-rc.0", - "@carbon/type": "^11.5.0-rc.0", + "@carbon/themes": "^11.5.0", + "@carbon/type": "^11.5.0", "@ibm/plex": "6.0.0-next.6" }, "devDependencies": { diff --git a/packages/themes/package.json b/packages/themes/package.json index e4cd2893ca2a..14a5411dbb1c 100644 --- a/packages/themes/package.json +++ b/packages/themes/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/themes", "description": "Themes for applying color in the Carbon Design System", - "version": "11.5.0-rc.0", + "version": "11.5.0", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.js", @@ -30,8 +30,8 @@ }, "dependencies": { "@carbon/colors": "^11.3.0", - "@carbon/layout": "^11.4.0-rc.0", - "@carbon/type": "^11.5.0-rc.0", + "@carbon/layout": "^11.4.0", + "@carbon/type": "^11.5.0", "color": "^3.1.2" }, "devDependencies": { diff --git a/packages/themes/src/index.js b/packages/themes/src/index.js index 9af8b57a88a6..7a8181fdf3fe 100644 --- a/packages/themes/src/index.js +++ b/packages/themes/src/index.js @@ -10,6 +10,7 @@ import * as g10 from './g10'; import * as g90 from './g90'; import * as g100 from './g100'; import * as v10 from './v10'; +import { unstable_metadata } from './tokens'; const themes = { white, @@ -19,4 +20,4 @@ const themes = { }; export * from './white'; -export { white, g10, g90, g100, themes, v10 }; +export { white, g10, g90, g100, themes, v10, unstable_metadata }; diff --git a/packages/themes/src/tokens/__tests__/metadata-test.js b/packages/themes/src/tokens/__tests__/metadata-test.js new file mode 100644 index 000000000000..8766d82c0c14 --- /dev/null +++ b/packages/themes/src/tokens/__tests__/metadata-test.js @@ -0,0 +1,1455 @@ +/** + * 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. + */ + +import { unstable_metadata } from '../'; + +test('metadata', () => { + expect(unstable_metadata).toMatchInlineSnapshot(` + Object { + "v10": Array [ + Object { + "name": "interactive-01", + "type": "color", + }, + Object { + "name": "interactive-02", + "type": "color", + }, + Object { + "name": "interactive-03", + "type": "color", + }, + Object { + "name": "interactive-04", + "type": "color", + }, + Object { + "name": "ui-background", + "type": "color", + }, + Object { + "name": "ui-01", + "type": "color", + }, + Object { + "name": "ui-02", + "type": "color", + }, + Object { + "name": "ui-03", + "type": "color", + }, + Object { + "name": "ui-04", + "type": "color", + }, + Object { + "name": "ui-05", + "type": "color", + }, + Object { + "name": "text-01", + "type": "color", + }, + Object { + "name": "text-02", + "type": "color", + }, + Object { + "name": "text-03", + "type": "color", + }, + Object { + "name": "text-04", + "type": "color", + }, + Object { + "name": "text-05", + "type": "color", + }, + Object { + "name": "text-error", + "type": "color", + }, + Object { + "name": "icon-01", + "type": "color", + }, + Object { + "name": "icon-02", + "type": "color", + }, + Object { + "name": "icon-03", + "type": "color", + }, + Object { + "name": "link-01", + "type": "color", + }, + Object { + "name": "link-02", + "type": "color", + }, + Object { + "name": "inverse-link", + "type": "color", + }, + Object { + "name": "field-01", + "type": "color", + }, + Object { + "name": "field-02", + "type": "color", + }, + Object { + "name": "inverse-01", + "type": "color", + }, + Object { + "name": "inverse-02", + "type": "color", + }, + Object { + "name": "support-01", + "type": "color", + }, + Object { + "name": "support-02", + "type": "color", + }, + Object { + "name": "support-03", + "type": "color", + }, + Object { + "name": "support-04", + "type": "color", + }, + Object { + "name": "inverse-support-01", + "type": "color", + }, + Object { + "name": "inverse-support-02", + "type": "color", + }, + Object { + "name": "inverse-support-03", + "type": "color", + }, + Object { + "name": "inverse-support-04", + "type": "color", + }, + Object { + "name": "overlay-01", + "type": "color", + }, + Object { + "name": "danger-01", + "type": "color", + }, + Object { + "name": "danger-02", + "type": "color", + }, + Object { + "name": "focus", + "type": "color", + }, + Object { + "name": "inverse-focus-ui", + "type": "color", + }, + Object { + "name": "hover-primary", + "type": "color", + }, + Object { + "name": "active-primary", + "type": "color", + }, + Object { + "name": "hover-primary-text", + "type": "color", + }, + Object { + "name": "hover-secondary", + "type": "color", + }, + Object { + "name": "active-secondary", + "type": "color", + }, + Object { + "name": "hover-tertiary", + "type": "color", + }, + Object { + "name": "active-tertiary", + "type": "color", + }, + Object { + "name": "hover-ui", + "type": "color", + }, + Object { + "name": "hover-light-ui", + "type": "color", + }, + Object { + "name": "hover-selected-ui", + "type": "color", + }, + Object { + "name": "active-ui", + "type": "color", + }, + Object { + "name": "active-light-ui", + "type": "color", + }, + Object { + "name": "selected-ui", + "type": "color", + }, + Object { + "name": "selected-light-ui", + "type": "color", + }, + Object { + "name": "inverse-hover-ui", + "type": "color", + }, + Object { + "name": "hover-danger", + "type": "color", + }, + Object { + "name": "active-danger", + "type": "color", + }, + Object { + "name": "hover-row", + "type": "color", + }, + Object { + "name": "visited-link", + "type": "color", + }, + Object { + "name": "disabled-01", + "type": "color", + }, + Object { + "name": "disabled-02", + "type": "color", + }, + Object { + "name": "disabled-03", + "type": "color", + }, + Object { + "name": "highlight", + "type": "color", + }, + Object { + "name": "decorative-01", + "type": "color", + }, + Object { + "name": "button-separator", + "type": "color", + }, + Object { + "name": "skeleton-01", + "type": "color", + }, + Object { + "name": "skeleton-02", + "type": "color", + }, + Object { + "name": "brand-01", + "type": "color", + }, + Object { + "name": "brand-02", + "type": "color", + }, + Object { + "name": "brand-03", + "type": "color", + }, + Object { + "name": "active-01", + "type": "color", + }, + Object { + "name": "hover-field", + "type": "color", + }, + Object { + "name": "danger", + "type": "color", + }, + Object { + "name": "caption-01", + "type": "type", + }, + Object { + "name": "caption-02", + "type": "type", + }, + Object { + "name": "label-01", + "type": "type", + }, + Object { + "name": "label-02", + "type": "type", + }, + Object { + "name": "helper-text-01", + "type": "type", + }, + Object { + "name": "helper-text-02", + "type": "type", + }, + Object { + "name": "body-short-01", + "type": "type", + }, + Object { + "name": "body-long-01", + "type": "type", + }, + Object { + "name": "body-short-02", + "type": "type", + }, + Object { + "name": "body-long-02", + "type": "type", + }, + Object { + "name": "code-01", + "type": "type", + }, + Object { + "name": "code-02", + "type": "type", + }, + Object { + "name": "heading-01", + "type": "type", + }, + Object { + "name": "productive-heading-01", + "type": "type", + }, + Object { + "name": "heading-02", + "type": "type", + }, + Object { + "name": "productive-Heading-02", + "type": "type", + }, + Object { + "name": "productive-heading-03", + "type": "type", + }, + Object { + "name": "productive-heading-04", + "type": "type", + }, + Object { + "name": "productive-heading-05", + "type": "type", + }, + Object { + "name": "productive-heading-06", + "type": "type", + }, + Object { + "name": "productive-heading-07", + "type": "type", + }, + Object { + "name": "expressive-heading-01", + "type": "type", + }, + Object { + "name": "expressive-heading-02", + "type": "type", + }, + Object { + "name": "expressive-heading-03", + "type": "type", + }, + Object { + "name": "expressive-heading-04", + "type": "type", + }, + Object { + "name": "expressive-heading-05", + "type": "type", + }, + Object { + "name": "expressive-heading-06", + "type": "type", + }, + Object { + "name": "expressive-paragraph-01", + "type": "type", + }, + Object { + "name": "quotation-01", + "type": "type", + }, + Object { + "name": "quotation-02", + "type": "type", + }, + Object { + "name": "display-01", + "type": "type", + }, + Object { + "name": "display-02", + "type": "type", + }, + Object { + "name": "display-03", + "type": "type", + }, + Object { + "name": "display-04", + "type": "type", + }, + Object { + "name": "spacing-01", + "type": "layout", + }, + Object { + "name": "spacing-02", + "type": "layout", + }, + Object { + "name": "spacing-03", + "type": "layout", + }, + Object { + "name": "spacing-04", + "type": "layout", + }, + Object { + "name": "spacing-05", + "type": "layout", + }, + Object { + "name": "spacing-06", + "type": "layout", + }, + Object { + "name": "spacing-07", + "type": "layout", + }, + Object { + "name": "spacing-08", + "type": "layout", + }, + Object { + "name": "spacing-09", + "type": "layout", + }, + Object { + "name": "spacing-10", + "type": "layout", + }, + Object { + "name": "spacing-11", + "type": "layout", + }, + Object { + "name": "spacing-12", + "type": "layout", + }, + Object { + "name": "spacing-13", + "type": "layout", + }, + Object { + "name": "layout-01", + "type": "layout", + }, + Object { + "name": "layout-02", + "type": "layout", + }, + Object { + "name": "layout-03", + "type": "layout", + }, + Object { + "name": "layout-04", + "type": "layout", + }, + Object { + "name": "layout-05", + "type": "layout", + }, + Object { + "name": "layout-06", + "type": "layout", + }, + Object { + "name": "layout-07", + "type": "layout", + }, + Object { + "name": "fluid-spacing-01", + "type": "layout", + }, + Object { + "name": "fluid-spacing-02", + "type": "layout", + }, + Object { + "name": "fluid-spacing-03", + "type": "layout", + }, + Object { + "name": "fluid-spacing-04", + "type": "layout", + }, + Object { + "name": "container-01", + "type": "layout", + }, + Object { + "name": "container-02", + "type": "layout", + }, + Object { + "name": "container-03", + "type": "layout", + }, + Object { + "name": "container-04", + "type": "layout", + }, + Object { + "name": "container-05", + "type": "layout", + }, + Object { + "name": "icon-size-01", + "type": "layout", + }, + Object { + "name": "icon-size-02", + "type": "layout", + }, + ], + "v11": Array [ + Object { + "name": "background", + "type": "color", + }, + Object { + "name": "background-active", + "type": "color", + }, + Object { + "name": "background-selected", + "type": "color", + }, + Object { + "name": "background-selected-hover", + "type": "color", + }, + Object { + "name": "background-hover", + "type": "color", + }, + Object { + "name": "background-brand", + "type": "color", + }, + Object { + "name": "background-inverse", + "type": "color", + }, + Object { + "name": "background-inverse-hover", + "type": "color", + }, + Object { + "name": "layer-01", + "type": "color", + }, + Object { + "name": "layer-active-01", + "type": "color", + }, + Object { + "name": "layer-hover-01", + "type": "color", + }, + Object { + "name": "layer-selected-01", + "type": "color", + }, + Object { + "name": "layer-selected-hover-01", + "type": "color", + }, + Object { + "name": "layer-02", + "type": "color", + }, + Object { + "name": "layer-active-02", + "type": "color", + }, + Object { + "name": "layer-hover-02", + "type": "color", + }, + Object { + "name": "layer-selected-02", + "type": "color", + }, + Object { + "name": "layer-selected-hover-02", + "type": "color", + }, + Object { + "name": "layer-03", + "type": "color", + }, + Object { + "name": "layer-active-03", + "type": "color", + }, + Object { + "name": "layer-hover-03", + "type": "color", + }, + Object { + "name": "layer-selected-03", + "type": "color", + }, + Object { + "name": "layer-selected-hover-03", + "type": "color", + }, + Object { + "name": "layer-selected-inverse", + "type": "color", + }, + Object { + "name": "layer-selected-disabled", + "type": "color", + }, + Object { + "name": "layer-accent-01", + "type": "color", + }, + Object { + "name": "layer-accent-active-01", + "type": "color", + }, + Object { + "name": "layer-accent-hover-01", + "type": "color", + }, + Object { + "name": "layer-accent-02", + "type": "color", + }, + Object { + "name": "layer-accent-active-02", + "type": "color", + }, + Object { + "name": "layer-accent-hover-02", + "type": "color", + }, + Object { + "name": "layer-accent-03", + "type": "color", + }, + Object { + "name": "layer-accent-active-03", + "type": "color", + }, + Object { + "name": "layer-accent-hover-03", + "type": "color", + }, + Object { + "name": "field-01", + "type": "color", + }, + Object { + "name": "field-hover-01", + "type": "color", + }, + Object { + "name": "field-02", + "type": "color", + }, + Object { + "name": "field-hover-02", + "type": "color", + }, + Object { + "name": "field-03", + "type": "color", + }, + Object { + "name": "field-hover-03", + "type": "color", + }, + Object { + "name": "interactive", + "type": "color", + }, + Object { + "name": "border-subtle-00", + "type": "color", + }, + Object { + "name": "border-subtle-01", + "type": "color", + }, + Object { + "name": "border-subtle-selected-01", + "type": "color", + }, + Object { + "name": "border-subtle-02", + "type": "color", + }, + Object { + "name": "border-subtle-selected-02", + "type": "color", + }, + Object { + "name": "border-subtle-03", + "type": "color", + }, + Object { + "name": "border-subtle-selected-03", + "type": "color", + }, + Object { + "name": "border-strong-01", + "type": "color", + }, + Object { + "name": "border-strong-02", + "type": "color", + }, + Object { + "name": "border-strong-03", + "type": "color", + }, + Object { + "name": "border-inverse", + "type": "color", + }, + Object { + "name": "border-interactive", + "type": "color", + }, + Object { + "name": "border-disabled", + "type": "color", + }, + Object { + "name": "text-primary", + "type": "color", + }, + Object { + "name": "text-secondary", + "type": "color", + }, + Object { + "name": "text-placeholder", + "type": "color", + }, + Object { + "name": "text-helper", + "type": "color", + }, + Object { + "name": "text-error", + "type": "color", + }, + Object { + "name": "text-inverse", + "type": "color", + }, + Object { + "name": "text-on-color", + "type": "color", + }, + Object { + "name": "text-on-color-disabled", + "type": "color", + }, + Object { + "name": "text-disabled", + "type": "color", + }, + Object { + "name": "link-primary", + "type": "color", + }, + Object { + "name": "link-primary-hover", + "type": "color", + }, + Object { + "name": "link-secondary", + "type": "color", + }, + Object { + "name": "link-visited", + "type": "color", + }, + Object { + "name": "link-inverse", + "type": "color", + }, + Object { + "name": "link-inverse-active", + "type": "color", + }, + Object { + "name": "link-inverse-hover", + "type": "color", + }, + Object { + "name": "icon-primary", + "type": "color", + }, + Object { + "name": "icon-secondary", + "type": "color", + }, + Object { + "name": "icon-inverse", + "type": "color", + }, + Object { + "name": "icon-on-color", + "type": "color", + }, + Object { + "name": "icon-on-color-disabled", + "type": "color", + }, + Object { + "name": "icon-disabled", + "type": "color", + }, + Object { + "name": "support-error", + "type": "color", + }, + Object { + "name": "support-success", + "type": "color", + }, + Object { + "name": "support-warning", + "type": "color", + }, + Object { + "name": "support-info", + "type": "color", + }, + Object { + "name": "support-error-inverse", + "type": "color", + }, + Object { + "name": "support-success-inverse", + "type": "color", + }, + Object { + "name": "support-warning-inverse", + "type": "color", + }, + Object { + "name": "support-info-inverse", + "type": "color", + }, + Object { + "name": "support-caution-major", + "type": "color", + }, + Object { + "name": "support-caution-minor", + "type": "color", + }, + Object { + "name": "support-caution-undefined", + "type": "color", + }, + Object { + "name": "highlight", + "type": "color", + }, + Object { + "name": "overlay", + "type": "color", + }, + Object { + "name": "toggle-off", + "type": "color", + }, + Object { + "name": "shadow", + "type": "color", + }, + Object { + "name": "focus", + "type": "color", + }, + Object { + "name": "focus-inset", + "type": "color", + }, + Object { + "name": "focus-inverse", + "type": "color", + }, + Object { + "name": "skeleton-background", + "type": "color", + }, + Object { + "name": "skeleton-element", + "type": "color", + }, + Object { + "name": "layer", + "type": "color", + }, + Object { + "name": "layer-active", + "type": "color", + }, + Object { + "name": "layer-hover", + "type": "color", + }, + Object { + "name": "layer-selected", + "type": "color", + }, + Object { + "name": "layer-selected-hover", + "type": "color", + }, + Object { + "name": "layer-accent", + "type": "color", + }, + Object { + "name": "layer-accent-hover", + "type": "color", + }, + Object { + "name": "layer-accent-active", + "type": "color", + }, + Object { + "name": "field", + "type": "color", + }, + Object { + "name": "field-hover", + "type": "color", + }, + Object { + "name": "border-subtle", + "type": "color", + }, + Object { + "name": "border-subtle-selected", + "type": "color", + }, + Object { + "name": "border-strong", + "type": "color", + }, + Object { + "name": "button-separator", + "type": "color", + }, + Object { + "name": "button-primary", + "type": "color", + }, + Object { + "name": "button-secondary", + "type": "color", + }, + Object { + "name": "button-tertiary", + "type": "color", + }, + Object { + "name": "button-danger-primary", + "type": "color", + }, + Object { + "name": "button-danger-secondary", + "type": "color", + }, + Object { + "name": "button-danger-active", + "type": "color", + }, + Object { + "name": "button-primary-active", + "type": "color", + }, + Object { + "name": "button-secondary-active", + "type": "color", + }, + Object { + "name": "button-tertiary-active", + "type": "color", + }, + Object { + "name": "button-danger-hover", + "type": "color", + }, + Object { + "name": "button-primary-hover", + "type": "color", + }, + Object { + "name": "button-secondary-hover", + "type": "color", + }, + Object { + "name": "button-tertiary-hover", + "type": "color", + }, + Object { + "name": "button-disabled", + "type": "color", + }, + Object { + "name": "notification-background-error", + "type": "color", + }, + Object { + "name": "notification-background-success", + "type": "color", + }, + Object { + "name": "notification-background-info", + "type": "color", + }, + Object { + "name": "notification-background-warning", + "type": "color", + }, + Object { + "name": "notification-action-hover", + "type": "color", + }, + Object { + "name": "notification-action-tertiary-inverse", + "type": "color", + }, + Object { + "name": "notification-action-tertiary-inverse-active", + "type": "color", + }, + Object { + "name": "notification-action-tertiary-inverse-hover", + "type": "color", + }, + Object { + "name": "notification-action-tertiary-inverse-text", + "type": "color", + }, + Object { + "name": "notification-action-tertiary-inverse-text-on-color-disabled", + "type": "color", + }, + Object { + "name": "tag-background-red", + "type": "color", + }, + Object { + "name": "tag-color-red", + "type": "color", + }, + Object { + "name": "tag-hover-red", + "type": "color", + }, + Object { + "name": "tag-background-magenta", + "type": "color", + }, + Object { + "name": "tag-color-magenta", + "type": "color", + }, + Object { + "name": "tag-hover-magenta", + "type": "color", + }, + Object { + "name": "tag-background-purple", + "type": "color", + }, + Object { + "name": "tag-color-purple", + "type": "color", + }, + Object { + "name": "tag-hover-purple", + "type": "color", + }, + Object { + "name": "tag-background-blue", + "type": "color", + }, + Object { + "name": "tag-color-blue", + "type": "color", + }, + Object { + "name": "tag-hover-blue", + "type": "color", + }, + Object { + "name": "tag-background-cyan", + "type": "color", + }, + Object { + "name": "tag-color-cyan", + "type": "color", + }, + Object { + "name": "tag-hover-cyan", + "type": "color", + }, + Object { + "name": "tag-background-teal", + "type": "color", + }, + Object { + "name": "tag-color-teal", + "type": "color", + }, + Object { + "name": "tag-hover-teal", + "type": "color", + }, + Object { + "name": "tag-background-green", + "type": "color", + }, + Object { + "name": "tag-color-green", + "type": "color", + }, + Object { + "name": "tag-hover-green", + "type": "color", + }, + Object { + "name": "tag-background-gray", + "type": "color", + }, + Object { + "name": "tag-color-gray", + "type": "color", + }, + Object { + "name": "tag-hover-gray", + "type": "color", + }, + Object { + "name": "tag-background-cool-gray", + "type": "color", + }, + Object { + "name": "tag-color-cool-gray", + "type": "color", + }, + Object { + "name": "tag-hover-cool-gray", + "type": "color", + }, + Object { + "name": "tag-background-warm-gray", + "type": "color", + }, + Object { + "name": "tag-color-warm-gray", + "type": "color", + }, + Object { + "name": "tag-hover-warm-gray", + "type": "color", + }, + Object { + "name": "caption-01", + "type": "type", + }, + Object { + "name": "caption-02", + "type": "type", + }, + Object { + "name": "label-01", + "type": "type", + }, + Object { + "name": "label-02", + "type": "type", + }, + Object { + "name": "helper-text-01", + "type": "type", + }, + Object { + "name": "helper-text-02", + "type": "type", + }, + Object { + "name": "body-short-01", + "type": "type", + }, + Object { + "name": "body-long-01", + "type": "type", + }, + Object { + "name": "body-short-02", + "type": "type", + }, + Object { + "name": "body-long-02", + "type": "type", + }, + Object { + "name": "code-01", + "type": "type", + }, + Object { + "name": "code-02", + "type": "type", + }, + Object { + "name": "heading-01", + "type": "type", + }, + Object { + "name": "productive-heading-01", + "type": "type", + }, + Object { + "name": "heading-02", + "type": "type", + }, + Object { + "name": "productive-Heading-02", + "type": "type", + }, + Object { + "name": "productive-heading-03", + "type": "type", + }, + Object { + "name": "productive-heading-04", + "type": "type", + }, + Object { + "name": "productive-heading-05", + "type": "type", + }, + Object { + "name": "productive-heading-06", + "type": "type", + }, + Object { + "name": "productive-heading-07", + "type": "type", + }, + Object { + "name": "expressive-heading-01", + "type": "type", + }, + Object { + "name": "expressive-heading-02", + "type": "type", + }, + Object { + "name": "expressive-heading-03", + "type": "type", + }, + Object { + "name": "expressive-heading-04", + "type": "type", + }, + Object { + "name": "expressive-heading-05", + "type": "type", + }, + Object { + "name": "expressive-heading-06", + "type": "type", + }, + Object { + "name": "expressive-paragraph-01", + "type": "type", + }, + Object { + "name": "quotation-01", + "type": "type", + }, + Object { + "name": "quotation-02", + "type": "type", + }, + Object { + "name": "display-01", + "type": "type", + }, + Object { + "name": "display-02", + "type": "type", + }, + Object { + "name": "display-03", + "type": "type", + }, + Object { + "name": "display-04", + "type": "type", + }, + Object { + "name": "spacing-01", + "type": "layout", + }, + Object { + "name": "spacing-02", + "type": "layout", + }, + Object { + "name": "spacing-03", + "type": "layout", + }, + Object { + "name": "spacing-04", + "type": "layout", + }, + Object { + "name": "spacing-05", + "type": "layout", + }, + Object { + "name": "spacing-06", + "type": "layout", + }, + Object { + "name": "spacing-07", + "type": "layout", + }, + Object { + "name": "spacing-08", + "type": "layout", + }, + Object { + "name": "spacing-09", + "type": "layout", + }, + Object { + "name": "spacing-10", + "type": "layout", + }, + Object { + "name": "spacing-11", + "type": "layout", + }, + Object { + "name": "spacing-12", + "type": "layout", + }, + Object { + "name": "spacing-13", + "type": "layout", + }, + Object { + "name": "fluid-spacing-01", + "type": "layout", + }, + Object { + "name": "fluid-spacing-02", + "type": "layout", + }, + Object { + "name": "fluid-spacing-03", + "type": "layout", + }, + Object { + "name": "fluid-spacing-04", + "type": "layout", + }, + Object { + "name": "container-01", + "type": "layout", + }, + Object { + "name": "container-02", + "type": "layout", + }, + Object { + "name": "container-03", + "type": "layout", + }, + Object { + "name": "container-04", + "type": "layout", + }, + Object { + "name": "container-05", + "type": "layout", + }, + Object { + "name": "icon-size-01", + "type": "layout", + }, + Object { + "name": "icon-size-02", + "type": "layout", + }, + ], + } + `); +}); diff --git a/packages/themes/src/tokens/components.js b/packages/themes/src/tokens/components.js new file mode 100644 index 000000000000..723883901910 --- /dev/null +++ b/packages/themes/src/tokens/components.js @@ -0,0 +1,84 @@ +/** + * 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. + */ + +import { TokenGroup } from './TokenGroup'; + +export const button = TokenGroup.create({ + name: 'Button', + properties: [], + tokens: [ + 'button-separator', + 'button-primary', + 'button-secondary', + 'button-tertiary', + 'button-danger-primary', + 'button-danger-secondary', + 'button-danger-active', + 'button-primary-active', + 'button-secondary-active', + 'button-tertiary-active', + 'button-danger-hover', + 'button-primary-hover', + 'button-secondary-hover', + 'button-tertiary-hover', + 'button-disabled', + ], +}); + +export const notification = TokenGroup.create({ + name: 'Notification', + properties: [], + tokens: [ + 'notification-background-error', + 'notification-background-success', + 'notification-background-info', + 'notification-background-warning', + 'notification-action-hover', + 'notification-action-tertiary-inverse', + 'notification-action-tertiary-inverse-active', + 'notification-action-tertiary-inverse-hover', + 'notification-action-tertiary-inverse-text', + 'notification-action-tertiary-inverse-text-on-color-disabled', + ], +}); + +export const tag = TokenGroup.create({ + name: 'Tag', + properties: [], + tokens: [ + 'tag-background-red', + 'tag-color-red', + 'tag-hover-red', + 'tag-background-magenta', + 'tag-color-magenta', + 'tag-hover-magenta', + 'tag-background-purple', + 'tag-color-purple', + 'tag-hover-purple', + 'tag-background-blue', + 'tag-color-blue', + 'tag-hover-blue', + 'tag-background-cyan', + 'tag-color-cyan', + 'tag-hover-cyan', + 'tag-background-teal', + 'tag-color-teal', + 'tag-hover-teal', + 'tag-background-green', + 'tag-color-green', + 'tag-hover-green', + 'tag-background-gray', + 'tag-color-gray', + 'tag-hover-gray', + 'tag-background-cool-gray', + 'tag-color-cool-gray', + 'tag-hover-cool-gray', + 'tag-background-warm-gray', + 'tag-color-warm-gray', + 'tag-hover-warm-gray', + ], +}); diff --git a/packages/themes/src/tokens/index.js b/packages/themes/src/tokens/index.js index 3b1f71cec843..fafc2650f9e9 100644 --- a/packages/themes/src/tokens/index.js +++ b/packages/themes/src/tokens/index.js @@ -9,7 +9,60 @@ import { Token } from './Token'; import { TokenFormat } from './TokenFormat'; import { TokenGroup } from './TokenGroup'; import { TokenSet } from './TokenSet'; -import { group } from './v11TokenGroup'; +import { group, contextual } from './v11TokenGroup'; import { set } from './v11TokenSet'; +import * as components from './components'; +import { type } from './type'; +import { layout } from './layout'; +import { v10 } from './v10'; export { Token, TokenFormat, TokenGroup, TokenSet, group, set }; + +const v11 = [ + // Base color tokens + ...group.getTokens().map((token) => { + return { + name: token.name, + type: 'color', + }; + }), + + // Contextual tokens + ...contextual.getTokens().map((token) => { + return { + name: token.name, + type: 'color', + }; + }), + + // Component tokens + ...Object.values(components).flatMap((group) => { + return group.getTokens().map((token) => { + return { + name: token.name, + type: 'color', + }; + }); + }), + + // Typography + ...type.getTokens().map((token) => { + return { + name: token.name, + type: 'type', + }; + }), + + // Layout (spacing) + ...layout.getTokens().map((token) => { + return { + name: token.name, + type: 'layout', + }; + }), +]; + +export const unstable_metadata = { + v11, + v10, +}; diff --git a/packages/themes/src/tokens/layout.js b/packages/themes/src/tokens/layout.js new file mode 100644 index 000000000000..84f0b5779dca --- /dev/null +++ b/packages/themes/src/tokens/layout.js @@ -0,0 +1,39 @@ +/** + * 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. + */ + +import { TokenGroup } from './TokenGroup'; + +export const layout = TokenGroup.create({ + name: 'Layout', + properties: [], + tokens: [ + 'spacing-01', + 'spacing-02', + 'spacing-03', + 'spacing-04', + 'spacing-05', + 'spacing-06', + 'spacing-07', + 'spacing-08', + 'spacing-09', + 'spacing-10', + 'spacing-11', + 'spacing-12', + 'spacing-13', + 'fluid-spacing-01', + 'fluid-spacing-02', + 'fluid-spacing-03', + 'fluid-spacing-04', + 'container-01', + 'container-02', + 'container-03', + 'container-04', + 'container-05', + 'icon-size-01', + 'icon-size-02', + ], +}); diff --git a/packages/themes/src/tokens/type.js b/packages/themes/src/tokens/type.js new file mode 100644 index 000000000000..b6c3d305cbf5 --- /dev/null +++ b/packages/themes/src/tokens/type.js @@ -0,0 +1,49 @@ +/** + * 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. + */ + +import { TokenGroup } from './TokenGroup'; + +export const type = TokenGroup.create({ + name: 'Type', + properties: [], + tokens: [ + 'caption-01', + 'caption-02', + 'label-01', + 'label-02', + 'helper-text-01', + 'helper-text-02', + 'body-short-01', + 'body-long-01', + 'body-short-02', + 'body-long-02', + 'code-01', + 'code-02', + 'heading-01', + 'productive-heading-01', + 'heading-02', + 'productive-Heading-02', + 'productive-heading-03', + 'productive-heading-04', + 'productive-heading-05', + 'productive-heading-06', + 'productive-heading-07', + 'expressive-heading-01', + 'expressive-heading-02', + 'expressive-heading-03', + 'expressive-heading-04', + 'expressive-heading-05', + 'expressive-heading-06', + 'expressive-paragraph-01', + 'quotation-01', + 'quotation-02', + 'display-01', + 'display-02', + 'display-03', + 'display-04', + ], +}); diff --git a/packages/themes/src/tokens/v10.js b/packages/themes/src/tokens/v10.js new file mode 100644 index 000000000000..f1d0e067e067 --- /dev/null +++ b/packages/themes/src/tokens/v10.js @@ -0,0 +1,188 @@ +/** + * 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. + */ + +import { TokenGroup } from './TokenGroup'; + +const color = TokenGroup.create({ + name: 'Color', + properties: [], + tokens: [ + 'interactive-01', + 'interactive-02', + 'interactive-03', + 'interactive-04', + 'ui-background', + 'ui-01', + 'ui-02', + 'ui-03', + 'ui-04', + 'ui-05', + 'text-01', + 'text-02', + 'text-03', + 'text-04', + 'text-05', + 'text-error', + 'icon-01', + 'icon-02', + 'icon-03', + 'link-01', + 'link-02', + 'inverse-link', + 'field-01', + 'field-02', + 'inverse-01', + 'inverse-02', + 'support-01', + 'support-02', + 'support-03', + 'support-04', + 'inverse-support-01', + 'inverse-support-02', + 'inverse-support-03', + 'inverse-support-04', + 'overlay-01', + 'danger-01', + 'danger-02', + 'focus', + 'inverse-focus-ui', + 'hover-primary', + 'active-primary', + 'hover-primary-text', + 'hover-secondary', + 'active-secondary', + 'hover-tertiary', + 'active-tertiary', + 'hover-ui', + 'hover-light-ui', + 'hover-selected-ui', + 'active-ui', + 'active-light-ui', + 'selected-ui', + 'selected-light-ui', + 'inverse-hover-ui', + 'hover-danger', + 'active-danger', + 'hover-row', + 'visited-link', + 'disabled-01', + 'disabled-02', + 'disabled-03', + 'highlight', + 'decorative-01', + 'button-separator', + 'skeleton-01', + 'skeleton-02', + // deprecated + 'brand-01', + 'brand-02', + 'brand-03', + 'active-01', + 'hover-field', + 'danger', + ], +}); + +const type = TokenGroup.create({ + name: 'Type', + properties: [], + tokens: [ + 'caption-01', + 'caption-02', + 'label-01', + 'label-02', + 'helper-text-01', + 'helper-text-02', + 'body-short-01', + 'body-long-01', + 'body-short-02', + 'body-long-02', + 'code-01', + 'code-02', + 'heading-01', + 'productive-heading-01', + 'heading-02', + 'productive-Heading-02', + 'productive-heading-03', + 'productive-heading-04', + 'productive-heading-05', + 'productive-heading-06', + 'productive-heading-07', + 'expressive-heading-01', + 'expressive-heading-02', + 'expressive-heading-03', + 'expressive-heading-04', + 'expressive-heading-05', + 'expressive-heading-06', + 'expressive-paragraph-01', + 'quotation-01', + 'quotation-02', + 'display-01', + 'display-02', + 'display-03', + 'display-04', + ], +}); + +const layout = TokenGroup.create({ + name: 'Layout', + properties: [], + tokens: [ + 'spacing-01', + 'spacing-02', + 'spacing-03', + 'spacing-04', + 'spacing-05', + 'spacing-06', + 'spacing-07', + 'spacing-08', + 'spacing-09', + 'spacing-10', + 'spacing-11', + 'spacing-12', + 'spacing-13', + 'layout-01', + 'layout-02', + 'layout-03', + 'layout-04', + 'layout-05', + 'layout-06', + 'layout-07', + 'fluid-spacing-01', + 'fluid-spacing-02', + 'fluid-spacing-03', + 'fluid-spacing-04', + 'container-01', + 'container-02', + 'container-03', + 'container-04', + 'container-05', + 'icon-size-01', + 'icon-size-02', + ], +}); + +export const v10 = [ + ...color.getTokens().map((token) => { + return { + name: token.name, + type: 'color', + }; + }), + ...type.getTokens().map((token) => { + return { + name: token.name, + type: 'type', + }; + }), + ...layout.getTokens().map((token) => { + return { + name: token.name, + type: 'layout', + }; + }), +]; diff --git a/packages/themes/src/tokens/v11TokenGroup.js b/packages/themes/src/tokens/v11TokenGroup.js index 3c881da57207..a53a3434482e 100644 --- a/packages/themes/src/tokens/v11TokenGroup.js +++ b/packages/themes/src/tokens/v11TokenGroup.js @@ -314,6 +314,26 @@ export const skeleton = TokenGroup.create({ tokens: ['skeleton-background', 'skeleton-element'], }); +export const contextual = TokenGroup.create({ + name: 'Contextual', + properties: [], + tokens: [ + 'layer', + 'layer-active', + 'layer-hover', + 'layer-selected', + 'layer-selected-hover', + 'layer-accent', + 'layer-accent-hover', + 'layer-accent-active', + 'field', + 'field-hover', + 'border-subtle', + 'border-subtle-selected', + 'border-strong', + ], +}); + export const group = TokenGroup.create({ name: 'All', tokens: [ diff --git a/packages/type/package.json b/packages/type/package.json index 898ac83c687d..b8f61d11b34d 100644 --- a/packages/type/package.json +++ b/packages/type/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/type", "description": "Typography for digital and software products using the Carbon Design System", - "version": "11.5.0-rc.0", + "version": "11.5.0", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.js", @@ -37,7 +37,7 @@ "clean": "rimraf css es lib umd" }, "dependencies": { - "@carbon/grid": "^11.4.0-rc.0" + "@carbon/grid": "^11.4.0" }, "devDependencies": { "@carbon/cli": "^11.2.0", diff --git a/www/package.json b/www/package.json index ebb9c2992bf8..f242c6ce1fb0 100644 --- a/www/package.json +++ b/www/package.json @@ -1,7 +1,7 @@ { "name": "www", "private": true, - "version": "0.17.0-rc.0", + "version": "0.17.0", "license": "Apache-2.0", "repository": { "type": "git", @@ -22,7 +22,7 @@ "start": "next start" }, "dependencies": { - "@carbon/react": "^1.8.0-rc.0", + "@carbon/react": "^1.8.0", "@octokit/core": "^3.5.1", "@octokit/plugin-retry": "^3.0.9", "@octokit/plugin-throttling": "^3.5.2", diff --git a/yarn.lock b/yarn.lock index 099d25a6c8cb..3aa48d7a551d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1938,12 +1938,12 @@ __metadata: dependencies: "@carbon/cli": ^11.2.0 "@carbon/colors": ^11.3.0 - "@carbon/grid": ^11.4.0-rc.0 - "@carbon/icons": ^11.6.0-rc.0 - "@carbon/layout": ^11.4.0-rc.0 + "@carbon/grid": ^11.4.0 + "@carbon/icons": ^11.6.0 + "@carbon/layout": ^11.4.0 "@carbon/motion": ^11.2.0 - "@carbon/themes": ^11.5.0-rc.0 - "@carbon/type": ^11.5.0-rc.0 + "@carbon/themes": ^11.5.0 + "@carbon/type": ^11.5.0 fs-extra: ^10.0.0 klaw-sync: ^6.0.0 replace-in-file: ^3.4.2 @@ -1972,12 +1972,12 @@ __metadata: languageName: unknown linkType: soft -"@carbon/grid@^11.4.0-rc.0, @carbon/grid@workspace:packages/grid": +"@carbon/grid@^11.4.0, @carbon/grid@workspace:packages/grid": version: 0.0.0-use.local resolution: "@carbon/grid@workspace:packages/grid" dependencies: "@carbon/cli": ^11.2.0 - "@carbon/layout": ^11.4.0-rc.0 + "@carbon/layout": ^11.4.0 rimraf: ^3.0.0 languageName: unknown linkType: soft @@ -2026,13 +2026,13 @@ __metadata: languageName: unknown linkType: soft -"@carbon/icons-react@^11.6.0-rc.0, @carbon/icons-react@workspace:packages/icons-react": +"@carbon/icons-react@^11.6.0, @carbon/icons-react@workspace:packages/icons-react": version: 0.0.0-use.local resolution: "@carbon/icons-react@workspace:packages/icons-react" dependencies: "@carbon/icon-build-helpers": ^1.2.0 "@carbon/icon-helpers": ^10.31.0 - "@carbon/icons": ^11.6.0-rc.0 + "@carbon/icons": ^11.6.0 "@carbon/telemetry": 0.1.0 prop-types: ^15.7.2 rimraf: ^3.0.2 @@ -2047,7 +2047,7 @@ __metadata: dependencies: "@carbon/cli-reporter": ^10.5.0 "@carbon/icon-helpers": ^10.31.0 - "@carbon/icons": ^11.6.0-rc.0 + "@carbon/icons": ^11.6.0 fs-extra: ^10.0.0 prettier: ^2.6.2 rimraf: ^3.0.0 @@ -2056,7 +2056,7 @@ __metadata: languageName: unknown linkType: soft -"@carbon/icons@^11.6.0-rc.0, @carbon/icons@workspace:packages/icons": +"@carbon/icons@^11.6.0, @carbon/icons@workspace:packages/icons": version: 0.0.0-use.local resolution: "@carbon/icons@workspace:packages/icons" dependencies: @@ -2066,7 +2066,7 @@ __metadata: languageName: unknown linkType: soft -"@carbon/layout@^11.4.0-rc.0, @carbon/layout@workspace:packages/layout": +"@carbon/layout@^11.4.0, @carbon/layout@workspace:packages/layout": version: 0.0.0-use.local resolution: "@carbon/layout@workspace:packages/layout" dependencies: @@ -2111,7 +2111,7 @@ __metadata: languageName: unknown linkType: soft -"@carbon/react@^1.8.0-rc.0, @carbon/react@workspace:packages/react": +"@carbon/react@^1.8.0, @carbon/react@workspace:packages/react": version: 0.0.0-use.local resolution: "@carbon/react@workspace:packages/react" dependencies: @@ -2124,12 +2124,12 @@ __metadata: "@babel/preset-react": ^7.17.12 "@babel/runtime": ^7.18.3 "@carbon/feature-flags": ^0.8.0 - "@carbon/icons-react": ^11.6.0-rc.0 - "@carbon/layout": ^11.4.0-rc.0 - "@carbon/styles": ^1.8.0-rc.0 + "@carbon/icons-react": ^11.6.0 + "@carbon/layout": ^11.4.0 + "@carbon/styles": ^1.8.0 "@carbon/telemetry": 0.1.0 "@carbon/test-utils": ^10.25.0 - "@carbon/themes": ^11.5.0-rc.0 + "@carbon/themes": ^11.5.0 "@rollup/plugin-babel": ^5.3.0 "@rollup/plugin-commonjs": ^21.0.0 "@rollup/plugin-node-resolve": ^13.0.0 @@ -2208,9 +2208,9 @@ __metadata: dependencies: "@carbon/colors": ^11.3.0 "@carbon/icon-helpers": ^10.31.0 - "@carbon/icons": ^11.6.0-rc.0 - "@carbon/themes": ^11.5.0-rc.0 - "@carbon/type": ^11.5.0-rc.0 + "@carbon/icons": ^11.6.0 + "@carbon/themes": ^11.5.0 + "@carbon/type": ^11.5.0 "@skpm/builder": ^0.8.0 color-string: ^1.5.3 core-js: ^3.16.0 @@ -2221,18 +2221,18 @@ __metadata: languageName: unknown linkType: soft -"@carbon/styles@^1.8.0-rc.0, @carbon/styles@workspace:packages/styles": +"@carbon/styles@^1.8.0, @carbon/styles@workspace:packages/styles": version: 0.0.0-use.local resolution: "@carbon/styles@workspace:packages/styles" dependencies: "@carbon/colors": ^11.3.0 "@carbon/feature-flags": ^0.8.0 - "@carbon/grid": ^11.4.0-rc.0 - "@carbon/layout": ^11.4.0-rc.0 + "@carbon/grid": ^11.4.0 + "@carbon/layout": ^11.4.0 "@carbon/motion": ^11.2.0 "@carbon/test-utils": ^10.25.0 - "@carbon/themes": ^11.5.0-rc.0 - "@carbon/type": ^11.5.0-rc.0 + "@carbon/themes": ^11.5.0 + "@carbon/type": ^11.5.0 "@ibm/plex": 6.0.0-next.6 autoprefixer: ^10.4.7 browserslist-config-carbon: ^11.0.0 @@ -2272,7 +2272,7 @@ __metadata: languageName: unknown linkType: soft -"@carbon/themes@^11.5.0-rc.0, @carbon/themes@workspace:packages/themes": +"@carbon/themes@^11.5.0, @carbon/themes@workspace:packages/themes": version: 0.0.0-use.local resolution: "@carbon/themes@workspace:packages/themes" dependencies: @@ -2281,10 +2281,10 @@ __metadata: "@carbon/cli": ^11.2.0 "@carbon/cli-reporter": ^10.5.0 "@carbon/colors": ^11.3.0 - "@carbon/layout": ^11.4.0-rc.0 + "@carbon/layout": ^11.4.0 "@carbon/scss-generator": ^10.14.0 "@carbon/test-utils": ^10.25.0 - "@carbon/type": ^11.5.0-rc.0 + "@carbon/type": ^11.5.0 change-case: ^4.1.1 color: ^3.1.2 core-js: ^3.16.0 @@ -2294,12 +2294,12 @@ __metadata: languageName: unknown linkType: soft -"@carbon/type@^11.5.0-rc.0, @carbon/type@workspace:packages/type": +"@carbon/type@^11.5.0, @carbon/type@workspace:packages/type": version: 0.0.0-use.local resolution: "@carbon/type@workspace:packages/type" dependencies: "@carbon/cli": ^11.2.0 - "@carbon/grid": ^11.4.0-rc.0 + "@carbon/grid": ^11.4.0 "@carbon/test-utils": ^10.25.0 change-case: ^4.1.1 css: ^3.0.0 @@ -10568,8 +10568,8 @@ __metadata: "@babel/plugin-transform-react-constant-elements": ^7.17.12 "@babel/preset-env": ^7.18.2 "@babel/preset-react": ^7.17.12 - "@carbon/react": ^1.8.0-rc.0 - "@carbon/styles": ^1.8.0-rc.0 + "@carbon/react": ^1.8.0 + "@carbon/styles": ^1.8.0 "@carbon/telemetry": 0.1.0 "@carbon/test-utils": ^10.25.0 "@rollup/plugin-babel": ^5.3.0 @@ -10595,7 +10595,7 @@ __metadata: version: 0.0.0-use.local resolution: "carbon-components@workspace:packages/carbon-components" dependencies: - "@carbon/styles": ^1.8.0-rc.0 + "@carbon/styles": ^1.8.0 "@carbon/telemetry": 0.1.0 "@carbon/test-utils": ^10.25.0 fs-extra: ^10.0.0 @@ -11284,7 +11284,7 @@ __metadata: version: 0.0.0-use.local resolution: "codesandbox-styles@workspace:examples/codesandbox-styles" dependencies: - "@carbon/styles": ^1.8.0-rc.0 + "@carbon/styles": ^1.8.0 sass: ^1.51.0 vite: ^2.8.0 languageName: unknown @@ -11294,7 +11294,7 @@ __metadata: version: 0.0.0-use.local resolution: "codesandbox-with-sass-compilation@workspace:examples/codesandbox-with-sass-compilation" dependencies: - "@carbon/react": ^1.8.0-rc.0 + "@carbon/react": ^1.8.0 react: ^17.0.0 react-dom: ^17.0.0 react-scripts: 5.0.0 @@ -11306,7 +11306,7 @@ __metadata: version: 0.0.0-use.local resolution: "codesandbox@workspace:examples/codesandbox" dependencies: - "@carbon/react": ^1.8.0-rc.0 + "@carbon/react": ^1.8.0 react: ^17.0.0 react-dom: ^17.0.0 react-scripts: 5.0.0 @@ -15051,7 +15051,7 @@ __metadata: version: 0.0.0-use.local resolution: "examples-light-dark@workspace:examples/light-dark-mode" dependencies: - "@carbon/react": ^1.8.0-rc.0 + "@carbon/react": ^1.8.0 eslint: 8.12.0 next: 12.1.4 react: 18.0.0 @@ -15064,7 +15064,7 @@ __metadata: version: 0.0.0-use.local resolution: "examples-nextjs@workspace:examples/nextjs" dependencies: - "@carbon/react": ^1.8.0-rc.0 + "@carbon/react": ^1.8.0 eslint: 8.12.0 eslint-config-next: 12.1.4 next: 12.1.4 @@ -31524,7 +31524,7 @@ resolve@^2.0.0-next.3: version: 0.0.0-use.local resolution: "vite@workspace:examples/vite" dependencies: - "@carbon/react": ^1.8.0-rc.0 + "@carbon/react": ^1.8.0 "@types/react": ^18.0.0 "@types/react-dom": ^18.0.0 "@vitejs/plugin-react": 1.1.3 @@ -32588,7 +32588,7 @@ resolve@^2.0.0-next.3: version: 0.0.0-use.local resolution: "www@workspace:www" dependencies: - "@carbon/react": ^1.8.0-rc.0 + "@carbon/react": ^1.8.0 "@octokit/core": ^3.5.1 "@octokit/plugin-retry": ^3.0.9 "@octokit/plugin-throttling": ^3.5.2