@dnb/eufemia 9.40.0 → 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 +18 -0
- 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/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/modal/Modal.d.ts +2 -2
- 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 -4
- package/cjs/components/table/TableScrollView.js +2 -1
- package/cjs/components/table/TableTd.d.ts +6 -1
- package/cjs/components/table/TableTd.js +5 -1
- package/cjs/components/table/TableTh.d.ts +3 -3
- package/cjs/components/table/TableTh.js +2 -0
- 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-td.scss +29 -2
- package/cjs/components/table/style/_table-tr.scss +8 -2
- package/cjs/components/table/style/_table.scss +9 -7
- package/cjs/components/table/style/dnb-table.css +540 -322
- package/cjs/components/table/style/dnb-table.min.css +11 -2
- package/cjs/components/table/style/themes/dnb-table-theme-ui.css +5 -1
- 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 +9 -1
- 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/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/dnb-ui-components.css +545 -317
- package/cjs/style/dnb-ui-components.min.css +13 -4
- 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 +5 -1
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +1 -1
- package/cjs/style/themes/theme-ui/dnb-theme-ui.css +5 -1
- package/cjs/style/themes/theme-ui/dnb-theme-ui.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/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/modal/Modal.d.ts +2 -2
- 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 +3 -4
- package/components/table/TableScrollView.js +2 -1
- package/components/table/TableTd.d.ts +6 -1
- package/components/table/TableTd.js +3 -1
- package/components/table/TableTh.d.ts +3 -3
- package/components/table/TableTh.js +2 -0
- 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-td.scss +29 -2
- package/components/table/style/_table-tr.scss +8 -2
- package/components/table/style/_table.scss +9 -7
- package/components/table/style/dnb-table.css +540 -322
- package/components/table/style/dnb-table.min.css +11 -2
- package/components/table/style/themes/dnb-table-theme-ui.css +5 -1
- package/components/table/style/themes/dnb-table-theme-ui.min.css +1 -1
- package/components/table/style/themes/dnb-table-theme-ui.scss +9 -1
- 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/elements/Element.d.ts +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/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/modal/Modal.d.ts +2 -2
- 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 +3 -4
- package/es/components/table/TableScrollView.js +2 -1
- package/es/components/table/TableTd.d.ts +6 -1
- package/es/components/table/TableTd.js +3 -1
- package/es/components/table/TableTh.d.ts +3 -3
- package/es/components/table/TableTh.js +2 -0
- 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-td.scss +29 -2
- package/es/components/table/style/_table-tr.scss +8 -2
- package/es/components/table/style/_table.scss +9 -7
- package/es/components/table/style/dnb-table.css +540 -322
- package/es/components/table/style/dnb-table.min.css +11 -2
- package/es/components/table/style/themes/dnb-table-theme-ui.css +5 -1
- 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 +9 -1
- 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/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/dnb-ui-components.css +545 -317
- package/es/style/dnb-ui-components.min.css +13 -4
- 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 +5 -1
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +1 -1
- package/es/style/themes/theme-ui/dnb-theme-ui.css +5 -1
- package/es/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/esm/dnb-ui-basis.min.mjs +1 -1
- package/esm/dnb-ui-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +3 -3
- package/esm/dnb-ui-extensions.min.mjs +4 -4
- package/esm/dnb-ui-lib.min.mjs +2 -2
- package/esm/dnb-ui-web-components.min.mjs +2 -2
- 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 +1 -1
- 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/dnb-ui-components.css +545 -317
- package/style/dnb-ui-components.min.css +13 -4
- 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 +5 -1
- package/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +1 -1
- package/style/themes/theme-ui/dnb-theme-ui.css +5 -1
- package/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/umd/dnb-ui-basis.min.js +1 -1
- package/umd/dnb-ui-components.min.js +1 -1
- package/umd/dnb-ui-elements.min.js +3 -3
- package/umd/dnb-ui-extensions.min.js +4 -4
- package/umd/dnb-ui-lib.min.js +2 -2
- package/umd/dnb-ui-web-components.min.js +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
.dnb-form-label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#333;color:var(--color-black-80,#333);font-family:DNB,sans-serif;font-family:var(--font-family-default);font-size:1rem;font-size:var(--font-size-small);font-style:normal;font-weight:400;font-weight:var(--font-weight-basis);line-height:1.5rem;line-height:var(--line-height-basis);margin:0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-break:break-word}.dnb-form-label *,.dnb-form-label :after,.dnb-form-label :before{background-repeat:no-repeat;-webkit-box-sizing:border-box;box-sizing:border-box}.dnb-form-label :after,.dnb-form-label :before{text-decoration:inherit;vertical-align:inherit}.dnb-form-label{color:inherit;display:inline-block;font-size:1.125rem;font-size:var(--font-size-basis);margin-right:1rem;padding:0;text-align:left;vertical-align:baseline;white-space:pre-wrap;width:auto;word-break:normal}.dnb-form-label--vertical{display:block;margin-bottom:.5rem;margin-right:0}.dnb-form-label--sr-only{margin:0 0 0 -1px!important;overflow:hidden!important;padding:0!important;white-space:nowrap!important;width:1px!important}.dnb-form-label[for]:not([disabled]){cursor:pointer;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.dnb-form-label[disabled]{cursor:not-allowed}@media screen and (-ms-high-contrast:none){.dnb-form-label{max-width:60vw}}legend.dnb-form-label{display:inline-block}.dnb-form-status{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#333;color:var(--color-black-80,#333);font-family:DNB,sans-serif;font-family:var(--font-family-default);font-size:1rem;font-size:var(--font-size-small);font-style:normal;font-weight:400;font-weight:var(--font-weight-basis);line-height:1.5rem;line-height:var(--line-height-basis);margin:0;padding:0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-break:break-word}.dnb-form-status *,.dnb-form-status :after,.dnb-form-status :before{background-repeat:no-repeat;-webkit-box-sizing:border-box;box-sizing:border-box}.dnb-form-status :after,.dnb-form-status :before{text-decoration:inherit;vertical-align:inherit}:root{--form-status-radius:0.25rem}.dnb-form-status{display:-webkit-box;display:-ms-flexbox;display:flex;opacity:1;-webkit-transition:height .4s cubic-bezier(.42,0,0,1),opacity .4s cubic-bezier(.42,0,0,1),margin .4s cubic-bezier(.42,0,0,1),padding .4s cubic-bezier(.42,0,0,1);transition:height .4s cubic-bezier(.42,0,0,1),opacity .4s cubic-bezier(.42,0,0,1),margin .4s cubic-bezier(.42,0,0,1),padding .4s cubic-bezier(.42,0,0,1);-webkit-transition:height .4s var(--easing-default),opacity .4s var(--easing-default),margin .4s var(--easing-default),padding .4s var(--easing-default);transition:height .4s var(--easing-default),opacity .4s var(--easing-default),margin .4s var(--easing-default),padding .4s var(--easing-default)}.dnb-form-status--hidden{height:0;opacity:0;width:0;will-change:height,opacity,margin,padding}.dnb-form-status--is-animating{overflow:hidden;width:auto}.dnb-form-status--disappear,.dnb-form-status--hidden{margin:0!important;padding:0!important}.dnb-form-status__shell{-webkit-box-pack:start;-ms-flex-pack:start;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;border-radius:.25rem;border-radius:var(--form-status-radius);display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:flex-start;min-width:inherit}.dnb-form-status__text{color:inherit;cursor:text;font-size:1rem;font-size:var(--font-size-small);line-height:1.25rem;line-height:var(--line-height-small);padding:.625rem 1rem;white-space:normal}button .dnb-form-status__text{cursor:inherit}.dnb-form-status__text .dnb-anchor{font-size:inherit}.dnb-icon+.dnb-form-status__text{padding-left:.5rem}.dnb-form-status__shell>.dnb-icon{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;margin:.3333333em .3333333em .3333333em .6666666em}.dnb-form-status__size--large .dnb-form-status__text{padding-bottom:1.125rem;padding-top:1.125rem}.dnb-form-status__size--large .dnb-form-status__shell>.dnb-icon{margin-bottom:.6666666em;margin-top:.6666666em}.dnb-form-status--stretch{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.dnb-form-status--stretch .dnb-form-status__shell{width:100%}.dnb-form-status--stretch .dnb-form-status__text{max-width:47rem}.dnb-form-status[hidden]{display:none}.dnb-form-status--no-animation,html[data-visual-test] .dnb-form-status{-webkit-transition-duration:1ms!important;transition-duration:1ms!important}@media screen and (-ms-high-contrast:none){.dnb-form-status__shell>.dnb-icon{border-width:1px}}.dnb-switch{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#333;color:var(--color-black-80,#333);font-family:DNB,sans-serif;font-family:var(--font-family-default);font-style:normal;font-weight:400;font-weight:var(--font-weight-basis);margin:0;padding:0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-break:break-word}.dnb-switch *,.dnb-switch :after,.dnb-switch :before{background-repeat:no-repeat;-webkit-box-sizing:border-box;box-sizing:border-box}.dnb-switch :after,.dnb-switch :before{text-decoration:inherit;vertical-align:inherit}:root{--switch-width--medium:2.5rem;--switch-height--medium:1.5rem;--switch-width--large:3.25rem;--switch-height--large:2rem;--switch-border-width--medium:0.0625rem;--switch-border-width--large:0.125rem}.dnb-switch{font-size:1rem;font-size:var(--font-size-small);line-height:1.5rem;line-height:var(--line-height-basis)}.dnb-switch,.dnb-switch__inner{-webkit-box-orient:vertical;-webkit-box-direction:normal;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}.dnb-switch__inner{-webkit-box-pack:center;-ms-flex-pack:center;font-size:1.125rem;font-size:var(--font-size-basis);justify-content:center}.dnb-switch__shell{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.dnb-switch--large{line-height:2rem;line-height:var(--switch-height--large)}.dnb-switch--large .dnb-switch__shell{height:2rem;height:var(--switch-height--large)}.dnb-switch__row{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;height:1.5rem;height:var(--switch-height--medium)}.dnb-switch__button,.dnb-switch__focus{border-radius:50%;position:absolute;z-index:4}.dnb-switch__button{border:.0625rem solid transparent;border:var(--switch-border-width--medium) solid transparent;height:1.5rem;height:var(--switch-height--medium);left:0;-webkit-transform:translateX(0);transform:translateX(0);-webkit-transition:-webkit-transform .16s ease-out 125ms;transition:-webkit-transform .16s ease-out 125ms;transition:transform .16s ease-out 125ms;transition:transform .16s ease-out 125ms,-webkit-transform .16s ease-out 125ms;width:1.5rem;width:var(--switch-height--medium)}.dnb-switch--large .dnb-switch__button{border-width:.125rem;border-width:var(--switch-border-width--large);height:2rem;height:var(--switch-height--large);width:2rem;width:var(--switch-height--large)}.dnb-switch__focus{-webkit-clip-path:polygon(50% 15%,110% 15%,110% -10%,-10% -10%,-10% 110%,110% 110%,110% 85%,50% 85%);clip-path:polygon(50% 15%,110% 15%,110% -10%,-10% -10%,-10% 110%,110% 110%,110% 85%,50% 85%);display:none;height:100%;outline:none;position:absolute;-webkit-transform:rotate(0deg);transform:rotate(0deg);-webkit-transition:-webkit-transform .15s ease-out;transition:-webkit-transform .15s ease-out;transition:transform .15s ease-out;transition:transform .15s ease-out,-webkit-transform .15s ease-out;width:100%;z-index:2}html[data-whatinput=keyboard] .dnb-switch__focus{--border-color:var(--color-emerald-green);border-color:transparent;-webkit-box-shadow:0 0 0 .125rem var(--border-color);box-shadow:0 0 0 .125rem var(--border-color)}@media screen and (-ms-high-contrast:none){html[data-whatinput=keyboard] .dnb-switch__focus{-webkit-box-shadow:0 0 0 .125rem #14555a;box-shadow:0 0 0 .125rem #14555a;-webkit-box-shadow:0 0 0 .125rem var(--color-emerald-green);box-shadow:0 0 0 .125rem var(--color-emerald-green)}}.dnb-switch__input:not(:checked)~.dnb-switch__button{-webkit-transform:translateX(0);transform:translateX(0);-webkit-transform:translateX(-.0625rem);transform:translateX(-.0625rem);-webkit-transform:translateX(calc(0px - var(--switch-border-width--medium)));transform:translateX(calc(0px - var(--switch-border-width--medium)))}.dnb-switch__input:checked~.dnb-switch__button{-webkit-transform:translateX(1rem);transform:translateX(1rem);-webkit-transform:translateX(1.0625rem);transform:translateX(1.0625rem);-webkit-transform:translateX(calc(var(--switch-width--medium) - 1.5rem + var(--switch-border-width--medium)));transform:translateX(calc(var(--switch-width--medium) - 1.5rem + var(--switch-border-width--medium)))}.dnb-switch--large .dnb-switch__input:not(:checked)~.dnb-switch__button{-webkit-transform:translateX(-.125rem);transform:translateX(-.125rem);-webkit-transform:translateX(calc(0px - var(--switch-border-width--large)));transform:translateX(calc(0px - var(--switch-border-width--large)))}.dnb-switch--large .dnb-switch__input:checked~.dnb-switch__button{-webkit-transform:translateX(1.375rem);transform:translateX(1.375rem);-webkit-transform:translateX(calc(var(--switch-width--large) - 2rem + var(--switch-border-width--large)));transform:translateX(calc(var(--switch-width--large) - 2rem + var(--switch-border-width--large)))}.dnb-switch__background{border-radius:1.25rem;border-radius:calc(var(--switch-height--medium) - .25rem);height:1rem;height:calc(var(--switch-height--medium) - .5rem);width:2.5rem;width:var(--switch-width--medium)}.dnb-switch--large .dnb-switch__background{border-radius:1.625rem;border-radius:calc(var(--switch-height--large) - .375rem);height:1.25rem;height:calc(var(--switch-height--large) - .75rem);width:3.25rem;width:var(--switch-width--large)}.dnb-switch__input{border:0;display:block;height:1.5rem;height:var(--switch-height--medium);left:0;margin:0;opacity:0;padding:0;position:absolute;right:0;width:2.5rem;width:var(--switch-width--medium);z-index:5}.dnb-switch--large .dnb-switch__input{height:2rem;height:var(--switch-height--large);width:3.25rem;width:var(--switch-width--large)}.dnb-switch__input:not([disabled]){cursor:pointer}.dnb-switch .dnb-form-label{margin-bottom:0;margin-left:0;margin-right:0;padding-right:.5rem}.dnb-switch__order{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}.dnb-switch__suffix{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.dnb-switch--label-position-left .dnb-switch__suffix{padding-left:1rem}.dnb-switch--label-position-left .dnb-switch__order .dnb-switch__inner{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.dnb-switch--label-position-left .dnb-switch__order .dnb-form-label{-webkit-box-ordinal-group:2;-ms-flex-order:1;-ms-flex-item-align:start;align-self:flex-start;order:1}.dnb-switch--label-position-left .dnb-switch__order .dnb-form-status{-webkit-box-ordinal-group:4;-ms-flex-order:3;margin-top:.5rem;order:3}.dnb-switch--label-position-right .dnb-switch__order .dnb-switch__inner{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.dnb-switch--label-position-right .dnb-switch__order .dnb-form-label{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;padding-left:.5rem}.dnb-switch--label-position-right .dnb-switch__order .dnb-form-status{-webkit-box-ordinal-group:4;-ms-flex-order:3;margin-top:.5rem;order:3}.dnb-switch.dnb-skeleton .dnb-switch__input[disabled]~.dnb-switch__background:after,.dnb-switch.dnb-skeleton .dnb-switch__input[disabled]~.dnb-switch__button{border-color:#ebebeb;border-color:var(--skeleton-color)}.dnb-switch.dnb-skeleton .dnb-switch__input[disabled]~.dnb-switch__background{background-color:#ebebeb;background-color:var(--skeleton-color)}.dnb-switch.dnb-skeleton .dnb-switch__input[disabled]:not(:checked)~.dnb-switch__background:after{border-color:#fff;border-color:var(--skeleton-color--contrast)}@media screen and (-ms-high-contrast:none){.dnb-switch{vertical-align:text-bottom}.dnb-switch__order{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.dnb-switch__shell{-webkit-transform:translateY(0);transform:translateY(0)}.dnb-switch__button,.dnb-switch__focus,.dnb-switch__input{bottom:0;margin:auto 0;top:0}}@supports (-ms-ime-align:auto){.dnb-switch__input:not(:checked)~.dnb-switch__button{-webkit-transform:translateX(0);transform:translateX(0)}.dnb-switch__input:checked~.dnb-switch__button{-webkit-transform:translateX(1rem);transform:translateX(1rem);-webkit-transform:translateX(calc(var(--switch-width--medium) - 1.5rem));transform:translateX(calc(var(--switch-width--medium) - 1.5rem))}}
|
|
1
|
+
.dnb-form-label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#333;color:var(--color-black-80,#333);font-family:DNB,sans-serif;font-family:var(--font-family-default);font-size:1rem;font-size:var(--font-size-small);font-style:normal;font-weight:400;font-weight:var(--font-weight-basis);line-height:1.5rem;line-height:var(--line-height-basis);margin:0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-break:break-word}.dnb-form-label *,.dnb-form-label :after,.dnb-form-label :before{background-repeat:no-repeat;-webkit-box-sizing:border-box;box-sizing:border-box}.dnb-form-label :after,.dnb-form-label :before{text-decoration:inherit;vertical-align:inherit}.dnb-form-label{color:inherit;display:inline-block;font-size:1.125rem;font-size:var(--font-size-basis);margin-right:1rem;padding:0;text-align:left;vertical-align:baseline;white-space:pre-wrap;width:auto;word-break:normal}.dnb-form-label--vertical{display:block;margin-bottom:.5rem;margin-right:0}.dnb-form-label[for]:not([disabled]){cursor:pointer;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.dnb-form-label[disabled]{cursor:not-allowed}@media screen and (-ms-high-contrast:none){.dnb-form-label{max-width:60vw}}legend.dnb-form-label{display:inline-block}.dnb-form-status{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#333;color:var(--color-black-80,#333);font-family:DNB,sans-serif;font-family:var(--font-family-default);font-size:1rem;font-size:var(--font-size-small);font-style:normal;font-weight:400;font-weight:var(--font-weight-basis);line-height:1.5rem;line-height:var(--line-height-basis);margin:0;padding:0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-break:break-word}.dnb-form-status *,.dnb-form-status :after,.dnb-form-status :before{background-repeat:no-repeat;-webkit-box-sizing:border-box;box-sizing:border-box}.dnb-form-status :after,.dnb-form-status :before{text-decoration:inherit;vertical-align:inherit}:root{--form-status-radius:0.25rem}.dnb-form-status{display:-webkit-box;display:-ms-flexbox;display:flex;opacity:1;-webkit-transition:height .4s cubic-bezier(.42,0,0,1),opacity .4s cubic-bezier(.42,0,0,1),margin .4s cubic-bezier(.42,0,0,1),padding .4s cubic-bezier(.42,0,0,1);transition:height .4s cubic-bezier(.42,0,0,1),opacity .4s cubic-bezier(.42,0,0,1),margin .4s cubic-bezier(.42,0,0,1),padding .4s cubic-bezier(.42,0,0,1);-webkit-transition:height .4s var(--easing-default),opacity .4s var(--easing-default),margin .4s var(--easing-default),padding .4s var(--easing-default);transition:height .4s var(--easing-default),opacity .4s var(--easing-default),margin .4s var(--easing-default),padding .4s var(--easing-default)}.dnb-form-status--hidden{height:0;opacity:0;width:0;will-change:height,opacity,margin,padding}.dnb-form-status--is-animating{overflow:hidden;width:auto}.dnb-form-status--disappear,.dnb-form-status--hidden{margin:0!important;padding:0!important}.dnb-form-status__shell{-webkit-box-pack:start;-ms-flex-pack:start;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;border-radius:.25rem;border-radius:var(--form-status-radius);display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:flex-start;min-width:inherit}.dnb-form-status__text{color:inherit;cursor:text;font-size:1rem;font-size:var(--font-size-small);line-height:1.25rem;line-height:var(--line-height-small);padding:.625rem 1rem;white-space:normal}button .dnb-form-status__text{cursor:inherit}.dnb-form-status__text .dnb-anchor{font-size:inherit}.dnb-icon+.dnb-form-status__text{padding-left:.5rem}.dnb-form-status__shell>.dnb-icon{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:center;margin:.3333333em .3333333em .3333333em .6666666em}.dnb-form-status__size--large .dnb-form-status__text{padding-bottom:1.125rem;padding-top:1.125rem}.dnb-form-status__size--large .dnb-form-status__shell>.dnb-icon{margin-bottom:.6666666em;margin-top:.6666666em}.dnb-form-status--stretch{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.dnb-form-status--stretch .dnb-form-status__shell{width:100%}.dnb-form-status--stretch .dnb-form-status__text{max-width:47rem}.dnb-form-status[hidden]{display:none}.dnb-form-status--no-animation,html[data-visual-test] .dnb-form-status{-webkit-transition-duration:1ms!important;transition-duration:1ms!important}@media screen and (-ms-high-contrast:none){.dnb-form-status__shell>.dnb-icon{border-width:1px}}.dnb-switch{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#333;color:var(--color-black-80,#333);font-family:DNB,sans-serif;font-family:var(--font-family-default);font-style:normal;font-weight:400;font-weight:var(--font-weight-basis);margin:0;padding:0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-break:break-word}.dnb-switch *,.dnb-switch :after,.dnb-switch :before{background-repeat:no-repeat;-webkit-box-sizing:border-box;box-sizing:border-box}.dnb-switch :after,.dnb-switch :before{text-decoration:inherit;vertical-align:inherit}:root{--switch-width--medium:2.5rem;--switch-height--medium:1.5rem;--switch-width--large:3.25rem;--switch-height--large:2rem;--switch-border-width--medium:0.0625rem;--switch-border-width--large:0.125rem}.dnb-switch{font-size:1rem;font-size:var(--font-size-small);line-height:1.5rem;line-height:var(--line-height-basis)}.dnb-switch,.dnb-switch__inner{-webkit-box-orient:vertical;-webkit-box-direction:normal;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}.dnb-switch__inner{-webkit-box-pack:center;-ms-flex-pack:center;font-size:1.125rem;font-size:var(--font-size-basis);justify-content:center}.dnb-switch__shell{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.dnb-switch--large{line-height:2rem;line-height:var(--switch-height--large)}.dnb-switch--large .dnb-switch__shell{height:2rem;height:var(--switch-height--large)}.dnb-switch__row{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;height:1.5rem;height:var(--switch-height--medium)}.dnb-switch__button,.dnb-switch__focus{border-radius:50%;position:absolute;z-index:4}.dnb-switch__button{border:.0625rem solid transparent;border:var(--switch-border-width--medium) solid transparent;height:1.5rem;height:var(--switch-height--medium);left:0;-webkit-transform:translateX(0);transform:translateX(0);-webkit-transition:-webkit-transform .16s ease-out 125ms;transition:-webkit-transform .16s ease-out 125ms;transition:transform .16s ease-out 125ms;transition:transform .16s ease-out 125ms,-webkit-transform .16s ease-out 125ms;width:1.5rem;width:var(--switch-height--medium)}.dnb-switch--large .dnb-switch__button{border-width:.125rem;border-width:var(--switch-border-width--large);height:2rem;height:var(--switch-height--large);width:2rem;width:var(--switch-height--large)}.dnb-switch__focus{-webkit-clip-path:polygon(50% 15%,110% 15%,110% -10%,-10% -10%,-10% 110%,110% 110%,110% 85%,50% 85%);clip-path:polygon(50% 15%,110% 15%,110% -10%,-10% -10%,-10% 110%,110% 110%,110% 85%,50% 85%);display:none;height:100%;outline:none;position:absolute;-webkit-transform:rotate(0deg);transform:rotate(0deg);-webkit-transition:-webkit-transform .15s ease-out;transition:-webkit-transform .15s ease-out;transition:transform .15s ease-out;transition:transform .15s ease-out,-webkit-transform .15s ease-out;width:100%;z-index:2}html[data-whatinput=keyboard] .dnb-switch__focus{--border-color:var(--color-emerald-green);border-color:transparent;-webkit-box-shadow:0 0 0 .125rem var(--border-color);box-shadow:0 0 0 .125rem var(--border-color)}@media screen and (-ms-high-contrast:none){html[data-whatinput=keyboard] .dnb-switch__focus{-webkit-box-shadow:0 0 0 .125rem #14555a;box-shadow:0 0 0 .125rem #14555a;-webkit-box-shadow:0 0 0 .125rem var(--color-emerald-green);box-shadow:0 0 0 .125rem var(--color-emerald-green)}}.dnb-switch__input:not(:checked)~.dnb-switch__button{-webkit-transform:translateX(0);transform:translateX(0);-webkit-transform:translateX(-.0625rem);transform:translateX(-.0625rem);-webkit-transform:translateX(calc(0px - var(--switch-border-width--medium)));transform:translateX(calc(0px - var(--switch-border-width--medium)))}.dnb-switch__input:checked~.dnb-switch__button{-webkit-transform:translateX(1rem);transform:translateX(1rem);-webkit-transform:translateX(1.0625rem);transform:translateX(1.0625rem);-webkit-transform:translateX(calc(var(--switch-width--medium) - 1.5rem + var(--switch-border-width--medium)));transform:translateX(calc(var(--switch-width--medium) - 1.5rem + var(--switch-border-width--medium)))}.dnb-switch--large .dnb-switch__input:not(:checked)~.dnb-switch__button{-webkit-transform:translateX(-.125rem);transform:translateX(-.125rem);-webkit-transform:translateX(calc(0px - var(--switch-border-width--large)));transform:translateX(calc(0px - var(--switch-border-width--large)))}.dnb-switch--large .dnb-switch__input:checked~.dnb-switch__button{-webkit-transform:translateX(1.375rem);transform:translateX(1.375rem);-webkit-transform:translateX(calc(var(--switch-width--large) - 2rem + var(--switch-border-width--large)));transform:translateX(calc(var(--switch-width--large) - 2rem + var(--switch-border-width--large)))}.dnb-switch__background{border-radius:1.25rem;border-radius:calc(var(--switch-height--medium) - .25rem);height:1rem;height:calc(var(--switch-height--medium) - .5rem);width:2.5rem;width:var(--switch-width--medium)}.dnb-switch--large .dnb-switch__background{border-radius:1.625rem;border-radius:calc(var(--switch-height--large) - .375rem);height:1.25rem;height:calc(var(--switch-height--large) - .75rem);width:3.25rem;width:var(--switch-width--large)}.dnb-switch__input{border:0;display:block;height:1.5rem;height:var(--switch-height--medium);left:0;margin:0;opacity:0;padding:0;position:absolute;right:0;width:2.5rem;width:var(--switch-width--medium);z-index:5}.dnb-switch--large .dnb-switch__input{height:2rem;height:var(--switch-height--large);width:3.25rem;width:var(--switch-width--large)}.dnb-switch__input:not([disabled]){cursor:pointer}.dnb-switch .dnb-form-label{margin-bottom:0;margin-left:0;margin-right:0;padding-right:.5rem}.dnb-switch__order{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}.dnb-switch__suffix{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.dnb-switch--label-position-left .dnb-switch__suffix{padding-left:1rem}.dnb-switch--label-position-left .dnb-switch__order .dnb-switch__inner{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.dnb-switch--label-position-left .dnb-switch__order .dnb-form-label{-webkit-box-ordinal-group:2;-ms-flex-order:1;-ms-flex-item-align:start;align-self:flex-start;order:1}.dnb-switch--label-position-left .dnb-switch__order .dnb-form-status{-webkit-box-ordinal-group:4;-ms-flex-order:3;margin-top:.5rem;order:3}.dnb-switch--label-position-right .dnb-switch__order .dnb-switch__inner{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.dnb-switch--label-position-right .dnb-switch__order .dnb-form-label{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;padding-left:.5rem}.dnb-switch--label-position-right .dnb-switch__order .dnb-form-status{-webkit-box-ordinal-group:4;-ms-flex-order:3;margin-top:.5rem;order:3}.dnb-switch.dnb-skeleton .dnb-switch__input[disabled]~.dnb-switch__background:after,.dnb-switch.dnb-skeleton .dnb-switch__input[disabled]~.dnb-switch__button{border-color:#ebebeb;border-color:var(--skeleton-color)}.dnb-switch.dnb-skeleton .dnb-switch__input[disabled]~.dnb-switch__background{background-color:#ebebeb;background-color:var(--skeleton-color)}.dnb-switch.dnb-skeleton .dnb-switch__input[disabled]:not(:checked)~.dnb-switch__background:after{border-color:#fff;border-color:var(--skeleton-color--contrast)}@media screen and (-ms-high-contrast:none){.dnb-switch{vertical-align:text-bottom}.dnb-switch__order{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.dnb-switch__shell{-webkit-transform:translateY(0);transform:translateY(0)}.dnb-switch__button,.dnb-switch__focus,.dnb-switch__input{bottom:0;margin:auto 0;top:0}}@supports (-ms-ime-align:auto){.dnb-switch__input:not(:checked)~.dnb-switch__button{-webkit-transform:translateX(0);transform:translateX(0)}.dnb-switch__input:checked~.dnb-switch__button{-webkit-transform:translateX(1rem);transform:translateX(1rem);-webkit-transform:translateX(calc(var(--switch-width--medium) - 1.5rem));transform:translateX(calc(var(--switch-width--medium) - 1.5rem))}}
|
|
@@ -41,6 +41,8 @@ export declare type TableProps = {
|
|
|
41
41
|
* Default: false
|
|
42
42
|
*/
|
|
43
43
|
outline?: boolean;
|
|
44
|
+
accordion?: boolean;
|
|
45
|
+
accordionChevronPlacement?: 'start' | 'end';
|
|
44
46
|
/**
|
|
45
47
|
* Defines if the table should behave with a fixed table layout, using: "table-layout: fixed;"
|
|
46
48
|
* Default: null.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
const _excluded = ["className", "children", "size", "skeleton", "variant", "sticky", "stickyOffset", "fixed", "border", "outline"];
|
|
4
|
+
const _excluded = ["className", "children", "size", "skeleton", "variant", "sticky", "stickyOffset", "fixed", "border", "outline", "accordion", "accordionChevronPlacement"];
|
|
5
5
|
|
|
6
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; }
|
|
7
7
|
|
|
@@ -17,6 +17,7 @@ import { extendPropsWithContext, validateDOMAttributes } from '../../shared/comp
|
|
|
17
17
|
import ScrollView from './TableScrollView';
|
|
18
18
|
import TableContext from './TableContext';
|
|
19
19
|
import { useStickyHeader, StickyHelper } from './TableStickyHeader';
|
|
20
|
+
import { useHandleOddEven } from './TableTr';
|
|
20
21
|
export { StickyHelper };
|
|
21
22
|
export { ScrollView };
|
|
22
23
|
export const defaultProps = {
|
|
@@ -40,19 +41,23 @@ const Table = componentProps => {
|
|
|
40
41
|
stickyOffset,
|
|
41
42
|
fixed,
|
|
42
43
|
border,
|
|
43
|
-
outline
|
|
44
|
+
outline,
|
|
45
|
+
accordion,
|
|
46
|
+
accordionChevronPlacement
|
|
44
47
|
} = allProps,
|
|
45
48
|
props = _objectWithoutProperties(allProps, _excluded);
|
|
46
49
|
|
|
47
|
-
const skeletonClasses = createSkeletonClass('font', skeleton, context);
|
|
48
|
-
const spacingClasses = createSpacingClasses(props);
|
|
49
50
|
const {
|
|
50
51
|
elementRef
|
|
51
52
|
} = useStickyHeader(allProps);
|
|
52
|
-
const
|
|
53
|
-
|
|
53
|
+
const {
|
|
54
|
+
trCountRef,
|
|
55
|
+
rerenderAlias
|
|
56
|
+
} = useHandleOddEven({
|
|
57
|
+
children
|
|
54
58
|
});
|
|
55
|
-
const
|
|
59
|
+
const skeletonClasses = createSkeletonClass('font', skeleton, context);
|
|
60
|
+
const spacingClasses = createSpacingClasses(props);
|
|
56
61
|
validateDOMAttributes(allProps, props);
|
|
57
62
|
return React.createElement(Provider, {
|
|
58
63
|
skeleton: Boolean(skeleton)
|
|
@@ -60,18 +65,12 @@ const Table = componentProps => {
|
|
|
60
65
|
value: {
|
|
61
66
|
trCountRef,
|
|
62
67
|
rerenderAlias,
|
|
63
|
-
forceRerender,
|
|
64
68
|
allProps: _objectSpread(_objectSpread({}, context.getTranslation(componentProps).Table), allProps)
|
|
65
69
|
}
|
|
66
70
|
}, React.createElement("table", _extends({
|
|
67
|
-
className: classnames('dnb-table', spacingClasses, skeletonClasses, className, variant && `dnb-table__variant--${variant}`, size && `dnb-table__size--${size}`, sticky && 'dnb-table--sticky', fixed && 'dnb-table--fixed', border && 'dnb-table--border', outline && 'dnb-table--outline'),
|
|
71
|
+
className: classnames('dnb-table', spacingClasses, skeletonClasses, className, variant && `dnb-table__variant--${variant}`, size && `dnb-table__size--${size}`, sticky && 'dnb-table--sticky', fixed && 'dnb-table--fixed', border && 'dnb-table--border', outline && 'dnb-table--outline', accordion && 'dnb-table--accordion'),
|
|
68
72
|
ref: elementRef
|
|
69
73
|
}, props), children)));
|
|
70
|
-
|
|
71
|
-
function forceRerender() {
|
|
72
|
-
trCountRef.current.count = 0;
|
|
73
|
-
setRerenderAlias({});
|
|
74
|
-
}
|
|
75
74
|
};
|
|
76
75
|
|
|
77
76
|
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,175 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
|
|
3
|
+
var _TableTdAccordionIcon, _TableThAccordionIcon, _Td;
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
import Button from '../button/Button';
|
|
8
|
+
import IconPrimary from '../icon/IconPrimary';
|
|
9
|
+
import Th from './TableTh';
|
|
10
|
+
import Td from './TableTd';
|
|
11
|
+
import TableContext from './TableContext';
|
|
12
|
+
import keycode from 'keycode';
|
|
13
|
+
import { hasSelectedText } from '../../shared/helpers';
|
|
14
|
+
import TableAccordionContent, { TrContext } from './TableAccordionContent';
|
|
15
|
+
export function useTableAccordion({
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
props,
|
|
19
|
+
expanded,
|
|
20
|
+
disabled,
|
|
21
|
+
noAnimation
|
|
22
|
+
}) {
|
|
23
|
+
var _tableContext$allProp, _tableContext$allProp2;
|
|
24
|
+
|
|
25
|
+
const tableContext = React.useContext(TableContext);
|
|
26
|
+
const [trIsOpen, setOpen] = React.useState(() => {
|
|
27
|
+
if (typeof expanded === 'boolean') {
|
|
28
|
+
return expanded;
|
|
29
|
+
} else if (typeof location !== 'undefined') {
|
|
30
|
+
const id = props === null || props === void 0 ? void 0 : props.id;
|
|
31
|
+
|
|
32
|
+
if (id && '#' + id === location.hash) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return false;
|
|
38
|
+
});
|
|
39
|
+
const [trIsHover, setHover] = React.useState(false);
|
|
40
|
+
const [trHadClick, setHadClick] = React.useState(false);
|
|
41
|
+
let content = React.Children.toArray(children);
|
|
42
|
+
|
|
43
|
+
if (!(tableContext !== null && tableContext !== void 0 && (_tableContext$allProp = tableContext.allProps) !== null && _tableContext$allProp !== void 0 && _tableContext$allProp.accordion)) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const accordionContent = content.find(element => {
|
|
48
|
+
return element.type === TableAccordionContent;
|
|
49
|
+
});
|
|
50
|
+
const hasAccordionContent = React.isValidElement(accordionContent);
|
|
51
|
+
const countTds = hasAccordionContent ? children.filter(element => {
|
|
52
|
+
return element.type === Td;
|
|
53
|
+
}).length + 1 : null;
|
|
54
|
+
const trParams = !disabled && hasAccordionContent ? {
|
|
55
|
+
onClick: toggleOpenTr,
|
|
56
|
+
onMouseEnter: onMouseEnterHandler,
|
|
57
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
58
|
+
onKeyDown: onKeydownHandler
|
|
59
|
+
} : {};
|
|
60
|
+
|
|
61
|
+
if (hasAccordionContent) {
|
|
62
|
+
content = content.filter(element => {
|
|
63
|
+
const hasContent = element.type === TableAccordionContent;
|
|
64
|
+
return !hasContent;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const tdElem = _TableTdAccordionIcon || (_TableTdAccordionIcon = React.createElement(TableTdAccordionIcon, {
|
|
68
|
+
key: "td-icon"
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
if (tableContext.allProps.accordionChevronPlacement === 'end') {
|
|
72
|
+
content.push(tdElem);
|
|
73
|
+
} else {
|
|
74
|
+
content.unshift(tdElem);
|
|
75
|
+
}
|
|
76
|
+
} else if (tableContext !== null && tableContext !== void 0 && (_tableContext$allProp2 = tableContext.allProps) !== null && _tableContext$allProp2 !== void 0 && _tableContext$allProp2.accordion) {
|
|
77
|
+
const isTh = content.some(element => {
|
|
78
|
+
return element.type === Th;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
if (isTh) {
|
|
82
|
+
const thElem = _TableThAccordionIcon || (_TableThAccordionIcon = React.createElement(TableThAccordionIcon, {
|
|
83
|
+
key: "th-icon"
|
|
84
|
+
}));
|
|
85
|
+
|
|
86
|
+
if (tableContext.allProps.accordionChevronPlacement === 'end') {
|
|
87
|
+
content.push(thElem);
|
|
88
|
+
} else {
|
|
89
|
+
content.unshift(thElem);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return React.createElement(TrContext.Provider, {
|
|
95
|
+
value: {
|
|
96
|
+
toggleOpenTr,
|
|
97
|
+
trIsOpen,
|
|
98
|
+
noAnimation,
|
|
99
|
+
countTds,
|
|
100
|
+
hasAccordionContent
|
|
101
|
+
}
|
|
102
|
+
}, React.createElement("tr", _extends({
|
|
103
|
+
tabIndex: accordionContent && !disabled ? 0 : undefined,
|
|
104
|
+
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')
|
|
105
|
+
}, trParams, props), content), accordionContent);
|
|
106
|
+
|
|
107
|
+
function onKeydownHandler(event) {
|
|
108
|
+
switch (keycode(event)) {
|
|
109
|
+
case 'space':
|
|
110
|
+
case 'enter':
|
|
111
|
+
{
|
|
112
|
+
const target = event.target;
|
|
113
|
+
|
|
114
|
+
if (document.activeElement !== target || target.tagName === 'TR') {
|
|
115
|
+
setOpen(!trIsOpen);
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function onMouseEnterHandler() {
|
|
124
|
+
setHover(true);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function onMouseLeaveHandler() {
|
|
128
|
+
setHover(false);
|
|
129
|
+
setHadClick(false);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function toggleOpenTr(event) {
|
|
133
|
+
const target = event.target;
|
|
134
|
+
|
|
135
|
+
if (document.activeElement !== target && target.tagName !== 'INPUT' && !hasSelectedText()) {
|
|
136
|
+
setOpen(!trIsOpen);
|
|
137
|
+
setHadClick(true);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export function TableAccordionToggleButton() {
|
|
142
|
+
var _React$useContext;
|
|
143
|
+
|
|
144
|
+
const trContext = React.useContext(TrContext);
|
|
145
|
+
const allProps = (_React$useContext = React.useContext(TableContext)) === null || _React$useContext === void 0 ? void 0 : _React$useContext.allProps;
|
|
146
|
+
const iconSize = allProps.size === 'medium' || allProps.size === 'small' ? 'basis' : 'medium';
|
|
147
|
+
return React.createElement("span", {
|
|
148
|
+
className: "dnb-table__toggle-button"
|
|
149
|
+
}, React.createElement(IconPrimary, {
|
|
150
|
+
icon: "chevron_down",
|
|
151
|
+
size: iconSize
|
|
152
|
+
}), React.createElement(Button, {
|
|
153
|
+
className: "dnb-sr-only",
|
|
154
|
+
tabIndex: -1,
|
|
155
|
+
"aria-label": allProps === null || allProps === void 0 ? void 0 : allProps.accordionToggleButtonSR,
|
|
156
|
+
"aria-expanded": Boolean(trContext === null || trContext === void 0 ? void 0 : trContext.trIsOpen),
|
|
157
|
+
on_click: trContext === null || trContext === void 0 ? void 0 : trContext.toggleOpenTr
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function TableThAccordionIcon() {
|
|
162
|
+
var _tableContext$allProp3;
|
|
163
|
+
|
|
164
|
+
const tableContext = React.useContext(TableContext);
|
|
165
|
+
return React.createElement(Th, {
|
|
166
|
+
"aria-hidden": true,
|
|
167
|
+
className: "dnb-table__th__accordion-icon"
|
|
168
|
+
}, 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));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function TableTdAccordionIcon() {
|
|
172
|
+
return _Td || (_Td = React.createElement(Td, {
|
|
173
|
+
className: "dnb-table__td__accordion-icon"
|
|
174
|
+
}, React.createElement(TableAccordionToggleButton, null)));
|
|
175
|
+
}
|
|
@@ -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,54 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["expanded", "noAnimation", "className", "children", "colSpan"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
import { useHeightAnimation } from '../height-animation/useHeightAnimation';
|
|
7
|
+
import TableContext from './TableContext';
|
|
8
|
+
export const TrContext = React.createContext(null);
|
|
9
|
+
export default function TableAccordionContent(componentProps) {
|
|
10
|
+
var _React$useContext;
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
expanded = null,
|
|
14
|
+
noAnimation = null,
|
|
15
|
+
className,
|
|
16
|
+
children,
|
|
17
|
+
colSpan = 100
|
|
18
|
+
} = componentProps,
|
|
19
|
+
props = _objectWithoutProperties(componentProps, _excluded);
|
|
20
|
+
|
|
21
|
+
const allProps = (_React$useContext = React.useContext(TableContext)) === null || _React$useContext === void 0 ? void 0 : _React$useContext.allProps;
|
|
22
|
+
const trContext = React.useContext(TrContext);
|
|
23
|
+
const innerRef = React.useRef(null);
|
|
24
|
+
const [ariaLive, setAriaLive] = React.useState(null);
|
|
25
|
+
const {
|
|
26
|
+
isInDOM,
|
|
27
|
+
isAnimating,
|
|
28
|
+
isVisibleParallax
|
|
29
|
+
} = useHeightAnimation(innerRef, {
|
|
30
|
+
open: Boolean(expanded || (trContext === null || trContext === void 0 ? void 0 : trContext.trIsOpen)),
|
|
31
|
+
animate: Boolean(!noAnimation && !(trContext !== null && trContext !== void 0 && trContext.noAnimation)),
|
|
32
|
+
onOpen: state => setAriaLive(state ? true : null)
|
|
33
|
+
});
|
|
34
|
+
const countTds = (trContext === null || trContext === void 0 ? void 0 : trContext.countTds) || colSpan;
|
|
35
|
+
return React.createElement("tr", _extends({
|
|
36
|
+
"aria-hidden": !isInDOM,
|
|
37
|
+
hidden: isInDOM ? undefined : true,
|
|
38
|
+
role: isInDOM ? 'row' : undefined,
|
|
39
|
+
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')
|
|
40
|
+
}, props), React.createElement("td", {
|
|
41
|
+
role: isInDOM ? 'cell' : undefined,
|
|
42
|
+
colSpan: countTds,
|
|
43
|
+
className: "dnb-table__td"
|
|
44
|
+
}, isInDOM && React.createElement("div", {
|
|
45
|
+
className: "dnb-table__tr__accordion_content__inner",
|
|
46
|
+
ref: innerRef
|
|
47
|
+
}, React.createElement("div", {
|
|
48
|
+
className: "dnb-table__tr__accordion_content__inner__spacing"
|
|
49
|
+
}, children)), React.createElement("span", {
|
|
50
|
+
className: "dnb-sr-only"
|
|
51
|
+
}, React.createElement("span", {
|
|
52
|
+
"aria-live": "assertive"
|
|
53
|
+
}, isInDOM && !ariaLive ? allProps === null || allProps === void 0 ? void 0 : allProps.accordionMoreContentSR : null))));
|
|
54
|
+
}
|
|
@@ -6,7 +6,7 @@ const _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) {
|
|
@@ -18,11 +18,10 @@ export default function TableContainer(props) {
|
|
|
18
18
|
|
|
19
19
|
const spacingClasses = createSpacingClasses(props);
|
|
20
20
|
validateDOMAttributes(props, rest);
|
|
21
|
+
const ScrollView = TableScrollView;
|
|
21
22
|
return React.createElement("section", _extends({
|
|
22
23
|
className: classnames('dnb-table__container', className, spacingClasses)
|
|
23
|
-
}, rest), React.createElement(ScrollView,
|
|
24
|
-
className: "dnb-table__scroll-view"
|
|
25
|
-
}, children));
|
|
24
|
+
}, rest), React.createElement(ScrollView, null, children));
|
|
26
25
|
}
|
|
27
26
|
export function TableContainerBody(props) {
|
|
28
27
|
const {
|
|
@@ -12,6 +12,7 @@ export default function TableScrollView(props) {
|
|
|
12
12
|
rest = _objectWithoutProperties(props, _excluded);
|
|
13
13
|
|
|
14
14
|
return React.createElement(ScrollView, _extends({
|
|
15
|
-
className: classnames('dnb-table__scroll-view', className)
|
|
15
|
+
className: classnames('dnb-table__scroll-view', className),
|
|
16
|
+
interactive: true
|
|
16
17
|
}, rest), children);
|
|
17
18
|
}
|
|
@@ -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
|
const _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
|
const {
|
|
8
9
|
className,
|
|
@@ -16,4 +17,5 @@ export default function Td(componentProps) {
|
|
|
16
17
|
role: "cell",
|
|
17
18
|
className: classnames('dnb-table__td', className, noSpacing && 'dnb-table__td--no-spacing', spacing && `dnb-table__td--spacing-${spacing}`)
|
|
18
19
|
}, props), children);
|
|
19
|
-
}
|
|
20
|
+
}
|
|
21
|
+
Td.AccordionContent = TableAccordionContent;
|
|
@@ -4,17 +4,17 @@ import TableHelpButton from './TableHelpButton';
|
|
|
4
4
|
export declare type TableThChildren = React.ReactNode | ReturnType<typeof TableSortButton> | ReturnType<typeof TableHelpButton>;
|
|
5
5
|
export declare type TableThProps = {
|
|
6
6
|
/**
|
|
7
|
-
* Defines the table header as sortable
|
|
7
|
+
* Defines the table header as sortable (ascending)
|
|
8
8
|
* Default: false
|
|
9
9
|
*/
|
|
10
10
|
sortable?: boolean;
|
|
11
11
|
/**
|
|
12
|
-
* Defines the sortable column as the current active
|
|
12
|
+
* Defines the sortable column as the current active (ascending)
|
|
13
13
|
* Default: false
|
|
14
14
|
*/
|
|
15
15
|
active?: boolean;
|
|
16
16
|
/**
|
|
17
|
-
* Defines the sortable column as in reversed order
|
|
17
|
+
* Defines the sortable column as in reversed order (descending)
|
|
18
18
|
* Default: false
|
|
19
19
|
*/
|
|
20
20
|
reversed?: boolean;
|
|
@@ -19,9 +19,11 @@ export default function Th(componentProps) {
|
|
|
19
19
|
|
|
20
20
|
const role = props.scope === 'row' ? 'rowheader' : 'columnheader';
|
|
21
21
|
const scope = props.scope === 'row' ? 'row' : 'col';
|
|
22
|
+
const ariaSort = sortable ? reversed ? 'descending' : 'ascending' : undefined;
|
|
22
23
|
return React.createElement("th", _extends({
|
|
23
24
|
role: role,
|
|
24
25
|
scope: scope,
|
|
26
|
+
"aria-sort": ariaSort,
|
|
25
27
|
className: classnames('dnb-table__th', className, sortable && 'dnb-table--sortable', active && 'dnb-table--active', reversed && 'dnb-table--reversed', noWrap && 'dnb-table--no-wrap')
|
|
26
28
|
}, props), children);
|
|
27
29
|
}
|
|
@@ -10,9 +10,36 @@ export declare type TableTrProps = {
|
|
|
10
10
|
* Default: false
|
|
11
11
|
*/
|
|
12
12
|
noWrap?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Set true to render the tr initially as expanded
|
|
15
|
+
* Default: false
|
|
16
|
+
*/
|
|
17
|
+
expanded?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Set true to disable the tr to be accessible as an interactive element
|
|
20
|
+
* Default: false
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Set to true to skip animation
|
|
25
|
+
* Default: false
|
|
26
|
+
*/
|
|
27
|
+
noAnimation?: boolean;
|
|
13
28
|
/**
|
|
14
29
|
* The content of the component.
|
|
15
30
|
*/
|
|
16
31
|
children: React.ReactElement<TableTdProps> | Array<React.ReactElement<TableTdProps>>;
|
|
17
32
|
};
|
|
18
33
|
export default function Tr(componentProps: TableTrProps & React.TableHTMLAttributes<HTMLTableRowElement>): JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* Handle odd/even on re-render and React.StrictMode
|
|
36
|
+
*/
|
|
37
|
+
export declare function useHandleOddEven({ children }: {
|
|
38
|
+
children: any;
|
|
39
|
+
}): {
|
|
40
|
+
trCountRef: React.MutableRefObject<{
|
|
41
|
+
count: number;
|
|
42
|
+
}>;
|
|
43
|
+
rerenderAlias: {};
|
|
44
|
+
setRerenderAlias: React.Dispatch<React.SetStateAction<{}>>;
|
|
45
|
+
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["variant", "noWrap", "children", "className"];
|
|
3
|
+
const _excluded = ["variant", "noWrap", "expanded", "disabled", "noAnimation", "children", "className"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
+
import { useTableAccordion } from './TableAccordion';
|
|
6
7
|
import TableContext from './TableContext';
|
|
7
8
|
export default function Tr(componentProps) {
|
|
8
9
|
const {
|
|
9
10
|
variant,
|
|
10
11
|
noWrap,
|
|
12
|
+
expanded,
|
|
13
|
+
disabled,
|
|
14
|
+
noAnimation,
|
|
11
15
|
children,
|
|
12
16
|
className: _className
|
|
13
17
|
} = componentProps,
|
|
@@ -19,6 +23,19 @@ export default function Tr(componentProps) {
|
|
|
19
23
|
variant
|
|
20
24
|
});
|
|
21
25
|
const className = classnames('dnb-table__tr', _className, currentVariant && `dnb-table__tr--${currentVariant}`, noWrap && 'dnb-table--no-wrap');
|
|
26
|
+
const accordionTr = useTableAccordion({
|
|
27
|
+
className,
|
|
28
|
+
children,
|
|
29
|
+
props,
|
|
30
|
+
expanded,
|
|
31
|
+
disabled,
|
|
32
|
+
noAnimation
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (accordionTr) {
|
|
36
|
+
return accordionTr;
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
return React.createElement("tr", _extends({
|
|
23
40
|
role: "row",
|
|
24
41
|
className: className
|
|
@@ -43,22 +60,14 @@ function useHandleTrVariant({
|
|
|
43
60
|
return countRef.count;
|
|
44
61
|
};
|
|
45
62
|
|
|
46
|
-
const
|
|
47
|
-
if (typeof
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!variant || variant === 'even' && countRef.count % 2 === 1 || variant === 'odd' && countRef.count % 2 === 0) {
|
|
52
|
-
countRef.count--;
|
|
53
|
-
tableContext === null || tableContext === void 0 ? void 0 : tableContext.forceRerender();
|
|
63
|
+
const [count, setCount] = React.useState(() => {
|
|
64
|
+
if (typeof window === 'undefined') {
|
|
65
|
+
return increment();
|
|
54
66
|
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const count = React.useMemo(increment, [tableContext === null || tableContext === void 0 ? void 0 : tableContext.rerenderAlias]);
|
|
58
|
-
React.useEffect(() => decrement, [tableContext === null || tableContext === void 0 ? void 0 : tableContext.trCountRef]);
|
|
67
|
+
});
|
|
59
68
|
React.useEffect(() => {
|
|
60
|
-
|
|
61
|
-
}, [
|
|
69
|
+
setCount(increment());
|
|
70
|
+
}, [tableContext === null || tableContext === void 0 ? void 0 : tableContext.rerenderAlias]);
|
|
62
71
|
let currentVariant = variant;
|
|
63
72
|
|
|
64
73
|
if (!currentVariant) {
|
|
@@ -68,4 +77,31 @@ function useHandleTrVariant({
|
|
|
68
77
|
return {
|
|
69
78
|
currentVariant
|
|
70
79
|
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function useHandleOddEven({
|
|
83
|
+
children
|
|
84
|
+
}) {
|
|
85
|
+
const trCountRef = React.useRef({
|
|
86
|
+
count: 0
|
|
87
|
+
});
|
|
88
|
+
const [rerenderAlias, setRerenderAlias] = React.useState({});
|
|
89
|
+
const isMounted = React.useRef(false);
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
if (isMounted.current) {
|
|
92
|
+
forceRerender();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
isMounted.current = true;
|
|
96
|
+
}, [children]);
|
|
97
|
+
return {
|
|
98
|
+
trCountRef,
|
|
99
|
+
rerenderAlias,
|
|
100
|
+
setRerenderAlias
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
function forceRerender() {
|
|
104
|
+
trCountRef.current.count = 0;
|
|
105
|
+
setRerenderAlias({});
|
|
106
|
+
}
|
|
71
107
|
}
|