@zonos/amino 5.1.62 → 5.1.63
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.
|
@@ -6,7 +6,11 @@ export type FilterSelectProps<T extends string = string, O extends SelectOption<
|
|
|
6
6
|
options: O[];
|
|
7
7
|
selectProps?: CustomSelectProps<T, O> | ((editingValue: O | null) => CustomSelectProps<T, O>);
|
|
8
8
|
value: O | null;
|
|
9
|
+
/**
|
|
10
|
+
* @default `is ${value.label}`
|
|
11
|
+
*/
|
|
12
|
+
getFilterText?: (value: O) => string;
|
|
9
13
|
onChange: (value: O | null) => void;
|
|
10
14
|
};
|
|
11
|
-
export declare const FilterSelect: <T extends string = string, O extends SelectOption<T> = SelectOption<T>>({ onChange, options, selectProps, value, ...props }: FilterSelectProps<T, O>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const FilterSelect: <T extends string = string, O extends SelectOption<T> = SelectOption<T>>({ getFilterText, onChange, options, selectProps, value, ...props }: FilterSelectProps<T, O>) => import("react/jsx-runtime").JSX.Element;
|
|
12
16
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../../_tslib-ccfac372.js"),r=require("react/jsx-runtime"),n=require("react"),
|
|
1
|
+
"use strict";var e=require("../../../_tslib-ccfac372.js"),r=require("react/jsx-runtime"),n=require("react"),t=require("../useFilterWrapper.js"),i=require("../../select/Select.js");require("styled-components"),require("../../button/Button.js"),require("../../button/RippleGroup.js"),require("framer-motion"),require("uuid"),require("../../button/_Ripple.js"),require("../../../styles/constants/theme.js"),require("../../button/useRipple.js"),require("../../spinner/Spinner.js"),require("../../../utils/getAminoColor.js"),require("../../text/Text.js"),require("../../../icons/ChevronDownIcon.js"),require("../../../icons/icon-base/_IconBase.js"),require("../../../icons/MinusCircleDuotoneIcon.js"),require("../../../icons/PlusCircleDuotoneIcon.js"),require("../../help-text/HelpText.js"),require("../../select/_StyledReactSelect.js"),require("react-select"),require("../../checkbox/Checkbox.js"),require("clsx"),require("../../../icons/CheckmarkIcon.js"),require("../../../utils/getTestId.js"),require("../../../icons/CheckCircleIcon.js"),require("../../../icons/DoubleChevronIcon.js"),require("../../../icons/RemoveCircleIcon.js"),require("../../../icons/RemoveIcon.js");exports.FilterSelect=function(o){var s=o.getFilterText,u=void 0===s?function(e){return"is ".concat(e.label)}:s,c=o.onChange,l=o.options,a=o.selectProps,q=o.value,p=e.__rest(o,["getFilterText","onChange","options","selectProps","value"]),j=e.__read(n.useState(q),2),C=j[0],_=j[1],f=e.__read(n.useState(!1),2),v=f[0],x=f[1],m=t.useFilterWrapper(e.__assign(e.__assign({},p),{filterExists:!!q,onApply:function(e){(c(C),C)&&e(u(C))},onClose:function(){_(q)},onRemove:function(){c(null),_(null)}})).renderWrapper,b=n.useMemo((function(){return"function"==typeof a?a(C):a}),[C,a]);return m(r.jsx(i.Select,e.__assign({isClearable:!1,onChange:_,onKeyDown:function(e){"Enter"===e.key&&v&&e.stopPropagation()},onMenuClose:function(){return x(!1)},onMenuOpen:function(){return x(!0)},options:l,size:"sm",value:l.filter((function(e){return e.value===(null==C?void 0:C.value)}))},b)))};
|
|
@@ -72,6 +72,10 @@ export type SimpleTableProps<T extends object> = BaseProps & {
|
|
|
72
72
|
*/
|
|
73
73
|
renderCustomRowCheckbox?: (item: T, index: number) => ReactNode;
|
|
74
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Will make the whole row (each td) an anchor tag so native link functionality exists. If clicking just navigates, use this over onRowClick.
|
|
77
|
+
*/
|
|
78
|
+
getRowLink?: (item: T) => string;
|
|
75
79
|
/** Adding unique list keys */
|
|
76
80
|
keyExtractor: (item: T) => string;
|
|
77
81
|
/**
|
|
@@ -90,5 +94,5 @@ export type SimpleTableProps<T extends object> = BaseProps & {
|
|
|
90
94
|
* - 'row-hover-show': Shows only when the row is hovered
|
|
91
95
|
* - 'cell-hover-show': Shows only when the cell is hovered
|
|
92
96
|
*/
|
|
93
|
-
export declare const SimpleTable: <T extends object>({ className, headers, items, keyExtractor, loading, loadingItems, noHoverBackground, onRowClick, onRowHover, renderFooter, selectable, }: SimpleTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
97
|
+
export declare const SimpleTable: <T extends object>({ className, getRowLink, headers, items, keyExtractor, loading, loadingItems, noHoverBackground, onRowClick, onRowHover, renderFooter, selectable, }: SimpleTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
94
98
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var n=require("../../_tslib-ccfac372.js"),e=require("react/jsx-runtime"),o=require("clsx"),i=require("styled-components"),r=require("../checkbox/Checkbox.js"),t=require("../skeleton/Skeleton.js"),d=require("../text/Text.js"),a=require("../../styles/constants/theme.js");function l(n){return n&&n.__esModule?n:{default:n}}require("react"),require("framer-motion"),require("../../icons/CheckmarkIcon.js"),require("../../icons/icon-base/_IconBase.js"),require("../../utils/getTestId.js");var s,c,h=l(o),u=l(i),g=u.default.table(s||(s=n.__makeTemplateObject(["\n width: 100%;\n\n > thead {\n text-transform: uppercase;\n\n > tr {\n border-bottom: ",";\n height: 56px;\n\n > th {\n padding: ",";\n white-space: nowrap;\n\n &.noPadding {\n padding: 0;\n }\n }\n }\n }\n\n > tbody {\n > tr {\n height: 48px;\n\n & {\n border-bottom: ",";\n }\n\n &.withHover:hover {\n background-color: ",";\n }\n\n &.clickable {\n cursor: pointer;\n }\n\n &:not(:hover) {\n .row-hover-show {\n visibility: collapse;\n }\n }\n\n > td {\n padding: ",";\n\n &.noPadding {\n padding: 0;\n }\n\n &.loading {\n text-align: center;\n }\n\n &:not(:hover) {\n .cell-hover-show {\n visibility: collapse;\n }\n }\n\n &.cellLink {\n padding: 0;\n\n > a {\n display: block;\n width: 100%;\n height: 100%;\n padding: ",";\n\n &.noPadding {\n padding: 0;\n }\n }\n }\n }\n }\n }\n"],["\n width: 100%;\n\n > thead {\n text-transform: uppercase;\n\n > tr {\n border-bottom: ",";\n height: 56px;\n\n > th {\n padding: ",";\n white-space: nowrap;\n\n &.noPadding {\n padding: 0;\n }\n }\n }\n }\n\n > tbody {\n > tr {\n height: 48px;\n\n & {\n border-bottom: ",";\n }\n\n &.withHover:hover {\n background-color: ",";\n }\n\n &.clickable {\n cursor: pointer;\n }\n\n &:not(:hover) {\n .row-hover-show {\n visibility: collapse;\n }\n }\n\n > td {\n padding: ",";\n\n &.noPadding {\n padding: 0;\n }\n\n &.loading {\n text-align: center;\n }\n\n &:not(:hover) {\n .cell-hover-show {\n visibility: collapse;\n }\n }\n\n &.cellLink {\n padding: 0;\n\n > a {\n display: block;\n width: 100%;\n height: 100%;\n padding: ",";\n\n &.noPadding {\n padding: 0;\n }\n }\n }\n }\n }\n }\n"])),a.theme.border,a.theme.space16,a.theme.border,a.theme.gray50,a.theme.space12,a.theme.space12),x=u.default(r.Checkbox)(c||(c=n.__makeTemplateObject(["\n padding: ",";\n display: inline-flex;\n"],["\n padding: ",";\n display: inline-flex;\n"])),a.theme.space12);exports.SimpleTable=function(o){var i=o.className,r=o.getRowLink,a=o.headers,l=o.items,s=o.keyExtractor,c=o.loading,u=void 0!==c&&c,p=o.loadingItems,b=void 0===p?10:p,m=o.noHoverBackground,k=void 0!==m&&m,v=o.onRowClick,j=o.onRowHover,w=o.renderFooter,y=o.selectable,C=void 0===y?{enabled:!1}:y;return e.jsxs(g,{className:i,children:[e.jsxs("colgroup",{children:[!!C.onHeaderCheckboxChange&&e.jsx("col",{width:0}),a.map((function(n){return e.jsx("col",{width:void 0!==n.width?"".concat(n.width,"%"):void 0},n.key)}))]}),e.jsx("thead",{children:e.jsxs("tr",{children:[!!C.onHeaderCheckboxChange&&e.jsx("th",{className:"noPadding",children:C.renderCustomHeaderCheckbox||e.jsx(x,{checked:!u&&C.headerCheckboxValue||!1,disabled:u,onChange:C.onHeaderCheckboxChange})}),a.map((function(n){return e.jsx("th",{style:{textAlign:n.align||"start"},children:e.jsx(d.Text,{color:"gray800",type:"small-header",children:n.name})},n.key)}))]})}),e.jsx("tbody",{children:u?n.__spreadArray([],n.__read(Array(b+1).keys()),!1).map((function(n){return e.jsxs("tr",{children:[C.enabled&&e.jsx("td",{children:e.jsx(t.Skeleton,{height:30},n)}),a.map((function(o){return e.jsx("td",{className:h.default({loading:!0,noPadding:o.noPadding}),children:e.jsx(t.Skeleton,{height:30},n)},o.key)}))]},n)})):l.map((function(n,o){var i,t,d,l=!!v||!!C.anySelected&&!!C.onRowCheckboxChange;return e.jsxs("tr",{className:h.default({clickable:l,withHover:!k}),onClick:function(){var e,i,r;C.anySelected?(null===(e=C.isRowCheckboxDisabled)||void 0===e?void 0:e.call(C,n,o))||null===(i=C.onRowCheckboxChange)||void 0===i||i.call(C,!(null===(r=C.isRowChecked)||void 0===r?void 0:r.call(C,n,o)),n,o):null==v||v(n)},onMouseEnter:function(){return null==j?void 0:j(n)},children:[C.enabled&&e.jsx("td",{className:"noPadding",children:(null===(i=C.renderCustomRowCheckbox)||void 0===i?void 0:i.call(C,n,o))||e.jsx(x,{checked:(null===(t=C.isRowChecked)||void 0===t?void 0:t.call(C,n,o))||!1,disabled:(null===(d=C.isRowCheckboxDisabled)||void 0===d?void 0:d.call(C,n,o))||!1,onChange:function(e){var i;return null===(i=C.onRowCheckboxChange)||void 0===i?void 0:i.call(C,e,n,o)}})}),a.map((function(o){return function(n,o){var i=o[n.key],t=function(i){return r?e.jsx("td",{className:"cellLink",children:e.jsx("a",{className:h.default({noPadding:n.noPadding}),href:r(o),style:{textAlign:n.align||"start"},children:i})},n.key):e.jsx("td",{className:h.default({noPadding:n.noPadding}),style:{textAlign:n.align||"start"},children:i},n.key)};return n.renderCustom?e.jsx(e.Fragment,{children:t(n.renderCustom(i,o))}):e.jsx(e.Fragment,{children:t(String(i))})}(o,n)}))]},s(n))}))}),w]})};
|