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