freemium-ui 2.0.91 → 2.1.0-alpha.1
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/lib/Accordion-Ccv-p2G6.js +134 -0
- package/lib/Accordion.d.ts +56 -0
- package/lib/Accordion.js +7 -0
- package/lib/Alert-BtEbkVK1.js +52 -0
- package/lib/Alert.d.ts +66 -0
- package/lib/Alert.js +6 -0
- package/lib/AutoComplete-DF33_uur.js +608 -0
- package/lib/AutoComplete.d.ts +105 -0
- package/lib/AutoComplete.js +14 -0
- package/lib/BoxedRadio-D5Kiintm.js +75 -0
- package/lib/BoxedRadio.d.ts +61 -0
- package/lib/BoxedRadio.js +10 -0
- package/lib/Button-Bd1O8_k7.js +34 -0
- package/lib/Button.d.ts +34 -0
- package/lib/Button.js +2 -0
- package/lib/ButtonDropdown-BZvCwUDe.js +37 -0
- package/lib/ButtonDropdown.d.ts +82 -0
- package/lib/ButtonDropdown.js +11 -0
- package/lib/Calendar-C0xW_pPO.js +32 -0
- package/lib/Calendar.d.ts +25 -0
- package/lib/Calendar.js +2 -0
- package/lib/Checkbox-By1CgFUJ.js +66 -0
- package/lib/Checkbox.d.ts +28 -0
- package/lib/Checkbox.js +7 -0
- package/lib/ChevronUp-BWiG3XYd.js +7 -0
- package/lib/Combination-AmN1Cqrf.js +210 -0
- package/lib/Confirmation-49GhlyzQ.js +66 -0
- package/lib/Confirmation.d.ts +72 -0
- package/lib/Confirmation.js +8 -0
- package/lib/Cross-CIeKwtq6.js +7 -0
- package/lib/CustomizeColumns-BSF8e_we.js +865 -0
- package/lib/Drawer-CnmXL5_B.js +33 -0
- package/lib/Drawer.d.ts +50 -0
- package/lib/Drawer.js +8 -0
- package/lib/Dropdown-D59u6zOt.js +89 -0
- package/lib/Dropdown.d.ts +162 -0
- package/lib/Dropdown.js +15 -0
- package/lib/ErrorText-Uvye7uop.js +8 -0
- package/lib/Info-BsILbpCG.js +9 -0
- package/lib/Input.d.ts +66 -0
- package/lib/Input.js +5 -0
- package/lib/Loader-b8lHCp4N.js +13 -0
- package/lib/Loader.d.ts +21 -0
- package/lib/Loader.js +3 -0
- package/lib/Menu-DoE00Mg-.js +19 -0
- package/lib/Menu.d.ts +80 -0
- package/lib/Menu.js +11 -0
- package/lib/Modal-D5RJHnbn.js +51 -0
- package/lib/Modal.d.ts +51 -0
- package/lib/Modal.js +7 -0
- package/lib/MultiSelectDropdown-DblSkVpv.js +84 -0
- package/lib/MultiSelectDropdown.d.ts +116 -0
- package/lib/MultiSelectDropdown.js +14 -0
- package/lib/Pickers.d.ts +94 -0
- package/lib/Pickers.js +16 -0
- package/lib/Popover-BU73-g73.js +90 -0
- package/lib/Popover.d.ts +94 -0
- package/lib/Popover.js +8 -0
- package/lib/QuillEditor.d.ts +29 -0
- package/lib/QuillEditor.js +3369 -0
- package/lib/Radio.d.ts +69 -0
- package/lib/Radio.js +10 -0
- package/lib/RadioGroup-DM_Y48_b.js +42 -0
- package/lib/Reorder-DUSHsq7i.js +697 -0
- package/lib/Reorder.d.ts +36 -0
- package/lib/Reorder.js +5 -0
- package/lib/SortDropdown-B0SSCJX6.js +17 -0
- package/lib/SortDropdown.d.ts +47 -0
- package/lib/SortDropdown.js +10 -0
- package/lib/Table-cidceyn5.js +117 -0
- package/lib/Table.d.ts +95 -0
- package/lib/Table.js +18 -0
- package/lib/Tabs-j1c7ybY-.js +50 -0
- package/lib/Tabs.d.ts +68 -0
- package/lib/Tabs.js +6 -0
- package/lib/Tag-Cu75ReQP.js +49 -0
- package/lib/Tag.d.ts +50 -0
- package/lib/Tag.js +4 -0
- package/lib/TextArea--fiwZ_QM.js +98 -0
- package/lib/ThemeProvider-bWL8hyYA.js +7 -0
- package/lib/ThemeProvider.d.ts +158 -0
- package/lib/ThemeProvider.js +9 -0
- package/lib/TickIcon-BJqSAG4_.js +7 -0
- package/lib/TimePicker-7Uqb3xJn.js +6598 -0
- package/lib/Toast.d.ts +61 -0
- package/lib/Toast.js +10 -0
- package/lib/ToastProvider-CMk1PSzB.js +264 -0
- package/lib/Toggle-BGV7Nc6t.js +59 -0
- package/lib/Toggle.d.ts +35 -0
- package/lib/Toggle.js +6 -0
- package/lib/Tooltip-DU_ATFRB.js +127 -0
- package/lib/Tooltip.d.ts +53 -0
- package/lib/Tooltip.js +8 -0
- package/lib/Typography-BcAppjDF.js +11 -0
- package/lib/Typography.d.ts +20 -0
- package/lib/Typography.js +2 -0
- package/lib/WorkspaceTable-BV5zccyt.js +100 -0
- package/lib/WorkspaceTable.d.ts +85 -0
- package/lib/WorkspaceTable.js +18 -0
- package/lib/_commonjsHelpers-fGXyuM93.js +4 -0
- package/lib/allPaths-DKtiSqHL.js +19 -0
- package/lib/allPathsLoader-Drb6xO2O.js +5 -0
- package/lib/index-B9EcTy5B.js +46 -0
- package/lib/index-BPxkexqj.js +60 -0
- package/lib/index-BROhcSiX.js +8 -0
- package/lib/index-BT1o947S.js +8 -0
- package/lib/index-BY9lf-do.js +2 -0
- package/lib/index-BdTXfGkV.js +24 -0
- package/lib/index-BnDw8kbT.js +135 -0
- package/lib/index-BrF1HKA1.js +338 -0
- package/lib/index-BxNZ3C71.js +4 -0
- package/lib/index-ByHJlnsx.js +26 -0
- package/lib/index-COoRg_pp.js +55 -0
- package/lib/index-CeIB4COQ.js +10 -0
- package/lib/index-Cjkk7z9c.js +19 -0
- package/lib/index-D6iTv28r.js +607 -0
- package/lib/index-D8E8s0tV.js +60 -0
- package/lib/index-DtILdK5l.js +48 -0
- package/lib/index-DtzckyT3.js +4 -0
- package/lib/index-Dy5ztCxm.js +27 -0
- package/lib/index-KMLwCm58.js +607 -0
- package/lib/index-_WvIFKTM.js +6 -0
- package/lib/index.d.ts +1826 -1842
- package/lib/index.js +54 -17049
- package/lib/isTypedArray-DN-UDJh5.js +89 -0
- package/lib/keyframes-PnzFl0I5.js +20 -0
- package/lib/package.json +133 -3
- package/lib/rollup.config.d.ts.map +1 -0
- package/lib/splitPathsBySizeLoader-Cm_vHo5k.js +23 -0
- package/lib/styled-components.browser.esm-Bq2p-e5F.js +479 -0
- package/lib/styles-BbwNLGy3.js +177 -0
- package/lib/styles-BlCCKAZq.js +1192 -0
- package/lib/use-toasts-GqvPVmSy.js +5 -0
- package/package.json +150 -12
- package/buildspec.yml +0 -22
- package/freemium-ui-2.0.91.tgz +0 -0
- package/lib/index.cjs.js +0 -17225
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import t from"react"
|
|
2
|
+
;import{u as n,_ as e,e as o}from"./styled-components.browser.esm-Bq2p-e5F.js"
|
|
3
|
+
;import{a as i,b as r,c as a,e as p}from"./index-BPxkexqj.js"
|
|
4
|
+
;import{f as x,g as l}from"./index-D8E8s0tV.js"
|
|
5
|
+
;import{a as c,t as m,i as s,j as f,k as u,l as d,m as g,n as h,o as y,p as v}from"./keyframes-PnzFl0I5.js"
|
|
6
|
+
;import{Z as b}from"./index-BnDw8kbT.js";var j,z,w,C,E={"top-center":{from:{
|
|
7
|
+
left:"50%",top:"16px",y:"-8px",x:"-50%"},enter:{left:"50%",top:"16px",y:"0",
|
|
8
|
+
x:"-50%"},leave:{left:"50%",top:"16px",y:"8px",x:"-50%"}},"top-left":{from:{
|
|
9
|
+
left:"16px",top:"16px",y:"-8px",x:"-8px"},enter:{left:"16px",top:"16px",y:"0",
|
|
10
|
+
x:"0"},leave:{left:"16px",top:"16px",y:"8px",x:"8px"}},"top-right":{from:{
|
|
11
|
+
right:"16px",top:"16px",y:"-8px",x:"8px"},enter:{right:"16px",top:"16px",y:"0",
|
|
12
|
+
x:"0"},leave:{right:"16px",top:"16px",y:"8px",x:"-8px"}},"center-center":{from:{
|
|
13
|
+
left:"50%",top:"50%",y:"-50%",x:"-50%"},enter:{left:"50%",top:"50%",y:"-50%",
|
|
14
|
+
x:"-50%"},leave:{left:"50%",top:"50%",y:"-50%",x:"-50%"}},"center-left":{from:{
|
|
15
|
+
left:"16px",top:"50%",y:"-50%",x:"-8px"},enter:{left:"16px",top:"50%",y:"-50%",
|
|
16
|
+
x:"0"},leave:{left:"16px",top:"50%",y:"-50%",x:"8px"}},"center-right":{from:{
|
|
17
|
+
right:"16px",top:"50%",y:"-50%",x:"8px"},enter:{right:"16px",top:"50%",y:"-50%",
|
|
18
|
+
x:"0"},leave:{right:"16px",top:"50%",y:"-50%",x:"-8px"}},"bottom-center":{from:{
|
|
19
|
+
left:"50%",bottom:"16px",y:"8px",x:"-50%"},enter:{left:"50%",bottom:"16px",
|
|
20
|
+
y:"0px",x:"-50%"},leave:{left:"50%",bottom:"16px",y:"-8px",x:"-50%"}},
|
|
21
|
+
"bottom-left":{from:{left:"16px",bottom:"16px",y:"8px",x:"-8px"},enter:{
|
|
22
|
+
left:"16px",bottom:"16px",y:"0",x:"0"},leave:{left:"16px",bottom:"16px",
|
|
23
|
+
y:"-8px",x:"8px"}},"bottom-right":{from:{right:"16px",bottom:"16px",y:"8px",
|
|
24
|
+
x:"8px"},enter:{right:"16px",bottom:"16px",y:"0",x:"0"},leave:{right:"16px",
|
|
25
|
+
bottom:"16px",y:"-8px",x:"-8px"}}},M={default:"512px",small:"424px",
|
|
26
|
+
medium:"600px",large:"800px","x-large":"1200px"},k={"top-center":m,"top-left":s,
|
|
27
|
+
"top-right":f,"center-center":u,"center-left":d,"center-right":g,
|
|
28
|
+
"bottom-center":h,"bottom-left":y,"bottom-right":v
|
|
29
|
+
},D=n(i)(j||(j=e([""],[""]))),O=n(r)(z||(z=e([""],[""]))),W=n(a)(w||(w=e(["\n ","\n"],["\n ","\n"])),x),I=n(p)(C||(C=e(["\n ","\n border-radius: 8px;\n max-width: ",";\n width: ",";\n max-height: 85vh;\n position: fixed;\n direction: ",";\n z-index: ",";\n transform: translate(\n ",",\n ","\n );\n top: ",";\n bottom: ",";\n left: ",";\n right: ",";\n animation-duration: ",";\n animation-timing-function: ",";\n &[data-state='open'] {\n animation-name: ",";\n }\n &[data-state='closed'] {\n animation-name: ",";\n }\n"],["\n ","\n border-radius: 8px;\n max-width: ",";\n width: ",";\n max-height: 85vh;\n position: fixed;\n direction: ",";\n z-index: ",";\n transform: translate(\n ",",\n ","\n );\n top: ",";\n bottom: ",";\n left: ",";\n right: ",";\n animation-duration: ",";\n animation-timing-function: ",";\n &[data-state='open'] {\n animation-name: ",";\n }\n &[data-state='closed'] {\n animation-name: ",";\n }\n"])),l,(function(t){
|
|
30
|
+
var n=t.size;return M[n]}),(function(t){return t.fullWidth?"100%":"unset"
|
|
31
|
+
}),(function(t){return t.theme.direction}),(function(t){
|
|
32
|
+
return t.theme.zIndex.modal||b.modal}),(function(t){var n=t.align,e=t.position
|
|
33
|
+
;return E["".concat(n,"-").concat(e)].enter.x}),(function(t){
|
|
34
|
+
var n=t.align,e=t.position;return E["".concat(n,"-").concat(e)].enter.y
|
|
35
|
+
}),(function(t){var n=t.align,e=t.position
|
|
36
|
+
;return E["".concat(n,"-").concat(e)].enter.top}),(function(t){
|
|
37
|
+
var n=t.align,e=t.position;return E["".concat(n,"-").concat(e)].enter.bottom
|
|
38
|
+
}),(function(t){var n=t.align,e=t.position
|
|
39
|
+
;return E["".concat(n,"-").concat(e)].enter.left}),(function(t){
|
|
40
|
+
var n=t.align,e=t.position;return E["".concat(n,"-").concat(e)].enter.right
|
|
41
|
+
}),(function(t){return t.theme.transitions.duration.standard}),(function(t){
|
|
42
|
+
return t.theme.transitions.easing.easeIn}),(function(t){
|
|
43
|
+
var n=t.align,e=t.position;return k["".concat(n,"-").concat(e)]
|
|
44
|
+
}),c),N=function(n){
|
|
45
|
+
var e=n.isOpen,i=n.children,r=n.align,a=void 0===r?"center":r,p=n.customClass,x=void 0===p?"":p,l=n.fullWidth,c=void 0!==l&&l,m=n.customModalContentStyles,s=void 0===m?{}:m,f=n.onDismiss,u=n.position,d=void 0===u?"center":u,g=n.size,h=o()
|
|
46
|
+
;return t.createElement(D,{open:e,onOpenChange:function(t){t||null==f||f()}
|
|
47
|
+
},t.createElement(O,null,t.createElement(W,{forceMount:!0,
|
|
48
|
+
className:"DialogOverlay",onClick:function(){return null==f?void 0:f()}
|
|
49
|
+
}),t.createElement(I,{forceMount:!0,dir:h.direction,
|
|
50
|
+
className:"DialogContent ".concat(null!=x?x:"").trim(),size:null!=g?g:"default",
|
|
51
|
+
fullWidth:c,align:a,position:d,style:s},i)))};export{N as M};
|
package/lib/Modal.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React$1 from 'react';
|
|
3
|
+
|
|
4
|
+
type ModalAlignType = 'top' | 'center' | 'bottom';
|
|
5
|
+
type ModalPositionType = 'left' | 'center' | 'right';
|
|
6
|
+
type ModalSizeType = 'default' | 'medium' | 'small' | 'large' | 'x-large';
|
|
7
|
+
interface ModalProps {
|
|
8
|
+
/**
|
|
9
|
+
* The children or label
|
|
10
|
+
*/
|
|
11
|
+
children?: React.ReactNode | string;
|
|
12
|
+
/**
|
|
13
|
+
* Is the button inline
|
|
14
|
+
*/
|
|
15
|
+
isOpen?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Is the button inline
|
|
18
|
+
*/
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Is the button inline
|
|
22
|
+
*/
|
|
23
|
+
align?: ModalAlignType;
|
|
24
|
+
/**
|
|
25
|
+
* Is the button inline
|
|
26
|
+
*/
|
|
27
|
+
position?: ModalPositionType;
|
|
28
|
+
/**
|
|
29
|
+
* Is the button inline
|
|
30
|
+
*/
|
|
31
|
+
size?: ModalSizeType;
|
|
32
|
+
/**
|
|
33
|
+
* How large should the button be?
|
|
34
|
+
*/
|
|
35
|
+
onDismiss?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* The children or label
|
|
38
|
+
*/
|
|
39
|
+
customClass?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The children or label
|
|
42
|
+
*/
|
|
43
|
+
customModalContentStyles?: React.CSSProperties;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Modals are used as an overlay to display information. It can also be used as confirm boxes to take user inputs.
|
|
48
|
+
*/
|
|
49
|
+
declare const Modal: ({ isOpen, children, align, customClass, fullWidth, customModalContentStyles, onDismiss, position, size, }: ModalProps) => React$1.JSX.Element;
|
|
50
|
+
|
|
51
|
+
export { Modal, type ModalAlignType, type ModalPositionType, type ModalProps, type ModalSizeType };
|
package/lib/Modal.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export{M as Modal}from"./Modal-D5RJHnbn.js";import"react"
|
|
2
|
+
;import"./styled-components.browser.esm-Bq2p-e5F.js";import"./index-BPxkexqj.js"
|
|
3
|
+
;import"./index-ByHJlnsx.js";import"react-dom";import"./index-CeIB4COQ.js"
|
|
4
|
+
;import"./index-BdTXfGkV.js";import"./index-BxNZ3C71.js"
|
|
5
|
+
;import"./index-COoRg_pp.js";import"./Combination-AmN1Cqrf.js"
|
|
6
|
+
;import"./index-Dy5ztCxm.js";import"./index-D8E8s0tV.js"
|
|
7
|
+
;import"./index-BnDw8kbT.js";import"./keyframes-PnzFl0I5.js";
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import{u as e,_ as n,e as t,b as l}from"./styled-components.browser.esm-Bq2p-e5F.js"
|
|
2
|
+
;import i from"react"
|
|
3
|
+
;import{p as o,u as a,D as r,q as s,o as d,I as c,j as u,L as m,T as p}from"./styles-BlCCKAZq.js"
|
|
4
|
+
;import{S as g,R as f,a as h}from"./index-D8E8s0tV.js"
|
|
5
|
+
;import{E as y}from"./ErrorText-Uvye7uop.js"
|
|
6
|
+
;import{C as v}from"./Cross-CIeKwtq6.js"
|
|
7
|
+
;import{T as C}from"./TickIcon-BJqSAG4_.js"
|
|
8
|
+
;import{L as I}from"./Loader-b8lHCp4N.js";import{T as w}from"./Tag-Cu75ReQP.js"
|
|
9
|
+
;var x,E,b=e.div(x||(x=n(["\n flex: 1;\n gap: 8px;\n display: flex;\n flex-wrap: wrap;\n direction: ",";\n input {\n color: ",";\n min-width: 150px;\n flex: 1;\n display: inline-block;\n outline: none;\n padding: 0 8px;\n margin: 0;\n border: none;\n background: none;\n font-weight: 500;\n font-family: ",";\n font-size: ",";\n line-height: ",";\n }\n"],["\n flex: 1;\n gap: 8px;\n display: flex;\n flex-wrap: wrap;\n direction: ",";\n input {\n color: ",";\n min-width: 150px;\n flex: 1;\n display: inline-block;\n outline: none;\n padding: 0 8px;\n margin: 0;\n border: none;\n background: none;\n font-weight: 500;\n font-family: ",";\n font-size: ",";\n line-height: ",";\n }\n"])),(function(e){
|
|
10
|
+
return e.theme.direction}),(function(e){return e.theme.colors.text.primary
|
|
11
|
+
}),(function(e){return e.theme.typography.fontFamily}),(function(e){
|
|
12
|
+
return e.theme.typography.primary.fontSize}),(function(e){
|
|
13
|
+
return e.theme.typography.primary.lineHeight}));e.span(E||(E=n([""],[""])))
|
|
14
|
+
;var S=function(e){
|
|
15
|
+
var n,x=e.itemIdentifier,E=void 0===x?"id":x,S=e.label,k=e.id,T=e.items,D=void 0===T?[]:T,P=e.onChange,O=e.placeholder,j=e.readOnly,K=void 0!==j&&j,L=e.disabled,M=void 0!==L&&L,B=e.isRequired,V=void 0!==B&&B,A=e.itemToString,F=e.name,$=e.filterKey,N=e.width,R=e.useComboboxProps,z=e.useMultipleSelectionProps,q=e.emptyItemsText,H=e.getCustomMessage,_=e.onCustomValueAdd,G=e.customValues,J=e.inputValue,Q=e.hideClear,U=e.hideArrow
|
|
16
|
+
;e.removeSelectedItem
|
|
17
|
+
;var W=e.defaultSelectedItems,X=void 0===W?[]:W,Y=e.handleInputChange,Z=e.isErrored,ee=e.isMenuLoading,ne=e.errorText,te=e.InputProps,le=e.itemComponent
|
|
18
|
+
;e.isDynamicMenu,e.locale,e.maxAllowedLength,e.minAllowedLength
|
|
19
|
+
;var ie=e.hideChips,oe=void 0!==ie&&ie,ae=e.hideSelectedItem,re=void 0!==ae&&ae,se=e.onBackSpace,de=t(),ce=i.useState(null!=J?J:""),ue=ce[0],me=ce[1],pe=o(l({
|
|
20
|
+
initialSelectedItems:X,onStateChange:function(e){var n=e.selectedItems
|
|
21
|
+
;switch(e.type){case o.stateChangeTypes.FunctionSetSelectedItems:
|
|
22
|
+
case o.stateChangeTypes.SelectedItemKeyDownBackspace:
|
|
23
|
+
case o.stateChangeTypes.SelectedItemKeyDownDelete:
|
|
24
|
+
case o.stateChangeTypes.DropdownKeyDownBackspace:
|
|
25
|
+
case o.stateChangeTypes.FunctionRemoveSelectedItem:
|
|
26
|
+
case o.stateChangeTypes.FunctionAddSelectedItem:n&&(null==P||P(n))}}
|
|
27
|
+
},z)),ge=pe.getSelectedItemProps,fe=pe.getDropdownProps,he=pe.selectedItems,ye=pe.removeSelectedItem,ve=pe.setSelectedItems,Ce=pe.addSelectedItem,Ie=i.useMemo((function(){
|
|
28
|
+
return D.filter((function(e){var n="string"==typeof e?e:null==e?void 0:e[$||E]
|
|
29
|
+
;return!(re&&he.some((function(n){
|
|
30
|
+
return(null==A?void 0:A(n))===(null==A?void 0:A(e))
|
|
31
|
+
})))&&(!ue||n.toLowerCase().includes(ue.toLowerCase()))}))
|
|
32
|
+
}),[D,ue,$,E,re,he,A]),we=a(l({id:k,items:Ie,itemToString:function(e){
|
|
33
|
+
return e&&A?A(e,"downshift"):""},selectedItem:null,inputValue:ue,
|
|
34
|
+
stateReducer:function(e,n){var t=n.changes;switch(n.type){
|
|
35
|
+
case a.stateChangeTypes.InputKeyDownEnter:case a.stateChangeTypes.ItemClick:
|
|
36
|
+
return l(l({},t),{isOpen:!ue});default:return t}},onStateChange:function(e){
|
|
37
|
+
var n=e.inputValue,t=e.type,l=e.selectedItem;switch(t){
|
|
38
|
+
case a.stateChangeTypes.InputKeyDownEnter:case a.stateChangeTypes.ItemClick:
|
|
39
|
+
case a.stateChangeTypes.InputBlur:l&&(he.find((function(e){
|
|
40
|
+
return(null==e?void 0:e[E])===(null==l?void 0:l[E])
|
|
41
|
+
}))?ye(l):Ce(l),me(""),null==Y||Y(""));break
|
|
42
|
+
;case a.stateChangeTypes.InputChange:
|
|
43
|
+
me(null!=n?n:""),null==Y||Y(null!=n?n:""),Ie.length||n||Ee()}}
|
|
44
|
+
},R)),xe=we.isOpen,Ee=we.closeMenu,be=we.getToggleButtonProps,Se=we.getLabelProps,ke=we.getMenuProps,Te=we.getInputProps,De=we.highlightedIndex,Pe=we.getItemProps,Oe=!M&&!K&&xe,je=Te(fe({
|
|
45
|
+
preventKeyAction:xe,name:F,disabled:M,readOnly:K,dir:de.direction
|
|
46
|
+
})),Ke=function(e){if(e&&G&&_&&De<0){var n=_({inputValue:e,customValues:!0})
|
|
47
|
+
;Ce(n),me("")}};return i.createElement(r,{width:N},i.createElement(g,l({
|
|
48
|
+
className:"input-label"},Se({disabled:M,readOnly:K,dir:de.direction
|
|
49
|
+
})),S,S&&V&&i.createElement(f,null,"*")),i.createElement(s,{disabled:M,
|
|
50
|
+
$isErrored:!!Z,"aria-invalid":Z,className:"dropdown-toggle-button"
|
|
51
|
+
},i.createElement(b,null,!oe&&he.map((function(e,n){var t
|
|
52
|
+
;return i.createElement(w,l({key:"selected-item-".concat(n)},ge({selectedItem:e,
|
|
53
|
+
index:n,dir:de.direction}),{"aria-disabled":M,"aria-readonly":K,iconProps:{
|
|
54
|
+
"aria-disabled":M,disabled:M},onClose:function(n){
|
|
55
|
+
M||K||(n.stopPropagation(),ye(e))}
|
|
56
|
+
}),null!==(t=null==A?void 0:A(e))&&void 0!==t?t:"")
|
|
57
|
+
})),i.createElement("input",l({placeholder:O},je,te,{onKeyDown:function(e){
|
|
58
|
+
var n,t
|
|
59
|
+
;"Backspace"!==e.key||ue||(ye(he[he.length-1]),null==se||se()),"Enter"===e.key&&Ke(ue),
|
|
60
|
+
null===(n=null==je?void 0:je.onKeyDown)||void 0===n||n.call(je,e),
|
|
61
|
+
null===(t=null==te?void 0:te.onKeyDown)||void 0===t||t.call(te,e)},
|
|
62
|
+
onClick:function(e){var n,t
|
|
63
|
+
;null===(n=null==je?void 0:je.onClick)||void 0===n||n.call(je,e),
|
|
64
|
+
null===(t=null==te?void 0:te.onClick)||void 0===t||t.call(te,e),
|
|
65
|
+
Ie.length||ue||Ee()}}))),!Q&&i.createElement(h,{"aria-label":"Clear",
|
|
66
|
+
onClick:function(e){ve([]),me(""),e.stopPropagation(),e.preventDefault()}
|
|
67
|
+
},i.createElement(v,{fill:de.colors.text.primary
|
|
68
|
+
})),!U&&i.createElement(h,l({},be({disabled:M,readOnly:K,dir:de.direction
|
|
69
|
+
})),i.createElement(d,{$isOpen:Oe,fill:de.colors.text.primary,width:8,height:8
|
|
70
|
+
}))),!K&&!M&&i.createElement(c,l({className:"ItemsContainer",$isOpen:xe},ke({
|
|
71
|
+
disabled:M,readOnly:K,dir:de.direction
|
|
72
|
+
})),ee?i.createElement(u,null,i.createElement(I,null)):i.createElement(i.Fragment,null,xe&&(0===Ie.length||G)&&i.createElement(m,{
|
|
73
|
+
readOnly:!0},G?i.createElement(p,{tabIndex:0,onClick:function(e){var n
|
|
74
|
+
;e.stopPropagation(),
|
|
75
|
+
Ke(ue),ue&&(null===(n=null==je?void 0:je.onClick)||void 0===n||n.call(je,e))}
|
|
76
|
+
},null!==(n=null==H?void 0:H(ue))&&void 0!==n?n:"Click to add"):null!=q?q:"No items"),xe&&Ie.map((function(e,n){
|
|
77
|
+
var t,o,a,r="string"==typeof e?"".concat(e).concat(n).trim():"".concat(null!==(t=null==e?void 0:e[E])&&void 0!==t?t:"").concat(n).trim(),s=he.map((function(e){
|
|
78
|
+
return null==e?void 0:e[E]
|
|
79
|
+
})).filter(Boolean).indexOf(null!==(o=null==e?void 0:e[E])&&void 0!==o?o:"")>-1
|
|
80
|
+
;return i.createElement(m,l({$isHilighted:De===n,$isSelected:s,key:r},Pe({
|
|
81
|
+
item:e,index:n,dir:de.direction
|
|
82
|
+
})),le?le(e):i.createElement(i.Fragment,null,null!==(a=null==A?void 0:A(e))&&void 0!==a?a:"",s&&i.createElement(C,{
|
|
83
|
+
fill:de.colors.common.accent})))})))),Z&&ne&&i.createElement(y,null,ne))}
|
|
84
|
+
;export{S as M};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React$1 from 'react';
|
|
3
|
+
import { UseMultipleSelectionProps, UseComboboxProps } from 'downshift';
|
|
4
|
+
|
|
5
|
+
type DefaultMultiSelectDropdownItem = {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
interface MultiSelectDropdownProps<T extends DefaultMultiSelectDropdownItem = DefaultMultiSelectDropdownItem> {
|
|
9
|
+
/**
|
|
10
|
+
* dropdown item content
|
|
11
|
+
*/
|
|
12
|
+
items?: Array<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Id of the item
|
|
15
|
+
*/
|
|
16
|
+
itemIdentifier?: string;
|
|
17
|
+
/**
|
|
18
|
+
* selected item of dropdown
|
|
19
|
+
*/
|
|
20
|
+
defaultSelectedItems?: T[];
|
|
21
|
+
/**
|
|
22
|
+
* Called when select an option or input value change
|
|
23
|
+
*/
|
|
24
|
+
onChange?: (item: T[]) => void;
|
|
25
|
+
itemToString?: (item: T, type?: 'list-item' | 'display' | 'downshift') => string;
|
|
26
|
+
/**
|
|
27
|
+
* Fuction to give the string representation of the item
|
|
28
|
+
*/
|
|
29
|
+
itemComponent?: (item: T) => React.ReactNode | string;
|
|
30
|
+
/**
|
|
31
|
+
* Is the dropdown readonly
|
|
32
|
+
*/
|
|
33
|
+
readOnly?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether disabled select
|
|
36
|
+
*/
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* name of the drowpdown
|
|
40
|
+
*/
|
|
41
|
+
name?: string;
|
|
42
|
+
/**
|
|
43
|
+
* width of the multi select drowpdown
|
|
44
|
+
*/
|
|
45
|
+
width?: string;
|
|
46
|
+
filterKey?: string;
|
|
47
|
+
getCustomMessage?: (inoutValue: string) => string;
|
|
48
|
+
/**
|
|
49
|
+
* Empty items text box
|
|
50
|
+
*/
|
|
51
|
+
emptyItemsText?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to allow hide or clear when click
|
|
54
|
+
*/
|
|
55
|
+
hideClear?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether to hide or show arrow
|
|
58
|
+
*/
|
|
59
|
+
hideArrow?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Error text to be shown
|
|
62
|
+
*/
|
|
63
|
+
errorText?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Is this a error field?
|
|
66
|
+
*/
|
|
67
|
+
isErrored?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Is this a required field?
|
|
70
|
+
*/
|
|
71
|
+
isRequired?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Is menu loading?
|
|
74
|
+
*/
|
|
75
|
+
isMenuLoading?: boolean;
|
|
76
|
+
inputValue?: string | null;
|
|
77
|
+
handleInputChange?: (inputValue: string) => void;
|
|
78
|
+
onCustomValueAdd?: (item: {
|
|
79
|
+
inputValue: string;
|
|
80
|
+
customValues: boolean;
|
|
81
|
+
}) => T;
|
|
82
|
+
removeSelectedItem?: (item: T, index: number) => void;
|
|
83
|
+
/**
|
|
84
|
+
* Is this custom value
|
|
85
|
+
*/
|
|
86
|
+
customValues?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* id of the drowpdown
|
|
89
|
+
*/
|
|
90
|
+
id?: string;
|
|
91
|
+
/**
|
|
92
|
+
* label for the drowpdown
|
|
93
|
+
*/
|
|
94
|
+
label?: string;
|
|
95
|
+
placeholder?: string;
|
|
96
|
+
useMultipleSelectionProps?: UseMultipleSelectionProps<T>;
|
|
97
|
+
useComboboxProps?: UseComboboxProps<T>;
|
|
98
|
+
InputProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
99
|
+
onBackSpace?: () => void;
|
|
100
|
+
maxAllowedLength?: number;
|
|
101
|
+
isDynamicMenu?: boolean;
|
|
102
|
+
minAllowedLength?: number;
|
|
103
|
+
locale?: {
|
|
104
|
+
createText: string;
|
|
105
|
+
deleteText: string;
|
|
106
|
+
};
|
|
107
|
+
hideChips?: boolean;
|
|
108
|
+
hideSelectedItem?: boolean;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* MultiSelectDropdown displays a list or drop-down box that enables selection of an option or multiple options from an available list of values.
|
|
113
|
+
*/
|
|
114
|
+
declare const MultiSelectDropdown: <T extends DefaultMultiSelectDropdownItem>({ itemIdentifier, label, id, items, onChange, placeholder, readOnly, disabled, isRequired, itemToString, name, filterKey, width, useComboboxProps, useMultipleSelectionProps, emptyItemsText, getCustomMessage, onCustomValueAdd, customValues, inputValue: iV, hideClear, hideArrow, removeSelectedItem: rSelectedItem, defaultSelectedItems, handleInputChange, isErrored, isMenuLoading, errorText, InputProps, itemComponent, isDynamicMenu, locale, maxAllowedLength, minAllowedLength, hideChips, hideSelectedItem, onBackSpace, }: MultiSelectDropdownProps<T>) => React$1.JSX.Element;
|
|
115
|
+
|
|
116
|
+
export { type DefaultMultiSelectDropdownItem, MultiSelectDropdown, type MultiSelectDropdownProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export{M as MultiSelectDropdown}from"./MultiSelectDropdown-DblSkVpv.js"
|
|
2
|
+
;import"./styled-components.browser.esm-Bq2p-e5F.js";import"react"
|
|
3
|
+
;import"./styles-BlCCKAZq.js";import"./index-ByHJlnsx.js";import"react-dom"
|
|
4
|
+
;import"./_commonjsHelpers-fGXyuM93.js";import"./index-CeIB4COQ.js"
|
|
5
|
+
;import"./index-BdTXfGkV.js";import"./index-Cjkk7z9c.js"
|
|
6
|
+
;import"./index-BY9lf-do.js";import"./index-COoRg_pp.js"
|
|
7
|
+
;import"./Combination-AmN1Cqrf.js";import"./index-BxNZ3C71.js"
|
|
8
|
+
;import"./index-BrF1HKA1.js";import"./index-BROhcSiX.js"
|
|
9
|
+
;import"./index-DtzckyT3.js";import"./index-_WvIFKTM.js"
|
|
10
|
+
;import"./keyframes-PnzFl0I5.js";import"./index-BnDw8kbT.js"
|
|
11
|
+
;import"./ChevronUp-BWiG3XYd.js";import"./index-D8E8s0tV.js"
|
|
12
|
+
;import"./ErrorText-Uvye7uop.js";import"./Cross-CIeKwtq6.js"
|
|
13
|
+
;import"./TickIcon-BJqSAG4_.js";import"./Loader-b8lHCp4N.js"
|
|
14
|
+
;import"./Tag-Cu75ReQP.js";
|
package/lib/Pickers.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DateInput3Props, DateRangeInput3Props, TimePrecision } from '@blueprintjs/datetime2';
|
|
3
|
+
|
|
4
|
+
type DefaultProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Is this a required field?
|
|
7
|
+
*/
|
|
8
|
+
isRequired?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Is this a error field?
|
|
11
|
+
*/
|
|
12
|
+
isErrored?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Error text to be shown
|
|
15
|
+
*/
|
|
16
|
+
errorText?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Id of the date picker
|
|
19
|
+
*/
|
|
20
|
+
id?: string;
|
|
21
|
+
/**
|
|
22
|
+
* name of the date picker
|
|
23
|
+
*/
|
|
24
|
+
name?: string;
|
|
25
|
+
/**
|
|
26
|
+
* label for the picker
|
|
27
|
+
*/
|
|
28
|
+
label?: string;
|
|
29
|
+
language?: string;
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Today's date according to the user's timezone in the YYYY-MM-DD format
|
|
33
|
+
*/
|
|
34
|
+
dateToHilight?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Whether disabled select
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
portalContainer?: HTMLElement;
|
|
40
|
+
cancelButtonText?: string;
|
|
41
|
+
updateButtonText?: string;
|
|
42
|
+
};
|
|
43
|
+
type DatePickerProps = DefaultProps & Partial<DateInput3Props> & {
|
|
44
|
+
displayFormat?: string;
|
|
45
|
+
useTime?: boolean;
|
|
46
|
+
};
|
|
47
|
+
type DateRangePickerProps = DefaultProps & Partial<DateRangeInput3Props> & {
|
|
48
|
+
displayFormat?: string;
|
|
49
|
+
useTime?: boolean;
|
|
50
|
+
};
|
|
51
|
+
type DateTimePickerProps = DefaultProps & Partial<DateInput3Props> & {
|
|
52
|
+
displayFormat?: string;
|
|
53
|
+
};
|
|
54
|
+
type DateTimeRangePickerProps = DefaultProps & Partial<DateRangeInput3Props> & {
|
|
55
|
+
displayFormat?: string;
|
|
56
|
+
};
|
|
57
|
+
type TimePickerProps = DefaultProps & {
|
|
58
|
+
displayFormat?: string;
|
|
59
|
+
value?: string;
|
|
60
|
+
onChange?: (dateString: string | null) => void;
|
|
61
|
+
useAmPm?: boolean;
|
|
62
|
+
precision?: TimePrecision;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Datepicker displays an input box with a calendar that enables selecting a date or date range. The values preselected in the input box and calendar are based on the fw-datepicker attribute values.
|
|
67
|
+
* All the date formats passed as attribute's values must be valid ISO Date format (opens new window).
|
|
68
|
+
*/
|
|
69
|
+
declare const DatePicker: (props: DatePickerProps) => React.JSX.Element;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* DateTimePicker displays an input box with a calendar that enables selecting a date or date range. The values preselected in the input box and calendar are based on the fw-datepicker attribute values.
|
|
73
|
+
* All the date formats passed as attribute's values must be valid ISO Date format (opens new window).
|
|
74
|
+
*/
|
|
75
|
+
declare const DateTimePicker: (props: DateTimePickerProps) => React.JSX.Element;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* DateRangePicker displays an input box with a calendar that enables selecting a date or date range. The values preselected in the input box and calendar are based on the fw-datepicker attribute values.
|
|
79
|
+
* All the date formats passed as attribute's values must be valid ISO Date format (opens new window).
|
|
80
|
+
*/
|
|
81
|
+
declare const DateRangePicker: (props: DateRangePickerProps) => React.JSX.Element;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* DateTimeRangePicker displays an input box with a calendar that enables selecting a date or date range. The values preselected in the input box and calendar are based on the fw-datepicker attribute values.
|
|
85
|
+
* All the date formats passed as attribute's values must be valid ISO Date format (opens new window).
|
|
86
|
+
*/
|
|
87
|
+
declare const DateTimeRangePicker: (props: DateTimeRangePickerProps) => React.JSX.Element;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* TimePicker displays an input box with a calendar that enables selecting a date or date range. The values preselected in the input box and calendar are based on the fw-datepicker attribute values.
|
|
91
|
+
*/
|
|
92
|
+
declare const TimePicker: (props: TimePickerProps) => React.JSX.Element;
|
|
93
|
+
|
|
94
|
+
export { DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, DateTimePicker, type DateTimePickerProps, DateTimeRangePicker, type DateTimeRangePickerProps, type DefaultProps, TimePicker, type TimePickerProps };
|
package/lib/Pickers.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export{D as DatePicker,b as DateRangePicker,a as DateTimePicker,c as DateTimeRangePicker,T as TimePicker}from"./TimePicker-7Uqb3xJn.js"
|
|
2
|
+
;import"./styled-components.browser.esm-Bq2p-e5F.js";import"react"
|
|
3
|
+
;import"./index-BT1o947S.js";import"./index-BnDw8kbT.js"
|
|
4
|
+
;import"./index-D8E8s0tV.js";import"./index-ByHJlnsx.js";import"react-dom"
|
|
5
|
+
;import"./keyframes-PnzFl0I5.js";import"./ErrorText-Uvye7uop.js"
|
|
6
|
+
;import"./Button-Bd1O8_k7.js";import"./_commonjsHelpers-fGXyuM93.js"
|
|
7
|
+
;import"./isTypedArray-DN-UDJh5.js";import"./styles-BlCCKAZq.js"
|
|
8
|
+
;import"./index-CeIB4COQ.js";import"./index-BdTXfGkV.js"
|
|
9
|
+
;import"./index-Cjkk7z9c.js";import"./index-BY9lf-do.js"
|
|
10
|
+
;import"./index-COoRg_pp.js";import"./Combination-AmN1Cqrf.js"
|
|
11
|
+
;import"./index-BxNZ3C71.js";import"./index-BrF1HKA1.js"
|
|
12
|
+
;import"./index-BROhcSiX.js";import"./index-DtzckyT3.js"
|
|
13
|
+
;import"./index-_WvIFKTM.js";import"./ChevronUp-BWiG3XYd.js"
|
|
14
|
+
;import"./Dropdown-D59u6zOt.js";import"./Cross-CIeKwtq6.js"
|
|
15
|
+
;import"./TickIcon-BJqSAG4_.js";import"./TextArea--fiwZ_QM.js"
|
|
16
|
+
;import"./Loader-b8lHCp4N.js";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import{u as o,_ as n,f as e,e as t,b as r}from"./styled-components.browser.esm-Bq2p-e5F.js"
|
|
2
|
+
|
|
3
|
+
;import a,{useRef as i,useState as s,createElement as l,useCallback as d,forwardRef as p,useEffect as c}from"react"
|
|
4
|
+
;import{T as u}from"./index-D8E8s0tV.js"
|
|
5
|
+
;import{$ as m,a as v,_ as f,b as h}from"./index-ByHJlnsx.js"
|
|
6
|
+
;import{a as g,$ as x}from"./index-CeIB4COQ.js"
|
|
7
|
+
;import{$ as b}from"./index-BdTXfGkV.js"
|
|
8
|
+
;import{a as P,$ as C}from"./index-COoRg_pp.js"
|
|
9
|
+
;import{h as O,R as _,$ as w,a as F}from"./Combination-AmN1Cqrf.js"
|
|
10
|
+
;import{$ as E}from"./index-BxNZ3C71.js"
|
|
11
|
+
;import{$ as y,a as D,b as A,c as j,d as k}from"./index-BrF1HKA1.js"
|
|
12
|
+
;import{$ as I}from"./index-Dy5ztCxm.js"
|
|
13
|
+
;import{s as M,q as T,r as R,u as $,a as z}from"./keyframes-PnzFl0I5.js"
|
|
14
|
+
;import{h as K}from"./index-BnDw8kbT.js"
|
|
15
|
+
;const N="Popover",[q,B]=b(N,[y]),L=y(),[S,U]=q(N),W=p(((o,n)=>{
|
|
16
|
+
const{__scopePopover:e,...t}=o,r=U("PopoverTrigger",e),a=L(e),i=m(n,r.triggerRef),s=l(v.button,f({
|
|
17
|
+
type:"button","aria-haspopup":"dialog","aria-expanded":r.open,
|
|
18
|
+
"aria-controls":r.contentId,"data-state":oo(r.open)},t,{ref:i,
|
|
19
|
+
onClick:x(o.onClick,r.onOpenToggle)}));return r.hasCustomAnchor?s:l(A,f({
|
|
20
|
+
asChild:!0},a),s)})),Z="PopoverPortal",[G,H]=q(Z,{forceMount:void 0
|
|
21
|
+
}),J="PopoverContent",Q=p(((o,n)=>{
|
|
22
|
+
const e=H(J,o.__scopePopover),{forceMount:t=e.forceMount,...r}=o,a=U(J,o.__scopePopover)
|
|
23
|
+
;return l(I,{present:t||a.open},a.modal?l(V,f({},r,{ref:n})):l(X,f({},r,{ref:n
|
|
24
|
+
})))})),V=p(((o,n)=>{const e=U(J,o.__scopePopover),t=i(null),r=m(n,t),a=i(!1)
|
|
25
|
+
;return c((()=>{const o=t.current;if(o)return O(o)}),[]),l(_,{as:h,
|
|
26
|
+
allowPinchZoom:!0},l(Y,f({},o,{ref:r,trapFocus:e.open,
|
|
27
|
+
disableOutsidePointerEvents:!0,onCloseAutoFocus:x(o.onCloseAutoFocus,(o=>{var n
|
|
28
|
+
;o.preventDefault(),
|
|
29
|
+
a.current||null===(n=e.triggerRef.current)||void 0===n||n.focus()})),
|
|
30
|
+
onPointerDownOutside:x(o.onPointerDownOutside,(o=>{
|
|
31
|
+
const n=o.detail.originalEvent,e=0===n.button&&!0===n.ctrlKey,t=2===n.button||e
|
|
32
|
+
;a.current=t}),{checkForDefaultPrevented:!1}),
|
|
33
|
+
onFocusOutside:x(o.onFocusOutside,(o=>o.preventDefault()),{
|
|
34
|
+
checkForDefaultPrevented:!1})})))})),X=p(((o,n)=>{
|
|
35
|
+
const e=U(J,o.__scopePopover),t=i(!1),r=i(!1);return l(Y,f({},o,{ref:n,
|
|
36
|
+
trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:n=>{var a,i
|
|
37
|
+
;(null===(a=o.onCloseAutoFocus)||void 0===a||a.call(o,n),
|
|
38
|
+
n.defaultPrevented)||(t.current||null===(i=e.triggerRef.current)||void 0===i||i.focus(),
|
|
39
|
+
n.preventDefault());t.current=!1,r.current=!1},onInteractOutside:n=>{var a,i
|
|
40
|
+
;null===(a=o.onInteractOutside)||void 0===a||a.call(o,n),
|
|
41
|
+
n.defaultPrevented||(t.current=!0,
|
|
42
|
+
"pointerdown"===n.detail.originalEvent.type&&(r.current=!0));const s=n.target
|
|
43
|
+
;(null===(i=e.triggerRef.current)||void 0===i?void 0:i.contains(s))&&n.preventDefault(),
|
|
44
|
+
"focusin"===n.detail.originalEvent.type&&r.current&&n.preventDefault()}}))
|
|
45
|
+
})),Y=p(((o,n)=>{
|
|
46
|
+
const{__scopePopover:e,trapFocus:t,onOpenAutoFocus:r,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEscapeKeyDown:s,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:c,...u}=o,m=U(J,e),v=L(e)
|
|
47
|
+
;return w(),l(F,{asChild:!0,loop:!0,trapped:t,onMountAutoFocus:r,
|
|
48
|
+
onUnmountAutoFocus:a},l(C,{asChild:!0,disableOutsidePointerEvents:i,
|
|
49
|
+
onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:d,onFocusOutside:p,
|
|
50
|
+
onDismiss:()=>m.onOpenChange(!1)},l(j,f({"data-state":oo(m.open),role:"dialog",
|
|
51
|
+
id:m.contentId},v,u,{ref:n,style:{...u.style,
|
|
52
|
+
"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)",
|
|
53
|
+
"--radix-popover-content-available-width":"var(--radix-popper-available-width)",
|
|
54
|
+
"--radix-popover-content-available-height":"var(--radix-popper-available-height)",
|
|
55
|
+
"--radix-popover-trigger-width":"var(--radix-popper-anchor-width)",
|
|
56
|
+
"--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}))))}))
|
|
57
|
+
;function oo(o){return o?"open":"closed"}const no=o=>{
|
|
58
|
+
const{__scopePopover:n,children:e,open:t,defaultOpen:r,onOpenChange:a,modal:p=!1}=o,c=L(n),u=i(null),[m,v]=s(!1),[f=!1,h]=g({
|
|
59
|
+
prop:t,defaultProp:r,onChange:a});return l(D,c,l(S,{scope:n,contentId:E(),
|
|
60
|
+
triggerRef:u,open:f,onOpenChange:h,onOpenToggle:d((()=>h((o=>!o))),[h]),
|
|
61
|
+
hasCustomAnchor:m,onCustomAnchorAdd:d((()=>v(!0)),[]),
|
|
62
|
+
onCustomAnchorRemove:d((()=>v(!1)),[]),modal:p},e))},eo=W,to=o=>{
|
|
63
|
+
const{__scopePopover:n,forceMount:e,children:t,container:r}=o,a=U(Z,n)
|
|
64
|
+
;return l(G,{scope:n,forceMount:e},l(I,{present:e||a.open},l(P,{asChild:!0,
|
|
65
|
+
container:r},t)))},ro=p(((o,n)=>{
|
|
66
|
+
const{__scopePopover:e,...t}=o,r=U("PopoverClose",e);return l(v.button,f({
|
|
67
|
+
type:"button"},t,{ref:n,onClick:x(o.onClick,(()=>r.onOpenChange(!1)))}))
|
|
68
|
+
})),ao=p(((o,n)=>{const{__scopePopover:e,...t}=o,r=L(e);return l(k,f({},r,t,{
|
|
69
|
+
ref:n}))}))
|
|
70
|
+
;var io,so,lo,po,co,uo,mo,vo=o(Q)(so||(so=n(["\n background: ",";\n color: ",";\n border-radius: 8px;\n box-shadow:\n "," 0px 10px 38px -10px,\n "," 0px 10px 20px -15px;\n animation-duration: ",";\n animation-timing-function: ",";\n will-change: transform, opacity;\n &[data-state='open'][data-side='top'] {\n animation-name: ",";\n }\n &[data-state='open'][data-side='right'] {\n animation-name: ",";\n }\n &[data-state='open'][data-side='bottom'] {\n animation-name: ",";\n }\n &[data-state='open'][data-side='left'] {\n animation-name: ",";\n }\n &[data-state='closed'] {\n animation-name: ",";\n }\n\n ","\n"],["\n background: ",";\n color: ",";\n border-radius: 8px;\n box-shadow:\n "," 0px 10px 38px -10px,\n "," 0px 10px 20px -15px;\n animation-duration: ",";\n animation-timing-function: ",";\n will-change: transform, opacity;\n &[data-state='open'][data-side='top'] {\n animation-name: ",";\n }\n &[data-state='open'][data-side='right'] {\n animation-name: ",";\n }\n &[data-state='open'][data-side='bottom'] {\n animation-name: ",";\n }\n &[data-state='open'][data-side='left'] {\n animation-name: ",";\n }\n &[data-state='closed'] {\n animation-name: ",";\n }\n\n ","\n"])),(function(o){
|
|
71
|
+
return o.theme.colors.fill.surface}),(function(o){
|
|
72
|
+
return o.theme.colors.text.primary}),(function(o){var n=o.theme
|
|
73
|
+
;return K(n.colors.shadow,.35)}),(function(o){var n=o.theme
|
|
74
|
+
;return K(n.colors.shadow,.2)}),(function(o){
|
|
75
|
+
return o.theme.transitions.duration.standard}),(function(o){
|
|
76
|
+
return o.theme.transitions.easing.easeIn}),M,T,R,$,z,(function(o){var t=o.theme
|
|
77
|
+
;return"dark"===t.mode&&e(io||(io=n(["\n border: 1px solid ",";\n "],["\n border: 1px solid ",";\n "])),t.colors.border.light)
|
|
78
|
+
})),fo=o(ao)(lo||(lo=n(["\n fill: ",";\n"],["\n fill: ",";\n"])),(function(o){
|
|
79
|
+
return o.theme.colors.fill.surface
|
|
80
|
+
})),ho=o(no)(po||(po=n([""],[""]))),go=o(eo)(co||(co=n([""],[""]))),xo=o(to)(uo||(uo=n([""],[""]))),bo=o(ro)(mo||(mo=n([""],[""]))),Po=function(o){
|
|
81
|
+
var n,e,i,s,l=o.children,d=o.trigger,p=o.arrow,c=o.hoverOutToClose,m=o.align,v=o.hoverToOpen,f=o.avoidCollisions,h=void 0===f||f,g=o.replaceTrigger,x=void 0!==g&&g,b=o.side,P=o.disabled,C=o.onClose,O=o.popoverContentProps,_=o.popoverRootProps,w=o.anchorOrigin,F=a.useState(!1),E=F[0],y=F[1],D=null!==(s=null!==(i=null!==(e=null!==(n=null!=b?b:"bottom"===(null==w?void 0:w.vertical)&&w.horizontal?"bottom":void 0)&&void 0!==n?n:"top"===(null==w?void 0:w.vertical)&&w.horizontal?"top":void 0)&&void 0!==e?e:"center"===(null==w?void 0:w.vertical)&&"left"===w.horizontal?"left":void 0)&&void 0!==i?i:"center"===(null==w?void 0:w.vertical)&&"right"===w.horizontal?"right":void 0)&&void 0!==s?s:"bottom",A=t()
|
|
82
|
+
;return a.createElement(ho,r({open:E,onOpenChange:function(o){y(o)}
|
|
83
|
+
},_),x?a.createElement(a.Fragment,null,d):a.createElement(go,{dir:A.direction,
|
|
84
|
+
asChild:!0,className:"PopoverTrigger",disabled:P},a.createElement(u,{
|
|
85
|
+
className:"TriggerButtonWrapper",onMouseEnter:function(){v&&y(!0)}
|
|
86
|
+
},d)),a.createElement(xo,null,a.createElement(vo,r({forceMount:!0,
|
|
87
|
+
className:"PopoverContent","data-popover-content":!0,dir:A.direction,
|
|
88
|
+
onMouseLeave:function(){c&&(y(!1),null==C||C())},onInteractOutside:function(){
|
|
89
|
+
y(!1),null==C||C()},side:D,align:m,sideOffset:8,avoidCollisions:h
|
|
90
|
+
},O),l,p&&a.createElement(fo,null))))};export{Po as P,bo as a,go as b};
|
package/lib/Popover.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default from 'react';
|
|
4
|
+
import * as Popover$1 from '@radix-ui/react-popover';
|
|
5
|
+
import * as styled_components from 'styled-components';
|
|
6
|
+
import * as styled_components_dist_types from 'styled-components/dist/types';
|
|
7
|
+
|
|
8
|
+
type Origin = {
|
|
9
|
+
vertical?: 'top' | 'center' | 'bottom';
|
|
10
|
+
horizontal?: 'left' | 'center' | 'right';
|
|
11
|
+
};
|
|
12
|
+
interface PopoverProps {
|
|
13
|
+
/**
|
|
14
|
+
* How large should the button be?
|
|
15
|
+
*/
|
|
16
|
+
onClose?: (event?: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Which variant the button should be
|
|
19
|
+
*/
|
|
20
|
+
id?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Which variant the button should be
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
replaceTrigger?: boolean;
|
|
26
|
+
popoverContentProps?: Popover$1.PopoverContentProps;
|
|
27
|
+
popoverRootProps?: Popover$1.PopoverProps;
|
|
28
|
+
/**
|
|
29
|
+
* The children or label
|
|
30
|
+
*/
|
|
31
|
+
trigger: React.ReactNode | string;
|
|
32
|
+
/**
|
|
33
|
+
* The children or label
|
|
34
|
+
*/
|
|
35
|
+
children?: React.ReactNode | string;
|
|
36
|
+
/**
|
|
37
|
+
* Is the button inline
|
|
38
|
+
*/
|
|
39
|
+
hoverOutToClose?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Is the button inline
|
|
42
|
+
*/
|
|
43
|
+
hoverToOpen?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Is the button inline
|
|
46
|
+
*/
|
|
47
|
+
arrow?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Is the button inline
|
|
50
|
+
*/
|
|
51
|
+
avoidCollisions?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Is the button inline
|
|
54
|
+
*/
|
|
55
|
+
side?: Popover$1.PopperContentProps['side'];
|
|
56
|
+
/**
|
|
57
|
+
* Is the button inline
|
|
58
|
+
*/
|
|
59
|
+
align?: Popover$1.PopperContentProps['align'];
|
|
60
|
+
/**
|
|
61
|
+
* Is the button inline
|
|
62
|
+
* @deprecated
|
|
63
|
+
*/
|
|
64
|
+
anchorOrigin?: Origin;
|
|
65
|
+
/**
|
|
66
|
+
* Is the button inline
|
|
67
|
+
* * @deprecated
|
|
68
|
+
*/
|
|
69
|
+
transformOrigin?: Origin;
|
|
70
|
+
/**
|
|
71
|
+
* Is the button inline
|
|
72
|
+
* * @deprecated
|
|
73
|
+
*/
|
|
74
|
+
clickOutToClose?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Is the button inline
|
|
77
|
+
* * @deprecated
|
|
78
|
+
*/
|
|
79
|
+
autoCloseDuration?: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Popover need two slots popover-trigger and popover-content. By default on clicking the trigger the content will be displayed. The props can be used to change the position of the content, width of the component and the distance between the trigger and the content.
|
|
84
|
+
*/
|
|
85
|
+
declare const Popover: ({ children, trigger, arrow, hoverOutToClose, align, hoverToOpen, avoidCollisions, replaceTrigger, side: s, disabled, onClose, popoverContentProps, popoverRootProps, anchorOrigin, }: PopoverProps) => react__default.JSX.Element;
|
|
86
|
+
|
|
87
|
+
declare const PopoverTrigger: styled_components.IStyledComponent<"web", styled_components_dist_types.FastOmit<Omit<Popover$1.PopoverTriggerProps & react.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
88
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
|
89
|
+
}, never>> & Omit<react.ForwardRefExoticComponent<Popover$1.PopoverTriggerProps & react.RefAttributes<HTMLButtonElement>>, keyof react.Component<any, {}, any>>;
|
|
90
|
+
declare const PopoverClose: styled_components.IStyledComponent<"web", styled_components_dist_types.FastOmit<Omit<Popover$1.PopoverCloseProps & react.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
91
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
|
92
|
+
}, never>> & Omit<react.ForwardRefExoticComponent<Popover$1.PopoverCloseProps & react.RefAttributes<HTMLButtonElement>>, keyof react.Component<any, {}, any>>;
|
|
93
|
+
|
|
94
|
+
export { type Origin, Popover, PopoverClose, type PopoverProps, PopoverTrigger };
|
package/lib/Popover.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export{P as Popover,a as PopoverClose,b as PopoverTrigger}from"./Popover-BU73-g73.js"
|
|
2
|
+
;import"./styled-components.browser.esm-Bq2p-e5F.js";import"react"
|
|
3
|
+
;import"./index-D8E8s0tV.js";import"./index-ByHJlnsx.js";import"react-dom"
|
|
4
|
+
;import"./index-BnDw8kbT.js";import"./keyframes-PnzFl0I5.js"
|
|
5
|
+
;import"./index-CeIB4COQ.js";import"./index-BdTXfGkV.js"
|
|
6
|
+
;import"./index-COoRg_pp.js";import"./Combination-AmN1Cqrf.js"
|
|
7
|
+
;import"./index-BxNZ3C71.js";import"./index-BrF1HKA1.js"
|
|
8
|
+
;import"./index-BROhcSiX.js";import"./index-Dy5ztCxm.js";
|