@jsenv/navi 0.7.3 → 0.9.0

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.
@@ -18575,124 +18575,233 @@ const useConstraints = (elementRef, constraints, targetSelector) => {
18575
18575
  }, constraints);
18576
18576
  };
18577
18577
 
18578
+ const FlexDirectionContext = createContext();
18579
+
18578
18580
  /**
18579
- * Merges a component's base style with style received from props.
18580
- * Automatically normalizes style values (e.g., adds "px" units where needed).
18581
- *
18582
- * ```jsx
18583
- * const MyButton = ({ style, children }) => (
18584
- * <button style={withPropsStyle({ padding: 10 }, style)}>
18585
- * {children}
18586
- * </button>
18587
- * );
18581
+ * Layout Style Hook
18588
18582
  *
18589
- * // Usage:
18590
- * <MyButton style={{ color: 'red', fontSize: 14 }} />
18591
- * <MyButton style="color: blue; margin: 5px;" />
18592
- * <MyButton /> // Just base styles
18593
- * ```
18583
+ * This hook processes layout-related props and converts them into CSS styles.
18584
+ * It handles spacing (margin/padding), alignment (alignX/alignY), and expansion behavior.
18585
+ * The hook is context-aware and adapts behavior based on flex direction.
18594
18586
  *
18595
- * @param {string|object} baseStyle - The component's base style (string or object)
18596
- * @param {string|object} [styleFromProps] - Additional style from props (optional)
18597
- * @returns {object} The merged and normalized style object
18587
+ * Key features:
18588
+ * - Spacing: margin/padding with X/Y shortcuts and directional variants
18589
+ * - Alignment: alignX/alignY using align-self and auto margins
18590
+ * - Expansion: expand prop for taking remaining space (flexGrow or width: 100%)
18591
+ * - Context-aware: behavior changes based on FlexDirectionContext (row/column/none)
18598
18592
  */
18599
- const withPropsStyle = (baseStyle, styleFromProps) => {
18600
- return mergeStyles(baseStyle, styleFromProps, "css");
18601
- };
18602
18593
 
18603
- const consumeSpacingProps = props => {
18604
- const style = {};
18594
+
18595
+ /**
18596
+ * Converts layout props into CSS styles
18597
+ * @param {Object} props - Component props containing layout properties
18598
+ * @param {string|number} [props.margin] - All-sides margin
18599
+ * @param {string|number} [props.marginX] - Horizontal margin (left + right)
18600
+ * @param {string|number} [props.marginY] - Vertical margin (top + bottom)
18601
+ * @param {string|number} [props.marginLeft] - Left margin
18602
+ * @param {string|number} [props.marginRight] - Right margin
18603
+ * @param {string|number} [props.marginTop] - Top margin
18604
+ * @param {string|number} [props.marginBottom] - Bottom margin
18605
+ * @param {string|number} [props.padding] - All-sides padding
18606
+ * @param {string|number} [props.paddingX] - Horizontal padding (left + right)
18607
+ * @param {string|number} [props.paddingY] - Vertical padding (top + bottom)
18608
+ * @param {string|number} [props.paddingLeft] - Left padding
18609
+ * @param {string|number} [props.paddingRight] - Right padding
18610
+ * @param {string|number} [props.paddingTop] - Top padding
18611
+ * @param {string|number} [props.paddingBottom] - Bottom padding
18612
+ * @param {"start"|"center"|"end"|"stretch"} [props.alignX] - Horizontal alignment
18613
+ * @param {"start"|"center"|"end"|"stretch"} [props.alignY] - Vertical alignment
18614
+ * @param {boolean} [props.expand] - Whether element should expand to fill available space
18615
+ * @returns {Object} Object with categorized styles: { margin, padding, alignment, expansion, all }
18616
+ */
18617
+ const useLayoutStyle = (props) => {
18618
+ const flexDirection = useContext(FlexDirectionContext);
18619
+
18620
+ const marginStyle = {};
18621
+ const paddingStyle = {};
18622
+ const alignmentStyle = {};
18623
+ const expansionStyle = {};
18624
+
18605
18625
  {
18606
- const margin = props.margin;
18607
- const marginX = props.marginX;
18608
- const marginY = props.marginY;
18609
- const marginLeft = props.marginLeft;
18610
- const marginRight = props.marginRight;
18611
- const marginTop = props.marginTop;
18612
- const marginBottom = props.marginBottom;
18613
- delete props.margin;
18614
- delete props.marginX;
18615
- delete props.marginY;
18616
- delete props.marginLeft;
18617
- delete props.marginRight;
18618
- delete props.marginTop;
18619
- delete props.marginBottom;
18620
- if (margin !== undefined) {
18621
- style.margin = margin;
18622
- }
18623
- if (marginLeft !== undefined) {
18624
- style.marginLeft = marginLeft;
18625
- } else if (marginX !== undefined) {
18626
- style.marginLeft = marginX;
18627
- }
18628
- if (marginRight !== undefined) {
18629
- style.marginRight = marginRight;
18630
- } else if (marginX !== undefined) {
18631
- style.marginRight = marginX;
18632
- }
18633
- if (marginTop !== undefined) {
18634
- style.marginTop = marginTop;
18635
- } else if (marginY !== undefined) {
18636
- style.marginTop = marginY;
18637
- }
18638
- if (marginBottom !== undefined) {
18639
- style.marginBottom = marginBottom;
18640
- } else if (marginY !== undefined) {
18641
- style.marginBottom = marginY;
18626
+ {
18627
+ const margin = props.margin;
18628
+ const marginX = props.marginX;
18629
+ const marginY = props.marginY;
18630
+ const marginLeft = props.marginLeft;
18631
+ const marginRight = props.marginRight;
18632
+ const marginTop = props.marginTop;
18633
+ const marginBottom = props.marginBottom;
18634
+ delete props.margin;
18635
+ delete props.marginX;
18636
+ delete props.marginY;
18637
+ delete props.marginLeft;
18638
+ delete props.marginRight;
18639
+ delete props.marginTop;
18640
+ delete props.marginBottom;
18641
+
18642
+ if (margin !== undefined) {
18643
+ marginStyle.margin = margin;
18644
+ }
18645
+ if (marginLeft !== undefined) {
18646
+ marginStyle.marginLeft = marginLeft;
18647
+ } else if (marginX !== undefined) {
18648
+ marginStyle.marginLeft = marginX;
18649
+ }
18650
+ if (marginRight !== undefined) {
18651
+ marginStyle.marginRight = marginRight;
18652
+ } else if (marginX !== undefined) {
18653
+ marginStyle.marginRight = marginX;
18654
+ }
18655
+ if (marginTop !== undefined) {
18656
+ marginStyle.marginTop = marginTop;
18657
+ } else if (marginY !== undefined) {
18658
+ marginStyle.marginTop = marginY;
18659
+ }
18660
+ if (marginBottom !== undefined) {
18661
+ marginStyle.marginBottom = marginBottom;
18662
+ } else if (marginY !== undefined) {
18663
+ marginStyle.marginBottom = marginY;
18664
+ }
18665
+ }
18666
+ {
18667
+ const padding = props.padding;
18668
+ const paddingX = props.paddingX;
18669
+ const paddingY = props.paddingY;
18670
+ const paddingLeft = props.paddingLeft;
18671
+ const paddingRight = props.paddingRight;
18672
+ const paddingTop = props.paddingTop;
18673
+ const paddingBottom = props.paddingBottom;
18674
+ delete props.padding;
18675
+ delete props.paddingX;
18676
+ delete props.paddingY;
18677
+ delete props.paddingLeft;
18678
+ delete props.paddingRight;
18679
+ delete props.paddingTop;
18680
+ delete props.paddingBottom;
18681
+
18682
+ if (padding !== undefined) {
18683
+ paddingStyle.padding = padding;
18684
+ }
18685
+ if (paddingLeft !== undefined) {
18686
+ paddingStyle.paddingLeft = paddingLeft;
18687
+ } else if (paddingX !== undefined) {
18688
+ paddingStyle.paddingLeft = paddingX;
18689
+ }
18690
+ if (paddingRight !== undefined) {
18691
+ paddingStyle.paddingRight = paddingRight;
18692
+ } else if (paddingX !== undefined) {
18693
+ paddingStyle.paddingRight = paddingX;
18694
+ }
18695
+ if (paddingTop !== undefined) {
18696
+ paddingStyle.paddingTop = paddingTop;
18697
+ } else if (paddingY !== undefined) {
18698
+ paddingStyle.paddingTop = paddingY;
18699
+ }
18700
+ if (paddingBottom !== undefined) {
18701
+ paddingStyle.paddingBottom = paddingBottom;
18702
+ } else if (paddingY !== undefined) {
18703
+ paddingStyle.paddingBottom = paddingY;
18704
+ }
18705
+ }
18706
+ }
18707
+
18708
+ {
18709
+ const alignX = props.alignX;
18710
+ const alignY = props.alignY;
18711
+ delete props.alignX;
18712
+ delete props.alignY;
18713
+
18714
+ // flex
18715
+ if (flexDirection === "row") {
18716
+ // In row direction: alignX controls justify-content, alignY controls align-self
18717
+ if (alignY !== undefined && alignY !== "start") {
18718
+ alignmentStyle.alignSelf = alignY;
18719
+ }
18720
+ // For row, alignX uses auto margins for positioning
18721
+ // NOTE: Auto margins only work effectively for positioning individual items.
18722
+ // When multiple adjacent items have the same auto margin alignment (e.g., alignX="end"),
18723
+ // only the first item will be positioned as expected because subsequent items
18724
+ // will be positioned relative to the previous item's margins, not the container edge.
18725
+ if (alignX !== undefined) {
18726
+ if (alignX === "start") {
18727
+ alignmentStyle.marginRight = "auto";
18728
+ } else if (alignX === "end") {
18729
+ alignmentStyle.marginLeft = "auto";
18730
+ } else if (alignX === "center") {
18731
+ alignmentStyle.marginLeft = "auto";
18732
+ alignmentStyle.marginRight = "auto";
18733
+ }
18734
+ }
18735
+ } else if (flexDirection === "column") {
18736
+ // In column direction: alignX controls align-self, alignY uses auto margins
18737
+ if (alignX !== undefined && alignX !== "start") {
18738
+ alignmentStyle.alignSelf = alignX;
18739
+ }
18740
+ // For column, alignY uses auto margins for positioning
18741
+ // NOTE: Same auto margin limitation applies - multiple adjacent items with
18742
+ // the same alignY won't all position relative to container edges.
18743
+ if (alignY !== undefined) {
18744
+ if (alignY === "start") {
18745
+ alignmentStyle.marginBottom = "auto";
18746
+ } else if (alignY === "end") {
18747
+ alignmentStyle.marginTop = "auto";
18748
+ } else if (alignY === "center") {
18749
+ alignmentStyle.marginTop = "auto";
18750
+ alignmentStyle.marginBottom = "auto";
18751
+ }
18752
+ }
18753
+ }
18754
+ // non flex
18755
+ else {
18756
+ if (alignX === "start") {
18757
+ alignmentStyle.marginRight = "auto";
18758
+ } else if (alignX === "center") {
18759
+ alignmentStyle.marginLeft = "auto";
18760
+ alignmentStyle.marginRight = "auto";
18761
+ } else if (alignX === "end") {
18762
+ alignmentStyle.marginLeft = "auto";
18763
+ }
18764
+
18765
+ if (alignY === "start") {
18766
+ alignmentStyle.marginBottom = "auto";
18767
+ } else if (alignY === "center") {
18768
+ alignmentStyle.marginTop = "auto";
18769
+ alignmentStyle.marginBottom = "auto";
18770
+ } else if (alignY === "end") {
18771
+ alignmentStyle.marginTop = "auto";
18772
+ }
18642
18773
  }
18643
18774
  }
18775
+
18644
18776
  {
18645
- const padding = props.padding;
18646
- const paddingX = props.paddingX;
18647
- const paddingY = props.paddingY;
18648
- const paddingLeft = props.paddingLeft;
18649
- const paddingRight = props.paddingRight;
18650
- const paddingTop = props.paddingTop;
18651
- const paddingBottom = props.paddingBottom;
18652
- delete props.padding;
18653
- delete props.paddingX;
18654
- delete props.paddingY;
18655
- delete props.paddingLeft;
18656
- delete props.paddingRight;
18657
- delete props.paddingTop;
18658
- delete props.paddingBottom;
18659
- if (padding !== undefined) {
18660
- style.padding = padding;
18661
- }
18662
- if (paddingLeft !== undefined) {
18663
- style.paddingLeft = paddingLeft;
18664
- } else if (paddingX !== undefined) {
18665
- style.paddingLeft = paddingX;
18666
- }
18667
- if (paddingRight !== undefined) {
18668
- style.paddingRight = paddingRight;
18669
- } else if (paddingX !== undefined) {
18670
- style.paddingRight = paddingX;
18671
- }
18672
- if (paddingTop !== undefined) {
18673
- style.paddingTop = paddingTop;
18674
- } else if (paddingY !== undefined) {
18675
- style.paddingTop = paddingY;
18676
- }
18677
- if (paddingBottom !== undefined) {
18678
- style.paddingBottom = paddingBottom;
18679
- } else if (paddingY !== undefined) {
18680
- style.paddingBottom = paddingY;
18777
+ const expand = props.expand;
18778
+ delete props.expand;
18779
+ if (expand) {
18780
+ if (flexDirection === "row") {
18781
+ expansionStyle.flexGrow = 1;
18782
+ } else if (flexDirection === "column") {
18783
+ expansionStyle.flexGrow = 1;
18784
+ } else {
18785
+ expansionStyle.width = "100%";
18786
+ }
18681
18787
  }
18682
18788
  }
18683
- return style;
18684
- };
18685
- const Spacing = ({
18686
- style,
18687
- children,
18688
- ...rest
18689
- }) => {
18690
- const styleForSpacing = consumeSpacingProps(rest);
18691
- return jsx("div", {
18692
- ...rest,
18693
- style: withPropsStyle(styleForSpacing, style),
18694
- children: children
18695
- });
18789
+
18790
+ // Merge all styles for convenience
18791
+ const allStyles = {
18792
+ ...marginStyle,
18793
+ ...paddingStyle,
18794
+ ...alignmentStyle,
18795
+ ...expansionStyle,
18796
+ };
18797
+
18798
+ return {
18799
+ margin: marginStyle,
18800
+ padding: paddingStyle,
18801
+ alignment: alignmentStyle,
18802
+ expansion: expansionStyle,
18803
+ all: allStyles,
18804
+ };
18696
18805
  };
18697
18806
 
18698
18807
  const useNetworkSpeed = () => {
@@ -19269,6 +19378,31 @@ const LoaderBackgroundBasic = ({
19269
19378
  });
19270
19379
  };
19271
19380
 
19381
+ /**
19382
+ * Merges a component's base style with style received from props.
19383
+ * Automatically normalizes style values (e.g., adds "px" units where needed).
19384
+ *
19385
+ * ```jsx
19386
+ * const MyButton = ({ style, children }) => (
19387
+ * <button style={withPropsStyle({ padding: 10 }, style)}>
19388
+ * {children}
19389
+ * </button>
19390
+ * );
19391
+ *
19392
+ * // Usage:
19393
+ * <MyButton style={{ color: 'red', fontSize: 14 }} />
19394
+ * <MyButton style="color: blue; margin: 5px;" />
19395
+ * <MyButton /> // Just base styles
19396
+ * ```
19397
+ *
19398
+ * @param {string|object} baseStyle - The component's base style (string or object)
19399
+ * @param {string|object} [styleFromProps] - Additional style from props (optional)
19400
+ * @returns {object} The merged and normalized style object
19401
+ */
19402
+ const withPropsStyle = (baseStyle, styleFromProps) => {
19403
+ return mergeStyles(baseStyle, styleFromProps, "css");
19404
+ };
19405
+
19272
19406
  // autoFocus does not work so we focus in a useLayoutEffect,
19273
19407
  // see https://github.com/preactjs/preact/issues/1255
19274
19408
 
@@ -20246,11 +20380,14 @@ const NaviCheckbox = ({
20246
20380
  useLayoutEffect(() => {
20247
20381
  return initCustomField(ref.current, inputRef.current);
20248
20382
  }, []);
20383
+ const {
20384
+ all
20385
+ } = useLayoutStyle(rest);
20249
20386
  const innerStyle = withPropsStyle({
20387
+ ...all,
20250
20388
  ...(accentColor ? {
20251
20389
  "--accent-color": accentColor
20252
- } : {}),
20253
- ...consumeSpacingProps(rest)
20390
+ } : {})
20254
20391
  }, style);
20255
20392
  return jsxs("div", {
20256
20393
  ...rest,
@@ -20671,11 +20808,14 @@ const NaviRadio = ({
20671
20808
  useLayoutEffect(() => {
20672
20809
  return initCustomField(ref.current, inputRef.current);
20673
20810
  }, []);
20811
+ const {
20812
+ all
20813
+ } = useLayoutStyle(rest);
20674
20814
  const innerStyle = withPropsStyle({
20815
+ ...all,
20675
20816
  ...(accentColor ? {
20676
20817
  "--accent-color": accentColor
20677
- } : {}),
20678
- ...consumeSpacingProps(rest)
20818
+ } : {})
20679
20819
  }, style);
20680
20820
  return jsxs("span", {
20681
20821
  ...rest,
@@ -20795,6 +20935,8 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
20795
20935
  --color: currentColor;
20796
20936
  --color-readonly: color-mix(in srgb, currentColor 60%, transparent);
20797
20937
  --color-disabled: var(--color-readonly);
20938
+
20939
+ width: 100%;
20798
20940
  color: var(--color);
20799
20941
 
20800
20942
  background-color: var(--background-color);
@@ -20873,8 +21015,6 @@ const InputTextualBasic = forwardRef((props, ref) => {
20873
21015
  // visual
20874
21016
  appearance = "navi",
20875
21017
  accentColor,
20876
- width,
20877
- height,
20878
21018
  className,
20879
21019
  style,
20880
21020
  ...rest
@@ -20893,11 +21033,13 @@ const InputTextualBasic = forwardRef((props, ref) => {
20893
21033
  });
20894
21034
  useConstraints(innerRef, constraints);
20895
21035
  const innerClassName = withPropsClassName(appearance === "navi" ? "navi_input" : undefined, className);
20896
- const innerStyle = withPropsStyle({
20897
- width,
20898
- height,
20899
- ...consumeSpacingProps(rest)
20900
- }, style);
21036
+ const {
21037
+ margin,
21038
+ padding,
21039
+ alignment,
21040
+ expansion
21041
+ } = useLayoutStyle(rest);
21042
+ const innerStyle = withPropsStyle(padding, style);
20901
21043
  const inputTextual = jsx("input", {
20902
21044
  ...rest,
20903
21045
  ref: innerRef,
@@ -20942,11 +21084,12 @@ const InputTextualBasic = forwardRef((props, ref) => {
20942
21084
  return jsx(LoadableInlineElement, {
20943
21085
  loading: innerLoading,
20944
21086
  style: {
21087
+ ...margin,
21088
+ ...alignment,
21089
+ ...expansion,
20945
21090
  "--accent-color": accentColor || "light-dark(#355fcc, #4476ff)"
20946
21091
  },
20947
21092
  color: "var(--accent-color)",
20948
- width: width,
20949
- height: height,
20950
21093
  inset: -1,
20951
21094
  children: inputTextual
20952
21095
  });
@@ -21369,153 +21512,6 @@ const Editable = forwardRef((props, ref) => {
21369
21512
  });
21370
21513
  });
21371
21514
 
21372
- installImportMetaCss(import.meta);import.meta.css = /* css */`
21373
- .navi_flex_row {
21374
- display: flex;
21375
- flex-direction: row;
21376
- align-items: center;
21377
- gap: 0;
21378
- }
21379
-
21380
- .navi_flex_column {
21381
- display: flex;
21382
- flex-direction: column;
21383
- align-items: center;
21384
- gap: 0;
21385
- }
21386
-
21387
- .navi_flex_item {
21388
- flex-shrink: 0;
21389
- }
21390
- `;
21391
- const FlexDirectionContext = createContext();
21392
- const FlexRow = ({
21393
- alignY,
21394
- gap,
21395
- style,
21396
- children,
21397
- ...rest
21398
- }) => {
21399
- const innerStyle = withPropsStyle({
21400
- alignItems: alignY,
21401
- gap,
21402
- ...consumeSpacingProps(rest)
21403
- }, style);
21404
- return jsx("div", {
21405
- ...rest,
21406
- className: "navi_flex_row",
21407
- style: innerStyle,
21408
- children: jsx(FlexDirectionContext.Provider, {
21409
- value: "row",
21410
- children: children
21411
- })
21412
- });
21413
- };
21414
- const FlexColumn = ({
21415
- alignX,
21416
- gap,
21417
- style,
21418
- children,
21419
- ...rest
21420
- }) => {
21421
- const innerStyle = withPropsStyle({
21422
- alignItems: alignX,
21423
- gap,
21424
- ...consumeSpacingProps(rest)
21425
- }, style);
21426
- return jsx("div", {
21427
- ...rest,
21428
- className: "navi_flex_column",
21429
- style: innerStyle,
21430
- children: jsx(FlexDirectionContext.Provider, {
21431
- value: "column",
21432
- children: children
21433
- })
21434
- });
21435
- };
21436
- const useConsumAlignProps = props => {
21437
- const flexDirection = useContext(FlexDirectionContext);
21438
- const alignX = props.alignX;
21439
- const alignY = props.alignY;
21440
- delete props.alignX;
21441
- delete props.alignY;
21442
- const style = {};
21443
- if (flexDirection === "row") {
21444
- // In row direction: alignX controls justify-content, alignY controls align-self
21445
- // Default alignY is "center" from CSS, so only set alignSelf when different
21446
- if (alignY !== undefined && alignY !== "center") {
21447
- style.alignSelf = alignY;
21448
- }
21449
- // For row, alignX uses auto margins for positioning
21450
- // NOTE: Auto margins only work effectively for positioning individual items.
21451
- // When multiple adjacent items have the same auto margin alignment (e.g., alignX="end"),
21452
- // only the first item will be positioned as expected because subsequent items
21453
- // will be positioned relative to the previous item's margins, not the container edge.
21454
- if (alignX !== undefined) {
21455
- if (alignX === "start") {
21456
- style.marginRight = "auto";
21457
- } else if (alignX === "end") {
21458
- style.marginLeft = "auto";
21459
- } else if (alignX === "center") {
21460
- style.marginLeft = "auto";
21461
- style.marginRight = "auto";
21462
- }
21463
- }
21464
- } else if (flexDirection === "column") {
21465
- // In column direction: alignX controls align-self, alignY uses auto margins
21466
- // Default alignX is "center" from CSS, so only set alignSelf when different
21467
- if (alignX !== undefined && alignX !== "center") {
21468
- style.alignSelf = alignX;
21469
- }
21470
- // For column, alignY uses auto margins for positioning
21471
- // NOTE: Same auto margin limitation applies - multiple adjacent items with
21472
- // the same alignY won't all position relative to container edges.
21473
- if (alignY !== undefined) {
21474
- if (alignY === "start") {
21475
- style.marginBottom = "auto";
21476
- } else if (alignY === "end") {
21477
- style.marginTop = "auto";
21478
- } else if (alignY === "center") {
21479
- style.marginTop = "auto";
21480
- style.marginBottom = "auto";
21481
- }
21482
- }
21483
- }
21484
- return style;
21485
- };
21486
- const FlexItem = ({
21487
- alignX,
21488
- alignY,
21489
- grow,
21490
- shrink,
21491
- className,
21492
- style,
21493
- children,
21494
- ...rest
21495
- }) => {
21496
- const flexDirection = useContext(FlexDirectionContext);
21497
- if (!flexDirection) {
21498
- console.warn("FlexItem must be used within a FlexRow or FlexColumn component.");
21499
- }
21500
- const innerClassName = withPropsClassName("navi_flex_item", className);
21501
- const alignStyle = useConsumAlignProps({
21502
- alignX,
21503
- alignY
21504
- });
21505
- const innerStyle = withPropsStyle({
21506
- flexGrow: grow ? 1 : undefined,
21507
- flexShrink: shrink ? 1 : undefined,
21508
- ...consumeSpacingProps(rest),
21509
- ...alignStyle
21510
- }, style);
21511
- return jsx("div", {
21512
- ...rest,
21513
- className: innerClassName,
21514
- style: innerStyle,
21515
- children: children
21516
- });
21517
- };
21518
-
21519
21515
  const useFormEvents = (
21520
21516
  elementRef,
21521
21517
  {
@@ -21616,6 +21612,7 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
21616
21612
  .navi_button_content {
21617
21613
  position: relative;
21618
21614
  display: inline-flex;
21615
+ width: 100%;
21619
21616
  padding-top: var(--padding-y);
21620
21617
  padding-right: var(--padding-x);
21621
21618
  padding-bottom: var(--padding-y);
@@ -21737,8 +21734,6 @@ const ButtonBasic = forwardRef((props, ref) => {
21737
21734
  autoFocus,
21738
21735
  // visual
21739
21736
  appearance = "navi",
21740
- alignX,
21741
- alignY,
21742
21737
  discrete,
21743
21738
  className,
21744
21739
  style,
@@ -21762,13 +21757,10 @@ const ButtonBasic = forwardRef((props, ref) => {
21762
21757
  buttonChildren = children;
21763
21758
  }
21764
21759
  const innerClassName = withPropsClassName(appearance === "navi" ? "navi_button" : undefined, className);
21765
- const innerStyle = withPropsStyle({
21766
- ...consumeSpacingProps(rest),
21767
- ...useConsumAlignProps({
21768
- alignX,
21769
- alignY
21770
- })
21771
- }, style);
21760
+ const {
21761
+ all
21762
+ } = useLayoutStyle(rest);
21763
+ const innerStyle = withPropsStyle(all, style);
21772
21764
  return jsx("button", {
21773
21765
  ...rest,
21774
21766
  ref: innerRef,
@@ -24343,7 +24335,6 @@ const LinkBasic = forwardRef((props, ref) => {
24343
24335
  });
24344
24336
  const LinkPlain = forwardRef((props, ref) => {
24345
24337
  const {
24346
- className = "",
24347
24338
  loading,
24348
24339
  readOnly,
24349
24340
  disabled,
@@ -24356,6 +24347,9 @@ const LinkPlain = forwardRef((props, ref) => {
24356
24347
  onClick,
24357
24348
  onKeyDown,
24358
24349
  href,
24350
+ // visual
24351
+ className,
24352
+ style,
24359
24353
  ...rest
24360
24354
  } = props;
24361
24355
  const innerRef = useRef();
@@ -24365,6 +24359,11 @@ const LinkPlain = forwardRef((props, ref) => {
24365
24359
  useConstraints(innerRef, constraints);
24366
24360
  const shouldDimColor = readOnly || disabled;
24367
24361
  useDimColorWhen(innerRef, shouldDimColor);
24362
+ const innerClassName = withPropsClassName("navi_link", className);
24363
+ const {
24364
+ all
24365
+ } = useLayoutStyle(rest);
24366
+ const innerStyle = withPropsStyle(all, style);
24368
24367
  return jsx(LoadableInlineElement, {
24369
24368
  loading: loading,
24370
24369
  color: "light-dark(#355fcc, #3b82f6)",
@@ -24372,7 +24371,8 @@ const LinkPlain = forwardRef((props, ref) => {
24372
24371
  ...rest,
24373
24372
  ref: innerRef,
24374
24373
  href: href,
24375
- className: ["navi_link", ...className.split(" ")].join(" "),
24374
+ className: innerClassName,
24375
+ style: innerStyle,
24376
24376
  "aria-busy": loading,
24377
24377
  inert: disabled,
24378
24378
  "data-field": "",
@@ -28216,23 +28216,17 @@ const Text = ({
28216
28216
  italic,
28217
28217
  underline,
28218
28218
  style,
28219
- alignX,
28220
28219
  ...rest
28221
28220
  }) => {
28221
+ const {
28222
+ all
28223
+ } = useLayoutStyle(rest);
28222
28224
  const innerStyle = withPropsStyle({
28225
+ ...all,
28223
28226
  color,
28224
28227
  fontWeight: bold ? "bold" : undefined,
28225
28228
  fontStyle: italic ? "italic" : undefined,
28226
- textDecoration: underline ? "underline" : undefined,
28227
- ...consumeSpacingProps(rest),
28228
- ...(alignX === "start" ? {} : alignX === "center" ? {
28229
- alignSelf: "center",
28230
- marginLeft: "auto",
28231
- marginRight: "auto"
28232
- } : {
28233
- alignSelf: "end",
28234
- marginLeft: "auto"
28235
- })
28229
+ textDecoration: underline ? "underline" : undefined
28236
28230
  }, style);
28237
28231
  return jsx("span", {
28238
28232
  ...rest,
@@ -28298,6 +28292,129 @@ const TextAndCount = ({
28298
28292
  });
28299
28293
  };
28300
28294
 
28295
+ installImportMetaCss(import.meta);import.meta.css = /* css */`
28296
+ .navi_flex_row {
28297
+ display: flex;
28298
+ flex-direction: row;
28299
+ gap: 0;
28300
+ }
28301
+
28302
+ .navi_flex_column {
28303
+ display: flex;
28304
+ flex-direction: column;
28305
+ gap: 0;
28306
+ }
28307
+
28308
+ .navi_flex_item {
28309
+ flex-shrink: 0;
28310
+ }
28311
+ `;
28312
+ const FlexRow = ({
28313
+ alignX,
28314
+ alignY,
28315
+ gap,
28316
+ style,
28317
+ children,
28318
+ ...rest
28319
+ }) => {
28320
+ const {
28321
+ all
28322
+ } = useLayoutStyle(rest);
28323
+ const innerStyle = withPropsStyle({
28324
+ ...all,
28325
+ // Only set justifyContent if it's not the default "start"
28326
+ justifyContent: alignX !== "start" ? alignX : undefined,
28327
+ // Only set alignItems if it's not the default "stretch"
28328
+ alignItems: alignY !== "stretch" ? alignY : undefined,
28329
+ gap
28330
+ }, style);
28331
+ return jsx("div", {
28332
+ ...rest,
28333
+ className: "navi_flex_row",
28334
+ style: innerStyle,
28335
+ children: jsx(FlexDirectionContext.Provider, {
28336
+ value: "row",
28337
+ children: children
28338
+ })
28339
+ });
28340
+ };
28341
+ const FlexColumn = ({
28342
+ alignX,
28343
+ alignY,
28344
+ gap,
28345
+ style,
28346
+ children,
28347
+ ...rest
28348
+ }) => {
28349
+ const {
28350
+ all
28351
+ } = useLayoutStyle(rest);
28352
+ const innerStyle = withPropsStyle({
28353
+ ...all,
28354
+ // Only set alignItems if it's not the default "stretch"
28355
+ alignItems: alignX !== "stretch" ? alignX : undefined,
28356
+ // Only set justifyContent if it's not the default "start"
28357
+ justifyContent: alignY !== "start" ? alignY : undefined,
28358
+ gap
28359
+ }, style);
28360
+ return jsx("div", {
28361
+ ...rest,
28362
+ className: "navi_flex_column",
28363
+ style: innerStyle,
28364
+ children: jsx(FlexDirectionContext.Provider, {
28365
+ value: "column",
28366
+ children: children
28367
+ })
28368
+ });
28369
+ };
28370
+ const FlexItem = ({
28371
+ shrink,
28372
+ className,
28373
+ expand,
28374
+ style,
28375
+ children,
28376
+ ...rest
28377
+ }) => {
28378
+ const flexDirection = useContext(FlexDirectionContext);
28379
+ if (!flexDirection) {
28380
+ console.warn("FlexItem must be used within a FlexRow or FlexColumn component.");
28381
+ }
28382
+ const innerClassName = withPropsClassName("navi_flex_item", className);
28383
+ const {
28384
+ all
28385
+ } = useLayoutStyle(rest);
28386
+ const innerStyle = withPropsStyle({
28387
+ ...all,
28388
+ flexGrow: expand ? 1 : undefined,
28389
+ flexShrink: shrink ? 1 : undefined
28390
+ }, style);
28391
+ return jsx("div", {
28392
+ ...rest,
28393
+ className: innerClassName,
28394
+ style: innerStyle,
28395
+ children: children
28396
+ });
28397
+ };
28398
+
28399
+ const Spacing = ({
28400
+ style,
28401
+ children,
28402
+ ...rest
28403
+ }) => {
28404
+ const {
28405
+ padding,
28406
+ margin
28407
+ } = useLayoutStyle(rest);
28408
+ return jsx("div", {
28409
+ ...rest,
28410
+ style: withPropsStyle({
28411
+ ...margin,
28412
+ ...padding
28413
+ }, style),
28414
+ children: children
28415
+ });
28416
+ };
28417
+
28301
28418
  const createUniqueValueConstraint = (
28302
28419
  // the set might be incomplete (the front usually don't have the full copy of all the items from the backend)
28303
28420
  // but this is already nice to help user with what we know