@jsenv/navi 0.27.69 → 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 +49 -35
- package/dist/jsenv_navi.js.map +12 -12
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -30833,11 +30833,11 @@ installImportMetaCssBuild(import.meta);const css$C = /* css */`
|
|
|
30833
30833
|
@layer navi {
|
|
30834
30834
|
.navi_checkbox {
|
|
30835
30835
|
--switch-margin: 2px; /* Useful to reserve space for outline */
|
|
30836
|
-
--switch-width: 2em;
|
|
30837
|
-
--switch-thumb-size: 1.2em;
|
|
30838
30836
|
/* Padding uses px and not em otherwise it can be resolved to a float which does not play well */
|
|
30839
30837
|
/* With the translation calc in some configurations. In the end 2px is nice in all sizes and can still be configured for exceptions */
|
|
30840
30838
|
--switch-padding: 2px;
|
|
30839
|
+
--switch-thumb-size: calc(1em - var(--switch-padding) * 2);
|
|
30840
|
+
--switch-width: calc(1.4em - var(--switch-padding) * 2);
|
|
30841
30841
|
--switch-border-radius: calc(
|
|
30842
30842
|
var(--switch-thumb-size) / 2 + calc(var(--switch-padding) * 2)
|
|
30843
30843
|
);
|
|
@@ -31095,6 +31095,14 @@ installImportMetaCssBuild(import.meta);const css$B = /* css */`
|
|
|
31095
31095
|
pointer-events: none;
|
|
31096
31096
|
}
|
|
31097
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
|
+
|
|
31098
31106
|
/* Focus */
|
|
31099
31107
|
&[data-focus-visible] {
|
|
31100
31108
|
z-index: 1;
|
|
@@ -31428,31 +31436,34 @@ installImportMetaCssBuild(import.meta);const css$A = /* css */`
|
|
|
31428
31436
|
}
|
|
31429
31437
|
|
|
31430
31438
|
[navi-field] {
|
|
31431
|
-
--
|
|
31439
|
+
--spacing-with-control: var(--navi-xs);
|
|
31440
|
+
|
|
31441
|
+
.navi_checkbox {
|
|
31442
|
+
--margin: 0;
|
|
31443
|
+
}
|
|
31444
|
+
.navi_radio {
|
|
31445
|
+
--margin: 0;
|
|
31446
|
+
}
|
|
31447
|
+
}
|
|
31432
31448
|
|
|
31449
|
+
/* Field container: padding on Label extends its interactive zone */
|
|
31450
|
+
:not(label)[navi-field] {
|
|
31433
31451
|
> [navi-control] + .navi_label {
|
|
31434
|
-
padding-left: var(--
|
|
31452
|
+
padding-left: var(--spacing-with-control);
|
|
31435
31453
|
}
|
|
31436
31454
|
> .navi_label:first-child {
|
|
31437
|
-
padding-right: var(--
|
|
31455
|
+
padding-right: var(--spacing-with-control);
|
|
31438
31456
|
}
|
|
31439
31457
|
&[data-vertical] {
|
|
31440
31458
|
> .navi_label:first-child {
|
|
31441
31459
|
padding-right: 0;
|
|
31442
|
-
padding-bottom: var(--
|
|
31460
|
+
padding-bottom: var(--spacing-with-control);
|
|
31443
31461
|
}
|
|
31444
31462
|
> [navi-control] + .navi_label {
|
|
31445
|
-
padding-top: var(--
|
|
31463
|
+
padding-top: var(--spacing-with-control);
|
|
31446
31464
|
padding-left: 0;
|
|
31447
31465
|
}
|
|
31448
31466
|
}
|
|
31449
|
-
|
|
31450
|
-
.navi_checkbox {
|
|
31451
|
-
--margin: 0;
|
|
31452
|
-
}
|
|
31453
|
-
.navi_radio {
|
|
31454
|
-
--margin: 0;
|
|
31455
|
-
}
|
|
31456
31467
|
}
|
|
31457
31468
|
}
|
|
31458
31469
|
`;
|
|
@@ -31470,12 +31481,12 @@ installImportMetaCssBuild(import.meta);const css$A = /* css */`
|
|
|
31470
31481
|
*
|
|
31471
31482
|
* Props:
|
|
31472
31483
|
* id — optional explicit id used as the field id instead of the auto-generated one
|
|
31473
|
-
*
|
|
31484
|
+
* flex="y" — vertical layout; automatically sets alignX="start" and data-vertical
|
|
31474
31485
|
* children — any JSX; should contain a `Label` and a form control
|
|
31475
|
-
* ...rest — forwarded to the wrapping
|
|
31486
|
+
* ...rest — forwarded to the wrapping element (className, style, flex, spacing, …)
|
|
31476
31487
|
*
|
|
31477
31488
|
* @example
|
|
31478
|
-
* <Field flex
|
|
31489
|
+
* <Field flex spacingWithControl="s">
|
|
31479
31490
|
* Date de début
|
|
31480
31491
|
* <Input name="start_date" required />
|
|
31481
31492
|
* </Field>
|
|
@@ -31498,31 +31509,32 @@ const Field = props => {
|
|
|
31498
31509
|
};
|
|
31499
31510
|
const FieldAsLabel = props => {
|
|
31500
31511
|
const {
|
|
31501
|
-
|
|
31512
|
+
spacingWithControl = "s",
|
|
31502
31513
|
children
|
|
31503
31514
|
} = props;
|
|
31504
|
-
|
|
31515
|
+
const isVertical = props.flex === "y";
|
|
31516
|
+
const htmlFor = Object.hasOwn(props, "htmlFor") ? props.htmlFor : undefined;
|
|
31505
31517
|
return jsx(Label, {
|
|
31506
31518
|
"navi-field": "",
|
|
31507
|
-
|
|
31508
|
-
|
|
31509
|
-
alignX: vertical ? "start" : undefined,
|
|
31510
|
-
"data-vertical": vertical ? "" : undefined,
|
|
31519
|
+
alignX: isVertical ? "start" : undefined,
|
|
31520
|
+
spacing: spacingWithControl,
|
|
31511
31521
|
...props,
|
|
31512
|
-
|
|
31522
|
+
spacingWithControl: undefined,
|
|
31523
|
+
"data-vertical": isVertical ? "" : undefined,
|
|
31524
|
+
htmlFor: htmlFor,
|
|
31513
31525
|
children: children
|
|
31514
31526
|
});
|
|
31515
31527
|
};
|
|
31516
31528
|
const FieldCSSVars = {
|
|
31517
|
-
|
|
31529
|
+
spacingWithControl: "--spacing-with-control"
|
|
31518
31530
|
};
|
|
31519
31531
|
const FieldAsContainer = props => {
|
|
31520
31532
|
import.meta.css = [css$A, "@jsenv/navi/src/control/field.jsx"];
|
|
31521
31533
|
const {
|
|
31522
|
-
vertical,
|
|
31523
31534
|
children
|
|
31524
31535
|
} = props;
|
|
31525
|
-
props.
|
|
31536
|
+
props.spacingWithControl = resolveSpacingSize(props.spacingWithControl);
|
|
31537
|
+
const isVertical = props.flex === "y";
|
|
31526
31538
|
const [messageProps, remainingProps] = extractMessageAndRemainingProps(props);
|
|
31527
31539
|
const messagePropsRef = useRef();
|
|
31528
31540
|
messagePropsRef.current = messageProps;
|
|
@@ -31531,11 +31543,9 @@ const FieldAsContainer = props => {
|
|
|
31531
31543
|
return jsx(Box, {
|
|
31532
31544
|
"navi-field": "",
|
|
31533
31545
|
styleCSSVars: FieldCSSVars,
|
|
31534
|
-
|
|
31535
|
-
alignX: vertical ? "start" : undefined,
|
|
31536
|
-
"data-vertical": vertical ? "" : undefined,
|
|
31546
|
+
alignX: isVertical ? "start" : undefined,
|
|
31537
31547
|
...remainingProps,
|
|
31538
|
-
vertical: undefined,
|
|
31548
|
+
"data-vertical": isVertical ? "" : undefined,
|
|
31539
31549
|
fieldId: undefined,
|
|
31540
31550
|
children: jsx(MessagePropsRefContext.Provider, {
|
|
31541
31551
|
value: messagePropsRef,
|
|
@@ -31556,8 +31566,13 @@ const Label = props => {
|
|
|
31556
31566
|
const [disabled, setDisabled] = useState(false);
|
|
31557
31567
|
const [readOnly, setReadOnly] = useState(false);
|
|
31558
31568
|
const [connected, setConnected] = useState(false);
|
|
31559
|
-
|
|
31560
|
-
|
|
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;
|
|
31561
31576
|
const [messageProps, remainingProps] = extractMessageAndRemainingProps(props);
|
|
31562
31577
|
const messagePropsRef = useRef();
|
|
31563
31578
|
messagePropsRef.current = messageProps;
|
|
@@ -40841,7 +40856,6 @@ installImportMetaCssBuild(import.meta);const css$i = /* css */`
|
|
|
40841
40856
|
pointer-events: none;
|
|
40842
40857
|
|
|
40843
40858
|
.navi_icon {
|
|
40844
|
-
height: 100%;
|
|
40845
40859
|
max-height: 100%;
|
|
40846
40860
|
}
|
|
40847
40861
|
}
|
|
@@ -40954,7 +40968,7 @@ const PickerButton = props => {
|
|
|
40954
40968
|
ref,
|
|
40955
40969
|
variant,
|
|
40956
40970
|
icon,
|
|
40957
|
-
iconSize = "
|
|
40971
|
+
iconSize = "inherit",
|
|
40958
40972
|
placeholder,
|
|
40959
40973
|
ui,
|
|
40960
40974
|
maxLines = 1
|