@papillonarts/components 0.7.0 → 0.9.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 (254) hide show
  1. package/build/index.ts +1 -0
  2. package/build/primer/Alert/Alert.mdx +88 -0
  3. package/build/primer/Alert/Alert.prop.ts +45 -0
  4. package/build/primer/Alert/Alert.tsx +101 -0
  5. package/build/primer/Alert/__tests__/Alert.int.story.tsx +86 -0
  6. package/build/primer/Alert/__tests__/Alert.int.test.ts +37 -0
  7. package/build/primer/Alert/index.ts +2 -0
  8. package/build/primer/Blankslate/Blankslate.mdx +57 -0
  9. package/build/primer/Blankslate/Blankslate.prop.ts +26 -0
  10. package/build/primer/Blankslate/Blankslate.tsx +26 -0
  11. package/build/primer/Blankslate/__tests__/Blankslate.int.story.tsx +43 -0
  12. package/build/primer/Blankslate/__tests__/Blankslate.int.test.ts +29 -0
  13. package/build/primer/Blankslate/index.ts +2 -0
  14. package/build/primer/BranchName/branch-name.scss +2 -2
  15. package/build/primer/Breadcrumb/Breadcrumb.mdx +23 -0
  16. package/build/primer/Breadcrumb/Breadcrumb.prop.ts +28 -0
  17. package/build/primer/Breadcrumb/Breadcrumb.tsx +57 -0
  18. package/build/primer/Breadcrumb/__tests__/Breadcrumb.int.story.tsx +40 -0
  19. package/build/primer/Breadcrumb/__tests__/Breadcrumb.int.test.ts +40 -0
  20. package/build/primer/Breadcrumb/index.ts +2 -0
  21. package/build/primer/Button/Button.mdx +239 -0
  22. package/build/primer/Button/Button.prop.ts +77 -0
  23. package/build/primer/Button/Button.scss +4 -4
  24. package/build/primer/Button/Button.tsx +91 -0
  25. package/build/primer/Button/ButtonGroup.scss +2 -2
  26. package/build/primer/Button/__tests__/Button.int.story.tsx +173 -0
  27. package/build/primer/Button/__tests__/Button.int.test.ts +191 -0
  28. package/build/primer/Button/index.ts +2 -0
  29. package/build/primer/Button/misc.scss +2 -2
  30. package/build/primer/Dropdown/Dropdown.mdx +19 -0
  31. package/build/primer/Dropdown/Dropdown.prop.ts +33 -0
  32. package/build/primer/Dropdown/Dropdown.tsx +102 -0
  33. package/build/primer/Dropdown/__tests__/Dropdown.int.story.tsx +43 -0
  34. package/build/primer/Dropdown/__tests__/Dropdown.int.test.ts +53 -0
  35. package/build/primer/Dropdown/index.ts +2 -0
  36. package/build/primer/ErrorBoundary/ErrorBoundary.prop.ts +5 -0
  37. package/build/primer/ErrorBoundary/ErrorBoundary.tsx +35 -0
  38. package/build/primer/ErrorBoundary/__tests__/ErrorBoundary.int.story.tsx +23 -0
  39. package/build/primer/ErrorBoundary/__tests__/ErrorBoundary.int.test.ts +9 -0
  40. package/build/primer/ErrorBoundary/index.ts +1 -0
  41. package/build/primer/Form/Checkbox/Checkbox.prop.ts +34 -0
  42. package/build/primer/Form/Checkbox/Checkbox.tsx +40 -0
  43. package/build/primer/Form/Checkbox/__tests__/Checkbox.int.story.tsx +50 -0
  44. package/build/primer/Form/Checkbox/__tests__/Checkbox.int.test.ts +23 -0
  45. package/build/primer/Form/Checkbox/index.ts +2 -0
  46. package/build/primer/Form/Input/Input.prop.ts +43 -0
  47. package/build/primer/Form/Input/Input.tsx +43 -0
  48. package/build/primer/Form/Input/__tests__/Input.int.story.tsx +54 -0
  49. package/build/primer/Form/Input/__tests__/Input.int.test.ts +15 -0
  50. package/build/primer/Form/Input/index.ts +2 -0
  51. package/build/primer/Form/Radio/Radio.prop.ts +30 -0
  52. package/build/primer/Form/Radio/Radio.tsx +38 -0
  53. package/build/primer/Form/Radio/__tests__/Radio.int.story.tsx +42 -0
  54. package/build/primer/Form/Radio/__tests__/Radio.int.test.ts +13 -0
  55. package/build/primer/Form/Radio/index.ts +2 -0
  56. package/build/primer/Form/form-control.scss +4 -4
  57. package/build/primer/Form/form-select.scss +4 -4
  58. package/build/primer/Form/index.ts +19 -0
  59. package/build/primer/Grid/DisplayTable/DisplayTable.prop.ts +21 -0
  60. package/build/primer/Grid/DisplayTable/DisplayTable.tsx +68 -0
  61. package/build/primer/Grid/DisplayTable/__tests__/DisplayTable.int.data.ts +289 -0
  62. package/build/primer/Grid/DisplayTable/__tests__/DisplayTable.int.story.tsx +27 -0
  63. package/build/primer/Grid/DisplayTable/__tests__/DisplayTable.int.test.ts +9 -0
  64. package/build/primer/Grid/DisplayTable/index.ts +1 -0
  65. package/build/primer/Grid/FlexGrid/FlexGrid.prop.ts +59 -0
  66. package/build/primer/Grid/FlexGrid/FlexGrid.tsx +274 -0
  67. package/build/primer/Grid/FlexGrid/__tests__/FlexGrid.int.data.ts +289 -0
  68. package/build/primer/Grid/FlexGrid/__tests__/FlexGrid.int.story.tsx +146 -0
  69. package/build/primer/Grid/FlexGrid/__tests__/FlexGrid.int.test.ts +46 -0
  70. package/build/primer/Grid/FlexGrid/index.ts +2 -0
  71. package/build/primer/Grid/index.ts +9 -0
  72. package/build/primer/Icon/Icon.part.ts +1289 -0
  73. package/build/primer/Icon/Icon.prop.ts +1337 -0
  74. package/build/primer/Icon/Icon.tsx +49 -0
  75. package/build/primer/Icon/__tests__/Icon.int.story.tsx +58 -0
  76. package/build/primer/Icon/__tests__/Icon.int.test.ts +13 -0
  77. package/build/primer/Icon/index.ts +2 -0
  78. package/build/primer/Label/Label.mdx +13 -0
  79. package/build/primer/Label/Label.prop.ts +31 -0
  80. package/build/primer/Label/Label.tsx +27 -0
  81. package/build/primer/Label/__tests__/Label.int.story.tsx +19 -0
  82. package/build/primer/Label/__tests__/Label.int.test.ts +9 -0
  83. package/build/primer/Label/index.ts +1 -0
  84. package/build/primer/Label/mixins.scss +3 -3
  85. package/build/primer/Layout/container.scss +1 -1
  86. package/build/primer/Layout/grid-offset.scss +1 -1
  87. package/build/primer/Layout/grid.scss +2 -2
  88. package/build/primer/Loader/Loader.mdx +31 -0
  89. package/build/primer/Loader/Loader.prop.ts +16 -0
  90. package/build/primer/Loader/Loader.tsx +43 -0
  91. package/build/primer/Loader/__tests__/Loader.int.story.tsx +34 -0
  92. package/build/primer/Loader/__tests__/Loader.int.test.ts +21 -0
  93. package/build/primer/Loader/index.ts +2 -0
  94. package/build/primer/Navigation/Menu/Menu.prop.ts +26 -0
  95. package/build/primer/Navigation/Menu/Menu.tsx +42 -0
  96. package/build/primer/Navigation/Menu/__tests__/Menu.int.story.tsx +55 -0
  97. package/build/primer/Navigation/Menu/__tests__/Menu.int.test.ts +57 -0
  98. package/build/primer/Navigation/Menu/index.ts +1 -0
  99. package/build/primer/Navigation/TabNav/TabNav.prop.ts +39 -0
  100. package/build/primer/Navigation/TabNav/TabNav.tsx +105 -0
  101. package/build/primer/Navigation/TabNav/__tests__/TabNav.int.story.tsx +168 -0
  102. package/build/primer/Navigation/TabNav/__tests__/TabNav.int.test.ts +55 -0
  103. package/build/primer/Navigation/TabNav/index.ts +2 -0
  104. package/build/primer/Navigation/UnderlineNav/UnderlineNav.prop.ts +41 -0
  105. package/build/primer/Navigation/UnderlineNav/UnderlineNav.tsx +106 -0
  106. package/build/primer/Navigation/UnderlineNav/__tests__/UnderlineNav.int.story.tsx +140 -0
  107. package/build/primer/Navigation/UnderlineNav/__tests__/UnderlineNav.int.test.ts +81 -0
  108. package/build/primer/Navigation/UnderlineNav/index.ts +2 -0
  109. package/build/primer/Navigation/index.ts +12 -0
  110. package/build/primer/Pagination/PreviousNext/PreviousNext.prop.ts +53 -0
  111. package/build/primer/Pagination/PreviousNext/PreviousNext.scss +2 -2
  112. package/build/primer/Pagination/PreviousNext/PreviousNext.tsx +71 -0
  113. package/build/primer/Pagination/PreviousNext/__tests__/PreviousNext.int.story.tsx +48 -0
  114. package/build/primer/Pagination/PreviousNext/__tests__/PreviousNext.int.test.ts +15 -0
  115. package/build/primer/Pagination/PreviousNext/index.ts +2 -0
  116. package/build/primer/Pagination/index.ts +6 -0
  117. package/build/primer/Popover/Popover.mdx +190 -0
  118. package/build/primer/Popover/Popover.prop.ts +49 -0
  119. package/build/primer/Popover/Popover.tsx +80 -0
  120. package/build/primer/Popover/__tests__/Popover.int.story.tsx +216 -0
  121. package/build/primer/Popover/__tests__/Popover.int.test.ts +71 -0
  122. package/build/primer/Popover/index.ts +2 -0
  123. package/build/primer/Progress/Progress.mdx +31 -0
  124. package/build/primer/Progress/Progress.prop.ts +16 -0
  125. package/build/primer/Progress/Progress.tsx +19 -0
  126. package/build/primer/Progress/__tests__/Progress.int.story.tsx +28 -0
  127. package/build/primer/Progress/__tests__/Progress.int.test.ts +17 -0
  128. package/build/primer/Progress/index.ts +2 -0
  129. package/build/primer/Select/Select.mdx +19 -0
  130. package/build/primer/Select/Select.prop.ts +24 -0
  131. package/build/primer/Select/Select.scss +2 -2
  132. package/build/primer/Select/Select.tsx +58 -0
  133. package/build/primer/Select/__tests__/Select.int.story.tsx +38 -0
  134. package/build/primer/Select/__tests__/Select.int.test.ts +42 -0
  135. package/build/primer/Select/index.ts +2 -0
  136. package/build/primer/SelectMenu/SelectMenu.mdx +13 -0
  137. package/build/primer/SelectMenu/SelectMenu.prop.ts +25 -0
  138. package/build/primer/SelectMenu/SelectMenu.scss +4 -4
  139. package/build/primer/SelectMenu/SelectMenu.tsx +68 -0
  140. package/build/primer/SelectMenu/__tests__/SelectMenu.int.story.tsx +50 -0
  141. package/build/primer/SelectMenu/__tests__/SelectMenu.int.test.ts +56 -0
  142. package/build/primer/SelectMenu/index.ts +1 -0
  143. package/build/primer/Subhead/Subhead.mdx +20 -0
  144. package/build/primer/Subhead/Subhead.prop.ts +10 -0
  145. package/build/primer/Subhead/Subhead.scss +3 -3
  146. package/build/primer/Subhead/Subhead.tsx +15 -0
  147. package/build/primer/Subhead/__tests__/Subhead.int.story.tsx +23 -0
  148. package/build/primer/Subhead/__tests__/Subhead.int.test.ts +13 -0
  149. package/build/primer/Subhead/index.ts +1 -0
  150. package/build/primer/Toast/Toast.prop.ts +21 -0
  151. package/build/primer/Toast/Toast.scss +3 -3
  152. package/build/primer/Toast/Toast.tsx +38 -0
  153. package/build/primer/Toast/__tests__/Toast.int.story.tsx +50 -0
  154. package/build/primer/Toast/__tests__/Toast.int.test.ts +25 -0
  155. package/build/primer/Toast/index.ts +2 -0
  156. package/build/primer/index.ts +83 -0
  157. package/package.json +4 -4
  158. package/build/index.js +0 -12
  159. package/build/primer/Alert/Alert.js +0 -121
  160. package/build/primer/Alert/Alert.prop.js +0 -38
  161. package/build/primer/Alert/index.js +0 -19
  162. package/build/primer/Blankslate/Blankslate.js +0 -31
  163. package/build/primer/Blankslate/Blankslate.prop.js +0 -26
  164. package/build/primer/Blankslate/index.js +0 -19
  165. package/build/primer/Breadcrumb/Breadcrumb.js +0 -74
  166. package/build/primer/Breadcrumb/Breadcrumb.prop.js +0 -29
  167. package/build/primer/Breadcrumb/index.js +0 -19
  168. package/build/primer/Button/Button.js +0 -99
  169. package/build/primer/Button/Button.prop.js +0 -67
  170. package/build/primer/Button/index.js +0 -49
  171. package/build/primer/Dropdown/Dropdown.js +0 -104
  172. package/build/primer/Dropdown/Dropdown.prop.js +0 -34
  173. package/build/primer/Dropdown/index.js +0 -19
  174. package/build/primer/ErrorBoundary/ErrorBoundary.js +0 -59
  175. package/build/primer/ErrorBoundary/ErrorBoundary.prop.js +0 -11
  176. package/build/primer/ErrorBoundary/index.js +0 -12
  177. package/build/primer/Form/Checkbox/Checkbox.js +0 -49
  178. package/build/primer/Form/Checkbox/Checkbox.prop.js +0 -36
  179. package/build/primer/Form/Checkbox/index.js +0 -19
  180. package/build/primer/Form/Input/Input.js +0 -56
  181. package/build/primer/Form/Input/Input.prop.js +0 -43
  182. package/build/primer/Form/Input/index.js +0 -25
  183. package/build/primer/Form/Radio/Radio.js +0 -48
  184. package/build/primer/Form/Radio/Radio.prop.js +0 -34
  185. package/build/primer/Form/Radio/index.js +0 -19
  186. package/build/primer/Form/index.js +0 -24
  187. package/build/primer/Grid/DisplayTable/DisplayTable.js +0 -58
  188. package/build/primer/Grid/DisplayTable/DisplayTable.prop.js +0 -18
  189. package/build/primer/Grid/DisplayTable/index.js +0 -12
  190. package/build/primer/Grid/FlexGrid/FlexGrid.js +0 -244
  191. package/build/primer/Grid/FlexGrid/FlexGrid.prop.js +0 -49
  192. package/build/primer/Grid/FlexGrid/index.js +0 -25
  193. package/build/primer/Grid/index.js +0 -14
  194. package/build/primer/Icon/Icon.js +0 -70
  195. package/build/primer/Icon/Icon.part.js +0 -1295
  196. package/build/primer/Icon/Icon.prop.js +0 -689
  197. package/build/primer/Icon/index.js +0 -25
  198. package/build/primer/Label/Label.js +0 -31
  199. package/build/primer/Label/Label.prop.js +0 -34
  200. package/build/primer/Label/index.js +0 -12
  201. package/build/primer/Loader/Loader.js +0 -65
  202. package/build/primer/Loader/Loader.prop.js +0 -21
  203. package/build/primer/Loader/index.js +0 -19
  204. package/build/primer/Navigation/Menu/Menu.js +0 -70
  205. package/build/primer/Navigation/Menu/Menu.prop.js +0 -28
  206. package/build/primer/Navigation/Menu/index.js +0 -12
  207. package/build/primer/Navigation/TabNav/TabNav.js +0 -125
  208. package/build/primer/Navigation/TabNav/TabNav.prop.js +0 -36
  209. package/build/primer/Navigation/TabNav/index.js +0 -19
  210. package/build/primer/Navigation/UnderlineNav/UnderlineNav.js +0 -121
  211. package/build/primer/Navigation/UnderlineNav/UnderlineNav.prop.js +0 -41
  212. package/build/primer/Navigation/UnderlineNav/index.js +0 -25
  213. package/build/primer/Navigation/index.js +0 -17
  214. package/build/primer/Pagination/PreviousNext/PreviousNext.js +0 -76
  215. package/build/primer/Pagination/PreviousNext/PreviousNext.prop.js +0 -56
  216. package/build/primer/Pagination/PreviousNext/index.js +0 -19
  217. package/build/primer/Pagination/index.js +0 -11
  218. package/build/primer/Popover/Popover.js +0 -63
  219. package/build/primer/Popover/Popover.prop.js +0 -41
  220. package/build/primer/Popover/index.js +0 -25
  221. package/build/primer/Progress/Progress.js +0 -31
  222. package/build/primer/Progress/Progress.prop.js +0 -21
  223. package/build/primer/Progress/index.js +0 -19
  224. package/build/primer/Select/Select.js +0 -66
  225. package/build/primer/Select/Select.prop.js +0 -27
  226. package/build/primer/Select/index.js +0 -19
  227. package/build/primer/SelectMenu/SelectMenu.js +0 -95
  228. package/build/primer/SelectMenu/SelectMenu.prop.js +0 -26
  229. package/build/primer/SelectMenu/index.js +0 -12
  230. package/build/primer/Subhead/Subhead.js +0 -27
  231. package/build/primer/Subhead/Subhead.prop.js +0 -16
  232. package/build/primer/Subhead/index.js +0 -12
  233. package/build/primer/Toast/Toast.js +0 -55
  234. package/build/primer/Toast/Toast.prop.js +0 -26
  235. package/build/primer/Toast/index.js +0 -19
  236. package/build/primer/index.js +0 -87
  237. /package/build/primer/Form/Checkbox/{Checkbox.md → Checkbox.mdx} +0 -0
  238. /package/build/primer/Form/Checkbox/__tests__/__snapshots__/{Checkbox.int.test.js.snap → Checkbox.int.test.ts.snap} +0 -0
  239. /package/build/primer/Form/Input/{Input.md → Input.mdx} +0 -0
  240. /package/build/primer/Form/Input/__tests__/__snapshots__/{Input.int.test.js.snap → Input.int.test.ts.snap} +0 -0
  241. /package/build/primer/Form/Radio/{Radio.md → Radio.mdx} +0 -0
  242. /package/build/primer/Form/Radio/__tests__/__snapshots__/{Radio.int.test.js.snap → Radio.int.test.ts.snap} +0 -0
  243. /package/build/primer/Grid/DisplayTable/{DisplayTable.md → DisplayTable.mdx} +0 -0
  244. /package/build/primer/Grid/DisplayTable/__tests__/__snapshots__/{DisplayTable.int.test.js.snap → DisplayTable.int.test.ts.snap} +0 -0
  245. /package/build/primer/Grid/FlexGrid/{FlexGrid.md → FlexGrid.mdx} +0 -0
  246. /package/build/primer/Grid/FlexGrid/__tests__/__snapshots__/{FlexGrid.int.test.js.snap → FlexGrid.int.test.ts.snap} +0 -0
  247. /package/build/primer/Navigation/Menu/{Menu.md → Menu.mdx} +0 -0
  248. /package/build/primer/Navigation/Menu/__tests__/__snapshots__/{Menu.int.test.js.snap → Menu.int.test.ts.snap} +0 -0
  249. /package/build/primer/Navigation/TabNav/{TabNav.md → TabNav.mdx} +0 -0
  250. /package/build/primer/Navigation/TabNav/__tests__/__snapshots__/{TabNav.int.test.js.snap → TabNav.int.test.ts.snap} +0 -0
  251. /package/build/primer/Navigation/UnderlineNav/{UnderlineNav.md → UnderlineNav.mdx} +0 -0
  252. /package/build/primer/Navigation/UnderlineNav/__tests__/__snapshots__/{UnderlineNav.int.test.js.snap → UnderlineNav.int.test.ts.snap} +0 -0
  253. /package/build/primer/Pagination/PreviousNext/{PreviousNext.md → PreviousNext.mdx} +0 -0
  254. /package/build/primer/Pagination/PreviousNext/__tests__/__snapshots__/{PreviousNext.int.test.js.snap → PreviousNext.int.test.ts.snap} +0 -0
@@ -0,0 +1,191 @@
1
+ import {
2
+ defaultNormal,
3
+ defaultSmall,
4
+ defaultLarge,
5
+ defaultInactive,
6
+ defaultIconLeftAligned,
7
+ defaultIconRightAligned,
8
+ defaultLink,
9
+ primary,
10
+ primarySmall,
11
+ primaryLarge,
12
+ primaryInactive,
13
+ primaryIconLeftAligned,
14
+ primaryIconRightAligned,
15
+ danger,
16
+ dangerSmall,
17
+ dangerLarge,
18
+ dangerInactive,
19
+ dangerIconLeftAligned,
20
+ dangerIconRightAligned,
21
+ outline,
22
+ outlineSmall,
23
+ outlineLarge,
24
+ outlineInactive,
25
+ outlineIconLeftAligned,
26
+ outlineIconRightAligned,
27
+ blue,
28
+ blueSmall,
29
+ blueLarge,
30
+ blueInactive,
31
+ blueIconLeftAligned,
32
+ blueIconRightAligned,
33
+ orange,
34
+ orangeSmall,
35
+ orangeLarge,
36
+ orangeInactive,
37
+ orangeIconLeftAligned,
38
+ orangeIconRightAligned,
39
+ } from './Button.int.story'
40
+
41
+ describe('<Button />', () => {
42
+ describe('Render', () => {
43
+ test('must match defaultNormal()', () => {
44
+ expect(global.renderToJSON(defaultNormal())).toMatchSnapshot()
45
+ })
46
+
47
+ test('must match defaultSmall()', () => {
48
+ expect(global.renderToJSON(defaultSmall())).toMatchSnapshot()
49
+ })
50
+
51
+ test('must match defaultLarge()', () => {
52
+ expect(global.renderToJSON(defaultLarge())).toMatchSnapshot()
53
+ })
54
+
55
+ test('must match defaultInactive()', () => {
56
+ expect(global.renderToJSON(defaultInactive())).toMatchSnapshot()
57
+ })
58
+
59
+ test('must match defaultIconLeftAligned()', () => {
60
+ expect(global.renderToJSON(defaultIconLeftAligned())).toMatchSnapshot()
61
+ })
62
+
63
+ test('must match defaultIconRightAligned()', () => {
64
+ expect(global.renderToJSON(defaultIconRightAligned())).toMatchSnapshot()
65
+ })
66
+
67
+ test('must match defaultLink()', () => {
68
+ expect(global.renderToJSON(defaultLink())).toMatchSnapshot()
69
+ })
70
+
71
+ test('must match primary()', () => {
72
+ expect(global.renderToJSON(primary())).toMatchSnapshot()
73
+ })
74
+
75
+ test('must match primarySmall()', () => {
76
+ expect(global.renderToJSON(primarySmall())).toMatchSnapshot()
77
+ })
78
+
79
+ test('must match primaryLarge()', () => {
80
+ expect(global.renderToJSON(primaryLarge())).toMatchSnapshot()
81
+ })
82
+
83
+ test('must match primaryInactive()', () => {
84
+ expect(global.renderToJSON(primaryInactive())).toMatchSnapshot()
85
+ })
86
+
87
+ test('must match primaryIconLeftAligned()', () => {
88
+ expect(global.renderToJSON(primaryIconLeftAligned())).toMatchSnapshot()
89
+ })
90
+
91
+ test('must match primaryIconRightAligned()', () => {
92
+ expect(global.renderToJSON(primaryIconRightAligned())).toMatchSnapshot()
93
+ })
94
+
95
+ test('must match danger()', () => {
96
+ expect(global.renderToJSON(danger())).toMatchSnapshot()
97
+ })
98
+
99
+ test('must match dangerSmall()', () => {
100
+ expect(global.renderToJSON(dangerSmall())).toMatchSnapshot()
101
+ })
102
+
103
+ test('must match dangerLarge()', () => {
104
+ expect(global.renderToJSON(dangerLarge())).toMatchSnapshot()
105
+ })
106
+
107
+ test('must match dangerInactive()', () => {
108
+ expect(global.renderToJSON(dangerInactive())).toMatchSnapshot()
109
+ })
110
+
111
+ test('must match dangerIconLeftAligned()', () => {
112
+ expect(global.renderToJSON(dangerIconLeftAligned())).toMatchSnapshot()
113
+ })
114
+
115
+ test('must match dangerIconRightAligned()', () => {
116
+ expect(global.renderToJSON(dangerIconRightAligned())).toMatchSnapshot()
117
+ })
118
+
119
+ test('must match outline()', () => {
120
+ expect(global.renderToJSON(outline())).toMatchSnapshot()
121
+ })
122
+
123
+ test('must match outlineSmall()', () => {
124
+ expect(global.renderToJSON(outlineSmall())).toMatchSnapshot()
125
+ })
126
+
127
+ test('must match outlineLarge()', () => {
128
+ expect(global.renderToJSON(outlineLarge())).toMatchSnapshot()
129
+ })
130
+
131
+ test('must match outlineInactive()', () => {
132
+ expect(global.renderToJSON(outlineInactive())).toMatchSnapshot()
133
+ })
134
+
135
+ test('must match outlineIconLeftAligned()', () => {
136
+ expect(global.renderToJSON(outlineIconLeftAligned())).toMatchSnapshot()
137
+ })
138
+
139
+ test('must match outlineIconRightAligned()', () => {
140
+ expect(global.renderToJSON(outlineIconRightAligned())).toMatchSnapshot()
141
+ })
142
+
143
+ test('must match blue()', () => {
144
+ expect(global.renderToJSON(blue())).toMatchSnapshot()
145
+ })
146
+
147
+ test('must match blueSmall()', () => {
148
+ expect(global.renderToJSON(blueSmall())).toMatchSnapshot()
149
+ })
150
+
151
+ test('must match blueLarge()', () => {
152
+ expect(global.renderToJSON(blueLarge())).toMatchSnapshot()
153
+ })
154
+
155
+ test('must match blueInactive()', () => {
156
+ expect(global.renderToJSON(blueInactive())).toMatchSnapshot()
157
+ })
158
+
159
+ test('must match blueIconLeftAligned()', () => {
160
+ expect(global.renderToJSON(blueIconLeftAligned())).toMatchSnapshot()
161
+ })
162
+
163
+ test('must match blueIconRightAligned()', () => {
164
+ expect(global.renderToJSON(blueIconRightAligned())).toMatchSnapshot()
165
+ })
166
+
167
+ test('must match orange()', () => {
168
+ expect(global.renderToJSON(orange())).toMatchSnapshot()
169
+ })
170
+
171
+ test('must match orangeSmall()', () => {
172
+ expect(global.renderToJSON(orangeSmall())).toMatchSnapshot()
173
+ })
174
+
175
+ test('must match orangeLarge()', () => {
176
+ expect(global.renderToJSON(orangeLarge())).toMatchSnapshot()
177
+ })
178
+
179
+ test('must match orangeInactive()', () => {
180
+ expect(global.renderToJSON(orangeInactive())).toMatchSnapshot()
181
+ })
182
+
183
+ test('must match orangeIconLeftAligned()', () => {
184
+ expect(global.renderToJSON(orangeIconLeftAligned())).toMatchSnapshot()
185
+ })
186
+
187
+ test('must match orangeIconRightAligned()', () => {
188
+ expect(global.renderToJSON(orangeIconRightAligned())).toMatchSnapshot()
189
+ })
190
+ })
191
+ })
@@ -0,0 +1,2 @@
1
+ export { Button } from './Button'
2
+ export { buttonElement, buttonVariant, buttonSize, buttonState, iconAlignment, buttonInputType } from './Button.prop'
@@ -1,5 +1,5 @@
1
- @import '@papillonbits/css/build/primer/support/variables/misc.scss';
2
- @import '@papillonbits/css/build/primer/support/variables/typography.scss';
1
+ @import '@papillonarts/css/build/primer/support/variables/misc.scss';
2
+ @import '@papillonarts/css/build/primer/support/variables/typography.scss';
3
3
 
4
4
  // stylelint-disable no-descending-specificity
5
5
  // stylelint-disable selector-max-type, function-no-unknown
@@ -0,0 +1,19 @@
1
+ # Dropdown
2
+
3
+ > Dropdowns are lightweight context menus for housing navigation and actions. They're great for instances where you don't need the full power (and code) of the select menu.
4
+
5
+ # Variants
6
+
7
+ > - Regular, Inactive
8
+
9
+ ## Regular
10
+
11
+ ```jsx
12
+ <Dropdown summary={summary} ariaAttr={ariaAttr} items={items} onClick={action('onClick')} />
13
+ ```
14
+
15
+ ## Inactive
16
+
17
+ ```jsx
18
+ <Dropdown summary={summary} ariaAttr={ariaAttr} items={items} onClick={action('onClick')} state={dropdownState.inactive} />
19
+ ```
@@ -0,0 +1,33 @@
1
+ export const dropdownState = {
2
+ active: 'active',
3
+ inactive: 'inactive',
4
+ }
5
+
6
+ export const defaultProps = {
7
+ className: null,
8
+ ariaAttr: {
9
+ haspopup: false,
10
+ current: 'page',
11
+ },
12
+ state: dropdownState.active,
13
+ }
14
+
15
+ export interface AriaAttrType {
16
+ haspopup: boolean
17
+ current: string
18
+ }
19
+
20
+ export interface ItemType {
21
+ href: string
22
+ text: string
23
+ isSelected: boolean
24
+ }
25
+
26
+ export interface DropdownProps {
27
+ className?: string
28
+ summary: string
29
+ ariaAttr?: AriaAttrType
30
+ items: ItemType[]
31
+ onClick: (value) => void
32
+ state?: typeof dropdownState.active | typeof dropdownState.inactive
33
+ }
@@ -0,0 +1,102 @@
1
+ import cx from 'classnames'
2
+ import { v1 as uuidv1 } from 'uuid'
3
+ import detailsUtilityStyles from '@papillonarts/css/build/primer/utilities/details.scss'
4
+ import displayStyles from '@papillonarts/css/build/primer/utilities/visibility-display.scss'
5
+ import layoutStyles from '@papillonarts/css/build/primer/utilities/layout.scss'
6
+ import flexboxStyles from '@papillonarts/css/build/primer/utilities/flexbox.scss'
7
+ import { getIndexItems, getIndexItemsWithSelected } from '@papillonarts/library/array'
8
+ import { useRef } from '@papillonarts/library/hooks'
9
+ import buttonStyles from '../Button/Button.scss'
10
+ import { DropdownProps, defaultProps, dropdownState } from './Dropdown.prop'
11
+ import styles from './Dropdown.scss'
12
+
13
+ export function Dropdown({
14
+ className = defaultProps.className,
15
+ summary,
16
+ ariaAttr = defaultProps.ariaAttr,
17
+ items,
18
+ onClick,
19
+ state = defaultProps.state,
20
+ }: DropdownProps) {
21
+ const details = useRef(null)
22
+
23
+ if (!items) {
24
+ return null
25
+ }
26
+
27
+ const indexItems = getIndexItems(items)
28
+
29
+ return (
30
+ <div className={className}>
31
+ <details
32
+ ref={details}
33
+ className={cx(
34
+ styles.dropdown,
35
+ detailsUtilityStyles['details-reset'],
36
+ detailsUtilityStyles['details-overlay'],
37
+ displayStyles['d-inline-block'],
38
+ {
39
+ [styles['dropdown-inactive']]: state === dropdownState.inactive,
40
+ },
41
+ )}
42
+ >
43
+ <summary className={cx(buttonStyles.btn)} aria-haspopup={ariaAttr?.haspopup ?? false}>
44
+ <div
45
+ className={cx(displayStyles['d-flex'], flexboxStyles['flex-justify-between'], flexboxStyles['flex-items-center'], {
46
+ [styles['dropdown-inactive']]: state === dropdownState.inactive,
47
+ })}
48
+ >
49
+ <div>{summary}</div> <div className={styles['dropdown-caret']} />
50
+ </div>
51
+ </summary>
52
+
53
+ <ul className={cx(styles['dropdown-menu'], styles['dropdown-menu-se'], layoutStyles['width-full'])}>
54
+ {indexItems.map((indexItem) => {
55
+ const { href, text /* isSelected */ } = indexItem
56
+
57
+ // const itemOtherProps = isSelected ? { ...{ 'aria-current': ariaAttr?.current } } : null
58
+
59
+ return (
60
+ <li key={uuidv1()}>
61
+ <a
62
+ onClick={(e) => {
63
+ e.preventDefault()
64
+ const newIndexItems = getIndexItemsWithSelected(indexItems, indexItem)
65
+ onClick({
66
+ summary: text,
67
+ ariaAttr,
68
+ items: newIndexItems.map((newIndexItem) =>
69
+ (({
70
+ id: newIndexItemId,
71
+ href: newIndexItemHref,
72
+ text: newIndexItemText,
73
+ 'date-modified': dateModified,
74
+ 'date-created': dateCreated,
75
+ isSelected: newIndexItemIsSelected,
76
+ }) => ({
77
+ id: newIndexItemId,
78
+ href: newIndexItemHref,
79
+ text: newIndexItemText,
80
+ 'date-modified': dateModified,
81
+ 'date-created': dateCreated,
82
+ isSelected: newIndexItemIsSelected,
83
+ }))(newIndexItem),
84
+ ),
85
+ })
86
+ details.current.removeAttribute('open')
87
+ }}
88
+ className={styles['dropdown-item']}
89
+ href={href}
90
+ // @ts-ignore
91
+ // {...itemOtherProps}
92
+ >
93
+ {text}
94
+ </a>
95
+ </li>
96
+ )
97
+ })}
98
+ </ul>
99
+ </details>
100
+ </div>
101
+ )
102
+ }
@@ -0,0 +1,43 @@
1
+ import { action } from 'storybook/actions'
2
+ import { withTests } from '@storybook/addon-jest'
3
+ import { dropdownState } from '../Dropdown.prop'
4
+ import results from '../../../../../../.jest-test-results.json'
5
+
6
+ const Dropdown =
7
+ process.env.NODE_ENV === 'develop' || process.env.NODE_ENV === 'test'
8
+ ? require('../../../index').primer.Dropdown.Dropdown
9
+ : require('../../../../build').primer.Dropdown.Dropdown
10
+
11
+ export default {
12
+ title: 'Primer/Atom/Dropdown',
13
+ component: Dropdown,
14
+ decorators: [withTests({ results })],
15
+ parameters: { jest: ['Dropdown.int.test.js'] },
16
+ excludeStories: ['summary', 'ariaAttr', 'items', 'custom'],
17
+ }
18
+
19
+ export const summary = 'Dropdown'
20
+
21
+ export const ariaAttr = {
22
+ haspopup: true,
23
+ current: 'page',
24
+ }
25
+
26
+ export const items = [
27
+ { href: '#url', text: 'Dropdown Item 1', isSelected: true },
28
+ { href: '#url', text: 'Dropdown Item 2', isSelected: false },
29
+ { href: '#url', text: 'Dropdown Item 3', isSelected: false },
30
+ { href: '#url', text: 'Dropdown Item 4', isSelected: false },
31
+ ]
32
+
33
+ export function custom(onClick) {
34
+ return <Dropdown summary={summary} ariaAttr={ariaAttr} items={items} onClick={onClick} />
35
+ }
36
+
37
+ export function regular() {
38
+ return <Dropdown summary={summary} ariaAttr={ariaAttr} items={items} onClick={action('onClick')} />
39
+ }
40
+
41
+ export function inactive() {
42
+ return <Dropdown summary={summary} ariaAttr={ariaAttr} items={items} onClick={action('onClick')} state={dropdownState.inactive} />
43
+ }
@@ -0,0 +1,53 @@
1
+ import { items, regular, inactive } from './Dropdown.int.story'
2
+
3
+ jest.mock('@papillonarts/library/array', () => ({
4
+ getIndexItems: () => {},
5
+ getIndexItemsWithSelected: () => {},
6
+ }))
7
+
8
+ jest.mock('@papillonarts/library/hooks', () => ({
9
+ useRef: () => {},
10
+ }))
11
+
12
+ const libraryArrayMockObject = require('@papillonarts/library/array')
13
+ const libraryHooksMockObject = require('@papillonarts/library/hooks')
14
+
15
+ describe('<Dropdown />', () => {
16
+ const indexItemsDataObject = [
17
+ { ...items[0], index: 0 },
18
+ { ...items[1], index: 1 },
19
+ { ...items[2], index: 2 },
20
+ { ...items[3], index: 3 },
21
+ ]
22
+
23
+ const newIndexItemsWithSelectedDataObject = [
24
+ { ...items[0], index: 0, isSelected: true },
25
+ { ...items[1], index: 1, isSelected: false },
26
+ { ...items[2], index: 2, isSelected: false },
27
+ { ...items[3], index: 3, isSelected: false },
28
+ ]
29
+
30
+ beforeEach(() => {
31
+ jest.spyOn(libraryArrayMockObject, 'getIndexItems').mockReturnValue(indexItemsDataObject)
32
+
33
+ jest.spyOn(libraryArrayMockObject, 'getIndexItemsWithSelected').mockReturnValue(newIndexItemsWithSelectedDataObject)
34
+
35
+ jest.spyOn(libraryHooksMockObject, 'useRef').mockImplementation(() => ({
36
+ current: {
37
+ removeAttribute: () => {},
38
+ },
39
+ }))
40
+ })
41
+
42
+ afterEach(() => jest.clearAllMocks())
43
+
44
+ describe('Render', () => {
45
+ test('must match regular()', () => {
46
+ expect(global.renderToJSON(regular())).toMatchSnapshot()
47
+ })
48
+
49
+ test('must match inacive()', () => {
50
+ expect(global.renderToJSON(inactive())).toMatchSnapshot()
51
+ })
52
+ })
53
+ })
@@ -0,0 +1,2 @@
1
+ export { Dropdown } from './Dropdown'
2
+ export { dropdownState } from './Dropdown.prop'
@@ -0,0 +1,5 @@
1
+ export const defaultProps = {}
2
+
3
+ export interface ErrorBoundaryProps {
4
+ children: React.ReactNode // https://react.dev/learn/typescript#typing-children,
5
+ }
@@ -0,0 +1,35 @@
1
+ /* eslint-disable no-unused-vars, no-console */
2
+ import { Component } from 'react'
3
+ import { ErrorBoundaryProps } from './ErrorBoundary.prop'
4
+
5
+ export class ErrorBoundary extends Component<ErrorBoundaryProps> {
6
+ constructor(props) {
7
+ super(props)
8
+ this.state = { hasError: false }
9
+ }
10
+
11
+ static getDerivedStateFromError(error) {
12
+ // Update state so the next render will show the fallback UI.
13
+ return { hasError: true }
14
+ }
15
+
16
+ componentDidCatch(error, errorInfo) {
17
+ // You can also log the error to an error reporting service
18
+ console.log('~error~', error)
19
+ console.log('~errorInfo~', errorInfo)
20
+ }
21
+
22
+ render() {
23
+ // @ts-ignore
24
+ const { hasError } = this.state
25
+ // @ts-ignore
26
+ const { children } = this.props
27
+
28
+ if (hasError) {
29
+ // You can render any custom fallback UI
30
+ return <h1>Something went wrong.</h1>
31
+ }
32
+
33
+ return children
34
+ }
35
+ }
@@ -0,0 +1,23 @@
1
+ import { withTests } from '@storybook/addon-jest'
2
+ import results from '../../../../../../.jest-test-results.json'
3
+
4
+ const ErrorBoundary =
5
+ process.env.NODE_ENV === 'develop' || process.env.NODE_ENV === 'test'
6
+ ? require('../../../index').primer.ErrorBoundary
7
+ : require('../../../../build').primer.ErrorBoundary
8
+
9
+ export default {
10
+ title: 'Primer/Molecule/ErrorBoundary',
11
+ component: ErrorBoundary,
12
+ decorators: [withTests({ results })],
13
+ parameters: { jest: ['ErrorBoundary.int.test.js'] },
14
+ excludeStories: ['custom'],
15
+ }
16
+
17
+ export function regular() {
18
+ return (
19
+ <ErrorBoundary>
20
+ <div />
21
+ </ErrorBoundary>
22
+ )
23
+ }
@@ -0,0 +1,9 @@
1
+ import { regular } from './ErrorBoundary.int.story'
2
+
3
+ describe('<ErrorBoundary />', () => {
4
+ describe('Render', () => {
5
+ test('must match regular()', () => {
6
+ expect(global.renderToJSON(regular())).toMatchSnapshot()
7
+ })
8
+ })
9
+ })
@@ -0,0 +1 @@
1
+ export { ErrorBoundary } from './ErrorBoundary'
@@ -0,0 +1,34 @@
1
+ export const checkboxState = {
2
+ active: 'active',
3
+ inactive: 'inactive',
4
+ }
5
+
6
+ export const inputType = {
7
+ checkbox: 'checkbox',
8
+ }
9
+
10
+ export const defaultProps = {
11
+ dataTest: null,
12
+ className: null,
13
+ htmlFor: 'checkbox',
14
+ inputType: inputType.checkbox,
15
+ isChecked: false,
16
+ text: null,
17
+ state: checkboxState.active,
18
+ }
19
+
20
+ export interface AriaAttrType {
21
+ describedBy: string
22
+ }
23
+
24
+ export interface CheckboxProps {
25
+ dataTest?: string
26
+ className?: string
27
+ htmlFor?: string
28
+ ariaAttr: AriaAttrType
29
+ inputType?: typeof inputType.checkbox
30
+ isChecked?: boolean
31
+ text?: string
32
+ onChange: (value) => void
33
+ state?: typeof checkboxState.active | typeof checkboxState.inactive
34
+ }
@@ -0,0 +1,40 @@
1
+ import cx from 'classnames'
2
+ import marginStyles from '@papillonarts/css/build/primer/utilities/margin.scss'
3
+ import { CheckboxProps, defaultProps, checkboxState } from './Checkbox.prop'
4
+ import styles from './Checkbox.scss'
5
+ import formStyles from '../index.scss'
6
+
7
+ export function Checkbox({
8
+ dataTest = defaultProps.dataTest,
9
+ className = defaultProps.className,
10
+ htmlFor = defaultProps.htmlFor,
11
+ ariaAttr,
12
+ inputType = defaultProps.inputType,
13
+ isChecked = defaultProps.isChecked,
14
+ text = defaultProps.text,
15
+ onChange,
16
+ state = defaultProps.state,
17
+ }: CheckboxProps) {
18
+ const { describedBy } = ariaAttr
19
+
20
+ return (
21
+ <div
22
+ data-test={dataTest}
23
+ className={cx(className, marginStyles['m-0'], formStyles['form-checkbox'], {
24
+ [styles['checkbox-inactive']]: state === checkboxState.inactive,
25
+ })}
26
+ >
27
+ <label htmlFor={htmlFor}>
28
+ <input
29
+ type={inputType}
30
+ aria-describedby={describedBy}
31
+ onChange={(event) => {
32
+ onChange(event)
33
+ }}
34
+ checked={isChecked}
35
+ />
36
+ {text}
37
+ </label>
38
+ </div>
39
+ )
40
+ }
@@ -0,0 +1,50 @@
1
+ import { action } from 'storybook/actions'
2
+ import { withTests } from '@storybook/addon-jest'
3
+ import { checkboxState } from '../Checkbox.prop'
4
+ import results from '../../../../../../../.jest-test-results.json'
5
+
6
+ const Checkbox =
7
+ process.env.NODE_ENV === 'develop' || process.env.NODE_ENV === 'test'
8
+ ? require('../../../../index').primer.Form.Checkbox.Checkbox
9
+ : require('../../../../../build').primer.Form.Checkbox.Checkbox
10
+
11
+ export default {
12
+ title: 'Primer/Atom/Form/Checkbox',
13
+ component: Checkbox,
14
+ decorators: [withTests({ results })],
15
+ parameters: { jest: ['Checkbox.int.test.js'] },
16
+ excludeStories: ['ariaAttr', 'text', 'custom'],
17
+ }
18
+
19
+ const ariaAttr = {
20
+ describedBy: 'help-text-for-checkbox',
21
+ }
22
+
23
+ export const text = {
24
+ isChecked: 'is checked',
25
+ isNotChecked: 'is not checked',
26
+ }
27
+
28
+ export function custom(onChange) {
29
+ return <Checkbox ariaAttr={ariaAttr} isChecked={true} onChange={onChange} text="is checked" />
30
+ }
31
+
32
+ export function isChecked() {
33
+ return <Checkbox ariaAttr={ariaAttr} isChecked={true} onChange={action('onChange')} text={text.isChecked} />
34
+ }
35
+
36
+ export function isCheckedInactive() {
37
+ return (
38
+ <Checkbox ariaAttr={ariaAttr} isChecked={true} onChange={action('onChange')} text={text.isChecked} state={checkboxState.inactive} />
39
+ )
40
+ }
41
+
42
+ export function isNotChecked() {
43
+ return <Checkbox ariaAttr={ariaAttr} isChecked={false} onChange={action('onChange')} text={text.isNotChecked} />
44
+ }
45
+
46
+ export function isNotCheckedInactive() {
47
+ return (
48
+ <Checkbox ariaAttr={ariaAttr} isChecked={false} onChange={action('onChange')} text={text.isNotChecked} state={checkboxState.inactive} />
49
+ )
50
+ }