Skip to content

Commit 47180b1

Browse files
committed
2 parents c732c9c + 3911965 commit 47180b1

39 files changed

+950
-212
lines changed

index.html

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ <h2>IconList</h2>
283283
<div class="d-flex-row">
284284
<sgds-icon-list size="sm">
285285
<div role="listitem">
286-
<sgds-icon name="placeholder" size="sm"></sgds-icon>item one
286+
<sgds-icon size="sm" name="placeholder"></sgds-icon>item one
287287
</div>
288288
<div role="listitem">
289289
<sgds-icon name="placeholder" size="sm"></sgds-icon>item one
@@ -471,7 +471,7 @@ <h3>Size</h3>
471471
</sgds-table>
472472
</div>
473473
<div class="container">
474-
<sgds-tab-group variant="tabs-info-toggle">
474+
<sgds-tab-group>
475475
<sgds-tab slot="nav" panel="apple">
476476
<sgds-icon slot="icon" name="map"></sgds-icon>
477477
<span slot="count">1</span>
@@ -489,7 +489,7 @@ <h3>Size</h3>
489489
<sgds-tab-panel name="banana">Banana</sgds-tab-panel>
490490
<sgds-tab-panel name="carrot">Carrot</sgds-tab-panel>
491491
</sgds-tab-group>
492-
<sgds-tab-group variant="tabs-basic-toggle">
492+
<sgds-tab-group>
493493
<sgds-tab slot="nav" panel="12">
494494
<sgds-icon slot="icon" name="map"></sgds-icon>
495495
<span>12</span>
@@ -1151,13 +1151,15 @@ <h3>Button Full Width</h3>
11511151
<h2>Close Button</h2>
11521152
<div class="row">
11531153
<sgds-close-button></sgds-close-button>
1154+
<sgds-close-button variant="light"></sgds-close-button>
1155+
<sgds-close-button variant="dark"></sgds-close-button>
11541156
<sgds-close-button size="sm"></sgds-close-button>
11551157
</div>
11561158
</div>
11571159
<div class="container">
11581160
<h2>Modal</h2>
11591161
<sgds-button id="modalShowButton">Open Modal</sgds-button>
1160-
<sgds-modal size="fullscreen">
1162+
<sgds-modal>
11611163
<h2 slot="title">Modal title</h2>
11621164
<p slot="description">Modal description</p>
11631165
<p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dictum est vitae erat molestie blandit. Pellentesque at nunc at mi auctor imperdiet eu at leo. Integer aliquam, turpis vel ultricies ornare, sem massa commodo velit, pretium dictum quam nibh et ex. Suspendisse eu dignissim libero. Donec aliquam, lacus eu pellentesque interdum, arcu nisl blandit turpis, at tincidunt purus orci ut dolor. Morbi malesuada faucibus lorem, ornare accumsan sapien lacinia vel. In enim justo, hendrerit eu mi vitae, viverra fringilla nunc. Proin semper nunc a mollis faucibus. Nam at arcu non justo congue tincidunt. Donec vehicula felis risus, et lobortis lacus fringilla eu. Proin faucibus, nisi non semper elementum, sapien nisi viverra urna, id tempus augue felis ac nibh. Nullam pulvinar magna eros. Vestibulum at orci elit. Sed convallis fermentum gravida.
@@ -1632,24 +1634,14 @@ <h2>Drawer</h2>
16321634
<sgds-button>Open Drawer</sgds-button>
16331635
</div>
16341636

1635-
<div class="container">
1637+
<div class="">
16361638
<h2>Tooltip</h2>
16371639
Hover me
16381640
<sgds-tooltip content="This is a tooltip" placement="top" trigger="hover">
1639-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle"
1640-
viewBox="0 0 16 16">
1641-
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
1642-
<path
1643-
d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
1644-
</svg>
1645-
</sgds-tooltip>
1641+
<sgds-icon name="plus"></sgds-icon>
1642+
</sgds-tooltip>
16461643
<sgds-tooltip content="This is a tooltip" placement="right" trigger="hover">
1647-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle"
1648-
viewBox="0 0 16 16">
1649-
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
1650-
<path
1651-
d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
1652-
</svg>
1644+
<sgds-icon name="plus"></sgds-icon>
16531645
</sgds-tooltip>
16541646
<sgds-tooltip content="This is a tooltip" placement="bottom" trigger="hover">
16551647
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle"

scripts/generateStories.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ${ArgsType.join('\n')}
8686
8787
${methodsMeta.map(meta => {
8888
if (meta.methods.length > 0){
89-
return `## Methods \n### ${meta.tagName}\n<table>
89+
return `## Methods \n ### ${meta.tagName}\n<table>
9090
<thead>
9191
<tr>
9292
<th>Name</th>

src/base/sgds-element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default class SgdsElement extends LitElement {
6262
// `Attempted to register <${name}>${newVersion}, but <${name}>${existingVersion} has already been registered.`
6363
// );
6464
}
65-
65+
/** @internal */
6666
static dependencies: Record<string, typeof SgdsElement> = {};
6767

6868
constructor() {

src/components/Breadcrumb/sgds-breadcrumb-item.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import { html } from "lit";
22
import { property } from "lit/decorators.js";
33
import SgdsLink from "../Link/sgds-link";
44
import breadcrumbItemStyle from "./breadcrumb-item.css";
5+
import SgdsElement from "../../base/sgds-element";
56
/**
67
* @summary Breadcrumb Item are navigational links used in Breadcrumb component
78
*
8-
* @slot default - The title of the item
9+
* @slot default - The link of the item. Pass in anchor tags into this slot
910
*/
10-
export class SgdsBreadcrumbItem extends SgdsLink {
11+
export class SgdsBreadcrumbItem extends SgdsElement {
1112
static styles = [...SgdsLink.styles, breadcrumbItemStyle];
12-
/** Specifies the url path of the breadcrumb-item. When defined, the breadcrumb-items is a anchor element. When not defined, indicates that the breadcrumb item is active. In such cases, a span element is rendered. */
13+
/** Indicates the link matches the current location of the page. Programmatically handled by SgdsBreadcrumb to set this prop to true for the last breadcrumb item */
1314
@property({ type: Boolean, reflect: true }) active = false;
1415

1516
render() {

src/components/DescriptionList/sgds-description-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let id = 0;
77

88
/**
99
*
10-
* @summary Description Lists are used with description list group as list components
10+
* @summary Description Lists are used with description list group as list components. A description list (often referred to as a “definition list”) is a type of list used in web design and documentation to pair terms with their corresponding descriptions or values.
1111
*
1212
* @slot default - The slot for the label
1313
* @slot data - The slot for the data

src/components/Icon/icon.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
:host {
22
color: inherit;
3+
display: inline-flex;
34
}
45
:host([size="sm"]) svg {
56
width: var(--sgds-icon-size-sm);
@@ -27,7 +28,7 @@
2728
}
2829

2930
svg {
30-
display: block;
31+
display: inline-block;
3132
width: var(--sgds-icon-size-lg);
3233
height: var(--sgds-icon-size-lg);
3334
}

src/components/Icon/sgds-icon.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import { unsafeSVG } from "lit/directives/unsafe-svg.js";
55
import iconStyles from "./icon.css";
66

77
/**
8-
* @summary Icons offer a form of visual shorthand that we are all familiar with. They can label, inform and aid navigation quickly and effectively in minimal space. Icons must first and foremost communicate meaning. By default, the icon component renders icons form SgdsIcon library set
9-
*
10-
* @event sgds-blur - Emitted when the button is blurred.
11-
* @event sgds-focus - Emitted when the button is focused.
8+
* @summary Icons offer a form of visual shorthand that we are all familiar with. They can label, inform and aid navigation quickly and effectively in minimal space. Icons must first and foremost communicate meaning. By default, the icon component renders icons from `SgdsIcon` library set
129
*/
1310
export class SgdsIcon extends SgdsElement {
1411
static styles = [...SgdsElement.styles, iconStyles];
@@ -25,14 +22,12 @@ export class SgdsIcon extends SgdsElement {
2522

2623
async updated(changedProperties: Map<string, any>) {
2724
if (changedProperties.has("name")) {
28-
await this.loadSvg(this.name);
25+
await this._loadSvg(this.name);
2926
}
30-
this.style.display = this._svgContent ? "" : "none";
3127
}
3228

33-
async loadSvg(name: string): Promise<void> {
29+
private async _loadSvg(name: string): Promise<void> {
3430
if (name) {
35-
// Dynamically import the SVG if not cached
3631
const pascalName = name
3732
.split("-")
3833
.map(name => String(name).charAt(0).toUpperCase() + String(name).slice(1))
@@ -43,7 +38,7 @@ export class SgdsIcon extends SgdsElement {
4338
if (svg) {
4439
this._svgContent = svg;
4540
} else {
46-
throw new Error("Icon `name` is undefined");
41+
throw new Error("icon `name` not found");
4742
}
4843
} catch (error) {
4944
console.error(`Unable to load icon: ${name}.`, error);

src/components/IconButton/icon-button.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
:host {
2+
display: inline-block;
3+
}
4+
15
.btn.btn-icon {
26
display: flex;
37
width: var(--sgds-dimension-48, 56px);

src/components/IconButton/sgds-icon-button.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import iconButtonStyles from "./icon-button.css";
99
/**
1010
* @summary An icon button is a user interface element that combines an icon and a button, serving as a clickable or tabbable component.
1111
*
12-
* @slot default - The slot for sgds-icon
13-
*
1412
* @event sgds-blur - Emitted when the button is blurred.
1513
* @event sgds-focus - Emitted when the button is focused.
1614
*/

src/components/IconList/sgds-icon-list.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,24 @@
1-
import SgdsElement from "../../base/sgds-element";
21
import { html } from "lit";
3-
import iconListStyles from "./icon-list.css";
42
import { property } from "lit/decorators.js";
53
import { classMap } from "lit/directives/class-map.js";
6-
import SgdsIcon from "../Icon/sgds-icon";
7-
import { ifDefined } from "lit/directives/if-defined.js";
4+
import SgdsElement from "../../base/sgds-element";
5+
import iconListStyles from "./icon-list.css";
86
/**
97
* @summary A IconList can be used to display content related to the same topic. Each list item begins an icon.
108
*
11-
* @slot default - The list items of IconList. Each list items should have aria attribute role="list" added
9+
* @slot default - The list items of IconList. Each list items should have aria attribute role="listitem" added
1210
*/
1311
export class SgdsIconList extends SgdsElement {
1412
static styles = [...SgdsElement.styles, iconListStyles];
15-
static dependencies = { "sgds-icon": SgdsIcon };
1613

1714
/** Sets the aria-role of the sgds-icon-list */
1815
@property({ type: String, reflect: true }) role = "list";
1916
/** The size of icon list. Changes the font-size the list items */
2017
@property({ type: String, reflect: true }) size: "sm" | "md" | "lg" = "md";
21-
/** The name of the icon from sgds icon library */
22-
@property({ type: String, reflect: true }) name: string;
23-
24-
private _assignIconSize(buttonSize: "sm" | "md" | "lg") {
25-
if (buttonSize === "sm") return "md";
26-
if (buttonSize === "md") return "lg";
27-
if (buttonSize === "lg") return "xl";
28-
}
2918

3019
render() {
3120
return html`
3221
<div class=${classMap({ [this.size]: this.size })}>
33-
<sgds-icon name=${ifDefined(this.name)} size=${ifDefined(this._assignIconSize(this.size))}></sgds-icon>
3422
<slot></slot>
3523
</div>
3624
`;

0 commit comments

Comments
 (0)