@adyen/bento-mcp 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +24 -2
- package/SKILL.md +37 -7
- package/dist/assets/components/accordion/accordion.stories.ts +1 -1
- package/dist/assets/components/accordion/components/accordion-item.stories.ts +1 -1
- package/dist/assets/components/accordion/components/accordion-item.vue +1 -1
- package/dist/assets/components/action-bar/action-bar.docs.mdx +10 -3
- package/dist/assets/components/action-bar/action-bar.internal.types.ts +1 -0
- package/dist/assets/components/action-bar/action-bar.stories.ts +1 -1
- package/dist/assets/components/action-bar/action-bar.types.ts +1 -1
- package/dist/assets/components/action-bar/action-bar.vue +1 -1
- package/dist/assets/components/ai-tag/ai-tag.stories.ts +1 -1
- package/dist/assets/components/ai-tag/ai-tag.vue +1 -1
- package/dist/assets/components/alert/alert.stories.ts +1 -1
- package/dist/assets/components/alert/alert.types.ts +1 -1
- package/dist/assets/components/anchor-scroller/anchor-scroller.stories.ts +1 -1
- package/dist/assets/components/anchor-scroller/anchor-scroller.vue +1 -1
- package/dist/assets/components/avatar/avatar.internal.types.ts +1 -0
- package/dist/assets/components/avatar/avatar.stories.ts +1 -1
- package/dist/assets/components/avatar/avatar.types.ts +1 -1
- package/dist/assets/components/button/button.docs.mdx +4 -3
- package/dist/assets/components/button/button.stories.ts +1 -1
- package/dist/assets/components/button/button.types.ts +1 -1
- package/dist/assets/components/button/components/ai-button/ai-button.stories.ts +1 -1
- package/dist/assets/components/button/components/ai-button/ai-button.vue +1 -1
- package/dist/assets/components/button/components/button-actions/button-actions.docs.mdx +3 -0
- package/dist/assets/components/button/components/button-actions/button-actions.internal.types.ts +1 -0
- package/dist/assets/components/button/components/button-actions/button-actions.stories.ts +1 -1
- package/dist/assets/components/button/components/button-actions/button-actions.types.ts +1 -1
- package/dist/assets/components/button/components/button-actions/button-actions.vue +1 -1
- package/dist/assets/components/button/components/loading-button/loading-button.docs.mdx +26 -23
- package/dist/assets/components/button/components/loading-button/loading-button.stories.ts +1 -1
- package/dist/assets/components/button/components/loading-button/loading-button.vue +1 -1
- package/dist/assets/components/button/components/toggle-button/toggle-button.stories.ts +1 -1
- package/dist/assets/components/card/card.docs.mdx +18 -1
- package/dist/assets/components/card/card.stories.ts +1 -1
- package/dist/assets/components/card/card.types.ts +1 -1
- package/dist/assets/components/card/card.vue +1 -1
- package/dist/assets/components/checkbox/checkbox.stories.ts +1 -1
- package/dist/assets/components/checkbox/checkbox.types.ts +1 -1
- package/dist/assets/components/checkbox/checkbox.vue +1 -1
- package/dist/assets/components/checkbox/components/checkbox-group/checkbox-group.docs.mdx +9 -14
- package/dist/assets/components/checkbox/components/checkbox-group/checkbox-group.stories.ts +1 -1
- package/dist/assets/components/checkbox/components/checkbox-group/checkbox-group.types.ts +1 -1
- package/dist/assets/components/checkbox/components/checkbox-group/checkbox-group.vue +1 -1
- package/dist/assets/components/chip/chip.stories.ts +1 -1
- package/dist/assets/components/chip/chip.vue +1 -1
- package/dist/assets/components/click-outside/click-outside.stories.ts +1 -1
- package/dist/assets/components/code-snippet/code-snippet.types.ts +1 -1
- package/dist/assets/components/code-snippet/code-snippet.vue +1 -1
- package/dist/assets/components/country/country.stories.ts +1 -1
- package/dist/assets/components/country/country.types.ts +1 -1
- package/dist/assets/components/country/country.vue +1 -1
- package/dist/assets/components/currency/currency.stories.ts +1 -1
- package/dist/assets/components/currency/currency.vue +1 -1
- package/dist/assets/components/dashed-underline/dashed-underline.stories.ts +1 -1
- package/dist/assets/components/data-grid/components/data-grid-cell-actions/data-grid-cell-actions.types.ts +1 -1
- package/dist/assets/components/data-grid/components/data-grid-cell-actions/data-grid-cell-actions.vue +1 -1
- package/dist/assets/components/data-grid/components/data-grid-config-settings/data-grid-config-settings.vue +1 -1
- package/dist/assets/components/data-grid/components/data-grid-row/data-grid-row.vue +1 -1
- package/dist/assets/components/data-grid/components/data-grid-static-icon/data-grid-static-icon.stories.ts +1 -1
- package/dist/assets/components/data-grid/components/data-grid-summary-cell/data-grid-summary-cell.stories.ts +1 -1
- package/dist/assets/components/data-grid/components/data-grid-summary-cell/data-grid-summary-cell.vue +1 -1
- package/dist/assets/components/data-grid/components/data-grid-tag-with-text-cell/data-grid-tag-with-text-cell.stories.ts +1 -1
- package/dist/assets/components/data-grid/components/data-grid-trend-cell/data-grid-trend-cell.stories.ts +1 -1
- package/dist/assets/components/data-grid/components/data-grid-trend-cell/data-grid-trend-cell.vue +1 -1
- package/dist/assets/components/data-grid/data-grid.docs.mdx +3 -60
- package/dist/assets/components/data-grid/data-grid.stories.ts +1 -1
- package/dist/assets/components/data-grid/data-grid.vue +1 -1
- package/dist/assets/components/date/date.stories.ts +1 -1
- package/dist/assets/components/date-picker/date-picker.stories.ts +1 -1
- package/dist/assets/components/date-picker/date-picker.types.ts +1 -1
- package/dist/assets/components/date-picker/date-picker.vue +1 -1
- package/dist/assets/components/date-range-picker/components/date-range-picker-calendar/date-range-picker-calendar.vue +1 -1
- package/dist/assets/components/date-range-picker/components/date-time-input/date-time-input.types.ts +1 -1
- package/dist/assets/components/date-range-picker/components/date-time-input/date-time-input.vue +1 -1
- package/dist/assets/components/date-range-picker/date-range-picker.docs.mdx +31 -6
- package/dist/assets/components/date-range-picker/date-range-picker.stories.ts +1 -1
- package/dist/assets/components/date-range-picker/date-range-picker.types.ts +1 -1
- package/dist/assets/components/date-range-picker/date-range-picker.vue +1 -1
- package/dist/assets/components/date-time-picker/date-time-picker.stories.ts +1 -1
- package/dist/assets/components/date-time-picker/date-time-picker.types.ts +1 -1
- package/dist/assets/components/divider/divider.internal.types.ts +1 -0
- package/dist/assets/components/divider/divider.stories.ts +1 -1
- package/dist/assets/components/divider/divider.types.ts +1 -1
- package/dist/assets/components/divider/divider.vue +1 -1
- package/dist/assets/components/draggable/components/draggable-handle/draggable-handle.stories.ts +1 -1
- package/dist/assets/components/draggable/draggable.stories.ts +1 -1
- package/dist/assets/components/draggable/draggable.vue +1 -1
- package/dist/assets/components/drawer/drawer.stories.ts +1 -1
- package/dist/assets/components/dropdown/components/dropdown-base-textbox/dropdown-base-textbox.internal.types.ts +1 -0
- package/dist/assets/components/dropdown/components/dropdown-base-textbox/dropdown-base-textbox.types.ts +1 -1
- package/dist/assets/components/dropdown/components/dropdown-base-textbox/dropdown-base-textbox.vue +1 -1
- package/dist/assets/components/dropdown/components/dropdown-default-textbox/dropdown-default-textbox.vue +1 -1
- package/dist/assets/components/dropdown/components/dropdown-options-container/dropdown-options-container.vue +1 -1
- package/dist/assets/components/dropdown/components/dropdown-small-textbox/dropdown-small-textbox.vue +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.stories.ts +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.types.ts +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.vue +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-country/dropdown-country.stories.ts +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-country/dropdown-country.types.ts +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-country/dropdown-country.vue +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-currency/dropdown-currency.stories.ts +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-currency/dropdown-currency.types.ts +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-currency/dropdown-currency.vue +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.stories.ts +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.types.ts +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.vue +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-tag/dropdown-tag.stories.ts +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-tag/dropdown-tag.types.ts +1 -1
- package/dist/assets/components/dropdown/components/variants/dropdown-tag/dropdown-tag.vue +1 -1
- package/dist/assets/components/dropdown/dropdown.docs.mdx +4 -40
- package/dist/assets/components/dropdown/dropdown.internal.types.ts +1 -0
- package/dist/assets/components/dropdown/dropdown.stories.ts +1 -1
- package/dist/assets/components/dropdown/dropdown.types.ts +1 -1
- package/dist/assets/components/dropdown/dropdown.vue +1 -1
- package/dist/assets/components/empty-state/empty-state.stories.ts +1 -1
- package/dist/assets/components/empty-state/empty-state.types.ts +1 -1
- package/dist/assets/components/file-uploader/components/file-uploader-file-card/file-uploader-file-card.stories.ts +1 -1
- package/dist/assets/components/file-uploader/components/file-uploader-file-card/file-uploader-file-card.types.ts +1 -1
- package/dist/assets/components/file-uploader/components/file-uploader-file-card/file-uploader-file-card.vue +1 -1
- package/dist/assets/components/file-uploader/components/file-uploader-restrictions/file-uploader-restrictions.types.ts +1 -1
- package/dist/assets/components/file-uploader/components/file-uploader-restrictions/file-uploader-restrictions.vue +1 -1
- package/dist/assets/components/file-uploader/file-uploader.internal.types.ts +1 -0
- package/dist/assets/components/file-uploader/file-uploader.stories.ts +1 -1
- package/dist/assets/components/file-uploader/file-uploader.types.ts +1 -1
- package/dist/assets/components/file-uploader/file-uploader.vue +1 -1
- package/dist/assets/components/filter-bar/components/all-filters-modal/all-filters-modal.stories.ts +1 -1
- package/dist/assets/components/filter-bar/components/all-filters-modal/all-filters-modal.types.ts +1 -1
- package/dist/assets/components/filter-bar/components/all-filters-modal/all-filters-modal.vue +1 -1
- package/dist/assets/components/filter-bar/components/all-filters-modal/components/all-filters-modal-filter-selection/all-filters-modal-filter-selection.types.ts +1 -0
- package/dist/assets/components/filter-bar/components/all-filters-modal/components/all-filters-modal-filter-selection/all-filters-modal-filter-selection.vue +1 -0
- package/dist/assets/components/filter-bar/components/all-filters-modal/components/all-filters-modal-selected-filter/all-filters-modal-selected-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/base-filter/base-filter.internal.types.ts +1 -0
- package/dist/assets/components/filter-bar/components/base-filter/base-filter.types.ts +1 -1
- package/dist/assets/components/filter-bar/components/base-filter/base-filter.vue +1 -1
- package/dist/assets/components/filter-bar/components/boolean-filter/boolean-filter.vue +1 -1
- package/dist/assets/components/filter-bar/components/date-filter/date-filter.vue +1 -1
- package/dist/assets/components/filter-bar/components/date-range-filter/date-range-filter.vue +1 -1
- package/dist/assets/components/filter-bar/components/input-filter/input-filter.types.ts +1 -1
- package/dist/assets/components/filter-bar/components/input-filter/input-filter.vue +1 -1
- package/dist/assets/components/filter-bar/components/input-with-dropdown-filter/input-with-dropdown-filter.stories.ts +1 -1
- package/dist/assets/components/filter-bar/components/input-with-dropdown-filter/input-with-dropdown-filter.vue +1 -1
- package/dist/assets/components/filter-bar/components/select-filter/components/select-filter-button/select-filter-button.vue +1 -1
- package/dist/assets/components/filter-bar/components/select-filter/select-filter.vue +1 -1
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-avatar-filter/select-avatar-filter.stories.ts +1 -1
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-country-filter/select-country-filter.stories.ts +1 -1
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-country-filter/select-country-filter.vue +1 -1
- package/dist/assets/components/filter-bar/components/toggle-filter/toggle-filter.vue +1 -1
- package/dist/assets/components/filter-bar/filter-bar.docs.mdx +4 -62
- package/dist/assets/components/filter-bar/filter-bar.stories.ts +1 -1
- package/dist/assets/components/filter-bar/filter-bar.types.ts +1 -1
- package/dist/assets/components/filter-bar/filter-bar.vue +1 -1
- package/dist/assets/components/form-layout/form-layout.docs.mdx +0 -23
- package/dist/assets/components/form-layout/form-layout.stories.ts +1 -1
- package/dist/assets/components/header/header.stories.ts +1 -1
- package/dist/assets/components/header/header.types.ts +1 -1
- package/dist/assets/components/header/header.vue +1 -1
- package/dist/assets/components/header-with-views/components/header-with-views-all-views/header-with-views-all-views.vue +1 -1
- package/dist/assets/components/header-with-views/components/header-with-views-item-edit-form/header-with-views-edit-form.types.ts +1 -1
- package/dist/assets/components/header-with-views/components/header-with-views-item-edit-form/header-with-views-edit-form.vue +1 -1
- package/dist/assets/components/header-with-views/header-with-views.internal.types.ts +1 -0
- package/dist/assets/components/header-with-views/header-with-views.stories.ts +1 -1
- package/dist/assets/components/header-with-views/header-with-views.types.ts +1 -1
- package/dist/assets/components/header-with-views/header-with-views.vue +1 -1
- package/dist/assets/components/image/image.stories.ts +1 -1
- package/dist/assets/components/info-icon/info-icon.stories.ts +1 -1
- package/dist/assets/components/input-field/input-field.docs.mdx +1 -13
- package/dist/assets/components/input-field/input-field.stories.ts +1 -1
- package/dist/assets/components/input-field/input-field.types.ts +1 -1
- package/dist/assets/components/input-field/input-field.vue +1 -1
- package/dist/assets/components/input-field-password/input-field-password.internal.types.ts +1 -0
- package/dist/assets/components/input-field-password/input-field-password.stories.ts +1 -1
- package/dist/assets/components/input-field-password/input-field-password.types.ts +1 -1
- package/dist/assets/components/input-field-password/input-field-password.vue +1 -1
- package/dist/assets/components/input-field-phone-number/input-field-phone-number.stories.ts +1 -1
- package/dist/assets/components/input-field-phone-number/input-field-phone-number.types.ts +1 -1
- package/dist/assets/components/input-field-phone-number/input-field-phone-number.vue +1 -1
- package/dist/assets/components/input-time/input-time.docs.mdx +17 -0
- package/dist/assets/components/input-time/input-time.stories.ts +1 -1
- package/dist/assets/components/input-time/input-time.types.ts +1 -1
- package/dist/assets/components/input-time/input-time.vue +1 -1
- package/dist/assets/components/inspector/inspector.stories.ts +1 -1
- package/dist/assets/components/inspector/inspector.vue +1 -1
- package/dist/assets/components/layout/components/layout-row/layout-row.stories.ts +1 -1
- package/dist/assets/components/layout/components/layout-row/layout-row.vue +1 -1
- package/dist/assets/components/layout/layout.docs.mdx +10 -0
- package/dist/assets/components/layout/layout.internal.types.ts +1 -0
- package/dist/assets/components/layout/layout.stories.ts +1 -1
- package/dist/assets/components/layout/layout.types.ts +1 -1
- package/dist/assets/components/link/link.stories.ts +1 -1
- package/dist/assets/components/link/link.types.ts +1 -1
- package/dist/assets/components/link/link.vue +1 -1
- package/dist/assets/components/list/list.stories.ts +1 -1
- package/dist/assets/components/loading-indicator/loading-indicator.stories.ts +1 -1
- package/dist/assets/components/menu/components/menu-item/menu-item.types.ts +1 -1
- package/dist/assets/components/menu/components/menu-item/menu-item.vue +1 -1
- package/dist/assets/components/menu/components/menu-item-list/menu-item-list.vue +1 -1
- package/dist/assets/components/menu/components/sub-menu-item-list/sub-menu-item-list.vue +1 -1
- package/dist/assets/components/menu/menu.docs.mdx +17 -7
- package/dist/assets/components/menu/menu.stories.ts +1 -1
- package/dist/assets/components/menu/menu.types.ts +1 -1
- package/dist/assets/components/menu/menu.vue +1 -1
- package/dist/assets/components/modal/components/base-modal/base-modal.vue +1 -1
- package/dist/assets/components/modal/components/modal-page/modal-page.vue +1 -1
- package/dist/assets/components/modal/modal.internal.types.ts +1 -0
- package/dist/assets/components/modal/modal.stories.ts +1 -1
- package/dist/assets/components/modal/modal.types.ts +1 -1
- package/dist/assets/components/modal/modal.vue +1 -1
- package/dist/assets/components/modal-fullscreen/components/modal-fullscreen-page.vue +1 -1
- package/dist/assets/components/modal-fullscreen/modal-fullscreen.stories.ts +1 -1
- package/dist/assets/components/modal-fullscreen/modal-fullscreen.vue +1 -1
- package/dist/assets/components/navigation-menu/components/navigation-menu-group/navigation-menu-group.internal.types.ts +1 -0
- package/dist/assets/components/navigation-menu/components/navigation-menu-group/navigation-menu-group.types.ts +1 -1
- package/dist/assets/components/navigation-menu/components/navigation-menu-group/navigation-menu-group.vue +1 -1
- package/dist/assets/components/navigation-menu/components/navigation-menu-item/navigation-menu-item.vue +1 -1
- package/dist/assets/components/navigation-menu/navigation-menu.internal.types.ts +1 -0
- package/dist/assets/components/navigation-menu/navigation-menu.stories.ts +1 -1
- package/dist/assets/components/navigation-menu/navigation-menu.types.ts +1 -1
- package/dist/assets/components/navigation-menu/navigation-menu.vue +1 -1
- package/dist/assets/components/pagination/components/pagination-context/pagination-context.vue +1 -1
- package/dist/assets/components/pagination/components/pagination-results-per-page/pagination-results-per-page.vue +1 -1
- package/dist/assets/components/pagination/pagination.stories.ts +1 -1
- package/dist/assets/components/pagination/pagination.types.ts +1 -1
- package/dist/assets/components/pagination/pagination.vue +1 -1
- package/dist/assets/components/payment-method/payment-method.stories.ts +1 -1
- package/dist/assets/components/payment-method/payment-method.types.ts +1 -1
- package/dist/assets/components/popover/popover.docs.mdx +32 -9
- package/dist/assets/components/popover/popover.stories.ts +1 -1
- package/dist/assets/components/popover/popover.types.ts +1 -1
- package/dist/assets/components/popover/popover.vue +1 -1
- package/dist/assets/components/popper-container/popper-container.types.ts +1 -1
- package/dist/assets/components/popper-container/popper-container.vue +1 -1
- package/dist/assets/components/progress-bar/progress-bar.docs.mdx +102 -0
- package/dist/assets/components/progress-bar/progress-bar.stories.ts +1 -0
- package/dist/assets/components/progress-bar/progress-bar.types.ts +1 -0
- package/dist/assets/components/progress-bar/progress-bar.vue +1 -0
- package/dist/assets/components/promo-banner/promo-banner.stories.ts +1 -1
- package/dist/assets/components/promo-banner/promo-banner.types.ts +1 -1
- package/dist/assets/components/promo-banner/promo-banner.vue +1 -1
- package/dist/assets/components/radio-group/components/radio-button/radio-button.vue +1 -1
- package/dist/assets/components/radio-group/radio-group.docs.mdx +1 -6
- package/dist/assets/components/radio-group/radio-group.stories.ts +1 -1
- package/dist/assets/components/radio-group/radio-group.types.ts +1 -1
- package/dist/assets/components/radio-group/radio-group.vue +1 -1
- package/dist/assets/components/rich-text-editor/rich-text-editor.internal.types.ts +1 -0
- package/dist/assets/components/rich-text-editor/rich-text-editor.stories.ts +1 -1
- package/dist/assets/components/rich-text-editor/rich-text-editor.types.ts +1 -1
- package/dist/assets/components/rich-text-editor/rich-text-editor.vue +1 -1
- package/dist/assets/components/search-bar/search-bar.stories.ts +1 -1
- package/dist/assets/components/search-bar/search-bar.vue +1 -1
- package/dist/assets/components/secondary-nav/components/secondary-nav-item/secondary-nav-item.vue +1 -1
- package/dist/assets/components/secondary-nav/secondary-nav.stories.ts +1 -1
- package/dist/assets/components/secondary-nav/secondary-nav.vue +1 -1
- package/dist/assets/components/segmented-control/components/segmented-control-button/segmented-control-button.vue +1 -1
- package/dist/assets/components/segmented-control/segmented-control.stories.ts +1 -1
- package/dist/assets/components/segmented-control/segmented-control.types.ts +1 -1
- package/dist/assets/components/segmented-control/segmented-control.vue +1 -1
- package/dist/assets/components/selection-card/components/selection-card-group/selection-card-group.docs.mdx +12 -13
- package/dist/assets/components/selection-card/components/selection-card-group/selection-card-group.stories.ts +1 -1
- package/dist/assets/components/selection-card/components/selection-card-group/selection-card-group.vue +1 -1
- package/dist/assets/components/selection-card/selection-card.stories.ts +1 -1
- package/dist/assets/components/selection-card/selection-card.types.ts +1 -1
- package/dist/assets/components/selection-card/selection-card.vue +1 -1
- package/dist/assets/components/sidepanel/sidepanel.docs.mdx +1 -1
- package/dist/assets/components/sidepanel/sidepanel.stories.ts +1 -1
- package/dist/assets/components/sidepanel/sidepanel.vue +1 -1
- package/dist/assets/components/status/status.stories.ts +1 -1
- package/dist/assets/components/status/status.types.ts +1 -1
- package/dist/assets/components/stepper/components/step/step.vue +1 -1
- package/dist/assets/components/stepper/stepper.stories.ts +1 -1
- package/dist/assets/components/stepper/stepper.vue +1 -1
- package/dist/assets/components/structured-list/structured-list.stories.ts +1 -1
- package/dist/assets/components/structured-list/structured-list.vue +1 -1
- package/dist/assets/components/summary-grid/components/summary-grid-item/summary-grid-item.types.ts +1 -1
- package/dist/assets/components/summary-grid/summary-grid.stories.ts +1 -1
- package/dist/assets/components/summary-grid/summary-grid.types.ts +1 -1
- package/dist/assets/components/table-of-contents/components/table-of-contents-list/table-of-contents-list.vue +1 -1
- package/dist/assets/components/table-of-contents/table-of-contents.internal.types.ts +1 -0
- package/dist/assets/components/table-of-contents/table-of-contents.stories.ts +1 -1
- package/dist/assets/components/table-of-contents/table-of-contents.types.ts +1 -1
- package/dist/assets/components/table-of-contents/table-of-contents.vue +1 -1
- package/dist/assets/components/tabs/components/tab.internal.types.ts +1 -0
- package/dist/assets/components/tabs/components/tab.types.ts +1 -1
- package/dist/assets/components/tabs/components/tab.vue +1 -1
- package/dist/assets/components/tabs/tabs.stories.ts +1 -1
- package/dist/assets/components/tabs/tabs.vue +1 -1
- package/dist/assets/components/tag/tag.docs.mdx +1 -1
- package/dist/assets/components/tag/tag.stories.ts +1 -1
- package/dist/assets/components/tag/tag.types.ts +1 -1
- package/dist/assets/components/tag/tag.vue +1 -1
- package/dist/assets/components/textarea/textarea.docs.mdx +0 -7
- package/dist/assets/components/textarea/textarea.stories.ts +1 -1
- package/dist/assets/components/textarea/textarea.types.ts +1 -1
- package/dist/assets/components/textarea/textarea.vue +1 -1
- package/dist/assets/components/timeline/components/timeline-item/timeline-item.stories.ts +1 -1
- package/dist/assets/components/timeline/components/timeline-item/timeline-item.vue +1 -1
- package/dist/assets/components/timeline/timeline.docs.mdx +0 -10
- package/dist/assets/components/timeline/timeline.internal.types.ts +1 -0
- package/dist/assets/components/timeline/timeline.stories.ts +1 -1
- package/dist/assets/components/timeline/timeline.types.ts +1 -1
- package/dist/assets/components/timeline/timeline.vue +1 -1
- package/dist/assets/components/toast/components/toast-item/toast-item.vue +1 -1
- package/dist/assets/components/toggle/toggle.stories.ts +1 -1
- package/dist/assets/components/toggle/toggle.types.ts +1 -1
- package/dist/assets/components/toggle/toggle.vue +1 -1
- package/dist/assets/components/tutorial/tutorial.stories.ts +1 -1
- package/dist/assets/components/typography/typography.stories.ts +1 -1
- package/dist/assets/components/typography/typography.types.ts +1 -1
- package/dist/assets/components/typography/typography.vue +1 -1
- package/dist/assets/components.json +1 -0
- package/dist/assets/composables/use-bento-base-filter/index.ts +1 -0
- package/dist/assets/composables/use-bento-base-filter/use-bento-base-filter.ts +1 -0
- package/dist/assets/composables/use-bento-base-filter/utils/index.ts +1 -0
- package/dist/assets/composables/use-bento-base-filter/utils/utils.ts +1 -0
- package/dist/assets/composables/use-bento-currency/index.ts +1 -0
- package/dist/assets/composables/use-bento-currency/use-bento-currency.stories.ts +1 -1
- package/dist/assets/composables/use-bento-currency/use-bento-currency.ts +1 -0
- package/dist/assets/composables/use-bento-delayed-hover/index.ts +1 -0
- package/dist/assets/composables/use-bento-delayed-hover/use-bento-delayed-hover.stories.ts +1 -1
- package/dist/assets/composables/use-bento-delayed-hover/use-bento-delayed-hover.ts +1 -0
- package/dist/assets/composables/use-bento-theme/index.ts +1 -0
- package/dist/assets/composables/use-bento-theme/install.ts +1 -1
- package/dist/assets/composables/use-bento-theme/install.types.ts +1 -1
- package/dist/assets/composables/use-bento-theme/use-bento-theme.ts +1 -0
- package/dist/assets/composables/use-bento-toast-controller/index.ts +1 -0
- package/dist/assets/composables/use-bento-toast-controller/toast-stack.ts +1 -0
- package/dist/assets/composables/use-bento-toast-controller/use-bento-toast-controller.ts +1 -0
- package/dist/assets/composables/use-click-outside/index.ts +1 -0
- package/dist/assets/composables/use-click-outside/use-click-outside.stories.ts +1 -1
- package/dist/assets/composables/use-click-outside/use-click-outside.ts +1 -0
- package/dist/assets/composables/use-form-validate/index.ts +1 -0
- package/dist/assets/composables/use-form-validate/use-form.ts +1 -0
- package/dist/assets/composables/use-form-validate/use-form.types.ts +1 -1
- package/dist/assets/composables.json +9 -0
- package/dist/assets/deprecations.md +139 -243
- package/dist/assets/directives/highlight/highlight.stories.ts +1 -1
- package/dist/assets/directives/keyboard-navigation/keyboard-navigation.stories.ts +1 -1
- package/dist/assets/directives/tooltip/tooltip.internal.types.ts +1 -0
- package/dist/assets/directives/tooltip/tooltip.stories.ts +1 -1
- package/dist/assets/directives/tooltip/tooltip.types.ts +1 -1
- package/dist/assets/icons.json +1 -0
- package/dist/assets/index.ts +1 -1
- package/dist/assets/install.ts +1 -1
- package/dist/assets/tailwind/README.md +3 -3
- package/dist/assets/templates/dashboard-template/components/dashboard-section/dashboard-section.stories.ts +1 -1
- package/dist/assets/templates/dashboard-template/dashboard-template.stories.ts +1 -1
- package/dist/assets/templates/data-grid-template/data-grid-template.stories.ts +1 -1
- package/dist/assets/usage.json +81 -80
- package/dist/assets/variables.css +152 -140
- package/dist/main.js +228 -34
- package/package.json +2 -2
- package/dist/assets/components/internal/base-button/base-button.types.ts +0 -1
- package/dist/assets/components/internal/base-button/base-button.vue +0 -1
- package/dist/assets/components/internal/button-actions-with-menu/button-actions-with-menu.stories.ts +0 -1
- package/dist/assets/components/internal/button-actions-with-menu/button-actions-with-menu.types.ts +0 -1
- package/dist/assets/components/internal/button-actions-with-menu/button-actions-with-menu.vue +0 -1
- package/dist/assets/components/internal/calendar/calendar.stories.ts +0 -1
- package/dist/assets/components/internal/calendar/calendar.types.ts +0 -1
- package/dist/assets/components/internal/calendar/calendar.vue +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-month/calendar-month.stories.ts +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-month/calendar-month.types.ts +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-month/calendar-month.vue +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-month/components/calendar-month-day/__test__/calendar-month-day-stub.vue +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-month/components/calendar-month-day/calendar-month-day.stories.ts +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-month/components/calendar-month-day/calendar-month-day.types.ts +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-month/components/calendar-month-day/calendar-month-day.vue +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-month/composables/granular-min-max-date.types.ts +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-year/calendar-year.types.ts +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-year/calendar-year.vue +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-year/components/calendar-year-month/__test__/calendar-year-month-stub.vue +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-year/components/calendar-year-month/calendar-year-month.types.ts +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-year/components/calendar-year-month/calendar-year-month.vue +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-year-selector/calendar-year-selector.types.ts +0 -1
- package/dist/assets/components/internal/calendar/components/calendar-year-selector/calendar-year-selector.vue +0 -1
- package/dist/assets/components/internal/calendar/composables/use-granularity-adjustments.types.ts +0 -1
- package/dist/assets/components/internal/calendar/composables/use-range-pane.types.ts +0 -1
- package/dist/assets/components/internal/checkbox-input/checkbox-input.stories.ts +0 -1
- package/dist/assets/components/internal/checkbox-input/checkbox-input.types.ts +0 -1
- package/dist/assets/components/internal/checkbox-input/checkbox-input.vue +0 -1
- package/dist/assets/components/internal/controls-group/controls-group.vue +0 -1
- package/dist/assets/components/internal/copy/copy.docs.mdx +0 -43
- package/dist/assets/components/internal/copy/copy.stories.ts +0 -1
- package/dist/assets/components/internal/copy/copy.types.ts +0 -1
- package/dist/assets/components/internal/copy/copy.vue +0 -1
- package/dist/assets/components/internal/decorative-checkbox/decorative-checkbox.vue +0 -1
- package/dist/assets/components/internal/dialog-page/dialog-page.types.ts +0 -1
- package/dist/assets/components/internal/dialog-page/dialog-page.vue +0 -1
- package/dist/assets/components/internal/error-message/error-message.vue +0 -1
- package/dist/assets/components/internal/field-label/field-label.vue +0 -1
- package/dist/assets/components/internal/fixed-scroller/fixed-scroller.docs.mdx +0 -21
- package/dist/assets/components/internal/fixed-scroller/fixed-scroller.stories.ts +0 -1
- package/dist/assets/components/internal/fixed-scroller/fixed-scroller.vue +0 -1
- package/dist/assets/components/internal/footer-actions/footer-actions.vue +0 -1
- package/dist/assets/components/internal/grid-layout/grid-layout.types.ts +0 -1
- package/dist/assets/components/internal/grid-layout/grid-layout.vue +0 -1
- package/dist/assets/components/internal/header-meta/header-meta.types.ts +0 -1
- package/dist/assets/components/internal/header-meta/header-meta.vue +0 -1
- package/dist/assets/components/internal/info-icon-with-popover/info-icon-with-popover.vue +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-lazy-load/listbox-lazy-load.types.ts +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-lazy-load/listbox-lazy-load.vue +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/components/listbox-multi-select-category/listbox-multi-select-category.types.ts +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/components/listbox-multi-select-category/listbox-multi-select-category.vue +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/components/listbox-multi-select-nested-lazy-load/listbox-multi-select-nested-lazy-load.types.ts +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/components/listbox-multi-select-nested-lazy-load/listbox-multi-select-nested-lazy-load.vue +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/listbox-multi-select-options.types.ts +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/listbox-multi-select-options.vue +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-multi-select/listbox-multi-select.types.ts +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-multi-select/listbox-multi-select.vue +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-option/listbox-option.vue +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-option-tag/listbox-option-tag.vue +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-single-select/components/listbox-single-select-category/listbox-single-select-category.vue +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-single-select/listbox-single-select.vue +0 -1
- package/dist/assets/components/internal/listbox/components/listbox-single-select-option/listbox-single-select-option.vue +0 -1
- package/dist/assets/components/internal/listbox/listbox.stories.ts +0 -1
- package/dist/assets/components/internal/listbox/listbox.types.ts +0 -1
- package/dist/assets/components/internal/listbox/listbox.vue +0 -1
- package/dist/assets/components/internal/radio-input/radio-input.stories.ts +0 -1
- package/dist/assets/components/internal/radio-input/radio-input.types.ts +0 -1
- package/dist/assets/components/internal/radio-input/radio-input.vue +0 -1
- package/dist/assets/components/internal/teleport/teleport.types.ts +0 -1
- package/dist/assets/components/internal/teleport/teleport.vue +0 -1
- package/dist/assets/components/internal/tooltip/tooltip.test.vue +0 -1
- package/dist/assets/components/internal/tooltip/tooltip.types.ts +0 -1
- package/dist/assets/components/internal/tooltip/tooltip.vue +0 -1
- package/dist/assets/composables/use-form-validate-zod-4/use-form.types.ts +0 -1
- package/dist/assets/composables/use-numeric-input/use-numeric-input.types.ts +0 -1
- package/dist/assets/composables/use-section-navigation-keyboard/use-section-navigation-keyboard.types.ts +0 -1
- package/dist/assets/composables/use-virtual-list/use-virtual-list.types.ts +0 -1
|
@@ -24,7 +24,7 @@ Think of these utilities as tools for:
|
|
|
24
24
|
For implementing standard interface patterns (buttons, inputs, cards, etc.), using the pre-built components from the
|
|
25
25
|
main Bento library is generally recommended for consistency and accessibility.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## What's customized?
|
|
28
28
|
|
|
29
29
|
This preset removes default Tailwind values for categories that are fully managed by Bento:
|
|
30
30
|
|
|
@@ -58,7 +58,7 @@ npm install @adyen/bento-tailwind
|
|
|
58
58
|
|
|
59
59
|
## Usage
|
|
60
60
|
|
|
61
|
-
###
|
|
61
|
+
### Import the Bento styles
|
|
62
62
|
|
|
63
63
|
For Adyen's consistent look and feel, you'll need to import CSS variables for Bento's foundational design rules for
|
|
64
64
|
colors, fonts, and spacing.
|
|
@@ -82,7 +82,7 @@ Add the following lines to your project's main CSS file:
|
|
|
82
82
|
@import '@adyen/bento-design-tokens/dist/css/bento/variables-dark.css';
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
###
|
|
85
|
+
### Install Tailwind Bento theme
|
|
86
86
|
|
|
87
87
|
To integrate Bento styles and design tokens using the `@adyen/bento-tailwind` package.
|
|
88
88
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import { ref } from 'vue'; import { isVue2 } from 'vue-demi'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import type { Meta, StoryObj } from '@storybook/vue'; import { BentoDropdown } from '@/components/dropdown'; import { BentoDataGrid } from '@/components/data-grid'; import { BentoSegmentedControl } from '@/components/segmented-control'; import { LumeLineChart } from '@adyen/lume'; import BentoDashboardSection from './dashboard-section.vue'; import { type BentoDashboardTemplateHeader } from '../../dashboard-template.types'; import { type BentoListboxOptions } from '@/types/listbox'; const meta: Meta = { title: 'Dashboard template/Dashboard section', component: BentoDashboardSection, }; export default meta; type Story = StoryObj<typeof BentoDashboardSection>; const HEADER_PROPS: BentoDashboardTemplateHeader = { title: 'Section', infoIconTooltipText: 'Info', }; const SEGMENTED_CONTROL_ITEMS = [ { label: 'Count', value: 'count' }, { label: 'Amount', value: 'amount' }, ]; const DROPDOWN_OPTIONS: BentoListboxOptions = [ { label: 'Monthly', value: 'monthly' }, { label: 'Yearly', value: 'yearly' }, ]; const LUME_DATA = { data: [ { label: 'Skyblue', color: 'skyblue', values: [10, 30, 20, 50, 40], }, { label: 'Green', color: 'green', values: [50, 60, 90, 30, 10], }, ], labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'], options: { yAxisOptions: { gridLines: true, title: 'Y-label', }, }, }; const GRID_DATA = [ { id: 1, paymentMethods: 'Visa', amount: '1,234 USD', numeric: '54,213' }, { id: 2, paymentMethods: 'MasterCard', amount: '1,234 USD', numeric: '54,213' }, { id: 3, paymentMethods: 'iDeal', amount: '1,234 USD', numeric: '54,213' }, { id: 4, paymentMethods: 'Klarna', amount: '1,234 USD', numeric: '54,213' }, { id: 5, paymentMethods: 'Apple Pay', amount: '1,234 USD', numeric: '54,213' }, ]; const GRID_COLUMNS = [ { field: 'paymentMethods', label: 'Payment methods', minWidth: 300, mandatory: true }, { field: 'amount', label: 'Amount', numeric: true, minWidth: 300 }, { field: 'numeric', label: 'Numeric', numeric: true, minWidth: 300 }, ];
|
|
1
|
+
import { ref } from 'vue'; import { isVue2 } from 'vue-demi'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import type { Meta, StoryObj } from '@storybook/vue'; import { BentoDropdown } from '@/components/dropdown'; import { BentoDataGrid } from '@/components/data-grid'; import { BentoSegmentedControl } from '@/components/segmented-control'; import { LumeLineChart } from '@adyen/lume'; import BentoDashboardSection from './dashboard-section.vue'; import { type BentoDashboardTemplateHeader } from '../../dashboard-template.types'; import { type BentoListboxOptions } from '@/types/listbox'; const dashboardSectionDataGrid = "<template>\n <bento-dashboard-template :header=\"dashboardHeader\">\n <bento-dashboard-section :header=\"sectionHeader\">\n <bento-data-grid :columns=\"gridColumns\" :data=\"gridData\" />\n </bento-dashboard-section>\n </bento-dashboard-template>\n</template>\n\n<script setup lang=\"ts\">\n import {\n type BentoColumn,\n BentoDashboardSection,\n BentoDashboardTemplate,\n type BentoDashboardTemplateHeader,\n BentoDataGrid,\n type BentoDatagridData,\n } from '@adyen/bento-vue2';\n\n const dashboardHeader: BentoDashboardTemplateHeader = { title: 'Dashboard' };\n const sectionHeader: BentoDashboardTemplateHeader = { title: 'Section' };\n const gridData: BentoDatagridData = [\n { id: 1, paymentMethods: 'Visa', amount: '1,234 USD', numeric: '54,213' },\n { id: 2, paymentMethods: 'MasterCard', amount: '2,345 USD', numeric: '63,124' },\n ];\n const gridColumns: Array<BentoColumn> = [\n { field: 'paymentMethods', label: 'Payment methods', mandatory: true },\n { field: 'amount', label: 'Amount', numeric: true },\n { field: 'numeric', label: 'Numeric', numeric: true },\n ];\n</script>\n"; const dashboardSectionGraph = "<template>\n <bento-dashboard-template :header=\"dashboardHeader\">\n <bento-dashboard-section :header=\"sectionHeader\">\n <template #controls>\n <bento-dropdown v-model=\"dropdownValue\" :items=\"dropdownOptions\" />\n <bento-segmented-control v-model=\"segmentedControlValue\" :items=\"segmentedControlItems\" />\n </template>\n <lume-line-chart v-bind=\"lumeData\" />\n </bento-dashboard-section>\n </bento-dashboard-template>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import {\n BentoDashboardSection,\n BentoDashboardTemplate,\n type BentoDashboardTemplateHeader,\n BentoDropdown,\n type BentoListboxOptions,\n type BentoListboxSelectedValue,\n BentoSegmentedControl,\n type BentoSegmentedControlItem,\n type BentoSegmentedControlValue,\n } from '@adyen/bento-vue2';\n import { LumeLineChart } from '@adyen/lume';\n\n const dashboardHeader: BentoDashboardTemplateHeader = { title: 'Dashboard' };\n const sectionHeader: BentoDashboardTemplateHeader = { title: 'Section' };\n const dropdownOptions: BentoListboxOptions = [\n { label: 'Monthly', value: 'monthly' },\n { label: 'Yearly', value: 'yearly' },\n ];\n const segmentedControlItems: Array<BentoSegmentedControlItem> = [\n { label: 'Count', value: 'count' },\n { label: 'Amount', value: 'amount' },\n ];\n const dropdownValue = ref<BentoListboxSelectedValue>('monthly');\n const segmentedControlValue = ref<BentoSegmentedControlValue>('count');\n const lumeData = {\n data: [{ label: 'Volume', values: [10, 30, 20] }],\n labels: ['Jan', 'Feb', 'Mar'],\n };\n</script>\n"; const dashboardSectionTwoColumns = "<template>\n <bento-dashboard-template :header=\"dashboardHeader\">\n <bento-dashboard-section :header=\"sectionHeader\">\n <template #controls>\n <bento-dropdown v-model=\"dropdownValue\" :items=\"dropdownOptions\" />\n <bento-segmented-control v-model=\"segmentedControlValue\" :items=\"segmentedControlItems\" />\n </template>\n <template #content-col-1><lume-line-chart v-bind=\"lumeData\" /></template>\n <template #content-col-2><lume-line-chart v-bind=\"lumeData\" /></template>\n </bento-dashboard-section>\n </bento-dashboard-template>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import {\n BentoDashboardSection,\n BentoDashboardTemplate,\n type BentoDashboardTemplateHeader,\n BentoDropdown,\n type BentoListboxOptions,\n type BentoListboxSelectedValue,\n BentoSegmentedControl,\n type BentoSegmentedControlItem,\n type BentoSegmentedControlValue,\n } from '@adyen/bento-vue2';\n import { LumeLineChart } from '@adyen/lume';\n\n const dashboardHeader: BentoDashboardTemplateHeader = { title: 'Dashboard' };\n const sectionHeader: BentoDashboardTemplateHeader = { title: 'Section' };\n const dropdownOptions: BentoListboxOptions = [\n { label: 'Monthly', value: 'monthly' },\n { label: 'Yearly', value: 'yearly' },\n ];\n const segmentedControlItems: Array<BentoSegmentedControlItem> = [\n { label: 'Count', value: 'count' },\n { label: 'Amount', value: 'amount' },\n ];\n const dropdownValue = ref<BentoListboxSelectedValue>('monthly');\n const segmentedControlValue = ref<BentoSegmentedControlValue>('count');\n const lumeData = {\n data: [{ label: 'Volume', values: [10, 30, 20] }],\n labels: ['Jan', 'Feb', 'Mar'],\n };\n</script>\n"; const meta: Meta = { title: 'Dashboard template/Dashboard section', component: BentoDashboardSection, }; export default meta; type Story = StoryObj<typeof BentoDashboardSection>; const HEADER_PROPS: BentoDashboardTemplateHeader = { title: 'Section', infoIconTooltipText: 'Info', }; const SEGMENTED_CONTROL_ITEMS = [ { label: 'Count', value: 'count' }, { label: 'Amount', value: 'amount' }, ]; const DROPDOWN_OPTIONS: BentoListboxOptions = [ { label: 'Monthly', value: 'monthly' }, { label: 'Yearly', value: 'yearly' }, ]; const LUME_DATA = { data: [ { label: 'Skyblue', color: 'skyblue', values: [10, 30, 20, 50, 40], }, { label: 'Green', color: 'green', values: [50, 60, 90, 30, 10], }, ], labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'], options: { yAxisOptions: { gridLines: true, title: 'Y-label', }, }, }; const GRID_DATA = [ { id: 1, paymentMethods: 'Visa', amount: '1,234 USD', numeric: '54,213' }, { id: 2, paymentMethods: 'MasterCard', amount: '1,234 USD', numeric: '54,213' }, { id: 3, paymentMethods: 'iDeal', amount: '1,234 USD', numeric: '54,213' }, { id: 4, paymentMethods: 'Klarna', amount: '1,234 USD', numeric: '54,213' }, { id: 5, paymentMethods: 'Apple Pay', amount: '1,234 USD', numeric: '54,213' }, ]; const GRID_COLUMNS = [ { field: 'paymentMethods', label: 'Payment methods', minWidth: 300, mandatory: true }, { field: 'amount', label: 'Amount', numeric: true, minWidth: 300 }, { field: 'numeric', label: 'Numeric', numeric: true, minWidth: 300 }, ]; export const Graph: Story = { render: (_args, { argTypes }) => ({ components: { BentoDashboardSection, BentoDropdown, BentoSegmentedControl, LumeLineChart }, props: Object.keys(argTypes), template: ` <bento-dashboard-section v-bind="args"> <template #controls> <bento-dropdown :model-value="dropdownValue" @update:model-value="dropdownValue = $event" :items='DROPDOWN_OPTIONS' /> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue" @update:model-value="segmentedControlValue = $event"/> </template> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> `, setup(props) { const segmentedControlValue = ref(SEGMENTED_CONTROL_ITEMS[0].value); const dropdownValue = ref(DROPDOWN_OPTIONS[0].value); return { // Values args: isVue2 ? props : _args, segmentedControlValue, dropdownValue, // Contants LUME_DATA, SEGMENTED_CONTROL_ITEMS, DROPDOWN_OPTIONS, }; }, }), args: { header: HEADER_PROPS, }, parameters: storybookDocsParameter(dashboardSectionGraph), }; export const DataGrid: Story = { render: (_args, { argTypes }) => ({ components: { BentoDashboardSection, BentoDataGrid }, props: Object.keys(argTypes), template: ` <bento-dashboard-section v-bind="args"> <bento-data-grid :data="GRID_DATA" :columns="GRID_COLUMNS" /> </bento-dashboard-section> `, setup(props) { return { // Values args: isVue2 ? props : _args, // Contants GRID_COLUMNS, GRID_DATA, }; }, }), args: { header: HEADER_PROPS, }, parameters: storybookDocsParameter(dashboardSectionDataGrid), }; export const TwoColumns: Story = { render: (_args, { argTypes }) => ({ components: { BentoDashboardSection, BentoDropdown, BentoSegmentedControl, LumeLineChart }, props: Object.keys(argTypes), template: ` <bento-dashboard-section v-bind="args"> <template #controls> <bento-dropdown :model-value="dropdownValue" @update:model-value="dropdownValue = $event" :items='DROPDOWN_OPTIONS' /> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue" @update:model-value="segmentedControlValue = $event"/> </template> <template #content-col-1><lume-line-chart v-bind="LUME_DATA" /></template> <template #content-col-2><lume-line-chart v-bind="LUME_DATA" /></template> </bento-dashboard-section> `, setup(props) { const segmentedControlValue = ref(SEGMENTED_CONTROL_ITEMS[0].value); const dropdownValue = ref(DROPDOWN_OPTIONS[0].value); return { // Values args: isVue2 ? props : _args, segmentedControlValue, dropdownValue, // Contants LUME_DATA, SEGMENTED_CONTROL_ITEMS, DROPDOWN_OPTIONS, }; }, }), args: { header: HEADER_PROPS, }, parameters: storybookDocsParameter(dashboardSectionTwoColumns), };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import { isVue2 } from 'vue-demi'; import { ref } from 'vue'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import type { Meta, StoryObj } from '@storybook/vue'; import { BentoSummaryGrid, BentoSummaryGridItemAmount } from '@/components/summary-grid'; import { BentoDataGrid } from '@/components/data-grid'; import { type BentoDateRangeFilterOptions, BentoFilterBar, type BentoFilterBarModel, BentoFilterItemType, type BentoFilterValues, } from '@/components/filter-bar'; import { BentoDropdown } from '@/components/dropdown'; import { BentoSegmentedControl } from '@/components/segmented-control'; import { LumeLineChart } from '@adyen/lume'; import BentoDashboardTemplate from './dashboard-template.vue'; import BentoDashboardSection from './components/dashboard-section/dashboard-section.vue'; import InfoIcon from '@adyen/ui-assets-icons-16/vue/info'; import Settings from '@adyen/ui-assets-icons-16/vue/settings'; import Download from '@adyen/ui-assets-icons-16/vue/download'; import Share from '@adyen/ui-assets-icons-16/vue/share-2'; import { subDays } from 'date-fns'; import { type BentoDashboardTemplateHeader, type BentoDashboardTemplateTabs } from './dashboard-template.types'; import { type BentoListboxOptions } from '@/types/listbox'; const meta: Meta = { title: 'Dashboard template', component: BentoDashboardTemplate, parameters: { layout: 'fullscreen', }, }; export default meta; type Story = StoryObj<typeof BentoDashboardTemplate>; const HEADER_PROPS: BentoDashboardTemplateHeader = { title: 'Dashboard', lastUpdated: Date.now(), actions: [ { title: 'Glossary', variant: 'secondary', event: () => undefined, icon: InfoIcon }, { title: 'Settings', variant: 'secondary', event: () => undefined, icon: Settings }, { title: 'Download', variant: 'secondary', event: () => undefined, icon: Download }, { title: 'Share', variant: 'secondary', event: () => undefined, icon: Share }, ], infoIconTooltipText: 'Info', }; const TABS_ARGS: BentoDashboardTemplateTabs = { tabs: [{ title: 'Tab 1' }, { title: 'Tab 2' }], }; const HEADER_SECTION_PROPS: BentoDashboardTemplateHeader = { title: 'Section', infoIconTooltipText: 'Extra info about this section', }; const FILTERS_CONFIG: BentoFilterBarModel = [ { field: 'date-range', label: 'Date range', options: { allowTimeInput: true, numberOfMonths: 1, } as BentoDateRangeFilterOptions, type: BentoFilterItemType.DATE_RANGE, visible: true, }, { field: 'company', label: 'Company', options: { listboxItems: [ { label: 'Adyen', value: 'adyen' }, { label: 'Bento', value: 'bento' }, ], multiple: true, }, type: BentoFilterItemType.SELECT, visible: true, }, ]; const FILTER_VALUES: BentoFilterValues = [ { field: 'date-range', value: { startDate: subDays(new Date(), 7), endDate: new Date() }, }, { field: 'company', value: [], }, ]; const SEGMENTED_CONTROL_ITEMS = [ { label: 'Count', value: 'count' }, { label: 'Amount', value: 'amount' }, ]; const DROPDOWN_OPTIONS: BentoListboxOptions = [ { label: 'Monthly', value: 'monthly' }, { label: 'Yearly', value: 'yearly' }, ]; const LUME_DATA = { data: [ { label: 'Skyblue', color: 'skyblue', values: [10, 30, 20, 50, 40], }, { label: 'Green', color: 'green', values: [50, 60, 90, 30, 10], }, ], labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'], options: { yAxisOptions: { gridLines: true, title: 'Y-label', }, }, }; const GRID_DATA = [ { id: 1, paymentMethods: 'Visa', amount: '1,234 USD', numeric: '54,213' }, { id: 2, paymentMethods: 'MasterCard', amount: '1,234 USD', numeric: '54,213' }, { id: 3, paymentMethods: 'iDeal', amount: '1,234 USD', numeric: '54,213' }, { id: 4, paymentMethods: 'Klarna', amount: '1,234 USD', numeric: '54,213' }, { id: 5, paymentMethods: 'Apple Pay', amount: '1,234 USD', numeric: '54,213' }, ]; const GRID_COLUMNS = [ { field: 'paymentMethods', label: 'Payment methods', minWidth: 300, mandatory: true }, { field: 'amount', label: 'Amount', numeric: true, minWidth: 300 }, { field: 'numeric', label: 'Numeric', numeric: true, minWidth: 300 }, ]; const DEFAULT_PROPS = { header: HEADER_PROPS, tabs: TABS_ARGS, stickyFilters: true, stickyTabs: true, }; const defaultCode = ` <template> <bento-dashboard-template :header="header" sticky-filters> <template #filters> <bento-filter-bar :config="filterConfig" :filter-values="filterValues" @update:filter-values="filterValues = $event" /> </template> <bento-summary-grid> <template #cell-1-1> <bento-summary-grid-item-amount title="Title" label="€ 220.00" /> </template> <template #cell-1-2> <bento-summary-grid-item-amount title="Title" label="€ 220.00" /> </template> <template #cell-1-3> <bento-summary-grid-item-amount title="Title" label="€ 220.00" /> </template> </bento-summary-grid> <bento-dashboard-section :header="dashboardSectionHeader" half-width> <template #controls> <bento-dropdown :model-value="dropdownValue1" @update:model-value="dropdownValue1 = $event" :items='dropdownOptions' /> <bento-segmented-control :items="segmentedControlItems" :model-value="segmentedControlValue1" @update:model-value="segmentedControlValue1 = $event"/> </template> <lume-line-chart v-bind="lumeData" /> <lume-line-chart v-bind="lumeData" /> </bento-dashboard-section> <bento-dashboard-section :header="dashboardSectionHeader" half-width> <template #controls> <bento-dropdown :model-value="dropdownValue2" @update:model-value="dropdownValue2 = $event" :items='dropdownOptions' /> <bento-segmented-control :items="segmentedControlItems" :model-value="segmentedControlValue2" @update:model-value="segmentedControlValue2 = $event"/> </template> <lume-line-chart v-bind="lumeData" /> <lume-line-chart v-bind="lumeData" /> </bento-dashboard-section> <bento-dashboard-section :header="dashboardSectionHeader"> <lume-line-chart v-bind="lumeData" /> </bento-dashboard-section> <bento-dashboard-section :header="dashboardSectionHeader"> <bento-data-grid :data="gridData" :columns="gridColumns" /> </bento-dashboard-section> </bento-dashboard-template> </template> <script setup lang="ts"> import { BentoDashboardTemplate, BentoDashboardSection, BentoFilterBar, BentoFilterValues, BentoSummaryGrid, BentoSummaryGridItemAmount, BentoDropdown, BentoSegmentedControl, BentoDataGrid } from '@adyen/bento-vue2' import { LumeLineChart } from '@adyen/lume'; import InfoIcon from '@adyen/ui-assets-icons-16/vue/info'; import Settings from '@adyen/ui-assets-icons-16/vue/settings'; import Download from '@adyen/ui-assets-icons-16/vue/download'; const header = { title: 'Dashboard', lastUpdated: Date.now(), actions: [ { title: 'Glossary', variant: 'secondary', event: () => {}, icon: InfoIcon }, { title: 'Settings', variant: 'secondary', event: () => {}, icon: Settings }, { title: 'Download', variant: 'secondary', event: () => {}, icon: Download }, { title: 'Share', variant: 'secondary', event: () => {}, icon: Share }, ], infoIconTooltipText: 'Info', }; const filterConfig = ${JSON.stringify(FILTERS_CONFIG, null, 4)}; const dashboardSectionHeader = ${JSON.stringify(HEADER_SECTION_PROPS, null, 4)}; const dropdownOptions = ${JSON.stringify(DROPDOWN_OPTIONS, null, 4)}; const segmentedControlItems = ${JSON.stringify(SEGMENTED_CONTROL_ITEMS, null, 4)}; const lumeData = ${JSON.stringify(LUME_DATA, null, 4)}; const filterValues = ref<BentoFilterValues>([ { field: 'date-range', value: { startDate: subDays(new Date(), 7), endDate: new Date() }, }, { field: 'company', value: [], }, ]); const gridData = ${JSON.stringify(GRID_DATA, null, 4)}; const gridColumns = ${JSON.stringify(GRID_COLUMNS, null, 4)}; const segmentedControlValue1 = ref('count'); const dropdownValue1 = ref('monthly'); const segmentedControlValue2 = ref('count'); const dropdownValue2 = ref('monthly'); </script> `; export const Default: Story = { render: (_args, { argTypes }) => ({ components: { BentoDashboardTemplate, BentoDashboardSection, BentoFilterBar, BentoSummaryGrid, BentoSummaryGridItemAmount, BentoDropdown, BentoSegmentedControl, BentoDataGrid, LumeLineChart, }, props: Object.keys(argTypes), template: ` <bento-dashboard-template v-bind="args"> <template #filters> <bento-filter-bar :config="FILTERS_CONFIG" :filter-values="filterValues" @update:filter-values="filterValues = $event" /> </template> <bento-summary-grid> <template #cell-1-1> <bento-summary-grid-item-amount title="Title" label="€ 220.00" /> </template> <template #cell-1-2> <bento-summary-grid-item-amount title="Title" label="€ 220.00" /> </template> <template #cell-1-3> <bento-summary-grid-item-amount title="Title" label="€ 220.00" /> </template> </bento-summary-grid> <bento-dashboard-section :header="HEADER_SECTION_PROPS" half-width> <template #controls> <bento-dropdown :model-value="dropdownValue1" @update:model-value="dropdownValue1 = $event" :items='DROPDOWN_OPTIONS' /> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue1" @update:model-value="segmentedControlValue1 = $event"/> </template> <lume-line-chart v-bind="LUME_DATA" /> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> <bento-dashboard-section :header="HEADER_SECTION_PROPS" half-width> <template #controls> <bento-dropdown :model-value="dropdownValue2" @update:model-value="dropdownValue2 = $event" :items='DROPDOWN_OPTIONS' /> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue2" @update:model-value="segmentedControlValue2 = $event"/> </template> <lume-line-chart v-bind="LUME_DATA" /> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> <bento-dashboard-section :header="HEADER_SECTION_PROPS"> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> <bento-dashboard-section :header="HEADER_SECTION_PROPS"> <bento-data-grid :data="GRID_DATA" :columns="GRID_COLUMNS" /> </bento-dashboard-section> </bento-dashboard-template> `, setup(props) { const args = isVue2 ? props : _args; const filterValues = ref<BentoFilterValues>(FILTER_VALUES); const segmentedControlValue1 = ref(SEGMENTED_CONTROL_ITEMS[0].value); const dropdownValue1 = ref(DROPDOWN_OPTIONS[0].value); const segmentedControlValue2 = ref(SEGMENTED_CONTROL_ITEMS[0].value); const dropdownValue2 = ref(DROPDOWN_OPTIONS[0].value); return { args, // Values filterValues, segmentedControlValue1, dropdownValue1, segmentedControlValue2, dropdownValue2, // Constants HEADER_SECTION_PROPS, FILTERS_CONFIG, DROPDOWN_OPTIONS, SEGMENTED_CONTROL_ITEMS, LUME_DATA, GRID_DATA, GRID_COLUMNS, }; }, }), args: DEFAULT_PROPS, parameters: storybookDocsParameter(defaultCode), }; const withTabsCode = ` <template> <bento-dashboard-template :header="header" :tabs="tabs" sticky-filters sticky-tabs> <template #filters> <bento-filter-bar :config="filterConfig" :filter-values="filterValues" @update:filter-values="filterValues = $event" /> </template> <template #tab-1> <bento-dashboard-section :header="dashboardSectionHeader"> <template #controls> <bento-dropdown :model-value="dropdownValue1" @update:model-value="dropdownValue1 = $event" :items='dropdownOptions' /> <bento-segmented-control :items="segmentedControlItems" :model-value="segmentedControlValue1" @update:model-value="segmentedControlValue1 = $event"/> </template> <template #content-col-1> <lume-line-chart v-bind="lumeData" /> <lume-line-chart v-bind="lumeData" /> </template> <template #content-col-2> <lume-line-chart v-bind="lumeData" /> <lume-line-chart v-bind="lumeData" /> </template> </bento-dashboard-section> </template> <template #tab-2> <bento-dashboard-section :header="dashboardSectionHeader"> <template #controls> <bento-dropdown :model-value="dropdownValue2" @update:model-value="dropdownValue2 = $event" :items='dropdownOptions' /> <bento-segmented-control :items="segmentedControlItems" :model-value="segmentedControlValue2" @update:model-value="segmentedControlValue2 = $event"/> </template> <template #content-col-1><lume-line-chart v-bind="lumeData" /></template> <template #content-col-2><lume-line-chart v-bind="lumeData" /></template> </bento-dashboard-section> </template> </bento-dashboard-template> </template> <script setup lang="ts"> import { BentoDashboardTemplate, BentoDashboardSection, BentoFilterBar, BentoFilterValues, BentoDropdown, BentoSegmentedControl } from '@adyen/bento-vue2' import { LumeLineChart } from '@adyen/lume'; import InfoIcon from '@adyen/ui-assets-icons-16/vue/info'; import Settings from '@adyen/ui-assets-icons-16/vue/settings'; import Download from '@adyen/ui-assets-icons-16/vue/download'; const header = { title: 'Dashboard', lastUpdated: Date.now(), actions: [ { title: 'Glossary', variant: 'secondary', event: () => {}, icon: InfoIcon }, { title: 'Settings', variant: 'secondary', event: () => {}, icon: Settings }, { title: 'Download', variant: 'secondary', event: () => {}, icon: Download }, { title: 'Share', variant: 'secondary', event: () => {}, icon: Share }, ], infoIconTooltipText: 'Info', }; const tabs = ${JSON.stringify(TABS_ARGS, null, 4)}; const filterConfig = ${JSON.stringify(FILTERS_CONFIG, null, 4)}; const dashboardSectionHeader = ${JSON.stringify(HEADER_SECTION_PROPS, null, 4)}; const dropdownOptions = ${JSON.stringify(DROPDOWN_OPTIONS, null, 4)}; const segmentedControlItems = ${JSON.stringify(SEGMENTED_CONTROL_ITEMS, null, 4)}; const lumeData = ${JSON.stringify(LUME_DATA, null, 4)}; const filterValues = ref<BentoFilterValues>([ { field: 'date-range', value: { startDate: subDays(new Date(), 7), endDate: new Date() }, }, { field: 'company', value: [], }, ]); const segmentedControlValue1 = ref('count'); const dropdownValue1 = ref('monthly'); const segmentedControlValue2 = ref('count'); const dropdownValue2 = ref('monthly'); </script> `; export const WithTabs: Story = { render: (_args, { argTypes }) => ({ components: { BentoDashboardTemplate, BentoDashboardSection, BentoFilterBar, BentoDropdown, BentoSegmentedControl, LumeLineChart, }, props: Object.keys(argTypes), template: ` <bento-dashboard-template v-bind="args"> <template #filters> <bento-filter-bar :config="FILTERS_CONFIG" :filter-values="filterValues" @update:filter-values="filterValues = $event" /> </template> <template #tab-1> <bento-dashboard-section :header="HEADER_SECTION_PROPS"> <template #controls> <bento-dropdown :model-value="dropdownValue" @update:model-value="dropdownValue = $event" :items='DROPDOWN_OPTIONS' /> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue" @update:model-value="segmentedControlValue = $event"/> </template> <template #content-col-1> <lume-line-chart v-bind="LUME_DATA" /> <lume-line-chart v-bind="LUME_DATA" /> </template> <template #content-col-2> <lume-line-chart v-bind="LUME_DATA" /> <lume-line-chart v-bind="LUME_DATA" /> </template> </bento-dashboard-section> </template> <template #tab-2> <bento-dashboard-section :header="HEADER_SECTION_PROPS"> <template #controls> <bento-dropdown :model-value="dropdownValue" @update:model-value="dropdownValue = $event" :items='DROPDOWN_OPTIONS' /> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue" @update:model-value="segmentedControlValue = $event"/> </template> <template #content-col-1><lume-line-chart v-bind="LUME_DATA" /></template> <template #content-col-2><lume-line-chart v-bind="LUME_DATA" /></template> </bento-dashboard-section> </template> </bento-dashboard-template> `, setup(props) { const args = isVue2 ? props : _args; const filterValues = ref<BentoFilterValues>(FILTER_VALUES); const segmentedControlValue = ref(SEGMENTED_CONTROL_ITEMS[0].value); const dropdownValue = ref(DROPDOWN_OPTIONS[0].value); return { args, // Values filterValues, segmentedControlValue, dropdownValue, // Constants HEADER_SECTION_PROPS, FILTERS_CONFIG, SEGMENTED_CONTROL_ITEMS, DROPDOWN_OPTIONS, LUME_DATA, }; }, }), args: DEFAULT_PROPS, parameters: storybookDocsParameter(withTabsCode), }; const halfWidthCode = ` <template> <bento-dashboard-template :header="header"> <bento-dashboard-section :header="{ title: 'Section 1'}" half-width> <template #controls> <bento-segmented-control :items="segmentedControlItems" :model-value="segmentedControlValue" @update:model-value="segmentedControlValue = $event"/> </template> <lume-line-chart v-bind="lumeData" /> </bento-dashboard-section> <bento-dashboard-section :header="{ title: 'Section 2'}" half-width> <template #controls> <bento-dropdown :model-value="dropdownValue" @update:model-value="dropdownValue = $event" :items='dropdownOptions' /> </template> <lume-line-chart v-bind="lumeData" /> </bento-dashboard-section> </bento-dashboard-template> </template> <script setup lang="ts"> import { BentoDashboardTemplate, BentoDashboardSection, BentoDropdown, BentoSegmentedControl, } from '@adyen/bento-vue2' import { LumeLineChart } from '@adyen/lume'; import InfoIcon from '@adyen/ui-assets-icons-16/vue/info'; import Settings from '@adyen/ui-assets-icons-16/vue/settings'; import Download from '@adyen/ui-assets-icons-16/vue/download'; const header = { title: 'Dashboard', lastUpdated: Date.now(), actions: [ { title: 'Glossary', variant: 'secondary', event: () => {}, icon: InfoIcon }, { title: 'Settings', variant: 'secondary', event: () => {}, icon: Settings }, { title: 'Download', variant: 'secondary', event: () => {}, icon: Download }, { title: 'Share', variant: 'secondary', event: () => {}, icon: Share }, ], infoIconTooltipText: 'Info', }; const dropdownOptions = ${JSON.stringify(DROPDOWN_OPTIONS, null, 4)}; const segmentedControlItems = ${JSON.stringify(SEGMENTED_CONTROL_ITEMS, null, 4)}; const lumeData = ${JSON.stringify(LUME_DATA, null, 4)}; const segmentedControlValue = ref('count'); const dropdownValue = ref('monthly'); </script> `; export const HalfWidth: Story = { render: (_args, { argTypes }) => ({ components: { BentoDashboardTemplate, BentoDashboardSection, BentoDropdown, BentoSegmentedControl, LumeLineChart, }, props: Object.keys(argTypes), template: ` <bento-dashboard-template v-bind="args"> <bento-dashboard-section :header="{ title: 'Section 1' }" half-width> <template #controls> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue" @update:model-value="segmentedControlValue = $event"/> </template> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> <bento-dashboard-section :header="{ title: 'Section 2' }" half-width> <template #controls> <bento-dropdown :model-value="dropdownValue" @update:model-value="dropdownValue = $event" :items='DROPDOWN_OPTIONS' /> </template> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> </bento-dashboard-template> `, setup(props) { const segmentedControlValue = ref(SEGMENTED_CONTROL_ITEMS[0].value); const dropdownValue = ref(DROPDOWN_OPTIONS[0].value); return { // Values args: isVue2 ? props : _args, segmentedControlValue, dropdownValue, // Contants LUME_DATA, SEGMENTED_CONTROL_ITEMS, DROPDOWN_OPTIONS, }; }, }), args: DEFAULT_PROPS, parameters: storybookDocsParameter(halfWidthCode), };
|
|
1
|
+
import { isVue2 } from 'vue-demi'; import { ref } from 'vue'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import { subDays } from 'date-fns/subDays'; import { BentoSummaryGrid, BentoSummaryGridItemAmount } from '@/components/summary-grid'; import { BentoDataGrid } from '@/components/data-grid'; import { type BentoDateRangeFilterOptions, BentoFilterBar, type BentoFilterBarModel, BentoFilterItemType, type BentoFilterValues, } from '@/components/filter-bar'; import { BentoDropdown } from '@/components/dropdown'; import { BentoSegmentedControl } from '@/components/segmented-control'; import { LumeLineChart } from '@adyen/lume'; import BentoDashboardTemplate from './dashboard-template.vue'; import BentoDashboardSection from './components/dashboard-section/dashboard-section.vue'; import InfoIcon from '@adyen/ui-assets-icons-16/vue/info'; import Settings from '@adyen/ui-assets-icons-16/vue/settings'; import Download from '@adyen/ui-assets-icons-16/vue/download'; import Share from '@adyen/ui-assets-icons-16/vue/share-2'; const DashboardTemplateDefault = "<template>\n <bento-dashboard-template :header=\"header\" sticky-filters>\n <template #filters>\n <bento-filter-bar\n :config=\"filterConfig\"\n :filter-values=\"filterValues\"\n @update:filter-values=\"filterValues = $event\"\n />\n </template>\n\n <bento-summary-grid>\n <template #cell-1-1>\n <bento-summary-grid-item-amount title=\"Title\" label=\"€ 220.00\" />\n </template>\n <template #cell-1-2>\n <bento-summary-grid-item-amount title=\"Title\" label=\"€ 220.00\" />\n </template>\n <template #cell-1-3>\n <bento-summary-grid-item-amount title=\"Title\" label=\"€ 220.00\" />\n </template>\n </bento-summary-grid>\n\n <bento-dashboard-section :header=\"sectionHeader\" half-width>\n <template #controls>\n <bento-dropdown v-model=\"dropdownValue1\" :items=\"dropdownOptions\" />\n <bento-segmented-control v-model=\"segmentedControlValue1\" :items=\"segmentedControlItems\" />\n </template>\n <lume-line-chart v-bind=\"lumeData\" />\n <lume-line-chart v-bind=\"lumeData\" />\n </bento-dashboard-section>\n\n <bento-dashboard-section :header=\"sectionHeader\" half-width>\n <template #controls>\n <bento-dropdown v-model=\"dropdownValue2\" :items=\"dropdownOptions\" />\n <bento-segmented-control v-model=\"segmentedControlValue2\" :items=\"segmentedControlItems\" />\n </template>\n <lume-line-chart v-bind=\"lumeData\" />\n <lume-line-chart v-bind=\"lumeData\" />\n </bento-dashboard-section>\n\n <bento-dashboard-section :header=\"sectionHeader\">\n <lume-line-chart v-bind=\"lumeData\" />\n </bento-dashboard-section>\n\n <bento-dashboard-section :header=\"sectionHeader\">\n <bento-data-grid :data=\"gridData\" :columns=\"gridColumns\" />\n </bento-dashboard-section>\n </bento-dashboard-template>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { subDays } from 'date-fns/subDays';\n import {\n type BentoColumn,\n BentoDashboardSection,\n BentoDashboardTemplate,\n type BentoDashboardTemplateHeader,\n BentoDataGrid,\n type BentoDatagridData,\n type BentoDateRangeFilterOptions,\n BentoDropdown,\n BentoFilterBar,\n type BentoFilterBarModel,\n BentoFilterItemType,\n type BentoFilterValues,\n type BentoListboxOptions,\n type BentoListboxSelectedValue,\n BentoSegmentedControl,\n type BentoSegmentedControlItem,\n type BentoSegmentedControlValue,\n BentoSummaryGrid,\n BentoSummaryGridItemAmount,\n } from '@adyen/bento-vue2';\n import { LumeLineChart } from '@adyen/lume';\n import DownloadIcon from '@adyen/ui-assets-icons-16/vue/download';\n import InfoIcon from '@adyen/ui-assets-icons-16/vue/info';\n import SettingsIcon from '@adyen/ui-assets-icons-16/vue/settings';\n import ShareIcon from '@adyen/ui-assets-icons-16/vue/share-2';\n\n const header: BentoDashboardTemplateHeader = {\n title: 'Dashboard',\n lastUpdated: Date.now(),\n actions: [\n { title: 'Glossary', variant: 'secondary', event: () => undefined, icon: InfoIcon },\n { title: 'Settings', variant: 'secondary', event: () => undefined, icon: SettingsIcon },\n { title: 'Download', variant: 'secondary', event: () => undefined, icon: DownloadIcon },\n { title: 'Share', variant: 'secondary', event: () => undefined, icon: ShareIcon },\n ],\n infoIconTooltipText: 'Info',\n };\n const sectionHeader: BentoDashboardTemplateHeader = {\n title: 'Section',\n infoIconTooltipText: 'Extra info about this section',\n };\n const filterConfig: BentoFilterBarModel = [\n {\n field: 'date-range',\n label: 'Date range',\n options: {\n allowTimeInput: true,\n numberOfMonths: 1,\n } as BentoDateRangeFilterOptions,\n type: BentoFilterItemType.DATE_RANGE,\n visible: true,\n },\n {\n field: 'company',\n label: 'Company',\n options: {\n listboxItems: [\n { label: 'Adyen', value: 'adyen' },\n { label: 'Bento', value: 'bento' },\n ],\n multiple: true,\n },\n type: BentoFilterItemType.SELECT,\n visible: true,\n },\n ];\n const filterValues = ref<BentoFilterValues>([\n {\n field: 'date-range',\n value: { startDate: subDays(new Date(), 7), endDate: new Date() },\n },\n { field: 'company', value: [] },\n ]);\n const dropdownOptions: BentoListboxOptions = [\n { label: 'Monthly', value: 'monthly' },\n { label: 'Yearly', value: 'yearly' },\n ];\n const segmentedControlItems: Array<BentoSegmentedControlItem> = [\n { label: 'Count', value: 'count' },\n { label: 'Amount', value: 'amount' },\n ];\n const lumeData = {\n data: [\n { label: 'Skyblue', color: 'skyblue', values: [10, 30, 20, 50, 40] },\n { label: 'Green', color: 'green', values: [50, 60, 90, 30, 10] },\n ],\n labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],\n options: {\n yAxisOptions: {\n gridLines: true,\n title: 'Y-label',\n },\n },\n };\n const gridData: BentoDatagridData = [\n { id: 1, paymentMethods: 'Visa', amount: '1,234 USD', numeric: '54,213' },\n { id: 2, paymentMethods: 'MasterCard', amount: '1,234 USD', numeric: '54,213' },\n { id: 3, paymentMethods: 'iDeal', amount: '1,234 USD', numeric: '54,213' },\n { id: 4, paymentMethods: 'Klarna', amount: '1,234 USD', numeric: '54,213' },\n { id: 5, paymentMethods: 'Apple Pay', amount: '1,234 USD', numeric: '54,213' },\n ];\n const gridColumns: Array<BentoColumn> = [\n { field: 'paymentMethods', label: 'Payment methods', minWidth: 300, mandatory: true },\n { field: 'amount', label: 'Amount', numeric: true, minWidth: 300 },\n { field: 'numeric', label: 'Numeric', numeric: true, minWidth: 300 },\n ];\n const segmentedControlValue1 = ref<BentoSegmentedControlValue>('count');\n const dropdownValue1 = ref<BentoListboxSelectedValue>('monthly');\n const segmentedControlValue2 = ref<BentoSegmentedControlValue>('count');\n const dropdownValue2 = ref<BentoListboxSelectedValue>('monthly');\n</script>\n"; const DashboardTemplateHalfWidth = "<template>\n <bento-dashboard-template :header=\"header\">\n <bento-dashboard-section half-width :header=\"sectionOneHeader\">\n <template #controls>\n <bento-segmented-control v-model=\"segmentedControlValue\" :items=\"segmentedControlItems\" />\n </template>\n <lume-line-chart v-bind=\"lumeData\" />\n </bento-dashboard-section>\n\n <bento-dashboard-section :header=\"sectionTwoHeader\" half-width>\n <template #controls>\n <bento-dropdown v-model=\"dropdownValue\" :items=\"dropdownOptions\" />\n </template>\n <lume-line-chart v-bind=\"lumeData\" />\n </bento-dashboard-section>\n </bento-dashboard-template>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import {\n BentoDashboardSection,\n BentoDashboardTemplate,\n type BentoDashboardTemplateHeader,\n BentoDropdown,\n type BentoListboxOptions,\n type BentoListboxSelectedValue,\n BentoSegmentedControl,\n type BentoSegmentedControlItem,\n type BentoSegmentedControlValue,\n } from '@adyen/bento-vue2';\n import { LumeLineChart } from '@adyen/lume';\n\n const header: BentoDashboardTemplateHeader = { title: 'Dashboard' };\n const sectionOneHeader: BentoDashboardTemplateHeader = { title: 'Section 1' };\n const sectionTwoHeader: BentoDashboardTemplateHeader = { title: 'Section 2' };\n const dropdownOptions: BentoListboxOptions = [\n { label: 'Monthly', value: 'monthly' },\n { label: 'Yearly', value: 'yearly' },\n ];\n const segmentedControlItems: Array<BentoSegmentedControlItem> = [\n { label: 'Count', value: 'count' },\n { label: 'Amount', value: 'amount' },\n ];\n const dropdownValue = ref<BentoListboxSelectedValue>('monthly');\n const segmentedControlValue = ref<BentoSegmentedControlValue>('count');\n const lumeData = {\n data: [{ label: 'Volume', values: [10, 30, 20] }],\n labels: ['Jan', 'Feb', 'Mar'],\n };\n</script>\n"; const DashboardTemplateWithTabs = "<template>\n <bento-dashboard-template :header=\"header\" sticky-filters sticky-tabs :tabs=\"tabs\">\n <template #filters>\n <bento-filter-bar\n :config=\"filterConfig\"\n :filter-values=\"filterValues\"\n @update:filter-values=\"filterValues = $event\"\n />\n </template>\n\n <template #tab-1>\n <bento-dashboard-section :header=\"sectionHeader\">\n <template #controls>\n <bento-dropdown v-model=\"dropdownValue\" :items=\"dropdownOptions\" />\n <bento-segmented-control v-model=\"segmentedControlValue\" :items=\"segmentedControlItems\" />\n </template>\n <template #content-col-1><lume-line-chart v-bind=\"lumeData\" /></template>\n <template #content-col-2><lume-line-chart v-bind=\"lumeData\" /></template>\n </bento-dashboard-section>\n </template>\n\n <template #tab-2>\n <bento-dashboard-section :header=\"sectionHeader\">\n <lume-line-chart v-bind=\"lumeData\" />\n </bento-dashboard-section>\n </template>\n </bento-dashboard-template>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import {\n BentoDashboardSection,\n BentoDashboardTemplate,\n type BentoDashboardTemplateHeader,\n type BentoDashboardTemplateTabs,\n BentoDropdown,\n BentoFilterBar,\n type BentoFilterBarModel,\n BentoFilterItemType,\n type BentoFilterValues,\n type BentoListboxOptions,\n type BentoListboxSelectedValue,\n BentoSegmentedControl,\n type BentoSegmentedControlItem,\n type BentoSegmentedControlValue,\n } from '@adyen/bento-vue2';\n import { LumeLineChart } from '@adyen/lume';\n\n const header: BentoDashboardTemplateHeader = { title: 'Dashboard' };\n const sectionHeader: BentoDashboardTemplateHeader = { title: 'Section' };\n const tabs: BentoDashboardTemplateTabs = { tabs: [{ title: 'Tab 1' }, { title: 'Tab 2' }] };\n const filterConfig: BentoFilterBarModel = [\n {\n field: 'company',\n label: 'Company',\n options: { listboxItems: [{ label: 'Adyen', value: 'adyen' }], multiple: true },\n type: BentoFilterItemType.SELECT,\n visible: true,\n },\n ];\n const filterValues = ref<BentoFilterValues>([{ field: 'company', value: [] }]);\n const dropdownOptions: BentoListboxOptions = [\n { label: 'Monthly', value: 'monthly' },\n { label: 'Yearly', value: 'yearly' },\n ];\n const segmentedControlItems: Array<BentoSegmentedControlItem> = [\n { label: 'Count', value: 'count' },\n { label: 'Amount', value: 'amount' },\n ];\n const dropdownValue = ref<BentoListboxSelectedValue>('monthly');\n const segmentedControlValue = ref<BentoSegmentedControlValue>('count');\n const lumeData = {\n data: [{ label: 'Volume', values: [10, 30, 20] }],\n labels: ['Jan', 'Feb', 'Mar'],\n };\n</script>\n"; import { type BentoDashboardTemplateHeader, type BentoDashboardTemplateTabs } from './dashboard-template.types'; import { type BentoListboxOptions } from '@/types/listbox'; import type { Meta, StoryObj } from '@storybook/vue'; const meta: Meta = { title: 'Dashboard template', component: BentoDashboardTemplate, parameters: { layout: 'fullscreen', }, }; export default meta; type Story = StoryObj<typeof BentoDashboardTemplate>; const HEADER_PROPS: BentoDashboardTemplateHeader = { title: 'Dashboard', lastUpdated: Date.now(), actions: [ { title: 'Glossary', variant: 'secondary', event: () => undefined, icon: InfoIcon }, { title: 'Settings', variant: 'secondary', event: () => undefined, icon: Settings }, { title: 'Download', variant: 'secondary', event: () => undefined, icon: Download }, { title: 'Share', variant: 'secondary', event: () => undefined, icon: Share }, ], infoIconTooltipText: 'Info', }; const TABS_ARGS: BentoDashboardTemplateTabs = { tabs: [{ title: 'Tab 1' }, { title: 'Tab 2' }], }; const HEADER_SECTION_PROPS: BentoDashboardTemplateHeader = { title: 'Section', infoIconTooltipText: 'Extra info about this section', }; const FILTERS_CONFIG: BentoFilterBarModel = [ { field: 'date-range', label: 'Date range', options: { allowTimeInput: true, numberOfMonths: 1, } as BentoDateRangeFilterOptions, type: BentoFilterItemType.DATE_RANGE, visible: true, }, { field: 'company', label: 'Company', options: { listboxItems: [ { label: 'Adyen', value: 'adyen' }, { label: 'Bento', value: 'bento' }, ], multiple: true, }, type: BentoFilterItemType.SELECT, visible: true, }, ]; const FILTER_VALUES: BentoFilterValues = [ { field: 'date-range', value: { startDate: subDays(new Date(), 7), endDate: new Date() }, }, { field: 'company', value: [], }, ]; const SEGMENTED_CONTROL_ITEMS = [ { label: 'Count', value: 'count' }, { label: 'Amount', value: 'amount' }, ]; const DROPDOWN_OPTIONS: BentoListboxOptions = [ { label: 'Monthly', value: 'monthly' }, { label: 'Yearly', value: 'yearly' }, ]; const LUME_DATA = { data: [ { label: 'Skyblue', color: 'skyblue', values: [10, 30, 20, 50, 40], }, { label: 'Green', color: 'green', values: [50, 60, 90, 30, 10], }, ], labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'], options: { yAxisOptions: { gridLines: true, title: 'Y-label', }, }, }; const GRID_DATA = [ { id: 1, paymentMethods: 'Visa', amount: '1,234 USD', numeric: '54,213' }, { id: 2, paymentMethods: 'MasterCard', amount: '1,234 USD', numeric: '54,213' }, { id: 3, paymentMethods: 'iDeal', amount: '1,234 USD', numeric: '54,213' }, { id: 4, paymentMethods: 'Klarna', amount: '1,234 USD', numeric: '54,213' }, { id: 5, paymentMethods: 'Apple Pay', amount: '1,234 USD', numeric: '54,213' }, ]; const GRID_COLUMNS = [ { field: 'paymentMethods', label: 'Payment methods', minWidth: 300, mandatory: true }, { field: 'amount', label: 'Amount', numeric: true, minWidth: 300 }, { field: 'numeric', label: 'Numeric', numeric: true, minWidth: 300 }, ]; const DEFAULT_PROPS = { header: HEADER_PROPS, tabs: TABS_ARGS, stickyFilters: true, stickyTabs: true, }; export const Default: Story = { render: (_args, { argTypes }) => ({ components: { BentoDashboardTemplate, BentoDashboardSection, BentoFilterBar, BentoSummaryGrid, BentoSummaryGridItemAmount, BentoDropdown, BentoSegmentedControl, BentoDataGrid, LumeLineChart, }, props: Object.keys(argTypes), template: ` <bento-dashboard-template v-bind="args"> <template #filters> <bento-filter-bar :config="FILTERS_CONFIG" :filter-values="filterValues" @update:filter-values="filterValues = $event" /> </template> <bento-summary-grid> <template #cell-1-1> <bento-summary-grid-item-amount title="Title" label="€ 220.00" /> </template> <template #cell-1-2> <bento-summary-grid-item-amount title="Title" label="€ 220.00" /> </template> <template #cell-1-3> <bento-summary-grid-item-amount title="Title" label="€ 220.00" /> </template> </bento-summary-grid> <bento-dashboard-section :header="HEADER_SECTION_PROPS" half-width> <template #controls> <bento-dropdown :model-value="dropdownValue1" @update:model-value="dropdownValue1 = $event" :items='DROPDOWN_OPTIONS' /> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue1" @update:model-value="segmentedControlValue1 = $event"/> </template> <lume-line-chart v-bind="LUME_DATA" /> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> <bento-dashboard-section :header="HEADER_SECTION_PROPS" half-width> <template #controls> <bento-dropdown :model-value="dropdownValue2" @update:model-value="dropdownValue2 = $event" :items='DROPDOWN_OPTIONS' /> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue2" @update:model-value="segmentedControlValue2 = $event"/> </template> <lume-line-chart v-bind="LUME_DATA" /> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> <bento-dashboard-section :header="HEADER_SECTION_PROPS"> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> <bento-dashboard-section :header="HEADER_SECTION_PROPS"> <bento-data-grid :data="GRID_DATA" :columns="GRID_COLUMNS" /> </bento-dashboard-section> </bento-dashboard-template> `, setup(props) { const args = isVue2 ? props : _args; const filterValues = ref<BentoFilterValues>(FILTER_VALUES); const segmentedControlValue1 = ref(SEGMENTED_CONTROL_ITEMS[0].value); const dropdownValue1 = ref(DROPDOWN_OPTIONS[0].value); const segmentedControlValue2 = ref(SEGMENTED_CONTROL_ITEMS[0].value); const dropdownValue2 = ref(DROPDOWN_OPTIONS[0].value); return { args, // Values filterValues, segmentedControlValue1, dropdownValue1, segmentedControlValue2, dropdownValue2, // Constants HEADER_SECTION_PROPS, FILTERS_CONFIG, DROPDOWN_OPTIONS, SEGMENTED_CONTROL_ITEMS, LUME_DATA, GRID_DATA, GRID_COLUMNS, }; }, }), args: DEFAULT_PROPS, parameters: storybookDocsParameter(DashboardTemplateDefault), }; export const WithTabs: Story = { render: (_args, { argTypes }) => ({ components: { BentoDashboardTemplate, BentoDashboardSection, BentoFilterBar, BentoDropdown, BentoSegmentedControl, LumeLineChart, }, props: Object.keys(argTypes), template: ` <bento-dashboard-template v-bind="args"> <template #filters> <bento-filter-bar :config="FILTERS_CONFIG" :filter-values="filterValues" @update:filter-values="filterValues = $event" /> </template> <template #tab-1> <bento-dashboard-section :header="HEADER_SECTION_PROPS"> <template #controls> <bento-dropdown :model-value="dropdownValue" @update:model-value="dropdownValue = $event" :items='DROPDOWN_OPTIONS' /> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue" @update:model-value="segmentedControlValue = $event"/> </template> <template #content-col-1> <lume-line-chart v-bind="LUME_DATA" /> <lume-line-chart v-bind="LUME_DATA" /> </template> <template #content-col-2> <lume-line-chart v-bind="LUME_DATA" /> <lume-line-chart v-bind="LUME_DATA" /> </template> </bento-dashboard-section> </template> <template #tab-2> <bento-dashboard-section :header="HEADER_SECTION_PROPS"> <template #controls> <bento-dropdown :model-value="dropdownValue" @update:model-value="dropdownValue = $event" :items='DROPDOWN_OPTIONS' /> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue" @update:model-value="segmentedControlValue = $event"/> </template> <template #content-col-1><lume-line-chart v-bind="LUME_DATA" /></template> <template #content-col-2><lume-line-chart v-bind="LUME_DATA" /></template> </bento-dashboard-section> </template> </bento-dashboard-template> `, setup(props) { const args = isVue2 ? props : _args; const filterValues = ref<BentoFilterValues>(FILTER_VALUES); const segmentedControlValue = ref(SEGMENTED_CONTROL_ITEMS[0].value); const dropdownValue = ref(DROPDOWN_OPTIONS[0].value); return { args, // Values filterValues, segmentedControlValue, dropdownValue, // Constants HEADER_SECTION_PROPS, FILTERS_CONFIG, SEGMENTED_CONTROL_ITEMS, DROPDOWN_OPTIONS, LUME_DATA, }; }, }), args: DEFAULT_PROPS, parameters: storybookDocsParameter(DashboardTemplateWithTabs), }; export const HalfWidth: Story = { render: (_args, { argTypes }) => ({ components: { BentoDashboardTemplate, BentoDashboardSection, BentoDropdown, BentoSegmentedControl, LumeLineChart, }, props: Object.keys(argTypes), template: ` <bento-dashboard-template v-bind="args"> <bento-dashboard-section :header="{ title: 'Section 1' }" half-width> <template #controls> <bento-segmented-control :items="SEGMENTED_CONTROL_ITEMS" :model-value="segmentedControlValue" @update:model-value="segmentedControlValue = $event"/> </template> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> <bento-dashboard-section :header="{ title: 'Section 2' }" half-width> <template #controls> <bento-dropdown :model-value="dropdownValue" @update:model-value="dropdownValue = $event" :items='DROPDOWN_OPTIONS' /> </template> <lume-line-chart v-bind="LUME_DATA" /> </bento-dashboard-section> </bento-dashboard-template> `, setup(props) { const segmentedControlValue = ref(SEGMENTED_CONTROL_ITEMS[0].value); const dropdownValue = ref(DROPDOWN_OPTIONS[0].value); return { // Values args: isVue2 ? props : _args, segmentedControlValue, dropdownValue, // Contants LUME_DATA, SEGMENTED_CONTROL_ITEMS, DROPDOWN_OPTIONS, }; }, }), args: DEFAULT_PROPS, parameters: storybookDocsParameter(DashboardTemplateHalfWidth), };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import { BentoButton } from '@/components/button'; import { BentoCountry, BentoCountryCode } from '@/components/country'; import { type BentoColumn, BentoDataGrid, type BentoDatagridData } from '@/components/data-grid'; import { type BentoFilterBarModel, BentoFilterItemType, type BentoFilterValues } from '@/components/filter-bar'; import { BentoHeaderWithViews, type BentoHeaderWithViewsItem } from '@/components/header-with-views'; import { type BentoInspectorProps } from '@/components/inspector'; import { BentoStatus } from '@/components/status'; import { BentoSummaryGrid, BentoSummaryGridItemAmount, BentoSummaryGridItemCustom } from '@/components/summary-grid'; import { BentoTypography } from '@/components/typography'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import type { Meta, StoryObj } from '@storybook/vue'; import { computed, onMounted, ref } from 'vue'; import { isVue2 } from 'vue-demi'; import DataGridTemplateWithHeaderWithViews from './__tests__/data-grid-template-with-header-with-views.vue?raw'; import './data-grid-template.stories.scss?module'; import { type BentoDataGridTemplateTabs } from './data-grid-template.types'; import BentoDataGridTemplate from './data-grid-template.vue'; const meta: Meta = { title: 'Data grid template', component: BentoDataGridTemplate, parameters: { layout: 'fullscreen', }, }; const HEADER_PROPS = { title: 'Payments', actions: [ { title: 'Primary action', event: () => undefined }, { title: 'Secondary action', event: () => undefined }, { title: 'Tetiary action', event: () => undefined }, ], infoIconTooltipText: 'Title Tooltip Text', }; const HEADER_PROPS_DOCS = { title: 'Payments', actions: [ { title: 'Primary action', event: () => undefined }, { title: 'Secondary action', event: () => undefined }, { title: 'Tetiary action', event: () => undefined }, ], infoIconTooltipText: 'Title Tooltip Text', }; const PAGINATION_DOCS = { description: 'datagrid navigation', hasNext: true, size: 10 }; const DEFAULT_COLUMNS: Array<BentoColumn> = [ { field: 'name', label: 'Name', minWidth: 300, mandatory: true }, { field: 'company', label: 'Reference', minWidth: 150 }, { field: 'payment', label: 'Payment', width: 200, minWidth: 150 }, ]; const DATA_GRID_1_DATA: BentoDatagridData = Array.from({ length: 50 }, (_, index) => ({ name: `Name ${index + 1}`, company: `Company ${index + 1}`, payment: `Payment ${index + 1}`, id: `${index + 1}`, })); const FILTERS: BentoFilterBarModel = [ { field: 'name', label: 'Name', type: BentoFilterItemType.INPUT, }, { field: 'company', label: 'Company', type: BentoFilterItemType.INPUT, }, ]; const FILTER_VALUES: BentoFilterValues = [ { field: 'company', value: 'Company 1', }, ]; const FILTERS_DOCS = `[ { field: 'name', label: 'Name', type: BentoFilterItemType.INPUT, }, { field: 'company', label: 'Company', type: BentoFilterItemType.INPUT, }, ]`; const FILTER_VALUES_DOCS = `[ { field: 'company', value: 'Company 1' }, ]`; const TABS_ARGS: BentoDataGridTemplateTabs = { tabs: [{ title: 'Data grid title 1' }, { title: 'Data grid title 2' }], }; const INSPECTOR_ARGS: BentoInspectorProps = { title: 'Title', size: 'large', isOpen: false, activePage: '', expandable: true, }; const BULK_ACTIONS = [ { title: 'Edit', event: () => undefined, }, { title: 'Delete', critical: true, event: () => undefined, }, ]; const DATA_GRID_1_ARGS = { data: DATA_GRID_1_DATA, columns: DEFAULT_COLUMNS, allowColumnDragAndDrop: false, pagination: {}, filterSearchTerm: '', highlightedRows: [DATA_GRID_1_DATA[0].id], selectable: true, selection: [DATA_GRID_1_DATA[2].id], bulkActions: BULK_ACTIONS, stickyPagination: true, }; const DATA_GRID_2_DATA: BentoDatagridData = Array.from({ length: 30 }, (_, index) => ({ name: `Name ${index + 1}`, company: `Company ${index + 1}`, payment: `Payment ${index + 1}`, })); const DATA_GRID_2_ARGS = { data: DATA_GRID_2_DATA, columns: DEFAULT_COLUMNS, allowColumnDragAndDrop: false, pagination: {}, }; export default meta; type Story = StoryObj<typeof BentoDataGridTemplate>; const defaultCode = ` <template> <bento-data-grid-template :header="header" :tabs="tabs" sticky-tabs> <template #tab-1> <bento-data-grid :columns="columns" :data="dataArray" :pagination.sync="pagination" :selection.sync="selection" :bulk-actions="bulkActions" selectable sticky-pagination @navigate="clickNavigate" /> </template> <template #tab-2> <bento-data-grid :columns="columns" :data="dataArray" :filter-search-term.sync="searchTerm" :filters="filtersConfig" :filter-values.sync="filterValues" :sort-by.sync="sortBy" /> </template> </bento-data-grid-template> </template> <script setup lang="ts"> import { BentoCountryCode, type BentoColumn, type BentoDatagridSortByColumn, type BentoDatagridDataItem, BentoDataGridTemplate, BentoDataGrid, type BentoDataGridTemplateHeader, type BentoDatagridPaginationProps, type BentoFilterBarModel, BentoFilterItemType, } from '@adyen/bento-vue2'; import messages from './messages.json'; const { t } = useI18n({ messages }); const header: BentoDataGridTemplateHeader = { title: 'Payments', actions: [ { title: 'Primary action', event: () => {} }, { title: 'Secondary action', event: () => {} }, { title: 'Tetiary action', event: () => {} }, ], infoIconTooltipText: 'Title Tooltip Text', }; const tabs: BentoDataGridTemplateTabs = { tabs: [{ title: 'Data grid title 1' }, { title: 'Data grid title 2' }], }; const columns = computed<BentoColumn[]>(() => [ { field: 'name', label: t('Name'), minWidth: 300, mandatory: true, frozen: true, autoWidth: true, sortable: true, }, { field: 'company', label: t('Reference') }, { field: 'payment', label: t('Payment'), width: 200, minWidth: 150 }, ]); const filtersConfig = computed<BentoFilterBarModel>(() => [ { field: 'company', label: t('Company'), type: BentoFilterItemType.INPUT, }, { field: 'countryCode', label: t('Country'), options: { listboxItems: [ { value: BentoCountryCode.NL, }, { value: BentoCountryCode.BE, }, ], variant: 'name', }, type: BentoFilterItemType.SELECT_COUNTRY, }, ]); // Watch this to keep track if the user filters data const filterValues = ref(); // Watch this to keep track if the user sorts data const sortBy = ref<BentoDatagridSortByColumn[]>([]); // Watch this to keep track if the user searches for data const searchTerm = ref(''); // Watch this to keep track if the user pages through the data const pagination = ref<BentoDatagridPaginationProps>({ description: 'datagrid 1 navigation', hasNext: true, size: 10 }); const selection = ref([]); const bulkActions = [ { title: 'Edit', event: () => undefined, }, { title: 'Delete', critical: true, event: () => undefined, }, ]; // This is a contrived example of the dataArray as this will normally be retried via an API const dataArray = ref<BentoDatagridDataItem[]>([ { id: '03c0a799-1ced-4017-aea3-0cebb0106335', name: 'Shepherd Kane', payment: 160405, company: 'VURBO', registered: '2023-06-30T13:56:09.498Z', tags: ['deserunt', 'et', 'esse'], reference: 'UnbQaUncf3eR1D8XUBqn_UnbQaUncf3eR1D8XUBqn_UnbQaUncf3eR1D8XUBqn', paymentStatus: 1, countryCode: BentoCountryCode.NL, }, { id: 'b6d4f1fd-b1f6-40a6-a443-f785c89604ef', name: 'Santos Palmer', payment: 163500, company: 'POLARAX', registered: '2023-04-28T13:11:09.498Z', tags: ['et', 'Lorem', 'sint'], reference: 'IxUZ9FsEPCZ9dFFPpI9C', paymentStatus: 2, countryCode: BentoCountryCode.BE, }, ]); </script> `; export const Default: Story = { render: (_args, { argTypes }) => ({ components: { BentoDataGrid, BentoDataGridTemplate, }, props: Object.keys(argTypes), template: ` <bento-data-grid-template v-bind="args"> <template #infoIconTooltipContent>Test</template> <template #tab-1><bento-data-grid v-bind="dataGrid1Props" :filters="filters" :filter-values.sync="filterValues" :selection.sync="selection" column-panel /></template> <template #tab-2><bento-data-grid v-bind="dataGrid2Props" /></template> <template #inspector-content>Hello</template> </bento-data-grid-template> `, setup(props) { const args = isVue2 ? props : _args; const filters = ref<BentoFilterBarModel>(args?.filters ?? FILTERS); const filterValues = ref<BentoFilterValues>(args?.filterValues ?? FILTER_VALUES); const selection = ref(DATA_GRID_1_ARGS.selection); const dataGrid1Props = DATA_GRID_1_ARGS; const dataGrid2Props = DATA_GRID_2_ARGS; return { // Values args, dataGrid1Props, dataGrid2Props, filters, filterValues, selection, }; }, }), args: { header: HEADER_PROPS, tabs: TABS_ARGS, inspector: INSPECTOR_ARGS, }, parameters: storybookDocsParameter(defaultCode), }; const additionalContentCode = ` <bento-data-grid-template :header="${JSON.stringify(HEADER_PROPS_DOCS)}" :tabs="${JSON.stringify( TABS_ARGS )}" sticky-tabs> <template #additionalContent> Your additional content/component here </template> <template #tab-1> <bento-data-grid :columns="${JSON.stringify(DEFAULT_COLUMNS)}" :data="dataArray" :pagination="${JSON.stringify(PAGINATION_DOCS)}" @navigate="clickNavigate" /> </template> <template #tab-2> <bento-data-grid :columns="${JSON.stringify(DEFAULT_COLUMNS)}" :data="dataArray" :filter-search-term.sync="searchTerm" :filters="${FILTERS_DOCS}" :filter-values.sync="${FILTER_VALUES_DOCS}" @filter-search-clear="onSearchCleared" @filter-search-input="onSearchInput" /> </template> </bento-data-grid-template> `; export const withAdditionalContent: Story = { render: (_args, { argTypes }) => ({ components: { BentoCountry, BentoDataGrid, BentoDataGridTemplate, BentoStatus, BentoSummaryGrid, BentoSummaryGridItemAmount, BentoSummaryGridItemCustom, }, props: Object.keys(argTypes), template: ` <bento-data-grid-template v-bind="args"> <template #additionalContent> <bento-summary-grid> <template #cell-1-1> <bento-summary-grid-item-custom title="Title" info-icon-tooltip-text="Text for icon" > <bento-status variant="green"> Status </bento-status> </bento-summary-grid-item-custom> </template> <template #cell-1-2> <bento-summary-grid-item-amount title="Title" label="€200.00" secondary-label="/ day" info-icon-tooltip-text="Text for icon" copy="Copy this to clipboard" /> </template> <template #cell-1-3> <bento-summary-grid-item-custom title="Title" info-icon-tooltip-text="Text for icon" > <bento-country :code="BentoCountryCode.NL" /> </bento-summary-grid-item-custom> </template> </bento-summary-grid> </template> <template #tab-1><bento-data-grid v-bind="dataGrid1Props" :filters="filters" :filter-values.sync="filterValues" /></template> <template #tab-2><bento-data-grid v-bind="dataGrid2Props" /></template> </bento-data-grid-template> `, setup(props) { const args = isVue2 ? props : _args; const filters = ref<BentoFilterBarModel>(args?.filters ?? FILTERS); const filterValues = ref<BentoFilterValues>(args?.filterValues ?? FILTER_VALUES); const dataGrid1Props = DATA_GRID_1_ARGS; const dataGrid2Props = DATA_GRID_2_ARGS; return { // Values args, dataGrid1Props, dataGrid2Props, filters, filterValues, // Enums BentoCountryCode, }; }, }), args: { header: HEADER_PROPS, tabs: TABS_ARGS, }, parameters: storybookDocsParameter(additionalContentCode), }; const singularDataGridCode = ` <bento-data-grid-template :header="${JSON.stringify(HEADER_PROPS)}" sticky-tabs> <bento-data-grid :columns="${JSON.stringify(DEFAULT_COLUMNS)}" :data="dataArray" :pagination="${JSON.stringify(PAGINATION_DOCS)}" @navigate="clickNavigate" :filter-search-term.sync="searchTerm" :filters="${FILTERS_DOCS}" :filter-values.sync="${FILTER_VALUES_DOCS}" @filter-search-clear="onSearchCleared" @filter-search-input="onSearchInput" /> </bento-data-grid-template> `; export const singularDataGrid: Story = { render: (_args, { argTypes }) => ({ components: { BentoDataGrid, BentoDataGridTemplate }, props: Object.keys(argTypes), template: ` <bento-data-grid-template v-bind="args"> <bento-data-grid v-bind="dataGridProps" :filters="filters" :filter-values.sync="filterValues" /> </bento-data-grid-template> `, setup(props) { const args = isVue2 ? props : _args; const filters = ref<BentoFilterBarModel>(args?.filters ?? FILTERS); const filterValues = ref<BentoFilterValues>(args?.filterValues ?? FILTER_VALUES); const dataGridProps = DATA_GRID_1_ARGS; return { // Values args, dataGridProps, filters, filterValues, }; }, }), args: { header: HEADER_PROPS, }, parameters: storybookDocsParameter(singularDataGridCode), }; const inspectorCode = ` <template> <bento-data-grid-template :header="header" :inspector="computedInspectorProps" @update:is-open:inspector="isInspectorOpen = $event" @update:active-page:inspector="inspectorActivePage = $event" > <template #default> <bento-data-grid :columns="columns" :data="dataArray" /> </template> <template #inspector-content> <div style="padding: 1rem;"> <bento-typography variant="title" el="h3"> Details for: {{ inspectorTitle }} </bento-typography> </div> </template> </bento-data-grid-template> </template> <script setup lang="ts"> import { ref, computed, onMounted } from 'vue'; import { BentoDataGridTemplate, BentoDataGrid, BentoTypography, } from '@adyen/bento-vue2'; import type { BentoDataGridTemplateHeader, BentoColumn, BentoDatagridDataItem } from '@adyen/bento-vue3'; const isInspectorOpen = ref(true); const inspectorTitle = ref('Shepherd Kane'); const inspectorActivePage = ref('id-1'); const pageFocusAnchorRef = ref<HTMLElement | null>(null); const dataArray = ref([ { id: '1', name: 'Shepherd Kane', company: 'Company 1', payment: 1604.05 }, { id: '2', name: 'Santos Palmer', company: 'Company 2', payment: 1635.00 }, ]); const openInspector = (item) => { inspectorTitle.value = item.name as string; isInspectorOpen.value = true; inspectorActivePage.value = item.id as string; const row = document.querySelector(\`[role="row"][aria-rowindex="\${item.rowIndex + 1}"]\`); pageFocusAnchorRef.value = row?.querySelector('[role="gridcell"]') as HTMLElement; }; const columns = computed<BentoColumn[]>(() => [ { field: 'name', label: 'Name', cellActions: [{ variant: 'open', event: openInspector }], }, { field: 'payment', label: 'Payment (€)', width: 200, }, ]); const header = ref<BentoDataGridTemplateHeader>({ title: 'Payments', infoIconTooltipText: 'Click the > icon on a row to open the inspector.', }); const computedInspectorProps = computed(() => ({ isOpen: isInspectorOpen.value, title: inspectorTitle.value, activePage: inspectorActivePage.value, pageFocusAnchor: pageFocusAnchorRef.value, })); <script> `; export const withInspector: Story = { render: (_args, { argTypes }) => ({ components: { BentoDataGrid, BentoDataGridTemplate, BentoTypography, BentoButton, }, props: Object.keys(argTypes), template: ` <bento-data-grid-template v-bind="args" :inspector="computedInspectorProps" @update:is-open:inspector="isInspectorOpen = $event" @update:active-page:inspector="inspectorActivePage = $event" > <template #default> <bento-data-grid v-bind="dataGridProps" :filters="dataGridFilters" :filter-values.sync="dataGridFilterValues" /> </template> <template #inspector-content> <bento-typography v-for="i in 10" :key="i" style="padding: 5px"> {{ inspectorContent }} </bento-typography> </template> </bento-data-grid-template> `, setup(props) { const args = isVue2 ? props : _args; const isInspectorOpen = ref(args.inspector.isOpen); const inspectorTitle = ref(args.inspector.title); const inspectorActivePage = ref(''); const dataGridFilters = ref<BentoFilterBarModel>(args?.filters ?? FILTERS); const dataGridFilterValues = ref<BentoFilterValues>(args?.filterValues ?? []); const inspectorContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'; const cellWithActions = { ...DEFAULT_COLUMNS[0], cellActions: [{ variant: 'open', event: item => openInspector(item) }], } satisfies BentoColumn; const columnsWithActions: Array<BentoColumn> = [cellWithActions, ...DEFAULT_COLUMNS.slice(1, 2)]; const dataGridProps = { ...DATA_GRID_1_ARGS, columns: columnsWithActions }; const pageFocusAnchorRef = ref<HTMLElement | null>(null); // Find the element after the component has mounted in the browser onMounted(() => { pageFocusAnchorRef.value = document.body .querySelector('[role="row"][aria-rowindex="1"]') .querySelectorAll('[role="gridcell"]')[0] as HTMLElement; }); const openInspector = item => { inspectorTitle.value = item.name; isInspectorOpen.value = true; inspectorActivePage.value = item.name; pageFocusAnchorRef.value = document.body .querySelector(`[role="row"][aria-rowindex="${item.id}"]`) .querySelectorAll('[role="gridcell"]')[0] as HTMLElement; }; const computedInspectorProps = computed(() => ({ ...args.inspector, isOpen: isInspectorOpen.value, title: inspectorTitle.value, activePage: inspectorActivePage.value, pageFocusAnchor: pageFocusAnchorRef.value, })); return { args, dataGridProps, dataGridFilters, dataGridFilterValues, isInspectorOpen, inspectorActivePage, computedInspectorProps, inspectorContent, openInspector, }; }, }), args: { header: HEADER_PROPS, inspector: { title: DATA_GRID_1_DATA[0].name, isOpen: true, activePage: DATA_GRID_1_DATA[0].name, }, }, parameters: storybookDocsParameter(inspectorCode), }; export const withHeaderWithViews: Story = { render: (_args, { argTypes }) => ({ components: { BentoDataGrid, BentoDataGridTemplate, BentoHeaderWithViews, }, props: Object.keys(argTypes), template: ` <bento-data-grid-template v-bind="args"> <template #header> <bento-header-with-views :actions="headerActions" description="Description" title="Page Title" :hasChanges="false" skipUnsavedChangesText="Don’t show this message again" :views="headerViews" /> </template> <template #infoIconTooltipContent>Test</template> <template #tab-1><bento-data-grid v-bind="dataGrid1Props" :filters="filters" :filter-values.sync="filterValues" column-panel /></template> <template #tab-2><bento-data-grid v-bind="dataGrid2Props" /></template> <template #inspector-content>Hello</template> </bento-data-grid-template> `, setup(props) { const args = isVue2 ? props : _args; const filters = ref<BentoFilterBarModel>(args?.filters ?? FILTERS); const filterValues = ref<BentoFilterValues>(args?.filterValues ?? FILTER_VALUES); const dataGrid1Props = DATA_GRID_1_ARGS; const dataGrid2Props = DATA_GRID_2_ARGS; const headerViews: Array<BentoHeaderWithViewsItem> = [ { icon: 'stack', iconColor: 'primary', label: 'View 1', }, { icon: 'stack', iconColor: 'primary', label: 'View 2', }, ]; const headerActions = [ { title: 'Primary action', }, { title: 'Secondary action', }, ]; return { // Values args, dataGrid1Props, dataGrid2Props, filters, filterValues, headerActions, headerViews, }; }, }), args: { tabs: TABS_ARGS, inspector: INSPECTOR_ARGS, }, parameters: storybookDocsParameter(DataGridTemplateWithHeaderWithViews), };
|
|
1
|
+
import { BentoButton } from '@/components/button'; import { BentoCountry, BentoCountryCode } from '@/components/country'; import { type BentoColumn, BentoDataGrid, type BentoDatagridData } from '@/components/data-grid'; import { type BentoFilterBarModel, BentoFilterItemType, type BentoFilterValues } from '@/components/filter-bar'; import { BentoHeaderWithViews, type BentoHeaderWithViewsItem } from '@/components/header-with-views'; import { type BentoInspectorProps } from '@/components/inspector'; import { BentoStatus } from '@/components/status'; import { BentoSummaryGrid, BentoSummaryGridItemAmount, BentoSummaryGridItemCustom } from '@/components/summary-grid'; import { BentoTypography } from '@/components/typography'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import type { Meta, StoryObj } from '@storybook/vue'; import { computed, onMounted, ref } from 'vue'; import { isVue2 } from 'vue-demi'; const DataGridTemplateWithHeaderWithViews = "<template>\n <bento-data-grid-template :tabs=\"tabs\">\n <template #header>\n <bento-header-with-views\n title=\"Page Title\"\n info-icon-tooltip-text=\"Description\"\n :has-changes=\"false\"\n skip-unsaved-changes-text=\"Don’t show this message again\"\n :actions=\"headerActions\"\n :views=\"headerViews\"\n />\n </template>\n\n <template #infoIconTooltipContent>Test</template>\n\n <template #tab-1>\n <bento-data-grid v-bind=\"dataGrid1Props\" column-panel />\n </template>\n\n <template #tab-2>\n <bento-data-grid v-bind=\"dataGrid2Props\" />\n </template>\n\n <template #inspector-content>Hello</template>\n </bento-data-grid-template>\n</template>\n\n<script setup lang=\"ts\">\n import type { BentoColumn, BentoDatagridData } from '@/components/data-grid';\n import { BentoDataGrid } from '@/components/data-grid';\n import type { BentoHeaderWithViewsItem } from '@/components/header-with-views';\n import { BentoHeaderWithViews } from '@/components/header-with-views';\n import type { BentoDataGridTemplateTabs } from '@/templates/data-grid-template';\n import { BentoDataGridTemplate } from '@/templates/data-grid-template';\n import { ref } from 'vue';\n\n const tabs = ref<BentoDataGridTemplateTabs>({\n tabs: [{ title: 'Data grid title 1' }, { title: 'Data grid title 2' }],\n });\n\n const defaultColumns: Array<BentoColumn> = [\n { field: 'name', label: 'Name', minWidth: 300, mandatory: true },\n { field: 'company', label: 'Reference', minWidth: 150 },\n { field: 'payment', label: 'Payment', width: 200, minWidth: 150 },\n ];\n\n const dataGrid1Data: BentoDatagridData = Array.from({ length: 50 }, (_, i) => ({\n id: `${i + 1}`,\n name: `Name ${i + 1}`,\n company: `Company ${i + 1}`,\n payment: `Payment ${i + 1}`,\n }));\n\n const dataGrid2Data: BentoDatagridData = Array.from({ length: 30 }, (_, i) => ({\n name: `Name ${i + 1}`,\n company: `Company ${i + 1}`,\n payment: `Payment ${i + 1}`,\n }));\n\n const dataGrid1Props = ref({\n data: dataGrid1Data,\n columns: defaultColumns,\n });\n\n const dataGrid2Props = ref({\n data: dataGrid2Data,\n columns: defaultColumns,\n });\n\n const headerViews: Array<BentoHeaderWithViewsItem> = [\n { icon: 'stack', iconColor: 'primary', label: 'View 1' },\n { icon: 'stack', iconColor: 'primary', label: 'View 2' },\n ];\n\n const headerActions = [{ title: 'Primary action' }, { title: 'Secondary action' }];\n</script>\n"; import './data-grid-template.stories.scss?module'; import { type BentoDataGridTemplateTabs } from './data-grid-template.types'; import BentoDataGridTemplate from './data-grid-template.vue'; const meta: Meta = { title: 'Data grid template', component: BentoDataGridTemplate, parameters: { layout: 'fullscreen', }, }; const HEADER_PROPS = { title: 'Payments', actions: [ { title: 'Primary action', event: () => undefined }, { title: 'Secondary action', event: () => undefined }, { title: 'Tetiary action', event: () => undefined }, ], infoIconTooltipText: 'Title Tooltip Text', }; const HEADER_PROPS_DOCS = { title: 'Payments', actions: [ { title: 'Primary action', event: () => undefined }, { title: 'Secondary action', event: () => undefined }, { title: 'Tetiary action', event: () => undefined }, ], infoIconTooltipText: 'Title Tooltip Text', }; const PAGINATION_DOCS = { description: 'datagrid navigation', hasNext: true, size: 10 }; const DEFAULT_COLUMNS: Array<BentoColumn> = [ { field: 'name', label: 'Name', minWidth: 300, mandatory: true }, { field: 'company', label: 'Reference', minWidth: 150 }, { field: 'payment', label: 'Payment', width: 200, minWidth: 150 }, ]; const DATA_GRID_1_DATA: BentoDatagridData = Array.from({ length: 50 }, (_, index) => ({ name: `Name ${index + 1}`, company: `Company ${index + 1}`, payment: `Payment ${index + 1}`, id: `${index + 1}`, })); const FILTERS: BentoFilterBarModel = [ { field: 'name', label: 'Name', type: BentoFilterItemType.INPUT, }, { field: 'company', label: 'Company', type: BentoFilterItemType.INPUT, }, ]; const FILTER_VALUES: BentoFilterValues = [ { field: 'company', value: 'Company 1', }, ]; const FILTERS_DOCS = `[ { field: 'name', label: 'Name', type: BentoFilterItemType.INPUT, }, { field: 'company', label: 'Company', type: BentoFilterItemType.INPUT, }, ]`; const FILTER_VALUES_DOCS = `[ { field: 'company', value: 'Company 1' }, ]`; const TABS_ARGS: BentoDataGridTemplateTabs = { tabs: [{ title: 'Data grid title 1' }, { title: 'Data grid title 2' }], }; const INSPECTOR_ARGS: BentoInspectorProps = { title: 'Title', size: 'large', isOpen: false, activePage: '', expandable: true, }; const BULK_ACTIONS = [ { title: 'Edit', event: () => undefined, }, { title: 'Delete', critical: true, event: () => undefined, }, ]; const DATA_GRID_1_ARGS = { data: DATA_GRID_1_DATA, columns: DEFAULT_COLUMNS, allowColumnDragAndDrop: false, pagination: {}, filterSearchTerm: '', highlightedRows: [DATA_GRID_1_DATA[0].id], selectable: true, selection: [DATA_GRID_1_DATA[2].id], bulkActions: BULK_ACTIONS, stickyPagination: true, }; const DATA_GRID_2_DATA: BentoDatagridData = Array.from({ length: 30 }, (_, index) => ({ name: `Name ${index + 1}`, company: `Company ${index + 1}`, payment: `Payment ${index + 1}`, })); const DATA_GRID_2_ARGS = { data: DATA_GRID_2_DATA, columns: DEFAULT_COLUMNS, allowColumnDragAndDrop: false, pagination: {}, }; export default meta; type Story = StoryObj<typeof BentoDataGridTemplate>; const defaultCode = ` <template> <bento-data-grid-template :header="header" :tabs="tabs" sticky-tabs> <template #tab-1> <bento-data-grid :columns="columns" :data="dataArray" :pagination.sync="pagination" :selection.sync="selection" :bulk-actions="bulkActions" selectable sticky-pagination @navigate="clickNavigate" /> </template> <template #tab-2> <bento-data-grid :columns="columns" :data="dataArray" :filter-search-term.sync="searchTerm" :filters="filtersConfig" :filter-values.sync="filterValues" :sort-by.sync="sortBy" /> </template> </bento-data-grid-template> </template> <script setup lang="ts"> import { BentoCountryCode, type BentoColumn, type BentoDatagridSortByColumn, type BentoDatagridDataItem, BentoDataGridTemplate, BentoDataGrid, type BentoDataGridTemplateHeader, type BentoDatagridPaginationProps, type BentoFilterBarModel, BentoFilterItemType, } from '@adyen/bento-vue2'; import messages from './messages.json'; const { t } = useI18n({ messages }); const header: BentoDataGridTemplateHeader = { title: 'Payments', actions: [ { title: 'Primary action', event: () => {} }, { title: 'Secondary action', event: () => {} }, { title: 'Tetiary action', event: () => {} }, ], infoIconTooltipText: 'Title Tooltip Text', }; const tabs: BentoDataGridTemplateTabs = { tabs: [{ title: 'Data grid title 1' }, { title: 'Data grid title 2' }], }; const columns = computed<BentoColumn[]>(() => [ { field: 'name', label: t('Name'), minWidth: 300, mandatory: true, frozen: true, autoWidth: true, sortable: true, }, { field: 'company', label: t('Reference') }, { field: 'payment', label: t('Payment'), width: 200, minWidth: 150 }, ]); const filtersConfig = computed<BentoFilterBarModel>(() => [ { field: 'company', label: t('Company'), type: BentoFilterItemType.INPUT, }, { field: 'countryCode', label: t('Country'), options: { listboxItems: [ { value: BentoCountryCode.NL, }, { value: BentoCountryCode.BE, }, ], variant: 'name', }, type: BentoFilterItemType.SELECT_COUNTRY, }, ]); // Watch this to keep track if the user filters data const filterValues = ref(); // Watch this to keep track if the user sorts data const sortBy = ref<BentoDatagridSortByColumn[]>([]); // Watch this to keep track if the user searches for data const searchTerm = ref(''); // Watch this to keep track if the user pages through the data const pagination = ref<BentoDatagridPaginationProps>({ description: 'datagrid 1 navigation', hasNext: true, size: 10 }); const selection = ref([]); const bulkActions = [ { title: 'Edit', event: () => undefined, }, { title: 'Delete', critical: true, event: () => undefined, }, ]; // This is a contrived example of the dataArray as this will normally be retried via an API const dataArray = ref<BentoDatagridDataItem[]>([ { id: '03c0a799-1ced-4017-aea3-0cebb0106335', name: 'Shepherd Kane', payment: 160405, company: 'VURBO', registered: '2023-06-30T13:56:09.498Z', tags: ['deserunt', 'et', 'esse'], reference: 'UnbQaUncf3eR1D8XUBqn_UnbQaUncf3eR1D8XUBqn_UnbQaUncf3eR1D8XUBqn', paymentStatus: 1, countryCode: BentoCountryCode.NL, }, { id: 'b6d4f1fd-b1f6-40a6-a443-f785c89604ef', name: 'Santos Palmer', payment: 163500, company: 'POLARAX', registered: '2023-04-28T13:11:09.498Z', tags: ['et', 'Lorem', 'sint'], reference: 'IxUZ9FsEPCZ9dFFPpI9C', paymentStatus: 2, countryCode: BentoCountryCode.BE, }, ]); </script> `; export const Default: Story = { render: (_args, { argTypes }) => ({ components: { BentoDataGrid, BentoDataGridTemplate, }, props: Object.keys(argTypes), template: ` <bento-data-grid-template v-bind="args"> <template #infoIconTooltipContent>Test</template> <template #tab-1><bento-data-grid v-bind="dataGrid1Props" :filters="filters" :filter-values.sync="filterValues" :selection.sync="selection" column-panel /></template> <template #tab-2><bento-data-grid v-bind="dataGrid2Props" /></template> <template #inspector-content>Hello</template> </bento-data-grid-template> `, setup(props) { const args = isVue2 ? props : _args; const filters = ref<BentoFilterBarModel>(args?.filters ?? FILTERS); const filterValues = ref<BentoFilterValues>(args?.filterValues ?? FILTER_VALUES); const selection = ref(DATA_GRID_1_ARGS.selection); const dataGrid1Props = DATA_GRID_1_ARGS; const dataGrid2Props = DATA_GRID_2_ARGS; return { // Values args, dataGrid1Props, dataGrid2Props, filters, filterValues, selection, }; }, }), args: { header: HEADER_PROPS, tabs: TABS_ARGS, inspector: INSPECTOR_ARGS, }, parameters: storybookDocsParameter(defaultCode), }; const additionalContentCode = ` <bento-data-grid-template :header="${JSON.stringify(HEADER_PROPS_DOCS)}" :tabs="${JSON.stringify( TABS_ARGS )}" sticky-tabs> <template #additionalContent> Your additional content/component here </template> <template #tab-1> <bento-data-grid :columns="${JSON.stringify(DEFAULT_COLUMNS)}" :data="dataArray" :pagination="${JSON.stringify(PAGINATION_DOCS)}" @navigate="clickNavigate" /> </template> <template #tab-2> <bento-data-grid :columns="${JSON.stringify(DEFAULT_COLUMNS)}" :data="dataArray" :filter-search-term.sync="searchTerm" :filters="${FILTERS_DOCS}" :filter-values.sync="${FILTER_VALUES_DOCS}" @filter-search-clear="onSearchCleared" @filter-search-input="onSearchInput" /> </template> </bento-data-grid-template> `; export const withAdditionalContent: Story = { render: (_args, { argTypes }) => ({ components: { BentoCountry, BentoDataGrid, BentoDataGridTemplate, BentoStatus, BentoSummaryGrid, BentoSummaryGridItemAmount, BentoSummaryGridItemCustom, }, props: Object.keys(argTypes), template: ` <bento-data-grid-template v-bind="args"> <template #additionalContent> <bento-summary-grid> <template #cell-1-1> <bento-summary-grid-item-custom title="Title" info-icon-tooltip-text="Text for icon" > <bento-status variant="green"> Status </bento-status> </bento-summary-grid-item-custom> </template> <template #cell-1-2> <bento-summary-grid-item-amount title="Title" label="€200.00" secondary-label="/ day" info-icon-tooltip-text="Text for icon" copy="Copy this to clipboard" /> </template> <template #cell-1-3> <bento-summary-grid-item-custom title="Title" info-icon-tooltip-text="Text for icon" > <bento-country :code="BentoCountryCode.NL" /> </bento-summary-grid-item-custom> </template> </bento-summary-grid> </template> <template #tab-1><bento-data-grid v-bind="dataGrid1Props" :filters="filters" :filter-values.sync="filterValues" /></template> <template #tab-2><bento-data-grid v-bind="dataGrid2Props" /></template> </bento-data-grid-template> `, setup(props) { const args = isVue2 ? props : _args; const filters = ref<BentoFilterBarModel>(args?.filters ?? FILTERS); const filterValues = ref<BentoFilterValues>(args?.filterValues ?? FILTER_VALUES); const dataGrid1Props = DATA_GRID_1_ARGS; const dataGrid2Props = DATA_GRID_2_ARGS; return { // Values args, dataGrid1Props, dataGrid2Props, filters, filterValues, // Enums BentoCountryCode, }; }, }), args: { header: HEADER_PROPS, tabs: TABS_ARGS, }, parameters: storybookDocsParameter(additionalContentCode), }; const singularDataGridCode = ` <bento-data-grid-template :header="${JSON.stringify(HEADER_PROPS)}" sticky-tabs> <bento-data-grid :columns="${JSON.stringify(DEFAULT_COLUMNS)}" :data="dataArray" :pagination="${JSON.stringify(PAGINATION_DOCS)}" @navigate="clickNavigate" :filter-search-term.sync="searchTerm" :filters="${FILTERS_DOCS}" :filter-values.sync="${FILTER_VALUES_DOCS}" @filter-search-clear="onSearchCleared" @filter-search-input="onSearchInput" /> </bento-data-grid-template> `; export const singularDataGrid: Story = { render: (_args, { argTypes }) => ({ components: { BentoDataGrid, BentoDataGridTemplate }, props: Object.keys(argTypes), template: ` <bento-data-grid-template v-bind="args"> <bento-data-grid v-bind="dataGridProps" :filters="filters" :filter-values.sync="filterValues" /> </bento-data-grid-template> `, setup(props) { const args = isVue2 ? props : _args; const filters = ref<BentoFilterBarModel>(args?.filters ?? FILTERS); const filterValues = ref<BentoFilterValues>(args?.filterValues ?? FILTER_VALUES); const dataGridProps = DATA_GRID_1_ARGS; return { // Values args, dataGridProps, filters, filterValues, }; }, }), args: { header: HEADER_PROPS, }, parameters: storybookDocsParameter(singularDataGridCode), }; const inspectorCode = ` <template> <bento-data-grid-template :header="header" :inspector="computedInspectorProps" @update:is-open:inspector="isInspectorOpen = $event" @update:active-page:inspector="inspectorActivePage = $event" > <template #default> <bento-data-grid :columns="columns" :data="dataArray" /> </template> <template #inspector-content> <div style="padding: 1rem;"> <bento-typography variant="title" el="h3"> Details for: {{ inspectorTitle }} </bento-typography> </div> </template> </bento-data-grid-template> </template> <script setup lang="ts"> import { ref, computed, onMounted } from 'vue'; import { BentoDataGridTemplate, BentoDataGrid, BentoTypography, } from '@adyen/bento-vue2'; import type { BentoDataGridTemplateHeader, BentoColumn, BentoDatagridDataItem } from '@adyen/bento-vue3'; const isInspectorOpen = ref(true); const inspectorTitle = ref('Shepherd Kane'); const inspectorActivePage = ref('id-1'); const pageFocusAnchorRef = ref<HTMLElement | null>(null); const dataArray = ref([ { id: '1', name: 'Shepherd Kane', company: 'Company 1', payment: 1604.05 }, { id: '2', name: 'Santos Palmer', company: 'Company 2', payment: 1635.00 }, ]); const openInspector = (item) => { inspectorTitle.value = item.name as string; isInspectorOpen.value = true; inspectorActivePage.value = item.id as string; const row = document.querySelector(\`[role="row"][aria-rowindex="\${item.rowIndex + 1}"]\`); pageFocusAnchorRef.value = row?.querySelector('[role="gridcell"]') as HTMLElement; }; const columns = computed<BentoColumn[]>(() => [ { field: 'name', label: 'Name', cellActions: [{ variant: 'open', event: openInspector }], }, { field: 'payment', label: 'Payment (€)', width: 200, }, ]); const header = ref<BentoDataGridTemplateHeader>({ title: 'Payments', infoIconTooltipText: 'Click the > icon on a row to open the inspector.', }); const computedInspectorProps = computed(() => ({ isOpen: isInspectorOpen.value, title: inspectorTitle.value, activePage: inspectorActivePage.value, pageFocusAnchor: pageFocusAnchorRef.value, })); <script> `; export const withInspector: Story = { render: (_args, { argTypes }) => ({ components: { BentoDataGrid, BentoDataGridTemplate, BentoTypography, BentoButton, }, props: Object.keys(argTypes), template: ` <bento-data-grid-template v-bind="args" :inspector="computedInspectorProps" @update:is-open:inspector="isInspectorOpen = $event" @update:active-page:inspector="inspectorActivePage = $event" > <template #default> <bento-data-grid v-bind="dataGridProps" :filters="dataGridFilters" :filter-values.sync="dataGridFilterValues" /> </template> <template #inspector-content> <bento-typography v-for="i in 10" :key="i" style="padding: 5px"> {{ inspectorContent }} </bento-typography> </template> </bento-data-grid-template> `, setup(props) { const args = isVue2 ? props : _args; const isInspectorOpen = ref(args.inspector.isOpen); const inspectorTitle = ref(args.inspector.title); const inspectorActivePage = ref(''); const dataGridFilters = ref<BentoFilterBarModel>(args?.filters ?? FILTERS); const dataGridFilterValues = ref<BentoFilterValues>(args?.filterValues ?? []); const inspectorContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'; const cellWithActions = { ...DEFAULT_COLUMNS[0], cellActions: [{ variant: 'open', event: item => openInspector(item) }], } satisfies BentoColumn; const columnsWithActions: Array<BentoColumn> = [cellWithActions, ...DEFAULT_COLUMNS.slice(1, 2)]; const dataGridProps = { ...DATA_GRID_1_ARGS, columns: columnsWithActions }; const pageFocusAnchorRef = ref<HTMLElement | null>(null); // Find the element after the component has mounted in the browser onMounted(() => { pageFocusAnchorRef.value = document.body .querySelector('[role="row"][aria-rowindex="1"]') .querySelectorAll('[role="gridcell"]')[0] as HTMLElement; }); const openInspector = item => { inspectorTitle.value = item.name; isInspectorOpen.value = true; inspectorActivePage.value = item.name; pageFocusAnchorRef.value = document.body .querySelector(`[role="row"][aria-rowindex="${item.id}"]`) .querySelectorAll('[role="gridcell"]')[0] as HTMLElement; }; const computedInspectorProps = computed(() => ({ ...args.inspector, isOpen: isInspectorOpen.value, title: inspectorTitle.value, activePage: inspectorActivePage.value, pageFocusAnchor: pageFocusAnchorRef.value, })); return { args, dataGridProps, dataGridFilters, dataGridFilterValues, isInspectorOpen, inspectorActivePage, computedInspectorProps, inspectorContent, openInspector, }; }, }), args: { header: HEADER_PROPS, inspector: { title: DATA_GRID_1_DATA[0].name, isOpen: true, activePage: DATA_GRID_1_DATA[0].name, }, }, parameters: storybookDocsParameter(inspectorCode), }; export const withHeaderWithViews: Story = { render: (_args, { argTypes }) => ({ components: { BentoDataGrid, BentoDataGridTemplate, BentoHeaderWithViews, }, props: Object.keys(argTypes), template: ` <bento-data-grid-template v-bind="args"> <template #header> <bento-header-with-views :actions="headerActions" description="Description" title="Page Title" :hasChanges="false" skipUnsavedChangesText="Don’t show this message again" :views="headerViews" /> </template> <template #infoIconTooltipContent>Test</template> <template #tab-1><bento-data-grid v-bind="dataGrid1Props" :filters="filters" :filter-values.sync="filterValues" column-panel /></template> <template #tab-2><bento-data-grid v-bind="dataGrid2Props" /></template> <template #inspector-content>Hello</template> </bento-data-grid-template> `, setup(props) { const args = isVue2 ? props : _args; const filters = ref<BentoFilterBarModel>(args?.filters ?? FILTERS); const filterValues = ref<BentoFilterValues>(args?.filterValues ?? FILTER_VALUES); const dataGrid1Props = DATA_GRID_1_ARGS; const dataGrid2Props = DATA_GRID_2_ARGS; const headerViews: Array<BentoHeaderWithViewsItem> = [ { icon: 'stack', iconColor: 'primary', label: 'View 1', }, { icon: 'stack', iconColor: 'primary', label: 'View 2', }, ]; const headerActions = [ { title: 'Primary action', }, { title: 'Secondary action', }, ]; return { // Values args, dataGrid1Props, dataGrid2Props, filters, filterValues, headerActions, headerViews, }; }, }), args: { tabs: TABS_ARGS, inspector: INSPECTOR_ARGS, }, parameters: storybookDocsParameter(DataGridTemplateWithHeaderWithViews), };
|