@veeqo/ui 15.7.0 → 15.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Action/styles/button.module.scss.cjs +2 -2
- package/dist/components/Action/styles/button.module.scss.cjs.map +1 -1
- package/dist/components/Action/styles/button.module.scss.js +2 -2
- package/dist/components/Action/styles/button.module.scss.js.map +1 -1
- package/dist/components/Action/styles/link.module.scss.cjs +2 -2
- package/dist/components/Action/styles/link.module.scss.cjs.map +1 -1
- package/dist/components/Action/styles/link.module.scss.js +2 -2
- package/dist/components/Action/styles/link.module.scss.js.map +1 -1
- package/dist/components/Action/styles/{base.module.scss.cjs → reset.module.scss.cjs} +3 -3
- package/dist/components/Action/styles/reset.module.scss.cjs.map +1 -0
- package/dist/components/Action/styles/{base.module.scss.js → reset.module.scss.js} +3 -3
- package/dist/components/Action/styles/reset.module.scss.js.map +1 -0
- package/dist/components/Action/utils.cjs +2 -4
- package/dist/components/Action/utils.cjs.map +1 -1
- package/dist/components/Action/utils.js +2 -4
- package/dist/components/Action/utils.js.map +1 -1
- package/dist/components/Anchor/types.d.ts +3 -0
- package/dist/components/AnimatedDropdown/types.d.ts +3 -0
- package/dist/components/Badge/types.d.ts +3 -0
- package/dist/components/Banner/Banner.cjs.map +1 -1
- package/dist/components/Banner/Banner.d.ts +3 -0
- package/dist/components/Banner/Banner.js.map +1 -1
- package/dist/components/DataTable/DataTable.cjs +3 -0
- package/dist/components/DataTable/DataTable.cjs.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +3 -0
- package/dist/components/DataTable/DataTable.js +3 -0
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/types.cjs.map +1 -1
- package/dist/components/DataTable/types.d.ts +3 -0
- package/dist/components/DataTable/types.js.map +1 -1
- package/dist/components/DescriptionList/DescriptionList.cjs +3 -0
- package/dist/components/DescriptionList/DescriptionList.cjs.map +1 -1
- package/dist/components/DescriptionList/DescriptionList.d.ts +6 -0
- package/dist/components/DescriptionList/DescriptionList.js +3 -0
- package/dist/components/DescriptionList/DescriptionList.js.map +1 -1
- package/dist/components/DetailPage/DetailPage.cjs +3 -0
- package/dist/components/DetailPage/DetailPage.cjs.map +1 -1
- package/dist/components/DetailPage/DetailPage.d.ts +6 -0
- package/dist/components/DetailPage/DetailPage.js +3 -0
- package/dist/components/DetailPage/DetailPage.js.map +1 -1
- package/dist/components/LegacyDataTable/LegacyDataTable.cjs +1 -3
- package/dist/components/LegacyDataTable/LegacyDataTable.cjs.map +1 -1
- package/dist/components/LegacyDataTable/LegacyDataTable.d.ts +1 -3
- package/dist/components/LegacyDataTable/LegacyDataTable.js +1 -3
- package/dist/components/LegacyDataTable/LegacyDataTable.js.map +1 -1
- package/dist/components/LegacyDataTable/utils/types.d.ts +3 -0
- package/dist/components/Popup/Popup.cjs +3 -0
- package/dist/components/Popup/Popup.cjs.map +1 -1
- package/dist/components/Popup/Popup.d.ts +3 -0
- package/dist/components/Popup/Popup.js +3 -0
- package/dist/components/Popup/Popup.js.map +1 -1
- package/dist/components/Popup/types.d.ts +3 -0
- package/dist/components/Stack/types.d.ts +3 -0
- package/dist/components/View/types.cjs.map +1 -1
- package/dist/components/View/types.d.ts +3 -0
- package/dist/components/View/types.js.map +1 -1
- package/dist/utils/forms/form.module.scss.cjs +2 -2
- package/dist/utils/forms/form.module.scss.js +2 -2
- package/package.json +1 -1
- package/dist/components/Action/styles/base.module.scss.cjs.map +0 -1
- package/dist/components/Action/styles/base.module.scss.js.map +0 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var buildClassnames = require('../../utils/buildClassnames.cjs');
|
|
4
4
|
require('uid/secure');
|
|
5
|
-
var base_module = require('./styles/base.module.scss.cjs');
|
|
6
5
|
var button_module = require('./styles/button.module.scss.cjs');
|
|
7
6
|
var link_module = require('./styles/link.module.scss.cjs');
|
|
7
|
+
var reset_module = require('./styles/reset.module.scss.cjs');
|
|
8
8
|
|
|
9
9
|
const getButtonVariantClasses = (variant) => [
|
|
10
10
|
(variant === 'primary' || variant === 'primaryDestructive') && button_module['primary-variant'],
|
|
@@ -23,7 +23,6 @@ const getAppearanceClasses = (appearance, props) => {
|
|
|
23
23
|
case 'button':
|
|
24
24
|
return buildClassnames.buildClassnames([
|
|
25
25
|
props.className,
|
|
26
|
-
base_module.reset,
|
|
27
26
|
button_module.base,
|
|
28
27
|
...iconClasses,
|
|
29
28
|
props.disabled && button_module.disabled,
|
|
@@ -34,13 +33,12 @@ const getAppearanceClasses = (appearance, props) => {
|
|
|
34
33
|
case 'link':
|
|
35
34
|
return buildClassnames.buildClassnames([
|
|
36
35
|
props.className,
|
|
37
|
-
base_module.reset,
|
|
38
36
|
link_module.base,
|
|
39
37
|
!props.size && link_module['inherit-size'],
|
|
40
38
|
props.size && props.size !== 'base' && link_module[`${props.size}-size`],
|
|
41
39
|
]);
|
|
42
40
|
default:
|
|
43
|
-
return buildClassnames.buildClassnames([props.className,
|
|
41
|
+
return buildClassnames.buildClassnames([props.className, reset_module.reset]);
|
|
44
42
|
}
|
|
45
43
|
};
|
|
46
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../../../src/components/Action/utils.ts"],"sourcesContent":["import React from 'react';\nimport { buildClassnames } from '../../utils';\nimport
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../../src/components/Action/utils.ts"],"sourcesContent":["import React from 'react';\nimport { buildClassnames } from '../../utils';\nimport buttonStyles from './styles/button.module.scss';\nimport linkStyles from './styles/link.module.scss';\nimport resetStyles from './styles/reset.module.scss';\nimport { ActionAppearance, ActionSize, ActionVariant } from './types';\n\ntype AppearanceClassProps = {\n className?: string;\n variant?: ActionVariant;\n disabled?: boolean;\n size?: ActionSize;\n dropdown?: boolean;\n iconSlot?: React.ReactNode;\n children?: React.ReactNode;\n};\n\nexport const getButtonVariantClasses = (variant?: ActionVariant) =>\n [\n (variant === 'primary' || variant === 'primaryDestructive') && buttonStyles['primary-variant'],\n (variant === 'destructive' || variant === 'primaryDestructive') &&\n buttonStyles['destructive-variant'],\n variant === 'flat' && buttonStyles['flat-variant'],\n ].filter(Boolean);\n\nexport const getAppearanceClasses = (appearance: ActionAppearance, props: AppearanceClassProps) => {\n const hasIcon = !!props.iconSlot;\n const isIconOnly = hasIcon && (props.children == null || props.children === '');\n const iconClasses = [\n hasIcon && !isIconOnly && buttonStyles.icon,\n isIconOnly && buttonStyles.iconOnly,\n ];\n\n switch (appearance) {\n case 'button':\n return buildClassnames([\n props.className,\n buttonStyles.base,\n ...iconClasses,\n props.disabled && buttonStyles.disabled,\n props.size && props.size !== 'base' && buttonStyles[`${props.size}-size`],\n props.dropdown && buttonStyles.dropdown,\n ...getButtonVariantClasses(props.variant),\n ]);\n case 'link':\n return buildClassnames([\n props.className,\n linkStyles.base,\n !props.size && linkStyles['inherit-size'],\n props.size && props.size !== 'base' && linkStyles[`${props.size}-size`],\n ]);\n default:\n return buildClassnames([props.className, resetStyles.reset]);\n }\n};\n"],"names":["buttonStyles","buildClassnames","linkStyles","resetStyles"],"mappings":";;;;;;;;MAiBa,uBAAuB,GAAG,CAAC,OAAuB,KAC7D;AACE,IAAA,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,oBAAoB,KAAKA,aAAY,CAAC,iBAAiB,CAAC;AAC9F,IAAA,CAAC,OAAO,KAAK,aAAa,IAAI,OAAO,KAAK,oBAAoB;QAC5DA,aAAY,CAAC,qBAAqB,CAAC;AACrC,IAAA,OAAO,KAAK,MAAM,IAAIA,aAAY,CAAC,cAAc,CAAC;AACnD,CAAA,CAAC,MAAM,CAAC,OAAO;MAEL,oBAAoB,GAAG,CAAC,UAA4B,EAAE,KAA2B,KAAI;AAChG,IAAA,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,QAAQ;AAChC,IAAA,MAAM,UAAU,GAAG,OAAO,KAAK,KAAK,CAAC,QAAQ,IAAI,IAAI,IAAI,KA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yles from './styles/base.module.scss.js';
|
|
4
3
|
import buttonStyles from './styles/button.module.scss.js';
|
|
5
4
|
import linkStyles from './styles/link.module.scss.js';
|
|
5
|
+
import resetStyles from './styles/reset.module.scss.js';
|
|
6
6
|
|
|
7
7
|
const getButtonVariantClasses = (variant) => [
|
|
8
8
|
(variant === 'primary' || variant === 'primaryDestructive') && buttonStyles['primary-variant'],
|
|
@@ -21,7 +21,6 @@ const getAppearanceClasses = (appearance, props) => {
|
|
|
21
21
|
case 'button':
|
|
22
22
|
return buildClassnames([
|
|
23
23
|
props.className,
|
|
24
|
-
baseStyles.reset,
|
|
25
24
|
buttonStyles.base,
|
|
26
25
|
...iconClasses,
|
|
27
26
|
props.disabled && buttonStyles.disabled,
|
|
@@ -32,13 +31,12 @@ const getAppearanceClasses = (appearance, props) => {
|
|
|
32
31
|
case 'link':
|
|
33
32
|
return buildClassnames([
|
|
34
33
|
props.className,
|
|
35
|
-
baseStyles.reset,
|
|
36
34
|
linkStyles.base,
|
|
37
35
|
!props.size && linkStyles['inherit-size'],
|
|
38
36
|
props.size && props.size !== 'base' && linkStyles[`${props.size}-size`],
|
|
39
37
|
]);
|
|
40
38
|
default:
|
|
41
|
-
return buildClassnames([props.className,
|
|
39
|
+
return buildClassnames([props.className, resetStyles.reset]);
|
|
42
40
|
}
|
|
43
41
|
};
|
|
44
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/components/Action/utils.ts"],"sourcesContent":["import React from 'react';\nimport { buildClassnames } from '../../utils';\nimport
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/components/Action/utils.ts"],"sourcesContent":["import React from 'react';\nimport { buildClassnames } from '../../utils';\nimport buttonStyles from './styles/button.module.scss';\nimport linkStyles from './styles/link.module.scss';\nimport resetStyles from './styles/reset.module.scss';\nimport { ActionAppearance, ActionSize, ActionVariant } from './types';\n\ntype AppearanceClassProps = {\n className?: string;\n variant?: ActionVariant;\n disabled?: boolean;\n size?: ActionSize;\n dropdown?: boolean;\n iconSlot?: React.ReactNode;\n children?: React.ReactNode;\n};\n\nexport const getButtonVariantClasses = (variant?: ActionVariant) =>\n [\n (variant === 'primary' || variant === 'primaryDestructive') && buttonStyles['primary-variant'],\n (variant === 'destructive' || variant === 'primaryDestructive') &&\n buttonStyles['destructive-variant'],\n variant === 'flat' && buttonStyles['flat-variant'],\n ].filter(Boolean);\n\nexport const getAppearanceClasses = (appearance: ActionAppearance, props: AppearanceClassProps) => {\n const hasIcon = !!props.iconSlot;\n const isIconOnly = hasIcon && (props.children == null || props.children === '');\n const iconClasses = [\n hasIcon && !isIconOnly && buttonStyles.icon,\n isIconOnly && buttonStyles.iconOnly,\n ];\n\n switch (appearance) {\n case 'button':\n return buildClassnames([\n props.className,\n buttonStyles.base,\n ...iconClasses,\n props.disabled && buttonStyles.disabled,\n props.size && props.size !== 'base' && buttonStyles[`${props.size}-size`],\n props.dropdown && buttonStyles.dropdown,\n ...getButtonVariantClasses(props.variant),\n ]);\n case 'link':\n return buildClassnames([\n props.className,\n linkStyles.base,\n !props.size && linkStyles['inherit-size'],\n props.size && props.size !== 'base' && linkStyles[`${props.size}-size`],\n ]);\n default:\n return buildClassnames([props.className, resetStyles.reset]);\n }\n};\n"],"names":[],"mappings":";;;;;;MAiBa,uBAAuB,GAAG,CAAC,OAAuB,KAC7D;AACE,IAAA,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,oBAAoB,KAAK,YAAY,CAAC,iBAAiB,CAAC;AAC9F,IAAA,CAAC,OAAO,KAAK,aAAa,IAAI,OAAO,KAAK,oBAAoB;QAC5D,YAAY,CAAC,qBAAqB,CAAC;AACrC,IAAA,OAAO,KAAK,MAAM,IAAI,YAAY,CAAC,cAAc,CAAC;AACnD,CAAA,CAAC,MAAM,CAAC,OAAO;MAEL,oBAAoB,GAAG,CAAC,UAA4B,EAAE,KAA2B,KAAI;AAChG,IAAA,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,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'lg' | 'md' | 'base' | 'sm';
|
|
|
7
7
|
/**
|
|
8
8
|
* Props for the Anchor component
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Anchor is deprecated and will be removed in a future release. Use the `Action` component instead.
|
|
12
|
+
*/
|
|
10
13
|
export interface AnchorProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
11
14
|
/**
|
|
12
15
|
* The visual style variant of the anchor
|
|
@@ -5,6 +5,9 @@ export type BasicDropdownProps = EventHandlerProps & {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
role?: HTMLAttributes<HTMLDivElement>['role'];
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated AnimatedDropdown is deprecated and will be removed in a future release. Use the `Dropdown` component instead.
|
|
10
|
+
*/
|
|
8
11
|
export type AnimatedDropdownProps = BasicDropdownProps & {
|
|
9
12
|
cta?: ReactNode;
|
|
10
13
|
shouldShowDropdown: boolean;
|
|
@@ -3,6 +3,9 @@ export type BadgeVariant = 'default' | 'primary' | 'warning';
|
|
|
3
3
|
/**
|
|
4
4
|
* Badge properties.
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Badge is deprecated and will be removed in a future release. Use `Tag` or `FilterTag` instead.
|
|
8
|
+
*/
|
|
6
9
|
export type BadgeProps = {
|
|
7
10
|
/**
|
|
8
11
|
* Specifies the Badge variant.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.cjs","sources":["../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import React, { ReactEventHandler, ReactNode, ReactElement } from 'react';\n\nimport { buildClassnames } from '../../utils';\nimport { Text } from '../Text';\nimport { Button } from '../Button';\nimport { CrossIcon } from '../../icons';\nimport { BannerTypes } from './types';\n\nimport styles from './Banner.module.scss';\n\nconst accentColors = {\n help: 'var(--colors-secondary-blue-base)',\n info: 'var(--colors-neutral-ink-base)',\n error: 'var(--colors-secondary-red-base)',\n success: 'var(--colors-secondary-green-base)',\n};\n\ntype BannerProps = React.HTMLAttributes<HTMLDivElement> & {\n type?: BannerTypes;\n backgroundColor?: string;\n text?: string;\n iconSlot?: ReactElement;\n onClose?: ReactEventHandler;\n className?: string;\n header?: ReactNode;\n children?: ReactNode;\n};\n\n/**\n * @deprecated\n * The `Banner` component was previously called `Alert` (and similarly `Pill`).\n * Use Alert, FeatureBanner or SystemBanner instead\n */\nexport const Banner = ({\n type = 'info',\n text,\n iconSlot,\n onClose,\n className,\n header,\n children,\n backgroundColor = 'white',\n ...props\n}: BannerProps) => {\n const accentColor = accentColors[type as BannerTypes];\n\n return (\n <div\n className={buildClassnames([styles.banner, className])}\n style={\n {\n '--banner-accent': accentColor,\n '--banner-bg': backgroundColor,\n } as React.CSSProperties\n }\n {...props}\n >\n <div className={styles.row}>\n {iconSlot && <div className={styles.iconCol}>{iconSlot}</div>}\n {children ? (\n <div className={styles.childContainer}>{children}</div>\n ) : (\n <>\n <div className={styles.headerCol}>\n {header || (\n <Text className={styles.headerText} variant=\"headingSmall\">\n {text}\n </Text>\n )}\n </div>\n <div className={styles.col}>\n {onClose && (\n <Button\n variant=\"flat\"\n aria-label=\"Close\"\n iconSlot={<CrossIcon />}\n onClick={onClose}\n />\n )}\n </div>\n </>\n )}\n </div>\n </div>\n );\n};\n"],"names":["React","buildClassnames","styles","Text","Button","CrossIcon"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,mCAAmC;AACzC,IAAA,IAAI,EAAE,gCAAgC;AACtC,IAAA,KAAK,EAAE,kCAAkC;AACzC,IAAA,OAAO,EAAE,oCAAoC;CAC9C;
|
|
1
|
+
{"version":3,"file":"Banner.cjs","sources":["../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import React, { ReactEventHandler, ReactNode, ReactElement } from 'react';\n\nimport { buildClassnames } from '../../utils';\nimport { Text } from '../Text';\nimport { Button } from '../Button';\nimport { CrossIcon } from '../../icons';\nimport { BannerTypes } from './types';\n\nimport styles from './Banner.module.scss';\n\nconst accentColors = {\n help: 'var(--colors-secondary-blue-base)',\n info: 'var(--colors-neutral-ink-base)',\n error: 'var(--colors-secondary-red-base)',\n success: 'var(--colors-secondary-green-base)',\n};\n\n/**\n * @deprecated Banner is deprecated and will be removed in a future release. Use `Alert`, `FeatureBanner` or `SystemBanner` instead.\n */\ntype BannerProps = React.HTMLAttributes<HTMLDivElement> & {\n type?: BannerTypes;\n backgroundColor?: string;\n text?: string;\n iconSlot?: ReactElement;\n onClose?: ReactEventHandler;\n className?: string;\n header?: ReactNode;\n children?: ReactNode;\n};\n\n/**\n * @deprecated\n * The `Banner` component was previously called `Alert` (and similarly `Pill`).\n * Use Alert, FeatureBanner or SystemBanner instead\n */\nexport const Banner = ({\n type = 'info',\n text,\n iconSlot,\n onClose,\n className,\n header,\n children,\n backgroundColor = 'white',\n ...props\n}: BannerProps) => {\n const accentColor = accentColors[type as BannerTypes];\n\n return (\n <div\n className={buildClassnames([styles.banner, className])}\n style={\n {\n '--banner-accent': accentColor,\n '--banner-bg': backgroundColor,\n } as React.CSSProperties\n }\n {...props}\n >\n <div className={styles.row}>\n {iconSlot && <div className={styles.iconCol}>{iconSlot}</div>}\n {children ? (\n <div className={styles.childContainer}>{children}</div>\n ) : (\n <>\n <div className={styles.headerCol}>\n {header || (\n <Text className={styles.headerText} variant=\"headingSmall\">\n {text}\n </Text>\n )}\n </div>\n <div className={styles.col}>\n {onClose && (\n <Button\n variant=\"flat\"\n aria-label=\"Close\"\n iconSlot={<CrossIcon />}\n onClick={onClose}\n />\n )}\n </div>\n </>\n )}\n </div>\n </div>\n );\n};\n"],"names":["React","buildClassnames","styles","Text","Button","CrossIcon"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,mCAAmC;AACzC,IAAA,IAAI,EAAE,gCAAgC;AACtC,IAAA,KAAK,EAAE,kCAAkC;AACzC,IAAA,OAAO,EAA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,EAAA,EACL,OAAO,EAAC,MAAM,EAAA,YAAA,EACH,OAAO,EAClB,QAAQ,EAAEJ,sBAAA,CAAA,aAAA,CAACK,wBAAS,EAAA,IAAA,CAAG,EACvB,OAAO,EAAE,OAAO,EAAA,CAChB,CACH,CACG,CACL,CACJ,CACG,CACF;AAEV;;;;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React, { ReactEventHandler, ReactNode, ReactElement } from 'react';
|
|
2
2
|
import { BannerTypes } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Banner is deprecated and will be removed in a future release. Use `Alert`, `FeatureBanner` or `SystemBanner` instead.
|
|
5
|
+
*/
|
|
3
6
|
type BannerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
7
|
type?: BannerTypes;
|
|
5
8
|
backgroundColor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","sources":["../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import React, { ReactEventHandler, ReactNode, ReactElement } from 'react';\n\nimport { buildClassnames } from '../../utils';\nimport { Text } from '../Text';\nimport { Button } from '../Button';\nimport { CrossIcon } from '../../icons';\nimport { BannerTypes } from './types';\n\nimport styles from './Banner.module.scss';\n\nconst accentColors = {\n help: 'var(--colors-secondary-blue-base)',\n info: 'var(--colors-neutral-ink-base)',\n error: 'var(--colors-secondary-red-base)',\n success: 'var(--colors-secondary-green-base)',\n};\n\ntype BannerProps = React.HTMLAttributes<HTMLDivElement> & {\n type?: BannerTypes;\n backgroundColor?: string;\n text?: string;\n iconSlot?: ReactElement;\n onClose?: ReactEventHandler;\n className?: string;\n header?: ReactNode;\n children?: ReactNode;\n};\n\n/**\n * @deprecated\n * The `Banner` component was previously called `Alert` (and similarly `Pill`).\n * Use Alert, FeatureBanner or SystemBanner instead\n */\nexport const Banner = ({\n type = 'info',\n text,\n iconSlot,\n onClose,\n className,\n header,\n children,\n backgroundColor = 'white',\n ...props\n}: BannerProps) => {\n const accentColor = accentColors[type as BannerTypes];\n\n return (\n <div\n className={buildClassnames([styles.banner, className])}\n style={\n {\n '--banner-accent': accentColor,\n '--banner-bg': backgroundColor,\n } as React.CSSProperties\n }\n {...props}\n >\n <div className={styles.row}>\n {iconSlot && <div className={styles.iconCol}>{iconSlot}</div>}\n {children ? (\n <div className={styles.childContainer}>{children}</div>\n ) : (\n <>\n <div className={styles.headerCol}>\n {header || (\n <Text className={styles.headerText} variant=\"headingSmall\">\n {text}\n </Text>\n )}\n </div>\n <div className={styles.col}>\n {onClose && (\n <Button\n variant=\"flat\"\n aria-label=\"Close\"\n iconSlot={<CrossIcon />}\n onClick={onClose}\n />\n )}\n </div>\n </>\n )}\n </div>\n </div>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;AAUA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,mCAAmC;AACzC,IAAA,IAAI,EAAE,gCAAgC;AACtC,IAAA,KAAK,EAAE,kCAAkC;AACzC,IAAA,OAAO,EAAE,oCAAoC;CAC9C;
|
|
1
|
+
{"version":3,"file":"Banner.js","sources":["../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import React, { ReactEventHandler, ReactNode, ReactElement } from 'react';\n\nimport { buildClassnames } from '../../utils';\nimport { Text } from '../Text';\nimport { Button } from '../Button';\nimport { CrossIcon } from '../../icons';\nimport { BannerTypes } from './types';\n\nimport styles from './Banner.module.scss';\n\nconst accentColors = {\n help: 'var(--colors-secondary-blue-base)',\n info: 'var(--colors-neutral-ink-base)',\n error: 'var(--colors-secondary-red-base)',\n success: 'var(--colors-secondary-green-base)',\n};\n\n/**\n * @deprecated Banner is deprecated and will be removed in a future release. Use `Alert`, `FeatureBanner` or `SystemBanner` instead.\n */\ntype BannerProps = React.HTMLAttributes<HTMLDivElement> & {\n type?: BannerTypes;\n backgroundColor?: string;\n text?: string;\n iconSlot?: ReactElement;\n onClose?: ReactEventHandler;\n className?: string;\n header?: ReactNode;\n children?: ReactNode;\n};\n\n/**\n * @deprecated\n * The `Banner` component was previously called `Alert` (and similarly `Pill`).\n * Use Alert, FeatureBanner or SystemBanner instead\n */\nexport const Banner = ({\n type = 'info',\n text,\n iconSlot,\n onClose,\n className,\n header,\n children,\n backgroundColor = 'white',\n ...props\n}: BannerProps) => {\n const accentColor = accentColors[type as BannerTypes];\n\n return (\n <div\n className={buildClassnames([styles.banner, className])}\n style={\n {\n '--banner-accent': accentColor,\n '--banner-bg': backgroundColor,\n } as React.CSSProperties\n }\n {...props}\n >\n <div className={styles.row}>\n {iconSlot && <div className={styles.iconCol}>{iconSlot}</div>}\n {children ? (\n <div className={styles.childContainer}>{children}</div>\n ) : (\n <>\n <div className={styles.headerCol}>\n {header || (\n <Text className={styles.headerText} variant=\"headingSmall\">\n {text}\n </Text>\n )}\n </div>\n <div className={styles.col}>\n {onClose && (\n <Button\n variant=\"flat\"\n aria-label=\"Close\"\n iconSlot={<CrossIcon />}\n onClick={onClose}\n />\n )}\n </div>\n </>\n )}\n </div>\n </div>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;AAUA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,mCAAmC;AACzC,IAAA,IAAI,EAAE,gCAAgC;AACtC,IAAA,KAAK,EAAE,kCAAkC;AACzC,IAAA,OAAO,EAAE,oCAAoC;CAC9C;AAgBD;;;;AAIG;AACI,MAAM,MAAM,GAAG,CAAC,EACrB,IAAI,GAAG,MAAM,EACb,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,EACR,eAAe,GAAG,OAAO,EACzB,GAAG,KAAK,EACI,KAAI;AAChB,IAAA,MAAM,WAAW,GAAG,YAAY,CAAC,IAAmB,CAAC;AAErD,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,EACtD,KAAK,EACH;AACE,YAAA,iBAAiB,EAAE,WAAW;AAC9B,YAAA,aAAa,EAAE,eAAe;AACR,SAAA,EAAA,GAEtB,KAAK,EAAA;AAET,QAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,GAAG,EAAA;YACvB,QAAQ,IAAIA,sCAAK,SAAS,EAAE,MAAM,CAAC,OAAO,EAAA,EAAG,QAAQ,CAAO;AAC5D,YAAA,QAAQ,IACPA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,cAAc,IAAG,QAAQ,CAAO,KAEvDA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA;gBACEA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,SAAS,IAC7B,MAAM,KACLA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,EAAC,cAAc,EAAA,EACvD,IAAI,CACA,CACR,CACG;AACN,gBAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,GAAG,EAAA,EACvB,OAAO,KACNA,6BAAC,MAAM,EAAA,EACL,OAAO,EAAC,MAAM,EAAA,YAAA,EACH,OAAO,EAClB,QAAQ,EAAEA,cAAA,CAAA,aAAA,CAAC,SAAS,EAAA,IAAA,CAAG,EACvB,OAAO,EAAE,OAAO,EAAA,CAChB,CACH,CACG,CACL,CACJ,CACG,CACF;AAEV;;;;"}
|
|
@@ -48,6 +48,9 @@ const defaultEmptyState = {
|
|
|
48
48
|
heading: 'No results',
|
|
49
49
|
};
|
|
50
50
|
const emptyAction = () => { };
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated DataTable is deprecated and will be removed in a future release. Use `DataGrid` instead.
|
|
53
|
+
*/
|
|
51
54
|
const DataTable = ({ actionBarSlot, borderMode, columns: initialColumns, emptyState = defaultEmptyState, expandedRowIds, loading, loadingRowCount, onChangeSort, rows, disabledRowIds, selectionMode, selectionState, setExpanded, sortState, stripingMode, enableStickyHeader, resizeableColumns, onResizeColumns, columnWidths, stickyHeaderTop, }) => {
|
|
52
55
|
// Refs
|
|
53
56
|
const scrollContainerRef = React.useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.cjs","sources":["../../../src/components/DataTable/DataTable.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-redundant-roles */\n\nimport React, { useRef } from 'react';\nimport { Stack } from '../Stack';\nimport { Text } from '../Text';\n\nimport { useDragToScroll, useScrollPosition } from '../../hooks';\n\nimport { generateTableCss } from './utils';\nimport { DataTableProps, CustomState, TableRow } from './types';\n\nimport { useCellWidths, useColumns, useSelection } from './hooks';\n\nimport {\n renderCell,\n renderFooter,\n renderHeader,\n renderLoadingCell,\n renderNestedCell,\n} from './renderers';\n\nimport { ActionBar } from './components/ActionBar';\nimport { Cell } from './components/Cell';\nimport { ColumnMenu } from './components/ColumnMenu';\nimport { EmptyBodyContent, EmptyBodyGlyphWrapper } from './components/EmptyBodyContent';\nimport { Header } from './components/Header';\nimport { NoWrap } from './components/NoWrap';\nimport { Row } from './components/Row';\nimport { ScrollContainer } from './components/ScrollContainer';\nimport { TableGrid } from './components/TableGrid';\nimport { Truncate } from './components/Truncate';\nimport { Wrapper } from './components/Wrapper';\nimport { SelectionCell } from './components/SelectionCell';\nimport { SelectionHeader } from './components/SelectionHeader';\nimport { StickyHead } from './components/StickyHead';\n\nimport { getRowState } from './utils/getRowState';\nimport { InfoIcon } from '../../icons';\n\nconst defaultEmptyState: CustomState = {\n iconSlot: <InfoIcon width={48} height={48} />,\n heading: 'No results',\n};\n\nconst emptyAction = () => {};\n\nexport const DataTable = ({\n actionBarSlot,\n borderMode,\n columns: initialColumns,\n emptyState = defaultEmptyState,\n expandedRowIds,\n loading,\n loadingRowCount,\n onChangeSort,\n rows,\n disabledRowIds,\n selectionMode,\n selectionState,\n setExpanded,\n sortState,\n stripingMode,\n enableStickyHeader,\n resizeableColumns,\n onResizeColumns,\n columnWidths,\n stickyHeaderTop,\n}: DataTableProps) => {\n // Refs\n\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const tableRef = useRef<HTMLTableElement>(null);\n const intersectionTargetRef = useRef<HTMLDivElement>(null);\n\n useDragToScroll({ targetRef: scrollContainerRef, ignoreClassName: 'th-divider' });\n\n // Configure row selection\n\n const enabledRowIds = rows.map((row) => row.id).filter((id) => !disabledRowIds?.includes(id));\n\n const { selectionEnabled, selectedRowIds, selectionColumn, setSelected } = useSelection({\n selectionMode,\n selectionState,\n enabledRowIds,\n });\n\n // Assign actions\n\n const actions = {\n setSelected: setSelected || emptyAction,\n setExpanded: setExpanded || emptyAction,\n };\n\n // Process columns\n\n const columnsWithSelection = [selectionColumn, ...initialColumns];\n const allColumns = selectionEnabled ? columnsWithSelection : initialColumns;\n\n const cellWidths = useCellWidths(tableRef, scrollContainerRef);\n const {\n visible,\n pinnedLeft,\n pinnedRight,\n setColumnWidth,\n columnWidths: calcColumnWidths,\n } = useColumns(allColumns, tableRef, onResizeColumns, columnWidths);\n const adjustedCellWidths =\n cellWidths.length === visible.length\n ? (visible.map((col, i) =>\n Number.isNaN(calcColumnWidths[col.id] || '') ? cellWidths[i] : calcColumnWidths[col.id],\n ) as number[])\n : cellWidths;\n\n // Generate styles\n const { scrollPosition, onScroll, enableTransition } = useScrollPosition({\n containerRef: scrollContainerRef,\n });\n const tableCss = generateTableCss({\n pinnedLeft,\n pinnedRight,\n cellWidths: adjustedCellWidths,\n scrollPosition,\n columnWidths: calcColumnWidths,\n columns: visible,\n stripingMode,\n enableTransition,\n });\n\n // Render states\n\n if (loading) {\n const loadingRows: Array<TableRow> = new Array(loadingRowCount).fill(true).map(() => ({\n // generate random ID forcing all rows to re-render avoid animation de-sync\n id: Math.random() * 1000,\n data: null,\n }));\n\n return (\n <Wrapper borderMode={borderMode}>\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n </thead>\n <tbody role=\"rowgroup\">\n {loadingRows.map((row) => (\n <Row key={row.id}>{visible.map((col) => renderLoadingCell(row, col))}</Row>\n ))}\n </tbody>\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n }\n\n if (rows.length === 0) {\n return (\n <Wrapper borderMode={borderMode}>\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n </thead>\n <tbody role=\"rowgroup\">\n <EmptyBodyContent columnCount={visible.length}>\n <EmptyBodyGlyphWrapper>\n {/* Should be 48x48px */}\n {emptyState.iconSlot}\n </EmptyBodyGlyphWrapper>\n <Stack spacing=\"sm\" alignX=\"center\">\n <Text variant=\"headingMedium\">{emptyState.heading}</Text>\n {emptyState.subheading && (\n <Text variant=\"subheadingMedium\">{emptyState.subheading}</Text>\n )}\n </Stack>\n </EmptyBodyContent>\n </tbody>\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n }\n\n const renderRow = (row: TableRow) => {\n const { e2eClassName = '', accentColor } = row;\n const rowState = getRowState(row.id, { selectedRowIds, expandedRowIds, disabledRowIds });\n\n return (\n <Row role=\"row\" key={row.id} accentColor={accentColor} className={e2eClassName} {...rowState}>\n {visible.map((col) => renderCell(row, col, actions, rowState))}\n </Row>\n );\n };\n\n const renderNestedRow = (nestedRow: TableRow, rowId: TableRow['id']) => {\n const nestedRowE2eClassName = nestedRow?.data?.e2eClassNames?.row;\n const rowState = getRowState(rowId, { selectedRowIds, expandedRowIds, disabledRowIds });\n return (\n <Row role=\"row\" key={nestedRow.id} className={nestedRowE2eClassName}>\n {visible.map((col) => renderNestedCell(nestedRow, col, rowState))}\n </Row>\n );\n };\n\n const renderSection = (row: TableRow) => {\n const isExpanded = expandedRowIds?.includes(row.id);\n return (\n <tbody role=\"rowgroup\" key={row.id}>\n {renderRow(row)}\n {isExpanded && row.nestedRows?.map((nestedRow) => renderNestedRow(nestedRow, row.id))}\n </tbody>\n );\n };\n\n const renderBody = () => {\n const hasNestedRows = !!expandedRowIds;\n const hasMultipleSections = hasNestedRows && stripingMode === 'nested';\n\n if (hasMultipleSections) {\n return rows.map(renderSection);\n }\n\n if (hasNestedRows) {\n return (\n <tbody role=\"rowgroup\">\n {rows.map((row) => {\n const rowElement = renderRow(row);\n const isExpanded = expandedRowIds?.includes(row.id);\n const nestedRowElements =\n (isExpanded &&\n row.nestedRows?.map((nestedRow) => renderNestedRow(nestedRow, row.id))) ||\n [];\n return [rowElement, ...nestedRowElements];\n })}\n </tbody>\n );\n }\n\n return <tbody role=\"rowgroup\">{rows.map(renderRow)}</tbody>;\n };\n\n const headersMarkup = (\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n );\n\n const shouldRenderFooter = initialColumns.some((column) => !!column.renderFooter);\n const shouldRenderActionBar = selectedRowIds.length > 0 && !!actionBarSlot;\n\n return (\n <Wrapper borderMode={borderMode}>\n {shouldRenderActionBar && (\n <ActionBar\n selectionColumn={selectionColumn}\n intersectionTargetRef={intersectionTargetRef}\n containerRef={scrollContainerRef}\n >\n {actionBarSlot}\n </ActionBar>\n )}\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n {enableStickyHeader && (\n <StickyHead\n tableCss={tableCss}\n intersectionTargetRef={intersectionTargetRef}\n containerRef={scrollContainerRef}\n cellWidths={adjustedCellWidths}\n stickyHeaderTop={stickyHeaderTop}\n >\n {headersMarkup}\n </StickyHead>\n )}\n <div ref={intersectionTargetRef} style={{ height: 0 }} />\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">{headersMarkup}</thead>\n {renderBody()}\n {shouldRenderFooter && (\n <tfoot role=\"rowgroup\">\n <Row role=\"row\">{visible.map((column) => renderFooter({ column }))}</Row>\n </tfoot>\n )}\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n};\n\nDataTable.defaultProps = {\n loading: false,\n loadingRowCount: 5,\n selectionMode: 'multiple',\n stripingMode: 'row',\n enableStickyHeader: true,\n};\n\nDataTable.Cell = Cell;\nDataTable.ColumnMenu = ColumnMenu;\nDataTable.SelectionCell = SelectionCell;\nDataTable.SelectionHeader = SelectionHeader;\nDataTable.Header = Header;\nDataTable.Truncate = Truncate;\nDataTable.NoWrap = NoWrap;\n"],"names":["React","InfoIcon","useRef","useDragToScroll","useSelection","useCellWidths","useColumns","useScrollPosition","generateTableCss","Wrapper","ScrollContainer","TableGrid","Row","renderHeader","renderLoadingCell","EmptyBodyContent","EmptyBodyGlyphWrapper","Stack","Text","getRowState","renderCell","renderNestedCell","ActionBar","StickyHead","renderFooter","Cell","ColumnMenu","SelectionCell","SelectionHeader","Header","Truncate","NoWrap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAuCA,MAAM,iBAAiB,GAAgB;IACrC,QAAQ,EAAEA,sBAAA,CAAA,aAAA,CAACC,uBAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAA,CAAI;AAC7C,IAAA,OAAO,EAAE,YAAY;CACtB;AAED,MAAM,WAAW,GAAG,MAAK,EAAE,CAAC;MAEf,SAAS,GAAG,CAAC,EACxB,aAAa,EACb,UAAU,EACV,O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;;"}
|
|
1
|
+
{"version":3,"file":"DataTable.cjs","sources":["../../../src/components/DataTable/DataTable.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-redundant-roles */\n\nimport React, { useRef } from 'react';\nimport { Stack } from '../Stack';\nimport { Text } from '../Text';\n\nimport { useDragToScroll, useScrollPosition } from '../../hooks';\n\nimport { generateTableCss } from './utils';\nimport { DataTableProps, CustomState, TableRow } from './types';\n\nimport { useCellWidths, useColumns, useSelection } from './hooks';\n\nimport {\n renderCell,\n renderFooter,\n renderHeader,\n renderLoadingCell,\n renderNestedCell,\n} from './renderers';\n\nimport { ActionBar } from './components/ActionBar';\nimport { Cell } from './components/Cell';\nimport { ColumnMenu } from './components/ColumnMenu';\nimport { EmptyBodyContent, EmptyBodyGlyphWrapper } from './components/EmptyBodyContent';\nimport { Header } from './components/Header';\nimport { NoWrap } from './components/NoWrap';\nimport { Row } from './components/Row';\nimport { ScrollContainer } from './components/ScrollContainer';\nimport { TableGrid } from './components/TableGrid';\nimport { Truncate } from './components/Truncate';\nimport { Wrapper } from './components/Wrapper';\nimport { SelectionCell } from './components/SelectionCell';\nimport { SelectionHeader } from './components/SelectionHeader';\nimport { StickyHead } from './components/StickyHead';\n\nimport { getRowState } from './utils/getRowState';\nimport { InfoIcon } from '../../icons';\n\nconst defaultEmptyState: CustomState = {\n iconSlot: <InfoIcon width={48} height={48} />,\n heading: 'No results',\n};\n\nconst emptyAction = () => {};\n\n/**\n * @deprecated DataTable is deprecated and will be removed in a future release. Use `DataGrid` instead.\n */\nexport const DataTable = ({\n actionBarSlot,\n borderMode,\n columns: initialColumns,\n emptyState = defaultEmptyState,\n expandedRowIds,\n loading,\n loadingRowCount,\n onChangeSort,\n rows,\n disabledRowIds,\n selectionMode,\n selectionState,\n setExpanded,\n sortState,\n stripingMode,\n enableStickyHeader,\n resizeableColumns,\n onResizeColumns,\n columnWidths,\n stickyHeaderTop,\n}: DataTableProps) => {\n // Refs\n\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const tableRef = useRef<HTMLTableElement>(null);\n const intersectionTargetRef = useRef<HTMLDivElement>(null);\n\n useDragToScroll({ targetRef: scrollContainerRef, ignoreClassName: 'th-divider' });\n\n // Configure row selection\n\n const enabledRowIds = rows.map((row) => row.id).filter((id) => !disabledRowIds?.includes(id));\n\n const { selectionEnabled, selectedRowIds, selectionColumn, setSelected } = useSelection({\n selectionMode,\n selectionState,\n enabledRowIds,\n });\n\n // Assign actions\n\n const actions = {\n setSelected: setSelected || emptyAction,\n setExpanded: setExpanded || emptyAction,\n };\n\n // Process columns\n\n const columnsWithSelection = [selectionColumn, ...initialColumns];\n const allColumns = selectionEnabled ? columnsWithSelection : initialColumns;\n\n const cellWidths = useCellWidths(tableRef, scrollContainerRef);\n const {\n visible,\n pinnedLeft,\n pinnedRight,\n setColumnWidth,\n columnWidths: calcColumnWidths,\n } = useColumns(allColumns, tableRef, onResizeColumns, columnWidths);\n const adjustedCellWidths =\n cellWidths.length === visible.length\n ? (visible.map((col, i) =>\n Number.isNaN(calcColumnWidths[col.id] || '') ? cellWidths[i] : calcColumnWidths[col.id],\n ) as number[])\n : cellWidths;\n\n // Generate styles\n const { scrollPosition, onScroll, enableTransition } = useScrollPosition({\n containerRef: scrollContainerRef,\n });\n const tableCss = generateTableCss({\n pinnedLeft,\n pinnedRight,\n cellWidths: adjustedCellWidths,\n scrollPosition,\n columnWidths: calcColumnWidths,\n columns: visible,\n stripingMode,\n enableTransition,\n });\n\n // Render states\n\n if (loading) {\n const loadingRows: Array<TableRow> = new Array(loadingRowCount).fill(true).map(() => ({\n // generate random ID forcing all rows to re-render avoid animation de-sync\n id: Math.random() * 1000,\n data: null,\n }));\n\n return (\n <Wrapper borderMode={borderMode}>\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n </thead>\n <tbody role=\"rowgroup\">\n {loadingRows.map((row) => (\n <Row key={row.id}>{visible.map((col) => renderLoadingCell(row, col))}</Row>\n ))}\n </tbody>\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n }\n\n if (rows.length === 0) {\n return (\n <Wrapper borderMode={borderMode}>\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n </thead>\n <tbody role=\"rowgroup\">\n <EmptyBodyContent columnCount={visible.length}>\n <EmptyBodyGlyphWrapper>\n {/* Should be 48x48px */}\n {emptyState.iconSlot}\n </EmptyBodyGlyphWrapper>\n <Stack spacing=\"sm\" alignX=\"center\">\n <Text variant=\"headingMedium\">{emptyState.heading}</Text>\n {emptyState.subheading && (\n <Text variant=\"subheadingMedium\">{emptyState.subheading}</Text>\n )}\n </Stack>\n </EmptyBodyContent>\n </tbody>\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n }\n\n const renderRow = (row: TableRow) => {\n const { e2eClassName = '', accentColor } = row;\n const rowState = getRowState(row.id, { selectedRowIds, expandedRowIds, disabledRowIds });\n\n return (\n <Row role=\"row\" key={row.id} accentColor={accentColor} className={e2eClassName} {...rowState}>\n {visible.map((col) => renderCell(row, col, actions, rowState))}\n </Row>\n );\n };\n\n const renderNestedRow = (nestedRow: TableRow, rowId: TableRow['id']) => {\n const nestedRowE2eClassName = nestedRow?.data?.e2eClassNames?.row;\n const rowState = getRowState(rowId, { selectedRowIds, expandedRowIds, disabledRowIds });\n return (\n <Row role=\"row\" key={nestedRow.id} className={nestedRowE2eClassName}>\n {visible.map((col) => renderNestedCell(nestedRow, col, rowState))}\n </Row>\n );\n };\n\n const renderSection = (row: TableRow) => {\n const isExpanded = expandedRowIds?.includes(row.id);\n return (\n <tbody role=\"rowgroup\" key={row.id}>\n {renderRow(row)}\n {isExpanded && row.nestedRows?.map((nestedRow) => renderNestedRow(nestedRow, row.id))}\n </tbody>\n );\n };\n\n const renderBody = () => {\n const hasNestedRows = !!expandedRowIds;\n const hasMultipleSections = hasNestedRows && stripingMode === 'nested';\n\n if (hasMultipleSections) {\n return rows.map(renderSection);\n }\n\n if (hasNestedRows) {\n return (\n <tbody role=\"rowgroup\">\n {rows.map((row) => {\n const rowElement = renderRow(row);\n const isExpanded = expandedRowIds?.includes(row.id);\n const nestedRowElements =\n (isExpanded &&\n row.nestedRows?.map((nestedRow) => renderNestedRow(nestedRow, row.id))) ||\n [];\n return [rowElement, ...nestedRowElements];\n })}\n </tbody>\n );\n }\n\n return <tbody role=\"rowgroup\">{rows.map(renderRow)}</tbody>;\n };\n\n const headersMarkup = (\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n );\n\n const shouldRenderFooter = initialColumns.some((column) => !!column.renderFooter);\n const shouldRenderActionBar = selectedRowIds.length > 0 && !!actionBarSlot;\n\n return (\n <Wrapper borderMode={borderMode}>\n {shouldRenderActionBar && (\n <ActionBar\n selectionColumn={selectionColumn}\n intersectionTargetRef={intersectionTargetRef}\n containerRef={scrollContainerRef}\n >\n {actionBarSlot}\n </ActionBar>\n )}\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n {enableStickyHeader && (\n <StickyHead\n tableCss={tableCss}\n intersectionTargetRef={intersectionTargetRef}\n containerRef={scrollContainerRef}\n cellWidths={adjustedCellWidths}\n stickyHeaderTop={stickyHeaderTop}\n >\n {headersMarkup}\n </StickyHead>\n )}\n <div ref={intersectionTargetRef} style={{ height: 0 }} />\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">{headersMarkup}</thead>\n {renderBody()}\n {shouldRenderFooter && (\n <tfoot role=\"rowgroup\">\n <Row role=\"row\">{visible.map((column) => renderFooter({ column }))}</Row>\n </tfoot>\n )}\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n};\n\nDataTable.defaultProps = {\n loading: false,\n loadingRowCount: 5,\n selectionMode: 'multiple',\n stripingMode: 'row',\n enableStickyHeader: true,\n};\n\nDataTable.Cell = Cell;\nDataTable.ColumnMenu = ColumnMenu;\nDataTable.SelectionCell = SelectionCell;\nDataTable.SelectionHeader = SelectionHeader;\nDataTable.Header = Header;\nDataTable.Truncate = Truncate;\nDataTable.NoWrap = NoWrap;\n"],"names":["React","InfoIcon","useRef","useDragToScroll","useSelection","useCellWidths","useColumns","useScrollPosition","generateTableCss","Wrapper","ScrollContainer","TableGrid","Row","renderHeader","renderLoadingCell","EmptyBodyContent","EmptyBodyGlyphWrapper","Stack","Text","getRowState","renderCell","renderNestedCell","ActionBar","StickyHead","renderFooter","Cell","ColumnMenu","SelectionCell","SelectionHeader","Header","Truncate","NoWrap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAuCA,MAAM,iBAAiB,GAAgB;IACrC,QAAQ,EAAEA,sBAAA,CAAA,aAAA,CAACC,uBAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAA,CAAI;AAC7C,IAAA,OAAO,EAAE,YAAY;CACtB;AAED,MAAM,WAAW,GAAG,MAAK,EAAE,CAAC;AAE5B;;AAEG;MACU,SAAS,GAAG,CAAC,EACxB,aAAa,EACb,UAAU,EACV,OAAO,EAAE,cAAc,EACvB,UAAU,GAAG,iBAAiB,EAC9B,cAAc,EACd,OAAO,EACP,eAAe,EACf,YAAY,EACZ,IAAI,EACJ,cAAc,EACd,aAAa,EACb,cAAc,EACd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BAAqB,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAA,CAAI;AACzD,YAAAA,sBAAA,CAAA,aAAA,CAACW,mBAAS,EAAA,EAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAC,OAAO,EAAA;AACxD,gBAAAX,sBAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,IAAI,EAAC,UAAU,EAAA,EAAE,aAAa,CAAS;AAC7C,gBAAA,UAAU,EAAE;AACZ,gBAAA,kBAAkB,KACjBA,sBAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,IAAI,EAAC,UAAU,EAAA;AACpB,oBAAAA,sBAAA,CAAA,aAAA,CAACY,OAAG,EAAA,EAAC,IAAI,EAAC,KAAK,EAAA,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAKY,yBAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAO,CACnE,CACT,CACS,CACI,CACV;AAEd;AAEA,SAAS,CAAC,YAAY,GAAG;AACvB,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,eAAe,EAAE,CAAC;AAClB,IAAA,aAAa,EAAE,UAAU;AACzB,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,kBAAkB,EAAE,IAAI;CACzB;AAED,SAAS,CAAC,IAAI,GAAGC,SAAI;AACrB,SAAS,CAAC,UAAU,GAAGC,qBAAU;AACjC,SAAS,CAAC,aAAa,GAAGC,2BAAa;AACvC,SAAS,CAAC,eAAe,GAAGC,+BAAe;AAC3C,SAAS,CAAC,MAAM,GAAGC,aAAM;AACzB,SAAS,CAAC,QAAQ,GAAGC,iBAAQ;AAC7B,SAAS,CAAC,MAAM,GAAGC,aAAM;;;;"}
|
|
@@ -3,6 +3,9 @@ import { DataTableProps } from './types';
|
|
|
3
3
|
import { ColumnMenu } from './components/ColumnMenu';
|
|
4
4
|
import { SelectionCell } from './components/SelectionCell';
|
|
5
5
|
import { SelectionHeader } from './components/SelectionHeader';
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated DataTable is deprecated and will be removed in a future release. Use `DataGrid` instead.
|
|
8
|
+
*/
|
|
6
9
|
export declare const DataTable: {
|
|
7
10
|
({ actionBarSlot, borderMode, columns: initialColumns, emptyState, expandedRowIds, loading, loadingRowCount, onChangeSort, rows, disabledRowIds, selectionMode, selectionState, setExpanded, sortState, stripingMode, enableStickyHeader, resizeableColumns, onResizeColumns, columnWidths, stickyHeaderTop, }: DataTableProps): React.JSX.Element;
|
|
8
11
|
defaultProps: {
|
|
@@ -42,6 +42,9 @@ const defaultEmptyState = {
|
|
|
42
42
|
heading: 'No results',
|
|
43
43
|
};
|
|
44
44
|
const emptyAction = () => { };
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated DataTable is deprecated and will be removed in a future release. Use `DataGrid` instead.
|
|
47
|
+
*/
|
|
45
48
|
const DataTable = ({ actionBarSlot, borderMode, columns: initialColumns, emptyState = defaultEmptyState, expandedRowIds, loading, loadingRowCount, onChangeSort, rows, disabledRowIds, selectionMode, selectionState, setExpanded, sortState, stripingMode, enableStickyHeader, resizeableColumns, onResizeColumns, columnWidths, stickyHeaderTop, }) => {
|
|
46
49
|
// Refs
|
|
47
50
|
const scrollContainerRef = useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","sources":["../../../src/components/DataTable/DataTable.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-redundant-roles */\n\nimport React, { useRef } from 'react';\nimport { Stack } from '../Stack';\nimport { Text } from '../Text';\n\nimport { useDragToScroll, useScrollPosition } from '../../hooks';\n\nimport { generateTableCss } from './utils';\nimport { DataTableProps, CustomState, TableRow } from './types';\n\nimport { useCellWidths, useColumns, useSelection } from './hooks';\n\nimport {\n renderCell,\n renderFooter,\n renderHeader,\n renderLoadingCell,\n renderNestedCell,\n} from './renderers';\n\nimport { ActionBar } from './components/ActionBar';\nimport { Cell } from './components/Cell';\nimport { ColumnMenu } from './components/ColumnMenu';\nimport { EmptyBodyContent, EmptyBodyGlyphWrapper } from './components/EmptyBodyContent';\nimport { Header } from './components/Header';\nimport { NoWrap } from './components/NoWrap';\nimport { Row } from './components/Row';\nimport { ScrollContainer } from './components/ScrollContainer';\nimport { TableGrid } from './components/TableGrid';\nimport { Truncate } from './components/Truncate';\nimport { Wrapper } from './components/Wrapper';\nimport { SelectionCell } from './components/SelectionCell';\nimport { SelectionHeader } from './components/SelectionHeader';\nimport { StickyHead } from './components/StickyHead';\n\nimport { getRowState } from './utils/getRowState';\nimport { InfoIcon } from '../../icons';\n\nconst defaultEmptyState: CustomState = {\n iconSlot: <InfoIcon width={48} height={48} />,\n heading: 'No results',\n};\n\nconst emptyAction = () => {};\n\nexport const DataTable = ({\n actionBarSlot,\n borderMode,\n columns: initialColumns,\n emptyState = defaultEmptyState,\n expandedRowIds,\n loading,\n loadingRowCount,\n onChangeSort,\n rows,\n disabledRowIds,\n selectionMode,\n selectionState,\n setExpanded,\n sortState,\n stripingMode,\n enableStickyHeader,\n resizeableColumns,\n onResizeColumns,\n columnWidths,\n stickyHeaderTop,\n}: DataTableProps) => {\n // Refs\n\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const tableRef = useRef<HTMLTableElement>(null);\n const intersectionTargetRef = useRef<HTMLDivElement>(null);\n\n useDragToScroll({ targetRef: scrollContainerRef, ignoreClassName: 'th-divider' });\n\n // Configure row selection\n\n const enabledRowIds = rows.map((row) => row.id).filter((id) => !disabledRowIds?.includes(id));\n\n const { selectionEnabled, selectedRowIds, selectionColumn, setSelected } = useSelection({\n selectionMode,\n selectionState,\n enabledRowIds,\n });\n\n // Assign actions\n\n const actions = {\n setSelected: setSelected || emptyAction,\n setExpanded: setExpanded || emptyAction,\n };\n\n // Process columns\n\n const columnsWithSelection = [selectionColumn, ...initialColumns];\n const allColumns = selectionEnabled ? columnsWithSelection : initialColumns;\n\n const cellWidths = useCellWidths(tableRef, scrollContainerRef);\n const {\n visible,\n pinnedLeft,\n pinnedRight,\n setColumnWidth,\n columnWidths: calcColumnWidths,\n } = useColumns(allColumns, tableRef, onResizeColumns, columnWidths);\n const adjustedCellWidths =\n cellWidths.length === visible.length\n ? (visible.map((col, i) =>\n Number.isNaN(calcColumnWidths[col.id] || '') ? cellWidths[i] : calcColumnWidths[col.id],\n ) as number[])\n : cellWidths;\n\n // Generate styles\n const { scrollPosition, onScroll, enableTransition } = useScrollPosition({\n containerRef: scrollContainerRef,\n });\n const tableCss = generateTableCss({\n pinnedLeft,\n pinnedRight,\n cellWidths: adjustedCellWidths,\n scrollPosition,\n columnWidths: calcColumnWidths,\n columns: visible,\n stripingMode,\n enableTransition,\n });\n\n // Render states\n\n if (loading) {\n const loadingRows: Array<TableRow> = new Array(loadingRowCount).fill(true).map(() => ({\n // generate random ID forcing all rows to re-render avoid animation de-sync\n id: Math.random() * 1000,\n data: null,\n }));\n\n return (\n <Wrapper borderMode={borderMode}>\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n </thead>\n <tbody role=\"rowgroup\">\n {loadingRows.map((row) => (\n <Row key={row.id}>{visible.map((col) => renderLoadingCell(row, col))}</Row>\n ))}\n </tbody>\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n }\n\n if (rows.length === 0) {\n return (\n <Wrapper borderMode={borderMode}>\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n </thead>\n <tbody role=\"rowgroup\">\n <EmptyBodyContent columnCount={visible.length}>\n <EmptyBodyGlyphWrapper>\n {/* Should be 48x48px */}\n {emptyState.iconSlot}\n </EmptyBodyGlyphWrapper>\n <Stack spacing=\"sm\" alignX=\"center\">\n <Text variant=\"headingMedium\">{emptyState.heading}</Text>\n {emptyState.subheading && (\n <Text variant=\"subheadingMedium\">{emptyState.subheading}</Text>\n )}\n </Stack>\n </EmptyBodyContent>\n </tbody>\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n }\n\n const renderRow = (row: TableRow) => {\n const { e2eClassName = '', accentColor } = row;\n const rowState = getRowState(row.id, { selectedRowIds, expandedRowIds, disabledRowIds });\n\n return (\n <Row role=\"row\" key={row.id} accentColor={accentColor} className={e2eClassName} {...rowState}>\n {visible.map((col) => renderCell(row, col, actions, rowState))}\n </Row>\n );\n };\n\n const renderNestedRow = (nestedRow: TableRow, rowId: TableRow['id']) => {\n const nestedRowE2eClassName = nestedRow?.data?.e2eClassNames?.row;\n const rowState = getRowState(rowId, { selectedRowIds, expandedRowIds, disabledRowIds });\n return (\n <Row role=\"row\" key={nestedRow.id} className={nestedRowE2eClassName}>\n {visible.map((col) => renderNestedCell(nestedRow, col, rowState))}\n </Row>\n );\n };\n\n const renderSection = (row: TableRow) => {\n const isExpanded = expandedRowIds?.includes(row.id);\n return (\n <tbody role=\"rowgroup\" key={row.id}>\n {renderRow(row)}\n {isExpanded && row.nestedRows?.map((nestedRow) => renderNestedRow(nestedRow, row.id))}\n </tbody>\n );\n };\n\n const renderBody = () => {\n const hasNestedRows = !!expandedRowIds;\n const hasMultipleSections = hasNestedRows && stripingMode === 'nested';\n\n if (hasMultipleSections) {\n return rows.map(renderSection);\n }\n\n if (hasNestedRows) {\n return (\n <tbody role=\"rowgroup\">\n {rows.map((row) => {\n const rowElement = renderRow(row);\n const isExpanded = expandedRowIds?.includes(row.id);\n const nestedRowElements =\n (isExpanded &&\n row.nestedRows?.map((nestedRow) => renderNestedRow(nestedRow, row.id))) ||\n [];\n return [rowElement, ...nestedRowElements];\n })}\n </tbody>\n );\n }\n\n return <tbody role=\"rowgroup\">{rows.map(renderRow)}</tbody>;\n };\n\n const headersMarkup = (\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n );\n\n const shouldRenderFooter = initialColumns.some((column) => !!column.renderFooter);\n const shouldRenderActionBar = selectedRowIds.length > 0 && !!actionBarSlot;\n\n return (\n <Wrapper borderMode={borderMode}>\n {shouldRenderActionBar && (\n <ActionBar\n selectionColumn={selectionColumn}\n intersectionTargetRef={intersectionTargetRef}\n containerRef={scrollContainerRef}\n >\n {actionBarSlot}\n </ActionBar>\n )}\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n {enableStickyHeader && (\n <StickyHead\n tableCss={tableCss}\n intersectionTargetRef={intersectionTargetRef}\n containerRef={scrollContainerRef}\n cellWidths={adjustedCellWidths}\n stickyHeaderTop={stickyHeaderTop}\n >\n {headersMarkup}\n </StickyHead>\n )}\n <div ref={intersectionTargetRef} style={{ height: 0 }} />\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">{headersMarkup}</thead>\n {renderBody()}\n {shouldRenderFooter && (\n <tfoot role=\"rowgroup\">\n <Row role=\"row\">{visible.map((column) => renderFooter({ column }))}</Row>\n </tfoot>\n )}\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n};\n\nDataTable.defaultProps = {\n loading: false,\n loadingRowCount: 5,\n selectionMode: 'multiple',\n stripingMode: 'row',\n enableStickyHeader: true,\n};\n\nDataTable.Cell = Cell;\nDataTable.ColumnMenu = ColumnMenu;\nDataTable.SelectionCell = SelectionCell;\nDataTable.SelectionHeader = SelectionHeader;\nDataTable.Header = Header;\nDataTable.Truncate = Truncate;\nDataTable.NoW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S,CAAC,IAAI,GAAG,IAAI;AACrB,SAAS,CAAC,UAAU,GAAG,UAAU;AACjC,SAAS,CAAC,aAAa,GAAG,aAAa;AACvC,SAAS,CAAC,eAAe,GAAG,eAAe;AAC3C,SAAS,CAAC,MAAM,GAAG,MAAM;AACzB,SAAS,CAAC,QAAQ,GAAG,QAAQ;AAC7B,SAAS,CAAC,MAAM,GAAG,MAAM;;;;"}
|
|
1
|
+
{"version":3,"file":"DataTable.js","sources":["../../../src/components/DataTable/DataTable.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-redundant-roles */\n\nimport React, { useRef } from 'react';\nimport { Stack } from '../Stack';\nimport { Text } from '../Text';\n\nimport { useDragToScroll, useScrollPosition } from '../../hooks';\n\nimport { generateTableCss } from './utils';\nimport { DataTableProps, CustomState, TableRow } from './types';\n\nimport { useCellWidths, useColumns, useSelection } from './hooks';\n\nimport {\n renderCell,\n renderFooter,\n renderHeader,\n renderLoadingCell,\n renderNestedCell,\n} from './renderers';\n\nimport { ActionBar } from './components/ActionBar';\nimport { Cell } from './components/Cell';\nimport { ColumnMenu } from './components/ColumnMenu';\nimport { EmptyBodyContent, EmptyBodyGlyphWrapper } from './components/EmptyBodyContent';\nimport { Header } from './components/Header';\nimport { NoWrap } from './components/NoWrap';\nimport { Row } from './components/Row';\nimport { ScrollContainer } from './components/ScrollContainer';\nimport { TableGrid } from './components/TableGrid';\nimport { Truncate } from './components/Truncate';\nimport { Wrapper } from './components/Wrapper';\nimport { SelectionCell } from './components/SelectionCell';\nimport { SelectionHeader } from './components/SelectionHeader';\nimport { StickyHead } from './components/StickyHead';\n\nimport { getRowState } from './utils/getRowState';\nimport { InfoIcon } from '../../icons';\n\nconst defaultEmptyState: CustomState = {\n iconSlot: <InfoIcon width={48} height={48} />,\n heading: 'No results',\n};\n\nconst emptyAction = () => {};\n\n/**\n * @deprecated DataTable is deprecated and will be removed in a future release. Use `DataGrid` instead.\n */\nexport const DataTable = ({\n actionBarSlot,\n borderMode,\n columns: initialColumns,\n emptyState = defaultEmptyState,\n expandedRowIds,\n loading,\n loadingRowCount,\n onChangeSort,\n rows,\n disabledRowIds,\n selectionMode,\n selectionState,\n setExpanded,\n sortState,\n stripingMode,\n enableStickyHeader,\n resizeableColumns,\n onResizeColumns,\n columnWidths,\n stickyHeaderTop,\n}: DataTableProps) => {\n // Refs\n\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const tableRef = useRef<HTMLTableElement>(null);\n const intersectionTargetRef = useRef<HTMLDivElement>(null);\n\n useDragToScroll({ targetRef: scrollContainerRef, ignoreClassName: 'th-divider' });\n\n // Configure row selection\n\n const enabledRowIds = rows.map((row) => row.id).filter((id) => !disabledRowIds?.includes(id));\n\n const { selectionEnabled, selectedRowIds, selectionColumn, setSelected } = useSelection({\n selectionMode,\n selectionState,\n enabledRowIds,\n });\n\n // Assign actions\n\n const actions = {\n setSelected: setSelected || emptyAction,\n setExpanded: setExpanded || emptyAction,\n };\n\n // Process columns\n\n const columnsWithSelection = [selectionColumn, ...initialColumns];\n const allColumns = selectionEnabled ? columnsWithSelection : initialColumns;\n\n const cellWidths = useCellWidths(tableRef, scrollContainerRef);\n const {\n visible,\n pinnedLeft,\n pinnedRight,\n setColumnWidth,\n columnWidths: calcColumnWidths,\n } = useColumns(allColumns, tableRef, onResizeColumns, columnWidths);\n const adjustedCellWidths =\n cellWidths.length === visible.length\n ? (visible.map((col, i) =>\n Number.isNaN(calcColumnWidths[col.id] || '') ? cellWidths[i] : calcColumnWidths[col.id],\n ) as number[])\n : cellWidths;\n\n // Generate styles\n const { scrollPosition, onScroll, enableTransition } = useScrollPosition({\n containerRef: scrollContainerRef,\n });\n const tableCss = generateTableCss({\n pinnedLeft,\n pinnedRight,\n cellWidths: adjustedCellWidths,\n scrollPosition,\n columnWidths: calcColumnWidths,\n columns: visible,\n stripingMode,\n enableTransition,\n });\n\n // Render states\n\n if (loading) {\n const loadingRows: Array<TableRow> = new Array(loadingRowCount).fill(true).map(() => ({\n // generate random ID forcing all rows to re-render avoid animation de-sync\n id: Math.random() * 1000,\n data: null,\n }));\n\n return (\n <Wrapper borderMode={borderMode}>\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n </thead>\n <tbody role=\"rowgroup\">\n {loadingRows.map((row) => (\n <Row key={row.id}>{visible.map((col) => renderLoadingCell(row, col))}</Row>\n ))}\n </tbody>\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n }\n\n if (rows.length === 0) {\n return (\n <Wrapper borderMode={borderMode}>\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n </thead>\n <tbody role=\"rowgroup\">\n <EmptyBodyContent columnCount={visible.length}>\n <EmptyBodyGlyphWrapper>\n {/* Should be 48x48px */}\n {emptyState.iconSlot}\n </EmptyBodyGlyphWrapper>\n <Stack spacing=\"sm\" alignX=\"center\">\n <Text variant=\"headingMedium\">{emptyState.heading}</Text>\n {emptyState.subheading && (\n <Text variant=\"subheadingMedium\">{emptyState.subheading}</Text>\n )}\n </Stack>\n </EmptyBodyContent>\n </tbody>\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n }\n\n const renderRow = (row: TableRow) => {\n const { e2eClassName = '', accentColor } = row;\n const rowState = getRowState(row.id, { selectedRowIds, expandedRowIds, disabledRowIds });\n\n return (\n <Row role=\"row\" key={row.id} accentColor={accentColor} className={e2eClassName} {...rowState}>\n {visible.map((col) => renderCell(row, col, actions, rowState))}\n </Row>\n );\n };\n\n const renderNestedRow = (nestedRow: TableRow, rowId: TableRow['id']) => {\n const nestedRowE2eClassName = nestedRow?.data?.e2eClassNames?.row;\n const rowState = getRowState(rowId, { selectedRowIds, expandedRowIds, disabledRowIds });\n return (\n <Row role=\"row\" key={nestedRow.id} className={nestedRowE2eClassName}>\n {visible.map((col) => renderNestedCell(nestedRow, col, rowState))}\n </Row>\n );\n };\n\n const renderSection = (row: TableRow) => {\n const isExpanded = expandedRowIds?.includes(row.id);\n return (\n <tbody role=\"rowgroup\" key={row.id}>\n {renderRow(row)}\n {isExpanded && row.nestedRows?.map((nestedRow) => renderNestedRow(nestedRow, row.id))}\n </tbody>\n );\n };\n\n const renderBody = () => {\n const hasNestedRows = !!expandedRowIds;\n const hasMultipleSections = hasNestedRows && stripingMode === 'nested';\n\n if (hasMultipleSections) {\n return rows.map(renderSection);\n }\n\n if (hasNestedRows) {\n return (\n <tbody role=\"rowgroup\">\n {rows.map((row) => {\n const rowElement = renderRow(row);\n const isExpanded = expandedRowIds?.includes(row.id);\n const nestedRowElements =\n (isExpanded &&\n row.nestedRows?.map((nestedRow) => renderNestedRow(nestedRow, row.id))) ||\n [];\n return [rowElement, ...nestedRowElements];\n })}\n </tbody>\n );\n }\n\n return <tbody role=\"rowgroup\">{rows.map(renderRow)}</tbody>;\n };\n\n const headersMarkup = (\n <Row role=\"row\">\n {visible.map((column, i) =>\n renderHeader({\n column,\n sortState,\n onChangeSort,\n resizeableColumns,\n setColumnWidth,\n columnCount: visible.length,\n columnI: i,\n }),\n )}\n </Row>\n );\n\n const shouldRenderFooter = initialColumns.some((column) => !!column.renderFooter);\n const shouldRenderActionBar = selectedRowIds.length > 0 && !!actionBarSlot;\n\n return (\n <Wrapper borderMode={borderMode}>\n {shouldRenderActionBar && (\n <ActionBar\n selectionColumn={selectionColumn}\n intersectionTargetRef={intersectionTargetRef}\n containerRef={scrollContainerRef}\n >\n {actionBarSlot}\n </ActionBar>\n )}\n <ScrollContainer ref={scrollContainerRef} onScroll={onScroll}>\n {enableStickyHeader && (\n <StickyHead\n tableCss={tableCss}\n intersectionTargetRef={intersectionTargetRef}\n containerRef={scrollContainerRef}\n cellWidths={adjustedCellWidths}\n stickyHeaderTop={stickyHeaderTop}\n >\n {headersMarkup}\n </StickyHead>\n )}\n <div ref={intersectionTargetRef} style={{ height: 0 }} />\n <TableGrid tableCss={tableCss} ref={tableRef} role=\"table\">\n <thead role=\"rowgroup\">{headersMarkup}</thead>\n {renderBody()}\n {shouldRenderFooter && (\n <tfoot role=\"rowgroup\">\n <Row role=\"row\">{visible.map((column) => renderFooter({ column }))}</Row>\n </tfoot>\n )}\n </TableGrid>\n </ScrollContainer>\n </Wrapper>\n );\n};\n\nDataTable.defaultProps = {\n loading: false,\n loadingRowCount: 5,\n selectionMode: 'multiple',\n stripingMode: 'row',\n enableStickyHeader: true,\n};\n\nDataTable.Cell = Cell;\nDataTable.ColumnMenu = ColumnMenu;\nDataTable.SelectionCell = SelectionCell;\nDataTable.SelectionHeader = SelectionHeader;\nDataTable.Header = Header;\nDataTable.Truncate = Truncate;\nDataTable.NoWrap = NoWrap;\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAuCA,MAAM,iBAAiB,GAAgB;IACrC,QAAQ,EAAEA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAA,CAAI;AAC7C,IAAA,OAAO,EAAE,YAAY;CACtB;AAED,MAAM,WAAW,GAAG,MAAK,EAAE,CAAC;AAE5B;;AAEG;MACU,SAAS,GAAG,CAAC,EACxB,aAAa,EACb,UAAU,EACV,OAAO,EAAE,cAAc,EACvB,UAAU,GAAG,iBAAiB,EAC9B,cAAc,EACd,OAAO,EACP,eAAe,EACf,YAAY,EACZ,IAAI,EACJ,cAAc,EACd,aAAa,EACb,cAAc,EACd,W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,aAAA,CAAC,SAAS,EAAA,EAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAC,OAAO,EAAA;AACxD,gBAAAA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,IAAI,EAAC,UAAU,EAAA,EAAE,aAAa,CAAS;AAC7C,gBAAA,UAAU,EAAE;AACZ,gBAAA,kBAAkB,KACjBA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,IAAI,EAAC,UAAU,EAAA;AACpB,oBAAAA,cAAA,CAAA,aAAA,CAAC,GAAG,EAAA,EAAC,IAAI,EAAC,KAAK,EAAA,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAO,CACnE,CACT,CACS,CACI,CACV;AAEd;AAEA,SAAS,CAAC,YAAY,GAAG;AACvB,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,eAAe,EAAE,CAAC;AAClB,IAAA,aAAa,EAAE,UAAU;AACzB,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,kBAAkB,EAAE,IAAI;CACzB;AAED,SAAS,CAAC,IAAI,GAAG,IAAI;AACrB,SAAS,CAAC,UAAU,GAAG,UAAU;AACjC,SAAS,CAAC,aAAa,GAAG,aAAa;AACvC,SAAS,CAAC,eAAe,GAAG,eAAe;AAC3C,SAAS,CAAC,MAAM,GAAG,MAAM;AACzB,SAAS,CAAC,QAAQ,GAAG,QAAQ;AAC7B,SAAS,CAAC,MAAM,GAAG,MAAM;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sources":["../../../src/components/DataTable/types.ts"],"sourcesContent":["import { ReactElement, ReactNode } from 'react';\nimport { Size } from '../Stack/types';\n\nexport type BorderType = 'all' | 'vertical' | 'none';\n\nexport type RowState = {\n selected: boolean;\n expanded: boolean;\n disabled: boolean;\n};\n\n/* Columns */\n\nexport type ColumnId = string | number;\nexport type ColumnAlignment = 'left' | 'center' | 'right';\nexport type ColumnOverflow = 'none' | 'wrap' | 'truncate';\nexport type ColumnPinned = 'left' | 'right' | 'none';\nexport type ColumnSpacing = Size;\nexport type ColumnWidth = number | string;\nexport type ColumnWidthFixed = ColumnWidth;\n\nexport type ColumnWidthBounded = {\n min?: ColumnWidth;\n max?: ColumnWidth;\n};\n\nexport type ColumnConfig = {\n id: ColumnId;\n // Options\n align?: ColumnAlignment;\n hidden?: boolean;\n iconSlot?: ReactElement; // Size[5]\n pinned?: ColumnPinned;\n sortable?: boolean;\n spacing?: ColumnSpacing;\n span?: number;\n title?: string;\n tooltip?: string;\n width?: ColumnWidthFixed | ColumnWidthBounded;\n resizeMinWidth?: number;\n // Renderers\n renderCell: CellRenderer;\n renderFooter?: FooterRenderer;\n renderHeader?: HeaderRenderer;\n renderNestedCell?: NestedCellRenderer;\n};\nexport type ColumnConfigs = Array<ColumnConfig>;\n\n/* Sorting */\n\nexport enum SortDirection {\n ascending = 'ascending',\n descending = 'descending',\n}\n\nexport type SortDirectionType = keyof typeof SortDirection;\n\nexport type SortState = {\n columnId: ColumnId;\n direction: SortDirection;\n};\n\nexport type SortChangeHandler = (sortState: SortState) => void;\n\nexport type ColumnWidthState = {\n columnId: ColumnId;\n width: number | string;\n};\n\nexport type ColumnWidthHandler = (columnWidthState: ColumnWidthState) => ColumnWidthsType | void;\n\n/* Data */\n\nexport type RowId = number | string;\n\nexport interface NestedTableRow {\n id: RowId;\n data: any;\n}\n\nexport type NestedTableRows = Array<NestedTableRow>;\n\nexport interface TableRow {\n id: RowId;\n data: any;\n nestedRows?: NestedTableRows;\n accentColor?: string;\n e2eClassName?: string;\n}\nexport type TableRows = Array<TableRow>;\n\n/* Header Props */\n\nexport interface HeaderProps extends React.HtmlHTMLAttributes<HTMLTableCellElement> {\n id: string;\n align?: ColumnAlignment;\n spacing?: ColumnSpacing;\n span?: number;\n zIndex?: number;\n}\n\nexport interface RendererHeaderProps extends HeaderProps {\n key: string;\n 'data-columnid'?: string;\n}\nexport interface SelectionHeaderProps extends Omit<HeaderProps, 'onChange'> {\n selected: boolean;\n indeterminate: boolean;\n onChange: (selected: boolean, value: RowId | undefined) => void;\n selectionMode: SelectionMode;\n}\n\n/* Renderers */\n\nexport type HeaderRenderer = (column: ColumnConfig, headerProps: RendererHeaderProps) => ReactNode;\nexport type FooterRenderer = (column: ColumnConfig, footerProps: object) => ReactNode;\n\nexport type CellRenderer = (\n row: TableRow,\n cellProps: object,\n actions: TableActions,\n rowState: RowState,\n) => ReactNode;\n\ntype ParentRowState = RowState;\nexport type NestedCellRenderer = (\n nestedRow: NestedTableRow,\n cellProps: object,\n parentRowState: ParentRowState,\n) => ReactNode;\n\n/* Actions */\n\nexport type SetSelectedAction = (\n selected: boolean,\n rowId: RowId | undefined,\n options?: { shiftKey?: boolean },\n) => void;\nexport type SetExpandedAction = (expanded: boolean, rowId: RowId | undefined) => void;\n\nexport type TableActions = {\n setSelected: SetSelectedAction;\n setExpanded: SetExpandedAction;\n};\n\n/* Props */\n\nexport type BorderMode = 'full' | 'vertical' | 'none';\n\nexport type CustomState = {\n iconSlot: ReactElement;\n heading: string;\n subheading?: string;\n};\n\nexport type SelectionMode = 'single' | 'multiple';\n\nexport type SelectionIntent = 'range' | 'single' | 'add' | 'remove';\n\nexport type SelectionState = [RowId[], (rowIds: RowId[]) => void];\n\nexport type StripingMode = 'row' | 'nested';\n\nexport interface DataTableProps {\n /** slot for the action bar above the table */\n actionBarSlot?: ReactNode;\n /** Type of border for the table */\n borderMode?: BorderMode;\n /** Columns for the table */\n columns: ColumnConfigs;\n /** Disable specific rows of the table */\n disabledRowIds?: Array<RowId>;\n /** Enable sticky header */\n enableStickyHeader?: boolean;\n /** Render a custom empty state for the table */\n emptyState?: CustomState;\n /** The rows that can be expanded to show more information */\n expandedRowIds?: Array<RowId>;\n /** Renders a loading indicator inside the table */\n loading?: boolean;\n /** Number of rows to display when loading */\n loadingRowCount?: number;\n /** OnChange handler for sorting functionality */\n onChangeSort?: SortChangeHandler;\n /** Rows of data to be displayed in the table */\n rows: TableRows;\n /** Decide how many rows can be selected */\n selectionMode?: SelectionMode;\n /** The current selected rows */\n selectionState?: SelectionState;\n /** Handler to expand specific row */\n setExpanded?: SetExpandedAction;\n /** State of each column's sorting */\n sortState?: SortState;\n /** Renders alternate row a slightly different colour */\n stripingMode?: StripingMode;\n /** Enable column resizing */\n resizeableColumns?: boolean;\n /** Callback for when columns are resized */\n onResizeColumns?: (columnWidths: ResizeColumnData) => void;\n columnWidths?: ColumnWidthsType;\n\n stickyHeaderTop?: number;\n}\n\nexport type ColumnWidthsType = {\n [key: ColumnId]: ColumnWidthType;\n};\n\nexport type ColumnWidthType = ColumnWidthFixed | ColumnWidthBounded | undefined;\n\nexport type ResizeColumnData = ColumnWidthsType;\n"],"names":["SortDirection"],"mappings":";;AAgDA;AAEYA;AAAZ,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,aAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AAC3B,CAAC,EAHWA,qBAAa,KAAbA,qBAAa,GAAA,EAAA,CAAA,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"types.cjs","sources":["../../../src/components/DataTable/types.ts"],"sourcesContent":["import { ReactElement, ReactNode } from 'react';\nimport { Size } from '../Stack/types';\n\nexport type BorderType = 'all' | 'vertical' | 'none';\n\nexport type RowState = {\n selected: boolean;\n expanded: boolean;\n disabled: boolean;\n};\n\n/* Columns */\n\nexport type ColumnId = string | number;\nexport type ColumnAlignment = 'left' | 'center' | 'right';\nexport type ColumnOverflow = 'none' | 'wrap' | 'truncate';\nexport type ColumnPinned = 'left' | 'right' | 'none';\nexport type ColumnSpacing = Size;\nexport type ColumnWidth = number | string;\nexport type ColumnWidthFixed = ColumnWidth;\n\nexport type ColumnWidthBounded = {\n min?: ColumnWidth;\n max?: ColumnWidth;\n};\n\nexport type ColumnConfig = {\n id: ColumnId;\n // Options\n align?: ColumnAlignment;\n hidden?: boolean;\n iconSlot?: ReactElement; // Size[5]\n pinned?: ColumnPinned;\n sortable?: boolean;\n spacing?: ColumnSpacing;\n span?: number;\n title?: string;\n tooltip?: string;\n width?: ColumnWidthFixed | ColumnWidthBounded;\n resizeMinWidth?: number;\n // Renderers\n renderCell: CellRenderer;\n renderFooter?: FooterRenderer;\n renderHeader?: HeaderRenderer;\n renderNestedCell?: NestedCellRenderer;\n};\nexport type ColumnConfigs = Array<ColumnConfig>;\n\n/* Sorting */\n\nexport enum SortDirection {\n ascending = 'ascending',\n descending = 'descending',\n}\n\nexport type SortDirectionType = keyof typeof SortDirection;\n\nexport type SortState = {\n columnId: ColumnId;\n direction: SortDirection;\n};\n\nexport type SortChangeHandler = (sortState: SortState) => void;\n\nexport type ColumnWidthState = {\n columnId: ColumnId;\n width: number | string;\n};\n\nexport type ColumnWidthHandler = (columnWidthState: ColumnWidthState) => ColumnWidthsType | void;\n\n/* Data */\n\nexport type RowId = number | string;\n\nexport interface NestedTableRow {\n id: RowId;\n data: any;\n}\n\nexport type NestedTableRows = Array<NestedTableRow>;\n\nexport interface TableRow {\n id: RowId;\n data: any;\n nestedRows?: NestedTableRows;\n accentColor?: string;\n e2eClassName?: string;\n}\nexport type TableRows = Array<TableRow>;\n\n/* Header Props */\n\nexport interface HeaderProps extends React.HtmlHTMLAttributes<HTMLTableCellElement> {\n id: string;\n align?: ColumnAlignment;\n spacing?: ColumnSpacing;\n span?: number;\n zIndex?: number;\n}\n\nexport interface RendererHeaderProps extends HeaderProps {\n key: string;\n 'data-columnid'?: string;\n}\nexport interface SelectionHeaderProps extends Omit<HeaderProps, 'onChange'> {\n selected: boolean;\n indeterminate: boolean;\n onChange: (selected: boolean, value: RowId | undefined) => void;\n selectionMode: SelectionMode;\n}\n\n/* Renderers */\n\nexport type HeaderRenderer = (column: ColumnConfig, headerProps: RendererHeaderProps) => ReactNode;\nexport type FooterRenderer = (column: ColumnConfig, footerProps: object) => ReactNode;\n\nexport type CellRenderer = (\n row: TableRow,\n cellProps: object,\n actions: TableActions,\n rowState: RowState,\n) => ReactNode;\n\ntype ParentRowState = RowState;\nexport type NestedCellRenderer = (\n nestedRow: NestedTableRow,\n cellProps: object,\n parentRowState: ParentRowState,\n) => ReactNode;\n\n/* Actions */\n\nexport type SetSelectedAction = (\n selected: boolean,\n rowId: RowId | undefined,\n options?: { shiftKey?: boolean },\n) => void;\nexport type SetExpandedAction = (expanded: boolean, rowId: RowId | undefined) => void;\n\nexport type TableActions = {\n setSelected: SetSelectedAction;\n setExpanded: SetExpandedAction;\n};\n\n/* Props */\n\nexport type BorderMode = 'full' | 'vertical' | 'none';\n\nexport type CustomState = {\n iconSlot: ReactElement;\n heading: string;\n subheading?: string;\n};\n\nexport type SelectionMode = 'single' | 'multiple';\n\nexport type SelectionIntent = 'range' | 'single' | 'add' | 'remove';\n\nexport type SelectionState = [RowId[], (rowIds: RowId[]) => void];\n\nexport type StripingMode = 'row' | 'nested';\n\n/**\n * @deprecated DataTable is deprecated and will be removed in a future release. Use `DataGrid` instead.\n */\nexport interface DataTableProps {\n /** slot for the action bar above the table */\n actionBarSlot?: ReactNode;\n /** Type of border for the table */\n borderMode?: BorderMode;\n /** Columns for the table */\n columns: ColumnConfigs;\n /** Disable specific rows of the table */\n disabledRowIds?: Array<RowId>;\n /** Enable sticky header */\n enableStickyHeader?: boolean;\n /** Render a custom empty state for the table */\n emptyState?: CustomState;\n /** The rows that can be expanded to show more information */\n expandedRowIds?: Array<RowId>;\n /** Renders a loading indicator inside the table */\n loading?: boolean;\n /** Number of rows to display when loading */\n loadingRowCount?: number;\n /** OnChange handler for sorting functionality */\n onChangeSort?: SortChangeHandler;\n /** Rows of data to be displayed in the table */\n rows: TableRows;\n /** Decide how many rows can be selected */\n selectionMode?: SelectionMode;\n /** The current selected rows */\n selectionState?: SelectionState;\n /** Handler to expand specific row */\n setExpanded?: SetExpandedAction;\n /** State of each column's sorting */\n sortState?: SortState;\n /** Renders alternate row a slightly different colour */\n stripingMode?: StripingMode;\n /** Enable column resizing */\n resizeableColumns?: boolean;\n /** Callback for when columns are resized */\n onResizeColumns?: (columnWidths: ResizeColumnData) => void;\n columnWidths?: ColumnWidthsType;\n\n stickyHeaderTop?: number;\n}\n\nexport type ColumnWidthsType = {\n [key: ColumnId]: ColumnWidthType;\n};\n\nexport type ColumnWidthType = ColumnWidthFixed | ColumnWidthBounded | undefined;\n\nexport type ResizeColumnData = ColumnWidthsType;\n"],"names":["SortDirection"],"mappings":";;AAgDA;AAEYA;AAAZ,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,aAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AAC3B,CAAC,EAHWA,qBAAa,KAAbA,qBAAa,GAAA,EAAA,CAAA,CAAA;;"}
|
|
@@ -105,6 +105,9 @@ export type SelectionMode = 'single' | 'multiple';
|
|
|
105
105
|
export type SelectionIntent = 'range' | 'single' | 'add' | 'remove';
|
|
106
106
|
export type SelectionState = [RowId[], (rowIds: RowId[]) => void];
|
|
107
107
|
export type StripingMode = 'row' | 'nested';
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated DataTable is deprecated and will be removed in a future release. Use `DataGrid` instead.
|
|
110
|
+
*/
|
|
108
111
|
export interface DataTableProps {
|
|
109
112
|
/** slot for the action bar above the table */
|
|
110
113
|
actionBarSlot?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/components/DataTable/types.ts"],"sourcesContent":["import { ReactElement, ReactNode } from 'react';\nimport { Size } from '../Stack/types';\n\nexport type BorderType = 'all' | 'vertical' | 'none';\n\nexport type RowState = {\n selected: boolean;\n expanded: boolean;\n disabled: boolean;\n};\n\n/* Columns */\n\nexport type ColumnId = string | number;\nexport type ColumnAlignment = 'left' | 'center' | 'right';\nexport type ColumnOverflow = 'none' | 'wrap' | 'truncate';\nexport type ColumnPinned = 'left' | 'right' | 'none';\nexport type ColumnSpacing = Size;\nexport type ColumnWidth = number | string;\nexport type ColumnWidthFixed = ColumnWidth;\n\nexport type ColumnWidthBounded = {\n min?: ColumnWidth;\n max?: ColumnWidth;\n};\n\nexport type ColumnConfig = {\n id: ColumnId;\n // Options\n align?: ColumnAlignment;\n hidden?: boolean;\n iconSlot?: ReactElement; // Size[5]\n pinned?: ColumnPinned;\n sortable?: boolean;\n spacing?: ColumnSpacing;\n span?: number;\n title?: string;\n tooltip?: string;\n width?: ColumnWidthFixed | ColumnWidthBounded;\n resizeMinWidth?: number;\n // Renderers\n renderCell: CellRenderer;\n renderFooter?: FooterRenderer;\n renderHeader?: HeaderRenderer;\n renderNestedCell?: NestedCellRenderer;\n};\nexport type ColumnConfigs = Array<ColumnConfig>;\n\n/* Sorting */\n\nexport enum SortDirection {\n ascending = 'ascending',\n descending = 'descending',\n}\n\nexport type SortDirectionType = keyof typeof SortDirection;\n\nexport type SortState = {\n columnId: ColumnId;\n direction: SortDirection;\n};\n\nexport type SortChangeHandler = (sortState: SortState) => void;\n\nexport type ColumnWidthState = {\n columnId: ColumnId;\n width: number | string;\n};\n\nexport type ColumnWidthHandler = (columnWidthState: ColumnWidthState) => ColumnWidthsType | void;\n\n/* Data */\n\nexport type RowId = number | string;\n\nexport interface NestedTableRow {\n id: RowId;\n data: any;\n}\n\nexport type NestedTableRows = Array<NestedTableRow>;\n\nexport interface TableRow {\n id: RowId;\n data: any;\n nestedRows?: NestedTableRows;\n accentColor?: string;\n e2eClassName?: string;\n}\nexport type TableRows = Array<TableRow>;\n\n/* Header Props */\n\nexport interface HeaderProps extends React.HtmlHTMLAttributes<HTMLTableCellElement> {\n id: string;\n align?: ColumnAlignment;\n spacing?: ColumnSpacing;\n span?: number;\n zIndex?: number;\n}\n\nexport interface RendererHeaderProps extends HeaderProps {\n key: string;\n 'data-columnid'?: string;\n}\nexport interface SelectionHeaderProps extends Omit<HeaderProps, 'onChange'> {\n selected: boolean;\n indeterminate: boolean;\n onChange: (selected: boolean, value: RowId | undefined) => void;\n selectionMode: SelectionMode;\n}\n\n/* Renderers */\n\nexport type HeaderRenderer = (column: ColumnConfig, headerProps: RendererHeaderProps) => ReactNode;\nexport type FooterRenderer = (column: ColumnConfig, footerProps: object) => ReactNode;\n\nexport type CellRenderer = (\n row: TableRow,\n cellProps: object,\n actions: TableActions,\n rowState: RowState,\n) => ReactNode;\n\ntype ParentRowState = RowState;\nexport type NestedCellRenderer = (\n nestedRow: NestedTableRow,\n cellProps: object,\n parentRowState: ParentRowState,\n) => ReactNode;\n\n/* Actions */\n\nexport type SetSelectedAction = (\n selected: boolean,\n rowId: RowId | undefined,\n options?: { shiftKey?: boolean },\n) => void;\nexport type SetExpandedAction = (expanded: boolean, rowId: RowId | undefined) => void;\n\nexport type TableActions = {\n setSelected: SetSelectedAction;\n setExpanded: SetExpandedAction;\n};\n\n/* Props */\n\nexport type BorderMode = 'full' | 'vertical' | 'none';\n\nexport type CustomState = {\n iconSlot: ReactElement;\n heading: string;\n subheading?: string;\n};\n\nexport type SelectionMode = 'single' | 'multiple';\n\nexport type SelectionIntent = 'range' | 'single' | 'add' | 'remove';\n\nexport type SelectionState = [RowId[], (rowIds: RowId[]) => void];\n\nexport type StripingMode = 'row' | 'nested';\n\nexport interface DataTableProps {\n /** slot for the action bar above the table */\n actionBarSlot?: ReactNode;\n /** Type of border for the table */\n borderMode?: BorderMode;\n /** Columns for the table */\n columns: ColumnConfigs;\n /** Disable specific rows of the table */\n disabledRowIds?: Array<RowId>;\n /** Enable sticky header */\n enableStickyHeader?: boolean;\n /** Render a custom empty state for the table */\n emptyState?: CustomState;\n /** The rows that can be expanded to show more information */\n expandedRowIds?: Array<RowId>;\n /** Renders a loading indicator inside the table */\n loading?: boolean;\n /** Number of rows to display when loading */\n loadingRowCount?: number;\n /** OnChange handler for sorting functionality */\n onChangeSort?: SortChangeHandler;\n /** Rows of data to be displayed in the table */\n rows: TableRows;\n /** Decide how many rows can be selected */\n selectionMode?: SelectionMode;\n /** The current selected rows */\n selectionState?: SelectionState;\n /** Handler to expand specific row */\n setExpanded?: SetExpandedAction;\n /** State of each column's sorting */\n sortState?: SortState;\n /** Renders alternate row a slightly different colour */\n stripingMode?: StripingMode;\n /** Enable column resizing */\n resizeableColumns?: boolean;\n /** Callback for when columns are resized */\n onResizeColumns?: (columnWidths: ResizeColumnData) => void;\n columnWidths?: ColumnWidthsType;\n\n stickyHeaderTop?: number;\n}\n\nexport type ColumnWidthsType = {\n [key: ColumnId]: ColumnWidthType;\n};\n\nexport type ColumnWidthType = ColumnWidthFixed | ColumnWidthBounded | undefined;\n\nexport type ResizeColumnData = ColumnWidthsType;\n"],"names":[],"mappings":"AAgDA;IAEY;AAAZ,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,aAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AAC3B,CAAC,EAHW,aAAa,KAAb,aAAa,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/components/DataTable/types.ts"],"sourcesContent":["import { ReactElement, ReactNode } from 'react';\nimport { Size } from '../Stack/types';\n\nexport type BorderType = 'all' | 'vertical' | 'none';\n\nexport type RowState = {\n selected: boolean;\n expanded: boolean;\n disabled: boolean;\n};\n\n/* Columns */\n\nexport type ColumnId = string | number;\nexport type ColumnAlignment = 'left' | 'center' | 'right';\nexport type ColumnOverflow = 'none' | 'wrap' | 'truncate';\nexport type ColumnPinned = 'left' | 'right' | 'none';\nexport type ColumnSpacing = Size;\nexport type ColumnWidth = number | string;\nexport type ColumnWidthFixed = ColumnWidth;\n\nexport type ColumnWidthBounded = {\n min?: ColumnWidth;\n max?: ColumnWidth;\n};\n\nexport type ColumnConfig = {\n id: ColumnId;\n // Options\n align?: ColumnAlignment;\n hidden?: boolean;\n iconSlot?: ReactElement; // Size[5]\n pinned?: ColumnPinned;\n sortable?: boolean;\n spacing?: ColumnSpacing;\n span?: number;\n title?: string;\n tooltip?: string;\n width?: ColumnWidthFixed | ColumnWidthBounded;\n resizeMinWidth?: number;\n // Renderers\n renderCell: CellRenderer;\n renderFooter?: FooterRenderer;\n renderHeader?: HeaderRenderer;\n renderNestedCell?: NestedCellRenderer;\n};\nexport type ColumnConfigs = Array<ColumnConfig>;\n\n/* Sorting */\n\nexport enum SortDirection {\n ascending = 'ascending',\n descending = 'descending',\n}\n\nexport type SortDirectionType = keyof typeof SortDirection;\n\nexport type SortState = {\n columnId: ColumnId;\n direction: SortDirection;\n};\n\nexport type SortChangeHandler = (sortState: SortState) => void;\n\nexport type ColumnWidthState = {\n columnId: ColumnId;\n width: number | string;\n};\n\nexport type ColumnWidthHandler = (columnWidthState: ColumnWidthState) => ColumnWidthsType | void;\n\n/* Data */\n\nexport type RowId = number | string;\n\nexport interface NestedTableRow {\n id: RowId;\n data: any;\n}\n\nexport type NestedTableRows = Array<NestedTableRow>;\n\nexport interface TableRow {\n id: RowId;\n data: any;\n nestedRows?: NestedTableRows;\n accentColor?: string;\n e2eClassName?: string;\n}\nexport type TableRows = Array<TableRow>;\n\n/* Header Props */\n\nexport interface HeaderProps extends React.HtmlHTMLAttributes<HTMLTableCellElement> {\n id: string;\n align?: ColumnAlignment;\n spacing?: ColumnSpacing;\n span?: number;\n zIndex?: number;\n}\n\nexport interface RendererHeaderProps extends HeaderProps {\n key: string;\n 'data-columnid'?: string;\n}\nexport interface SelectionHeaderProps extends Omit<HeaderProps, 'onChange'> {\n selected: boolean;\n indeterminate: boolean;\n onChange: (selected: boolean, value: RowId | undefined) => void;\n selectionMode: SelectionMode;\n}\n\n/* Renderers */\n\nexport type HeaderRenderer = (column: ColumnConfig, headerProps: RendererHeaderProps) => ReactNode;\nexport type FooterRenderer = (column: ColumnConfig, footerProps: object) => ReactNode;\n\nexport type CellRenderer = (\n row: TableRow,\n cellProps: object,\n actions: TableActions,\n rowState: RowState,\n) => ReactNode;\n\ntype ParentRowState = RowState;\nexport type NestedCellRenderer = (\n nestedRow: NestedTableRow,\n cellProps: object,\n parentRowState: ParentRowState,\n) => ReactNode;\n\n/* Actions */\n\nexport type SetSelectedAction = (\n selected: boolean,\n rowId: RowId | undefined,\n options?: { shiftKey?: boolean },\n) => void;\nexport type SetExpandedAction = (expanded: boolean, rowId: RowId | undefined) => void;\n\nexport type TableActions = {\n setSelected: SetSelectedAction;\n setExpanded: SetExpandedAction;\n};\n\n/* Props */\n\nexport type BorderMode = 'full' | 'vertical' | 'none';\n\nexport type CustomState = {\n iconSlot: ReactElement;\n heading: string;\n subheading?: string;\n};\n\nexport type SelectionMode = 'single' | 'multiple';\n\nexport type SelectionIntent = 'range' | 'single' | 'add' | 'remove';\n\nexport type SelectionState = [RowId[], (rowIds: RowId[]) => void];\n\nexport type StripingMode = 'row' | 'nested';\n\n/**\n * @deprecated DataTable is deprecated and will be removed in a future release. Use `DataGrid` instead.\n */\nexport interface DataTableProps {\n /** slot for the action bar above the table */\n actionBarSlot?: ReactNode;\n /** Type of border for the table */\n borderMode?: BorderMode;\n /** Columns for the table */\n columns: ColumnConfigs;\n /** Disable specific rows of the table */\n disabledRowIds?: Array<RowId>;\n /** Enable sticky header */\n enableStickyHeader?: boolean;\n /** Render a custom empty state for the table */\n emptyState?: CustomState;\n /** The rows that can be expanded to show more information */\n expandedRowIds?: Array<RowId>;\n /** Renders a loading indicator inside the table */\n loading?: boolean;\n /** Number of rows to display when loading */\n loadingRowCount?: number;\n /** OnChange handler for sorting functionality */\n onChangeSort?: SortChangeHandler;\n /** Rows of data to be displayed in the table */\n rows: TableRows;\n /** Decide how many rows can be selected */\n selectionMode?: SelectionMode;\n /** The current selected rows */\n selectionState?: SelectionState;\n /** Handler to expand specific row */\n setExpanded?: SetExpandedAction;\n /** State of each column's sorting */\n sortState?: SortState;\n /** Renders alternate row a slightly different colour */\n stripingMode?: StripingMode;\n /** Enable column resizing */\n resizeableColumns?: boolean;\n /** Callback for when columns are resized */\n onResizeColumns?: (columnWidths: ResizeColumnData) => void;\n columnWidths?: ColumnWidthsType;\n\n stickyHeaderTop?: number;\n}\n\nexport type ColumnWidthsType = {\n [key: ColumnId]: ColumnWidthType;\n};\n\nexport type ColumnWidthType = ColumnWidthFixed | ColumnWidthBounded | undefined;\n\nexport type ResizeColumnData = ColumnWidthsType;\n"],"names":[],"mappings":"AAgDA;IAEY;AAAZ,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,aAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AAC3B,CAAC,EAHW,aAAa,KAAb,aAAa,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -7,6 +7,9 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
7
7
|
|
|
8
8
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated DescriptionList is deprecated and will be removed in a future release.
|
|
12
|
+
*/
|
|
10
13
|
const DescriptionList = ({ items, horizontal }) => {
|
|
11
14
|
const renderDescription = (description) => {
|
|
12
15
|
if (Array.isArray(description)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionList.cjs","sources":["../../../src/components/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './DescriptionList.module.scss';\n\ntype DescriptionListItem = {\n term: string;\n description: string | string[];\n};\n\nexport interface DescriptionListProps {\n items: DescriptionListItem[];\n horizontal?: boolean;\n}\n\nexport const DescriptionList = ({ items, horizontal }: DescriptionListProps) => {\n const renderDescription = (description: string | string[]) => {\n if (Array.isArray(description)) {\n return description.map((d) => (\n <dd className={styles.description} key={d}>\n {d}\n </dd>\n ));\n }\n return <dd className={styles.description}>{description}</dd>;\n };\n\n const renderItem = (item: DescriptionListItem) => {\n if (horizontal) {\n return (\n <div className={styles.itemRow} key={item.term}>\n <dt className={styles.term}>{item.term}</dt>\n <div className={styles.descriptionContainer}>{renderDescription(item.description)}</div>\n </div>\n );\n }\n return (\n <div className={styles.item} key={item.term}>\n <dt className={styles.term}>{item.term}</dt>\n {renderDescription(item.description)}\n </div>\n );\n };\n\n return <dl className={styles.list}>{items.map(renderItem)}</dl>;\n};\n"],"names":["React","styles"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"DescriptionList.cjs","sources":["../../../src/components/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './DescriptionList.module.scss';\n\ntype DescriptionListItem = {\n term: string;\n description: string | string[];\n};\n\n/**\n * @deprecated DescriptionList is deprecated and will be removed in a future release.\n */\nexport interface DescriptionListProps {\n items: DescriptionListItem[];\n horizontal?: boolean;\n}\n\n/**\n * @deprecated DescriptionList is deprecated and will be removed in a future release.\n */\nexport const DescriptionList = ({ items, horizontal }: DescriptionListProps) => {\n const renderDescription = (description: string | string[]) => {\n if (Array.isArray(description)) {\n return description.map((d) => (\n <dd className={styles.description} key={d}>\n {d}\n </dd>\n ));\n }\n return <dd className={styles.description}>{description}</dd>;\n };\n\n const renderItem = (item: DescriptionListItem) => {\n if (horizontal) {\n return (\n <div className={styles.itemRow} key={item.term}>\n <dt className={styles.term}>{item.term}</dt>\n <div className={styles.descriptionContainer}>{renderDescription(item.description)}</div>\n </div>\n );\n }\n return (\n <div className={styles.item} key={item.term}>\n <dt className={styles.term}>{item.term}</dt>\n {renderDescription(item.description)}\n </div>\n );\n };\n\n return <dl className={styles.list}>{items.map(renderItem)}</dl>;\n};\n"],"names":["React","styles"],"mappings":";;;;;;;;;AAgBA;;AAEG;AACI,MAAM,eAAe,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAwB,KAAI;AAC7E,IAAA,MAAM,iBAAiB,GAAG,CAAC,WAA8B,KAAI;AAC3D,QAAA,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAC9B,OA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M,CAAC,IAAI,EAAA,EAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAM;AACjE;;;;"}
|
|
@@ -3,9 +3,15 @@ type DescriptionListItem = {
|
|
|
3
3
|
term: string;
|
|
4
4
|
description: string | string[];
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated DescriptionList is deprecated and will be removed in a future release.
|
|
8
|
+
*/
|
|
6
9
|
export interface DescriptionListProps {
|
|
7
10
|
items: DescriptionListItem[];
|
|
8
11
|
horizontal?: boolean;
|
|
9
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated DescriptionList is deprecated and will be removed in a future release.
|
|
15
|
+
*/
|
|
10
16
|
export declare const DescriptionList: ({ items, horizontal }: DescriptionListProps) => React.JSX.Element;
|
|
11
17
|
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import styles from './DescriptionList.module.scss.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated DescriptionList is deprecated and will be removed in a future release.
|
|
6
|
+
*/
|
|
4
7
|
const DescriptionList = ({ items, horizontal }) => {
|
|
5
8
|
const renderDescription = (description) => {
|
|
6
9
|
if (Array.isArray(description)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionList.js","sources":["../../../src/components/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './DescriptionList.module.scss';\n\ntype DescriptionListItem = {\n term: string;\n description: string | string[];\n};\n\nexport interface DescriptionListProps {\n items: DescriptionListItem[];\n horizontal?: boolean;\n}\n\nexport const DescriptionList = ({ items, horizontal }: DescriptionListProps) => {\n const renderDescription = (description: string | string[]) => {\n if (Array.isArray(description)) {\n return description.map((d) => (\n <dd className={styles.description} key={d}>\n {d}\n </dd>\n ));\n }\n return <dd className={styles.description}>{description}</dd>;\n };\n\n const renderItem = (item: DescriptionListItem) => {\n if (horizontal) {\n return (\n <div className={styles.itemRow} key={item.term}>\n <dt className={styles.term}>{item.term}</dt>\n <div className={styles.descriptionContainer}>{renderDescription(item.description)}</div>\n </div>\n );\n }\n return (\n <div className={styles.item} key={item.term}>\n <dt className={styles.term}>{item.term}</dt>\n {renderDescription(item.description)}\n </div>\n );\n };\n\n return <dl className={styles.list}>{items.map(renderItem)}</dl>;\n};\n"],"names":["React"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"DescriptionList.js","sources":["../../../src/components/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './DescriptionList.module.scss';\n\ntype DescriptionListItem = {\n term: string;\n description: string | string[];\n};\n\n/**\n * @deprecated DescriptionList is deprecated and will be removed in a future release.\n */\nexport interface DescriptionListProps {\n items: DescriptionListItem[];\n horizontal?: boolean;\n}\n\n/**\n * @deprecated DescriptionList is deprecated and will be removed in a future release.\n */\nexport const DescriptionList = ({ items, horizontal }: DescriptionListProps) => {\n const renderDescription = (description: string | string[]) => {\n if (Array.isArray(description)) {\n return description.map((d) => (\n <dd className={styles.description} key={d}>\n {d}\n </dd>\n ));\n }\n return <dd className={styles.description}>{description}</dd>;\n };\n\n const renderItem = (item: DescriptionListItem) => {\n if (horizontal) {\n return (\n <div className={styles.itemRow} key={item.term}>\n <dt className={styles.term}>{item.term}</dt>\n <div className={styles.descriptionContainer}>{renderDescription(item.description)}</div>\n </div>\n );\n }\n return (\n <div className={styles.item} key={item.term}>\n <dt className={styles.term}>{item.term}</dt>\n {renderDescription(item.description)}\n </div>\n );\n };\n\n return <dl className={styles.list}>{items.map(renderItem)}</dl>;\n};\n"],"names":["React"],"mappings":";;;AAgBA;;AAEG;AACI,MAAM,eAAe,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAwB,KAAI;AAC7E,IAAA,MAAM,iBAAiB,GAAG,CAAC,WAA8B,KAAI;AAC3D,QAAA,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAC9B,OAAO,WAAW,CAAC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