@streamscloud/kit 0.9.19 → 0.10.1

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.
@@ -1,9 +1,9 @@
1
- <script lang="ts">const { variant = 'neutral', size = 'md', style = 'soft', children } = $props();
1
+ <script lang="ts">const { variant = 'neutral', size = 'md', style = 'soft', fullWidth = false, children } = $props();
2
2
  export {};
3
3
  </script>
4
4
 
5
- <span class="badge badge--{size} badge--{variant}-{style}">
6
- {@render children()}
5
+ <span class="badge badge--{size} badge--{variant}-{style}" class:badge--full={fullWidth}>
6
+ <span class="badge__content">{@render children()}</span>
7
7
  </span>
8
8
 
9
9
  <!--
@@ -39,10 +39,18 @@ Pill-shaped status indicator. Use `solid` for stronger emphasis, `soft` (default
39
39
  font-size: var(--_badge--font-size);
40
40
  font-weight: var(--_badge--font-weight);
41
41
  line-height: 1.4;
42
- white-space: nowrap;
42
+ max-width: 100%;
43
+ }
44
+ .badge__content {
45
+ min-width: 0;
43
46
  overflow: hidden;
44
47
  text-overflow: ellipsis;
45
- max-width: 100%;
48
+ white-space: nowrap;
49
+ }
50
+ .badge--full {
51
+ display: flex;
52
+ width: 100%;
53
+ justify-content: center;
46
54
  }
47
55
  .badge--sm {
48
56
  --_badge--padding-block: var(--sc-kit--badge--padding-block, 0.25rem);
@@ -7,6 +7,8 @@ type Props = {
7
7
  size?: 'sm' | 'md';
8
8
  /** Filled chip vs soft-tinted fill @default 'soft' */
9
9
  style?: 'soft' | 'solid';
10
+ /** Stretch to fill the parent's inline axis, centering the content. @default false */
11
+ fullWidth?: boolean;
10
12
  children: Snippet;
11
13
  };
12
14
  /**
@@ -104,7 +104,7 @@ Pass `type="anchor"` to render as `<a>` with `href`. Otherwise `type` is the nat
104
104
  | `--sc-kit--button--font-size` | Label font size | per size |
105
105
  | `--sc-kit--button--gap` | Gap between icon and label | per size |
106
106
  | `--sc-kit--button--border-radius` | Corner rounding | `var(--sc-kit--radius--md)` |
107
- | `--sc-kit--button--font-weight` | Font weight | `var(--sc-kit--font-weight--medium)` |
107
+ | `--sc-kit--button--font-weight` | Font weight | `var(--sc-kit--font-weight--regular)` |
108
108
  | `--sc-kit--button--width` | Explicit width | `fit-content` |
109
109
  | `--sc-kit--button--min-width` | Minimum width | `0` |
110
110
  | `--sc-kit--button--max-width` | Maximum width | `100%` |
@@ -126,7 +126,7 @@ Pass `type="anchor"` to render as `<a>` with `href`. Otherwise `type` is the nat
126
126
  --_btn--min-width: var(--sc-kit--button--min-width, 0);
127
127
  --_btn--max-width: var(--sc-kit--button--max-width, 100%);
128
128
  --_btn--border-radius: var(--sc-kit--button--border-radius, var(--sc-kit--radius--md));
129
- --_btn--font-weight: var(--sc-kit--button--font-weight, var(--sc-kit--font-weight--medium));
129
+ --_btn--font-weight: var(--sc-kit--button--font-weight, var(--sc-kit--font-weight--regular));
130
130
  box-sizing: border-box;
131
131
  display: flex;
132
132
  align-items: center;
@@ -199,7 +199,7 @@ Pass `type="anchor"` to render as `<a>` with `href`. Otherwise `type` is the nat
199
199
  --sc-kit--button--padding-inline: var(--sc-kit--space--3);
200
200
  --sc-kit--button--font-size: var(--sc-kit--font-size--sm);
201
201
  --sc-kit--button--gap: var(--sc-kit--space--1);
202
- --sc-kit--icon--size: 1rem;
202
+ --sc-kit--icon--size: 0.875rem;
203
203
  }
204
204
  .btn--md {
205
205
  --sc-kit--button--height: 2rem;
@@ -62,7 +62,7 @@ type Props = ButtonModeProps | AnchorModeProps;
62
62
  * | `--sc-kit--button--font-size` | Label font size | per size |
63
63
  * | `--sc-kit--button--gap` | Gap between icon and label | per size |
64
64
  * | `--sc-kit--button--border-radius` | Corner rounding | `var(--sc-kit--radius--md)` |
65
- * | `--sc-kit--button--font-weight` | Font weight | `var(--sc-kit--font-weight--medium)` |
65
+ * | `--sc-kit--button--font-weight` | Font weight | `var(--sc-kit--font-weight--regular)` |
66
66
  * | `--sc-kit--button--width` | Explicit width | `fit-content` |
67
67
  * | `--sc-kit--button--min-width` | Minimum width | `0` |
68
68
  * | `--sc-kit--button--max-width` | Maximum width | `100%` |
@@ -9,7 +9,7 @@ let { icon, iconPosition = 'leading', secondaryIcon, trimText = false, hideText
9
9
  class:icon-text--md={size === 'md'}
10
10
  class:icon-text--lg={size === 'lg'}>
11
11
  <span class="icon-text__icon">
12
- <IconSlot icon={icon} size={size} />
12
+ <IconSlot icon={icon} />
13
13
  </span>
14
14
  {#if children && !hideText}
15
15
  <span class="icon-text__text" class:icon-text__text--trim={trimText}>
@@ -18,7 +18,7 @@ let { icon, iconPosition = 'leading', secondaryIcon, trimText = false, hideText
18
18
  {/if}
19
19
  {#if secondaryIcon}
20
20
  <span class="icon-text__secondary">
21
- <IconSlot icon={secondaryIcon} size={size} />
21
+ <IconSlot icon={secondaryIcon} />
22
22
  </span>
23
23
  {/if}
24
24
  </span>
@@ -70,12 +70,15 @@ status" dropdown-trigger patterns. Each icon prop accepts a string SVG source, a
70
70
  }
71
71
  .icon-text--sm {
72
72
  --sc-kit--icon-text--text--font-size: var(--sc-kit--font-size--sm);
73
+ --sc-kit--icon-text--icon--font-size: 0.875rem;
73
74
  }
74
75
  .icon-text--md {
75
76
  --sc-kit--icon-text--text--font-size: var(--sc-kit--font-size--md);
77
+ --sc-kit--icon-text--icon--font-size: 1rem;
76
78
  }
77
79
  .icon-text--lg {
78
80
  --sc-kit--icon-text--text--font-size: var(--sc-kit--font-size--lg);
81
+ --sc-kit--icon-text--icon--font-size: 1.25rem;
79
82
  }
80
83
  .icon-text__text {
81
84
  font-size: var(--_icon-text--text--font-size);
@@ -11,7 +11,7 @@ type Props = {
11
11
  trimText?: boolean;
12
12
  /** Hide text, showing only the icon(s) */
13
13
  hideText?: boolean;
14
- /** Font-size preset scales icon + text together (em-based). Inherits (`1em`) when unset. */
14
+ /** Size preset matching `Button` of the same size — text/icon px: sm 12/14, md 14/16, lg 16/20. Unset: text + icon follow the inherited font size (`1em`). */
15
15
  size?: 'sm' | 'md' | 'lg';
16
16
  children?: Snippet;
17
17
  };
@@ -65,15 +65,22 @@ const transformDraggedElement = (draggedRow) => {
65
65
  if (!draggedRow) {
66
66
  return;
67
67
  }
68
- const referenceColumns = tableRef.querySelector('tbody')?.querySelector('tr')?.querySelectorAll('td') || [];
68
+ const referenceRow = tableRef.querySelector('tbody tr:not([data-is-dnd-shadow-item-internal])') ?? tableRef.querySelector('tbody tr');
69
+ const referenceColumns = referenceRow?.querySelectorAll('td') ?? [];
69
70
  const draggedColumns = draggedRow.querySelectorAll('td');
70
- if (referenceColumns.length !== draggedColumns.length) {
71
+ if (!referenceRow || referenceColumns.length !== draggedColumns.length) {
71
72
  console.error('not equal count of model.columns withing table rows');
72
73
  return;
73
74
  }
74
75
  for (let i = 0, length = referenceColumns.length; i < length; i++) {
75
76
  draggedColumns[i].style.width = `${referenceColumns[i].clientWidth}px`;
77
+ draggedColumns[i].style.height = `${referenceColumns[i].clientHeight}px`;
76
78
  }
79
+ // Clone is reparented to <body>, losing the .table-container --_table--* vars; cells collapse without this.
80
+ const cellStyle = window.getComputedStyle(referenceColumns[0]);
81
+ draggedRow.style.setProperty('--_table--cell--font-size', cellStyle.fontSize);
82
+ draggedRow.style.setProperty('--_table--cell--horizontal-padding', cellStyle.paddingInlineStart);
83
+ draggedRow.style.setProperty('--_table--border-color', cellStyle.borderBottomColor);
77
84
  };
78
85
  // endregion Drag and Drop
79
86
  const changeItemPosition = (item, positionChange) => {
@@ -177,7 +184,7 @@ const getEditorColumnOrDefault = (column, editMode) => {
177
184
  {#each model.itemActions as action (action)}
178
185
  {#if action.visibilityFactory ? action.visibilityFactory(item) : true}
179
186
  <PopoverItem on={{ click: () => action.action(item) }}>
180
- <IconText icon={action.icon}>
187
+ <IconText icon={action.icon} size="md">
181
188
  {action.title}
182
189
  </IconText>
183
190
  </PopoverItem>
@@ -452,11 +459,6 @@ Data table component with support for sorting, selection, drag-and-drop row reor
452
459
  }
453
460
  .table__actions {
454
461
  display: contents;
455
- --sc-kit--popover-item--font-size: var(--sc-kit--font-size--md);
456
- --sc-kit--popover-item--min-width: 8.75rem;
457
- --sc-kit--popover-item--padding: var(--sc-kit--space--3) var(--sc-kit--space--5);
458
- --sc-kit--icon-text--text--font-size: var(--sc-kit--font-size--md);
459
- --sc-kit--icon-text--icon--font-size: 1.125rem;
460
462
  }
461
463
  .table__drag-handle {
462
464
  width: 2.25rem;
@@ -24,7 +24,7 @@ const singleGroupAction = $derived(availableGroupActions[0]);
24
24
  {#each groupActions as action (action)}
25
25
  {#if isActionVisible(action, selection.items)}
26
26
  <PopoverItem on={{ click: () => action.action(selection.items) }}>
27
- <IconText icon={action.icon}>
27
+ <IconText icon={action.icon} size="sm">
28
28
  {action.title}
29
29
  </IconText>
30
30
  </PopoverItem>
@@ -33,7 +33,7 @@ const singleGroupAction = $derived(availableGroupActions[0]);
33
33
  </Popover>
34
34
  {:else if singleGroupAction}
35
35
  <Button type="button" variant="secondary" size="sm" on={{ click: () => singleGroupAction.action(selection.items) }}>
36
- <IconText icon={singleGroupAction.icon}>
36
+ <IconText icon={singleGroupAction.icon} size="sm">
37
37
  {singleGroupAction.title}
38
38
  </IconText>
39
39
  </Button>
@@ -48,9 +48,4 @@ Group actions toolbar for table selections. Shows a single button or popover wit
48
48
 
49
49
  <style>.table-group-actions {
50
50
  display: contents;
51
- --sc-kit--popover-item--font-size: 0.875rem;
52
- --sc-kit--popover-item--min-width: 11.25rem;
53
- --sc-kit--popover-item--padding: 0.75rem 1.25rem;
54
- --sc-kit--icon-text--text--font-size: 0.875rem;
55
- --sc-kit--icon-text--icon--font-size: 1.125rem;
56
51
  }</style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.9.19",
3
+ "version": "0.10.1",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",