@streamscloud/kit 0.10.2 → 0.10.4
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/divider/cmp.divider.svelte +2 -1
- package/dist/ui/duration/cmp.duration.svelte +2 -1
- package/dist/ui/grid-card/fields/cmp.grid-card-id-field.svelte +2 -1
- package/dist/ui/logo/cmp.logo.svelte +2 -1
- package/dist/ui/navigation/cmp.nav-menu-divider.svelte +2 -1
- package/dist/ui/page-toolbar/cmp.toolbar-value-stepper.svelte +84 -0
- package/dist/ui/page-toolbar/cmp.toolbar-value-stepper.svelte.d.ts +30 -0
- package/dist/ui/page-toolbar/index.d.ts +1 -0
- package/dist/ui/page-toolbar/index.js +1 -0
- package/dist/ui/page-toolbar/toolbar-value-stepper-localization.d.ts +5 -0
- package/dist/ui/page-toolbar/toolbar-value-stepper-localization.js +26 -0
- package/dist/ui/pin-input/cmp.pin-input.svelte +2 -1
- package/dist/ui/progress/cmp.progress.svelte +2 -1
- package/dist/ui/radio/cmp.radio-card.svelte +2 -1
- package/dist/ui/segmented-control/cmp.segmented-control.svelte +2 -1
- package/dist/ui/skeleton/cmp.skeleton.svelte +2 -1
- package/dist/ui/slider/cmp.slider.svelte +2 -1
- package/dist/ui/spinner/cmp.spinner.svelte +2 -1
- package/dist/ui/table/table-cells/table-badge-cell.svelte +1 -1
- package/dist/ui/table/types.d.ts +2 -0
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script lang="ts">
|
|
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);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script lang="ts">
|
|
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.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script lang="ts">import { Icon } from '../icon';
|
|
2
|
+
import { ToolbarValueStepperLocalization } from './toolbar-value-stepper-localization';
|
|
3
|
+
import IconChevronLeft from '@fluentui/svg-icons/icons/chevron_left_16_regular.svg?raw';
|
|
4
|
+
import IconChevronRight from '@fluentui/svg-icons/icons/chevron_right_16_regular.svg?raw';
|
|
5
|
+
const { value, min = 0, max = 100, step = 1, valueSuffix = '', size = 'sm', on } = $props();
|
|
6
|
+
const localization = new ToolbarValueStepperLocalization();
|
|
7
|
+
const atMin = $derived(value <= min);
|
|
8
|
+
const atMax = $derived(value >= max);
|
|
9
|
+
const decrease = () => {
|
|
10
|
+
on?.change?.(Math.max(min, value - step));
|
|
11
|
+
};
|
|
12
|
+
const increase = () => {
|
|
13
|
+
on?.change?.(Math.min(max, value + step));
|
|
14
|
+
};
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div class="toolbar-value-stepper toolbar-value-stepper--{size}" role="group" aria-label={localization.value}>
|
|
18
|
+
<button type="button" class="toolbar-value-stepper__btn" onclick={decrease} disabled={atMin} aria-label={localization.decreaseValue}>
|
|
19
|
+
<Icon src={IconChevronLeft} />
|
|
20
|
+
</button>
|
|
21
|
+
<span class="toolbar-value-stepper__value">{value}{valueSuffix}</span>
|
|
22
|
+
<button type="button" class="toolbar-value-stepper__btn" onclick={increase} disabled={atMax} aria-label={localization.increaseValue}>
|
|
23
|
+
<Icon src={IconChevronRight} />
|
|
24
|
+
</button>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<!--
|
|
28
|
+
@component
|
|
29
|
+
A compact `[<] value [>]` stepper for toolbars — increment / decrement a numeric value between `min`
|
|
30
|
+
and `max` by `step`, with an optional `valueSuffix` (e.g. ` %`). Bound arrows disable at the limits.
|
|
31
|
+
Shares the field-height preset so it lines up with other toolbar controls.
|
|
32
|
+
|
|
33
|
+
### CSS Custom Properties
|
|
34
|
+
| Property | Description | Default |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `--sc-kit--toolbar-value-stepper--value--min-inline-size` | Min width of the value readout (keeps arrows from shifting) | `2.25rem` |
|
|
37
|
+
| `--sc-kit--toolbar-value-stepper--icon--color` | Arrow icon color | `var(--sc-kit--color--accent)` |
|
|
38
|
+
-->
|
|
39
|
+
|
|
40
|
+
<style>.toolbar-value-stepper {
|
|
41
|
+
--_toolbar-value-stepper--value--min-inline-size: var(--sc-kit--toolbar-value-stepper--value--min-inline-size, 2.25rem);
|
|
42
|
+
--_toolbar-value-stepper--icon--color: var(--sc-kit--toolbar-value-stepper--icon--color, var(--sc-kit--color--accent));
|
|
43
|
+
--sc-kit--icon--color: var(--_toolbar-value-stepper--icon--color);
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: var(--sc-kit--space--1);
|
|
47
|
+
block-size: var(--_toolbar-value-stepper--height);
|
|
48
|
+
padding-inline: var(--sc-kit--space--2);
|
|
49
|
+
border: 1px solid var(--sc-kit--color--border--field);
|
|
50
|
+
border-radius: var(--sc-kit--radius--md);
|
|
51
|
+
background: var(--sc-kit--color--bg--field);
|
|
52
|
+
}
|
|
53
|
+
.toolbar-value-stepper--sm {
|
|
54
|
+
--_toolbar-value-stepper--height: var(--sc-kit--field--height--sm);
|
|
55
|
+
--_toolbar-value-stepper--font-size: var(--sc-kit--font-size--sm);
|
|
56
|
+
}
|
|
57
|
+
.toolbar-value-stepper--md {
|
|
58
|
+
--_toolbar-value-stepper--height: var(--sc-kit--field--height--md);
|
|
59
|
+
--_toolbar-value-stepper--font-size: var(--sc-kit--font-size--md);
|
|
60
|
+
}
|
|
61
|
+
.toolbar-value-stepper--lg {
|
|
62
|
+
--_toolbar-value-stepper--height: var(--sc-kit--field--height--lg);
|
|
63
|
+
--_toolbar-value-stepper--font-size: var(--sc-kit--font-size--lg);
|
|
64
|
+
}
|
|
65
|
+
.toolbar-value-stepper__btn {
|
|
66
|
+
display: inline-flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
padding-inline: var(--sc-kit--space--1);
|
|
69
|
+
border: 0;
|
|
70
|
+
background: none;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
transition: opacity var(--sc-kit--duration--base) var(--sc-kit--ease--default);
|
|
73
|
+
}
|
|
74
|
+
.toolbar-value-stepper__btn:disabled {
|
|
75
|
+
cursor: default;
|
|
76
|
+
opacity: 0.4;
|
|
77
|
+
}
|
|
78
|
+
.toolbar-value-stepper__value {
|
|
79
|
+
min-inline-size: var(--_toolbar-value-stepper--value--min-inline-size);
|
|
80
|
+
text-align: center;
|
|
81
|
+
font-size: var(--_toolbar-value-stepper--font-size);
|
|
82
|
+
color: var(--sc-kit--color--text--primary);
|
|
83
|
+
font-variant-numeric: tabular-nums;
|
|
84
|
+
}</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
value: number;
|
|
3
|
+
/** @default 0 */
|
|
4
|
+
min?: number;
|
|
5
|
+
/** @default 100 */
|
|
6
|
+
max?: number;
|
|
7
|
+
/** @default 1 */
|
|
8
|
+
step?: number;
|
|
9
|
+
/** Suffix appended to the displayed value (e.g. ' %'). @default '' */
|
|
10
|
+
valueSuffix?: string;
|
|
11
|
+
/** Size preset (shared with Input / DatePicker / Select). @default 'sm' */
|
|
12
|
+
size?: 'sm' | 'md' | 'lg';
|
|
13
|
+
on?: {
|
|
14
|
+
change?: (value: number) => void;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A compact `[<] value [>]` stepper for toolbars — increment / decrement a numeric value between `min`
|
|
19
|
+
* and `max` by `step`, with an optional `valueSuffix` (e.g. ` %`). Bound arrows disable at the limits.
|
|
20
|
+
* Shares the field-height preset so it lines up with other toolbar controls.
|
|
21
|
+
*
|
|
22
|
+
* ### CSS Custom Properties
|
|
23
|
+
* | Property | Description | Default |
|
|
24
|
+
* |---|---|---|
|
|
25
|
+
* | `--sc-kit--toolbar-value-stepper--value--min-inline-size` | Min width of the value readout (keeps arrows from shifting) | `2.25rem` |
|
|
26
|
+
* | `--sc-kit--toolbar-value-stepper--icon--color` | Arrow icon color | `var(--sc-kit--color--accent)` |
|
|
27
|
+
*/
|
|
28
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
29
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
30
|
+
export default Cmp;
|
|
@@ -7,4 +7,5 @@ export { default as ToolbarSearchInput } from './cmp.toolbar-search-input.svelte
|
|
|
7
7
|
export { default as ToolbarSegmentedControl } from './cmp.toolbar-segmented-control.svelte';
|
|
8
8
|
export { default as ToolbarSwitchItem } from './cmp.toolbar-switch-item.svelte';
|
|
9
9
|
export { default as ToolbarToggleItem } from './cmp.toolbar-toggle-item.svelte';
|
|
10
|
+
export { default as ToolbarValueStepper } from './cmp.toolbar-value-stepper.svelte';
|
|
10
11
|
export type { ReorderableToggleItem } from './types';
|
|
@@ -7,3 +7,4 @@ export { default as ToolbarSearchInput } from './cmp.toolbar-search-input.svelte
|
|
|
7
7
|
export { default as ToolbarSegmentedControl } from './cmp.toolbar-segmented-control.svelte';
|
|
8
8
|
export { default as ToolbarSwitchItem } from './cmp.toolbar-switch-item.svelte';
|
|
9
9
|
export { default as ToolbarToggleItem } from './cmp.toolbar-toggle-item.svelte';
|
|
10
|
+
export { default as ToolbarValueStepper } from './cmp.toolbar-value-stepper.svelte';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AppLocale } from '../../core/locale';
|
|
2
|
+
const loc = {
|
|
3
|
+
value: {
|
|
4
|
+
en: 'Value',
|
|
5
|
+
no: 'Verdi'
|
|
6
|
+
},
|
|
7
|
+
decreaseValue: {
|
|
8
|
+
en: 'Decrease value',
|
|
9
|
+
no: 'Reduser verdi'
|
|
10
|
+
},
|
|
11
|
+
increaseValue: {
|
|
12
|
+
en: 'Increase value',
|
|
13
|
+
no: 'Øk verdi'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export class ToolbarValueStepperLocalization {
|
|
17
|
+
get value() {
|
|
18
|
+
return loc.value[AppLocale.current];
|
|
19
|
+
}
|
|
20
|
+
get decreaseValue() {
|
|
21
|
+
return loc.decreaseValue[AppLocale.current];
|
|
22
|
+
}
|
|
23
|
+
get increaseValue() {
|
|
24
|
+
return loc.increaseValue[AppLocale.current];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script lang="ts">
|
|
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">
|
|
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">
|
|
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">
|
|
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">
|
|
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">
|
|
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
|
|
package/dist/ui/table/types.d.ts
CHANGED
|
@@ -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
|
+
"version": "0.10.4",
|
|
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": "^
|
|
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": "^
|
|
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",
|