@razorpay/blade 12.13.1 → 12.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/QuickFilters/QuickFilter.js +39 -0
- package/build/lib/native/components/QuickFilters/QuickFilter.js.map +1 -0
- package/build/lib/native/components/QuickFilters/QuickFilterGroup/QuickFilterContext.js +6 -0
- package/build/lib/native/components/QuickFilters/QuickFilterGroup/QuickFilterContext.js.map +1 -0
- package/build/lib/native/components/QuickFilters/QuickFilterGroup/QuickFilterGroup.js +17 -0
- package/build/lib/native/components/QuickFilters/QuickFilterGroup/QuickFilterGroup.js.map +1 -0
- package/build/lib/native/components/Table/TableBody.native.js.map +1 -1
- package/build/lib/native/components/Table/TableContext.js +1 -1
- package/build/lib/native/components/Table/TableContext.js.map +1 -1
- package/build/lib/native/components/index.js +2 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/web/development/components/QuickFilters/QuickFilter.js +99 -0
- package/build/lib/web/development/components/QuickFilters/QuickFilter.js.map +1 -0
- package/build/lib/web/development/components/QuickFilters/QuickFilterGroup/QuickFilterContext.js +14 -0
- package/build/lib/web/development/components/QuickFilters/QuickFilterGroup/QuickFilterContext.js.map +1 -0
- package/build/lib/web/development/components/QuickFilters/QuickFilterGroup/QuickFilterGroup.js +99 -0
- package/build/lib/web/development/components/QuickFilters/QuickFilterGroup/QuickFilterGroup.js.map +1 -0
- package/build/lib/web/development/components/QuickFilters/QuickFilterGroup/index.js +3 -0
- package/build/lib/web/development/components/QuickFilters/QuickFilterGroup/index.js.map +1 -0
- package/build/lib/web/development/components/QuickFilters/index.js +3 -0
- package/build/lib/web/development/components/QuickFilters/index.js.map +1 -0
- package/build/lib/web/development/components/Table/Table.web.js +38 -11
- package/build/lib/web/development/components/Table/Table.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableBody.web.js +96 -179
- package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableContext.js +5 -1
- package/build/lib/web/development/components/Table/TableContext.js.map +1 -1
- package/build/lib/web/development/components/Table/TableHeader.web.js +22 -5
- package/build/lib/web/development/components/Table/TableHeader.web.js.map +1 -1
- package/build/lib/web/development/components/Table/commonStyles/index.js +2 -0
- package/build/lib/web/development/components/Table/commonStyles/index.js.map +1 -0
- package/build/lib/web/development/components/Table/commonStyles/tableBodyStyles.js +187 -0
- package/build/lib/web/development/components/Table/commonStyles/tableBodyStyles.js.map +1 -0
- package/build/lib/web/development/components/Table/componentIds.js +1 -0
- package/build/lib/web/development/components/Table/componentIds.js.map +1 -1
- package/build/lib/web/development/components/Table/utils.js +29 -0
- package/build/lib/web/development/components/Table/utils.js.map +1 -0
- package/build/lib/web/development/components/index.js +3 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/production/components/QuickFilters/QuickFilter.js +99 -0
- package/build/lib/web/production/components/QuickFilters/QuickFilter.js.map +1 -0
- package/build/lib/web/production/components/QuickFilters/QuickFilterGroup/QuickFilterContext.js +14 -0
- package/build/lib/web/production/components/QuickFilters/QuickFilterGroup/QuickFilterContext.js.map +1 -0
- package/build/lib/web/production/components/QuickFilters/QuickFilterGroup/QuickFilterGroup.js +99 -0
- package/build/lib/web/production/components/QuickFilters/QuickFilterGroup/QuickFilterGroup.js.map +1 -0
- package/build/lib/web/production/components/QuickFilters/QuickFilterGroup/index.js +3 -0
- package/build/lib/web/production/components/QuickFilters/QuickFilterGroup/index.js.map +1 -0
- package/build/lib/web/production/components/QuickFilters/index.js +3 -0
- package/build/lib/web/production/components/QuickFilters/index.js.map +1 -0
- package/build/lib/web/production/components/Table/Table.web.js +38 -11
- package/build/lib/web/production/components/Table/Table.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableBody.web.js +96 -179
- package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableContext.js +5 -1
- package/build/lib/web/production/components/Table/TableContext.js.map +1 -1
- package/build/lib/web/production/components/Table/TableHeader.web.js +22 -5
- package/build/lib/web/production/components/Table/TableHeader.web.js.map +1 -1
- package/build/lib/web/production/components/Table/commonStyles/index.js +2 -0
- package/build/lib/web/production/components/Table/commonStyles/index.js.map +1 -0
- package/build/lib/web/production/components/Table/commonStyles/tableBodyStyles.js +187 -0
- package/build/lib/web/production/components/Table/commonStyles/tableBodyStyles.js.map +1 -0
- package/build/lib/web/production/components/Table/componentIds.js +1 -0
- package/build/lib/web/production/components/Table/componentIds.js.map +1 -1
- package/build/lib/web/production/components/Table/utils.js +29 -0
- package/build/lib/web/production/components/Table/utils.js.map +1 -0
- package/build/lib/web/production/components/index.js +3 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/types/components/index.d.ts +49 -4
- package/build/types/components/index.native.d.ts +49 -4
- package/codemods/aicodemod/knowledge/Table.md +126 -0
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import { useQuickFilterGroupContext } from './QuickFilterGroup/QuickFilterContext.js';
|
|
5
|
+
import { Radio } from '../Radio/Radio.js';
|
|
6
|
+
import '../../tokens/global/typography.js';
|
|
7
|
+
import '../../tokens/global/motion.js';
|
|
8
|
+
import '../Radio/RadioGroup/RadioContext.js';
|
|
9
|
+
import '../../utils/useCallbackRef.js';
|
|
10
|
+
import 'styled-components/native';
|
|
11
|
+
import '@gorhom/portal';
|
|
12
|
+
import 'react-native-gesture-handler';
|
|
13
|
+
import '../BladeProvider/useTheme.js';
|
|
14
|
+
import 'react-native';
|
|
15
|
+
import '../BottomSheet/BottomSheetStack.js';
|
|
16
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
17
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
|
|
18
|
+
import { Text } from '../Typography/Text/Text.js';
|
|
19
|
+
import 'react-native-svg';
|
|
20
|
+
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.native.js';
|
|
21
|
+
import '../Icons/_Svg/Svg/Svg.native.js';
|
|
22
|
+
import { Box } from '../Box/Box.js';
|
|
23
|
+
import '../VisuallyHidden/VisuallyHidden.native.js';
|
|
24
|
+
import '../Typography/Heading/Heading.js';
|
|
25
|
+
import '../Typography/Code/Code.js';
|
|
26
|
+
import '../Typography/Display/Display.js';
|
|
27
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
28
|
+
import '../../utils/makeAccessible/accessibilityMapNative.js';
|
|
29
|
+
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
30
|
+
import { Checkbox } from '../Checkbox/Checkbox.js';
|
|
31
|
+
import '../Checkbox/CheckboxGroup/CheckboxGroupContext.js';
|
|
32
|
+
import { Card, CardBody } from '../Card/Card.js';
|
|
33
|
+
import '../Card/CardHeader.js';
|
|
34
|
+
import '../Card/CardFooter.js';
|
|
35
|
+
|
|
36
|
+
var _excluded=["title","value","trailing","testID"];var QuickFilterContent=function QuickFilterContent(_ref){var value=_ref.value,title=_ref.title,trailing=_ref.trailing,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,_ref$isSelected=_ref.isSelected,isSelected=_ref$isSelected===void 0?false:_ref$isSelected;return jsxs(BaseBox,{display:"flex",flexDirection:"row",gap:"spacing.3",width:"fit-content",justifyContent:"center",alignItems:"center",paddingY:"spacing.3",paddingLeft:"spacing.3",paddingRight:"spacing.4",children:[jsxs(Box,{display:"flex",flexDirection:"row",gap:"spacing.2",justifyContent:"center",alignItems:"center",children:[selectionType==='single'?jsx(Radio,{value:value}):jsx(Checkbox,{value:value}),jsx(Text,{variant:"body",size:"medium",color:isSelected?'interactive.text.primary.subtle':'interactive.text.gray.subtle',weight:"medium",children:title})]}),trailing]});};var QuickFilter=forwardRef(function(_ref2,ref){var title=_ref2.title,value=_ref2.value,trailing=_ref2.trailing,testID=_ref2.testID,rest=_objectWithoutProperties(_ref2,_excluded);var _useQuickFilterGroupC=useQuickFilterGroupContext(),selectedQuickFilters=_useQuickFilterGroupC.selectedQuickFilters,selectionType=_useQuickFilterGroupC.selectionType;var isQuickFilterSelected=selectedQuickFilters.includes(value);return jsx(Card,Object.assign({padding:"spacing.0",as:"label",accessibilityLabel:title,borderRadius:"medium",elevation:"none",isSelected:isQuickFilterSelected,ref:ref},makeAnalyticsAttribute(rest),metaAttribute({testID:testID}),{children:jsx(CardBody,{children:jsx(QuickFilterContent,Object.assign({value:value,title:title,trailing:trailing,selectionType:selectionType,isSelected:isQuickFilterSelected},rest))})}));});
|
|
37
|
+
|
|
38
|
+
export { QuickFilter };
|
|
39
|
+
//# sourceMappingURL=QuickFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickFilter.js","sources":["../../../../../src/components/QuickFilters/QuickFilter.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport type { QuickFilterProps, QuickFilterContentProps } from './types';\nimport { useQuickFilterGroupContext } from './QuickFilterGroup';\nimport { Card, CardBody } from '~components/Card';\nimport { Box } from '~components/Box';\nimport { Text } from '~components/Typography';\nimport { Radio } from '~components/Radio';\nimport { Checkbox } from '~components/Checkbox';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { BladeElementRef } from '~utils/types';\n\nconst QuickFilterContent = ({\n value,\n title,\n trailing,\n selectionType = 'single',\n isSelected = false,\n}: QuickFilterContentProps): React.ReactElement => {\n return (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n gap=\"spacing.3\"\n width=\"fit-content\"\n justifyContent=\"center\"\n alignItems=\"center\"\n paddingY=\"spacing.3\"\n paddingLeft=\"spacing.3\"\n paddingRight=\"spacing.4\"\n >\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n gap=\"spacing.2\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n {selectionType === 'single' ? <Radio value={value} /> : <Checkbox value={value} />}\n <Text\n variant=\"body\"\n size=\"medium\"\n color={isSelected ? 'interactive.text.primary.subtle' : 'interactive.text.gray.subtle'}\n weight=\"medium\"\n >\n {title}\n </Text>\n </Box>\n\n {trailing}\n </BaseBox>\n );\n};\n\nconst QuickFilter = forwardRef<BladeElementRef, QuickFilterProps>(\n ({ title, value, trailing, testID, ...rest }, ref): React.ReactElement => {\n const { selectedQuickFilters, selectionType } = useQuickFilterGroupContext();\n\n const isQuickFilterSelected = selectedQuickFilters.includes(value);\n return (\n <Card\n padding=\"spacing.0\"\n as=\"label\"\n accessibilityLabel={title}\n borderRadius=\"medium\"\n elevation=\"none\"\n isSelected={isQuickFilterSelected}\n ref={ref}\n {...makeAnalyticsAttribute(rest)}\n {...metaAttribute({ testID })}\n >\n <CardBody>\n <QuickFilterContent\n value={value}\n title={title}\n trailing={trailing}\n selectionType={selectionType}\n isSelected={isQuickFilterSelected}\n {...rest}\n />\n </CardBody>\n </Card>\n );\n },\n);\nexport { QuickFilter };\n"],"names":["QuickFilterContent","_ref","value","title","trailing","_ref$selectionType","selectionType","_ref$isSelected","isSelected","_jsxs","BaseBox","display","flexDirection","gap","width","justifyContent","alignItems","paddingY","paddingLeft","paddingRight","children","Box","_jsx","Radio","Checkbox","Text","variant","size","color","weight","QuickFilter","forwardRef","_ref2","ref","testID","rest","_objectWithoutProperties","_excluded","_useQuickFilterGroupC","useQuickFilterGroupContext","selectedQuickFilters","isQuickFilterSelected","includes","Card","Object","assign","padding","as","accessibilityLabel","borderRadius","elevation","makeAnalyticsAttribute","metaAttribute","CardBody"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAaA,IAAMA,kBAAkB,CAAG,SAArBA,kBAAkBA,CAAAC,IAAA,CAM2B,CALjD,IAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK,C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|
|
3
|
+
var QuickFilterGroupContext=React__default.createContext({selectionType:'single',selectedQuickFilters:[]});var QuickFilterGroupProvider=QuickFilterGroupContext.Provider;var useQuickFilterGroupContext=function useQuickFilterGroupContext(){var context=React__default.useContext(QuickFilterGroupContext);return context;};
|
|
4
|
+
|
|
5
|
+
export { QuickFilterGroupProvider, useQuickFilterGroupContext };
|
|
6
|
+
//# sourceMappingURL=QuickFilterContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickFilterContext.js","sources":["../../../../../../src/components/QuickFilters/QuickFilterGroup/QuickFilterContext.tsx"],"sourcesContent":["import React from 'react';\nimport type { QuickFilterGroupContextType } from '../types';\n\nconst QuickFilterGroupContext = React.createContext<QuickFilterGroupContextType>({\n selectionType: 'single',\n selectedQuickFilters: [],\n});\nconst QuickFilterGroupProvider = QuickFilterGroupContext.Provider;\n\nconst useQuickFilterGroupContext = (): QuickFilterGroupContextType => {\n const context = React.useContext(QuickFilterGroupContext);\n return context;\n};\n\nexport { useQuickFilterGroupContext, QuickFilterGroupProvider };\n"],"names":["QuickFilterGroupContext","React","createContext","selectionType","selectedQuickFilters","QuickFilterGroupProvider","Provider","useQuickFilterGroupContext","context","useContext"],"mappings":";;AAGA,IAAMA,uBAAuB,CAAGC,cAAK,CAACC,aAAa,CAA8B,CAC/EC,aAAa,CAAE,QAAQ,CACvBC,oBAAoB,CAAE,EACxB,CAAC,CAAC,CACI,IAAAC,wBAAwB,CAAGL,uBAAuB,CAACM,SAEnD,IAAAC,0BAA0B,CAAG,SAA7BA,0BAA0BA,EAAsC,CACpE,IAAMC,OAAO,CAAGP,cAAK,CAACQ,UAAU,CAACT,uBAAuB,CAAC,CACzD,OAAOQ,OAAO,CAChB;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { QuickFilterGroupProvider, useQuickFilterGroupContext } from './QuickFilterContext.js';
|
|
5
|
+
import '../../Radio/Radio.js';
|
|
6
|
+
import { RadioGroup } from '../../Radio/RadioGroup/RadioGroup.js';
|
|
7
|
+
import { BaseBox } from '../../Box/BaseBox/BaseBox.native.js';
|
|
8
|
+
import '../../Checkbox/Checkbox.js';
|
|
9
|
+
import { CheckboxGroup } from '../../Checkbox/CheckboxGroup/CheckboxGroup.js';
|
|
10
|
+
import { useControllableState } from '../../../utils/useControllable.js';
|
|
11
|
+
import { useId } from '../../../utils/useId.js';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
var _excluded=["children","onChange","setSelectedQuickFilters"],_excluded2=["children","testID","value","defaultValue","onChange","name","selectionType"];var QuickFilterWrapper=function QuickFilterWrapper(_ref){var children=_ref.children;_ref.onChange;var setSelectedQuickFilters=_ref.setSelectedQuickFilters,rest=_objectWithoutProperties(_ref,_excluded);var _useQuickFilterGroupC=useQuickFilterGroupContext(),selectedQuickFilters=_useQuickFilterGroupC.selectedQuickFilters,selectionType=_useQuickFilterGroupC.selectionType;if(selectionType==='single'){return jsx(RadioGroup,Object.assign({value:selectedQuickFilters[0],onChange:function onChange(_ref2){var value=_ref2.value;setSelectedQuickFilters(function(){return [value];});},size:"small"},rest,{children:children}));}return jsx(CheckboxGroup,Object.assign({value:selectedQuickFilters,onChange:function onChange(_ref3){var values=_ref3.values;setSelectedQuickFilters(function(){return values;});},size:"small"},rest,{children:children}));};var QuickFilterGroup=function QuickFilterGroup(_ref4){var children=_ref4.children;_ref4.testID;var value=_ref4.value,defaultValue=_ref4.defaultValue,_onChange=_ref4.onChange,name=_ref4.name,selectionType=_ref4.selectionType,rest=_objectWithoutProperties(_ref4,_excluded2);var idBase=useId('quick-filter-group');var _useControllableState=useControllableState({value:value&&selectionType==='single'?[value]:value,defaultValue:defaultValue&&selectionType==='single'?[defaultValue]:defaultValue!=null?defaultValue:[],onChange:function onChange(values){return _onChange==null?void 0:_onChange({values:values,name:name!=null?name:idBase});}}),_useControllableState2=_slicedToArray(_useControllableState,2),selectedQuickFilters=_useControllableState2[0],setSelectedQuickFilters=_useControllableState2[1];return jsx(QuickFilterGroupProvider,{value:{selectionType:selectionType,selectedQuickFilters:selectedQuickFilters},children:jsx(QuickFilterWrapper,Object.assign({onChange:_onChange,setSelectedQuickFilters:setSelectedQuickFilters},rest,{children:jsx(BaseBox,{display:"flex",flexDirection:"row",gap:"spacing.3",children:children})}))});};
|
|
15
|
+
|
|
16
|
+
export { QuickFilterGroup };
|
|
17
|
+
//# sourceMappingURL=QuickFilterGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickFilterGroup.js","sources":["../../../../../../src/components/QuickFilters/QuickFilterGroup/QuickFilterGroup.tsx"],"sourcesContent":["import React from 'react';\nimport type { QuickFilterGroupProps, QuickFilterWrapperProps } from '../types';\nimport { QuickFilterGroupProvider, useQuickFilterGroupContext } from './QuickFilterContext';\nimport { RadioGroup } from '~components/Radio';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CheckboxGroup } from '~components/Checkbox';\nimport { useControllableState } from '~utils/useControllable';\nimport { useId } from '~utils/useId';\n\nconst QuickFilterWrapper = ({\n children,\n onChange,\n setSelectedQuickFilters,\n ...rest\n}: QuickFilterWrapperProps): React.ReactElement => {\n const { selectedQuickFilters, selectionType } = useQuickFilterGroupContext();\n\n if (selectionType === 'single') {\n return (\n <RadioGroup\n value={selectedQuickFilters[0]}\n onChange={({ value }) => {\n setSelectedQuickFilters(() => [value]);\n }}\n size=\"small\"\n {...rest}\n >\n {children}\n </RadioGroup>\n );\n }\n return (\n <CheckboxGroup\n value={selectedQuickFilters}\n onChange={({ values }) => {\n setSelectedQuickFilters(() => values);\n }}\n size=\"small\"\n {...rest}\n >\n {children}\n </CheckboxGroup>\n );\n};\n\nconst QuickFilterGroup = ({\n children,\n testID,\n value,\n defaultValue,\n onChange,\n name,\n selectionType,\n ...rest\n}: QuickFilterGroupProps): React.ReactElement => {\n const idBase = useId('quick-filter-group');\n const [selectedQuickFilters, setSelectedQuickFilters] = useControllableState({\n value: (value && selectionType === 'single' ? [value] : value) as string[] | undefined,\n // If selectionType is single, we need to convert the value to an array\n defaultValue: (defaultValue && selectionType === 'single'\n ? [defaultValue]\n : defaultValue ?? []) as string[] | undefined,\n onChange: (values: string[]) => onChange?.({ values, name: name ?? idBase }),\n });\n return (\n <QuickFilterGroupProvider value={{ selectionType, selectedQuickFilters }}>\n <QuickFilterWrapper\n onChange={onChange}\n setSelectedQuickFilters={setSelectedQuickFilters}\n {...rest}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" gap=\"spacing.3\">\n {children}\n </BaseBox>\n </QuickFilterWrapper>\n </QuickFilterGroupProvider>\n );\n};\n\nexport { QuickFilterGroup };\n"],"names":["QuickFilterWrapper","_ref","children","onChange","setSelectedQuickFilters","rest","_objectWithoutProperties","_excluded","_useQuickFilterGroupC","useQuickFilterGroupContext","selectedQuickFilters","selectionType","_jsx","RadioGroup","Object","assign","value","_ref2","size","CheckboxGroup","_ref3","values","QuickFilterGroup","_ref4","testID","defaultValue","name","_excluded2","idBase","useId","_useControllableState","useControllableState","_useControllableState2","_slicedToArray","QuickFilterGroupProvider","BaseBox","display","flexDirection","gap"],"mappings":";;;;;;;;;;;;;0JASA,IAAMA,kBAAkB,CAAG,SAArBA,kBAAkBA,CAAAC,IAAA,CAK2B,CAJjD,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACAD,IAAA,CAARE,QAAQ,KACRC,uBAAuB,CAAAH,IAAA,CAAvBG,uBAAuB,CACpBC,IAAI,CAAAC,wBAAA,CAAAL,IAAA,CAAAM,SAAA,EAEP,IAAAC,qBAAA,CAAgDC,0BAA0B,EAAE,CAApEC,oBAAoB,CAAAF,qBAAA,CAApBE,oBAAoB,CAAEC,aAAa,CAAAH,qBAAA,CAAbG,aAAa,CAE3C,G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cesContent":["/* eslint-disable react/no-unused-prop-types */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React from 'react';\nimport type { TableBodyProps, TableCellProps, TableRowProps } from './types';\nimport { Text } from '~components/Typography';\n\nconst TableBody = (props: TableBodyProps): React.ReactElement => {\n return <Text>Table Component is not available for Native mobile apps.</Text>;\n};\n\nconst TableRow = (props: TableRowProps<unknown>): React.ReactElement => {\n return <Text>Table Component is not available for Native mobile apps.</Text>;\n};\n\nconst TableCell = (props: TableCellProps): React.ReactElement => {\n return <Text>Table Component is not available for Native mobile apps.</Text>;\n};\n\nconst StyledCell = (props: TableCellProps): React.ReactElement => {\n return <Text>Table Component is not available for Native mobile apps.</Text>;\n};\n\nconst CellWrapper = (props: TableCellProps): React.ReactElement => {\n return <Text>Table Component is not available for Native mobile apps.</Text>;\n};\n\nexport { TableBody, TableRow, TableCell, StyledCell, CellWrapper };\n"],"names":["TableBody","props","_jsx","Text","children","TableRow","TableCell"],"mappings":";;;;;;;AAMM,IAAAA,SAAS,CAAG,SAAZA,SAASA,
|
|
1
|
+
{"version":3,"file":"TableBody.native.js","sources":["../../../../../src/components/Table/TableBody.native.tsx"],"sourcesContent":["/* eslint-disable react/no-unused-prop-types */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React from 'react';\nimport type { TableBodyProps, TableCellProps, TableRowProps } from './types';\nimport { Text } from '~components/Typography';\n\nconst TableBody = <Item,>(props: TableBodyProps<Item>): React.ReactElement => {\n return <Text>Table Component is not available for Native mobile apps.</Text>;\n};\n\nconst TableRow = (props: TableRowProps<unknown>): React.ReactElement => {\n return <Text>Table Component is not available for Native mobile apps.</Text>;\n};\n\nconst TableCell = (props: TableCellProps): React.ReactElement => {\n return <Text>Table Component is not available for Native mobile apps.</Text>;\n};\n\nconst StyledCell = (props: TableCellProps): React.ReactElement => {\n return <Text>Table Component is not available for Native mobile apps.</Text>;\n};\n\nconst CellWrapper = (props: TableCellProps): React.ReactElement => {\n return <Text>Table Component is not available for Native mobile apps.</Text>;\n};\n\nexport { TableBody, TableRow, TableCell, StyledCell, CellWrapper };\n"],"names":["TableBody","props","_jsx","Text","children","TableRow","TableCell"],"mappings":";;;;;;;AAMM,IAAAA,SAAS,CAAG,SAAZA,SAASA,CAAWC,KAA2B,CAAyB,CAC5E,OAAOC,GAAA,CAACC,IAAI,CAAA,CAAAC,QAAA,CAAC,0DAAwD,CAAM,CAAC,CAC9E,EAEM,IAAAC,QAAQ,CAAG,SAAXA,QAAQA,CAAIJ,KAA6B,CAAyB,CACtE,OAAOC,GAAA,CAACC,IAAI,CAAAC,CAAAA,QAAA,CAAC,0DAAwD,CAAM,CAAC,CAC9E,EAEM,IAAAE,SAAS,CAAG,SAAZA,SAASA,CAAIL,KAAqB,CAAyB,CAC/D,OAAOC,GAAA,CAACC,IAAI,EAAAC,QAAA,CAAC,0DAAwD,CAAM,CAAC,CAC9E;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
|
|
3
|
-
var TableContext=React__default.createContext({selectionType:'none',selectedRows:undefined,totalItems:0,toggleRowSelectionById:function toggleRowSelectionById(){},toggleAllRowsSelection:function toggleAllRowsSelection(){},deselectAllRows:function deselectAllRows(){},rowDensity:'normal',toggleSort:function toggleSort(){},currentSortedState:{sortKey:'',isSortReversed:false},setPaginationPage:function setPaginationPage(){},setPaginationRowSize:function setPaginationRowSize(){},disabledRows:[],setDisabledRows:function setDisabledRows(){},paginationType:'client',setPaginationType:function setPaginationType(){},backgroundColor:'surface.background.gray.intense',setHeaderRowDensity:function setHeaderRowDensity(){},showBorderedCells:false,hasHoverActions:false,setHasHoverActions:function setHasHoverActions(){}});var useTableContext=function useTableContext(){var context=React__default.useContext(TableContext);return context;};
|
|
3
|
+
var TableContext=React__default.createContext({selectionType:'none',selectedRows:undefined,totalItems:0,toggleRowSelectionById:function toggleRowSelectionById(){},toggleAllRowsSelection:function toggleAllRowsSelection(){},deselectAllRows:function deselectAllRows(){},rowDensity:'normal',toggleSort:function toggleSort(){},currentSortedState:{sortKey:'',isSortReversed:false},setPaginationPage:function setPaginationPage(){},setPaginationRowSize:function setPaginationRowSize(){},disabledRows:[],setDisabledRows:function setDisabledRows(){},paginationType:'client',setPaginationType:function setPaginationType(){},backgroundColor:'surface.background.gray.intense',setHeaderRowDensity:function setHeaderRowDensity(){},showBorderedCells:false,hasHoverActions:false,setHasHoverActions:function setHasHoverActions(){},columnCount:0,gridTemplateColumns:undefined,isVirtualized:false,tableData:[]});var useTableContext=function useTableContext(){var context=React__default.useContext(TableContext);return context;};
|
|
4
4
|
|
|
5
5
|
export { TableContext, useTableContext };
|
|
6
6
|
//# sourceMappingURL=TableContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableContext.js","sources":["../../../../../src/components/Table/TableContext.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nimport React from 'react';\nimport type { TableNode } from '@table-library/react-table-library/table';\nimport type {\n TableBackgroundColors,\n TableProps,\n TablePaginationType,\n TableHeaderRowProps,\n} from './types';\n\nexport type TableContextType = {\n selectionType?: TableProps<unknown>['selectionType'];\n selectedRows?: TableNode['id'][];\n totalItems: number;\n toggleRowSelectionById: (id: TableNode['id']) => void;\n toggleAllRowsSelection: () => void;\n deselectAllRows: () => void;\n rowDensity: NonNullable<TableProps<unknown>['rowDensity']>;\n toggleSort: (sortKey: string) => void;\n currentSortedState: {\n sortKey: string;\n isSortReversed: boolean;\n sortableColumns?: string[];\n };\n setPaginationPage: (page: number) => void;\n setPaginationRowSize: (size: number) => void;\n currentPaginationState?: {\n page: number;\n size: number;\n };\n showStripedRows?: boolean;\n disabledRows: TableNode['id'][];\n setDisabledRows: React.Dispatch<React.SetStateAction<TableNode['id'][]>>;\n paginationType: NonNullable<TablePaginationType>;\n setPaginationType: React.Dispatch<React.SetStateAction<NonNullable<TablePaginationType>>>;\n backgroundColor: TableBackgroundColors;\n headerRowDensity?: TableHeaderRowProps['rowDensity'];\n setHeaderRowDensity: React.Dispatch<React.SetStateAction<TableHeaderRowProps['rowDensity']>>;\n showBorderedCells: NonNullable<TableProps<unknown>['showBorderedCells']>;\n hasHoverActions: boolean;\n setHasHoverActions: (hasHoverActions: boolean) => void;\n};\n\nconst TableContext = React.createContext<TableContextType
|
|
1
|
+
{"version":3,"file":"TableContext.js","sources":["../../../../../src/components/Table/TableContext.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nimport React from 'react';\nimport type { TableNode } from '@table-library/react-table-library/table';\nimport type {\n TableBackgroundColors,\n TableProps,\n TablePaginationType,\n TableHeaderRowProps,\n TableNode as LocalTableNode,\n} from './types';\n\nexport type TableContextType<Item> = {\n selectionType?: TableProps<unknown>['selectionType'];\n selectedRows?: TableNode['id'][];\n totalItems: number;\n toggleRowSelectionById: (id: TableNode['id']) => void;\n toggleAllRowsSelection: () => void;\n deselectAllRows: () => void;\n rowDensity: NonNullable<TableProps<unknown>['rowDensity']>;\n toggleSort: (sortKey: string) => void;\n currentSortedState: {\n sortKey: string;\n isSortReversed: boolean;\n sortableColumns?: string[];\n };\n setPaginationPage: (page: number) => void;\n setPaginationRowSize: (size: number) => void;\n currentPaginationState?: {\n page: number;\n size: number;\n };\n showStripedRows?: boolean;\n disabledRows: TableNode['id'][];\n setDisabledRows: React.Dispatch<React.SetStateAction<TableNode['id'][]>>;\n paginationType: NonNullable<TablePaginationType>;\n setPaginationType: React.Dispatch<React.SetStateAction<NonNullable<TablePaginationType>>>;\n backgroundColor: TableBackgroundColors;\n headerRowDensity?: TableHeaderRowProps['rowDensity'];\n setHeaderRowDensity: React.Dispatch<React.SetStateAction<TableHeaderRowProps['rowDensity']>>;\n showBorderedCells: NonNullable<TableProps<unknown>['showBorderedCells']>;\n hasHoverActions: boolean;\n setHasHoverActions: (hasHoverActions: boolean) => void;\n columnCount: number;\n gridTemplateColumns: string | undefined;\n isVirtualized?: boolean;\n tableData: LocalTableNode<Item>[];\n};\n\nconst TableContext = React.createContext<TableContextType<unknown>>({\n selectionType: 'none',\n selectedRows: undefined,\n totalItems: 0,\n toggleRowSelectionById: () => {},\n toggleAllRowsSelection: () => {},\n deselectAllRows: () => {},\n rowDensity: 'normal',\n toggleSort: () => {},\n currentSortedState: {\n sortKey: '',\n isSortReversed: false,\n },\n setPaginationPage: () => {},\n setPaginationRowSize: () => {},\n disabledRows: [],\n setDisabledRows: () => {},\n paginationType: 'client',\n setPaginationType: () => {},\n backgroundColor: 'surface.background.gray.intense',\n setHeaderRowDensity: () => {},\n showBorderedCells: false,\n hasHoverActions: false,\n setHasHoverActions: () => {},\n columnCount: 0,\n gridTemplateColumns: undefined,\n isVirtualized: false,\n tableData: [],\n});\n\nconst useTableContext = <Item,>(): TableContextType<Item> => {\n const context = React.useContext(TableContext as React.Context<TableContextType<Item>>);\n return context;\n};\n\nexport { useTableContext, TableContext };\n"],"names":["TableContext","React","createContext","selectionType","selectedRows","undefined","totalItems","toggleRowSelectionById","toggleAllRowsSelection","deselectAllRows","rowDensity","toggleSort","currentSortedState","sortKey","isSortReversed","setPaginationPage","setPaginationRowSize","disabledRows","setDisabledRows","paginationType","setPaginationType","backgroundColor","setHeaderRowDensity","showBorderedCells","hasHoverActions","setHasHoverActions","columnCount","gridTemplateColumns","isVirtualized","tableData","useTableContext","context","useContext"],"mappings":";;AAiDM,IAAAA,YAAY,CAAGC,cAAK,CAACC,aAAa,CAA4B,CAClEC,aAAa,CAAE,MAAM,CACrBC,YAAY,CAAEC,SAAS,CACvBC,UAAU,CAAE,CAAC,CACbC,sBAAsB,CAAE,SAAAA,sBAAA,EAAM,EAAE,CAChCC,sBAAsB,CAAE,SAAAA,wBAAM,EAAE,CAChCC,eAAe,CAAE,SAAAA,eAAAA,EAAM,EAAE,CACzBC,UAAU,CAAE,QAAQ,CACpBC,UAAU,CAAE,SAAAA,UAAAA,EAAM,EAAE,CACpBC,kBAAkB,CAAE,CAClBC,OAAO,CAAE,EAAE,CACXC,cAAc,CAAE,KAClB,CAAC,CACDC,iBAAiB,CAAE,SAAAA,iBAAA,EAAM,EAAE,CAC3BC,oBAAoB,CAAE,SAAAA,sBAAM,EAAE,CAC9BC,YAAY,CAAE,EAAE,CAChBC,eAAe,CAAE,SAAAA,eAAAA,EAAM,EAAE,CACzBC,cAAc,CAAE,QAAQ,CACxBC,iBAAiB,CAAE,SAAAA,iBAAAA,EAAM,EAAE,CAC3BC,eAAe,CAAE,iCAAiC,CAClDC,mBAAmB,CAAE,SAAAA,mBAAAA,EAAM,EAAE,CAC7BC,iBAAiB,CAAE,KAAK,CACxBC,eAAe,CAAE,KAAK,CACtBC,kBAAkB,CAAE,SAAAA,oBAAM,EAAE,CAC5BC,WAAW,CAAE,CAAC,CACdC,mBAAmB,CAAEtB,SAAS,CAC9BuB,aAAa,CAAE,KAAK,CACpBC,SAAS,CAAE,EACb,CAAC,EAEK,IAAAC,eAAe,CAAG,SAAlBA,eAAeA,EAAwC,CAC3D,IAAMC,OAAO,CAAG9B,cAAK,CAAC+B,UAAU,CAAChC,YAAqD,CAAC,CACvF,OAAO+B,OAAO,CAChB;;;;"}
|
|
@@ -460,6 +460,8 @@ export { MenuFooter, MenuHeader } from './Menu/VisualSubComponents/MenuHeaderFoo
|
|
|
460
460
|
export { Popover } from './Popover/Popover.native.js';
|
|
461
461
|
export { PopoverInteractiveWrapper } from './Popover/PopoverInteractiveWrapper.native.js';
|
|
462
462
|
export { ProgressBar } from './ProgressBar/ProgressBar.js';
|
|
463
|
+
export { QuickFilter } from './QuickFilters/QuickFilter.js';
|
|
464
|
+
export { QuickFilterGroup } from './QuickFilters/QuickFilterGroup/QuickFilterGroup.js';
|
|
463
465
|
export { Radio } from './Radio/Radio.js';
|
|
464
466
|
export { RadioGroup } from './Radio/RadioGroup/RadioGroup.js';
|
|
465
467
|
export { Scale } from './Scale/Scale.native.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import './QuickFilterGroup/index.js';
|
|
5
|
+
import '../Card/index.js';
|
|
6
|
+
import '../Box/index.js';
|
|
7
|
+
import '../Typography/index.js';
|
|
8
|
+
import '../Radio/index.js';
|
|
9
|
+
import '../Checkbox/index.js';
|
|
10
|
+
import '../../utils/makeAnalyticsAttribute/index.js';
|
|
11
|
+
import '../../utils/metaAttribute/index.js';
|
|
12
|
+
import '../Box/BaseBox/index.js';
|
|
13
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
15
|
+
import { Box } from '../Box/Box.js';
|
|
16
|
+
import { Radio } from '../Radio/Radio.js';
|
|
17
|
+
import { Checkbox } from '../Checkbox/Checkbox.js';
|
|
18
|
+
import { Text } from '../Typography/Text/Text.js';
|
|
19
|
+
import { useQuickFilterGroupContext } from './QuickFilterGroup/QuickFilterContext.js';
|
|
20
|
+
import { Card, CardBody } from '../Card/Card.js';
|
|
21
|
+
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
22
|
+
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
23
|
+
|
|
24
|
+
var _excluded = ["title", "value", "trailing", "testID"];
|
|
25
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27
|
+
var QuickFilterContent = function QuickFilterContent(_ref) {
|
|
28
|
+
var value = _ref.value,
|
|
29
|
+
title = _ref.title,
|
|
30
|
+
trailing = _ref.trailing,
|
|
31
|
+
_ref$selectionType = _ref.selectionType,
|
|
32
|
+
selectionType = _ref$selectionType === void 0 ? 'single' : _ref$selectionType,
|
|
33
|
+
_ref$isSelected = _ref.isSelected,
|
|
34
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected;
|
|
35
|
+
return /*#__PURE__*/jsxs(BaseBox, {
|
|
36
|
+
display: "flex",
|
|
37
|
+
flexDirection: "row",
|
|
38
|
+
gap: "spacing.3",
|
|
39
|
+
width: "fit-content",
|
|
40
|
+
justifyContent: "center",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
paddingY: "spacing.3",
|
|
43
|
+
paddingLeft: "spacing.3",
|
|
44
|
+
paddingRight: "spacing.4",
|
|
45
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
46
|
+
display: "flex",
|
|
47
|
+
flexDirection: "row",
|
|
48
|
+
gap: "spacing.2",
|
|
49
|
+
justifyContent: "center",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
children: [selectionType === 'single' ? /*#__PURE__*/jsx(Radio, {
|
|
52
|
+
value: value
|
|
53
|
+
}) : /*#__PURE__*/jsx(Checkbox, {
|
|
54
|
+
value: value
|
|
55
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
56
|
+
variant: "body",
|
|
57
|
+
size: "medium",
|
|
58
|
+
color: isSelected ? 'interactive.text.primary.subtle' : 'interactive.text.gray.subtle',
|
|
59
|
+
weight: "medium",
|
|
60
|
+
children: title
|
|
61
|
+
})]
|
|
62
|
+
}), trailing]
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
var QuickFilter = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
66
|
+
var title = _ref2.title,
|
|
67
|
+
value = _ref2.value,
|
|
68
|
+
trailing = _ref2.trailing,
|
|
69
|
+
testID = _ref2.testID,
|
|
70
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
71
|
+
var _useQuickFilterGroupC = useQuickFilterGroupContext(),
|
|
72
|
+
selectedQuickFilters = _useQuickFilterGroupC.selectedQuickFilters,
|
|
73
|
+
selectionType = _useQuickFilterGroupC.selectionType;
|
|
74
|
+
var isQuickFilterSelected = selectedQuickFilters.includes(value);
|
|
75
|
+
return /*#__PURE__*/jsx(Card, _objectSpread(_objectSpread(_objectSpread({
|
|
76
|
+
padding: "spacing.0",
|
|
77
|
+
as: "label",
|
|
78
|
+
accessibilityLabel: title,
|
|
79
|
+
borderRadius: "medium",
|
|
80
|
+
elevation: "none",
|
|
81
|
+
isSelected: isQuickFilterSelected,
|
|
82
|
+
ref: ref
|
|
83
|
+
}, makeAnalyticsAttribute(rest)), metaAttribute({
|
|
84
|
+
testID: testID
|
|
85
|
+
})), {}, {
|
|
86
|
+
children: /*#__PURE__*/jsx(CardBody, {
|
|
87
|
+
children: /*#__PURE__*/jsx(QuickFilterContent, _objectSpread({
|
|
88
|
+
value: value,
|
|
89
|
+
title: title,
|
|
90
|
+
trailing: trailing,
|
|
91
|
+
selectionType: selectionType,
|
|
92
|
+
isSelected: isQuickFilterSelected
|
|
93
|
+
}, rest))
|
|
94
|
+
})
|
|
95
|
+
}));
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export { QuickFilter };
|
|
99
|
+
//# sourceMappingURL=QuickFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickFilter.js","sources":["../../../../../../src/components/QuickFilters/QuickFilter.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport type { QuickFilterProps, QuickFilterContentProps } from './types';\nimport { useQuickFilterGroupContext } from './QuickFilterGroup';\nimport { Card, CardBody } from '~components/Card';\nimport { Box } from '~components/Box';\nimport { Text } from '~components/Typography';\nimport { Radio } from '~components/Radio';\nimport { Checkbox } from '~components/Checkbox';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { BladeElementRef } from '~utils/types';\n\nconst QuickFilterContent = ({\n value,\n title,\n trailing,\n selectionType = 'single',\n isSelected = false,\n}: QuickFilterContentProps): React.ReactElement => {\n return (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n gap=\"spacing.3\"\n width=\"fit-content\"\n justifyContent=\"center\"\n alignItems=\"center\"\n paddingY=\"spacing.3\"\n paddingLeft=\"spacing.3\"\n paddingRight=\"spacing.4\"\n >\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n gap=\"spacing.2\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n {selectionType === 'single' ? <Radio value={value} /> : <Checkbox value={value} />}\n <Text\n variant=\"body\"\n size=\"medium\"\n color={isSelected ? 'interactive.text.primary.subtle' : 'interactive.text.gray.subtle'}\n weight=\"medium\"\n >\n {title}\n </Text>\n </Box>\n\n {trailing}\n </BaseBox>\n );\n};\n\nconst QuickFilter = forwardRef<BladeElementRef, QuickFilterProps>(\n ({ title, value, trailing, testID, ...rest }, ref): React.ReactElement => {\n const { selectedQuickFilters, selectionType } = useQuickFilterGroupContext();\n\n const isQuickFilterSelected = selectedQuickFilters.includes(value);\n return (\n <Card\n padding=\"spacing.0\"\n as=\"label\"\n accessibilityLabel={title}\n borderRadius=\"medium\"\n elevation=\"none\"\n isSelected={isQuickFilterSelected}\n ref={ref}\n {...makeAnalyticsAttribute(rest)}\n {...metaAttribute({ testID })}\n >\n <CardBody>\n <QuickFilterContent\n value={value}\n title={title}\n trailing={trailing}\n selectionType={selectionType}\n isSelected={isQuickFilterSelected}\n {...rest}\n />\n </CardBody>\n </Card>\n );\n },\n);\nexport { QuickFilter };\n"],"names":["QuickFilterContent","_ref","value","title","trailing","_ref$selectionType","selectionType","_ref$isSelected","isSelected","_jsxs","BaseBox","display","flexDirection","gap","width","justifyContent","alignItems","paddingY","paddingLeft","paddingRight","children","Box","_jsx","Radio","Checkbox","Text","variant","size","color","weight","QuickFilter","forwardRef","_ref2","ref","testID","rest","_objectWithoutProperties","_excluded","_useQuickFilterGroupC","useQuickFilterGroupContext","selectedQuickFilters","isQuickFilterSelected","includes","Card","_objectSpread","padding","as","accessibilityLabel","borderRadius","elevation","makeAnalyticsAttribute","metaAttribute","CardBody"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAM2B;AAA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C,CAAA,EAAA,EAAA,EAAA;IAAAd,QAAA,eAE7BE,GAAA,CAAC8B,QAAQ,EAAA;AAAAhC,MAAAA,QAAA,eACPE,GAAA,CAACtB,kBAAkB,EAAA4C,aAAA,CAAA;AACjB1C,QAAAA,KAAK,EAAEA,KAAM;AACbC,QAAAA,KAAK,EAAEA,KAAM;AACbC,QAAAA,QAAQ,EAAEA,QAAS;AACnBE,QAAAA,aAAa,EAAEA,aAAc;AAC7BE,QAAAA,UAAU,EAAEiC,qBAAAA;AAAsB,OAAA,EAC9BN,IAAI,CACT,CAAA;KACO,CAAA;AAAC,GAAA,CACP,CAAC,CAAA;AAEX,CACF;;;;"}
|
package/build/lib/web/development/components/QuickFilters/QuickFilterGroup/QuickFilterContext.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
var QuickFilterGroupContext = /*#__PURE__*/React__default.createContext({
|
|
4
|
+
selectionType: 'single',
|
|
5
|
+
selectedQuickFilters: []
|
|
6
|
+
});
|
|
7
|
+
var QuickFilterGroupProvider = QuickFilterGroupContext.Provider;
|
|
8
|
+
var useQuickFilterGroupContext = function useQuickFilterGroupContext() {
|
|
9
|
+
var context = React__default.useContext(QuickFilterGroupContext);
|
|
10
|
+
return context;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { QuickFilterGroupProvider, useQuickFilterGroupContext };
|
|
14
|
+
//# sourceMappingURL=QuickFilterContext.js.map
|
package/build/lib/web/development/components/QuickFilters/QuickFilterGroup/QuickFilterContext.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickFilterContext.js","sources":["../../../../../../../src/components/QuickFilters/QuickFilterGroup/QuickFilterContext.tsx"],"sourcesContent":["import React from 'react';\nimport type { QuickFilterGroupContextType } from '../types';\n\nconst QuickFilterGroupContext = React.createContext<QuickFilterGroupContextType>({\n selectionType: 'single',\n selectedQuickFilters: [],\n});\nconst QuickFilterGroupProvider = QuickFilterGroupContext.Provider;\n\nconst useQuickFilterGroupContext = (): QuickFilterGroupContextType => {\n const context = React.useContext(QuickFilterGroupContext);\n return context;\n};\n\nexport { useQuickFilterGroupContext, QuickFilterGroupProvider };\n"],"names":["QuickFilterGroupContext","React","createContext","selectionType","selectedQuickFilters","QuickFilterGroupProvider","Provider","useQuickFilterGroupContext","context","useContext"],"mappings":";;AAGA,IAAMA,uBAAuB,gBAAGC,cAAK,CAACC,aAAa,CAA8B;AAC/EC,EAAAA,aAAa,EAAE,QAAQ;AACvBC,EAAAA,oBAAoB,EAAE,EAAA;AACxB,CAAC,CAAC,CAAA;AACF,IAAMC,wBAAwB,GAAGL,uBAAuB,CAACM,SAAQ;AAEjE,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,GAAsC;AACpE,EAAA,IAAMC,OAAO,GAAGP,cAAK,CAACQ,UAAU,CAACT,uBAAuB,CAAC,CAAA;AACzD,EAAA,OAAOQ,OAAO,CAAA;AAChB;;;;"}
|
package/build/lib/web/development/components/QuickFilters/QuickFilterGroup/QuickFilterGroup.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
+
import 'react';
|
|
5
|
+
import { useQuickFilterGroupContext, QuickFilterGroupProvider } from './QuickFilterContext.js';
|
|
6
|
+
import '../../Radio/index.js';
|
|
7
|
+
import '../../Box/BaseBox/index.js';
|
|
8
|
+
import '../../Checkbox/index.js';
|
|
9
|
+
import { useControllableState } from '../../../utils/useControllable.js';
|
|
10
|
+
import { useId } from '../../../utils/useId.js';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
import { RadioGroup } from '../../Radio/RadioGroup/RadioGroup.js';
|
|
13
|
+
import { CheckboxGroup } from '../../Checkbox/CheckboxGroup/CheckboxGroup.js';
|
|
14
|
+
import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
|
|
15
|
+
|
|
16
|
+
var _excluded = ["children", "onChange", "setSelectedQuickFilters"],
|
|
17
|
+
_excluded2 = ["children", "testID", "value", "defaultValue", "onChange", "name", "selectionType"];
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
var QuickFilterWrapper = function QuickFilterWrapper(_ref) {
|
|
21
|
+
var children = _ref.children,
|
|
22
|
+
onChange = _ref.onChange,
|
|
23
|
+
setSelectedQuickFilters = _ref.setSelectedQuickFilters,
|
|
24
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
var _useQuickFilterGroupC = useQuickFilterGroupContext(),
|
|
26
|
+
selectedQuickFilters = _useQuickFilterGroupC.selectedQuickFilters,
|
|
27
|
+
selectionType = _useQuickFilterGroupC.selectionType;
|
|
28
|
+
if (selectionType === 'single') {
|
|
29
|
+
return /*#__PURE__*/jsx(RadioGroup, _objectSpread(_objectSpread({
|
|
30
|
+
value: selectedQuickFilters[0],
|
|
31
|
+
onChange: function onChange(_ref2) {
|
|
32
|
+
var value = _ref2.value;
|
|
33
|
+
setSelectedQuickFilters(function () {
|
|
34
|
+
return [value];
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
size: "small"
|
|
38
|
+
}, rest), {}, {
|
|
39
|
+
children: children
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
return /*#__PURE__*/jsx(CheckboxGroup, _objectSpread(_objectSpread({
|
|
43
|
+
value: selectedQuickFilters,
|
|
44
|
+
onChange: function onChange(_ref3) {
|
|
45
|
+
var values = _ref3.values;
|
|
46
|
+
setSelectedQuickFilters(function () {
|
|
47
|
+
return values;
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
size: "small"
|
|
51
|
+
}, rest), {}, {
|
|
52
|
+
children: children
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
var QuickFilterGroup = function QuickFilterGroup(_ref4) {
|
|
56
|
+
var children = _ref4.children,
|
|
57
|
+
testID = _ref4.testID,
|
|
58
|
+
value = _ref4.value,
|
|
59
|
+
defaultValue = _ref4.defaultValue,
|
|
60
|
+
_onChange = _ref4.onChange,
|
|
61
|
+
name = _ref4.name,
|
|
62
|
+
selectionType = _ref4.selectionType,
|
|
63
|
+
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
64
|
+
var idBase = useId('quick-filter-group');
|
|
65
|
+
var _useControllableState = useControllableState({
|
|
66
|
+
value: value && selectionType === 'single' ? [value] : value,
|
|
67
|
+
// If selectionType is single, we need to convert the value to an array
|
|
68
|
+
defaultValue: defaultValue && selectionType === 'single' ? [defaultValue] : defaultValue !== null && defaultValue !== void 0 ? defaultValue : [],
|
|
69
|
+
onChange: function onChange(values) {
|
|
70
|
+
return _onChange === null || _onChange === void 0 ? void 0 : _onChange({
|
|
71
|
+
values: values,
|
|
72
|
+
name: name !== null && name !== void 0 ? name : idBase
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
_useControllableState2 = _slicedToArray(_useControllableState, 2),
|
|
77
|
+
selectedQuickFilters = _useControllableState2[0],
|
|
78
|
+
setSelectedQuickFilters = _useControllableState2[1];
|
|
79
|
+
return /*#__PURE__*/jsx(QuickFilterGroupProvider, {
|
|
80
|
+
value: {
|
|
81
|
+
selectionType: selectionType,
|
|
82
|
+
selectedQuickFilters: selectedQuickFilters
|
|
83
|
+
},
|
|
84
|
+
children: /*#__PURE__*/jsx(QuickFilterWrapper, _objectSpread(_objectSpread({
|
|
85
|
+
onChange: _onChange,
|
|
86
|
+
setSelectedQuickFilters: setSelectedQuickFilters
|
|
87
|
+
}, rest), {}, {
|
|
88
|
+
children: /*#__PURE__*/jsx(BaseBox, {
|
|
89
|
+
display: "flex",
|
|
90
|
+
flexDirection: "row",
|
|
91
|
+
gap: "spacing.3",
|
|
92
|
+
children: children
|
|
93
|
+
})
|
|
94
|
+
}))
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { QuickFilterGroup };
|
|
99
|
+
//# sourceMappingURL=QuickFilterGroup.js.map
|
package/build/lib/web/development/components/QuickFilters/QuickFilterGroup/QuickFilterGroup.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickFilterGroup.js","sources":["../../../../../../../src/components/QuickFilters/QuickFilterGroup/QuickFilterGroup.tsx"],"sourcesContent":["import React from 'react';\nimport type { QuickFilterGroupProps, QuickFilterWrapperProps } from '../types';\nimport { QuickFilterGroupProvider, useQuickFilterGroupContext } from './QuickFilterContext';\nimport { RadioGroup } from '~components/Radio';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CheckboxGroup } from '~components/Checkbox';\nimport { useControllableState } from '~utils/useControllable';\nimport { useId } from '~utils/useId';\n\nconst QuickFilterWrapper = ({\n children,\n onChange,\n setSelectedQuickFilters,\n ...rest\n}: QuickFilterWrapperProps): React.ReactElement => {\n const { selectedQuickFilters, selectionType } = useQuickFilterGroupContext();\n\n if (selectionType === 'single') {\n return (\n <RadioGroup\n value={selectedQuickFilters[0]}\n onChange={({ value }) => {\n setSelectedQuickFilters(() => [value]);\n }}\n size=\"small\"\n {...rest}\n >\n {children}\n </RadioGroup>\n );\n }\n return (\n <CheckboxGroup\n value={selectedQuickFilters}\n onChange={({ values }) => {\n setSelectedQuickFilters(() => values);\n }}\n size=\"small\"\n {...rest}\n >\n {children}\n </CheckboxGroup>\n );\n};\n\nconst QuickFilterGroup = ({\n children,\n testID,\n value,\n defaultValue,\n onChange,\n name,\n selectionType,\n ...rest\n}: QuickFilterGroupProps): React.ReactElement => {\n const idBase = useId('quick-filter-group');\n const [selectedQuickFilters, setSelectedQuickFilters] = useControllableState({\n value: (value && selectionType === 'single' ? [value] : value) as string[] | undefined,\n // If selectionType is single, we need to convert the value to an array\n defaultValue: (defaultValue && selectionType === 'single'\n ? [defaultValue]\n : defaultValue ?? []) as string[] | undefined,\n onChange: (values: string[]) => onChange?.({ values, name: name ?? idBase }),\n });\n return (\n <QuickFilterGroupProvider value={{ selectionType, selectedQuickFilters }}>\n <QuickFilterWrapper\n onChange={onChange}\n setSelectedQuickFilters={setSelectedQuickFilters}\n {...rest}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" gap=\"spacing.3\">\n {children}\n </BaseBox>\n </QuickFilterWrapper>\n </QuickFilterGroupProvider>\n );\n};\n\nexport { QuickFilterGroup };\n"],"names":["QuickFilterWrapper","_ref","children","onChange","setSelectedQuickFilters","rest","_objectWithoutProperties","_excluded","_useQuickFilterGroupC","useQuickFilterGroupContext","selectedQuickFilters","selectionType","_jsx","RadioGroup","_objectSpread","value","_ref2","size","CheckboxGroup","_ref3","values","QuickFilterGroup","_ref4","testID","defaultValue","name","_excluded2","idBase","useId","_useControllableState","useControllableState","_useControllableState2","_slicedToArray","QuickFilterGroupProvider","BaseBox","display","flexDirection","gap"],"mappings":";;;;;;;;;;;;;;;;;;;AASA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAK2B;AAAA,EAAA,IAJjDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,uBAAuB,GAAAH,IAAA,CAAvBG,uBAAuB;AACpBC,I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nB,IAAAA,oBAAoB,GAAAqB,sBAAA,CAAA,CAAA,CAAA;AAAE3B,IAAAA,uBAAuB,GAAA2B,sBAAA,CAAA,CAAA,CAAA,CAAA;EAQpD,oBACEnB,GAAA,CAACqB,wBAAwB,EAAA;AAAClB,IAAAA,KAAK,EAAE;AAAEJ,MAAAA,aAAa,EAAbA,aAAa;AAAED,MAAAA,oBAAoB,EAApBA,oBAAAA;KAAuB;AAAAR,IAAAA,QAAA,eACvEU,GAAA,CAACZ,kBAAkB,EAAAc,aAAA,CAAAA,aAAA,CAAA;AACjBX,MAAAA,QAAQ,EAAEA,SAAS;AACnBC,MAAAA,uBAAuB,EAAEA,uBAAAA;AAAwB,KAAA,EAC7CC,IAAI,CAAA,EAAA,EAAA,EAAA;MAAAH,QAAA,eAERU,GAAA,CAACsB,OAAO,EAAA;AAACC,QAAAA,OAAO,EAAC,MAAM;AAACC,QAAAA,aAAa,EAAC,KAAK;AAACC,QAAAA,GAAG,EAAC,WAAW;AAAAnC,QAAAA,QAAA,EACxDA,QAAAA;OACM,CAAA;KACS,CAAA,CAAA;AAAC,GACG,CAAC,CAAA;AAE/B;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -12,6 +12,7 @@ import usePresence from 'use-presence';
|
|
|
12
12
|
import { TableContext } from './TableContext.js';
|
|
13
13
|
import { ComponentIds } from './componentIds.js';
|
|
14
14
|
import { tableBackgroundColor, firstColumnStickyZIndex, checkboxCellWidth, tablePagination, refreshWrapperZIndex } from './tokens.js';
|
|
15
|
+
import './commonStyles/index.js';
|
|
15
16
|
import '../../utils/index.js';
|
|
16
17
|
import '../../utils/isValidAllowedChildren/index.js';
|
|
17
18
|
import '../../utils/logger/index.js';
|
|
@@ -29,6 +30,7 @@ import '../../utils/makeAnalyticsAttribute/index.js';
|
|
|
29
30
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
30
31
|
import { getComponentId, isValidAllowedChildren } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
|
|
31
32
|
import useTheme from '../BladeProvider/useTheme.js';
|
|
33
|
+
import { getTableBodyStyles } from './commonStyles/tableBodyStyles.js';
|
|
32
34
|
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
33
35
|
import { makeMotionTime } from '../../utils/makeMotionTime/makeMotionTime.web.js';
|
|
34
36
|
import { makeBorderSize } from '../../utils/makeBorderSize/makeBorderSize.js';
|
|
@@ -83,13 +85,26 @@ var StyledReactTable = /*#__PURE__*/styled(Table$1).withConfig({
|
|
|
83
85
|
var $styledProps = _ref.$styledProps;
|
|
84
86
|
var _useTheme = useTheme(),
|
|
85
87
|
theme = _useTheme.theme;
|
|
86
|
-
var styledPropsCSSObject = getBaseBoxStyles({
|
|
88
|
+
var styledPropsCSSObject = getBaseBoxStyles(_objectSpread({
|
|
87
89
|
theme: theme,
|
|
88
90
|
height: $styledProps === null || $styledProps === void 0 ? void 0 : $styledProps.height
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
}, ($styledProps === null || $styledProps === void 0 ? void 0 : $styledProps.isVirtualized) && {
|
|
92
|
+
width: '100%'
|
|
93
|
+
}));
|
|
94
|
+
var $isSelectable = $styledProps === null || $styledProps === void 0 ? void 0 : $styledProps.isSelectable;
|
|
95
|
+
var $showStripedRows = $styledProps === null || $styledProps === void 0 ? void 0 : $styledProps.showStripedRows;
|
|
96
|
+
return _objectSpread({
|
|
97
|
+
'&&&': _objectSpread(_objectSpread({}, styledPropsCSSObject), {}, {
|
|
98
|
+
overflow: "".concat($styledProps !== null && $styledProps !== void 0 && $styledProps.isVirtualized ? 'unset' : 'auto', " !important")
|
|
99
|
+
})
|
|
100
|
+
}, $styledProps !== null && $styledProps !== void 0 && $styledProps.isVirtualized ? getTableBodyStyles({
|
|
101
|
+
isVirtualized: $styledProps === null || $styledProps === void 0 ? void 0 : $styledProps.isVirtualized,
|
|
102
|
+
theme: theme,
|
|
103
|
+
height: $styledProps === null || $styledProps === void 0 ? void 0 : $styledProps.height,
|
|
104
|
+
width: '100%',
|
|
105
|
+
isSelectable: $isSelectable,
|
|
106
|
+
showStripedRows: $showStripedRows
|
|
107
|
+
}) : null);
|
|
93
108
|
});
|
|
94
109
|
var RefreshWrapper = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
95
110
|
displayName: "Tableweb__RefreshWrapper",
|
|
@@ -105,6 +120,7 @@ var RefreshWrapper = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
105
120
|
};
|
|
106
121
|
});
|
|
107
122
|
var _Table = function _Table(_ref3) {
|
|
123
|
+
var _ref4;
|
|
108
124
|
var children = _ref3.children,
|
|
109
125
|
data = _ref3.data,
|
|
110
126
|
_ref3$multiSelectTrig = _ref3.multiSelectTrigger,
|
|
@@ -159,8 +175,10 @@ var _Table = function _Table(_ref3) {
|
|
|
159
175
|
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
160
176
|
hasHoverActions = _React$useState12[0],
|
|
161
177
|
setHasHoverActions = _React$useState12[1];
|
|
178
|
+
var tableRootComponent = children([]);
|
|
179
|
+
var isVirtualized = getComponentId(tableRootComponent) === ComponentIds.VirtualizedTable;
|
|
162
180
|
// Need to make header is sticky if first column is sticky otherwise the first header cell will not be sticky
|
|
163
|
-
var shouldHeaderBeSticky =
|
|
181
|
+
var shouldHeaderBeSticky = (_ref4 = isVirtualized !== null && isVirtualized !== void 0 ? isVirtualized : isHeaderSticky) !== null && _ref4 !== void 0 ? _ref4 : isFirstColumnSticky;
|
|
164
182
|
var backgroundColor = tableBackgroundColor;
|
|
165
183
|
var isMobile = useIsMobile();
|
|
166
184
|
var lastHoverActionsColWidth = isMobile ? '1fr' : '0px';
|
|
@@ -189,7 +207,7 @@ var _Table = function _Table(_ref3) {
|
|
|
189
207
|
}, [data.nodes]);
|
|
190
208
|
|
|
191
209
|
// Selection Logic
|
|
192
|
-
var onSelectChange = function onSelectChange(
|
|
210
|
+
var onSelectChange = function onSelectChange(_, state) {
|
|
193
211
|
var _state$ids;
|
|
194
212
|
var selectedIds = state.id ? [state.id] : (_state$ids = state.ids) !== null && _state$ids !== void 0 ? _state$ids : [];
|
|
195
213
|
setSelectedRows(selectedIds);
|
|
@@ -235,7 +253,7 @@ var _Table = function _Table(_ref3) {
|
|
|
235
253
|
}, [rowSelectConfig.fns, data.nodes, selectedRows, disabledRows]);
|
|
236
254
|
|
|
237
255
|
// Sort Logic
|
|
238
|
-
var handleSortChange = function handleSortChange(
|
|
256
|
+
var handleSortChange = function handleSortChange(_, state) {
|
|
239
257
|
onSortChange === null || onSortChange === void 0 ? void 0 : onSortChange({
|
|
240
258
|
sortKey: state.sortKey,
|
|
241
259
|
isSortReversed: state.reverse
|
|
@@ -319,9 +337,13 @@ var _Table = function _Table(_ref3) {
|
|
|
319
337
|
setHeaderRowDensity: setHeaderRowDensity,
|
|
320
338
|
showBorderedCells: showBorderedCells,
|
|
321
339
|
hasHoverActions: hasHoverActions,
|
|
322
|
-
setHasHoverActions: setHasHoverActions
|
|
340
|
+
setHasHoverActions: setHasHoverActions,
|
|
341
|
+
columnCount: columnCount,
|
|
342
|
+
gridTemplateColumns: gridTemplateColumns,
|
|
343
|
+
isVirtualized: isVirtualized,
|
|
344
|
+
tableData: data.nodes
|
|
323
345
|
};
|
|
324
|
-
}, [selectionType, selectedRows, totalItems, toggleRowSelectionById, toggleAllRowsSelection, deselectAllRows, rowDensity, toggleSort, currentSortedState, setPaginationPage, setPaginationRowSize, currentPaginationState, showStripedRows, disabledRows, setDisabledRows, paginationType, setPaginationType, backgroundColor, headerRowDensity, setHeaderRowDensity, showBorderedCells, hasHoverActions, setHasHoverActions]);
|
|
346
|
+
}, [selectionType, selectedRows, totalItems, toggleRowSelectionById, toggleAllRowsSelection, deselectAllRows, gridTemplateColumns, rowDensity, toggleSort, columnCount, currentSortedState, setPaginationPage, setPaginationRowSize, currentPaginationState, showStripedRows, disabledRows, setDisabledRows, paginationType, setPaginationType, backgroundColor, headerRowDensity, setHeaderRowDensity, showBorderedCells, hasHoverActions, setHasHoverActions, isVirtualized, data]);
|
|
325
347
|
return /*#__PURE__*/jsx(TableContext.Provider, {
|
|
326
348
|
value: tableContext,
|
|
327
349
|
children: isLoading ? /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
@@ -346,6 +368,7 @@ var _Table = function _Table(_ref3) {
|
|
|
346
368
|
}, getStyledProps(rest)), metaAttribute({
|
|
347
369
|
name: MetaConstants.Table
|
|
348
370
|
})), {}, {
|
|
371
|
+
width: isVirtualized ? "100%" : undefined,
|
|
349
372
|
children: [isRefreshSpinnerMounted && /*#__PURE__*/jsx(RefreshWrapper, {
|
|
350
373
|
position: "absolute",
|
|
351
374
|
width: "100%",
|
|
@@ -376,7 +399,11 @@ var _Table = function _Table(_ref3) {
|
|
|
376
399
|
select: selectionType !== 'none' ? rowSelectConfig : null,
|
|
377
400
|
sort: sortFunctions ? sort : null,
|
|
378
401
|
$styledProps: {
|
|
379
|
-
height: height
|
|
402
|
+
height: height,
|
|
403
|
+
width: isVirtualized ? "100%" : undefined,
|
|
404
|
+
isVirtualized: isVirtualized,
|
|
405
|
+
isSelectable: selectionType !== 'none',
|
|
406
|
+
showStripedRows: showStripedRows
|
|
380
407
|
},
|
|
381
408
|
pagination: hasPagination ? paginationConfig : null
|
|
382
409
|
}, makeAccessible({
|