@carbon/web-components 2.0.0-beta.2 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/custom-elements.json +4026 -1801
- package/es/components/breadcrumb/breadcrumb.css.js +1 -1
- package/es/components/breadcrumb/breadcrumb.rtl.css.js +1 -1
- package/es/components/button/button.css.js +1 -1
- package/es/components/button/button.d.ts +12 -4
- package/es/components/button/button.d.ts.map +1 -1
- package/es/components/button/button.js +57 -19
- package/es/components/button/button.js.map +1 -1
- package/es/components/button/button.rtl.css.js +1 -1
- package/es/components/checkbox/checkbox.css.js +1 -1
- package/es/components/checkbox/checkbox.d.ts +9 -0
- package/es/components/checkbox/checkbox.d.ts.map +1 -1
- package/es/components/checkbox/checkbox.js +32 -1
- package/es/components/checkbox/checkbox.js.map +1 -1
- package/es/components/checkbox/checkbox.rtl.css.js +1 -1
- package/es/components/code-snippet/code-snippet-skeleton.d.ts +2 -2
- package/es/components/code-snippet/code-snippet-skeleton.d.ts.map +1 -1
- package/es/components/code-snippet/code-snippet-skeleton.js +4 -4
- package/es/components/code-snippet/code-snippet-skeleton.js.map +1 -1
- package/es/components/code-snippet/code-snippet.css.js +1 -1
- package/es/components/code-snippet/code-snippet.d.ts +75 -29
- package/es/components/code-snippet/code-snippet.d.ts.map +1 -1
- package/es/components/code-snippet/code-snippet.js +370 -164
- package/es/components/code-snippet/code-snippet.js.map +1 -1
- package/es/components/code-snippet/code-snippet.rtl.css.js +1 -1
- package/es/components/copy/copy.d.ts +1 -2
- package/es/components/copy/copy.d.ts.map +1 -1
- package/es/components/copy/copy.js +6 -13
- package/es/components/copy/copy.js.map +1 -1
- package/es/components/copy-button/copy-button.css.js +1 -1
- package/es/components/copy-button/copy-button.d.ts +8 -0
- package/es/components/copy-button/copy-button.d.ts.map +1 -1
- package/es/components/copy-button/copy-button.js +38 -2
- package/es/components/copy-button/copy-button.js.map +1 -1
- package/es/components/copy-button/copy-button.rtl.css.js +1 -1
- package/es/components/data-table/data-table.css.js +1 -1
- package/es/components/data-table/data-table.rtl.css.js +1 -1
- package/es/components/data-table/defs.d.ts +0 -13
- package/es/components/data-table/defs.d.ts.map +1 -1
- package/es/components/data-table/defs.js +0 -9
- package/es/components/data-table/defs.js.map +1 -1
- package/es/components/data-table/index.d.ts +6 -5
- package/es/components/data-table/index.d.ts.map +1 -1
- package/es/components/data-table/index.js +6 -5
- package/es/components/data-table/index.js.map +1 -1
- package/es/components/data-table/table-batch-actions.d.ts +7 -2
- package/es/components/data-table/table-batch-actions.d.ts.map +1 -1
- package/es/components/data-table/table-batch-actions.js +25 -6
- package/es/components/data-table/table-batch-actions.js.map +1 -1
- package/es/components/data-table/table-body.d.ts +8 -4
- package/es/components/data-table/table-body.d.ts.map +1 -1
- package/es/components/data-table/table-body.js +21 -14
- package/es/components/data-table/table-body.js.map +1 -1
- package/es/components/data-table/table-cell-content.d.ts +21 -0
- package/es/components/data-table/table-cell-content.d.ts.map +1 -0
- package/es/components/data-table/table-cell-content.js +53 -0
- package/es/components/data-table/table-cell-content.js.map +1 -0
- package/es/components/data-table/table-cell.d.ts +15 -2
- package/es/components/data-table/table-cell.d.ts.map +1 -1
- package/es/components/data-table/table-cell.js +43 -8
- package/es/components/data-table/table-cell.js.map +1 -1
- package/es/components/data-table/table-expanded-row.d.ts +336 -2
- package/es/components/data-table/table-expanded-row.d.ts.map +1 -1
- package/es/components/data-table/table-expanded-row.js +69 -16
- package/es/components/data-table/table-expanded-row.js.map +1 -1
- package/es/components/data-table/table-head.d.ts +7 -2
- package/es/components/data-table/table-head.d.ts.map +1 -1
- package/es/components/data-table/table-head.js +15 -6
- package/es/components/data-table/table-head.js.map +1 -1
- package/es/components/data-table/table-header-cell.d.ts +21 -3
- package/es/components/data-table/table-header-cell.d.ts.map +1 -1
- package/es/components/data-table/table-header-cell.js +67 -10
- package/es/components/data-table/table-header-cell.js.map +1 -1
- package/es/components/data-table/table-header-description.d.ts +21 -0
- package/es/components/data-table/table-header-description.d.ts.map +1 -0
- package/es/components/data-table/table-header-description.js +53 -0
- package/es/components/data-table/table-header-description.js.map +1 -0
- package/es/components/data-table/table-header-row.d.ts +3 -3
- package/es/components/data-table/table-header-row.d.ts.map +1 -1
- package/es/components/data-table/table-header-row.js +6 -6
- package/es/components/data-table/table-header-row.js.map +1 -1
- package/es/components/data-table/table-header-title.d.ts +21 -0
- package/es/components/data-table/table-header-title.d.ts.map +1 -0
- package/es/components/data-table/table-header-title.js +53 -0
- package/es/components/data-table/table-header-title.js.map +1 -0
- package/es/components/data-table/table-row.d.ts +413 -5
- package/es/components/data-table/table-row.d.ts.map +1 -1
- package/es/components/data-table/table-row.js +386 -45
- package/es/components/data-table/table-row.js.map +1 -1
- package/es/components/data-table/table-skeleton.d.ts +59 -0
- package/es/components/data-table/table-skeleton.d.ts.map +1 -0
- package/es/components/data-table/table-skeleton.js +259 -0
- package/es/components/data-table/table-skeleton.js.map +1 -0
- package/es/components/data-table/table-toolbar-content.d.ts +6 -2
- package/es/components/data-table/table-toolbar-content.d.ts.map +1 -1
- package/es/components/data-table/table-toolbar-content.js +21 -4
- package/es/components/data-table/table-toolbar-content.js.map +1 -1
- package/es/components/data-table/table-toolbar-search.d.ts +7 -3
- package/es/components/data-table/table-toolbar-search.d.ts.map +1 -1
- package/es/components/data-table/table-toolbar-search.js +25 -8
- package/es/components/data-table/table-toolbar-search.js.map +1 -1
- package/es/components/data-table/table-toolbar.d.ts +19 -2
- package/es/components/data-table/table-toolbar.d.ts.map +1 -1
- package/es/components/data-table/table-toolbar.js +68 -13
- package/es/components/data-table/table-toolbar.js.map +1 -1
- package/es/components/data-table/table.d.ts +556 -6
- package/es/components/data-table/table.d.ts.map +1 -1
- package/es/components/data-table/table.js +1012 -15
- package/es/components/data-table/table.js.map +1 -1
- package/es/components/dropdown/defs.d.ts +6 -6
- package/es/components/dropdown/defs.d.ts.map +1 -1
- package/es/components/dropdown/defs.js +2 -2
- package/es/components/dropdown/defs.js.map +1 -1
- package/es/components/dropdown/dropdown-item.d.ts.map +1 -1
- package/es/components/dropdown/dropdown-item.js +1 -1
- package/es/components/dropdown/dropdown-item.js.map +1 -1
- package/es/components/dropdown/dropdown.d.ts +9 -2
- package/es/components/dropdown/dropdown.d.ts.map +1 -1
- package/es/components/dropdown/dropdown.js +83 -62
- package/es/components/dropdown/dropdown.js.map +1 -1
- package/es/components/file-uploader/demo-file-uploader.d.ts +1 -1
- package/es/components/file-uploader/demo-file-uploader.d.ts.map +1 -1
- package/es/components/file-uploader/demo-file-uploader.js +38 -4
- package/es/components/file-uploader/demo-file-uploader.js.map +1 -1
- package/es/components/floating-menu/defs.d.ts +1 -39
- package/es/components/floating-menu/defs.d.ts.map +1 -1
- package/es/components/floating-menu/defs.js +2 -23
- package/es/components/floating-menu/defs.js.map +1 -1
- package/es/components/floating-menu/floating-menu-trigger.d.ts +3 -3
- package/es/components/floating-menu/floating-menu-trigger.d.ts.map +1 -1
- package/es/components/floating-menu/floating-menu.d.ts +11 -13
- package/es/components/floating-menu/floating-menu.d.ts.map +1 -1
- package/es/components/floating-menu/floating-menu.js +44 -54
- package/es/components/floating-menu/floating-menu.js.map +1 -1
- package/es/components/form/form-item.d.ts +2 -2
- package/es/components/form/form-item.d.ts.map +1 -1
- package/es/components/form/form-item.js +4 -4
- package/es/components/form/form-item.js.map +1 -1
- package/es/components/form-group/form-group.css.js +12 -0
- package/es/components/form-group/form-group.d.ts +44 -0
- package/es/components/form-group/form-group.d.ts.map +1 -0
- package/es/components/form-group/form-group.js +141 -0
- package/es/components/form-group/form-group.js.map +1 -0
- package/es/components/form-group/form-group.rtl.css.js +12 -0
- package/es/components/form-group/index.d.ts +11 -0
- package/es/components/form-group/index.d.ts.map +1 -0
- package/es/components/form-group/index.js +11 -0
- package/es/components/form-group/index.js.map +1 -0
- package/es/components/icon-button/icon-button.css.js +1 -1
- package/es/components/icon-button/icon-button.d.ts +1 -1
- package/es/components/icon-button/icon-button.d.ts.map +1 -1
- package/es/components/icon-button/icon-button.js +5 -3
- package/es/components/icon-button/icon-button.js.map +1 -1
- package/es/components/icon-button/icon-button.rtl.css.js +1 -1
- package/es/components/list/list.css.js +1 -1
- package/es/components/list/list.rtl.css.js +1 -1
- package/es/components/modal/defs.d.ts +3 -3
- package/es/components/modal/defs.d.ts.map +1 -1
- package/es/components/modal/defs.js +2 -2
- package/es/components/modal/defs.js.map +1 -1
- package/es/components/modal/index.d.ts +2 -1
- package/es/components/modal/index.d.ts.map +1 -1
- package/es/components/modal/index.js +2 -1
- package/es/components/modal/index.js.map +1 -1
- package/es/components/modal/modal-body-content.d.ts +21 -0
- package/es/components/modal/modal-body-content.d.ts.map +1 -0
- package/es/components/modal/modal-body-content.js +53 -0
- package/es/components/modal/modal-body-content.js.map +1 -0
- package/es/components/modal/modal-body.d.ts +2 -2
- package/es/components/modal/modal-body.d.ts.map +1 -1
- package/es/components/modal/modal-body.js +4 -4
- package/es/components/modal/modal-body.js.map +1 -1
- package/es/components/modal/modal-close-button.d.ts +5 -5
- package/es/components/modal/modal-close-button.d.ts.map +1 -1
- package/es/components/modal/modal-close-button.js +9 -9
- package/es/components/modal/modal-close-button.js.map +1 -1
- package/es/components/modal/modal-footer.d.ts +3 -3
- package/es/components/modal/modal-footer.d.ts.map +1 -1
- package/es/components/modal/modal-footer.js +13 -21
- package/es/components/modal/modal-footer.js.map +1 -1
- package/es/components/modal/modal-header.d.ts +2 -2
- package/es/components/modal/modal-header.d.ts.map +1 -1
- package/es/components/modal/modal-header.js +4 -4
- package/es/components/modal/modal-header.js.map +1 -1
- package/es/components/modal/modal-heading.d.ts +2 -2
- package/es/components/modal/modal-heading.d.ts.map +1 -1
- package/es/components/modal/modal-heading.js +4 -4
- package/es/components/modal/modal-heading.js.map +1 -1
- package/es/components/modal/modal-label.d.ts +2 -2
- package/es/components/modal/modal-label.d.ts.map +1 -1
- package/es/components/modal/modal-label.js +4 -4
- package/es/components/modal/modal-label.js.map +1 -1
- package/es/components/modal/modal.css.js +1 -1
- package/es/components/modal/modal.d.ts +33 -3
- package/es/components/modal/modal.d.ts.map +1 -1
- package/es/components/modal/modal.js +121 -14
- package/es/components/modal/modal.js.map +1 -1
- package/es/components/modal/modal.rtl.css.js +1 -1
- package/es/components/multi-select/defs.d.ts +27 -0
- package/es/components/multi-select/defs.d.ts.map +1 -0
- package/es/components/multi-select/defs.js +19 -0
- package/es/components/multi-select/defs.js.map +1 -0
- package/es/components/multi-select/multi-select-item.d.ts.map +1 -1
- package/es/components/multi-select/multi-select-item.js +9 -14
- package/es/components/multi-select/multi-select-item.js.map +1 -1
- package/es/components/multi-select/multi-select.css.js +1 -1
- package/es/components/multi-select/multi-select.d.ts +44 -5
- package/es/components/multi-select/multi-select.d.ts.map +1 -1
- package/es/components/multi-select/multi-select.js +250 -32
- package/es/components/multi-select/multi-select.js.map +1 -1
- package/es/components/multi-select/multi-select.rtl.css.js +1 -1
- package/es/components/number-input/number-input.css.js +1 -1
- package/es/components/number-input/number-input.d.ts.map +1 -1
- package/es/components/number-input/number-input.js +1 -1
- package/es/components/number-input/number-input.js.map +1 -1
- package/es/components/number-input/number-input.rtl.css.js +1 -1
- package/es/components/overflow-menu/defs.d.ts +4 -9
- package/es/components/overflow-menu/defs.d.ts.map +1 -1
- package/es/components/overflow-menu/defs.js +1 -4
- package/es/components/overflow-menu/defs.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu-body.d.ts +16 -15
- package/es/components/overflow-menu/overflow-menu-body.d.ts.map +1 -1
- package/es/components/overflow-menu/overflow-menu-body.js +49 -28
- package/es/components/overflow-menu/overflow-menu-body.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu-item.d.ts +12 -3
- package/es/components/overflow-menu/overflow-menu-item.d.ts.map +1 -1
- package/es/components/overflow-menu/overflow-menu-item.js +44 -12
- package/es/components/overflow-menu/overflow-menu-item.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu.css.js +1 -1
- package/es/components/overflow-menu/overflow-menu.d.ts +22 -10
- package/es/components/overflow-menu/overflow-menu.d.ts.map +1 -1
- package/es/components/overflow-menu/overflow-menu.js +89 -40
- package/es/components/overflow-menu/overflow-menu.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu.rtl.css.js +1 -1
- package/es/components/pagination/defs.d.ts +27 -0
- package/es/components/pagination/defs.d.ts.map +1 -0
- package/es/components/pagination/defs.js +19 -0
- package/es/components/pagination/defs.js.map +1 -0
- package/es/components/pagination/index.d.ts +1 -3
- package/es/components/pagination/index.d.ts.map +1 -1
- package/es/components/pagination/index.js +1 -3
- package/es/components/pagination/index.js.map +1 -1
- package/es/components/pagination/pagination.css.js +1 -1
- package/es/components/pagination/pagination.d.ts +55 -20
- package/es/components/pagination/pagination.d.ts.map +1 -1
- package/es/components/pagination/pagination.js +303 -123
- package/es/components/pagination/pagination.js.map +1 -1
- package/es/components/pagination/pagination.rtl.css.js +1 -1
- package/es/components/progress-indicator/progress-indicator-skeleton.d.ts +1 -2
- package/es/components/progress-indicator/progress-indicator-skeleton.d.ts.map +1 -1
- package/es/components/progress-indicator/progress-indicator-skeleton.js +5 -5
- package/es/components/progress-indicator/progress-indicator-skeleton.js.map +1 -1
- package/es/components/progress-indicator/progress-indicator.css.js +1 -1
- package/es/components/progress-indicator/progress-indicator.d.ts +8 -3
- package/es/components/progress-indicator/progress-indicator.d.ts.map +1 -1
- package/es/components/progress-indicator/progress-indicator.js +35 -8
- package/es/components/progress-indicator/progress-indicator.js.map +1 -1
- package/es/components/progress-indicator/progress-indicator.rtl.css.js +1 -1
- package/es/components/progress-indicator/progress-step-skeleton.d.ts +2 -2
- package/es/components/progress-indicator/progress-step-skeleton.d.ts.map +1 -1
- package/es/components/progress-indicator/progress-step-skeleton.js +12 -12
- package/es/components/progress-indicator/progress-step-skeleton.js.map +1 -1
- package/es/components/progress-indicator/progress-step.d.ts +11 -3
- package/es/components/progress-indicator/progress-step.d.ts.map +1 -1
- package/es/components/progress-indicator/progress-step.js +65 -24
- package/es/components/progress-indicator/progress-step.js.map +1 -1
- package/es/components/radio-button/radio-button.css.js +1 -1
- package/es/components/radio-button/radio-button.d.ts +4 -0
- package/es/components/radio-button/radio-button.d.ts.map +1 -1
- package/es/components/radio-button/radio-button.js +22 -0
- package/es/components/radio-button/radio-button.js.map +1 -1
- package/es/components/radio-button/radio-button.rtl.css.js +1 -1
- package/es/components/select/select.css.js +1 -1
- package/es/components/select/select.d.ts.map +1 -1
- package/es/components/select/select.js +3 -1
- package/es/components/select/select.js.map +1 -1
- package/es/components/select/select.rtl.css.js +1 -1
- package/es/components/slider/slider.css.js +1 -1
- package/es/components/slider/slider.rtl.css.js +1 -1
- package/es/components/stack/defs.d.ts +29 -0
- package/es/components/stack/defs.d.ts.map +1 -0
- package/es/components/stack/defs.js +31 -0
- package/es/components/stack/defs.js.map +1 -0
- package/es/components/stack/index.d.ts +11 -0
- package/es/components/stack/index.d.ts.map +1 -0
- package/es/components/stack/index.js +11 -0
- package/es/components/stack/index.js.map +1 -0
- package/es/components/stack/stack.css.js +12 -0
- package/es/components/stack/stack.d.ts +46 -0
- package/es/components/stack/stack.d.ts.map +1 -0
- package/es/components/stack/stack.js +116 -0
- package/es/components/stack/stack.js.map +1 -0
- package/es/components/stack/stack.rtl.css.js +12 -0
- package/es/components/structured-list/structured-list.css.js +1 -1
- package/es/components/structured-list/structured-list.d.ts +9 -0
- package/es/components/structured-list/structured-list.d.ts.map +1 -1
- package/es/components/structured-list/structured-list.js +47 -1
- package/es/components/structured-list/structured-list.js.map +1 -1
- package/es/components/structured-list/structured-list.rtl.css.js +1 -1
- package/es/components/tabs/tabs.css.js +1 -1
- package/es/components/tabs/tabs.rtl.css.js +1 -1
- package/es/components/text-input/defs.d.ts +38 -0
- package/es/components/text-input/defs.d.ts.map +1 -1
- package/es/components/text-input/defs.js +24 -3
- package/es/components/text-input/defs.js.map +1 -1
- package/es/components/text-input/text-input.d.ts +4 -5
- package/es/components/text-input/text-input.d.ts.map +1 -1
- package/es/components/text-input/text-input.js +5 -6
- package/es/components/text-input/text-input.js.map +1 -1
- package/es/components/textarea/textarea.d.ts.map +1 -1
- package/es/components/textarea/textarea.js +1 -1
- package/es/components/textarea/textarea.js.map +1 -1
- package/es/components/tile/expandable-tile.d.ts +1 -3
- package/es/components/tile/expandable-tile.d.ts.map +1 -1
- package/es/components/tile/expandable-tile.js +1 -1
- package/es/components/tile/expandable-tile.js.map +1 -1
- package/es/components/tile/radio-tile.d.ts.map +1 -1
- package/es/components/tile/radio-tile.js +2 -2
- package/es/components/tile/radio-tile.js.map +1 -1
- package/es/components/toggle-tip/toggletip.d.ts +1 -1
- package/es/components/toggle-tip/toggletip.d.ts.map +1 -1
- package/es/components/toggle-tip/toggletip.js +28 -3
- package/es/components/toggle-tip/toggletip.js.map +1 -1
- package/es/components/tooltip/tooltip.css.js +1 -1
- package/es/components/tooltip/tooltip.d.ts +12 -1
- package/es/components/tooltip/tooltip.d.ts.map +1 -1
- package/es/components/tooltip/tooltip.js +47 -1
- package/es/components/tooltip/tooltip.js.map +1 -1
- package/es/components/tooltip/tooltip.rtl.css.js +1 -1
- package/es/components/ui-shell/header-global-action.d.ts +31 -0
- package/es/components/ui-shell/header-global-action.d.ts.map +1 -0
- package/es/components/ui-shell/header-global-action.js +88 -0
- package/es/components/ui-shell/header-global-action.js.map +1 -0
- package/es/components/ui-shell/header-menu-button.d.ts +6 -6
- package/es/components/ui-shell/header-menu-button.d.ts.map +1 -1
- package/es/components/ui-shell/header-menu-button.js +10 -10
- package/es/components/ui-shell/header-menu-button.js.map +1 -1
- package/es/components/ui-shell/header-menu-item.d.ts +3 -3
- package/es/components/ui-shell/header-menu-item.d.ts.map +1 -1
- package/es/components/ui-shell/header-menu-item.js +6 -6
- package/es/components/ui-shell/header-menu-item.js.map +1 -1
- package/es/components/ui-shell/header-menu.d.ts +11 -3
- package/es/components/ui-shell/header-menu.d.ts.map +1 -1
- package/es/components/ui-shell/header-menu.js +47 -7
- package/es/components/ui-shell/header-menu.js.map +1 -1
- package/es/components/ui-shell/header-name.d.ts +3 -3
- package/es/components/ui-shell/header-name.d.ts.map +1 -1
- package/es/components/ui-shell/header-name.js +4 -4
- package/es/components/ui-shell/header-name.js.map +1 -1
- package/es/components/ui-shell/header-nav-item.d.ts +11 -3
- package/es/components/ui-shell/header-nav-item.d.ts.map +1 -1
- package/es/components/ui-shell/header-nav-item.js +39 -6
- package/es/components/ui-shell/header-nav-item.js.map +1 -1
- package/es/components/ui-shell/header-nav.d.ts +2 -2
- package/es/components/ui-shell/header-nav.d.ts.map +1 -1
- package/es/components/ui-shell/header-nav.js +5 -5
- package/es/components/ui-shell/header-nav.js.map +1 -1
- package/es/components/ui-shell/header-panel.d.ts +30 -0
- package/es/components/ui-shell/header-panel.d.ts.map +1 -0
- package/es/components/ui-shell/header-panel.js +72 -0
- package/es/components/ui-shell/header-panel.js.map +1 -0
- package/es/components/ui-shell/header-side-nav-items.d.ts +27 -0
- package/es/components/ui-shell/header-side-nav-items.d.ts.map +1 -0
- package/es/components/ui-shell/header-side-nav-items.js +80 -0
- package/es/components/ui-shell/header-side-nav-items.js.map +1 -0
- package/es/components/ui-shell/header.css.js +1 -1
- package/es/components/ui-shell/header.d.ts +2 -2
- package/es/components/ui-shell/header.d.ts.map +1 -1
- package/es/components/ui-shell/header.js +5 -5
- package/es/components/ui-shell/header.js.map +1 -1
- package/es/components/ui-shell/header.rtl.css.js +1 -1
- package/es/components/ui-shell/index.d.ts +5 -0
- package/es/components/ui-shell/index.d.ts.map +1 -1
- package/es/components/ui-shell/index.js +5 -0
- package/es/components/ui-shell/index.js.map +1 -1
- package/es/components/ui-shell/side-nav-divider.d.ts +2 -2
- package/es/components/ui-shell/side-nav-divider.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav-divider.js +5 -5
- package/es/components/ui-shell/side-nav-divider.js.map +1 -1
- package/es/components/ui-shell/side-nav-items.d.ts +2 -2
- package/es/components/ui-shell/side-nav-items.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav-items.js +6 -6
- package/es/components/ui-shell/side-nav-items.js.map +1 -1
- package/es/components/ui-shell/side-nav-link.d.ts +7 -3
- package/es/components/ui-shell/side-nav-link.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav-link.js +18 -5
- package/es/components/ui-shell/side-nav-link.js.map +1 -1
- package/es/components/ui-shell/side-nav-menu-item.d.ts +3 -3
- package/es/components/ui-shell/side-nav-menu-item.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav-menu-item.js +4 -4
- package/es/components/ui-shell/side-nav-menu-item.js.map +1 -1
- package/es/components/ui-shell/side-nav-menu.d.ts +7 -3
- package/es/components/ui-shell/side-nav-menu.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav-menu.js +18 -5
- package/es/components/ui-shell/side-nav-menu.js.map +1 -1
- package/es/components/ui-shell/side-nav.css.js +1 -1
- package/es/components/ui-shell/side-nav.d.ts +35 -13
- package/es/components/ui-shell/side-nav.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav.js +142 -48
- package/es/components/ui-shell/side-nav.js.map +1 -1
- package/es/components/ui-shell/side-nav.rtl.css.js +1 -1
- package/es/components/ui-shell/switcher-divider.d.ts +21 -0
- package/es/components/ui-shell/switcher-divider.d.ts.map +1 -0
- package/es/components/ui-shell/switcher-divider.js +56 -0
- package/es/components/ui-shell/switcher-divider.js.map +1 -0
- package/es/components/{pagination/page-sizes-select.d.ts → ui-shell/switcher-item.d.ts} +18 -22
- package/es/components/ui-shell/switcher-item.d.ts.map +1 -0
- package/es/components/ui-shell/switcher-item.js +162 -0
- package/es/components/ui-shell/switcher-item.js.map +1 -0
- package/es/components/ui-shell/switcher.d.ts +35 -0
- package/es/components/ui-shell/switcher.d.ts.map +1 -0
- package/es/components/ui-shell/switcher.js +95 -0
- package/es/components/ui-shell/switcher.js.map +1 -0
- package/es/components-react/code-snippet/code-snippet-skeleton.d.ts +2 -2
- package/es/components-react/code-snippet/code-snippet.d.ts +2 -2
- package/es/components-react/data-table/table-batch-actions.d.ts +2 -2
- package/es/components-react/data-table/table-body.d.ts +2 -2
- package/es/components-react/{pagination/pages-select.d.ts → data-table/table-cell-content.d.ts} +2 -6
- package/es/components-react/{pagination/pages-select.js → data-table/table-cell-content.js} +4 -10
- package/es/components-react/data-table/table-cell.d.ts +2 -2
- package/es/components-react/data-table/table-expanded-row.d.ts +2 -2
- package/es/components-react/data-table/table-head.d.ts +2 -2
- package/es/components-react/data-table/table-header-cell.d.ts +2 -2
- package/es/components-react/{pagination/page-sizes-select.d.ts → data-table/table-header-description.d.ts} +2 -6
- package/es/components-react/{pagination/page-sizes-select.js → data-table/table-header-description.js} +4 -10
- package/es/components-react/data-table/table-header-row.d.ts +2 -2
- package/es/components-react/data-table/table-header-title.d.ts +15 -0
- package/es/components-react/data-table/{table-header-cell-skeleton.js → table-header-title.js} +4 -6
- package/es/components-react/data-table/table-row.d.ts +19 -2
- package/es/components-react/data-table/table-row.js +16 -0
- package/es/components-react/data-table/table-skeleton.d.ts +15 -0
- package/es/components-react/data-table/table-skeleton.js +21 -0
- package/es/components-react/data-table/table-toolbar-content.d.ts +2 -2
- package/es/components-react/data-table/table-toolbar-search.d.ts +2 -2
- package/es/components-react/data-table/table-toolbar.d.ts +2 -2
- package/es/components-react/data-table/table.d.ts +44 -2
- package/es/components-react/data-table/table.js +45 -3
- package/es/components-react/file-uploader/demo-file-uploader.d.ts +0 -49
- package/es/components-react/file-uploader/demo-file-uploader.js +3 -51
- package/es/components-react/floating-menu/floating-menu.d.ts +2 -2
- package/es/components-react/floating-menu/floating-menu.js +0 -2
- package/es/components-react/form/form-item.d.ts +2 -2
- package/es/components-react/form-group/form-group.d.ts +15 -0
- package/es/components-react/form-group/form-group.js +21 -0
- package/es/components-react/form-group/index.d.ts +14 -0
- package/es/components-react/form-group/index.js +8 -0
- package/es/components-react/modal/modal-body-content.d.ts +15 -0
- package/es/components-react/modal/modal-body-content.js +21 -0
- package/es/components-react/modal/modal-body.d.ts +2 -2
- package/es/components-react/modal/modal-close-button.d.ts +2 -2
- package/es/components-react/modal/modal-footer.d.ts +2 -2
- package/es/components-react/modal/modal-header.d.ts +2 -2
- package/es/components-react/modal/modal-heading.d.ts +2 -2
- package/es/components-react/modal/modal-label.d.ts +2 -2
- package/es/components-react/modal/modal.d.ts +2 -2
- package/es/components-react/multi-select/defs.d.ts +14 -0
- package/es/components-react/multi-select/defs.js +9 -0
- package/es/components-react/multi-select/multi-select.js +6 -1
- package/es/components-react/overflow-menu/overflow-menu-body.d.ts +2 -2
- package/es/components-react/overflow-menu/overflow-menu-item.d.ts +2 -2
- package/es/components-react/overflow-menu/overflow-menu.d.ts +4 -5
- package/es/components-react/overflow-menu/overflow-menu.js +5 -3
- package/es/components-react/pagination/defs.d.ts +14 -0
- package/es/components-react/pagination/defs.js +9 -0
- package/es/components-react/pagination/pagination.d.ts +3 -7
- package/es/components-react/pagination/pagination.js +3 -7
- package/es/components-react/progress-indicator/progress-indicator-skeleton.d.ts +2 -3
- package/es/components-react/progress-indicator/progress-indicator.d.ts +2 -3
- package/es/components-react/progress-indicator/progress-step-skeleton.d.ts +2 -3
- package/es/components-react/progress-indicator/progress-step.d.ts +2 -3
- package/es/components-react/stack/defs.d.ts +14 -0
- package/es/components-react/stack/defs.js +9 -0
- package/es/components-react/stack/index.d.ts +14 -0
- package/es/components-react/stack/index.js +8 -0
- package/es/components-react/stack/stack.d.ts +15 -0
- package/es/components-react/stack/stack.js +22 -0
- package/es/components-react/text-input/text-input.js +7 -1
- package/es/components-react/toggle-tip/toggletip.d.ts +0 -5
- package/es/components-react/toggle-tip/toggletip.js +3 -13
- package/es/components-react/{data-table/table-cell-skeleton.d.ts → ui-shell/header-global-action.d.ts} +3 -3
- package/es/components-react/{data-table/table-cell-skeleton.js → ui-shell/header-global-action.js} +4 -4
- package/es/components-react/ui-shell/header-menu-button.d.ts +2 -2
- package/es/components-react/ui-shell/header-menu-item.d.ts +2 -2
- package/es/components-react/ui-shell/header-menu.d.ts +2 -2
- package/es/components-react/ui-shell/header-name.d.ts +2 -2
- package/es/components-react/ui-shell/header-nav-item.d.ts +2 -2
- package/es/components-react/ui-shell/header-nav.d.ts +2 -2
- package/es/components-react/ui-shell/header-panel.d.ts +15 -0
- package/es/components-react/ui-shell/header-panel.js +21 -0
- package/es/components-react/ui-shell/header-side-nav-items.d.ts +15 -0
- package/es/components-react/ui-shell/header-side-nav-items.js +21 -0
- package/es/components-react/ui-shell/header.d.ts +2 -2
- package/es/components-react/ui-shell/side-nav-divider.d.ts +2 -2
- package/es/components-react/ui-shell/side-nav-items.d.ts +2 -2
- package/es/components-react/ui-shell/side-nav-link.d.ts +2 -2
- package/es/components-react/ui-shell/side-nav-menu-item.d.ts +2 -2
- package/es/components-react/ui-shell/side-nav-menu.d.ts +2 -2
- package/es/components-react/ui-shell/side-nav.d.ts +2 -2
- package/es/components-react/ui-shell/switcher-divider.d.ts +15 -0
- package/es/components-react/ui-shell/switcher-divider.js +21 -0
- package/es/components-react/ui-shell/switcher-item.d.ts +15 -0
- package/es/components-react/ui-shell/switcher-item.js +21 -0
- package/es/components-react/ui-shell/switcher.d.ts +15 -0
- package/es/components-react/ui-shell/switcher.js +21 -0
- package/es/icons/arrow--down/16.js +1 -1
- package/es/icons/arrow--down/32.js +1 -1
- package/es/icons/arrows--vertical/16.js +1 -1
- package/es/icons/arrows--vertical/32.js +1 -1
- package/es/icons/overflow-menu--vertical/16.js +1 -1
- package/es/index.d.ts +12 -2
- package/es/index.d.ts.map +1 -1
- package/es/index.js +12 -2
- package/es/index.js.map +1 -1
- package/lib/components/data-table/defs.js +1 -10
- package/lib/components/data-table/defs.js.map +1 -1
- package/lib/components/dropdown/defs.js +2 -2
- package/lib/components/dropdown/defs.js.map +1 -1
- package/lib/components/floating-menu/defs.js +3 -24
- package/lib/components/floating-menu/defs.js.map +1 -1
- package/lib/components/modal/defs.js +2 -2
- package/lib/components/modal/defs.js.map +1 -1
- package/lib/components/multi-select/defs.js +25 -0
- package/lib/components/multi-select/defs.js.map +1 -0
- package/lib/components/overflow-menu/defs.js +2 -11
- package/lib/components/overflow-menu/defs.js.map +1 -1
- package/lib/components/pagination/defs.js +25 -0
- package/lib/components/pagination/defs.js.map +1 -0
- package/lib/components/stack/defs.js +36 -0
- package/lib/components/stack/defs.js.map +1 -0
- package/lib/components/text-input/defs.js +25 -4
- package/lib/components/text-input/defs.js.map +1 -1
- package/lib/components-react-node/{pagination/pages-select.js → data-table/table-cell-content.js} +3 -9
- package/lib/components-react-node/{pagination/page-sizes-select.js → data-table/table-header-description.js} +3 -9
- package/lib/components-react-node/data-table/{table-cell-skeleton.js → table-header-title.js} +3 -4
- package/lib/components-react-node/data-table/table-row.js +16 -0
- package/lib/components-react-node/data-table/{table-header-cell-skeleton.js → table-skeleton.js} +3 -4
- package/lib/components-react-node/data-table/table.js +44 -8
- package/lib/components-react-node/file-uploader/demo-file-uploader.js +3 -89
- package/lib/components-react-node/floating-menu/floating-menu.js +0 -12
- package/lib/components-react-node/form-group/form-group.js +36 -0
- package/lib/components-react-node/form-group/index.js +9 -0
- package/lib/components-react-node/modal/modal-body-content.js +36 -0
- package/lib/components-react-node/multi-select/defs.js +24 -0
- package/lib/components-react-node/multi-select/multi-select.js +13 -0
- package/lib/components-react-node/overflow-menu/overflow-menu.js +3 -8
- package/lib/components-react-node/pagination/defs.js +24 -0
- package/lib/components-react-node/pagination/pagination.js +3 -7
- package/lib/components-react-node/stack/defs.js +24 -0
- package/lib/components-react-node/stack/index.js +9 -0
- package/lib/components-react-node/stack/stack.js +49 -0
- package/lib/components-react-node/text-input/text-input.js +12 -0
- package/lib/components-react-node/toggle-tip/toggletip.js +3 -51
- package/lib/components-react-node/ui-shell/header-global-action.js +37 -0
- package/lib/components-react-node/ui-shell/header-panel.js +36 -0
- package/lib/components-react-node/ui-shell/header-side-nav-items.js +36 -0
- package/lib/components-react-node/ui-shell/switcher-divider.js +36 -0
- package/lib/components-react-node/ui-shell/switcher-item.js +36 -0
- package/lib/components-react-node/ui-shell/switcher.js +36 -0
- package/package.json +6 -7
- package/scss/components/button/button.scss +48 -1
- package/scss/components/checkbox/checkbox.scss +16 -0
- package/scss/components/code-snippet/code-snippet.scss +82 -101
- package/scss/components/copy-button/copy-button.scss +17 -0
- package/scss/components/data-table/_table-action.scss +50 -32
- package/scss/components/data-table/_table-core.scss +253 -29
- package/scss/components/data-table/_table-expandable.scss +25 -32
- package/scss/components/data-table/_table-selection.scss +36 -20
- package/scss/components/data-table/_table-sizes.scss +162 -20
- package/scss/components/data-table/_table-sort.scss +5 -21
- package/scss/components/data-table/data-table.scss +4 -3
- package/scss/components/form-group/form-group.scss +23 -0
- package/scss/components/modal/modal.scss +61 -87
- package/scss/components/multi-select/multi-select.scss +54 -19
- package/scss/components/overflow-menu/overflow-menu.scss +21 -9
- package/scss/components/pagination/pagination.scss +0 -66
- package/scss/components/progress-indicator/progress-indicator.scss +11 -10
- package/scss/components/radio-button/radio-button.scss +11 -1
- package/scss/components/select/select.scss +28 -1
- package/scss/components/stack/stack.scss +33 -0
- package/scss/components/structured-list/structured-list.scss +90 -20
- package/scss/components/tooltip/tooltip.scss +26 -0
- package/scss/components/ui-shell/header.scss +69 -0
- package/scss/components/ui-shell/side-nav.scss +27 -49
- package/es/components/data-table/table-cell-skeleton.d.ts +0 -20
- package/es/components/data-table/table-cell-skeleton.d.ts.map +0 -1
- package/es/components/data-table/table-cell-skeleton.js +0 -42
- package/es/components/data-table/table-cell-skeleton.js.map +0 -1
- package/es/components/data-table/table-expand-row.d.ts +0 -371
- package/es/components/data-table/table-expand-row.d.ts.map +0 -1
- package/es/components/data-table/table-expand-row.js +0 -192
- package/es/components/data-table/table-expand-row.js.map +0 -1
- package/es/components/data-table/table-header-cell-skeleton.d.ts +0 -19
- package/es/components/data-table/table-header-cell-skeleton.d.ts.map +0 -1
- package/es/components/data-table/table-header-cell-skeleton.js +0 -33
- package/es/components/data-table/table-header-cell-skeleton.js.map +0 -1
- package/es/components/data-table/table-header-expand-row.d.ts +0 -33
- package/es/components/data-table/table-header-expand-row.d.ts.map +0 -1
- package/es/components/data-table/table-header-expand-row.js +0 -68
- package/es/components/data-table/table-header-expand-row.js.map +0 -1
- package/es/components/pagination/page-sizes-select.d.ts.map +0 -1
- package/es/components/pagination/page-sizes-select.js +0 -172
- package/es/components/pagination/page-sizes-select.js.map +0 -1
- package/es/components/pagination/pages-select.d.ts +0 -362
- package/es/components/pagination/pages-select.d.ts.map +0 -1
- package/es/components/pagination/pages-select.js +0 -185
- package/es/components/pagination/pages-select.js.map +0 -1
- package/es/components-react/data-table/table-expand-row.d.ts +0 -24
- package/es/components-react/data-table/table-expand-row.js +0 -33
- package/es/components-react/data-table/table-header-cell-skeleton.d.ts +0 -14
- package/es/components-react/data-table/table-header-expand-row.d.ts +0 -29
- package/es/components-react/data-table/table-header-expand-row.js +0 -37
- package/lib/components-react-node/data-table/table-expand-row.js +0 -47
- package/lib/components-react-node/data-table/table-header-expand-row.js +0 -51
- package/scss/components/data-table/_table-skeleton.scss +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"demo-file-uploader.js","names":["html","property","LitElement","customElement","delay","prefix","ifDefined","FILE_UPLOADER_ITEM_STATE","BUTTON_SIZE","CDSCEDemoFileUploader","_decorate","_initialize","_LitElement","constructor","args","F","d","kind","key","value","_handleChange","event","addedFiles","detail","newFiles","map","item","id","Math","random","toString","slice","file","state","UPLOADING","multiple","_files","files","_simulateUpload","simulateUpload","concat","requestUpdate","forEach","length","_handleDelete","fileId","idToDelete","target","dataset","filter","data","size","_objectSpread","EDIT","invalid","errorSubject","errorBody","rand","COMPLETE","decorators","type","Boolean","reflect","attribute","MEDIUM","render","accept","button","buttonKind","buttonLabel","disabled","labelDescription","labelTitle","inputState","iconDescription","handleChange","handleDelete","_t","_","_t2","inputName","_t3","_t4","name","default"],"sources":["components/file-uploader/demo-file-uploader.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, LitElement, customElement } from 'lit-element';\n\nimport { delay } from 'bluebird';\nimport { prefix } from '../../globals/settings';\nimport { ifDefined } from 'lit/directives/if-defined';\nimport './index';\nimport { FILE_UPLOADER_ITEM_STATE } from './file-uploader-item';\nimport { BUTTON_SIZE } from '../button/button';\nimport { FileData } from './stories/types';\n\n/**\n * A class to manage file uploading states, like sending file contents to server.\n * DEMONSTRATION-PURPOSE ONLY.\n * Data/state handling in file uploading tends to involve lots of application-specific logics\n * and thus abstracting everything in a library won't be a good return on investment\n * vs. letting users copy code here and implement features that fit their needs.\n */\n@customElement(`${prefix}-ce-demo-file-uploader`)\nexport default class CDSCEDemoFileUploader extends LitElement {\n /**\n * The files being uploaded.\n */\n private _files: FileData[] = [];\n\n /**\n * Handles `cds-drop-container-changed` on `<cds-file-drop-container>`.\n *\n * @param event The event.\n */\n private _handleChange(event: CustomEvent) {\n const { addedFiles } = event.detail;\n const newFiles: FileData[] = addedFiles.map(\n (item) =>\n ({\n id: Math.random().toString(36).slice(2),\n file: item,\n state: FILE_UPLOADER_ITEM_STATE.UPLOADING,\n } as FileData)\n );\n const { multiple, _files: files, _simulateUpload: simulateUpload } = this;\n if (multiple) {\n this._files = files.concat(newFiles);\n this.requestUpdate();\n newFiles.forEach(simulateUpload, this);\n } else if (addedFiles.length > 0) {\n this._files = files.concat(newFiles[0]);\n this.requestUpdate();\n this._simulateUpload(newFiles[0]);\n }\n }\n\n /**\n * Handles `cds-file-uploader-item-deleted` on `<cds-file-uploader-item>`.\n *\n * @param event The event.\n */\n private _handleDelete(event: CustomEvent) {\n const { fileId: idToDelete } = (event.target as HTMLElement).dataset;\n this._files = this._files.filter(({ id }) => idToDelete !== id);\n this.requestUpdate();\n }\n\n /**\n * Simulates updating file.\n *\n * @param data The data of the file being uploaded.\n */\n private async _simulateUpload(data: FileData) {\n const { id, file } = data;\n if (file.size > 524288) {\n this._files = this._files.map((item) =>\n id !== item.id\n ? item\n : {\n ...item,\n state: FILE_UPLOADER_ITEM_STATE.EDIT,\n invalid: true,\n errorSubject: 'File size exceeds limit',\n errorBody:\n '500kb max file size. Select a new file and try again.',\n }\n );\n this.requestUpdate();\n } else {\n // Simulates network request time\n const rand = Math.random() * 1000;\n await delay(rand);\n this._files = this._files.map((item) =>\n id !== item.id\n ? item\n : {\n ...item,\n state: FILE_UPLOADER_ITEM_STATE.COMPLETE,\n }\n );\n this.requestUpdate();\n // Shows x icon after 1 second\n await delay(1000);\n this._files = this._files.map((item) =>\n id !== item.id\n ? item\n : {\n ...item,\n state: FILE_UPLOADER_ITEM_STATE.EDIT,\n }\n );\n this.requestUpdate();\n }\n }\n\n /**\n * The file types the file input should accept, separated by space.\n */\n @property()\n accept = '';\n\n /**\n * `true` if the drop container should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n button = false;\n\n /**\n * Button kind.\n */\n @property({ attribute: 'button-kind' })\n buttonKind = 'primary';\n\n /**\n * Button label.\n */\n @property({ attribute: 'button-label' })\n buttonLabel = 'Add file';\n\n /**\n * `true` if the drop container should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * Icon description.\n */\n @property({ attribute: 'icon-description' })\n iconDescription = '';\n\n /**\n * The input name.\n */\n @property({ attribute: 'input-name' })\n inputName = '';\n\n /**\n * The label description text.\n */\n @property({ attribute: 'label-description' })\n labelDescription = '';\n\n /**\n * The label title.\n */\n @property({ attribute: 'label-title' })\n labelTitle = '';\n\n /**\n * `true` if the drop container should accept more than one files at once.\n * Note that even with `false` set here, user _can_ select multiple files one by one.\n */\n @property({ type: Boolean, reflect: true })\n multiple = false;\n\n /**\n * The size of the button item.\n */\n @property({ reflect: true })\n size = BUTTON_SIZE.MEDIUM;\n\n /**\n * The state of this file uploader item.\n */\n @property({ reflect: true, attribute: 'input-state' })\n inputState = '';\n\n render() {\n const {\n accept,\n button,\n buttonKind,\n buttonLabel,\n disabled,\n labelDescription,\n labelTitle,\n multiple,\n size,\n inputState,\n iconDescription,\n _files: files,\n _handleChange: handleChange,\n _handleDelete: handleDelete,\n } = this;\n return html`\n <cds-file-uploader\n label-description=\"${ifDefined(labelDescription)}\"\n label-title=\"${ifDefined(labelTitle)}\"\n ?disabled=\"${disabled}\">\n ${!button\n ? html` <cds-file-uploader-drop-container\n accept=\"${ifDefined(accept)}\"\n ?multiple=\"${multiple}\"\n name=\"${ifDefined(this.inputName)}\"\n @cds-file-uploader-drop-container-changed=\"${handleChange}\">\n Drag and drop files here or click to upload\n </cds-file-uploader-drop-container>`\n : html` <cds-file-uploader-button\n size=\"${ifDefined(size)}\"\n button-kind=\"${buttonKind}\"\n accept=\"${ifDefined(accept)}\"\n name=\"${ifDefined(this.inputName)}\"\n ?multiple=\"${multiple}\"\n @cds-file-uploader-button-changed=\"${handleChange}\">\n ${buttonLabel}\n </cds-file-uploader-button>`}\n ${files.map(\n ({ id, invalid, file, state, errorSubject, errorBody }) => html`\n <cds-file-uploader-item\n data-file-id=\"${id}\"\n ?invalid=\"${invalid}\"\n state=\"${inputState || ifDefined(state)}\"\n icon-description=\"${ifDefined(iconDescription)}\"\n error-subject=\"${ifDefined(errorSubject)}\"\n error-body=\"${ifDefined(errorBody)}\"\n @cds-file-uploader-item-deleted=\"${handleDelete}\">\n ${file.name}\n </cds-file-uploader-item>\n `\n )}\n </cds-file-uploader>\n `;\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvE,SAASC,KAAK,QAAQ,UAAU;AAChC,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,SAAS,QAAQ,2BAA2B;AACrD,OAAO,SAAS;AAChB,SAASC,wBAAwB,QAAQ,sBAAsB;AAC/D,SAASC,WAAW,QAAQ,kBAAkB;AAG9C;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAQqBC,qBAAqB,GAAAC,SAAA,EADzCP,aAAa,CAAE,G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EAC7C5C,IAAI,CAACmD,IAAI,CAEd,CACF;MAGP;IAAC;EAAA;AAAA,GA5NgDjF,UAAU;AAAA,SAAxCO,qBAAqB,IAAA2E,OAAA"}
|
|
1
|
+
{"version":3,"file":"demo-file-uploader.js","names":["html","LitElement","customElement","property","delay","prefix","ifDefined","FILE_UPLOADER_ITEM_STATE","BUTTON_SIZE","CDSCEDemoFileUploader","_decorate","_initialize","_LitElement","constructor","args","F","d","kind","key","value","_handleChange","event","addedFiles","detail","newFiles","map","item","id","Math","random","toString","slice","file","state","UPLOADING","multiple","_files","files","_simulateUpload","simulateUpload","concat","requestUpdate","forEach","length","_handleDelete","fileId","idToDelete","target","dataset","filter","data","size","_objectSpread","EDIT","invalid","errorSubject","errorBody","rand","COMPLETE","decorators","type","Boolean","reflect","attribute","MEDIUM","render","accept","button","buttonKind","buttonLabel","disabled","labelDescription","labelTitle","inputState","iconDescription","handleChange","handleDelete","_t","_","_t2","inputName","_t3","_t4","name","default"],"sources":["components/file-uploader/demo-file-uploader.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { delay } from 'bluebird';\nimport { prefix } from '../../globals/settings';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport './index';\nimport { FILE_UPLOADER_ITEM_STATE } from './file-uploader-item';\nimport { BUTTON_SIZE } from '../button/button';\nimport { FileData } from './stories/types';\n\n/**\n * A class to manage file uploading states, like sending file contents to server.\n * DEMONSTRATION-PURPOSE ONLY.\n * Data/state handling in file uploading tends to involve lots of application-specific logics\n * and thus abstracting everything in a library won't be a good return on investment\n * vs. letting users copy code here and implement features that fit their needs.\n */\n@customElement(`${prefix}-ce-demo-file-uploader`)\nexport default class CDSCEDemoFileUploader extends LitElement {\n /**\n * The files being uploaded.\n */\n private _files: FileData[] = [];\n\n /**\n * Handles `cds-drop-container-changed` on `<cds-file-drop-container>`.\n *\n * @param event The event.\n */\n private _handleChange(event: CustomEvent) {\n const { addedFiles } = event.detail;\n const newFiles: FileData[] = addedFiles.map(\n (item) =>\n ({\n id: Math.random().toString(36).slice(2),\n file: item,\n state: FILE_UPLOADER_ITEM_STATE.UPLOADING,\n } as FileData)\n );\n const { multiple, _files: files, _simulateUpload: simulateUpload } = this;\n if (multiple) {\n this._files = files.concat(newFiles);\n this.requestUpdate();\n newFiles.forEach(simulateUpload, this);\n } else if (addedFiles.length > 0) {\n this._files = files.concat(newFiles[0]);\n this.requestUpdate();\n this._simulateUpload(newFiles[0]);\n }\n }\n\n /**\n * Handles `cds-file-uploader-item-deleted` on `<cds-file-uploader-item>`.\n *\n * @param event The event.\n */\n private _handleDelete(event: CustomEvent) {\n const { fileId: idToDelete } = (event.target as HTMLElement).dataset;\n this._files = this._files.filter(({ id }) => idToDelete !== id);\n this.requestUpdate();\n }\n\n /**\n * Simulates updating file.\n *\n * @param data The data of the file being uploaded.\n */\n private async _simulateUpload(data: FileData) {\n const { id, file } = data;\n if (file.size > 524288) {\n this._files = this._files.map((item) =>\n id !== item.id\n ? item\n : {\n ...item,\n state: FILE_UPLOADER_ITEM_STATE.EDIT,\n invalid: true,\n errorSubject: 'File size exceeds limit',\n errorBody:\n '500kb max file size. Select a new file and try again.',\n }\n );\n this.requestUpdate();\n } else {\n // Simulates network request time\n const rand = Math.random() * 1000;\n await delay(rand);\n this._files = this._files.map((item) =>\n id !== item.id\n ? item\n : {\n ...item,\n state: FILE_UPLOADER_ITEM_STATE.COMPLETE,\n }\n );\n this.requestUpdate();\n // Shows x icon after 1 second\n await delay(1000);\n this._files = this._files.map((item) =>\n id !== item.id\n ? item\n : {\n ...item,\n state: FILE_UPLOADER_ITEM_STATE.EDIT,\n }\n );\n this.requestUpdate();\n }\n }\n\n /**\n * The file types the file input should accept, separated by space.\n */\n @property()\n accept = '';\n\n /**\n * `true` if the drop container should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n button = false;\n\n /**\n * Button kind.\n */\n @property({ attribute: 'button-kind' })\n buttonKind = 'primary';\n\n /**\n * Button label.\n */\n @property({ attribute: 'button-label' })\n buttonLabel = 'Add file';\n\n /**\n * `true` if the drop container should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * Icon description.\n */\n @property({ attribute: 'icon-description' })\n iconDescription = '';\n\n /**\n * The input name.\n */\n @property({ attribute: 'input-name' })\n inputName = '';\n\n /**\n * The label description text.\n */\n @property({ attribute: 'label-description' })\n labelDescription = '';\n\n /**\n * The label title.\n */\n @property({ attribute: 'label-title' })\n labelTitle = '';\n\n /**\n * `true` if the drop container should accept more than one files at once.\n * Note that even with `false` set here, user _can_ select multiple files one by one.\n */\n @property({ type: Boolean, reflect: true })\n multiple = false;\n\n /**\n * The size of the button item.\n */\n @property({ reflect: true })\n size = BUTTON_SIZE.MEDIUM;\n\n /**\n * The state of this file uploader item.\n */\n @property({ reflect: true, attribute: 'input-state' })\n inputState = '';\n\n render() {\n const {\n accept,\n button,\n buttonKind,\n buttonLabel,\n disabled,\n labelDescription,\n labelTitle,\n multiple,\n size,\n inputState,\n iconDescription,\n _files: files,\n _handleChange: handleChange,\n _handleDelete: handleDelete,\n } = this;\n return html`\n <cds-file-uploader\n label-description=\"${ifDefined(labelDescription)}\"\n label-title=\"${ifDefined(labelTitle)}\"\n ?disabled=\"${disabled}\">\n ${!button\n ? html` <cds-file-uploader-drop-container\n accept=\"${ifDefined(accept)}\"\n ?multiple=\"${multiple}\"\n name=\"${ifDefined(this.inputName)}\"\n @cds-file-uploader-drop-container-changed=\"${handleChange}\">\n Drag and drop files here or click to upload\n </cds-file-uploader-drop-container>`\n : html` <cds-file-uploader-button\n size=\"${ifDefined(size)}\"\n button-kind=\"${buttonKind}\"\n accept=\"${ifDefined(accept)}\"\n name=\"${ifDefined(this.inputName)}\"\n ?multiple=\"${multiple}\"\n @cds-file-uploader-button-changed=\"${handleChange}\">\n ${buttonLabel}\n </cds-file-uploader-button>`}\n ${files.map(\n ({ id, invalid, file, state, errorSubject, errorBody }) => html`\n <cds-file-uploader-item\n data-file-id=\"${id}\"\n ?invalid=\"${invalid}\"\n state=\"${inputState || ifDefined(state)}\"\n icon-description=\"${ifDefined(iconDescription)}\"\n error-subject=\"${ifDefined(errorSubject)}\"\n error-body=\"${ifDefined(errorBody)}\"\n @cds-file-uploader-item-deleted=\"${handleDelete}\">\n ${file.name}\n </cds-file-uploader-item>\n `\n )}\n </cds-file-uploader>\n `;\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,UAAU,QAAQ,KAAK;AACtC,SAASC,aAAa,EAAEC,QAAQ,QAAQ,mBAAmB;AAE3D,SAASC,KAAK,QAAQ,UAAU;AAChC,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,SAAS,QAAQ,8BAA8B;AACxD,OAAO,SAAS;AAChB,SAASC,wBAAwB,QAAQ,sBAAsB;AAC/D,SAASC,WAAW,QAAQ,kBAAkB;AAG9C;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAQqBC,qBAAqB,GAAAC,SAAA,EADzCR,aAAa,CAAE,GAAEG,MAAO,wBAAuB,CAAC,aAAAM,WAAA,EAAAC,WAAA;EAAjD,MACqBH,qBAAqB,SAAAG,WAAA,CAAoB;IAAAC,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAAH,WAAA;IAAA;EA6N9D;EAAC;IAAAI,CAAA,EA7NoBN,qBAAqB;IAAAO,CAAA;MAAAC,IAAA;MAAAC,GAAA;MAAAC,MAAA;QAAA,OAIX,EAAE;MAAA;IAAA;MAAAF,IAAA;MAAAC,GAAA;MAAAC,KAAA;MAH/B;AACF;AACA;;MAGE;AACF;AACA;AACA;AACA;MACE,SAAAC,cAAsBC,KAAkB,EAAE;QACxC,MAAM;UAAEC;QAAW,CAAC,GAA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E,SAAS,CAAC2B,KAAK,CAAC,EACnB3B,SAAS,CAACoE,eAAe,CAAC,EAC7BpE,SAAS,CAACiD,YAAY,CAAC,EAC1BjD,SAAS,CAACkD,SAAS,CAAC,EACCoB,YAAY,EAC7C5C,IAAI,CAACmD,IAAI,CAEd,CACF;MAGP;IAAC;EAAA;AAAA,GA5NgDlF,UAAU;AAAA,SAAxCQ,qBAAqB,IAAA2E,OAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
*
|
|
4
|
-
* Copyright IBM Corp. 2020
|
|
4
|
+
* Copyright IBM Corp. 2020, 2023
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -19,56 +19,18 @@ export declare enum FLOATING_MENU_POSITION_DIRECTION {
|
|
|
19
19
|
*/
|
|
20
20
|
RTL = "rtl"
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
23
|
-
* The alignment choices of floating menu.
|
|
24
|
-
*/
|
|
25
|
-
export declare enum FLOATING_MENU_ALIGNMENT {
|
|
26
|
-
/**
|
|
27
|
-
* Align the top/left position menu body to the one of its trigger button.
|
|
28
|
-
*/
|
|
29
|
-
START = "start",
|
|
30
|
-
/**
|
|
31
|
-
* Align the center position menu body to the one of its trigger button.
|
|
32
|
-
*/
|
|
33
|
-
CENTER = "center",
|
|
34
|
-
/**
|
|
35
|
-
* Align the bottom/right position menu body to the one of its trigger button.
|
|
36
|
-
*/
|
|
37
|
-
END = "end"
|
|
38
|
-
}
|
|
39
22
|
/**
|
|
40
23
|
* The direction/positioning/orientation choices of floating menu.
|
|
41
24
|
*/
|
|
42
25
|
export declare enum FLOATING_MENU_DIRECTION {
|
|
43
|
-
/**
|
|
44
|
-
* Put menu body at the left of its trigger button.
|
|
45
|
-
*/
|
|
46
|
-
LEFT = "left",
|
|
47
26
|
/**
|
|
48
27
|
* Put menu body at the top of its trigger button.
|
|
49
28
|
*/
|
|
50
29
|
TOP = "top",
|
|
51
|
-
/**
|
|
52
|
-
* Put menu body at the right of its trigger button.
|
|
53
|
-
*/
|
|
54
|
-
RIGHT = "right",
|
|
55
30
|
/**
|
|
56
31
|
* Put menu body at the bottom of its trigger button.
|
|
57
32
|
*/
|
|
58
33
|
BOTTOM = "bottom"
|
|
59
34
|
}
|
|
60
|
-
/**
|
|
61
|
-
* The group of the direction/positioning/orientation choices of floating menu.
|
|
62
|
-
*/
|
|
63
|
-
export declare enum FLOATING_MENU_DIRECTION_GROUP {
|
|
64
|
-
/**
|
|
65
|
-
* Put menu body at the left/right of its trigger button.
|
|
66
|
-
*/
|
|
67
|
-
HORIZONTAL = "horizontal",
|
|
68
|
-
/**
|
|
69
|
-
* Put menu body at the top/bottom of its trigger button.
|
|
70
|
-
*/
|
|
71
|
-
VERTICAL = "vertical"
|
|
72
|
-
}
|
|
73
35
|
|
|
74
36
|
//# sourceMappingURL=defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/floating-menu/defs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,oBAAY,gCAAgC;IAC1C;;OAEG;IACH,GAAG,QAAQ;IAEX;;OAEG;IACH,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,oBAAY,uBAAuB;IACjC;;OAEG;IACH,
|
|
1
|
+
{"version":3,"sources":["components/floating-menu/defs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,oBAAY,gCAAgC;IAC1C;;OAEG;IACH,GAAG,QAAQ;IAEX;;OAEG;IACH,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,oBAAY,uBAAuB;IACjC;;OAEG;IACH,GAAG,QAAQ;IAEX;;OAEG;IACH,MAAM,WAAW;CAClB","file":"defs.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * The LTR/RTL direction used for positioning floating menu.\n */\nexport enum FLOATING_MENU_POSITION_DIRECTION {\n /**\n * LTR.\n */\n LTR = 'ltr',\n\n /**\n * RTL.\n */\n RTL = 'rtl',\n}\n\n/**\n * The direction/positioning/orientation choices of floating menu.\n */\nexport enum FLOATING_MENU_DIRECTION {\n /**\n * Put menu body at the top of its trigger button.\n */\n TOP = 'top',\n\n /**\n * Put menu body at the bottom of its trigger button.\n */\n BOTTOM = 'bottom',\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
*
|
|
4
|
-
* Copyright IBM Corp. 2020
|
|
4
|
+
* Copyright IBM Corp. 2020, 2023
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -13,36 +13,15 @@
|
|
|
13
13
|
export let FLOATING_MENU_POSITION_DIRECTION;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* The
|
|
16
|
+
* The direction/positioning/orientation choices of floating menu.
|
|
17
17
|
*/
|
|
18
18
|
(function (FLOATING_MENU_POSITION_DIRECTION) {
|
|
19
19
|
FLOATING_MENU_POSITION_DIRECTION["LTR"] = "ltr";
|
|
20
20
|
FLOATING_MENU_POSITION_DIRECTION["RTL"] = "rtl";
|
|
21
21
|
})(FLOATING_MENU_POSITION_DIRECTION || (FLOATING_MENU_POSITION_DIRECTION = {}));
|
|
22
|
-
export let FLOATING_MENU_ALIGNMENT;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The direction/positioning/orientation choices of floating menu.
|
|
26
|
-
*/
|
|
27
|
-
(function (FLOATING_MENU_ALIGNMENT) {
|
|
28
|
-
FLOATING_MENU_ALIGNMENT["START"] = "start";
|
|
29
|
-
FLOATING_MENU_ALIGNMENT["CENTER"] = "center";
|
|
30
|
-
FLOATING_MENU_ALIGNMENT["END"] = "end";
|
|
31
|
-
})(FLOATING_MENU_ALIGNMENT || (FLOATING_MENU_ALIGNMENT = {}));
|
|
32
22
|
export let FLOATING_MENU_DIRECTION;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The group of the direction/positioning/orientation choices of floating menu.
|
|
36
|
-
*/
|
|
37
23
|
(function (FLOATING_MENU_DIRECTION) {
|
|
38
|
-
FLOATING_MENU_DIRECTION["LEFT"] = "left";
|
|
39
24
|
FLOATING_MENU_DIRECTION["TOP"] = "top";
|
|
40
|
-
FLOATING_MENU_DIRECTION["RIGHT"] = "right";
|
|
41
25
|
FLOATING_MENU_DIRECTION["BOTTOM"] = "bottom";
|
|
42
26
|
})(FLOATING_MENU_DIRECTION || (FLOATING_MENU_DIRECTION = {}));
|
|
43
|
-
export let FLOATING_MENU_DIRECTION_GROUP;
|
|
44
|
-
(function (FLOATING_MENU_DIRECTION_GROUP) {
|
|
45
|
-
FLOATING_MENU_DIRECTION_GROUP["HORIZONTAL"] = "horizontal";
|
|
46
|
-
FLOATING_MENU_DIRECTION_GROUP["VERTICAL"] = "vertical";
|
|
47
|
-
})(FLOATING_MENU_DIRECTION_GROUP || (FLOATING_MENU_DIRECTION_GROUP = {}));
|
|
48
27
|
//# sourceMappingURL=defs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defs.js","names":["FLOATING_MENU_POSITION_DIRECTION","
|
|
1
|
+
{"version":3,"file":"defs.js","names":["FLOATING_MENU_POSITION_DIRECTION","FLOATING_MENU_DIRECTION"],"sources":["components/floating-menu/defs.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * The LTR/RTL direction used for positioning floating menu.\n */\nexport enum FLOATING_MENU_POSITION_DIRECTION {\n /**\n * LTR.\n */\n LTR = 'ltr',\n\n /**\n * RTL.\n */\n RTL = 'rtl',\n}\n\n/**\n * The direction/positioning/orientation choices of floating menu.\n */\nexport enum FLOATING_MENU_DIRECTION {\n /**\n * Put menu body at the top of its trigger button.\n */\n TOP = 'top',\n\n /**\n * Put menu body at the bottom of its trigger button.\n */\n BOTTOM = 'bottom',\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAYA,gCAAgC;;AAY5C;AACA;AACA;AAFA,WAZYA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;AAAA,GAAhCA,gCAAgC,KAAhCA,gCAAgC;AAe5C,WAAYC,uBAAuB;AAUlC,WAVWA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;AAAA,GAAvBA,uBAAuB,KAAvBA,uBAAuB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
*
|
|
4
|
-
* Copyright IBM Corp. 2019,
|
|
4
|
+
* Copyright IBM Corp. 2019, 2023
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
/**
|
|
10
10
|
* The interface of floating menus containing the trigger button.
|
|
11
11
|
*/
|
|
12
|
-
interface
|
|
12
|
+
interface CDSFloatingMenuTrigger extends HTMLElement {
|
|
13
13
|
/**
|
|
14
14
|
* `true` if the menu should be open.
|
|
15
15
|
*/
|
|
@@ -19,6 +19,6 @@ interface BXFloatingMenuTrigger extends HTMLElement {
|
|
|
19
19
|
*/
|
|
20
20
|
triggerPosition: ClientRect;
|
|
21
21
|
}
|
|
22
|
-
export default
|
|
22
|
+
export default CDSFloatingMenuTrigger;
|
|
23
23
|
|
|
24
24
|
//# sourceMappingURL=floating-menu-trigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/floating-menu/floating-menu-trigger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,UAAU,
|
|
1
|
+
{"version":3,"sources":["components/floating-menu/floating-menu-trigger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,UAAU,sBAAuB,SAAQ,WAAW;IAClD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,eAAe,EAAE,UAAU,CAAC;CAC7B;AAGD,eAAe,sBAAsB,CAAC","file":"floating-menu-trigger.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * The interface of floating menus containing the trigger button.\n */\ninterface CDSFloatingMenuTrigger extends HTMLElement {\n /**\n * `true` if the menu should be open.\n */\n open: boolean;\n\n /**\n * The position of the trigger button.\n */\n triggerPosition: ClientRect;\n}\n\n// eslint-disable-next-line no-undef\nexport default CDSFloatingMenuTrigger;\n"]}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { LitElement } from 'lit';
|
|
10
10
|
import Handle from '../../globals/internal/handle';
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
export {
|
|
11
|
+
import { FLOATING_MENU_DIRECTION, FLOATING_MENU_POSITION_DIRECTION } from './defs';
|
|
12
|
+
import CDSFloatingMenuTrigger from './floating-menu-trigger';
|
|
13
|
+
export { FLOATING_MENU_DIRECTION, FLOATING_MENU_POSITION_DIRECTION };
|
|
14
14
|
/**
|
|
15
15
|
* Position of floating menu, or trigger button of floating menu.
|
|
16
16
|
*/
|
|
@@ -28,7 +28,7 @@ export interface FloatingMenuPosition {
|
|
|
28
28
|
*/
|
|
29
29
|
top: number;
|
|
30
30
|
}
|
|
31
|
-
declare const
|
|
31
|
+
declare const CDSFloatingMenu_base: {
|
|
32
32
|
new (...args: any[]): {
|
|
33
33
|
_handles: Set<Handle>;
|
|
34
34
|
connectedCallback(): void;
|
|
@@ -652,7 +652,7 @@ declare const BXFloatingMenu_base: {
|
|
|
652
652
|
/**
|
|
653
653
|
* Floating menu.
|
|
654
654
|
*/
|
|
655
|
-
declare abstract class
|
|
655
|
+
declare abstract class CDSFloatingMenu extends CDSFloatingMenu_base {
|
|
656
656
|
/**
|
|
657
657
|
* The handle for observing resize of the element containing the trigger button.
|
|
658
658
|
*/
|
|
@@ -666,14 +666,12 @@ declare abstract class BXFloatingMenu extends BXFloatingMenu_base {
|
|
|
666
666
|
*/
|
|
667
667
|
private _resizeObserver;
|
|
668
668
|
private _handleBlur;
|
|
669
|
+
private _click;
|
|
670
|
+
private _handleKeyDown;
|
|
669
671
|
/**
|
|
670
672
|
* The DOM element, typically a custom element in this library, launching this floating menu.
|
|
671
673
|
*/
|
|
672
|
-
protected parent:
|
|
673
|
-
/**
|
|
674
|
-
* How the menu is aligned to the trigger button.
|
|
675
|
-
*/
|
|
676
|
-
abstract alignment: FLOATING_MENU_ALIGNMENT;
|
|
674
|
+
protected parent: CDSFloatingMenuTrigger | null;
|
|
677
675
|
/**
|
|
678
676
|
* The menu direction.
|
|
679
677
|
*/
|
|
@@ -683,9 +681,9 @@ declare abstract class BXFloatingMenu extends BXFloatingMenu_base {
|
|
|
683
681
|
*/
|
|
684
682
|
abstract open: boolean;
|
|
685
683
|
/**
|
|
686
|
-
*
|
|
684
|
+
* `true` if the menu alignment should be flipped.
|
|
687
685
|
*/
|
|
688
|
-
|
|
686
|
+
abstract flipped: boolean;
|
|
689
687
|
/**
|
|
690
688
|
* The DOM element to put this menu into.
|
|
691
689
|
*/
|
|
@@ -710,6 +708,6 @@ declare abstract class BXFloatingMenu extends BXFloatingMenu_base {
|
|
|
710
708
|
slotAssignment?: SlotAssignmentMode | undefined;
|
|
711
709
|
};
|
|
712
710
|
}
|
|
713
|
-
export default
|
|
711
|
+
export default CDSFloatingMenu;
|
|
714
712
|
|
|
715
713
|
//# sourceMapping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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD;;GAEG;AACH,uBAAe,cAAe,SAAQ,mBAErC;IACC;;OAEG;IACH,OAAO,CAAC,qBAAqB,CAAuB;IAEpD;;OAEG;IACH,OAAO,CAAC,wBAAwB,CAAuB;IAEvD;;OAEG;IAGH,OAAO,CAAC,eAAe,CASpB;IAIH,OAAO,CAAC,WAAW,CAQjB;IAEF;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAQ;IAEtD;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;IAE5C;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;IAE5C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,IAAI,kBAAkB,kCAQrB;IAED;;OAEG;IACH,IAAI,SAAS,QAOZ;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,oBAAoB,CAqGnC;IAED,oBAAoB;IASpB,OAAO,CAAC,iBAAiB,KAAA;IA0CzB;;OAEG;IACH,MAAM,CAAC,aAAa,UAAQ;IAE5B;;OAEG;IACH,MAAM,KAAK,iBAAiB,WAE3B;IACD,MAAM,CAAC,iBAAiB;;;;MAGtB;CACH;AAED,eAAe,cAAc,CAAC","file":"floating-menu.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement } from 'lit';\nimport HostListener from '../../globals/decorators/host-listener';\nimport FocusMixin from '../../globals/mixins/focus';\nimport HostListenerMixin from '../../globals/mixins/host-listener';\nimport Handle from '../../globals/internal/handle';\nimport {\n FLOATING_MENU_ALIGNMENT,\n FLOATING_MENU_DIRECTION,\n FLOATING_MENU_DIRECTION_GROUP,\n FLOATING_MENU_POSITION_DIRECTION,\n} from './defs';\nimport BXFloatingMenuTrigger from './floating-menu-trigger';\nimport { prefix } from '../../globals/settings';\n\nexport {\n FLOATING_MENU_ALIGNMENT,\n FLOATING_MENU_DIRECTION,\n FLOATING_MENU_DIRECTION_GROUP,\n FLOATING_MENU_POSITION_DIRECTION,\n};\n\n/**\n * Position of floating menu, or trigger button of floating menu.\n */\nexport interface FloatingMenuPosition {\n /**\n * The LTR/RTL direction used for positioning floating menu.\n */\n direction: FLOATING_MENU_POSITION_DIRECTION;\n\n /**\n * The start position (Left position for LTR, right position for RTL).\n */\n start: number;\n\n /**\n * The top position.\n */\n top: number;\n}\n\n/**\n * Observes resize of the given element with the given resize observer.\n *\n * @param observer The resize observer.\n * @param elem The element to observe the resize.\n */\nconst observeResize = (observer: ResizeObserver, elem: Element) => {\n observer.observe(elem);\n return {\n release() {\n observer.unobserve(elem);\n return null;\n },\n } as Handle;\n};\n\n/**\n * @param elem The starting element.\n * @param selector The CSS selector.\n * @returns {Element}\n * The closest ancestor node of the given element that matches the given selector, crossing Shadow DOM boundary.\n */\nconst closestComposed = (elem: Element, selector: string) => {\n const found = elem.closest(selector);\n if (found) {\n return found;\n }\n const { host } = elem.getRootNode() as ShadowRoot;\n if (host) {\n return closestComposed(host, selector);\n }\n return null;\n};\n\n/**\n * Floating menu.\n */\nabstract class BXFloatingMenu extends HostListenerMixin(\n FocusMixin(LitElement)\n) {\n /**\n * The handle for observing resize of the element containing the trigger button.\n */\n private _hObserveResizeParent: Handle | null = null;\n\n /**\n * The handle for observing resize of the floating menu container.\n */\n private _hObserveResizeContainer: Handle | null = null;\n\n /**\n * The `ResizeObserver` instance for observing element resizes for re-positioning floating menu position.\n */\n // TODO: Wait for `.d.ts` update to support `ResizeObserver`\n // @ts-ignore\n private _resizeObserver = new ResizeObserver(() => {\n const { container, open, parent, position } = this;\n if (container && open && parent) {\n const { direction, start, top } = position;\n this.style[\n direction !== FLOATING_MENU_POSITION_DIRECTION.RTL ? 'left' : 'right'\n ] = `${start}px`;\n this.style.top = `${top}px`;\n }\n });\n\n @HostListener('focusout')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleBlur = ({ relatedTarget }: FocusEvent) => {\n if (!this.contains(relatedTarget as Node)) {\n const { parent } = this;\n if (parent) {\n parent.open = false;\n HTMLElement.prototype.focus.call(this.parent); // SVGElement in IE11 does not have `.focus()` method\n }\n }\n };\n\n /**\n * The DOM element, typically a custom element in this library, launching this floating menu.\n */\n protected parent: BXFloatingMenuTrigger | null = null;\n\n /**\n * How the menu is aligned to the trigger button.\n */\n abstract alignment: FLOATING_MENU_ALIGNMENT;\n\n /**\n * The menu direction.\n */\n abstract direction: FLOATING_MENU_DIRECTION;\n\n /**\n * `true` if the menu should be open.\n */\n abstract open: boolean;\n\n /**\n * The horizontal/vertical direction with regard to how the menu is aligned to the trigger button.\n */\n get alignmentDirection() {\n return {\n [FLOATING_MENU_DIRECTION.LEFT]: FLOATING_MENU_DIRECTION_GROUP.VERTICAL,\n [FLOATING_MENU_DIRECTION.TOP]: FLOATING_MENU_DIRECTION_GROUP.HORIZONTAL,\n [FLOATING_MENU_DIRECTION.RIGHT]: FLOATING_MENU_DIRECTION_GROUP.VERTICAL,\n [FLOATING_MENU_DIRECTION.BOTTOM]:\n FLOATING_MENU_DIRECTION_GROUP.HORIZONTAL,\n }[this.direction];\n }\n\n /**\n * The DOM element to put this menu into.\n */\n get container() {\n return (\n closestComposed(\n this,\n (this.constructor as typeof BXFloatingMenu).selectorContainer\n ) || this.ownerDocument!.body\n );\n }\n\n /**\n * The position of this floating menu.\n */\n get position(): FloatingMenuPosition {\n const { triggerPosition } = this.parent!;\n if (!triggerPosition) {\n throw new TypeError('Missing information of trigger button position.');\n }\n\n const { container } = this;\n const {\n left: refLeft = 0,\n top: refTop = 0,\n right: refRight = 0,\n bottom: refBottom = 0,\n } = triggerPosition;\n const { width, height } = this.getBoundingClientRect();\n const {\n left: containerLeft = 0,\n right: containerRight = 0,\n top: containerTop = 0,\n } = container.getBoundingClientRect();\n const refCenterHorizontal = (refLeft + refRight) / 2;\n const refCenterVertical = (refTop + refBottom) / 2;\n\n const containerComputedStyle =\n container.ownerDocument!.defaultView!.getComputedStyle(container);\n const positionDirection = containerComputedStyle.getPropertyValue(\n 'direction'\n ) as FLOATING_MENU_POSITION_DIRECTION;\n const isRtl = positionDirection === FLOATING_MENU_POSITION_DIRECTION.RTL;\n const containerStartFromViewport = !isRtl\n ? containerLeft\n : container.ownerDocument!.defaultView!.innerWidth - containerRight;\n const refStartFromContainer = !isRtl\n ? refLeft - containerLeft\n : containerRight - refRight;\n const refEndFromContainer = !isRtl\n ? refRight - containerLeft\n : containerRight - refLeft;\n const refCenterHorizontalFromContainer = !isRtl\n ? refCenterHorizontal - containerLeft\n : containerRight - refCenterHorizontal;\n const refTopFromContainer = refTop - containerTop;\n const refCenterVerticalFromContainer = refCenterVertical - containerTop;\n\n if (\n (container !== this.ownerDocument!.body ||\n containerStartFromViewport !== 0 ||\n containerTop !== 0) &&\n containerComputedStyle.getPropertyValue('position') === 'static'\n ) {\n throw new Error(\n 'Floating menu container must not have `position:static`.'\n );\n }\n\n const { alignment, alignmentDirection, direction } = this;\n if (Object.values(FLOATING_MENU_ALIGNMENT).indexOf(alignment) < 0) {\n throw new Error(`Wrong menu alignment: ${alignment}`);\n }\n if (Object.values(FLOATING_MENU_DIRECTION).indexOf(direction) < 0) {\n throw new Error(`Wrong menu position direction: ${direction}`);\n }\n\n const alignmentStart = {\n [FLOATING_MENU_DIRECTION_GROUP.HORIZONTAL]: {\n [FLOATING_MENU_ALIGNMENT.START]: () => refStartFromContainer,\n [FLOATING_MENU_ALIGNMENT.CENTER]: () =>\n refCenterHorizontalFromContainer - width / 2,\n [FLOATING_MENU_ALIGNMENT.END]: () => refEndFromContainer - width,\n },\n [FLOATING_MENU_DIRECTION_GROUP.VERTICAL]: {\n [FLOATING_MENU_ALIGNMENT.START]: () => refTopFromContainer,\n [FLOATING_MENU_ALIGNMENT.CENTER]: () =>\n refCenterVerticalFromContainer - height / 2,\n [FLOATING_MENU_ALIGNMENT.END]: () => refBottom - height,\n },\n }[alignmentDirection][alignment]();\n\n const { start, top } = {\n [FLOATING_MENU_DIRECTION.LEFT]: () => ({\n start: refStartFromContainer - width,\n top: alignmentStart,\n }),\n [FLOATING_MENU_DIRECTION.TOP]: () => ({\n start: alignmentStart,\n top: refTopFromContainer - height,\n }),\n [FLOATING_MENU_DIRECTION.RIGHT]: () => ({\n start: refEndFromContainer,\n top: alignmentStart,\n }),\n [FLOATING_MENU_DIRECTION.BOTTOM]: () => ({\n start: alignmentStart,\n top: refBottom,\n }),\n }[direction]();\n\n return {\n direction: positionDirection,\n start,\n top,\n };\n }\n\n disconnectedCallback() {\n if (this._hObserveResizeContainer) {\n this._hObserveResizeContainer = this._hObserveResizeContainer.release();\n }\n if (this._hObserveResizeParent) {\n this._hObserveResizeParent = this._hObserveResizeParent.release();\n }\n }\n\n updated(changedProperties) {\n const { container, open, parent } = this;\n if (\n (changedProperties.has('alignment') ||\n changedProperties.has('direction') ||\n changedProperties.has('open')) &&\n open\n ) {\n if (!parent) {\n this.parent = this.parentElement as BXFloatingMenuTrigger;\n container.appendChild(this);\n }\n // Note: `this.position` cannot be referenced until `this.parent` is set\n const { direction, start, top } = this.position;\n this.style[\n direction !== FLOATING_MENU_POSITION_DIRECTION.RTL ? 'left' : 'right'\n ] = `${start}px`;\n this.style.top = `${top}px`;\n }\n if (changedProperties.has('open')) {\n if (this._hObserveResizeContainer) {\n this._hObserveResizeContainer = this._hObserveResizeContainer.release();\n }\n if (this._hObserveResizeParent) {\n this._hObserveResizeParent = this._hObserveResizeParent.release();\n }\n if (open) {\n const { parentElement } = this.parent ?? {};\n this._hObserveResizeContainer = observeResize(\n this._resizeObserver,\n container\n );\n if (parentElement) {\n this._hObserveResizeParent = observeResize(\n this._resizeObserver,\n parentElement\n );\n }\n }\n }\n }\n\n /**\n * A constant indicating that this class is a floating menu.\n */\n static FLOATING_MENU = true;\n\n /**\n * The CSS selector to find the element to put this floating menu in.\n */\n static get selectorContainer() {\n return `[data-floating-menu-container],${prefix}-modal`;\n }\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n}\n\nexport default BXFloatingMenu;\n"]}
|
|
1
|
+
{"version":3,"sources":["components/floating-menu/floating-menu.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAIjC,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EACjC,MAAM,QAAQ,CAAC;AAChB,OAAO,sBAAsB,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,uBAAuB,EAAE,gCAAgC,EAAE,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,SAAS,EAAE,gCAAgC,CAAC;IAE5C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD;;GAEG;AACH,uBAAe,eAAgB,SAAQ,oBAEtC;IACC;;OAEG;IACH,OAAO,CAAC,qBAAqB,CAAuB;IAEpD;;OAEG;IACH,OAAO,CAAC,wBAAwB,CAAuB;IAEvD;;OAEG;IAGH,OAAO,CAAC,eAAe,CASpB;IAIH,OAAO,CAAC,WAAW,CAQjB;IAIF,OAAO,CAAC,MAAM,CAKZ;IAIF,OAAO,CAAC,cAAc,CASpB;IAEF;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAQ;IAEvD;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;IAE5C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,IAAI,SAAS,QAOZ;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,oBAAoB,CAyEnC;IAED,oBAAoB;IASpB,OAAO,CAAC,iBAAiB,KAAA;IA0CzB;;OAEG;IACH,MAAM,CAAC,aAAa,UAAQ;IAE5B;;OAEG;IACH,MAAM,KAAK,iBAAiB,WAE3B;IACD,MAAM,CAAC,iBAAiB;;;;MAGtB;CACH;AAED,eAAe,eAAe,CAAC","file":"floating-menu.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement } from 'lit';\nimport HostListener from '../../globals/decorators/host-listener';\nimport FocusMixin from '../../globals/mixins/focus';\nimport HostListenerMixin from '../../globals/mixins/host-listener';\nimport Handle from '../../globals/internal/handle';\nimport {\n FLOATING_MENU_DIRECTION,\n FLOATING_MENU_POSITION_DIRECTION,\n} from './defs';\nimport CDSFloatingMenuTrigger from './floating-menu-trigger';\nimport { prefix } from '../../globals/settings';\n\nexport { FLOATING_MENU_DIRECTION, FLOATING_MENU_POSITION_DIRECTION };\n\n/**\n * Position of floating menu, or trigger button of floating menu.\n */\nexport interface FloatingMenuPosition {\n /**\n * The LTR/RTL direction used for positioning floating menu.\n */\n direction: FLOATING_MENU_POSITION_DIRECTION;\n\n /**\n * The start position (Left position for LTR, right position for RTL).\n */\n start: number;\n\n /**\n * The top position.\n */\n top: number;\n}\n\n/**\n * Observes resize of the given element with the given resize observer.\n *\n * @param observer The resize observer.\n * @param elem The element to observe the resize.\n */\nconst observeResize = (observer: ResizeObserver, elem: Element) => {\n observer.observe(elem);\n return {\n release() {\n observer.unobserve(elem);\n return null;\n },\n } as Handle;\n};\n\n/**\n * @param elem The starting element.\n * @param selector The CSS selector.\n * @returns {Element}\n * The closest ancestor node of the given element that matches the given selector, crossing Shadow DOM boundary.\n */\nconst closestComposed = (elem: Element, selector: string) => {\n const found = elem.closest(selector);\n if (found) {\n return found;\n }\n const { host } = elem.getRootNode() as ShadowRoot;\n if (host) {\n return closestComposed(host, selector);\n }\n return null;\n};\n\n/**\n * Floating menu.\n */\nabstract class CDSFloatingMenu extends HostListenerMixin(\n FocusMixin(LitElement)\n) {\n /**\n * The handle for observing resize of the element containing the trigger button.\n */\n private _hObserveResizeParent: Handle | null = null;\n\n /**\n * The handle for observing resize of the floating menu container.\n */\n private _hObserveResizeContainer: Handle | null = null;\n\n /**\n * The `ResizeObserver` instance for observing element resizes for re-positioning floating menu position.\n */\n // TODO: Wait for `.d.ts` update to support `ResizeObserver`\n // @ts-ignore\n private _resizeObserver = new ResizeObserver(() => {\n const { container, open, parent, position } = this;\n if (container && open && parent) {\n const { direction, start, top } = position;\n this.style[\n direction !== FLOATING_MENU_POSITION_DIRECTION.RTL ? 'left' : 'right'\n ] = `${start}px`;\n this.style.top = `${top}px`;\n }\n });\n\n @HostListener('focusout')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleBlur = ({ relatedTarget }: FocusEvent) => {\n if (!this.contains(relatedTarget as Node)) {\n const { parent } = this;\n if (parent && parent !== relatedTarget) {\n parent.open = false;\n HTMLElement.prototype.focus.call(this.parent); // SVGElement in IE11 does not have `.focus()` method\n }\n }\n };\n\n @HostListener('click')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _click = (event: MouseEvent) => {\n const { parent } = this;\n if (parent) {\n parent.open = false;\n }\n };\n\n @HostListener('keydown')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n const { parent } = this;\n if (parent) {\n parent.open = false;\n }\n }\n }\n };\n\n /**\n * The DOM element, typically a custom element in this library, launching this floating menu.\n */\n protected parent: CDSFloatingMenuTrigger | null = null;\n\n /**\n * The menu direction.\n */\n abstract direction: FLOATING_MENU_DIRECTION;\n\n /**\n * `true` if the menu should be open.\n */\n abstract open: boolean;\n\n /**\n * `true` if the menu alignment should be flipped.\n */\n abstract flipped: boolean;\n\n /**\n * The DOM element to put this menu into.\n */\n get container() {\n return (\n closestComposed(\n this,\n (this.constructor as typeof CDSFloatingMenu).selectorContainer\n ) || this.ownerDocument!.body\n );\n }\n\n /**\n * The position of this floating menu.\n */\n get position(): FloatingMenuPosition {\n const { triggerPosition } = this.parent!;\n if (!triggerPosition) {\n throw new TypeError('Missing information of trigger button position.');\n }\n\n const { container } = this;\n const {\n left: refLeft = 0,\n top: refTop = 0,\n right: refRight = 0,\n bottom: refBottom = 0,\n } = triggerPosition;\n const { width, height } = this.getBoundingClientRect();\n const {\n left: containerLeft = 0,\n right: containerRight = 0,\n top: containerTop = 0,\n } = container.getBoundingClientRect();\n\n const containerComputedStyle =\n container.ownerDocument!.defaultView!.getComputedStyle(container);\n const positionDirection = containerComputedStyle.getPropertyValue(\n 'direction'\n ) as FLOATING_MENU_POSITION_DIRECTION;\n const isRtl = positionDirection === FLOATING_MENU_POSITION_DIRECTION.RTL;\n const containerStartFromViewport = !isRtl\n ? containerLeft\n : container.ownerDocument!.defaultView!.innerWidth - containerRight;\n const refStartFromContainer = !isRtl\n ? refLeft - containerLeft\n : containerRight - refRight;\n const refEndFromContainer = !isRtl\n ? refRight - containerLeft\n : containerRight - refLeft;\n const refTopFromContainer = refTop - containerTop;\n\n if (\n (container !== this.ownerDocument!.body ||\n containerStartFromViewport !== 0 ||\n containerTop !== 0) &&\n containerComputedStyle.getPropertyValue('position') === 'static'\n ) {\n throw new Error(\n 'Floating menu container must not have `position:static`.'\n );\n }\n\n const { flipped, direction } = this;\n if (Object.values(FLOATING_MENU_DIRECTION).indexOf(direction) < 0) {\n throw new Error(`Wrong menu position direction: ${direction}`);\n }\n\n const alignmentStart = flipped\n ? refEndFromContainer - width\n : refStartFromContainer;\n\n const { start, top } = {\n [FLOATING_MENU_DIRECTION.TOP]: () => ({\n start: alignmentStart,\n top: refTopFromContainer - height,\n }),\n [FLOATING_MENU_DIRECTION.BOTTOM]: () => ({\n start: alignmentStart,\n top: refBottom,\n }),\n }[direction]();\n\n return {\n direction: positionDirection,\n start,\n top,\n };\n }\n\n disconnectedCallback() {\n if (this._hObserveResizeContainer) {\n this._hObserveResizeContainer = this._hObserveResizeContainer.release();\n }\n if (this._hObserveResizeParent) {\n this._hObserveResizeParent = this._hObserveResizeParent.release();\n }\n }\n\n updated(changedProperties) {\n const { container, open, parent } = this;\n if (\n (changedProperties.has('flipped') ||\n changedProperties.has('direction') ||\n changedProperties.has('open')) &&\n open\n ) {\n if (!parent) {\n this.parent = this.parentElement as CDSFloatingMenuTrigger;\n container.appendChild(this);\n }\n // Note: `this.position` cannot be referenced until `this.parent` is set\n const { direction, start, top } = this.position;\n this.style[\n direction !== FLOATING_MENU_POSITION_DIRECTION.RTL ? 'left' : 'right'\n ] = `${start}px`;\n this.style.top = `${top}px`;\n }\n if (changedProperties.has('open')) {\n if (this._hObserveResizeContainer) {\n this._hObserveResizeContainer = this._hObserveResizeContainer.release();\n }\n if (this._hObserveResizeParent) {\n this._hObserveResizeParent = this._hObserveResizeParent.release();\n }\n if (open) {\n const { parentElement } = this.parent ?? {};\n this._hObserveResizeContainer = observeResize(\n this._resizeObserver,\n container\n );\n if (parentElement) {\n this._hObserveResizeParent = observeResize(\n this._resizeObserver,\n parentElement\n );\n }\n }\n }\n }\n\n /**\n * A constant indicating that this class is a floating menu.\n */\n static FLOATING_MENU = true;\n\n /**\n * The CSS selector to find the element to put this floating menu in.\n */\n static get selectorContainer() {\n return `[data-floating-menu-container],${prefix}-modal`;\n }\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n}\n\nexport default CDSFloatingMenu;\n"]}
|
|
@@ -13,9 +13,9 @@ import { LitElement } from 'lit';
|
|
|
13
13
|
import HostListener from '../../globals/decorators/host-listener';
|
|
14
14
|
import FocusMixin from '../../globals/mixins/focus';
|
|
15
15
|
import HostListenerMixin from '../../globals/mixins/host-listener';
|
|
16
|
-
import {
|
|
16
|
+
import { FLOATING_MENU_DIRECTION, FLOATING_MENU_POSITION_DIRECTION } from './defs';
|
|
17
17
|
import { prefix } from '../../globals/settings';
|
|
18
|
-
export {
|
|
18
|
+
export { FLOATING_MENU_DIRECTION, FLOATING_MENU_POSITION_DIRECTION };
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Position of floating menu, or trigger button of floating menu.
|
|
@@ -60,15 +60,15 @@ const closestComposed = (elem, selector) => {
|
|
|
60
60
|
/**
|
|
61
61
|
* Floating menu.
|
|
62
62
|
*/
|
|
63
|
-
let
|
|
64
|
-
class
|
|
63
|
+
let CDSFloatingMenu = _decorate(null, function (_initialize, _HostListenerMixin) {
|
|
64
|
+
class CDSFloatingMenu extends _HostListenerMixin {
|
|
65
65
|
constructor(...args) {
|
|
66
66
|
super(...args);
|
|
67
67
|
_initialize(this);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
return {
|
|
71
|
-
F:
|
|
71
|
+
F: CDSFloatingMenu,
|
|
72
72
|
d: [{
|
|
73
73
|
kind: "field",
|
|
74
74
|
key: "_hObserveResizeParent",
|
|
@@ -115,13 +115,45 @@ let BXFloatingMenu = _decorate(null, function (_initialize, _HostListenerMixin)
|
|
|
115
115
|
const {
|
|
116
116
|
parent
|
|
117
117
|
} = this;
|
|
118
|
-
if (parent) {
|
|
118
|
+
if (parent && parent !== relatedTarget) {
|
|
119
119
|
parent.open = false;
|
|
120
120
|
HTMLElement.prototype.focus.call(this.parent); // SVGElement in IE11 does not have `.focus()` method
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
+
}, {
|
|
126
|
+
kind: "field",
|
|
127
|
+
decorators: [HostListener('click')],
|
|
128
|
+
key: "_click",
|
|
129
|
+
value() {
|
|
130
|
+
return event => {
|
|
131
|
+
const {
|
|
132
|
+
parent
|
|
133
|
+
} = this;
|
|
134
|
+
if (parent) {
|
|
135
|
+
parent.open = false;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
kind: "field",
|
|
141
|
+
decorators: [HostListener('keydown')],
|
|
142
|
+
key: "_handleKeyDown",
|
|
143
|
+
value() {
|
|
144
|
+
return event => {
|
|
145
|
+
if (event.key === 'Tab') {
|
|
146
|
+
if (event.shiftKey) {
|
|
147
|
+
const {
|
|
148
|
+
parent
|
|
149
|
+
} = this;
|
|
150
|
+
if (parent) {
|
|
151
|
+
parent.open = false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
125
157
|
}, {
|
|
126
158
|
kind: "field",
|
|
127
159
|
key: "parent",
|
|
@@ -130,7 +162,7 @@ let BXFloatingMenu = _decorate(null, function (_initialize, _HostListenerMixin)
|
|
|
130
162
|
}
|
|
131
163
|
}, {
|
|
132
164
|
kind: "get",
|
|
133
|
-
key: "
|
|
165
|
+
key: "container",
|
|
134
166
|
value:
|
|
135
167
|
/**
|
|
136
168
|
* The handle for observing resize of the element containing the trigger button.
|
|
@@ -150,25 +182,10 @@ let BXFloatingMenu = _decorate(null, function (_initialize, _HostListenerMixin)
|
|
|
150
182
|
* The DOM element, typically a custom element in this library, launching this floating menu.
|
|
151
183
|
*/
|
|
152
184
|
|
|
153
|
-
/**
|
|
154
|
-
* The horizontal/vertical direction with regard to how the menu is aligned to the trigger button.
|
|
155
|
-
*/
|
|
156
|
-
function alignmentDirection() {
|
|
157
|
-
return {
|
|
158
|
-
[FLOATING_MENU_DIRECTION.LEFT]: FLOATING_MENU_DIRECTION_GROUP.VERTICAL,
|
|
159
|
-
[FLOATING_MENU_DIRECTION.TOP]: FLOATING_MENU_DIRECTION_GROUP.HORIZONTAL,
|
|
160
|
-
[FLOATING_MENU_DIRECTION.RIGHT]: FLOATING_MENU_DIRECTION_GROUP.VERTICAL,
|
|
161
|
-
[FLOATING_MENU_DIRECTION.BOTTOM]: FLOATING_MENU_DIRECTION_GROUP.HORIZONTAL
|
|
162
|
-
}[this.direction];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
185
|
/**
|
|
166
186
|
* The DOM element to put this menu into.
|
|
167
187
|
*/
|
|
168
|
-
|
|
169
|
-
kind: "get",
|
|
170
|
-
key: "container",
|
|
171
|
-
value: function container() {
|
|
188
|
+
function container() {
|
|
172
189
|
return closestComposed(this, this.constructor.selectorContainer) || this.ownerDocument.body;
|
|
173
190
|
}
|
|
174
191
|
|
|
@@ -203,59 +220,32 @@ let BXFloatingMenu = _decorate(null, function (_initialize, _HostListenerMixin)
|
|
|
203
220
|
right: containerRight = 0,
|
|
204
221
|
top: containerTop = 0
|
|
205
222
|
} = container.getBoundingClientRect();
|
|
206
|
-
const refCenterHorizontal = (refLeft + refRight) / 2;
|
|
207
|
-
const refCenterVertical = (refTop + refBottom) / 2;
|
|
208
223
|
const containerComputedStyle = container.ownerDocument.defaultView.getComputedStyle(container);
|
|
209
224
|
const positionDirection = containerComputedStyle.getPropertyValue('direction');
|
|
210
225
|
const isRtl = positionDirection === FLOATING_MENU_POSITION_DIRECTION.RTL;
|
|
211
226
|
const containerStartFromViewport = !isRtl ? containerLeft : container.ownerDocument.defaultView.innerWidth - containerRight;
|
|
212
227
|
const refStartFromContainer = !isRtl ? refLeft - containerLeft : containerRight - refRight;
|
|
213
228
|
const refEndFromContainer = !isRtl ? refRight - containerLeft : containerRight - refLeft;
|
|
214
|
-
const refCenterHorizontalFromContainer = !isRtl ? refCenterHorizontal - containerLeft : containerRight - refCenterHorizontal;
|
|
215
229
|
const refTopFromContainer = refTop - containerTop;
|
|
216
|
-
const refCenterVerticalFromContainer = refCenterVertical - containerTop;
|
|
217
230
|
if ((container !== this.ownerDocument.body || containerStartFromViewport !== 0 || containerTop !== 0) && containerComputedStyle.getPropertyValue('position') === 'static') {
|
|
218
231
|
throw new Error('Floating menu container must not have `position:static`.');
|
|
219
232
|
}
|
|
220
233
|
const {
|
|
221
|
-
|
|
222
|
-
alignmentDirection,
|
|
234
|
+
flipped,
|
|
223
235
|
direction
|
|
224
236
|
} = this;
|
|
225
|
-
if (Object.values(FLOATING_MENU_ALIGNMENT).indexOf(alignment) < 0) {
|
|
226
|
-
throw new Error(`Wrong menu alignment: ${alignment}`);
|
|
227
|
-
}
|
|
228
237
|
if (Object.values(FLOATING_MENU_DIRECTION).indexOf(direction) < 0) {
|
|
229
238
|
throw new Error(`Wrong menu position direction: ${direction}`);
|
|
230
239
|
}
|
|
231
|
-
const alignmentStart =
|
|
232
|
-
[FLOATING_MENU_DIRECTION_GROUP.HORIZONTAL]: {
|
|
233
|
-
[FLOATING_MENU_ALIGNMENT.START]: () => refStartFromContainer,
|
|
234
|
-
[FLOATING_MENU_ALIGNMENT.CENTER]: () => refCenterHorizontalFromContainer - width / 2,
|
|
235
|
-
[FLOATING_MENU_ALIGNMENT.END]: () => refEndFromContainer - width
|
|
236
|
-
},
|
|
237
|
-
[FLOATING_MENU_DIRECTION_GROUP.VERTICAL]: {
|
|
238
|
-
[FLOATING_MENU_ALIGNMENT.START]: () => refTopFromContainer,
|
|
239
|
-
[FLOATING_MENU_ALIGNMENT.CENTER]: () => refCenterVerticalFromContainer - height / 2,
|
|
240
|
-
[FLOATING_MENU_ALIGNMENT.END]: () => refBottom - height
|
|
241
|
-
}
|
|
242
|
-
}[alignmentDirection][alignment]();
|
|
240
|
+
const alignmentStart = flipped ? refEndFromContainer - width : refStartFromContainer;
|
|
243
241
|
const {
|
|
244
242
|
start,
|
|
245
243
|
top
|
|
246
244
|
} = {
|
|
247
|
-
[FLOATING_MENU_DIRECTION.LEFT]: () => ({
|
|
248
|
-
start: refStartFromContainer - width,
|
|
249
|
-
top: alignmentStart
|
|
250
|
-
}),
|
|
251
245
|
[FLOATING_MENU_DIRECTION.TOP]: () => ({
|
|
252
246
|
start: alignmentStart,
|
|
253
247
|
top: refTopFromContainer - height
|
|
254
248
|
}),
|
|
255
|
-
[FLOATING_MENU_DIRECTION.RIGHT]: () => ({
|
|
256
|
-
start: refEndFromContainer,
|
|
257
|
-
top: alignmentStart
|
|
258
|
-
}),
|
|
259
249
|
[FLOATING_MENU_DIRECTION.BOTTOM]: () => ({
|
|
260
250
|
start: alignmentStart,
|
|
261
251
|
top: refBottom
|
|
@@ -287,7 +277,7 @@ let BXFloatingMenu = _decorate(null, function (_initialize, _HostListenerMixin)
|
|
|
287
277
|
open,
|
|
288
278
|
parent
|
|
289
279
|
} = this;
|
|
290
|
-
if ((changedProperties.has('
|
|
280
|
+
if ((changedProperties.has('flipped') || changedProperties.has('direction') || changedProperties.has('open')) && open) {
|
|
291
281
|
if (!parent) {
|
|
292
282
|
this.parent = this.parentElement;
|
|
293
283
|
container.appendChild(this);
|
|
@@ -354,5 +344,5 @@ let BXFloatingMenu = _decorate(null, function (_initialize, _HostListenerMixin)
|
|
|
354
344
|
}]
|
|
355
345
|
};
|
|
356
346
|
}, HostListenerMixin(FocusMixin(LitElement)));
|
|
357
|
-
export default
|
|
347
|
+
export default CDSFloatingMenu;
|
|
358
348
|
//# sourceMappingURL=floating-menu.js.map
|