@smart-factor/gem-ui-components 0.0.18 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import pt, { jsx as x, jsxs as de } from "react/jsx-runtime";
2
- import { c as J, P as n, _ as f, o as q, C as ft, a as H, b as mt, s as ge, u as ye, d as ht, e as bt, f as vt, g as Ee, h as Y, i as gt, j as yt, k as Q, l as ee, m as L, n as $e, p as te, q as z, r as pe, t as V, v as ne, T as He, w as Ue, x as le, y as ze, z as We, A as Et, B as Ie, D as xt, E as Tt, F as kt, S as ke, G as Pt, H as Rt, I as wt } from "./Stack-BaLJatT3.js";
2
+ import { c as J, P as n, _ as f, o as q, C as ft, a as H, b as mt, s as ge, u as ye, d as ht, e as bt, f as vt, g as Ee, h as Y, i as gt, j as yt, k as Q, l as ee, m as L, n as $e, p as te, q as z, r as pe, t as V, v as ne, T as He, w as Ue, x as le, y as ze, z as We, A as Et, B as Ie, D as xt, E as Tt, F as kt, S as ke, G as Pt, H as Rt, I as wt } from "./Stack-B21Kr1Fq.js";
3
3
  import * as u from "react";
4
4
  import * as Nt from "react-dom";
5
5
  var be = {};
@@ -6580,8 +6580,8 @@ export {
6580
6580
  Mc as ai,
6581
6581
  Ac as aj,
6582
6582
  du as ak,
6583
- Gt as al,
6584
- Yt as am,
6583
+ Yt as al,
6584
+ Uc as am,
6585
6585
  Al as an,
6586
6586
  di as ao,
6587
6587
  Qr as ap,
@@ -1,7 +1,7 @@
1
1
  import { jsx as w, jsxs as ve } from "react/jsx-runtime";
2
2
  import * as x from "react";
3
3
  import { createElement as Ht } from "react";
4
- import { J as Yt, K as Qe, L as Qt, M as Zt, N as en, k as fe, l as me, m as U, _ as D, p as ot, O as tn, T as nn, q as Ne, r as on, Q as rn, h as de, t as Ie, P as r, R as rt, v as ge, x as Ze, U as sn, D as it, f as ln, V as st, a as ue, b as te, n as an, d as cn, g as G, o as dn, E as un, u as pn, B as ce, W as fn, X as lt, Y as ie, A as et, e as mn, F as In, S as gn, H as hn, I as bn } from "./Stack-BaLJatT3.js";
4
+ import { J as Yt, K as Qe, L as Qt, M as Zt, N as en, k as fe, l as me, m as U, _ as D, p as ot, O as tn, T as nn, q as Ne, r as on, Q as rn, h as de, t as Ie, P as r, R as rt, v as ge, x as Ze, U as sn, D as it, f as ln, V as st, a as ue, b as te, n as an, d as cn, g as G, o as dn, E as un, u as pn, B as ce, W as fn, X as lt, Y as ie, A as et, e as mn, F as In, S as gn, H as hn, I as bn } from "./Stack-B21Kr1Fq.js";
5
5
  function yn(e, t = 0, n = 1) {
6
6
  return process.env.NODE_ENV !== "production" && (e < t || e > n) && console.error(`MUI: The value provided ${e} is out of range [${t}, ${n}].`), Yt(e, t, n);
7
7
  }
@@ -1,4 +1,4 @@
1
- import { D as e } from "../../Drawer-Cp4FHKbE.js";
1
+ import { D as e } from "../../Drawer-ClBanoDR.js";
2
2
  export {
3
3
  e as Drawer
4
4
  };
@@ -1,18 +1,11 @@
1
- import { Control, FieldValues, Path } from 'react-hook-form';
2
- import { TextFieldVariants } from '@mui/material';
1
+ import { ReactNode } from 'react';
2
+ import { FilterOptionsState, TextFieldVariants } from '@mui/material';
3
3
 
4
- export interface IContextualSearchOption {
5
- value: number;
4
+ interface ContextualSearchBaseProps<T> {
5
+ options: T[];
6
+ isOptionEqualToValue: (option: T, value: T) => boolean;
7
+ renderOption: (option: T) => ReactNode;
6
8
  label: string;
7
- secondaryLabel?: string;
8
- title?: string | string[];
9
- }
10
- export interface ContextualSearchProps<T extends FieldValues> {
11
- name: Path<T>;
12
- control: Control<T>;
13
- options: IContextualSearchOption[];
14
- label: string;
15
- multiple?: boolean;
16
9
  required?: boolean;
17
10
  disabled?: boolean;
18
11
  loading?: boolean;
@@ -22,5 +15,27 @@ export interface ContextualSearchProps<T extends FieldValues> {
22
15
  onLastOptionInView: () => void;
23
16
  onInputChange: (event: React.SyntheticEvent<Element, Event>, value: string) => void;
24
17
  onAddNewEntry?: () => void;
18
+ errorMessage?: string;
19
+ getOptionKey: (option: T) => string | number;
20
+ getOptionLabel: (option: T) => string;
21
+ filterOptions?: (options: T[], state: FilterOptionsState<T>) => T[];
25
22
  }
26
- export declare const ContextualSearch: <T extends FieldValues>(props: ContextualSearchProps<T>) => import("react/jsx-runtime").JSX.Element;
23
+ type ContextualSearchPropsByMultiple<T> = {
24
+ multiple: false;
25
+ value: T | null;
26
+ onChange: (value: T | null) => void;
27
+ } | {
28
+ multiple: true;
29
+ value: T[];
30
+ onChange: (value: T[]) => void;
31
+ };
32
+ type ContextualSearchPropsByType = {
33
+ listboxType: 'default';
34
+ listboxPortalId?: string;
35
+ } | {
36
+ listboxType: 'list';
37
+ listboxPortalId: string;
38
+ };
39
+ export type ContextualSearchProps<T> = ContextualSearchBaseProps<T> & ContextualSearchPropsByMultiple<T> & ContextualSearchPropsByType;
40
+ export declare function ContextualSearch<T>({ listboxType, ...props }: ContextualSearchProps<T>): import("react/jsx-runtime").JSX.Element;
41
+ export {};
@@ -1,10 +1,15 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
- import { ContextualSearch } from './ContextualSearch';
2
+ import { ContextualSearchProps } from './ContextualSearch';
3
+ import { ContextualSearchStoryOption } from './mock';
3
4
 
4
- declare const meta: Meta<typeof ContextualSearch>;
5
+ type StoryArgs = ContextualSearchProps<ContextualSearchStoryOption> & {
6
+ loadingSize?: number;
7
+ };
8
+ declare const meta: Meta<StoryArgs>;
5
9
  export default meta;
6
- type Story = StoryObj<typeof meta>;
10
+ type Story = StoryObj<StoryArgs>;
7
11
  export declare const Single: Story;
8
12
  export declare const Multiple: Story;
13
+ export declare const Loading: Story;
9
14
  export declare const WithEntryAdd: Story;
10
- export declare const WithLoading: Story;
15
+ export declare const List: Story;
@@ -0,0 +1,9 @@
1
+ import { Control, FieldValues, Path } from 'react-hook-form';
2
+ import { ContextualSearchProps } from './ContextualSearch';
3
+
4
+ type ContextualSearchControlledProps<T, R extends FieldValues> = ContextualSearchProps<T> & {
5
+ control: Control<R>;
6
+ name: Path<R>;
7
+ };
8
+ export declare function ContextualSearchControlled<T, R extends FieldValues>(props: ContextualSearchControlledProps<T, R>): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import { AutocompleteProps } from '@mui/material';
2
+
3
+ type ContextualSearchListListbox<T> = AutocompleteProps<T, boolean, false, false, 'div'>['ListboxProps'] & {
4
+ listboxPortalId: string;
5
+ };
6
+ export declare function ContextualSearchListListbox<T>(props: ContextualSearchListListbox<T>): import('react').ReactPortal;
7
+ export {};
@@ -1,2 +1,2 @@
1
- export type { IContextualSearchOption } from './ContextualSearch';
2
1
  export { ContextualSearch } from './ContextualSearch';
2
+ export { ContextualSearchControlled } from './ContextualSearchControlled';
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export type ContextualSearchStoryOption = {
3
+ id: number;
4
+ label: string;
5
+ secondaryLabel: string;
6
+ };
7
+ export declare function useLazyOptions(size?: number): {
8
+ options: ContextualSearchStoryOption[];
9
+ loading: boolean;
10
+ onLastOptionInView: () => Promise<void>;
11
+ onSearchTextChange: import('react').Dispatch<import('react').SetStateAction<string>>;
12
+ };
13
+ export declare function getOptions(): ContextualSearchStoryOption[];
@@ -1,5 +1,4 @@
1
- export type { IContextualSearchOption } from './ContextualSearch';
2
- export { ContextualSearch } from './ContextualSearch';
1
+ export { ContextualSearch, ContextualSearchControlled, } from './ContextualSearch';
3
2
  export { DatePicker } from './DatePicker/DatePicker';
4
3
  export { DateTimePicker } from './DateTimePicker/DateTimePicker';
5
4
  export { Input } from './Input/Input';
@@ -1,4 +1,4 @@
1
- import { T as o } from "../../Tree-p-qFS5a4.js";
1
+ import { T as o } from "../../Tree-CAPqaaUN.js";
2
2
  export {
3
3
  o as Tree
4
4
  };