carbon-react 118.1.0 → 118.2.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/esm/__internal__/filter-object-properties/filter-object-properties.d.ts +1 -1
- package/esm/__internal__/input/input-presentation.style.js +1 -0
- package/esm/__internal__/input/input.style.js +1 -0
- package/esm/components/action-popover/action-popover.style.js +3 -0
- package/esm/components/advanced-color-picker/advanced-color-picker-cell.style.js +1 -0
- package/esm/components/advanced-color-picker/advanced-color-picker.style.js +1 -0
- package/esm/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.style.js +6 -2
- package/esm/components/badge/badge.style.js +1 -1
- package/esm/components/batch-selection/batch-selection.style.js +6 -0
- package/esm/components/box/box.component.d.ts +3 -0
- package/esm/components/box/box.component.js +4 -0
- package/esm/components/button/button.style.js +10 -9
- package/esm/components/button-bar/button-bar.style.js +19 -0
- package/esm/components/button-minor/button-minor.style.js +42 -40
- package/esm/components/button-toggle/button-toggle.component.js +2 -1
- package/esm/components/button-toggle/button-toggle.style.d.ts +1 -0
- package/esm/components/button-toggle/button-toggle.style.js +31 -13
- package/esm/components/button-toggle-group/button-toggle-group.style.js +21 -3
- package/esm/components/card/__internal__/card-context/index.d.ts +7 -0
- package/esm/components/card/__internal__/card-context/index.js +2 -0
- package/esm/components/card/card-footer/card-footer.component.js +9 -2
- package/esm/components/card/card-footer/card-footer.style.d.ts +2 -1
- package/esm/components/card/card-footer/card-footer.style.js +10 -1
- package/esm/components/card/card.component.d.ts +3 -2
- package/esm/components/card/card.component.js +10 -1
- package/esm/components/card/card.style.d.ts +2 -1
- package/esm/components/card/card.style.js +3 -1
- package/esm/components/carousel/carousel.component.js +1 -1
- package/esm/components/carousel/carousel.style.js +4 -2
- package/esm/components/carousel/slide/slide.style.js +2 -0
- package/esm/components/checkbox/checkbox.style.js +2 -0
- package/esm/components/date/__internal__/date-picker/day-picker.style.js +4 -0
- package/esm/components/date/__internal__/navbar/button.style.js +2 -0
- package/esm/components/dialog/dialog.style.js +5 -0
- package/esm/components/dismissible-box/dismissible-box.component.d.ts +1 -1
- package/esm/components/dismissible-box/dismissible-box.component.js +4 -1
- package/esm/components/drawer/drawer.style.js +1 -0
- package/esm/components/duelling-picklist/picklist-item/picklist-item.style.js +20 -0
- package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +7 -0
- package/esm/components/flat-table/flat-table.component.js +56 -2
- package/esm/components/flat-table/flat-table.style.js +101 -1
- package/esm/components/flat-table/sort/sort.style.js +1 -0
- package/esm/components/icon-button/icon-button.style.js +1 -0
- package/esm/components/inline-inputs/inline-inputs.style.js +18 -0
- package/esm/components/link/link.style.js +1 -0
- package/esm/components/link-preview/__internal__/placeholder.component.d.ts +3 -1
- package/esm/components/link-preview/__internal__/placeholder.component.js +4 -1
- package/esm/components/link-preview/link-preview.style.js +1 -0
- package/esm/components/loader/loader-square.style.js +5 -0
- package/esm/components/loader-bar/loader-bar.style.js +1 -0
- package/esm/components/menu/__internal__/submenu/submenu.style.js +13 -0
- package/esm/components/menu/menu.style.js +13 -6
- package/esm/components/menu/scrollable-block/scrollable-block.style.js +15 -0
- package/esm/components/message/message.style.js +2 -0
- package/esm/components/multi-action-button/multi-action-button.style.js +4 -0
- package/esm/components/note/note.style.js +1 -0
- package/esm/components/numeral-date/numeral-date.component.js +2 -0
- package/esm/components/numeral-date/numeral-date.style.d.ts +1 -0
- package/esm/components/numeral-date/numeral-date.style.js +12 -0
- package/esm/components/pager/pager.component.js +5 -5
- package/esm/components/pager/pager.style.js +2 -0
- package/esm/components/pill/pill.component.d.ts +3 -1
- package/esm/components/pill/pill.component.js +1 -0
- package/esm/components/pill/pill.style.js +5 -15
- package/esm/components/pod/pod.style.js +6 -0
- package/esm/components/popover-container/popover-container.style.js +1 -0
- package/esm/components/portrait/portrait-gravatar.component.js +1 -1
- package/esm/components/portrait/portrait-initials.component.js +1 -1
- package/esm/components/portrait/portrait.component.js +1 -1
- package/esm/components/portrait/portrait.style.js +1 -3
- package/esm/components/profile/profile.component.js +1 -1
- package/esm/components/progress-tracker/progress-tracker.style.js +2 -2
- package/esm/components/radio-button/radio-button.style.js +1 -1
- package/esm/components/search/search-button.style.js +5 -0
- package/esm/components/search/search.style.js +7 -0
- package/esm/components/select/__internal__/select-list-context.d.ts +7 -0
- package/esm/components/select/__internal__/select-text/index.d.ts +2 -0
- package/esm/components/select/__internal__/select-text/index.js +1 -0
- package/esm/components/select/__internal__/select-text/select-text.component.d.ts +33 -0
- package/esm/components/select/__internal__/select-text/select-text.component.js +16 -36
- package/esm/components/select/__internal__/select-text/select-text.style.d.ts +6 -1
- package/esm/components/select/filterable-select/filterable-select.component.d.ts +65 -0
- package/esm/components/select/filterable-select/filterable-select.component.js +568 -102
- package/esm/components/select/filterable-select/index.d.ts +2 -1
- package/esm/components/select/filterable-select/index.js +1 -0
- package/esm/components/select/index.d.ts +6 -0
- package/esm/components/select/index.js +6 -6
- package/esm/components/select/list-action-button/index.d.ts +2 -0
- package/esm/components/select/list-action-button/index.js +1 -0
- package/esm/components/select/list-action-button/list-action-button.component.d.ts +7 -0
- package/esm/components/select/list-action-button/list-action-button.component.js +9 -6
- package/esm/components/select/list-action-button/list-action-button.style.d.ts +2 -0
- package/esm/components/select/multi-select/index.d.ts +2 -1
- package/esm/components/select/multi-select/index.js +1 -0
- package/esm/components/select/multi-select/multi-select.component.d.ts +62 -0
- package/esm/components/select/multi-select/multi-select.component.js +575 -104
- package/esm/components/select/multi-select/multi-select.style.d.ts +4 -0
- package/esm/components/select/multi-select/multi-select.style.js +1 -0
- package/esm/components/select/option/index.d.ts +2 -25
- package/esm/components/select/option/index.js +1 -0
- package/esm/components/select/option/option.component.d.ts +34 -0
- package/esm/components/select/option/option.component.js +399 -62
- package/esm/components/select/option/option.style.d.ts +6 -0
- package/esm/components/select/option/option.style.js +0 -5
- package/esm/components/select/option-group-header/index.d.ts +2 -10
- package/esm/components/select/option-group-header/index.js +1 -0
- package/esm/components/select/option-group-header/option-group-header.component.d.ts +16 -0
- package/esm/components/select/option-group-header/option-group-header.component.js +4 -15
- package/esm/components/select/option-group-header/option-group-header.style.d.ts +2 -0
- package/esm/components/select/option-row/index.d.ts +2 -16
- package/esm/components/select/option-row/index.js +1 -0
- package/esm/components/select/option-row/option-row.component.d.ts +42 -0
- package/esm/components/select/option-row/option-row.component.js +10 -40
- package/esm/components/select/option-row/option-row.style.d.ts +6 -0
- package/esm/components/select/select-list/index.d.ts +2 -0
- package/esm/components/select/select-list/index.js +1 -0
- package/esm/components/select/select-list/select-list-container.style.d.ts +6 -0
- package/esm/components/select/select-list/select-list-container.style.js +1 -0
- package/esm/components/select/select-list/select-list.component.d.ts +64 -0
- package/esm/components/select/select-list/select-list.component.js +69 -100
- package/esm/components/select/select-list/select-list.style.d.ts +12 -0
- package/esm/components/select/select-list/select-list.style.js +2 -2
- package/esm/components/select/select-textbox/index.d.ts +2 -1
- package/esm/components/select/select-textbox/index.js +1 -0
- package/esm/components/select/select-textbox/select-textbox.component.d.ts +81 -0
- package/esm/components/select/select-textbox/select-textbox.component.js +567 -142
- package/esm/components/select/select.style.d.ts +8 -0
- package/esm/components/select/simple-select/index.d.ts +2 -1
- package/esm/components/select/simple-select/index.js +1 -0
- package/esm/components/select/simple-select/simple-select.component.d.ts +58 -0
- package/esm/components/select/simple-select/simple-select.component.js +578 -111
- package/esm/components/select/utils/get-next-child-by-text.d.ts +5 -0
- package/esm/components/select/utils/get-next-child-by-text.js +20 -17
- package/esm/components/select/utils/get-next-index-by-key.d.ts +2 -0
- package/esm/components/select/utils/highlight-part-of-text.d.ts +2 -0
- package/esm/components/select/utils/highlight-part-of-text.js +10 -3
- package/esm/components/select/utils/is-expected-option.d.ts +2 -0
- package/esm/components/select/utils/is-expected-option.js +1 -1
- package/esm/components/select/utils/is-expected-value.d.ts +1 -0
- package/esm/components/select/utils/is-expected-value.js +1 -1
- package/esm/components/select/utils/is-navigation-key.d.ts +1 -0
- package/esm/components/select/utils/matching-text.style.d.ts +2 -0
- package/esm/components/select/utils/with-filter.hoc.d.ts +14 -0
- package/esm/components/select/utils/with-filter.hoc.js +59 -41
- package/esm/components/split-button/split-button-children.style.d.ts +1 -0
- package/esm/components/split-button/split-button-children.style.js +28 -0
- package/esm/components/split-button/split-button-toggle.style.js +6 -1
- package/esm/components/split-button/split-button.style.js +5 -2
- package/esm/components/switch/__internal__/switch-slider.style.js +1 -2
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.js +1 -0
- package/esm/components/tabs/__internal__/tab-title/tab-title.style.js +22 -2
- package/esm/components/tabs/__internal__/tabs-header/tabs-header.style.js +5 -0
- package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.js +3 -0
- package/esm/components/text-editor/text-editor.style.js +3 -0
- package/esm/components/tile/tile.component.d.ts +3 -1
- package/esm/components/tile/tile.component.js +3 -1
- package/esm/components/tile/tile.style.d.ts +1 -1
- package/esm/components/tile/tile.style.js +4 -1
- package/esm/components/tile-select/tile-select.style.d.ts +1 -0
- package/esm/components/tile-select/tile-select.style.js +8 -0
- package/esm/components/tooltip/tooltip.style.js +1 -0
- package/esm/components/vertical-menu/vertical-menu.style.js +1 -0
- package/lib/__internal__/filter-object-properties/filter-object-properties.d.ts +1 -1
- package/lib/__internal__/input/input-presentation.style.js +1 -0
- package/lib/__internal__/input/input.style.js +1 -0
- package/lib/components/action-popover/action-popover.style.js +3 -0
- package/lib/components/advanced-color-picker/advanced-color-picker-cell.style.js +1 -0
- package/lib/components/advanced-color-picker/advanced-color-picker.style.js +1 -0
- package/lib/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.style.js +6 -2
- package/lib/components/badge/badge.style.js +1 -1
- package/lib/components/batch-selection/batch-selection.style.js +6 -0
- package/lib/components/box/box.component.d.ts +3 -0
- package/lib/components/box/box.component.js +4 -0
- package/lib/components/button/button.style.js +10 -9
- package/lib/components/button-bar/button-bar.style.js +19 -0
- package/lib/components/button-minor/button-minor.style.js +42 -40
- package/lib/components/button-toggle/button-toggle.component.js +2 -1
- package/lib/components/button-toggle/button-toggle.style.d.ts +1 -0
- package/lib/components/button-toggle/button-toggle.style.js +31 -13
- package/lib/components/button-toggle-group/button-toggle-group.style.js +21 -3
- package/lib/components/card/__internal__/card-context/index.d.ts +7 -0
- package/lib/components/card/__internal__/card-context/index.js +14 -0
- package/lib/components/card/__internal__/card-context/package.json +6 -0
- package/lib/components/card/card-footer/card-footer.component.js +14 -2
- package/lib/components/card/card-footer/card-footer.style.d.ts +2 -1
- package/lib/components/card/card-footer/card-footer.style.js +10 -1
- package/lib/components/card/card.component.d.ts +3 -2
- package/lib/components/card/card.component.js +11 -1
- package/lib/components/card/card.style.d.ts +2 -1
- package/lib/components/card/card.style.js +3 -1
- package/lib/components/carousel/carousel.component.js +1 -1
- package/lib/components/carousel/carousel.style.js +4 -2
- package/lib/components/carousel/slide/slide.style.js +2 -0
- package/lib/components/checkbox/checkbox.style.js +2 -0
- package/lib/components/date/__internal__/date-picker/day-picker.style.js +4 -0
- package/lib/components/date/__internal__/navbar/button.style.js +2 -0
- package/lib/components/dialog/dialog.style.js +5 -0
- package/lib/components/dismissible-box/dismissible-box.component.d.ts +1 -1
- package/lib/components/dismissible-box/dismissible-box.component.js +4 -1
- package/lib/components/drawer/drawer.style.js +1 -0
- package/lib/components/duelling-picklist/picklist-item/picklist-item.style.js +20 -0
- package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +7 -0
- package/lib/components/flat-table/flat-table.component.js +60 -2
- package/lib/components/flat-table/flat-table.style.js +102 -1
- package/lib/components/flat-table/sort/sort.style.js +1 -0
- package/lib/components/icon-button/icon-button.style.js +1 -0
- package/lib/components/inline-inputs/inline-inputs.style.js +18 -0
- package/lib/components/link/link.style.js +1 -0
- package/lib/components/link-preview/__internal__/placeholder.component.d.ts +3 -1
- package/lib/components/link-preview/__internal__/placeholder.component.js +6 -1
- package/lib/components/link-preview/link-preview.style.js +1 -0
- package/lib/components/loader/loader-square.style.js +5 -0
- package/lib/components/loader-bar/loader-bar.style.js +1 -0
- package/lib/components/menu/__internal__/submenu/submenu.style.js +13 -0
- package/lib/components/menu/menu.style.js +13 -6
- package/lib/components/menu/scrollable-block/scrollable-block.style.js +18 -0
- package/lib/components/message/message.style.js +2 -0
- package/lib/components/multi-action-button/multi-action-button.style.js +5 -0
- package/lib/components/note/note.style.js +1 -0
- package/lib/components/numeral-date/numeral-date.component.js +2 -0
- package/lib/components/numeral-date/numeral-date.style.d.ts +1 -0
- package/lib/components/numeral-date/numeral-date.style.js +12 -0
- package/lib/components/pager/pager.component.js +5 -5
- package/lib/components/pager/pager.style.js +2 -0
- package/lib/components/pill/pill.component.d.ts +3 -1
- package/lib/components/pill/pill.component.js +1 -0
- package/lib/components/pill/pill.style.js +5 -15
- package/lib/components/pod/pod.style.js +6 -0
- package/lib/components/popover-container/popover-container.style.js +1 -0
- package/lib/components/portrait/portrait-gravatar.component.js +1 -1
- package/lib/components/portrait/portrait-initials.component.js +1 -1
- package/lib/components/portrait/portrait.component.js +1 -1
- package/lib/components/portrait/portrait.style.js +1 -3
- package/lib/components/profile/profile.component.js +1 -1
- package/lib/components/progress-tracker/progress-tracker.style.js +2 -2
- package/lib/components/radio-button/radio-button.style.js +1 -1
- package/lib/components/search/search-button.style.js +5 -0
- package/lib/components/search/search.style.js +7 -0
- package/lib/components/select/__internal__/select-list-context.d.ts +7 -0
- package/lib/components/select/__internal__/select-text/index.d.ts +2 -0
- package/lib/components/select/__internal__/select-text/index.js +15 -0
- package/lib/components/select/__internal__/select-text/package.json +6 -0
- package/lib/components/select/__internal__/select-text/select-text.component.d.ts +33 -0
- package/lib/components/select/__internal__/select-text/select-text.component.js +16 -36
- package/lib/components/select/__internal__/select-text/select-text.style.d.ts +6 -1
- package/lib/components/select/filterable-select/filterable-select.component.d.ts +65 -0
- package/lib/components/select/filterable-select/filterable-select.component.js +569 -103
- package/lib/components/select/filterable-select/index.d.ts +2 -1
- package/lib/components/select/filterable-select/index.js +15 -0
- package/lib/components/select/filterable-select/package.json +6 -0
- package/lib/components/select/index.d.ts +6 -0
- package/lib/components/select/index.js +6 -6
- package/lib/components/select/list-action-button/index.d.ts +2 -0
- package/lib/components/select/list-action-button/index.js +15 -0
- package/lib/components/select/list-action-button/list-action-button.component.d.ts +7 -0
- package/lib/components/select/list-action-button/list-action-button.component.js +9 -6
- package/lib/components/select/list-action-button/list-action-button.style.d.ts +2 -0
- package/lib/components/select/list-action-button/package.json +6 -0
- package/lib/components/select/multi-select/index.d.ts +2 -1
- package/lib/components/select/multi-select/index.js +15 -0
- package/lib/components/select/multi-select/multi-select.component.d.ts +62 -0
- package/lib/components/select/multi-select/multi-select.component.js +576 -105
- package/lib/components/select/multi-select/multi-select.style.d.ts +4 -0
- package/lib/components/select/multi-select/multi-select.style.js +1 -0
- package/lib/components/select/multi-select/package.json +6 -0
- package/lib/components/select/option/index.d.ts +2 -25
- package/lib/components/select/option/index.js +15 -0
- package/lib/components/select/option/option.component.d.ts +34 -0
- package/lib/components/select/option/option.component.js +399 -62
- package/lib/components/select/option/option.style.d.ts +6 -0
- package/lib/components/select/option/option.style.js +0 -8
- package/lib/components/select/option/package.json +6 -0
- package/lib/components/select/option-group-header/index.d.ts +2 -10
- package/lib/components/select/option-group-header/index.js +15 -0
- package/lib/components/select/option-group-header/option-group-header.component.d.ts +16 -0
- package/lib/components/select/option-group-header/option-group-header.component.js +4 -15
- package/lib/components/select/option-group-header/option-group-header.style.d.ts +2 -0
- package/lib/components/select/option-group-header/package.json +6 -0
- package/lib/components/select/option-row/index.d.ts +2 -16
- package/lib/components/select/option-row/index.js +15 -0
- package/lib/components/select/option-row/option-row.component.d.ts +42 -0
- package/lib/components/select/option-row/option-row.component.js +10 -40
- package/lib/components/select/option-row/option-row.style.d.ts +6 -0
- package/lib/components/select/option-row/package.json +6 -0
- package/lib/components/select/select-list/index.d.ts +2 -0
- package/lib/components/select/select-list/index.js +15 -0
- package/lib/components/select/select-list/package.json +6 -0
- package/lib/components/select/select-list/select-list-container.style.d.ts +6 -0
- package/lib/components/select/select-list/select-list-container.style.js +1 -0
- package/lib/components/select/select-list/select-list.component.d.ts +64 -0
- package/lib/components/select/select-list/select-list.component.js +69 -100
- package/lib/components/select/select-list/select-list.style.d.ts +12 -0
- package/lib/components/select/select-list/select-list.style.js +2 -2
- package/lib/components/select/select-textbox/index.d.ts +2 -1
- package/lib/components/select/select-textbox/index.js +15 -0
- package/lib/components/select/select-textbox/package.json +6 -0
- package/lib/components/select/select-textbox/select-textbox.component.d.ts +81 -0
- package/lib/components/select/select-textbox/select-textbox.component.js +567 -142
- package/lib/components/select/select.style.d.ts +8 -0
- package/lib/components/select/simple-select/index.d.ts +2 -1
- package/lib/components/select/simple-select/index.js +15 -0
- package/lib/components/select/simple-select/package.json +6 -0
- package/lib/components/select/simple-select/simple-select.component.d.ts +58 -0
- package/lib/components/select/simple-select/simple-select.component.js +579 -113
- package/lib/components/select/utils/get-next-child-by-text.d.ts +5 -0
- package/lib/components/select/utils/get-next-child-by-text.js +20 -17
- package/lib/components/select/utils/get-next-index-by-key.d.ts +2 -0
- package/lib/components/select/utils/highlight-part-of-text.d.ts +2 -0
- package/lib/components/select/utils/highlight-part-of-text.js +10 -3
- package/lib/components/select/utils/is-expected-option.d.ts +2 -0
- package/lib/components/select/utils/is-expected-option.js +1 -1
- package/lib/components/select/utils/is-expected-value.d.ts +1 -0
- package/lib/components/select/utils/is-expected-value.js +1 -1
- package/lib/components/select/utils/is-navigation-key.d.ts +1 -0
- package/lib/components/select/utils/matching-text.style.d.ts +2 -0
- package/lib/components/select/utils/with-filter.hoc.d.ts +14 -0
- package/lib/components/select/utils/with-filter.hoc.js +59 -42
- package/lib/components/split-button/split-button-children.style.d.ts +1 -0
- package/lib/components/split-button/split-button-children.style.js +30 -1
- package/lib/components/split-button/split-button-toggle.style.js +6 -1
- package/lib/components/split-button/split-button.style.js +5 -2
- package/lib/components/switch/__internal__/switch-slider.style.js +1 -2
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +1 -0
- package/lib/components/tabs/__internal__/tab-title/tab-title.style.js +22 -2
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.style.js +5 -0
- package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.js +3 -0
- package/lib/components/text-editor/text-editor.style.js +3 -0
- package/lib/components/tile/tile.component.d.ts +3 -1
- package/lib/components/tile/tile.component.js +3 -1
- package/lib/components/tile/tile.style.d.ts +1 -1
- package/lib/components/tile/tile.style.js +4 -1
- package/lib/components/tile-select/tile-select.style.d.ts +1 -0
- package/lib/components/tile-select/tile-select.style.js +8 -0
- package/lib/components/tooltip/tooltip.style.js +1 -0
- package/lib/components/vertical-menu/vertical-menu.style.js +1 -0
- package/package.json +1 -1
- package/esm/components/select/__internal__/select-text/select-text.d.ts +0 -36
- package/esm/components/select/filterable-select/filterable-select.d.ts +0 -71
- package/esm/components/select/multi-select/multi-select.d.ts +0 -68
- package/esm/components/select/select-textbox/select-textbox.d.ts +0 -72
- package/esm/components/select/simple-select/simple-select.d.ts +0 -64
- package/lib/components/select/__internal__/select-text/select-text.d.ts +0 -36
- package/lib/components/select/filterable-select/filterable-select.d.ts +0 -71
- package/lib/components/select/multi-select/multi-select.d.ts +0 -68
- package/lib/components/select/select-textbox/select-textbox.d.ts +0 -72
- package/lib/components/select/simple-select/simple-select.d.ts +0 -64
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface OptionRowProps {
|
|
4
|
-
/** The option's visible text, displayed within <Textbox> of <Select> */
|
|
5
|
-
text: string;
|
|
6
|
-
/** Row content, should consist of multiple td elements */
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
/** The option's invisible internal value */
|
|
9
|
-
value: string | Record<string, unknown>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare function OptionRow(
|
|
13
|
-
props: OptionRowProps & React.RefAttributes<HTMLTableRowElement>
|
|
14
|
-
): JSX.Element;
|
|
15
|
-
|
|
16
|
-
export default OptionRow;
|
|
1
|
+
export { default } from "./option-row.component";
|
|
2
|
+
export type { OptionRowProps } from "./option-row.component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./option-row.component";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CSSProperties } from "styled-components";
|
|
3
|
+
export interface OptionRowProps {
|
|
4
|
+
/** The option's visible text, displayed within <Textbox> of <Select> */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Row content, should consist of multiple td elements */
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/** The option's invisible internal value */
|
|
9
|
+
value: string | Record<string, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
* @ignore
|
|
13
|
+
* Component id (prop added by the SelectList component)
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* @private
|
|
18
|
+
* @ignore
|
|
19
|
+
* Callback to return value when the element is selected (prop added by the SelectList component) */
|
|
20
|
+
onSelect?: (ev: {
|
|
21
|
+
id: string;
|
|
22
|
+
text: string;
|
|
23
|
+
value: string | Record<string, unknown>;
|
|
24
|
+
}) => void;
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* @ignore
|
|
28
|
+
* Position of the element in the list */
|
|
29
|
+
index?: number;
|
|
30
|
+
/**
|
|
31
|
+
* @private
|
|
32
|
+
* @ignore
|
|
33
|
+
* True when option should be hidden from the view (prop added by the SelectList component) */
|
|
34
|
+
hidden?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* @private
|
|
37
|
+
* @ignore
|
|
38
|
+
* object containing CSS styles to be passed to the underlying DOM element */
|
|
39
|
+
style?: CSSProperties;
|
|
40
|
+
}
|
|
41
|
+
declare const OptionRow: React.ForwardRefExoticComponent<OptionRowProps & React.RefAttributes<HTMLTableRowElement>>;
|
|
42
|
+
export default OptionRow;
|
|
@@ -16,7 +16,7 @@ const OptionRow = /*#__PURE__*/React.forwardRef(({
|
|
|
16
16
|
...rest
|
|
17
17
|
}, ref) => {
|
|
18
18
|
const handleClick = () => {
|
|
19
|
-
onSelect({
|
|
19
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect({
|
|
20
20
|
id,
|
|
21
21
|
text,
|
|
22
22
|
value
|
|
@@ -43,44 +43,14 @@ const OptionRow = /*#__PURE__*/React.forwardRef(({
|
|
|
43
43
|
}, rest), children);
|
|
44
44
|
});
|
|
45
45
|
OptionRow.propTypes = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
value: PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @private
|
|
57
|
-
* @ignore
|
|
58
|
-
* Component id (prop added by the SelectList component)
|
|
59
|
-
*/
|
|
60
|
-
id: PropTypes.string.isRequired,
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @private
|
|
64
|
-
* @ignore
|
|
65
|
-
* Callback to return value when the element is selected (prop added by the SelectList component) */
|
|
66
|
-
onSelect: PropTypes.func,
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @private
|
|
70
|
-
* @ignore
|
|
71
|
-
* Position of the element in the list */
|
|
72
|
-
index: PropTypes.number,
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @private
|
|
76
|
-
* @ignore
|
|
77
|
-
* True when option should be hidden from the view (prop added by the SelectList component) */
|
|
78
|
-
hidden: PropTypes.bool,
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @private
|
|
82
|
-
* @ignore
|
|
83
|
-
* object containing CSS styles to be passed to the underlying DOM element */
|
|
84
|
-
style: PropTypes.object
|
|
46
|
+
"children": PropTypes.node,
|
|
47
|
+
"hidden": PropTypes.bool,
|
|
48
|
+
"id": PropTypes.string.isRequired,
|
|
49
|
+
"index": PropTypes.number,
|
|
50
|
+
"onSelect": PropTypes.func,
|
|
51
|
+
"style": PropTypes.object,
|
|
52
|
+
"text": PropTypes.string.isRequired,
|
|
53
|
+
"value": PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired
|
|
85
54
|
};
|
|
55
|
+
OptionRow.displayName = "OptionRow";
|
|
86
56
|
export default OptionRow;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OptionRowProps } from ".";
|
|
2
|
+
interface StyledOptionRowProps extends Pick<OptionRowProps, "hidden"> {
|
|
3
|
+
isHighlighted?: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const StyledOptionRow: import("styled-components").StyledComponent<"tr", any, StyledOptionRowProps, never>;
|
|
6
|
+
export default StyledOptionRow;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./select-list.component";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SelectListProps } from ".";
|
|
2
|
+
interface StyledSelectListContainerProps extends Pick<SelectListProps, "isLoading"> {
|
|
3
|
+
maxHeight: number;
|
|
4
|
+
}
|
|
5
|
+
declare const StyledSelectListContainer: import("styled-components").StyledComponent<"div", any, StyledSelectListContainerProps, never>;
|
|
6
|
+
export default StyledSelectListContainer;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Side } from "@floating-ui/dom";
|
|
3
|
+
export interface SelectListProps {
|
|
4
|
+
/** The ID for the parent <div> */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** The Id of the label */
|
|
7
|
+
labelId?: string;
|
|
8
|
+
/** Child components (such as <Option>) */
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
/** Boolean to toggle where DatePicker is rendered in relation to the Date Input */
|
|
11
|
+
disablePortal?: boolean;
|
|
12
|
+
/** DOM element to position the dropdown menu list relative to */
|
|
13
|
+
anchorElement?: HTMLElement;
|
|
14
|
+
/** A callback for when a child is selected */
|
|
15
|
+
onSelect: (target: {
|
|
16
|
+
text?: string;
|
|
17
|
+
value?: string | Record<string, unknown>;
|
|
18
|
+
id?: string;
|
|
19
|
+
selectionType: string;
|
|
20
|
+
}) => void;
|
|
21
|
+
/** A callback for when the list should be closed */
|
|
22
|
+
onSelectListClose: () => void;
|
|
23
|
+
/** Text value to highlight an option */
|
|
24
|
+
filterText?: string;
|
|
25
|
+
/** Value of option to be highlighted on component render */
|
|
26
|
+
highlightedValue?: string | Record<string, unknown>;
|
|
27
|
+
/** True for default text button or a Button Component to be rendered */
|
|
28
|
+
listActionButton?: boolean | React.ReactNode;
|
|
29
|
+
/** Maximum list height - defaults to 180 */
|
|
30
|
+
listMaxHeight?: number;
|
|
31
|
+
/** A callback for when the Action Button is triggered */
|
|
32
|
+
onListAction?: (ev?: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
33
|
+
/** If true the loader animation is displayed below the last option */
|
|
34
|
+
isLoading?: boolean;
|
|
35
|
+
/** A callback that is triggered when a user scrolls to the bottom of the list */
|
|
36
|
+
onListScrollBottom?: () => void;
|
|
37
|
+
/** SelectList table header, should consist of multiple th elements. Works only in multiColumn mode */
|
|
38
|
+
tableHeader?: React.ReactNode;
|
|
39
|
+
/** When true component will work in multi column mode, children should consist of OptionRow components in this mode */
|
|
40
|
+
multiColumn?: boolean;
|
|
41
|
+
/** Data role for loader component */
|
|
42
|
+
loaderDataRole?: string;
|
|
43
|
+
/** Placement of the select list relative to the input element */
|
|
44
|
+
listPlacement?: Side;
|
|
45
|
+
/** Use the opposite list placement if the set placement does not fit */
|
|
46
|
+
flipEnabled?: boolean;
|
|
47
|
+
/** @private @ignore
|
|
48
|
+
* Hides the list (with CSS display: none) if not set
|
|
49
|
+
*/
|
|
50
|
+
isOpen?: boolean;
|
|
51
|
+
/** array of selected values, if rendered as part of a MultiSelect */
|
|
52
|
+
multiselectValues?: string[] | Record<string, unknown>[];
|
|
53
|
+
/** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
|
|
54
|
+
* DOM at all times, which may cause performance problems on very large lists */
|
|
55
|
+
enableVirtualScroll?: boolean;
|
|
56
|
+
/** The number of options to render into the DOM at once, either side of the currently-visible ones.
|
|
57
|
+
* Higher values make for smoother scrolling but may impact performance.
|
|
58
|
+
* Only used if the `enableVirtualScroll` prop is set. */
|
|
59
|
+
virtualScrollOverscan?: number;
|
|
60
|
+
/** @private @ignore A callback for when a mouseDown event occurs on the component */
|
|
61
|
+
onMouseDown?: () => void;
|
|
62
|
+
}
|
|
63
|
+
declare const SelectList: React.ForwardRefExoticComponent<SelectListProps & React.RefAttributes<HTMLDivElement>>;
|
|
64
|
+
export default SelectList;
|
|
@@ -13,15 +13,15 @@ import OptionRow from "../option-row/option-row.component";
|
|
|
13
13
|
import getNextChildByText from "../utils/get-next-child-by-text";
|
|
14
14
|
import getNextIndexByKey from "../utils/get-next-index-by-key";
|
|
15
15
|
import isNavigationKey from "../utils/is-navigation-key";
|
|
16
|
-
import ListActionButton from "../list-action-button
|
|
16
|
+
import ListActionButton from "../list-action-button";
|
|
17
17
|
import StyledSelectListContainer from "./select-list-container.style";
|
|
18
18
|
import Loader from "../../loader";
|
|
19
|
-
import Option from "../option
|
|
19
|
+
import Option from "../option";
|
|
20
20
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
21
21
|
import SelectListContext from "../__internal__/select-list-context";
|
|
22
22
|
const TABLE_HEADER_HEIGHT = 48;
|
|
23
23
|
const SCROLL_OPTIONS = {
|
|
24
|
-
|
|
24
|
+
behavior: "auto",
|
|
25
25
|
align: "end"
|
|
26
26
|
};
|
|
27
27
|
const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
@@ -55,9 +55,9 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
55
55
|
const [currentOptionsListIndex, setCurrentOptionsListIndex] = useState(-1);
|
|
56
56
|
const [scrollbarWidth, setScrollbarWidth] = useState(0);
|
|
57
57
|
const lastFilter = useRef("");
|
|
58
|
-
const listRef = useRef();
|
|
59
|
-
const tableRef = useRef();
|
|
60
|
-
const listActionButtonRef = useRef();
|
|
58
|
+
const listRef = useRef(null);
|
|
59
|
+
const tableRef = useRef(null);
|
|
60
|
+
const listActionButtonRef = useRef(null);
|
|
61
61
|
const {
|
|
62
62
|
blockScroll,
|
|
63
63
|
allowScroll
|
|
@@ -88,11 +88,13 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
88
88
|
}, [allowScroll, blockScroll, isOpen]);
|
|
89
89
|
useLayoutEffect(() => {
|
|
90
90
|
if (multiColumn) {
|
|
91
|
-
setScrollbarWidth(tableRef.current.offsetWidth - tableRef.current.clientWidth
|
|
91
|
+
setScrollbarWidth(tableRef.current ? tableRef.current.offsetWidth - tableRef.current.clientWidth :
|
|
92
|
+
/* istanbul ignore next */
|
|
93
|
+
0);
|
|
92
94
|
}
|
|
93
95
|
}, [multiColumn]);
|
|
94
96
|
const anchorRef = useMemo(() => ({
|
|
95
|
-
current: anchorElement
|
|
97
|
+
current: anchorElement || null
|
|
96
98
|
}), [anchorElement]);
|
|
97
99
|
const handleSelect = useCallback(optionData => {
|
|
98
100
|
onSelect({ ...optionData,
|
|
@@ -103,7 +105,9 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
103
105
|
// as that isn't absolutely guaranteed to never rerun when dependencies haven't changed.
|
|
104
106
|
|
|
105
107
|
const setChildIds = () => {
|
|
106
|
-
childIdsRef.current = React.Children.map(children, () => guid())
|
|
108
|
+
childIdsRef.current = React.Children.map(children, () => guid()) ||
|
|
109
|
+
/* istanbul ignore next */
|
|
110
|
+
null;
|
|
107
111
|
};
|
|
108
112
|
|
|
109
113
|
if (((_childIdsRef$current = childIdsRef.current) === null || _childIdsRef$current === void 0 ? void 0 : _childIdsRef$current.length) !== React.Children.count(children)) {
|
|
@@ -112,7 +116,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
112
116
|
|
|
113
117
|
const childIds = childIdsRef.current;
|
|
114
118
|
const childrenList = useMemo(() => React.Children.toArray(children), [children]);
|
|
115
|
-
const optionChildrenList = useMemo(() => childrenList.filter(child => child.type === Option || child.type === OptionRow), [childrenList]);
|
|
119
|
+
const optionChildrenList = useMemo(() => childrenList.filter(child => /*#__PURE__*/React.isValidElement(child) && (child.type === Option || child.type === OptionRow)), [childrenList]);
|
|
116
120
|
const {
|
|
117
121
|
measureElement
|
|
118
122
|
} = virtualizer;
|
|
@@ -131,7 +135,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
131
135
|
} = item;
|
|
132
136
|
const child = childrenList[index];
|
|
133
137
|
|
|
134
|
-
if (!child) {
|
|
138
|
+
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
135
139
|
return child;
|
|
136
140
|
}
|
|
137
141
|
|
|
@@ -139,7 +143,9 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
139
143
|
const isOption = optionChildIndex > -1;
|
|
140
144
|
const newProps = {
|
|
141
145
|
index,
|
|
142
|
-
id: childIds[index]
|
|
146
|
+
id: childIds ? childIds[index] :
|
|
147
|
+
/* istanbul ignore next */
|
|
148
|
+
undefined,
|
|
143
149
|
onSelect: handleSelect,
|
|
144
150
|
hidden: isLoading && childrenList.length === 1,
|
|
145
151
|
// these need to be inline styles rather than implemented in styled-components to avoid it generating thousands of classes
|
|
@@ -154,20 +160,20 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
154
160
|
};
|
|
155
161
|
return /*#__PURE__*/React.cloneElement(child, newProps);
|
|
156
162
|
});
|
|
157
|
-
const lastOptionIndex = findLastIndex(childrenList, child => child.type === Option || child.type === OptionRow);
|
|
163
|
+
const lastOptionIndex = findLastIndex(childrenList, child => /*#__PURE__*/React.isValidElement(child) && (child.type === Option || child.type === OptionRow));
|
|
158
164
|
const getNextHighlightableItemIndex = useCallback((key, indexOfHighlighted) => {
|
|
159
165
|
const lastIndex = lastOptionIndex;
|
|
160
166
|
let nextIndex = getNextIndexByKey(key, indexOfHighlighted, lastIndex, isLoading);
|
|
161
167
|
const nextElement = childrenList[nextIndex];
|
|
162
168
|
|
|
163
|
-
if (nextElement && nextElement.type !== Option && nextElement.type !== OptionRow) {
|
|
164
|
-
nextIndex = getNextHighlightableItemIndex(key, nextIndex
|
|
169
|
+
if ( /*#__PURE__*/React.isValidElement(nextElement) && nextElement.type !== Option && nextElement.type !== OptionRow) {
|
|
170
|
+
nextIndex = getNextHighlightableItemIndex(key, nextIndex);
|
|
165
171
|
}
|
|
166
172
|
|
|
167
173
|
return nextIndex;
|
|
168
174
|
}, [childrenList, lastOptionIndex, isLoading]);
|
|
169
175
|
const getIndexOfMatch = useCallback(valueToMatch => {
|
|
170
|
-
return childrenList.findIndex(child => child.props.value === valueToMatch);
|
|
176
|
+
return childrenList.findIndex(child => /*#__PURE__*/React.isValidElement(child) && child.props.value === valueToMatch);
|
|
171
177
|
}, [childrenList]);
|
|
172
178
|
const highlightNextItem = useCallback(key => {
|
|
173
179
|
let currentIndex = currentOptionsListIndex;
|
|
@@ -191,7 +197,9 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
191
197
|
text,
|
|
192
198
|
value,
|
|
193
199
|
selectionType: "navigationKey",
|
|
194
|
-
id: childIds[nextIndex]
|
|
200
|
+
id: childIds ? childIds[nextIndex] :
|
|
201
|
+
/* istanbul ignore next */
|
|
202
|
+
undefined
|
|
195
203
|
});
|
|
196
204
|
}, [childrenList, currentOptionsListIndex, getIndexOfMatch, getNextHighlightableItemIndex, highlightedValue, onSelect, childIds]);
|
|
197
205
|
const handleActionButtonTab = useCallback((event, isActionButtonFocused) => {
|
|
@@ -200,8 +208,10 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
200
208
|
selectionType: "tab"
|
|
201
209
|
});
|
|
202
210
|
} else {
|
|
211
|
+
var _listActionButtonRef$;
|
|
212
|
+
|
|
203
213
|
event.preventDefault();
|
|
204
|
-
listActionButtonRef.current
|
|
214
|
+
(_listActionButtonRef$ = listActionButtonRef.current) === null || _listActionButtonRef$ === void 0 ? void 0 : _listActionButtonRef$.focus();
|
|
205
215
|
}
|
|
206
216
|
}, [onSelect]);
|
|
207
217
|
const focusOnAnchor = useCallback(() => {
|
|
@@ -227,7 +237,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
227
237
|
event.preventDefault();
|
|
228
238
|
const currentOption = childrenList[currentOptionsListIndex];
|
|
229
239
|
|
|
230
|
-
if (!currentOption) {
|
|
240
|
+
if (! /*#__PURE__*/React.isValidElement(currentOption)) {
|
|
231
241
|
onSelectListClose();
|
|
232
242
|
return;
|
|
233
243
|
}
|
|
@@ -237,7 +247,9 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
237
247
|
value
|
|
238
248
|
} = currentOption.props;
|
|
239
249
|
onSelect({
|
|
240
|
-
id: childIds[currentOptionsListIndex]
|
|
250
|
+
id: childIds ? childIds[currentOptionsListIndex] :
|
|
251
|
+
/* istanbul ignore next */
|
|
252
|
+
undefined,
|
|
241
253
|
text,
|
|
242
254
|
value,
|
|
243
255
|
selectionType: "enterKey"
|
|
@@ -253,7 +265,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
253
265
|
}
|
|
254
266
|
}, [onSelectListClose]);
|
|
255
267
|
useModalManager({
|
|
256
|
-
open: isOpen,
|
|
268
|
+
open: !!isOpen,
|
|
257
269
|
closeModal: handleEscapeKey,
|
|
258
270
|
modalRef: listRef,
|
|
259
271
|
triggerRefocusOnClose: false
|
|
@@ -270,15 +282,15 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
270
282
|
const keyboardEvent = "keydown";
|
|
271
283
|
const listElement = listContainerRef.current;
|
|
272
284
|
window.addEventListener(keyboardEvent, handleGlobalKeydown);
|
|
273
|
-
listElement.addEventListener("scroll", handleListScroll);
|
|
285
|
+
listElement === null || listElement === void 0 ? void 0 : listElement.addEventListener("scroll", handleListScroll);
|
|
274
286
|
return function cleanup() {
|
|
275
287
|
window.removeEventListener(keyboardEvent, handleGlobalKeydown);
|
|
276
|
-
listElement.removeEventListener("scroll", handleListScroll);
|
|
288
|
+
listElement === null || listElement === void 0 ? void 0 : listElement.removeEventListener("scroll", handleListScroll);
|
|
277
289
|
};
|
|
278
290
|
}, [handleGlobalKeydown, handleListScroll, listContainerRef]);
|
|
279
291
|
useEffect(() => {
|
|
280
292
|
if (!filterText || filterText === lastFilter.current) {
|
|
281
|
-
lastFilter.current = filterText;
|
|
293
|
+
lastFilter.current = filterText || "";
|
|
282
294
|
return;
|
|
283
295
|
}
|
|
284
296
|
|
|
@@ -351,9 +363,9 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
351
363
|
};
|
|
352
364
|
useLayoutEffect(() => {
|
|
353
365
|
if (listActionButton && isOpen) {
|
|
354
|
-
var _listActionButtonRef
|
|
366
|
+
var _listActionButtonRef$2, _listActionButtonRef$3;
|
|
355
367
|
|
|
356
|
-
actionButtonHeight.current = ((_listActionButtonRef$ = listActionButtonRef.current) === null || _listActionButtonRef$ === void 0 ? void 0 : (_listActionButtonRef$
|
|
368
|
+
actionButtonHeight.current = ((_listActionButtonRef$2 = listActionButtonRef.current) === null || _listActionButtonRef$2 === void 0 ? void 0 : (_listActionButtonRef$3 = _listActionButtonRef$2.parentElement) === null || _listActionButtonRef$3 === void 0 ? void 0 : _listActionButtonRef$3.offsetHeight) || 0;
|
|
357
369
|
}
|
|
358
370
|
}, [listActionButton, isOpen]);
|
|
359
371
|
|
|
@@ -390,7 +402,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
390
402
|
"data-element": "select-list"
|
|
391
403
|
}, multiColumn ? {} : listBoxProps, {
|
|
392
404
|
ref: listRef,
|
|
393
|
-
tabIndex:
|
|
405
|
+
tabIndex: -1,
|
|
394
406
|
listHeight: multiColumn ? undefined : listHeight
|
|
395
407
|
}), selectListContent), isLoading && loader(), listActionButton && /*#__PURE__*/React.createElement(ListActionButton, {
|
|
396
408
|
ref: listActionButtonRef,
|
|
@@ -399,78 +411,35 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
399
411
|
}))));
|
|
400
412
|
});
|
|
401
413
|
SelectList.propTypes = {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
children: PropTypes.node,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
/** Maximum list height - defaults to 180 */
|
|
433
|
-
listMaxHeight: PropTypes.number,
|
|
434
|
-
|
|
435
|
-
/** A callback for when the Action Button is triggered */
|
|
436
|
-
onListAction: PropTypes.func,
|
|
437
|
-
|
|
438
|
-
/** If true the loader animation is displayed below the last option */
|
|
439
|
-
isLoading: PropTypes.bool,
|
|
440
|
-
|
|
441
|
-
/** A callback that is triggered when a user scrolls to the bottom of the list */
|
|
442
|
-
onListScrollBottom: PropTypes.func,
|
|
443
|
-
|
|
444
|
-
/** SelectList table header, should consist of multiple th elements. Works only in multiColumn mode */
|
|
445
|
-
tableHeader: PropTypes.node,
|
|
446
|
-
|
|
447
|
-
/** When true component will work in multi column mode, children should consist of OptionRow components in this mode */
|
|
448
|
-
multiColumn: PropTypes.bool,
|
|
449
|
-
|
|
450
|
-
/** Data role for loader component */
|
|
451
|
-
loaderDataRole: PropTypes.string,
|
|
452
|
-
|
|
453
|
-
/** Placement of the select list relative to the input element */
|
|
454
|
-
listPlacement: PropTypes.oneOf(["top", "bottom", "right", "left"]),
|
|
455
|
-
|
|
456
|
-
/** Use the opposite list placement if the set placement does not fit */
|
|
457
|
-
flipEnabled: PropTypes.bool,
|
|
458
|
-
|
|
459
|
-
/** @private @ignore
|
|
460
|
-
* Hides the list (with CSS display: none) if not set
|
|
461
|
-
*/
|
|
462
|
-
isOpen: PropTypes.bool,
|
|
463
|
-
|
|
464
|
-
/** array of selected values, if rendered as part of a MultiSelect */
|
|
465
|
-
multiselectValues: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.object)]),
|
|
466
|
-
|
|
467
|
-
/** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
|
|
468
|
-
* DOM at all times, which may cause performance problems on very large lists */
|
|
469
|
-
enableVirtualScroll: PropTypes.bool,
|
|
470
|
-
|
|
471
|
-
/** The number of options to render into the DOM at once, either side of the currently-visible ones.
|
|
472
|
-
* Higher values make for smoother scrolling but may impact performance.
|
|
473
|
-
* Only used if the `enableVirtualScroll` prop is set. */
|
|
474
|
-
virtualScrollOverscan: PropTypes.number
|
|
414
|
+
"anchorElement": function (props, propName) {
|
|
415
|
+
if (props[propName] == null) {
|
|
416
|
+
return null;
|
|
417
|
+
} else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
418
|
+
return new Error("Expected prop '" + propName + "' to be of type Element");
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
"children": PropTypes.node,
|
|
422
|
+
"disablePortal": PropTypes.bool,
|
|
423
|
+
"enableVirtualScroll": PropTypes.bool,
|
|
424
|
+
"filterText": PropTypes.string,
|
|
425
|
+
"flipEnabled": PropTypes.bool,
|
|
426
|
+
"highlightedValue": PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
427
|
+
"id": PropTypes.string,
|
|
428
|
+
"isLoading": PropTypes.bool,
|
|
429
|
+
"isOpen": PropTypes.bool,
|
|
430
|
+
"labelId": PropTypes.string,
|
|
431
|
+
"listActionButton": PropTypes.node,
|
|
432
|
+
"listMaxHeight": PropTypes.number,
|
|
433
|
+
"listPlacement": PropTypes.oneOf(["bottom", "left", "right", "top"]),
|
|
434
|
+
"loaderDataRole": PropTypes.string,
|
|
435
|
+
"multiColumn": PropTypes.bool,
|
|
436
|
+
"multiselectValues": PropTypes.arrayOf(PropTypes.string),
|
|
437
|
+
"onListAction": PropTypes.func,
|
|
438
|
+
"onListScrollBottom": PropTypes.func,
|
|
439
|
+
"onMouseDown": PropTypes.func,
|
|
440
|
+
"onSelect": PropTypes.func.isRequired,
|
|
441
|
+
"onSelectListClose": PropTypes.func.isRequired,
|
|
442
|
+
"tableHeader": PropTypes.node,
|
|
443
|
+
"virtualScrollOverscan": PropTypes.number
|
|
475
444
|
};
|
|
476
445
|
export default SelectList;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface StyledSelectListProps {
|
|
2
|
+
listHeight?: number;
|
|
3
|
+
}
|
|
4
|
+
declare const StyledSelectList: import("styled-components").StyledComponent<"ul", any, StyledSelectListProps, never>;
|
|
5
|
+
declare const StyledSelectLoaderContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
declare const StyledSelectListTable: import("styled-components").StyledComponent<"table", any, {}, never>;
|
|
7
|
+
interface StyledSelectListTableHeaderProps {
|
|
8
|
+
scrollbarWidth: number;
|
|
9
|
+
}
|
|
10
|
+
declare const StyledSelectListTableHeader: import("styled-components").StyledComponent<"thead", any, StyledSelectListTableHeaderProps, never>;
|
|
11
|
+
declare const StyledSelectListTableBody: import("styled-components").StyledComponent<"tbody", any, StyledSelectListProps, never>;
|
|
12
|
+
export { StyledSelectList, StyledSelectLoaderContainer, StyledSelectListTable, StyledSelectListTableHeader, StyledSelectListTableBody, };
|
|
@@ -41,8 +41,8 @@ const StyledSelectListTable = styled.table`
|
|
|
41
41
|
width: 100%;
|
|
42
42
|
table-layout: fixed;
|
|
43
43
|
}
|
|
44
|
-
`;
|
|
45
|
-
|
|
44
|
+
`;
|
|
45
|
+
// TODO (design-tokens): to match current style for border bottom colorsUtilityMajor100
|
|
46
46
|
const StyledSelectListTableHeader = styled.thead`
|
|
47
47
|
border-bottom: 1px solid var(--colorsUtilityMajor050);
|
|
48
48
|
position: sticky;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./select-textbox";
|
|
1
|
+
export { default } from "./select-textbox.component";
|
|
2
|
+
export type { SelectTextboxProps, FormInputPropTypes, } from "./select-textbox.component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./select-textbox.component";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CommonTextboxProps } from "../../textbox";
|
|
3
|
+
import { ValidationProps } from "../../../__internal__/validations";
|
|
4
|
+
export interface FormInputPropTypes extends ValidationProps, Omit<CommonTextboxProps, "onClick"> {
|
|
5
|
+
/** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
|
|
6
|
+
adaptiveLabelBreakpoint?: number;
|
|
7
|
+
/** Prop to specify the aria-label attribute of the component input */
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
/** Prop to specify the aria-labeledby property of the component input */
|
|
10
|
+
ariaLabelledby?: string;
|
|
11
|
+
/** If true the Component will be focused when rendered */
|
|
12
|
+
autoFocus?: boolean;
|
|
13
|
+
/** If true, the component will be disabled */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Id attribute of the input element */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** The width of the input as a percentage */
|
|
18
|
+
inputWidth?: number;
|
|
19
|
+
/** Label content */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** A message that the Help component will display */
|
|
22
|
+
labelHelp?: React.ReactNode;
|
|
23
|
+
/** When true label is inline */
|
|
24
|
+
labelInline?: boolean;
|
|
25
|
+
/** Label width */
|
|
26
|
+
labelWidth?: number;
|
|
27
|
+
/** Name attribute of the input element */
|
|
28
|
+
name?: string;
|
|
29
|
+
/** Specify a callback triggered on blur */
|
|
30
|
+
onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
|
|
31
|
+
/** Specify a callback triggered on change */
|
|
32
|
+
onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
|
|
33
|
+
/** Specify a callback triggered on click */
|
|
34
|
+
onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
|
|
35
|
+
/** Specify a callback triggered on focus */
|
|
36
|
+
onFocus?: (ev: React.FocusEvent<HTMLInputElement>) => void;
|
|
37
|
+
/** pecify a callback triggered on keuyDown */
|
|
38
|
+
onKeyDown?: (ev: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
39
|
+
/** Placeholder string to be displayed in input */
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
/** Flag to configure component as mandatory */
|
|
42
|
+
required?: boolean;
|
|
43
|
+
/** If true, the component will be read-only */
|
|
44
|
+
readOnly?: boolean;
|
|
45
|
+
/** Size of an input */
|
|
46
|
+
size?: "small" | "medium" | "large";
|
|
47
|
+
/**
|
|
48
|
+
* Id of the element containing the currently displayed value
|
|
49
|
+
* to be read by voice readers
|
|
50
|
+
* @private
|
|
51
|
+
* @ignore
|
|
52
|
+
*/
|
|
53
|
+
accessibilityLabelId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Label id passed from Select component
|
|
56
|
+
* @private
|
|
57
|
+
* @ignore
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
labelId?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface SelectTextboxProps extends FormInputPropTypes {
|
|
63
|
+
/** Id attribute of the select list */
|
|
64
|
+
"aria-controls"?: string;
|
|
65
|
+
/** Value to be displayed in the Textbox */
|
|
66
|
+
formattedValue?: string;
|
|
67
|
+
/** If true, the input will be displayed */
|
|
68
|
+
hasTextCursor?: boolean;
|
|
69
|
+
/** If true, the list is displayed */
|
|
70
|
+
isOpen?: boolean;
|
|
71
|
+
/** Value of the Select Input */
|
|
72
|
+
selectedValue?: string | Record<string, unknown> | string[] | Record<string, unknown>[];
|
|
73
|
+
/** @private @ignore */
|
|
74
|
+
textboxRef?: HTMLInputElement | null;
|
|
75
|
+
/** @private @ignore */
|
|
76
|
+
transparent?: boolean;
|
|
77
|
+
/** @private @ignore */
|
|
78
|
+
activeDescendantId?: string;
|
|
79
|
+
}
|
|
80
|
+
declare const SelectTextbox: React.ForwardRefExoticComponent<SelectTextboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
81
|
+
export default SelectTextbox;
|