@jsenv/navi 0.26.0 → 0.26.2

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.
@@ -6287,6 +6287,7 @@ const FLOW_PROPS = {
6287
6287
  flex: () => {},
6288
6288
  grid: () => {},
6289
6289
  gridTemplateColumns: PASS_THROUGH,
6290
+ display: PASS_THROUGH, // in case people write "display: none" (even if hidden prop is recommended)
6290
6291
  row: () => {},
6291
6292
  column: () => {},
6292
6293
  };
@@ -6835,9 +6836,9 @@ const TYPO_SIZE_MAP = {
6835
6836
  xxl: "var(--navi-typo-xxl)",
6836
6837
  };
6837
6838
  Object.assign(TYPO_SIZE_MAP, negativeEntries(TYPO_SIZE_MAP));
6838
- const sizeSpacingScaleKeys = new Set(Object.keys(SIZE_MAP));
6839
- const isSizeSpacingScaleKey = (key) => {
6840
- return sizeSpacingScaleKeys.has(key);
6839
+ const sizeSpacingKeySet = new Set(Object.keys(SIZE_MAP));
6840
+ const isSizeSpacingKey = (key) => {
6841
+ return sizeSpacingKeySet.has(key);
6841
6842
  };
6842
6843
  const resolveSpacingSize = (size, property = "padding") => {
6843
6844
  return stringifyStyle(SIZE_MAP[size] || size, property);
@@ -8223,6 +8224,19 @@ import.meta.css = [/* css */`
8223
8224
  grid-auto-flow: unset;
8224
8225
  }
8225
8226
  }
8227
+ /*
8228
+
8229
+ It's very common to declare a display on component as follow
8230
+ .component_class { display: component_display; }
8231
+
8232
+ This kill the default behavior of [hidden] attribute and we need to explicitly handle it with:
8233
+ .component_class[hidden] { display: none; }
8234
+
8235
+ To avoid this extra work and potential mistakes we force the default behavior of [hidden] attribute.
8236
+ */
8237
+ [hidden] {
8238
+ display: none !important;
8239
+ }
8226
8240
  `, "@jsenv/navi/src/box/box.jsx"];
8227
8241
  const PSEUDO_CLASSES_DEFAULT = [];
8228
8242
  const PSEUDO_ELEMENTS_DEFAULT = [];
@@ -20948,6 +20962,13 @@ const CustomWidthSpace = ({
20948
20962
  useRealSpaceChar
20949
20963
  }) => {
20950
20964
  if (useRealSpaceChar) {
20965
+ // Two-span trick: we want a real space character in the DOM so that
20966
+ // copy-pasting the text produces an actual space, but we also want
20967
+ // full control over the visual width of that gap.
20968
+ // - First span: contains the real space but rendered at font-size:0 so it
20969
+ // takes up zero visual space.
20970
+ // - Second span: a zero-width joiner (​) with padding-left set to
20971
+ // the desired gap size. This is the only visible part.
20951
20972
  return jsxs("span", {
20952
20973
  children: [jsx("span", {
20953
20974
  style: "font-size: 0",
@@ -20980,7 +21001,13 @@ const applySpacingOnTextChildren = (children, spacing, defaultSpace) => {
20980
21001
  if (spacing === REGULAR_SPACE || spacing === FAKE_SPACE) {
20981
21002
  separator = defaultSpace;
20982
21003
  } else if (typeof spacing === "string") {
20983
- if (isSizeSpacingScaleKey(spacing) || hasCSSSizeUnit(spacing) || spacing.startsWith("var(")) {
21004
+ if (isSizeSpacingKey(spacing)) {
21005
+ const value = resolveSpacingSize(spacing);
21006
+ separator = jsx(CustomWidthSpace, {
21007
+ value: value,
21008
+ useRealSpaceChar: useRealSpaceChar
21009
+ });
21010
+ } else if (hasCSSSizeUnit(spacing) || spacing.startsWith("var(")) {
20984
21011
  separator = jsx(CustomWidthSpace, {
20985
21012
  value: spacing,
20986
21013
  useRealSpaceChar: useRealSpaceChar
@@ -22768,7 +22795,9 @@ const ButtonDispatcher = props => {
22768
22795
  });
22769
22796
  };
22770
22797
  const ButtonUI = props => {
22798
+ import.meta.css = [css$x, "@jsenv/navi/src/field/button.jsx"];
22771
22799
  const {
22800
+ ref,
22772
22801
  readOnly,
22773
22802
  disabled,
22774
22803
  loading,
@@ -22785,13 +22814,10 @@ const ButtonUI = props => {
22785
22814
  children,
22786
22815
  ...rest
22787
22816
  } = props;
22788
- import.meta.css = [css$x, "@jsenv/navi/src/field/button.jsx"];
22789
22817
  const contextLoading = useContext(LoadingContext);
22790
22818
  const contextLoadingElement = useContext(LoadingElementContext);
22791
22819
  const contextReadOnly = useContext(ReadOnlyContext);
22792
22820
  const contextDisabled = useContext(DisabledContext);
22793
- const defaultRef = useRef();
22794
- const ref = props.ref || defaultRef;
22795
22821
  useAutoFocus(ref, autoFocus);
22796
22822
  const remainingProps = useConstraints(ref, rest);
22797
22823
  const innerLoading = loading || contextLoading && contextLoadingElement === ref.current;
@@ -22825,6 +22851,7 @@ const ButtonUI = props => {
22825
22851
  return jsxs(Box, {
22826
22852
  "data-readonly-silent": innerLoading ? "" : undefined,
22827
22853
  ...remainingProps,
22854
+ ref: ref,
22828
22855
  autFocus: undefined // See use_auto_focus.js
22829
22856
  ,
22830
22857
 
@@ -22832,7 +22859,6 @@ const ButtonUI = props => {
22832
22859
  href: href,
22833
22860
  target: innerTarget,
22834
22861
  rel: innerRel,
22835
- ref: ref,
22836
22862
  onContextMenu: e => {
22837
22863
  if (as === "a") {
22838
22864
  // For link we keep context menu to allow "open in new tab" and other browser features
@@ -27212,9 +27238,6 @@ const css$l = /* css */`
27212
27238
  cursor: not-allowed;
27213
27239
  pointer-events: none;
27214
27240
  }
27215
- &[hidden] {
27216
- display: none;
27217
- }
27218
27241
  }
27219
27242
 
27220
27243
  .navi_list_container {
@@ -27290,9 +27313,6 @@ const css$l = /* css */`
27290
27313
  text-align: center;
27291
27314
  user-select: none;
27292
27315
  }
27293
- &[hidden] {
27294
- display: none;
27295
- }
27296
27316
  }
27297
27317
  [navi-virtual-filler="bottom"] {
27298
27318
  /* for some reason preact ends up puttin this element before the list items in some scenarios
@@ -30974,7 +30994,7 @@ installImportMetaCssBuild(import.meta);const css$f = /* css */`
30974
30994
 
30975
30995
  &[hidden] {
30976
30996
  /* We keep placeholder in the dom in case it dictates the select width, this way select wont shrink once a value is selected */
30977
- display: inline-block;
30997
+ display: inline-block !important;
30978
30998
  height: 0;
30979
30999
  padding-block: 0;
30980
31000
  visibility: hidden;