@streamscloud/kit 0.24.0 → 0.25.0
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.
- package/dist/ui/page-toolbar/cmp.toolbar-sort-select.svelte +14 -7
- package/dist/ui/page-toolbar/cmp.toolbar-sort-select.svelte.d.ts +6 -5
- package/dist/ui/page-toolbar/toolbar-sort-select-localization.d.ts +1 -0
- package/dist/ui/page-toolbar/toolbar-sort-select-localization.js +5 -1
- package/dist/ui/progress-bar/cmp.progress-bar.svelte +31 -12
- package/dist/ui/progress-bar/cmp.progress-bar.svelte.d.ts +9 -4
- package/dist/ui/table/table-cells/table-cell.svelte +0 -3
- package/dist/ui/table/types.d.ts +2 -7
- package/dist/ui/table/types.js +1 -1
- package/package.json +1 -1
- package/dist/ui/table/table-cells/table-custom-cell.svelte +0 -5
- package/dist/ui/table/table-cells/table-custom-cell.svelte.d.ts +0 -38
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
<script lang="ts" generics="S">import
|
|
1
|
+
<script lang="ts" generics="S">import { Button } from '../button';
|
|
2
|
+
import ToolbarFilterSelect from './cmp.toolbar-filter-select.svelte';
|
|
2
3
|
import ToolbarIconButton from './cmp.toolbar-icon-button.svelte';
|
|
3
4
|
import ToolbarSectionTitle from './cmp.toolbar-section-title.svelte';
|
|
4
5
|
import { ToolbarSortSelectLocalization } from './toolbar-sort-select-localization';
|
|
5
6
|
import IconFilter from '@fluentui/svg-icons/icons/filter_20_regular.svg?raw';
|
|
6
|
-
const { options, value, label, size = 'sm', trigger, compare, on } = $props();
|
|
7
|
+
const { options, value, label, size = 'sm', trigger = 'icon', compare, on } = $props();
|
|
7
8
|
const localization = new ToolbarSortSelectLocalization();
|
|
8
9
|
const orderByLabel = $derived(label ?? localization.orderBy);
|
|
9
10
|
const selection = $derived([value]);
|
|
11
|
+
const resolvedTrigger = $derived(typeof trigger === 'function' ? trigger : trigger === 'button' ? buttonTrigger : iconTrigger);
|
|
10
12
|
const onChange = (next) => {
|
|
11
13
|
if (next.length > 0) {
|
|
12
14
|
on?.change?.(next[0]);
|
|
@@ -14,10 +16,14 @@ const onChange = (next) => {
|
|
|
14
16
|
};
|
|
15
17
|
</script>
|
|
16
18
|
|
|
17
|
-
{#snippet
|
|
19
|
+
{#snippet iconTrigger()}
|
|
18
20
|
<ToolbarIconButton presentational icon={IconFilter} size={size} />
|
|
19
21
|
{/snippet}
|
|
20
22
|
|
|
23
|
+
{#snippet buttonTrigger()}
|
|
24
|
+
<Button type="presentational" variant="secondary" size={size} icon={IconFilter}>{localization.sorting}</Button>
|
|
25
|
+
{/snippet}
|
|
26
|
+
|
|
21
27
|
<ToolbarFilterSelect
|
|
22
28
|
label={orderByLabel}
|
|
23
29
|
single
|
|
@@ -26,7 +32,7 @@ const onChange = (next) => {
|
|
|
26
32
|
options={options}
|
|
27
33
|
value={selection}
|
|
28
34
|
compare={compare}
|
|
29
|
-
trigger={
|
|
35
|
+
trigger={resolvedTrigger}
|
|
30
36
|
on={{ change: onChange }}>
|
|
31
37
|
{#snippet header()}
|
|
32
38
|
<ToolbarSectionTitle>{orderByLabel}</ToolbarSectionTitle>
|
|
@@ -35,7 +41,8 @@ const onChange = (next) => {
|
|
|
35
41
|
|
|
36
42
|
<!--
|
|
37
43
|
@component
|
|
38
|
-
A toolbar sort control: a `ToolbarFilterSelect` in single-select mode behind a
|
|
39
|
-
(
|
|
40
|
-
options. Stand-alone, or composed into `ToolbarViewControls` via
|
|
44
|
+
A toolbar sort control: a `ToolbarFilterSelect` in single-select mode behind a `trigger` — `'icon'`
|
|
45
|
+
(default, flat icon button), `'button'` (labelled secondary button), or a custom snippet — with an
|
|
46
|
+
`Order by` section title above the options. Stand-alone, or composed into `ToolbarViewControls` via
|
|
47
|
+
its `prepend` snippet.
|
|
41
48
|
-->
|
|
@@ -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
|
-
/**
|
|
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
|
|
40
|
-
* (
|
|
41
|
-
* options. Stand-alone, or composed into `ToolbarViewControls` via
|
|
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,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,7 +1,7 @@
|
|
|
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 ?? '');
|
|
@@ -12,7 +12,7 @@ const segmentColor = (s) => {
|
|
|
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()}
|
|
@@ -47,43 +47,62 @@ descriptors — the bar renders one segment per stage; segments `0..stage` (incl
|
|
|
47
47
|
the rest use the empty-segment color. Each stage's `color` is either a named tone from the shared
|
|
48
48
|
palette (same schemes as `Badge`, e.g. `'green'`) or a raw CSS color / `var(--sc-kit--*)`. Useful
|
|
49
49
|
for content-lifecycle indicators (Ideas → Draft → Review → Scheduled → Published) in cards, table
|
|
50
|
-
cells, or post pages. `
|
|
51
|
-
|
|
50
|
+
cells, or post pages. `variant="pips"` renders compact fixed-size ticks (left-aligned) instead of
|
|
51
|
+
full-width segments — for dense table cells. `showLabel={false}` drops the inline current-stage
|
|
52
|
+
label (e.g. in a compact table cell) and surfaces it in a hover tooltip instead.
|
|
52
53
|
|
|
53
54
|
### CSS Custom Properties
|
|
54
55
|
| Property | Description | Default |
|
|
55
56
|
|---|---|---|
|
|
56
|
-
| `--sc-kit--progress-bar--segment--height` |
|
|
57
|
-
| `--sc-kit--progress-bar--segment--
|
|
57
|
+
| `--sc-kit--progress-bar--segment--height` | Segment height | `bar` 4px / `pips` 12px |
|
|
58
|
+
| `--sc-kit--progress-bar--segment--width` | Segment width | `bar` auto (stretches) / `pips` 6px |
|
|
59
|
+
| `--sc-kit--progress-bar--segment--gap` | Gap between segments | `bar` 2px / `pips` 4px |
|
|
60
|
+
| `--sc-kit--progress-bar--segment--border-radius` | Segment corner radius | `bar` 1px / `pips` 2px |
|
|
58
61
|
| `--sc-kit--progress-bar--segment--background--empty` | Empty segment color | `var(--sc-kit--color--bg--active)` |
|
|
59
62
|
| `--sc-kit--progress-bar--track--padding-block` | Vertical padding around the bar (enlarges the hover/click target) | `5px` |
|
|
60
63
|
-->
|
|
61
64
|
|
|
62
65
|
<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);
|
|
66
|
+
--_pb--seg-height: var(--sc-kit--progress-bar--segment--height, var(--_pb--seg-height-default, 0.25rem));
|
|
67
|
+
--_pb--seg-gap: var(--sc-kit--progress-bar--segment--gap, var(--_pb--seg-gap-default, 0.125rem));
|
|
68
|
+
--_pb--seg-width: var(--sc-kit--progress-bar--segment--width, var(--_pb--seg-width-default, auto));
|
|
69
|
+
--_pb--seg-radius: var(--sc-kit--progress-bar--segment--border-radius, var(--_pb--seg-radius-default, 0.0625rem));
|
|
65
70
|
--_pb--seg-empty: var(--sc-kit--progress-bar--segment--background--empty, var(--sc-kit--color--bg--active));
|
|
66
71
|
--_pb--track-padding-block: var(--sc-kit--progress-bar--track--padding-block, 0.3125rem);
|
|
72
|
+
--_pb--seg-flex: 1;
|
|
73
|
+
--_pb--track-width: 100%;
|
|
67
74
|
display: flex;
|
|
68
75
|
flex-direction: column;
|
|
69
76
|
gap: 0.125rem;
|
|
77
|
+
width: 100%;
|
|
70
78
|
min-width: 0;
|
|
71
79
|
}
|
|
80
|
+
.progress-bar--pips {
|
|
81
|
+
--_pb--seg-height-default: 0.75rem;
|
|
82
|
+
--_pb--seg-gap-default: 0.25rem;
|
|
83
|
+
--_pb--seg-width-default: 0.375rem;
|
|
84
|
+
--_pb--seg-radius-default: 0.125rem;
|
|
85
|
+
--_pb--seg-flex: 0 0 auto;
|
|
86
|
+
--_pb--track-width: auto;
|
|
87
|
+
align-items: flex-start;
|
|
88
|
+
}
|
|
72
89
|
.progress-bar__track {
|
|
73
90
|
display: flex;
|
|
74
91
|
align-items: center;
|
|
75
92
|
gap: var(--_pb--seg-gap);
|
|
76
|
-
width:
|
|
93
|
+
width: var(--_pb--track-width);
|
|
77
94
|
padding-block: var(--_pb--track-padding-block);
|
|
78
95
|
}
|
|
79
96
|
.progress-bar__segment {
|
|
80
|
-
|
|
97
|
+
--_pb--seg-color: var(--_--pb--segment-color);
|
|
98
|
+
flex: var(--_pb--seg-flex);
|
|
99
|
+
width: var(--_pb--seg-width);
|
|
81
100
|
height: var(--_pb--seg-height);
|
|
82
101
|
background: var(--_pb--seg-empty);
|
|
83
|
-
border-radius:
|
|
102
|
+
border-radius: var(--_pb--seg-radius);
|
|
84
103
|
}
|
|
85
104
|
.progress-bar__segment--filled {
|
|
86
|
-
background: var(--
|
|
105
|
+
background: var(--_pb--seg-color);
|
|
87
106
|
}
|
|
88
107
|
.progress-bar__label {
|
|
89
108
|
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
|
};
|
|
@@ -16,14 +18,17 @@ type Props = {
|
|
|
16
18
|
* the rest use the empty-segment color. Each stage's `color` is either a named tone from the shared
|
|
17
19
|
* palette (same schemes as `Badge`, e.g. `'green'`) or a raw CSS color / `var(--sc-kit--*)`. Useful
|
|
18
20
|
* for content-lifecycle indicators (Ideas → Draft → Review → Scheduled → Published) in cards, table
|
|
19
|
-
* cells, or post pages. `
|
|
20
|
-
*
|
|
21
|
+
* cells, or post pages. `variant="pips"` renders compact fixed-size ticks (left-aligned) instead of
|
|
22
|
+
* full-width segments — for dense table cells. `showLabel={false}` drops the inline current-stage
|
|
23
|
+
* label (e.g. in a compact table cell) and surfaces it in a hover tooltip instead.
|
|
21
24
|
*
|
|
22
25
|
* ### CSS Custom Properties
|
|
23
26
|
* | Property | Description | Default |
|
|
24
27
|
* |---|---|---|
|
|
25
|
-
* | `--sc-kit--progress-bar--segment--height` |
|
|
26
|
-
* | `--sc-kit--progress-bar--segment--
|
|
28
|
+
* | `--sc-kit--progress-bar--segment--height` | Segment height | `bar` 4px / `pips` 12px |
|
|
29
|
+
* | `--sc-kit--progress-bar--segment--width` | Segment width | `bar` auto (stretches) / `pips` 6px |
|
|
30
|
+
* | `--sc-kit--progress-bar--segment--gap` | Gap between segments | `bar` 2px / `pips` 4px |
|
|
31
|
+
* | `--sc-kit--progress-bar--segment--border-radius` | Segment corner radius | `bar` 1px / `pips` 2px |
|
|
27
32
|
* | `--sc-kit--progress-bar--segment--background--empty` | Empty segment color | `var(--sc-kit--color--bg--active)` |
|
|
28
33
|
* | `--sc-kit--progress-bar--track--padding-block` | Vertical padding around the bar (enlarges the hover/click target) | `5px` |
|
|
29
34
|
*/
|
|
@@ -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'}
|
package/dist/ui/table/types.d.ts
CHANGED
|
@@ -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 |
|
|
12
|
-
export type TableColumnType = 'actions' | 'badge' | 'button' | 'by' | 'checkbox' | '
|
|
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;
|
package/dist/ui/table/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -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;
|