@jsenv/navi 0.27.68 → 0.27.70
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 +53 -35
- package/dist/jsenv_navi.js.map +13 -13
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -22924,6 +22924,10 @@ const useUIStateController = (
|
|
|
22924
22924
|
if (el) {
|
|
22925
22925
|
el.__uiStateController__ = controller;
|
|
22926
22926
|
}
|
|
22927
|
+
// Re-register so the radio registry stays in sync when props.ref changes
|
|
22928
|
+
// identity (e.g. across a Suspense boundary). The render-phase call in
|
|
22929
|
+
// control_hooks.jsx handles the initial mount; this call handles re-runs.
|
|
22930
|
+
onUIStateControllerCreated(controller);
|
|
22927
22931
|
return () => {
|
|
22928
22932
|
if (el && el.__uiStateController__ === controller) {
|
|
22929
22933
|
delete el.__uiStateController__;
|
|
@@ -30829,11 +30833,11 @@ installImportMetaCssBuild(import.meta);const css$C = /* css */`
|
|
|
30829
30833
|
@layer navi {
|
|
30830
30834
|
.navi_checkbox {
|
|
30831
30835
|
--switch-margin: 2px; /* Useful to reserve space for outline */
|
|
30832
|
-
--switch-width: 2em;
|
|
30833
|
-
--switch-thumb-size: 1.2em;
|
|
30834
30836
|
/* Padding uses px and not em otherwise it can be resolved to a float which does not play well */
|
|
30835
30837
|
/* With the translation calc in some configurations. In the end 2px is nice in all sizes and can still be configured for exceptions */
|
|
30836
30838
|
--switch-padding: 2px;
|
|
30839
|
+
--switch-thumb-size: calc(1em - var(--switch-padding) * 2);
|
|
30840
|
+
--switch-width: calc(1.4em - var(--switch-padding) * 2);
|
|
30837
30841
|
--switch-border-radius: calc(
|
|
30838
30842
|
var(--switch-thumb-size) / 2 + calc(var(--switch-padding) * 2)
|
|
30839
30843
|
);
|
|
@@ -31091,6 +31095,14 @@ installImportMetaCssBuild(import.meta);const css$B = /* css */`
|
|
|
31091
31095
|
pointer-events: none;
|
|
31092
31096
|
}
|
|
31093
31097
|
|
|
31098
|
+
.navi_checkbox_icon {
|
|
31099
|
+
display: flex;
|
|
31100
|
+
aspect-ratio: inherit;
|
|
31101
|
+
height: 1em;
|
|
31102
|
+
align-items: center;
|
|
31103
|
+
justify-content: center;
|
|
31104
|
+
}
|
|
31105
|
+
|
|
31094
31106
|
/* Focus */
|
|
31095
31107
|
&[data-focus-visible] {
|
|
31096
31108
|
z-index: 1;
|
|
@@ -31424,31 +31436,34 @@ installImportMetaCssBuild(import.meta);const css$A = /* css */`
|
|
|
31424
31436
|
}
|
|
31425
31437
|
|
|
31426
31438
|
[navi-field] {
|
|
31427
|
-
--
|
|
31439
|
+
--spacing-with-control: var(--navi-xs);
|
|
31440
|
+
|
|
31441
|
+
.navi_checkbox {
|
|
31442
|
+
--margin: 0;
|
|
31443
|
+
}
|
|
31444
|
+
.navi_radio {
|
|
31445
|
+
--margin: 0;
|
|
31446
|
+
}
|
|
31447
|
+
}
|
|
31428
31448
|
|
|
31449
|
+
/* Field container: padding on Label extends its interactive zone */
|
|
31450
|
+
:not(label)[navi-field] {
|
|
31429
31451
|
> [navi-control] + .navi_label {
|
|
31430
|
-
padding-left: var(--
|
|
31452
|
+
padding-left: var(--spacing-with-control);
|
|
31431
31453
|
}
|
|
31432
31454
|
> .navi_label:first-child {
|
|
31433
|
-
padding-right: var(--
|
|
31455
|
+
padding-right: var(--spacing-with-control);
|
|
31434
31456
|
}
|
|
31435
31457
|
&[data-vertical] {
|
|
31436
31458
|
> .navi_label:first-child {
|
|
31437
31459
|
padding-right: 0;
|
|
31438
|
-
padding-bottom: var(--
|
|
31460
|
+
padding-bottom: var(--spacing-with-control);
|
|
31439
31461
|
}
|
|
31440
31462
|
> [navi-control] + .navi_label {
|
|
31441
|
-
padding-top: var(--
|
|
31463
|
+
padding-top: var(--spacing-with-control);
|
|
31442
31464
|
padding-left: 0;
|
|
31443
31465
|
}
|
|
31444
31466
|
}
|
|
31445
|
-
|
|
31446
|
-
.navi_checkbox {
|
|
31447
|
-
--margin: 0;
|
|
31448
|
-
}
|
|
31449
|
-
.navi_radio {
|
|
31450
|
-
--margin: 0;
|
|
31451
|
-
}
|
|
31452
31467
|
}
|
|
31453
31468
|
}
|
|
31454
31469
|
`;
|
|
@@ -31466,12 +31481,12 @@ installImportMetaCssBuild(import.meta);const css$A = /* css */`
|
|
|
31466
31481
|
*
|
|
31467
31482
|
* Props:
|
|
31468
31483
|
* id — optional explicit id used as the field id instead of the auto-generated one
|
|
31469
|
-
*
|
|
31484
|
+
* flex="y" — vertical layout; automatically sets alignX="start" and data-vertical
|
|
31470
31485
|
* children — any JSX; should contain a `Label` and a form control
|
|
31471
|
-
* ...rest — forwarded to the wrapping
|
|
31486
|
+
* ...rest — forwarded to the wrapping element (className, style, flex, spacing, …)
|
|
31472
31487
|
*
|
|
31473
31488
|
* @example
|
|
31474
|
-
* <Field flex
|
|
31489
|
+
* <Field flex spacingWithControl="s">
|
|
31475
31490
|
* Date de début
|
|
31476
31491
|
* <Input name="start_date" required />
|
|
31477
31492
|
* </Field>
|
|
@@ -31494,31 +31509,32 @@ const Field = props => {
|
|
|
31494
31509
|
};
|
|
31495
31510
|
const FieldAsLabel = props => {
|
|
31496
31511
|
const {
|
|
31497
|
-
|
|
31512
|
+
spacingWithControl = "s",
|
|
31498
31513
|
children
|
|
31499
31514
|
} = props;
|
|
31500
|
-
|
|
31515
|
+
const isVertical = props.flex === "y";
|
|
31516
|
+
const htmlFor = Object.hasOwn(props, "htmlFor") ? props.htmlFor : undefined;
|
|
31501
31517
|
return jsx(Label, {
|
|
31502
31518
|
"navi-field": "",
|
|
31503
|
-
|
|
31504
|
-
|
|
31505
|
-
alignX: vertical ? "start" : undefined,
|
|
31506
|
-
"data-vertical": vertical ? "" : undefined,
|
|
31519
|
+
alignX: isVertical ? "start" : undefined,
|
|
31520
|
+
spacing: spacingWithControl,
|
|
31507
31521
|
...props,
|
|
31508
|
-
|
|
31522
|
+
spacingWithControl: undefined,
|
|
31523
|
+
"data-vertical": isVertical ? "" : undefined,
|
|
31524
|
+
htmlFor: htmlFor,
|
|
31509
31525
|
children: children
|
|
31510
31526
|
});
|
|
31511
31527
|
};
|
|
31512
31528
|
const FieldCSSVars = {
|
|
31513
|
-
|
|
31529
|
+
spacingWithControl: "--spacing-with-control"
|
|
31514
31530
|
};
|
|
31515
31531
|
const FieldAsContainer = props => {
|
|
31516
31532
|
import.meta.css = [css$A, "@jsenv/navi/src/control/field.jsx"];
|
|
31517
31533
|
const {
|
|
31518
|
-
vertical,
|
|
31519
31534
|
children
|
|
31520
31535
|
} = props;
|
|
31521
|
-
props.
|
|
31536
|
+
props.spacingWithControl = resolveSpacingSize(props.spacingWithControl);
|
|
31537
|
+
const isVertical = props.flex === "y";
|
|
31522
31538
|
const [messageProps, remainingProps] = extractMessageAndRemainingProps(props);
|
|
31523
31539
|
const messagePropsRef = useRef();
|
|
31524
31540
|
messagePropsRef.current = messageProps;
|
|
@@ -31527,11 +31543,9 @@ const FieldAsContainer = props => {
|
|
|
31527
31543
|
return jsx(Box, {
|
|
31528
31544
|
"navi-field": "",
|
|
31529
31545
|
styleCSSVars: FieldCSSVars,
|
|
31530
|
-
|
|
31531
|
-
alignX: vertical ? "start" : undefined,
|
|
31532
|
-
"data-vertical": vertical ? "" : undefined,
|
|
31546
|
+
alignX: isVertical ? "start" : undefined,
|
|
31533
31547
|
...remainingProps,
|
|
31534
|
-
vertical: undefined,
|
|
31548
|
+
"data-vertical": isVertical ? "" : undefined,
|
|
31535
31549
|
fieldId: undefined,
|
|
31536
31550
|
children: jsx(MessagePropsRefContext.Provider, {
|
|
31537
31551
|
value: messagePropsRef,
|
|
@@ -31552,8 +31566,13 @@ const Label = props => {
|
|
|
31552
31566
|
const [disabled, setDisabled] = useState(false);
|
|
31553
31567
|
const [readOnly, setReadOnly] = useState(false);
|
|
31554
31568
|
const [connected, setConnected] = useState(false);
|
|
31555
|
-
|
|
31556
|
-
|
|
31569
|
+
// Set htmlFor only when we know the correct target id:
|
|
31570
|
+
// - caller explicitly provided one (even undefined to opt out)
|
|
31571
|
+
// - a parent Field provided one via ControlIdContext
|
|
31572
|
+
// When neither is present the label either wraps the control directly
|
|
31573
|
+
// (implicit HTML association) or is disconnected — either way, a
|
|
31574
|
+
// randomly generated id would point to nothing and cause confusion.
|
|
31575
|
+
const htmlFor = Object.hasOwn(props, "htmlFor") ? props.htmlFor : controlId;
|
|
31557
31576
|
const [messageProps, remainingProps] = extractMessageAndRemainingProps(props);
|
|
31558
31577
|
const messagePropsRef = useRef();
|
|
31559
31578
|
messagePropsRef.current = messageProps;
|
|
@@ -40837,7 +40856,6 @@ installImportMetaCssBuild(import.meta);const css$i = /* css */`
|
|
|
40837
40856
|
pointer-events: none;
|
|
40838
40857
|
|
|
40839
40858
|
.navi_icon {
|
|
40840
|
-
height: 100%;
|
|
40841
40859
|
max-height: 100%;
|
|
40842
40860
|
}
|
|
40843
40861
|
}
|
|
@@ -40950,7 +40968,7 @@ const PickerButton = props => {
|
|
|
40950
40968
|
ref,
|
|
40951
40969
|
variant,
|
|
40952
40970
|
icon,
|
|
40953
|
-
iconSize = "
|
|
40971
|
+
iconSize = "inherit",
|
|
40954
40972
|
placeholder,
|
|
40955
40973
|
ui,
|
|
40956
40974
|
maxLines = 1
|