@economic/taco 2.55.0-settings.0 → 2.55.0-settings.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Checkbox/Checkbox.d.ts +2 -7
- package/dist/components/List/List.d.ts +2 -2
- package/dist/components/List/components/Toggle.d.ts +2 -2
- package/dist/components/ModeSwitch/ModeSwitch.d.ts +3 -6
- package/dist/components/Switch/Switch.d.ts +4 -6
- package/dist/esm/index.css +5 -76
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +63 -41
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/List/components/Toggle.js +4 -14
- package/dist/esm/packages/taco/src/components/List/components/Toggle.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +3 -6
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +12 -34
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Switch/Switch.js +35 -37
- package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js +4 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
- package/dist/index.css +5 -76
- package/dist/taco.cjs.development.js +123 -135
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +3 -3
@@ -191,7 +191,6 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
|
|
191
191
|
"data-cell-align": isGroup ? 'center' : align,
|
192
192
|
"data-cell-id": id,
|
193
193
|
"data-cell-pinned": isPinned ? isPinned : undefined,
|
194
|
-
"data-taco": isGroup ? 'grouped-column-header' : 'column-header',
|
195
194
|
style: style,
|
196
195
|
ref: setRef
|
197
196
|
}), !isPlaceholder ? (/*#__PURE__*/React__default.createElement(HeaderContent, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Header.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport {\n TableMeta as ReactTableMeta,\n ColumnMeta as ReactTableColumnMeta,\n Header as ReactTableHeader,\n ColumnPinningPosition as ReactTableColumnPinningPosition,\n flexRender,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { freezeUptoExternalColumn, isInternalColumn, unfreezeAllExternalColumns } from '../../../useTableManager/util/columns';\nimport { Tooltip } from '../../../../../components/Tooltip/Tooltip';\nimport { SortIndicator, getSortAttributes } from './components/SortIndicator';\nimport {\n TableColumnAlignment,\n TableColumnMenu,\n TableColumnSortDirection,\n TableColumnWidth,\n TableFilterComparator,\n} from '../../../types';\nimport { Resizer } from './components/Resizer';\nimport { HeaderMenu } from './components/Menu';\nimport { getIsPinned, useSetInitialColumnSizing } from './util';\n\ninterface HeaderContentProps {\n children: React.ReactNode;\n tooltip?: React.ReactNode;\n isInternalColumnHeader: boolean;\n}\n\nconst HeaderContent = ({ children, tooltip, isInternalColumnHeader }: HeaderContentProps) => {\n if (isInternalColumnHeader || typeof children !== 'string') {\n return <>{children}</>;\n }\n\n return (\n <Tooltip title={String(tooltip ?? children)} placement=\"top\">\n <span className=\"truncate\">{children}</span>\n </Tooltip>\n );\n};\n\nexport type HeaderProps<TType = unknown> = {\n header: ReactTableHeader<TType, unknown>;\n scrollToIndex: (index: number) => void;\n};\n\nexport function Header<TType = unknown>(props: HeaderProps<TType>) {\n const { header, scrollToIndex } = props;\n\n if (header.column.getIsGrouped()) {\n return null;\n }\n\n const { table } = header.getContext();\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const columnMeta = (header.column.columnDef.meta ?? {}) as ReactTableColumnMeta<TType, unknown>;\n\n const isGroup = !!header.subHeaders.length;\n const isPinned = getIsPinned(header);\n\n const canFilter = !header.isPlaceholder && header.column.getCanFilter() && !!table.options.enableColumnFilters;\n const canHide = !header.isPlaceholder && !isGroup && header.column.getCanHide();\n const canMeasureSize = !!table.getRowModel().rows.length;\n const canPin = !header.isPlaceholder && !isGroup && header.column.getCanPin();\n const canResize = !header.isPlaceholder && !isGroup && header.column.getCanResize();\n const canSort = !header.isPlaceholder && !isGroup && header.column.getCanSort();\n const canGoto = canSort && !header.isPlaceholder && !isGroup && tableMeta.rowGoto.isEnabled && !!header.column.getIsSorted();\n\n const hasMenu = !isInternalColumn(header.id) && (canHide || canGoto || canPin || canSort || !!columnMeta.menu);\n\n const sorting = table.getState().sorting;\n const filters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n // passing header or column results in re-renders on scroll, so anything from those objects as memoed props\n const memoedProps: MemoedHeaderProps = {\n align: columnMeta.align,\n canFilter,\n canHide,\n canGoto,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n className: cn('group/header', columnMeta.headerClassName),\n children: flexRender(header.column.columnDef.header, header.getContext()),\n colSpan: header.colSpan,\n customMenu: columnMeta.menu,\n defaultWidth: columnMeta.defaultWidth,\n hasMenu,\n id: header.id,\n isFiltered: header.column.getIsFiltered(),\n index: header.index,\n isGroup,\n isPinned,\n isPlaceholder: header.isPlaceholder,\n offset: header.column.getStart(isPinned),\n scrollToIndex,\n setRowActiveIndex: tableMeta.rowActive.setRowActiveIndex,\n setColumnSizing: table.setColumnSizing,\n tooltip: columnMeta.tooltip,\n width: table.getState().columnSizing[header.id],\n };\n\n if (header.isPlaceholder) {\n const nextHeader = header.headerGroup.headers[header.index + 1];\n memoedProps.className = cn('!bg-white before:!content-none', memoedProps.className, {\n 'after:!content-none': nextHeader?.isPlaceholder,\n });\n }\n\n if (canFilter) {\n memoedProps.onFilter = () => {\n header.column.setFilterValue({ comparator: TableFilterComparator.Contains });\n };\n }\n\n if (canGoto) {\n memoedProps.onGoto = ((query: string) => tableMeta.rowGoto.handleGoto?.(header.id, query, sorting, filters, search)) as (\n query: string\n ) => Promise<number>;\n }\n\n if (canHide) {\n memoedProps.onHide = header.column.getToggleVisibilityHandler();\n }\n\n if (canPin) {\n memoedProps.onPin = (index: number | undefined) => {\n // TODO: this can probably be moved to a feature hook\n table.setColumnPinning(pinningState => {\n return {\n ...pinningState,\n left:\n index === undefined\n ? unfreezeAllExternalColumns(pinningState.left)\n : freezeUptoExternalColumn(\n index,\n table.getAllLeafColumns().map(column => column.id)\n ),\n };\n });\n };\n }\n\n if (canResize) {\n memoedProps.isResizing = header.column.getIsResizing();\n memoedProps.onResize = header.getResizeHandler();\n memoedProps.resetSize = header.column.resetSize;\n }\n\n if (canSort) {\n const handleSortToggle = (sortDirection: TableColumnSortDirection | false) => {\n if (sortDirection === false) {\n header.column.clearSorting();\n } else {\n header.column.toggleSorting(sortDirection === 'desc');\n }\n };\n\n memoedProps.onSort = header.column.getToggleSortingHandler();\n memoedProps.onSortToggle = handleSortToggle;\n memoedProps.sortDirection = header.column.getIsSorted();\n }\n\n return <MemoedHeader key={header.id} {...memoedProps} />;\n}\n\nexport type MemoedHeaderProps = {\n align?: TableColumnAlignment;\n canFilter: boolean;\n canHide: boolean;\n canGoto: boolean;\n canMeasureSize: boolean;\n canPin: boolean;\n canResize: boolean;\n canSort: boolean;\n children: JSX.Element | React.ReactNode;\n className?: string;\n colSpan: number;\n customMenu?: TableColumnMenu;\n defaultWidth?: TableColumnWidth;\n hasMenu: boolean;\n id: string;\n index: number;\n isFiltered: boolean;\n isGroup: boolean;\n isPinned?: ReactTableColumnPinningPosition;\n isPlaceholder: boolean;\n isResizing?: boolean;\n offset?: number;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onResize?: (event: unknown) => void;\n onSort?: (event: unknown) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n resetSize?: () => void;\n scrollToIndex: (index: number) => void;\n setRowActiveIndex: (index: number) => void;\n setColumnSizing: any;\n sortDirection?: TableColumnSortDirection | false;\n tooltip?: string;\n width?: TableColumnWidth;\n};\n\nconst MemoedHeader = React.memo(function MemoedHeader(props: MemoedHeaderProps) {\n const {\n align,\n canFilter,\n canGoto,\n canHide,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n children,\n className,\n colSpan,\n customMenu,\n defaultWidth,\n hasMenu,\n id,\n index,\n isFiltered,\n isGroup,\n isPinned,\n isPlaceholder,\n isResizing,\n offset,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onResize: handleResize,\n onSort: handleSort,\n onSortToggle: handleSortToggle,\n resetSize: handleResetSize,\n scrollToIndex,\n setRowActiveIndex,\n setColumnSizing,\n sortDirection,\n tooltip,\n width,\n } = props;\n const [ref, setRef] = React.useState<HTMLTableCellElement | null>(null);\n\n // save column width if none is set\n useSetInitialColumnSizing(id, defaultWidth, width, ref, canMeasureSize, setColumnSizing);\n\n // feature specific styles\n const style: React.CSSProperties = {};\n\n // column groups often span multiple columns\n if (colSpan > 1) {\n style.gridColumn = `span ${colSpan}`;\n }\n\n // pinned columns should be offset from either the left or right\n if (isPinned) {\n style[isPinned] = `${offset}px`;\n }\n\n return (\n <th\n {...getSortAttributes(canSort, handleSort, sortDirection)}\n className={className}\n data-cell-align={isGroup ? 'center' : align}\n data-cell-id={id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n data-taco={isGroup ? 'grouped-column-header' : 'column-header'}\n style={style}\n ref={setRef}>\n {!isPlaceholder ? (\n <HeaderContent children={children} tooltip={tooltip} isInternalColumnHeader={!!isInternalColumn(id)} />\n ) : null}\n {sortDirection ? <SortIndicator direction={sortDirection} /> : null}\n {hasMenu ? (\n <HeaderMenu\n canFilter={canFilter}\n canGoto={canGoto}\n canHide={canHide}\n canPin={canPin}\n canSort={canSort}\n className={cn({\n 'ml-auto': align !== 'right',\n 'ml-0': align === 'right',\n })}\n customMenu={customMenu}\n index={index}\n isFiltered={isFiltered}\n onFilter={handleFilter}\n onGoto={handleGoto}\n onHide={handleHide}\n onPin={handlePin}\n onSortToggle={handleSortToggle}\n scrollToIndex={scrollToIndex}\n setRowActiveIndex={setRowActiveIndex}\n sortDirection={sortDirection}\n columnId={id}\n />\n ) : null}\n {canResize ? (\n <Resizer\n headerRef={ref}\n id={id}\n isResizing={isResizing as boolean}\n onResize={handleResize as (event: unknown) => void}\n onResetSize={handleResetSize as () => void}\n setColumnSizing={setColumnSizing}\n width={width}\n />\n ) : null}\n </th>\n );\n});\n"],"names":["HeaderContent","children","tooltip","isInternalColumnHeader","React","Tooltip","title","String","placement","className","Header","props","header","scrollToIndex","column","getIsGrouped","table","getContext","tableMeta","options","meta","columnMeta","_header$column$column","columnDef","isGroup","subHeaders","length","isPinned","getIsPinned","canFilter","isPlaceholder","getCanFilter","enableColumnFilters","canHide","getCanHide","canMeasureSize","getRowModel","rows","canPin","getCanPin","canResize","getCanResize","canSort","getCanSort","canGoto","rowGoto","isEnabled","getIsSorted","hasMenu","isInternalColumn","id","menu","sorting","getState","filters","columnFilters","search","globalFilter","memoedProps","align","cn","headerClassName","flexRender","colSpan","customMenu","defaultWidth","isFiltered","getIsFiltered","index","offset","getStart","setRowActiveIndex","rowActive","setColumnSizing","width","columnSizing","nextHeader","headerGroup","headers","onFilter","setFilterValue","comparator","TableFilterComparator","Contains","onGoto","query","_tableMeta$rowGoto$ha","_tableMeta$rowGoto","handleGoto","call","onHide","getToggleVisibilityHandler","onPin","setColumnPinning","pinningState","left","undefined","unfreezeAllExternalColumns","freezeUptoExternalColumn","getAllLeafColumns","map","isResizing","getIsResizing","onResize","getResizeHandler","resetSize","handleSortToggle","sortDirection","clearSorting","toggleSorting","onSort","getToggleSortingHandler","onSortToggle","MemoedHeader","key","memo","handleFilter","handleHide","handlePin","handleResize","handleSort","handleResetSize","ref","setRef","useState","useSetInitialColumnSizing","style","gridColumn","getSortAttributes","SortIndicator","direction","HeaderMenu","columnId","Resizer","headerRef","onResetSize"],"mappings":";;;;;;;;;;;AA6BA,MAAMA,aAAa,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;EAAEC;CAA4C;EACpF,IAAIA,sBAAsB,IAAI,OAAOF,QAAQ,KAAK,QAAQ,EAAE;IACxD,oBAAOG,4DAAGH,QAAQ,CAAI;;EAG1B,oBACIG,6BAACC,OAAO;IAACC,KAAK,EAAEC,MAAM,CAACL,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAID,QAAQ,CAAC;IAAEO,SAAS,EAAC;kBACnDJ;IAAMK,SAAS,EAAC;KAAYR,QAAQ,CAAQ,CACtC;AAElB,CAAC;SAOeS,MAAMA,CAAkBC,KAAyB;;EAC7D,MAAM;IAAEC,MAAM;IAAEC;GAAe,GAAGF,KAAK;EAEvC,IAAIC,MAAM,CAACE,MAAM,CAACC,YAAY,EAAE,EAAE;IAC9B,OAAO,IAAI;;EAGf,MAAM;IAAEC;GAAO,GAAGJ,MAAM,CAACK,UAAU,EAAE;EAErC,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,UAAU,IAAAC,qBAAA,GAAIV,MAAM,CAACE,MAAM,CAACS,SAAS,CAACH,IAAI,cAAAE,qBAAA,cAAAA,qBAAA,GAAI,EAA2C;EAE/F,MAAME,OAAO,GAAG,CAAC,CAACZ,MAAM,CAACa,UAAU,CAACC,MAAM;EAC1C,MAAMC,QAAQ,GAAGC,WAAW,CAAChB,MAAM,CAAC;EAEpC,MAAMiB,SAAS,GAAG,CAACjB,MAAM,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S,EAAEmD,EAAE,CAAC;MACV,SAAS,EAAED,KAAK,KAAK,OAAO;MAC5B,MAAM,EAAEA,KAAK,KAAK;KACrB,CAAC;IACFK,UAAU,EAAEA,UAAU;IACtBI,KAAK,EAAEA,KAAK;IACZF,UAAU,EAAEA,UAAU;IACtBa,QAAQ,EAAEqC,YAAY;IACtBhC,MAAM,EAAEI,UAAU;IAClBE,MAAM,EAAE2B,UAAU;IAClBzB,KAAK,EAAE0B,SAAS;IAChBN,YAAY,EAAEN,gBAAgB;IAC9B7F,aAAa,EAAEA,aAAa;IAC5B0D,iBAAiB,EAAEA,iBAAiB;IACpCoC,aAAa,EAAEA,aAAa;IAC5ByB,QAAQ,EAAElF;IACZ,IACF,IAAI,EACPV,SAAS,iBACNpC,6BAACiI,OAAO;IACJC,SAAS,EAAEZ,GAAG;IACdxE,EAAE,EAAEA,EAAE;IACNmD,UAAU,EAAEA,UAAqB;IACjCE,QAAQ,EAAEgB,YAAwC;IAClDgB,WAAW,EAAEd,eAA6B;IAC1ChD,eAAe,EAAEA,eAAe;IAChCC,KAAK,EAAEA;IACT,IACF,IAAI,CACP;AAEb,CAAC,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"Header.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport {\n TableMeta as ReactTableMeta,\n ColumnMeta as ReactTableColumnMeta,\n Header as ReactTableHeader,\n ColumnPinningPosition as ReactTableColumnPinningPosition,\n flexRender,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { freezeUptoExternalColumn, isInternalColumn, unfreezeAllExternalColumns } from '../../../useTableManager/util/columns';\nimport { Tooltip } from '../../../../../components/Tooltip/Tooltip';\nimport { SortIndicator, getSortAttributes } from './components/SortIndicator';\nimport {\n TableColumnAlignment,\n TableColumnMenu,\n TableColumnSortDirection,\n TableColumnWidth,\n TableFilterComparator,\n} from '../../../types';\nimport { Resizer } from './components/Resizer';\nimport { HeaderMenu } from './components/Menu';\nimport { getIsPinned, useSetInitialColumnSizing } from './util';\n\ninterface HeaderContentProps {\n children: React.ReactNode;\n tooltip?: React.ReactNode;\n isInternalColumnHeader: boolean;\n}\n\nconst HeaderContent = ({ children, tooltip, isInternalColumnHeader }: HeaderContentProps) => {\n if (isInternalColumnHeader || typeof children !== 'string') {\n return <>{children}</>;\n }\n\n return (\n <Tooltip title={String(tooltip ?? children)} placement=\"top\">\n <span className=\"truncate\">{children}</span>\n </Tooltip>\n );\n};\n\nexport type HeaderProps<TType = unknown> = {\n header: ReactTableHeader<TType, unknown>;\n scrollToIndex: (index: number) => void;\n};\n\nexport function Header<TType = unknown>(props: HeaderProps<TType>) {\n const { header, scrollToIndex } = props;\n\n if (header.column.getIsGrouped()) {\n return null;\n }\n\n const { table } = header.getContext();\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const columnMeta = (header.column.columnDef.meta ?? {}) as ReactTableColumnMeta<TType, unknown>;\n\n const isGroup = !!header.subHeaders.length;\n const isPinned = getIsPinned(header);\n\n const canFilter = !header.isPlaceholder && header.column.getCanFilter() && !!table.options.enableColumnFilters;\n const canHide = !header.isPlaceholder && !isGroup && header.column.getCanHide();\n const canMeasureSize = !!table.getRowModel().rows.length;\n const canPin = !header.isPlaceholder && !isGroup && header.column.getCanPin();\n const canResize = !header.isPlaceholder && !isGroup && header.column.getCanResize();\n const canSort = !header.isPlaceholder && !isGroup && header.column.getCanSort();\n const canGoto = canSort && !header.isPlaceholder && !isGroup && tableMeta.rowGoto.isEnabled && !!header.column.getIsSorted();\n\n const hasMenu = !isInternalColumn(header.id) && (canHide || canGoto || canPin || canSort || !!columnMeta.menu);\n\n const sorting = table.getState().sorting;\n const filters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n // passing header or column results in re-renders on scroll, so anything from those objects as memoed props\n const memoedProps: MemoedHeaderProps = {\n align: columnMeta.align,\n canFilter,\n canHide,\n canGoto,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n className: cn('group/header', columnMeta.headerClassName),\n children: flexRender(header.column.columnDef.header, header.getContext()),\n colSpan: header.colSpan,\n customMenu: columnMeta.menu,\n defaultWidth: columnMeta.defaultWidth,\n hasMenu,\n id: header.id,\n isFiltered: header.column.getIsFiltered(),\n index: header.index,\n isGroup,\n isPinned,\n isPlaceholder: header.isPlaceholder,\n offset: header.column.getStart(isPinned),\n scrollToIndex,\n setRowActiveIndex: tableMeta.rowActive.setRowActiveIndex,\n setColumnSizing: table.setColumnSizing,\n tooltip: columnMeta.tooltip,\n width: table.getState().columnSizing[header.id],\n };\n\n if (header.isPlaceholder) {\n const nextHeader = header.headerGroup.headers[header.index + 1];\n memoedProps.className = cn('!bg-white before:!content-none', memoedProps.className, {\n 'after:!content-none': nextHeader?.isPlaceholder,\n });\n }\n\n if (canFilter) {\n memoedProps.onFilter = () => {\n header.column.setFilterValue({ comparator: TableFilterComparator.Contains });\n };\n }\n\n if (canGoto) {\n memoedProps.onGoto = ((query: string) => tableMeta.rowGoto.handleGoto?.(header.id, query, sorting, filters, search)) as (\n query: string\n ) => Promise<number>;\n }\n\n if (canHide) {\n memoedProps.onHide = header.column.getToggleVisibilityHandler();\n }\n\n if (canPin) {\n memoedProps.onPin = (index: number | undefined) => {\n // TODO: this can probably be moved to a feature hook\n table.setColumnPinning(pinningState => {\n return {\n ...pinningState,\n left:\n index === undefined\n ? unfreezeAllExternalColumns(pinningState.left)\n : freezeUptoExternalColumn(\n index,\n table.getAllLeafColumns().map(column => column.id)\n ),\n };\n });\n };\n }\n\n if (canResize) {\n memoedProps.isResizing = header.column.getIsResizing();\n memoedProps.onResize = header.getResizeHandler();\n memoedProps.resetSize = header.column.resetSize;\n }\n\n if (canSort) {\n const handleSortToggle = (sortDirection: TableColumnSortDirection | false) => {\n if (sortDirection === false) {\n header.column.clearSorting();\n } else {\n header.column.toggleSorting(sortDirection === 'desc');\n }\n };\n\n memoedProps.onSort = header.column.getToggleSortingHandler();\n memoedProps.onSortToggle = handleSortToggle;\n memoedProps.sortDirection = header.column.getIsSorted();\n }\n\n return <MemoedHeader key={header.id} {...memoedProps} />;\n}\n\nexport type MemoedHeaderProps = {\n align?: TableColumnAlignment;\n canFilter: boolean;\n canHide: boolean;\n canGoto: boolean;\n canMeasureSize: boolean;\n canPin: boolean;\n canResize: boolean;\n canSort: boolean;\n children: JSX.Element | React.ReactNode;\n className?: string;\n colSpan: number;\n customMenu?: TableColumnMenu;\n defaultWidth?: TableColumnWidth;\n hasMenu: boolean;\n id: string;\n index: number;\n isFiltered: boolean;\n isGroup: boolean;\n isPinned?: ReactTableColumnPinningPosition;\n isPlaceholder: boolean;\n isResizing?: boolean;\n offset?: number;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onResize?: (event: unknown) => void;\n onSort?: (event: unknown) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n resetSize?: () => void;\n scrollToIndex: (index: number) => void;\n setRowActiveIndex: (index: number) => void;\n setColumnSizing: any;\n sortDirection?: TableColumnSortDirection | false;\n tooltip?: string;\n width?: TableColumnWidth;\n};\n\nconst MemoedHeader = React.memo(function MemoedHeader(props: MemoedHeaderProps) {\n const {\n align,\n canFilter,\n canGoto,\n canHide,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n children,\n className,\n colSpan,\n customMenu,\n defaultWidth,\n hasMenu,\n id,\n index,\n isFiltered,\n isGroup,\n isPinned,\n isPlaceholder,\n isResizing,\n offset,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onResize: handleResize,\n onSort: handleSort,\n onSortToggle: handleSortToggle,\n resetSize: handleResetSize,\n scrollToIndex,\n setRowActiveIndex,\n setColumnSizing,\n sortDirection,\n tooltip,\n width,\n } = props;\n const [ref, setRef] = React.useState<HTMLTableCellElement | null>(null);\n\n // save column width if none is set\n useSetInitialColumnSizing(id, defaultWidth, width, ref, canMeasureSize, setColumnSizing);\n\n // feature specific styles\n const style: React.CSSProperties = {};\n\n // column groups often span multiple columns\n if (colSpan > 1) {\n style.gridColumn = `span ${colSpan}`;\n }\n\n // pinned columns should be offset from either the left or right\n if (isPinned) {\n style[isPinned] = `${offset}px`;\n }\n\n return (\n <th\n {...getSortAttributes(canSort, handleSort, sortDirection)}\n className={className}\n data-cell-align={isGroup ? 'center' : align}\n data-cell-id={id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n style={style}\n ref={setRef}>\n {!isPlaceholder ? (\n <HeaderContent children={children} tooltip={tooltip} isInternalColumnHeader={!!isInternalColumn(id)} />\n ) : null}\n {sortDirection ? <SortIndicator direction={sortDirection} /> : null}\n {hasMenu ? (\n <HeaderMenu\n canFilter={canFilter}\n canGoto={canGoto}\n canHide={canHide}\n canPin={canPin}\n canSort={canSort}\n className={cn({\n 'ml-auto': align !== 'right',\n 'ml-0': align === 'right',\n })}\n customMenu={customMenu}\n index={index}\n isFiltered={isFiltered}\n onFilter={handleFilter}\n onGoto={handleGoto}\n onHide={handleHide}\n onPin={handlePin}\n onSortToggle={handleSortToggle}\n scrollToIndex={scrollToIndex}\n setRowActiveIndex={setRowActiveIndex}\n sortDirection={sortDirection}\n columnId={id}\n />\n ) : null}\n {canResize ? (\n <Resizer\n headerRef={ref}\n id={id}\n isResizing={isResizing as boolean}\n onResize={handleResize as (event: unknown) => void}\n onResetSize={handleResetSize as () => void}\n setColumnSizing={setColumnSizing}\n width={width}\n />\n ) : null}\n </th>\n );\n});\n"],"names":["HeaderContent","children","tooltip","isInternalColumnHeader","React","Tooltip","title","String","placement","className","Header","props","header","scrollToIndex","column","getIsGrouped","table","getContext","tableMeta","options","meta","columnMeta","_header$column$column","columnDef","isGroup","subHeaders","length","isPinned","getIsPinned","canFilter","isPlaceholder","getCanFilter","enableColumnFilters","canHide","getCanHide","canMeasureSize","getRowModel","rows","canPin","getCanPin","canResize","getCanResize","canSort","getCanSort","canGoto","rowGoto","isEnabled","getIsSorted","hasMenu","isInternalColumn","id","menu","sorting","getState","filters","columnFilters","search","globalFilter","memoedProps","align","cn","headerClassName","flexRender","colSpan","customMenu","defaultWidth","isFiltered","getIsFiltered","index","offset","getStart","setRowActiveIndex","rowActive","setColumnSizing","width","columnSizing","nextHeader","headerGroup","headers","onFilter","setFilterValue","comparator","TableFilterComparator","Contains","onGoto","query","_tableMeta$rowGoto$ha","_tableMeta$rowGoto","handleGoto","call","onHide","getToggleVisibilityHandler","onPin","setColumnPinning","pinningState","left","undefined","unfreezeAllExternalColumns","freezeUptoExternalColumn","getAllLeafColumns","map","isResizing","getIsResizing","onResize","getResizeHandler","resetSize","handleSortToggle","sortDirection","clearSorting","toggleSorting","onSort","getToggleSortingHandler","onSortToggle","MemoedHeader","key","memo","handleFilter","handleHide","handlePin","handleResize","handleSort","handleResetSize","ref","setRef","useState","useSetInitialColumnSizing","style","gridColumn","getSortAttributes","SortIndicator","direction","HeaderMenu","columnId","Resizer","headerRef","onResetSize"],"mappings":";;;;;;;;;;;AA6BA,MAAMA,aAAa,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;EAAEC;CAA4C;EACpF,IAAIA,sBAAsB,IAAI,OAAOF,QAAQ,KAAK,QAAQ,EAAE;IACxD,oBAAOG,4DAAGH,QAAQ,CAAI;;EAG1B,oBACIG,6BAACC,OAAO;IAACC,KAAK,EAAEC,MAAM,CAACL,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAID,QAAQ,CAAC;IAAEO,SAAS,EAAC;kBACnDJ;IAAMK,SAAS,EAAC;KAAYR,QAAQ,CAAQ,CACtC;AAElB,CAAC;SAOeS,MAAMA,CAAkBC,KAAyB;;EAC7D,MAAM;IAAEC,MAAM;IAAEC;GAAe,GAAGF,KAAK;EAEvC,IAAIC,MAAM,CAACE,MAAM,CAACC,YAAY,EAAE,EAAE;IAC9B,OAAO,IAAI;;EAGf,MAAM;IAAEC;GAAO,GAAGJ,MAAM,CAACK,UAAU,EAAE;EAErC,MAAMC,SAAS,G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AAE;IAAK,IACvG,IAAI,EACPyD,aAAa,gBAAGvG,6BAAC6H,aAAa;IAACC,SAAS,EAAEvB;IAAiB,GAAG,IAAI,EAClE3D,OAAO,iBACJ5C,6BAAC+H,UAAU;IACPtG,SAAS,EAAEA,SAAS;IACpBe,OAAO,EAAEA,OAAO;IAChBX,OAAO,EAAEA,OAAO;IAChBK,MAAM,EAAEA,MAAM;IACdI,OAAO,EAAEA,OAAO;IAChBjC,SAAS,EAAEmD,EAAE,CAAC;MACV,SAAS,EAAED,KAAK,KAAK,OAAO;MAC5B,MAAM,EAAEA,KAAK,KAAK;KACrB,CAAC;IACFK,UAAU,EAAEA,UAAU;IACtBI,KAAK,EAAEA,KAAK;IACZF,UAAU,EAAEA,UAAU;IACtBa,QAAQ,EAAEqC,YAAY;IACtBhC,MAAM,EAAEI,UAAU;IAClBE,MAAM,EAAE2B,UAAU;IAClBzB,KAAK,EAAE0B,SAAS;IAChBN,YAAY,EAAEN,gBAAgB;IAC9B7F,aAAa,EAAEA,aAAa;IAC5B0D,iBAAiB,EAAEA,iBAAiB;IACpCoC,aAAa,EAAEA,aAAa;IAC5ByB,QAAQ,EAAElF;IACZ,IACF,IAAI,EACPV,SAAS,iBACNpC,6BAACiI,OAAO;IACJC,SAAS,EAAEZ,GAAG;IACdxE,EAAE,EAAEA,EAAE;IACNmD,UAAU,EAAEA,UAAqB;IACjCE,QAAQ,EAAEgB,YAAwC;IAClDgB,WAAW,EAAEd,eAA6B;IAC1ChD,eAAe,EAAEA,eAAe;IAChCC,KAAK,EAAEA;IACT,IACF,IAAI,CACP;AAEb,CAAC,CAAC;;;;"}
|
@@ -7,13 +7,15 @@ function useTableSettingsListener(table, tableId, onChangeSettings, isEnabled =
|
|
7
7
|
const taco = useTaco();
|
8
8
|
const meta = table.options.meta;
|
9
9
|
const state = table.getState();
|
10
|
+
const lastUsedSettingsRef = React__default.useRef(removeDisabledSettings(getSettings(table), enabledSettings));
|
10
11
|
React__default.useEffect(() => {
|
11
12
|
const handler = setTimeout(() => {
|
12
13
|
if (!hasSomeEnabledSettings) {
|
13
14
|
return;
|
14
15
|
}
|
15
16
|
const settings = removeDisabledSettings(getSettings(table), enabledSettings);
|
16
|
-
if (Object.keys(settings).length) {
|
17
|
+
if (Object.keys(settings).length && JSON.stringify(settings) !== JSON.stringify(lastUsedSettingsRef.current)) {
|
18
|
+
lastUsedSettingsRef.current = settings;
|
17
19
|
// some settings shouldn't be persisted, but we comment them out here to highlight the intention
|
18
20
|
taco.settings.saveSetting(getSettingsId(tableId), settings);
|
19
21
|
if (onChangeSettings) {
|
@@ -28,7 +30,7 @@ function useTableSettingsListener(table, tableId, onChangeSettings, isEnabled =
|
|
28
30
|
//state.grouping,
|
29
31
|
meta.printing.settings, meta.rowHeight.height,
|
30
32
|
//state.globalFilter,
|
31
|
-
state.sorting]);
|
33
|
+
state.sorting, lastUsedSettingsRef.current]);
|
32
34
|
}
|
33
35
|
const DEFAULT_ENABLED_OPTIONS = {
|
34
36
|
columnOrder: true,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTableSettingsListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableSettingsListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { getSettings, getSettingsId } from '../util/settings';\nimport { useTaco } from '../../../../hooks/useTaco';\nimport { TableEnableSettingsOptions, TableSettings, TableSettingsHandler } from '../../types';\n\nexport function useTableSettingsListener<TType = unknown>(\n table: ReactTable<TType>,\n tableId: string,\n onChangeSettings: TableSettingsHandler | undefined,\n isEnabled: boolean | Partial<TableEnableSettingsOptions> = false\n) {\n const [enabledSettings, hasSomeEnabledSettings] = useEnabledSettings(isEnabled);\n const taco = useTaco();\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n React.useEffect(() => {\n const handler = setTimeout(() => {\n if (!hasSomeEnabledSettings) {\n return;\n }\n\n const settings = removeDisabledSettings(getSettings(table), enabledSettings);\n\n if (Object.keys(settings).length) {\n // some settings shouldn't be persisted, but we comment them out here to highlight the intention\n taco.settings.saveSetting(getSettingsId(tableId), settings);\n\n if (onChangeSettings) {\n onChangeSettings(getSettings(table));\n }\n }\n }, 250);\n\n return () => clearTimeout(handler);\n }, [\n //state.columnFilters,\n state.columnOrder,\n state.columnPinning,\n state.columnSizing,\n state.columnVisibility,\n table.options.enableGlobalFilter,\n meta.fontSize.size,\n //state.grouping,\n meta.printing.settings,\n meta.rowHeight.height,\n //state.globalFilter,\n state.sorting,\n ]);\n}\n\nconst DEFAULT_ENABLED_OPTIONS = {\n columnOrder: true,\n columnPinning: true,\n columnSizing: true,\n columnVisibility: true,\n excludeUnmatchedRecordsInSearch: true,\n fontSize: true,\n grouping: true,\n rowHeight: true,\n sorting: true,\n};\n\nfunction useEnabledSettings(isEnabled: boolean | Partial<TableEnableSettingsOptions>): [TableEnableSettingsOptions, boolean] {\n return React.useMemo(() => {\n if (isEnabled === false) {\n return [\n Object.keys(DEFAULT_ENABLED_OPTIONS).reduce(\n (o, key) => ({ ...o, [key]: false }),\n {}\n ) as TableEnableSettingsOptions,\n false,\n ];\n } else if (isEnabled === true) {\n return [DEFAULT_ENABLED_OPTIONS, true];\n }\n\n const options = { ...DEFAULT_ENABLED_OPTIONS, ...isEnabled };\n return [options, Object.values(options).some(o => o === true)];\n }, [isEnabled]);\n}\n\nfunction removeDisabledSettings(settings: TableSettings, enabledSettings: TableEnableSettingsOptions) {\n const sanitizedSettings: TableSettings = { ...settings };\n\n Object.keys(enabledSettings).forEach(setting => {\n if (!enabledSettings[setting]) {\n delete sanitizedSettings[setting];\n }\n });\n\n return sanitizedSettings;\n}\n"],"names":["useTableSettingsListener","table","tableId","onChangeSettings","isEnabled","enabledSettings","hasSomeEnabledSettings","useEnabledSettings","taco","useTaco","meta","options","state","getState","React","useEffect","handler","setTimeout","settings","
|
1
|
+
{"version":3,"file":"useTableSettingsListener.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/listeners/useTableSettingsListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { getSettings, getSettingsId } from '../util/settings';\nimport { useTaco } from '../../../../hooks/useTaco';\nimport { TableEnableSettingsOptions, TableSettings, TableSettingsHandler } from '../../types';\n\nexport function useTableSettingsListener<TType = unknown>(\n table: ReactTable<TType>,\n tableId: string,\n onChangeSettings: TableSettingsHandler | undefined,\n isEnabled: boolean | Partial<TableEnableSettingsOptions> = false\n) {\n const [enabledSettings, hasSomeEnabledSettings] = useEnabledSettings(isEnabled);\n const taco = useTaco();\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n const lastUsedSettingsRef = React.useRef(removeDisabledSettings(getSettings(table), enabledSettings));\n\n React.useEffect(() => {\n const handler = setTimeout(() => {\n if (!hasSomeEnabledSettings) {\n return;\n }\n\n const settings = removeDisabledSettings(getSettings(table), enabledSettings);\n\n if (Object.keys(settings).length && JSON.stringify(settings) !== JSON.stringify(lastUsedSettingsRef.current)) {\n lastUsedSettingsRef.current = settings;\n\n // some settings shouldn't be persisted, but we comment them out here to highlight the intention\n taco.settings.saveSetting(getSettingsId(tableId), settings);\n\n if (onChangeSettings) {\n onChangeSettings(getSettings(table));\n }\n }\n }, 250);\n\n return () => clearTimeout(handler);\n }, [\n //state.columnFilters,\n state.columnOrder,\n state.columnPinning,\n state.columnSizing,\n state.columnVisibility,\n table.options.enableGlobalFilter,\n meta.fontSize.size,\n //state.grouping,\n meta.printing.settings,\n meta.rowHeight.height,\n //state.globalFilter,\n state.sorting,\n lastUsedSettingsRef.current,\n ]);\n}\n\nconst DEFAULT_ENABLED_OPTIONS = {\n columnOrder: true,\n columnPinning: true,\n columnSizing: true,\n columnVisibility: true,\n excludeUnmatchedRecordsInSearch: true,\n fontSize: true,\n grouping: true,\n rowHeight: true,\n sorting: true,\n};\n\nfunction useEnabledSettings(isEnabled: boolean | Partial<TableEnableSettingsOptions>): [TableEnableSettingsOptions, boolean] {\n return React.useMemo(() => {\n if (isEnabled === false) {\n return [\n Object.keys(DEFAULT_ENABLED_OPTIONS).reduce(\n (o, key) => ({ ...o, [key]: false }),\n {}\n ) as TableEnableSettingsOptions,\n false,\n ];\n } else if (isEnabled === true) {\n return [DEFAULT_ENABLED_OPTIONS, true];\n }\n\n const options = { ...DEFAULT_ENABLED_OPTIONS, ...isEnabled };\n return [options, Object.values(options).some(o => o === true)];\n }, [isEnabled]);\n}\n\nfunction removeDisabledSettings(settings: TableSettings, enabledSettings: TableEnableSettingsOptions) {\n const sanitizedSettings: TableSettings = { ...settings };\n\n Object.keys(enabledSettings).forEach(setting => {\n if (!enabledSettings[setting]) {\n delete sanitizedSettings[setting];\n }\n });\n\n return sanitizedSettings;\n}\n"],"names":["useTableSettingsListener","table","tableId","onChangeSettings","isEnabled","enabledSettings","hasSomeEnabledSettings","useEnabledSettings","taco","useTaco","meta","options","state","getState","lastUsedSettingsRef","React","useRef","removeDisabledSettings","getSettings","useEffect","handler","setTimeout","settings","Object","keys","length","JSON","stringify","current","saveSetting","getSettingsId","clearTimeout","columnOrder","columnPinning","columnSizing","columnVisibility","enableGlobalFilter","fontSize","size","printing","rowHeight","height","sorting","DEFAULT_ENABLED_OPTIONS","excludeUnmatchedRecordsInSearch","grouping","useMemo","reduce","o","key","values","some","sanitizedSettings","forEach","setting"],"mappings":";;;;SAMgBA,wBAAwBA,CACpCC,KAAwB,EACxBC,OAAe,EACfC,gBAAkD,EAClDC,YAA2D,KAAK;EAEhE,MAAM,CAACC,eAAe,EAAEC,sBAAsB,CAAC,GAAGC,kBAAkB,CAACH,SAAS,CAAC;EAC/E,MAAMI,IAAI,GAAGC,OAAO,EAAE;EACtB,MAAMC,IAAI,GAAGT,KAAK,CAACU,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGX,KAAK,CAACY,QAAQ,EAAE;EAE9B,MAAMC,mBAAmB,GAAGC,cAAK,CAACC,MAAM,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,IAAI;EACtBS,+BAA+B,EAAE,IAAI;EACrCP,QAAQ,EAAE,IAAI;EACdQ,QAAQ,EAAE,IAAI;EACdL,SAAS,EAAE,IAAI;EACfE,OAAO,EAAE;CACZ;AAED,SAASnC,kBAAkBA,CAACH,SAAwD;EAChF,OAAOW,cAAK,CAAC+B,OAAO,CAAC;IACjB,IAAI1C,SAAS,KAAK,KAAK,EAAE;MACrB,OAAO,CACHmB,MAAM,CAACC,IAAI,CAACmB,uBAAuB,CAAC,CAACI,MAAM,CACvC,CAACC,CAAC,EAAEC,GAAG,MAAM;QAAE,GAAGD,CAAC;QAAE,CAACC,GAAG,GAAG;OAAO,CAAC,EACpC,EAAE,CACyB,EAC/B,KAAK,CACR;KACJ,MAAM,IAAI7C,SAAS,KAAK,IAAI,EAAE;MAC3B,OAAO,CAACuC,uBAAuB,EAAE,IAAI,CAAC;;IAG1C,MAAMhC,OAAO,GAAG;MAAE,GAAGgC,uBAAuB;MAAE,GAAGvC;KAAW;IAC5D,OAAO,CAACO,OAAO,EAAEY,MAAM,CAAC2B,MAAM,CAACvC,OAAO,CAAC,CAACwC,IAAI,CAACH,CAAC,IAAIA,CAAC,KAAK,IAAI,CAAC,CAAC;GACjE,EAAE,CAAC5C,SAAS,CAAC,CAAC;AACnB;AAEA,SAASa,sBAAsBA,CAACK,QAAuB,EAAEjB,eAA2C;EAChG,MAAM+C,iBAAiB,GAAkB;IAAE,GAAG9B;GAAU;EAExDC,MAAM,CAACC,IAAI,CAACnB,eAAe,CAAC,CAACgD,OAAO,CAACC,OAAO;IACxC,IAAI,CAACjD,eAAe,CAACiD,OAAO,CAAC,EAAE;MAC3B,OAAOF,iBAAiB,CAACE,OAAO,CAAC;;GAExC,CAAC;EAEF,OAAOF,iBAAiB;AAC5B;;;;"}
|
package/dist/index.css
CHANGED
@@ -350,77 +350,6 @@
|
|
350
350
|
stroke: currentColor;
|
351
351
|
}
|
352
352
|
|
353
|
-
/* Base styles */
|
354
|
-
[data-taco='checkbox-container'] [data-taco='checkbox'] {
|
355
|
-
@apply border-grey-500;
|
356
|
-
}
|
357
|
-
|
358
|
-
[data-taco='checkbox-container'][data-focus-visible] [data-taco='checkbox'] {
|
359
|
-
@apply yt-focus;
|
360
|
-
}
|
361
|
-
|
362
|
-
/* Readonly state */
|
363
|
-
[data-taco='checkbox-container'][data-readonly] [data-taco='checkbox'] {
|
364
|
-
@apply cursor-default;
|
365
|
-
}
|
366
|
-
|
367
|
-
/* Invalid state */
|
368
|
-
[data-taco='checkbox-container'][data-invalid] [data-taco='checkbox'] {
|
369
|
-
@apply border-red-500;
|
370
|
-
}
|
371
|
-
|
372
|
-
/* Selected or indeterminate state */
|
373
|
-
[data-taco='checkbox-container'][data-selected] [data-taco='checkbox'],
|
374
|
-
[data-taco='checkbox-container'][data-indeterminate] [data-taco='checkbox'] {
|
375
|
-
@apply border-blue-500 bg-blue-500;
|
376
|
-
}
|
377
|
-
|
378
|
-
/* Selected or indeterminate AND invalid state */
|
379
|
-
[data-taco='checkbox-container'][data-selected][data-invalid] [data-taco='checkbox'],
|
380
|
-
[data-taco='checkbox-container'][data-indeterminate][data-invalid] [data-taco='checkbox'] {
|
381
|
-
@apply !border-red-500 !bg-red-500;
|
382
|
-
}
|
383
|
-
|
384
|
-
/* Disabled state */
|
385
|
-
[data-taco='checkbox-container'][data-disabled] [data-taco='checkbox'] {
|
386
|
-
@apply border-grey-500/50 cursor-not-allowed;
|
387
|
-
}
|
388
|
-
|
389
|
-
[data-taco='checkbox-container'][data-disabled][data-invalid] [data-taco='checkbox'] {
|
390
|
-
@apply !border-red-500/50 !bg-red-500/50;
|
391
|
-
}
|
392
|
-
|
393
|
-
[data-taco='checkbox-container'][data-disabled][data-selected] [data-taco='checkbox'],
|
394
|
-
[data-taco='checkbox-container'][data-disabled][data-indeterminate] [data-taco='checkbox'] {
|
395
|
-
@apply !bg-blue-500/50;
|
396
|
-
}
|
397
|
-
|
398
|
-
[data-taco='checkbox-container'][data-disabled][data-selected][data-invalid] [data-taco='checkbox'],
|
399
|
-
[data-taco='checkbox-container'][data-disabled][data-indeterminate][data-invalid] [data-taco='checkbox'] {
|
400
|
-
@apply !bg-red-500/50 text-white;
|
401
|
-
}
|
402
|
-
|
403
|
-
/* Hover states (separate rules for clarity) */
|
404
|
-
[data-taco='checkbox-container']:hover:not([data-disabled]):not([data-readonly]) [data-taco='checkbox'] {
|
405
|
-
@apply border-grey-700;
|
406
|
-
}
|
407
|
-
|
408
|
-
[data-taco='checkbox-container']:hover[data-selected]:not([data-disabled]):not([data-readonly]) [data-taco='checkbox'],
|
409
|
-
[data-taco='checkbox-container']:hover[data-indeterminate]:not([data-disabled]):not([data-readonly]) [data-taco='checkbox'] {
|
410
|
-
@apply !border-blue-700 !bg-blue-700;
|
411
|
-
}
|
412
|
-
|
413
|
-
[data-taco='checkbox-container']:hover[data-invalid]:not([data-disabled]):not([data-readonly]) [data-taco='checkbox'] {
|
414
|
-
@apply !border-red-700;
|
415
|
-
}
|
416
|
-
|
417
|
-
[data-taco='checkbox-container']:hover[data-invalid][data-selected]:not([data-disabled]):not([data-readonly])
|
418
|
-
[data-taco='checkbox'],
|
419
|
-
[data-taco='checkbox-container']:hover[data-invalid][data-indeterminate]:not([data-disabled]):not([data-readonly])
|
420
|
-
[data-taco='checkbox'] {
|
421
|
-
@apply !border-red-700 !bg-red-700;
|
422
|
-
}
|
423
|
-
|
424
353
|
[data-taco='scrollable-list'].yt-list--multiselect li:first-child {
|
425
354
|
@apply border-grey-100 border-b-2 pl-4; /* Listbox max-height is dependant on this border-bottom-width value! */
|
426
355
|
}
|
@@ -895,7 +824,7 @@ table[data-taco^='table'] td[data-cell-truncate='true'] [data-taco='textarea'] {
|
|
895
824
|
@apply focus:absolute focus:overflow-y-auto;
|
896
825
|
}
|
897
826
|
|
898
|
-
table[data-taco^='table'] td label
|
827
|
+
table[data-taco^='table'] td label {
|
899
828
|
@apply h-fit !min-h-fit w-full !pb-0;
|
900
829
|
}
|
901
830
|
|
@@ -934,14 +863,14 @@ table[data-taco^='table'][data-table-font-size='small'] td [data-taco='spinner']
|
|
934
863
|
@apply !h-4 !w-4;
|
935
864
|
}
|
936
865
|
|
937
|
-
table[data-taco^='table'][data-table-font-size='small'] td [data-taco='icon']
|
866
|
+
table[data-taco^='table'][data-table-font-size='small'] td [data-taco='icon'],
|
938
867
|
table[data-taco^='table'][data-table-font-size='small'] td [data-taco='spinner'] {
|
939
868
|
@apply !-my-[3px];
|
940
869
|
}
|
941
870
|
|
942
871
|
table[data-taco^='table'][data-table-font-size='small'] td [data-taco='badge'],
|
943
872
|
table[data-taco^='table'][data-table-font-size='small'] td [data-taco='badge-icon'],
|
944
|
-
table[data-taco^='table'][data-table-font-size='small'] td [data-taco='icon']
|
873
|
+
table[data-taco^='table'][data-table-font-size='small'] td [data-taco='icon'],
|
945
874
|
table[data-taco^='table'][data-table-font-size='small'] td [data-taco='spinner'] {
|
946
875
|
@apply !-my-0.5 !text-xs;
|
947
876
|
}
|
@@ -1070,7 +999,7 @@ table[data-taco^='table'][data-table-font-size='medium'] td [data-taco='icon-but
|
|
1070
999
|
@apply !-my-1.5;
|
1071
1000
|
}
|
1072
1001
|
|
1073
|
-
table[data-taco^='table'][data-table-font-size='medium'] td [data-taco='icon']
|
1002
|
+
table[data-taco^='table'][data-table-font-size='medium'] td [data-taco='icon'] {
|
1074
1003
|
@apply !-my-0.5;
|
1075
1004
|
}
|
1076
1005
|
|
@@ -1155,7 +1084,7 @@ table[data-taco^='table'][data-table-font-size='large'] td [data-taco='icon-butt
|
|
1155
1084
|
@apply !-my-1;
|
1156
1085
|
}
|
1157
1086
|
|
1158
|
-
table[data-taco^='table'][data-table-font-size='large'] td [data-taco='icon']
|
1087
|
+
table[data-taco^='table'][data-table-font-size='large'] td [data-taco='icon'] {
|
1159
1088
|
@apply !-my-0.5;
|
1160
1089
|
}
|
1161
1090
|
|