@lostgradient/cinder 0.11.0 → 0.12.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 +10 -0
- package/components.json +1 -1
- package/dist/components/code-block/code-block.css +15 -9
- package/dist/components/code-block/code-block.variables.js +8 -2
- package/dist/components/confirm-dialog/confirm-dialog.css +2 -0
- package/dist/components/confirm-dialog/confirm-dialog.schema.js +10 -1
- package/dist/components/confirm-dialog/confirm-dialog.types.d.ts +7 -0
- package/dist/components/confirm-dialog/index.js +478 -106
- package/dist/components/faceted-filter-bar/faceted-filter-bar.schema.js +5 -1
- package/dist/components/faceted-filter-bar/faceted-filter-bar.types.d.ts +2 -0
- package/dist/components/faceted-filter-bar/index.js +40 -31
- package/dist/components/navigation-bar/index.js +11 -17
- package/dist/components/run-step-timeline/index.js +65 -6
- package/dist/components/run-step-timeline/run-step-timeline.utilities.d.ts +9 -1
- package/dist/index.js +352 -246
- package/dist/server/components/color-field/index.js +2 -2
- package/dist/server/components/confirm-dialog/index.js +7 -2
- package/dist/server/components/faceted-filter-bar/index.js +1 -1
- package/dist/server/components/navigation-bar/index.js +1 -1
- package/dist/server/components/run-step-timeline/index.js +1 -1
- package/dist/server/index.js +7 -7
- package/dist/server/{index.server-5tf22d6e.js → index.server-4wx0qven.js} +3 -3
- package/dist/server/{index.server-894t97kv.js → index.server-7yvpb6z7.js} +4 -4
- package/dist/server/{index.server-btgb3d56.js → index.server-d5a5ccz7.js} +18 -12
- package/dist/server/{index.server-z38bxms8.js → index.server-g5jgq3jp.js} +65 -6
- package/dist/server/{index.server-39ne5cd1.js → index.server-pxq277t5.js} +32 -1
- package/package.json +22 -95
- package/src/components/code-block/code-block.css +15 -9
- package/src/components/code-block/code-block.variables.json +7 -1
- package/src/components/code-block/code-block.variables.ts +7 -1
- package/src/components/confirm-dialog/confirm-dialog.css +2 -0
- package/src/components/confirm-dialog/confirm-dialog.schema.json +8 -0
- package/src/components/confirm-dialog/confirm-dialog.schema.ts +10 -0
- package/src/components/confirm-dialog/confirm-dialog.svelte +31 -3
- package/src/components/confirm-dialog/confirm-dialog.types.ts +7 -0
- package/src/components/faceted-filter-bar/faceted-filter-bar.schema.json +4 -0
- package/src/components/faceted-filter-bar/faceted-filter-bar.schema.ts +4 -0
- package/src/components/faceted-filter-bar/faceted-filter-bar.svelte +13 -11
- package/src/components/faceted-filter-bar/faceted-filter-bar.types.ts +2 -0
- package/src/components/navigation-bar/navigation-bar.svelte +2 -2
- package/src/components/run-step-timeline/run-step-timeline.svelte +4 -4
- package/src/components/run-step-timeline/run-step-timeline.utilities.ts +68 -0
|
@@ -320,7 +320,7 @@ import"@lostgradient/cinder/confirm-dialog/styles";
|
|
|
320
320
|
|
|
321
321
|
// src/components/confirm-dialog/confirm-dialog.svelte
|
|
322
322
|
import"svelte/internal/disclose-version";
|
|
323
|
-
import * as $
|
|
323
|
+
import * as $6 from "svelte/internal/client";
|
|
324
324
|
|
|
325
325
|
// src/components/button/button.svelte
|
|
326
326
|
import"svelte/internal/disclose-version";
|
|
@@ -554,9 +554,337 @@ function Button($$anchor, $$props) {
|
|
|
554
554
|
$3.pop();
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
// src/components/
|
|
557
|
+
// src/components/input/input.svelte
|
|
558
558
|
import"svelte/internal/disclose-version";
|
|
559
559
|
import * as $4 from "svelte/internal/client";
|
|
560
|
+
|
|
561
|
+
// src/_internal/field-control.ts
|
|
562
|
+
function describeId(fieldId, hasDescription) {
|
|
563
|
+
return hasDescription ? `${fieldId}-description` : undefined;
|
|
564
|
+
}
|
|
565
|
+
function errorId(fieldId, hasError) {
|
|
566
|
+
return hasError ? `${fieldId}-error` : undefined;
|
|
567
|
+
}
|
|
568
|
+
function composeDescribedBy(...ids) {
|
|
569
|
+
const filtered = ids.flatMap((id) => typeof id === "string" ? id.trim().split(/\s+/).filter(Boolean) : []);
|
|
570
|
+
const unique = Array.from(new Set(filtered));
|
|
571
|
+
return unique.length > 0 ? unique.join(" ") : undefined;
|
|
572
|
+
}
|
|
573
|
+
function ariaInvalid(hasError) {
|
|
574
|
+
return hasError ? "true" : undefined;
|
|
575
|
+
}
|
|
576
|
+
function resolveFieldControl(input) {
|
|
577
|
+
const resolvedId = input.id ?? input.context?.controlId ?? input.generatedId;
|
|
578
|
+
const defaultDescriptionId = describeId(resolvedId, input.hasDescription ?? false);
|
|
579
|
+
const defaultErrorId = errorId(resolvedId, input.hasError ?? false);
|
|
580
|
+
const ownDescriptionId = defaultDescriptionId && defaultDescriptionId === input.context?.descriptionId && input.localIdNamespace ? `${resolvedId}-${input.localIdNamespace}-description` : defaultDescriptionId;
|
|
581
|
+
const ownErrorId = defaultErrorId && defaultErrorId === input.context?.errorId && input.localIdNamespace ? `${resolvedId}-${input.localIdNamespace}-error` : defaultErrorId;
|
|
582
|
+
const descriptionId = ownDescriptionId ?? input.context?.descriptionId;
|
|
583
|
+
const resolvedErrorId = ownErrorId ?? input.context?.errorId;
|
|
584
|
+
const explicitInvalid = ariaInvalid(input.hasError ?? false);
|
|
585
|
+
const consumerInvalid = input.consumerInvalid === true ? "true" : input.consumerInvalid === false ? undefined : input.consumerInvalid ?? undefined;
|
|
586
|
+
return {
|
|
587
|
+
id: resolvedId,
|
|
588
|
+
ownDescriptionId,
|
|
589
|
+
ownErrorId,
|
|
590
|
+
descriptionId,
|
|
591
|
+
errorId: resolvedErrorId,
|
|
592
|
+
describedBy: composeDescribedBy(descriptionId, ...input.additionalDescribedBy ?? [], resolvedErrorId, input.context?.describedBy, input.consumerDescribedBy),
|
|
593
|
+
ariaInvalid: explicitInvalid ?? input.context?.invalid ?? consumerInvalid,
|
|
594
|
+
required: input.required ?? input.context?.required ?? false,
|
|
595
|
+
disabled: input.disabled ?? input.context?.disabled ?? false
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// src/_internal/form-field-context.ts
|
|
600
|
+
import { createContext } from "svelte";
|
|
601
|
+
|
|
602
|
+
// src/_internal/optional-context.ts
|
|
603
|
+
function optionalContext(getStrict) {
|
|
604
|
+
return () => {
|
|
605
|
+
try {
|
|
606
|
+
return getStrict();
|
|
607
|
+
} catch {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// src/_internal/form-field-context.ts
|
|
614
|
+
var [getFormFieldContextStrict, setFormFieldContextRaw] = createContext();
|
|
615
|
+
function setFormFieldContext(context) {
|
|
616
|
+
setFormFieldContextRaw(context);
|
|
617
|
+
}
|
|
618
|
+
var getFormFieldContext = optionalContext(getFormFieldContextStrict);
|
|
619
|
+
|
|
620
|
+
// src/utilities/value-change.ts
|
|
621
|
+
function commitValue(proposed, onValueChange, setValue) {
|
|
622
|
+
const committed = onValueChange?.(proposed) ?? proposed;
|
|
623
|
+
setValue(committed);
|
|
624
|
+
return committed;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// src/components/input/input.svelte
|
|
628
|
+
var calendarIcon = ($$anchor) => {
|
|
629
|
+
var svg = root3();
|
|
630
|
+
$4.append($$anchor, svg);
|
|
631
|
+
};
|
|
632
|
+
var rest_excludes3 = new Set([
|
|
633
|
+
"$$slots",
|
|
634
|
+
"$$events",
|
|
635
|
+
"$$legacy",
|
|
636
|
+
"id",
|
|
637
|
+
"value",
|
|
638
|
+
"onValueChange",
|
|
639
|
+
"label",
|
|
640
|
+
"hideLabel",
|
|
641
|
+
"description",
|
|
642
|
+
"error",
|
|
643
|
+
"disabled",
|
|
644
|
+
"required",
|
|
645
|
+
"type",
|
|
646
|
+
"class",
|
|
647
|
+
"leading",
|
|
648
|
+
"trailing",
|
|
649
|
+
"leadingInteractive",
|
|
650
|
+
"trailingInteractive",
|
|
651
|
+
"aria-describedby",
|
|
652
|
+
"aria-invalid",
|
|
653
|
+
"oninput"
|
|
654
|
+
]);
|
|
655
|
+
var root3 = $4.from_svg(`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>`);
|
|
656
|
+
var root_12 = $4.from_html(`<input/>`);
|
|
657
|
+
var root_22 = $4.from_html(`<span class="cinder-_required-marker" aria-hidden="true">*</span>`);
|
|
658
|
+
var root_32 = $4.from_html(`<label> <!></label>`);
|
|
659
|
+
var root_42 = $4.from_html(`<span class="cinder-input-group__leading cinder-_truncate"><!></span>`);
|
|
660
|
+
var root_52 = $4.from_html(`<span class="cinder-input-group__trailing cinder-_truncate"><!></span>`);
|
|
661
|
+
var root_6 = $4.from_html(`<span class="cinder-input-group__trailing cinder-input-group__date-icon cinder-_truncate" aria-hidden="true"><!></span>`);
|
|
662
|
+
var root_7 = $4.from_html(`<div class="cinder-input-group"><!> <!> <!></div>`);
|
|
663
|
+
var root_8 = $4.from_html(`<p class="cinder-input-field__description"> </p>`);
|
|
664
|
+
var root_9 = $4.from_html(`<p class="cinder-input-field__error" aria-live="polite"> </p>`);
|
|
665
|
+
var root_10 = $4.from_html(`<div class="cinder-input-field"><!> <!> <!> <!></div>`);
|
|
666
|
+
function Input($$anchor, $$props) {
|
|
667
|
+
$4.push($$props, true);
|
|
668
|
+
const inputElement = ($$anchor2) => {
|
|
669
|
+
var input = root_12();
|
|
670
|
+
$4.attribute_effect(input, ($0) => ({
|
|
671
|
+
id: $$props.id,
|
|
672
|
+
type: type(),
|
|
673
|
+
...rest,
|
|
674
|
+
disabled: $4.get(resolvedDisabled),
|
|
675
|
+
required: $4.get(resolvedRequired),
|
|
676
|
+
value: value(),
|
|
677
|
+
oninput: handleInput,
|
|
678
|
+
class: $0,
|
|
679
|
+
"data-cinder-native-date": $4.get(rendersNativeDateIcon) ? "" : undefined,
|
|
680
|
+
"aria-invalid": $4.get(resolvedAriaInvalid),
|
|
681
|
+
"aria-describedby": $4.get(describedBy)
|
|
682
|
+
}), [() => classNames("cinder-input", $$props.class)], undefined, undefined, undefined, true);
|
|
683
|
+
$4.bind_this(input, ($$value) => $4.set(inputNode, $$value), () => $4.get(inputNode));
|
|
684
|
+
$4.append($$anchor2, input);
|
|
685
|
+
};
|
|
686
|
+
let value = $4.prop($$props, "value", 15, ""), hideLabel = $4.prop($$props, "hideLabel", 3, false), type = $4.prop($$props, "type", 3, "text"), leadingInteractive = $4.prop($$props, "leadingInteractive", 3, false), trailingInteractive = $4.prop($$props, "trailingInteractive", 3, false), rest = $4.rest_props($$props, rest_excludes3);
|
|
687
|
+
const context = getFormFieldContext();
|
|
688
|
+
$4.user_effect(() => {
|
|
689
|
+
if (context && context.controlId !== $$props.id) {
|
|
690
|
+
devWarn(`[cinder/Input] id mismatch: Input id="${$$props.id}" but wrapping FormField expects controlId="${context.controlId}". Set the same id on both.`);
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
const field = $4.derived(() => resolveFieldControl({
|
|
694
|
+
id: $$props.id,
|
|
695
|
+
generatedId: $$props.id,
|
|
696
|
+
context,
|
|
697
|
+
hasDescription: !!$$props.description,
|
|
698
|
+
hasError: !!$$props.error,
|
|
699
|
+
localIdNamespace: "input",
|
|
700
|
+
consumerDescribedBy: $$props["aria-describedby"],
|
|
701
|
+
consumerInvalid: $$props["aria-invalid"],
|
|
702
|
+
required: $$props.required,
|
|
703
|
+
disabled: $$props.disabled
|
|
704
|
+
}));
|
|
705
|
+
const ownDescriptionId = $4.derived(() => $4.get(field).ownDescriptionId);
|
|
706
|
+
const ownErrorId = $4.derived(() => $4.get(field).ownErrorId);
|
|
707
|
+
const describedBy = $4.derived(() => $4.get(field).describedBy);
|
|
708
|
+
const resolvedAriaInvalid = $4.derived(() => $4.get(field).ariaInvalid);
|
|
709
|
+
const resolvedRequired = $4.derived(() => $4.get(field).required);
|
|
710
|
+
const resolvedDisabled = $4.derived(() => $4.get(field).disabled);
|
|
711
|
+
const isNativeDateInput = $4.derived(() => type() === "date");
|
|
712
|
+
const rendersNativeDateIcon = $4.derived(() => $4.get(isNativeDateInput) && !$$props.trailing);
|
|
713
|
+
const hasTrailing = $4.derived(() => !!$$props.trailing || $4.get(isNativeDateInput));
|
|
714
|
+
const hasGroupWrapper = $4.derived(() => !!$$props.leading || $4.get(hasTrailing));
|
|
715
|
+
const isInvalid = $4.derived(() => $4.get(resolvedAriaInvalid) === "true");
|
|
716
|
+
let inputNode = $4.state(undefined);
|
|
717
|
+
let resetSyncTimeout;
|
|
718
|
+
function syncValueAfterFormReset() {
|
|
719
|
+
if (resetSyncTimeout !== undefined)
|
|
720
|
+
clearTimeout(resetSyncTimeout);
|
|
721
|
+
resetSyncTimeout = setTimeout(() => {
|
|
722
|
+
resetSyncTimeout = undefined;
|
|
723
|
+
if ($4.get(inputNode))
|
|
724
|
+
value($4.get(inputNode).value);
|
|
725
|
+
}, 0);
|
|
726
|
+
}
|
|
727
|
+
$4.user_effect(() => {
|
|
728
|
+
const form = $4.get(inputNode)?.form;
|
|
729
|
+
if (!form)
|
|
730
|
+
return;
|
|
731
|
+
form.addEventListener("reset", syncValueAfterFormReset);
|
|
732
|
+
return () => {
|
|
733
|
+
form.removeEventListener("reset", syncValueAfterFormReset);
|
|
734
|
+
if (resetSyncTimeout !== undefined) {
|
|
735
|
+
clearTimeout(resetSyncTimeout);
|
|
736
|
+
resetSyncTimeout = undefined;
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
});
|
|
740
|
+
function handleInput(event) {
|
|
741
|
+
const target = event.currentTarget;
|
|
742
|
+
const committed = commitValue(target.value, $$props.onValueChange, (next) => {
|
|
743
|
+
value(next);
|
|
744
|
+
});
|
|
745
|
+
target.value = committed;
|
|
746
|
+
$$props.oninput?.(event);
|
|
747
|
+
}
|
|
748
|
+
var div = root_10();
|
|
749
|
+
var node = $4.child(div);
|
|
750
|
+
{
|
|
751
|
+
var consequent_1 = ($$anchor2) => {
|
|
752
|
+
var label_1 = root_32();
|
|
753
|
+
var text2 = $4.child(label_1);
|
|
754
|
+
var node_1 = $4.sibling(text2);
|
|
755
|
+
{
|
|
756
|
+
var consequent = ($$anchor3) => {
|
|
757
|
+
var span = root_22();
|
|
758
|
+
$4.append($$anchor3, span);
|
|
759
|
+
};
|
|
760
|
+
$4.if(node_1, ($$render) => {
|
|
761
|
+
if ($4.get(resolvedRequired))
|
|
762
|
+
$$render(consequent);
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
$4.reset(label_1);
|
|
766
|
+
$4.template_effect(($0) => {
|
|
767
|
+
$4.set_attribute(label_1, "for", $$props.id);
|
|
768
|
+
$4.set_class(label_1, 1, $0);
|
|
769
|
+
$4.set_attribute(label_1, "data-disabled", $4.get(resolvedDisabled) || undefined);
|
|
770
|
+
$4.set_text(text2, `${$$props.label ?? ""} `);
|
|
771
|
+
}, [
|
|
772
|
+
() => $4.clsx(classNames("cinder-input-field__label", hideLabel() && "cinder-sr-only"))
|
|
773
|
+
]);
|
|
774
|
+
$4.append($$anchor2, label_1);
|
|
775
|
+
};
|
|
776
|
+
$4.if(node, ($$render) => {
|
|
777
|
+
if ($$props.label)
|
|
778
|
+
$$render(consequent_1);
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
var node_2 = $4.sibling(node, 2);
|
|
782
|
+
{
|
|
783
|
+
var consequent_5 = ($$anchor2) => {
|
|
784
|
+
var div_1 = root_7();
|
|
785
|
+
var node_3 = $4.child(div_1);
|
|
786
|
+
{
|
|
787
|
+
var consequent_2 = ($$anchor3) => {
|
|
788
|
+
var span_1 = root_42();
|
|
789
|
+
var node_4 = $4.child(span_1);
|
|
790
|
+
$4.snippet(node_4, () => $$props.leading);
|
|
791
|
+
$4.reset(span_1);
|
|
792
|
+
$4.template_effect(() => $4.set_attribute(span_1, "aria-hidden", leadingInteractive() ? undefined : "true"));
|
|
793
|
+
$4.append($$anchor3, span_1);
|
|
794
|
+
};
|
|
795
|
+
$4.if(node_3, ($$render) => {
|
|
796
|
+
if ($$props.leading)
|
|
797
|
+
$$render(consequent_2);
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
var node_5 = $4.sibling(node_3, 2);
|
|
801
|
+
inputElement(node_5);
|
|
802
|
+
var node_6 = $4.sibling(node_5, 2);
|
|
803
|
+
{
|
|
804
|
+
var consequent_3 = ($$anchor3) => {
|
|
805
|
+
var span_2 = root_52();
|
|
806
|
+
var node_7 = $4.child(span_2);
|
|
807
|
+
$4.snippet(node_7, () => $$props.trailing);
|
|
808
|
+
$4.reset(span_2);
|
|
809
|
+
$4.template_effect(() => $4.set_attribute(span_2, "aria-hidden", trailingInteractive() ? undefined : "true"));
|
|
810
|
+
$4.append($$anchor3, span_2);
|
|
811
|
+
};
|
|
812
|
+
var consequent_4 = ($$anchor3) => {
|
|
813
|
+
var span_3 = root_6();
|
|
814
|
+
var node_8 = $4.child(span_3);
|
|
815
|
+
calendarIcon(node_8);
|
|
816
|
+
$4.reset(span_3);
|
|
817
|
+
$4.append($$anchor3, span_3);
|
|
818
|
+
};
|
|
819
|
+
$4.if(node_6, ($$render) => {
|
|
820
|
+
if ($$props.trailing)
|
|
821
|
+
$$render(consequent_3);
|
|
822
|
+
else if ($4.get(rendersNativeDateIcon))
|
|
823
|
+
$$render(consequent_4, 1);
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
$4.reset(div_1);
|
|
827
|
+
$4.template_effect(() => {
|
|
828
|
+
$4.set_attribute(div_1, "data-leading", $$props.leading ? "" : undefined);
|
|
829
|
+
$4.set_attribute(div_1, "data-trailing", $4.get(hasTrailing) ? "" : undefined);
|
|
830
|
+
$4.set_attribute(div_1, "data-native-date", $4.get(rendersNativeDateIcon) ? "" : undefined);
|
|
831
|
+
$4.set_attribute(div_1, "data-disabled", $4.get(resolvedDisabled) ? "" : undefined);
|
|
832
|
+
$4.set_attribute(div_1, "data-invalid", $4.get(isInvalid) ? "" : undefined);
|
|
833
|
+
});
|
|
834
|
+
$4.append($$anchor2, div_1);
|
|
835
|
+
};
|
|
836
|
+
var alternate = ($$anchor2) => {
|
|
837
|
+
inputElement($$anchor2);
|
|
838
|
+
};
|
|
839
|
+
$4.if(node_2, ($$render) => {
|
|
840
|
+
if ($4.get(hasGroupWrapper))
|
|
841
|
+
$$render(consequent_5);
|
|
842
|
+
else
|
|
843
|
+
$$render(alternate, -1);
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
var node_9 = $4.sibling(node_2, 2);
|
|
847
|
+
{
|
|
848
|
+
var consequent_6 = ($$anchor2) => {
|
|
849
|
+
var p = root_8();
|
|
850
|
+
var text_1 = $4.child(p, true);
|
|
851
|
+
$4.reset(p);
|
|
852
|
+
$4.template_effect(() => {
|
|
853
|
+
$4.set_attribute(p, "id", $4.get(ownDescriptionId));
|
|
854
|
+
$4.set_text(text_1, $$props.description);
|
|
855
|
+
});
|
|
856
|
+
$4.append($$anchor2, p);
|
|
857
|
+
};
|
|
858
|
+
$4.if(node_9, ($$render) => {
|
|
859
|
+
if ($$props.description)
|
|
860
|
+
$$render(consequent_6);
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
var node_10 = $4.sibling(node_9, 2);
|
|
864
|
+
{
|
|
865
|
+
var consequent_7 = ($$anchor2) => {
|
|
866
|
+
var p_1 = root_9();
|
|
867
|
+
var text_2 = $4.child(p_1, true);
|
|
868
|
+
$4.reset(p_1);
|
|
869
|
+
$4.template_effect(() => {
|
|
870
|
+
$4.set_attribute(p_1, "id", $4.get(ownErrorId));
|
|
871
|
+
$4.set_text(text_2, $$props.error);
|
|
872
|
+
});
|
|
873
|
+
$4.append($$anchor2, p_1);
|
|
874
|
+
};
|
|
875
|
+
$4.if(node_10, ($$render) => {
|
|
876
|
+
if ($$props.error)
|
|
877
|
+
$$render(consequent_7);
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
$4.reset(div);
|
|
881
|
+
$4.append($$anchor, div);
|
|
882
|
+
$4.pop();
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// src/components/modal/modal.svelte
|
|
886
|
+
import"svelte/internal/disclose-version";
|
|
887
|
+
import * as $5 from "svelte/internal/client";
|
|
560
888
|
import { onDestroy } from "svelte";
|
|
561
889
|
|
|
562
890
|
// src/_internal/overlay.ts
|
|
@@ -729,17 +1057,17 @@ function overflowFade() {
|
|
|
729
1057
|
}
|
|
730
1058
|
|
|
731
1059
|
// src/components/modal/modal.svelte
|
|
732
|
-
var
|
|
733
|
-
var
|
|
734
|
-
var
|
|
735
|
-
var
|
|
1060
|
+
var root4 = $5.from_html(`<div class="cinder-modal__footer"><!></div>`);
|
|
1061
|
+
var root_13 = $5.from_html(`<button type="button" class="cinder-modal__close" aria-label="Close dialog"><svg class="cinder-modal__close-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg></button>`);
|
|
1062
|
+
var root_23 = $5.from_html(`<div class="cinder-modal__panel"><div class="cinder-modal__header"><h2 class="cinder-modal__title"> </h2></div> <div class="cinder-modal__body" tabindex="-1"><!></div> <!> <!></div>`);
|
|
1063
|
+
var root_33 = $5.from_html(`<dialog><!></dialog>`);
|
|
736
1064
|
function Modal($$anchor, $$props) {
|
|
737
|
-
const titleId = $
|
|
738
|
-
$
|
|
739
|
-
let open = $
|
|
740
|
-
let dialogElement = $
|
|
741
|
-
let bodyElement = $
|
|
742
|
-
let mounted = $
|
|
1065
|
+
const titleId = $5.props_id();
|
|
1066
|
+
$5.push($$props, true);
|
|
1067
|
+
let open = $5.prop($$props, "open", 15, false), role = $5.prop($$props, "role", 3, "dialog"), dismissOnBackdropClick = $5.prop($$props, "dismissOnBackdropClick", 3, true), dismissOnEscape = $5.prop($$props, "dismissOnEscape", 3, true), showCloseButton = $5.prop($$props, "showCloseButton", 3, true), triggerRef = $5.prop($$props, "triggerRef", 3, null);
|
|
1068
|
+
let dialogElement = $5.state(undefined);
|
|
1069
|
+
let bodyElement = $5.state(undefined);
|
|
1070
|
+
let mounted = $5.state(false);
|
|
743
1071
|
let capturedFocus = null;
|
|
744
1072
|
let releaseBodyScrollLock = null;
|
|
745
1073
|
let releaseEscapeHandler = null;
|
|
@@ -762,28 +1090,28 @@ function Modal($$anchor, $$props) {
|
|
|
762
1090
|
releaseEscapeHandler = null;
|
|
763
1091
|
}
|
|
764
1092
|
const bodyOverflowFade = overflowFade();
|
|
765
|
-
$
|
|
766
|
-
$
|
|
1093
|
+
$5.user_effect(() => {
|
|
1094
|
+
$5.set(mounted, true);
|
|
767
1095
|
});
|
|
768
|
-
$
|
|
1096
|
+
$5.user_effect(() => {
|
|
769
1097
|
if (role() === "alertdialog" && (dismissOnBackdropClick() !== false || dismissOnEscape() !== false || showCloseButton() !== false)) {
|
|
770
1098
|
devWarn('[cinder/Modal] role="alertdialog" requires dismissOnBackdropClick={false}, dismissOnEscape={false}, and showCloseButton={false}. ' + "Without these, Escape or backdrop click can bypass the mandatory acknowledgement. " + "Use <AlertDialog> instead, or pass all three companion props explicitly.");
|
|
771
1099
|
}
|
|
772
1100
|
});
|
|
773
|
-
$
|
|
774
|
-
if (!$
|
|
1101
|
+
$5.user_effect(() => {
|
|
1102
|
+
if (!$5.get(dialogElement))
|
|
775
1103
|
return;
|
|
776
|
-
if (open() && !$
|
|
1104
|
+
if (open() && !$5.get(dialogElement).open) {
|
|
777
1105
|
capturedFocus = captureFocus();
|
|
778
|
-
$
|
|
1106
|
+
$5.get(dialogElement).showModal();
|
|
779
1107
|
acquireLock();
|
|
780
1108
|
acquireEscapeHandler();
|
|
781
|
-
const hasExplicitAutofocus = $
|
|
782
|
-
if (!hasExplicitAutofocus && $
|
|
783
|
-
$
|
|
1109
|
+
const hasExplicitAutofocus = $5.get(dialogElement).querySelector("[autofocus]") !== null || Array.from($5.get(dialogElement).querySelectorAll("*")).some((el) => el.autofocus === true);
|
|
1110
|
+
if (!hasExplicitAutofocus && $5.get(bodyElement)) {
|
|
1111
|
+
$5.get(bodyElement).focus();
|
|
784
1112
|
}
|
|
785
|
-
} else if (!open() && $
|
|
786
|
-
$
|
|
1113
|
+
} else if (!open() && $5.get(dialogElement).open) {
|
|
1114
|
+
$5.get(dialogElement).close();
|
|
787
1115
|
}
|
|
788
1116
|
});
|
|
789
1117
|
function returnFocus() {
|
|
@@ -809,7 +1137,7 @@ function Modal($$anchor, $$props) {
|
|
|
809
1137
|
releaseEscape();
|
|
810
1138
|
});
|
|
811
1139
|
function handleBackdropClick(event) {
|
|
812
|
-
if (dismissOnBackdropClick() && event.target === $
|
|
1140
|
+
if (dismissOnBackdropClick() && event.target === $5.get(dialogElement)) {
|
|
813
1141
|
dismiss();
|
|
814
1142
|
}
|
|
815
1143
|
}
|
|
@@ -819,12 +1147,12 @@ function Modal($$anchor, $$props) {
|
|
|
819
1147
|
return;
|
|
820
1148
|
dismiss();
|
|
821
1149
|
}
|
|
822
|
-
var fragment = $
|
|
823
|
-
var node = $
|
|
1150
|
+
var fragment = $5.comment();
|
|
1151
|
+
var node = $5.first_child(fragment);
|
|
824
1152
|
{
|
|
825
1153
|
var consequent_3 = ($$anchor2) => {
|
|
826
|
-
var dialog =
|
|
827
|
-
$
|
|
1154
|
+
var dialog = root_33();
|
|
1155
|
+
$5.attribute_effect(dialog, ($0) => ({
|
|
828
1156
|
class: $0,
|
|
829
1157
|
role: role(),
|
|
830
1158
|
"aria-modal": "true",
|
|
@@ -834,86 +1162,98 @@ function Modal($$anchor, $$props) {
|
|
|
834
1162
|
onclick: handleBackdropClick,
|
|
835
1163
|
oncancel: handleNativeCancel
|
|
836
1164
|
}), [() => classNames("cinder-modal", $$props.class)]);
|
|
837
|
-
var node_1 = $
|
|
1165
|
+
var node_1 = $5.child(dialog);
|
|
838
1166
|
{
|
|
839
1167
|
var consequent_2 = ($$anchor3) => {
|
|
840
|
-
var div =
|
|
841
|
-
var div_1 = $
|
|
842
|
-
var h2 = $
|
|
843
|
-
var text2 = $
|
|
844
|
-
$
|
|
845
|
-
$
|
|
846
|
-
var div_2 = $
|
|
847
|
-
var node_2 = $
|
|
848
|
-
$
|
|
849
|
-
$
|
|
850
|
-
$
|
|
851
|
-
$
|
|
852
|
-
var node_3 = $
|
|
1168
|
+
var div = root_23();
|
|
1169
|
+
var div_1 = $5.child(div);
|
|
1170
|
+
var h2 = $5.child(div_1);
|
|
1171
|
+
var text2 = $5.child(h2, true);
|
|
1172
|
+
$5.reset(h2);
|
|
1173
|
+
$5.reset(div_1);
|
|
1174
|
+
var div_2 = $5.sibling(div_1, 2);
|
|
1175
|
+
var node_2 = $5.child(div_2);
|
|
1176
|
+
$5.snippet(node_2, () => $$props.children);
|
|
1177
|
+
$5.reset(div_2);
|
|
1178
|
+
$5.bind_this(div_2, ($$value) => $5.set(bodyElement, $$value), () => $5.get(bodyElement));
|
|
1179
|
+
$5.attach(div_2, () => bodyOverflowFade);
|
|
1180
|
+
var node_3 = $5.sibling(div_2, 2);
|
|
853
1181
|
{
|
|
854
1182
|
var consequent = ($$anchor4) => {
|
|
855
|
-
var div_3 =
|
|
856
|
-
var node_4 = $
|
|
857
|
-
$
|
|
858
|
-
$
|
|
859
|
-
$
|
|
1183
|
+
var div_3 = root4();
|
|
1184
|
+
var node_4 = $5.child(div_3);
|
|
1185
|
+
$5.snippet(node_4, () => $$props.footer);
|
|
1186
|
+
$5.reset(div_3);
|
|
1187
|
+
$5.append($$anchor4, div_3);
|
|
860
1188
|
};
|
|
861
|
-
$
|
|
1189
|
+
$5.if(node_3, ($$render) => {
|
|
862
1190
|
if ($$props.footer)
|
|
863
1191
|
$$render(consequent);
|
|
864
1192
|
});
|
|
865
1193
|
}
|
|
866
|
-
var node_5 = $
|
|
1194
|
+
var node_5 = $5.sibling(node_3, 2);
|
|
867
1195
|
{
|
|
868
1196
|
var consequent_1 = ($$anchor4) => {
|
|
869
|
-
var button =
|
|
870
|
-
$
|
|
871
|
-
$
|
|
1197
|
+
var button = root_13();
|
|
1198
|
+
$5.delegated("click", button, dismiss);
|
|
1199
|
+
$5.append($$anchor4, button);
|
|
872
1200
|
};
|
|
873
|
-
$
|
|
1201
|
+
$5.if(node_5, ($$render) => {
|
|
874
1202
|
if (showCloseButton())
|
|
875
1203
|
$$render(consequent_1);
|
|
876
1204
|
});
|
|
877
1205
|
}
|
|
878
|
-
$
|
|
879
|
-
$
|
|
1206
|
+
$5.reset(div);
|
|
1207
|
+
$5.attach(div, () => createFocusTrap({
|
|
880
1208
|
active: () => open(),
|
|
881
1209
|
restoreFocus: false,
|
|
882
1210
|
manageInitialFocus: false
|
|
883
1211
|
}));
|
|
884
|
-
$
|
|
885
|
-
$
|
|
886
|
-
$
|
|
1212
|
+
$5.template_effect(() => {
|
|
1213
|
+
$5.set_attribute(h2, "id", titleId);
|
|
1214
|
+
$5.set_text(text2, $$props.title);
|
|
887
1215
|
});
|
|
888
|
-
$
|
|
1216
|
+
$5.append($$anchor3, div);
|
|
889
1217
|
};
|
|
890
|
-
$
|
|
1218
|
+
$5.if(node_1, ($$render) => {
|
|
891
1219
|
if (open())
|
|
892
1220
|
$$render(consequent_2);
|
|
893
1221
|
});
|
|
894
1222
|
}
|
|
895
|
-
$
|
|
896
|
-
$
|
|
897
|
-
$
|
|
1223
|
+
$5.reset(dialog);
|
|
1224
|
+
$5.bind_this(dialog, ($$value) => $5.set(dialogElement, $$value), () => $5.get(dialogElement));
|
|
1225
|
+
$5.append($$anchor2, dialog);
|
|
898
1226
|
};
|
|
899
|
-
$
|
|
900
|
-
if ($
|
|
1227
|
+
$5.if(node, ($$render) => {
|
|
1228
|
+
if ($5.get(mounted) || open())
|
|
901
1229
|
$$render(consequent_3);
|
|
902
1230
|
});
|
|
903
1231
|
}
|
|
904
|
-
$
|
|
905
|
-
$
|
|
1232
|
+
$5.append($$anchor, fragment);
|
|
1233
|
+
$5.pop();
|
|
906
1234
|
}
|
|
907
|
-
$
|
|
1235
|
+
$5.delegate(["click"]);
|
|
908
1236
|
|
|
909
1237
|
// src/components/confirm-dialog/confirm-dialog.svelte
|
|
910
|
-
var
|
|
911
|
-
var
|
|
1238
|
+
var root5 = $6.from_html(`<!> <!>`, 1);
|
|
1239
|
+
var root_14 = $6.from_html(`<p class="cinder-confirm-dialog__description"> </p>`);
|
|
912
1240
|
function Confirm_dialog($$anchor, $$props) {
|
|
913
|
-
const descriptionId = $
|
|
914
|
-
$
|
|
915
|
-
|
|
916
|
-
|
|
1241
|
+
const descriptionId = $6.props_id();
|
|
1242
|
+
$6.push($$props, true);
|
|
1243
|
+
const typedConfirmationId = `${descriptionId}-typed-confirmation`;
|
|
1244
|
+
let open = $6.prop($$props, "open", 15, false), cancelLabel = $6.prop($$props, "cancelLabel", 3, "Cancel"), destructive = $6.prop($$props, "destructive", 3, false), triggerRef = $6.prop($$props, "triggerRef", 3, null);
|
|
1245
|
+
const describedById = $6.derived(() => $$props.description ? descriptionId : undefined);
|
|
1246
|
+
const normalizedTypeToConfirm = $6.derived(() => $$props.typeToConfirm?.trim() || undefined);
|
|
1247
|
+
const normalizedTypeToConfirmLabel = $6.derived(() => $$props.typeToConfirmLabel?.trim() || undefined);
|
|
1248
|
+
let typedConfirmation = $6.state("");
|
|
1249
|
+
let previousOpen = open();
|
|
1250
|
+
const typedConfirmationMatches = $6.derived(() => $6.get(normalizedTypeToConfirm) === undefined || $6.get(typedConfirmation).trim().toLowerCase() === $6.get(normalizedTypeToConfirm).toLowerCase());
|
|
1251
|
+
$6.user_effect(() => {
|
|
1252
|
+
if (open() === previousOpen)
|
|
1253
|
+
return;
|
|
1254
|
+
previousOpen = open();
|
|
1255
|
+
$6.set(typedConfirmation, "");
|
|
1256
|
+
});
|
|
917
1257
|
function handleCancel() {
|
|
918
1258
|
open(false);
|
|
919
1259
|
$$props.oncancel?.();
|
|
@@ -924,41 +1264,45 @@ function Confirm_dialog($$anchor, $$props) {
|
|
|
924
1264
|
}
|
|
925
1265
|
{
|
|
926
1266
|
const footer = ($$anchor2) => {
|
|
927
|
-
var fragment_1 =
|
|
928
|
-
var node = $
|
|
1267
|
+
var fragment_1 = root5();
|
|
1268
|
+
var node = $6.first_child(fragment_1);
|
|
929
1269
|
Button(node, {
|
|
930
1270
|
variant: "secondary",
|
|
931
1271
|
autofocus: true,
|
|
932
1272
|
onclick: handleCancel,
|
|
933
1273
|
children: ($$anchor3, $$slotProps) => {
|
|
934
|
-
$
|
|
935
|
-
var text3 = $
|
|
936
|
-
$
|
|
937
|
-
$
|
|
1274
|
+
$6.next();
|
|
1275
|
+
var text3 = $6.text();
|
|
1276
|
+
$6.template_effect(() => $6.set_text(text3, cancelLabel()));
|
|
1277
|
+
$6.append($$anchor3, text3);
|
|
938
1278
|
},
|
|
939
1279
|
$$slots: { default: true }
|
|
940
1280
|
});
|
|
941
|
-
var node_1 = $
|
|
1281
|
+
var node_1 = $6.sibling(node, 2);
|
|
942
1282
|
{
|
|
943
|
-
let $02 = $
|
|
1283
|
+
let $02 = $6.derived(() => destructive() ? "danger" : "primary");
|
|
1284
|
+
let $1 = $6.derived(() => !$6.get(typedConfirmationMatches));
|
|
944
1285
|
Button(node_1, {
|
|
945
1286
|
get variant() {
|
|
946
|
-
return $
|
|
1287
|
+
return $6.get($02);
|
|
1288
|
+
},
|
|
1289
|
+
get disabled() {
|
|
1290
|
+
return $6.get($1);
|
|
947
1291
|
},
|
|
948
1292
|
onclick: handleConfirm,
|
|
949
1293
|
children: ($$anchor3, $$slotProps) => {
|
|
950
|
-
$
|
|
951
|
-
var text_1 = $
|
|
952
|
-
$
|
|
953
|
-
$
|
|
1294
|
+
$6.next();
|
|
1295
|
+
var text_1 = $6.text();
|
|
1296
|
+
$6.template_effect(() => $6.set_text(text_1, $$props.confirmLabel));
|
|
1297
|
+
$6.append($$anchor3, text_1);
|
|
954
1298
|
},
|
|
955
1299
|
$$slots: { default: true }
|
|
956
1300
|
});
|
|
957
1301
|
}
|
|
958
|
-
$
|
|
1302
|
+
$6.append($$anchor2, fragment_1);
|
|
959
1303
|
};
|
|
960
|
-
let $0 = $
|
|
961
|
-
Modal($$anchor, $
|
|
1304
|
+
let $0 = $6.derived(() => classNames("cinder-confirm-dialog", $$props.class));
|
|
1305
|
+
Modal($$anchor, $6.spread_props({
|
|
962
1306
|
get title() {
|
|
963
1307
|
return $$props.title;
|
|
964
1308
|
},
|
|
@@ -966,9 +1310,9 @@ function Confirm_dialog($$anchor, $$props) {
|
|
|
966
1310
|
return triggerRef();
|
|
967
1311
|
},
|
|
968
1312
|
get class() {
|
|
969
|
-
return $
|
|
1313
|
+
return $6.get($0);
|
|
970
1314
|
}
|
|
971
|
-
}, () => $
|
|
1315
|
+
}, () => $6.get(describedById) ? { describedById: $6.get(describedById) } : {}, () => $$props.oncancel ? { ondismiss: $$props.oncancel } : {}, {
|
|
972
1316
|
get open() {
|
|
973
1317
|
return open();
|
|
974
1318
|
},
|
|
@@ -977,30 +1321,58 @@ function Confirm_dialog($$anchor, $$props) {
|
|
|
977
1321
|
},
|
|
978
1322
|
footer,
|
|
979
1323
|
children: ($$anchor2, $$slotProps) => {
|
|
980
|
-
var fragment_4 =
|
|
981
|
-
var node_2 = $
|
|
1324
|
+
var fragment_4 = root5();
|
|
1325
|
+
var node_2 = $6.first_child(fragment_4);
|
|
982
1326
|
{
|
|
983
1327
|
var consequent = ($$anchor3) => {
|
|
984
|
-
var p =
|
|
985
|
-
var text_2 = $
|
|
986
|
-
$
|
|
987
|
-
$
|
|
988
|
-
$
|
|
989
|
-
$
|
|
1328
|
+
var p = root_14();
|
|
1329
|
+
var text_2 = $6.child(p, true);
|
|
1330
|
+
$6.reset(p);
|
|
1331
|
+
$6.template_effect(() => {
|
|
1332
|
+
$6.set_attribute(p, "id", descriptionId);
|
|
1333
|
+
$6.set_text(text_2, $$props.description);
|
|
990
1334
|
});
|
|
991
|
-
$
|
|
1335
|
+
$6.append($$anchor3, p);
|
|
992
1336
|
};
|
|
993
|
-
$
|
|
1337
|
+
$6.if(node_2, ($$render) => {
|
|
994
1338
|
if ($$props.description)
|
|
995
1339
|
$$render(consequent);
|
|
996
1340
|
});
|
|
997
1341
|
}
|
|
998
|
-
$
|
|
1342
|
+
var node_3 = $6.sibling(node_2, 2);
|
|
1343
|
+
{
|
|
1344
|
+
var consequent_1 = ($$anchor3) => {
|
|
1345
|
+
{
|
|
1346
|
+
let $02 = $6.derived(() => $6.get(normalizedTypeToConfirmLabel) ?? `Type "${$6.get(normalizedTypeToConfirm)}" to confirm`);
|
|
1347
|
+
Input($$anchor3, {
|
|
1348
|
+
get id() {
|
|
1349
|
+
return typedConfirmationId;
|
|
1350
|
+
},
|
|
1351
|
+
class: "cinder-confirm-dialog__typed-confirmation",
|
|
1352
|
+
get label() {
|
|
1353
|
+
return $6.get($02);
|
|
1354
|
+
},
|
|
1355
|
+
autocomplete: "off",
|
|
1356
|
+
get value() {
|
|
1357
|
+
return $6.get(typedConfirmation);
|
|
1358
|
+
},
|
|
1359
|
+
set value($$value) {
|
|
1360
|
+
$6.set(typedConfirmation, $$value, true);
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
};
|
|
1365
|
+
$6.if(node_3, ($$render) => {
|
|
1366
|
+
if ($6.get(normalizedTypeToConfirm) !== undefined)
|
|
1367
|
+
$$render(consequent_1);
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
$6.append($$anchor2, fragment_4);
|
|
999
1371
|
},
|
|
1000
1372
|
$$slots: { footer: true, default: true }
|
|
1001
1373
|
}));
|
|
1002
1374
|
}
|
|
1003
|
-
$
|
|
1375
|
+
$6.pop();
|
|
1004
1376
|
}
|
|
1005
1377
|
|
|
1006
1378
|
// src/components/confirm-dialog/index.ts
|
|
@@ -1010,4 +1382,4 @@ export {
|
|
|
1010
1382
|
Confirm_dialog as ConfirmDialog
|
|
1011
1383
|
};
|
|
1012
1384
|
|
|
1013
|
-
//# debugId=
|
|
1385
|
+
//# debugId=6A9B3E83BCDBF78764756E2164756E21
|