@spaced-out/ui-design-system 0.0.1-alpha.0

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 (259) hide show
  1. package/.commitlintrc.json +3 -0
  2. package/.cspell/custom-words.txt +22 -0
  3. package/.editorconfig +9 -0
  4. package/.eslintignore +1 -0
  5. package/.eslintrc.yml +122 -0
  6. package/.flowconfig +45 -0
  7. package/.github/workflows/pages.yml +52 -0
  8. package/.prettierrc +11 -0
  9. package/.storybook/SenseTheme.js +12 -0
  10. package/.storybook/main.js +73 -0
  11. package/.storybook/manager-head.html +41 -0
  12. package/.storybook/manager.js +14 -0
  13. package/.storybook/preview-head.html +130 -0
  14. package/.storybook/preview.js +128 -0
  15. package/.storybook/public/favicon.ico +0 -0
  16. package/.storybook/public/favicon.svg +6 -0
  17. package/.storybook/public/fonts/CentraNo2-Book.woff +0 -0
  18. package/.storybook/public/fonts/CentraNo2-Book.woff2 +0 -0
  19. package/.storybook/public/fonts/CentraNo2-BookItalic.woff +0 -0
  20. package/.storybook/public/fonts/CentraNo2-BookItalic.woff2 +0 -0
  21. package/.storybook/public/fonts/CentraNo2-Medium.woff +0 -0
  22. package/.storybook/public/fonts/CentraNo2-Medium.woff2 +0 -0
  23. package/.vscode/extensions.json +3 -0
  24. package/CHANGELOG.md +73 -0
  25. package/README.md +178 -0
  26. package/babel.config.js +24 -0
  27. package/config.js +58 -0
  28. package/cspell.json +26 -0
  29. package/design-tokens/border/app-border.json +41 -0
  30. package/design-tokens/border/base-border.json +41 -0
  31. package/design-tokens/color/app-color.json +226 -0
  32. package/design-tokens/color/base-color.json +265 -0
  33. package/design-tokens/elevation/app-elevation.json +22 -0
  34. package/design-tokens/elevation/base-elevation.json +19 -0
  35. package/design-tokens/font/base-font.json +98 -0
  36. package/design-tokens/index.js +5 -0
  37. package/design-tokens/motion/app.motion.json +24 -0
  38. package/design-tokens/motion/base-motion.json +40 -0
  39. package/design-tokens/opacity/base-opacity.json +49 -0
  40. package/design-tokens/shadow/base-shadow.json +86 -0
  41. package/design-tokens/size/base-size.json +94 -0
  42. package/design-tokens/space/app-space.json +40 -0
  43. package/design-tokens/space/base-space.json +40 -0
  44. package/flow-typed/npm/lodash_v4.x.x.js +6407 -0
  45. package/git-conventional-commits.json +43 -0
  46. package/gulpfile.js +48 -0
  47. package/jest.config.js +9 -0
  48. package/lib/assets/fontawesome/LICENSE.txt +18 -0
  49. package/lib/assets/fontawesome/css/all.min.css +27184 -0
  50. package/lib/assets/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  51. package/lib/assets/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  52. package/lib/assets/fontawesome/webfonts/fa-duotone-900.ttf +0 -0
  53. package/lib/assets/fontawesome/webfonts/fa-duotone-900.woff2 +0 -0
  54. package/lib/assets/fontawesome/webfonts/fa-light-300.ttf +0 -0
  55. package/lib/assets/fontawesome/webfonts/fa-light-300.woff2 +0 -0
  56. package/lib/assets/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  57. package/lib/assets/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  58. package/lib/assets/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  59. package/lib/assets/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  60. package/lib/assets/fontawesome/webfonts/fa-thin-100.ttf +0 -0
  61. package/lib/assets/fontawesome/webfonts/fa-thin-100.woff2 +0 -0
  62. package/lib/assets/fontawesome/webfonts/fa-v4compatibility.ttf +0 -0
  63. package/lib/assets/fontawesome/webfonts/fa-v4compatibility.woff2 +0 -0
  64. package/lib/components/Button/Button.js +120 -0
  65. package/lib/components/Button/Button.js.flow +166 -0
  66. package/lib/components/Button/Button.module.css +226 -0
  67. package/lib/components/Button/index.js +24 -0
  68. package/lib/components/Button/index.js.flow +4 -0
  69. package/lib/components/ButtonDropdown/ButtonDropdown.js +89 -0
  70. package/lib/components/ButtonDropdown/ButtonDropdown.js.flow +119 -0
  71. package/lib/components/ButtonDropdown/ButtonDropdown.module.css +4 -0
  72. package/lib/components/ButtonDropdown/index.js +12 -0
  73. package/lib/components/ButtonDropdown/index.js.flow +4 -0
  74. package/lib/components/Checkbox/Checkbox.js +99 -0
  75. package/lib/components/Checkbox/Checkbox.js.flow +133 -0
  76. package/lib/components/Checkbox/Checkbox.module.css +160 -0
  77. package/lib/components/Checkbox/CheckboxGroup.js +85 -0
  78. package/lib/components/Checkbox/CheckboxGroup.js.flow +105 -0
  79. package/lib/components/Checkbox/CheckboxGroup.module.css +47 -0
  80. package/lib/components/Checkbox/index.js +19 -0
  81. package/lib/components/Checkbox/index.js.flow +3 -0
  82. package/lib/components/CircularLoader/CircularLoader.js +44 -0
  83. package/lib/components/CircularLoader/CircularLoader.js.flow +44 -0
  84. package/lib/components/CircularLoader/CircularLoader.module.css +81 -0
  85. package/lib/components/CircularLoader/index.js +12 -0
  86. package/lib/components/CircularLoader/index.js.flow +3 -0
  87. package/lib/components/CodeBlock.js +26 -0
  88. package/lib/components/CodeBlock.js.flow +19 -0
  89. package/lib/components/Dialog/Dialog.js +148 -0
  90. package/lib/components/Dialog/Dialog.js.flow +165 -0
  91. package/lib/components/Dialog/Dialog.module.css +87 -0
  92. package/lib/components/Dialog/index.js +36 -0
  93. package/lib/components/Dialog/index.js.flow +14 -0
  94. package/lib/components/Dropdown/Dropdown.js +108 -0
  95. package/lib/components/Dropdown/Dropdown.js.flow +129 -0
  96. package/lib/components/Dropdown/Dropdown.module.css +14 -0
  97. package/lib/components/Dropdown/index.js +18 -0
  98. package/lib/components/Dropdown/index.js.flow +4 -0
  99. package/lib/components/Grid/Grid.js +82 -0
  100. package/lib/components/Grid/Grid.js.flow +88 -0
  101. package/lib/components/Grid/Grid.module.css +30 -0
  102. package/lib/components/Grid/index.js +16 -0
  103. package/lib/components/Grid/index.js.flow +3 -0
  104. package/lib/components/Icon/ClickableIcon.js +51 -0
  105. package/lib/components/Icon/ClickableIcon.js.flow +51 -0
  106. package/lib/components/Icon/ClickableIcon.module.css +50 -0
  107. package/lib/components/Icon/FontAwesomeLibrary.js +3 -0
  108. package/lib/components/Icon/FontAwesomeLibrary.js.flow +3 -0
  109. package/lib/components/Icon/Icon.js +38 -0
  110. package/lib/components/Icon/Icon.js.flow +51 -0
  111. package/lib/components/Icon/index.js +25 -0
  112. package/lib/components/Icon/index.js.flow +6 -0
  113. package/lib/components/InContextAlert/InContextAlert.js +121 -0
  114. package/lib/components/InContextAlert/InContextAlert.js.flow +173 -0
  115. package/lib/components/InContextAlert/InContextAlert.module.css +54 -0
  116. package/lib/components/InContextAlert/index.js +18 -0
  117. package/lib/components/InContextAlert/index.js.flow +3 -0
  118. package/lib/components/Input/Input.js +172 -0
  119. package/lib/components/Input/Input.js.flow +246 -0
  120. package/lib/components/Input/Input.module.css +122 -0
  121. package/lib/components/Input/index.js +12 -0
  122. package/lib/components/Input/index.js.flow +4 -0
  123. package/lib/components/LinearLoader/LinearLoader.js +35 -0
  124. package/lib/components/LinearLoader/LinearLoader.js.flow +34 -0
  125. package/lib/components/LinearLoader/LinearLoader.module.css +43 -0
  126. package/lib/components/LinearLoader/index.js +12 -0
  127. package/lib/components/LinearLoader/index.js.flow +3 -0
  128. package/lib/components/Menu/Menu.js +76 -0
  129. package/lib/components/Menu/Menu.js.flow +85 -0
  130. package/lib/components/Menu/Menu.module.css +124 -0
  131. package/lib/components/Menu/index.js +12 -0
  132. package/lib/components/Menu/index.js.flow +4 -0
  133. package/lib/components/Modal/Modal.js +121 -0
  134. package/lib/components/Modal/Modal.js.flow +157 -0
  135. package/lib/components/Modal/Modal.module.css +62 -0
  136. package/lib/components/Modal/index.js +12 -0
  137. package/lib/components/Modal/index.js.flow +3 -0
  138. package/lib/components/Notification/Notification.js +89 -0
  139. package/lib/components/Notification/Notification.js.flow +136 -0
  140. package/lib/components/Notification/Notification.module.css +54 -0
  141. package/lib/components/Notification/index.js +18 -0
  142. package/lib/components/Notification/index.js.flow +3 -0
  143. package/lib/components/Panel/Panel.js +96 -0
  144. package/lib/components/Panel/Panel.js.flow +109 -0
  145. package/lib/components/Panel/Panel.module.css +77 -0
  146. package/lib/components/Panel/index.js +30 -0
  147. package/lib/components/Panel/index.js.flow +10 -0
  148. package/lib/components/RadioButton/RadioButton.js +76 -0
  149. package/lib/components/RadioButton/RadioButton.js.flow +102 -0
  150. package/lib/components/RadioButton/RadioButton.module.css +122 -0
  151. package/lib/components/RadioButton/RadioGroup.js +60 -0
  152. package/lib/components/RadioButton/RadioGroup.js.flow +85 -0
  153. package/lib/components/RadioButton/RadioGroup.module.css +47 -0
  154. package/lib/components/RadioButton/index.js +19 -0
  155. package/lib/components/RadioButton/index.js.flow +3 -0
  156. package/lib/components/SearchInput/SearchInput.js +47 -0
  157. package/lib/components/SearchInput/SearchInput.js.flow +73 -0
  158. package/lib/components/SearchInput/SearchInput.module.css +11 -0
  159. package/lib/components/SearchInput/index.js +12 -0
  160. package/lib/components/SearchInput/index.js.flow +4 -0
  161. package/lib/components/Text/Text.js +195 -0
  162. package/lib/components/Text/Text.js.flow +160 -0
  163. package/lib/components/Text/index.js +103 -0
  164. package/lib/components/Text/index.js.flow +21 -0
  165. package/lib/components/Textarea/Textarea.js +95 -0
  166. package/lib/components/Textarea/Textarea.js.flow +133 -0
  167. package/lib/components/Textarea/Textarea.module.css +110 -0
  168. package/lib/components/Textarea/index.js +12 -0
  169. package/lib/components/Textarea/index.js.flow +4 -0
  170. package/lib/components/Toast/Toast.js +187 -0
  171. package/lib/components/Toast/Toast.js.flow +210 -0
  172. package/lib/components/Toast/Toast.module.css +52 -0
  173. package/lib/components/Toast/ToastContainer.js +129 -0
  174. package/lib/components/Toast/ToastContainer.js.flow +125 -0
  175. package/lib/components/Toast/ToastContainer.module.css +41 -0
  176. package/lib/components/Toast/ToastManager.js +62 -0
  177. package/lib/components/Toast/ToastManager.js.flow +67 -0
  178. package/lib/components/Toast/index.js +56 -0
  179. package/lib/components/Toast/index.js.flow +12 -0
  180. package/lib/components/Toggle/Toggle.js +69 -0
  181. package/lib/components/Toggle/Toggle.js.flow +94 -0
  182. package/lib/components/Toggle/Toggle.module.css +144 -0
  183. package/lib/components/Toggle/index.js +12 -0
  184. package/lib/components/Toggle/index.js.flow +2 -0
  185. package/lib/components/Tooltip/Tooltip.js +81 -0
  186. package/lib/components/Tooltip/Tooltip.js.flow +110 -0
  187. package/lib/components/Tooltip/Tooltip.module.css +16 -0
  188. package/lib/components/Tooltip/index.js +12 -0
  189. package/lib/components/Tooltip/index.js.flow +4 -0
  190. package/lib/components/Truncate/Truncate.js +28 -0
  191. package/lib/components/Truncate/Truncate.js.flow +22 -0
  192. package/lib/components/Truncate/Truncate.module.css +6 -0
  193. package/lib/components/Truncate/index.js +12 -0
  194. package/lib/components/Truncate/index.js.flow +4 -0
  195. package/lib/components/Typeahead/Typeahead.js +124 -0
  196. package/lib/components/Typeahead/Typeahead.js.flow +153 -0
  197. package/lib/components/Typeahead/Typeahead.module.css +10 -0
  198. package/lib/components/Typeahead/index.js +12 -0
  199. package/lib/components/Typeahead/index.js.flow +4 -0
  200. package/lib/hooks/index.js +27 -0
  201. package/lib/hooks/index.js.flow +4 -0
  202. package/lib/hooks/useMountTransition.js +25 -0
  203. package/lib/hooks/useMountTransition.js.flow +27 -0
  204. package/lib/hooks/useToastPortal.js +32 -0
  205. package/lib/hooks/useToastPortal.js.flow +30 -0
  206. package/lib/styles/animation.module.css +9 -0
  207. package/lib/styles/border.module.css +27 -0
  208. package/lib/styles/shadow.module.css +42 -0
  209. package/lib/styles/typography.module.css +227 -0
  210. package/lib/styles/variables/_border.css +21 -0
  211. package/lib/styles/variables/_border.js +29 -0
  212. package/lib/styles/variables/_border.js.flow +23 -0
  213. package/lib/styles/variables/_color.css +131 -0
  214. package/lib/styles/variables/_color.js +139 -0
  215. package/lib/styles/variables/_color.js.flow +133 -0
  216. package/lib/styles/variables/_elevation.css +11 -0
  217. package/lib/styles/variables/_elevation.js +19 -0
  218. package/lib/styles/variables/_elevation.js.flow +13 -0
  219. package/lib/styles/variables/_font.css +51 -0
  220. package/lib/styles/variables/_font.js +59 -0
  221. package/lib/styles/variables/_font.js.flow +53 -0
  222. package/lib/styles/variables/_motion.css +11 -0
  223. package/lib/styles/variables/_motion.js +19 -0
  224. package/lib/styles/variables/_motion.js.flow +13 -0
  225. package/lib/styles/variables/_opacity.css +29 -0
  226. package/lib/styles/variables/_opacity.js +37 -0
  227. package/lib/styles/variables/_opacity.js.flow +31 -0
  228. package/lib/styles/variables/_shadow.css +47 -0
  229. package/lib/styles/variables/_shadow.js +55 -0
  230. package/lib/styles/variables/_shadow.js.flow +49 -0
  231. package/lib/styles/variables/_size.css +59 -0
  232. package/lib/styles/variables/_size.js +67 -0
  233. package/lib/styles/variables/_size.js.flow +61 -0
  234. package/lib/styles/variables/_space.css +23 -0
  235. package/lib/styles/variables/_space.js +31 -0
  236. package/lib/styles/variables/_space.js.flow +25 -0
  237. package/lib/types/common.js +1 -0
  238. package/lib/types/common.js.flow +3 -0
  239. package/lib/types/toast.js +24 -0
  240. package/lib/types/toast.js.flow +41 -0
  241. package/lib/types/typography.js +22 -0
  242. package/lib/types/typography.js.flow +18 -0
  243. package/lib/utils/classify.js +33 -0
  244. package/lib/utils/classify.js.flow +29 -0
  245. package/lib/utils/click-away.js +110 -0
  246. package/lib/utils/click-away.js.flow +134 -0
  247. package/lib/utils/dom.js +202 -0
  248. package/lib/utils/dom.js.flow +238 -0
  249. package/lib/utils/helpers.js +16 -0
  250. package/lib/utils/helpers.js.flow +11 -0
  251. package/lib/utils/makeClassNameComponent.js +58 -0
  252. package/lib/utils/makeClassNameComponent.js.flow +71 -0
  253. package/lib/utils/merge-refs.js +17 -0
  254. package/lib/utils/merge-refs.js.flow +14 -0
  255. package/lint-staged.config.js +5 -0
  256. package/package.json +114 -0
  257. package/postcss.config.js +3 -0
  258. package/pull_request_template.md +48 -0
  259. package/settings.json +3 -0
@@ -0,0 +1,85 @@
1
+ // @flow strict
2
+
3
+ import * as React from 'react';
4
+
5
+ import type {GroupAlign} from '../../types/common';
6
+ import classify from '../../utils/classify';
7
+ import {BodySmall} from '../Text/Text.js';
8
+
9
+ import css from './RadioGroup.module.css';
10
+
11
+ /**
12
+ * Note:
13
+ * Do not wrap Radio in a label. For simplicity's sake, Radio uses an
14
+ * internal label tag to handle click delegation to the hidden input, and
15
+ * nesting labels is a bad idea.
16
+ */
17
+
18
+ type ClassNames = $ReadOnly<{
19
+ wrapper?: string,
20
+ radioGroup?: string,
21
+ errorText?: string,
22
+ }>;
23
+
24
+ export type RadioGroupProps = {
25
+ align?: GroupAlign,
26
+ name: string,
27
+ value?: string,
28
+ onChange?: (value: string) => mixed,
29
+ children?: React.Node,
30
+ classNames?: ClassNames,
31
+ error?: boolean,
32
+ errorText?: string,
33
+ };
34
+
35
+ export const RadioGroup = ({
36
+ align = 'vertical',
37
+ name,
38
+ value,
39
+ onChange,
40
+ children,
41
+ classNames,
42
+ error = false,
43
+ errorText = '',
44
+ }: RadioGroupProps): React.Node => {
45
+ const onChangeHandler = (value) => {
46
+ if (onChange) {
47
+ onChange(value);
48
+ }
49
+ };
50
+
51
+ const childrenWithProps = React.Children.map(children, (child) => {
52
+ if (React.isValidElement(child)) {
53
+ return React.cloneElement(child, {
54
+ name,
55
+ selectedValue: value,
56
+ onChange: onChangeHandler,
57
+ align,
58
+ error,
59
+ });
60
+ }
61
+ return child;
62
+ });
63
+
64
+ return (
65
+ <div className={classify(css.radioGroupContainer, classNames?.wrapper)}>
66
+ <div
67
+ className={classify(
68
+ {
69
+ [css.vertical]: align === 'vertical',
70
+ [css.horizontal]: align === 'horizontal-fixed',
71
+ [css.horizontalFluid]: align === 'horizontal-fluid',
72
+ },
73
+ classNames?.radioGroup,
74
+ )}
75
+ >
76
+ {childrenWithProps}
77
+ </div>
78
+ {error && (
79
+ <BodySmall color="danger" className={classNames?.errorText}>
80
+ {errorText}
81
+ </BodySmall>
82
+ )}
83
+ </div>
84
+ );
85
+ };
@@ -0,0 +1,47 @@
1
+ @value (
2
+ colorBackgroundTertiary,
3
+ colorBorderSecondary,
4
+ colorFillPrimary,
5
+ colorFillDisabled,
6
+ colorFocusPrimary
7
+ ) from '../../styles/variables/_color.css';
8
+
9
+ @value (
10
+ spaceXSmall,
11
+ spaceSmall,
12
+ spaceMedium
13
+ ) from '../../styles/variables/_space.css';
14
+
15
+ @value (
16
+ size500,
17
+ sizeFluid
18
+ ) from '../../styles/variables/_size.css';
19
+
20
+ .radioGroupContainer {
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: spaceXSmall;
24
+ }
25
+
26
+ .vertical {
27
+ display: flex;
28
+ flex-direction: column;
29
+ align-items: flex-start;
30
+ gap: spaceSmall;
31
+ }
32
+
33
+ .horizontal {
34
+ display: flex;
35
+ align-items: flex-start;
36
+ gap: spaceMedium;
37
+ flex-wrap: wrap;
38
+ width: sizeFluid;
39
+ }
40
+
41
+ .horizontalFluid {
42
+ display: flex;
43
+ align-items: flex-start;
44
+ gap: spaceMedium;
45
+ flex-wrap: wrap;
46
+ width: sizeFluid;
47
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "RadioButton", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _RadioButton.RadioButton;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "RadioGroup", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _RadioGroup.RadioGroup;
16
+ }
17
+ });
18
+ var _RadioButton = require("./RadioButton.js");
19
+ var _RadioGroup = require("./RadioGroup.js");
@@ -0,0 +1,3 @@
1
+ //@flow strict
2
+ export {RadioButton} from './RadioButton.js';
3
+ export {RadioGroup} from './RadioGroup.js';
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SearchInput = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _Input = require("../Input");
9
+ var _SearchInputModule = _interopRequireDefault(require("./SearchInput.module.css"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+
15
+ const SearchInput = _ref => {
16
+ let {
17
+ value,
18
+ disabled,
19
+ locked,
20
+ placeholder = 'Search...',
21
+ classNames,
22
+ ...searchInputProps
23
+ } = _ref;
24
+ const [searchValue, setSearchValue] = React.useState(value);
25
+ React.useEffect(() => {
26
+ setSearchValue(value);
27
+ }, [value]);
28
+ const handleClearClick = () => {
29
+ setSearchValue('');
30
+ };
31
+ return /*#__PURE__*/(0, _jsxRuntime.js)(_Input.Input, {
32
+ ...searchInputProps,
33
+ classNames: {
34
+ ...classNames,
35
+ iconRight: searchValue && !(disabled || locked) ? _SearchInputModule.default.clickable : '',
36
+ iconLeft: searchValue && !disabled ? _SearchInputModule.default.primaryText : ''
37
+ },
38
+ placeholder: placeholder,
39
+ value: searchValue,
40
+ disabled: disabled,
41
+ locked: locked,
42
+ iconLeftName: "magnifying-glass",
43
+ iconRightName: searchValue && !(disabled || locked) ? 'xmark' : 'fw',
44
+ onIconRightClick: handleClearClick
45
+ });
46
+ };
47
+ exports.SearchInput = SearchInput;
@@ -0,0 +1,73 @@
1
+ // @flow strict
2
+
3
+ import * as React from 'react';
4
+
5
+ import {Input} from '../Input';
6
+
7
+ import css from './SearchInput.module.css';
8
+
9
+
10
+ type ClassNames = $ReadOnly<{box?: string, iconLeft?: string}>;
11
+
12
+ export type SearchInputProps = {
13
+ classNames?: ClassNames,
14
+ name?: string,
15
+ placeholder?: string,
16
+ disabled?: boolean,
17
+ locked?: boolean,
18
+ value?: string,
19
+ error?: boolean,
20
+ errorText?: string,
21
+ label?: string | React.Node,
22
+ helperText?: string | React.Node,
23
+ size?: 'medium' | 'small',
24
+ required?: boolean,
25
+ boxRef?: (?HTMLElement) => mixed,
26
+ onChange?: (
27
+ evt: SyntheticInputEvent<HTMLInputElement>,
28
+ isEnter?: boolean,
29
+ ) => mixed,
30
+ onFocus?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
31
+ onBlur?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
32
+ onKeyDown?: (e: SyntheticKeyboardEvent<HTMLInputElement>) => mixed,
33
+ onPaste?: (e: ClipboardEvent) => mixed,
34
+ onPaste?: (e: ClipboardEvent) => mixed,
35
+ onContainerClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
36
+ };
37
+
38
+ export const SearchInput = ({
39
+ value,
40
+ disabled,
41
+ locked,
42
+ placeholder = 'Search...',
43
+ classNames,
44
+ ...searchInputProps
45
+ }: SearchInputProps): React.Node => {
46
+ const [searchValue, setSearchValue] = React.useState(value);
47
+
48
+ React.useEffect(() => {
49
+ setSearchValue(value);
50
+ }, [value]);
51
+
52
+ const handleClearClick = () => {
53
+ setSearchValue('');
54
+ };
55
+
56
+ return (
57
+ <Input
58
+ {...searchInputProps}
59
+ classNames={{
60
+ ...classNames,
61
+ iconRight: searchValue && !(disabled || locked) ? css.clickable : '',
62
+ iconLeft: searchValue && !disabled ? css.primaryText : '',
63
+ }}
64
+ placeholder={placeholder}
65
+ value={searchValue}
66
+ disabled={disabled}
67
+ locked={locked}
68
+ iconLeftName="magnifying-glass"
69
+ iconRightName={searchValue && !(disabled || locked) ? 'xmark' : 'fw'}
70
+ onIconRightClick={handleClearClick}
71
+ />
72
+ );
73
+ };
@@ -0,0 +1,11 @@
1
+ @value (
2
+ colorTextPrimary
3
+ ) from '../../styles/variables/_color.css';
4
+
5
+ .clickable {
6
+ cursor: pointer;
7
+ }
8
+
9
+ .primaryText {
10
+ color: colorTextPrimary;
11
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "SearchInput", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _SearchInput.SearchInput;
10
+ }
11
+ });
12
+ var _SearchInput = require("./SearchInput");
@@ -0,0 +1,4 @@
1
+ // @flow strict
2
+
3
+ export type {SearchInputProps} from './SearchInput';
4
+ export {SearchInput} from './SearchInput';
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TitleMedium = exports.SubTitleSmall = exports.SubTitleMedium = exports.SubTitleLarge = exports.SubTitleExtraSmall = exports.JumboMedium = exports.FormLabelSmall = exports.FormLabelMedium = exports.FormInputSmall = exports.FormInputMedium = exports.ButtonTextSmall = exports.ButtonTextMedium = exports.BodySmall = exports.BodyMedium = exports.BodyLarge = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _typography = require("../../types/typography");
9
+ var _classify = _interopRequireDefault(require("../../utils/classify"));
10
+ var _typographyModule = _interopRequireDefault(require("../../styles/typography.module.css"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+
16
+ const JumboMedium = _ref => {
17
+ let {
18
+ color = _typography.TEXT_COLORS.primary,
19
+ children,
20
+ className
21
+ } = _ref;
22
+ return /*#__PURE__*/(0, _jsxRuntime.js)("span", {
23
+ className: (0, _classify.default)(_typographyModule.default.jumboMedium, _typographyModule.default[color], className),
24
+ children: children
25
+ });
26
+ };
27
+ exports.JumboMedium = JumboMedium;
28
+ const TitleMedium = _ref2 => {
29
+ let {
30
+ color = _typography.TEXT_COLORS.primary,
31
+ children,
32
+ className
33
+ } = _ref2;
34
+ return /*#__PURE__*/(0, _jsxRuntime.js)("h1", {
35
+ className: (0, _classify.default)(_typographyModule.default.titleMedium, _typographyModule.default[color], className),
36
+ children: children
37
+ });
38
+ };
39
+ exports.TitleMedium = TitleMedium;
40
+ const SubTitleLarge = _ref3 => {
41
+ let {
42
+ color = _typography.TEXT_COLORS.primary,
43
+ children,
44
+ className
45
+ } = _ref3;
46
+ return /*#__PURE__*/(0, _jsxRuntime.js)("h2", {
47
+ className: (0, _classify.default)(_typographyModule.default.subTitleLarge, _typographyModule.default[color], className),
48
+ children: children
49
+ });
50
+ };
51
+ exports.SubTitleLarge = SubTitleLarge;
52
+ const SubTitleMedium = _ref4 => {
53
+ let {
54
+ color = _typography.TEXT_COLORS.primary,
55
+ children,
56
+ className
57
+ } = _ref4;
58
+ return /*#__PURE__*/(0, _jsxRuntime.js)("h3", {
59
+ className: (0, _classify.default)(_typographyModule.default.subTitleMedium, _typographyModule.default[color], className),
60
+ children: children
61
+ });
62
+ };
63
+ exports.SubTitleMedium = SubTitleMedium;
64
+ const SubTitleSmall = _ref5 => {
65
+ let {
66
+ color = _typography.TEXT_COLORS.primary,
67
+ children,
68
+ className
69
+ } = _ref5;
70
+ return /*#__PURE__*/(0, _jsxRuntime.js)("h4", {
71
+ className: (0, _classify.default)(_typographyModule.default.subTitleSmall, _typographyModule.default[color], className),
72
+ children: children
73
+ });
74
+ };
75
+ exports.SubTitleSmall = SubTitleSmall;
76
+ const SubTitleExtraSmall = _ref6 => {
77
+ let {
78
+ color = _typography.TEXT_COLORS.primary,
79
+ children,
80
+ className
81
+ } = _ref6;
82
+ return /*#__PURE__*/(0, _jsxRuntime.js)("h5", {
83
+ className: (0, _classify.default)(_typographyModule.default.subTitleExtraSmall, _typographyModule.default[color], className),
84
+ children: children
85
+ });
86
+ };
87
+ exports.SubTitleExtraSmall = SubTitleExtraSmall;
88
+ const ButtonTextMedium = _ref7 => {
89
+ let {
90
+ color = _typography.TEXT_COLORS.primary,
91
+ children,
92
+ className
93
+ } = _ref7;
94
+ return /*#__PURE__*/(0, _jsxRuntime.js)("span", {
95
+ className: (0, _classify.default)(_typographyModule.default.buttonTextMedium, _typographyModule.default[color], className),
96
+ children: children
97
+ });
98
+ };
99
+ exports.ButtonTextMedium = ButtonTextMedium;
100
+ const ButtonTextSmall = _ref8 => {
101
+ let {
102
+ color = _typography.TEXT_COLORS.primary,
103
+ children,
104
+ className
105
+ } = _ref8;
106
+ return /*#__PURE__*/(0, _jsxRuntime.js)("span", {
107
+ className: (0, _classify.default)(_typographyModule.default.buttonTextSmall, _typographyModule.default[color], className),
108
+ children: children
109
+ });
110
+ };
111
+ exports.ButtonTextSmall = ButtonTextSmall;
112
+ const FormInputMedium = _ref9 => {
113
+ let {
114
+ color = _typography.TEXT_COLORS.primary,
115
+ children,
116
+ className
117
+ } = _ref9;
118
+ return /*#__PURE__*/(0, _jsxRuntime.js)("p", {
119
+ className: (0, _classify.default)(_typographyModule.default.formInputMedium, _typographyModule.default[color], className),
120
+ children: children
121
+ });
122
+ };
123
+ exports.FormInputMedium = FormInputMedium;
124
+ const FormInputSmall = _ref10 => {
125
+ let {
126
+ color = _typography.TEXT_COLORS.primary,
127
+ children,
128
+ className
129
+ } = _ref10;
130
+ return /*#__PURE__*/(0, _jsxRuntime.js)("p", {
131
+ className: (0, _classify.default)(_typographyModule.default.formInputSmall, _typographyModule.default[color], className),
132
+ children: children
133
+ });
134
+ };
135
+ exports.FormInputSmall = FormInputSmall;
136
+ const BodyLarge = _ref11 => {
137
+ let {
138
+ color = _typography.TEXT_COLORS.primary,
139
+ children,
140
+ className
141
+ } = _ref11;
142
+ return /*#__PURE__*/(0, _jsxRuntime.js)("p", {
143
+ className: (0, _classify.default)(_typographyModule.default.bodyLarge, _typographyModule.default[color], className),
144
+ children: children
145
+ });
146
+ };
147
+ exports.BodyLarge = BodyLarge;
148
+ const BodyMedium = _ref12 => {
149
+ let {
150
+ color = _typography.TEXT_COLORS.primary,
151
+ children,
152
+ className
153
+ } = _ref12;
154
+ return /*#__PURE__*/(0, _jsxRuntime.js)("p", {
155
+ className: (0, _classify.default)(_typographyModule.default.bodyMedium, _typographyModule.default[color], className),
156
+ children: children
157
+ });
158
+ };
159
+ exports.BodyMedium = BodyMedium;
160
+ const BodySmall = _ref13 => {
161
+ let {
162
+ color = _typography.TEXT_COLORS.primary,
163
+ children,
164
+ className
165
+ } = _ref13;
166
+ return /*#__PURE__*/(0, _jsxRuntime.js)("p", {
167
+ className: (0, _classify.default)(_typographyModule.default.bodySmall, _typographyModule.default[color], className),
168
+ children: children
169
+ });
170
+ };
171
+ exports.BodySmall = BodySmall;
172
+ const FormLabelMedium = _ref14 => {
173
+ let {
174
+ color = _typography.TEXT_COLORS.primary,
175
+ children,
176
+ className
177
+ } = _ref14;
178
+ return /*#__PURE__*/(0, _jsxRuntime.js)("span", {
179
+ className: (0, _classify.default)(_typographyModule.default.formLabelMedium, _typographyModule.default[color], className),
180
+ children: children
181
+ });
182
+ };
183
+ exports.FormLabelMedium = FormLabelMedium;
184
+ const FormLabelSmall = _ref15 => {
185
+ let {
186
+ color = _typography.TEXT_COLORS.primary,
187
+ children,
188
+ className
189
+ } = _ref15;
190
+ return /*#__PURE__*/(0, _jsxRuntime.js)("span", {
191
+ className: (0, _classify.default)(_typographyModule.default.formLabelSmall, _typographyModule.default[color], className),
192
+ children: children
193
+ });
194
+ };
195
+ exports.FormLabelSmall = FormLabelSmall;
@@ -0,0 +1,160 @@
1
+ // @flow strict
2
+
3
+ import * as React from 'react';
4
+
5
+ import type {ColorTypes} from '../../types/typography';
6
+ import {TEXT_COLORS} from '../../types/typography';
7
+ import classify from '../../utils/classify';
8
+
9
+ import css from '../../styles/typography.module.css';
10
+
11
+
12
+ export type TextProps = {
13
+ color?: ColorTypes,
14
+ children?: React.Node,
15
+ className?: string,
16
+ };
17
+
18
+ export const JumboMedium = ({
19
+ color = TEXT_COLORS.primary,
20
+ children,
21
+ className,
22
+ }: TextProps): React.Node => (
23
+ <span className={classify(css.jumboMedium, css[color], className)}>
24
+ {children}
25
+ </span>
26
+ );
27
+
28
+ export const TitleMedium = ({
29
+ color = TEXT_COLORS.primary,
30
+ children,
31
+ className,
32
+ }: TextProps): React.Node => (
33
+ <h1 className={classify(css.titleMedium, css[color], className)}>
34
+ {children}
35
+ </h1>
36
+ );
37
+
38
+ export const SubTitleLarge = ({
39
+ color = TEXT_COLORS.primary,
40
+ children,
41
+ className,
42
+ }: TextProps): React.Node => (
43
+ <h2 className={classify(css.subTitleLarge, css[color], className)}>
44
+ {children}
45
+ </h2>
46
+ );
47
+
48
+ export const SubTitleMedium = ({
49
+ color = TEXT_COLORS.primary,
50
+ children,
51
+ className,
52
+ }: TextProps): React.Node => (
53
+ <h3 className={classify(css.subTitleMedium, css[color], className)}>
54
+ {children}
55
+ </h3>
56
+ );
57
+
58
+ export const SubTitleSmall = ({
59
+ color = TEXT_COLORS.primary,
60
+ children,
61
+ className,
62
+ }: TextProps): React.Node => (
63
+ <h4 className={classify(css.subTitleSmall, css[color], className)}>
64
+ {children}
65
+ </h4>
66
+ );
67
+
68
+ export const SubTitleExtraSmall = ({
69
+ color = TEXT_COLORS.primary,
70
+ children,
71
+ className,
72
+ }: TextProps): React.Node => (
73
+ <h5 className={classify(css.subTitleExtraSmall, css[color], className)}>
74
+ {children}
75
+ </h5>
76
+ );
77
+
78
+ export const ButtonTextMedium = ({
79
+ color = TEXT_COLORS.primary,
80
+ children,
81
+ className,
82
+ }: TextProps): React.Node => (
83
+ <span className={classify(css.buttonTextMedium, css[color], className)}>
84
+ {children}
85
+ </span>
86
+ );
87
+
88
+ export const ButtonTextSmall = ({
89
+ color = TEXT_COLORS.primary,
90
+ children,
91
+ className,
92
+ }: TextProps): React.Node => (
93
+ <span className={classify(css.buttonTextSmall, css[color], className)}>
94
+ {children}
95
+ </span>
96
+ );
97
+
98
+ export const FormInputMedium = ({
99
+ color = TEXT_COLORS.primary,
100
+ children,
101
+ className,
102
+ }: TextProps): React.Node => (
103
+ <p className={classify(css.formInputMedium, css[color], className)}>
104
+ {children}
105
+ </p>
106
+ );
107
+
108
+ export const FormInputSmall = ({
109
+ color = TEXT_COLORS.primary,
110
+ children,
111
+ className,
112
+ }: TextProps): React.Node => (
113
+ <p className={classify(css.formInputSmall, css[color], className)}>
114
+ {children}
115
+ </p>
116
+ );
117
+
118
+ export const BodyLarge = ({
119
+ color = TEXT_COLORS.primary,
120
+ children,
121
+ className,
122
+ }: TextProps): React.Node => (
123
+ <p className={classify(css.bodyLarge, css[color], className)}>{children}</p>
124
+ );
125
+
126
+ export const BodyMedium = ({
127
+ color = TEXT_COLORS.primary,
128
+ children,
129
+ className,
130
+ }: TextProps): React.Node => (
131
+ <p className={classify(css.bodyMedium, css[color], className)}>{children}</p>
132
+ );
133
+
134
+ export const BodySmall = ({
135
+ color = TEXT_COLORS.primary,
136
+ children,
137
+ className,
138
+ }: TextProps): React.Node => (
139
+ <p className={classify(css.bodySmall, css[color], className)}>{children}</p>
140
+ );
141
+
142
+ export const FormLabelMedium = ({
143
+ color = TEXT_COLORS.primary,
144
+ children,
145
+ className,
146
+ }: TextProps): React.Node => (
147
+ <span className={classify(css.formLabelMedium, css[color], className)}>
148
+ {children}
149
+ </span>
150
+ );
151
+
152
+ export const FormLabelSmall = ({
153
+ color = TEXT_COLORS.primary,
154
+ children,
155
+ className,
156
+ }: TextProps): React.Node => (
157
+ <span className={classify(css.formLabelSmall, css[color], className)}>
158
+ {children}
159
+ </span>
160
+ );