@jsenv/navi 0.14.18 → 0.14.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.
@@ -4729,6 +4729,12 @@ const INNER_SPACING_PROPS = {
4729
4729
  paddingX: applyOnTwoCSSProps("paddingLeft", "paddingRight"),
4730
4730
  paddingY: applyOnTwoCSSProps("paddingTop", "paddingBottom"),
4731
4731
  };
4732
+ const hasWidthHeight = (context) => {
4733
+ return (
4734
+ (context.styles.width || context.remainingProps.width) &&
4735
+ (context.styles.height || context.remainingProps.height)
4736
+ );
4737
+ };
4732
4738
  const DIMENSION_PROPS = {
4733
4739
  width: PASS_THROUGH,
4734
4740
  minWidth: PASS_THROUGH,
@@ -4736,20 +4742,24 @@ const DIMENSION_PROPS = {
4736
4742
  height: PASS_THROUGH,
4737
4743
  minHeight: PASS_THROUGH,
4738
4744
  maxHeight: PASS_THROUGH,
4739
- square: (v) => {
4745
+ square: (v, context) => {
4740
4746
  if (!v) {
4741
4747
  return null;
4742
4748
  }
4749
+ if (hasWidthHeight(context)) {
4750
+ // width/height are defined, remove aspect ratio, we explicitely allow rectanglular shapes
4751
+ return null;
4752
+ }
4743
4753
  return {
4744
4754
  aspectRatio: "1/1",
4745
4755
  };
4746
4756
  },
4747
- circle: (v) => {
4757
+ circle: (v, context) => {
4748
4758
  if (!v) {
4749
4759
  return null;
4750
4760
  }
4751
4761
  return {
4752
- aspectRatio: "1/1",
4762
+ aspectRatio: hasWidthHeight(context) ? undefined : "1/1",
4753
4763
  borderRadius: "100%",
4754
4764
  };
4755
4765
  },
@@ -14667,10 +14677,15 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
14667
14677
  .navi_icon {
14668
14678
  display: inline-block;
14669
14679
  box-sizing: border-box;
14670
- width: 1em;
14671
14680
  max-width: 100%;
14672
- height: 1em;
14673
14681
  max-height: 100%;
14682
+
14683
+ &[data-flow-inline] {
14684
+ width: 1em;
14685
+ width: 1lh;
14686
+ height: 1em;
14687
+ height: 1lh;
14688
+ }
14674
14689
  }
14675
14690
 
14676
14691
  .navi_icon[data-interactive] {
@@ -14710,18 +14725,18 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
14710
14725
  height: 100%;
14711
14726
  backface-visibility: hidden;
14712
14727
  }
14713
- .navi_icon[data-width] > svg,
14714
- .navi_icon[data-width] > img {
14728
+ .navi_icon[data-has-width] > svg,
14729
+ .navi_icon[data-has-width] > img {
14715
14730
  width: 100%;
14716
14731
  height: auto;
14717
14732
  }
14718
- .navi_icon[data-height] > svg,
14719
- .navi_icon[data-height] > img {
14733
+ .navi_icon[data-has-height] > svg,
14734
+ .navi_icon[data-has-height] > img {
14720
14735
  width: auto;
14721
14736
  height: 100%;
14722
14737
  }
14723
- .navi_icon[data-width][data-height] > svg,
14724
- .navi_icon[data-width][data-height] > img {
14738
+ .navi_icon[data-has-width][data-has-height] > svg,
14739
+ .navi_icon[data-has-width][data-has-height] > img {
14725
14740
  width: 100%;
14726
14741
  height: 100%;
14727
14742
  }
@@ -14760,7 +14775,11 @@ const Icon = ({
14760
14775
  width,
14761
14776
  height
14762
14777
  } = props;
14763
- if (width === undefined && height === undefined) {
14778
+ if (width === "auto") width = undefined;
14779
+ if (height === "auto") height = undefined;
14780
+ const hasExplicitWidth = width !== undefined;
14781
+ const hasExplicitHeight = height !== undefined;
14782
+ if (!hasExplicitWidth && !hasExplicitHeight) {
14764
14783
  if (decorative === undefined) {
14765
14784
  decorative = true;
14766
14785
  }
@@ -14772,12 +14791,13 @@ const Icon = ({
14772
14791
  } : {};
14773
14792
  if (box) {
14774
14793
  return jsx(Box, {
14794
+ square: true,
14775
14795
  ...props,
14776
14796
  ...ariaProps,
14777
14797
  box: box,
14778
14798
  baseClassName: "navi_icon",
14779
- "data-width": width,
14780
- "data-height": height,
14799
+ "data-has-width": hasExplicitWidth ? "" : undefined,
14800
+ "data-has-height": hasExplicitHeight ? "" : undefined,
14781
14801
  "data-interactive": onClick ? "" : undefined,
14782
14802
  onClick: onClick,
14783
14803
  children: innerChildren
@@ -14785,13 +14805,14 @@ const Icon = ({
14785
14805
  }
14786
14806
  const invisibleText = baseChar.repeat(charWidth);
14787
14807
  return jsxs(Text, {
14808
+ square: true,
14788
14809
  ...props,
14789
14810
  ...ariaProps,
14790
14811
  className: withPropsClassName("navi_icon", className),
14791
14812
  spacing: "pre",
14792
14813
  "data-icon-char": "",
14793
- "data-width": width,
14794
- "data-height": height,
14814
+ "data-has-width": hasExplicitWidth ? "" : undefined,
14815
+ "data-has-height": hasExplicitHeight ? "" : undefined,
14795
14816
  "data-interactive": onClick ? "" : undefined,
14796
14817
  onClick: onClick,
14797
14818
  children: [jsx("span", {