@streamscloud/kit 0.10.3 → 0.10.5

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.
@@ -103,6 +103,7 @@ Pass `type="anchor"` to render as `<a>` with `href`. Otherwise `type` is the nat
103
103
  | `--sc-kit--button--padding-inline` | Inline (horizontal) padding | per size |
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
+ | `--sc-kit--button--icon-size` | Icon / spinner size | per size (12 / 14 / 16 / 20 px for xs/sm/md/lg) |
106
107
  | `--sc-kit--button--border-radius` | Corner rounding | `var(--sc-kit--radius--md)` |
107
108
  | `--sc-kit--button--font-weight` | Font weight | `var(--sc-kit--font-weight--regular)` |
108
109
  | `--sc-kit--button--width` | Explicit width | `fit-content` |
@@ -118,10 +119,11 @@ Pass `type="anchor"` to render as `<a>` with `href`. Otherwise `type` is the nat
118
119
  --_btn--border: var(--sc-kit--button--border, 1px solid transparent);
119
120
  --_btn--box-shadow: var(--sc-kit--button--box-shadow, inset 0 2px 0 rgba(255, 255, 255, 0.3));
120
121
  --_btn--focus-ring-color: var(--sc-kit--button--focus-ring-color, var(--sc-kit--color--border--focus));
121
- --_btn--height: var(--sc-kit--button--height, 2rem);
122
- --_btn--padding-inline: var(--sc-kit--button--padding-inline, var(--sc-kit--space--4));
123
- --_btn--font-size: var(--sc-kit--button--font-size, var(--sc-kit--font-size--md));
124
- --_btn--gap: var(--sc-kit--button--gap, var(--sc-kit--space--2));
122
+ --_btn--height: var(--sc-kit--button--height, var(--_btn--size-height));
123
+ --_btn--padding-inline: var(--sc-kit--button--padding-inline, var(--_btn--size-padding-inline));
124
+ --_btn--font-size: var(--sc-kit--button--font-size, var(--_btn--size-font-size));
125
+ --_btn--gap: var(--sc-kit--button--gap, var(--_btn--size-gap));
126
+ --_btn--icon-size: var(--sc-kit--button--icon-size, var(--_btn--size-icon-size));
125
127
  --_btn--width: var(--sc-kit--button--width, fit-content);
126
128
  --_btn--min-width: var(--sc-kit--button--min-width, 0);
127
129
  --_btn--max-width: var(--sc-kit--button--max-width, 100%);
@@ -173,15 +175,16 @@ Pass `type="anchor"` to render as `<a>` with `href`. Otherwise `type` is the nat
173
175
  text-overflow: ellipsis;
174
176
  }
175
177
  .btn__icon {
178
+ --sc-kit--icon--size: var(--_btn--icon-size);
176
179
  flex-shrink: 0;
177
180
  display: inline-flex;
178
181
  align-items: center;
179
182
  justify-content: center;
180
- width: var(--sc-kit--icon--size);
181
- height: var(--sc-kit--icon--size);
183
+ width: var(--_btn--icon-size);
184
+ height: var(--_btn--icon-size);
182
185
  }
183
186
  .btn__spinner {
184
- --sc-kit--spinner--size: var(--sc-kit--icon--size);
187
+ --sc-kit--spinner--size: var(--_btn--icon-size);
185
188
  flex-shrink: 0;
186
189
  display: inline-flex;
187
190
  align-items: center;
@@ -194,26 +197,33 @@ Pass `type="anchor"` to render as `<a>` with `href`. Otherwise `type` is the nat
194
197
  .btn--disabled {
195
198
  cursor: default;
196
199
  }
200
+ .btn--xs {
201
+ --_btn--size-height: 1.5rem;
202
+ --_btn--size-padding-inline: var(--sc-kit--space--2);
203
+ --_btn--size-font-size: var(--sc-kit--font-size--xs);
204
+ --_btn--size-gap: var(--sc-kit--space--1);
205
+ --_btn--size-icon-size: 0.875rem;
206
+ }
197
207
  .btn--sm {
198
- --sc-kit--button--height: 1.75rem;
199
- --sc-kit--button--padding-inline: var(--sc-kit--space--3);
200
- --sc-kit--button--font-size: var(--sc-kit--font-size--sm);
201
- --sc-kit--button--gap: var(--sc-kit--space--1);
202
- --sc-kit--icon--size: 0.875rem;
208
+ --_btn--size-height: 1.75rem;
209
+ --_btn--size-padding-inline: var(--sc-kit--space--3);
210
+ --_btn--size-font-size: var(--sc-kit--font-size--sm);
211
+ --_btn--size-gap: var(--sc-kit--space--1);
212
+ --_btn--size-icon-size: 0.875rem;
203
213
  }
204
214
  .btn--md {
205
- --sc-kit--button--height: 2rem;
206
- --sc-kit--button--padding-inline: var(--sc-kit--space--4);
207
- --sc-kit--button--font-size: var(--sc-kit--font-size--md);
208
- --sc-kit--button--gap: var(--sc-kit--space--2);
209
- --sc-kit--icon--size: 1rem;
215
+ --_btn--size-height: 2rem;
216
+ --_btn--size-padding-inline: var(--sc-kit--space--4);
217
+ --_btn--size-font-size: var(--sc-kit--font-size--md);
218
+ --_btn--size-gap: var(--sc-kit--space--2);
219
+ --_btn--size-icon-size: 1rem;
210
220
  }
211
221
  .btn--lg {
212
- --sc-kit--button--height: 2.5rem;
213
- --sc-kit--button--padding-inline: var(--sc-kit--space--6);
214
- --sc-kit--button--font-size: var(--sc-kit--font-size--lg);
215
- --sc-kit--button--gap: var(--sc-kit--space--2);
216
- --sc-kit--icon--size: 1.25rem;
222
+ --_btn--size-height: 2.5rem;
223
+ --_btn--size-padding-inline: var(--sc-kit--space--6);
224
+ --_btn--size-font-size: var(--sc-kit--font-size--lg);
225
+ --_btn--size-gap: var(--sc-kit--space--2);
226
+ --_btn--size-icon-size: 1.25rem;
217
227
  }
218
228
  .btn--icon-only {
219
229
  --sc-kit--button--padding-inline: 0;
@@ -61,6 +61,7 @@ type Props = ButtonModeProps | AnchorModeProps;
61
61
  * | `--sc-kit--button--padding-inline` | Inline (horizontal) padding | per size |
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
+ * | `--sc-kit--button--icon-size` | Icon / spinner size | per size (12 / 14 / 16 / 20 px for xs/sm/md/lg) |
64
65
  * | `--sc-kit--button--border-radius` | Corner rounding | `var(--sc-kit--radius--md)` |
65
66
  * | `--sc-kit--button--font-weight` | Font weight | `var(--sc-kit--font-weight--regular)` |
66
67
  * | `--sc-kit--button--width` | Explicit width | `fit-content` |
@@ -1,2 +1,2 @@
1
1
  export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'info' | 'success' | 'warning' | 'danger';
2
- export type ButtonSize = 'sm' | 'md' | 'lg';
2
+ export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
@@ -1,4 +1,5 @@
1
- <script lang="ts">let { orientation = 'horizontal', label } = $props();
1
+ <script lang="ts">"use strict";
2
+ let { orientation = 'horizontal', label } = $props();
2
3
  </script>
3
4
 
4
5
  {#if label}
@@ -1,4 +1,5 @@
1
- <script lang="ts">const { seconds, variant = 'raw', showZero = false } = $props();
1
+ <script lang="ts">"use strict";
2
+ const { seconds, variant = 'raw', showZero = false } = $props();
2
3
  const format = (secs) => {
3
4
  const total = Math.max(0, Math.round(secs));
4
5
  const hours = Math.floor(total / 3600);
@@ -6,7 +6,7 @@ const { label, actions } = $props();
6
6
  <GridCardField label={label}>
7
7
  <div class="grid-card-actions-field">
8
8
  {#each actions as action (action)}
9
- <GridCardButton icon={action.icon} text={action.text} on={action.on} />
9
+ <GridCardButton icon={action.icon} text={action.text} variant={action.variant} on={action.on} />
10
10
  {/each}
11
11
  </div>
12
12
  </GridCardField>
@@ -1,8 +1,11 @@
1
+ import type { ButtonVariant } from '../../button';
1
2
  import type { IconProp } from '../../icon';
2
3
  export type GridCardAction = {
3
4
  /** Use the `{ src, color }` object form to tint the icon (e.g. `'danger'` for delete) without coloring the whole button. */
4
5
  icon: IconProp;
5
6
  text?: string;
7
+ /** @default 'ghost' */
8
+ variant?: ButtonVariant;
6
9
  on: {
7
10
  click: (e: MouseEvent) => void;
8
11
  };
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">import { Button } from '../../button';
2
2
  import { IconText } from '../../icon-text';
3
- const { icon, text, on } = $props();
3
+ const { icon, text, variant = 'ghost', on } = $props();
4
4
  const handleClick = (e) => {
5
5
  e.stopPropagation();
6
6
  on.click(e);
@@ -8,7 +8,7 @@ const handleClick = (e) => {
8
8
  </script>
9
9
 
10
10
  <span class="grid-card-button">
11
- <Button type="button" variant="ghost" size="sm" on={{ click: handleClick }}>
11
+ <Button type="button" variant={variant} size="xs" on={{ click: handleClick }}>
12
12
  <IconText icon={icon} hideText={!text} trimText>
13
13
  {#if text}{text}{/if}
14
14
  </IconText>
@@ -17,10 +17,10 @@ const handleClick = (e) => {
17
17
 
18
18
  <!--
19
19
  @component
20
- Internal compact action button for `GridCard` rows. Kit `Button` `size='sm'` + `variant='ghost'`
21
- wrapping an `IconText` so individual action icons can be tinted (e.g. `{ src, color: 'danger' }`
22
- on delete) without coloring the whole button. Click handler stops propagation so it doesn't fire
23
- the card's `on.activate`.
20
+ Internal compact action button for `GridCard` rows. Kit `Button` (`size='xs'`, `variant='ghost'` by
21
+ default — override via `variant`) wrapping an `IconText` so individual action icons can be tinted
22
+ (e.g. `{ src, color: 'danger' }` on delete) without coloring the whole button. Click handler stops
23
+ propagation so it doesn't fire the card's `on.activate`.
24
24
  -->
25
25
 
26
26
  <style>.grid-card-button {
@@ -1,16 +1,19 @@
1
+ import { type ButtonVariant } from '../../button';
1
2
  import type { IconProp } from '../../icon';
2
3
  type Props = {
3
4
  icon: IconProp;
4
5
  text?: string;
6
+ /** @default 'ghost' */
7
+ variant?: ButtonVariant;
5
8
  on: {
6
9
  click: (e: MouseEvent) => void;
7
10
  };
8
11
  };
9
12
  /**
10
- * Internal compact action button for `GridCard` rows. Kit `Button` `size='sm'` + `variant='ghost'`
11
- * wrapping an `IconText` so individual action icons can be tinted (e.g. `{ src, color: 'danger' }`
12
- * on delete) without coloring the whole button. Click handler stops propagation so it doesn't fire
13
- * the card's `on.activate`.
13
+ * Internal compact action button for `GridCard` rows. Kit `Button` (`size='xs'`, `variant='ghost'` by
14
+ * default — override via `variant`) wrapping an `IconText` so individual action icons can be tinted
15
+ * (e.g. `{ src, color: 'danger' }` on delete) without coloring the whole button. Click handler stops
16
+ * propagation so it doesn't fire the card's `on.activate`.
14
17
  */
15
18
  declare const Cmp: import("svelte").Component<Props, {}, "">;
16
19
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,4 +1,5 @@
1
- <script lang="ts">const { label = 'Id:', text } = $props();
1
+ <script lang="ts">"use strict";
2
+ const { label = 'Id:', text } = $props();
2
3
  </script>
3
4
 
4
5
  <div class="grid-card-id-field">
@@ -1,4 +1,5 @@
1
- <script lang="ts">let { mark = false, subheading = null, variant = 'mono', ariaLabel } = $props();
1
+ <script lang="ts">"use strict";
2
+ let { mark = false, subheading = null, variant = 'mono', ariaLabel } = $props();
2
3
  // Resolve fills per variant. `mono` keeps the existing currentColor behavior;
3
4
  // `standard` paints the mark in the brand accent and the type in primary text,
4
5
  // matching the Figma master Standard lockup.
@@ -1,4 +1,5 @@
1
- <script lang="ts"></script>
1
+ <script lang="ts">"use strict";
2
+ </script>
2
3
 
3
4
  <div class="nav-menu-divider" role="separator"></div>
4
5
 
@@ -1,4 +1,5 @@
1
- <script lang="ts">const { value, length = 6, mask = false, disabled = false, error = false, 'aria-label': ariaLabel, on } = $props();
1
+ <script lang="ts">"use strict";
2
+ const { value, length = 6, mask = false, disabled = false, error = false, 'aria-label': ariaLabel, on } = $props();
2
3
  let cells = $state([]);
3
4
  const cellValue = (i) => value[i] ?? '';
4
5
  const emit = (next) => {
@@ -1,4 +1,5 @@
1
- <script lang="ts">let { value, size = 'md', color, label } = $props();
1
+ <script lang="ts">"use strict";
2
+ let { value, size = 'md', color, label } = $props();
2
3
  const clamped = $derived(Math.max(0, Math.min(1, value)));
3
4
  const cssWidth = $derived(`${100 * clamped}%`);
4
5
  const percent = $derived(Math.round(100 * clamped));
@@ -1,4 +1,5 @@
1
- <script lang="ts">const { selected, title, description, disabled = false, name, on } = $props();
1
+ <script lang="ts">"use strict";
2
+ const { selected, title, description, disabled = false, name, on } = $props();
2
3
  const handleClick = (event) => {
3
4
  event.stopPropagation();
4
5
  if (disabled || selected) {
@@ -1,7 +1,8 @@
1
1
  <script lang="ts" module>export {};
2
2
  </script>
3
3
 
4
- <script lang="ts" generics="T">const { value, segments, variant = 'tray', size = 'md', fullWidth = false, compare, on } = $props();
4
+ <script lang="ts" generics="T">"use strict";
5
+ const { value, segments, variant = 'tray', size = 'md', fullWidth = false, compare, on } = $props();
5
6
  const isActive = (segment) => (compare ? compare(value, segment.value) : value === segment.value);
6
7
  const handleClick = (segment) => {
7
8
  if (segment.disabled || isActive(segment)) {
@@ -1,4 +1,5 @@
1
- <script lang="ts">let { shape = 'rect', lines = 1 } = $props();
1
+ <script lang="ts">"use strict";
2
+ let { shape = 'rect', lines = 1 } = $props();
2
3
  </script>
3
4
 
4
5
  {#if shape === 'text' && lines > 1}
@@ -1,4 +1,5 @@
1
- <script lang="ts">let { value, min = 0, max = 100, step = 1, disabled = false, showValue = false, withInput = false, ticks = [], valueSuffix = '', on } = $props();
1
+ <script lang="ts">"use strict";
2
+ let { value, min = 0, max = 100, step = 1, disabled = false, showValue = false, withInput = false, ticks = [], valueSuffix = '', on } = $props();
2
3
  let focused = $state(false);
3
4
  const fillPct = $derived(max === min ? 0 : ((value - min) / (max - min)) * 100);
4
5
  const handleInput = (e) => {
@@ -1,4 +1,5 @@
1
- <script lang="ts">let { size = 'md', color, label, position, blocking = false, timeout = 0 } = $props();
1
+ <script lang="ts">"use strict";
2
+ let { size = 'md', color, label, position, blocking = false, timeout = 0 } = $props();
2
3
  let visible = $state(false);
3
4
  $effect(() => {
4
5
  if (timeout <= 0) {
@@ -6,7 +6,7 @@ const variant = $derived(column.variantFactory ? column.variantFactory(item) : '
6
6
 
7
7
  {#if getValueForColumn(column, item) !== null}
8
8
  <div class="table-badge-cell">
9
- <Badge variant={variant}>{getValueForColumn(column, item)}</Badge>
9
+ <Badge variant={variant} fullWidth={column.fullWidth}>{getValueForColumn(column, item)}</Badge>
10
10
  </div>
11
11
  {/if}
12
12
 
@@ -40,6 +40,8 @@ export interface ITableBadgeColumn<T> extends ITableColumn<T> {
40
40
  type: 'badge';
41
41
  variantFactory?: ((item: T) => BadgeVariant) | null;
42
42
  valueFactory?: ((item: T) => string) | null;
43
+ /** Stretch the badge to fill the column width. @default false */
44
+ fullWidth?: boolean;
43
45
  }
44
46
  export interface ITableByColumn<T> extends ITableColumn<T> {
45
47
  type: 'by';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",
@@ -519,7 +519,7 @@
519
519
  "nanoid": "^5.1.11",
520
520
  "p-limit": "^7.3.0",
521
521
  "prettier": "^3.8.3",
522
- "prettier-plugin-svelte": "^3.5.2",
522
+ "prettier-plugin-svelte": "^4.1.0",
523
523
  "publint": "^0.3.21",
524
524
  "rfdc": "^1.4.1",
525
525
  "sass": "^1.99.0",
@@ -528,7 +528,7 @@
528
528
  "svelte-check": "^4.4.8",
529
529
  "svelte-dnd-action": "^0.9.69",
530
530
  "svelte-preprocess": "^6.0.3",
531
- "typescript": "^5.9.3",
531
+ "typescript": "^6.0.3",
532
532
  "typescript-eslint": "^8.59.3",
533
533
  "vite": "^8.0.13",
534
534
  "vite-tsconfig-paths": "^6.1.1",