@economic/taco 0.0.1-alpha.1533 → 0.0.1-alpha.8

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 (111) hide show
  1. package/dist/components/Backdrop/Backdrop.d.ts +3 -0
  2. package/dist/components/Button/Button.d.ts +39 -1
  3. package/dist/components/Button/util.d.ts +2 -0
  4. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  5. package/dist/components/Dialog/Context.d.ts +1 -0
  6. package/dist/components/Dialog/Dialog.d.ts +14 -12
  7. package/dist/components/Hanger/Hanger.d.ts +4 -9
  8. package/dist/components/Icon/components/MatchEntries.d.ts +3 -0
  9. package/dist/components/Icon/components/index.d.ts +1 -1
  10. package/dist/components/IconButton/IconButton.d.ts +38 -1
  11. package/dist/components/Input/Input.d.ts +1 -1
  12. package/dist/components/Menu/Menu.d.ts +2 -2
  13. package/dist/components/Menu/components/Item.d.ts +1 -1
  14. package/dist/components/Menu/components/Link.d.ts +1 -1
  15. package/dist/components/Navigation/Navigation.d.ts +4 -4
  16. package/dist/components/Popover/Popover.d.ts +5 -9
  17. package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
  18. package/dist/components/Select/Select.d.ts +4 -0
  19. package/dist/components/Select/useSelect.d.ts +1 -1
  20. package/dist/components/Table/Table.storyexample.d.ts +1 -1
  21. package/dist/components/Table/components/PaginatedTable.d.ts +2 -2
  22. package/dist/components/Table/components/Table.d.ts +2 -2
  23. package/dist/components/Table/components/WindowedTable.d.ts +2 -2
  24. package/dist/components/Table/types.d.ts +2 -2
  25. package/dist/components/Tabs/Tabs.d.ts +2 -2
  26. package/dist/components/Tooltip/Tooltip.d.ts +11 -1
  27. package/dist/components/Treeview/Treeview.d.ts +2 -2
  28. package/dist/esm/index.css +96 -119
  29. package/dist/esm/src/components/Backdrop/Backdrop.js +12 -0
  30. package/dist/esm/src/components/Backdrop/Backdrop.js.map +1 -0
  31. package/dist/esm/src/components/Button/Button.js +6 -9
  32. package/dist/esm/src/components/Button/Button.js.map +1 -1
  33. package/dist/esm/src/components/Button/util.js +42 -1
  34. package/dist/esm/src/components/Button/util.js.map +1 -1
  35. package/dist/esm/src/components/Calendar/Calendar.js +1 -1
  36. package/dist/esm/src/components/Checkbox/Checkbox.js +9 -1
  37. package/dist/esm/src/components/Checkbox/Checkbox.js.map +1 -1
  38. package/dist/esm/src/components/Combobox/useCombobox.js +1 -1
  39. package/dist/esm/src/components/Datepicker/Datepicker.js +2 -2
  40. package/dist/esm/src/components/Dialog/Context.js +1 -0
  41. package/dist/esm/src/components/Dialog/Context.js.map +1 -1
  42. package/dist/esm/src/components/Dialog/Dialog.js +5 -4
  43. package/dist/esm/src/components/Dialog/Dialog.js.map +1 -1
  44. package/dist/esm/src/components/Dialog/components/Content.js +13 -13
  45. package/dist/esm/src/components/Dialog/components/Content.js.map +1 -1
  46. package/dist/esm/src/components/Dialog/components/Drawer.js +2 -1
  47. package/dist/esm/src/components/Dialog/components/Drawer.js.map +1 -1
  48. package/dist/esm/src/components/Dialog/components/Extra.js +2 -1
  49. package/dist/esm/src/components/Dialog/components/Extra.js.map +1 -1
  50. package/dist/esm/src/components/Dialog/components/Trigger.js +2 -1
  51. package/dist/esm/src/components/Dialog/components/Trigger.js.map +1 -1
  52. package/dist/esm/src/components/Hanger/Hanger.js +12 -9
  53. package/dist/esm/src/components/Hanger/Hanger.js.map +1 -1
  54. package/dist/esm/src/components/Icon/components/MatchEntries.js +18 -0
  55. package/dist/esm/src/components/Icon/components/MatchEntries.js.map +1 -0
  56. package/dist/esm/src/components/Icon/components/index.js +2 -0
  57. package/dist/esm/src/components/Icon/components/index.js.map +1 -1
  58. package/dist/esm/src/components/IconButton/IconButton.js +9 -11
  59. package/dist/esm/src/components/IconButton/IconButton.js.map +1 -1
  60. package/dist/esm/src/components/Input/util.js +6 -6
  61. package/dist/esm/src/components/Input/util.js.map +1 -1
  62. package/dist/esm/src/components/Listbox/ScrollableList.js +1 -1
  63. package/dist/esm/src/components/Navigation/Navigation.js +5 -4
  64. package/dist/esm/src/components/Navigation/Navigation.js.map +1 -1
  65. package/dist/esm/src/components/Pagination/PageNumbers.js +1 -1
  66. package/dist/esm/src/components/Pagination/Pagination.js +2 -1
  67. package/dist/esm/src/components/Pagination/Pagination.js.map +1 -1
  68. package/dist/esm/src/components/Popover/Popover.js +9 -6
  69. package/dist/esm/src/components/Popover/Popover.js.map +1 -1
  70. package/dist/esm/src/components/RadioGroup/RadioGroup.js.map +1 -1
  71. package/dist/esm/src/components/SearchInput/SearchInput.js +8 -7
  72. package/dist/esm/src/components/SearchInput/SearchInput.js.map +1 -1
  73. package/dist/esm/src/components/Select/Select.js +2 -1
  74. package/dist/esm/src/components/Select/Select.js.map +1 -1
  75. package/dist/esm/src/components/Select/useSelect.js +12 -5
  76. package/dist/esm/src/components/Select/useSelect.js.map +1 -1
  77. package/dist/esm/src/components/Table/components/PaginatedTable.js.map +1 -1
  78. package/dist/esm/src/components/Table/components/Table.js.map +1 -1
  79. package/dist/esm/src/components/Table/components/WindowedTable.js.map +1 -1
  80. package/dist/esm/src/components/Table/hooks/plugins/useRowActions.js +11 -5
  81. package/dist/esm/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  82. package/dist/esm/src/components/Table/hooks/plugins/useRowSelect.js +3 -3
  83. package/dist/esm/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  84. package/dist/esm/src/components/Table/util/renderColumn.js +4 -3
  85. package/dist/esm/src/components/Table/util/renderColumn.js.map +1 -1
  86. package/dist/esm/src/components/Table/util/renderRow.js +4 -3
  87. package/dist/esm/src/components/Table/util/renderRow.js.map +1 -1
  88. package/dist/esm/src/components/Tabs/Tabs.js.map +1 -1
  89. package/dist/esm/src/components/Toast/Toast.js +1 -1
  90. package/dist/esm/src/components/Tooltip/Tooltip.js +11 -10
  91. package/dist/esm/src/components/Tooltip/Tooltip.js.map +1 -1
  92. package/dist/esm/src/components/Tour/Tour.js +2 -2
  93. package/dist/esm/src/components/Treeview/Treeview.js.map +1 -1
  94. package/dist/esm/src/index.js +8 -7
  95. package/dist/esm/src/index.js.map +1 -1
  96. package/dist/esm/src/primitives/Button.js +2 -12
  97. package/dist/esm/src/primitives/Button.js.map +1 -1
  98. package/dist/esm/src/utils/mergeRefs.js +14 -0
  99. package/dist/esm/src/utils/mergeRefs.js.map +1 -0
  100. package/dist/index.css +96 -119
  101. package/dist/index.d.ts +1 -0
  102. package/dist/primitives/Button.d.ts +0 -4
  103. package/dist/taco.cjs.development.js +1660 -1570
  104. package/dist/taco.cjs.development.js.map +1 -1
  105. package/dist/taco.cjs.production.min.js +1 -1
  106. package/dist/taco.cjs.production.min.js.map +1 -1
  107. package/dist/utils/mergeRefs.d.ts +2 -0
  108. package/dist/utils/tailwind.d.ts +1 -1
  109. package/package.json +5 -3
  110. package/plugins/tailwindcss-aria-attributes.js +73 -0
  111. package/types.json +7310 -0
@@ -1 +1 @@
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 keycode from 'keycode';\nimport { sanitizeRowProps } from '../../util';\nimport { Group } from '../../../Group/Group';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { LocalizationTexts } from '../../../Provider/Provider';\nimport { Menu } from '../../../Menu/Menu';\nimport { RowAction, RowActionHandler, TableRow } from '../../types';\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 event.persist();\n action.onClick(row, event);\n },\n };\n};\n\nconst EditModeActions = () => {\n React.useEffect(() => {\n const listener = (event: any) => {\n if (event.keyCode === keycode('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 <Group>\n <IconButton appearance=\"primary\" icon=\"tick\" type=\"submit\" className=\"mr-2\" />\n <IconButton appearance=\"ghost\" icon=\"close\" type=\"reset\" />\n </Group>\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: 'yt-table__cell__actions',\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=\"plus-circle\"\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 {action.text}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n ) : null}\n </>\n );\n\n if (windowed) {\n return <Group>{output}</Group>;\n }\n\n return (\n <InView rootMargin=\"100px 0px\">\n {({ inView, ref }) => <Group ref={ref}>{inView ? output : null}</Group>}\n </InView>\n );\n },\n },\n ]);\n }\n };\n plugin.pluginName = 'useRowActions';\n return plugin;\n};\n"],"names":["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","persist","EditModeActions","React","useEffect","listener","keyCode","keycode","target","form","reset","preventDefault","document","addEventListener","removeEventListener","Group","IconButton","appearance","icon","type","className","useRowActions","rowExpansionRenderer","texts","windowed","inlineEditing","actionsLength","plugin","hooks","visibleColumns","columns","id","flex","Cell","isEditing","sanitizedRow","sanitizeRowProps","output","table","newSubRow","canEdit","stopPropagation","setActive","isExpanded","toggleRowExpanded","edit","toggleRowEditing","copy","del","map","index","key","Menu","Trigger","Content","Item","text","InView","rootMargin","inView","ref","pluginName"],"mappings":";;;;;;;;AAWA,IAAMA,UAAU,GAAG,SAAbA,UAAa,CAACC,qBAAD,EAA6BC,QAA7B,EAA4CC,OAA5C;AACf,SACI,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,IAAMC,UAAU,GAAG,SAAbA,UAAa,CACfL,OADe,EAEfM,GAFe;MAEfA;AAAAA,IAAAA,MAAiCC;;;AAEjC,MAAMC,OAAO,GAAqB,EAAlC;AACA,MAAMC,SAAS,GAAqB,EAApC;;AAEA,MAAIT,OAAJ,EAAa;AACT,QAAIU,cAAc,GAAGV,OAAO,CAACW,MAAR,CAAe,UAAAC,CAAC;AAAA,aAAI,CAAC,CAACA,CAAN;AAAA,KAAhB,CAArB;;AAEA,QAAIN,GAAJ,EAAS;AACLI,MAAAA,cAAc,GAAGA,cAAc,CAACC,MAAf,CAAsB,UAACE,MAAD;AACnC,YAAIA,MAAM,CAACC,OAAP,KAAmBP,SAAvB,EAAkC;AAC9B,cAAI,OAAOM,MAAM,CAACC,OAAd,KAA0B,UAA9B,EAA0C;AACtC,mBAAOD,MAAM,CAACC,OAAP,CAAeR,GAAf,CAAP;AACH;;AAED,iBAAOO,MAAM,CAACC,OAAd;AACH;;AAED,eAAO,IAAP;AACH,OAVgB,CAAjB;AAWH;;AAEDJ,IAAAA,cAAc,CAACK,OAAf,CAAuB,UAACF,MAAD;AACnB,UAAIA,MAAM,CAACG,SAAX,EAAsB;AAClBR,QAAAA,OAAO,CAACS,IAAR,C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"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 keycode from 'keycode';\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 event.persist();\n action.onClick(row, event);\n },\n };\n};\n\nconst EditModeActions = () => {\n React.useEffect(() => {\n const listener = (event: any) => {\n if (event.keyCode === keycode('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=\"plus-circle\"\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 {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","persist","EditModeActions","React","useEffect","listener","keyCode","keycode","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","setActive","isExpanded","toggleRowExpanded","edit","toggleRowEditing","copy","del","map","index","key","Menu","Trigger","Content","Item","text","InView","rootMargin","inView","ref","pluginName"],"mappings":";;;;;;;AAUA,IAAMA,oBAAoB,GAAG,sBAA7B;;AAEA,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAACC,qBAAD,EAA6BC,QAA7B,EAA4CC,OAA5C;AACf,SACI,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,IAA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BAAAA,IAAI,EACA,OAAO/B,MAAM,CAAC+B,IAAd,KAAuB,UAAvB,GACM/B,MAAM,CAAC+B,IAAP,CAAYgB,YAAZ,CADN,GAEM/C,MAAM,CAAC+B;iBAEbtB,cAAc,CAACT,MAAD,EAAS+C,YAAT,EAPtB,EASK/C,MAAM,CAACoE,IATZ,CADkB;AAAA,aAArB,CADL,CAdJ,CADH,GA+BG,IAjHR,CADJ;;AAsHA,gBAAIhC,QAAJ,EAAc;AACV,qBAAOpB,4BAAA,MAAA;AAAKY,gBAAAA,SAAS,EAAE7C;eAAhB,EAAuCkE,MAAvC,CAAP;AACH;;AAED,mBACIjC,4BAAA,CAACqD,MAAD;AAAQC,cAAAA,UAAU,EAAC;aAAnB,EACK;AAAA,kBAAGC,MAAH,SAAGA,MAAH;AAAA,kBAAWC,GAAX,SAAWA,GAAX;AAAA,qBACGxD,4BAAA,MAAA;AAAKY,gBAAAA,SAAS,EAAE7C;AAAsByF,gBAAAA,GAAG,EAAEA;eAA3C,EACKD,MAAM,GAAGtB,MAAH,GAAY,IADvB,CADH;AAAA,aADL,CADJ;AASH;AA/IL,SAFsB;AAAA,OAA1B;AAoJH;AACJ,GAvJD;;AAwJAV,EAAAA,MAAM,CAACkC,UAAP,GAAoB,eAApB;AACA,SAAOlC,MAAP;AACH;;;;"}
@@ -64,7 +64,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
64
64
 
65
65
  return React__default.createElement(Checkbox, Object.assign({}, props, {
66
66
  onChange: onChange,
67
- className: "h-auto mt-px"
67
+ className: "mt-px"
68
68
  }));
69
69
  },
70
70
  Cell: function Cell(_ref2) {
@@ -96,7 +96,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
96
96
  };
97
97
 
98
98
  return React__default.createElement(Checkbox, Object.assign({}, props, {
99
- className: "h-auto mt-px",
99
+ className: "mt-px",
100
100
  onClick: onClick,
101
101
  // this is necessary to remove console spam from eslint
102
102
  onChange: function onChange() {
@@ -105,7 +105,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
105
105
  }));
106
106
  },
107
107
  flex: '0 0 36px',
108
- className: 'flex-col justify-start'
108
+ className: 'flex-col justify-start !pb-0'
109
109
  }].concat(columns);
110
110
  });
111
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useRowSelect.js","sources":["../../../../../../../src/components/Table/hooks/plugins/useRowSelect.tsx"],"sourcesContent":["// this wraps react-table's internal useRowSelect hook\nimport React from 'react';\nimport { useRowSelect as useBaseRowSelect, Row, PluginHook } from 'react-table';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { SelectedRowsHandler } from '../../types';\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\n// react-table calls \"index paths\" row ids. we named them indexPaths to reduce confusion with natural ids\n// the selection hook usess react-table's row selection, so this hok references row.id - it is the index path\n\nexport const useRowSelect = (onSelectedRows: SelectedRowsHandler | undefined): PluginHook<{}> => {\n const plugin = (hooks: any): void => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useBaseRowSelect(hooks);\n\n if (onSelectedRows) {\n const toggleRowSelected = (indexPath: string, checked: boolean): void =>\n onSelectedRows(state => {\n const nextState = { ...state };\n\n if (checked) {\n nextState[indexPath] = true;\n } else {\n delete nextState[indexPath];\n }\n\n return nextState;\n });\n\n const prepareRow = (row: any) => {\n row.toggleRowSelected = () => toggleRowSelected(row.id, !row.isSelected);\n };\n\n hooks.prepareRow.push(prepareRow);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const lastSelectedSortedIndex = React.useRef();\n\n hooks.visibleColumns.push((columns: any) => [\n {\n id: 'selection',\n Header: ({ getToggleAllRowsSelectedProps, rows }: any) => {\n const { onChange: _, ...props } = getToggleAllRowsSelectedProps();\n\n const onChange = (checked): void => {\n if (checked) {\n // this intentionally only selects top level rows - sub rows add too much complexity\n onSelectedRows(Object.assign({}, Array(rows.length).fill(true)));\n } else {\n onSelectedRows({});\n }\n };\n\n return <Checkbox {...props} onChange={onChange} className=\"h-auto mt-px\" />;\n },\n Cell: ({ row, rows }: any) => {\n const { onChange: _, ...props } = row.getToggleRowSelectedProps();\n // row.index refers to the index in the original data, not the current index\n const sortedIndex = rows.findIndex((r: Row) => r.index === row.index);\n\n const onClick = (event: React.MouseEvent): void => {\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(lastSelectedSortedIndex.current || 0, sortedIndex);\n\n for (let i = fromIndex; i <= toIndex; i++) {\n toggleRowSelected(rows[i].id, true);\n }\n } else {\n toggleRowSelected(row.id, !props.checked);\n }\n\n lastSelectedSortedIndex.current = sortedIndex;\n };\n\n return (\n <Checkbox\n {...props}\n className=\"h-auto mt-px\"\n onClick={onClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n );\n },\n flex: '0 0 36px',\n className: 'flex-col justify-start',\n },\n ...columns,\n ]);\n }\n };\n plugin.pluginName = 'useRowSelect';\n return plugin;\n};\n"],"names":["toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","useRowSelect","onSelectedRows","plugin","hooks","useBaseRowSelect","toggleRowSelected","indexPath","checked","state","nextState","prepareRow","row","id","isSelected","push","lastSelectedSortedIndex","React","useRef","visibleColumns","columns","Header","getToggleAllRowsSelectedProps","rows","props","onChange","Object","assign","Array","length","fill","Checkbox","className","Cell","getToggleRowSelectedProps","sortedIndex","findIndex","r","index","onClick","event","shiftKey","current","i","flex","pluginName"],"mappings":";;;;;;;;AAMA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,YAAD,EAAuBC,UAAvB;AAClB,MAAMC,SAAS,GAAGD,UAAU,GAAGD,YAAb,GAA4BC,UAA5B,GAAyCD,YAA3D;AACA,MAAMG,OAAO,GAAGF,UAAU,GAAGD,YAAb,GAA4BC,UAA5B,GAAyCD,YAAzD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A,CAACc,QAAD,oBACQP;AACJQ,cAAAA,SAAS,EAAC;AACVO,cAAAA,OAAO,EAAEA;AACT;AACAd,cAAAA,QAAQ,EAAE;AAAA,uBAAM,KAAN;AAAA;cALd,CADJ;AASH,WA5CL;AA6CImB,UAAAA,IAAI,EAAE,UA7CV;AA8CIZ,UAAAA,SAAS,EAAE;AA9Cf,SADsB,SAiDnBZ,OAjDmB;AAAA,OAA1B;AAmDH;AACJ,GA/ED;;AAgFAjB,EAAAA,MAAM,CAAC0C,UAAP,GAAoB,cAApB;AACA,SAAO1C,MAAP;AACH;;;;"}
1
+ {"version":3,"file":"useRowSelect.js","sources":["../../../../../../../src/components/Table/hooks/plugins/useRowSelect.tsx"],"sourcesContent":["// this wraps react-table's internal useRowSelect hook\nimport React from 'react';\nimport { useRowSelect as useBaseRowSelect, Row, PluginHook } from 'react-table';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { SelectedRowsHandler } from '../../types';\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\n// react-table calls \"index paths\" row ids. we named them indexPaths to reduce confusion with natural ids\n// the selection hook usess react-table's row selection, so this hok references row.id - it is the index path\n\nexport const useRowSelect = (onSelectedRows: SelectedRowsHandler | undefined): PluginHook<{}> => {\n const plugin = (hooks: any): void => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useBaseRowSelect(hooks);\n\n if (onSelectedRows) {\n const toggleRowSelected = (indexPath: string, checked: boolean): void =>\n onSelectedRows(state => {\n const nextState = { ...state };\n\n if (checked) {\n nextState[indexPath] = true;\n } else {\n delete nextState[indexPath];\n }\n\n return nextState;\n });\n\n const prepareRow = (row: any) => {\n row.toggleRowSelected = () => toggleRowSelected(row.id, !row.isSelected);\n };\n\n hooks.prepareRow.push(prepareRow);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const lastSelectedSortedIndex = React.useRef();\n\n hooks.visibleColumns.push((columns: any) => [\n {\n id: 'selection',\n Header: ({ getToggleAllRowsSelectedProps, rows }: any) => {\n const { onChange: _, ...props } = getToggleAllRowsSelectedProps();\n\n const onChange = (checked): void => {\n if (checked) {\n // this intentionally only selects top level rows - sub rows add too much complexity\n onSelectedRows(Object.assign({}, Array(rows.length).fill(true)));\n } else {\n onSelectedRows({});\n }\n };\n\n return <Checkbox {...props} onChange={onChange} className=\"mt-px\" />;\n },\n Cell: ({ row, rows }: any) => {\n const { onChange: _, ...props } = row.getToggleRowSelectedProps();\n // row.index refers to the index in the original data, not the current index\n const sortedIndex = rows.findIndex((r: Row) => r.index === row.index);\n\n const onClick = (event: React.MouseEvent): void => {\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(lastSelectedSortedIndex.current || 0, sortedIndex);\n\n for (let i = fromIndex; i <= toIndex; i++) {\n toggleRowSelected(rows[i].id, true);\n }\n } else {\n toggleRowSelected(row.id, !props.checked);\n }\n\n lastSelectedSortedIndex.current = sortedIndex;\n };\n\n return (\n <Checkbox\n {...props}\n className=\"mt-px\"\n onClick={onClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n );\n },\n flex: '0 0 36px',\n className: 'flex-col justify-start !pb-0',\n },\n ...columns,\n ]);\n }\n };\n plugin.pluginName = 'useRowSelect';\n return plugin;\n};\n"],"names":["toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","useRowSelect","onSelectedRows","plugin","hooks","useBaseRowSelect","toggleRowSelected","indexPath","checked","state","nextState","prepareRow","row","id","isSelected","push","lastSelectedSortedIndex","React","useRef","visibleColumns","columns","Header","getToggleAllRowsSelectedProps","rows","props","onChange","Object","assign","Array","length","fill","Checkbox","className","Cell","getToggleRowSelectedProps","sortedIndex","findIndex","r","index","onClick","event","shiftKey","current","i","flex","pluginName"],"mappings":";;;;;;;;AAMA,IAAMA,aAAa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;AACH;AACJ,eAND,MAMO;AACHP,gBAAAA,iBAAiB,CAACM,GAAG,CAACC,EAAL,EAAS,CAACW,KAAK,CAAChB,OAAhB,CAAjB;AACH;;AAEDQ,cAAAA,uBAAuB,CAAC0B,OAAxB,GAAkCP,WAAlC;AACH,aAZD;;AAcA,mBACIlB,4BAAA,CAACc,QAAD,oBACQP;AACJQ,cAAAA,SAAS,EAAC;AACVO,cAAAA,OAAO,EAAEA;AACT;AACAd,cAAAA,QAAQ,EAAE;AAAA,uBAAM,KAAN;AAAA;cALd,CADJ;AASH,WA5CL;AA6CImB,UAAAA,IAAI,EAAE,UA7CV;AA8CIZ,UAAAA,SAAS,EAAE;AA9Cf,SADsB,SAiDnBZ,OAjDmB;AAAA,OAA1B;AAmDH;AACJ,GA/ED;;AAgFAjB,EAAAA,MAAM,CAAC0C,UAAP,GAAoB,cAApB;AACA,SAAO1C,MAAP;AACH;;;;"}
@@ -12,8 +12,8 @@ var Column = function Column(_ref) {
12
12
  className: cn('yt-table__cell', cell.className, {
13
13
  'yt-table__cell__group': !!cell.columns,
14
14
  'yt-table__cell--disable-sort': cell.disableSorting,
15
- 'yt-table__cell--align-left': cell.align === 'left',
16
- 'yt-table__cell--align-right': cell.align === 'right'
15
+ 'justify-start text-left': cell.align === 'left',
16
+ 'justify-end text-right': cell.align === 'right'
17
17
  }),
18
18
  style: _extends({}, cell.style, {
19
19
  flex: cell.flex
@@ -25,7 +25,8 @@ var Column = function Column(_ref) {
25
25
  }
26
26
 
27
27
  return React__default.createElement("div", Object.assign({}, props, {
28
- key: cell.id
28
+ key: cell.id,
29
+ "data-taco": "table-column"
29
30
  }), React__default.createElement("span", null, cell.render('Header')), cell.isSorted ? React__default.createElement(Icon, {
30
31
  name: cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'
31
32
  }) : null);
@@ -1 +1 @@
1
- {"version":3,"file":"renderColumn.js","sources":["../../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon } from '../../Icon/Icon';\n\nexport const Column = ({ cell }: any): any => {\n const props = {\n ...cell.getHeaderProps(),\n ...(cell.getSortByToggleProps && cell.getSortByToggleProps({ title: undefined })),\n className: cn('yt-table__cell', cell.className, {\n 'yt-table__cell__group': !!cell.columns,\n 'yt-table__cell--disable-sort': cell.disableSorting,\n 'yt-table__cell--align-left': cell.align === 'left',\n 'yt-table__cell--align-right': cell.align === 'right',\n }),\n style: { ...cell.style, flex: cell.flex },\n };\n\n if (cell.isSorted) {\n props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';\n }\n\n return (\n <div {...props} key={cell.id}>\n <span>{cell.render('Header')}</span>\n {cell.isSorted ? <Icon name={cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'} /> : null}\n </div>\n );\n};\n"],"names":["Column","cell","props","getHeaderProps","getSortByToggleProps","title","undefined","className","cn","columns","disableSorting","align","style","flex","isSorted","isSortedDesc","React","key","id","render","Icon","name"],"mappings":";;;;;IAIaA,MAAM,GAAG,SAATA,MAAS;MAAGC,YAAAA;;AACrB,MAAMC,KAAK,gBACJD,IAAI,CAACE,cAAL,EADI,EAEHF,IAAI,CAACG,oBAAL,IAA6BH,IAAI,CAACG,oBAAL,CAA0B;AAAEC,IAAAA,KAAK,EAAEC;AAAT,GAA1B,CAF1B;AAGPC,IAAAA,SAAS,EAAEC,EAAE,CAAC,gBAAD,EAAmBP,IAAI,CAACM,SAAxB,EAAmC;AAC5C,+BAAyB,CAAC,CAACN,IAAI,CAACQ,OADY;AAE5C,sCAAgCR,IAAI,CAACS,cAFO;AAG5C,oCAA8BT,IAAI,CAACU,KAAL,KAAe,MAHD;AAI5C,qCAA+BV,IAAI,CAACU,KAAL,KAAe;AAJF,KAAnC,CAHN;AASPC,IAAAA,KAAK,eAAOX,IAAI,CAACW,KAAZ;AAAmBC,MAAAA,IAAI,EAAEZ,IAAI,CAACY;AAA9B;AATE,IAAX;;AAYA,MAAIZ,IAAI,CAACa,QAAT,EAAmB;AACfZ,IAAAA,KAAK,CAAC,WAAD,CAAL,GAAqBD,IAAI,CAACc,YAAL,GAAoB,YAApB,GAAmC,WAAxD;AACH;;AAED,SACIC,4BAAA,MAAA,oBAASd;AAAOe,IAAAA,GAAG,EAAEhB,IAAI,CAACiB;IAA1B,EACIF,4BAAA,OAAA,MAAA,EAAOf,IAAI,CAACkB,MAAL,CAAY,QAAZ,CAAP,CADJ,EAEKlB,IAAI,CAACa,QAAL,GAAgBE,4BAAA,CAACI,IAAD;AAAMC,IAAAA,IAAI,EAAEpB,IAAI,CAACc,YAAL,GAAoB,oBAApB,GAA2C;GAAvD,CAAhB,GAAgG,IAFrG,CADJ;AAMH;;;;"}
1
+ {"version":3,"file":"renderColumn.js","sources":["../../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon } from '../../Icon/Icon';\n\nexport const Column = ({ cell }: any): any => {\n const props = {\n ...cell.getHeaderProps(),\n ...(cell.getSortByToggleProps && cell.getSortByToggleProps({ title: undefined })),\n className: cn('yt-table__cell', cell.className, {\n 'yt-table__cell__group': !!cell.columns,\n 'yt-table__cell--disable-sort': cell.disableSorting,\n 'justify-start text-left': cell.align === 'left',\n 'justify-end text-right': cell.align === 'right',\n }),\n style: { ...cell.style, flex: cell.flex },\n };\n\n if (cell.isSorted) {\n props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';\n }\n\n return (\n <div {...props} key={cell.id} data-taco=\"table-column\">\n <span>{cell.render('Header')}</span>\n {cell.isSorted ? <Icon name={cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'} /> : null}\n </div>\n );\n};\n"],"names":["Column","cell","props","getHeaderProps","getSortByToggleProps","title","undefined","className","cn","columns","disableSorting","align","style","flex","isSorted","isSortedDesc","React","key","id","render","Icon","name"],"mappings":";;;;;IAIaA,MAAM,GAAG,SAATA,MAAS;MAAGC,YAAAA;;AACrB,MAAMC,KAAK,gBACJD,IAAI,CAACE,cAAL,EADI,EAEHF,IAAI,CAACG,oBAAL,IAA6BH,IAAI,CAACG,oBAAL,CAA0B;AAAEC,IAAAA,KAAK,EAAEC;AAAT,GAA1B,CAF1B;AAGPC,IAAAA,SAAS,EAAEC,EAAE,CAAC,gBAAD,EAAmBP,IAAI,CAACM,SAAxB,EAAmC;AAC5C,+BAAyB,CAAC,CAACN,IAAI,CAACQ,OADY;AAE5C,sCAAgCR,IAAI,CAACS,cAFO;AAG5C,iCAA2BT,IAAI,CAACU,KAAL,KAAe,MAHE;AAI5C,gCAA0BV,IAAI,CAACU,KAAL,KAAe;AAJG,KAAnC,CAHN;AASPC,IAAAA,KAAK,eAAOX,IAAI,CAACW,KAAZ;AAAmBC,MAAAA,IAAI,EAAEZ,IAAI,CAACY;AAA9B;AATE,IAAX;;AAYA,MAAIZ,IAAI,CAACa,QAAT,EAAmB;AACfZ,IAAAA,KAAK,CAAC,WAAD,CAAL,GAAqBD,IAAI,CAACc,YAAL,GAAoB,YAApB,GAAmC,WAAxD;AACH;;AAED,SACIC,4BAAA,MAAA,oBAASd;AAAOe,IAAAA,GAAG,EAAEhB,IAAI,CAACiB;iBAAc;IAAxC,EACIF,4BAAA,OAAA,MAAA,EAAOf,IAAI,CAACkB,MAAL,CAAY,QAAZ,CAAP,CADJ,EAEKlB,IAAI,CAACa,QAAL,GAAgBE,4BAAA,CAACI,IAAD;AAAMC,IAAAA,IAAI,EAAEpB,IAAI,CAACc,YAAL,GAAoB,oBAApB,GAA2C;GAAvD,CAAhB,GAAgG,IAFrG,CADJ;AAMH;;;;"}
@@ -9,8 +9,8 @@ var _excluded = ["row", "index", "instance", "headerGroups"];
9
9
  var renderCell = function renderCell(cell, row) {
10
10
  var props = _extends({}, cell.getCellProps(), {
11
11
  className: cn('yt-table__cell', cell.column.className, {
12
- 'yt-table__cell--align-left': cell.column.align === 'left',
13
- 'yt-table__cell--align-right': cell.column.align === 'right'
12
+ 'justify-start text-left': cell.column.align === 'left',
13
+ 'justify-end text-right': cell.column.align === 'right'
14
14
  }),
15
15
  style: _extends({}, cell.column.style, {
16
16
  flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex
@@ -18,7 +18,8 @@ var renderCell = function renderCell(cell, row) {
18
18
  });
19
19
 
20
20
  return React__default.createElement("div", Object.assign({}, props, {
21
- role: "gridcell"
21
+ role: "gridcell",
22
+ "data-taco": "table-cell"
22
23
  }), cell.render('Cell') || null);
23
24
  };
24
25
 
@@ -1 +1 @@
1
- {"version":3,"file":"renderRow.js","sources":["../../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { FocusScope } from '@react-aria/focus';\nimport { InternalTableCell, TableRow } from '../types';\nimport { sanitizeRowProps } from '../util';\n\nconst renderCell = (cell: InternalTableCell, row: TableRow<any>): JSX.Element => {\n const props = {\n ...cell.getCellProps(),\n className: cn('yt-table__cell', cell.column.className, {\n 'yt-table__cell--align-left': cell.column.align === 'left',\n 'yt-table__cell--align-right': cell.column.align === 'right',\n }),\n style: {\n ...cell.column.style,\n flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex,\n },\n };\n return (\n <div {...props} role=\"gridcell\">\n {cell.render('Cell') || null}\n </div>\n );\n};\n\nexport const Row = React.forwardRef(({ row, index, instance, headerGroups, ...rowProps }: any, ref: any): JSX.Element => {\n const {\n activeIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n setActiveIndex,\n style,\n inlineEditingUniqueId,\n } = rowProps;\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n\n const props = {\n ...row.getRowProps(),\n style: {\n ...style,\n minHeight: rowHeight ? `${rowHeight}px` : undefined,\n paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined,\n },\n className: cn(\n 'yt-table__row',\n {\n 'yt-table__row--active': activeIndex === index,\n 'yt-table__row--clickable': !!onRowClick,\n 'yt-table__row--dragging': !!row.isDragging,\n 'yt-table__row--editing': !!row.isEditing,\n },\n typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName\n ),\n onClick: onRowClick\n ? (event: React.MouseEvent<HTMLElement>) => {\n if (\n event.target === event.currentTarget ||\n (event.target as HTMLElement).classList.contains('yt-table__cell')\n ) {\n event.preventDefault();\n event.persist();\n setActiveIndex(index);\n onRowClick(sanitizedRow);\n }\n }\n : () => {\n setActiveIndex(index);\n },\n };\n\n let cells = row.cells;\n\n if (row.depth > 0) {\n cells = row.cells.filter((cell: any) => !cell.column.hiddenOnSubRows);\n }\n\n const expandedRow = rowExpansionRenderer && row.isExpanded && <div>{rowExpansionRenderer(sanitizedRow, instance)}</div>;\n const rowContent = React.useMemo(() => {\n return (\n <>\n <FocusScope key={row.original._createKey} contain restoreFocus autoFocus>\n <div {...props} role=\"row\" ref={ref}>\n <input type=\"hidden\" name=\"_rowIndexPath\" value={row.id} />\n <input type=\"hidden\" name=\"_inlineEditingUniqueId\" value={row.original[inlineEditingUniqueId]} />\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n </FocusScope>\n {expandedRow}\n </>\n );\n }, [row.original._createKey]);\n\n if (row.isEditing) {\n return rowContent;\n }\n\n return (\n <>\n <div {...props} role=\"row\" ref={ref}>\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n {expandedRow}\n </>\n );\n});\n"],"names":["renderCell","cell","row","props","getCellProps","className","cn","column","align","style","flex","React","role","render","Row","forwardRef","ref","index","instance","rowProps","activeIndex","onRowClick","rowClassName","rowExpansionRenderer","rowHeight","setActiveIndex","inlineEditingUniqueId","sanitizedRow","sanitizeRowProps","getRowProps","minHeight","undefined","paddingLeft","depth","isDragging","isEditing","onClick","event","target","currentTarget","classList","contains","preventDefault","persist","cells","filter","hiddenOnSubRows","expandedRow","isExpanded","rowContent","useMemo","FocusScope","key","original","_createKey","contain","restoreFocus","autoFocus","type","name","value","id","map"],"mappings":";;;;;;;;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AAAA,GAAG,EAAEA;IAAhC,EACK4B,KAAK,CAACkB,GAAN,CAAU,UAAC7D,IAAD;AAAA,WAA6BD,UAAU,CAACC,IAAD,EAAO0B,YAAP,CAAvC;AAAA,GAAV,CADL,CADJ,EAIKoB,WAJL,CADJ;AAQH,CAjFkB;;;;"}
1
+ {"version":3,"file":"renderRow.js","sources":["../../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { FocusScope } from '@react-aria/focus';\nimport { InternalTableCell, TableRow } from '../types';\nimport { sanitizeRowProps } from '../util';\n\nconst renderCell = (cell: InternalTableCell, row: TableRow<any>): JSX.Element => {\n const props = {\n ...cell.getCellProps(),\n className: cn('yt-table__cell', cell.column.className, {\n 'justify-start text-left': cell.column.align === 'left',\n 'justify-end text-right': cell.column.align === 'right',\n }),\n style: {\n ...cell.column.style,\n flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex,\n },\n };\n return (\n <div {...props} role=\"gridcell\" data-taco=\"table-cell\">\n {cell.render('Cell') || null}\n </div>\n );\n};\n\nexport const Row = React.forwardRef(({ row, index, instance, headerGroups, ...rowProps }: any, ref: any): JSX.Element => {\n const {\n activeIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n setActiveIndex,\n style,\n inlineEditingUniqueId,\n } = rowProps;\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n\n const props = {\n ...row.getRowProps(),\n style: {\n ...style,\n minHeight: rowHeight ? `${rowHeight}px` : undefined,\n paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined,\n },\n className: cn(\n 'yt-table__row',\n {\n 'yt-table__row--active': activeIndex === index,\n 'yt-table__row--clickable': !!onRowClick,\n 'yt-table__row--dragging': !!row.isDragging,\n 'yt-table__row--editing': !!row.isEditing,\n },\n typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName\n ),\n onClick: onRowClick\n ? (event: React.MouseEvent<HTMLElement>) => {\n if (\n event.target === event.currentTarget ||\n (event.target as HTMLElement).classList.contains('yt-table__cell')\n ) {\n event.preventDefault();\n event.persist();\n setActiveIndex(index);\n onRowClick(sanitizedRow);\n }\n }\n : () => {\n setActiveIndex(index);\n },\n };\n\n let cells = row.cells;\n\n if (row.depth > 0) {\n cells = row.cells.filter((cell: any) => !cell.column.hiddenOnSubRows);\n }\n\n const expandedRow = rowExpansionRenderer && row.isExpanded && <div>{rowExpansionRenderer(sanitizedRow, instance)}</div>;\n const rowContent = React.useMemo(() => {\n return (\n <>\n <FocusScope key={row.original._createKey} contain restoreFocus autoFocus>\n <div {...props} role=\"row\" ref={ref}>\n <input type=\"hidden\" name=\"_rowIndexPath\" value={row.id} />\n <input type=\"hidden\" name=\"_inlineEditingUniqueId\" value={row.original[inlineEditingUniqueId]} />\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n </FocusScope>\n {expandedRow}\n </>\n );\n }, [row.original._createKey]);\n\n if (row.isEditing) {\n return rowContent;\n }\n\n return (\n <>\n <div {...props} role=\"row\" ref={ref}>\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n {expandedRow}\n </>\n );\n});\n"],"names":["renderCell","cell","row","props","getCellProps","className","cn","column","align","style","flex","React","role","render","Row","forwardRef","ref","index","instance","rowProps","activeIndex","onRowClick","rowClassName","rowExpansionRenderer","rowHeight","setActiveIndex","inlineEditingUniqueId","sanitizedRow","sanitizeRowProps","getRowProps","minHeight","undefined","paddingLeft","depth","isDragging","isEditing","onClick","event","target","currentTarget","classList","contains","preventDefault","persist","cells","filter","hiddenOnSubRows","expandedRow","isExpanded","rowContent","useMemo","FocusScope","key","original","_createKey","contain","restoreFocus","autoFocus","type","name","value","id","map"],"mappings":";;;;;;;;AAMA,IAAMA,UAAU,GAAG,SAAbA,UAAa,CAACC,IAAD,EAA0BC,GAA1B;AACf,MAAMC,KAAK,gBACJF,IAAI,CAACG,YAAL,EADI;AAEPC,I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,YAAP,CAAvC;AAAA,GAAV,CADL,CADJ,EAIKoB,WAJL,CADJ;AAQH,CAjFkB;;;;"}
@@ -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 FowardedTabsWithStatics = 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 FowardedTabsWithStatics;\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'\n : 'cursor-pointer rounded-t hover:border-grey-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":";;;;;;;;IA+DaA,IAAI,gBAAGC,UAAA,CAAiB,SAASD,IAAT,CAAcE,KAAd,EAAgCC,GAAhC;AACjC,MAAQC,EAAR,GAAyFF,KAAzF,CAAQE,EAAR;AAAA,MAAYC,SAAZ,GAAyFH,KAAzF,CAAYG,SAAZ;AAAA,MAAuBC,QAAvB,GAAyFJ,KAAzF,CAAuBI,QAAvB;AAAA,MAAiCC,QAAjC,GAAyFL,KAAzF,CAAiCK,QAAjC;AAAA,2BAAyFL,KAAzF,CAA2CM,WAA3C;AAAA,MAA2CA,WAA3C,mCAAyD,YAAzD;AAAA,MAA0EC,UAA1E,iCAAyFP,KAAzF;;AACA,MAAMQ,SAAS,GAAGC,EAAE,CAChB,SADgB,gBAEJH,WAFI,EAGhB;AACI,mBAAeA,WAAW,KAAK;AADnC,GAHgB,EAMhBN,KAAK,CAACQ,SANU,CAApB;AASA,SACIT,aAAA,CAACW,IAAD,oBACQH;AACJC,IAAAA,SAAS,EAAEA;iBACD;AACVG,IAAAA,YAAY,EAAER;AACdS,IAAAA,GAAG,EAAC;AACJC,IAAAA,aAAa,EAAER;AACfC,IAAAA,WAAW,EAAEA;AACbL,IAAAA,GAAG,EAAEA;AACLa,IAAAA,KAAK,EAAEZ;IATX,EAWKE,QAXL,CADJ;AAeH,CA1BmB;AA4BpB,IAAMW,OAAO,gBAAGhB,UAAA,CAAiB,SAASiB,GAAT,CAAahB,KAAb,EAAkCC,GAAlC;AAC7B,MAAMO,SAAS,GAAGC,EAAE,CAAC,gEAAD,EAAmET,KAAK,CAACQ,SAAzE,CAApB;AAEA,SAAOT,aAAA,CAACW,IAAD,oBAAwBV;AAAOQ,IAAAA,SAAS,EAAEA;AAAWP,IAAAA,GAAG,EAAEA;IAA1D,CAAP;AACH,CAJe,CAAhB;AAMA,IAAMgB,UAAU,gBAAGlB,UAAA,CAAiB,SAASiB,GAAT,CAAahB,KAAb,EAAqCC,GAArC;AAChC,MAAQC,EAAR,GAAwCF,KAAxC,CAAQE,EAAR;AAAA,MAAYgB,QAAZ,GAAwClB,KAAxC,CAAYkB,QAAZ;AAAA,MAAyBX,UAAzB,iCAAwCP,KAAxC;;AACA,MAAMQ,SAAS,GAAGC,EAAE,CAChB,qFADgB,EAEhBS,QAAQ,GACF,+BADE,GAEF,uIAJU,EAKhBlB,KAAK,CAACQ,SALU,CAApB;AAQA,SACIT,aAAA,CAACW,OAAD,oBACQH;AACJC,IAAAA,SAAS,EAAEA;AACXU,IAAAA,QAAQ,EAAEA;AACVjB,IAAAA,GAAG,EAAEA;AACLkB,IAAAA,KAAK,EAAE;AACHC,MAAAA,UAAU,EAAE;AADT;AAGPN,IAAAA,KAAK,EAAEZ;IARX,CADJ;AAYH,CAtBkB,CAAnB;AAwBA,IAAMmB,UAAU,gBAAGtB,UAAA,CAAiB,SAASiB,GAAT,CAAahB,KAAb,EAAqCC,GAArC;AAChC,MAAQC,EAAR,GAA8BF,KAA9B,CAAQE,EAAR;AAAA,MAAeK,UAAf,iCAA8BP,KAA9B;;AACA,MAAMQ,SAAS,GAAGC,EAAE,CAAC,4BAAD,EAA+BT,KAAK,CAACQ,SAArC,CAApB;AAEA,SAAOT,aAAA,CAACW,OAAD,oBAA2BH;AAAYC,IAAAA,SAAS,EAAEA;AAAWP,IAAAA,GAAG,EAAEA;AAAKa,IAAAA,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
+ {"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'\n : 'cursor-pointer rounded-t hover:border-grey-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":";;;;;;;;IA+DaA,IAAI,gBAAGC,UAAA,CAAiB,SAASD,IAAT,CAAcE,KAAd,EAAgCC,GAAhC;AACjC,MAAQC,EAAR,GAAyFF,KAAzF,CAAQE,EAAR;AAAA,MAAYC,SAAZ,GAAyFH,KAAzF,CAAYG,SA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U,EAKhBlB,KAAK,CAACQ,SALU,CAApB;AAQA,SACIT,aAAA,CAACW,OAAD,oBACQH;AACJC,IAAAA,SAAS,EAAEA;AACXU,IAAAA,QAAQ,EAAEA;AACVjB,IAAAA,GAAG,EAAEA;AACLkB,IAAAA,KAAK,EAAE;AACHC,MAAAA,UAAU,EAAE;AADT;AAGPN,IAAAA,KAAK,EAAEZ;IARX,CADJ;AAYH,CAtBkB,CAAnB;AAwBA,IAAMmB,UAAU,gBAAGtB,UAAA,CAAiB,SAASiB,GAAT,CAAahB,KAAb,EAAqCC,GAArC;AAChC,MAAQC,EAAR,GAA8BF,KAA9B,CAAQE,EAAR;AAAA,MAAeK,UAAf,iCAA8BP,KAA9B;;AACA,MAAMQ,SAAS,GAAGC,EAAE,CAAC,4BAAD,EAA+BT,KAAK,CAACQ,SAArC,CAApB;AAEA,SAAOT,aAAA,CAACW,OAAD,oBAA2BH;AAAYC,IAAAA,SAAS,EAAEA;AAAWP,IAAAA,GAAG,EAAEA;AAAKa,IAAAA,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,11 +1,11 @@
1
1
  import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import React__default from 'react';
3
3
  import cn from 'classnames';
4
- import { IconButton } from '../IconButton/IconButton.js';
5
4
  import { useAnimation, motion } from 'framer-motion';
6
5
  import useTimer from '../../utils/hooks/useTimer.js';
7
6
  import { getBadgeIcon } from './util.js';
8
7
  import { useLocalization } from '../Provider/Provider.js';
8
+ import { IconButton } from '../IconButton/IconButton.js';
9
9
 
10
10
  var _excluded = ["content", "lastUpdated", "onClose", "options"];
11
11
  var Toast = function Toast(_ref) {
@@ -1,24 +1,25 @@
1
1
  import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { createElement } from 'react';
2
+ import { forwardRef, createElement } from 'react';
3
3
  import { Root, Trigger, Content, Arrow } from '@radix-ui/react-tooltip';
4
4
 
5
5
  var _excluded = ["title", "children", "placement"];
6
- var Tooltip = function Tooltip(_ref) {
7
- var title = _ref.title,
8
- children = _ref.children,
9
- placement = _ref.placement,
10
- otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
6
+ var Tooltip = /*#__PURE__*/forwardRef(function (props, ref) {
7
+ var title = props.title,
8
+ children = props.children,
9
+ placement = props.placement,
10
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
11
11
 
12
12
  return createElement(Root, {
13
13
  delayDuration: 50
14
14
  }, createElement(Trigger, {
15
- asChild: true
15
+ asChild: true,
16
+ ref: ref
16
17
  }, children), createElement(Content, Object.assign({}, otherProps, {
17
18
  asChild: true,
18
19
  side: placement,
19
- sideOffset: 5
20
+ sideOffset: 3
20
21
  }), createElement("div", {
21
- className: "px-2 py-1 rounded-sm wcag-purple text-xs font-bold animate-[fade-in_150ms]",
22
+ className: "wcag-purple animate-[fade-in_150ms] rounded-sm px-2 py-1 text-xs font-bold",
22
23
  "data-taco": "tooltip",
23
24
  style: {
24
25
  transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
@@ -26,7 +27,7 @@ var Tooltip = function Tooltip(_ref) {
26
27
  }, createElement(Arrow, {
27
28
  className: "fill-purple stroke-purple"
28
29
  }), title)));
29
- };
30
+ });
30
31
 
31
32
  export { Tooltip };
32
33
  //# sourceMappingURL=Tooltip.js.map
@@ -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 = ({ title, children, placement, ...otherProps }: TooltipProps) => (\n <TooltipPrimitive.Root delayDuration={50}>\n <TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>\n <TooltipPrimitive.Content {...otherProps} asChild side={placement} sideOffset={5}>\n <div\n className=\"px-2 py-1 rounded-sm wcag-purple text-xs font-bold animate-[fade-in_150ms]\"\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"],"names":["Tooltip","title","children","placement","otherProps","React","TooltipPrimitive","delayDuration","asChild","side","sideOffset","className","style","transformOrigin"],"mappings":";;;;;IAeaA,OAAO,GAAG,SAAVA,OAAU;AAAA,MAAGC,KAAH,QAAGA,KAAH;AAAA,MAAUC,QAAV,QAAUA,QAAV;AAAA,MAAoBC,SAApB,QAAoBA,SAApB;AAAA,MAAkCC,UAAlC;;AAAA,SACnBC,aAAA,CAACC,IAAD;AAAuBC,IAAAA,aAAa,EAAE;GAAtC,EACIF,aAAA,CAACC,OAAD;AAA0BE,IAAAA,OAAO;GAAjC,EAAmCN,QAAnC,CADJ,EAEIG,aAAA,CAACC,OAAD,oBAA8BF;AAAYI,IAAAA,OAAO;AAACC,IAAAA,IAAI,EAAEN;AAAWO,IAAAA,UAAU,EAAE;IAA/E,EACIL,aAAA,MAAA;AACIM,IAAAA,SAAS,EAAC;iBACA;AACVC,IAAAA,KAAK,EAAE;AACHC,MAAAA,eAAe,EAAE;AADd;GAHX,EAOIR,aAAA,CAACC,KAAD;AAAwBK,IAAAA,SAAS,EAAC;GAAlC,CAPJ,EAQKV,KARL,CADJ,CAFJ,CADmB;AAAA;;;;"}
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((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 animate-[fade-in_150ms] rounded-sm px-2 py-1 text-xs font-bold\"\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":";;;;;IAeaA,OAAO,gBAAGC,UAAA,CAAiB,UAACC,KAAD,EAAsBC,GAAtB;AACpC,MAAQC,KAAR,GAAsDF,KAAtD,CAAQE,KAAR;AAAA,MAAeC,QAAf,GAAsDH,KAAtD,CAAeG,QAAf;AAAA,MAAyBC,SAAzB,GAAsDJ,KAAtD,CAAyBI,SAAzB;AAAA,MAAuCC,UAAvC,iCAAsDL,KAAtD;;AAEA,SACID,aAAA,CAACO,IAAD;AAAuBC,IAAAA,aAAa,EAAE;GAAtC,EACIR,aAAA,CAACO,OAAD;AAA0BE,IAAAA,OAAO;AAACP,IAAAA,GAAG,EAAEA;GAAvC,EACKE,QADL,CADJ,EAIIJ,aAAA,CAACO,OAAD,oBAA8BD;AAAYG,IAAAA,OAAO;AAACC,IAAAA,IAAI,EAAEL;AAAWM,IAAAA,UAAU,EAAE;IAA/E,EACIX,aAAA,MAAA;AACIY,IAAAA,SAAS,EAAC;iBACA;AACVC,IAAAA,KAAK,EAAE;AACHC,MAAAA,eAAe,EAAE;AADd;GAHX,EAOId,aAAA,CAACO,KAAD;AAAwBK,IAAAA,SAAS,EAAC;GAAlC,CAPJ,EAQKT,KARL,CADJ,CAJJ,CADJ;AAmBH,CAtBsB;;;;"}
@@ -1,10 +1,10 @@
1
1
  import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import React__default, { useMemo } from 'react';
3
+ import { useLocalization } from '../Provider/Provider.js';
4
+ import { Group } from '../Group/Group.js';
3
5
  import { IconButton } from '../IconButton/IconButton.js';
4
6
  import { Button } from '../Button/Button.js';
5
- import { useLocalization } from '../Provider/Provider.js';
6
7
  import keycode from 'keycode';
7
- import { Group } from '../Group/Group.js';
8
8
  import Joyride, { ACTIONS, LIFECYCLE, EVENTS } from 'react-joyride';
9
9
  import { theme as tailwind_config_1 } from '../../../tailwind.config.js';
10
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"Treeview.js","sources":["../../../../../src/components/Treeview/Treeview.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nexport type TreeviewItemProps = React.LinkHTMLAttributes<HTMLAnchorElement>;\n\nconst TreeviewItem = React.forwardRef((props: TreeviewItemProps, ref: React.Ref<HTMLAnchorElement>) => {\n return <a {...props} ref={ref} />;\n});\n\nexport type TreeviewGroupProps = Omit<React.LinkHTMLAttributes<HTMLDivElement>, 'className' | 'onClick' | 'title'> & {\n /** Add a classname to the treeview */\n className?: string | ((expanded: boolean) => string);\n /**\n * Set wheter the region is expanded, showing the children, or collapsed.\n * Default value is `false`\n */\n expanded?: boolean;\n /** Region is expanded at mount and can't be collapsed */\n fixed?: boolean;\n /** Handler called when user clicks the title of the group */\n onClick?: (event: React.MouseEvent<HTMLDivElement>, expanded: boolean) => void;\n /** Text displayed in the group's header */\n title: React.ReactNode | ((expanded: boolean) => React.ReactNode);\n};\n\nconst TreeviewGroup = React.forwardRef((props: TreeviewGroupProps, ref: React.Ref<HTMLDivElement>) => {\n const {\n children,\n className: externalClassName,\n expanded: initialExpanded = false,\n title,\n fixed,\n onClick,\n ...otherProps\n } = props;\n const [expanded, setExpanded] = React.useState(fixed || initialExpanded);\n\n React.useEffect(() => {\n if (!fixed) {\n setExpanded(fixed || initialExpanded);\n }\n }, [fixed, initialExpanded]);\n\n const listClassName = cn('flex-col mb-0', {\n flex: expanded,\n hidden: !expanded,\n });\n\n const itemProps = {\n ...otherProps,\n 'aria-expanded': expanded,\n role: 'treeitem',\n tabIndex: -1,\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n const nextState = !expanded;\n\n if (!fixed) {\n setExpanded(nextState);\n }\n\n if (onClick) {\n onClick(event, nextState);\n }\n };\n\n const className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;\n\n return (\n <div {...itemProps} className={className} ref={ref}>\n <div onClick={handleClick}>{typeof title === 'function' ? title(expanded) : title}</div>\n <ul role=\"group\" className={listClassName}>\n {React.Children.toArray(children)\n .filter(item => !!item)\n .map((item, i) => (\n <li key={i} role=\"none\">\n {React.cloneElement(item as React.ReactElement<any>, { role: 'treeitem' })}\n </li>\n ))}\n </ul>\n </div>\n );\n});\n\nexport type TreeviewProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type FowardedTreeviewWithStatics = React.ForwardRefExoticComponent<TreeviewProps & React.RefAttributes<HTMLDivElement>> & {\n /** Navigable link */\n Item: React.ForwardRefExoticComponent<TreeviewItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /** Container for a set of related links, usually expandable */\n Group: React.ForwardRefExoticComponent<TreeviewGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Treeview = React.forwardRef((props: TreeviewProps, ref: React.Ref<HTMLDivElement>) => {\n return <div {...props} ref={ref} role=\"tree\" />;\n}) as FowardedTreeviewWithStatics;\n\nTreeview.Group = TreeviewGroup;\nTreeview.Item = TreeviewItem;\n"],"names":["TreeviewItem","React","forwardRef","props","ref","TreeviewGroup","children","externalClassName","className","expanded","initialExpanded","title","fixed","onClick","otherProps","useState","setExpanded","useEffect","listClassName","cn","flex","hidden","itemProps","role","tabIndex","handleClick","event","nextState","Children","toArray","filter","item","map","i","key","cloneElement","Treeview","Group","Item"],"mappings":";;;;;AAKA,IAAMA,YAAY,gBAAGC,cAAK,CAACC,UAAN,CAAiB,UAACC,KAAD,EAA2BC,GAA3B;AAClC,SAAOH,4BAAA,IAAA,oBAAOE;AAAOC,IAAAA,GAAG,EAAEA;IAAnB,CAAP;AACH,CAFoB,CAArB;AAoBA,IAAMC,aAAa,gBAAGJ,cAAK,CAACC,UAAN,CAAiB,UAACC,KAAD,EAA4BC,GAA5B;AACnC,MACIE,QADJ,GAQIH,KARJ,CACIG,QADJ;AAAA,MAEeC,iBAFf,GAQIJ,KARJ,CAEIK,SAFJ;AAAA,wBAQIL,KARJ,CAGIM,QAHJ;AAAA,MAGcC,eAHd,gCAGgC,KAHhC;AAAA,MAIIC,KAJJ,GAQIR,KARJ,CAIIQ,KAJJ;AAAA,MAKIC,KALJ,GAQIT,KARJ,CAKIS,KALJ;AAAA,MAMIC,OANJ,GAQIV,KARJ,CAMIU,OANJ;AAAA,MAOOC,UAPP,iCAQIX,KARJ;;AASA,wBAAgCF,cAAK,CAACc,QAAN,CAAeH,KAAK,IAAIF,eAAxB,CAAhC;AAAA,MAAOD,QAAP;AAAA,MAAiBO,WAAjB;;AAEAf,EAAAA,cAAK,CAACg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IAAN;AAAA,GADf,EAEIC,GAFJ,CAEQ,UAACD,IAAD,EAAOE,CAAP;AAAA,WACDhC,4BAAA,KAAA;AAAIiC,MAAAA,GAAG,EAAED;AAAGV,MAAAA,IAAI,EAAC;KAAjB,EACKtB,cAAK,CAACkC,YAAN,CAAmBJ,IAAnB,EAAoD;AAAER,MAAAA,IAAI,EAAE;AAAR,KAApD,CADL,CADC;AAAA,GAFR,CADL,CAFJ,CADJ;AAcH,CA1DqB,CAAtB;IAqEaa,QAAQ,gBAAGnC,cAAK,CAACC,UAAN,CAAiB,UAACC,KAAD,EAAuBC,GAAvB;AACrC,SAAOH,4BAAA,MAAA,oBAASE;AAAOC,IAAAA,GAAG,EAAEA;AAAKmB,IAAAA,IAAI,EAAC;IAA/B,CAAP;AACH,CAFuB;AAIxBa,QAAQ,CAACC,KAAT,GAAiBhC,aAAjB;AACA+B,QAAQ,CAACE,IAAT,GAAgBtC,YAAhB;;;;"}
1
+ {"version":3,"file":"Treeview.js","sources":["../../../../../src/components/Treeview/Treeview.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nexport type TreeviewItemProps = React.LinkHTMLAttributes<HTMLAnchorElement>;\n\nconst TreeviewItem = React.forwardRef((props: TreeviewItemProps, ref: React.Ref<HTMLAnchorElement>) => {\n return <a {...props} ref={ref} />;\n});\n\nexport type TreeviewGroupProps = Omit<React.LinkHTMLAttributes<HTMLDivElement>, 'className' | 'onClick' | 'title'> & {\n /** Add a classname to the treeview */\n className?: string | ((expanded: boolean) => string);\n /**\n * Set wheter the region is expanded, showing the children, or collapsed.\n * Default value is `false`\n */\n expanded?: boolean;\n /** Region is expanded at mount and can't be collapsed */\n fixed?: boolean;\n /** Handler called when user clicks the title of the group */\n onClick?: (event: React.MouseEvent<HTMLDivElement>, expanded: boolean) => void;\n /** Text displayed in the group's header */\n title: React.ReactNode | ((expanded: boolean) => React.ReactNode);\n};\n\nconst TreeviewGroup = React.forwardRef((props: TreeviewGroupProps, ref: React.Ref<HTMLDivElement>) => {\n const {\n children,\n className: externalClassName,\n expanded: initialExpanded = false,\n title,\n fixed,\n onClick,\n ...otherProps\n } = props;\n const [expanded, setExpanded] = React.useState(fixed || initialExpanded);\n\n React.useEffect(() => {\n if (!fixed) {\n setExpanded(fixed || initialExpanded);\n }\n }, [fixed, initialExpanded]);\n\n const listClassName = cn('flex-col mb-0', {\n flex: expanded,\n hidden: !expanded,\n });\n\n const itemProps = {\n ...otherProps,\n 'aria-expanded': expanded,\n role: 'treeitem',\n tabIndex: -1,\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n const nextState = !expanded;\n\n if (!fixed) {\n setExpanded(nextState);\n }\n\n if (onClick) {\n onClick(event, nextState);\n }\n };\n\n const className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;\n\n return (\n <div {...itemProps} className={className} ref={ref}>\n <div onClick={handleClick}>{typeof title === 'function' ? title(expanded) : title}</div>\n <ul role=\"group\" className={listClassName}>\n {React.Children.toArray(children)\n .filter(item => !!item)\n .map((item, i) => (\n <li key={i} role=\"none\">\n {React.cloneElement(item as React.ReactElement<any>, { role: 'treeitem' })}\n </li>\n ))}\n </ul>\n </div>\n );\n});\n\nexport type TreeviewProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type ForwardedTreeviewWithStatics = React.ForwardRefExoticComponent<\n TreeviewProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Navigable link */\n Item: React.ForwardRefExoticComponent<TreeviewItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /** Container for a set of related links, usually expandable */\n Group: React.ForwardRefExoticComponent<TreeviewGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Treeview = React.forwardRef((props: TreeviewProps, ref: React.Ref<HTMLDivElement>) => {\n return <div {...props} ref={ref} role=\"tree\" />;\n}) as ForwardedTreeviewWithStatics;\n\nTreeview.Group = TreeviewGroup;\nTreeview.Item = TreeviewItem;\n"],"names":["TreeviewItem","React","forwardRef","props","ref","TreeviewGroup","children","externalClassName","className","expanded","initialExpanded","title","fixed","onClick","otherProps","useState","setExpanded","useEffect","listClassName","cn","flex","hidden","itemProps","role","tabIndex","handleClick","event","nextState","Children","toArray","filter","item","map","i","key","cloneElement","Treeview","Group","Item"],"mappings":";;;;;AAKA,IAAMA,YAAY,gBAAGC,cAAK,CAACC,UAAN,CAAiB,UAACC,KAAD,EAA2BC,GAA3B;AAClC,SAAOH,4BAAA,IAAA,oBAAOE;AAAOC,IAAAA,GAAG,EAAEA;IAAnB,CAAP;AACH,CAFoB,CAArB;AAoBA,IAAMC,aAAa,gBAAGJ,cAAK,CAACC,UAAN,CAAiB,UAACC,KAAD,EAA4BC,GAA5B;AACnC,MACIE,QADJ,GAQIH,KARJ,CACIG,QADJ;AAAA,MAEeC,iBAFf,GAQIJ,KARJ,CAEIK,SAFJ;AAAA,wBAQIL,KARJ,CAGIM,QAHJ;AAAA,MAGcC,eAHd,gCAGgC,KAHhC;AAAA,MAIIC,KAJJ,GAQIR,KARJ,CAIIQ,KAJJ;AAAA,MAKIC,KALJ,GAQIT,KARJ,CAKIS,KALJ;AAAA,MAMIC,OANJ,GAQIV,KARJ,CAMIU,OANJ;AAAA,MAOOC,UAPP,iCAQIX,KARJ;;AASA,wBAAgCF,cAAK,CAACc,QAAN,CAAeH,KAAK,IAAIF,eAAxB,CAAhC;AAAA,MAAOD,QAAP;AAAA,MAAiBO,WAAjB;;AAEAf,EAAAA,cAAK,CAACgB,SAAN,CAAgB;AACZ,QAAI,CAACL,KAAL,EAAY;AACRI,MAAAA,WAAW,CAACJ,KAAK,IAAIF,eAAV,CAAX;AACH;AACJ,GAJD,EAIG,CAACE,KAAD,EAAQF,eAAR,CAJH;AAMA,MAAMQ,aAAa,GAAGC,EAAE,CAAC,eAAD,EAAkB;AACtCC,IAAAA,IAAI,EAAEX,QADgC;AAEtCY,IAAAA,MAAM,EAAE,CAACZ;AAF6B,GAAlB,CAAxB;;AAKA,MAAMa,SAAS,gBACRR,U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C,cAAK,CAACC,UAAN,CAAiB,UAACC,KAAD,EAAuBC,GAAvB;AACrC,SAAOH,4BAAA,MAAA,oBAASE;AAAOC,IAAAA,GAAG,EAAEA;AAAKmB,IAAAA,IAAI,EAAC;IAA/B,CAAP;AACH,CAFuB;AAIxBa,QAAQ,CAACC,KAAT,GAAiBhC,aAAjB;AACA+B,QAAQ,CAACE,IAAT,GAAgBtC,YAAhB;;;;"}
@@ -1,15 +1,20 @@
1
1
  export { icons } from './components/Icon/components/index.js';
2
2
  export { Icon } from './components/Icon/Icon.js';
3
3
  export { Accordion } from './components/Accordion/Accordion.js';
4
+ export { Backdrop } from './components/Backdrop/Backdrop.js';
4
5
  export { VisuallyHidden } from './components/VisuallyHidden/VisuallyHidden.js';
5
6
  export { Badge } from './components/Badge/Badge.js';
6
7
  export { Tooltip } from './components/Tooltip/Tooltip.js';
7
- export { IconButton } from './components/IconButton/IconButton.js';
8
- export { Banner } from './components/Banner/Banner.js';
9
- export { Button } from './components/Button/Button.js';
10
8
  export { Spinner } from './components/Spinner/Spinner.js';
11
9
  export { ToastProvider, useToast } from './components/Toast/Toaster.js';
12
10
  export { Provider, defaultLocalisationTexts, useLocalization, useTaco } from './components/Provider/Provider.js';
11
+ export { Hanger } from './components/Hanger/Hanger.js';
12
+ export { Group } from './components/Group/Group.js';
13
+ export { Dialog } from './components/Dialog/Dialog.js';
14
+ export { Popover } from './components/Popover/Popover.js';
15
+ export { IconButton } from './components/IconButton/IconButton.js';
16
+ export { Banner } from './components/Banner/Banner.js';
17
+ export { Button } from './components/Button/Button.js';
13
18
  export { Calendar } from './components/Calendar/Calendar.js';
14
19
  export { Checkbox } from './components/Checkbox/Checkbox.js';
15
20
  export { Input } from './components/Input/Input.js';
@@ -17,12 +22,8 @@ export { getNextIndexFromKeycode, useListKeyboardNavigation } from './utils/hook
17
22
  export { useListScrollTo } from './utils/hooks/useListScrollTo.js';
18
23
  export { Combobox } from './components/Combobox/Combobox.js';
19
24
  export { format, parseFromCustomString, parseFromISOString } from './utils/date.js';
20
- export { Popover } from './components/Popover/Popover.js';
21
25
  export { Datepicker } from './components/Datepicker/Datepicker.js';
22
- export { Group } from './components/Group/Group.js';
23
- export { Dialog } from './components/Dialog/Dialog.js';
24
26
  export { Form } from './components/Form/Form.js';
25
- export { Hanger } from './components/Hanger/Hanger.js';
26
27
  export { SearchInput } from './components/SearchInput/SearchInput.js';
27
28
  export { Label } from './components/Label/Label.js';
28
29
  export { Listbox, MultiListbox } from './components/Listbox/Listbox.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,18 +1,16 @@
1
1
  import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { forwardRef, createElement, Children } from 'react';
3
- import { Tooltip } from '../components/Tooltip/Tooltip.js';
4
3
 
5
- var _excluded = ["disabled", "target", "tooltip", "type"];
4
+ var _excluded = ["disabled", "target", "type"];
6
5
  var Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
7
6
  var disabled = props.disabled,
8
7
  target = props.target,
9
- tooltip = props.tooltip,
10
8
  _props$type = props.type,
11
9
  type = _props$type === void 0 ? 'button' : _props$type,
12
10
  otherProps = _objectWithoutPropertiesLoose(props, _excluded);
13
11
 
14
12
  var Tag = props.href ? 'a' : 'button';
15
- var button = createElement(Tag, Object.assign({}, otherProps, {
13
+ return createElement(Tag, Object.assign({}, otherProps, {
16
14
  "aria-disabled": disabled ? 'true' : undefined,
17
15
  disabled: disabled,
18
16
  target: Tag === 'a' ? target : undefined,
@@ -21,14 +19,6 @@ var Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
21
19
  }), Children.count(props.children) > 1 ? Children.map(props.children, function (child) {
22
20
  return typeof child === 'string' ? createElement("span", null, child) : child;
23
21
  }) : props.children);
24
-
25
- if (tooltip) {
26
- return createElement(Tooltip, {
27
- title: tooltip
28
- }, button);
29
- }
30
-
31
- return button;
32
22
  });
33
23
 
34
24
  export { Button };
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../src/primitives/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Tooltip } from '../components/Tooltip/Tooltip';\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 /** A tooltip to show when hovering over the button */\n tooltip?: string;\n};\n\nconst Button = React.forwardRef(function Button(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { disabled, target, tooltip, type = 'button', ...otherProps } = props;\n\n const Tag = props.href ? 'a' : 'button';\n\n const button = (\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 if (tooltip) {\n return <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n});\n\nexport { Button, ButtonProps };\n"],"names":["Button","React","props","ref","disabled","target","tooltip","type","otherProps","Tag","href","button","undefined","count","children","map","child","Tooltip","title"],"mappings":";;;;;IAcMA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;AAC5B,MAAQC,QAAR,GAAsEF,KAAtE,CAAQE,QAAR;AAAA,MAAkBC,MAAlB,GAAsEH,KAAtE,CAAkBG,MAAlB;AAAA,MAA0BC,OAA1B,GAAsEJ,KAAtE,CAA0BI,OAA1B;AAAA,oBAAsEJ,KAAtE,CAAmCK,IAAnC;AAAA,MAAmCA,IAAnC,4BAA0C,QAA1C;AAAA,MAAuDC,UAAvD,iCAAsEN,KAAtE;;AAEA,MAAMO,GAAG,GAAGP,KAAK,CAACQ,IAAN,GAAa,GAAb,GAAmB,QAA/B;AAEA,MAAMC,MAAM,GACRV,aAAA,CAACQ,GAAD,oBACQD;qBACWJ,QAAQ,GAAG,MAAH,GAAYQ;AACnCR,IAAAA,QAAQ,EAAEA;AACVC,IAAAA,MAAM,EAAEI,GAAG,KAAK,GAAR,GAAcJ,MAAd,GAAuBO;AAC/BL,IAAAA,IAAI,EAAEE,GAAG,KAAK,GAAR,GAAcF,IAAd,GAAqBK;AAC3BT,IAAAA,GAAG,EAAEA;IANT,EAQKF,QAAA,CAAeY,KAAf,CAAqBX,KAAK,CAACY,QAA3B,IAAuC,CAAvC,GACKb,QAAA,CAAec,GAAf,CAAmBb,KAAK,CAACY,QAAzB,EAAmC,UAAAE,KAAK;AAAA,WAAK,OAAOA,KAAP,KAAiB,QAAjB,GAA4Bf,aAAA,OAAA,MAAA,EAAOe,KAAP,CAA5B,GAAmDA,KAAxD;AAAA,GAAxC,CADL,GAEKd,KAAK,CAACY,QAVhB,CADJ;;AAeA,MAAIR,OAAJ,EAAa;AACT,WAAOL,aAAA,CAACgB,OAAD;AAASC,MAAAA,KAAK,EAAEZ;KAAhB,EAA0BK,MAA1B,CAAP;AACH;;AAED,SAAOA,MAAP;AACH,CAzBc;;;;"}
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":";;;;IAWMA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;AAC5B,MAAQC,QAAR,GAA6DF,KAA7D,CAAQE,QAAR;AAAA,MAAkBC,MAAlB,GAA6DH,KAA7D,CAAkBG,MAAlB;AAAA,oBAA6DH,KAA7D,CAA0BI,IAA1B;AAAA,MAA0BA,IAA1B,4BAAiC,QAAjC;AAAA,MAA8CC,UAA9C,iCAA6DL,KAA7D;;AAEA,MAAMM,GAAG,GAAGN,KAAK,CAACO,IAAN,GAAa,GAAb,GAAmB,QAA/B;AAEA,SACIR,aAAA,CAACO,GAAD,oBACQD;qBACWH,QAAQ,GAAG,MAAH,GAAYM;AACnCN,IAAAA,QAAQ,EAAEA;AACVC,IAAAA,MAAM,EAAEG,GAAG,KAAK,GAAR,GAAcH,MAAd,GAAuBK;AAC/BJ,IAAAA,IAAI,EAAEE,GAAG,KAAK,GAAR,GAAcF,IAAd,GAAqBI;AAC3BP,IAAAA,GAAG,EAAEA;IANT,EAQKF,QAAA,CAAeU,KAAf,CAAqBT,KAAK,CAACU,QAA3B,IAAuC,CAAvC,GACKX,QAAA,CAAeY,GAAf,CAAmBX,KAAK,CAACU,QAAzB,EAAmC,UAAAE,KAAK;AAAA,WAAK,OAAOA,KAAP,KAAiB,QAAjB,GAA4Bb,aAAA,OAAA,MAAA,EAAOa,KAAP,CAA5B,GAAmDA,KAAxD;AAAA,GAAxC,CADL,GAEKZ,KAAK,CAACU,QAVhB,CADJ;AAcH,CAnBc;;;;"}
@@ -0,0 +1,14 @@
1
+ function mergeRefs(refs) {
2
+ return function (value) {
3
+ refs.forEach(function (ref) {
4
+ if (typeof ref === 'function') {
5
+ ref(value);
6
+ } else if (ref != null) {
7
+ ref.current = value;
8
+ }
9
+ });
10
+ };
11
+ }
12
+
13
+ export default mergeRefs;
14
+ //# sourceMappingURL=mergeRefs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeRefs.js","sources":["../../../../src/utils/mergeRefs.ts"],"sourcesContent":["import React from 'react';\n\nexport default function mergeRefs<T = any>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T> {\n return value => {\n refs.forEach(ref => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref != null) {\n (ref as React.MutableRefObject<T | null>).current = value;\n }\n });\n };\n}\n"],"names":["mergeRefs","refs","value","forEach","ref","current"],"mappings":"SAEwBA,UAAmBC;AACvC,SAAO,UAAAC,KAAK;AACRD,IAAAA,IAAI,CAACE,OAAL,CAAa,UAAAC,GAAG;AACZ,UAAI,OAAOA,GAAP,KAAe,UAAnB,EAA+B;AAC3BA,QAAAA,GAAG,CAACF,KAAD,CAAH;AACH,OAFD,MAEO,IAAIE,GAAG,IAAI,IAAX,EAAiB;AACnBA,QAAAA,GAAwC,CAACC,OAAzC,GAAmDH,KAAnD;AACJ;AACJ,KAND;AAOH,GARD;AASH;;;;"}