@mycause/ui 0.0.0-ce837d6b → 0.0.0-cf802939
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 +225 -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 +14 -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/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/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/footerV2/footerV2.d.ts +32 -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 +18 -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/{phone-number-field/phone-number-field.stories.d.ts → info-represent-campaign/info-represent-campaign.stories.d.ts} +1 -1
- 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/modal.d.ts +4 -3
- package/dist/components/modal/modal.stories.d.ts +6 -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 +1 -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-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 +11 -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/phone-number-input/index.d.ts +2 -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 +13 -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/progressbar.d.ts +8 -0
- package/dist/components/progressbar/progressbar.stories.d.ts +14 -0
- package/dist/components/select/select.d.ts +2 -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/statistics/statistics.d.ts +2 -1
- 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/text-field.d.ts +1 -0
- package/dist/index.esm.js +9570 -6554
- package/dist/index.js +9296 -6261
- 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,138 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
|
-
import classnames from "classnames";
|
|
3
|
-
import css from "styled-jsx/css";
|
|
4
|
-
import { useTheme, getColorToken, } from "../../theme/theme";
|
|
5
|
-
import { flags } from "../../utils/flags";
|
|
6
|
-
import { wrap } from "../../utils/wrap";
|
|
7
|
-
import Box from "../layout/box";
|
|
8
|
-
// Wrap the text in modifier elements like bold or italic
|
|
9
|
-
function addWrappers(node, { underline, strike, bold, italic }) {
|
|
10
|
-
let result = node;
|
|
11
|
-
result = wrap(result, "u", underline);
|
|
12
|
-
result = wrap(result, "s", strike);
|
|
13
|
-
result = wrap(result, "b", bold);
|
|
14
|
-
result = wrap(result, "i", italic);
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
const kinds = {
|
|
18
|
-
display1: `
|
|
19
|
-
font-size: 3rem;
|
|
20
|
-
line-height: 3.5rem;
|
|
21
|
-
`,
|
|
22
|
-
display2: `
|
|
23
|
-
font-size: 2.25rem;
|
|
24
|
-
line-height: 3rem;
|
|
25
|
-
`,
|
|
26
|
-
h1: `
|
|
27
|
-
font-size: 2.25rem;
|
|
28
|
-
line-height: 3rem;
|
|
29
|
-
font-weight: bold;
|
|
30
|
-
`,
|
|
31
|
-
h2: `
|
|
32
|
-
font-size: 1.75rem;
|
|
33
|
-
line-height: 2rem;
|
|
34
|
-
font-weight: bold;
|
|
35
|
-
`,
|
|
36
|
-
h3: `
|
|
37
|
-
font-size: 1.25rem;
|
|
38
|
-
line-height: 2rem;
|
|
39
|
-
font-weight: bold;
|
|
40
|
-
`,
|
|
41
|
-
h4: `
|
|
42
|
-
font-size: 1rem;
|
|
43
|
-
line-height: 1.5rem;
|
|
44
|
-
font-weight: bold;
|
|
45
|
-
`,
|
|
46
|
-
h5: `
|
|
47
|
-
font-size: 0.875rem;
|
|
48
|
-
line-height: 1.5rem;
|
|
49
|
-
font-weight: bold;
|
|
50
|
-
`,
|
|
51
|
-
h6: `
|
|
52
|
-
font-size: 0.875rem;
|
|
53
|
-
line-height: 1.5rem;
|
|
54
|
-
font-weight: bold;
|
|
55
|
-
`,
|
|
56
|
-
p: `
|
|
57
|
-
font-size: 1rem;
|
|
58
|
-
line-height: 1.5rem;
|
|
59
|
-
`,
|
|
60
|
-
sub: `
|
|
61
|
-
font-size: 0.875rem;
|
|
62
|
-
line-height: 1.25rem;
|
|
63
|
-
`,
|
|
64
|
-
small: `
|
|
65
|
-
font-size: 0.75rem;
|
|
66
|
-
line-height: 1.25rem;
|
|
67
|
-
`,
|
|
68
|
-
fine: `
|
|
69
|
-
font-size: 0.675rem;
|
|
70
|
-
line-height: 1rem;
|
|
71
|
-
`,
|
|
72
|
-
span: ``,
|
|
73
|
-
};
|
|
74
|
-
const Text = forwardRef(function Text({ elem: element, kind, font, align,
|
|
75
|
-
// component types
|
|
76
|
-
h1, h2, h3, h4, h5, h6, p, small, span,
|
|
77
|
-
// modifiers
|
|
78
|
-
underline, strike, bold, italic,
|
|
79
|
-
// color
|
|
80
|
-
color, invert,
|
|
81
|
-
//
|
|
82
|
-
children, className, ...rest }, ref) {
|
|
83
|
-
const theme = useTheme();
|
|
84
|
-
// Process component type flags, defaulting to span
|
|
85
|
-
element = flags({ h1, h2, h3, h4, h5, h6, p, small, span }, element || "span");
|
|
86
|
-
// If no kind is specified, just use the kind named after the element
|
|
87
|
-
kind = kind || element;
|
|
88
|
-
// Headings are already bold so prevent wrapping an extra <b> element
|
|
89
|
-
if (isHeading(element) && bold) {
|
|
90
|
-
bold = false;
|
|
91
|
-
}
|
|
92
|
-
// The h6 style has a different color by default
|
|
93
|
-
if (kind === "h6") {
|
|
94
|
-
color = color || "muted";
|
|
95
|
-
}
|
|
96
|
-
const foreground = color || invert
|
|
97
|
-
? getColorToken(theme, "foreground", color || "neutral", {
|
|
98
|
-
invert,
|
|
99
|
-
})
|
|
100
|
-
: "inherit";
|
|
101
|
-
const fontFamily = font
|
|
102
|
-
? theme.typography.fontFamily[font]
|
|
103
|
-
: "inherit";
|
|
104
|
-
const scope = css.resolve `
|
|
105
|
-
${element} {
|
|
106
|
-
font-weight: initial;
|
|
107
|
-
font-family: ${fontFamily};
|
|
108
|
-
color: ${foreground};
|
|
109
|
-
${kinds[kind]}
|
|
110
|
-
margin: 0;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.unbold {
|
|
114
|
-
font-weight: 400;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.align {
|
|
118
|
-
text-align: ${align};
|
|
119
|
-
}
|
|
120
|
-
`;
|
|
121
|
-
return (<Box as={element} {...rest} className={classnames(className, {
|
|
122
|
-
unbold: isHeading(element) && bold === false,
|
|
123
|
-
align: align,
|
|
124
|
-
}, scope.className)}
|
|
125
|
-
// The following error is caused by the fact that the element rendered
|
|
126
|
-
// could be either a HTMLElement or HTMLHeadingElement but it cannot know
|
|
127
|
-
// which at runtime. In practice the difference between the two elements
|
|
128
|
-
// never really arises as an issue.
|
|
129
|
-
// @ts-ignore
|
|
130
|
-
ref={ref}>
|
|
131
|
-
{addWrappers(children, { underline, strike, bold, italic })}
|
|
132
|
-
{scope.styles}
|
|
133
|
-
</Box>);
|
|
134
|
-
});
|
|
135
|
-
function isHeading(kind) {
|
|
136
|
-
return kind.startsWith("h");
|
|
137
|
-
}
|
|
138
|
-
export default Text;
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { withKnobs, select, boolean, text } from "@storybook/addon-knobs";
|
|
3
|
-
import Text from "./text";
|
|
4
|
-
import { useTheme } from "../../theme/theme";
|
|
5
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
6
|
-
export default {
|
|
7
|
-
title: "Text",
|
|
8
|
-
decorators: [withKnobs],
|
|
9
|
-
};
|
|
10
|
-
export const TextStory = () => {
|
|
11
|
-
const contents = text("Contents", "Hello");
|
|
12
|
-
const elem = select("Element", {
|
|
13
|
-
Span: "span",
|
|
14
|
-
"Heading 1": "h1",
|
|
15
|
-
"Heading 2": "h2",
|
|
16
|
-
"Heading 3": "h3",
|
|
17
|
-
"Heading 4": "h4",
|
|
18
|
-
"Heading 5": "h5",
|
|
19
|
-
"Heading 6": "h6",
|
|
20
|
-
Paragraph: "p",
|
|
21
|
-
Small: "small",
|
|
22
|
-
}, "span");
|
|
23
|
-
const kind = select("Kind", [
|
|
24
|
-
"default",
|
|
25
|
-
"display1",
|
|
26
|
-
"display2",
|
|
27
|
-
"h1",
|
|
28
|
-
"h2",
|
|
29
|
-
"h3",
|
|
30
|
-
"h4",
|
|
31
|
-
"h5",
|
|
32
|
-
"h6",
|
|
33
|
-
"p",
|
|
34
|
-
"sub",
|
|
35
|
-
"small",
|
|
36
|
-
"fine",
|
|
37
|
-
], "default");
|
|
38
|
-
const align = select("Align", ["default", "left", "right", "center", "justify"], "default");
|
|
39
|
-
const underline = boolean("Underline", false);
|
|
40
|
-
const strike = boolean("Strike", false);
|
|
41
|
-
const bold = boolean("Bold", false);
|
|
42
|
-
const italic = boolean("Italic", false);
|
|
43
|
-
return (<div className="container">
|
|
44
|
-
<Text elem={elem} kind={kind !== "default" ? kind : undefined} align={align !== "default" ? align : undefined} underline={underline} strike={strike} bold={bold} italic={italic}>
|
|
45
|
-
{contents}
|
|
46
|
-
</Text>
|
|
47
|
-
<style jsx>{`
|
|
48
|
-
.container {
|
|
49
|
-
width: 100%;
|
|
50
|
-
max-width: 20rem;
|
|
51
|
-
}
|
|
52
|
-
`}</style>
|
|
53
|
-
</div>);
|
|
54
|
-
};
|
|
55
|
-
TextStory.story = {
|
|
56
|
-
name: "default",
|
|
57
|
-
decorators: [CenterDecorator],
|
|
58
|
-
};
|
|
59
|
-
function Article({ children }) {
|
|
60
|
-
const theme = useTheme();
|
|
61
|
-
return (<div className="article">
|
|
62
|
-
{children}
|
|
63
|
-
<style jsx>{`
|
|
64
|
-
.article {
|
|
65
|
-
font-family: ${theme.typography.fontFamily.default};
|
|
66
|
-
}
|
|
67
|
-
`}</style>
|
|
68
|
-
<style jsx>{`
|
|
69
|
-
.article {
|
|
70
|
-
max-width: 42rem;
|
|
71
|
-
margin: 2rem auto;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.article > :global(*:not(:last-child)) {
|
|
75
|
-
display: block;
|
|
76
|
-
margin-bottom: 1rem;
|
|
77
|
-
}
|
|
78
|
-
`}</style>
|
|
79
|
-
</div>);
|
|
80
|
-
}
|
|
81
|
-
export const kinds = () => (<Article>
|
|
82
|
-
<Text p kind="display1">
|
|
83
|
-
Display 1
|
|
84
|
-
</Text>
|
|
85
|
-
<Text p kind="display2">
|
|
86
|
-
Display 2
|
|
87
|
-
</Text>
|
|
88
|
-
<Text h1>Heading 1</Text>
|
|
89
|
-
<Text h2>Heading 2</Text>
|
|
90
|
-
<Text h3>Heading 3</Text>
|
|
91
|
-
<Text h4>Heading 4</Text>
|
|
92
|
-
<Text h5>Heading 5</Text>
|
|
93
|
-
<Text h6>Heading 6</Text>
|
|
94
|
-
<Text p>Para</Text>
|
|
95
|
-
<Text p kind="sub">
|
|
96
|
-
Sub
|
|
97
|
-
</Text>
|
|
98
|
-
<Text small>Small</Text>
|
|
99
|
-
<Text small kind="fine">
|
|
100
|
-
Fine
|
|
101
|
-
</Text>
|
|
102
|
-
</Article>);
|
|
103
|
-
kinds.story = {
|
|
104
|
-
name: "all kinds",
|
|
105
|
-
};
|
|
106
|
-
export const titles = () => (<Article>
|
|
107
|
-
<Text p kind="display1">
|
|
108
|
-
Display 1
|
|
109
|
-
</Text>
|
|
110
|
-
<Text p kind="display2">
|
|
111
|
-
Display 2
|
|
112
|
-
</Text>
|
|
113
|
-
<Text h1>Heading 1</Text>
|
|
114
|
-
<Text h2>Heading 2</Text>
|
|
115
|
-
<Text h3>Heading 3</Text>
|
|
116
|
-
<Text h4>Heading 4</Text>
|
|
117
|
-
<Text h5>Heading 5</Text>
|
|
118
|
-
<Text h6>Heading 6</Text>
|
|
119
|
-
</Article>);
|
|
120
|
-
titles.story = {
|
|
121
|
-
name: "title kinds",
|
|
122
|
-
};
|
|
123
|
-
export const paras = () => (<Article>
|
|
124
|
-
<Text h1>Body text</Text>
|
|
125
|
-
<Text h5>p (paragraph)</Text>
|
|
126
|
-
<Text p>
|
|
127
|
-
As the first Australian online fundraising platform, mycause has the most
|
|
128
|
-
experience in many aspects of crowdfunding, including annual Matched
|
|
129
|
-
Giving Days (MGDs). Many charities would benefit greatly from a giving day
|
|
130
|
-
but do not have the knowledge or resources to effectively run it. When you
|
|
131
|
-
hold your MGD with mycause, you get advice based on experience, project
|
|
132
|
-
management and resources, and so much more.
|
|
133
|
-
</Text>
|
|
134
|
-
<Text h5>sub (sub-paragraph)</Text>
|
|
135
|
-
<Text p kind="sub">
|
|
136
|
-
As the first Australian online fundraising platform, mycause has the most
|
|
137
|
-
experience in many aspects of crowdfunding, including annual Matched
|
|
138
|
-
Giving Days (MGDs). Many charities would benefit greatly from a giving day
|
|
139
|
-
but do not have the knowledge or resources to effectively run it. When you
|
|
140
|
-
hold your MGD with mycause, you get advice based on experience, project
|
|
141
|
-
management and resources, and so much more.
|
|
142
|
-
</Text>
|
|
143
|
-
<Text h5>small (small)</Text>
|
|
144
|
-
<Text small>
|
|
145
|
-
As the first Australian online fundraising platform, mycause has the most
|
|
146
|
-
experience in many aspects of crowdfunding, including annual Matched
|
|
147
|
-
Giving Days (MGDs). Many charities would benefit greatly from a giving day
|
|
148
|
-
but do not have the knowledge or resources to effectively run it. When you
|
|
149
|
-
hold your MGD with mycause, you get advice based on experience, project
|
|
150
|
-
management and resources, and so much more.
|
|
151
|
-
</Text>
|
|
152
|
-
<Text h5>fine (fine print)</Text>
|
|
153
|
-
<Text small kind="fine">
|
|
154
|
-
As the first Australian online fundraising platform, mycause has the most
|
|
155
|
-
experience in many aspects of crowdfunding, including annual Matched
|
|
156
|
-
Giving Days (MGDs). Many charities would benefit greatly from a giving day
|
|
157
|
-
but do not have the knowledge or resources to effectively run it. When you
|
|
158
|
-
hold your MGD with mycause, you get advice based on experience, project
|
|
159
|
-
management and resources, and so much more.
|
|
160
|
-
</Text>
|
|
161
|
-
</Article>);
|
|
162
|
-
paras.story = {
|
|
163
|
-
name: "body text kinds",
|
|
164
|
-
};
|
|
165
|
-
export const modifiers = () => (<Article>
|
|
166
|
-
<Text p kind="sub" bold>
|
|
167
|
-
This is the bold modifier
|
|
168
|
-
</Text>
|
|
169
|
-
<Text p kind="sub" underline>
|
|
170
|
-
This is the underline modifier
|
|
171
|
-
</Text>
|
|
172
|
-
<Text p kind="sub" strike>
|
|
173
|
-
This is the strike modifier
|
|
174
|
-
</Text>
|
|
175
|
-
<Text p kind="sub" italic>
|
|
176
|
-
This is the italic modifier
|
|
177
|
-
</Text>
|
|
178
|
-
</Article>);
|
|
179
|
-
modifiers.story = {
|
|
180
|
-
name: "modifiers",
|
|
181
|
-
};
|
|
182
|
-
export const textArticle = () => (<Article>
|
|
183
|
-
<Text h1>Why choose mycause for your next giving day?</Text>
|
|
184
|
-
<Text p>
|
|
185
|
-
As the first Australian online fundraising platform, mycause has the most
|
|
186
|
-
experience in many aspects of crowdfunding, including annual Matched
|
|
187
|
-
Giving Days (MGDs). Many charities would benefit greatly from a giving day
|
|
188
|
-
but do not have the knowledge or resources to effectively run it. When you
|
|
189
|
-
hold your MGD with mycause, you get advice based on experience, project
|
|
190
|
-
management and resources, and so much more.
|
|
191
|
-
</Text>
|
|
192
|
-
<Text h2>Getting started with your next MGD</Text>
|
|
193
|
-
<Text p>
|
|
194
|
-
mycause will manage your project end-to-end using the online tool
|
|
195
|
-
Basecamp, which we will teach your team to navigate so we can be in
|
|
196
|
-
constant communication and keep track of everything that needs to be done.
|
|
197
|
-
Your team will also have the assistance of their very own mycause account
|
|
198
|
-
manager and a dedicated project officer.
|
|
199
|
-
</Text>
|
|
200
|
-
<Text h2>Our great features</Text>
|
|
201
|
-
<Text p>
|
|
202
|
-
Whether your charity’s MGD consists of one campaign, or the increasingly
|
|
203
|
-
popular Multi-Campaign, mycause will work with you to create a beautifully
|
|
204
|
-
branded campaign page. Your multi-campaign solution will be created using
|
|
205
|
-
our drag and drop website builder for a properly designed parent landing
|
|
206
|
-
page and stand-alone campaign page per child campaign. Your campaign
|
|
207
|
-
website will include an embedded donation widget with Apple Pay capability
|
|
208
|
-
to make it even easier for your supporters to donate.
|
|
209
|
-
</Text>
|
|
210
|
-
<Text h3>Heading 3</Text>
|
|
211
|
-
<Text p>
|
|
212
|
-
If you have influencers who raise money on your behalf, we can create
|
|
213
|
-
branded fundraising pages for each of them connected directly to your
|
|
214
|
-
website so their donations appear in your total automatically. Using our
|
|
215
|
-
receipting system and receipt text and imagery of your choice, mycause
|
|
216
|
-
will automatically send receipts by email to anyone who donates through
|
|
217
|
-
any of your child campaigns, influencer fundraisers or the parent campaign
|
|
218
|
-
page.
|
|
219
|
-
</Text>
|
|
220
|
-
<Text h3>Heading 3</Text>
|
|
221
|
-
<Text p>
|
|
222
|
-
Your giving day campaign also features a branded URL with the option to
|
|
223
|
-
get a brand-new domain name that is redirected to your campaign site or
|
|
224
|
-
page. We recommend a short and memorable domain name that can be added to
|
|
225
|
-
your marketing collateral and told during a volunteer phone room on the
|
|
226
|
-
day of your MGD.
|
|
227
|
-
</Text>
|
|
228
|
-
<Text p>
|
|
229
|
-
In the lead up to your charity’s MGD it is important to get the word out
|
|
230
|
-
with digital marketing. mycause can set up your remarketing, domain
|
|
231
|
-
marketing, look alikes, Gmail and social media ads for a small extra fee.
|
|
232
|
-
We will also give recommendations for organic social media posting,
|
|
233
|
-
included in the project management fee.
|
|
234
|
-
</Text>
|
|
235
|
-
<Text h4>Heading 4</Text>
|
|
236
|
-
<Text h5>Heading 5</Text>
|
|
237
|
-
<Text h6>Heading 6</Text>
|
|
238
|
-
<Text p kind="sub">
|
|
239
|
-
This website is provided by The Giving Network Pty Ltd ACN 115 262 256
|
|
240
|
-
(trading as mycause) and Fribur Pty Ltd ACN 135 047 148, trustee of the My
|
|
241
|
-
Cause Gift Fund, hereinafter referred to as “mycause”, “we”, “our” and
|
|
242
|
-
“us” in these Terms of Use. The term “you” refers to the user or viewer of
|
|
243
|
-
the site.
|
|
244
|
-
</Text>
|
|
245
|
-
<Text small kind="small">
|
|
246
|
-
This website is provided by The Giving Network Pty Ltd ACN 115 262 256
|
|
247
|
-
(trading as mycause) and Fribur Pty Ltd ACN 135 047 148, trustee of the My
|
|
248
|
-
Cause Gift Fund, hereinafter referred to as “mycause”, “we”, “our” and
|
|
249
|
-
“us” in these Terms of Use. The term “you” refers to the user or viewer of
|
|
250
|
-
the site.
|
|
251
|
-
</Text>
|
|
252
|
-
<Text p kind="fine">
|
|
253
|
-
This website is provided by The Giving Network Pty Ltd ACN 115 262 256
|
|
254
|
-
(trading as mycause) and Fribur Pty Ltd ACN 135 047 148, trustee of the My
|
|
255
|
-
Cause Gift Fund, hereinafter referred to as “mycause”, “we”, “our” and
|
|
256
|
-
“us” in these Terms of Use. The term “you” refers to the user or viewer of
|
|
257
|
-
the site.
|
|
258
|
-
</Text>
|
|
259
|
-
</Article>);
|
|
260
|
-
textArticle.story = {
|
|
261
|
-
name: "example",
|
|
262
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { HelperText as MDCHelperText, } from "@material/react-text-field";
|
|
3
|
-
function HelperText({ error, children, ...props }) {
|
|
4
|
-
return (<MDCHelperText isValid={!error} isValidationMessage={!!error} validation={!!error} {...props}>
|
|
5
|
-
{error ? error : children || null}
|
|
6
|
-
</MDCHelperText>);
|
|
7
|
-
}
|
|
8
|
-
export default HelperText;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useCallback } from "react";
|
|
2
|
-
import cn from "classnames";
|
|
3
|
-
import css from "styled-jsx/css";
|
|
4
|
-
import MDCTextField, { Input } from "@material/react-text-field";
|
|
5
|
-
import { setRef } from "../../utils/set-ref";
|
|
6
|
-
import { isInternetExplorer } from "../../utils/browser";
|
|
7
|
-
import { useTheme } from "../../theme/theme";
|
|
8
|
-
import HelperText from "./text-field-helper-text";
|
|
9
|
-
const TextField = forwardRef(function TextField({ fullWidth, helperText, isHelperTextPersistent, characterCounter, label, leadingIcon, onLeadingIconSelect, onTrailingIconSelect, textarea, trailingIcon, large, error, externalLabel, id, required, placeholder, className, ...rest }, ref_) {
|
|
10
|
-
const theme = useTheme();
|
|
11
|
-
let noLabel = false; // nolabel turns the provided label into a placeholder
|
|
12
|
-
let externalLabelContents = null;
|
|
13
|
-
// The floating label has a visual bug in Internet Explorer so we use the external label instead
|
|
14
|
-
if (isInternetExplorer()) {
|
|
15
|
-
externalLabel = true;
|
|
16
|
-
}
|
|
17
|
-
// If helperText is passed as a string turn it into a HelperText
|
|
18
|
-
// If there is an error, it gets rendered into the HelperText
|
|
19
|
-
// use isHelperTextPersistent to ensure the HelperText is always
|
|
20
|
-
// rendered and takes up space for layout reasons.
|
|
21
|
-
if (typeof helperText === "string" ||
|
|
22
|
-
isHelperTextPersistent ||
|
|
23
|
-
(error && typeof error !== "boolean")) {
|
|
24
|
-
helperText = (<HelperText persistent={isHelperTextPersistent}>
|
|
25
|
-
{helperText}
|
|
26
|
-
</HelperText>);
|
|
27
|
-
}
|
|
28
|
-
// Override the HelperText when there is an error
|
|
29
|
-
// When error is a boolean that means we just update the styling of the field,
|
|
30
|
-
// the helper text does not change
|
|
31
|
-
if (error && typeof error !== "boolean") {
|
|
32
|
-
helperText = React.cloneElement(helperText, {
|
|
33
|
-
error,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
// Apply externalLabel
|
|
37
|
-
if (externalLabel) {
|
|
38
|
-
externalLabelContents = label;
|
|
39
|
-
label = undefined;
|
|
40
|
-
}
|
|
41
|
-
// Add the placeholder
|
|
42
|
-
if (placeholder) {
|
|
43
|
-
if (!externalLabel) {
|
|
44
|
-
externalLabelContents = label; // you can't have a floating label and a placeholder at the same time
|
|
45
|
-
}
|
|
46
|
-
label = placeholder;
|
|
47
|
-
noLabel = true;
|
|
48
|
-
}
|
|
49
|
-
let props = {
|
|
50
|
-
outlined: true,
|
|
51
|
-
dense: !large,
|
|
52
|
-
fullWidth,
|
|
53
|
-
helperText: helperText,
|
|
54
|
-
characterCounter,
|
|
55
|
-
label,
|
|
56
|
-
leadingIcon,
|
|
57
|
-
onLeadingIconSelect,
|
|
58
|
-
onTrailingIconSelect,
|
|
59
|
-
textarea,
|
|
60
|
-
trailingIcon,
|
|
61
|
-
id,
|
|
62
|
-
noLabel,
|
|
63
|
-
};
|
|
64
|
-
// useCallback to ensure there is a stable ref
|
|
65
|
-
// The <Input> component has an `inputElement` property which holds
|
|
66
|
-
// the underlying input element node
|
|
67
|
-
let ref = useCallback(setRef(ref_, instance => instance.inputElement), [ref_]);
|
|
68
|
-
const scope = css.resolve `
|
|
69
|
-
.text-field {
|
|
70
|
-
display: flex;
|
|
71
|
-
flex-direction: column;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.text-field :global(.mdc-text-field__input),
|
|
75
|
-
.text-field :global(.mdc-floating-label),
|
|
76
|
-
.text-field :global(.mdc-text-field-helper-text) {
|
|
77
|
-
font-weight: 500;
|
|
78
|
-
font-family: ${theme.typography.fontFamily.brand};
|
|
79
|
-
}
|
|
80
|
-
`;
|
|
81
|
-
return (<div className={cn("text-field", className, scope.className)}>
|
|
82
|
-
{externalLabelContents ? (<ExternalLabel id={id} required={required} dense={!large}>
|
|
83
|
-
{externalLabelContents}
|
|
84
|
-
</ExternalLabel>) : null}
|
|
85
|
-
<MDCTextField {...props}>
|
|
86
|
-
<Input inputType={textarea ? "textarea" : "input"} isValid={!error} id={id} required={required} ref={ref} {...rest}/>
|
|
87
|
-
</MDCTextField>
|
|
88
|
-
{scope.styles}
|
|
89
|
-
</div>);
|
|
90
|
-
});
|
|
91
|
-
function ExternalLabel({ id, dense, required, children }) {
|
|
92
|
-
const theme = useTheme();
|
|
93
|
-
const scope = css.resolve `
|
|
94
|
-
.text-field-label {
|
|
95
|
-
font-family: ${theme.typography.fontFamily.brand};
|
|
96
|
-
font-weight: 500;
|
|
97
|
-
}
|
|
98
|
-
`;
|
|
99
|
-
return (<label className={cn("text-field-label", {
|
|
100
|
-
"text-field-label--dense": dense,
|
|
101
|
-
}, scope.className)} htmlFor={id}>
|
|
102
|
-
{children}
|
|
103
|
-
{required ? "*" : ""}
|
|
104
|
-
<style jsx>{`
|
|
105
|
-
.text-field-label {
|
|
106
|
-
font-size: 0.875rem;
|
|
107
|
-
font-weight: 500;
|
|
108
|
-
margin: 0.5rem 0;
|
|
109
|
-
display: inline-block;
|
|
110
|
-
font-weight: 400;
|
|
111
|
-
letter-spacing: 0.00937em;
|
|
112
|
-
color: rgba(0, 0, 0, 0.6);
|
|
113
|
-
text-align: left;
|
|
114
|
-
line-height: 1rem;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.text-field-label--dense {
|
|
118
|
-
font-size: 0.75rem;
|
|
119
|
-
}
|
|
120
|
-
`}</style>
|
|
121
|
-
{scope.styles}
|
|
122
|
-
</label>);
|
|
123
|
-
}
|
|
124
|
-
export default TextField;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { withKnobs, text, boolean, select } from "@storybook/addon-knobs";
|
|
3
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
4
|
-
import Icon from "../icon/icon";
|
|
5
|
-
import TextField from "./text-field";
|
|
6
|
-
export default {
|
|
7
|
-
title: "TextField",
|
|
8
|
-
decorators: [CenterDecorator, withKnobs],
|
|
9
|
-
};
|
|
10
|
-
export const TextFieldStory = () => {
|
|
11
|
-
const [value, setValue] = useState("");
|
|
12
|
-
const kind = select("Field Type", { Field: "field", TextArea: "textarea" }, "field");
|
|
13
|
-
const large = boolean("Large", false);
|
|
14
|
-
const label = text("Label", "Name");
|
|
15
|
-
const labelKind = select("Label Type", { External: "external", Floating: "floating" }, "floating");
|
|
16
|
-
const required = boolean("Required", false);
|
|
17
|
-
const helperText = text("Helper Text", "Your given name(s).");
|
|
18
|
-
const persistent = boolean("Persistent Helper Text", false);
|
|
19
|
-
const placeholder = text("Placeholder", "");
|
|
20
|
-
// eslint-disable-next-line
|
|
21
|
-
const error = select("Error State", {
|
|
22
|
-
None: undefined,
|
|
23
|
-
"Error with message": "Something is wrong here.",
|
|
24
|
-
"Error without message": true,
|
|
25
|
-
}, undefined);
|
|
26
|
-
const leadingIcon = boolean("Leading Icon", false);
|
|
27
|
-
const trailingIcon = boolean("Trailing Icon", false);
|
|
28
|
-
return (<TextField value={value} onChange={e => setValue(e.currentTarget.value)} label={label} placeholder={placeholder} helperText={helperText} isHelperTextPersistent={persistent} large={large} error={error} externalLabel={labelKind === "external"} required={required} leadingIcon={leadingIcon ? <Icon icon="account_circle"/> : undefined} trailingIcon={trailingIcon ? <Icon icon="visibility_off"/> : undefined} textarea={kind === "textarea"}/>);
|
|
29
|
-
};
|
|
30
|
-
TextFieldStory.story = {
|
|
31
|
-
name: "default",
|
|
32
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Uploader } from "./uploader";
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from "react";
|
|
2
|
-
import Dropzone from "react-dropzone-uploader";
|
|
3
|
-
import { Icon } from "../icon";
|
|
4
|
-
import { Text } from "../text";
|
|
5
|
-
import classnames from "classnames";
|
|
6
|
-
import css from "styled-jsx/css";
|
|
7
|
-
import * as html5FileSelector from "html5-file-selector";
|
|
8
|
-
const { getDroppedOrSelectedFiles } = html5FileSelector;
|
|
9
|
-
import { useTheme, getColorToken } from "../../theme/theme";
|
|
10
|
-
const Uploader = ({ color = "primary", width, height, getUploadParams, onChangeStatus, multiple, maxFiles, fontSize, iconSize, accept, customIcon = "cloud_upload", dragAndDropMessage, hasBrowseButton, browsButtonMessage = {
|
|
11
|
-
noFiles: "Choose files",
|
|
12
|
-
hasFiles: "Add more files",
|
|
13
|
-
}, }) => {
|
|
14
|
-
const theme = useTheme();
|
|
15
|
-
const setColor = getColorToken(theme, "foreground", color);
|
|
16
|
-
const brandFont = theme.typography.fontFamily.brand;
|
|
17
|
-
const scope = css.resolve `
|
|
18
|
-
.dropzone-custom-wrapper {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
align-items: center;
|
|
22
|
-
width: ${width ? width : "100%"};
|
|
23
|
-
min-height: ${height ? height : "120px"};
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
margin: 0 auto;
|
|
26
|
-
position: relative;
|
|
27
|
-
box-sizing: border-box;
|
|
28
|
-
transition: all 0.15s linear;
|
|
29
|
-
border-radius: 4px;
|
|
30
|
-
border: none;
|
|
31
|
-
padding: 10px;
|
|
32
|
-
}
|
|
33
|
-
.dropzone-custom {
|
|
34
|
-
color: ${setColor} !important;
|
|
35
|
-
font-family: ${brandFont};
|
|
36
|
-
display: flex;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
align-items: center;
|
|
39
|
-
position: absolute;
|
|
40
|
-
top: 0;
|
|
41
|
-
bottom: 0;
|
|
42
|
-
left: 0;
|
|
43
|
-
right: 0;
|
|
44
|
-
font-size: ${fontSize ? fontSize : "12px"};
|
|
45
|
-
font-weight: 600;
|
|
46
|
-
color: #2484ff;
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
}
|
|
49
|
-
.dropzone-custom-submit {
|
|
50
|
-
background-color: ${setColor} !important;
|
|
51
|
-
color: white;
|
|
52
|
-
padding: 10px;
|
|
53
|
-
font-family: ${brandFont};
|
|
54
|
-
border: none;
|
|
55
|
-
border-radius: 5px;
|
|
56
|
-
cursor: pointer;
|
|
57
|
-
font-weight: 600;
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
const Input = ({ accept, onFiles, files, getFilesFromEvent, }) => {
|
|
61
|
-
const { noFiles, hasFiles } = browsButtonMessage;
|
|
62
|
-
const text = files.length > 0 ? hasFiles : noFiles;
|
|
63
|
-
return (<label className={classnames("dropzone-custom-submit", scope.className)}>
|
|
64
|
-
{text}
|
|
65
|
-
<input style={{ display: "none" }} type="file" accept={accept} multiple onChange={(e) => {
|
|
66
|
-
getFilesFromEvent(e).then((chosenFiles) => {
|
|
67
|
-
onFiles(chosenFiles);
|
|
68
|
-
});
|
|
69
|
-
}}/>
|
|
70
|
-
</label>);
|
|
71
|
-
};
|
|
72
|
-
const getFilesFromEvent = (e) => {
|
|
73
|
-
return new Promise((resolve) => {
|
|
74
|
-
getDroppedOrSelectedFiles(e).then((chosenFiles) => {
|
|
75
|
-
resolve(chosenFiles.map((f) => f.fileObject));
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
return (<Fragment>
|
|
80
|
-
<Dropzone classNames={{
|
|
81
|
-
dropzone: classnames("dropzone-custom-wrapper", scope.className),
|
|
82
|
-
inputLabel: classnames("dropzone-custom", scope.className),
|
|
83
|
-
submitButton: classnames("dropzone-custom-submit", scope.className),
|
|
84
|
-
inputLabelWithFiles: classnames("dropzone-custom-submit", scope.className),
|
|
85
|
-
}} getUploadParams={getUploadParams} onChangeStatus={onChangeStatus} accept={accept} multiple={multiple} maxFiles={maxFiles} inputContent={<div style={{ textAlign: "center" }}>
|
|
86
|
-
{dragAndDropMessage && (<Text h3 font="brand">
|
|
87
|
-
{dragAndDropMessage}
|
|
88
|
-
</Text>)}
|
|
89
|
-
<div style={{ padding: "5px" }}>
|
|
90
|
-
<Icon icon={customIcon} size={iconSize} color={setColor}/>
|
|
91
|
-
</div>
|
|
92
|
-
</div>} InputComponent={hasBrowseButton ? Input : undefined} getFilesFromEvent={getFilesFromEvent}/>
|
|
93
|
-
{scope.styles}
|
|
94
|
-
</Fragment>);
|
|
95
|
-
};
|
|
96
|
-
export default Uploader;
|
package/dist/input.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare type Foo = {};
|
package/dist/input.js
DELETED
package/dist/input.jsx
DELETED