-
Notifications
You must be signed in to change notification settings - Fork 6
Feature/2725 callout develop component #2842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
76047b6
First version of a callout component
anna-lach 216b066
callout component changes
anna-lach 6f411e6
callout component changes, styling, two sizes, examples improvements
anna-lach 6df15a7
callout component changes, styling, some cleanup
anna-lach 7b6ae5e
unit tests
anna-lach 8b58503
changeset, callout added to chromatic
anna-lach 380ad1d
some fixes
anna-lach 7f30ae2
component's status updated
anna-lach 845bc8d
Update callout.stories.ts
anna-lach e0d701a
some changes after review
anna-lach a10c647
density instead of size
anna-lach 95227a5
cleanup
anna-lach 87b8e8f
Merge remote-tracking branch 'origin/main' into feature/2725-callout-…
anna-lach a84024d
Merge remote-tracking branch 'origin/main' into feature/2725-callout-…
anna-lach a3b4388
Merge remote-tracking branch 'origin/main' into feature/2725-callout-…
anna-lach 2043526
fixing imports
anna-lach 7c631f0
changes after review
anna-lach 84fdf72
changes after review
anna-lach 0e89969
callout density changes
anna-lach abb82d8
density for the panel changes
anna-lach 7844217
fixes the panel status on the website (draft instead of preview)
anna-lach bd0166c
deprecated density values description
anna-lach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@sl-design-system/panel': minor | ||
| --- | ||
|
|
||
| From now on, use `default` and `relaxed` for the `density` property. | ||
| The `plain` and `comfortable` values are deprecated, they will be kept for the backward compatibility for now but removed in the future. | ||
| Please use `default` or `relaxed` from now on. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@sl-design-system/callout': patch | ||
| --- | ||
|
|
||
| New `callout` component, visually similar to the `inline-message` but with a different purpose: | ||
| it can be used to provide additional, non-interrupting information and may include actions (e.g. buttons). | ||
| It must not be shown/hidden dynamically in response to user actions (unlike the `inline-message`). | ||
| There is no ARIA role on this component as it is not meant to interrupt the user (no live region). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './src/callout.js'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| { | ||
| "name": "@sl-design-system/callout", | ||
| "version": "0.0.1", | ||
| "description": "Callout component for the SL Design System", | ||
| "license": "Apache-2.0", | ||
| "publishConfig": { | ||
| "registry": "https://npm.pkg.github.com" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/sl-design-system/components.git", | ||
| "directory": "packages/components/callout" | ||
| }, | ||
| "homepage": "https://sanomalearning.design/components/callout", | ||
| "bugs": { | ||
| "url": "https://github.com/sl-design-system/components/issues" | ||
| }, | ||
| "type": "module", | ||
| "main": "./index.js", | ||
| "module": "./index.js", | ||
| "types": "./index.d.ts", | ||
| "customElements": "custom-elements.json", | ||
| "exports": { | ||
| ".": "./index.js", | ||
| "./package.json": "./package.json", | ||
| "./register.js": "./register.js" | ||
| }, | ||
| "files": [ | ||
| "**/*.d.ts", | ||
| "**/*.js", | ||
| "**/*.js.map", | ||
| "custom-elements.json" | ||
| ], | ||
| "sideEffects": [ | ||
| "register.js" | ||
| ], | ||
| "scripts": { | ||
| "test": "echo \"Error: run tests from monorepo root.\" && exit 1" | ||
| }, | ||
| "dependencies": { | ||
| "@sl-design-system/icon": "^1.3.0", | ||
| "@sl-design-system/shared": "^0.9.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@lit/localize": "^0.12.2", | ||
| "@open-wc/scoped-elements": "^3.0.6" | ||
| }, | ||
| "peerDependencies": { | ||
| "@lit/localize": "^0.12.1", | ||
| "@open-wc/scoped-elements": "^3.0.6" | ||
| } | ||
anna-lach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { Callout } from './src/callout.js'; | ||
|
|
||
| customElements.define('sl-callout', Callout); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| :host { | ||
| align-items: center; | ||
| background: var(--sl-color-background-info-subtlest); | ||
| border-radius: var(--sl-size-borderRadius-default); | ||
| color: var(--sl-color-foreground-info-bold); | ||
| display: grid; | ||
| gap: 0 var(--sl-size-100); | ||
| grid-template-columns: auto 1fr; | ||
| padding: var(--sl-size-150) var(--sl-size-200); | ||
| } | ||
|
|
||
| :host([density='relaxed']) { | ||
| padding: var(--sl-size-300); | ||
| } | ||
|
|
||
| :host([no-title]) { | ||
anna-lach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| [part='title'] { | ||
| display: none; | ||
| } | ||
|
|
||
| [part='content'] { | ||
| grid-area: 1 / 2; | ||
| } | ||
| } | ||
|
|
||
| :host([variant='positive']) { | ||
| background: var(--sl-color-background-positive-subtlest); | ||
| color: var(--sl-color-foreground-positive-bold); | ||
| } | ||
|
|
||
| :host([variant='negative']) { | ||
| background: var(--sl-color-background-negative-subtlest); | ||
| color: var(--sl-color-foreground-negative-bold); | ||
| } | ||
|
|
||
| :host([variant='caution']) { | ||
| background: var(--sl-color-background-caution-subtlest); | ||
| color: var(--sl-color-foreground-caution-bold); | ||
| } | ||
|
|
||
| [part='content'] { | ||
| grid-column: 2; | ||
|
|
||
| slot { | ||
| display: block; | ||
| text-wrap: pretty; | ||
| } | ||
| } | ||
|
|
||
| [part='content'] > * { | ||
| display: block; | ||
| } | ||
|
|
||
| [part='icon'] { | ||
| align-items: center; | ||
| align-self: start; | ||
| block-size: 1lh; | ||
| display: inline-flex; | ||
| } | ||
|
|
||
| [part='title'] { | ||
| align-self: start; | ||
| font-size: calc((16 / 14) * 1em); | ||
| font-weight: var(--sl-text-new-typeset-fontWeight-semiBold); | ||
| grid-area: 1 / 2; | ||
| margin-block-end: var(--sl-size-025); | ||
|
|
||
| slot { | ||
| display: block; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { fixture } from '@sl-design-system/vitest-browser-lit'; | ||
| import { html } from 'lit'; | ||
| import { beforeEach, describe, expect, it } from 'vitest'; | ||
| import '../register.js'; | ||
| import { Callout } from './callout.js'; | ||
|
|
||
| describe('sl-callout', () => { | ||
| let el: Callout; | ||
|
|
||
| describe('defaults', () => { | ||
| beforeEach(async () => { | ||
| el = await fixture(html`<sl-callout>Callout component</sl-callout>`); | ||
| }); | ||
|
|
||
| it('should not have an explicit density', () => { | ||
| expect(el).not.to.have.attribute('density'); | ||
| expect(el.density).to.be.undefined; | ||
| }); | ||
|
|
||
| it('should not have an explicit variant', () => { | ||
| expect(el).not.to.have.attribute('variant'); | ||
| expect(el.variant).to.be.undefined; | ||
| }); | ||
|
|
||
| it('should have positive variant when set', async () => { | ||
| el.variant = 'positive'; | ||
| await el.updateComplete; | ||
|
|
||
| expect(el).to.have.attribute('variant', 'positive'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('no title', () => { | ||
| beforeEach(async () => { | ||
| el = await fixture(html`<sl-callout>Callout component text</sl-callout>`); | ||
| }); | ||
|
|
||
| it('should not display a title', () => { | ||
| const title = el.renderRoot.querySelector('[part="title"]')!; | ||
|
|
||
| expect(title).to.exist; | ||
| expect(title).to.have.style('display', 'none'); | ||
| }); | ||
|
|
||
| it('should have the no-title attribute set', () => { | ||
| expect(el).to.have.attribute('no-title'); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.