@verifiedinc-public/shared-ui-elements 12.8.4 → 12.9.1-rc.10

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.
Files changed (95) hide show
  1. package/dist/components/DataTable/DataTable.context.d.ts +2 -0
  2. package/dist/components/DataTable/DataTable.context.mjs +1 -1
  3. package/dist/components/DataTable/DataTable.export.mjs +3 -3
  4. package/dist/components/DataTable/DataTable.mjs +1 -1
  5. package/dist/components/DataTable/DataTableExpandRow.d.ts +28 -0
  6. package/dist/components/DataTable/DataTableExpandRow.mjs +1 -0
  7. package/dist/components/DataTable/DataTableHeaderCell.mjs +1 -1
  8. package/dist/components/DataTable/index.d.ts +1 -0
  9. package/dist/components/NetworkRules/NetworkRules.context.d.ts +11 -0
  10. package/dist/components/NetworkRules/NetworkRules.context.mjs +1 -0
  11. package/dist/components/NetworkRules/dialog/NetworkRuleDeleteDialog.d.ts +16 -0
  12. package/dist/components/NetworkRules/dialog/NetworkRuleDeleteDialog.mjs +1 -0
  13. package/dist/components/NetworkRules/dialog/NetworkRuleDiscardDialog.d.ts +10 -0
  14. package/dist/components/NetworkRules/dialog/NetworkRuleDiscardDialog.mjs +1 -0
  15. package/dist/components/NetworkRules/dialog/index.d.ts +2 -0
  16. package/dist/components/NetworkRules/editor/NetworkRuleEditorDialog.d.ts +10 -0
  17. package/dist/components/NetworkRules/editor/NetworkRuleEditorDialog.mjs +1 -0
  18. package/dist/components/NetworkRules/editor/NetworkRuleEditorForm.d.ts +24 -0
  19. package/dist/components/NetworkRules/editor/NetworkRuleEditorForm.mjs +1 -0
  20. package/dist/components/NetworkRules/editor/fields/ConditionRow.d.ts +10 -0
  21. package/dist/components/NetworkRules/editor/fields/ConditionRow.mjs +1 -0
  22. package/dist/components/NetworkRules/editor/fields/ConditionValuesInput.d.ts +13 -0
  23. package/dist/components/NetworkRules/editor/fields/ConditionValuesInput.mjs +1 -0
  24. package/dist/components/NetworkRules/editor/fields/ConditionsField.d.ts +7 -0
  25. package/dist/components/NetworkRules/editor/fields/ConditionsField.mjs +1 -0
  26. package/dist/components/NetworkRules/editor/fields/DateField.d.ts +19 -0
  27. package/dist/components/NetworkRules/editor/fields/DateField.mjs +2 -0
  28. package/dist/components/NetworkRules/editor/fields/NotesField.d.ts +8 -0
  29. package/dist/components/NetworkRules/editor/fields/NotesField.mjs +1 -0
  30. package/dist/components/NetworkRules/editor/fields/StatusField.d.ts +5 -0
  31. package/dist/components/NetworkRules/editor/fields/StatusField.mjs +1 -0
  32. package/dist/components/NetworkRules/editor/fields/values/InlineValuesInput.d.ts +12 -0
  33. package/dist/components/NetworkRules/editor/fields/values/InlineValuesInput.mjs +1 -0
  34. package/dist/components/NetworkRules/editor/fields/values/RemoteValuesInput.d.ts +17 -0
  35. package/dist/components/NetworkRules/editor/fields/values/RemoteValuesInput.mjs +1 -0
  36. package/dist/components/NetworkRules/editor/fields/values/TextValuesInput.d.ts +12 -0
  37. package/dist/components/NetworkRules/editor/fields/values/TextValuesInput.mjs +1 -0
  38. package/dist/components/NetworkRules/editor/index.d.ts +5 -0
  39. package/dist/components/NetworkRules/editor/schema.d.ts +84 -0
  40. package/dist/components/NetworkRules/editor/schema.mjs +1 -0
  41. package/dist/components/NetworkRules/hooks/index.d.ts +5 -0
  42. package/dist/components/NetworkRules/hooks/useHeldWhileClosed.d.ts +2 -0
  43. package/dist/components/NetworkRules/hooks/useHeldWhileClosed.mjs +1 -0
  44. package/dist/components/NetworkRules/hooks/useNetworkRuleSourceSearch.d.ts +26 -0
  45. package/dist/components/NetworkRules/hooks/useNetworkRuleSourceSearch.mjs +1 -0
  46. package/dist/components/NetworkRules/hooks/useNetworkRulesCatalog.d.ts +3 -0
  47. package/dist/components/NetworkRules/hooks/useNetworkRulesCatalog.mjs +1 -0
  48. package/dist/components/NetworkRules/hooks/useNetworkRulesDialogs.d.ts +41 -0
  49. package/dist/components/NetworkRules/hooks/useNetworkRulesDialogs.mjs +1 -0
  50. package/dist/components/NetworkRules/hooks/useResolvedConditionOptions.d.ts +16 -0
  51. package/dist/components/NetworkRules/hooks/useResolvedConditionOptions.mjs +1 -0
  52. package/dist/components/NetworkRules/index.d.ts +9 -0
  53. package/dist/components/NetworkRules/index.mjs +1 -0
  54. package/dist/components/NetworkRules/shared/NetworkStatusChip.d.ts +5 -0
  55. package/dist/components/NetworkRules/shared/NetworkStatusChip.mjs +1 -0
  56. package/dist/components/NetworkRules/shared/OptionChips.d.ts +9 -0
  57. package/dist/components/NetworkRules/shared/OptionChips.mjs +1 -0
  58. package/dist/components/NetworkRules/shared/index.d.ts +2 -0
  59. package/dist/components/NetworkRules/statuses.d.ts +3 -0
  60. package/dist/components/NetworkRules/statuses.mjs +1 -0
  61. package/dist/components/NetworkRules/table/NetworkRuleConditionsTable.d.ts +9 -0
  62. package/dist/components/NetworkRules/table/NetworkRuleConditionsTable.mjs +1 -0
  63. package/dist/components/NetworkRules/table/NetworkRuleExpandedPanel.d.ts +15 -0
  64. package/dist/components/NetworkRules/table/NetworkRuleExpandedPanel.mjs +1 -0
  65. package/dist/components/NetworkRules/table/NetworkRuleRow.d.ts +9 -0
  66. package/dist/components/NetworkRules/table/NetworkRuleRow.mjs +1 -0
  67. package/dist/components/NetworkRules/table/NetworkRulesTable.d.ts +21 -0
  68. package/dist/components/NetworkRules/table/NetworkRulesTable.mjs +1 -0
  69. package/dist/components/NetworkRules/table/columns.d.ts +12 -0
  70. package/dist/components/NetworkRules/table/columns.mjs +1 -0
  71. package/dist/components/NetworkRules/table/index.d.ts +5 -0
  72. package/dist/components/NetworkRules/types.d.ts +111 -0
  73. package/dist/components/NetworkRules/utils/catalog.d.ts +20 -0
  74. package/dist/components/NetworkRules/utils/catalog.mjs +1 -0
  75. package/dist/components/NetworkRules/utils/condition.d.ts +7 -0
  76. package/dist/components/NetworkRules/utils/condition.mjs +1 -0
  77. package/dist/components/NetworkRules/utils/date.d.ts +6 -0
  78. package/dist/components/NetworkRules/utils/date.mjs +1 -0
  79. package/dist/components/NetworkRules/utils/index.d.ts +3 -0
  80. package/dist/components/UI/LogoAvatar.d.ts +14 -0
  81. package/dist/components/UI/LogoAvatar.mjs +1 -0
  82. package/dist/components/UI/LogoChip.d.ts +14 -0
  83. package/dist/components/UI/LogoChip.mjs +1 -0
  84. package/dist/components/UI/index.d.ts +2 -0
  85. package/dist/components/form/PhoneInput.d.ts +9 -4
  86. package/dist/components/form/PhoneInput.mjs +1 -1
  87. package/dist/components/form/PrettyPhoneInput.d.ts +15 -1
  88. package/dist/components/form/PrettyPhoneInput.mjs +32 -64
  89. package/dist/components/index.d.ts +1 -0
  90. package/dist/components/index.mjs +1 -1
  91. package/dist/index.mjs +1 -1
  92. package/dist/styles/lib/react-datepicker.d.ts +1 -1
  93. package/dist/styles/lib/react-datepicker.mjs +8 -2
  94. package/dist/styles/theme.mjs +1 -1
  95. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ "use strict";import{useMemo as M}from"react";import{useInfiniteQuery as N,keepPreviousData as k}from"@tanstack/react-query";import{useDebounceValue as w}from"../../../hooks/useDebounceValue.mjs";import{useNetworkRulesServices as x}from"../NetworkRules.context.mjs";function b(t,g,{limit:i=20,debounceMs:m=300,enabled:p=!0}={}){const{scope:v,sources:u}=x(),r=t?u?.[t]:void 0,n=w(g.trim(),m),s=N({queryKey:["network-rules",v,"source",t,n,i],queryFn:async({pageParam:a,signal:e})=>r?await r.search({search:n||void 0,limit:i,skip:a},e):[],initialPageParam:0,getNextPageParam:(a,e)=>a.length<i?void 0:e.reduce((o,y)=>o+y.length,0),enabled:p&&r!==void 0,placeholderData:k}),h=M(()=>{var a;const e=new Map;for(const o of((a=s.data)==null?void 0:a.pages.flat())??[])e.has(o.value)||e.set(o.value,o);return[...e.values()]},[s.data]),{hasNextPage:c,isFetching:l,isFetchingNextPage:d,fetchNextPage:f,refetch:P}=s;return{options:h,isLoading:l&&!d,isLoadingMore:d,hasMore:c,loadMore:()=>{c&&!l&&f()},isSupported:r!==void 0,service:r,error:s.error,retry:()=>{P()}}}export{b as useNetworkRuleSourceSearch};
@@ -0,0 +1,3 @@
1
+ import { UseQueryResult } from '@tanstack/react-query';
2
+ import { NetworkRuleCatalog } from '../types';
3
+ export declare function useNetworkRulesCatalog(): UseQueryResult<NetworkRuleCatalog>;
@@ -0,0 +1 @@
1
+ "use strict";import{useQuery as r}from"@tanstack/react-query";import{useNetworkRulesServices as o}from"../NetworkRules.context.mjs";const a=300*1e3;function u(){const{scope:e,getCatalog:s}=o();return r({queryKey:["network-rules",e,"catalog"],queryFn:async({signal:t})=>await s(t),staleTime:a})}export{u as useNetworkRulesCatalog};
@@ -0,0 +1,41 @@
1
+ import { NetworkRuleDeleteDialogProps } from '../dialog/NetworkRuleDeleteDialog';
2
+ import { NetworkRuleEditorDialogProps } from '../editor/NetworkRuleEditorDialog';
3
+ import { NetworkRuleRowHandlers } from '../table/NetworkRuleExpandedPanel';
4
+ import { NetworkRule, NetworkRuleServerError } from '../types';
5
+ export interface NetworkRulesEditorState {
6
+ open: boolean;
7
+ /** Undefined for a new rule. */
8
+ rule?: NetworkRule;
9
+ appendEmptyCondition: boolean;
10
+ focusConditionIndex?: number;
11
+ }
12
+ export interface NetworkRulesDeletionState {
13
+ open: boolean;
14
+ rule?: NetworkRule;
15
+ /** Set when one condition is being deleted rather than the rule. */
16
+ conditionIndex?: number;
17
+ }
18
+ /** Table callbacks wired to the dialogs; `onToggleEnabled` stays with the consumer. */
19
+ export type NetworkRulesDialogTableHandlers = Required<Pick<NetworkRuleRowHandlers, 'onEdit' | 'onDelete' | 'onAddCondition' | 'onEditCondition' | 'onDeleteCondition'>>;
20
+ export type NetworkRulesEditorDialogProps = Pick<NetworkRuleEditorDialogProps, 'open' | 'rule' | 'appendEmptyCondition' | 'focusConditionIndex' | 'serverErrors' | 'onClose'>;
21
+ export type NetworkRulesDeleteDialogProps = Pick<NetworkRuleDeleteDialogProps, 'open' | 'rule' | 'conditionIndex' | 'onClose'>;
22
+ export interface UseNetworkRulesDialogsResult {
23
+ editor: NetworkRulesEditorState;
24
+ deletion: NetworkRulesDeletionState;
25
+ /** Cleared on open and close. */
26
+ serverErrors: NetworkRuleServerError[] | undefined;
27
+ setServerErrors: (errors: NetworkRuleServerError[] | undefined) => void;
28
+ openCreate: () => void;
29
+ openEdit: (rule: NetworkRule) => void;
30
+ openAddCondition: (rule: NetworkRule) => void;
31
+ openEditCondition: (rule: NetworkRule, index: number) => void;
32
+ closeEditor: () => void;
33
+ requestDeleteRule: (rule: NetworkRule) => void;
34
+ requestDeleteCondition: (rule: NetworkRule, index: number) => void;
35
+ closeDeletion: () => void;
36
+ tableHandlers: NetworkRulesDialogTableHandlers;
37
+ editorDialogProps: NetworkRulesEditorDialogProps;
38
+ deleteDialogProps: NetworkRulesDeleteDialogProps;
39
+ }
40
+ /** Which dialog is open and about what. Data stays with the consumer. */
41
+ export declare function useNetworkRulesDialogs(): UseNetworkRulesDialogsResult;
@@ -0,0 +1 @@
1
+ "use strict";import{useState as v,useCallback as e,useMemo as D}from"react";function b(){const[n,t]=v({open:!1,appendEmptyCondition:!1}),[d,p]=v({open:!1}),[r,i]=v(),x=e(()=>{i(void 0),t({open:!0,appendEmptyCondition:!1})},[]),l=e(o=>{i(void 0),t({open:!0,rule:o,appendEmptyCondition:!1})},[]),s=e(o=>{i(void 0),t({open:!0,rule:o,appendEmptyCondition:!0})},[]),u=e((o,m)=>{i(void 0),t({open:!0,rule:o,appendEmptyCondition:!1,focusConditionIndex:m})},[]),a=e(()=>{i(void 0),t(o=>({...o,open:!1}))},[]),C=e(o=>{p({open:!0,rule:o})},[]),E=e((o,m)=>{p({open:!0,rule:o,conditionIndex:m})},[]),c=e(()=>{p(o=>({...o,open:!1}))},[]),y=D(()=>({onEdit:l,onDelete:C,onAddCondition:s,onEditCondition:u,onDeleteCondition:E}),[l,C,s,u,E]),I=D(()=>({open:n.open,rule:n.rule,appendEmptyCondition:n.appendEmptyCondition,focusConditionIndex:n.focusConditionIndex,serverErrors:r,onClose:a}),[n,r,a]),f=D(()=>({open:d.open,rule:d.rule,conditionIndex:d.conditionIndex,onClose:c}),[d,c]);return{editor:n,deletion:d,serverErrors:r,setServerErrors:i,openCreate:x,openEdit:l,openAddCondition:s,openEditCondition:u,closeEditor:a,requestDeleteRule:C,requestDeleteCondition:E,closeDeletion:c,tableHandlers:y,editorDialogProps:I,deleteDialogProps:f}}export{b as useNetworkRulesDialogs};
@@ -0,0 +1,16 @@
1
+ import { NetworkRuleKeyDef, NetworkRuleOption, NetworkRuleSourceService } from '../types';
2
+ export interface UseResolvedConditionOptionsParams {
3
+ /** Options already known to the caller; never sent to `resolve`. */
4
+ known?: readonly NetworkRuleOption[];
5
+ }
6
+ export interface UseResolvedConditionOptionsResult {
7
+ /** One option per stored value, in the stored order. */
8
+ options: NetworkRuleOption[];
9
+ isLoading: boolean;
10
+ service: NetworkRuleSourceService | undefined;
11
+ }
12
+ /**
13
+ * Stored values → displayable options: matched from inline options, resolved
14
+ * through the key's remote source, or labelled by themselves.
15
+ */
16
+ export declare function useResolvedConditionOptions(keyDef: NetworkRuleKeyDef | undefined, values: string[], { known }?: UseResolvedConditionOptionsParams): UseResolvedConditionOptionsResult;
@@ -0,0 +1 @@
1
+ "use strict";import{useMemo as m}from"react";import{useQuery as y,keepPreviousData as g}from"@tanstack/react-query";import{useNetworkRulesServices as h}from"../NetworkRules.context.mjs";import{hasInlineOptions as k,hasRemoteSource as w,toOptions as c}from"../utils/catalog.mjs";const O=300*1e3;function R(e,s,{known:a=[]}={}){const{scope:f,sources:p}=h(),v=k(e),i=w(e)?e.values.source:void 0,n=i?p?.[i]:void 0,t=n?.resolve,r=m(()=>s.filter(o=>!a.some(u=>u.value===o)).sort((o,u)=>o.localeCompare(u)),[s,a]),d=t!==void 0&&r.length>0,l=y({queryKey:["network-rules",f,"resolve",i,r],queryFn:async({signal:o})=>t?await t(r,o):[],enabled:d,staleTime:O,placeholderData:g});return{options:m(()=>v?c(s,e.values.options):c(s,[...a,...l.data??[]]),[v,e,s,a,l.data]),isLoading:d&&l.isPending,service:n}}export{R as useResolvedConditionOptions};
@@ -0,0 +1,9 @@
1
+ export * from './types';
2
+ export * from './statuses';
3
+ export * from './NetworkRules.context';
4
+ export * from './hooks';
5
+ export * from './utils';
6
+ export * from './shared';
7
+ export * from './table';
8
+ export * from './editor';
9
+ export * from './dialog';
@@ -0,0 +1 @@
1
+ "use strict";import{NETWORK_RULE_STATUSES as e,getStatusPresentation as o}from"./statuses.mjs";import{NetworkRulesProvider as a,useNetworkRuleStatuses as s,useNetworkRulesServices as t}from"./NetworkRules.context.mjs";import{ConditionValuesInput as r}from"./editor/fields/ConditionValuesInput.mjs";import{DateField as l}from"./editor/fields/DateField.mjs";import{NETWORK_RULES_COLUMN_IDS as i,buildNetworkRulesColumns as u}from"./table/columns.mjs";import{NetworkRuleConditionsTable as m}from"./table/NetworkRuleConditionsTable.mjs";import{NetworkRuleDeleteDialog as R}from"./dialog/NetworkRuleDeleteDialog.mjs";import{NetworkRuleDiscardDialog as n}from"./dialog/NetworkRuleDiscardDialog.mjs";import{NetworkRuleEditorDialog as p}from"./editor/NetworkRuleEditorDialog.mjs";import{NetworkRuleEditorForm as N}from"./editor/NetworkRuleEditorForm.mjs";import{NetworkRuleExpandedPanel as w}from"./table/NetworkRuleExpandedPanel.mjs";import{NetworkRuleRow as k}from"./table/NetworkRuleRow.mjs";import{NetworkRulesTable as d}from"./table/NetworkRulesTable.mjs";import{NetworkStatusChip as f}from"./shared/NetworkStatusChip.mjs";import{OptionChips as S}from"./shared/OptionChips.mjs";import{dayToRuleDate as D,formatRuleDate as C,ruleDateToDay as g}from"./utils/date.mjs";import{dedupeValues as O,emptyConditionFormValues as h,fromNetworkRuleFormValues as T,normalizeConditionValues as E,toNetworkRuleFormValues as F}from"./utils/condition.mjs";import{getKeyDef as c,getKeyLabel as L,getOperatorLabel as b,getStatusLabel as V,hasInlineOptions as y,hasRemoteSource as _,isOperatorMulti as K,toOptions as U}from"./utils/catalog.mjs";import{networkRuleConditionFormSchema as v,networkRuleFormSchema as I}from"./editor/schema.mjs";import{useHeldWhileClosed as P}from"./hooks/useHeldWhileClosed.mjs";import{useNetworkRuleSourceSearch as W}from"./hooks/useNetworkRuleSourceSearch.mjs";import{useNetworkRulesCatalog as M}from"./hooks/useNetworkRulesCatalog.mjs";import{useNetworkRulesDialogs as x}from"./hooks/useNetworkRulesDialogs.mjs";import{useResolvedConditionOptions as z}from"./hooks/useResolvedConditionOptions.mjs";export{r as ConditionValuesInput,l as DateField,i as NETWORK_RULES_COLUMN_IDS,e as NETWORK_RULE_STATUSES,m as NetworkRuleConditionsTable,R as NetworkRuleDeleteDialog,n as NetworkRuleDiscardDialog,p as NetworkRuleEditorDialog,N as NetworkRuleEditorForm,w as NetworkRuleExpandedPanel,k as NetworkRuleRow,a as NetworkRulesProvider,d as NetworkRulesTable,f as NetworkStatusChip,S as OptionChips,u as buildNetworkRulesColumns,D as dayToRuleDate,O as dedupeValues,h as emptyConditionFormValues,C as formatRuleDate,T as fromNetworkRuleFormValues,c as getKeyDef,L as getKeyLabel,b as getOperatorLabel,V as getStatusLabel,o as getStatusPresentation,y as hasInlineOptions,_ as hasRemoteSource,K as isOperatorMulti,v as networkRuleConditionFormSchema,I as networkRuleFormSchema,E as normalizeConditionValues,g as ruleDateToDay,F as toNetworkRuleFormValues,U as toOptions,P as useHeldWhileClosed,W as useNetworkRuleSourceSearch,s as useNetworkRuleStatuses,M as useNetworkRulesCatalog,x as useNetworkRulesDialogs,t as useNetworkRulesServices,z as useResolvedConditionOptions};
@@ -0,0 +1,5 @@
1
+ import { ChipProps } from '@mui/material';
2
+ export interface NetworkStatusChipProps extends Omit<ChipProps, 'label' | 'color' | 'icon'> {
3
+ status: string;
4
+ }
5
+ export declare function NetworkStatusChip({ status, size, sx, ...chipProps }: Readonly<NetworkStatusChipProps>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use strict";import{Chip as i}from"@mui/material";import{getStatusPresentation as e}from"../statuses.mjs";import{jsx as l}from"react/jsx-runtime";function n({status:r,size:s="small",sx:o,...a}){const t=e(r);return l(i,{size:s,label:t.label,color:t.color??"default",icon:t.icon,sx:[{"& .MuiChip-label":{fontWeight:700}},...Array.isArray(o)?o:[o]],...a})}export{n as NetworkStatusChip};
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { NetworkRuleOption, NetworkRuleRenderChip } from '../types';
3
+ export interface OptionChipsProps {
4
+ options: readonly NetworkRuleOption[];
5
+ renderChip?: NetworkRuleRenderChip;
6
+ emptyPlaceholder?: ReactNode;
7
+ }
8
+ /** Condition values as a wrapping row of chips. */
9
+ export declare function OptionChips({ options, renderChip, emptyPlaceholder, }: Readonly<OptionChipsProps>): import("react").JSX.Element;
@@ -0,0 +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};
@@ -0,0 +1,2 @@
1
+ export * from './NetworkStatusChip';
2
+ export * from './OptionChips';
@@ -0,0 +1,3 @@
1
+ import { NetworkRuleStatusPresentation } from './types';
2
+ export declare const NETWORK_RULE_STATUSES: Record<string, NetworkRuleStatusPresentation>;
3
+ export declare function getStatusPresentation(status: string): NetworkRuleStatusPresentation;
@@ -0,0 +1 @@
1
+ "use strict";import{Close as r,QuestionMark as t,Check as a}from"@mui/icons-material";import{jsx as e}from"react/jsx-runtime";const l={IN_NETWORK:{label:"In Network",color:"success",icon:e(a,{fontSize:"small"})},INDETERMINATE:{label:"Indeterminate",color:"warning",icon:e(t,{fontSize:"small"})},OUT_OF_NETWORK:{label:"Out of Network",color:"error",icon:e(r,{fontSize:"small"})}},n=o=>o.toLowerCase().split(/[_\s]+/).filter(Boolean).map(s=>s[0].toUpperCase()+s.slice(1)).join(" ");function i(o){return l[o]??{label:n(o)}}export{l as NETWORK_RULE_STATUSES,i as getStatusPresentation};
@@ -0,0 +1,9 @@
1
+ import { NetworkRule, NetworkRuleCatalog } from '../types';
2
+ export interface NetworkRuleConditionsTableProps {
3
+ rule: NetworkRule;
4
+ catalog?: NetworkRuleCatalog;
5
+ readOnly?: boolean;
6
+ onEditCondition?: (rule: NetworkRule, index: number) => void;
7
+ onDeleteCondition?: (rule: NetworkRule, index: number) => void;
8
+ }
9
+ export declare function NetworkRuleConditionsTable({ rule, catalog, readOnly, onEditCondition, onDeleteCondition, }: Readonly<NetworkRuleConditionsTableProps>): import("react").JSX.Element;
@@ -0,0 +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};
@@ -0,0 +1,15 @@
1
+ import { NetworkRule, NetworkRuleCatalog } from '../types';
2
+ export interface NetworkRuleRowHandlers {
3
+ onToggleEnabled?: (rule: NetworkRule, enabled: boolean) => void;
4
+ onEdit?: (rule: NetworkRule) => void;
5
+ onDelete?: (rule: NetworkRule) => void;
6
+ onAddCondition?: (rule: NetworkRule) => void;
7
+ onEditCondition?: (rule: NetworkRule, index: number) => void;
8
+ onDeleteCondition?: (rule: NetworkRule, index: number) => void;
9
+ }
10
+ export interface NetworkRuleExpandedPanelProps extends NetworkRuleRowHandlers {
11
+ rule: NetworkRule;
12
+ catalog?: NetworkRuleCatalog;
13
+ readOnly?: boolean;
14
+ }
15
+ export declare function NetworkRuleExpandedPanel({ rule, catalog, readOnly, onEdit, onDelete, onAddCondition, onEditCondition, onDeleteCondition, }: Readonly<NetworkRuleExpandedPanelProps>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use strict";import{Stack as o,Button as l,Typography as i}from"@mui/material";import{Edit as u,Add as h,Delete as m}from"@mui/icons-material";import{CopyableUuid as C}from"../../CopyableUuid/index.mjs";import{NetworkRuleConditionsTable as f}from"./NetworkRuleConditionsTable.mjs";import{jsxs as e,jsx as n}from"react/jsx-runtime";function g({rule:t,catalog:s,readOnly:c=!1,onEdit:r,onDelete:a,onAddCondition:d,onEditCondition:p,onDeleteCondition:x}){return e(o,{spacing:2,useFlexGap:!0,sx:{px:3,py:2},children:[!c&&(r!==void 0||d!==void 0||a!==void 0)&&e(o,{direction:"row",spacing:2,alignItems:"center",children:[r&&n(l,{variant:"text",startIcon:n(u,{}),onClick:()=>r(t),children:"Edit"}),d&&n(l,{variant:"text",startIcon:n(h,{}),onClick:()=>d(t),children:"Add Condition"}),a&&n(l,{variant:"text",color:"error",startIcon:n(m,{}),onClick:()=>a(t),children:"Delete"})]}),e(o,{direction:"row",spacing:4,alignItems:"flex-start",children:[e(o,{children:[n(i,{variant:"caption",color:"text.secondary",children:"Rule UUID"}),n(C,{uuid:t.uuid,label:"Rule UUID",variant:"button",head:36,tail:0,mono:!0,iconSx:{fontSize:14,p:.125}})]}),t.notes&&e(o,{sx:{maxWidth:480},children:[n(i,{variant:"caption",color:"text.secondary",children:"Notes"}),n(i,{variant:"body2",children:t.notes})]})]}),e(o,{spacing:1,children:[n(i,{sx:{fontSize:11,fontWeight:700,letterSpacing:.6,textTransform:"uppercase"},children:"Conditions"}),n(f,{rule:t,catalog:s,readOnly:c,onEditCondition:p,onDeleteCondition:x})]})]})}export{g as NetworkRuleExpandedPanel};
@@ -0,0 +1,9 @@
1
+ import { DataTableRowContext } from '../../DataTable/DataTable.types';
2
+ import { NetworkRule, NetworkRuleCatalog } from '../types';
3
+ import { NetworkRuleRowHandlers } from './NetworkRuleExpandedPanel';
4
+ export interface NetworkRuleRowProps extends DataTableRowContext<NetworkRule>, NetworkRuleRowHandlers {
5
+ catalog?: NetworkRuleCatalog;
6
+ readOnly?: boolean;
7
+ }
8
+ /** A rule row plus its collapsible detail row, for `DataTable`'s `renderRow`. */
9
+ export declare function NetworkRuleRow({ row, rowProps, getCellProps, catalog, readOnly, onToggleEnabled, ...handlers }: Readonly<NetworkRuleRowProps>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use strict";import{TableRow as u,TableCell as c,Collapse as R,Box as C,Switch as _}from"@mui/material";import{flexRender as D}from"@tanstack/react-table";import{useResizeObserver as O}from"../../../hooks/useResizeObserver.mjs";import{useDataTableContext as P}from"../../DataTable/DataTable.context.mjs";import{EXPAND_TRANSITION_MS as S,EXPANDED_ROW_PANEL_SX as v,EXPAND_COLUMN_ID as T,ExpandRowToggle as A}from"../../DataTable/DataTableExpandRow.mjs";import{NetworkStatusChip as I}from"../shared/NetworkStatusChip.mjs";import{NETWORK_RULES_COLUMN_IDS as p}from"./columns.mjs";import{NetworkRuleExpandedPanel as k}from"./NetworkRuleExpandedPanel.mjs";import{jsxs as L,Fragment as X,jsx as e}from"react/jsx-runtime";function y({row:o,rowProps:h,getCellProps:x,catalog:f,readOnly:s=!1,onToggleEnabled:l,...g}){var n;const E=o.getIsExpanded(),a=o.original,i=a.enabled??!0,d=o.getVisibleCells(),{scrollContainerRef:m}=P();O(m);const t=(n=m.current)==null?void 0:n.clientWidth,b=t!==void 0&&t>0?t:"100%",w=r=>{switch(r.column.id){case T:return e(A,{row:o});case p.enabled:return e(_,{size:"small",checked:i,disabled:s||l===void 0,onChange:(M,N)=>l?.(a,N),inputProps:{"aria-label":`${i?"Disable":"Enable"} rule ${a.name}`}});case p.status:return e(I,{status:a.status});default:return D(r.column.columnDef.cell,r.getContext())}};return L(X,{children:[e(u,{...h,hover:!0,sx:{"& > td":{borderBottom:"unset"}},children:d.map(r=>e(c,{...x(r),children:w(r)},r.id))}),e(u,{children:e(c,{sx:{py:0,px:0},colSpan:d.length,children:e(R,{in:E,timeout:S,unmountOnExit:!0,children:e(C,{sx:{...v,width:b},children:e(k,{rule:a,catalog:f,readOnly:s,...g})})})})})]})}export{y as NetworkRuleRow};
@@ -0,0 +1,21 @@
1
+ import { NetworkRule } from '../types';
2
+ import { NetworkRuleRowHandlers } from './NetworkRuleExpandedPanel';
3
+ export interface NetworkRulesTableProps extends NetworkRuleRowHandlers {
4
+ rules: NetworkRule[];
5
+ isLoading?: boolean;
6
+ /** No toggle, no row or condition actions. */
7
+ readOnly?: boolean;
8
+ emptyMessage?: string;
9
+ /** Defaults to 640. `'100%'` fills a parent with a definite height. */
10
+ maxHeight?: number | string;
11
+ /** Defaults to 900. */
12
+ minWidth?: number | string;
13
+ /** Defaults to 'network-rules'. */
14
+ exportFilename?: string;
15
+ }
16
+ /**
17
+ * One expandable row per rule. Presentation only: every change is reported
18
+ * through a callback. Rows render once the catalog is available, so codes
19
+ * never flash before their labels.
20
+ */
21
+ export declare function NetworkRulesTable({ rules, isLoading, readOnly, emptyMessage, maxHeight, minWidth, exportFilename, ...handlers }: Readonly<NetworkRulesTableProps>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use strict";import{useMemo as m}from"react";import{Alert as w,Button as k,Box as x,TableRow as y,TableCell as L,Skeleton as N}from"@mui/material";import{DataTable as v}from"../../DataTable/DataTable.mjs";import{EXPAND_COLUMN_ID as E}from"../../DataTable/DataTableExpandRow.mjs";import{useNetworkRuleStatuses as S}from"../NetworkRules.context.mjs";import{useNetworkRulesCatalog as T}from"../hooks/useNetworkRulesCatalog.mjs";import{getStatusLabel as D,getKeyLabel as I,getOperatorLabel as M}from"../utils/catalog.mjs";import{normalizeConditionValues as O}from"../utils/condition.mjs";import{buildNetworkRulesColumns as U,NETWORK_RULES_COLUMN_IDS as r}from"./columns.mjs";import{NetworkRuleRow as _}from"./NetworkRuleRow.mjs";import{jsx as o,Fragment as A}from"react/jsx-runtime";const F=4;function P({columnCount:t}){return o(A,{children:Array.from({length:F},(a,e)=>o(y,{children:Array.from({length:t},(d,i)=>o(L,{children:o(N,{variant:"text"})},i))},e))})}function j(t){return[{id:r.status,label:"Status",kind:"multiSelect",columnId:r.status,options:t.map(a=>{const e=D(a);return{label:e,value:e}})},{id:r.enabled,label:"Enabled",kind:"boolean",columnId:r.enabled}]}function z(t){return[{header:"Rule UUID",value:a=>a.uuid},{header:"Condition Details",value:a=>a.conditions.map(e=>`${I(t,e.key)} ${M(t,e.operator)} ${O(e.value).join(" | ")}`).join("; ")}]}function H({rules:t,isLoading:a=!1,readOnly:e=!1,emptyMessage:d="No network rules yet",maxHeight:i=640,minWidth:b=900,exportFilename:g="network-rules",...h}){const s=T(),n=s.data,c=S()??n?.statuses??[],u=n!==void 0,p=m(()=>U(),[]),f=m(()=>j(c),[c]),C=m(()=>z(n),[n]),R=i==="100%";return!u&&s.isError?o(w,{severity:"error",action:o(k,{color:"inherit",size:"small",onClick:()=>{s.refetch()},children:"Retry"}),children:"The rule catalog could not be loaded, so rules cannot be shown."}):o(x,{sx:R?{height:"100%",minHeight:0}:void 0,children:o(v,{data:u?t:[],columns:p,getRowId:l=>l.uuid,isLoading:a||!u,disablePagination:!0,showToolbar:!0,enableColumnMenu:!0,enableColumnResizing:!0,enableColumnPinning:!0,initialColumnPinning:{left:[E,r.enabled,r.name],right:[]},filterFields:f,enableExport:!0,exportFilename:g,additionalExportColumns:C,tableLayout:"fixed",minWidth:b,maxHeight:i,emptyMessage:d,renderRow:l=>o(_,{...l,catalog:n,readOnly:e,...h}),renderLoading:l=>o(P,{columnCount:l})})})}export{H as NetworkRulesTable};
@@ -0,0 +1,12 @@
1
+ import { ColumnDef } from '@tanstack/react-table';
2
+ import { NetworkRule } from '../types';
3
+ export declare const NETWORK_RULES_COLUMN_IDS: {
4
+ readonly enabled: "enabled";
5
+ readonly name: "name";
6
+ readonly conditions: "conditions";
7
+ readonly status: "status";
8
+ readonly startDate: "startDate";
9
+ readonly endDate: "endDate";
10
+ readonly notes: "notes";
11
+ };
12
+ export declare function buildNetworkRulesColumns(): Array<ColumnDef<NetworkRule, unknown>>;
@@ -0,0 +1 @@
1
+ "use strict";import{expandColumn as l}from"../../DataTable/DataTableExpandRow.mjs";import{getStatusLabel as r}from"../utils/catalog.mjs";import{formatRuleDate as n}from"../utils/date.mjs";const t={enabled:"enabled",name:"name",conditions:"conditions",status:"status",startDate:"startDate",endDate:"endDate",notes:"notes"};function a(e){return(i,s)=>(e(i.original)??"").localeCompare(e(s.original)??"")}const o=({getValue:e})=>e()??"-";function d(){return[l(),{id:t.enabled,header:"Enabled",accessorFn:e=>e.enabled??!0,enableSorting:!1,enableColumnFilter:!1,enableResizing:!1,meta:{width:100,disableColumnMenu:!0}},{id:t.name,header:"Rule Name",accessorFn:e=>e.name,enableSorting:!0,enableColumnFilter:!1,meta:{width:300}},{id:t.conditions,header:"Conditions",accessorFn:e=>e.conditions.length,enableSorting:!0,enableColumnFilter:!1,meta:{width:140}},{id:t.status,header:"Status",accessorFn:e=>r(e.status),enableSorting:!0,enableColumnFilter:!1,meta:{width:200}},{id:t.startDate,header:"Starts",accessorFn:e=>n(e.startDate)??void 0,cell:o,sortingFn:a(e=>e.startDate),sortUndefined:"last",enableSorting:!0,enableColumnFilter:!1,meta:{width:280}},{id:t.endDate,header:"Ends",accessorFn:e=>n(e.endDate)??void 0,cell:o,sortingFn:a(e=>e.endDate),sortUndefined:"last",enableSorting:!0,enableColumnFilter:!1,meta:{width:280}},{id:t.notes,header:"Notes",accessorFn:e=>e.notes??"-",enableSorting:!1,enableColumnFilter:!1,meta:{width:300}}]}export{t as NETWORK_RULES_COLUMN_IDS,d as buildNetworkRulesColumns};
@@ -0,0 +1,5 @@
1
+ export * from './columns';
2
+ export * from './NetworkRulesTable';
3
+ export * from './NetworkRuleRow';
4
+ export * from './NetworkRuleExpandedPanel';
5
+ export * from './NetworkRuleConditionsTable';
@@ -0,0 +1,111 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { ChipProps } from '@mui/material';
3
+ import { QueryClient } from '@tanstack/react-query';
4
+ export type NetworkRuleOption<TData = unknown> = {
5
+ value: string;
6
+ label: string;
7
+ /** The raw record a remote source returned; read only by that source's renderers. */
8
+ data?: TData;
9
+ };
10
+ export type NetworkRuleStatusPresentation = {
11
+ label: string;
12
+ color?: ChipProps['color'];
13
+ icon?: ReactElement;
14
+ };
15
+ export type NetworkRuleOperatorDef = {
16
+ label: string;
17
+ /** Accepts several values. Defaults to true. */
18
+ multi?: boolean;
19
+ };
20
+ export type NetworkRuleKeyValues = {
21
+ source: string;
22
+ options?: NetworkRuleOption[];
23
+ };
24
+ /**
25
+ * `values.options` → pick-list; `values.source` alone → search through
26
+ * `services.sources[source]`; no `values` → free text.
27
+ */
28
+ export type NetworkRuleKeyDef = {
29
+ key: string;
30
+ label: string;
31
+ operators: string[];
32
+ type?: string;
33
+ values?: NetworkRuleKeyValues;
34
+ };
35
+ export type NetworkRuleCatalog = {
36
+ statuses: string[];
37
+ operators: Record<string, NetworkRuleOperatorDef>;
38
+ keys: NetworkRuleKeyDef[];
39
+ };
40
+ /** `value` is one string or several (inclusive OR). */
41
+ export type NetworkRuleCondition = {
42
+ key: string;
43
+ operator: string;
44
+ value: string | string[];
45
+ };
46
+ /** Dates are calendar days, `YYYY-MM-DD`: from the start day up to, not including, the end day. */
47
+ export type NetworkRule = {
48
+ uuid: string;
49
+ name: string;
50
+ status: string;
51
+ notes?: string | null;
52
+ /** Defaults to true. */
53
+ enabled?: boolean;
54
+ startDate?: string | null;
55
+ endDate?: string | null;
56
+ conditions: NetworkRuleCondition[];
57
+ };
58
+ /** What the editor emits: a rule without its id. */
59
+ export type NetworkRuleData = Omit<NetworkRule, 'uuid'>;
60
+ export type NetworkRuleConditionFormValues = {
61
+ key: string;
62
+ operator: string;
63
+ values: string[];
64
+ };
65
+ export type NetworkRuleFormValues = {
66
+ name: string;
67
+ status: string;
68
+ notes: string | null;
69
+ enabled: boolean;
70
+ startDate: string | null;
71
+ endDate: string | null;
72
+ conditions: NetworkRuleConditionFormValues[];
73
+ };
74
+ /** Handed back with the submitted rule. */
75
+ export type NetworkRuleSubmitExtras = {
76
+ /** Note presets added while editing, not yet in `notePresets`. */
77
+ newNotePresets: string[];
78
+ };
79
+ /** A server validation error; `index` points at the offending condition. */
80
+ export type NetworkRuleServerError = {
81
+ index?: number;
82
+ key?: string;
83
+ operator?: string;
84
+ code: string;
85
+ message?: string;
86
+ };
87
+ export type NetworkRuleSourceSearchParams = {
88
+ search?: string;
89
+ limit?: number;
90
+ skip?: number;
91
+ };
92
+ export type NetworkRuleRenderOption<TData = unknown> = (option: NetworkRuleOption<TData>) => ReactNode;
93
+ /** Receives the props the default chip would get; spread them to keep size, deletion and keyboard behaviour. */
94
+ export type NetworkRuleRenderChip<TData = unknown> = (option: NetworkRuleOption<TData>, chipProps: ChipProps) => ReactNode;
95
+ /** One remote option source, keyed by `NetworkRuleKeyDef.values.source`. */
96
+ export type NetworkRuleSourceService<TData = unknown> = {
97
+ search: (params: NetworkRuleSourceSearchParams, signal?: AbortSignal) => Promise<Array<NetworkRuleOption<TData>>>;
98
+ /** Labels for stored values. Without it they render as their raw string. */
99
+ resolve?: (values: string[], signal?: AbortSignal) => Promise<Array<NetworkRuleOption<TData>>>;
100
+ renderOption?: NetworkRuleRenderOption<TData>;
101
+ renderChip?: NetworkRuleRenderChip<TData>;
102
+ searchPlaceholder?: string;
103
+ };
104
+ export type NetworkRulesServices = {
105
+ /** Namespaces the query keys when several providers share one query client, e.g. `${env}:${brandUuid}`. */
106
+ scope?: string;
107
+ getCatalog: (signal?: AbortSignal) => Promise<NetworkRuleCatalog>;
108
+ sources?: Record<string, NetworkRuleSourceService<any>>;
109
+ /** Shared with the host app; otherwise the provider creates its own. */
110
+ queryClient?: QueryClient;
111
+ };
@@ -0,0 +1,20 @@
1
+ import { NetworkRuleCatalog, NetworkRuleKeyDef, NetworkRuleOption } from '../types';
2
+ export declare function getKeyDef(catalog: NetworkRuleCatalog | undefined, key: string): NetworkRuleKeyDef | undefined;
3
+ export declare function getKeyLabel(catalog: NetworkRuleCatalog | undefined, key: string): string;
4
+ export declare function getOperatorLabel(catalog: NetworkRuleCatalog | undefined, operator: string): string;
5
+ /** Unknown operators count as multi, so the editor is never stricter than the catalog. */
6
+ export declare function isOperatorMulti(catalog: NetworkRuleCatalog | undefined, operator: string): boolean;
7
+ export declare function getStatusLabel(status: string): string;
8
+ export declare function hasInlineOptions(keyDef: NetworkRuleKeyDef | undefined): keyDef is NetworkRuleKeyDef & {
9
+ values: {
10
+ source: string;
11
+ options: NetworkRuleOption[];
12
+ };
13
+ };
14
+ export declare function hasRemoteSource(keyDef: NetworkRuleKeyDef | undefined): keyDef is NetworkRuleKeyDef & {
15
+ values: {
16
+ source: string;
17
+ };
18
+ };
19
+ /** One option per value, in order; a value `options` lacks is labelled by itself. */
20
+ export declare function toOptions(values: readonly string[], options: readonly NetworkRuleOption[]): NetworkRuleOption[];
@@ -0,0 +1 @@
1
+ "use strict";import{getStatusPresentation as o}from"../statuses.mjs";function r(e,t){return e?.keys.find(l=>l.key===t)}function u(e,t){var l;return((l=r(e,t))==null?void 0:l.label)??t}function i(e,t){var l;return((l=e?.operators[t])==null?void 0:l.label)??t}function s(e,t){var l;return((l=e?.operators[t])==null?void 0:l.multi)??!0}function v(e){return o(e).label}function a(e){var t;return Array.isArray((t=e?.values)==null?void 0:t.options)}function f(e){var t;return!a(e)&&typeof((t=e?.values)==null?void 0:t.source)=="string"&&e.values.source.length>0}function d(e,t){return e.map(l=>t.find(n=>n.value===l)??{value:l,label:l})}export{r as getKeyDef,u as getKeyLabel,i as getOperatorLabel,v as getStatusLabel,a as hasInlineOptions,f as hasRemoteSource,s as isOperatorMulti,d as toOptions};
@@ -0,0 +1,7 @@
1
+ import { NetworkRule, NetworkRuleConditionFormValues, NetworkRuleData, NetworkRuleFormValues } from '../types';
2
+ export declare function normalizeConditionValues(value: string | string[] | null | undefined): string[];
3
+ export declare function emptyConditionFormValues(): NetworkRuleConditionFormValues;
4
+ export declare function toNetworkRuleFormValues(rule?: Partial<NetworkRule> | null): NetworkRuleFormValues;
5
+ export declare function fromNetworkRuleFormValues(values: NetworkRuleFormValues): NetworkRuleData;
6
+ /** Case-insensitive, trimmed, blanks dropped; keeps the first spelling seen. */
7
+ export declare function dedupeValues(values: readonly string[]): string[];
@@ -0,0 +1 @@
1
+ "use strict";function l(e){return Array.isArray(e)?e:e==null||e===""?[]:[e]}function t(){return{key:"",operator:"",values:[]}}function u(e){return{name:e?.name??"",status:e?.status??"",notes:e?.notes??null,enabled:e?.enabled??!0,startDate:e?.startDate??null,endDate:e?.endDate??null,conditions:(e?.conditions??[]).map(n=>({key:n.key,operator:n.operator,values:l(n.value)}))}}function i(e){var n;return{name:e.name.trim(),status:e.status,notes:(n=e.notes)!=null&&n.trim()?e.notes.trim():null,enabled:e.enabled,startDate:e.startDate,endDate:e.endDate,conditions:e.conditions.map(o=>({key:o.key,operator:o.operator,value:o.values}))}}function d(e){const n=new Set,o=[];for(const s of e){const a=s.trim();if(!a)continue;const r=a.toLowerCase();n.has(r)||(n.add(r),o.push(a))}return o}export{d as dedupeValues,t as emptyConditionFormValues,i as fromNetworkRuleFormValues,l as normalizeConditionValues,u as toNetworkRuleFormValues};
@@ -0,0 +1,6 @@
1
+ /** `YYYY-MM-DD` → a local Date on that day, for pickers. */
2
+ export declare function ruleDateToDay(value?: string | null): Date | null;
3
+ /** A picked Date → `YYYY-MM-DD` from its local calendar fields. */
4
+ export declare function dayToRuleDate(date?: Date | null): string | null;
5
+ /** `YYYY-MM-DD` → "October 1, 2026". */
6
+ export declare function formatRuleDate(value?: string | null): string | null;
@@ -0,0 +1 @@
1
+ "use strict";import{format as l}from"date-fns";const s=/^(\d{4})-(\d{2})-(\d{2})$/;function o(e){const n=e?s.exec(e):null;if(!n)return null;const[u,r,a]=n.slice(1).map(Number),t=new Date(u,r-1,a);return t.getFullYear()===u&&t.getMonth()===r-1&&t.getDate()===a?t:null}function y(e){return!e||Number.isNaN(e.getTime())?null:l(e,"yyyy-MM-dd")}function c(e){const n=o(e);return n?l(n,"MMMM d, yyyy"):null}export{y as dayToRuleDate,c as formatRuleDate,o as ruleDateToDay};
@@ -0,0 +1,3 @@
1
+ export * from './catalog';
2
+ export * from './condition';
3
+ export * from './date';
@@ -0,0 +1,14 @@
1
+ import { AvatarProps } from '@mui/material';
2
+ export interface LogoAvatarProps extends Omit<AvatarProps, 'src' | 'children'> {
3
+ /** Entity name; its first letter is the fallback when there is no (working) logo. */
4
+ name: string;
5
+ logoUrl?: string | null;
6
+ /** Width and height in px. Defaults to 32. */
7
+ size?: number;
8
+ }
9
+ /**
10
+ * Rounded-square avatar showing an entity's logo, falling back to its initial
11
+ * on a primary background when the logo is missing or fails to load. Matches
12
+ * the payer avatar in the 1-Click health insurance field.
13
+ */
14
+ export declare function LogoAvatar({ name, logoUrl, size, sx, slotProps, ...avatarProps }: Readonly<LogoAvatarProps>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use strict";import{useState as u}from"react";import{Avatar as d}from"@mui/material";import{jsx as p}from"react/jsx-runtime";function g({name:s,logoUrl:r,size:o=32,sx:a,slotProps:t,...l}){var i;const[e,m]=u(null),n=r&&r!==e?r:void 0;return p(d,{src:n,alt:`${s} logo`,variant:"rounded",...l,sx:[{width:o,height:o,fontSize:Math.round(o*.5),borderRadius:1,bgcolor:n?"transparent":"primary.main"},...Array.isArray(a)?a:[a]],slotProps:{...t,img:{...t?.img,onError:()=>{m(r??null)}}},children:(i=s.trim()[0])==null?void 0:i.toUpperCase()})}export{g as LogoAvatar};
@@ -0,0 +1,14 @@
1
+ import { ChipProps } from '@mui/material';
2
+ export interface LogoChipProps extends Omit<ChipProps, 'avatar'> {
3
+ /** Entity name; drives the avatar's fallback initial. Pass `label` separately for the chip text. */
4
+ name: string;
5
+ logoUrl?: string | null;
6
+ }
7
+ /**
8
+ * A chip carrying a `LogoAvatar`. The avatar is a rounded square, so it is
9
+ * inset a little further than MUI's default round avatar to keep the pill's
10
+ * curve from clipping its corners. MUI paints chip avatars in gray text, which
11
+ * would swallow the fallback initial on its primary background, so the initial
12
+ * is pinned to the primary contrast color.
13
+ */
14
+ export declare function LogoChip({ name, logoUrl, label, sx, ...chipProps }: Readonly<LogoChipProps>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use strict";import{Chip as l}from"@mui/material";import{LogoAvatar as p}from"./LogoAvatar.mjs";import{jsx as o}from"react/jsx-runtime";function s({name:r,logoUrl:t,label:i,sx:a,...m}){return o(l,{...m,label:i??r,avatar:o(p,{name:r,logoUrl:t}),sx:[{"& .MuiChip-avatar":{marginLeft:"10px",color:"primary.contrastText"}},...Array.isArray(a)?a:[a]]})}export{s as LogoChip};
@@ -1,2 +1,4 @@
1
1
  export * from './AdaptativeBox';
2
2
  export * from './ContentWithLoader';
3
+ export * from './LogoAvatar';
4
+ export * from './LogoChip';
@@ -1,11 +1,16 @@
1
- import { BasePhoneInputProps } from '.';
1
+ import { PrettyPhoneInputProps } from './PrettyPhoneInput';
2
+ export interface PhoneInputProps extends PrettyPhoneInputProps {
3
+ /**
4
+ * Whether to render the phone input in a pretty way (animated gradient border). Defaults to false.
5
+ */
6
+ pretty?: boolean;
7
+ }
2
8
  /**
3
9
  * Renders a phone input component.
4
10
  *
5
11
  * @param props - The props for the phone input component.
6
12
  * @param props.pretty - Whether to render the phone input in a pretty way.
13
+ * @param props.loading - Whether to show the loading indicator. Only the pretty variant renders one.
7
14
  * @returns The phone input component.
8
15
  */
9
- export declare function PhoneInput(props: Readonly<BasePhoneInputProps & {
10
- pretty?: boolean;
11
- }>): import("react").JSX.Element;
16
+ export declare function PhoneInput({ pretty, loading, ...props }: Readonly<PhoneInputProps>): React.JSX.Element;
@@ -1 +1 @@
1
- "use strict";import{jsx as o}from"react/jsx-runtime";import{PrettyPhoneInput as t}from"./PrettyPhoneInput.mjs";import{BasePhoneInput as n}from"./BasePhoneInput.mjs";function e(r){return r.pretty?o(t,{...r}):o(n,{...r})}export{e as PhoneInput};
1
+ "use strict";import{BasePhoneInput as e}from"./BasePhoneInput.mjs";import{PrettyPhoneInput as p}from"./PrettyPhoneInput.mjs";import{jsx as r}from"react/jsx-runtime";function a({pretty:t=!1,loading:n,...o}){return t?r(p,{...o,loading:n}):r(e,{...o})}export{a as PhoneInput};
@@ -1,2 +1,16 @@
1
1
  import { BasePhoneInputProps } from './BasePhoneInput';
2
- export declare function PrettyPhoneInput(props: Readonly<BasePhoneInputProps>): React.JSX.Element;
2
+ export interface PrettyPhoneInputProps extends BasePhoneInputProps {
3
+ /**
4
+ * Whether the input is waiting on something (e.g. a lookup triggered by the typed number).
5
+ * The beam lapping the border speeds up while true so it reads as a loading indicator. Defaults to false.
6
+ */
7
+ loading?: boolean;
8
+ }
9
+ /**
10
+ * Renders the phone input wrapped in a gradient border with a beam of light lapping it at a constant
11
+ * speed: slowly while idle, quickly while loading.
12
+ *
13
+ * @param loading - Whether to show the loading indicator (the beam laps the border quickly). Defaults to false.
14
+ * @param props - Every other prop is forwarded to `BasePhoneInput`.
15
+ */
16
+ export declare function PrettyPhoneInput({ loading, ...props }: Readonly<PrettyPhoneInputProps>): React.JSX.Element;