@cryptlex/web-components 6.6.6-alpha41 → 6.6.6-alpha46

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 (42) hide show
  1. package/dist/components/checkbox.d.ts +4 -2
  2. package/dist/components/checkbox.js +1 -1
  3. package/dist/components/checkbox.js.map +1 -1
  4. package/dist/components/data-table-filter.d.ts +1 -1
  5. package/dist/components/data-table-filter.js +1 -1
  6. package/dist/components/data-table.d.ts +3 -11
  7. package/dist/components/data-table.js +1 -1
  8. package/dist/components/data-table.js.map +1 -1
  9. package/dist/components/dialog-action-utils.d.ts +38 -0
  10. package/dist/components/dialog-action-utils.js +2 -0
  11. package/dist/components/dialog-action-utils.js.map +1 -0
  12. package/dist/components/dialog-menu.d.ts +3 -3
  13. package/dist/components/dialog-menu.js +1 -1
  14. package/dist/components/dialog-menu.js.map +1 -1
  15. package/dist/components/id-search.d.ts +12 -11
  16. package/dist/components/id-search.js +1 -1
  17. package/dist/components/id-search.js.map +1 -1
  18. package/dist/components/select-options.d.ts +8 -0
  19. package/dist/components/select-options.js +1 -1
  20. package/dist/components/select-options.js.map +1 -1
  21. package/dist/components/table-actions.d.ts +46 -0
  22. package/dist/components/table-actions.js +2 -0
  23. package/dist/components/table-actions.js.map +1 -0
  24. package/dist/utilities/countries.d.ts +3 -0
  25. package/dist/utilities/countries.js +2 -0
  26. package/dist/utilities/countries.js.map +1 -0
  27. package/dist/utilities/ctx-client.d.ts +8 -0
  28. package/dist/utilities/ctx-client.js +2 -0
  29. package/dist/utilities/ctx-client.js.map +1 -0
  30. package/dist/utilities/numbers.d.ts +1 -0
  31. package/dist/utilities/numbers.js +1 -1
  32. package/dist/utilities/numbers.js.map +1 -1
  33. package/dist/utilities/resources.d.ts +8 -1
  34. package/dist/utilities/resources.js +1 -1
  35. package/dist/utilities/resources.js.map +1 -1
  36. package/dist/utilities/string.d.ts +5 -0
  37. package/dist/utilities/string.js +1 -1
  38. package/dist/utilities/string.js.map +1 -1
  39. package/dist/utilities/validators.d.ts +16 -0
  40. package/dist/utilities/validators.js +2 -0
  41. package/dist/utilities/validators.js.map +1 -0
  42. package/package.json +1 -1
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Hook for managing dialog state in action components.
3
+ * Returns the open key and setter function.
4
+ */
5
+ export declare function useDialogState(): {
6
+ openKey: string | null;
7
+ setOpenKey: import('react').Dispatch<import('react').SetStateAction<string | null>>;
8
+ };
9
+ /**
10
+ * Props for rendering a dialog action.
11
+ */
12
+ export type DialogActionRendererProps<TDialogProps extends {
13
+ close: () => void;
14
+ }> = {
15
+ /** The key of the currently open dialog */
16
+ readonly openKey: string | null;
17
+ /** Callback when dialog open state changes */
18
+ readonly onOpenChange: (open: boolean) => void;
19
+ /** Function to find the dialog item by normalized label key */
20
+ readonly findItem: (key: string) => {
21
+ component: React.ComponentType<TDialogProps>;
22
+ } | null;
23
+ /** Function to get dialog props, receives close function and returns full dialog props */
24
+ readonly getDialogProps: (close: () => void) => TDialogProps;
25
+ };
26
+ /**
27
+ * Renders a dialog for action components.
28
+ * Handles the DialogTrigger, DialogOverlay, and DialogContent wrapper.
29
+ */
30
+ export declare function DialogActionRenderer<TDialogProps extends {
31
+ close: () => void;
32
+ }>({ openKey, onOpenChange, findItem, getDialogProps, }: DialogActionRendererProps<TDialogProps>): import("react/jsx-runtime").JSX.Element;
33
+ /**
34
+ * Helper function to find an item by normalized label.
35
+ */
36
+ export declare function findItemByNormalizedLabel<T extends {
37
+ label: string;
38
+ }>(items: T[], normalizedKey: string): T | undefined;
@@ -0,0 +1,2 @@
1
+ "use client";import{jsx as o}from"react/jsx-runtime";import{useState as p}from"react";import{normalizeLabel as u}from"../utilities/string.js";import{DialogTrigger as a,DialogOverlay as c,DialogContent as f}from"./dialog.js";import"lodash-es";import"class-variance-authority";import"react-aria-components";import"./button.js";import"../utilities/theme.js";import"clsx";import"./loader.js";import"./icons.js";function S(){const[r,t]=p(null);return{openKey:r,setOpenKey:t}}function j({openKey:r,onOpenChange:t,findItem:n,getDialogProps:e}){return o(a,{isOpen:r!==null,onOpenChange:t,children:r!==null&&(()=>{const i=n(r);if(!i)return null;const l=i.component;return o(c,{children:o(f,{children:({close:m})=>o(l,{...e(m)})})})})()})}function v(r,t){return r.find(n=>u(n.label)===t)}export{j as DialogActionRenderer,v as findItemByNormalizedLabel,S as useDialogState};
2
+ //# sourceMappingURL=dialog-action-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog-action-utils.js","sources":["../../lib/components/dialog-action-utils.tsx"],"sourcesContent":["'use client';\nimport { useState } from 'react';\nimport { normalizeLabel } from '../utilities/string';\nimport { DialogContent, DialogOverlay, DialogTrigger } from './dialog';\n\n/**\n * Hook for managing dialog state in action components.\n * Returns the open key and setter function.\n */\nexport function useDialogState() {\n const [openKey, setOpenKey] = useState<string | null>(null);\n return { openKey, setOpenKey };\n}\n\n/**\n * Props for rendering a dialog action.\n */\nexport type DialogActionRendererProps<TDialogProps extends { close: () => void }> = {\n /** The key of the currently open dialog */\n readonly openKey: string | null;\n /** Callback when dialog open state changes */\n readonly onOpenChange: (open: boolean) => void;\n /** Function to find the dialog item by normalized label key */\n readonly findItem: (key: string) => { component: React.ComponentType<TDialogProps> } | null;\n /** Function to get dialog props, receives close function and returns full dialog props */\n readonly getDialogProps: (close: () => void) => TDialogProps;\n};\n\n/**\n * Renders a dialog for action components.\n * Handles the DialogTrigger, DialogOverlay, and DialogContent wrapper.\n */\nexport function DialogActionRenderer<TDialogProps extends { close: () => void }>({\n openKey,\n onOpenChange,\n findItem,\n getDialogProps,\n}: DialogActionRendererProps<TDialogProps>) {\n return (\n <DialogTrigger isOpen={openKey !== null} onOpenChange={onOpenChange}>\n {openKey !== null &&\n (() => {\n const item = findItem(openKey);\n if (!item) return null;\n\n const Component = item.component;\n\n return (\n <DialogOverlay>\n <DialogContent>{({ close }) => <Component {...getDialogProps(close)} />}</DialogContent>\n </DialogOverlay>\n );\n })()}\n </DialogTrigger>\n );\n}\n\n/**\n * Helper function to find an item by normalized label.\n */\nexport function findItemByNormalizedLabel<T extends { label: string }>(\n items: T[],\n normalizedKey: string\n): T | undefined {\n return items.find(it => normalizeLabel(it.label) === normalizedKey);\n}\n"],"names":["useDialogState","openKey","setOpenKey","useState","DialogActionRenderer","onOpenChange","findItem","getDialogProps","jsx","DialogTrigger","item","Component","DialogOverlay","DialogContent","close","findItemByNormalizedLabel","items","normalizedKey","it","normalizeLabel"],"mappings":"uZASO,SAASA,GAAiB,CAC7B,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAwB,IAAI,EAC1D,MAAO,CAAE,QAAAF,EAAS,WAAAC,CAAA,CACtB,CAoBO,SAASE,EAAiE,CAC7E,QAAAH,EACA,aAAAI,EACA,SAAAC,EACA,eAAAC,CACJ,EAA4C,CACxC,OACIC,EAACC,GAAc,OAAQR,IAAY,KAAM,aAAAI,EACpC,SAAAJ,IAAY,OACR,IAAM,CACH,MAAMS,EAAOJ,EAASL,CAAO,EAC7B,GAAI,CAACS,EAAM,OAAO,KAElB,MAAMC,EAAYD,EAAK,UAEvB,OACIF,EAACI,EAAA,CACG,SAAAJ,EAACK,EAAA,CAAe,UAAC,CAAE,MAAAC,CAAA,IAAYN,EAACG,GAAW,GAAGJ,EAAeO,CAAK,CAAA,CAAG,EAAG,EAC5E,CAER,IAAG,CACX,CAER,CAKO,SAASC,EACZC,EACAC,EACa,CACb,OAAOD,EAAM,KAAKE,GAAMC,EAAeD,EAAG,KAAK,IAAMD,CAAa,CACtE"}
@@ -27,8 +27,8 @@ export type MenuActionDialog<T> = MenuActionBase<T> & {
27
27
  /** Common menu action type that works for both DialogMenu and table row actions */
28
28
  export type DialogMenuAction<T> = MenuActionAction<T> | MenuActionDialog<T>;
29
29
  export type DialogMenuProps<T> = {
30
- label: React.ReactNode;
31
- items: DialogMenuAction<T>[];
32
- data: T;
30
+ readonly label: React.ReactNode;
31
+ readonly items: DialogMenuAction<T>[];
32
+ readonly data: T;
33
33
  };
34
34
  export declare function DialogMenu<T>({ label, items, data }: DialogMenuProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- "use client";import{jsxs as m,Fragment as d,jsx as r}from"react/jsx-runtime";import{useState as g}from"react";import{DialogTrigger as b,DialogOverlay as D,DialogContent as h}from"./dialog.js";import{EasyMenu as y,MenuItem as A}from"./menu.js";import"class-variance-authority";import"react-aria-components";import"./button.js";import"../utilities/theme.js";import"clsx";import"./loader.js";import"./icons.js";import"./list-box.js";import"./select.js";import"../utilities/form.js";import"../utilities/form-context.js";import"@tanstack/react-form";import"./form.js";import"./popover.js";function p(i){return i.trim().toLowerCase().replace(/\s+/g,"-")}function M(i){return i.type==="action"}function a(i){return i.type==="dialog"}function f(i,t){return i.isDisabled?i.isDisabled(t):!1}function G({label:i,items:t,data:l}){const[s,u]=g(null);return m(d,{children:[r(y,{"aria-label":"Actions",label:i,size:"icon",onAction:n=>{if(typeof n!="string")return;const e=t.find(c=>p(c.label)===n);!e||f(e,l)||(M(e)?e.onPress(l):a(e)&&u(n))},children:t.map(n=>{const e=p(n.label),o=n.icon,c=f(n,l);return m(A,{id:e,isDisabled:c,children:[r(o,{className:"size-icon"})," ",n.label]},e)})}),r(b,{isOpen:s!==null,onOpenChange:n=>{n||u(null)},children:s!==null&&(()=>{const n=t.find(o=>p(o.label)===s);if(!n||!a(n))return null;const e=n.component;return r(D,{children:r(h,{children:({close:o})=>r(e,{close:o,data:l})})})})()})]})}export{G as DialogMenu};
1
+ "use client";import{jsxs as m,Fragment as d,jsx as t}from"react/jsx-runtime";import{normalizeLabel as b}from"../utilities/string.js";import{useDialogState as g,findItemByNormalizedLabel as p,DialogActionRenderer as D}from"./dialog-action-utils.js";import{EasyMenu as A,MenuItem as y}from"./menu.js";import"lodash-es";import"react";import"./dialog.js";import"class-variance-authority";import"react-aria-components";import"./button.js";import"../utilities/theme.js";import"clsx";import"./loader.js";import"./icons.js";import"./list-box.js";import"./select.js";import"../utilities/form.js";import"../utilities/form-context.js";import"@tanstack/react-form";import"./form.js";import"./popover.js";function I(n){return n.type==="action"}function c(n){return n.type==="dialog"}function a(n,e){return n.isDisabled?n.isDisabled(e):!1}function J({label:n,items:e,data:r}){const{openKey:u,setOpenKey:s}=g();return m(d,{children:[t(A,{"aria-label":"Actions",label:n,size:"icon",onAction:i=>{if(typeof i!="string")return;const o=p(e,i);!o||a(o,r)||(I(o)?o.onPress(r):c(o)&&s(i))},children:e.map(i=>{const o=b(i.label),l=i.icon,f=a(i,r);return m(y,{id:o,isDisabled:f,children:[t(l,{className:"size-icon"})," ",i.label]},o)})}),t(D,{openKey:u,onOpenChange:i=>{i||s(null)},findItem:i=>{const o=p(e,i);return!o||!c(o)?null:{component:o.component}},getDialogProps:i=>({data:r,close:i})})]})}export{J as DialogMenu};
2
2
  //# sourceMappingURL=dialog-menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-menu.js","sources":["../../lib/components/dialog-menu.tsx"],"sourcesContent":["'use client';\nimport { useState } from 'react';\nimport { DialogContent, DialogOverlay, DialogTrigger } from './dialog';\nimport type { CtxIcon } from './icons';\nimport { EasyMenu, MenuItem } from './menu';\n\nfunction normalizeLabel(label: string): string {\n return label.trim().toLowerCase().replace(/\\s+/g, '-');\n}\n\nexport type DialogMenuContentProps<T> = {\n /** Callback to close the dialog */\n close: () => void;\n /** The data passed to the dialog */\n data: T;\n};\n\n/** Base properties shared by all menu actions */\nexport type MenuActionBase<T> = {\n label: string;\n /** Optional function to determine if the action is disabled. Receives the data and returns a boolean. Defaults to false if not provided */\n isDisabled?: (data: T) => boolean;\n icon: CtxIcon;\n};\n\n/** Action that triggers a callback */\nexport type MenuActionAction<T> = MenuActionBase<T> & {\n type: 'action';\n /** Callback triggered when the action is pressed. Receives the data as parameter */\n onPress: (data: T) => void;\n};\n\n/** Action that opens a dialog */\nexport type MenuActionDialog<T> = MenuActionBase<T> & {\n type: 'dialog';\n /** Component to render in the dialog */\n component: React.ComponentType<DialogMenuContentProps<T>>;\n};\n\n/** Common menu action type that works for both DialogMenu and table row actions */\nexport type DialogMenuAction<T> = MenuActionAction<T> | MenuActionDialog<T>;\n\nfunction isMenuActionAction<T>(item: DialogMenuAction<T>): item is MenuActionAction<T> {\n return item.type === 'action';\n}\n\nfunction isMenuActionDialog<T>(item: DialogMenuAction<T>): item is MenuActionDialog<T> {\n return item.type === 'dialog';\n}\n\nfunction getIsDisabled<T>(item: DialogMenuAction<T>, data: T): boolean {\n return item.isDisabled ? item.isDisabled(data) : false;\n}\n\nexport type DialogMenuProps<T> = {\n label: React.ReactNode;\n items: DialogMenuAction<T>[];\n data: T;\n};\n\nexport function DialogMenu<T>({ label, items, data }: DialogMenuProps<T>) {\n const [openKey, setOpenKey] = useState<string | null>(null);\n\n return (\n <>\n <EasyMenu\n aria-label=\"Actions\"\n label={label}\n size={'icon'}\n onAction={key => {\n if (typeof key !== 'string') return;\n const found = items.find(it => normalizeLabel(it.label) === key);\n if (!found) return;\n\n const isDisabled = getIsDisabled(found, data);\n if (isDisabled) return;\n\n if (isMenuActionAction(found)) {\n found.onPress(data);\n } else if (isMenuActionDialog(found)) {\n setOpenKey(key);\n }\n }}\n >\n {items.map(it => {\n const id = normalizeLabel(it.label);\n const Icon = it.icon;\n const isDisabled = getIsDisabled(it, data);\n return (\n <MenuItem key={id} id={id} isDisabled={isDisabled}>\n {<Icon className=\"size-icon\" />} {it.label}\n </MenuItem>\n );\n })}\n </EasyMenu>\n\n <DialogTrigger\n isOpen={openKey !== null}\n onOpenChange={open => {\n if (!open) setOpenKey(null);\n }}\n >\n {openKey !== null &&\n (() => {\n const renderItem = items.find(it => normalizeLabel(it.label) === openKey);\n if (!renderItem || !isMenuActionDialog(renderItem)) return null;\n\n const Component = renderItem.component;\n\n return (\n <DialogOverlay>\n <DialogContent>{({ close }) => <Component close={close} data={data} />}</DialogContent>\n </DialogOverlay>\n );\n })()}\n </DialogTrigger>\n </>\n );\n}\n"],"names":["normalizeLabel","label","isMenuActionAction","item","isMenuActionDialog","getIsDisabled","data","DialogMenu","items","openKey","setOpenKey","useState","jsxs","Fragment","jsx","EasyMenu","key","found","it","id","Icon","isDisabled","MenuItem","DialogTrigger","open","renderItem","Component","DialogOverlay","DialogContent","close"],"mappings":"wkBAMA,SAASA,EAAeC,EAAuB,CAC3C,OAAOA,EAAM,OAAO,cAAc,QAAQ,OAAQ,GAAG,CACzD,CAkCA,SAASC,EAAsBC,EAAwD,CACnF,OAAOA,EAAK,OAAS,QACzB,CAEA,SAASC,EAAsBD,EAAwD,CACnF,OAAOA,EAAK,OAAS,QACzB,CAEA,SAASE,EAAiBF,EAA2BG,EAAkB,CACnE,OAAOH,EAAK,WAAaA,EAAK,WAAWG,CAAI,EAAI,EACrD,CAQO,SAASC,EAAc,CAAE,MAAAN,EAAO,MAAAO,EAAO,KAAAF,GAA4B,CACtE,KAAM,CAACG,EAASC,CAAU,EAAIC,EAAwB,IAAI,EAE1D,OACIC,EAAAC,EAAA,CACI,SAAA,CAAAC,EAACC,EAAA,CACG,aAAW,UACX,MAAAd,EACA,KAAM,OACN,SAAUe,GAAO,CACb,GAAI,OAAOA,GAAQ,SAAU,OAC7B,MAAMC,EAAQT,EAAM,KAAKU,GAAMlB,EAAekB,EAAG,KAAK,IAAMF,CAAG,EAC3D,CAACC,GAEcZ,EAAcY,EAAOX,CAAI,IAGxCJ,EAAmBe,CAAK,EACxBA,EAAM,QAAQX,CAAI,EACXF,EAAmBa,CAAK,GAC/BP,EAAWM,CAAG,EAEtB,EAEC,SAAAR,EAAM,IAAIU,GAAM,CACb,MAAMC,EAAKnB,EAAekB,EAAG,KAAK,EAC5BE,EAAOF,EAAG,KACVG,EAAahB,EAAca,EAAIZ,CAAI,EACzC,OACIM,EAACU,EAAA,CAAkB,GAAAH,EAAQ,WAAAE,EACtB,SAAA,CAAAP,EAACM,EAAA,CAAK,UAAU,WAAA,CAAY,EAAG,IAAEF,EAAG,KAAA,CAAA,EAD1BC,CAEf,CAER,CAAC,CAAA,CAAA,EAGLL,EAACS,EAAA,CACG,OAAQd,IAAY,KACpB,aAAce,GAAQ,CACbA,GAAMd,EAAW,IAAI,CAC9B,EAEC,SAAAD,IAAY,OACR,IAAM,CACH,MAAMgB,EAAajB,EAAM,KAAKU,GAAMlB,EAAekB,EAAG,KAAK,IAAMT,CAAO,EACxE,GAAI,CAACgB,GAAc,CAACrB,EAAmBqB,CAAU,EAAG,OAAO,KAE3D,MAAMC,EAAYD,EAAW,UAE7B,OACIX,EAACa,EAAA,CACG,SAAAb,EAACc,EAAA,CAAe,SAAA,CAAC,CAAE,MAAAC,CAAA,IAAYf,EAACY,EAAA,CAAU,MAAAG,EAAc,KAAAvB,CAAA,CAAY,EAAG,EAC3E,CAER,GAAA,CAAG,CAAA,CACX,EACJ,CAER"}
1
+ {"version":3,"file":"dialog-menu.js","sources":["../../lib/components/dialog-menu.tsx"],"sourcesContent":["'use client';\nimport { normalizeLabel } from '../utilities/string';\nimport { DialogActionRenderer, findItemByNormalizedLabel, useDialogState } from './dialog-action-utils';\nimport type { CtxIcon } from './icons';\nimport { EasyMenu, MenuItem } from './menu';\n\nexport type DialogMenuContentProps<T> = {\n /** Callback to close the dialog */\n close: () => void;\n /** The data passed to the dialog */\n data: T;\n};\n\n/** Base properties shared by all menu actions */\nexport type MenuActionBase<T> = {\n label: string;\n /** Optional function to determine if the action is disabled. Receives the data and returns a boolean. Defaults to false if not provided */\n isDisabled?: (data: T) => boolean;\n icon: CtxIcon;\n};\n\n/** Action that triggers a callback */\nexport type MenuActionAction<T> = MenuActionBase<T> & {\n type: 'action';\n /** Callback triggered when the action is pressed. Receives the data as parameter */\n onPress: (data: T) => void;\n};\n\n/** Action that opens a dialog */\nexport type MenuActionDialog<T> = MenuActionBase<T> & {\n type: 'dialog';\n /** Component to render in the dialog */\n component: React.ComponentType<DialogMenuContentProps<T>>;\n};\n\n/** Common menu action type that works for both DialogMenu and table row actions */\nexport type DialogMenuAction<T> = MenuActionAction<T> | MenuActionDialog<T>;\n\nfunction isMenuActionAction<T>(item: DialogMenuAction<T>): item is MenuActionAction<T> {\n return item.type === 'action';\n}\n\nfunction isMenuActionDialog<T>(item: DialogMenuAction<T>): item is MenuActionDialog<T> {\n return item.type === 'dialog';\n}\n\nfunction getIsDisabled<T>(item: DialogMenuAction<T>, data: T): boolean {\n return item.isDisabled ? item.isDisabled(data) : false;\n}\n\nexport type DialogMenuProps<T> = {\n readonly label: React.ReactNode;\n readonly items: DialogMenuAction<T>[];\n readonly data: T;\n};\n\nexport function DialogMenu<T>({ label, items, data }: DialogMenuProps<T>) {\n const { openKey, setOpenKey } = useDialogState();\n\n return (\n <>\n <EasyMenu\n aria-label=\"Actions\"\n label={label}\n size={'icon'}\n onAction={key => {\n if (typeof key !== 'string') return;\n const found = findItemByNormalizedLabel(items, key);\n if (!found) return;\n\n const isDisabled = getIsDisabled(found, data);\n if (isDisabled) return;\n\n if (isMenuActionAction(found)) {\n found.onPress(data);\n } else if (isMenuActionDialog(found)) {\n setOpenKey(key);\n }\n }}\n >\n {items.map(it => {\n const id = normalizeLabel(it.label);\n const Icon = it.icon;\n const isDisabled = getIsDisabled(it, data);\n return (\n <MenuItem key={id} id={id} isDisabled={isDisabled}>\n {<Icon className=\"size-icon\" />} {it.label}\n </MenuItem>\n );\n })}\n </EasyMenu>\n\n <DialogActionRenderer<DialogMenuContentProps<T>>\n openKey={openKey}\n onOpenChange={open => {\n if (!open) setOpenKey(null);\n }}\n findItem={key => {\n const item = findItemByNormalizedLabel(items, key);\n if (!item || !isMenuActionDialog(item)) return null;\n return { component: item.component };\n }}\n getDialogProps={close => ({ data, close })}\n />\n </>\n );\n}\n"],"names":["isMenuActionAction","item","isMenuActionDialog","getIsDisabled","data","DialogMenu","label","items","openKey","setOpenKey","useDialogState","jsxs","Fragment","jsx","EasyMenu","key","found","findItemByNormalizedLabel","it","id","normalizeLabel","Icon","isDisabled","MenuItem","DialogActionRenderer","open","close"],"mappings":"orBAsCA,SAASA,EAAsBC,EAAwD,CACnF,OAAO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C5C,EACJ,CAER"}
@@ -19,7 +19,7 @@ type BaseSearchableResource = {
19
19
  * - Search (powered by react-query)
20
20
  * - Renders an accessible Autocomplete + Menu listbox
21
21
  * - Exposes a controlled `value`/`onChange` contract so callers (and wrappers) can manage state
22
- * - Clear separation of concerns: this component only handles UI search/display; callers provide `searchFn`
22
+ * - Automatically generates search function based on resource name using RESOURCE_ENDPOINT_MAP
23
23
  *
24
24
  * @template T - resource type extending `BaseSearchableResource` (must have `id` and `name`)
25
25
  * @template V - controlled value type (e.g. `string` for single-select or `string[]` for multi-select)
@@ -27,26 +27,25 @@ type BaseSearchableResource = {
27
27
  * @param props - props object (see inline property JSDoc for the most important fields)
28
28
  *
29
29
  * @remarks
30
- * - `searchFn` should return `Promise<T[] | undefined>`. Returning `undefined` indicates no results / handled error.
30
+ * - Search is automatically handled based on the `resource` prop using the API client from context
31
31
  * - When the popover closes, `onBlur` (if provided) is called with the current `value`.
32
32
  * - `renderLabel` must convert `value` to a readable string for the control button.
33
+ * - `defaultParams` can be used to pass additional query parameters to the search endpoint
33
34
  *
34
35
  * @example
35
36
  * <BaseIdSearchInput
36
37
  * label="Owner"
37
- * searchFn={q => api.searchUsers(q)}
38
+ * resource="user"
38
39
  * value={ownerId}
39
40
  * onChange={setOwnerId}
40
41
  * renderLabel={(v, data) => data?.find(d => d.id === v)?.name ?? v}
41
42
  * />
42
43
  *
43
44
  * @testing
44
- * - Mock `searchFn` in unit tests; assert keyboard navigation, open/close behavior, and `onBlur` call on popover close.
45
+ * - Ensure API client is provided via context; assert keyboard navigation, open/close behavior, and `onBlur` call on popover close.
45
46
  */
46
- declare function BaseIdSearchInput<T extends BaseSearchableResource, V>({ label, description, errorMessage, requiredIndicator, searchFn, isDisabled, isInvalid, onBlur, resource, onChange, value, renderLabel, ...props }: FormFieldProps & {
47
+ declare function BaseIdSearchInput<T extends BaseSearchableResource, V>({ label, description, errorMessage, requiredIndicator, isDisabled, isInvalid, onBlur, resource, onChange, value, renderLabel, accessor, defaultParams, className, ...props }: FormFieldProps & {
47
48
  resource: CtxResourceName;
48
- /** Function that returns matching resources for the current query. */
49
- searchFn: (q: string) => Promise<T[] | undefined>;
50
49
  /** Disable interactions. */
51
50
  isDisabled?: boolean;
52
51
  /** Whether the field is invalid. */
@@ -61,6 +60,10 @@ declare function BaseIdSearchInput<T extends BaseSearchableResource, V>({ label,
61
60
  onChange: (v: V) => void;
62
61
  /** Render a human-readable label for the current value using the latest data. */
63
62
  renderLabel: (v: V, data: T[] | undefined) => string;
63
+ /** Default parameters to include in the request. This is useful when using /v3/users?role='admin' or /v3/organizations/ID/user-groups */
64
+ defaultParams?: Record<'path' | 'query', any>;
65
+ /** Optional className to customize the trigger button styling. */
66
+ className?: string;
64
67
  } & Omit<React.ComponentProps<typeof Menu>, 'items' | 'className'>): import("react/jsx-runtime").JSX.Element;
65
68
  /**
66
69
  * Single-selection ID search input.
@@ -77,7 +80,6 @@ declare function BaseIdSearchInput<T extends BaseSearchableResource, V>({ label,
77
80
  * label="Reporter"
78
81
  * value={reporterId}
79
82
  * onChange={setReporterId}
80
- * searchFn={q => api.searchUsers(q)}
81
83
  * />
82
84
  *
83
85
  */
@@ -97,7 +99,6 @@ export declare function SingleIdSearchInput<T extends BaseSearchableResource>({
97
99
  * label="Reviewers"
98
100
  * value={reviewerIds}
99
101
  * onChange={setReviewerIds}
100
- * searchFn={q => api.searchUsers(q)}
101
102
  * />
102
103
  *
103
104
  * @remarks
@@ -113,7 +114,7 @@ export declare function MultipleIdSearchInput<T extends BaseSearchableResource>(
113
114
  * - surfaces field-level error messages
114
115
  *
115
116
  * @example
116
- * <TfSingleIdSearchInput name="ownerId" label="Owner" searchFn={q => api.searchUsers(q)} />
117
+ * <TfSingleIdSearchInput name="ownerId" label="Owner" />
117
118
 
118
119
  */
119
120
  export declare function TfSingleIdSearchInput({ isDisabled, ...props }: Omit<React.ComponentProps<typeof SingleIdSearchInput>, 'value' | 'onChange' | 'onBlur'>): import("react/jsx-runtime").JSX.Element;
@@ -126,7 +127,7 @@ export declare function TfSingleIdSearchInput({ isDisabled, ...props }: Omit<Rea
126
127
  * - surfaces field-level error messages
127
128
  *
128
129
  * @example
129
- * <TfMultipleIdSearchInput name="reviewerIds" label="Reviewers" searchFn={q => api.searchUsers(q)} />
130
+ * <TfMultipleIdSearchInput name="reviewerIds" label="Reviewers" />
130
131
  *
131
132
  */
132
133
  export declare function TfMultipleIdSearchInput({ isDisabled, ...props }: Omit<React.ComponentProps<typeof MultipleIdSearchInput>, 'value' | 'onChange'>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as r,jsxs as g}from"react/jsx-runtime";import{useQuery as x}from"@tanstack/react-query";import{useId as B,useState as T}from"react";import{Select as j,Autocomplete as A}from"react-aria-components";import{Loader as E}from"./loader.js";import{Menu as K,MenuItem as L}from"./menu.js";import{PopoverTrigger as _}from"./popover.js";import{SearchField as q}from"./searchfield.js";import{getFieldErrorMessage as a}from"../utilities/form.js";import{useFieldContext as S}from"../utilities/form-context.js";import{FormField as P}from"./form.js";import{SelectTrigger as w,SelectPopover as O}from"./select.js";import"../utilities/theme.js";import"clsx";import"./icons.js";import"./list-box.js";import"./button.js";import"class-variance-authority";import"@tanstack/react-form";function I({label:t,description:n,errorMessage:e,requiredIndicator:i,searchFn:l,isDisabled:v,isInvalid:s,onBlur:y,resource:C,onChange:k,value:m,renderLabel:b,...c}){const F=B(),u=c.id||F,[d,M]=T(""),{data:h,isError:f,isFetching:p,error:N}=x({queryKey:[C,"id",d],queryFn:()=>l(d)});return r("div",{className:"group form-field","data-invalid":s?"":void 0,children:r(P,{label:t,description:n,errorMessage:e,requiredIndicator:i,htmlFor:u,children:r(j,{isInvalid:s,children:g(_,{onOpenChange:o=>{o||y?.(m)},children:[r(w,{id:u,isDisabled:v,className:"w-full",children:b(m,h)}),r(O,{placement:"bottom start",children:g(A,{inputValue:d,onInputChange:M,children:[r(q,{className:"p-2",autoFocus:!0}),p&&r("div",{className:"p-input",children:r(E,{className:"mx-auto"})}),!p&&!f&&r(K,{...c,className:"max-h-48",items:h,renderEmptyState:()=>r("div",{className:"body-sm p-2",children:"No results found."}),children:o=>r(L,{id:o.id,children:o.name},o.id)}),f&&r("div",{className:"text-destructive p-icon body-sm",children:N.message})]})})]})})})})}function Q({...t}){return r(I,{selectedKeys:[t.value],onSelectionChange:n=>t.onChange(Array.from(n).filter(e=>typeof e=="string")[0]),renderLabel:(n,e)=>e?.find(i=>i.id===n)?.name??n,selectionMode:"single",...t})}function V({...t}){return r(I,{selectedKeys:t.value,onSelectionChange:n=>t.onChange(Array.from(n).filter(e=>typeof e=="string")),selectionMode:"multiple",renderLabel:(n,e)=>n?.map(i=>e?.find(l=>l.id===i)?.name??i).join(","),...t})}function le({isDisabled:t,...n}){const e=S({disabled:t});return r(Q,{...n,isDisabled:t||e.form.state.isSubmitting,value:e.state.value,onBlur:i=>e.handleBlur(),onChange:i=>e.handleChange(i),isInvalid:!!a(e),errorMessage:a(e)})}function de({isDisabled:t,...n}){const e=S({disabled:t});return r(V,{...n,isDisabled:t||e.form.state.isSubmitting,value:e.state.value,onBlur:i=>e.handleBlur(),onChange:i=>e.handleChange(i),isInvalid:!!a(e),errorMessage:a(e)})}export{V as MultipleIdSearchInput,Q as SingleIdSearchInput,de as TfMultipleIdSearchInput,le as TfSingleIdSearchInput};
1
+ "use client";import{jsx as n,jsxs as C}from"react/jsx-runtime";import{useQuery as B}from"@tanstack/react-query";import{useId as _,useState as j}from"react";import{Select as q,Autocomplete as w}from"react-aria-components";import{useCtxClient as R}from"../utilities/ctx-client.js";import{Loader as K}from"./loader.js";import{Menu as L,MenuItem as O}from"./menu.js";import{PopoverTrigger as P}from"./popover.js";import{SearchField as D}from"./searchfield.js";import{getFieldErrorMessage as a}from"../utilities/form.js";import{useFieldContext as v}from"../utilities/form-context.js";import{RESOURCE_ENDPOINT_MAP as G}from"../utilities/resources.js";import{FormField as Q}from"./form.js";import{SelectTrigger as U,SelectPopover as V}from"./select.js";import"../utilities/theme.js";import"clsx";import"./icons.js";import"./list-box.js";import"./button.js";import"class-variance-authority";import"@tanstack/react-form";import"../utilities/string.js";import"lodash-es";function k(t){return Array.isArray(t)&&t.every(r=>r&&typeof r=="object"&&"id"in r&&"name"in r)}function b({label:t,description:r,errorMessage:e,requiredIndicator:i,isDisabled:l,isInvalid:c,onBlur:N,resource:s,onChange:J,value:u,renderLabel:M,accessor:p,defaultParams:h,className:F,...f}){if(s==="profile")throw Error('Resource "profile" is not supported with IdSearch since it is not a searchable resource.');const x=_(),g=f.id||x,E=R(),[d,A]=j(""),{data:y,isError:S,isFetching:I,error:T}=B({queryKey:[s,"id",d],queryFn:async()=>{const m=(await E.GET(G[s],{params:{query:{search:d,...h?.query},path:{...h?.path}}})).data;return m&&k(m)?m:[]}});return n("div",{className:"group form-field","data-invalid":c?"":void 0,children:n(Q,{label:t,description:r,errorMessage:e,requiredIndicator:i,htmlFor:g,children:n(q,{isInvalid:c,children:C(P,{onOpenChange:o=>{o||N?.(u)},children:[n(U,{id:g,isDisabled:l,className:F??"w-full",children:M(u,y)}),n(V,{placement:"bottom start",children:C(w,{inputValue:d,onInputChange:A,children:[n(D,{className:"p-2",autoFocus:!0}),I&&n("div",{className:"p-input",children:n(K,{className:"mx-auto"})}),!I&&!S&&n(L,{...f,className:"max-h-48",items:y,renderEmptyState:()=>n("div",{className:"body-sm p-2",children:"No results found."}),children:o=>n(O,{id:o[p],children:o.name},o[p])}),S&&n("div",{className:"text-destructive p-icon body-sm",children:T.message})]})})]})})})})}function z({...t}){return n(b,{selectedKeys:[t.value],onSelectionChange:r=>t.onChange(Array.from(r).filter(e=>typeof e=="string")[0]),renderLabel:(r,e)=>e?.find(i=>i.id===r)?.name??r,selectionMode:"single",...t})}function H({...t}){return n(b,{selectedKeys:t.value,onSelectionChange:r=>t.onChange(Array.from(r).filter(e=>typeof e=="string")),selectionMode:"multiple",renderLabel:(r,e)=>r?.map(i=>e?.find(l=>l.id===i)?.name??i).join(","),...t})}function Se({isDisabled:t,...r}){const e=v({disabled:t});return n(z,{...r,isDisabled:t||e.form.state.isSubmitting,value:e.state.value,onBlur:i=>e.handleBlur(),onChange:i=>e.handleChange(i),isInvalid:!!a(e),errorMessage:a(e)})}function Ie({isDisabled:t,...r}){const e=v({disabled:t});return n(H,{...r,isDisabled:t||e.form.state.isSubmitting,value:e.state.value,onBlur:i=>e.handleBlur(),onChange:i=>e.handleChange(i),isInvalid:!!a(e),errorMessage:a(e)})}export{H as MultipleIdSearchInput,z as SingleIdSearchInput,Ie as TfMultipleIdSearchInput,Se as TfSingleIdSearchInput};
2
2
  //# sourceMappingURL=id-search.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"id-search.js","sources":["../../lib/components/id-search.tsx"],"sourcesContent":["'use client';\nimport { useQuery } from '@tanstack/react-query';\nimport { useId, useState } from 'react';\nimport { Select as AriaSelect, Autocomplete } from 'react-aria-components';\n\nimport { Loader } from '../components/loader';\nimport { Menu, MenuItem } from '../components/menu';\nimport { PopoverTrigger } from '../components/popover';\nimport { SearchField } from '../components/searchfield';\nimport { getFieldErrorMessage } from '../utilities/form';\nimport { useFieldContext } from '../utilities/form-context';\nimport type { CtxResourceName } from '../utilities/resources';\nimport { FormField, type FormFieldProps } from './form';\nimport { SelectPopover, SelectTrigger } from './select';\n\n/**\n * Minimal resource shape used by the ID search inputs.\n * Only `id` and `name` are required.\n *\n * @example\n * const user: BaseSearchableResource = { id: 'u_123', name: 'Nabeel Farooq' };\n */\ntype BaseSearchableResource = {\n /** Unique identifier used as the input value. */\n id: string;\n /** Human-readable label shown to users. */\n name: string;\n};\n\n/**\n * - Generic, accessible ID-search building block.\n * - Search (powered by react-query)\n * - Renders an accessible Autocomplete + Menu listbox\n * - Exposes a controlled `value`/`onChange` contract so callers (and wrappers) can manage state\n * - Clear separation of concerns: this component only handles UI search/display; callers provide `searchFn`\n *\n * @template T - resource type extending `BaseSearchableResource` (must have `id` and `name`)\n * @template V - controlled value type (e.g. `string` for single-select or `string[]` for multi-select)\n *\n * @param props - props object (see inline property JSDoc for the most important fields)\n *\n * @remarks\n * - `searchFn` should return `Promise<T[] | undefined>`. Returning `undefined` indicates no results / handled error.\n * - When the popover closes, `onBlur` (if provided) is called with the current `value`.\n * - `renderLabel` must convert `value` to a readable string for the control button.\n *\n * @example\n * <BaseIdSearchInput\n * label=\"Owner\"\n * searchFn={q => api.searchUsers(q)}\n * value={ownerId}\n * onChange={setOwnerId}\n * renderLabel={(v, data) => data?.find(d => d.id === v)?.name ?? v}\n * />\n *\n * @testing\n * - Mock `searchFn` in unit tests; assert keyboard navigation, open/close behavior, and `onBlur` call on popover close.\n */\nfunction BaseIdSearchInput<T extends BaseSearchableResource, V>({\n label,\n description,\n errorMessage,\n requiredIndicator,\n searchFn,\n isDisabled,\n isInvalid,\n onBlur,\n resource,\n onChange,\n value,\n renderLabel,\n ...props\n}: FormFieldProps & {\n resource: CtxResourceName;\n /** Function that returns matching resources for the current query. */\n searchFn: (q: string) => Promise<T[] | undefined>;\n /** Disable interactions. */\n isDisabled?: boolean;\n /** Whether the field is invalid. */\n isInvalid?: boolean;\n /** Key used to access an alternate display accessor on item (kept for compatibility). */\n accessor: keyof BaseSearchableResource;\n /** Controlled value. */\n value: V;\n /** Called when popover closes or the field blurs with the current value. */\n onBlur?: (v: V) => void;\n /** Controlled change handler. */\n onChange: (v: V) => void;\n /** Render a human-readable label for the current value using the latest data. */\n renderLabel: (v: V, data: T[] | undefined) => string;\n} & Omit<React.ComponentProps<typeof Menu>, 'items' | 'className'>) {\n const generatedId = useId();\n const fieldId = props.id || generatedId;\n\n const [search, _setSearch] = useState('');\n const { data, isError, isFetching, error } = useQuery({\n queryKey: [resource, 'id', search],\n queryFn: () => searchFn(search),\n });\n\n return (\n <div className=\"group form-field\" data-invalid={isInvalid ? '' : undefined}>\n <FormField {...{ label, description, errorMessage, requiredIndicator, htmlFor: fieldId }}>\n <AriaSelect isInvalid={isInvalid}>\n <PopoverTrigger\n onOpenChange={o => {\n if (!o) {\n // searchInputRef.current?.focus();\n onBlur?.(value);\n }\n }}\n >\n <SelectTrigger id={fieldId} isDisabled={isDisabled} className={'w-full'}>\n {renderLabel(value, data)}\n </SelectTrigger>\n <SelectPopover placement=\"bottom start\">\n <Autocomplete inputValue={search} onInputChange={_setSearch}>\n <SearchField className={'p-2'} autoFocus />\n {isFetching && (\n <div className=\"p-input\">\n <Loader className=\"mx-auto\" />\n </div>\n )}\n {!isFetching && !isError && (\n <Menu\n {...props}\n className={'max-h-48'}\n items={data}\n renderEmptyState={() => <div className=\"body-sm p-2\">No results found.</div>}\n >\n {item => (\n <MenuItem key={item['id']} id={item['id']}>\n {item.name}\n </MenuItem>\n )}\n </Menu>\n )}\n {isError && <div className=\"text-destructive p-icon body-sm\">{error.message}</div>}\n </Autocomplete>\n </SelectPopover>\n </PopoverTrigger>\n </AriaSelect>\n </FormField>\n </div>\n );\n}\n\n/**\n * Single-selection ID search input.\n *\n * Thin, typed wrapper around `BaseIdSearchInput` specialized for the very common single-ID case.\n * Adapts the internal selection events into `onChange(id?: string)` and renders the selected label.\n *\n * @template T - resource type (extends BaseSearchableResource)\n *\n * @param props - Inherits `BaseIdSearchInput` props but uses `string[]` value type.\n *\n * @example\n * <SingleIdSearchInput\n * label=\"Reporter\"\n * value={reporterId}\n * onChange={setReporterId}\n * searchFn={q => api.searchUsers(q)}\n * />\n *\n */\nexport function SingleIdSearchInput<T extends BaseSearchableResource>({\n ...props\n}: Omit<\n React.ComponentProps<typeof BaseIdSearchInput<T, string>>,\n 'onSelectionChange' | 'selectionMode' | 'selectedKeys' | 'renderLabel'\n>) {\n return (\n <BaseIdSearchInput\n selectedKeys={[props.value]}\n onSelectionChange={e => props.onChange(Array.from(e).filter(v => typeof v === 'string')[0])}\n renderLabel={(v, d) => d?.find(di => di.id === v)?.name ?? v}\n selectionMode=\"single\"\n {...props}\n />\n );\n}\n\n/**\n * Multi-selection ID search input.\n *\n * Thin wrapper around `BaseIdSearchInput` for the multiple-ID (`string[]`) case.\n * Adapts internal selection events into `onChange(ids: string[])`.\n *\n * @template T - resource type (extends BaseSearchableResource)\n *\n * @param props - Inherits `BaseIdSearchInput` props but uses `string[]` value type.\n *\n * @example\n * <MultipleIdSearchInput\n * label=\"Reviewers\"\n * value={reviewerIds}\n * onChange={setReviewerIds}\n * searchFn={q => api.searchUsers(q)}\n * />\n *\n * @remarks\n * - The `renderLabel` joins selected item names with commas for compact display.\n */\nexport function MultipleIdSearchInput<T extends BaseSearchableResource>({\n ...props\n}: Omit<\n React.ComponentProps<typeof BaseIdSearchInput<T, string[]>>,\n 'renderLabel' | 'onSelectionChange' | 'selectionMode' | 'selectedKeys'\n>) {\n return (\n <BaseIdSearchInput\n selectedKeys={props.value}\n onSelectionChange={e => props.onChange(Array.from(e).filter(v => typeof v === 'string'))}\n selectionMode=\"multiple\"\n renderLabel={(v, d) => v?.map(vi => d?.find(di => di.id === vi)?.name ?? vi).join(',')}\n {...props}\n />\n );\n}\n\n/**\n * Form-integrated single-select ID input (field wrapper).\n *\n * Integrates `SingleIdSearchInput` into the form system using `useFieldContext`.\n * - wires `value`, `onChange`, and `onBlur`\n * - disables the control while the form is submitting\n * - surfaces field-level error messages\n *\n * @example\n * <TfSingleIdSearchInput name=\"ownerId\" label=\"Owner\" searchFn={q => api.searchUsers(q)} />\n \n */\nexport function TfSingleIdSearchInput({\n isDisabled,\n ...props\n}: Omit<React.ComponentProps<typeof SingleIdSearchInput>, 'value' | 'onChange' | 'onBlur'>) {\n const field = useFieldContext<string>({ disabled: isDisabled });\n return (\n <SingleIdSearchInput\n {...props}\n isDisabled={isDisabled || field.form.state.isSubmitting}\n value={field.state.value}\n onBlur={_ => field.handleBlur()}\n onChange={e => field.handleChange(e)}\n isInvalid={!!getFieldErrorMessage(field)}\n errorMessage={getFieldErrorMessage(field)}\n />\n );\n}\n\n/**\n * Form-integrated multi-select ID input (field wrapper).\n *\n * Integrates `MultipleIdSearchInput` into the form system using `useFieldContext`.\n * - wires `value`, `onChange`, and `onBlur`\n * - disables the control while the form is submitting\n * - surfaces field-level error messages\n *\n * @example\n * <TfMultipleIdSearchInput name=\"reviewerIds\" label=\"Reviewers\" searchFn={q => api.searchUsers(q)} />\n *\n */\nexport function TfMultipleIdSearchInput({\n isDisabled,\n ...props\n}: Omit<React.ComponentProps<typeof MultipleIdSearchInput>, 'value' | 'onChange'>) {\n const field = useFieldContext<string[]>({ disabled: isDisabled });\n return (\n <MultipleIdSearchInput\n {...props}\n isDisabled={isDisabled || field.form.state.isSubmitting}\n value={field.state.value}\n onBlur={_ => field.handleBlur()}\n onChange={e => field.handleChange(e)}\n isInvalid={!!getFieldErrorMessage(field)}\n errorMessage={getFieldErrorMessage(field)}\n />\n );\n}\n"],"names":["BaseIdSearchInput","label","description","errorMessage","requiredIndicator","searchFn","isDisabled","isInvalid","onBlur","resource","onChange","value","renderLabel","props","generatedId","useId","fieldId","search","_setSearch","useState","data","isError","isFetching","error","useQuery","jsx","FormField","AriaSelect","jsxs","PopoverTrigger","SelectTrigger","SelectPopover","Autocomplete","SearchField","Loader","Menu","item","MenuItem","SingleIdSearchInput","e","v","d","di","MultipleIdSearchInput","vi","TfSingleIdSearchInput","field","useFieldContext","_","getFieldErrorMessage","TfMultipleIdSearchInput"],"mappings":"oxBA0DA,SAASA,EAAuD,CAC5D,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,kBAAAC,EACA,SAAAC,EACA,WAAAC,EACA,UAAAC,EACA,OAAAC,EACA,SAAAC,EACA,SAAAC,EACA,MAAAC,EACA,YAAAC,EACA,GAAGC,CACP,EAkBoE,CAChE,MAAMC,EAAcC,EAAA,EACdC,EAAUH,EAAM,IAAMC,EAEtB,CAACG,EAAQC,CAAU,EAAIC,EAAS,EAAE,EAClC,CAAE,KAAAC,EAAM,QAAAC,EAAS,WAAAC,EAAY,MAAAC,CAAA,EAAUC,EAAS,CAClD,SAAU,CAACf,EAAU,KAAMQ,CAAM,EACjC,QAAS,IAAMZ,EAASY,CAAM,CAAA,C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version":3,"file":"id-search.js","sources":["../../lib/components/id-search.tsx"],"sourcesContent":["'use client';\nimport { useQuery } from '@tanstack/react-query';\nimport { useId, useState } from 'react';\nimport { Select as AriaSelect, Autocomplete } from 'react-aria-components';\n\nimport { useCtxClient } from '../utilities/ctx-client';\nimport { Loader } from '../components/loader';\nimport { Menu, MenuItem } from '../components/menu';\nimport { PopoverTrigger } from '../components/popover';\nimport { SearchField } from '../components/searchfield';\nimport { getFieldErrorMessage } from '../utilities/form';\nimport { useFieldContext } from '../utilities/form-context';\nimport type { CtxResourceName } from '../utilities/resources';\nimport { RESOURCE_ENDPOINT_MAP } from '../utilities/resources';\nimport { FormField, type FormFieldProps } from './form';\nimport { SelectPopover, SelectTrigger } from './select';\n\n/**\n * Minimal resource shape used by the ID search inputs.\n * Only `id` and `name` are required.\n *\n * @example\n * const user: BaseSearchableResource = { id: 'u_123', name: 'Nabeel Farooq' };\n */\ntype BaseSearchableResource = {\n /** Unique identifier used as the input value. */\n id: string;\n /** Human-readable label shown to users. */\n name: string;\n};\n\n/**\n * Type guard to check if a value is an array of searchable resources\n */\nfunction isSearchableResourceArray<T extends BaseSearchableResource>(value: unknown): value is T[] {\n return (\n Array.isArray(value) && value.every(item => item && typeof item === 'object' && 'id' in item && 'name' in item)\n );\n}\n\n/**\n * - Generic, accessible ID-search building block.\n * - Search (powered by react-query)\n * - Renders an accessible Autocomplete + Menu listbox\n * - Exposes a controlled `value`/`onChange` contract so callers (and wrappers) can manage state\n * - Automatically generates search function based on resource name using RESOURCE_ENDPOINT_MAP\n *\n * @template T - resource type extending `BaseSearchableResource` (must have `id` and `name`)\n * @template V - controlled value type (e.g. `string` for single-select or `string[]` for multi-select)\n *\n * @param props - props object (see inline property JSDoc for the most important fields)\n *\n * @remarks\n * - Search is automatically handled based on the `resource` prop using the API client from context\n * - When the popover closes, `onBlur` (if provided) is called with the current `value`.\n * - `renderLabel` must convert `value` to a readable string for the control button.\n * - `defaultParams` can be used to pass additional query parameters to the search endpoint\n *\n * @example\n * <BaseIdSearchInput\n * label=\"Owner\"\n * resource=\"user\"\n * value={ownerId}\n * onChange={setOwnerId}\n * renderLabel={(v, data) => data?.find(d => d.id === v)?.name ?? v}\n * />\n *\n * @testing\n * - Ensure API client is provided via context; assert keyboard navigation, open/close behavior, and `onBlur` call on popover close.\n */\nfunction BaseIdSearchInput<T extends BaseSearchableResource, V>({\n label,\n description,\n errorMessage,\n requiredIndicator,\n isDisabled,\n isInvalid,\n onBlur,\n resource,\n onChange,\n value,\n renderLabel,\n accessor,\n defaultParams,\n className,\n ...props\n}: FormFieldProps & {\n resource: CtxResourceName;\n /** Disable interactions. */\n isDisabled?: boolean;\n /** Whether the field is invalid. */\n isInvalid?: boolean;\n /** Key used to access an alternate display accessor on item (kept for compatibility). */\n accessor: keyof BaseSearchableResource;\n /** Controlled value. */\n value: V;\n /** Called when popover closes or the field blurs with the current value. */\n onBlur?: (v: V) => void;\n /** Controlled change handler. */\n onChange: (v: V) => void;\n /** Render a human-readable label for the current value using the latest data. */\n renderLabel: (v: V, data: T[] | undefined) => string;\n /** Default parameters to include in the request. This is useful when using /v3/users?role='admin' or /v3/organizations/ID/user-groups */\n defaultParams?: Record<'path' | 'query', any>;\n /** Optional className to customize the trigger button styling. */\n className?: string;\n} & Omit<React.ComponentProps<typeof Menu>, 'items' | 'className'>) {\n if (resource === 'profile') {\n throw Error('Resource \"profile\" is not supported with IdSearch since it is not a searchable resource.');\n }\n\n const generatedId = useId();\n const fieldId = props.id || generatedId;\n const client = useCtxClient();\n\n const [search, _setSearch] = useState('');\n const { data, isError, isFetching, error } = useQuery({\n queryKey: [resource, 'id', search],\n queryFn: async (): Promise<T[]> => {\n const result = await client.GET(RESOURCE_ENDPOINT_MAP[resource], {\n params: {\n query: {\n search,\n ...defaultParams?.query,\n },\n path: {\n ...defaultParams?.path,\n },\n },\n });\n\n // Type narrowing: result.data is inferred as never due to complex union types\n // We use unknown to bypass this and then validate with our type guard\n const responseData: unknown = result.data;\n if (responseData && isSearchableResourceArray<T>(responseData)) {\n return responseData;\n }\n return [];\n },\n });\n\n return (\n <div className=\"group form-field\" data-invalid={isInvalid ? '' : undefined}>\n <FormField {...{ label, description, errorMessage, requiredIndicator, htmlFor: fieldId }}>\n <AriaSelect isInvalid={isInvalid}>\n <PopoverTrigger\n onOpenChange={o => {\n if (!o) {\n // searchInputRef.current?.focus();\n onBlur?.(value);\n }\n }}\n >\n <SelectTrigger id={fieldId} isDisabled={isDisabled} className={className ?? 'w-full'}>\n {renderLabel(value, data)}\n </SelectTrigger>\n <SelectPopover placement=\"bottom start\">\n <Autocomplete inputValue={search} onInputChange={_setSearch}>\n <SearchField className={'p-2'} autoFocus />\n {isFetching && (\n <div className=\"p-input\">\n <Loader className=\"mx-auto\" />\n </div>\n )}\n {!isFetching && !isError && (\n <Menu\n {...props}\n className={'max-h-48'}\n items={data}\n renderEmptyState={() => <div className=\"body-sm p-2\">No results found.</div>}\n >\n {item => (\n <MenuItem key={item[accessor]} id={item[accessor]}>\n {item.name}\n </MenuItem>\n )}\n </Menu>\n )}\n {isError && <div className=\"text-destructive p-icon body-sm\">{error.message}</div>}\n </Autocomplete>\n </SelectPopover>\n </PopoverTrigger>\n </AriaSelect>\n </FormField>\n </div>\n );\n}\n\n/**\n * Single-selection ID search input.\n *\n * Thin, typed wrapper around `BaseIdSearchInput` specialized for the very common single-ID case.\n * Adapts the internal selection events into `onChange(id?: string)` and renders the selected label.\n *\n * @template T - resource type (extends BaseSearchableResource)\n *\n * @param props - Inherits `BaseIdSearchInput` props but uses `string[]` value type.\n *\n * @example\n * <SingleIdSearchInput\n * label=\"Reporter\"\n * value={reporterId}\n * onChange={setReporterId}\n * />\n *\n */\nexport function SingleIdSearchInput<T extends BaseSearchableResource>({\n ...props\n}: Omit<\n React.ComponentProps<typeof BaseIdSearchInput<T, string>>,\n 'onSelectionChange' | 'selectionMode' | 'selectedKeys' | 'renderLabel'\n>) {\n return (\n <BaseIdSearchInput\n selectedKeys={[props.value]}\n onSelectionChange={e => props.onChange(Array.from(e).filter(v => typeof v === 'string')[0])}\n renderLabel={(v, d) => d?.find(di => di.id === v)?.name ?? v}\n selectionMode=\"single\"\n {...props}\n />\n );\n}\n\n/**\n * Multi-selection ID search input.\n *\n * Thin wrapper around `BaseIdSearchInput` for the multiple-ID (`string[]`) case.\n * Adapts internal selection events into `onChange(ids: string[])`.\n *\n * @template T - resource type (extends BaseSearchableResource)\n *\n * @param props - Inherits `BaseIdSearchInput` props but uses `string[]` value type.\n *\n * @example\n * <MultipleIdSearchInput\n * label=\"Reviewers\"\n * value={reviewerIds}\n * onChange={setReviewerIds}\n * />\n *\n * @remarks\n * - The `renderLabel` joins selected item names with commas for compact display.\n */\nexport function MultipleIdSearchInput<T extends BaseSearchableResource>({\n ...props\n}: Omit<\n React.ComponentProps<typeof BaseIdSearchInput<T, string[]>>,\n 'renderLabel' | 'onSelectionChange' | 'selectionMode' | 'selectedKeys'\n>) {\n return (\n <BaseIdSearchInput\n selectedKeys={props.value}\n onSelectionChange={e => props.onChange(Array.from(e).filter(v => typeof v === 'string'))}\n selectionMode=\"multiple\"\n renderLabel={(v, d) => v?.map(vi => d?.find(di => di.id === vi)?.name ?? vi).join(',')}\n {...props}\n />\n );\n}\n\n/**\n * Form-integrated single-select ID input (field wrapper).\n *\n * Integrates `SingleIdSearchInput` into the form system using `useFieldContext`.\n * - wires `value`, `onChange`, and `onBlur`\n * - disables the control while the form is submitting\n * - surfaces field-level error messages\n *\n * @example\n * <TfSingleIdSearchInput name=\"ownerId\" label=\"Owner\" />\n \n */\nexport function TfSingleIdSearchInput({\n isDisabled,\n ...props\n}: Omit<React.ComponentProps<typeof SingleIdSearchInput>, 'value' | 'onChange' | 'onBlur'>) {\n const field = useFieldContext<string>({ disabled: isDisabled });\n return (\n <SingleIdSearchInput\n {...props}\n isDisabled={isDisabled || field.form.state.isSubmitting}\n value={field.state.value}\n onBlur={_ => field.handleBlur()}\n onChange={e => field.handleChange(e)}\n isInvalid={!!getFieldErrorMessage(field)}\n errorMessage={getFieldErrorMessage(field)}\n />\n );\n}\n\n/**\n * Form-integrated multi-select ID input (field wrapper).\n *\n * Integrates `MultipleIdSearchInput` into the form system using `useFieldContext`.\n * - wires `value`, `onChange`, and `onBlur`\n * - disables the control while the form is submitting\n * - surfaces field-level error messages\n *\n * @example\n * <TfMultipleIdSearchInput name=\"reviewerIds\" label=\"Reviewers\" />\n *\n */\nexport function TfMultipleIdSearchInput({\n isDisabled,\n ...props\n}: Omit<React.ComponentProps<typeof MultipleIdSearchInput>, 'value' | 'onChange'>) {\n const field = useFieldContext<string[]>({ disabled: isDisabled });\n return (\n <MultipleIdSearchInput\n {...props}\n isDisabled={isDisabled || field.form.state.isSubmitting}\n value={field.state.value}\n onBlur={_ => field.handleBlur()}\n onChange={e => field.handleChange(e)}\n isInvalid={!!getFieldErrorMessage(field)}\n errorMessage={getFieldErrorMessage(field)}\n />\n );\n}\n"],"names":["isSearchableResourceArray","value","item","BaseIdSearchInput","label","description","errorMessage","requiredIndicator","isDisabled","isInvalid","onBlur","resource","onChange","renderLabel","accessor","defaultParams","className","props","generatedId","useId","fieldId","client","useCtxClient","search","_setSearch","useState","data","isError","isFetching","error","useQuery","responseData","RESOURCE_ENDPOINT_MAP","jsx","FormField","AriaSelect","jsxs","PopoverTrigger","SelectTrigger","SelectPopover","Autocomplete","SearchField","Loader","Menu","MenuItem","SingleIdSearchInput","e","v","d","di","MultipleIdSearchInput","vi","TfSingleIdSearchInput","field","useFieldContext","_","getFieldErrorMessage","TfMultipleIdSearchInput"],"mappings":"i8BAkCA,SAASA,EAA4DC,EAA8B,CAC/F,OACI,MAAM,QAAQA,CAAK,GAAKA,EAAM,MAAMC,GAAQA,GAAQ,OAAOA,GAAS,UAAY,OAAQA,GAAQ,SAAUA,CAAI,CAEtH,CAgCA,SAASC,EAAuD,CAC5D,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,UAAAC,EACA,OAAAC,EACA,SAAA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EAA4F,CACxF,MAAMoC,EAAQC,EAAwB,CAAE,SAAU9C,EAAY,EAC9D,OACIyB,EAACY,EAAA,CACI,GAAG5B,EACJ,WAAYT,GAAc6C,EAAM,KAAK,MAAM,aAC3C,MAAOA,EAAM,MAAM,MACnB,OAAQE,GAAKF,EAAM,WAAA,EACnB,SAAUP,GAAKO,EAAM,aAAaP,CAAC,EACnC,UAAW,CAAC,CAACU,EAAqBH,CAAK,EACvC,aAAcG,EAAqBH,CAAK,CAAA,CAAA,CAGpD,CAcO,SAASI,GAAwB,CACpC,WAAAjD,EACA,GAAGS,CACP,EAAmF,CAC/E,MAAMoC,EAAQC,EAA0B,CAAE,SAAU9C,EAAY,EAChE,OACIyB,EAACiB,EAAA,CACI,GAAGjC,EACJ,WAAYT,GAAc6C,EAAM,KAAK,MAAM,aAC3C,MAAOA,EAAM,MAAM,MACnB,OAAQE,GAAKF,EAAM,WAAA,EACnB,SAAUP,GAAKO,EAAM,aAAaP,CAAC,EACnC,UAAW,CAAC,CAACU,EAAqBH,CAAK,EACvC,aAAcG,EAAqBH,CAAK,CAAA,CAAA,CAGpD"}
@@ -5,5 +5,13 @@ export type SelectOption = {
5
5
  };
6
6
  export declare const LICENSE_TYPE_OPTIONS: SelectOption[];
7
7
  export declare const SUBSCRIPTION_START_TRIGGER_OPTIONS: SelectOption[];
8
+ /**
9
+ * Creates Unicode flag from a two-letter ISO country code.
10
+ * https://stackoverflow.com/questions/24050671/how-to-put-japan-flag-character-in-a-string
11
+ * @param {string} country — A two-letter ISO country code (case-insensitive).
12
+ * @return {string}
13
+ */
14
+ export declare function getCountryFlag(country: string): string;
15
+ export declare function getCountryName(country: string): string;
8
16
  /** Options for MultiSelect component */
9
17
  export declare const COUNTRY_OPTIONS: SelectOption[];
@@ -1,2 +1,2 @@
1
- import{jsxs as n,Fragment as i,jsx as e}from"react/jsx-runtime";import{IcNodeLocked as t,IcHostedFloating as l,IcLexFloatServer as s}from"./icons.js";import"react";const I=[{label:n(i,{children:["Node-locked",e(t,{})]}),id:"node-locked"},{label:n(i,{children:["Hosted floating",e(l,{})]}),id:"hosted-floating"},{label:n(i,{children:["LexFloatServer",e(s,{})]}),id:"on-premise-floating"}],C=[{label:"License Creation",id:"creation"},{label:"License Activation",id:"activation"}];function d(a){function r(o){return String.fromCodePoint(127397+o.toUpperCase().charCodeAt(0))}return r(a[0])+r(a[1])}const u={AF:"Afghanistan",AX:"Åland Islands",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua and Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia (Plurinational State of)",BQ:"Bonaire, Sint Eustatius and Saba",BA:"Bosnia and Herzegovina",BW:"Botswana",BV:"Bouvet Island",BR:"Brazil",IO:"British Indian Ocean Territory",BN:"Brunei Darussalam",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",CV:"Caboe Verde",KH:"Cambodia",CM:"Cameroon",CA:"Canada",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos (Keeling) Islands",CO:"Colombia",KM:"Comoros",CG:"Congo",CD:"Congo, Democratic Republic of the",CK:"Cook Islands",CR:"Costa Rica",CI:"Côte d'voire",HR:"Croatia",CU:"Cuba",CW:"Curaçao",CY:"Cyprus",CZ:"Czechia",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",SZ:"Eswatini",ET:"Ethiopia",FK:"Falkland Islands (Malvinas)",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",GF:"French Guiana",PF:"French Polynesia",TF:"French Southern Territories",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HM:"Heard Island and Mcdonald Islands",VA:"Holy See",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran (Islamic Republic of)",IQ:"Iraq",IE:"Ireland",IM:"Isle of Man",IL:"Israel",IT:"Italy",JM:"Jamaica",JP:"Japan",JE:"Jersey",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",KP:"Korea (Democratic People's Republic of)",KR:"Korea (Republic of)",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Lao People's Democratic Republic",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macao",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MQ:"Martinique",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia (Federated States of)",MD:"Moldova, Republic of",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands, Kingdom of the",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NF:"Norfolk Island",MK:"North Macedonia",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestine, State of",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russian Federation",RW:"Rwanda",BL:"Saint Barthélemy",SH:"Saint Helena, Ascension Island, Tristan da Cunha",KN:"Saint Kitts and Nevis",LC:"Saint Lucia",MF:"Saint Martin (French part)",PM:"Saint Pierre and Miquelon",VC:"Saint Vincent and the Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome and Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SX:"Sint Maarten (Dutch part)",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",GS:"South Georgia and the South Sandwich Islands",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard and Jan Mayen",SE:"Sweden",CH:"Switzerland",SY:"Syrian Arab Republic",TW:"Taiwan, Province of China",TJ:"Tajikistan",TZ:"Tanzania, United Republic of",TH:"Thailand",TL:"Timor-Leste",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad and Tobago",TN:"Tunisia",TR:"Türkiye",TM:"Turkmenistan",TC:"Turks and Caicos Islands",TV:"Tuvalu",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom of Great Britain and Northern Ireland",UM:"United States Minor Outlying Islands",US:"United States of America",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VE:"Venezuela (Bolivarian Republic of)",VN:"Viet Nam",VG:"Virgin Islands (British)",VI:"Virgin Islands (U.S)",WF:"Wallis and Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"},m=Object.entries(u).map(a=>({label:n(i,{children:[d(a[0])," ",a[1]]}),id:a[0]}));export{m as COUNTRY_OPTIONS,I as LICENSE_TYPE_OPTIONS,C as SUBSCRIPTION_START_TRIGGER_OPTIONS};
1
+ import{jsxs as n,Fragment as i,jsx as e}from"react/jsx-runtime";import{IcNodeLocked as l,IcHostedFloating as s,IcLexFloatServer as d}from"./icons.js";import"react";const C=[{label:n(i,{children:["Node-locked",e(l,{})]}),id:"node-locked"},{label:n(i,{children:["Hosted floating",e(s,{})]}),id:"hosted-floating"},{label:n(i,{children:["LexFloatServer",e(d,{})]}),id:"on-premise-floating"}],I=[{label:"License Creation",id:"creation"},{label:"License Activation",id:"activation"}];function u(a){function r(t){return String.fromCodePoint(127397+t.toUpperCase().charCodeAt(0))}return r(a[0])+r(a[1])}const o={AF:"Afghanistan",AX:"Åland Islands",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua and Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia (Plurinational State of)",BQ:"Bonaire, Sint Eustatius and Saba",BA:"Bosnia and Herzegovina",BW:"Botswana",BV:"Bouvet Island",BR:"Brazil",IO:"British Indian Ocean Territory",BN:"Brunei Darussalam",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",CV:"Caboe Verde",KH:"Cambodia",CM:"Cameroon",CA:"Canada",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos (Keeling) Islands",CO:"Colombia",KM:"Comoros",CG:"Congo",CD:"Congo, Democratic Republic of the",CK:"Cook Islands",CR:"Costa Rica",CI:"Côte d'voire",HR:"Croatia",CU:"Cuba",CW:"Curaçao",CY:"Cyprus",CZ:"Czechia",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",SZ:"Eswatini",ET:"Ethiopia",FK:"Falkland Islands (Malvinas)",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",GF:"French Guiana",PF:"French Polynesia",TF:"French Southern Territories",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HM:"Heard Island and Mcdonald Islands",VA:"Holy See",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran (Islamic Republic of)",IQ:"Iraq",IE:"Ireland",IM:"Isle of Man",IL:"Israel",IT:"Italy",JM:"Jamaica",JP:"Japan",JE:"Jersey",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",KP:"Korea (Democratic People's Republic of)",KR:"Korea (Republic of)",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Lao People's Democratic Republic",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macao",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MQ:"Martinique",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia (Federated States of)",MD:"Moldova, Republic of",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands, Kingdom of the",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NF:"Norfolk Island",MK:"North Macedonia",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestine, State of",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russian Federation",RW:"Rwanda",BL:"Saint Barthélemy",SH:"Saint Helena, Ascension Island, Tristan da Cunha",KN:"Saint Kitts and Nevis",LC:"Saint Lucia",MF:"Saint Martin (French part)",PM:"Saint Pierre and Miquelon",VC:"Saint Vincent and the Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome and Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SX:"Sint Maarten (Dutch part)",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",GS:"South Georgia and the South Sandwich Islands",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard and Jan Mayen",SE:"Sweden",CH:"Switzerland",SY:"Syrian Arab Republic",TW:"Taiwan, Province of China",TJ:"Tajikistan",TZ:"Tanzania, United Republic of",TH:"Thailand",TL:"Timor-Leste",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad and Tobago",TN:"Tunisia",TR:"Türkiye",TM:"Turkmenistan",TC:"Turks and Caicos Islands",TV:"Tuvalu",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom of Great Britain and Northern Ireland",UM:"United States Minor Outlying Islands",US:"United States of America",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VE:"Venezuela (Bolivarian Republic of)",VN:"Viet Nam",VG:"Virgin Islands (British)",VI:"Virgin Islands (U.S)",WF:"Wallis and Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"};function m(a){return o[a]}const T=Object.entries(o).map(a=>({label:n(i,{children:[u(a[0])," ",a[1]]}),id:a[0]}));export{T as COUNTRY_OPTIONS,C as LICENSE_TYPE_OPTIONS,I as SUBSCRIPTION_START_TRIGGER_OPTIONS,u as getCountryFlag,m as getCountryName};
2
2
  //# sourceMappingURL=select-options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-options.js","sources":["../../lib/components/select-options.tsx"],"sourcesContent":["import { IcHostedFloating, IcLexFloatServer, IcNodeLocked } from './icons';\n\nexport type SelectOption = {\n id: string;\n label: React.ReactNode;\n disabled?: boolean;\n};\n\n// TODO, use icons\nexport const LICENSE_TYPE_OPTIONS: SelectOption[] = [\n {\n label: (\n <>\n Node-locked\n <IcNodeLocked />\n </>\n ),\n id: 'node-locked',\n },\n {\n label: (\n <>\n Hosted floating\n <IcHostedFloating />\n </>\n ),\n id: 'hosted-floating',\n },\n {\n label: (\n <>\n LexFloatServer\n <IcLexFloatServer />\n </>\n ),\n id: 'on-premise-floating',\n },\n];\n\nexport const SUBSCRIPTION_START_TRIGGER_OPTIONS: SelectOption[] = [\n {\n label: 'License Creation',\n id: 'creation',\n },\n {\n label: 'License Activation',\n id: 'activation',\n },\n];\n\n/**\n * Creates Unicode flag from a two-letter ISO country code.\n * https://stackoverflow.com/questions/24050671/how-to-put-japan-flag-character-in-a-string\n * @param {string} country — A two-letter ISO country code (case-insensitive).\n * @return {string}\n */\nfunction getCountryFlag(country: string) {\n function getRegionalIndicatorSymbol(letter: string) {\n return String.fromCodePoint(0x1f1e6 - 65 + letter.toUpperCase().charCodeAt(0));\n }\n\n return getRegionalIndicatorSymbol(country[0]) + getRegionalIndicatorSymbol(country[1]);\n}\n\nconst ALL_COUNTRIES: { [key: string]: string } = {\n AF: 'Afghanistan',\n AX: 'Åland Islands',\n AL: 'Albania',\n DZ: 'Algeria',\n AS: 'American Samoa',\n AD: 'Andorra',\n AO: 'Angola',\n AI: 'Anguilla',\n AQ: 'Antarctica',\n AG: 'Antigua and Barbuda',\n AR: 'Argentina',\n AM: 'Armenia',\n AW: 'Aruba',\n AU: 'Australia',\n AT: 'Austria',\n AZ: 'Azerbaijan',\n BS: 'Bahamas',\n BH: 'Bahrain',\n BD: 'Bangladesh',\n BB: 'Barbados',\n BY: 'Belarus',\n BE: 'Belgium',\n BZ: 'Belize',\n BJ: 'Benin',\n BM: 'Bermuda',\n BT: 'Bhutan',\n BO: 'Bolivia (Plurinational State of)',\n BQ: 'Bonaire, Sint Eustatius and Saba',\n BA: 'Bosnia and Herzegovina',\n BW: 'Botswana',\n BV: 'Bouvet Island',\n BR: 'Brazil',\n IO: 'British Indian Ocean Territory',\n BN: 'Brunei Darussalam',\n BG: 'Bulgaria',\n BF: 'Burkina Faso',\n BI: 'Burundi',\n CV: 'Caboe Verde',\n KH: 'Cambodia',\n CM: 'Cameroon',\n CA: 'Canada',\n KY: 'Cayman Islands',\n CF: 'Central African Republic',\n TD: 'Chad',\n CL: 'Chile',\n CN: 'China',\n CX: 'Christmas Island',\n CC: 'Cocos (Keeling) Islands',\n CO: 'Colombia',\n KM: 'Comoros',\n CG: 'Congo',\n CD: 'Congo, Democratic Republic of the',\n CK: 'Cook Islands',\n CR: 'Costa Rica',\n CI: \"Côte d'voire\",\n HR: 'Croatia',\n CU: 'Cuba',\n CW: 'Curaçao',\n CY: 'Cyprus',\n CZ: 'Czechia',\n DK: 'Denmark',\n DJ: 'Djibouti',\n DM: 'Dominica',\n DO: 'Dominican Republic',\n EC: 'Ecuador',\n EG: 'Egypt',\n SV: 'El Salvador',\n GQ: 'Equatorial Guinea',\n ER: 'Eritrea',\n EE: 'Estonia',\n SZ: 'Eswatini',\n ET: 'Ethiopia',\n FK: 'Falkland Islands (Malvinas)',\n FO: 'Faroe Islands',\n FJ: 'Fiji',\n FI: 'Finland',\n FR: 'France',\n GF: 'French Guiana',\n PF: 'French Polynesia',\n TF: 'French Southern Territories',\n GA: 'Gabon',\n GM: 'Gambia',\n GE: 'Georgia',\n DE: 'Germany',\n GH: 'Ghana',\n GI: 'Gibraltar',\n GR: 'Greece',\n GL: 'Greenland',\n GD: 'Grenada',\n GP: 'Guadeloupe',\n GU: 'Guam',\n GT: 'Guatemala',\n GG: 'Guernsey',\n GN: 'Guinea',\n GW: 'Guinea-Bissau',\n GY: 'Guyana',\n HT: 'Haiti',\n HM: 'Heard Island and Mcdonald Islands',\n VA: 'Holy See',\n HN: 'Honduras',\n HK: 'Hong Kong',\n HU: 'Hungary',\n IS: 'Iceland',\n IN: 'India',\n ID: 'Indonesia',\n IR: 'Iran (Islamic Republic of)',\n IQ: 'Iraq',\n IE: 'Ireland',\n IM: 'Isle of Man',\n IL: 'Israel',\n IT: 'Italy',\n JM: 'Jamaica',\n JP: 'Japan',\n JE: 'Jersey',\n JO: 'Jordan',\n KZ: 'Kazakhstan',\n KE: 'Kenya',\n KI: 'Kiribati',\n KP: \"Korea (Democratic People's Republic of)\",\n KR: 'Korea (Republic of)',\n KW: 'Kuwait',\n KG: 'Kyrgyzstan',\n LA: \"Lao People's Democratic Republic\",\n LV: 'Latvia',\n LB: 'Lebanon',\n LS: 'Lesotho',\n LR: 'Liberia',\n LY: 'Libya',\n LI: 'Liechtenstein',\n LT: 'Lithuania',\n LU: 'Luxembourg',\n MO: 'Macao',\n MG: 'Madagascar',\n MW: 'Malawi',\n MY: 'Malaysia',\n MV: 'Maldives',\n ML: 'Mali',\n MT: 'Malta',\n MH: 'Marshall Islands',\n MQ: 'Martinique',\n MR: 'Mauritania',\n MU: 'Mauritius',\n YT: 'Mayotte',\n MX: 'Mexico',\n FM: 'Micronesia (Federated States of)',\n MD: 'Moldova, Republic of',\n MC: 'Monaco',\n MN: 'Mongolia',\n ME: 'Montenegro',\n MS: 'Montserrat',\n MA: 'Morocco',\n MZ: 'Mozambique',\n MM: 'Myanmar',\n NA: 'Namibia',\n NR: 'Nauru',\n NP: 'Nepal',\n NL: 'Netherlands, Kingdom of the',\n NC: 'New Caledonia',\n NZ: 'New Zealand',\n NI: 'Nicaragua',\n NE: 'Niger',\n NG: 'Nigeria',\n NU: 'Niue',\n NF: 'Norfolk Island',\n MK: 'North Macedonia',\n MP: 'Northern Mariana Islands',\n NO: 'Norway',\n OM: 'Oman',\n PK: 'Pakistan',\n PW: 'Palau',\n PS: 'Palestine, State of',\n PA: 'Panama',\n PG: 'Papua New Guinea',\n PY: 'Paraguay',\n PE: 'Peru',\n PH: 'Philippines',\n PN: 'Pitcairn',\n PL: 'Poland',\n PT: 'Portugal',\n PR: 'Puerto Rico',\n QA: 'Qatar',\n RE: 'Réunion',\n RO: 'Romania',\n RU: 'Russian Federation',\n RW: 'Rwanda',\n BL: 'Saint Barthélemy',\n SH: 'Saint Helena, Ascension Island, Tristan da Cunha',\n KN: 'Saint Kitts and Nevis',\n LC: 'Saint Lucia',\n MF: 'Saint Martin (French part)',\n PM: 'Saint Pierre and Miquelon',\n VC: 'Saint Vincent and the Grenadines',\n WS: 'Samoa',\n SM: 'San Marino',\n ST: 'Sao Tome and Principe',\n SA: 'Saudi Arabia',\n SN: 'Senegal',\n RS: 'Serbia',\n SC: 'Seychelles',\n SL: 'Sierra Leone',\n SG: 'Singapore',\n SX: 'Sint Maarten (Dutch part)',\n SK: 'Slovakia',\n SI: 'Slovenia',\n SB: 'Solomon Islands',\n SO: 'Somalia',\n ZA: 'South Africa',\n GS: 'South Georgia and the South Sandwich Islands',\n SS: 'South Sudan',\n ES: 'Spain',\n LK: 'Sri Lanka',\n SD: 'Sudan',\n SR: 'Suriname',\n SJ: 'Svalbard and Jan Mayen',\n SE: 'Sweden',\n CH: 'Switzerland',\n SY: 'Syrian Arab Republic',\n TW: 'Taiwan, Province of China',\n TJ: 'Tajikistan',\n TZ: 'Tanzania, United Republic of',\n TH: 'Thailand',\n TL: 'Timor-Leste',\n TG: 'Togo',\n TK: 'Tokelau',\n TO: 'Tonga',\n TT: 'Trinidad and Tobago',\n TN: 'Tunisia',\n TR: 'Türkiye',\n TM: 'Turkmenistan',\n TC: 'Turks and Caicos Islands',\n TV: 'Tuvalu',\n UG: 'Uganda',\n UA: 'Ukraine',\n AE: 'United Arab Emirates',\n GB: 'United Kingdom of Great Britain and Northern Ireland',\n UM: 'United States Minor Outlying Islands',\n US: 'United States of America',\n UY: 'Uruguay',\n UZ: 'Uzbekistan',\n VU: 'Vanuatu',\n VE: 'Venezuela (Bolivarian Republic of)',\n VN: 'Viet Nam',\n VG: 'Virgin Islands (British)',\n VI: 'Virgin Islands (U.S)',\n WF: 'Wallis and Futuna',\n EH: 'Western Sahara',\n YE: 'Yemen',\n ZM: 'Zambia',\n ZW: 'Zimbabwe',\n};\n\n/** Options for MultiSelect component */\nexport const COUNTRY_OPTIONS: SelectOption[] = Object.entries(ALL_COUNTRIES).map(v => {\n return {\n label: (\n <>\n {getCountryFlag(v[0])} {v[1]}\n </>\n ),\n id: v[0],\n };\n});\n"],"names":["LICENSE_TYPE_OPTIONS","jsxs","Fragment","IcNodeLocked","IcHostedFloating","IcLexFloatServer","SUBSCRIPTION_START_TRIGGER_OPTIONS","getCountryFlag","country","getRegionalIndicatorSymbol","letter","ALL_COUNTRIES","COUNTRY_OPTIONS","v"],"mappings":"oKASO,MAAMA,EAAuC,CAChD,CACI,MACIC,EAAAC,EAAA,CAAE,SAAA,CAAA,gBAEGC,EAAA,CAAA,CAAa,CAAA,EAClB,EAEJ,GAAI,aAAA,EAER,CACI,MACIF,EAAAC,EAAA,CAAE,SAAA,CAAA,oBAEGE,EAAA,CAAA,CAAiB,CAAA,EACtB,EAEJ,GAAI,iBAAA,EAER,CACI,MACIH,EAAAC,EAAA,CAAE,SAAA,CAAA,mBAEGG,EAAA,CAAA,CAAiB,CAAA,EACtB,EAEJ,GAAI,qBAAA,CAEZ,EAEaC,EAAqD,CAC9D,CACI,MAAO,mBACP,GAAI,UAAA,EAER,CACI,MAAO,qBACP,GAAI,YAAA,CAEZ,EAQA,SAASC,EAAeC,EAAiB,CACrC,SAASC,EAA2BC,EAAgB,CAChD,OAAO,OAAO,cAAc,OAAeA,EAAO,YAAA,EAAc,WA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ACJ,GAAI,4BACJ,GAAI,mCACJ,GAAI,QACJ,GAAI,aACJ,GAAI,wBACJ,GAAI,eACJ,GAAI,UACJ,GAAI,SACJ,GAAI,aACJ,GAAI,eACJ,GAAI,YACJ,GAAI,4BACJ,GAAI,WACJ,GAAI,WACJ,GAAI,kBACJ,GAAI,UACJ,GAAI,eACJ,GAAI,+CACJ,GAAI,cACJ,GAAI,QACJ,GAAI,YACJ,GAAI,QACJ,GAAI,WACJ,GAAI,yBACJ,GAAI,SACJ,GAAI,cACJ,GAAI,uBACJ,GAAI,4BACJ,GAAI,aACJ,GAAI,+BACJ,GAAI,WACJ,GAAI,cACJ,GAAI,OACJ,GAAI,UACJ,GAAI,QACJ,GAAI,sBACJ,GAAI,UACJ,GAAI,UACJ,GAAI,eACJ,GAAI,2BACJ,GAAI,SACJ,GAAI,SACJ,GAAI,UACJ,GAAI,uBACJ,GAAI,uDACJ,GAAI,uCACJ,GAAI,2BACJ,GAAI,UACJ,GAAI,aACJ,GAAI,UACJ,GAAI,qCACJ,GAAI,WACJ,GAAI,2BACJ,GAAI,uBACJ,GAAI,oBACJ,GAAI,iBACJ,GAAI,QACJ,GAAI,SACJ,GAAI,UACR,EAGaC,EAAkC,OAAO,QAAQD,CAAa,EAAE,IAAIE,IACtE,CACH,MACIZ,EAAAC,EAAA,CACK,SAAA,CAAAK,EAAeM,EAAE,CAAC,CAAC,EAAE,IAAEA,EAAE,CAAC,CAAA,EAC/B,EAEJ,GAAIA,EAAE,CAAC,CAAA,EAEd"}
1
+ {"version":3,"file":"select-options.js","sources":["../../lib/components/select-options.tsx"],"sourcesContent":["import { IcHostedFloating, IcLexFloatServer, IcNodeLocked } from './icons';\n\nexport type SelectOption = {\n id: string;\n label: React.ReactNode;\n disabled?: boolean;\n};\n\n// TODO, use icons\nexport const LICENSE_TYPE_OPTIONS: SelectOption[] = [\n {\n label: (\n <>\n Node-locked\n <IcNodeLocked />\n </>\n ),\n id: 'node-locked',\n },\n {\n label: (\n <>\n Hosted floating\n <IcHostedFloating />\n </>\n ),\n id: 'hosted-floating',\n },\n {\n label: (\n <>\n LexFloatServer\n <IcLexFloatServer />\n </>\n ),\n id: 'on-premise-floating',\n },\n];\n\nexport const SUBSCRIPTION_START_TRIGGER_OPTIONS: SelectOption[] = [\n {\n label: 'License Creation',\n id: 'creation',\n },\n {\n label: 'License Activation',\n id: 'activation',\n },\n];\n\n/**\n * Creates Unicode flag from a two-letter ISO country code.\n * https://stackoverflow.com/questions/24050671/how-to-put-japan-flag-character-in-a-string\n * @param {string} country — A two-letter ISO country code (case-insensitive).\n * @return {string}\n */\nexport function getCountryFlag(country: string) {\n function getRegionalIndicatorSymbol(letter: string) {\n return String.fromCodePoint(0x1f1e6 - 65 + letter.toUpperCase().charCodeAt(0));\n }\n\n return getRegionalIndicatorSymbol(country[0]) + getRegionalIndicatorSymbol(country[1]);\n}\n\nconst ALL_COUNTRIES: { [key: string]: string } = {\n AF: 'Afghanistan',\n AX: 'Åland Islands',\n AL: 'Albania',\n DZ: 'Algeria',\n AS: 'American Samoa',\n AD: 'Andorra',\n AO: 'Angola',\n AI: 'Anguilla',\n AQ: 'Antarctica',\n AG: 'Antigua and Barbuda',\n AR: 'Argentina',\n AM: 'Armenia',\n AW: 'Aruba',\n AU: 'Australia',\n AT: 'Austria',\n AZ: 'Azerbaijan',\n BS: 'Bahamas',\n BH: 'Bahrain',\n BD: 'Bangladesh',\n BB: 'Barbados',\n BY: 'Belarus',\n BE: 'Belgium',\n BZ: 'Belize',\n BJ: 'Benin',\n BM: 'Bermuda',\n BT: 'Bhutan',\n BO: 'Bolivia (Plurinational State of)',\n BQ: 'Bonaire, Sint Eustatius and Saba',\n BA: 'Bosnia and Herzegovina',\n BW: 'Botswana',\n BV: 'Bouvet Island',\n BR: 'Brazil',\n IO: 'British Indian Ocean Territory',\n BN: 'Brunei Darussalam',\n BG: 'Bulgaria',\n BF: 'Burkina Faso',\n BI: 'Burundi',\n CV: 'Caboe Verde',\n KH: 'Cambodia',\n CM: 'Cameroon',\n CA: 'Canada',\n KY: 'Cayman Islands',\n CF: 'Central African Republic',\n TD: 'Chad',\n CL: 'Chile',\n CN: 'China',\n CX: 'Christmas Island',\n CC: 'Cocos (Keeling) Islands',\n CO: 'Colombia',\n KM: 'Comoros',\n CG: 'Congo',\n CD: 'Congo, Democratic Republic of the',\n CK: 'Cook Islands',\n CR: 'Costa Rica',\n CI: \"Côte d'voire\",\n HR: 'Croatia',\n CU: 'Cuba',\n CW: 'Curaçao',\n CY: 'Cyprus',\n CZ: 'Czechia',\n DK: 'Denmark',\n DJ: 'Djibouti',\n DM: 'Dominica',\n DO: 'Dominican Republic',\n EC: 'Ecuador',\n EG: 'Egypt',\n SV: 'El Salvador',\n GQ: 'Equatorial Guinea',\n ER: 'Eritrea',\n EE: 'Estonia',\n SZ: 'Eswatini',\n ET: 'Ethiopia',\n FK: 'Falkland Islands (Malvinas)',\n FO: 'Faroe Islands',\n FJ: 'Fiji',\n FI: 'Finland',\n FR: 'France',\n GF: 'French Guiana',\n PF: 'French Polynesia',\n TF: 'French Southern Territories',\n GA: 'Gabon',\n GM: 'Gambia',\n GE: 'Georgia',\n DE: 'Germany',\n GH: 'Ghana',\n GI: 'Gibraltar',\n GR: 'Greece',\n GL: 'Greenland',\n GD: 'Grenada',\n GP: 'Guadeloupe',\n GU: 'Guam',\n GT: 'Guatemala',\n GG: 'Guernsey',\n GN: 'Guinea',\n GW: 'Guinea-Bissau',\n GY: 'Guyana',\n HT: 'Haiti',\n HM: 'Heard Island and Mcdonald Islands',\n VA: 'Holy See',\n HN: 'Honduras',\n HK: 'Hong Kong',\n HU: 'Hungary',\n IS: 'Iceland',\n IN: 'India',\n ID: 'Indonesia',\n IR: 'Iran (Islamic Republic of)',\n IQ: 'Iraq',\n IE: 'Ireland',\n IM: 'Isle of Man',\n IL: 'Israel',\n IT: 'Italy',\n JM: 'Jamaica',\n JP: 'Japan',\n JE: 'Jersey',\n JO: 'Jordan',\n KZ: 'Kazakhstan',\n KE: 'Kenya',\n KI: 'Kiribati',\n KP: \"Korea (Democratic People's Republic of)\",\n KR: 'Korea (Republic of)',\n KW: 'Kuwait',\n KG: 'Kyrgyzstan',\n LA: \"Lao People's Democratic Republic\",\n LV: 'Latvia',\n LB: 'Lebanon',\n LS: 'Lesotho',\n LR: 'Liberia',\n LY: 'Libya',\n LI: 'Liechtenstein',\n LT: 'Lithuania',\n LU: 'Luxembourg',\n MO: 'Macao',\n MG: 'Madagascar',\n MW: 'Malawi',\n MY: 'Malaysia',\n MV: 'Maldives',\n ML: 'Mali',\n MT: 'Malta',\n MH: 'Marshall Islands',\n MQ: 'Martinique',\n MR: 'Mauritania',\n MU: 'Mauritius',\n YT: 'Mayotte',\n MX: 'Mexico',\n FM: 'Micronesia (Federated States of)',\n MD: 'Moldova, Republic of',\n MC: 'Monaco',\n MN: 'Mongolia',\n ME: 'Montenegro',\n MS: 'Montserrat',\n MA: 'Morocco',\n MZ: 'Mozambique',\n MM: 'Myanmar',\n NA: 'Namibia',\n NR: 'Nauru',\n NP: 'Nepal',\n NL: 'Netherlands, Kingdom of the',\n NC: 'New Caledonia',\n NZ: 'New Zealand',\n NI: 'Nicaragua',\n NE: 'Niger',\n NG: 'Nigeria',\n NU: 'Niue',\n NF: 'Norfolk Island',\n MK: 'North Macedonia',\n MP: 'Northern Mariana Islands',\n NO: 'Norway',\n OM: 'Oman',\n PK: 'Pakistan',\n PW: 'Palau',\n PS: 'Palestine, State of',\n PA: 'Panama',\n PG: 'Papua New Guinea',\n PY: 'Paraguay',\n PE: 'Peru',\n PH: 'Philippines',\n PN: 'Pitcairn',\n PL: 'Poland',\n PT: 'Portugal',\n PR: 'Puerto Rico',\n QA: 'Qatar',\n RE: 'Réunion',\n RO: 'Romania',\n RU: 'Russian Federation',\n RW: 'Rwanda',\n BL: 'Saint Barthélemy',\n SH: 'Saint Helena, Ascension Island, Tristan da Cunha',\n KN: 'Saint Kitts and Nevis',\n LC: 'Saint Lucia',\n MF: 'Saint Martin (French part)',\n PM: 'Saint Pierre and Miquelon',\n VC: 'Saint Vincent and the Grenadines',\n WS: 'Samoa',\n SM: 'San Marino',\n ST: 'Sao Tome and Principe',\n SA: 'Saudi Arabia',\n SN: 'Senegal',\n RS: 'Serbia',\n SC: 'Seychelles',\n SL: 'Sierra Leone',\n SG: 'Singapore',\n SX: 'Sint Maarten (Dutch part)',\n SK: 'Slovakia',\n SI: 'Slovenia',\n SB: 'Solomon Islands',\n SO: 'Somalia',\n ZA: 'South Africa',\n GS: 'South Georgia and the South Sandwich Islands',\n SS: 'South Sudan',\n ES: 'Spain',\n LK: 'Sri Lanka',\n SD: 'Sudan',\n SR: 'Suriname',\n SJ: 'Svalbard and Jan Mayen',\n SE: 'Sweden',\n CH: 'Switzerland',\n SY: 'Syrian Arab Republic',\n TW: 'Taiwan, Province of China',\n TJ: 'Tajikistan',\n TZ: 'Tanzania, United Republic of',\n TH: 'Thailand',\n TL: 'Timor-Leste',\n TG: 'Togo',\n TK: 'Tokelau',\n TO: 'Tonga',\n TT: 'Trinidad and Tobago',\n TN: 'Tunisia',\n TR: 'Türkiye',\n TM: 'Turkmenistan',\n TC: 'Turks and Caicos Islands',\n TV: 'Tuvalu',\n UG: 'Uganda',\n UA: 'Ukraine',\n AE: 'United Arab Emirates',\n GB: 'United Kingdom of Great Britain and Northern Ireland',\n UM: 'United States Minor Outlying Islands',\n US: 'United States of America',\n UY: 'Uruguay',\n UZ: 'Uzbekistan',\n VU: 'Vanuatu',\n VE: 'Venezuela (Bolivarian Republic of)',\n VN: 'Viet Nam',\n VG: 'Virgin Islands (British)',\n VI: 'Virgin Islands (U.S)',\n WF: 'Wallis and Futuna',\n EH: 'Western Sahara',\n YE: 'Yemen',\n ZM: 'Zambia',\n ZW: 'Zimbabwe',\n};\n\nexport function getCountryName(country: string) {\n return ALL_COUNTRIES[country];\n}\n\n/** Options for MultiSelect component */\nexport const COUNTRY_OPTIONS: SelectOption[] = Object.entries(ALL_COUNTRIES).map(v => {\n return {\n label: (\n <>\n {getCountryFlag(v[0])} {v[1]}\n </>\n ),\n id: v[0],\n };\n});\n"],"names":["LICENSE_TYPE_OPTIONS","jsxs","Fragment","IcNodeLocked","IcHostedFloating","IcLexFloatServer","SUBSCRIPTION_START_TRIGGER_OPTIONS","getCountryFlag","country","getRegionalIndicatorSymbol","letter","ALL_COUNTRIES","getCountryName","COUNTRY_OPTIONS","v"],"mappings":"oKASO,MAAMA,EAAuC,CAChD,CACI,MACIC,EAAAC,EAAA,CAAE,SAAA,CAAA,gBAEGC,EAAA,CAAA,CAAa,CAAA,EAClB,EAEJ,GAAI,aAAA,EAER,CACI,MACIF,EAAAC,EAAA,CAAE,SAAA,CAAA,oBAEGE,EAAA,CAAA,CAAiB,CAAA,EACtB,EAEJ,GAAI,iBAAA,EAER,CACI,MACIH,EAAAC,EAAA,CAAE,SAAA,CAAA,mBAEGG,EAAA,CAAA,CAAiB,CAAA,EACtB,EAEJ,GAAI,qBAAA,CAEZ,EAEaC,EAAqD,CAC9D,CACI,MAAO,mBACP,GAAI,UAAA,EAER,CACI,MAAO,qBACP,GAAI,YAAA,CAEZ,EAQO,SAASC,EAAeC,EAAiB,CAC5C,SAASC,EAA2BC,EAAgB,CAChD,OAAO,OAAO,cAAc,OAAeA,EAAO,YAAA,EAAc,WAAW,CAAC,CAAC,CACjF,CAEA,OAAOD,EAA2BD,EAAQ,CAAC,CAAC,EAAIC,EAA2BD,EAAQ,CAAC,CAAC,CACzF,CAEA,MAAMG,EAA2C,CAC7C,GAAI,cACJ,GAAI,gBACJ,GAAI,UACJ,GAAI,UACJ,GAAI,iBACJ,GAAI,UACJ,GAAI,SACJ,GAAI,WACJ,GAAI,aACJ,GAAI,sBACJ,GAAI,YACJ,GAAI,UACJ,GAAI,QACJ,GAAI,YACJ,GAAI,UACJ,GAAI,aACJ,GAAI,UACJ,GAAI,UACJ,GAAI,aACJ,GAAI,WACJ,GAAI,UACJ,GAAI,UACJ,GAAI,SACJ,GAAI,QACJ,GAAI,UACJ,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,GAAI,sBACJ,GAAI,UACJ,GAAI,UACJ,GAAI,eACJ,GAAI,2BACJ,GAAI,SACJ,GAAI,SACJ,GAAI,UACJ,GAAI,uBACJ,GAAI,uDACJ,GAAI,uCACJ,GAAI,2BACJ,GAAI,UACJ,GAAI,aACJ,GAAI,UACJ,GAAI,qCACJ,GAAI,WACJ,GAAI,2BACJ,GAAI,uBACJ,GAAI,oBACJ,GAAI,iBACJ,GAAI,QACJ,GAAI,SACJ,GAAI,UACR,EAEO,SAASC,EAAeJ,EAAiB,CAC5C,OAAOG,EAAcH,CAAO,CAChC,CAGO,MAAMK,EAAkC,OAAO,QAAQF,CAAa,EAAE,IAAIG,IACtE,CACH,MACIb,EAAAC,EAAA,CACK,SAAA,CAAAK,EAAeO,EAAE,CAAC,CAAC,EAAE,IAAEA,EAAE,CAAC,CAAA,EAC/B,EAEJ,GAAIA,EAAE,CAAC,CAAA,EAEd"}
@@ -0,0 +1,46 @@
1
+ import { default as React } from 'react';
2
+ import { PressEvent } from 'react-aria-components';
3
+ import { Button } from './button';
4
+ import { CtxIcon } from './icons';
5
+ export type TableActionDialogContentProps<T> = {
6
+ /** Callback to close the dialog */
7
+ close: () => void;
8
+ /** The data passed to the dialog - array of selected rows */
9
+ data: T[];
10
+ /** Flag to identify table action dialogs */
11
+ tableAction: true;
12
+ };
13
+ /** Base properties shared by all table actions */
14
+ export type TableActionBase<T> = {
15
+ label: string;
16
+ /** Optional function to determine if the action is disabled. Receives the rows and returns a boolean. Defaults to false if not provided */
17
+ isDisabled?: (rows: T[]) => boolean;
18
+ icon: CtxIcon;
19
+ bulk: boolean;
20
+ tooltip?: string;
21
+ /** Optional button variant to pass through to Button (defaults to neutral) */
22
+ variant?: React.ComponentProps<typeof Button>['variant'];
23
+ };
24
+ /** Action that triggers a callback */
25
+ export type TableActionAction<T> = TableActionBase<T> & {
26
+ type: 'action';
27
+ /** Callback triggered when the action is pressed. Receives the press event and selected rows as parameters */
28
+ onClick: (e: PressEvent, rows: T[]) => void;
29
+ };
30
+ /** Action that opens a dialog */
31
+ export type TableActionDialog<T> = TableActionBase<T> & {
32
+ type: 'dialog';
33
+ /** Component to render in the dialog */
34
+ component: React.ComponentType<TableActionDialogContentProps<T>>;
35
+ };
36
+ /** Common table action type that works for both action and dialog types */
37
+ export type TableAction<T> = TableActionAction<T> | TableActionDialog<T>;
38
+ export type TableActionsProps<T> = {
39
+ /** Array of table actions to render */
40
+ readonly items: TableAction<T>[];
41
+ /** Array of selected rows */
42
+ readonly rowsSelected: T[];
43
+ /** Whether the table is currently fetching data */
44
+ readonly isFetching?: boolean;
45
+ };
46
+ export declare function TableActions<T>({ items, rowsSelected, isFetching }: TableActionsProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ "use client";import{jsxs as s,Fragment as b,jsx as r}from"react/jsx-runtime";import{normalizeLabel as d}from"../utilities/string.js";import{Button as g}from"./button.js";import{useDialogState as D,DialogActionRenderer as A,findItemByNormalizedLabel as y}from"./dialog-action-utils.js";import"lodash-es";import"class-variance-authority";import"react-aria-components";import"../utilities/theme.js";import"clsx";import"./loader.js";import"./icons.js";import"react";import"./dialog.js";function h(t){return t.type==="action"}function c(t){return t.type==="dialog"}function I(t,i){return t.isDisabled?t.isDisabled(i):!1}function k({items:t,rowsSelected:i,isFetching:p}){const{openKey:u,setOpenKey:e}=D();return s(b,{children:[t.map((n,o)=>{const a=d(n.label),f=n.icon,l=I(n,i)||p;return s(g,{"aria-label":n.label,type:"button",isDisabled:l,className:"animate-in fade-in slide-in-from-left-15 duration-300 transition-transform",onPress:m=>{l||(h(n)?n.onClick(m,i):c(n)&&e(a))},variant:n.variant??"neutral",children:[r(f,{}),r("span",{children:n.label})]},`${a}-${o}`)}),r(A,{openKey:u,onOpenChange:n=>{n||e(null)},findItem:n=>{const o=y(t,n);return!o||!c(o)?null:{component:o.component}},getDialogProps:n=>({data:i,tableAction:!0,close:n})})]})}export{k as TableActions};
2
+ //# sourceMappingURL=table-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-actions.js","sources":["../../lib/components/table-actions.tsx"],"sourcesContent":["'use client';\nimport type React from 'react';\nimport type { PressEvent } from 'react-aria-components';\nimport { normalizeLabel } from '../utilities/string';\nimport { Button } from './button';\nimport { DialogActionRenderer, findItemByNormalizedLabel, useDialogState } from './dialog-action-utils';\nimport type { CtxIcon } from './icons';\n\nexport type TableActionDialogContentProps<T> = {\n /** Callback to close the dialog */\n close: () => void;\n /** The data passed to the dialog - array of selected rows */\n data: T[];\n /** Flag to identify table action dialogs */\n tableAction: true;\n};\n\n/** Base properties shared by all table actions */\nexport type TableActionBase<T> = {\n label: string;\n /** Optional function to determine if the action is disabled. Receives the rows and returns a boolean. Defaults to false if not provided */\n isDisabled?: (rows: T[]) => boolean;\n icon: CtxIcon;\n bulk: boolean;\n tooltip?: string;\n /** Optional button variant to pass through to Button (defaults to neutral) */\n variant?: React.ComponentProps<typeof Button>['variant'];\n};\n\n/** Action that triggers a callback */\nexport type TableActionAction<T> = TableActionBase<T> & {\n type: 'action';\n /** Callback triggered when the action is pressed. Receives the press event and selected rows as parameters */\n onClick: (e: PressEvent, rows: T[]) => void;\n};\n\n/** Action that opens a dialog */\nexport type TableActionDialog<T> = TableActionBase<T> & {\n type: 'dialog';\n /** Component to render in the dialog */\n component: React.ComponentType<TableActionDialogContentProps<T>>;\n};\n\n/** Common table action type that works for both action and dialog types */\nexport type TableAction<T> = TableActionAction<T> | TableActionDialog<T>;\n\nfunction isTableActionAction<T>(item: TableAction<T>): item is TableActionAction<T> {\n return item.type === 'action';\n}\n\nfunction isTableActionDialog<T>(item: TableAction<T>): item is TableActionDialog<T> {\n return item.type === 'dialog';\n}\n\nfunction getTableActionIsDisabled<T>(item: TableAction<T>, rows: T[]): boolean {\n return item.isDisabled ? item.isDisabled(rows) : false;\n}\n\nexport type TableActionsProps<T> = {\n /** Array of table actions to render */\n readonly items: TableAction<T>[];\n /** Array of selected rows */\n readonly rowsSelected: T[];\n /** Whether the table is currently fetching data */\n readonly isFetching?: boolean;\n};\n\nexport function TableActions<T>({ items, rowsSelected, isFetching }: TableActionsProps<T>) {\n const { openKey, setOpenKey } = useDialogState();\n\n return (\n <>\n {items.map((item, i) => {\n const id = normalizeLabel(item.label);\n const Icon = item.icon;\n const isDisabled = getTableActionIsDisabled(item, rowsSelected) || isFetching;\n\n return (\n <Button\n key={`${id}-${i}`}\n aria-label={item.label}\n type=\"button\"\n isDisabled={isDisabled}\n className=\"animate-in fade-in slide-in-from-left-15 duration-300 transition-transform\"\n onPress={e => {\n if (isDisabled) return;\n\n if (isTableActionAction(item)) {\n item.onClick(e, rowsSelected);\n } else if (isTableActionDialog(item)) {\n setOpenKey(id);\n }\n }}\n variant={item.variant ?? 'neutral'}\n >\n <Icon />\n <span>{item.label}</span>\n </Button>\n );\n })}\n\n <DialogActionRenderer<TableActionDialogContentProps<T>>\n openKey={openKey}\n onOpenChange={open => {\n if (!open) setOpenKey(null);\n }}\n findItem={key => {\n const item = findItemByNormalizedLabel(items, key);\n if (!item || !isTableActionDialog(item)) return null;\n return { component: item.component };\n }}\n getDialogProps={close => ({ data: rowsSelected, tableAction: true, close })}\n />\n </>\n );\n}\n"],"names":["isTableActionAction","item","isTableActionDialog","getTableActionIsDisabled","rows","TableActions","items","rowsSelected","isFetching","openKey","setOpenKey","useDialogState","jsxs","Fragment","i","id","normalizeLabel","Icon","isDisabled","Button","e","jsx","DialogActionRenderer","open","key","findItemByNormalizedLabel","close"],"mappings":"keA8CA,SAASA,EAAuBC,EAAoD,CAChF,OAAOA,EAAK,OAAS,QACzB,CAEA,SAASC,EAAuBD,EAAoD,CAChF,OAAOA,EAAK,OAAS,QACzB,CAEA,SAASE,EAA4BF,EAAsBG,EAAoB,CAC3E,OAAOH,EAAK,WAAaA,EAAK,WAAWG,CAAI,EAAI,EACrD,CAWO,SAASC,EAAgB,CAAE,MAAAC,EAAO,aAAAC,EAAc,WAAAC,GAAoC,CACvF,KAAM,CAAE,QAAAC,EAAS,WAAAC,CAAA,EAAeC,EAAA,EAEhC,OACIC,EAAAC,EAAA,CACK,SAAA,CAAAP,EAAM,IAAI,CAACL,EAAMa,IAAM,CACpB,MAAMC,EAAKC,EAAef,EAAK,KAAK,EAC9BgB,EAAOhB,EAAK,KACZiB,EAAaf,EAAyBF,EAAMM,CAAY,GAAKC,EAEnE,OACII,EAACO,EAAA,CAEG,aAAYlB,EAAK,MACjB,KAAK,SACL,WAAAiB,EACA,UAAU,6EACV,QAASE,GAAK,CACNF,IAEAlB,EAAoBC,CAAI,EACxBA,EAAK,QAAQmB,EAAGb,CAAY,EACrBL,EAAoBD,CAAI,GAC/BS,EAAWK,CAAE,EAErB,EACA,QAASd,EAAK,SAAW,UAEzB,SAAA,CAAAoB,EAACJ,EAAA,EAAK,EACNI,EAAC,OAAA,CAAM,SAAApB,EAAK,KAAA,CAAM,CAAA,CAAA,EAjBb,GAAGc,CAAE,IAAID,CAAC,EAAA,CAoB3B,CAAC,EAEDO,EAACC,EAAA,CACG,QAAAb,EACA,aAAcc,GAAQ,CACbA,GAAMb,EAAW,IAAI,CAC9B,EACA,SAAUc,GAAO,CACb,MAAMvB,EAAOwB,EAA0BnB,EAAOkB,CAAG,EACjD,MAAI,CAACvB,GAAQ,CAACC,EAAoBD,CAAI,EAAU,KACzC,CAAE,UAAWA,EAAK,SAAA,CAC7B,EACA,eAAgByB,IAAU,CAAE,KAAMnB,EAAc,YAAa,GAAM,MAAAmB,CAAA,EAAM,CAAA,CAC7E,EACJ,CAER"}
@@ -0,0 +1,3 @@
1
+ export declare function CountryName({ value }: {
2
+ value: string;
3
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import{jsxs as t,Fragment as o}from"react/jsx-runtime";import{getCountryFlag as n,getCountryName as m}from"../components/select-options.js";import"../components/icons.js";import"react";function f({value:r}){return r?t(o,{children:[n(r)," ",m(r)]}):null}export{f as CountryName};
2
+ //# sourceMappingURL=countries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countries.js","sources":["../../lib/utilities/countries.tsx"],"sourcesContent":["import { getCountryFlag, getCountryName } from '../components/select-options';\n\nexport function CountryName({ value }: { value: string }) {\n if (!value) return null;\n return (\n <>\n {getCountryFlag(value)} {getCountryName(value)}\n </>\n );\n}\n"],"names":["CountryName","value","jsxs","Fragment","getCountryFlag","getCountryName"],"mappings":"yLAEO,SAASA,EAAY,CAAE,MAAAC,GAA4B,CACtD,OAAKA,EAEDC,EAAAC,EAAA,CACK,SAAA,CAAAC,EAAeH,CAAK,EAAE,IAAEI,EAAeJ,CAAK,CAAA,EACjD,EAJe,IAMvB"}
@@ -0,0 +1,8 @@
1
+ import { paths } from '@cryptlex/web-api-types/develop';
2
+ import { default as createClient } from 'openapi-fetch';
3
+ export type CtxClientType = ReturnType<typeof createClient<paths>>;
4
+ export declare function CtxClientProvider({ client, children }: {
5
+ client: CtxClientType;
6
+ children: React.ReactNode;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ export declare function useCtxClient(): CtxClientType;
@@ -0,0 +1,2 @@
1
+ import{jsx as n}from"react/jsx-runtime";import{createContext as i,use as o}from"react";const e=i(null);function l({client:t,children:r}){return n(e.Provider,{value:t,children:r})}function x(){const t=o(e);if(!t)throw new Error("useCtxClient must be used within a CtxClientProvider.");return t}export{l as CtxClientProvider,x as useCtxClient};
2
+ //# sourceMappingURL=ctx-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ctx-client.js","sources":["../../lib/utilities/ctx-client.tsx"],"sourcesContent":["import type { paths } from '@cryptlex/web-api-types/develop';\nimport createClient from 'openapi-fetch';\nimport { createContext, use } from 'react';\n\nexport type CtxClientType = ReturnType<typeof createClient<paths>>;\n\nconst CtxClientContext = createContext<CtxClientType | null>(null);\n\nexport function CtxClientProvider({ client, children }: { client: CtxClientType; children: React.ReactNode }) {\n return <CtxClientContext.Provider value={client}>{children}</CtxClientContext.Provider>;\n}\n\nexport function useCtxClient(): CtxClientType {\n const client = use(CtxClientContext);\n if (!client) {\n throw new Error('useCtxClient must be used within a CtxClientProvider.');\n }\n return client;\n}\n"],"names":["CtxClientContext","createContext","CtxClientProvider","client","children","useCtxClient","use"],"mappings":"uFAMA,MAAMA,EAAmBC,EAAoC,IAAI,EAE1D,SAASC,EAAkB,CAAE,OAAAC,EAAQ,SAAAC,GAAkE,CAC1G,SAAQJ,EAAiB,SAAjB,CAA0B,MAAOG,EAAS,SAAAC,EAAS,CAC/D,CAEO,SAASC,GAA8B,CAC1C,MAAMF,EAASG,EAAIN,CAAgB,EACnC,GAAI,CAACG,EACD,MAAM,IAAI,MAAM,uDAAuD,EAE3E,OAAOA,CACX"}
@@ -5,6 +5,7 @@ export declare const MIN_INT32 = -2147483648;
5
5
  export declare const MIN_INT32_DAYS: number;
6
6
  export declare function getNumberValidator(min: number, max: number): z.ZodNumber;
7
7
  export declare function getDaysValidator(min: number): z.ZodNumber;
8
+ export declare function formatDays(seconds: number): string;
8
9
  export declare function formatNumber(num: number | bigint, options?: Intl.NumberFormatOptions): string;
9
10
  /**
10
11
  * @returns A formatted string for the number of bytes
@@ -1,2 +1,2 @@
1
- import m from"zod";import{Duration as c}from"./duration.js";const d=2147483647,i=Math.floor(d/86400),l=-2147483648,_=Math.ceil(l/86400);function b(e,t){return m.number().min(e,{error:n=>{if(n.code==="too_small")return`The number must be at least ${o(e)}.`}}).max(t,{error:n=>{if(n.code==="too_big")return`The number must be at most ${o(t)}.`}})}const u=86400;function g(e){const t=e*u,n=i*u;return m.number().min(t,{error:`The number must be at least ${o(e)} days.`}).max(n,{error:`The number must be at most ${o(i)} days.`})}function o(e,t){return Intl.NumberFormat(navigator.language,t).format(e)}function N(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(2)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function y(e=10){const t=365*e,n=s=>{try{const r=c.parse(s);return{years:r.years??0,months:r.months??0,days:(r.days??0)+(r.weeks??0)*7,hours:r.hours??0,minutes:r.minutes??0,seconds:r.seconds??0}}catch{return{years:0,months:0,days:0,hours:0,minutes:0,seconds:0}}};return m.string().refine(s=>{const r=n(s);return Object.values(r).some(a=>a>0)},{message:"At least one value (years, months, days, hours, minutes, or seconds) must be non-zero"}).refine(s=>{const r=n(s),a=(r.hours*3600+r.minutes*60+r.seconds)/u;return r.years*365+r.months*30+r.days+a<=t},{message:`Subscription interval cannot exceed ${e} years`})}export{d as MAX_INT32,i as MAX_INT32_DAYS,l as MIN_INT32,_ as MIN_INT32_DAYS,N as formatFilesize,o as formatNumber,g as getDaysValidator,y as getISO8601DurationValidator,b as getNumberValidator};
1
+ import m from"zod";import{Duration as c}from"./duration.js";const d=2147483647,i=Math.floor(d/86400),f=-2147483648,y=Math.ceil(f/86400);function _(e,t){return m.number().min(e,{error:n=>{if(n.code==="too_small")return`The number must be at least ${a(e)}.`}}).max(t,{error:n=>{if(n.code==="too_big")return`The number must be at most ${a(t)}.`}})}const o=86400;function b(e){const t=e*o,n=i*o;return m.number().min(t,{error:`The number must be at least ${a(e)} days.`}).max(n,{error:`The number must be at most ${a(i)} days.`})}function g(e){return`${Math.floor(e/o)} days`}function a(e,t){return Intl.NumberFormat(navigator.language,t).format(e)}function D(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(2)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function N(e=10){const t=365*e,n=s=>{try{const r=c.parse(s);return{years:r.years??0,months:r.months??0,days:(r.days??0)+(r.weeks??0)*7,hours:r.hours??0,minutes:r.minutes??0,seconds:r.seconds??0}}catch{return{years:0,months:0,days:0,hours:0,minutes:0,seconds:0}}};return m.string().refine(s=>{const r=n(s);return Object.values(r).some(u=>u>0)},{message:"At least one value (years, months, days, hours, minutes, or seconds) must be non-zero"}).refine(s=>{const r=n(s),u=(r.hours*3600+r.minutes*60+r.seconds)/o;return r.years*365+r.months*30+r.days+u<=t},{message:`Subscription interval cannot exceed ${e} years`})}export{d as MAX_INT32,i as MAX_INT32_DAYS,f as MIN_INT32,y as MIN_INT32_DAYS,g as formatDays,D as formatFilesize,a as formatNumber,b as getDaysValidator,N as getISO8601DurationValidator,_ as getNumberValidator};
2
2
  //# sourceMappingURL=numbers.js.map