@papillonarts/components 0.9.0 → 0.11.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 (209) hide show
  1. package/build/index.js +12 -0
  2. package/build/primer/Alert/Alert.js +122 -0
  3. package/build/primer/Alert/Alert.prop.js +19 -0
  4. package/build/primer/Alert/index.js +19 -0
  5. package/build/primer/Blankslate/Blankslate.js +30 -0
  6. package/build/primer/Blankslate/Blankslate.prop.js +18 -0
  7. package/build/primer/Blankslate/index.js +19 -0
  8. package/build/primer/Breadcrumb/Breadcrumb.js +75 -0
  9. package/build/primer/Breadcrumb/Breadcrumb.prop.js +14 -0
  10. package/build/primer/Breadcrumb/index.js +19 -0
  11. package/build/primer/Button/Button.js +108 -0
  12. package/build/primer/Button/Button.prop.js +48 -0
  13. package/build/primer/Button/index.js +49 -0
  14. package/build/primer/Dropdown/Dropdown.js +102 -0
  15. package/build/primer/Dropdown/Dropdown.prop.js +18 -0
  16. package/build/primer/Dropdown/index.js +19 -0
  17. package/build/primer/ErrorBoundary/ErrorBoundary.js +59 -0
  18. package/build/primer/ErrorBoundary/ErrorBoundary.prop.js +7 -0
  19. package/build/primer/ErrorBoundary/index.js +12 -0
  20. package/build/primer/Form/Checkbox/Checkbox.js +48 -0
  21. package/build/primer/Form/Checkbox/Checkbox.prop.js +22 -0
  22. package/build/primer/Form/Checkbox/index.js +19 -0
  23. package/build/primer/Form/Input/Input.js +55 -0
  24. package/build/primer/Form/Input/Input.prop.js +27 -0
  25. package/build/primer/Form/Input/index.js +25 -0
  26. package/build/primer/Form/Radio/Radio.js +47 -0
  27. package/build/primer/Form/Radio/Radio.prop.js +22 -0
  28. package/build/primer/Form/Radio/index.js +19 -0
  29. package/build/primer/Form/index.js +24 -0
  30. package/build/primer/Grid/DisplayTable/DisplayTable.js +57 -0
  31. package/build/primer/Grid/DisplayTable/DisplayTable.prop.js +11 -0
  32. package/build/primer/Grid/DisplayTable/index.js +12 -0
  33. package/build/primer/Grid/FlexGrid/FlexGrid.js +249 -0
  34. package/build/primer/Grid/FlexGrid/FlexGrid.prop.js +28 -0
  35. package/build/primer/Grid/FlexGrid/index.js +25 -0
  36. package/build/primer/Grid/index.js +14 -0
  37. package/build/primer/Icon/Icon.js +70 -0
  38. package/build/primer/Icon/Icon.part.js +1295 -0
  39. package/build/primer/Icon/Icon.prop.js +678 -0
  40. package/build/primer/Icon/index.js +25 -0
  41. package/build/primer/Label/Label.js +30 -0
  42. package/build/primer/Label/Label.prop.js +26 -0
  43. package/build/primer/Label/index.js +12 -0
  44. package/build/primer/Loader/Loader.js +64 -0
  45. package/build/primer/Loader/Loader.prop.js +15 -0
  46. package/build/primer/Loader/index.js +19 -0
  47. package/build/primer/Navigation/Menu/Menu.js +69 -0
  48. package/build/primer/Navigation/Menu/Menu.prop.js +10 -0
  49. package/build/primer/Navigation/Menu/index.js +12 -0
  50. package/build/primer/Navigation/TabNav/TabNav.js +124 -0
  51. package/build/primer/Navigation/TabNav/TabNav.prop.js +16 -0
  52. package/build/primer/Navigation/TabNav/index.js +19 -0
  53. package/build/primer/Navigation/UnderlineNav/UnderlineNav.js +122 -0
  54. package/build/primer/Navigation/UnderlineNav/UnderlineNav.prop.js +20 -0
  55. package/build/primer/Navigation/UnderlineNav/index.js +25 -0
  56. package/build/primer/Navigation/index.js +17 -0
  57. package/build/primer/Pagination/PreviousNext/PreviousNext.js +84 -0
  58. package/build/primer/Pagination/PreviousNext/PreviousNext.prop.js +30 -0
  59. package/build/primer/Pagination/PreviousNext/index.js +19 -0
  60. package/build/primer/Pagination/index.js +11 -0
  61. package/build/primer/Popover/Popover.js +63 -0
  62. package/build/primer/Popover/Popover.prop.js +29 -0
  63. package/build/primer/Popover/index.js +25 -0
  64. package/build/primer/Progress/Progress.js +30 -0
  65. package/build/primer/Progress/Progress.prop.js +15 -0
  66. package/build/primer/Progress/index.js +19 -0
  67. package/build/primer/Select/Select.js +67 -0
  68. package/build/primer/Select/Select.prop.js +15 -0
  69. package/build/primer/Select/index.js +19 -0
  70. package/build/primer/SelectMenu/SelectMenu.js +94 -0
  71. package/build/primer/SelectMenu/SelectMenu.prop.js +10 -0
  72. package/build/primer/SelectMenu/index.js +12 -0
  73. package/build/primer/Subhead/Subhead.js +26 -0
  74. package/build/primer/Subhead/Subhead.prop.js +10 -0
  75. package/build/primer/Subhead/index.js +12 -0
  76. package/build/primer/Toast/Toast.js +54 -0
  77. package/build/primer/Toast/Toast.prop.js +18 -0
  78. package/build/primer/Toast/index.js +19 -0
  79. package/build/primer/index.js +87 -0
  80. package/package.json +5 -5
  81. package/build/index.ts +0 -1
  82. package/build/primer/Alert/Alert.prop.ts +0 -45
  83. package/build/primer/Alert/Alert.tsx +0 -101
  84. package/build/primer/Alert/__tests__/Alert.int.story.tsx +0 -86
  85. package/build/primer/Alert/__tests__/Alert.int.test.ts +0 -37
  86. package/build/primer/Alert/index.ts +0 -2
  87. package/build/primer/Blankslate/Blankslate.prop.ts +0 -26
  88. package/build/primer/Blankslate/Blankslate.tsx +0 -26
  89. package/build/primer/Blankslate/__tests__/Blankslate.int.story.tsx +0 -43
  90. package/build/primer/Blankslate/__tests__/Blankslate.int.test.ts +0 -29
  91. package/build/primer/Blankslate/index.ts +0 -2
  92. package/build/primer/Breadcrumb/Breadcrumb.prop.ts +0 -28
  93. package/build/primer/Breadcrumb/Breadcrumb.tsx +0 -57
  94. package/build/primer/Breadcrumb/__tests__/Breadcrumb.int.story.tsx +0 -40
  95. package/build/primer/Breadcrumb/__tests__/Breadcrumb.int.test.ts +0 -40
  96. package/build/primer/Breadcrumb/index.ts +0 -2
  97. package/build/primer/Button/Button.prop.ts +0 -77
  98. package/build/primer/Button/Button.tsx +0 -91
  99. package/build/primer/Button/__tests__/Button.int.story.tsx +0 -173
  100. package/build/primer/Button/__tests__/Button.int.test.ts +0 -191
  101. package/build/primer/Button/index.ts +0 -2
  102. package/build/primer/Dropdown/Dropdown.prop.ts +0 -33
  103. package/build/primer/Dropdown/Dropdown.tsx +0 -102
  104. package/build/primer/Dropdown/__tests__/Dropdown.int.story.tsx +0 -43
  105. package/build/primer/Dropdown/__tests__/Dropdown.int.test.ts +0 -53
  106. package/build/primer/Dropdown/index.ts +0 -2
  107. package/build/primer/ErrorBoundary/ErrorBoundary.prop.ts +0 -5
  108. package/build/primer/ErrorBoundary/ErrorBoundary.tsx +0 -35
  109. package/build/primer/ErrorBoundary/__tests__/ErrorBoundary.int.story.tsx +0 -23
  110. package/build/primer/ErrorBoundary/__tests__/ErrorBoundary.int.test.ts +0 -9
  111. package/build/primer/ErrorBoundary/index.ts +0 -1
  112. package/build/primer/Form/Checkbox/Checkbox.prop.ts +0 -34
  113. package/build/primer/Form/Checkbox/Checkbox.tsx +0 -40
  114. package/build/primer/Form/Checkbox/__tests__/Checkbox.int.story.tsx +0 -50
  115. package/build/primer/Form/Checkbox/__tests__/Checkbox.int.test.ts +0 -23
  116. package/build/primer/Form/Checkbox/index.ts +0 -2
  117. package/build/primer/Form/Input/Input.prop.ts +0 -43
  118. package/build/primer/Form/Input/Input.tsx +0 -43
  119. package/build/primer/Form/Input/__tests__/Input.int.story.tsx +0 -54
  120. package/build/primer/Form/Input/__tests__/Input.int.test.ts +0 -15
  121. package/build/primer/Form/Input/index.ts +0 -2
  122. package/build/primer/Form/Radio/Radio.prop.ts +0 -30
  123. package/build/primer/Form/Radio/Radio.tsx +0 -38
  124. package/build/primer/Form/Radio/__tests__/Radio.int.story.tsx +0 -42
  125. package/build/primer/Form/Radio/__tests__/Radio.int.test.ts +0 -13
  126. package/build/primer/Form/Radio/index.ts +0 -2
  127. package/build/primer/Form/index.ts +0 -19
  128. package/build/primer/Grid/DisplayTable/DisplayTable.prop.ts +0 -21
  129. package/build/primer/Grid/DisplayTable/DisplayTable.tsx +0 -68
  130. package/build/primer/Grid/DisplayTable/__tests__/DisplayTable.int.data.ts +0 -289
  131. package/build/primer/Grid/DisplayTable/__tests__/DisplayTable.int.story.tsx +0 -27
  132. package/build/primer/Grid/DisplayTable/__tests__/DisplayTable.int.test.ts +0 -9
  133. package/build/primer/Grid/DisplayTable/index.ts +0 -1
  134. package/build/primer/Grid/FlexGrid/FlexGrid.prop.ts +0 -59
  135. package/build/primer/Grid/FlexGrid/FlexGrid.tsx +0 -274
  136. package/build/primer/Grid/FlexGrid/__tests__/FlexGrid.int.data.ts +0 -289
  137. package/build/primer/Grid/FlexGrid/__tests__/FlexGrid.int.story.tsx +0 -146
  138. package/build/primer/Grid/FlexGrid/__tests__/FlexGrid.int.test.ts +0 -46
  139. package/build/primer/Grid/FlexGrid/index.ts +0 -2
  140. package/build/primer/Grid/index.ts +0 -9
  141. package/build/primer/Icon/Icon.part.ts +0 -1289
  142. package/build/primer/Icon/Icon.prop.ts +0 -1337
  143. package/build/primer/Icon/Icon.tsx +0 -49
  144. package/build/primer/Icon/__tests__/Icon.int.story.tsx +0 -58
  145. package/build/primer/Icon/__tests__/Icon.int.test.ts +0 -13
  146. package/build/primer/Icon/index.ts +0 -2
  147. package/build/primer/Label/Label.prop.ts +0 -31
  148. package/build/primer/Label/Label.tsx +0 -27
  149. package/build/primer/Label/__tests__/Label.int.story.tsx +0 -19
  150. package/build/primer/Label/__tests__/Label.int.test.ts +0 -9
  151. package/build/primer/Label/index.ts +0 -1
  152. package/build/primer/Loader/Loader.prop.ts +0 -16
  153. package/build/primer/Loader/Loader.tsx +0 -43
  154. package/build/primer/Loader/__tests__/Loader.int.story.tsx +0 -34
  155. package/build/primer/Loader/__tests__/Loader.int.test.ts +0 -21
  156. package/build/primer/Loader/index.ts +0 -2
  157. package/build/primer/Navigation/Menu/Menu.prop.ts +0 -26
  158. package/build/primer/Navigation/Menu/Menu.tsx +0 -42
  159. package/build/primer/Navigation/Menu/__tests__/Menu.int.story.tsx +0 -55
  160. package/build/primer/Navigation/Menu/__tests__/Menu.int.test.ts +0 -57
  161. package/build/primer/Navigation/Menu/index.ts +0 -1
  162. package/build/primer/Navigation/TabNav/TabNav.prop.ts +0 -39
  163. package/build/primer/Navigation/TabNav/TabNav.tsx +0 -105
  164. package/build/primer/Navigation/TabNav/__tests__/TabNav.int.story.tsx +0 -168
  165. package/build/primer/Navigation/TabNav/__tests__/TabNav.int.test.ts +0 -55
  166. package/build/primer/Navigation/TabNav/index.ts +0 -2
  167. package/build/primer/Navigation/UnderlineNav/UnderlineNav.prop.ts +0 -41
  168. package/build/primer/Navigation/UnderlineNav/UnderlineNav.tsx +0 -106
  169. package/build/primer/Navigation/UnderlineNav/__tests__/UnderlineNav.int.story.tsx +0 -140
  170. package/build/primer/Navigation/UnderlineNav/__tests__/UnderlineNav.int.test.ts +0 -81
  171. package/build/primer/Navigation/UnderlineNav/index.ts +0 -2
  172. package/build/primer/Navigation/index.ts +0 -12
  173. package/build/primer/Pagination/PreviousNext/PreviousNext.prop.ts +0 -53
  174. package/build/primer/Pagination/PreviousNext/PreviousNext.tsx +0 -71
  175. package/build/primer/Pagination/PreviousNext/__tests__/PreviousNext.int.story.tsx +0 -48
  176. package/build/primer/Pagination/PreviousNext/__tests__/PreviousNext.int.test.ts +0 -15
  177. package/build/primer/Pagination/PreviousNext/index.ts +0 -2
  178. package/build/primer/Pagination/index.ts +0 -6
  179. package/build/primer/Popover/Popover.prop.ts +0 -49
  180. package/build/primer/Popover/Popover.tsx +0 -80
  181. package/build/primer/Popover/__tests__/Popover.int.story.tsx +0 -216
  182. package/build/primer/Popover/__tests__/Popover.int.test.ts +0 -71
  183. package/build/primer/Popover/index.ts +0 -2
  184. package/build/primer/Progress/Progress.prop.ts +0 -16
  185. package/build/primer/Progress/Progress.tsx +0 -19
  186. package/build/primer/Progress/__tests__/Progress.int.story.tsx +0 -28
  187. package/build/primer/Progress/__tests__/Progress.int.test.ts +0 -17
  188. package/build/primer/Progress/index.ts +0 -2
  189. package/build/primer/Select/Select.prop.ts +0 -24
  190. package/build/primer/Select/Select.tsx +0 -58
  191. package/build/primer/Select/__tests__/Select.int.story.tsx +0 -38
  192. package/build/primer/Select/__tests__/Select.int.test.ts +0 -42
  193. package/build/primer/Select/index.ts +0 -2
  194. package/build/primer/SelectMenu/SelectMenu.prop.ts +0 -25
  195. package/build/primer/SelectMenu/SelectMenu.tsx +0 -68
  196. package/build/primer/SelectMenu/__tests__/SelectMenu.int.story.tsx +0 -50
  197. package/build/primer/SelectMenu/__tests__/SelectMenu.int.test.ts +0 -56
  198. package/build/primer/SelectMenu/index.ts +0 -1
  199. package/build/primer/Subhead/Subhead.prop.ts +0 -10
  200. package/build/primer/Subhead/Subhead.tsx +0 -15
  201. package/build/primer/Subhead/__tests__/Subhead.int.story.tsx +0 -23
  202. package/build/primer/Subhead/__tests__/Subhead.int.test.ts +0 -13
  203. package/build/primer/Subhead/index.ts +0 -1
  204. package/build/primer/Toast/Toast.prop.ts +0 -21
  205. package/build/primer/Toast/Toast.tsx +0 -38
  206. package/build/primer/Toast/__tests__/Toast.int.story.tsx +0 -50
  207. package/build/primer/Toast/__tests__/Toast.int.test.ts +0 -25
  208. package/build/primer/Toast/index.ts +0 -2
  209. package/build/primer/index.ts +0 -83
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.Toast = Toast;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _padding = _interopRequireDefault(require("@papillonarts/css/build/primer/utilities/padding.scss"));
11
+ var _Toast = require("./Toast.prop");
12
+ var _Toast2 = _interopRequireDefault(require("./Toast.scss"));
13
+ var _Icon = require("../Icon");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ function Toast(_ref) {
16
+ var _ref$className = _ref.className,
17
+ className = _ref$className === void 0 ? _Toast.defaultProps.className : _ref$className,
18
+ _ref$variant = _ref.variant,
19
+ variant = _ref$variant === void 0 ? _Toast.defaultProps.variant : _ref$variant,
20
+ text = _ref.text,
21
+ _ref$isDismissable = _ref.isDismissable,
22
+ isDismissable = _ref$isDismissable === void 0 ? _Toast.defaultProps.isDismissable : _ref$isDismissable,
23
+ _ref$onClick = _ref.onClick,
24
+ onClick = _ref$onClick === void 0 ? _Toast.defaultProps.onClick : _ref$onClick;
25
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
26
+ className: (0, _classnames["default"])(className, _padding["default"]['p-1']),
27
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
28
+ className: (0, _classnames["default"])(_Toast2["default"].Toast, (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _Toast2["default"]['Toast--success'], variant === _Toast.toastVariant.success), _Toast2["default"]['Toast--warning'], variant === _Toast.toastVariant.warning), _Toast2["default"]['Toast--error'], variant === _Toast.toastVariant.error)),
29
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
30
+ className: _Toast2["default"]['Toast-icon'],
31
+ children: [variant === _Toast.toastVariant.info && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
32
+ icon: _Icon.iconName.Info16
33
+ }), variant === _Toast.toastVariant.success && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
34
+ icon: _Icon.iconName.Check16
35
+ }), variant === _Toast.toastVariant.warning && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
36
+ icon: _Icon.iconName.Alert16
37
+ }), variant === _Toast.toastVariant.error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
38
+ icon: _Icon.iconName.Stop16
39
+ })]
40
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
41
+ className: _Toast2["default"]['Toast-content'],
42
+ children: text
43
+ }), isDismissable && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
44
+ type: "button",
45
+ className: _Toast2["default"]['Toast-dismissButton'],
46
+ onClick: onClick,
47
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
48
+ icon: _Icon.iconName.X16,
49
+ size: _Icon.iconSize.small
50
+ })
51
+ })]
52
+ })
53
+ });
54
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.toastVariant = exports.defaultProps = void 0;
7
+ var toastVariant = exports.toastVariant = {
8
+ info: 'info',
9
+ success: 'success',
10
+ warning: 'warning',
11
+ error: 'error'
12
+ };
13
+ var defaultProps = exports.defaultProps = {
14
+ className: null,
15
+ variant: toastVariant.info,
16
+ isDismissable: false,
17
+ onClick: function onClick() {}
18
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Toast", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _Toast.Toast;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "toastVariant", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _Toast2.toastVariant;
16
+ }
17
+ });
18
+ var _Toast = require("./Toast");
19
+ var _Toast2 = require("./Toast.prop");
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.primer = void 0;
7
+ var _Alert = require("./Alert");
8
+ var _Breadcrumb = require("./Breadcrumb");
9
+ var _Blankslate = require("./Blankslate");
10
+ var _Button = require("./Button");
11
+ var _Dropdown = require("./Dropdown");
12
+ var _ErrorBoundary = require("./ErrorBoundary");
13
+ var _Form = require("./Form");
14
+ var _Grid = require("./Grid");
15
+ var _Icon = require("./Icon");
16
+ var _Label = require("./Label");
17
+ var _Loader = require("./Loader");
18
+ var _Navigation = require("./Navigation");
19
+ var _Pagination = require("./Pagination");
20
+ var _Popover = require("./Popover");
21
+ var _Progress = require("./Progress");
22
+ var _Select = require("./Select");
23
+ var _SelectMenu = require("./SelectMenu");
24
+ var _Subhead = require("./Subhead");
25
+ var _Toast = require("./Toast");
26
+ require("@papillonarts/css/build/primer/index.scss");
27
+ var primer = exports.primer = {
28
+ Alert: {
29
+ Alert: _Alert.Alert,
30
+ alertVariant: _Alert.alertVariant
31
+ },
32
+ Breadcrumb: {
33
+ Breadcrumb: _Breadcrumb.Breadcrumb,
34
+ breadcrumbState: _Breadcrumb.breadcrumbState
35
+ },
36
+ Blankslate: {
37
+ Blankslate: _Blankslate.Blankslate,
38
+ blankslateVariant: _Blankslate.blankslateVariant
39
+ },
40
+ Button: {
41
+ Button: _Button.Button,
42
+ buttonElement: _Button.buttonElement,
43
+ buttonVariant: _Button.buttonVariant,
44
+ buttonSize: _Button.buttonSize,
45
+ buttonState: _Button.buttonState,
46
+ iconAlignment: _Button.iconAlignment,
47
+ buttonInputType: _Button.buttonInputType
48
+ },
49
+ Dropdown: {
50
+ Dropdown: _Dropdown.Dropdown,
51
+ dropdownState: _Dropdown.dropdownState
52
+ },
53
+ ErrorBoundary: _ErrorBoundary.ErrorBoundary,
54
+ Form: _Form.Form,
55
+ Grid: _Grid.Grid,
56
+ Icon: {
57
+ Icon: _Icon.Icon,
58
+ iconName: _Icon.iconName,
59
+ iconSize: _Icon.iconSize
60
+ },
61
+ Label: _Label.Label,
62
+ Loader: {
63
+ Loader: _Loader.Loader,
64
+ loaderVariant: _Loader.loaderVariant
65
+ },
66
+ Navigation: _Navigation.Navigation,
67
+ Pagination: _Pagination.Pagination,
68
+ Popover: {
69
+ Popover: _Popover.Popover,
70
+ popoverVariant: _Popover.popoverVariant,
71
+ popoverSize: _Popover.popoverSize
72
+ },
73
+ Progress: {
74
+ Progress: _Progress.Progress,
75
+ progressVariant: _Progress.progressVariant
76
+ },
77
+ Select: {
78
+ Select: _Select.Select,
79
+ selectState: _Select.selectState
80
+ },
81
+ SelectMenu: _SelectMenu.SelectMenu,
82
+ Subhead: _Subhead.Subhead,
83
+ Toast: {
84
+ Toast: _Toast.Toast,
85
+ toastVariant: _Toast.toastVariant
86
+ }
87
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papillonarts/components",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Papillon Arts Components",
5
5
  "homepage": "https://github.com/papillonarts/papillonarts/tree/master/packages/components",
6
6
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "remove-test-folders": "rm -rf src/**/**/__tests__ && rm -rf src/**/**/**/__tests__ && rm -rf src/primer/Concept",
22
22
  "remove-snapshot-folders": "rm -rf src/**/**/__tests__/__snapshots__",
23
23
  "remove-build-folder": "rm -rf build",
24
- "transpile": "babel --copy-files --no-copy-ignored --out-dir build src --ignore **/__tests__",
24
+ "transpile": "babel --copy-files --no-copy-ignored --extensions '.js,.jsx,.ts,.tsx' --out-dir build src --ignore **/__tests__",
25
25
  "remove-markdown-files": "find build -maxdepth 3 -type f -name \"*.md\" -delete",
26
26
  "build": "npm-run-all remove-snapshot-folders remove-build-folder transpile remove-markdown-files",
27
27
  "build-test": "npm run build",
@@ -29,8 +29,8 @@
29
29
  "build-release": "npm run build"
30
30
  },
31
31
  "dependencies": {
32
- "@papillonarts/css": "^0.9.0",
33
- "@papillonarts/library": "^0.9.0"
32
+ "@papillonarts/css": "^0.11.0",
33
+ "@papillonarts/library": "^0.11.0"
34
34
  },
35
- "gitHead": "584fbedfbea9771d584d15adb3396feb2e9c56b6"
35
+ "gitHead": "afb8232b4029b44881fa5613b3069ad2d3032f16"
36
36
  }
package/build/index.ts DELETED
@@ -1 +0,0 @@
1
- export { primer } from './primer'
@@ -1,45 +0,0 @@
1
- export const alertVariant = {
2
- default: 'default',
3
- info: 'info',
4
- warning: 'warning',
5
- error: 'error',
6
- success: 'success',
7
- consent: 'consent',
8
- }
9
-
10
- export const defaultProps = {
11
- dataTest: null,
12
- className: null,
13
- variant: alertVariant.default,
14
- }
15
-
16
- export interface ActionType {
17
- approve?: (value?: string) => void
18
- cancel?: (value?: string) => void
19
- }
20
-
21
- export interface ConsentType {
22
- action?: ActionType
23
- withInput?: boolean
24
- }
25
-
26
- export interface DataTestType {
27
- default?: string
28
- approve?: string
29
- cancel?: string
30
- value?: string
31
- }
32
-
33
- export interface AlertProps {
34
- dataTest?: DataTestType
35
- className?: string
36
- variant?:
37
- | typeof alertVariant.default
38
- | typeof alertVariant.info
39
- | typeof alertVariant.warning
40
- | typeof alertVariant.error
41
- | typeof alertVariant.success
42
- | typeof alertVariant.consent
43
- children: React.ReactNode // https://react.dev/learn/typescript#typing-children
44
- consent: ConsentType
45
- }
@@ -1,101 +0,0 @@
1
- import { Fragment } from 'react'
2
- import { useState } from '@papillonarts/library/hooks'
3
- import utilityStyles from '@papillonarts/css/build/primer/utilities/margin.scss'
4
- import cx from 'classnames'
5
- import { AlertProps, defaultProps, alertVariant } from './Alert.prop'
6
- import styles from './Alert.scss'
7
- import buttonStyles from '../Button/Button.scss'
8
- import { Input } from '../Form/Input'
9
- import { Button, buttonVariant, buttonInputType, iconAlignment } from '../Button'
10
- import { iconName } from '../Icon/Icon.prop'
11
- import { Icon, iconSize } from '../Icon'
12
-
13
- export function Alert({
14
- dataTest = defaultProps.dataTest,
15
- className = defaultProps.className,
16
- variant = defaultProps.variant,
17
- children,
18
- consent,
19
- }: AlertProps) {
20
- const [consentValue, setConsentValue] = useState('')
21
-
22
- return (
23
- <div data-test={dataTest?.default} className={className}>
24
- <div className={cx(styles['flash-messages'])}>
25
- <div
26
- className={cx(styles.flash, {
27
- [styles['flash-warn']]: variant === alertVariant.warning,
28
- [styles['flash-error']]: variant === alertVariant.error,
29
- [styles['flash-success']]: variant === alertVariant.success,
30
- [styles['flash-consent']]: variant === alertVariant.consent,
31
- })}
32
- >
33
- {consent && (
34
- <Fragment>
35
- <Button
36
- dataTest={dataTest?.cancel}
37
- className={cx(buttonStyles.btn, buttonStyles['btn-sm'], buttonStyles.primary, styles['flash-action'])}
38
- text="Cancel"
39
- icon={{ name: iconName.XCircleFill16, alignment: iconAlignment.left }}
40
- variant={buttonVariant.default}
41
- inputType={buttonInputType.submit}
42
- onClick={() => {
43
- consent?.action?.cancel()
44
- setConsentValue('')
45
- }}
46
- />
47
- <Button
48
- dataTest={dataTest?.approve}
49
- className={cx(buttonStyles.btn, buttonStyles['btn-sm'], buttonStyles.primary, styles['flash-action'])}
50
- text="Approve"
51
- icon={{ name: iconName.CheckCircleFill16, alignment: iconAlignment.left }}
52
- variant={buttonVariant.primary}
53
- inputType={buttonInputType.submit}
54
- autoFocus={consent?.withInput ? false : true} // eslint-disable-line
55
- onClick={
56
- consent?.withInput
57
- ? () => {
58
- if (consentValue !== '') {
59
- consent?.action?.approve(consentValue)
60
- setConsentValue('')
61
- }
62
- }
63
- : consent?.action?.approve
64
- }
65
- />
66
- </Fragment>
67
- )}
68
- {variant === alertVariant.info && <Icon className={utilityStyles['mr-2']} icon={iconName.Info16} size={iconSize.small} />}
69
- {variant === alertVariant.warning && !consent && (
70
- <Icon className={utilityStyles['mr-2']} icon={iconName.Alert16} size={iconSize.small} />
71
- )}
72
- {variant === alertVariant.warning && consent && (
73
- <Icon className={utilityStyles['mr-2']} icon={iconName.Question16} size={iconSize.small} />
74
- )}
75
- {variant === alertVariant.error && <Icon className={utilityStyles['mr-2']} icon={iconName.XCircle16} size={iconSize.small} />}
76
- {variant === alertVariant.success && (
77
- <Icon className={utilityStyles['mr-2']} icon={iconName.CheckCircle16} size={iconSize.small} />
78
- )}
79
- {variant === alertVariant.consent && <Icon className={utilityStyles['mr-2']} icon={iconName.Question16} size={iconSize.small} />}
80
- {children}
81
- {consent?.withInput && (
82
- <Input
83
- dataTest={dataTest?.value}
84
- className={styles['flash-action']}
85
- value={consentValue}
86
- placeholder=""
87
- ariaAttr={{ label: '' }}
88
- onChange={(event) => {
89
- setConsentValue(event.target.value)
90
- }}
91
- onKeyUp={(event) => {
92
- setConsentValue(event.target.value)
93
- }}
94
- autoFocus={true} // eslint-disable-line
95
- />
96
- )}
97
- </div>
98
- </div>
99
- </div>
100
- )
101
- }
@@ -1,86 +0,0 @@
1
- // https://storybook.js.org/docs/configure/integration/typescript
2
-
3
- import { action } from 'storybook/actions'
4
- import { withTests } from '@storybook/addon-jest'
5
- import { alertVariant } from '../Alert.prop'
6
- import results from '../../../../../../.jest-test-results.json'
7
-
8
- const children = 'Flash message goes here.'
9
-
10
- const Alert =
11
- process.env.NODE_ENV === 'develop' || process.env.NODE_ENV === 'test'
12
- ? require('../../../index').primer.Alert.Alert
13
- : require('../../../../build').primer.Alert.Alert
14
-
15
- export default {
16
- title: 'Primer/Molecule/Alert',
17
- component: Alert,
18
- decorators: [withTests({ results })],
19
- parameters: { jest: ['Alert.int.test.js'] },
20
- excludeStories: ['custom'],
21
- }
22
-
23
- export function regular() {
24
- return <Alert variant={alertVariant.default}>{children}</Alert>
25
- }
26
-
27
- export function regularMultipleParagraphs() {
28
- return (
29
- <Alert variant={alertVariant.default}>
30
- <p>
31
- This is a longer flash message in it&apos;s own paragraph. It ends up looking something like this. If we keep adding more text,
32
- it&apos;ll eventually wrap to a new line.
33
- </p>
34
- <p>And this is another paragraph.</p>
35
- </Alert>
36
- )
37
- }
38
-
39
- export function info() {
40
- return <Alert variant={alertVariant.info}>{children}</Alert>
41
- }
42
-
43
- export function warning() {
44
- return <Alert variant={alertVariant.warning}>{children}</Alert>
45
- }
46
-
47
- export function error() {
48
- return <Alert variant={alertVariant.error}>{children}</Alert>
49
- }
50
-
51
- export function success() {
52
- return <Alert variant={alertVariant.success}>{children}</Alert>
53
- }
54
-
55
- export function consent() {
56
- return (
57
- <Alert
58
- variant={alertVariant.consent}
59
- consent={{
60
- action: {
61
- approve: action('Approved'),
62
- cancel: action('Cancelled'),
63
- },
64
- }}
65
- >
66
- {children}
67
- </Alert>
68
- )
69
- }
70
-
71
- export function consentWithInput() {
72
- return (
73
- <Alert
74
- variant={alertVariant.consent}
75
- consent={{
76
- action: {
77
- approve: action('Approved'),
78
- cancel: action('Cancelled'),
79
- },
80
- withInput: true,
81
- }}
82
- >
83
- {children}
84
- </Alert>
85
- )
86
- }
@@ -1,37 +0,0 @@
1
- import { regular, regularMultipleParagraphs, info, warning, error, success, consent, consentWithInput } from './Alert.int.story'
2
-
3
- describe('<Alert />', () => {
4
- describe('Render', () => {
5
- test('must match regular()', () => {
6
- expect(global.renderToJSON(regular())).toMatchSnapshot()
7
- })
8
-
9
- test('must match regularMultipleParagraphs()', () => {
10
- expect(global.renderToJSON(regularMultipleParagraphs())).toMatchSnapshot()
11
- })
12
-
13
- test('must match info()', () => {
14
- expect(global.renderToJSON(info())).toMatchSnapshot()
15
- })
16
-
17
- test('must match warning()', () => {
18
- expect(global.renderToJSON(warning())).toMatchSnapshot()
19
- })
20
-
21
- test('must match error()', () => {
22
- expect(global.renderToJSON(error())).toMatchSnapshot()
23
- })
24
-
25
- test('must match success()', () => {
26
- expect(global.renderToJSON(success())).toMatchSnapshot()
27
- })
28
-
29
- test('must match consent()', () => {
30
- expect(global.renderToJSON(consent())).toMatchSnapshot()
31
- })
32
-
33
- test('must match consentWithInput()', () => {
34
- expect(global.renderToJSON(consentWithInput())).toMatchSnapshot()
35
- })
36
- })
37
- })
@@ -1,2 +0,0 @@
1
- export { Alert } from './Alert'
2
- export { alertVariant } from './Alert.prop'
@@ -1,26 +0,0 @@
1
- export const blankslateVariant = {
2
- default: 'default',
3
- narrow: 'narrow',
4
- capped: 'capped',
5
- spacious: 'spacious',
6
- large: 'large',
7
- }
8
-
9
- export const defaultProps = {
10
- className: null,
11
- variant: blankslateVariant.default,
12
- hasCleanBackground: false,
13
- }
14
-
15
- export interface BlankslateProps {
16
- className?: string
17
- heading: string
18
- text: string
19
- variant?:
20
- | typeof blankslateVariant.default
21
- | typeof blankslateVariant.narrow
22
- | typeof blankslateVariant.capped
23
- | typeof blankslateVariant.spacious
24
- | typeof blankslateVariant.large
25
- hasCleanBackground?: boolean
26
- }
@@ -1,26 +0,0 @@
1
- import cx from 'classnames'
2
- import { BlankslateProps, defaultProps, blankslateVariant } from './Blankslate.prop'
3
- import styles from './Blankslate.scss'
4
-
5
- export function Blankslate({
6
- className = defaultProps.className,
7
- heading,
8
- text,
9
- variant = defaultProps.variant,
10
- hasCleanBackground = defaultProps.hasCleanBackground,
11
- }: BlankslateProps) {
12
- return (
13
- <div
14
- className={cx(className, styles.blankslate, {
15
- [styles['blankslate-narrow']]: variant === blankslateVariant.narrow,
16
- [styles['blankslate-capped']]: (variant === blankslateVariant.capped) === true,
17
- [styles['blankslate-spacious']]: variant === blankslateVariant.spacious,
18
- [styles['blankslate-large']]: variant === blankslateVariant.large,
19
- [styles['blankslate-clean-background']]: hasCleanBackground === true,
20
- })}
21
- >
22
- <h3>{heading}</h3>
23
- <p>{text}</p>
24
- </div>
25
- )
26
- }
@@ -1,43 +0,0 @@
1
- import { withTests } from '@storybook/addon-jest'
2
- import { blankslateVariant } from '../Blankslate.prop'
3
- import results from '../../../../../../.jest-test-results.json'
4
-
5
- const Blankslate =
6
- process.env.NODE_ENV === 'develop' || process.env.NODE_ENV === 'test'
7
- ? require('../../../index').primer.Blankslate.Blankslate
8
- : require('../../../../build').primer.Blankslate.Blankslate
9
-
10
- const heading = 'This is a blank slate'
11
- const text = 'Use it to provide information when no dynamic content exists.'
12
-
13
- export default {
14
- title: 'Primer/Atom/Blankslate',
15
- component: Blankslate,
16
- decorators: [withTests({ results })],
17
- parameters: { jest: ['Blankslate.int.test.js'] },
18
- excludeStories: ['custom'],
19
- }
20
-
21
- export function regular() {
22
- return <Blankslate variant={blankslateVariant.default} heading={heading} text={text} />
23
- }
24
-
25
- export function narrow() {
26
- return <Blankslate variant={blankslateVariant.narrow} heading={heading} text={text} />
27
- }
28
-
29
- export function capped() {
30
- return <Blankslate variant={blankslateVariant.capped} heading={heading} text={text} />
31
- }
32
-
33
- export function spacious() {
34
- return <Blankslate variant={blankslateVariant.spacious} heading={heading} text={text} />
35
- }
36
-
37
- export function large() {
38
- return <Blankslate variant={blankslateVariant.large} heading={heading} text={text} />
39
- }
40
-
41
- export function cleanBackground() {
42
- return <Blankslate hasCleanBackground={true} heading={heading} text={text} />
43
- }
@@ -1,29 +0,0 @@
1
- import { regular, narrow, capped, spacious, large, cleanBackground } from './Blankslate.int.story'
2
-
3
- describe('<Blankslate />', () => {
4
- describe('Render', () => {
5
- test('must match regular()', () => {
6
- expect(global.renderToJSON(regular())).toMatchSnapshot()
7
- })
8
-
9
- test('must match narrow()', () => {
10
- expect(global.renderToJSON(narrow())).toMatchSnapshot()
11
- })
12
-
13
- test('must match capped()', () => {
14
- expect(global.renderToJSON(capped())).toMatchSnapshot()
15
- })
16
-
17
- test('must match spacious()', () => {
18
- expect(global.renderToJSON(spacious())).toMatchSnapshot()
19
- })
20
-
21
- test('must match large()', () => {
22
- expect(global.renderToJSON(large())).toMatchSnapshot()
23
- })
24
-
25
- test('must match cleanBackground()', () => {
26
- expect(global.renderToJSON(cleanBackground())).toMatchSnapshot()
27
- })
28
- })
29
- })
@@ -1,2 +0,0 @@
1
- export { Blankslate } from './Blankslate'
2
- export { blankslateVariant } from './Blankslate.prop'
@@ -1,28 +0,0 @@
1
- export const breadcrumbState = {
2
- active: 'active',
3
- inactive: 'inactive',
4
- }
5
-
6
- export const defaultProps = {
7
- className: null,
8
- state: breadcrumbState.active,
9
- }
10
-
11
- export interface AriaAttrType {
12
- label: string
13
- current: boolean | false | true | 'page' | 'step' | 'location' | 'date' | 'time'
14
- }
15
-
16
- export interface ItemType {
17
- href: string
18
- text: string
19
- isSelected: boolean
20
- }
21
-
22
- export interface BreadcrumbProps {
23
- className?: string
24
- ariaAttr: AriaAttrType
25
- items: ItemType[]
26
- onClick: (value) => void
27
- state?: typeof breadcrumbState.active | typeof breadcrumbState.inactive
28
- }