@emuanalytics/flow-rdf-ui 4.1.0 → 4.1.2

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.
@@ -0,0 +1,56 @@
1
+ import { html } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
4
+ import styles from './busy-overlay.styles.mjs';
5
+ import { boolean } from '../../internal/boolean.mjs';
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __decorateClass = (decorators, target, key, kind) => {
10
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
11
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
12
+ if (decorator = decorators[i])
13
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
14
+ if (kind && result)
15
+ __defProp(target, key, result);
16
+ return result;
17
+ };
18
+ class FlowUiBusyOverlay extends FlowRdfElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.busy = false;
22
+ this.variant = "neutral";
23
+ this.size = "medium";
24
+ this.overlayParent = false;
25
+ }
26
+ connectedCallback() {
27
+ super.connectedCallback();
28
+ this.busy = boolean(this.busy, true);
29
+ this.overlayParent = boolean(this.overlayParent, true);
30
+ }
31
+ render() {
32
+ return html`
33
+ <slot></slot>
34
+ <div class="busy-overlay">
35
+ <slot name="busy-animation">
36
+ <flow-ui-progress-ring variant=${this.variant} indeterminate></flow-ui-progress-ring>
37
+ </slot>
38
+ </div>
39
+ `;
40
+ }
41
+ }
42
+ FlowUiBusyOverlay.styles = styles;
43
+ __decorateClass([
44
+ property({ reflect: true, type: Boolean })
45
+ ], FlowUiBusyOverlay.prototype, "busy", 2);
46
+ __decorateClass([
47
+ property({ reflect: true })
48
+ ], FlowUiBusyOverlay.prototype, "variant", 2);
49
+ __decorateClass([
50
+ property({ reflect: true })
51
+ ], FlowUiBusyOverlay.prototype, "size", 2);
52
+ __decorateClass([
53
+ property({ type: Boolean, reflect: true, attribute: "overlay-parent" })
54
+ ], FlowUiBusyOverlay.prototype, "overlayParent", 2);
55
+
56
+ export { FlowUiBusyOverlay as default };
@@ -0,0 +1,5 @@
1
+ import FlowUiBusyOverlay from './busy-overlay.component.mjs';
2
+
3
+
4
+
5
+ export { FlowUiBusyOverlay as default };
@@ -0,0 +1,105 @@
1
+ import { css } from 'lit';
2
+ import componentStyles from '../../styles/component.styles.mjs';
3
+
4
+ const styles = css`
5
+ ${componentStyles}
6
+
7
+ :host {
8
+ --transition-delay: 1s;
9
+ --transition-duration: 0.3s;
10
+
11
+ --progress-ring-size: 1.5em;
12
+ --progress-ring-track-width: 0.15em;
13
+ --progress-ring-track-color: transparent;
14
+ --progress-ring-indicator-color: var(--flow-ui-busy-overlay-color);
15
+
16
+ --overlay-background-color: var(--flow-ui-busy-overlay-background-color);
17
+
18
+ display: block;
19
+ position: relative;
20
+ }
21
+
22
+ .busy-overlay {
23
+ display: flex;
24
+ justify-content: center;
25
+ align-items: center;
26
+ position: absolute;
27
+ top: 0;
28
+ left: 0;
29
+ right: 0;
30
+ bottom: 0;
31
+ width: 100%;
32
+ height: 100%;
33
+ background: grey;
34
+ background-color: var(--overlay-background-color);
35
+ pointer-events: none;
36
+ opacity: 0;
37
+ transition: opacity var(--transition-duration) ease-in-out;
38
+ z-index: 1;
39
+ }
40
+
41
+ :host([overlay-parent]) {
42
+ position: absolute;
43
+ top: 0;
44
+ bottom: 0;
45
+ left: 0;
46
+ right: 0;
47
+ pointer-events: none;
48
+ z-index: 1;
49
+ }
50
+
51
+ :host([busy]) .busy-overlay {
52
+ opacity: 1;
53
+ transition-delay: var(--transition-delay);
54
+ pointer-events: all;
55
+ }
56
+
57
+ :host([size='small']) {
58
+ --progress-ring-size: 1em;
59
+ --progress-ring-track-width: 0.15em;
60
+ }
61
+
62
+ :host([size='medium']) {
63
+ --progress-ring-size: 1.5em;
64
+ --progress-ring-track-width: 0.15em;
65
+ }
66
+
67
+ :host([size='large']) {
68
+ --progress-ring-size: 2.25em;
69
+ --progress-ring-track-width: 0.15em;
70
+ }
71
+
72
+ :host([variant='primary']) {
73
+ --progress-ring-indicator-color: var(--flow-ui-color-primary-500);
74
+ }
75
+
76
+ :host([variant='secondary']) {
77
+ --progress-ring-indicator-color: var(--flow-ui-color-secondary-500);
78
+ }
79
+
80
+ :host([variant='success']) {
81
+ --progress-ring-indicator-color: var(--flow-ui-color-success-500);
82
+ }
83
+
84
+ :host([variant='neutral']) {
85
+ --progress-ring-indicator-color: var(--flow-ui-busy-overlay-color);
86
+ }
87
+
88
+ :host([variant='warning']) {
89
+ --progress-ring-indicator-color: var(--flow-ui-color-warning-500);
90
+ }
91
+
92
+ :host([variant='danger']) {
93
+ --progress-ring-indicator-color: var(--flow-ui-color-danger-500);
94
+ }
95
+
96
+ flow-ui-progress-ring::part(base) {
97
+ --size: var(--progress-ring-size);
98
+ --track-width: var(--progress-ring-track-width);
99
+ --indicator-width: var(--track-width);
100
+ --track-color: var(--progress-ring-track-color);
101
+ --indicator-color: var(--progress-ring-indicator-color);
102
+ }
103
+ `;
104
+
105
+ export { styles as default };
@@ -221,7 +221,10 @@ class FlowUiButton extends FlowRdfFormControl {
221
221
  <flow-ui-icon part="caret" class="button__caret" library="system" name="caret"></flow-ui-icon>
222
222
  ` : ""}
223
223
  ${this.loading ? html`
224
- <flow-ui-spinner></flow-ui-spinner>
224
+ <flow-ui-progress-ring
225
+ size=${this.size === "large" ? "medium" : this.size}
226
+ indeterminate
227
+ ></flow-ui-progress-ring>
225
228
  ` : ""}
226
229
  </${tag}>
227
230
  `;
@@ -512,16 +512,25 @@ const buttonStyles = css`
512
512
  visibility: hidden;
513
513
  }
514
514
 
515
- .button--loading flow-ui-spinner {
516
- --indicator-color: currentColor;
515
+ .button--loading flow-ui-progress-ring {
517
516
  position: absolute;
518
- font-size: 1em;
519
- height: 1em;
520
- width: 1em;
517
+ }
518
+
519
+ .button--medium flow-ui-progress-ring,
520
+ .button--large flow-ui-progress-ring {
521
+ top: calc(50% - 0.75em);
522
+ left: calc(50% - 0.75em);
523
+ }
524
+
525
+ .button--small flow-ui-progress-ring {
521
526
  top: calc(50% - 0.5em);
522
527
  left: calc(50% - 0.5em);
523
528
  }
524
529
 
530
+ .button--loading flow-ui-progress-ring::part(base) {
531
+ --indicator-color: currentColor;
532
+ }
533
+
525
534
  /*
526
535
  * Badges
527
536
  */
@@ -1,6 +1,5 @@
1
1
  import { html } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
- import { classMap } from 'lit/directives/class-map.js';
4
3
  import { ifDefined } from 'lit/directives/if-defined.js';
5
4
  import { styleMap } from 'lit/directives/style-map.js';
6
5
  import { boolean } from '../../internal/boolean.mjs';
@@ -23,9 +22,10 @@ class FlowUiProgressBar extends FlowRdfElement {
23
22
  constructor() {
24
23
  super(...arguments);
25
24
  this.localize = new LocalizeController(this);
25
+ this.label = "";
26
26
  this.value = 0;
27
27
  this.indeterminate = false;
28
- this.label = "";
28
+ this.variant = "primary";
29
29
  }
30
30
  connectedCallback() {
31
31
  super.connectedCallback();
@@ -35,11 +35,7 @@ class FlowUiProgressBar extends FlowRdfElement {
35
35
  return html`
36
36
  <div
37
37
  part="base"
38
- class=${classMap({
39
- "progress-bar": true,
40
- "progress-bar--indeterminate": this.indeterminate,
41
- "progress-bar--rtl": this.localize.dir() === "rtl"
42
- })}
38
+ class="progress-bar"
43
39
  role="progressbar"
44
40
  title=${ifDefined(this.label)}
45
41
  aria-label=${this.label.length > 0 ? this.label : this.localize.term("progress")}
@@ -47,16 +43,20 @@ class FlowUiProgressBar extends FlowRdfElement {
47
43
  aria-valuemax="100"
48
44
  aria-valuenow=${this.indeterminate ? 0 : this.value}
49
45
  >
50
- <div part="indicator" class="progress-bar__indicator" style=${styleMap({ width: `${this.value}%` })}>
51
- ${!this.indeterminate ? html`
52
- <slot part="label" class="progress-bar__label"></slot>
53
- ` : ""}
54
- </div>
46
+ <div part="indicator" class="progress-bar__indicator" style=${styleMap({ width: `${this.value}%` })}></div>
47
+ </div>
48
+ <div class="progress-bar__label-container">
49
+ ${!this.indeterminate ? html`
50
+ <slot part="label" class="progress-bar__label"></slot>
51
+ ` : ""}
55
52
  </div>
56
53
  `;
57
54
  }
58
55
  }
59
56
  FlowUiProgressBar.styles = styles;
57
+ __decorateClass([
58
+ property()
59
+ ], FlowUiProgressBar.prototype, "label", 2);
60
60
  __decorateClass([
61
61
  property({ type: Number, reflect: true })
62
62
  ], FlowUiProgressBar.prototype, "value", 2);
@@ -64,7 +64,7 @@ __decorateClass([
64
64
  property({ type: Boolean, reflect: true })
65
65
  ], FlowUiProgressBar.prototype, "indeterminate", 2);
66
66
  __decorateClass([
67
- property()
68
- ], FlowUiProgressBar.prototype, "label", 2);
67
+ property({ reflect: true })
68
+ ], FlowUiProgressBar.prototype, "variant", 2);
69
69
 
70
70
  export { FlowUiProgressBar as default };
@@ -5,48 +5,77 @@ const styles = css`
5
5
  ${componentStyles}
6
6
 
7
7
  :host {
8
- --height: 1rem;
8
+ --track-height: 0.15rem;
9
9
  --track-color: var(--flow-ui-color-neutral-200);
10
10
  --indicator-color: var(--flow-ui-color-primary-500);
11
- --label-color: var(--flow-ui-color-neutral-0);
12
11
 
13
- display: block;
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
14
15
  }
15
16
 
16
17
  .progress-bar {
17
18
  position: relative;
18
19
  background-color: var(--track-color);
19
- height: var(--height);
20
+ height: var(--track-height);
21
+ width: 100%;
20
22
  border-radius: var(--flow-ui-border-radius-pill);
21
23
  box-shadow: inset var(--flow-ui-shadow-small);
22
24
  overflow: hidden;
23
25
  }
24
26
 
27
+ :host([variant='primary']) .progress-bar {
28
+ --indicator-color: var(--flow-ui-color-primary-500);
29
+ }
30
+
31
+ :host([variant='secondary']) .progress-bar {
32
+ --indicator-color: var(--flow-ui-color-secondary-500);
33
+ }
34
+
35
+ :host([variant='success']) .progress-bar {
36
+ --indicator-color: var(--flow-ui-color-success-500);
37
+ }
38
+
39
+ :host([variant='neutral']) .progress-bar {
40
+ --indicator-color: var(--flow-ui-color-neutral-500);
41
+ }
42
+
43
+ :host([variant='warning']) .progress-bar {
44
+ --indicator-color: var(--flow-ui-color-warning-500);
45
+ }
46
+
47
+ :host([variant='danger']) .progress-bar {
48
+ --indicator-color: var(--flow-ui-color-danger-500);
49
+ }
50
+
25
51
  .progress-bar__indicator {
26
52
  height: 100%;
27
53
  font-family: var(--flow-ui-font-sans);
28
54
  font-size: 12px;
29
55
  font-weight: var(--flow-ui-font-weight-normal);
30
56
  background-color: var(--indicator-color);
31
- color: var(--label-color);
32
57
  text-align: center;
33
- line-height: var(--height);
58
+ line-height: var(--track-height);
34
59
  white-space: nowrap;
35
60
  overflow: hidden;
36
- transition: 400ms width, 400ms background-color;
61
+ transition:
62
+ 400ms width,
63
+ 400ms background-color;
37
64
  user-select: none;
38
65
  }
39
66
 
67
+ .progress-bar__label-container {
68
+ display: flex;
69
+ justify-content: center;
70
+ align-items: center;
71
+ }
72
+
40
73
  /* Indeterminate */
41
- .progress-bar--indeterminate .progress-bar__indicator {
74
+ :host([indeterminate]) .progress-bar__indicator {
42
75
  position: absolute;
43
76
  animation: indeterminate 2.5s infinite cubic-bezier(0.37, 0, 0.63, 1);
44
77
  }
45
78
 
46
- .progress-bar--indeterminate.progress-bar--rtl .progress-bar__indicator {
47
- animation-name: indeterminate-rtl;
48
- }
49
-
50
79
  @media (forced-colors: active) {
51
80
  .progress-bar {
52
81
  outline: solid 1px SelectedItem;
@@ -1,8 +1,9 @@
1
1
  import { html } from 'lit';
2
- import { query, state, property } from 'lit/decorators.js';
2
+ import { property } from 'lit/decorators.js';
3
3
  import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
4
4
  import { LocalizeController } from '../../utilities/localize.mjs';
5
5
  import styles from './progress-ring.styles.mjs';
6
+ import { boolean } from '../../internal/boolean.mjs';
6
7
 
7
8
  var __defProp = Object.defineProperty;
8
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -19,17 +20,15 @@ class FlowUiProgressRing extends FlowRdfElement {
19
20
  constructor() {
20
21
  super(...arguments);
21
22
  this.localize = new LocalizeController(this);
22
- this.value = 0;
23
23
  this.label = "";
24
+ this.value = 0;
25
+ this.indeterminate = false;
26
+ this.variant = "primary";
27
+ this.size = "medium";
24
28
  }
25
- updated(changedProps) {
26
- super.updated(changedProps);
27
- if (changedProps.has("value")) {
28
- const radius = parseFloat(getComputedStyle(this.indicator).getPropertyValue("r"));
29
- const circumference = 2 * Math.PI * radius;
30
- const offset = circumference - this.value / 100 * circumference;
31
- this.indicatorOffset = `${offset}px`;
32
- }
29
+ connectedCallback() {
30
+ super.connectedCallback();
31
+ this.indeterminate = boolean(this.indeterminate, true);
33
32
  }
34
33
  render() {
35
34
  return html`
@@ -41,12 +40,12 @@ class FlowUiProgressRing extends FlowRdfElement {
41
40
  aria-describedby="label"
42
41
  aria-valuemin="0"
43
42
  aria-valuemax="100"
44
- aria-valuenow="${this.value}"
45
- style="--percentage: ${this.value / 100}"
43
+ aria-valuenow="${this.indeterminate ? 0 : this.value}"
44
+ style="--percentage: ${this.value}"
46
45
  >
47
46
  <svg class="progress-ring__image">
48
47
  <circle class="progress-ring__track"></circle>
49
- <circle class="progress-ring__indicator" style="stroke-dashoffset: ${this.indicatorOffset}"></circle>
48
+ <circle class="progress-ring__indicator"></circle>
50
49
  </svg>
51
50
 
52
51
  <slot id="label" part="label" class="progress-ring__label"></slot>
@@ -56,16 +55,19 @@ class FlowUiProgressRing extends FlowRdfElement {
56
55
  }
57
56
  FlowUiProgressRing.styles = styles;
58
57
  __decorateClass([
59
- query(".progress-ring__indicator")
60
- ], FlowUiProgressRing.prototype, "indicator", 2);
61
- __decorateClass([
62
- state()
63
- ], FlowUiProgressRing.prototype, "indicatorOffset", 2);
58
+ property()
59
+ ], FlowUiProgressRing.prototype, "label", 2);
64
60
  __decorateClass([
65
61
  property({ type: Number, reflect: true })
66
62
  ], FlowUiProgressRing.prototype, "value", 2);
67
63
  __decorateClass([
68
- property()
69
- ], FlowUiProgressRing.prototype, "label", 2);
64
+ property({ type: Boolean, reflect: true })
65
+ ], FlowUiProgressRing.prototype, "indeterminate", 2);
66
+ __decorateClass([
67
+ property({ reflect: true })
68
+ ], FlowUiProgressRing.prototype, "variant", 2);
69
+ __decorateClass([
70
+ property({ reflect: true })
71
+ ], FlowUiProgressRing.prototype, "size", 2);
70
72
 
71
73
  export { FlowUiProgressRing as default };
@@ -5,8 +5,8 @@ const styles = css`
5
5
  ${componentStyles}
6
6
 
7
7
  :host {
8
- --size: 128px;
9
- --track-width: 4px;
8
+ --size: 1em;
9
+ --track-width: 0.15em;
10
10
  --track-color: var(--flow-ui-color-neutral-200);
11
11
  --indicator-width: var(--track-width);
12
12
  --indicator-color: var(--flow-ui-color-primary-500);
@@ -16,12 +16,53 @@ const styles = css`
16
16
  }
17
17
 
18
18
  .progress-ring {
19
+ --indicator-width: var(--track-width);
20
+
19
21
  display: inline-flex;
20
22
  align-items: center;
21
23
  justify-content: center;
22
24
  position: relative;
23
25
  }
24
26
 
27
+ :host([size='small']) .progress-ring {
28
+ --size: 1em;
29
+ --track-width: 0.15em;
30
+ }
31
+
32
+ :host([size='medium']) .progress-ring {
33
+ --size: 1.5em;
34
+ --track-width: 0.15em;
35
+ }
36
+
37
+ :host([size='large']) .progress-ring {
38
+ --size: 2.25em;
39
+ --track-width: 0.15em;
40
+ }
41
+
42
+ :host([variant='primary']) .progress-ring {
43
+ --indicator-color: var(--flow-ui-color-primary-500);
44
+ }
45
+
46
+ :host([variant='secondary']) .progress-ring {
47
+ --indicator-color: var(--flow-ui-color-secondary-500);
48
+ }
49
+
50
+ :host([variant='success']) .progress-ring {
51
+ --indicator-color: var(--flow-ui-color-success-500);
52
+ }
53
+
54
+ :host([variant='neutral']) .progress-ring {
55
+ --indicator-color: var(--flow-ui-color-neutral-500);
56
+ }
57
+
58
+ :host([variant='warning']) .progress-ring {
59
+ --indicator-color: var(--flow-ui-color-warning-500);
60
+ }
61
+
62
+ :host([variant='danger']) .progress-ring {
63
+ --indicator-color: var(--flow-ui-color-danger-500);
64
+ }
65
+
25
66
  .progress-ring__image {
26
67
  width: var(--size);
27
68
  height: var(--size);
@@ -38,6 +79,8 @@ const styles = css`
38
79
  r: var(--radius);
39
80
  cx: calc(var(--size) / 2);
40
81
  cy: calc(var(--size) / 2);
82
+
83
+ transform-origin: 50% 50%;
41
84
  }
42
85
 
43
86
  .progress-ring__track {
@@ -49,10 +92,23 @@ const styles = css`
49
92
  stroke: var(--indicator-color);
50
93
  stroke-width: var(--indicator-width);
51
94
  stroke-linecap: round;
95
+ }
96
+
97
+ .progress-ring__indicator {
98
+ --blank-ratio: calc(1 - var(--percentage) * 0.01);
99
+
100
+ stroke-dasharray: calc(var(--circumference)) calc(var(--circumference));
101
+ stroke-dashoffset: calc(var(--blank-ratio) * var(--circumference));
52
102
  transition-property: stroke-dashoffset;
53
103
  transition-duration: var(--indicator-transition-duration);
54
- stroke-dasharray: var(--circumference) var(--circumference);
55
- stroke-dashoffset: calc(var(--circumference) - var(--percentage) * var(--circumference));
104
+ }
105
+
106
+ :host([indeterminate]) .progress-ring {
107
+ --track-color: transparent;
108
+ }
109
+
110
+ :host([indeterminate]) .progress-ring__indicator {
111
+ animation: indeterminate 2.5s infinite linear;
56
112
  }
57
113
 
58
114
  .progress-ring__label {
@@ -67,6 +123,23 @@ const styles = css`
67
123
  text-align: center;
68
124
  user-select: none;
69
125
  }
126
+
127
+ @keyframes indeterminate {
128
+ 0% {
129
+ transform: rotate(0deg);
130
+ stroke-dasharray: calc(var(--circumference) * 0) calc(var(--circumference) * 1);
131
+ }
132
+
133
+ 50% {
134
+ transform: rotate(450deg);
135
+ stroke-dasharray: calc(var(--circumference) * 0.8) calc(var(--circumference) * 0.2);
136
+ }
137
+
138
+ 100% {
139
+ transform: rotate(1080deg);
140
+ stroke-dasharray: calc(var(--circumference) * 0) calc(var(--circumference) * 1);
141
+ }
142
+ }
70
143
  `;
71
144
 
72
145
  export { styles as default };
@@ -69,7 +69,7 @@ const styles = css`
69
69
  height: 100%;
70
70
  left: calc(var(--divider-hit-area) / -2 + var(--divider-width) / 2);
71
71
  width: var(--divider-hit-area);
72
- z-index: 1;
72
+ z-index: 1000;
73
73
  }
74
74
 
75
75
  /* Vertical */
@@ -189,7 +189,10 @@ const _FlowUiTreeItem = class _FlowUiTreeItem extends FlowRdfElement {
189
189
  ${when(
190
190
  this.loading,
191
191
  () => html`
192
- <flow-ui-spinner></flow-ui-spinner>
192
+ <flow-ui-progress-ring
193
+ size=${this.size === "large" ? "medium" : this.size}
194
+ indeterminate
195
+ ></flow-ui-progress-ring>
193
196
  `
194
197
  )}
195
198
  <slot class="tree-item__expand-icon-slot" name="expand-icon">