@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.
Files changed (150) hide show
  1. package/CHANGELOG.md +39 -15
  2. package/README.md +114 -5
  3. package/dist/PipelineBoard-FucyGArR.d.cts +759 -0
  4. package/dist/PipelineBoard-FucyGArR.d.ts +759 -0
  5. package/dist/PipelineBoard.markdown-DIcvrS-2.d.cts +16 -0
  6. package/dist/PipelineBoard.markdown-DIcvrS-2.d.ts +16 -0
  7. package/dist/{StatusBadge.schema-1tOjB4Ir.d.cts → StatusBadge.schema-BEjSH2_4.d.cts} +2 -2
  8. package/dist/{StatusBadge.schema-1tOjB4Ir.d.ts → StatusBadge.schema-BEjSH2_4.d.ts} +2 -2
  9. package/dist/{Tabs.schema-BzcEyeq8.d.cts → Tabs.schema-Dqr6vwV3.d.cts} +2 -2
  10. package/dist/{Tabs.schema-BzcEyeq8.d.ts → Tabs.schema-Dqr6vwV3.d.ts} +2 -2
  11. package/dist/Timeline-Coo_3tA_.d.cts +114 -0
  12. package/dist/Timeline-Coo_3tA_.d.ts +114 -0
  13. package/dist/Timeline.markdown-C6UPDv1H.d.cts +4 -0
  14. package/dist/Timeline.markdown-C6UPDv1H.d.ts +4 -0
  15. package/dist/TransactionPreview-BzWDn8kE.d.cts +391 -0
  16. package/dist/TransactionPreview-BzWDn8kE.d.ts +391 -0
  17. package/dist/TransactionPreview.markdown-Dpb0VYgN.d.cts +7 -0
  18. package/dist/TransactionPreview.markdown-Dpb0VYgN.d.ts +7 -0
  19. package/dist/artifacts.cjs +186 -2
  20. package/dist/artifacts.cjs.map +1 -1
  21. package/dist/artifacts.js +186 -2
  22. package/dist/artifacts.js.map +1 -1
  23. package/dist/confirmation.cjs +724 -2
  24. package/dist/confirmation.cjs.map +1 -1
  25. package/dist/confirmation.d.cts +2 -1
  26. package/dist/confirmation.d.ts +2 -1
  27. package/dist/confirmation.js +722 -4
  28. package/dist/confirmation.js.map +1 -1
  29. package/dist/display.cjs +1551 -203
  30. package/dist/display.cjs.map +1 -1
  31. package/dist/display.d.cts +6 -229
  32. package/dist/display.d.ts +6 -229
  33. package/dist/display.js +1535 -206
  34. package/dist/display.js.map +1 -1
  35. package/dist/forms.cjs +139 -46
  36. package/dist/forms.cjs.map +1 -1
  37. package/dist/forms.d.cts +2 -2
  38. package/dist/forms.d.ts +2 -2
  39. package/dist/forms.js +139 -46
  40. package/dist/forms.js.map +1 -1
  41. package/dist/host.cjs +822 -0
  42. package/dist/host.cjs.map +1 -0
  43. package/dist/host.d.cts +287 -0
  44. package/dist/host.d.ts +287 -0
  45. package/dist/host.js +794 -0
  46. package/dist/host.js.map +1 -0
  47. package/dist/{index-CwXVgtGb.d.cts → index-BadRcCbm.d.cts} +28 -11
  48. package/dist/{index-CwXVgtGb.d.ts → index-BadRcCbm.d.ts} +28 -11
  49. package/dist/index.cjs +2198 -247
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.d.cts +42 -8
  52. package/dist/index.d.ts +42 -8
  53. package/dist/index.js +2163 -251
  54. package/dist/index.js.map +1 -1
  55. package/dist/input.d.cts +2 -2
  56. package/dist/input.d.ts +2 -2
  57. package/dist/media.cjs +186 -2
  58. package/dist/media.cjs.map +1 -1
  59. package/dist/media.d.cts +1 -1
  60. package/dist/media.d.ts +1 -1
  61. package/dist/media.js +186 -2
  62. package/dist/media.js.map +1 -1
  63. package/dist/preact/artifacts.js +186 -2
  64. package/dist/preact/artifacts.js.map +1 -1
  65. package/dist/preact/confirmation.d.ts +321 -1
  66. package/dist/preact/confirmation.js +625 -4
  67. package/dist/preact/confirmation.js.map +1 -1
  68. package/dist/preact/display.d.ts +544 -47
  69. package/dist/preact/display.js +1190 -126
  70. package/dist/preact/display.js.map +1 -1
  71. package/dist/preact/forms.d.ts +32 -15
  72. package/dist/preact/forms.js +139 -46
  73. package/dist/preact/forms.js.map +1 -1
  74. package/dist/preact/host.d.ts +307 -0
  75. package/dist/preact/host.js +875 -0
  76. package/dist/preact/host.js.map +1 -0
  77. package/dist/preact/media.d.ts +37 -1
  78. package/dist/preact/media.js +423 -0
  79. package/dist/preact/media.js.map +1 -1
  80. package/dist/preact/progress.d.ts +92 -1
  81. package/dist/preact/progress.js +465 -3
  82. package/dist/preact/progress.js.map +1 -1
  83. package/dist/progress.cjs +521 -2
  84. package/dist/progress.cjs.map +1 -1
  85. package/dist/progress.d.cts +2 -1
  86. package/dist/progress.d.ts +2 -1
  87. package/dist/progress.js +518 -3
  88. package/dist/progress.js.map +1 -1
  89. package/dist/react/artifacts.cjs +186 -2
  90. package/dist/react/artifacts.cjs.map +1 -1
  91. package/dist/react/artifacts.js +186 -2
  92. package/dist/react/artifacts.js.map +1 -1
  93. package/dist/react/confirmation.cjs +626 -2
  94. package/dist/react/confirmation.cjs.map +1 -1
  95. package/dist/react/confirmation.d.cts +3 -3
  96. package/dist/react/confirmation.d.ts +3 -3
  97. package/dist/react/confirmation.js +625 -4
  98. package/dist/react/confirmation.js.map +1 -1
  99. package/dist/react/display.cjs +1076 -123
  100. package/dist/react/display.cjs.map +1 -1
  101. package/dist/react/display.d.cts +13 -27
  102. package/dist/react/display.d.ts +13 -27
  103. package/dist/react/display.js +1064 -126
  104. package/dist/react/display.js.map +1 -1
  105. package/dist/react/forms.cjs +139 -46
  106. package/dist/react/forms.cjs.map +1 -1
  107. package/dist/react/forms.d.cts +1 -1
  108. package/dist/react/forms.d.ts +1 -1
  109. package/dist/react/forms.js +139 -46
  110. package/dist/react/forms.js.map +1 -1
  111. package/dist/react/host.cjs +910 -0
  112. package/dist/react/host.cjs.map +1 -0
  113. package/dist/react/host.d.cts +24 -0
  114. package/dist/react/host.d.ts +24 -0
  115. package/dist/react/host.js +875 -0
  116. package/dist/react/host.js.map +1 -0
  117. package/dist/react/input.d.cts +1 -1
  118. package/dist/react/input.d.ts +1 -1
  119. package/dist/react/media.cjs +426 -0
  120. package/dist/react/media.cjs.map +1 -1
  121. package/dist/react/media.d.cts +19 -1
  122. package/dist/react/media.d.ts +19 -1
  123. package/dist/react/media.js +423 -0
  124. package/dist/react/media.js.map +1 -1
  125. package/dist/react/progress.cjs +467 -2
  126. package/dist/react/progress.cjs.map +1 -1
  127. package/dist/react/progress.d.cts +1 -1
  128. package/dist/react/progress.d.ts +1 -1
  129. package/dist/react/progress.js +465 -3
  130. package/dist/react/progress.js.map +1 -1
  131. package/dist/server/resource.cjs +151 -0
  132. package/dist/server/resource.cjs.map +1 -0
  133. package/dist/server/resource.d.cts +90 -0
  134. package/dist/server/resource.d.ts +90 -0
  135. package/dist/server/resource.js +147 -0
  136. package/dist/server/resource.js.map +1 -0
  137. package/dist/server.cjs +1100 -25
  138. package/dist/server.cjs.map +1 -1
  139. package/dist/server.d.cts +84 -5
  140. package/dist/server.d.ts +84 -5
  141. package/dist/server.js +1087 -27
  142. package/dist/server.js.map +1 -1
  143. package/package.json +250 -233
  144. package/registry.yaml +44 -2
  145. package/dist/Alert.schema-LPJE5gFP.d.cts +0 -71
  146. package/dist/Alert.schema-LPJE5gFP.d.ts +0 -71
  147. package/dist/ProgressBar.schema-CdVYx0Wq.d.cts +0 -22
  148. package/dist/ProgressBar.schema-CdVYx0Wq.d.ts +0 -22
  149. package/dist/{ConfirmDialog-B3CQQGmJ.d.cts → ConfirmDialog-BCtOcmHe.d.cts} +1 -1
  150. package/dist/{ConfirmDialog-B3CQQGmJ.d.ts → ConfirmDialog-BCtOcmHe.d.ts} +1 -1
@@ -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
- className: getGroupClasses(orientation),
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("div", { className: getOptionRowClasses(isDisabled, orientation), children: [
871
- /* @__PURE__ */ jsxRuntime.jsx(
872
- "input",
873
- {
874
- ref: (el) => {
875
- radioRefs.current[index] = el;
876
- },
877
- type: "radio",
878
- id: `${instanceId}-${name}-${option.value}`,
879
- name: field.name,
880
- value: option.value,
881
- checked: isSelected,
882
- disabled: isDisabled,
883
- "aria-labelledby": optLabelId,
884
- "aria-describedby": optDescId,
885
- tabIndex: isDisabled ? -1 : tabIdx,
886
- className: "mosaic-forms-radiogroup-input sr-only",
887
- onChange: () => {
888
- field.onChange(option.value);
889
- },
890
- onKeyDown: (e) => {
891
- if (!isDisabled) handleKeyDown(e, index);
892
- },
893
- onBlur: field.onBlur
894
- }
895
- ),
896
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5", children: [
897
- /* @__PURE__ */ jsxRuntime.jsx("span", { id: optLabelId, className: "mosaic-forms-radiogroup-option-label", children: option.label }),
898
- option.description ? /* @__PURE__ */ jsxRuntime.jsx(
899
- "span",
900
- {
901
- id: optDescId,
902
- className: "mosaic-forms-radiogroup-option-description text-sm text-slate-500",
903
- children: option.description
904
- }
905
- ) : null
906
- ] })
907
- ] }, option.value);
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
  ),