@mycause/ui 0.0.0-ce837d6b → 0.0.0-cec05abe
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/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/date-picker.stories.d.ts +6 -0
- package/dist/components/date-picker/single-date-picker-custom-header.d.ts +31 -0
- 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/donate-card copy/donate-card.d.ts +8 -0
- package/dist/components/donate-card copy/donate-card.stories.d.ts +14 -0
- package/dist/components/donate-card copy/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/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/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 +41 -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 +13 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/input.stories.d.ts +24 -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/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 +13 -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 +17 -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 +15 -0
- package/dist/components/my-account-sidebar/index.d.ts +1 -0
- package/dist/components/my-account-sidebar/my-account-sidebar.d.ts +18 -0
- package/dist/components/{phone-number-field/phone-number-field.stories.d.ts → my-account-sidebar/my-account-sidebar.stories.d.ts} +1 -1
- 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-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 +14 -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 +57 -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/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-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-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 +4 -0
- package/dist/components/phone-number-input/phone-number-input-v1.d.ts +25 -0
- package/dist/components/phone-number-input/phone-number-input-v2.d.ts +19 -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 +31 -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/index.d.ts +1 -0
- package/dist/components/select/select-enhanced.d.ts +23 -0
- package/dist/components/select/select.d.ts +4 -1
- package/dist/components/select/select.stories.d.ts +6 -0
- 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/statistics/statistics.d.ts +2 -1
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/partner-monthly-table.d.ts +17 -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/components/transaction-card/Dot.d.ts +6 -0
- package/dist/components/transaction-card/donate-card.d.ts +8 -0
- package/dist/components/transaction-card/donate-card.stories.d.ts +14 -0
- package/dist/components/transaction-card/index.d.ts +1 -0
- package/dist/components/transaction-card/transaction-card.d.ts +13 -0
- package/dist/components/transaction-card/transaction-card.stories.d.ts +14 -0
- package/dist/components/transaction-card/transaction-cardstories.d.ts +14 -0
- package/dist/index.esm.js +33642 -6329
- package/dist/index.js +33977 -6620
- 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
package/dist/theme/theme.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export declare type Theme = {
|
|
|
21
21
|
secondary: string;
|
|
22
22
|
muted: string;
|
|
23
23
|
inactive: string;
|
|
24
|
+
partner: string;
|
|
25
|
+
coral: string;
|
|
24
26
|
};
|
|
25
27
|
background: {
|
|
26
28
|
neutral: string;
|
|
@@ -29,6 +31,8 @@ export declare type Theme = {
|
|
|
29
31
|
secondary: string;
|
|
30
32
|
muted: string;
|
|
31
33
|
inactive: string;
|
|
34
|
+
partner: string;
|
|
35
|
+
coral: string;
|
|
32
36
|
};
|
|
33
37
|
};
|
|
34
38
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mycause/ui",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-cec05abe",
|
|
4
4
|
"author": "Marc Porciuncula <marc@mycause.com.au>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,9 +29,11 @@
|
|
|
29
29
|
"@babel/preset-env": "^7.5.5",
|
|
30
30
|
"@babel/preset-react": "^7.0.0",
|
|
31
31
|
"@babel/preset-typescript": "^7.6.0",
|
|
32
|
+
"@rollup/plugin-image": "^2.0.4",
|
|
32
33
|
"@rollup/plugin-json": "^4.0.0",
|
|
33
34
|
"@storybook/addon-actions": "^5.2.1",
|
|
34
35
|
"@storybook/addon-knobs": "^5.2.5",
|
|
36
|
+
"@storybook/addon-storysource": "^5.3.14",
|
|
35
37
|
"@storybook/react": "^5.2.1",
|
|
36
38
|
"@types/classnames": "^2.2.9",
|
|
37
39
|
"@types/node": "^12.7.5",
|
|
@@ -100,6 +102,7 @@
|
|
|
100
102
|
"classnames": "^2.2.6",
|
|
101
103
|
"html5-file-selector": "^2.1.0",
|
|
102
104
|
"i18n-iso-countries": "^4.3.1",
|
|
105
|
+
"js-cookie": "^2.2.1",
|
|
103
106
|
"libphonenumber-js": "^1.7.29",
|
|
104
107
|
"nanoid": "^2.1.6",
|
|
105
108
|
"ramda": "^0.26.1",
|
package/styles/index.css
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@import url("https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.4.3/css/flag-icon.min.css");
|
|
1
2
|
:root {
|
|
2
3
|
--mdc-theme-primary: #358b76;
|
|
3
4
|
--mdc-theme-secondary: #f05c6a;
|
|
@@ -490,6 +491,10 @@ svg.mdc-button__icon {
|
|
|
490
491
|
.mdc-button--raised.mdc-button--display {
|
|
491
492
|
padding: 0 1.75rem; }
|
|
492
493
|
|
|
494
|
+
.mdc-button {
|
|
495
|
+
background: #358b76;
|
|
496
|
+
background: var(--mdc-theme-primary); }
|
|
497
|
+
|
|
493
498
|
.mdc-button--outlined.mdc-button--display {
|
|
494
499
|
padding: 0 calc(1.75rem - 2px); }
|
|
495
500
|
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
|
-
import cn from "classnames";
|
|
3
|
-
import css from "styled-jsx/css";
|
|
4
|
-
import { useTheme, getColorToken } from "../../theme/theme";
|
|
5
|
-
/* A standard text anchor */
|
|
6
|
-
const Anchor = forwardRef(function Anchor({ href, children, color = "primary", invert, className, ...rest }, ref) {
|
|
7
|
-
const theme = useTheme();
|
|
8
|
-
const foreground = getColorToken(theme, "foreground", color, { invert });
|
|
9
|
-
const scope = css.resolve `
|
|
10
|
-
a,
|
|
11
|
-
a:visited {
|
|
12
|
-
color: ${foreground};
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
15
|
-
return (<a href={href || "#"} className={cn(className, scope.className)} {...rest} ref={ref}>
|
|
16
|
-
{children}
|
|
17
|
-
<style jsx>{`
|
|
18
|
-
a:hover,
|
|
19
|
-
a:focus {
|
|
20
|
-
text-decoration: underline;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
a:focus,
|
|
24
|
-
a:active {
|
|
25
|
-
outline: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
a:active {
|
|
29
|
-
text-decoration: none;
|
|
30
|
-
}
|
|
31
|
-
`}</style>
|
|
32
|
-
{scope.styles}
|
|
33
|
-
</a>);
|
|
34
|
-
});
|
|
35
|
-
export default Anchor;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import { Anchor } from "./index";
|
|
4
|
-
export default {
|
|
5
|
-
title: "Anchor",
|
|
6
|
-
decorators: [CenterDecorator],
|
|
7
|
-
component: Anchor,
|
|
8
|
-
};
|
|
9
|
-
export const anchor = () => <Anchor href="#">Start fundraising</Anchor>;
|
|
10
|
-
anchor.story = {
|
|
11
|
-
name: "default",
|
|
12
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
|
-
import cn from "classnames";
|
|
3
|
-
import { useTheme, getColorToken } from "../../theme/theme";
|
|
4
|
-
import css from "styled-jsx/css";
|
|
5
|
-
/* A bold anchor that turns green when active/focused */
|
|
6
|
-
const BoldAnchor = forwardRef(function EmboldenAnchor({ className, href, children, active, color = "primary", invert, analyticsId, id, ...rest }, ref) {
|
|
7
|
-
const theme = useTheme();
|
|
8
|
-
if (process.env.NODE_ENV !== "production") {
|
|
9
|
-
if (id && analyticsId) {
|
|
10
|
-
console.warn("[BoldAnchor] only one of the `id` and `analyticsId` props can be passed. Please remove one as `analyticsId` will override the id.");
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
const scope = css.resolve `
|
|
14
|
-
a {
|
|
15
|
-
position: relative;
|
|
16
|
-
text-decoration: none;
|
|
17
|
-
color: inherit;
|
|
18
|
-
font-weight: 500;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
a:hover,
|
|
22
|
-
a:focus,
|
|
23
|
-
a:active,
|
|
24
|
-
a.active {
|
|
25
|
-
color: ${getColorToken(theme, "foreground", color, { invert })};
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
return (<a ref={ref} href={href || "#"} className={cn("bold-anchor", className, scope.className, { active })} id={analyticsId || id} {...rest}>
|
|
29
|
-
{children}
|
|
30
|
-
{scope.styles}
|
|
31
|
-
</a>);
|
|
32
|
-
});
|
|
33
|
-
export default BoldAnchor;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import { BoldAnchor } from "./index";
|
|
4
|
-
export default {
|
|
5
|
-
title: "BoldAnchor",
|
|
6
|
-
decorators: [CenterDecorator],
|
|
7
|
-
};
|
|
8
|
-
export const boldAnchor = () => (<BoldAnchor href="#">Start fundraising</BoldAnchor>);
|
|
9
|
-
boldAnchor.story = {
|
|
10
|
-
name: "default",
|
|
11
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import ImageAvatar from "./image-avatar";
|
|
3
|
-
import TextAvatar from "./text-avatar";
|
|
4
|
-
/* Used to represent a user */
|
|
5
|
-
function Avatar(props) {
|
|
6
|
-
if (isImageAvatar(props)) {
|
|
7
|
-
return <ImageAvatar {...props}/>;
|
|
8
|
-
}
|
|
9
|
-
return <TextAvatar {...props}/>;
|
|
10
|
-
}
|
|
11
|
-
function isImageAvatar(props) {
|
|
12
|
-
return "src" in props && typeof props.src !== "undefined";
|
|
13
|
-
}
|
|
14
|
-
export default Avatar;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import ImageAvatar from "./image-avatar";
|
|
4
|
-
import TextAvatar from "./text-avatar";
|
|
5
|
-
import src from "./ipet-photo-CfDAo3C3bvQ-unsplash.jpg";
|
|
6
|
-
export default {
|
|
7
|
-
title: "Avatar",
|
|
8
|
-
decorators: [CenterDecorator],
|
|
9
|
-
};
|
|
10
|
-
export const imageAvatar = () => (<ImageAvatar name="Adorable Puppy" src={src}/>);
|
|
11
|
-
imageAvatar.story = {
|
|
12
|
-
name: "image avatar",
|
|
13
|
-
};
|
|
14
|
-
export const textAvatar = () => <TextAvatar name="Adorable Puppy"/>;
|
|
15
|
-
textAvatar.story = {
|
|
16
|
-
name: "text avatar",
|
|
17
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import css from "styled-jsx/css";
|
|
3
|
-
import cn from "classnames";
|
|
4
|
-
import { ON_BACKGROUND_GREY_GREY } from "../../theme/colors";
|
|
5
|
-
/* An avatar with an image */
|
|
6
|
-
function ImageAvatar({ name, src, size = "2.5rem", ...rest }) {
|
|
7
|
-
const scope = css.resolve `
|
|
8
|
-
.avatar {
|
|
9
|
-
border-radius: 100%;
|
|
10
|
-
display: inline-block;
|
|
11
|
-
overflow: hidden;
|
|
12
|
-
border: 1px solid ${ON_BACKGROUND_GREY_GREY};
|
|
13
|
-
line-height: 0;
|
|
14
|
-
vertical-align: top;
|
|
15
|
-
width: ${size};
|
|
16
|
-
height: ${size};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
img {
|
|
20
|
-
width: 100%;
|
|
21
|
-
height: 100%;
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
return (<span className={cn("avatar", scope.className)} title={name} {...rest}>
|
|
25
|
-
<img className={scope.className} alt={name} src={src}/>
|
|
26
|
-
{scope.styles}
|
|
27
|
-
</span>);
|
|
28
|
-
}
|
|
29
|
-
export default ImageAvatar;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Avatar } from "./avatar";
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import css from "styled-jsx/css";
|
|
3
|
-
import cn from "classnames";
|
|
4
|
-
import { useTheme, getColorToken } from "../../theme/theme";
|
|
5
|
-
/* An avatar that shows initials, usually for when there is no photo available */
|
|
6
|
-
function TextAvatar({ name, initials, color = "primary", invert, size = "2.5rem", ...rest }) {
|
|
7
|
-
const theme = useTheme();
|
|
8
|
-
if (!initials) {
|
|
9
|
-
initials = name
|
|
10
|
-
.split(/\s+/)
|
|
11
|
-
.filter(str => str.length)
|
|
12
|
-
.map(str => str[0].toUpperCase())
|
|
13
|
-
.join("");
|
|
14
|
-
}
|
|
15
|
-
const foreground = getColorToken(theme, "foreground", color, { invert });
|
|
16
|
-
const background = getColorToken(theme, "background", color, { invert });
|
|
17
|
-
const scope = css.resolve `
|
|
18
|
-
.text-avatar {
|
|
19
|
-
width: ${size};
|
|
20
|
-
height: ${size};
|
|
21
|
-
background-color: ${foreground};
|
|
22
|
-
color: ${background};
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
return (<span className={cn("text-avatar", scope.className)} title={name} {...rest}>
|
|
26
|
-
<span className="name">{initials}</span>
|
|
27
|
-
<style jsx>{`
|
|
28
|
-
.text-avatar {
|
|
29
|
-
border-radius: 100%;
|
|
30
|
-
display: inline-flex;
|
|
31
|
-
overflow: hidden;
|
|
32
|
-
line-height: 0;
|
|
33
|
-
vertical-align: top;
|
|
34
|
-
|
|
35
|
-
justify-content: center;
|
|
36
|
-
align-items: center;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.name {
|
|
40
|
-
font-size: 1rem;
|
|
41
|
-
user-select: none;
|
|
42
|
-
}
|
|
43
|
-
`}</style>
|
|
44
|
-
{scope.styles}
|
|
45
|
-
</span>);
|
|
46
|
-
}
|
|
47
|
-
export default TextAvatar;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import classnames from "classnames";
|
|
3
|
-
import css from "styled-jsx/css";
|
|
4
|
-
import MDCButton from "@material/react-button";
|
|
5
|
-
import { useTheme, getColorToken } from "../../theme/theme";
|
|
6
|
-
import { tapEvent } from "../../utils/tap-event";
|
|
7
|
-
/**
|
|
8
|
-
* Button
|
|
9
|
-
*
|
|
10
|
-
* Customised version of @material/react-button
|
|
11
|
-
* see: https://github.com/material-components/material-components-web-react/tree/master/packages/button
|
|
12
|
-
*
|
|
13
|
-
* When using this button you must also include the accompanying `button.scss`.
|
|
14
|
-
*/
|
|
15
|
-
function Button({ control, display, large, color = "primary", invert, raised, unelevated, outlined, className, icon, trailingIcon, onMouseOver, onMouseOut, analyticsId, id, ...rest }) {
|
|
16
|
-
const theme = useTheme();
|
|
17
|
-
if (process.env.NODE_ENV !== "production") {
|
|
18
|
-
if (id && analyticsId) {
|
|
19
|
-
console.warn("[Button] only one of the `id` and `analyticsId` props can be passed. Please remove one as `analyticsId` will override the id.");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const [hovered, setHovered] = useState();
|
|
23
|
-
const handleMouseOver = tapEvent(() => setHovered(true), onMouseOver);
|
|
24
|
-
const handleMouseOut = tapEvent(() => setHovered(false), onMouseOut);
|
|
25
|
-
// Handle icon colors
|
|
26
|
-
const foreground = getColorToken(theme, "foreground", color, {
|
|
27
|
-
invert,
|
|
28
|
-
});
|
|
29
|
-
const background = getColorToken(theme, "background", color, {
|
|
30
|
-
invert,
|
|
31
|
-
});
|
|
32
|
-
icon = setIconColor(icon, {
|
|
33
|
-
color,
|
|
34
|
-
invert,
|
|
35
|
-
unelevated,
|
|
36
|
-
raised,
|
|
37
|
-
outlined,
|
|
38
|
-
hovered,
|
|
39
|
-
});
|
|
40
|
-
trailingIcon = setIconColor(trailingIcon, {
|
|
41
|
-
color,
|
|
42
|
-
invert,
|
|
43
|
-
unelevated,
|
|
44
|
-
raised,
|
|
45
|
-
outlined,
|
|
46
|
-
hovered,
|
|
47
|
-
});
|
|
48
|
-
const scope = css.resolve `
|
|
49
|
-
.button {
|
|
50
|
-
--mdc-theme-primary: ${foreground};
|
|
51
|
-
--mdc-theme-on-primary: ${background};
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
const props = {
|
|
55
|
-
className: classnames("button", {
|
|
56
|
-
"mdc-button--display": display,
|
|
57
|
-
"mdc-button--large": large,
|
|
58
|
-
"mdc-button--control": control,
|
|
59
|
-
}, className, scope.className),
|
|
60
|
-
id: analyticsId || id,
|
|
61
|
-
raised,
|
|
62
|
-
unelevated,
|
|
63
|
-
outlined: outlined,
|
|
64
|
-
icon: icon,
|
|
65
|
-
trailingIcon: trailingIcon,
|
|
66
|
-
onMouseOver: handleMouseOver,
|
|
67
|
-
onMouseOut: handleMouseOut,
|
|
68
|
-
...rest,
|
|
69
|
-
};
|
|
70
|
-
return (<>
|
|
71
|
-
<MDCButton {...props}/>
|
|
72
|
-
{scope.styles}
|
|
73
|
-
</>);
|
|
74
|
-
}
|
|
75
|
-
export default Button;
|
|
76
|
-
function setIconColor(icon, { color, invert, unelevated, raised, outlined, hovered, }) {
|
|
77
|
-
if (!icon) {
|
|
78
|
-
return icon;
|
|
79
|
-
}
|
|
80
|
-
icon = React.cloneElement(icon, { color: icon.props.color || color });
|
|
81
|
-
if (unelevated || raised || (hovered && outlined)) {
|
|
82
|
-
icon = React.cloneElement(icon, { invert: !invert });
|
|
83
|
-
}
|
|
84
|
-
return icon;
|
|
85
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import Matrix from "../../utils/component-matrix";
|
|
4
|
-
import Button from "./button";
|
|
5
|
-
import Icon from "../icon/icon";
|
|
6
|
-
export default {
|
|
7
|
-
title: "Button",
|
|
8
|
-
decorators: [CenterDecorator],
|
|
9
|
-
};
|
|
10
|
-
export const types = () => {
|
|
11
|
-
let props = {
|
|
12
|
-
primary: [
|
|
13
|
-
{ children: "Text button" },
|
|
14
|
-
{ children: "Outlined button", outlined: true },
|
|
15
|
-
{ children: "Unelevated button", unelevated: true },
|
|
16
|
-
{ children: "Raised button", raised: true },
|
|
17
|
-
],
|
|
18
|
-
secondary: [{}],
|
|
19
|
-
};
|
|
20
|
-
return (<Matrix {...props}>
|
|
21
|
-
{props => <Button {...props}/>}
|
|
22
|
-
</Matrix>);
|
|
23
|
-
};
|
|
24
|
-
types.story = {
|
|
25
|
-
name: "types",
|
|
26
|
-
};
|
|
27
|
-
export const disabled = () => {
|
|
28
|
-
let props = {
|
|
29
|
-
primary: [
|
|
30
|
-
{ children: "Text button" },
|
|
31
|
-
{ children: "Outlined button", outlined: true },
|
|
32
|
-
{ children: "Unelevated button", unelevated: true },
|
|
33
|
-
{ children: "Raised button", raised: true },
|
|
34
|
-
],
|
|
35
|
-
secondary: [{ disabled: true }],
|
|
36
|
-
};
|
|
37
|
-
return (<Matrix {...props}>
|
|
38
|
-
{props => <Button {...props}/>}
|
|
39
|
-
</Matrix>);
|
|
40
|
-
};
|
|
41
|
-
disabled.story = {
|
|
42
|
-
name: "disabled",
|
|
43
|
-
};
|
|
44
|
-
export const sizes = () => {
|
|
45
|
-
let props = {
|
|
46
|
-
primary: [
|
|
47
|
-
{ children: "Dense", dense: true },
|
|
48
|
-
{ children: "Normal" },
|
|
49
|
-
{ children: "Display", display: true },
|
|
50
|
-
{ children: "Large", large: true },
|
|
51
|
-
],
|
|
52
|
-
secondary: [{}, { outlined: true }, { unelevated: true }, { raised: true }],
|
|
53
|
-
};
|
|
54
|
-
return (<Matrix {...props}>
|
|
55
|
-
{props => <Button {...props}/>}
|
|
56
|
-
</Matrix>);
|
|
57
|
-
};
|
|
58
|
-
sizes.story = {
|
|
59
|
-
name: "sizes",
|
|
60
|
-
};
|
|
61
|
-
export const colors = () => {
|
|
62
|
-
let props = {
|
|
63
|
-
primary: [
|
|
64
|
-
{ children: "Neutral", color: "neutral" },
|
|
65
|
-
{ children: "Primary", color: "primary" },
|
|
66
|
-
{ children: "Secondary", color: "secondary" },
|
|
67
|
-
{ children: "Accent", color: "accent" },
|
|
68
|
-
{
|
|
69
|
-
children: "Custom",
|
|
70
|
-
color: { foreground: "#3C5A99", background: "#ffffff" },
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
secondary: [{}, { outlined: true }, { unelevated: true }, { raised: true }],
|
|
74
|
-
};
|
|
75
|
-
return (<Matrix {...props}>
|
|
76
|
-
{props => <Button {...props}/>}
|
|
77
|
-
</Matrix>);
|
|
78
|
-
};
|
|
79
|
-
colors.story = {
|
|
80
|
-
name: "colors",
|
|
81
|
-
};
|
|
82
|
-
export const icon = () => {
|
|
83
|
-
let props = {
|
|
84
|
-
primary: [
|
|
85
|
-
{ icon: <Icon icon="card_giftcard"/>, children: "Voucher" },
|
|
86
|
-
{ trailingIcon: <Icon icon="favorite_border"/>, children: "Thanks" },
|
|
87
|
-
],
|
|
88
|
-
secondary: [{}, { outlined: true }, { unelevated: true }, { raised: true }],
|
|
89
|
-
};
|
|
90
|
-
return (<Matrix {...props}>
|
|
91
|
-
{props => <Button {...props}/>}
|
|
92
|
-
</Matrix>);
|
|
93
|
-
};
|
|
94
|
-
icon.story = {
|
|
95
|
-
name: "with icon",
|
|
96
|
-
};
|
|
97
|
-
export const controlButton = () => <Button control>Control</Button>;
|
|
98
|
-
controlButton.story = {
|
|
99
|
-
name: "control button",
|
|
100
|
-
};
|
|
101
|
-
export const controlButtonDense = () => (<Button control dense>
|
|
102
|
-
Control
|
|
103
|
-
</Button>);
|
|
104
|
-
controlButtonDense.story = {
|
|
105
|
-
name: "control button dense",
|
|
106
|
-
};
|
|
107
|
-
export const example1 = () => (<Button raised display color="secondary">
|
|
108
|
-
Start fundraising
|
|
109
|
-
</Button>);
|
|
110
|
-
example1.story = {
|
|
111
|
-
name: "start fundraising",
|
|
112
|
-
};
|
|
113
|
-
export const example2 = () => (<Button outlined display color="primary">
|
|
114
|
-
Become a partner (free)
|
|
115
|
-
</Button>);
|
|
116
|
-
example2.story = {
|
|
117
|
-
name: "become a partner",
|
|
118
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Button } from "./button";
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import classnames from "classnames";
|
|
3
|
-
import css from "styled-jsx/css";
|
|
4
|
-
import nanoid from "nanoid";
|
|
5
|
-
import { useTheme, getColorToken } from "../../theme/theme";
|
|
6
|
-
import { Flex } from "../layout";
|
|
7
|
-
import { Text } from "../text";
|
|
8
|
-
import MDCCheckbox from "@material/react-checkbox";
|
|
9
|
-
const Checkbox = ({ id, label, color = "primary", checked, className, ...rest }) => {
|
|
10
|
-
const theme = useTheme();
|
|
11
|
-
const [mainId, setmainId] = useState("");
|
|
12
|
-
const setColor = getColorToken(theme, "foreground", color);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
setmainId(id ? id : nanoid());
|
|
15
|
-
}, [id, setmainId]);
|
|
16
|
-
const scope = css.resolve `
|
|
17
|
-
.checkbox {
|
|
18
|
-
--mdc-theme-primary: ${setColor};
|
|
19
|
-
--mdc-theme-secondary: ${setColor};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.checkbox-label {
|
|
23
|
-
flex-grow: 1;
|
|
24
|
-
flex-shrink: 1;
|
|
25
|
-
margin-left: 0.25rem;
|
|
26
|
-
cursor: pointer;
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
return (<Flex align="center">
|
|
30
|
-
<MDCCheckbox className={classnames(className, "checkbox", scope.className)} checked={checked} nativeControlId={mainId} {...rest}/>
|
|
31
|
-
{label && (<label className={classnames(scope.className, "checkbox-label")} htmlFor={mainId}>
|
|
32
|
-
<Text font="brand" kind="sub" span>
|
|
33
|
-
{label}
|
|
34
|
-
</Text>
|
|
35
|
-
</label>)}
|
|
36
|
-
{scope.styles}
|
|
37
|
-
</Flex>);
|
|
38
|
-
};
|
|
39
|
-
export default Checkbox;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React, { useState, Fragment } from "react";
|
|
2
|
-
import CheckBox from "./checkbox";
|
|
3
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
4
|
-
export default {
|
|
5
|
-
title: "CheckBox",
|
|
6
|
-
decorators: [CenterDecorator],
|
|
7
|
-
};
|
|
8
|
-
export const CheckBoxStoriesDefault = () => {
|
|
9
|
-
const [isChecked, setChecked] = useState(true);
|
|
10
|
-
const handleClick = (event) => {
|
|
11
|
-
setChecked(event.target.checked);
|
|
12
|
-
};
|
|
13
|
-
return (<Fragment>
|
|
14
|
-
<CheckBox onChange={handleClick} checked={isChecked} color="primary"/>
|
|
15
|
-
<CheckBox onChange={handleClick} checked={isChecked} color="secondary"/>
|
|
16
|
-
<CheckBox onChange={handleClick} checked={isChecked} color="muted"/>
|
|
17
|
-
</Fragment>);
|
|
18
|
-
};
|
|
19
|
-
CheckBoxStoriesDefault.story = {
|
|
20
|
-
name: "default",
|
|
21
|
-
};
|
|
22
|
-
export const CheckBoxStoriesLabel = () => {
|
|
23
|
-
const [isChecked, setChecked] = useState(true);
|
|
24
|
-
const handleClick = (event) => {
|
|
25
|
-
setChecked(event.target.checked);
|
|
26
|
-
};
|
|
27
|
-
return (<Fragment>
|
|
28
|
-
<CheckBox label="Checkbox Story" onChange={handleClick} checked={isChecked}/>
|
|
29
|
-
</Fragment>);
|
|
30
|
-
};
|
|
31
|
-
CheckBoxStoriesLabel.story = {
|
|
32
|
-
name: "with label",
|
|
33
|
-
};
|
|
34
|
-
export const CheckBoxStoriesDisabled = () => {
|
|
35
|
-
return (<Fragment>
|
|
36
|
-
<CheckBox disabled={true} checked={false}/>
|
|
37
|
-
<CheckBox disabled={true} checked={true}/>
|
|
38
|
-
</Fragment>);
|
|
39
|
-
};
|
|
40
|
-
CheckBoxStoriesDisabled.story = {
|
|
41
|
-
name: "disabled",
|
|
42
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Checkbox } from "./checkbox";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import classnames from "classnames";
|
|
3
|
-
import css from "styled-jsx/css";
|
|
4
|
-
import { Chip as MDCChip, } from "@material/react-chips";
|
|
5
|
-
import { useTheme } from "../../theme/theme";
|
|
6
|
-
function Chip({ className, leadingIcon, trailingIcon, ...props }) {
|
|
7
|
-
const theme = useTheme();
|
|
8
|
-
const scope = css.resolve `
|
|
9
|
-
.mdc-chip {
|
|
10
|
-
font-family: ${theme.typography.fontFamily.brand};
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
// default icon sizes to 18px
|
|
14
|
-
if (leadingIcon) {
|
|
15
|
-
leadingIcon = React.cloneElement(leadingIcon, {
|
|
16
|
-
size: leadingIcon.props.size || "18px",
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
if (trailingIcon) {
|
|
20
|
-
trailingIcon = React.cloneElement(trailingIcon, {
|
|
21
|
-
size: trailingIcon.props.size || "18px",
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return (<>
|
|
25
|
-
<MDCChip className={classnames(scope.className, className)} leadingIcon={leadingIcon} trailingIcon={trailingIcon} {...props}/>
|
|
26
|
-
{scope.styles}
|
|
27
|
-
</>);
|
|
28
|
-
}
|
|
29
|
-
Chip.defaultProps = MDCChip.defaultProps;
|
|
30
|
-
export default Chip;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ChipSet } from "@material/react-chips";
|
|
3
|
-
import Chip from "./chip";
|
|
4
|
-
function Chips({ value, onChange, options, children, ...rest }) {
|
|
5
|
-
if (options) {
|
|
6
|
-
children = options.map(option => <Chip key={option.id} {...option}/>);
|
|
7
|
-
}
|
|
8
|
-
const props = {
|
|
9
|
-
selectedChipIds: value,
|
|
10
|
-
handleSelect: onChange,
|
|
11
|
-
children: children,
|
|
12
|
-
...rest,
|
|
13
|
-
};
|
|
14
|
-
return <ChipSet {...props}/>;
|
|
15
|
-
}
|
|
16
|
-
export default Chips;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import Chips from "./chips";
|
|
4
|
-
import Chip from "./chip";
|
|
5
|
-
export default {
|
|
6
|
-
title: "Chips",
|
|
7
|
-
decorators: [CenterDecorator],
|
|
8
|
-
};
|
|
9
|
-
export const chips = () => (<Chips>
|
|
10
|
-
<Chip id="summer" label="Summer"/>
|
|
11
|
-
<Chip id="winter" label="Winter"/>
|
|
12
|
-
</Chips>);
|
|
13
|
-
chips.story = {
|
|
14
|
-
name: "default",
|
|
15
|
-
};
|
|
16
|
-
export const ChoiceChips = () => {
|
|
17
|
-
const [selected, setSelected] = useState(["summer"]);
|
|
18
|
-
return (<Chips choice value={selected} onChange={setSelected} options={[
|
|
19
|
-
{ id: "summer", label: "Summer" },
|
|
20
|
-
{ id: "winter", label: "Winter" },
|
|
21
|
-
]}></Chips>);
|
|
22
|
-
};
|
|
23
|
-
ChoiceChips.story = {
|
|
24
|
-
name: "choice",
|
|
25
|
-
};
|
|
26
|
-
export const FilterChips = () => {
|
|
27
|
-
const [selected, setSelected] = useState(["summer"]);
|
|
28
|
-
return (<Chips filter value={selected} onChange={setSelected}>
|
|
29
|
-
<Chip id="summer" label="Summer"/>
|
|
30
|
-
<Chip id="winter" label="Winter"/>
|
|
31
|
-
</Chips>);
|
|
32
|
-
};
|
|
33
|
-
FilterChips.story = {
|
|
34
|
-
name: "filter",
|
|
35
|
-
};
|