@vantageos/mosaic 0.3.1 → 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 +88 -2
- package/LICENSE +110 -0
- package/README.md +193 -21
- 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 +190 -2
- package/dist/artifacts.cjs.map +1 -1
- package/dist/artifacts.js +190 -2
- package/dist/artifacts.js.map +1 -1
- package/dist/confirmation.cjs +728 -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 +726 -4
- package/dist/confirmation.js.map +1 -1
- package/dist/display.cjs +1555 -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 +1539 -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 +2202 -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 +2167 -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 +190 -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 +190 -2
- package/dist/media.js.map +1 -1
- package/dist/preact/artifacts.js +190 -2
- package/dist/preact/artifacts.js.map +1 -1
- package/dist/preact/confirmation.d.ts +321 -1
- package/dist/preact/confirmation.js +629 -4
- package/dist/preact/confirmation.js.map +1 -1
- package/dist/preact/display.d.ts +570 -31
- package/dist/preact/display.js +1248 -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 +469 -3
- package/dist/preact/progress.js.map +1 -1
- package/dist/progress.cjs +525 -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 +522 -3
- package/dist/progress.js.map +1 -1
- package/dist/react/artifacts.cjs +190 -2
- package/dist/react/artifacts.cjs.map +1 -1
- package/dist/react/artifacts.js +190 -2
- package/dist/react/artifacts.js.map +1 -1
- package/dist/react/confirmation.cjs +630 -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 +629 -4
- package/dist/react/confirmation.js.map +1 -1
- package/dist/react/display.cjs +1137 -123
- package/dist/react/display.cjs.map +1 -1
- package/dist/react/display.d.cts +42 -14
- package/dist/react/display.d.ts +42 -14
- package/dist/react/display.js +1122 -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 +471 -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 +469 -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/dist/tokens.cjs +73 -22
- package/dist/tokens.cjs.map +1 -1
- package/dist/tokens.d.cts +23 -3
- package/dist/tokens.d.ts +23 -3
- package/dist/tokens.js +73 -22
- package/dist/tokens.js.map +1 -1
- package/package.json +250 -231
- package/registry.yaml +51 -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/forms.cjs
CHANGED
|
@@ -517,7 +517,9 @@ var MultiSelectPropsSchema = zod.z.object({
|
|
|
517
517
|
placeholder: zod.z.string().optional(),
|
|
518
518
|
disabled: zod.z.boolean().optional(),
|
|
519
519
|
searchable: zod.z.boolean().optional(),
|
|
520
|
-
maxItems: zod.z.number().int().positive().optional()
|
|
520
|
+
maxItems: zod.z.number().int().positive().optional(),
|
|
521
|
+
/** `chips`: every option is a visible toggle button (aria-pressed), no dropdown. */
|
|
522
|
+
appearance: zod.z.enum(["default", "chips"]).default("default")
|
|
521
523
|
});
|
|
522
524
|
function MultiSelect(props) {
|
|
523
525
|
const parsed = MultiSelectPropsSchema.parse({
|
|
@@ -527,15 +529,32 @@ function MultiSelect(props) {
|
|
|
527
529
|
placeholder: props.placeholder,
|
|
528
530
|
disabled: props.disabled,
|
|
529
531
|
searchable: props.searchable,
|
|
530
|
-
maxItems: props.maxItems
|
|
532
|
+
maxItems: props.maxItems,
|
|
533
|
+
appearance: props.appearance
|
|
531
534
|
});
|
|
532
|
-
const { name, label, options, placeholder, disabled, searchable, maxItems } = parsed;
|
|
535
|
+
const { name, label, options, placeholder, disabled, searchable, maxItems, appearance } = parsed;
|
|
533
536
|
const reactId = react.useId();
|
|
534
537
|
const triggerId = `${reactId}-trigger`;
|
|
535
538
|
const listboxId = `${reactId}-listbox`;
|
|
536
539
|
const labelId = `${reactId}-label`;
|
|
537
540
|
return /* @__PURE__ */ jsxRuntime.jsx(FormField, { name, children: ({ field }) => {
|
|
538
541
|
const value = Array.isArray(field.value) ? field.value : [];
|
|
542
|
+
if (appearance === "chips") {
|
|
543
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
544
|
+
ChipToggles,
|
|
545
|
+
{
|
|
546
|
+
labelId,
|
|
547
|
+
label,
|
|
548
|
+
options,
|
|
549
|
+
value,
|
|
550
|
+
disabled,
|
|
551
|
+
maxItems,
|
|
552
|
+
onChange: (next) => field.onChange(next),
|
|
553
|
+
onBlur: () => field.onBlur(),
|
|
554
|
+
className: props.className
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
}
|
|
539
558
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
540
559
|
Inner,
|
|
541
560
|
{
|
|
@@ -556,6 +575,39 @@ function MultiSelect(props) {
|
|
|
556
575
|
);
|
|
557
576
|
} });
|
|
558
577
|
}
|
|
578
|
+
function ChipToggles(p) {
|
|
579
|
+
const atMax = isAtMaxItems(p.value, p.maxItems);
|
|
580
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
581
|
+
"fieldset",
|
|
582
|
+
{
|
|
583
|
+
"aria-labelledby": p.labelId,
|
|
584
|
+
"data-appearance": "chips",
|
|
585
|
+
className: `m-0 min-w-0 border-0 p-0 ${p.className ?? "mosaic-multiselect mosaic-multiselect--chips"}`,
|
|
586
|
+
onBlur: p.onBlur,
|
|
587
|
+
children: [
|
|
588
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { id: p.labelId, className: "mosaic-multiselect-label", children: p.label }),
|
|
589
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row flex-wrap gap-2", children: p.options.map((opt) => {
|
|
590
|
+
const on = p.value.includes(opt.value);
|
|
591
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
592
|
+
"button",
|
|
593
|
+
{
|
|
594
|
+
type: "button",
|
|
595
|
+
"aria-pressed": on,
|
|
596
|
+
disabled: p.disabled || !on && atMax,
|
|
597
|
+
"data-chip-value": opt.value,
|
|
598
|
+
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`,
|
|
599
|
+
onClick: () => p.onChange(
|
|
600
|
+
on ? removeValue(p.value, opt.value) : addValue(p.value, opt.value, p.maxItems)
|
|
601
|
+
),
|
|
602
|
+
children: opt.label
|
|
603
|
+
},
|
|
604
|
+
opt.value
|
|
605
|
+
);
|
|
606
|
+
}) })
|
|
607
|
+
]
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
}
|
|
559
611
|
function Inner(p) {
|
|
560
612
|
const [open, setOpen] = react.useState(false);
|
|
561
613
|
const [query, setQuery] = react.useState("");
|
|
@@ -766,10 +818,21 @@ function getOptionLabelId(instanceId, name, optionValue) {
|
|
|
766
818
|
function getOptionDescriptionId(instanceId, name, optionValue) {
|
|
767
819
|
return `${instanceId}-${name}-${optionValue}-desc`;
|
|
768
820
|
}
|
|
769
|
-
function getGroupClasses(orientation) {
|
|
821
|
+
function getGroupClasses(orientation, appearance = "default") {
|
|
822
|
+
if (appearance === "segmented") {
|
|
823
|
+
return "inline-flex flex-row overflow-hidden rounded-md border border-slate-300";
|
|
824
|
+
}
|
|
825
|
+
if (appearance === "chips") return "flex flex-row flex-wrap gap-2";
|
|
770
826
|
return orientation === "vertical" ? "flex flex-col gap-2" : "flex flex-row flex-wrap gap-4";
|
|
771
827
|
}
|
|
772
|
-
function getOptionRowClasses(isDisabled, orientation) {
|
|
828
|
+
function getOptionRowClasses(isDisabled, orientation, appearance = "default") {
|
|
829
|
+
const state0 = isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer";
|
|
830
|
+
if (appearance !== "default") {
|
|
831
|
+
return [
|
|
832
|
+
"relative inline-flex items-center focus-within:outline focus-within:outline-2 focus-within:outline-blue-600",
|
|
833
|
+
state0
|
|
834
|
+
].join(" ");
|
|
835
|
+
}
|
|
773
836
|
const base = "flex items-start gap-2";
|
|
774
837
|
const orient = orientation === "vertical" ? "flex-row" : "flex-row";
|
|
775
838
|
const state = isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer";
|
|
@@ -783,6 +846,13 @@ function getRadioControlClasses(isSelected, isDisabled) {
|
|
|
783
846
|
function isActivationKey(key) {
|
|
784
847
|
return key === " " || key === "Space" || key === "Enter";
|
|
785
848
|
}
|
|
849
|
+
function getOptionLabelClasses(appearance, isSelected) {
|
|
850
|
+
if (appearance === "default") return "mosaic-forms-radiogroup-option-label";
|
|
851
|
+
const base = "mosaic-forms-radiogroup-option-label inline-flex items-center px-3 py-1 text-sm";
|
|
852
|
+
const shape = appearance === "chips" ? "rounded-full border" : "";
|
|
853
|
+
const tone = isSelected ? "bg-slate-900 text-white border-slate-900" : "bg-white text-slate-700 border-slate-300 hover:bg-slate-50";
|
|
854
|
+
return [base, shape, tone].filter(Boolean).join(" ");
|
|
855
|
+
}
|
|
786
856
|
var RadioGroupOptionSchema = zod.z.object({
|
|
787
857
|
value: zod.z.string().min(1),
|
|
788
858
|
label: zod.z.string().min(1),
|
|
@@ -794,6 +864,12 @@ var RadioGroupPropsSchema = zod.z.object({
|
|
|
794
864
|
label: zod.z.string().min(1),
|
|
795
865
|
options: zod.z.array(RadioGroupOptionSchema).min(1),
|
|
796
866
|
orientation: zod.z.enum(["vertical", "horizontal"]).default("vertical"),
|
|
867
|
+
/**
|
|
868
|
+
* `segmented` / `chips` render the options as always-visible controls (Claude design
|
|
869
|
+
* guidelines prefer visible options over menus, which clip inside the iframe). The ARIA
|
|
870
|
+
* radiogroup semantics are identical in every appearance.
|
|
871
|
+
*/
|
|
872
|
+
appearance: zod.z.enum(["default", "segmented", "chips"]).default("default"),
|
|
797
873
|
disabled: zod.z.boolean().optional().default(false),
|
|
798
874
|
locale: zod.z.enum(["en", "fr"]).default("en")
|
|
799
875
|
});
|
|
@@ -806,9 +882,10 @@ function RadioGroup(props) {
|
|
|
806
882
|
label: props.label,
|
|
807
883
|
options: props.options,
|
|
808
884
|
orientation: props.orientation,
|
|
809
|
-
disabled: props.disabled
|
|
885
|
+
disabled: props.disabled,
|
|
886
|
+
appearance: props.appearance
|
|
810
887
|
});
|
|
811
|
-
const { name, label, options, orientation, disabled } = validated;
|
|
888
|
+
const { name, label, options, orientation, disabled, appearance } = validated;
|
|
812
889
|
const instanceId = react.useId();
|
|
813
890
|
const groupLabelId = getGroupLabelId(instanceId, name);
|
|
814
891
|
const { prev: prevKey, next: nextKey } = getNavKeys(orientation);
|
|
@@ -863,51 +940,67 @@ function RadioGroup(props) {
|
|
|
863
940
|
"aria-labelledby": groupLabelId,
|
|
864
941
|
"aria-orientation": orientation,
|
|
865
942
|
"aria-disabled": disabled || void 0,
|
|
866
|
-
|
|
943
|
+
"data-appearance": appearance === "default" ? void 0 : appearance,
|
|
944
|
+
className: getGroupClasses(orientation, appearance),
|
|
867
945
|
children: options.map((option, index) => {
|
|
868
946
|
const isSelected = selectedValue === option.value;
|
|
869
947
|
const isDisabled = !!(disabled || option.disabled);
|
|
870
948
|
const optLabelId = getOptionLabelId(instanceId, name, option.value);
|
|
871
949
|
const optDescId = option.description ? getOptionDescriptionId(instanceId, name, option.value) : void 0;
|
|
872
950
|
const tabIdx = index === rovingIdx ? 0 : -1;
|
|
873
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
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
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
951
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
952
|
+
"div",
|
|
953
|
+
{
|
|
954
|
+
className: getOptionRowClasses(isDisabled, orientation, appearance),
|
|
955
|
+
children: [
|
|
956
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
957
|
+
"input",
|
|
958
|
+
{
|
|
959
|
+
ref: (el) => {
|
|
960
|
+
radioRefs.current[index] = el;
|
|
961
|
+
},
|
|
962
|
+
type: "radio",
|
|
963
|
+
id: `${instanceId}-${name}-${option.value}`,
|
|
964
|
+
name: field.name,
|
|
965
|
+
value: option.value,
|
|
966
|
+
checked: isSelected,
|
|
967
|
+
disabled: isDisabled,
|
|
968
|
+
"aria-labelledby": optLabelId,
|
|
969
|
+
"aria-describedby": optDescId,
|
|
970
|
+
tabIndex: isDisabled ? -1 : tabIdx,
|
|
971
|
+
className: "mosaic-forms-radiogroup-input sr-only",
|
|
972
|
+
onChange: () => {
|
|
973
|
+
field.onChange(option.value);
|
|
974
|
+
},
|
|
975
|
+
onKeyDown: (e) => {
|
|
976
|
+
if (!isDisabled) handleKeyDown(e, index);
|
|
977
|
+
},
|
|
978
|
+
onBlur: field.onBlur
|
|
979
|
+
}
|
|
980
|
+
),
|
|
981
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
982
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
983
|
+
"span",
|
|
984
|
+
{
|
|
985
|
+
id: optLabelId,
|
|
986
|
+
"data-selected": isSelected ? "true" : void 0,
|
|
987
|
+
className: getOptionLabelClasses(appearance, isSelected),
|
|
988
|
+
children: option.label
|
|
989
|
+
}
|
|
990
|
+
),
|
|
991
|
+
option.description ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
992
|
+
"span",
|
|
993
|
+
{
|
|
994
|
+
id: optDescId,
|
|
995
|
+
className: "mosaic-forms-radiogroup-option-description text-sm text-slate-500",
|
|
996
|
+
children: option.description
|
|
997
|
+
}
|
|
998
|
+
) : null
|
|
999
|
+
] })
|
|
1000
|
+
]
|
|
1001
|
+
},
|
|
1002
|
+
option.value
|
|
1003
|
+
);
|
|
911
1004
|
})
|
|
912
1005
|
}
|
|
913
1006
|
),
|