@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.
Files changed (258) hide show
  1. package/CHANGELOG.md +225 -0
  2. package/README.md +9 -0
  3. package/dist/components/button-select/button-select.d.ts +12 -0
  4. package/dist/components/button-select/button-select.stories.d.ts +13 -0
  5. package/dist/components/button-select/index.d.ts +1 -0
  6. package/dist/components/campaign-card/campaign-card.d.ts +9 -0
  7. package/dist/components/campaign-card/campaign-card.stories.d.ts +14 -0
  8. package/dist/components/campaign-card/index.d.ts +1 -0
  9. package/dist/components/campaign-of-month/campaign-of-month.d.ts +14 -0
  10. package/dist/components/campaign-of-month/campaign-of-month.stories.d.ts +14 -0
  11. package/dist/components/campaign-of-month/index.d.ts +1 -0
  12. package/dist/components/charity-card/charity-card.d.ts +7 -0
  13. package/dist/components/charity-card/charity-card.stories.d.ts +14 -0
  14. package/dist/components/charity-card/index.d.ts +1 -0
  15. package/dist/components/combo-field/combo-field.d.ts +4 -1
  16. package/dist/components/comment-section/comment-section-v2/comment-section-v2.d.ts +31 -0
  17. package/dist/components/comment-section/comment-section-v2/sub-comments-v2.d.ts +11 -0
  18. package/dist/components/comment-section/comment-section.d.ts +24 -0
  19. package/dist/components/comment-section/comment-section.stories.d.ts +19 -0
  20. package/dist/components/comment-section/index.d.ts +2 -0
  21. package/dist/components/comment-section/sub-comments.d.ts +6 -0
  22. package/dist/components/cropper/cropper.d.ts +5 -4
  23. package/dist/components/cropper/cropper.stories.d.ts +1 -2
  24. package/dist/components/date-picker/single-date-picker.d.ts +3 -2
  25. package/dist/components/donate-card/donate-card.d.ts +8 -0
  26. package/dist/components/donate-card/donate-card.stories.d.ts +14 -0
  27. package/dist/components/donate-card/index.d.ts +1 -0
  28. package/dist/components/donation-form/donation-details.d.ts +12 -0
  29. package/dist/components/donation-form/donation-form-v2/donation-form-v2.d.ts +13 -0
  30. package/dist/components/donation-form/donation-form.d.ts +64 -0
  31. package/dist/components/donation-form/donation-form.stories.d.ts +18 -0
  32. package/dist/components/donation-form/donation-payment.d.ts +13 -0
  33. package/dist/components/donation-form/donation-select.d.ts +13 -0
  34. package/dist/components/donation-form/index.d.ts +2 -0
  35. package/dist/components/elevation/elevation.d.ts +2 -1
  36. package/dist/components/featured-campaign-card/featured-campaign-card.d.ts +17 -0
  37. package/dist/components/featured-campaign-card/featured-campaign-card.stories.d.ts +14 -0
  38. package/dist/components/featured-campaign-card/index.d.ts +1 -0
  39. package/dist/components/footerV2/footerV2.d.ts +32 -0
  40. package/dist/components/footerV2/footerV2.stories.d.ts +15 -0
  41. package/dist/components/footerV2/index.d.ts +1 -0
  42. package/dist/components/fundraising-section/fundraising-section.d.ts +9 -0
  43. package/dist/components/fundraising-section/fundraising-section.stories.d.ts +14 -0
  44. package/dist/components/fundraising-section/index.d.ts +1 -0
  45. package/dist/components/hero-banner/hero-banner.d.ts +9 -0
  46. package/dist/components/hero-banner/hero-banner.stories.d.ts +14 -0
  47. package/dist/components/hero-banner/index.d.ts +1 -0
  48. package/dist/components/horizontalbar/horizontalbar.d.ts +11 -0
  49. package/dist/components/horizontalbar/horizontalbar.stories.d.ts +26 -0
  50. package/dist/components/horizontalbar/index.d.ts +1 -0
  51. package/dist/components/icon/{toggle-button.d.ts → heart-toggle.d.ts} +3 -3
  52. package/dist/components/icon/{toggle-button.stories.d.ts → heart-toggle.stories.d.ts} +1 -1
  53. package/dist/components/icon/index.d.ts +1 -1
  54. package/dist/components/index.d.ts +18 -1
  55. package/dist/components/info-represent-campaign/index.d.ts +1 -0
  56. package/dist/components/info-represent-campaign/info-represent-campaign.d.ts +11 -0
  57. package/dist/components/{phone-number-field/phone-number-field.stories.d.ts → info-represent-campaign/info-represent-campaign.stories.d.ts} +1 -1
  58. package/dist/components/list/list.d.ts +29 -14
  59. package/dist/components/list/list.stories.d.ts +8 -2
  60. package/dist/components/login/index.d.ts +1 -0
  61. package/dist/components/login/login.d.ts +15 -0
  62. package/dist/components/login/login.stories.d.ts +19 -0
  63. package/dist/components/logo/logo-type.d.ts +2 -1
  64. package/dist/components/modal/modal.d.ts +4 -3
  65. package/dist/components/modal/modal.stories.d.ts +6 -0
  66. package/dist/components/nav/icons/IconBigger.d.ts +5 -0
  67. package/dist/components/nav/icons/IconSmaller.d.ts +5 -0
  68. package/dist/components/nav/index.d.ts +1 -0
  69. package/dist/components/nav/nav-actions.d.ts +5 -0
  70. package/dist/components/nav/nav-bar.d.ts +7 -0
  71. package/dist/components/nav/nav-call-to-action.d.ts +5 -0
  72. package/dist/components/nav/nav-expanded-charity.d.ts +13 -0
  73. package/dist/components/nav/nav-expanded.d.ts +14 -0
  74. package/dist/components/nav/nav-list.d.ts +29 -0
  75. package/dist/components/nav/nav-menu-control.d.ts +8 -0
  76. package/dist/components/nav/nav-menu.d.ts +12 -0
  77. package/dist/components/nav/nav-search-control.d.ts +8 -0
  78. package/dist/components/nav/nav-search.d.ts +10 -0
  79. package/dist/components/nav/nav-sign-in-control.d.ts +12 -0
  80. package/dist/components/nav/nav-user-menu-items.d.ts +20 -0
  81. package/dist/components/nav/nav-user-menu.d.ts +18 -0
  82. package/dist/components/nav/nav.d.ts +56 -0
  83. package/dist/components/nav/nav.stories.d.ts +11 -0
  84. package/dist/components/navigation/navigation-list.d.ts +3 -1
  85. package/dist/components/navigation/navigation-menu.d.ts +2 -1
  86. package/dist/components/navigation/navigation-sign-in-control.d.ts +6 -3
  87. package/dist/components/navigation/navigation.d.ts +12 -1
  88. package/dist/components/navigation/navigation.stories.d.ts +3 -21
  89. package/dist/components/phone-number-input/index.d.ts +2 -0
  90. package/dist/components/{phone-number-field/phone-number-field.d.ts → phone-number-input/phone-number-input.d.ts} +5 -3
  91. package/dist/components/phone-number-input/phone-number-input.stories.d.ts +13 -0
  92. package/dist/components/popup/index.d.ts +1 -0
  93. package/dist/components/popup/popup.d.ts +8 -0
  94. package/dist/components/popup/popup.stories.d.ts +14 -0
  95. package/dist/components/progressbar/index.d.ts +1 -0
  96. package/dist/components/progressbar/progressbar.d.ts +8 -0
  97. package/dist/components/progressbar/progressbar.stories.d.ts +14 -0
  98. package/dist/components/select/select.d.ts +2 -1
  99. package/dist/components/spinner/index.d.ts +1 -0
  100. package/dist/components/spinner/spinner.d.ts +8 -0
  101. package/dist/components/spinner/spinner.stories.d.ts +13 -0
  102. package/dist/components/start-campaign-card/index.d.ts +1 -0
  103. package/dist/components/start-campaign-card/start-campaign-card.d.ts +8 -0
  104. package/dist/components/start-campaign-card/start-campaign-card.stories.d.ts +14 -0
  105. package/dist/components/statistics/statistics.d.ts +2 -1
  106. package/dist/components/tabs/nav-tabs.d.ts +18 -0
  107. package/dist/components/tabs/tabs.d.ts +3 -1
  108. package/dist/components/text/text.d.ts +1 -1
  109. package/dist/components/text-field/text-field.d.ts +1 -0
  110. package/dist/index.esm.js +9570 -6554
  111. package/dist/index.js +9296 -6261
  112. package/dist/theme/theme.d.ts +4 -0
  113. package/dist/utils/parse-numbers.d.ts +2 -0
  114. package/package.json +4 -1
  115. package/styles/index.css +5 -0
  116. package/dist/components/anchor/anchor.jsx +0 -35
  117. package/dist/components/anchor/anchor.stories.jsx +0 -12
  118. package/dist/components/anchor/bold-anchor.jsx +0 -33
  119. package/dist/components/anchor/bold-anchor.stories.jsx +0 -11
  120. package/dist/components/anchor/index.js +0 -2
  121. package/dist/components/avatar/avatar.jsx +0 -14
  122. package/dist/components/avatar/avatar.stories.jsx +0 -17
  123. package/dist/components/avatar/image-avatar.jsx +0 -29
  124. package/dist/components/avatar/index.js +0 -1
  125. package/dist/components/avatar/text-avatar.jsx +0 -47
  126. package/dist/components/button/button.jsx +0 -85
  127. package/dist/components/button/button.stories.jsx +0 -118
  128. package/dist/components/button/index.js +0 -1
  129. package/dist/components/checkbox/checkbox.jsx +0 -39
  130. package/dist/components/checkbox/checkbox.stories.jsx +0 -42
  131. package/dist/components/checkbox/index.js +0 -1
  132. package/dist/components/chips/chip.jsx +0 -30
  133. package/dist/components/chips/chips.jsx +0 -16
  134. package/dist/components/chips/chips.stories.jsx +0 -35
  135. package/dist/components/chips/index.js +0 -3
  136. package/dist/components/chips/input-chips.jsx +0 -16
  137. package/dist/components/chips/input-chips.stories.jsx +0 -39
  138. package/dist/components/combo-field/combo-field-expander.jsx +0 -23
  139. package/dist/components/combo-field/combo-field.jsx +0 -93
  140. package/dist/components/combo-field/combo-field.stories.jsx +0 -62
  141. package/dist/components/combo-field/index.js +0 -2
  142. package/dist/components/cropper/cropper.jsx +0 -15
  143. package/dist/components/cropper/cropper.stories.jsx +0 -18
  144. package/dist/components/cropper/index.js +0 -1
  145. package/dist/components/date-picker/date-picker.jsx +0 -74
  146. package/dist/components/date-picker/date-picker.stories.jsx +0 -46
  147. package/dist/components/date-picker/index.js +0 -2
  148. package/dist/components/date-picker/single-date-picker.jsx +0 -81
  149. package/dist/components/elevation/elevation.jsx +0 -19
  150. package/dist/components/elevation/elevation.stories.jsx +0 -31
  151. package/dist/components/elevation/index.js +0 -1
  152. package/dist/components/field-helpers/field-helper-text.jsx +0 -42
  153. package/dist/components/field-helpers/field-label.jsx +0 -29
  154. package/dist/components/field-helpers/index.js +0 -2
  155. package/dist/components/icon/btn_google_light_normal_ios.svg.jsx +0 -21
  156. package/dist/components/icon/facebook_6.svg.jsx +0 -13
  157. package/dist/components/icon/icon-button-group.jsx +0 -51
  158. package/dist/components/icon/icon-button-group.stories.jsx +0 -26
  159. package/dist/components/icon/icon-button.jsx +0 -48
  160. package/dist/components/icon/icon-button.stories.jsx +0 -33
  161. package/dist/components/icon/icon.jsx +0 -49
  162. package/dist/components/icon/icon.stories.jsx +0 -78
  163. package/dist/components/icon/index.js +0 -4
  164. package/dist/components/icon/material-icon.jsx +0 -18
  165. package/dist/components/icon/toggle-button.jsx +0 -29
  166. package/dist/components/icon/toggle-button.stories.jsx +0 -16
  167. package/dist/components/index.js +0 -27
  168. package/dist/components/layout/box.jsx +0 -58
  169. package/dist/components/layout/flex.jsx +0 -55
  170. package/dist/components/layout/flex.stories.jsx +0 -44
  171. package/dist/components/layout/grid.jsx +0 -19
  172. package/dist/components/layout/grid.stories.jsx +0 -29
  173. package/dist/components/layout/index.js +0 -4
  174. package/dist/components/layout/stack.jsx +0 -33
  175. package/dist/components/layout/stack.stories.jsx +0 -40
  176. package/dist/components/list/index.js +0 -1
  177. package/dist/components/list/list.jsx +0 -52
  178. package/dist/components/list/list.stories.jsx +0 -135
  179. package/dist/components/logo/index.js +0 -1
  180. package/dist/components/logo/logo-type.jsx +0 -65
  181. package/dist/components/menu/index.js +0 -8
  182. package/dist/components/menu/menu-list-divider.jsx +0 -2
  183. package/dist/components/menu/menu-list-item-graphic.jsx +0 -2
  184. package/dist/components/menu/menu-list-item-meta.jsx +0 -2
  185. package/dist/components/menu/menu-list-item-text.jsx +0 -2
  186. package/dist/components/menu/menu-list-item.jsx +0 -11
  187. package/dist/components/menu/menu-list.jsx +0 -18
  188. package/dist/components/menu/menu-surface.jsx +0 -4
  189. package/dist/components/menu/menu.jsx +0 -2
  190. package/dist/components/menu/menu.stories.jsx +0 -42
  191. package/dist/components/modal/index.js +0 -1
  192. package/dist/components/modal/modal.jsx +0 -49
  193. package/dist/components/modal/modal.stories.jsx +0 -47
  194. package/dist/components/navigation/index.js +0 -1
  195. package/dist/components/navigation/navigation-actions.jsx +0 -8
  196. package/dist/components/navigation/navigation-bar.jsx +0 -42
  197. package/dist/components/navigation/navigation-call-to-action.jsx +0 -6
  198. package/dist/components/navigation/navigation-expanded.jsx +0 -165
  199. package/dist/components/navigation/navigation-list.jsx +0 -126
  200. package/dist/components/navigation/navigation-menu-control.jsx +0 -25
  201. package/dist/components/navigation/navigation-menu.jsx +0 -103
  202. package/dist/components/navigation/navigation-search-control.jsx +0 -8
  203. package/dist/components/navigation/navigation-search.jsx +0 -63
  204. package/dist/components/navigation/navigation-sign-in-control.jsx +0 -14
  205. package/dist/components/navigation/navigation-user-menu-items.jsx +0 -36
  206. package/dist/components/navigation/navigation-user-menu.jsx +0 -121
  207. package/dist/components/navigation/navigation.jsx +0 -137
  208. package/dist/components/navigation/navigation.stories.jsx +0 -260
  209. package/dist/components/phone-number-field/index.d.ts +0 -2
  210. package/dist/components/phone-number-field/index.js +0 -2
  211. package/dist/components/phone-number-field/phone-number-field.jsx +0 -50
  212. package/dist/components/phone-number-field/phone-number-field.stories.jsx +0 -23
  213. package/dist/components/phone-number-field/util.js +0 -19
  214. package/dist/components/radio/index.js +0 -2
  215. package/dist/components/radio/radio-group.jsx +0 -9
  216. package/dist/components/radio/radio-group.stories.jsx +0 -21
  217. package/dist/components/radio/radio.jsx +0 -31
  218. package/dist/components/radio/radio.stories.jsx +0 -44
  219. package/dist/components/select/index.js +0 -2
  220. package/dist/components/select/select-helper-text.jsx +0 -6
  221. package/dist/components/select/select.jsx +0 -152
  222. package/dist/components/select/select.stories.jsx +0 -40
  223. package/dist/components/statistics/index.js +0 -1
  224. package/dist/components/statistics/statistics.jsx +0 -61
  225. package/dist/components/statistics/statistics.stories.jsx +0 -34
  226. package/dist/components/switch/index.js +0 -1
  227. package/dist/components/switch/switch.jsx +0 -32
  228. package/dist/components/switch/switch.stories.jsx +0 -41
  229. package/dist/components/tabs/index.js +0 -1
  230. package/dist/components/tabs/tab-bar.jsx +0 -35
  231. package/dist/components/tabs/tab-text-label.jsx +0 -5
  232. package/dist/components/tabs/tab.jsx +0 -50
  233. package/dist/components/tabs/tabs.jsx +0 -65
  234. package/dist/components/tabs/tabs.stories.jsx +0 -27
  235. package/dist/components/text/index.js +0 -1
  236. package/dist/components/text/text.jsx +0 -138
  237. package/dist/components/text/text.stories.jsx +0 -262
  238. package/dist/components/text-field/index.js +0 -2
  239. package/dist/components/text-field/text-field-helper-text.jsx +0 -8
  240. package/dist/components/text-field/text-field.jsx +0 -124
  241. package/dist/components/text-field/text-field.stories.jsx +0 -32
  242. package/dist/components/uploader/index.js +0 -1
  243. package/dist/components/uploader/uploader.jsx +0 -96
  244. package/dist/input.d.ts +0 -1
  245. package/dist/input.js +0 -4
  246. package/dist/input.jsx +0 -4
  247. package/dist/theme/colors.js +0 -9
  248. package/dist/theme/index.js +0 -2
  249. package/dist/theme/mycause-theme.js +0 -33
  250. package/dist/theme/theme.jsx +0 -36
  251. package/dist/utils/browser.js +0 -19
  252. package/dist/utils/center-decorator.jsx +0 -15
  253. package/dist/utils/component-matrix.jsx +0 -39
  254. package/dist/utils/flags.js +0 -18
  255. package/dist/utils/grid-decorator.jsx +0 -27
  256. package/dist/utils/tap-event.js +0 -11
  257. package/dist/utils/wrap.js +0 -8
  258. /package/dist/components/{phone-number-field → phone-number-input}/util.d.ts +0 -0
@@ -1,16 +0,0 @@
1
- import React from "react";
2
- import { ChipSet } from "@material/react-chips";
3
- /**
4
- * A form control for adding and removing items to a set.
5
- */
6
- function InputChips({ onChange, ...rest }) {
7
- const handleUpdateChips = (chips) => {
8
- onChange(chips.map((chip) => chip.id));
9
- };
10
- const props = {
11
- updateChips: handleUpdateChips,
12
- ...rest,
13
- };
14
- return <ChipSet {...props}/>;
15
- }
16
- export default InputChips;
@@ -1,39 +0,0 @@
1
- import React, { useState } from "react";
2
- import CenterDecorator from "../../utils/center-decorator";
3
- import { TextField } from "../text-field";
4
- import { Icon } from "../icon";
5
- import InputChips from "./input-chips";
6
- import Chip from "./chip";
7
- export default {
8
- title: "InputChips",
9
- decorators: [CenterDecorator],
10
- };
11
- export function InputChipsStory() {
12
- const [text, setText] = useState("");
13
- const [values, setValues] = useState([]);
14
- const handleKeyDown = (e) => {
15
- if (e.key === "Enter" && text.trim()) {
16
- if (!values.includes(text.trim())) {
17
- setValues(values => [...values, text.trim()]);
18
- setText("");
19
- }
20
- }
21
- };
22
- return (<div>
23
- <div>
24
- <TextField placeholder="Add an item" value={text} onChange={e => setText(e.target.value)} onKeyDown={handleKeyDown}/>
25
- </div>
26
- <InputChips onChange={chips => setValues(chips)}>
27
- {values.map((value) => (<Chip id={value} key={value} label={value} trailingIcon={<Icon icon="cancel"/>}/>))}
28
- </InputChips>
29
- <style jsx>{`
30
- div {
31
- max-width: 360px;
32
- width: 100%;
33
- }
34
- `}</style>
35
- </div>);
36
- }
37
- InputChipsStory.story = {
38
- name: "default",
39
- };
@@ -1,23 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
- import css from "styled-jsx/css";
4
- const scope = css.resolve `
5
- .combo-field-expand {
6
- flex-grow: 1;
7
- }
8
- `;
9
- /**
10
- * Makes a field in a combo-field expand to fill as
11
- * much size as it can.
12
- */
13
- function ComboFieldExpander({ children, className, ...props }) {
14
- const child = React.Children.only(children);
15
- return (<>
16
- {React.cloneElement(child, {
17
- className: classnames(child.props.className, scope.className, className, "combo-field-expand"),
18
- ...props,
19
- })}
20
- {scope.styles}
21
- </>);
22
- }
23
- export default ComboFieldExpander;
@@ -1,93 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
- import { getElementDisplayName } from "../../utils/get-element-display-name";
4
- import { TextField } from "../text-field";
5
- import { Select } from "../select";
6
- import { Button } from "../button";
7
- import { IconButtonGroup } from "../icon";
8
- import ComboFieldExpander from "./combo-field-expander";
9
- /**
10
- * Combines several input controls to into one visually continuous
11
- * control
12
- *
13
- * Supports the following components:
14
- * - TextField
15
- * - Select
16
- * - Button
17
- * - IconButtonGroup
18
- */
19
- function ComboField({ children, className, large = false, ...rest }) {
20
- children = React.Children.map(children, child => augment(child, { large }));
21
- return (<div className={classnames("combo-field", className)} {...rest}>
22
- {children}
23
- <style jsx>{`
24
- .combo-field {
25
- display: flex;
26
- align-items: flex-end;
27
- margin-bottom: 1px;
28
- }
29
-
30
- .combo-field
31
- > :global(*:not(:last-child))
32
- :global(.mdc-text-field:not(.mdc-text-field--focused))
33
- :global(.mdc-notched-outline__trailing),
34
- .combo-field
35
- > :global(*:not(:last-child))
36
- :global(.mdc-select:not(.mdc-select--focused))
37
- :global(.mdc-notched-outline__trailing),
38
- .combo-field :global(.mdc-button--control:not(:last-child):not(:focus)),
39
- .combo-field :global(.icon-button-group:not(:last-child)::after) {
40
- border-right-color: transparent;
41
- border-top-right-radius: 0;
42
- border-bottom-right-radius: 0;
43
- margin-right: -1px;
44
- }
45
-
46
- .combo-field
47
- > :global(*:not(:first-child))
48
- :global(.mdc-text-field:not(.mdc-text-field--focused))
49
- :global(.mdc-notched-outline__leading),
50
- .combo-field
51
- > :global(*:not(:first-child))
52
- :global(.mdc-select:not(.mdc-select--focused))
53
- :global(.mdc-notched-outline__leading),
54
- .combo-field
55
- :global(.mdc-button--control:not(:first-child):not(:focus)),
56
- .combo-field :global(.icon-button-group:not(:first-child)::after) {
57
- border-left-color: transparent;
58
- border-top-left-radius: 0;
59
- border-bottom-left-radius: 0;
60
- margin-left: -1px;
61
- }
62
- `}</style>
63
- </div>);
64
- }
65
- export default ComboField;
66
- /* Augment the passed elements */
67
- function augment(element, { large }) {
68
- switch (element.type) {
69
- case ComboFieldExpander:
70
- return React.cloneElement(element, {}, augment(React.Children.only(element.props.children), { large }));
71
- case TextField:
72
- case Select:
73
- // Force text-field or select to be large if needed
74
- element = React.cloneElement(element, { large });
75
- break;
76
- case Button:
77
- // Force the button to be the control style
78
- element = React.cloneElement(element, { control: true, dense: !large });
79
- break;
80
- case IconButtonGroup:
81
- // Ensure the size of the button matches the height
82
- element = React.cloneElement(element, {
83
- size: large ? "3.5rem" : undefined,
84
- isOutlinedOnFocus: true,
85
- });
86
- break;
87
- default:
88
- if (process.env.NODE_ENV !== "production") {
89
- console.warn("[ComboField] unsupported element type", getElementDisplayName(element));
90
- }
91
- }
92
- return element;
93
- }
@@ -1,62 +0,0 @@
1
- import React, { useState } from "react";
2
- import CenterDecorator from "../../utils/center-decorator";
3
- import { TextField } from "../text-field";
4
- import { Select } from "../select";
5
- import { Icon, IconButton, IconButtonGroup } from "../icon";
6
- import { Button } from "../button";
7
- import ComboField from "./combo-field";
8
- import ComboFieldExpander from "./combo-field-expander";
9
- export default {
10
- title: "ComboField",
11
- decorators: [CenterDecorator],
12
- };
13
- export const ComboFieldStory = () => {
14
- const [value, setValue] = useState("");
15
- const [state, setState] = useState("");
16
- return (<div>
17
- <ComboField>
18
- <ComboFieldExpander>
19
- <TextField label="Charity" placeholder="Search" leadingIcon={<Icon icon="search"/>} value={value} onChange={e => setValue(e.target.value)}/>
20
- </ComboFieldExpander>
21
- <Select label="State" options={[
22
- { value: "", label: "" },
23
- { value: "VIC", label: "Victoria" },
24
- ]} value={state} onChange={e => setState(e.target.value)}/>
25
- <Button>Category</Button>
26
- </ComboField>
27
- <style jsx>{`
28
- div {
29
- max-width: 580px;
30
- width: 100%;
31
- }
32
- `}</style>
33
- </div>);
34
- };
35
- ComboFieldStory.story = {
36
- name: "default",
37
- };
38
- export const WithIconButton = () => {
39
- const [value, setValue] = useState("");
40
- const [show, setShow] = useState(false);
41
- return (<div>
42
- <ComboField>
43
- <ComboFieldExpander>
44
- <TextField label="Charity" placeholder="Search" leadingIcon={<Icon icon="search"/>} value={value} onChange={e => setValue(e.target.value)}/>
45
- </ComboFieldExpander>
46
- <IconButtonGroup>
47
- <IconButton pressed={show} onClick={() => setShow(!show)}>
48
- <Icon icon="filter_list"/>
49
- </IconButton>
50
- </IconButtonGroup>
51
- </ComboField>
52
- <style jsx>{`
53
- div {
54
- max-width: 580px;
55
- width: 100%;
56
- }
57
- `}</style>
58
- </div>);
59
- };
60
- WithIconButton.story = {
61
- name: "icon button",
62
- };
@@ -1,2 +0,0 @@
1
- export { default as ComboField } from "./combo-field";
2
- export { default as ComboFieldExpander } from "./combo-field-expander";
@@ -1,15 +0,0 @@
1
- import React, { useRef } from "react";
2
- import ReactCropper from "react-cropper";
3
- const Cropper = ({ image, exportType, aspectRatio, cropImage, ...res }) => {
4
- const cropperRef = useRef(null);
5
- const crop = () => {
6
- if (!exportType) {
7
- exportType = "image/png";
8
- }
9
- cropImage(cropperRef.current
10
- .getCroppedCanvas()
11
- .toDataURL(exportType));
12
- };
13
- return (<ReactCropper ref={cropperRef} src={image} aspectRatio={aspectRatio} crop={crop} {...res}/>);
14
- };
15
- export default Cropper;
@@ -1,18 +0,0 @@
1
- import React, { Fragment, useState } from "react";
2
- import CenterDecorator from "../../utils/center-decorator";
3
- import Cropper from "./cropper";
4
- import catImage from "./cat.jpeg";
5
- export default {
6
- title: "Cropper",
7
- decorators: [CenterDecorator],
8
- };
9
- export const CropperStory = () => {
10
- const [croppedImage, setCroppedImage] = useState("");
11
- return (<Fragment>
12
- <Cropper image={catImage} style={{ width: "100%", height: "400px", maxWidth: "500px" }} aspectRatio={16 / 16} cropImage={setCroppedImage} dragMode="move" viewMode={2} cropBoxResizable={true}/>
13
- <img style={{ width: "400px" }} src={croppedImage} alt="cropped image"/>
14
- </Fragment>);
15
- };
16
- CropperStory.story = {
17
- name: "default",
18
- };
@@ -1 +0,0 @@
1
- export { default as Cropper } from "./cropper";
@@ -1,74 +0,0 @@
1
- import React from "react";
2
- import "react-dates/initialize";
3
- import { DateRangePicker } from "react-dates";
4
- import { useTheme, getColorToken } from "../../theme/theme";
5
- const DatePicker = ({ color = "primary", setStartDate, setEndDate, setFocusedInput, hasArrowIcon = true, numberOfMonths = 1, ...rest }) => {
6
- const theme = useTheme();
7
- const setColor = getColorToken(theme, "foreground", color);
8
- const handleDatesChange = ({ startDate, endDate, }) => {
9
- startDate && setStartDate(startDate);
10
- endDate && setEndDate(endDate);
11
- };
12
- return (<div className="calendar-container">
13
- <DateRangePicker numberOfMonths={numberOfMonths} onDatesChange={handleDatesChange} onFocusChange={event => setFocusedInput(event)} {...rest}/>
14
- <style jsx>{`
15
- .calendar-container {
16
- font-family: ${theme.typography.fontFamily.brand};
17
- }
18
- :global(.DateRangePickerInput__withBorder) {
19
- border-width: 2px !important;
20
- border-radius: 4px !important;
21
- }
22
- :global(.DateRangePickerInput__withBorder:hover) {
23
- border-width: 1px !important;
24
- border-color: #000000 !important;
25
- }
26
- :global(.DateRangePickerInput__withBorder:focus-within) {
27
- border-width: 2px !important;
28
- border-color: ${setColor} !important;
29
- }
30
- :global(.DateRangePickerInput_arrow) {
31
- display: ${!hasArrowIcon && "none"};
32
- }
33
- :global(.DateInput_input) {
34
- font-weight: 500 !important;
35
- font-size: 15px;
36
- }
37
- :global(.DayPickerKeyboardShortcuts_show__bottomRight::before) {
38
- border-right: 33px solid ${setColor} !important;
39
- }
40
- :global(.DateInput_input__focused) {
41
- border: none;
42
- }
43
- :global(.CalendarDay__selected_span) {
44
- background: ${setColor};
45
- color: white;
46
- opacity: 0.7;
47
- border: 1px solid white;
48
- }
49
-
50
- :global(.CalendarDay__selected) {
51
- background: ${setColor};
52
- color: white;
53
- border: 1px double white;
54
- }
55
-
56
- :global(.CalendarDay__selected:hover) {
57
- background: ${setColor};
58
- color: white;
59
- border: 1px double white;
60
- }
61
-
62
- :global(.CalendarDay__selected_span:active, .CalendarDay__selected_span:hover) {
63
- background: ${setColor};
64
- opacity: 0.5;
65
- }
66
-
67
- :global(.CalendarDay__hovered_span:hover, .CalendarDay__hovered_span) {
68
- background: ${setColor};
69
- color: white;
70
- }
71
- `}</style>
72
- </div>);
73
- };
74
- export default DatePicker;
@@ -1,46 +0,0 @@
1
- import React, { useState } from "react";
2
- import "react-dates/initialize";
3
- import CenterDecorator from "../../utils/center-decorator";
4
- import DatePicker from "./date-picker";
5
- import SingleDatePicker from "./single-date-picker";
6
- import moment from "moment";
7
- import { Icon } from "../icon";
8
- export default {
9
- title: "DatePicker",
10
- decorators: [CenterDecorator],
11
- };
12
- export const DatePickerStory = () => {
13
- const [startDate, setStartDate] = useState(moment());
14
- const [endDate, setEndDate] = useState(null);
15
- const [focusedInput, setFocusedInput] = useState(null);
16
- return (<DatePicker startDateId="dateStart" endDateId="dateEnd" startDate={startDate} endDate={endDate} setStartDate={setStartDate} setEndDate={setEndDate} focusedInput={focusedInput} setFocusedInput={setFocusedInput}/>);
17
- };
18
- DatePickerStory.story = {
19
- name: "default",
20
- };
21
- export const DatePickerNoIconStory = () => {
22
- const [startDate, setStartDate] = useState(moment());
23
- const [endDate, setEndDate] = useState(null);
24
- const [focusedInput, setFocusedInput] = useState(null);
25
- return (<DatePicker startDateId="dateStart" endDateId="dateEnd" startDate={startDate} endDate={endDate} setStartDate={setStartDate} setEndDate={setEndDate} focusedInput={focusedInput} hasArrowIcon={false} setFocusedInput={setFocusedInput}/>);
26
- };
27
- DatePickerNoIconStory.story = {
28
- name: "no icons",
29
- };
30
- export const DatePickerCustomIconsStory = () => {
31
- const [startDate, setStartDate] = useState(moment());
32
- const [endDate, setEndDate] = useState(null);
33
- const [focusedInput, setFocusedInput] = useState(null);
34
- return (<DatePicker startDateId="dateStart" endDateId="dateEnd" startDate={startDate} endDate={endDate} setStartDate={setStartDate} setEndDate={setEndDate} focusedInput={focusedInput} setFocusedInput={setFocusedInput} customArrowIcon={<Icon icon="double_arrow"/>} customInputIcon={<Icon icon="av_timer"/>} customCloseIcon={<Icon icon="clear"/>}/>);
35
- };
36
- DatePickerCustomIconsStory.story = {
37
- name: "custom icons",
38
- };
39
- export const SingleDatePickerStory = () => {
40
- const [date, setDate] = useState(moment());
41
- const [focusedInput, setFocusedInput] = useState();
42
- return (<SingleDatePicker date={date} onDateChange={setDate} focused={focusedInput} onFocusChange={setFocusedInput} label="Single date picker" id="date"/>);
43
- };
44
- SingleDatePickerStory.story = {
45
- name: "single date picker",
46
- };
@@ -1,2 +0,0 @@
1
- export { default as DatePicker } from "./date-picker";
2
- export { default as SingleDatePicker } from "./single-date-picker";
@@ -1,81 +0,0 @@
1
- import React from "react";
2
- import { SingleDatePicker } from "react-dates";
3
- import { useTheme, getColorToken } from "../../theme/theme";
4
- import { FieldLabel } from "../field-helpers";
5
- import { Stack } from "../layout";
6
- const CustomSingleDatePicker = ({ width, color = "primary", onDateChange, onFocusChange, numberOfMonths = 1, error, label, ...rest }) => {
7
- const theme = useTheme();
8
- const setColor = getColorToken(theme, "foreground", color);
9
- return (<div className="calendar-container">
10
- <Stack direction="column" gap="0.5rem 0">
11
- <div>{label && <FieldLabel required>{label}</FieldLabel>}</div>
12
- <SingleDatePicker numberOfMonths={numberOfMonths} onDateChange={onDateChange} onFocusChange={(e) => onFocusChange(e.focused)} {...rest}/>
13
- </Stack>
14
- <style jsx>{`
15
- :global(.SingleDatePicker) {
16
- width: ${width};
17
- }
18
- :global(.SingleDatePickerInput) {
19
- width: 100%;
20
- }
21
- :global(.DateInput) {
22
- width: 100%;
23
- }
24
- .calendar-container {
25
- font-family: ${theme.typography.fontFamily.brand};
26
- }
27
- :global(.SingleDatePickerInput__withBorder) {
28
- border-width: 2px !important;
29
- border-radius: 4px !important;
30
- border-color: ${error && "#b00020"};
31
- }
32
- :global(.SingleDatePickerInput__withBorder:hover) {
33
- border-width: 1px !important;
34
- border-color: #000000 !important;
35
- }
36
- :global(.SingleDatePickerInput__withBorder:focus-within) {
37
- border-width: 2px !important;
38
- border-color: ${setColor} !important;
39
- }
40
- :global(.DateInput_input) {
41
- font-weight: 500 !important;
42
- font-size: 15px;
43
- }
44
- :global(.DayPickerKeyboardShortcuts_show__bottomRight::before) {
45
- border-right: 33px solid ${setColor} !important;
46
- }
47
- :global(.DateInput_input__focused) {
48
- border: none;
49
- }
50
- :global(.CalendarDay__selected_span) {
51
- background: ${setColor};
52
- color: white;
53
- opacity: 0.7;
54
- border: 1px solid white;
55
- }
56
-
57
- :global(.CalendarDay__selected) {
58
- background: ${setColor};
59
- color: white;
60
- border: 1px double white;
61
- }
62
-
63
- :global(.CalendarDay__selected:hover) {
64
- background: ${setColor};
65
- color: white;
66
- border: 1px double white;
67
- }
68
-
69
- :global(.CalendarDay__selected_span:active, .CalendarDay__selected_span:hover) {
70
- background: ${setColor};
71
- opacity: 0.5;
72
- }
73
-
74
- :global(.CalendarDay__hovered_span:hover, .CalendarDay__hovered_span) {
75
- background: ${setColor};
76
- color: white;
77
- }
78
- `}</style>
79
- </div>);
80
- };
81
- export default CustomSingleDatePicker;
@@ -1,19 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
- import css from "styled-jsx/css";
4
- import Box from "../layout/box";
5
- const Elevation = ({ dp, radius = "4px", children, className, transition, ...res }) => {
6
- const scope = css.resolve `
7
- .elevation {
8
- border-radius: ${radius};
9
- overflow: hidden;
10
- }
11
- `;
12
- return (<Box className={classnames("elevation", {
13
- "mdc-elevation-transition": transition,
14
- }, `mdc-elevation--z${dp ? dp : 0}`, scope.className, className)} {...res}>
15
- {children}
16
- {scope.styles}
17
- </Box>);
18
- };
19
- export default Elevation;
@@ -1,31 +0,0 @@
1
- import React, { Fragment } from "react";
2
- import CenterDecorator from "../../utils/center-decorator";
3
- import Elevation from "./elevation";
4
- export default {
5
- title: "Elevation",
6
- decorators: [CenterDecorator],
7
- };
8
- export const ElevationExample = () => {
9
- const elevationsArray = [];
10
- for (let i = 0; i <= 24; i++) {
11
- elevationsArray.push(<Elevation dp={i} transition={true} className="elevation-example">
12
- Example {i} dp
13
- </Elevation>);
14
- }
15
- return (<Fragment>
16
- <div className="elevate-container">{elevationsArray}</div>
17
- <style jsx>{`
18
- :global(.elevation-example) {
19
- padding: 20px;
20
- margin: 20px;
21
- }
22
- .elevate-container {
23
- display: grid;
24
- grid-template-columns: auto auto auto auto auto;
25
- }
26
- `}</style>
27
- </Fragment>);
28
- };
29
- ElevationExample.story = {
30
- name: "default",
31
- };
@@ -1 +0,0 @@
1
- export { default as Elevation } from "./elevation";
@@ -1,42 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
- import { useTheme } from "../../theme";
4
- function FieldHelperText({ hidden, children, error }) {
5
- const theme = useTheme();
6
- return (<div className={classnames("field-helper-text")}>
7
- <p className={classnames({ hidden, error })}>
8
- {error ? error : children}
9
- </p>
10
- <style jsx>{`
11
- .field-helper-text {
12
- margin-bottom: 4px;
13
- display: flex;
14
- justify-content: space-between;
15
- }
16
-
17
- p {
18
- color: rgba(0, 0, 0, 0.6);
19
- font-size: 0.75rem;
20
- letter-spacing: 0;
21
- margin: 0;
22
- line-height: 19px;
23
- transition: opacity 150ms ease;
24
- }
25
-
26
- .hidden {
27
- opacity: 0;
28
- }
29
-
30
- .error {
31
- color: #b00020;
32
- }
33
- `}</style>
34
- <style jsx>{`
35
- p {
36
- font-weight: 500;
37
- font-family: ${theme.typography.fontFamily.brand};
38
- }
39
- `}</style>
40
- </div>);
41
- }
42
- export default FieldHelperText;
@@ -1,29 +0,0 @@
1
- import React from "react";
2
- import classnames from "classnames";
3
- import { useTheme } from "../../theme";
4
- function FieldLabel({ large, className, children, required, ...rest }) {
5
- const theme = useTheme();
6
- return (<label className={classnames("field-label", {
7
- "field-label--dense": !large,
8
- }, className)} {...rest}>
9
- {children}
10
- {required ? "*" : null}
11
- <style jsx>{`
12
- .field-label {
13
- font-weight: 500;
14
- font-family: ${theme.typography.fontFamily.brand};
15
- font-size: 0.875rem;
16
- margin: 0.5rem 0;
17
- display: inline-block;
18
- letter-spacing: 0.00937rem;
19
- color: rgba(0, 0, 0, 0.6);
20
- line-height: 1rem;
21
- }
22
-
23
- .field-label--dense {
24
- font-size: 0.75rem;
25
- }
26
- `}</style>
27
- </label>);
28
- }
29
- export default FieldLabel;
@@ -1,2 +0,0 @@
1
- export { default as FieldLabel } from "./field-label";
2
- export { default as FieldHelperText } from "./field-helper-text";
@@ -1,21 +0,0 @@
1
- import React from "react";
2
- /**
3
- * Google logo for Google sign in
4
- *
5
- * Based on the file btn_google_light_normal_ios.svg but with the button background removed
6
- * See: https://developers.google.com/identity/branding-guidelines
7
- */
8
- export default function GoogleIconSvg(props) {
9
- return (<svg height="24" width="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" {...props}>
10
- <title>btn_google_light_normal_ios</title>
11
- <g id="Google-Button" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
12
- <g id="logo_googleg_48dp" transform="translate(4.000000, 4.000000)">
13
- <path d="M17.64,9.20454545 C17.64,8.56636364 17.5827273,7.95272727 17.4763636,7.36363636 L9,7.36363636 L9,10.845 L13.8436364,10.845 C13.635,11.97 13.0009091,12.9231818 12.0477273,13.5613636 L12.0477273,15.8195455 L14.9563636,15.8195455 C16.6581818,14.2527273 17.64,11.9454545 17.64,9.20454545 L17.64,9.20454545 Z" id="Shape" fill="#4285F4"></path>
14
- <path d="M9,18 C11.43,18 13.4672727,17.1940909 14.9563636,15.8195455 L12.0477273,13.5613636 C11.2418182,14.1013636 10.2109091,14.4204545 9,14.4204545 C6.65590909,14.4204545 4.67181818,12.8372727 3.96409091,10.71 L0.957272727,10.71 L0.957272727,13.0418182 C2.43818182,15.9831818 5.48181818,18 9,18 L9,18 Z" id="Shape" fill="#34A853"></path>
15
- <path d="M3.96409091,10.71 C3.78409091,10.17 3.68181818,9.59318182 3.68181818,9 C3.68181818,8.40681818 3.78409091,7.83 3.96409091,7.29 L3.96409091,4.95818182 L0.957272727,4.95818182 C0.347727273,6.17318182 0,7.54772727 0,9 C0,10.4522727 0.347727273,11.8268182 0.957272727,13.0418182 L3.96409091,10.71 L3.96409091,10.71 Z" id="Shape" fill="#FBBC05"></path>
16
- <path d="M9,3.57954545 C10.3213636,3.57954545 11.5077273,4.03363636 12.4404545,4.92545455 L15.0218182,2.34409091 C13.4631818,0.891818182 11.4259091,0 9,0 C5.48181818,0 2.43818182,2.01681818 0.957272727,4.95818182 L3.96409091,7.29 C4.67181818,5.16272727 6.65590909,3.57954545 9,3.57954545 L9,3.57954545 Z" id="Shape" fill="#EA4335"></path>
17
- <path d="M0,0 L18,0 L18,18 L0,18 L0,0 Z" id="Shape"></path>
18
- </g>
19
- </g>
20
- </svg>);
21
- }
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- /**
3
- * Facebook icon for Facebook login
4
- *
5
- * See: https://iconmonstr.com/facebook-6-svg/
6
- *
7
- * Only use with the color #3C5A99
8
- */
9
- export default function FacebookIconSVG(props) {
10
- return (<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" {...props}>
11
- <path d="M22.675 0h-21.35c-.732 0-1.325.593-1.325 1.325v21.351c0 .731.593 1.324 1.325 1.324h11.495v-9.294h-3.128v-3.622h3.128v-2.671c0-3.1 1.893-4.788 4.659-4.788 1.325 0 2.463.099 2.795.143v3.24l-1.918.001c-1.504 0-1.795.715-1.795 1.763v2.313h3.587l-.467 3.622h-3.12v9.293h6.116c.73 0 1.323-.593 1.323-1.325v-21.35c0-.732-.593-1.325-1.325-1.325z"/>
12
- </svg>);
13
- }