@vantageos/mosaic 0.4.0 → 0.5.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 +39 -15
- package/README.md +114 -5
- package/dist/PipelineBoard-FucyGArR.d.cts +759 -0
- package/dist/PipelineBoard-FucyGArR.d.ts +759 -0
- package/dist/PipelineBoard.markdown-DIcvrS-2.d.cts +16 -0
- package/dist/PipelineBoard.markdown-DIcvrS-2.d.ts +16 -0
- package/dist/{StatusBadge.schema-1tOjB4Ir.d.cts → StatusBadge.schema-BEjSH2_4.d.cts} +2 -2
- package/dist/{StatusBadge.schema-1tOjB4Ir.d.ts → StatusBadge.schema-BEjSH2_4.d.ts} +2 -2
- package/dist/{Tabs.schema-BzcEyeq8.d.cts → Tabs.schema-Dqr6vwV3.d.cts} +2 -2
- package/dist/{Tabs.schema-BzcEyeq8.d.ts → Tabs.schema-Dqr6vwV3.d.ts} +2 -2
- package/dist/Timeline-Coo_3tA_.d.cts +114 -0
- package/dist/Timeline-Coo_3tA_.d.ts +114 -0
- package/dist/Timeline.markdown-C6UPDv1H.d.cts +4 -0
- package/dist/Timeline.markdown-C6UPDv1H.d.ts +4 -0
- package/dist/TransactionPreview-BzWDn8kE.d.cts +391 -0
- package/dist/TransactionPreview-BzWDn8kE.d.ts +391 -0
- package/dist/TransactionPreview.markdown-Dpb0VYgN.d.cts +7 -0
- package/dist/TransactionPreview.markdown-Dpb0VYgN.d.ts +7 -0
- package/dist/artifacts.cjs +186 -2
- package/dist/artifacts.cjs.map +1 -1
- package/dist/artifacts.js +186 -2
- package/dist/artifacts.js.map +1 -1
- package/dist/confirmation.cjs +724 -2
- package/dist/confirmation.cjs.map +1 -1
- package/dist/confirmation.d.cts +2 -1
- package/dist/confirmation.d.ts +2 -1
- package/dist/confirmation.js +722 -4
- package/dist/confirmation.js.map +1 -1
- package/dist/display.cjs +1551 -203
- package/dist/display.cjs.map +1 -1
- package/dist/display.d.cts +6 -229
- package/dist/display.d.ts +6 -229
- package/dist/display.js +1535 -206
- package/dist/display.js.map +1 -1
- package/dist/forms.cjs +139 -46
- package/dist/forms.cjs.map +1 -1
- package/dist/forms.d.cts +2 -2
- package/dist/forms.d.ts +2 -2
- package/dist/forms.js +139 -46
- package/dist/forms.js.map +1 -1
- package/dist/host.cjs +822 -0
- package/dist/host.cjs.map +1 -0
- package/dist/host.d.cts +287 -0
- package/dist/host.d.ts +287 -0
- package/dist/host.js +794 -0
- package/dist/host.js.map +1 -0
- package/dist/{index-CwXVgtGb.d.cts → index-BadRcCbm.d.cts} +28 -11
- package/dist/{index-CwXVgtGb.d.ts → index-BadRcCbm.d.ts} +28 -11
- package/dist/index.cjs +2198 -247
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -8
- package/dist/index.d.ts +42 -8
- package/dist/index.js +2163 -251
- package/dist/index.js.map +1 -1
- package/dist/input.d.cts +2 -2
- package/dist/input.d.ts +2 -2
- package/dist/media.cjs +186 -2
- package/dist/media.cjs.map +1 -1
- package/dist/media.d.cts +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/media.js +186 -2
- package/dist/media.js.map +1 -1
- package/dist/preact/artifacts.js +186 -2
- package/dist/preact/artifacts.js.map +1 -1
- package/dist/preact/confirmation.d.ts +321 -1
- package/dist/preact/confirmation.js +625 -4
- package/dist/preact/confirmation.js.map +1 -1
- package/dist/preact/display.d.ts +544 -47
- package/dist/preact/display.js +1190 -126
- package/dist/preact/display.js.map +1 -1
- package/dist/preact/forms.d.ts +32 -15
- package/dist/preact/forms.js +139 -46
- package/dist/preact/forms.js.map +1 -1
- package/dist/preact/host.d.ts +307 -0
- package/dist/preact/host.js +875 -0
- package/dist/preact/host.js.map +1 -0
- package/dist/preact/media.d.ts +37 -1
- package/dist/preact/media.js +423 -0
- package/dist/preact/media.js.map +1 -1
- package/dist/preact/progress.d.ts +92 -1
- package/dist/preact/progress.js +465 -3
- package/dist/preact/progress.js.map +1 -1
- package/dist/progress.cjs +521 -2
- package/dist/progress.cjs.map +1 -1
- package/dist/progress.d.cts +2 -1
- package/dist/progress.d.ts +2 -1
- package/dist/progress.js +518 -3
- package/dist/progress.js.map +1 -1
- package/dist/react/artifacts.cjs +186 -2
- package/dist/react/artifacts.cjs.map +1 -1
- package/dist/react/artifacts.js +186 -2
- package/dist/react/artifacts.js.map +1 -1
- package/dist/react/confirmation.cjs +626 -2
- package/dist/react/confirmation.cjs.map +1 -1
- package/dist/react/confirmation.d.cts +3 -3
- package/dist/react/confirmation.d.ts +3 -3
- package/dist/react/confirmation.js +625 -4
- package/dist/react/confirmation.js.map +1 -1
- package/dist/react/display.cjs +1076 -123
- package/dist/react/display.cjs.map +1 -1
- package/dist/react/display.d.cts +13 -27
- package/dist/react/display.d.ts +13 -27
- package/dist/react/display.js +1064 -126
- package/dist/react/display.js.map +1 -1
- package/dist/react/forms.cjs +139 -46
- package/dist/react/forms.cjs.map +1 -1
- package/dist/react/forms.d.cts +1 -1
- package/dist/react/forms.d.ts +1 -1
- package/dist/react/forms.js +139 -46
- package/dist/react/forms.js.map +1 -1
- package/dist/react/host.cjs +910 -0
- package/dist/react/host.cjs.map +1 -0
- package/dist/react/host.d.cts +24 -0
- package/dist/react/host.d.ts +24 -0
- package/dist/react/host.js +875 -0
- package/dist/react/host.js.map +1 -0
- package/dist/react/input.d.cts +1 -1
- package/dist/react/input.d.ts +1 -1
- package/dist/react/media.cjs +426 -0
- package/dist/react/media.cjs.map +1 -1
- package/dist/react/media.d.cts +19 -1
- package/dist/react/media.d.ts +19 -1
- package/dist/react/media.js +423 -0
- package/dist/react/media.js.map +1 -1
- package/dist/react/progress.cjs +467 -2
- package/dist/react/progress.cjs.map +1 -1
- package/dist/react/progress.d.cts +1 -1
- package/dist/react/progress.d.ts +1 -1
- package/dist/react/progress.js +465 -3
- package/dist/react/progress.js.map +1 -1
- package/dist/server/resource.cjs +151 -0
- package/dist/server/resource.cjs.map +1 -0
- package/dist/server/resource.d.cts +90 -0
- package/dist/server/resource.d.ts +90 -0
- package/dist/server/resource.js +147 -0
- package/dist/server/resource.js.map +1 -0
- package/dist/server.cjs +1100 -25
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +84 -5
- package/dist/server.d.ts +84 -5
- package/dist/server.js +1087 -27
- package/dist/server.js.map +1 -1
- package/package.json +250 -233
- package/registry.yaml +44 -2
- package/dist/Alert.schema-LPJE5gFP.d.cts +0 -71
- package/dist/Alert.schema-LPJE5gFP.d.ts +0 -71
- package/dist/ProgressBar.schema-CdVYx0Wq.d.cts +0 -22
- package/dist/ProgressBar.schema-CdVYx0Wq.d.ts +0 -22
- package/dist/{ConfirmDialog-B3CQQGmJ.d.cts → ConfirmDialog-BCtOcmHe.d.cts} +1 -1
- package/dist/{ConfirmDialog-B3CQQGmJ.d.ts → ConfirmDialog-BCtOcmHe.d.ts} +1 -1
package/dist/react/forms.cjs
CHANGED
|
@@ -514,7 +514,9 @@ var MultiSelectPropsSchema = zod.z.object({
|
|
|
514
514
|
placeholder: zod.z.string().optional(),
|
|
515
515
|
disabled: zod.z.boolean().optional(),
|
|
516
516
|
searchable: zod.z.boolean().optional(),
|
|
517
|
-
maxItems: zod.z.number().int().positive().optional()
|
|
517
|
+
maxItems: zod.z.number().int().positive().optional(),
|
|
518
|
+
/** `chips`: every option is a visible toggle button (aria-pressed), no dropdown. */
|
|
519
|
+
appearance: zod.z.enum(["default", "chips"]).default("default")
|
|
518
520
|
});
|
|
519
521
|
function MultiSelect(props) {
|
|
520
522
|
const parsed = MultiSelectPropsSchema.parse({
|
|
@@ -524,15 +526,32 @@ function MultiSelect(props) {
|
|
|
524
526
|
placeholder: props.placeholder,
|
|
525
527
|
disabled: props.disabled,
|
|
526
528
|
searchable: props.searchable,
|
|
527
|
-
maxItems: props.maxItems
|
|
529
|
+
maxItems: props.maxItems,
|
|
530
|
+
appearance: props.appearance
|
|
528
531
|
});
|
|
529
|
-
const { name, label, options, placeholder, disabled, searchable, maxItems } = parsed;
|
|
532
|
+
const { name, label, options, placeholder, disabled, searchable, maxItems, appearance } = parsed;
|
|
530
533
|
const reactId = react.useId();
|
|
531
534
|
const triggerId = `${reactId}-trigger`;
|
|
532
535
|
const listboxId = `${reactId}-listbox`;
|
|
533
536
|
const labelId = `${reactId}-label`;
|
|
534
537
|
return /* @__PURE__ */ jsxRuntime.jsx(FormField, { name, children: ({ field }) => {
|
|
535
538
|
const value = Array.isArray(field.value) ? field.value : [];
|
|
539
|
+
if (appearance === "chips") {
|
|
540
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
541
|
+
ChipToggles,
|
|
542
|
+
{
|
|
543
|
+
labelId,
|
|
544
|
+
label,
|
|
545
|
+
options,
|
|
546
|
+
value,
|
|
547
|
+
disabled,
|
|
548
|
+
maxItems,
|
|
549
|
+
onChange: (next) => field.onChange(next),
|
|
550
|
+
onBlur: () => field.onBlur(),
|
|
551
|
+
className: props.className
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
}
|
|
536
555
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
537
556
|
Inner,
|
|
538
557
|
{
|
|
@@ -553,6 +572,39 @@ function MultiSelect(props) {
|
|
|
553
572
|
);
|
|
554
573
|
} });
|
|
555
574
|
}
|
|
575
|
+
function ChipToggles(p) {
|
|
576
|
+
const atMax = isAtMaxItems(p.value, p.maxItems);
|
|
577
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
578
|
+
"fieldset",
|
|
579
|
+
{
|
|
580
|
+
"aria-labelledby": p.labelId,
|
|
581
|
+
"data-appearance": "chips",
|
|
582
|
+
className: `m-0 min-w-0 border-0 p-0 ${p.className ?? "mosaic-multiselect mosaic-multiselect--chips"}`,
|
|
583
|
+
onBlur: p.onBlur,
|
|
584
|
+
children: [
|
|
585
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { id: p.labelId, className: "mosaic-multiselect-label", children: p.label }),
|
|
586
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row flex-wrap gap-2", children: p.options.map((opt) => {
|
|
587
|
+
const on = p.value.includes(opt.value);
|
|
588
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
589
|
+
"button",
|
|
590
|
+
{
|
|
591
|
+
type: "button",
|
|
592
|
+
"aria-pressed": on,
|
|
593
|
+
disabled: p.disabled || !on && atMax,
|
|
594
|
+
"data-chip-value": opt.value,
|
|
595
|
+
className: `mosaic-multiselect-chip inline-flex items-center rounded-full border px-3 py-1 text-sm ${on ? "border-slate-900 bg-slate-900 text-white" : "border-slate-300 bg-white text-slate-700 hover:bg-slate-50"} disabled:cursor-not-allowed disabled:opacity-50`,
|
|
596
|
+
onClick: () => p.onChange(
|
|
597
|
+
on ? removeValue(p.value, opt.value) : addValue(p.value, opt.value, p.maxItems)
|
|
598
|
+
),
|
|
599
|
+
children: opt.label
|
|
600
|
+
},
|
|
601
|
+
opt.value
|
|
602
|
+
);
|
|
603
|
+
}) })
|
|
604
|
+
]
|
|
605
|
+
}
|
|
606
|
+
);
|
|
607
|
+
}
|
|
556
608
|
function Inner(p) {
|
|
557
609
|
const [open, setOpen] = react.useState(false);
|
|
558
610
|
const [query, setQuery] = react.useState("");
|
|
@@ -763,10 +815,21 @@ function getOptionLabelId(instanceId, name, optionValue) {
|
|
|
763
815
|
function getOptionDescriptionId(instanceId, name, optionValue) {
|
|
764
816
|
return `${instanceId}-${name}-${optionValue}-desc`;
|
|
765
817
|
}
|
|
766
|
-
function getGroupClasses(orientation) {
|
|
818
|
+
function getGroupClasses(orientation, appearance = "default") {
|
|
819
|
+
if (appearance === "segmented") {
|
|
820
|
+
return "inline-flex flex-row overflow-hidden rounded-md border border-slate-300";
|
|
821
|
+
}
|
|
822
|
+
if (appearance === "chips") return "flex flex-row flex-wrap gap-2";
|
|
767
823
|
return orientation === "vertical" ? "flex flex-col gap-2" : "flex flex-row flex-wrap gap-4";
|
|
768
824
|
}
|
|
769
|
-
function getOptionRowClasses(isDisabled, orientation) {
|
|
825
|
+
function getOptionRowClasses(isDisabled, orientation, appearance = "default") {
|
|
826
|
+
const state0 = isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer";
|
|
827
|
+
if (appearance !== "default") {
|
|
828
|
+
return [
|
|
829
|
+
"relative inline-flex items-center focus-within:outline focus-within:outline-2 focus-within:outline-blue-600",
|
|
830
|
+
state0
|
|
831
|
+
].join(" ");
|
|
832
|
+
}
|
|
770
833
|
const base = "flex items-start gap-2";
|
|
771
834
|
const orient = orientation === "vertical" ? "flex-row" : "flex-row";
|
|
772
835
|
const state = isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer";
|
|
@@ -780,6 +843,13 @@ function getRadioControlClasses(isSelected, isDisabled) {
|
|
|
780
843
|
function isActivationKey(key) {
|
|
781
844
|
return key === " " || key === "Space" || key === "Enter";
|
|
782
845
|
}
|
|
846
|
+
function getOptionLabelClasses(appearance, isSelected) {
|
|
847
|
+
if (appearance === "default") return "mosaic-forms-radiogroup-option-label";
|
|
848
|
+
const base = "mosaic-forms-radiogroup-option-label inline-flex items-center px-3 py-1 text-sm";
|
|
849
|
+
const shape = appearance === "chips" ? "rounded-full border" : "";
|
|
850
|
+
const tone = isSelected ? "bg-slate-900 text-white border-slate-900" : "bg-white text-slate-700 border-slate-300 hover:bg-slate-50";
|
|
851
|
+
return [base, shape, tone].filter(Boolean).join(" ");
|
|
852
|
+
}
|
|
783
853
|
var RadioGroupOptionSchema = zod.z.object({
|
|
784
854
|
value: zod.z.string().min(1),
|
|
785
855
|
label: zod.z.string().min(1),
|
|
@@ -791,6 +861,12 @@ var RadioGroupPropsSchema = zod.z.object({
|
|
|
791
861
|
label: zod.z.string().min(1),
|
|
792
862
|
options: zod.z.array(RadioGroupOptionSchema).min(1),
|
|
793
863
|
orientation: zod.z.enum(["vertical", "horizontal"]).default("vertical"),
|
|
864
|
+
/**
|
|
865
|
+
* `segmented` / `chips` render the options as always-visible controls (Claude design
|
|
866
|
+
* guidelines prefer visible options over menus, which clip inside the iframe). The ARIA
|
|
867
|
+
* radiogroup semantics are identical in every appearance.
|
|
868
|
+
*/
|
|
869
|
+
appearance: zod.z.enum(["default", "segmented", "chips"]).default("default"),
|
|
794
870
|
disabled: zod.z.boolean().optional().default(false),
|
|
795
871
|
locale: zod.z.enum(["en", "fr"]).default("en")
|
|
796
872
|
});
|
|
@@ -803,9 +879,10 @@ function RadioGroup(props) {
|
|
|
803
879
|
label: props.label,
|
|
804
880
|
options: props.options,
|
|
805
881
|
orientation: props.orientation,
|
|
806
|
-
disabled: props.disabled
|
|
882
|
+
disabled: props.disabled,
|
|
883
|
+
appearance: props.appearance
|
|
807
884
|
});
|
|
808
|
-
const { name, label, options, orientation, disabled } = validated;
|
|
885
|
+
const { name, label, options, orientation, disabled, appearance } = validated;
|
|
809
886
|
const instanceId = react.useId();
|
|
810
887
|
const groupLabelId = getGroupLabelId(instanceId, name);
|
|
811
888
|
const { prev: prevKey, next: nextKey } = getNavKeys(orientation);
|
|
@@ -860,51 +937,67 @@ function RadioGroup(props) {
|
|
|
860
937
|
"aria-labelledby": groupLabelId,
|
|
861
938
|
"aria-orientation": orientation,
|
|
862
939
|
"aria-disabled": disabled || void 0,
|
|
863
|
-
|
|
940
|
+
"data-appearance": appearance === "default" ? void 0 : appearance,
|
|
941
|
+
className: getGroupClasses(orientation, appearance),
|
|
864
942
|
children: options.map((option, index) => {
|
|
865
943
|
const isSelected = selectedValue === option.value;
|
|
866
944
|
const isDisabled = !!(disabled || option.disabled);
|
|
867
945
|
const optLabelId = getOptionLabelId(instanceId, name, option.value);
|
|
868
946
|
const optDescId = option.description ? getOptionDescriptionId(instanceId, name, option.value) : void 0;
|
|
869
947
|
const tabIdx = index === rovingIdx ? 0 : -1;
|
|
870
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
{
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
948
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
949
|
+
"div",
|
|
950
|
+
{
|
|
951
|
+
className: getOptionRowClasses(isDisabled, orientation, appearance),
|
|
952
|
+
children: [
|
|
953
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
954
|
+
"input",
|
|
955
|
+
{
|
|
956
|
+
ref: (el) => {
|
|
957
|
+
radioRefs.current[index] = el;
|
|
958
|
+
},
|
|
959
|
+
type: "radio",
|
|
960
|
+
id: `${instanceId}-${name}-${option.value}`,
|
|
961
|
+
name: field.name,
|
|
962
|
+
value: option.value,
|
|
963
|
+
checked: isSelected,
|
|
964
|
+
disabled: isDisabled,
|
|
965
|
+
"aria-labelledby": optLabelId,
|
|
966
|
+
"aria-describedby": optDescId,
|
|
967
|
+
tabIndex: isDisabled ? -1 : tabIdx,
|
|
968
|
+
className: "mosaic-forms-radiogroup-input sr-only",
|
|
969
|
+
onChange: () => {
|
|
970
|
+
field.onChange(option.value);
|
|
971
|
+
},
|
|
972
|
+
onKeyDown: (e) => {
|
|
973
|
+
if (!isDisabled) handleKeyDown(e, index);
|
|
974
|
+
},
|
|
975
|
+
onBlur: field.onBlur
|
|
976
|
+
}
|
|
977
|
+
),
|
|
978
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
979
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
980
|
+
"span",
|
|
981
|
+
{
|
|
982
|
+
id: optLabelId,
|
|
983
|
+
"data-selected": isSelected ? "true" : void 0,
|
|
984
|
+
className: getOptionLabelClasses(appearance, isSelected),
|
|
985
|
+
children: option.label
|
|
986
|
+
}
|
|
987
|
+
),
|
|
988
|
+
option.description ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
989
|
+
"span",
|
|
990
|
+
{
|
|
991
|
+
id: optDescId,
|
|
992
|
+
className: "mosaic-forms-radiogroup-option-description text-sm text-slate-500",
|
|
993
|
+
children: option.description
|
|
994
|
+
}
|
|
995
|
+
) : null
|
|
996
|
+
] })
|
|
997
|
+
]
|
|
998
|
+
},
|
|
999
|
+
option.value
|
|
1000
|
+
);
|
|
908
1001
|
})
|
|
909
1002
|
}
|
|
910
1003
|
),
|