@brightlocal/ui-components 1.2.3 → 1.2.4

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),J=require("react"),Q=require("@brightlocal/icons"),R=require("@brightlocal/ui-components/lib/utils"),U=require("../button.cjs"),S=require("../field.cjs"),W=require("../input.cjs"),m=require("../list.cjs");function Y(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const c in t)if(c!=="default"){const f=Object.getOwnPropertyDescriptor(t,c);Object.defineProperty(a,c,f.get?f:{enumerable:!0,get:()=>t[c]})}}return a.default=t,Object.freeze(a)}const o=Y(J);function q({value:t,onValueChange:a,maxItems:c,placeholder:f="Add item",addButtonLabel:E="Add",skeletonCount:M=3,disabled:h=!1,loading:g=!1,error:D=!1,errorMessage:I,description:N,dataHook:d,trackingEl:O,trackingLabel:F,className:P}){const[b,$]=o.useState(""),[T,k]=o.useState(()=>new Set),[j,v]=o.useState(()=>new Set);o.useEffect(()=>{if(j.size===0)return;const e=requestAnimationFrame(()=>{v(new Set)});return()=>cancelAnimationFrame(e)},[j]);const x=o.useRef(t);o.useEffect(()=>{x.current=t},[t]);const y=o.useRef(new Set);o.useEffect(()=>{const e=y.current;return()=>{e.forEach(clearTimeout),e.clear()}},[]);const A=o.useRef(t.length),[K,p]=o.useState(()=>t.map((e,s)=>s));o.useEffect(()=>{p(e=>e.length!==t.length?t.map(()=>A.current++):e)},[t]);const _=c!==void 0&&t.length>=c,L=h||_||g,z=h||_||g,w=o.useCallback(e=>{const s=e.map(r=>r.trim()).filter(Boolean);if(!s.length)return;const l=c!==void 0?c-t.length:1/0,i=s.slice(0,l);if(i.length){if(!window.matchMedia("(prefers-reduced-motion: reduce)").matches){const u=t.length;v(new Set(i.map((Z,G)=>u+G)))}p(u=>[...u,...i.map(()=>A.current++)]),a([...t,...i]),$("")}},[t,c,a]),C=o.useCallback(e=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){p(i=>i.filter((r,u)=>u!==e)),a(x.current.filter((i,r)=>r!==e));return}k(i=>new Set(i).add(e));const l=setTimeout(()=>{y.current.delete(l),k(i=>{const r=new Set(i);return r.delete(e),r}),p(i=>i.filter((r,u)=>u!==e)),a(x.current.filter((i,r)=>r!==e))},200);y.current.add(l)},[a]),B=e=>{e.key==="Enter"&&(e.preventDefault(),w([b]))},X=e=>{const l=e.clipboardData.getData("text").split(`
2
- `);l.length>1&&(e.preventDefault(),w(l))};return n.jsxs("div",{className:R.cn("flex flex-col gap-4",P),"data-hook":d,"data-slot":"input-list","data-tracking-el":O,"data-tracking-label":F,children:[g?n.jsx("ul",{className:"flex flex-col gap-2","data-slot":"input-list-skeleton",children:Array.from({length:M}).map((e,s)=>n.jsx(m.Item,{variant:"loading"},s))}):t.length>0?n.jsx("ul",{className:"flex flex-col","data-hook":`${d}-list`,"data-slot":"list",children:t.map((e,s)=>{const l=T.has(s),r=j.has(s)||l;return n.jsx("li",{className:R.cn("grid transition-[grid-template-rows,opacity,margin-bottom] ease-out",r?"mb-0 grid-rows-[0fr] opacity-0":"mb-2 grid-rows-[1fr] opacity-100 last:mb-0",l?"duration-200":"duration-300"),"data-hook":`${d}-item-${s}`,"data-slot":"item",children:n.jsx("div",{className:"overflow-hidden",children:n.jsxs("div",{className:"bg-card flex items-center gap-4 rounded-lg py-2 pr-2 pl-4",children:[n.jsx(m.ItemContent,{children:n.jsx(m.ItemTitle,{children:e})}),n.jsx(m.ItemActions,{children:n.jsx("button",{"aria-label":`Remove ${e}`,className:R.cn("inline-flex size-9 cursor-pointer items-center justify-center rounded-full","text-muted-foreground","focus-visible:shadow-default outline-none","transition-colors duration-150 ease-in-out","disabled:pointer-events-none disabled:opacity-50"),"data-hook":`${d}-remove-${s}`,disabled:h||l,type:"button",onClick:()=>C(s),children:n.jsx(Q.X,{})})})]})})},K[s])})}):null,n.jsxs("div",{className:"flex flex-col gap-2","data-slot":"input-list-input-area",children:[n.jsxs("div",{className:"flex gap-2",children:[n.jsx(W.Input,{className:"flex-1",dataHook:`${d}-input`,disabled:L,error:D,placeholder:f,value:b,onChange:e=>$(e.target.value),onKeyDown:B,onPaste:X}),n.jsx(U.Button,{dataHook:`${d}-add`,disabled:z,onClick:()=>w([b]),children:E})]}),N&&n.jsx(S.FieldDescription,{"data-slot":"input-list-description",dataHook:`${d}-description`,children:N}),c!==void 0&&n.jsxs(S.FieldDescription,{"data-slot":"input-list-count",dataHook:`${d}-count`,children:[t.length,"/",c]}),D&&I&&n.jsx(S.FieldError,{"data-slot":"input-list-error",dataHook:`${d}-error`,children:I})]})]})}q.displayName="InputList";exports.InputList=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),T=require("react"),q=require("framer-motion"),z=require("@brightlocal/icons"),A=require("@brightlocal/ui-components/lib/utils"),B=require("../button.cjs"),b=require("../field.cjs"),M=require("../input.cjs"),u=require("../list.cjs");function v(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const d=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(a,s,d.get?d:{enumerable:!0,get:()=>e[s]})}}return a.default=e,Object.freeze(a)}const o=v(T);function I({value:e,onValueChange:a,maxItems:s,placeholder:d="Add item",addButtonLabel:S="Add",skeletonCount:_=3,disabled:p=!1,loading:f=!1,error:y=!1,errorMessage:D,description:$,dataHook:l,trackingEl:O,trackingLabel:P,className:R}){const[h,k]=o.useState(""),g=o.useRef(e.length),[w,m]=o.useState(()=>e.map((t,i)=>i));o.useEffect(()=>{m(t=>t.length===e.length?t:e.length>t.length?[...t,...Array.from({length:e.length-t.length},()=>g.current++)]:e.map(()=>g.current++))},[e]);const N=s!==void 0&&e.length>=s,F=p||N||f,K=p||N||f,j=o.useCallback(t=>{const i=t.map(x=>x.trim()).filter(Boolean);if(!i.length)return;const r=s!==void 0?s-e.length:1/0,c=i.slice(0,r);c.length&&(m(x=>[...x,...c.map(()=>g.current++)]),a([...e,...c]),k(""))},[e,s,a]),L=o.useCallback(t=>{m(i=>i.filter((r,c)=>c!==t)),a(e.filter((i,r)=>r!==t))},[e,a]),C=t=>{t.key==="Enter"&&(t.preventDefault(),j([h]))},E=t=>{const r=t.clipboardData.getData("text").split(`
2
+ `);r.length>1&&(t.preventDefault(),j(r))};return n.jsxs("div",{className:A.cn("flex flex-col gap-4",R),"data-hook":l,"data-slot":"input-list","data-tracking-el":O,"data-tracking-label":P,children:[f?n.jsx("ul",{className:"flex flex-col gap-2","data-slot":"input-list-skeleton",children:Array.from({length:_}).map((t,i)=>n.jsx(u.Item,{variant:"loading"},i))}):e.length>0?n.jsx("ul",{className:"flex flex-col gap-2","data-hook":`${l}-list`,"data-slot":"list",children:n.jsx(q.AnimatePresence,{initial:!1,children:e.map((t,i)=>n.jsx(q.motion.li,{layout:!0,animate:{opacity:1,scale:1},"data-hook":`${l}-item-${i}`,"data-slot":"item",exit:{opacity:0,scale:.8,transition:{opacity:{duration:.15},scale:{duration:.12}}},initial:{opacity:0,scale:.8},transition:{opacity:{duration:.15},scale:{duration:.15},layout:{type:"spring",stiffness:500,damping:35}},children:n.jsxs("div",{className:"bg-card flex items-center gap-4 rounded-lg py-2 pr-2 pl-4",children:[n.jsx(u.ItemContent,{children:n.jsx(u.ItemTitle,{children:t})}),n.jsx(u.ItemActions,{children:n.jsx("button",{"aria-label":`Remove ${t}`,className:A.cn("inline-flex size-9 cursor-pointer items-center justify-center rounded-full","text-muted-foreground","focus-visible:shadow-default outline-none","transition-colors duration-150 ease-in-out","disabled:pointer-events-none disabled:opacity-50"),"data-hook":`${l}-remove-${i}`,disabled:p,type:"button",onClick:()=>L(i),children:n.jsx(z.X,{})})})]})},w[i]))})}):null,n.jsxs("div",{className:"flex flex-col gap-2","data-slot":"input-list-input-area",children:[n.jsxs("div",{className:"flex gap-2",children:[n.jsx(M.Input,{className:"flex-1",dataHook:`${l}-input`,disabled:F,error:y,placeholder:d,value:h,onChange:t=>k(t.target.value),onKeyDown:C,onPaste:E}),n.jsx(B.Button,{dataHook:`${l}-add`,disabled:K,onClick:()=>j([h]),children:S})]}),y&&D?n.jsx(b.FieldError,{"data-slot":"input-list-error",dataHook:`${l}-error`,children:D}):n.jsxs(n.Fragment,{children:[$&&n.jsx(b.FieldDescription,{"data-slot":"input-list-description",dataHook:`${l}-description`,children:$}),s!==void 0&&n.jsxs(b.FieldDescription,{"data-slot":"input-list-count",dataHook:`${l}-count`,children:[e.length,"/",s]})]})]})]})}I.displayName="InputList";exports.InputList=I;
@@ -1 +1 @@
1
- {"version":3,"file":"input-list.d.ts","sourceRoot":"","sources":["../../src/blocks/input-list.tsx"],"names":[],"mappings":"AAeA;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,aAAa,EACb,QAAQ,EACR,WAAwB,EACxB,cAAsB,EACtB,aAAiB,EACjB,QAAgB,EAChB,OAAe,EACf,KAAa,EACb,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EACb,SAAS,GACV,EAAE,cAAc,2CAkPhB;kBAlQQ,SAAS;;;AAsQlB,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"input-list.d.ts","sourceRoot":"","sources":["../../src/blocks/input-list.tsx"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,aAAa,EACb,QAAQ,EACR,WAAwB,EACxB,cAAsB,EACtB,aAAiB,EACjB,QAAgB,EAChB,OAAe,EACf,KAAa,EACb,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EACb,SAAS,GACV,EAAE,cAAc,2CAmNhB;kBAnOQ,SAAS;;;AAuOlB,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,215 +1,191 @@
1
- import { jsxs as u, jsx as r } from "react/jsx-runtime";
2
- import * as o from "react";
3
- import { X as J } from "@brightlocal/icons";
4
- import { cn as S } from "@brightlocal/ui-components/lib/utils";
5
- import { Button as O } from "../button.js";
6
- import { FieldDescription as _, FieldError as Q } from "../field.js";
7
- import { Input as U } from "../input.js";
8
- import { Item as W, ItemContent as Y, ItemTitle as Z, ItemActions as V } from "../list.js";
9
- function H({
1
+ import { jsxs as r, jsx as i, Fragment as B } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { AnimatePresence as z, motion as T } from "framer-motion";
4
+ import { X } from "@brightlocal/icons";
5
+ import { cn as N } from "@brightlocal/ui-components/lib/utils";
6
+ import { Button as q } from "../button.js";
7
+ import { FieldError as G, FieldDescription as A } from "../field.js";
8
+ import { Input as J } from "../input.js";
9
+ import { Item as O, ItemContent as Q, ItemTitle as U, ItemActions as W } from "../list.js";
10
+ function Y({
10
11
  value: e,
11
- onValueChange: f,
12
- maxItems: c,
13
- placeholder: M = "Add item",
14
- addButtonLabel: x = "Add",
15
- skeletonCount: F = 3,
12
+ onValueChange: d,
13
+ maxItems: a,
14
+ placeholder: I = "Add item",
15
+ addButtonLabel: K = "Add",
16
+ skeletonCount: R = 3,
16
17
  disabled: p = !1,
17
- loading: h = !1,
18
- error: I = !1,
19
- errorMessage: N,
20
- description: $,
18
+ loading: f = !1,
19
+ error: b = !1,
20
+ errorMessage: $,
21
+ description: k,
21
22
  dataHook: l,
22
- trackingEl: K,
23
+ trackingEl: _,
23
24
  trackingLabel: j,
24
- className: C
25
+ className: w
25
26
  }) {
26
- const [g, A] = o.useState(""), [L, k] = o.useState(
27
- () => /* @__PURE__ */ new Set()
28
- ), [b, D] = o.useState(
29
- () => /* @__PURE__ */ new Set()
30
- );
31
- o.useEffect(() => {
32
- if (b.size === 0) return;
33
- const t = requestAnimationFrame(() => {
34
- D(/* @__PURE__ */ new Set());
35
- });
36
- return () => cancelAnimationFrame(t);
37
- }, [b]);
38
- const w = o.useRef(e);
39
- o.useEffect(() => {
40
- w.current = e;
41
- }, [e]);
42
- const y = o.useRef(/* @__PURE__ */ new Set());
43
- o.useEffect(() => {
44
- const t = y.current;
45
- return () => {
46
- t.forEach(clearTimeout), t.clear();
47
- };
48
- }, []);
49
- const v = o.useRef(e.length), [T, m] = o.useState(
27
+ const [m, x] = s.useState(""), u = s.useRef(e.length), [C, h] = s.useState(
50
28
  () => e.map((t, n) => n)
51
29
  );
52
- o.useEffect(() => {
53
- m((t) => t.length !== e.length ? e.map(() => v.current++) : t);
30
+ s.useEffect(() => {
31
+ h((t) => t.length === e.length ? t : e.length > t.length ? [
32
+ ...t,
33
+ ...Array.from(
34
+ { length: e.length - t.length },
35
+ () => u.current++
36
+ )
37
+ ] : e.map(() => u.current++));
54
38
  }, [e]);
55
- const E = c !== void 0 && e.length >= c, z = p || E || h, B = p || E || h, R = o.useCallback(
39
+ const D = a !== void 0 && e.length >= a, E = p || D || f, F = p || D || f, g = s.useCallback(
56
40
  (t) => {
57
- const n = t.map((s) => s.trim()).filter(Boolean);
41
+ const n = t.map((y) => y.trim()).filter(Boolean);
58
42
  if (!n.length) return;
59
- const a = c !== void 0 ? c - e.length : 1 / 0, i = n.slice(0, a);
60
- if (i.length) {
61
- if (!window.matchMedia(
62
- "(prefers-reduced-motion: reduce)"
63
- ).matches) {
64
- const d = e.length;
65
- D(new Set(i.map((tt, G) => d + G)));
66
- }
67
- m((d) => [
68
- ...d,
69
- ...i.map(() => v.current++)
70
- ]), f([...e, ...i]), A("");
71
- }
43
+ const o = a !== void 0 ? a - e.length : 1 / 0, c = n.slice(0, o);
44
+ c.length && (h((y) => [
45
+ ...y,
46
+ ...c.map(() => u.current++)
47
+ ]), d([...e, ...c]), x(""));
72
48
  },
73
- [e, c, f]
74
- ), P = o.useCallback(
49
+ [e, a, d]
50
+ ), L = s.useCallback(
75
51
  (t) => {
76
- if (window.matchMedia(
77
- "(prefers-reduced-motion: reduce)"
78
- ).matches) {
79
- m((i) => i.filter((s, d) => d !== t)), f(w.current.filter((i, s) => s !== t));
80
- return;
81
- }
82
- k((i) => new Set(i).add(t));
83
- const a = setTimeout(() => {
84
- y.current.delete(a), k((i) => {
85
- const s = new Set(i);
86
- return s.delete(t), s;
87
- }), m((i) => i.filter((s, d) => d !== t)), f(w.current.filter((i, s) => s !== t));
88
- }, 200);
89
- y.current.add(a);
52
+ h((n) => n.filter((o, c) => c !== t)), d(e.filter((n, o) => o !== t));
90
53
  },
91
- [f]
92
- ), q = (t) => {
93
- t.key === "Enter" && (t.preventDefault(), R([g]));
94
- }, X = (t) => {
95
- const a = t.clipboardData.getData("text").split(`
54
+ [e, d]
55
+ ), P = (t) => {
56
+ t.key === "Enter" && (t.preventDefault(), g([m]));
57
+ }, S = (t) => {
58
+ const o = t.clipboardData.getData("text").split(`
96
59
  `);
97
- a.length > 1 && (t.preventDefault(), R(a));
60
+ o.length > 1 && (t.preventDefault(), g(o));
98
61
  };
99
- return /* @__PURE__ */ u(
62
+ return /* @__PURE__ */ r(
100
63
  "div",
101
64
  {
102
- className: S("flex flex-col gap-4", C),
65
+ className: N("flex flex-col gap-4", w),
103
66
  "data-hook": l,
104
67
  "data-slot": "input-list",
105
- "data-tracking-el": K,
68
+ "data-tracking-el": _,
106
69
  "data-tracking-label": j,
107
70
  children: [
108
- h ? /* @__PURE__ */ r("ul", { className: "flex flex-col gap-2", "data-slot": "input-list-skeleton", children: Array.from({ length: F }).map((t, n) => /* @__PURE__ */ r(W, { variant: "loading" }, n)) }) : e.length > 0 ? /* @__PURE__ */ r(
71
+ f ? /* @__PURE__ */ i("ul", { className: "flex flex-col gap-2", "data-slot": "input-list-skeleton", children: Array.from({ length: R }).map((t, n) => /* @__PURE__ */ i(O, { variant: "loading" }, n)) }) : e.length > 0 ? /* @__PURE__ */ i(
109
72
  "ul",
110
73
  {
111
- className: "flex flex-col",
74
+ className: "flex flex-col gap-2",
112
75
  "data-hook": `${l}-list`,
113
76
  "data-slot": "list",
114
- children: e.map((t, n) => {
115
- const a = L.has(n), s = b.has(n) || a;
116
- return /* @__PURE__ */ r(
117
- "li",
118
- {
119
- className: S(
120
- "grid transition-[grid-template-rows,opacity,margin-bottom] ease-out",
121
- s ? "mb-0 grid-rows-[0fr] opacity-0" : "mb-2 grid-rows-[1fr] opacity-100 last:mb-0",
122
- a ? "duration-200" : "duration-300"
123
- ),
124
- "data-hook": `${l}-item-${n}`,
125
- "data-slot": "item",
126
- children: /* @__PURE__ */ r("div", { className: "overflow-hidden", children: /* @__PURE__ */ u("div", { className: "bg-card flex items-center gap-4 rounded-lg py-2 pr-2 pl-4", children: [
127
- /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ r(Z, { children: t }) }),
128
- /* @__PURE__ */ r(V, { children: /* @__PURE__ */ r(
129
- "button",
130
- {
131
- "aria-label": `Remove ${t}`,
132
- className: S(
133
- "inline-flex size-9 cursor-pointer items-center justify-center rounded-full",
134
- "text-muted-foreground",
135
- "focus-visible:shadow-default outline-none",
136
- "transition-colors duration-150 ease-in-out",
137
- "disabled:pointer-events-none disabled:opacity-50"
138
- ),
139
- "data-hook": `${l}-remove-${n}`,
140
- disabled: p || a,
141
- type: "button",
142
- onClick: () => P(n),
143
- children: /* @__PURE__ */ r(J, {})
144
- }
145
- ) })
146
- ] }) })
77
+ children: /* @__PURE__ */ i(z, { initial: !1, children: e.map((t, n) => /* @__PURE__ */ i(
78
+ T.li,
79
+ {
80
+ layout: !0,
81
+ animate: { opacity: 1, scale: 1 },
82
+ "data-hook": `${l}-item-${n}`,
83
+ "data-slot": "item",
84
+ exit: {
85
+ opacity: 0,
86
+ scale: 0.8,
87
+ transition: {
88
+ opacity: { duration: 0.15 },
89
+ scale: { duration: 0.12 }
90
+ }
91
+ },
92
+ initial: { opacity: 0, scale: 0.8 },
93
+ transition: {
94
+ opacity: { duration: 0.15 },
95
+ scale: { duration: 0.15 },
96
+ layout: {
97
+ type: "spring",
98
+ stiffness: 500,
99
+ damping: 35
100
+ }
147
101
  },
148
- T[n]
149
- );
150
- })
102
+ children: /* @__PURE__ */ r("div", { className: "bg-card flex items-center gap-4 rounded-lg py-2 pr-2 pl-4", children: [
103
+ /* @__PURE__ */ i(Q, { children: /* @__PURE__ */ i(U, { children: t }) }),
104
+ /* @__PURE__ */ i(W, { children: /* @__PURE__ */ i(
105
+ "button",
106
+ {
107
+ "aria-label": `Remove ${t}`,
108
+ className: N(
109
+ "inline-flex size-9 cursor-pointer items-center justify-center rounded-full",
110
+ "text-muted-foreground",
111
+ "focus-visible:shadow-default outline-none",
112
+ "transition-colors duration-150 ease-in-out",
113
+ "disabled:pointer-events-none disabled:opacity-50"
114
+ ),
115
+ "data-hook": `${l}-remove-${n}`,
116
+ disabled: p,
117
+ type: "button",
118
+ onClick: () => L(n),
119
+ children: /* @__PURE__ */ i(X, {})
120
+ }
121
+ ) })
122
+ ] })
123
+ },
124
+ C[n]
125
+ )) })
151
126
  }
152
127
  ) : null,
153
- /* @__PURE__ */ u("div", { className: "flex flex-col gap-2", "data-slot": "input-list-input-area", children: [
154
- /* @__PURE__ */ u("div", { className: "flex gap-2", children: [
155
- /* @__PURE__ */ r(
156
- U,
128
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-2", "data-slot": "input-list-input-area", children: [
129
+ /* @__PURE__ */ r("div", { className: "flex gap-2", children: [
130
+ /* @__PURE__ */ i(
131
+ J,
157
132
  {
158
133
  className: "flex-1",
159
134
  dataHook: `${l}-input`,
160
- disabled: z,
161
- error: I,
162
- placeholder: M,
163
- value: g,
164
- onChange: (t) => A(t.target.value),
165
- onKeyDown: q,
166
- onPaste: X
135
+ disabled: E,
136
+ error: b,
137
+ placeholder: I,
138
+ value: m,
139
+ onChange: (t) => x(t.target.value),
140
+ onKeyDown: P,
141
+ onPaste: S
167
142
  }
168
143
  ),
169
- /* @__PURE__ */ r(
170
- O,
144
+ /* @__PURE__ */ i(
145
+ q,
171
146
  {
172
147
  dataHook: `${l}-add`,
173
- disabled: B,
174
- onClick: () => R([g]),
175
- children: x
148
+ disabled: F,
149
+ onClick: () => g([m]),
150
+ children: K
176
151
  }
177
152
  )
178
153
  ] }),
179
- $ && /* @__PURE__ */ r(
180
- _,
181
- {
182
- "data-slot": "input-list-description",
183
- dataHook: `${l}-description`,
184
- children: $
185
- }
186
- ),
187
- c !== void 0 && /* @__PURE__ */ u(
188
- _,
189
- {
190
- "data-slot": "input-list-count",
191
- dataHook: `${l}-count`,
192
- children: [
193
- e.length,
194
- "/",
195
- c
196
- ]
197
- }
198
- ),
199
- I && N && /* @__PURE__ */ r(
200
- Q,
154
+ b && $ ? /* @__PURE__ */ i(
155
+ G,
201
156
  {
202
157
  "data-slot": "input-list-error",
203
158
  dataHook: `${l}-error`,
204
- children: N
159
+ children: $
205
160
  }
206
- )
161
+ ) : /* @__PURE__ */ r(B, { children: [
162
+ k && /* @__PURE__ */ i(
163
+ A,
164
+ {
165
+ "data-slot": "input-list-description",
166
+ dataHook: `${l}-description`,
167
+ children: k
168
+ }
169
+ ),
170
+ a !== void 0 && /* @__PURE__ */ r(
171
+ A,
172
+ {
173
+ "data-slot": "input-list-count",
174
+ dataHook: `${l}-count`,
175
+ children: [
176
+ e.length,
177
+ "/",
178
+ a
179
+ ]
180
+ }
181
+ )
182
+ ] })
207
183
  ] })
208
184
  ]
209
185
  }
210
186
  );
211
187
  }
212
- H.displayName = "InputList";
188
+ Y.displayName = "InputList";
213
189
  export {
214
- H as InputList
190
+ Y as InputList
215
191
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,