@lanaco/lnc-react-ui 3.11.35 → 4.0.2
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/README.md +0 -3
- package/dist/Accordion.cjs +6 -0
- package/dist/Accordion.js +65 -0
- package/dist/AccordionDetails.cjs +7 -0
- package/dist/AccordionDetails.js +32 -0
- package/dist/AccordionSummary.cjs +12 -0
- package/dist/AccordionSummary.js +78 -0
- package/dist/ActionsToolbar.cjs +19 -0
- package/dist/ActionsToolbar.js +225 -0
- package/dist/Alert.cjs +40 -0
- package/dist/Alert.js +138 -0
- package/dist/Avatar.cjs +16 -0
- package/dist/Avatar.js +114 -0
- package/dist/Badge.cjs +17 -0
- package/dist/Badge.js +70 -0
- package/dist/Breadcrumbs.cjs +8 -0
- package/dist/Breadcrumbs.js +131 -0
- package/dist/Button.cjs +127 -0
- package/dist/Button.js +542 -0
- package/dist/ButtonGroup.cjs +44 -0
- package/dist/ButtonGroup.js +112 -0
- package/dist/CheckBoxInput.cjs +118 -0
- package/dist/CheckBoxInput.js +348 -0
- package/dist/Chip.cjs +27 -0
- package/dist/Chip.js +189 -0
- package/dist/ColorInput.cjs +60 -0
- package/dist/ColorInput.js +256 -0
- package/dist/ConfirmationForm.cjs +22 -0
- package/dist/ConfirmationForm.js +169 -0
- package/dist/Content.cjs +1 -0
- package/dist/Content.js +18 -0
- package/dist/CustomStyles-CqlCjTgU.cjs +8 -0
- package/dist/CustomStyles-nfD3J1mi.js +2881 -0
- package/dist/DataView.cjs +1 -0
- package/dist/DataView.js +62 -0
- package/dist/DateInput.cjs +296 -0
- package/dist/DateInput.js +7042 -0
- package/dist/DecimalInput.cjs +54 -0
- package/dist/DecimalInput.js +697 -0
- package/dist/DetailsView.cjs +18 -0
- package/dist/DetailsView.js +243 -0
- package/dist/DoubleRangeSlider.cjs +114 -0
- package/dist/DoubleRangeSlider.js +289 -0
- package/dist/DragAndDropFile.cjs +31 -0
- package/dist/DragAndDropFile.js +2331 -0
- package/dist/DragDropFiles.cjs +14 -0
- package/dist/DragDropFiles.js +175 -0
- package/dist/Drawer.cjs +6 -0
- package/dist/Drawer.js +206 -0
- package/dist/Dropdown.cjs +1 -0
- package/dist/Dropdown.js +266 -0
- package/dist/DropdownItem.cjs +36 -0
- package/dist/DropdownItem.js +241 -0
- package/dist/DropdownLookup.cjs +1 -0
- package/dist/DropdownLookup.js +325 -0
- package/dist/DropdownMenu-B6qr13ik.cjs +19 -0
- package/dist/DropdownMenu-DZi3TJ8Q.js +1547 -0
- package/dist/DropdownMenu.cjs +1 -0
- package/dist/DropdownMenu.js +12 -0
- package/dist/EditableTable.cjs +21 -0
- package/dist/EditableTable.js +462 -0
- package/dist/FileInput.cjs +47 -0
- package/dist/FileInput.js +206 -0
- package/dist/FlexBox.cjs +9 -0
- package/dist/FlexBox.js +97 -0
- package/dist/FlexGrid.cjs +1 -0
- package/dist/FlexGrid.js +78 -0
- package/dist/FlexGridItem.cjs +7 -0
- package/dist/FlexGridItem.js +97 -0
- package/dist/Footer.cjs +1 -0
- package/dist/Footer.js +18 -0
- package/dist/FormField.cjs +11 -0
- package/dist/FormField.js +65 -0
- package/dist/FormView.cjs +13 -0
- package/dist/FormView.js +354 -0
- package/dist/Grid.cjs +13 -0
- package/dist/Grid.js +62 -0
- package/dist/GridItem.cjs +15 -0
- package/dist/GridItem.js +72 -0
- package/dist/Header.cjs +1 -0
- package/dist/Header.js +18 -0
- package/dist/Icon.cjs +8 -0
- package/dist/Icon.js +59 -0
- package/dist/IconButton.cjs +122 -0
- package/dist/IconButton.js +481 -0
- package/dist/Kanban.cjs +85 -0
- package/dist/Kanban.js +4793 -0
- package/dist/KanbanActionsToolbar.cjs +19 -0
- package/dist/KanbanActionsToolbar.js +152 -0
- package/dist/KanbanCard-ConTmu3w.cjs +30 -0
- package/dist/KanbanCard-D9OhU8C6.js +175 -0
- package/dist/KanbanCard.cjs +1 -0
- package/dist/KanbanCard.js +12 -0
- package/dist/KanbanFooter.cjs +5 -0
- package/dist/KanbanFooter.js +84 -0
- package/dist/KanbanHeader.cjs +15 -0
- package/dist/KanbanHeader.js +127 -0
- package/dist/KanbanView.cjs +8 -0
- package/dist/KanbanView.js +255 -0
- package/dist/Link.cjs +15 -0
- package/dist/Link.js +62 -0
- package/dist/MenuItem.cjs +36 -0
- package/dist/MenuItem.js +230 -0
- package/dist/Modal.cjs +84 -0
- package/dist/Modal.js +372 -0
- package/dist/MultiSelectDropdown.cjs +1 -0
- package/dist/MultiSelectDropdown.js +261 -0
- package/dist/MultiSelectDropdownLookup.cjs +1 -0
- package/dist/MultiSelectDropdownLookup.js +274 -0
- package/dist/NestedDropdownItem.cjs +6 -0
- package/dist/NestedDropdownItem.js +102 -0
- package/dist/NestedMenuItem.cjs +6 -0
- package/dist/NestedMenuItem.js +115 -0
- package/dist/Notification.cjs +83 -0
- package/dist/Notification.js +1079 -0
- package/dist/NumberInput.cjs +45 -0
- package/dist/NumberInput.js +241 -0
- package/dist/PageLayout.cjs +26 -0
- package/dist/PageLayout.js +92 -0
- package/dist/PasswordInput.cjs +47 -0
- package/dist/PasswordInput.js +230 -0
- package/dist/ProgressBar.cjs +22 -0
- package/dist/ProgressBar.js +92 -0
- package/dist/RadioGroup.cjs +7 -0
- package/dist/RadioGroup.js +104 -0
- package/dist/RadioInput.cjs +117 -0
- package/dist/RadioInput.js +362 -0
- package/dist/RangeSlider.cjs +72 -0
- package/dist/RangeSlider.js +253 -0
- package/dist/SearchBar.cjs +100 -0
- package/dist/SearchBar.js +994 -0
- package/dist/Separator.cjs +6 -0
- package/dist/Separator.js +37 -0
- package/dist/Sidebar.cjs +39 -0
- package/dist/Sidebar.js +123 -0
- package/dist/Spinner.cjs +38 -0
- package/dist/Spinner.js +114 -0
- package/dist/Surface.cjs +7 -0
- package/dist/Surface.js +60 -0
- package/dist/SwipeableDrawer.cjs +33 -0
- package/dist/SwipeableDrawer.js +213 -0
- package/dist/Table.cjs +170 -0
- package/dist/Table.js +1408 -0
- package/dist/TableView-Cj5_fbSR.js +481 -0
- package/dist/TableView-D8ex512p.cjs +19 -0
- package/dist/TableView.cjs +1 -0
- package/dist/TableView.js +11 -0
- package/dist/Tabs.cjs +7 -0
- package/dist/Tabs.js +72 -0
- package/dist/TextAreaInput.cjs +33 -0
- package/dist/TextAreaInput.js +320 -0
- package/dist/TextInput.cjs +45 -0
- package/dist/TextInput.js +227 -0
- package/dist/ThemeProvider.cjs +113 -0
- package/dist/ThemeProvider.js +1340 -0
- package/dist/TimeInput.cjs +31 -0
- package/dist/TimeInput.js +133 -0
- package/dist/Toggle.cjs +151 -0
- package/dist/Toggle.js +421 -0
- package/dist/TreeMenu.cjs +15 -0
- package/dist/TreeMenu.js +108 -0
- package/dist/TreeMenuSeparator.cjs +6 -0
- package/dist/TreeMenuSeparator.js +40 -0
- package/dist/UploadedFile.cjs +39 -0
- package/dist/UploadedFile.js +192 -0
- package/dist/defineProperty-BHpTtkhC.js +110 -0
- package/dist/defineProperty-DHvxLH8G.cjs +1 -0
- package/dist/emotion-element-5486c51c.browser.esm-CSejtOeT.js +886 -0
- package/dist/emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs +1 -0
- package/dist/emotion-is-prop-valid.esm-BzFBwmJz.js +10 -0
- package/dist/emotion-is-prop-valid.esm-CMrshNb7.cjs +1 -0
- package/dist/emotion-react.browser.esm-DQBL7Wls.cjs +1 -0
- package/dist/emotion-react.browser.esm-OWM-uG8Q.js +94 -0
- package/dist/emotion-styled.browser.esm-BZSYYThs.js +210 -0
- package/dist/emotion-styled.browser.esm-Cbp_XsK4.cjs +1 -0
- package/dist/floating-ui.dom-1F2mTXOe.cjs +1 -0
- package/dist/floating-ui.dom-BdUovkEr.js +938 -0
- package/dist/hoist-non-react-statics.cjs-B8r9S_ak.cjs +15 -0
- package/dist/hoist-non-react-statics.cjs-Drf1aBlk.js +235 -0
- package/dist/index-BLQWNy78.js +109 -0
- package/dist/index-BP5r5zGN.cjs +1 -0
- package/dist/index-B_da1uvD.js +451 -0
- package/dist/index-BjdOz5Ok.cjs +1 -0
- package/dist/index-BklgDeu4.js +42 -0
- package/dist/index-C29T0m2a.cjs +174 -0
- package/dist/index-CZJEA84h.js +19069 -0
- package/dist/index-Cdkz-XH-.js +127 -0
- package/dist/index-D5vEbKUT.js +81 -0
- package/dist/index-DXnSjbfJ.cjs +20 -0
- package/dist/index-Ds9PUTwb.js +667 -0
- package/dist/index-Dzkd2i4n.cjs +1 -0
- package/dist/index-IO9v6o0I.cjs +5 -0
- package/dist/index-P-naJISQ.cjs +1 -0
- package/dist/index.cjs +26 -0
- package/dist/index.js +378 -0
- package/dist/motion-CtkUpWEn.js +3785 -0
- package/dist/motion-Oud-wpUz.cjs +1 -0
- package/dist/objectWithoutPropertiesLoose-Bz3hwpmU.cjs +1 -0
- package/dist/objectWithoutPropertiesLoose-DwEN6RBQ.js +12 -0
- package/dist/setPrototypeOf-4aSEnBDm.cjs +1 -0
- package/dist/setPrototypeOf-a891FLQJ.js +13 -0
- package/dist/style.css +5 -0
- package/dist/tslib.es6-ZNVz5r_T.js +90 -0
- package/dist/tslib.es6-fPwcSa2V.cjs +1 -0
- package/dist/use-isomorphic-layout-effect.browser.esm-CkGv31zs.cjs +1 -0
- package/dist/use-isomorphic-layout-effect.browser.esm-DERp5kr6.js +5 -0
- package/dist/useUpdateEffect-BtMgpgIV.cjs +1 -0
- package/dist/useUpdateEffect-CuYWz7EA.js +15 -0
- package/dist/utils-DEke8iwo.js +10196 -0
- package/dist/utils-hdRGTsQ7.cjs +13 -0
- package/eslint.config.js +38 -0
- package/package.json +137 -58
- package/vite.config.js +135 -0
- package/jest.config.js +0 -7
- package/lib/index.esm.js +0 -84028
- package/lib/index.js +0 -84165
- package/rc1 +0 -0
- package/test/jest/__mocks__/styleMock.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("react/jsx-runtime");require("react");require("./index-DXnSjbfJ.cjs");require("./emotion-styled.browser.esm-Cbp_XsK4.cjs");require("./Button.cjs");require("./utils-hdRGTsQ7.cjs");require("./ThemeProvider.cjs");const e=require("./DropdownMenu-B6qr13ik.cjs");require("./motion-Oud-wpUz.cjs");module.exports=e.DropdownMenu;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "./index-Ds9PUTwb.js";
|
|
4
|
+
import "./emotion-styled.browser.esm-BZSYYThs.js";
|
|
5
|
+
import "./Button.js";
|
|
6
|
+
import "./utils-DEke8iwo.js";
|
|
7
|
+
import "./ThemeProvider.js";
|
|
8
|
+
import { D as l } from "./DropdownMenu-DZi3TJ8Q.js";
|
|
9
|
+
import "./motion-CtkUpWEn.js";
|
|
10
|
+
export {
|
|
11
|
+
l as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),i=require("react"),r=require("./index-DXnSjbfJ.cjs"),w=require("./utils-hdRGTsQ7.cjs"),H=require("./Table.cjs"),G=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),B=require("./TextInput.cjs"),W=require("./NumberInput.cjs"),J=require("./DecimalInput.cjs"),Q=require("./CheckBoxInput.cjs"),U=require("./Dropdown.cjs"),X=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs"),m={BOOLEAN:"BOOLEAN",STRING:"STRING",INTEGER:"INTEGER",DECIMAL:"DECIMAL",DATE:"DATE",SELECT:"SELECT"},Z=G.newStyled.td`
|
|
2
|
+
white-space: nowrap;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
text-overflow: ellipsis;
|
|
5
|
+
max-width: ${o=>o.width};
|
|
6
|
+
padding: ${o=>o.focused&&!o.isBoolean?"0.5rem 0.5rem 0.5rem 0.7rem":"0.5rem 0.5rem 0.5rem 1.5rem"};
|
|
7
|
+
${o=>o.bgColor}
|
|
8
|
+
|
|
9
|
+
${o=>w.getComponentTypographyCss(o.theme,"TableCell",o.size,"enabled")};
|
|
10
|
+
`,ee=G.newStyled.div`
|
|
11
|
+
${o=>w.getComponentTypographyCss(o.theme,"TableSpecialLastRow",o.size,"enabled")};
|
|
12
|
+
padding: ${o=>o.hasRender?"0":"9.5px 6px 9.5px 0"};
|
|
13
|
+
cursor: ${o=>o.tabIndex!==-1?"pointer":"auto"};
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
text-overflow: ellipsis;
|
|
17
|
+
|
|
18
|
+
&:focus {
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
`,N=o=>{const[d,R]=i.useState(!1);var l=i.useRef(),P=i.useRef(),A=i.useRef(!0);const{__TYPE__:L="TABLE_CELL",Column:e={},ColumnsToRender:p,RowData:s={},Index:g=0,RowIndex:f,EnableSelection:v=!1,TabIndexOffset:x=100,onFocusChanged:I,RowIdentifier:q,onDiscard:O,onMount:t,onChange:n,className:T="",size:C="small",color:b="primary"}=o,D=X.useTheme(),S={className:T,size:C,color:b,theme:D};i.useEffect(()=>{t(f,g,P)},[]),i.useEffect(()=>{d||t(f,g,P)},[d]),i.useEffect(()=>{d&&l&&l.current&&l.current.focus()},[d]);const M=()=>e&&e.width?e.width+"%":"auto",F=()=>{if(e.editable!==!0)return-1;var a=p.filter(y=>y.editable),E=a.find(y=>y.id===e.id);return x+f*a.length+a.indexOf(E)},j=(a,E)=>{I(a,E,f,g),E||R(E)},$=a=>{a.key==="Escape"&&(A.current=!1,l.current.blur(),A.current=!0,O(a,f,g,s))},z=()=>{var a=null,E=(u,K)=>{n(u,K,f,g,e,s)},y=u=>{n(_,u,f,g,e,s)},h={...S,debounceTime:0,...e.inputProps,value:e!=null&&e.objectAccessor?s[e.accessor][e==null?void 0:e.objectAccessor]:s[e.accessor],defaultChecked:e!=null&&e.objectAccessor?s[e.accessor][e==null?void 0:e.objectAccessor]:s[e.accessor],focused:d,onChange:E,onBlur:u=>j(u,!1),onFocus:u=>j(u,!0),onKeyDown:u=>$(u),tabIndex:F()};switch(e.inputType){case m.STRING:a=c.jsx(B,{...h,ref:l});break;case m.INTEGER:a=c.jsx(W,{...h,ref:l});break;case m.DECIMAL:a=c.jsx(J,{...h,ref:l});break;case m.DATE:a=c.jsx(B,{...h,ref:l});break;case m.BOOLEAN:a=c.jsx(Q,{...h,ref:l});break;case m.SELECT:a=c.jsx(U.default,{...h,value:e.inputProps.options.find(u=>u.value===(e==null?void 0:e.objectAccessor)?s[e.accessor][e==null?void 0:e.objectAccessor]:s[e.accessor]),onChange:y,ref:l});break;default:a=c.jsx(B,{...h,ref:l})}return a},V=a=>{A.current===!0?j(a,!1):R(!1)},Y=()=>{var a=z();if(e.editable===!0&&e.editComponent){var E={};e.inputType===m.SELECT&&(E={items:e.selectItems,mapNameTo:e.selectProps.mapNameTo,mapValueTo:e.selectProps.mapValueTo}),a=c.jsx(e.editComponent,{ref:l,tabIndex:F(),value:e!=null&&e.objectAccessor?s[e.accessor][e==null?void 0:e.objectAccessor]:s[e.accessor],onChange:(y,h,u)=>{n(y,h,f,g,e,s,u)},focused:d,onBlur:V,onFocus:y=>j(y,!0),onKeyDown:y=>$(y),...E})}if(e.editable===!0&&d)return a;if(!d||e.editable!==!0)return c.jsx(ee,{ref:P,tabIndex:F(),onFocus:()=>R(!0),hasRender:!!e.readonlyComponent,...S,children:e.readonlyComponent?c.jsx(e.readonlyComponent,{rowData:s,value:e!=null&&e.objectAccessor?s[e.accessor][e==null?void 0:e.objectAccessor]:s[e.accessor],fullValue:s[e.accessor],disabled:!0}):e!=null&&e.objectAccessor?s[e.accessor][e==null?void 0:e.objectAccessor]:s[e.accessor]})};return i.createElement(Z,{"data-rowindex":f,...S,selection:v,width:M(),key:g,focused:d,isBoolean:e.inputType===m.BOOLEAN},Y())};N.propTypes={__TYPE__:r.PropTypes.string,Column:r.PropTypes.object,RowData:r.PropTypes.object,Index:r.PropTypes.number,EnableSelection:r.PropTypes.bool,TabIndexOffset:r.PropTypes.number,className:r.PropTypes.string,size:r.PropTypes.oneOf(["small","medium","large"]),color:r.PropTypes.oneOf(["primary","secondary","success","warning","danger","information","neutral","gray"])};N.displayName="TABLE_CELL";const k=i.forwardRef((o,d)=>{var{__TYPE__:R="EDITABLE_TABLE",Data:l=[],onRowFocusChange:P=()=>{},onDiscard:A=()=>{},onInputChange:L=()=>{}}=o;const e=i.useRef({FocusedCell:null,PreviousFocusedCell:null}),p=i.useRef([]),s=i.useRef(null),g=i.useRef();i.useImperativeHandle(d,()=>({focusFirstCellOfLastRow:()=>{s.current&&s.current.focus()},focusLastActiveCell:()=>{try{var t=p.current.find(n=>n.row===e.current.PreviousFocusedCell.row&&n.cell===e.current.PreviousFocusedCell.cell);t.ref&&t.ref.focus()}catch{}}}),[o]);const f=(t,n,T,C,b,D)=>{L&&L(t,n,T,C,b,D)},v=(t,n,T,C,b)=>{n&&(e.current={...e.current,FocusedCell:{row:T,cell:C,ref:b}}),n||(e.current={PreviousFocusedCell:e.current.FocusedCell,FocusedCell:null},x(t,T))},x=(t,n)=>{(t.relatedTarget===null||t.relatedTarget.closest("tbody")===null||!t.relatedTarget.closest("tbody").hasAttribute("data-tbody"))&&P(t,n,-1),t.relatedTarget&&t.relatedTarget.closest("tbody")&&t.relatedTarget.closest("tbody").hasAttribute("data-tbody")&&parseInt(t.relatedTarget.closest("td").getAttribute("data-rowindex"))!==n&&P(t,n,parseInt(t.relatedTarget.closest("td").getAttribute("data-rowindex")))},I=(t,n,T)=>{if(t===l.length-1&&n===0&&(s.current=T.current),p.current.length===0&&(p.current=[{row:t,cell:n,ref:T.current}]),p.current.length>0&&p.current.find(b=>b.row===t&&b.cell===n)){var C=p.current.find(b=>b.row===t&&b.cell===n);C.ref=T.current}else p.current.length>0&&(p.current=[...p.current,{row:t,cell:n,ref:T.current}])},q=()=>w.renderCustomElement(w.getCustomRender("TABLE_SPECIAL_LAST_ROW",o.children),{TabIndexOffset:50})||c.jsx(c.Fragment,{}),O=()=>{var t={TabIndexOffset:50,onFocusChanged:v,onChange:f,onDiscard:A,onMount:I};return w.renderCustomElement(w.getCustomRender("TABLE_CELL",o.children),t)||c.jsx(N,{...t})};return c.jsx(c.Fragment,{children:c.jsxs(H.default,{ref:g,...o,Data:l,VisibilityPattern:null,children:[o.children,O(),q()]})})});k.propTypes={__TYPE__:r.PropTypes.string,EnableSelection:r.PropTypes.bool,EnableOrdering:r.PropTypes.bool,EnableLoader:r.PropTypes.bool,EnableSelectAll:r.PropTypes.bool,NoDataText:r.PropTypes.string,Loading:r.PropTypes.bool,Columns:r.PropTypes.arrayOf(r.PropTypes.object),Data:r.PropTypes.arrayOf(r.PropTypes.object),SelectedData:r.PropTypes.arrayOf(r.PropTypes.object),SelectedEntirePage:r.PropTypes.bool,RowIdentifier:r.PropTypes.string,VisibilityPattern:r.PropTypes.object,Ordering:r.PropTypes.object,onRowFocusChange:()=>{},onDiscard:()=>{},onInputChange:()=>{},onColumnClick:r.PropTypes.func,onRowClick:r.PropTypes.func,onSelectRow:r.PropTypes.func,onSelectAll:r.PropTypes.func,className:r.PropTypes.string,size:r.PropTypes.oneOf(["small","medium","large"]),color:r.PropTypes.oneOf(["primary","secondary","success","error","warning","gray","white","neutral"])};k.displayName="EDITABLE_TABLE";module.exports=k;
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { jsx as i, Fragment as G, jsxs as U } from "react/jsx-runtime";
|
|
2
|
+
import { useState as X, useRef as w, useEffect as F, createElement as Z, forwardRef as ee, useImperativeHandle as re } from "react";
|
|
3
|
+
import { P as r } from "./index-Ds9PUTwb.js";
|
|
4
|
+
import { a as V, r as M, e as z } from "./utils-DEke8iwo.js";
|
|
5
|
+
import te from "./Table.js";
|
|
6
|
+
import { n as Y } from "./emotion-styled.browser.esm-BZSYYThs.js";
|
|
7
|
+
import N from "./TextInput.js";
|
|
8
|
+
import oe from "./NumberInput.js";
|
|
9
|
+
import ne from "./DecimalInput.js";
|
|
10
|
+
import ae from "./CheckBoxInput.js";
|
|
11
|
+
import se from "./Dropdown.js";
|
|
12
|
+
import { u as ce } from "./emotion-element-5486c51c.browser.esm-CSejtOeT.js";
|
|
13
|
+
const h = {
|
|
14
|
+
BOOLEAN: "BOOLEAN",
|
|
15
|
+
STRING: "STRING",
|
|
16
|
+
INTEGER: "INTEGER",
|
|
17
|
+
DECIMAL: "DECIMAL",
|
|
18
|
+
DATE: "DATE",
|
|
19
|
+
SELECT: "SELECT"
|
|
20
|
+
}, le = Y.td`
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
text-overflow: ellipsis;
|
|
24
|
+
max-width: ${(o) => o.width};
|
|
25
|
+
padding: ${(o) => o.focused && !o.isBoolean ? "0.5rem 0.5rem 0.5rem 0.7rem" : "0.5rem 0.5rem 0.5rem 1.5rem"};
|
|
26
|
+
${(o) => o.bgColor}
|
|
27
|
+
|
|
28
|
+
${(o) => V(o.theme, "TableCell", o.size, "enabled")};
|
|
29
|
+
`, ie = Y.div`
|
|
30
|
+
${(o) => V(
|
|
31
|
+
o.theme,
|
|
32
|
+
"TableSpecialLastRow",
|
|
33
|
+
o.size,
|
|
34
|
+
"enabled"
|
|
35
|
+
)};
|
|
36
|
+
padding: ${(o) => o.hasRender ? "0" : "9.5px 6px 9.5px 0"};
|
|
37
|
+
cursor: ${(o) => o.tabIndex !== -1 ? "pointer" : "auto"};
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
text-overflow: ellipsis;
|
|
41
|
+
|
|
42
|
+
&:focus {
|
|
43
|
+
outline: none;
|
|
44
|
+
}
|
|
45
|
+
`, x = (o) => {
|
|
46
|
+
const [u, L] = X(!1);
|
|
47
|
+
var c = w(), y = w(), A = w(!0);
|
|
48
|
+
const {
|
|
49
|
+
__TYPE__: I = "TABLE_CELL",
|
|
50
|
+
Column: e = {},
|
|
51
|
+
ColumnsToRender: d,
|
|
52
|
+
RowData: n = {},
|
|
53
|
+
Index: T = 0,
|
|
54
|
+
RowIndex: f,
|
|
55
|
+
EnableSelection: O = !1,
|
|
56
|
+
TabIndexOffset: D = 100,
|
|
57
|
+
onFocusChanged: R,
|
|
58
|
+
RowIdentifier: k,
|
|
59
|
+
onDiscard: S,
|
|
60
|
+
onMount: t,
|
|
61
|
+
//----------------
|
|
62
|
+
onChange: a,
|
|
63
|
+
//----------------
|
|
64
|
+
className: b = "",
|
|
65
|
+
size: C = "small",
|
|
66
|
+
color: p = "primary"
|
|
67
|
+
} = o, j = ce(), P = {
|
|
68
|
+
className: b,
|
|
69
|
+
size: C,
|
|
70
|
+
color: p,
|
|
71
|
+
theme: j
|
|
72
|
+
};
|
|
73
|
+
F(() => {
|
|
74
|
+
t(f, T, y);
|
|
75
|
+
}, []), F(() => {
|
|
76
|
+
u || t(f, T, y);
|
|
77
|
+
}, [u]), F(() => {
|
|
78
|
+
u && c && c.current && c.current.focus();
|
|
79
|
+
}, [u]);
|
|
80
|
+
const H = () => e && e.width ? e.width + "%" : "auto", B = () => {
|
|
81
|
+
if (e.editable !== !0) return -1;
|
|
82
|
+
var s = d.filter((m) => m.editable), g = s.find((m) => m.id === e.id);
|
|
83
|
+
return D + f * s.length + s.indexOf(g);
|
|
84
|
+
}, v = (s, g) => {
|
|
85
|
+
R(s, g, f, T), g || L(g);
|
|
86
|
+
}, $ = (s) => {
|
|
87
|
+
s.key === "Escape" && (A.current = !1, c.current.blur(), A.current = !0, S(s, f, T, n));
|
|
88
|
+
}, W = () => {
|
|
89
|
+
var s = null, g = (l, Q) => {
|
|
90
|
+
a(l, Q, f, T, e, n);
|
|
91
|
+
}, m = (l) => {
|
|
92
|
+
a(_, l, f, T, e, n);
|
|
93
|
+
}, E = {
|
|
94
|
+
...P,
|
|
95
|
+
debounceTime: 0,
|
|
96
|
+
...e.inputProps,
|
|
97
|
+
value: e != null && e.objectAccessor ? n[e.accessor][e == null ? void 0 : e.objectAccessor] : n[e.accessor],
|
|
98
|
+
defaultChecked: e != null && e.objectAccessor ? n[e.accessor][e == null ? void 0 : e.objectAccessor] : n[e.accessor],
|
|
99
|
+
focused: u,
|
|
100
|
+
onChange: g,
|
|
101
|
+
onBlur: (l) => v(l, !1),
|
|
102
|
+
onFocus: (l) => v(l, !0),
|
|
103
|
+
onKeyDown: (l) => $(l),
|
|
104
|
+
tabIndex: B()
|
|
105
|
+
};
|
|
106
|
+
switch (e.inputType) {
|
|
107
|
+
case h.STRING:
|
|
108
|
+
s = /* @__PURE__ */ i(N, { ...E, ref: c });
|
|
109
|
+
break;
|
|
110
|
+
case h.INTEGER:
|
|
111
|
+
s = /* @__PURE__ */ i(oe, { ...E, ref: c });
|
|
112
|
+
break;
|
|
113
|
+
case h.DECIMAL:
|
|
114
|
+
s = /* @__PURE__ */ i(ne, { ...E, ref: c });
|
|
115
|
+
break;
|
|
116
|
+
case h.DATE:
|
|
117
|
+
s = /* @__PURE__ */ i(N, { ...E, ref: c });
|
|
118
|
+
break;
|
|
119
|
+
case h.BOOLEAN:
|
|
120
|
+
s = /* @__PURE__ */ i(ae, { ...E, ref: c });
|
|
121
|
+
break;
|
|
122
|
+
case h.SELECT:
|
|
123
|
+
s = /* @__PURE__ */ i(
|
|
124
|
+
se,
|
|
125
|
+
{
|
|
126
|
+
...E,
|
|
127
|
+
value: e.inputProps.options.find(
|
|
128
|
+
(l) => l.value === (e == null ? void 0 : e.objectAccessor) ? n[e.accessor][e == null ? void 0 : e.objectAccessor] : n[e.accessor]
|
|
129
|
+
),
|
|
130
|
+
onChange: m,
|
|
131
|
+
ref: c
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
break;
|
|
135
|
+
default:
|
|
136
|
+
s = /* @__PURE__ */ i(N, { ...E, ref: c });
|
|
137
|
+
}
|
|
138
|
+
return s;
|
|
139
|
+
}, q = (s) => {
|
|
140
|
+
A.current === !0 ? v(s, !1) : L(!1);
|
|
141
|
+
}, J = () => {
|
|
142
|
+
var s = W();
|
|
143
|
+
if (e.editable === !0 && e.editComponent) {
|
|
144
|
+
var g = {};
|
|
145
|
+
e.inputType === h.SELECT && (g = {
|
|
146
|
+
items: e.selectItems,
|
|
147
|
+
mapNameTo: e.selectProps.mapNameTo,
|
|
148
|
+
mapValueTo: e.selectProps.mapValueTo
|
|
149
|
+
}), s = /* @__PURE__ */ i(
|
|
150
|
+
e.editComponent,
|
|
151
|
+
{
|
|
152
|
+
ref: c,
|
|
153
|
+
tabIndex: B(),
|
|
154
|
+
value: e != null && e.objectAccessor ? n[e.accessor][e == null ? void 0 : e.objectAccessor] : n[e.accessor],
|
|
155
|
+
onChange: (m, E, l) => {
|
|
156
|
+
a(m, E, f, T, e, n, l);
|
|
157
|
+
},
|
|
158
|
+
focused: u,
|
|
159
|
+
onBlur: q,
|
|
160
|
+
onFocus: (m) => v(m, !0),
|
|
161
|
+
onKeyDown: (m) => $(m),
|
|
162
|
+
...g
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
if (e.editable === !0 && u) return s;
|
|
167
|
+
if (!u || e.editable !== !0)
|
|
168
|
+
return /* @__PURE__ */ i(
|
|
169
|
+
ie,
|
|
170
|
+
{
|
|
171
|
+
ref: y,
|
|
172
|
+
tabIndex: B(),
|
|
173
|
+
onFocus: () => L(!0),
|
|
174
|
+
hasRender: !!e.readonlyComponent,
|
|
175
|
+
...P,
|
|
176
|
+
children: e.readonlyComponent ? /* @__PURE__ */ i(
|
|
177
|
+
e.readonlyComponent,
|
|
178
|
+
{
|
|
179
|
+
rowData: n,
|
|
180
|
+
value: e != null && e.objectAccessor ? n[e.accessor][e == null ? void 0 : e.objectAccessor] : n[e.accessor],
|
|
181
|
+
fullValue: n[e.accessor],
|
|
182
|
+
disabled: !0
|
|
183
|
+
}
|
|
184
|
+
) : e != null && e.objectAccessor ? n[e.accessor][e == null ? void 0 : e.objectAccessor] : n[e.accessor]
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
return /* @__PURE__ */ Z(
|
|
189
|
+
le,
|
|
190
|
+
{
|
|
191
|
+
"data-rowindex": f,
|
|
192
|
+
...P,
|
|
193
|
+
selection: O,
|
|
194
|
+
width: H(),
|
|
195
|
+
key: T,
|
|
196
|
+
focused: u,
|
|
197
|
+
isBoolean: e.inputType === h.BOOLEAN
|
|
198
|
+
},
|
|
199
|
+
J()
|
|
200
|
+
);
|
|
201
|
+
};
|
|
202
|
+
x.propTypes = {
|
|
203
|
+
__TYPE__: r.string,
|
|
204
|
+
//----------------------------------------
|
|
205
|
+
Column: r.object,
|
|
206
|
+
RowData: r.object,
|
|
207
|
+
Index: r.number,
|
|
208
|
+
EnableSelection: r.bool,
|
|
209
|
+
TabIndexOffset: r.number,
|
|
210
|
+
//----------------------------------------
|
|
211
|
+
className: r.string,
|
|
212
|
+
size: r.oneOf(["small", "medium", "large"]),
|
|
213
|
+
color: r.oneOf([
|
|
214
|
+
"primary",
|
|
215
|
+
"secondary",
|
|
216
|
+
"success",
|
|
217
|
+
"warning",
|
|
218
|
+
"danger",
|
|
219
|
+
"information",
|
|
220
|
+
"neutral",
|
|
221
|
+
"gray"
|
|
222
|
+
])
|
|
223
|
+
};
|
|
224
|
+
x.displayName = "TABLE_CELL";
|
|
225
|
+
const K = ee((o, u) => {
|
|
226
|
+
var {
|
|
227
|
+
__TYPE__: L = "EDITABLE_TABLE",
|
|
228
|
+
Data: c = [],
|
|
229
|
+
onRowFocusChange: y = () => {
|
|
230
|
+
},
|
|
231
|
+
onDiscard: A = () => {
|
|
232
|
+
},
|
|
233
|
+
onInputChange: I = () => {
|
|
234
|
+
}
|
|
235
|
+
} = o;
|
|
236
|
+
const e = w({
|
|
237
|
+
FocusedCell: null,
|
|
238
|
+
PreviousFocusedCell: null
|
|
239
|
+
}), d = w([]), n = w(null), T = w();
|
|
240
|
+
re(
|
|
241
|
+
u,
|
|
242
|
+
() => ({
|
|
243
|
+
focusFirstCellOfLastRow: () => {
|
|
244
|
+
n.current && n.current.focus();
|
|
245
|
+
},
|
|
246
|
+
focusLastActiveCell: () => {
|
|
247
|
+
try {
|
|
248
|
+
var t = d.current.find(
|
|
249
|
+
(a) => a.row === e.current.PreviousFocusedCell.row && a.cell === e.current.PreviousFocusedCell.cell
|
|
250
|
+
);
|
|
251
|
+
t.ref && t.ref.focus();
|
|
252
|
+
} catch {
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}),
|
|
256
|
+
[
|
|
257
|
+
o
|
|
258
|
+
// Update functions when certain state changes
|
|
259
|
+
]
|
|
260
|
+
);
|
|
261
|
+
const f = (t, a, b, C, p, j) => {
|
|
262
|
+
I && I(t, a, b, C, p, j);
|
|
263
|
+
}, O = (t, a, b, C, p) => {
|
|
264
|
+
a && (e.current = {
|
|
265
|
+
...e.current,
|
|
266
|
+
FocusedCell: {
|
|
267
|
+
row: b,
|
|
268
|
+
cell: C,
|
|
269
|
+
ref: p
|
|
270
|
+
}
|
|
271
|
+
}), a || (e.current = {
|
|
272
|
+
PreviousFocusedCell: e.current.FocusedCell,
|
|
273
|
+
FocusedCell: null
|
|
274
|
+
}, D(t, b));
|
|
275
|
+
}, D = (t, a) => {
|
|
276
|
+
(t.relatedTarget === null || t.relatedTarget.closest("tbody") === null || !t.relatedTarget.closest("tbody").hasAttribute("data-tbody")) && y(t, a, -1), t.relatedTarget && t.relatedTarget.closest("tbody") && t.relatedTarget.closest("tbody").hasAttribute("data-tbody") && parseInt(t.relatedTarget.closest("td").getAttribute("data-rowindex")) !== a && y(
|
|
277
|
+
t,
|
|
278
|
+
a,
|
|
279
|
+
parseInt(t.relatedTarget.closest("td").getAttribute("data-rowindex"))
|
|
280
|
+
);
|
|
281
|
+
}, R = (t, a, b) => {
|
|
282
|
+
if (t === c.length - 1 && a === 0 && (n.current = b.current), d.current.length === 0 && (d.current = [
|
|
283
|
+
{ row: t, cell: a, ref: b.current }
|
|
284
|
+
]), d.current.length > 0 && d.current.find(
|
|
285
|
+
(p) => p.row === t && p.cell === a
|
|
286
|
+
)) {
|
|
287
|
+
var C = d.current.find(
|
|
288
|
+
(p) => p.row === t && p.cell === a
|
|
289
|
+
);
|
|
290
|
+
C.ref = b.current;
|
|
291
|
+
} else d.current.length > 0 && (d.current = [
|
|
292
|
+
...d.current,
|
|
293
|
+
{ row: t, cell: a, ref: b.current }
|
|
294
|
+
]);
|
|
295
|
+
}, k = () => M(
|
|
296
|
+
z("TABLE_SPECIAL_LAST_ROW", o.children),
|
|
297
|
+
{
|
|
298
|
+
TabIndexOffset: 50
|
|
299
|
+
}
|
|
300
|
+
) || /* @__PURE__ */ i(G, {}), S = () => {
|
|
301
|
+
var t = {
|
|
302
|
+
TabIndexOffset: 50,
|
|
303
|
+
onFocusChanged: O,
|
|
304
|
+
onChange: f,
|
|
305
|
+
onDiscard: A,
|
|
306
|
+
onMount: R
|
|
307
|
+
};
|
|
308
|
+
return M(
|
|
309
|
+
z("TABLE_CELL", o.children),
|
|
310
|
+
t
|
|
311
|
+
) || /* @__PURE__ */ i(x, { ...t });
|
|
312
|
+
};
|
|
313
|
+
return /* @__PURE__ */ i(G, { children: /* @__PURE__ */ U(te, { ref: T, ...o, Data: c, VisibilityPattern: null, children: [
|
|
314
|
+
o.children,
|
|
315
|
+
S(),
|
|
316
|
+
k()
|
|
317
|
+
] }) });
|
|
318
|
+
});
|
|
319
|
+
K.propTypes = {
|
|
320
|
+
/**
|
|
321
|
+
* This property determines where the component is rendered.
|
|
322
|
+
* Should not be overridden!
|
|
323
|
+
*/
|
|
324
|
+
__TYPE__: r.string,
|
|
325
|
+
//----------------------------------------
|
|
326
|
+
/**
|
|
327
|
+
* Show a selection checkbox in the first cell of every row.
|
|
328
|
+
* Value of the checkbox is determined by the `SelectedData` property.
|
|
329
|
+
*/
|
|
330
|
+
EnableSelection: r.bool,
|
|
331
|
+
/**
|
|
332
|
+
* Show ordering arrows in header cells.
|
|
333
|
+
*/
|
|
334
|
+
EnableOrdering: r.bool,
|
|
335
|
+
/**
|
|
336
|
+
* Show a spinner with backdrop on top of the table when `Loading` is set to `true`.
|
|
337
|
+
*/
|
|
338
|
+
EnableLoader: r.bool,
|
|
339
|
+
/**
|
|
340
|
+
* Show a selection checkbox in the first cell of the table header.
|
|
341
|
+
* Value of the checkbox is determined by the `SelectedEntirePage` property.
|
|
342
|
+
*/
|
|
343
|
+
EnableSelectAll: r.bool,
|
|
344
|
+
//----------------------------------------
|
|
345
|
+
/**
|
|
346
|
+
* Specify the text that is shown when there are 0 rows in the `Data`.
|
|
347
|
+
*/
|
|
348
|
+
NoDataText: r.string,
|
|
349
|
+
/**
|
|
350
|
+
* Disables some events and actions when set to `true`. Also triggers the spinner if `EnableLoader` is set to `true`.
|
|
351
|
+
*/
|
|
352
|
+
Loading: r.bool,
|
|
353
|
+
/**
|
|
354
|
+
* Defines the table columns.
|
|
355
|
+
* @param id - Column identifier
|
|
356
|
+
* @param displayName - Text displayed in the header
|
|
357
|
+
* @param accessor - Access the property in `Data`
|
|
358
|
+
* @param width - Default column width (overridden by the VisibilityPattern)
|
|
359
|
+
* @param sortable - Can be sorted
|
|
360
|
+
*
|
|
361
|
+
*/
|
|
362
|
+
Columns: r.arrayOf(r.object),
|
|
363
|
+
/**
|
|
364
|
+
* Defines the data displayed in each row.
|
|
365
|
+
*/
|
|
366
|
+
Data: r.arrayOf(r.object),
|
|
367
|
+
/**
|
|
368
|
+
* Define the selected data.
|
|
369
|
+
* @param id - Column identifier (mandatory field)
|
|
370
|
+
*/
|
|
371
|
+
SelectedData: r.arrayOf(r.object),
|
|
372
|
+
/**
|
|
373
|
+
* Value of the `SelectAll` checkbox.
|
|
374
|
+
*/
|
|
375
|
+
SelectedEntirePage: r.bool,
|
|
376
|
+
/**
|
|
377
|
+
* Defines which field in a data object is the row identifier.
|
|
378
|
+
*/
|
|
379
|
+
RowIdentifier: r.string,
|
|
380
|
+
/**
|
|
381
|
+
* An object that defines the width and order of columns for different screen sizes.
|
|
382
|
+
* (`XS`,`S`,`M`,`L`,`XL`)
|
|
383
|
+
*/
|
|
384
|
+
VisibilityPattern: r.object,
|
|
385
|
+
/**
|
|
386
|
+
* Describe how the data is ordered.
|
|
387
|
+
* @param columnId - Column identifier, maps to the id on the Column object
|
|
388
|
+
*/
|
|
389
|
+
Ordering: r.object,
|
|
390
|
+
//----------------------------------------
|
|
391
|
+
/**
|
|
392
|
+
* Triggers when the focus is moved to another row or another component outside of the table
|
|
393
|
+
* @param event - event object
|
|
394
|
+
* @param currentRowIndex - index of the currently focused row
|
|
395
|
+
* @param nextRowIndex - index of the next focused row (-1 if the focuse moves otutside of the table rows)
|
|
396
|
+
*/
|
|
397
|
+
onRowFocusChange: () => {
|
|
398
|
+
},
|
|
399
|
+
/**
|
|
400
|
+
*
|
|
401
|
+
*/
|
|
402
|
+
onDiscard: () => {
|
|
403
|
+
},
|
|
404
|
+
/**
|
|
405
|
+
*
|
|
406
|
+
*/
|
|
407
|
+
onInputChange: () => {
|
|
408
|
+
},
|
|
409
|
+
//----------------------------------------
|
|
410
|
+
/**
|
|
411
|
+
* Triggered on header cell click.
|
|
412
|
+
* @param event - event object
|
|
413
|
+
* @param column - column definition
|
|
414
|
+
* @param ordering - updated ordering object, or undefined if ordering is not enabled or the column is not sortable
|
|
415
|
+
*/
|
|
416
|
+
onColumnClick: r.func,
|
|
417
|
+
/**
|
|
418
|
+
* Triggered on table row click.
|
|
419
|
+
* @param event - event object
|
|
420
|
+
* @param rowData - row data
|
|
421
|
+
*/
|
|
422
|
+
onRowClick: r.func,
|
|
423
|
+
/**
|
|
424
|
+
* Triggered on selection checkbox click.
|
|
425
|
+
* @param event - event object
|
|
426
|
+
* @param rowData - row data
|
|
427
|
+
* @param isSelected - the value of selection checkbox
|
|
428
|
+
*/
|
|
429
|
+
onSelectRow: r.func,
|
|
430
|
+
/**
|
|
431
|
+
* Triggered on select all checkbox click.
|
|
432
|
+
* @param event - event object
|
|
433
|
+
* @param isSelected - the value of select all checkbox
|
|
434
|
+
*/
|
|
435
|
+
onSelectAll: r.func,
|
|
436
|
+
//----------------------------------------
|
|
437
|
+
/**
|
|
438
|
+
* `className` applied to the component container.
|
|
439
|
+
*/
|
|
440
|
+
className: r.string,
|
|
441
|
+
/**
|
|
442
|
+
* Defines size of the component (padding, margin, font etc.).
|
|
443
|
+
*/
|
|
444
|
+
size: r.oneOf(["small", "medium", "large"]),
|
|
445
|
+
/**
|
|
446
|
+
* Defines the palette color for the component.
|
|
447
|
+
*/
|
|
448
|
+
color: r.oneOf([
|
|
449
|
+
"primary",
|
|
450
|
+
"secondary",
|
|
451
|
+
"success",
|
|
452
|
+
"error",
|
|
453
|
+
"warning",
|
|
454
|
+
"gray",
|
|
455
|
+
"white",
|
|
456
|
+
"neutral"
|
|
457
|
+
])
|
|
458
|
+
};
|
|
459
|
+
K.displayName = "EDITABLE_TABLE";
|
|
460
|
+
export {
|
|
461
|
+
K as default
|
|
462
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),g=require("react"),b=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),t=require("./index-DXnSjbfJ.cjs"),r=require("./utils-hdRGTsQ7.cjs"),j=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs"),k=b.newStyled.label`
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
width: 100%;
|
|
5
|
+
min-height: ${e=>r.getSizeValueWithUnits(e.theme,e.size)};
|
|
6
|
+
max-height: ${e=>r.getSizeValueWithUnits(e.theme,e.size)};
|
|
7
|
+
background-color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.color,"enabled","background")};
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
${e=>e.focused===!0&&e.readOnly!==!0?r.getOutlineCss(e.theme):""}
|
|
10
|
+
`,q=b.newStyled.input`
|
|
11
|
+
width: 0.1px;
|
|
12
|
+
height: 0.1px;
|
|
13
|
+
opacity: 0;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
position: absolute;
|
|
16
|
+
z-index: -1;
|
|
17
|
+
`,v=b.newStyled.div`
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
padding: 0.625rem 0.75rem;
|
|
22
|
+
${e=>r.getComponentTypographyCss(e.theme,"Input",e.size,"enabled")}
|
|
23
|
+
color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","prefix")};
|
|
24
|
+
cursor: ${e=>e.disabled===!0?"default":"pointer"};
|
|
25
|
+
background-color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.color,"enabled","background")};
|
|
26
|
+
border: 1px solid
|
|
27
|
+
${e=>r.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,e.disabled===!0?"disabled":"enabled","border")};
|
|
28
|
+
border-radius: 8px 0 0 8px;
|
|
29
|
+
|
|
30
|
+
${e=>e.disabled===!0?r.getDisabledStateCss(e.theme):""}
|
|
31
|
+
`,N=b.newStyled.input`
|
|
32
|
+
width: 100%;
|
|
33
|
+
appearance: none;
|
|
34
|
+
outline: none;
|
|
35
|
+
padding: 0.625rem 0.75rem;
|
|
36
|
+
${e=>r.getComponentTypographyCss(e.theme,"Input",e.size,"enabled")}
|
|
37
|
+
border: 1px solid
|
|
38
|
+
${e=>r.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,e.disabled===!0?"disabled":"enabled","border")};
|
|
39
|
+
border-radius: 0 8px 8px 0;
|
|
40
|
+
border-left: transparent;
|
|
41
|
+
color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","text")};
|
|
42
|
+
|
|
43
|
+
background-color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.color,"enabled","background")};
|
|
44
|
+
color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","text")};
|
|
45
|
+
|
|
46
|
+
${e=>e.disabled===!0?r.getDisabledStateCss(e.theme):""}
|
|
47
|
+
`,h=g.forwardRef((e,f)=>{const{className:x="",style:T={},onChange:s,onFocus:i,onBlur:d,disabled:l,readOnly:m,multiple:C=!1,accept:$="",label:P="Choose File",color:I="primary",size:w="small",...R}=e,z=j.useTheme(),[a,S]=g.useState([]),[p,y]=g.useState(!1);var u={theme:z,size:w,color:I,disabled:l,focused:p};const V=()=>{if(a.length>0){var o="";for(const n in a)o+=n==a.length-1?`${a[n].name}`:`${a[n].name}, `;return o}return""},O=o=>{var n=[];if(o.target.files&&o.target.files.length>0)for(const F of o.target.files)n.push(F);else n=[];S(n),s&&(s==null||s(o,n))};return c.jsxs(k,{...u,className:x,style:T,focused:p,readOnly:m,children:[c.jsx(q,{...u,accept:$,multiple:C,ref:f,onChange:l||m?()=>{}:O,type:"file",onFocus:o=>{l||y(!0),i&&!l&&(i==null||i(o))},onBlur:o=>{l||y(!1),d&&!l&&(d==null||d(o))},...R}),c.jsx(v,{...u,children:P}),c.jsx(N,{tabIndex:-1,...u,onChange:()=>{},value:V()})]})});h.propTypes={id:t.PropTypes.any,disabled:t.PropTypes.bool,readOnly:t.PropTypes.bool,multiple:t.PropTypes.bool,accept:t.PropTypes.string,label:t.PropTypes.oneOfType([t.PropTypes.string,t.PropTypes.element]),tabIndex:t.PropTypes.number,onChange:t.PropTypes.func,onFocus:t.PropTypes.func,onBlur:t.PropTypes.func,className:t.PropTypes.string,style:t.PropTypes.object,size:t.PropTypes.oneOf(["small","medium","large"]),color:t.PropTypes.oneOf(["primary","secondary","success","danger","warning","information","neutral","gray"])};module.exports=h;
|