@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.
Files changed (258) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/README.md +9 -0
  3. package/dist/components/campaign-card/campaign-card.d.ts +9 -0
  4. package/dist/components/campaign-card/campaign-card.stories.d.ts +14 -0
  5. package/dist/components/campaign-card/index.d.ts +1 -0
  6. package/dist/components/campaign-of-month/campaign-of-month.d.ts +14 -0
  7. package/dist/components/campaign-of-month/campaign-of-month.stories.d.ts +14 -0
  8. package/dist/components/campaign-of-month/index.d.ts +1 -0
  9. package/dist/components/charity-card/charity-card.d.ts +7 -0
  10. package/dist/components/charity-card/charity-card.stories.d.ts +14 -0
  11. package/dist/components/charity-card/index.d.ts +1 -0
  12. package/dist/components/combo-field/combo-field.d.ts +4 -1
  13. package/dist/components/comment-section/comment-section-v2/comment-section-v2.d.ts +31 -0
  14. package/dist/components/comment-section/comment-section-v2/sub-comments-v2.d.ts +11 -0
  15. package/dist/components/comment-section/comment-section.d.ts +1 -0
  16. package/dist/components/comment-section/comment-section.stories.d.ts +6 -0
  17. package/dist/components/comment-section/index.d.ts +1 -0
  18. package/dist/components/date-picker/single-date-picker.d.ts +3 -2
  19. package/dist/components/donate-card/donate-card.d.ts +8 -0
  20. package/dist/components/donate-card/donate-card.stories.d.ts +14 -0
  21. package/dist/components/donate-card/index.d.ts +1 -0
  22. package/dist/components/donation-form/donation-details.d.ts +12 -0
  23. package/dist/components/donation-form/donation-form-v2/donation-form-v2.d.ts +13 -0
  24. package/dist/components/donation-form/donation-form.d.ts +64 -0
  25. package/dist/components/donation-form/donation-form.stories.d.ts +18 -0
  26. package/dist/components/donation-form/donation-payment.d.ts +13 -0
  27. package/dist/components/donation-form/donation-select.d.ts +13 -0
  28. package/dist/components/donation-form/index.d.ts +2 -0
  29. package/dist/components/featured-campaign-card/featured-campaign-card.d.ts +17 -0
  30. package/dist/components/featured-campaign-card/featured-campaign-card.stories.d.ts +14 -0
  31. package/dist/components/featured-campaign-card/index.d.ts +1 -0
  32. package/dist/components/footerV2/footerV2.d.ts +35 -0
  33. package/dist/components/footerV2/footerV2.stories.d.ts +15 -0
  34. package/dist/components/footerV2/index.d.ts +1 -0
  35. package/dist/components/fundraising-section/fundraising-section.d.ts +9 -0
  36. package/dist/components/fundraising-section/fundraising-section.stories.d.ts +14 -0
  37. package/dist/components/fundraising-section/index.d.ts +1 -0
  38. package/dist/components/hero-banner/hero-banner.d.ts +9 -0
  39. package/dist/components/hero-banner/hero-banner.stories.d.ts +14 -0
  40. package/dist/components/hero-banner/index.d.ts +1 -0
  41. package/dist/components/horizontalbar/horizontalbar.d.ts +11 -0
  42. package/dist/components/horizontalbar/horizontalbar.stories.d.ts +26 -0
  43. package/dist/components/horizontalbar/index.d.ts +1 -0
  44. package/dist/components/icon/{toggle-button.d.ts → heart-toggle.d.ts} +3 -3
  45. package/dist/components/icon/{toggle-button.stories.d.ts → heart-toggle.stories.d.ts} +1 -1
  46. package/dist/components/icon/index.d.ts +1 -1
  47. package/dist/components/index.d.ts +14 -0
  48. package/dist/components/info-represent-campaign/index.d.ts +1 -0
  49. package/dist/components/info-represent-campaign/info-represent-campaign.d.ts +11 -0
  50. package/dist/components/{phone-number-field/phone-number-field.stories.d.ts → info-represent-campaign/info-represent-campaign.stories.d.ts} +1 -1
  51. package/dist/components/list/list.d.ts +7 -2
  52. package/dist/components/list/list.stories.d.ts +2 -2
  53. package/dist/components/logo/logo-type.d.ts +2 -1
  54. package/dist/components/modal/modal.d.ts +1 -1
  55. package/dist/components/nav/icons/IconBigger.d.ts +5 -0
  56. package/dist/components/nav/icons/IconSmaller.d.ts +5 -0
  57. package/dist/components/nav/index.d.ts +1 -0
  58. package/dist/components/nav/nav-actions.d.ts +5 -0
  59. package/dist/components/nav/nav-bar.d.ts +7 -0
  60. package/dist/components/nav/nav-call-to-action.d.ts +5 -0
  61. package/dist/components/nav/nav-expanded-charity.d.ts +13 -0
  62. package/dist/components/nav/nav-expanded.d.ts +14 -0
  63. package/dist/components/nav/nav-list.d.ts +29 -0
  64. package/dist/components/nav/nav-menu-control.d.ts +8 -0
  65. package/dist/components/nav/nav-menu.d.ts +12 -0
  66. package/dist/components/nav/nav-search-control.d.ts +8 -0
  67. package/dist/components/nav/nav-search.d.ts +10 -0
  68. package/dist/components/nav/nav-sign-in-control.d.ts +12 -0
  69. package/dist/components/nav/nav-user-menu-items.d.ts +20 -0
  70. package/dist/components/nav/nav-user-menu.d.ts +18 -0
  71. package/dist/components/nav/nav.d.ts +56 -0
  72. package/dist/components/nav/nav.stories.d.ts +11 -0
  73. package/dist/components/navigation/navigation-list.d.ts +3 -1
  74. package/dist/components/navigation/navigation-sign-in-control.d.ts +3 -2
  75. package/dist/components/navigation/navigation.d.ts +2 -0
  76. package/dist/components/navigation/navigation.stories.d.ts +6 -0
  77. package/dist/components/partner-dashboard-chart/chart.d.ts +3 -0
  78. package/dist/components/{phone-number-input/phone-number-field.stories.d.ts → partner-dashboard-chart/chart.stories.d.ts} +2 -1
  79. package/dist/components/partner-dashboard-chart/index.d.ts +1 -0
  80. package/dist/components/phone-number-input/phone-number-input.d.ts +2 -1
  81. package/dist/components/popup/index.d.ts +1 -0
  82. package/dist/components/popup/popup.d.ts +8 -0
  83. package/dist/components/popup/popup.stories.d.ts +14 -0
  84. package/dist/components/progressbar/index.d.ts +1 -0
  85. package/dist/components/progressbar/progressbar.d.ts +8 -0
  86. package/dist/components/progressbar/progressbar.stories.d.ts +14 -0
  87. package/dist/components/select/select.d.ts +2 -1
  88. package/dist/components/start-campaign-card/index.d.ts +1 -0
  89. package/dist/components/start-campaign-card/start-campaign-card.d.ts +8 -0
  90. package/dist/components/start-campaign-card/start-campaign-card.stories.d.ts +14 -0
  91. package/dist/components/statistics/statistics.d.ts +2 -1
  92. package/dist/components/tabs/nav-tabs.d.ts +18 -0
  93. package/dist/components/text-field/index.d.ts +1 -0
  94. package/dist/components/text-field/text-field-search.d.ts +9 -0
  95. package/dist/components/text-field/text-field.d.ts +1 -0
  96. package/dist/components/text-field/text-field.stories.d.ts +6 -0
  97. package/dist/index.esm.js +21647 -1735
  98. package/dist/index.js +21664 -1735
  99. package/dist/theme/theme.d.ts +4 -0
  100. package/package.json +1 -1
  101. package/styles/index.css +4 -0
  102. package/dist/components/anchor/anchor.jsx +0 -35
  103. package/dist/components/anchor/anchor.stories.jsx +0 -12
  104. package/dist/components/anchor/bold-anchor.jsx +0 -33
  105. package/dist/components/anchor/bold-anchor.stories.jsx +0 -11
  106. package/dist/components/anchor/index.js +0 -2
  107. package/dist/components/avatar/avatar.jsx +0 -14
  108. package/dist/components/avatar/avatar.stories.jsx +0 -17
  109. package/dist/components/avatar/image-avatar.jsx +0 -29
  110. package/dist/components/avatar/index.js +0 -1
  111. package/dist/components/avatar/text-avatar.jsx +0 -47
  112. package/dist/components/button/button.jsx +0 -85
  113. package/dist/components/button/button.stories.jsx +0 -118
  114. package/dist/components/button/index.js +0 -1
  115. package/dist/components/button-select/button-select.jsx +0 -34
  116. package/dist/components/button-select/button-select.stories.jsx +0 -39
  117. package/dist/components/button-select/index.js +0 -1
  118. package/dist/components/checkbox/checkbox.jsx +0 -39
  119. package/dist/components/checkbox/checkbox.stories.jsx +0 -42
  120. package/dist/components/checkbox/index.js +0 -1
  121. package/dist/components/chips/chip.jsx +0 -30
  122. package/dist/components/chips/chips.jsx +0 -16
  123. package/dist/components/chips/chips.stories.jsx +0 -35
  124. package/dist/components/chips/index.js +0 -3
  125. package/dist/components/chips/input-chips.jsx +0 -16
  126. package/dist/components/chips/input-chips.stories.jsx +0 -39
  127. package/dist/components/combo-field/combo-field-expander.jsx +0 -23
  128. package/dist/components/combo-field/combo-field.jsx +0 -93
  129. package/dist/components/combo-field/combo-field.stories.jsx +0 -62
  130. package/dist/components/combo-field/index.js +0 -2
  131. package/dist/components/comment-section/comment-section.jsx +0 -95
  132. package/dist/components/comment-section/comment-section.stories.jsx +0 -97
  133. package/dist/components/comment-section/index.js +0 -1
  134. package/dist/components/cropper/cropper.jsx +0 -10
  135. package/dist/components/cropper/cropper.stories.jsx +0 -18
  136. package/dist/components/cropper/index.js +0 -1
  137. package/dist/components/date-picker/date-picker.jsx +0 -74
  138. package/dist/components/date-picker/date-picker.stories.jsx +0 -46
  139. package/dist/components/date-picker/index.js +0 -2
  140. package/dist/components/date-picker/single-date-picker.jsx +0 -81
  141. package/dist/components/elevation/elevation.jsx +0 -24
  142. package/dist/components/elevation/elevation.stories.jsx +0 -31
  143. package/dist/components/elevation/index.js +0 -1
  144. package/dist/components/field-helpers/field-helper-text.jsx +0 -42
  145. package/dist/components/field-helpers/field-label.jsx +0 -29
  146. package/dist/components/field-helpers/index.js +0 -2
  147. package/dist/components/icon/btn_google_light_normal_ios.svg.jsx +0 -22
  148. package/dist/components/icon/facebook_6.svg.jsx +0 -14
  149. package/dist/components/icon/icon-button-group.jsx +0 -51
  150. package/dist/components/icon/icon-button-group.stories.jsx +0 -26
  151. package/dist/components/icon/icon-button.jsx +0 -48
  152. package/dist/components/icon/icon-button.stories.jsx +0 -33
  153. package/dist/components/icon/icon.jsx +0 -49
  154. package/dist/components/icon/icon.stories.jsx +0 -78
  155. package/dist/components/icon/index.js +0 -4
  156. package/dist/components/icon/material-icon.jsx +0 -18
  157. package/dist/components/icon/toggle-button.jsx +0 -29
  158. package/dist/components/icon/toggle-button.stories.jsx +0 -16
  159. package/dist/components/index.js +0 -28
  160. package/dist/components/layout/box.jsx +0 -58
  161. package/dist/components/layout/flex.jsx +0 -55
  162. package/dist/components/layout/flex.stories.jsx +0 -44
  163. package/dist/components/layout/grid.jsx +0 -19
  164. package/dist/components/layout/grid.stories.jsx +0 -29
  165. package/dist/components/layout/index.js +0 -4
  166. package/dist/components/layout/stack.jsx +0 -33
  167. package/dist/components/layout/stack.stories.jsx +0 -40
  168. package/dist/components/list/index.js +0 -1
  169. package/dist/components/list/list.jsx +0 -55
  170. package/dist/components/list/list.stories.jsx +0 -135
  171. package/dist/components/logo/index.js +0 -1
  172. package/dist/components/logo/logo-type.jsx +0 -65
  173. package/dist/components/menu/index.js +0 -8
  174. package/dist/components/menu/menu-list-divider.jsx +0 -2
  175. package/dist/components/menu/menu-list-item-graphic.jsx +0 -2
  176. package/dist/components/menu/menu-list-item-meta.jsx +0 -2
  177. package/dist/components/menu/menu-list-item-text.jsx +0 -2
  178. package/dist/components/menu/menu-list-item.jsx +0 -11
  179. package/dist/components/menu/menu-list.jsx +0 -18
  180. package/dist/components/menu/menu-surface.jsx +0 -4
  181. package/dist/components/menu/menu.jsx +0 -2
  182. package/dist/components/menu/menu.stories.jsx +0 -42
  183. package/dist/components/modal/index.js +0 -1
  184. package/dist/components/modal/modal.jsx +0 -49
  185. package/dist/components/modal/modal.stories.jsx +0 -59
  186. package/dist/components/navigation/index.js +0 -1
  187. package/dist/components/navigation/navigation-actions.jsx +0 -8
  188. package/dist/components/navigation/navigation-bar.jsx +0 -42
  189. package/dist/components/navigation/navigation-call-to-action.jsx +0 -6
  190. package/dist/components/navigation/navigation-expanded.jsx +0 -165
  191. package/dist/components/navigation/navigation-list.jsx +0 -126
  192. package/dist/components/navigation/navigation-menu-control.jsx +0 -25
  193. package/dist/components/navigation/navigation-menu.jsx +0 -126
  194. package/dist/components/navigation/navigation-search-control.jsx +0 -8
  195. package/dist/components/navigation/navigation-search.jsx +0 -63
  196. package/dist/components/navigation/navigation-sign-in-control.jsx +0 -14
  197. package/dist/components/navigation/navigation-user-menu-items.jsx +0 -36
  198. package/dist/components/navigation/navigation-user-menu.jsx +0 -121
  199. package/dist/components/navigation/navigation.jsx +0 -137
  200. package/dist/components/navigation/navigation.stories.jsx +0 -270
  201. package/dist/components/phone-number-field/index.d.ts +0 -2
  202. package/dist/components/phone-number-field/index.js +0 -2
  203. package/dist/components/phone-number-field/phone-number-field.d.ts +0 -23
  204. package/dist/components/phone-number-field/phone-number-field.jsx +0 -50
  205. package/dist/components/phone-number-field/phone-number-field.stories.jsx +0 -23
  206. package/dist/components/phone-number-field/util.d.ts +0 -2
  207. package/dist/components/phone-number-field/util.js +0 -19
  208. package/dist/components/phone-number-input/index.js +0 -2
  209. package/dist/components/phone-number-input/phone-number-field.d.ts +0 -23
  210. package/dist/components/phone-number-input/phone-number-field.jsx +0 -50
  211. package/dist/components/phone-number-input/phone-number-field.stories.jsx +0 -16
  212. package/dist/components/phone-number-input/phone-number-input.jsx +0 -75
  213. package/dist/components/phone-number-input/phone-number-input.stories.jsx +0 -23
  214. package/dist/components/phone-number-input/util.js +0 -19
  215. package/dist/components/radio/index.js +0 -2
  216. package/dist/components/radio/radio-group.jsx +0 -9
  217. package/dist/components/radio/radio-group.stories.jsx +0 -21
  218. package/dist/components/radio/radio.jsx +0 -31
  219. package/dist/components/radio/radio.stories.jsx +0 -44
  220. package/dist/components/select/index.js +0 -2
  221. package/dist/components/select/select-helper-text.jsx +0 -6
  222. package/dist/components/select/select.jsx +0 -150
  223. package/dist/components/select/select.stories.jsx +0 -40
  224. package/dist/components/statistics/index.js +0 -1
  225. package/dist/components/statistics/statistics.jsx +0 -61
  226. package/dist/components/statistics/statistics.stories.jsx +0 -34
  227. package/dist/components/switch/index.js +0 -1
  228. package/dist/components/switch/switch.jsx +0 -32
  229. package/dist/components/switch/switch.stories.jsx +0 -41
  230. package/dist/components/tabs/index.js +0 -1
  231. package/dist/components/tabs/tab-bar.jsx +0 -35
  232. package/dist/components/tabs/tab-text-label.jsx +0 -5
  233. package/dist/components/tabs/tab.jsx +0 -50
  234. package/dist/components/tabs/tabs.jsx +0 -65
  235. package/dist/components/tabs/tabs.stories.jsx +0 -27
  236. package/dist/components/text/index.js +0 -1
  237. package/dist/components/text/text.jsx +0 -138
  238. package/dist/components/text/text.stories.jsx +0 -262
  239. package/dist/components/text-field/index.js +0 -2
  240. package/dist/components/text-field/text-field-helper-text.jsx +0 -8
  241. package/dist/components/text-field/text-field.jsx +0 -124
  242. package/dist/components/text-field/text-field.stories.jsx +0 -32
  243. package/dist/components/uploader/index.js +0 -1
  244. package/dist/components/uploader/uploader.jsx +0 -96
  245. package/dist/input.d.ts +0 -1
  246. package/dist/input.js +0 -4
  247. package/dist/input.jsx +0 -4
  248. package/dist/theme/colors.js +0 -9
  249. package/dist/theme/index.js +0 -2
  250. package/dist/theme/mycause-theme.js +0 -33
  251. package/dist/theme/theme.jsx +0 -36
  252. package/dist/utils/browser.js +0 -19
  253. package/dist/utils/center-decorator.jsx +0 -15
  254. package/dist/utils/component-matrix.jsx +0 -39
  255. package/dist/utils/flags.js +0 -18
  256. package/dist/utils/grid-decorator.jsx +0 -27
  257. package/dist/utils/tap-event.js +0 -11
  258. package/dist/utils/wrap.js +0 -8
@@ -1,35 +0,0 @@
1
- import React, { useState } from "react";
2
- import CenterDecorator from "../../utils/center-decorator";
3
- import Chips from "./chips";
4
- import Chip from "./chip";
5
- export default {
6
- title: "Chips",
7
- decorators: [CenterDecorator],
8
- };
9
- export const chips = () => (<Chips>
10
- <Chip id="summer" label="Summer"/>
11
- <Chip id="winter" label="Winter"/>
12
- </Chips>);
13
- chips.story = {
14
- name: "default",
15
- };
16
- export const ChoiceChips = () => {
17
- const [selected, setSelected] = useState(["summer"]);
18
- return (<Chips choice value={selected} onChange={setSelected} options={[
19
- { id: "summer", label: "Summer" },
20
- { id: "winter", label: "Winter" },
21
- ]}></Chips>);
22
- };
23
- ChoiceChips.story = {
24
- name: "choice",
25
- };
26
- export const FilterChips = () => {
27
- const [selected, setSelected] = useState(["summer"]);
28
- return (<Chips filter value={selected} onChange={setSelected}>
29
- <Chip id="summer" label="Summer"/>
30
- <Chip id="winter" label="Winter"/>
31
- </Chips>);
32
- };
33
- FilterChips.story = {
34
- name: "filter",
35
- };
@@ -1,3 +0,0 @@
1
- export { default as Chips } from "./chips";
2
- export { default as InputChips } from "./input-chips";
3
- export { default as Chip } from "./chip";
@@ -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,95 +0,0 @@
1
- import React, { Fragment } from "react";
2
- import { Elevation } from "../elevation";
3
- import { Avatar } from "../avatar";
4
- import { Grid, Flex } from "../layout";
5
- import { Icon } from "../icon";
6
- import { Button } from "../button";
7
- import { Text } from "../text";
8
- const CommentSection = ({ comments, maxWidth, title, dissableCount, showMore, likeCall, }) => {
9
- const checkLastElement = (key, itemLength) => {
10
- return key + 1 < itemLength;
11
- };
12
- return (<Fragment>
13
- <Elevation dp={5} className="comment-section-main">
14
- <div className="comment-section-header">
15
- <Flex direction="row">
16
- <div style={{ paddingRight: "10px" }}>
17
- <Text h3 color="primary">
18
- {title}
19
- </Text>
20
- </div>
21
- {!dissableCount && <Button raised={true}>{comments.length}</Button>}
22
- </Flex>
23
- </div>
24
- <hr style={{ opacity: "0.3" }}/>
25
- {comments.map((res, key) => {
26
- return (<div key={res.userId}>
27
- <Grid className="comment-grid-custom" columns="52px auto" gap="1rem">
28
- <Avatar name="Profile Image" src={res.profileImage}/>
29
- <div>
30
- <Grid columns="auto 100px 40px" gap="0.5rem">
31
- <Text h4>{res.username}</Text>
32
- <Text p bold color="primary">
33
- ${res.donation}
34
- </Text>
35
- <div onClick={() => likeCall && likeCall(res)}>
36
- <Icon className="comment-icon" color="primary" icon={res.liked ? "favorite" : "favorite_border"}/>
37
- </div>
38
- </Grid>
39
- <div style={{ padding: "15px 15px 0px 0px" }}>
40
- <Text p>{res.comment}</Text>
41
- </div>
42
- </div>
43
- </Grid>
44
- {res.subComment && (<div style={{ width: "80%", margin: "auto" }}>
45
- <hr style={{ opacity: "0.3" }}/>
46
- {res.subComment.map((subRes, key) => {
47
- return (<div key={subRes.userId}>
48
- <Grid className="comment-grid-custom" columns="52px auto" gap="1rem">
49
- <Avatar name="Profile Image" src={subRes.profileImage}/>
50
- <Grid rows="auto" gap="0.5rem">
51
- <Text h5>{subRes.username}</Text>
52
- <Text p>{subRes.comment}</Text>
53
- </Grid>
54
- </Grid>
55
- {checkLastElement(key, res.subComment ? res.subComment.length : 0) && <hr style={{ opacity: "0.3" }}/>}
56
- </div>);
57
- })}
58
- </div>)}
59
- {checkLastElement(key, comments.length) && (<hr style={{ opacity: "0.3" }}/>)}
60
- </div>);
61
- })}
62
- {showMore && (<div className="comment-section-footer">
63
- <hr style={{ opacity: "0.3" }}/>
64
- <Button onClick={showMore}>
65
- <Flex direction="row">
66
- <Text h4 color={{ foreground: "#626263", background: "#626263" }}>
67
- Show More
68
- </Text>{" "}
69
- <Icon icon="keyboard_arrow_down"/>
70
- </Flex>
71
- </Button>
72
- </div>)}
73
- </Elevation>
74
- <style jsx>{`
75
- :global(.comment-section-main) {
76
- padding: 20px;
77
- max-width: ${maxWidth ? maxWidth : "300px"};
78
- width: 100%;
79
- }
80
- :global(.comment-grid-custom, .comment-section-header) {
81
- padding: 15px 0px 15px 0px;
82
- }
83
- :global(.comment-icon) {
84
- cursor: pointer;
85
- }
86
- .comment-section-footer {
87
- text-align: center;
88
- }
89
- .profile-icon {
90
- width: 40px;
91
- }
92
- `}</style>
93
- </Fragment>);
94
- };
95
- export default CommentSection;
@@ -1,97 +0,0 @@
1
- import React, { useState } from "react";
2
- import CenterDecorator from "../../utils/center-decorator";
3
- import CommentSection from "./comment-section";
4
- import nanoid from "nanoid";
5
- import logo from "../list/causes-icon.svg";
6
- export default {
7
- title: "Comment Section",
8
- decorators: [CenterDecorator],
9
- };
10
- export const CommentSectionStory = () => {
11
- let [comments, setComments] = useState([
12
- {
13
- userId: 1233323,
14
- profileImage: logo,
15
- username: "User",
16
- liked: true,
17
- donation: 100,
18
- comment: "Lorem ispum pro nubis la .",
19
- },
20
- {
21
- userId: 675342,
22
- profileImage: logo,
23
- username: "User",
24
- liked: true,
25
- donation: 100,
26
- },
27
- {
28
- userId: 991233,
29
- profileImage: logo,
30
- username: "User",
31
- donation: 400,
32
- comment: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.",
33
- liked: true,
34
- subComment: [
35
- {
36
- userId: 679380,
37
- profileImage: logo,
38
- username: "Sub User",
39
- comment: "Lorem ispum pro nubis la.",
40
- liked: false,
41
- },
42
- {
43
- userId: 7454533,
44
- profileImage: logo,
45
- username: "Sub User",
46
- comment: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.",
47
- liked: true,
48
- },
49
- ],
50
- },
51
- {
52
- userId: 777753,
53
- profileImage: logo,
54
- username: "User",
55
- liked: false,
56
- donation: 16,
57
- comment: "Lorem ispum pro nubis la.",
58
- },
59
- {
60
- userId: 756453,
61
- profileImage: logo,
62
- username: "User",
63
- liked: false,
64
- donation: 1000,
65
- comment: "Lorem ispum pro nubis la.",
66
- },
67
- ]);
68
- const handleLikeClick = (event) => {
69
- setComments(comments.map(res => {
70
- if (res.userId == event.userId) {
71
- return {
72
- ...res,
73
- liked: !res.liked,
74
- };
75
- }
76
- return res;
77
- }));
78
- };
79
- const handleShowMore = () => {
80
- let userId = nanoid();
81
- setComments([
82
- ...comments,
83
- {
84
- userId,
85
- profileImage: logo,
86
- username: "User",
87
- liked: false,
88
- donation: 100,
89
- comment: "Lorem ispum pro nubis la.",
90
- },
91
- ]);
92
- };
93
- return (<CommentSection maxWidth={"600px"} title="Comment Component" showMore={handleShowMore} likeCall={handleLikeClick} comments={comments}/>);
94
- };
95
- CommentSectionStory.story = {
96
- name: "default",
97
- };
@@ -1 +0,0 @@
1
- export { default as CommentsSection } from "./comment-section";
@@ -1,10 +0,0 @@
1
- import React, { useRef } from "react";
2
- import ReactCropper from "react-cropper";
3
- const Cropper = ({ image, aspectRatio, cropImage, autoCropArea = 1, ...res }) => {
4
- const cropperRef = useRef(null);
5
- const crop = () => {
6
- cropImage(cropperRef.current.getCroppedCanvas().toDataURL());
7
- };
8
- return (<ReactCropper ref={cropperRef} src={image} aspectRatio={aspectRatio} crop={crop} autoCropArea={autoCropArea} {...res}/>);
9
- };
10
- 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";