@jsenv/navi 0.14.17 → 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
  },
@@ -5096,7 +5106,14 @@ const getNormalizer = (key) => {
5096
5106
  if (group === "typo") {
5097
5107
  return normalizeTypoStyle;
5098
5108
  }
5099
- return stringifyStyle;
5109
+ return normalizeRegularStyle;
5110
+ };
5111
+ const normalizeRegularStyle = (
5112
+ value,
5113
+ name,
5114
+ // styleContext, context
5115
+ ) => {
5116
+ return stringifyStyle(value, name);
5100
5117
  };
5101
5118
  const getHowToHandleStyleProp = (name) => {
5102
5119
  const getStyle = All_PROPS[name];
@@ -14660,10 +14677,15 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
14660
14677
  .navi_icon {
14661
14678
  display: inline-block;
14662
14679
  box-sizing: border-box;
14663
- width: 1em;
14664
14680
  max-width: 100%;
14665
- height: 1em;
14666
14681
  max-height: 100%;
14682
+
14683
+ &[data-flow-inline] {
14684
+ width: 1em;
14685
+ width: 1lh;
14686
+ height: 1em;
14687
+ height: 1lh;
14688
+ }
14667
14689
  }
14668
14690
 
14669
14691
  .navi_icon[data-interactive] {
@@ -14703,18 +14725,18 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
14703
14725
  height: 100%;
14704
14726
  backface-visibility: hidden;
14705
14727
  }
14706
- .navi_icon[data-width] > svg,
14707
- .navi_icon[data-width] > img {
14728
+ .navi_icon[data-has-width] > svg,
14729
+ .navi_icon[data-has-width] > img {
14708
14730
  width: 100%;
14709
14731
  height: auto;
14710
14732
  }
14711
- .navi_icon[data-height] > svg,
14712
- .navi_icon[data-height] > img {
14733
+ .navi_icon[data-has-height] > svg,
14734
+ .navi_icon[data-has-height] > img {
14713
14735
  width: auto;
14714
14736
  height: 100%;
14715
14737
  }
14716
- .navi_icon[data-width][data-height] > svg,
14717
- .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 {
14718
14740
  width: 100%;
14719
14741
  height: 100%;
14720
14742
  }
@@ -14753,7 +14775,11 @@ const Icon = ({
14753
14775
  width,
14754
14776
  height
14755
14777
  } = props;
14756
- 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) {
14757
14783
  if (decorative === undefined) {
14758
14784
  decorative = true;
14759
14785
  }
@@ -14765,12 +14791,13 @@ const Icon = ({
14765
14791
  } : {};
14766
14792
  if (box) {
14767
14793
  return jsx(Box, {
14794
+ square: true,
14768
14795
  ...props,
14769
14796
  ...ariaProps,
14770
14797
  box: box,
14771
14798
  baseClassName: "navi_icon",
14772
- "data-width": width,
14773
- "data-height": height,
14799
+ "data-has-width": hasExplicitWidth ? "" : undefined,
14800
+ "data-has-height": hasExplicitHeight ? "" : undefined,
14774
14801
  "data-interactive": onClick ? "" : undefined,
14775
14802
  onClick: onClick,
14776
14803
  children: innerChildren
@@ -14778,13 +14805,14 @@ const Icon = ({
14778
14805
  }
14779
14806
  const invisibleText = baseChar.repeat(charWidth);
14780
14807
  return jsxs(Text, {
14808
+ square: true,
14781
14809
  ...props,
14782
14810
  ...ariaProps,
14783
14811
  className: withPropsClassName("navi_icon", className),
14784
14812
  spacing: "pre",
14785
14813
  "data-icon-char": "",
14786
- "data-width": width,
14787
- "data-height": height,
14814
+ "data-has-width": hasExplicitWidth ? "" : undefined,
14815
+ "data-has-height": hasExplicitHeight ? "" : undefined,
14788
14816
  "data-interactive": onClick ? "" : undefined,
14789
14817
  onClick: onClick,
14790
14818
  children: [jsx("span", {