@streamscloud/kit 0.60.0 → 0.62.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/core/i18n/index.d.ts +1 -1
- package/dist/core/i18n/index.js +1 -1
- package/dist/core/i18n/resolve-plural-form.d.ts +23 -0
- package/dist/core/i18n/resolve-plural-form.js +41 -0
- package/dist/ui/confirmation-dialog/cmp.confirmation-dialog.svelte +14 -25
- package/dist/ui/confirmation-dialog/cmp.confirmation-dialog.svelte.d.ts +1 -1
- package/dist/ui/dialog/layout/cmp.frameless-dialog.svelte +77 -0
- package/dist/ui/dialog/layout/cmp.frameless-dialog.svelte.d.ts +48 -0
- package/dist/ui/{stepper-dialog-layout/cmp.stepper-dialog-layout.svelte → dialog/layout/cmp.stepper-dialog.svelte} +38 -38
- package/dist/ui/{stepper-dialog-layout/cmp.stepper-dialog-layout.svelte.d.ts → dialog/layout/cmp.stepper-dialog.svelte.d.ts} +7 -7
- package/dist/ui/dialog/layout/index.d.ts +2 -0
- package/dist/ui/dialog/layout/index.js +2 -0
- package/dist/ui/{stepper-dialog-layout/stepper-dialog-layout-localization.d.ts → dialog/layout/stepper-dialog-localization.d.ts} +1 -1
- package/dist/ui/{stepper-dialog-layout/stepper-dialog-layout-localization.js → dialog/layout/stepper-dialog-localization.js} +2 -2
- package/package.json +5 -5
- package/dist/core/i18n/plural.d.ts +0 -14
- package/dist/core/i18n/plural.js +0 -18
- package/dist/ui/stepper-dialog-layout/index.d.ts +0 -1
- package/dist/ui/stepper-dialog-layout/index.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { resolvePluralForm } from './resolve-plural-form';
|
package/dist/core/i18n/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { resolvePluralForm } from './resolve-plural-form';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type ResolvePluralFormOptions = {
|
|
2
|
+
count: number;
|
|
3
|
+
candidates: [string, ...string[]];
|
|
4
|
+
locale: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Picks the plural form matching `count` for `locale`.
|
|
8
|
+
*
|
|
9
|
+
* @param count - The number to pluralize
|
|
10
|
+
* @param candidates - One string per plural category `locale` distinguishes, in canonical CLDR order
|
|
11
|
+
* (zero, one, two, few, many, other) filtered to that locale's categories — e.g. 2 entries for 'en'
|
|
12
|
+
* (one, other), 4 for 'ru' (one, few, many, other). The caller (or its translation catalog) owns
|
|
13
|
+
* supplying the right length and order for the given locale. In dev, a length mismatch against
|
|
14
|
+
* `locale`'s actual category count throws instead of silently resolving the wrong form.
|
|
15
|
+
* @param locale - BCP 47 locale used to resolve the matching category via `Intl.PluralRules`.
|
|
16
|
+
* Invalid locale tags silently fall back to the runtime default — validate the locale upstream.
|
|
17
|
+
* @returns The matching candidate with # replaced by count
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* resolvePluralForm({ count: 1, candidates: ['# item', '# items'], locale: 'en' }) // "1 item"
|
|
21
|
+
* resolvePluralForm({ count: 5, candidates: ['# item', '# items'], locale: 'en' }) // "5 items"
|
|
22
|
+
*/
|
|
23
|
+
export declare const resolvePluralForm: ({ count, candidates, locale }: ResolvePluralFormOptions) => string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Picks the plural form matching `count` for `locale`.
|
|
3
|
+
*
|
|
4
|
+
* @param count - The number to pluralize
|
|
5
|
+
* @param candidates - One string per plural category `locale` distinguishes, in canonical CLDR order
|
|
6
|
+
* (zero, one, two, few, many, other) filtered to that locale's categories — e.g. 2 entries for 'en'
|
|
7
|
+
* (one, other), 4 for 'ru' (one, few, many, other). The caller (or its translation catalog) owns
|
|
8
|
+
* supplying the right length and order for the given locale. In dev, a length mismatch against
|
|
9
|
+
* `locale`'s actual category count throws instead of silently resolving the wrong form.
|
|
10
|
+
* @param locale - BCP 47 locale used to resolve the matching category via `Intl.PluralRules`.
|
|
11
|
+
* Invalid locale tags silently fall back to the runtime default — validate the locale upstream.
|
|
12
|
+
* @returns The matching candidate with # replaced by count
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* resolvePluralForm({ count: 1, candidates: ['# item', '# items'], locale: 'en' }) // "1 item"
|
|
16
|
+
* resolvePluralForm({ count: 5, candidates: ['# item', '# items'], locale: 'en' }) // "5 items"
|
|
17
|
+
*/
|
|
18
|
+
export const resolvePluralForm = ({ count, candidates, locale }) => {
|
|
19
|
+
const { index, categoriesLength } = indexerFor(locale);
|
|
20
|
+
if (import.meta.env?.DEV && candidates.length !== categoriesLength) {
|
|
21
|
+
throw new Error(`resolvePluralForm(): locale "${locale}" needs ${categoriesLength} candidate(s), got ${JSON.stringify(candidates)}.`);
|
|
22
|
+
}
|
|
23
|
+
const template = candidates[index(count)] ?? candidates[candidates.length - 1];
|
|
24
|
+
return template.replace(/#/g, String(count));
|
|
25
|
+
};
|
|
26
|
+
const PLURAL_CATEGORY_ORDER = ['zero', 'one', 'two', 'few', 'many', 'other'];
|
|
27
|
+
const indexers = new Map();
|
|
28
|
+
const indexerFor = (locale) => {
|
|
29
|
+
const cached = indexers.get(locale);
|
|
30
|
+
if (cached) {
|
|
31
|
+
return cached;
|
|
32
|
+
}
|
|
33
|
+
const rules = new Intl.PluralRules(locale);
|
|
34
|
+
const categories = rules
|
|
35
|
+
.resolvedOptions()
|
|
36
|
+
.pluralCategories.slice()
|
|
37
|
+
.sort((a, b) => PLURAL_CATEGORY_ORDER.indexOf(a) - PLURAL_CATEGORY_ORDER.indexOf(b));
|
|
38
|
+
const indexer = { index: (count) => categories.indexOf(rules.select(count)), categoriesLength: categories.length };
|
|
39
|
+
indexers.set(locale, indexer);
|
|
40
|
+
return indexer;
|
|
41
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
1
|
+
<script lang="ts">import { DialogButton, DialogCancelButton } from '../dialog';
|
|
2
|
+
import { FramelessDialog } from '../dialog/layout';
|
|
2
3
|
import { ConfirmationDialogLocalization } from './confirmation-dialog-localization';
|
|
3
4
|
import {} from './types';
|
|
4
5
|
import { untrack } from 'svelte';
|
|
@@ -26,36 +27,24 @@ untrack(() => {
|
|
|
26
27
|
});
|
|
27
28
|
</script>
|
|
28
29
|
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<DialogCancelButton on={{ click: close }}>{localization.no}</DialogCancelButton>
|
|
41
|
-
<DialogButton on={{ click: confirm }} variant={buttonVariant} icon={icon}>
|
|
42
|
-
{localization.yes}
|
|
43
|
-
</DialogButton>
|
|
44
|
-
{/snippet}
|
|
45
|
-
</Dialog>
|
|
46
|
-
</div>
|
|
30
|
+
<FramelessDialog controller={controller} title={titleText} hideCloseButton>
|
|
31
|
+
{#if bodyText}
|
|
32
|
+
{bodyText}
|
|
33
|
+
{/if}
|
|
34
|
+
{#snippet footer()}
|
|
35
|
+
<DialogCancelButton on={{ click: close }}>{localization.no}</DialogCancelButton>
|
|
36
|
+
<DialogButton on={{ click: confirm }} variant={buttonVariant} icon={icon}>
|
|
37
|
+
{localization.yes}
|
|
38
|
+
</DialogButton>
|
|
39
|
+
{/snippet}
|
|
40
|
+
</FramelessDialog>
|
|
47
41
|
|
|
48
42
|
<!--
|
|
49
43
|
@component
|
|
50
|
-
Internal view for `openConfirmationDialog`. Renders the
|
|
44
|
+
Internal view for `openConfirmationDialog`. Renders the frameless dialog frame + Yes/No footer. The Yes button's
|
|
51
45
|
Button variant is derived from `data.style` (`alert → danger`, `warning → warning`, `info → primary`)
|
|
52
46
|
so the confirmation reads the same as the surrounding banner color.
|
|
53
47
|
|
|
54
48
|
Use the imperative `openConfirmationDialog({ title, text, style, icon })` from the package barrel —
|
|
55
49
|
never render this view directly.
|
|
56
50
|
-->
|
|
57
|
-
|
|
58
|
-
<style>.confirmation-dialog {
|
|
59
|
-
--sc-kit--dialog--body--padding-inline: var(--sc-kit--space--6);
|
|
60
|
-
--sc-kit--dialog--body--padding-block: var(--sc-kit--space--6) var(--sc-kit--space--12);
|
|
61
|
-
}</style>
|
|
@@ -5,7 +5,7 @@ type Props = {
|
|
|
5
5
|
data: ConfirmationDialogData;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* Internal view for `openConfirmationDialog`. Renders the
|
|
8
|
+
* Internal view for `openConfirmationDialog`. Renders the frameless dialog frame + Yes/No footer. The Yes button's
|
|
9
9
|
* Button variant is derived from `data.style` (`alert → danger`, `warning → warning`, `info → primary`)
|
|
10
10
|
* so the confirmation reads the same as the surrounding banner color.
|
|
11
11
|
*
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script lang="ts" generics="TResult = void, TCancelResult = void">import { Dialog, DialogCloseButton } from '..';
|
|
2
|
+
let { controller, title, hideCloseButton = false, children, footer } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="frameless-dialog">
|
|
6
|
+
<Dialog controller={controller} hideCloseButton>
|
|
7
|
+
{#snippet bodySection()}
|
|
8
|
+
<div class="frameless-dialog__body">
|
|
9
|
+
{#if !hideCloseButton}
|
|
10
|
+
<span class="frameless-dialog__close"><DialogCloseButton controller={controller} /></span>
|
|
11
|
+
{/if}
|
|
12
|
+
<div class="frameless-dialog__title" class:frameless-dialog__title--no-close={hideCloseButton}>{title}</div>
|
|
13
|
+
{@render children()}
|
|
14
|
+
</div>
|
|
15
|
+
{/snippet}
|
|
16
|
+
{#snippet footerSection()}
|
|
17
|
+
<div class="frameless-dialog__footer">
|
|
18
|
+
{@render footer()}
|
|
19
|
+
</div>
|
|
20
|
+
{/snippet}
|
|
21
|
+
</Dialog>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<!--
|
|
25
|
+
@component
|
|
26
|
+
A `Dialog` frame with no header bar: the title sits in the body under generous top padding, the close (×) button is
|
|
27
|
+
placed in the body's corner, and the footer gets a tinted band instead of inheriting the panel background. For short
|
|
28
|
+
confirm / rename / move-style dialogs. The caller owns `controller` settings (`closeOnClickOutside`, `closeOnEsc`,
|
|
29
|
+
`nonCancelable`) and container settings (`size`, `position`) — this component only changes the frame's look.
|
|
30
|
+
|
|
31
|
+
### CSS Custom Properties
|
|
32
|
+
| Property | Description | Default |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `--sc-kit--frameless-dialog--footer--background` | Footer band background | `--sc-kit--color--bg--field-alt` |
|
|
35
|
+
|
|
36
|
+
The close button is fixed at 16px (`--sc-kit--dialog-close-button--icon--size`) regardless of ancestor overrides — part of the frameless style, not a per-instance knob.
|
|
37
|
+
-->
|
|
38
|
+
|
|
39
|
+
<style>.frameless-dialog {
|
|
40
|
+
--_radius: var(--sc-kit--dialog--border-radius, var(--sc-kit--radius--lg));
|
|
41
|
+
--sc-kit--dialog-close-button--icon--size: 1rem;
|
|
42
|
+
display: contents;
|
|
43
|
+
}
|
|
44
|
+
.frameless-dialog__body {
|
|
45
|
+
position: relative;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: var(--sc-kit--space--4);
|
|
49
|
+
padding: var(--sc-kit--space--10) var(--sc-kit--space--6) var(--sc-kit--space--8);
|
|
50
|
+
}
|
|
51
|
+
.frameless-dialog__close {
|
|
52
|
+
position: absolute;
|
|
53
|
+
inset-block-start: var(--sc-kit--space--3);
|
|
54
|
+
inset-inline-end: var(--sc-kit--space--3);
|
|
55
|
+
}
|
|
56
|
+
.frameless-dialog__title {
|
|
57
|
+
margin: 0;
|
|
58
|
+
padding-inline-end: var(--sc-kit--space--8);
|
|
59
|
+
font-size: var(--sc-kit--dialog--title--font-size, 1.125rem);
|
|
60
|
+
font-weight: var(--sc-kit--font-weight--semibold);
|
|
61
|
+
line-height: var(--sc-kit--dialog--title--line-height, 1.4);
|
|
62
|
+
overflow-wrap: anywhere;
|
|
63
|
+
}
|
|
64
|
+
.frameless-dialog__title--no-close {
|
|
65
|
+
padding-inline-end: 0;
|
|
66
|
+
}
|
|
67
|
+
.frameless-dialog__footer {
|
|
68
|
+
--_footer--background: var(--sc-kit--frameless-dialog--footer--background, var(--sc-kit--color--bg--field-alt));
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: flex-end;
|
|
71
|
+
gap: var(--sc-kit--space--3);
|
|
72
|
+
padding: var(--sc-kit--space--3) var(--sc-kit--space--6);
|
|
73
|
+
background: var(--_footer--background);
|
|
74
|
+
border-block-start: 1px solid var(--sc-kit--dialog--border-color, var(--sc-kit--color--border));
|
|
75
|
+
border-end-start-radius: var(--_radius);
|
|
76
|
+
border-end-end-radius: var(--_radius);
|
|
77
|
+
}</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type DialogController } from '..';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
declare function $$render<TResult = void, TCancelResult = void>(): {
|
|
4
|
+
props: {
|
|
5
|
+
controller: DialogController<TResult, TCancelResult>;
|
|
6
|
+
title: string;
|
|
7
|
+
/** Hide the corner close (×) button @default false */
|
|
8
|
+
hideCloseButton?: boolean;
|
|
9
|
+
/** Body content under the title */
|
|
10
|
+
children: Snippet;
|
|
11
|
+
/** Buttons rendered right-aligned in the tinted footer band */
|
|
12
|
+
footer: Snippet;
|
|
13
|
+
};
|
|
14
|
+
exports: {};
|
|
15
|
+
bindings: "";
|
|
16
|
+
slots: {};
|
|
17
|
+
events: {};
|
|
18
|
+
};
|
|
19
|
+
declare class __sveltets_Render<TResult = void, TCancelResult = void> {
|
|
20
|
+
props(): ReturnType<typeof $$render<TResult, TCancelResult>>['props'];
|
|
21
|
+
events(): ReturnType<typeof $$render<TResult, TCancelResult>>['events'];
|
|
22
|
+
slots(): ReturnType<typeof $$render<TResult, TCancelResult>>['slots'];
|
|
23
|
+
bindings(): "";
|
|
24
|
+
exports(): {};
|
|
25
|
+
}
|
|
26
|
+
interface $$IsomorphicComponent {
|
|
27
|
+
new <TResult = void, TCancelResult = void>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TResult, TCancelResult>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TResult, TCancelResult>['props']>, ReturnType<__sveltets_Render<TResult, TCancelResult>['events']>, ReturnType<__sveltets_Render<TResult, TCancelResult>['slots']>> & {
|
|
28
|
+
$$bindings?: ReturnType<__sveltets_Render<TResult, TCancelResult>['bindings']>;
|
|
29
|
+
} & ReturnType<__sveltets_Render<TResult, TCancelResult>['exports']>;
|
|
30
|
+
<TResult = void, TCancelResult = void>(internal: unknown, props: ReturnType<__sveltets_Render<TResult, TCancelResult>['props']> & {}): ReturnType<__sveltets_Render<TResult, TCancelResult>['exports']>;
|
|
31
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A `Dialog` frame with no header bar: the title sits in the body under generous top padding, the close (×) button is
|
|
35
|
+
* placed in the body's corner, and the footer gets a tinted band instead of inheriting the panel background. For short
|
|
36
|
+
* confirm / rename / move-style dialogs. The caller owns `controller` settings (`closeOnClickOutside`, `closeOnEsc`,
|
|
37
|
+
* `nonCancelable`) and container settings (`size`, `position`) — this component only changes the frame's look.
|
|
38
|
+
*
|
|
39
|
+
* ### CSS Custom Properties
|
|
40
|
+
* | Property | Description | Default |
|
|
41
|
+
* |---|---|---|
|
|
42
|
+
* | `--sc-kit--frameless-dialog--footer--background` | Footer band background | `--sc-kit--color--bg--field-alt` |
|
|
43
|
+
*
|
|
44
|
+
* The close button is fixed at 16px (`--sc-kit--dialog-close-button--icon--size`) regardless of ancestor overrides — part of the frameless style, not a per-instance knob.
|
|
45
|
+
*/
|
|
46
|
+
declare const Cmp: $$IsomorphicComponent;
|
|
47
|
+
type Cmp<TResult = void, TCancelResult = void> = InstanceType<typeof Cmp<TResult, TCancelResult>>;
|
|
48
|
+
export default Cmp;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<script lang="ts" generics="TResult = void, TCancelResult = void">import { Button } from '
|
|
2
|
-
import { Dialog, DialogCloseButton } from '
|
|
3
|
-
import { IconSlot } from '
|
|
4
|
-
import { Stepper } from '
|
|
5
|
-
import {
|
|
1
|
+
<script lang="ts" generics="TResult = void, TCancelResult = void">import { Button } from '../../button';
|
|
2
|
+
import { Dialog, DialogCloseButton } from '..';
|
|
3
|
+
import { IconSlot } from '../../icon';
|
|
4
|
+
import { Stepper } from '../../stepper';
|
|
5
|
+
import { StepperDialogLocalization } from './stepper-dialog-localization';
|
|
6
6
|
let { controller, icon, title, subtitle, steps, canAdvance = () => true, labels, children, on } = $props();
|
|
7
|
-
const localization = new
|
|
7
|
+
const localization = new StepperDialogLocalization();
|
|
8
8
|
let step = $state(0);
|
|
9
9
|
let submitting = $state(false);
|
|
10
10
|
const isFirstStep = $derived(step === 0);
|
|
@@ -38,7 +38,7 @@ const handleFinish = async () => {
|
|
|
38
38
|
await on.finish();
|
|
39
39
|
}
|
|
40
40
|
catch (error) {
|
|
41
|
-
console.error('
|
|
41
|
+
console.error('StepperDialog: on.finish threw — surface errors inside the handler', error);
|
|
42
42
|
}
|
|
43
43
|
finally {
|
|
44
44
|
submitting = false;
|
|
@@ -51,17 +51,17 @@ const handleStepClick = (clicked) => {
|
|
|
51
51
|
};
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
|
-
<div class="stepper-dialog
|
|
54
|
+
<div class="stepper-dialog">
|
|
55
55
|
<Dialog controller={controller}>
|
|
56
56
|
{#snippet headerSection()}
|
|
57
|
-
<div class="stepper-
|
|
57
|
+
<div class="stepper-dialog__header">
|
|
58
58
|
{#if icon}
|
|
59
|
-
<span class="stepper-
|
|
59
|
+
<span class="stepper-dialog__icon" aria-hidden="true"><IconSlot icon={icon} /></span>
|
|
60
60
|
{/if}
|
|
61
|
-
<div class="stepper-
|
|
62
|
-
<div class="stepper-
|
|
61
|
+
<div class="stepper-dialog__title-block">
|
|
62
|
+
<div class="stepper-dialog__title">{title}</div>
|
|
63
63
|
{#if subtitle}
|
|
64
|
-
<div class="stepper-
|
|
64
|
+
<div class="stepper-dialog__subtitle">{subtitle}</div>
|
|
65
65
|
{/if}
|
|
66
66
|
</div>
|
|
67
67
|
{#if showCloseButton}
|
|
@@ -71,12 +71,12 @@ const handleStepClick = (clicked) => {
|
|
|
71
71
|
{/snippet}
|
|
72
72
|
|
|
73
73
|
{#snippet bodySection()}
|
|
74
|
-
<div class="stepper-
|
|
75
|
-
<div class="stepper-
|
|
74
|
+
<div class="stepper-dialog__layout">
|
|
75
|
+
<div class="stepper-dialog__sidebar">
|
|
76
76
|
<Stepper orientation="vertical" completed="checkmark" current={step} steps={steps} on={{ stepClick: handleStepClick }} />
|
|
77
77
|
</div>
|
|
78
|
-
<div class="stepper-
|
|
79
|
-
<div class="stepper-
|
|
78
|
+
<div class="stepper-dialog__main">
|
|
79
|
+
<div class="stepper-dialog__body">{@render children(step)}</div>
|
|
80
80
|
</div>
|
|
81
81
|
</div>
|
|
82
82
|
{/snippet}
|
|
@@ -98,7 +98,7 @@ const handleStepClick = (clicked) => {
|
|
|
98
98
|
|
|
99
99
|
<!--
|
|
100
100
|
@component
|
|
101
|
-
|
|
101
|
+
StepperDialog — layout scaffold for multi-step wizard dialog views: header (icon / title /
|
|
102
102
|
subtitle / close), vertical Stepper sidebar, scrollable body, and a Cancel / Back / Next / Finish
|
|
103
103
|
footer. Render it inside your own dialog view opened via `Dialogs.open()` — the layout owns step
|
|
104
104
|
navigation and the submitting state; your `on.finish` owns closing (`controller.ok(...)`).
|
|
@@ -107,26 +107,26 @@ Completed sidebar steps are clickable to go back; `canAdvance(step)` gates Next
|
|
|
107
107
|
### CSS Custom Properties
|
|
108
108
|
| Property | Description | Default |
|
|
109
109
|
|---|---|---|
|
|
110
|
-
| `--sc-kit--stepper-dialog
|
|
111
|
-
| `--sc-kit--stepper-dialog
|
|
112
|
-
| `--sc-kit--stepper-dialog
|
|
110
|
+
| `--sc-kit--stepper-dialog--sidebar--width` | Stepper sidebar width | `20rem` (320px) |
|
|
111
|
+
| `--sc-kit--stepper-dialog--sidebar--background` | Sidebar background | `--sc-kit--color--bg--field-alt` |
|
|
112
|
+
| `--sc-kit--stepper-dialog--height` | Dialog height (forwarded to `--sc-kit--dialog--height`) | `auto` |
|
|
113
113
|
-->
|
|
114
114
|
|
|
115
|
-
<style>.stepper-dialog
|
|
116
|
-
--
|
|
117
|
-
--
|
|
118
|
-
--sc-kit--dialog--height: var(--sc-kit--stepper-dialog
|
|
115
|
+
<style>.stepper-dialog {
|
|
116
|
+
--_sd--sidebar-width: var(--sc-kit--stepper-dialog--sidebar--width, 20rem);
|
|
117
|
+
--_sd--sidebar-background: var(--sc-kit--stepper-dialog--sidebar--background, var(--sc-kit--color--bg--field-alt));
|
|
118
|
+
--sc-kit--dialog--height: var(--sc-kit--stepper-dialog--height, auto);
|
|
119
119
|
--sc-kit--dialog--body--overflow-y: auto;
|
|
120
120
|
display: contents;
|
|
121
121
|
}
|
|
122
|
-
.stepper-
|
|
122
|
+
.stepper-dialog__header {
|
|
123
123
|
display: flex;
|
|
124
124
|
align-items: flex-start;
|
|
125
125
|
gap: var(--sc-kit--space--3);
|
|
126
126
|
padding: var(--sc-kit--space--5) var(--sc-kit--space--6);
|
|
127
127
|
border-block-end: 1px solid var(--sc-kit--color--border);
|
|
128
128
|
}
|
|
129
|
-
.stepper-
|
|
129
|
+
.stepper-dialog__icon {
|
|
130
130
|
--sc-kit--icon--size: 1.5rem;
|
|
131
131
|
display: inline-flex;
|
|
132
132
|
align-items: center;
|
|
@@ -138,58 +138,58 @@ Completed sidebar steps are clickable to go back; `canAdvance(step)` gates Next
|
|
|
138
138
|
color: var(--sc-kit--color--text--primary);
|
|
139
139
|
border-radius: var(--sc-kit--radius--md);
|
|
140
140
|
}
|
|
141
|
-
.stepper-
|
|
141
|
+
.stepper-dialog__title-block {
|
|
142
142
|
flex: 1;
|
|
143
143
|
min-inline-size: 0;
|
|
144
144
|
display: flex;
|
|
145
145
|
flex-direction: column;
|
|
146
146
|
gap: 0.125rem;
|
|
147
147
|
}
|
|
148
|
-
.stepper-
|
|
148
|
+
.stepper-dialog__title {
|
|
149
149
|
font-size: var(--sc-kit--font-size--lg);
|
|
150
150
|
font-weight: var(--sc-kit--font-weight--semibold);
|
|
151
151
|
line-height: var(--sc-kit--leading--tight);
|
|
152
152
|
color: var(--sc-kit--color--text--primary);
|
|
153
153
|
}
|
|
154
|
-
.stepper-
|
|
154
|
+
.stepper-dialog__subtitle {
|
|
155
155
|
font-size: var(--sc-kit--font-size--sm);
|
|
156
156
|
color: var(--sc-kit--color--text--muted);
|
|
157
157
|
line-height: var(--sc-kit--leading--normal);
|
|
158
158
|
}
|
|
159
|
-
.stepper-
|
|
159
|
+
.stepper-dialog__layout {
|
|
160
160
|
display: flex;
|
|
161
161
|
flex: 1;
|
|
162
162
|
min-block-size: 0;
|
|
163
163
|
block-size: 100%;
|
|
164
164
|
}
|
|
165
165
|
@media screen and (max-width: 768px) {
|
|
166
|
-
.stepper-
|
|
166
|
+
.stepper-dialog__layout {
|
|
167
167
|
flex-direction: column;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
.stepper-
|
|
171
|
-
flex: 0 0 var(--
|
|
170
|
+
.stepper-dialog__sidebar {
|
|
171
|
+
flex: 0 0 var(--_sd--sidebar-width);
|
|
172
172
|
padding: var(--sc-kit--space--5) var(--sc-kit--space--4);
|
|
173
|
-
background: var(--
|
|
173
|
+
background: var(--_sd--sidebar-background);
|
|
174
174
|
border-inline-end: 1px solid var(--sc-kit--color--border);
|
|
175
175
|
overflow-y: auto;
|
|
176
176
|
min-block-size: 0;
|
|
177
177
|
}
|
|
178
178
|
@media screen and (max-width: 768px) {
|
|
179
|
-
.stepper-
|
|
179
|
+
.stepper-dialog__sidebar {
|
|
180
180
|
flex: 0 0 auto;
|
|
181
181
|
border-inline-end: none;
|
|
182
182
|
border-block-end: 1px solid var(--sc-kit--color--border);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
.stepper-
|
|
185
|
+
.stepper-dialog__main {
|
|
186
186
|
flex: 1 1 auto;
|
|
187
187
|
display: flex;
|
|
188
188
|
flex-direction: column;
|
|
189
189
|
min-inline-size: 0;
|
|
190
190
|
min-block-size: 0;
|
|
191
191
|
}
|
|
192
|
-
.stepper-
|
|
192
|
+
.stepper-dialog__body {
|
|
193
193
|
flex: 1;
|
|
194
194
|
min-block-size: 0;
|
|
195
195
|
overflow-y: auto;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type DialogController } from '
|
|
2
|
-
import { type IconProp } from '
|
|
3
|
-
import { type Step } from '
|
|
1
|
+
import { type DialogController } from '..';
|
|
2
|
+
import { type IconProp } from '../../icon';
|
|
3
|
+
import { type Step } from '../../stepper';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
declare function $$render<TResult = void, TCancelResult = void>(): {
|
|
6
6
|
props: {
|
|
@@ -48,7 +48,7 @@ interface $$IsomorphicComponent {
|
|
|
48
48
|
z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* StepperDialog — layout scaffold for multi-step wizard dialog views: header (icon / title /
|
|
52
52
|
* subtitle / close), vertical Stepper sidebar, scrollable body, and a Cancel / Back / Next / Finish
|
|
53
53
|
* footer. Render it inside your own dialog view opened via `Dialogs.open()` — the layout owns step
|
|
54
54
|
* navigation and the submitting state; your `on.finish` owns closing (`controller.ok(...)`).
|
|
@@ -57,9 +57,9 @@ interface $$IsomorphicComponent {
|
|
|
57
57
|
* ### CSS Custom Properties
|
|
58
58
|
* | Property | Description | Default |
|
|
59
59
|
* |---|---|---|
|
|
60
|
-
* | `--sc-kit--stepper-dialog
|
|
61
|
-
* | `--sc-kit--stepper-dialog
|
|
62
|
-
* | `--sc-kit--stepper-dialog
|
|
60
|
+
* | `--sc-kit--stepper-dialog--sidebar--width` | Stepper sidebar width | `20rem` (320px) |
|
|
61
|
+
* | `--sc-kit--stepper-dialog--sidebar--background` | Sidebar background | `--sc-kit--color--bg--field-alt` |
|
|
62
|
+
* | `--sc-kit--stepper-dialog--height` | Dialog height (forwarded to `--sc-kit--dialog--height`) | `auto` |
|
|
63
63
|
*/
|
|
64
64
|
declare const Cmp: $$IsomorphicComponent;
|
|
65
65
|
type Cmp<TResult = void, TCancelResult = void> = InstanceType<typeof Cmp<TResult, TCancelResult>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppLocale } from '
|
|
1
|
+
import { AppLocale } from '../../../core/locale';
|
|
2
2
|
const loc = {
|
|
3
3
|
cancel: {
|
|
4
4
|
en: 'Cancel',
|
|
@@ -17,7 +17,7 @@ const loc = {
|
|
|
17
17
|
no: 'Fullfør'
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
export class
|
|
20
|
+
export class StepperDialogLocalization {
|
|
21
21
|
get cancel() {
|
|
22
22
|
return loc.cancel[AppLocale.current];
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamscloud/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"author": "StreamsCloud",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -159,6 +159,10 @@
|
|
|
159
159
|
"types": "./dist/ui/dialog/index.d.ts",
|
|
160
160
|
"svelte": "./dist/ui/dialog/index.js"
|
|
161
161
|
},
|
|
162
|
+
"./ui/dialog/layout": {
|
|
163
|
+
"types": "./dist/ui/dialog/layout/index.d.ts",
|
|
164
|
+
"svelte": "./dist/ui/dialog/layout/index.js"
|
|
165
|
+
},
|
|
162
166
|
"./ui/divider": {
|
|
163
167
|
"types": "./dist/ui/divider/index.d.ts",
|
|
164
168
|
"svelte": "./dist/ui/divider/index.js"
|
|
@@ -391,10 +395,6 @@
|
|
|
391
395
|
"types": "./dist/ui/stepper/index.d.ts",
|
|
392
396
|
"svelte": "./dist/ui/stepper/index.js"
|
|
393
397
|
},
|
|
394
|
-
"./ui/stepper-dialog-layout": {
|
|
395
|
-
"types": "./dist/ui/stepper-dialog-layout/index.d.ts",
|
|
396
|
-
"svelte": "./dist/ui/stepper-dialog-layout/index.js"
|
|
397
|
-
},
|
|
398
398
|
"./ui/swipe-indicator": {
|
|
399
399
|
"types": "./dist/ui/swipe-indicator/index.d.ts",
|
|
400
400
|
"svelte": "./dist/ui/swipe-indicator/index.js"
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plural function for wuchale i18n.
|
|
3
|
-
* Wuchale extracts the candidates array and compiles locale-specific plural rules.
|
|
4
|
-
*
|
|
5
|
-
* @param count - The number to pluralize
|
|
6
|
-
* @param candidates - Array of plural forms, e.g., ['One item', '# items']
|
|
7
|
-
* @param rule - Optional plural rule function (injected by wuchale at compile time)
|
|
8
|
-
* @returns The appropriate plural form with # replaced by count
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* plural(1, ['# item', '# items']) // "1 item"
|
|
12
|
-
* plural(5, ['# item', '# items']) // "5 items"
|
|
13
|
-
*/
|
|
14
|
-
export declare const plural: (count: number, candidates: string[], rule?: (n: number) => number) => string;
|
package/dist/core/i18n/plural.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plural function for wuchale i18n.
|
|
3
|
-
* Wuchale extracts the candidates array and compiles locale-specific plural rules.
|
|
4
|
-
*
|
|
5
|
-
* @param count - The number to pluralize
|
|
6
|
-
* @param candidates - Array of plural forms, e.g., ['One item', '# items']
|
|
7
|
-
* @param rule - Optional plural rule function (injected by wuchale at compile time)
|
|
8
|
-
* @returns The appropriate plural form with # replaced by count
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* plural(1, ['# item', '# items']) // "1 item"
|
|
12
|
-
* plural(5, ['# item', '# items']) // "5 items"
|
|
13
|
-
*/
|
|
14
|
-
export const plural = (count, candidates, rule = (n) => (n === 1 ? 0 : 1)) => {
|
|
15
|
-
const index = rule(count);
|
|
16
|
-
const template = candidates[index] ?? candidates[candidates.length - 1];
|
|
17
|
-
return template.replace(/#/g, String(count));
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as StepperDialogLayout } from './cmp.stepper-dialog-layout.svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as StepperDialogLayout } from './cmp.stepper-dialog-layout.svelte';
|