freemium-ui 2.0.0-beta.32 → 2.0.0-beta.33
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.
- package/index.cjs.js +27 -27
- package/index.d.ts +2 -1
- package/index.js +27 -27
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -3625,7 +3625,7 @@ className:"end-adornment"},i)),o&&e.createElement("div",{className:"end-label"
|
|
|
3625
3625
|
className:"fui-loader",speed:r,size:n})
|
|
3626
3626
|
},nm=({type:t="button",...n})=>"button"===t?e.createElement(rm,{...n,
|
|
3627
3627
|
type:"button"}):e.createElement(am,{...n,type:"input"}),rm=t=>{
|
|
3628
|
-
const n=qt(),{itemIdentifier:r="id",label:a,id:o,items:i=[],onChange:l,placeholder:c,readOnly:s=!1,disabled:u=!1,isRequired:d=!1,showTick:h=!0,itemToString:p,name:f,itemComponent:m,width:v,className:g,style:y,defaultSelectedItem:b=null,isErrored:w,isMenuLoading:C,errorText:z,defaultIsOpen:M,isOpen:x}=t,
|
|
3628
|
+
const n=qt(),{itemIdentifier:r="id",label:a,id:o,items:i=[],onChange:l,placeholder:c,readOnly:s=!1,disabled:u=!1,isRequired:d=!1,showTick:h=!0,itemToString:p,name:f,itemComponent:m,width:v,className:g,style:y,defaultSelectedItem:b=null,isErrored:w,isMenuLoading:C,errorText:z,defaultIsOpen:M,isOpen:x,contentProps:E}=t,S=e.useMemo((()=>{
|
|
3629
3629
|
const e=i.reduce(((e,t)=>{const n=t.group??"default"
|
|
3630
3630
|
;return e[n]?e[n].push(t):e[n]=[t],e}),{})
|
|
3631
3631
|
;return Object.keys(e).sort(((e,t)=>"default"!==e?1:-1)).map((t=>({key:t,
|
|
@@ -3640,11 +3640,11 @@ isErrored:!!w,"aria-invalid":!!w,width:v,style:y},e.createElement(gd,{
|
|
|
3640
3640
|
className:"SelectValue",placeholder:c}),e.createElement(Hd,{
|
|
3641
3641
|
className:"SelectIcon"},e.createElement(Rl,{fill:n.colors.text.primary
|
|
3642
3642
|
}))),e.createElement(yd,null,e.createElement(zd,{className:"SelectContent",
|
|
3643
|
-
position:"popper",side:"bottom",sideOffset:4,sticky:"partial"
|
|
3643
|
+
position:"popper",side:"bottom",sideOffset:4,sticky:"partial",...E
|
|
3644
3644
|
},C?e.createElement(hd,null,e.createElement(tm,null)):e.createElement(e.Fragment,null,e.createElement(Sd,{
|
|
3645
3645
|
className:"SelectScrollButton"},e.createElement(Rl,{fill:n.colors.text.primary
|
|
3646
3646
|
})),e.createElement(xd,{className:"SelectViewport"
|
|
3647
|
-
},
|
|
3647
|
+
},S.map((t=>e.createElement(vd,{key:t.key,className:"SelectGroup"
|
|
3648
3648
|
},"default"!==t.key&&e.createElement(Cd,{className:"SelectLabel"
|
|
3649
3649
|
},t.key,e.createElement(wd,null)),t.items.map(((t,n)=>{
|
|
3650
3650
|
const a="string"==typeof t?t:t?.[r],o=t?.[r]??""
|
|
@@ -3654,35 +3654,35 @@ showTick:h}):e.createElement(om,{key:a,value:o||a,disabled:!!t.disabled,
|
|
|
3654
3654
|
showTick:h},p(t,"list-item")))})))))),e.createElement(_d,{
|
|
3655
3655
|
className:"SelectScrollButton"},e.createElement(Rl,{fill:n.colors.text.primary
|
|
3656
3656
|
})))))),w&&z&&e.createElement(vc,null,z))
|
|
3657
|
-
},am=({itemIdentifier:t="id",label:n,id:r,items:a=[],placeholder:o,readOnly:i=!1,disabled:l=!1,isRequired:c=!1,hideClear:s=!1,itemToString:u,name:d,filterKey:h,width:p,customValues:f,onCustomValueAdd:m,itemComponent:v,emptyItemsText:g,getCustomMessage:y,onChange:b,useComboboxProps:w,isErrored:C,errorText:z,defaultSelectedItem:M,isMenuLoading:x})=>{
|
|
3658
|
-
const
|
|
3659
|
-
selectedItem:M,items:
|
|
3657
|
+
},am=({itemIdentifier:t="id",label:n,id:r,items:a=[],placeholder:o,readOnly:i=!1,disabled:l=!1,isRequired:c=!1,hideClear:s=!1,itemToString:u,name:d,filterKey:h,width:p,customValues:f,onCustomValueAdd:m,itemComponent:v,emptyItemsText:g,getCustomMessage:y,onChange:b,useComboboxProps:w,isErrored:C,errorText:z,defaultSelectedItem:M,isMenuLoading:x,contentProps:E})=>{
|
|
3658
|
+
const S=qt(),[_,H]=e.useState(a),{isOpen:D,selectedItem:L,getToggleButtonProps:V,getLabelProps:A,getMenuProps:k,openMenu:T,highlightedIndex:R,setHighlightedIndex:P,setInputValue:I,inputValue:O,getItemProps:N,getInputProps:F}=ff({
|
|
3659
|
+
selectedItem:M,items:_,onSelectedItemChange:({selectedItem:e})=>{
|
|
3660
3660
|
console.log("onSelectedItemChange",{sI:e}),b?.(e??null)},
|
|
3661
3661
|
onIsOpenChange:({isOpen:e})=>{
|
|
3662
|
-
if(e&&(""===
|
|
3663
|
-
|
|
3662
|
+
if(e&&(""===O||L&&h&&(O||"").toLowerCase()===`${L?.[h||t]||""}`.toLowerCase()))H(a),
|
|
3663
|
+
P(L?a.indexOf(L):-1);else{const t=L?u(L):"";L&&!e&&t!==O&&I(t)}e||H(a)},
|
|
3664
3664
|
onInputValueChange:({inputValue:e})=>{
|
|
3665
|
-
|
|
3666
|
-
},itemToString:e=>e?u(e,"downshift"):"",...w}),
|
|
3667
|
-
;return e.createElement(ld,{width:p,isOpen:
|
|
3668
|
-
className:"input-label",...
|
|
3669
|
-
},n,c&&e.createElement(zn,null,"*")),e.createElement(Kf,{...
|
|
3665
|
+
D&&(""===e||L&&h&&(e||"").toLowerCase()===`${L?.[h||t]||""}`.toLowerCase())?H(a):H((n=>n.filter((n=>!e||("string"==typeof n?n:n?.[h||t]).toLowerCase().includes(e.toLowerCase())))))
|
|
3666
|
+
},itemToString:e=>e?u(e,"downshift"):"",...w}),B=!l&&!i&&D
|
|
3667
|
+
;return e.createElement(ld,{width:p,isOpen:B},e.createElement(wn,{
|
|
3668
|
+
className:"input-label",...A({disabled:l,readOnly:i})
|
|
3669
|
+
},n,c&&e.createElement(zn,null,"*")),e.createElement(Kf,{...F({name:d,
|
|
3670
3670
|
readOnly:i,disabled:l,id:r}),placeholder:o,
|
|
3671
|
-
endAdornment:e.createElement(pd,null,!l&&!i&&!s&&
|
|
3671
|
+
endAdornment:e.createElement(pd,null,!l&&!i&&!s&&L&&e.createElement(Mn,{
|
|
3672
3672
|
onClick:e=>{
|
|
3673
|
-
console.log("onClick WORKING"),
|
|
3674
|
-
borderRadius:"50%"}},e.createElement(qn,{fill:
|
|
3675
|
-
})),e.createElement(Mn,{...
|
|
3676
|
-
isOpen:
|
|
3677
|
-
}),!i&&!l&&e.createElement(sd,{isOpen:
|
|
3678
|
-
},x?e.createElement(hd,null,e.createElement(tm,null)):e.createElement(e.Fragment,null,
|
|
3679
|
-
onClick:e=>{e.stopPropagation(),m&&m({inputValue:
|
|
3680
|
-
},y?.(
|
|
3681
|
-
},g||"No items")),
|
|
3682
|
-
;return e.createElement(e.Fragment,null,v?v(n,{isHilighted:
|
|
3683
|
-
isSelected:
|
|
3684
|
-
isHilighted:
|
|
3685
|
-
},u(n),
|
|
3673
|
+
console.log("onClick WORKING"),I(""),b?.(null),T(),e.stopPropagation()},style:{
|
|
3674
|
+
borderRadius:"50%"}},e.createElement(qn,{fill:S.colors.text.primary
|
|
3675
|
+
})),e.createElement(Mn,{...V({disabled:l,readOnly:i})},e.createElement(id,{
|
|
3676
|
+
isOpen:B,fill:S.colors.text.primary,width:8,height:8})))
|
|
3677
|
+
}),!i&&!l&&e.createElement(sd,{isOpen:D,...E,...k({disabled:l,readOnly:i})
|
|
3678
|
+
},x?e.createElement(hd,null,e.createElement(tm,null)):e.createElement(e.Fragment,null,D&&0===_.length&&e.createElement(e.Fragment,null,f?e.createElement(ud,null,e.createElement(dd,{
|
|
3679
|
+
onClick:e=>{e.stopPropagation(),m&&m({inputValue:O,customValues:!0}),I("")}
|
|
3680
|
+
},y?.(O)||"Click to add")):e.createElement(ud,{readOnly:!0
|
|
3681
|
+
},g||"No items")),D&&_.map(((n,r)=>{const a="string"==typeof n?n:n?.[t]
|
|
3682
|
+
;return e.createElement(e.Fragment,null,v?v(n,{isHilighted:R===r,
|
|
3683
|
+
isSelected:L===n,key:a,...N({item:n,index:r})}):e.createElement(ud,{
|
|
3684
|
+
isHilighted:R===r,isSelected:L===n,key:a,...N({item:n,index:r})
|
|
3685
|
+
},u(n),L===n&&e.createElement(Lc,{fill:S.colors.common.accent})))
|
|
3686
3686
|
})))),C&&z&&e.createElement(vc,null,z))
|
|
3687
3687
|
},om=e.forwardRef((({children:t,showTick:n=!0,...r},a)=>{const o=qt()
|
|
3688
3688
|
;return e.createElement(bd,{className:"SelectItem",...r,ref:a
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import react__default from 'react';
|
|
3
|
+
import react__default, { HTMLAttributes } from 'react';
|
|
4
4
|
import * as Popover$1 from '@radix-ui/react-popover';
|
|
5
5
|
import { PopperContentProps } from '@radix-ui/react-popover';
|
|
6
6
|
import { RadioGroupProps as RadioGroupProps$1, RadioGroupContextValue } from '@radix-ui/react-radio-group';
|
|
@@ -470,6 +470,7 @@ interface DropdownProps<T extends DefaultDropdownItem = DefaultDropdownItem> ext
|
|
|
470
470
|
*/
|
|
471
471
|
useComboboxProps?: UseComboboxProps<T>;
|
|
472
472
|
itemComponent?: (item: T, props?: DropdownItemProps | DropdownInputItemProps) => React.ReactNode | string;
|
|
473
|
+
contentProps?: Pick<HTMLAttributes<HTMLElement>, 'style' | 'className'>;
|
|
473
474
|
}
|
|
474
475
|
interface DropdownButtonProps<T extends DefaultDropdownItem = DefaultDropdownItem> extends DropdownProps<T> {
|
|
475
476
|
}
|
package/index.js
CHANGED
|
@@ -3604,7 +3604,7 @@ className:"end-adornment"},i)),o&&t.createElement("div",{className:"end-label"
|
|
|
3604
3604
|
className:"fui-loader",speed:r,size:n})
|
|
3605
3605
|
},_m=({type:e="button",...n})=>"button"===e?t.createElement(Hm,{...n,
|
|
3606
3606
|
type:"button"}):t.createElement(Dm,{...n,type:"input"}),Hm=e=>{
|
|
3607
|
-
const n=vn(),{itemIdentifier:r="id",label:a,id:o,items:i=[],onChange:l,placeholder:c,readOnly:s=!1,disabled:u=!1,isRequired:d=!1,showTick:h=!0,itemToString:p,name:f,itemComponent:m,width:v,className:g,style:y,defaultSelectedItem:b=null,isErrored:w,isMenuLoading:C,errorText:z,defaultIsOpen:M,isOpen:x}=e,
|
|
3607
|
+
const n=vn(),{itemIdentifier:r="id",label:a,id:o,items:i=[],onChange:l,placeholder:c,readOnly:s=!1,disabled:u=!1,isRequired:d=!1,showTick:h=!0,itemToString:p,name:f,itemComponent:m,width:v,className:g,style:y,defaultSelectedItem:b=null,isErrored:w,isMenuLoading:C,errorText:z,defaultIsOpen:M,isOpen:x,contentProps:S}=e,E=t.useMemo((()=>{
|
|
3608
3608
|
const e=i.reduce(((e,t)=>{const n=t.group??"default"
|
|
3609
3609
|
;return e[n]?e[n].push(t):e[n]=[t],e}),{})
|
|
3610
3610
|
;return Object.keys(e).sort(((e,t)=>"default"!==e?1:-1)).map((t=>({key:t,
|
|
@@ -3619,11 +3619,11 @@ isErrored:!!w,"aria-invalid":!!w,width:v,style:y},t.createElement(jd,{
|
|
|
3619
3619
|
className:"SelectValue",placeholder:c}),t.createElement(Jd,{
|
|
3620
3620
|
className:"SelectIcon"},t.createElement(nc,{fill:n.colors.text.primary
|
|
3621
3621
|
}))),t.createElement(Ud,null,t.createElement(Gd,{className:"SelectContent",
|
|
3622
|
-
position:"popper",side:"bottom",sideOffset:4,sticky:"partial"
|
|
3622
|
+
position:"popper",side:"bottom",sideOffset:4,sticky:"partial",...S
|
|
3623
3623
|
},C?t.createElement(Rd,null,t.createElement(Em,null)):t.createElement(t.Fragment,null,t.createElement(Xd,{
|
|
3624
3624
|
className:"SelectScrollButton"},t.createElement(nc,{fill:n.colors.text.primary
|
|
3625
3625
|
})),t.createElement(qd,{className:"SelectViewport"
|
|
3626
|
-
},
|
|
3626
|
+
},E.map((e=>t.createElement(Bd,{key:e.key,className:"SelectGroup"
|
|
3627
3627
|
},"default"!==e.key&&t.createElement(Wd,{className:"SelectLabel"
|
|
3628
3628
|
},e.key,t.createElement(Yd,null)),e.items.map(((e,n)=>{
|
|
3629
3629
|
const a="string"==typeof e?e:e?.[r],o=e?.[r]??""
|
|
@@ -3633,35 +3633,35 @@ showTick:h}):t.createElement(Lm,{key:a,value:o||a,disabled:!!e.disabled,
|
|
|
3633
3633
|
showTick:h},p(e,"list-item")))})))))),t.createElement(Qd,{
|
|
3634
3634
|
className:"SelectScrollButton"},t.createElement(nc,{fill:n.colors.text.primary
|
|
3635
3635
|
})))))),w&&z&&t.createElement(Oc,null,z))
|
|
3636
|
-
},Dm=({itemIdentifier:e="id",label:n,id:r,items:a=[],placeholder:o,readOnly:i=!1,disabled:l=!1,isRequired:c=!1,hideClear:s=!1,itemToString:u,name:d,filterKey:h,width:p,customValues:f,onCustomValueAdd:m,itemComponent:v,emptyItemsText:g,getCustomMessage:y,onChange:b,useComboboxProps:w,isErrored:C,errorText:z,defaultSelectedItem:M,isMenuLoading:x})=>{
|
|
3637
|
-
const
|
|
3638
|
-
selectedItem:M,items:
|
|
3636
|
+
},Dm=({itemIdentifier:e="id",label:n,id:r,items:a=[],placeholder:o,readOnly:i=!1,disabled:l=!1,isRequired:c=!1,hideClear:s=!1,itemToString:u,name:d,filterKey:h,width:p,customValues:f,onCustomValueAdd:m,itemComponent:v,emptyItemsText:g,getCustomMessage:y,onChange:b,useComboboxProps:w,isErrored:C,errorText:z,defaultSelectedItem:M,isMenuLoading:x,contentProps:S})=>{
|
|
3637
|
+
const E=vn(),[_,H]=t.useState(a),{isOpen:D,selectedItem:L,getToggleButtonProps:V,getLabelProps:A,getMenuProps:k,openMenu:T,highlightedIndex:P,setHighlightedIndex:I,setInputValue:R,inputValue:O,getItemProps:N,getInputProps:F}=Nf({
|
|
3638
|
+
selectedItem:M,items:_,onSelectedItemChange:({selectedItem:e})=>{
|
|
3639
3639
|
console.log("onSelectedItemChange",{sI:e}),b?.(e??null)},
|
|
3640
3640
|
onIsOpenChange:({isOpen:t})=>{
|
|
3641
|
-
if(t&&(""===
|
|
3642
|
-
|
|
3641
|
+
if(t&&(""===O||L&&h&&(O||"").toLowerCase()===`${L?.[h||e]||""}`.toLowerCase()))H(a),
|
|
3642
|
+
I(L?a.indexOf(L):-1);else{const e=L?u(L):"";L&&!t&&e!==O&&R(e)}t||H(a)},
|
|
3643
3643
|
onInputValueChange:({inputValue:t})=>{
|
|
3644
|
-
|
|
3645
|
-
},itemToString:e=>e?u(e,"downshift"):"",...w}),
|
|
3646
|
-
;return t.createElement(Ad,{width:p,isOpen:
|
|
3647
|
-
className:"input-label",...
|
|
3648
|
-
},n,c&&t.createElement(jn,null,"*")),t.createElement(bm,{...
|
|
3644
|
+
D&&(""===t||L&&h&&(t||"").toLowerCase()===`${L?.[h||e]||""}`.toLowerCase())?H(a):H((n=>n.filter((n=>!t||("string"==typeof n?n:n?.[h||e]).toLowerCase().includes(t.toLowerCase())))))
|
|
3645
|
+
},itemToString:e=>e?u(e,"downshift"):"",...w}),B=!l&&!i&&D
|
|
3646
|
+
;return t.createElement(Ad,{width:p,isOpen:B},t.createElement(Fn,{
|
|
3647
|
+
className:"input-label",...A({disabled:l,readOnly:i})
|
|
3648
|
+
},n,c&&t.createElement(jn,null,"*")),t.createElement(bm,{...F({name:d,
|
|
3649
3649
|
readOnly:i,disabled:l,id:r}),placeholder:o,
|
|
3650
|
-
endAdornment:t.createElement(Od,null,!l&&!i&&!s&&
|
|
3650
|
+
endAdornment:t.createElement(Od,null,!l&&!i&&!s&&L&&t.createElement(Un,{
|
|
3651
3651
|
onClick:e=>{
|
|
3652
|
-
console.log("onClick WORKING"),
|
|
3653
|
-
borderRadius:"50%"}},t.createElement(mr,{fill:
|
|
3654
|
-
})),t.createElement(Un,{...
|
|
3655
|
-
isOpen:
|
|
3656
|
-
}),!i&&!l&&t.createElement(Td,{isOpen:
|
|
3657
|
-
},x?t.createElement(Rd,null,t.createElement(Em,null)):t.createElement(t.Fragment,null,
|
|
3658
|
-
onClick:e=>{e.stopPropagation(),m&&m({inputValue:
|
|
3659
|
-
},y?.(
|
|
3660
|
-
},g||"No items")),
|
|
3661
|
-
;return t.createElement(t.Fragment,null,v?v(n,{isHilighted:
|
|
3662
|
-
isSelected:
|
|
3663
|
-
isHilighted:
|
|
3664
|
-
},u(n),
|
|
3652
|
+
console.log("onClick WORKING"),R(""),b?.(null),T(),e.stopPropagation()},style:{
|
|
3653
|
+
borderRadius:"50%"}},t.createElement(mr,{fill:E.colors.text.primary
|
|
3654
|
+
})),t.createElement(Un,{...V({disabled:l,readOnly:i})},t.createElement(Vd,{
|
|
3655
|
+
isOpen:B,fill:E.colors.text.primary,width:8,height:8})))
|
|
3656
|
+
}),!i&&!l&&t.createElement(Td,{isOpen:D,...S,...k({disabled:l,readOnly:i})
|
|
3657
|
+
},x?t.createElement(Rd,null,t.createElement(Em,null)):t.createElement(t.Fragment,null,D&&0===_.length&&t.createElement(t.Fragment,null,f?t.createElement(Pd,null,t.createElement(Id,{
|
|
3658
|
+
onClick:e=>{e.stopPropagation(),m&&m({inputValue:O,customValues:!0}),R("")}
|
|
3659
|
+
},y?.(O)||"Click to add")):t.createElement(Pd,{readOnly:!0
|
|
3660
|
+
},g||"No items")),D&&_.map(((n,r)=>{const a="string"==typeof n?n:n?.[e]
|
|
3661
|
+
;return t.createElement(t.Fragment,null,v?v(n,{isHilighted:P===r,
|
|
3662
|
+
isSelected:L===n,key:a,...N({item:n,index:r})}):t.createElement(Pd,{
|
|
3663
|
+
isHilighted:P===r,isSelected:L===n,key:a,...N({item:n,index:r})
|
|
3664
|
+
},u(n),L===n&&t.createElement(Jc,{fill:E.colors.common.accent})))
|
|
3665
3665
|
})))),C&&z&&t.createElement(Oc,null,z))
|
|
3666
3666
|
},Lm=t.forwardRef((({children:e,showTick:n=!0,...r},a)=>{const o=vn()
|
|
3667
3667
|
;return t.createElement($d,{className:"SelectItem",...r,ref:a
|