@streamscloud/kit 0.24.0 → 0.25.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.
@@ -65,16 +65,22 @@
65
65
  // COLOR — TONES (categorical palette; fg + soft bg, component-neutral)
66
66
  // ============================================================
67
67
  --sc-kit--tone--gray--fg: light-dark(#{$color-neutral-500}, #{$color-neutral-400});
68
+ --sc-kit--tone--gray--muted: light-dark(#{$color-neutral-400}, #{$color-neutral-600});
68
69
  --sc-kit--tone--gray--bg: light-dark(#{$color-neutral-50}, #{$color-dark-600});
69
70
  --sc-kit--tone--blue--fg: light-dark(#{$color-blue-500}, #{$color-blue-400});
71
+ --sc-kit--tone--blue--muted: light-dark(#{$color-blue-200}, #{$color-blue-700});
70
72
  --sc-kit--tone--blue--bg: light-dark(#{$color-blue-50}, #{$color-blue-900});
71
73
  --sc-kit--tone--green--fg: light-dark(#{$color-green-500}, #{$color-green-400});
74
+ --sc-kit--tone--green--muted: light-dark(#{$color-green-200}, #{$color-green-700});
72
75
  --sc-kit--tone--green--bg: light-dark(#{$color-green-50}, #{$color-green-900});
73
76
  --sc-kit--tone--red--fg: light-dark(#{$color-red-500}, #{$color-red-400});
77
+ --sc-kit--tone--red--muted: light-dark(#{$color-red-200}, #{$color-red-700});
74
78
  --sc-kit--tone--red--bg: light-dark(#{$color-red-50}, #{$color-red-900});
75
79
  --sc-kit--tone--orange--fg: light-dark(#{$color-orange-500}, #{$color-orange-400});
80
+ --sc-kit--tone--orange--muted: light-dark(#{$color-orange-200}, #{$color-orange-700});
76
81
  --sc-kit--tone--orange--bg: light-dark(#{$color-orange-100}, #{$color-orange-900});
77
82
  --sc-kit--tone--teal--fg: light-dark(#3d7068, #5f938a);
83
+ --sc-kit--tone--teal--muted: light-dark(#3d7068, #5f938a);
78
84
  --sc-kit--tone--teal--bg: light-dark(#eef4f3, #16302b);
79
85
 
80
86
  // ============================================================
@@ -1,12 +1,16 @@
1
- <script lang="ts" generics="S">import ToolbarFilterSelect from './cmp.toolbar-filter-select.svelte';
1
+ <script lang="ts" generics="S">import { Button } from '../button';
2
+ import { IconText } from '../icon-text';
3
+ import ToolbarFilterSelect from './cmp.toolbar-filter-select.svelte';
2
4
  import ToolbarIconButton from './cmp.toolbar-icon-button.svelte';
3
5
  import ToolbarSectionTitle from './cmp.toolbar-section-title.svelte';
4
6
  import { ToolbarSortSelectLocalization } from './toolbar-sort-select-localization';
7
+ import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
5
8
  import IconFilter from '@fluentui/svg-icons/icons/filter_20_regular.svg?raw';
6
- const { options, value, label, size = 'sm', trigger, compare, on } = $props();
9
+ const { options, value, label, size = 'sm', trigger = 'icon', compare, on } = $props();
7
10
  const localization = new ToolbarSortSelectLocalization();
8
11
  const orderByLabel = $derived(label ?? localization.orderBy);
9
12
  const selection = $derived([value]);
13
+ const resolvedTrigger = $derived(typeof trigger === 'function' ? trigger : trigger === 'button' ? buttonTrigger : iconTrigger);
10
14
  const onChange = (next) => {
11
15
  if (next.length > 0) {
12
16
  on?.change?.(next[0]);
@@ -14,10 +18,16 @@ const onChange = (next) => {
14
18
  };
15
19
  </script>
16
20
 
17
- {#snippet defaultTrigger()}
21
+ {#snippet iconTrigger()}
18
22
  <ToolbarIconButton presentational icon={IconFilter} size={size} />
19
23
  {/snippet}
20
24
 
25
+ {#snippet buttonTrigger()}
26
+ <Button type="presentational" variant="secondary" size={size}>
27
+ <IconText icon={IconFilter} secondaryIcon={IconChevronDown} size={size} iconScale="large" trimText>{localization.sorting}</IconText>
28
+ </Button>
29
+ {/snippet}
30
+
21
31
  <ToolbarFilterSelect
22
32
  label={orderByLabel}
23
33
  single
@@ -26,7 +36,7 @@ const onChange = (next) => {
26
36
  options={options}
27
37
  value={selection}
28
38
  compare={compare}
29
- trigger={trigger ?? defaultTrigger}
39
+ trigger={resolvedTrigger}
30
40
  on={{ change: onChange }}>
31
41
  {#snippet header()}
32
42
  <ToolbarSectionTitle>{orderByLabel}</ToolbarSectionTitle>
@@ -35,7 +45,8 @@ const onChange = (next) => {
35
45
 
36
46
  <!--
37
47
  @component
38
- A toolbar sort control: a `ToolbarFilterSelect` in single-select mode behind a flat icon trigger
39
- (`ToolbarIconButton` by default, or a custom `trigger` snippet), with an `Order by` section title above the
40
- options. Stand-alone, or composed into `ToolbarViewControls` via its `prepend` snippet.
48
+ A toolbar sort control: a `ToolbarFilterSelect` in single-select mode behind a `trigger` — `'icon'`
49
+ (default, flat icon button), `'button'` (labelled secondary button), or a custom snippet with an
50
+ `Order by` section title above the options. Stand-alone, or composed into `ToolbarViewControls` via
51
+ its `prepend` snippet.
41
52
  -->
@@ -8,8 +8,8 @@ declare function $$render<S>(): {
8
8
  label?: string;
9
9
  /** Button size preset — sm = 28px, md = 32px. @default 'sm' */
10
10
  size?: "sm" | "md";
11
- /** Custom presentational trigger content replaces the default filter-icon button (the popover owns the click and is named by `label`). */
12
- trigger?: Snippet;
11
+ /** Presentational trigger — `'icon'` (flat icon button), `'button'` (labelled secondary button), or a custom snippet. The popover owns the click and is named by `label`. @default 'icon' */
12
+ trigger?: "icon" | "button" | Snippet;
13
13
  /** Equality comparator — required when `S` is an object. */
14
14
  compare?: (a: S, b: S) => boolean;
15
15
  on?: {
@@ -36,9 +36,10 @@ interface $$IsomorphicComponent {
36
36
  z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
37
37
  }
38
38
  /**
39
- * A toolbar sort control: a `ToolbarFilterSelect` in single-select mode behind a flat icon trigger
40
- * (`ToolbarIconButton` by default, or a custom `trigger` snippet), with an `Order by` section title above the
41
- * options. Stand-alone, or composed into `ToolbarViewControls` via its `prepend` snippet.
39
+ * A toolbar sort control: a `ToolbarFilterSelect` in single-select mode behind a `trigger` — `'icon'`
40
+ * (default, flat icon button), `'button'` (labelled secondary button), or a custom snippet with an
41
+ * `Order by` section title above the options. Stand-alone, or composed into `ToolbarViewControls` via
42
+ * its `prepend` snippet.
42
43
  */
43
44
  declare const Cmp: $$IsomorphicComponent;
44
45
  type Cmp<S> = InstanceType<typeof Cmp<S>>;
@@ -1,3 +1,4 @@
1
1
  export declare class ToolbarSortSelectLocalization {
2
2
  get orderBy(): string;
3
+ get sorting(): string;
3
4
  }
@@ -1,9 +1,13 @@
1
1
  import { AppLocale } from '../../core/locale';
2
2
  const loc = {
3
- orderBy: { en: 'Order by', no: 'Sorter etter' }
3
+ orderBy: { en: 'Order by', no: 'Sorter etter' },
4
+ sorting: { en: 'Sorting', no: 'Sortering' }
4
5
  };
5
6
  export class ToolbarSortSelectLocalization {
6
7
  get orderBy() {
7
8
  return loc.orderBy[AppLocale.current];
8
9
  }
10
+ get sorting() {
11
+ return loc.sorting[AppLocale.current];
12
+ }
9
13
  }
@@ -1,18 +1,18 @@
1
1
  <script lang="ts">import { Tooltip } from '../tooltip';
2
2
  import { ProgressBarLocalization } from './progress-bar-localization';
3
3
  import { PROGRESS_BAR_TONES } from './types';
4
- const { stage, stages, showLabel = true } = $props();
4
+ const { stage, stages, variant = 'bar', showLabel = true } = $props();
5
5
  const localization = new ProgressBarLocalization();
6
6
  const currentStage = $derived(stages[Math.max(0, Math.min(stage, stages.length - 1))]);
7
7
  const currentLabel = $derived(currentStage?.label ?? '');
8
8
  const tooltipLabel = $derived(!showLabel ? currentLabel : '');
9
9
  const segmentColor = (s) => {
10
10
  const value = s.color ?? 'gray';
11
- return PROGRESS_BAR_TONES.includes(value) ? `var(--sc-kit--tone--${value}--fg)` : value;
11
+ return PROGRESS_BAR_TONES.includes(value) ? `var(--sc-kit--tone--${value}--muted)` : value;
12
12
  };
13
13
  </script>
14
14
 
15
- <div class="progress-bar">
15
+ <div class="progress-bar" class:progress-bar--pips={variant === 'pips'}>
16
16
  {#if tooltipLabel}
17
17
  <Tooltip text={tooltipLabel}>
18
18
  {@render track()}
@@ -45,45 +45,65 @@ const segmentColor = (s) => {
45
45
  Multi-stage workflow progress indicator. Pass `stages` as an array of `{ color, label? }`
46
46
  descriptors — the bar renders one segment per stage; segments `0..stage` (inclusive) are filled,
47
47
  the rest use the empty-segment color. Each stage's `color` is either a named tone from the shared
48
- palette (same schemes as `Badge`, e.g. `'green'`) or a raw CSS color / `var(--sc-kit--*)`. Useful
48
+ palette (resolved to its muted shade, e.g. `'green'` → `--sc-kit--tone--green--muted`) or a raw CSS
49
+ color / `var(--sc-kit--*)`. Useful
49
50
  for content-lifecycle indicators (Ideas → Draft → Review → Scheduled → Published) in cards, table
50
- cells, or post pages. `showLabel={false}` drops the inline current-stage label (e.g. in a compact
51
- table cell) and surfaces it in a hover tooltip instead.
51
+ cells, or post pages. `variant="pips"` renders compact fixed-size ticks (left-aligned) instead of
52
+ full-width segments for dense table cells. `showLabel={false}` drops the inline current-stage
53
+ label (e.g. in a compact table cell) and surfaces it in a hover tooltip instead.
52
54
 
53
55
  ### CSS Custom Properties
54
56
  | Property | Description | Default |
55
57
  |---|---|---|
56
- | `--sc-kit--progress-bar--segment--height` | Bar segment height | `4px` |
57
- | `--sc-kit--progress-bar--segment--gap` | Gap between segments | `2px` |
58
+ | `--sc-kit--progress-bar--segment--height` | Segment height | `bar` 4px / `pips` 12px |
59
+ | `--sc-kit--progress-bar--segment--width` | Segment width | `bar` auto (stretches) / `pips` 6px |
60
+ | `--sc-kit--progress-bar--segment--gap` | Gap between segments | `bar` 2px / `pips` 4px |
61
+ | `--sc-kit--progress-bar--segment--border-radius` | Segment corner radius | `bar` 1px / `pips` 2px |
58
62
  | `--sc-kit--progress-bar--segment--background--empty` | Empty segment color | `var(--sc-kit--color--bg--active)` |
59
63
  | `--sc-kit--progress-bar--track--padding-block` | Vertical padding around the bar (enlarges the hover/click target) | `5px` |
60
64
  -->
61
65
 
62
66
  <style>.progress-bar {
63
- --_pb--seg-height: var(--sc-kit--progress-bar--segment--height, 0.25rem);
64
- --_pb--seg-gap: var(--sc-kit--progress-bar--segment--gap, 0.125rem);
67
+ --_pb--seg-height: var(--sc-kit--progress-bar--segment--height, var(--_pb--seg-height-default, 0.25rem));
68
+ --_pb--seg-gap: var(--sc-kit--progress-bar--segment--gap, var(--_pb--seg-gap-default, 0.125rem));
69
+ --_pb--seg-width: var(--sc-kit--progress-bar--segment--width, var(--_pb--seg-width-default, auto));
70
+ --_pb--seg-radius: var(--sc-kit--progress-bar--segment--border-radius, var(--_pb--seg-radius-default, 0.0625rem));
65
71
  --_pb--seg-empty: var(--sc-kit--progress-bar--segment--background--empty, var(--sc-kit--color--bg--active));
66
72
  --_pb--track-padding-block: var(--sc-kit--progress-bar--track--padding-block, 0.3125rem);
73
+ --_pb--seg-flex: 1;
74
+ --_pb--track-width: 100%;
67
75
  display: flex;
68
76
  flex-direction: column;
69
77
  gap: 0.125rem;
78
+ width: 100%;
70
79
  min-width: 0;
71
80
  }
81
+ .progress-bar--pips {
82
+ --_pb--seg-height-default: 0.75rem;
83
+ --_pb--seg-gap-default: 0.25rem;
84
+ --_pb--seg-width-default: 0.375rem;
85
+ --_pb--seg-radius-default: 0.125rem;
86
+ --_pb--seg-flex: 0 0 auto;
87
+ --_pb--track-width: auto;
88
+ align-items: flex-start;
89
+ }
72
90
  .progress-bar__track {
73
91
  display: flex;
74
92
  align-items: center;
75
93
  gap: var(--_pb--seg-gap);
76
- width: 100%;
94
+ width: var(--_pb--track-width);
77
95
  padding-block: var(--_pb--track-padding-block);
78
96
  }
79
97
  .progress-bar__segment {
80
- flex: 1;
98
+ --_pb--seg-color: var(--_--pb--segment-color);
99
+ flex: var(--_pb--seg-flex);
100
+ width: var(--_pb--seg-width);
81
101
  height: var(--_pb--seg-height);
82
102
  background: var(--_pb--seg-empty);
83
- border-radius: 0.0625rem;
103
+ border-radius: var(--_pb--seg-radius);
84
104
  }
85
105
  .progress-bar__segment--filled {
86
- background: var(--_--pb--segment-color);
106
+ background: var(--_pb--seg-color);
87
107
  }
88
108
  .progress-bar__label {
89
109
  font-size: 0.625rem;
@@ -7,6 +7,8 @@ type Props = {
7
7
  * Length determines the total segment count.
8
8
  */
9
9
  stages: ProgressBarStage[];
10
+ /** Segment shape — `bar` = full-width stretched segments, `pips` = compact fixed-size ticks (e.g. a table cell). @default 'bar' */
11
+ variant?: 'bar' | 'pips';
10
12
  /** Show the current stage's label below the bar. When `false`, the label surfaces in a tooltip on hover instead. @default true */
11
13
  showLabel?: boolean;
12
14
  };
@@ -14,16 +16,20 @@ type Props = {
14
16
  * Multi-stage workflow progress indicator. Pass `stages` as an array of `{ color, label? }`
15
17
  * descriptors — the bar renders one segment per stage; segments `0..stage` (inclusive) are filled,
16
18
  * the rest use the empty-segment color. Each stage's `color` is either a named tone from the shared
17
- * palette (same schemes as `Badge`, e.g. `'green'`) or a raw CSS color / `var(--sc-kit--*)`. Useful
19
+ * palette (resolved to its muted shade, e.g. `'green'` → `--sc-kit--tone--green--muted`) or a raw CSS
20
+ * color / `var(--sc-kit--*)`. Useful
18
21
  * for content-lifecycle indicators (Ideas → Draft → Review → Scheduled → Published) in cards, table
19
- * cells, or post pages. `showLabel={false}` drops the inline current-stage label (e.g. in a compact
20
- * table cell) and surfaces it in a hover tooltip instead.
22
+ * cells, or post pages. `variant="pips"` renders compact fixed-size ticks (left-aligned) instead of
23
+ * full-width segments for dense table cells. `showLabel={false}` drops the inline current-stage
24
+ * label (e.g. in a compact table cell) and surfaces it in a hover tooltip instead.
21
25
  *
22
26
  * ### CSS Custom Properties
23
27
  * | Property | Description | Default |
24
28
  * |---|---|---|
25
- * | `--sc-kit--progress-bar--segment--height` | Bar segment height | `4px` |
26
- * | `--sc-kit--progress-bar--segment--gap` | Gap between segments | `2px` |
29
+ * | `--sc-kit--progress-bar--segment--height` | Segment height | `bar` 4px / `pips` 12px |
30
+ * | `--sc-kit--progress-bar--segment--width` | Segment width | `bar` auto (stretches) / `pips` 6px |
31
+ * | `--sc-kit--progress-bar--segment--gap` | Gap between segments | `bar` 2px / `pips` 4px |
32
+ * | `--sc-kit--progress-bar--segment--border-radius` | Segment corner radius | `bar` 1px / `pips` 2px |
27
33
  * | `--sc-kit--progress-bar--segment--background--empty` | Empty segment color | `var(--sc-kit--color--bg--active)` |
28
34
  * | `--sc-kit--progress-bar--track--padding-block` | Vertical padding around the bar (enlarges the hover/click target) | `5px` |
29
35
  */
@@ -5,7 +5,6 @@ import { default as TableBadgeCell } from './table-badge-cell.svelte';
5
5
  import { default as TableButtonCell } from './table-button-cell.svelte';
6
6
  import { default as TableByCell } from './table-by-cell.svelte';
7
7
  import { default as TableCheckboxCell } from './table-checkbox-cell.svelte';
8
- import { default as TableCustomCell } from './table-custom-cell.svelte';
9
8
  import { default as TableIconCell } from './table-icon-cell.svelte';
10
9
  import { default as TableImageCell } from './table-image-cell.svelte';
11
10
  import { default as TableMoveRowCell } from './table-move-row-cell.svelte';
@@ -52,8 +51,6 @@ const changeItemPosition = (target, positionChange) => {
52
51
  <TableByCell column={def} item={item} />
53
52
  {:else if def.type === 'checkbox'}
54
53
  <TableCheckboxCell item={item} selection={model.selection} />
55
- {:else if def.type === 'custom'}
56
- <TableCustomCell column={def} item={item} />
57
54
  {:else if def.type === 'icon'}
58
55
  <TableIconCell column={def} item={item} centered={column.centered} />
59
56
  {:else if def.type === 'image'}
@@ -1,15 +1,14 @@
1
1
  import type { Repository } from '../../core/repository';
2
2
  import type { BadgeShape, BadgeVariant } from '../badge';
3
3
  import type { ButtonSize, ButtonVariant } from '../button';
4
- import { DynamicComponentModel } from '../dynamic-component';
5
4
  import type { IconProp } from '../icon';
6
5
  import type { Snippet } from 'svelte';
7
6
  export type WithId = {
8
7
  id: string;
9
8
  };
10
9
  export type IAnyTableColumn<T> = IOneOfTableColumn<T>;
11
- export type IOneOfTableColumn<T> = ITableBadgeColumn<T> | ITableButtonColumn<T> | ITableByColumn<T> | ITableCheckboxColumn | ITableCustomColumn<T> | ITableIconColumn<T> | ITableImageColumn<T> | ITableMoveRowColumn | ITableSnippetColumn<T> | ITableTextColumn<T>;
12
- export type TableColumnType = 'actions' | 'badge' | 'button' | 'by' | 'checkbox' | 'custom' | 'icon' | 'image' | 'move-row' | 'snippet' | 'text';
10
+ export type IOneOfTableColumn<T> = ITableBadgeColumn<T> | ITableButtonColumn<T> | ITableByColumn<T> | ITableCheckboxColumn | ITableIconColumn<T> | ITableImageColumn<T> | ITableMoveRowColumn | ITableSnippetColumn<T> | ITableTextColumn<T>;
11
+ export type TableColumnType = 'actions' | 'badge' | 'button' | 'by' | 'checkbox' | 'icon' | 'image' | 'move-row' | 'snippet' | 'text';
13
12
  interface ITableColumnBase {
14
13
  type: TableColumnType;
15
14
  fixedCssWidth?: string;
@@ -70,10 +69,6 @@ export interface ITableButtonColumn<T> extends ITableColumn<T> {
70
69
  export interface ITableCheckboxColumn extends ITableColumnBase {
71
70
  type: 'checkbox';
72
71
  }
73
- export interface ITableCustomColumn<T> extends ITableColumn<T> {
74
- type: 'custom';
75
- componentFactory: (item: T) => DynamicComponentModel;
76
- }
77
72
  export interface ITableIconColumn<T> extends ITableColumn<T> {
78
73
  type: 'icon';
79
74
  iconFactory?: ((item: T) => IconProp) | null;
@@ -1 +1 @@
1
- import { DynamicComponentModel } from '../dynamic-component';
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.24.0",
3
+ "version": "0.25.1",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +0,0 @@
1
- <script lang="ts" generics="T extends {id: string}">import { DynamicComponent } from '../../dynamic-component';
2
- let { item, column } = $props();
3
- </script>
4
-
5
- <DynamicComponent model={column.componentFactory(item)} />
@@ -1,38 +0,0 @@
1
- import type { ITableCustomColumn } from '../types';
2
- declare function $$render<T extends {
3
- id: string;
4
- }>(): {
5
- props: {
6
- item: T;
7
- column: ITableCustomColumn<T>;
8
- };
9
- exports: {};
10
- bindings: "";
11
- slots: {};
12
- events: {};
13
- };
14
- declare class __sveltets_Render<T extends {
15
- id: string;
16
- }> {
17
- props(): ReturnType<typeof $$render<T>>['props'];
18
- events(): ReturnType<typeof $$render<T>>['events'];
19
- slots(): ReturnType<typeof $$render<T>>['slots'];
20
- bindings(): "";
21
- exports(): {};
22
- }
23
- interface $$IsomorphicComponent {
24
- new <T extends {
25
- id: string;
26
- }>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
27
- $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
28
- } & ReturnType<__sveltets_Render<T>['exports']>;
29
- <T extends {
30
- id: string;
31
- }>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
32
- z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
33
- }
34
- declare const TableCustomCell: $$IsomorphicComponent;
35
- type TableCustomCell<T extends {
36
- id: string;
37
- }> = InstanceType<typeof TableCustomCell<T>>;
38
- export default TableCustomCell;