@lostgradient/cinder 0.12.0 → 0.13.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/CHANGELOG.md +12 -0
- package/components.json +9 -6
- package/dist/components/accordion/index.js +14 -11
- package/dist/components/accordion-item/accordion-item.css +20 -7
- package/dist/components/accordion-item/accordion-item.schema.js +5 -1
- package/dist/components/accordion-item/accordion-item.types.d.ts +4 -0
- package/dist/components/accordion-item/accordion-item.variables.js +13 -2
- package/dist/components/accordion-item/index.js +14 -11
- package/dist/components/action-row/action-row.css +20 -9
- package/dist/components/action-row/action-row.schema.js +5 -1
- package/dist/components/action-row/action-row.types.d.ts +43 -0
- package/dist/components/action-row/action-row.variables.js +12 -2
- package/dist/components/chat/chat.svelte.d.ts +1 -0
- package/dist/components/diff-viewer/index.js +201 -101
- package/dist/components/json-schema-editor/index.js +229 -129
- package/dist/components/markdown-editor/index.js +207 -107
- package/dist/components/review-editor/index.js +291 -191
- package/dist/components/schedule-builder/index.js +205 -105
- package/dist/components/segment/index.js +119 -56
- package/dist/components/segment/segment.schema.d.ts +2 -2
- package/dist/components/segment/segment.schema.js +71 -33
- package/dist/components/segment/segment.svelte.d.ts +2 -1
- package/dist/components/segment/segment.types.d.ts +67 -10
- package/dist/components/segmented-control/index.js +193 -93
- package/dist/components/segmented-control/segmented-control-state.svelte.d.ts +4 -4
- package/dist/components/segmented-control/segmented-control.css +26 -6
- package/dist/components/segmented-control/segmented-control.schema.js +3 -3
- package/dist/components/segmented-control/segmented-control.svelte.d.ts +2 -1
- package/dist/components/segmented-control/segmented-control.types.d.ts +4 -4
- package/dist/components/side-navigation/side-navigation.css +2 -1
- package/dist/components/side-navigation/side-navigation.schema.js +9 -6
- package/dist/components/side-navigation/side-navigation.types.d.ts +11 -0
- package/dist/components/side-navigation/side-navigation.variables.js +2 -2
- package/dist/components/sidebar/index.d.ts +1 -0
- package/dist/components/sidebar/index.js +9 -3
- package/dist/components/sidebar/sidebar.constants.d.ts +12 -0
- package/dist/components/stat/stat.css +16 -8
- package/dist/components/stat/stat.schema.js +5 -1
- package/dist/components/stat/stat.types.d.ts +19 -0
- package/dist/components/stat/stat.variables.js +11 -2
- package/dist/components/stat-group/stat-group.css +7 -4
- package/dist/components/stat-group/stat-group.schema.js +5 -1
- package/dist/components/stat-group/stat-group.types.d.ts +27 -0
- package/dist/components/stat-group/stat-group.variables.js +6 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +479 -368
- package/dist/server/components/accordion/index.js +2 -2
- package/dist/server/components/accordion-item/index.js +2 -2
- package/dist/server/components/diff-viewer/index.js +4 -4
- package/dist/server/components/json-schema-editor/index.js +4 -4
- package/dist/server/components/markdown-editor/index.js +3 -3
- package/dist/server/components/review-editor/index.js +4 -4
- package/dist/server/components/schedule-builder/index.js +3 -3
- package/dist/server/components/segment/index.js +2 -2
- package/dist/server/components/segmented-control/index.js +3 -3
- package/dist/server/components/sidebar/index.js +7 -3
- package/dist/server/index.js +19 -13
- package/dist/server/{index.server-cf6pxeyg.js → index.server-0rzd71e0.js} +1 -1
- package/dist/server/{index.server-jgb8yh5k.js → index.server-2m1kenak.js} +1 -1
- package/dist/server/{index.server-jfrssta6.js → index.server-ck3fwrab.js} +1 -1
- package/dist/server/{index.server-sedjxt36.js → index.server-e89qfamd.js} +79 -35
- package/dist/server/{index.server-pag862vz.js → index.server-grgv455a.js} +2 -2
- package/dist/server/{index.server-y83kqayt.js → index.server-h3nzp8g8.js} +1 -1
- package/dist/server/{index.server-2qj6s2mh.js → index.server-j570vb03.js} +7 -3
- package/dist/server/index.server-jwvxxjvc.js +50 -0
- package/dist/server/{index.server-xeqtpv61.js → index.server-mr68brd6.js} +49 -24
- package/dist/server/{index.server-qbkxz7r2.js → index.server-nx9c2ep1.js} +2 -2
- package/dist/server/{index.server-jj76374p.js → index.server-p071e531.js} +1 -1
- package/dist/server/{index.server-5gzyqv78.js → index.server-v3arexq8.js} +2 -2
- package/dist/server/{index.server-85p4ydph.js → index.server-zzd5wpbw.js} +1 -1
- package/package.json +1 -1
- package/src/components/accordion/accordion.examples.json +6 -0
- package/src/components/accordion-item/accordion-item.css +20 -7
- package/src/components/accordion-item/accordion-item.schema.json +4 -0
- package/src/components/accordion-item/accordion-item.schema.ts +4 -0
- package/src/components/accordion-item/accordion-item.svelte +9 -7
- package/src/components/accordion-item/accordion-item.types.ts +4 -0
- package/src/components/accordion-item/accordion-item.variables.json +12 -1
- package/src/components/accordion-item/accordion-item.variables.ts +12 -1
- package/src/components/action-row/action-row.css +20 -9
- package/src/components/action-row/action-row.examples.json +6 -0
- package/src/components/action-row/action-row.schema.json +4 -0
- package/src/components/action-row/action-row.schema.ts +4 -0
- package/src/components/action-row/action-row.types.ts +44 -0
- package/src/components/action-row/action-row.variables.json +11 -1
- package/src/components/action-row/action-row.variables.ts +11 -1
- package/src/components/chat/chat.examples.json +6 -0
- package/src/components/segment/segment.schema.json +34 -7
- package/src/components/segment/segment.schema.ts +5 -47
- package/src/components/segment/segment.svelte +58 -23
- package/src/components/segment/segment.types.ts +81 -11
- package/src/components/segmented-control/segmented-control.css +26 -6
- package/src/components/segmented-control/segmented-control.examples.json +6 -0
- package/src/components/segmented-control/segmented-control.schema.json +2 -2
- package/src/components/segmented-control/segmented-control.schema.ts +2 -2
- package/src/components/segmented-control/segmented-control.svelte +50 -23
- package/src/components/segmented-control/segmented-control.types.ts +4 -7
- package/src/components/side-navigation/side-navigation.css +2 -1
- package/src/components/side-navigation/side-navigation.examples.json +6 -0
- package/src/components/side-navigation/side-navigation.schema.json +8 -5
- package/src/components/side-navigation/side-navigation.schema.ts +8 -5
- package/src/components/side-navigation/side-navigation.types.ts +12 -0
- package/src/components/side-navigation/side-navigation.variables.json +1 -1
- package/src/components/side-navigation/side-navigation.variables.ts +1 -1
- package/src/components/sidebar/index.ts +1 -0
- package/src/components/sidebar/sidebar.constants.ts +13 -0
- package/src/components/sidebar/sidebar.examples.json +6 -0
- package/src/components/sidebar/sidebar.svelte +4 -5
- package/src/components/stat/stat.css +16 -8
- package/src/components/stat/stat.schema.json +4 -0
- package/src/components/stat/stat.schema.ts +4 -0
- package/src/components/stat/stat.types.ts +20 -0
- package/src/components/stat/stat.variables.json +10 -1
- package/src/components/stat/stat.variables.ts +10 -1
- package/src/components/stat-group/stat-group.css +7 -4
- package/src/components/stat-group/stat-group.examples.json +6 -0
- package/src/components/stat-group/stat-group.schema.json +4 -0
- package/src/components/stat-group/stat-group.schema.ts +4 -0
- package/src/components/stat-group/stat-group.types.ts +28 -0
- package/src/components/stat-group/stat-group.variables.json +5 -1
- package/src/components/stat-group/stat-group.variables.ts +5 -1
- package/src/index.ts +5 -1
- package/src/styles/foundation.css +2 -1
- package/dist/server/index.server-hfx487zj.js +0 -42
|
@@ -12,3 +12,15 @@ export type SideNavigationProps = Omit<
|
|
|
12
12
|
/** Must be <li> elements containing NavigationItem and/or SideNavigationGroup. */
|
|
13
13
|
children: Snippet;
|
|
14
14
|
};
|
|
15
|
+
|
|
16
|
+
/** Schema generator surface for SideNavigation — excludes native attributes except supported styling hooks. */
|
|
17
|
+
export interface SideNavigationSchemaProps {
|
|
18
|
+
/** Accessible name for the <nav> landmark. Required, non-empty, distinct from other navs on the page. */
|
|
19
|
+
ariaLabel: string;
|
|
20
|
+
/** Additional CSS class merged with `.cinder-side-navigation`. */
|
|
21
|
+
class?: string;
|
|
22
|
+
/** Inline style string applied to the `.cinder-side-navigation` root. */
|
|
23
|
+
style?: string;
|
|
24
|
+
/** Must be <li> elements containing NavigationItem and/or SideNavigationGroup. */
|
|
25
|
+
children: Snippet;
|
|
26
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[]
|
|
1
|
+
["--cinder-side-navigation-list-gap"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewport width below which Sidebar uses its mobile drawer behavior.
|
|
3
|
+
*
|
|
4
|
+
* Consumers with app chrome outside the Sidebar can import this value instead
|
|
5
|
+
* of duplicating the component's internal breakpoint.
|
|
6
|
+
*/
|
|
7
|
+
export const SIDEBAR_MOBILE_BREAKPOINT = '47.99rem';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Fully parenthesized media query used by Sidebar to switch from the inline
|
|
11
|
+
* aside to the mobile drawer.
|
|
12
|
+
*/
|
|
13
|
+
export const SIDEBAR_MOBILE_MEDIA_QUERY = `(max-width: ${SIDEBAR_MOBILE_BREAKPOINT})`;
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
"title": "Basic sidebar",
|
|
9
9
|
"description": "Layout-level sidebar with brand, navigation, and footer regions. Collapse toggles icon-only mode on desktop and closes the drawer on mobile.",
|
|
10
10
|
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { NavigationItem } from '@lostgradient/cinder/navigation-item';\n import { SideNavigation } from '@lostgradient/cinder/side-navigation';\n import { SideNavigationGroup } from '@lostgradient/cinder/side-navigation-group';\n import { SideNavigationItem } from '@lostgradient/cinder/side-navigation-item';\n import { Sidebar } from '@lostgradient/cinder/sidebar';\n let collapsed = $state(false);\n</script>\n\n<div style=\"display: flex; flex-direction: column; gap: 1rem;\">\n <div>\n <Button\n label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n onclick={() => (collapsed = !collapsed)}\n />\n </div>\n\n <div\n style=\"display: flex; min-height: 24rem; border: 1px solid #e5e7eb; border-radius: 0.5rem; overflow: hidden;\"\n >\n <Sidebar bind:collapsed label=\"Workspace\">\n {#snippet brand()}\n <strong style=\"font-size: 0.875rem;\">Cinder</strong>\n {/snippet}\n\n {#snippet navigation()}\n <SideNavigation ariaLabel=\"Workspace sections\">\n {#snippet children()}\n <SideNavigationItem href=\"#dashboard\">\n {#snippet children()}Dashboard{/snippet}\n </SideNavigationItem>\n <SideNavigationItem href=\"#projects\" active>\n {#snippet children()}Projects{/snippet}\n </SideNavigationItem>\n <SideNavigationGroup label=\"Settings\">\n {#snippet children()}\n <SideNavigationItem href=\"#general\">\n {#snippet children()}General{/snippet}\n </SideNavigationItem>\n <SideNavigationItem href=\"#billing\">\n {#snippet children()}Billing{/snippet}\n </SideNavigationItem>\n {/snippet}\n </SideNavigationGroup>\n {/snippet}\n </SideNavigation>\n {/snippet}\n\n {#snippet footer()}\n <NavigationItem variant=\"vertical\" href=\"#account\">\n {#snippet children()}Account{/snippet}\n </NavigationItem>\n {/snippet}\n </Sidebar>\n\n <main style=\"flex: 1; padding: 1rem;\">\n <p>Main content area.</p>\n <p>Resize the viewport below ~767px to see the mobile drawer behavior.</p>\n </main>\n </div>\n</div>\n"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "mobile-trigger",
|
|
14
|
+
"title": "App-owned mobile trigger",
|
|
15
|
+
"description": "Use the exported Sidebar mobile media query when a top bar owns the drawer trigger outside the Sidebar.",
|
|
16
|
+
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { NavigationItem } from '@lostgradient/cinder/navigation-item';\n import { SideNavigation } from '@lostgradient/cinder/side-navigation';\n import { SideNavigationItem } from '@lostgradient/cinder/side-navigation-item';\n import { SIDEBAR_MOBILE_MEDIA_QUERY, Sidebar } from '@lostgradient/cinder/sidebar';\n import { MediaQuery } from 'svelte/reactivity';\n\n const mobile = new MediaQuery(SIDEBAR_MOBILE_MEDIA_QUERY, false);\n let collapsed = $state(true);\n\n const triggerLabel = $derived(\n mobile.current\n ? collapsed\n ? 'Open workspace navigation'\n : 'Close workspace navigation'\n : collapsed\n ? 'Expand workspace navigation'\n : 'Collapse workspace navigation',\n );\n</script>\n\n<div\n style=\"display: flex; min-height: 24rem; border: 1px solid #e5e7eb; border-radius: 0.5rem; overflow: hidden;\"\n>\n <Sidebar id=\"workspace-sidebar\" bind:collapsed label=\"Workspace\">\n {#snippet brand()}\n <strong style=\"font-size: 0.875rem;\">Cinder</strong>\n {/snippet}\n\n {#snippet navigation()}\n <SideNavigation ariaLabel=\"Workspace sections\">\n <SideNavigationItem href=\"#dashboard\">Dashboard</SideNavigationItem>\n <SideNavigationItem href=\"#projects\" active>Projects</SideNavigationItem>\n <SideNavigationItem href=\"#settings\">Settings</SideNavigationItem>\n </SideNavigation>\n {/snippet}\n\n {#snippet footer()}\n <NavigationItem variant=\"vertical\" href=\"#account\">Account</NavigationItem>\n {/snippet}\n </Sidebar>\n\n <main style=\"flex: 1; display: flex; flex-direction: column; min-inline-size: 0;\">\n <div\n style=\"display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid #e5e7eb;\"\n >\n <Button\n label={triggerLabel}\n aria-controls=\"workspace-sidebar\"\n aria-expanded={!collapsed}\n onclick={() => (collapsed = !collapsed)}\n />\n <strong>Workspace</strong>\n </div>\n\n <div style=\"padding: 1rem;\">\n <p style=\"margin: 0;\">\n The trigger lives in app chrome, while Sidebar owns the drawer state and breakpoint.\n </p>\n </div>\n </main>\n</div>\n"
|
|
11
17
|
}
|
|
12
18
|
]
|
|
13
19
|
}
|
|
@@ -7,6 +7,7 @@ import { MediaQuery } from 'svelte/reactivity';
|
|
|
7
7
|
import { setSidebarContext } from '../../_internal/sidebar-context.ts';
|
|
8
8
|
import { classNames } from '../../utilities/class-names.ts';
|
|
9
9
|
import Drawer from '../drawer/drawer.svelte';
|
|
10
|
+
import { SIDEBAR_MOBILE_MEDIA_QUERY } from './sidebar.constants.ts';
|
|
10
11
|
let { id: sidebarId, collapsed = $bindable(false), label = 'Sidebar', class: className, brand: brandSnippet, navigation: navigationSnippet, footer: footerSnippet, 'aria-label': _ariaLabelAttribute, 'aria-labelledby': _ariaLabelledbyAttribute, ...rest } = $props();
|
|
11
12
|
const validatedLabel = $derived.by(() => {
|
|
12
13
|
if (label.trim() === '') {
|
|
@@ -18,16 +19,14 @@ const validatedLabel = $derived.by(() => {
|
|
|
18
19
|
// complementary <aside> and the inner navigation are not announced as two
|
|
19
20
|
// identically-named landmarks.
|
|
20
21
|
const navigationLabel = $derived(`${validatedLabel} navigation`);
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
// is required — `window.matchMedia` rejects bare media feature expressions
|
|
24
|
-
// on Firefox and Safari.
|
|
22
|
+
// The fully-parenthesized form is required — `window.matchMedia` rejects
|
|
23
|
+
// bare media feature expressions on Firefox and Safari.
|
|
25
24
|
// Keep the fallback explicit for SSR-contract test environments that resolve
|
|
26
25
|
// the client MediaQuery build while `window.matchMedia` is unavailable.
|
|
27
26
|
const hasMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
|
|
28
27
|
const usesSsrResponsiveFallback = !hasMatchMedia;
|
|
29
28
|
const mobile = hasMatchMedia
|
|
30
|
-
? new MediaQuery(
|
|
29
|
+
? new MediaQuery(SIDEBAR_MOBILE_MEDIA_QUERY, false)
|
|
31
30
|
: { current: false };
|
|
32
31
|
const context = {
|
|
33
32
|
get collapsed() {
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
|
|
2
2
|
@layer cinder.components {
|
|
3
3
|
.cinder-stat {
|
|
4
|
+
--cinder-stat-row-gap: var(--cinder-space-1, 0.25rem);
|
|
5
|
+
--cinder-stat-column-gap: var(--cinder-space-3, 0.75rem);
|
|
6
|
+
--cinder-stat-label-font-size: var(--cinder-text-sm);
|
|
7
|
+
--cinder-stat-value-font-size: var(--cinder-text-4xl);
|
|
8
|
+
--cinder-stat-value-font-weight: var(--cinder-font-semibold);
|
|
9
|
+
--cinder-stat-value-line-height: 1.1;
|
|
10
|
+
--cinder-stat-change-gap: var(--cinder-space-1, 0.25rem);
|
|
11
|
+
--cinder-stat-change-font-size: var(--cinder-text-sm);
|
|
4
12
|
display: grid;
|
|
5
13
|
grid-template-columns: 1fr;
|
|
6
14
|
grid-template-rows: auto auto auto;
|
|
7
|
-
row-gap: var(--cinder-space-1, 0.25rem);
|
|
15
|
+
row-gap: var(--cinder-stat-row-gap, var(--cinder-space-1, 0.25rem));
|
|
8
16
|
align-items: start;
|
|
9
17
|
color: var(--cinder-text);
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
.cinder-stat[data-cinder-has-icon] {
|
|
13
21
|
grid-template-columns: auto 1fr;
|
|
14
|
-
column-gap: var(--cinder-space-3, 0.75rem);
|
|
22
|
+
column-gap: var(--cinder-stat-column-gap, var(--cinder-space-3, 0.75rem));
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
.cinder-stat__icon {
|
|
@@ -25,7 +33,7 @@
|
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
.cinder-stat__label {
|
|
28
|
-
font-size: var(--cinder-text-sm);
|
|
36
|
+
font-size: var(--cinder-stat-label-font-size, var(--cinder-text-sm));
|
|
29
37
|
color: var(--cinder-text-muted);
|
|
30
38
|
}
|
|
31
39
|
|
|
@@ -34,10 +42,10 @@
|
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
.cinder-stat__value {
|
|
37
|
-
font-size: var(--cinder-text-4xl);
|
|
38
|
-
font-weight: var(--cinder-font-semibold);
|
|
45
|
+
font-size: var(--cinder-stat-value-font-size, var(--cinder-text-4xl));
|
|
46
|
+
font-weight: var(--cinder-stat-value-font-weight, var(--cinder-font-semibold));
|
|
39
47
|
font-variant-numeric: tabular-nums;
|
|
40
|
-
line-height: 1.1;
|
|
48
|
+
line-height: var(--cinder-stat-value-line-height, 1.1);
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
.cinder-stat[data-cinder-has-icon] .cinder-stat__value {
|
|
@@ -47,8 +55,8 @@
|
|
|
47
55
|
.cinder-stat__change {
|
|
48
56
|
display: inline-flex;
|
|
49
57
|
align-items: center;
|
|
50
|
-
gap: var(--cinder-space-1, 0.25rem);
|
|
51
|
-
font-size: var(--cinder-text-sm);
|
|
58
|
+
gap: var(--cinder-stat-change-gap, var(--cinder-space-1, 0.25rem));
|
|
59
|
+
font-size: var(--cinder-stat-change-font-size, var(--cinder-text-sm));
|
|
52
60
|
}
|
|
53
61
|
|
|
54
62
|
.cinder-stat[data-cinder-has-icon] .cinder-stat__change {
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"class": {
|
|
25
25
|
"type": "string",
|
|
26
26
|
"description": "Additional class names merged with `.cinder-stat`."
|
|
27
|
+
},
|
|
28
|
+
"style": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Inline style string applied to the `.cinder-stat` root."
|
|
27
31
|
}
|
|
28
32
|
},
|
|
29
33
|
"additionalProperties": false,
|
|
@@ -28,6 +28,10 @@ const schema = {
|
|
|
28
28
|
type: 'string',
|
|
29
29
|
description: 'Additional class names merged with `.cinder-stat`.',
|
|
30
30
|
},
|
|
31
|
+
style: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'Inline style string applied to the `.cinder-stat` root.',
|
|
34
|
+
},
|
|
31
35
|
},
|
|
32
36
|
additionalProperties: false,
|
|
33
37
|
required: ['label', 'value'],
|
|
@@ -33,3 +33,23 @@ export type StatProps = Omit<HTMLAttributes<HTMLDivElement>, 'class'> & {
|
|
|
33
33
|
/** Additional class names merged with `.cinder-stat`. */
|
|
34
34
|
class?: string;
|
|
35
35
|
};
|
|
36
|
+
|
|
37
|
+
/** Schema generator surface for Stat — excludes native attributes except supported styling hooks. */
|
|
38
|
+
export interface StatSchemaProps {
|
|
39
|
+
/** Short label describing the metric, e.g. "Monthly Revenue". */
|
|
40
|
+
label: string;
|
|
41
|
+
/** The statistic. Strings rendered verbatim; numbers formatted via formatNumber. */
|
|
42
|
+
value: string | number;
|
|
43
|
+
/** Optional change indicator with direction and accessible wording. */
|
|
44
|
+
change?: StatChange;
|
|
45
|
+
/** Optional leading icon snippet (decorative — wrapper is aria-hidden). */
|
|
46
|
+
icon?: Snippet;
|
|
47
|
+
/** Intl.NumberFormat options applied only when `value` is a number. */
|
|
48
|
+
valueFormatOptions?: Intl.NumberFormatOptions;
|
|
49
|
+
/** Locale forwarded to formatNumber. Defaults to the nearest LocaleProvider locale, then en-US. */
|
|
50
|
+
valueLocale?: string;
|
|
51
|
+
/** Additional class names merged with `.cinder-stat`. */
|
|
52
|
+
class?: string;
|
|
53
|
+
/** Inline style string applied to the `.cinder-stat` root. */
|
|
54
|
+
style?: string;
|
|
55
|
+
}
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
[
|
|
1
|
+
[
|
|
2
|
+
"--cinder-stat-change-font-size",
|
|
3
|
+
"--cinder-stat-change-gap",
|
|
4
|
+
"--cinder-stat-column-gap",
|
|
5
|
+
"--cinder-stat-label-font-size",
|
|
6
|
+
"--cinder-stat-row-gap",
|
|
7
|
+
"--cinder-stat-value-font-size",
|
|
8
|
+
"--cinder-stat-value-font-weight",
|
|
9
|
+
"--cinder-stat-value-line-height"
|
|
10
|
+
]
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
const variables: readonly string[] = [
|
|
1
|
+
const variables: readonly string[] = [
|
|
2
|
+
'--cinder-stat-change-font-size',
|
|
3
|
+
'--cinder-stat-change-gap',
|
|
4
|
+
'--cinder-stat-column-gap',
|
|
5
|
+
'--cinder-stat-label-font-size',
|
|
6
|
+
'--cinder-stat-row-gap',
|
|
7
|
+
'--cinder-stat-value-font-size',
|
|
8
|
+
'--cinder-stat-value-font-weight',
|
|
9
|
+
'--cinder-stat-value-line-height',
|
|
10
|
+
];
|
|
2
11
|
|
|
3
12
|
export default variables;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
|
|
2
2
|
@layer cinder.components {
|
|
3
3
|
.cinder-stat-group {
|
|
4
|
+
--cinder-stat-group-gap: var(--cinder-space-4, 1rem);
|
|
5
|
+
--cinder-stat-group-card-padding: var(--cinder-space-4, 1rem);
|
|
6
|
+
--cinder-stat-group-shared-cell-padding: var(--cinder-space-4, 1rem);
|
|
4
7
|
display: grid;
|
|
5
|
-
gap: var(--cinder-space-4, 1rem);
|
|
8
|
+
gap: var(--cinder-stat-group-gap, var(--cinder-space-4, 1rem));
|
|
6
9
|
/* Query the group's own inline size so fixed column counts can collapse when
|
|
7
10
|
the group is narrow — even inside a wide viewport (RESPONSIVE-POLICY.md). */
|
|
8
11
|
container-type: inline-size;
|
|
@@ -50,7 +53,7 @@
|
|
|
50
53
|
|
|
51
54
|
/* variant: cards — each stat gets a card-style border, background, and shadow */
|
|
52
55
|
.cinder-stat-group[data-cinder-variant='cards'] > .cinder-stat {
|
|
53
|
-
padding: var(--cinder-space-4, 1rem);
|
|
56
|
+
padding: var(--cinder-stat-group-card-padding, var(--cinder-space-4, 1rem));
|
|
54
57
|
background: var(--cinder-surface-raised);
|
|
55
58
|
border: 1px solid var(--cinder-border);
|
|
56
59
|
border-radius: var(--cinder-radius-md, 0.5rem);
|
|
@@ -63,15 +66,15 @@
|
|
|
63
66
|
* gap with the surface color, avoiding nth-child math for any column count.
|
|
64
67
|
*/
|
|
65
68
|
.cinder-stat-group[data-cinder-variant='shared-borders'] {
|
|
69
|
+
--cinder-stat-group-gap: 1px;
|
|
66
70
|
border: 1px solid var(--cinder-border);
|
|
67
71
|
border-radius: var(--cinder-radius-md, 0.5rem);
|
|
68
72
|
overflow: hidden;
|
|
69
73
|
background: var(--cinder-border);
|
|
70
|
-
gap: 1px;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
.cinder-stat-group[data-cinder-variant='shared-borders'] > .cinder-stat {
|
|
74
|
-
padding: var(--cinder-space-4, 1rem);
|
|
77
|
+
padding: var(--cinder-stat-group-shared-cell-padding, var(--cinder-space-4, 1rem));
|
|
75
78
|
background: var(--cinder-surface-raised);
|
|
76
79
|
}
|
|
77
80
|
}
|
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
"description": "The `cards` variant renders each metric as a discrete bordered card, separating the tiles instead of laying them out edge-to-edge in a shared grid.",
|
|
22
22
|
"code": "<script lang=\"ts\">\n import { StatGroup } from '@lostgradient/cinder/stat-group';\n</script>\n\n<StatGroup label=\"This quarter\" columns={3} variant=\"cards\">\n <StatGroup.Stat label=\"Projects\" value={42} />\n <StatGroup.Stat label=\"Members\" value={18} />\n <StatGroup.Stat label=\"Storage\" value=\"64 GB\" />\n</StatGroup>\n"
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
"id": "compact-summary",
|
|
26
|
+
"title": "Compact summary strip",
|
|
27
|
+
"description": "Dense summaries can tune StatGroup spacing and Stat typography through public CSS variables.",
|
|
28
|
+
"code": "<script lang=\"ts\">\n import { StatGroup } from '@lostgradient/cinder/stat-group';\n</script>\n\n<StatGroup\n label=\"Workflow summary\"\n columns={4}\n variant=\"shared-borders\"\n style=\"--cinder-stat-group-gap: 1px; --cinder-stat-group-shared-cell-padding: var(--cinder-space-2);\"\n>\n <StatGroup.Stat\n label=\"Events\"\n value={128}\n style=\"--cinder-stat-row-gap: 0; --cinder-stat-label-font-size: var(--cinder-text-xs); --cinder-stat-value-font-size: var(--cinder-text-lg); --cinder-stat-change-font-size: var(--cinder-text-xs);\"\n />\n <StatGroup.Stat\n label=\"Matched\"\n value={42}\n style=\"--cinder-stat-row-gap: 0; --cinder-stat-label-font-size: var(--cinder-text-xs); --cinder-stat-value-font-size: var(--cinder-text-lg); --cinder-stat-change-font-size: var(--cinder-text-xs);\"\n />\n <StatGroup.Stat\n label=\"Retries\"\n value={3}\n style=\"--cinder-stat-row-gap: 0; --cinder-stat-label-font-size: var(--cinder-text-xs); --cinder-stat-value-font-size: var(--cinder-text-lg); --cinder-stat-change-font-size: var(--cinder-text-xs);\"\n />\n <StatGroup.Stat\n label=\"Latency\"\n value=\"184 ms\"\n style=\"--cinder-stat-row-gap: 0; --cinder-stat-label-font-size: var(--cinder-text-xs); --cinder-stat-value-font-size: var(--cinder-text-lg); --cinder-stat-change-font-size: var(--cinder-text-xs);\"\n />\n</StatGroup>\n"
|
|
29
|
+
},
|
|
24
30
|
{
|
|
25
31
|
"id": "shared-borders-variant",
|
|
26
32
|
"title": "Shared-borders variant",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"class": {
|
|
20
20
|
"type": "string",
|
|
21
21
|
"description": "Additional class names merged with `.cinder-stat-group`."
|
|
22
|
+
},
|
|
23
|
+
"style": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Inline style string applied to the `.cinder-stat-group` root."
|
|
22
26
|
}
|
|
23
27
|
},
|
|
24
28
|
"additionalProperties": false,
|
|
@@ -24,6 +24,10 @@ const schema = {
|
|
|
24
24
|
type: 'string',
|
|
25
25
|
description: 'Additional class names merged with `.cinder-stat-group`.',
|
|
26
26
|
},
|
|
27
|
+
style: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'Inline style string applied to the `.cinder-stat-group` root.',
|
|
30
|
+
},
|
|
27
31
|
},
|
|
28
32
|
additionalProperties: false,
|
|
29
33
|
metadata: {
|
|
@@ -28,3 +28,31 @@ export type StatGroupProps = Omit<HTMLAttributes<HTMLDivElement>, 'class'> & {
|
|
|
28
28
|
/** Additional class names merged with `.cinder-stat-group`. */
|
|
29
29
|
class?: string;
|
|
30
30
|
};
|
|
31
|
+
|
|
32
|
+
/** Schema generator surface for StatGroup — excludes native attributes except supported styling hooks. */
|
|
33
|
+
export interface StatGroupSchemaProps {
|
|
34
|
+
/**
|
|
35
|
+
* Optional accessible label for the whole stat set. When provided, the
|
|
36
|
+
* container becomes `role="group"` and uses this value as its accessible name.
|
|
37
|
+
*/
|
|
38
|
+
label?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Grid column count. `'auto'` uses auto-fit with minmax for responsive layout.
|
|
41
|
+
* @default 'auto'
|
|
42
|
+
*/
|
|
43
|
+
columns?: StatGroupColumns;
|
|
44
|
+
/**
|
|
45
|
+
* Visual variant; surfaced as `data-cinder-variant` for CSS styling.
|
|
46
|
+
* - `'default'` — plain grid, no borders or backgrounds.
|
|
47
|
+
* - `'cards'` — each stat gets a card-style border and shadow.
|
|
48
|
+
* - `'shared-borders'` — single outer border with 1px gap dividers between stats.
|
|
49
|
+
* @default 'default'
|
|
50
|
+
*/
|
|
51
|
+
variant?: StatGroupVariant;
|
|
52
|
+
/** Stat children, typically one or more `<Stat>` components. */
|
|
53
|
+
children: Snippet;
|
|
54
|
+
/** Additional class names merged with `.cinder-stat-group`. */
|
|
55
|
+
class?: string;
|
|
56
|
+
/** Inline style string applied to the `.cinder-stat-group` root. */
|
|
57
|
+
style?: string;
|
|
58
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -797,7 +797,11 @@ export type { SideNavigationGroupProps } from './components/side-navigation-grou
|
|
|
797
797
|
export { default as SideNavigationItem } from './components/side-navigation-item/index.ts';
|
|
798
798
|
export type { SideNavigationItemProps } from './components/side-navigation-item/index.ts';
|
|
799
799
|
|
|
800
|
-
export {
|
|
800
|
+
export {
|
|
801
|
+
SIDEBAR_MOBILE_BREAKPOINT,
|
|
802
|
+
SIDEBAR_MOBILE_MEDIA_QUERY,
|
|
803
|
+
default as Sidebar,
|
|
804
|
+
} from './components/sidebar/index.ts';
|
|
801
805
|
export type { SidebarProps } from './components/sidebar/index.ts';
|
|
802
806
|
|
|
803
807
|
export { default as SortableList } from './components/sortable-list/index.ts';
|
|
@@ -303,7 +303,8 @@
|
|
|
303
303
|
.cinder-dropdown-item[data-disabled],
|
|
304
304
|
.cinder-toggle:disabled,
|
|
305
305
|
.cinder-segmented-control[aria-disabled='true'],
|
|
306
|
-
.cinder-segmented-control-option:disabled
|
|
306
|
+
.cinder-segmented-control-option:disabled,
|
|
307
|
+
.cinder-segmented-control-option[aria-disabled='true']
|
|
307
308
|
) {
|
|
308
309
|
opacity: 0.6;
|
|
309
310
|
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
strictStableContext
|
|
3
|
-
} from "./index.server-bn02606y.js";
|
|
4
|
-
import {
|
|
5
|
-
classNames
|
|
6
|
-
} from "./index.server-z7nvkz8v.js";
|
|
7
|
-
|
|
8
|
-
// src/components/accordion-item/accordion-item.svelte
|
|
9
|
-
import * as $ from "svelte/internal/server";
|
|
10
|
-
|
|
11
|
-
// src/components/accordion/accordion.context.ts
|
|
12
|
-
var [getAccordionContext, setAccordionContext] = strictStableContext("@lostgradient/cinder/accordion/context", "AccordionItem must be rendered inside an Accordion");
|
|
13
|
-
|
|
14
|
-
// src/components/accordion-item/accordion-item.svelte
|
|
15
|
-
function Accordion_item($$renderer, $$props) {
|
|
16
|
-
$$renderer.component(($$renderer2) => {
|
|
17
|
-
let { id, title, disabled = false, class: className, children } = $$props;
|
|
18
|
-
const context = getAccordionContext();
|
|
19
|
-
const isExpanded = $.derived(() => context.expandedIds.includes(id));
|
|
20
|
-
const headerId = $.derived(() => `${id}-header`);
|
|
21
|
-
const panelId = $.derived(() => `${id}-panel`);
|
|
22
|
-
function handleClick() {
|
|
23
|
-
if (disabled)
|
|
24
|
-
return;
|
|
25
|
-
context.toggle(id);
|
|
26
|
-
}
|
|
27
|
-
$$renderer2.push(`<div${$.attr_class($.clsx(classNames("cinder-accordion-item", className)))}${$.attr("data-cinder-expanded", isExpanded() ? "" : undefined)}${$.attr("data-cinder-disabled", disabled ? "" : undefined)}><h3 class="cinder-accordion-item__heading"><button type="button"${$.attr("id", headerId())} class="cinder-accordion-item__trigger"${$.attr("aria-expanded", isExpanded())}${$.attr("aria-controls", panelId())}${$.attr("disabled", disabled, true)}><span class="cinder-accordion-item__title">${$.escape(title)}</span> <svg class="cinder-accordion-item__chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" focusable="false"><path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06z" clip-rule="evenodd"></path></svg></button></h3> `);
|
|
28
|
-
if (isExpanded()) {
|
|
29
|
-
$$renderer2.push("<!--[0-->");
|
|
30
|
-
$$renderer2.push(`<div${$.attr("id", panelId())} class="cinder-accordion-item__panel"><div class="cinder-accordion-item__panel-inner">`);
|
|
31
|
-
children($$renderer2);
|
|
32
|
-
$$renderer2.push(`<!----></div></div>`);
|
|
33
|
-
} else {
|
|
34
|
-
$$renderer2.push("<!--[-1-->");
|
|
35
|
-
}
|
|
36
|
-
$$renderer2.push(`<!--]--></div>`);
|
|
37
|
-
}, Accordion_item);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { setAccordionContext, Accordion_item };
|
|
41
|
-
|
|
42
|
-
//# debugId=A611BC101408464764756E2164756E21
|