@mycause/ui 0.0.0-c7de8cef → 0.0.0-c7f1270a
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 +106 -0
- package/README.md +9 -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 +1 -0
- package/dist/components/comment-section/comment-section.stories.d.ts +6 -0
- package/dist/components/comment-section/index.d.ts +1 -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/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/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 +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 +14 -0
- 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 +7 -2
- package/dist/components/list/list.stories.d.ts +2 -2
- package/dist/components/logo/logo-type.d.ts +2 -1
- package/dist/components/modal/modal.d.ts +1 -1
- 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-sign-in-control.d.ts +3 -2
- package/dist/components/navigation/navigation.d.ts +2 -0
- package/dist/components/navigation/navigation.stories.d.ts +6 -0
- package/dist/components/partner-dashboard-chart/chart.d.ts +3 -0
- package/dist/components/{phone-number-input/phone-number-field.stories.d.ts → partner-dashboard-chart/chart.stories.d.ts} +2 -1
- package/dist/components/partner-dashboard-chart/index.d.ts +1 -0
- package/dist/components/phone-number-input/phone-number-input.d.ts +2 -1
- 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/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/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/index.esm.js +21647 -1735
- package/dist/index.js +21664 -1735
- package/dist/theme/theme.d.ts +4 -0
- package/package.json +1 -1
- package/styles/index.css +4 -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/button-select/button-select.jsx +0 -34
- package/dist/components/button-select/button-select.stories.jsx +0 -39
- package/dist/components/button-select/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/comment-section/comment-section.jsx +0 -95
- package/dist/components/comment-section/comment-section.stories.jsx +0 -97
- package/dist/components/comment-section/index.js +0 -1
- package/dist/components/cropper/cropper.jsx +0 -10
- 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 -24
- 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 -22
- package/dist/components/icon/facebook_6.svg.jsx +0 -14
- 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 -28
- 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 -55
- 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 -59
- 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 -126
- 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 -270
- 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.d.ts +0 -23
- 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.d.ts +0 -2
- package/dist/components/phone-number-field/util.js +0 -19
- package/dist/components/phone-number-input/index.js +0 -2
- package/dist/components/phone-number-input/phone-number-field.d.ts +0 -23
- package/dist/components/phone-number-input/phone-number-field.jsx +0 -50
- package/dist/components/phone-number-input/phone-number-field.stories.jsx +0 -16
- package/dist/components/phone-number-input/phone-number-input.jsx +0 -75
- package/dist/components/phone-number-input/phone-number-input.stories.jsx +0 -23
- package/dist/components/phone-number-input/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 -150
- 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
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { withKnobs, boolean, text } from "@storybook/addon-knobs";
|
|
3
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
4
|
-
import PhoneNumberField from "./phone-number-field";
|
|
5
|
-
export default {
|
|
6
|
-
title: "PhoneNumberField",
|
|
7
|
-
decorators: [CenterDecorator, withKnobs],
|
|
8
|
-
};
|
|
9
|
-
export const PhoneNumberFieldStory = () => {
|
|
10
|
-
const [values, setValues] = useState({
|
|
11
|
-
number: "",
|
|
12
|
-
countryCallingCode: "",
|
|
13
|
-
country: "",
|
|
14
|
-
});
|
|
15
|
-
const label = text("Label", "Phone number");
|
|
16
|
-
const required = boolean("Required", false);
|
|
17
|
-
const helperText = text("Helper Text", "Enter an Australian or international phone number.");
|
|
18
|
-
const error = text("Error text", "");
|
|
19
|
-
return (<PhoneNumberField values={values} onChange={(value, name) => setValues(values => ({ ...values, [name]: value }))} label={label} helperText={helperText} required={required} error={error || null}/>);
|
|
20
|
-
};
|
|
21
|
-
PhoneNumberFieldStory.story = {
|
|
22
|
-
name: "default",
|
|
23
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { parsePhoneNumberFromString, } from "libphonenumber-js";
|
|
2
|
-
export function parseNationalPhoneNumber(phoneNumber, countryCallingCode, defaultCountry) {
|
|
3
|
-
let number;
|
|
4
|
-
// Try with the country code
|
|
5
|
-
if (countryCallingCode) {
|
|
6
|
-
number = parsePhoneNumberFromString("+" + countryCallingCode + phoneNumber, defaultCountry);
|
|
7
|
-
if (number && number.isValid())
|
|
8
|
-
return number;
|
|
9
|
-
}
|
|
10
|
-
// Try clipping the intital "0" from the number, if there is one
|
|
11
|
-
if ((countryCallingCode && phoneNumber.startsWith("0"), defaultCountry)) {
|
|
12
|
-
number = parsePhoneNumberFromString("+" + countryCallingCode + phoneNumber.substr(1));
|
|
13
|
-
if (number && number.isValid())
|
|
14
|
-
return number;
|
|
15
|
-
}
|
|
16
|
-
// Finally just try the number by itself
|
|
17
|
-
number = parsePhoneNumberFromString(phoneNumber, defaultCountry);
|
|
18
|
-
return number || null;
|
|
19
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { CountryCode } from "libphonenumber-js";
|
|
3
|
-
declare type PhoneNumberFieldProps = {
|
|
4
|
-
values: {
|
|
5
|
-
number: string;
|
|
6
|
-
countryCallingCode: string;
|
|
7
|
-
country: string;
|
|
8
|
-
};
|
|
9
|
-
names?: {
|
|
10
|
-
number: string;
|
|
11
|
-
countryCallingCode: string;
|
|
12
|
-
country: string;
|
|
13
|
-
};
|
|
14
|
-
onChange: (value: string, name: string) => void;
|
|
15
|
-
label?: React.ReactNode;
|
|
16
|
-
error?: string | null;
|
|
17
|
-
onBlur?: (e: React.FocusEvent) => void;
|
|
18
|
-
helperText?: React.ReactNode;
|
|
19
|
-
required?: boolean;
|
|
20
|
-
defaultCountry?: CountryCode;
|
|
21
|
-
};
|
|
22
|
-
declare function PhoneNumberField({ onChange, values, names, error, onBlur, helperText, label, required, defaultCountry, }: PhoneNumberFieldProps): JSX.Element;
|
|
23
|
-
export default PhoneNumberField;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import countries from "i18n-iso-countries";
|
|
3
|
-
import en from "i18n-iso-countries/langs/en.json";
|
|
4
|
-
import { AsYouType } from "libphonenumber-js";
|
|
5
|
-
import { FieldLabel, FieldHelperText } from "../field-helpers";
|
|
6
|
-
import { ComboField, ComboFieldExpander } from "../combo-field";
|
|
7
|
-
import { Box } from "../layout";
|
|
8
|
-
import { Select } from "../select";
|
|
9
|
-
import { TextField } from "../text-field";
|
|
10
|
-
countries.registerLocale(en);
|
|
11
|
-
const COUNTRY_CODES = Object.keys(countries.getAlpha2Codes()).sort();
|
|
12
|
-
function PhoneNumberField({ onChange, values, names = {
|
|
13
|
-
number: "number",
|
|
14
|
-
countryCallingCode: "countryCallingCode",
|
|
15
|
-
country: "country",
|
|
16
|
-
}, error, onBlur, helperText, label, required, defaultCountry = "AU", }) {
|
|
17
|
-
const format = (text, c) => {
|
|
18
|
-
const typer = new AsYouType(c || defaultCountry);
|
|
19
|
-
const formatted = typer.input(text);
|
|
20
|
-
let result = typer.getNumber();
|
|
21
|
-
if (result && result.isValid()) {
|
|
22
|
-
// When the user has typed in a full valid number,
|
|
23
|
-
// emit the country calling code and set the country explicitly
|
|
24
|
-
onChange(result.country, names.country);
|
|
25
|
-
onChange(result.format("NATIONAL"), names.number);
|
|
26
|
-
onChange(result.countryCallingCode, names.countryCallingCode);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
onChange(formatted, names.number);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const handleCountryChange = (e) => {
|
|
33
|
-
onChange(e.target.value || "", names.country);
|
|
34
|
-
format(values.number, e.target.value);
|
|
35
|
-
};
|
|
36
|
-
const handleTextChange = (e) => {
|
|
37
|
-
format(e.target.value, values.country);
|
|
38
|
-
};
|
|
39
|
-
return (<Box>
|
|
40
|
-
{label ? <FieldLabel required={required}>{label}</FieldLabel> : null}
|
|
41
|
-
<ComboField>
|
|
42
|
-
<Select options={COUNTRY_CODES} value={values.country} onChange={handleCountryChange} noArrow onBlur={onBlur} required={required}/>
|
|
43
|
-
<ComboFieldExpander>
|
|
44
|
-
<TextField type="tel" value={values.number} onChange={handleTextChange} name={names.number} onBlur={onBlur} error={!!error} required={required}/>
|
|
45
|
-
</ComboFieldExpander>
|
|
46
|
-
</ComboField>
|
|
47
|
-
{helperText ? (<FieldHelperText error={error}>{helperText}</FieldHelperText>) : null}
|
|
48
|
-
</Box>);
|
|
49
|
-
}
|
|
50
|
-
export default PhoneNumberField;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import PhoneNumberInput from "./phone-number-input";
|
|
4
|
-
export default {
|
|
5
|
-
title: "PhoneNumberInput",
|
|
6
|
-
decorators: [CenterDecorator],
|
|
7
|
-
};
|
|
8
|
-
export const PhoneNumberInputStory = () => {
|
|
9
|
-
const [values, setValues] = useState("");
|
|
10
|
-
return (<div style={{ width: "313px" }}>
|
|
11
|
-
<PhoneNumberInput value={values} onChange={setValues} preferredCountries={["au"]} label="Phone number" placeholder="Enter phone number" helperText="Enter an Australian or international phone number."/>
|
|
12
|
-
</div>);
|
|
13
|
-
};
|
|
14
|
-
PhoneNumberInputStory.story = {
|
|
15
|
-
name: "default",
|
|
16
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import countries from "i18n-iso-countries";
|
|
3
|
-
import en from "i18n-iso-countries/langs/en.json";
|
|
4
|
-
import { AsYouType } from "libphonenumber-js";
|
|
5
|
-
import { FieldLabel, FieldHelperText } from "../field-helpers";
|
|
6
|
-
import { ComboField, ComboFieldExpander } from "../combo-field";
|
|
7
|
-
import { Box } from "../layout";
|
|
8
|
-
import { Select } from "../select";
|
|
9
|
-
import { TextField } from "../text-field";
|
|
10
|
-
// Set up country options.
|
|
11
|
-
countries.registerLocale(en);
|
|
12
|
-
const getCountryNames = countries.getNames("en");
|
|
13
|
-
const COUNTRY_CODES = Object.keys(countries.getAlpha2Codes()).sort();
|
|
14
|
-
let countryOptions = COUNTRY_CODES.map(key => {
|
|
15
|
-
return {
|
|
16
|
-
label: getCountryNames[key],
|
|
17
|
-
value: key,
|
|
18
|
-
};
|
|
19
|
-
}).filter(res => res.value != "AU");
|
|
20
|
-
countryOptions.unshift({ label: "Australia", value: "AU" });
|
|
21
|
-
function PhoneNumberInput({ onChange, values, names = {
|
|
22
|
-
number: "number",
|
|
23
|
-
countryCallingCode: "countryCallingCode",
|
|
24
|
-
country: "country",
|
|
25
|
-
}, error, onBlur, helperText, label, required, defaultCountry = "AU", }) {
|
|
26
|
-
const format = (text, c) => {
|
|
27
|
-
const typer = new AsYouType(c || defaultCountry);
|
|
28
|
-
const formatted = typer.input(text);
|
|
29
|
-
let result = typer.getNumber();
|
|
30
|
-
if (result && result.isValid()) {
|
|
31
|
-
// When the user has typed in a full valid number,
|
|
32
|
-
// emit the country calling code and set the country explicitly
|
|
33
|
-
onChange(result.country, names.country);
|
|
34
|
-
onChange(result.format("NATIONAL"), names.number);
|
|
35
|
-
onChange(result.countryCallingCode, names.countryCallingCode);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
onChange(formatted, names.number);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const handleCountryChange = (e) => {
|
|
42
|
-
onChange(e.target.value || "", names.country);
|
|
43
|
-
format(values.number, e.target.value);
|
|
44
|
-
};
|
|
45
|
-
const handleTextChange = (e) => {
|
|
46
|
-
format(e.target.value, values.country);
|
|
47
|
-
};
|
|
48
|
-
return (<Box>
|
|
49
|
-
{label ? <FieldLabel required={required}>{label}</FieldLabel> : null}
|
|
50
|
-
<span className={`flag-icon flag-icon-${values.country.toLowerCase()}`}></span>
|
|
51
|
-
<ComboField className="combofield-phonenumber-input">
|
|
52
|
-
<Select options={countryOptions} value={values.country} onChange={handleCountryChange} noArrow onBlur={onBlur} required={required}/>
|
|
53
|
-
<ComboFieldExpander>
|
|
54
|
-
<TextField type="tel" value={values.number} onChange={handleTextChange} name={names.number} onBlur={onBlur} error={!!error} required={required}/>
|
|
55
|
-
</ComboFieldExpander>
|
|
56
|
-
</ComboField>
|
|
57
|
-
{helperText ? <FieldHelperText>{helperText}</FieldHelperText> : null}
|
|
58
|
-
{error ? <FieldHelperText error={error}/> : null}
|
|
59
|
-
<style jsx>{`
|
|
60
|
-
.flag-icon {
|
|
61
|
-
position: relative;
|
|
62
|
-
top: 40px;
|
|
63
|
-
right: 78px;
|
|
64
|
-
}
|
|
65
|
-
:global(.combofield-phonenumber-input
|
|
66
|
-
> .select
|
|
67
|
-
> .mdc-select
|
|
68
|
-
> .mdc-select__native-control) {
|
|
69
|
-
opacity: 0;
|
|
70
|
-
max-width: 55px;
|
|
71
|
-
}
|
|
72
|
-
`}</style>
|
|
73
|
-
</Box>);
|
|
74
|
-
}
|
|
75
|
-
export default PhoneNumberInput;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import { boolean, text } from "@storybook/addon-knobs";
|
|
4
|
-
import PhoneNumberInput from "./phone-number-input";
|
|
5
|
-
export default {
|
|
6
|
-
title: "PhoneNumberInput",
|
|
7
|
-
decorators: [CenterDecorator],
|
|
8
|
-
};
|
|
9
|
-
export const PhoneNumberInputStory = () => {
|
|
10
|
-
const [values, setValues] = useState({
|
|
11
|
-
number: "",
|
|
12
|
-
countryCallingCode: "",
|
|
13
|
-
country: "AU",
|
|
14
|
-
});
|
|
15
|
-
const label = text("Label", "Phone number");
|
|
16
|
-
const required = boolean("Required", false);
|
|
17
|
-
const helperText = text("Helper Text", "Enter an Australian or international phone number.");
|
|
18
|
-
const error = text("Error text", "");
|
|
19
|
-
return (<PhoneNumberInput values={values} onChange={(value, name) => setValues(values => ({ ...values, [name]: value }))} label={label} helperText={helperText} required={required} error={error || null}/>);
|
|
20
|
-
};
|
|
21
|
-
PhoneNumberInputStory.story = {
|
|
22
|
-
name: "default",
|
|
23
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { parsePhoneNumberFromString, } from "libphonenumber-js";
|
|
2
|
-
export function parseNationalPhoneNumber(phoneNumber, countryCallingCode, defaultCountry) {
|
|
3
|
-
let number;
|
|
4
|
-
// Try with the country code
|
|
5
|
-
if (countryCallingCode) {
|
|
6
|
-
number = parsePhoneNumberFromString("+" + countryCallingCode + phoneNumber, defaultCountry);
|
|
7
|
-
if (number && number.isValid())
|
|
8
|
-
return number;
|
|
9
|
-
}
|
|
10
|
-
// Try clipping the intital "0" from the number, if there is one
|
|
11
|
-
if ((countryCallingCode && phoneNumber.startsWith("0"), defaultCountry)) {
|
|
12
|
-
number = parsePhoneNumberFromString("+" + countryCallingCode + phoneNumber.substr(1));
|
|
13
|
-
if (number && number.isValid())
|
|
14
|
-
return number;
|
|
15
|
-
}
|
|
16
|
-
// Finally just try the number by itself
|
|
17
|
-
number = parsePhoneNumberFromString(phoneNumber, defaultCountry);
|
|
18
|
-
return number || null;
|
|
19
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Radio from "./radio";
|
|
3
|
-
import { Flex } from "../layout";
|
|
4
|
-
function RadioGroup({ name, value, onChange, options, onBlur, onFocus, disabled, ...rest }) {
|
|
5
|
-
return (<Flex direction="column" {...rest}>
|
|
6
|
-
{options.map(option => (<Radio key={option.value} checked={option.value === value} label={option.label} name={name} value={option.value} onBlur={onBlur} onFocus={onFocus} onChange={onChange} disabled={disabled || option.disabled}/>))}
|
|
7
|
-
</Flex>);
|
|
8
|
-
}
|
|
9
|
-
export default RadioGroup;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import RadioGroup from "./radio-group";
|
|
3
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
4
|
-
export default {
|
|
5
|
-
title: "RadioGroup",
|
|
6
|
-
decorators: [CenterDecorator],
|
|
7
|
-
};
|
|
8
|
-
export const RadioGroupStory = () => {
|
|
9
|
-
const [value, setValue] = useState("");
|
|
10
|
-
return (<RadioGroup value={value} onChange={e => {
|
|
11
|
-
console.log(e.target.value);
|
|
12
|
-
setValue(e.target.value);
|
|
13
|
-
}} options={[
|
|
14
|
-
{ value: "1", label: "This is option one" },
|
|
15
|
-
{ value: "2", label: "This is the second option" },
|
|
16
|
-
{ value: "3", label: "This is the last option" },
|
|
17
|
-
]}/>);
|
|
18
|
-
};
|
|
19
|
-
RadioGroupStory.story = {
|
|
20
|
-
name: "default",
|
|
21
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React, { Fragment, useState, useEffect } from "react";
|
|
2
|
-
import MDCRadio, { NativeRadioControl as MDCNativeRadioControl, } from "@material/react-radio";
|
|
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 Radio = ({ id = "", color = "primary", label = "", value, name, className, wrapperClasses, ...rest }) => {
|
|
8
|
-
const [mainId, setMainId] = useState("");
|
|
9
|
-
const theme = useTheme();
|
|
10
|
-
const setColor = getColorToken(theme, "foreground", color);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
setMainId(id || (name && value ? `name__${value}` : nanoid()));
|
|
13
|
-
}, [id, setMainId, name, value]);
|
|
14
|
-
const scope = css.resolve `
|
|
15
|
-
.mdc-radio {
|
|
16
|
-
--mdc-theme-secondary: ${setColor};
|
|
17
|
-
}
|
|
18
|
-
.mdc-form-field :global(label) {
|
|
19
|
-
font-family: ${theme.typography.fontFamily.brand};
|
|
20
|
-
font-weight: 500;
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
return (<Fragment>
|
|
25
|
-
<MDCRadio wrapperClasses={classnames(wrapperClasses, scope.className)} className={classnames(className, scope.className)} value={value} label={label} key={mainId}>
|
|
26
|
-
<MDCNativeRadioControl className={classnames(className)} value={value} name={name} id={mainId} {...rest}/>
|
|
27
|
-
</MDCRadio>
|
|
28
|
-
{scope.styles}
|
|
29
|
-
</Fragment>);
|
|
30
|
-
};
|
|
31
|
-
export default Radio;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { useState, Fragment } from "react";
|
|
2
|
-
import CenterDecorator from "../../utils/center-decorator";
|
|
3
|
-
import Radio from "./radio";
|
|
4
|
-
export default {
|
|
5
|
-
title: "Radio",
|
|
6
|
-
decorators: [CenterDecorator],
|
|
7
|
-
};
|
|
8
|
-
export const RadioExample = () => {
|
|
9
|
-
const [checked, setChecked] = useState(false);
|
|
10
|
-
const handleClick = (event) => {
|
|
11
|
-
let targetValue = event.target.value ? true : false;
|
|
12
|
-
setChecked(targetValue);
|
|
13
|
-
};
|
|
14
|
-
return (<Fragment>
|
|
15
|
-
<Radio checked={checked} value="primary" onChange={handleClick}/>
|
|
16
|
-
<Radio color="secondary" checked={checked} value="secondary" onChange={handleClick}/>
|
|
17
|
-
<Radio color="muted" checked={checked} value="muted" onChange={handleClick}/>
|
|
18
|
-
</Fragment>);
|
|
19
|
-
};
|
|
20
|
-
RadioExample.story = {
|
|
21
|
-
name: "default",
|
|
22
|
-
};
|
|
23
|
-
export const RadioLabelExample = () => {
|
|
24
|
-
const [checked, setChecked] = useState(false);
|
|
25
|
-
const handleClick = (event) => {
|
|
26
|
-
let targetValue = event.target.value ? true : false;
|
|
27
|
-
setChecked(targetValue);
|
|
28
|
-
};
|
|
29
|
-
return (<Fragment>
|
|
30
|
-
<Radio label="Radio with Label" checked={checked} value="withLabel" onChange={handleClick}/>
|
|
31
|
-
</Fragment>);
|
|
32
|
-
};
|
|
33
|
-
RadioLabelExample.story = {
|
|
34
|
-
name: "with label",
|
|
35
|
-
};
|
|
36
|
-
export const RadioDisabledExample = () => {
|
|
37
|
-
return (<Fragment>
|
|
38
|
-
<Radio disabled={true} checked={true}/>
|
|
39
|
-
<Radio disabled={true} checked={false}/>
|
|
40
|
-
</Fragment>);
|
|
41
|
-
};
|
|
42
|
-
RadioDisabledExample.story = {
|
|
43
|
-
name: "disabled",
|
|
44
|
-
};
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import React 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 { useTheme } from "../../theme/theme";
|
|
6
|
-
import SelectHelperText from "./select-helper-text";
|
|
7
|
-
import { FieldLabel, FieldHelperText } from "../field-helpers";
|
|
8
|
-
const Select = function Select({ label = "", value, onChange, helperText, isHelperTextPersistent, externalLabel, id, className, options, large = false, required, leadingIcon, noArrow, error = false, ...rest }) {
|
|
9
|
-
const theme = useTheme();
|
|
10
|
-
let errorMessage = null;
|
|
11
|
-
// If options has been provided as an array of strings, convert it into an array of objects
|
|
12
|
-
if (isStringArray(options)) {
|
|
13
|
-
options = options.map((option) => ({
|
|
14
|
-
value: option,
|
|
15
|
-
label: option,
|
|
16
|
-
}));
|
|
17
|
-
}
|
|
18
|
-
// Add an empty default value
|
|
19
|
-
if (value === "" && !options.find(option => option.value === "")) {
|
|
20
|
-
options = [
|
|
21
|
-
{
|
|
22
|
-
value: "",
|
|
23
|
-
label: "",
|
|
24
|
-
disabled: true,
|
|
25
|
-
},
|
|
26
|
-
...options,
|
|
27
|
-
];
|
|
28
|
-
}
|
|
29
|
-
if (leadingIcon) {
|
|
30
|
-
leadingIcon = <SelectIcon tag="span">{leadingIcon}</SelectIcon>;
|
|
31
|
-
}
|
|
32
|
-
// If helperText is passed as a string turn it into a HelperText
|
|
33
|
-
// helperText=null or helperText="" indicates that there should be empty helper text (for layout reasons)
|
|
34
|
-
if (typeof helperText === "string" || helperText === null) {
|
|
35
|
-
helperText = (<SelectHelperText persistent={isHelperTextPersistent}>
|
|
36
|
-
{helperText}
|
|
37
|
-
</SelectHelperText>);
|
|
38
|
-
}
|
|
39
|
-
if (typeof error === "string") {
|
|
40
|
-
errorMessage = <FieldHelperText error={error}/>;
|
|
41
|
-
}
|
|
42
|
-
const scope = css.resolve `
|
|
43
|
-
.select :global(.mdc-select__native-control) {
|
|
44
|
-
border: ${error && "2px solid #b00020 !important"};
|
|
45
|
-
}
|
|
46
|
-
.select :global(.mdc-select__native-control),
|
|
47
|
-
.select :global(.mdc-floating-label) {
|
|
48
|
-
font-weight: 500;
|
|
49
|
-
font-family: ${theme.typography.fontFamily.brand};
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
/**
|
|
53
|
-
* This is a fix for the Material Component Bug in firefox
|
|
54
|
-
* untill they address this we have to handle the onChange
|
|
55
|
-
* of select with onClick.
|
|
56
|
-
*/
|
|
57
|
-
const handler = getFirefoxSelectBugHHandler(value, onChange);
|
|
58
|
-
return (<div className={classnames("select", scope.className)}>
|
|
59
|
-
{externalLabel && label ? (<FieldLabel large={large} htmlFor={id} required={required}>
|
|
60
|
-
{label}
|
|
61
|
-
</FieldLabel>) : null}
|
|
62
|
-
<MDCSelect label={externalLabel ? "" : label} value={value} enhanced={false} onChange={handler} onClick={handler} id={id} outlined required={required} className={classnames(className, {
|
|
63
|
-
"mdc-select--dense": !large,
|
|
64
|
-
"mdc-select--no-arrow": noArrow,
|
|
65
|
-
})} leadingIcon={leadingIcon} helperText={!error ? helperText : undefined} {...rest}>
|
|
66
|
-
{options.map(option => (<Option key={option.value} {...option}>
|
|
67
|
-
{option.label}
|
|
68
|
-
</Option>))}
|
|
69
|
-
</MDCSelect>
|
|
70
|
-
{errorMessage}
|
|
71
|
-
<style jsx>{`
|
|
72
|
-
.select {
|
|
73
|
-
display: flex;
|
|
74
|
-
flex-direction: column;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.select-label {
|
|
78
|
-
font-size: 0.875rem;
|
|
79
|
-
margin: 0.5rem 0;
|
|
80
|
-
display: inline-block;
|
|
81
|
-
font-weight: 400;
|
|
82
|
-
letter-spacing: 0.00937em;
|
|
83
|
-
color: rgba(0, 0, 0, 0.6);
|
|
84
|
-
text-align: left;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.select-label--dense {
|
|
88
|
-
font-size: 0.75rem;
|
|
89
|
-
}
|
|
90
|
-
`}</style>
|
|
91
|
-
{scope.styles}
|
|
92
|
-
</div>);
|
|
93
|
-
};
|
|
94
|
-
export default Select;
|
|
95
|
-
function isStringArray(arr) {
|
|
96
|
-
// Note this only tests that at least one item in the array is a string
|
|
97
|
-
// This only works under the assumption that the array does not contain mixed types
|
|
98
|
-
return arr.some((option) => typeof option === "string");
|
|
99
|
-
}
|
|
100
|
-
function getFirefoxSelectBugHHandler(value, handler) {
|
|
101
|
-
let events = {
|
|
102
|
-
click: null,
|
|
103
|
-
change: null,
|
|
104
|
-
};
|
|
105
|
-
let values = {
|
|
106
|
-
click: "",
|
|
107
|
-
change: "",
|
|
108
|
-
};
|
|
109
|
-
let flushed = false;
|
|
110
|
-
let handle = null;
|
|
111
|
-
const flush = () => {
|
|
112
|
-
if (events.change && !events.click) {
|
|
113
|
-
events.change.target.value = values.change;
|
|
114
|
-
handler(events.change);
|
|
115
|
-
}
|
|
116
|
-
else if (events.change && values.change && values.change !== value) {
|
|
117
|
-
handler(events.change);
|
|
118
|
-
}
|
|
119
|
-
else if (events.click && values.click && values.click !== value) {
|
|
120
|
-
handler(events.click);
|
|
121
|
-
}
|
|
122
|
-
else if (events.change && !values.click && !values.change && value) {
|
|
123
|
-
handler(events.change);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
return (e) => {
|
|
127
|
-
switch (e.type) {
|
|
128
|
-
case "click":
|
|
129
|
-
values.click = e.target.value;
|
|
130
|
-
events.click = e;
|
|
131
|
-
break;
|
|
132
|
-
case "change":
|
|
133
|
-
values.change = e.currentTarget.value;
|
|
134
|
-
events.change = e;
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
if (events.click && events.change) {
|
|
138
|
-
flush();
|
|
139
|
-
}
|
|
140
|
-
if (!handle) {
|
|
141
|
-
// This flush is required if the user used the keyboard to select
|
|
142
|
-
// as no click event would have been dispatched
|
|
143
|
-
handle = requestAnimationFrame(() => {
|
|
144
|
-
if (!flushed) {
|
|
145
|
-
flush();
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
@@ -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;
|