@dnb/eufemia 9.39.1 → 9.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/cjs/components/accordion/style/_accordion.scss +2 -2
- package/cjs/components/accordion/style/dnb-accordion.css +3 -3
- package/cjs/components/accordion/style/dnb-accordion.min.css +1 -1
- package/cjs/components/autocomplete/style/dnb-autocomplete.css +3 -14
- package/cjs/components/autocomplete/style/dnb-autocomplete.min.css +2 -2
- package/cjs/components/checkbox/style/dnb-checkbox.css +0 -7
- package/cjs/components/checkbox/style/dnb-checkbox.min.css +1 -1
- package/cjs/components/date-picker/style/dnb-date-picker.css +3 -35
- package/cjs/components/date-picker/style/dnb-date-picker.min.css +2 -2
- package/cjs/components/dialog/Dialog.d.ts +1 -1
- package/cjs/components/dialog/parts/DialogAction.d.ts +5 -4
- package/cjs/components/dialog/parts/DialogAction.js +23 -4
- package/cjs/components/dialog/style/_dialog.scss +7 -30
- package/cjs/components/dialog/style/dnb-dialog.css +21 -44
- package/cjs/components/dialog/style/dnb-dialog.min.css +1 -1
- package/cjs/components/dialog/style/themes/dnb-dialog-theme-ui.css +20 -0
- package/cjs/components/dialog/style/themes/dnb-dialog-theme-ui.min.css +1 -1
- package/cjs/components/dialog/style/themes/dnb-dialog-theme-ui.scss +29 -0
- package/cjs/components/drawer/style/_drawer.scss +1 -0
- package/cjs/components/drawer/style/dnb-drawer.css +12 -22
- package/cjs/components/drawer/style/dnb-drawer.min.css +1 -1
- package/cjs/components/drawer/types.d.ts +5 -5
- package/cjs/components/dropdown/style/dnb-dropdown.css +0 -7
- package/cjs/components/dropdown/style/dnb-dropdown.min.css +1 -1
- package/cjs/components/form-label/FormLabel.js +1 -1
- package/cjs/components/form-label/style/_form-label.scss +0 -13
- package/cjs/components/form-label/style/dnb-form-label.css +0 -7
- package/cjs/components/form-label/style/dnb-form-label.min.css +1 -1
- package/cjs/components/form-row/style/dnb-form-row.css +0 -7
- package/cjs/components/form-row/style/dnb-form-row.min.css +1 -1
- package/cjs/components/input/style/_input.scss +4 -0
- package/cjs/components/input/style/dnb-input.css +3 -7
- package/cjs/components/input/style/dnb-input.min.css +1 -1
- package/cjs/components/input-masked/style/dnb-input-masked.css +3 -7
- package/cjs/components/input-masked/style/dnb-input-masked.min.css +1 -1
- package/cjs/components/lib.d.ts +1 -1
- package/cjs/components/modal/Modal.d.ts +2 -2
- package/cjs/components/modal/style/dnb-modal.css +11 -22
- package/cjs/components/modal/style/dnb-modal.min.css +1 -1
- package/cjs/components/number-format/NumberFormat.js +1 -1
- package/cjs/components/number-format/NumberUtils.d.ts +3 -0
- package/cjs/components/radio/style/dnb-radio.css +0 -7
- package/cjs/components/radio/style/dnb-radio.min.css +1 -1
- package/cjs/components/slider/style/dnb-slider.css +0 -7
- package/cjs/components/slider/style/dnb-slider.min.css +1 -1
- package/cjs/components/switch/style/dnb-switch.css +0 -7
- package/cjs/components/switch/style/dnb-switch.min.css +1 -1
- package/cjs/components/table/Table.d.ts +2 -0
- package/cjs/components/table/Table.js +14 -50
- package/cjs/components/table/TableAccordion.d.ts +10 -0
- package/cjs/components/table/TableAccordion.js +265 -0
- package/cjs/components/table/TableAccordionContent.d.ts +18 -0
- package/cjs/components/table/TableAccordionContent.js +126 -0
- package/cjs/components/table/TableContainer.js +3 -2
- package/cjs/components/table/TableScrollView.js +2 -1
- package/cjs/components/table/TableStickyHeader.d.ts +4 -1
- package/cjs/components/table/TableStickyHeader.js +112 -83
- package/cjs/components/table/TableTd.d.ts +6 -1
- package/cjs/components/table/TableTd.js +5 -1
- package/cjs/components/table/TableTh.d.ts +4 -4
- package/cjs/components/table/TableTh.js +6 -1
- package/cjs/components/table/TableTr.d.ts +27 -0
- package/cjs/components/table/TableTr.js +95 -18
- package/cjs/components/table/style/_table-accordion.scss +280 -0
- package/cjs/components/table/style/_table-cell.scss +4 -4
- package/cjs/components/table/style/_table-container.scss +7 -17
- package/cjs/components/table/style/_table-deprecated.scss +74 -0
- package/cjs/components/table/style/_table-header-buttons.scss +2 -1
- package/cjs/components/table/style/_table-sticky.scss +24 -23
- package/cjs/components/table/style/_table-td.scss +46 -38
- package/cjs/components/table/style/_table-th.scss +44 -0
- package/cjs/components/table/style/_table-tr.scss +8 -2
- package/cjs/components/table/style/_table.scss +21 -77
- package/cjs/components/table/style/dnb-table.css +538 -271
- package/cjs/components/table/style/dnb-table.min.css +11 -2
- package/cjs/components/table/style/themes/dnb-table-theme-ui.css +82 -63
- package/cjs/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
- package/cjs/components/table/style/themes/dnb-table-theme-ui.scss +49 -16
- package/cjs/components/textarea/style/dnb-textarea.css +0 -7
- package/cjs/components/textarea/style/dnb-textarea.min.css +1 -1
- package/cjs/components/toggle-button/style/dnb-toggle-button.css +0 -21
- package/cjs/components/toggle-button/style/dnb-toggle-button.min.css +1 -1
- package/cjs/components/visually-hidden/VisuallyHidden.d.ts +2 -11
- package/cjs/components/visually-hidden/VisuallyHidden.js +2 -5
- package/cjs/components/visually-hidden/style/_visually-hidden.scss +0 -8
- package/cjs/components/visually-hidden/style/dnb-visually-hidden.css +10 -42
- package/cjs/components/visually-hidden/style/dnb-visually-hidden.min.css +1 -1
- package/cjs/elements/Element.d.ts +1 -1
- package/cjs/fragments/lib.d.ts +4 -7
- package/cjs/fragments/scroll-view/ScrollView.d.ts +12 -11
- package/cjs/fragments/scroll-view/ScrollView.js +8 -5
- package/cjs/fragments/scroll-view/style/_scroll-view.scss +8 -0
- package/cjs/shared/Eufemia.js +1 -1
- package/cjs/shared/helpers.js +7 -1
- package/cjs/shared/locales/en-GB.d.ts +4 -0
- package/cjs/shared/locales/en-GB.js +4 -0
- package/cjs/shared/locales/en-US.d.ts +4 -0
- package/cjs/shared/locales/index.d.ts +8 -0
- package/cjs/shared/locales/nb-NO.d.ts +4 -0
- package/cjs/shared/locales/nb-NO.js +4 -0
- package/cjs/style/core/helper-classes/helper-classes.scss +3 -0
- package/cjs/style/core/utilities.scss +15 -16
- package/cjs/style/dnb-ui-basis.css +20 -13
- package/cjs/style/dnb-ui-basis.min.css +1 -1
- package/cjs/style/dnb-ui-components.css +599 -365
- package/cjs/style/dnb-ui-components.min.css +13 -4
- package/cjs/style/dnb-ui-core.css +20 -13
- package/cjs/style/dnb-ui-core.min.css +1 -1
- package/cjs/style/dnb-ui-fragments.css +14 -0
- package/cjs/style/dnb-ui-fragments.min.css +1 -1
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.css +102 -63
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/cjs/style/themes/theme-ui/dnb-theme-ui.css +102 -63
- package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/components/accordion/style/_accordion.scss +2 -2
- package/components/accordion/style/dnb-accordion.css +3 -3
- package/components/accordion/style/dnb-accordion.min.css +1 -1
- package/components/autocomplete/style/dnb-autocomplete.css +3 -14
- package/components/autocomplete/style/dnb-autocomplete.min.css +2 -2
- package/components/checkbox/style/dnb-checkbox.css +0 -7
- package/components/checkbox/style/dnb-checkbox.min.css +1 -1
- package/components/date-picker/style/dnb-date-picker.css +3 -35
- package/components/date-picker/style/dnb-date-picker.min.css +2 -2
- package/components/dialog/Dialog.d.ts +1 -1
- package/components/dialog/parts/DialogAction.d.ts +5 -4
- package/components/dialog/parts/DialogAction.js +19 -11
- package/components/dialog/style/_dialog.scss +7 -30
- package/components/dialog/style/dnb-dialog.css +21 -44
- package/components/dialog/style/dnb-dialog.min.css +1 -1
- package/components/dialog/style/themes/dnb-dialog-theme-ui.css +20 -0
- package/components/dialog/style/themes/dnb-dialog-theme-ui.min.css +1 -1
- package/components/dialog/style/themes/dnb-dialog-theme-ui.scss +29 -0
- package/components/drawer/style/_drawer.scss +1 -0
- package/components/drawer/style/dnb-drawer.css +12 -22
- package/components/drawer/style/dnb-drawer.min.css +1 -1
- package/components/drawer/types.d.ts +5 -5
- package/components/dropdown/style/dnb-dropdown.css +0 -7
- package/components/dropdown/style/dnb-dropdown.min.css +1 -1
- package/components/form-label/FormLabel.js +1 -1
- package/components/form-label/style/_form-label.scss +0 -13
- package/components/form-label/style/dnb-form-label.css +0 -7
- package/components/form-label/style/dnb-form-label.min.css +1 -1
- package/components/form-row/style/dnb-form-row.css +0 -7
- package/components/form-row/style/dnb-form-row.min.css +1 -1
- package/components/input/style/_input.scss +4 -0
- package/components/input/style/dnb-input.css +3 -7
- package/components/input/style/dnb-input.min.css +1 -1
- package/components/input-masked/style/dnb-input-masked.css +3 -7
- package/components/input-masked/style/dnb-input-masked.min.css +1 -1
- package/components/lib.d.ts +1 -1
- package/components/modal/Modal.d.ts +2 -2
- package/components/modal/style/dnb-modal.css +11 -22
- package/components/modal/style/dnb-modal.min.css +1 -1
- package/components/number-format/NumberFormat.js +1 -1
- package/components/number-format/NumberUtils.d.ts +3 -0
- package/components/radio/style/dnb-radio.css +0 -7
- package/components/radio/style/dnb-radio.min.css +1 -1
- package/components/slider/style/dnb-slider.css +0 -7
- package/components/slider/style/dnb-slider.min.css +1 -1
- package/components/switch/style/dnb-switch.css +0 -7
- package/components/switch/style/dnb-switch.min.css +1 -1
- package/components/table/Table.d.ts +2 -0
- package/components/table/Table.js +12 -20
- package/components/table/TableAccordion.d.ts +10 -0
- package/components/table/TableAccordion.js +192 -0
- package/components/table/TableAccordionContent.d.ts +18 -0
- package/components/table/TableAccordionContent.js +63 -0
- package/components/table/TableContainer.js +2 -1
- package/components/table/TableScrollView.js +2 -1
- package/components/table/TableStickyHeader.d.ts +4 -1
- package/components/table/TableStickyHeader.js +112 -51
- package/components/table/TableTd.d.ts +6 -1
- package/components/table/TableTd.js +3 -1
- package/components/table/TableTh.d.ts +4 -4
- package/components/table/TableTh.js +6 -1
- package/components/table/TableTr.d.ts +27 -0
- package/components/table/TableTr.js +59 -16
- package/components/table/style/_table-accordion.scss +280 -0
- package/components/table/style/_table-cell.scss +4 -4
- package/components/table/style/_table-container.scss +7 -17
- package/components/table/style/_table-deprecated.scss +74 -0
- package/components/table/style/_table-header-buttons.scss +2 -1
- package/components/table/style/_table-sticky.scss +24 -23
- package/components/table/style/_table-td.scss +46 -38
- package/components/table/style/_table-th.scss +44 -0
- package/components/table/style/_table-tr.scss +8 -2
- package/components/table/style/_table.scss +21 -77
- package/components/table/style/dnb-table.css +538 -271
- package/components/table/style/dnb-table.min.css +11 -2
- package/components/table/style/themes/dnb-table-theme-ui.css +82 -63
- package/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
- package/components/table/style/themes/dnb-table-theme-ui.scss +49 -16
- package/components/textarea/style/dnb-textarea.css +0 -7
- package/components/textarea/style/dnb-textarea.min.css +1 -1
- package/components/toggle-button/style/dnb-toggle-button.css +0 -21
- package/components/toggle-button/style/dnb-toggle-button.min.css +1 -1
- package/components/visually-hidden/VisuallyHidden.d.ts +2 -11
- package/components/visually-hidden/VisuallyHidden.js +2 -5
- package/components/visually-hidden/style/_visually-hidden.scss +0 -8
- package/components/visually-hidden/style/dnb-visually-hidden.css +10 -42
- package/components/visually-hidden/style/dnb-visually-hidden.min.css +1 -1
- package/elements/Element.d.ts +1 -1
- package/es/components/accordion/style/_accordion.scss +2 -2
- package/es/components/accordion/style/dnb-accordion.css +3 -3
- package/es/components/accordion/style/dnb-accordion.min.css +1 -1
- package/es/components/autocomplete/style/dnb-autocomplete.css +3 -14
- package/es/components/autocomplete/style/dnb-autocomplete.min.css +2 -2
- package/es/components/checkbox/style/dnb-checkbox.css +0 -7
- package/es/components/checkbox/style/dnb-checkbox.min.css +1 -1
- package/es/components/date-picker/style/dnb-date-picker.css +3 -35
- package/es/components/date-picker/style/dnb-date-picker.min.css +2 -2
- package/es/components/dialog/Dialog.d.ts +1 -1
- package/es/components/dialog/parts/DialogAction.d.ts +5 -4
- package/es/components/dialog/parts/DialogAction.js +21 -11
- package/es/components/dialog/style/_dialog.scss +7 -30
- package/es/components/dialog/style/dnb-dialog.css +21 -44
- package/es/components/dialog/style/dnb-dialog.min.css +1 -1
- package/es/components/dialog/style/themes/dnb-dialog-theme-ui.css +20 -0
- package/es/components/dialog/style/themes/dnb-dialog-theme-ui.min.css +1 -1
- package/es/components/dialog/style/themes/dnb-dialog-theme-ui.scss +29 -0
- package/es/components/drawer/style/_drawer.scss +1 -0
- package/es/components/drawer/style/dnb-drawer.css +12 -22
- package/es/components/drawer/style/dnb-drawer.min.css +1 -1
- package/es/components/drawer/types.d.ts +5 -5
- package/es/components/dropdown/style/dnb-dropdown.css +0 -7
- package/es/components/dropdown/style/dnb-dropdown.min.css +1 -1
- package/es/components/form-label/FormLabel.js +1 -1
- package/es/components/form-label/style/_form-label.scss +0 -13
- package/es/components/form-label/style/dnb-form-label.css +0 -7
- package/es/components/form-label/style/dnb-form-label.min.css +1 -1
- package/es/components/form-row/style/dnb-form-row.css +0 -7
- package/es/components/form-row/style/dnb-form-row.min.css +1 -1
- package/es/components/input/style/_input.scss +4 -0
- package/es/components/input/style/dnb-input.css +3 -7
- package/es/components/input/style/dnb-input.min.css +1 -1
- package/es/components/input-masked/style/dnb-input-masked.css +3 -7
- package/es/components/input-masked/style/dnb-input-masked.min.css +1 -1
- package/es/components/lib.d.ts +1 -1
- package/es/components/modal/Modal.d.ts +2 -2
- package/es/components/modal/style/dnb-modal.css +11 -22
- package/es/components/modal/style/dnb-modal.min.css +1 -1
- package/es/components/number-format/NumberFormat.js +1 -1
- package/es/components/number-format/NumberUtils.d.ts +3 -0
- package/es/components/radio/style/dnb-radio.css +0 -7
- package/es/components/radio/style/dnb-radio.min.css +1 -1
- package/es/components/slider/style/dnb-slider.css +0 -7
- package/es/components/slider/style/dnb-slider.min.css +1 -1
- package/es/components/switch/style/dnb-switch.css +0 -7
- package/es/components/switch/style/dnb-switch.min.css +1 -1
- package/es/components/table/Table.d.ts +2 -0
- package/es/components/table/Table.js +13 -14
- package/es/components/table/TableAccordion.d.ts +10 -0
- package/es/components/table/TableAccordion.js +175 -0
- package/es/components/table/TableAccordionContent.d.ts +18 -0
- package/es/components/table/TableAccordionContent.js +54 -0
- package/es/components/table/TableContainer.js +2 -1
- package/es/components/table/TableScrollView.js +2 -1
- package/es/components/table/TableStickyHeader.d.ts +4 -1
- package/es/components/table/TableStickyHeader.js +112 -48
- package/es/components/table/TableTd.d.ts +6 -1
- package/es/components/table/TableTd.js +3 -1
- package/es/components/table/TableTh.d.ts +4 -4
- package/es/components/table/TableTh.js +6 -1
- package/es/components/table/TableTr.d.ts +27 -0
- package/es/components/table/TableTr.js +51 -15
- package/es/components/table/style/_table-accordion.scss +280 -0
- package/es/components/table/style/_table-cell.scss +4 -4
- package/es/components/table/style/_table-container.scss +7 -17
- package/es/components/table/style/_table-deprecated.scss +74 -0
- package/es/components/table/style/_table-header-buttons.scss +2 -1
- package/es/components/table/style/_table-sticky.scss +24 -23
- package/es/components/table/style/_table-td.scss +46 -38
- package/es/components/table/style/_table-th.scss +44 -0
- package/es/components/table/style/_table-tr.scss +8 -2
- package/es/components/table/style/_table.scss +21 -77
- package/es/components/table/style/dnb-table.css +538 -271
- package/es/components/table/style/dnb-table.min.css +11 -2
- package/es/components/table/style/themes/dnb-table-theme-ui.css +82 -63
- package/es/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
- package/es/components/table/style/themes/dnb-table-theme-ui.scss +49 -16
- package/es/components/textarea/style/dnb-textarea.css +0 -7
- package/es/components/textarea/style/dnb-textarea.min.css +1 -1
- package/es/components/toggle-button/style/dnb-toggle-button.css +0 -21
- package/es/components/toggle-button/style/dnb-toggle-button.min.css +1 -1
- package/es/components/visually-hidden/VisuallyHidden.d.ts +2 -11
- package/es/components/visually-hidden/VisuallyHidden.js +2 -5
- package/es/components/visually-hidden/style/_visually-hidden.scss +0 -8
- package/es/components/visually-hidden/style/dnb-visually-hidden.css +10 -42
- package/es/components/visually-hidden/style/dnb-visually-hidden.min.css +1 -1
- package/es/elements/Element.d.ts +1 -1
- package/es/fragments/lib.d.ts +4 -7
- package/es/fragments/scroll-view/ScrollView.d.ts +12 -11
- package/es/fragments/scroll-view/ScrollView.js +7 -3
- package/es/fragments/scroll-view/style/_scroll-view.scss +8 -0
- package/es/shared/Eufemia.js +1 -1
- package/es/shared/helpers.js +7 -1
- package/es/shared/locales/en-GB.d.ts +4 -0
- package/es/shared/locales/en-GB.js +4 -0
- package/es/shared/locales/en-US.d.ts +4 -0
- package/es/shared/locales/index.d.ts +8 -0
- package/es/shared/locales/nb-NO.d.ts +4 -0
- package/es/shared/locales/nb-NO.js +4 -0
- package/es/style/core/helper-classes/helper-classes.scss +3 -0
- package/es/style/core/utilities.scss +15 -16
- package/es/style/dnb-ui-basis.css +20 -13
- package/es/style/dnb-ui-basis.min.css +1 -1
- package/es/style/dnb-ui-components.css +599 -365
- package/es/style/dnb-ui-components.min.css +13 -4
- package/es/style/dnb-ui-core.css +20 -13
- package/es/style/dnb-ui-core.min.css +1 -1
- package/es/style/dnb-ui-fragments.css +14 -0
- package/es/style/dnb-ui-fragments.min.css +1 -1
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.css +102 -63
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/es/style/themes/theme-ui/dnb-theme-ui.css +102 -63
- package/es/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/esm/dnb-ui-basis.min.mjs +2 -2
- package/esm/dnb-ui-components.min.mjs +4 -4
- package/esm/dnb-ui-elements.min.mjs +4 -4
- package/esm/dnb-ui-extensions.min.mjs +4 -4
- package/esm/dnb-ui-lib.min.mjs +4 -4
- package/esm/dnb-ui-web-components.min.mjs +4 -4
- package/fragments/lib.d.ts +4 -7
- package/fragments/scroll-view/ScrollView.d.ts +12 -11
- package/fragments/scroll-view/ScrollView.js +8 -4
- package/fragments/scroll-view/style/_scroll-view.scss +8 -0
- package/package.json +2 -2
- package/shared/Eufemia.js +1 -1
- package/shared/helpers.js +7 -1
- package/shared/locales/en-GB.d.ts +4 -0
- package/shared/locales/en-GB.js +4 -0
- package/shared/locales/en-US.d.ts +4 -0
- package/shared/locales/index.d.ts +8 -0
- package/shared/locales/nb-NO.d.ts +4 -0
- package/shared/locales/nb-NO.js +4 -0
- package/style/core/helper-classes/helper-classes.scss +3 -0
- package/style/core/utilities.scss +15 -16
- package/style/dnb-ui-basis.css +20 -13
- package/style/dnb-ui-basis.min.css +1 -1
- package/style/dnb-ui-components.css +599 -365
- package/style/dnb-ui-components.min.css +13 -4
- package/style/dnb-ui-core.css +20 -13
- package/style/dnb-ui-core.min.css +1 -1
- package/style/dnb-ui-fragments.css +14 -0
- package/style/dnb-ui-fragments.min.css +1 -1
- package/style/themes/theme-eiendom/dnb-theme-eiendom.css +102 -63
- package/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/style/themes/theme-ui/dnb-theme-ui.css +102 -63
- package/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/umd/dnb-ui-basis.min.js +3 -3
- package/umd/dnb-ui-components.min.js +5 -5
- package/umd/dnb-ui-elements.min.js +4 -4
- package/umd/dnb-ui-extensions.min.js +5 -5
- package/umd/dnb-ui-lib.min.js +5 -5
- package/umd/dnb-ui-web-components.min.js +5 -5
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["className", "children", "size", "skeleton", "variant", "sticky", "stickyOffset", "fixed", "border", "outline"];
|
|
4
|
+
var _excluded = ["className", "children", "size", "skeleton", "variant", "sticky", "stickyOffset", "fixed", "border", "outline", "accordion", "accordionChevronPlacement"];
|
|
6
5
|
|
|
7
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8
7
|
|
|
@@ -26,6 +25,7 @@ import { extendPropsWithContext, validateDOMAttributes } from '../../shared/comp
|
|
|
26
25
|
import ScrollView from './TableScrollView';
|
|
27
26
|
import TableContext from './TableContext';
|
|
28
27
|
import { useStickyHeader, StickyHelper } from './TableStickyHeader';
|
|
28
|
+
import { useHandleOddEven } from './TableTr';
|
|
29
29
|
export { StickyHelper };
|
|
30
30
|
export { ScrollView };
|
|
31
31
|
export var defaultProps = {
|
|
@@ -49,23 +49,21 @@ var Table = function Table(componentProps) {
|
|
|
49
49
|
fixed = allProps.fixed,
|
|
50
50
|
border = allProps.border,
|
|
51
51
|
outline = allProps.outline,
|
|
52
|
+
accordion = allProps.accordion,
|
|
53
|
+
accordionChevronPlacement = allProps.accordionChevronPlacement,
|
|
52
54
|
props = _objectWithoutProperties(allProps, _excluded);
|
|
53
55
|
|
|
54
|
-
var skeletonClasses = createSkeletonClass('font', skeleton, context);
|
|
55
|
-
var spacingClasses = createSpacingClasses(props);
|
|
56
|
-
|
|
57
56
|
var _useStickyHeader = useStickyHeader(allProps),
|
|
58
57
|
elementRef = _useStickyHeader.elementRef;
|
|
59
58
|
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
66
|
-
rerenderAlias = _React$useState2[0],
|
|
67
|
-
setRerenderAlias = _React$useState2[1];
|
|
59
|
+
var _useHandleOddEven = useHandleOddEven({
|
|
60
|
+
children: children
|
|
61
|
+
}),
|
|
62
|
+
trCountRef = _useHandleOddEven.trCountRef,
|
|
63
|
+
rerenderAlias = _useHandleOddEven.rerenderAlias;
|
|
68
64
|
|
|
65
|
+
var skeletonClasses = createSkeletonClass('font', skeleton, context);
|
|
66
|
+
var spacingClasses = createSpacingClasses(props);
|
|
69
67
|
validateDOMAttributes(allProps, props);
|
|
70
68
|
return React.createElement(Provider, {
|
|
71
69
|
skeleton: Boolean(skeleton)
|
|
@@ -73,18 +71,12 @@ var Table = function Table(componentProps) {
|
|
|
73
71
|
value: {
|
|
74
72
|
trCountRef: trCountRef,
|
|
75
73
|
rerenderAlias: rerenderAlias,
|
|
76
|
-
forceRerender: forceRerender,
|
|
77
74
|
allProps: _objectSpread(_objectSpread({}, context.getTranslation(componentProps).Table), allProps)
|
|
78
75
|
}
|
|
79
76
|
}, React.createElement("table", _extends({
|
|
80
|
-
className: classnames('dnb-table', spacingClasses, skeletonClasses, className, variant && "dnb-table__variant--".concat(variant), size && "dnb-table__size--".concat(size), sticky &&
|
|
77
|
+
className: classnames('dnb-table', spacingClasses, skeletonClasses, className, variant && "dnb-table__variant--".concat(variant), size && "dnb-table__size--".concat(size), sticky && 'dnb-table--sticky', fixed && 'dnb-table--fixed', border && 'dnb-table--border', outline && 'dnb-table--outline', accordion && 'dnb-table--accordion'),
|
|
81
78
|
ref: elementRef
|
|
82
79
|
}, props), children)));
|
|
83
|
-
|
|
84
|
-
function forceRerender() {
|
|
85
|
-
trCountRef.current.count = 0;
|
|
86
|
-
setRerenderAlias({});
|
|
87
|
-
}
|
|
88
80
|
};
|
|
89
81
|
|
|
90
82
|
export default Table;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function useTableAccordion({ children, className, props, expanded, disabled, noAnimation, }: {
|
|
3
|
+
children: any;
|
|
4
|
+
className: any;
|
|
5
|
+
props: any;
|
|
6
|
+
expanded: any;
|
|
7
|
+
disabled: any;
|
|
8
|
+
noAnimation: any;
|
|
9
|
+
}): JSX.Element;
|
|
10
|
+
export declare function TableAccordionToggleButton(): JSX.Element;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
|
|
4
|
+
var _TableTdAccordionIcon, _TableThAccordionIcon, _Td;
|
|
5
|
+
|
|
6
|
+
import "core-js/modules/es.object.to-string.js";
|
|
7
|
+
import "core-js/modules/es.promise.js";
|
|
8
|
+
import "core-js/modules/es.array.find.js";
|
|
9
|
+
import "core-js/modules/es.array.filter.js";
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import classnames from 'classnames';
|
|
12
|
+
import Button from '../button/Button';
|
|
13
|
+
import IconPrimary from '../icon/IconPrimary';
|
|
14
|
+
import Th from './TableTh';
|
|
15
|
+
import Td from './TableTd';
|
|
16
|
+
import TableContext from './TableContext';
|
|
17
|
+
import keycode from 'keycode';
|
|
18
|
+
import { hasSelectedText } from '../../shared/helpers';
|
|
19
|
+
import TableAccordionContent, { TrContext } from './TableAccordionContent';
|
|
20
|
+
export function useTableAccordion(_ref) {
|
|
21
|
+
var _tableContext$allProp, _tableContext$allProp2;
|
|
22
|
+
|
|
23
|
+
var children = _ref.children,
|
|
24
|
+
className = _ref.className,
|
|
25
|
+
props = _ref.props,
|
|
26
|
+
expanded = _ref.expanded,
|
|
27
|
+
disabled = _ref.disabled,
|
|
28
|
+
noAnimation = _ref.noAnimation;
|
|
29
|
+
var tableContext = React.useContext(TableContext);
|
|
30
|
+
|
|
31
|
+
var _React$useState = React.useState(function () {
|
|
32
|
+
if (typeof expanded === 'boolean') {
|
|
33
|
+
return expanded;
|
|
34
|
+
} else if (typeof location !== 'undefined') {
|
|
35
|
+
var id = props === null || props === void 0 ? void 0 : props.id;
|
|
36
|
+
|
|
37
|
+
if (id && '#' + id === location.hash) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return false;
|
|
43
|
+
}),
|
|
44
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
45
|
+
trIsOpen = _React$useState2[0],
|
|
46
|
+
setOpen = _React$useState2[1];
|
|
47
|
+
|
|
48
|
+
var _React$useState3 = React.useState(false),
|
|
49
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
50
|
+
trIsHover = _React$useState4[0],
|
|
51
|
+
setHover = _React$useState4[1];
|
|
52
|
+
|
|
53
|
+
var _React$useState5 = React.useState(false),
|
|
54
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
55
|
+
trHadClick = _React$useState6[0],
|
|
56
|
+
setHadClick = _React$useState6[1];
|
|
57
|
+
|
|
58
|
+
var content = React.Children.toArray(children);
|
|
59
|
+
|
|
60
|
+
if (!(tableContext !== null && tableContext !== void 0 && (_tableContext$allProp = tableContext.allProps) !== null && _tableContext$allProp !== void 0 && _tableContext$allProp.accordion)) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var accordionContent = content.find(function (element) {
|
|
65
|
+
return element.type === TableAccordionContent;
|
|
66
|
+
});
|
|
67
|
+
var hasAccordionContent = React.isValidElement(accordionContent);
|
|
68
|
+
var countTds = hasAccordionContent ? children.filter(function (element) {
|
|
69
|
+
return element.type === Td;
|
|
70
|
+
}).length + 1 : null;
|
|
71
|
+
var trParams = !disabled && hasAccordionContent ? {
|
|
72
|
+
onClick: toggleOpenTr,
|
|
73
|
+
onMouseEnter: onMouseEnterHandler,
|
|
74
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
75
|
+
onKeyDown: onKeydownHandler
|
|
76
|
+
} : {};
|
|
77
|
+
|
|
78
|
+
if (hasAccordionContent) {
|
|
79
|
+
content = content.filter(function (element) {
|
|
80
|
+
var hasContent = element.type === TableAccordionContent;
|
|
81
|
+
return !hasContent;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
var tdElem = _TableTdAccordionIcon || (_TableTdAccordionIcon = React.createElement(TableTdAccordionIcon, {
|
|
85
|
+
key: "td-icon"
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
if (tableContext.allProps.accordionChevronPlacement === 'end') {
|
|
89
|
+
content.push(tdElem);
|
|
90
|
+
} else {
|
|
91
|
+
content.unshift(tdElem);
|
|
92
|
+
}
|
|
93
|
+
} else if (tableContext !== null && tableContext !== void 0 && (_tableContext$allProp2 = tableContext.allProps) !== null && _tableContext$allProp2 !== void 0 && _tableContext$allProp2.accordion) {
|
|
94
|
+
var isTh = content.some(function (element) {
|
|
95
|
+
return element.type === Th;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
if (isTh) {
|
|
99
|
+
var thElem = _TableThAccordionIcon || (_TableThAccordionIcon = React.createElement(TableThAccordionIcon, {
|
|
100
|
+
key: "th-icon"
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
if (tableContext.allProps.accordionChevronPlacement === 'end') {
|
|
104
|
+
content.push(thElem);
|
|
105
|
+
} else {
|
|
106
|
+
content.unshift(thElem);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return React.createElement(TrContext.Provider, {
|
|
112
|
+
value: {
|
|
113
|
+
toggleOpenTr: toggleOpenTr,
|
|
114
|
+
trIsOpen: trIsOpen,
|
|
115
|
+
noAnimation: noAnimation,
|
|
116
|
+
countTds: countTds,
|
|
117
|
+
hasAccordionContent: hasAccordionContent
|
|
118
|
+
}
|
|
119
|
+
}, React.createElement("tr", _extends({
|
|
120
|
+
tabIndex: accordionContent && !disabled ? 0 : undefined,
|
|
121
|
+
className: classnames(className, hasAccordionContent && 'dnb-table__tr--has-accordion-content', trIsOpen && 'dnb-table__tr--expanded', disabled && 'dnb-table__tr--disabled', noAnimation && 'dnb-table__tr--no-animation', trIsHover && trHadClick && 'dnb-table__tr--hover')
|
|
122
|
+
}, trParams, props), content), accordionContent);
|
|
123
|
+
|
|
124
|
+
function onKeydownHandler(event) {
|
|
125
|
+
switch (keycode(event)) {
|
|
126
|
+
case 'space':
|
|
127
|
+
case 'enter':
|
|
128
|
+
{
|
|
129
|
+
var target = event.target;
|
|
130
|
+
|
|
131
|
+
if (document.activeElement !== target || target.tagName === 'TR') {
|
|
132
|
+
setOpen(!trIsOpen);
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function onMouseEnterHandler() {
|
|
141
|
+
setHover(true);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function onMouseLeaveHandler() {
|
|
145
|
+
setHover(false);
|
|
146
|
+
setHadClick(false);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function toggleOpenTr(event) {
|
|
150
|
+
var target = event.target;
|
|
151
|
+
|
|
152
|
+
if (document.activeElement !== target && target.tagName !== 'INPUT' && !hasSelectedText()) {
|
|
153
|
+
setOpen(!trIsOpen);
|
|
154
|
+
setHadClick(true);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
export function TableAccordionToggleButton() {
|
|
159
|
+
var _React$useContext;
|
|
160
|
+
|
|
161
|
+
var trContext = React.useContext(TrContext);
|
|
162
|
+
var allProps = (_React$useContext = React.useContext(TableContext)) === null || _React$useContext === void 0 ? void 0 : _React$useContext.allProps;
|
|
163
|
+
var iconSize = allProps.size === 'medium' || allProps.size === 'small' ? 'basis' : 'medium';
|
|
164
|
+
return React.createElement("span", {
|
|
165
|
+
className: "dnb-table__toggle-button"
|
|
166
|
+
}, React.createElement(IconPrimary, {
|
|
167
|
+
icon: "chevron_down",
|
|
168
|
+
size: iconSize
|
|
169
|
+
}), React.createElement(Button, {
|
|
170
|
+
className: "dnb-sr-only",
|
|
171
|
+
tabIndex: -1,
|
|
172
|
+
"aria-label": allProps === null || allProps === void 0 ? void 0 : allProps.accordionToggleButtonSR,
|
|
173
|
+
"aria-expanded": Boolean(trContext === null || trContext === void 0 ? void 0 : trContext.trIsOpen),
|
|
174
|
+
on_click: trContext === null || trContext === void 0 ? void 0 : trContext.toggleOpenTr
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function TableThAccordionIcon() {
|
|
179
|
+
var _tableContext$allProp3;
|
|
180
|
+
|
|
181
|
+
var tableContext = React.useContext(TableContext);
|
|
182
|
+
return React.createElement(Th, {
|
|
183
|
+
"aria-hidden": true,
|
|
184
|
+
className: "dnb-table__th__accordion-icon"
|
|
185
|
+
}, React.createElement("div", null, tableContext === null || tableContext === void 0 ? void 0 : (_tableContext$allProp3 = tableContext.allProps) === null || _tableContext$allProp3 === void 0 ? void 0 : _tableContext$allProp3.accordionToggleButtonSR));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function TableTdAccordionIcon() {
|
|
189
|
+
return _Td || (_Td = React.createElement(Td, {
|
|
190
|
+
className: "dnb-table__td__accordion-icon"
|
|
191
|
+
}, React.createElement(TableAccordionToggleButton, null)));
|
|
192
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const TrContext: React.Context<any>;
|
|
3
|
+
export declare type TableAccordionContentProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Set to true to expanded the content on initial render
|
|
6
|
+
*/
|
|
7
|
+
expanded?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Set to true to skip animation
|
|
10
|
+
* Default: false
|
|
11
|
+
*/
|
|
12
|
+
noAnimation?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Overwrite the internal collected colSpan (add +1)
|
|
15
|
+
*/
|
|
16
|
+
colSpan?: number;
|
|
17
|
+
};
|
|
18
|
+
export default function TableAccordionContent(componentProps: TableAccordionContentProps & React.TableHTMLAttributes<HTMLTableRowElement>): JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["expanded", "noAnimation", "className", "children", "colSpan"];
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
import { useHeightAnimation } from '../height-animation/useHeightAnimation';
|
|
8
|
+
import TableContext from './TableContext';
|
|
9
|
+
export var TrContext = React.createContext(null);
|
|
10
|
+
export default function TableAccordionContent(componentProps) {
|
|
11
|
+
var _React$useContext;
|
|
12
|
+
|
|
13
|
+
var _componentProps$expan = componentProps.expanded,
|
|
14
|
+
expanded = _componentProps$expan === void 0 ? null : _componentProps$expan,
|
|
15
|
+
_componentProps$noAni = componentProps.noAnimation,
|
|
16
|
+
noAnimation = _componentProps$noAni === void 0 ? null : _componentProps$noAni,
|
|
17
|
+
className = componentProps.className,
|
|
18
|
+
children = componentProps.children,
|
|
19
|
+
_componentProps$colSp = componentProps.colSpan,
|
|
20
|
+
colSpan = _componentProps$colSp === void 0 ? 100 : _componentProps$colSp,
|
|
21
|
+
props = _objectWithoutProperties(componentProps, _excluded);
|
|
22
|
+
|
|
23
|
+
var allProps = (_React$useContext = React.useContext(TableContext)) === null || _React$useContext === void 0 ? void 0 : _React$useContext.allProps;
|
|
24
|
+
var trContext = React.useContext(TrContext);
|
|
25
|
+
var innerRef = React.useRef(null);
|
|
26
|
+
|
|
27
|
+
var _React$useState = React.useState(null),
|
|
28
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
29
|
+
ariaLive = _React$useState2[0],
|
|
30
|
+
setAriaLive = _React$useState2[1];
|
|
31
|
+
|
|
32
|
+
var _useHeightAnimation = useHeightAnimation(innerRef, {
|
|
33
|
+
open: Boolean(expanded || (trContext === null || trContext === void 0 ? void 0 : trContext.trIsOpen)),
|
|
34
|
+
animate: Boolean(!noAnimation && !(trContext !== null && trContext !== void 0 && trContext.noAnimation)),
|
|
35
|
+
onOpen: function onOpen(state) {
|
|
36
|
+
return setAriaLive(state ? true : null);
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
isInDOM = _useHeightAnimation.isInDOM,
|
|
40
|
+
isAnimating = _useHeightAnimation.isAnimating,
|
|
41
|
+
isVisibleParallax = _useHeightAnimation.isVisibleParallax;
|
|
42
|
+
|
|
43
|
+
var countTds = (trContext === null || trContext === void 0 ? void 0 : trContext.countTds) || colSpan;
|
|
44
|
+
return React.createElement("tr", _extends({
|
|
45
|
+
"aria-hidden": !isInDOM,
|
|
46
|
+
hidden: isInDOM ? undefined : true,
|
|
47
|
+
role: isInDOM ? 'row' : undefined,
|
|
48
|
+
className: classnames('dnb-table__tr__accordion_content', className, isInDOM && "dnb-table__tr dnb-table__tr__accordion_content--expanded", isAnimating && 'dnb-table__tr__accordion_content--animating', isVisibleParallax && 'dnb-table__tr__accordion_content--parallax')
|
|
49
|
+
}, props), React.createElement("td", {
|
|
50
|
+
role: isInDOM ? 'cell' : undefined,
|
|
51
|
+
colSpan: countTds,
|
|
52
|
+
className: "dnb-table__td"
|
|
53
|
+
}, isInDOM && React.createElement("div", {
|
|
54
|
+
className: "dnb-table__tr__accordion_content__inner",
|
|
55
|
+
ref: innerRef
|
|
56
|
+
}, React.createElement("div", {
|
|
57
|
+
className: "dnb-table__tr__accordion_content__inner__spacing"
|
|
58
|
+
}, children)), React.createElement("span", {
|
|
59
|
+
className: "dnb-sr-only"
|
|
60
|
+
}, React.createElement("span", {
|
|
61
|
+
"aria-live": "assertive"
|
|
62
|
+
}, isInDOM && !ariaLive ? allProps === null || allProps === void 0 ? void 0 : allProps.accordionMoreContentSR : null))));
|
|
63
|
+
}
|
|
@@ -6,7 +6,7 @@ var _excluded = ["children", "className"],
|
|
|
6
6
|
_excluded4 = ["children", "className"];
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import classnames from 'classnames';
|
|
9
|
-
import
|
|
9
|
+
import TableScrollView from './TableScrollView';
|
|
10
10
|
import { createSpacingClasses } from '../space/SpacingUtils';
|
|
11
11
|
import { validateDOMAttributes } from '../../shared/component-helper';
|
|
12
12
|
export default function TableContainer(props) {
|
|
@@ -16,6 +16,7 @@ export default function TableContainer(props) {
|
|
|
16
16
|
|
|
17
17
|
var spacingClasses = createSpacingClasses(props);
|
|
18
18
|
validateDOMAttributes(props, rest);
|
|
19
|
+
var ScrollView = TableScrollView;
|
|
19
20
|
return React.createElement("section", _extends({
|
|
20
21
|
className: classnames('dnb-table__container', className, spacingClasses)
|
|
21
22
|
}, rest), React.createElement(ScrollView, null, children));
|
|
@@ -10,6 +10,7 @@ export default function TableScrollView(props) {
|
|
|
10
10
|
rest = _objectWithoutProperties(props, _excluded);
|
|
11
11
|
|
|
12
12
|
return React.createElement(ScrollView, _extends({
|
|
13
|
-
className: classnames('dnb-table__scroll-view', className)
|
|
13
|
+
className: classnames('dnb-table__scroll-view', className),
|
|
14
|
+
interactive: true
|
|
14
15
|
}, rest), children);
|
|
15
16
|
}
|
|
@@ -4,7 +4,7 @@ export declare type StickyTableHeaderProps = {
|
|
|
4
4
|
* Makes the Table header sticky
|
|
5
5
|
* Default: false
|
|
6
6
|
*/
|
|
7
|
-
sticky?: boolean;
|
|
7
|
+
sticky?: boolean | 'css-position';
|
|
8
8
|
/**
|
|
9
9
|
* The offset from top in rem or em unit
|
|
10
10
|
* Default: false
|
|
@@ -18,4 +18,7 @@ export declare type StickyTableHeaderProps = {
|
|
|
18
18
|
export declare const useStickyHeader: ({ sticky, stickyOffset, sticky_offset, }: StickyTableHeaderProps) => {
|
|
19
19
|
elementRef: React.MutableRefObject<HTMLTableElement>;
|
|
20
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Deprecated in v10
|
|
23
|
+
*/
|
|
21
24
|
export declare const StickyHelper: () => JSX.Element;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
|
|
3
1
|
var _tr;
|
|
4
2
|
|
|
5
3
|
import "core-js/modules/es.parse-float.js";
|
|
6
4
|
import "core-js/modules/es.array.includes.js";
|
|
7
5
|
import "core-js/modules/es.string.includes.js";
|
|
8
6
|
import React from 'react';
|
|
9
|
-
import { warn } from '../../shared/component-helper';
|
|
7
|
+
import { getPreviousSibling, warn } from '../../shared/component-helper';
|
|
8
|
+
import { getOffsetTop } from '../../shared/helpers';
|
|
10
9
|
export var useStickyHeader = function useStickyHeader(_ref) {
|
|
11
10
|
var sticky = _ref.sticky,
|
|
12
11
|
stickyOffset = _ref.stickyOffset,
|
|
@@ -17,78 +16,144 @@ export var useStickyHeader = function useStickyHeader(_ref) {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
var elementRef = React.useRef();
|
|
20
|
-
var intersectionObserver = React.useRef(null);
|
|
21
19
|
React.useEffect(function () {
|
|
22
20
|
if (sticky) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!elementRef.current) {
|
|
29
|
-
stickyWarning('No ref element given');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var tableElem = elementRef.current;
|
|
33
|
-
var thHeight = 80;
|
|
21
|
+
var isSticky = false;
|
|
22
|
+
var thHeight = 0;
|
|
34
23
|
var offsetTopPx = 0;
|
|
24
|
+
var tableOffset = 0;
|
|
25
|
+
var tableHeight = 0;
|
|
26
|
+
var totalOffset = 0;
|
|
27
|
+
var hasScrollbar = null;
|
|
28
|
+
var scrollViewElem = null;
|
|
29
|
+
var timeout = null;
|
|
35
30
|
|
|
36
31
|
try {
|
|
32
|
+
var tableElem = elementRef.current;
|
|
37
33
|
var trElem = tableElem.querySelector('thead > tr:first-of-type, thead > .dnb-table__tr:first-of-type');
|
|
38
|
-
|
|
34
|
+
var thElem = getThElement(tableElem);
|
|
35
|
+
var inIframe = window.self !== window.top;
|
|
36
|
+
|
|
37
|
+
var setSizes = function setSizes() {
|
|
38
|
+
offsetTopPx = parseFloat(String(stickyOffset)) || 0;
|
|
39
|
+
|
|
40
|
+
if (offsetTopPx > 0) {
|
|
41
|
+
if (String(stickyOffset).includes('rem')) {
|
|
42
|
+
offsetTopPx = Math.round(offsetTopPx * 16);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
var modalElem = getPreviousSibling('.dnb-modal__content', tableElem);
|
|
47
|
+
|
|
48
|
+
if (modalElem) {
|
|
49
|
+
scrollViewElem = modalElem.querySelector('.dnb-scroll-view');
|
|
50
|
+
|
|
51
|
+
if (offsetTopPx === 0) {
|
|
52
|
+
offsetTopPx = modalElem.querySelector('.dnb-modal__header__bar').offsetHeight || 0;
|
|
53
|
+
}
|
|
44
54
|
} else {
|
|
55
|
+
var scrollElem = getPreviousSibling('.dnb-scroll-view', tableElem);
|
|
56
|
+
|
|
57
|
+
if (scrollElem) {
|
|
58
|
+
hasScrollbar = scrollElem.scrollHeight - 1 > scrollElem.offsetHeight;
|
|
59
|
+
|
|
60
|
+
if (hasScrollbar) {
|
|
61
|
+
scrollViewElem = scrollElem;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
thHeight = thElem.offsetHeight;
|
|
67
|
+
tableHeight = tableElem.offsetHeight;
|
|
68
|
+
tableOffset = getOffsetTop(tableElem);
|
|
69
|
+
totalOffset = tableOffset - (inIframe ? 0 : offsetTopPx);
|
|
70
|
+
|
|
71
|
+
if (sticky === 'css-position') {
|
|
45
72
|
trElem.style.setProperty('--table-top', "".concat(offsetTopPx / 16, "rem"));
|
|
46
73
|
}
|
|
47
|
-
}
|
|
74
|
+
};
|
|
48
75
|
|
|
49
|
-
var
|
|
50
|
-
thHeight = thElem && parseFloat(window.getComputedStyle(thElem).height) || thHeight;
|
|
51
|
-
intersectionObserver.current = new IntersectionObserver(function (entries) {
|
|
52
|
-
var _entries = _slicedToArray(entries, 1),
|
|
53
|
-
entry = _entries[0];
|
|
76
|
+
var offset = 0;
|
|
54
77
|
|
|
78
|
+
var onScroll = function onScroll() {
|
|
79
|
+
if (scrollViewElem) {
|
|
80
|
+
offset = scrollViewElem.scrollTop;
|
|
81
|
+
} else {
|
|
82
|
+
offset = window.pageYOffset;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
offset -= hasScrollbar ? offsetTopPx : totalOffset;
|
|
86
|
+
|
|
87
|
+
if (offset > 0 && offset < tableHeight - thHeight) {
|
|
88
|
+
if (sticky !== 'css-position') {
|
|
89
|
+
trElem.style.setProperty('--table-offset', String(offset) + 'px');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!isSticky) {
|
|
93
|
+
isSticky = true;
|
|
94
|
+
trElem.classList.add('is-sticky');
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
if (isSticky) {
|
|
98
|
+
isSticky = false;
|
|
99
|
+
|
|
100
|
+
if (offset <= 0) {
|
|
101
|
+
if (sticky !== 'css-position') {
|
|
102
|
+
trElem.style.removeProperty('--table-offset');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
trElem.classList.remove('is-sticky');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
var onResize = function onResize() {
|
|
112
|
+
setSizes();
|
|
113
|
+
onScroll();
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var applyObservers = function applyObservers() {
|
|
55
117
|
try {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
trElem.classList.add('
|
|
118
|
+
trElem.classList.add('sticky');
|
|
119
|
+
|
|
120
|
+
if (sticky === 'css-position') {
|
|
121
|
+
trElem.classList.add('css-position');
|
|
60
122
|
}
|
|
123
|
+
|
|
124
|
+
setSizes();
|
|
125
|
+
var scrollElem = scrollViewElem || document;
|
|
126
|
+
scrollElem.addEventListener('scroll', onScroll);
|
|
127
|
+
window.addEventListener('resize', onResize);
|
|
61
128
|
} catch (e) {
|
|
62
129
|
stickyWarning(e);
|
|
63
130
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
timeout = setTimeout(applyObservers, 100);
|
|
134
|
+
return function () {
|
|
135
|
+
clearTimeout(timeout);
|
|
136
|
+
document.removeEventListener('scroll', onScroll);
|
|
137
|
+
window.removeEventListener('resize', onResize);
|
|
138
|
+
};
|
|
73
139
|
} catch (e) {
|
|
74
140
|
stickyWarning(e);
|
|
75
141
|
}
|
|
76
142
|
}
|
|
77
|
-
|
|
78
|
-
return function () {
|
|
79
|
-
var _intersectionObserver;
|
|
80
|
-
|
|
81
|
-
(_intersectionObserver = intersectionObserver.current) === null || _intersectionObserver === void 0 ? void 0 : _intersectionObserver.disconnect();
|
|
82
|
-
};
|
|
83
143
|
}, [elementRef, sticky, stickyOffset]);
|
|
84
144
|
return {
|
|
85
145
|
elementRef: elementRef
|
|
86
146
|
};
|
|
87
147
|
};
|
|
88
148
|
export var StickyHelper = function StickyHelper() {
|
|
149
|
+
warn('Table.StickyHelper is deprecated!');
|
|
89
150
|
return _tr || (_tr = React.createElement("tr", {
|
|
90
|
-
className: "dnb-table__sticky-helper"
|
|
91
|
-
|
|
151
|
+
className: "dnb-table__sticky-helper",
|
|
152
|
+
"aria-hidden": true,
|
|
153
|
+
role: "presentation"
|
|
154
|
+
}, React.createElement("td", {
|
|
155
|
+
colSpan: 100
|
|
156
|
+
})));
|
|
92
157
|
};
|
|
93
158
|
|
|
94
159
|
var stickyWarning = function stickyWarning() {
|
|
@@ -96,10 +161,6 @@ var stickyWarning = function stickyWarning() {
|
|
|
96
161
|
warn('Could not enable Sticky mode in table:', message);
|
|
97
162
|
};
|
|
98
163
|
|
|
99
|
-
var getTdElement = function getTdElement(element) {
|
|
100
|
-
return element.querySelector('tbody > tr:not(.dnb-table__sticky-helper):first-of-type > td:first-of-type, tbody > .dnb-table__tr:first-of-type > .dnb-table__td:first-of-type');
|
|
101
|
-
};
|
|
102
|
-
|
|
103
164
|
var getThElement = function getThElement(element) {
|
|
104
165
|
return element.querySelector('thead > tr:first-of-type > th:first-of-type, thead > .dnb-table__tr:first-of-type > .dnb-table__th:first-of-type');
|
|
105
166
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import TableAccordionContent from './TableAccordionContent';
|
|
2
3
|
export declare type TableTdProps = {
|
|
3
4
|
/**
|
|
4
5
|
* if set to `true`, no padding will be added
|
|
@@ -16,4 +17,8 @@ export declare type TableTdProps = {
|
|
|
16
17
|
*/
|
|
17
18
|
children?: React.ReactNode;
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
declare function Td(componentProps: TableTdProps & React.TdHTMLAttributes<HTMLTableCellElement>): JSX.Element;
|
|
21
|
+
declare namespace Td {
|
|
22
|
+
var AccordionContent: typeof TableAccordionContent;
|
|
23
|
+
}
|
|
24
|
+
export default Td;
|
|
@@ -3,6 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["className", "children", "noSpacing", "spacing"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
+
import TableAccordionContent from './TableAccordionContent';
|
|
6
7
|
export default function Td(componentProps) {
|
|
7
8
|
var className = componentProps.className,
|
|
8
9
|
children = componentProps.children,
|
|
@@ -14,4 +15,5 @@ export default function Td(componentProps) {
|
|
|
14
15
|
role: "cell",
|
|
15
16
|
className: classnames('dnb-table__td', className, noSpacing && 'dnb-table__td--no-spacing', spacing && "dnb-table__td--spacing-".concat(spacing))
|
|
16
17
|
}, props), children);
|
|
17
|
-
}
|
|
18
|
+
}
|
|
19
|
+
Td.AccordionContent = TableAccordionContent;
|