diff --git a/.storybook/data/tokens.json b/.storybook/data/tokens.json index 77361d550..9a082dfb0 100644 --- a/.storybook/data/tokens.json +++ b/.storybook/data/tokens.json @@ -78,7 +78,7 @@ "eds-l-max-width": "71.25rem", "eds-l-linelength-width": "36rem", "eds-box-shadow-sm": "0px 1px 2px 1px rgba(0, 0, 0, 0.2)", - "eds-box-shadow-md": "0 0.5rem 0.375rem -0.375rem rgba(0, 0, 0, 0.1)", + "eds-box-shadow-md": "0px 0px 0px 1px var(--eds-color-neutral-200), 0px 2px 3px rgba(0, 0, 0, 0.02), 0px 4px 8px rgba(0, 0, 0, 0.08)", "eds-size-1": "0.5rem", "eds-size-2": "1rem", "eds-size-3": "1.5rem", @@ -201,5 +201,5 @@ "eds-theme-color-form-input-border-error": "#BD0044", "eds-theme-form-input-border-width": "1px", "eds-theme-form-input-border-radius": "4px", - "eds-theme-box-shadow": "0 0.5rem 0.375rem -0.375rem rgba(0, 0, 0, 0.1)" + "eds-theme-box-shadow": "0px 0px 0px 1px var(--eds-color-neutral-200), 0px 2px 3px rgba(0, 0, 0, 0.02), 0px 4px 8px rgba(0, 0, 0, 0.08)" } \ No newline at end of file diff --git a/.stylelintrc b/.stylelintrc index 32167bf83..78cb95ad4 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -13,6 +13,12 @@ } ], "custom-property-empty-line-before": "never", - "max-nesting-depth": 1 + "max-nesting-depth": 1, + "selector-pseudo-class-no-unknown": [ + true, + { + "ignorePseudoClasses": ["global"] + } + ] } } diff --git a/docs/CODE_GUIDELINES.md b/docs/CODE_GUIDELINES.md index 7f1a2435d..ab7127e1b 100644 --- a/docs/CODE_GUIDELINES.md +++ b/docs/CODE_GUIDELINES.md @@ -88,7 +88,7 @@ Here's another example: ### CSS Nesting -EDS uses [PostCSS Nested](https://github.com/postcss/postcss-nested) to provide some developer ergononics. As a general principle, nesting should be used sparingly and is only used in the following situations: +EDS uses [PostCSS Nested](https://github.com/postcss/postcss-nested) to provide some developer ergonomics. As a general principle, nesting should be used sparingly and is only used in the following situations: - Media queries - States and pseudo-selectors @@ -127,7 +127,7 @@ EDS uses [PostCSS Nested](https://github.com/postcss/postcss-nested) to provide #### Parent selectors -Use [parent selectors](https://sass-lang.com/documentation/style-rules/parent-selector) to target a selector when it appears inside a specific parent element. Use parent selectors instead of child selectors in order to co-locate all styles around a specific selector, which improves maintability and findability. +Use [parent selectors](https://sass-lang.com/documentation/style-rules/parent-selector) to target a selector when it appears inside a specific parent element. Use parent selectors instead of child selectors in order to co-locate all styles around a specific selector, which improves maintainability and findability. Use the following conventions: @@ -188,7 +188,7 @@ For example: } ``` -Not all CSS declarations warrant a comment, but non-obvious declarations (like context-specific styles, magic numbers, or styles dependant on other selector styles) should be accompanied by a comment. +Not all CSS declarations warrant a comment, but non-obvious declarations (like context-specific styles, magic numbers, or styles dependent on other selector styles) should be accompanied by a comment. ### Other CSS Rules @@ -261,7 +261,7 @@ Please refer to the [design tokens documentation](./TOKENS.md) to learn how to u - **Presentational Components Only** - EDS provides a library of reusable [presentational UI components](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0) that are consumed by CZI applications. These presentational components are "dumb" and don't contain any application business logic and aren't hooked up to any data models. - **Predictable APIs** - EDS provides consistent, clear [component APIs](#component-naming) in order to provide a consistent and intuitive user developer experience. -- **Composition over inheritence** EDS adheres to the [composition over inheritence](https://en.wikipedia.org/wiki/Composition_over_inheritance) principle in order to create clean, extensible components that aren't tied to specific contexts or content. +- **Composition over inheritance** EDS adheres to the [composition over inheritance](https://en.wikipedia.org/wiki/Composition_over_inheritance) principle in order to create clean, extensible components that aren't tied to specific contexts or content. ## JavaScript Tools @@ -320,7 +320,7 @@ export interface Props { } ``` -All component props must be defined with appropriate [TypeScript type](https://www.typescriptlang.org/docs/handbook/basic-types.html) applied. Each prop must contain a comment above the prop declaration to document the prop's function. These comments and prop declarations are automatically converted into prop documentation in Storybook. As a general guideline, try to organize component prop definitiones alphabetically. +All component props must be defined with appropriate [TypeScript type](https://www.typescriptlang.org/docs/handbook/basic-types.html) applied. Each prop must contain a comment above the prop declaration to document the prop's function. These comments and prop declarations are automatically converted into prop documentation in Storybook. As a general guideline, try to organize component prop definitions alphabetically. ### Export module @@ -333,7 +333,7 @@ export const ComponentName: React.FC = ({ }) => { ``` -This defines the component name and passses in all the `Props`. +This defines the component name and passes in all the `Props`. ### Variables, Methods, and Hooks (if applicable) @@ -371,7 +371,7 @@ Components in this library exist in a flat structure so each component directory Certain components (such as `` and ``) require splitting up into smaller subcomponents. -By default, we err towards more centralized control over the component architecture in order to prevent undesired results (for instance, we don't want users to put a `` inside of ``). However, certain components will require more flexibility and will therefore be architected to be composible and flexible (such as ``). +By default, we err towards more centralized control over the component architecture in order to prevent undesired results (for instance, we don't want users to put a `` inside of ``). However, certain components will require more flexibility and will therefore be architected to be composable and flexible (such as ``). #### Conventions for compound components @@ -391,17 +391,17 @@ By default, we err towards more centralized control over the component architect EDS follows specific front-end API naming conventions. Authoring a consistent API language provides many benefits: - **More efficient development** - Because the API language is consistent across components, user developers can spend more time coding rather than reading API documentation. Also, library contributors don't have to think as much about component API naming when creating new components/variants. -- **Shared vocuabulary between designers and developers** - When the code library and design library use the same language, designers and developers can spend more time collaborating rather than futzing over what things are named. This improves team velocity and product quality. It also positions the team to benefit from future tooling that can bring design and code closer together (something many startups and plugins are trying to solve right now!) +- **Shared vocabulary between designers and developers** - When the code library and design library use the same language, designers and developers can spend more time collaborating rather than futzing over what things are named. This improves team velocity and product quality. It also positions the team to benefit from future tooling that can bring design and code closer together (something many startups and plugins are trying to solve right now!) - **Future changes** - Utilizing a consistent language means that future changes and improvements are as easy as find-and-replace. -EDS adhreres to the following API naming conventions: +EDS adheres to the following API naming conventions: ### Variants - `variant` should be used for primary _stylistic_ variations of a component, such as (e.g. `` or ` + +
+ + +`; + +exports[` DarkVariant story renders snapshot 1`] = ` + +
+ +
+
+ + +`; + +exports[` Interactive story renders snapshot 1`] = ` + +
+
+

+ Click somewhere in this area to dismiss the tooltip, then hover over the button to make it reappear. +

+ +
+
+
+ + +`; + +exports[` LeftPlacement story renders snapshot 1`] = ` + +
+ +
+
+ + +`; + +exports[` LightVariant story renders snapshot 1`] = ` + +
+ +
+
+ + +`; + +exports[` LongButtonText story renders snapshot 1`] = ` + +
+ +
+
+ + +`; + +exports[` LongText story renders snapshot 1`] = ` + +
+ +
+
+ + +`; + +exports[` TopPlacement story renders snapshot 1`] = ` + +
+ +
+
+ + +`; diff --git a/src/components/Tooltip/index.ts b/src/components/Tooltip/index.ts new file mode 100644 index 000000000..cdc0fab16 --- /dev/null +++ b/src/components/Tooltip/index.ts @@ -0,0 +1 @@ +export { default } from './Tooltip'; diff --git a/src/design-tokens/tier-1-definitions/shadows.json b/src/design-tokens/tier-1-definitions/shadows.json index 4ee585422..bddfa8c2e 100644 --- a/src/design-tokens/tier-1-definitions/shadows.json +++ b/src/design-tokens/tier-1-definitions/shadows.json @@ -5,7 +5,7 @@ "value": "0px 1px 2px 1px rgba(0, 0, 0, 0.2)" }, "md": { - "value": "0 0.5rem 0.375rem -0.375rem rgba(0, 0, 0, 0.1)" + "value": "0px 0px 0px 1px var(--eds-color-neutral-200), 0px 2px 3px rgba(0, 0, 0, 0.02), 0px 4px 8px rgba(0, 0, 0, 0.08)" } } } diff --git a/yarn.lock b/yarn.lock index 4781bb652..f14b8ab1f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1610,9 +1610,12 @@ __metadata: "@storybook/addon-postcss": ^2.0.0 "@storybook/addon-storyshots": ^6.4.19 "@storybook/react": ^6.4.19 + "@storybook/testing-library": ^0.0.9 + "@storybook/testing-react": ^1.2.3 "@testing-library/jest-dom": ^5.16.2 "@testing-library/react": ^12.1.3 "@testing-library/user-event": ^13.5.0 + "@tippyjs/react": 4.2.5 "@types/estree": ^0.0.51 "@types/jest": ^27.4.1 "@types/node": ^17.0.21 @@ -2615,7 +2618,7 @@ __metadata: languageName: node linkType: hard -"@popperjs/core@npm:^2.5.4, @popperjs/core@npm:^2.6.0": +"@popperjs/core@npm:^2.5.4, @popperjs/core@npm:^2.6.0, @popperjs/core@npm:^2.9.0": version: 2.11.2 resolution: "@popperjs/core@npm:2.11.2" checksum: 5695bf020eda54636e16a62dc9b5fdd92beaf7b2d19f62fcef049d57c5cff92773562d80cbf760b217c3ec928da310eb24994ab6a00fd39dffa0af9b5dfc01a6 @@ -3179,6 +3182,28 @@ __metadata: languageName: node linkType: hard +"@storybook/addons@npm:6.5.0-alpha.46": + version: 6.5.0-alpha.46 + resolution: "@storybook/addons@npm:6.5.0-alpha.46" + dependencies: + "@storybook/api": 6.5.0-alpha.46 + "@storybook/channels": 6.5.0-alpha.46 + "@storybook/client-logger": 6.5.0-alpha.46 + "@storybook/core-events": 6.5.0-alpha.46 + "@storybook/csf": 0.0.2--canary.87bc651.0 + "@storybook/router": 6.5.0-alpha.46 + "@storybook/theming": 6.5.0-alpha.46 + "@types/webpack-env": ^1.16.0 + core-js: ^3.8.2 + global: ^4.4.0 + regenerator-runtime: ^0.13.7 + peerDependencies: + react: ^16.8.0 || ^17.0.0 + react-dom: ^16.8.0 || ^17.0.0 + checksum: a9b28e644a2a13706763678e26e3b33d1bbeb02a60d3c57d3674a98e716ad2bcf3d86760b6f629341ce2e26031873d912799a7c44396a6cf0ecbed981c389757 + languageName: node + linkType: hard + "@storybook/api@npm:6.4.19": version: 6.4.19 resolution: "@storybook/api@npm:6.4.19" @@ -3207,6 +3232,34 @@ __metadata: languageName: node linkType: hard +"@storybook/api@npm:6.5.0-alpha.46": + version: 6.5.0-alpha.46 + resolution: "@storybook/api@npm:6.5.0-alpha.46" + dependencies: + "@storybook/channels": 6.5.0-alpha.46 + "@storybook/client-logger": 6.5.0-alpha.46 + "@storybook/core-events": 6.5.0-alpha.46 + "@storybook/csf": 0.0.2--canary.87bc651.0 + "@storybook/router": 6.5.0-alpha.46 + "@storybook/semver": ^7.3.2 + "@storybook/theming": 6.5.0-alpha.46 + core-js: ^3.8.2 + fast-deep-equal: ^3.1.3 + global: ^4.4.0 + lodash: ^4.17.21 + memoizerific: ^1.11.3 + regenerator-runtime: ^0.13.7 + store2: ^2.12.0 + telejson: ^5.3.3 + ts-dedent: ^2.0.0 + util-deprecate: ^1.0.2 + peerDependencies: + react: ^16.8.0 || ^17.0.0 + react-dom: ^16.8.0 || ^17.0.0 + checksum: f43e718c7aa05d81839ee74821231059b7fe304a8255a6b977c87b7fd9d7017ea55b53c79faca55af004449cf7c59621ae9986c4abebc1859b62b9f538f48bc1 + languageName: node + linkType: hard + "@storybook/babel-plugin-require-context-hook@npm:1.0.1": version: 1.0.1 resolution: "@storybook/babel-plugin-require-context-hook@npm:1.0.1" @@ -3336,6 +3389,17 @@ __metadata: languageName: node linkType: hard +"@storybook/channels@npm:6.5.0-alpha.46": + version: 6.5.0-alpha.46 + resolution: "@storybook/channels@npm:6.5.0-alpha.46" + dependencies: + core-js: ^3.8.2 + ts-dedent: ^2.0.0 + util-deprecate: ^1.0.2 + checksum: 62a949a7d78d75ba7e71fb90d93904f357569f9b23310314873e2359a76a785569e1df444bc20d1167e162cccfebad28e87e0867691cd6fc639756261337ccb2 + languageName: node + linkType: hard + "@storybook/client-api@npm:6.4.19": version: 6.4.19 resolution: "@storybook/client-api@npm:6.4.19" @@ -3377,6 +3441,16 @@ __metadata: languageName: node linkType: hard +"@storybook/client-logger@npm:6.5.0-alpha.46, @storybook/client-logger@npm:^6.4.0 || >=6.5.0-0": + version: 6.5.0-alpha.46 + resolution: "@storybook/client-logger@npm:6.5.0-alpha.46" + dependencies: + core-js: ^3.8.2 + global: ^4.4.0 + checksum: a8ec257f183ab4bc436b0f0a4e05a734b67c106fc025cc0c549fe9ba576468501b1de80b14acbb5408c91feae588b2dbd14278e1e2c3df5eaaf2180d456cf01d + languageName: node + linkType: hard + "@storybook/components@npm:6.4.19": version: 6.4.19 resolution: "@storybook/components@npm:6.4.19" @@ -3519,6 +3593,15 @@ __metadata: languageName: node linkType: hard +"@storybook/core-events@npm:6.5.0-alpha.46": + version: 6.5.0-alpha.46 + resolution: "@storybook/core-events@npm:6.5.0-alpha.46" + dependencies: + core-js: ^3.8.2 + checksum: 5377f98af902a766e0b38debcdef33786cf82e66378482c521978d77c64c96cd35dee0a4d8c4f46392293e996c2b4da9c2af9bdb444cee3931b5143d571bb976 + languageName: node + linkType: hard + "@storybook/core-server@npm:6.4.19": version: 6.4.19 resolution: "@storybook/core-server@npm:6.4.19" @@ -3644,6 +3727,19 @@ __metadata: languageName: node linkType: hard +"@storybook/instrumenter@npm:^6.4.0 || >=6.5.0-0": + version: 6.5.0-alpha.46 + resolution: "@storybook/instrumenter@npm:6.5.0-alpha.46" + dependencies: + "@storybook/addons": 6.5.0-alpha.46 + "@storybook/client-logger": 6.5.0-alpha.46 + "@storybook/core-events": 6.5.0-alpha.46 + core-js: ^3.8.2 + global: ^4.4.0 + checksum: f4ff088ca0c46f7d20b82d043ee2b11354c833b868897c335aca3ac8d4ab55351732f37cac7e3f03f78d3fae41e823388082a216d81b2181c7128d0f84d6fa3d + languageName: node + linkType: hard + "@storybook/manager-webpack4@npm:6.4.19": version: 6.4.19 resolution: "@storybook/manager-webpack4@npm:6.4.19" @@ -3828,6 +3924,20 @@ __metadata: languageName: node linkType: hard +"@storybook/router@npm:6.5.0-alpha.46": + version: 6.5.0-alpha.46 + resolution: "@storybook/router@npm:6.5.0-alpha.46" + dependencies: + "@storybook/client-logger": 6.5.0-alpha.46 + core-js: ^3.8.2 + regenerator-runtime: ^0.13.7 + peerDependencies: + react: ^16.8.0 || ^17.0.0 + react-dom: ^16.8.0 || ^17.0.0 + checksum: 722f127715d985dbfce52491b387165cec5a4e01f2762c9dec13a1b6cfabf76c98337004944ec446a8a012bbc63d2d7e0b0a7bf78f88203b4b35556bbeccd73a + languageName: node + linkType: hard + "@storybook/semver@npm:^7.3.2": version: 7.3.2 resolution: "@storybook/semver@npm:7.3.2" @@ -3887,6 +3997,19 @@ __metadata: languageName: node linkType: hard +"@storybook/testing-library@npm:^0.0.9": + version: 0.0.9 + resolution: "@storybook/testing-library@npm:0.0.9" + dependencies: + "@storybook/client-logger": ^6.4.0 || >=6.5.0-0 + "@storybook/instrumenter": ^6.4.0 || >=6.5.0-0 + "@testing-library/dom": ^8.3.0 + "@testing-library/user-event": ^13.2.1 + ts-dedent: ^2.2.0 + checksum: 070a545bb9d97bcf2c4aebc6f698af55b3735d463200d4864650b4aff17334f5ed6ece0cebed5dd370d4015999e8875fe8aa08a01a067a1c827573cea457a9ff + languageName: node + linkType: hard + "@storybook/testing-react@npm:^1.2.3": version: 1.2.3 resolution: "@storybook/testing-react@npm:1.2.3" @@ -3925,6 +4048,20 @@ __metadata: languageName: node linkType: hard +"@storybook/theming@npm:6.5.0-alpha.46": + version: 6.5.0-alpha.46 + resolution: "@storybook/theming@npm:6.5.0-alpha.46" + dependencies: + "@storybook/client-logger": 6.5.0-alpha.46 + core-js: ^3.8.2 + regenerator-runtime: ^0.13.7 + peerDependencies: + react: ^16.8.0 || ^17.0.0 + react-dom: ^16.8.0 || ^17.0.0 + checksum: af85f6c56da98f431464af7bc60a7619d78f02dd7b3192e238322ff76eaed31beebb6f968f101dde9e775ebd2689e9584d2c6c277ff709ae1c92dd041870c268 + languageName: node + linkType: hard + "@storybook/ui@npm:6.4.19": version: 6.4.19 resolution: "@storybook/ui@npm:6.4.19" @@ -3964,7 +4101,7 @@ __metadata: languageName: node linkType: hard -"@testing-library/dom@npm:^8.0.0": +"@testing-library/dom@npm:^8.0.0, @testing-library/dom@npm:^8.3.0": version: 8.11.3 resolution: "@testing-library/dom@npm:8.11.3" dependencies: @@ -4011,7 +4148,7 @@ __metadata: languageName: node linkType: hard -"@testing-library/user-event@npm:^13.5.0": +"@testing-library/user-event@npm:^13.2.1, @testing-library/user-event@npm:^13.5.0": version: 13.5.0 resolution: "@testing-library/user-event@npm:13.5.0" dependencies: @@ -4022,6 +4159,18 @@ __metadata: languageName: node linkType: hard +"@tippyjs/react@npm:4.2.5": + version: 4.2.5 + resolution: "@tippyjs/react@npm:4.2.5" + dependencies: + tippy.js: ^6.3.1 + peerDependencies: + react: ">=16.8" + react-dom: ">=16.8" + checksum: 68a6bb8922597df105f601953f14c593a8179328026dc425db0cd5d8521cdd8ad8c6ec7b6d0707708c8ed25e5ad01c488e95a6b3de0b2f404bd71137e2b8fce9 + languageName: node + linkType: hard + "@tootallnate/once@npm:1": version: 1.1.2 resolution: "@tootallnate/once@npm:1.1.2" @@ -18205,6 +18354,15 @@ __metadata: languageName: node linkType: hard +"tippy.js@npm:^6.3.1": + version: 6.3.7 + resolution: "tippy.js@npm:6.3.7" + dependencies: + "@popperjs/core": ^2.9.0 + checksum: cac955318a65288e8d2dca05059878b003c6e66f92c94f7810f5bc5448eb6646abdf7dacc9bd00020e2611592598d0aae3a28ec9a45349a159603c3fdddce5fb + languageName: node + linkType: hard + "title-case@npm:^3.0.3": version: 3.0.3 resolution: "title-case@npm:3.0.3"