@cdx-ui/primitives 0.0.1-alpha.1
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/README.md +17 -0
- package/lib/commonjs/button/context.js +11 -0
- package/lib/commonjs/button/context.js.map +1 -0
- package/lib/commonjs/button/createButtonGroup.js +80 -0
- package/lib/commonjs/button/createButtonGroup.js.map +1 -0
- package/lib/commonjs/button/createButtonIcon.js +18 -0
- package/lib/commonjs/button/createButtonIcon.js.map +1 -0
- package/lib/commonjs/button/createButtonRoot.js +81 -0
- package/lib/commonjs/button/createButtonRoot.js.map +1 -0
- package/lib/commonjs/button/createButtonSpinner.js +34 -0
- package/lib/commonjs/button/createButtonSpinner.js.map +1 -0
- package/lib/commonjs/button/createButtonText.js +38 -0
- package/lib/commonjs/button/createButtonText.js.map +1 -0
- package/lib/commonjs/button/index.js +31 -0
- package/lib/commonjs/button/index.js.map +1 -0
- package/lib/commonjs/button/types.js +6 -0
- package/lib/commonjs/button/types.js.map +1 -0
- package/lib/commonjs/index.js +52 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/input/context.js +11 -0
- package/lib/commonjs/input/context.js.map +1 -0
- package/lib/commonjs/input/createInputField.js +90 -0
- package/lib/commonjs/input/createInputField.js.map +1 -0
- package/lib/commonjs/input/createInputIcon.js +20 -0
- package/lib/commonjs/input/createInputIcon.js.map +1 -0
- package/lib/commonjs/input/createInputRoot.js +82 -0
- package/lib/commonjs/input/createInputRoot.js.map +1 -0
- package/lib/commonjs/input/createInputSlot.js +44 -0
- package/lib/commonjs/input/createInputSlot.js.map +1 -0
- package/lib/commonjs/input/index.js +28 -0
- package/lib/commonjs/input/index.js.map +1 -0
- package/lib/commonjs/input/types.js +6 -0
- package/lib/commonjs/input/types.js.map +1 -0
- package/lib/commonjs/overlay/OverlayContainer.js +67 -0
- package/lib/commonjs/overlay/OverlayContainer.js.map +1 -0
- package/lib/commonjs/overlay/index.js +40 -0
- package/lib/commonjs/overlay/index.js.map +1 -0
- package/lib/commonjs/overlay/useAnchorPosition.js +68 -0
- package/lib/commonjs/overlay/useAnchorPosition.js.map +1 -0
- package/lib/commonjs/overlay/useDismissOverlay.js +14 -0
- package/lib/commonjs/overlay/useDismissOverlay.js.map +1 -0
- package/lib/commonjs/overlay/useDismissOverlay.web.js +46 -0
- package/lib/commonjs/overlay/useDismissOverlay.web.js.map +1 -0
- package/lib/commonjs/overlay/useOverlayPosition.js +93 -0
- package/lib/commonjs/overlay/useOverlayPosition.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/select/context.js +63 -0
- package/lib/commonjs/select/context.js.map +1 -0
- package/lib/commonjs/select/createSelectContent.js +102 -0
- package/lib/commonjs/select/createSelectContent.js.map +1 -0
- package/lib/commonjs/select/createSelectIcon.js +41 -0
- package/lib/commonjs/select/createSelectIcon.js.map +1 -0
- package/lib/commonjs/select/createSelectItem.js +101 -0
- package/lib/commonjs/select/createSelectItem.js.map +1 -0
- package/lib/commonjs/select/createSelectItemLabel.js +41 -0
- package/lib/commonjs/select/createSelectItemLabel.js.map +1 -0
- package/lib/commonjs/select/createSelectRoot.js +99 -0
- package/lib/commonjs/select/createSelectRoot.js.map +1 -0
- package/lib/commonjs/select/createSelectTrigger.js +138 -0
- package/lib/commonjs/select/createSelectTrigger.js.map +1 -0
- package/lib/commonjs/select/createSelectValue.js +53 -0
- package/lib/commonjs/select/createSelectValue.js.map +1 -0
- package/lib/commonjs/select/index.js +38 -0
- package/lib/commonjs/select/index.js.map +1 -0
- package/lib/commonjs/select/types.js +6 -0
- package/lib/commonjs/select/types.js.map +1 -0
- package/lib/commonjs/select/useContentFocus.js +47 -0
- package/lib/commonjs/select/useContentFocus.js.map +1 -0
- package/lib/commonjs/select/useListboxNavigation.js +83 -0
- package/lib/commonjs/select/useListboxNavigation.js.map +1 -0
- package/lib/commonjs/uniwind.d.js +2 -0
- package/lib/commonjs/uniwind.d.js.map +1 -0
- package/lib/commonjs/utils/dataAttributes.js +32 -0
- package/lib/commonjs/utils/dataAttributes.js.map +1 -0
- package/lib/commonjs/utils/dataAttributes.web.js +31 -0
- package/lib/commonjs/utils/dataAttributes.web.js.map +1 -0
- package/lib/module/button/context.js +5 -0
- package/lib/module/button/context.js.map +1 -0
- package/lib/module/button/createButtonGroup.js +74 -0
- package/lib/module/button/createButtonGroup.js.map +1 -0
- package/lib/module/button/createButtonIcon.js +13 -0
- package/lib/module/button/createButtonIcon.js.map +1 -0
- package/lib/module/button/createButtonRoot.js +76 -0
- package/lib/module/button/createButtonRoot.js.map +1 -0
- package/lib/module/button/createButtonSpinner.js +29 -0
- package/lib/module/button/createButtonSpinner.js.map +1 -0
- package/lib/module/button/createButtonText.js +33 -0
- package/lib/module/button/createButtonText.js.map +1 -0
- package/lib/module/button/index.js +27 -0
- package/lib/module/button/index.js.map +1 -0
- package/lib/module/button/types.js +4 -0
- package/lib/module/button/types.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/input/context.js +5 -0
- package/lib/module/input/context.js.map +1 -0
- package/lib/module/input/createInputField.js +85 -0
- package/lib/module/input/createInputField.js.map +1 -0
- package/lib/module/input/createInputIcon.js +15 -0
- package/lib/module/input/createInputIcon.js.map +1 -0
- package/lib/module/input/createInputRoot.js +76 -0
- package/lib/module/input/createInputRoot.js.map +1 -0
- package/lib/module/input/createInputSlot.js +39 -0
- package/lib/module/input/createInputSlot.js.map +1 -0
- package/lib/module/input/index.js +23 -0
- package/lib/module/input/index.js.map +1 -0
- package/lib/module/input/types.js +4 -0
- package/lib/module/input/types.js.map +1 -0
- package/lib/module/overlay/OverlayContainer.js +62 -0
- package/lib/module/overlay/OverlayContainer.js.map +1 -0
- package/lib/module/overlay/index.js +7 -0
- package/lib/module/overlay/index.js.map +1 -0
- package/lib/module/overlay/useAnchorPosition.js +64 -0
- package/lib/module/overlay/useAnchorPosition.js.map +1 -0
- package/lib/module/overlay/useDismissOverlay.js +10 -0
- package/lib/module/overlay/useDismissOverlay.js.map +1 -0
- package/lib/module/overlay/useDismissOverlay.web.js +43 -0
- package/lib/module/overlay/useDismissOverlay.web.js.map +1 -0
- package/lib/module/overlay/useOverlayPosition.js +88 -0
- package/lib/module/overlay/useOverlayPosition.js.map +1 -0
- package/lib/module/select/context.js +56 -0
- package/lib/module/select/context.js.map +1 -0
- package/lib/module/select/createSelectContent.js +97 -0
- package/lib/module/select/createSelectContent.js.map +1 -0
- package/lib/module/select/createSelectIcon.js +36 -0
- package/lib/module/select/createSelectIcon.js.map +1 -0
- package/lib/module/select/createSelectItem.js +96 -0
- package/lib/module/select/createSelectItem.js.map +1 -0
- package/lib/module/select/createSelectItemLabel.js +36 -0
- package/lib/module/select/createSelectItemLabel.js.map +1 -0
- package/lib/module/select/createSelectRoot.js +94 -0
- package/lib/module/select/createSelectRoot.js.map +1 -0
- package/lib/module/select/createSelectTrigger.js +133 -0
- package/lib/module/select/createSelectTrigger.js.map +1 -0
- package/lib/module/select/createSelectValue.js +48 -0
- package/lib/module/select/createSelectValue.js.map +1 -0
- package/lib/module/select/index.js +34 -0
- package/lib/module/select/index.js.map +1 -0
- package/lib/module/select/types.js +4 -0
- package/lib/module/select/types.js.map +1 -0
- package/lib/module/select/useContentFocus.js +44 -0
- package/lib/module/select/useContentFocus.js.map +1 -0
- package/lib/module/select/useListboxNavigation.js +80 -0
- package/lib/module/select/useListboxNavigation.js.map +1 -0
- package/lib/module/uniwind.d.js +2 -0
- package/lib/module/uniwind.d.js.map +1 -0
- package/lib/module/utils/dataAttributes.js +28 -0
- package/lib/module/utils/dataAttributes.js.map +1 -0
- package/lib/module/utils/dataAttributes.web.js +27 -0
- package/lib/module/utils/dataAttributes.web.js.map +1 -0
- package/lib/typescript/button/context.d.ts +6 -0
- package/lib/typescript/button/context.d.ts.map +1 -0
- package/lib/typescript/button/createButtonGroup.d.ts +4 -0
- package/lib/typescript/button/createButtonGroup.d.ts.map +1 -0
- package/lib/typescript/button/createButtonIcon.d.ts +2 -0
- package/lib/typescript/button/createButtonIcon.d.ts.map +1 -0
- package/lib/typescript/button/createButtonRoot.d.ts +6 -0
- package/lib/typescript/button/createButtonRoot.d.ts.map +1 -0
- package/lib/typescript/button/createButtonSpinner.d.ts +4 -0
- package/lib/typescript/button/createButtonSpinner.d.ts.map +1 -0
- package/lib/typescript/button/createButtonText.d.ts +4 -0
- package/lib/typescript/button/createButtonText.d.ts.map +1 -0
- package/lib/typescript/button/index.d.ts +11 -0
- package/lib/typescript/button/index.d.ts.map +1 -0
- package/lib/typescript/button/types.d.ts +65 -0
- package/lib/typescript/button/types.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/input/context.d.ts +6 -0
- package/lib/typescript/input/context.d.ts.map +1 -0
- package/lib/typescript/input/createInputField.d.ts +4 -0
- package/lib/typescript/input/createInputField.d.ts.map +1 -0
- package/lib/typescript/input/createInputIcon.d.ts +4 -0
- package/lib/typescript/input/createInputIcon.d.ts.map +1 -0
- package/lib/typescript/input/createInputRoot.d.ts +4 -0
- package/lib/typescript/input/createInputRoot.d.ts.map +1 -0
- package/lib/typescript/input/createInputSlot.d.ts +4 -0
- package/lib/typescript/input/createInputSlot.d.ts.map +1 -0
- package/lib/typescript/input/index.d.ts +9 -0
- package/lib/typescript/input/index.d.ts.map +1 -0
- package/lib/typescript/input/types.d.ts +91 -0
- package/lib/typescript/input/types.d.ts.map +1 -0
- package/lib/typescript/overlay/OverlayContainer.d.ts +23 -0
- package/lib/typescript/overlay/OverlayContainer.d.ts.map +1 -0
- package/lib/typescript/overlay/index.d.ts +6 -0
- package/lib/typescript/overlay/index.d.ts.map +1 -0
- package/lib/typescript/overlay/useAnchorPosition.d.ts +15 -0
- package/lib/typescript/overlay/useAnchorPosition.d.ts.map +1 -0
- package/lib/typescript/overlay/useDismissOverlay.d.ts +7 -0
- package/lib/typescript/overlay/useDismissOverlay.d.ts.map +1 -0
- package/lib/typescript/overlay/useDismissOverlay.web.d.ts +8 -0
- package/lib/typescript/overlay/useDismissOverlay.web.d.ts.map +1 -0
- package/lib/typescript/overlay/useOverlayPosition.d.ts +45 -0
- package/lib/typescript/overlay/useOverlayPosition.d.ts.map +1 -0
- package/lib/typescript/select/context.d.ts +17 -0
- package/lib/typescript/select/context.d.ts.map +1 -0
- package/lib/typescript/select/createSelectContent.d.ts +4 -0
- package/lib/typescript/select/createSelectContent.d.ts.map +1 -0
- package/lib/typescript/select/createSelectIcon.d.ts +2 -0
- package/lib/typescript/select/createSelectIcon.d.ts.map +1 -0
- package/lib/typescript/select/createSelectItem.d.ts +6 -0
- package/lib/typescript/select/createSelectItem.d.ts.map +1 -0
- package/lib/typescript/select/createSelectItemLabel.d.ts +4 -0
- package/lib/typescript/select/createSelectItemLabel.d.ts.map +1 -0
- package/lib/typescript/select/createSelectRoot.d.ts +4 -0
- package/lib/typescript/select/createSelectRoot.d.ts.map +1 -0
- package/lib/typescript/select/createSelectTrigger.d.ts +12 -0
- package/lib/typescript/select/createSelectTrigger.d.ts.map +1 -0
- package/lib/typescript/select/createSelectValue.d.ts +4 -0
- package/lib/typescript/select/createSelectValue.d.ts.map +1 -0
- package/lib/typescript/select/index.d.ts +13 -0
- package/lib/typescript/select/index.d.ts.map +1 -0
- package/lib/typescript/select/types.d.ts +96 -0
- package/lib/typescript/select/types.d.ts.map +1 -0
- package/lib/typescript/select/useContentFocus.d.ts +19 -0
- package/lib/typescript/select/useContentFocus.d.ts.map +1 -0
- package/lib/typescript/select/useListboxNavigation.d.ts +13 -0
- package/lib/typescript/select/useListboxNavigation.d.ts.map +1 -0
- package/lib/typescript/utils/dataAttributes.d.ts +14 -0
- package/lib/typescript/utils/dataAttributes.d.ts.map +1 -0
- package/lib/typescript/utils/dataAttributes.web.d.ts +16 -0
- package/lib/typescript/utils/dataAttributes.web.d.ts.map +1 -0
- package/package.json +78 -0
- package/src/button/context.tsx +4 -0
- package/src/button/createButtonGroup.tsx +88 -0
- package/src/button/createButtonIcon.tsx +8 -0
- package/src/button/createButtonRoot.tsx +101 -0
- package/src/button/createButtonSpinner.tsx +20 -0
- package/src/button/createButtonText.tsx +22 -0
- package/src/button/index.tsx +53 -0
- package/src/button/types.ts +85 -0
- package/src/index.ts +4 -0
- package/src/input/context.tsx +4 -0
- package/src/input/createInputField.tsx +104 -0
- package/src/input/createInputIcon.tsx +12 -0
- package/src/input/createInputRoot.tsx +92 -0
- package/src/input/createInputSlot.tsx +39 -0
- package/src/input/index.tsx +51 -0
- package/src/input/types.ts +113 -0
- package/src/overlay/OverlayContainer.tsx +77 -0
- package/src/overlay/index.ts +10 -0
- package/src/overlay/useAnchorPosition.ts +72 -0
- package/src/overlay/useDismissOverlay.ts +14 -0
- package/src/overlay/useDismissOverlay.web.ts +51 -0
- package/src/overlay/useOverlayPosition.ts +96 -0
- package/src/select/context.tsx +56 -0
- package/src/select/createSelectContent.tsx +115 -0
- package/src/select/createSelectIcon.tsx +27 -0
- package/src/select/createSelectItem.tsx +121 -0
- package/src/select/createSelectItemLabel.tsx +30 -0
- package/src/select/createSelectRoot.tsx +130 -0
- package/src/select/createSelectTrigger.tsx +192 -0
- package/src/select/createSelectValue.tsx +38 -0
- package/src/select/index.tsx +73 -0
- package/src/select/types.ts +131 -0
- package/src/select/useContentFocus.ts +54 -0
- package/src/select/useListboxNavigation.ts +85 -0
- package/src/uniwind.d.ts +3 -0
- package/src/utils/dataAttributes.ts +28 -0
- package/src/utils/dataAttributes.web.ts +26 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
4
|
+
import { Platform } from 'react-native';
|
|
5
|
+
|
|
6
|
+
// TODO: Split into web and native versions?
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Manages focus lifecycle for overlay content:
|
|
10
|
+
* - Restores focus to the trigger when the overlay closes (web)
|
|
11
|
+
* - Initializes `activeValue` to the current value or first enabled item
|
|
12
|
+
*
|
|
13
|
+
* Initial focus on open is handled via a ref callback in createSelectContent
|
|
14
|
+
* to avoid timing issues with deferred portal rendering.
|
|
15
|
+
*/
|
|
16
|
+
export function useContentFocus({
|
|
17
|
+
open,
|
|
18
|
+
triggerRef,
|
|
19
|
+
items,
|
|
20
|
+
value,
|
|
21
|
+
setActiveValue
|
|
22
|
+
}) {
|
|
23
|
+
const prevOpenRef = useRef(open);
|
|
24
|
+
const getEnabledItems = useCallback(() => items.filter(item => !item.disabled), [items]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (prevOpenRef.current && !open && Platform.OS === 'web') {
|
|
27
|
+
triggerRef.current?.focus?.();
|
|
28
|
+
}
|
|
29
|
+
prevOpenRef.current = open;
|
|
30
|
+
}, [open, triggerRef]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (open) {
|
|
33
|
+
const enabled = getEnabledItems();
|
|
34
|
+
if (value && enabled.some(i => i.value === value)) {
|
|
35
|
+
setActiveValue(value);
|
|
36
|
+
} else if (enabled.length > 0) {
|
|
37
|
+
setActiveValue(enabled[0].value);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
setActiveValue(undefined);
|
|
41
|
+
}
|
|
42
|
+
}, [open, getEnabledItems, setActiveValue, value]);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=useContentFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","Platform","useContentFocus","open","triggerRef","items","value","setActiveValue","prevOpenRef","getEnabledItems","filter","item","disabled","current","OS","focus","enabled","some","i","length","undefined"],"sourceRoot":"../../../src","sources":["select/useContentFocus.ts"],"mappings":";;AACA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACtD,SAASC,QAAQ,QAAQ,cAAc;;AAGvC;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAC;EAC9BC,IAAI;EACJC,UAAU;EACVC,KAAK;EACLC,KAAK;EACLC;AACsB,CAAC,EAAE;EACzB,MAAMC,WAAW,GAAGR,MAAM,CAACG,IAAI,CAAC;EAEhC,MAAMM,eAAe,GAAGX,WAAW,CAAC,MAAMO,KAAK,CAACK,MAAM,CAAEC,IAAI,IAAK,CAACA,IAAI,CAACC,QAAQ,CAAC,EAAE,CAACP,KAAK,CAAC,CAAC;EAE1FN,SAAS,CAAC,MAAM;IACd,IAAIS,WAAW,CAACK,OAAO,IAAI,CAACV,IAAI,IAAIF,QAAQ,CAACa,EAAE,KAAK,KAAK,EAAE;MACzDV,UAAU,CAACS,OAAO,EAAEE,KAAK,GAAG,CAAC;IAC/B;IACAP,WAAW,CAACK,OAAO,GAAGV,IAAI;EAC5B,CAAC,EAAE,CAACA,IAAI,EAAEC,UAAU,CAAC,CAAC;EAEtBL,SAAS,CAAC,MAAM;IACd,IAAII,IAAI,EAAE;MACR,MAAMa,OAAO,GAAGP,eAAe,CAAC,CAAC;MACjC,IAAIH,KAAK,IAAIU,OAAO,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACZ,KAAK,KAAKA,KAAK,CAAC,EAAE;QACnDC,cAAc,CAACD,KAAK,CAAC;MACvB,CAAC,MAAM,IAAIU,OAAO,CAACG,MAAM,GAAG,CAAC,EAAE;QAC7BZ,cAAc,CAACS,OAAO,CAAC,CAAC,CAAC,CAACV,KAAK,CAAC;MAClC;IACF,CAAC,MAAM;MACLC,cAAc,CAACa,SAAS,CAAC;IAC3B;EACF,CAAC,EAAE,CAACjB,IAAI,EAAEM,eAAe,EAAEF,cAAc,EAAED,KAAK,CAAC,CAAC;AACpD","ignoreList":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useRef } from 'react';
|
|
4
|
+
|
|
5
|
+
// TODO: Split into web and native versions?
|
|
6
|
+
|
|
7
|
+
export function useListboxNavigation({
|
|
8
|
+
items,
|
|
9
|
+
activeValue,
|
|
10
|
+
setActiveValue,
|
|
11
|
+
onSelect,
|
|
12
|
+
onDismiss
|
|
13
|
+
}) {
|
|
14
|
+
const onSelectRef = useRef(onSelect);
|
|
15
|
+
onSelectRef.current = onSelect;
|
|
16
|
+
const onDismissRef = useRef(onDismiss);
|
|
17
|
+
onDismissRef.current = onDismiss;
|
|
18
|
+
const getEnabledItems = useCallback(() => items.filter(item => !item.disabled), [items]);
|
|
19
|
+
const handleKeyDown = useCallback(e => {
|
|
20
|
+
const enabledItems = getEnabledItems();
|
|
21
|
+
if (enabledItems.length === 0) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const idx = enabledItems.findIndex(i => i.value === activeValue);
|
|
25
|
+
switch (e.key) {
|
|
26
|
+
case 'ArrowDown':
|
|
27
|
+
{
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
setActiveValue(enabledItems[idx < enabledItems.length - 1 ? idx + 1 : 0].value);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case 'ArrowUp':
|
|
33
|
+
{
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
setActiveValue(enabledItems[idx > 0 ? idx - 1 : enabledItems.length - 1].value);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case 'Home':
|
|
39
|
+
{
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
setActiveValue(enabledItems[0].value);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case 'End':
|
|
45
|
+
{
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
const last = enabledItems.at(-1);
|
|
48
|
+
if (last) {
|
|
49
|
+
setActiveValue(last.value);
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
case 'Enter':
|
|
54
|
+
case ' ':
|
|
55
|
+
{
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
if (activeValue) {
|
|
58
|
+
onSelectRef.current(activeValue);
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case 'Escape':
|
|
63
|
+
{
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
onDismissRef.current();
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case 'Tab':
|
|
69
|
+
{
|
|
70
|
+
onDismissRef.current();
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}, [activeValue, getEnabledItems, setActiveValue]);
|
|
75
|
+
return {
|
|
76
|
+
handleKeyDown,
|
|
77
|
+
getEnabledItems
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=useListboxNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","useListboxNavigation","items","activeValue","setActiveValue","onSelect","onDismiss","onSelectRef","current","onDismissRef","getEnabledItems","filter","item","disabled","handleKeyDown","e","enabledItems","length","idx","findIndex","i","value","key","preventDefault","last","at"],"sourceRoot":"../../../src","sources":["select/useListboxNavigation.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;;AAG3C;;AAUA,OAAO,SAASC,oBAAoBA,CAAC;EACnCC,KAAK;EACLC,WAAW;EACXC,cAAc;EACdC,QAAQ;EACRC;AAC2B,CAAC,EAAE;EAC9B,MAAMC,WAAW,GAAGP,MAAM,CAACK,QAAQ,CAAC;EACpCE,WAAW,CAACC,OAAO,GAAGH,QAAQ;EAE9B,MAAMI,YAAY,GAAGT,MAAM,CAACM,SAAS,CAAC;EACtCG,YAAY,CAACD,OAAO,GAAGF,SAAS;EAEhC,MAAMI,eAAe,GAAGX,WAAW,CAAC,MAAMG,KAAK,CAACS,MAAM,CAAEC,IAAI,IAAK,CAACA,IAAI,CAACC,QAAQ,CAAC,EAAE,CAACX,KAAK,CAAC,CAAC;EAE1F,MAAMY,aAAa,GAAGf,WAAW,CAC9BgB,CAAM,IAAK;IACV,MAAMC,YAAY,GAAGN,eAAe,CAAC,CAAC;IACtC,IAAIM,YAAY,CAACC,MAAM,KAAK,CAAC,EAAE;MAC7B;IACF;IAEA,MAAMC,GAAG,GAAGF,YAAY,CAACG,SAAS,CAAEC,CAAC,IAAKA,CAAC,CAACC,KAAK,KAAKlB,WAAW,CAAC;IAElE,QAAQY,CAAC,CAACO,GAAG;MACX,KAAK,WAAW;QAAE;UAChBP,CAAC,CAACQ,cAAc,CAAC,CAAC;UAClBnB,cAAc,CAACY,YAAY,CAACE,GAAG,GAAGF,YAAY,CAACC,MAAM,GAAG,CAAC,GAAGC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAACG,KAAK,CAAC;UAC/E;QACF;MACA,KAAK,SAAS;QAAE;UACdN,CAAC,CAACQ,cAAc,CAAC,CAAC;UAClBnB,cAAc,CAACY,YAAY,CAACE,GAAG,GAAG,CAAC,GAAGA,GAAG,GAAG,CAAC,GAAGF,YAAY,CAACC,MAAM,GAAG,CAAC,CAAC,CAACI,KAAK,CAAC;UAC/E;QACF;MACA,KAAK,MAAM;QAAE;UACXN,CAAC,CAACQ,cAAc,CAAC,CAAC;UAClBnB,cAAc,CAACY,YAAY,CAAC,CAAC,CAAC,CAACK,KAAK,CAAC;UACrC;QACF;MACA,KAAK,KAAK;QAAE;UACVN,CAAC,CAACQ,cAAc,CAAC,CAAC;UAClB,MAAMC,IAAI,GAAGR,YAAY,CAACS,EAAE,CAAC,CAAC,CAAC,CAAC;UAChC,IAAID,IAAI,EAAE;YACRpB,cAAc,CAACoB,IAAI,CAACH,KAAK,CAAC;UAC5B;UACA;QACF;MACA,KAAK,OAAO;MACZ,KAAK,GAAG;QAAE;UACRN,CAAC,CAACQ,cAAc,CAAC,CAAC;UAClB,IAAIpB,WAAW,EAAE;YACfI,WAAW,CAACC,OAAO,CAACL,WAAW,CAAC;UAClC;UACA;QACF;MACA,KAAK,QAAQ;QAAE;UACbY,CAAC,CAACQ,cAAc,CAAC,CAAC;UAClBd,YAAY,CAACD,OAAO,CAAC,CAAC;UACtB;QACF;MACA,KAAK,KAAK;QAAE;UACVC,YAAY,CAACD,OAAO,CAAC,CAAC;UACtB;QACF;IACF;EACF,CAAC,EACD,CAACL,WAAW,EAAEO,eAAe,EAAEN,cAAc,CAC/C,CAAC;EAED,OAAO;IAAEU,aAAa;IAAEJ;EAAgB,CAAC;AAC3C","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["uniwind.d.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Produces platform-specific props for data attributes.
|
|
5
|
+
*
|
|
6
|
+
* Native: individual `data-*` props consumed by Uniwind.
|
|
7
|
+
* Web (.web.ts): a `dataSet` object consumed by React Native Web.
|
|
8
|
+
*
|
|
9
|
+
* Boolean values serialize to `"true"` / `"false"` strings.
|
|
10
|
+
* String values pass through as-is.
|
|
11
|
+
* Undefined values are omitted.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
function camelToKebab(str) {
|
|
15
|
+
return str.replaceAll(/[A-Z]/g, ch => `-${ch.toLowerCase()}`);
|
|
16
|
+
}
|
|
17
|
+
export function dataAttributes(attrs) {
|
|
18
|
+
const result = {};
|
|
19
|
+
for (const key in attrs) {
|
|
20
|
+
const value = attrs[key];
|
|
21
|
+
if (value === undefined) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
result[`data-${camelToKebab(key)}`] = typeof value === 'boolean' ? String(value) : value;
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=dataAttributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["camelToKebab","str","replaceAll","ch","toLowerCase","dataAttributes","attrs","result","key","value","undefined","String"],"sourceRoot":"../../../src","sources":["utils/dataAttributes.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,YAAYA,CAACC,GAAW,EAAU;EACzC,OAAOA,GAAG,CAACC,UAAU,CAAC,QAAQ,EAAGC,EAAE,IAAK,IAAIA,EAAE,CAACC,WAAW,CAAC,CAAC,EAAE,CAAC;AACjE;AAEA,OAAO,SAASC,cAAcA,CAACC,KAAyC,EAA0B;EAChG,MAAMC,MAA8B,GAAG,CAAC,CAAC;EACzC,KAAK,MAAMC,GAAG,IAAIF,KAAK,EAAE;IACvB,MAAMG,KAAK,GAAGH,KAAK,CAACE,GAAG,CAAC;IACxB,IAAIC,KAAK,KAAKC,SAAS,EAAE;MACvB;IACF;IACAH,MAAM,CAAC,QAAQP,YAAY,CAACQ,GAAG,CAAC,EAAE,CAAC,GAAG,OAAOC,KAAK,KAAK,SAAS,GAAGE,MAAM,CAACF,KAAK,CAAC,GAAGA,KAAK;EAC1F;EACA,OAAOF,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Produces platform-specific props for data attributes.
|
|
5
|
+
*
|
|
6
|
+
* Web: a `dataSet` object consumed by React Native Web, which translates
|
|
7
|
+
* camelCase keys to `data-kebab-case` DOM attributes automatically.
|
|
8
|
+
* Native (.ts): individual `data-*` props consumed by Uniwind.
|
|
9
|
+
*
|
|
10
|
+
* Values pass through to `dataSet` as-is (RNW handles serialization).
|
|
11
|
+
* Undefined values are omitted.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export function dataAttributes(attrs) {
|
|
15
|
+
const dataSet = {};
|
|
16
|
+
for (const key in attrs) {
|
|
17
|
+
const value = attrs[key];
|
|
18
|
+
if (value === undefined) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
dataSet[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
dataSet
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=dataAttributes.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["dataAttributes","attrs","dataSet","key","value","undefined"],"sourceRoot":"../../../src","sources":["utils/dataAttributes.web.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,cAAcA,CAACC,KAAyC,EAEtE;EACA,MAAMC,OAAyC,GAAG,CAAC,CAAC;EACpD,KAAK,MAAMC,GAAG,IAAIF,KAAK,EAAE;IACvB,MAAMG,KAAK,GAAGH,KAAK,CAACE,GAAG,CAAC;IACxB,IAAIC,KAAK,KAAKC,SAAS,EAAE;MACvB;IACF;IACAH,OAAO,CAACC,GAAG,CAAC,GAAGC,KAAK;EACtB;EACA,OAAO;IAAEF;EAAQ,CAAC;AACpB","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { InteractionState } from './types';
|
|
2
|
+
export declare const ButtonProvider: import("react").FunctionComponent<{
|
|
3
|
+
children: import("react").ReactNode;
|
|
4
|
+
value: InteractionState;
|
|
5
|
+
}>, useButtonContext: () => InteractionState;
|
|
6
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/button/context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAO,cAAc;;;IAAE,gBAAgB,wBAAoD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IButtonGroupProps } from './types';
|
|
3
|
+
export declare const createButtonGroup: <T>(BaseButtonGroup: React.ComponentType<T>) => React.ForwardRefExoticComponent<IButtonGroupProps & React.RefAttributes<T>>;
|
|
4
|
+
//# sourceMappingURL=createButtonGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createButtonGroup.d.ts","sourceRoot":"","sources":["../../../src/button/createButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAG,iBAAiB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,gFAmF1E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createButtonIcon.d.ts","sourceRoot":"","sources":["../../../src/button/createButtonIcon.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,gBAAgB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,mGAGvE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { InteractionState } from './types';
|
|
3
|
+
export declare const createButtonRoot: <T>(BaseButton: React.ComponentType<T>) => React.ForwardRefExoticComponent<Omit<import("./types").InterfaceButtonProps, "children"> & {
|
|
4
|
+
children?: ((state: InteractionState) => React.ReactNode) | React.ReactNode;
|
|
5
|
+
} & React.RefAttributes<T>>;
|
|
6
|
+
//# sourceMappingURL=createButtonRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createButtonRoot.d.ts","sourceRoot":"","sources":["../../../src/button/createButtonRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAgB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE9D,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,YAAY,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;eAYpD,CAAC,CAAC,KAAK,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS;2BA+EhF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { IButtonSpinnerProps } from './types';
|
|
3
|
+
export declare const createButtonSpinner: <T>(BaseButtonSpinner: React.ComponentType<T>) => React.ForwardRefExoticComponent<IButtonSpinnerProps & React.RefAttributes<unknown>>;
|
|
4
|
+
//# sourceMappingURL=createButtonSpinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createButtonSpinner.d.ts","sourceRoot":"","sources":["../../../src/button/createButtonSpinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAG,mBAAmB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,wFAa7E,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { IButtonTextProps } from './types';
|
|
3
|
+
export declare const createButtonText: <T>(BaseButtonText: React.ComponentType<T>) => React.ForwardRefExoticComponent<IButtonTextProps & React.RefAttributes<unknown>>;
|
|
4
|
+
//# sourceMappingURL=createButtonText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createButtonText.d.ts","sourceRoot":"","sources":["../../../src/button/createButtonText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIhD,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,gBAAgB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,qFAavE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { IButtonComponentType } from './types';
|
|
3
|
+
export type { IButtonProps } from './types';
|
|
4
|
+
export declare function createButton<ButtonProps, TextProps, GroupProps, SpinnerProps, IconProps, ButtonRef = unknown, TextRef = unknown>({ Root, Text, Group, Spinner, Icon, }: {
|
|
5
|
+
Root: React.ComponentType<ButtonProps>;
|
|
6
|
+
Text: React.ComponentType<TextProps>;
|
|
7
|
+
Group: React.ComponentType<GroupProps>;
|
|
8
|
+
Spinner: React.ComponentType<SpinnerProps>;
|
|
9
|
+
Icon: React.ComponentType<IconProps>;
|
|
10
|
+
}): IButtonComponentType<ButtonProps, GroupProps, SpinnerProps, TextProps, IconProps, ButtonRef, TextRef>;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,wBAAgB,YAAY,CAC1B,WAAW,EACX,SAAS,EACT,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,GAAG,OAAO,EACnB,OAAO,GAAG,OAAO,EACjB,EACA,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,IAAI,GACL,EAAE;IACD,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACvC,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACrC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACvC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAC3C,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;CACtC,GAakB,oBAAoB,CACnC,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,SAAS,EACT,OAAO,CACR,CACF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { PropsWithoutRef, ReactElement, ReactNode, RefAttributes } from 'react';
|
|
2
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
3
|
+
export interface InteractionState {
|
|
4
|
+
hover: boolean;
|
|
5
|
+
focus: boolean;
|
|
6
|
+
active: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
focusVisible: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface InterfaceButtonProps extends PressableProps {
|
|
11
|
+
/**
|
|
12
|
+
* If true, the button will be in hovered state.
|
|
13
|
+
*/
|
|
14
|
+
isHovered?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* If true, the button will be in pressed state.
|
|
17
|
+
*/
|
|
18
|
+
isActive?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* If true, the button will be focused.
|
|
21
|
+
*/
|
|
22
|
+
isFocused?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* If true, the button focus ring will be visible.
|
|
25
|
+
*/
|
|
26
|
+
isFocusVisible?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* If true, the button will be disabled.
|
|
29
|
+
*/
|
|
30
|
+
isDisabled?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface IButtonGroupProps {
|
|
33
|
+
/**
|
|
34
|
+
* The direction of the Stack Items.
|
|
35
|
+
* @default row
|
|
36
|
+
*/
|
|
37
|
+
flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
children: ReactElement | ReactElement[];
|
|
42
|
+
/**
|
|
43
|
+
* If true, the button will be disabled.
|
|
44
|
+
*/
|
|
45
|
+
isDisabled?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* If true, button will be atttached together.
|
|
48
|
+
*/
|
|
49
|
+
isAttached?: boolean;
|
|
50
|
+
reversed?: boolean;
|
|
51
|
+
isReversed?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export type IButtonComponentType<ButtonProps, GroupProps, SpinnerProps, TextProps, IconProps, ButtonRef = unknown, TextRef = unknown> = React.ForwardRefExoticComponent<PropsWithoutRef<ButtonProps & IButtonProps> & RefAttributes<ButtonRef>> & {
|
|
54
|
+
Group: React.ForwardRefExoticComponent<RefAttributes<unknown> & PropsWithoutRef<GroupProps & IButtonGroupProps>>;
|
|
55
|
+
Spinner: React.ForwardRefExoticComponent<PropsWithoutRef<SpinnerProps> & React.RefAttributes<unknown>>;
|
|
56
|
+
Text: React.ForwardRefExoticComponent<React.RefAttributes<TextRef> & PropsWithoutRef<TextProps>>;
|
|
57
|
+
Icon: React.ForwardRefExoticComponent<React.RefAttributes<unknown> & PropsWithoutRef<IconProps>>;
|
|
58
|
+
};
|
|
59
|
+
export interface IButtonTextProps extends ViewProps {
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
}
|
|
62
|
+
export interface IButtonSpinnerProps extends ViewProps {
|
|
63
|
+
}
|
|
64
|
+
export type IButtonProps = InterfaceButtonProps;
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,aAAa,GAAG,gBAAgB,CAAC;IACpE;;OAEG;IACH,QAAQ,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAExC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,oBAAoB,CAC9B,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,SAAS,GAAG,OAAO,EACnB,OAAO,GAAG,OAAO,IACf,KAAK,CAAC,yBAAyB,CACjC,eAAe,CAAC,WAAW,GAAG,YAAY,CAAC,GAAG,aAAa,CAAC,SAAS,CAAC,CACvE,GAAG;IACF,KAAK,EAAE,KAAK,CAAC,yBAAyB,CACpC,aAAa,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,UAAU,GAAG,iBAAiB,CAAC,CACzE,CAAC;IACF,OAAO,EAAE,KAAK,CAAC,yBAAyB,CACtC,eAAe,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAC7D,CAAC;IACF,IAAI,EAAE,KAAK,CAAC,yBAAyB,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;IACjG,IAAI,EAAE,KAAK,CAAC,yBAAyB,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;CAClG,CAAC;AAEF,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,mBAAoB,SAAQ,SAAS;CAAG;AAEzD,MAAM,MAAM,YAAY,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/input/context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAO,aAAa;;;IAAE,eAAe,oBAA+C,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { IInputProps } from './types';
|
|
3
|
+
export declare const createInputField: <T>(BaseInputField: React.ComponentType<T>) => React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<unknown>>;
|
|
4
|
+
//# sourceMappingURL=createInputField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInputField.d.ts","sourceRoot":"","sources":["../../../src/input/createInputField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,gBAAgB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,gFA0FxE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { IInputIconProps } from './types';
|
|
3
|
+
export declare const createInputIcon: <T>(BaseInputIcon: React.ComponentType<T>) => React.ForwardRefExoticComponent<IInputIconProps & React.RefAttributes<unknown>>;
|
|
4
|
+
//# sourceMappingURL=createInputIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInputIcon.d.ts","sourceRoot":"","sources":["../../../src/input/createInputIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,eAAe,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,oFAOrE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IInputRootProps } from './types';
|
|
3
|
+
export declare const createInputRoot: <T>(BaseInput: React.ComponentType<T>) => React.ForwardRefExoticComponent<IInputRootProps & React.RefAttributes<T>>;
|
|
4
|
+
//# sourceMappingURL=createInputRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInputRoot.d.ts","sourceRoot":"","sources":["../../../src/input/createInputRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAMhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI/C,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,WAAW,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,8EAiFlE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { IInputSlotProps } from './types';
|
|
3
|
+
export declare const createInputSlot: <T>(BaseInputSlot: React.ComponentType<T>) => React.ForwardRefExoticComponent<IInputSlotProps & React.RefAttributes<unknown>>;
|
|
4
|
+
//# sourceMappingURL=createInputSlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInputSlot.d.ts","sourceRoot":"","sources":["../../../src/input/createInputSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,eAAe,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,oFA+BtE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IInputComponentType } from './types';
|
|
2
|
+
export type { IInputFieldProps, IInputIconProps, IInputProps, IInputRootProps, IInputSlotProps, } from './types';
|
|
3
|
+
export declare const createInput: <RootProps, IconProps, SlotProps, FieldProps, RootRef = unknown, FieldRef = unknown>({ Root, Icon, Slot, Field, }: {
|
|
4
|
+
Root: React.ComponentType<RootProps>;
|
|
5
|
+
Icon: React.ComponentType<IconProps>;
|
|
6
|
+
Slot: React.ComponentType<SlotProps>;
|
|
7
|
+
Field: React.ComponentType<FieldProps>;
|
|
8
|
+
}) => IInputComponentType<RootProps, IconProps, SlotProps, FieldProps, RootRef, FieldRef>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/input/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,eAAe,EACf,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,WAAW,GACtB,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,GAAG,OAAO,EACjB,QAAQ,GAAG,OAAO,EAClB,8BAKC;IACD,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACrC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;CACxC,KAWiB,mBAAmB,CACjC,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,CAEX,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { TextInputProps, ViewProps } from 'react-native';
|
|
2
|
+
export interface InputContext {
|
|
3
|
+
isDisabled?: boolean;
|
|
4
|
+
isInvalid?: boolean;
|
|
5
|
+
isReadOnly?: boolean;
|
|
6
|
+
isRequired?: boolean;
|
|
7
|
+
isHovered?: boolean;
|
|
8
|
+
isFocused?: boolean;
|
|
9
|
+
handleFocus?: any;
|
|
10
|
+
isFocusVisible?: boolean;
|
|
11
|
+
isFullWidth?: boolean;
|
|
12
|
+
inputRef?: any;
|
|
13
|
+
setIsFocused?: any;
|
|
14
|
+
inputFieldRef?: any;
|
|
15
|
+
}
|
|
16
|
+
export interface IInputFieldProps {
|
|
17
|
+
/**
|
|
18
|
+
* If true, the input will indicate an error.
|
|
19
|
+
*/
|
|
20
|
+
isInvalid?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If true, the input will be disabled.
|
|
23
|
+
*/
|
|
24
|
+
isDisabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* If true, the input will be hovered.
|
|
27
|
+
*/
|
|
28
|
+
isHovered?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* If true, the input will be focused.
|
|
31
|
+
*/
|
|
32
|
+
isFocused?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* This will set aria-required="true" on web when passed in formcontrol.
|
|
35
|
+
*/
|
|
36
|
+
isRequired?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* If true, prevents the value of the input from being edited.
|
|
39
|
+
*/
|
|
40
|
+
isReadOnly?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* If true, the input element will span the full width of its parent
|
|
43
|
+
*/
|
|
44
|
+
isFullWidth?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface IInputRootProps extends IInputFieldProps {
|
|
47
|
+
children?: React.ReactNode;
|
|
48
|
+
isFocusVisible?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface IInputBaseProps extends TextInputProps {
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
isDisabled?: boolean;
|
|
53
|
+
isInvalid?: boolean;
|
|
54
|
+
isReadOnly?: boolean;
|
|
55
|
+
isRequired?: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface IInputTextProps extends IInputBaseProps {
|
|
58
|
+
type?: 'text' | 'password';
|
|
59
|
+
}
|
|
60
|
+
interface IInputFileProps extends IInputBaseProps {
|
|
61
|
+
type: 'file';
|
|
62
|
+
/** @platform web — Accepted file types, e.g. "image/*", ".pdf,.doc" */
|
|
63
|
+
accept?: string;
|
|
64
|
+
/** @platform web — Allow selecting multiple files */
|
|
65
|
+
multiple?: boolean;
|
|
66
|
+
/** @platform web — Preferred capture source on mobile web: "user" (front) or "environment" (rear) */
|
|
67
|
+
capture?: 'user' | 'environment';
|
|
68
|
+
/** @platform web — Called when the user selects files */
|
|
69
|
+
onFiles?: (files: File[]) => void;
|
|
70
|
+
}
|
|
71
|
+
export type IInputProps = IInputTextProps | IInputFileProps;
|
|
72
|
+
export interface IInputIconProps extends ViewProps {
|
|
73
|
+
children?: React.ReactNode;
|
|
74
|
+
}
|
|
75
|
+
export interface IInputSlotProps extends ViewProps {
|
|
76
|
+
children?: React.ReactNode;
|
|
77
|
+
onPress?: () => void;
|
|
78
|
+
isDisabled?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* If true, the input will be focused on press.
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
focusOnPress?: boolean;
|
|
84
|
+
}
|
|
85
|
+
export type IInputComponentType<RootProps, IconProps, SlotProps, FieldProps, RootRef = unknown, FieldRef = unknown> = React.ForwardRefExoticComponent<React.PropsWithoutRef<RootProps & IInputFieldProps> & React.RefAttributes<RootRef>> & {
|
|
86
|
+
Icon: React.ForwardRefExoticComponent<React.PropsWithoutRef<IconProps> & React.RefAttributes<unknown>>;
|
|
87
|
+
Slot: React.ForwardRefExoticComponent<React.PropsWithoutRef<SlotProps & IInputSlotProps> & React.RefAttributes<unknown>>;
|
|
88
|
+
Field: React.ForwardRefExoticComponent<React.PropsWithoutRef<FieldProps & IInputProps> & React.RefAttributes<FieldRef>>;
|
|
89
|
+
};
|
|
90
|
+
export {};
|
|
91
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/input/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type EntryOrExitLayoutType } from 'react-native-reanimated';
|
|
4
|
+
export interface OverlayContainerProps {
|
|
5
|
+
onDismiss: () => void;
|
|
6
|
+
entering?: EntryOrExitLayoutType;
|
|
7
|
+
exiting?: EntryOrExitLayoutType;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Cross-platform overlay container.
|
|
13
|
+
*
|
|
14
|
+
* - Web: renders children into a `createPortal` at `document.body` with
|
|
15
|
+
* `position: fixed` and `zIndex: 50`.
|
|
16
|
+
* - Native: renders children inside a transparent `<Modal>` with a
|
|
17
|
+
* backdrop `<Pressable>` that calls `onDismiss` on press.
|
|
18
|
+
*
|
|
19
|
+
* The consumer is responsible for not mounting this component when the
|
|
20
|
+
* overlay should be hidden.
|
|
21
|
+
*/
|
|
22
|
+
export declare function OverlayContainer({ onDismiss, entering, exiting, style, children, }: Readonly<OverlayContainerProps>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=OverlayContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayContainer.d.ts","sourceRoot":"","sources":["../../../src/overlay/OverlayContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAW/E,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,QAAQ,EACR,OAAO,EACP,KAAK,EACL,QAAQ,GACT,EAAE,QAAQ,CAAC,qBAAqB,CAAC,2CA+BjC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { OverlayContainer } from './OverlayContainer';
|
|
2
|
+
export type { OverlayContainerProps } from './OverlayContainer';
|
|
3
|
+
export { useAnchorPosition, type AnchorLayout } from './useAnchorPosition';
|
|
4
|
+
export { useDismissOverlay } from './useDismissOverlay';
|
|
5
|
+
export { useOverlayPosition, type OverlayPosition, OverlayInsetsProvider, type EdgeInsets, } from './useOverlayPosition';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/overlay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,kBAAkB,EAClB,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,UAAU,GAChB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
export interface AnchorLayout {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Measures an anchor element's position and size, re-measuring on scroll/resize
|
|
10
|
+
* (web) so a positioned overlay can track its anchor across layout changes.
|
|
11
|
+
*
|
|
12
|
+
* Returns `null` until the first measurement completes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useAnchorPosition(anchorRef: RefObject<any>, open: boolean): AnchorLayout | null;
|
|
15
|
+
//# sourceMappingURL=useAnchorPosition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnchorPosition.d.ts","sourceRoot":"","sources":["../../../src/overlay/useAnchorPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAOD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CA+C/F"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* No-op on native — overlay dismissal is handled by backdrop press
|
|
4
|
+
* or the system back gesture / hardware button via Modal.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useDismissOverlay(_open: boolean, _contentRef: RefObject<any>, _excludeRefs: RefObject<any>[], _onDismiss: () => void): void;
|
|
7
|
+
//# sourceMappingURL=useDismissOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDismissOverlay.d.ts","sourceRoot":"","sources":["../../../src/overlay/useDismissOverlay.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,WAAW,EAAE,SAAS,CAAC,GAAG,CAAC,EAC3B,YAAY,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,EAC9B,UAAU,EAAE,MAAM,IAAI,QACpB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Dismisses an overlay when the user clicks/presses outside of it or when
|
|
4
|
+
* focus moves to an element outside the overlay via keyboard.
|
|
5
|
+
* Events targeting `contentRef` or any of `excludeRefs` are ignored.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useDismissOverlay(open: boolean, contentRef: RefObject<any>, excludeRefs: RefObject<any>[], onDismiss: () => void): void;
|
|
8
|
+
//# sourceMappingURL=useDismissOverlay.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDismissOverlay.web.d.ts","sourceRoot":"","sources":["../../../src/overlay/useDismissOverlay.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,SAAS,CAAC,GAAG,CAAC,EAC1B,WAAW,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,EAC7B,SAAS,EAAE,MAAM,IAAI,QAsCtB"}
|