@popsure/dirty-swan 0.54.21 → 0.54.22
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/cjs/index.js +6 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/{TableSection-32fb8adb.js → TableSection-24502d3f.js} +1 -1
- package/dist/esm/{TableSection-32fb8adb.js.map → TableSection-24502d3f.js.map} +1 -1
- package/dist/esm/components/table/Table.js +1 -1
- package/dist/esm/components/table/Table.stories.js +5 -2
- package/dist/esm/components/table/Table.stories.js.map +1 -1
- package/dist/esm/components/table/Table.test.js +1 -1
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js +6 -4
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js.map +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.js +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.test.js +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.js +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.test.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/src/lib/components/table/Table.stories.tsx +4 -1
- package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.module.scss +6 -0
- package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSection-32fb8adb.js","sources":["../../../src/lib/components/table/types.ts","../../../src/lib/hooks/useMediaQuery.ts","../../../src/lib/components/table/components/TableSection/TableSection.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { BaseCellProps } from './components/TableCell/BaseCell/BaseCell';\nimport { CTACellProps } from './components/TableCell/CTACell/CTACell';\nimport { ButtonCellProps } from './components/TableCell/ButtonCell/ButtonCell';\nimport { CardCellProps } from './components/TableCell/CardCell/CardCell';\n\ntype DefaultCellProps = {\n cellId?: string;\n colSpan?: number;\n};\n\ntype BaseCellData = BaseCellProps & { type?: undefined } & DefaultCellProps;\ntype CTACellData = CTACellProps & { type: 'CTA' } & DefaultCellProps;\ntype ButtonCellData = ButtonCellProps & { type: 'BUTTON' } & DefaultCellProps;\ntype CardCellData = CardCellProps & { type: 'CARD' } & DefaultCellProps;\n\nexport type TableCellData =\n | BaseCellData\n | CTACellData\n | ButtonCellData\n | CardCellData;\n\nexport const isBaseCell = (\n tableCellData: TableCellData\n): tableCellData is BaseCellData => {\n return !tableCellData.type;\n};\n\nexport type TableSectionType = {\n title?: string;\n icon?: ReactNode;\n};\n\nexport type ModalData = {\n title?: ReactNode;\n body?: ReactNode;\n};\n\nexport type TableCellRowData = TableCellData[];\n\nexport type TableSectionData = {\n section?: TableSectionType;\n rows: TableCellRowData[];\n};\n\nexport type TableData = TableSectionData[];\n\nexport type ModalFunction = (modalData: ModalData) => void;\n\nexport type CellReplacements = Record<string, Partial<TableCellData>>;\n","import { useEffect, useState } from 'react';\n\n// USAGE:\n// const isMobile = useMediaQuery('BELOW_MOBILE');\n\nexport const breakpointsArray = [\n 'ABOVE_MOBILE',\n 'ABOVE_TABLET',\n 'ABOVE_DESKTOP',\n 'BELOW_MOBILE',\n 'BELOW_TABLET',\n 'BELOW_DESKTOP',\n] as const;\n\nexport type Breakpoint = typeof breakpointsArray[number];\nexport type BreakpointData = { initialValue: boolean; queryString: string };\n\nexport const breakpointLookup = (breakpoint: Breakpoint): BreakpointData => {\n switch (breakpoint) {\n case 'BELOW_MOBILE':\n default:\n return {\n initialValue: window.innerWidth <= 544, // 34rem = 544px = mobile breakpoint}\n queryString: '(max-width: 34rem)',\n };\n case 'BELOW_TABLET':\n return {\n initialValue: window.innerWidth <= 720, // 45rem = 720px = tablet breakpoint\n queryString: '(max-width: 45rem)',\n };\n case 'BELOW_DESKTOP':\n return {\n initialValue: window.innerWidth <= 1024, // 64rem = 1024px = desktop breakpoint\n queryString: '(max-width: 64rem)',\n };\n case 'ABOVE_MOBILE':\n return {\n initialValue: window.innerWidth >= 544, // 34rem = 544px = mobile breakpoint}\n queryString: '(min-width: 34rem)',\n };\n case 'ABOVE_TABLET':\n return {\n initialValue: window.innerWidth >= 720, // 45rem = 720px = tablet breakpoint\n queryString: '(min-width: 45rem)',\n };\n case 'ABOVE_DESKTOP':\n return {\n initialValue: window.innerWidth >= 1024, // 64rem = 1024px = desktop breakpoint\n queryString: '(min-width: 64rem)',\n };\n }\n};\n\nexport const useMediaQuery = (breakpoint: Breakpoint) => {\n const { initialValue, queryString } = breakpointLookup(breakpoint);\n\n const [matchesBreakpoint, setMatchesBreakpoint] = useState(initialValue);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(queryString);\n\n const updateMediaQuery = (e: MediaQueryListEvent) =>\n setMatchesBreakpoint(e.matches);\n\n mediaQuery.addEventListener('change', updateMediaQuery);\n\n return () => {\n mediaQuery.removeEventListener('change', updateMediaQuery);\n };\n }, [queryString]);\n\n return matchesBreakpoint;\n};\n","import classNames from 'classnames';\n\nimport styles from './TableSection.module.scss';\nimport { TableCell } from '../TableCell/TableCell';\nimport {\n CellReplacements,\n isBaseCell,\n ModalFunction,\n TableCellData,\n TableCellRowData,\n} from '../../types';\nimport { useCallback } from 'react';\nimport { useMediaQuery } from '../../../../hooks/useMediaQuery';\n\nexport interface TableSectionProps {\n className?: string;\n tableCellRows: TableCellRowData[];\n hideColumns?: number[];\n hideHeader?: boolean;\n openModal?: ModalFunction;\n title: string;\n width?: number | string;\n cellReplacements?: CellReplacements;\n imageComponent?: (args: any) => JSX.Element;\n}\n\nconst TableSection = ({\n className,\n tableCellRows,\n hideColumns = [],\n hideHeader,\n openModal,\n title,\n width,\n cellReplacements,\n imageComponent,\n}: TableSectionProps) => {\n const headerRow = tableCellRows?.[0];\n const isBelowDesktop = useMediaQuery('BELOW_DESKTOP');\n\n const getModalTitleFromColumnHeader = (cellIndex: number) => {\n const firstCellInColumn = tableCellRows?.[0]?.[cellIndex];\n let titleFromColumn;\n\n switch (firstCellInColumn.type) {\n case 'BUTTON':\n titleFromColumn = firstCellInColumn.buttonCaption;\n break;\n case 'CTA':\n titleFromColumn = firstCellInColumn.title;\n break;\n case undefined:\n titleFromColumn = firstCellInColumn.text || '';\n break;\n }\n\n return titleFromColumn;\n };\n\n const getModalTitleFromRowHeader = (currentRow: TableCellRowData) => {\n const firstCellInRow = currentRow?.[0];\n const titleFromRow =\n (isBaseCell(firstCellInRow) && firstCellInRow.text) || '';\n\n return titleFromRow;\n };\n\n const isVisibleColumn = useCallback(\n (cellIndex: number) => !hideColumns.includes(cellIndex),\n [hideColumns]\n );\n\n return (\n <table\n className={classNames(className, 'w100', styles.table)}\n width={width}\n >\n <caption className=\"sr-only\">{title}</caption>\n\n {headerRow && (\n <thead className={hideHeader ? 'sr-only' : ''}>\n <tr>\n {headerRow.map((tableCellData, cellIndex) => {\n const isFirstCellInRow = cellIndex === 0;\n const cellReplacementData =\n (tableCellData.cellId &&\n cellReplacements?.[tableCellData.cellId]) ||\n {};\n\n const cellProps = {\n ...tableCellData,\n ...cellReplacementData,\n ...{\n openModal,\n modalTitle:\n (isBaseCell(tableCellData) && tableCellData.text) ||\n getModalTitleFromColumnHeader(cellIndex),\n align: isFirstCellInRow ? 'left' : 'center',\n },\n } as TableCellData;\n\n return (\n isVisibleColumn(cellIndex) && (\n <TableCell\n key={cellIndex}\n isBelowDesktop={isBelowDesktop}\n isHeader\n isFirstCellInRow={isFirstCellInRow}\n isTopLeftCell={isFirstCellInRow}\n {...cellProps}\n imageComponent={imageComponent}\n />\n )\n );\n })}\n </tr>\n </thead>\n )}\n\n <tbody>\n {tableCellRows.map(\n (row, rowIndex) =>\n rowIndex > 0 && (\n <tr key={rowIndex} className={styles.tr}>\n {row.map((tableCellData, cellIndex) => {\n const key = `${rowIndex}-${cellIndex}`;\n const isFirstCellInRow = cellIndex === 0;\n\n const titleFromRow = getModalTitleFromRowHeader(row);\n const titleFromColumnOrRow =\n getModalTitleFromColumnHeader(cellIndex) ||\n getModalTitleFromRowHeader(row);\n\n const cellReplacementData =\n (tableCellData.cellId &&\n cellReplacements?.[tableCellData.cellId]) ||\n {};\n\n const cellProps = {\n ...tableCellData,\n ...cellReplacementData,\n ...{\n openModal,\n modalTitle: isFirstCellInRow\n ? titleFromRow\n : titleFromColumnOrRow,\n align: isFirstCellInRow ? 'left' : 'center',\n },\n } as TableCellData;\n\n return (\n !hideColumns.includes(cellIndex) && (\n <TableCell\n isBelowDesktop={isBelowDesktop}\n isFirstCellInRow={isFirstCellInRow}\n key={key}\n {...cellProps}\n imageComponent={imageComponent}\n />\n )\n );\n })}\n </tr>\n )\n )}\n </tbody>\n </table>\n );\n};\n\nexport { TableSection };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;IAsBa,UAAU,GAAG,UACxB,aAA4B;IAE5B,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;AAC7B;;ACTO,IAAM,gBAAgB,GAAG,UAAC,UAAsB;IACrD,QAAQ,UAAU;QAChB,KAAK,cAAc,CAAC;QACpB;YACE,OAAO;gBACL,YAAY,EAAE,MAAM,CAAC,UAAU,IAAI,GAAG;gBACtC,WAAW,EAAE,oBAAoB;aAClC,CAAC;QACJ,KAAK,cAAc;YACjB,OAAO;gBACL,YAAY,EAAE,MAAM,CAAC,UAAU,IAAI,GAAG;gBACtC,WAAW,EAAE,oBAAoB;aAClC,CAAC;QACJ,KAAK,eAAe;YAClB,OAAO;gBACL,YAAY,EAAE,MAAM,CAAC,UAAU,IAAI,IAAI;gBACvC,WAAW,EAAE,oBAAoB;aAClC,CAAC;QACJ,KAAK,cAAc;YACjB,OAAO;gBACL,YAAY,EAAE,MAAM,CAAC,UAAU,IAAI,GAAG;gBACtC,WAAW,EAAE,oBAAoB;aAClC,CAAC;QACJ,KAAK,cAAc;YACjB,OAAO;gBACL,YAAY,EAAE,MAAM,CAAC,UAAU,IAAI,GAAG;gBACtC,WAAW,EAAE,oBAAoB;aAClC,CAAC;QACJ,KAAK,eAAe;YAClB,OAAO;gBACL,YAAY,EAAE,MAAM,CAAC,UAAU,IAAI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gCACxB,KAAK,EAAE,gBAAgB,GAAG,MAAM,GAAG,QAAQ;6BAC5C,CACe,CAAC;4BAEnB,QACE,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,KAC9BA,IAAC,SAAS,aACR,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,IAE9B,SAAS,IACb,cAAc,EAAE,cAAc,KAFzB,GAAG,CAGR,CACH,EACD;yBACH,CAAC,IAtCK,QAAQ,CAuCZ,CACN;iBAAA,CACJ,GACK,IACF,EACR;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"TableSection-24502d3f.js","sources":["../../../src/lib/components/table/types.ts","../../../src/lib/hooks/useMediaQuery.ts","../../../src/lib/components/table/components/TableSection/TableSection.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { BaseCellProps } from './components/TableCell/BaseCell/BaseCell';\nimport { CTACellProps } from './components/TableCell/CTACell/CTACell';\nimport { ButtonCellProps } from './components/TableCell/ButtonCell/ButtonCell';\nimport { CardCellProps } from './components/TableCell/CardCell/CardCell';\n\ntype DefaultCellProps = {\n cellId?: string;\n colSpan?: number;\n};\n\ntype BaseCellData = BaseCellProps & { type?: undefined } & DefaultCellProps;\ntype CTACellData = CTACellProps & { type: 'CTA' } & DefaultCellProps;\ntype ButtonCellData = ButtonCellProps & { type: 'BUTTON' } & DefaultCellProps;\ntype CardCellData = CardCellProps & { type: 'CARD' } & DefaultCellProps;\n\nexport type TableCellData =\n | BaseCellData\n | CTACellData\n | ButtonCellData\n | CardCellData;\n\nexport const isBaseCell = (\n tableCellData: TableCellData\n): tableCellData is BaseCellData => {\n return !tableCellData.type;\n};\n\nexport type TableSectionType = {\n title?: string;\n icon?: ReactNode;\n};\n\nexport type ModalData = {\n title?: ReactNode;\n body?: ReactNode;\n};\n\nexport type TableCellRowData = TableCellData[];\n\nexport type TableSectionData = {\n section?: TableSectionType;\n rows: TableCellRowData[];\n};\n\nexport type TableData = TableSectionData[];\n\nexport type ModalFunction = (modalData: ModalData) => void;\n\nexport type CellReplacements = Record<string, Partial<TableCellData>>;\n","import { useEffect, useState } from 'react';\n\n// USAGE:\n// const isMobile = useMediaQuery('BELOW_MOBILE');\n\nexport const breakpointsArray = [\n 'ABOVE_MOBILE',\n 'ABOVE_TABLET',\n 'ABOVE_DESKTOP',\n 'BELOW_MOBILE',\n 'BELOW_TABLET',\n 'BELOW_DESKTOP',\n] as const;\n\nexport type Breakpoint = typeof breakpointsArray[number];\nexport type BreakpointData = { initialValue: boolean; queryString: string };\n\nexport const breakpointLookup = (breakpoint: Breakpoint): BreakpointData => {\n switch (breakpoint) {\n case 'BELOW_MOBILE':\n default:\n return {\n initialValue: window.innerWidth <= 544, // 34rem = 544px = mobile breakpoint}\n queryString: '(max-width: 34rem)',\n };\n case 'BELOW_TABLET':\n return {\n initialValue: window.innerWidth <= 720, // 45rem = 720px = tablet breakpoint\n queryString: '(max-width: 45rem)',\n };\n case 'BELOW_DESKTOP':\n return {\n initialValue: window.innerWidth <= 1024, // 64rem = 1024px = desktop breakpoint\n queryString: '(max-width: 64rem)',\n };\n case 'ABOVE_MOBILE':\n return {\n initialValue: window.innerWidth >= 544, // 34rem = 544px = mobile breakpoint}\n queryString: '(min-width: 34rem)',\n };\n case 'ABOVE_TABLET':\n return {\n initialValue: window.innerWidth >= 720, // 45rem = 720px = tablet breakpoint\n queryString: '(min-width: 45rem)',\n };\n case 'ABOVE_DESKTOP':\n return {\n initialValue: window.innerWidth >= 1024, // 64rem = 1024px = desktop breakpoint\n queryString: '(min-width: 64rem)',\n };\n }\n};\n\nexport const useMediaQuery = (breakpoint: Breakpoint) => {\n const { initialValue, queryString } = breakpointLookup(breakpoint);\n\n const [matchesBreakpoint, setMatchesBreakpoint] = useState(initialValue);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(queryString);\n\n const updateMediaQuery = (e: MediaQueryListEvent) =>\n setMatchesBreakpoint(e.matches);\n\n mediaQuery.addEventListener('change', updateMediaQuery);\n\n return () => {\n mediaQuery.removeEventListener('change', updateMediaQuery);\n };\n }, [queryString]);\n\n return matchesBreakpoint;\n};\n","import classNames from 'classnames';\n\nimport styles from './TableSection.module.scss';\nimport { TableCell } from '../TableCell/TableCell';\nimport {\n CellReplacements,\n isBaseCell,\n ModalFunction,\n TableCellData,\n TableCellRowData,\n} from '../../types';\nimport { useCallback } from 'react';\nimport { useMediaQuery } from '../../../../hooks/useMediaQuery';\n\nexport interface TableSectionProps {\n className?: string;\n tableCellRows: TableCellRowData[];\n hideColumns?: number[];\n hideHeader?: boolean;\n openModal?: ModalFunction;\n title: string;\n width?: number | string;\n cellReplacements?: CellReplacements;\n imageComponent?: (args: any) => JSX.Element;\n}\n\nconst TableSection = ({\n className,\n tableCellRows,\n hideColumns = [],\n hideHeader,\n openModal,\n title,\n width,\n cellReplacements,\n imageComponent,\n}: TableSectionProps) => {\n const headerRow = tableCellRows?.[0];\n const isBelowDesktop = useMediaQuery('BELOW_DESKTOP');\n\n const getModalTitleFromColumnHeader = (cellIndex: number) => {\n const firstCellInColumn = tableCellRows?.[0]?.[cellIndex];\n let titleFromColumn;\n\n switch (firstCellInColumn.type) {\n case 'BUTTON':\n titleFromColumn = firstCellInColumn.buttonCaption;\n break;\n case 'CTA':\n titleFromColumn = firstCellInColumn.title;\n break;\n case undefined:\n titleFromColumn = firstCellInColumn.text || '';\n break;\n }\n\n return titleFromColumn;\n };\n\n const getModalTitleFromRowHeader = (currentRow: TableCellRowData) => {\n const firstCellInRow = currentRow?.[0];\n const titleFromRow =\n (isBaseCell(firstCellInRow) && firstCellInRow.text) || '';\n\n return titleFromRow;\n };\n\n const isVisibleColumn = useCallback(\n (cellIndex: number) => !hideColumns.includes(cellIndex),\n [hideColumns]\n );\n\n return (\n <table\n className={classNames(className, 'w100', styles.table)}\n width={width}\n >\n <caption className=\"sr-only\">{title}</caption>\n\n {headerRow && (\n <thead className={hideHeader ? 'sr-only' : ''}>\n <tr>\n {headerRow.map((tableCellData, cellIndex) => {\n const isFirstCellInRow = cellIndex === 0;\n const cellReplacementData =\n (tableCellData.cellId &&\n cellReplacements?.[tableCellData.cellId]) ||\n {};\n\n const cellProps = {\n ...tableCellData,\n ...cellReplacementData,\n ...{\n openModal,\n modalTitle:\n (isBaseCell(tableCellData) && tableCellData.text) ||\n getModalTitleFromColumnHeader(cellIndex),\n align: isFirstCellInRow ? 'left' : 'center',\n },\n } as TableCellData;\n\n return (\n isVisibleColumn(cellIndex) && (\n <TableCell\n key={cellIndex}\n isBelowDesktop={isBelowDesktop}\n isHeader\n isFirstCellInRow={isFirstCellInRow}\n isTopLeftCell={isFirstCellInRow}\n {...cellProps}\n imageComponent={imageComponent}\n />\n )\n );\n })}\n </tr>\n </thead>\n )}\n\n <tbody>\n {tableCellRows.map(\n (row, rowIndex) =>\n rowIndex > 0 && (\n <tr key={rowIndex} className={styles.tr}>\n {row.map((tableCellData, cellIndex) => {\n const key = `${rowIndex}-${cellIndex}`;\n const isFirstCellInRow = cellIndex === 0;\n\n const titleFromRow = getModalTitleFromRowHeader(row);\n const titleFromColumnOrRow =\n getModalTitleFromColumnHeader(cellIndex) ||\n getModalTitleFromRowHeader(row);\n\n const cellReplacementData =\n (tableCellData.cellId &&\n cellReplacements?.[tableCellData.cellId]) ||\n {};\n\n const cellProps = {\n ...tableCellData,\n ...cellReplacementData,\n ...{\n openModal,\n modalTitle: isFirstCellInRow\n ? titleFromRow\n : titleFromColumnOrRow,\n align: isFirstCellInRow ? 'left' : 'center',\n },\n } as TableCellData;\n\n return (\n !hideColumns.includes(cellIndex) && (\n <TableCell\n isBelowDesktop={isBelowDesktop}\n isFirstCellInRow={isFirstCellInRow}\n key={key}\n {...cellProps}\n imageComponent={imageComponent}\n />\n )\n );\n })}\n </tr>\n )\n )}\n </tbody>\n </table>\n );\n};\n\nexport { TableSection };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;IAsBa,UAAU,GAAG,UACxB,aAA4B;IAE5B,OAAO,CAAC,aAAa,CAAC,IAAI,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AEDA,yBACG,aAAa,CAAC,GAAG,CAChB,UAAC,GAAG,EAAE,QAAQ;oBACZ,OAAA,QAAQ,GAAG,CAAC,KACVA,YAAmB,SAAS,EAAE,MAAM,CAAC,EAAE,YACpC,GAAG,CAAC,GAAG,CAAC,UAAC,aAAa,EAAE,SAAS;4BAChC,IAAM,GAAG,GAAG,UAAG,QAAQ,cAAI,SAAS,CAAE,CAAC;4BACvC,IAAM,gBAAgB,GAAG,SAAS,KAAK,CAAC,CAAC;4BAEzC,IAAM,YAAY,GAAG,0BAA0B,CAAC,GAAG,CAAC,CAAC;4BACrD,IAAM,oBAAoB,GACxB,6BAA6B,CAAC,SAAS,CAAC;gCACxC,0BAA0B,CAAC,GAAG,CAAC,CAAC;4BAElC,IAAM,mBAAmB,GACvB,CAAC,aAAa,CAAC,MAAM;iCACnB,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,aAAa,CAAC,MAAM,CAAC,CAAA;gCAC1C,EAAE,CAAC;4BAEL,IAAM,SAAS,GAAG,+BACb,aAAa,GACb,mBAAmB,GACnB;gCACD,SAAS,WAAA;gCACT,UAAU,EAAE,gBAAgB;sCACxB,YAAY;sCACZ,oBAAoB;gCACxB,KAAK,EAAE,gBAAgB,GAAG,MAAM,GAAG,QAAQ;6BAC5C,CACe,CAAC;4BAEnB,QACE,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,KAC9BA,IAAC,SAAS,aACR,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,IAE9B,SAAS,IACb,cAAc,EAAE,cAAc,KAFzB,GAAG,CAGR,CACH,EACD;yBACH,CAAC,IAtCK,QAAQ,CAuCZ,CACN;iBAAA,CACJ,GACK,IACF,EACR;AACJ;;;;"}
|
|
@@ -7,7 +7,7 @@ import ChevronDownIcon from '../icon/icons/ChevronDown.js';
|
|
|
7
7
|
import ChevronUpIcon from '../icon/icons/ChevronUp.js';
|
|
8
8
|
import { Card } from '../cards/card/index.js';
|
|
9
9
|
import { s as styleInject } from '../../style-inject.es-1f59c1d0.js';
|
|
10
|
-
import { u as useMediaQuery, i as isBaseCell, T as TableSection } from '../../TableSection-
|
|
10
|
+
import { u as useMediaQuery, i as isBaseCell, T as TableSection } from '../../TableSection-24502d3f.js';
|
|
11
11
|
import { TableContents } from './components/TableContents/TableContents.js';
|
|
12
12
|
import { c as classNames } from '../../index-6ea95111.js';
|
|
13
13
|
import { u as useTableNavigation } from '../../useTableNavigation-f929fbc9.js';
|
|
@@ -33,7 +33,7 @@ import '../modal/genericModal/index.js';
|
|
|
33
33
|
import '../modal/regularModal/index.js';
|
|
34
34
|
import '../icon/icons/ChevronDown.js';
|
|
35
35
|
import '../icon/icons/ChevronUp.js';
|
|
36
|
-
import '../../TableSection-
|
|
36
|
+
import '../../TableSection-24502d3f.js';
|
|
37
37
|
import './components/TableContents/TableContents.js';
|
|
38
38
|
import './components/TableContents/Collapsible.js';
|
|
39
39
|
import '../../useTableNavigation-f929fbc9.js';
|
|
@@ -160,7 +160,10 @@ var initialData = [
|
|
|
160
160
|
],
|
|
161
161
|
[
|
|
162
162
|
{ text: 'Operations', modalContent: 'info' },
|
|
163
|
-
{
|
|
163
|
+
{
|
|
164
|
+
text: 'This is a table cell with a lot of text',
|
|
165
|
+
modalContent: 'Maybe',
|
|
166
|
+
},
|
|
164
167
|
{ checkmarkValue: false },
|
|
165
168
|
{ checkmarkValue: true },
|
|
166
169
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.stories.js","sources":["../../../../../src/lib/components/table/Table.stories.tsx"],"sourcesContent":["import { Table, TableProps } from './Table';\nimport { DentalPlusIcon, PlaneIcon } from '../icon';\nimport { TableData } from './types';\nimport { useState } from 'react';\nimport { Input } from '../input';\n\nconst initialData: TableData = [\n {\n rows: [\n [\n { text: 'Our plans' },\n {\n type: 'CTA',\n icon: 'https://placehold.co/24x24/orange/white',\n title: 'Standard',\n price: '€234',\n buttonCaption: 'Get covered',\n href: 'http://example.com',\n },\n {\n type: 'CTA',\n icon: 'https://placehold.co/24x24/green/white',\n title: 'Plus',\n price: '€344',\n buttonCaption: 'Get covered',\n href: 'http://example.com',\n },\n {\n type: 'CTA',\n icon: <PlaneIcon size={24} noMargin />,\n title: 'Premium',\n price: '€556',\n buttonCaption: 'Get covered',\n href: 'http://example.com',\n },\n ],\n [\n { text: 'Select a plan' },\n {\n type: 'BUTTON',\n buttonCaption: 'Standard',\n price: '€234',\n onClick: () => {},\n },\n {\n type: 'BUTTON',\n buttonCaption: 'Plus',\n price: '€344',\n onClick: () => {},\n },\n {\n type: 'BUTTON',\n buttonCaption: 'Premium',\n price: '€556',\n onClick: () => {},\n },\n ],\n [\n {\n text: 'Your contribution',\n },\n {\n cellId: '#1',\n text: '€210',\n description: 'per month',\n fontVariant: 'PRICE',\n modalContent: 'Price info',\n },\n {\n cellId: '#2',\n text: '€275',\n description: 'per month',\n fontVariant: 'PRICE',\n modalContent: 'Price info',\n },\n {\n cellId: '#3',\n text: '€310',\n description: 'per month',\n fontVariant: 'PRICE',\n modalContent: 'Price info',\n },\n ],\n [\n {\n text: 'Regular vet visits & medication',\n description: 'Pflegepflichtversicherungrightno',\n modalContent: 'Some stories about vets',\n },\n { text: 'No', description: 'Annual Only' },\n { text: '50%' },\n { text: '80%-100%' },\n ],\n [\n { text: 'Operations', modalContent: 'Operations info' },\n { checkmarkValue: true, modalContent: 'Operations info column 2' },\n { checkmarkValue: false },\n { checkmarkValue: true },\n ],\n [\n { text: 'Rating', modalContent: 'Rating info' },\n { rating: { type: 'zap', value: 1 } },\n {\n rating: { type: 'zap', value: 3 },\n modalContent: 'Rating info column 3',\n },\n { rating: { type: 'star', value: 3 } },\n ],\n ],\n },\n {\n section: {\n icon: <DentalPlusIcon size={24} noMargin />,\n title: 'Dental',\n },\n rows: [\n [\n { text: 'Regular vet visits & medication' },\n { text: 'No' },\n { text: 'Yes' },\n { text: 'Yes' },\n ],\n [\n { text: 'Operations', modalContent: 'info' },\n { checkmarkValue: true, modalContent: 'Maybe' },\n { checkmarkValue: false },\n { checkmarkValue: true },\n ],\n [\n { text: 'Rating', modalContent: 'info' },\n { rating: { type: 'zap', value: 1 }, modalContent: 'Maybe' },\n { rating: { type: 'zap', value: 3 } },\n { rating: { type: 'star', value: 3 } },\n ],\n [\n {\n type: 'CARD',\n colSpan: 3,\n title: 'Dental add-on',\n href: 'https://example.com',\n icon: 'https://placehold.co/24x24/green/yellow',\n description:\n 'Get your dental cleanings and additional treatments covered for just 10.90€ a month.',\n },\n ],\n ],\n },\n {\n section: {\n title: 'Travel',\n icon: 'https://placehold.co/24x24/red/yellow',\n },\n rows: [\n [\n { text: 'Regular vet visits & medication' },\n { text: 'No', checkmarkValue: false },\n { text: 'Yes' },\n { text: 'Yes' },\n ],\n [\n { text: 'Operations', modalContent: 'info' },\n { checkmarkValue: true, modalContent: 'Maybe' },\n { checkmarkValue: false },\n { checkmarkValue: true },\n ],\n [\n { text: 'Rating', modalContent: 'info' },\n { rating: { type: 'zap', value: 1 }, modalContent: 'Maybe' },\n { rating: { type: 'zap', value: 3 } },\n { rating: { type: 'star', value: 3 } },\n ],\n ],\n },\n];\n\nconst story = {\n title: 'JSX/Table',\n component: Table,\n argTypes: {\n tableData: {\n subContent:\n 'This property allows to set the data of the Table component.',\n },\n title: {\n subContent:\n 'This property allows to add a title to the Table component for accessibility purposes.',\n },\n collapsibleSections: {\n subContent: 'This property allows to collapse the sections of the table.',\n },\n hideDetails: {\n subContent: 'This property allows to hide the details of the table.',\n },\n stickyHeaderTopOffset: {\n subContent:\n 'This property allows to set the offset of the sticky header.',\n },\n className: {\n subContent:\n 'This property allows to set a custom class to the Table component.',\n },\n textOverrides: {\n subContent:\n 'This property allows to set custom text for the show and hide details buttons.',\n },\n hideColumns: {\n subContent: 'This property allows to hide defined columns by index.',\n },\n modalContentRenderer: {\n subContent: 'This property allows to render custom modal content.',\n },\n onSelectionChanged: {\n subContent:\n 'This event is triggered when a selection is changed. It receives the index of the selection as an argument.',\n table: {\n category: 'Events',\n },\n },\n onModalOpen: {\n subContent:\n 'This event is triggered when a modal is opened. It receives the title and body of the modal as arguments.',\n table: {\n category: 'Events',\n },\n },\n },\n args: {\n tableData: initialData,\n collapsibleSections: false,\n hideDetails: false,\n stickyHeaderTopOffset: 0,\n title: 'Title of the table',\n className: '',\n textOverrides: {\n showDetails: 'Show details',\n hideDetails: 'Hide details',\n },\n hideColumns: [],\n },\n};\n\nexport const TableStory = ({\n collapsibleSections,\n tableData,\n hideColumns,\n hideDetails,\n stickyHeaderTopOffset,\n textOverrides,\n title,\n}: TableProps) => {\n const [price, setPrice] = useState(999);\n return (\n <div>\n <div className=\"d-flex fd-column p24 mb80 gap16 wmx5\">\n <label htmlFor=\"\">Change price to see replacement in action: </label>\n <Input\n id=\"#stuff\"\n type=\"text\"\n onChange={(e) => setPrice(Number(e.target.value))}\n value={price}\n />\n </div>\n\n <Table\n cellReplacements={{\n '#1': {\n type: 'CTA',\n title: 'Replaced!',\n price: `€${price}`,\n buttonCaption: 'I got replaced',\n href: 'http://example.com',\n },\n '#2': {\n type: 'BUTTON',\n buttonCaption: 'I got replaced too',\n },\n '#3': {\n description: 'per year',\n },\n }}\n collapsibleSections={collapsibleSections}\n tableData={tableData}\n hideColumns={hideColumns}\n hideDetails={hideDetails}\n stickyHeaderTopOffset={stickyHeaderTopOffset}\n textOverrides={textOverrides}\n title={title}\n />\n </div>\n );\n};\n\nexport const TableDataType = () => {\n return (\n <pre>\n {`\ntype TableData = {\n section?: \n title?: string;\n icon?: ReactNode;\n };\n rows: {\n align?: 'center' | 'left' | 'right';\n checkmarkValue?: boolean;\n text?: ReactNode;\n modalContent?: ReactNode;\n subContent?: ReactNode;\n rating?: {\n value: number;\n type: 'zap' | 'star';\n }\n openModal?: (modalContent: ReactNode) => void;\n }[][];\n}[];\n `}\n </pre>\n );\n};\n\nTableStory.storyName = 'Table';\n\nexport default story;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;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J,WAAW,EAAE,UAAU;qBACxB;iBACF,EACD,mBAAmB,EAAE,mBAAmB,EACxC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,qBAAqB,EAAE,qBAAqB,EAC5C,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,GACZ,IACE,EACN;AACJ,EAAE;IAEW,aAAa,GAAG;IAC3B,QACEA,uBACG,mZAmBA,GACG,EACN;AACJ,EAAE;AAEF,UAAU,CAAC,SAAS,GAAG,OAAO;;;;;"}
|
|
1
|
+
{"version":3,"file":"Table.stories.js","sources":["../../../../../src/lib/components/table/Table.stories.tsx"],"sourcesContent":["import { Table, TableProps } from './Table';\nimport { DentalPlusIcon, PlaneIcon } from '../icon';\nimport { TableData } from './types';\nimport { useState } from 'react';\nimport { Input } from '../input';\n\nconst initialData: TableData = [\n {\n rows: [\n [\n { text: 'Our plans' },\n {\n type: 'CTA',\n icon: 'https://placehold.co/24x24/orange/white',\n title: 'Standard',\n price: '€234',\n buttonCaption: 'Get covered',\n href: 'http://example.com',\n },\n {\n type: 'CTA',\n icon: 'https://placehold.co/24x24/green/white',\n title: 'Plus',\n price: '€344',\n buttonCaption: 'Get covered',\n href: 'http://example.com',\n },\n {\n type: 'CTA',\n icon: <PlaneIcon size={24} noMargin />,\n title: 'Premium',\n price: '€556',\n buttonCaption: 'Get covered',\n href: 'http://example.com',\n },\n ],\n [\n { text: 'Select a plan' },\n {\n type: 'BUTTON',\n buttonCaption: 'Standard',\n price: '€234',\n onClick: () => {},\n },\n {\n type: 'BUTTON',\n buttonCaption: 'Plus',\n price: '€344',\n onClick: () => {},\n },\n {\n type: 'BUTTON',\n buttonCaption: 'Premium',\n price: '€556',\n onClick: () => {},\n },\n ],\n [\n {\n text: 'Your contribution',\n },\n {\n cellId: '#1',\n text: '€210',\n description: 'per month',\n fontVariant: 'PRICE',\n modalContent: 'Price info',\n },\n {\n cellId: '#2',\n text: '€275',\n description: 'per month',\n fontVariant: 'PRICE',\n modalContent: 'Price info',\n },\n {\n cellId: '#3',\n text: '€310',\n description: 'per month',\n fontVariant: 'PRICE',\n modalContent: 'Price info',\n },\n ],\n [\n {\n text: 'Regular vet visits & medication',\n description: 'Pflegepflichtversicherungrightno',\n modalContent: 'Some stories about vets',\n },\n { text: 'No', description: 'Annual Only' },\n { text: '50%' },\n { text: '80%-100%' },\n ],\n [\n { text: 'Operations', modalContent: 'Operations info' },\n { checkmarkValue: true, modalContent: 'Operations info column 2' },\n { checkmarkValue: false },\n { checkmarkValue: true },\n ],\n [\n { text: 'Rating', modalContent: 'Rating info' },\n { rating: { type: 'zap', value: 1 } },\n {\n rating: { type: 'zap', value: 3 },\n modalContent: 'Rating info column 3',\n },\n { rating: { type: 'star', value: 3 } },\n ],\n ],\n },\n {\n section: {\n icon: <DentalPlusIcon size={24} noMargin />,\n title: 'Dental',\n },\n rows: [\n [\n { text: 'Regular vet visits & medication' },\n { text: 'No' },\n { text: 'Yes' },\n { text: 'Yes' },\n ],\n [\n { text: 'Operations', modalContent: 'info' },\n {\n text: 'This is a table cell with a lot of text',\n modalContent: 'Maybe',\n },\n { checkmarkValue: false },\n { checkmarkValue: true },\n ],\n [\n { text: 'Rating', modalContent: 'info' },\n { rating: { type: 'zap', value: 1 }, modalContent: 'Maybe' },\n { rating: { type: 'zap', value: 3 } },\n { rating: { type: 'star', value: 3 } },\n ],\n [\n {\n type: 'CARD',\n colSpan: 3,\n title: 'Dental add-on',\n href: 'https://example.com',\n icon: 'https://placehold.co/24x24/green/yellow',\n description:\n 'Get your dental cleanings and additional treatments covered for just 10.90€ a month.',\n },\n ],\n ],\n },\n {\n section: {\n title: 'Travel',\n icon: 'https://placehold.co/24x24/red/yellow',\n },\n rows: [\n [\n { text: 'Regular vet visits & medication' },\n { text: 'No', checkmarkValue: false },\n { text: 'Yes' },\n { text: 'Yes' },\n ],\n [\n { text: 'Operations', modalContent: 'info' },\n { checkmarkValue: true, modalContent: 'Maybe' },\n { checkmarkValue: false },\n { checkmarkValue: true },\n ],\n [\n { text: 'Rating', modalContent: 'info' },\n { rating: { type: 'zap', value: 1 }, modalContent: 'Maybe' },\n { rating: { type: 'zap', value: 3 } },\n { rating: { type: 'star', value: 3 } },\n ],\n ],\n },\n];\n\nconst story = {\n title: 'JSX/Table',\n component: Table,\n argTypes: {\n tableData: {\n subContent:\n 'This property allows to set the data of the Table component.',\n },\n title: {\n subContent:\n 'This property allows to add a title to the Table component for accessibility purposes.',\n },\n collapsibleSections: {\n subContent: 'This property allows to collapse the sections of the table.',\n },\n hideDetails: {\n subContent: 'This property allows to hide the details of the table.',\n },\n stickyHeaderTopOffset: {\n subContent:\n 'This property allows to set the offset of the sticky header.',\n },\n className: {\n subContent:\n 'This property allows to set a custom class to the Table component.',\n },\n textOverrides: {\n subContent:\n 'This property allows to set custom text for the show and hide details buttons.',\n },\n hideColumns: {\n subContent: 'This property allows to hide defined columns by index.',\n },\n modalContentRenderer: {\n subContent: 'This property allows to render custom modal content.',\n },\n onSelectionChanged: {\n subContent:\n 'This event is triggered when a selection is changed. It receives the index of the selection as an argument.',\n table: {\n category: 'Events',\n },\n },\n onModalOpen: {\n subContent:\n 'This event is triggered when a modal is opened. It receives the title and body of the modal as arguments.',\n table: {\n category: 'Events',\n },\n },\n },\n args: {\n tableData: initialData,\n collapsibleSections: false,\n hideDetails: false,\n stickyHeaderTopOffset: 0,\n title: 'Title of the table',\n className: '',\n textOverrides: {\n showDetails: 'Show details',\n hideDetails: 'Hide details',\n },\n hideColumns: [],\n },\n};\n\nexport const TableStory = ({\n collapsibleSections,\n tableData,\n hideColumns,\n hideDetails,\n stickyHeaderTopOffset,\n textOverrides,\n title,\n}: TableProps) => {\n const [price, setPrice] = useState(999);\n return (\n <div>\n <div className=\"d-flex fd-column p24 mb80 gap16 wmx5\">\n <label htmlFor=\"\">Change price to see replacement in action: </label>\n <Input\n id=\"#stuff\"\n type=\"text\"\n onChange={(e) => setPrice(Number(e.target.value))}\n value={price}\n />\n </div>\n\n <Table\n cellReplacements={{\n '#1': {\n type: 'CTA',\n title: 'Replaced!',\n price: `€${price}`,\n buttonCaption: 'I got replaced',\n href: 'http://example.com',\n },\n '#2': {\n type: 'BUTTON',\n buttonCaption: 'I got replaced too',\n },\n '#3': {\n description: 'per year',\n },\n }}\n collapsibleSections={collapsibleSections}\n tableData={tableData}\n hideColumns={hideColumns}\n hideDetails={hideDetails}\n stickyHeaderTopOffset={stickyHeaderTopOffset}\n textOverrides={textOverrides}\n title={title}\n />\n </div>\n );\n};\n\nexport const TableDataType = () => {\n return (\n <pre>\n {`\ntype TableData = {\n section?: \n title?: string;\n icon?: ReactNode;\n };\n rows: {\n align?: 'center' | 'left' | 'right';\n checkmarkValue?: boolean;\n text?: ReactNode;\n modalContent?: ReactNode;\n subContent?: ReactNode;\n rating?: {\n value: number;\n type: 'zap' | 'star';\n }\n openModal?: (modalContent: ReactNode) => void;\n }[][];\n}[];\n `}\n </pre>\n );\n};\n\nTableStory.storyName = 'Table';\n\nexport default story;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAM,WAAW,GAAc;IAC7B;QACE,IAAI,EAAE;YACJ;gBACE,EAAE,IAAI,EAAE,WAAW,EAAE;gBACrB;oBACE,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,yCAAyC;oBAC/C,KAAK,EAAE,UAAU;oBACjB,KAAK,EAAE,MAAM;oBACb,aAAa,EAAE,aAAa;oBAC5B,IAAI,EAAE,oBAAoB;iBAC3B;gBACD;oBACE,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,wCAAwC;oBAC9C,KAAK,EAAE,MAAM;oBACb,KAAK,EAAE,MAAM;oBACb,aAAa,EAAE,aAAa;oBAC5B,IAAI,EAAE,oBAAoB;iBAC3B;gBACD;oBACE,IAAI,EAAE,KAAK;oBACX,IAAI,EAAEA,IAAC,SAAS,IAAC,IAAI,EAAE,E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oB,QAAQ,CAAC,GAAG,CAAC,EAAhC,KAAK,QAAA,EAAE,QAAQ,QAAiB,CAAC;IACxC,QACEC,yBACEA,cAAK,SAAS,EAAC,sCAAsC,aACnDD,eAAO,OAAO,EAAC,EAAE,4DAAoD,EACrEA,IAAC,KAAK,IACJ,EAAE,EAAC,QAAQ,EACX,IAAI,EAAC,MAAM,EACX,QAAQ,EAAE,UAAC,CAAC,IAAK,OAAA,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAA,EACjD,KAAK,EAAE,KAAK,GACZ,IACE,EAENA,IAAC,KAAK,IACJ,gBAAgB,EAAE;oBAChB,IAAI,EAAE;wBACJ,IAAI,EAAE,KAAK;wBACX,KAAK,EAAE,WAAW;wBAClB,KAAK,EAAE,gBAAI,KAAK,CAAE;wBAClB,aAAa,EAAE,gBAAgB;wBAC/B,IAAI,EAAE,oBAAoB;qBAC3B;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,aAAa,EAAE,oBAAoB;qBACpC;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,UAAU;qBACxB;iBACF,EACD,mBAAmB,EAAE,mBAAmB,EACxC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,qBAAqB,EAAE,qBAAqB,EAC5C,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,GACZ,IACE,EACN;AACJ,EAAE;IAEW,aAAa,GAAG;IAC3B,QACEA,uBACG,mZAmBA,GACG,EACN;AACJ,EAAE;AAEF,UAAU,CAAC,SAAS,GAAG,OAAO;;;;;"}
|
|
@@ -33,7 +33,7 @@ import '../modal/genericModal/index.js';
|
|
|
33
33
|
import '../modal/regularModal/index.js';
|
|
34
34
|
import '../icon/icons/ChevronDown.js';
|
|
35
35
|
import '../icon/icons/ChevronUp.js';
|
|
36
|
-
import '../../TableSection-
|
|
36
|
+
import '../../TableSection-24502d3f.js';
|
|
37
37
|
import './components/TableContents/TableContents.js';
|
|
38
38
|
import './components/TableContents/Collapsible.js';
|
|
39
39
|
import '../../useTableNavigation-f929fbc9.js';
|
|
@@ -15,8 +15,8 @@ import '../../../../../tslib.es6-a39f91fc.js';
|
|
|
15
15
|
import '../../../../../_commonjsHelpers-4730bd53.js';
|
|
16
16
|
import '../../../../icon/icons/Info.js';
|
|
17
17
|
|
|
18
|
-
var css_248z = ".BaseCell-module_relative__1v2X0 {\n position: relative;\n}\n\n.BaseCell-module_infoButtonAbsolute__Mpjrz {\n position: absolute;\n right: -32px;\n}\n\n.BaseCell-module_icon__1775U {\n margin: 2px;\n}\n\n.BaseCell-module_description__3_kfe {\n word-break: break-word;\n}\n\n.BaseCell-module_bigWithUnderline__2xx5X {\n position: relative;\n display: flex;\n line-height: 38px;\n text-decoration: underline;\n text-decoration-color: #8e8cee;\n text-decoration-thickness: 4px;\n text-underline-offset: 8px;\n}";
|
|
19
|
-
var styles = {"relative":"BaseCell-module_relative__1v2X0","infoButtonAbsolute":"BaseCell-module_infoButtonAbsolute__Mpjrz","icon":"BaseCell-module_icon__1775U","description":"BaseCell-module_description__3_kfe","bigWithUnderline":"BaseCell-module_bigWithUnderline__2xx5X"};
|
|
18
|
+
var css_248z = ".BaseCell-module_relative__1v2X0 {\n position: relative;\n}\n\n@media (max-width: 34rem) {\n .BaseCell-module_maxWidth__14Cly {\n max-width: calc(100% - 64px);\n }\n}\n\n.BaseCell-module_infoButtonAbsolute__Mpjrz {\n position: absolute;\n right: -32px;\n}\n\n.BaseCell-module_icon__1775U {\n margin: 2px;\n}\n\n.BaseCell-module_description__3_kfe {\n word-break: break-word;\n}\n\n.BaseCell-module_bigWithUnderline__2xx5X {\n position: relative;\n display: flex;\n line-height: 38px;\n text-decoration: underline;\n text-decoration-color: #8e8cee;\n text-decoration-thickness: 4px;\n text-underline-offset: 8px;\n}";
|
|
19
|
+
var styles = {"relative":"BaseCell-module_relative__1v2X0","maxWidth":"BaseCell-module_maxWidth__14Cly","infoButtonAbsolute":"BaseCell-module_infoButtonAbsolute__Mpjrz","icon":"BaseCell-module_icon__1775U","description":"BaseCell-module_description__3_kfe","bigWithUnderline":"BaseCell-module_bigWithUnderline__2xx5X"};
|
|
20
20
|
styleInject(css_248z);
|
|
21
21
|
|
|
22
22
|
var progressLookup = {
|
|
@@ -32,7 +32,8 @@ var progressLookup = {
|
|
|
32
32
|
'100%': 5,
|
|
33
33
|
};
|
|
34
34
|
var BaseCell = function (_a) {
|
|
35
|
-
var _b
|
|
35
|
+
var _b;
|
|
36
|
+
var _c = _a.align, align = _c === void 0 ? 'center' : _c, checkmarkValue = _a.checkmarkValue, _d = _a.description, description = _d === void 0 ? '' : _d, _e = _a.fontVariant, fontVariant = _e === void 0 ? 'NORMAL' : _e, _f = _a.hideProgressBar, hideProgressBar = _f === void 0 ? false : _f, _g = _a.modalTitle, modalTitle = _g === void 0 ? '' : _g, _h = _a.modalContent, modalContent = _h === void 0 ? '' : _h, openModal = _a.openModal, rating = _a.rating, _j = _a.text, text = _j === void 0 ? '' : _j;
|
|
36
37
|
var alignClassName = {
|
|
37
38
|
center: 'ta-center jc-center ai-center',
|
|
38
39
|
left: 'ta-left jc-start',
|
|
@@ -43,9 +44,10 @@ var BaseCell = function (_a) {
|
|
|
43
44
|
var progressBarValue = !hideProgressBar && typeof text === 'string'
|
|
44
45
|
? progressLookup[text]
|
|
45
46
|
: undefined;
|
|
47
|
+
console.log(modalContent);
|
|
46
48
|
return (jsx("div", { className: classNames('d-flex gap8 ai-center', {
|
|
47
49
|
'jc-center': align === 'center',
|
|
48
|
-
}), children: jsxs("div", { className: classNames('d-flex fd-column', alignClassName, styles.relative), children: [progressBarValue !== undefined && (jsx(MiniProgressBar, { nFilledBars: progressBarValue })), (rating === null || rating === void 0 ? void 0 : rating.value) && (jsx("span", { "data-testid": "table-cell-rating", title: "".concat(rating === null || rating === void 0 ? void 0 : rating.value, " out of 3"), children: validRatingValues.map(function (value) { return (jsx(SelectedIcon, { "aria-hidden": "true", color: value <= (rating === null || rating === void 0 ? void 0 : rating.value) ? 'primary-500' : 'grey-400', className: styles.icon }, value)); }) })), jsxs("div", { className: "d-flex ai-center", children: [checkmarkValue !== undefined && (jsx("span", { title: checkmarkValue ? 'Yes' : 'No', children: checkmarkValue ? (jsx(CheckIcon, { "data-testid": "table-cell-boolean-yes", size: 24, "aria-hidden": true, color: "primary-500" })) : (jsx(XIcon, { "data-testid": "table-cell-boolean-no", size: 24, "aria-hidden": true, color: "grey-400" })) })), jsxs("div", { className: "d-inline", children: [text && fontVariant === 'NORMAL' && (jsx("div", { className: "p-p d-inline", "data-testid": "table-cell-text", children: text })), text && fontVariant === 'PRICE' && (jsx("div", { className: "p-h1 p--serif tc-primary-500", "data-testid": "table-cell-content", children: text })), text && fontVariant === 'BIG_WITH_UNDERLINE' && (jsx("h2", { "aria-hidden": true, className: classNames('tc-grey-800 p-h2 p--serif', styles.bigWithUnderline), children: text })), modalContent && openModal && align == 'left' && (jsx("span", { className: "ml8", children: jsx(TableInfoButton, { onClick: function () {
|
|
50
|
+
}), children: jsxs("div", { className: classNames('d-flex fd-column', alignClassName, styles.relative, (_b = {}, _b[styles.maxWidth] = modalContent && align === 'center', _b)), children: [progressBarValue !== undefined && (jsx(MiniProgressBar, { nFilledBars: progressBarValue })), (rating === null || rating === void 0 ? void 0 : rating.value) && (jsx("span", { "data-testid": "table-cell-rating", title: "".concat(rating === null || rating === void 0 ? void 0 : rating.value, " out of 3"), children: validRatingValues.map(function (value) { return (jsx(SelectedIcon, { "aria-hidden": "true", color: value <= (rating === null || rating === void 0 ? void 0 : rating.value) ? 'primary-500' : 'grey-400', className: styles.icon }, value)); }) })), jsxs("div", { className: "d-flex ai-center", children: [checkmarkValue !== undefined && (jsx("span", { title: checkmarkValue ? 'Yes' : 'No', children: checkmarkValue ? (jsx(CheckIcon, { "data-testid": "table-cell-boolean-yes", size: 24, "aria-hidden": true, color: "primary-500" })) : (jsx(XIcon, { "data-testid": "table-cell-boolean-no", size: 24, "aria-hidden": true, color: "grey-400" })) })), jsxs("div", { className: "d-inline", children: [text && fontVariant === 'NORMAL' && (jsx("div", { className: "p-p d-inline", "data-testid": "table-cell-text", children: text })), text && fontVariant === 'PRICE' && (jsx("div", { className: "p-h1 p--serif tc-primary-500", "data-testid": "table-cell-content", children: text })), text && fontVariant === 'BIG_WITH_UNDERLINE' && (jsx("h2", { "aria-hidden": true, className: classNames('tc-grey-800 p-h2 p--serif', styles.bigWithUnderline), children: text })), modalContent && openModal && align == 'left' && (jsx("span", { className: "ml8", children: jsx(TableInfoButton, { onClick: function () {
|
|
49
51
|
return openModal({
|
|
50
52
|
title: modalTitle,
|
|
51
53
|
body: modalContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCell.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n CheckIcon,\n
|
|
1
|
+
{"version":3,"file":"BaseCell.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n CheckIcon,\n StarFilledIcon,\n XIcon,\n ZapFilledIcon,\n} from '../../../../icon';\nimport { ReactNode } from 'react';\nimport styles from './BaseCell.module.scss';\nimport { MiniProgressBar } from './MiniProgressBar/MiniProgressBar';\nimport { TableInfoButton } from '../../../../comparisonTable';\nimport { ModalFunction } from '../../../types';\n\nexport type FontVariant = 'NORMAL' | 'BIG_WITH_UNDERLINE' | 'PRICE';\n\nconst progressLookup: Record<string, number> = {\n '30%': 1,\n '50%': 2,\n '70%': 3,\n '75%': 4,\n '80%': 4,\n '90%': 4,\n '75%-90%': 4,\n '75%-100%': 4,\n '80%-100%': 4,\n '100%': 5,\n};\n\nexport type Alignment = 'center' | 'left' | 'right';\n\nexport type BaseCellProps = {\n align?: Alignment;\n checkmarkValue?: boolean;\n description?: ReactNode;\n fontVariant?: FontVariant;\n hideProgressBar?: boolean;\n modalTitle?: ReactNode;\n modalContent?: ReactNode;\n openModal?: ModalFunction;\n text?: ReactNode;\n rating?: {\n value: number;\n type: 'zap' | 'star';\n };\n};\n\nexport const BaseCell = ({\n align = 'center',\n checkmarkValue,\n description = '',\n fontVariant = 'NORMAL',\n hideProgressBar = false,\n modalTitle = '',\n modalContent = '',\n openModal,\n rating,\n text = '',\n}: BaseCellProps) => {\n const alignClassName = {\n center: 'ta-center jc-center ai-center',\n left: 'ta-left jc-start',\n right: 'ta-right jc-end ai-end',\n }[align];\n\n const validRatingValues: number[] = [1, 2, 3];\n const SelectedIcon = rating?.type === 'zap' ? ZapFilledIcon : StarFilledIcon;\n\n const progressBarValue =\n !hideProgressBar && typeof text === 'string'\n ? progressLookup[text]\n : undefined;\n\n console.log(modalContent);\n\n return (\n <div\n className={classNames('d-flex gap8 ai-center', {\n 'jc-center': align === 'center',\n })}\n >\n <div\n className={classNames(\n 'd-flex fd-column',\n alignClassName,\n styles.relative,\n { [styles.maxWidth]: modalContent && align === 'center' }\n )}\n >\n {progressBarValue !== undefined && (\n <MiniProgressBar nFilledBars={progressBarValue} />\n )}\n\n {rating?.value && (\n <span\n data-testid=\"table-cell-rating\"\n title={`${rating?.value} out of 3`}\n >\n {validRatingValues.map((value) => (\n <SelectedIcon\n aria-hidden=\"true\"\n key={value}\n color={value <= rating?.value ? 'primary-500' : 'grey-400'}\n className={styles.icon}\n />\n ))}\n </span>\n )}\n\n <div className=\"d-flex ai-center\">\n {checkmarkValue !== undefined && (\n <span title={checkmarkValue ? 'Yes' : 'No'}>\n {checkmarkValue ? (\n <CheckIcon\n data-testid=\"table-cell-boolean-yes\"\n size={24}\n aria-hidden\n color=\"primary-500\"\n />\n ) : (\n <XIcon\n data-testid=\"table-cell-boolean-no\"\n size={24}\n aria-hidden\n color=\"grey-400\"\n />\n )}\n </span>\n )}\n\n <div className=\"d-inline\">\n {text && fontVariant === 'NORMAL' && (\n <div className=\"p-p d-inline\" data-testid=\"table-cell-text\">\n {text}\n </div>\n )}\n\n {text && fontVariant === 'PRICE' && (\n <div\n className=\"p-h1 p--serif tc-primary-500\"\n data-testid=\"table-cell-content\"\n >\n {text}\n </div>\n )}\n\n {text && fontVariant === 'BIG_WITH_UNDERLINE' && (\n <h2\n aria-hidden\n className={classNames(\n 'tc-grey-800 p-h2 p--serif',\n styles.bigWithUnderline\n )}\n >\n {text}\n </h2>\n )}\n\n {modalContent && openModal && align == 'left' && (\n <span className=\"ml8\">\n <TableInfoButton\n onClick={() =>\n openModal({\n title: modalTitle,\n body: modalContent,\n })\n }\n />\n </span>\n )}\n </div>\n </div>\n\n {description && (\n <div\n className={classNames(\n styles.description,\n 'd-flex p-p--small tc-grey-500',\n alignClassName\n )}\n >\n {description}\n </div>\n )}\n\n {modalContent && openModal && align == 'center' && (\n <span className={styles.infoButtonAbsolute}>\n <TableInfoButton\n onClick={() =>\n openModal({\n title: modalTitle,\n body: modalContent,\n })\n }\n />\n </span>\n )}\n </div>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,IAAM,cAAc,GAA2B;IAC7C,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC;CACV,CAAC;IAoBW,QAAQ,GAAG,UAAC,EAWT;;QAVd,aAAgB,EAAhB,KAAK,mBAAG,QAAQ,KAAA,EAChB,cAAc,oBAAA,EACd,mBAAgB,EAAhB,WAAW,mBAAG,EAAE,KAAA,EAChB,mBAAsB,EAAtB,WAAW,mBAAG,QAAQ,KAAA,EACtB,uBAAuB,EAAvB,eAAe,mBAAG,KAAK,KAAA,EACvB,kBAAe,EAAf,UAAU,mBA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,IAAI,SAAS,IAAI,KAAK,IAAI,QAAQ,KAC7CA,cAAM,SAAS,EAAE,MAAM,CAAC,kBAAkB,YACxCA,IAAC,eAAe,IACd,OAAO,EAAE;4BACP,OAAA,SAAS,CAAC;gCACR,KAAK,EAAE,UAAU;gCACjB,IAAI,EAAE,YAAY;6BACnB,CAAC;yBAAA,GAEJ,GACG,CACR,IACG,GACF,EACN;AACJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as __assign, _ as __spreadArray } from '../../../../tslib.es6-a39f91fc.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { T as TableSection } from '../../../../TableSection-
|
|
4
|
+
import { T as TableSection } from '../../../../TableSection-24502d3f.js';
|
|
5
5
|
import ChevronDownIcon from '../../../icon/icons/ChevronDown.js';
|
|
6
6
|
import ChevronUpIcon from '../../../icon/icons/ChevronUp.js';
|
|
7
7
|
import { Card } from '../../../cards/card/index.js';
|
|
@@ -6,7 +6,7 @@ import 'react';
|
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import '../../../../_commonjsHelpers-4730bd53.js';
|
|
8
8
|
import 'react-dom/test-utils';
|
|
9
|
-
import '../../../../TableSection-
|
|
9
|
+
import '../../../../TableSection-24502d3f.js';
|
|
10
10
|
import '../../../../index-6ea95111.js';
|
|
11
11
|
import '../../../../style-inject.es-1f59c1d0.js';
|
|
12
12
|
import '../TableCell/TableCell.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../../../../tslib.es6-a39f91fc.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import '../../../../index-6ea95111.js';
|
|
4
|
-
export { T as TableSection } from '../../../../TableSection-
|
|
4
|
+
export { T as TableSection } from '../../../../TableSection-24502d3f.js';
|
|
5
5
|
import '../TableCell/TableCell.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../../../style-inject.es-1f59c1d0.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as __assign } from '../../../../tslib.es6-a39f91fc.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { c as customRender, s as screen } from '../../../../customRender-d03c10b6.js';
|
|
4
|
-
import { T as TableSection } from '../../../../TableSection-
|
|
4
|
+
import { T as TableSection } from '../../../../TableSection-24502d3f.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import '../../../../_commonjsHelpers-4730bd53.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -445,7 +445,7 @@ import './components/table/components/TableCell/CTACell/CTACell.js';
|
|
|
445
445
|
import './components/table/components/IconRenderer/IconRenderer.js';
|
|
446
446
|
import './components/table/components/TableCell/CardCell/CardCell.js';
|
|
447
447
|
import './components/table/components/TableCell/ButtonCell/ButtonCell.js';
|
|
448
|
-
import './TableSection-
|
|
448
|
+
import './TableSection-24502d3f.js';
|
|
449
449
|
import './components/table/components/TableContents/TableContents.js';
|
|
450
450
|
import './components/table/components/TableContents/Collapsible.js';
|
|
451
451
|
import './useTableNavigation-f929fbc9.js';
|
package/package.json
CHANGED
|
@@ -122,7 +122,10 @@ const initialData: TableData = [
|
|
|
122
122
|
],
|
|
123
123
|
[
|
|
124
124
|
{ text: 'Operations', modalContent: 'info' },
|
|
125
|
-
{
|
|
125
|
+
{
|
|
126
|
+
text: 'This is a table cell with a lot of text',
|
|
127
|
+
modalContent: 'Maybe',
|
|
128
|
+
},
|
|
126
129
|
{ checkmarkValue: false },
|
|
127
130
|
{ checkmarkValue: true },
|
|
128
131
|
],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import {
|
|
3
3
|
CheckIcon,
|
|
4
|
-
XIcon,
|
|
5
4
|
StarFilledIcon,
|
|
5
|
+
XIcon,
|
|
6
6
|
ZapFilledIcon,
|
|
7
7
|
} from '../../../../icon';
|
|
8
8
|
import { ReactNode } from 'react';
|
|
@@ -70,6 +70,8 @@ export const BaseCell = ({
|
|
|
70
70
|
? progressLookup[text]
|
|
71
71
|
: undefined;
|
|
72
72
|
|
|
73
|
+
console.log(modalContent);
|
|
74
|
+
|
|
73
75
|
return (
|
|
74
76
|
<div
|
|
75
77
|
className={classNames('d-flex gap8 ai-center', {
|
|
@@ -80,7 +82,8 @@ export const BaseCell = ({
|
|
|
80
82
|
className={classNames(
|
|
81
83
|
'd-flex fd-column',
|
|
82
84
|
alignClassName,
|
|
83
|
-
styles.relative
|
|
85
|
+
styles.relative,
|
|
86
|
+
{ [styles.maxWidth]: modalContent && align === 'center' }
|
|
84
87
|
)}
|
|
85
88
|
>
|
|
86
89
|
{progressBarValue !== undefined && (
|