From b64338e78a8d5b1e0159059ecbd37619a8456851 Mon Sep 17 00:00:00 2001 From: Damien Pellier Date: Thu, 3 Aug 2023 17:00:10 +0200 Subject: [PATCH] feat(arch): move && simplify component tooltip --- packages-new/components/package.json | 3 +- .../components/tooltip/.gitignore | 0 .../components/tooltip/.npmignore | 0 .../components/tooltip/CHANGELOG.md | 0 .../components/tooltip/THIRD-PARTY-LICENCES | 0 .../documentation/specifications/spec.md | 134 ++++++++++++++++++ .../specifications-tooltip-contents.mdx | 0 .../specifications-tooltip-events.mdx | 0 .../specifications-tooltip-methods.mdx | 0 .../specifications-tooltip-properties.mdx | 0 .../specifications-tooltip-tests.mdx | 0 .../specifications-tooltip.mdx | 3 +- .../components/tooltip/jest.config.ts | 5 +- .../components/tooltip/package.json | 15 +- .../components/tooltip/react/.gitignore | 0 .../components/tooltip/react/.npmignore | 0 .../components/tooltip/react/CHANGELOG.md | 0 .../components/tooltip/react/package.json | 12 +- .../tooltip/react/tsconfig.cjs.json | 0 .../components/tooltip/react/tsconfig.json | 0 .../osds-tooltip-content.e2e.ts | 29 ++++ .../osds-tooltip-content.scss | 0 .../osds-tooltip-content.spec.ts | 29 ++++ .../osds-tooltip-content.tsx | 21 +++ .../osds-tooltip-content/public-api.ts | 1 + .../styles/osds-tooltip-content.color.scss | 0 .../styles/osds-tooltip-content.mixins.scss | 0 .../styles/osds-tooltip-content.size.scss | 0 .../osds-tooltip-content.typography.scss | 0 .../constants/default-attributes.ts | 10 ++ .../osds-tooltip/constants/tooltip-variant.ts | 11 ++ .../osds-tooltip/core/controller.spec.ts | 42 +++--- .../osds-tooltip/core/controller.ts | 27 ++-- .../osds-tooltip/interfaces/attributes.ts | 10 ++ .../osds-tooltip/interfaces/methods.ts | 15 ++ .../osds-tooltip.e2e.screenshot.ts | 23 ++- .../osds-tooltip/osds-tooltip.e2e.ts | 15 +- .../components/osds-tooltip/osds-tooltip.scss | 0 .../osds-tooltip/osds-tooltip.spec.ts | 53 +++---- .../components/osds-tooltip/osds-tooltip.tsx | 29 ++-- .../src/components/osds-tooltip/public-api.ts | 4 + .../styles/osds-tooltip.color.scss | 0 .../styles/osds-tooltip.mixins.scss | 0 .../styles/osds-tooltip.size.scss | 0 .../styles/osds-tooltip.typography.scss | 0 .../tooltip/src/docs/osds-tooltip/usage.mdx | 2 +- .../components/tooltip/src/global.dev.ts | 2 +- .../components/tooltip/src/global.prod.ts | 0 .../components/tooltip/src/global.test.ts | 0 .../components/tooltip/src/global.ts | 2 +- .../components/tooltip/src/index.html | 0 .../components/tooltip/src/index.ts | 0 .../components/tooltip/stencil.config.ts | 7 +- .../components/tooltip/tsconfig.dev.json | 0 .../components/tooltip/tsconfig.json | 0 .../components/tooltip/tsconfig.prod.json | 0 .../components/tooltip/tsconfig.test.json | 0 .../components/tooltip/typedoc.json | 2 +- .../components/tooltip/vue/.gitignore | 0 .../components/tooltip/vue/.npmignore | 0 .../components/tooltip/vue/CHANGELOG.md | 0 .../components/tooltip/vue/package.json | 8 +- .../components/tooltip/vue/tsconfig.cjs.json | 0 .../components/tooltip/vue/tsconfig.json | 0 .../core/src/components/public-api.ts | 1 - .../core/src/components/tooltip/public-api.ts | 2 - .../ods-tooltip-content-attributes.ts | 7 - .../ods-tooltip-content-controller.ts | 12 -- .../ods-tooltip-content-default-attributes.ts | 7 - .../ods-tooltip-content-events.ts | 5 - .../ods-tooltip-content-methods.ts | 5 - .../tooltip-content/ods-tooltip-content.ts | 16 --- .../tooltip/tooltip-content/public-api.ts | 6 - .../tooltip/tooltip/ods-tooltip-attributes.ts | 7 - .../tooltip/tooltip/ods-tooltip-behavior.ts | 16 --- .../tooltip/ods-tooltip-default-attributes.ts | 8 -- .../tooltip/tooltip/ods-tooltip-events.ts | 5 - .../tooltip/tooltip/ods-tooltip-methods.ts | 13 -- .../tooltip/tooltip/ods-tooltip-variant.ts | 9 -- .../tooltip/tooltip/ods-tooltip.mock.ts | 28 ---- .../components/tooltip/tooltip/ods-tooltip.ts | 17 --- .../components/tooltip/tooltip/public-api.ts | 8 -- .../testing/src/components/public-api.ts | 1 - .../src/components/tooltip/public-api.ts | 2 - .../ods-tooltip-content-base-attributes.ts | 8 -- .../tooltip/tooltip-content/public-api.ts | 1 - .../tooltip/ods-tooltip-base-attributes.ts | 8 -- .../components/tooltip/tooltip/public-api.ts | 1 - .../components/form-field/package.json | 1 + .../components/form-field/src/global.dev.ts | 2 +- .../components/form-field/src/global.test.ts | 2 +- .../components/pagination/package.json | 1 + .../components/pagination/src/global.dev.ts | 2 +- .../components/pagination/src/global.test.ts | 2 +- packages/stencil/components/stencil.config.ts | 2 + .../osds-tooltip-content.e2e.ts | 33 ----- .../osds-tooltip-content.spec.ts | 41 ------ .../osds-tooltip-content.tsx | 29 ---- .../osds-tooltip-content/public-api.ts | 1 - .../src/components/osds-tooltip/public-api.ts | 1 - .../components/tsconfig.components.dev.json | 1 - .../components/tsconfig.components.prod.json | 1 - .../components/tsconfig.components.test.json | 1 - .../tooltip.specifications.stories.mdx | 2 +- .../tooltip.web-component.stories.page.mdx | 5 +- .../tooltip/tooltip.web-components.stories.ts | 21 ++- scripts/testing-report/index.html | 2 +- yarn.lock | 81 ++++++----- 108 files changed, 442 insertions(+), 496 deletions(-) rename {packages/stencil => packages-new}/components/tooltip/.gitignore (100%) rename {packages/stencil => packages-new}/components/tooltip/.npmignore (100%) rename {packages/stencil => packages-new}/components/tooltip/CHANGELOG.md (100%) rename {packages/stencil => packages-new}/components/tooltip/THIRD-PARTY-LICENCES (100%) create mode 100644 packages-new/components/tooltip/documentation/specifications/spec.md rename {packages/specifications/components/tooltip => packages-new/components/tooltip/documentation/specifications}/specifications-tooltip-contents.mdx (100%) rename {packages/specifications/components/tooltip => packages-new/components/tooltip/documentation/specifications}/specifications-tooltip-events.mdx (100%) rename {packages/specifications/components/tooltip => packages-new/components/tooltip/documentation/specifications}/specifications-tooltip-methods.mdx (100%) rename {packages/specifications/components/tooltip => packages-new/components/tooltip/documentation/specifications}/specifications-tooltip-properties.mdx (100%) rename {packages/specifications/components/tooltip => packages-new/components/tooltip/documentation/specifications}/specifications-tooltip-tests.mdx (100%) rename {packages/specifications/components/tooltip => packages-new/components/tooltip/documentation/specifications}/specifications-tooltip.mdx (54%) rename {packages/stencil => packages-new}/components/tooltip/jest.config.ts (68%) rename {packages/stencil => packages-new}/components/tooltip/package.json (83%) rename {packages/stencil => packages-new}/components/tooltip/react/.gitignore (100%) rename {packages/stencil => packages-new}/components/tooltip/react/.npmignore (100%) rename {packages/stencil => packages-new}/components/tooltip/react/CHANGELOG.md (100%) rename {packages/stencil => packages-new}/components/tooltip/react/package.json (70%) rename {packages/stencil => packages-new}/components/tooltip/react/tsconfig.cjs.json (100%) rename {packages/stencil => packages-new}/components/tooltip/react/tsconfig.json (100%) create mode 100644 packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.e2e.ts rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.scss (100%) create mode 100644 packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.spec.ts create mode 100644 packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.tsx create mode 100644 packages-new/components/tooltip/src/components/osds-tooltip-content/public-api.ts rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.color.scss (100%) rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.mixins.scss (100%) rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.size.scss (100%) rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.typography.scss (100%) create mode 100644 packages-new/components/tooltip/src/components/osds-tooltip/constants/default-attributes.ts create mode 100644 packages-new/components/tooltip/src/components/osds-tooltip/constants/tooltip-variant.ts rename packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-controller.spec.ts => packages-new/components/tooltip/src/components/osds-tooltip/core/controller.spec.ts (89%) rename packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-controller.ts => packages-new/components/tooltip/src/components/osds-tooltip/core/controller.ts (68%) create mode 100644 packages-new/components/tooltip/src/components/osds-tooltip/interfaces/attributes.ts create mode 100644 packages-new/components/tooltip/src/components/osds-tooltip/interfaces/methods.ts rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.screenshot.ts (52%) rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.ts (81%) rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip/osds-tooltip.scss (100%) rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip/osds-tooltip.spec.ts (79%) rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip/osds-tooltip.tsx (81%) create mode 100644 packages-new/components/tooltip/src/components/osds-tooltip/public-api.ts rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.color.scss (100%) rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.mixins.scss (100%) rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.size.scss (100%) rename {packages/stencil => packages-new}/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.typography.scss (100%) rename {packages/stencil => packages-new}/components/tooltip/src/docs/osds-tooltip/usage.mdx (62%) rename {packages/stencil => packages-new}/components/tooltip/src/global.dev.ts (90%) rename {packages/stencil => packages-new}/components/tooltip/src/global.prod.ts (100%) rename {packages/stencil => packages-new}/components/tooltip/src/global.test.ts (100%) rename {packages/stencil => packages-new}/components/tooltip/src/global.ts (81%) rename {packages/stencil => packages-new}/components/tooltip/src/index.html (100%) rename {packages/stencil => packages-new}/components/tooltip/src/index.ts (100%) rename {packages/stencil => packages-new}/components/tooltip/stencil.config.ts (63%) rename {packages/stencil => packages-new}/components/tooltip/tsconfig.dev.json (100%) rename {packages/stencil => packages-new}/components/tooltip/tsconfig.json (100%) rename {packages/stencil => packages-new}/components/tooltip/tsconfig.prod.json (100%) rename {packages/stencil => packages-new}/components/tooltip/tsconfig.test.json (100%) rename {packages/stencil => packages-new}/components/tooltip/typedoc.json (73%) rename {packages/stencil => packages-new}/components/tooltip/vue/.gitignore (100%) rename {packages/stencil => packages-new}/components/tooltip/vue/.npmignore (100%) rename {packages/stencil => packages-new}/components/tooltip/vue/CHANGELOG.md (100%) rename {packages/stencil => packages-new}/components/tooltip/vue/package.json (79%) rename {packages/stencil => packages-new}/components/tooltip/vue/tsconfig.cjs.json (100%) rename {packages/stencil => packages-new}/components/tooltip/vue/tsconfig.json (100%) delete mode 100644 packages/libraries/core/src/components/tooltip/public-api.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-attributes.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-controller.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-default-attributes.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-events.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-methods.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip-content/public-api.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-attributes.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-behavior.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-default-attributes.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-events.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-methods.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-variant.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip.mock.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip.ts delete mode 100644 packages/libraries/core/src/components/tooltip/tooltip/public-api.ts delete mode 100644 packages/libraries/testing/src/components/tooltip/public-api.ts delete mode 100644 packages/libraries/testing/src/components/tooltip/tooltip-content/ods-tooltip-content-base-attributes.ts delete mode 100644 packages/libraries/testing/src/components/tooltip/tooltip-content/public-api.ts delete mode 100644 packages/libraries/testing/src/components/tooltip/tooltip/ods-tooltip-base-attributes.ts delete mode 100644 packages/libraries/testing/src/components/tooltip/tooltip/public-api.ts delete mode 100644 packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.e2e.ts delete mode 100644 packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.spec.ts delete mode 100644 packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.tsx delete mode 100644 packages/stencil/components/tooltip/src/components/osds-tooltip-content/public-api.ts delete mode 100644 packages/stencil/components/tooltip/src/components/osds-tooltip/public-api.ts diff --git a/packages-new/components/package.json b/packages-new/components/package.json index 6ab3904ed5..0e891daf22 100644 --- a/packages-new/components/package.json +++ b/packages-new/components/package.json @@ -13,7 +13,8 @@ "@ovhcloud/ods-component-spinner": "^15.0.1", "@ovhcloud/ods-component-text": "^15.0.1", "@ovhcloud/ods-component-textarea": "^15.0.1", - "@ovhcloud/ods-component-tile": "^15.0.1" + "@ovhcloud/ods-component-tile": "^15.0.1", + "@ovhcloud/ods-component-tooltip": "^15.0.1" }, "devDependencies": { "@ovhcloud/ods-dev": "^15.0.1" diff --git a/packages/stencil/components/tooltip/.gitignore b/packages-new/components/tooltip/.gitignore similarity index 100% rename from packages/stencil/components/tooltip/.gitignore rename to packages-new/components/tooltip/.gitignore diff --git a/packages/stencil/components/tooltip/.npmignore b/packages-new/components/tooltip/.npmignore similarity index 100% rename from packages/stencil/components/tooltip/.npmignore rename to packages-new/components/tooltip/.npmignore diff --git a/packages/stencil/components/tooltip/CHANGELOG.md b/packages-new/components/tooltip/CHANGELOG.md similarity index 100% rename from packages/stencil/components/tooltip/CHANGELOG.md rename to packages-new/components/tooltip/CHANGELOG.md diff --git a/packages/stencil/components/tooltip/THIRD-PARTY-LICENCES b/packages-new/components/tooltip/THIRD-PARTY-LICENCES similarity index 100% rename from packages/stencil/components/tooltip/THIRD-PARTY-LICENCES rename to packages-new/components/tooltip/THIRD-PARTY-LICENCES diff --git a/packages-new/components/tooltip/documentation/specifications/spec.md b/packages-new/components/tooltip/documentation/specifications/spec.md new file mode 100644 index 0000000000..062dd5b65c --- /dev/null +++ b/packages-new/components/tooltip/documentation/specifications/spec.md @@ -0,0 +1,134 @@ +* [**Interfaces**](#interfaces) +* [**Types**](#types) +* [**Classes**](#classes) +* [**Type alias**](#type-alias) +* [**Variables**](#variables) + +## Interfaces + +### OdsTooltipAttributes +|name | Type | Required | Default | Description| +|---|---|:---:|---|---| +|**`variant`** | `OdsTooltipVariant` | | | with or without visible tip: see component principles| + +### OdsTooltipBehavior +|name | Type | Required | Default | Description| +|---|---|:---:|---|---| +|**`anchor`** | `HTMLDivElement` | ✴️ | | | +|**`el`** | `HTMLStencilElement` | ✴️ | | | +|**`surface`** | `undefined` \| `OcdkSurface` | ✴️ | | | +|**`checkForClickOutside`** | _void_ | ✴️ | | | +|**`handleMouseEnter`** | _void_ | ✴️ | | | +|**`handleMouseLeave`** | _void_ | ✴️ | | | +|**`handleTriggerBlur`** | _void_ | ✴️ | | | +|**`handleTriggerClick`** | _void_ | ✴️ | | | +|**`handleTriggerFocus`** | _void_ | ✴️ | | | +|**`syncReferences`** | _void_ | ✴️ | | | + +### OdsTooltipMethods +|name | Type | Required | Default | Description| +|---|---|:---:|---|---| +|**`closeSurface`** | _void_ | ✴️ | | Close the surface| +|**`setTabindex`** | _void_ | ✴️ | | set tab index on the component| + +## Types + +### OdsTooltipVariant +| | +|:---:| +| `standard` | +| `tip` | + +## Classes + +### OdsTooltipContentController +_common controller logic for component used by the different implementations._ +_it contains all the glue between framework implementation and the third party service._ + + +### OdsTooltipController +_common controller logic for component used by the different implementations._ +_it contains all the glue between framework implementation and the third party service._ + +#### Methods +> **checkForClickOutside**() => _unknown_ + + +> **closeSurface**() => _unknown_ + + +> **handleMouseEnter**() => _unknown_ + + +> **handleMouseLeave**() => _unknown_ + + +> **handleTriggerBlur**() => _unknown_ + + +> **handleTriggerClick**() => _unknown_ + + +> **handleTriggerFocus**() => _unknown_ + + +> **syncReferences**() => _unknown_ + + +> **validateAttributes**() => _unknown_ + + + +## Type alias + +### OdsTooltip + +interface description of all implementation of `ods-tooltip`. +each implementation must have defined events, methods, attributes +and one controller for the common behavior logic + +> - `OdsComponentGenericMethods` + +> - `OdsComponentGenericEvents` + +### OdsTooltipContent + +interface description of all implementation of `ods-tooltip-content`. +each implementation must have defined events, methods, attributes +and one controller for the common behavior logic + +> - `OdsComponentGenericMethods` + +> - `OdsComponentGenericEvents` + +### OdsTooltipAttributes + +> _Based on `OdsComponentAttributes`_ + +### OdsTooltipContentAttributes + +> _Based on `OdsComponentAttributes`_ + +### OdsTooltipContentEvents + +> _Based on `OdsComponentEvents`_ + +### OdsTooltipContentMethods + +> _Based on `OdsComponentMethods`_ + +### OdsTooltipEvents + +> _Based on `OdsComponentEvents`_ + +### OdsTooltipMethods + +> _Based on `OdsComponentMethods`_ + +## Variables + +### odsTooltipContentDefaultAttributes +`OdsTooltipContentAttributes` + +### odsTooltipDefaultAttributes +`OdsTooltipAttributes` \ No newline at end of file diff --git a/packages/specifications/components/tooltip/specifications-tooltip-contents.mdx b/packages-new/components/tooltip/documentation/specifications/specifications-tooltip-contents.mdx similarity index 100% rename from packages/specifications/components/tooltip/specifications-tooltip-contents.mdx rename to packages-new/components/tooltip/documentation/specifications/specifications-tooltip-contents.mdx diff --git a/packages/specifications/components/tooltip/specifications-tooltip-events.mdx b/packages-new/components/tooltip/documentation/specifications/specifications-tooltip-events.mdx similarity index 100% rename from packages/specifications/components/tooltip/specifications-tooltip-events.mdx rename to packages-new/components/tooltip/documentation/specifications/specifications-tooltip-events.mdx diff --git a/packages/specifications/components/tooltip/specifications-tooltip-methods.mdx b/packages-new/components/tooltip/documentation/specifications/specifications-tooltip-methods.mdx similarity index 100% rename from packages/specifications/components/tooltip/specifications-tooltip-methods.mdx rename to packages-new/components/tooltip/documentation/specifications/specifications-tooltip-methods.mdx diff --git a/packages/specifications/components/tooltip/specifications-tooltip-properties.mdx b/packages-new/components/tooltip/documentation/specifications/specifications-tooltip-properties.mdx similarity index 100% rename from packages/specifications/components/tooltip/specifications-tooltip-properties.mdx rename to packages-new/components/tooltip/documentation/specifications/specifications-tooltip-properties.mdx diff --git a/packages/specifications/components/tooltip/specifications-tooltip-tests.mdx b/packages-new/components/tooltip/documentation/specifications/specifications-tooltip-tests.mdx similarity index 100% rename from packages/specifications/components/tooltip/specifications-tooltip-tests.mdx rename to packages-new/components/tooltip/documentation/specifications/specifications-tooltip-tests.mdx diff --git a/packages/specifications/components/tooltip/specifications-tooltip.mdx b/packages-new/components/tooltip/documentation/specifications/specifications-tooltip.mdx similarity index 54% rename from packages/specifications/components/tooltip/specifications-tooltip.mdx rename to packages-new/components/tooltip/documentation/specifications/specifications-tooltip.mdx index d15c8a711e..84e58ce535 100644 --- a/packages/specifications/components/tooltip/specifications-tooltip.mdx +++ b/packages-new/components/tooltip/documentation/specifications/specifications-tooltip.mdx @@ -1,5 +1,4 @@ import { Description } from '@storybook/addon-docs'; - -import Specs from '@ovhcloud/ods-core/src/components/tooltip/docs/spec.md'; +import Specs from './spec.md'; { Specs } diff --git a/packages/stencil/components/tooltip/jest.config.ts b/packages-new/components/tooltip/jest.config.ts similarity index 68% rename from packages/stencil/components/tooltip/jest.config.ts rename to packages-new/components/tooltip/jest.config.ts index 03c8f901bd..aa2c0e1fc3 100644 --- a/packages/stencil/components/tooltip/jest.config.ts +++ b/packages-new/components/tooltip/jest.config.ts @@ -1,5 +1,5 @@ import type { Config } from '@jest/types'; -import { OdsGetJestConfig } from '@ovhcloud/ods-testing'; +import { OdsGetJestConfig } from '@ovhcloud/ods-common-testing'; const args = process.argv.slice(2); @@ -15,8 +15,9 @@ const args = process.argv.slice(2); * }; * ``` */ +// @ts-ignore until dependencies are fixed to one unique version of @jest/types const config: Config.InitialOptions = OdsGetJestConfig({ - basePath: '/../../../..', + basePath: '/../../..', args }); export default config; diff --git a/packages/stencil/components/tooltip/package.json b/packages-new/components/tooltip/package.json similarity index 83% rename from packages/stencil/components/tooltip/package.json rename to packages-new/components/tooltip/package.json index 62101f6bd0..f17951cabe 100644 --- a/packages/stencil/components/tooltip/package.json +++ b/packages-new/components/tooltip/package.json @@ -1,15 +1,14 @@ { - "name": "@ovhcloud/ods-stencil-tooltip", + "name": "@ovhcloud/ods-component-tooltip", "version": "15.0.1", - "private": true, - "description": "Tooltip component", + "description": "ODS Tooltip component", "author": "OVH SAS", "license": "Apache-2.0", "main": "dist/index.cjs.js", "module": "dist/index.js", "es2015": "dist/esm/index.js", "es2017": "dist/esm/index.js", - "types": "dist/types/components.d.ts", + "types": "dist/types/index.d.ts", "collection": "dist/collection/collection-manifest.json", "collection:main": "dist/collection/index.js", "scripts": { @@ -35,11 +34,15 @@ "test:e2e:ci:screenshot:update": "stencil test --config stencil.config.ts --e2e --ci --screenshot --update-screenshot --passWithNoTests" }, "dependencies": { - "@ovhcloud/ods-stencil-component": "^15.0.1" + "@ovhcloud/ods-common-core": "^15.0.1", + "@ovhcloud/ods-common-stencil": "^15.0.1", + "@ovhcloud/ods-theming": "^15.0.1" }, "devDependencies": { + "@ovhcloud/ods-common-testing": "^15.0.1", + "@ovhcloud/ods-component-icon": "^15.0.1", "@ovhcloud/ods-component-text": "^15.0.1", - "@ovhcloud/ods-stencil-component-dev": "^15.0.1" + "@ovhcloud/ods-stencil-dev": "^15.0.1" }, "publishConfig": { "registry": "" diff --git a/packages/stencil/components/tooltip/react/.gitignore b/packages-new/components/tooltip/react/.gitignore similarity index 100% rename from packages/stencil/components/tooltip/react/.gitignore rename to packages-new/components/tooltip/react/.gitignore diff --git a/packages/stencil/components/tooltip/react/.npmignore b/packages-new/components/tooltip/react/.npmignore similarity index 100% rename from packages/stencil/components/tooltip/react/.npmignore rename to packages-new/components/tooltip/react/.npmignore diff --git a/packages/stencil/components/tooltip/react/CHANGELOG.md b/packages-new/components/tooltip/react/CHANGELOG.md similarity index 100% rename from packages/stencil/components/tooltip/react/CHANGELOG.md rename to packages-new/components/tooltip/react/CHANGELOG.md diff --git a/packages/stencil/components/tooltip/react/package.json b/packages-new/components/tooltip/react/package.json similarity index 70% rename from packages/stencil/components/tooltip/react/package.json rename to packages-new/components/tooltip/react/package.json index f09e096d78..8106b109ab 100644 --- a/packages/stencil/components/tooltip/react/package.json +++ b/packages-new/components/tooltip/react/package.json @@ -1,5 +1,5 @@ { - "name": "@ovhcloud/ods-stencil-tooltip-react", + "name": "@ovhcloud/ods-component-tooltip-react", "version": "15.0.1", "private": true, "description": "React specific wrapper for ods", @@ -20,19 +20,13 @@ "dist/" ], "dependencies": { - "@ovhcloud/ods-stencil-tooltip": "^15.0.1", - "tslib": "*" + "@ovhcloud/ods-component-tooltip": "^15.0.1" }, "peerDependencies": { "react": ">=16.8.6", "react-dom": ">=16.8.6" }, "devDependencies": { - "@types/react": "17.0.37", - "@types/react-dom": "17.0.11", - "react": "16.14.0", - "react-dom": "16.14.0", - "rimraf": "^3.0.2", - "typescript": "4.7.4" + "@ovhcloud/ods-react-dev": "^15.0.1" } } diff --git a/packages/stencil/components/tooltip/react/tsconfig.cjs.json b/packages-new/components/tooltip/react/tsconfig.cjs.json similarity index 100% rename from packages/stencil/components/tooltip/react/tsconfig.cjs.json rename to packages-new/components/tooltip/react/tsconfig.cjs.json diff --git a/packages/stencil/components/tooltip/react/tsconfig.json b/packages-new/components/tooltip/react/tsconfig.json similarity index 100% rename from packages/stencil/components/tooltip/react/tsconfig.json rename to packages-new/components/tooltip/react/tsconfig.json diff --git a/packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.e2e.ts b/packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.e2e.ts new file mode 100644 index 0000000000..fa7cad169e --- /dev/null +++ b/packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.e2e.ts @@ -0,0 +1,29 @@ +import type { E2EElement, E2EPage } from '@stencil/core/testing'; +import { newE2EPage } from '@stencil/core/testing'; + +describe('e2e:osds-tooltip-content', () => { + let page: E2EPage; + let el: E2EElement; + + async function setup({ html }: { html?: string } = {}) { + page = await newE2EPage(); + await page.setContent(`${html}`); + await page.evaluate(() => document.body.style.setProperty('margin', '0px')); + + el = await page.find('osds-tooltip-content'); + } + + it('should render', async () => { + await setup(); + expect(el).not.toBeNull(); + expect(el).toHaveClass('hydrated'); + }); + + describe('default slot', () => { + it('should display a text', async () => { + const slot = 'Dummy text' + await setup({ html: slot }); + expect(el.innerHTML).toBe(slot); + }) + }); +}); diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.scss b/packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.scss similarity index 100% rename from packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.scss rename to packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.scss diff --git a/packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.spec.ts b/packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.spec.ts new file mode 100644 index 0000000000..91b8a9e051 --- /dev/null +++ b/packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.spec.ts @@ -0,0 +1,29 @@ +import type { SpecPage } from '@stencil/core/testing'; +import { newSpecPage } from '@stencil/core/testing'; +import { OsdsTooltipContent } from './osds-tooltip-content'; + +describe('spec:osds-tooltip-content', () => { + let page: SpecPage; + let root: HTMLElement | undefined; + let instance: OsdsTooltipContent; + + afterEach(() => { + jest.clearAllMocks(); + }); + + async function setup() { + page = await newSpecPage({ + components: [OsdsTooltipContent], + html: `My Tooltip Content`, + }); + + root = page.root; + instance = page.rootInstance; + } + + it('should render', async () => { + await setup(); + expect(root?.shadowRoot).toBeTruthy(); + expect(instance).toBeTruthy(); + }); +}); diff --git a/packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.tsx b/packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.tsx new file mode 100644 index 0000000000..3a08e1c4b1 --- /dev/null +++ b/packages-new/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.tsx @@ -0,0 +1,21 @@ +import { Component, Element, Host, h } from '@stencil/core'; + +/** + * @slot (tooltip-content) - The Tooltip content + */ +@Component({ + tag: 'osds-tooltip-content', + styleUrl: 'osds-tooltip-content.scss', + shadow: true +}) +export class OsdsTooltipContent { + @Element() el!: HTMLElement; + + render() { + return ( + + + + ); + } +} diff --git a/packages-new/components/tooltip/src/components/osds-tooltip-content/public-api.ts b/packages-new/components/tooltip/src/components/osds-tooltip-content/public-api.ts new file mode 100644 index 0000000000..ce35daa0d6 --- /dev/null +++ b/packages-new/components/tooltip/src/components/osds-tooltip-content/public-api.ts @@ -0,0 +1 @@ +export { OsdsTooltipContent } from './osds-tooltip-content'; diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.color.scss b/packages-new/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.color.scss similarity index 100% rename from packages/stencil/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.color.scss rename to packages-new/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.color.scss diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.mixins.scss b/packages-new/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.mixins.scss similarity index 100% rename from packages/stencil/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.mixins.scss rename to packages-new/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.mixins.scss diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.size.scss b/packages-new/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.size.scss similarity index 100% rename from packages/stencil/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.size.scss rename to packages-new/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.size.scss diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.typography.scss b/packages-new/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.typography.scss similarity index 100% rename from packages/stencil/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.typography.scss rename to packages-new/components/tooltip/src/components/osds-tooltip-content/styles/osds-tooltip-content.typography.scss diff --git a/packages-new/components/tooltip/src/components/osds-tooltip/constants/default-attributes.ts b/packages-new/components/tooltip/src/components/osds-tooltip/constants/default-attributes.ts new file mode 100644 index 0000000000..3d03e10361 --- /dev/null +++ b/packages-new/components/tooltip/src/components/osds-tooltip/constants/default-attributes.ts @@ -0,0 +1,10 @@ +import type { OdsTooltipAttribute } from '../interfaces/attributes'; +import { ODS_TOOLTIP_VARIANT } from './tooltip-variant'; + +const DEFAULT_ATTRIBUTE: OdsTooltipAttribute = Object.freeze({ + variant: ODS_TOOLTIP_VARIANT.standard, +}); + +export { + DEFAULT_ATTRIBUTE, +}; diff --git a/packages-new/components/tooltip/src/components/osds-tooltip/constants/tooltip-variant.ts b/packages-new/components/tooltip/src/components/osds-tooltip/constants/tooltip-variant.ts new file mode 100644 index 0000000000..e2b330e09f --- /dev/null +++ b/packages-new/components/tooltip/src/components/osds-tooltip/constants/tooltip-variant.ts @@ -0,0 +1,11 @@ +enum ODS_TOOLTIP_VARIANT { + standard = 'standard', + tip = 'tip', +} + +const ODS_TOOLTIP_VARIANTS = Object.freeze(Object.values(ODS_TOOLTIP_VARIANT)); + +export { + ODS_TOOLTIP_VARIANT, + ODS_TOOLTIP_VARIANTS, +}; diff --git a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-controller.spec.ts b/packages-new/components/tooltip/src/components/osds-tooltip/core/controller.spec.ts similarity index 89% rename from packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-controller.spec.ts rename to packages-new/components/tooltip/src/components/osds-tooltip/core/controller.spec.ts index 877ea79650..3d98e0c382 100644 --- a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-controller.spec.ts +++ b/packages-new/components/tooltip/src/components/osds-tooltip/core/controller.spec.ts @@ -1,29 +1,31 @@ -import { OdsClearLoggerSpy, OdsInitializeLoggerSpy, OdsLoggerSpyReferences } from '@ovhcloud/ods-testing/src'; -import { Ods } from '../../../configure/ods'; -import { OdsLogger } from '../../../logger/ods-logger'; -import { HTMLStencilElement } from '@stencil/core/internal'; -import { OdsTooltip } from './ods-tooltip'; -import { OdsTooltipController } from './ods-tooltip-controller'; -import { OdsTooltipVariant } from './ods-tooltip-variant'; -import { OdsTooltipMock } from './ods-tooltip.mock'; -import { OcdkSurface, OcdkSurfaceMock } from '@ovhcloud/ods-cdk'; - -describe('spec:ods-tooltip-controller', () => { +import type { OcdkSurface } from '@ovhcloud/ods-cdk'; +import { OcdkSurfaceMock } from '@ovhcloud/ods-cdk'; +import { Ods, OdsLogger } from '@ovhcloud/ods-common-core'; +import { OdsClearLoggerSpy, OdsInitializeLoggerSpy, OdsLoggerSpyReferences } from '@ovhcloud/ods-common-testing'; +import { ODS_TOOLTIP_VARIANT } from '../constants/tooltip-variant'; +import { OdsTooltipController } from './controller'; +import { OsdsTooltip } from '../osds-tooltip'; + +class OdsTooltipMock extends OsdsTooltip { + constructor(attribute: Partial) { + super(); + Object.assign(this, attribute); + } +} + +describe('ods-tooltip-controller', () => { let controller: OdsTooltipController; - let component: OdsTooltip; + let component: OsdsTooltip; let loggerSpyReferences: OdsLoggerSpyReferences; Ods.instance().logging(false); - function setup(attributes: Partial = {}) { - component = { ...component, ...attributes }; + function setup(attributes: Partial = {}) { + component = new OdsTooltipMock(attributes); controller = new OdsTooltipController(component); } beforeEach(() => { - component = new OdsTooltipMock(); - component.el = document.createElement('osds-tooltip') as HTMLStencilElement; - const loggerMocked = new OdsLogger('myLoggerMocked'); loggerSpyReferences = OdsInitializeLoggerSpy({ loggerMocked: loggerMocked as never, @@ -43,7 +45,7 @@ describe('spec:ods-tooltip-controller', () => { describe('methods', () => { beforeEach(() => { - setup(component); + setup() }); describe('checkForClickOutside', () => { @@ -247,7 +249,7 @@ describe('spec:ods-tooltip-controller', () => { describe('validateAttributes', () => { beforeEach(() => { - setup({ variant: OdsTooltipVariant.standard }); + setup({ variant: ODS_TOOLTIP_VARIANT.standard }); }) it('should not call console.warn', () => { @@ -258,7 +260,7 @@ describe('spec:ods-tooltip-controller', () => { it('should call console.warn with wrong variant', () => { const expected = 'The variant attribute must have a value from [standard, tip]'; - component.variant = 'variant' as OdsTooltipVariant; + component.variant = 'variant' as ODS_TOOLTIP_VARIANT; controller.validateAttributes(); diff --git a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-controller.ts b/packages-new/components/tooltip/src/components/osds-tooltip/core/controller.ts similarity index 68% rename from packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-controller.ts rename to packages-new/components/tooltip/src/components/osds-tooltip/core/controller.ts index f3c31eefbe..47ff919591 100644 --- a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-controller.ts +++ b/packages-new/components/tooltip/src/components/osds-tooltip/core/controller.ts @@ -1,18 +1,13 @@ -import { OdsTooltip } from './ods-tooltip'; -import { OdsComponentController } from '../../ods-component-controller'; -import { OdsLogger } from '../../../logger/ods-logger'; -import { OdsWarnComponentAttribute } from '../../../logger/ods-warn-logger'; -import { OdsTooltipVariant } from './ods-tooltip-variant'; +import type { OsdsTooltip } from '../osds-tooltip'; +import { OdsLogger, OdsWarnComponentAttribute } from '@ovhcloud/ods-common-core'; +import { ODS_TOOLTIP_VARIANT } from '../constants/tooltip-variant'; -/** - * common controller logic for component used by the different implementations. - * it contains all the glue between framework implementation and the third party service. - */ -export class OdsTooltipController extends OdsComponentController { +class OdsTooltipController { + private component: OsdsTooltip; private readonly logger = new OdsLogger('OdsTooltipController'); - constructor(component: OdsTooltip) { - super(component); + constructor(component: OsdsTooltip) { + this.component = component; } /** @@ -80,9 +75,9 @@ export class OdsTooltipController extends OdsComponentController { * Validate that all attributes have correct values */ validateAttributes(): void { - OdsWarnComponentAttribute({ + OdsWarnComponentAttribute({ logger: this.logger, - attributeValues: OdsTooltipVariant as Record, + attributeValues: ODS_TOOLTIP_VARIANT as Record, attributeName: 'variant', attribute: this.component.variant, }); @@ -94,3 +89,7 @@ export class OdsTooltipController extends OdsComponentController { } } } + +export { + OdsTooltipController, +}; diff --git a/packages-new/components/tooltip/src/components/osds-tooltip/interfaces/attributes.ts b/packages-new/components/tooltip/src/components/osds-tooltip/interfaces/attributes.ts new file mode 100644 index 0000000000..11153f2edd --- /dev/null +++ b/packages-new/components/tooltip/src/components/osds-tooltip/interfaces/attributes.ts @@ -0,0 +1,10 @@ +import type { ODS_TOOLTIP_VARIANT } from '../constants/tooltip-variant'; + +interface OdsTooltipAttribute { + /** with or without visible tip: see component principles */ + variant?: ODS_TOOLTIP_VARIANT; +} + +export { + OdsTooltipAttribute, +}; diff --git a/packages-new/components/tooltip/src/components/osds-tooltip/interfaces/methods.ts b/packages-new/components/tooltip/src/components/osds-tooltip/interfaces/methods.ts new file mode 100644 index 0000000000..46a7e1009c --- /dev/null +++ b/packages-new/components/tooltip/src/components/osds-tooltip/interfaces/methods.ts @@ -0,0 +1,15 @@ +interface OdsTooltipMethod { + /** + * Close the surface + */ + closeSurface(): Promise; + + /** + * set tab index on the component + */ + setTabindex(value: number): Promise; +} + +export { + OdsTooltipMethod, +}; diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.screenshot.ts b/packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.screenshot.ts similarity index 52% rename from packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.screenshot.ts rename to packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.screenshot.ts index 262a7fab41..a13092e179 100644 --- a/packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.screenshot.ts +++ b/packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.screenshot.ts @@ -1,23 +1,20 @@ -import { E2EElement, E2EPage, newE2EPage } from '@stencil/core/testing'; -import { - OdsTooltipAttributes, - OdsComponentAttributes2StringAttributes, - odsTooltipDefaultAttributes, - OdsTooltipVariant, -} from '@ovhcloud/ods-core'; -import { OdsCreateAttributes, OdsStringAttributes2Str, odsTooltipBaseAttributes } from '@ovhcloud/ods-testing'; +import type { E2EElement, E2EPage } from '@stencil/core/testing'; +import type { OdsTooltipAttribute } from './interfaces/attributes'; +import { odsComponentAttributes2StringAttributes, odsStringAttributes2Str } from '@ovhcloud/ods-common-testing'; +import { newE2EPage } from '@stencil/core/testing'; +import { DEFAULT_ATTRIBUTE } from './constants/default-attributes'; +import { ODS_TOOLTIP_VARIANT } from './constants/tooltip-variant'; describe('e2e:osds-tooltip', () => { let page: E2EPage; let el: E2EElement; - async function setup({ attributes = {}, html = '' }: { attributes?: Partial, html?: string } = {}) { - const minimalAttributes: OdsTooltipAttributes = OdsCreateAttributes(attributes, odsTooltipBaseAttributes); - const stringAttributes = OdsComponentAttributes2StringAttributes(minimalAttributes, odsTooltipDefaultAttributes); + async function setup({ attributes = {}, html = '' }: { attributes?: Partial, html?: string } = {}) { + const stringAttributes = odsComponentAttributes2StringAttributes(attributes, DEFAULT_ATTRIBUTE); page = await newE2EPage(); await page.setContent(` - + ${html} `); @@ -31,7 +28,7 @@ describe('e2e:osds-tooltip', () => { describe('screenshots', () => { it('standard tooltip', async () => { await setup({ - attributes: { variant: OdsTooltipVariant.standard }, + attributes: { variant: ODS_TOOLTIP_VARIANT.standard }, html: 'Lorem ispum...Hover me', }); diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.ts b/packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.ts similarity index 81% rename from packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.ts rename to packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.ts index b2b7dd1a7a..2546bd8da2 100644 --- a/packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.ts +++ b/packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.e2e.ts @@ -1,6 +1,8 @@ -import { E2EElement, E2EPage, newE2EPage } from '@stencil/core/testing'; -import { OdsTooltipAttributes, OdsComponentAttributes2StringAttributes, odsTooltipDefaultAttributes } from '@ovhcloud/ods-core'; -import { OdsCreateAttributes, OdsStringAttributes2Str, odsTooltipBaseAttributes } from '@ovhcloud/ods-testing'; +import type { E2EElement, E2EPage } from '@stencil/core/testing'; +import type { OdsTooltipAttribute } from './interfaces/attributes'; +import { odsComponentAttributes2StringAttributes, odsStringAttributes2Str } from '@ovhcloud/ods-common-testing'; +import { newE2EPage } from '@stencil/core/testing'; +import { DEFAULT_ATTRIBUTE } from './constants/default-attributes'; describe('e2e:osds-tooltip', () => { let page: E2EPage; @@ -12,13 +14,12 @@ describe('e2e:osds-tooltip', () => { }); } - async function setup({ attributes = {}, extraContent = '' }: { attributes?: Partial, extraContent?: string } = {}) { - const minimalAttributes: OdsTooltipAttributes = OdsCreateAttributes(attributes, odsTooltipBaseAttributes); - const stringAttributes = OdsComponentAttributes2StringAttributes(minimalAttributes, odsTooltipDefaultAttributes); + async function setup({ attributes = {}, extraContent = '' }: { attributes?: Partial, extraContent?: string } = {}) { + const stringAttributes = odsComponentAttributes2StringAttributes(attributes, DEFAULT_ATTRIBUTE); page = await newE2EPage(); await page.setContent(` - + Tooltip content diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.scss b/packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.scss similarity index 100% rename from packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.scss rename to packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.scss diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.spec.ts b/packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.spec.ts similarity index 79% rename from packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.spec.ts rename to packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.spec.ts index d3bfc22e33..581300152f 100644 --- a/packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.spec.ts +++ b/packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.spec.ts @@ -1,23 +1,16 @@ // keep jest.mock before any -jest.mock('@ovhcloud/ods-core/src/components/tooltip/tooltip/ods-tooltip-controller'); +jest.mock('./core/controller'); jest.mock('@ovhcloud/ods-cdk'); -import { getAttributeContextOptions } from '@ovhcloud/ods-stencil-testing'; -import { - OdsTooltipAttributes, - OdsTooltipController, - OdsComponentAttributes2StringAttributes, - odsTooltipDefaultAttributes, OdsTooltipVariantList, -} from '@ovhcloud/ods-core'; -import { - OdsCreateAttributes, - OdsStringAttributes2Str, - odsTooltipBaseAttributes, - odsUnitTestAttribute, -} from '@ovhcloud/ods-testing'; -import { SpecPage, newSpecPage } from '@stencil/core/testing'; -import { OsdsTooltip } from './osds-tooltip'; +import type { SpecPage } from '@stencil/core/testing'; +import type { OdsTooltipAttribute } from './interfaces/attributes'; import { ocdkIsSurface } from '@ovhcloud/ods-cdk'; +import { odsComponentAttributes2StringAttributes, odsStringAttributes2Str, odsUnitTestAttribute } from '@ovhcloud/ods-common-testing'; +import { newSpecPage } from '@stencil/core/testing'; +import { DEFAULT_ATTRIBUTE } from './constants/default-attributes'; +import { ODS_TOOLTIP_VARIANT, ODS_TOOLTIP_VARIANTS } from './constants/tooltip-variant'; +import { OdsTooltipController } from './core/controller'; +import { OsdsTooltip } from './osds-tooltip'; describe('spec:osds-tooltip', () => { let page: SpecPage; @@ -31,13 +24,12 @@ describe('spec:osds-tooltip', () => { jest.clearAllMocks(); }); - async function setup({ attributes = {}, html = '' }: { attributes?: Partial, html?: string } = {}) { - const minimalAttributes: OdsTooltipAttributes = OdsCreateAttributes(attributes, odsTooltipBaseAttributes); - const stringAttributes = OdsComponentAttributes2StringAttributes(minimalAttributes, odsTooltipDefaultAttributes); + async function setup({ attributes = {}, html = '' }: { attributes?: Partial, html?: string } = {}) { + const stringAttributes = odsComponentAttributes2StringAttributes(attributes, DEFAULT_ATTRIBUTE); page = await newSpecPage({ components: [OsdsTooltip], - html: `${html}`, + html: `${html}`, }); root = page.root; @@ -85,23 +77,24 @@ describe('spec:osds-tooltip', () => { describe('attributes', () => { const config = { - page: () => page, instance: () => instance, - setup + page: () => page, + root: () => page.root, + wait: () => page.waitForChanges(), }; describe('variant', () => { - odsUnitTestAttribute({ - ...getAttributeContextOptions({ - name: 'variant', - list: OdsTooltipVariantList, - defaultValue: odsTooltipDefaultAttributes.variant, - ...config - }) + odsUnitTestAttribute({ + name: 'variant', + defaultValue: DEFAULT_ATTRIBUTE.variant, + newValue: ODS_TOOLTIP_VARIANT.standard, + value: ODS_TOOLTIP_VARIANT.tip, + setup: (value) => setup({ attributes: { ['variant']: value } }), + ...config, }); it('should set the variant if attribute is added', async () => { - const randomVariant = OdsTooltipVariantList[Math.floor(Math.random() * OdsTooltipVariantList.length)]; + const randomVariant = ODS_TOOLTIP_VARIANTS[Math.floor(Math.random() * ODS_TOOLTIP_VARIANTS.length)]; await setup({ attributes: { variant: randomVariant } }); expect(instance.variant).toBe(randomVariant); }); diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.tsx b/packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.tsx similarity index 81% rename from packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.tsx rename to packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.tsx index cc5d6d9e6f..3eb9005976 100644 --- a/packages/stencil/components/tooltip/src/components/osds-tooltip/osds-tooltip.tsx +++ b/packages-new/components/tooltip/src/components/osds-tooltip/osds-tooltip.tsx @@ -1,16 +1,13 @@ -import { Component, Element, Host, h, Listen, State } from '@stencil/core'; -import { - odsDebounce, - OdsTooltip, - OdsTooltipController, - odsTooltipDefaultAttributes, - OdsTooltipEvents, - OdsTooltipMethods, - OdsTooltipVariant, -} from '@ovhcloud/ods-core'; -import { OdsStencilEvents, OdsStencilMethods } from '@ovhcloud/ods-stencil/libraries/stencil-core'; +import type { HTMLStencilElement } from '@stencil/core/internal'; +import type { ODS_TOOLTIP_VARIANT } from './constants/tooltip-variant'; +import type { OdsTooltipAttribute } from './interfaces/attributes'; +import type { OdsTooltipMethod } from './interfaces/methods'; import { ocdkDefineCustomElements, ocdkIsSurface, OcdkSurface } from '@ovhcloud/ods-cdk'; -import { HTMLStencilElement, Method, Prop } from '@stencil/core/internal'; +import { odsDebounce } from '@ovhcloud/ods-common-core'; +import { Component, Element, Host, h, Listen, State } from '@stencil/core'; +import { Method, Prop } from '@stencil/core/internal'; +import { DEFAULT_ATTRIBUTE } from './constants/default-attributes'; +import { OdsTooltipController } from './core/controller'; // define custom elements from CDK ocdkDefineCustomElements() @@ -23,11 +20,11 @@ ocdkDefineCustomElements() styleUrl: 'osds-tooltip.scss', shadow: true, }) -export class OsdsTooltip implements OdsTooltip, OdsStencilEvents> { +export class OsdsTooltip implements OdsTooltipAttribute, OdsTooltipMethod { anchor!: HTMLDivElement; controller: OdsTooltipController = new OdsTooltipController(this); surface: OcdkSurface | undefined = undefined; - + @State() hasSlotTooltipContent: boolean = false; @Element() el!: HTMLStencilElement; @@ -39,7 +36,7 @@ export class OsdsTooltip implements OdsTooltip - { this.hasSlotTooltipContent && + { this.hasSlotTooltipContent && { if (ocdkIsSurface(el)) { this.surface = el as OcdkSurface; diff --git a/packages-new/components/tooltip/src/components/osds-tooltip/public-api.ts b/packages-new/components/tooltip/src/components/osds-tooltip/public-api.ts new file mode 100644 index 0000000000..4d8859dbd5 --- /dev/null +++ b/packages-new/components/tooltip/src/components/osds-tooltip/public-api.ts @@ -0,0 +1,4 @@ +export type { OdsTooltipAttribute } from './interfaces/attributes'; +export type { OdsTooltipMethod } from './interfaces/methods'; +export { ODS_TOOLTIP_VARIANT, ODS_TOOLTIP_VARIANTS } from './constants/tooltip-variant'; +export { OsdsTooltip } from './osds-tooltip'; diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.color.scss b/packages-new/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.color.scss similarity index 100% rename from packages/stencil/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.color.scss rename to packages-new/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.color.scss diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.mixins.scss b/packages-new/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.mixins.scss similarity index 100% rename from packages/stencil/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.mixins.scss rename to packages-new/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.mixins.scss diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.size.scss b/packages-new/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.size.scss similarity index 100% rename from packages/stencil/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.size.scss rename to packages-new/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.size.scss diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.typography.scss b/packages-new/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.typography.scss similarity index 100% rename from packages/stencil/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.typography.scss rename to packages-new/components/tooltip/src/components/osds-tooltip/styles/osds-tooltip.typography.scss diff --git a/packages/stencil/components/tooltip/src/docs/osds-tooltip/usage.mdx b/packages-new/components/tooltip/src/docs/osds-tooltip/usage.mdx similarity index 62% rename from packages/stencil/components/tooltip/src/docs/osds-tooltip/usage.mdx rename to packages-new/components/tooltip/src/docs/osds-tooltip/usage.mdx index bca3be6c99..8e2917ea04 100644 --- a/packages/stencil/components/tooltip/src/docs/osds-tooltip/usage.mdx +++ b/packages-new/components/tooltip/src/docs/osds-tooltip/usage.mdx @@ -1,4 +1,4 @@ -import GenericStyle from '@ovhcloud/ods-core/docs/generic-style.mdx'; +import GenericStyle from '@ovhcloud/ods-common-core/docs/generic-style.mdx'; diff --git a/packages/stencil/components/tooltip/src/global.dev.ts b/packages-new/components/tooltip/src/global.dev.ts similarity index 90% rename from packages/stencil/components/tooltip/src/global.dev.ts rename to packages-new/components/tooltip/src/global.dev.ts index 7befa90144..0936ad8158 100644 --- a/packages/stencil/components/tooltip/src/global.dev.ts +++ b/packages-new/components/tooltip/src/global.dev.ts @@ -5,7 +5,7 @@ import './components'; import './global'; -import { OdsLogger } from '@ovhcloud/ods-core'; +import { OdsLogger } from '@ovhcloud/ods-common-core'; import '@ovhcloud/ods-component-icon'; import '@ovhcloud/ods-component-text'; diff --git a/packages/stencil/components/tooltip/src/global.prod.ts b/packages-new/components/tooltip/src/global.prod.ts similarity index 100% rename from packages/stencil/components/tooltip/src/global.prod.ts rename to packages-new/components/tooltip/src/global.prod.ts diff --git a/packages/stencil/components/tooltip/src/global.test.ts b/packages-new/components/tooltip/src/global.test.ts similarity index 100% rename from packages/stencil/components/tooltip/src/global.test.ts rename to packages-new/components/tooltip/src/global.test.ts diff --git a/packages/stencil/components/tooltip/src/global.ts b/packages-new/components/tooltip/src/global.ts similarity index 81% rename from packages/stencil/components/tooltip/src/global.ts rename to packages-new/components/tooltip/src/global.ts index 3cc7724e81..20f7f01cb4 100644 --- a/packages/stencil/components/tooltip/src/global.ts +++ b/packages-new/components/tooltip/src/global.ts @@ -3,7 +3,7 @@ // it allows to initialize some stuff of the library, after the component itself // ### -import { OdsLogger } from '@ovhcloud/ods-core'; +import { OdsLogger } from '@ovhcloud/ods-common-core'; const logger = new OdsLogger('tooltip.global'); logger.log('init'); diff --git a/packages/stencil/components/tooltip/src/index.html b/packages-new/components/tooltip/src/index.html similarity index 100% rename from packages/stencil/components/tooltip/src/index.html rename to packages-new/components/tooltip/src/index.html diff --git a/packages/stencil/components/tooltip/src/index.ts b/packages-new/components/tooltip/src/index.ts similarity index 100% rename from packages/stencil/components/tooltip/src/index.ts rename to packages-new/components/tooltip/src/index.ts diff --git a/packages/stencil/components/tooltip/stencil.config.ts b/packages-new/components/tooltip/stencil.config.ts similarity index 63% rename from packages/stencil/components/tooltip/stencil.config.ts rename to packages-new/components/tooltip/stencil.config.ts index 502e16ef34..4c2f7a3b9f 100644 --- a/packages/stencil/components/tooltip/stencil.config.ts +++ b/packages-new/components/tooltip/stencil.config.ts @@ -1,5 +1,5 @@ import { Config } from '@stencil/core'; -import { getStencilConfig } from '@ovhcloud/ods-stencil/libraries/stencil-core'; +import { getStencilConfig } from '@ovhcloud/ods-common-stencil'; import * as jestConfig from './jest.config'; const args = process.argv.slice(2); @@ -9,12 +9,11 @@ export const config: Config = getStencilConfig({ args, jestConfig: jestConfig.default, reactOutput: { - componentCorePackage: '@ovhcloud/ods-stencil/components/tooltip', - // exclude peer dependencies that corresponds to www usage + componentCorePackage: '@ovhcloud/ods-component-tooltip', excludeComponents: [] }, vueOutput: { - componentCorePackage: '@ovhcloud/ods-stencil/components/tooltip', + componentCorePackage: '@ovhcloud/ods-component-tooltip', excludeComponents: [] }, dev: { diff --git a/packages/stencil/components/tooltip/tsconfig.dev.json b/packages-new/components/tooltip/tsconfig.dev.json similarity index 100% rename from packages/stencil/components/tooltip/tsconfig.dev.json rename to packages-new/components/tooltip/tsconfig.dev.json diff --git a/packages/stencil/components/tooltip/tsconfig.json b/packages-new/components/tooltip/tsconfig.json similarity index 100% rename from packages/stencil/components/tooltip/tsconfig.json rename to packages-new/components/tooltip/tsconfig.json diff --git a/packages/stencil/components/tooltip/tsconfig.prod.json b/packages-new/components/tooltip/tsconfig.prod.json similarity index 100% rename from packages/stencil/components/tooltip/tsconfig.prod.json rename to packages-new/components/tooltip/tsconfig.prod.json diff --git a/packages/stencil/components/tooltip/tsconfig.test.json b/packages-new/components/tooltip/tsconfig.test.json similarity index 100% rename from packages/stencil/components/tooltip/tsconfig.test.json rename to packages-new/components/tooltip/tsconfig.test.json diff --git a/packages/stencil/components/tooltip/typedoc.json b/packages-new/components/tooltip/typedoc.json similarity index 73% rename from packages/stencil/components/tooltip/typedoc.json rename to packages-new/components/tooltip/typedoc.json index 96abc615cf..0806319bf2 100644 --- a/packages/stencil/components/tooltip/typedoc.json +++ b/packages-new/components/tooltip/typedoc.json @@ -1,6 +1,6 @@ { "entryPoints": ["src"], - "out": "docs-api/stencil-components-tooltip", + "out": "docs-api/ods-component-tooltip", "tsconfig":"tsconfig.prod.json", "exclude": "**/*+(index|.spec|.e2e|.d).ts", "plugin": "none" diff --git a/packages/stencil/components/tooltip/vue/.gitignore b/packages-new/components/tooltip/vue/.gitignore similarity index 100% rename from packages/stencil/components/tooltip/vue/.gitignore rename to packages-new/components/tooltip/vue/.gitignore diff --git a/packages/stencil/components/tooltip/vue/.npmignore b/packages-new/components/tooltip/vue/.npmignore similarity index 100% rename from packages/stencil/components/tooltip/vue/.npmignore rename to packages-new/components/tooltip/vue/.npmignore diff --git a/packages/stencil/components/tooltip/vue/CHANGELOG.md b/packages-new/components/tooltip/vue/CHANGELOG.md similarity index 100% rename from packages/stencil/components/tooltip/vue/CHANGELOG.md rename to packages-new/components/tooltip/vue/CHANGELOG.md diff --git a/packages/stencil/components/tooltip/vue/package.json b/packages-new/components/tooltip/vue/package.json similarity index 79% rename from packages/stencil/components/tooltip/vue/package.json rename to packages-new/components/tooltip/vue/package.json index aa5b122a9e..78d5c7b578 100644 --- a/packages/stencil/components/tooltip/vue/package.json +++ b/packages-new/components/tooltip/vue/package.json @@ -1,5 +1,5 @@ { - "name": "@ovhcloud/ods-stencil-tooltip-vue", + "name": "@ovhcloud/ods-component-tooltip-vue", "version": "15.0.1", "private": true, "description": "Vue specific wrapper for ods", @@ -20,14 +20,12 @@ "dist/" ], "dependencies": { - "@ovhcloud/ods-stencil-tooltip": "^15.0.1" + "@ovhcloud/ods-component-tooltip": "^15.0.1" }, "peerDependencies": { "vue": ">=3" }, "devDependencies": { - "rimraf": "^3.0.2", - "typescript": "4.7.4", - "vue": "^3.2.41" + "@ovhcloud/ods-vue-dev": "^15.0.1" } } diff --git a/packages/stencil/components/tooltip/vue/tsconfig.cjs.json b/packages-new/components/tooltip/vue/tsconfig.cjs.json similarity index 100% rename from packages/stencil/components/tooltip/vue/tsconfig.cjs.json rename to packages-new/components/tooltip/vue/tsconfig.cjs.json diff --git a/packages/stencil/components/tooltip/vue/tsconfig.json b/packages-new/components/tooltip/vue/tsconfig.json similarity index 100% rename from packages/stencil/components/tooltip/vue/tsconfig.json rename to packages-new/components/tooltip/vue/tsconfig.json diff --git a/packages/libraries/core/src/components/public-api.ts b/packages/libraries/core/src/components/public-api.ts index 5bfbc48e53..8c72c4cc18 100644 --- a/packages/libraries/core/src/components/public-api.ts +++ b/packages/libraries/core/src/components/public-api.ts @@ -36,7 +36,6 @@ export * from './switch/public-api'; export * from './switch-item/public-api'; export * from './tabs/public-api'; export * from './toggle/public-api'; -export * from './tooltip/public-api'; export * from './ods-component'; export * from './ods-component-generic-attributes'; diff --git a/packages/libraries/core/src/components/tooltip/public-api.ts b/packages/libraries/core/src/components/tooltip/public-api.ts deleted file mode 100644 index f5d0a0a2f8..0000000000 --- a/packages/libraries/core/src/components/tooltip/public-api.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './tooltip/public-api'; -export * from './tooltip-content/public-api'; diff --git a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-attributes.ts b/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-attributes.ts deleted file mode 100644 index 15b2eccee0..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-attributes.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { OdsComponentAttributes } from '../../ods-component-attributes'; - -export interface OdsTooltipContentAttributes extends OdsComponentAttributes { - /** - * TooltipContent attribute description - */ -} diff --git a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-controller.ts b/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-controller.ts deleted file mode 100644 index 13bb74a1fa..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-controller.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { OdsTooltipContent } from './ods-tooltip-content'; -import { OdsComponentController } from '../../ods-component-controller'; - -/** - * common controller logic for component used by the different implementations. - * it contains all the glue between framework implementation and the third party service. - */ -export class OdsTooltipContentController extends OdsComponentController { - constructor(component: OdsTooltipContent) { - super(component); - } -} diff --git a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-default-attributes.ts b/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-default-attributes.ts deleted file mode 100644 index 8824dd21a4..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-default-attributes.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { OdsTooltipContentAttributes } from './ods-tooltip-content-attributes'; - -export const odsTooltipContentDefaultAttributesDoc = { - // default attributes -} as const; - -export const odsTooltipContentDefaultAttributes = odsTooltipContentDefaultAttributesDoc as OdsTooltipContentAttributes; diff --git a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-events.ts b/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-events.ts deleted file mode 100644 index 529419254f..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-events.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { OdsComponentEvents } from '../../ods-component-events'; - -export interface OdsTooltipContentEvents extends OdsComponentEvents { - // Events -} diff --git a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-methods.ts b/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-methods.ts deleted file mode 100644 index 5ae15fc24f..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content-methods.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { OdsComponentMethods } from '../../ods-component-methods'; - -export interface OdsTooltipContentMethods extends OdsComponentMethods { - -} diff --git a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content.ts b/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content.ts deleted file mode 100644 index 37a7e50207..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip-content/ods-tooltip-content.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { OdsTooltipContentAttributes } from './ods-tooltip-content-attributes'; -import { OdsTooltipContentController } from './ods-tooltip-content-controller'; -import { OdsTooltipContentEvents } from './ods-tooltip-content-events'; -import { OdsTooltipContentMethods } from './ods-tooltip-content-methods'; -import { OdsComponent } from '../../ods-component'; -import { OdsComponentGenericEvents } from '../../ods-component-generic-events'; -import { OdsComponentGenericMethods } from '../../ods-component-generic-methods'; - -/** - * interface description of all implementation of `ods-tooltip-content`. - * each implementation must have defined events, methods, attributes - * and one controller for the common behavior logic - */ -export type OdsTooltipContent = OdsComponentGenericMethods, - ComponentEvents extends OdsComponentGenericEvents = OdsComponentGenericEvents> = - OdsComponent; diff --git a/packages/libraries/core/src/components/tooltip/tooltip-content/public-api.ts b/packages/libraries/core/src/components/tooltip/tooltip-content/public-api.ts deleted file mode 100644 index b8b0be598e..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip-content/public-api.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './ods-tooltip-content'; -export * from './ods-tooltip-content-attributes'; -export * from './ods-tooltip-content-controller'; -export * from './ods-tooltip-content-default-attributes'; -export * from './ods-tooltip-content-events'; -export * from './ods-tooltip-content-methods'; diff --git a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-attributes.ts b/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-attributes.ts deleted file mode 100644 index c5f5fe7992..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-attributes.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { OdsComponentAttributes } from '../../ods-component-attributes'; -import { OdsTooltipVariant } from './ods-tooltip-variant'; - -export interface OdsTooltipAttributes extends OdsComponentAttributes { - /** with or without visible tip: see component principles */ - variant?: OdsTooltipVariant; -} diff --git a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-behavior.ts b/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-behavior.ts deleted file mode 100644 index a7e8368ed6..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-behavior.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { OcdkSurface } from '@ovhcloud/ods-cdk'; -import { HTMLStencilElement } from '@stencil/core/internal'; - -export interface OdsTooltipBehavior { - anchor: HTMLDivElement; - el: HTMLStencilElement; - surface: OcdkSurface | undefined; - - handleMouseEnter(): void; - handleMouseLeave(): void; - handleTriggerBlur(): void; - handleTriggerClick(): void; - handleTriggerFocus(): void; - checkForClickOutside(event: { target: HTMLElement }): void; - syncReferences(): void; -} diff --git a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-default-attributes.ts b/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-default-attributes.ts deleted file mode 100644 index a2a715561d..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-default-attributes.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { OdsTooltipAttributes } from './ods-tooltip-attributes'; -import { OdsTooltipVariant } from './ods-tooltip-variant'; - -export const odsTooltipDefaultAttributesDoc = { - variant: OdsTooltipVariant.standard, -} as const; - -export const odsTooltipDefaultAttributes = odsTooltipDefaultAttributesDoc as OdsTooltipAttributes; diff --git a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-events.ts b/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-events.ts deleted file mode 100644 index 486513ef2a..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-events.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { OdsComponentEvents } from '../../ods-component-events'; - -export interface OdsTooltipEvents extends OdsComponentEvents { - // Events -} diff --git a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-methods.ts b/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-methods.ts deleted file mode 100644 index 8fad8063f2..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-methods.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { OdsComponentMethods } from '../../ods-component-methods'; - -export interface OdsTooltipMethods extends OdsComponentMethods { - /** - * Close the surface - */ - closeSurface() : void; - - /** - * set tab index on the component - */ - setTabindex(value: number): void; -} diff --git a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-variant.ts b/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-variant.ts deleted file mode 100644 index ef0b7b55ee..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip-variant.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum OdsTooltipVariant { - standard = 'standard', - tip = 'tip', -} - -export type OdsTooltipVariantUnion = `${OdsTooltipVariant}`; - -export const OdsTooltipVariantList = Object.keys(OdsTooltipVariant) - .map((key) => OdsTooltipVariant[key as OdsTooltipVariantUnion]); diff --git a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip.mock.ts b/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip.mock.ts deleted file mode 100644 index a1a3d822c1..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip.mock.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { OdsTooltip } from './ods-tooltip'; -import { OdsTooltipController } from './ods-tooltip-controller'; -import { OdsTooltipEvents } from './ods-tooltip-events'; -import { OdsTooltipMethods } from './ods-tooltip-methods'; -import { OcdkSurface } from '@ovhcloud/ods-cdk'; -import { HTMLStencilElement } from '@stencil/core/internal'; - -/** - * Mocked generic implementation that represents an `OdsTooltip`. - * it allows to test the controller with a stub implementation. - */ -export class OdsTooltipMock implements OdsTooltip { - anchor!: HTMLDivElement; - controller: OdsTooltipController = jest.fn() as unknown as OdsTooltipController; - el!: HTMLStencilElement; - surface: OcdkSurface | undefined = undefined; - - handleMouseEnter = jest.fn(); - handleMouseLeave = jest.fn(); - handleTriggerBlur = jest.fn(); - handleTriggerClick = jest.fn(); - handleTriggerFocus = jest.fn(); - checkForClickOutside = jest.fn(); - syncReferences = jest.fn(); - - closeSurface = jest.fn(); - setTabindex = jest.fn(); -} diff --git a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip.ts b/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip.ts deleted file mode 100644 index 52aaffd086..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip/ods-tooltip.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { OdsTooltipAttributes } from './ods-tooltip-attributes'; -import { OdsTooltipBehavior } from './ods-tooltip-behavior'; -import { OdsTooltipController } from './ods-tooltip-controller'; -import { OdsTooltipEvents } from './ods-tooltip-events'; -import { OdsTooltipMethods } from './ods-tooltip-methods'; -import { OdsComponent } from '../../ods-component'; -import { OdsComponentGenericEvents } from '../../ods-component-generic-events'; -import { OdsComponentGenericMethods } from '../../ods-component-generic-methods'; - -/** - * interface description of all implementation of `ods-tooltip`. - * each implementation must have defined events, methods, attributes - * and one controller for the common behavior logic - */ -export type OdsTooltip = OdsComponentGenericMethods, - ComponentEvents extends OdsComponentGenericEvents = OdsComponentGenericEvents> = - OdsComponent; diff --git a/packages/libraries/core/src/components/tooltip/tooltip/public-api.ts b/packages/libraries/core/src/components/tooltip/tooltip/public-api.ts deleted file mode 100644 index 9295b26578..0000000000 --- a/packages/libraries/core/src/components/tooltip/tooltip/public-api.ts +++ /dev/null @@ -1,8 +0,0 @@ -export * from './ods-tooltip'; -export * from './ods-tooltip-attributes'; -export * from './ods-tooltip-behavior'; -export * from './ods-tooltip-controller'; -export * from './ods-tooltip-default-attributes'; -export * from './ods-tooltip-events'; -export * from './ods-tooltip-methods'; -export * from './ods-tooltip-variant'; diff --git a/packages/libraries/testing/src/components/public-api.ts b/packages/libraries/testing/src/components/public-api.ts index 7ccac798c1..3001b6019f 100644 --- a/packages/libraries/testing/src/components/public-api.ts +++ b/packages/libraries/testing/src/components/public-api.ts @@ -21,4 +21,3 @@ export * from './skeleton/public-api'; export * from './switch/public-api'; export * from './tabs/public-api'; export * from './toggle/public-api'; -export * from './tooltip/public-api'; diff --git a/packages/libraries/testing/src/components/tooltip/public-api.ts b/packages/libraries/testing/src/components/tooltip/public-api.ts deleted file mode 100644 index f5d0a0a2f8..0000000000 --- a/packages/libraries/testing/src/components/tooltip/public-api.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './tooltip/public-api'; -export * from './tooltip-content/public-api'; diff --git a/packages/libraries/testing/src/components/tooltip/tooltip-content/ods-tooltip-content-base-attributes.ts b/packages/libraries/testing/src/components/tooltip/tooltip-content/ods-tooltip-content-base-attributes.ts deleted file mode 100644 index bd724dfad0..0000000000 --- a/packages/libraries/testing/src/components/tooltip/tooltip-content/ods-tooltip-content-base-attributes.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { OdsTooltipContentAttributes } from '@ovhcloud/ods-core'; - -/** - * Base attributes value - */ -export const odsTooltipContentBaseAttributes: OdsTooltipContentAttributes = { - -}; diff --git a/packages/libraries/testing/src/components/tooltip/tooltip-content/public-api.ts b/packages/libraries/testing/src/components/tooltip/tooltip-content/public-api.ts deleted file mode 100644 index 79ba6c9987..0000000000 --- a/packages/libraries/testing/src/components/tooltip/tooltip-content/public-api.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ods-tooltip-content-base-attributes'; diff --git a/packages/libraries/testing/src/components/tooltip/tooltip/ods-tooltip-base-attributes.ts b/packages/libraries/testing/src/components/tooltip/tooltip/ods-tooltip-base-attributes.ts deleted file mode 100644 index ba4fa39f93..0000000000 --- a/packages/libraries/testing/src/components/tooltip/tooltip/ods-tooltip-base-attributes.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { OdsTooltipAttributes } from '@ovhcloud/ods-core'; - -/** - * Base attributes value - */ -export const odsTooltipBaseAttributes: OdsTooltipAttributes = { - -}; diff --git a/packages/libraries/testing/src/components/tooltip/tooltip/public-api.ts b/packages/libraries/testing/src/components/tooltip/tooltip/public-api.ts deleted file mode 100644 index ce8dc04fc3..0000000000 --- a/packages/libraries/testing/src/components/tooltip/tooltip/public-api.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ods-tooltip-base-attributes'; diff --git a/packages/stencil/components/form-field/package.json b/packages/stencil/components/form-field/package.json index cc38bd69cc..ea2d669d42 100644 --- a/packages/stencil/components/form-field/package.json +++ b/packages/stencil/components/form-field/package.json @@ -41,6 +41,7 @@ "devDependencies": { "@ovhcloud/ods-component-link": "^15.0.1", "@ovhcloud/ods-component-textarea": "^15.0.1", + "@ovhcloud/ods-component-tooltip": "^15.0.1", "@ovhcloud/ods-stencil-component-dev": "^15.0.1" }, "publishConfig": { diff --git a/packages/stencil/components/form-field/src/global.dev.ts b/packages/stencil/components/form-field/src/global.dev.ts index c30fde36af..b49bf46d6d 100644 --- a/packages/stencil/components/form-field/src/global.dev.ts +++ b/packages/stencil/components/form-field/src/global.dev.ts @@ -15,7 +15,7 @@ import '@ovhcloud/ods-component-textarea'; // Top right slot dependencies import '@ovhcloud/ods-component-link'; -import '@ovhcloud/ods-stencil/components/tooltip'; +import '@ovhcloud/ods-component-tooltip'; // Other dependencies import '@ovhcloud/ods-component-text'; diff --git a/packages/stencil/components/form-field/src/global.test.ts b/packages/stencil/components/form-field/src/global.test.ts index 3bff4092d6..135d7c1559 100644 --- a/packages/stencil/components/form-field/src/global.test.ts +++ b/packages/stencil/components/form-field/src/global.test.ts @@ -13,7 +13,7 @@ import '@ovhcloud/ods-component-textarea'; // Top right slot dependencies import '@ovhcloud/ods-component-link'; -import '@ovhcloud/ods-stencil/components/tooltip'; +import '@ovhcloud/ods-component-tooltip'; // Other dependencies import '@ovhcloud/ods-component-text'; diff --git a/packages/stencil/components/pagination/package.json b/packages/stencil/components/pagination/package.json index bf70dcdaa4..07fef69b73 100644 --- a/packages/stencil/components/pagination/package.json +++ b/packages/stencil/components/pagination/package.json @@ -38,6 +38,7 @@ "@ovhcloud/ods-component-button": "^15.0.1", "@ovhcloud/ods-component-icon": "^15.0.1", "@ovhcloud/ods-component-text": "^15.0.1", + "@ovhcloud/ods-component-tooltip": "^15.0.1", "@ovhcloud/ods-stencil-component": "^15.0.1" }, "devDependencies": { diff --git a/packages/stencil/components/pagination/src/global.dev.ts b/packages/stencil/components/pagination/src/global.dev.ts index e64526a257..2c4bf9f289 100644 --- a/packages/stencil/components/pagination/src/global.dev.ts +++ b/packages/stencil/components/pagination/src/global.dev.ts @@ -11,7 +11,7 @@ import '@ovhcloud/ods-component-button'; import '@ovhcloud/ods-component-icon'; import '@ovhcloud/ods-stencil/components/select'; import '@ovhcloud/ods-component-text'; -import '@ovhcloud/ods-stencil/components/tooltip'; +import '@ovhcloud/ods-component-tooltip'; const logger = new OdsLogger('global-dev'); logger.log('init'); diff --git a/packages/stencil/components/pagination/src/global.test.ts b/packages/stencil/components/pagination/src/global.test.ts index a8526f65ea..f72fa2e2a9 100644 --- a/packages/stencil/components/pagination/src/global.test.ts +++ b/packages/stencil/components/pagination/src/global.test.ts @@ -9,4 +9,4 @@ import '@ovhcloud/ods-component-button'; import '@ovhcloud/ods-component-icon'; import '@ovhcloud/ods-stencil/components/select'; import '@ovhcloud/ods-component-text'; -import '@ovhcloud/ods-stencil/components/tooltip'; +import '@ovhcloud/ods-component-tooltip'; diff --git a/packages/stencil/components/stencil.config.ts b/packages/stencil/components/stencil.config.ts index 7502189989..b10ab479f2 100644 --- a/packages/stencil/components/stencil.config.ts +++ b/packages/stencil/components/stencil.config.ts @@ -44,6 +44,7 @@ const config: Config = { 'osds-text', 'osds-textarea', 'osds-tile', + 'osds-tooltip', ], }, vueOutput: { @@ -59,6 +60,7 @@ const config: Config = { 'osds-text', 'osds-textarea', 'osds-tile', + 'osds-tooltip', ], }, dev: { diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.e2e.ts b/packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.e2e.ts deleted file mode 100644 index e80bba59d5..0000000000 --- a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.e2e.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { E2EElement, E2EPage, newE2EPage } from '@stencil/core/testing'; -import { OdsTooltipContentAttributes, OdsComponentAttributes2StringAttributes, odsTooltipContentDefaultAttributes } from '@ovhcloud/ods-core'; -import { OdsCreateAttributes, OdsStringAttributes2Str, odsTooltipContentBaseAttributes } from '@ovhcloud/ods-testing'; - -describe('e2e:osds-tooltip-content', () => { - let page: E2EPage; - let el: E2EElement; - - async function setup({ attributes, html }: { attributes: Partial, html?: string }) { - const minimalAttributes: OdsTooltipContentAttributes = OdsCreateAttributes(attributes, odsTooltipContentBaseAttributes); - const stringAttributes = OdsComponentAttributes2StringAttributes(minimalAttributes, odsTooltipContentDefaultAttributes); - - page = await newE2EPage(); - await page.setContent(`${html}`); - await page.evaluate(() => document.body.style.setProperty('margin', '0px')); - - el = await page.find('osds-tooltip-content'); - } - - it('should render', async () => { - await setup({ attributes: {} }); - expect(el).not.toBeNull(); - expect(el).toHaveClass('hydrated'); - }); - - describe('default slot', () => { - it('should display a text', async () => { - const slot = 'Dummy text' - await setup({ attributes: {}, html: slot }); - expect(el.innerHTML).toBe(slot); - }) - }); -}); diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.spec.ts b/packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.spec.ts deleted file mode 100644 index 166b6c0dfb..0000000000 --- a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { - OdsTooltipContentAttributes, - OdsComponentAttributes2StringAttributes, - odsTooltipContentDefaultAttributes, -} from '@ovhcloud/ods-core'; -import { - OdsCreateAttributes, - OdsStringAttributes2Str, - odsTooltipContentBaseAttributes, -} from '@ovhcloud/ods-testing'; -import { SpecPage, newSpecPage } from '@stencil/core/testing'; -import { OsdsTooltipContent } from './osds-tooltip-content'; - -describe('spec:osds-tooltip-content', () => { - let page: SpecPage; - let root: HTMLElement | undefined; - let instance: OsdsTooltipContent; - - afterEach(() => { - jest.clearAllMocks(); - }); - - async function setup({ attributes = {} }: { attributes?: Partial } = {}) { - const minimalAttributes: OdsTooltipContentAttributes = OdsCreateAttributes(attributes, odsTooltipContentBaseAttributes); - const stringAttributes = OdsComponentAttributes2StringAttributes(minimalAttributes, odsTooltipContentDefaultAttributes); - - page = await newSpecPage({ - components: [OsdsTooltipContent], - html: `My Tooltip Content`, - }); - - root = page.root; - instance = page.rootInstance; - } - - it('should render', async () => { - await setup({}); - expect(root?.shadowRoot).toBeTruthy(); - expect(instance).toBeTruthy(); - }); -}); diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.tsx b/packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.tsx deleted file mode 100644 index f12db3269e..0000000000 --- a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/osds-tooltip-content.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Component, Element, Host, h } from '@stencil/core'; -import { - OdsTooltipContent, - OdsTooltipContentController, - OdsTooltipContentEvents, - OdsTooltipContentMethods, -} from '@ovhcloud/ods-core'; -import { OdsStencilEvents, OdsStencilMethods } from '@ovhcloud/ods-stencil/libraries/stencil-core'; - -/** - * @slot (tooltip-content) - The Tooltip content - */ -@Component({ - tag: 'osds-tooltip-content', - styleUrl: 'osds-tooltip-content.scss', - shadow: true -}) -export class OsdsTooltipContent implements OdsTooltipContent, OdsStencilEvents> { - controller: OdsTooltipContentController = new OdsTooltipContentController(this); - @Element() el!: HTMLElement; - - render() { - return ( - - - - ); - } -} diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/public-api.ts b/packages/stencil/components/tooltip/src/components/osds-tooltip-content/public-api.ts deleted file mode 100644 index bf92ca185c..0000000000 --- a/packages/stencil/components/tooltip/src/components/osds-tooltip-content/public-api.ts +++ /dev/null @@ -1 +0,0 @@ -export { OsdsTooltipContent } from './osds-tooltip-content' diff --git a/packages/stencil/components/tooltip/src/components/osds-tooltip/public-api.ts b/packages/stencil/components/tooltip/src/components/osds-tooltip/public-api.ts deleted file mode 100644 index 00890e82fa..0000000000 --- a/packages/stencil/components/tooltip/src/components/osds-tooltip/public-api.ts +++ /dev/null @@ -1 +0,0 @@ -export { OsdsTooltip } from './osds-tooltip' diff --git a/packages/stencil/components/tsconfig.components.dev.json b/packages/stencil/components/tsconfig.components.dev.json index f6b4c2d0c7..4f7c167205 100644 --- a/packages/stencil/components/tsconfig.components.dev.json +++ b/packages/stencil/components/tsconfig.components.dev.json @@ -35,7 +35,6 @@ "switch/src", "tabs/src", "toggle/src", - "tooltip/src", ], "exclude": [ "node_modules", diff --git a/packages/stencil/components/tsconfig.components.prod.json b/packages/stencil/components/tsconfig.components.prod.json index 70cd597319..7a368b1b74 100644 --- a/packages/stencil/components/tsconfig.components.prod.json +++ b/packages/stencil/components/tsconfig.components.prod.json @@ -36,7 +36,6 @@ "switch/src", "tabs/src", "toggle/src", - "tooltip/src", ], "exclude": [ "node_modules", diff --git a/packages/stencil/components/tsconfig.components.test.json b/packages/stencil/components/tsconfig.components.test.json index 2962c89ca7..8b96c7613d 100644 --- a/packages/stencil/components/tsconfig.components.test.json +++ b/packages/stencil/components/tsconfig.components.test.json @@ -35,7 +35,6 @@ "switch/src", "tabs/src", "toggle/src", - "tooltip/src", ], "exclude": [ "node_modules", diff --git a/packages/tools/storybook/stories/components/tooltip/tooltip.specifications.stories.mdx b/packages/tools/storybook/stories/components/tooltip/tooltip.specifications.stories.mdx index e2455ce28e..a4fd8ffc9b 100644 --- a/packages/tools/storybook/stories/components/tooltip/tooltip.specifications.stories.mdx +++ b/packages/tools/storybook/stories/components/tooltip/tooltip.specifications.stories.mdx @@ -1,5 +1,5 @@ import { Meta } from '@storybook/addon-docs'; -import SpecificationsTooltip from '@ovhcloud/ods-specifications/components/tooltip/specifications-tooltip.mdx'; +import SpecificationsTooltip from '@ovhcloud/ods-component-tooltip/documentation/specifications/specifications-tooltip.mdx'; import Notes from '../notes.mdx'; diff --git a/packages/tools/storybook/stories/components/tooltip/tooltip.web-component.stories.page.mdx b/packages/tools/storybook/stories/components/tooltip/tooltip.web-component.stories.page.mdx index e1ca90ed34..aea2e8b9b8 100644 --- a/packages/tools/storybook/stories/components/tooltip/tooltip.web-component.stories.page.mdx +++ b/packages/tools/storybook/stories/components/tooltip/tooltip.web-component.stories.page.mdx @@ -1,7 +1,6 @@ import { Canvas, Description, Meta, DocsContainer } from '@storybook/addon-docs'; - -import Usage from '@ovhcloud/ods-stencil-tooltip/src/docs/osds-tooltip/usage.mdx'; -import APITable from '@ovhcloud/ods-stencil-tooltip/dist/docs/components/osds-tooltip/readme.md'; +import APITable from '@ovhcloud/ods-component-tooltip/dist/docs/components/osds-tooltip/readme.md'; +import Usage from '@ovhcloud/ods-component-tooltip/src/docs/osds-tooltip/usage.mdx'; diff --git a/packages/tools/storybook/stories/components/tooltip/tooltip.web-components.stories.ts b/packages/tools/storybook/stories/components/tooltip/tooltip.web-components.stories.ts index 9a18c80af0..7d3a7e355d 100644 --- a/packages/tools/storybook/stories/components/tooltip/tooltip.web-components.stories.ts +++ b/packages/tools/storybook/stories/components/tooltip/tooltip.web-components.stories.ts @@ -1,13 +1,10 @@ import { html } from 'lit-html'; -import { iframe } from '../../../.storybook/iframe'; -import { defineCustomElements } from '@ovhcloud/ods-stencil-tooltip/loader'; -import { - extractArgTypes, - extractStoryParams, - getTagAttributes, -} from '../../../core/componentHTMLUtils'; -import { OdsTooltipVariant, OdsTooltipVariantList } from '@ovhcloud/ods-core'; -import changelog from '@ovhcloud/ods-stencil-tooltip/CHANGELOG.md'; +import { ODS_TOOLTIP_VARIANT, ODS_TOOLTIP_VARIANTS } from '@ovhcloud/ods-component-tooltip'; +import { defineCustomElements } from '@ovhcloud/ods-component-tooltip/loader'; +import { extractArgTypes, extractStoryParams, getTagAttributes } from '../../../core/componentHTMLUtils'; +// @ts-ignore +import changelog from '@ovhcloud/ods-component-tooltip/CHANGELOG.md'; +// @ts-ignore import page from './tooltip.web-component.stories.page.mdx'; defineCustomElements(); @@ -17,8 +14,8 @@ const storyParams = { variant: { category: 'General', control: { type: 'select' }, - defaultValue: OdsTooltipVariant.standard, - options: OdsTooltipVariantList, + defaultValue: ODS_TOOLTIP_VARIANT.standard, + options: ODS_TOOLTIP_VARIANTS, }, content: { category: 'General', @@ -31,7 +28,6 @@ export default { id: 'tooltip', parameters: { notes: { - API: iframe('/stencil-tooltip/modules/index.html'), changelog, }, docs: { page } @@ -51,6 +47,7 @@ const TemplateDefault = (args:any) => { `; } export const Default = TemplateDefault.bind({}); +// @ts-ignore Default.args = { ...extractStoryParams(storyParams), }; diff --git a/scripts/testing-report/index.html b/scripts/testing-report/index.html index 63d0e45119..f636fb5543 100644 --- a/scripts/testing-report/index.html +++ b/scripts/testing-report/index.html @@ -133,7 +133,7 @@ {name: 'osds-textarea', id: 'textarea', newArch: true}, {name: 'osds-tile', id: 'tile', newArch: true}, {name: 'osds-toggle', id: 'toggle'}, - {name: 'osds-tooltip', id: 'tooltip'}, + {name: 'osds-tooltip', id: 'tooltip', newArch: true}, ].map((componentDef) => { return `
  • diff --git a/yarn.lock b/yarn.lock index 98dc980606..127a39ff9b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5847,6 +5847,43 @@ __metadata: languageName: unknown linkType: soft +"@ovhcloud/ods-component-tooltip-react@workspace:packages-new/components/tooltip/react": + version: 0.0.0-use.local + resolution: "@ovhcloud/ods-component-tooltip-react@workspace:packages-new/components/tooltip/react" + dependencies: + "@ovhcloud/ods-component-tooltip": ^15.0.1 + "@ovhcloud/ods-react-dev": ^15.0.1 + peerDependencies: + react: ">=16.8.6" + react-dom: ">=16.8.6" + languageName: unknown + linkType: soft + +"@ovhcloud/ods-component-tooltip-vue@workspace:packages-new/components/tooltip/vue": + version: 0.0.0-use.local + resolution: "@ovhcloud/ods-component-tooltip-vue@workspace:packages-new/components/tooltip/vue" + dependencies: + "@ovhcloud/ods-component-tooltip": ^15.0.1 + "@ovhcloud/ods-vue-dev": ^15.0.1 + peerDependencies: + vue: ">=3" + languageName: unknown + linkType: soft + +"@ovhcloud/ods-component-tooltip@^15.0.1, @ovhcloud/ods-component-tooltip@workspace:packages-new/components/tooltip": + version: 0.0.0-use.local + resolution: "@ovhcloud/ods-component-tooltip@workspace:packages-new/components/tooltip" + dependencies: + "@ovhcloud/ods-common-core": ^15.0.1 + "@ovhcloud/ods-common-stencil": ^15.0.1 + "@ovhcloud/ods-common-testing": ^15.0.1 + "@ovhcloud/ods-component-icon": ^15.0.1 + "@ovhcloud/ods-component-text": ^15.0.1 + "@ovhcloud/ods-stencil-dev": ^15.0.1 + "@ovhcloud/ods-theming": ^15.0.1 + languageName: unknown + linkType: soft + "@ovhcloud/ods-components@^15.0.1, @ovhcloud/ods-components@workspace:packages-new/components": version: 0.0.0-use.local resolution: "@ovhcloud/ods-components@workspace:packages-new/components" @@ -5860,6 +5897,7 @@ __metadata: "@ovhcloud/ods-component-text": ^15.0.1 "@ovhcloud/ods-component-textarea": ^15.0.1 "@ovhcloud/ods-component-tile": ^15.0.1 + "@ovhcloud/ods-component-tooltip": ^15.0.1 "@ovhcloud/ods-dev": ^15.0.1 languageName: unknown linkType: soft @@ -6545,6 +6583,7 @@ __metadata: "@ovhcloud/ods-component-link": ^15.0.1 "@ovhcloud/ods-component-text": ^15.0.1 "@ovhcloud/ods-component-textarea": ^15.0.1 + "@ovhcloud/ods-component-tooltip": ^15.0.1 "@ovhcloud/ods-stencil-component": ^15.0.1 "@ovhcloud/ods-stencil-component-dev": ^15.0.1 languageName: unknown @@ -6711,6 +6750,7 @@ __metadata: "@ovhcloud/ods-component-button": ^15.0.1 "@ovhcloud/ods-component-icon": ^15.0.1 "@ovhcloud/ods-component-text": ^15.0.1 + "@ovhcloud/ods-component-tooltip": ^15.0.1 "@ovhcloud/ods-stencil-component": ^15.0.1 "@ovhcloud/ods-stencil-component-dev": ^15.0.1 languageName: unknown @@ -7256,47 +7296,6 @@ __metadata: languageName: unknown linkType: soft -"@ovhcloud/ods-stencil-tooltip-react@workspace:packages/stencil/components/tooltip/react": - version: 0.0.0-use.local - resolution: "@ovhcloud/ods-stencil-tooltip-react@workspace:packages/stencil/components/tooltip/react" - dependencies: - "@ovhcloud/ods-stencil-tooltip": ^15.0.1 - "@types/react": 17.0.37 - "@types/react-dom": 17.0.11 - react: 16.14.0 - react-dom: 16.14.0 - rimraf: ^3.0.2 - tslib: "*" - typescript: 4.7.4 - peerDependencies: - react: ">=16.8.6" - react-dom: ">=16.8.6" - languageName: unknown - linkType: soft - -"@ovhcloud/ods-stencil-tooltip-vue@workspace:packages/stencil/components/tooltip/vue": - version: 0.0.0-use.local - resolution: "@ovhcloud/ods-stencil-tooltip-vue@workspace:packages/stencil/components/tooltip/vue" - dependencies: - "@ovhcloud/ods-stencil-tooltip": ^15.0.1 - rimraf: ^3.0.2 - typescript: 4.7.4 - vue: ^3.2.41 - peerDependencies: - vue: ">=3" - languageName: unknown - linkType: soft - -"@ovhcloud/ods-stencil-tooltip@^15.0.1, @ovhcloud/ods-stencil-tooltip@workspace:packages/stencil/components/tooltip": - version: 0.0.0-use.local - resolution: "@ovhcloud/ods-stencil-tooltip@workspace:packages/stencil/components/tooltip" - dependencies: - "@ovhcloud/ods-component-text": ^15.0.1 - "@ovhcloud/ods-stencil-component": ^15.0.1 - "@ovhcloud/ods-stencil-component-dev": ^15.0.1 - languageName: unknown - linkType: soft - "@ovhcloud/ods-stencil@^15.0.1, @ovhcloud/ods-stencil@workspace:packages/stencil": version: 0.0.0-use.local resolution: "@ovhcloud/ods-stencil@workspace:packages/stencil"