@jsenv/navi 0.11.8 → 0.11.11

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.
@@ -9802,14 +9802,24 @@ const FlexDirectionContext = createContext();
9802
9802
  */
9803
9803
  const withPropsStyle = (
9804
9804
  props,
9805
- { base, layout, spacing = layout, align = layout, expansion = layout, typo },
9805
+ {
9806
+ base,
9807
+ layout,
9808
+ spacing = layout,
9809
+ align = layout,
9810
+ size = layout,
9811
+ typo,
9812
+ visual = true,
9813
+ },
9806
9814
  ...remainingConfig
9807
9815
  ) => {
9808
9816
  const flexDirection = useContext(FlexDirectionContext);
9809
9817
  const {
9810
9818
  // style from props
9811
9819
  style,
9820
+
9812
9821
  // layout props
9822
+ // layout/spacing
9813
9823
  margin,
9814
9824
  marginX,
9815
9825
  marginY,
@@ -9824,11 +9834,16 @@ const withPropsStyle = (
9824
9834
  paddingRight,
9825
9835
  paddingTop,
9826
9836
  paddingBottom,
9837
+ // layout/alignment
9827
9838
  alignX,
9828
9839
  alignY,
9840
+ // layout/size
9829
9841
  expand,
9830
9842
  expandX = expand,
9831
9843
  expandY = expand,
9844
+ width,
9845
+ height,
9846
+
9832
9847
  // typo props
9833
9848
  textSize,
9834
9849
  textBold,
@@ -9838,18 +9853,44 @@ const withPropsStyle = (
9838
9853
  textUnderlineStyle,
9839
9854
  textUnderlineColor,
9840
9855
  textColor,
9856
+ textShadow,
9857
+
9858
+ // visual props
9859
+ boxShadow,
9860
+ background,
9861
+ backgroundColor,
9862
+ backgroundImage,
9863
+ border,
9864
+ borderWidth,
9865
+ borderRadius,
9866
+ borderColor,
9867
+ borderStyle,
9868
+ borderTop,
9869
+ borderLeft,
9870
+ borderRight,
9871
+ borderBottom,
9872
+ opacity,
9873
+ filter,
9874
+
9841
9875
  // props not related to styling
9842
9876
  ...remainingProps
9843
9877
  } = props;
9844
9878
 
9845
9879
  const hasRemainingConfig = remainingConfig.length > 0;
9880
+ let propStyles;
9846
9881
  let marginStyles;
9847
9882
  let paddingStyles;
9848
9883
  let alignmentStyles;
9849
- let expansionStyles;
9884
+ let sizeStyles;
9850
9885
  let typoStyles;
9851
- let propStyles;
9886
+ let visualStyles;
9852
9887
 
9888
+ props_styles: {
9889
+ if (!style && !hasRemainingConfig) {
9890
+ break props_styles;
9891
+ }
9892
+ propStyles = style ? normalizeStyles(style, "css") : {};
9893
+ }
9853
9894
  spacing_styles: {
9854
9895
  if (!spacing && !hasRemainingConfig) {
9855
9896
  break spacing_styles;
@@ -9978,28 +10019,32 @@ const withPropsStyle = (
9978
10019
  }
9979
10020
  }
9980
10021
  }
9981
- expansion_styles: {
9982
- if (!expansion && !hasRemainingConfig) {
9983
- break expansion_styles;
10022
+ size_styles: {
10023
+ if (!size && !hasRemainingConfig) {
10024
+ break size_styles;
9984
10025
  }
9985
- expansionStyles = {};
10026
+ sizeStyles = {};
9986
10027
  if (expandX) {
9987
10028
  if (flexDirection === "row") {
9988
- expansionStyles.flexGrow = 1; // Grow horizontally in row
10029
+ sizeStyles.flexGrow = 1; // Grow horizontally in row
9989
10030
  } else if (flexDirection === "column") {
9990
- expansionStyles.width = "100%"; // Take full width in column
10031
+ sizeStyles.width = "100%"; // Take full width in column
9991
10032
  } else {
9992
- expansionStyles.width = "100%"; // Take full width outside flex
10033
+ sizeStyles.width = "100%"; // Take full width outside flex
9993
10034
  }
10035
+ } else if (width !== undefined) {
10036
+ sizeStyles.width = width;
9994
10037
  }
9995
10038
  if (expandY) {
9996
10039
  if (flexDirection === "row") {
9997
- expansionStyles.height = "100%"; // Take full height in row
10040
+ sizeStyles.height = "100%"; // Take full height in row
9998
10041
  } else if (flexDirection === "column") {
9999
- expansionStyles.flexGrow = 1; // Grow vertically in column
10042
+ sizeStyles.flexGrow = 1; // Grow vertically in column
10000
10043
  } else {
10001
- expansionStyles.height = "100%"; // Take full height outside flex
10044
+ sizeStyles.height = "100%"; // Take full height outside flex
10002
10045
  }
10046
+ } else if (height !== undefined) {
10047
+ sizeStyles.height = height;
10003
10048
  }
10004
10049
  }
10005
10050
  typo_styles: {
@@ -10038,13 +10083,62 @@ const withPropsStyle = (
10038
10083
  if (textUnderlineColor) {
10039
10084
  typoStyles.textDecorationColor = textUnderlineColor;
10040
10085
  }
10086
+ if (textShadow) {
10087
+ typoStyles.textShadow = textShadow;
10088
+ }
10041
10089
  typoStyles.color = textColor;
10042
10090
  }
10043
- props_styles: {
10044
- if (!style && !hasRemainingConfig) {
10045
- break props_styles;
10091
+ visual_styles: {
10092
+ if (!visual && !hasRemainingConfig) {
10093
+ break visual_styles;
10094
+ }
10095
+ visualStyles = {};
10096
+ if (boxShadow !== undefined) {
10097
+ visualStyles.boxShadow = boxShadow;
10098
+ }
10099
+ if (background !== undefined) {
10100
+ visualStyles.background = background;
10101
+ }
10102
+ if (backgroundColor !== undefined) {
10103
+ visualStyles.backgroundColor = backgroundColor;
10104
+ }
10105
+ if (backgroundImage !== undefined) {
10106
+ visualStyles.backgroundImage = backgroundImage;
10107
+ }
10108
+ if (border !== undefined) {
10109
+ visualStyles.border = border;
10110
+ }
10111
+ if (borderTop !== undefined) {
10112
+ visualStyles.borderTop = borderTop;
10113
+ }
10114
+ if (borderLeft !== undefined) {
10115
+ visualStyles.borderLeft = borderLeft;
10116
+ }
10117
+ if (borderRight !== undefined) {
10118
+ visualStyles.borderRight = borderRight;
10119
+ }
10120
+ if (borderBottom !== undefined) {
10121
+ visualStyles.borderBottom = borderBottom;
10122
+ }
10123
+ if (borderWidth !== undefined) {
10124
+ visualStyles.borderWidth = sizeSpacingScale[borderWidth] || borderWidth;
10125
+ }
10126
+ if (borderRadius !== undefined) {
10127
+ visualStyles.borderRadius =
10128
+ sizeSpacingScale[borderRadius] || borderRadius;
10129
+ }
10130
+ if (borderColor !== undefined) {
10131
+ visualStyles.borderColor = borderColor;
10132
+ }
10133
+ if (borderStyle !== undefined) {
10134
+ visualStyles.borderStyle = borderStyle;
10135
+ }
10136
+ if (opacity !== undefined) {
10137
+ visualStyles.opacity = opacity;
10138
+ }
10139
+ if (filter !== undefined) {
10140
+ visualStyles.filter = filter;
10046
10141
  }
10047
- propStyles = style ? normalizeStyles(style, "css") : {};
10048
10142
  }
10049
10143
 
10050
10144
  const firstConfigStyle = {};
@@ -10057,12 +10151,15 @@ const withPropsStyle = (
10057
10151
  if (align) {
10058
10152
  Object.assign(firstConfigStyle, alignmentStyles);
10059
10153
  }
10060
- if (expansion) {
10061
- Object.assign(firstConfigStyle, expansionStyles);
10154
+ if (size) {
10155
+ Object.assign(firstConfigStyle, sizeStyles);
10062
10156
  }
10063
10157
  if (typo) {
10064
10158
  Object.assign(firstConfigStyle, typoStyles);
10065
10159
  }
10160
+ if (visual) {
10161
+ Object.assign(firstConfigStyle, visualStyles);
10162
+ }
10066
10163
  if (style) {
10067
10164
  appendStyles(firstConfigStyle, propStyles, "css");
10068
10165
  }
@@ -10081,12 +10178,15 @@ const withPropsStyle = (
10081
10178
  if (config.align || config.layout) {
10082
10179
  Object.assign(configStyle, alignmentStyles);
10083
10180
  }
10084
- if (config.expansion || config.layout) {
10085
- Object.assign(configStyle, expansionStyles);
10181
+ if (config.size || config.layout) {
10182
+ Object.assign(configStyle, sizeStyles);
10086
10183
  }
10087
10184
  if (config.typo) {
10088
10185
  Object.assign(configStyle, typoStyles);
10089
10186
  }
10187
+ if (config.visual || config.visual === undefined) {
10188
+ Object.assign(configStyle, visualStyles);
10189
+ }
10090
10190
  if (config.style) {
10091
10191
  appendStyles(configStyle, propStyles, "css");
10092
10192
  }
@@ -13758,7 +13858,8 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
13758
13858
  );
13759
13859
 
13760
13860
  --color: currentColor;
13761
- --color-readonly: color-mix(in srgb, currentColor 60%, transparent);
13861
+ --color-dimmed: color-mix(in srgb, currentColor 60%, transparent);
13862
+ --color-readonly: var(--color-dimmed);
13762
13863
  --color-disabled: var(--color-readonly);
13763
13864
 
13764
13865
  width: 100%;
@@ -13775,6 +13876,15 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
13775
13876
  outline-color: var(--border-color);
13776
13877
  outline-offset: calc(-1 * (var(--border-width)));
13777
13878
  }
13879
+ .navi_input::placeholder {
13880
+ color: var(--color-dimmed);
13881
+ }
13882
+ .navi_input:-internal-autofill-selected {
13883
+ /* Webkit is putting some nasty styles after automplete that look as follow */
13884
+ /* input:-internal-autofill-selected { color: FieldText !important; } */
13885
+ /* Fortunately we can override it as follow */
13886
+ -webkit-text-fill-color: var(--color) !important;
13887
+ }
13778
13888
  /* Focus */
13779
13889
  .navi_input[data-focus] {
13780
13890
  border-color: var(--outline-color);
@@ -13784,16 +13894,13 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
13784
13894
  }
13785
13895
  /* Readonly */
13786
13896
  .navi_input[data-readonly] {
13787
- color: var(--color-readonly);
13897
+ --color: var(--color-readonly);
13788
13898
  background-color: var(--background-color-readonly);
13789
13899
  outline-color: var(--border-color-readonly);
13790
13900
  }
13791
- .navi_input[data-readonly]::placeholder {
13792
- color: var(--color-readonly);
13793
- }
13794
13901
  /* Disabled */
13795
13902
  .navi_input[data-disabled] {
13796
- color: var(--color-disabled);
13903
+ --color: var(--color-disabled);
13797
13904
  background-color: var(--background-color-disabled);
13798
13905
  outline-color: var(--border-color-disabled);
13799
13906
  }
@@ -19205,8 +19312,8 @@ const Title = ({
19205
19312
  as = "h1",
19206
19313
  ...rest
19207
19314
  }) => {
19208
- if (rest.bold === undefined) {
19209
- rest.bold = true;
19315
+ if (rest.textBold === undefined) {
19316
+ rest.textBold = true;
19210
19317
  }
19211
19318
  const [remainingProps, innerStyle] = withPropsStyle(rest, {
19212
19319
  layout: true,
@@ -19238,25 +19345,27 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
19238
19345
  }
19239
19346
  `;
19240
19347
  const FlexRow = ({
19348
+ className,
19241
19349
  alignX,
19242
19350
  alignY,
19243
19351
  gap,
19244
19352
  children,
19245
19353
  ...rest
19246
19354
  }) => {
19355
+ const innerClassName = withPropsClassName("navi_flex_row", className);
19247
19356
  const [remainingProps, innerStyle] = withPropsStyle(rest, {
19248
19357
  base: {
19249
19358
  // Only set justifyContent if it's not the default "start"
19250
19359
  justifyContent: alignX !== "start" ? alignX : undefined,
19251
19360
  // Only set alignItems if it's not the default "stretch"
19252
19361
  alignItems: alignY !== "stretch" ? alignY : undefined,
19253
- gap
19362
+ gap: sizeSpacingScale[gap] || gap
19254
19363
  },
19255
19364
  layout: true
19256
19365
  });
19257
19366
  return jsx("div", {
19258
19367
  ...remainingProps,
19259
- className: "navi_flex_row",
19368
+ className: innerClassName,
19260
19369
  style: innerStyle,
19261
19370
  children: jsx(FlexDirectionContext.Provider, {
19262
19371
  value: "row",
@@ -19265,12 +19374,14 @@ const FlexRow = ({
19265
19374
  });
19266
19375
  };
19267
19376
  const FlexColumn = ({
19377
+ className,
19268
19378
  alignX,
19269
19379
  alignY,
19270
19380
  gap,
19271
19381
  children,
19272
19382
  ...rest
19273
19383
  }) => {
19384
+ const innerClassName = withPropsClassName("navi_flex_column", className);
19274
19385
  const [remainingProps, innerStyle] = withPropsStyle(rest, {
19275
19386
  base: {
19276
19387
  // Only set alignItems if it's not the default "stretch"
@@ -19278,11 +19389,12 @@ const FlexColumn = ({
19278
19389
  // Only set justifyContent if it's not the default "start"
19279
19390
  justifyContent: alignY !== "start" ? alignY : undefined,
19280
19391
  gap: sizeSpacingScale[gap] || gap
19281
- }
19392
+ },
19393
+ layout: true
19282
19394
  });
19283
19395
  return jsx("div", {
19284
19396
  ...remainingProps,
19285
- className: "navi_flex_column",
19397
+ className: innerClassName,
19286
19398
  style: innerStyle,
19287
19399
  children: jsx(FlexDirectionContext.Provider, {
19288
19400
  value: "column",
@@ -19322,7 +19434,8 @@ const Spacing = ({
19322
19434
  ...rest
19323
19435
  }) => {
19324
19436
  const [remainingProps, innerStyle] = withPropsStyle(rest, {
19325
- spacing: true
19437
+ spacing: true,
19438
+ visual: true
19326
19439
  });
19327
19440
  return jsx("div", {
19328
19441
  ...remainingProps,