@jsenv/navi 0.8.0 → 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.
- package/dist/jsenv_navi.js +406 -293
- package/package.json +1 -1
- package/src/components/field/button.jsx +4 -11
- package/src/components/field/input_checkbox.jsx +3 -2
- package/src/components/field/input_radio.jsx +3 -2
- package/src/components/field/input_textual.jsx +8 -13
- package/src/components/layout/demos/demo_use_layout_style.html +226 -0
- package/src/components/layout/demos/demo_use_layout_style_buttons.html +260 -0
- package/src/components/layout/demos/demo_use_layout_style_text.html +514 -0
- package/src/components/layout/flex.jsx +10 -64
- package/src/components/layout/layout_context.jsx +3 -0
- package/src/components/layout/spacing.jsx +12 -90
- package/src/components/layout/use_layout_style.js +229 -0
- package/src/components/link/link.jsx +13 -2
- package/src/components/text/text.jsx +3 -15
package/dist/jsenv_navi.js
CHANGED
|
@@ -18575,124 +18575,233 @@ const useConstraints = (elementRef, constraints, targetSelector) => {
|
|
|
18575
18575
|
}, constraints);
|
|
18576
18576
|
};
|
|
18577
18577
|
|
|
18578
|
+
const FlexDirectionContext = createContext();
|
|
18579
|
+
|
|
18578
18580
|
/**
|
|
18579
|
-
*
|
|
18580
|
-
* Automatically normalizes style values (e.g., adds "px" units where needed).
|
|
18581
|
+
* Layout Style Hook
|
|
18581
18582
|
*
|
|
18582
|
-
*
|
|
18583
|
-
*
|
|
18584
|
-
*
|
|
18585
|
-
* {children}
|
|
18586
|
-
* </button>
|
|
18587
|
-
* );
|
|
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.
|
|
18588
18586
|
*
|
|
18589
|
-
*
|
|
18590
|
-
*
|
|
18591
|
-
*
|
|
18592
|
-
*
|
|
18593
|
-
*
|
|
18594
|
-
*
|
|
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
|
-
|
|
18604
|
-
|
|
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
|
-
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
|
|
18610
|
-
|
|
18611
|
-
|
|
18612
|
-
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18616
|
-
|
|
18617
|
-
|
|
18618
|
-
|
|
18619
|
-
|
|
18620
|
-
|
|
18621
|
-
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18633
|
-
|
|
18634
|
-
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
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
|
|
18646
|
-
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
|
|
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
|
-
|
|
18684
|
-
|
|
18685
|
-
const
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
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
|
|
20897
|
-
|
|
20898
|
-
|
|
20899
|
-
|
|
20900
|
-
|
|
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,157 +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
|
-
gap: 0;
|
|
21377
|
-
}
|
|
21378
|
-
|
|
21379
|
-
.navi_flex_column {
|
|
21380
|
-
display: flex;
|
|
21381
|
-
flex-direction: column;
|
|
21382
|
-
gap: 0;
|
|
21383
|
-
}
|
|
21384
|
-
|
|
21385
|
-
.navi_flex_item {
|
|
21386
|
-
flex-shrink: 0;
|
|
21387
|
-
}
|
|
21388
|
-
`;
|
|
21389
|
-
const FlexDirectionContext = createContext();
|
|
21390
|
-
const FlexRow = ({
|
|
21391
|
-
alignX,
|
|
21392
|
-
alignY,
|
|
21393
|
-
gap,
|
|
21394
|
-
style,
|
|
21395
|
-
children,
|
|
21396
|
-
...rest
|
|
21397
|
-
}) => {
|
|
21398
|
-
const innerStyle = withPropsStyle({
|
|
21399
|
-
// Only set justifyContent if it's not the default "start"
|
|
21400
|
-
justifyContent: alignX !== "start" ? alignX : undefined,
|
|
21401
|
-
// Only set alignItems if it's not the default "stretch"
|
|
21402
|
-
alignItems: alignY !== "stretch" ? alignY : undefined,
|
|
21403
|
-
gap,
|
|
21404
|
-
...consumeSpacingProps(rest)
|
|
21405
|
-
}, style);
|
|
21406
|
-
return jsx("div", {
|
|
21407
|
-
...rest,
|
|
21408
|
-
className: "navi_flex_row",
|
|
21409
|
-
style: innerStyle,
|
|
21410
|
-
children: jsx(FlexDirectionContext.Provider, {
|
|
21411
|
-
value: "row",
|
|
21412
|
-
children: children
|
|
21413
|
-
})
|
|
21414
|
-
});
|
|
21415
|
-
};
|
|
21416
|
-
const FlexColumn = ({
|
|
21417
|
-
alignX,
|
|
21418
|
-
alignY,
|
|
21419
|
-
gap,
|
|
21420
|
-
style,
|
|
21421
|
-
children,
|
|
21422
|
-
...rest
|
|
21423
|
-
}) => {
|
|
21424
|
-
const innerStyle = withPropsStyle({
|
|
21425
|
-
// Only set alignItems if it's not the default "stretch"
|
|
21426
|
-
alignItems: alignX !== "stretch" ? alignX : undefined,
|
|
21427
|
-
// Only set justifyContent if it's not the default "start"
|
|
21428
|
-
justifyContent: alignY !== "start" ? alignY : undefined,
|
|
21429
|
-
gap,
|
|
21430
|
-
...consumeSpacingProps(rest)
|
|
21431
|
-
}, style);
|
|
21432
|
-
return jsx("div", {
|
|
21433
|
-
...rest,
|
|
21434
|
-
className: "navi_flex_column",
|
|
21435
|
-
style: innerStyle,
|
|
21436
|
-
children: jsx(FlexDirectionContext.Provider, {
|
|
21437
|
-
value: "column",
|
|
21438
|
-
children: children
|
|
21439
|
-
})
|
|
21440
|
-
});
|
|
21441
|
-
};
|
|
21442
|
-
const useConsumAlignProps = props => {
|
|
21443
|
-
const flexDirection = useContext(FlexDirectionContext);
|
|
21444
|
-
const alignX = props.alignX;
|
|
21445
|
-
const alignY = props.alignY;
|
|
21446
|
-
delete props.alignX;
|
|
21447
|
-
delete props.alignY;
|
|
21448
|
-
const style = {};
|
|
21449
|
-
if (flexDirection === "row") {
|
|
21450
|
-
// In row direction: alignX controls justify-content, alignY controls align-self
|
|
21451
|
-
if (alignY !== undefined && alignY !== "start") {
|
|
21452
|
-
style.alignSelf = alignY;
|
|
21453
|
-
}
|
|
21454
|
-
// For row, alignX uses auto margins for positioning
|
|
21455
|
-
// NOTE: Auto margins only work effectively for positioning individual items.
|
|
21456
|
-
// When multiple adjacent items have the same auto margin alignment (e.g., alignX="end"),
|
|
21457
|
-
// only the first item will be positioned as expected because subsequent items
|
|
21458
|
-
// will be positioned relative to the previous item's margins, not the container edge.
|
|
21459
|
-
if (alignX !== undefined) {
|
|
21460
|
-
if (alignX === "start") {
|
|
21461
|
-
style.marginRight = "auto";
|
|
21462
|
-
} else if (alignX === "end") {
|
|
21463
|
-
style.marginLeft = "auto";
|
|
21464
|
-
} else if (alignX === "center") {
|
|
21465
|
-
style.marginLeft = "auto";
|
|
21466
|
-
style.marginRight = "auto";
|
|
21467
|
-
}
|
|
21468
|
-
}
|
|
21469
|
-
} else if (flexDirection === "column") {
|
|
21470
|
-
// In column direction: alignX controls align-self, alignY uses auto margins
|
|
21471
|
-
if (alignX !== undefined && alignX !== "start") {
|
|
21472
|
-
style.alignSelf = alignX;
|
|
21473
|
-
}
|
|
21474
|
-
// For column, alignY uses auto margins for positioning
|
|
21475
|
-
// NOTE: Same auto margin limitation applies - multiple adjacent items with
|
|
21476
|
-
// the same alignY won't all position relative to container edges.
|
|
21477
|
-
if (alignY !== undefined) {
|
|
21478
|
-
if (alignY === "start") {
|
|
21479
|
-
style.marginBottom = "auto";
|
|
21480
|
-
} else if (alignY === "end") {
|
|
21481
|
-
style.marginTop = "auto";
|
|
21482
|
-
} else if (alignY === "center") {
|
|
21483
|
-
style.marginTop = "auto";
|
|
21484
|
-
style.marginBottom = "auto";
|
|
21485
|
-
}
|
|
21486
|
-
}
|
|
21487
|
-
}
|
|
21488
|
-
return style;
|
|
21489
|
-
};
|
|
21490
|
-
const FlexItem = ({
|
|
21491
|
-
alignX,
|
|
21492
|
-
alignY,
|
|
21493
|
-
grow,
|
|
21494
|
-
shrink,
|
|
21495
|
-
className,
|
|
21496
|
-
style,
|
|
21497
|
-
children,
|
|
21498
|
-
...rest
|
|
21499
|
-
}) => {
|
|
21500
|
-
const flexDirection = useContext(FlexDirectionContext);
|
|
21501
|
-
if (!flexDirection) {
|
|
21502
|
-
console.warn("FlexItem must be used within a FlexRow or FlexColumn component.");
|
|
21503
|
-
}
|
|
21504
|
-
const innerClassName = withPropsClassName("navi_flex_item", className);
|
|
21505
|
-
const alignStyle = useConsumAlignProps({
|
|
21506
|
-
alignX,
|
|
21507
|
-
alignY
|
|
21508
|
-
});
|
|
21509
|
-
const innerStyle = withPropsStyle({
|
|
21510
|
-
flexGrow: grow ? 1 : undefined,
|
|
21511
|
-
flexShrink: shrink ? 1 : undefined,
|
|
21512
|
-
...consumeSpacingProps(rest),
|
|
21513
|
-
...alignStyle
|
|
21514
|
-
}, style);
|
|
21515
|
-
return jsx("div", {
|
|
21516
|
-
...rest,
|
|
21517
|
-
className: innerClassName,
|
|
21518
|
-
style: innerStyle,
|
|
21519
|
-
children: children
|
|
21520
|
-
});
|
|
21521
|
-
};
|
|
21522
|
-
|
|
21523
21515
|
const useFormEvents = (
|
|
21524
21516
|
elementRef,
|
|
21525
21517
|
{
|
|
@@ -21620,6 +21612,7 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
21620
21612
|
.navi_button_content {
|
|
21621
21613
|
position: relative;
|
|
21622
21614
|
display: inline-flex;
|
|
21615
|
+
width: 100%;
|
|
21623
21616
|
padding-top: var(--padding-y);
|
|
21624
21617
|
padding-right: var(--padding-x);
|
|
21625
21618
|
padding-bottom: var(--padding-y);
|
|
@@ -21741,8 +21734,6 @@ const ButtonBasic = forwardRef((props, ref) => {
|
|
|
21741
21734
|
autoFocus,
|
|
21742
21735
|
// visual
|
|
21743
21736
|
appearance = "navi",
|
|
21744
|
-
alignX,
|
|
21745
|
-
alignY,
|
|
21746
21737
|
discrete,
|
|
21747
21738
|
className,
|
|
21748
21739
|
style,
|
|
@@ -21766,13 +21757,10 @@ const ButtonBasic = forwardRef((props, ref) => {
|
|
|
21766
21757
|
buttonChildren = children;
|
|
21767
21758
|
}
|
|
21768
21759
|
const innerClassName = withPropsClassName(appearance === "navi" ? "navi_button" : undefined, className);
|
|
21769
|
-
const
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21773
|
-
alignY
|
|
21774
|
-
})
|
|
21775
|
-
}, style);
|
|
21760
|
+
const {
|
|
21761
|
+
all
|
|
21762
|
+
} = useLayoutStyle(rest);
|
|
21763
|
+
const innerStyle = withPropsStyle(all, style);
|
|
21776
21764
|
return jsx("button", {
|
|
21777
21765
|
...rest,
|
|
21778
21766
|
ref: innerRef,
|
|
@@ -24347,7 +24335,6 @@ const LinkBasic = forwardRef((props, ref) => {
|
|
|
24347
24335
|
});
|
|
24348
24336
|
const LinkPlain = forwardRef((props, ref) => {
|
|
24349
24337
|
const {
|
|
24350
|
-
className = "",
|
|
24351
24338
|
loading,
|
|
24352
24339
|
readOnly,
|
|
24353
24340
|
disabled,
|
|
@@ -24360,6 +24347,9 @@ const LinkPlain = forwardRef((props, ref) => {
|
|
|
24360
24347
|
onClick,
|
|
24361
24348
|
onKeyDown,
|
|
24362
24349
|
href,
|
|
24350
|
+
// visual
|
|
24351
|
+
className,
|
|
24352
|
+
style,
|
|
24363
24353
|
...rest
|
|
24364
24354
|
} = props;
|
|
24365
24355
|
const innerRef = useRef();
|
|
@@ -24369,6 +24359,11 @@ const LinkPlain = forwardRef((props, ref) => {
|
|
|
24369
24359
|
useConstraints(innerRef, constraints);
|
|
24370
24360
|
const shouldDimColor = readOnly || disabled;
|
|
24371
24361
|
useDimColorWhen(innerRef, shouldDimColor);
|
|
24362
|
+
const innerClassName = withPropsClassName("navi_link", className);
|
|
24363
|
+
const {
|
|
24364
|
+
all
|
|
24365
|
+
} = useLayoutStyle(rest);
|
|
24366
|
+
const innerStyle = withPropsStyle(all, style);
|
|
24372
24367
|
return jsx(LoadableInlineElement, {
|
|
24373
24368
|
loading: loading,
|
|
24374
24369
|
color: "light-dark(#355fcc, #3b82f6)",
|
|
@@ -24376,7 +24371,8 @@ const LinkPlain = forwardRef((props, ref) => {
|
|
|
24376
24371
|
...rest,
|
|
24377
24372
|
ref: innerRef,
|
|
24378
24373
|
href: href,
|
|
24379
|
-
className:
|
|
24374
|
+
className: innerClassName,
|
|
24375
|
+
style: innerStyle,
|
|
24380
24376
|
"aria-busy": loading,
|
|
24381
24377
|
inert: disabled,
|
|
24382
24378
|
"data-field": "",
|
|
@@ -28220,23 +28216,17 @@ const Text = ({
|
|
|
28220
28216
|
italic,
|
|
28221
28217
|
underline,
|
|
28222
28218
|
style,
|
|
28223
|
-
alignX,
|
|
28224
28219
|
...rest
|
|
28225
28220
|
}) => {
|
|
28221
|
+
const {
|
|
28222
|
+
all
|
|
28223
|
+
} = useLayoutStyle(rest);
|
|
28226
28224
|
const innerStyle = withPropsStyle({
|
|
28225
|
+
...all,
|
|
28227
28226
|
color,
|
|
28228
28227
|
fontWeight: bold ? "bold" : undefined,
|
|
28229
28228
|
fontStyle: italic ? "italic" : undefined,
|
|
28230
|
-
textDecoration: underline ? "underline" : undefined
|
|
28231
|
-
...consumeSpacingProps(rest),
|
|
28232
|
-
...(alignX === "start" ? {} : alignX === "center" ? {
|
|
28233
|
-
alignSelf: "center",
|
|
28234
|
-
marginLeft: "auto",
|
|
28235
|
-
marginRight: "auto"
|
|
28236
|
-
} : {
|
|
28237
|
-
alignSelf: "end",
|
|
28238
|
-
marginLeft: "auto"
|
|
28239
|
-
})
|
|
28229
|
+
textDecoration: underline ? "underline" : undefined
|
|
28240
28230
|
}, style);
|
|
28241
28231
|
return jsx("span", {
|
|
28242
28232
|
...rest,
|
|
@@ -28302,6 +28292,129 @@ const TextAndCount = ({
|
|
|
28302
28292
|
});
|
|
28303
28293
|
};
|
|
28304
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
|
+
|
|
28305
28418
|
const createUniqueValueConstraint = (
|
|
28306
28419
|
// the set might be incomplete (the front usually don't have the full copy of all the items from the backend)
|
|
28307
28420
|
// but this is already nice to help user with what we know
|