@mycause/ui 0.0.0-ce837d6b → 0.0.0-ceed63b4
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 +267 -0
- package/README.md +9 -0
- package/dist/components/button-select/button-select.d.ts +12 -0
- package/dist/components/button-select/button-select.stories.d.ts +13 -0
- package/dist/components/button-select/index.d.ts +1 -0
- package/dist/components/campaign-card/campaign-card.d.ts +9 -0
- package/dist/components/campaign-card/campaign-card.stories.d.ts +14 -0
- package/dist/components/campaign-card/index.d.ts +1 -0
- package/dist/components/campaign-of-month/campaign-of-month.d.ts +15 -0
- package/dist/components/campaign-of-month/campaign-of-month.stories.d.ts +14 -0
- package/dist/components/campaign-of-month/index.d.ts +1 -0
- package/dist/components/charity-card/charity-card.d.ts +7 -0
- package/dist/components/charity-card/charity-card.stories.d.ts +14 -0
- package/dist/components/charity-card/index.d.ts +1 -0
- package/dist/components/choose-/index.d.ts +1 -0
- package/dist/components/choose-/start-fundraise-card.d.ts +10 -0
- package/dist/components/choose-/start-fundraise-card.stories.d.ts +14 -0
- package/dist/components/choose-charity-card/choose-charity-card.d.ts +10 -0
- package/dist/components/choose-charity-card/choose-charity-card.stories.d.ts +14 -0
- package/dist/components/choose-charity-card/index.d.ts +1 -0
- package/dist/components/choose-charity-card/start-fundraise-card.d.ts +10 -0
- package/dist/components/choose-charity-card/start-fundraise-card.stories.d.ts +14 -0
- package/dist/components/choose-charity-card copy/choose-charity-card.d.ts +10 -0
- package/dist/components/choose-charity-card copy/choose-charity-card.stories.d.ts +14 -0
- package/dist/components/choose-charity-card copy/index.d.ts +1 -0
- package/dist/components/combo-field/combo-field.d.ts +4 -1
- package/dist/components/comment-section/comment-section-v2/comment-section-v2.d.ts +31 -0
- package/dist/components/comment-section/comment-section-v2/sub-comments-v2.d.ts +11 -0
- package/dist/components/comment-section/comment-section.d.ts +24 -0
- package/dist/components/comment-section/comment-section.stories.d.ts +19 -0
- package/dist/components/comment-section/index.d.ts +2 -0
- package/dist/components/comment-section/sub-comments.d.ts +6 -0
- package/dist/components/cropper/cropper.d.ts +5 -4
- package/dist/components/cropper/cropper.stories.d.ts +1 -2
- package/dist/components/date-picker/single-date-picker.d.ts +3 -2
- package/dist/components/donate-card/donate-card.d.ts +8 -0
- package/dist/components/donate-card/donate-card.stories.d.ts +14 -0
- package/dist/components/donate-card/index.d.ts +1 -0
- package/dist/components/donation-form/donation-details.d.ts +12 -0
- package/dist/components/donation-form/donation-form-v2/donation-form-v2.d.ts +13 -0
- package/dist/components/donation-form/donation-form.d.ts +64 -0
- package/dist/components/donation-form/donation-form.stories.d.ts +18 -0
- package/dist/components/donation-form/donation-payment.d.ts +13 -0
- package/dist/components/donation-form/donation-select.d.ts +13 -0
- package/dist/components/donation-form/index.d.ts +2 -0
- package/dist/components/elevation/elevation.d.ts +2 -1
- package/dist/components/favorite-charity-item/choose-charity-card.d.ts +10 -0
- package/dist/components/favorite-charity-item/choose-charity-card.stories.d.ts +14 -0
- package/dist/components/favorite-charity-item/favorite-charity-item.d.ts +15 -0
- package/dist/components/favorite-charity-item/favorite-charity-item.stories.d.ts +15 -0
- package/dist/components/favorite-charity-item/index.d.ts +1 -0
- package/dist/components/featured-campaign-card/featured-campaign-card.d.ts +17 -0
- package/dist/components/featured-campaign-card/featured-campaign-card.stories.d.ts +14 -0
- package/dist/components/featured-campaign-card/index.d.ts +1 -0
- package/dist/components/field-helpers/field-label.d.ts +2 -1
- package/dist/components/footerV2/footerV2.d.ts +35 -0
- package/dist/components/footerV2/footerV2.stories.d.ts +15 -0
- package/dist/components/footerV2/index.d.ts +1 -0
- package/dist/components/fundraising-section/fundraising-section.d.ts +9 -0
- package/dist/components/fundraising-section/fundraising-section.stories.d.ts +14 -0
- package/dist/components/fundraising-section/index.d.ts +1 -0
- package/dist/components/green-dashboard-sidebar/green-dashboard-sidebar.d.ts +6 -0
- package/dist/components/{phone-number-field/phone-number-field.stories.d.ts → green-dashboard-sidebar/green-dashboard-sidebar.stories.d.ts} +1 -1
- package/dist/components/green-dashboard-sidebar/index.d.ts +1 -0
- package/dist/components/hero-banner/hero-banner.d.ts +9 -0
- package/dist/components/hero-banner/hero-banner.stories.d.ts +14 -0
- package/dist/components/hero-banner/index.d.ts +1 -0
- package/dist/components/horizontalbar/horizontalbar.d.ts +11 -0
- package/dist/components/horizontalbar/horizontalbar.stories.d.ts +26 -0
- package/dist/components/horizontalbar/index.d.ts +1 -0
- package/dist/components/icon/{toggle-button.d.ts → heart-toggle.d.ts} +3 -3
- package/dist/components/icon/{toggle-button.stories.d.ts → heart-toggle.stories.d.ts} +1 -1
- package/dist/components/icon/index.d.ts +1 -1
- package/dist/components/index.d.ts +40 -1
- package/dist/components/info-represent-campaign/index.d.ts +1 -0
- package/dist/components/info-represent-campaign/info-represent-campaign.d.ts +11 -0
- package/dist/components/info-represent-campaign/info-represent-campaign.stories.d.ts +12 -0
- package/dist/components/input/InputDefault.d.ts +11 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/input.stories.d.ts +18 -0
- package/dist/components/line-chart/index.d.ts +1 -0
- package/dist/components/line-chart/line-chart-component.d.ts +6 -0
- package/dist/components/line-chart/line-chart.d.ts +6 -0
- package/dist/components/line-chart/line-chart.stories.d.ts +9 -0
- package/dist/components/line-chart/parnert-line-chart.d.ts +3 -0
- package/dist/components/line-chart/parnert-line-chart.stories.d.ts +12 -0
- package/dist/components/line-chart/partner-line-chart-block copy.d.ts +0 -0
- package/dist/components/line-chart/partner-line-chart-block.d.ts +10 -0
- package/dist/components/line-chart/partner-line-chart-block.stories.d.ts +12 -0
- package/dist/components/line-chart/partner-line-chart.d.ts +3 -0
- package/dist/components/line-chart/partner-line-chart.stories-block.d.ts +12 -0
- package/dist/components/line-chart/partner-line-chart.stories.d.ts +12 -0
- package/dist/components/line-chart copy/index.d.ts +2 -0
- package/dist/components/line-chart copy/partner-line-chart-block.d.ts +10 -0
- package/dist/components/line-chart copy/partner-line-chart-block.stories.d.ts +12 -0
- package/dist/components/line-chart copy/partner-line-chart.d.ts +3 -0
- package/dist/components/line-chartjs/index.d.ts +1 -0
- package/dist/components/line-chartjs/partner-line-chart-block.d.ts +10 -0
- package/dist/components/line-chartjs/partner-line-chart-block.stories.d.ts +12 -0
- package/dist/components/line-chartjs/partner-line-chart.d.ts +3 -0
- package/dist/components/list/list.d.ts +29 -14
- package/dist/components/list/list.stories.d.ts +8 -2
- package/dist/components/login/index.d.ts +1 -0
- package/dist/components/login/login.d.ts +15 -0
- package/dist/components/login/login.stories.d.ts +19 -0
- package/dist/components/logo/logo-type.d.ts +2 -1
- package/dist/components/modal/index.d.ts +1 -0
- package/dist/components/modal/modal-image.d.ts +8 -0
- package/dist/components/modal/modal.d.ts +7 -3
- package/dist/components/modal/modal.stories.d.ts +18 -0
- package/dist/components/my-account-choose-charity-card/choose-charity-card.d.ts +10 -0
- package/dist/components/my-account-choose-charity-card/choose-charity-card.stories.d.ts +14 -0
- package/dist/components/my-account-choose-charity-card/index.d.ts +1 -0
- package/dist/components/my-account-choose-charity-card/my-account-choose-charity-card.d.ts +11 -0
- package/dist/components/my-account-choose-charity-card/my-account-choose-charity-card.stories.d.ts +14 -0
- package/dist/components/my-account-frp-closed/Icon.d.ts +5 -0
- package/dist/components/my-account-frp-closed/frp-closed-img.d.ts +9 -0
- package/dist/components/my-account-frp-closed/frp-information.d.ts +10 -0
- package/dist/components/my-account-frp-closed/index.d.ts +1 -0
- package/dist/components/my-account-frp-closed/my-account-frp-closed.d.ts +14 -0
- package/dist/components/my-account-frp-closed/my-account-frp-closed.stories.d.ts +24 -0
- package/dist/components/my-account-frp-preview/Icon.d.ts +5 -0
- package/dist/components/my-account-frp-preview/frp-information.d.ts +13 -0
- package/dist/components/my-account-frp-preview/frp-preview-img.d.ts +9 -0
- package/dist/components/my-account-frp-preview/index.d.ts +1 -0
- package/dist/components/my-account-frp-preview/my-account-frp-preview.d.ts +17 -0
- package/dist/components/my-account-frp-preview/my-account-frp-preview.stories.d.ts +24 -0
- package/dist/components/my-account-sidebar/Icon.d.ts +13 -0
- package/dist/components/my-account-sidebar/index.d.ts +1 -0
- package/dist/components/my-account-sidebar/my-account-sidebar.d.ts +17 -0
- package/dist/components/my-account-sidebar/my-account-sidebar.stories.d.ts +12 -0
- package/dist/components/my-account-start-fundraise-card/index.d.ts +1 -0
- package/dist/components/my-account-start-fundraise-card/my-account-start-fundraise-card.d.ts +11 -0
- package/dist/components/my-account-start-fundraise-card/my-account-start-fundraise-card.stories.d.ts +14 -0
- package/dist/components/my-account-start-fundraise-card/start-fundraise-card.d.ts +10 -0
- package/dist/components/my-account-start-fundraise-card/start-fundraise-card.stories.d.ts +14 -0
- package/dist/components/my-account-stats-donated/index.d.ts +1 -0
- package/dist/components/my-account-stats-donated/my-account-stats-donated.d.ts +8 -0
- package/dist/components/my-account-stats-donated/my-account-stats-donated.stories.d.ts +12 -0
- package/dist/components/my-account-stats-raised/index.d.ts +1 -0
- package/dist/components/my-account-stats-raised/my-account-stats-raised.d.ts +8 -0
- package/dist/components/my-account-stats-raised/my-account-stats-raised.stories.d.ts +12 -0
- package/dist/components/nav/icons/IconBigger.d.ts +5 -0
- package/dist/components/nav/icons/IconSmaller.d.ts +5 -0
- package/dist/components/nav/index.d.ts +2 -0
- package/dist/components/nav/nav-actions.d.ts +5 -0
- package/dist/components/nav/nav-bar.d.ts +7 -0
- package/dist/components/nav/nav-call-to-action.d.ts +5 -0
- package/dist/components/nav/nav-expanded-charity.d.ts +13 -0
- package/dist/components/nav/nav-expanded.d.ts +14 -0
- package/dist/components/nav/nav-list.d.ts +29 -0
- package/dist/components/nav/nav-menu-control.d.ts +8 -0
- package/dist/components/nav/nav-menu.d.ts +12 -0
- package/dist/components/nav/nav-myaccount.d.ts +22 -0
- package/dist/components/nav/nav-search-control.d.ts +8 -0
- package/dist/components/nav/nav-search.d.ts +10 -0
- package/dist/components/nav/nav-sign-in-control.d.ts +12 -0
- package/dist/components/nav/nav-user-menu-items.d.ts +20 -0
- package/dist/components/nav/nav-user-menu.d.ts +18 -0
- package/dist/components/nav/nav.d.ts +56 -0
- package/dist/components/nav/nav.stories.d.ts +17 -0
- package/dist/components/navigation/navigation-list.d.ts +3 -1
- package/dist/components/navigation/navigation-menu.d.ts +2 -1
- package/dist/components/navigation/navigation-sign-in-control.d.ts +6 -3
- package/dist/components/navigation/navigation.d.ts +12 -1
- package/dist/components/navigation/navigation.stories.d.ts +3 -21
- package/dist/components/parnert-monthly-stats/index.d.ts +1 -0
- package/dist/components/parnert-monthly-stats/parnert-monthly-stats.d.ts +7 -0
- package/dist/components/parnert-monthly-stats/parnert-monthly-stats.stories.d.ts +12 -0
- package/dist/components/partner-chart-stats/index.d.ts +1 -0
- package/dist/components/partner-chart-stats/partner-chart-stats.d.ts +11 -0
- package/dist/components/partner-chart-stats/partner-chart-stats.stories.d.ts +18 -0
- package/dist/components/partner-chart-stats/partner-monthly-stats.d.ts +7 -0
- package/dist/components/partner-chart-stats/partner-monthly-stats.stories.d.ts +12 -0
- package/dist/components/partner-monthly-donations/index.d.ts +1 -0
- package/dist/components/partner-monthly-donations/partner-monthly-donations.d.ts +8 -0
- package/dist/components/partner-monthly-donations/partner-monthly-donations.stories.d.ts +12 -0
- package/dist/components/partner-monthly-stats/index.d.ts +1 -0
- package/dist/components/partner-monthly-stats/partner-monthly-stats.d.ts +7 -0
- package/dist/components/partner-monthly-stats/partner-monthly-stats.stories.d.ts +12 -0
- package/dist/components/partner-monthly-stats copy/index.d.ts +1 -0
- package/dist/components/partner-monthly-stats copy/partner-monthly-stats.d.ts +7 -0
- package/dist/components/partner-monthly-stats copy/partner-monthly-stats.stories.d.ts +12 -0
- package/dist/components/partner-monthly-table/index.d.ts +1 -0
- package/dist/components/partner-monthly-table/partner-monthly-table.d.ts +7 -0
- package/dist/components/partner-monthly-table/partner-monthly-table.stories.d.ts +12 -0
- package/dist/components/partner-thismonth-stats/index.d.ts +1 -0
- package/dist/components/partner-thismonth-stats/partner-monthly-stats.d.ts +7 -0
- package/dist/components/partner-thismonth-stats/partner-monthly-stats.stories.d.ts +12 -0
- package/dist/components/partner-toggle-button/index.d.ts +2 -0
- package/dist/components/partner-toggle-button/partner-toggle-button-block.d.ts +11 -0
- package/dist/components/partner-toggle-button/partner-toggle-button-block.stories.d.ts +12 -0
- package/dist/components/partner-toggle-button/partner-toggle-button.d.ts +8 -0
- package/dist/components/phone-number-input/index.d.ts +3 -0
- package/dist/components/phone-number-input/phone-number-input-v2.d.ts +18 -0
- package/dist/components/{phone-number-field/phone-number-field.d.ts → phone-number-input/phone-number-input.d.ts} +5 -3
- package/dist/components/phone-number-input/phone-number-input.stories.d.ts +25 -0
- package/dist/components/popup/index.d.ts +1 -0
- package/dist/components/popup/popup.d.ts +8 -0
- package/dist/components/popup/popup.stories.d.ts +14 -0
- package/dist/components/progressbar/index.d.ts +1 -0
- package/dist/components/progressbar/progress-bar-circle.d.ts +10 -0
- package/dist/components/progressbar/progressbar.d.ts +8 -0
- package/dist/components/progressbar/progressbar.stories.d.ts +20 -0
- package/dist/components/select/select.d.ts +4 -1
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/spinner.d.ts +8 -0
- package/dist/components/spinner/spinner.stories.d.ts +13 -0
- package/dist/components/start-campaign-card/index.d.ts +1 -0
- package/dist/components/start-campaign-card/start-campaign-card.d.ts +8 -0
- package/dist/components/start-campaign-card/start-campaign-card.stories.d.ts +14 -0
- package/dist/components/start-campaign-card copy/index.d.ts +1 -0
- package/dist/components/start-campaign-card copy/start-campaign-card.d.ts +8 -0
- package/dist/components/start-campaign-card copy/start-campaign-card.stories.d.ts +14 -0
- package/dist/components/start-fundraise-card/index.d.ts +1 -0
- package/dist/components/start-fundraise-card/start-campaign-card.d.ts +8 -0
- package/dist/components/start-fundraise-card/start-campaign-card.stories.d.ts +14 -0
- package/dist/components/start-fundraise-card/start-fundraise-card.d.ts +10 -0
- package/dist/components/start-fundraise-card/start-fundraise-card.stories.d.ts +14 -0
- package/dist/components/start-fundraise-card copy/index.d.ts +1 -0
- package/dist/components/start-fundraise-card copy/start-fundraise-card.d.ts +10 -0
- package/dist/components/start-fundraise-card copy/start-fundraise-card.stories.d.ts +14 -0
- package/dist/components/statistics/statistics.d.ts +2 -1
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/partner-monthly-table.d.ts +16 -0
- package/dist/components/table/partner-monthly-table.stories.d.ts +18 -0
- package/dist/components/tabs/nav-tabs.d.ts +18 -0
- package/dist/components/tabs/tabs.d.ts +3 -1
- package/dist/components/text/text.d.ts +1 -1
- package/dist/components/text-field/index.d.ts +1 -0
- package/dist/components/text-field/text-field-search.d.ts +9 -0
- package/dist/components/text-field/text-field.d.ts +1 -0
- package/dist/components/text-field/text-field.stories.d.ts +6 -0
- package/dist/components/this-month-card/index.d.ts +1 -0
- package/dist/components/this-month-card/this-month-card.d.ts +15 -0
- package/dist/components/this-month-card/this-month-card.stories.d.ts +12 -0
- package/dist/index.esm.js +33203 -6565
- package/dist/index.js +33245 -6566
- package/dist/theme/theme.d.ts +4 -0
- package/dist/utils/parse-numbers.d.ts +2 -0
- package/package.json +4 -1
- package/styles/index.css +5 -0
- package/dist/components/anchor/anchor.jsx +0 -35
- package/dist/components/anchor/anchor.stories.jsx +0 -12
- package/dist/components/anchor/bold-anchor.jsx +0 -33
- package/dist/components/anchor/bold-anchor.stories.jsx +0 -11
- package/dist/components/anchor/index.js +0 -2
- package/dist/components/avatar/avatar.jsx +0 -14
- package/dist/components/avatar/avatar.stories.jsx +0 -17
- package/dist/components/avatar/image-avatar.jsx +0 -29
- package/dist/components/avatar/index.js +0 -1
- package/dist/components/avatar/text-avatar.jsx +0 -47
- package/dist/components/button/button.jsx +0 -85
- package/dist/components/button/button.stories.jsx +0 -118
- package/dist/components/button/index.js +0 -1
- package/dist/components/checkbox/checkbox.jsx +0 -39
- package/dist/components/checkbox/checkbox.stories.jsx +0 -42
- package/dist/components/checkbox/index.js +0 -1
- package/dist/components/chips/chip.jsx +0 -30
- package/dist/components/chips/chips.jsx +0 -16
- package/dist/components/chips/chips.stories.jsx +0 -35
- package/dist/components/chips/index.js +0 -3
- package/dist/components/chips/input-chips.jsx +0 -16
- package/dist/components/chips/input-chips.stories.jsx +0 -39
- package/dist/components/combo-field/combo-field-expander.jsx +0 -23
- package/dist/components/combo-field/combo-field.jsx +0 -93
- package/dist/components/combo-field/combo-field.stories.jsx +0 -62
- package/dist/components/combo-field/index.js +0 -2
- package/dist/components/cropper/cropper.jsx +0 -15
- package/dist/components/cropper/cropper.stories.jsx +0 -18
- package/dist/components/cropper/index.js +0 -1
- package/dist/components/date-picker/date-picker.jsx +0 -74
- package/dist/components/date-picker/date-picker.stories.jsx +0 -46
- package/dist/components/date-picker/index.js +0 -2
- package/dist/components/date-picker/single-date-picker.jsx +0 -81
- package/dist/components/elevation/elevation.jsx +0 -19
- package/dist/components/elevation/elevation.stories.jsx +0 -31
- package/dist/components/elevation/index.js +0 -1
- package/dist/components/field-helpers/field-helper-text.jsx +0 -42
- package/dist/components/field-helpers/field-label.jsx +0 -29
- package/dist/components/field-helpers/index.js +0 -2
- package/dist/components/icon/btn_google_light_normal_ios.svg.jsx +0 -21
- package/dist/components/icon/facebook_6.svg.jsx +0 -13
- package/dist/components/icon/icon-button-group.jsx +0 -51
- package/dist/components/icon/icon-button-group.stories.jsx +0 -26
- package/dist/components/icon/icon-button.jsx +0 -48
- package/dist/components/icon/icon-button.stories.jsx +0 -33
- package/dist/components/icon/icon.jsx +0 -49
- package/dist/components/icon/icon.stories.jsx +0 -78
- package/dist/components/icon/index.js +0 -4
- package/dist/components/icon/material-icon.jsx +0 -18
- package/dist/components/icon/toggle-button.jsx +0 -29
- package/dist/components/icon/toggle-button.stories.jsx +0 -16
- package/dist/components/index.js +0 -27
- package/dist/components/layout/box.jsx +0 -58
- package/dist/components/layout/flex.jsx +0 -55
- package/dist/components/layout/flex.stories.jsx +0 -44
- package/dist/components/layout/grid.jsx +0 -19
- package/dist/components/layout/grid.stories.jsx +0 -29
- package/dist/components/layout/index.js +0 -4
- package/dist/components/layout/stack.jsx +0 -33
- package/dist/components/layout/stack.stories.jsx +0 -40
- package/dist/components/list/index.js +0 -1
- package/dist/components/list/list.jsx +0 -52
- package/dist/components/list/list.stories.jsx +0 -135
- package/dist/components/logo/index.js +0 -1
- package/dist/components/logo/logo-type.jsx +0 -65
- package/dist/components/menu/index.js +0 -8
- package/dist/components/menu/menu-list-divider.jsx +0 -2
- package/dist/components/menu/menu-list-item-graphic.jsx +0 -2
- package/dist/components/menu/menu-list-item-meta.jsx +0 -2
- package/dist/components/menu/menu-list-item-text.jsx +0 -2
- package/dist/components/menu/menu-list-item.jsx +0 -11
- package/dist/components/menu/menu-list.jsx +0 -18
- package/dist/components/menu/menu-surface.jsx +0 -4
- package/dist/components/menu/menu.jsx +0 -2
- package/dist/components/menu/menu.stories.jsx +0 -42
- package/dist/components/modal/index.js +0 -1
- package/dist/components/modal/modal.jsx +0 -49
- package/dist/components/modal/modal.stories.jsx +0 -47
- package/dist/components/navigation/index.js +0 -1
- package/dist/components/navigation/navigation-actions.jsx +0 -8
- package/dist/components/navigation/navigation-bar.jsx +0 -42
- package/dist/components/navigation/navigation-call-to-action.jsx +0 -6
- package/dist/components/navigation/navigation-expanded.jsx +0 -165
- package/dist/components/navigation/navigation-list.jsx +0 -126
- package/dist/components/navigation/navigation-menu-control.jsx +0 -25
- package/dist/components/navigation/navigation-menu.jsx +0 -103
- package/dist/components/navigation/navigation-search-control.jsx +0 -8
- package/dist/components/navigation/navigation-search.jsx +0 -63
- package/dist/components/navigation/navigation-sign-in-control.jsx +0 -14
- package/dist/components/navigation/navigation-user-menu-items.jsx +0 -36
- package/dist/components/navigation/navigation-user-menu.jsx +0 -121
- package/dist/components/navigation/navigation.jsx +0 -137
- package/dist/components/navigation/navigation.stories.jsx +0 -260
- package/dist/components/phone-number-field/index.d.ts +0 -2
- package/dist/components/phone-number-field/index.js +0 -2
- package/dist/components/phone-number-field/phone-number-field.jsx +0 -50
- package/dist/components/phone-number-field/phone-number-field.stories.jsx +0 -23
- package/dist/components/phone-number-field/util.js +0 -19
- package/dist/components/radio/index.js +0 -2
- package/dist/components/radio/radio-group.jsx +0 -9
- package/dist/components/radio/radio-group.stories.jsx +0 -21
- package/dist/components/radio/radio.jsx +0 -31
- package/dist/components/radio/radio.stories.jsx +0 -44
- package/dist/components/select/index.js +0 -2
- package/dist/components/select/select-helper-text.jsx +0 -6
- package/dist/components/select/select.jsx +0 -152
- package/dist/components/select/select.stories.jsx +0 -40
- package/dist/components/statistics/index.js +0 -1
- package/dist/components/statistics/statistics.jsx +0 -61
- package/dist/components/statistics/statistics.stories.jsx +0 -34
- package/dist/components/switch/index.js +0 -1
- package/dist/components/switch/switch.jsx +0 -32
- package/dist/components/switch/switch.stories.jsx +0 -41
- package/dist/components/tabs/index.js +0 -1
- package/dist/components/tabs/tab-bar.jsx +0 -35
- package/dist/components/tabs/tab-text-label.jsx +0 -5
- package/dist/components/tabs/tab.jsx +0 -50
- package/dist/components/tabs/tabs.jsx +0 -65
- package/dist/components/tabs/tabs.stories.jsx +0 -27
- package/dist/components/text/index.js +0 -1
- package/dist/components/text/text.jsx +0 -138
- package/dist/components/text/text.stories.jsx +0 -262
- package/dist/components/text-field/index.js +0 -2
- package/dist/components/text-field/text-field-helper-text.jsx +0 -8
- package/dist/components/text-field/text-field.jsx +0 -124
- package/dist/components/text-field/text-field.stories.jsx +0 -32
- package/dist/components/uploader/index.js +0 -1
- package/dist/components/uploader/uploader.jsx +0 -96
- package/dist/input.d.ts +0 -1
- package/dist/input.js +0 -4
- package/dist/input.jsx +0 -4
- package/dist/theme/colors.js +0 -9
- package/dist/theme/index.js +0 -2
- package/dist/theme/mycause-theme.js +0 -33
- package/dist/theme/theme.jsx +0 -36
- package/dist/utils/browser.js +0 -19
- package/dist/utils/center-decorator.jsx +0 -15
- package/dist/utils/component-matrix.jsx +0 -39
- package/dist/utils/flags.js +0 -18
- package/dist/utils/grid-decorator.jsx +0 -27
- package/dist/utils/tap-event.js +0 -11
- package/dist/utils/wrap.js +0 -8
- /package/dist/components/{phone-number-field → phone-number-input}/util.d.ts +0 -0
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useCallback } from "react";
|
|
2
|
-
import classnames from "classnames";
|
|
3
|
-
import css from "styled-jsx/css";
|
|
4
|
-
import MDCSelect, { Option, SelectIcon, } from "@material/react-select";
|
|
5
|
-
import { setRef } from "../../utils/set-ref";
|
|
6
|
-
import { useTheme } from "../../theme/theme";
|
|
7
|
-
import SelectHelperText from "./select-helper-text";
|
|
8
|
-
import { FieldLabel, FieldHelperText } from "../field-helpers";
|
|
9
|
-
const Select = forwardRef(function Select({ label = "", value, onChange, helperText, isHelperTextPersistent, externalLabel, id, className, options, large = false, required, leadingIcon, noArrow, error = false, ...rest }, ref_) {
|
|
10
|
-
const theme = useTheme();
|
|
11
|
-
let errorMessage = null;
|
|
12
|
-
// If options has been provided as an array of strings, convert it into an array of objects
|
|
13
|
-
if (isStringArray(options)) {
|
|
14
|
-
options = options.map((option) => ({
|
|
15
|
-
value: option,
|
|
16
|
-
label: option,
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
// Add an empty default value
|
|
20
|
-
if (value === "" && !options.find(option => option.value === "")) {
|
|
21
|
-
options = [
|
|
22
|
-
{
|
|
23
|
-
value: "",
|
|
24
|
-
label: "",
|
|
25
|
-
disabled: true,
|
|
26
|
-
},
|
|
27
|
-
...options,
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
if (leadingIcon) {
|
|
31
|
-
leadingIcon = <SelectIcon tag="span">{leadingIcon}</SelectIcon>;
|
|
32
|
-
}
|
|
33
|
-
// If helperText is passed as a string turn it into a HelperText
|
|
34
|
-
// helperText=null or helperText="" indicates that there should be empty helper text (for layout reasons)
|
|
35
|
-
if (typeof helperText === "string" || helperText === null) {
|
|
36
|
-
helperText = (<SelectHelperText persistent={isHelperTextPersistent}>
|
|
37
|
-
{helperText}
|
|
38
|
-
</SelectHelperText>);
|
|
39
|
-
}
|
|
40
|
-
if (typeof error === "string") {
|
|
41
|
-
errorMessage = <FieldHelperText error={error}/>;
|
|
42
|
-
}
|
|
43
|
-
const ref = useCallback(setRef(ref_, (instance) => instance.nativeControl.current), [ref_]);
|
|
44
|
-
const scope = css.resolve `
|
|
45
|
-
.select :global(.mdc-select__native-control) {
|
|
46
|
-
border: ${error && "2px solid #b00020 !important"};
|
|
47
|
-
}
|
|
48
|
-
.select :global(.mdc-select__native-control),
|
|
49
|
-
.select :global(.mdc-floating-label) {
|
|
50
|
-
font-weight: 500;
|
|
51
|
-
font-family: ${theme.typography.fontFamily.brand};
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
/**
|
|
55
|
-
* This is a fix for the Material Component Bug in firefox
|
|
56
|
-
* untill they address this we have to handle the onChange
|
|
57
|
-
* of select with onClick.
|
|
58
|
-
*/
|
|
59
|
-
const handler = getFirefoxSelectBugHHandler(value, onChange);
|
|
60
|
-
return (<div className={classnames("select", scope.className)}>
|
|
61
|
-
{externalLabel && label ? (<FieldLabel large={large} htmlFor={id} required={required}>
|
|
62
|
-
{label}
|
|
63
|
-
</FieldLabel>) : null}
|
|
64
|
-
<MDCSelect ref={ref} label={externalLabel ? "" : label} value={value} enhanced={false} onChange={handler} onClick={handler} id={id} outlined required={required} className={classnames(className, {
|
|
65
|
-
"mdc-select--dense": !large,
|
|
66
|
-
"mdc-select--no-arrow": noArrow,
|
|
67
|
-
})} leadingIcon={leadingIcon} helperText={!error ? helperText : undefined} {...rest}>
|
|
68
|
-
{options.map(option => (<Option key={option.value} {...option}>
|
|
69
|
-
{option.label}
|
|
70
|
-
</Option>))}
|
|
71
|
-
</MDCSelect>
|
|
72
|
-
{errorMessage}
|
|
73
|
-
<style jsx>{`
|
|
74
|
-
.select {
|
|
75
|
-
display: flex;
|
|
76
|
-
flex-direction: column;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.select-label {
|
|
80
|
-
font-size: 0.875rem;
|
|
81
|
-
margin: 0.5rem 0;
|
|
82
|
-
display: inline-block;
|
|
83
|
-
font-weight: 400;
|
|
84
|
-
letter-spacing: 0.00937em;
|
|
85
|
-
color: rgba(0, 0, 0, 0.6);
|
|
86
|
-
text-align: left;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.select-label--dense {
|
|
90
|
-
font-size: 0.75rem;
|
|
91
|
-
}
|
|
92
|
-
`}</style>
|
|
93
|
-
{scope.styles}
|
|
94
|
-
</div>);
|
|
95
|
-
});
|
|
96
|
-
export default Select;
|
|
97
|
-
function isStringArray(arr) {
|
|
98
|
-
// Note this only tests that at least one item in the array is a string
|
|
99
|
-
// This only works under the assumption that the array does not contain mixed types
|
|
100
|
-
return arr.some((option) => typeof option === "string");
|
|
101
|
-
}
|
|
102
|
-
function getFirefoxSelectBugHHandler(value, handler) {
|
|
103
|
-
let events = {
|
|
104
|
-
click: null,
|
|
105
|
-
change: null,
|
|
106
|
-
};
|
|
107
|
-
let values = {
|
|
108
|
-
click: "",
|
|
109
|
-
change: "",
|
|
110
|
-
};
|
|
111
|
-
let flushed = false;
|
|
112
|
-
let handle = null;
|
|
113
|
-
const flush = () => {
|
|
114
|
-
if (events.change && !events.click) {
|
|
115
|
-
events.change.target.value = values.change;
|
|
116
|
-
handler(events.change);
|
|
117
|
-
}
|
|
118
|
-
else if (events.change && values.change && values.change !== value) {
|
|
119
|
-
handler(events.change);
|
|
120
|
-
}
|
|
121
|
-
else if (events.click && values.click && values.click !== value) {
|
|
122
|
-
handler(events.click);
|
|
123
|
-
}
|
|
124
|
-
else if (events.change && !values.click && !values.change && value) {
|
|
125
|
-
handler(events.change);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
return (e) => {
|
|
129
|
-
switch (e.type) {
|
|
130
|
-
case "click":
|
|
131
|
-
values.click = e.target.value;
|
|
132
|
-
events.click = e;
|
|
133
|
-
break;
|
|
134
|
-
case "change":
|
|
135
|
-
values.change = e.currentTarget.value;
|
|
136
|
-
events.change = e;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
if (events.click && events.change) {
|
|
140
|
-
flush();
|
|
141
|
-
}
|
|
142
|
-
if (!handle) {
|
|
143
|
-
// This flush is required if the user used the keyboard to select
|
|
144
|
-
// as no click event would have been dispatched
|
|
145
|
-
handle = requestAnimationFrame(() => {
|
|
146
|
-
if (!flushed) {
|
|
147
|
-
flush();
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { withKnobs, select, boolean, text } from "@storybook/addon-knobs";
|
|
3
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
4
|
-
import Select from "./select";
|
|
5
|
-
import { Icon } from "../icon";
|
|
6
|
-
export default {
|
|
7
|
-
title: "Select",
|
|
8
|
-
decorators: [CenterDecorator, withKnobs],
|
|
9
|
-
};
|
|
10
|
-
let options = [
|
|
11
|
-
"",
|
|
12
|
-
"January",
|
|
13
|
-
"February",
|
|
14
|
-
"March",
|
|
15
|
-
"April",
|
|
16
|
-
"May",
|
|
17
|
-
"June",
|
|
18
|
-
"July",
|
|
19
|
-
"August",
|
|
20
|
-
"September",
|
|
21
|
-
"October",
|
|
22
|
-
"November",
|
|
23
|
-
"December",
|
|
24
|
-
];
|
|
25
|
-
export const SelectStory = () => {
|
|
26
|
-
const [value, setValue] = useState("");
|
|
27
|
-
const large = boolean("Large", false);
|
|
28
|
-
const label = text("Label", "Month");
|
|
29
|
-
const labelKind = select("Label Type", { External: "external", Floating: "floating" }, "Floating");
|
|
30
|
-
const required = boolean("Required", false);
|
|
31
|
-
const helperText = text("Helper Text", "A month in the year");
|
|
32
|
-
const persistent = boolean("Persistent Helper Text", false);
|
|
33
|
-
const leadingIcon = boolean("Leading Icon", false);
|
|
34
|
-
const arrow = boolean("Arrow", true);
|
|
35
|
-
const error = text("error message", "");
|
|
36
|
-
return (<Select value={value} options={options} onChange={e => setValue(e.target.value)} label={label} large={large} helperText={helperText} isHelperTextPersistent={persistent} externalLabel={labelKind === "external"} required={required} color="secondary" leadingIcon={leadingIcon ? <Icon icon="account_circle"/> : undefined} noArrow={!arrow} error={error}/>);
|
|
37
|
-
};
|
|
38
|
-
SelectStory.story = {
|
|
39
|
-
name: "default",
|
|
40
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Statistics } from "./statistics";
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import cn from "classnames";
|
|
3
|
-
import { Text } from "../text";
|
|
4
|
-
import { Flex, Stack } from "../layout";
|
|
5
|
-
function Statistics({ title, stats, className, ...rest }) {
|
|
6
|
-
return (<div className={cn("statistics", className)} {...rest}>
|
|
7
|
-
<Stack direction="column">
|
|
8
|
-
<Text p kind="h3" font="brand" color="primary">
|
|
9
|
-
{title}
|
|
10
|
-
</Text>
|
|
11
|
-
<Stack gap="1.5rem">
|
|
12
|
-
{stats.map(stat => {
|
|
13
|
-
let { id, label, logo, value } = stat;
|
|
14
|
-
return (<Stack key={id} align="stretch" className="statistics-item">
|
|
15
|
-
<div className="statistics-logo" style={{
|
|
16
|
-
backgroundImage: `url(${logo})`,
|
|
17
|
-
}}/>
|
|
18
|
-
<Flex className="statistics-text" direction="column" justify="space-around" align="stretch">
|
|
19
|
-
<Text span kind="h4" font="brand" className="statistics-text-title">
|
|
20
|
-
{label}
|
|
21
|
-
</Text>
|
|
22
|
-
<Text span kind="p" font="brand" className="statistics-text-value">
|
|
23
|
-
{value}
|
|
24
|
-
</Text>
|
|
25
|
-
</Flex>
|
|
26
|
-
</Stack>);
|
|
27
|
-
})}
|
|
28
|
-
</Stack>
|
|
29
|
-
</Stack>
|
|
30
|
-
<style jsx>{`
|
|
31
|
-
.statistics {
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.statistics-logo {
|
|
35
|
-
width: 3rem;
|
|
36
|
-
height: 3rem;
|
|
37
|
-
background-position: center;
|
|
38
|
-
background-size: contain;
|
|
39
|
-
background-repeat: no-repeat;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.statistics :global(.statistics-text) {
|
|
43
|
-
height: 100%;
|
|
44
|
-
min-width: max-content;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.statistics :global(.statistics-item) {
|
|
48
|
-
height: 3rem;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.statistics :global(.statistics-text) {
|
|
52
|
-
height: 100%;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.statistics :global(.statistics-text-value) {
|
|
56
|
-
line-height: 1;
|
|
57
|
-
}
|
|
58
|
-
`}</style>
|
|
59
|
-
</div>);
|
|
60
|
-
}
|
|
61
|
-
export default Statistics;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import Statistics from "./statistics";
|
|
4
|
-
import placeholder from "./circle.svg";
|
|
5
|
-
export default {
|
|
6
|
-
title: "Statistics",
|
|
7
|
-
decorators: [CenterDecorator],
|
|
8
|
-
};
|
|
9
|
-
export const StatisticsStory = () => {
|
|
10
|
-
const stats = [
|
|
11
|
-
{
|
|
12
|
-
label: "Members",
|
|
13
|
-
id: "nav-expand-members",
|
|
14
|
-
value: "302, 657",
|
|
15
|
-
logo: placeholder,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
label: "Causes",
|
|
19
|
-
id: "nav-expand-causes",
|
|
20
|
-
value: "68, 553",
|
|
21
|
-
logo: placeholder,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: "Raised",
|
|
25
|
-
id: "nav-expand-raised",
|
|
26
|
-
value: "$100 Million +",
|
|
27
|
-
logo: placeholder,
|
|
28
|
-
},
|
|
29
|
-
];
|
|
30
|
-
return <Statistics stats={stats} title="We support your cause"/>;
|
|
31
|
-
};
|
|
32
|
-
StatisticsStory.story = {
|
|
33
|
-
name: "default",
|
|
34
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Switch } from "./switch";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React, { Fragment, useState, useEffect } from "react";
|
|
2
|
-
import MDCSwitch from "@material/react-switch";
|
|
3
|
-
import nanoid from "nanoid";
|
|
4
|
-
import classnames from "classnames";
|
|
5
|
-
import css from "styled-jsx/css";
|
|
6
|
-
import { useTheme, getColorToken } from "../../theme/theme";
|
|
7
|
-
const Switch = ({ id, label, color = "primary", className, ...rest }) => {
|
|
8
|
-
const [mainId, setmainId] = useState("");
|
|
9
|
-
const theme = useTheme();
|
|
10
|
-
const setColor = getColorToken(theme, "foreground", color);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
setmainId(id ? id : nanoid());
|
|
13
|
-
}, [id, setmainId]);
|
|
14
|
-
const scope = css.resolve `
|
|
15
|
-
.switchStyle {
|
|
16
|
-
--mdc-theme-secondary: ${setColor};
|
|
17
|
-
}
|
|
18
|
-
.switch-label {
|
|
19
|
-
font-family: ${theme.typography.fontFamily.brand} !important;
|
|
20
|
-
margin-right: 10px;
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
return (<Fragment>
|
|
25
|
-
{label && (<label className={classnames("switch-label", scope.className)} htmlFor={mainId}>
|
|
26
|
-
{label}
|
|
27
|
-
</label>)}
|
|
28
|
-
<MDCSwitch className={classnames(className, "switchStyle", scope.className)} nativeControlId={mainId} checked={true} {...rest}/>
|
|
29
|
-
{scope.styles}
|
|
30
|
-
</Fragment>);
|
|
31
|
-
};
|
|
32
|
-
export default Switch;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import { Stack } from "../layout";
|
|
4
|
-
import Switch from "./switch";
|
|
5
|
-
export default {
|
|
6
|
-
title: "Switch",
|
|
7
|
-
decorators: [CenterDecorator],
|
|
8
|
-
};
|
|
9
|
-
export const SwitchDefault = () => {
|
|
10
|
-
const [switchChecked, setSwitchChecked] = useState(false);
|
|
11
|
-
const handleClick = (event) => {
|
|
12
|
-
setSwitchChecked(event.target.checked);
|
|
13
|
-
};
|
|
14
|
-
return (<Stack>
|
|
15
|
-
<Switch checked={switchChecked} onChange={handleClick}/>
|
|
16
|
-
<Switch checked={switchChecked} onChange={handleClick} color="secondary"/>
|
|
17
|
-
<Switch checked={switchChecked} onChange={handleClick} color="muted"/>
|
|
18
|
-
</Stack>);
|
|
19
|
-
};
|
|
20
|
-
SwitchDefault.story = {
|
|
21
|
-
name: "default",
|
|
22
|
-
};
|
|
23
|
-
export const SwitchWithLabel = () => {
|
|
24
|
-
const [switchChecked, setSwitchChecked] = useState(false);
|
|
25
|
-
const handleClick = (event) => {
|
|
26
|
-
setSwitchChecked(event.target.checked);
|
|
27
|
-
};
|
|
28
|
-
return (<Switch checked={switchChecked} onChange={handleClick} label="With Label"/>);
|
|
29
|
-
};
|
|
30
|
-
SwitchWithLabel.story = {
|
|
31
|
-
name: "with label",
|
|
32
|
-
};
|
|
33
|
-
export const SwitchDisabled = () => {
|
|
34
|
-
return (<Stack>
|
|
35
|
-
<Switch checked={false} disabled={true}/>
|
|
36
|
-
<Switch checked={true} disabled={true}/>
|
|
37
|
-
</Stack>);
|
|
38
|
-
};
|
|
39
|
-
SwitchDisabled.story = {
|
|
40
|
-
name: "disabled",
|
|
41
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Tabs } from "./tabs";
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useCallback } from "react";
|
|
2
|
-
import css from "styled-jsx/css";
|
|
3
|
-
import classnames from "classnames";
|
|
4
|
-
import MDCTabBar from "@material/react-tab-bar";
|
|
5
|
-
import { setRef } from "../../utils/set-ref";
|
|
6
|
-
const scope = css.resolve `
|
|
7
|
-
* :global(.mdc-tab) {
|
|
8
|
-
padding: 0 1rem;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
* :global(.mdc-tab__text-label) {
|
|
12
|
-
font-weight: 600;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.mdc-tab-bar--large :global(.mdc-tab) {
|
|
16
|
-
height: 6rem;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.mdc-tab-bar--large :global(.mdc-tab__text-label) {
|
|
20
|
-
font-size: 1rem;
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
const TabBar = forwardRef(function TabBar({ large, className, ...props }, ref_) {
|
|
24
|
-
// useCallback to ensure there is a stable ref
|
|
25
|
-
// The <MDCTabBar> component has a `tabBarRef` property which
|
|
26
|
-
// is a ref to the tab bar element
|
|
27
|
-
let ref = useCallback(setRef(ref_, instance => instance.tabBarRef.current), [ref_]);
|
|
28
|
-
return (<>
|
|
29
|
-
<MDCTabBar className={classnames(scope.className, className, {
|
|
30
|
-
"mdc-tab-bar--large": large,
|
|
31
|
-
})} ref={ref} {...props}/>
|
|
32
|
-
{scope.styles}
|
|
33
|
-
</>);
|
|
34
|
-
});
|
|
35
|
-
export default TabBar;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useState, useEffect, useRef } from "react";
|
|
2
|
-
import MDCTab from "@material/react-tab";
|
|
3
|
-
import classnames from "classnames";
|
|
4
|
-
import css from "styled-jsx/css";
|
|
5
|
-
import { tapRef } from "../../utils/tap-ref";
|
|
6
|
-
const Tab = forwardRef(function Tab({ children, className, isCompactHeight, isMinWidth, id, analyticsId, ...props }, ref) {
|
|
7
|
-
const [mounted, setMounted] = useState(false);
|
|
8
|
-
const scope = css.resolve `
|
|
9
|
-
.mdc-tab--min-width {
|
|
10
|
-
flex-grow: 0;
|
|
11
|
-
}
|
|
12
|
-
.mdc-tab--compact-height {
|
|
13
|
-
height: 64px !important;
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
setMounted(true);
|
|
18
|
-
}, []);
|
|
19
|
-
const intermediateRef = useRef(null);
|
|
20
|
-
const finalRef = tapRef(ref, intermediateRef);
|
|
21
|
-
// Because the ripple is the element that gets clicked (not the button)
|
|
22
|
-
// we need to put the analyticsId onto the ripple instead.
|
|
23
|
-
// there is no way to get to the ripple supported by @material/react-tab
|
|
24
|
-
// so we have to do it manually
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (mounted) {
|
|
27
|
-
if (intermediateRef.current && intermediateRef.current.tabRef.current) {
|
|
28
|
-
const tabNode = intermediateRef.current.tabRef.current;
|
|
29
|
-
let rippleNode = tabNode.querySelector(".mdc-tab__ripple");
|
|
30
|
-
setAttribute(rippleNode, "id", analyticsId);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}, [mounted, analyticsId]);
|
|
34
|
-
return (<MDCTab className={classnames(className, scope.className, {
|
|
35
|
-
"mdc-tab--min-width": isMinWidth,
|
|
36
|
-
"mdc-tab--compact-height": isCompactHeight,
|
|
37
|
-
})} id={id} ref={finalRef} {...props}>
|
|
38
|
-
{children}
|
|
39
|
-
{scope.styles}
|
|
40
|
-
</MDCTab>);
|
|
41
|
-
});
|
|
42
|
-
export default Tab;
|
|
43
|
-
function setAttribute(node, attr, val) {
|
|
44
|
-
if (typeof val !== "undefined") {
|
|
45
|
-
node.setAttribute(attr, val);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
node.removeAttribute(attr);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
import classnames from "classnames";
|
|
3
|
-
import css from "styled-jsx/css";
|
|
4
|
-
import TabBar from "./tab-bar";
|
|
5
|
-
import Tab from "./tab";
|
|
6
|
-
import TabTextLabel from "./tab-text-label";
|
|
7
|
-
const scope = css.resolve `
|
|
8
|
-
.tab--noselect {
|
|
9
|
-
width: 0;
|
|
10
|
-
padding: 0;
|
|
11
|
-
flex-grow: 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
when the invisible tab is selected (meaning no actual tab is selected)
|
|
16
|
-
show that the whole tab bar is focused
|
|
17
|
-
*/
|
|
18
|
-
.tab-bar--none-selected:focus-within {
|
|
19
|
-
background-color: rgba(0, 0, 0, 0.02);
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
function Tabs({ tabs, active, onActiveUpdate, isMinWidth, isMinWidthIndicator, isCompactHeight, className, ...props }) {
|
|
23
|
-
if (!active) {
|
|
24
|
-
// In the case that no tab is selected, an invisible tab will be added and be set to active
|
|
25
|
-
tabs = [
|
|
26
|
-
{
|
|
27
|
-
key: "",
|
|
28
|
-
label: null,
|
|
29
|
-
},
|
|
30
|
-
...tabs,
|
|
31
|
-
];
|
|
32
|
-
}
|
|
33
|
-
let activeIndex = active ? tabs.findIndex(tab => tab.key === active) : 0;
|
|
34
|
-
const handleActiveIndexUpdate = (i) => {
|
|
35
|
-
onActiveUpdate(tabs[i].key);
|
|
36
|
-
};
|
|
37
|
-
// When the component first mounts and active is set to null, the first
|
|
38
|
-
// (hidden) tab is selected. When this happens the tab bar gains focus
|
|
39
|
-
// and we can see the focus styling. The user didn't intend to focus the
|
|
40
|
-
// tab bar, so we unselect it by calling blur on the tab.
|
|
41
|
-
const ref = useRef(null);
|
|
42
|
-
const [mounted, setMounted] = useState(false);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (!mounted && !active && ref.current) {
|
|
45
|
-
let elem = ref.current;
|
|
46
|
-
let tab = elem.querySelector(".tab--noselect");
|
|
47
|
-
tab.blur();
|
|
48
|
-
}
|
|
49
|
-
setMounted(true);
|
|
50
|
-
}, [ref, active, mounted]);
|
|
51
|
-
return (<>
|
|
52
|
-
<TabBar key={(!!active).toString()} // TabBar crashes if the active index changes to -1 from non -1 or vice versa
|
|
53
|
-
activeIndex={activeIndex} handleActiveIndexUpdate={handleActiveIndexUpdate} className={classnames(scope.className, className, {
|
|
54
|
-
"tab-bar--none-selected": !active,
|
|
55
|
-
})} ref={ref} {...props}>
|
|
56
|
-
{tabs.map(({ key, label, className, ...tab }) => (<Tab key={key} isCompactHeight={isCompactHeight} isMinWidth={isMinWidth} isMinWidthIndicator={isMinWidthIndicator} className={classnames(scope.className, className, {
|
|
57
|
-
"tab--noselect": !key,
|
|
58
|
-
})} {...tab}>
|
|
59
|
-
<TabTextLabel>{label}</TabTextLabel>
|
|
60
|
-
</Tab>))}
|
|
61
|
-
</TabBar>
|
|
62
|
-
{scope.styles}
|
|
63
|
-
</>);
|
|
64
|
-
}
|
|
65
|
-
export default Tabs;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import Tabs from "./tabs";
|
|
4
|
-
import "./tabs.scss";
|
|
5
|
-
export default {
|
|
6
|
-
title: "Tabs",
|
|
7
|
-
decorators: [CenterDecorator],
|
|
8
|
-
};
|
|
9
|
-
export const tabs = function TabsDemo() {
|
|
10
|
-
const [active, setActive] = useState(null);
|
|
11
|
-
return (<div className="container">
|
|
12
|
-
<Tabs active={active} onActiveUpdate={setActive} tabs={[
|
|
13
|
-
{ key: "fundraise", label: "Fundraise" },
|
|
14
|
-
{ key: "donate", label: "Donate" },
|
|
15
|
-
{ key: "organisation", label: "Organisation" },
|
|
16
|
-
]}/>
|
|
17
|
-
<style jsx>{`
|
|
18
|
-
.container {
|
|
19
|
-
max-width: 680px;
|
|
20
|
-
width: 100%;
|
|
21
|
-
}
|
|
22
|
-
`}</style>
|
|
23
|
-
</div>);
|
|
24
|
-
};
|
|
25
|
-
tabs.story = {
|
|
26
|
-
name: "default",
|
|
27
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Text } from "./text";
|