grav-svelte 0.0.67 → 0.0.69

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.
@@ -4,25 +4,34 @@
4
4
  export let item: any;
5
5
  export let header: TableHeader;
6
6
  export let idField: string;
7
+
8
+ $: alignStyle = header.align === 'left' ? 'margin-right: auto;' :
9
+ header.align === 'right' ? 'margin-left: auto;' : '';
10
+
11
+ $: hasText1 = header.textField1 && item[header.textField1];
12
+ $: hasText2 = header.textField2 && item[header.textField2];
13
+ $: isSingleState = (hasText1 && !hasText2) || (!hasText1 && hasText2);
7
14
  </script>
8
15
 
9
- <button
10
- type="button"
11
- class="dual-text-button"
12
- on:click={() => {
13
- if (header.onButtonClick) {
14
- header.onButtonClick(item[idField], item);
15
- }
16
- }}
17
- >
18
- {#if header.textField1 && item[header.textField1]}
19
- <div class="dual-text-1 {item[header.colorField1 ?? ''] ?? ''}">
20
- {item[header.textField1]}
21
- </div>
22
- {/if}
23
- {#if header.textField2 && item[header.textField2]}
24
- <div class="dual-text-2 {item[header.colorField2 ?? ''] ?? ''}">
25
- {item[header.textField2]}
26
- </div>
27
- {/if}
28
- </button>
16
+ <div style="display: inline-flex; {alignStyle}">
17
+ <button
18
+ type="button"
19
+ class="dual-text-button"
20
+ on:click={() => {
21
+ if (header.onButtonClick) {
22
+ header.onButtonClick(item[idField], item);
23
+ }
24
+ }}
25
+ >
26
+ {#if hasText1}
27
+ <div class="dual-text-1 {item[header.colorField1 ?? ''] ?? ''} {isSingleState ? 'rounded-bottom' : ''}">
28
+ {item[header.textField1]}
29
+ </div>
30
+ {/if}
31
+ {#if hasText2}
32
+ <div class="dual-text-2 {item[header.colorField2 ?? ''] ?? ''} {isSingleState ? 'rounded-bottom' : ''}">
33
+ {item[header.textField2]}
34
+ </div>
35
+ {/if}
36
+ </button>
37
+ </div>
@@ -4,28 +4,33 @@
4
4
  export let item: any;
5
5
  export let header: TableHeader;
6
6
  export let idField: string;
7
+
8
+ $: alignStyle = header.align === 'left' ? 'margin-right: auto;' :
9
+ header.align === 'right' ? 'margin-left: auto;' : '';
7
10
  </script>
8
11
 
9
- <button
10
- type="button"
11
- class="dynamic-button {item[header.colorField ?? ''] ?? ''}"
12
- on:click={() => {
13
- if (header.onButtonClick) {
14
- header.onButtonClick(item[idField], item);
15
- }
16
- }}
17
- >
18
- {#if header.iconField && item[header.iconField]}
19
- {#if !header.iconPosition || header.iconPosition === "left"}
20
- <i class="{item[header.iconField]} dynamic-button-icon-left"></i>
12
+ <div style="display: inline-flex; {alignStyle}">
13
+ <button
14
+ type="button"
15
+ class="dynamic-button {item[header.colorField ?? ''] ?? ''}"
16
+ on:click={() => {
17
+ if (header.onButtonClick) {
18
+ header.onButtonClick(item[idField], item);
19
+ }
20
+ }}
21
+ >
22
+ {#if header.iconField && item[header.iconField]}
23
+ {#if !header.iconPosition || header.iconPosition === "left"}
24
+ <i class="{item[header.iconField]} dynamic-button-icon-left"></i>
25
+ {/if}
26
+ {/if}
27
+ {#if header.textField && item[header.textField]}
28
+ <span>{item[header.textField]}</span>
21
29
  {/if}
22
- {/if}
23
- {#if header.textField && item[header.textField]}
24
- <span>{item[header.textField]}</span>
25
- {/if}
26
- {#if header.iconField && item[header.iconField]}
27
- {#if header.iconPosition === "right"}
28
- <i class="{item[header.iconField]} dynamic-button-icon-right"></i>
30
+ {#if header.iconField && item[header.iconField]}
31
+ {#if header.iconPosition === "right"}
32
+ <i class="{item[header.iconField]} dynamic-button-icon-right"></i>
33
+ {/if}
29
34
  {/if}
30
- {/if}
31
- </button>
35
+ </button>
36
+ </div>
@@ -590,6 +590,11 @@
590
590
  border-bottom-right-radius: var(--grav-border-radius-md);
591
591
  }
592
592
 
593
+ .rounded-bottom {
594
+ border-bottom-left-radius: var(--grav-border-radius-md);
595
+ border-bottom-right-radius: var(--grav-border-radius-md);
596
+ }
597
+
593
598
  .dual-text-separator {
594
599
  color: var(--grav-crud-color-neutral);
595
600
  opacity: 0.5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grav-svelte",
3
- "version": "0.0.67",
3
+ "version": "0.0.69",
4
4
  "description": "A collection of Svelte components",
5
5
  "license": "MIT",
6
6
  "scripts": {