solid-baseui 0.1.0-alpha.1 → 0.1.0-alpha.2
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/CHANGELOG.md +42 -0
- package/README.md +51 -20
- package/dist/lib/client/DialogHandle-DluOK_7u.js +521 -0
- package/dist/lib/client/DialogPopup-CfEb3F54.js +138 -0
- package/dist/lib/client/FieldControl-eDe-Jnp9.js +142 -0
- package/dist/lib/client/{FieldRootContext-izCEh80D.js → FieldRootContext-D3fuVjs3.js} +1 -1
- package/dist/lib/client/{FocusManager-NP1uPXTi.js → FocusManager-q7z7PMV1.js} +92 -89
- package/dist/lib/client/{InternalBackdrop-cSK13gaM.js → InternalBackdrop-B8_lfUvf.js} +1 -1
- package/dist/lib/client/{MenuSubmenuTrigger-yfncqM-D.js → MenuSubmenuTrigger-DMb5CwTF.js} +386 -386
- package/dist/lib/client/{PopupHandle-CQI6Om1Z.js → PopupHandle-DyX5gY1e.js} +17 -11
- package/dist/lib/client/{PopupStore-Du0O57fL.js → PopupStore-BjRwcvbG.js} +91 -88
- package/dist/lib/client/PopupViewport-BanYHrD-.js +154 -0
- package/dist/lib/client/{TriggerFocusGuards-Cs8LVBj5.js → TriggerFocusGuards-Fzspp3Y1.js} +2 -2
- package/dist/lib/client/accordion/index.js +1 -1
- package/dist/lib/client/{accordion-BFeZFpJZ.js → accordion-CA2DfX67.js} +144 -144
- package/dist/lib/client/alert-dialog/index.js +1 -1
- package/dist/lib/client/{alert-dialog-BxGUF8_Q.js → alert-dialog-Bup88Dpx.js} +2 -2
- package/dist/lib/client/autocomplete/index.js +1 -1
- package/dist/lib/client/{autocomplete-C9QA98XD.js → autocomplete-oyy_uRpU.js} +2 -2
- package/dist/lib/client/avatar/index.js +1 -1
- package/dist/lib/client/avatar-DNZ4fnBd.js +191 -0
- package/dist/lib/client/button/index.js +1 -1
- package/dist/lib/client/button-BJZYmCVv.js +88 -0
- package/dist/lib/client/checkbox/index.js +1 -1
- package/dist/lib/client/checkbox-group/index.js +1 -1
- package/dist/lib/client/{checkbox-group-CwMDoSTK.js → checkbox-group-DGyrciZJ.js} +1 -1
- package/dist/lib/client/checkbox-sQHYTbpB.js +425 -0
- package/dist/lib/client/collapsible/index.js +1 -1
- package/dist/lib/client/collapsible-BENbFFCc.js +230 -0
- package/dist/lib/client/combobox/index.js +1 -1
- package/dist/lib/client/{combobox-6DhOdzit.js → combobox-BGH8QLXH.js} +143 -141
- package/dist/lib/client/compositeNavigation-DCt1sQon.js +82 -0
- package/dist/lib/client/{constants-cOVxAoxB.js → constants-ByOMFJAe.js} +100 -100
- package/dist/lib/client/context-menu/index.js +1 -1
- package/dist/lib/client/context-menu-xQ1sBCET.js +220 -0
- package/dist/lib/client/{createAnchorPositioning-D96gu-Dz.js → createAnchorPositioning-DCXIApS1.js} +1 -1
- package/dist/lib/client/{createAnchoredPopupScrollLock-Cx0cbh1_.js → createAnchoredPopupScrollLock-BxKpJbCE.js} +2 -2
- package/dist/lib/client/{createClickInteraction-CTaIFBiV.js → createClickInteraction-BeBsTqtY.js} +1 -1
- package/dist/lib/client/{createFocusInteraction--s9_qBf3.js → createFocusInteraction-DQPWkZe2.js} +7 -7
- package/dist/lib/client/{createPopupAutoResize-Dn-stj-8.js → createPopupAutoResize-CSNpMz5v.js} +3 -3
- package/dist/lib/client/dialog/index.js +1 -1
- package/dist/lib/client/{dialog-B9tR9X48.js → dialog-C0EF0a5u.js} +2 -2
- package/dist/lib/client/{dom-BEAeQ9Eb.js → dom-lDdayFF_.js} +25 -15
- package/dist/lib/client/drawer/index.js +1 -1
- package/dist/lib/client/{drawer-dyr3_sKQ.js → drawer-uKoNBwDU.js} +519 -518
- package/dist/lib/client/field/index.js +1 -1
- package/dist/lib/client/{field-CjUAjp1m.js → field-DIMrgpBW.js} +144 -144
- package/dist/lib/client/form/index.js +1 -1
- package/dist/lib/client/form-Bqq8wSLY.js +109 -0
- package/dist/lib/client/index.js +34 -34
- package/dist/lib/client/input/index.js +1 -1
- package/dist/lib/client/{input-_QHvSSqM.js → input-YthuKwIE.js} +1 -1
- package/dist/lib/client/internals/composeEventHandlers.js +14 -8
- package/dist/lib/client/internals/field-root-context/index.js +2 -2
- package/dist/lib/client/{mergeStyleValue-DhTA9Nwe.js → isSolidAccessor-BH_FevwH.js} +1 -12
- package/dist/lib/client/menu/index.js +1 -1
- package/dist/lib/client/{menu-DLqUBmMK.js → menu-4rNLN6aX.js} +79 -79
- package/dist/lib/client/menubar/index.js +1 -1
- package/dist/lib/client/menubar-nFQGtNmY.js +163 -0
- package/dist/lib/client/mergeStyleValue-Dcd36yxZ.js +12 -0
- package/dist/lib/client/navigation-menu/index.js +1 -1
- package/dist/lib/client/{navigation-menu-mVHV41Ky.js → navigation-menu-BbRyun3a.js} +284 -284
- package/dist/lib/client/number-field/index.js +1 -1
- package/dist/lib/client/{number-field-DusLw_0X.js → number-field-hT_H0hVu.js} +356 -356
- package/dist/lib/client/otp-field/index.js +1 -1
- package/dist/lib/client/otp-field-lsy2iGID.js +584 -0
- package/dist/lib/client/popover/index.js +1 -1
- package/dist/lib/client/{popover-Cv7xn0nW.js → popover-Cmvmuf1L.js} +250 -248
- package/dist/lib/client/{popupStateMapping-C6jQ_LKo.js → popupStateMapping-nhukB8NK.js} +51 -51
- package/dist/lib/client/preview-card/index.js +1 -1
- package/dist/lib/client/{preview-card-FTN_aafM.js → preview-card-Dtu8AnBN.js} +168 -168
- package/dist/lib/client/radio/index.js +1 -1
- package/dist/lib/client/{radio-DA_oZhQT.js → radio-CeCU-Qqi.js} +77 -77
- package/dist/lib/client/radio-group/index.js +1 -1
- package/dist/lib/client/radio-group-NbuJvjQe.js +195 -0
- package/dist/lib/client/{safePolygon-DJG0VIVo.js → safePolygon-DVAR5dQD.js} +70 -70
- package/dist/lib/client/scroll-area/index.js +1 -1
- package/dist/lib/client/scroll-area-DqbvoAd7.js +717 -0
- package/dist/lib/client/{scrollable-SRNYlhF7.js → scrollable-BVaDUXng.js} +12 -12
- package/dist/lib/client/select/index.js +1 -1
- package/dist/lib/client/{select-DSPJt7Rk.js → select-Dad51Xbn.js} +635 -634
- package/dist/lib/client/slider/index.js +1 -1
- package/dist/lib/client/slider-CLSKFq_M.js +927 -0
- package/dist/lib/client/switch/index.js +1 -1
- package/dist/lib/client/{switch-CPl7QHKI.js → switch-Bzuu5EIg.js} +61 -61
- package/dist/lib/client/tabs/index.js +1 -1
- package/dist/lib/client/{tabs-Bn4rZDyZ.js → tabs-DWiBDv8D.js} +252 -249
- package/dist/lib/client/toast/index.js +1 -1
- package/dist/lib/client/{toast-7LdqZWOs.js → toast-DmtPJW2k.js} +353 -353
- package/dist/lib/client/toggle/index.js +1 -1
- package/dist/lib/client/{toggle-CsC37e3e.js → toggle-CAe-Z8Xn.js} +33 -33
- package/dist/lib/client/toggle-group/index.js +1 -1
- package/dist/lib/client/{toggle-group-DSWb9HxN.js → toggle-group-BbQg5s-m.js} +44 -44
- package/dist/lib/client/toolbar/index.js +1 -1
- package/dist/lib/client/{toolbar-DcCi3HNp.js → toolbar-BXT_g-oX.js} +218 -218
- package/dist/lib/client/tooltip/index.js +1 -1
- package/dist/lib/client/{tooltip-D-PkGco9.js → tooltip-h2r2_Xuo.js} +250 -249
- package/dist/lib/client/{useFilteredItems-B7z2CGMV.js → useFilteredItems-BX0BEuSI.js} +850 -819
- package/dist/lib/server/{DialogHandle-nJSSy_jM.js → DialogHandle-BGIISmG7.js} +16 -16
- package/dist/lib/server/{DialogPopup-Da1aIxVA.js → DialogPopup-C2ZDGf42.js} +4 -4
- package/dist/lib/server/{FieldControl-BDeNR3ug.js → FieldControl-CDMMyvuj.js} +6 -6
- package/dist/lib/server/{FieldRootContext-IC-LWzVp.js → FieldRootContext-Bfpna6gA.js} +3 -3
- package/dist/lib/server/{FocusManager-1LfoCsya.js → FocusManager-D-xgblGs.js} +9 -3
- package/dist/lib/server/{InternalBackdrop-C_iDPVR-.js → InternalBackdrop-D_2zAWnl.js} +1 -1
- package/dist/lib/server/{MenuSubmenuTrigger-rR8ZN7YR.js → MenuSubmenuTrigger-BMQKlOvU.js} +50 -50
- package/dist/lib/server/{PopupHandle-Ct6wywmP.js → PopupHandle-QNj4mED2.js} +14 -5
- package/dist/lib/server/{PopupStore-kHjFPiQ5.js → PopupStore-evylvVnN.js} +5 -2
- package/dist/lib/server/{PopupViewport-DftN5VUp.js → PopupViewport-BDttjORN.js} +37 -27
- package/dist/lib/server/{TriggerFocusGuards-CvoGfft9.js → TriggerFocusGuards-B9GNbLrL.js} +2 -2
- package/dist/lib/server/accordion/index.js +7 -7
- package/dist/lib/server/alert-dialog/index.js +2 -2
- package/dist/lib/server/autocomplete/index.js +2 -2
- package/dist/lib/server/avatar/index.js +3 -3
- package/dist/lib/server/button/index.js +6 -6
- package/dist/lib/server/checkbox/index.js +7 -7
- package/dist/lib/server/checkbox-group/index.js +1 -1
- package/dist/lib/server/collapsible/index.js +6 -6
- package/dist/lib/server/combobox/index.js +18 -18
- package/dist/lib/server/{compositeNavigation-BRVT1C38.js → compositeNavigation-D5jKM4yk.js} +32 -1
- package/dist/lib/server/{constants-D7ciIzsV.js → constants-ByqXubhO.js} +2 -2
- package/dist/lib/server/context-menu/index.js +9 -9
- package/dist/lib/server/{createAnchorPositioning-B5Y0WEev.js → createAnchorPositioning-DrQYe7RS.js} +1 -1
- package/dist/lib/server/{createAnchoredPopupScrollLock-DFuUrykR.js → createAnchoredPopupScrollLock-q6gnOSmv.js} +2 -2
- package/dist/lib/server/{createClickInteraction-BYsMgvup.js → createClickInteraction-D7oc1Vco.js} +1 -1
- package/dist/lib/server/{createFocusInteraction-DMyKsniI.js → createFocusInteraction-DFKr4G7a.js} +1 -1
- package/dist/lib/server/{createPopupAutoResize-ImBjwdj_.js → createPopupAutoResize-Cg0-lLf4.js} +1 -1
- package/dist/lib/server/dialog/index.js +2 -2
- package/dist/lib/server/{dom-Crg_2R-j.js → dom-D8_aB1yy.js} +14 -1
- package/dist/lib/server/drawer/index.js +38 -34
- package/dist/lib/server/field/index.js +6 -6
- package/dist/lib/server/form/index.js +2 -2
- package/dist/lib/server/input/index.js +1 -1
- package/dist/lib/server/internals/composeEventHandlers.js +15 -9
- package/dist/lib/server/internals/field-root-context/index.js +1 -1
- package/dist/lib/server/{mergeStyleValue-BwJ10_X2.js → isSolidAccessor-CZpzAH5l.js} +1 -20
- package/dist/lib/server/menu/index.js +17 -17
- package/dist/lib/server/menubar/index.js +4 -4
- package/dist/lib/server/mergeStyleValue-DecVaoac.js +20 -0
- package/dist/lib/server/navigation-menu/index.js +21 -21
- package/dist/lib/server/number-field/index.js +21 -21
- package/dist/lib/server/otp-field/index.js +8 -8
- package/dist/lib/server/popover/index.js +27 -26
- package/dist/lib/server/{popupStateMapping-B2KsiiLb.js → popupStateMapping-VHqr6M4H.js} +1 -1
- package/dist/lib/server/preview-card/index.js +16 -16
- package/dist/lib/server/radio/index.js +6 -6
- package/dist/lib/server/radio-group/index.js +5 -5
- package/dist/lib/server/{safePolygon-C1GNJbKR.js → safePolygon-B8QtiIZ3.js} +1 -1
- package/dist/lib/server/scroll-area/index.js +18 -18
- package/dist/lib/server/{scrollable-CjsSxbGr.js → scrollable-C9Pgq8T5.js} +1 -1
- package/dist/lib/server/select/index.js +39 -38
- package/dist/lib/server/slider/index.js +14 -14
- package/dist/lib/server/switch/index.js +9 -9
- package/dist/lib/server/tabs/index.js +12 -8
- package/dist/lib/server/toast/index.js +32 -32
- package/dist/lib/server/toggle/index.js +7 -7
- package/dist/lib/server/toggle-group/index.js +2 -2
- package/dist/lib/server/toolbar/index.js +14 -14
- package/dist/lib/server/tooltip/index.js +32 -27
- package/dist/lib/server/{useFilteredItems-DCxq20Is.js → useFilteredItems-BmhL0nf1.js} +181 -137
- package/dist/lib/types/accordion/trigger/AccordionTrigger.d.ts +7 -7
- package/dist/lib/types/combobox/chip/ComboboxChip.d.ts +2 -0
- package/dist/lib/types/combobox/root/ComboboxRoot.d.ts +6 -1
- package/dist/lib/types/combobox/store/ComboboxStore.d.ts +1 -0
- package/dist/lib/types/combobox/utils/handleInputPress.d.ts +1 -1
- package/dist/lib/types/field/control/FieldControl.d.ts +5 -5
- package/dist/lib/types/internals/composeEventHandlers.d.ts +9 -2
- package/dist/lib/types/internals/field-root-context/FieldRootContext.d.ts +1 -0
- package/dist/lib/types/internals/overlay/dom.d.ts +2 -0
- package/dist/lib/types/number-field/input/NumberFieldInput.d.ts +5 -5
- package/dist/lib/types/slider/track/SliderTrack.d.ts +2 -2
- package/dist/lib/types/toolbar/link/ToolbarLink.d.ts +10 -3
- package/dist/lib/types/toolbar/root/ToolbarRoot.d.ts +10 -4
- package/package.json +1 -1
- package/dist/lib/client/DialogHandle-BGyIbcvg.js +0 -521
- package/dist/lib/client/DialogPopup-Df7MC358.js +0 -138
- package/dist/lib/client/FieldControl-C0PATyKV.js +0 -142
- package/dist/lib/client/PopupViewport-IS4XU03s.js +0 -152
- package/dist/lib/client/avatar-BQoEzzav.js +0 -191
- package/dist/lib/client/button-akYS6FyY.js +0 -88
- package/dist/lib/client/checkbox-DOXtzBhA.js +0 -425
- package/dist/lib/client/collapsible-t8YReaIp.js +0 -230
- package/dist/lib/client/compositeNavigation-sxniYTc7.js +0 -58
- package/dist/lib/client/context-menu-CplDpqmi.js +0 -220
- package/dist/lib/client/form-6Ne_bWQX.js +0 -109
- package/dist/lib/client/menubar-DhPRUQZ6.js +0 -163
- package/dist/lib/client/otp-field-D-B9tZzF.js +0 -584
- package/dist/lib/client/radio-group-CWtQxWDl.js +0 -195
- package/dist/lib/client/scroll-area-NCr49LkD.js +0 -717
- package/dist/lib/client/slider-CWq9hxFf.js +0 -927
|
@@ -4,29 +4,30 @@ import { E as pointer, S as listNavigation, b as keyboard, g as inputClear, h as
|
|
|
4
4
|
import { n as resolveClass, t as resolveStyle } from "./resolveStyle-XCSFDHAL.js";
|
|
5
5
|
import { createChangeEventDetails, createGenericEventDetails } from "./internals/createBaseUIEventDetails.js";
|
|
6
6
|
import { transitionStatusMapping } from "./internals/stateAttributesMapping.js";
|
|
7
|
-
import { composeEventHandlers } from "./internals/composeEventHandlers.js";
|
|
7
|
+
import { composeEventHandlers, liveEventHandler } from "./internals/composeEventHandlers.js";
|
|
8
8
|
import { t as runOnceAnimationsFinish } from "./runOnceAnimationsFinish-CYq38H8J.js";
|
|
9
|
-
import {
|
|
10
|
-
import { i as isListIndexDisabled, n as getMinListIndex, r as getNavigatedIndex, t as getMaxListIndex } from "./compositeNavigation-
|
|
11
|
-
import { t as createAnchorPositioning } from "./createAnchorPositioning-
|
|
12
|
-
import { t as InternalBackdrop } from "./InternalBackdrop-
|
|
13
|
-
import { t as createAnchoredPopupScrollLock } from "./createAnchoredPopupScrollLock-
|
|
14
|
-
import { t as createClickInteraction } from "./createClickInteraction-
|
|
9
|
+
import { l as isHTMLElement, m as ownerDocument, n as contains, o as isElement, s as isElementVisible, u as isInteractiveElement } from "./dom-D8_aB1yy.js";
|
|
10
|
+
import { i as isListIndexDisabled, n as getMinListIndex, r as getNavigatedIndex, t as getMaxListIndex } from "./compositeNavigation-D5jKM4yk.js";
|
|
11
|
+
import { t as createAnchorPositioning } from "./createAnchorPositioning-DrQYe7RS.js";
|
|
12
|
+
import { t as InternalBackdrop } from "./InternalBackdrop-D_2zAWnl.js";
|
|
13
|
+
import { t as createAnchoredPopupScrollLock } from "./createAnchoredPopupScrollLock-q6gnOSmv.js";
|
|
14
|
+
import { t as createClickInteraction } from "./createClickInteraction-D7oc1Vco.js";
|
|
15
15
|
import { c as useFloatingTree, i as createFloatingNode, n as FloatingTreeContext, r as FloatingTreeStore, s as useFloatingParentNodeId, t as FloatingParentNodeContext } from "./FloatingTree-z1JPD1dR.js";
|
|
16
|
-
import { a as createPopupPresence, n as createTriggerRegistration, o as createDismiss, t as PopupStore } from "./PopupStore-
|
|
16
|
+
import { a as createPopupPresence, n as createTriggerRegistration, o as createDismiss, t as PopupStore } from "./PopupStore-evylvVnN.js";
|
|
17
17
|
import { t as createTransitionStatus } from "./createTransitionStatus-184v7j3-.js";
|
|
18
|
-
import { a as triggerOpenStateMapping, i as pressableTriggerOpenStateMapping, n as popupStateMapping, o as PopupPortal, r as popupTransitionStateMapping } from "./popupStateMapping-
|
|
19
|
-
import { t as FocusManager } from "./FocusManager-
|
|
18
|
+
import { a as triggerOpenStateMapping, i as pressableTriggerOpenStateMapping, n as popupStateMapping, o as PopupPortal, r as popupTransitionStateMapping } from "./popupStateMapping-VHqr6M4H.js";
|
|
19
|
+
import { t as FocusManager } from "./FocusManager-D-xgblGs.js";
|
|
20
20
|
import { t as setRef } from "./setRef-Bt70sW7c.js";
|
|
21
21
|
import { a as stopButtonInteraction, i as preventDisabledButtonKeyDown, n as handleNonNativeButtonKeyUp, r as preventButtonInteraction, t as handleNonNativeButtonKeyDown } from "./buttonSemantics-BSwDxJhh.js";
|
|
22
22
|
import { n as useDirection } from "./DirectionContext-YORWLF08.js";
|
|
23
23
|
import { DEFAULT_FIELD_STATE_ATTRIBUTES, fieldStateAttributesMapping } from "./internals/field-constants.js";
|
|
24
|
-
import { n as useFieldRootContext } from "./FieldRootContext-
|
|
24
|
+
import { n as FieldRootContext, r as useFieldRootContext, t as DEFAULT_FIELD_ROOT_CONTEXT } from "./FieldRootContext-Bfpna6gA.js";
|
|
25
25
|
import { n as useFormContext } from "./FormContext-CYwo_ZnB.js";
|
|
26
|
-
import { a as
|
|
26
|
+
import { a as findItemIndex, c as selectedValueIncludes, i as defaultItemEquality, n as areItemArraysEqual, o as findSelectionIndex, r as compareItemEquality, s as removeItem, t as isSolidAccessor } from "./isSolidAccessor-CZpzAH5l.js";
|
|
27
27
|
import { r as useLabelableContext } from "./LabelableContext-BTeF0IWb.js";
|
|
28
|
-
import { i as isScrollableY } from "./scrollable-
|
|
28
|
+
import { i as isScrollableY } from "./scrollable-C9Pgq8T5.js";
|
|
29
29
|
import { t as isAndroid } from "./platform-DYukKUir.js";
|
|
30
|
+
import { t as mergeStyleValue } from "./mergeStyleValue-DecVaoac.js";
|
|
30
31
|
import { escape, memo, mergeProps, ssr, ssrAttribute, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle } from "@solidjs/web";
|
|
31
32
|
import { For, Show, createContext, createEffect, createMemo, createSignal, createUniqueId, flush, omit, onCleanup, untrack, useContext } from "solid-js";
|
|
32
33
|
//#region src/internals/overlay/createListNavigation.ts
|
|
@@ -456,7 +457,7 @@ var ComboboxStore = class extends PopupStore {
|
|
|
456
457
|
[this.popupSide, this.setPopupSide] = signal(null);
|
|
457
458
|
[this.openMethod, this.setOpenMethod] = signal(null);
|
|
458
459
|
[this.inputInsidePopup, this.setInputInsidePopup] = signal(true);
|
|
459
|
-
[this.inputOwnsFormValue, this.setInputOwnsFormValue] = signal(false);
|
|
460
|
+
[this.inputOwnsFormValue, this.setInputOwnsFormValue] = signal(options.inputOwnsFormValue ?? false);
|
|
460
461
|
}
|
|
461
462
|
/** The item elements addressed by index, as list navigation and typeahead see them. */
|
|
462
463
|
elements() {
|
|
@@ -579,7 +580,7 @@ function AriaCombobox(props) {
|
|
|
579
580
|
const itemToStringValue = () => props.itemToStringValue;
|
|
580
581
|
const initialSelectedValue = untrack(() => {
|
|
581
582
|
const defaultValue = props.defaultSelectedValue;
|
|
582
|
-
if (defaultValue !== void 0 && defaultValue !== null) return Array.isArray(defaultValue) ? defaultValue.slice() : defaultValue;
|
|
583
|
+
if (defaultValue !== void 0 && defaultValue !== null) return props.selectionMode === "multiple" && Array.isArray(defaultValue) ? defaultValue.slice() : defaultValue;
|
|
583
584
|
return props.selectionMode === "multiple" ? [] : defaultValue ?? null;
|
|
584
585
|
});
|
|
585
586
|
const [uncontrolledSelected, setUncontrolledSelected] = createSignal(() => initialSelectedValue);
|
|
@@ -684,13 +685,15 @@ function AriaCombobox(props) {
|
|
|
684
685
|
const listEmpty = createMemo(() => filteredItems().length === 0);
|
|
685
686
|
let hadInputClear = false;
|
|
686
687
|
let lastHighlight = INITIAL_LAST_HIGHLIGHT;
|
|
688
|
+
let lastHighlightType = none;
|
|
687
689
|
let pendingQueryHighlight = null;
|
|
688
690
|
let pendingInitialHighlight = null;
|
|
689
|
-
let initializedOpen =
|
|
691
|
+
let initializedOpen = untrack(() => Boolean(props.open ?? props.defaultOpen) && props.autoHighlight === true);
|
|
690
692
|
let previousSelectedValue = cloneValue(untrack(selectedValue));
|
|
691
693
|
let previousInputValue = untrack(inputValue);
|
|
692
694
|
let previousQuery = untrack(query);
|
|
693
695
|
const store = new ComboboxStore({
|
|
696
|
+
inputOwnsFormValue: untrack(() => props.selectionMode === "none"),
|
|
694
697
|
controlledOpen: () => controlledOpen ? props.open : void 0,
|
|
695
698
|
floatingId,
|
|
696
699
|
nodeId,
|
|
@@ -706,7 +709,7 @@ function AriaCombobox(props) {
|
|
|
706
709
|
});
|
|
707
710
|
store.update({ open: untrack(() => props.open ?? props.defaultOpen ?? false) });
|
|
708
711
|
store.configureTriggerUnmount({ closeOnActiveTriggerUnmount: false });
|
|
709
|
-
|
|
712
|
+
createEffect(() => selectionMode() === "none" && (props.inline || !store.inputInsidePopup()), (owns) => store.setInputOwnsFormValue(Boolean(owns)));
|
|
710
713
|
const node = createFloatingNode({
|
|
711
714
|
tree,
|
|
712
715
|
id: nodeId,
|
|
@@ -759,14 +762,15 @@ function AriaCombobox(props) {
|
|
|
759
762
|
const fieldStringValue = createMemo(() => {
|
|
760
763
|
if (selectionMode() === "none") return inputValue();
|
|
761
764
|
const current = selectedValue();
|
|
762
|
-
return Array.isArray(current) ? current.map((value) => stringifyAsValue(value, props.itemToStringValue)) : stringifyAsValue(current, props.itemToStringValue);
|
|
765
|
+
return multiple() && Array.isArray(current) ? current.map((value) => stringifyAsValue(value, props.itemToStringValue)) : stringifyAsValue(current, props.itemToStringValue);
|
|
763
766
|
});
|
|
764
767
|
const serializedValue = createMemo(() => {
|
|
765
768
|
const raw = fieldRawValue();
|
|
766
|
-
return Array.isArray(raw) ? "" : stringifyAsValue(raw, props.itemToStringValue);
|
|
769
|
+
return multiple() && Array.isArray(raw) ? "" : stringifyAsValue(raw, props.itemToStringValue);
|
|
767
770
|
});
|
|
768
771
|
const hiddenInputName = createMemo(() => multiple() || selectionMode() === "none" && store.inputOwnsFormValue() ? void 0 : name());
|
|
769
772
|
function emitHighlight(value, index, type) {
|
|
773
|
+
lastHighlightType = type;
|
|
770
774
|
if (index === -1) {
|
|
771
775
|
if (lastHighlight === INITIAL_LAST_HIGHLIGHT) return;
|
|
772
776
|
lastHighlight = INITIAL_LAST_HIGHLIGHT;
|
|
@@ -905,7 +909,7 @@ function AriaCombobox(props) {
|
|
|
905
909
|
setCloseQuery(null);
|
|
906
910
|
store.resetAfterClose();
|
|
907
911
|
if (selectionMode() === "none") setIndices({
|
|
908
|
-
activeIndex: null,
|
|
912
|
+
activeIndex: autoHighlight() === "always" && store.listElement() && !store.track().popupElement && itemValues().length > 0 ? 0 : null,
|
|
909
913
|
selectedIndex: null
|
|
910
914
|
});
|
|
911
915
|
else setIndices({ activeIndex: null });
|
|
@@ -1094,11 +1098,14 @@ function AriaCombobox(props) {
|
|
|
1094
1098
|
mode: selectionMode(),
|
|
1095
1099
|
values: itemValues(),
|
|
1096
1100
|
compare: comparator(),
|
|
1097
|
-
isMultiple: multiple()
|
|
1098
|
-
|
|
1101
|
+
isMultiple: multiple(),
|
|
1102
|
+
mounted: presence.mounted(),
|
|
1103
|
+
hasItems: hasItems() || hasFilteredItemsProp()
|
|
1104
|
+
}), (state, previous) => {
|
|
1099
1105
|
if (state.open) return;
|
|
1100
1106
|
store.pointerDownItem = null;
|
|
1101
1107
|
if (state.mode === "none") return;
|
|
1108
|
+
if (!state.hasItems && !state.mounted && state.values.length === 0 && previous && sameValue(state.selected, previous.selected, state.compare)) return;
|
|
1102
1109
|
untrack(() => setIndices({ selectedIndex: findSelectionIndex(state.values, state.selected, state.compare, state.isMultiple) }));
|
|
1103
1110
|
});
|
|
1104
1111
|
createEffect(() => ({
|
|
@@ -1110,17 +1117,25 @@ function AriaCombobox(props) {
|
|
|
1110
1117
|
highlight: autoHighlight()
|
|
1111
1118
|
}), (state) => untrack(() => resolveHighlight(state)));
|
|
1112
1119
|
function resolveHighlight(state) {
|
|
1120
|
+
let activeIndex = state.activeIndex;
|
|
1113
1121
|
const pending = pendingQueryHighlight;
|
|
1114
1122
|
if (pending) {
|
|
1115
1123
|
const listIsNavigable = state.open || state.inline || store.track().positionerElement?.hidden === false;
|
|
1116
1124
|
if (pending.hasQuery) {
|
|
1117
|
-
if (state.
|
|
1125
|
+
if (state.values.length === 0 && !hasItems() && !hasFilteredItemsProp()) return;
|
|
1126
|
+
if (state.highlight && listIsNavigable) {
|
|
1127
|
+
store.setActiveIndex(0);
|
|
1128
|
+
activeIndex = 0;
|
|
1129
|
+
}
|
|
1118
1130
|
pendingQueryHighlight = null;
|
|
1119
1131
|
} else if (String(state.input).trim() === "") {
|
|
1120
1132
|
pendingQueryHighlight = null;
|
|
1121
1133
|
if (listIsNavigable) {
|
|
1122
1134
|
const clearedBySelection = pending.selection;
|
|
1123
|
-
if (state.highlight === "always" && !clearedBySelection && selectionMode() === "none")
|
|
1135
|
+
if (state.highlight === "always" && !clearedBySelection && selectionMode() === "none") {
|
|
1136
|
+
store.setActiveIndex(0);
|
|
1137
|
+
activeIndex = 0;
|
|
1138
|
+
}
|
|
1124
1139
|
queueMicrotask(() => untrack(() => {
|
|
1125
1140
|
if (!store.open() && !inline() || (inputElement()?.value.trim() ?? "") !== "") return;
|
|
1126
1141
|
const current = selectedValue();
|
|
@@ -1135,7 +1150,7 @@ function AriaCombobox(props) {
|
|
|
1135
1150
|
}
|
|
1136
1151
|
}
|
|
1137
1152
|
if (!state.open && !state.inline) return;
|
|
1138
|
-
if (
|
|
1153
|
+
if (activeIndex == null) {
|
|
1139
1154
|
if (state.highlight === "always" && state.values.length > 0) {
|
|
1140
1155
|
store.setActiveIndex(0);
|
|
1141
1156
|
return;
|
|
@@ -1143,21 +1158,21 @@ function AriaCombobox(props) {
|
|
|
1143
1158
|
emitHighlight(void 0, -1, none);
|
|
1144
1159
|
return;
|
|
1145
1160
|
}
|
|
1146
|
-
if (
|
|
1161
|
+
if (activeIndex >= state.values.length) {
|
|
1147
1162
|
emitHighlight(void 0, -1, none);
|
|
1148
1163
|
store.setActiveIndex(null);
|
|
1149
1164
|
return;
|
|
1150
1165
|
}
|
|
1151
|
-
const itemValue = state.values[
|
|
1166
|
+
const itemValue = state.values[activeIndex];
|
|
1152
1167
|
const previousValue = lastHighlight.value;
|
|
1153
1168
|
const sameItem = previousValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previousValue, comparator());
|
|
1154
|
-
if (lastHighlight.index !==
|
|
1169
|
+
if (lastHighlight.index !== activeIndex || !sameItem) emitHighlight(itemValue, activeIndex, none);
|
|
1155
1170
|
}
|
|
1156
1171
|
createEffect(() => ({
|
|
1157
1172
|
index: store.activeIndex(),
|
|
1158
1173
|
elements: listElements()
|
|
1159
1174
|
}), (state) => {
|
|
1160
|
-
if (state.index == null ||
|
|
1175
|
+
if (state.index == null || lastHighlightType === "pointer") return;
|
|
1161
1176
|
state.elements[state.index]?.scrollIntoView?.({
|
|
1162
1177
|
block: "nearest",
|
|
1163
1178
|
inline: "nearest"
|
|
@@ -1432,6 +1447,10 @@ function ComboboxTrigger(props) {
|
|
|
1432
1447
|
return context.store.listElement()?.id;
|
|
1433
1448
|
});
|
|
1434
1449
|
const ariaLabelledBy = createMemo(() => internalProps["aria-labelledby"] ?? labelable.labelId() ?? context.store.labelId());
|
|
1450
|
+
const ariaDescribedBy = createMemo(() => {
|
|
1451
|
+
const external = internalProps["aria-describedby"];
|
|
1452
|
+
return external === false ? false : labelable.getAriaDescribedBy(external);
|
|
1453
|
+
});
|
|
1435
1454
|
const state = createMemo(() => ({
|
|
1436
1455
|
...context.field.state(),
|
|
1437
1456
|
readOnly: context.readOnly(),
|
|
@@ -1444,7 +1463,7 @@ function ComboboxTrigger(props) {
|
|
|
1444
1463
|
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
1445
1464
|
const styleValue = createMemo(() => resolveStyle(props.style, state()));
|
|
1446
1465
|
const stateAttributes = createMemo(() => getStateAttributesProps(state(), comboboxControlStateMapping));
|
|
1447
|
-
const others = omit(allProps, "aria-labelledby", "render", "class", "disabled", "id", "nativeButton", "onBlur", "onClick", "onFocus", "onKeyDown", "onKeyUp", "onMouseDown", "onPointerDown", "onPointerEnter", "ref", "style");
|
|
1466
|
+
const others = omit(allProps, "aria-describedby", "aria-labelledby", "render", "class", "disabled", "id", "nativeButton", "onBlur", "onClick", "onFocus", "onKeyDown", "onKeyUp", "onMouseDown", "onPointerDown", "onPointerEnter", "ref", "style");
|
|
1448
1467
|
const click = createClickInteraction({
|
|
1449
1468
|
context: context.store.context.floatingRoot,
|
|
1450
1469
|
enabled: () => !context.disabled(),
|
|
@@ -1454,7 +1473,7 @@ function ComboboxTrigger(props) {
|
|
|
1454
1473
|
context: context.store.context.floatingRoot,
|
|
1455
1474
|
enabled: () => !context.store.open() && !context.readOnly() && !context.disabled() && context.selectionMode() === "single",
|
|
1456
1475
|
list: context.itemLabels,
|
|
1457
|
-
|
|
1476
|
+
disabledIndices: () => context.store.collection.disabledIndices(),
|
|
1458
1477
|
activeIndex: context.store.activeIndex,
|
|
1459
1478
|
selectedIndex: context.store.selectedIndex,
|
|
1460
1479
|
onMatch(index) {
|
|
@@ -1529,14 +1548,14 @@ function ComboboxTrigger(props) {
|
|
|
1529
1548
|
context.focusInput();
|
|
1530
1549
|
}
|
|
1531
1550
|
}
|
|
1532
|
-
const onBlur = composeEventHandlers(() => internalProps.onBlur,
|
|
1533
|
-
const onClick = composeEventHandlers(() => untrack(() => disabled() ? preventButtonInteraction : void 0), () => internalProps.onClick,
|
|
1534
|
-
const onFocus = composeEventHandlers(() => internalProps.onFocus,
|
|
1535
|
-
const onKeyDown = composeEventHandlers(() => untrack(() => disabled() ? preventDisabledButtonKeyDown : void 0), () => internalProps.onKeyDown,
|
|
1536
|
-
const onKeyUp = composeEventHandlers(() => untrack(() => disabled() ? stopButtonInteraction : void 0), () => internalProps.onKeyUp, () => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyUp));
|
|
1537
|
-
const onMouseDown = composeEventHandlers(() => untrack(() => disabled() ? stopButtonInteraction : void 0), () => internalProps.onMouseDown,
|
|
1538
|
-
const onPointerDown = composeEventHandlers(() => untrack(() => disabled() ? preventButtonInteraction : void 0), () => internalProps.onPointerDown,
|
|
1539
|
-
const onPointerEnter = composeEventHandlers(() => internalProps.onPointerEnter, (
|
|
1551
|
+
const onBlur = composeEventHandlers(liveEventHandler(() => internalProps.onBlur), handleBlur);
|
|
1552
|
+
const onClick = composeEventHandlers(liveEventHandler(() => untrack(() => disabled() ? preventButtonInteraction : void 0)), liveEventHandler(() => internalProps.onClick), handleClick);
|
|
1553
|
+
const onFocus = composeEventHandlers(liveEventHandler(() => internalProps.onFocus), handleFocus);
|
|
1554
|
+
const onKeyDown = composeEventHandlers(liveEventHandler(() => untrack(() => disabled() ? preventDisabledButtonKeyDown : void 0)), liveEventHandler(() => internalProps.onKeyDown), handleKeyDown, liveEventHandler(() => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyDown)));
|
|
1555
|
+
const onKeyUp = composeEventHandlers(liveEventHandler(() => untrack(() => disabled() ? stopButtonInteraction : void 0)), liveEventHandler(() => internalProps.onKeyUp), liveEventHandler(() => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyUp)));
|
|
1556
|
+
const onMouseDown = composeEventHandlers(liveEventHandler(() => untrack(() => disabled() ? stopButtonInteraction : void 0)), liveEventHandler(() => internalProps.onMouseDown), handleMouseDown);
|
|
1557
|
+
const onPointerDown = composeEventHandlers(liveEventHandler(() => untrack(() => disabled() ? preventButtonInteraction : void 0)), liveEventHandler(() => internalProps.onPointerDown), handlePointerDown);
|
|
1558
|
+
const onPointerEnter = composeEventHandlers(liveEventHandler(() => internalProps.onPointerEnter), (event) => {
|
|
1540
1559
|
pointerType = event.pointerType || "";
|
|
1541
1560
|
});
|
|
1542
1561
|
createEffect(() => ({
|
|
@@ -1593,6 +1612,9 @@ function ComboboxTrigger(props) {
|
|
|
1593
1612
|
get ["aria-labelledby"]() {
|
|
1594
1613
|
return ariaLabelledBy();
|
|
1595
1614
|
},
|
|
1615
|
+
get ["aria-describedby"]() {
|
|
1616
|
+
return ariaDescribedBy();
|
|
1617
|
+
},
|
|
1596
1618
|
get ["aria-invalid"]() {
|
|
1597
1619
|
return state().valid === false && !disabled() ? "true" : void 0;
|
|
1598
1620
|
},
|
|
@@ -1770,7 +1792,11 @@ function ComboboxInput(props) {
|
|
|
1770
1792
|
const activeIndex = context.store.activeIndex();
|
|
1771
1793
|
return activeIndex == null ? void 0 : `${context.id()}-${activeIndex}`;
|
|
1772
1794
|
});
|
|
1773
|
-
const
|
|
1795
|
+
const ariaDescribedBy = createMemo(() => {
|
|
1796
|
+
const external = internalProps["aria-describedby"];
|
|
1797
|
+
return hasPositionerParent || external === false ? external : labelable.getAriaDescribedBy(external);
|
|
1798
|
+
});
|
|
1799
|
+
const others = omit(allProps, "aria-describedby", "render", "class", "disabled", "id", "onBlur", "onCompositionEnd", "onCompositionStart", "onFocus", "onInput", "onKeyDown", "onMouseDown", "onPointerDown", "onPointerMove", "ref", "style");
|
|
1774
1800
|
function clearHighlight() {
|
|
1775
1801
|
context.setIndices({
|
|
1776
1802
|
activeIndex: null,
|
|
@@ -1807,6 +1833,14 @@ function ComboboxInput(props) {
|
|
|
1807
1833
|
const next = event.currentTarget.value;
|
|
1808
1834
|
setComposingValue(null);
|
|
1809
1835
|
context.setInputValue(next, createChangeEventDetails(inputChange, event));
|
|
1836
|
+
restoreAcceptedInputValue(event.currentTarget);
|
|
1837
|
+
}
|
|
1838
|
+
function restoreAcceptedInputValue(input) {
|
|
1839
|
+
queueMicrotask(() => untrack(() => {
|
|
1840
|
+
if (composing || context.inputElement() !== input) return;
|
|
1841
|
+
const accepted = context.inputValue();
|
|
1842
|
+
if (input.value !== accepted) input.value = accepted;
|
|
1843
|
+
}));
|
|
1810
1844
|
}
|
|
1811
1845
|
function maybeOpenOnInput(trimmed, event, shouldOpen) {
|
|
1812
1846
|
if (context.readOnly() || disabled() || !trimmed || !shouldOpen) return;
|
|
@@ -1841,6 +1875,7 @@ function ComboboxInput(props) {
|
|
|
1841
1875
|
}
|
|
1842
1876
|
maybeOpenOnInput(input.value.trim(), event, shouldOpenOnInput);
|
|
1843
1877
|
if (context.store.open() && context.store.activeIndex() !== null && !context.autoHighlight()) clearHighlight();
|
|
1878
|
+
restoreAcceptedInputValue(input);
|
|
1844
1879
|
}
|
|
1845
1880
|
/** Chip highlight movement driven from the input, which owns real focus. */
|
|
1846
1881
|
function resolveChipIndex(event) {
|
|
@@ -1901,7 +1936,7 @@ function ComboboxInput(props) {
|
|
|
1901
1936
|
event.stopPropagation();
|
|
1902
1937
|
const scrollAmount = input.scrollWidth - input.clientWidth;
|
|
1903
1938
|
const atStart = event.key === "Home";
|
|
1904
|
-
const cursor = isGecko() && isRTL
|
|
1939
|
+
const cursor = (isGecko() && isRTL ? !atStart : atStart) ? 0 : input.value.length;
|
|
1905
1940
|
input.setSelectionRange(cursor, cursor);
|
|
1906
1941
|
input.scrollLeft = atStart ? 0 : isRTL ? -scrollAmount : scrollAmount;
|
|
1907
1942
|
return;
|
|
@@ -1941,18 +1976,18 @@ function ComboboxInput(props) {
|
|
|
1941
1976
|
function markPointerActive() {
|
|
1942
1977
|
context.store.keyboardActive = false;
|
|
1943
1978
|
}
|
|
1944
|
-
const onBlur = composeEventHandlers(() => internalProps.onBlur,
|
|
1945
|
-
const onCompositionEnd = composeEventHandlers(() => internalProps.onCompositionEnd,
|
|
1946
|
-
const onCompositionStart = composeEventHandlers(() => internalProps.onCompositionStart,
|
|
1947
|
-
const onFocus = composeEventHandlers(() => internalProps.onFocus,
|
|
1948
|
-
const onInput = composeEventHandlers(() => internalProps.onInput,
|
|
1949
|
-
const onKeyDown = composeEventHandlers(() => internalProps.onKeyDown,
|
|
1950
|
-
const onMouseDown = composeEventHandlers(() => internalProps.onMouseDown, (
|
|
1951
|
-
const onPointerDown = composeEventHandlers(() => internalProps.onPointerDown, (
|
|
1979
|
+
const onBlur = composeEventHandlers(liveEventHandler(() => internalProps.onBlur), handleBlur);
|
|
1980
|
+
const onCompositionEnd = composeEventHandlers(liveEventHandler(() => internalProps.onCompositionEnd), handleCompositionEnd);
|
|
1981
|
+
const onCompositionStart = composeEventHandlers(liveEventHandler(() => internalProps.onCompositionStart), handleCompositionStart);
|
|
1982
|
+
const onFocus = composeEventHandlers(liveEventHandler(() => internalProps.onFocus), handleFocus);
|
|
1983
|
+
const onInput = composeEventHandlers(liveEventHandler(() => internalProps.onInput), handleInput);
|
|
1984
|
+
const onKeyDown = composeEventHandlers(liveEventHandler(() => internalProps.onKeyDown), handleKeyDown);
|
|
1985
|
+
const onMouseDown = composeEventHandlers(liveEventHandler(() => internalProps.onMouseDown), (event) => context.click.onMouseDown(event));
|
|
1986
|
+
const onPointerDown = composeEventHandlers(liveEventHandler(() => internalProps.onPointerDown), (event) => {
|
|
1952
1987
|
markPointerActive();
|
|
1953
1988
|
context.click.onPointerDown(event);
|
|
1954
1989
|
});
|
|
1955
|
-
const onPointerMove = composeEventHandlers(() => internalProps.onPointerMove,
|
|
1990
|
+
const onPointerMove = composeEventHandlers(liveEventHandler(() => internalProps.onPointerMove), markPointerActive);
|
|
1956
1991
|
createEffect(() => ({
|
|
1957
1992
|
insidePopup: insidePopup(),
|
|
1958
1993
|
owns: inputOwnsFormValue()
|
|
@@ -1966,6 +2001,14 @@ function ComboboxInput(props) {
|
|
|
1966
2001
|
});
|
|
1967
2002
|
let element = null;
|
|
1968
2003
|
const Render = useRender(props, () => state(), (props) => ssrElement("input", props, void 0, true));
|
|
2004
|
+
const InputScope = (props) => hasPositionerParent ? FieldRootContext({
|
|
2005
|
+
value: DEFAULT_FIELD_ROOT_CONTEXT,
|
|
2006
|
+
get children() {
|
|
2007
|
+
return props.children;
|
|
2008
|
+
}
|
|
2009
|
+
}) : memo(() => {
|
|
2010
|
+
return escape(props.children);
|
|
2011
|
+
});
|
|
1969
2012
|
return [Show({
|
|
1970
2013
|
get when() {
|
|
1971
2014
|
return memo(() => {
|
|
@@ -1977,73 +2020,75 @@ function ComboboxInput(props) {
|
|
|
1977
2020
|
context.store.startDismissElement = node;
|
|
1978
2021
|
} });
|
|
1979
2022
|
}
|
|
1980
|
-
}),
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
return
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
return
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2023
|
+
}), InputScope({ get children() {
|
|
2024
|
+
return Render(mergeProps({
|
|
2025
|
+
ref: [((value) => {
|
|
2026
|
+
element = value;
|
|
2027
|
+
context.setInputElement(value);
|
|
2028
|
+
}), internalProps.ref],
|
|
2029
|
+
get id() {
|
|
2030
|
+
return id();
|
|
2031
|
+
},
|
|
2032
|
+
get value() {
|
|
2033
|
+
return composingValue() ?? context.inputValue();
|
|
2034
|
+
},
|
|
2035
|
+
get disabled() {
|
|
2036
|
+
return disabled();
|
|
2037
|
+
},
|
|
2038
|
+
get readonly() {
|
|
2039
|
+
return context.readOnly();
|
|
2040
|
+
},
|
|
2041
|
+
get required() {
|
|
2042
|
+
return memo(() => {
|
|
2043
|
+
return context.selectionMode() === "none";
|
|
2044
|
+
})() ? context.required() : void 0;
|
|
2045
|
+
},
|
|
2046
|
+
get form() {
|
|
2047
|
+
return context.form();
|
|
2048
|
+
},
|
|
2049
|
+
get name() {
|
|
2050
|
+
return memo(() => {
|
|
2051
|
+
return !!inputOwnsFormValue();
|
|
2052
|
+
})() ? context.name() : void 0;
|
|
2053
|
+
},
|
|
2054
|
+
get ["aria-readonly"]() {
|
|
2055
|
+
return context.readOnly() ? "true" : void 0;
|
|
2056
|
+
},
|
|
2057
|
+
get ["aria-required"]() {
|
|
2058
|
+
return context.required() ? "true" : void 0;
|
|
2059
|
+
},
|
|
2060
|
+
get ["aria-labelledby"]() {
|
|
2061
|
+
return labelable.labelId();
|
|
2062
|
+
},
|
|
2063
|
+
get ["aria-describedby"]() {
|
|
2064
|
+
return ariaDescribedBy();
|
|
2065
|
+
},
|
|
2066
|
+
get ["aria-activedescendant"]() {
|
|
2067
|
+
return activeDescendant();
|
|
2068
|
+
},
|
|
2069
|
+
get ["aria-invalid"]() {
|
|
2070
|
+
return state().valid === false && !disabled() ? "true" : void 0;
|
|
2071
|
+
},
|
|
2072
|
+
"data-base-ui-click-trigger": "",
|
|
2073
|
+
get ["class"]() {
|
|
2074
|
+
return classValue();
|
|
2075
|
+
},
|
|
2076
|
+
get style() {
|
|
2077
|
+
return styleValue();
|
|
2078
|
+
},
|
|
2079
|
+
onBlur,
|
|
2080
|
+
onCompositionEnd,
|
|
2081
|
+
onCompositionStart,
|
|
2082
|
+
onFocus,
|
|
2083
|
+
onInput,
|
|
2084
|
+
onKeyDown,
|
|
2085
|
+
onMouseDown,
|
|
2086
|
+
onPointerDown,
|
|
2087
|
+
onPointerMove
|
|
2088
|
+
}, () => {
|
|
2089
|
+
return context.referenceAria();
|
|
2090
|
+
}, stateAttributes, others));
|
|
2091
|
+
} })];
|
|
2047
2092
|
}
|
|
2048
2093
|
function isGecko() {
|
|
2049
2094
|
return typeof navigator !== "undefined" && navigator.userAgent.includes("Firefox");
|
|
@@ -2054,8 +2099,8 @@ function isGecko() {
|
|
|
2054
2099
|
* Routes a press anywhere in the input's surroundings back to the input, so clicking the padding
|
|
2055
2100
|
* of an input group or the empty space beside the chips focuses and opens the combobox.
|
|
2056
2101
|
*/
|
|
2057
|
-
function handleInputPress(event, context, disabled,
|
|
2058
|
-
if (event.baseUIHandlerPrevented
|
|
2102
|
+
function handleInputPress(event, context, disabled, shouldIgnoreTarget) {
|
|
2103
|
+
if (event.baseUIHandlerPrevented) return;
|
|
2059
2104
|
const target = event.target;
|
|
2060
2105
|
const targetElement = isElement(target) ? target : null;
|
|
2061
2106
|
if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) return;
|
|
@@ -2084,7 +2129,7 @@ function ComboboxInputGroup(props) {
|
|
|
2084
2129
|
const styleValue = createMemo(() => resolveStyle(props.style, state()));
|
|
2085
2130
|
const stateAttributes = createMemo(() => getStateAttributesProps(state(), comboboxControlStateMapping));
|
|
2086
2131
|
const others = omit(allProps, "render", "class", "onMouseDown", "ref", "style");
|
|
2087
|
-
const onMouseDown = composeEventHandlers(() => internalProps.onMouseDown, (
|
|
2132
|
+
const onMouseDown = composeEventHandlers(liveEventHandler(() => internalProps.onMouseDown), (event) => handleInputPress(event, context, context.disabled(), (target) => contains(context.store.chipsContainerElement, target)));
|
|
2088
2133
|
onCleanup(() => {
|
|
2089
2134
|
if (untrack(context.inputGroupElement) === element) context.setInputGroupElement(null);
|
|
2090
2135
|
});
|
|
@@ -2174,7 +2219,7 @@ function ComboboxClear(props) {
|
|
|
2174
2219
|
const type = context.store.keyboardActive ? keyboard : pointer;
|
|
2175
2220
|
context.setInputValue("", createChangeEventDetails(clearPress, event));
|
|
2176
2221
|
if (context.selectionMode() !== "none") {
|
|
2177
|
-
context.setSelectedValue(
|
|
2222
|
+
context.setSelectedValue(context.multiple() ? [] : null, createChangeEventDetails(clearPress, event));
|
|
2178
2223
|
context.setIndices({
|
|
2179
2224
|
activeIndex: null,
|
|
2180
2225
|
selectedIndex: null,
|
|
@@ -2186,10 +2231,10 @@ function ComboboxClear(props) {
|
|
|
2186
2231
|
});
|
|
2187
2232
|
context.focusInput();
|
|
2188
2233
|
}
|
|
2189
|
-
const onClick = composeEventHandlers(() => untrack(() => disabled() ? preventButtonInteraction : void 0), () => internalProps.onClick,
|
|
2190
|
-
const onKeyDown = composeEventHandlers(() => internalProps.onKeyDown, () => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyDown));
|
|
2191
|
-
const onKeyUp = composeEventHandlers(() => untrack(() => disabled() ? stopButtonInteraction : void 0), () => internalProps.onKeyUp, () => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyUp));
|
|
2192
|
-
const onMouseDown = composeEventHandlers(() => internalProps.onMouseDown, (
|
|
2234
|
+
const onClick = composeEventHandlers(liveEventHandler(() => untrack(() => disabled() ? preventButtonInteraction : void 0)), liveEventHandler(() => internalProps.onClick), handleClick);
|
|
2235
|
+
const onKeyDown = composeEventHandlers(liveEventHandler(() => internalProps.onKeyDown), liveEventHandler(() => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyDown)));
|
|
2236
|
+
const onKeyUp = composeEventHandlers(liveEventHandler(() => untrack(() => disabled() ? stopButtonInteraction : void 0)), liveEventHandler(() => internalProps.onKeyUp), liveEventHandler(() => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyUp)));
|
|
2237
|
+
const onMouseDown = composeEventHandlers(liveEventHandler(() => internalProps.onMouseDown), (event) => event.preventDefault());
|
|
2193
2238
|
const Render = useRender(props, () => state(), (props) => ssrElement("button", props, void 0, true));
|
|
2194
2239
|
return Show({
|
|
2195
2240
|
get when() {
|
|
@@ -2276,7 +2321,7 @@ function ComboboxList(props) {
|
|
|
2276
2321
|
event.stopPropagation();
|
|
2277
2322
|
context.clickHighlightedItem(activeIndex, event);
|
|
2278
2323
|
}
|
|
2279
|
-
const onKeyDown = composeEventHandlers(() => internalProps.onKeyDown,
|
|
2324
|
+
const onKeyDown = composeEventHandlers(liveEventHandler(() => internalProps.onKeyDown), handleKeyDown);
|
|
2280
2325
|
const [listElement, setListElement] = createSignal(null, { ownedWrite: true });
|
|
2281
2326
|
createEffect(listElement, (element) => {
|
|
2282
2327
|
if (!element) return;
|
|
@@ -2300,7 +2345,7 @@ function ComboboxList(props) {
|
|
|
2300
2345
|
});
|
|
2301
2346
|
const children = createMemo(() => {
|
|
2302
2347
|
const child = props.children;
|
|
2303
|
-
if (typeof child === "function" && !isSolidAccessor(child)) return ComboboxCollection({ children: child });
|
|
2348
|
+
if (typeof child === "function" && !isSolidAccessor(child) && !("$ll" in child)) return ComboboxCollection({ children: child });
|
|
2304
2349
|
return child;
|
|
2305
2350
|
});
|
|
2306
2351
|
return useRender(props, () => state(), (props) => ssrElement("div", props, void 0, true))(mergeProps({
|
|
@@ -2893,8 +2938,7 @@ function ComboboxItem(props) {
|
|
|
2893
2938
|
const declaredIndex = createMemo(() => {
|
|
2894
2939
|
if (internalProps.index != null) return internalProps.index;
|
|
2895
2940
|
if (!context.virtualized()) return;
|
|
2896
|
-
|
|
2897
|
-
return derived === -1 ? void 0 : derived;
|
|
2941
|
+
return findItemIndex(context.itemValues(), itemValue(), context.comparator());
|
|
2898
2942
|
});
|
|
2899
2943
|
const unregister = context.store.collection.register({
|
|
2900
2944
|
token,
|
|
@@ -2909,7 +2953,7 @@ function ComboboxItem(props) {
|
|
|
2909
2953
|
const selected = createMemo(() => {
|
|
2910
2954
|
if (!selectable()) return false;
|
|
2911
2955
|
const current = context.selectedValue();
|
|
2912
|
-
if (Array.isArray(current)) return selectedValueIncludes(current, itemValue(), context.comparator());
|
|
2956
|
+
if (context.multiple() && Array.isArray(current)) return selectedValueIncludes(current, itemValue(), context.comparator());
|
|
2913
2957
|
return compareItemEquality(itemValue(), current, context.comparator());
|
|
2914
2958
|
});
|
|
2915
2959
|
const highlighted = createMemo(() => context.store.activeIndex() === index());
|
|
@@ -2951,19 +2995,19 @@ function ComboboxItem(props) {
|
|
|
2951
2995
|
function handlePointerMove(event) {
|
|
2952
2996
|
if (event.pointerType === "touch") return;
|
|
2953
2997
|
context.store.keyboardActive = false;
|
|
2954
|
-
if (disabled()) return;
|
|
2998
|
+
if (disabled() || !hasRegistered()) return;
|
|
2955
2999
|
context.listNavigation.onItemPointerMove(event, index());
|
|
2956
3000
|
}
|
|
2957
3001
|
function handlePointerLeave(event) {
|
|
2958
3002
|
if (context.keepHighlight()) return;
|
|
2959
3003
|
context.listNavigation.onItemPointerLeave(event);
|
|
2960
3004
|
}
|
|
2961
|
-
const onClick = composeEventHandlers(() => untrack(() => disabled() ? preventButtonInteraction : void 0), () => internalProps.onClick,
|
|
2962
|
-
const onMouseDown = composeEventHandlers(() => internalProps.onMouseDown,
|
|
2963
|
-
const onMouseUp = composeEventHandlers(() => internalProps.onMouseUp,
|
|
2964
|
-
const onPointerDown = composeEventHandlers(() => internalProps.onPointerDown,
|
|
2965
|
-
const onPointerMove = composeEventHandlers(() => internalProps.onPointerMove,
|
|
2966
|
-
const onPointerLeave = composeEventHandlers(() => internalProps.onPointerLeave,
|
|
3005
|
+
const onClick = composeEventHandlers(liveEventHandler(() => untrack(() => disabled() ? preventButtonInteraction : void 0)), liveEventHandler(() => internalProps.onClick), handleClick);
|
|
3006
|
+
const onMouseDown = composeEventHandlers(liveEventHandler(() => internalProps.onMouseDown), handleMouseDown);
|
|
3007
|
+
const onMouseUp = composeEventHandlers(liveEventHandler(() => internalProps.onMouseUp), handleMouseUp);
|
|
3008
|
+
const onPointerDown = composeEventHandlers(liveEventHandler(() => internalProps.onPointerDown), handlePointerDown);
|
|
3009
|
+
const onPointerMove = composeEventHandlers(liveEventHandler(() => internalProps.onPointerMove), handlePointerMove);
|
|
3010
|
+
const onPointerLeave = composeEventHandlers(liveEventHandler(() => internalProps.onPointerLeave), handlePointerLeave);
|
|
2967
3011
|
createEffect(() => ({
|
|
2968
3012
|
registered: hasRegistered(),
|
|
2969
3013
|
hasItems: context.hasItems(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ComponentProps, JSX, ValidComponent } from
|
|
2
|
-
import { type BaseUIEventHandlerUnion } from
|
|
3
|
-
import type { BaseUIComponentProps } from
|
|
4
|
-
import type { AccordionItemState } from
|
|
1
|
+
import type { ComponentProps, JSX, ValidComponent } from "@solidjs/web";
|
|
2
|
+
import { type BaseUIEventHandlerUnion } from "../../internals/composeEventHandlers.js";
|
|
3
|
+
import type { BaseUIComponentProps } from "../../types/index.js";
|
|
4
|
+
import type { AccordionItemState } from "../item/AccordionItem.js";
|
|
5
5
|
export interface AccordionTriggerState extends AccordionItemState {
|
|
6
6
|
}
|
|
7
7
|
type TriggerEventTarget<Component extends ValidComponent> = ComponentProps<Component> extends {
|
|
@@ -17,11 +17,11 @@ interface AccordionTriggerOwnProps<Component extends ValidComponent> {
|
|
|
17
17
|
onMouseUp?: BaseUIEventHandlerUnion<TriggerEventTarget<Component>, MouseEvent> | undefined;
|
|
18
18
|
onPointerDown?: BaseUIEventHandlerUnion<TriggerEventTarget<Component>, PointerEvent> | undefined;
|
|
19
19
|
}
|
|
20
|
-
export type AccordionTriggerProps<Component extends ValidComponent =
|
|
20
|
+
export type AccordionTriggerProps<Component extends ValidComponent = "button"> = BaseUIComponentProps<Component, AccordionTriggerState, AccordionTriggerOwnProps<Component>>;
|
|
21
21
|
/** A button that opens and closes the corresponding panel. */
|
|
22
|
-
export declare function AccordionTrigger<Component extends ValidComponent =
|
|
22
|
+
export declare function AccordionTrigger<Component extends ValidComponent = "button">(props: AccordionTrigger.Props<Component>): JSX.Element;
|
|
23
23
|
export declare namespace AccordionTrigger {
|
|
24
24
|
type State = AccordionTriggerState;
|
|
25
|
-
type Props<Component extends ValidComponent =
|
|
25
|
+
type Props<Component extends ValidComponent = "button"> = AccordionTriggerProps<Component>;
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
@@ -5,7 +5,9 @@ export interface ComboboxChipState {
|
|
|
5
5
|
disabled: boolean;
|
|
6
6
|
}
|
|
7
7
|
interface ComboboxChipOwnProps {
|
|
8
|
+
onContextMenu?: BaseUIEventHandlerUnion<HTMLElement, MouseEvent> | undefined;
|
|
8
9
|
onKeyDown?: BaseUIEventHandlerUnion<HTMLElement, KeyboardEvent> | undefined;
|
|
10
|
+
onMouseDown?: BaseUIEventHandlerUnion<HTMLElement, MouseEvent> | undefined;
|
|
9
11
|
}
|
|
10
12
|
export type ComboboxChipProps<Component extends ValidComponent = 'div'> = BaseUIComponentProps<Component, ComboboxChipState, ComboboxChipOwnProps>;
|
|
11
13
|
/** An individual chip representing one value in a multiselectable input. */
|