@verifiedinc-public/shared-ui-elements 12.6.0 → 12.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
|
|
2
|
+
interface TipProps extends PropsWithChildren {
|
|
3
|
+
/**
|
|
4
|
+
* Widens the popover past MUI Tooltip's ~300px default for content that must not wrap,
|
|
5
|
+
* like a code snippet with a long line. Omit to keep the default.
|
|
6
|
+
*/
|
|
7
|
+
maxWidth?: number | string;
|
|
8
|
+
}
|
|
9
|
+
export declare function Tip({ children, maxWidth }: TipProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Tooltip as
|
|
1
|
+
"use strict";import{Tooltip as n,IconButton as e}from"@mui/material";import{Code as s}from"@mui/icons-material";import{jsx as o}from"react/jsx-runtime";function a({children:i,maxWidth:t}){return o(n,{title:i,arrow:!0,enterTouchDelay:0,componentsProps:t===void 0?void 0:{tooltip:{sx:{maxWidth:t}}},children:o(e,{size:"small",onClick:r=>{r.stopPropagation()},children:o(s,{})})})}export{a as Tip};
|
|
@@ -23,6 +23,11 @@ interface SelectInputMultipleProps extends SelectInputBaseProps {
|
|
|
23
23
|
onChange?: (value: Option[]) => void;
|
|
24
24
|
value?: Option[];
|
|
25
25
|
defaultOption?: Option[];
|
|
26
|
+
/**
|
|
27
|
+
* How many chips to show while the input is not focused; the rest collapse into `+N`.
|
|
28
|
+
* Focusing the input always reveals the full selection. Pass -1 to never collapse.
|
|
29
|
+
*/
|
|
30
|
+
limitTags?: number;
|
|
26
31
|
}
|
|
27
32
|
type SelectInputProps = SelectInputSingleProps | SelectInputMultipleProps;
|
|
28
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Autocomplete as m,TextField as
|
|
1
|
+
"use strict";import{Autocomplete as m,TextField as C,Checkbox as O}from"@mui/material";import{useState as g}from"react";import{jsx as t,jsxs as T}from"react/jsx-runtime";function V(o){return o.multiple?t(E,{...o}):t(k,{...o})}function k({options:o,defaultOption:n,value:i,onChange:a,onClear:u,disableClearable:b,...c}){const[h,P]=g(n??null),p=i!==void 0,s=p?i:h,d=e=>{p||P(e),a&&a(e)},f=()=>{d(null),u&&u()},r={inputProps:{tabIndex:0},fullWidth:!0,...c.InputProps};return t(m,{disablePortal:!0,autoHighlight:!0,defaultValue:n,options:o,disableClearable:b,isOptionEqualToValue:(e,l)=>e?.id===l?.id,value:s,onChange:(e,l)=>{if(!l){f();return}d(l)},renderInput:e=>t(C,{...e,...r,inputProps:{...e.inputProps,...r.inputProps}})})}function E({options:o,defaultOption:n,value:i,onChange:a,onClear:u,disableClearable:b,limitTags:c=2,...h}){const[P,p]=g(n??[]),s=i!==void 0,d=s?i:P,f=e=>{s||p(e),a&&a(e)},r={inputProps:{tabIndex:0},fullWidth:!0,...h.InputProps};return t(m,{multiple:!0,disableCloseOnSelect:!0,limitTags:c,disablePortal:!0,autoHighlight:!0,defaultValue:n,options:o,disableClearable:b,isOptionEqualToValue:(e,l)=>e?.id===l?.id,value:d,onChange:(e,l)=>{f(l),l.length===0&&u&&u()},renderOption:(e,l,{selected:v})=>{const{key:x,...I}=e;return T("li",{...I,children:[t(O,{checked:v,sx:{mr:1}}),l.label]},x)},renderInput:e=>t(C,{...e,...r,inputProps:{...e.inputProps,...r.inputProps}})})}export{V as SelectInput};
|