@jsenv/navi 0.29.367 → 0.29.368

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.
@@ -74690,6 +74690,7 @@ const css$t = /* css */`@layer navi {
74690
74690
  var(--picker-icon-color) 45%,
74691
74691
  transparent);
74692
74692
  --picker-icon-color-disabled: var(--picker-icon-color-readonly);
74693
+ --picker-icon-color-hover: var(--picker-icon-color);
74693
74694
  --picker-align-x-default: flex-start;
74694
74695
  --picker-align-y-default: center;
74695
74696
  --picker-text-align-default: initial;
@@ -74707,6 +74708,7 @@ const css$t = /* css */`@layer navi {
74707
74708
  --x-picker-press-padding-right: var(--picker-press-padding-right, var(--picker-press-padding-x, var(--picker-press-padding, 0px)));
74708
74709
  --x-picker-press-padding-bottom: var(--picker-press-padding-bottom, var(--picker-press-padding-y, var(--picker-press-padding, 0px)));
74709
74710
  --x-picker-press-padding-left: var(--picker-press-padding-left, var(--picker-press-padding-x, var(--picker-press-padding, 0px)));
74711
+ --x-picker-chevron-reach: 0px;
74710
74712
  --x-picker-color: var(--picker-color);
74711
74713
  --x-picker-icon-color: var(--picker-icon-color);
74712
74714
  --x-picker-align-x: var(--picker-align-x, var(--picker-align-x-default));
@@ -74875,7 +74877,10 @@ const css$t = /* css */`@layer navi {
74875
74877
  & > .navi_picker_box > .navi_picker_input {
74876
74878
  top: calc(-1 * (var(--picker-border-width) + var(--x-picker-press-padding-top)));
74877
74879
  right: calc(-1 *
74878
- (var(--picker-border-width) + var(--x-picker-press-padding-right)));
74880
+ (
74881
+ var(--picker-border-width) + var(--x-picker-press-padding-right) +
74882
+ var(--x-picker-chevron-reach)
74883
+ ));
74879
74884
  bottom: calc(-1 *
74880
74885
  (var(--picker-border-width) + var(--x-picker-press-padding-bottom)));
74881
74886
  left: calc(-1 * (var(--picker-border-width) + var(--x-picker-press-padding-left)));
@@ -74921,6 +74926,7 @@ const css$t = /* css */`@layer navi {
74921
74926
  &[data-hover] {
74922
74927
  --x-picker-background-color: var(--picker-background-color-hover);
74923
74928
  --x-picker-border-color: var(--picker-border-color-hover);
74929
+ --x-picker-icon-color: var(--picker-icon-color-hover);
74924
74930
  }
74925
74931
 
74926
74932
  &[data-readonly] {
@@ -75030,6 +75036,30 @@ const css$t = /* css */`@layer navi {
75030
75036
  align-items: var(--x-picker-align-y);
75031
75037
  display: flex;
75032
75038
  }
75039
+
75040
+ & > .navi_picker_box > .navi_picker_right_slot {
75041
+ margin-right: 0;
75042
+ margin-left: var(--picker-slot-spacing, var(--navi-xxs));
75043
+ align-self: center;
75044
+ }
75045
+
75046
+ &[data-chevron="start"] > .navi_picker_box > .navi_picker_right_slot {
75047
+ margin-right: var(--picker-slot-spacing, var(--navi-xxs));
75048
+ order: -1;
75049
+ margin-left: 0;
75050
+ }
75051
+
75052
+ &[data-chevron="hang-end"] > .navi_picker_box {
75053
+ --x-picker-chevron-reach: calc(var(--x-picker-chevron-size) +
75054
+ var(--picker-slot-spacing, var(--navi-xxs)));
75055
+
75056
+ & > .navi_picker_right_slot {
75057
+ position: absolute;
75058
+ top: 50%;
75059
+ left: 100%;
75060
+ transform: translateY(-50%);
75061
+ }
75062
+ }
75033
75063
  }
75034
75064
 
75035
75065
  &[data-variant="button"] {
@@ -75109,6 +75139,9 @@ const PickerButton = props => {
75109
75139
  // an <Icon>, which is aria-hidden, and a focusable node under aria-hidden is
75110
75140
  // invisible to assistive tech while still being reachable by tab.
75111
75141
  rightSlot,
75142
+ // A bare picker's chevron, and where it goes so the drawing keeps its box
75143
+ // (see the `chevron` doc). Left out, a bare picker draws no slot at all.
75144
+ chevron,
75112
75145
  placeholder,
75113
75146
  ui,
75114
75147
  maxLines: maxLinesProp = 1,
@@ -75169,12 +75202,22 @@ const PickerButton = props => {
75169
75202
  // icon, a headless one draws nothing, a button says what it opens with its
75170
75203
  // label, a word in a sentence has no room for furniture. Nor a picker
75171
75204
  // rendering the browser's own control ("default").
75172
- // Nor a bare one: the picker is that drawing's box to the pixel, so anything
75173
- // navi adds beside it either grows the box or covers what the caller drew.
75174
- // The pieces are the caller's to place there instead — a <Picker.Clear /> in
75175
- // their own layout (see warnOnClearableWithoutSlot).
75176
- const hasRightSlot = !picksNothing && rightSlot !== null && !isIcon && variant !== "headless" && variant !== "button" && variant !== "text" && variant !== "bare" && ui !== "default";
75205
+ // Nor a bare one, unless `chevron` says where: the picker is that drawing's
75206
+ // box to the pixel, so anything navi adds beside it either grows the box or
75207
+ // covers what the caller drew. The pieces are the caller's to place there
75208
+ // instead — a <Picker.Clear /> in their own layout (see
75209
+ // warnOnClearableWithoutSlot) — or the slot goes where the drawing is not:
75210
+ // after it, before it, or out of the flow altogether.
75211
+ const isBare = variant === "bare";
75212
+ const bareChevron = isBare && chevron !== undefined ? chevron : undefined;
75213
+ warnOnChevronOffBare(props, isBare);
75214
+ const hasRightSlot = !picksNothing && rightSlot !== null && !isIcon && variant !== "headless" && variant !== "button" && variant !== "text" && (!isBare || bareChevron !== undefined) && ui !== "default";
75177
75215
  warnOnClearableWithoutSlot(props, hasRightSlot);
75216
+ // How far the press must follow a hanging chevron: its size, as a length the
75217
+ // input's inset can add up. "inherit" is 1em of the picker's own font, which
75218
+ // the input shares (font: inherit), so the em the icon is drawn in and the
75219
+ // em the reach is measured in are the same.
75220
+ const hangingChevronSize = bareChevron === "hang-end" && hasRightSlot ? rightSlotIconSize === "inherit" ? "1em" : stringifyStyleValue(rightSlotIconSize, "fontSize") : undefined;
75178
75221
  const inputRef = useRef(null);
75179
75222
  const [pickerRemainingProps, inputProps, facadeChildrenProps] = useControlFacadeProps({
75180
75223
  ...props,
@@ -75258,6 +75301,7 @@ const PickerButton = props => {
75258
75301
  pseudoClasses: PICKER_BUTTON_PSEUDO_CLASSES,
75259
75302
  "data-variant": variant,
75260
75303
  "data-icon": isIcon ? "" : undefined,
75304
+ "data-chevron": hasRightSlot ? bareChevron : undefined,
75261
75305
  "navi-picker": "",
75262
75306
  "navi-single-line": isSingleLine ? "" : undefined,
75263
75307
  "navi-ui-custom": ui === "default" ? undefined : "",
@@ -75271,6 +75315,7 @@ const PickerButton = props => {
75271
75315
  rightSlotIcon: undefined,
75272
75316
  rightSlotIconSize: undefined,
75273
75317
  rightSlot: undefined,
75318
+ chevron: undefined,
75274
75319
  clearConfirm: undefined,
75275
75320
  picksNothing: undefined,
75276
75321
  openWhileReadOnly: undefined,
@@ -75307,6 +75352,9 @@ const PickerButton = props => {
75307
75352
  },
75308
75353
  children: [jsx("span", {
75309
75354
  className: "navi_picker_box",
75355
+ style: hangingChevronSize === undefined ? undefined : {
75356
+ "--x-picker-chevron-size": hangingChevronSize
75357
+ },
75310
75358
  children: jsxs(PickerContext.Provider, {
75311
75359
  value: pickerContext,
75312
75360
  children: [variant === "headless" ? null : jsx(LoadingOutline, {
@@ -75848,6 +75896,7 @@ const PickerFirstResolver = props => {
75848
75896
  * rightSlotIcon?: import("ignore:preact").ComponentChildren,
75849
75897
  * rightSlotIconSize?: number | string,
75850
75898
  * rightSlot?: import("ignore:preact").ComponentChildren,
75899
+ * chevron?: "end" | "start" | "hang-end",
75851
75900
  * clearConfirm?: string | import("ignore:preact").ComponentChildren,
75852
75901
  * message?: import("ignore:preact").ComponentChildren,
75853
75902
  * confirmLabel?: import("ignore:preact").ComponentChildren,
@@ -75948,7 +75997,7 @@ const PickerFirstResolver = props => {
75948
75997
  * a drawing that paints outside it on purpose — an affordance in the margin
75949
75998
  * beside it, out of the flow so the rest keeps its width — is drawn and
75950
75999
  * opens nothing; `pressPadding` is how far the press area follows it out
75951
- * there.
76000
+ * there. The chevron itself is the `chevron` prop's to draw and place.
75952
76001
  *
75953
76002
  * A drawing that follows what the picker HOLDS — the value the popup just
75954
76003
  * closed on, before the server has answered, the same state navi's own
@@ -76052,7 +76101,23 @@ const PickerFirstResolver = props => {
76052
76101
 
76053
76102
  * `variant="bare"` has no slot either, for the same reason turned around: the
76054
76103
  * picker is the drawing's box to the pixel, so nothing may be added beside it
76055
- * — the drawing holds what it needs (`<Picker.Clear />`) and places it.
76104
+ * — the drawing holds what it needs (`<Picker.Clear />`) and places it. Its
76105
+ * `chevron` prop is the exception: the slot, put where the drawing is not.
76106
+ * @param {"end"|"start"|"hang-end"} [chevron] `variant="bare"` only: the
76107
+ * picker draws no chevron beside the drawing, so nothing says it opens; this
76108
+ * draws one — the icon the right slot would hold, `rightSlotIcon` or the
76109
+ * chevron, at `rightSlotIconSize`, `slotSpacing` away from the drawing (xxs
76110
+ * by default), taking the clear cross's place under `clearable` like any
76111
+ * slot — and says where, so the drawing keeps the box it has when nothing
76112
+ * opens. Which side depends on where the drawing is anchored in its line.
76113
+ * `"end"`: after it, in the flow — a label with room after it. `"start"`:
76114
+ * before it — a label pushed against the right edge, which the chevron
76115
+ * would otherwise push left by its width. `"hang-end"`: after it and OUT of
76116
+ * the flow, in the margin beside the box — a drawing filling its whole
76117
+ * line; the press follows it out there by its size plus its gap, on top of
76118
+ * any `pressPaddingRight`. The chevron is drawn in `--picker-icon-color`
76119
+ * (`currentColor` here) and `--picker-icon-color-hover`; a dimmed one is
76120
+ * `--picker-icon-color: color-mix(in srgb, currentColor 55%, transparent)`.
76056
76121
  * @param {import("ignore:preact").ComponentChildren} [rightSlot] Same place, rendered
76057
76122
  * as-is: no `<Icon>` around it, nothing `aria-hidden`. This is where an
76058
76123
  * interactive right slot goes. `null` takes the slot away entirely — the
@@ -76354,6 +76419,18 @@ const warnOnClearableWithoutSlot = (props, hasRightSlot) => {
76354
76419
  }
76355
76420
  console.warn(`[navi] <Picker ${cause} clearable> — that leaves no right slot, so no cross is drawn. ` + `Draw it where it belongs instead: <Picker ${cause} ui={<YourDrawing>… <Picker.Clear /></YourDrawing>}>. ` + `It is the same cross, and it takes itself away when there is nothing left to clear.`);
76356
76421
  };
76422
+ let chevronOffBareWarned = false;
76423
+ const warnOnChevronOffBare = (props, isBare) => {
76424
+ const {
76425
+ chevron,
76426
+ variant
76427
+ } = props;
76428
+ if (chevron === undefined || isBare || chevronOffBareWarned) {
76429
+ return;
76430
+ }
76431
+ chevronOffBareWarned = true;
76432
+ console.warn(`[navi] <Picker variant="${variant}" chevron="${chevron}"> — \`chevron\` places the chevron of a bare picker, whose drawing has no slot beside it. ` + `This variant draws its chevron in its right slot already (rightSlotIcon, rightSlot to change it); \`chevron\` is ignored.`);
76433
+ };
76357
76434
  const warnOnUnknownPickerType = props => {
76358
76435
  const {
76359
76436
  type