diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index 88155ca4e6..0000000000
--- a/.eslintignore
+++ /dev/null
@@ -1,6 +0,0 @@
-dist/
-tools/generate-component/boilerplate/
-**/__snapshots__/
-
-# not ignored folders/files
-!.github/
diff --git a/.eslintrc.json b/.eslintrc.json
deleted file mode 100644
index 72a37f9ac2..0000000000
--- a/.eslintrc.json
+++ /dev/null
@@ -1,132 +0,0 @@
-{
- "root": true,
- "env": {
- "browser": true,
- "es2020": true,
- "node": true
- },
- "extends": ["eslint:recommended"],
- "ignorePatterns": ["**/*.chromatic.stories.*"],
- "parser": "@typescript-eslint/parser",
- "parserOptions": {
- "ecmaVersion": 2020
- },
- "overrides": [
- {
- "files": ["*.js"],
- "extends": ["prettier"],
- "rules": {
- "no-unused-vars": [
- "error",
- {
- "vars": "all",
- "varsIgnorePattern": "h"
- }
- ]
- }
- },
- {
- "files": ["*.ts"],
- "extends": [
- "plugin:@typescript-eslint/recommended",
- "plugin:import/recommended",
- "plugin:import/typescript",
- "plugin:lit/recommended",
- "plugin:lyne/all",
- "prettier"
- ],
- "rules": {
- "@typescript-eslint/array-type": "error",
- "@typescript-eslint/consistent-type-imports": "error",
- "@typescript-eslint/explicit-function-return-type": ["warn", { "allowExpressions": true }],
- "@typescript-eslint/explicit-member-accessibility": "error",
- "@typescript-eslint/naming-convention": [
- "error",
- {
- "format": ["PascalCase"],
- "selector": "interface"
- },
- {
- "format": ["camelCase"],
- "selector": "default"
- },
- {
- "format": ["camelCase", "UPPER_CASE"],
- "selector": "variable"
- },
- {
- "format": ["camelCase"],
- "leadingUnderscore": "allow",
- "selector": "parameter"
- },
- {
- "format": ["camelCase"],
- "leadingUnderscore": "require",
- "modifiers": ["private"],
- "selector": "memberLike"
- },
- {
- "format": ["PascalCase"],
- "selector": "typeLike"
- },
- {
- "format": null,
- "selector": "objectLiteralProperty"
- }
- ],
- // TODO: Remove this after fixing issues
- "@typescript-eslint/no-explicit-any": "off",
- "@typescript-eslint/no-unused-vars": [
- "error",
- {
- "args": "all",
- "argsIgnorePattern": "^_"
- }
- ],
- "@typescript-eslint/no-use-before-define": "error",
- // TODO: Remove this after fixing issues
- "@typescript-eslint/no-var-requires": "off",
- // TODO: Evaluate this rule
- "@typescript-eslint/semi": "error",
-
- "import/first": "error",
- "import/no-absolute-path": "error",
- "import/no-cycle": "error",
- "import/no-self-import": "error",
- "import/no-unresolved": [
- "error",
- {
- "ignore": [
- "\\.md\\?raw$",
- "\\.svg\\?raw$",
- "\\.scss\\?lit\\&inline",
- // Broken. Maybe due to commonjs?
- "@storybook/addon-actions/decorator"
- ]
- }
- ],
- "import/no-useless-path-segments": "error",
- "import/order": [
- "error",
- {
- "alphabetize": { "order": "asc", "caseInsensitive": true },
- "newlines-between": "always"
- }
- ],
- // TODO Discuss this with the team
- "lit/no-invalid-html": "off",
- "camelcase": "off"
- }
- },
- {
- "files": ["*.yaml", "*.yml"],
- "plugins": ["yaml"]
- },
- {
- "files": ["*.stories.ts"],
- "rules": {
- "@typescript-eslint/naming-convention": "off"
- }
- }
- ]
-}
diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml
index 1f7b203056..a9bcad9d01 100644
--- a/.github/ISSUE_TEMPLATE/bug-report.yml
+++ b/.github/ISSUE_TEMPLATE/bug-report.yml
@@ -15,9 +15,9 @@ body:
attributes:
label: Preflight Checklist
options:
- - label: I have read the [Contributing Guidelines](https://github.com/lyne-design-system/lyne-components/blob/main/CONTRIBUTING.md) for this project.
+ - label: I have read the [Contributing Guidelines](https://github.com/lyne-design-system/lyne-components/blob/main/docs/CONTRIBUTING.md) for this project.
required: true
- - label: I agree to follow the [Code of Conduct](https://github.com/lyne-design-system/lyne-components/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
+ - label: I agree to follow the [Code of Conduct](https://github.com/lyne-design-system/lyne-components/blob/main/docs/CODE_OF_CONDUCT.md) that this project adheres to.
required: true
- label: I have searched the [issue tracker](https://github.com/orgs/lyne-design-system/projects/4) for an issue that matches the one I want to file, without success.
required: true
@@ -30,11 +30,11 @@ body:
attributes:
label: Bug type
options:
- - 'Functionality'
- - 'Accessibility'
- - 'Performance'
- - 'Security vulnerability'
- - 'Other'
+ - Functionality
+ - Accessibility
+ - Performance
+ - Security vulnerability
+ - Other
validations:
required: true
- type: dropdown
@@ -42,10 +42,10 @@ body:
attributes:
label: It affects the following packages
options:
- - 'Design Tokens'
- - 'Components'
- - 'Both'
- - 'Other'
+ - Design Tokens
+ - Components
+ - Both
+ - Other
validations:
required: true
- type: input
@@ -78,9 +78,9 @@ body:
attributes:
label: Input mode
options:
- - 'Mouse/Keyboard'
- - 'Touch'
- - 'Other'
+ - Mouse/Keyboard
+ - Touch
+ - Other
validations:
required: false
- type: input
diff --git a/.github/ISSUE_TEMPLATE/contributing-request.yml b/.github/ISSUE_TEMPLATE/contributing-request.yml
index 656e4f12fd..8a2c2b2129 100644
--- a/.github/ISSUE_TEMPLATE/contributing-request.yml
+++ b/.github/ISSUE_TEMPLATE/contributing-request.yml
@@ -10,9 +10,9 @@ body:
attributes:
label: Preflight Checklist
options:
- - label: I have read the [Contributing Guidelines](https://github.com/lyne-design-system/lyne-components/blob/main/CONTRIBUTING.md) for this project.
+ - label: I have read the [Contributing Guidelines](https://github.com/lyne-design-system/lyne-components/blob/main/docs/CONTRIBUTING.md) for this project.
required: true
- - label: I agree to follow the [Code of Conduct](https://github.com/lyne-design-system/lyne-components/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
+ - label: I agree to follow the [Code of Conduct](https://github.com/lyne-design-system/lyne-components/blob/main/docs/CODE_OF_CONDUCT.md) that this project adheres to.
required: true
- label: I have searched the [issue tracker](https://github.com/orgs/lyne-design-system/projects/4) for an issue that matches the one I want to file, without success.
required: true
@@ -25,8 +25,8 @@ body:
attributes:
label: Contribution type
options:
- - 'Contribute a new component'
- - 'Contribute an enhancement of a component'
+ - Contribute a new component
+ - Contribute an enhancement of a component
validations:
required: true
- type: dropdown
@@ -34,10 +34,10 @@ body:
attributes:
label: It affects the following packages
options:
- - 'Design Tokens'
- - 'Components'
+ - Design Tokens
+ - Components
- 'Design Tokens & Components'
- - 'Other'
+ - Other
validations:
required: true
- type: textarea
diff --git a/.github/ISSUE_TEMPLATE/feature-request-or-enhancement.yml b/.github/ISSUE_TEMPLATE/feature-request-or-enhancement.yml
index 6e96309805..4a8e3ee19f 100644
--- a/.github/ISSUE_TEMPLATE/feature-request-or-enhancement.yml
+++ b/.github/ISSUE_TEMPLATE/feature-request-or-enhancement.yml
@@ -10,9 +10,9 @@ body:
attributes:
label: Preflight Checklist
options:
- - label: I have read the [Contributing Guidelines](https://github.com/lyne-design-system/lyne-components/blob/main/CONTRIBUTING.md) for this project.
+ - label: I have read the [Contributing Guidelines](https://github.com/lyne-design-system/lyne-components/blob/main/docs/CONTRIBUTING.md) for this project.
required: true
- - label: I agree to follow the [Code of Conduct](https://github.com/lyne-design-system/lyne-components/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
+ - label: I agree to follow the [Code of Conduct](https://github.com/lyne-design-system/lyne-components/blob/main/docs/CODE_OF_CONDUCT.md) that this project adheres to.
required: true
- label: I have searched the [issue tracker](https://github.com/orgs/lyne-design-system/projects/4) for an issue that matches the one I want to file, without success.
required: true
@@ -25,8 +25,8 @@ body:
attributes:
label: Request type
options:
- - 'Request for a new component'
- - 'Request for enhancement of a component'
+ - Request for a new component
+ - Request for enhancement of a component
validations:
required: true
- type: dropdown
@@ -34,10 +34,10 @@ body:
attributes:
label: It affects the following packages
options:
- - 'Design Tokens'
- - 'Components'
+ - Design Tokens
+ - Components
- 'Design Tokens & Components'
- - 'Other'
+ - Other
validations:
required: true
- type: textarea
diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml
index 4e94fd1545..6d6443291f 100644
--- a/.github/ISSUE_TEMPLATE/question.yml
+++ b/.github/ISSUE_TEMPLATE/question.yml
@@ -10,9 +10,9 @@ body:
attributes:
label: Preflight Checklist
options:
- - label: I have read the [Contributing Guidelines](https://github.com/lyne-design-system/lyne-components/blob/main/CONTRIBUTING.md) for this project.
+ - label: I have read the [Contributing Guidelines](https://github.com/lyne-design-system/lyne-components/blob/main/docs/CONTRIBUTING.md) for this project.
required: true
- - label: I agree to follow the [Code of Conduct](https://github.com/lyne-design-system/lyne-components/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
+ - label: I agree to follow the [Code of Conduct](https://github.com/lyne-design-system/lyne-components/blob/main/docs/CODE_OF_CONDUCT.md) that this project adheres to.
required: true
- label: I have searched the [issue tracker](https://github.com/orgs/lyne-design-system/projects/4) for an issue that matches the one I want to file, without success.
required: true
@@ -25,10 +25,10 @@ body:
attributes:
label: It affects the following packages
options:
- - 'Design Tokens'
- - 'Components'
+ - Design Tokens
+ - Components
- 'Design Tokens & Components'
- - 'Other'
+ - Other
validations:
required: true
- type: input
diff --git a/.github/ISSUE_TEMPLATE/story.yml b/.github/ISSUE_TEMPLATE/story.yml
index 546f5d2d44..3a29b83af5 100644
--- a/.github/ISSUE_TEMPLATE/story.yml
+++ b/.github/ISSUE_TEMPLATE/story.yml
@@ -1,7 +1,7 @@
name: '[Internal] Story'
description: An internal story for lyne-components
title: 'story(COMPONENT): TITLE'
-labels: ['story', 'to-refine']
+labels: [story, to-refine]
body:
- type: textarea
id: description
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 1c376c50bf..af6a71f28a 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -2,8 +2,8 @@
-- [ ] I have read the [Contributing Guidelines](https://github.com/lyne-design-system/lyne-components/blob/main/CONTRIBUTING.md) for this project.
-- [ ] I agree to follow the [Code of Conduct](https://github.com/lyne-design-system/lyne-components/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
+- [ ] I have read the [Contributing Guidelines](https://github.com/lyne-design-system/lyne-components/blob/main/docs/CONTRIBUTING.md) for this project.
+- [ ] I agree to follow the [Code of Conduct](https://github.com/lyne-design-system/lyne-components/blob/main/docs/CODE_OF_CONDUCT.md) that this project adheres to.
- [ ] I have searched the [pull request tracker](https://github.com/lyne-design-system/lyne-components/pulls) for a Pull Request (PR) that matches the one I want to submit, without success.
## Issue
@@ -17,7 +17,7 @@ Please check if your PR fulfills the following requirements:
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)
-See [Review Guidelines](../REVIEW.md) for more information what is checked during review process.
+See [Review Guidelines](../docs/REVIEW.md) for more information what is checked during review process.
## Changes
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 1e3d5bd69a..5ba4456c20 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -9,7 +9,7 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
-name: 'CodeQL'
+name: CodeQL
on:
push:
@@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- language: ['javascript']
+ language: [javascript]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
@@ -63,7 +63,7 @@ jobs:
# and modify them (or add more) to build your code if your project
# uses a compiled language
- #- run: |
+ # - run: |
# make bootstrap
# make release
diff --git a/.github/workflows/continuous-integration-secure.yml b/.github/workflows/continuous-integration-secure.yml
index 59f75244fe..13262d420b 100644
--- a/.github/workflows/continuous-integration-secure.yml
+++ b/.github/workflows/continuous-integration-secure.yml
@@ -5,7 +5,7 @@ name: Continuous Integration Secure
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
on:
workflow_run:
- workflows: ['Continuous Integration']
+ workflows: [Continuous Integration]
types: [completed]
permissions:
@@ -73,7 +73,7 @@ jobs:
# This label is used for filtering deployments in ArgoCD
uses: actions-ecosystem/action-add-labels@v1
with:
- labels: 'preview-available'
+ labels: preview-available
number: ${{ env.PR_NUMBER }}
codecov:
diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml
index 4ce6272a57..2beaf55455 100644
--- a/.github/workflows/continuous-integration.yml
+++ b/.github/workflows/continuous-integration.yml
@@ -14,8 +14,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
- node-version-file: '.nvmrc'
- cache: 'yarn'
+ node-version-file: .nvmrc
+ cache: yarn
- run: yarn install --frozen-lockfile --non-interactive
- name: Run eslint
@@ -27,8 +27,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
- node-version-file: '.nvmrc'
- cache: 'yarn'
+ node-version-file: .nvmrc
+ cache: yarn
- run: yarn install --frozen-lockfile --non-interactive
- name: 'Integrity: Verify workspace integrity'
@@ -42,8 +42,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
- node-version-file: '.nvmrc'
- cache: 'yarn'
+ node-version-file: .nvmrc
+ cache: yarn
- run: yarn install --frozen-lockfile --non-interactive
- name: Install browser dependencies
@@ -52,7 +52,7 @@ jobs:
run: yarn test
env:
NODE_ENV: production
- - name: 'Assert no new snapshots (run `yarn test --ci` if this fails)'
+ - name: Assert no new snapshots (run `yarn test --ci` if this fails)
run: git diff --exit-code
- name: Store coverage
if: github.event_name == 'pull_request'
@@ -67,8 +67,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
- node-version-file: '.nvmrc'
- cache: 'yarn'
+ node-version-file: .nvmrc
+ cache: yarn
- run: yarn install --frozen-lockfile --non-interactive
- name: Run build
@@ -124,8 +124,8 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
- node-version-file: '.nvmrc'
- cache: 'yarn'
+ node-version-file: .nvmrc
+ cache: yarn
- run: yarn install --frozen-lockfile --non-interactive
- name: Generate chromatic stories
run: yarn generate:chromatic-stories
diff --git a/.github/workflows/pr-title-lint.yml b/.github/workflows/pr-title-lint.yml
index 899464c057..0df1b2d696 100644
--- a/.github/workflows/pr-title-lint.yml
+++ b/.github/workflows/pr-title-lint.yml
@@ -12,8 +12,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
- node-version-file: '.nvmrc'
- cache: 'yarn'
+ node-version-file: .nvmrc
+ cache: yarn
- run: yarn install --frozen-lockfile --non-interactive
- name: 'Lint: Pull request title'
diff --git a/.github/workflows/preview-image-cleanup.yml b/.github/workflows/preview-image-cleanup.yml
index 2fc3e88cf7..3a9a8df931 100644
--- a/.github/workflows/preview-image-cleanup.yml
+++ b/.github/workflows/preview-image-cleanup.yml
@@ -56,6 +56,6 @@ jobs:
}
- uses: actions/delete-package-versions@v4
with:
- package-name: 'lyne-components/storybook-preview'
- package-type: 'container'
+ package-name: lyne-components/storybook-preview
+ package-type: container
delete-only-untagged-versions: 'true'
diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml
index edc545ff6b..21720da636 100644
--- a/.github/workflows/release-please.yml
+++ b/.github/workflows/release-please.yml
@@ -43,8 +43,8 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
- node-version-file: '.nvmrc'
- cache: 'yarn'
+ node-version-file: .nvmrc
+ cache: yarn
registry-url: 'https://registry.npmjs.org'
scope: sbb-esta
- run: yarn install --frozen-lockfile --non-interactive
@@ -106,8 +106,8 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
- node-version-file: '.nvmrc'
- cache: 'yarn'
+ node-version-file: .nvmrc
+ cache: yarn
- run: yarn install --frozen-lockfile --non-interactive
- name: Run build
diff --git a/.storybook/main.ts b/.storybook/main.ts
index 58377756ca..3def8b8f00 100644
--- a/.storybook/main.ts
+++ b/.storybook/main.ts
@@ -18,7 +18,7 @@ const config: StorybookConfig = {
sourcemap: false,
rollupOptions: {
output: {
- manualChunks(id) {
+ manualChunks(_id) {
return 'main';
},
},
diff --git a/.storybook/manager.js b/.storybook/manager.js
index 4f0c473d27..2367745518 100644
--- a/.storybook/manager.js
+++ b/.storybook/manager.js
@@ -1,5 +1,5 @@
import { addons } from '@storybook/manager-api';
-import theme from './theme';
+import theme from './theme.js';
addons.setConfig({
enableShortcuts: false,
diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html
index 23e3aa0b37..19cce4138c 100644
--- a/.storybook/preview-head.html
+++ b/.storybook/preview-head.html
@@ -46,6 +46,10 @@
.sbdocs-content {
max-width: var(--sbb-breakpoint-medium-max) !important;
}
+
+ .sb-show-main.sb-main-padded {
+ padding: 2rem;
+ }
+```
+
+To dismiss the dialog, you need to get a reference to the `sbb-dialog` element and call
+the `close(result?: any, target?: HTMLElement)` method, which will close the dialog element and
+emit a close event with an optional result as a payload.
+
+The component can also be dismissed by clicking on the close button, clicking on the backdrop, pressing the `Esc` key,
+or, if an element within the `sbb-dialog` has the `sbb-dialog-close` attribute, by clicking on it.
+
+You can also set the property `backButton` on the `sbb-dialog-title` component to display the back button in the title section which will emit the event `requestBackAction` when clicked.
+
+## Style
+
+It's possible to display the component in `negative` variant using the self-named property.
+
+```html
+
+ Title
+ Dialog content.
+
+```
+
+## Accessibility
+
+When using a button to trigger the dialog, ensure to manage the appropriate ARIA attributes on the button element itself. This includes: `aria-haspopup="dialog"` that signals to assistive technologies that the button controls a dialog element,
+`aria-controls="dialog-id"` that connects the button to the dialog by referencing the dialog's ID. Consider using `aria-expanded` to indicate the dialog's current state (open or closed).
+
+The `sbb-dialog` component may visually hide the title thanks to the `hideOnScroll` property of the [sbb-dialog-title](/docs/components-sbb-dialog-sbb-dialog-title--docs) to create more space for content, this is useful especially on smaller screens. Screen readers and other assistive technologies will still have access to the title information for context.
+
+
+
+## Properties
+
+| Name | Attribute | Privacy | Type | Default | Description |
+| -------------------- | --------------------- | ------- | --------------------- | --------- | -------------------------------------------------------------------- |
+| `backdropAction` | `backdrop-action` | public | `'close' \| 'none'` | `'close'` | Backdrop click action. |
+| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the relevant nested element. |
+| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. |
+
+## Methods
+
+| Name | Privacy | Description | Parameters | Return | Inherited From |
+| ------- | ------- | -------------------------- | ---------------------------------- | ------ | -------------- |
+| `open` | public | Opens the dialog element. | | `void` | |
+| `close` | public | Closes the dialog element. | `result: any, target: HTMLElement` | `any` | |
+
+## Events
+
+| Name | Type | Description | Inherited From |
+| ----------- | ----------------------------------------- | ------------------------------------------------------------------------------- | -------------- |
+| `willOpen` | `CustomEvent` | Emits whenever the `sbb-dialog` starts the opening transition. Can be canceled. | |
+| `didOpen` | `CustomEvent` | Emits whenever the `sbb-dialog` is opened. | |
+| `willClose` | `CustomEvent` | Emits whenever the `sbb-dialog` begins the closing transition. Can be canceled. | |
+| `didClose` | `CustomEvent` | Emits whenever the `sbb-dialog` is closed. | |
+
+## CSS Properties
+
+| Name | Default | Description |
+| ---------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `--sbb-dialog-z-index` | `var(--sbb-overlay-default-z-index)` | To specify a custom stack order, the `z-index` can be overridden by defining this CSS variable. The default `z-index` of the component is set to `var(--sbb-overlay-default-z-index)` with a value of `1000`. |
+
+## Slots
+
+| Name | Description |
+| ---- | ---------------------------------------------------------------------------------------------------------------- |
+| | Use the unnamed slot to provide a `sbb-dialog-title`, `sbb-dialog-content` and an optional `sbb-dialog-actions`. |
diff --git a/src/components/dialog/index.ts b/src/components/dialog/index.ts
deleted file mode 100644
index 20da8e550a..0000000000
--- a/src/components/dialog/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './dialog';
diff --git a/src/components/dialog/readme.md b/src/components/dialog/readme.md
deleted file mode 100644
index 80c5831236..0000000000
--- a/src/components/dialog/readme.md
+++ /dev/null
@@ -1,125 +0,0 @@
-The `sbb-dialog` component provides a way to present content on top of the app's content.
-It offers the following features:
-
-- creates a backdrop for disabling interaction below the modal;
-- disables scrolling of the page content while open;
-- manages focus properly by setting it on the first focusable element;
-- can have a header and a footer, both of which are optional;
-- can host a [sbb-action-group](/docs/components-sbb-action-group--docs) component in the footer;
-- has a close button, which is always visible;
-- can display a back button next to the title;
-- adds the appropriate ARIA roles automatically.
-
-```html
- Dialog content.
-```
-
-## Slots
-
-The content is projected in an unnamed slot, while the dialog's title can be provided via the `titleContent` property or via slot `name="title"`.
-It's also possible to display buttons in the component's footer using the `action-group` slot with the `sbb-action-group` component.
-
-**NOTE**:
-
-- The component will automatically set size `m` on slotted `sbb-action-group`;
-- If the title is not present, the footer will not be displayed even if provided;
-- If the title is not present, the dialog will be displayed in fullscreen mode with the close button in the content section along with the back button
- (if visible, see [next paragraph](#interactions)).
-
-```html
- Dialog content.
-
-
- My dialog title
- Dialog content.
-
- Abort
- Confirm
-
-
-```
-
-## Interactions
-
-In order to show the dialog, you need to call the `open(event?: PointerEvent)` method on the `sbb-dialog` component.
-It is necessary to pass the event object to the `open()` method to allow the dialog to detect
-whether it has been opened by click or keyboard, so that the focus can be better handled.
-
-```html
-
-
- Dialog content.
-
...
-
-
-
-```
-
-To dismiss the dialog, you need to get a reference to the `sbb-dialog` element and call
-the `close(result?: any, target?: HTMLElement)` method, which will close the dialog element and
-emit a close event with an optional result as a payload.
-
-The component can also be dismissed by clicking on the close button, clicking on the backdrop, pressing the `Esc` key,
-or, if an element within the `sbb-dialog` has the `sbb-dialog-close` attribute, by clicking on it.
-
-You can also set the property `titleBackButton` to display the back button in the title section
-(or content section, if title is omitted) which will emit the event `requestBackAction` when clicked.
-
-## Style
-
-It's possible to display the component in `negative` variant using the self-named property.
-
-## Animation
-
-Add the `sbb-disable-animation` class to disable animation and transition effects for the element and all its children.
-
-
-
-## Properties
-
-| Name | Attribute | Privacy | Type | Default | Description |
-| ------------------------- | --------------------------- | ------- | ---------------------------- | --------- | ------------------------------------------------------------------------------- |
-| `titleContent` | `title-content` | public | `string \| undefined` | | Dialog title. |
-| `titleLevel` | `title-level` | public | `SbbTitleLevel` | `'1'` | Level of title, will be rendered as heading tag (e.g. h1). Defaults to level 1. |
-| `titleBackButton` | `title-back-button` | public | `boolean` | `false` | Whether a back button is displayed next to the title. |
-| `backdropAction` | `backdrop-action` | public | `'close' \| 'none'` | `'close'` | Backdrop click action. |
-| `accessibilityLabel` | `accessibility-label` | public | `string \| undefined` | | This will be forwarded as aria-label to the relevant nested element. |
-| `accessibilityCloseLabel` | `accessibility-close-label` | public | `\| string \| undefined` | | This will be forwarded as aria-label to the close button element. |
-| `accessibilityBackLabel` | `accessibility-back-label` | public | `\| string \| undefined` | | This will be forwarded as aria-label to the back button element. |
-| `negative` | `negative` | public | `boolean` | `false` | Negative coloring variant flag. |
-
-## Methods
-
-| Name | Privacy | Description | Parameters | Return | Inherited From |
-| ------- | ------- | -------------------------- | ---------------------------------- | ------ | -------------- |
-| `open` | public | Opens the dialog element. | | `void` | |
-| `close` | public | Closes the dialog element. | `result: any, target: HTMLElement` | `any` | |
-
-## Events
-
-| Name | Type | Description | Inherited From |
-| ------------------- | ------------------- | ------------------------------------------------------------------------------- | -------------- |
-| `willOpen` | `CustomEvent` | Emits whenever the `sbb-dialog` starts the opening transition. Can be canceled. | |
-| `didOpen` | `CustomEvent` | Emits whenever the `sbb-dialog` is opened. | |
-| `willClose` | `CustomEvent` | Emits whenever the `sbb-dialog` begins the closing transition. Can be canceled. | |
-| `didClose` | `CustomEvent` | Emits whenever the `sbb-dialog` is closed. | |
-| `requestBackAction` | `CustomEvent` | Emits whenever the back button is clicked. | |
-
-## CSS Properties
-
-| Name | Default | Description |
-| ---------------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `--sbb-dialog-z-index` | `var(--sbb-overlay-z-index)` | To specify a custom stack order, the `z-index` can be overridden by defining this CSS variable. The default `z-index` of the component is set to `var(--sbb-overlay-z-index)` with a value of `1000`. |
-
-## Slots
-
-| Name | Description |
-| -------------- | ------------------------------------------------------------ |
-| | Use the unnamed slot to add content to the `sbb-dialog`. |
-| `title` | Use this slot to provide a title. |
-| `action-group` | Use this slot to display a `sbb-action-group` in the footer. |
diff --git a/src/components/divider.ts b/src/components/divider.ts
new file mode 100644
index 0000000000..06ac499007
--- /dev/null
+++ b/src/components/divider.ts
@@ -0,0 +1 @@
+export * from './divider/divider.js';
diff --git a/src/components/divider/divider.e2e.ts b/src/components/divider/divider.e2e.ts
index be46dc95ba..bdddc72069 100644
--- a/src/components/divider/divider.e2e.ts
+++ b/src/components/divider/divider.e2e.ts
@@ -1,9 +1,9 @@
import { assert } from '@open-wc/testing';
import { html } from 'lit/static-html.js';
-import { fixture } from '../core/testing/private';
+import { fixture } from '../core/testing/private.js';
-import { SbbDividerElement } from './divider';
+import { SbbDividerElement } from './divider.js';
describe(`sbb-divider with ${fixture.name}`, () => {
it('renders', async () => {
diff --git a/src/components/divider/divider.scss b/src/components/divider/divider.scss
index b3c904b171..cdece11213 100644
--- a/src/components/divider/divider.scss
+++ b/src/components/divider/divider.scss
@@ -1,12 +1,13 @@
@use '../core/styles' as sbb;
-// Default component properties, defined for :host. Properties which can not
-// travel the shadow boundary are defined through this mixin
-@include sbb.host-component-properties;
+// Box-sizing rules contained in typography are not traversing Shadow DOM boundaries. We need to include box-sizing mixin in every component.
+@include sbb.box-sizing;
:host {
--sbb-divider-color: var(--sbb-color-cloud);
--sbb-divider-border-width: var(--sbb-border-width-1x);
+
+ display: block;
}
:host([orientation='vertical']) {
diff --git a/src/components/divider/divider.spec.ts b/src/components/divider/divider.spec.ts
index 849b39ef45..14e6cc5bf7 100644
--- a/src/components/divider/divider.spec.ts
+++ b/src/components/divider/divider.spec.ts
@@ -1,13 +1,16 @@
import { expect } from '@open-wc/testing';
import { html } from 'lit/static-html.js';
-import { fixture, testA11yTreeSnapshot } from '../core/testing/private';
+import { fixture, testA11yTreeSnapshot } from '../core/testing/private.js';
+import { waitForLitRender } from '../core/testing.js';
-import './divider';
+import type { SbbDividerElement } from './divider.js';
+
+import './divider.js';
describe(`sbb-divider`, () => {
it('should render with default values', async () => {
- const element: Element = await fixture(html``);
+ const element: SbbDividerElement = await fixture(html``);
expect(element).dom.to.be.equal(
``,
);
@@ -15,7 +18,7 @@ describe(`sbb-divider`, () => {
});
it('should render with orientation horizontal', async () => {
- const element: Element = await fixture(
+ const element: SbbDividerElement = await fixture(
html``,
);
expect(element).dom.to.be.equal(
@@ -25,7 +28,7 @@ describe(`sbb-divider`, () => {
});
it('should render with orientation vertical', async () => {
- const element: Element = await fixture(
+ const element: SbbDividerElement = await fixture(
html``,
);
expect(element).dom.to.be.equal(
@@ -34,5 +37,13 @@ describe(`sbb-divider`, () => {
expect(element).shadowDom.to.be.equal(``);
});
+ it('should react to change of orientation', async () => {
+ const element: SbbDividerElement = await fixture(html``);
+
+ element.orientation = 'vertical';
+ await waitForLitRender(element);
+ expect(element).to.have.attribute('aria-orientation', 'vertical');
+ });
+
testA11yTreeSnapshot(html``);
});
diff --git a/src/components/divider/divider.stories.ts b/src/components/divider/divider.stories.ts
index 801c25ed87..3e6d09d98d 100644
--- a/src/components/divider/divider.stories.ts
+++ b/src/components/divider/divider.stories.ts
@@ -4,16 +4,10 @@ import type { TemplateResult } from 'lit';
import { html } from 'lit';
import { styleMap } from 'lit/directives/style-map.js';
-import { sbbSpread } from '../core/dom';
+import { sbbSpread } from '../../storybook/helpers/spread.js';
import readme from './readme.md?raw';
-import './divider';
-
-const wrapperStyle = (context: StoryContext): Record => ({
- 'background-color': context.args.negative
- ? 'var(--sbb-color-charcoal)'
- : 'var(--sbb-color-white)',
-});
+import './divider.js';
const Template = (args: Args): TemplateResult => html`
`;
-/* end snapshot sbb-form-error A11y tree Chrome */
+/* end snapshot sbb-form-error renders A11y tree Chrome */
-snapshots["sbb-form-error A11y tree Firefox"] =
+snapshots["sbb-form-error renders A11y tree Firefox"] =
`