@verifiedinc-public/shared-ui-elements 12.9.1-rc.21 → 12.10.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.
@@ -1 +1 @@
1
- "use strict";import{Dialog as k,DialogTitle as x,DialogContent as w,DialogContentText as L,DialogActions as T,Button as m,CircularProgress as j}from"@mui/material";import{useHeldWhileClosed as u}from"../hooks/useHeldWhileClosed.mjs";import{useNetworkRulesCatalog as W}from"../hooks/useNetworkRulesCatalog.mjs";import{getKeyLabel as y,getOperatorLabel as z}from"../utils/catalog.mjs";import{normalizeConditionValues as I}from"../utils/condition.mjs";import{jsxs as v,jsx as e}from"react/jsx-runtime";function N({open:r,rule:h,conditionIndex:f,onConfirm:p,onClose:a,isDeleting:n=!1,title:C,description:g,confirmLabel:D="Delete",cancelLabel:b="Cancel"}){const{data:s}=W(),o=u(r,h??void 0),i=u(r,f??void 0),t=o!==void 0&&i!==void 0?o.conditions[i]:void 0,d=i!==void 0,$=C??(d?"Delete condition?":"Delete rule?");let l=g;if(l===void 0&&o!==void 0)if(d)l=`"${t?`${y(s,t.key)} ${z(s,t.operator)} ${I(t.value).join(", ")}`:`Condition ${i+1}`}" will be removed from "${o.name}". The rule keeps its other conditions.`;else{const c=o.conditions.length;l=`"${o.name}" and its ${c} ${c===1?"condition":"conditions"} will be removed. This cannot be undone.`}return v(k,{open:r,onClose:n?void 0:a,maxWidth:"xs",fullWidth:!0,children:[e(x,{children:$}),e(w,{children:e(L,{children:l})}),v(T,{children:[e(m,{color:"neutral",onClick:a,disabled:n,children:b}),e(m,{color:"error",variant:"contained",disabled:n||o===void 0,startIcon:n?e(j,{size:16,color:"inherit"}):void 0,onClick:()=>{o!==void 0&&p(o,i)},children:D})]})]})}export{N as NetworkRuleDeleteDialog};
1
+ "use strict";import{Dialog as D,DialogTitle as b,DialogContent as $,DialogContentText as x,DialogActions as k,Button as d,CircularProgress as w}from"@mui/material";import{useHeldWhileClosed as c}from"../hooks/useHeldWhileClosed.mjs";import{useNetworkRulesCatalog as T}from"../hooks/useNetworkRulesCatalog.mjs";import{getKeyLabel as j,getOperatorLabel as L}from"../utils/catalog.mjs";import{normalizeConditionValues as W}from"../utils/condition.mjs";import{jsxs as m,jsx as n}from"react/jsx-runtime";function y(o,e,t){if(t===void 0){const l=e.conditions.length;return`"${e.name}" and its ${l} ${l===1?"condition":"conditions"} will be removed. This cannot be undone.`}const i=e.conditions[t];return`"${i?`${j(o,i.key)} ${L(o,i.operator)} ${W(i.value).join(", ")}`:`Condition ${t+1}`}" will be removed from "${e.name}". The rule keeps its other conditions.`}function z({open:o,rule:e,conditionIndex:t,onConfirm:i,onClose:l,isDeleting:a=!1,title:u,description:h,confirmLabel:p="Delete",cancelLabel:v="Cancel"}){const{data:C}=T(),r=c(o,e??void 0),s=c(o,t??void 0),f=u??(s!==void 0?"Delete condition?":"Delete rule?"),g=h??(r===void 0?void 0:y(C,r,s));return m(D,{open:o,onClose:a?void 0:l,maxWidth:"xs",fullWidth:!0,children:[n(b,{children:f}),n($,{children:n(x,{children:g})}),m(k,{children:[n(d,{color:"neutral",onClick:l,disabled:a,children:v}),n(d,{color:"error",variant:"contained",disabled:a||r===void 0,startIcon:a?n(w,{size:16,color:"inherit"}):void 0,onClick:()=>{r!==void 0&&i(r,s)},children:p})]})]})}export{z as NetworkRuleDeleteDialog};
@@ -1 +1 @@
1
- "use strict";import{Stack as l,Typography as c,Button as x,Alert as F,FormHelperText as A}from"@mui/material";import{Add as I}from"@mui/icons-material";import{useFormContext as b,useFieldArray as w}from"react-hook-form";import{emptyConditionFormValues as j}from"../../utils/condition.mjs";import{ConditionRow as P}from"./ConditionRow.mjs";import{jsxs as m,jsx as e}from"react/jsx-runtime";function R({catalog:p,addedPresets:u,onCreatePreset:f,disabled:t,focusIndex:h}){var n,i,r;const{control:v,formState:s}=b(),{fields:a,append:g,remove:y}=w({control:v,name:"conditions"}),d=((i=(n=s.errors.conditions)==null?void 0:n.root)==null?void 0:i.message)??((r=s.errors.conditions)==null?void 0:r.message);return m(l,{spacing:2,children:[m(l,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(c,{fontWeight:700,children:"Conditions"}),e(x,{startIcon:e(I,{}),disabled:t,onClick:()=>{g(j())},children:"Add Condition"})]}),e(F,{severity:"info",children:"If multiple values are selected for a given condition, that condition applies if any of the values match. In other words, multiple values map to an inclusive OR."}),a.length===0&&e(c,{variant:"body2",color:"text.secondary",children:"No conditions yet. A rule needs at least one; all conditions must match."}),a.map((C,o)=>e(P,{index:o,catalog:p,addedPresets:u,onCreatePreset:f,disabled:t,autoFocus:o===h,onRemove:()=>{y(o)}},C.id)),d&&e(A,{error:!0,children:d})]})}export{R as ConditionsField};
1
+ "use strict";import{Stack as l,Typography as c,Button as x,Alert as F,FormHelperText as A}from"@mui/material";import{Add as I}from"@mui/icons-material";import{useFormContext as b,useFieldArray as j}from"react-hook-form";import{emptyConditionFormValues as w}from"../../utils/condition.mjs";import{ConditionRow as P}from"./ConditionRow.mjs";import{jsxs as m,jsx as e}from"react/jsx-runtime";function R({catalog:p,addedPresets:u,onCreatePreset:f,disabled:n,focusIndex:h}){var t,i,r;const{control:v,formState:s}=b(),{fields:a,append:g,remove:y}=j({control:v,name:"conditions"}),d=((i=(t=s.errors.conditions)==null?void 0:t.root)==null?void 0:i.message)??((r=s.errors.conditions)==null?void 0:r.message);return m(l,{spacing:2,children:[m(l,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(c,{fontWeight:700,children:"Conditions"}),e(x,{startIcon:e(I,{}),disabled:n,onClick:()=>{g(w())},children:"Add Condition"})]}),e(F,{severity:"info",children:"If multiple values are selected for a given condition, that condition applies if any one of the values matches. (It's an inclusive OR.)"}),a.length===0&&e(c,{variant:"body2",color:"text.secondary",children:"No conditions yet. A rule needs at least one; all conditions must match."}),a.map((C,o)=>e(P,{index:o,catalog:p,addedPresets:u,onCreatePreset:f,disabled:n,autoFocus:o===h,onRemove:()=>{y(o)}},C.id)),d&&e(A,{error:!0,children:d})]})}export{R as ConditionsField};
@@ -1 +1 @@
1
- "use strict";import{Autocomplete as b,TextField as v,Checkbox as g,Typography as i}from"@mui/material";import{toOptions as O}from"../../../utils/catalog.mjs";import{jsx as o,jsxs as T}from"react/jsx-runtime";function f({options:r,values:s,onChange:p,multi:a,label:c,error:u,helperText:d,disabled:h}){const m=O(s,r);return o(b,{multiple:!0,options:r,value:m,disabled:h,limitTags:4,disableCloseOnSelect:a,getOptionLabel:e=>e.label,isOptionEqualToValue:(e,l)=>e.value===l.value,onChange:(e,l)=>{const t=l.map(n=>n.value);p(a?t:t.slice(-1))},renderOption:(e,l,{selected:t})=>{const{key:n,...x}=e;return T("li",{...x,children:[a&&o(g,{checked:t,sx:{mr:1}}),o(i,{children:l.label}),o(i,{variant:"caption",color:"text.secondary",sx:{ml:1},children:l.value})]},n)},renderInput:e=>o(v,{...e,label:c,placeholder:s.length===0?"Select\u2026":void 0,error:u,helperText:d})})}export{f as InlineValuesInput};
1
+ "use strict";import{Autocomplete as h,TextField as x,Checkbox as v}from"@mui/material";import{OptionLabel as O}from"../../../shared/OptionLabel.mjs";import{toOptions as f}from"../../../utils/catalog.mjs";import{jsx as t,jsxs as g}from"react/jsx-runtime";function T({options:s,values:i,onChange:n,multi:a,label:p,error:u,helperText:c,disabled:d}){const m=f(i,s);return t(h,{multiple:!0,options:s,value:m,disabled:d,limitTags:4,disableCloseOnSelect:a,getOptionLabel:e=>e.label,isOptionEqualToValue:(e,l)=>e.value===l.value,onChange:(e,l)=>{const o=l.map(r=>r.value);n(a?o:o.slice(-1))},renderOption:(e,l,{selected:o})=>{const{key:r,...b}=e;return g("li",{...b,children:[a&&t(v,{checked:o,sx:{mr:1}}),t(O,{option:l})]},r)},renderInput:e=>t(x,{...e,label:p,placeholder:i.length===0?"Select\u2026":void 0,error:u,helperText:c})})}export{T as InlineValuesInput};
@@ -1 +1 @@
1
- "use strict";import{useState as h,Fragment as R}from"react";import{Button as M,TextField as O,Autocomplete as N,Chip as P,Checkbox as V,Box as z,CircularProgress as F}from"@mui/material";import{useNetworkRuleSourceSearch as H}from"../../../hooks/useNetworkRuleSourceSearch.mjs";import{useResolvedConditionOptions as A}from"../../../hooks/useResolvedConditionOptions.mjs";import{jsx as l,jsxs as B}from"react/jsx-runtime";const E=50;function $({keyDef:p,values:d,onChange:k,multi:u,label:m,error:y,helperText:S,disabled:j}){const[c,g]=h(""),[v,b]=h(!1),[w,I]=h([]),t=H(p.values.source,c,{enabled:v}),f=A(p,d,{known:w}),n=t.service,x=t.isLoading||t.isLoadingMore,L=e=>{const o=e.currentTarget;o.scrollTop+o.clientHeight>=o.scrollHeight-E&&t.loadMore()};let C=c.trim()?"No matches":"Type to search";return t.error&&(C=l(M,{size:"small",onClick:t.retry,children:"Search failed. Retry"})),t.isSupported?l(N,{multiple:!0,open:v,onOpen:()=>{b(!0)},onClose:()=>{b(!1)},options:t.options,value:f.options,loading:x||f.isLoading,ListboxProps:{onScroll:L},popupIcon:x?l(z,{sx:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:l(F,{color:"inherit",size:18})}):void 0,disabled:j,limitTags:4,disableCloseOnSelect:u,filterOptions:e=>e,inputValue:c,onInputChange:(e,o,r)=>{r!=="reset"&&g(o)},getOptionLabel:e=>e.label,isOptionEqualToValue:(e,o)=>e.value===o.value,onChange:(e,o)=>{I(s=>{const i=new Map(s.map(a=>[a.value,a]));for(const a of o)i.set(a.value,a);return[...i.values()]});const r=o.map(s=>s.value);k(u?r:r.slice(-1)),g("")},noOptionsText:C,renderOption:(e,o,{selected:r})=>{const{key:s,...i}=e;return B("li",{...i,children:[u&&l(V,{checked:r,sx:{mr:1}}),n!=null&&n.renderOption?n.renderOption(o):o.label]},s)},renderTags:(e,o)=>e.map((r,s)=>{const{key:i,...a}=o({index:s}),T={...a,label:r.label};return l(R,{children:n!=null&&n.renderChip?n.renderChip(r,T):l(P,{...T})},i)}),renderInput:e=>l(O,{...e,label:m,placeholder:d.length===0?n?.searchPlaceholder??"Type to search\u2026":void 0,error:y,helperText:S})}):l(O,{fullWidth:!0,disabled:!0,label:m,value:d.join(", "),error:!0,helperText:`No data source is registered for "${p.values.source}"`})}export{$ as RemoteValuesInput};
1
+ "use strict";import{useState as d}from"react";import{Button as w,TextField as C,Autocomplete as R,Checkbox as U,Box as z,CircularProgress as M}from"@mui/material";import{LogoAvatar as N}from"../../../../UI/LogoAvatar.mjs";import{LogoChip as P}from"../../../../UI/LogoChip.mjs";import{useNetworkRuleSourceSearch as V}from"../../../hooks/useNetworkRuleSourceSearch.mjs";import{useResolvedConditionOptions as A}from"../../../hooks/useResolvedConditionOptions.mjs";import{OptionLabel as H}from"../../../shared/OptionLabel.mjs";import{jsx as l,jsxs as B}from"react/jsx-runtime";const E=50;function q({keyDef:n,values:p,onChange:O,multi:c,label:m,error:k,helperText:y,disabled:L}){const[u,h]=d(""),[g,f]=d(!1),[S,I]=d([]),t=V(n.values.source,u,{enabled:g}),b=A(n,p,{known:S}),v=t.service,x=t.isLoading||t.isLoadingMore,j=o=>{const e=o.currentTarget;e.scrollTop+e.clientHeight>=e.scrollHeight-E&&t.loadMore()};let T=u.trim()?"No matches":"Type to search";return t.error&&(T=l(w,{size:"small",onClick:t.retry,children:"Search failed. Retry"})),t.isSupported?l(R,{multiple:!0,open:g,onOpen:()=>{f(!0)},onClose:()=>{f(!1)},options:t.options,value:b.options,loading:x||b.isLoading,ListboxProps:{onScroll:j},popupIcon:x?l(z,{sx:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:l(M,{color:"inherit",size:18})}):void 0,disabled:L,limitTags:4,disableCloseOnSelect:c,filterOptions:o=>o,inputValue:u,onInputChange:(o,e,r)=>{r!=="reset"&&h(e)},getOptionLabel:o=>o.label,isOptionEqualToValue:(o,e)=>o.value===e.value,onChange:(o,e)=>{I(s=>{const i=new Map(s.map(a=>[a.value,a]));for(const a of e)i.set(a.value,a);return[...i.values()]});const r=e.map(s=>s.value);O(c?r:r.slice(-1)),h("")},noOptionsText:T,renderOption:(o,e,{selected:r})=>{const{key:s,...i}=o;return B("li",{...i,children:[c&&l(U,{checked:r,sx:{mr:1}}),l(N,{name:e.label,logoUrl:e.logoUrl,size:28,sx:{mr:1}}),l(H,{option:e})]},s)},renderTags:(o,e)=>o.map((r,s)=>{const{key:i,...a}=e({index:s});return l(P,{...a,label:r.label,name:r.label,logoUrl:r.logoUrl},i)}),renderInput:o=>l(C,{...o,label:m,placeholder:p.length===0?v?.searchPlaceholder??"Type to search\u2026":void 0,error:k,helperText:y})}):l(C,{fullWidth:!0,disabled:!0,label:m,value:p.join(", "),error:!0,helperText:`No data source is registered for "${n.values.source}"`})}export{q as RemoteValuesInput};
@@ -1,9 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
- import { NetworkRuleOption, NetworkRuleRenderChip } from '../types';
2
+ import { NetworkRuleOption } from '../types';
3
3
  export interface OptionChipsProps {
4
4
  options: readonly NetworkRuleOption[];
5
- renderChip?: NetworkRuleRenderChip;
5
+ /** Remote-source values: chips carry the option's logo, or its initial. */
6
+ withLogo?: boolean;
6
7
  emptyPlaceholder?: ReactNode;
7
8
  }
8
9
  /** Condition values as a wrapping row of chips. */
9
- export declare function OptionChips({ options, renderChip, emptyPlaceholder, }: Readonly<OptionChipsProps>): import("react").JSX.Element;
10
+ export declare function OptionChips({ options, withLogo, emptyPlaceholder, }: Readonly<OptionChipsProps>): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use strict";import{Fragment as i}from"react";import{Stack as o,Chip as t}from"@mui/material";import{jsx as r,Fragment as s}from"react/jsx-runtime";function m({options:a,renderChip:l,emptyPlaceholder:p="-"}){return a.length===0?r(s,{children:p}):r(o,{direction:"row",flexWrap:"wrap",useFlexGap:!0,gap:.75,children:a.map(e=>{const n={size:"small",label:e.label};return r(i,{children:l?l(e,n):r(t,{...n})},e.value)})})}export{m as OptionChips};
1
+ "use strict";import{Stack as i,Chip as p}from"@mui/material";import{LogoChip as s}from"../../UI/LogoChip.mjs";import{jsx as e,Fragment as t}from"react/jsx-runtime";function m({options:l,withLogo:o=!1,emptyPlaceholder:r="-"}){return l.length===0?e(t,{children:r}):e(i,{direction:"row",flexWrap:"wrap",useFlexGap:!0,gap:.75,children:l.map(a=>o?e(s,{size:"small",label:a.label,name:a.label,logoUrl:a.logoUrl},a.value):e(p,{size:"small",label:a.label},a.value))})}export{m as OptionChips};
@@ -0,0 +1,5 @@
1
+ import { NetworkRuleOption } from '../types';
2
+ /** The label with its code inline, so the code ends the label's last line when the label wraps. */
3
+ export declare function OptionLabel({ option, }: Readonly<{
4
+ option: NetworkRuleOption;
5
+ }>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use strict";import{Typography as n}from"@mui/material";import{jsxs as a,jsx as r}from"react/jsx-runtime";function t({option:o}){return a(n,{children:[o.label,r(n,{component:"span",variant:"caption",color:"text.secondary",sx:{ml:1},children:o.value})]})}export{t as OptionLabel};
@@ -1 +1 @@
1
- "use strict";import{useMemo as f}from"react";import{Typography as g,Table as y,TableHead as w,TableRow as p,TableCell as i,TableBody as x,Chip as v,Skeleton as k,IconButton as m}from"@mui/material";import{Edit as T,Delete as S}from"@mui/icons-material";import{useResolvedConditionOptions as $}from"../hooks/useResolvedConditionOptions.mjs";import{OptionChips as z}from"../shared/OptionChips.mjs";import{getKeyDef as D,getKeyLabel as O,getOperatorLabel as E}from"../utils/catalog.mjs";import{normalizeConditionValues as K}from"../utils/condition.mjs";import{jsx as o,jsxs as c}from"react/jsx-runtime";function L({rule:e,condition:n,index:t,catalog:a,showActions:s,onEditCondition:l,onDeleteCondition:r}){const d=D(a,n.key),C=f(()=>K(n.value),[n.value]),{options:u,isLoading:b,service:h}=$(d,C);return c(p,{children:[o(i,{sx:{whiteSpace:"nowrap"},children:o(v,{label:O(a,n.key)})}),o(i,{sx:{whiteSpace:"nowrap"},children:E(a,n.operator)}),o(i,{sx:{width:"100%"},children:b?o(k,{variant:"text",width:160}):o(z,{options:u,renderChip:h?.renderChip})}),s&&c(i,{align:"right",sx:{whiteSpace:"nowrap"},children:[l&&o(m,{size:"small",color:"primary","aria-label":`Edit condition ${t+1}`,onClick:()=>l(e,t),children:o(T,{fontSize:"small"})}),r&&o(m,{size:"small",color:"error","aria-label":`Delete condition ${t+1}`,disabled:e.conditions.length<=1,onClick:()=>r(e,t),children:o(S,{fontSize:"small"})})]})]})}function R({rule:e,catalog:n,readOnly:t=!1,onEditCondition:a,onDeleteCondition:s}){const l=!t&&(a!==void 0||s!==void 0);return e.conditions.length===0?o(g,{variant:"body2",color:"text.secondary",children:"No conditions"}):c(y,{"aria-label":`Conditions for ${e.name}`,children:[o(w,{children:c(p,{children:[o(i,{children:"Key"}),o(i,{children:"Operator"}),o(i,{children:"Values"}),l&&o(i,{align:"right",children:"Actions"})]})}),o(x,{children:e.conditions.map((r,d)=>o(L,{rule:e,condition:r,index:d,catalog:n,showActions:l,onEditCondition:a,onDeleteCondition:s},`${r.key}-${r.operator}-${d}`))})]})}export{R as NetworkRuleConditionsTable};
1
+ "use strict";import{useMemo as b}from"react";import{Typography as f,Table as w,TableHead as y,TableRow as h,TableCell as e,TableBody as x,Chip as v,Skeleton as k,IconButton as p}from"@mui/material";import{Edit as T,Delete as S}from"@mui/icons-material";import{useResolvedConditionOptions as $}from"../hooks/useResolvedConditionOptions.mjs";import{OptionChips as z}from"../shared/OptionChips.mjs";import{getKeyDef as D,getKeyLabel as O,getOperatorLabel as E}from"../utils/catalog.mjs";import{normalizeConditionValues as L}from"../utils/condition.mjs";import{jsx as o,jsxs as c}from"react/jsx-runtime";function K({rule:i,condition:n,index:t,catalog:a,showActions:s,onEditCondition:l,onDeleteCondition:r}){const d=D(a,n.key),m=b(()=>L(n.value),[n.value]),{options:g,isLoading:u,service:C}=$(d,m);return c(h,{children:[o(e,{sx:{whiteSpace:"nowrap"},children:o(v,{label:O(a,n.key)})}),o(e,{sx:{whiteSpace:"nowrap"},children:E(a,n.operator)}),o(e,{sx:{width:"100%"},children:u?o(k,{variant:"text",width:160}):o(z,{options:g,withLogo:C!==void 0})}),s&&c(e,{align:"right",sx:{whiteSpace:"nowrap"},children:[l&&o(p,{size:"small",color:"primary","aria-label":`Edit condition ${t+1}`,onClick:()=>l(i,t),children:o(T,{fontSize:"small"})}),r&&o(p,{size:"small",color:"error","aria-label":`Delete condition ${t+1}`,disabled:i.conditions.length<=1,onClick:()=>r(i,t),children:o(S,{fontSize:"small"})})]})]})}function R({rule:i,catalog:n,readOnly:t=!1,onEditCondition:a,onDeleteCondition:s}){const l=!t&&(a!==void 0||s!==void 0);return i.conditions.length===0?o(f,{variant:"body2",color:"text.secondary",children:"No conditions"}):c(w,{"aria-label":`Conditions for ${i.name}`,children:[o(y,{children:c(h,{children:[o(e,{children:"Key"}),o(e,{children:"Operator"}),o(e,{children:"Values"}),l&&o(e,{align:"right",children:"Actions"})]})}),o(x,{children:i.conditions.map((r,d)=>o(K,{rule:i,condition:r,index:d,catalog:n,showActions:l,onEditCondition:a,onDeleteCondition:s},`${r.key}-${r.operator}-${d}`))})]})}export{R as NetworkRuleConditionsTable};
@@ -1,10 +1,12 @@
1
- import { ReactElement, ReactNode } from 'react';
1
+ import { ReactElement } from 'react';
2
2
  import { ChipProps } from '@mui/material';
3
3
  import { QueryClient } from '@tanstack/react-query';
4
4
  export type NetworkRuleOption<TData = unknown> = {
5
5
  value: string;
6
6
  label: string;
7
- /** The raw record a remote source returned; read only by that source's renderers. */
7
+ /** Remote options show it as an avatar before the label, with the label's initial as fallback. */
8
+ logoUrl?: string | null;
9
+ /** The raw record a remote source returned. */
8
10
  data?: TData;
9
11
  };
10
12
  export type NetworkRuleStatusPresentation = {
@@ -31,13 +33,15 @@ export type NetworkRuleKeyDef = {
31
33
  operators: string[];
32
34
  type?: string;
33
35
  values?: NetworkRuleKeyValues;
36
+ /** The brand's saved suggestions for a free-text key. */
37
+ presets?: string[];
34
38
  };
35
39
  export type NetworkRuleCatalog = {
36
40
  statuses: string[];
37
41
  operators: Record<string, NetworkRuleOperatorDef>;
38
42
  keys: NetworkRuleKeyDef[];
39
- /** The brand's saved suggestions, keyed `notes` for the rule's note or by free-text condition key. */
40
- presets?: Record<string, string[]>;
43
+ /** The brand's saved suggestions for the rule's note. */
44
+ notePresets?: string[];
41
45
  };
42
46
  /** `value` is one string or several (inclusive OR). */
43
47
  export type NetworkRuleCondition = {
@@ -97,16 +101,11 @@ export type NetworkRuleSourceSearchParams = {
97
101
  limit?: number;
98
102
  skip?: number;
99
103
  };
100
- export type NetworkRuleRenderOption<TData = unknown> = (option: NetworkRuleOption<TData>) => ReactNode;
101
- /** Receives the props the default chip would get; spread them to keep size, deletion and keyboard behaviour. */
102
- export type NetworkRuleRenderChip<TData = unknown> = (option: NetworkRuleOption<TData>, chipProps: ChipProps) => ReactNode;
103
104
  /** One remote option source, keyed by `NetworkRuleKeyDef.values.source`. */
104
105
  export type NetworkRuleSourceService<TData = unknown> = {
105
106
  search: (params: NetworkRuleSourceSearchParams, signal?: AbortSignal) => Promise<Array<NetworkRuleOption<TData>>>;
106
107
  /** Labels for stored values. Without it they render as their raw string. */
107
108
  resolve?: (values: string[], signal?: AbortSignal) => Promise<Array<NetworkRuleOption<TData>>>;
108
- renderOption?: NetworkRuleRenderOption<TData>;
109
- renderChip?: NetworkRuleRenderChip<TData>;
110
109
  searchPlaceholder?: string;
111
110
  };
112
111
  export type NetworkRulesServices = {
@@ -1 +1 @@
1
- "use strict";import{getStatusPresentation as a}from"../statuses.mjs";function l(e,n){return e?.keys.find(t=>t.key===n)}function r(e,n){var t;return((t=l(e,n))==null?void 0:t.label)??n}function i(e,n){var t;return((t=e?.operators[n])==null?void 0:t.label)??n}function s(e,n){var t;return((t=e?.operators[n])==null?void 0:t.multi)??!0}function v(e){return a(e).label}function u(e){var n;return Array.isArray((n=e?.values)==null?void 0:n.options)}function f(e){var n;return!u(e)&&typeof((n=e?.values)==null?void 0:n.source)=="string"&&e.values.source.length>0}function d(e,n){return e.map(t=>n.find(o=>o.value===t)??{value:t,label:t})}function p(e,n){var t;return((t=e?.presets)==null?void 0:t[n])??[]}export{l as getKeyDef,r as getKeyLabel,i as getOperatorLabel,p as getPresets,v as getStatusLabel,u as hasInlineOptions,f as hasRemoteSource,s as isOperatorMulti,d as toOptions};
1
+ "use strict";import{getStatusPresentation as a}from"../statuses.mjs";function l(e,t){return e?.keys.find(n=>n.key===t)}function r(e,t){var n;return((n=l(e,t))==null?void 0:n.label)??t}function s(e,t){var n;return((n=e?.operators[t])==null?void 0:n.label)??t}function i(e,t){var n;return((n=e?.operators[t])==null?void 0:n.multi)??!0}function v(e){return a(e).label}function o(e){var t;return Array.isArray((t=e?.values)==null?void 0:t.options)}function f(e){var t;return!o(e)&&typeof((t=e?.values)==null?void 0:t.source)=="string"&&e.values.source.length>0}function d(e,t){return e.map(n=>t.find(u=>u.value===n)??{value:n,label:n})}function p(e,t){var n;return t==="notes"?e?.notePresets??[]:((n=l(e,t))==null?void 0:n.presets)??[]}export{l as getKeyDef,r as getKeyLabel,s as getOperatorLabel,p as getPresets,v as getStatusLabel,o as hasInlineOptions,f as hasRemoteSource,i as isOperatorMulti,d as toOptions};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "12.9.1-rc.21",
3
+ "version": "12.10.0",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "sideEffects": false,