@economic/taco 2.55.0-settings.0 → 2.55.0-settings.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/components/Checkbox/Checkbox.d.ts +2 -7
  2. package/dist/components/List/List.d.ts +2 -2
  3. package/dist/components/List/components/Toggle.d.ts +2 -2
  4. package/dist/components/ModeSwitch/ModeSwitch.d.ts +3 -6
  5. package/dist/components/Switch/Switch.d.ts +4 -6
  6. package/dist/esm/index.css +5 -76
  7. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +63 -41
  8. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  9. package/dist/esm/packages/taco/src/components/List/components/Toggle.js +4 -14
  10. package/dist/esm/packages/taco/src/components/List/components/Toggle.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +3 -6
  12. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +12 -34
  14. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Switch/Switch.js +35 -37
  16. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
  19. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +0 -1
  20. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  21. package/dist/index.css +5 -76
  22. package/dist/taco.cjs.development.js +119 -133
  23. package/dist/taco.cjs.development.js.map +1 -1
  24. package/dist/taco.cjs.production.min.js +1 -1
  25. package/dist/taco.cjs.production.min.js.map +1 -1
  26. 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,CAACkB,aAAa,IAAIlB,MAAM,CAACE,MAAM,CAACiB,YAAY,EAAE,IAAI,CAAC,CAACf,KAAK,CAACG,O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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,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,UAAU,IAAAC,qBAAA,GAAIV,MAAM,CAACE,MAA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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;;;;"}
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:not([data-taco='checkbox-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']:not([data-taco='checkbox'] *),
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']:not([data-taco='checkbox'] *),
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']:not([data-taco='checkbox'] *) {
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']:not([data-taco='checkbox'] *) {
1087
+ table[data-taco^='table'][data-table-font-size='large'] td [data-taco='icon'] {
1159
1088
  @apply !-my-0.5;
1160
1089
  }
1161
1090
 
@@ -11,9 +11,9 @@ var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
11
11
  var AccordionPrimitive = require('@radix-ui/react-accordion');
12
12
  var TooltipPrimitive = require('@radix-ui/react-tooltip');
13
13
  var reactDayPicker = require('react-day-picker');
14
- var reactAriaComponents = require('react-aria-components');
15
- var PopoverPrimitive = require('@radix-ui/react-popover');
14
+ var CheckboxPrimitive = require('@radix-ui/react-checkbox');
16
15
  var uuid = require('uuid');
16
+ var PopoverPrimitive = require('@radix-ui/react-popover');
17
17
  var debounce$1 = _interopDefault(require('lodash/debounce'));
18
18
  var dateFns = require('date-fns');
19
19
  var DialogPrimitive = require('@radix-ui/react-dialog');
@@ -24,6 +24,7 @@ var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
24
24
  var reactUseControllableState = require('@radix-ui/react-use-controllable-state');
25
25
  var HoverCardPrimitive = require('@radix-ui/react-hover-card');
26
26
  var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
27
+ var PrimitiveSwitch = require('@radix-ui/react-switch');
27
28
  var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
28
29
  var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
29
30
  var ReactDOM = _interopDefault(require('react-dom'));
@@ -5246,6 +5247,11 @@ const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
5246
5247
  });
5247
5248
  Card.Content = Content$2;
5248
5249
 
5250
+ // React 18 has this built-in, when we upgrade this hook should be removed and the uuid dependency should be removed
5251
+ const useId = nativeId => {
5252
+ return React__default.useMemo(() => nativeId !== null && nativeId !== void 0 ? nativeId : uuid.v4(), []);
5253
+ };
5254
+
5249
5255
  const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
5250
5256
  const {
5251
5257
  delay = 350,
@@ -5288,53 +5294,75 @@ const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, r
5288
5294
  const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
5289
5295
  const {
5290
5296
  checked,
5291
- className,
5292
- defaultChecked,
5293
5297
  indeterminate,
5294
- readOnly,
5295
5298
  invalid,
5296
- disabled,
5297
- required,
5298
- onChange,
5299
- loading,
5300
5299
  label,
5301
- onClick,
5300
+ loading,
5301
+ onChange,
5302
5302
  ...otherProps
5303
5303
  } = props;
5304
- // Converts the forwarded ref to an object ref, as required by RAC Checkbox.
5305
- const inputRef = useMergedRef(ref);
5306
- const checkboxContainerClassName = cn('group flex justify-center gap-2 data-[disabled]:text-grey-300 data-[disabled]:cursor-not-allowed');
5307
- // Styling for other complex, state-driven scenarios is managed directly within the styles.css file.
5308
- const checkboxClassName = cn('bg-white h-5 w-5 border rounded text-sm flex flex-shrink-0 text-white cursor-pointer', {
5304
+ const id = useId(props.id);
5305
+ const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 focus-visible:yt-focus disabled:cursor-not-allowed text-white', {
5309
5306
  'self-start': !!label,
5310
5307
  'mt-[0.1rem]': !label
5311
- }, className);
5312
- return /*#__PURE__*/React.createElement(reactAriaComponents.Checkbox, Object.assign({}, otherProps, {
5313
- className: checkboxContainerClassName,
5314
- "data-taco": "checkbox-container",
5315
- defaultSelected: defaultChecked,
5316
- isDisabled: disabled,
5317
- isIndeterminate: indeterminate,
5318
- isInvalid: invalid,
5319
- isRequired: required,
5320
- isReadOnly: readOnly,
5321
- isSelected: checked,
5322
- inputRef: inputRef,
5323
- onChange: onChange
5324
- }), ({
5325
- isIndeterminate,
5326
- isSelected
5327
- }) => (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
5328
- className: checkboxClassName,
5308
+ }, invalid ? {
5309
+ 'border-red-500 hover:border-red-700 aria-checked:border-red-500 aria-checked-mixed:border-red-500 aria-checked:bg-red-500 aria-checked-mixed:bg-red-500 aria-checked:hover:border-red-700 aria-checked-mixed:hover:border-red-700 aria-checked:hover:bg-red-700 aria-checked-mixed:hover:bg-red-700': !props.disabled,
5310
+ 'border-red-500/50 aria-checked:wcag-red-500/50 aria-checked-mixed:wcag-red-500/50': props.disabled
5311
+ } : {
5312
+ 'border-grey-500 hover:border-grey-700 aria-checked:border-blue-500 aria-checked-mixed:border-blue-500 aria-checked:bg-blue-500 aria-checked-mixed:bg-blue-500 aria-checked:hover:border-blue-700 aria-checked-mixed:hover:border-blue-700 aria-checked:hover:bg-blue-700 aria-checked-mixed:hover:bg-blue-700': !props.disabled,
5313
+ 'border-grey-500/50 aria-checked:bg-blue-500/50 aria-checked-mixed:bg-blue-500/50': props.disabled
5314
+ }, props.className);
5315
+ let handleChange;
5316
+ if (onChange) {
5317
+ handleChange = checked => onChange(checked === 'indeterminate' ? false : checked);
5318
+ }
5319
+ let labelledByProps = null;
5320
+ if (label) {
5321
+ labelledByProps = {
5322
+ 'aria-labelledby': `${id}-label`,
5323
+ id
5324
+ };
5325
+ }
5326
+ // the enter keyboard shortcut isn't supported by default, but we want it
5327
+ const handleKeyDown = event => {
5328
+ if (event.key === 'Enter') {
5329
+ event.currentTarget.click();
5330
+ }
5331
+ };
5332
+ const spinnerClassname = cn(
5333
+ //Spinner is slightly bigger then 'line' and 'tick' icons, so making it 2px smaller from each side
5334
+ "m-0.5 !h-[calc(100%-theme('spacing.1'))] !w-[calc(100%-theme('spacing.1'))]", {
5335
+ 'text-blue-500': !checked && !indeterminate
5336
+ });
5337
+ const element = /*#__PURE__*/React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, labelledByProps, {
5338
+ "aria-invalid": invalid ? 'true' : undefined,
5329
5339
  "data-taco": "checkbox",
5330
- onClick: onClick
5331
- }, loading ? (/*#__PURE__*/React.createElement(Spinner, {
5332
- className: "m-0.5 !h-[calc(100%-theme('spacing.1'))] !w-[calc(100%-theme('spacing.1'))] text-blue-500 group-data-[indeterminate]:text-white group-data-[selected]:text-white"
5333
- })) : (isIndeterminate || isSelected) && (/*#__PURE__*/React.createElement(Icon, {
5334
- "aria-hidden": true,
5335
- name: isIndeterminate ? 'line' : 'tick',
5340
+ checked: indeterminate ? 'indeterminate' : checked,
5341
+ className: className,
5342
+ onCheckedChange: handleChange,
5343
+ onKeyDown: handleKeyDown,
5344
+ ref: ref
5345
+ }), loading ? (/*#__PURE__*/React.createElement(Spinner, {
5346
+ className: spinnerClassname
5347
+ })) : (/*#__PURE__*/React.createElement(CheckboxPrimitive.Indicator, {
5348
+ className: "flex h-full w-full"
5349
+ }, /*#__PURE__*/React.createElement(Icon, {
5350
+ name: indeterminate ? 'line' : 'tick',
5336
5351
  className: "!h-full !w-full"
5337
- }))), label)));
5352
+ }))));
5353
+ if (label) {
5354
+ const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {
5355
+ 'cursor-not-allowed text-grey-300': props.disabled
5356
+ });
5357
+ return /*#__PURE__*/React.createElement("span", {
5358
+ className: labelContainerClassName,
5359
+ "data-taco": "checkbox-container"
5360
+ }, element, /*#__PURE__*/React.createElement("label", {
5361
+ htmlFor: id,
5362
+ id: `${id}-label`
5363
+ }, label));
5364
+ }
5365
+ return element;
5338
5366
  });
5339
5367
  Checkbox.displayName = 'Checkbox';
5340
5368
 
@@ -5772,13 +5800,10 @@ const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(pro
5772
5800
  // so need to be taken out of screen reader scope.
5773
5801
  , {
5774
5802
  "aria-hidden": true,
5775
- excludeFromTabOrder: true,
5803
+ tabIndex: -1,
5776
5804
  checked: optionProps['aria-selected'],
5777
- onChange: () => {
5778
- var _optionProps$ref, _optionProps$ref$curr;
5779
- (_optionProps$ref = optionProps.ref) === null || _optionProps$ref === void 0 ? void 0 : (_optionProps$ref$curr = _optionProps$ref.current) === null || _optionProps$ref$curr === void 0 ? void 0 : _optionProps$ref$curr.click();
5780
- },
5781
- className: "ml-2 self-center p-px"
5805
+ onChange: () => null,
5806
+ className: "pointer-events-none ml-2 self-center p-px"
5782
5807
  }))))) : (/*#__PURE__*/React.createElement("li", {
5783
5808
  className: "yt-list__empty"
5784
5809
  }, /*#__PURE__*/React.createElement("span", null, texts.listbox.empty))));
@@ -7749,46 +7774,44 @@ const Collapsible = /*#__PURE__*/React__default.forwardRef(function Accordion(pr
7749
7774
 
7750
7775
  const Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
7751
7776
  const {
7752
- checked,
7753
- defaultChecked,
7754
- readOnly,
7755
7777
  label,
7756
7778
  onChange,
7757
- disabled,
7758
- onClick,
7759
- className,
7760
7779
  ...otherProps
7761
7780
  } = props;
7762
- const inputRef = useMergedRef(ref);
7763
- const switchContainerClassName = cn('group flex self-start', 'data-[disabled]:text-grey-300 data-[disabled]:cursor-not-allowed');
7764
- const switchClassName = cn('h-5 w-9 flex flex-shrink-0 rounded-full inline-flex cursor-pointer bg-grey-500', 'group-data-[focus-visible]:yt-focus', {
7765
- 'mr-2': !!label
7766
- }, 'group-hover:bg-grey-700',
7767
- // When switch is selected
7768
- 'group-data-[selected]:bg-blue-500',
7769
- // When switch is selected and hovered
7770
- 'group-hover:group-data-[selected]:bg-blue-700',
7771
- // When switch is disabled
7772
- 'group-data-[disabled]:!bg-grey-500/50 group-data-[disabled]:cursor-not-allowed',
7773
- // When switch is disabled and selected
7774
- 'group-data-[disabled]:group-data-[selected]:!bg-blue-500/50', className);
7775
- const switchThumbClassName = cn('pointer-events-none mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform will-change-transform', 'group-data-[disabled]:opacity-50', 'group-data-[selected]:translate-x-[1.1rem]');
7776
- return /*#__PURE__*/React.createElement(reactAriaComponents.Switch, Object.assign({}, otherProps, {
7777
- className: switchContainerClassName,
7778
- "data-taco": "switch-container",
7779
- inputRef: inputRef,
7780
- isDisabled: disabled,
7781
- isReadOnly: readOnly,
7782
- isSelected: checked,
7783
- defaultSelected: defaultChecked,
7784
- onChange: onChange
7785
- }), /*#__PURE__*/React.createElement("span", {
7786
- className: switchClassName,
7781
+ const id = useId(props.id);
7782
+ const className = cn('group h-5 w-9 flex flex-shrink-0 rounded-full inline-flex focus-visible:yt-focus', {
7783
+ 'mr-2': !!label,
7784
+ 'bg-grey-500 hover:bg-grey-700 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-700': !props.disabled,
7785
+ 'bg-grey-500/50 aria-checked:bg-blue-500/50 cursor-not-allowed': props.disabled
7786
+ }, props.className);
7787
+ let labelledByProps = null;
7788
+ if (label) {
7789
+ labelledByProps = {
7790
+ 'aria-labelledby': `${id}-label`,
7791
+ id
7792
+ };
7793
+ }
7794
+ const element = /*#__PURE__*/React.createElement(PrimitiveSwitch.Root, Object.assign({}, otherProps, labelledByProps, {
7795
+ className: className,
7787
7796
  "data-taco": "switch",
7788
- onClick: onClick
7789
- }, /*#__PURE__*/React.createElement("span", {
7790
- className: switchThumbClassName
7791
- })), label);
7797
+ onCheckedChange: onChange,
7798
+ ref: ref
7799
+ }), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
7800
+ className: "pointer-events-none mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform will-change-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]"
7801
+ }));
7802
+ if (label) {
7803
+ const labelContainerClassName = cn('flex self-start cursor-pointer', {
7804
+ 'cursor-not-allowed text-grey-300': props.disabled
7805
+ });
7806
+ return /*#__PURE__*/React.createElement("span", {
7807
+ className: labelContainerClassName,
7808
+ "data-taco": "switch-container"
7809
+ }, element, /*#__PURE__*/React.createElement("label", {
7810
+ htmlFor: id,
7811
+ id: `${id}-label`
7812
+ }, label));
7813
+ }
7814
+ return element;
7792
7815
  });
7793
7816
  Switch.displayName = 'Switch';
7794
7817
 
@@ -7846,18 +7869,13 @@ const Switch$1 = /*#__PURE__*/React__default.forwardRef(function Switch$1(props,
7846
7869
  setChecked(!checked);
7847
7870
  onChange(!checked);
7848
7871
  }, [checked, onChange]);
7849
- const controlClassName = cn(
7850
- // When ToggleItem is hovered
7851
- 'group-hover/toggle:bg-grey-700',
7852
- // When ToggleItem is hovered and switch inside it is selected
7853
- 'group-hover/toggle:group-data-[selected]:bg-blue-700');
7854
7872
  const control = /*#__PURE__*/React__default.createElement(Switch, {
7855
7873
  checked: checked,
7856
- className: controlClassName,
7874
+ className: "group-hover/toggle:[&[aria-checked=false]]:bg-grey-700 group-hover/toggle:[&[aria-checked=true]]:bg-blue-700",
7857
7875
  disabled: props.disabled,
7858
7876
  onChange: toggle,
7859
7877
  ref: switchRef,
7860
- excludeFromTabOrder: true
7878
+ tabIndex: -1
7861
7879
  });
7862
7880
  return /*#__PURE__*/React__default.createElement(ToggleItem, Object.assign({}, attributes, {
7863
7881
  control: control,
@@ -7878,18 +7896,13 @@ const Checkbox$1 = /*#__PURE__*/React__default.forwardRef(function Switch(props,
7878
7896
  setChecked(!checked);
7879
7897
  onChange(!checked);
7880
7898
  }, [checked, onChange]);
7881
- const controlClassName = cn(
7882
- // When ToggleItem is hovered
7883
- 'group-hover/toggle:border-grey-700',
7884
- // When ToggleItem is hovered and checkbox inside it is selected
7885
- 'group-hover/toggle:group-data-[selected]:border-blue-700 group-hover/toggle:group-data-[selected]:bg-blue-700');
7886
7899
  const control = /*#__PURE__*/React__default.createElement(Checkbox, {
7887
7900
  checked: checked,
7888
- className: controlClassName,
7901
+ className: "group-hover/toggle:[&[aria-checked=false]]:border-grey-700 group-hover/toggle:[&[aria-checked=true]]:border-blue-700 group-hover/checkbox:[&[aria-checked=true]]:bg-blue-700",
7889
7902
  disabled: props.disabled,
7890
7903
  onChange: toggle,
7891
7904
  ref: checkboxRef,
7892
- excludeFromTabOrder: true
7905
+ tabIndex: -1
7893
7906
  });
7894
7907
  return /*#__PURE__*/React__default.createElement(ToggleItem, Object.assign({}, attributes, {
7895
7908
  control: control,
@@ -8836,41 +8849,20 @@ Menu$1.SubMenu = SubMenu;
8836
8849
 
8837
8850
  const ModeSwitch = /*#__PURE__*/React.forwardRef(function ModeSwitch(props, ref) {
8838
8851
  const {
8839
- checked,
8840
- defaultChecked,
8841
- readOnly,
8842
8852
  onChange,
8843
- disabled,
8844
- className,
8845
8853
  ...otherProps
8846
8854
  } = props;
8847
- const inputRef = useMergedRef(ref);
8848
- const switchClassName = cn('group w-14 h-8 flex flex-shrink-0 rounded-full inline-flex p-1 cursor-pointer bg-grey-500', 'data-[focus-visible]:yt-focus', 'hover:bg-grey-700',
8849
- // When modeswitch is selected
8850
- 'data-[selected]:bg-blue-500',
8851
- // When modeswitch is selected and hovered
8852
- 'hover:data-[selected]:bg-blue-700',
8853
- // When modeswitch is disabled
8854
- 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:bg-grey-500 ',
8855
- // When modeswitch is disabled and selected
8856
- 'data-[disabled]:data-[selected]:!bg-blue-500', className);
8857
- const switchThumbClassName = cn('pointer-events-none flex h-6 w-6 items-center justify-center rounded-full bg-white transition-transform will-change-transform',
8858
- // When modeswitch is disabled
8859
- 'group-data-[disabled]:opacity-50',
8860
- // When modeswitch is selected
8861
- 'group-data-[selected]:translate-x-full');
8862
- return /*#__PURE__*/React.createElement(reactAriaComponents.Switch, Object.assign({}, otherProps, {
8863
- className: switchClassName,
8864
- defaultSelected: defaultChecked,
8865
- id: otherProps.id,
8866
- inputRef: inputRef,
8867
- isDisabled: disabled,
8868
- isReadOnly: readOnly,
8869
- isSelected: checked,
8870
- onChange: onChange
8871
- }), /*#__PURE__*/React.createElement("span", {
8872
- className: switchThumbClassName,
8873
- "data-taco": "mode"
8855
+ const className = cn('group w-14 h-8 flex flex-shrink-0 rounded-full inline-flex focus-visible:yt-focus p-1', {
8856
+ 'bg-grey-500 hover:bg-grey-700 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-700': !props.disabled,
8857
+ 'bg-grey-500 aria-checked:bg-blue-500 cursor-not-allowed opacity-50': props.disabled
8858
+ }, props.className);
8859
+ return /*#__PURE__*/React.createElement(PrimitiveSwitch.Root, Object.assign({}, otherProps, {
8860
+ className: className,
8861
+ "data-taco": "mode",
8862
+ onCheckedChange: onChange,
8863
+ ref: ref
8864
+ }), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
8865
+ className: "pointer-events-none flex h-6 w-6 items-center justify-center rounded-full bg-white transition-transform will-change-transform group-disabled:opacity-50 group-aria-checked:translate-x-[100%]"
8874
8866
  }, /*#__PURE__*/React.createElement(Icon, {
8875
8867
  name: "edit-simple",
8876
8868
  className: "pointer-events-none !h-5 !w-5"
@@ -13872,7 +13864,6 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
13872
13864
  "data-cell-align": isGroup ? 'center' : align,
13873
13865
  "data-cell-id": id,
13874
13866
  "data-cell-pinned": isPinned ? isPinned : undefined,
13875
- "data-taco": isGroup ? 'grouped-column-header' : 'column-header',
13876
13867
  style: style,
13877
13868
  ref: setRef
13878
13869
  }), !isPlaceholder ? (/*#__PURE__*/React__default.createElement(HeaderContent, {
@@ -14794,11 +14785,6 @@ function RowHeightMenuItem({
14794
14785
  }, texts.table.rowHeight.sizes.extraTall)));
14795
14786
  }
14796
14787
 
14797
- // React 18 has this built-in, when we upgrade this hook should be removed and the uuid dependency should be removed
14798
- const useId = nativeId => {
14799
- return React__default.useMemo(() => nativeId !== null && nativeId !== void 0 ? nativeId : uuid.v4(), []);
14800
- };
14801
-
14802
14788
  const isAriaSelectionKey = event => {
14803
14789
  if (event.key === 'Enter' || event.key === ' ' || event.key === 'Tab') {
14804
14790
  return true;