@brightlocal/ui-components 1.4.2 → 1.4.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Machine-readable registry of all components in the BrightLocal Design System",
5
5
  "components": [
6
6
  {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),_=require("react"),k=require("framer-motion"),K=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils"),O=require("../button.cjs"),$=require("../input.cjs"),g=require("../list.cjs");function B(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,o.get?o:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const r=B(_),A=r.createContext(null);function y(){const t=r.useContext(A);if(!t)throw new Error("InputList components must be used within an <InputList>");return t}function w({value:t,onValueChange:s,children:a,className:o,dataHook:c,trackingEl:u,trackingLabel:I}){const[m,d]=r.useState(""),l=r.useRef(t.length),i=r.useRef(t.length),[b,h]=r.useState(()=>t.map((p,n)=>n)),[N,q]=r.useState(0);r.useEffect(()=>{const p=l.current;l.current=t.length,t.length>p&&d(""),h(n=>n.length===t.length?n:t.length>n.length?[...n,...Array.from({length:t.length-n.length},()=>i.current++)]:t.length===p?n.slice(0,t.length):t.map(()=>i.current++))},[t,N]);const j=r.useCallback(p=>{const n=p.map(f=>f.trim()).filter(Boolean);n.length&&(h(f=>[...f,...n.map(()=>i.current++)]),s([...t,...n]),q(f=>f+1))},[t,s]),L=r.useCallback(p=>{h(n=>n.filter((f,S)=>S!==p)),s(t.filter((n,f)=>f!==p))},[t,s]),P=r.useMemo(()=>({value:t,inputValue:m,setInputValue:d,addItems:j,removeItem:L,stableKeys:b}),[t,m,j,L,b]);return e.jsx(A.Provider,{value:P,children:e.jsx("div",{className:x.cn("flex flex-col gap-4",o),"data-hook":c,"data-slot":"input-list","data-tracking-el":u,"data-tracking-label":I,children:a})})}w.displayName="InputList";function C({dataHook:t="input-list",loading:s=!1,skeletonCount:a=5,disabled:o=!1,className:c}){const{value:u,removeItem:I,stableKeys:m}=y();return s?e.jsx("ul",{className:x.cn("flex flex-col gap-2",c),"data-slot":"input-list-skeleton",children:Array.from({length:a}).map((d,l)=>e.jsx(g.Item,{variant:"loading"},l))}):e.jsx("ul",{className:x.cn("flex flex-col gap-2",c),"data-hook":`${t}-list`,"data-slot":"list",children:e.jsx(k.AnimatePresence,{initial:!1,children:u.map((d,l)=>e.jsx(k.motion.li,{layout:!0,animate:{opacity:1,scale:1},"data-hook":`${t}-item-${l}`,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:e.jsx(g.Item,{asChild:!0,variant:"filled",children:e.jsxs("div",{children:[e.jsx(g.ItemContent,{children:e.jsx(g.ItemTitle,{children:d})}),e.jsx(g.ItemActions,{children:e.jsx("button",{"aria-label":`Remove ${d}`,className:x.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":`${t}-remove-${l}`,disabled:o,type:"button",onClick:()=>I(l),children:e.jsx(K.X,{})})})]})})},m[l]))})})}C.displayName="InputListItems";const R=r.forwardRef(({dataHook:t,error:s=!1,className:a,...o},c)=>{const{inputValue:u,setInputValue:I,addItems:m}=y(),d=i=>{i.key==="Enter"&&(i.preventDefault(),m([u])),o.onKeyDown?.(i)},l=i=>{const h=i.clipboardData.getData("text").split(`
2
- `);h.length>1&&(i.preventDefault(),m(h)),o.onPaste?.(i)};return e.jsx($.Input,{ref:c,...o,className:x.cn("flex-1",a),dataHook:t,error:s,value:u,onChange:i=>{I(i.target.value),o.onChange?.(i)},onKeyDown:d,onPaste:l})});R.displayName="InputListInput";const D=r.forwardRef(({dataHook:t,children:s,...a},o)=>{const{inputValue:c,addItems:u}=y();return e.jsx(O.Button,{ref:o,...a,dataHook:t,onClick:()=>u([c]),children:s})});D.displayName="InputListAddButton";exports.InputList=w;exports.InputListAddButton=D;exports.InputListInput=R;exports.InputListItems=C;exports.useInputListContext=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),_=require("react"),k=require("framer-motion"),K=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils"),O=require("../button.cjs"),$=require("../input.cjs"),g=require("../list.cjs");function B(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,i.get?i:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const a=B(_),A=a.createContext(null);function y(){const t=a.useContext(A);if(!t)throw new Error("InputList components must be used within an <InputList>");return t}function w({value:t,onValueChange:s,children:r,className:i,dataHook:u,trackingEl:c,trackingLabel:I}){const[f,d]=a.useState(""),l=a.useRef(t.length),o=a.useRef(t.length),[b,h]=a.useState(()=>t.map((m,n)=>n)),[N,q]=a.useState(0);a.useEffect(()=>{const m=l.current;l.current=t.length,t.length>m&&d(""),h(n=>n.length===t.length?n:t.length>n.length?[...n,...Array.from({length:t.length-n.length},()=>o.current++)]:n.slice(0,t.length))},[t,N]);const j=a.useCallback(m=>{const n=m.map(p=>p.trim()).filter(Boolean);n.length&&(h(p=>[...p,...n.map(()=>o.current++)]),s([...t,...n]),q(p=>p+1))},[t,s]),L=a.useCallback(m=>{h(n=>n.filter((p,S)=>S!==m)),s(t.filter((n,p)=>p!==m))},[t,s]),P=a.useMemo(()=>({value:t,inputValue:f,setInputValue:d,addItems:j,removeItem:L,stableKeys:b}),[t,f,j,L,b]);return e.jsx(A.Provider,{value:P,children:e.jsx("div",{className:x.cn("flex flex-col gap-4",i),"data-hook":u,"data-slot":"input-list","data-tracking-el":c,"data-tracking-label":I,children:r})})}w.displayName="InputList";function C({dataHook:t="input-list",loading:s=!1,skeletonCount:r=5,disabled:i=!1,className:u}){const{value:c,removeItem:I,stableKeys:f}=y();return s?e.jsx("ul",{className:x.cn("flex flex-col gap-2",u),"data-slot":"input-list-skeleton",children:Array.from({length:r}).map((d,l)=>e.jsx(g.Item,{variant:"loading"},l))}):e.jsx("ul",{className:x.cn("flex flex-col gap-2",u),"data-hook":`${t}-list`,"data-slot":"list",children:e.jsx(k.AnimatePresence,{initial:!1,mode:"popLayout",children:c.map((d,l)=>e.jsx(k.motion.li,{layout:!0,animate:{opacity:1,scale:1},"data-hook":`${t}-item-${l}`,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:e.jsx(g.Item,{asChild:!0,variant:"filled",children:e.jsxs("div",{children:[e.jsx(g.ItemContent,{children:e.jsx(g.ItemTitle,{children:d})}),e.jsx(g.ItemActions,{children:e.jsx("button",{"aria-label":`Remove ${d}`,className:x.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":`${t}-remove-${l}`,disabled:i,type:"button",onClick:()=>I(l),children:e.jsx(K.X,{})})})]})})},f[l]))})})}C.displayName="InputListItems";const R=a.forwardRef(({dataHook:t,error:s=!1,className:r,...i},u)=>{const{inputValue:c,setInputValue:I,addItems:f}=y(),d=o=>{o.key==="Enter"&&(o.preventDefault(),f([c])),i.onKeyDown?.(o)},l=o=>{const h=o.clipboardData.getData("text").split(`
2
+ `);h.length>1&&(o.preventDefault(),f(h)),i.onPaste?.(o)};return e.jsx($.Input,{ref:u,...i,className:x.cn("flex-1",r),dataHook:t,error:s,value:c,onChange:o=>{I(o.target.value),i.onChange?.(o)},onKeyDown:d,onPaste:l})});R.displayName="InputListInput";const D=a.forwardRef(({dataHook:t,children:s,...r},i)=>{const{inputValue:u,addItems:c}=y();return e.jsx(O.Button,{ref:i,...r,dataHook:t,onClick:()=>c([u]),children:s})});D.displayName="InputListAddButton";exports.InputList=w;exports.InputListAddButton=D;exports.InputListInput=R;exports.InputListItems=C;exports.useInputListContext=y;
@@ -1 +1 @@
1
- {"version":3,"file":"input-list.d.ts","sourceRoot":"","sources":["../../src/blocks/input-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQhE,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,+CAA+C;IAC/C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAMD,iBAAS,mBAAmB,0BAM3B;AAMD;;;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;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CA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AAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,cAAc,CAAC,EACtB,QAAuB,EACvB,OAAe,EACf,aAAiB,EACjB,QAAgB,EAChB,SAAS,GACV,EAAE,mBAAmB,2CA8ErB;kBApFQ,cAAc;;;AA4FvB;;;;;;GAMG;AACH,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EACvC,OAAO,GAAG,MAAM,CACjB;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,cAAc,8FAuCnB,CAAC;AAOF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAEnE;;;;;;;;GAQG;AACH,QAAA,MAAM,kBAAkB,gHAgBtB,CAAC;AAOH,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GACpB,CAAC"}
@@ -1,16 +1,16 @@
1
1
  import { jsx as n, jsxs as D } from "react/jsx-runtime";
2
- import * as s from "react";
2
+ import * as i from "react";
3
3
  import { AnimatePresence as K, motion as $ } from "framer-motion";
4
4
  import { X as P } from "@brightlocal/icons";
5
5
  import { cn as g } from "@brightlocal/ui-components/lib/utils";
6
6
  import { Button as B } from "../button.js";
7
7
  import { Input as S } from "../input.js";
8
8
  import { Item as k, ItemContent as V, ItemTitle as _, ItemActions as j } from "../list.js";
9
- const A = s.createContext(
9
+ const A = i.createContext(
10
10
  null
11
11
  );
12
12
  function x() {
13
- const t = s.useContext(A);
13
+ const t = i.useContext(A);
14
14
  if (!t)
15
15
  throw new Error("InputList components must be used within an <InputList>");
16
16
  return t;
@@ -18,49 +18,49 @@ function x() {
18
18
  function E({
19
19
  value: t,
20
20
  onValueChange: a,
21
- children: f,
21
+ children: m,
22
22
  className: r,
23
23
  dataHook: l,
24
24
  trackingEl: c,
25
25
  trackingLabel: I
26
26
  }) {
27
- const [p, u] = s.useState(""), o = s.useRef(t.length), i = s.useRef(t.length), [y, h] = s.useState(
28
- () => t.map((d, e) => e)
29
- ), [w, C] = s.useState(0);
30
- s.useEffect(() => {
31
- const d = o.current;
32
- o.current = t.length, t.length > d && u(""), h((e) => e.length === t.length ? e : t.length > e.length ? [
27
+ const [p, u] = i.useState(""), s = i.useRef(t.length), o = i.useRef(t.length), [y, h] = i.useState(
28
+ () => t.map((f, e) => e)
29
+ ), [w, C] = i.useState(0);
30
+ i.useEffect(() => {
31
+ const f = s.current;
32
+ s.current = t.length, t.length > f && u(""), h((e) => e.length === t.length ? e : t.length > e.length ? [
33
33
  ...e,
34
34
  ...Array.from(
35
35
  { length: t.length - e.length },
36
- () => i.current++
36
+ () => o.current++
37
37
  )
38
- ] : t.length === d ? e.slice(0, t.length) : t.map(() => i.current++));
38
+ ] : e.slice(0, t.length));
39
39
  }, [t, w]);
40
- const b = s.useCallback(
41
- (d) => {
42
- const e = d.map((m) => m.trim()).filter(Boolean);
43
- e.length && (h((m) => [
44
- ...m,
45
- ...e.map(() => i.current++)
46
- ]), a([...t, ...e]), C((m) => m + 1));
40
+ const L = i.useCallback(
41
+ (f) => {
42
+ const e = f.map((d) => d.trim()).filter(Boolean);
43
+ e.length && (h((d) => [
44
+ ...d,
45
+ ...e.map(() => o.current++)
46
+ ]), a([...t, ...e]), C((d) => d + 1));
47
47
  },
48
48
  [t, a]
49
- ), L = s.useCallback(
50
- (d) => {
51
- h((e) => e.filter((m, R) => R !== d)), a(t.filter((e, m) => m !== d));
49
+ ), b = i.useCallback(
50
+ (f) => {
51
+ h((e) => e.filter((d, R) => R !== f)), a(t.filter((e, d) => d !== f));
52
52
  },
53
53
  [t, a]
54
- ), N = s.useMemo(
54
+ ), N = i.useMemo(
55
55
  () => ({
56
56
  value: t,
57
57
  inputValue: p,
58
58
  setInputValue: u,
59
- addItems: b,
60
- removeItem: L,
59
+ addItems: L,
60
+ removeItem: b,
61
61
  stableKeys: y
62
62
  }),
63
- [t, p, b, L, y]
63
+ [t, p, L, b, y]
64
64
  );
65
65
  return /* @__PURE__ */ n(A.Provider, { value: N, children: /* @__PURE__ */ n(
66
66
  "div",
@@ -70,7 +70,7 @@ function E({
70
70
  "data-slot": "input-list",
71
71
  "data-tracking-el": c,
72
72
  "data-tracking-label": I,
73
- children: f
73
+ children: m
74
74
  }
75
75
  ) });
76
76
  }
@@ -78,7 +78,7 @@ E.displayName = "InputList";
78
78
  function z({
79
79
  dataHook: t = "input-list",
80
80
  loading: a = !1,
81
- skeletonCount: f = 5,
81
+ skeletonCount: m = 5,
82
82
  disabled: r = !1,
83
83
  className: l
84
84
  }) {
@@ -88,7 +88,7 @@ function z({
88
88
  {
89
89
  className: g("flex flex-col gap-2", l),
90
90
  "data-slot": "input-list-skeleton",
91
- children: Array.from({ length: f }).map((u, o) => /* @__PURE__ */ n(k, { variant: "loading" }, o))
91
+ children: Array.from({ length: m }).map((u, s) => /* @__PURE__ */ n(k, { variant: "loading" }, s))
92
92
  }
93
93
  ) : /* @__PURE__ */ n(
94
94
  "ul",
@@ -96,12 +96,12 @@ function z({
96
96
  className: g("flex flex-col gap-2", l),
97
97
  "data-hook": `${t}-list`,
98
98
  "data-slot": "list",
99
- children: /* @__PURE__ */ n(K, { initial: !1, children: c.map((u, o) => /* @__PURE__ */ n(
99
+ children: /* @__PURE__ */ n(K, { initial: !1, mode: "popLayout", children: c.map((u, s) => /* @__PURE__ */ n(
100
100
  $.li,
101
101
  {
102
102
  layout: !0,
103
103
  animate: { opacity: 1, scale: 1 },
104
- "data-hook": `${t}-item-${o}`,
104
+ "data-hook": `${t}-item-${s}`,
105
105
  exit: {
106
106
  opacity: 0,
107
107
  scale: 0.8,
@@ -133,56 +133,56 @@ function z({
133
133
  "transition-colors duration-150 ease-in-out",
134
134
  "disabled:pointer-events-none disabled:opacity-50"
135
135
  ),
136
- "data-hook": `${t}-remove-${o}`,
136
+ "data-hook": `${t}-remove-${s}`,
137
137
  disabled: r,
138
138
  type: "button",
139
- onClick: () => I(o),
139
+ onClick: () => I(s),
140
140
  children: /* @__PURE__ */ n(P, {})
141
141
  }
142
142
  ) })
143
143
  ] }) })
144
144
  },
145
- p[o]
145
+ p[s]
146
146
  )) })
147
147
  }
148
148
  );
149
149
  }
150
150
  z.displayName = "InputListItems";
151
- const M = s.forwardRef(
152
- ({ dataHook: t, error: a = !1, className: f, ...r }, l) => {
153
- const { inputValue: c, setInputValue: I, addItems: p } = x(), u = (i) => {
154
- i.key === "Enter" && (i.preventDefault(), p([c])), r.onKeyDown?.(i);
155
- }, o = (i) => {
156
- const h = i.clipboardData.getData("text").split(`
151
+ const M = i.forwardRef(
152
+ ({ dataHook: t, error: a = !1, className: m, ...r }, l) => {
153
+ const { inputValue: c, setInputValue: I, addItems: p } = x(), u = (o) => {
154
+ o.key === "Enter" && (o.preventDefault(), p([c])), r.onKeyDown?.(o);
155
+ }, s = (o) => {
156
+ const h = o.clipboardData.getData("text").split(`
157
157
  `);
158
- h.length > 1 && (i.preventDefault(), p(h)), r.onPaste?.(i);
158
+ h.length > 1 && (o.preventDefault(), p(h)), r.onPaste?.(o);
159
159
  };
160
160
  return /* @__PURE__ */ n(
161
161
  S,
162
162
  {
163
163
  ref: l,
164
164
  ...r,
165
- className: g("flex-1", f),
165
+ className: g("flex-1", m),
166
166
  dataHook: t,
167
167
  error: a,
168
168
  value: c,
169
- onChange: (i) => {
170
- I(i.target.value), r.onChange?.(i);
169
+ onChange: (o) => {
170
+ I(o.target.value), r.onChange?.(o);
171
171
  },
172
172
  onKeyDown: u,
173
- onPaste: o
173
+ onPaste: s
174
174
  }
175
175
  );
176
176
  }
177
177
  );
178
178
  M.displayName = "InputListInput";
179
- const T = s.forwardRef(({ dataHook: t, children: a, ...f }, r) => {
179
+ const T = i.forwardRef(({ dataHook: t, children: a, ...m }, r) => {
180
180
  const { inputValue: l, addItems: c } = x();
181
181
  return /* @__PURE__ */ n(
182
182
  B,
183
183
  {
184
184
  ref: r,
185
- ...f,
185
+ ...m,
186
186
  dataHook: t,
187
187
  onClick: () => c([l]),
188
188
  children: a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -130,12 +130,10 @@ function InputList({
130
130
  ),
131
131
  ];
132
132
  }
133
- // Value didn't grow but keys did (rejected add) — trim back
134
- if (value.length === prevLength) {
135
- return prev.slice(0, value.length);
136
- }
137
- // Removal or reorder: regenerate all keys
138
- return value.map(() => nextIdRef.current++);
133
+ // Trim excess keys (rejected add, partial acceptance, or external shrink).
134
+ // removeItem already eagerly filters keys, so removals hit the
135
+ // prev.length === value.length check above and never reach here.
136
+ return prev.slice(0, value.length);
139
137
  });
140
138
  }, [value, addAttempt]);
141
139
 
@@ -264,7 +262,7 @@ function InputListItems({
264
262
  data-hook={`${dataHook}-list`}
265
263
  data-slot="list"
266
264
  >
267
- <AnimatePresence initial={false}>
265
+ <AnimatePresence initial={false} mode="popLayout">
268
266
  {value.map((item, index) => (
269
267
  <motion.li
270
268
  key={stableKeys[index]}