@odx/foundation 1.0.0-alpha.2 → 1.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,19 +2,19 @@
2
2
  font-family: "Draeger Pangea Text";
3
3
  font-style: normal;
4
4
  font-weight: 400;
5
- src: url("./assets/draeger-pangea-text-regular.woff2") format("woff2");
5
+ src: url("./draeger-pangea-text-regular.woff2") format("woff2");
6
6
  }
7
7
 
8
8
  @font-face {
9
9
  font-family: "Draeger Pangea Text";
10
10
  font-style: normal;
11
11
  font-weight: 500;
12
- src: url("./assets/draeger-pangea-text-medium.woff2") format("woff2");
12
+ src: url("./draeger-pangea-text-medium.woff2") format("woff2");
13
13
  }
14
14
 
15
15
  @font-face {
16
16
  font-family: "Draeger Pangea Text";
17
17
  font-style: normal;
18
18
  font-weight: 600;
19
- src: url("./assets/draeger-pangea-text-semibold.woff2") format("woff2");
19
+ src: url("./draeger-pangea-text-semibold.woff2") format("woff2");
20
20
  }
@@ -1,7 +1,6 @@
1
1
  import { optionalAttr, customElement } from '@odx/foundation';
2
2
  import { html } from 'lit';
3
3
  import { property } from 'lit/decorators.js';
4
- import { when } from 'lit/directives/when.js';
5
4
  import { OdxButtonComponent } from '../button/button.component.js';
6
5
 
7
6
  var __defProp = Object.defineProperty;
@@ -18,7 +17,6 @@ let OdxIconButtonComponent = class extends OdxButtonComponent {
18
17
  renderContent() {
19
18
  return html`
20
19
  <odx-icon name=${optionalAttr(this.icon)}></odx-icon>
21
- ${when(this.loading, () => html`<odx-loading-spinner class="spinner"></odx-loading-spinner>`)}
22
20
  <odx-visually-hidden>
23
21
  <slot></slot>
24
22
  </odx-visually-hidden>
@@ -1,4 +1,4 @@
1
- import { WithLoadingState, CustomElement, waitForAnimations, emptySlotFallbackFix, customElement } from '@odx/foundation';
1
+ import { WithLoadingState, CustomElement, waitForAnimations, customElement } from '@odx/foundation';
2
2
  import { html } from 'lit';
3
3
  import { query } from 'lit/decorators.js';
4
4
  import styles from './loading-overlay.component.css.js';
@@ -48,9 +48,7 @@ let OdxLoadingOverlayComponent = class extends WithLoadingState(CustomElement) {
48
48
  return html`
49
49
  <div part="overlay">
50
50
  <div class="content">
51
- <slot ${emptySlotFallbackFix()}>
52
- <odx-loading-spinner></odx-loading-spinner>
53
- </slot>
51
+ <odx-loading-spinner></odx-loading-spinner>
54
52
  </div>
55
53
  </div>
56
54
  `;
@@ -1,3 +1,3 @@
1
- const styles = ":host{--color: var(--odx-color-separator);--size: var(--odx-size-px);--inline-space: var(--odx-size-12);--block-space: var(--odx-size-25);display:block;block-size:var(--size);background-color:var(--color);margin-block:calc(var(--block-space) - .5 * var(--size));margin-inline:var(--inline-space);pointer-events:none;user-select:none}:host([vertical]:not([vertical=\"false\"])){min-block-size:var(--odx-size-100);block-size:calc(100% - var(--block-space) * 2);inline-size:var(--size);margin-block:var(--block-space);margin-inline:calc(var(--inline-space) - .5 * var(--size))}:host([highlight]:not([highlight=\"false\"])){--color: var(--odx-color-separator-strong)}";
1
+ const styles = "@layer base{:host{--color: var(--odx-color-separator);--size: var(--odx-size-px);--min-size: var(--odx-size-75);--inline-space: var(--odx-size-12);--block-space: var(--odx-size-75);display:block;margin-block:calc(var(--block-space) - .5 * var(--size));margin-inline:var(--inline-space)}.base{display:flex;align-items:center;column-gap:var(--odx-size-37);&:before,&:after{content:\"\";display:block;flex:1 1 auto;block-size:var(--size);background-color:var(--color);pointer-events:none}}}@layer variants{:host([vertical]){margin-block:var(--block-space);margin-inline:calc(var(--inline-space) - .5 * var(--size));.base{flex-direction:column;&:after,&:before{min-block-size:calc(var(--min-size) / 2);block-size:calc(100% - var(--block-space) * 2);inline-size:var(--size)}}}:host(:not([vertical])){.base{&:after,&:before{min-inline-size:calc(var(--min-size) / 2)}}}:host([highlight]){--color: var(--odx-color-separator-strong)}:host([align=\"start\"]){.base:before{flex:0 0 var(--min-size)}}:host([align=\"end\"]){.base:after{flex:0 0 var(--min-size)}}:host([empty-slot]) .base{gap:0}}";
2
2
 
3
3
  export { styles as default };
@@ -1,12 +1,16 @@
1
1
  import { CustomElement } from '@odx/foundation';
2
+ import { TemplateResult } from 'lit';
3
+ import { SeparatorAlign } from './separator.models';
2
4
  declare global {
3
5
  interface HTMLElementTagNameMap {
4
6
  'odx-separator': OdxSeparatorComponent;
5
7
  }
6
8
  }
7
9
  export declare class OdxSeparatorComponent extends CustomElement {
10
+ align?: SeparatorAlign;
8
11
  highlight: boolean;
9
12
  vertical: boolean;
10
13
  connectedCallback(): void;
14
+ protected render(): TemplateResult;
11
15
  }
12
16
  //# sourceMappingURL=separator.component.d.ts.map
@@ -1,4 +1,5 @@
1
- import { CustomElement, customElement } from '@odx/foundation';
1
+ import { CustomElement, emptySlotFallbackFix, customElement } from '@odx/foundation';
2
+ import { html } from 'lit';
2
3
  import { property } from 'lit/decorators.js';
3
4
  import styles from './separator.component.css.js';
4
5
 
@@ -22,7 +23,19 @@ let OdxSeparatorComponent = class extends CustomElement {
22
23
  super.connectedCallback();
23
24
  this.role = "separator";
24
25
  }
26
+ render() {
27
+ return html`
28
+ <div class="base">
29
+ <div class="content">
30
+ <slot ${emptySlotFallbackFix()} @slotchange=${() => this.requestUpdate()}></slot>
31
+ </div>
32
+ </div>
33
+ `;
34
+ }
25
35
  };
36
+ __decorateClass([
37
+ property({ reflect: true })
38
+ ], OdxSeparatorComponent.prototype, "align", 2);
26
39
  __decorateClass([
27
40
  property({ type: Boolean, reflect: true })
28
41
  ], OdxSeparatorComponent.prototype, "highlight", 2);
@@ -0,0 +1,6 @@
1
+ export type SeparatorAlign = (typeof SeparatorAlign)[keyof typeof SeparatorAlign];
2
+ export declare const SeparatorAlign: {
3
+ readonly START: "start";
4
+ readonly END: "end";
5
+ };
6
+ //# sourceMappingURL=separator.models.d.ts.map
@@ -1,12 +1,12 @@
1
1
  import { directive, Directive } from 'lit/directive.js';
2
+ import { toggleAttribute } from '../utils/dom.js';
2
3
 
3
4
  class SlotFallbackDirective extends Directive {
4
5
  update({ options, element }) {
5
- if (!options?.host || !(element instanceof HTMLSlotElement)) return;
6
- const host = options.host;
7
- const slottedElementSelector = element.name ? `[slot="${element.name}"]` : "*";
8
- if (host.querySelectorAll(slottedElementSelector).length > 0 || host.textContent?.trim()) return;
9
- host.textContent = "";
6
+ const host = options?.host;
7
+ if (!host || !(element instanceof HTMLSlotElement)) return;
8
+ const attributeName = ["empty-slot", element.name].filter(Boolean).join("-");
9
+ toggleAttribute(host, attributeName, !host.textContent?.trim() && element.assignedElements().length === 0);
10
10
  }
11
11
  render() {
12
12
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@odx/foundation",
3
3
  "description": "A library of Web Component building blocks for ODX",
4
- "version": "1.0.0-alpha.2",
4
+ "version": "1.0.0-alpha.4",
5
5
  "author": "Drägerwerk AG & Co.KGaA",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "homepage": "https://odx.draeger.com",
@@ -2,19 +2,19 @@
2
2
  font-family: "Draeger Pangea Text";
3
3
  font-style: normal;
4
4
  font-weight: 400;
5
- src: url("./assets/draeger-pangea-text-regular.woff2") format("woff2");
5
+ src: url("./draeger-pangea-text-regular.woff2") format("woff2");
6
6
  }
7
7
 
8
8
  @font-face {
9
9
  font-family: "Draeger Pangea Text";
10
10
  font-style: normal;
11
11
  font-weight: 500;
12
- src: url("./assets/draeger-pangea-text-medium.woff2") format("woff2");
12
+ src: url("./draeger-pangea-text-medium.woff2") format("woff2");
13
13
  }
14
14
 
15
15
  @font-face {
16
16
  font-family: "Draeger Pangea Text";
17
17
  font-style: normal;
18
18
  font-weight: 600;
19
- src: url("./assets/draeger-pangea-text-semibold.woff2") format("woff2");
19
+ src: url("./draeger-pangea-text-semibold.woff2") format("woff2");
20
20
  }