@sentropic/design-system-svelte 0.34.49 → 0.34.51
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/README.md +62 -0
- package/dist/AnomalySwimLaneChart.svelte +10 -1
- package/dist/AnomalySwimLaneChart.svelte.d.ts +2 -0
- package/dist/AnomalySwimLaneChart.svelte.d.ts.map +1 -1
- package/dist/AppShell.svelte +284 -28
- package/dist/AppShell.svelte.d.ts +23 -3
- package/dist/AppShell.svelte.d.ts.map +1 -1
- package/dist/CalendarHeatmapChart.svelte +11 -1
- package/dist/CalendarHeatmapChart.svelte.d.ts +2 -0
- package/dist/CalendarHeatmapChart.svelte.d.ts.map +1 -1
- package/dist/Combobox.svelte +5 -1
- package/dist/Combobox.svelte.d.ts.map +1 -1
- package/dist/ContextPanel.svelte +86 -0
- package/dist/ContextPanel.svelte.d.ts +14 -0
- package/dist/ContextPanel.svelte.d.ts.map +1 -0
- package/dist/ContourChart.svelte +76 -13
- package/dist/ContourChart.svelte.d.ts +3 -1
- package/dist/ContourChart.svelte.d.ts.map +1 -1
- package/dist/Dashboard.svelte +155 -0
- package/dist/Dashboard.svelte.d.ts +21 -0
- package/dist/Dashboard.svelte.d.ts.map +1 -0
- package/dist/DashboardGrid.svelte +237 -0
- package/dist/DashboardGrid.svelte.d.ts +24 -0
- package/dist/DashboardGrid.svelte.d.ts.map +1 -0
- package/dist/DataTable.svelte +3 -1
- package/dist/DataTable.svelte.d.ts +1 -0
- package/dist/DataTable.svelte.d.ts.map +1 -1
- package/dist/DatePicker.svelte +33 -28
- package/dist/DatePicker.svelte.d.ts.map +1 -1
- package/dist/Density2DChart.svelte +10 -1
- package/dist/Density2DChart.svelte.d.ts +2 -0
- package/dist/Density2DChart.svelte.d.ts.map +1 -1
- package/dist/Dropdown.svelte +33 -9
- package/dist/Dropdown.svelte.d.ts.map +1 -1
- package/dist/EventFeedPanel.svelte +3 -3
- package/dist/EventFeedPanel.svelte.d.ts +1 -1
- package/dist/EventFeedPanel.svelte.d.ts.map +1 -1
- package/dist/FileUploader.svelte +7 -3
- package/dist/Footer.svelte +75 -11
- package/dist/Footer.svelte.d.ts +16 -6
- package/dist/Footer.svelte.d.ts.map +1 -1
- package/dist/ForceGraph.svelte +9 -3
- package/dist/ForceGraph.svelte.d.ts +4 -0
- package/dist/ForceGraph.svelte.d.ts.map +1 -1
- package/dist/HeatmapChart.svelte +39 -3
- package/dist/HeatmapChart.svelte.d.ts +4 -1
- package/dist/HeatmapChart.svelte.d.ts.map +1 -1
- package/dist/KanbanBoard.svelte +144 -0
- package/dist/KanbanBoard.svelte.d.ts +23 -0
- package/dist/KanbanBoard.svelte.d.ts.map +1 -0
- package/dist/ListReportPage.svelte +184 -0
- package/dist/ListReportPage.svelte.d.ts +46 -0
- package/dist/ListReportPage.svelte.d.ts.map +1 -0
- package/dist/MasterDetail.svelte +267 -0
- package/dist/MasterDetail.svelte.d.ts +35 -0
- package/dist/MasterDetail.svelte.d.ts.map +1 -0
- package/dist/NavDrawer.svelte +46 -0
- package/dist/NavDrawer.svelte.d.ts +17 -0
- package/dist/NavDrawer.svelte.d.ts.map +1 -0
- package/dist/NavItem.svelte +3 -5
- package/dist/NavItem.svelte.d.ts.map +1 -1
- package/dist/NavRail.svelte +147 -0
- package/dist/NavRail.svelte.d.ts +23 -0
- package/dist/NavRail.svelte.d.ts.map +1 -0
- package/dist/NavShell.svelte +218 -0
- package/dist/NavShell.svelte.d.ts +38 -0
- package/dist/NavShell.svelte.d.ts.map +1 -0
- package/dist/ObjectPage.svelte +222 -0
- package/dist/ObjectPage.svelte.d.ts +46 -0
- package/dist/ObjectPage.svelte.d.ts.map +1 -0
- package/dist/OrderedList.svelte +7 -12
- package/dist/OrderedList.svelte.d.ts.map +1 -1
- package/dist/PointAndFigureChart.svelte +18 -11
- package/dist/PointAndFigureChart.svelte.d.ts +1 -1
- package/dist/PointAndFigureChart.svelte.d.ts.map +1 -1
- package/dist/RenkoChart.svelte +40 -13
- package/dist/RenkoChart.svelte.d.ts +1 -1
- package/dist/RenkoChart.svelte.d.ts.map +1 -1
- package/dist/SelectableRow.svelte +16 -5
- package/dist/SelectableRow.svelte.d.ts +2 -0
- package/dist/SelectableRow.svelte.d.ts.map +1 -1
- package/dist/UtilityPanel.svelte +89 -0
- package/dist/UtilityPanel.svelte.d.ts +18 -0
- package/dist/UtilityPanel.svelte.d.ts.map +1 -0
- package/dist/VectorFieldChart.svelte +5 -5
- package/dist/VectorFieldChart.svelte.d.ts +1 -1
- package/dist/VectorFieldChart.svelte.d.ts.map +1 -1
- package/dist/WindBarbChart.svelte +5 -5
- package/dist/WindBarbChart.svelte.d.ts +1 -1
- package/dist/WindBarbChart.svelte.d.ts.map +1 -1
- package/dist/Wizard.svelte +125 -0
- package/dist/Wizard.svelte.d.ts +25 -0
- package/dist/Wizard.svelte.d.ts.map +1 -0
- package/dist/index.d.ts +35 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# `@sentropic/design-system-svelte`
|
|
2
|
+
|
|
3
|
+
Svelte implementation of the Sentropic design-system component catalog. The package ships ESM JavaScript, TypeScript declarations, and the shared component CSS.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @sentropic/design-system-svelte @sentropic/design-system-themes
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Svelte is a peer dependency:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install svelte
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Import the package CSS once at the app or preview boundary, then render components inside `ThemeProvider`.
|
|
20
|
+
|
|
21
|
+
```svelte
|
|
22
|
+
<script>
|
|
23
|
+
import { Button, Card, ThemeProvider } from "@sentropic/design-system-svelte";
|
|
24
|
+
import "@sentropic/design-system-svelte/styles.css";
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<ThemeProvider>
|
|
28
|
+
<Card>
|
|
29
|
+
<strong>Release plan</strong>
|
|
30
|
+
<Button>Open plan</Button>
|
|
31
|
+
</Card>
|
|
32
|
+
</ThemeProvider>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`ThemeProvider` defaults to the Sent Tech theme. Tenant themes can be supplied from `@sentropic/design-system-themes`, `@sentropic/design-system-theme-dsfr`, or `@sentropic/design-system-theme-carbon`.
|
|
36
|
+
|
|
37
|
+
```svelte
|
|
38
|
+
<script>
|
|
39
|
+
import { ThemeProvider } from "@sentropic/design-system-svelte";
|
|
40
|
+
import { carbonTheme } from "@sentropic/design-system-theme-carbon";
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<ThemeProvider theme={carbonTheme}>
|
|
44
|
+
<!-- your content -->
|
|
45
|
+
</ThemeProvider>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Exports
|
|
49
|
+
|
|
50
|
+
- `@sentropic/design-system-svelte`: all public Svelte components and TypeScript props.
|
|
51
|
+
- `@sentropic/design-system-svelte/styles.css`: component CSS consumed by every theme.
|
|
52
|
+
|
|
53
|
+
The package includes declarations through `dist/index.d.ts` and marks `dist/styles.css` as a side effect so bundlers keep the stylesheet import.
|
|
54
|
+
|
|
55
|
+
## Build
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm --workspace @sentropic/design-system-svelte run build
|
|
59
|
+
npm --workspace @sentropic/design-system-svelte run test
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Publishing is handled by `.github/workflows/svelte-publish.yml` with a `svelte-v*` tag.
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
| "category1" | "category2" | "category3" | "category4"
|
|
24
24
|
| "category5" | "category6" | "category7" | "category8";
|
|
25
25
|
|
|
26
|
+
export type AnomalySwimLaneChartScale = "categorical" | "sequential";
|
|
27
|
+
|
|
26
28
|
export type AnomalySwimLaneBucket = {
|
|
27
29
|
at: number;
|
|
28
30
|
score: number;
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
type AnomalySwimLaneChartProps = {
|
|
41
43
|
data: AnomalySwimLaneSeries[];
|
|
42
44
|
max?: number;
|
|
45
|
+
scale?: AnomalySwimLaneChartScale;
|
|
43
46
|
label?: string;
|
|
44
47
|
width?: number;
|
|
45
48
|
height?: number;
|
|
@@ -50,6 +53,7 @@
|
|
|
50
53
|
let {
|
|
51
54
|
data = [],
|
|
52
55
|
max,
|
|
56
|
+
scale = "sequential",
|
|
53
57
|
label,
|
|
54
58
|
width,
|
|
55
59
|
height = 300,
|
|
@@ -73,6 +77,10 @@
|
|
|
73
77
|
return TONES[index];
|
|
74
78
|
}
|
|
75
79
|
|
|
80
|
+
function normalizedScale(value: AnomalySwimLaneChartScale | undefined): AnomalySwimLaneChartScale {
|
|
81
|
+
return value === "categorical" ? "categorical" : "sequential";
|
|
82
|
+
}
|
|
83
|
+
|
|
76
84
|
// Tronque une étiquette à la largeur de la marge gauche (approx. par char).
|
|
77
85
|
function ellipsize(text: string, maxChars: number): string {
|
|
78
86
|
if (text.length <= maxChars) return text;
|
|
@@ -87,6 +95,7 @@
|
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
let hoveredKey: string | null = $state(null);
|
|
98
|
+
const resolvedScale = $derived(normalizedScale(scale));
|
|
90
99
|
|
|
91
100
|
const plotWidth = $derived(Math.max(resolvedWidth - MARGIN.left - MARGIN.right, 1));
|
|
92
101
|
const plotHeight = $derived(Math.max(height - MARGIN.top - MARGIN.bottom, 1));
|
|
@@ -190,7 +199,7 @@
|
|
|
190
199
|
return null;
|
|
191
200
|
});
|
|
192
201
|
|
|
193
|
-
const classes = () => ["st-anomalySwimLaneChart", className].filter(Boolean).join(" ");
|
|
202
|
+
const classes = () => ["st-anomalySwimLaneChart", `st-anomalySwimLaneChart--${resolvedScale}`, className].filter(Boolean).join(" ");
|
|
194
203
|
</script>
|
|
195
204
|
|
|
196
205
|
<div class={classes()}>
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* class string
|
|
20
20
|
*/
|
|
21
21
|
export type AnomalySwimLaneTone = "category1" | "category2" | "category3" | "category4" | "category5" | "category6" | "category7" | "category8";
|
|
22
|
+
export type AnomalySwimLaneChartScale = "categorical" | "sequential";
|
|
22
23
|
export type AnomalySwimLaneBucket = {
|
|
23
24
|
at: number;
|
|
24
25
|
score: number;
|
|
@@ -30,6 +31,7 @@ export type AnomalySwimLaneSeries = {
|
|
|
30
31
|
type AnomalySwimLaneChartProps = {
|
|
31
32
|
data: AnomalySwimLaneSeries[];
|
|
32
33
|
max?: number;
|
|
34
|
+
scale?: AnomalySwimLaneChartScale;
|
|
33
35
|
label?: string;
|
|
34
36
|
width?: number;
|
|
35
37
|
height?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnomalySwimLaneChart.svelte.d.ts","sourceRoot":"","sources":["../src/lib/AnomalySwimLaneChart.svelte.ts"],"names":[],"mappings":"AAGE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,mBAAmB,GAC3B,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GACrD,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAE1D,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,qBAAqB,EAAE,CAAC;CAClC,CAAC;AAMF,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,qBAAqB,EAAE,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;
|
|
1
|
+
{"version":3,"file":"AnomalySwimLaneChart.svelte.d.ts","sourceRoot":"","sources":["../src/lib/AnomalySwimLaneChart.svelte.ts"],"names":[],"mappings":"AAGE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,mBAAmB,GAC3B,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GACrD,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAE1D,MAAM,MAAM,yBAAyB,GAAG,aAAa,GAAG,YAAY,CAAC;AAErE,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,qBAAqB,EAAE,CAAC;CAClC,CAAC;AAMF,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,qBAAqB,EAAE,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,yBAAyB,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAqNJ,QAAA,MAAM,oBAAoB,+DAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
|
package/dist/AppShell.svelte
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { SiteConfig } from "./site-config";
|
|
4
|
+
|
|
5
|
+
export type AppShellVariant = "site" | "workspace";
|
|
6
|
+
export type AppShellUtilityMode = "reserve" | "overlay" | "floating";
|
|
7
|
+
export type AppShellUtilitySide = "left" | "right" | "bottom";
|
|
8
|
+
|
|
9
|
+
export type AppShellProps = {
|
|
10
|
+
variant?: AppShellVariant;
|
|
11
|
+
config?: SiteConfig;
|
|
12
|
+
topChrome?: Snippet;
|
|
13
|
+
primaryRail?: Snippet;
|
|
14
|
+
navigationPanel?: Snippet;
|
|
15
|
+
main?: Snippet;
|
|
16
|
+
contextPanel?: Snippet;
|
|
17
|
+
utilityPanel?: Snippet;
|
|
18
|
+
bottomPanel?: Snippet;
|
|
19
|
+
children?: Snippet;
|
|
20
|
+
mainId?: string;
|
|
21
|
+
navigationLabel?: string;
|
|
22
|
+
contextLabel?: string;
|
|
23
|
+
utilityLabel?: string;
|
|
24
|
+
utilityMode?: AppShellUtilityMode;
|
|
25
|
+
utilitySide?: AppShellUtilitySide;
|
|
26
|
+
class?: string;
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
1
30
|
<script lang="ts">
|
|
2
31
|
// App-shell SVELTE : COMPOSE les vrais composants du design system — zéro contrôle
|
|
3
32
|
// bricolé. Triggers = DS Button / IconButton ; menus = DS MenuPopover + Menu ;
|
|
@@ -11,24 +40,45 @@
|
|
|
11
40
|
import Menu from "./Menu.svelte";
|
|
12
41
|
import { Boxes, ChevronDown, Globe, Moon, Palette, Search as SearchIcon, Sun } from "@lucide/svelte";
|
|
13
42
|
import IdentityButton from "./IdentityButton.svelte";
|
|
14
|
-
import type { SiteConfig } from "./site-config";
|
|
15
43
|
|
|
16
|
-
let {
|
|
44
|
+
let {
|
|
45
|
+
variant,
|
|
46
|
+
config,
|
|
47
|
+
topChrome,
|
|
48
|
+
primaryRail,
|
|
49
|
+
navigationPanel,
|
|
50
|
+
main,
|
|
51
|
+
contextPanel,
|
|
52
|
+
utilityPanel,
|
|
53
|
+
bottomPanel,
|
|
54
|
+
children,
|
|
55
|
+
mainId = "main",
|
|
56
|
+
navigationLabel = "Workspace navigation",
|
|
57
|
+
contextLabel = "Context panel",
|
|
58
|
+
utilityLabel = "Utility panel",
|
|
59
|
+
utilityMode = "reserve",
|
|
60
|
+
utilitySide = "right",
|
|
61
|
+
class: className
|
|
62
|
+
}: AppShellProps = $props();
|
|
17
63
|
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
64
|
+
const mode = $derived(variant ?? (config ? "site" : "workspace"));
|
|
65
|
+
const siteConfig = $derived(config ?? ({ brand: { name: "Sentropic" }, nav: [], theming: { themes: [], theme: "" } } as SiteConfig));
|
|
66
|
+
const brand = $derived(siteConfig.brand ?? { name: "Sentropic" });
|
|
67
|
+
const nav = $derived(Array.isArray(siteConfig.nav) ? siteConfig.nav : []);
|
|
68
|
+
const t = $derived(siteConfig.theming ?? { themes: [], theme: "" });
|
|
69
|
+
const siteClasses = $derived(["st-shell", className].filter(Boolean).join(" "));
|
|
70
|
+
const workspaceClasses = $derived(["st-appShell", "st-appShell--workspace", className].filter(Boolean).join(" "));
|
|
21
71
|
|
|
22
72
|
const isActive = (item: { href: string; active?: boolean }) =>
|
|
23
73
|
item.active != null
|
|
24
74
|
? item.active
|
|
25
|
-
:
|
|
26
|
-
(item.href ===
|
|
75
|
+
: siteConfig.activePath != null &&
|
|
76
|
+
(item.href === siteConfig.activePath || (item.href !== "/" && (siteConfig.activePath ?? "").startsWith(item.href)));
|
|
27
77
|
|
|
28
78
|
const themeItems = $derived((t.themes ?? []).map((o) => ({ label: o.label, value: o.id })));
|
|
29
|
-
const fwItems = $derived((
|
|
30
|
-
const localeItems = $derived((
|
|
31
|
-
const fwLabel = $derived((
|
|
79
|
+
const fwItems = $derived((siteConfig.frameworkSwitcher?.available ?? []).map((o) => ({ label: o.label, value: o.id })));
|
|
80
|
+
const localeItems = $derived((siteConfig.locale?.available ?? []).map((o) => ({ label: o.label, value: o.code })));
|
|
81
|
+
const fwLabel = $derived((siteConfig.frameworkSwitcher?.available ?? []).find((o) => o.id === siteConfig.frameworkSwitcher?.current)?.label ?? "");
|
|
32
82
|
const themeLabel = $derived((t.themes ?? []).find((o) => o.id === t.theme)?.label ?? "");
|
|
33
83
|
|
|
34
84
|
// Ancrage des menus (MenuPopover veut un HTMLElement) : on bind un span tight.
|
|
@@ -56,7 +106,7 @@
|
|
|
56
106
|
{/snippet}
|
|
57
107
|
|
|
58
108
|
{#snippet navigation()}
|
|
59
|
-
<nav class="st-shell__nav" aria-label={
|
|
109
|
+
<nav class="st-shell__nav" aria-label={siteConfig.navLabel ?? "Navigation"}>
|
|
60
110
|
{#each nav as item (item.href)}
|
|
61
111
|
<a class="st-shell__navLink" href={item.href} aria-current={isActive(item) ? "page" : undefined}>{item.label}</a>
|
|
62
112
|
{/each}
|
|
@@ -65,22 +115,22 @@
|
|
|
65
115
|
|
|
66
116
|
{#snippet actions()}
|
|
67
117
|
<div class="st-shell__actions">
|
|
68
|
-
{#if
|
|
69
|
-
<Button variant="secondary" size="sm" class="st-shell__search" onclick={() =>
|
|
118
|
+
{#if siteConfig.search?.enabled}
|
|
119
|
+
<Button variant="secondary" size="sm" class="st-shell__search" onclick={() => siteConfig.search?.onSearch?.("")}>
|
|
70
120
|
<SearchIcon size={16} strokeWidth={2.1} aria-hidden="true" />
|
|
71
|
-
<span>{
|
|
121
|
+
<span>{siteConfig.search.placeholder ?? "Rechercher…"}</span>
|
|
72
122
|
<kbd class="st-shell__kbd">/</kbd>
|
|
73
123
|
</Button>
|
|
74
124
|
{/if}
|
|
75
125
|
|
|
76
|
-
{#if
|
|
126
|
+
{#if siteConfig.frameworkSwitcher?.enabled}
|
|
77
127
|
<span class="st-shell__menuWrap" bind:this={fwEl}>
|
|
78
128
|
<Button variant="secondary" size="sm" class="st-shell__switch" onclick={() => (fwOpen = !fwOpen)} aria-haspopup="menu" aria-expanded={fwOpen}>
|
|
79
129
|
<Boxes size={14} aria-hidden="true" /><span>{fwLabel}</span><ChevronDown size={14} aria-hidden="true" />
|
|
80
130
|
</Button>
|
|
81
131
|
</span>
|
|
82
132
|
<MenuPopover bind:open={fwOpen} trigger={fwEl} placement="bottom-end" label="Framework">
|
|
83
|
-
<Menu label="Framework" items={fwItems} onselect={(v) => {
|
|
133
|
+
<Menu label="Framework" items={fwItems} onselect={(v) => { siteConfig.frameworkSwitcher?.onChange?.(v); fwOpen = false; }} />
|
|
84
134
|
</MenuPopover>
|
|
85
135
|
{/if}
|
|
86
136
|
|
|
@@ -101,32 +151,81 @@
|
|
|
101
151
|
</IconButton>
|
|
102
152
|
{/if}
|
|
103
153
|
|
|
104
|
-
{#if
|
|
154
|
+
{#if siteConfig.locale}
|
|
105
155
|
<span class="st-shell__menuWrap" bind:this={localeEl}>
|
|
106
156
|
<Button variant="secondary" size="sm" class="st-shell__switch" onclick={() => (localeOpen = !localeOpen)} aria-haspopup="menu" aria-expanded={localeOpen}>
|
|
107
|
-
<Globe size={14} aria-hidden="true" /><span>{(
|
|
157
|
+
<Globe size={14} aria-hidden="true" /><span>{(siteConfig.locale.current ?? "").toUpperCase()}</span><ChevronDown size={14} aria-hidden="true" />
|
|
108
158
|
</Button>
|
|
109
159
|
</span>
|
|
110
|
-
<MenuPopover bind:open={localeOpen} trigger={localeEl} placement="bottom-end" label={
|
|
111
|
-
<Menu label={
|
|
160
|
+
<MenuPopover bind:open={localeOpen} trigger={localeEl} placement="bottom-end" label={siteConfig.locale.label ?? "Langue"}>
|
|
161
|
+
<Menu label={siteConfig.locale.label ?? "Langue"} items={localeItems} onselect={(v) => { siteConfig.locale?.onChange?.(v); localeOpen = false; }} />
|
|
112
162
|
</MenuPopover>
|
|
113
163
|
{/if}
|
|
114
164
|
|
|
115
|
-
{#if
|
|
165
|
+
{#if siteConfig.identity}
|
|
116
166
|
<IdentityButton
|
|
117
167
|
mode="icon"
|
|
118
|
-
authState={
|
|
119
|
-
user={
|
|
120
|
-
signInLabel={
|
|
121
|
-
onSignIn={() =>
|
|
122
|
-
onSignOut={() =>
|
|
123
|
-
menu={
|
|
168
|
+
authState={siteConfig.identity.state}
|
|
169
|
+
user={siteConfig.identity.user ?? null}
|
|
170
|
+
signInLabel={siteConfig.identity.label ?? "Se connecter"}
|
|
171
|
+
onSignIn={() => siteConfig.identity?.onSignIn?.()}
|
|
172
|
+
onSignOut={() => siteConfig.identity?.onSignOut?.()}
|
|
173
|
+
menu={siteConfig.identity.menu ?? []}
|
|
124
174
|
/>
|
|
125
175
|
{/if}
|
|
126
176
|
</div>
|
|
127
177
|
{/snippet}
|
|
128
178
|
|
|
129
|
-
|
|
179
|
+
{#if mode === "workspace"}
|
|
180
|
+
<div
|
|
181
|
+
class={workspaceClasses}
|
|
182
|
+
data-st-app-shell-variant="workspace"
|
|
183
|
+
data-utility-mode={utilityMode}
|
|
184
|
+
data-utility-side={utilitySide}
|
|
185
|
+
>
|
|
186
|
+
{#if topChrome}
|
|
187
|
+
<div class="st-appShell__topChrome">
|
|
188
|
+
{@render topChrome()}
|
|
189
|
+
</div>
|
|
190
|
+
{/if}
|
|
191
|
+
<div class="st-appShell__body">
|
|
192
|
+
{#if primaryRail}
|
|
193
|
+
<aside class="st-appShell__primaryRail" aria-label="Primary rail">
|
|
194
|
+
{@render primaryRail()}
|
|
195
|
+
</aside>
|
|
196
|
+
{/if}
|
|
197
|
+
{#if navigationPanel}
|
|
198
|
+
<aside class="st-appShell__navigationPanel" aria-label={navigationLabel}>
|
|
199
|
+
{@render navigationPanel()}
|
|
200
|
+
</aside>
|
|
201
|
+
{/if}
|
|
202
|
+
<main class="st-appShell__main" id={mainId}>
|
|
203
|
+
{#if main}
|
|
204
|
+
{@render main()}
|
|
205
|
+
{:else if children}
|
|
206
|
+
{@render children()}
|
|
207
|
+
{/if}
|
|
208
|
+
</main>
|
|
209
|
+
{#if contextPanel}
|
|
210
|
+
<aside class="st-appShell__contextPanel" aria-label={contextLabel}>
|
|
211
|
+
{@render contextPanel()}
|
|
212
|
+
</aside>
|
|
213
|
+
{/if}
|
|
214
|
+
{#if utilityPanel}
|
|
215
|
+
<aside class="st-appShell__utilityPanel" aria-label={utilityLabel}>
|
|
216
|
+
{@render utilityPanel()}
|
|
217
|
+
</aside>
|
|
218
|
+
{/if}
|
|
219
|
+
</div>
|
|
220
|
+
{#if bottomPanel}
|
|
221
|
+
<section class="st-appShell__bottomPanel" aria-label="Workspace tools">
|
|
222
|
+
{@render bottomPanel()}
|
|
223
|
+
</section>
|
|
224
|
+
{/if}
|
|
225
|
+
</div>
|
|
226
|
+
{:else}
|
|
227
|
+
<Header class={siteClasses} label={siteConfig.brand?.label ?? "Navigation"} logo={logo} navigation={navigation} actions={actions} />
|
|
228
|
+
{/if}
|
|
130
229
|
|
|
131
230
|
<style>
|
|
132
231
|
/* Hauteur de barre alignée sur la référence docs (80px) : le Header DS lit
|
|
@@ -164,4 +263,161 @@
|
|
|
164
263
|
.st-shell__actions { display: flex; align-items: center; gap: var(--st-spacing-2, 0.5rem); }
|
|
165
264
|
.st-shell__menuWrap { display: inline-flex; }
|
|
166
265
|
.st-shell__kbd { border: 1px solid var(--st-semantic-border-subtle); border-radius: 0.25rem; font-size: 0.6875rem; padding: 0 0.3rem; color: var(--st-semantic-text-secondary); }
|
|
266
|
+
|
|
267
|
+
.st-appShell {
|
|
268
|
+
--st-appShell-rail-width: var(--st-component-appShell-railWidth, 4.5rem);
|
|
269
|
+
--st-appShell-navigation-width: var(--st-component-appShell-navigationWidth, 20rem);
|
|
270
|
+
--st-appShell-context-width: var(--st-component-appShell-contextWidth, 22rem);
|
|
271
|
+
--st-appShell-utility-width: var(--st-component-appShell-utilityWidth, 24rem);
|
|
272
|
+
background: var(--st-component-appShell-background, var(--st-semantic-surface-default));
|
|
273
|
+
color: var(--st-semantic-text-primary);
|
|
274
|
+
display: grid;
|
|
275
|
+
grid-template-rows: auto minmax(0, 1fr) auto;
|
|
276
|
+
min-block-size: 100%;
|
|
277
|
+
position: relative;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.st-appShell__topChrome {
|
|
281
|
+
border-block-end: 1px solid var(--st-component-appShell-border, var(--st-semantic-border-subtle));
|
|
282
|
+
min-inline-size: 0;
|
|
283
|
+
z-index: var(--st-component-appShell-top-zIndex, 30);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.st-appShell__body {
|
|
287
|
+
display: grid;
|
|
288
|
+
grid-template-columns:
|
|
289
|
+
minmax(0, auto)
|
|
290
|
+
minmax(0, auto)
|
|
291
|
+
minmax(0, 1fr)
|
|
292
|
+
minmax(0, auto)
|
|
293
|
+
minmax(0, auto);
|
|
294
|
+
min-block-size: 0;
|
|
295
|
+
min-inline-size: 0;
|
|
296
|
+
position: relative;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.st-appShell__primaryRail {
|
|
300
|
+
inline-size: var(--st-appShell-rail-width);
|
|
301
|
+
order: 10;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.st-appShell__navigationPanel {
|
|
305
|
+
inline-size: var(--st-appShell-navigation-width);
|
|
306
|
+
order: 20;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.st-appShell__contextPanel {
|
|
310
|
+
inline-size: var(--st-appShell-context-width);
|
|
311
|
+
order: 40;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.st-appShell__utilityPanel {
|
|
315
|
+
inline-size: var(--st-appShell-utility-width);
|
|
316
|
+
order: 50;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.st-appShell__main {
|
|
320
|
+
order: 30;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.st-appShell__primaryRail,
|
|
324
|
+
.st-appShell__navigationPanel,
|
|
325
|
+
.st-appShell__contextPanel,
|
|
326
|
+
.st-appShell__utilityPanel {
|
|
327
|
+
background: var(--st-component-appShell-panelSurface, var(--st-semantic-surface-raised));
|
|
328
|
+
border-color: var(--st-component-appShell-border, var(--st-semantic-border-subtle));
|
|
329
|
+
min-block-size: 0;
|
|
330
|
+
min-inline-size: 0;
|
|
331
|
+
overflow: hidden;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.st-appShell__primaryRail,
|
|
335
|
+
.st-appShell__navigationPanel {
|
|
336
|
+
border-inline-end-style: solid;
|
|
337
|
+
border-inline-end-width: 1px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.st-appShell__contextPanel,
|
|
341
|
+
.st-appShell__utilityPanel {
|
|
342
|
+
border-inline-start-style: solid;
|
|
343
|
+
border-inline-start-width: 1px;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.st-appShell[data-utility-side="left"] .st-appShell__utilityPanel {
|
|
347
|
+
border-inline-end-style: solid;
|
|
348
|
+
border-inline-end-width: 1px;
|
|
349
|
+
border-inline-start-width: 0;
|
|
350
|
+
order: 25;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.st-appShell[data-utility-side="bottom"] .st-appShell__utilityPanel {
|
|
354
|
+
border-block-start: 1px solid var(--st-component-appShell-border, var(--st-semantic-border-subtle));
|
|
355
|
+
border-inline-start-width: 0;
|
|
356
|
+
grid-column: 1 / -1;
|
|
357
|
+
inline-size: auto;
|
|
358
|
+
order: 60;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.st-appShell__main {
|
|
362
|
+
min-block-size: 0;
|
|
363
|
+
min-inline-size: 0;
|
|
364
|
+
overflow: auto;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.st-appShell__bottomPanel {
|
|
368
|
+
background: var(--st-component-appShell-panelSurface, var(--st-semantic-surface-raised));
|
|
369
|
+
border-block-start: 1px solid var(--st-component-appShell-border, var(--st-semantic-border-subtle));
|
|
370
|
+
min-block-size: 0;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.st-appShell[data-utility-mode="overlay"] .st-appShell__utilityPanel,
|
|
374
|
+
.st-appShell[data-utility-mode="floating"] .st-appShell__utilityPanel {
|
|
375
|
+
box-shadow: var(--st-component-appShell-utilityShadow, 0 18px 45px rgb(15 23 42 / 0.18));
|
|
376
|
+
max-block-size: 100%;
|
|
377
|
+
position: absolute;
|
|
378
|
+
z-index: var(--st-component-appShell-utility-zIndex, 40);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.st-appShell[data-utility-mode="overlay"][data-utility-side="right"] .st-appShell__utilityPanel,
|
|
382
|
+
.st-appShell[data-utility-mode="floating"][data-utility-side="right"] .st-appShell__utilityPanel {
|
|
383
|
+
inset-block: 0;
|
|
384
|
+
inset-inline-end: 0;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.st-appShell[data-utility-mode="overlay"][data-utility-side="left"] .st-appShell__utilityPanel,
|
|
388
|
+
.st-appShell[data-utility-mode="floating"][data-utility-side="left"] .st-appShell__utilityPanel {
|
|
389
|
+
inset-block: 0;
|
|
390
|
+
inset-inline-start: 0;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.st-appShell[data-utility-mode="overlay"][data-utility-side="bottom"] .st-appShell__utilityPanel,
|
|
394
|
+
.st-appShell[data-utility-mode="floating"][data-utility-side="bottom"] .st-appShell__utilityPanel {
|
|
395
|
+
block-size: var(--st-component-appShell-utilityBottomHeight, min(40%, 20rem));
|
|
396
|
+
inline-size: auto;
|
|
397
|
+
inset-block-end: 0;
|
|
398
|
+
inset-inline: 0;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.st-appShell[data-utility-mode="floating"] .st-appShell__utilityPanel {
|
|
402
|
+
border: 1px solid var(--st-component-appShell-border, var(--st-semantic-border-subtle));
|
|
403
|
+
border-radius: var(--st-radius-lg, 0.75rem);
|
|
404
|
+
margin: var(--st-spacing-4, 1rem);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
@media (max-width: 48rem) {
|
|
408
|
+
.st-appShell__body {
|
|
409
|
+
display: flex;
|
|
410
|
+
flex-direction: column;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.st-appShell__primaryRail,
|
|
414
|
+
.st-appShell__navigationPanel,
|
|
415
|
+
.st-appShell__contextPanel,
|
|
416
|
+
.st-appShell__utilityPanel {
|
|
417
|
+
border-inline: 0;
|
|
418
|
+
border-block-end: 1px solid var(--st-component-appShell-border, var(--st-semantic-border-subtle));
|
|
419
|
+
inline-size: auto;
|
|
420
|
+
max-block-size: min(60vh, 28rem);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
167
423
|
</style>
|
|
@@ -1,8 +1,28 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
1
2
|
import type { SiteConfig } from "./site-config";
|
|
2
|
-
type
|
|
3
|
-
|
|
3
|
+
export type AppShellVariant = "site" | "workspace";
|
|
4
|
+
export type AppShellUtilityMode = "reserve" | "overlay" | "floating";
|
|
5
|
+
export type AppShellUtilitySide = "left" | "right" | "bottom";
|
|
6
|
+
export type AppShellProps = {
|
|
7
|
+
variant?: AppShellVariant;
|
|
8
|
+
config?: SiteConfig;
|
|
9
|
+
topChrome?: Snippet;
|
|
10
|
+
primaryRail?: Snippet;
|
|
11
|
+
navigationPanel?: Snippet;
|
|
12
|
+
main?: Snippet;
|
|
13
|
+
contextPanel?: Snippet;
|
|
14
|
+
utilityPanel?: Snippet;
|
|
15
|
+
bottomPanel?: Snippet;
|
|
16
|
+
children?: Snippet;
|
|
17
|
+
mainId?: string;
|
|
18
|
+
navigationLabel?: string;
|
|
19
|
+
contextLabel?: string;
|
|
20
|
+
utilityLabel?: string;
|
|
21
|
+
utilityMode?: AppShellUtilityMode;
|
|
22
|
+
utilitySide?: AppShellUtilitySide;
|
|
23
|
+
class?: string;
|
|
4
24
|
};
|
|
5
|
-
declare const AppShell: import("svelte").Component
|
|
25
|
+
declare const AppShell: import("svelte").Component<AppShellProps, {}, "">;
|
|
6
26
|
type AppShell = ReturnType<typeof AppShell>;
|
|
7
27
|
export default AppShell;
|
|
8
28
|
//# sourceMappingURL=AppShell.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.svelte.d.ts","sourceRoot":"","sources":["../src/lib/AppShell.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppShell.svelte.d.ts","sourceRoot":"","sources":["../src/lib/AppShell.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,WAAW,CAAC;AACnD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AACrE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAiNJ,QAAA,MAAM,QAAQ,mDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
date: string;
|
|
17
17
|
value: number;
|
|
18
18
|
};
|
|
19
|
+
|
|
20
|
+
export type CalendarHeatmapChartScale = "categorical" | "sequential";
|
|
19
21
|
</script>
|
|
20
22
|
|
|
21
23
|
<script lang="ts">
|
|
@@ -29,6 +31,7 @@
|
|
|
29
31
|
type CalendarHeatmapChartProps = {
|
|
30
32
|
data: CalendarHeatmapChartDatum[];
|
|
31
33
|
label: string;
|
|
34
|
+
scale?: CalendarHeatmapChartScale;
|
|
32
35
|
width?: number;
|
|
33
36
|
height?: number;
|
|
34
37
|
class?: string;
|
|
@@ -37,6 +40,7 @@
|
|
|
37
40
|
let {
|
|
38
41
|
data = [],
|
|
39
42
|
label,
|
|
43
|
+
scale = "sequential",
|
|
40
44
|
width = 480,
|
|
41
45
|
height = 140,
|
|
42
46
|
class: className
|
|
@@ -75,6 +79,12 @@
|
|
|
75
79
|
return Math.round((tsB - tsA) / 86400000);
|
|
76
80
|
}
|
|
77
81
|
|
|
82
|
+
function normalizedScale(value: CalendarHeatmapChartScale | undefined): CalendarHeatmapChartScale {
|
|
83
|
+
return value === "categorical" ? "categorical" : "sequential";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const resolvedScale = $derived(normalizedScale(scale));
|
|
87
|
+
|
|
78
88
|
// Group data by week and day-of-week
|
|
79
89
|
const grid = $derived.by(() => {
|
|
80
90
|
if (data.length === 0) return { cells: [], weeks: 0, monthLabels: [] };
|
|
@@ -187,7 +197,7 @@
|
|
|
187
197
|
hoveredDate = target.getAttribute("data-chart-date") ?? null;
|
|
188
198
|
}
|
|
189
199
|
|
|
190
|
-
const classes = () => ["st-calendarHeatmapChart", className].filter(Boolean).join(" ");
|
|
200
|
+
const classes = () => ["st-calendarHeatmapChart", `st-calendarHeatmapChart--${resolvedScale}`, className].filter(Boolean).join(" ");
|
|
191
201
|
</script>
|
|
192
202
|
|
|
193
203
|
<div class={classes()}>
|
|
@@ -15,9 +15,11 @@ export type CalendarHeatmapChartDatum = {
|
|
|
15
15
|
date: string;
|
|
16
16
|
value: number;
|
|
17
17
|
};
|
|
18
|
+
export type CalendarHeatmapChartScale = "categorical" | "sequential";
|
|
18
19
|
type CalendarHeatmapChartProps = {
|
|
19
20
|
data: CalendarHeatmapChartDatum[];
|
|
20
21
|
label: string;
|
|
22
|
+
scale?: CalendarHeatmapChartScale;
|
|
21
23
|
width?: number;
|
|
22
24
|
height?: number;
|
|
23
25
|
class?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarHeatmapChart.svelte.d.ts","sourceRoot":"","sources":["../src/lib/CalendarHeatmapChart.svelte.ts"],"names":[],"mappings":"AAGE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"CalendarHeatmapChart.svelte.d.ts","sourceRoot":"","sources":["../src/lib/CalendarHeatmapChart.svelte.ts"],"names":[],"mappings":"AAGE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,aAAa,GAAG,YAAY,CAAC;AAMrE,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,yBAAyB,EAAE,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,yBAAyB,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAuNJ,QAAA,MAAM,oBAAoB,+DAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
|
package/dist/Combobox.svelte
CHANGED
|
@@ -56,6 +56,8 @@
|
|
|
56
56
|
let expanded = $state(false);
|
|
57
57
|
let activeIndex = $state(-1);
|
|
58
58
|
|
|
59
|
+
const inputId = $derived((rest as { id?: string }).id ?? `st-combobox-${Math.random().toString(36).slice(2, 9)}`);
|
|
60
|
+
|
|
59
61
|
const fieldClasses = () => ["st-field", className].filter(Boolean).join(" ");
|
|
60
62
|
const groupClasses = () => ["st-combobox", `st-combobox--${size}`].join(" ");
|
|
61
63
|
const isInvalid = () => invalid || Boolean(errorText);
|
|
@@ -93,6 +95,7 @@
|
|
|
93
95
|
|
|
94
96
|
function clear() {
|
|
95
97
|
value = "";
|
|
98
|
+
activeIndex = -1;
|
|
96
99
|
onchange?.("");
|
|
97
100
|
}
|
|
98
101
|
|
|
@@ -131,11 +134,12 @@
|
|
|
131
134
|
</script>
|
|
132
135
|
|
|
133
136
|
<div class={fieldClasses()}>
|
|
134
|
-
<label class="st-field__control">
|
|
137
|
+
<label class="st-field__control" for={inputId}>
|
|
135
138
|
{#if label}<span class="st-field__label">{label}</span>{/if}
|
|
136
139
|
<span class={groupClasses()}>
|
|
137
140
|
<input
|
|
138
141
|
{...rest}
|
|
142
|
+
id={inputId}
|
|
139
143
|
type="text"
|
|
140
144
|
class="st-combobox__control"
|
|
141
145
|
role="combobox"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Combobox.svelte.ts"],"names":[],"mappings":"AAGE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,KAAK,aAAa,GAAG,IAAI,CACvB,mBAAmB,EACnB,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CACjD,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;
|
|
1
|
+
{"version":3,"file":"Combobox.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Combobox.svelte.ts"],"names":[],"mappings":"AAGE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,KAAK,aAAa,GAAG,IAAI,CACvB,mBAAmB,EACnB,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CACjD,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAyJJ,QAAA,MAAM,QAAQ,wDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|