@proyecto-viviana/solidaria 0.2.1 → 0.2.3
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/autocomplete/createAutocomplete.d.ts +2 -2
- package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
- package/dist/index.js +233 -234
- package/dist/index.js.map +2 -2
- package/dist/index.ssr.js +233 -234
- package/dist/index.ssr.js.map +2 -2
- package/dist/interactions/PressEvent.d.ts +13 -10
- package/dist/interactions/PressEvent.d.ts.map +1 -1
- package/dist/interactions/createPress.d.ts.map +1 -1
- package/dist/interactions/index.d.ts +1 -1
- package/dist/interactions/index.d.ts.map +1 -1
- package/dist/select/createHiddenSelect.d.ts.map +1 -1
- package/dist/toolbar/createToolbar.d.ts.map +1 -1
- package/dist/tooltip/createTooltipTrigger.d.ts.map +1 -1
- package/package.json +9 -7
- package/src/autocomplete/createAutocomplete.ts +341 -0
- package/src/autocomplete/index.ts +9 -0
- package/src/breadcrumbs/createBreadcrumbs.ts +196 -0
- package/src/breadcrumbs/index.ts +8 -0
- package/src/button/createButton.ts +142 -0
- package/src/button/createToggleButton.ts +101 -0
- package/src/button/index.ts +4 -0
- package/src/button/types.ts +78 -0
- package/src/calendar/createCalendar.ts +138 -0
- package/src/calendar/createCalendarCell.ts +187 -0
- package/src/calendar/createCalendarGrid.ts +140 -0
- package/src/calendar/createRangeCalendar.ts +136 -0
- package/src/calendar/createRangeCalendarCell.ts +186 -0
- package/src/calendar/index.ts +34 -0
- package/src/checkbox/createCheckbox.ts +135 -0
- package/src/checkbox/createCheckboxGroup.ts +137 -0
- package/src/checkbox/createCheckboxGroupItem.ts +117 -0
- package/src/checkbox/createCheckboxGroupState.ts +193 -0
- package/src/checkbox/index.ts +13 -0
- package/src/color/createColorArea.ts +314 -0
- package/src/color/createColorField.ts +137 -0
- package/src/color/createColorSlider.ts +197 -0
- package/src/color/createColorSwatch.ts +40 -0
- package/src/color/createColorWheel.ts +208 -0
- package/src/color/index.ts +24 -0
- package/src/color/types.ts +116 -0
- package/src/combobox/createComboBox.ts +647 -0
- package/src/combobox/index.ts +6 -0
- package/src/combobox/intl/en-US.json +7 -0
- package/src/combobox/intl/es-ES.json +7 -0
- package/src/combobox/intl/index.ts +23 -0
- package/src/datepicker/createDateField.ts +154 -0
- package/src/datepicker/createDatePicker.ts +206 -0
- package/src/datepicker/createDateSegment.ts +229 -0
- package/src/datepicker/createTimeField.ts +154 -0
- package/src/datepicker/index.ts +28 -0
- package/src/dialog/createDialog.ts +120 -0
- package/src/dialog/index.ts +2 -0
- package/src/dialog/types.ts +19 -0
- package/src/disclosure/createDisclosure.ts +131 -0
- package/src/disclosure/createDisclosureGroup.ts +62 -0
- package/src/disclosure/index.ts +11 -0
- package/src/dnd/createDrag.ts +209 -0
- package/src/dnd/createDraggableCollection.ts +63 -0
- package/src/dnd/createDraggableItem.ts +243 -0
- package/src/dnd/createDrop.ts +321 -0
- package/src/dnd/createDroppableCollection.ts +293 -0
- package/src/dnd/createDroppableItem.ts +213 -0
- package/src/dnd/index.ts +47 -0
- package/src/dnd/types.ts +89 -0
- package/src/dnd/utils.ts +294 -0
- package/src/focus/FocusScope.tsx +408 -0
- package/src/focus/createAutoFocus.ts +321 -0
- package/src/focus/createFocusRestore.ts +313 -0
- package/src/focus/createVirtualFocus.ts +396 -0
- package/src/focus/index.ts +35 -0
- package/src/form/createFormReset.ts +51 -0
- package/src/form/createFormValidation.ts +224 -0
- package/src/form/index.ts +11 -0
- package/src/grid/GridKeyboardDelegate.ts +429 -0
- package/src/grid/createGrid.ts +261 -0
- package/src/grid/createGridCell.ts +182 -0
- package/src/grid/createGridRow.ts +153 -0
- package/src/grid/index.ts +18 -0
- package/src/grid/types.ts +133 -0
- package/src/gridlist/createGridList.ts +185 -0
- package/src/gridlist/createGridListItem.ts +180 -0
- package/src/gridlist/createGridListSelectionCheckbox.ts +59 -0
- package/src/gridlist/index.ts +16 -0
- package/src/gridlist/types.ts +81 -0
- package/src/i18n/NumberFormatter.ts +266 -0
- package/src/i18n/createCollator.ts +79 -0
- package/src/i18n/createDateFormatter.ts +83 -0
- package/src/i18n/createFilter.ts +131 -0
- package/src/i18n/createNumberFormatter.ts +52 -0
- package/src/i18n/createStringFormatter.ts +87 -0
- package/src/i18n/index.ts +40 -0
- package/src/i18n/locale.tsx +188 -0
- package/src/i18n/utils.ts +99 -0
- package/src/index.ts +670 -0
- package/src/interactions/FocusableProvider.tsx +44 -0
- package/src/interactions/PressEvent.ts +126 -0
- package/src/interactions/createFocus.ts +163 -0
- package/src/interactions/createFocusRing.ts +89 -0
- package/src/interactions/createFocusWithin.ts +206 -0
- package/src/interactions/createFocusable.ts +168 -0
- package/src/interactions/createHover.ts +254 -0
- package/src/interactions/createInteractionModality.ts +424 -0
- package/src/interactions/createKeyboard.ts +82 -0
- package/src/interactions/createLongPress.ts +174 -0
- package/src/interactions/createMove.ts +289 -0
- package/src/interactions/createPress.ts +834 -0
- package/src/interactions/index.ts +78 -0
- package/src/label/createField.ts +145 -0
- package/src/label/createLabel.ts +117 -0
- package/src/label/createLabels.ts +50 -0
- package/src/label/index.ts +19 -0
- package/src/landmark/createLandmark.ts +377 -0
- package/src/landmark/index.ts +8 -0
- package/src/link/createLink.ts +182 -0
- package/src/link/index.ts +1 -0
- package/src/listbox/createListBox.ts +269 -0
- package/src/listbox/createOption.ts +151 -0
- package/src/listbox/index.ts +12 -0
- package/src/live-announcer/announce.ts +322 -0
- package/src/live-announcer/index.ts +9 -0
- package/src/menu/createMenu.ts +396 -0
- package/src/menu/createMenuItem.ts +149 -0
- package/src/menu/createMenuTrigger.ts +88 -0
- package/src/menu/index.ts +18 -0
- package/src/meter/createMeter.ts +75 -0
- package/src/meter/index.ts +1 -0
- package/src/numberfield/createNumberField.ts +268 -0
- package/src/numberfield/index.ts +5 -0
- package/src/overlays/ariaHideOutside.ts +219 -0
- package/src/overlays/createInteractOutside.ts +149 -0
- package/src/overlays/createModal.tsx +202 -0
- package/src/overlays/createOverlay.ts +155 -0
- package/src/overlays/createOverlayTrigger.ts +85 -0
- package/src/overlays/createPreventScroll.ts +266 -0
- package/src/overlays/index.ts +44 -0
- package/src/popover/calculatePosition.ts +766 -0
- package/src/popover/createOverlayPosition.ts +356 -0
- package/src/popover/createPopover.ts +170 -0
- package/src/popover/index.ts +24 -0
- package/src/progress/createProgressBar.ts +128 -0
- package/src/progress/index.ts +5 -0
- package/src/radio/createRadio.ts +287 -0
- package/src/radio/createRadioGroup.ts +189 -0
- package/src/radio/createRadioGroupState.ts +201 -0
- package/src/radio/index.ts +23 -0
- package/src/searchfield/createSearchField.ts +186 -0
- package/src/searchfield/index.ts +2 -0
- package/src/select/createHiddenSelect.tsx +236 -0
- package/src/select/createSelect.ts +395 -0
- package/src/select/index.ts +14 -0
- package/src/selection/createTypeSelect.ts +201 -0
- package/src/selection/index.ts +6 -0
- package/src/separator/createSeparator.ts +82 -0
- package/src/separator/index.ts +6 -0
- package/src/slider/createSlider.ts +349 -0
- package/src/slider/index.ts +2 -0
- package/src/ssr/index.tsx +370 -0
- package/src/switch/createSwitch.ts +70 -0
- package/src/switch/index.ts +1 -0
- package/src/table/createTable.ts +526 -0
- package/src/table/createTableCell.ts +147 -0
- package/src/table/createTableColumnHeader.ts +115 -0
- package/src/table/createTableHeaderRow.ts +40 -0
- package/src/table/createTableRow.ts +155 -0
- package/src/table/createTableRowGroup.ts +32 -0
- package/src/table/createTableSelectAllCheckbox.ts +73 -0
- package/src/table/createTableSelectionCheckbox.ts +59 -0
- package/src/table/index.ts +30 -0
- package/src/table/types.ts +165 -0
- package/src/tabs/createTabs.ts +472 -0
- package/src/tabs/index.ts +14 -0
- package/src/tag/createTag.ts +194 -0
- package/src/tag/createTagGroup.ts +154 -0
- package/src/tag/index.ts +12 -0
- package/src/textfield/createTextField.ts +198 -0
- package/src/textfield/index.ts +5 -0
- package/src/toast/createToast.ts +118 -0
- package/src/toast/createToastRegion.ts +100 -0
- package/src/toast/index.ts +11 -0
- package/src/toggle/createToggle.ts +223 -0
- package/src/toggle/createToggleState.ts +94 -0
- package/src/toggle/index.ts +7 -0
- package/src/toolbar/createToolbar.ts +369 -0
- package/src/toolbar/index.ts +6 -0
- package/src/tooltip/createTooltip.ts +79 -0
- package/src/tooltip/createTooltipTrigger.ts +222 -0
- package/src/tooltip/index.ts +6 -0
- package/src/tree/createTree.ts +246 -0
- package/src/tree/createTreeItem.ts +233 -0
- package/src/tree/createTreeSelectionCheckbox.ts +68 -0
- package/src/tree/index.ts +16 -0
- package/src/tree/types.ts +87 -0
- package/src/utils/createDescription.ts +137 -0
- package/src/utils/dom.ts +327 -0
- package/src/utils/env.ts +54 -0
- package/src/utils/events.ts +106 -0
- package/src/utils/filterDOMProps.ts +116 -0
- package/src/utils/focus.ts +151 -0
- package/src/utils/geometry.ts +115 -0
- package/src/utils/globalListeners.ts +142 -0
- package/src/utils/index.ts +80 -0
- package/src/utils/mergeProps.ts +52 -0
- package/src/utils/platform.ts +52 -0
- package/src/utils/reactivity.ts +36 -0
- package/src/utils/textSelection.ts +114 -0
- package/src/visually-hidden/createVisuallyHidden.ts +124 -0
- package/src/visually-hidden/index.ts +6 -0
|
@@ -4,13 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';
|
|
6
6
|
export type PressEventType = 'pressstart' | 'pressend' | 'pressup' | 'press';
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Minimal event data needed to create a PressEvent.
|
|
9
|
+
* Allows both native Event objects and synthetic event-like objects.
|
|
10
|
+
*/
|
|
11
|
+
export interface PressEventSource {
|
|
12
|
+
currentTarget?: EventTarget | null;
|
|
13
|
+
shiftKey?: boolean;
|
|
14
|
+
ctrlKey?: boolean;
|
|
15
|
+
metaKey?: boolean;
|
|
16
|
+
altKey?: boolean;
|
|
14
17
|
clientX?: number;
|
|
15
18
|
clientY?: number;
|
|
16
19
|
}
|
|
@@ -54,7 +57,7 @@ export declare class PressEvent implements IPressEvent {
|
|
|
54
57
|
altKey: boolean;
|
|
55
58
|
x: number;
|
|
56
59
|
y: number;
|
|
57
|
-
constructor(type: PressEventType, pointerType: PointerType, originalEvent:
|
|
60
|
+
constructor(type: PressEventType, pointerType: PointerType, originalEvent: PressEventSource | null, target: Element | null);
|
|
58
61
|
/**
|
|
59
62
|
* Call this to allow the press event to propagate to parent elements.
|
|
60
63
|
* By default, press events stop propagation.
|
|
@@ -67,7 +70,7 @@ export declare class PressEvent implements IPressEvent {
|
|
|
67
70
|
get shouldStopPropagation(): boolean;
|
|
68
71
|
}
|
|
69
72
|
/**
|
|
70
|
-
* Creates a PressEvent from a native event.
|
|
73
|
+
* Creates a PressEvent from a native event or event-like source.
|
|
71
74
|
*/
|
|
72
|
-
export declare function createPressEvent(type: PressEventType, pointerType: PointerType, originalEvent:
|
|
75
|
+
export declare function createPressEvent(type: PressEventType, pointerType: PointerType, originalEvent: PressEventSource | null, target: Element | null): PressEvent;
|
|
73
76
|
//# sourceMappingURL=PressEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PressEvent.d.ts","sourceRoot":"","sources":["../../src/interactions/PressEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AAE7E
|
|
1
|
+
{"version":3,"file":"PressEvent.d.ts","sourceRoot":"","sources":["../../src/interactions/PressEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,IAAI,EAAE,cAAc,CAAC;IACrB,uDAAuD;IACvD,WAAW,EAAE,WAAW,CAAC;IACzB,6CAA6C;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,OAAO,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,OAAO,EAAE,OAAO,CAAC;IACjB,yEAAyE;IACzE,MAAM,EAAE,OAAO,CAAC;IAChB,8DAA8D;IAC9D,CAAC,EAAE,MAAM,CAAC;IACV,8DAA8D;IAC9D,CAAC,EAAE,MAAM,CAAC;IACV;;;OAGG;IACH,mBAAmB,IAAI,IAAI,CAAC;CAC7B;AAED;;;GAGG;AACH,qBAAa,UAAW,YAAW,WAAW;;IAC5C,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;gBAKR,IAAI,EAAE,cAAc,EACpB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,gBAAgB,GAAG,IAAI,EACtC,MAAM,EAAE,OAAO,GAAG,IAAI;IA6BxB;;;OAGG;IACH,mBAAmB,IAAI,IAAI;IAI3B;;;OAGG;IACH,IAAI,qBAAqB,IAAI,OAAO,CAEnC;CACF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,cAAc,EACpB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,gBAAgB,GAAG,IAAI,EACtC,MAAM,EAAE,OAAO,GAAG,IAAI,GACrB,UAAU,CAEZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPress.d.ts","sourceRoot":"","sources":["../../src/interactions/createPress.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAgB,GAAG,EAAE,QAAQ,EAAa,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"createPress.d.ts","sourceRoot":"","sources":["../../src/interactions/createPress.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAgB,GAAG,EAAE,QAAQ,EAAa,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,UAAU,EAAwD,MAAM,cAAc,CAAC;AAsBhG,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,UAAU,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACzC,iEAAiE;IACjE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,sDAAsD;IACtD,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,+GAA+G;IAC/G,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACpC,mDAAmD;IACnD,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,uEAAuE;IACvE,SAAS,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACxC,8CAA8C;IAC9C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,yEAAyE;IACzE,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,6DAA6D;IAC7D,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC7B,6CAA6C;IAC7C,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;CAC7C;AAmCD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,GAAE,gBAAqB,GAAG,WAAW,CAktBrE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createPress, type CreatePressProps, type PressResult } from './createPress';
|
|
2
|
-
export { PressEvent, type IPressEvent, type
|
|
2
|
+
export { PressEvent, type IPressEvent, type PressEventType } from './PressEvent';
|
|
3
3
|
export { createLongPress, type LongPressProps, type LongPressResult, type LongPressEvent, } from './createLongPress';
|
|
4
4
|
export { createMove, type MoveEvents, type MoveResult, type MoveStartEvent, type MoveMoveEvent, type MoveEndEvent } from './createMove';
|
|
5
5
|
export { createFocus, type CreateFocusProps, type FocusResult, type FocusEvents } from './createFocus';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interactions/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interactions/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAGjF,OAAO,EACL,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAGxI,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EACL,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHiddenSelect.d.ts","sourceRoot":"","sources":["../../src/select/createHiddenSelect.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAgC,MAAM,UAAU,CAAC;AACjF,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"createHiddenSelect.d.ts","sourceRoot":"","sources":["../../src/select/createHiddenSelect.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAgC,MAAM,UAAU,CAAC;AACjF,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,KAAK,EAAE,WAAW,EAAO,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE7F,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEnD,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,uCAAuC;IACvC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACtB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,kEAAkE;IAClE,UAAU,CAAC,EAAE,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC1C,+DAA+D;IAC/D,eAAe,CAAC,EAAE,mBAAmB,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,cAAc,EAAE,GAAG,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IACnD,2CAA2C;IAC3C,WAAW,EAAE,GAAG,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IACzD,gEAAgE;IAChE,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;CACvD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,KAAK,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAC7C,gBAAgB,CA0GlB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,uCAAuC;IACvC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACtB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACtC,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,+DAA+D;IAC/D,eAAe,CAAC,EAAE,mBAAmB,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAmDxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createToolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/createToolbar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"createToolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/createToolbar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,KAAK,aAAa,EAAU,MAAM,UAAU,CAAA;AASrD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,CAAA;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,WAAW,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAA;IACxC,8CAA8C;IAC9C,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACpC,oEAAoE;IACpE,iBAAiB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAC1C;AAED,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,YAAY,EAAE;QACZ,IAAI,EAAE,SAAS,GAAG,OAAO,CAAA;QACzB,kBAAkB,EAAE,WAAW,CAAA;QAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,GAAG,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAA;KAC/B,CAAA;IACD,sCAAsC;IACtC,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAA;CACnC;AA+KD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE,gBAAqB,GAAG,WAAW,CAkIvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTooltipTrigger.d.ts","sourceRoot":"","sources":["../../src/tooltip/createTooltipTrigger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,GAAG,EAA2B,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"createTooltipTrigger.d.ts","sourceRoot":"","sources":["../../src/tooltip/createTooltipTrigger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,GAAG,EAA2B,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAU3E,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,YAAY,EAAE,GAAG,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC9C,qEAAqE;IACrE,YAAY,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9B;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,mBAAmB,EAC1B,GAAG,EAAE,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,GACxC,kBAAkB,CAqHpB"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proyecto-viviana/solidaria",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "A 1-1 SolidJS port of React Aria - accessible UI primitives",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"solid": "./
|
|
12
|
+
"solid": "./src/index.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
13
14
|
"default": "./dist/index.js"
|
|
14
15
|
}
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
|
-
"dist"
|
|
18
|
+
"dist",
|
|
19
|
+
"src"
|
|
18
20
|
],
|
|
19
21
|
"sideEffects": false,
|
|
20
22
|
"scripts": {
|
|
21
|
-
"build": "
|
|
23
|
+
"build": "tsup",
|
|
22
24
|
"dev": "tsup --watch",
|
|
23
|
-
"prepublishOnly": "deno task
|
|
25
|
+
"prepublishOnly": "echo 'Use deno task release from root'"
|
|
24
26
|
},
|
|
25
27
|
"dependencies": {
|
|
26
|
-
"@proyecto-viviana/solid-stately": "
|
|
28
|
+
"@proyecto-viviana/solid-stately": "workspace:*",
|
|
27
29
|
"@internationalized/string": "^3.2.5"
|
|
28
30
|
},
|
|
29
31
|
"peerDependencies": {
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createAutocomplete - Accessibility hook for autocomplete components
|
|
3
|
+
*
|
|
4
|
+
* Provides keyboard navigation, virtual focus via aria-activedescendant,
|
|
5
|
+
* and filtering capabilities for autocomplete inputs.
|
|
6
|
+
*
|
|
7
|
+
* Based on @react-aria/autocomplete useAutocomplete.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
createSignal,
|
|
12
|
+
createEffect,
|
|
13
|
+
onCleanup,
|
|
14
|
+
type Accessor,
|
|
15
|
+
} from 'solid-js'
|
|
16
|
+
import { createId, getOwnerDocument } from '../ssr'
|
|
17
|
+
import { type AutocompleteState } from '@proyecto-viviana/solid-stately'
|
|
18
|
+
|
|
19
|
+
// ============================================
|
|
20
|
+
// TYPES
|
|
21
|
+
// ============================================
|
|
22
|
+
|
|
23
|
+
export interface CollectionOptions {
|
|
24
|
+
/** The id of the collection element. */
|
|
25
|
+
id?: string
|
|
26
|
+
/** Accessible label for the collection. */
|
|
27
|
+
'aria-label'?: string
|
|
28
|
+
/** Whether the collection items should use virtual focus instead of being focused directly. */
|
|
29
|
+
shouldUseVirtualFocus: boolean
|
|
30
|
+
/** Whether typeahead is disabled. */
|
|
31
|
+
disallowTypeAhead: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface AutocompleteInputProps {
|
|
35
|
+
/** Current input value. */
|
|
36
|
+
value: Accessor<string>
|
|
37
|
+
/** Handler for input value changes. */
|
|
38
|
+
onChange: (value: string) => void
|
|
39
|
+
/** Handler for key events. */
|
|
40
|
+
onKeyDown: (e: KeyboardEvent) => void
|
|
41
|
+
/** Handler for focus events. */
|
|
42
|
+
onFocus: (e: FocusEvent) => void
|
|
43
|
+
/** Handler for blur events. */
|
|
44
|
+
onBlur: (e: FocusEvent) => void
|
|
45
|
+
/** The id of the currently focused item for aria-activedescendant. */
|
|
46
|
+
'aria-activedescendant': Accessor<string | undefined>
|
|
47
|
+
/** The id of the controlled collection. */
|
|
48
|
+
'aria-controls': string
|
|
49
|
+
/** Autocomplete type. */
|
|
50
|
+
'aria-autocomplete': 'list' | 'none' | 'inline' | 'both'
|
|
51
|
+
/** Enter key hint for mobile keyboards. */
|
|
52
|
+
enterKeyHint: 'go'
|
|
53
|
+
/** Disable autocorrect. */
|
|
54
|
+
autoCorrect: 'off'
|
|
55
|
+
/** Disable spell check. */
|
|
56
|
+
spellCheck: 'false'
|
|
57
|
+
/** Disable browser autocomplete. */
|
|
58
|
+
autoComplete: 'off'
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface AriaAutocompleteOptions<T = unknown> {
|
|
62
|
+
/** Ref accessor for the input element. */
|
|
63
|
+
inputRef: Accessor<HTMLInputElement | undefined>
|
|
64
|
+
/** Ref accessor for the collection element. */
|
|
65
|
+
collectionRef: Accessor<HTMLElement | undefined>
|
|
66
|
+
/**
|
|
67
|
+
* An optional filter function used to determine if an option should be included.
|
|
68
|
+
* @param textValue - The text value of the item
|
|
69
|
+
* @param inputValue - The current input value
|
|
70
|
+
*/
|
|
71
|
+
filter?: (textValue: string, inputValue: string) => boolean
|
|
72
|
+
/**
|
|
73
|
+
* Whether to focus the first item after filtering.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
disableAutoFocusFirst?: boolean
|
|
77
|
+
/**
|
|
78
|
+
* Whether to disable virtual focus (aria-activedescendant).
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
disableVirtualFocus?: boolean
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface AutocompleteAria<T = unknown> {
|
|
85
|
+
/** Props for the autocomplete input element. */
|
|
86
|
+
inputProps: AutocompleteInputProps
|
|
87
|
+
/** Props for the collection (ListBox/Menu). */
|
|
88
|
+
collectionProps: CollectionOptions
|
|
89
|
+
/** A filter function that returns if the item should be shown. */
|
|
90
|
+
filter?: (textValue: string) => boolean
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ============================================
|
|
94
|
+
// CONSTANTS
|
|
95
|
+
// ============================================
|
|
96
|
+
|
|
97
|
+
// Custom event names for collection communication
|
|
98
|
+
export const AUTOCOMPLETE_FOCUS_EVENT = 'autocomplete:focus'
|
|
99
|
+
export const AUTOCOMPLETE_CLEAR_FOCUS_EVENT = 'autocomplete:clearfocus'
|
|
100
|
+
|
|
101
|
+
// ============================================
|
|
102
|
+
// CREATE AUTOCOMPLETE HOOK
|
|
103
|
+
// ============================================
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Provides the behavior and accessibility implementation for an autocomplete component.
|
|
107
|
+
* An autocomplete combines a text input with a collection, allowing users to filter
|
|
108
|
+
* the collection's contents to match a query.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* const state = createAutocompleteState({ defaultInputValue: '' });
|
|
113
|
+
* let inputRef, collectionRef;
|
|
114
|
+
*
|
|
115
|
+
* const { inputProps, collectionProps, filter } = createAutocomplete({
|
|
116
|
+
* inputRef: () => inputRef,
|
|
117
|
+
* collectionRef: () => collectionRef,
|
|
118
|
+
* filter: (textValue, inputValue) =>
|
|
119
|
+
* textValue.toLowerCase().includes(inputValue.toLowerCase()),
|
|
120
|
+
* }, state);
|
|
121
|
+
*
|
|
122
|
+
* return (
|
|
123
|
+
* <div>
|
|
124
|
+
* <input ref={inputRef} {...inputProps} />
|
|
125
|
+
* <ul ref={collectionRef} {...collectionProps}>
|
|
126
|
+
* {items.filter(item => filter?.(item.name) ?? true).map(item => (
|
|
127
|
+
* <li key={item.id}>{item.name}</li>
|
|
128
|
+
* ))}
|
|
129
|
+
* </ul>
|
|
130
|
+
* </div>
|
|
131
|
+
* );
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
export function createAutocomplete<T = unknown>(
|
|
135
|
+
props: AriaAutocompleteOptions<T>,
|
|
136
|
+
state: AutocompleteState
|
|
137
|
+
): AutocompleteAria<T> {
|
|
138
|
+
const {
|
|
139
|
+
inputRef,
|
|
140
|
+
collectionRef,
|
|
141
|
+
filter,
|
|
142
|
+
disableAutoFocusFirst = false,
|
|
143
|
+
disableVirtualFocus = false,
|
|
144
|
+
} = props
|
|
145
|
+
|
|
146
|
+
const collectionId = createId()
|
|
147
|
+
const [shouldUseVirtualFocus] = createSignal(!disableVirtualFocus)
|
|
148
|
+
let lastInputType = ''
|
|
149
|
+
|
|
150
|
+
// Track the input type for determining focus behavior
|
|
151
|
+
const handleInput = (e: Event) => {
|
|
152
|
+
const inputEvent = e as InputEvent
|
|
153
|
+
lastInputType = inputEvent.inputType || ''
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Set up input event listener
|
|
157
|
+
createEffect(() => {
|
|
158
|
+
const input = inputRef()
|
|
159
|
+
if (input) {
|
|
160
|
+
input.addEventListener('input', handleInput)
|
|
161
|
+
onCleanup(() => {
|
|
162
|
+
input.removeEventListener('input', handleInput)
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
// Focus first item in collection
|
|
168
|
+
const focusFirstItem = () => {
|
|
169
|
+
const collection = collectionRef()
|
|
170
|
+
if (collection) {
|
|
171
|
+
collection.dispatchEvent(
|
|
172
|
+
new CustomEvent(AUTOCOMPLETE_FOCUS_EVENT, {
|
|
173
|
+
cancelable: true,
|
|
174
|
+
bubbles: true,
|
|
175
|
+
detail: { focusStrategy: 'first' },
|
|
176
|
+
})
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Clear virtual focus
|
|
182
|
+
const clearVirtualFocus = (clearFocusKey = false) => {
|
|
183
|
+
state.setFocusedNodeId(null)
|
|
184
|
+
const collection = collectionRef()
|
|
185
|
+
if (collection) {
|
|
186
|
+
collection.dispatchEvent(
|
|
187
|
+
new CustomEvent(AUTOCOMPLETE_CLEAR_FOCUS_EVENT, {
|
|
188
|
+
cancelable: true,
|
|
189
|
+
bubbles: true,
|
|
190
|
+
detail: { clearFocusKey },
|
|
191
|
+
})
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Handle input value changes
|
|
197
|
+
const onChange = (value: string) => {
|
|
198
|
+
// Focus first item when typing forward, clear when backspacing/pasting
|
|
199
|
+
if (lastInputType === 'insertText' && !disableAutoFocusFirst) {
|
|
200
|
+
focusFirstItem()
|
|
201
|
+
} else if (
|
|
202
|
+
lastInputType &&
|
|
203
|
+
(lastInputType.includes('insert') ||
|
|
204
|
+
lastInputType.includes('delete') ||
|
|
205
|
+
lastInputType.includes('history'))
|
|
206
|
+
) {
|
|
207
|
+
clearVirtualFocus(true)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
state.setInputValue(value)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Handle keyboard navigation
|
|
214
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
215
|
+
if ((e as any).isComposing) {
|
|
216
|
+
return
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const focusedNodeId = state.focusedNodeId()
|
|
220
|
+
const collection = collectionRef()
|
|
221
|
+
|
|
222
|
+
switch (e.key) {
|
|
223
|
+
case 'Escape':
|
|
224
|
+
// Let the input handle Escape (e.g., clear value)
|
|
225
|
+
if (e.defaultPrevented) {
|
|
226
|
+
return
|
|
227
|
+
}
|
|
228
|
+
break
|
|
229
|
+
|
|
230
|
+
case ' ':
|
|
231
|
+
// Space shouldn't trigger item action
|
|
232
|
+
return
|
|
233
|
+
|
|
234
|
+
case 'Tab':
|
|
235
|
+
// Let Tab propagate normally for focus management
|
|
236
|
+
return
|
|
237
|
+
|
|
238
|
+
case 'ArrowUp':
|
|
239
|
+
case 'ArrowDown':
|
|
240
|
+
case 'Home':
|
|
241
|
+
case 'End':
|
|
242
|
+
case 'PageUp':
|
|
243
|
+
case 'PageDown': {
|
|
244
|
+
// Prevent cursor movement in input
|
|
245
|
+
e.preventDefault()
|
|
246
|
+
|
|
247
|
+
// Dispatch focus event to collection
|
|
248
|
+
if (collection) {
|
|
249
|
+
collection.dispatchEvent(
|
|
250
|
+
new CustomEvent(AUTOCOMPLETE_FOCUS_EVENT, {
|
|
251
|
+
cancelable: true,
|
|
252
|
+
bubbles: true,
|
|
253
|
+
})
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
break
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
case 'ArrowLeft':
|
|
260
|
+
case 'ArrowRight':
|
|
261
|
+
// Clear activedescendant so screen reader announces cursor movement
|
|
262
|
+
clearVirtualFocus()
|
|
263
|
+
return
|
|
264
|
+
|
|
265
|
+
case 'Enter':
|
|
266
|
+
// Trigger click on focused item
|
|
267
|
+
if (focusedNodeId) {
|
|
268
|
+
const item = document.getElementById(focusedNodeId)
|
|
269
|
+
if (item) {
|
|
270
|
+
item.click()
|
|
271
|
+
e.preventDefault()
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Forward keyboard events to collection/focused item
|
|
278
|
+
if (!e.defaultPrevented && collection) {
|
|
279
|
+
e.stopPropagation()
|
|
280
|
+
|
|
281
|
+
if (focusedNodeId) {
|
|
282
|
+
const item = document.getElementById(focusedNodeId)
|
|
283
|
+
if (item) {
|
|
284
|
+
item.dispatchEvent(new KeyboardEvent(e.type, e))
|
|
285
|
+
}
|
|
286
|
+
} else {
|
|
287
|
+
collection.dispatchEvent(new KeyboardEvent(e.type, e))
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Handle focus events
|
|
293
|
+
const onFocus = (e: FocusEvent) => {
|
|
294
|
+
if (!e.isTrusted) return
|
|
295
|
+
|
|
296
|
+
// Restore virtual focus when refocusing input
|
|
297
|
+
const focusedNodeId = state.focusedNodeId()
|
|
298
|
+
if (focusedNodeId) {
|
|
299
|
+
const item = document.getElementById(focusedNodeId)
|
|
300
|
+
if (item) {
|
|
301
|
+
// Item still exists, keep focus on it
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const onBlur = (e: FocusEvent) => {
|
|
307
|
+
if (!e.isTrusted) return
|
|
308
|
+
// Virtual focus blur handling would go here
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Create filter function
|
|
312
|
+
const filterFn = filter
|
|
313
|
+
? (textValue: string) => filter(textValue, state.inputValue())
|
|
314
|
+
: undefined
|
|
315
|
+
|
|
316
|
+
return {
|
|
317
|
+
inputProps: {
|
|
318
|
+
value: state.inputValue,
|
|
319
|
+
onChange,
|
|
320
|
+
onKeyDown,
|
|
321
|
+
onFocus,
|
|
322
|
+
onBlur,
|
|
323
|
+
get 'aria-activedescendant'() {
|
|
324
|
+
return () => (shouldUseVirtualFocus() ? state.focusedNodeId() ?? undefined : undefined)
|
|
325
|
+
},
|
|
326
|
+
'aria-controls': collectionId,
|
|
327
|
+
'aria-autocomplete': 'list',
|
|
328
|
+
enterKeyHint: 'go',
|
|
329
|
+
autoCorrect: 'off',
|
|
330
|
+
spellCheck: 'false',
|
|
331
|
+
autoComplete: 'off',
|
|
332
|
+
},
|
|
333
|
+
collectionProps: {
|
|
334
|
+
id: collectionId,
|
|
335
|
+
'aria-label': 'Suggestions',
|
|
336
|
+
shouldUseVirtualFocus: shouldUseVirtualFocus(),
|
|
337
|
+
disallowTypeAhead: shouldUseVirtualFocus(),
|
|
338
|
+
},
|
|
339
|
+
filter: filterFn,
|
|
340
|
+
}
|
|
341
|
+
}
|