ui-library-sorin 0.0.2 → 0.0.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/components/Autocomplete/Autocomplete.d.ts +23 -0
- package/dist/components/Autocomplete/Autocomplete2.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete2.js +72 -0
- package/dist/components/Autocomplete/index.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/ui-library-sorin.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export interface AutocompleteOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AutocompleteProps {
|
|
7
|
+
label: string;
|
|
8
|
+
options: AutocompleteOption[];
|
|
9
|
+
value?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
onValueChange?: (value: string) => void;
|
|
12
|
+
filterType?: "contains" | "startsWith" | "endsWith";
|
|
13
|
+
limit?: number;
|
|
14
|
+
mode?: "list" | "both" | "inline" | "none";
|
|
15
|
+
icon?: ReactElement;
|
|
16
|
+
toggleIcon?: () => void;
|
|
17
|
+
className?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
hideError?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
name?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function Autocomplete({ label, options, filterType, limit, mode, icon, toggleIcon, className, error, hideError, ...props }: AutocompleteProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use client";const e=require("../../assets/icons/ErrorIcon.cjs");;/* empty css */let t=require("react/jsx-runtime"),n=require("@base-ui/react/autocomplete");function r({label:r,options:i,filterType:a=`contains`,limit:o,mode:s,icon:c,toggleIcon:l,className:u,error:d,hideError:f=!1,...p}){let{contains:m,startsWith:h,endsWith:g}=n.Autocomplete.useFilter(),_={contains:m,startsWith:h,endsWith:g}[a],v=[d?`ui-library-autocomplete--error`:``,c?`ui-library-autocomplete--has-icon`:``].filter(Boolean).join(` `);return(0,t.jsxs)(n.Autocomplete.Root,{items:i,filter:_,limit:o,mode:s,...p,children:[(0,t.jsxs)(`div`,{className:`ui-library-autocomplete ${u}`,children:[(0,t.jsxs)(`label`,{className:`ui-library-autocomplete__label ${v}`,children:[(0,t.jsx)(`span`,{className:`ui-library-autocomplete__span`,children:r}),(0,t.jsx)(n.Autocomplete.Input,{className:`ui-library-autocomplete__input`,"aria-invalid":!!d,placeholder:` `}),c&&(0,t.jsx)(`div`,{className:`ui-library-autocomplete__icon`,onClick:l,children:c})]}),!f&&(0,t.jsx)(`div`,{className:`ui-library-autocomplete__error`,children:d&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(`span`,{className:`ui-library-autocomplete__error-icon`,children:(0,t.jsx)(e.default,{})}),(0,t.jsx)(`span`,{className:`ui-library-autocomplete__error-text`,children:d})]})})]}),(0,t.jsx)(n.Autocomplete.Portal,{children:(0,t.jsx)(n.Autocomplete.Positioner,{className:`ui-library-autocomplete__positioner`,side:`bottom`,sideOffset:4,children:(0,t.jsxs)(n.Autocomplete.Popup,{className:`ui-library-autocomplete__popup`,children:[(0,t.jsx)(n.Autocomplete.Empty,{children:(0,t.jsx)(`div`,{className:`ui-library-autocomplete__empty`,children:`No hay resultados.`})}),(0,t.jsx)(n.Autocomplete.List,{className:`ui-library-autocomplete__list`,children:e=>(0,t.jsx)(n.Autocomplete.Item,{value:e,className:`ui-library-autocomplete__item`,children:e.label},e.value)})]})})})]})}exports.Autocomplete=r;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import e from "../../assets/icons/ErrorIcon.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
import { Autocomplete as i } from "@base-ui/react/autocomplete";
|
|
7
|
+
//#region src/components/Autocomplete/Autocomplete.tsx
|
|
8
|
+
function a({ label: a, options: o, filterType: s = "contains", limit: c, mode: l, icon: u, toggleIcon: d, className: f, error: p, hideError: m = !1, ...h }) {
|
|
9
|
+
let { contains: g, startsWith: _, endsWith: v } = i.useFilter(), y = {
|
|
10
|
+
contains: g,
|
|
11
|
+
startsWith: _,
|
|
12
|
+
endsWith: v
|
|
13
|
+
}[s], b = [p ? "ui-library-autocomplete--error" : "", u ? "ui-library-autocomplete--has-icon" : ""].filter(Boolean).join(" ");
|
|
14
|
+
return /* @__PURE__ */ r(i.Root, {
|
|
15
|
+
items: o,
|
|
16
|
+
filter: y,
|
|
17
|
+
limit: c,
|
|
18
|
+
mode: l,
|
|
19
|
+
...h,
|
|
20
|
+
children: [/* @__PURE__ */ r("div", {
|
|
21
|
+
className: `ui-library-autocomplete ${f}`,
|
|
22
|
+
children: [/* @__PURE__ */ r("label", {
|
|
23
|
+
className: `ui-library-autocomplete__label ${b}`,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ n("span", {
|
|
26
|
+
className: "ui-library-autocomplete__span",
|
|
27
|
+
children: a
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ n(i.Input, {
|
|
30
|
+
className: "ui-library-autocomplete__input",
|
|
31
|
+
"aria-invalid": !!p,
|
|
32
|
+
placeholder: " "
|
|
33
|
+
}),
|
|
34
|
+
u && /* @__PURE__ */ n("div", {
|
|
35
|
+
className: "ui-library-autocomplete__icon",
|
|
36
|
+
onClick: d,
|
|
37
|
+
children: u
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
}), !m && /* @__PURE__ */ n("div", {
|
|
41
|
+
className: "ui-library-autocomplete__error",
|
|
42
|
+
children: p && /* @__PURE__ */ r(t, { children: [/* @__PURE__ */ n("span", {
|
|
43
|
+
className: "ui-library-autocomplete__error-icon",
|
|
44
|
+
children: /* @__PURE__ */ n(e, {})
|
|
45
|
+
}), /* @__PURE__ */ n("span", {
|
|
46
|
+
className: "ui-library-autocomplete__error-text",
|
|
47
|
+
children: p
|
|
48
|
+
})] })
|
|
49
|
+
})]
|
|
50
|
+
}), /* @__PURE__ */ n(i.Portal, { children: /* @__PURE__ */ n(i.Positioner, {
|
|
51
|
+
className: "ui-library-autocomplete__positioner",
|
|
52
|
+
side: "bottom",
|
|
53
|
+
sideOffset: 4,
|
|
54
|
+
children: /* @__PURE__ */ r(i.Popup, {
|
|
55
|
+
className: "ui-library-autocomplete__popup",
|
|
56
|
+
children: [/* @__PURE__ */ n(i.Empty, { children: /* @__PURE__ */ n("div", {
|
|
57
|
+
className: "ui-library-autocomplete__empty",
|
|
58
|
+
children: "No hay resultados."
|
|
59
|
+
}) }), /* @__PURE__ */ n(i.List, {
|
|
60
|
+
className: "ui-library-autocomplete__list",
|
|
61
|
+
children: (e) => /* @__PURE__ */ n(i.Item, {
|
|
62
|
+
value: e,
|
|
63
|
+
className: "ui-library-autocomplete__item",
|
|
64
|
+
children: e.label
|
|
65
|
+
}, e.value)
|
|
66
|
+
})]
|
|
67
|
+
})
|
|
68
|
+
}) })]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { a as Autocomplete };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});/* empty css */const e=require("./components/Button/Button2.cjs"),t=require("./components/Input/Input2.cjs"),n=require("./components/Checkbox/Checkbox2.cjs"),r=require("./components/RadioNative/RadioNative2.cjs"),i=require("./components/Switch/Switch2.cjs"),a=require("./components/Select/Select2.cjs"),o=require("./components/Tabs/Tabs2.cjs"),s=require("./components/Tooltip/Tooltip2.cjs"),c=require("./components/IconButton/IconButton2.cjs"),l=require("./components/Timeline/Timeline2.cjs"),u=require("./components/Modal/Modal2.cjs");exports.Button=e.Button,exports.Checkbox=n.Checkbox,exports.IconButton=c.IconButton,exports.Input=t.Input,exports.Modal=u.Modal,exports.RadioNative=r.RadioNative,exports.Select=a.Select,exports.Switch=i.Switch,exports.Tabs=o.Tabs,exports.Timeline=l.Timeline,exports.Tooltip=s.Tooltip;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});/* empty css */const e=require("./components/Button/Button2.cjs"),t=require("./components/Input/Input2.cjs"),n=require("./components/Checkbox/Checkbox2.cjs"),r=require("./components/RadioNative/RadioNative2.cjs"),i=require("./components/Switch/Switch2.cjs"),a=require("./components/Select/Select2.cjs"),o=require("./components/Tabs/Tabs2.cjs"),s=require("./components/Tooltip/Tooltip2.cjs"),c=require("./components/IconButton/IconButton2.cjs"),l=require("./components/Timeline/Timeline2.cjs"),u=require("./components/Modal/Modal2.cjs"),d=require("./components/Autocomplete/Autocomplete2.cjs");exports.Autocomplete=d.Autocomplete,exports.Button=e.Button,exports.Checkbox=n.Checkbox,exports.IconButton=c.IconButton,exports.Input=t.Input,exports.Modal=u.Modal,exports.RadioNative=r.RadioNative,exports.Select=a.Select,exports.Switch=i.Switch,exports.Tabs=o.Tabs,exports.Timeline=l.Timeline,exports.Tooltip=s.Tooltip;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -10,4 +10,5 @@ import { Tooltip as s } from "./components/Tooltip/Tooltip2.js";
|
|
|
10
10
|
import { IconButton as c } from "./components/IconButton/IconButton2.js";
|
|
11
11
|
import { Timeline as l } from "./components/Timeline/Timeline2.js";
|
|
12
12
|
import { Modal as u } from "./components/Modal/Modal2.js";
|
|
13
|
-
|
|
13
|
+
import { Autocomplete as d } from "./components/Autocomplete/Autocomplete2.js";
|
|
14
|
+
export { d as Autocomplete, e as Button, n as Checkbox, c as IconButton, t as Input, u as Modal, r as RadioNative, a as Select, i as Switch, o as Tabs, l as Timeline, s as Tooltip };
|