@darajs/ui-components 1.0.0-a.1

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 (242) hide show
  1. package/LICENSE +201 -0
  2. package/dist/accordion/accordion-item.d.ts +25 -0
  3. package/dist/accordion/accordion-item.d.ts.map +1 -0
  4. package/dist/accordion/accordion-item.js +90 -0
  5. package/dist/accordion/accordion-item.js.map +1 -0
  6. package/dist/accordion/accordion.d.ts +33 -0
  7. package/dist/accordion/accordion.d.ts.map +1 -0
  8. package/dist/accordion/accordion.js +86 -0
  9. package/dist/accordion/accordion.js.map +1 -0
  10. package/dist/badge/badge.d.ts +21 -0
  11. package/dist/badge/badge.d.ts.map +1 -0
  12. package/dist/badge/badge.js +42 -0
  13. package/dist/badge/badge.js.map +1 -0
  14. package/dist/button/button.d.ts +35 -0
  15. package/dist/button/button.d.ts.map +1 -0
  16. package/dist/button/button.js +169 -0
  17. package/dist/button/button.js.map +1 -0
  18. package/dist/button-bar/button-bar.d.ts +19 -0
  19. package/dist/button-bar/button-bar.d.ts.map +1 -0
  20. package/dist/button-bar/button-bar.js +123 -0
  21. package/dist/button-bar/button-bar.js.map +1 -0
  22. package/dist/carousel/carousel.d.ts +24 -0
  23. package/dist/carousel/carousel.d.ts.map +1 -0
  24. package/dist/carousel/carousel.js +175 -0
  25. package/dist/carousel/carousel.js.map +1 -0
  26. package/dist/checkbox/checkbox-group.d.ts +36 -0
  27. package/dist/checkbox/checkbox-group.d.ts.map +1 -0
  28. package/dist/checkbox/checkbox-group.js +116 -0
  29. package/dist/checkbox/checkbox-group.js.map +1 -0
  30. package/dist/checkbox/checkbox.d.ts +28 -0
  31. package/dist/checkbox/checkbox.d.ts.map +1 -0
  32. package/dist/checkbox/checkbox.js +162 -0
  33. package/dist/checkbox/checkbox.js.map +1 -0
  34. package/dist/checkbox/tri-state-checkbox.d.ts +23 -0
  35. package/dist/checkbox/tri-state-checkbox.d.ts.map +1 -0
  36. package/dist/checkbox/tri-state-checkbox.js +87 -0
  37. package/dist/checkbox/tri-state-checkbox.js.map +1 -0
  38. package/dist/combo-box/combo-box.d.ts +328 -0
  39. package/dist/combo-box/combo-box.d.ts.map +1 -0
  40. package/dist/combo-box/combo-box.js +213 -0
  41. package/dist/combo-box/combo-box.js.map +1 -0
  42. package/dist/component-select-list/component-select-list.d.ts +27 -0
  43. package/dist/component-select-list/component-select-list.d.ts.map +1 -0
  44. package/dist/component-select-list/component-select-list.js +129 -0
  45. package/dist/component-select-list/component-select-list.js.map +1 -0
  46. package/dist/constants.d.ts +33 -0
  47. package/dist/constants.d.ts.map +1 -0
  48. package/dist/constants.js +47 -0
  49. package/dist/constants.js.map +1 -0
  50. package/dist/context-menu/context-menu.d.ts +24 -0
  51. package/dist/context-menu/context-menu.d.ts.map +1 -0
  52. package/dist/context-menu/context-menu.js +112 -0
  53. package/dist/context-menu/context-menu.js.map +1 -0
  54. package/dist/datepicker/datepicker-select.d.ts +50 -0
  55. package/dist/datepicker/datepicker-select.d.ts.map +1 -0
  56. package/dist/datepicker/datepicker-select.js +211 -0
  57. package/dist/datepicker/datepicker-select.js.map +1 -0
  58. package/dist/datepicker/datepicker.d.ts +57 -0
  59. package/dist/datepicker/datepicker.d.ts.map +1 -0
  60. package/dist/datepicker/datepicker.js +608 -0
  61. package/dist/datepicker/datepicker.js.map +1 -0
  62. package/dist/dropzone/dropzone.d.ts +20 -0
  63. package/dist/dropzone/dropzone.d.ts.map +1 -0
  64. package/dist/dropzone/dropzone.js +77 -0
  65. package/dist/dropzone/dropzone.js.map +1 -0
  66. package/dist/error-boundary/error-boundary.d.ts +33 -0
  67. package/dist/error-boundary/error-boundary.d.ts.map +1 -0
  68. package/dist/error-boundary/error-boundary.js +72 -0
  69. package/dist/error-boundary/error-boundary.js.map +1 -0
  70. package/dist/filter/categorical-filter.d.ts +27 -0
  71. package/dist/filter/categorical-filter.d.ts.map +1 -0
  72. package/dist/filter/categorical-filter.js +150 -0
  73. package/dist/filter/categorical-filter.js.map +1 -0
  74. package/dist/filter/datetime-filter.d.ts +29 -0
  75. package/dist/filter/datetime-filter.d.ts.map +1 -0
  76. package/dist/filter/datetime-filter.js +196 -0
  77. package/dist/filter/datetime-filter.js.map +1 -0
  78. package/dist/filter/numeric-filter.d.ts +25 -0
  79. package/dist/filter/numeric-filter.d.ts.map +1 -0
  80. package/dist/filter/numeric-filter.js +146 -0
  81. package/dist/filter/numeric-filter.js.map +1 -0
  82. package/dist/hierarchy-selector/hierarchy-selector.d.ts +31 -0
  83. package/dist/hierarchy-selector/hierarchy-selector.d.ts.map +1 -0
  84. package/dist/hierarchy-selector/hierarchy-selector.js +65 -0
  85. package/dist/hierarchy-selector/hierarchy-selector.js.map +1 -0
  86. package/dist/hierarchy-selector/node/branch.d.ts +47 -0
  87. package/dist/hierarchy-selector/node/branch.d.ts.map +1 -0
  88. package/dist/hierarchy-selector/node/branch.js +133 -0
  89. package/dist/hierarchy-selector/node/branch.js.map +1 -0
  90. package/dist/index.d.ts +54 -0
  91. package/dist/index.d.ts.map +1 -0
  92. package/dist/index.js +52 -0
  93. package/dist/index.js.map +1 -0
  94. package/dist/input/input.d.ts +58 -0
  95. package/dist/input/input.d.ts.map +1 -0
  96. package/dist/input/input.js +102 -0
  97. package/dist/input/input.js.map +1 -0
  98. package/dist/jest-setup.d.ts +18 -0
  99. package/dist/jest-setup.d.ts.map +1 -0
  100. package/dist/jest-setup.js +18 -0
  101. package/dist/jest-setup.js.map +1 -0
  102. package/dist/modal/modal.d.ts +37 -0
  103. package/dist/modal/modal.d.ts.map +1 -0
  104. package/dist/modal/modal.js +120 -0
  105. package/dist/modal/modal.js.map +1 -0
  106. package/dist/multiselect/multiselect.d.ts +31 -0
  107. package/dist/multiselect/multiselect.d.ts.map +1 -0
  108. package/dist/multiselect/multiselect.js +282 -0
  109. package/dist/multiselect/multiselect.js.map +1 -0
  110. package/dist/numeric-input/input-stepper.d.ts +33 -0
  111. package/dist/numeric-input/input-stepper.d.ts.map +1 -0
  112. package/dist/numeric-input/input-stepper.js +54 -0
  113. package/dist/numeric-input/input-stepper.js.map +1 -0
  114. package/dist/numeric-input/numeric-input.d.ts +48 -0
  115. package/dist/numeric-input/numeric-input.d.ts.map +1 -0
  116. package/dist/numeric-input/numeric-input.js +199 -0
  117. package/dist/numeric-input/numeric-input.js.map +1 -0
  118. package/dist/progress-bar/progress-bar.d.ts +23 -0
  119. package/dist/progress-bar/progress-bar.d.ts.map +1 -0
  120. package/dist/progress-bar/progress-bar.js +88 -0
  121. package/dist/progress-bar/progress-bar.js.map +1 -0
  122. package/dist/radio/radio-group.d.ts +20 -0
  123. package/dist/radio/radio-group.d.ts.map +1 -0
  124. package/dist/radio/radio-group.js +158 -0
  125. package/dist/radio/radio-group.js.map +1 -0
  126. package/dist/search-bar/search-bar.d.ts +34 -0
  127. package/dist/search-bar/search-bar.d.ts.map +1 -0
  128. package/dist/search-bar/search-bar.js +39 -0
  129. package/dist/search-bar/search-bar.js.map +1 -0
  130. package/dist/sectioned-list/sectioned-list.d.ts +29 -0
  131. package/dist/sectioned-list/sectioned-list.d.ts.map +1 -0
  132. package/dist/sectioned-list/sectioned-list.js +208 -0
  133. package/dist/sectioned-list/sectioned-list.js.map +1 -0
  134. package/dist/select/select.d.ts +54 -0
  135. package/dist/select/select.d.ts.map +1 -0
  136. package/dist/select/select.js +159 -0
  137. package/dist/select/select.js.map +1 -0
  138. package/dist/slider/slider-inputs.d.ts +36 -0
  139. package/dist/slider/slider-inputs.d.ts.map +1 -0
  140. package/dist/slider/slider-inputs.js +85 -0
  141. package/dist/slider/slider-inputs.js.map +1 -0
  142. package/dist/slider/slider.d.ts +53 -0
  143. package/dist/slider/slider.d.ts.map +1 -0
  144. package/dist/slider/slider.js +267 -0
  145. package/dist/slider/slider.js.map +1 -0
  146. package/dist/spinner/spinner.d.ts +20 -0
  147. package/dist/spinner/spinner.d.ts.map +1 -0
  148. package/dist/spinner/spinner.js +132 -0
  149. package/dist/spinner/spinner.js.map +1 -0
  150. package/dist/switch/sun-icon.d.ts +3 -0
  151. package/dist/switch/sun-icon.d.ts.map +1 -0
  152. package/dist/switch/sun-icon.js +24 -0
  153. package/dist/switch/sun-icon.js.map +1 -0
  154. package/dist/switch/switch.d.ts +17 -0
  155. package/dist/switch/switch.d.ts.map +1 -0
  156. package/dist/switch/switch.js +92 -0
  157. package/dist/switch/switch.js.map +1 -0
  158. package/dist/table/cells/action-cell.d.ts +34 -0
  159. package/dist/table/cells/action-cell.d.ts.map +1 -0
  160. package/dist/table/cells/action-cell.js +68 -0
  161. package/dist/table/cells/action-cell.js.map +1 -0
  162. package/dist/table/cells/datetime-cell.d.ts +12 -0
  163. package/dist/table/cells/datetime-cell.d.ts.map +1 -0
  164. package/dist/table/cells/datetime-cell.js +36 -0
  165. package/dist/table/cells/datetime-cell.js.map +1 -0
  166. package/dist/table/cells/edit-cell-utils.d.ts +32 -0
  167. package/dist/table/cells/edit-cell-utils.d.ts.map +1 -0
  168. package/dist/table/cells/edit-cell-utils.js +2 -0
  169. package/dist/table/cells/edit-cell-utils.js.map +1 -0
  170. package/dist/table/cells/edit-input-cell.d.ts +10 -0
  171. package/dist/table/cells/edit-input-cell.d.ts.map +1 -0
  172. package/dist/table/cells/edit-input-cell.js +61 -0
  173. package/dist/table/cells/edit-input-cell.js.map +1 -0
  174. package/dist/table/cells/edit-select-cell.d.ts +12 -0
  175. package/dist/table/cells/edit-select-cell.d.ts.map +1 -0
  176. package/dist/table/cells/edit-select-cell.js +55 -0
  177. package/dist/table/cells/edit-select-cell.js.map +1 -0
  178. package/dist/table/filters.d.ts +46 -0
  179. package/dist/table/filters.d.ts.map +1 -0
  180. package/dist/table/filters.js +223 -0
  181. package/dist/table/filters.js.map +1 -0
  182. package/dist/table/headers/select-header.d.ts +14 -0
  183. package/dist/table/headers/select-header.d.ts.map +1 -0
  184. package/dist/table/headers/select-header.js +41 -0
  185. package/dist/table/headers/select-header.js.map +1 -0
  186. package/dist/table/options-menu.d.ts +25 -0
  187. package/dist/table/options-menu.d.ts.map +1 -0
  188. package/dist/table/options-menu.js +120 -0
  189. package/dist/table/options-menu.js.map +1 -0
  190. package/dist/table/table.d.ts +95 -0
  191. package/dist/table/table.d.ts.map +1 -0
  192. package/dist/table/table.js +524 -0
  193. package/dist/table/table.js.map +1 -0
  194. package/dist/table/types.d.ts +30 -0
  195. package/dist/table/types.d.ts.map +1 -0
  196. package/dist/table/types.js +2 -0
  197. package/dist/table/types.js.map +1 -0
  198. package/dist/tabs/tabs.d.ts +22 -0
  199. package/dist/tabs/tabs.d.ts.map +1 -0
  200. package/dist/tabs/tabs.js +88 -0
  201. package/dist/tabs/tabs.js.map +1 -0
  202. package/dist/textarea/textarea.d.ts +45 -0
  203. package/dist/textarea/textarea.d.ts.map +1 -0
  204. package/dist/textarea/textarea.js +77 -0
  205. package/dist/textarea/textarea.js.map +1 -0
  206. package/dist/tooltip/tooltip.d.ts +46 -0
  207. package/dist/tooltip/tooltip.d.ts.map +1 -0
  208. package/dist/tooltip/tooltip.js +116 -0
  209. package/dist/tooltip/tooltip.js.map +1 -0
  210. package/dist/types.d.ts +66 -0
  211. package/dist/types.d.ts.map +1 -0
  212. package/dist/types.js +2 -0
  213. package/dist/types.js.map +1 -0
  214. package/dist/utils/chevron.d.ts +34 -0
  215. package/dist/utils/chevron.d.ts.map +1 -0
  216. package/dist/utils/chevron.js +40 -0
  217. package/dist/utils/chevron.js.map +1 -0
  218. package/dist/utils/index.d.ts +22 -0
  219. package/dist/utils/index.d.ts.map +1 -0
  220. package/dist/utils/index.js +22 -0
  221. package/dist/utils/index.js.map +1 -0
  222. package/dist/utils/label.d.ts +3 -0
  223. package/dist/utils/label.d.ts.map +1 -0
  224. package/dist/utils/label.js +24 -0
  225. package/dist/utils/label.js.map +1 -0
  226. package/dist/utils/list-styles.d.ts +12 -0
  227. package/dist/utils/list-styles.d.ts.map +1 -0
  228. package/dist/utils/list-styles.js +58 -0
  229. package/dist/utils/list-styles.js.map +1 -0
  230. package/dist/utils/same-width-modifier.d.ts +23 -0
  231. package/dist/utils/same-width-modifier.d.ts.map +1 -0
  232. package/dist/utils/same-width-modifier.js +17 -0
  233. package/dist/utils/same-width-modifier.js.map +1 -0
  234. package/dist/utils/use-infinite-loader.d.ts +32 -0
  235. package/dist/utils/use-infinite-loader.d.ts.map +1 -0
  236. package/dist/utils/use-infinite-loader.js +114 -0
  237. package/dist/utils/use-infinite-loader.js.map +1 -0
  238. package/dist/utils/use-on-click-outside.d.ts +3 -0
  239. package/dist/utils/use-on-click-outside.d.ts.map +1 -0
  240. package/dist/utils/use-on-click-outside.js +36 -0
  241. package/dist/utils/use-on-click-outside.js.map +1 -0
  242. package/package.json +105 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2023 Impulse Innovations Ltd.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { AccordionItemType } from '../types';
3
+ export interface AccordionItemProps {
4
+ /** Background color to set to match the surrounding */
5
+ backgroundColor?: string;
6
+ /** Optional function for rendering the header row; accepts the label */
7
+ headerRenderer?: (item: AccordionItemType) => JSX.Element;
8
+ /** Optional function for rendering the content; accepts the item */
9
+ innerRenderer?: (item: AccordionItemType) => JSX.Element;
10
+ /** Item containing label and content */
11
+ item: any;
12
+ /** Optional handler for handling clicking the header */
13
+ onClick?: (e?: React.SyntheticEvent<HTMLElement | SVGSVGElement>) => void | Promise<void>;
14
+ /** Flag that specifies whether item is open or close */
15
+ open: boolean;
16
+ }
17
+ /**
18
+ * The component renders each item of the accordion. It accepts optional headerRenderer and innerRenderer
19
+ * for rendering the header and content
20
+ *
21
+ * @param {AccordionItemProps} props - the component props
22
+ */
23
+ declare function AccordionItem({ backgroundColor, headerRenderer, innerRenderer, item, onClick, open, }: AccordionItemProps): JSX.Element;
24
+ export default AccordionItem;
25
+ //# sourceMappingURL=accordion-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accordion-item.d.ts","sourceRoot":"","sources":["../../src/accordion/accordion-item.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AA0E7C,MAAM,WAAW,kBAAkB;IAC/B,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wEAAwE;IACxE,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,GAAG,CAAC,OAAO,CAAC;IAC1D,oEAAoE;IACpE,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,GAAG,CAAC,OAAO,CAAC;IACzD,wCAAwC;IACxC,IAAI,EAAE,GAAG,CAAC;IACV,wDAAwD;IACxD,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,GAAG,aAAa,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1F,wDAAwD;IACxD,IAAI,EAAE,OAAO,CAAC;CACjB;AAED;;;;;GAKG;AACH,iBAAS,aAAa,CAAC,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,IAAI,EACJ,OAAO,EACP,IAAI,GACP,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAclC;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright 2023 Impulse Innovations Limited
4
+ *
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import { Collapse } from 'react-collapse';
19
+ import styled from '@darajs/styled-components';
20
+ import { Chevron } from '../utils';
21
+ const AccordionItemWrapper = styled.div `
22
+ width: 100%;
23
+ background-color: ${(props) => { var _a; return (_a = props.backgroundColor) !== null && _a !== void 0 ? _a : props.theme.colors.blue1; }};
24
+ border: 1px solid ${(props) => props.theme.colors.grey1};
25
+ border-radius: 0.25rem;
26
+
27
+ /* Define the animation used for collapsing */
28
+ .ReactCollapse--collapse {
29
+ transition: height 0.35s ease;
30
+ }
31
+ `;
32
+ const AccordionLabel = styled.dt `
33
+ cursor: pointer;
34
+
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: space-between;
38
+
39
+ width: 100%;
40
+ padding: 0.5rem 1rem;
41
+
42
+ font-size: 1.2em;
43
+ font-weight: 400;
44
+ color: ${(props) => props.theme.colors.text};
45
+
46
+ background-color: ${(props) => props.theme.colors.grey1};
47
+ border: none;
48
+ border-radius: ${(props) => (props.isOpen ? '0.25rem 0.25rem 0rem 0rem' : '0.25rem')};
49
+
50
+ &:hover {
51
+ background-color: ${(props) => props.theme.colors.grey2};
52
+ }
53
+
54
+ &:active {
55
+ background-color: ${(props) => props.theme.colors.grey3};
56
+ }
57
+ `;
58
+ const ContentWrapper = styled.dd `
59
+ overflow: hidden;
60
+
61
+ width: 100%;
62
+ height: 100%;
63
+ /*
64
+ We have to use padding for the gap between items rather than margin
65
+ because margin doesn't work well with react-collapse and causes jumping
66
+ See: https://github.com/nkbt/react-collapse#behaviour-notes
67
+ */
68
+ margin: 0;
69
+ padding: 1rem;
70
+ `;
71
+ const AccordionContent = styled.div `
72
+ display: flex;
73
+
74
+ height: auto;
75
+
76
+ font-size: 1em;
77
+ font-weight: 300;
78
+ color: ${(props) => props.theme.colors.text};
79
+ `;
80
+ /**
81
+ * The component renders each item of the accordion. It accepts optional headerRenderer and innerRenderer
82
+ * for rendering the header and content
83
+ *
84
+ * @param {AccordionItemProps} props - the component props
85
+ */
86
+ function AccordionItem({ backgroundColor, headerRenderer, innerRenderer, item, onClick, open, }) {
87
+ return (_jsxs(AccordionItemWrapper, { backgroundColor: backgroundColor, children: [_jsxs(AccordionLabel, { isOpen: open, onClick: onClick, children: [headerRenderer ? headerRenderer(item) : item.label, _jsx(Chevron, { isOpen: open })] }), _jsx(Collapse, { isOpened: open, children: _jsx(ContentWrapper, { children: _jsx(AccordionContent, { children: innerRenderer ? innerRenderer(item) : item.content }) }) })] }, item.label));
88
+ }
89
+ export default AccordionItem;
90
+ //# sourceMappingURL=accordion-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accordion-item.js","sourceRoot":"","sources":["../../src/accordion/accordion-item.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAG/C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAMnC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAc;;wBAE7B,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,MAAA,KAAK,CAAC,eAAe,mCAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAA,EAAA;wBAC5D,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;;;;;;;CAO1D,CAAC;AAMF,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CAAqB;;;;;;;;;;;;aAYxC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI;;wBAEvB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;;qBAEtC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,SAAS,CAAC;;;4BAG5D,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;;;;4BAInC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;;CAE9D,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;;;;;;;;CAY/B,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;aAOtB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI;CAC9C,CAAC;AAiBF;;;;;GAKG;AACH,SAAS,aAAa,CAAC,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,IAAI,EACJ,OAAO,EACP,IAAI,GACa;IACjB,OAAO,CACH,MAAC,oBAAoB,IAAC,eAAe,EAAE,eAAe,aAClD,MAAC,cAAc,IAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,aACzC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EACnD,KAAC,OAAO,IAAC,MAAM,EAAE,IAAI,GAAI,IACZ,EACjB,KAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI,YACpB,KAAC,cAAc,cACX,KAAC,gBAAgB,cAAE,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,GAAoB,GAC5E,GACV,KAT8C,IAAI,CAAC,KAAK,CAUhD,CAC1B,CAAC;AACN,CAAC;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,33 @@
1
+ /// <reference types="react" />
2
+ import { AccordionItemType } from '../types';
3
+ export interface AccordionProps {
4
+ /** Background color to set to match the surrounding */
5
+ backgroundColor?: string;
6
+ /** Standard react className property */
7
+ className?: string;
8
+ /** Optional function for rendering the header row; accepts the item */
9
+ headerRenderer?: (item: AccordionItemType) => JSX.Element;
10
+ /** Optional prop to specify which item(s) to open initially; should be its index in the array */
11
+ initialOpenItems?: Array<number> | number;
12
+ /** Optional function for rendering the content; accepts the item */
13
+ innerRenderer?: (item: AccordionItemType) => JSX.Element;
14
+ /** Array of items containing label and content */
15
+ items?: Array<AccordionItemType>;
16
+ /** defines whether to only be able to open one item at a time defaults to true */
17
+ multi?: boolean;
18
+ /** onChange event. */
19
+ onChange?: (openItems: Array<number> | number) => void | Promise<void>;
20
+ /** Pass through of style property to the wrapper element */
21
+ style?: React.CSSProperties;
22
+ /** Optional prop to put the component in controlled mode */
23
+ value?: Array<number> | number;
24
+ }
25
+ /**
26
+ * An accordion component that accepts an array of items as well as optional headerRenderer
27
+ * for rendering the header row and optional innerRenderer for rendering the content
28
+ *
29
+ * @param {AccordionProps} props - the component props
30
+ */
31
+ declare function Accordion({ backgroundColor, className, initialOpenItems, headerRenderer, innerRenderer, items, style, multi, onChange, value, }: AccordionProps): JSX.Element;
32
+ export default Accordion;
33
+ //# sourceMappingURL=accordion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/accordion/accordion.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAa7C,MAAM,WAAW,cAAc;IAC3B,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,GAAG,CAAC,OAAO,CAAC;IAC1D,iGAAiG;IACjG,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC1C,oEAAoE;IACpE,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,GAAG,CAAC,OAAO,CAAC;IACzD,kDAAkD;IAClD,KAAK,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACjC,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE,4DAA4D;IAC5D,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,4DAA4D;IAC5D,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CAClC;AAsBD;;;;;GAKG;AACH,iBAAS,SAAS,CAAC,EACf,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,KAAK,EACL,KAAK,EACL,KAAY,EACZ,QAAQ,EACR,KAAK,GACR,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CAmD9B;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright 2023 Impulse Innovations Limited
4
+ *
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import { useCallback, useEffect, useState } from 'react';
19
+ import styled from '@darajs/styled-components';
20
+ import AccordionItem from './accordion-item';
21
+ const AccordionWrapper = styled.dl `
22
+ overflow: auto;
23
+ display: flex;
24
+ flex-direction: column;
25
+ gap: 2px;
26
+ align-items: center;
27
+
28
+ width: 100%;
29
+ height: 100%;
30
+ `;
31
+ function getInitialOpen(initialItems, value, itemsArray) {
32
+ if (value !== undefined) {
33
+ const initialOpen = Array.isArray(value) ? value : [value];
34
+ return itemsArray.map((item, index) => {
35
+ return initialOpen.includes(index);
36
+ });
37
+ }
38
+ if (initialItems !== undefined) {
39
+ const initialOpen = Array.isArray(initialItems) ? initialItems : [initialItems];
40
+ return itemsArray.map((item, index) => {
41
+ return initialOpen.includes(index);
42
+ });
43
+ }
44
+ return new Array(itemsArray.length).fill(false);
45
+ }
46
+ /**
47
+ * An accordion component that accepts an array of items as well as optional headerRenderer
48
+ * for rendering the header row and optional innerRenderer for rendering the content
49
+ *
50
+ * @param {AccordionProps} props - the component props
51
+ */
52
+ function Accordion({ backgroundColor, className, initialOpenItems, headerRenderer, innerRenderer, items, style, multi = true, onChange, value, }) {
53
+ const [openItems, setOpenItems] = useState(getInitialOpen(initialOpenItems, value, items));
54
+ const onClick = useCallback((index) => {
55
+ let newOpenItems = openItems;
56
+ if (!multi) {
57
+ newOpenItems = openItems.map((item, idx) => {
58
+ if (idx === index) {
59
+ return !item;
60
+ }
61
+ return false;
62
+ });
63
+ }
64
+ else {
65
+ newOpenItems[index] = !openItems[index];
66
+ }
67
+ // gets a list of boolean and returns the indexes of the true values
68
+ const chosenItems = newOpenItems.reduce((acc, curr, idx) => {
69
+ if (curr) {
70
+ acc.push(idx);
71
+ }
72
+ return acc;
73
+ }, []);
74
+ onChange === null || onChange === void 0 ? void 0 : onChange([...chosenItems]);
75
+ // uncontrolled component
76
+ if (value === undefined) {
77
+ setOpenItems([...newOpenItems]);
78
+ }
79
+ }, [openItems, setOpenItems]);
80
+ useEffect(() => {
81
+ setOpenItems(getInitialOpen(initialOpenItems, value, items));
82
+ }, [value]);
83
+ return (_jsx(AccordionWrapper, { className: className, style: style, children: items.map((item, index) => (_jsx(AccordionItem, { backgroundColor: backgroundColor, headerRenderer: headerRenderer, innerRenderer: innerRenderer, item: item, onClick: () => onClick(index), open: openItems[index] }, `accordion-item-${index}`))) }));
84
+ }
85
+ export default Accordion;
86
+ //# sourceMappingURL=accordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../src/accordion/accordion.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ export interface BadgeProps {
3
+ /** The label of the badge, can be any react node */
4
+ children: React.ReactNode;
5
+ /** The main color of the badge */
6
+ color: string;
7
+ /** An optional height parameter, if not provided 18px */
8
+ height?: number;
9
+ /** An optional param that defines whether badge shows outline instead or filled styling, if not provided defaults to false */
10
+ outline?: boolean;
11
+ /** An optional width parameter, if not provided the badge will scale to the content */
12
+ width?: string;
13
+ }
14
+ /**
15
+ * A simple badge component
16
+ *
17
+ * @param {BadgeProps} props - the component props
18
+ */
19
+ declare const Badge: import("styled-components").StyledComponent<"span", import("@darajs/styled-components").DefaultTheme, BadgeProps, never>;
20
+ export default Badge;
21
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/badge/badge.tsx"],"names":[],"mappings":";AAoBA,MAAM,WAAW,UAAU;IACvB,oDAAoD;IACpD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8HAA8H;IAC9H,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uFAAuF;IACvF,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,QAAA,MAAM,KAAK,0HAgBV,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright 2023 Impulse Innovations Limited
3
+ *
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import styled from '@darajs/styled-components';
18
+ const shouldForwardProp = (prop) => !['color', 'width'].includes(prop);
19
+ /**
20
+ * A simple badge component
21
+ *
22
+ * @param {BadgeProps} props - the component props
23
+ */
24
+ const Badge = styled.span.withConfig({ shouldForwardProp }) `
25
+ display: inline-flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+
29
+ width: ${(props) => props.width || 'auto'};
30
+ height: ${(props) => (props.height ? `${props.height}px` : '2rem')};
31
+ padding: 0 0.75rem;
32
+
33
+ font-size: 0.875rem;
34
+ font-weight: 400;
35
+ color: ${(props) => (props.outline ? props.color : props.theme.colors.blue1)};
36
+
37
+ background-color: ${(props) => (props.outline ? props.theme.colors.blue1 : props.color)};
38
+ border: 1px solid ${(props) => props.color};
39
+ border-radius: ${(props) => (props.height ? `${props.height / 2}px` : '1rem')};
40
+ `;
41
+ export default Badge;
42
+ //# sourceMappingURL=badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/badge/badge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAE/C,MAAM,iBAAiB,GAAG,CAAC,IAAS,EAAW,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAerF;;;;GAIG;AACH,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAY;;;;;aAK1D,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,MAAM;cAC/B,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;;;;;aAKzD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;;wBAExD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;wBACnE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK;qBACzB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;CAChF,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { ButtonHTMLAttributes } from 'react';
2
+ import { DefaultTheme } from '@darajs/styled-components';
3
+ interface BaseButtonProps {
4
+ $hasAnchor: boolean;
5
+ }
6
+ export declare const BaseButton: import("styled-components").StyledComponent<"button", DefaultTheme, BaseButtonProps, never>;
7
+ type Styling = 'primary' | 'secondary' | 'error' | 'ghost' | 'plain';
8
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
9
+ autoFocus?: boolean;
10
+ /** The label of the button, can be any react node */
11
+ children: React.ReactNode;
12
+ /** Standard react className property */
13
+ className?: string;
14
+ /** Optional property to disable the button */
15
+ disabled?: boolean;
16
+ /** Optional property to set filename to download; should be used together with href for downloads */
17
+ download?: string;
18
+ /** Optional href to navigate to, will swap the button element for an anchor */
19
+ href?: string;
20
+ /** Component id */
21
+ id?: string;
22
+ /** Optional flag to show a loading state - replace the text of the button with a spinner */
23
+ loading?: boolean;
24
+ /** Optional onClick handler, will be called when the button is pressed */
25
+ onClick?: (e?: React.SyntheticEvent<HTMLButtonElement>) => void | Promise<void>;
26
+ /** If true the button will have the outline look, otherwise by default it takes the filled style */
27
+ outline?: boolean;
28
+ /** Native react style property, can be used to fine tune the button appearance */
29
+ style?: React.CSSProperties;
30
+ /** The style of the button, accepts: primary, secondary or error. Defaults to primary */
31
+ styling?: Styling;
32
+ }
33
+ declare const _default: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
34
+ export default _default;
35
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,oBAAoB,EAA4B,MAAM,OAAO,CAAC;AAEvE,OAAe,EAAE,YAAY,EAAY,MAAM,2BAA2B,CAAC;AAI3E,UAAU,eAAe;IACrB,UAAU,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,UAAU,6FAiBtB,CAAC;AA8JF,KAAK,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAWrE,MAAM,WAAW,WAAY,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qDAAqD;IACrD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qGAAqG;IACrG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4FAA4F;IAC5F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChF,oGAAoG;IACpG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kFAAkF;IAClF,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,yFAAyF;IACzF,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;;AA6DD,wBAAkC"}