@economic/taco 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/components/Calendar/Calendar.d.ts +3 -1
  2. package/dist/esm/components/Badge/Badge.js.map +1 -1
  3. package/dist/esm/components/Calendar/Calendar.js +3 -7
  4. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  5. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  6. package/dist/esm/components/Combobox/Combobox.js.map +1 -1
  7. package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
  8. package/dist/esm/components/Dialog/components/Content.js.map +1 -1
  9. package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
  10. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  11. package/dist/esm/components/Menu/components/Content.js.map +1 -1
  12. package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
  13. package/dist/esm/components/Pagination/PageNumbers.js.map +1 -1
  14. package/dist/esm/components/Popover/Primitives.js.map +1 -1
  15. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
  16. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  17. package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
  18. package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
  19. package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  20. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  21. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  22. package/dist/esm/index.css +2 -6
  23. package/dist/esm/primitives/Button.js.map +1 -1
  24. package/dist/index.css +2 -6
  25. package/dist/taco.cjs.development.js +3 -7
  26. package/dist/taco.cjs.development.js.map +1 -1
  27. package/dist/taco.cjs.production.min.js +1 -1
  28. package/dist/taco.cjs.production.min.js.map +1 -1
  29. package/package.json +2 -2
  30. package/types.json +7 -2
@@ -1 +1 @@
1
- {"version":3,"file":"WindowedTable.js","sources":["../../../../../src/components/Table/components/WindowedTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { PluginHook } from 'react-table';\nimport { areEqual, VariableSizeList } from 'react-window';\nimport InfiniteLoader from 'react-window-infinite-loader';\nimport { TableProps, ForwardedGenericTableWithStatics, TableRef } from '../types';\nimport { useTable } from '../hooks/useTable';\nimport { useBoundingClientRectListener } from '../../../utils/hooks/useBoundingClientRectListener';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { Row } from '../util/renderRow';\nimport { DefaultEmptyState, BaseTable } from './BaseTable';\nimport { useLocalization } from '../../Provider/Provider';\n\nconst ROW_HEIGHT = 40;\n\nconst VariableRow = React.memo(({ data, index, style: { height: _, ...style } }: any) => {\n const { texts } = useLocalization();\n const { rows, setRowHeight, rowProps, tableProps, instance, prepareRow, rowHeights } = data;\n const row = rows[index];\n const ref = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (ref?.current) {\n setRowHeight(index, ref.current.getBoundingClientRect().height);\n }\n }, [rowHeights[index]]);\n\n if (row) {\n prepareRow(row, index);\n\n return (\n <Row\n {...rowProps}\n style={style}\n key={index}\n index={index}\n row={row}\n instance={instance}\n headerGroups={tableProps.headerGroups}\n setRowHeight={setRowHeight}\n ref={ref}\n />\n );\n }\n\n return (\n <div className=\"yt-table__row\" role=\"row\" style={style}>\n <div className=\"yt-table__cell text-grey-dark\">{texts.table.loading}</div>\n </div>\n );\n}, areEqual);\n\nconst getAverageRowHeight = (rowHeights = {}) => {\n const keys = Object.keys(rowHeights);\n const estimatedHeight = keys.reduce((p, i) => p + rowHeights[i], 0);\n return estimatedHeight / keys.length;\n};\n\nexport const WindowedTable = React.forwardRef(function WindowedTable<T>(\n props: TableProps<T> & { plugins: PluginHook<{}>[] },\n ref: React.Ref<TableRef>\n) {\n const tableRef: any = useProxiedRef<HTMLDivElement>(ref);\n const { emptyStateRenderer = DefaultEmptyState, length, loadMore, ...otherProps } = props;\n const { rowProps, tableProps, rows, prepareRow, instance, state } = useTable<T>({ ...otherProps, windowed: true }, tableRef);\n\n // determine heights for windowing calculations\n const headerRef = React.useRef<HTMLDivElement>(null);\n const [rowsRef, setRowsRef] = React.useState<any>(null);\n const tableDimensions = useBoundingClientRectListener(tableRef);\n const headerDimensions = useBoundingClientRectListener(headerRef);\n const height = tableDimensions && headerDimensions ? tableDimensions.height - headerDimensions.height : null;\n\n // variable row height calculations\n const estimatedRowHeight = rowProps.rowHeight || ROW_HEIGHT;\n const rowHeights = React.useRef<Record<string, number>>({});\n const setRowHeight = React.useCallback((index: number, size: number) => {\n if (rowHeights.current[index] !== size) {\n rowHeights.current = {\n ...rowHeights.current,\n [index]: size,\n };\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }\n }, []);\n const getRowHeight = React.useCallback(index => rowHeights.current[index] || estimatedRowHeight, []);\n\n React.useEffect(() => {\n if (rowsRef && rowProps.activeIndex !== undefined) {\n rowsRef.scrollToItem(rowProps.activeIndex, 'start');\n }\n }, [rowsRef, rowProps.activeIndex]);\n\n // trigger recalculation of variable row heights if the data changes\n React.useEffect(() => {\n rowHeights.current = {};\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }, [rows.length]);\n\n const contentHeight = estimatedRowHeight * props.data.length || 0;\n const isScrollbarVisible = height !== null ? contentHeight > height : false;\n\n const className = cn(tableProps.className, 'yt-table--windowed', { 'table-with-scrollbar': isScrollbarVisible });\n\n let list;\n\n const itemData = {\n rows,\n setRowHeight,\n rowProps,\n tableProps,\n instance,\n prepareRow,\n state,\n rowHeights: rowHeights.current,\n };\n\n if (height && rows.length) {\n const listProps = {\n height,\n itemData,\n estimatedItemSize: getAverageRowHeight(rowHeights.current),\n itemSize: getRowHeight,\n width: '100%',\n };\n\n if (loadMore && length) {\n const isLoaded = (index: number) => !!rows[index];\n\n list = (\n <InfiniteLoader isItemLoaded={isLoaded} itemCount={length} loadMoreItems={loadMore as any}>\n {({ onItemsRendered, ref }: any) => (\n <VariableSizeList\n {...listProps}\n itemCount={length}\n onItemsRendered={onItemsRendered}\n ref={list => {\n ref(list);\n setRowsRef(list);\n }}\n >\n {VariableRow}\n </VariableSizeList>\n )}\n </InfiniteLoader>\n );\n } else {\n list = (\n <VariableSizeList\n {...listProps}\n itemCount={rows.length}\n ref={ref => {\n setRowsRef(ref);\n }}\n >\n {VariableRow}\n </VariableSizeList>\n );\n }\n }\n\n return (\n <BaseTable {...tableProps} className={className} headerRef={headerRef} ref={tableRef}>\n {list ? list : emptyStateRenderer()}\n </BaseTable>\n );\n}) as ForwardedGenericTableWithStatics;\n\nWindowedTable.Column = () => null;\nWindowedTable.Group = () => null;\n"],"names":["ROW_HEIGHT","VariableRow","React","memo","data","index","style","height","_","texts","useLocalization","rows","setRowHeight","rowProps","tableProps","instance","prepareRow","rowHeights","row","ref","useRef","useEffect","current","getBoundingClientRect","Row","key","headerGroups","className","role","table","loading","areEqual","getAverageRowHeight","keys","Object","estimatedHeight","reduce","p","i","length","WindowedTable","forwardRef","props","tableRef","useProxiedRef","emptyStateRenderer","DefaultEmptyState","loadMore","otherProps","state","useTable","windowed","headerRef","rowsRef","setRowsRef","useState","tableDimensions","useBoundingClientRectListener","headerDimensions","estimatedRowHeight","rowHeight","useCallback","size","resetAfterIndex","getRowHeight","activeIndex","undefined","scrollToItem","contentHeight","isScrollbarVisible","cn","list","itemData","listProps","estimatedItemSize","itemSize","width","isLoaded","InfiniteLoader","isItemLoaded","itemCount","loadMoreItems","onItemsRendered","VariableSizeList","BaseTable","Column","Group"],"mappings":";;;;;;;;;;;AAaA,MAAMA,UAAU,GAAG,EAAnB;AAEA,MAAMC,WAAW,gBAAGC,cAAK,CAACC,IAAN,CAAW,CAAC;EAAEC,IAAF;EAAQC,KAAR;EAAeC,KAAK,EAAE;IAAEC,MAAM,EAAEC,CAAV;IAAa,GAAGF;;AAAtC,CAAD;EAC3B,MAAM;IAAEG;MAAUC,eAAe,EAAjC;EACA,MAAM;IAAEC,IAAF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WindowedTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { PluginHook } from 'react-table';\nimport { areEqual, VariableSizeList } from 'react-window';\nimport InfiniteLoader from 'react-window-infinite-loader';\nimport { TableProps, ForwardedGenericTableWithStatics, TableRef } from '../types';\nimport { useTable } from '../hooks/useTable';\nimport { useBoundingClientRectListener } from '../../../utils/hooks/useBoundingClientRectListener';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { Row } from '../util/renderRow';\nimport { DefaultEmptyState, BaseTable } from './BaseTable';\nimport { useLocalization } from '../../Provider/Provider';\n\nconst ROW_HEIGHT = 40;\n\nconst VariableRow = React.memo(({ data, index, style: { height: _, ...style } }: any) => {\n const { texts } = useLocalization();\n const { rows, setRowHeight, rowProps, tableProps, instance, prepareRow, rowHeights } = data;\n const row = rows[index];\n const ref = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (ref?.current) {\n setRowHeight(index, ref.current.getBoundingClientRect().height);\n }\n }, [rowHeights[index]]);\n\n if (row) {\n prepareRow(row, index);\n\n return (\n <Row\n {...rowProps}\n style={style}\n key={index}\n index={index}\n row={row}\n instance={instance}\n headerGroups={tableProps.headerGroups}\n setRowHeight={setRowHeight}\n ref={ref}\n />\n );\n }\n\n return (\n <div className=\"yt-table__row\" role=\"row\" style={style}>\n <div className=\"yt-table__cell text-grey-dark\">{texts.table.loading}</div>\n </div>\n );\n}, areEqual);\n\nconst getAverageRowHeight = (rowHeights = {}) => {\n const keys = Object.keys(rowHeights);\n const estimatedHeight = keys.reduce((p, i) => p + rowHeights[i], 0);\n return estimatedHeight / keys.length;\n};\n\nexport const WindowedTable = React.forwardRef(function WindowedTable<T>(\n props: TableProps<T> & { plugins: PluginHook<{}>[] },\n ref: React.Ref<TableRef>\n) {\n const tableRef: any = useProxiedRef<HTMLDivElement>(ref);\n const { emptyStateRenderer = DefaultEmptyState, length, loadMore, ...otherProps } = props;\n const { rowProps, tableProps, rows, prepareRow, instance, state } = useTable<T>({ ...otherProps, windowed: true }, tableRef);\n\n // determine heights for windowing calculations\n const headerRef = React.useRef<HTMLDivElement>(null);\n const [rowsRef, setRowsRef] = React.useState<any>(null);\n const tableDimensions = useBoundingClientRectListener(tableRef);\n const headerDimensions = useBoundingClientRectListener(headerRef);\n const height = tableDimensions && headerDimensions ? tableDimensions.height - headerDimensions.height : null;\n\n // variable row height calculations\n const estimatedRowHeight = rowProps.rowHeight || ROW_HEIGHT;\n const rowHeights = React.useRef<Record<string, number>>({});\n const setRowHeight = React.useCallback((index: number, size: number) => {\n if (rowHeights.current[index] !== size) {\n rowHeights.current = {\n ...rowHeights.current,\n [index]: size,\n };\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }\n }, []);\n const getRowHeight = React.useCallback(index => rowHeights.current[index] || estimatedRowHeight, []);\n\n React.useEffect(() => {\n if (rowsRef && rowProps.activeIndex !== undefined) {\n rowsRef.scrollToItem(rowProps.activeIndex, 'start');\n }\n }, [rowsRef, rowProps.activeIndex]);\n\n // trigger recalculation of variable row heights if the data changes\n React.useEffect(() => {\n rowHeights.current = {};\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }, [rows.length]);\n\n const contentHeight = estimatedRowHeight * props.data.length || 0;\n const isScrollbarVisible = height !== null ? contentHeight > height : false;\n\n const className = cn(tableProps.className, 'yt-table--windowed', { 'table-with-scrollbar': isScrollbarVisible });\n\n let list;\n\n const itemData = {\n rows,\n setRowHeight,\n rowProps,\n tableProps,\n instance,\n prepareRow,\n state,\n rowHeights: rowHeights.current,\n };\n\n if (height && rows.length) {\n const listProps = {\n height,\n itemData,\n estimatedItemSize: getAverageRowHeight(rowHeights.current),\n itemSize: getRowHeight,\n width: '100%',\n };\n\n if (loadMore && length) {\n const isLoaded = (index: number) => !!rows[index];\n\n list = (\n <InfiniteLoader isItemLoaded={isLoaded} itemCount={length} loadMoreItems={loadMore as any}>\n {({ onItemsRendered, ref }: any) => (\n <VariableSizeList\n {...listProps}\n itemCount={length}\n onItemsRendered={onItemsRendered}\n ref={list => {\n ref(list);\n setRowsRef(list);\n }}>\n {VariableRow}\n </VariableSizeList>\n )}\n </InfiniteLoader>\n );\n } else {\n list = (\n <VariableSizeList\n {...listProps}\n itemCount={rows.length}\n ref={ref => {\n setRowsRef(ref);\n }}>\n {VariableRow}\n </VariableSizeList>\n );\n }\n }\n\n return (\n <BaseTable {...tableProps} className={className} headerRef={headerRef} ref={tableRef}>\n {list ? list : emptyStateRenderer()}\n </BaseTable>\n );\n}) as ForwardedGenericTableWithStatics;\n\nWindowedTable.Column = () => null;\nWindowedTable.Group = () => null;\n"],"names":["ROW_HEIGHT","VariableRow","React","memo","data","index","style","height","_","texts","useLocalization","rows","setRowHeight","rowProps","tableProps","instance","prepareRow","rowHeights","row","ref","useRef","useEffect","current","getBoundingClientRect","Row","key","headerGroups","className","role","table","loading","areEqual","getAverageRowHeight","keys","Object","estimatedHeight","reduce","p","i","length","WindowedTable","forwardRef","props","tableRef","useProxiedRef","emptyStateRenderer","DefaultEmptyState","loadMore","otherProps","state","useTable","windowed","headerRef","rowsRef","setRowsRef","useState","tableDimensions","useBoundingClientRectListener","headerDimensions","estimatedRowHeight","rowHeight","useCallback","size","resetAfterIndex","getRowHeight","activeIndex","undefined","scrollToItem","contentHeight","isScrollbarVisible","cn","list","itemData","listProps","estimatedItemSize","itemSize","width","isLoaded","InfiniteLoader","isItemLoaded","itemCount","loadMoreItems","onItemsRendered","VariableSizeList","BaseTable","Column","Group"],"mappings":";;;;;;;;;;;AAaA,MAAMA,UAAU,GAAG,EAAnB;AAEA,MAAMC,WAAW,gBAAGC,cAAK,CAACC,IAAN,CAAW,CAAC;EAAEC,IAAF;EAAQC,KAAR;EAAeC,KAAK,EAAE;IAAEC,MAAM,EAAEC,CAAV;IAAa,GAAGF;;AAAtC,CAAD;EAC3B,MAAM;IAAEG;MAAUC,eAAe,EAAjC;EACA,MAAM;IAAEC,IAAF;IAAQC,YAAR;IAAsBC,Q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Actions.tsx"],"sourcesContent":["import React from 'react';\nimport { PluginHook } from 'react-table';\nimport { InView } from 'react-intersection-observer';\nimport { sanitizeRowProps } from '../../util';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { LocalizationTexts } from '../../../Provider/Provider';\nimport { Menu } from '../../../Menu/Menu';\nimport { RowAction, RowActionHandler, TableRow } from '../../types';\n\nconst actionGroupClassName = '-mt-1 -mb-1 h-8 flex';\n\nconst hasActions = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n return (\n !!actions ||\n handlers.onRowCreate ||\n handlers.onRowCopy ||\n handlers.onRowDelete ||\n !!inlineEditingUniqueId ||\n handlers.onRowEdit\n );\n};\n\nconst getActions = (\n actions: RowActionHandler<any>[] | undefined,\n row: TableRow<any> | undefined = undefined\n): [RowAction<any>[], RowAction<any>[]] => {\n const primary: RowAction<any>[] = [];\n const secondary: RowAction<any>[] = [];\n\n if (actions) {\n let visibleActions = actions.filter(x => !!x);\n\n if (row) {\n visibleActions = visibleActions.filter((action: RowAction<any>) => {\n if (action.visible !== undefined) {\n if (typeof action.visible === 'function') {\n return action.visible(row);\n }\n\n return action.visible;\n }\n\n return true;\n });\n }\n\n visibleActions.forEach((action: RowAction<any>) => {\n if (action.showOnRow) {\n primary.push(action);\n } else {\n secondary.push(action);\n }\n });\n }\n\n return [primary, secondary];\n};\n\nconst getLength = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n const [primaryActions, secondaryActions] = getActions(actions);\n\n let length = primaryActions.length + (secondaryActions.length ? 1 : 0);\n\n if (handlers.onRowCreate) {\n length++;\n }\n\n if (handlers.onRowCopy) {\n length++;\n }\n\n if (handlers.onRowDelete) {\n length++;\n }\n\n if (!!inlineEditingUniqueId || handlers.onRowEdit) {\n length++;\n\n if (length < 2) {\n length++;\n }\n }\n\n return length;\n};\n\nconst getActionProps = (action: RowAction<any>, row: TableRow<any>) => {\n return {\n 'aria-label': typeof action.tooltip === 'function' ? action.tooltip(row) : action.tooltip,\n disabled: typeof action.disabled === 'function' ? action.disabled(row) : action.disabled,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n action.onClick(row, event);\n },\n };\n};\n\nconst EditModeActions = () => {\n React.useEffect(() => {\n const listener = (event: any) => {\n if (event.key === 'Escape' && event.target?.form?.reset) {\n event.preventDefault();\n event.target.form.reset();\n }\n };\n\n document.addEventListener('keydown', listener);\n\n return () => {\n document.removeEventListener('keydown', listener);\n };\n }, []);\n\n return (\n <div className={actionGroupClassName}>\n <IconButton appearance=\"primary\" icon=\"tick\" type=\"submit\" className=\"mr-2\" />\n <IconButton appearance=\"ghost\" icon=\"close\" type=\"reset\" />\n </div>\n );\n};\n\nexport const useRowActions = <T extends {}>(\n inlineEditingUniqueId: keyof T | undefined,\n handlers: any,\n actions: RowActionHandler<T>[] | undefined,\n rowExpansionRenderer: any,\n texts: LocalizationTexts,\n windowed = false\n): PluginHook<{}> => {\n const inlineEditing = !!inlineEditingUniqueId;\n const actionsLength = getLength(inlineEditingUniqueId, handlers, actions);\n\n const plugin = (hooks: any): void => {\n if (hasActions(inlineEditingUniqueId, handlers, actions)) {\n hooks.visibleColumns.push((columns: any) => [\n ...columns,\n {\n id: '_actions',\n className: 'flex justify-end px-1 overflow-visible',\n flex: `0 0 calc((${actionsLength} * 2rem) + .5rem)`,\n Cell: ({ row }: any) => {\n if (row.isEditing) {\n return <EditModeActions />;\n }\n\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n const [primaryActions, secondaryActions] = getActions(actions, sanitizedRow);\n\n const output = (\n <>\n {handlers.onRowCreate && (\n <IconButton\n appearance=\"discrete\"\n icon=\"circle-plus\"\n aria-label={texts.table.newSubRow}\n tooltip={texts.table.newSubRow}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n\n if (!row.isExpanded) {\n row.toggleRowExpanded();\n }\n\n handlers.onRowCreate(sanitizedRow, event);\n }}\n />\n )}\n {(inlineEditing || handlers.onRowEdit) && (\n <IconButton\n appearance=\"discrete\"\n icon=\"edit\"\n aria-label={texts.table.edit}\n tooltip={texts.table.edit}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n\n if (inlineEditing) {\n row.toggleRowEditing();\n } else if (handlers.onRowEdit) {\n event.persist();\n handlers.onRowEdit(sanitizedRow, event);\n }\n }}\n />\n )}\n {handlers.onRowCopy && (\n <IconButton\n appearance=\"discrete\"\n icon=\"copy\"\n aria-label={texts.table.copy}\n tooltip={texts.table.copy}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowCopy(sanitizedRow, event);\n }}\n />\n )}\n {handlers.onRowDelete && (\n <IconButton\n appearance=\"discrete\"\n icon=\"delete\"\n aria-label={texts.table.del}\n tooltip={texts.table.del}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowDelete(sanitizedRow, event);\n }}\n />\n )}\n {primaryActions.map((action: RowAction<T>, index: number) => (\n <IconButton\n {...getActionProps(action, sanitizedRow)}\n key={index}\n appearance=\"discrete\"\n icon={typeof action.icon === 'function' ? action.icon(sanitizedRow) : action.icon}\n tooltip={\n typeof action.tooltip === 'function' ? action.tooltip(sanitizedRow) : action.tooltip\n }\n />\n ))}\n {secondaryActions.length ? (\n <Menu>\n <Menu.Trigger>\n <IconButton\n appearance=\"discrete\"\n icon=\"ellipsis-vertical\"\n aria-label={texts.table.actions}\n tooltip={texts.table.actions}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n }}\n />\n </Menu.Trigger>\n <Menu.Content>\n {secondaryActions.map((action: RowAction<T>, index: number) => (\n <Menu.Item\n key={index}\n icon={\n typeof action.icon === 'function'\n ? action.icon(sanitizedRow)\n : action.icon\n }\n {...getActionProps(action, sanitizedRow)}\n >\n {typeof action.text === 'function' ? action.text(sanitizedRow) : action.text}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n ) : null}\n </>\n );\n\n if (windowed) {\n return <div className={actionGroupClassName}>{output}</div>;\n }\n\n return (\n <InView rootMargin=\"100px 0px\">\n {({ inView, ref }) => (\n <div className={actionGroupClassName} ref={ref}>\n {inView ? output : null}\n </div>\n )}\n </InView>\n );\n },\n },\n ]);\n }\n };\n plugin.pluginName = 'useRowActions';\n return plugin;\n};\n"],"names":["actionGroupClassName","hasActions","inlineEditingUniqueId","handlers","actions","onRowCreate","onRowCopy","onRowDelete","onRowEdit","getActions","row","undefined","primary","secondary","visibleActions","filter","x","action","visible","forEach","showOnRow","push","getLength","primaryActions","secondaryActions","length","getActionProps","tooltip","disabled","onClick","event","EditModeActions","React","useEffect","listener","key","target","form","reset","preventDefault","document","addEventListener","removeEventListener","className","IconButton","appearance","icon","type","useRowActions","rowExpansionRenderer","texts","windowed","inlineEditing","actionsLength","plugin","hooks","visibleColumns","columns","id","flex","Cell","isEditing","sanitizedRow","sanitizeRowProps","output","table","newSubRow","canEdit","stopPropagation","persist","setActive","isExpanded","toggleRowExpanded","edit","toggleRowEditing","copy","del","map","index","Menu","Trigger","Content","Item","text","InView","rootMargin","inView","ref","pluginName"],"mappings":";;;;;;AASA,MAAMA,oBAAoB,GAAG,sBAA7B;;AAEA,MAAMC,UAAU,GAAG,CAACC,qBAAD,EAA6BC,QAA7B,EAA4CC,OAA5C;EACf,OACI,CAAC,CAACA,OAAF,IACAD,QAAQ,CAACE,WADT,IAEAF,QAAQ,CAACG,SAFT,IAGAH,QAAQ,CAACI,WAHT,IAIA,CAAC,CAACL,qBAJF,IAKAC,QAAQ,CAACK,SANb;AAQH,CATD;;AAWA,MAAMC,UAAU,GAAG,CACfL,OADe,EAEfM,MAAiCC,SAFlB;EAIf,MAAMC,OAAO,GAAqB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GAAjB,CAAqB,CAAC5D,MAAD,EAAuB6D,KAAvB,KAClB9C,4BAAA,CAAC+C,IAAI,CAACG,IAAN;YACI/C,GAAG,EAAE2C;YACLhC,IAAI,EACA,OAAO7B,MAAM,CAAC6B,IAAd,KAAuB,UAAvB,GACM7B,MAAM,CAAC6B,IAAP,CAAYgB,YAAZ,CADN,GAEM7C,MAAM,CAAC6B;aAEbpB,cAAc,CAACT,MAAD,EAAS6C,YAAT,EAPtB,EASK,OAAO7C,MAAM,CAACkE,IAAd,KAAuB,UAAvB,GAAoClE,MAAM,CAACkE,IAAP,CAAYrB,YAAZ,CAApC,GAAgE7C,MAAM,CAACkE,IAT5E,CADH,CADL,CAdJ,CADH,GA+BG,IAjHR,CADJ;;UAsHA,IAAIhC,QAAJ,EAAc;YACV,OAAOnB,4BAAA,MAAA;cAAKW,SAAS,EAAE3C;aAAhB,EAAuCgE,MAAvC,CAAP;;;UAGJ,OACIhC,4BAAA,CAACoD,MAAD;YAAQC,UAAU,EAAC;WAAnB,EACK,CAAC;YAAEC,MAAF;YAAUC;WAAX,KACGvD,4BAAA,MAAA;YAAKW,SAAS,EAAE3C;YAAsBuF,GAAG,EAAEA;WAA3C,EACKD,MAAM,GAAGtB,MAAH,GAAY,IADvB,CAFR,CADJ;;OAxIgC,CAA5C;;GAFR;;EAwJAV,MAAM,CAACkC,UAAP,GAAoB,eAApB;EACA,OAAOlC,MAAP;AACH;;;;"}
1
+ {"version":3,"file":"useRowActions.js","sources":["../../../../../../src/components/Table/hooks/plugins/useRowActions.tsx"],"sourcesContent":["import React from 'react';\nimport { PluginHook } from 'react-table';\nimport { InView } from 'react-intersection-observer';\nimport { sanitizeRowProps } from '../../util';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { LocalizationTexts } from '../../../Provider/Provider';\nimport { Menu } from '../../../Menu/Menu';\nimport { RowAction, RowActionHandler, TableRow } from '../../types';\n\nconst actionGroupClassName = '-mt-1 -mb-1 h-8 flex';\n\nconst hasActions = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n return (\n !!actions ||\n handlers.onRowCreate ||\n handlers.onRowCopy ||\n handlers.onRowDelete ||\n !!inlineEditingUniqueId ||\n handlers.onRowEdit\n );\n};\n\nconst getActions = (\n actions: RowActionHandler<any>[] | undefined,\n row: TableRow<any> | undefined = undefined\n): [RowAction<any>[], RowAction<any>[]] => {\n const primary: RowAction<any>[] = [];\n const secondary: RowAction<any>[] = [];\n\n if (actions) {\n let visibleActions = actions.filter(x => !!x);\n\n if (row) {\n visibleActions = visibleActions.filter((action: RowAction<any>) => {\n if (action.visible !== undefined) {\n if (typeof action.visible === 'function') {\n return action.visible(row);\n }\n\n return action.visible;\n }\n\n return true;\n });\n }\n\n visibleActions.forEach((action: RowAction<any>) => {\n if (action.showOnRow) {\n primary.push(action);\n } else {\n secondary.push(action);\n }\n });\n }\n\n return [primary, secondary];\n};\n\nconst getLength = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n const [primaryActions, secondaryActions] = getActions(actions);\n\n let length = primaryActions.length + (secondaryActions.length ? 1 : 0);\n\n if (handlers.onRowCreate) {\n length++;\n }\n\n if (handlers.onRowCopy) {\n length++;\n }\n\n if (handlers.onRowDelete) {\n length++;\n }\n\n if (!!inlineEditingUniqueId || handlers.onRowEdit) {\n length++;\n\n if (length < 2) {\n length++;\n }\n }\n\n return length;\n};\n\nconst getActionProps = (action: RowAction<any>, row: TableRow<any>) => {\n return {\n 'aria-label': typeof action.tooltip === 'function' ? action.tooltip(row) : action.tooltip,\n disabled: typeof action.disabled === 'function' ? action.disabled(row) : action.disabled,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n action.onClick(row, event);\n },\n };\n};\n\nconst EditModeActions = () => {\n React.useEffect(() => {\n const listener = (event: any) => {\n if (event.key === 'Escape' && event.target?.form?.reset) {\n event.preventDefault();\n event.target.form.reset();\n }\n };\n\n document.addEventListener('keydown', listener);\n\n return () => {\n document.removeEventListener('keydown', listener);\n };\n }, []);\n\n return (\n <div className={actionGroupClassName}>\n <IconButton appearance=\"primary\" icon=\"tick\" type=\"submit\" className=\"mr-2\" />\n <IconButton appearance=\"ghost\" icon=\"close\" type=\"reset\" />\n </div>\n );\n};\n\nexport const useRowActions = <T extends {}>(\n inlineEditingUniqueId: keyof T | undefined,\n handlers: any,\n actions: RowActionHandler<T>[] | undefined,\n rowExpansionRenderer: any,\n texts: LocalizationTexts,\n windowed = false\n): PluginHook<{}> => {\n const inlineEditing = !!inlineEditingUniqueId;\n const actionsLength = getLength(inlineEditingUniqueId, handlers, actions);\n\n const plugin = (hooks: any): void => {\n if (hasActions(inlineEditingUniqueId, handlers, actions)) {\n hooks.visibleColumns.push((columns: any) => [\n ...columns,\n {\n id: '_actions',\n className: 'flex justify-end px-1 overflow-visible',\n flex: `0 0 calc((${actionsLength} * 2rem) + .5rem)`,\n Cell: ({ row }: any) => {\n if (row.isEditing) {\n return <EditModeActions />;\n }\n\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n const [primaryActions, secondaryActions] = getActions(actions, sanitizedRow);\n\n const output = (\n <>\n {handlers.onRowCreate && (\n <IconButton\n appearance=\"discrete\"\n icon=\"circle-plus\"\n aria-label={texts.table.newSubRow}\n tooltip={texts.table.newSubRow}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n\n if (!row.isExpanded) {\n row.toggleRowExpanded();\n }\n\n handlers.onRowCreate(sanitizedRow, event);\n }}\n />\n )}\n {(inlineEditing || handlers.onRowEdit) && (\n <IconButton\n appearance=\"discrete\"\n icon=\"edit\"\n aria-label={texts.table.edit}\n tooltip={texts.table.edit}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n\n if (inlineEditing) {\n row.toggleRowEditing();\n } else if (handlers.onRowEdit) {\n event.persist();\n handlers.onRowEdit(sanitizedRow, event);\n }\n }}\n />\n )}\n {handlers.onRowCopy && (\n <IconButton\n appearance=\"discrete\"\n icon=\"copy\"\n aria-label={texts.table.copy}\n tooltip={texts.table.copy}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowCopy(sanitizedRow, event);\n }}\n />\n )}\n {handlers.onRowDelete && (\n <IconButton\n appearance=\"discrete\"\n icon=\"delete\"\n aria-label={texts.table.del}\n tooltip={texts.table.del}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowDelete(sanitizedRow, event);\n }}\n />\n )}\n {primaryActions.map((action: RowAction<T>, index: number) => (\n <IconButton\n {...getActionProps(action, sanitizedRow)}\n key={index}\n appearance=\"discrete\"\n icon={typeof action.icon === 'function' ? action.icon(sanitizedRow) : action.icon}\n tooltip={\n typeof action.tooltip === 'function' ? action.tooltip(sanitizedRow) : action.tooltip\n }\n />\n ))}\n {secondaryActions.length ? (\n <Menu>\n <Menu.Trigger>\n <IconButton\n appearance=\"discrete\"\n icon=\"ellipsis-vertical\"\n aria-label={texts.table.actions}\n tooltip={texts.table.actions}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n }}\n />\n </Menu.Trigger>\n <Menu.Content>\n {secondaryActions.map((action: RowAction<T>, index: number) => (\n <Menu.Item\n key={index}\n icon={\n typeof action.icon === 'function'\n ? action.icon(sanitizedRow)\n : action.icon\n }\n {...getActionProps(action, sanitizedRow)}>\n {typeof action.text === 'function' ? action.text(sanitizedRow) : action.text}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n ) : null}\n </>\n );\n\n if (windowed) {\n return <div className={actionGroupClassName}>{output}</div>;\n }\n\n return (\n <InView rootMargin=\"100px 0px\">\n {({ inView, ref }) => (\n <div className={actionGroupClassName} ref={ref}>\n {inView ? output : null}\n </div>\n )}\n </InView>\n );\n },\n },\n ]);\n }\n };\n plugin.pluginName = 'useRowActions';\n return plugin;\n};\n"],"names":["actionGroupClassName","hasActions","inlineEditingUniqueId","handlers","actions","onRowCreate","onRowCopy","onRowDelete","onRowEdit","getActions","row","undefined","primary","secondary","visibleActions","filter","x","action","visible","forEach","showOnRow","push","getLength","primaryActions","secondaryActions","length","getActionProps","tooltip","disabled","onClick","event","EditModeActions","React","useEffect","listener","key","target","form","reset","preventDefault","document","addEventListener","removeEventListener","className","IconButton","appearance","icon","type","useRowActions","rowExpansionRenderer","texts","windowed","inlineEditing","actionsLength","plugin","hooks","visibleColumns","columns","id","flex","Cell","isEditing","sanitizedRow","sanitizeRowProps","output","table","newSubRow","canEdit","stopPropagation","persist","setActive","isExpanded","toggleRowExpanded","edit","toggleRowEditing","copy","del","map","index","Menu","Trigger","Content","Item","text","InView","rootMargin","inView","ref","pluginName"],"mappings":";;;;;;AASA,MAAMA,oBAAoB,GAAG,sBAA7B;;AAEA,MAAMC,UAAU,GAAG,CAACC,qBAAD,EAA6BC,QAA7B,EAA4CC,OAA5C;EACf,OACI,CAAC,CAACA,OAAF,IACAD,QAAQ,CAACE,WADT,IAEAF,QAAQ,CAACG,SAFT,IAGAH,QAAQ,CAACI,WAHT,IAIA,CAAC,CAACL,qBAJF,IAKAC,QAAQ,CAACK,SANb;AAQH,CATD;;AAWA,MAAMC,UAAU,GAAG,CACfL,OADe,EAEfM,MAAiCC,SAFlB;EAIf,MAAMC,OAAO,GAAqB,EAAlC;EACA,MAAMC,SAAS,GAAqB,EAApC;;EAEA,IAAIT,OAAJ,EAAa;IACT,IAAIU,cAAc,GAAGV,OAAO,CAACW,MAAR,CAAeC,CAAC,IAAI,CAAC,CAACA,CAAtB,CAArB;;IAEA,IAAIN,GAAJ,EAAS;MACLI,cAAc,GAAGA,cAAc,CAACC,MAAf,CAAuBE,MAAD;QACnC,IAAIA,MAAM,CAACC,OAAP,KAAmBP,SAAvB,EAAk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tB,EAQK,OAAO7C,MAAM,CAACkE,IAAd,KAAuB,UAAvB,GAAoClE,MAAM,CAACkE,IAAP,CAAYrB,YAAZ,CAApC,GAAgE7C,MAAM,CAACkE,IAR5E,CADH,CADL,CAdJ,CADH,GA8BG,IAhHR,CADJ;;UAqHA,IAAIhC,QAAJ,EAAc;YACV,OAAOnB,4BAAA,MAAA;cAAKW,SAAS,EAAE3C;aAAhB,EAAuCgE,MAAvC,CAAP;;;UAGJ,OACIhC,4BAAA,CAACoD,MAAD;YAAQC,UAAU,EAAC;WAAnB,EACK,CAAC;YAAEC,MAAF;YAAUC;WAAX,KACGvD,4BAAA,MAAA;YAAKW,SAAS,EAAE3C;YAAsBuF,GAAG,EAAEA;WAA3C,EACKD,MAAM,GAAGtB,MAAH,GAAY,IADvB,CAFR,CADJ;;OAvIgC,CAA5C;;GAFR;;EAuJAV,MAAM,CAACkC,UAAP,GAAoB,eAApB;EACA,OAAOlC,MAAP;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sources":["../../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\n\nimport { Orientation } from '../../types';\nimport './Tabs.css';\n\nexport type TabsProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * The controlled value of the tab to activate. Should be used in conjunction with `onChange`.\n */\n id?: string;\n /**\n * Set which tab is selected on mount.\n * This has to be one of the existing ids provided for tabs\n */\n defaultId?: string;\n /**\n * Content should be one or an array of `Tabs.Trigger` components inside `Tabs.List` and then\n * followed by one or an array of `Tabs.Content`.\n * *Note* that there can also be tabs that are rendered conditionally.\n */\n children: React.ReactNode;\n /**\n * Define orientation of tabs.\n * @defaultValue horizontal\n */\n orientation?: Orientation;\n /**\n * Callback that is called when tab is changed.\n */\n onChange?: (id: string) => void;\n};\n\nexport type TabListProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type TabTriggerProps = React.HTMLAttributes<HTMLButtonElement> & {\n /**\n * A unique value that associates the trigger with a content.\n */\n id: string;\n /**\n * When true, prevents the user from interacting with the tab.\n */\n disabled?: boolean;\n};\n\nexport type TabContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * A unique value that associates the content with a trigger.\n */\n id: string;\n};\n\nexport type ForwardedTabsWithStatics = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>> & {\n /** Tab list component containing all tab triggers, rendered in a `Tabs` group component */\n List: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement>>;\n /** Tab trigger component rendered in a `Tabs.List` component */\n Trigger: React.ForwardRefExoticComponent<TabTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n /** Tab content component rendered in a `Tabs` group component */\n Content: React.ForwardRefExoticComponent<TabContentProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Tabs = React.forwardRef(function Tabs(props: TabsProps, ref: React.Ref<HTMLDivElement>) {\n const { id, defaultId, children, onChange, orientation = 'horizontal', ...otherProps } = props;\n const className = cn(\n 'yt-tabs',\n `yt-tabs--${orientation}`,\n {\n 'flex w-full': orientation === 'vertical',\n },\n props.className\n );\n\n return (\n <TabsPrimitive.Root\n {...otherProps}\n className={className}\n data-taco=\"tabs\"\n defaultValue={defaultId}\n dir=\"ltr\"\n onValueChange={onChange}\n orientation={orientation}\n ref={ref}\n value={id}\n >\n {children}\n </TabsPrimitive.Root>\n );\n}) as ForwardedTabsWithStatics;\n\nconst TabList = React.forwardRef(function Tab(props: TabListProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('yt-tab__list border-b border-grey-light flex flex-row m-0 mb-4', props.className);\n\n return <TabsPrimitive.List {...props} className={className} ref={ref} />;\n});\n\nconst TabTrigger = React.forwardRef(function Tab(props: TabTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const { id, disabled, ...otherProps } = props;\n const className = cn(\n 'yt-tab bg-transparent border-b-2 border-transparent text-grey-darkest m-0 py-2 px-4',\n disabled\n ? 'cursor-not-allowed !text-grey-darker'\n : 'cursor-pointer rounded-t hover:border-grey-dark aria-selected:border-blue aria-selected:text-black aria-selected:hover:border-blue-light hover:text-black active:yt-focus active:border-blue focus:yt-focus focus:border-blue',\n props.className\n );\n\n return (\n <TabsPrimitive.Trigger\n {...otherProps}\n className={className}\n disabled={disabled}\n ref={ref}\n style={{\n transition: 'border 0.2s ease-in',\n }}\n value={id}\n />\n );\n});\n\nconst TabContent = React.forwardRef(function Tab(props: TabContentProps, ref: React.Ref<HTMLDivElement>) {\n const { id, ...otherProps } = props;\n const className = cn('yt-tab__panel outline-none', props.className);\n\n return <TabsPrimitive.Content {...otherProps} className={className} ref={ref} value={id} />;\n});\n\nTabs.List = TabList;\nTabs.Trigger = TabTrigger;\nTabs.Content = TabContent;\n"],"names":["Tabs","React","props","ref","id","defaultId","children","onChange","orientation","otherProps","className","cn","TabsPrimitive","defaultValue","dir","onValueChange","value","TabList","Tab","TabTrigger","disabled","style","transition","TabContent","List","Trigger","Content"],"mappings":";;;;MA+DaA,IAAI,gBAAGC,UAAA,CAAiB,SAASD,IAAT,CAAcE,KAAd,EAAgCC,GAAhC;EACjC,MAAM;IAAEC,EAAF;IAAMC,SAAN;IAAiBC,QAAjB;IAA2BC,QAA3B;IAAqCC,WAAW,GAAG,YAAnD;IAAiE,GAAGC;MAAeP,KAAzF;EACA,MAAMQ,SAAS,GAAGC,EAAE,CAChB,SADgB,cAEJH,aAFI,EAGhB;IACI,eAAeA,WAAW,KAAK;GAJnB,EAMhBN,KAAK,CAACQ,SANU,CAApB;EASA,OACIT,aAAA,CAACW,IAAD,oBACQH;IACJC,SAAS,EAAEA;iBACD;IACVG,YAAY,EAAER;IACdS,GAAG,EAAC;IACJC,aAAa,EAAER;IACfC,WAAW,EAAEA;IACbL,GAAG,EAAEA;IACLa,KAAK,EAAEZ;IATX,EAWKE,QAXL,CADJ;AAeH,CA1BmB;AA4BpB,MAAMW,OAAO,gBAAGhB,UAAA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tabs/Tabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\n\nimport { Orientation } from '../../types';\nimport './Tabs.css';\n\nexport type TabsProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * The controlled value of the tab to activate. Should be used in conjunction with `onChange`.\n */\n id?: string;\n /**\n * Set which tab is selected on mount.\n * This has to be one of the existing ids provided for tabs\n */\n defaultId?: string;\n /**\n * Content should be one or an array of `Tabs.Trigger` components inside `Tabs.List` and then\n * followed by one or an array of `Tabs.Content`.\n * *Note* that there can also be tabs that are rendered conditionally.\n */\n children: React.ReactNode;\n /**\n * Define orientation of tabs.\n * @defaultValue horizontal\n */\n orientation?: Orientation;\n /**\n * Callback that is called when tab is changed.\n */\n onChange?: (id: string) => void;\n};\n\nexport type TabListProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type TabTriggerProps = React.HTMLAttributes<HTMLButtonElement> & {\n /**\n * A unique value that associates the trigger with a content.\n */\n id: string;\n /**\n * When true, prevents the user from interacting with the tab.\n */\n disabled?: boolean;\n};\n\nexport type TabContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * A unique value that associates the content with a trigger.\n */\n id: string;\n};\n\nexport type ForwardedTabsWithStatics = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>> & {\n /** Tab list component containing all tab triggers, rendered in a `Tabs` group component */\n List: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement>>;\n /** Tab trigger component rendered in a `Tabs.List` component */\n Trigger: React.ForwardRefExoticComponent<TabTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n /** Tab content component rendered in a `Tabs` group component */\n Content: React.ForwardRefExoticComponent<TabContentProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Tabs = React.forwardRef(function Tabs(props: TabsProps, ref: React.Ref<HTMLDivElement>) {\n const { id, defaultId, children, onChange, orientation = 'horizontal', ...otherProps } = props;\n const className = cn(\n 'yt-tabs',\n `yt-tabs--${orientation}`,\n {\n 'flex w-full': orientation === 'vertical',\n },\n props.className\n );\n\n return (\n <TabsPrimitive.Root\n {...otherProps}\n className={className}\n data-taco=\"tabs\"\n defaultValue={defaultId}\n dir=\"ltr\"\n onValueChange={onChange}\n orientation={orientation}\n ref={ref}\n value={id}>\n {children}\n </TabsPrimitive.Root>\n );\n}) as ForwardedTabsWithStatics;\n\nconst TabList = React.forwardRef(function Tab(props: TabListProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('yt-tab__list border-b border-grey-light flex flex-row m-0 mb-4', props.className);\n\n return <TabsPrimitive.List {...props} className={className} ref={ref} />;\n});\n\nconst TabTrigger = React.forwardRef(function Tab(props: TabTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const { id, disabled, ...otherProps } = props;\n const className = cn(\n 'yt-tab bg-transparent border-b-2 border-transparent text-grey-darkest m-0 py-2 px-4',\n disabled\n ? 'cursor-not-allowed !text-grey-darker'\n : 'cursor-pointer rounded-t hover:border-grey-dark aria-selected:border-blue aria-selected:text-black aria-selected:hover:border-blue-light hover:text-black active:yt-focus active:border-blue focus:yt-focus focus:border-blue',\n props.className\n );\n\n return (\n <TabsPrimitive.Trigger\n {...otherProps}\n className={className}\n disabled={disabled}\n ref={ref}\n style={{\n transition: 'border 0.2s ease-in',\n }}\n value={id}\n />\n );\n});\n\nconst TabContent = React.forwardRef(function Tab(props: TabContentProps, ref: React.Ref<HTMLDivElement>) {\n const { id, ...otherProps } = props;\n const className = cn('yt-tab__panel outline-none', props.className);\n\n return <TabsPrimitive.Content {...otherProps} className={className} ref={ref} value={id} />;\n});\n\nTabs.List = TabList;\nTabs.Trigger = TabTrigger;\nTabs.Content = TabContent;\n"],"names":["Tabs","React","props","ref","id","defaultId","children","onChange","orientation","otherProps","className","cn","TabsPrimitive","defaultValue","dir","onValueChange","value","TabList","Tab","TabTrigger","disabled","style","transition","TabContent","List","Trigger","Content"],"mappings":";;;;MA+DaA,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N,KAAK,EAAEZ;IARX,CADJ;AAYH,CAtBkB,CAAnB;AAwBA,MAAMmB,UAAU,gBAAGtB,UAAA,CAAiB,SAASiB,GAAT,CAAahB,KAAb,EAAqCC,GAArC;EAChC,MAAM;IAAEC,EAAF;IAAM,GAAGK;MAAeP,KAA9B;EACA,MAAMQ,SAAS,GAAGC,EAAE,CAAC,4BAAD,EAA+BT,KAAK,CAACQ,SAArC,CAApB;EAEA,OAAOT,aAAA,CAACW,OAAD,oBAA2BH;IAAYC,SAAS,EAAEA;IAAWP,GAAG,EAAEA;IAAKa,KAAK,EAAEZ;IAA9E,CAAP;AACH,CALkB,CAAnB;AAOAJ,IAAI,CAACwB,IAAL,GAAYP,OAAZ;AACAjB,IAAI,CAACyB,OAAL,GAAeN,UAAf;AACAnB,IAAI,CAAC0B,OAAL,GAAeH,UAAf;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\n\nexport type TooltipProps = React.HTMLAttributes<HTMLDivElement> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Text displayed in the tooltip */\n title: string;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, ...otherProps } = props;\n\n return (\n <TooltipPrimitive.Root delayDuration={50}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Content {...otherProps} asChild side={placement} sideOffset={3}>\n <div\n className=\"wcag-purple max-w-[theme(spacing.56)] animate-[fade-in_150ms] rounded-sm px-2 py-1 text-xs font-bold opacity-90\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}\n >\n <TooltipPrimitive.Arrow className=\"fill-purple stroke-purple\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","otherProps","TooltipPrimitive","delayDuration","asChild","side","sideOffset","className","style","transformOrigin"],"mappings":";;;MAeaA,OAAO,gBAAGC,UAAA,CAAiB,SAASD,OAAT,CAAiBE,KAAjB,EAAsCC,GAAtC;EACpC,MAAM;IAAEC,KAAF;IAASC,QAAT;IAAmBC,SAAnB;IAA8B,GAAGC;MAAeL,KAAtD;EAEA,OACID,aAAA,CAACO,IAAD;IAAuBC,aAAa,EAAE;GAAtC,EACIR,aAAA,CAACO,OAAD;IAA0BE,OAAO;IAACP,GAAG,EAAEA;GAAvC,EACKE,QADL,CADJ,EAIIJ,aAAA,CAACO,OAAD,oBAA8BD;IAAYG,OAAO;IAACC,IAAI,EAAEL;IAAWM,UAAU,EAAE;IAA/E,EACIX,aAAA,MAAA;IACIY,SAAS,EAAC;iBACA;IACVC,KAAK,EAAE;MACHC,eAAe,EAAE;;GAJzB,EAOId,aAAA,CAACO,KAAD;IAAwBK,SAAS,EAAC;GAAlC,CAPJ,EAQKT,KARL,CADJ,CAJJ,CADJ;AAmBH,CAtBsB;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\n\nexport type TooltipProps = React.HTMLAttributes<HTMLDivElement> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Text displayed in the tooltip */\n title: string;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, ...otherProps } = props;\n\n return (\n <TooltipPrimitive.Root delayDuration={50}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Content {...otherProps} asChild side={placement} sideOffset={3}>\n <div\n className=\"wcag-purple max-w-[theme(spacing.56)] animate-[fade-in_150ms] rounded-sm px-2 py-1 text-xs font-bold opacity-90\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}>\n <TooltipPrimitive.Arrow className=\"fill-purple stroke-purple\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","otherProps","TooltipPrimitive","delayDuration","asChild","side","sideOffset","className","style","transformOrigin"],"mappings":";;;MAeaA,OAAO,gBAAGC,UAAA,CAAiB,SAASD,OAAT,CAAiBE,KAAjB,EAAsCC,GAAtC;EACpC,MAAM;IAAEC,KAAF;IAASC,QAAT;IAAmBC,SAAnB;IAA8B,GAAGC;MAAeL,KAAtD;EAEA,OACID,aAAA,CAACO,IAAD;IAAuBC,aAAa,EAAE;GAAtC,EACIR,aAAA,CAACO,OAAD;IAA0BE,OAAO;IAACP,GAAG,EAAEA;GAAvC,EACKE,QADL,CADJ,EAIIJ,aAAA,CAACO,OAAD,oBAA8BD;IAAYG,OAAO;IAACC,IAAI,EAAEL;IAAWM,UAAU,EAAE;IAA/E,EACIX,aAAA,MAAA;IACIY,SAAS,EAAC;iBACA;IACVC,KAAK,EAAE;MACHC,eAAe,EAAE;;GAJzB,EAMId,aAAA,CAACO,KAAD;IAAwBK,SAAS,EAAC;GAAlC,CANJ,EAOKT,KAPL,CADJ,CAJJ,CADJ;AAkBH,CArBsB;;;;"}
@@ -175,7 +175,7 @@
175
175
  }
176
176
 
177
177
  [data-taco='badge'] > [data-taco='spinner'] {
178
- @apply h-3 w-3 ml-2;
178
+ @apply ml-2 h-3 w-3;
179
179
  }
180
180
 
181
181
  [data-taco='badge'] > [data-taco='spinner'] svg circle {
@@ -332,11 +332,7 @@
332
332
  }
333
333
 
334
334
  [data-taco='calendar'] .DayPicker-Day--disabled {
335
- @apply text-grey-dark pointer-events-none w-4 cursor-default;
336
- }
337
-
338
- [data-taco='calendar'] .DayPicker-Day--disabled > span.dot {
339
- @apply bg-grey inline-block rounded-full p-2;
335
+ @apply text-grey-dark pointer-events-none cursor-default;
340
336
  }
341
337
 
342
338
  [data-taco='calendar'] .icon:hover,
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../src/primitives/Button.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement | HTMLAnchorElement> & {\n /** Content should be a text */\n children: React.ReactNode;\n /** Provides url for buttons being used as a link */\n href?: string;\n /** Provides target for buttons being used as a link */\n target?: '_self' | '_blank' | '_parent' | '_top';\n};\n\nconst Button = React.forwardRef(function Button(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { disabled, target, type = 'button', ...otherProps } = props;\n\n const Tag = props.href ? 'a' : 'button';\n\n return (\n <Tag\n {...otherProps}\n aria-disabled={disabled ? 'true' : undefined}\n disabled={disabled}\n target={Tag === 'a' ? target : undefined}\n type={Tag !== 'a' ? type : undefined}\n ref={ref as any}\n >\n {React.Children.count(props.children) > 1\n ? React.Children.map(props.children, child => (typeof child === 'string' ? <span>{child}</span> : child))\n : props.children}\n </Tag>\n );\n});\n\nexport { Button, ButtonProps };\n"],"names":["Button","React","props","ref","disabled","target","type","otherProps","Tag","href","undefined","count","children","map","child"],"mappings":";;MAWMA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;EAC5B,MAAM;IAAEC,QAAF;IAAYC,MAAZ;IAAoBC,IAAI,GAAG,QAA3B;IAAqC,GAAGC;MAAeL,KAA7D;EAEA,MAAMM,GAAG,GAAGN,KAAK,CAACO,IAAN,GAAa,GAAb,GAAmB,QAA/B;EAEA,OACIR,aAAA,CAACO,GAAD,oBACQD;qBACWH,QAAQ,GAAG,MAAH,GAAYM;IACnCN,QAAQ,EAAEA;IACVC,MAAM,EAAEG,GAAG,KAAK,GAAR,GAAcH,MAAd,GAAuBK;IAC/BJ,IAAI,EAAEE,GAAG,KAAK,GAAR,GAAcF,IAAd,GAAqBI;IAC3BP,GAAG,EAAEA;IANT,EAQKF,QAAA,CAAeU,KAAf,CAAqBT,KAAK,CAACU,QAA3B,IAAuC,CAAvC,GACKX,QAAA,CAAeY,GAAf,CAAmBX,KAAK,CAACU,QAAzB,EAAmCE,KAAK,IAAK,OAAOA,KAAP,KAAiB,QAAjB,GAA4Bb,aAAA,OAAA,MAAA,EAAOa,KAAP,CAA5B,GAAmDA,KAAhG,CADL,GAEKZ,KAAK,CAACU,QAVhB,CADJ;AAcH,CAnBc;;;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../src/primitives/Button.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement | HTMLAnchorElement> & {\n /** Content should be a text */\n children: React.ReactNode;\n /** Provides url for buttons being used as a link */\n href?: string;\n /** Provides target for buttons being used as a link */\n target?: '_self' | '_blank' | '_parent' | '_top';\n};\n\nconst Button = React.forwardRef(function Button(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { disabled, target, type = 'button', ...otherProps } = props;\n\n const Tag = props.href ? 'a' : 'button';\n\n return (\n <Tag\n {...otherProps}\n aria-disabled={disabled ? 'true' : undefined}\n disabled={disabled}\n target={Tag === 'a' ? target : undefined}\n type={Tag !== 'a' ? type : undefined}\n ref={ref as any}>\n {React.Children.count(props.children) > 1\n ? React.Children.map(props.children, child => (typeof child === 'string' ? <span>{child}</span> : child))\n : props.children}\n </Tag>\n );\n});\n\nexport { Button, ButtonProps };\n"],"names":["Button","React","props","ref","disabled","target","type","otherProps","Tag","href","undefined","count","children","map","child"],"mappings":";;MAWMA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;EAC5B,MAAM;IAAEC,QAAF;IAAYC,MAAZ;IAAoBC,IAAI,GAAG,QAA3B;IAAqC,GAAGC;MAAeL,KAA7D;EAEA,MAAMM,GAAG,GAAGN,KAAK,CAACO,IAAN,GAAa,GAAb,GAAmB,QAA/B;EAEA,OACIR,aAAA,CAACO,GAAD,oBACQD;qBACWH,QAAQ,GAAG,MAAH,GAAYM;IACnCN,QAAQ,EAAEA;IACVC,MAAM,EAAEG,GAAG,KAAK,GAAR,GAAcH,MAAd,GAAuBK;IAC/BJ,IAAI,EAAEE,GAAG,KAAK,GAAR,GAAcF,IAAd,GAAqBI;IAC3BP,GAAG,EAAEA;IANT,EAOKF,QAAA,CAAeU,KAAf,CAAqBT,KAAK,CAACU,QAA3B,IAAuC,CAAvC,GACKX,QAAA,CAAeY,GAAf,CAAmBX,KAAK,CAACU,QAAzB,EAAmCE,KAAK,IAAK,OAAOA,KAAP,KAAiB,QAAjB,GAA4Bb,aAAA,OAAA,MAAA,EAAOa,KAAP,CAA5B,GAAmDA,KAAhG,CADL,GAEKZ,KAAK,CAACU,QAThB,CADJ;AAaH,CAlBc;;;;"}
package/dist/index.css CHANGED
@@ -175,7 +175,7 @@
175
175
  }
176
176
 
177
177
  [data-taco='badge'] > [data-taco='spinner'] {
178
- @apply h-3 w-3 ml-2;
178
+ @apply ml-2 h-3 w-3;
179
179
  }
180
180
 
181
181
  [data-taco='badge'] > [data-taco='spinner'] svg circle {
@@ -332,11 +332,7 @@
332
332
  }
333
333
 
334
334
  [data-taco='calendar'] .DayPicker-Day--disabled {
335
- @apply text-grey-dark pointer-events-none w-4 cursor-default;
336
- }
337
-
338
- [data-taco='calendar'] .DayPicker-Day--disabled > span.dot {
339
- @apply bg-grey inline-block rounded-full p-2;
335
+ @apply text-grey-dark pointer-events-none cursor-default;
340
336
  }
341
337
 
342
338
  [data-taco='calendar'] .icon:hover,
@@ -4065,10 +4065,6 @@ const Provider = props => {
4065
4065
  const useTaco = () => React.useContext(Context);
4066
4066
  const useLocalization = () => useTaco().localization;
4067
4067
 
4068
- const renderDay = (day, modifiers) => modifiers.disabled ? React.createElement("span", {
4069
- className: "dot"
4070
- }) : day.getDate();
4071
-
4072
4068
  const thisYear = /*#__PURE__*/new Date().getFullYear();
4073
4069
  const years = [];
4074
4070
 
@@ -4137,6 +4133,7 @@ const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
4137
4133
  const {
4138
4134
  onChange: handleChange,
4139
4135
  value,
4136
+ disabledDays,
4140
4137
  ...otherProps
4141
4138
  } = props;
4142
4139
  const {
@@ -4187,10 +4184,9 @@ const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
4187
4184
  onTodayButtonClick: handleCalendarClickToday,
4188
4185
  captionElement: () => null,
4189
4186
  todayButton: texts.calendar.actions.today,
4190
- showOutsideDays: true,
4191
- renderDay: renderDay,
4192
4187
  numberOfMonths: 1,
4193
- ref: ref
4188
+ ref: ref,
4189
+ disabledDays: disabledDays
4194
4190
  })));
4195
4191
  });
4196
4192