@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
|
@@ -305,25 +305,69 @@ var rest_excludes = new Set([
|
|
|
305
305
|
"$$events",
|
|
306
306
|
"$$legacy",
|
|
307
307
|
"value",
|
|
308
|
+
"href",
|
|
309
|
+
"download",
|
|
310
|
+
"target",
|
|
311
|
+
"rel",
|
|
312
|
+
"current",
|
|
313
|
+
"currentToken",
|
|
308
314
|
"disabled",
|
|
309
315
|
"controls",
|
|
310
316
|
"leading",
|
|
311
317
|
"trailing",
|
|
312
318
|
"children",
|
|
313
|
-
"class"
|
|
319
|
+
"class",
|
|
320
|
+
"onclick"
|
|
314
321
|
]);
|
|
315
322
|
var root = $2.from_html(`<span class="cinder-segmented-control-option-icon" aria-hidden="true"><!></span>`);
|
|
316
323
|
var root_1 = $2.from_html(`<span class="cinder-segmented-control-option-trailing" aria-hidden="true"><!></span>`);
|
|
317
|
-
var root_2 = $2.from_html(
|
|
324
|
+
var root_2 = $2.from_html(`<!> <!> <!>`, 1);
|
|
325
|
+
var root_3 = $2.from_html(`<a><!></a>`);
|
|
326
|
+
var root_4 = $2.from_html(`<button><!></button>`);
|
|
318
327
|
function Segment($$anchor, $$props) {
|
|
319
328
|
$2.push($$props, true);
|
|
320
|
-
|
|
329
|
+
const content = ($$anchor2) => {
|
|
330
|
+
var fragment = root_2();
|
|
331
|
+
var node_1 = $2.first_child(fragment);
|
|
332
|
+
{
|
|
333
|
+
var consequent = ($$anchor3) => {
|
|
334
|
+
var span = root();
|
|
335
|
+
var node_2 = $2.child(span);
|
|
336
|
+
$2.snippet(node_2, () => $$props.leading);
|
|
337
|
+
$2.reset(span);
|
|
338
|
+
$2.append($$anchor3, span);
|
|
339
|
+
};
|
|
340
|
+
$2.if(node_1, ($$render) => {
|
|
341
|
+
if ($$props.leading)
|
|
342
|
+
$$render(consequent);
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
var node_3 = $2.sibling(node_1, 2);
|
|
346
|
+
$2.snippet(node_3, () => $$props.children ?? $2.noop);
|
|
347
|
+
var node_4 = $2.sibling(node_3, 2);
|
|
348
|
+
{
|
|
349
|
+
var consequent_1 = ($$anchor3) => {
|
|
350
|
+
var span_1 = root_1();
|
|
351
|
+
var node_5 = $2.child(span_1);
|
|
352
|
+
$2.snippet(node_5, () => $$props.trailing);
|
|
353
|
+
$2.reset(span_1);
|
|
354
|
+
$2.append($$anchor3, span_1);
|
|
355
|
+
};
|
|
356
|
+
$2.if(node_4, ($$render) => {
|
|
357
|
+
if ($$props.trailing)
|
|
358
|
+
$$render(consequent_1);
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
$2.append($$anchor2, fragment);
|
|
362
|
+
};
|
|
363
|
+
let current = $2.prop($$props, "current", 3, false), currentToken = $2.prop($$props, "currentToken", 3, "page"), disabled = $2.prop($$props, "disabled", 3, false), rest = $2.rest_props($$props, rest_excludes);
|
|
321
364
|
const context = getSegmentedControlContext();
|
|
365
|
+
const buttonValue = $2.derived(() => $$props.value ?? $$props.href ?? "");
|
|
322
366
|
const registerSegment = (node) => {
|
|
323
367
|
return untrack(() => context.register({
|
|
324
368
|
node,
|
|
325
369
|
get value() {
|
|
326
|
-
return
|
|
370
|
+
return $2.get(buttonValue);
|
|
327
371
|
},
|
|
328
372
|
get disabled() {
|
|
329
373
|
return disabled() || context.controlDisabled;
|
|
@@ -333,64 +377,83 @@ function Segment($$anchor, $$props) {
|
|
|
333
377
|
}
|
|
334
378
|
}));
|
|
335
379
|
};
|
|
336
|
-
const isSelected = $2.derived(() => context.isSelected(
|
|
337
|
-
const isFocusable = $2.derived(() => context.isFocusable(
|
|
380
|
+
const isSelected = $2.derived(() => context.isSelected($2.get(buttonValue)));
|
|
381
|
+
const isFocusable = $2.derived(() => context.isFocusable($2.get(buttonValue)));
|
|
338
382
|
const effectiveDisabled = $2.derived(() => disabled() || context.controlDisabled);
|
|
383
|
+
const isNavigationItem = $2.derived(() => context.variant === "navigation");
|
|
384
|
+
const anchorDisabled = $2.derived(() => $2.get(effectiveDisabled) || $$props.href === undefined);
|
|
385
|
+
const elementAttributes = $2.derived(() => rest);
|
|
386
|
+
const anchorTabindex = $2.derived(() => $2.get(anchorDisabled) ? -1 : $2.get(elementAttributes).tabindex);
|
|
339
387
|
const role = $2.derived(() => context.selectionMode === "multiple" ? undefined : context.variant === "tablist" ? "tab" : "radio");
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
"data-cinder-segment-value": $$props.value,
|
|
347
|
-
"aria-checked": $2.get(role) === "radio" ? $2.get(isSelected) : undefined,
|
|
348
|
-
"aria-selected": $2.get(role) === "tab" ? $2.get(isSelected) : undefined,
|
|
349
|
-
"aria-pressed": context.selectionMode === "multiple" ? $2.get(isSelected) : undefined,
|
|
350
|
-
"aria-controls": $2.get(role) === "tab" ? $$props.controls : undefined,
|
|
351
|
-
"aria-disabled": $2.get(effectiveDisabled) ? "true" : undefined,
|
|
352
|
-
disabled: context.selectionMode === "multiple" ? $2.get(effectiveDisabled) : undefined,
|
|
353
|
-
tabindex: $2.get(isFocusable) ? 0 : -1,
|
|
354
|
-
class: $0,
|
|
355
|
-
"data-cinder-selected": $2.get(isSelected) ? "" : undefined,
|
|
356
|
-
"data-cinder-pressed": context.selectionMode === "multiple" && $2.get(isSelected) ? "" : undefined,
|
|
357
|
-
onclick: event_handler
|
|
358
|
-
}), [
|
|
359
|
-
() => classNames("cinder-segmented-control-option", $$props.class)
|
|
360
|
-
]);
|
|
361
|
-
var node_1 = $2.child(button);
|
|
362
|
-
{
|
|
363
|
-
var consequent = ($$anchor2) => {
|
|
364
|
-
var span = root();
|
|
365
|
-
var node_2 = $2.child(span);
|
|
366
|
-
$2.snippet(node_2, () => $$props.leading);
|
|
367
|
-
$2.reset(span);
|
|
368
|
-
$2.append($$anchor2, span);
|
|
369
|
-
};
|
|
370
|
-
$2.if(node_1, ($$render) => {
|
|
371
|
-
if ($$props.leading)
|
|
372
|
-
$$render(consequent);
|
|
373
|
-
});
|
|
388
|
+
function handleAnchorClick(event) {
|
|
389
|
+
if ($2.get(anchorDisabled)) {
|
|
390
|
+
event.preventDefault();
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
$$props.onclick?.(event);
|
|
374
394
|
}
|
|
375
|
-
var
|
|
376
|
-
|
|
377
|
-
var node_4 = $2.sibling(node_3, 2);
|
|
395
|
+
var fragment_1 = $2.comment();
|
|
396
|
+
var node_6 = $2.first_child(fragment_1);
|
|
378
397
|
{
|
|
379
|
-
var
|
|
380
|
-
var
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
398
|
+
var consequent_2 = ($$anchor2) => {
|
|
399
|
+
var a = root_3();
|
|
400
|
+
$2.attribute_effect(a, ($0) => ({
|
|
401
|
+
...$2.get(elementAttributes),
|
|
402
|
+
href: $2.get(anchorDisabled) ? undefined : $$props.href,
|
|
403
|
+
download: $$props.download,
|
|
404
|
+
target: $$props.target,
|
|
405
|
+
rel: $$props.rel,
|
|
406
|
+
"data-cinder-segment-value": $2.get(buttonValue),
|
|
407
|
+
"aria-current": current() ? currentToken() : undefined,
|
|
408
|
+
"aria-disabled": $2.get(anchorDisabled) ? "true" : undefined,
|
|
409
|
+
tabindex: $2.get(anchorTabindex),
|
|
410
|
+
class: $0,
|
|
411
|
+
"data-cinder-current": current() ? "" : undefined,
|
|
412
|
+
onclick: handleAnchorClick
|
|
413
|
+
}), [
|
|
414
|
+
() => classNames("cinder-segmented-control-option", $$props.class)
|
|
415
|
+
]);
|
|
416
|
+
var node_7 = $2.child(a);
|
|
417
|
+
content(node_7);
|
|
418
|
+
$2.reset(a);
|
|
419
|
+
$2.append($$anchor2, a);
|
|
385
420
|
};
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
421
|
+
var alternate = ($$anchor2) => {
|
|
422
|
+
var button = root_4();
|
|
423
|
+
var event_handler = () => context.toggle($2.get(buttonValue));
|
|
424
|
+
$2.attribute_effect(button, ($0) => ({
|
|
425
|
+
...$2.get(elementAttributes),
|
|
426
|
+
type: "button",
|
|
427
|
+
role: $2.get(role),
|
|
428
|
+
"data-cinder-segment-value": $2.get(buttonValue),
|
|
429
|
+
"aria-checked": $2.get(role) === "radio" ? $2.get(isSelected) : undefined,
|
|
430
|
+
"aria-selected": $2.get(role) === "tab" ? $2.get(isSelected) : undefined,
|
|
431
|
+
"aria-pressed": context.selectionMode === "multiple" ? $2.get(isSelected) : undefined,
|
|
432
|
+
"aria-controls": $2.get(role) === "tab" ? $$props.controls : undefined,
|
|
433
|
+
"aria-disabled": $2.get(effectiveDisabled) ? "true" : undefined,
|
|
434
|
+
disabled: context.selectionMode === "multiple" ? $2.get(effectiveDisabled) : undefined,
|
|
435
|
+
tabindex: $2.get(isFocusable) ? 0 : -1,
|
|
436
|
+
class: $0,
|
|
437
|
+
"data-cinder-selected": $2.get(isSelected) ? "" : undefined,
|
|
438
|
+
"data-cinder-pressed": context.selectionMode === "multiple" && $2.get(isSelected) ? "" : undefined,
|
|
439
|
+
onclick: event_handler
|
|
440
|
+
}), [
|
|
441
|
+
() => classNames("cinder-segmented-control-option", $$props.class)
|
|
442
|
+
]);
|
|
443
|
+
var node_8 = $2.child(button);
|
|
444
|
+
content(node_8);
|
|
445
|
+
$2.reset(button);
|
|
446
|
+
$2.attach(button, () => registerSegment);
|
|
447
|
+
$2.append($$anchor2, button);
|
|
448
|
+
};
|
|
449
|
+
$2.if(node_6, ($$render) => {
|
|
450
|
+
if ($2.get(isNavigationItem))
|
|
451
|
+
$$render(consequent_2);
|
|
452
|
+
else
|
|
453
|
+
$$render(alternate, -1);
|
|
389
454
|
});
|
|
390
455
|
}
|
|
391
|
-
$2.
|
|
392
|
-
$2.attach(button, () => registerSegment);
|
|
393
|
-
$2.append($$anchor, button);
|
|
456
|
+
$2.append($$anchor, fragment_1);
|
|
394
457
|
$2.pop();
|
|
395
458
|
}
|
|
396
459
|
|
|
@@ -421,9 +484,11 @@ var rest_excludes2 = new Set([
|
|
|
421
484
|
"onchange",
|
|
422
485
|
"children"
|
|
423
486
|
]);
|
|
424
|
-
var root2 = $3.from_html(`<
|
|
425
|
-
var root_12 = $3.from_html(`<
|
|
426
|
-
var root_22 = $3.from_html(`<
|
|
487
|
+
var root2 = $3.from_html(`<nav><!></nav>`);
|
|
488
|
+
var root_12 = $3.from_html(`<div><!></div>`);
|
|
489
|
+
var root_22 = $3.from_html(`<input type="hidden"/>`);
|
|
490
|
+
var root_32 = $3.from_html(`<input type="hidden" disabled=""/> <!>`, 1);
|
|
491
|
+
var root_42 = $3.from_html(`<div class="cinder-segmented-control-container"><span> </span> <!> <!></div>`);
|
|
427
492
|
function Segmented_control($$anchor, $$props) {
|
|
428
493
|
$3.push($$props, true);
|
|
429
494
|
let value = $3.prop($$props, "value", 15), hideLabel = $3.prop($$props, "hideLabel", 3, false), disabled = $3.prop($$props, "disabled", 3, false), size = $3.prop($$props, "size", 3, "md"), orientation = $3.prop($$props, "orientation", 3, "horizontal"), detached = $3.prop($$props, "detached", 3, false), fullWidth = $3.prop($$props, "fullWidth", 3, false), variant = $3.prop($$props, "variant", 3, "radiogroup"), selectionMode = $3.prop($$props, "selectionMode", 3, "single"), disallowEmptySelection = $3.prop($$props, "disallowEmptySelection", 3, true), rest = $3.rest_props($$props, rest_excludes2);
|
|
@@ -431,9 +496,11 @@ function Segmented_control($$anchor, $$props) {
|
|
|
431
496
|
let resetSyncTimeout;
|
|
432
497
|
const initialSingleValue = untrack2(() => typeof value() === "string" ? value() : undefined);
|
|
433
498
|
const initialMultipleValues = untrack2(() => selectionMode() === "multiple" && value() instanceof SvelteSet ? Array.from(value()) : undefined);
|
|
499
|
+
const effectiveVariant = $3.derived(() => selectionMode() === "multiple" && variant() !== "radiogroup" ? "radiogroup" : variant());
|
|
500
|
+
const rendersNavigation = $3.derived(() => $3.get(effectiveVariant) === "navigation");
|
|
434
501
|
const controller = new SegmentedControlController({
|
|
435
502
|
selectionMode: () => selectionMode(),
|
|
436
|
-
variant: () =>
|
|
503
|
+
variant: () => $3.get(effectiveVariant),
|
|
437
504
|
orientation: () => orientation(),
|
|
438
505
|
controlDisabled: () => disabled(),
|
|
439
506
|
disallowEmptySelection: () => disallowEmptySelection(),
|
|
@@ -448,7 +515,7 @@ function Segmented_control($$anchor, $$props) {
|
|
|
448
515
|
return selectionMode();
|
|
449
516
|
},
|
|
450
517
|
get variant() {
|
|
451
|
-
return
|
|
518
|
+
return $3.get(effectiveVariant);
|
|
452
519
|
},
|
|
453
520
|
get controlDisabled() {
|
|
454
521
|
return disabled();
|
|
@@ -459,7 +526,7 @@ function Segmented_control($$anchor, $$props) {
|
|
|
459
526
|
toggle: (segmentValue) => controller.toggle(segmentValue)
|
|
460
527
|
};
|
|
461
528
|
setSegmentedControlContext(contextValue);
|
|
462
|
-
const groupRole = $3.derived(() => selectionMode() === "multiple" ? "group" : variant() === "tablist" ? "tablist" : "radiogroup");
|
|
529
|
+
const groupRole = $3.derived(() => selectionMode() === "multiple" ? "group" : variant() === "navigation" ? undefined : variant() === "tablist" ? "tablist" : "radiogroup");
|
|
463
530
|
const effectiveSize = $3.derived(() => $$props.density === "toolbar" ? "sm" : size());
|
|
464
531
|
const selectedValues = $3.derived(() => selectionMode() === "multiple" ? value() instanceof SvelteSet ? Array.from(value()) : [] : typeof value() === "string" ? [value()] : []);
|
|
465
532
|
function resetToInitialValue(event) {
|
|
@@ -490,41 +557,74 @@ function Segmented_control($$anchor, $$props) {
|
|
|
490
557
|
}
|
|
491
558
|
};
|
|
492
559
|
});
|
|
493
|
-
var div =
|
|
560
|
+
var div = root_42();
|
|
494
561
|
var span = $3.child(div);
|
|
495
562
|
var text = $3.child(span, true);
|
|
496
563
|
$3.reset(span);
|
|
497
|
-
var
|
|
498
|
-
var event_handler = (event) => controller.handleKeydown(event);
|
|
499
|
-
$3.attribute_effect(div_1, ($0) => ({
|
|
500
|
-
...rest,
|
|
501
|
-
id: $$props.id,
|
|
502
|
-
role: $3.get(groupRole),
|
|
503
|
-
"aria-labelledby": `${$$props.id}-label`,
|
|
504
|
-
"aria-disabled": disabled() ? "true" : undefined,
|
|
505
|
-
"aria-orientation": selectionMode() === "single" ? orientation() : undefined,
|
|
506
|
-
"data-cinder-orientation": orientation(),
|
|
507
|
-
"data-cinder-size": $3.get(effectiveSize),
|
|
508
|
-
"data-cinder-density": $$props.density === "toolbar" ? "toolbar" : undefined,
|
|
509
|
-
"data-cinder-selection-mode": selectionMode(),
|
|
510
|
-
"data-cinder-detached": detached() ? "" : undefined,
|
|
511
|
-
"data-cinder-full-width": fullWidth() ? "" : undefined,
|
|
512
|
-
"data-cinder-variant": variant(),
|
|
513
|
-
class: $0,
|
|
514
|
-
onkeydown: event_handler
|
|
515
|
-
}), [() => classNames("cinder-segmented-control", $$props.class)]);
|
|
516
|
-
var node = $3.child(div_1);
|
|
517
|
-
$3.snippet(node, () => $$props.children);
|
|
518
|
-
$3.reset(div_1);
|
|
519
|
-
var node_1 = $3.sibling(div_1, 2);
|
|
564
|
+
var node = $3.sibling(span, 2);
|
|
520
565
|
{
|
|
521
566
|
var consequent = ($$anchor2) => {
|
|
522
|
-
var
|
|
567
|
+
var nav = root2();
|
|
568
|
+
$3.attribute_effect(nav, ($0) => ({
|
|
569
|
+
...rest,
|
|
570
|
+
id: $$props.id,
|
|
571
|
+
role: "navigation",
|
|
572
|
+
"aria-labelledby": `${$$props.id}-label`,
|
|
573
|
+
"data-cinder-orientation": orientation(),
|
|
574
|
+
"data-cinder-size": $3.get(effectiveSize),
|
|
575
|
+
"data-cinder-density": $$props.density === "toolbar" ? "toolbar" : undefined,
|
|
576
|
+
"data-cinder-selection-mode": selectionMode(),
|
|
577
|
+
"data-cinder-detached": detached() ? "" : undefined,
|
|
578
|
+
"data-cinder-full-width": fullWidth() ? "" : undefined,
|
|
579
|
+
"data-cinder-variant": $3.get(effectiveVariant),
|
|
580
|
+
class: $0
|
|
581
|
+
}), [() => classNames("cinder-segmented-control", $$props.class)]);
|
|
582
|
+
var node_1 = $3.child(nav);
|
|
583
|
+
$3.snippet(node_1, () => $$props.children);
|
|
584
|
+
$3.reset(nav);
|
|
585
|
+
$3.append($$anchor2, nav);
|
|
586
|
+
};
|
|
587
|
+
var alternate = ($$anchor2) => {
|
|
588
|
+
var div_1 = root_12();
|
|
589
|
+
var event_handler = (event) => controller.handleKeydown(event);
|
|
590
|
+
$3.attribute_effect(div_1, ($0) => ({
|
|
591
|
+
...rest,
|
|
592
|
+
id: $$props.id,
|
|
593
|
+
role: $3.get(groupRole),
|
|
594
|
+
"aria-labelledby": `${$$props.id}-label`,
|
|
595
|
+
"aria-disabled": disabled() ? "true" : undefined,
|
|
596
|
+
"aria-orientation": selectionMode() === "single" ? orientation() : undefined,
|
|
597
|
+
"data-cinder-orientation": orientation(),
|
|
598
|
+
"data-cinder-size": $3.get(effectiveSize),
|
|
599
|
+
"data-cinder-density": $$props.density === "toolbar" ? "toolbar" : undefined,
|
|
600
|
+
"data-cinder-selection-mode": selectionMode(),
|
|
601
|
+
"data-cinder-detached": detached() ? "" : undefined,
|
|
602
|
+
"data-cinder-full-width": fullWidth() ? "" : undefined,
|
|
603
|
+
"data-cinder-variant": $3.get(effectiveVariant),
|
|
604
|
+
class: $0,
|
|
605
|
+
onkeydown: event_handler
|
|
606
|
+
}), [() => classNames("cinder-segmented-control", $$props.class)]);
|
|
607
|
+
var node_2 = $3.child(div_1);
|
|
608
|
+
$3.snippet(node_2, () => $$props.children);
|
|
609
|
+
$3.reset(div_1);
|
|
610
|
+
$3.append($$anchor2, div_1);
|
|
611
|
+
};
|
|
612
|
+
$3.if(node, ($$render) => {
|
|
613
|
+
if ($3.get(rendersNavigation))
|
|
614
|
+
$$render(consequent);
|
|
615
|
+
else
|
|
616
|
+
$$render(alternate, -1);
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
var node_3 = $3.sibling(node, 2);
|
|
620
|
+
{
|
|
621
|
+
var consequent_1 = ($$anchor2) => {
|
|
622
|
+
var fragment = root_32();
|
|
523
623
|
var input_1 = $3.first_child(fragment);
|
|
524
624
|
$3.bind_this(input_1, ($$value) => $3.set(resetInputElement, $$value), () => $3.get(resetInputElement));
|
|
525
|
-
var
|
|
526
|
-
$3.each(
|
|
527
|
-
var input_2 =
|
|
625
|
+
var node_4 = $3.sibling(input_1, 2);
|
|
626
|
+
$3.each(node_4, 16, () => $3.get(selectedValues), (selectedValue) => selectedValue, ($$anchor3, selectedValue) => {
|
|
627
|
+
var input_2 = root_22();
|
|
528
628
|
$3.remove_input_defaults(input_2);
|
|
529
629
|
$3.template_effect(() => {
|
|
530
630
|
$3.set_attribute(input_2, "name", $$props.name);
|
|
@@ -535,9 +635,9 @@ function Segmented_control($$anchor, $$props) {
|
|
|
535
635
|
});
|
|
536
636
|
$3.append($$anchor2, fragment);
|
|
537
637
|
};
|
|
538
|
-
$3.if(
|
|
539
|
-
if ($$props.name)
|
|
540
|
-
$$render(
|
|
638
|
+
$3.if(node_3, ($$render) => {
|
|
639
|
+
if ($$props.name && !$3.get(rendersNavigation))
|
|
640
|
+
$$render(consequent_1);
|
|
541
641
|
});
|
|
542
642
|
}
|
|
543
643
|
$3.reset(div);
|
|
@@ -560,4 +660,4 @@ export {
|
|
|
560
660
|
Segment
|
|
561
661
|
};
|
|
562
662
|
|
|
563
|
-
//# debugId=
|
|
663
|
+
//# debugId=968EAD19C4AB9BF964756E2164756E21
|
|
@@ -22,8 +22,8 @@ export type SegmentRegistration = {
|
|
|
22
22
|
export type SegmentedControlContextValue = {
|
|
23
23
|
/** True when the control is in single-selection mode. */
|
|
24
24
|
readonly selectionMode: 'single' | 'multiple';
|
|
25
|
-
/** 'radiogroup' or '
|
|
26
|
-
readonly variant: 'radiogroup' | 'tablist';
|
|
25
|
+
/** 'radiogroup', 'tablist', or 'navigation' — single mode only. */
|
|
26
|
+
readonly variant: 'radiogroup' | 'tablist' | 'navigation';
|
|
27
27
|
/** True when the whole control is disabled. */
|
|
28
28
|
readonly controlDisabled: boolean;
|
|
29
29
|
/** Register a segment when its DOM node mounts. Returns an unregister fn. */
|
|
@@ -45,7 +45,7 @@ export { getSegmentedControlContext, setSegmentedControlContext };
|
|
|
45
45
|
*/
|
|
46
46
|
export type SegmentedControlControllerOptions = {
|
|
47
47
|
selectionMode: () => 'single' | 'multiple';
|
|
48
|
-
variant: () => 'radiogroup' | 'tablist';
|
|
48
|
+
variant: () => 'radiogroup' | 'tablist' | 'navigation';
|
|
49
49
|
orientation: () => 'horizontal' | 'vertical';
|
|
50
50
|
controlDisabled: () => boolean;
|
|
51
51
|
disallowEmptySelection: () => boolean;
|
|
@@ -65,7 +65,7 @@ export declare class SegmentedControlController {
|
|
|
65
65
|
/** DOM-ordered view of registered segments. Re-sorts on every read. */
|
|
66
66
|
get segments(): SegmentRegistration[];
|
|
67
67
|
get selectionMode(): 'single' | 'multiple';
|
|
68
|
-
get variant(): 'radiogroup' | 'tablist';
|
|
68
|
+
get variant(): 'radiogroup' | 'tablist' | 'navigation';
|
|
69
69
|
get controlDisabled(): boolean;
|
|
70
70
|
register(registration: SegmentRegistration): () => void;
|
|
71
71
|
isSelected(value: string): boolean;
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
cursor: pointer;
|
|
99
99
|
font-weight: var(--cinder-font-medium);
|
|
100
100
|
line-height: 1;
|
|
101
|
+
text-decoration: none;
|
|
101
102
|
transition:
|
|
102
103
|
background-color var(--cinder-duration-fast) var(--cinder-ease-standard),
|
|
103
104
|
color var(--cinder-duration-fast) var(--cinder-ease-standard),
|
|
@@ -117,11 +118,16 @@
|
|
|
117
118
|
|
|
118
119
|
.cinder-segmented-control:not([data-cinder-detached])
|
|
119
120
|
.cinder-segmented-control-option[data-cinder-selected]:not(:first-child)::before,
|
|
121
|
+
.cinder-segmented-control:not([data-cinder-detached])
|
|
122
|
+
.cinder-segmented-control-option[data-cinder-current]:not(:first-child)::before,
|
|
120
123
|
.cinder-segmented-control:not([data-cinder-detached])
|
|
121
124
|
.cinder-segmented-control-option[data-cinder-pressed]:not(:first-child)::before,
|
|
122
125
|
.cinder-segmented-control:not([data-cinder-detached])
|
|
123
126
|
[data-cinder-selected]
|
|
124
127
|
+ .cinder-segmented-control-option::before,
|
|
128
|
+
.cinder-segmented-control:not([data-cinder-detached])
|
|
129
|
+
[data-cinder-current]
|
|
130
|
+
+ .cinder-segmented-control-option::before,
|
|
125
131
|
.cinder-segmented-control:not([data-cinder-detached])
|
|
126
132
|
[data-cinder-pressed]
|
|
127
133
|
+ .cinder-segmented-control-option::before {
|
|
@@ -211,9 +217,9 @@
|
|
|
211
217
|
/* Sticky-hover suppression on touch: wrap hover-only chrome so it doesn't
|
|
212
218
|
* "stick" after tap on touch devices that emulate :hover. */
|
|
213
219
|
@media (hover: hover) {
|
|
214
|
-
.cinder-segmented-control-option:hover:not(:disabled):not([
|
|
215
|
-
[data-cinder-
|
|
216
|
-
) {
|
|
220
|
+
.cinder-segmented-control-option:hover:not(:disabled):not([aria-disabled='true']):not(
|
|
221
|
+
[data-cinder-selected]
|
|
222
|
+
):not([data-cinder-current]):not([data-cinder-pressed]) {
|
|
217
223
|
background: color-mix(in oklch, var(--cinder-accent), transparent 90%);
|
|
218
224
|
color: var(--cinder-text);
|
|
219
225
|
}
|
|
@@ -229,6 +235,9 @@
|
|
|
229
235
|
.cinder-segmented-control-option[data-cinder-selected]:hover:not(:disabled):not(
|
|
230
236
|
[aria-disabled='true']
|
|
231
237
|
),
|
|
238
|
+
.cinder-segmented-control-option[data-cinder-current]:hover:not(:disabled):not(
|
|
239
|
+
[aria-disabled='true']
|
|
240
|
+
),
|
|
232
241
|
.cinder-segmented-control-option[data-cinder-pressed]:hover:not(:disabled):not(
|
|
233
242
|
[aria-disabled='true']
|
|
234
243
|
) {
|
|
@@ -248,7 +257,8 @@
|
|
|
248
257
|
|
|
249
258
|
/* ── Disabled option ────────────────────────────────────────────────────── */
|
|
250
259
|
|
|
251
|
-
.cinder-segmented-control-option:disabled
|
|
260
|
+
.cinder-segmented-control-option:disabled,
|
|
261
|
+
.cinder-segmented-control-option[aria-disabled='true'] {
|
|
252
262
|
cursor: not-allowed;
|
|
253
263
|
/* opacity centralized in foundation.css disabled-visual rule (0.6) */
|
|
254
264
|
}
|
|
@@ -261,6 +271,12 @@
|
|
|
261
271
|
box-shadow: var(--cinder-shadow-sm);
|
|
262
272
|
}
|
|
263
273
|
|
|
274
|
+
.cinder-segmented-control-option[data-cinder-current] {
|
|
275
|
+
background: var(--cinder-accent);
|
|
276
|
+
color: var(--cinder-accent-contrast);
|
|
277
|
+
box-shadow: var(--cinder-shadow-sm);
|
|
278
|
+
}
|
|
279
|
+
|
|
264
280
|
.cinder-segmented-control-option-icon {
|
|
265
281
|
opacity: 0.9;
|
|
266
282
|
}
|
|
@@ -283,7 +299,9 @@
|
|
|
283
299
|
.cinder-segmented-control:not([data-cinder-variant='tablist'])
|
|
284
300
|
.cinder-segmented-control-option[data-cinder-selected]:focus-visible,
|
|
285
301
|
.cinder-segmented-control:not([data-cinder-variant='tablist'])
|
|
286
|
-
.cinder-segmented-control-option[data-cinder-pressed]:focus-visible
|
|
302
|
+
.cinder-segmented-control-option[data-cinder-pressed]:focus-visible,
|
|
303
|
+
.cinder-segmented-control:not([data-cinder-variant='tablist'])
|
|
304
|
+
.cinder-segmented-control-option[data-cinder-current]:focus-visible {
|
|
287
305
|
box-shadow:
|
|
288
306
|
0 0 0 var(--cinder-ring-offset) var(--cinder-ring-offset-color),
|
|
289
307
|
0 0 0 calc(var(--cinder-ring-offset) + var(--cinder-ring-width)) var(--cinder-ring-color);
|
|
@@ -296,7 +314,9 @@
|
|
|
296
314
|
.cinder-segmented-control:not([data-cinder-variant='tablist'])
|
|
297
315
|
.cinder-segmented-control-option[data-cinder-selected]:focus-visible,
|
|
298
316
|
.cinder-segmented-control:not([data-cinder-variant='tablist'])
|
|
299
|
-
.cinder-segmented-control-option[data-cinder-pressed]:focus-visible
|
|
317
|
+
.cinder-segmented-control-option[data-cinder-pressed]:focus-visible,
|
|
318
|
+
.cinder-segmented-control:not([data-cinder-variant='tablist'])
|
|
319
|
+
.cinder-segmented-control-option[data-cinder-current]:focus-visible {
|
|
300
320
|
outline: var(--cinder-ring-width) solid Highlight;
|
|
301
321
|
outline-offset: 1px;
|
|
302
322
|
box-shadow: none;
|
|
@@ -97,8 +97,8 @@ var schema = {
|
|
|
97
97
|
description: "Stretch the control to fill available width."
|
|
98
98
|
},
|
|
99
99
|
variant: {
|
|
100
|
-
enum: ["radiogroup", "tablist"],
|
|
101
|
-
description: "ARIA interaction pattern. Use `
|
|
100
|
+
enum: ["radiogroup", "tablist", "navigation"],
|
|
101
|
+
description: "ARIA interaction pattern. Use `navigation` for route-backed links."
|
|
102
102
|
},
|
|
103
103
|
class: {
|
|
104
104
|
type: "string",
|
|
@@ -142,4 +142,4 @@ export {
|
|
|
142
142
|
segmented_control_schema_default as default
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
//# debugId=
|
|
145
|
+
//# debugId=B5990BD217C25BF364756E2164756E21
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* @cinder
|
|
3
3
|
* @category form
|
|
4
4
|
* @status stable
|
|
5
|
-
* @purpose Compact
|
|
5
|
+
* @purpose Compact segmented selector that surfaces a small fixed set of options as a connected bar, including bindable selections and route-backed links.
|
|
6
6
|
* @tag form
|
|
7
7
|
* @tag selection
|
|
8
8
|
* @useWhen Choosing one of two to five mutually exclusive options that all fit on screen at once.
|
|
9
9
|
* @useWhen Picking a view filter where seeing every option beats hiding them inside a toggle or tabs control.
|
|
10
|
+
* @useWhen Rendering route-backed filters as real links with `variant="navigation"` and `Segment href`.
|
|
10
11
|
* @avoidWhen Toggling a single binary on or off — use toggle or checkbox instead.
|
|
11
12
|
* @avoidWhen Switching between panels of associated content — use tabs instead.
|
|
12
13
|
* @related toggle, checkbox, tabs, button-group
|
|
@@ -2,7 +2,7 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { SvelteSet } from 'svelte/reactivity';
|
|
4
4
|
type ComponentOwnedAttributes = 'id' | 'class' | 'role' | 'tabindex' | 'aria-label' | 'aria-labelledby' | 'aria-disabled' | 'aria-orientation' | 'onchange' | 'onkeydown';
|
|
5
|
-
type CommonProps<T extends string> = Omit<HTMLAttributes<
|
|
5
|
+
type CommonProps<T extends string> = Omit<HTMLAttributes<HTMLElement>, ComponentOwnedAttributes> & {
|
|
6
6
|
/** Unique identifier for the control. */
|
|
7
7
|
id: string;
|
|
8
8
|
/** Accessible label for the group. */
|
|
@@ -38,8 +38,8 @@ type CommonProps<T extends string> = Omit<HTMLAttributes<HTMLDivElement>, Compon
|
|
|
38
38
|
detached?: boolean | undefined;
|
|
39
39
|
/** Stretch the control to fill available width. */
|
|
40
40
|
fullWidth?: boolean | undefined;
|
|
41
|
-
/** ARIA interaction pattern. Use `
|
|
42
|
-
variant?: 'radiogroup' | 'tablist' | undefined;
|
|
41
|
+
/** ARIA interaction pattern. Use `navigation` for route-backed links. */
|
|
42
|
+
variant?: 'radiogroup' | 'tablist' | 'navigation' | undefined;
|
|
43
43
|
/** Additional class names merged with `.cinder-segmented-control`. */
|
|
44
44
|
class?: string | undefined;
|
|
45
45
|
/** Called when the selected value changes (single mode only). */
|
|
@@ -65,7 +65,7 @@ type MultipleProps<T extends string> = CommonProps<T> & {
|
|
|
65
65
|
value?: SvelteSet<T> | undefined;
|
|
66
66
|
/** Not applicable in multiple mode — present for Svelte destructuring compatibility. */
|
|
67
67
|
disallowEmptySelection?: undefined;
|
|
68
|
-
/** Tablist semantics are only valid for single selection. */
|
|
68
|
+
/** Tablist and navigation semantics are only valid for single selection. */
|
|
69
69
|
variant?: 'radiogroup' | undefined;
|
|
70
70
|
};
|
|
71
71
|
export type SegmentedControlProps<T extends string = string> = SingleProps<T> | MultipleProps<T>;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* ======================================== */
|
|
14
14
|
|
|
15
15
|
.cinder-side-navigation {
|
|
16
|
+
--cinder-side-navigation-list-gap: var(--cinder-space-1);
|
|
16
17
|
display: block;
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
padding: 0;
|
|
23
24
|
display: flex;
|
|
24
25
|
flex-direction: column;
|
|
25
|
-
gap: var(--cinder-space-1);
|
|
26
|
+
gap: var(--cinder-side-navigation-list-gap, var(--cinder-space-1));
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/* ----------------------------------------
|
|
@@ -59,6 +59,14 @@ var schema = {
|
|
|
59
59
|
ariaLabel: {
|
|
60
60
|
type: "string",
|
|
61
61
|
description: "Accessible name for the <nav> landmark. Required, non-empty, distinct from other navs on the page."
|
|
62
|
+
},
|
|
63
|
+
class: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Additional CSS class merged with `.cinder-side-navigation`."
|
|
66
|
+
},
|
|
67
|
+
style: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "Inline style string applied to the `.cinder-side-navigation` root."
|
|
62
70
|
}
|
|
63
71
|
},
|
|
64
72
|
additionalProperties: false,
|
|
@@ -70,11 +78,6 @@ var schema = {
|
|
|
70
78
|
reason: "function-or-snippet",
|
|
71
79
|
required: true,
|
|
72
80
|
description: "Must be <li> elements containing NavigationItem and/or SideNavigationGroup."
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "class",
|
|
76
|
-
reason: "unknown-shape",
|
|
77
|
-
description: "Additional CSS class merged with `.cinder-side-navigation`."
|
|
78
81
|
}
|
|
79
82
|
]
|
|
80
83
|
}
|
|
@@ -84,4 +87,4 @@ export {
|
|
|
84
87
|
side_navigation_schema_default as default
|
|
85
88
|
};
|
|
86
89
|
|
|
87
|
-
//# debugId=
|
|
90
|
+
//# debugId=8436A7F5FC75585064756E2164756E21
|
|
@@ -9,3 +9,14 @@ export type SideNavigationProps = Omit<HTMLAttributes<HTMLElement>, 'aria-label'
|
|
|
9
9
|
/** Must be <li> elements containing NavigationItem and/or SideNavigationGroup. */
|
|
10
10
|
children: Snippet;
|
|
11
11
|
};
|
|
12
|
+
/** Schema generator surface for SideNavigation — excludes native attributes except supported styling hooks. */
|
|
13
|
+
export interface SideNavigationSchemaProps {
|
|
14
|
+
/** Accessible name for the <nav> landmark. Required, non-empty, distinct from other navs on the page. */
|
|
15
|
+
ariaLabel: string;
|
|
16
|
+
/** Additional CSS class merged with `.cinder-side-navigation`. */
|
|
17
|
+
class?: string;
|
|
18
|
+
/** Inline style string applied to the `.cinder-side-navigation` root. */
|
|
19
|
+
style?: string;
|
|
20
|
+
/** Must be <li> elements containing NavigationItem and/or SideNavigationGroup. */
|
|
21
|
+
children: Snippet;
|
|
22
|
+
}
|
|
@@ -52,10 +52,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
// src/components/side-navigation/side-navigation.variables.ts
|
|
55
|
-
var variables = [];
|
|
55
|
+
var variables = ["--cinder-side-navigation-list-gap"];
|
|
56
56
|
var side_navigation_variables_default = variables;
|
|
57
57
|
export {
|
|
58
58
|
side_navigation_variables_default as default
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
//# debugId=
|
|
61
|
+
//# debugId=E3DF58EF8E02E02F64756E2164756E21
|