@jamsrui/autocomplete 0.0.22 → 0.1.0
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 +1 -3
- package/dist/autocomplete-context.d.mts +2 -3
- package/dist/autocomplete-item.mjs +1 -1
- package/dist/autocomplete.d.mts +1 -2
- package/dist/autocomplete.mjs +1 -1
- package/dist/index.d.mts +2 -9
- package/dist/index.mjs +1 -1
- package/dist/{autocomplete-Fn-_jn7o.d.mts → use-autocomplete-C-5IcNBN.d.mts} +9 -11
- package/dist/use-autocomplete.d.mts +1 -2
- package/dist/use-autocomplete.mjs +1 -1
- package/package.json +5 -5
- package/dist/autocomplete-config.d.mts +0 -23
- package/dist/autocomplete-config.mjs +0 -1
- package/dist/styles.d.mts +0 -59
- package/dist/styles.mjs +0 -1
package/README.md
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
**A comprehensive React UI component library designed for developers, with Tailwind CSS integration for seamless styling.**
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
## 📖 **Overview**
|
|
7
6
|
|
|
8
7
|
[JamsrUI](https://jamsr-ui.jamsrworld.com) is designed to help developers build modern, fast and visually appealing web applications with ease.
|
|
9
8
|
|
|
10
|
-
## 🚀 Getting Started
|
|
9
|
+
## 🚀 Getting Started
|
|
11
10
|
|
|
12
11
|
Boost & Build your websites using [JamsrUI](https://jamsr-ui.jamsrworld.com).
|
|
13
12
|
|
|
@@ -37,4 +36,3 @@ We welcome contributions from developers of all skill levels!
|
|
|
37
36
|
## ⭐ Support the Project
|
|
38
37
|
|
|
39
38
|
If you find **JamsrUI** helpful, consider giving it a ⭐ on [GitHub](https://github.com/jamsrworld/jamsr-ui).
|
|
40
|
-
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { u as useAutocomplete } from './autocomplete-
|
|
3
|
-
import 'react/jsx-runtime';
|
|
2
|
+
import { u as useAutocomplete } from './use-autocomplete-C-5IcNBN.mjs';
|
|
4
3
|
import '@floating-ui/react';
|
|
5
4
|
import '@jamsrui/input';
|
|
6
5
|
import '@jamsrui/utils';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
7
|
import './autocomplete-content.mjs';
|
|
8
8
|
import './autocomplete-item.mjs';
|
|
9
9
|
import './autocomplete-popover.mjs';
|
|
10
|
-
import './styles.mjs';
|
|
11
10
|
|
|
12
11
|
declare const useAutocompleteContext: () => AutocompleteContext.Props;
|
|
13
12
|
declare const AutocompleteContext: react.Context<AutocompleteContext.Props | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useListItem as
|
|
1
|
+
"use client";import{useListItem as x}from"@floating-ui/react";import{useHover as g,useMergeRefs as A,useRenderElement as L}from"@jamsrui/hooks";import{useAutocompleteContext as P}from"./autocomplete-context.mjs";const M=l=>{const{textValue:a,children:e,value:t,disabled:i,...n}=l,{getAutocompleteItemProps:c,activeIndex:d,value:m}=P(),s=a??(typeof e=="string"?e:t);s.length||console.warn(`No label provided for list item with value ${t}`);const{ref:p,index:u}=x({label:s}),o=i??!1,r=m.includes(t),f=d===u,{isHovered:v,ref:I}=g({isDisabled:o}),b=A([p,I]);return L("li",{props:[c(n),{ref:b,"aria-selected":r,"data-selected":r,"aria-disabled":o,"data-disabled":o,"data-active":f,"data-hovered":v,children:e}]})};export{M as AutocompleteItem};
|
package/dist/autocomplete.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'react/jsx-runtime';
|
|
2
|
-
export { A as Autocomplete } from './autocomplete-
|
|
2
|
+
export { A as Autocomplete } from './use-autocomplete-C-5IcNBN.mjs';
|
|
3
3
|
import '@floating-ui/react';
|
|
4
4
|
import '@jamsrui/input';
|
|
5
5
|
import '@jamsrui/utils';
|
|
@@ -7,4 +7,3 @@ import 'react';
|
|
|
7
7
|
import './autocomplete-content.mjs';
|
|
8
8
|
import './autocomplete-item.mjs';
|
|
9
9
|
import './autocomplete-popover.mjs';
|
|
10
|
-
import './styles.mjs';
|
package/dist/autocomplete.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as f,jsx as o,jsxs as P}from"react/jsx-runtime";import{useRenderElement as l}from"@jamsrui/hooks";import{Input as u}from"@jamsrui/input";import{AutocompleteContent as s}from"./autocomplete-content.mjs";import{AutocompleteContext as i}from"./autocomplete-context.mjs";import{AutocompletePopover as A}from"./autocomplete-popover.mjs";import{useAutocomplete as d}from"./use-autocomplete.mjs";const E=e=>{const{children:p}=e,t=d(e),{getRootProps:r,getInputProps:m}=t,n=P(f,{children:[o(u,{...m({})}),o(A,{children:o(s,{children:p})})]}),c=l("div",{props:[r({}),{children:n}]});return o(i,{value:t,children:c})};export{E as Autocomplete};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import { A as Autocomplete$1 } from './autocomplete-
|
|
4
|
-
export { u as useAutocomplete } from './autocomplete-Fn-_jn7o.mjs';
|
|
5
|
-
import { AutocompleteConfig } from './autocomplete-config.mjs';
|
|
6
|
-
export { useAutocompleteConfig } from './autocomplete-config.mjs';
|
|
3
|
+
import { A as Autocomplete$1 } from './use-autocomplete-C-5IcNBN.mjs';
|
|
7
4
|
import { AutocompleteItem } from './autocomplete-item.mjs';
|
|
8
|
-
export { AutocompleteSlots, AutocompleteVariantProps, autocompleteVariants } from './styles.mjs';
|
|
9
5
|
import '@floating-ui/react';
|
|
10
6
|
import '@jamsrui/input';
|
|
11
7
|
import '@jamsrui/utils';
|
|
12
8
|
import './autocomplete-content.mjs';
|
|
13
9
|
import './autocomplete-popover.mjs';
|
|
14
|
-
import '@jamsrui/core';
|
|
15
10
|
|
|
16
11
|
declare const Autocomplete: ((props: Autocomplete$1.Props) => react_jsx_runtime.JSX.Element) & {
|
|
17
12
|
Item: (props: AutocompleteItem.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
@@ -19,10 +14,8 @@ declare const Autocomplete: ((props: Autocomplete$1.Props) => react_jsx_runtime.
|
|
|
19
14
|
declare namespace Autocomplete {
|
|
20
15
|
interface Props extends Autocomplete$1.Props {
|
|
21
16
|
}
|
|
22
|
-
interface Config extends AutocompleteConfig.Props {
|
|
23
|
-
}
|
|
24
17
|
interface Item extends AutocompleteItem.Props {
|
|
25
18
|
}
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
export { Autocomplete
|
|
21
|
+
export { Autocomplete };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Autocomplete as
|
|
1
|
+
import{Autocomplete as e}from"./autocomplete.mjs";import{AutocompleteItem as t}from"./autocomplete-item.mjs";const m=Object.assign(e,{Item:t});export{m as Autocomplete};
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import { FloatingList, FloatingFocusManagerProps, Placement } from '@floating-ui/react';
|
|
3
2
|
import { Input } from '@jamsrui/input';
|
|
4
|
-
import { PropGetter
|
|
3
|
+
import { PropGetter } from '@jamsrui/utils';
|
|
5
4
|
import { ComponentProps } from 'react';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { AutocompleteContent } from './autocomplete-content.mjs';
|
|
7
7
|
import { AutocompleteItem } from './autocomplete-item.mjs';
|
|
8
8
|
import { AutocompletePopover } from './autocomplete-popover.mjs';
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
declare const Autocomplete: (props: Autocomplete.Props) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
declare namespace Autocomplete {
|
|
12
|
+
interface Props extends useAutocomplete.Props {
|
|
13
|
+
}
|
|
14
|
+
}
|
|
10
15
|
|
|
11
16
|
declare const useAutocomplete: (props: useAutocomplete.Props) => {
|
|
12
17
|
getAutocompleteItemProps: PropGetter<AutocompleteItem.Props>;
|
|
@@ -22,7 +27,6 @@ declare const useAutocomplete: (props: useAutocomplete.Props) => {
|
|
|
22
27
|
};
|
|
23
28
|
declare namespace useAutocomplete {
|
|
24
29
|
interface InnerProps {
|
|
25
|
-
classNames?: SlotsToClassNames<AutocompleteSlots>;
|
|
26
30
|
value?: string[];
|
|
27
31
|
defaultValue?: string[];
|
|
28
32
|
onValueChange?: (value: string[]) => void;
|
|
@@ -32,15 +36,9 @@ declare namespace useAutocomplete {
|
|
|
32
36
|
onOpenChange?: (value: boolean) => void;
|
|
33
37
|
isMultiple?: boolean;
|
|
34
38
|
}
|
|
35
|
-
export interface Props extends Omit<Input.Props, keyof InnerProps>,
|
|
39
|
+
export interface Props extends Omit<Input.Props, keyof InnerProps>, InnerProps {
|
|
36
40
|
}
|
|
37
41
|
export { };
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
declare const Autocomplete: (props: Autocomplete.Props) => react_jsx_runtime.JSX.Element;
|
|
41
|
-
declare namespace Autocomplete {
|
|
42
|
-
interface Props extends useAutocomplete.Props {
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
44
|
export { Autocomplete as A, useAutocomplete as u };
|
|
@@ -2,9 +2,8 @@ import '@floating-ui/react';
|
|
|
2
2
|
import '@jamsrui/input';
|
|
3
3
|
import '@jamsrui/utils';
|
|
4
4
|
import 'react';
|
|
5
|
-
export { u as useAutocomplete } from './autocomplete-
|
|
5
|
+
export { u as useAutocomplete } from './use-autocomplete-C-5IcNBN.mjs';
|
|
6
6
|
import './autocomplete-content.mjs';
|
|
7
7
|
import './autocomplete-item.mjs';
|
|
8
8
|
import './autocomplete-popover.mjs';
|
|
9
|
-
import './styles.mjs';
|
|
10
9
|
import 'react/jsx-runtime';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useCallback as
|
|
1
|
+
"use client";import{useCallback as t,useMemo as T,useRef as $,useState as r}from"react";import{autoUpdate as z,flip as U,offset as W,size as q,useDismiss as B,useFloating as J,useInteractions as K,useListNavigation as Q,useRole as X}from"@floating-ui/react";import{useControlledState as F}from"@jamsrui/hooks";const pe=O=>{const{isOpen:A,defaultOpen:C,onOpenChange:b,value:M,defaultValue:R,onValueChange:G,placement:l="bottom-start",isMultiple:Y,...a}=O,i=$([]),[n,L]=r(null),[V,Z]=r(1),[_,S]=r(!1),[s=!1,p]=F({defaultProp:C,onChange:b,prop:A}),[u=[],ee]=F({defaultProp:R,onChange:G,prop:M}),{refs:{setReference:j,setFloating:m},floatingStyles:c,context:o}=J({placement:l,open:s,onOpenChange:p,whileElementsMounted:z,middleware:[W(2),U({crossAxis:l.includes("-"),padding:0}),q({apply({rects:e,elements:D,availableHeight:E}){Object.assign(D.floating.style,{maxHeight:`${Math.max(50,Math.min(400,E))}px`,minWidth:`${e.reference.width}px`})},padding:0})]}),w=Q(o,{listRef:i,activeIndex:n,selectedIndex:V,onNavigate:L,virtual:!0,loop:!0}),H=B(o,{outsidePress:!0}),N=X(o,{role:"listbox"}),{getReferenceProps:d,getFloatingProps:g,getItemProps:te}=K([w,H,N]),k=t(()=>{S(!0),p(e=>!e)},[p]),P=t(()=>({...a,"data-component":"autocomplete","data-slot":"root"}),[a]),f=t(e=>({...e,"data-slot":"item"}),[]),v=t(e=>({...e,"data-slot":"popover",style:c,...g({}),ref:m}),[c,g,m]),I=t(e=>({...e,"data-slot":"content"}),[]),h=t(()=>({context:o,initialFocus:-1,visuallyHiddenDismiss:!0,modal:!0,restoreFocus:!0}),[o]),x=t(()=>({elementsRef:i}),[]),y=t(e=>({...e,...d({})}),[d,k,j]);return T(()=>({getAutocompleteItemProps:f,getRootProps:P,getInputProps:y,getContentProps:I,getPopoverProps:v,getFloatingListProps:x,getFocusManagerProps:h,isOpen:s,activeIndex:n,value:u}),[n,f,I,x,h,y,v,P,s,u])};export{pe as useAutocomplete};
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamsrui/autocomplete",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"motion": ">=12",
|
|
6
6
|
"react": ">=19"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@floating-ui/react": ">=0.27",
|
|
10
|
-
"@jamsrui/hooks": "^0.0
|
|
11
|
-
"@jamsrui/
|
|
12
|
-
"@jamsrui/
|
|
13
|
-
"@jamsrui/core": "^0.0
|
|
10
|
+
"@jamsrui/hooks": "^0.1.0",
|
|
11
|
+
"@jamsrui/input": "^0.1.0",
|
|
12
|
+
"@jamsrui/utils": "^0.1.0",
|
|
13
|
+
"@jamsrui/core": "^0.1.0"
|
|
14
14
|
},
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { WithGlobalConfig } from '@jamsrui/core';
|
|
3
|
-
import { A as Autocomplete } from './autocomplete-Fn-_jn7o.mjs';
|
|
4
|
-
import '@floating-ui/react';
|
|
5
|
-
import '@jamsrui/input';
|
|
6
|
-
import '@jamsrui/utils';
|
|
7
|
-
import 'react';
|
|
8
|
-
import './autocomplete-content.mjs';
|
|
9
|
-
import './autocomplete-item.mjs';
|
|
10
|
-
import './autocomplete-popover.mjs';
|
|
11
|
-
import './styles.mjs';
|
|
12
|
-
|
|
13
|
-
declare const useAutocompleteConfig: () => AutocompleteConfig.Props;
|
|
14
|
-
declare const AutocompleteConfig: (props: Omit<Partial<AutocompleteConfig.Props>, "children"> & {
|
|
15
|
-
merge?: boolean;
|
|
16
|
-
children: React.ReactNode;
|
|
17
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
18
|
-
declare namespace AutocompleteConfig {
|
|
19
|
-
interface Props extends WithGlobalConfig<Autocomplete.Props> {
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { AutocompleteConfig, useAutocompleteConfig };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{createConfigContext as o}from"@jamsrui/utils";const[t,p]=o({displayName:"AutocompleteConfig"});export{t as AutocompleteConfig,p as useAutocompleteConfig};
|
package/dist/styles.d.mts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as _jamsrui_utils from '@jamsrui/utils';
|
|
2
|
-
import { VariantProps } from '@jamsrui/utils';
|
|
3
|
-
|
|
4
|
-
declare const autocompleteVariants: _jamsrui_utils.TVReturnType<{
|
|
5
|
-
radius: {
|
|
6
|
-
sm: {};
|
|
7
|
-
md: {};
|
|
8
|
-
lg: {};
|
|
9
|
-
xl: {};
|
|
10
|
-
"2xl": {};
|
|
11
|
-
"3xl": {};
|
|
12
|
-
full: {};
|
|
13
|
-
none: {};
|
|
14
|
-
};
|
|
15
|
-
}, {
|
|
16
|
-
root: string[];
|
|
17
|
-
popover: string;
|
|
18
|
-
content: string;
|
|
19
|
-
emptyContent: string;
|
|
20
|
-
item: string[];
|
|
21
|
-
}, undefined, {
|
|
22
|
-
radius: {
|
|
23
|
-
sm: {};
|
|
24
|
-
md: {};
|
|
25
|
-
lg: {};
|
|
26
|
-
xl: {};
|
|
27
|
-
"2xl": {};
|
|
28
|
-
"3xl": {};
|
|
29
|
-
full: {};
|
|
30
|
-
none: {};
|
|
31
|
-
};
|
|
32
|
-
}, {
|
|
33
|
-
root: string[];
|
|
34
|
-
popover: string;
|
|
35
|
-
content: string;
|
|
36
|
-
emptyContent: string;
|
|
37
|
-
item: string[];
|
|
38
|
-
}, _jamsrui_utils.TVReturnType<{
|
|
39
|
-
radius: {
|
|
40
|
-
sm: {};
|
|
41
|
-
md: {};
|
|
42
|
-
lg: {};
|
|
43
|
-
xl: {};
|
|
44
|
-
"2xl": {};
|
|
45
|
-
"3xl": {};
|
|
46
|
-
full: {};
|
|
47
|
-
none: {};
|
|
48
|
-
};
|
|
49
|
-
}, {
|
|
50
|
-
root: string[];
|
|
51
|
-
popover: string;
|
|
52
|
-
content: string;
|
|
53
|
-
emptyContent: string;
|
|
54
|
-
item: string[];
|
|
55
|
-
}, undefined, unknown, unknown, undefined>>;
|
|
56
|
-
type AutocompleteSlots = keyof ReturnType<typeof autocompleteVariants>;
|
|
57
|
-
type AutocompleteVariantProps = VariantProps<typeof autocompleteVariants>;
|
|
58
|
-
|
|
59
|
-
export { type AutocompleteSlots, type AutocompleteVariantProps, autocompleteVariants };
|
package/dist/styles.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{radiusVariant as e,tv as o}from"@jamsrui/utils";const r=o({slots:{root:["group relative flex w-full flex-col text-sm"],popover:"z-popover flex flex-col overflow-hidden rounded-2xl bg-surface shadow-md backdrop-blur-3xl focus:outline-none",content:"flex flex-col gap-px overflow-y-auto p-2",emptyContent:"text-foreground-500",item:["relative flex w-full cursor-pointer select-none items-center gap-2 rounded-xl p-2 text-sm","ui-hover:bg-surface-secondary","ui-active:bg-surface-secondary","ui-selected:bg-surface-secondary/50","ui-disabled:cursor-not-allowed ui-disabled:opacity-disabled"]},variants:{radius:e(["popover","item"])},defaultVariants:{radius:"md"}});export{r as autocompleteVariants};
|