@lostgradient/cinder 0.12.1 → 0.14.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/components.json +55 -5
  3. package/dist/components/chat/index.js +93 -93
  4. package/dist/components/chat-conversation-header/index.js +3 -3
  5. package/dist/components/diff-viewer/index.js +230 -130
  6. package/dist/components/json-schema-editor/index.js +258 -158
  7. package/dist/components/markdown-editor/index.js +224 -124
  8. package/dist/components/review-editor/index.js +364 -264
  9. package/dist/components/schedule-builder/index.js +205 -105
  10. package/dist/components/segment/index.js +119 -56
  11. package/dist/components/segment/segment.schema.d.ts +2 -2
  12. package/dist/components/segment/segment.schema.js +71 -33
  13. package/dist/components/segment/segment.svelte.d.ts +2 -1
  14. package/dist/components/segment/segment.types.d.ts +67 -10
  15. package/dist/components/segmented-control/index.js +193 -93
  16. package/dist/components/segmented-control/segmented-control-state.svelte.d.ts +4 -4
  17. package/dist/components/segmented-control/segmented-control.css +26 -6
  18. package/dist/components/segmented-control/segmented-control.schema.js +3 -3
  19. package/dist/components/segmented-control/segmented-control.svelte.d.ts +2 -1
  20. package/dist/components/segmented-control/segmented-control.types.d.ts +4 -4
  21. package/dist/components/selectable-row/index.d.ts +5 -0
  22. package/dist/components/selectable-row/index.js +288 -0
  23. package/dist/components/selectable-row/selectable-row.css +128 -0
  24. package/dist/components/selectable-row/selectable-row.css.d.ts +1 -0
  25. package/dist/components/selectable-row/selectable-row.schema.d.ts +3 -0
  26. package/dist/components/selectable-row/selectable-row.schema.js +155 -0
  27. package/dist/components/selectable-row/selectable-row.svelte.d.ts +24 -0
  28. package/dist/components/selectable-row/selectable-row.types.d.ts +84 -0
  29. package/dist/components/selectable-row/selectable-row.variables.d.ts +2 -0
  30. package/dist/components/selectable-row/selectable-row.variables.js +68 -0
  31. package/dist/components/sidebar/index.d.ts +1 -0
  32. package/dist/components/sidebar/index.js +9 -3
  33. package/dist/components/sidebar/sidebar.constants.d.ts +12 -0
  34. package/dist/index.d.ts +3 -1
  35. package/dist/index.js +4408 -4075
  36. package/dist/server/components/chat/index.js +2 -2
  37. package/dist/server/components/chat-conversation-header/index.js +2 -2
  38. package/dist/server/components/diff-viewer/index.js +4 -4
  39. package/dist/server/components/json-schema-editor/index.js +4 -4
  40. package/dist/server/components/markdown-editor/index.js +3 -3
  41. package/dist/server/components/review-editor/index.js +53 -53
  42. package/dist/server/components/schedule-builder/index.js +3 -3
  43. package/dist/server/components/segment/index.js +2 -2
  44. package/dist/server/components/segmented-control/index.js +3 -3
  45. package/dist/server/components/selectable-row/index.js +12 -0
  46. package/dist/server/components/side-navigation/index.js +2 -2
  47. package/dist/server/components/sidebar/index.js +7 -3
  48. package/dist/server/index.js +44 -33
  49. package/dist/server/{index.server-3w72dxz7.js → index.server-0jhra85x.js} +4 -4
  50. package/dist/server/index.server-1gzbrhhh.js +151 -0
  51. package/dist/server/{index.server-jgb8yh5k.js → index.server-2m1kenak.js} +1 -1
  52. package/dist/server/{index.server-jfrssta6.js → index.server-46cjwcqw.js} +1 -1
  53. package/dist/server/{index.server-2zdbz3rj.js → index.server-8rmtb8vx.js} +4 -4
  54. package/dist/server/{index.server-pag862vz.js → index.server-9ra3xv88.js} +28 -28
  55. package/dist/server/{index.server-sedjxt36.js → index.server-e89qfamd.js} +79 -35
  56. package/dist/server/{index.server-4x4hgvqe.js → index.server-f2me5abn.js} +114 -114
  57. package/dist/server/{index.server-2qj6s2mh.js → index.server-j570vb03.js} +7 -3
  58. package/dist/server/{index.server-xeqtpv61.js → index.server-mr68brd6.js} +49 -24
  59. package/dist/server/{index.server-2s5h1d05.js → index.server-nphtb2ey.js} +1 -1
  60. package/dist/server/{index.server-qbkxz7r2.js → index.server-nx9c2ep1.js} +2 -2
  61. package/dist/server/{index.server-jj76374p.js → index.server-t1x9h8cb.js} +1 -1
  62. package/dist/server/{index.server-5gzyqv78.js → index.server-vhyjjx9z.js} +34 -34
  63. package/dist/server/{index.server-85p4ydph.js → index.server-zzd5wpbw.js} +1 -1
  64. package/package.json +33 -1
  65. package/src/components/segment/segment.schema.json +34 -7
  66. package/src/components/segment/segment.schema.ts +5 -47
  67. package/src/components/segment/segment.svelte +58 -23
  68. package/src/components/segment/segment.types.ts +81 -11
  69. package/src/components/segmented-control/segmented-control.css +26 -6
  70. package/src/components/segmented-control/segmented-control.examples.json +6 -0
  71. package/src/components/segmented-control/segmented-control.schema.json +2 -2
  72. package/src/components/segmented-control/segmented-control.schema.ts +2 -2
  73. package/src/components/segmented-control/segmented-control.svelte +50 -23
  74. package/src/components/segmented-control/segmented-control.types.ts +4 -7
  75. package/src/components/selectable-row/index.ts +12 -0
  76. package/src/components/selectable-row/selectable-row.css +128 -0
  77. package/src/components/selectable-row/selectable-row.examples.json +13 -0
  78. package/src/components/selectable-row/selectable-row.schema.json +95 -0
  79. package/src/components/selectable-row/selectable-row.schema.ts +104 -0
  80. package/src/components/selectable-row/selectable-row.svelte +95 -0
  81. package/src/components/selectable-row/selectable-row.types.ts +97 -0
  82. package/src/components/selectable-row/selectable-row.variables.json +8 -0
  83. package/src/components/selectable-row/selectable-row.variables.ts +10 -0
  84. package/src/components/sidebar/index.ts +1 -0
  85. package/src/components/sidebar/sidebar.constants.ts +13 -0
  86. package/src/components/sidebar/sidebar.examples.json +6 -0
  87. package/src/components/sidebar/sidebar.svelte +4 -5
  88. package/src/index.ts +14 -1
  89. package/src/styles/components.css +1 -0
  90. package/src/styles/foundation.css +2 -1
@@ -0,0 +1,95 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "density": {
6
+ "enum": ["comfortable", "condensed"],
7
+ "description": "Density token surfaced as `data-cinder-density`.",
8
+ "default": "comfortable"
9
+ },
10
+ "selected": {
11
+ "type": "boolean",
12
+ "description": "Whether the primary action represents the selected or current row.",
13
+ "default": false
14
+ },
15
+ "selectedState": {
16
+ "enum": ["pressed", "current"],
17
+ "description": "Accessible state mapping for selected button rows. Links always use `aria-current`.",
18
+ "default": "pressed"
19
+ },
20
+ "href": {
21
+ "type": "string",
22
+ "description": "Destination that renders the primary action as a native anchor."
23
+ },
24
+ "rel": {
25
+ "anyOf": [
26
+ {
27
+ "type": "string"
28
+ },
29
+ {
30
+ "type": "null"
31
+ }
32
+ ],
33
+ "description": "`rel` forwarded to the primary anchor and de-duplicated case-insensitively; `noopener noreferrer` is merged when `target=\"_blank\"`."
34
+ },
35
+ "currentValue": {
36
+ "enum": ["page", "step", "location", "date", "time", "true"],
37
+ "description": "`aria-current` value emitted for a selected link or a selected button using `selectedState=\"current\"`.",
38
+ "default": "true"
39
+ },
40
+ "type": {
41
+ "enum": ["button", "submit", "reset"],
42
+ "description": "Native button type.",
43
+ "default": "button"
44
+ },
45
+ "class": {
46
+ "type": "string",
47
+ "description": "Additional classes merged with `.cinder-selectable-row`."
48
+ },
49
+ "style": {
50
+ "type": "string",
51
+ "description": "Inline style string applied to the `.cinder-selectable-row` root."
52
+ }
53
+ },
54
+ "additionalProperties": false,
55
+ "metadata": {
56
+ "unsupportedProps": [
57
+ {
58
+ "name": "description",
59
+ "reason": "function-or-snippet",
60
+ "description": "Secondary description below the title."
61
+ },
62
+ {
63
+ "name": "leading",
64
+ "reason": "function-or-snippet",
65
+ "description": "Leading visual such as an icon, avatar, marker, or status dot."
66
+ },
67
+ {
68
+ "name": "meta",
69
+ "reason": "function-or-snippet",
70
+ "description": "Tertiary metadata such as a timestamp, status, or compact badge."
71
+ },
72
+ {
73
+ "name": "onclick",
74
+ "reason": "function-or-snippet",
75
+ "description": "Called when the native primary button activates. Optional for submit and reset buttons."
76
+ },
77
+ {
78
+ "name": "target",
79
+ "reason": "unknown-shape",
80
+ "description": "Browsing context for the primary anchor. `_blank` merges `noopener noreferrer` into `rel`."
81
+ },
82
+ {
83
+ "name": "title",
84
+ "reason": "function-or-snippet",
85
+ "required": true,
86
+ "description": "Primary row label. Required."
87
+ },
88
+ {
89
+ "name": "trailingActions",
90
+ "reason": "function-or-snippet",
91
+ "description": "Independent controls rendered as siblings after the primary action."
92
+ }
93
+ ]
94
+ }
95
+ }
@@ -0,0 +1,104 @@
1
+ import type { ComponentSchema } from '../../schema-types';
2
+
3
+ const schema = {
4
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
5
+ type: 'object',
6
+ properties: {
7
+ density: {
8
+ enum: ['comfortable', 'condensed'],
9
+ description: 'Density token surfaced as `data-cinder-density`.',
10
+ default: 'comfortable',
11
+ },
12
+ selected: {
13
+ type: 'boolean',
14
+ description: 'Whether the primary action represents the selected or current row.',
15
+ default: false,
16
+ },
17
+ selectedState: {
18
+ enum: ['pressed', 'current'],
19
+ description:
20
+ 'Accessible state mapping for selected button rows. Links always use `aria-current`.',
21
+ default: 'pressed',
22
+ },
23
+ href: {
24
+ type: 'string',
25
+ description: 'Destination that renders the primary action as a native anchor.',
26
+ },
27
+ rel: {
28
+ anyOf: [
29
+ {
30
+ type: 'string',
31
+ },
32
+ {
33
+ type: 'null',
34
+ },
35
+ ],
36
+ description:
37
+ '`rel` forwarded to the primary anchor and de-duplicated case-insensitively; `noopener noreferrer` is merged when `target="_blank"`.',
38
+ },
39
+ currentValue: {
40
+ enum: ['page', 'step', 'location', 'date', 'time', 'true'],
41
+ description:
42
+ '`aria-current` value emitted for a selected link or a selected button using `selectedState="current"`.',
43
+ default: 'true',
44
+ },
45
+ type: {
46
+ enum: ['button', 'submit', 'reset'],
47
+ description: 'Native button type.',
48
+ default: 'button',
49
+ },
50
+ class: {
51
+ type: 'string',
52
+ description: 'Additional classes merged with `.cinder-selectable-row`.',
53
+ },
54
+ style: {
55
+ type: 'string',
56
+ description: 'Inline style string applied to the `.cinder-selectable-row` root.',
57
+ },
58
+ },
59
+ additionalProperties: false,
60
+ metadata: {
61
+ unsupportedProps: [
62
+ {
63
+ name: 'description',
64
+ reason: 'function-or-snippet',
65
+ description: 'Secondary description below the title.',
66
+ },
67
+ {
68
+ name: 'leading',
69
+ reason: 'function-or-snippet',
70
+ description: 'Leading visual such as an icon, avatar, marker, or status dot.',
71
+ },
72
+ {
73
+ name: 'meta',
74
+ reason: 'function-or-snippet',
75
+ description: 'Tertiary metadata such as a timestamp, status, or compact badge.',
76
+ },
77
+ {
78
+ name: 'onclick',
79
+ reason: 'function-or-snippet',
80
+ description:
81
+ 'Called when the native primary button activates. Optional for submit and reset buttons.',
82
+ },
83
+ {
84
+ name: 'target',
85
+ reason: 'unknown-shape',
86
+ description:
87
+ 'Browsing context for the primary anchor. `_blank` merges `noopener noreferrer` into `rel`.',
88
+ },
89
+ {
90
+ name: 'title',
91
+ reason: 'function-or-snippet',
92
+ required: true,
93
+ description: 'Primary row label. Required.',
94
+ },
95
+ {
96
+ name: 'trailingActions',
97
+ reason: 'function-or-snippet',
98
+ description: 'Independent controls rendered as siblings after the primary action.',
99
+ },
100
+ ],
101
+ },
102
+ } satisfies ComponentSchema;
103
+
104
+ export default schema as ComponentSchema;
@@ -0,0 +1,95 @@
1
+ <script lang="ts" module>
2
+ export {};
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ import { classNames } from '../../utilities/class-names.ts';
7
+ let { density = 'comfortable', selected = false, selectedState = 'pressed', href, currentValue = 'true', type = 'button', leading, title, description, meta, trailingActions, class: className, style, ...rest } = $props();
8
+ const isLink = $derived(href !== undefined);
9
+ const selectedDataAttribute = $derived(selected ? '' : undefined);
10
+ const ariaPressed = $derived(!isLink && selectedState === 'pressed' ? selected : undefined);
11
+ const ariaCurrent = $derived(selected && (isLink || selectedState === 'current') ? currentValue : undefined);
12
+ const anchorAttributes = $derived(rest);
13
+ const buttonAttributes = $derived(rest);
14
+ const resolvedRel = $derived.by(() => {
15
+ if (!isLink)
16
+ return undefined;
17
+ const consumerTokens = (anchorAttributes.rel ?? '').split(/\s+/).filter(Boolean);
18
+ const seen = new Set();
19
+ const merged = [];
20
+ for (const token of consumerTokens) {
21
+ const normalizedToken = token.toLowerCase();
22
+ if (!seen.has(normalizedToken)) {
23
+ seen.add(normalizedToken);
24
+ merged.push(token);
25
+ }
26
+ }
27
+ if (anchorAttributes.target?.toLowerCase() === '_blank') {
28
+ for (const token of ['noopener', 'noreferrer']) {
29
+ if (!seen.has(token)) {
30
+ seen.add(token);
31
+ merged.push(token);
32
+ }
33
+ }
34
+ }
35
+ return merged.length > 0 ? merged.join(' ') : undefined;
36
+ });
37
+ </script>
38
+
39
+ <div
40
+ class={classNames(
41
+ 'cinder-selectable-row',
42
+ leading && 'cinder-selectable-row--has-leading',
43
+ trailingActions && 'cinder-selectable-row--has-trailing-actions',
44
+ className,
45
+ )}
46
+ {style}
47
+ data-cinder-density={density}
48
+ data-cinder-selected={selectedDataAttribute}
49
+ >
50
+ {#if isLink}
51
+ <a
52
+ {...anchorAttributes}
53
+ class="cinder-selectable-row__primary"
54
+ {href}
55
+ rel={resolvedRel}
56
+ aria-current={ariaCurrent}
57
+ >
58
+ {#if leading}
59
+ <span class="cinder-selectable-row__leading">{@render leading()}</span>
60
+ {/if}
61
+ <span class="cinder-selectable-row__body">
62
+ <span class="cinder-selectable-row__title">{@render title()}</span>
63
+ {#if description}
64
+ <span class="cinder-selectable-row__description">{@render description()}</span>
65
+ {/if}
66
+ {#if meta}<span class="cinder-selectable-row__meta">{@render meta()}</span>{/if}
67
+ </span>
68
+ </a>
69
+ {:else}
70
+ <button
71
+ {...buttonAttributes}
72
+ class="cinder-selectable-row__primary"
73
+ {type}
74
+ aria-pressed={ariaPressed}
75
+ aria-current={ariaCurrent}
76
+ >
77
+ {#if leading}
78
+ <span class="cinder-selectable-row__leading">{@render leading()}</span>
79
+ {/if}
80
+ <span class="cinder-selectable-row__body">
81
+ <span class="cinder-selectable-row__title">{@render title()}</span>
82
+ {#if description}
83
+ <span class="cinder-selectable-row__description">{@render description()}</span>
84
+ {/if}
85
+ {#if meta}<span class="cinder-selectable-row__meta">{@render meta()}</span>{/if}
86
+ </span>
87
+ </button>
88
+ {/if}
89
+
90
+ {#if trailingActions}
91
+ <div class="cinder-selectable-row__trailing-actions">
92
+ {@render trailingActions()}
93
+ </div>
94
+ {/if}
95
+ </div>
@@ -0,0 +1,97 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
+
4
+ export type SelectableRowDensity = 'comfortable' | 'condensed';
5
+ export type SelectableRowSelectedState = 'pressed' | 'current';
6
+ export type SelectableRowCurrentValue = 'page' | 'step' | 'location' | 'date' | 'time' | 'true';
7
+
8
+ type SelectableRowSharedProps = {
9
+ /** Density token surfaced as `data-cinder-density`. @default "comfortable" */
10
+ density?: SelectableRowDensity;
11
+ /** Whether the primary action represents the selected or current row. @default false */
12
+ selected?: boolean;
13
+ /** Leading visual such as an icon, avatar, marker, or status dot. */
14
+ leading?: Snippet;
15
+ /** Primary row label. Required so the native action has visible text and an accessible name. */
16
+ title: Snippet;
17
+ /** Secondary description below the title. */
18
+ description?: Snippet;
19
+ /** Tertiary metadata such as a timestamp, status, or compact badge. */
20
+ meta?: Snippet;
21
+ /** Independent controls rendered as siblings after the primary action. */
22
+ trailingActions?: Snippet;
23
+ /** Additional classes merged with `.cinder-selectable-row`. */
24
+ class?: string;
25
+ /** Inline style string applied to the `.cinder-selectable-row` root. */
26
+ style?: string;
27
+ };
28
+
29
+ type SelectableRowButtonProps = SelectableRowSharedProps &
30
+ Omit<
31
+ HTMLButtonAttributes,
32
+ 'aria-current' | 'aria-pressed' | 'class' | 'href' | 'style' | 'title' | 'type'
33
+ > & {
34
+ href?: undefined;
35
+ /** Called when the native primary button activates. Optional for submit and reset buttons. */
36
+ onclick?: (event: MouseEvent) => void;
37
+ /** Native button type. @default "button" */
38
+ type?: 'button' | 'submit' | 'reset';
39
+ /** Accessible state mapping for selected button rows. @default "pressed" */
40
+ selectedState?: SelectableRowSelectedState;
41
+ /** `aria-current` value emitted when `selectedState="current"` and the row is selected. @default "true" */
42
+ currentValue?: SelectableRowCurrentValue;
43
+ };
44
+
45
+ type SelectableRowLinkProps = SelectableRowSharedProps &
46
+ Omit<
47
+ HTMLAnchorAttributes,
48
+ 'aria-current' | 'aria-pressed' | 'class' | 'href' | 'rel' | 'style' | 'target' | 'title'
49
+ > & {
50
+ /** Destination that renders the primary action as a native anchor. */
51
+ href: string;
52
+ /** Browsing context for the primary anchor. `_blank` merges `noopener noreferrer` into `rel`. */
53
+ target?: HTMLAnchorAttributes['target'];
54
+ /** `rel` forwarded to the primary anchor and de-duplicated case-insensitively; `noopener noreferrer` is merged when `target="_blank"`. */
55
+ rel?: HTMLAnchorAttributes['rel'];
56
+ /** `aria-current` value emitted when the linked row is selected. @default "true" */
57
+ currentValue?: SelectableRowCurrentValue;
58
+ selectedState?: never;
59
+ type?: never;
60
+ };
61
+
62
+ /** Props for SelectableRow. Pass `href` for a link or `onclick` for a button. */
63
+ export type SelectableRowProps = SelectableRowButtonProps | SelectableRowLinkProps;
64
+
65
+ /** Cinder-specific props used by the schema generator. */
66
+ export interface SelectableRowSchemaProps {
67
+ /** Density token surfaced as `data-cinder-density`. @default "comfortable" */
68
+ density?: SelectableRowDensity;
69
+ /** Whether the primary action represents the selected or current row. @default false */
70
+ selected?: boolean;
71
+ /** Accessible state mapping for selected button rows. Links always use `aria-current`. @default "pressed" */
72
+ selectedState?: SelectableRowSelectedState;
73
+ /** Destination that renders the primary action as a native anchor. */
74
+ href?: string;
75
+ /** Browsing context for the primary anchor. `_blank` merges `noopener noreferrer` into `rel`. */
76
+ target?: HTMLAnchorAttributes['target'];
77
+ /** `rel` forwarded to the primary anchor and de-duplicated case-insensitively; `noopener noreferrer` is merged when `target="_blank"`. */
78
+ rel?: HTMLAnchorAttributes['rel'];
79
+ /** `aria-current` value emitted for a selected link or a selected button using `selectedState="current"`. @default "true" */
80
+ currentValue?: SelectableRowCurrentValue;
81
+ /** Native button type. @default "button" */
82
+ type?: 'button' | 'submit' | 'reset';
83
+ /** Leading visual such as an icon, avatar, marker, or status dot. */
84
+ leading?: Snippet;
85
+ /** Primary row label. Required. */
86
+ title: Snippet;
87
+ /** Secondary description below the title. */
88
+ description?: Snippet;
89
+ /** Tertiary metadata such as a timestamp, status, or compact badge. */
90
+ meta?: Snippet;
91
+ /** Independent controls rendered as siblings after the primary action. */
92
+ trailingActions?: Snippet;
93
+ /** Additional classes merged with `.cinder-selectable-row`. */
94
+ class?: string;
95
+ /** Inline style string applied to the `.cinder-selectable-row` root. */
96
+ style?: string;
97
+ }
@@ -0,0 +1,8 @@
1
+ [
2
+ "--cinder-selectable-row-column-gap",
3
+ "--cinder-selectable-row-content-gap",
4
+ "--cinder-selectable-row-leading-gap",
5
+ "--cinder-selectable-row-padding-block",
6
+ "--cinder-selectable-row-padding-inline",
7
+ "--cinder-selectable-row-trailing-actions-gap"
8
+ ]
@@ -0,0 +1,10 @@
1
+ const variables: readonly string[] = [
2
+ '--cinder-selectable-row-column-gap',
3
+ '--cinder-selectable-row-content-gap',
4
+ '--cinder-selectable-row-leading-gap',
5
+ '--cinder-selectable-row-padding-block',
6
+ '--cinder-selectable-row-padding-inline',
7
+ '--cinder-selectable-row-trailing-actions-gap',
8
+ ];
9
+
10
+ export default variables;
@@ -2,5 +2,6 @@ import './sidebar.css';
2
2
  import Sidebar from './sidebar.svelte';
3
3
 
4
4
  export default Sidebar;
5
+ export { SIDEBAR_MOBILE_BREAKPOINT, SIDEBAR_MOBILE_MEDIA_QUERY } from './sidebar.constants.ts';
5
6
  export type { SidebarProps } from './sidebar.types.ts';
6
7
  export { Sidebar };
@@ -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
- // Breakpoint matches the existing `47.99rem` (~767px) convention used by
22
- // navigation-bar.css and navigation-item.css. The fully-parenthesized form
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('(max-width: 47.99rem)', false)
29
+ ? new MediaQuery(SIDEBAR_MOBILE_MEDIA_QUERY, false)
31
30
  : { current: false };
32
31
  const context = {
33
32
  get collapsed() {
package/src/index.ts CHANGED
@@ -773,6 +773,15 @@ export type { SegmentedControlProps } from './components/segmented-control/index
773
773
  export { default as Select } from './components/select/index.ts';
774
774
  export type { SelectOption, SelectProps } from './components/select/index.ts';
775
775
 
776
+ export { default as SelectableRow } from './components/selectable-row/index.ts';
777
+ export type {
778
+ SelectableRowCurrentValue,
779
+ SelectableRowDensity,
780
+ SelectableRowProps,
781
+ SelectableRowSchemaProps,
782
+ SelectableRowSelectedState,
783
+ } from './components/selectable-row/index.ts';
784
+
776
785
  export { default as SelectionPopover } from './components/selection-popover/index.ts';
777
786
  export type {
778
787
  SelectionPopoverPosition,
@@ -797,7 +806,11 @@ export type { SideNavigationGroupProps } from './components/side-navigation-grou
797
806
  export { default as SideNavigationItem } from './components/side-navigation-item/index.ts';
798
807
  export type { SideNavigationItemProps } from './components/side-navigation-item/index.ts';
799
808
 
800
- export { default as Sidebar } from './components/sidebar/index.ts';
809
+ export {
810
+ SIDEBAR_MOBILE_BREAKPOINT,
811
+ SIDEBAR_MOBILE_MEDIA_QUERY,
812
+ default as Sidebar,
813
+ } from './components/sidebar/index.ts';
801
814
  export type { SidebarProps } from './components/sidebar/index.ts';
802
815
 
803
816
  export { default as SortableList } from './components/sortable-list/index.ts';
@@ -139,6 +139,7 @@
139
139
  @import '../components/section-heading/section-heading.css';
140
140
  @import '../components/select/select.css';
141
141
  @import '../components/segmented-control/segmented-control.css';
142
+ @import '../components/selectable-row/selectable-row.css';
142
143
  @import '../components/selection-popover/selection-popover.css';
143
144
  @import '../components/spectrogram/spectrogram.css';
144
145
  @import '../components/spectrum-chart/spectrum-chart.css';
@@ -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
  }