@adyen/bento-mcp 0.0.0 → 0.1.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 +11 -0
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/assets/components/accordion/accordion.docs.mdx +77 -0
- package/dist/assets/components/accordion/accordion.stories.ts +1 -0
- package/dist/assets/components/accordion/accordion.vue +1 -0
- package/dist/assets/components/accordion/components/accordion-item.stories.ts +1 -0
- package/dist/assets/components/accordion/components/accordion-item.vue +1 -0
- package/dist/assets/components/action-bar/action-bar.docs.mdx +103 -0
- package/dist/assets/components/action-bar/action-bar.stories.ts +1 -0
- package/dist/assets/components/action-bar/action-bar.vue +1 -0
- package/dist/assets/components/alert/alert.docs.mdx +106 -0
- package/dist/assets/components/alert/alert.stories.ts +1 -0
- package/dist/assets/components/alert/alert.vue +1 -0
- package/dist/assets/components/avatar/avatar.docs.mdx +44 -0
- package/dist/assets/components/avatar/avatar.stories.ts +1 -0
- package/dist/assets/components/avatar/avatar.vue +1 -0
- package/dist/assets/components/avatar/components/avatar-image/avatar-image.vue +1 -0
- package/dist/assets/components/button/button.docs.mdx +137 -0
- package/dist/assets/components/button/button.stories.ts +1 -0
- package/dist/assets/components/button/button.vue +1 -0
- package/dist/assets/components/button/components/ai-button/ai-button.docs.mdx +40 -0
- package/dist/assets/components/button/components/ai-button/ai-button.stories.ts +1 -0
- package/dist/assets/components/button/components/ai-button/ai-button.vue +1 -0
- package/dist/assets/components/button/components/button-actions/button-actions.docs.mdx +169 -0
- package/dist/assets/components/button/components/button-actions/button-actions.stories.ts +1 -0
- package/dist/assets/components/button/components/button-actions/button-actions.vue +1 -0
- package/dist/assets/components/button/components/loading-button/loading-button.docs.mdx +106 -0
- package/dist/assets/components/button/components/loading-button/loading-button.stories.ts +1 -0
- package/dist/assets/components/button/components/loading-button/loading-button.vue +1 -0
- package/dist/assets/components/button/components/toggle-button/toggle-button.docs.mdx +81 -0
- package/dist/assets/components/button/components/toggle-button/toggle-button.stories.ts +1 -0
- package/dist/assets/components/button/components/toggle-button/toggle-button.vue +1 -0
- package/dist/assets/components/card/card.docs.mdx +166 -0
- package/dist/assets/components/card/card.stories.ts +1 -0
- package/dist/assets/components/card/card.vue +1 -0
- package/dist/assets/components/checkbox/checkbox.docs.mdx +116 -0
- package/dist/assets/components/checkbox/checkbox.stories.ts +1 -0
- package/dist/assets/components/checkbox/checkbox.vue +1 -0
- package/dist/assets/components/checkbox/components/checkbox-group/checkbox-group.docs.mdx +134 -0
- package/dist/assets/components/checkbox/components/checkbox-group/checkbox-group.stories.ts +1 -0
- package/dist/assets/components/checkbox/components/checkbox-group/checkbox-group.vue +1 -0
- package/dist/assets/components/chip/chip.docs.mdx +51 -0
- package/dist/assets/components/chip/chip.stories.ts +1 -0
- package/dist/assets/components/chip/chip.vue +1 -0
- package/dist/assets/components/click-outside/click-outside.docs.mdx +30 -0
- package/dist/assets/components/click-outside/click-outside.stories.ts +1 -0
- package/dist/assets/components/code-snippet/code-snippet.docs.mdx +73 -0
- package/dist/assets/components/code-snippet/code-snippet.stories.ts +1 -0
- package/dist/assets/components/code-snippet/code-snippet.vue +1 -0
- package/dist/assets/components/country/country.docs.mdx +61 -0
- package/dist/assets/components/country/country.stories.ts +1 -0
- package/dist/assets/components/country/country.vue +1 -0
- package/dist/assets/components/currency/currency.docs.mdx +38 -0
- package/dist/assets/components/currency/currency.stories.ts +1 -0
- package/dist/assets/components/currency/currency.vue +1 -0
- package/dist/assets/components/dashed-underline/dashed-underline.docs.mdx +57 -0
- package/dist/assets/components/dashed-underline/dashed-underline.stories.ts +1 -0
- package/dist/assets/components/dashed-underline/dashed-underline.vue +1 -0
- package/dist/assets/components/data-grid/components/data-grid-cell/data-grid-cell.vue +1 -0
- package/dist/assets/components/data-grid/components/data-grid-cell-actions/data-grid-cell-actions.vue +1 -0
- package/dist/assets/components/data-grid/components/data-grid-columns/data-grid-columns.vue +1 -0
- package/dist/assets/components/data-grid/components/data-grid-config-settings/components/data-grid-config-settings-column-row/data-grid-config-settings-column-row.vue +1 -0
- package/dist/assets/components/data-grid/components/data-grid-config-settings/data-grid-config-settings.vue +1 -0
- package/dist/assets/components/data-grid/components/data-grid-lazy-load/data-grid-lazy-load.vue +1 -0
- package/dist/assets/components/data-grid/components/data-grid-row/data-grid-row.vue +1 -0
- package/dist/assets/components/data-grid/components/data-grid-static-icon/data-grid-static-icon.docs.mdx +61 -0
- package/dist/assets/components/data-grid/components/data-grid-static-icon/data-grid-static-icon.stories.ts +1 -0
- package/dist/assets/components/data-grid/components/data-grid-static-icon/data-grid-static-icon.vue +1 -0
- package/dist/assets/components/data-grid/components/data-grid-summary-cell/data-grid-summary-cell.docs.mdx +56 -0
- package/dist/assets/components/data-grid/components/data-grid-summary-cell/data-grid-summary-cell.stories.ts +1 -0
- package/dist/assets/components/data-grid/components/data-grid-summary-cell/data-grid-summary-cell.vue +1 -0
- package/dist/assets/components/data-grid/components/data-grid-trend-cell/data-grid-trend-cell.docs.mdx +48 -0
- package/dist/assets/components/data-grid/components/data-grid-trend-cell/data-grid-trend-cell.stories.ts +1 -0
- package/dist/assets/components/data-grid/components/data-grid-trend-cell/data-grid-trend-cell.vue +1 -0
- package/dist/assets/components/data-grid/data-grid.docs.mdx +951 -0
- package/dist/assets/components/data-grid/data-grid.stories.ts +1 -0
- package/dist/assets/components/data-grid/data-grid.vue +1 -0
- package/dist/assets/components/date/date.docs.mdx +49 -0
- package/dist/assets/components/date/date.stories.ts +1 -0
- package/dist/assets/components/date/date.vue +1 -0
- package/dist/assets/components/date-picker/date-picker.docs.mdx +69 -0
- package/dist/assets/components/date-picker/date-picker.stories.ts +1 -0
- package/dist/assets/components/date-picker/date-picker.vue +1 -0
- package/dist/assets/components/date-range-picker/components/date-range-picker-calendar/date-range-picker-calendar.vue +1 -0
- package/dist/assets/components/date-range-picker/date-range-picker.docs.mdx +168 -0
- package/dist/assets/components/date-range-picker/date-range-picker.stories.ts +1 -0
- package/dist/assets/components/date-range-picker/date-range-picker.vue +1 -0
- package/dist/assets/components/divider/divider.docs.mdx +27 -0
- package/dist/assets/components/divider/divider.stories.ts +1 -0
- package/dist/assets/components/divider/divider.vue +1 -0
- package/dist/assets/components/dropdown/components/dropdown-base-textbox/dropdown-base-textbox.vue +1 -0
- package/dist/assets/components/dropdown/components/dropdown-default-textbox/dropdown-default-textbox.vue +1 -0
- package/dist/assets/components/dropdown/components/dropdown-options-container/dropdown-options-container.vue +1 -0
- package/dist/assets/components/dropdown/components/dropdown-small-textbox/dropdown-small-textbox.vue +1 -0
- package/dist/assets/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.stories.ts +1 -0
- package/dist/assets/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.vue +1 -0
- package/dist/assets/components/dropdown/components/variants/dropdown-country/dropdown-country.stories.ts +1 -0
- package/dist/assets/components/dropdown/components/variants/dropdown-country/dropdown-country.vue +1 -0
- package/dist/assets/components/dropdown/components/variants/dropdown-currency/dropdown-currency.stories.ts +1 -0
- package/dist/assets/components/dropdown/components/variants/dropdown-currency/dropdown-currency.vue +1 -0
- package/dist/assets/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.stories.ts +1 -0
- package/dist/assets/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.vue +1 -0
- package/dist/assets/components/dropdown/components/variants/dropdown-tag/dropdown-tag.stories.ts +1 -0
- package/dist/assets/components/dropdown/components/variants/dropdown-tag/dropdown-tag.vue +1 -0
- package/dist/assets/components/dropdown/dropdown.docs.mdx +420 -0
- package/dist/assets/components/dropdown/dropdown.stories.ts +1 -0
- package/dist/assets/components/dropdown/dropdown.vue +1 -0
- package/dist/assets/components/empty-state/empty-state.docs.mdx +115 -0
- package/dist/assets/components/empty-state/empty-state.stories.ts +1 -0
- package/dist/assets/components/empty-state/empty-state.vue +1 -0
- package/dist/assets/components/file-uploader/components/file-uploader-file-card/components/file-uploader-file-card-animation/file-uploader-file-card-animation.vue +1 -0
- package/dist/assets/components/file-uploader/components/file-uploader-file-card/file-uploader-file-card.stories.ts +1 -0
- package/dist/assets/components/file-uploader/components/file-uploader-file-card/file-uploader-file-card.vue +1 -0
- package/dist/assets/components/file-uploader/components/file-uploader-restrictions/file-uploader-restrictions.stories.ts +1 -0
- package/dist/assets/components/file-uploader/components/file-uploader-restrictions/file-uploader-restrictions.vue +1 -0
- package/dist/assets/components/file-uploader/file-uploader.docs.mdx +117 -0
- package/dist/assets/components/file-uploader/file-uploader.stories.ts +1 -0
- package/dist/assets/components/file-uploader/file-uploader.vue +1 -0
- package/dist/assets/components/filter-bar/components/all-filters-modal/all-filters-modal.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/all-filters-modal/all-filters-modal.vue +1 -0
- package/dist/assets/components/filter-bar/components/all-filters-modal/components/all-filters-modal-button/all-filters-modal-button.vue +1 -0
- package/dist/assets/components/filter-bar/components/base-filter/base-filter.docs.mdx +90 -0
- package/dist/assets/components/filter-bar/components/base-filter/base-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/base-filter/base-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/base-filter-button/base-filter-button.vue +1 -0
- package/dist/assets/components/filter-bar/components/boolean-filter/boolean-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/checkbox-group-filter/checkbox-group-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/checkbox-group-filter/checkbox-group-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/date-filter/date-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/date-filter/date-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/date-range-filter/date-range-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/date-range-filter/date-range-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/filter-bar-button/filter-bar-button.vue +1 -0
- package/dist/assets/components/filter-bar/components/filter-bar-button-group/filter-bar-button-group.vue +1 -0
- package/dist/assets/components/filter-bar/components/input-filter/input-filter.docs.mdx +18 -0
- package/dist/assets/components/filter-bar/components/input-filter/input-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/input-filter/input-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/input-with-dropdown-filter/input-with-dropdown-filter.docs.mdx +18 -0
- package/dist/assets/components/filter-bar/components/input-with-dropdown-filter/input-with-dropdown-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/input-with-dropdown-filter/input-with-dropdown-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/radio-group-filter/radio-group-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/radio-group-filter/radio-group-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/range-filter/range-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/components/select-filter-button/select-filter-button.vue +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/components/select-filter-dropdown/select-filter-dropdown.vue +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/select-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/select-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-avatar-filter/select-avatar-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-avatar-filter/select-avatar-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-country-filter/select-country-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-country-filter/select-country-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-currency-filter/select-currency-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-currency-filter/select-currency-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-payment-method-filter/select-payment-method-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-payment-method-filter/select-payment-method-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-tag-filter/select-tag-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/select-filter/variants/select-tag-filter/select-tag-filter.vue +1 -0
- package/dist/assets/components/filter-bar/components/toggle-filter/toggle-filter.stories.ts +1 -0
- package/dist/assets/components/filter-bar/components/toggle-filter/toggle-filter.vue +1 -0
- package/dist/assets/components/filter-bar/filter-bar.docs.mdx +1005 -0
- package/dist/assets/components/filter-bar/filter-bar.stories.ts +1 -0
- package/dist/assets/components/filter-bar/filter-bar.vue +1 -0
- package/dist/assets/components/focus-trap/focus-trap.docs.mdx +10 -0
- package/dist/assets/components/focus-trap/focus-trap.stories.ts +1 -0
- package/dist/assets/components/focus-trap/focus-trap.vue +1 -0
- package/dist/assets/components/form-layout/components/form-layout-field-tip/form-layout-field-tip.vue +1 -0
- package/dist/assets/components/form-layout/components/form-layout-group/form-layout-group.vue +1 -0
- package/dist/assets/components/form-layout/components/form-layout-title/form-layout-title.vue +1 -0
- package/dist/assets/components/form-layout/form-layout.docs.mdx +452 -0
- package/dist/assets/components/form-layout/form-layout.stories.ts +1 -0
- package/dist/assets/components/form-layout/form-layout.vue +1 -0
- package/dist/assets/components/header/header.docs.mdx +85 -0
- package/dist/assets/components/header/header.stories.ts +1 -0
- package/dist/assets/components/header/header.vue +1 -0
- package/dist/assets/components/header-with-views/components/header-with-views-all-views/header-with-views-all-views.vue +1 -0
- package/dist/assets/components/header-with-views/components/header-with-views-item-edit-form/header-with-views-edit-form.vue +1 -0
- package/dist/assets/components/header-with-views/header-with-views.docs.mdx +103 -0
- package/dist/assets/components/header-with-views/header-with-views.stories.ts +1 -0
- package/dist/assets/components/header-with-views/header-with-views.vue +1 -0
- package/dist/assets/components/image/image.docs.mdx +34 -0
- package/dist/assets/components/image/image.stories.ts +1 -0
- package/dist/assets/components/image/image.vue +1 -0
- package/dist/assets/components/info-icon/info-icon.docs.mdx +57 -0
- package/dist/assets/components/info-icon/info-icon.stories.ts +1 -0
- package/dist/assets/components/info-icon/info-icon.vue +1 -0
- package/dist/assets/components/input-field/input-field.docs.mdx +141 -0
- package/dist/assets/components/input-field/input-field.stories.ts +1 -0
- package/dist/assets/components/input-field/input-field.vue +1 -0
- package/dist/assets/components/input-field-password/input-field-password.docs.mdx +292 -0
- package/dist/assets/components/input-field-password/input-field-password.stories.ts +1 -0
- package/dist/assets/components/input-field-password/input-field-password.vue +1 -0
- package/dist/assets/components/input-field-phone-number/input-field-phone-number.docs.mdx +72 -0
- package/dist/assets/components/input-field-phone-number/input-field-phone-number.stories.ts +1 -0
- package/dist/assets/components/input-field-phone-number/input-field-phone-number.vue +1 -0
- package/dist/assets/components/inspector/inspector.docs.mdx +118 -0
- package/dist/assets/components/inspector/inspector.stories.ts +1 -0
- package/dist/assets/components/inspector/inspector.vue +1 -0
- package/dist/assets/components/internal/base-button/base-button.vue +1 -0
- package/dist/assets/components/internal/button-actions-with-menu/button-actions-with-menu.stories.ts +1 -0
- package/dist/assets/components/internal/button-actions-with-menu/button-actions-with-menu.vue +1 -0
- package/dist/assets/components/internal/calendar/calendar.stories.ts +1 -0
- package/dist/assets/components/internal/calendar/calendar.vue +1 -0
- package/dist/assets/components/internal/calendar/components/calendar-month/calendar-month.stories.ts +1 -0
- package/dist/assets/components/internal/calendar/components/calendar-month/calendar-month.vue +1 -0
- package/dist/assets/components/internal/calendar/components/calendar-month/components/calendar-month-day/__test__/calendar-month-day-stub.vue +1 -0
- package/dist/assets/components/internal/calendar/components/calendar-month/components/calendar-month-day/calendar-month-day.stories.ts +1 -0
- package/dist/assets/components/internal/calendar/components/calendar-month/components/calendar-month-day/calendar-month-day.vue +1 -0
- package/dist/assets/components/internal/calendar/components/calendar-year/calendar-year.vue +1 -0
- package/dist/assets/components/internal/calendar/components/calendar-year/components/calendar-year-month/__test__/calendar-year-month-stub.vue +1 -0
- package/dist/assets/components/internal/calendar/components/calendar-year/components/calendar-year-month/calendar-year-month.vue +1 -0
- package/dist/assets/components/internal/checkbox-input/checkbox-input.stories.ts +1 -0
- package/dist/assets/components/internal/checkbox-input/checkbox-input.vue +1 -0
- package/dist/assets/components/internal/controls-group/controls-group.vue +1 -0
- package/dist/assets/components/internal/copy/copy.docs.mdx +43 -0
- package/dist/assets/components/internal/copy/copy.stories.ts +1 -0
- package/dist/assets/components/internal/copy/copy.vue +1 -0
- package/dist/assets/components/internal/decorative-checkbox/decorative-checkbox.vue +1 -0
- package/dist/assets/components/internal/dialog-page/dialog-page.vue +1 -0
- package/dist/assets/components/internal/error-message/error-message.vue +1 -0
- package/dist/assets/components/internal/field-label/field-label.vue +1 -0
- package/dist/assets/components/internal/fixed-scroller/fixed-scroller.docs.mdx +21 -0
- package/dist/assets/components/internal/fixed-scroller/fixed-scroller.stories.ts +1 -0
- package/dist/assets/components/internal/fixed-scroller/fixed-scroller.vue +1 -0
- package/dist/assets/components/internal/footer-actions/footer-actions.vue +1 -0
- package/dist/assets/components/internal/grid-layout/grid-layout.vue +1 -0
- package/dist/assets/components/internal/header-meta/header-meta.vue +1 -0
- package/dist/assets/components/internal/info-icon-with-popover/info-icon-with-popover.vue +1 -0
- 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 +1 -0
- package/dist/assets/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/listbox-multi-select-options.vue +1 -0
- package/dist/assets/components/internal/listbox/components/listbox-multi-select/listbox-multi-select.vue +1 -0
- package/dist/assets/components/internal/listbox/components/listbox-option/listbox-option.vue +1 -0
- package/dist/assets/components/internal/listbox/components/listbox-option-tag/listbox-option-tag.vue +1 -0
- package/dist/assets/components/internal/listbox/components/listbox-single-select/components/listbox-single-select-category/listbox-single-select-category.vue +1 -0
- package/dist/assets/components/internal/listbox/components/listbox-single-select/listbox-single-select.vue +1 -0
- package/dist/assets/components/internal/listbox/components/listbox-single-select-option/listbox-single-select-option.vue +1 -0
- package/dist/assets/components/internal/listbox/listbox.stories.ts +1 -0
- package/dist/assets/components/internal/listbox/listbox.vue +1 -0
- package/dist/assets/components/internal/radio-input/radio-input.stories.ts +1 -0
- package/dist/assets/components/internal/radio-input/radio-input.vue +1 -0
- package/dist/assets/components/internal/teleport/teleport.vue +1 -0
- package/dist/assets/components/internal/tooltip/tooltip.test.vue +1 -0
- package/dist/assets/components/internal/tooltip/tooltip.vue +1 -0
- package/dist/assets/components/layout/components/layout-row/layout-row.stories.ts +1 -0
- package/dist/assets/components/layout/components/layout-row/layout-row.vue +1 -0
- package/dist/assets/components/layout/layout.docs.mdx +108 -0
- package/dist/assets/components/layout/layout.stories.ts +1 -0
- package/dist/assets/components/layout/layout.vue +1 -0
- package/dist/assets/components/link/link.docs.mdx +119 -0
- package/dist/assets/components/link/link.stories.ts +1 -0
- package/dist/assets/components/link/link.vue +1 -0
- package/dist/assets/components/loading-indicator/loading-indicator.docs.mdx +65 -0
- package/dist/assets/components/loading-indicator/loading-indicator.stories.ts +1 -0
- package/dist/assets/components/loading-indicator/loading-indicator.vue +1 -0
- package/dist/assets/components/menu/components/menu-item/menu-item.vue +1 -0
- package/dist/assets/components/menu/components/menu-item-list/menu-item-list.vue +1 -0
- package/dist/assets/components/menu/components/menu-list-container/menu-list-container.vue +1 -0
- package/dist/assets/components/menu/components/sub-menu-item-list/sub-menu-item-list.vue +1 -0
- package/dist/assets/components/menu/menu.docs.mdx +121 -0
- package/dist/assets/components/menu/menu.stories.ts +1 -0
- package/dist/assets/components/menu/menu.vue +1 -0
- package/dist/assets/components/modal/components/base-modal/base-modal.vue +1 -0
- package/dist/assets/components/modal/components/modal-default/modal-default.vue +1 -0
- package/dist/assets/components/modal/components/modal-dialog/modal-dialog.vue +1 -0
- package/dist/assets/components/modal/components/modal-page/modal-page.vue +1 -0
- package/dist/assets/components/modal/modal.docs.mdx +215 -0
- package/dist/assets/components/modal/modal.stories.ts +1 -0
- package/dist/assets/components/modal/modal.vue +1 -0
- package/dist/assets/components/modal-fullscreen/components/modal-fullscreen-page.vue +1 -0
- package/dist/assets/components/modal-fullscreen/modal-fullscreen.docs.mdx +217 -0
- package/dist/assets/components/modal-fullscreen/modal-fullscreen.stories.ts +1 -0
- package/dist/assets/components/modal-fullscreen/modal-fullscreen.vue +1 -0
- package/dist/assets/components/pagination/components/pagination-context/pagination-context.vue +1 -0
- package/dist/assets/components/pagination/components/pagination-controls/pagination-controls.vue +1 -0
- package/dist/assets/components/pagination/components/pagination-results-per-page/pagination-results-per-page.vue +1 -0
- package/dist/assets/components/pagination/pagination.docs.mdx +116 -0
- package/dist/assets/components/pagination/pagination.stories.ts +1 -0
- package/dist/assets/components/pagination/pagination.vue +1 -0
- package/dist/assets/components/payment-method/payment-method.docs.mdx +34 -0
- package/dist/assets/components/payment-method/payment-method.stories.ts +1 -0
- package/dist/assets/components/payment-method/payment-method.vue +1 -0
- package/dist/assets/components/popover/components/popover-dismiss-button/popover-dismiss-button.vue +1 -0
- package/dist/assets/components/popover/components/popover-image/popover-image.vue +1 -0
- package/dist/assets/components/popover/components/popover-title/popover-title.vue +1 -0
- package/dist/assets/components/popover/popover.docs.mdx +89 -0
- package/dist/assets/components/popover/popover.stories.ts +1 -0
- package/dist/assets/components/popover/popover.vue +1 -0
- package/dist/assets/components/popper-container/popper-container.docs.mdx +11 -0
- package/dist/assets/components/popper-container/popper-container.stories.ts +1 -0
- package/dist/assets/components/popper-container/popper-container.vue +1 -0
- package/dist/assets/components/promo-banner/promo-banner.docs.mdx +94 -0
- package/dist/assets/components/promo-banner/promo-banner.stories.ts +1 -0
- package/dist/assets/components/promo-banner/promo-banner.vue +1 -0
- package/dist/assets/components/radio-group/components/radio-button/radio-button.docs.mdx +76 -0
- package/dist/assets/components/radio-group/components/radio-button/radio-button.stories.ts +1 -0
- package/dist/assets/components/radio-group/components/radio-button/radio-button.vue +1 -0
- package/dist/assets/components/radio-group/radio-group.docs.mdx +154 -0
- package/dist/assets/components/radio-group/radio-group.stories.ts +1 -0
- package/dist/assets/components/radio-group/radio-group.vue +1 -0
- package/dist/assets/components/rich-text-editor/components/rich-text-editor-content-area/rich-text-editor-content-area.vue +1 -0
- package/dist/assets/components/rich-text-editor/components/rich-text-editor-renderer/components/rich-text-editor-code-block/rich-text-editor-code-block.vue +1 -0
- package/dist/assets/components/rich-text-editor/components/rich-text-editor-renderer/components/rich-text-editor-inline-code/rich-text-editor-inline-code.vue +1 -0
- package/dist/assets/components/rich-text-editor/components/rich-text-editor-renderer/components/rich-text-editor-link/rich-text-editor-link.vue +1 -0
- package/dist/assets/components/rich-text-editor/components/rich-text-editor-renderer/components/rich-text-editor-list-item/rich-text-editor-list-item.vue +1 -0
- package/dist/assets/components/rich-text-editor/components/rich-text-editor-renderer/components/rich-text-editor-table/rich-text-editor-table.vue +1 -0
- package/dist/assets/components/rich-text-editor/rich-text-editor.docs.mdx +52 -0
- package/dist/assets/components/rich-text-editor/rich-text-editor.stories.ts +1 -0
- package/dist/assets/components/rich-text-editor/rich-text-editor.vue +1 -0
- package/dist/assets/components/search-bar/search-bar.docs.mdx +117 -0
- package/dist/assets/components/search-bar/search-bar.stories.ts +1 -0
- package/dist/assets/components/search-bar/search-bar.vue +1 -0
- package/dist/assets/components/secondary-nav/components/secondary-nav-category/secondary-nav-category.vue +1 -0
- package/dist/assets/components/secondary-nav/components/secondary-nav-item/secondary-nav-item.vue +1 -0
- package/dist/assets/components/secondary-nav/secondary-nav.docs.mdx +40 -0
- package/dist/assets/components/secondary-nav/secondary-nav.stories.ts +1 -0
- package/dist/assets/components/secondary-nav/secondary-nav.vue +1 -0
- package/dist/assets/components/segmented-control/components/segmented-control-button/segmented-control-button.vue +1 -0
- package/dist/assets/components/segmented-control/segmented-control.docs.mdx +90 -0
- package/dist/assets/components/segmented-control/segmented-control.stories.ts +1 -0
- package/dist/assets/components/segmented-control/segmented-control.vue +1 -0
- package/dist/assets/components/selection-card/components/selection-card-group/selection-card-group.docs.mdx +119 -0
- package/dist/assets/components/selection-card/components/selection-card-group/selection-card-group.stories.ts +1 -0
- package/dist/assets/components/selection-card/components/selection-card-group/selection-card-group.vue +1 -0
- package/dist/assets/components/selection-card/selection-card.docs.mdx +108 -0
- package/dist/assets/components/selection-card/selection-card.stories.ts +1 -0
- package/dist/assets/components/selection-card/selection-card.vue +1 -0
- package/dist/assets/components/sidepanel/components/sidepanel-page.stories.ts +1 -0
- package/dist/assets/components/sidepanel/components/sidepanel-page.vue +1 -0
- package/dist/assets/components/sidepanel/sidepanel.docs.mdx +129 -0
- package/dist/assets/components/sidepanel/sidepanel.stories.ts +1 -0
- package/dist/assets/components/sidepanel/sidepanel.vue +1 -0
- package/dist/assets/components/status/status.docs.mdx +62 -0
- package/dist/assets/components/status/status.stories.ts +1 -0
- package/dist/assets/components/status/status.vue +1 -0
- package/dist/assets/components/stepper/components/step/step.stories.ts +1 -0
- package/dist/assets/components/stepper/components/step/step.vue +1 -0
- package/dist/assets/components/stepper/stepper.docs.mdx +127 -0
- package/dist/assets/components/stepper/stepper.stories.ts +1 -0
- package/dist/assets/components/stepper/stepper.vue +1 -0
- package/dist/assets/components/structured-list/components/structered-list-item/structured-list-item.stories.ts +1 -0
- package/dist/assets/components/structured-list/components/structered-list-item/structured-list-item.vue +1 -0
- package/dist/assets/components/structured-list/structured-list.docs.mdx +68 -0
- package/dist/assets/components/structured-list/structured-list.stories.ts +1 -0
- package/dist/assets/components/structured-list/structured-list.vue +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item/summary-grid-item.vue +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item-amount/summary-grid-item-amount.stories.ts +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item-amount/summary-grid-item-amount.vue +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item-custom/summary-grid-item-custom.stories.ts +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item-custom/summary-grid-item-custom.vue +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item-numeric/summary-grid-item-numeric.stories.ts +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item-numeric/summary-grid-item-numeric.vue +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item-percentage/summary-grid-item-percentage.stories.ts +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item-percentage/summary-grid-item-percentage.vue +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item-text/summary-grid-item-text.stories.ts +1 -0
- package/dist/assets/components/summary-grid/components/summary-grid-item-text/summary-grid-item-text.vue +1 -0
- package/dist/assets/components/summary-grid/summary-grid.docs.mdx +152 -0
- package/dist/assets/components/summary-grid/summary-grid.stories.ts +1 -0
- package/dist/assets/components/summary-grid/summary-grid.vue +1 -0
- package/dist/assets/components/tabs/components/tab.vue +1 -0
- package/dist/assets/components/tabs/tabs.docs.mdx +98 -0
- package/dist/assets/components/tabs/tabs.stories.ts +1 -0
- package/dist/assets/components/tabs/tabs.vue +1 -0
- package/dist/assets/components/tag/tag.docs.mdx +137 -0
- package/dist/assets/components/tag/tag.stories.ts +1 -0
- package/dist/assets/components/tag/tag.vue +1 -0
- package/dist/assets/components/textarea/textarea.docs.mdx +53 -0
- package/dist/assets/components/textarea/textarea.stories.ts +1 -0
- package/dist/assets/components/textarea/textarea.vue +1 -0
- package/dist/assets/components/timeline/components/timeline-item/timeline-item.stories.ts +1 -0
- package/dist/assets/components/timeline/components/timeline-item/timeline-item.vue +1 -0
- package/dist/assets/components/timeline/timeline.docs.mdx +131 -0
- package/dist/assets/components/timeline/timeline.stories.ts +1 -0
- package/dist/assets/components/timeline/timeline.vue +1 -0
- package/dist/assets/components/toast/components/toast-item/toast-item.vue +1 -0
- package/dist/assets/components/toast/components/toast-shadow-stack/toast-shadow-stack.vue +1 -0
- package/dist/assets/components/toast/toast.docs.mdx +151 -0
- package/dist/assets/components/toast/toast.stories.ts +1 -0
- package/dist/assets/components/toast/toast.vue +1 -0
- package/dist/assets/components/toggle/toggle.docs.mdx +81 -0
- package/dist/assets/components/toggle/toggle.stories.ts +1 -0
- package/dist/assets/components/toggle/toggle.vue +1 -0
- package/dist/assets/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue +1 -0
- package/dist/assets/components/tutorial/components/tutorial-popover/tutorial-popover.vue +1 -0
- package/dist/assets/components/tutorial/tutorial.docs.mdx +85 -0
- package/dist/assets/components/tutorial/tutorial.stories.ts +1 -0
- package/dist/assets/components/tutorial/tutorial.vue +1 -0
- package/dist/assets/components/typography/typography.docs.mdx +124 -0
- package/dist/assets/components/typography/typography.stories.ts +1 -0
- package/dist/assets/components/typography/typography.vue +1 -0
- package/dist/assets/composables/use-bento-currency/use-bento-currency.docs.mdx +28 -0
- package/dist/assets/composables/use-bento-currency/use-bento-currency.stories.ts +1 -0
- package/dist/assets/composables/use-click-outside/use-click-outside.docs.mdx +10 -0
- package/dist/assets/composables/use-click-outside/use-click-outside.stories.ts +1 -0
- package/dist/assets/directives/highlight/highlight.docs.mdx +64 -0
- package/dist/assets/directives/highlight/highlight.stories.ts +1 -0
- package/dist/assets/directives/keyboard-navigation/keyboard-navigation.docs.mdx +41 -0
- package/dist/assets/directives/keyboard-navigation/keyboard-navigation.stories.ts +1 -0
- package/dist/assets/directives/tooltip/tooltip.docs.mdx +86 -0
- package/dist/assets/directives/tooltip/tooltip.stories.ts +1 -0
- package/dist/assets/index.ts +1 -0
- package/dist/assets/templates/dashboard-template/components/dashboard-section/dashboard-section.stories.ts +1 -0
- package/dist/assets/templates/dashboard-template/components/dashboard-section/dashboard-section.vue +1 -0
- package/dist/assets/templates/dashboard-template/dashboard-template.docs.mdx +148 -0
- package/dist/assets/templates/dashboard-template/dashboard-template.stories.ts +1 -0
- package/dist/assets/templates/dashboard-template/dashboard-template.vue +1 -0
- package/dist/assets/templates/data-grid-template/data-grid-template.docs.mdx +117 -0
- package/dist/assets/templates/data-grid-template/data-grid-template.stories.ts +1 -0
- package/dist/assets/templates/data-grid-template/data-grid-template.vue +1 -0
- package/dist/main.js +30031 -0
- package/package.json +45 -3
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Canvas, Meta, Story } from '@storybook/blocks';
|
|
2
|
+
import * as ButtonStories from './button.stories';
|
|
3
|
+
|
|
4
|
+
<Meta title="Docs" of={ButtonStories} />
|
|
5
|
+
|
|
6
|
+
# Button
|
|
7
|
+
|
|
8
|
+
<Canvas withSource="closed">
|
|
9
|
+
<Story of={ButtonStories.Default} />
|
|
10
|
+
</Canvas>
|
|
11
|
+
|
|
12
|
+
A button communicates possible actions. Use a button to trigger actions and are ideal for calling attention to where a
|
|
13
|
+
user needs to do something in order to move forward in a flow.
|
|
14
|
+
|
|
15
|
+
## Use Cases
|
|
16
|
+
|
|
17
|
+
Here are some examples:
|
|
18
|
+
|
|
19
|
+
- Submitting or moving onto the next step in a form wizard.
|
|
20
|
+
- Adding a new item to a data set.
|
|
21
|
+
|
|
22
|
+
### Do not use
|
|
23
|
+
|
|
24
|
+
Here are some "don't dos":
|
|
25
|
+
|
|
26
|
+
- Add custom HTML inside the button's `default` slot e.g. `<bento-button><strong>click me</hello></bento-button>`.
|
|
27
|
+
- Putting any elements other than icon components (from the `@adyen/ui-assets` package) in the `iconLeft` or `iconRight`
|
|
28
|
+
slots .
|
|
29
|
+
|
|
30
|
+
## Variations
|
|
31
|
+
|
|
32
|
+
### Primary
|
|
33
|
+
|
|
34
|
+
Primary button is used to highlight the main action on the page. A page can contain several types of buttons, but the
|
|
35
|
+
primary button focuses on indicating the main action of the entire page. The primary can only be used once in the page
|
|
36
|
+
and can’t be combined another primary button.
|
|
37
|
+
|
|
38
|
+
### Secondary
|
|
39
|
+
|
|
40
|
+
Secondary button should be used when the action is less important than the main action.. It’s also used when the user
|
|
41
|
+
has multiple options and all of them have the same importancy.
|
|
42
|
+
|
|
43
|
+
The secondary button should only be used when a primary button is present.
|
|
44
|
+
|
|
45
|
+
### Tertiary button
|
|
46
|
+
|
|
47
|
+
Tertiary button should be used for secondary action. It can be use when the action is recurring on the page or when is
|
|
48
|
+
linked to a group of elements like tables, card list, etc. The main difference between a Tertiary and a secondary button
|
|
49
|
+
is the visual aspect of it. In case the visual is too heavy with the use of more than one secondary button, a tertiary
|
|
50
|
+
button should be applied.
|
|
51
|
+
|
|
52
|
+
### Tertiary button with background
|
|
53
|
+
|
|
54
|
+
In situations where tertiary button is combined with toggle button, we recommend to use tertiary button with background,
|
|
55
|
+
which has the same padding and states as the toggle button.
|
|
56
|
+
|
|
57
|
+
## Modifiers
|
|
58
|
+
|
|
59
|
+
### Critical buttons
|
|
60
|
+
|
|
61
|
+
Critical buttons have same variations as the regular default buttons except that represent a critical action.
|
|
62
|
+
|
|
63
|
+
| Variation | Usage |
|
|
64
|
+
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
65
|
+
| Primary | when the primary action is a critical action the red variation can be applied. This scenario will only happen in case the button is a confirmation of a critical action. |
|
|
66
|
+
| Secondary | in case the critical action is a secondary action, the secondary red can be applied. Eg. when deleting an item is a possibility for the user, but it’s not the main action. |
|
|
67
|
+
| Tertiary | in case there many critical actions present or the call to action for this button is minimal. |
|
|
68
|
+
|
|
69
|
+
### Button with icon
|
|
70
|
+
|
|
71
|
+
<Canvas withSource="closed">
|
|
72
|
+
<Story of={ButtonStories.WithIcon} />
|
|
73
|
+
</Canvas>
|
|
74
|
+
|
|
75
|
+
Please use the @adyen/ui-assets-icons-16 NPM package for all icons.
|
|
76
|
+
|
|
77
|
+
All the buttons variation can be used combined with an icon. The combination of text and icon together should be use if
|
|
78
|
+
the icon adds value to the user interaction.
|
|
79
|
+
|
|
80
|
+
Icons can be used as standing alone button in case the icon is clear enough for the users that doesn’t need a support
|
|
81
|
+
text. In most of the cases, the icon button should receive a tooltip or aria label, otherwise it won’t be accessible.
|
|
82
|
+
|
|
83
|
+
When the icon is used in combination with text, the icon can be placed in either side of the text using the `iconLeft`
|
|
84
|
+
and `iconRight` slot.
|
|
85
|
+
|
|
86
|
+
### Condensed button
|
|
87
|
+
|
|
88
|
+
All the buttons variation can be used as a condensed button. They should be use in case you need an action on a table or
|
|
89
|
+
in case there is lack of space or too many information at the same place.
|
|
90
|
+
|
|
91
|
+
All the condensed button variations can be used combined with a icon respecting the same rules of the default button.
|
|
92
|
+
|
|
93
|
+
### Link button
|
|
94
|
+
|
|
95
|
+
<Canvas withSource="closed">
|
|
96
|
+
<Story of={ButtonStories.Link} />
|
|
97
|
+
</Canvas>
|
|
98
|
+
|
|
99
|
+
The button component can also be rendered as a link (i.e. using an anchor DOM element instead of a button DOM element).
|
|
100
|
+
To do this set the `link` property which will be forwarded onto the internal `BentoLink` component. To find out which
|
|
101
|
+
properties you can set see the [BentoLink story](?path=/docs/components-link--docs)).
|
|
102
|
+
|
|
103
|
+
## Inverse color set
|
|
104
|
+
|
|
105
|
+
All the button variants and modifiers can also be used with color set inverse. This is to be used when the button is
|
|
106
|
+
being applied on top of an element using `background.inverse.primary` instead of `background.primary`.
|
|
107
|
+
|
|
108
|
+
It will turn any button into its inverse color. For example, a button using `background.primary` as its
|
|
109
|
+
background-color, will now be set to `background.inverse.primary`.
|
|
110
|
+
|
|
111
|
+
## Accessibility
|
|
112
|
+
|
|
113
|
+
### Keyboard Interaction
|
|
114
|
+
|
|
115
|
+
Being an interactive element, the button is reachable through keyboard navigation in the logical navigation flow of the
|
|
116
|
+
page. The following keys trigger the following actions:
|
|
117
|
+
|
|
118
|
+
| Keyboard interaction | Action |
|
|
119
|
+
| -------------------- | ------------------------------------------------- |
|
|
120
|
+
| `Tab` | Moves focus to the button or away from it. |
|
|
121
|
+
| `Space` | Activates the button, triggering the click event. |
|
|
122
|
+
| `Enter` | Activates the button, triggering the click event. |
|
|
123
|
+
|
|
124
|
+
### Roles, States, and Properties
|
|
125
|
+
|
|
126
|
+
Adhering to the Adhering to the [WAI-ARIA 1.2 standard](https://www.w3.org/TR/wai-aria-1.2/) we follow the
|
|
127
|
+
[button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/#wai-ariaroles,states,andproperties) documentation
|
|
128
|
+
provided. we follow the button pattern documentation provided.
|
|
129
|
+
|
|
130
|
+
| ARIA attribute | is automatic? | fallback used | manual override |
|
|
131
|
+
| -------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------- |
|
|
132
|
+
| label | Yes, default slot text | If no slot text present e.g. icon only, then meaningful title must be provided in the `svg-title` property of the icon component. | - |
|
|
133
|
+
| role | Yes, semantic `button` element used | - | - |
|
|
134
|
+
|
|
135
|
+
## Resources
|
|
136
|
+
|
|
137
|
+
- [Figma link](https://www.figma.com/file/uLabwF3243jdMDsNSP7U9I/ADL-2.0---Components?node-id=1-9&t=otNdkreSYuLIZgud-0)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions'; import { BentoButtonVariant } from '@/components/button/button.types'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import type { Meta, StoryObj } from '@storybook/vue'; import { isVue2 } from 'vue-demi'; import CheckMark from '@adyen/ui-assets-icons-16/vue/checkmark-circle-fill'; import BentoButton from './button.vue'; const meta: Meta = { title: 'Button', component: BentoButton, argTypes: { variant: { options: Object.values(BentoButtonVariant), mapping: BentoButtonVariant, control: { type: 'select', }, }, default: { name: 'default', defaultValue: '', description: 'Button text', table: { type: { summary: 'VNode[]' }, }, control: { type: 'text', }, }, iconLeft: { name: 'iconLeft', defaultValue: '', description: 'Icon component', table: { type: { summary: 'VNode[]' }, }, control: { disable: true, }, }, iconRight: { name: 'iconRight', defaultValue: '', description: 'Icon component', table: { type: { summary: 'VNode[]' }, }, control: { disable: true, }, }, type: { options: ['button', 'submit', 'reset'], control: { type: 'select', }, }, // Events blur: { table: { type: { summary: '() => void' }, }, control: { disable: true }, }, click: { table: { type: { summary: '(event: MouseEvent) => void' }, }, control: { disable: true }, }, focus: { table: { type: { summary: '() => void' }, }, control: { disable: true }, }, 'keydown.esc': { table: { type: { summary: '() => void' }, }, control: { disable: true }, }, }, }; export default meta; type Story = StoryObj<typeof BentoButton>; const BUTTON_TEXT_DEFAULT = { default: 'Button', }; const DEFAULT_BUTTON_PROPS = { disabled: false, variant: 'primary', ...BUTTON_TEXT_DEFAULT, }; const defaultCode = ` <bento-button @click="clickedButtonAction"> ${BUTTON_TEXT_DEFAULT.default} </bento-button> `; export const Default: Story = { render: (_args, { argTypes }) => ({ components: { BentoButton }, props: Object.keys(argTypes), template: ` <bento-button v-bind="args" @click="clickedButtonAction" > {{args.default}} </bento-button> `, setup(props) { return { clickedButtonAction: action('onClick'), args: isVue2 ? props : _args, }; }, }), args: DEFAULT_BUTTON_PROPS, parameters: storybookDocsParameter(defaultCode), }; const ButtonWithIconTemplate = { render: (_args, { argTypes }) => ({ components: { BentoButton, CheckMark }, props: Object.keys(argTypes), template: ` <bento-button v-bind="args" @click="clickedButtonAction" > <template #iconLeft> <check-mark svg-title="checked" /> </template> {{args.default}} <template #iconRight> <check-mark svg-title="checked" /> </template> </bento-button> `, setup(props) { return { clickedButtonAction: action('onClick'), args: isVue2 ? props : _args, }; }, }), }; const WithIconCode = ` <bento-button @click="clickedButtonAction" > <template #iconLeft> <check-mark svg-title="checked" /> </template> ${BUTTON_TEXT_DEFAULT.default} <template #iconRight> <check-mark svg-title="checked" /> </template> </bento-button> `; export const WithIcon = { ...ButtonWithIconTemplate, args: DEFAULT_BUTTON_PROPS, parameters: storybookDocsParameter(WithIconCode), }; const OnlyIconTemplate = { render: (_args, { argTypes }) => ({ components: { BentoButton, CheckMark }, props: Object.keys(argTypes), template: ` <bento-button v-bind="args" @click="clickedButtonAction" > <template #iconLeft> <check-mark svg-title="check item" /> </template> </bento-button> `, setup(props) { return { clickedButtonAction: action('onClick'), args: isVue2 ? props : _args, }; }, }), }; export const OnlyIcon = { ...OnlyIconTemplate, argTypes: { default: { table: { disable: true } }, }, }; const LinkCode = ` <bento-button :link="{ to: 'https://adyen.com', external: true }"> {{${BUTTON_TEXT_DEFAULT.default}}} </bento-button> `; export const Link: Story = { render: (_args, { argTypes }) => ({ components: { BentoButton }, props: Object.keys(argTypes), template: ` <bento-button v-bind="args" @click="clickedButtonAction" > {{args.default}} </bento-button> `, setup(props) { return { clickedButtonAction: action('onClick'), args: isVue2 ? props : _args, }; }, }), args: { ...DEFAULT_BUTTON_PROPS, link: { to: '/' } }, parameters: storybookDocsParameter(LinkCode), };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template> <component :is="componentType" v-bind="componentProps" class="b-button" :class="{ ...conditionalClasses, ...getIconOnlyClass() }" @click.capture="onClickButton" > <span v-if="hasSlot('iconLeft')" class="b-button__icon-left" data-testid="icon-button-left" :aria-hidden="hasSlot('default') ? 'true' : null" > <slot name="iconLeft" /> </span> <bento-typography v-if="hasSlot('default')" el="span" variant="body" stronger class="b-button__label"> <slot /> </bento-typography> <span v-if="hasSlot('iconRight')" class="b-button__icon-right" data-testid="icon-button-right" :aria-hidden="hasSlot('default') ? 'true' : null" > <slot name="iconRight" /> </span> </component> </template> <script setup lang="ts"> import { computed, type PropType, useAttrs, useSlots } from 'vue'; import { BentoButtonPropClass, BentoButtonVariant } from './button.types'; import { BentoTypography } from '@/components/typography'; import { useHasSlot } from '@/composables/use-has-slot/use-has-slot'; import { type Booleanish } from '../../types/prop-types'; import type { RouterLinkProps } from 'vue-router/types/router.d.ts'; import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'vue/types/jsx.d.ts'; import { BentoLink, BentoLinkVariant } from '@/components/link'; // TODO: replace all this code when migrated to Vue 3 is complete as this is the only // current way to extend the `router-link` component in Vue 2 and Vue Router 3 export interface LinkProps extends RouterLinkProps, AnchorHTMLAttributes { args?: { props: RouterLinkProps }; /** * Set the rendered link to a regular external anchor link. */ external: boolean; } const props = defineProps({ /** * Reduces sizing of button */ condensed: { type: Boolean, default: false }, /** * Displays button as critical */ critical: { type: Boolean, default: false }, /** * Disables button functionality */ disabled: { type: Boolean, default: false }, /** * Sets color set to inverse */ inverse: { type: Boolean, default: false }, /** * Object containing props passed on to the BentoLink component. @see BentoLink documentation for which properties you can pass. */ link: { type: Object, default: undefined }, /** * The default behavior of the button. * Possible values are: 'button', 'reset', 'submit' */ type: { type: String as PropType<ButtonHTMLAttributes['type']>, default: 'button', }, /** * Types of flavour of Button * @values primary, secondary, tertiary, tertiary-with-background */ variant: { type: String as PropType<BentoButtonVariant | `${BentoButtonVariant}`>, default: BentoButtonVariant.PRIMARY, validator: (value: BentoButtonVariant) => Object.values(BentoButtonVariant).includes(value), }, }); const emit = defineEmits<{ /** * Emitted when the element has lost focus */ (e: 'blur'); /** * Emitted when the button is clicked */ (e: 'click', event: MouseEvent); /** * Emitted when the element has received focus */ (e: 'focus'); /** * Emitted when the "ESC" key is pressed */ (e: 'keydown.esc'); }>(); const attrs = useAttrs(); const slots = useSlots(); const hasSlot = useHasSlot(slots); const componentType = computed(() => { if (props?.link !== undefined) { /** * Display a "span" with role "link" and "aria-disabled=true" * if the link is disabled. * @link https://www.scottohara.me/blog/2021/05/28/disabled-links.html */ return props.disabled ? 'span' : BentoLink; } return 'button'; }); const ariaAttributes = computed(() => ({ 'aria-controls': attrs['aria-controls']?.toString() as string, 'aria-expanded': attrs['aria-expanded']?.toString() as Booleanish, })); const componentProps = computed(() => componentType.value === 'button' ? { ...ariaAttributes.value, disabled: props.disabled, type: props.type, } : { ...props.link, disableTypography: true, variant: BentoLinkVariant.DEFAULT, isButton: true, /** * When the button is a disabled link, it's rendered as a `<span>`. * These attributes ensure it's still announced as a disabled link by screen readers. */ 'aria-disabled': props.disabled ? 'true' : undefined, role: props.disabled ? 'link' : undefined, } ); const variantClass = computed(() => ({ [`b-button--${props.variant}${props.critical ? `-${BentoButtonPropClass.DESTRUCTIVE}` : ''}`]: true, })); const conditionalClasses = computed(() => ({ ...variantClass.value, [`b-button--${BentoButtonPropClass.CONDENSED}`]: props.condensed, [`b-button--${BentoButtonPropClass.DISABLED}`]: props.disabled, [`b-button--${BentoButtonPropClass.INVERSE}`]: props.inverse, })); const getIconOnlyClass = () => ({ [`b-button--${BentoButtonPropClass.ICON_ONLY}`]: !hasSlot('default'), }); const onClickButton = (e: MouseEvent) => { if (!props.disabled) { emit('click', e); } else { e.preventDefault(); e.stopPropagation(); } }; </script> <script lang="ts"> /** * Button component for all the various types of bento buttons. * * @example * import { BentoButton } from '@adyen/bento-vue2'; * import { CheckMarkIcon } from '@adyen/ui-assets-icons-16'; * * export default { * components: { BentoButton }, * template: ` * <bento-button * disabled * variant="secondary" * > * <template #iconLeft> * <check-mark svg-title="checked" /> * </template> * * Button text * * <template #iconRight> * <check-mark svg-title="checked" /> * </template> * </bento-button> * `, * } */ export default { name: 'bento-button', }; </script> <style lang="scss" scoped src="./button.scss" />
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Canvas, Meta } from '@storybook/blocks';
|
|
2
|
+
import * as AiButtonStories from './ai-button.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={AiButtonStories} />
|
|
5
|
+
|
|
6
|
+
# AI Button
|
|
7
|
+
|
|
8
|
+
The `bento-ai-button` is a specific variant of the `bento-button` used for actions related to Artificial Intelligence.
|
|
9
|
+
It includes a dedicated AI icon, animation and is styled as a secondary button to ensure consistency across different
|
|
10
|
+
features.
|
|
11
|
+
|
|
12
|
+
<Canvas of={AiButtonStories.Default} />
|
|
13
|
+
|
|
14
|
+
## Use Cases
|
|
15
|
+
|
|
16
|
+
Use this component whenever a user needs to trigger an action powered by AI, such as:
|
|
17
|
+
|
|
18
|
+
- Generating content.
|
|
19
|
+
- Summarizing text.
|
|
20
|
+
- Triggering an AI-based analysis.
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
The AI Button accepts a subset of the standard `bento-button` props. The `variant` is fixed to `secondary` and cannot be
|
|
25
|
+
changed. There is also no `critical` state available as AI should not be making critical actions.
|
|
26
|
+
|
|
27
|
+
## Accessibility
|
|
28
|
+
|
|
29
|
+
On top of already using the correct semantic elements for the buttons, the `bento-ai-button` follows all accessibility
|
|
30
|
+
guidelines of a standard button.
|
|
31
|
+
|
|
32
|
+
### Keyboard interaction
|
|
33
|
+
|
|
34
|
+
The button is reachable through keyboard navigation and follows the logical navigation flow of the page. A detailed list
|
|
35
|
+
of keyboard interactions is provided in the table below.
|
|
36
|
+
|
|
37
|
+
| Keyboard interaction | Output |
|
|
38
|
+
| -------------------- | ----------------------------------------------------- |
|
|
39
|
+
| `Tab` | Moves focus to the button or away from it. |
|
|
40
|
+
| `Space` or `Enter` | Activates the button where the focus is currently on. |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import BentoAiButton from './ai-button.vue'; import BentoAiButtonDefault from './__tests__/ai-button-default.vue?raw'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import { action } from '@storybook/addon-actions'; import { isVue2 } from 'vue-demi'; import { type Meta, type StoryObj } from '@storybook/vue'; export default { title: 'Button/AI Button', component: BentoAiButton, argTypes: { condensed: { control: { type: 'boolean', }, table: { type: { summary: 'boolean' }, }, }, default: { name: 'default', defaultValue: '', description: 'Button text', table: { type: { summary: 'VNode[]' }, }, control: { disable: true }, }, disabled: { control: { type: 'boolean', }, table: { type: { summary: 'boolean' }, }, }, inverse: { control: { type: 'boolean', }, table: { type: { summary: 'boolean' }, }, }, }, } as Meta; type Story = StoryObj<typeof BentoAiButton>; export const Default: Story = { render: (_args, { argTypes }) => ({ components: { BentoAiButton }, props: Object.keys(argTypes), template: ` <bento-ai-button @click="onClick" v-bind="args"> Generate with AI </bento-ai-button> `, setup(props) { return { args: isVue2 ? props : _args, onClick: action('click'), }; }, }), parameters: storybookDocsParameter(BentoAiButtonDefault), };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template> <div class="b-ai-button" :class="conditionalClass"> <div class="b-ai-button__animation" /> <bento-button class="b-ai-button__button" :condensed="condensed" :disabled="disabled" :inverse="inverse" variant="secondary" @click.capture.stop="onClick" > <template #iconLeft> <ai-filled-icon aria-hidden="true" class="b-ai-button__icon" /> </template> <slot></slot> </bento-button> </div> </template> <script setup lang="ts"> import { computed, onMounted, useSlots } from 'vue'; import BentoButton from '../../button.vue'; import AiFilledIcon from '@adyen/ui-assets-icons-16/vue/artificial-intelligence-ai-filled'; import { useHasSlot } from '@/composables/use-has-slot/use-has-slot'; import { printDevelopmentWarning } from '@/utils/ts/print-development-warning'; import { type BentoAiButtonProps } from './ai-button.types'; const props = withDefaults(defineProps<BentoAiButtonProps>(), { link: undefined, type: 'button', condensed: false, disabled: false, inverse: false, }); const emit = defineEmits<{ /** * Click event handler */ (e: 'click', event: MouseEvent): void; }>(); const slots = useSlots(); const hasSlot = useHasSlot(slots); const conditionalClass = computed(() => ({ 'b-ai-button--disabled': props.disabled, })); const onClick = (e: MouseEvent) => { // Prevent Vue3 from triggering event twice e.stopPropagation(); emit('click', e); }; onMounted(() => { if (!hasSlot('default')) { printDevelopmentWarning('An icon-only button cannot be a AI button'); } }); </script> <script lang="ts"> /** * AI Button component is used for cases where pressing a button starts an AI-related action. * * @example * import { BentoAiButton } from '@adyen/bento-vue2'; * * export default { * components: { BentoAiButton }, * template: ` * <bento-ai-button @click="onClick">Generate with AI</bento-ai-button> * ` * } */ export default { name: 'bento-ai-button', }; </script> <style lang="scss" scoped src="./ai-button.scss" />
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { Canvas, Meta, Source } from '@storybook/blocks';
|
|
2
|
+
import * as ButtonActionsStories from './button-actions.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={ButtonActionsStories} />
|
|
5
|
+
|
|
6
|
+
# Button Actions
|
|
7
|
+
|
|
8
|
+
<Canvas of={ButtonActionsStories.Default} />
|
|
9
|
+
|
|
10
|
+
The `bento-button-actions` component manages a set of actions a user can choose from by displaying a group of
|
|
11
|
+
`bento-buttons`.
|
|
12
|
+
|
|
13
|
+
## Use Cases
|
|
14
|
+
|
|
15
|
+
Use this component if:
|
|
16
|
+
|
|
17
|
+
- You have one or more actions that a user needs to perform.
|
|
18
|
+
- You have one primary action in the list of possible actions (in most cases, this would be a `create new` type of
|
|
19
|
+
action).
|
|
20
|
+
- You have a number of actions that ranges from 2 to 4.
|
|
21
|
+
|
|
22
|
+
### Do not use
|
|
23
|
+
|
|
24
|
+
Don't use the `bento-button-actions` if:
|
|
25
|
+
|
|
26
|
+
- You have more than one primary action.
|
|
27
|
+
- You have more than 3 or 4 actions in the group. In this case, consider if this is the right pattern and speak to you
|
|
28
|
+
product designer about it.
|
|
29
|
+
|
|
30
|
+
## Variations
|
|
31
|
+
|
|
32
|
+
### Actions
|
|
33
|
+
|
|
34
|
+
It's the set of actions that will be displayed in the group in the form of `bento-button`s. This set is an array of
|
|
35
|
+
`BentoButtonActionObject` objects, which means every element of the array will require the following fields to be
|
|
36
|
+
configured:
|
|
37
|
+
|
|
38
|
+
<Source
|
|
39
|
+
dark
|
|
40
|
+
language="typescript"
|
|
41
|
+
code={`
|
|
42
|
+
interface BentoButtonActionObject {
|
|
43
|
+
|
|
44
|
+
// Shared properties
|
|
45
|
+
title: string;
|
|
46
|
+
condensed?: boolean;
|
|
47
|
+
critical?: boolean;
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
elementRef?: Exclude<VNodeRef, string>;
|
|
50
|
+
icon?: VueComponent;
|
|
51
|
+
iconLeft?: VueComponent;
|
|
52
|
+
iconRight?: VueComponent;
|
|
53
|
+
inverse?: boolean;
|
|
54
|
+
link?: object;
|
|
55
|
+
type?: string;
|
|
56
|
+
variant?: BentoButtonVariant | \`\$\{BentoButtonVariant\}\`;
|
|
57
|
+
|
|
58
|
+
// Button properties
|
|
59
|
+
event?: (event: Event) => void;
|
|
60
|
+
iconOnly?: boolean;
|
|
61
|
+
state?: BentoLoadingButtonState | \`\$\{BentoLoadingButtonState\}\`;
|
|
62
|
+
|
|
63
|
+
// Menu properties (providing 'data' will render a menu instead of a button)
|
|
64
|
+
closeMenuOnItemSelect?: boolean;
|
|
65
|
+
closeOnClickOutsideOptions?: object;
|
|
66
|
+
data?: BentoMenuItem[];
|
|
67
|
+
disableArrowDownOpeningMenu?: boolean;
|
|
68
|
+
menuFixedPositioning?: boolean;
|
|
69
|
+
menuPosition?: BentoPopoverPositions | \`\$\{BentoPopoverPositions\}\`;
|
|
70
|
+
menuWidth?: number;
|
|
71
|
+
revertFocusToButton?: boolean;
|
|
72
|
+
teleport?: boolean;
|
|
73
|
+
|
|
74
|
+
}`}/>
|
|
75
|
+
|
|
76
|
+
- `title`: the button's text.
|
|
77
|
+
- `condensed` (optional): condensed button.
|
|
78
|
+
- `critical` (optional): the button's red border and color.
|
|
79
|
+
- `disabled` (optional): the button renders as disabled.
|
|
80
|
+
- `elementRef` (optional): provides a template ref to the underlying component instance
|
|
81
|
+
- `event` (optional): the button's event handler).
|
|
82
|
+
- `icon` (optional): the button's icon.
|
|
83
|
+
- `iconLeft` (optional): the button's left icon.
|
|
84
|
+
- `iconRight` (optional): the button's right icon.
|
|
85
|
+
- `iconOnly` (optional): renders the button as iconOnly.
|
|
86
|
+
- `inverse` (optional): the button's color to inverse.
|
|
87
|
+
- `link` (optional): the button's [link](../?path=/docs/components-link--docs#variations) properties.
|
|
88
|
+
- `state` (optional): the button's [loading state](../?path=/docs/components-button-loading-button--docs#state).
|
|
89
|
+
- `type` (optional): HTML
|
|
90
|
+
[button element type](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/type).
|
|
91
|
+
- `variant` (optional): the button's variant background color.
|
|
92
|
+
- See [menu](../?path=/story/components-menu--default) for the menu properties
|
|
93
|
+
|
|
94
|
+
#### Styling Guidelines
|
|
95
|
+
|
|
96
|
+
As a developer, you should rely on these patterns of `bento-button-actions` styling:
|
|
97
|
+
|
|
98
|
+
- 1-st button PRIMARY, all others - SECONDARY: is applicable in the majority of cases
|
|
99
|
+
- 1-st button CRITICAL, all others - SECONDARY: a destructive pattern that is applicable in user's more urgent attention
|
|
100
|
+
|
|
101
|
+
Keep in mind that `bento-button-actions` is a component that is reused in multiple other components in different
|
|
102
|
+
configurations (meaning some of it options can be restricted for use in some components).
|
|
103
|
+
|
|
104
|
+
The final available configuration is always dictated by the component in which action-buttons is used.
|
|
105
|
+
|
|
106
|
+
Please, NEVER use action-buttons configurations that are not available on the component in which action-buttons is used.
|
|
107
|
+
If you have a strong need > please reach Bento team first to get a guidance from designer.
|
|
108
|
+
|
|
109
|
+
### Critical
|
|
110
|
+
|
|
111
|
+
<Canvas of={ButtonActionsStories.Critical} />
|
|
112
|
+
|
|
113
|
+
### With Link
|
|
114
|
+
|
|
115
|
+
<Canvas of={ButtonActionsStories.WithLink} />
|
|
116
|
+
|
|
117
|
+
### With loading button
|
|
118
|
+
|
|
119
|
+
<Canvas of={ButtonActionsStories.WithLoadingButton} />
|
|
120
|
+
|
|
121
|
+
### With menu button
|
|
122
|
+
|
|
123
|
+
The `actions` prop also accepts arguments from the `bento-menu` component. This allows you to render a menu component
|
|
124
|
+
instead of a button for a given action. Check the example below for more details.
|
|
125
|
+
|
|
126
|
+
<Canvas of={ButtonActionsStories.WithMenu} />
|
|
127
|
+
|
|
128
|
+
## Modifiers
|
|
129
|
+
|
|
130
|
+
### Layout
|
|
131
|
+
|
|
132
|
+
It's the spatial disposition of the button group. This property can take the following values:
|
|
133
|
+
|
|
134
|
+
- `'buttons-end'`: aligns the buttons to the right side of the container.
|
|
135
|
+
- `'fill-container'`: stretches the buttons to fill the container's space.
|
|
136
|
+
- `'space-between'`: spaces the buttons evenly to fill in the container's width without stretching them.
|
|
137
|
+
- `'vertical-stack'`: stack the buttons vertically one on top of the other.
|
|
138
|
+
|
|
139
|
+
## Inverse color set
|
|
140
|
+
|
|
141
|
+
Button actions can also be used with color set inverse. This is to be used when the buttons are being applied on top of
|
|
142
|
+
an element using `background.inverse.primary` instead of `background.primary`.
|
|
143
|
+
|
|
144
|
+
It will turn **ALL** buttons in the group to its inverse color.
|
|
145
|
+
|
|
146
|
+
## Accessibility
|
|
147
|
+
|
|
148
|
+
On top of already using the correct semantic elements for the buttons, the `bento-button-actions` component used the
|
|
149
|
+
ARIA `group` role to form a logical collection between items with related functionality.
|
|
150
|
+
|
|
151
|
+
### Keyboard interaction
|
|
152
|
+
|
|
153
|
+
The button actions component is reachable through keyboard navigation and follows logical navigation flow of the page. A
|
|
154
|
+
detailed list of keyboard interactions is provided in the table below.
|
|
155
|
+
|
|
156
|
+
| Keyboard interaction | Output |
|
|
157
|
+
| -------------------- | --------------------------------------------------------------- |
|
|
158
|
+
| `Tab` | Moves focus to the various buttons in the list or away from it. |
|
|
159
|
+
| `Space` | Activates the button where the focus is currently on. |
|
|
160
|
+
|
|
161
|
+
### Roles, states and properties
|
|
162
|
+
|
|
163
|
+
| ARIA attribute | is automatic? | fallback used | manual override |
|
|
164
|
+
| -------------- | ------------------------------------------------------------------------------------------------- | ------------- | --------------- |
|
|
165
|
+
| `role` | Yes, corresponds to `group` value and indicates that the items are related and form a collection. | - | - |
|
|
166
|
+
|
|
167
|
+
## Resources
|
|
168
|
+
|
|
169
|
+
-[ARIA group role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/group_role)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions'; import { BentoButtonActionsLayout } from '@/components/button'; import ButtonActionsWithMenu from './__tests__/button-actions-with-menu.vue?raw'; import { isVue2 } from 'vue-demi'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import { type Meta, type StoryObj } from '@storybook/vue'; import BentoButtonActions from './button-actions.vue'; import MachineLearningIcon from '@adyen/ui-assets-icons-16/vue/machine-learning'; import type { BentoButtonActionsList } from './button-actions.types'; export default { title: 'Button/Button Actions', component: BentoButtonActions, argTypes: { layout: { options: Object.values(BentoButtonActionsLayout), mapping: BentoButtonActionsLayout, control: { type: 'select', }, }, }, } as Meta; type Story = StoryObj<typeof BentoButtonActions>; const defaultCode = ` <script setup lang="ts"> import MachineLearningIcon from '@adyen/ui-assets-icons-16/vue/machine-learning'; </script> <template> <bento-button-actions :actions="[{ title: 'Primary', event: clickedAction, icon: MachineLearningIcon, }, { title: 'Secondary', event: clickedAction, }, { title: 'Tertiary', event: clickedAction, }]" /> </template> `; export const Default: Story = { render: (_args, { argTypes }) => ({ components: { BentoButtonActions, MachineLearningIcon }, props: Object.keys(argTypes), template: ` <bento-button-actions v-bind="args" :actions="[{ title: 'Primary', event: clickedAction, icon: icon, }, { title: 'Secondary', event: clickedAction, }, { title: 'Tertiary', event: clickedAction, }]" > </bento-button-actions> `, setup(props) { const icon = MachineLearningIcon; return { args: isVue2 ? props : _args, clickedAction: action('input'), icon, }; }, }), parameters: storybookDocsParameter(defaultCode), }; export const Critical = { render: (_args, { argTypes }) => ({ components: { BentoButtonActions, MachineLearningIcon }, props: Object.keys(argTypes), template: ` <bento-button-actions v-bind="args" :actions="[{ title: 'Primary', critical: true, event: clickedAction, icon: args.icon, }, { title: 'Secondary', event: clickedAction, }]" > </bento-button-actions> `, setup(props) { return { args: isVue2 ? props : _args, clickedAction: action('input'), }; }, }), }; const withLinkCode = ` <script setup lang="ts"> import MachineLearningIcon from '@adyen/ui-assets-icons-16/vue/machine-learning'; </script> <template> <bento-button-actions :actions="[{ title: 'Primary', event: clickedAction, icon: MachineLearningIcon, }, { title: 'Secondary', event: clickedAction, link: { variant: 'default', external: true, to: 'https://www.adyen.com/' }, }, { title: 'Tertiary', event: clickedAction, }]" /> </template> `; export const WithLink: Story = { render: (_args, { argTypes }) => ({ components: { BentoButtonActions, MachineLearningIcon }, props: Object.keys(argTypes), template: ` <bento-button-actions v-bind="args" :actions="[{ title: 'Primary', event: clickedAction, icon: icon, }, { title: 'Secondary (a link)', event: clickedAction, link: { variant: 'default', external: true, to: 'https://www.adyen.com/' }, }, { title: 'Tertiary', event: clickedAction, }]" > </bento-button-actions> `, setup(props) { const icon = MachineLearningIcon; return { args: isVue2 ? props : _args, clickedAction: action('input'), icon, }; }, }), parameters: storybookDocsParameter(withLinkCode), }; const withLoadingButtonCode = ` <template> <bento-button-actions :actions="[ { title: 'Loading Button', event: loadingClickAction, state: 'loading', icon, }, { title: 'Secondary', event: secondaryClickAction, state: 'start', icon, }, ]" /> </template> `; export const WithLoadingButton: Story = { render: (_args, { argTypes }) => ({ components: { BentoButtonActions, MachineLearningIcon }, props: Object.keys(argTypes), template: ` <bento-button-actions v-bind="args" :actions="[ { title: 'Loading Button', event: clickedAction, state: 'loading', icon, }, { title: 'Secondary', event: clickedAction, state: 'start', icon, }, ]" /> `, setup(props) { const icon = MachineLearningIcon; return { args: isVue2 ? props : _args, clickedAction: action('input'), icon, }; }, }), parameters: storybookDocsParameter(withLoadingButtonCode), }; export const WithMenu: Story = { render: (_args, { argTypes }) => ({ components: { BentoButtonActions }, props: Object.keys(argTypes), template: ` <bento-button-actions v-bind="args" /> `, setup(props) { return { args: isVue2 ? props : _args, }; }, }), args: { actions: [ { title: 'Primary', event: () => true, }, { title: 'Secondary', event: () => true, }, { title: 'Tertiary', event: () => true, disabled: true, }, { title: 'Menu', data: [ { text: 'Item 1', secondaryText: 'Text', handler: () => true, critical: true, }, { text: 'Item 2', secondaryText: 'Text', handler: () => true, }, ], }, ] satisfies BentoButtonActionsList, }, parameters: storybookDocsParameter(ButtonActionsWithMenu), };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template> <div ref="buttonActions" class="b-button-actions"> <div class="b-button-actions__container-wrapper" :class="conditionalClasses" role="group"> <div v-for="(button, index) in reversedActionsList" :key="index" ref="buttons" class="b-button-actions__button-wrapper" > <template v-if="button.data"> <bento-menu :ref="button.elementRef" :data="button.data" :close-menu-on-item-select="button.closeMenuOnItemSelect" :close-on-click-outside-options="button.closeOnClickOutsideOptions" :disable-arrow-down-opening-menu="button.disableArrowDownOpeningMenu" :menu-position="button.menuPosition" :menu-fixed-positioning="button.menuFixedPositioning" :menu-width="button.menuWidth" :revert-focus-to-button="button.revertFocusToButton" :teleport="button.teleport" > <template v-if="button.icon || button.iconLeft" #iconLeft> <component :is="button.icon || button.iconLeft" :svg-title="button.title"></component> </template> <template v-if="!isIconOnly(button)" #default> {{ button.title }} </template> </bento-menu> </template> <template v-else> <bento-loading-button v-if="button.state" :ref="button.elementRef" :condensed="button.condensed" :critical="button.critical" :disabled="button.disabled" :inverse="inverse" :state="button.state" :variant="button.variant || generateButtonVariantByIndex(index)" v-on="generateButtonEvents(button)" > <template v-if="button.icon || button.iconLeft" #iconLeft> <component :is="button.icon || button.iconLeft" :svg-title="button.title"></component> </template> <template v-if="!isIconOnly(button)" #default> {{ button.title }} </template> </bento-loading-button> <bento-button v-else :ref="button.elementRef" :condensed="button.condensed" :critical="button.critical" :disabled="button.disabled" :inverse="inverse" :link="button.link" :variant="button.variant || generateButtonVariantByIndex(index)" v-on="generateButtonEvents(button)" > <template v-if="button.icon || button.iconLeft" #iconLeft> <component :is="button.icon || button.iconLeft" :svg-title="button.title"></component> </template> <template v-if="!isIconOnly(button)" #default> {{ button.title }} </template> <template v-if="button.iconRight" #iconRight> <component :is="button.iconRight" :svg-title="button.title"></component> </template> </bento-button> </template> </div> </div> </div> </template> <script setup lang="ts"> import { computed, ref, toRef } from 'vue'; import BentoButton from '../../button.vue'; import type { BentoActionButton, BentoButtonActionsProps } from './button-actions.types'; import BentoLoadingButton from '../loading-button/loading-button.vue'; import BentoMenu from '@/components/menu/menu.vue'; import { useStackButtons } from './composables/use-stack-buttons/use-stack-buttons'; const props = withDefaults(defineProps<BentoButtonActionsProps>(), { inverse: false, layout: 'buttons-end', }); const buttonActions = ref<HTMLDivElement>(null); const buttons = ref<Array<HTMLDivElement>>(null); const stackButtons = useStackButtons(buttonActions, buttons, toRef(props, 'actions')); const reversedActionsList = computed(() => props.actions.slice().reverse()); const generateButtonVariantByIndex = actionIndex => { const lastActionIndex = props.actions.length - 1; return actionIndex === lastActionIndex ? 'primary' : 'secondary'; }; const conditionalClasses = computed(() => ({ [`b-button-actions--${props.layout}`]: true, [`b-button-actions--stacked-buttons`]: stackButtons.value, })); const generateButtonEvents = (button: BentoActionButton) => button?.event !== undefined ? { click: button.event, } : {}; const isIconOnly = (button: BentoActionButton) => button.iconOnly && (button.iconLeft || button.iconRight || button.icon); </script> <script lang="ts"> /** * ButtonActions component manages a set of actions a user can choose from by displaying a group of buttons. * * @example * import { BentoButtonActions } from '@adyen/bento-vue2'; * import MachineLearningIcon from '@adyen/ui-assets-icons-16/vue/machine-learning'; * * const clickedAction = () => { //your action here } * * <template> * <bento-button-actions * :actions="[{ * title: 'Primary', * event: clickedAction, * icon: MachineLearningIcon, * }, { * title: 'Secondary', * event: clickedAction, * }, { * title: 'Tertiary', * event: clickedAction, * }]" * /> * </template> */ export default {}; </script> <style lang="scss" scoped src="./button-actions.scss" />
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Canvas, Story, Meta } from '@storybook/blocks';
|
|
2
|
+
import * as LoadingButtonStories from './loading-button.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={LoadingButtonStories} />
|
|
5
|
+
|
|
6
|
+
# Loading Button
|
|
7
|
+
|
|
8
|
+
<Canvas withSource="closed">
|
|
9
|
+
<Story of={LoadingButtonStories.Default} />
|
|
10
|
+
</Canvas>
|
|
11
|
+
|
|
12
|
+
A loading button is used for cases where pressing a button starts an event that requires a loading state. This is then
|
|
13
|
+
displayed by a small variant of `bento-loading-indicator` and it can result in either a success or fail state.
|
|
14
|
+
|
|
15
|
+
## Use cases
|
|
16
|
+
|
|
17
|
+
Use a `bento-loading-button` when you have any sort of asynchronous action and are waiting for a response.
|
|
18
|
+
|
|
19
|
+
Note that both the states of the button (`start`, `loading`, `success` or `fail`) and its text need to be updated
|
|
20
|
+
manually based on the state of the action you are waiting upon. For example, let's say clicking on this button would
|
|
21
|
+
trigger a `POST` request:
|
|
22
|
+
|
|
23
|
+
- Before the user clicks on the button, this will be shown initially in a `start` state.
|
|
24
|
+
- Once the user clicks on the button, the `POST` request is triggered and the button's state has to be changed to
|
|
25
|
+
`loading` and have a matching text of your liking to represent that state. At this point the button will be rendered
|
|
26
|
+
as disabled and will not trigger any actions on click.
|
|
27
|
+
- Once a response from the request is received, the loading button state has to be updated and its text updated
|
|
28
|
+
accordingly:
|
|
29
|
+
- If the request was successful a `success` state has to be set with a corresponding text that marks success.
|
|
30
|
+
- Otherwise a `fail` state needs to be set with a corresponding text that indicates failure and tells the user
|
|
31
|
+
they can retry the action if the button is clicked again.
|
|
32
|
+
- In these two final states the button will be clickable again, for retrying on `fail` or doing any other action on
|
|
33
|
+
`success`.
|
|
34
|
+
|
|
35
|
+
## Variations
|
|
36
|
+
|
|
37
|
+
### State
|
|
38
|
+
|
|
39
|
+
This property represents the state of the button and is of type `BentoLoadingButtonState`, which can take up one of the
|
|
40
|
+
following values:
|
|
41
|
+
|
|
42
|
+
- `BentoLoadingButtonState.START`: the initial state of the button, this state represents a button that has not
|
|
43
|
+
triggered any action yet.
|
|
44
|
+
- `BentoLoadingButtonState.LOADING`: the state of the button that represents an action in process, during this state
|
|
45
|
+
the button click events will not be emitted.
|
|
46
|
+
- `BentoLoadingButtonState.SUCCESS`: the state of the button that represents that an action has been completed
|
|
47
|
+
successfully.
|
|
48
|
+
- `BentoLoadingButtonState.FAIL`: the state of the button that represents that an action has been completed
|
|
49
|
+
unsuccessfully.
|
|
50
|
+
|
|
51
|
+
### Variant
|
|
52
|
+
|
|
53
|
+
This property represent the variant referenced in the `bento-button` component. It is one of the following values:
|
|
54
|
+
|
|
55
|
+
- `'primary'`: renders the `bento-loading-button` in the primary variant.
|
|
56
|
+
- `'secondary'`: renders the `bento-loading-button` in the secondary variant.
|
|
57
|
+
- `'tertiary'`: renders the `bento-loading-button` in the tertiary variant.
|
|
58
|
+
|
|
59
|
+
## Slots
|
|
60
|
+
|
|
61
|
+
### Icon
|
|
62
|
+
|
|
63
|
+
You can pass an icon to the `bento-loading-button` the same way you do to `bento-button`, by using the `iconLeft` slot.
|
|
64
|
+
However, the icon will only show in the `start` state, being replaced by the loading button respective icons in the
|
|
65
|
+
other states.
|
|
66
|
+
|
|
67
|
+
## Modifiers
|
|
68
|
+
|
|
69
|
+
### Disabled
|
|
70
|
+
|
|
71
|
+
This property represents the loading button in a disabled state.
|
|
72
|
+
|
|
73
|
+
### Condensed
|
|
74
|
+
|
|
75
|
+
This property represents the loading button in a smaller size. This version should only be used in data-dense spaces
|
|
76
|
+
where a regular-size button would be too big (e.g. inside of tables and data grids).
|
|
77
|
+
|
|
78
|
+
## Accessibility
|
|
79
|
+
|
|
80
|
+
Being implemented by leveraging the `bento-button`, the loading button provides out of the box all of the accessibility
|
|
81
|
+
features already present in the `bento-button`.
|
|
82
|
+
|
|
83
|
+
### Keyboard navigation
|
|
84
|
+
|
|
85
|
+
The loading button is reachable through keyboard navigation and is placed in the logical navigation flow of the page.
|
|
86
|
+
The following keys trigger the following actions:
|
|
87
|
+
|
|
88
|
+
| Keyboard interaction | Action |
|
|
89
|
+
| -------------------- | ------------------------------------------------- |
|
|
90
|
+
| `Tab` | Moves focus to the button or away from it. |
|
|
91
|
+
| `Space` | Activates the button, triggering the click event. |
|
|
92
|
+
| `Enter` | Activates the button, triggering the click event. |
|
|
93
|
+
|
|
94
|
+
### Roles, States, and Properties
|
|
95
|
+
|
|
96
|
+
The roles, states and properties set adhering to the [WAI-ARIA 1.2](https://www.w3.org/TR/wai-aria-1.2/) standard on
|
|
97
|
+
this component are as follows:
|
|
98
|
+
|
|
99
|
+
| ARIA attribute | is automatic? | fallback used | manual override |
|
|
100
|
+
| -------------- | ------------------------------------ | ------------- | --------------- |
|
|
101
|
+
| `aria-label` | Yes, default slot text. | - | - |
|
|
102
|
+
| `role` | Yes, semantic `button` element used. | - | - |
|
|
103
|
+
|
|
104
|
+
Resources:
|
|
105
|
+
|
|
106
|
+
- [Figma link](https://www.figma.com/file/uLabwF3243jdMDsNSP7U9I/Bento---Components?node-id=1901-27998&t=NHLd9msx8lGq3NNF-0)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ref, watch } from 'vue'; import { action } from '@storybook/addon-actions'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import { BentoButtonVariant } from '@/components/button'; import { computed, isVue2 } from 'vue-demi'; import { type Meta, type StoryObj } from '@storybook/vue'; import BentoLoadingButton from './loading-button.vue'; import DownloadIcon from '@adyen/ui-assets-icons-16/vue/download'; export default { title: 'Button/Loading Button', component: BentoLoadingButton, argTypes: { condensed: { control: { type: 'boolean', }, table: { type: { summary: 'boolean' }, }, }, critical: { control: { type: 'boolean', }, table: { type: { summary: 'boolean' }, }, }, default: { name: 'default', defaultValue: '', description: 'Button text', table: { type: { summary: 'VNode[]' }, }, control: { disable: true }, }, disabled: { control: { type: 'boolean', }, table: { type: { summary: 'boolean' }, }, }, state: { control: { type: 'select', }, table: { type: { summary: 'BentoLoadingButtonState: start, loading, success, fail', }, }, }, variant: { options: Object.values(BentoButtonVariant), control: { type: 'select', }, table: { type: { summary: `BentoButtonVariant: ${Object.values(BentoButtonVariant)}` }, }, }, }, } as Meta; type Story = StoryObj<typeof BentoLoadingButton>; const BUTTON_TEXT = { start: 'Button', loading: 'Loading', success: 'Success', fail: 'Retry', }; const defaultCode = ` <bento-loading-button state="loading" :variant="primary" @input="() => {}" > Loading </bento-loading-button> `; export const Default: Story = { render: (_args, { argTypes }) => ({ components: { BentoLoadingButton }, props: Object.keys(argTypes), template: ` <bento-loading-button v-bind="args" @click="clickedButtonAction"> {{ loadingButtonText }} </bento-loading-button> `, setup(props) { const args = isVue2 ? props : _args; const loadingButtonText = computed(() => BUTTON_TEXT[args.state]); return { clickedButtonAction: action('click'), loadingButtonText, args, }; }, }), args: { state: 'loading', variant: 'primary', }, parameters: storybookDocsParameter(defaultCode), }; const withIconCode = ` <bento-loading-button state="start" :variant="primary" @click="() => {}" > <template #iconLeft> <download-icon /> </template> Download </bento-loading-button> `; export const WithIcon: Story = { render: (_args, { argTypes }) => ({ components: { BentoLoadingButton, DownloadIcon }, props: Object.keys(argTypes), template: ` <bento-loading-button v-bind="args" @click="downloadAction" :state="loadingState"> <template #iconLeft> <download-icon /> </template> Download </bento-loading-button> `, setup(props) { const args = isVue2 ? props : _args; const loadingState = ref(args.state); const downloadAction = () => { loadingState.value = 'loading'; setTimeout(() => { loadingState.value = Math.random() < 0.5 ? 'success' : 'fail'; }, 1000); }; watch( () => args.state, () => { loadingState.value = args.state; } ); return { downloadAction, loadingState, args, }; }, }), args: { variant: 'primary', state: 'start', }, parameters: storybookDocsParameter(withIconCode), };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template> <bento-button :critical="isCritical" :variant="variant" :condensed="condensed" :disabled="disabled" :inverse="inverse" class="b-loading-button" :class="conditionalClasses" @click.capture.stop="onClick" > <slot></slot> <template v-if="state === 'start' && hasSlot('iconLeft')" #iconLeft> <slot name="iconLeft"></slot> </template> <template v-else-if="state !== 'start'" #iconLeft> <span class="b-loading-button__icon" data-testid="loading-button-rotating-icon"> <cross v-if="state === 'fail'" :svg-title="t('failed')" /> <checkmark v-else-if="state === 'success'" :svg-title="t('succeded')" /> <!-- TODO: Replace with new loading-indicator component --> <bento-loading-indicator v-else-if="state === 'loading'" small :inverse="isInverseLoadingIndicator" /> </span> </template> </bento-button> </template> <script setup lang="ts"> import { computed, type PropType, useSlots } from 'vue'; import { BentoLoadingButtonState } from './loading-button.types'; import { BentoLoadingIndicator } from '@/components/loading-indicator'; import BentoButton from '@/components/button/button.vue'; import Cross from '@adyen/ui-assets-icons-16/vue/cross-circle-fill'; import Checkmark from '@adyen/ui-assets-icons-16/vue/checkmark-circle-fill'; import { useHasSlot } from '@/composables/use-has-slot/use-has-slot'; import { useI18n } from '@/utils/ts/i18n'; import messages from './messages.json'; type MessageSchema = (typeof messages)['en-US']; const props = defineProps({ /** * Reduces sizing of button */ condensed: { type: BentoButton.props.condensed.type, default: false, }, /** * Displays loading-button as critical */ critical: { type: BentoButton.props.critical.type, default: false, }, /** * Disables button functonality */ disabled: { type: BentoButton.props.disabled.type, default: false, }, /** * Sets color set to inverse */ inverse: { type: Boolean, default: false, }, /** * State of the button. * @values start, loading, success, fail */ state: { type: String as PropType<BentoLoadingButtonState | `${BentoLoadingButtonState}`>, default: BentoLoadingButtonState.START, validator: (value: BentoLoadingButtonState) => Object.values(BentoLoadingButtonState).includes(value), }, /** * Types of flavour of Button */ variant: { type: BentoButton.props.variant.type, default: 'primary', validator: BentoButton.props.variant.validator, }, }); const emit = defineEmits<{ /** * Click event handler */ (e: 'click', event: MouseEvent): void; }>(); const slots = useSlots(); const hasSlot = useHasSlot(slots); const { t } = useI18n<{ message: MessageSchema }>({ messages }); const conditionalClasses = computed(() => ({ [`b-loading-button--${props.variant}-${BentoLoadingButtonState.LOADING}`]: props.state === BentoLoadingButtonState.LOADING && !props.disabled, 'b-loading-button--loading': props.state === BentoLoadingButtonState.LOADING && !props.disabled, [`b-loading-button--${props.variant}-${BentoLoadingButtonState.SUCCESS}`]: props.state === BentoLoadingButtonState.SUCCESS, [`b-loading-button--inverse`]: props.inverse, })); const isInverseLoadingIndicator = computed( () => (props.variant === 'primary' && !props.inverse) || (props.variant !== 'primary' && props.inverse) ); const isCritical = computed( () => (props.critical && props.state === BentoLoadingButtonState.START) || props.state === BentoLoadingButtonState.FAIL ); const onClick = (e: MouseEvent) => { // Prevent Vue3 from triggering event twice e.stopPropagation(); if (props.state !== BentoLoadingButtonState.LOADING) { emit('click', e); } }; </script> <script lang="ts"> /** * Loading Button component is used for cases where pressing a button starts an event that requires a loading state, e.g. when you have any sort of asynchronous action and are waiting for a response * * @example * import { BentoLoadingButton } from '@adyen/bento-vue2'; * * export default { * components: { BentoLoadingButton }, * template: ` * <bento-loading-button state="loading" variant="secondary"> * Loading * </bento-loading button> * ` * } */ export default { i18n: { messages }, }; </script> <style lang="scss" scoped src="./loading-button.scss" />
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Canvas, Story, Meta } from '@storybook/blocks';
|
|
2
|
+
import * as ToggleButtonStories from './toggle-button.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={ToggleButtonStories} />
|
|
5
|
+
|
|
6
|
+
# Toggle Button
|
|
7
|
+
|
|
8
|
+
<Canvas withSource="closed">
|
|
9
|
+
<Story of={ToggleButtonStories.Default} />
|
|
10
|
+
</Canvas>
|
|
11
|
+
|
|
12
|
+
Toggle button is used to switch between two states (example: menu shown, menu hidden). It functions as a regular button
|
|
13
|
+
but retains its state to indicate whether the associated menu or element is active or inactive.
|
|
14
|
+
|
|
15
|
+
## Use Cases
|
|
16
|
+
|
|
17
|
+
Use this component when you need to provide a way for user to show/hide menus or additional content.
|
|
18
|
+
|
|
19
|
+
### Do not use
|
|
20
|
+
|
|
21
|
+
- Don't use for controlling a setting or preference (use toggle instead).
|
|
22
|
+
- Don't use when the state change does not need to be visually indicated.
|
|
23
|
+
- Don't use for any form of selection (use radio button or dropdown instead).
|
|
24
|
+
|
|
25
|
+
## Variations
|
|
26
|
+
|
|
27
|
+
### Toggled
|
|
28
|
+
|
|
29
|
+
This property can be used to set the toggled state of the button programatically. You can use this in combination with
|
|
30
|
+
the `update:toggled` emit event to sync the toggled state using the
|
|
31
|
+
[sync modifier](https://v2.vuejs.org/v2/guide/components-custom-events.html#sync-Modifier) (in vue 2) or using `v-model`
|
|
32
|
+
(in vue 3)
|
|
33
|
+
|
|
34
|
+
### Variant
|
|
35
|
+
|
|
36
|
+
This property represent the variant referenced in the `bento-button` component. It is one of the following values:
|
|
37
|
+
|
|
38
|
+
- `'primary'`: renders the `bento-toggle-button` in the primary variant.
|
|
39
|
+
- `'secondary'`: renders the `bento-toggle-button` in the secondary variant.
|
|
40
|
+
- `'tertiary'`: renders the `bento-toggle-button` in the tertiary variant.
|
|
41
|
+
|
|
42
|
+
## Modifiers
|
|
43
|
+
|
|
44
|
+
### Disabled
|
|
45
|
+
|
|
46
|
+
This property disables the button from being toggled and emit any events.
|
|
47
|
+
|
|
48
|
+
### Condensed
|
|
49
|
+
|
|
50
|
+
This property represents the toggle button in a smaller size. This version should only be used in data-dense spaces
|
|
51
|
+
where a regular-size button would be too big (e.g. inside of tables and data grids).
|
|
52
|
+
|
|
53
|
+
## Accessibility
|
|
54
|
+
|
|
55
|
+
Being implemented by leveraging the `bento-button`, the toggle button provides out of the box all of the accessibility
|
|
56
|
+
features already present in the `bento-button`.
|
|
57
|
+
|
|
58
|
+
### Keyboard navigation
|
|
59
|
+
|
|
60
|
+
The toggle button is reachable through keyboard navigation and is placed in the logical navigation flow of the page. The
|
|
61
|
+
following keys trigger the following actions:
|
|
62
|
+
|
|
63
|
+
| Keyboard interaction | Action |
|
|
64
|
+
| -------------------- | ------------------------------------------------- |
|
|
65
|
+
| `Tab` | Moves focus to the button or away from it. |
|
|
66
|
+
| `Space` | Activates the button, triggering the click event. |
|
|
67
|
+
| `Enter` | Activates the button, triggering the click event. |
|
|
68
|
+
|
|
69
|
+
### Roles, States, and Properties
|
|
70
|
+
|
|
71
|
+
The roles, states and properties set adhering to the [WAI-ARIA 1.2](https://www.w3.org/TR/wai-aria-1.2/) standard on
|
|
72
|
+
this component are as follows:
|
|
73
|
+
|
|
74
|
+
| ARIA attribute | is automatic? | fallback used | manual override |
|
|
75
|
+
| -------------- | ------------------------------------ | ------------- | --------------- |
|
|
76
|
+
| `aria-label` | Yes, default slot text. | - | - |
|
|
77
|
+
| `role` | Yes, semantic `button` element used. | - | - |
|
|
78
|
+
|
|
79
|
+
Resources:
|
|
80
|
+
|
|
81
|
+
- [Figma link](https://www.figma.com/design/uLabwF3243jdMDsNSP7U9I/Bento---Components?node-id=25572-108880&node-type=INSTANCE)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions'; import { storybookDocsParameter } from '@/utils/ts/storybook'; import { isVue2 } from 'vue-demi'; import { computed, ref, watch } from 'vue'; import { type Meta, type StoryObj } from '@storybook/vue'; import BentoToggleButton from './toggle-button.vue'; import OptionsVerticalIcon from '@adyen/ui-assets-icons-16/vue/options-vertical'; import CheckmarkCircleFillIcon from '@adyen/ui-assets-icons-16/vue/checkmark-circle-fill'; export default { title: 'Button/Toggle Button', component: BentoToggleButton, argTypes: { condensed: { control: { type: 'boolean', }, table: { type: { summary: 'boolean' }, }, }, default: { name: 'default', defaultValue: '', description: 'Button text', table: { type: { summary: 'VNode[]' }, }, control: { disable: true }, }, disabled: { control: { type: 'boolean', }, table: { type: { summary: 'boolean' }, }, }, variant: { control: { type: 'select', }, table: { type: { summary: 'BentoButtonVariant: primary, secondary, tertiary' }, }, }, }, } as Meta; type Story = StoryObj<typeof BentoToggleButton>; const defaultCode = ` <bento-toggle-button variant="primary" :state="toggleState" @update:state="updateToggleState" > Toggle Button </bento-toggle-button> <script setup lang="ts"> import { BentoToggleButton } from '@adyen/bento-vue2' const toggleState = ref(false); const updateToggleState = (newToggleState: boolean) => { toggleState.value = newToggleState; }; </script> `; export const Default: Story = { render: (_args, { argTypes }) => ({ components: { BentoToggleButton }, props: Object.keys(argTypes), template: ` <bento-toggle-button v-bind="args" :toggled="toggleState" @click="clickedButtonAction" @update:toggled="updateToggleState" > {{toggleButtonText}} </bento-toggle-button> `, setup(props) { const args = isVue2 ? props : _args; const toggleState = ref<boolean>(args?.toggled); const toggleButtonText = computed(() => (toggleState.value ? 'Toggled' : 'Un-toggled')); const updateToggleState = (newToggleState: boolean) => { action('update:toggled')(newToggleState); toggleState.value = newToggleState; }; watch( () => args.toggled, () => { toggleState.value = args.toggled; } ); return { // Methods clickedButtonAction: action('click'), updateToggleState, // Values toggleButtonText, toggleState, args, }; }, }), args: { toggled: false, variant: 'primary', disabled: false, inverse: false, condensed: false, }, parameters: storybookDocsParameter(defaultCode), }; const withIconsCode = ` <bento-toggle-button variant="primary" :state="toggleState" @update:state="updateToggleState" > Toggle Button <template #iconLeft> <CheckmarkCircleFillIcon /> </template> <template #iconRight> <CheckmarkCircleFillIcon /> </template> </bento-toggle-button> <script setup lang="ts"> import { BentoToggleButton } from '@adyen/bento-vue2' import CheckmarkCircleFillIcon from '@adyen/ui-assets-icons-16/vue/checkmark-circle-fill'; const toggleState = ref(false); const updateToggleState = (newToggleState: boolean) => { toggleState.value = newToggleState; }; </script> `; export const WithIcons: Story = { render: (_args, { argTypes }) => ({ components: { BentoToggleButton, CheckmarkCircleFillIcon }, props: Object.keys(argTypes), template: ` <bento-toggle-button v-bind="args" :toggled="toggleState" @click="clickedButtonAction" @update:toggled="updateToggleState" > {{toggleButtonText}} <template #iconLeft> <CheckmarkCircleFillIcon /> </template> <template #iconRight> <CheckmarkCircleFillIcon /> </template> </bento-toggle-button> `, setup(props) { const args = isVue2 ? props : _args; const toggleState = ref<boolean>(args?.toggled); const toggleButtonText = computed(() => (toggleState.value ? 'Toggled' : 'Un-toggled')); const updateToggleState = (newToggleState: boolean) => { action('update:toggled')(newToggleState); toggleState.value = newToggleState; }; watch( () => args.toggled, () => { toggleState.value = args.toggled; } ); return { // Methods clickedButtonAction: action('click'), updateToggleState, // Values toggleButtonText, toggleState, args, }; }, }), args: { toggled: false, variant: 'primary', disabled: false, inverse: false, condensed: false, }, parameters: storybookDocsParameter(withIconsCode), }; const onlyIconCode = ` <bento-toggle-button variant="primary" :state="toggleState" @update:state="updateToggleState" > <template #iconLeft> <OptionsVerticalIcon /> </template> </bento-toggle-button> <script setup lang="ts"> import { BentoToggleButton } from '@adyen/bento-vue2' import OptionsVerticalIcon from '@adyen/ui-assets-icons-16/vue/options-vertical'; const toggleState = ref(false); const updateToggleState = (newToggleState: boolean) => { toggleState.value = newToggleState; }; </script> `; export const OnlyIcon: Story = { render: (_args, { argTypes }) => ({ components: { BentoToggleButton, OptionsVerticalIcon }, props: Object.keys(argTypes), template: ` <bento-toggle-button v-bind="args" :toggled="toggleState" @click="clickedButtonAction" @update:toggled="updateToggleState" > <template #iconLeft> <OptionsVerticalIcon /> </template> </bento-toggle-button> `, setup(props) { const args = isVue2 ? props : _args; const toggleState = ref<boolean>(args?.toggled); const updateToggleState = (newToggleState: boolean) => { action('update:toggled')(newToggleState); toggleState.value = newToggleState; }; watch( () => args.toggled, () => { toggleState.value = args.toggled; } ); return { // Methods clickedButtonAction: action('click'), updateToggleState, // Values toggleState, args, }; }, }), args: { toggled: false, variant: 'primary', disabled: false, inverse: false, condensed: false, }, parameters: storybookDocsParameter(onlyIconCode), };
|