@oliasoft-open-source/react-ui-library 3.12.0-beta-20 → 3.12.0-beta-21
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/dist/common-enum.d.ts +73 -0
- package/dist/common-enum.js +81 -0
- package/dist/components/accordion/accordion.d.ts +4 -0
- package/dist/components/accordion/accordion.interface.d.ts +17 -0
- package/dist/components/accordion/accordion.interface.js +1 -0
- package/dist/components/accordion/accordion.js +17 -0
- package/dist/components/accordion/accordion.stories.d.ts +11 -0
- package/dist/components/accordion/accordion.stories.js +140 -0
- package/dist/components/accordion/chevron/chevron.d.ts +5 -0
- package/dist/components/accordion/chevron/chevron.js +8 -0
- package/dist/components/accordion/enum.d.ts +4 -0
- package/dist/components/accordion/enum.js +5 -0
- package/dist/components/accordion/helpers/accordion-with-default-toggle.d.ts +12 -0
- package/dist/components/accordion/helpers/accordion-with-default-toggle.js +35 -0
- package/dist/components/actions/actions.d.ts +14 -0
- package/dist/components/actions/actions.interface.d.ts +25 -0
- package/dist/components/actions/actions.interface.js +1 -0
- package/dist/components/actions/actions.js +66 -0
- package/dist/components/actions/actions.stories.d.ts +25 -0
- package/dist/components/actions/actions.stories.js +67 -0
- package/dist/components/badge/badge.d.ts +10 -0
- package/dist/components/badge/badge.js +21 -0
- package/dist/components/badge/badge.stories.d.ts +7 -0
- package/dist/components/badge/badge.stories.js +21 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +6 -0
- package/dist/components/breadcrumb/breadcrumb.js +11 -0
- package/dist/components/breadcrumb/breadcrumb.stories.d.ts +5 -0
- package/dist/components/breadcrumb/breadcrumb.stories.js +36 -0
- package/dist/components/breadcrumb/enum.d.ts +5 -0
- package/dist/components/breadcrumb/enum.js +6 -0
- package/dist/components/breadcrumb/link.d.ts +12 -0
- package/dist/components/breadcrumb/link.js +12 -0
- package/dist/components/button/button.d.ts +31 -0
- package/dist/components/button/button.js +52 -0
- package/dist/components/button/button.stories.d.ts +13 -0
- package/dist/components/button/button.stories.js +63 -0
- package/dist/components/button/enum.d.ts +5 -0
- package/dist/components/button/enum.js +6 -0
- package/dist/components/button-group/button-group.d.ts +38 -0
- package/dist/components/button-group/button-group.js +83 -0
- package/dist/components/button-group/button-group.stories-data.d.ts +6 -0
- package/dist/components/button-group/button-group.stories-data.js +61 -0
- package/dist/components/button-group/button-group.stories.d.ts +9 -0
- package/dist/components/button-group/button-group.stories.js +51 -0
- package/dist/components/card/card.d.ts +10 -0
- package/dist/components/card/card.js +6 -0
- package/dist/components/card/card.stories.d.ts +8 -0
- package/dist/components/card/card.stories.js +27 -0
- package/dist/components/check-box/check-box.d.ts +19 -0
- package/dist/components/check-box/check-box.js +19 -0
- package/dist/components/check-box/check-box.stories.d.ts +6 -0
- package/dist/components/check-box/check-box.stories.js +29 -0
- package/dist/components/color/color.stories-data.d.ts +9 -0
- package/dist/components/color/color.stories-data.js +55 -0
- package/dist/components/dialog/dialog.d.ts +17 -0
- package/dist/components/dialog/dialog.js +18 -0
- package/dist/components/divider/divider.d.ts +9 -0
- package/dist/components/divider/divider.js +19 -0
- package/dist/components/divider/divider.stories.d.ts +7 -0
- package/dist/components/divider/divider.stories.js +41 -0
- package/dist/components/drawer/drawer-resize-wrapper.d.ts +2 -0
- package/dist/components/drawer/drawer-resize-wrapper.js +33 -0
- package/dist/components/drawer/drawer-tabs.d.ts +2 -0
- package/dist/components/drawer/drawer-tabs.js +15 -0
- package/dist/components/drawer/drawer.constants.d.ts +2 -0
- package/dist/components/drawer/drawer.constants.js +2 -0
- package/dist/components/drawer/drawer.d.ts +2 -0
- package/dist/components/drawer/drawer.interface.d.ts +55 -0
- package/dist/components/drawer/drawer.interface.js +1 -0
- package/dist/components/drawer/drawer.js +80 -0
- package/dist/components/drawer/drawer.stories.d.ts +40 -0
- package/dist/components/drawer/drawer.stories.js +176 -0
- package/dist/components/empty/empty.d.ts +8 -0
- package/dist/components/empty/empty.js +6 -0
- package/dist/components/empty/empty.stories.d.ts +5 -0
- package/dist/components/empty/empty.stories.js +19 -0
- package/dist/components/file-input/enum.d.ts +6 -0
- package/dist/components/file-input/enum.js +7 -0
- package/dist/components/file-input/file-input.d.ts +18 -0
- package/dist/components/file-input/file-input.js +47 -0
- package/dist/components/file-input/file-input.stories.d.ts +7 -0
- package/dist/components/file-input/file-input.stories.js +65 -0
- package/dist/components/form/field.d.ts +16 -0
- package/dist/components/form/field.js +13 -0
- package/dist/components/form/field.stories.d.ts +12 -0
- package/dist/components/form/field.stories.js +51 -0
- package/dist/components/form/form.stories.d.ts +27 -0
- package/dist/components/form/form.stories.js +76 -0
- package/dist/components/heading/heading.d.ts +19 -0
- package/dist/components/heading/heading.js +9 -0
- package/dist/components/heading/heading.stories.d.ts +10 -0
- package/dist/components/heading/heading.stories.js +46 -0
- package/dist/components/help-icon/help-icon.d.ts +10 -0
- package/dist/components/help-icon/help-icon.js +19 -0
- package/dist/components/help-icon/help-icon.stories.d.ts +10 -0
- package/dist/components/help-icon/help-icon.stories.js +37 -0
- package/dist/components/icon/icon.d.ts +16 -0
- package/dist/components/icon/icon.js +31 -0
- package/dist/components/icon/icon.stories.d.ts +25 -0
- package/dist/components/icon/icon.stories.js +37 -0
- package/dist/components/icon/named-icon.d.ts +6 -0
- package/dist/components/icon/named-icon.js +418 -0
- package/dist/components/input/input.d.ts +26 -0
- package/dist/components/input/input.js +40 -0
- package/dist/components/input/input.stories.d.ts +5 -0
- package/dist/components/input/input.stories.js +22 -0
- package/dist/components/input-group/input-group-addon/input-group-addon.d.ts +8 -0
- package/dist/components/input-group/input-group-addon/input-group-addon.js +20 -0
- package/dist/components/input-group/input-group.d.ts +7 -0
- package/dist/components/input-group/input-group.js +27 -0
- package/dist/components/input-group/input-group.stories.d.ts +8 -0
- package/dist/components/input-group/input-group.stories.js +65 -0
- package/dist/components/label/label.d.ts +24 -0
- package/dist/components/label/label.js +14 -0
- package/dist/components/label/label.stories.d.ts +10 -0
- package/dist/components/label/label.stories.js +42 -0
- package/dist/components/layout/column/column.d.ts +18 -0
- package/dist/components/layout/column/column.js +13 -0
- package/dist/components/layout/column/styles.d.ts +15 -0
- package/dist/components/layout/column/styles.js +41 -0
- package/dist/components/layout/column.stories.d.ts +20 -0
- package/dist/components/layout/column.stories.js +53 -0
- package/dist/components/layout/flex/flex.d.ts +11 -0
- package/dist/components/layout/flex/flex.js +18 -0
- package/dist/components/layout/flex/flex.stories.d.ts +10 -0
- package/dist/components/layout/flex/flex.stories.js +52 -0
- package/dist/components/layout/form-row/form-row.d.ts +5 -0
- package/dist/components/layout/form-row/form-row.js +5 -0
- package/dist/components/layout/grid/grid.d.ts +11 -0
- package/dist/components/layout/grid/grid.js +41 -0
- package/dist/components/layout/grid/grid.stories.d.ts +9 -0
- package/dist/components/layout/grid/grid.stories.js +48 -0
- package/dist/components/layout/page/page.d.ts +9 -0
- package/dist/components/layout/page/page.js +11 -0
- package/dist/components/layout/page.stories.d.ts +9 -0
- package/dist/components/layout/page.stories.js +32 -0
- package/dist/components/layout/placeholder.d.ts +1 -0
- package/dist/components/layout/placeholder.js +1 -0
- package/dist/components/layout/print-header/print-header.d.ts +7 -0
- package/dist/components/layout/print-header/print-header.js +3 -0
- package/dist/components/layout/row/row.d.ts +15 -0
- package/dist/components/layout/row/row.js +24 -0
- package/dist/components/layout/spacer/spacer.d.ts +6 -0
- package/dist/components/layout/spacer/spacer.js +8 -0
- package/dist/components/list/list-row/item-content.d.ts +2 -0
- package/dist/components/list/list-row/item-content.js +9 -0
- package/dist/components/list/list-row/label.d.ts +2 -0
- package/dist/components/list/list-row/label.js +6 -0
- package/dist/components/list/list-row/list-heading.d.ts +3 -0
- package/dist/components/list/list-row/list-heading.js +10 -0
- package/dist/components/list/list-row/list-row.d.ts +3 -0
- package/dist/components/list/list-row/list-row.interface.d.ts +105 -0
- package/dist/components/list/list-row/list-row.interface.js +1 -0
- package/dist/components/list/list-row/list-row.js +56 -0
- package/dist/components/list/list-row/list-subheading.d.ts +3 -0
- package/dist/components/list/list-row/list-subheading.js +27 -0
- package/dist/components/list/list-row/meta-content.d.ts +2 -0
- package/dist/components/list/list-row/meta-content.js +12 -0
- package/dist/components/list/list-row/meta-count.d.ts +2 -0
- package/dist/components/list/list-row/meta-count.js +5 -0
- package/dist/components/list/list-row/name.d.ts +3 -0
- package/dist/components/list/list-row/name.js +12 -0
- package/dist/components/list/list.d.ts +2 -0
- package/dist/components/list/list.interface.d.ts +55 -0
- package/dist/components/list/list.interface.js +1 -0
- package/dist/components/list/list.js +86 -0
- package/dist/components/list/list.stories-data.d.ts +310 -0
- package/dist/components/list/list.stories-data.js +270 -0
- package/dist/components/list/list.stories.d.ts +22 -0
- package/dist/components/list/list.stories.js +411 -0
- package/dist/components/list/toggle-narrow.d.ts +2 -0
- package/dist/components/list/toggle-narrow.js +7 -0
- package/dist/components/loader/loader.d.ts +14 -0
- package/dist/components/loader/loader.js +15 -0
- package/dist/components/loader/loader.stories.d.ts +32 -0
- package/dist/components/loader/loader.stories.js +92 -0
- package/dist/components/menu/enum.d.ts +11 -0
- package/dist/components/menu/enum.js +13 -0
- package/dist/components/menu/index.d.ts +4 -0
- package/dist/components/menu/index.js +8 -0
- package/dist/components/menu/layer/divider.d.ts +1 -0
- package/dist/components/menu/layer/divider.js +3 -0
- package/dist/components/menu/layer/heading.d.ts +8 -0
- package/dist/components/menu/layer/heading.js +3 -0
- package/dist/components/menu/layer/layer.d.ts +15 -0
- package/dist/components/menu/layer/layer.js +47 -0
- package/dist/components/menu/layer/option.d.ts +19 -0
- package/dist/components/menu/layer/option.js +22 -0
- package/dist/components/menu/layer/path.d.ts +5 -0
- package/dist/components/menu/layer/path.js +30 -0
- package/dist/components/menu/layer/placementOptions.d.ts +3 -0
- package/dist/components/menu/layer/placementOptions.js +6 -0
- package/dist/components/menu/layer/section.d.ts +10 -0
- package/dist/components/menu/layer/section.js +23 -0
- package/dist/components/menu/menu.d.ts +3 -0
- package/dist/components/menu/menu.interface.d.ts +82 -0
- package/dist/components/menu/menu.interface.js +1 -0
- package/dist/components/menu/menu.js +92 -0
- package/dist/components/menu/menu.stories-data.d.ts +101 -0
- package/dist/components/menu/menu.stories-data.js +182 -0
- package/dist/components/menu/menu.stories.d.ts +31 -0
- package/dist/components/menu/menu.stories.js +104 -0
- package/dist/components/menu/menu.test.d.ts +1 -0
- package/dist/components/menu/menu.test.js +46 -0
- package/dist/components/menu/trigger/button.d.ts +14 -0
- package/dist/components/menu/trigger/button.js +13 -0
- package/dist/components/menu/trigger/component.d.ts +8 -0
- package/dist/components/menu/trigger/component.js +6 -0
- package/dist/components/menu/trigger/text.d.ts +10 -0
- package/dist/components/menu/trigger/text.js +9 -0
- package/dist/components/menu/trigger/trigger.d.ts +27 -0
- package/dist/components/menu/trigger/trigger.js +35 -0
- package/dist/components/message/dismiss.d.ts +8 -0
- package/dist/components/message/dismiss.js +17 -0
- package/dist/components/message/enum.d.ts +9 -0
- package/dist/components/message/enum.js +11 -0
- package/dist/components/message/message.d.ts +19 -0
- package/dist/components/message/message.js +49 -0
- package/dist/components/message/message.stories.d.ts +11 -0
- package/dist/components/message/message.stories.js +82 -0
- package/dist/components/modal/modal.d.ts +8 -0
- package/dist/components/modal/modal.js +7 -0
- package/dist/components/modal/modal.stories.d.ts +12 -0
- package/dist/components/modal/modal.stories.js +107 -0
- package/dist/components/number-input/number-input.d.ts +26 -0
- package/dist/components/number-input/number-input.js +66 -0
- package/dist/components/number-input/number-input.stories.d.ts +13 -0
- package/dist/components/number-input/number-input.stories.js +43 -0
- package/dist/components/option-dropdown/enum.d.ts +5 -0
- package/dist/components/option-dropdown/enum.js +6 -0
- package/dist/components/option-dropdown/heading.d.ts +4 -0
- package/dist/components/option-dropdown/heading.js +3 -0
- package/dist/components/option-dropdown/layer.d.ts +16 -0
- package/dist/components/option-dropdown/layer.js +43 -0
- package/dist/components/option-dropdown/option-dropdown.d.ts +19 -0
- package/dist/components/option-dropdown/option-dropdown.js +17 -0
- package/dist/components/option-dropdown/option-dropdown.stories.d.ts +5 -0
- package/dist/components/option-dropdown/option-dropdown.stories.js +35 -0
- package/dist/components/option-dropdown/option.d.ts +10 -0
- package/dist/components/option-dropdown/option.js +7 -0
- package/dist/components/pagination/pagination.d.ts +13 -0
- package/dist/components/pagination/pagination.interface.d.ts +15 -0
- package/dist/components/pagination/pagination.interface.js +1 -0
- package/dist/components/pagination/pagination.js +33 -0
- package/dist/components/pagination/pagination.stories.d.ts +7 -0
- package/dist/components/pagination/pagination.stories.js +62 -0
- package/dist/components/pagination/pagination.test.d.ts +1 -0
- package/dist/components/pagination/pagination.test.js +84 -0
- package/dist/components/pagination/pagination.viewdata.d.ts +17 -0
- package/dist/components/pagination/pagination.viewdata.js +53 -0
- package/dist/components/pop-confirm/content.d.ts +9 -0
- package/dist/components/pop-confirm/content.js +5 -0
- package/dist/components/pop-confirm/pop-confirm.d.ts +14 -0
- package/dist/components/pop-confirm/pop-confirm.js +7 -0
- package/dist/components/pop-confirm/pop-confirm.stories.d.ts +4 -0
- package/dist/components/pop-confirm/pop-confirm.stories.js +43 -0
- package/dist/components/popover/popover.d.ts +14 -0
- package/dist/components/popover/popover.js +39 -0
- package/dist/components/popover/popover.stories.d.ts +7 -0
- package/dist/components/popover/popover.stories.js +43 -0
- package/dist/components/portal/portal.d.ts +6 -0
- package/dist/components/portal/portal.js +11 -0
- package/dist/components/portal/portal.stories.d.ts +7 -0
- package/dist/components/portal/portal.stories.js +51 -0
- package/dist/components/progress-bar/progress-bar.d.ts +9 -0
- package/dist/components/progress-bar/progress-bar.js +21 -0
- package/dist/components/progress-bar/progress-bar.stories.d.ts +4 -0
- package/dist/components/progress-bar/progress-bar.stories.js +16 -0
- package/dist/components/radio-button/radio-button.d.ts +27 -0
- package/dist/components/radio-button/radio-button.js +45 -0
- package/dist/components/radio-button/radio-button.stories.d.ts +5 -0
- package/dist/components/radio-button/radio-button.stories.js +45 -0
- package/dist/components/radio-button/radio-input.d.ts +16 -0
- package/dist/components/radio-button/radio-input.js +9 -0
- package/dist/components/rich-text-input/rich-text-input.d.ts +10 -0
- package/dist/components/rich-text-input/rich-text-input.js +35 -0
- package/dist/components/rich-text-input/rich-text-input.stories.d.ts +9 -0
- package/dist/components/rich-text-input/rich-text-input.stories.js +60 -0
- package/dist/components/rich-text-input/rich-text-toolbar/enum.d.ts +7 -0
- package/dist/components/rich-text-input/rich-text-toolbar/enum.js +8 -0
- package/dist/components/rich-text-input/rich-text-toolbar/rich-text-toolbar.d.ts +7 -0
- package/dist/components/rich-text-input/rich-text-toolbar/rich-text-toolbar.js +42 -0
- package/dist/components/select/custom-select/custom-select.d.ts +2 -0
- package/dist/components/select/custom-select/custom-select.interface.d.ts +47 -0
- package/dist/components/select/custom-select/custom-select.interface.js +1 -0
- package/dist/components/select/custom-select/custom-select.js +51 -0
- package/dist/components/select/custom-select/custom-select.reducer.d.ts +6 -0
- package/dist/components/select/custom-select/custom-select.reducer.js +140 -0
- package/dist/components/select/custom-select/enum.d.ts +11 -0
- package/dist/components/select/custom-select/enum.js +12 -0
- package/dist/components/select/custom-select/helper.d.ts +3 -0
- package/dist/components/select/custom-select/helper.js +55 -0
- package/dist/components/select/custom-select/hooks/enum.d.ts +20 -0
- package/dist/components/select/custom-select/hooks/enum.js +22 -0
- package/dist/components/select/custom-select/hooks/use-custom-select-logic.d.ts +39 -0
- package/dist/components/select/custom-select/hooks/use-custom-select-logic.js +222 -0
- package/dist/components/select/custom-select/layer/heading.d.ts +3 -0
- package/dist/components/select/custom-select/layer/heading.js +5 -0
- package/dist/components/select/custom-select/layer/layer.d.ts +17 -0
- package/dist/components/select/custom-select/layer/layer.js +25 -0
- package/dist/components/select/custom-select/layer/option.d.ts +15 -0
- package/dist/components/select/custom-select/layer/option.js +10 -0
- package/dist/components/select/custom-select/layer/placementOptions.d.ts +10 -0
- package/dist/components/select/custom-select/layer/placementOptions.js +7 -0
- package/dist/components/select/custom-select/layer/section.d.ts +15 -0
- package/dist/components/select/custom-select/layer/section.js +16 -0
- package/dist/components/select/custom-select/reducer.interface.d.ts +34 -0
- package/dist/components/select/custom-select/reducer.interface.js +1 -0
- package/dist/components/select/custom-select/trigger/input.d.ts +14 -0
- package/dist/components/select/custom-select/trigger/input.js +21 -0
- package/dist/components/select/custom-select/trigger/multi-selected-options.d.ts +8 -0
- package/dist/components/select/custom-select/trigger/multi-selected-options.js +41 -0
- package/dist/components/select/custom-select/trigger/trigger.d.ts +34 -0
- package/dist/components/select/custom-select/trigger/trigger.js +53 -0
- package/dist/components/select/native-select/native-select.d.ts +29 -0
- package/dist/components/select/native-select/native-select.js +61 -0
- package/dist/components/select/select.d.ts +2 -0
- package/dist/components/select/select.input.d.ts +21 -0
- package/dist/components/select/select.input.js +114 -0
- package/dist/components/select/select.interface.d.ts +39 -0
- package/dist/components/select/select.interface.js +1 -0
- package/dist/components/select/select.js +61 -0
- package/dist/components/select/select.stories-data.d.ts +25 -0
- package/dist/components/select/select.stories-data.js +113 -0
- package/dist/components/select/select.stories.d.ts +30 -0
- package/dist/components/select/select.stories.js +93 -0
- package/dist/components/select/select.test.d.ts +1 -0
- package/dist/components/select/select.test.js +303 -0
- package/dist/components/side-bar/link.d.ts +17 -0
- package/dist/components/side-bar/link.js +20 -0
- package/dist/components/side-bar/sections.d.ts +21 -0
- package/dist/components/side-bar/sections.js +7 -0
- package/dist/components/side-bar/side-bar.d.ts +26 -0
- package/dist/components/side-bar/side-bar.js +28 -0
- package/dist/components/side-bar/side-bar.stories.d.ts +5 -0
- package/dist/components/side-bar/side-bar.stories.js +90 -0
- package/dist/components/slider/slider-tooltip.d.ts +5 -0
- package/dist/components/slider/slider-tooltip.js +13 -0
- package/dist/components/slider/slider.d.ts +37 -0
- package/dist/components/slider/slider.js +57 -0
- package/dist/components/slider/slider.stories.d.ts +16 -0
- package/dist/components/slider/slider.stories.js +85 -0
- package/dist/components/spinner/spinner.d.ts +7 -0
- package/dist/components/spinner/spinner.js +6 -0
- package/dist/components/spinner/spinner.stories.d.ts +4 -0
- package/dist/components/spinner/spinner.stories.js +14 -0
- package/dist/components/table/cell/cell-types/action-cell.d.ts +5 -0
- package/dist/components/table/cell/cell-types/action-cell.js +5 -0
- package/dist/components/table/cell/cell-types/cell-help-icon.d.ts +5 -0
- package/dist/components/table/cell/cell-types/cell-help-icon.js +7 -0
- package/dist/components/table/cell/cell-types/cell-library-icon.d.ts +5 -0
- package/dist/components/table/cell/cell-types/cell-library-icon.js +8 -0
- package/dist/components/table/cell/cell-types/cell-types.interface.d.ts +150 -0
- package/dist/components/table/cell/cell-types/cell-types.interface.js +1 -0
- package/dist/components/table/cell/cell-types/check-box-cell.d.ts +7 -0
- package/dist/components/table/cell/cell-types/check-box-cell.js +5 -0
- package/dist/components/table/cell/cell-types/icon-cell.d.ts +5 -0
- package/dist/components/table/cell/cell-types/icon-cell.js +9 -0
- package/dist/components/table/cell/cell-types/input-cell.d.ts +8 -0
- package/dist/components/table/cell/cell-types/input-cell.js +6 -0
- package/dist/components/table/cell/cell-types/link-cell.d.ts +7 -0
- package/dist/components/table/cell/cell-types/link-cell.js +23 -0
- package/dist/components/table/cell/cell-types/number-input-cell.d.ts +7 -0
- package/dist/components/table/cell/cell-types/number-input-cell.js +5 -0
- package/dist/components/table/cell/cell-types/popover-cell.d.ts +6 -0
- package/dist/components/table/cell/cell-types/popover-cell.js +8 -0
- package/dist/components/table/cell/cell-types/select-cell.d.ts +8 -0
- package/dist/components/table/cell/cell-types/select-cell.js +6 -0
- package/dist/components/table/cell/cell-types/slider-cell.d.ts +6 -0
- package/dist/components/table/cell/cell-types/slider-cell.js +6 -0
- package/dist/components/table/cell/cell-types/sort-cell.d.ts +5 -0
- package/dist/components/table/cell/cell-types/sort-cell.js +9 -0
- package/dist/components/table/cell/cell-types/static-cell.d.ts +7 -0
- package/dist/components/table/cell/cell-types/static-cell.js +16 -0
- package/dist/components/table/cell/cell-wrapper.d.ts +8 -0
- package/dist/components/table/cell/cell-wrapper.js +33 -0
- package/dist/components/table/cell/cell.d.ts +12 -0
- package/dist/components/table/cell/cell.js +45 -0
- package/dist/components/table/cell/cell.stories.d.ts +21 -0
- package/dist/components/table/cell/cell.stories.js +209 -0
- package/dist/components/table/cell/input-cell-wrapper.d.ts +7 -0
- package/dist/components/table/cell/input-cell-wrapper.js +8 -0
- package/dist/components/table/enum.d.ts +9 -0
- package/dist/components/table/enum.js +10 -0
- package/dist/components/table/footer/footer.d.ts +10 -0
- package/dist/components/table/footer/footer.js +18 -0
- package/dist/components/table/footer/footer.stories.d.ts +3 -0
- package/dist/components/table/footer/footer.stories.js +19 -0
- package/dist/components/table/helper.d.ts +22 -0
- package/dist/components/table/helper.js +49 -0
- package/dist/components/table/helper.test.d.ts +1 -0
- package/dist/components/table/helper.test.js +127 -0
- package/dist/components/table/row/expanded-content-row.d.ts +7 -0
- package/dist/components/table/row/expanded-content-row.js +6 -0
- package/dist/components/table/row/row.d.ts +37 -0
- package/dist/components/table/row/row.js +46 -0
- package/dist/components/table/row/row.stories.d.ts +9 -0
- package/dist/components/table/row/row.stories.js +132 -0
- package/dist/components/table/table-scroll-wrapper.d.ts +13 -0
- package/dist/components/table/table-scroll-wrapper.js +24 -0
- package/dist/components/table/table.d.ts +34 -0
- package/dist/components/table/table.js +91 -0
- package/dist/components/table/table.stories-data.d.ts +1970 -0
- package/dist/components/table/table.stories-data.js +996 -0
- package/dist/components/table/table.stories.d.ts +17 -0
- package/dist/components/table/table.stories.js +521 -0
- package/dist/components/table/table.test.d.ts +1 -0
- package/dist/components/table/table.test.js +27 -0
- package/dist/components/table/table.viewdata.d.ts +16 -0
- package/dist/components/table/table.viewdata.js +17 -0
- package/dist/components/table/title/title.d.ts +8 -0
- package/dist/components/table/title/title.js +22 -0
- package/dist/components/table/title/title.stories.d.ts +11 -0
- package/dist/components/table/title/title.stories.js +53 -0
- package/dist/components/tabs/content.d.ts +7 -0
- package/dist/components/tabs/content.js +6 -0
- package/dist/components/tabs/label.d.ts +14 -0
- package/dist/components/tabs/label.js +8 -0
- package/dist/components/tabs/tabs.d.ts +33 -0
- package/dist/components/tabs/tabs.js +64 -0
- package/dist/components/tabs/tabs.stories.d.ts +10 -0
- package/dist/components/tabs/tabs.stories.js +86 -0
- package/dist/components/text/text.d.ts +15 -0
- package/dist/components/text/text.js +6 -0
- package/dist/components/text/text.stories.d.ts +6 -0
- package/dist/components/text/text.stories.js +22 -0
- package/dist/components/text-link/text-link.d.ts +9 -0
- package/dist/components/text-link/text-link.js +5 -0
- package/dist/components/text-link/text-link.stories.d.ts +5 -0
- package/dist/components/text-link/text-link.stories.js +17 -0
- package/dist/components/textarea/textarea.d.ts +22 -0
- package/dist/components/textarea/textarea.js +15 -0
- package/dist/components/textarea/textarea.stories.d.ts +4 -0
- package/dist/components/textarea/textarea.stories.js +18 -0
- package/dist/components/toaster/toaster.d.ts +19 -0
- package/dist/components/toaster/toaster.js +51 -0
- package/dist/components/toaster/toaster.stories.d.ts +15 -0
- package/dist/components/toaster/toaster.stories.js +84 -0
- package/dist/components/toggle/toggle.d.ts +14 -0
- package/dist/components/toggle/toggle.js +17 -0
- package/dist/components/toggle/toggle.stories.d.ts +10 -0
- package/dist/components/toggle/toggle.stories.js +41 -0
- package/dist/components/tooltip/tooltip-layer.d.ts +16 -0
- package/dist/components/tooltip/tooltip-layer.js +19 -0
- package/dist/components/tooltip/tooltip.d.ts +19 -0
- package/dist/components/tooltip/tooltip.js +31 -0
- package/dist/components/tooltip/tooltip.stories.d.ts +11 -0
- package/dist/components/tooltip/tooltip.stories.js +50 -0
- package/dist/components/tooltip/tooltip.test-case.stories.d.ts +4 -0
- package/dist/components/tooltip/tooltip.test-case.stories.js +20 -0
- package/dist/components/top-bar/element/element.d.ts +32 -0
- package/dist/components/top-bar/element/element.js +28 -0
- package/dist/components/top-bar/element/enum.d.ts +6 -0
- package/dist/components/top-bar/element/enum.js +7 -0
- package/dist/components/top-bar/element/link.d.ts +11 -0
- package/dist/components/top-bar/element/link.js +15 -0
- package/dist/components/top-bar/title.d.ts +9 -0
- package/dist/components/top-bar/title.js +7 -0
- package/dist/components/top-bar/top-bar.d.ts +11 -0
- package/dist/components/top-bar/top-bar.js +19 -0
- package/dist/components/top-bar/top-bar.stories.d.ts +6 -0
- package/dist/components/top-bar/top-bar.stories.js +124 -0
- package/dist/components/top-bar/top-bar.testcase.stories.d.ts +5 -0
- package/dist/components/top-bar/top-bar.testcase.stories.js +53 -0
- package/dist/components/top-bar/warning.d.ts +5 -0
- package/dist/components/top-bar/warning.js +5 -0
- package/dist/components/tree/tree-item.d.ts +10 -0
- package/dist/components/tree/tree-item.js +27 -0
- package/dist/components/tree/tree-placeholder.d.ts +4 -0
- package/dist/components/tree/tree-placeholder.js +3 -0
- package/dist/components/tree/tree.d.ts +42 -0
- package/dist/components/tree/tree.js +50 -0
- package/dist/components/tree/tree.stories-data.d.ts +126 -0
- package/dist/components/tree/tree.stories-data.js +83 -0
- package/dist/components/tree/tree.stories.d.ts +11 -0
- package/dist/components/tree/tree.stories.js +98 -0
- package/dist/helpers/disabled-context.d.ts +2 -0
- package/dist/helpers/disabled-context.js +2 -0
- package/dist/helpers/text.d.ts +1 -0
- package/dist/helpers/text.js +9 -0
- package/dist/helpers/types.d.ts +3 -0
- package/dist/helpers/types.js +8 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-focus.d.ts +4 -0
- package/dist/hooks/use-focus.js +10 -0
- package/dist/hooks/use-fonts-ready.d.ts +1 -0
- package/dist/hooks/use-fonts-ready.js +13 -0
- package/dist/hooks/use-keyboard-event.d.ts +2 -0
- package/dist/hooks/use-keyboard-event.js +14 -0
- package/dist/hooks/use-window-width.d.ts +1 -0
- package/dist/hooks/use-window-width.js +16 -0
- package/dist/index.d.ts +79 -1467
- package/dist/index.js +86 -72363
- package/dist/my-dummy.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import 'remirror/styles/all.css';
|
|
3
|
+
export interface IRichTextInputProps {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
onChange?: (markdown: string) => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
toolbarComponent?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const RichTextInput: React.ForwardRefExoticComponent<IRichTextInputProps & React.RefAttributes<any>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useContext, useImperativeHandle, } from 'react';
|
|
3
|
+
import { BoldExtension, BulletListExtension, CodeExtension, ItalicExtension, MarkdownExtension, OrderedListExtension, PlaceholderExtension, } from 'remirror/extensions';
|
|
4
|
+
import { EditorComponent, Remirror, useRemirror } from '@remirror/react';
|
|
5
|
+
import 'remirror/styles/all.css';
|
|
6
|
+
import { DisabledContext } from '../../helpers/disabled-context';
|
|
7
|
+
import { RichTextToolbar } from './rich-text-toolbar/rich-text-toolbar';
|
|
8
|
+
import styles from './rich-text-input.module.less';
|
|
9
|
+
export const RichTextInput = forwardRef(({ placeholder, onChange, value, disabled: disabledProp, toolbarComponent }, ref) => {
|
|
10
|
+
const disabledContext = useContext(DisabledContext);
|
|
11
|
+
const disabled = disabledProp || disabledContext;
|
|
12
|
+
const { manager, state, setState, getContext } = useRemirror({
|
|
13
|
+
extensions: () => [
|
|
14
|
+
new BoldExtension(),
|
|
15
|
+
new BulletListExtension(),
|
|
16
|
+
new CodeExtension(),
|
|
17
|
+
new ItalicExtension(),
|
|
18
|
+
new MarkdownExtension(),
|
|
19
|
+
new OrderedListExtension(),
|
|
20
|
+
new PlaceholderExtension({ placeholder }),
|
|
21
|
+
],
|
|
22
|
+
content: value,
|
|
23
|
+
selection: 'start',
|
|
24
|
+
stringHandler: 'markdown',
|
|
25
|
+
});
|
|
26
|
+
useImperativeHandle(ref, () => getContext(), [getContext]);
|
|
27
|
+
const handleChange = ({ helpers, state }) => {
|
|
28
|
+
const markdown = helpers.getMarkdown(state);
|
|
29
|
+
if (onChange) {
|
|
30
|
+
onChange(markdown);
|
|
31
|
+
}
|
|
32
|
+
setState(state);
|
|
33
|
+
};
|
|
34
|
+
return (_jsx("div", { className: styles.richTextInput, children: _jsxs(Remirror, { manager: manager, state: state, placeholder: placeholder, onChange: handleChange, editable: !disabled, children: [_jsx(RichTextToolbar, { disabled: disabled, toolbarComponent: toolbarComponent }), _jsx(EditorComponent, {})] }) }));
|
|
35
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IRichTextInputProps } from './rich-text-input';
|
|
2
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
|
+
export default _default;
|
|
4
|
+
export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, IRichTextInputProps>;
|
|
5
|
+
export declare const Filled: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, IRichTextInputProps>;
|
|
6
|
+
export declare const Placeholder: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, IRichTextInputProps>;
|
|
7
|
+
export declare const Disabled: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, IRichTextInputProps>;
|
|
8
|
+
export declare const HandlingStateExternallyWithRef: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const WithToolbarComponent: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, IRichTextInputProps>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { RichTextInput } from './rich-text-input';
|
|
4
|
+
import { Button } from '../button/button';
|
|
5
|
+
import { Select } from '../select/select';
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Forms/RichTextInput',
|
|
8
|
+
component: RichTextInput,
|
|
9
|
+
args: {},
|
|
10
|
+
};
|
|
11
|
+
const Template = (args) => {
|
|
12
|
+
const [value, setValue] = React.useState(args.value);
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsx(RichTextInput
|
|
14
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
15
|
+
, { ...args, value: value, onChange: setValue }), _jsx("pre", { children: _jsx("strong", { children: "Markdown output:" }) }), _jsx("pre", { children: value })] }));
|
|
16
|
+
};
|
|
17
|
+
export const Default = Template.bind({});
|
|
18
|
+
export const Filled = Template.bind({});
|
|
19
|
+
Filled.args = {
|
|
20
|
+
value: 'Paragraph goes here lorem ipsum dolor.\n1. Item (*italic*)\n2. Item (**bold**)\n3. Item (`code`)\n* Item\n* Item',
|
|
21
|
+
};
|
|
22
|
+
export const Placeholder = Template.bind({});
|
|
23
|
+
Placeholder.args = {
|
|
24
|
+
placeholder: 'Enter message...',
|
|
25
|
+
};
|
|
26
|
+
export const Disabled = Template.bind({});
|
|
27
|
+
Disabled.args = {
|
|
28
|
+
disabled: true,
|
|
29
|
+
};
|
|
30
|
+
export const HandlingStateExternallyWithRef = () => {
|
|
31
|
+
const [value, setValue] = React.useState('starting value');
|
|
32
|
+
const editorRef = React.useRef(null);
|
|
33
|
+
const handleClick = (ref) => {
|
|
34
|
+
setValue('');
|
|
35
|
+
ref.current.clearContent();
|
|
36
|
+
};
|
|
37
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { label: "Clear input!", colored: "red", onClick: () => handleClick(editorRef) }), _jsx(RichTextInput, { value: value, onChange: setValue, ref: editorRef }), _jsx("pre", { children: _jsx("strong", { children: "Markdown output:" }) }), _jsx("pre", { children: value })] }));
|
|
38
|
+
};
|
|
39
|
+
const SelectorComponent = (_jsx(Select, { options: [
|
|
40
|
+
{
|
|
41
|
+
label: 'Aardvarks',
|
|
42
|
+
value: 'termites',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: 'Kangaroos',
|
|
46
|
+
value: 'grass',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: 'Koalas',
|
|
50
|
+
value: 'leaves',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: 'Wombats',
|
|
54
|
+
value: 'bark',
|
|
55
|
+
},
|
|
56
|
+
], width: "auto", value: "termites", small: true }));
|
|
57
|
+
export const WithToolbarComponent = Template.bind({});
|
|
58
|
+
WithToolbarComponent.args = {
|
|
59
|
+
toolbarComponent: SelectorComponent,
|
|
60
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import 'remirror/styles/all.css';
|
|
3
|
+
export interface IRichTextToolbarProps {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
toolbarComponent?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const RichTextToolbar: ({ disabled, toolbarComponent, }: IRichTextToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useActive, useCommands } from '@remirror/react';
|
|
3
|
+
import 'remirror/styles/all.css';
|
|
4
|
+
import { Button } from '../../button/button';
|
|
5
|
+
import styles from './rich-text-toolbar.module.less';
|
|
6
|
+
import { RichTextIcon } from './enum';
|
|
7
|
+
import { Color } from '../../../common-enum';
|
|
8
|
+
export const RichTextToolbar = ({ disabled = false, toolbarComponent = null, }) => {
|
|
9
|
+
const { focus, toggleBold, toggleBulletList, toggleCode, toggleItalic, toggleOrderedList, } = useCommands();
|
|
10
|
+
const active = useActive();
|
|
11
|
+
const items = [
|
|
12
|
+
{
|
|
13
|
+
icon: RichTextIcon.BOLD,
|
|
14
|
+
onClick: toggleBold,
|
|
15
|
+
active: active.bold(),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
icon: RichTextIcon.ITALIC,
|
|
19
|
+
onClick: toggleItalic,
|
|
20
|
+
active: active.italic(),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
icon: RichTextIcon.CODE,
|
|
24
|
+
onClick: toggleCode,
|
|
25
|
+
active: active.code(),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
icon: RichTextIcon.UL,
|
|
29
|
+
onClick: toggleBulletList,
|
|
30
|
+
active: active.bulletList(),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
icon: RichTextIcon.OL,
|
|
34
|
+
onClick: toggleOrderedList,
|
|
35
|
+
active: active.orderedList(),
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
return (_jsxs("div", { className: styles.richTextToolbarContainer, children: [_jsx("div", { className: styles.richTextToolbar, children: items.map((item, index) => (_jsx(Button, { small: true, round: true, basic: true, icon: item.icon, colored: Color.MUTED, onClick: () => {
|
|
39
|
+
item.onClick();
|
|
40
|
+
focus();
|
|
41
|
+
}, active: item.active, disabled: disabled }, index))) }), toolbarComponent] }));
|
|
42
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ChangeEvent, ReactNode } from 'react';
|
|
2
|
+
import { ISelectSelectedOption } from '../select.interface';
|
|
3
|
+
import { GroupOrder } from "../../../common-enum";
|
|
4
|
+
interface Heading {
|
|
5
|
+
label: string | number;
|
|
6
|
+
type: string;
|
|
7
|
+
}
|
|
8
|
+
export type TCustomSelectSelectOption = ISelectSelectedOption | Heading;
|
|
9
|
+
export type TSelectedOptionsIndexType = keyof ISelectSelectedOption;
|
|
10
|
+
export type ICustomSelectOptionType = {
|
|
11
|
+
createAble?: boolean;
|
|
12
|
+
label?: string;
|
|
13
|
+
value?: string | number;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
details?: string;
|
|
16
|
+
};
|
|
17
|
+
export type ICustomSelectScrollableComponent = {
|
|
18
|
+
scrollToItem: (index: number) => void;
|
|
19
|
+
};
|
|
20
|
+
export interface ICustomSelectProps {
|
|
21
|
+
multi?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
error?: string | number | ReactNode;
|
|
24
|
+
warning?: string | number | ReactNode;
|
|
25
|
+
tooltip?: string | number | ReactNode;
|
|
26
|
+
options: TCustomSelectSelectOption[];
|
|
27
|
+
selectedOptions: ISelectSelectedOption | ISelectSelectedOption[];
|
|
28
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>, newSelectedOptions: ISelectSelectedOption) => void;
|
|
29
|
+
onCreate?: (value: string) => void;
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
small?: boolean;
|
|
32
|
+
tabIndex?: number;
|
|
33
|
+
width?: string | number | null;
|
|
34
|
+
autoLayerWidth?: boolean;
|
|
35
|
+
onFocus?: () => void;
|
|
36
|
+
onBlur?: () => void;
|
|
37
|
+
searchable?: boolean;
|
|
38
|
+
clearable?: boolean;
|
|
39
|
+
isInTable?: boolean;
|
|
40
|
+
groupOrder?: GroupOrder;
|
|
41
|
+
firstSelectedOptionIndex: number | null;
|
|
42
|
+
right?: boolean;
|
|
43
|
+
maxTooltipWidth?: string | number;
|
|
44
|
+
closeOnOptionActionClick?: boolean;
|
|
45
|
+
testId?: string | undefined;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useReducer, useRef } from "react";
|
|
3
|
+
import { mergeRefs } from "react-laag";
|
|
4
|
+
import KeyboardEventHandler from "@infinium/react-keyboard-event-handler";
|
|
5
|
+
import { useFocus, useFontsReady } from "../../../hooks";
|
|
6
|
+
import { Layer } from "./layer/layer";
|
|
7
|
+
import { Trigger } from "./trigger/trigger";
|
|
8
|
+
import { initialLayerFocus, initialTriggerFocus, reducer } from "./custom-select.reducer";
|
|
9
|
+
import styles from "./custom-select.module.less";
|
|
10
|
+
import { DisabledContext } from "../../../helpers/disabled-context";
|
|
11
|
+
import { useCustomSelectLogic } from "./hooks/use-custom-select-logic";
|
|
12
|
+
import { EventKey } from "./hooks/enum";
|
|
13
|
+
// TODO - @Oleg & @Jack - revisit and fix types
|
|
14
|
+
export const CustomSelect = (props) => {
|
|
15
|
+
const { multi: isMulti = false, disabled = false, error = null, warning = null, tooltip = null, options, selectedOptions, onCreate = null, placeholder = '', small = false, tabIndex = 0, onFocus = () => { }, onBlur = () => { }, searchable = true, clearable = false, maxTooltipWidth, closeOnOptionActionClick,
|
|
16
|
+
//private props (don't use)
|
|
17
|
+
isInTable = false, groupOrder, firstSelectedOptionIndex = 0, right = false, testId = undefined, } = props;
|
|
18
|
+
const disabledContext = useContext(DisabledContext);
|
|
19
|
+
const createAble = onCreate !== null;
|
|
20
|
+
const listRef = useRef(null);
|
|
21
|
+
const [triggerRef, setTriggerFocus] = useFocus();
|
|
22
|
+
const isFontLoaded = useFontsReady();
|
|
23
|
+
const [state, dispatch] = useReducer(reducer,
|
|
24
|
+
// @ts-ignore: write explicit reason: write explicit reason
|
|
25
|
+
{ options, firstSelectedOptionIndex }, ({ options }) => ({
|
|
26
|
+
searchValue: '',
|
|
27
|
+
visibleOptions: options,
|
|
28
|
+
layerFocus: initialLayerFocus(options, firstSelectedOptionIndex ?? 0),
|
|
29
|
+
triggerFocus: initialTriggerFocus,
|
|
30
|
+
isLayerOpen: false,
|
|
31
|
+
}));
|
|
32
|
+
const { getTriggerWidth, onKeyEvent, clearAllIsFocused, triggerProps, onClickTrigger, onChangeSearch, onClickDeselectOption, onClickClearAll, renderLayer, layerProps, closeLayer, onSelectOption, getLayerWidth, triggerBounds, } = useCustomSelectLogic({
|
|
33
|
+
...props,
|
|
34
|
+
state,
|
|
35
|
+
dispatch,
|
|
36
|
+
setTriggerFocus,
|
|
37
|
+
disabledContext,
|
|
38
|
+
isFontLoaded,
|
|
39
|
+
createAble,
|
|
40
|
+
listRef,
|
|
41
|
+
});
|
|
42
|
+
return (_jsx("div", { style: { width: getTriggerWidth() }, children: _jsxs(KeyboardEventHandler, { handleKeys: Object.values(EventKey), onKeyEvent: onKeyEvent, children: [_jsx(Trigger, { selectedOptions: selectedOptions, searchValue: state.searchValue, isOpen: state.isLayerOpen, focusedSelectedOptionIndex: state.triggerFocus.currentOption, clearAllIsFocused: clearAllIsFocused, searchable: searchable, triggerRef: mergeRefs(triggerRef, triggerProps.ref), error: error, warning: warning, tooltip: tooltip, small: small, isInTable: isInTable, disabled: disabled || disabledContext, clearable: clearable, tabIndex: tabIndex, onClickTrigger: onClickTrigger, onChangeSearch: onChangeSearch, onClickDeselect: onClickDeselectOption, onClickClear: onClickClearAll, onFocus: onFocus, onBlur: onBlur, groupOrder: groupOrder, maxTooltipWidth: maxTooltipWidth, placeholder: placeholder, right: right, testId: testId }), state.isLayerOpen &&
|
|
43
|
+
renderLayer(_jsx("div", { ...layerProps, className: styles.layerContainer, children: _jsx(Layer, { listRef: listRef, isMulti: isMulti, sections: state.visibleOptions, selectedOptions: selectedOptions, onSelectOption: (evt, option) => {
|
|
44
|
+
const close = !isMulti ? closeLayer : undefined;
|
|
45
|
+
onSelectOption(evt, option, close);
|
|
46
|
+
}, closeLayer: () => {
|
|
47
|
+
if (closeOnOptionActionClick) {
|
|
48
|
+
closeLayer();
|
|
49
|
+
}
|
|
50
|
+
}, width: getLayerWidth(triggerBounds), small: small, focusedOptionIndex: state.layerFocus.current, firstSelectedOptionIndex: firstSelectedOptionIndex ?? 0, testId: testId && `${testId}-layer` }) }))] }) }));
|
|
51
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ICustomSelectAction, ICustomSelectDirection, ICustomSelectLayerFocus, ICustomSelectState, ICustomSelectTriggerFocus } from "./reducer.interface";
|
|
2
|
+
import { TCustomSelectSelectOption } from "./custom-select.interface";
|
|
3
|
+
export declare const initialTriggerFocus: ICustomSelectTriggerFocus;
|
|
4
|
+
export declare const initialLayerFocus: (options: TCustomSelectSelectOption[], firstSelectedOptionIndex: number) => ICustomSelectLayerFocus;
|
|
5
|
+
export declare const nextLayerFocus: (direction: ICustomSelectDirection, layerFocus: ICustomSelectLayerFocus) => ICustomSelectLayerFocus;
|
|
6
|
+
export declare const reducer: (state: ICustomSelectState, action: ICustomSelectAction) => ICustomSelectState;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { MenuType } from "../../menu/enum";
|
|
2
|
+
import { ReducerAction } from "./enum";
|
|
3
|
+
export const initialTriggerFocus = {
|
|
4
|
+
options: ['none', 'clearAll'],
|
|
5
|
+
currentIndex: 0,
|
|
6
|
+
currentOption: false,
|
|
7
|
+
clearAll: false,
|
|
8
|
+
};
|
|
9
|
+
const initialLayerFocusIndex = (firstSelectedOptionIndex) => firstSelectedOptionIndex !== null ? firstSelectedOptionIndex + 1 : 0;
|
|
10
|
+
export const initialLayerFocus = (options, firstSelectedOptionIndex) => {
|
|
11
|
+
const layerFocusOptions = [
|
|
12
|
+
'none',
|
|
13
|
+
...options
|
|
14
|
+
.map((o, i) => (o.type !== MenuType.HEADING ? i : null))
|
|
15
|
+
.filter((o) => o !== null),
|
|
16
|
+
];
|
|
17
|
+
const layerFocusIndex = initialLayerFocusIndex(firstSelectedOptionIndex);
|
|
18
|
+
return {
|
|
19
|
+
options: layerFocusOptions,
|
|
20
|
+
currentIndex: layerFocusIndex,
|
|
21
|
+
current: layerFocusOptions[layerFocusIndex],
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export const nextLayerFocus = (direction, layerFocus) => {
|
|
25
|
+
const sign = direction === 'up' ? -1 : 1;
|
|
26
|
+
const increment = layerFocus.currentIndex + sign;
|
|
27
|
+
const nextIndex = (increment < 0 ? layerFocus.options.length - 1 : increment) %
|
|
28
|
+
layerFocus.options.length;
|
|
29
|
+
const next = layerFocus.options[nextIndex];
|
|
30
|
+
return {
|
|
31
|
+
...layerFocus,
|
|
32
|
+
currentIndex: nextIndex,
|
|
33
|
+
current: next,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const nextTriggerFocus = (direction, selectedOptions, triggerFocus) => {
|
|
37
|
+
const sign = direction === 'left' ? -1 : 1;
|
|
38
|
+
const nextOptions = selectedOptions && selectedOptions.length
|
|
39
|
+
? [
|
|
40
|
+
'none',
|
|
41
|
+
...Array.from({ length: selectedOptions.length }, (_, i) => i),
|
|
42
|
+
'clearAll',
|
|
43
|
+
]
|
|
44
|
+
: ['none', 'clearAll'];
|
|
45
|
+
const increment = triggerFocus.currentIndex + sign;
|
|
46
|
+
const nextIndex = (increment < 0 ? nextOptions.length - 1 : increment) % nextOptions.length;
|
|
47
|
+
const next = nextOptions[nextIndex];
|
|
48
|
+
const clearAll = next === 'clearAll';
|
|
49
|
+
return {
|
|
50
|
+
options: nextOptions,
|
|
51
|
+
currentIndex: nextIndex,
|
|
52
|
+
currentOption: next,
|
|
53
|
+
clearAll,
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const blurTriggerFocus = () => initialTriggerFocus;
|
|
57
|
+
const blurLayerFocus = (layerFocus) => ({
|
|
58
|
+
...layerFocus,
|
|
59
|
+
currentIndex: 0,
|
|
60
|
+
current: 'none',
|
|
61
|
+
});
|
|
62
|
+
export const reducer = (state, action) => {
|
|
63
|
+
switch (action.type) {
|
|
64
|
+
case ReducerAction.SET_VISIBLE_OPTIONS: {
|
|
65
|
+
return {
|
|
66
|
+
...state,
|
|
67
|
+
visibleOptions: action.options || [],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
case ReducerAction.RESET_LAYER_FOCUS: {
|
|
71
|
+
return {
|
|
72
|
+
...state,
|
|
73
|
+
layerFocus: initialLayerFocus(action.options || [], action.firstSelectedOptionIndex || 0),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
case ReducerAction.CLEAR_SEARCH: {
|
|
77
|
+
return {
|
|
78
|
+
...state,
|
|
79
|
+
visibleOptions: action.options || [],
|
|
80
|
+
searchValue: '',
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
case ReducerAction.ON_CHANGE_SEARCH: {
|
|
84
|
+
const visibleOptions = (action.options || []).filter((o) => (String(o.label) + (o.details ? String(o.details) : ''))
|
|
85
|
+
.toLowerCase()
|
|
86
|
+
.includes(String(action.value || '').toLowerCase()));
|
|
87
|
+
let newVisibleOptions = [...visibleOptions];
|
|
88
|
+
if (action.createAble && action.value && action.value !== '') {
|
|
89
|
+
newVisibleOptions.push({
|
|
90
|
+
label: `Create "${action.value}"`,
|
|
91
|
+
value: action.value,
|
|
92
|
+
createAble: true,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
...state,
|
|
97
|
+
searchValue: action.value,
|
|
98
|
+
visibleOptions: newVisibleOptions,
|
|
99
|
+
layerFocus: blurLayerFocus(state.layerFocus),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
case ReducerAction.FOCUS_TRIGGER_INPUTS: {
|
|
103
|
+
return {
|
|
104
|
+
...state,
|
|
105
|
+
triggerFocus: nextTriggerFocus(action.direction || 'right', action.selectedOptions || [], state.triggerFocus),
|
|
106
|
+
layerFocus: blurLayerFocus(state.layerFocus),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
case ReducerAction.BLUR_TRIGGER_INPUTS: {
|
|
110
|
+
return {
|
|
111
|
+
...state,
|
|
112
|
+
triggerFocus: blurTriggerFocus(),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
case ReducerAction.FOCUS_LAYER_OPTIONS: {
|
|
116
|
+
if (!action.nextLayerFocus) {
|
|
117
|
+
return state;
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
...state,
|
|
121
|
+
layerFocus: action.nextLayerFocus,
|
|
122
|
+
triggerFocus: blurTriggerFocus(),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
case ReducerAction.OPEN_LAYER: {
|
|
126
|
+
return {
|
|
127
|
+
...state,
|
|
128
|
+
isLayerOpen: true,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
case ReducerAction.CLOSE_LAYER: {
|
|
132
|
+
return {
|
|
133
|
+
...state,
|
|
134
|
+
isLayerOpen: false,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
default:
|
|
138
|
+
return state;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum ReducerAction {
|
|
2
|
+
SET_VISIBLE_OPTIONS = "SET_VISIBLE_OPTIONS",
|
|
3
|
+
RESET_LAYER_FOCUS = "RESET_LAYER_FOCUS",
|
|
4
|
+
CLEAR_SEARCH = "CLEAR_SEARCH",
|
|
5
|
+
ON_CHANGE_SEARCH = "ON_CHANGE_SEARCH",
|
|
6
|
+
FOCUS_TRIGGER_INPUTS = "FOCUS_TRIGGER_INPUTS",
|
|
7
|
+
BLUR_TRIGGER_INPUTS = "BLUR_TRIGGER_INPUTS",
|
|
8
|
+
FOCUS_LAYER_OPTIONS = "FOCUS_LAYER_OPTIONS",
|
|
9
|
+
OPEN_LAYER = "OPEN_LAYER",
|
|
10
|
+
CLOSE_LAYER = "CLOSE_LAYER"
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var ReducerAction;
|
|
2
|
+
(function (ReducerAction) {
|
|
3
|
+
ReducerAction["SET_VISIBLE_OPTIONS"] = "SET_VISIBLE_OPTIONS";
|
|
4
|
+
ReducerAction["RESET_LAYER_FOCUS"] = "RESET_LAYER_FOCUS";
|
|
5
|
+
ReducerAction["CLEAR_SEARCH"] = "CLEAR_SEARCH";
|
|
6
|
+
ReducerAction["ON_CHANGE_SEARCH"] = "ON_CHANGE_SEARCH";
|
|
7
|
+
ReducerAction["FOCUS_TRIGGER_INPUTS"] = "FOCUS_TRIGGER_INPUTS";
|
|
8
|
+
ReducerAction["BLUR_TRIGGER_INPUTS"] = "BLUR_TRIGGER_INPUTS";
|
|
9
|
+
ReducerAction["FOCUS_LAYER_OPTIONS"] = "FOCUS_LAYER_OPTIONS";
|
|
10
|
+
ReducerAction["OPEN_LAYER"] = "OPEN_LAYER";
|
|
11
|
+
ReducerAction["CLOSE_LAYER"] = "CLOSE_LAYER";
|
|
12
|
+
})(ReducerAction || (ReducerAction = {}));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ISelectSelectedOption } from '../select.interface';
|
|
2
|
+
export declare const getWidestOptionWidth: (options: ISelectSelectedOption[], small: boolean, isFontLoaded: boolean, placeholder?: string) => number;
|
|
3
|
+
export declare const getMultiOptionWidth: (option: ISelectSelectedOption, small?: boolean, isFontLoaded?: boolean) => number;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getTextWidth } from '../../../helpers/text';
|
|
2
|
+
// TODO: Draw these values from global design tokens shared with stylesheets (e.g. https://amzn.github.io/style-dictionary/)
|
|
3
|
+
const FONT_SIZE = '14px';
|
|
4
|
+
const FONT_SIZE_SMALL = '12px';
|
|
5
|
+
const FONT_FAMILY = 'Lato';
|
|
6
|
+
const FONT_FAMILY_FALLBACK = 'sans-serif';
|
|
7
|
+
// Input padding on left
|
|
8
|
+
const PADDING = 14;
|
|
9
|
+
const PADDING_SMALL = 7;
|
|
10
|
+
// Width of toggle icon on right
|
|
11
|
+
const TOGGLE_SIZE = 38;
|
|
12
|
+
const TOGGLE_SIZE_SMALL = 24;
|
|
13
|
+
// Selected option tags
|
|
14
|
+
const TAG_PADDING = 5;
|
|
15
|
+
const TAG_PADDING_SMALL = 3;
|
|
16
|
+
const TAG_BORDER_WIDTH = 1;
|
|
17
|
+
const TAG_MARGIN = 2;
|
|
18
|
+
const getFont = (small = false, isFontLoaded = false) => {
|
|
19
|
+
const fontSize = small ? FONT_SIZE_SMALL : FONT_SIZE;
|
|
20
|
+
const fontFamily = isFontLoaded ? FONT_FAMILY : FONT_FAMILY_FALLBACK;
|
|
21
|
+
return `${fontSize} ${fontFamily}`;
|
|
22
|
+
};
|
|
23
|
+
const getExtraOptionWidth = (small = false, scrollbar = false) => {
|
|
24
|
+
// Scrollbar upper limit suggested on https://adminhacks.com/browser-scrollbar-widths.html
|
|
25
|
+
const SCROLLBAR_WIDTH = 17;
|
|
26
|
+
return ((small ? PADDING_SMALL : PADDING) +
|
|
27
|
+
(small ? TOGGLE_SIZE_SMALL : TOGGLE_SIZE) +
|
|
28
|
+
(scrollbar ? SCROLLBAR_WIDTH : 0));
|
|
29
|
+
};
|
|
30
|
+
export const getWidestOptionWidth = (options, small, isFontLoaded, placeholder) => {
|
|
31
|
+
const font = getFont(small, isFontLoaded);
|
|
32
|
+
const placeholderWidth = placeholder
|
|
33
|
+
? getTextWidth(placeholder, font)
|
|
34
|
+
: 0;
|
|
35
|
+
const widestTextWidth = Math.ceil(options.reduce((acc, option) => {
|
|
36
|
+
const optionActionsWidth = (option?.actions?.length ?? 0) * 24; // actions width
|
|
37
|
+
const optionIconWidth = option.icon
|
|
38
|
+
? (small ? parseInt(FONT_SIZE_SMALL) : parseInt(FONT_SIZE)) + 7
|
|
39
|
+
: 0;
|
|
40
|
+
const optionsText = `${option.label} ${option.details || ''}`;
|
|
41
|
+
const optionWidth = getTextWidth(optionsText, font) + optionActionsWidth + optionIconWidth;
|
|
42
|
+
acc = optionWidth > acc ? optionWidth : acc;
|
|
43
|
+
return acc;
|
|
44
|
+
}, placeholderWidth));
|
|
45
|
+
const extraWidth = getExtraOptionWidth(small, true);
|
|
46
|
+
return widestTextWidth + extraWidth;
|
|
47
|
+
};
|
|
48
|
+
export const getMultiOptionWidth = (option, small, isFontLoaded) => {
|
|
49
|
+
const font = getFont(true, isFontLoaded);
|
|
50
|
+
const textWidth = getTextWidth(option.label, font);
|
|
51
|
+
const extraWidth = (small ? TAG_PADDING_SMALL : TAG_PADDING) * 2 +
|
|
52
|
+
TAG_BORDER_WIDTH * 2 +
|
|
53
|
+
TAG_MARGIN;
|
|
54
|
+
return Math.ceil(textWidth + extraWidth);
|
|
55
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum ActionTypes {
|
|
2
|
+
CLOSE_LAYER = "CLOSE_LAYER",
|
|
3
|
+
OPEN_LAYER = "OPEN_LAYER",
|
|
4
|
+
SET_VISIBLE_OPTIONS = "SET_VISIBLE_OPTIONS",
|
|
5
|
+
CLEAR_SEARCH = "CLEAR_SEARCH",
|
|
6
|
+
RESET_LAYER_FOCUS = "RESET_LAYER_FOCUS",
|
|
7
|
+
FOCUS_LAYER_OPTIONS = "FOCUS_LAYER_OPTIONS",
|
|
8
|
+
BLUR_TRIGGER_INPUTS = "BLUR_TRIGGER_INPUTS",
|
|
9
|
+
FOCUS_TRIGGER_INPUTS = "FOCUS_TRIGGER_INPUTS",
|
|
10
|
+
ON_CHANGE_SEARCH = "ON_CHANGE_SEARCH"
|
|
11
|
+
}
|
|
12
|
+
export declare enum EventKey {
|
|
13
|
+
RIGHT = "right",
|
|
14
|
+
LEFT = "left",
|
|
15
|
+
UP = "up",
|
|
16
|
+
DOWN = "down",
|
|
17
|
+
ENTER = "enter",
|
|
18
|
+
ESC = "esc",
|
|
19
|
+
TAB = "tab"
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export var ActionTypes;
|
|
2
|
+
(function (ActionTypes) {
|
|
3
|
+
ActionTypes["CLOSE_LAYER"] = "CLOSE_LAYER";
|
|
4
|
+
ActionTypes["OPEN_LAYER"] = "OPEN_LAYER";
|
|
5
|
+
ActionTypes["SET_VISIBLE_OPTIONS"] = "SET_VISIBLE_OPTIONS";
|
|
6
|
+
ActionTypes["CLEAR_SEARCH"] = "CLEAR_SEARCH";
|
|
7
|
+
ActionTypes["RESET_LAYER_FOCUS"] = "RESET_LAYER_FOCUS";
|
|
8
|
+
ActionTypes["FOCUS_LAYER_OPTIONS"] = "FOCUS_LAYER_OPTIONS";
|
|
9
|
+
ActionTypes["BLUR_TRIGGER_INPUTS"] = "BLUR_TRIGGER_INPUTS";
|
|
10
|
+
ActionTypes["FOCUS_TRIGGER_INPUTS"] = "FOCUS_TRIGGER_INPUTS";
|
|
11
|
+
ActionTypes["ON_CHANGE_SEARCH"] = "ON_CHANGE_SEARCH";
|
|
12
|
+
})(ActionTypes || (ActionTypes = {}));
|
|
13
|
+
export var EventKey;
|
|
14
|
+
(function (EventKey) {
|
|
15
|
+
EventKey["RIGHT"] = "right";
|
|
16
|
+
EventKey["LEFT"] = "left";
|
|
17
|
+
EventKey["UP"] = "up";
|
|
18
|
+
EventKey["DOWN"] = "down";
|
|
19
|
+
EventKey["ENTER"] = "enter";
|
|
20
|
+
EventKey["ESC"] = "esc";
|
|
21
|
+
EventKey["TAB"] = "tab";
|
|
22
|
+
})(EventKey || (EventKey = {}));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { ChangeEvent } from "react";
|
|
2
|
+
import { ISelectSelectedOption } from "../../select.interface";
|
|
3
|
+
import { ICustomSelectDirection, ICustomSelectState } from "../reducer.interface";
|
|
4
|
+
import { TCustomSelectSelectOption } from "../custom-select.interface";
|
|
5
|
+
export interface UseCustomSelectLogicProps {
|
|
6
|
+
state: ICustomSelectState;
|
|
7
|
+
dispatch: (action: any) => void;
|
|
8
|
+
options: TCustomSelectSelectOption[];
|
|
9
|
+
setTriggerFocus: () => void;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
disabledContext: boolean;
|
|
12
|
+
onCreate: ((value: string) => void) | null;
|
|
13
|
+
onChange: ((evt: any, selected: any) => void) | null;
|
|
14
|
+
selectedOptions: ISelectSelectedOption | ISelectSelectedOption[];
|
|
15
|
+
width: string | number | null;
|
|
16
|
+
small: boolean;
|
|
17
|
+
isFontLoaded: boolean;
|
|
18
|
+
placeholder: string;
|
|
19
|
+
firstSelectedOptionIndex: number;
|
|
20
|
+
createAble: boolean;
|
|
21
|
+
listRef: React.RefObject<any>;
|
|
22
|
+
autoLayerWidth: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const useCustomSelectLogic: ({ state, dispatch, options, setTriggerFocus, disabled, disabledContext, onCreate, onChange, selectedOptions, width, small, isFontLoaded, placeholder, firstSelectedOptionIndex, createAble, listRef, autoLayerWidth, }: UseCustomSelectLogicProps) => {
|
|
25
|
+
getTriggerWidth: () => string | number;
|
|
26
|
+
onKeyEvent: (key: string | ICustomSelectDirection, evt: KeyboardEvent) => void;
|
|
27
|
+
clearAllIsFocused: boolean;
|
|
28
|
+
triggerProps: import("react-laag").TriggerProps;
|
|
29
|
+
onClickTrigger: () => void;
|
|
30
|
+
onChangeSearch: (value: any) => void;
|
|
31
|
+
onClickDeselectOption: (evt: any, options?: any) => void;
|
|
32
|
+
onClickClearAll: (evt: ChangeEvent<any>) => void;
|
|
33
|
+
renderLayer: (children: React.ReactNode) => React.ReactPortal | null;
|
|
34
|
+
layerProps: import("react-laag").LayerProps;
|
|
35
|
+
closeLayer: () => void;
|
|
36
|
+
onSelectOption: (evt: any, option?: any, close?: () => void) => void;
|
|
37
|
+
getLayerWidth: (triggerBounds: any) => any;
|
|
38
|
+
triggerBounds: ClientRect | null;
|
|
39
|
+
};
|