@salemcobalt/ui 0.2.0-rc.17 → 0.2.0-rc.19

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/dist/index.d.ts CHANGED
@@ -1013,8 +1013,11 @@ declare function Item({ icon, trailing, tone, className, children, ...rest }: Me
1013
1013
  interface MenuLinkItemProps extends Omit<Menu$1.LinkItem.Props, 'className'>, ItemSlots {
1014
1014
  className?: string | undefined;
1015
1015
  }
1016
- /** An item that navigates: renders an `<a href>`. */
1017
- declare function LinkItem({ icon, trailing, tone, className, children, ...rest }: MenuLinkItemProps): react.JSX.Element;
1016
+ /**
1017
+ * An item that navigates: renders an `<a href>`. Closes the menu when chosen, like `Menu.Item`: with client-side
1018
+ * routing the page stays mounted, so an open menu would sit over the new page. Pass `closeOnClick={false}` to keep it.
1019
+ */
1020
+ declare function LinkItem({ icon, trailing, tone, className, closeOnClick, children, ...rest }: MenuLinkItemProps): react.JSX.Element;
1018
1021
  interface MenuCheckboxItemProps extends Omit<Menu$1.CheckboxItem.Props, 'className' | 'onCheckedChange'> {
1019
1022
  /** Called with the next checked state. */
1020
1023
  onCheckedChange?: ((checked: boolean) => void) | undefined;
@@ -2974,6 +2977,7 @@ interface WordDiffPart {
2974
2977
  }
2975
2978
  type WordDiffElement = 'p' | 'div' | 'span';
2976
2979
  type WordDiffSize = 'sm' | 'md';
2980
+ type WordDiffFamily = 'sans' | 'mono';
2977
2981
  interface WordDiffProps extends Omit<ComponentPropsWithRef<'p'>, 'children'> {
2978
2982
  /** Runs of unchanged, removed and added text, in reading order, whitespace included. Rendered exactly: joining every `text` gives the visible string. */
2979
2983
  parts: readonly WordDiffPart[];
@@ -2981,6 +2985,11 @@ interface WordDiffProps extends Omit<ComponentPropsWithRef<'p'>, 'children'> {
2981
2985
  as?: WordDiffElement | undefined;
2982
2986
  /** `sm` 14px UI text (default) or `md` body copy. */
2983
2987
  size?: WordDiffSize | undefined;
2988
+ /**
2989
+ * `sans` prose (default), or `mono` for code and structured text (YAML, JSON, Markdown source): the mono face, no
2990
+ * reading-measure cap, and marks without side padding so columns stay aligned.
2991
+ */
2992
+ family?: WordDiffFamily | undefined;
2984
2993
  /** Screen reader word around added text: "[added: …]". Default "added". */
2985
2994
  addedLabel?: string | undefined;
2986
2995
  /** Screen reader word around removed text: "[removed: …]". Default "removed". */
@@ -2991,7 +3000,7 @@ interface WordDiffProps extends Omit<ComponentPropsWithRef<'p'>, 'children'> {
2991
3000
  * `<del>` and `<ins>` with "[removed: …]" / "[added: …]" for screen readers. The line, not the colour, carries the
2992
3001
  * meaning. Whitespace is preserved exactly (`white-space: pre-wrap`).
2993
3002
  */
2994
- declare function WordDiff({ parts, as, size, addedLabel, removedLabel, className, ...rest }: WordDiffProps): react.DetailedReactHTMLElement<{
3003
+ declare function WordDiff({ parts, as, size, family, addedLabel, removedLabel, className, ...rest }: WordDiffProps): react.DetailedReactHTMLElement<{
2995
3004
  slot?: string | undefined | undefined;
2996
3005
  style?: react.CSSProperties | undefined;
2997
3006
  title?: string | undefined | undefined;
@@ -3272,6 +3281,7 @@ declare function WordDiff({ parts, as, size, addedLabel, removedLabel, className
3272
3281
  onTransitionRunCapture?: react.TransitionEventHandler<HTMLParagraphElement> | undefined;
3273
3282
  onTransitionStart?: react.TransitionEventHandler<HTMLParagraphElement> | undefined;
3274
3283
  onTransitionStartCapture?: react.TransitionEventHandler<HTMLParagraphElement> | undefined;
3284
+ 'data-family'?: string;
3275
3285
  className: string;
3276
3286
  'data-size': WordDiffSize;
3277
3287
  }, HTMLParagraphElement>;
package/dist/index.js CHANGED
@@ -710,8 +710,25 @@ function ItemBody({
710
710
  function Item({ icon, trailing, tone = "default", className, children, ...rest }) {
711
711
  return /* @__PURE__ */ jsx9(BaseMenu.Item, { className: cx("sc-menu__item", className), "data-tone": tone, ...rest, children: /* @__PURE__ */ jsx9(ItemBody, { icon, trailing, children }) });
712
712
  }
713
- function LinkItem({ icon, trailing, tone = "default", className, children, ...rest }) {
714
- return /* @__PURE__ */ jsx9(BaseMenu.LinkItem, { className: cx("sc-menu__item", className), "data-tone": tone, ...rest, children: /* @__PURE__ */ jsx9(ItemBody, { icon, trailing, children }) });
713
+ function LinkItem({
714
+ icon,
715
+ trailing,
716
+ tone = "default",
717
+ className,
718
+ closeOnClick = true,
719
+ children,
720
+ ...rest
721
+ }) {
722
+ return /* @__PURE__ */ jsx9(
723
+ BaseMenu.LinkItem,
724
+ {
725
+ className: cx("sc-menu__item", className),
726
+ "data-tone": tone,
727
+ closeOnClick,
728
+ ...rest,
729
+ children: /* @__PURE__ */ jsx9(ItemBody, { icon, trailing, children })
730
+ }
731
+ );
715
732
  }
716
733
  function CheckboxItem({ trailing, onCheckedChange, className, children, ...rest }) {
717
734
  return /* @__PURE__ */ jsxs8(
@@ -3585,6 +3602,7 @@ function WordDiff({
3585
3602
  parts,
3586
3603
  as = "p",
3587
3604
  size = "sm",
3605
+ family = "sans",
3588
3606
  addedLabel = "added",
3589
3607
  removedLabel = "removed",
3590
3608
  className,
@@ -3603,7 +3621,12 @@ function WordDiff({
3603
3621
  );
3604
3622
  return createElement7(
3605
3623
  as,
3606
- { className: cx("sc-word-diff", className), "data-size": size, ...rest },
3624
+ {
3625
+ className: cx("sc-word-diff", className),
3626
+ "data-size": size,
3627
+ ...family === "mono" ? { "data-family": "mono" } : {},
3628
+ ...rest
3629
+ },
3607
3630
  children
3608
3631
  );
3609
3632
  }