@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,103 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "BodyLarge", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Text.BodyLarge;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "BodyMedium", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _Text.BodyMedium;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "BodySmall", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _Text.BodySmall;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "ButtonTextMedium", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _Text.ButtonTextMedium;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "ButtonTextSmall", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _Text.ButtonTextSmall;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "FormInputMedium", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _Text.FormInputMedium;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "FormInputSmall", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _Text.FormInputSmall;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "FormLabelMedium", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _Text.FormLabelMedium;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "FormLabelSmall", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _Text.FormLabelSmall;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "JumboMedium", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _Text.JumboMedium;
64
+ }
65
+ });
66
+ Object.defineProperty(exports, "SubTitleExtraSmall", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _Text.SubTitleExtraSmall;
70
+ }
71
+ });
72
+ Object.defineProperty(exports, "SubTitleLarge", {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _Text.SubTitleLarge;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, "SubTitleMedium", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _Text.SubTitleMedium;
82
+ }
83
+ });
84
+ Object.defineProperty(exports, "SubTitleSmall", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _Text.SubTitleSmall;
88
+ }
89
+ });
90
+ Object.defineProperty(exports, "TEXT_COLORS", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _typography.TEXT_COLORS;
94
+ }
95
+ });
96
+ Object.defineProperty(exports, "TitleMedium", {
97
+ enumerable: true,
98
+ get: function () {
99
+ return _Text.TitleMedium;
100
+ }
101
+ });
102
+ var _typography = require("../../types/typography");
103
+ var _Text = require("./Text");
@@ -0,0 +1,21 @@
1
+ // @flow strict
2
+
3
+ export {TEXT_COLORS} from '../../types/typography';
4
+ export type {TextProps} from './Text';
5
+ export {
6
+ BodyLarge,
7
+ BodyMedium,
8
+ BodySmall,
9
+ ButtonTextMedium,
10
+ ButtonTextSmall,
11
+ FormInputMedium,
12
+ FormInputSmall,
13
+ FormLabelMedium,
14
+ FormLabelSmall,
15
+ JumboMedium,
16
+ SubTitleExtraSmall,
17
+ SubTitleLarge,
18
+ SubTitleMedium,
19
+ SubTitleSmall,
20
+ TitleMedium,
21
+ } from './Text';
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Textarea = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _classify = require("../../utils/classify");
9
+ var _Text = require("../Text");
10
+ var _TextareaModule = _interopRequireDefault(require("./Textarea.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 Textarea_ = (props, ref) => {
17
+ const {
18
+ value,
19
+ onChange,
20
+ onFocus,
21
+ onBlur,
22
+ name,
23
+ disabled,
24
+ placeholder,
25
+ error,
26
+ locked,
27
+ errorText,
28
+ label,
29
+ helperText,
30
+ classNames,
31
+ size = 'medium',
32
+ required,
33
+ textCountLimit,
34
+ ...textareaProps
35
+ } = props;
36
+ const [textCountError, setTextCountError] = React.useState(false);
37
+ React.useEffect(() => {
38
+ if (textCountLimit) {
39
+ if (value && value.length > textCountLimit) {
40
+ setTextCountError(true);
41
+ } else {
42
+ setTextCountError(false);
43
+ }
44
+ }
45
+ }, [value]);
46
+ const controlledTextareaFilled = value !== '';
47
+ return /*#__PURE__*/(0, _jsxRuntime.jss)("div", {
48
+ className: (0, _classify.classify)(_TextareaModule.default.wrapper, {
49
+ [_TextareaModule.default.filled]: controlledTextareaFilled ?? false,
50
+ [_TextareaModule.default.withError]: (error || textCountError) ?? false
51
+ }),
52
+ children: [Boolean(label) && /*#__PURE__*/(0, _jsxRuntime.jss)("div", {
53
+ className: _TextareaModule.default.info,
54
+ children: [/*#__PURE__*/(0, _jsxRuntime.jss)("div", {
55
+ className: _TextareaModule.default.infoContent,
56
+ children: [/*#__PURE__*/(0, _jsxRuntime.js)(_Text.FormLabelSmall, {
57
+ color: "secondary",
58
+ children: label ?? ''
59
+ }), "\xA0", required && /*#__PURE__*/(0, _jsxRuntime.js)(_Text.FormLabelSmall, {
60
+ color: "danger",
61
+ children: '*'
62
+ })]
63
+ }), /*#__PURE__*/(0, _jsxRuntime.js)(_Text.FormLabelSmall, {
64
+ color: error || textCountError ? 'danger' : 'secondary',
65
+ children: !!textCountLimit && (value && value.length || 0) + '/' + textCountLimit
66
+ })]
67
+ }), /*#__PURE__*/(0, _jsxRuntime.js)("div", {
68
+ className: (0, _classify.classify)(_TextareaModule.default.box, classNames?.box, {
69
+ [_TextareaModule.default.inputDisabled]: disabled ?? false,
70
+ [_TextareaModule.default.medium]: size === 'medium',
71
+ [_TextareaModule.default.small]: size === 'small',
72
+ [_TextareaModule.default.locked]: locked
73
+ }),
74
+ children: /*#__PURE__*/(0, _jsxRuntime.js)("textarea", {
75
+ disabled: locked || disabled,
76
+ name: name,
77
+ ref: ref,
78
+ placeholder: placeholder,
79
+ value: value,
80
+ onChange: onChange,
81
+ onFocus: onFocus,
82
+ onBlur: onBlur,
83
+ ...textareaProps
84
+ })
85
+ }), (Boolean(helperText) || error) && /*#__PURE__*/(0, _jsxRuntime.js)("div", {
86
+ className: _TextareaModule.default.info,
87
+ children: /*#__PURE__*/(0, _jsxRuntime.js)(_Text.BodySmall, {
88
+ color: error && errorText ? 'danger' : disabled ? 'disabled' : 'secondary',
89
+ children: error && errorText ? errorText : helperText ?? ''
90
+ })
91
+ })]
92
+ });
93
+ };
94
+ const Textarea = /*#__PURE__*/React.forwardRef(Textarea_);
95
+ exports.Textarea = Textarea;
@@ -0,0 +1,133 @@
1
+ // @flow strict
2
+ import * as React from 'react';
3
+
4
+ import {classify} from '../../utils/classify';
5
+ import {BodySmall, FormLabelSmall} from '../Text';
6
+
7
+ import css from './Textarea.module.css';
8
+
9
+
10
+ type ClassNames = $ReadOnly<{box?: string}>;
11
+
12
+ export type TextareaProps = {
13
+ value?: string,
14
+ onChange?: (
15
+ evt: SyntheticInputEvent<HTMLInputElement>,
16
+ isEnter?: boolean,
17
+ ) => mixed,
18
+ onFocus?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
19
+ onBlur?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
20
+ onKeyDown?: (e: SyntheticKeyboardEvent<HTMLInputElement>) => mixed,
21
+ name?: string,
22
+ disabled?: boolean,
23
+ placeholder?: string,
24
+ locked?: boolean,
25
+ error?: boolean,
26
+ errorText?: string,
27
+ label?: string | React.Node,
28
+ helperText?: string | React.Node,
29
+ classNames?: ClassNames,
30
+ size?: 'medium' | 'small',
31
+ required?: boolean,
32
+ textCountLimit?: number,
33
+ };
34
+
35
+ const Textarea_ = (props: TextareaProps, ref): React.Node => {
36
+ const {
37
+ value,
38
+ onChange,
39
+ onFocus,
40
+ onBlur,
41
+ name,
42
+ disabled,
43
+ placeholder,
44
+ error,
45
+ locked,
46
+ errorText,
47
+ label,
48
+ helperText,
49
+ classNames,
50
+ size = 'medium',
51
+ required,
52
+ textCountLimit,
53
+ ...textareaProps
54
+ } = props;
55
+
56
+ const [textCountError, setTextCountError] = React.useState(false);
57
+
58
+ React.useEffect(() => {
59
+ if (textCountLimit) {
60
+ if (value && value.length > textCountLimit) {
61
+ setTextCountError(true);
62
+ } else {
63
+ setTextCountError(false);
64
+ }
65
+ }
66
+ }, [value]);
67
+
68
+ const controlledTextareaFilled = value !== '';
69
+
70
+ return (
71
+ <div
72
+ className={classify(css.wrapper, {
73
+ [css.filled]: controlledTextareaFilled ?? false,
74
+ [css.withError]: (error || textCountError) ?? false,
75
+ })}
76
+ >
77
+ {Boolean(label) && (
78
+ <div className={css.info}>
79
+ <div className={css.infoContent}>
80
+ <FormLabelSmall color="secondary">{label ?? ''}</FormLabelSmall>
81
+ &nbsp;
82
+ {required && <FormLabelSmall color="danger">{'*'}</FormLabelSmall>}
83
+ </div>
84
+ <FormLabelSmall
85
+ color={error || textCountError ? 'danger' : 'secondary'}
86
+ >
87
+ {!!textCountLimit &&
88
+ ((value && value.length) || 0) + '/' + textCountLimit}
89
+ </FormLabelSmall>
90
+ </div>
91
+ )}
92
+ <div
93
+ className={classify(css.box, classNames?.box, {
94
+ [css.inputDisabled]: disabled ?? false,
95
+ [css.medium]: size === 'medium',
96
+ [css.small]: size === 'small',
97
+ [css.locked]: locked,
98
+ })}
99
+ >
100
+ <textarea
101
+ disabled={locked || disabled}
102
+ name={name}
103
+ ref={ref}
104
+ placeholder={placeholder}
105
+ value={value}
106
+ onChange={onChange}
107
+ onFocus={onFocus}
108
+ onBlur={onBlur}
109
+ {...textareaProps}
110
+ ></textarea>
111
+ </div>
112
+ {(Boolean(helperText) || error) && (
113
+ <div className={css.info}>
114
+ <BodySmall
115
+ color={
116
+ error && errorText
117
+ ? 'danger'
118
+ : disabled
119
+ ? 'disabled'
120
+ : 'secondary'
121
+ }
122
+ >
123
+ {error && errorText ? errorText : helperText ?? ''}
124
+ </BodySmall>
125
+ </div>
126
+ )}
127
+ </div>
128
+ );
129
+ };
130
+
131
+ export const Textarea = (React.forwardRef<TextareaProps, HTMLTextAreaElement>(
132
+ Textarea_,
133
+ ): React$AbstractComponent<TextareaProps, HTMLTextAreaElement>);
@@ -0,0 +1,110 @@
1
+ @value (
2
+ size160,
3
+ size140,
4
+ sizeFluid
5
+ ) from '../../styles/variables/_size.css';
6
+
7
+ @value (
8
+ spaceNone,
9
+ spaceSmall,
10
+ spaceXSmall,
11
+ spaceXXSmall
12
+ ) from '../../styles/variables/_space.css';
13
+
14
+ @value (
15
+ borderRadiusMedium,
16
+ borderRadiusSmall,
17
+ borderWidthSecondary,
18
+ borderWidthTertiary,
19
+ borderWidthNone
20
+ ) from '../../styles/variables/_border.css';
21
+
22
+ @value (
23
+ colorTextPrimary,
24
+ colorTextSecondary,
25
+ colorBorderPrimary,
26
+ colorFillPrimary,
27
+ colorFocusPrimary,
28
+ colorFocusDanger,
29
+ colorTextDisabled,
30
+ colorFillDisabled,
31
+ colorTextDanger
32
+ ) from '../../styles/variables/_color.css';
33
+
34
+ .container {
35
+ color: colorTextPrimary;
36
+ width: sizeFluid;
37
+ }
38
+
39
+ .box {
40
+ display: flex;
41
+ align-items: center;
42
+ color: colorTextPrimary;
43
+ gap: spaceSmall;
44
+ height: size160;
45
+ padding: spaceXSmall spaceSmall;
46
+ border: borderWidthSecondary solid colorBorderPrimary;
47
+ }
48
+
49
+ .locked {
50
+ border-style: dashed;
51
+ }
52
+
53
+ .medium {
54
+ composes: formInputMedium from '../../styles/typography.module.css';
55
+ height: size160;
56
+ border-radius: borderRadiusMedium;
57
+ }
58
+
59
+ .small {
60
+ composes: formInputSmall from '../../styles/typography.module.css';
61
+ height: size140;
62
+ border-radius: borderRadiusSmall;
63
+ }
64
+
65
+ .wrapper.withError .box {
66
+ border-color: colorTextDanger;
67
+ }
68
+
69
+ .wrapper.withError:focus-within .box {
70
+ box-shadow: borderWidthNone borderWidthNone borderWidthNone
71
+ borderWidthTertiary colorFocusDanger;
72
+ }
73
+
74
+ .box textarea {
75
+ width: sizeFluid;
76
+ height: sizeFluid;
77
+ resize: none;
78
+ }
79
+
80
+ .wrapper:not(.inputDisabled):not(.withError):focus-within .box {
81
+ border-color: colorFillPrimary;
82
+ box-shadow: borderWidthNone borderWidthNone borderWidthNone
83
+ borderWidthTertiary colorFocusPrimary;
84
+ }
85
+
86
+ .inputDisabled {
87
+ color: colorTextDisabled;
88
+ border-color: colorBorderPrimary;
89
+ background-color: colorFillDisabled;
90
+ }
91
+
92
+ .inputDisabled textarea::placeholder {
93
+ color: inherit;
94
+ }
95
+
96
+ .wrapper {
97
+ display: flex;
98
+ flex-direction: column;
99
+ width: sizeFluid;
100
+ gap: spaceXXSmall;
101
+ }
102
+
103
+ .info {
104
+ display: flex;
105
+ justify-content: space-between;
106
+ }
107
+
108
+ .infoContent {
109
+ display: flex;
110
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Textarea", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Textarea.Textarea;
10
+ }
11
+ });
12
+ var _Textarea = require("./Textarea");
@@ -0,0 +1,4 @@
1
+ // @flow strict
2
+
3
+ export type {TextareaProps} from './Textarea';
4
+ export {Textarea} from './Textarea';
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ToastTitle = exports.ToastFooter = exports.ToastBody = exports.Toast = exports.TOAST_SEMANTIC = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _reactDomInteractions = require("@floating-ui/react-dom-interactions");
9
+ var _classify = _interopRequireDefault(require("../../utils/classify"));
10
+ var _Icon = require("../Icon");
11
+ var _Text = require("../Text");
12
+ var _ToastModule = _interopRequireDefault(require("./Toast.module.css"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ 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); }
16
+ 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; }
17
+
18
+ const TOAST_SEMANTIC = Object.freeze({
19
+ success: 'success',
20
+ information: 'information',
21
+ warning: 'warning',
22
+ danger: 'danger'
23
+ });
24
+ exports.TOAST_SEMANTIC = TOAST_SEMANTIC;
25
+ const TOAST_TITLE_COLOR = {
26
+ success: _Text.TEXT_COLORS.success,
27
+ information: _Text.TEXT_COLORS.information,
28
+ warning: _Text.TEXT_COLORS.warning,
29
+ danger: _Text.TEXT_COLORS.danger
30
+ };
31
+ const ToastIcon = _ref => {
32
+ let {
33
+ semantic
34
+ } = _ref;
35
+ switch (semantic) {
36
+ case 'success':
37
+ return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
38
+ name: "circle-check",
39
+ size: "medium",
40
+ color: _Text.TEXT_COLORS.success,
41
+ type: "solid"
42
+ });
43
+ case TOAST_SEMANTIC.information:
44
+ return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
45
+ name: "circle-info",
46
+ size: "medium",
47
+ color: _Text.TEXT_COLORS.information,
48
+ type: "solid"
49
+ });
50
+ case TOAST_SEMANTIC.warning:
51
+ return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
52
+ name: "circle-exclamation",
53
+ size: "medium",
54
+ color: _Text.TEXT_COLORS.warning,
55
+ type: "solid"
56
+ });
57
+ case TOAST_SEMANTIC.danger:
58
+ return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
59
+ name: "shield-exclamation",
60
+ size: "medium",
61
+ color: _Text.TEXT_COLORS.danger,
62
+ type: "solid"
63
+ });
64
+ default:
65
+ return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
66
+ color: _Text.TEXT_COLORS.neutral,
67
+ name: "face-smile",
68
+ size: "medium",
69
+ type: "solid"
70
+ });
71
+ }
72
+ };
73
+ const ToastTitle = _ref2 => {
74
+ let {
75
+ children
76
+ } = _ref2;
77
+ return children;
78
+ };
79
+ exports.ToastTitle = ToastTitle;
80
+ const ToastBody = _ref3 => {
81
+ let {
82
+ children
83
+ } = _ref3;
84
+ return children;
85
+ };
86
+ exports.ToastBody = ToastBody;
87
+ const ToastFooter = _ref4 => {
88
+ let {
89
+ children,
90
+ onClose
91
+ } = _ref4;
92
+ const arrayChildren = React.Children.toArray(children);
93
+ const footerActions = React.Children.map(children, (child, index) => {
94
+ const isLast = index === arrayChildren.length - 1;
95
+ if ( /*#__PURE__*/React.isValidElement(child)) {
96
+ const {
97
+ onClick
98
+ } = child.props;
99
+ const buttonClickHandler = e => {
100
+ onClose && onClose();
101
+ onClick && onClick(e);
102
+ };
103
+ if (child?.type?.name === 'Button' && isLast) {
104
+ return /*#__PURE__*/React.cloneElement(child, {
105
+ size: 'small',
106
+ type: 'primary',
107
+ ...child.props,
108
+ onClick: buttonClickHandler
109
+ });
110
+ } else if (child?.type?.name === 'Button') {
111
+ return /*#__PURE__*/React.cloneElement(child, {
112
+ size: 'small',
113
+ type: 'tertiary',
114
+ ...child.props,
115
+ onClick: buttonClickHandler
116
+ });
117
+ }
118
+ }
119
+ return child;
120
+ });
121
+ return React.Children.count(children) > 0 ? /*#__PURE__*/(0, _jsxRuntime.js)("div", {
122
+ className: _ToastModule.default.toastFooterActions,
123
+ children: footerActions
124
+ }) : null;
125
+ };
126
+ exports.ToastFooter = ToastFooter;
127
+ const Toast = _ref5 => {
128
+ let {
129
+ classNames,
130
+ children,
131
+ time,
132
+ semantic = TOAST_SEMANTIC.success,
133
+ onClose,
134
+ initialFocus = -1
135
+ } = _ref5;
136
+ const {
137
+ floating,
138
+ context
139
+ } = (0, _reactDomInteractions.useFloating)();
140
+ const getComp = comp => {
141
+ if (children instanceof Array) {
142
+ const nodes = [];
143
+ for (const child of children) {
144
+ if (child?.type?.name === comp) {
145
+ nodes.push(child);
146
+ }
147
+ }
148
+ return nodes.length > 1 ? nodes : nodes[0];
149
+ }
150
+ return null;
151
+ };
152
+ const footer = getComp('ToastFooter');
153
+ // $FlowFixMe
154
+ const footerWithClose = footer ? /*#__PURE__*/React.cloneElement(footer, {
155
+ onClose
156
+ }) : null;
157
+ return /*#__PURE__*/(0, _jsxRuntime.js)(_reactDomInteractions.FloatingFocusManager, {
158
+ context: context,
159
+ initialFocus: initialFocus,
160
+ children: /*#__PURE__*/(0, _jsxRuntime.jss)("div", {
161
+ className: (0, _classify.default)(_ToastModule.default.toastContainer, classNames?.wrapper),
162
+ ref: floating,
163
+ children: [/*#__PURE__*/(0, _jsxRuntime.js)(ToastIcon, {
164
+ semantic: semantic
165
+ }), /*#__PURE__*/(0, _jsxRuntime.jss)("div", {
166
+ className: _ToastModule.default.toastMidSection,
167
+ children: [/*#__PURE__*/(0, _jsxRuntime.jss)("div", {
168
+ className: _ToastModule.default.contentWrap,
169
+ children: [/*#__PURE__*/(0, _jsxRuntime.jss)("div", {
170
+ className: _ToastModule.default.titleBodyWrap,
171
+ children: [/*#__PURE__*/(0, _jsxRuntime.js)(_Text.SubTitleSmall, {
172
+ color: TOAST_TITLE_COLOR[semantic],
173
+ children: getComp('ToastTitle')
174
+ }), /*#__PURE__*/(0, _jsxRuntime.js)(_Text.BodyMedium, {
175
+ children: getComp('ToastBody')
176
+ })]
177
+ }), time && /*#__PURE__*/(0, _jsxRuntime.js)(_Text.SubTitleExtraSmall, {
178
+ children: time
179
+ })]
180
+ }), footerWithClose]
181
+ }), /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.CloseIcon, {
182
+ onClick: onClose
183
+ })]
184
+ })
185
+ });
186
+ };
187
+ exports.Toast = Toast;