@cimpress-ui/react 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commonjs/components/breadcrumbs/breadcrumbs.d.ts +22 -0
- package/dist/commonjs/components/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/commonjs/components/breadcrumbs/breadcrumbs.js +37 -0
- package/dist/commonjs/components/breadcrumbs/breadcrumbs.js.map +1 -0
- package/dist/commonjs/components/button/button.js +1 -1
- package/dist/commonjs/components/button/button.js.map +1 -1
- package/dist/commonjs/components/button/icon-button.js +1 -1
- package/dist/commonjs/components/button/icon-button.js.map +1 -1
- package/dist/commonjs/components/button/types.d.ts.map +1 -1
- package/dist/commonjs/components/button/types.js.map +1 -1
- package/dist/commonjs/components/card/card-context.d.ts +4 -0
- package/dist/commonjs/components/card/card-context.d.ts.map +1 -0
- package/dist/commonjs/components/card/card-context.js +6 -0
- package/dist/commonjs/components/card/card-context.js.map +1 -0
- package/dist/commonjs/components/card/card.d.ts +15 -0
- package/dist/commonjs/components/card/card.d.ts.map +1 -0
- package/dist/commonjs/components/card/card.js +24 -0
- package/dist/commonjs/components/card/card.js.map +1 -0
- package/dist/commonjs/components/checkbox/checkbox.d.ts +1 -1
- package/dist/commonjs/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox.js.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.d.ts +5 -1
- package/dist/commonjs/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.js +6 -6
- package/dist/commonjs/components/combo-box/combo-box.js.map +1 -1
- package/dist/commonjs/components/disclosure/disclosure-group.d.ts +10 -0
- package/dist/commonjs/components/disclosure/disclosure-group.d.ts.map +1 -0
- package/dist/commonjs/components/disclosure/disclosure-group.js +18 -0
- package/dist/commonjs/components/disclosure/disclosure-group.js.map +1 -0
- package/dist/commonjs/components/disclosure/disclosure.d.ts +14 -0
- package/dist/commonjs/components/disclosure/disclosure.d.ts.map +1 -0
- package/dist/commonjs/components/disclosure/disclosure.js +20 -0
- package/dist/commonjs/components/disclosure/disclosure.js.map +1 -0
- package/dist/commonjs/components/internal/collapsible-list/collapsible-list.d.ts +0 -14
- package/dist/commonjs/components/internal/collapsible-list/collapsible-list.d.ts.map +1 -1
- package/dist/commonjs/components/internal/collapsible-list/collapsible-list.js +2 -4
- package/dist/commonjs/components/internal/collapsible-list/collapsible-list.js.map +1 -1
- package/dist/commonjs/components/internal/form-field/form-field.d.ts +1 -28
- package/dist/commonjs/components/internal/form-field/form-field.d.ts.map +1 -1
- package/dist/commonjs/components/internal/form-field/form-field.js +10 -0
- package/dist/commonjs/components/internal/form-field/form-field.js.map +1 -1
- package/dist/commonjs/components/internal/spinner/spinner.d.ts +0 -16
- package/dist/commonjs/components/internal/spinner/spinner.d.ts.map +1 -1
- package/dist/commonjs/components/modal/modal.d.ts +19 -0
- package/dist/commonjs/components/modal/modal.d.ts.map +1 -0
- package/dist/commonjs/components/modal/modal.js +25 -0
- package/dist/commonjs/components/modal/modal.js.map +1 -0
- package/dist/commonjs/components/nav-tabs/nav-tabs.d.ts +23 -0
- package/dist/commonjs/components/nav-tabs/nav-tabs.d.ts.map +1 -0
- package/dist/commonjs/components/nav-tabs/nav-tabs.js +27 -0
- package/dist/commonjs/components/nav-tabs/nav-tabs.js.map +1 -0
- package/dist/commonjs/components/number-field/number-field.d.ts +10 -0
- package/dist/commonjs/components/number-field/number-field.d.ts.map +1 -0
- package/dist/commonjs/components/number-field/number-field.js +32 -0
- package/dist/commonjs/components/number-field/number-field.js.map +1 -0
- package/dist/commonjs/components/pagination/pagination.d.ts +14 -0
- package/dist/commonjs/components/pagination/pagination.d.ts.map +1 -0
- package/dist/commonjs/components/pagination/pagination.js +69 -0
- package/dist/commonjs/components/pagination/pagination.js.map +1 -0
- package/dist/commonjs/components/radio/radio.d.ts +1 -1
- package/dist/commonjs/components/radio/radio.d.ts.map +1 -1
- package/dist/commonjs/components/radio/radio.js.map +1 -1
- package/dist/commonjs/components/table/contexts/focus.d.ts +13 -0
- package/dist/commonjs/components/table/contexts/focus.d.ts.map +1 -0
- package/dist/commonjs/components/table/contexts/focus.js +51 -0
- package/dist/commonjs/components/table/contexts/focus.js.map +1 -0
- package/dist/commonjs/components/table/contexts/row-state.d.ts +10 -0
- package/dist/commonjs/components/table/contexts/row-state.d.ts.map +1 -0
- package/dist/commonjs/components/table/contexts/row-state.js +22 -0
- package/dist/commonjs/components/table/contexts/row-state.js.map +1 -0
- package/dist/commonjs/components/table/hooks/use-table-cell.d.ts +7 -0
- package/dist/commonjs/components/table/hooks/use-table-cell.d.ts.map +1 -0
- package/dist/commonjs/components/table/hooks/use-table-cell.js +125 -0
- package/dist/commonjs/components/table/hooks/use-table-cell.js.map +1 -0
- package/dist/commonjs/components/table/hooks/use-table.d.ts +7 -0
- package/dist/commonjs/components/table/hooks/use-table.d.ts.map +1 -0
- package/dist/commonjs/components/table/hooks/use-table.js +142 -0
- package/dist/commonjs/components/table/hooks/use-table.js.map +1 -0
- package/dist/commonjs/components/table/table-body-cell.d.ts +26 -0
- package/dist/commonjs/components/table/table-body-cell.d.ts.map +1 -0
- package/dist/commonjs/components/table/table-body-cell.js +17 -0
- package/dist/commonjs/components/table/table-body-cell.js.map +1 -0
- package/dist/commonjs/components/table/table-body.d.ts +8 -0
- package/dist/commonjs/components/table/table-body.d.ts.map +1 -0
- package/dist/commonjs/components/table/table-body.js +11 -0
- package/dist/commonjs/components/table/table-body.js.map +1 -0
- package/dist/commonjs/components/table/table-container.d.ts +8 -0
- package/dist/commonjs/components/table/table-container.d.ts.map +1 -0
- package/dist/commonjs/components/table/table-container.js +40 -0
- package/dist/commonjs/components/table/table-container.js.map +1 -0
- package/dist/commonjs/components/table/table-header-cell.d.ts +26 -0
- package/dist/commonjs/components/table/table-header-cell.d.ts.map +1 -0
- package/dist/commonjs/components/table/table-header-cell.js +17 -0
- package/dist/commonjs/components/table/table-header-cell.js.map +1 -0
- package/dist/commonjs/components/table/table-header.d.ts +8 -0
- package/dist/commonjs/components/table/table-header.d.ts.map +1 -0
- package/dist/commonjs/components/table/table-header.js +11 -0
- package/dist/commonjs/components/table/table-header.js.map +1 -0
- package/dist/commonjs/components/table/table-row.d.ts +21 -0
- package/dist/commonjs/components/table/table-row.d.ts.map +1 -0
- package/dist/commonjs/components/table/table-row.js +14 -0
- package/dist/commonjs/components/table/table-row.js.map +1 -0
- package/dist/commonjs/components/table/table.d.ts +26 -0
- package/dist/commonjs/components/table/table.d.ts.map +1 -0
- package/dist/commonjs/components/table/table.js +27 -0
- package/dist/commonjs/components/table/table.js.map +1 -0
- package/dist/commonjs/components/table/utils/focus-table-child.d.ts +4 -0
- package/dist/commonjs/components/table/utils/focus-table-child.d.ts.map +1 -0
- package/dist/commonjs/components/table/utils/focus-table-child.js +14 -0
- package/dist/commonjs/components/table/utils/focus-table-child.js.map +1 -0
- package/dist/commonjs/components/tag/tag-group.d.ts +18 -0
- package/dist/commonjs/components/tag/tag-group.d.ts.map +1 -0
- package/dist/commonjs/components/tag/tag-group.js +27 -0
- package/dist/commonjs/components/tag/tag-group.js.map +1 -0
- package/dist/commonjs/components/tag/tag.d.ts +17 -0
- package/dist/commonjs/components/tag/tag.d.ts.map +1 -0
- package/dist/commonjs/components/tag/tag.js +20 -0
- package/dist/commonjs/components/tag/tag.js.map +1 -0
- package/dist/commonjs/components/text-inputs/text-area.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/text-area.js +1 -1
- package/dist/commonjs/components/text-inputs/text-area.js.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.js +1 -1
- package/dist/commonjs/components/text-inputs/text-field.js.map +1 -1
- package/dist/commonjs/components/tooltip/tooltip.d.ts +9 -0
- package/dist/commonjs/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/commonjs/components/tooltip/tooltip.js +15 -0
- package/dist/commonjs/components/tooltip/tooltip.js.map +1 -0
- package/dist/commonjs/components/types.d.ts +16 -2
- package/dist/commonjs/components/types.d.ts.map +1 -1
- package/dist/commonjs/components/types.js.map +1 -1
- package/dist/commonjs/components/typography/link.d.ts +2 -2
- package/dist/commonjs/components/typography/link.d.ts.map +1 -1
- package/dist/commonjs/components/typography/link.js +3 -2
- package/dist/commonjs/components/typography/link.js.map +1 -1
- package/dist/commonjs/components/typography/types.d.ts +2 -1
- package/dist/commonjs/components/typography/types.d.ts.map +1 -1
- package/dist/commonjs/components/typography/types.js.map +1 -1
- package/dist/commonjs/components/typography/utils.d.ts.map +1 -1
- package/dist/commonjs/components/typography/utils.js +2 -2
- package/dist/commonjs/components/typography/utils.js.map +1 -1
- package/dist/commonjs/components/visually-hidden/visually-hidden.d.ts +17 -0
- package/dist/commonjs/components/visually-hidden/visually-hidden.d.ts.map +1 -0
- package/dist/commonjs/components/visually-hidden/visually-hidden.js +20 -0
- package/dist/commonjs/components/visually-hidden/visually-hidden.js.map +1 -0
- package/dist/commonjs/icons/accounting-document.d.ts +1 -1
- package/dist/commonjs/icons/accounting-document.d.ts.map +1 -1
- package/dist/commonjs/icons/accounting-document.js +4 -2
- package/dist/commonjs/icons/accounting-document.js.map +1 -1
- package/dist/commonjs/icons/add-circle-fill.d.ts +1 -1
- package/dist/commonjs/icons/add-circle-fill.d.ts.map +1 -1
- package/dist/commonjs/icons/add-circle-fill.js +4 -2
- package/dist/commonjs/icons/add-circle-fill.js.map +1 -1
- package/dist/commonjs/icons/add-circle.d.ts +1 -1
- package/dist/commonjs/icons/add-circle.d.ts.map +1 -1
- package/dist/commonjs/icons/add-circle.js +4 -2
- package/dist/commonjs/icons/add-circle.js.map +1 -1
- package/dist/commonjs/icons/add.d.ts +1 -1
- package/dist/commonjs/icons/add.d.ts.map +1 -1
- package/dist/commonjs/icons/add.js +4 -2
- package/dist/commonjs/icons/add.js.map +1 -1
- package/dist/commonjs/icons/alert-triangle.d.ts +1 -1
- package/dist/commonjs/icons/alert-triangle.d.ts.map +1 -1
- package/dist/commonjs/icons/alert-triangle.js +4 -2
- package/dist/commonjs/icons/alert-triangle.js.map +1 -1
- package/dist/commonjs/icons/calculator-alt.d.ts +1 -1
- package/dist/commonjs/icons/calculator-alt.d.ts.map +1 -1
- package/dist/commonjs/icons/calculator-alt.js +4 -2
- package/dist/commonjs/icons/calculator-alt.js.map +1 -1
- package/dist/commonjs/icons/calculator.d.ts +1 -1
- package/dist/commonjs/icons/calculator.d.ts.map +1 -1
- package/dist/commonjs/icons/calculator.js +4 -2
- package/dist/commonjs/icons/calculator.js.map +1 -1
- package/dist/commonjs/icons/checkmark-circle-fill.d.ts +1 -1
- package/dist/commonjs/icons/checkmark-circle-fill.d.ts.map +1 -1
- package/dist/commonjs/icons/checkmark-circle-fill.js +4 -2
- package/dist/commonjs/icons/checkmark-circle-fill.js.map +1 -1
- package/dist/commonjs/icons/checkmark-circle.d.ts +1 -1
- package/dist/commonjs/icons/checkmark-circle.d.ts.map +1 -1
- package/dist/commonjs/icons/checkmark-circle.js +4 -2
- package/dist/commonjs/icons/checkmark-circle.js.map +1 -1
- package/dist/commonjs/icons/checkmark-small.d.ts +1 -1
- package/dist/commonjs/icons/checkmark-small.d.ts.map +1 -1
- package/dist/commonjs/icons/checkmark-small.js +4 -2
- package/dist/commonjs/icons/checkmark-small.js.map +1 -1
- package/dist/commonjs/icons/checkmark.d.ts +1 -1
- package/dist/commonjs/icons/checkmark.d.ts.map +1 -1
- package/dist/commonjs/icons/checkmark.js +4 -2
- package/dist/commonjs/icons/checkmark.js.map +1 -1
- package/dist/commonjs/icons/chevron-down-fill.d.ts +1 -1
- package/dist/commonjs/icons/chevron-down-fill.d.ts.map +1 -1
- package/dist/commonjs/icons/chevron-down-fill.js +4 -2
- package/dist/commonjs/icons/chevron-down-fill.js.map +1 -1
- package/dist/commonjs/icons/error-circle-fill.d.ts +1 -1
- package/dist/commonjs/icons/error-circle-fill.d.ts.map +1 -1
- package/dist/commonjs/icons/error-circle-fill.js +5 -3
- package/dist/commonjs/icons/error-circle-fill.js.map +1 -1
- package/dist/commonjs/icons/index.d.ts +6 -0
- package/dist/commonjs/icons/index.d.ts.map +1 -1
- package/dist/commonjs/icons/index.js +13 -1
- package/dist/commonjs/icons/index.js.map +1 -1
- package/dist/commonjs/icons/info-circle-fill.d.ts +1 -1
- package/dist/commonjs/icons/info-circle-fill.d.ts.map +1 -1
- package/dist/commonjs/icons/info-circle-fill.js +4 -2
- package/dist/commonjs/icons/info-circle-fill.js.map +1 -1
- package/dist/commonjs/icons/minus-small.d.ts +1 -1
- package/dist/commonjs/icons/minus-small.d.ts.map +1 -1
- package/dist/commonjs/icons/minus-small.js +4 -2
- package/dist/commonjs/icons/minus-small.js.map +1 -1
- package/dist/commonjs/icons/minus.d.ts +8 -0
- package/dist/commonjs/icons/minus.d.ts.map +1 -0
- package/dist/commonjs/icons/minus.js +24 -0
- package/dist/commonjs/icons/minus.js.map +1 -0
- package/dist/commonjs/icons/unstable-chevron-left-fill.d.ts +8 -0
- package/dist/commonjs/icons/unstable-chevron-left-fill.d.ts.map +1 -0
- package/dist/commonjs/icons/unstable-chevron-left-fill.js +24 -0
- package/dist/commonjs/icons/unstable-chevron-left-fill.js.map +1 -0
- package/dist/commonjs/icons/unstable-chevron-right-fill.d.ts +8 -0
- package/dist/commonjs/icons/unstable-chevron-right-fill.d.ts.map +1 -0
- package/dist/commonjs/icons/unstable-chevron-right-fill.js +24 -0
- package/dist/commonjs/icons/unstable-chevron-right-fill.js.map +1 -0
- package/dist/commonjs/icons/unstable-close.d.ts +8 -0
- package/dist/commonjs/icons/unstable-close.d.ts.map +1 -0
- package/dist/commonjs/icons/unstable-close.js +24 -0
- package/dist/commonjs/icons/unstable-close.js.map +1 -0
- package/dist/commonjs/icons/unstable-info-circle.d.ts +8 -0
- package/dist/commonjs/icons/unstable-info-circle.d.ts.map +1 -0
- package/dist/commonjs/icons/unstable-info-circle.js +24 -0
- package/dist/commonjs/icons/unstable-info-circle.js.map +1 -0
- package/dist/commonjs/icons/unstable-placeholder.d.ts +8 -0
- package/dist/commonjs/icons/unstable-placeholder.d.ts.map +1 -0
- package/dist/commonjs/icons/unstable-placeholder.js +24 -0
- package/dist/commonjs/icons/unstable-placeholder.js.map +1 -0
- package/dist/commonjs/icons/warning-circle-fill.d.ts +1 -1
- package/dist/commonjs/icons/warning-circle-fill.d.ts.map +1 -1
- package/dist/commonjs/icons/warning-circle-fill.js +4 -2
- package/dist/commonjs/icons/warning-circle-fill.js.map +1 -1
- package/dist/commonjs/index.d.ts +21 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +19 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/utils/style/tone.d.ts +3 -0
- package/dist/commonjs/utils/style/tone.d.ts.map +1 -0
- package/dist/commonjs/utils/style/tone.js +7 -0
- package/dist/commonjs/utils/style/tone.js.map +1 -0
- package/dist/commonjs/utils/style/types.d.ts +2 -0
- package/dist/commonjs/utils/style/types.d.ts.map +1 -0
- package/dist/commonjs/utils/style/types.js +3 -0
- package/dist/commonjs/utils/style/types.js.map +1 -0
- package/dist/commonjs/with-style-props.d.ts +1 -1
- package/dist/commonjs/with-style-props.d.ts.map +1 -1
- package/dist/commonjs/with-style-props.js.map +1 -1
- package/dist/esm/components/breadcrumbs/breadcrumbs.d.ts +22 -0
- package/dist/esm/components/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/esm/components/breadcrumbs/breadcrumbs.js +30 -0
- package/dist/esm/components/breadcrumbs/breadcrumbs.js.map +1 -0
- package/dist/esm/components/button/button.js +1 -1
- package/dist/esm/components/button/button.js.map +1 -1
- package/dist/esm/components/button/icon-button.js +1 -1
- package/dist/esm/components/button/icon-button.js.map +1 -1
- package/dist/esm/components/button/types.d.ts.map +1 -1
- package/dist/esm/components/button/types.js.map +1 -1
- package/dist/esm/components/card/card-context.d.ts +4 -0
- package/dist/esm/components/card/card-context.d.ts.map +1 -0
- package/dist/esm/components/card/card-context.js +3 -0
- package/dist/esm/components/card/card-context.js.map +1 -0
- package/dist/esm/components/card/card.d.ts +15 -0
- package/dist/esm/components/card/card.d.ts.map +1 -0
- package/dist/esm/components/card/card.js +17 -0
- package/dist/esm/components/card/card.js.map +1 -0
- package/dist/esm/components/checkbox/checkbox.d.ts +1 -1
- package/dist/esm/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/esm/components/checkbox/checkbox.js.map +1 -1
- package/dist/esm/components/combo-box/combo-box.d.ts +5 -1
- package/dist/esm/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/esm/components/combo-box/combo-box.js +7 -7
- package/dist/esm/components/combo-box/combo-box.js.map +1 -1
- package/dist/esm/components/disclosure/disclosure-group.d.ts +10 -0
- package/dist/esm/components/disclosure/disclosure-group.d.ts.map +1 -0
- package/dist/esm/components/disclosure/disclosure-group.js +12 -0
- package/dist/esm/components/disclosure/disclosure-group.js.map +1 -0
- package/dist/esm/components/disclosure/disclosure.d.ts +14 -0
- package/dist/esm/components/disclosure/disclosure.d.ts.map +1 -0
- package/dist/esm/components/disclosure/disclosure.js +14 -0
- package/dist/esm/components/disclosure/disclosure.js.map +1 -0
- package/dist/esm/components/internal/collapsible-list/collapsible-list.d.ts +0 -14
- package/dist/esm/components/internal/collapsible-list/collapsible-list.d.ts.map +1 -1
- package/dist/esm/components/internal/collapsible-list/collapsible-list.js +2 -4
- package/dist/esm/components/internal/collapsible-list/collapsible-list.js.map +1 -1
- package/dist/esm/components/internal/form-field/form-field.d.ts +1 -28
- package/dist/esm/components/internal/form-field/form-field.d.ts.map +1 -1
- package/dist/esm/components/internal/form-field/form-field.js +10 -1
- package/dist/esm/components/internal/form-field/form-field.js.map +1 -1
- package/dist/esm/components/internal/spinner/spinner.d.ts +0 -16
- package/dist/esm/components/internal/spinner/spinner.d.ts.map +1 -1
- package/dist/esm/components/modal/modal.d.ts +19 -0
- package/dist/esm/components/modal/modal.d.ts.map +1 -0
- package/dist/esm/components/modal/modal.js +18 -0
- package/dist/esm/components/modal/modal.js.map +1 -0
- package/dist/esm/components/nav-tabs/nav-tabs.d.ts +23 -0
- package/dist/esm/components/nav-tabs/nav-tabs.d.ts.map +1 -0
- package/dist/esm/components/nav-tabs/nav-tabs.js +20 -0
- package/dist/esm/components/nav-tabs/nav-tabs.js.map +1 -0
- package/dist/esm/components/number-field/number-field.d.ts +10 -0
- package/dist/esm/components/number-field/number-field.d.ts.map +1 -0
- package/dist/esm/components/number-field/number-field.js +26 -0
- package/dist/esm/components/number-field/number-field.js.map +1 -0
- package/dist/esm/components/pagination/pagination.d.ts +14 -0
- package/dist/esm/components/pagination/pagination.d.ts.map +1 -0
- package/dist/esm/components/pagination/pagination.js +66 -0
- package/dist/esm/components/pagination/pagination.js.map +1 -0
- package/dist/esm/components/radio/radio.d.ts +1 -1
- package/dist/esm/components/radio/radio.d.ts.map +1 -1
- package/dist/esm/components/radio/radio.js.map +1 -1
- package/dist/esm/components/table/contexts/focus.d.ts +13 -0
- package/dist/esm/components/table/contexts/focus.d.ts.map +1 -0
- package/dist/esm/components/table/contexts/focus.js +47 -0
- package/dist/esm/components/table/contexts/focus.js.map +1 -0
- package/dist/esm/components/table/contexts/row-state.d.ts +10 -0
- package/dist/esm/components/table/contexts/row-state.d.ts.map +1 -0
- package/dist/esm/components/table/contexts/row-state.js +18 -0
- package/dist/esm/components/table/contexts/row-state.js.map +1 -0
- package/dist/esm/components/table/hooks/use-table-cell.d.ts +7 -0
- package/dist/esm/components/table/hooks/use-table-cell.d.ts.map +1 -0
- package/dist/esm/components/table/hooks/use-table-cell.js +122 -0
- package/dist/esm/components/table/hooks/use-table-cell.js.map +1 -0
- package/dist/esm/components/table/hooks/use-table.d.ts +7 -0
- package/dist/esm/components/table/hooks/use-table.d.ts.map +1 -0
- package/dist/esm/components/table/hooks/use-table.js +139 -0
- package/dist/esm/components/table/hooks/use-table.js.map +1 -0
- package/dist/esm/components/table/table-body-cell.d.ts +26 -0
- package/dist/esm/components/table/table-body-cell.d.ts.map +1 -0
- package/dist/esm/components/table/table-body-cell.js +14 -0
- package/dist/esm/components/table/table-body-cell.js.map +1 -0
- package/dist/esm/components/table/table-body.d.ts +8 -0
- package/dist/esm/components/table/table-body.d.ts.map +1 -0
- package/dist/esm/components/table/table-body.js +8 -0
- package/dist/esm/components/table/table-body.js.map +1 -0
- package/dist/esm/components/table/table-container.d.ts +8 -0
- package/dist/esm/components/table/table-container.d.ts.map +1 -0
- package/dist/esm/components/table/table-container.js +34 -0
- package/dist/esm/components/table/table-container.js.map +1 -0
- package/dist/esm/components/table/table-header-cell.d.ts +26 -0
- package/dist/esm/components/table/table-header-cell.d.ts.map +1 -0
- package/dist/esm/components/table/table-header-cell.js +14 -0
- package/dist/esm/components/table/table-header-cell.js.map +1 -0
- package/dist/esm/components/table/table-header.d.ts +8 -0
- package/dist/esm/components/table/table-header.d.ts.map +1 -0
- package/dist/esm/components/table/table-header.js +8 -0
- package/dist/esm/components/table/table-header.js.map +1 -0
- package/dist/esm/components/table/table-row.d.ts +21 -0
- package/dist/esm/components/table/table-row.d.ts.map +1 -0
- package/dist/esm/components/table/table-row.js +11 -0
- package/dist/esm/components/table/table-row.js.map +1 -0
- package/dist/esm/components/table/table.d.ts +26 -0
- package/dist/esm/components/table/table.d.ts.map +1 -0
- package/dist/esm/components/table/table.js +24 -0
- package/dist/esm/components/table/table.js.map +1 -0
- package/dist/esm/components/table/utils/focus-table-child.d.ts +4 -0
- package/dist/esm/components/table/utils/focus-table-child.d.ts.map +1 -0
- package/dist/esm/components/table/utils/focus-table-child.js +11 -0
- package/dist/esm/components/table/utils/focus-table-child.js.map +1 -0
- package/dist/esm/components/tag/tag-group.d.ts +18 -0
- package/dist/esm/components/tag/tag-group.d.ts.map +1 -0
- package/dist/esm/components/tag/tag-group.js +21 -0
- package/dist/esm/components/tag/tag-group.js.map +1 -0
- package/dist/esm/components/tag/tag.d.ts +17 -0
- package/dist/esm/components/tag/tag.d.ts.map +1 -0
- package/dist/esm/components/tag/tag.js +14 -0
- package/dist/esm/components/tag/tag.js.map +1 -0
- package/dist/esm/components/text-inputs/text-area.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/text-area.js +3 -3
- package/dist/esm/components/text-inputs/text-area.js.map +1 -1
- package/dist/esm/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/text-field.js +3 -3
- package/dist/esm/components/text-inputs/text-field.js.map +1 -1
- package/dist/esm/components/tooltip/tooltip.d.ts +9 -0
- package/dist/esm/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/esm/components/tooltip/tooltip.js +9 -0
- package/dist/esm/components/tooltip/tooltip.js.map +1 -0
- package/dist/esm/components/types.d.ts +16 -2
- package/dist/esm/components/types.d.ts.map +1 -1
- package/dist/esm/components/types.js.map +1 -1
- package/dist/esm/components/typography/link.d.ts +2 -2
- package/dist/esm/components/typography/link.d.ts.map +1 -1
- package/dist/esm/components/typography/link.js +3 -2
- package/dist/esm/components/typography/link.js.map +1 -1
- package/dist/esm/components/typography/types.d.ts +2 -1
- package/dist/esm/components/typography/types.d.ts.map +1 -1
- package/dist/esm/components/typography/types.js.map +1 -1
- package/dist/esm/components/typography/utils.d.ts.map +1 -1
- package/dist/esm/components/typography/utils.js +2 -2
- package/dist/esm/components/typography/utils.js.map +1 -1
- package/dist/esm/components/visually-hidden/visually-hidden.d.ts +17 -0
- package/dist/esm/components/visually-hidden/visually-hidden.d.ts.map +1 -0
- package/dist/esm/components/visually-hidden/visually-hidden.js +14 -0
- package/dist/esm/components/visually-hidden/visually-hidden.js.map +1 -0
- package/dist/esm/icons/accounting-document.d.ts +1 -1
- package/dist/esm/icons/accounting-document.d.ts.map +1 -1
- package/dist/esm/icons/accounting-document.js +4 -2
- package/dist/esm/icons/accounting-document.js.map +1 -1
- package/dist/esm/icons/add-circle-fill.d.ts +1 -1
- package/dist/esm/icons/add-circle-fill.d.ts.map +1 -1
- package/dist/esm/icons/add-circle-fill.js +4 -2
- package/dist/esm/icons/add-circle-fill.js.map +1 -1
- package/dist/esm/icons/add-circle.d.ts +1 -1
- package/dist/esm/icons/add-circle.d.ts.map +1 -1
- package/dist/esm/icons/add-circle.js +4 -2
- package/dist/esm/icons/add-circle.js.map +1 -1
- package/dist/esm/icons/add.d.ts +1 -1
- package/dist/esm/icons/add.d.ts.map +1 -1
- package/dist/esm/icons/add.js +4 -2
- package/dist/esm/icons/add.js.map +1 -1
- package/dist/esm/icons/alert-triangle.d.ts +1 -1
- package/dist/esm/icons/alert-triangle.d.ts.map +1 -1
- package/dist/esm/icons/alert-triangle.js +4 -2
- package/dist/esm/icons/alert-triangle.js.map +1 -1
- package/dist/esm/icons/calculator-alt.d.ts +1 -1
- package/dist/esm/icons/calculator-alt.d.ts.map +1 -1
- package/dist/esm/icons/calculator-alt.js +4 -2
- package/dist/esm/icons/calculator-alt.js.map +1 -1
- package/dist/esm/icons/calculator.d.ts +1 -1
- package/dist/esm/icons/calculator.d.ts.map +1 -1
- package/dist/esm/icons/calculator.js +4 -2
- package/dist/esm/icons/calculator.js.map +1 -1
- package/dist/esm/icons/checkmark-circle-fill.d.ts +1 -1
- package/dist/esm/icons/checkmark-circle-fill.d.ts.map +1 -1
- package/dist/esm/icons/checkmark-circle-fill.js +4 -2
- package/dist/esm/icons/checkmark-circle-fill.js.map +1 -1
- package/dist/esm/icons/checkmark-circle.d.ts +1 -1
- package/dist/esm/icons/checkmark-circle.d.ts.map +1 -1
- package/dist/esm/icons/checkmark-circle.js +4 -2
- package/dist/esm/icons/checkmark-circle.js.map +1 -1
- package/dist/esm/icons/checkmark-small.d.ts +1 -1
- package/dist/esm/icons/checkmark-small.d.ts.map +1 -1
- package/dist/esm/icons/checkmark-small.js +4 -2
- package/dist/esm/icons/checkmark-small.js.map +1 -1
- package/dist/esm/icons/checkmark.d.ts +1 -1
- package/dist/esm/icons/checkmark.d.ts.map +1 -1
- package/dist/esm/icons/checkmark.js +4 -2
- package/dist/esm/icons/checkmark.js.map +1 -1
- package/dist/esm/icons/chevron-down-fill.d.ts +1 -1
- package/dist/esm/icons/chevron-down-fill.d.ts.map +1 -1
- package/dist/esm/icons/chevron-down-fill.js +4 -2
- package/dist/esm/icons/chevron-down-fill.js.map +1 -1
- package/dist/esm/icons/error-circle-fill.d.ts +1 -1
- package/dist/esm/icons/error-circle-fill.d.ts.map +1 -1
- package/dist/esm/icons/error-circle-fill.js +6 -4
- package/dist/esm/icons/error-circle-fill.js.map +1 -1
- package/dist/esm/icons/index.d.ts +6 -0
- package/dist/esm/icons/index.d.ts.map +1 -1
- package/dist/esm/icons/index.js +6 -0
- package/dist/esm/icons/index.js.map +1 -1
- package/dist/esm/icons/info-circle-fill.d.ts +1 -1
- package/dist/esm/icons/info-circle-fill.d.ts.map +1 -1
- package/dist/esm/icons/info-circle-fill.js +4 -2
- package/dist/esm/icons/info-circle-fill.js.map +1 -1
- package/dist/esm/icons/minus-small.d.ts +1 -1
- package/dist/esm/icons/minus-small.d.ts.map +1 -1
- package/dist/esm/icons/minus-small.js +4 -2
- package/dist/esm/icons/minus-small.js.map +1 -1
- package/dist/esm/icons/minus.d.ts +8 -0
- package/dist/esm/icons/minus.d.ts.map +1 -0
- package/dist/esm/icons/minus.js +19 -0
- package/dist/esm/icons/minus.js.map +1 -0
- package/dist/esm/icons/unstable-chevron-left-fill.d.ts +8 -0
- package/dist/esm/icons/unstable-chevron-left-fill.d.ts.map +1 -0
- package/dist/esm/icons/unstable-chevron-left-fill.js +19 -0
- package/dist/esm/icons/unstable-chevron-left-fill.js.map +1 -0
- package/dist/esm/icons/unstable-chevron-right-fill.d.ts +8 -0
- package/dist/esm/icons/unstable-chevron-right-fill.d.ts.map +1 -0
- package/dist/esm/icons/unstable-chevron-right-fill.js +19 -0
- package/dist/esm/icons/unstable-chevron-right-fill.js.map +1 -0
- package/dist/esm/icons/unstable-close.d.ts +8 -0
- package/dist/esm/icons/unstable-close.d.ts.map +1 -0
- package/dist/esm/icons/unstable-close.js +19 -0
- package/dist/esm/icons/unstable-close.js.map +1 -0
- package/dist/esm/icons/unstable-info-circle.d.ts +8 -0
- package/dist/esm/icons/unstable-info-circle.d.ts.map +1 -0
- package/dist/esm/icons/unstable-info-circle.js +19 -0
- package/dist/esm/icons/unstable-info-circle.js.map +1 -0
- package/dist/esm/icons/unstable-placeholder.d.ts +8 -0
- package/dist/esm/icons/unstable-placeholder.d.ts.map +1 -0
- package/dist/esm/icons/unstable-placeholder.js +19 -0
- package/dist/esm/icons/unstable-placeholder.js.map +1 -0
- package/dist/esm/icons/warning-circle-fill.d.ts +1 -1
- package/dist/esm/icons/warning-circle-fill.d.ts.map +1 -1
- package/dist/esm/icons/warning-circle-fill.js +4 -2
- package/dist/esm/icons/warning-circle-fill.js.map +1 -1
- package/dist/esm/index.d.ts +21 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +19 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/style/tone.d.ts +3 -0
- package/dist/esm/utils/style/tone.d.ts.map +1 -0
- package/dist/esm/utils/style/tone.js +4 -0
- package/dist/esm/utils/style/tone.js.map +1 -0
- package/dist/esm/utils/style/types.d.ts +2 -0
- package/dist/esm/utils/style/types.d.ts.map +1 -0
- package/dist/esm/utils/style/types.js +2 -0
- package/dist/esm/utils/style/types.js.map +1 -0
- package/dist/esm/with-style-props.d.ts +1 -1
- package/dist/esm/with-style-props.d.ts.map +1 -1
- package/dist/esm/with-style-props.js.map +1 -1
- package/dist-styles/styles.css +1 -1
- package/package.json +5 -2
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTableCell = useTableCell;
|
|
4
|
+
const focus_1 = require("@react-aria/focus");
|
|
5
|
+
const interactions_1 = require("@react-aria/interactions");
|
|
6
|
+
const utils_1 = require("@react-aria/utils");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const focus_js_1 = require("../contexts/focus.js");
|
|
9
|
+
const focus_table_child_js_1 = require("../utils/focus-table-child.js");
|
|
10
|
+
function useTableCell(ref, rowKey, columnKey) {
|
|
11
|
+
const tableFocus = (0, focus_js_1.useTableFocus)();
|
|
12
|
+
const isTabbable = rowKey === tableFocus.focusedRowKey && columnKey === tableFocus.focusedColumnKey;
|
|
13
|
+
// Handles focusing the cell.
|
|
14
|
+
// If there is a focusable child, it is focused, otherwise the cell itself is focused.
|
|
15
|
+
const focusCell = () => {
|
|
16
|
+
if (!ref.current) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// If focus is already on a focusable child within the cell, early return so we don't shift focus
|
|
20
|
+
if (ref.current.contains(document.activeElement) && ref.current !== document.activeElement) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const treeWalker = (0, focus_1.getFocusableTreeWalker)(ref.current);
|
|
24
|
+
const focusable = tableFocus.childFocusStrategy === 'last' ? treeWalker.lastChild() : treeWalker.firstChild();
|
|
25
|
+
if (focusable) {
|
|
26
|
+
// Cell has focusable children, focus the child
|
|
27
|
+
(0, focus_table_child_js_1.focusTableChild)(focusable);
|
|
28
|
+
}
|
|
29
|
+
else if (!ref.current.contains(document.activeElement)) {
|
|
30
|
+
// Cell has no focusable children and current focus is outside of the cell, focus the cell itself
|
|
31
|
+
(0, focus_table_child_js_1.focusTableChild)(ref.current);
|
|
32
|
+
}
|
|
33
|
+
else if (ref.current === document.activeElement && !isTabbable) {
|
|
34
|
+
// Focus is on the current cell, but table focus is elsewhere, update table focus state
|
|
35
|
+
tableFocus.setFocus(rowKey, columnKey);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
// Focus the cell DOM node when table focus moves to this cell
|
|
39
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
40
|
+
if (isTabbable && !ref.current.contains(document.activeElement)) {
|
|
41
|
+
focusCell();
|
|
42
|
+
}
|
|
43
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
+
}, [ref, isTabbable]);
|
|
45
|
+
const onFocus = (e) => {
|
|
46
|
+
// Ignore focus events bubbling through portals
|
|
47
|
+
if (!e.currentTarget.contains(e.target)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// If cell is already focused, return early
|
|
51
|
+
if (e.currentTarget.contains(e.relatedTarget)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (e.target !== ref.current) {
|
|
55
|
+
// If a child element of the cell receives focus, there are 3 scenarios:
|
|
56
|
+
// - focus happens through a press, we need to update table focus state to the current cell
|
|
57
|
+
// - focus happens through arrow key navigation within the table,
|
|
58
|
+
// we do nothing as table focus state would have already been updated earlier
|
|
59
|
+
// - focus happens through tabbing into the table from outside,
|
|
60
|
+
// we do nothing because we want to restore focus to the previously focused cell,
|
|
61
|
+
// and overriding table focus state would make that impossible
|
|
62
|
+
if (!(0, interactions_1.isFocusVisible)()) {
|
|
63
|
+
tableFocus.setFocus(rowKey, columnKey);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// If the cell itself receives focus, wait a frame so that focus finishes propagating
|
|
68
|
+
// up to the tree, and move focus to a focusable child if possible.
|
|
69
|
+
requestAnimationFrame(() => {
|
|
70
|
+
if (document.activeElement === ref.current) {
|
|
71
|
+
focusCell();
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
// Handles keyboard navigation between focusable children within the cell.
|
|
77
|
+
const onKeyDownCapture = (e) => {
|
|
78
|
+
// Ignore keyboard events bubbling through portals
|
|
79
|
+
if (!e.currentTarget.contains(e.target) || !ref.current || !document.activeElement) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const walker = (0, focus_1.getFocusableTreeWalker)(ref.current);
|
|
83
|
+
walker.currentNode = document.activeElement;
|
|
84
|
+
if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
|
|
85
|
+
// Move to the previous/next focusable element within the cell
|
|
86
|
+
const childElementToFocus = e.key === 'ArrowLeft' ? walker.previousNode() : walker.nextNode();
|
|
87
|
+
if (childElementToFocus && childElementToFocus !== ref.current) {
|
|
88
|
+
(0, focus_table_child_js_1.focusTableChild)(childElementToFocus);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// If there is no previous/next focusable element within the current cell, focus should move to the previous/next cell.
|
|
92
|
+
// This is handled by `useTable`, so we need to let the event bubble up to it.
|
|
93
|
+
// But we also don't want this event to reach children of the current cell, as arrow keys should be used exclusively for table navigation.
|
|
94
|
+
// Solution: re-dispatch the event from a parent element of the current cell.
|
|
95
|
+
ref.current.parentElement.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
99
|
+
// Move to the previous/next cell in the current column.
|
|
100
|
+
// This is handled by `useTable`, so we need to let the event bubble up to it.
|
|
101
|
+
// But we also don't want this event to reach children of the current cell, as arrow keys should be used exclusively for table navigation.
|
|
102
|
+
// Solution: re-dispatch the event from a parent element of the current cell.
|
|
103
|
+
ref.current.parentElement?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// if we didn't handle anything, return early so we don't stop propagation and preventDefault
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
e.stopPropagation();
|
|
111
|
+
};
|
|
112
|
+
const { focusProps, isFocused } = (0, focus_1.useFocusRing)();
|
|
113
|
+
const customProps = {
|
|
114
|
+
tabIndex: isTabbable ? 0 : -1,
|
|
115
|
+
onFocus,
|
|
116
|
+
onKeyDownCapture,
|
|
117
|
+
'data-cell-row-key': rowKey,
|
|
118
|
+
'data-cell-column-key': columnKey,
|
|
119
|
+
'data-focused': isFocused || undefined,
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
cellProps: (0, utils_1.mergeProps)(focusProps, customProps),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=use-table-cell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-table-cell.js","sourceRoot":"","sources":["../../../../../src/components/table/hooks/use-table-cell.ts"],"names":[],"mappings":";;AAYA,oCA6HC;AAzID,6CAAyE;AACzE,2DAA0D;AAC1D,6CAA+C;AAC/C,iCAA2G;AAE3G,mDAAqD;AACrD,wEAAgE;AAMhE,SAAgB,YAAY,CAAC,GAAoC,EAAE,MAAc,EAAE,SAAiB;IAClG,MAAM,UAAU,GAAG,IAAA,wBAAa,GAAE,CAAC;IAEnC,MAAM,UAAU,GAAG,MAAM,KAAK,UAAU,CAAC,aAAa,IAAI,SAAS,KAAK,UAAU,CAAC,gBAAgB,CAAC;IAEpG,6BAA6B;IAC7B,sFAAsF;IACtF,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QAED,iGAAiG;QACjG,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,aAAa,EAAE,CAAC;YAC3F,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,IAAA,8BAAsB,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACvD,MAAM,SAAS,GAAG,UAAU,CAAC,kBAAkB,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAE9G,IAAI,SAAS,EAAE,CAAC;YACd,+CAA+C;YAC/C,IAAA,sCAAe,EAAC,SAA6B,CAAC,CAAC;QACjD,CAAC;aAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,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SAAS,IAAI,CAAC,CAAC,GAAG,KAAK,WAAW,EAAE,CAAC;YACxD,wDAAwD;YACxD,8EAA8E;YAC9E,0IAA0I;YAC1I,6EAA6E;YAC7E,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QACjG,CAAC;aAAM,CAAC;YACN,6FAA6F;YAC7F,OAAO;QACT,CAAC;QAED,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,CAAC,CAAC,eAAe,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAEjD,MAAM,WAAW,GAA6C;QAC5D,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,OAAO;QACP,gBAAgB;QAChB,mBAAmB,EAAE,MAAM;QAC3B,sBAAsB,EAAE,SAAS;QACjC,cAAc,EAAE,SAAS,IAAI,SAAS;KACvC,CAAC;IAEF,OAAO;QACL,SAAS,EAAE,IAAA,kBAAU,EAAC,UAAU,EAAE,WAAW,CAAC;KAC/C,CAAC;AACJ,CAAC","sourcesContent":["import { getFocusableTreeWalker, useFocusRing } from '@react-aria/focus';\nimport { isFocusVisible } from '@react-aria/interactions';\nimport { mergeProps } from '@react-aria/utils';\nimport { type KeyboardEventHandler, useLayoutEffect, type FocusEventHandler, type RefObject } from 'react';\nimport type { FocusableElement, NativeElementProps } from '../../types.js';\nimport { useTableFocus } from '../contexts/focus.js';\nimport { focusTableChild } from '../utils/focus-table-child.js';\n\nexport interface UseTableCell {\n cellProps: NativeElementProps<HTMLTableCellElement>;\n}\n\nexport function useTableCell(ref: RefObject<HTMLTableCellElement>, rowKey: string, columnKey: string): UseTableCell {\n const tableFocus = useTableFocus();\n\n const isTabbable = rowKey === tableFocus.focusedRowKey && columnKey === tableFocus.focusedColumnKey;\n\n // Handles focusing the cell.\n // If there is a focusable child, it is focused, otherwise the cell itself is focused.\n const focusCell = () => {\n if (!ref.current) {\n return;\n }\n\n // If focus is already on a focusable child within the cell, early return so we don't shift focus\n if (ref.current.contains(document.activeElement) && ref.current !== document.activeElement) {\n return;\n }\n\n const treeWalker = getFocusableTreeWalker(ref.current);\n const focusable = tableFocus.childFocusStrategy === 'last' ? treeWalker.lastChild() : treeWalker.firstChild();\n\n if (focusable) {\n // Cell has focusable children, focus the child\n focusTableChild(focusable as FocusableElement);\n } else if (!ref.current.contains(document.activeElement)) {\n // Cell has no focusable children and current focus is outside of the cell, focus the cell itself\n focusTableChild(ref.current);\n } else if (ref.current === document.activeElement && !isTabbable) {\n // Focus is on the current cell, but table focus is elsewhere, update table focus state\n tableFocus.setFocus(rowKey, columnKey);\n }\n };\n\n // Focus the cell DOM node when table focus moves to this cell\n useLayoutEffect(() => {\n if (isTabbable && !ref.current!.contains(document.activeElement)) {\n focusCell();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [ref, isTabbable]);\n\n const onFocus: FocusEventHandler = (e) => {\n // Ignore focus events bubbling through portals\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n // If cell is already focused, return early\n if (e.currentTarget.contains(e.relatedTarget)) {\n return;\n }\n\n if (e.target !== ref.current) {\n // If a child element of the cell receives focus, there are 3 scenarios:\n // - focus happens through a press, we need to update table focus state to the current cell\n // - focus happens through arrow key navigation within the table,\n // we do nothing as table focus state would have already been updated earlier\n // - focus happens through tabbing into the table from outside,\n // we do nothing because we want to restore focus to the previously focused cell,\n // and overriding table focus state would make that impossible\n if (!isFocusVisible()) {\n tableFocus.setFocus(rowKey, columnKey);\n }\n } else {\n // If the cell itself receives focus, wait a frame so that focus finishes propagating\n // up to the tree, and move focus to a focusable child if possible.\n requestAnimationFrame(() => {\n if (document.activeElement === ref.current) {\n focusCell();\n }\n });\n }\n };\n\n // Handles keyboard navigation between focusable children within the cell.\n const onKeyDownCapture: KeyboardEventHandler = (e) => {\n // Ignore keyboard events bubbling through portals\n if (!e.currentTarget.contains(e.target as Element) || !ref.current || !document.activeElement) {\n return;\n }\n\n const walker = getFocusableTreeWalker(ref.current);\n walker.currentNode = document.activeElement;\n\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n // Move to the previous/next focusable element within the cell\n const childElementToFocus = e.key === 'ArrowLeft' ? walker.previousNode() : walker.nextNode();\n\n if (childElementToFocus && childElementToFocus !== ref.current) {\n focusTableChild(childElementToFocus as FocusableElement);\n } else {\n // If there is no previous/next focusable element within the current cell, focus should move to the previous/next cell.\n // This is handled by `useTable`, so we need to let the event bubble up to it.\n // But we also don't want this event to reach children of the current cell, as arrow keys should be used exclusively for table navigation.\n // Solution: re-dispatch the event from a parent element of the current cell.\n ref.current.parentElement!.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));\n }\n } else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n // Move to the previous/next cell in the current column.\n // This is handled by `useTable`, so we need to let the event bubble up to it.\n // But we also don't want this event to reach children of the current cell, as arrow keys should be used exclusively for table navigation.\n // Solution: re-dispatch the event from a parent element of the current cell.\n ref.current.parentElement?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));\n } else {\n // if we didn't handle anything, return early so we don't stop propagation and preventDefault\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n };\n\n const { focusProps, isFocused } = useFocusRing();\n\n const customProps: NativeElementProps<HTMLTableCellElement> = {\n tabIndex: isTabbable ? 0 : -1,\n onFocus,\n onKeyDownCapture,\n 'data-cell-row-key': rowKey,\n 'data-cell-column-key': columnKey,\n 'data-focused': isFocused || undefined,\n };\n\n return {\n cellProps: mergeProps(focusProps, customProps),\n };\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { NativeElementProps } from '../../types.js';
|
|
3
|
+
export interface UseTable {
|
|
4
|
+
tableProps: NativeElementProps<HTMLTableElement>;
|
|
5
|
+
}
|
|
6
|
+
export declare function useTable(ref: RefObject<HTMLTableElement>): UseTable;
|
|
7
|
+
//# sourceMappingURL=use-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-table.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/hooks/use-table.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAoB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAI3E,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;CAClD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAsJnE"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTable = useTable;
|
|
4
|
+
const focus_1 = require("@react-aria/focus");
|
|
5
|
+
const interactions_1 = require("@react-aria/interactions");
|
|
6
|
+
const utils_1 = require("@react-aria/utils");
|
|
7
|
+
const focus_js_1 = require("../contexts/focus.js");
|
|
8
|
+
const focus_table_child_js_1 = require("../utils/focus-table-child.js");
|
|
9
|
+
function useTable(ref) {
|
|
10
|
+
const tableFocus = (0, focus_js_1.useTableFocus)();
|
|
11
|
+
const restoreCellFocus = (e) => {
|
|
12
|
+
if (!tableFocus.focusedRowKey || !tableFocus.focusedColumnKey) {
|
|
13
|
+
// User hasn't interacted with the table yet.
|
|
14
|
+
// Focus the first or last cell, depending on which direction the user is tabbing from.
|
|
15
|
+
const lastFocusedElement = e.relatedTarget;
|
|
16
|
+
const cellElements = e.currentTarget.querySelectorAll('[data-cell-row-key][data-cell-column-key]');
|
|
17
|
+
let cellElementToFocus;
|
|
18
|
+
if (lastFocusedElement &&
|
|
19
|
+
e.currentTarget.compareDocumentPosition(lastFocusedElement) & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
20
|
+
cellElementToFocus = cellElements[cellElements.length - 1];
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
cellElementToFocus = cellElements[0];
|
|
24
|
+
}
|
|
25
|
+
const { cellRowKey, cellColumnKey } = cellElementToFocus.dataset;
|
|
26
|
+
// We know the keys are defined, because we queried the DOM for elements that have them
|
|
27
|
+
tableFocus.setFocus(cellRowKey, cellColumnKey);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const element = e.currentTarget.querySelector(`[data-cell-row-key='${CSS.escape(tableFocus.focusedRowKey)}'][data-cell-column-key='${CSS.escape(tableFocus.focusedColumnKey)}']`);
|
|
31
|
+
if (element) {
|
|
32
|
+
// If focus is already within the cell, don't refocus
|
|
33
|
+
if (!element.contains(document.activeElement)) {
|
|
34
|
+
(0, focus_table_child_js_1.focusTableChild)(element);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const { focusableProps } = (0, focus_1.useFocusable)({
|
|
40
|
+
onFocus: (e) => {
|
|
41
|
+
// Ignore focus events bubbling through portals
|
|
42
|
+
if (!e.currentTarget.contains(e.target)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
restoreCellFocus(e);
|
|
46
|
+
},
|
|
47
|
+
}, ref);
|
|
48
|
+
const { keyboardProps } = (0, interactions_1.useKeyboard)({
|
|
49
|
+
onKeyDown: (e) => {
|
|
50
|
+
// Ignore keyboard events bubbling through portals
|
|
51
|
+
if (!e.currentTarget.contains(e.target)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const focusedCellElement = e.currentTarget.querySelector(`[data-cell-row-key='${CSS.escape(tableFocus.focusedRowKey)}'][data-cell-column-key='${CSS.escape(tableFocus.focusedColumnKey)}']`);
|
|
55
|
+
let cellElementToFocus = null;
|
|
56
|
+
let newChildFocusStrategy;
|
|
57
|
+
if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
|
|
58
|
+
// Focus previous/next cell in the same row
|
|
59
|
+
const selector = `[data-cell-row-key='${CSS.escape(tableFocus.focusedRowKey)}']:not([data-cell-column-key='${CSS.escape(tableFocus.focusedColumnKey)}'])`;
|
|
60
|
+
const walker = (0, focus_1.getFocusableTreeWalker)(e.currentTarget, { accept: (node) => node.matches(selector) });
|
|
61
|
+
walker.currentNode = focusedCellElement;
|
|
62
|
+
cellElementToFocus = e.key === 'ArrowLeft' ? walker.previousNode() : walker.nextNode();
|
|
63
|
+
newChildFocusStrategy = e.key === 'ArrowLeft' ? 'last' : 'first';
|
|
64
|
+
}
|
|
65
|
+
else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
66
|
+
// Focus previous/next cell in the same column
|
|
67
|
+
const selector = `[data-cell-column-key='${CSS.escape(tableFocus.focusedColumnKey)}']:not([data-cell-row-key='${CSS.escape(tableFocus.focusedRowKey)}'])`;
|
|
68
|
+
const walker = (0, focus_1.getFocusableTreeWalker)(e.currentTarget, { accept: (node) => node.matches(selector) });
|
|
69
|
+
walker.currentNode = focusedCellElement;
|
|
70
|
+
cellElementToFocus = e.key === 'ArrowUp' ? walker.previousNode() : walker.nextNode();
|
|
71
|
+
}
|
|
72
|
+
else if (e.key === 'PageUp' || e.key === 'PageDown') {
|
|
73
|
+
// Move focus up/down by 5 rows
|
|
74
|
+
const selector = `[data-cell-column-key='${CSS.escape(tableFocus.focusedColumnKey)}']:not([data-cell-row-key='${CSS.escape(tableFocus.focusedRowKey)}'])`;
|
|
75
|
+
const walker = (0, focus_1.getFocusableTreeWalker)(e.currentTarget, { accept: (node) => node.matches(selector) });
|
|
76
|
+
walker.currentNode = focusedCellElement;
|
|
77
|
+
const advance = e.key === 'PageUp' ? walker.previousNode.bind(walker) : walker.nextNode.bind(walker);
|
|
78
|
+
// `advance()` will do nothing if there's no appropriate node found, so it's safe to just call it 5 times
|
|
79
|
+
for (let i = 0; i < 5; i++) {
|
|
80
|
+
advance();
|
|
81
|
+
}
|
|
82
|
+
cellElementToFocus = walker.currentNode;
|
|
83
|
+
}
|
|
84
|
+
else if (e.key === 'Home' || e.key === 'End') {
|
|
85
|
+
// If Ctrl/Cmd is pressed, move focus to the first/last cell of the table;
|
|
86
|
+
// otherwise, move focus to the first/last cell of the current row
|
|
87
|
+
const selector = '[data-cell-row-key][data-cell-column-key]';
|
|
88
|
+
const walker = (0, focus_1.getFocusableTreeWalker)(e.currentTarget, { accept: (node) => node.matches(selector) });
|
|
89
|
+
walker.currentNode = isCtrlKeyPressed(e) ? e.currentTarget : focusedCellElement.parentElement;
|
|
90
|
+
cellElementToFocus = e.key === 'Home' ? walker.firstChild() : walker.lastChild();
|
|
91
|
+
newChildFocusStrategy = e.key === 'Home' ? 'first' : 'last';
|
|
92
|
+
}
|
|
93
|
+
else if (e.key === 'Tab') {
|
|
94
|
+
// Table is supposed to be a single Tab stop, but cells may contain elements that are tabbable (checkboxes, buttons, menus, etc.).
|
|
95
|
+
// We don't control the rendering of these elements, so we can't override their tabIndex to prevent tabbing.
|
|
96
|
+
// Instead, we detect when Tab key is pressed, and move focus manually to the guard element before/after the table,
|
|
97
|
+
// so that the browser default behavior will apply starting from that element rather than the currently focused one.
|
|
98
|
+
const tableElement = e.currentTarget;
|
|
99
|
+
const guardElement = e.shiftKey ? tableElement.previousElementSibling : tableElement.nextElementSibling;
|
|
100
|
+
if (guardElement) {
|
|
101
|
+
(0, focus_table_child_js_1.focusTableChild)(guardElement);
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// if we didn't handle anything, return early so we don't preventDefault
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (cellElementToFocus) {
|
|
110
|
+
const { cellRowKey, cellColumnKey } = cellElementToFocus.dataset;
|
|
111
|
+
// We know the keys are defined, because we queried the DOM for elements that have them
|
|
112
|
+
tableFocus.setFocus(cellRowKey, cellColumnKey, newChildFocusStrategy);
|
|
113
|
+
}
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
const customProps = {
|
|
118
|
+
role: 'grid',
|
|
119
|
+
// If no cell is tabbable within the table, make the table itself tabbable,
|
|
120
|
+
// otherwise the Tab key will just skip it
|
|
121
|
+
tabIndex: tableFocus.focusedRowKey && tableFocus.focusedColumnKey ? -1 : 0,
|
|
122
|
+
onFocusCapture: (e) => {
|
|
123
|
+
// If we're navigating into the table with a keyboard, focus the last focused cell instead of the first tabbable element
|
|
124
|
+
if ((0, interactions_1.getInteractionModality)() === 'keyboard' &&
|
|
125
|
+
!e.currentTarget.contains(e.relatedTarget) &&
|
|
126
|
+
e.currentTarget.contains(e.target)) {
|
|
127
|
+
restoreCellFocus(e);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
return {
|
|
132
|
+
tableProps: (0, utils_1.mergeProps)(focusableProps, keyboardProps, customProps),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
// TODO: use `isCtrlKeyPressed` from `@react-aria/utils` after version upgrade
|
|
136
|
+
function isCtrlKeyPressed(e) {
|
|
137
|
+
if ((0, utils_1.isMac)()) {
|
|
138
|
+
return e.metaKey;
|
|
139
|
+
}
|
|
140
|
+
return e.ctrlKey;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=use-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-table.js","sourceRoot":"","sources":["../../../../../src/components/table/hooks/use-table.ts"],"names":[],"mappings":";;AAYA,4BAsJC;AAlKD,6CAAyE;AACzE,2DAA+E;AAC/E,6CAAsD;AAGtD,mDAA8E;AAC9E,wEAAgE;AAMhE,SAAgB,QAAQ,CAAC,GAAgC;IACvD,MAAM,UAAU,GAAG,IAAA,wBAAa,GAAE,CAAC;IAEnC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C,CAAC,CAAC,MAAM,CAAC,EAClC,CAAC;gBACD,gBAAgB,CAAC,CAAC,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;KACF,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,IAAA,kBAAU,EAAC,cAAc,EAAE,aAAa,EAAE,WAAW,CAAC;KACnE,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,SAAS,gBAAgB,CAAC,CAAyC;IACjE,IAAI,IAAA,aAAK,GAAE,EAAE,CAAC;QACZ,OAAO,CAAC,CAAC,OAAO,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,CAAC,OAAO,CAAC;AACnB,CAAC","sourcesContent":["import { getFocusableTreeWalker, useFocusable } from '@react-aria/focus';\nimport { getInteractionModality, useKeyboard } from '@react-aria/interactions';\nimport { isMac, mergeProps } from '@react-aria/utils';\nimport type { FocusEventHandler, RefObject } from 'react';\nimport type { FocusableElement, NativeElementProps } from '../../types.js';\nimport { type ChildFocusStrategy, useTableFocus } from '../contexts/focus.js';\nimport { focusTableChild } from '../utils/focus-table-child.js';\n\nexport interface UseTable {\n tableProps: NativeElementProps<HTMLTableElement>;\n}\n\nexport function useTable(ref: RefObject<HTMLTableElement>): UseTable {\n const tableFocus = useTableFocus();\n\n const restoreCellFocus: FocusEventHandler = (e) => {\n if (!tableFocus.focusedRowKey || !tableFocus.focusedColumnKey) {\n // User hasn't interacted with the table yet.\n // Focus the first or last cell, depending on which direction the user is tabbing from.\n const lastFocusedElement = e.relatedTarget as Element;\n const cellElements = e.currentTarget.querySelectorAll('[data-cell-row-key][data-cell-column-key]');\n let cellElementToFocus: Element | undefined;\n\n if (\n lastFocusedElement &&\n e.currentTarget.compareDocumentPosition(lastFocusedElement) & Node.DOCUMENT_POSITION_FOLLOWING\n ) {\n cellElementToFocus = cellElements[cellElements.length - 1];\n } else {\n cellElementToFocus = cellElements[0];\n }\n\n const { cellRowKey, cellColumnKey } = (cellElementToFocus as HTMLTableCellElement).dataset;\n\n // We know the keys are defined, because we queried the DOM for elements that have them\n tableFocus.setFocus(cellRowKey!, cellColumnKey!);\n } else {\n const element = e.currentTarget.querySelector(\n `[data-cell-row-key='${CSS.escape(tableFocus.focusedRowKey)}'][data-cell-column-key='${CSS.escape(tableFocus.focusedColumnKey)}']`,\n ) as HTMLTableCellElement;\n\n if (element) {\n // If focus is already within the cell, don't refocus\n if (!element.contains(document.activeElement)) {\n focusTableChild(element);\n }\n }\n }\n };\n\n const { focusableProps } = useFocusable(\n {\n onFocus: (e) => {\n // Ignore focus events bubbling through portals\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n restoreCellFocus(e);\n },\n },\n ref,\n );\n\n const { keyboardProps } = useKeyboard({\n onKeyDown: (e) => {\n // Ignore keyboard events bubbling through portals\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n const focusedCellElement = e.currentTarget.querySelector(\n `[data-cell-row-key='${CSS.escape(tableFocus.focusedRowKey)}'][data-cell-column-key='${CSS.escape(tableFocus.focusedColumnKey)}']`,\n ) as HTMLTableCellElement;\n\n let cellElementToFocus: Node | null = null;\n let newChildFocusStrategy: ChildFocusStrategy | undefined;\n\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n // Focus previous/next cell in the same row\n const selector = `[data-cell-row-key='${CSS.escape(tableFocus.focusedRowKey)}']:not([data-cell-column-key='${CSS.escape(tableFocus.focusedColumnKey)}'])`;\n const walker = getFocusableTreeWalker(e.currentTarget, { accept: (node) => node.matches(selector) });\n walker.currentNode = focusedCellElement;\n cellElementToFocus = e.key === 'ArrowLeft' ? walker.previousNode() : walker.nextNode();\n newChildFocusStrategy = e.key === 'ArrowLeft' ? 'last' : 'first';\n } else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n // Focus previous/next cell in the same column\n const selector = `[data-cell-column-key='${CSS.escape(tableFocus.focusedColumnKey)}']:not([data-cell-row-key='${CSS.escape(tableFocus.focusedRowKey)}'])`;\n const walker = getFocusableTreeWalker(e.currentTarget, { accept: (node) => node.matches(selector) });\n walker.currentNode = focusedCellElement;\n cellElementToFocus = e.key === 'ArrowUp' ? walker.previousNode() : walker.nextNode();\n } else if (e.key === 'PageUp' || e.key === 'PageDown') {\n // Move focus up/down by 5 rows\n const selector = `[data-cell-column-key='${CSS.escape(tableFocus.focusedColumnKey)}']:not([data-cell-row-key='${CSS.escape(tableFocus.focusedRowKey)}'])`;\n const walker = getFocusableTreeWalker(e.currentTarget, { accept: (node) => node.matches(selector) });\n walker.currentNode = focusedCellElement;\n\n const advance = e.key === 'PageUp' ? walker.previousNode.bind(walker) : walker.nextNode.bind(walker);\n\n // `advance()` will do nothing if there's no appropriate node found, so it's safe to just call it 5 times\n for (let i = 0; i < 5; i++) {\n advance();\n }\n\n cellElementToFocus = walker.currentNode;\n } else if (e.key === 'Home' || e.key === 'End') {\n // If Ctrl/Cmd is pressed, move focus to the first/last cell of the table;\n // otherwise, move focus to the first/last cell of the current row\n const selector = '[data-cell-row-key][data-cell-column-key]';\n const walker = getFocusableTreeWalker(e.currentTarget, { accept: (node) => node.matches(selector) });\n walker.currentNode = isCtrlKeyPressed(e) ? e.currentTarget : focusedCellElement.parentElement!;\n cellElementToFocus = e.key === 'Home' ? walker.firstChild() : walker.lastChild();\n newChildFocusStrategy = e.key === 'Home' ? 'first' : 'last';\n } else if (e.key === 'Tab') {\n // Table is supposed to be a single Tab stop, but cells may contain elements that are tabbable (checkboxes, buttons, menus, etc.).\n // We don't control the rendering of these elements, so we can't override their tabIndex to prevent tabbing.\n // Instead, we detect when Tab key is pressed, and move focus manually to the guard element before/after the table,\n // so that the browser default behavior will apply starting from that element rather than the currently focused one.\n const tableElement = e.currentTarget as HTMLTableElement;\n const guardElement = e.shiftKey ? tableElement.previousElementSibling : tableElement.nextElementSibling;\n\n if (guardElement) {\n focusTableChild(guardElement as FocusableElement);\n }\n\n return;\n } else {\n // if we didn't handle anything, return early so we don't preventDefault\n return;\n }\n\n if (cellElementToFocus) {\n const { cellRowKey, cellColumnKey } = (cellElementToFocus as HTMLTableCellElement).dataset;\n\n // We know the keys are defined, because we queried the DOM for elements that have them\n tableFocus.setFocus(cellRowKey!, cellColumnKey!, newChildFocusStrategy);\n }\n\n e.preventDefault();\n },\n });\n\n const customProps: NativeElementProps<HTMLTableElement> = {\n role: 'grid',\n // If no cell is tabbable within the table, make the table itself tabbable,\n // otherwise the Tab key will just skip it\n tabIndex: tableFocus.focusedRowKey && tableFocus.focusedColumnKey ? -1 : 0,\n onFocusCapture: (e) => {\n // If we're navigating into the table with a keyboard, focus the last focused cell instead of the first tabbable element\n if (\n getInteractionModality() === 'keyboard' &&\n !e.currentTarget.contains(e.relatedTarget) &&\n e.currentTarget.contains(e.target)\n ) {\n restoreCellFocus(e);\n }\n },\n };\n\n return {\n tableProps: mergeProps(focusableProps, keyboardProps, customProps),\n };\n}\n\n// TODO: use `isCtrlKeyPressed` from `@react-aria/utils` after version upgrade\nfunction isCtrlKeyPressed(e: { ctrlKey: boolean; metaKey: boolean }): boolean {\n if (isMac()) {\n return e.metaKey;\n }\n\n return e.ctrlKey;\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { CommonProps } from '../types.js';
|
|
3
|
+
export interface UNSTABLE_TableBodyCellProps extends CommonProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* A unique identifier for the column that this cell belongs to.
|
|
7
|
+
* Cells that belong to the same column must have the same `columnKey`.
|
|
8
|
+
*/
|
|
9
|
+
columnKey: string;
|
|
10
|
+
/**
|
|
11
|
+
* The position of the column that this cell belongs to within the full dataset.
|
|
12
|
+
*
|
|
13
|
+
* Provide this value if your table presents a subset of columns, such as when the user toggles column visibility.
|
|
14
|
+
*
|
|
15
|
+
* This number must be:
|
|
16
|
+
* - greater than or equal to `1`
|
|
17
|
+
* - greater than the `columnNumber` of any previous cells in the current row
|
|
18
|
+
* - less than or equal to the `totalColumnCount` of the parent `Table`
|
|
19
|
+
*
|
|
20
|
+
* Use together with `totalColumnCount` on the `Table` component.
|
|
21
|
+
*/
|
|
22
|
+
columnNumber?: number;
|
|
23
|
+
}
|
|
24
|
+
declare const _UNSTABLE_TableBodyCell: (props: UNSTABLE_TableBodyCellProps & import("react").RefAttributes<HTMLTableCellElement>) => import("react").JSX.Element | null;
|
|
25
|
+
export { _UNSTABLE_TableBodyCell as UNSTABLE_TableBodyCell };
|
|
26
|
+
//# sourceMappingURL=table-body-cell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-body-cell.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-body-cell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,MAAM,WAAW,2BAA4B,SAAQ,WAAW;IAC9D,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAuBD,QAAA,MAAM,uBAAuB,kIAAsD,CAAC;AAEpF,OAAO,EAAE,uBAAuB,IAAI,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UNSTABLE_TableBodyCell = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const utils_1 = require("@react-aria/utils");
|
|
6
|
+
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
7
|
+
const row_state_js_1 = require("./contexts/row-state.js");
|
|
8
|
+
const use_table_cell_js_1 = require("./hooks/use-table-cell.js");
|
|
9
|
+
function UNSTABLE_TableBodyCell({ children, UNSAFE_className, UNSAFE_style, columnKey, columnNumber, ...props }, ref) {
|
|
10
|
+
const cellRef = (0, utils_1.useObjectRef)(ref);
|
|
11
|
+
const { rowKey } = (0, row_state_js_1.useTableRowState)();
|
|
12
|
+
const { cellProps } = (0, use_table_cell_js_1.useTableCell)(cellRef, rowKey, columnKey);
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("td", { ...(0, utils_1.mergeProps)(props, cellProps), ref: cellRef, className: UNSAFE_className, style: UNSAFE_style, "aria-colindex": columnNumber, children: children }));
|
|
14
|
+
}
|
|
15
|
+
const _UNSTABLE_TableBodyCell = (0, forward_ref_js_1.forwardRef)(UNSTABLE_TableBodyCell, 'TableBodyCell');
|
|
16
|
+
exports.UNSTABLE_TableBodyCell = _UNSTABLE_TableBodyCell;
|
|
17
|
+
//# sourceMappingURL=table-body-cell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-body-cell.js","sourceRoot":"","sources":["../../../../src/components/table/table-body-cell.tsx"],"names":[],"mappings":";;;;AAAA,6CAA6D;AAE7D,yDAAkD;AAElD,0DAA2D;AAC3D,iEAAyD;AAwBzD,SAAS,sBAAsB,CAC7B,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,KAAK,EAA+B,EAC5G,GAAuC;IAEvC,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,GAAG,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,+BAAgB,GAAE,CAAC;IACtC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,gCAAY,EAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAE/D,OAAO,CACL,kCACM,IAAA,kBAAU,EAAC,KAAK,EAAE,SAAS,CAAC,EAChC,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,YAAY,mBACJ,YAAY,YAE1B,QAAQ,GACN,CACN,CAAC;AACJ,CAAC;AAED,MAAM,uBAAuB,GAAG,IAAA,2BAAU,EAAC,sBAAsB,EAAE,eAAe,CAAC,CAAC;AAEhD,yDAAsB","sourcesContent":["import { mergeProps, useObjectRef } from '@react-aria/utils';\nimport type { ForwardedRef, ReactNode } from 'react';\nimport { forwardRef } from '../../forward-ref.js';\nimport type { CommonProps } from '../types.js';\nimport { useTableRowState } from './contexts/row-state.js';\nimport { useTableCell } from './hooks/use-table-cell.js';\n\nexport interface UNSTABLE_TableBodyCellProps extends CommonProps {\n children: ReactNode;\n /**\n * A unique identifier for the column that this cell belongs to.\n * Cells that belong to the same column must have the same `columnKey`.\n */\n columnKey: string;\n /**\n * The position of the column that this cell belongs to within the full dataset.\n *\n * Provide this value if your table presents a subset of columns, such as when the user toggles column visibility.\n *\n * This number must be:\n * - greater than or equal to `1`\n * - greater than the `columnNumber` of any previous cells in the current row\n * - less than or equal to the `totalColumnCount` of the parent `Table`\n *\n * Use together with `totalColumnCount` on the `Table` component.\n */\n columnNumber?: number;\n}\n\nfunction UNSTABLE_TableBodyCell(\n { children, UNSAFE_className, UNSAFE_style, columnKey, columnNumber, ...props }: UNSTABLE_TableBodyCellProps,\n ref: ForwardedRef<HTMLTableCellElement>,\n) {\n const cellRef = useObjectRef(ref);\n const { rowKey } = useTableRowState();\n const { cellProps } = useTableCell(cellRef, rowKey, columnKey);\n\n return (\n <td\n {...mergeProps(props, cellProps)}\n ref={cellRef}\n className={UNSAFE_className}\n style={UNSAFE_style}\n aria-colindex={columnNumber}\n >\n {children}\n </td>\n );\n}\n\nconst _UNSTABLE_TableBodyCell = forwardRef(UNSTABLE_TableBodyCell, 'TableBodyCell');\n\nexport { _UNSTABLE_TableBodyCell as UNSTABLE_TableBodyCell };\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { CommonProps } from '../types.js';
|
|
3
|
+
export interface UNSTABLE_TableBodyProps extends CommonProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
declare const _UNSTABLE_TableBody: (props: UNSTABLE_TableBodyProps & import("react").RefAttributes<HTMLTableSectionElement>) => import("react").JSX.Element | null;
|
|
7
|
+
export { _UNSTABLE_TableBody as UNSTABLE_TableBody };
|
|
8
|
+
//# sourceMappingURL=table-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-body.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-body.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,uBAAwB,SAAQ,WAAW;IAC1D,QAAQ,EAAE,SAAS,CAAC;CACrB;AAaD,QAAA,MAAM,mBAAmB,iIAA8C,CAAC;AAExE,OAAO,EAAE,mBAAmB,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UNSTABLE_TableBody = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
6
|
+
function UNSTABLE_TableBody({ children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("tbody", { ...props, ref: ref, className: UNSAFE_className, style: UNSAFE_style, children: children }));
|
|
8
|
+
}
|
|
9
|
+
const _UNSTABLE_TableBody = (0, forward_ref_js_1.forwardRef)(UNSTABLE_TableBody, 'TableBody');
|
|
10
|
+
exports.UNSTABLE_TableBody = _UNSTABLE_TableBody;
|
|
11
|
+
//# sourceMappingURL=table-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-body.js","sourceRoot":"","sources":["../../../../src/components/table/table-body.tsx"],"names":[],"mappings":";;;;AACA,yDAAkD;AAOlD,SAAS,kBAAkB,CACzB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAA2B,EAC/E,GAA0C;IAE1C,OAAO,CACL,qCAAW,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,YACzE,QAAQ,GACH,CACT,CAAC;AACJ,CAAC;AAED,MAAM,mBAAmB,GAAG,IAAA,2BAAU,EAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;AAExC,iDAAkB","sourcesContent":["import type { ForwardedRef, ReactNode } from 'react';\nimport { forwardRef } from '../../forward-ref.js';\nimport type { CommonProps } from '../types.js';\n\nexport interface UNSTABLE_TableBodyProps extends CommonProps {\n children: ReactNode;\n}\n\nfunction UNSTABLE_TableBody(\n { children, UNSAFE_className, UNSAFE_style, ...props }: UNSTABLE_TableBodyProps,\n ref: ForwardedRef<HTMLTableSectionElement>,\n) {\n return (\n <tbody {...props} ref={ref} className={UNSAFE_className} style={UNSAFE_style}>\n {children}\n </tbody>\n );\n}\n\nconst _UNSTABLE_TableBody = forwardRef(UNSTABLE_TableBody, 'TableBody');\n\nexport { _UNSTABLE_TableBody as UNSTABLE_TableBody };\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { CommonProps, LabellableProps } from '../types.js';
|
|
3
|
+
export interface UNSTABLE_TableContainerProps extends CommonProps, Omit<LabellableProps, 'label'> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
declare const _UNSTABLE_TableContainer: (props: UNSTABLE_TableContainerProps & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
|
|
7
|
+
export { _UNSTABLE_TableContainer as UNSTABLE_TableContainer };
|
|
8
|
+
//# sourceMappingURL=table-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-container.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-container.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAgD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrF,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,4BAA6B,SAAQ,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC;IAC/F,QAAQ,EAAE,SAAS,CAAC;CACrB;AA+CD,QAAA,MAAM,wBAAwB,8KAAwE,CAAC;AAEvG,OAAO,EAAE,wBAAwB,IAAI,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UNSTABLE_TableContainer = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const focus_1 = require("@react-aria/focus");
|
|
9
|
+
const utils_1 = require("@react-aria/utils");
|
|
10
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
11
|
+
const react_1 = require("react");
|
|
12
|
+
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
13
|
+
const with_style_props_js_1 = require("../../with-style-props.js");
|
|
14
|
+
function UNSTABLE_TableContainer({ children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
|
|
15
|
+
const containerRef = (0, utils_1.useObjectRef)(ref);
|
|
16
|
+
const { focusProps, isFocusVisible } = (0, focus_1.useFocusRing)();
|
|
17
|
+
const [isScrollable, setIsScrollable] = (0, react_1.useState)(false);
|
|
18
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
19
|
+
const containerElement = containerRef.current;
|
|
20
|
+
const isSSR = typeof window === 'undefined';
|
|
21
|
+
let containerResizeObserver;
|
|
22
|
+
if (containerElement && !isSSR) {
|
|
23
|
+
containerResizeObserver = new window.ResizeObserver((entries) => {
|
|
24
|
+
if (entries[0]) {
|
|
25
|
+
setIsScrollable(entries[0].target.scrollWidth > entries[0].target.clientWidth);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
containerResizeObserver.observe(containerElement);
|
|
29
|
+
}
|
|
30
|
+
return () => {
|
|
31
|
+
if (containerElement && containerResizeObserver) {
|
|
32
|
+
containerResizeObserver.unobserve(containerElement);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}, [containerRef]);
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)("div", { ...(0, utils_1.mergeProps)(props, focusProps), ref: containerRef, className: (0, clsx_1.default)('cim-table-container', UNSAFE_className), style: UNSAFE_style, tabIndex: isScrollable ? 0 : -1, "data-focus-visible": isFocusVisible || undefined, children: children }));
|
|
37
|
+
}
|
|
38
|
+
const _UNSTABLE_TableContainer = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(UNSTABLE_TableContainer), 'TableContainer');
|
|
39
|
+
exports.UNSTABLE_TableContainer = _UNSTABLE_TableContainer;
|
|
40
|
+
//# sourceMappingURL=table-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-container.js","sourceRoot":"","sources":["../../../../src/components/table/table-container.tsx"],"names":[],"mappings":";;;;;;;AAAA,6CAAiD;AACjD,6CAA6D;AAC7D,gDAAwB;AACxB,iCAAqF;AACrF,yDAAkD;AAClD,mEAA2D;AAO3D,SAAS,uBAAuB,CAC9B,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAgC,EACpF,GAAiC;IAEjC,MAAM,YAAY,GAAG,IAAA,oBAAY,EAAC,GAAG,CAAC,CAAC;IACvC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IACtD,MAAM,CAAC,Y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EAAC,uBAAuB,CAAC,EAAE,gBAAgB,CAAC,CAAC;AAElE,2DAAuB","sourcesContent":["import { useFocusRing } from '@react-aria/focus';\nimport { mergeProps, useObjectRef } from '@react-aria/utils';\nimport clsx from 'clsx';\nimport { useLayoutEffect, useState, type ForwardedRef, type ReactNode } from 'react';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { CommonProps, LabellableProps } from '../types.js';\n\nexport interface UNSTABLE_TableContainerProps extends CommonProps, Omit<LabellableProps, 'label'> {\n children: ReactNode;\n}\n\nfunction UNSTABLE_TableContainer(\n { children, UNSAFE_className, UNSAFE_style, ...props }: UNSTABLE_TableContainerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const containerRef = useObjectRef(ref);\n const { focusProps, isFocusVisible } = useFocusRing();\n const [isScrollable, setIsScrollable] = useState(false);\n\n useLayoutEffect(() => {\n const containerElement = containerRef.current;\n const isSSR = typeof window === 'undefined';\n\n let containerResizeObserver: ResizeObserver | undefined;\n\n if (containerElement && !isSSR) {\n containerResizeObserver = new window.ResizeObserver((entries) => {\n if (entries[0]) {\n setIsScrollable(entries[0].target.scrollWidth > entries[0].target.clientWidth);\n }\n });\n\n containerResizeObserver.observe(containerElement);\n }\n\n return () => {\n if (containerElement && containerResizeObserver) {\n containerResizeObserver.unobserve(containerElement);\n }\n };\n }, [containerRef]);\n\n return (\n <div\n {...mergeProps(props, focusProps)}\n ref={containerRef}\n className={clsx('cim-table-container', UNSAFE_className)}\n style={UNSAFE_style}\n tabIndex={isScrollable ? 0 : -1}\n data-focus-visible={isFocusVisible || undefined}\n >\n {children}\n </div>\n );\n}\n\nconst _UNSTABLE_TableContainer = withStyleProps(forwardRef(UNSTABLE_TableContainer), 'TableContainer');\n\nexport { _UNSTABLE_TableContainer as UNSTABLE_TableContainer };\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { CommonProps } from '../types.js';
|
|
3
|
+
export interface UNSTABLE_TableHeaderCellProps extends CommonProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* A unique identifier for the column that this cell belongs to.
|
|
7
|
+
* Cells that belong to the same column must have the same `columnKey`.
|
|
8
|
+
*/
|
|
9
|
+
columnKey: string;
|
|
10
|
+
/**
|
|
11
|
+
* The position of the column that this cell belongs to within the full dataset.
|
|
12
|
+
*
|
|
13
|
+
* Provide this value if your table presents a subset of columns, such as when the user toggles column visibility.
|
|
14
|
+
*
|
|
15
|
+
* This number must be:
|
|
16
|
+
* - greater than or equal to `1`
|
|
17
|
+
* - greater than the `columnNumber` of any previous cells in the current row
|
|
18
|
+
* - less than or equal to the `totalColumnCount` of the parent `Table`
|
|
19
|
+
*
|
|
20
|
+
* Use together with `totalColumnCount` on the `Table` component.
|
|
21
|
+
*/
|
|
22
|
+
columnNumber?: number;
|
|
23
|
+
}
|
|
24
|
+
declare const _UNSTABLE_TableHeaderCell: (props: UNSTABLE_TableHeaderCellProps & import("react").RefAttributes<HTMLTableCellElement>) => import("react").JSX.Element | null;
|
|
25
|
+
export { _UNSTABLE_TableHeaderCell as UNSTABLE_TableHeaderCell };
|
|
26
|
+
//# sourceMappingURL=table-header-cell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-header-cell.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-header-cell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,MAAM,WAAW,6BAA8B,SAAQ,WAAW;IAChE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAwBD,QAAA,MAAM,yBAAyB,oIAA0D,CAAC;AAE1F,OAAO,EAAE,yBAAyB,IAAI,wBAAwB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UNSTABLE_TableHeaderCell = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const utils_1 = require("@react-aria/utils");
|
|
6
|
+
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
7
|
+
const row_state_js_1 = require("./contexts/row-state.js");
|
|
8
|
+
const use_table_cell_js_1 = require("./hooks/use-table-cell.js");
|
|
9
|
+
function UNSTABLE_TableHeaderCell({ children, UNSAFE_className, UNSAFE_style, columnKey, columnNumber, ...props }, ref) {
|
|
10
|
+
const cellRef = (0, utils_1.useObjectRef)(ref);
|
|
11
|
+
const { rowKey } = (0, row_state_js_1.useTableRowState)();
|
|
12
|
+
const { cellProps } = (0, use_table_cell_js_1.useTableCell)(cellRef, rowKey, columnKey);
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("th", { ...(0, utils_1.mergeProps)(props, cellProps), ref: cellRef, className: UNSAFE_className, style: UNSAFE_style, scope: "col", "aria-colindex": columnNumber, children: children }));
|
|
14
|
+
}
|
|
15
|
+
const _UNSTABLE_TableHeaderCell = (0, forward_ref_js_1.forwardRef)(UNSTABLE_TableHeaderCell, 'TableHeaderCell');
|
|
16
|
+
exports.UNSTABLE_TableHeaderCell = _UNSTABLE_TableHeaderCell;
|
|
17
|
+
//# sourceMappingURL=table-header-cell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-header-cell.js","sourceRoot":"","sources":["../../../../src/components/table/table-header-cell.tsx"],"names":[],"mappings":";;;;AAAA,6CAA6D;AAE7D,yDAAkD;AAElD,0DAA2D;AAC3D,iEAAyD;AAwBzD,SAAS,wBAAwB,CAC/B,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,KAAK,EAAiC,EAC9G,GAAuC;IAEvC,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,GAAG,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,+BAAgB,GAAE,CAAC;IACtC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,gCAAY,EAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAE/D,OAAO,CACL,kCACM,IAAA,kBAAU,EAAC,KAAK,EAAE,SAAS,CAAC,EAChC,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAC,KAAK,mBACI,YAAY,YAE1B,QAAQ,GACN,CACN,CAAC;AACJ,CAAC;AAED,MAAM,yBAAyB,GAAG,IAAA,2BAAU,EAAC,wBAAwB,EAAE,iBAAiB,CAAC,CAAC;AAEpD,6DAAwB","sourcesContent":["import { mergeProps, useObjectRef } from '@react-aria/utils';\nimport type { ForwardedRef, ReactNode } from 'react';\nimport { forwardRef } from '../../forward-ref.js';\nimport type { CommonProps } from '../types.js';\nimport { useTableRowState } from './contexts/row-state.js';\nimport { useTableCell } from './hooks/use-table-cell.js';\n\nexport interface UNSTABLE_TableHeaderCellProps extends CommonProps {\n children: ReactNode;\n /**\n * A unique identifier for the column that this cell belongs to.\n * Cells that belong to the same column must have the same `columnKey`.\n */\n columnKey: string;\n /**\n * The position of the column that this cell belongs to within the full dataset.\n *\n * Provide this value if your table presents a subset of columns, such as when the user toggles column visibility.\n *\n * This number must be:\n * - greater than or equal to `1`\n * - greater than the `columnNumber` of any previous cells in the current row\n * - less than or equal to the `totalColumnCount` of the parent `Table`\n *\n * Use together with `totalColumnCount` on the `Table` component.\n */\n columnNumber?: number;\n}\n\nfunction UNSTABLE_TableHeaderCell(\n { children, UNSAFE_className, UNSAFE_style, columnKey, columnNumber, ...props }: UNSTABLE_TableHeaderCellProps,\n ref: ForwardedRef<HTMLTableCellElement>,\n) {\n const cellRef = useObjectRef(ref);\n const { rowKey } = useTableRowState();\n const { cellProps } = useTableCell(cellRef, rowKey, columnKey);\n\n return (\n <th\n {...mergeProps(props, cellProps)}\n ref={cellRef}\n className={UNSAFE_className}\n style={UNSAFE_style}\n scope=\"col\"\n aria-colindex={columnNumber}\n >\n {children}\n </th>\n );\n}\n\nconst _UNSTABLE_TableHeaderCell = forwardRef(UNSTABLE_TableHeaderCell, 'TableHeaderCell');\n\nexport { _UNSTABLE_TableHeaderCell as UNSTABLE_TableHeaderCell };\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { CommonProps } from '../types.js';
|
|
3
|
+
export interface UNSTABLE_TableHeaderProps extends CommonProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
declare const _UNSTABLE_TableHeader: (props: UNSTABLE_TableHeaderProps & import("react").RefAttributes<HTMLTableSectionElement>) => import("react").JSX.Element | null;
|
|
7
|
+
export { _UNSTABLE_TableHeader as UNSTABLE_TableHeader };
|
|
8
|
+
//# sourceMappingURL=table-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-header.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,yBAA0B,SAAQ,WAAW;IAC5D,QAAQ,EAAE,SAAS,CAAC;CACrB;AAaD,QAAA,MAAM,qBAAqB,mIAAkD,CAAC;AAE9E,OAAO,EAAE,qBAAqB,IAAI,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UNSTABLE_TableHeader = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
6
|
+
function UNSTABLE_TableHeader({ children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("thead", { ...props, ref: ref, className: UNSAFE_className, style: UNSAFE_style, children: children }));
|
|
8
|
+
}
|
|
9
|
+
const _UNSTABLE_TableHeader = (0, forward_ref_js_1.forwardRef)(UNSTABLE_TableHeader, 'TableHeader');
|
|
10
|
+
exports.UNSTABLE_TableHeader = _UNSTABLE_TableHeader;
|
|
11
|
+
//# sourceMappingURL=table-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-header.js","sourceRoot":"","sources":["../../../../src/components/table/table-header.tsx"],"names":[],"mappings":";;;;AACA,yDAAkD;AAOlD,SAAS,oBAAoB,CAC3B,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAA6B,EACjF,GAA0C;IAE1C,OAAO,CACL,qCAAW,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,YACzE,QAAQ,GACH,CACT,CAAC;AACJ,CAAC;AAED,MAAM,qBAAqB,GAAG,IAAA,2BAAU,EAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC;AAE5C,qDAAoB","sourcesContent":["import type { ForwardedRef, ReactNode } from 'react';\nimport { forwardRef } from '../../forward-ref.js';\nimport type { CommonProps } from '../types.js';\n\nexport interface UNSTABLE_TableHeaderProps extends CommonProps {\n children: ReactNode;\n}\n\nfunction UNSTABLE_TableHeader(\n { children, UNSAFE_className, UNSAFE_style, ...props }: UNSTABLE_TableHeaderProps,\n ref: ForwardedRef<HTMLTableSectionElement>,\n) {\n return (\n <thead {...props} ref={ref} className={UNSAFE_className} style={UNSAFE_style}>\n {children}\n </thead>\n );\n}\n\nconst _UNSTABLE_TableHeader = forwardRef(UNSTABLE_TableHeader, 'TableHeader');\n\nexport { _UNSTABLE_TableHeader as UNSTABLE_TableHeader };\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { CommonProps } from '../types.js';
|
|
3
|
+
export interface UNSTABLE_TableRowProps extends CommonProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* The row's position within the full dataset, including headers.
|
|
7
|
+
*
|
|
8
|
+
* Provide this value if your table presents a subset of rows, such as when using pagination.
|
|
9
|
+
*
|
|
10
|
+
* This number must be:
|
|
11
|
+
* - greater than or equal to `1`
|
|
12
|
+
* - greater than the `rowNumber` of any previous rows
|
|
13
|
+
* - less than or equal to the `totalRowCount` of the parent `Table`
|
|
14
|
+
*
|
|
15
|
+
* Use together with `totalRowCount` on the `Table` component.
|
|
16
|
+
*/
|
|
17
|
+
rowNumber?: number;
|
|
18
|
+
}
|
|
19
|
+
declare const _UNSTABLE_TableRow: (props: UNSTABLE_TableRowProps & import("react").RefAttributes<HTMLTableRowElement>) => import("react").JSX.Element | null;
|
|
20
|
+
export { _UNSTABLE_TableRow as UNSTABLE_TableRow };
|
|
21
|
+
//# sourceMappingURL=table-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-row.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-row.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAeD,QAAA,MAAM,kBAAkB,4HAA4C,CAAC;AAErE,OAAO,EAAE,kBAAkB,IAAI,iBAAiB,EAAE,CAAC"}
|