@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
@@ -0,0 +1,328 @@
1
+ /// <reference types="react" />
2
+ import { InteractiveComponentProps, Item } from '../types';
3
+ interface WrapperProps {
4
+ isDisabled: boolean;
5
+ isErrored: boolean;
6
+ isOpen: boolean;
7
+ }
8
+ export declare const Wrapper: import("styled-components").StyledComponent<"div", import("@darajs/styled-components").DefaultTheme, WrapperProps, never>;
9
+ interface InputWrapperProps {
10
+ disabled: boolean;
11
+ isOpen: boolean;
12
+ }
13
+ export declare const InputWrapper: import("styled-components").StyledComponent<"div", import("@darajs/styled-components").DefaultTheme, InputWrapperProps, never>;
14
+ export declare const Input: import("styled-components").StyledComponent<"input", import("@darajs/styled-components").DefaultTheme, {}, never>;
15
+ export declare const NoItemsLabel: import("styled-components").StyledComponent<"span", import("@darajs/styled-components").DefaultTheme, {}, never>;
16
+ export declare const ChevronButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../button/button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, import("@darajs/styled-components").DefaultTheme, {
17
+ styling: "ghost";
18
+ autoFocus?: boolean;
19
+ children: import("react").ReactNode;
20
+ className?: string;
21
+ disabled?: boolean;
22
+ download?: string;
23
+ href?: string;
24
+ id?: string;
25
+ loading?: boolean;
26
+ onClick?: (e?: import("react").SyntheticEvent<HTMLButtonElement, Event>) => void | Promise<void>;
27
+ outline?: boolean;
28
+ style?: import("react").CSSProperties;
29
+ form?: string;
30
+ formAction?: string;
31
+ formEncType?: string;
32
+ formMethod?: string;
33
+ formNoValidate?: boolean;
34
+ formTarget?: string;
35
+ name?: string;
36
+ type?: "button" | "reset" | "submit";
37
+ value?: string | number | readonly string[];
38
+ defaultChecked?: boolean;
39
+ defaultValue?: string | number | readonly string[];
40
+ suppressContentEditableWarning?: boolean;
41
+ suppressHydrationWarning?: boolean;
42
+ accessKey?: string;
43
+ contentEditable?: "inherit" | (boolean | "false" | "true");
44
+ contextMenu?: string;
45
+ dir?: string;
46
+ draggable?: boolean | "false" | "true";
47
+ hidden?: boolean;
48
+ lang?: string;
49
+ nonce?: string;
50
+ placeholder?: string;
51
+ slot?: string;
52
+ spellCheck?: boolean | "false" | "true";
53
+ tabIndex?: number;
54
+ title?: string;
55
+ translate?: "no" | "yes";
56
+ radioGroup?: string;
57
+ role?: import("react").AriaRole;
58
+ about?: string;
59
+ content?: string;
60
+ datatype?: string;
61
+ inlist?: any;
62
+ prefix?: string;
63
+ property?: string;
64
+ rel?: string;
65
+ resource?: string;
66
+ rev?: string;
67
+ typeof?: string;
68
+ vocab?: string;
69
+ autoCapitalize?: string;
70
+ autoCorrect?: string;
71
+ autoSave?: string;
72
+ color?: string;
73
+ itemProp?: string;
74
+ itemScope?: boolean;
75
+ itemType?: string;
76
+ itemID?: string;
77
+ itemRef?: string;
78
+ results?: number;
79
+ security?: string;
80
+ unselectable?: "on" | "off";
81
+ inputMode?: "search" | "text" | "none" | "email" | "tel" | "url" | "numeric" | "decimal";
82
+ is?: string;
83
+ 'aria-activedescendant'?: string;
84
+ 'aria-atomic'?: boolean | "false" | "true";
85
+ 'aria-autocomplete'?: "both" | "none" | "inline" | "list";
86
+ 'aria-braillelabel'?: string;
87
+ 'aria-brailleroledescription'?: string;
88
+ 'aria-busy'?: boolean | "false" | "true";
89
+ 'aria-checked'?: boolean | "mixed" | "false" | "true";
90
+ 'aria-colcount'?: number;
91
+ 'aria-colindex'?: number;
92
+ 'aria-colindextext'?: string;
93
+ 'aria-colspan'?: number;
94
+ 'aria-controls'?: string;
95
+ 'aria-current'?: boolean | "time" | "page" | "false" | "true" | "step" | "date" | "location";
96
+ 'aria-describedby'?: string;
97
+ 'aria-description'?: string;
98
+ 'aria-details'?: string;
99
+ 'aria-disabled'?: boolean | "false" | "true";
100
+ 'aria-dropeffect'?: "link" | "none" | "copy" | "move" | "execute" | "popup";
101
+ 'aria-errormessage'?: string;
102
+ 'aria-expanded'?: boolean | "false" | "true";
103
+ 'aria-flowto'?: string;
104
+ 'aria-grabbed'?: boolean | "false" | "true";
105
+ 'aria-haspopup'?: boolean | "dialog" | "menu" | "listbox" | "grid" | "false" | "true" | "tree";
106
+ 'aria-hidden'?: boolean | "false" | "true";
107
+ 'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling";
108
+ 'aria-keyshortcuts'?: string;
109
+ 'aria-label'?: string;
110
+ 'aria-labelledby'?: string;
111
+ 'aria-level'?: number;
112
+ 'aria-live'?: "off" | "assertive" | "polite";
113
+ 'aria-modal'?: boolean | "false" | "true";
114
+ 'aria-multiline'?: boolean | "false" | "true";
115
+ 'aria-multiselectable'?: boolean | "false" | "true";
116
+ 'aria-orientation'?: "horizontal" | "vertical";
117
+ 'aria-owns'?: string;
118
+ 'aria-placeholder'?: string;
119
+ 'aria-posinset'?: number;
120
+ 'aria-pressed'?: boolean | "mixed" | "false" | "true";
121
+ 'aria-readonly'?: boolean | "false" | "true";
122
+ 'aria-relevant'?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals";
123
+ 'aria-required'?: boolean | "false" | "true";
124
+ 'aria-roledescription'?: string;
125
+ 'aria-rowcount'?: number;
126
+ 'aria-rowindex'?: number;
127
+ 'aria-rowindextext'?: string;
128
+ 'aria-rowspan'?: number;
129
+ 'aria-selected'?: boolean | "false" | "true";
130
+ 'aria-setsize'?: number;
131
+ 'aria-sort'?: "none" | "ascending" | "descending" | "other";
132
+ 'aria-valuemax'?: number;
133
+ 'aria-valuemin'?: number;
134
+ 'aria-valuenow'?: number;
135
+ 'aria-valuetext'?: string;
136
+ dangerouslySetInnerHTML?: {
137
+ __html: string | TrustedHTML;
138
+ };
139
+ onCopy?: import("react").ClipboardEventHandler<HTMLButtonElement>;
140
+ onCopyCapture?: import("react").ClipboardEventHandler<HTMLButtonElement>;
141
+ onCut?: import("react").ClipboardEventHandler<HTMLButtonElement>;
142
+ onCutCapture?: import("react").ClipboardEventHandler<HTMLButtonElement>;
143
+ onPaste?: import("react").ClipboardEventHandler<HTMLButtonElement>;
144
+ onPasteCapture?: import("react").ClipboardEventHandler<HTMLButtonElement>;
145
+ onCompositionEnd?: import("react").CompositionEventHandler<HTMLButtonElement>;
146
+ onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLButtonElement>;
147
+ onCompositionStart?: import("react").CompositionEventHandler<HTMLButtonElement>;
148
+ onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLButtonElement>;
149
+ onCompositionUpdate?: import("react").CompositionEventHandler<HTMLButtonElement>;
150
+ onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLButtonElement>;
151
+ onFocus?: import("react").FocusEventHandler<HTMLButtonElement>;
152
+ onFocusCapture?: import("react").FocusEventHandler<HTMLButtonElement>;
153
+ onBlur?: import("react").FocusEventHandler<HTMLButtonElement>;
154
+ onBlurCapture?: import("react").FocusEventHandler<HTMLButtonElement>;
155
+ onChange?: import("react").FormEventHandler<HTMLButtonElement>;
156
+ onChangeCapture?: import("react").FormEventHandler<HTMLButtonElement>;
157
+ onBeforeInput?: import("react").FormEventHandler<HTMLButtonElement>;
158
+ onBeforeInputCapture?: import("react").FormEventHandler<HTMLButtonElement>;
159
+ onInput?: import("react").FormEventHandler<HTMLButtonElement>;
160
+ onInputCapture?: import("react").FormEventHandler<HTMLButtonElement>;
161
+ onReset?: import("react").FormEventHandler<HTMLButtonElement>;
162
+ onResetCapture?: import("react").FormEventHandler<HTMLButtonElement>;
163
+ onSubmit?: import("react").FormEventHandler<HTMLButtonElement>;
164
+ onSubmitCapture?: import("react").FormEventHandler<HTMLButtonElement>;
165
+ onInvalid?: import("react").FormEventHandler<HTMLButtonElement>;
166
+ onInvalidCapture?: import("react").FormEventHandler<HTMLButtonElement>;
167
+ onLoad?: import("react").ReactEventHandler<HTMLButtonElement>;
168
+ onLoadCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
169
+ onError?: import("react").ReactEventHandler<HTMLButtonElement>;
170
+ onErrorCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
171
+ onKeyDown?: import("react").KeyboardEventHandler<HTMLButtonElement>;
172
+ onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLButtonElement>;
173
+ onKeyPress?: import("react").KeyboardEventHandler<HTMLButtonElement>;
174
+ onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLButtonElement>;
175
+ onKeyUp?: import("react").KeyboardEventHandler<HTMLButtonElement>;
176
+ onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLButtonElement>;
177
+ onAbort?: import("react").ReactEventHandler<HTMLButtonElement>;
178
+ onAbortCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
179
+ onCanPlay?: import("react").ReactEventHandler<HTMLButtonElement>;
180
+ onCanPlayCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
181
+ onCanPlayThrough?: import("react").ReactEventHandler<HTMLButtonElement>;
182
+ onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
183
+ onDurationChange?: import("react").ReactEventHandler<HTMLButtonElement>;
184
+ onDurationChangeCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
185
+ onEmptied?: import("react").ReactEventHandler<HTMLButtonElement>;
186
+ onEmptiedCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
187
+ onEncrypted?: import("react").ReactEventHandler<HTMLButtonElement>;
188
+ onEncryptedCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
189
+ onEnded?: import("react").ReactEventHandler<HTMLButtonElement>;
190
+ onEndedCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
191
+ onLoadedData?: import("react").ReactEventHandler<HTMLButtonElement>;
192
+ onLoadedDataCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
193
+ onLoadedMetadata?: import("react").ReactEventHandler<HTMLButtonElement>;
194
+ onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
195
+ onLoadStart?: import("react").ReactEventHandler<HTMLButtonElement>;
196
+ onLoadStartCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
197
+ onPause?: import("react").ReactEventHandler<HTMLButtonElement>;
198
+ onPauseCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
199
+ onPlay?: import("react").ReactEventHandler<HTMLButtonElement>;
200
+ onPlayCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
201
+ onPlaying?: import("react").ReactEventHandler<HTMLButtonElement>;
202
+ onPlayingCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
203
+ onProgress?: import("react").ReactEventHandler<HTMLButtonElement>;
204
+ onProgressCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
205
+ onRateChange?: import("react").ReactEventHandler<HTMLButtonElement>;
206
+ onRateChangeCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
207
+ onResize?: import("react").ReactEventHandler<HTMLButtonElement>;
208
+ onResizeCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
209
+ onSeeked?: import("react").ReactEventHandler<HTMLButtonElement>;
210
+ onSeekedCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
211
+ onSeeking?: import("react").ReactEventHandler<HTMLButtonElement>;
212
+ onSeekingCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
213
+ onStalled?: import("react").ReactEventHandler<HTMLButtonElement>;
214
+ onStalledCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
215
+ onSuspend?: import("react").ReactEventHandler<HTMLButtonElement>;
216
+ onSuspendCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
217
+ onTimeUpdate?: import("react").ReactEventHandler<HTMLButtonElement>;
218
+ onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
219
+ onVolumeChange?: import("react").ReactEventHandler<HTMLButtonElement>;
220
+ onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
221
+ onWaiting?: import("react").ReactEventHandler<HTMLButtonElement>;
222
+ onWaitingCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
223
+ onAuxClick?: import("react").MouseEventHandler<HTMLButtonElement>;
224
+ onAuxClickCapture?: import("react").MouseEventHandler<HTMLButtonElement>;
225
+ onClickCapture?: import("react").MouseEventHandler<HTMLButtonElement>;
226
+ onContextMenu?: import("react").MouseEventHandler<HTMLButtonElement>;
227
+ onContextMenuCapture?: import("react").MouseEventHandler<HTMLButtonElement>;
228
+ onDoubleClick?: import("react").MouseEventHandler<HTMLButtonElement>;
229
+ onDoubleClickCapture?: import("react").MouseEventHandler<HTMLButtonElement>;
230
+ onDrag?: import("react").DragEventHandler<HTMLButtonElement>;
231
+ onDragCapture?: import("react").DragEventHandler<HTMLButtonElement>;
232
+ onDragEnd?: import("react").DragEventHandler<HTMLButtonElement>;
233
+ onDragEndCapture?: import("react").DragEventHandler<HTMLButtonElement>;
234
+ onDragEnter?: import("react").DragEventHandler<HTMLButtonElement>;
235
+ onDragEnterCapture?: import("react").DragEventHandler<HTMLButtonElement>;
236
+ onDragExit?: import("react").DragEventHandler<HTMLButtonElement>;
237
+ onDragExitCapture?: import("react").DragEventHandler<HTMLButtonElement>;
238
+ onDragLeave?: import("react").DragEventHandler<HTMLButtonElement>;
239
+ onDragLeaveCapture?: import("react").DragEventHandler<HTMLButtonElement>;
240
+ onDragOver?: import("react").DragEventHandler<HTMLButtonElement>;
241
+ onDragOverCapture?: import("react").DragEventHandler<HTMLButtonElement>;
242
+ onDragStart?: import("react").DragEventHandler<HTMLButtonElement>;
243
+ onDragStartCapture?: import("react").DragEventHandler<HTMLButtonElement>;
244
+ onDrop?: import("react").DragEventHandler<HTMLButtonElement>;
245
+ onDropCapture?: import("react").DragEventHandler<HTMLButtonElement>;
246
+ onMouseDown?: import("react").MouseEventHandler<HTMLButtonElement>;
247
+ onMouseDownCapture?: import("react").MouseEventHandler<HTMLButtonElement>;
248
+ onMouseEnter?: import("react").MouseEventHandler<HTMLButtonElement>;
249
+ onMouseLeave?: import("react").MouseEventHandler<HTMLButtonElement>;
250
+ onMouseMove?: import("react").MouseEventHandler<HTMLButtonElement>;
251
+ onMouseMoveCapture?: import("react").MouseEventHandler<HTMLButtonElement>;
252
+ onMouseOut?: import("react").MouseEventHandler<HTMLButtonElement>;
253
+ onMouseOutCapture?: import("react").MouseEventHandler<HTMLButtonElement>;
254
+ onMouseOver?: import("react").MouseEventHandler<HTMLButtonElement>;
255
+ onMouseOverCapture?: import("react").MouseEventHandler<HTMLButtonElement>;
256
+ onMouseUp?: import("react").MouseEventHandler<HTMLButtonElement>;
257
+ onMouseUpCapture?: import("react").MouseEventHandler<HTMLButtonElement>;
258
+ onSelect?: import("react").ReactEventHandler<HTMLButtonElement>;
259
+ onSelectCapture?: import("react").ReactEventHandler<HTMLButtonElement>;
260
+ onTouchCancel?: import("react").TouchEventHandler<HTMLButtonElement>;
261
+ onTouchCancelCapture?: import("react").TouchEventHandler<HTMLButtonElement>;
262
+ onTouchEnd?: import("react").TouchEventHandler<HTMLButtonElement>;
263
+ onTouchEndCapture?: import("react").TouchEventHandler<HTMLButtonElement>;
264
+ onTouchMove?: import("react").TouchEventHandler<HTMLButtonElement>;
265
+ onTouchMoveCapture?: import("react").TouchEventHandler<HTMLButtonElement>;
266
+ onTouchStart?: import("react").TouchEventHandler<HTMLButtonElement>;
267
+ onTouchStartCapture?: import("react").TouchEventHandler<HTMLButtonElement>;
268
+ onPointerDown?: import("react").PointerEventHandler<HTMLButtonElement>;
269
+ onPointerDownCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
270
+ onPointerMove?: import("react").PointerEventHandler<HTMLButtonElement>;
271
+ onPointerMoveCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
272
+ onPointerUp?: import("react").PointerEventHandler<HTMLButtonElement>;
273
+ onPointerUpCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
274
+ onPointerCancel?: import("react").PointerEventHandler<HTMLButtonElement>;
275
+ onPointerCancelCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
276
+ onPointerEnter?: import("react").PointerEventHandler<HTMLButtonElement>;
277
+ onPointerEnterCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
278
+ onPointerLeave?: import("react").PointerEventHandler<HTMLButtonElement>;
279
+ onPointerLeaveCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
280
+ onPointerOver?: import("react").PointerEventHandler<HTMLButtonElement>;
281
+ onPointerOverCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
282
+ onPointerOut?: import("react").PointerEventHandler<HTMLButtonElement>;
283
+ onPointerOutCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
284
+ onGotPointerCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
285
+ onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
286
+ onLostPointerCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
287
+ onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLButtonElement>;
288
+ onScroll?: import("react").UIEventHandler<HTMLButtonElement>;
289
+ onScrollCapture?: import("react").UIEventHandler<HTMLButtonElement>;
290
+ onWheel?: import("react").WheelEventHandler<HTMLButtonElement>;
291
+ onWheelCapture?: import("react").WheelEventHandler<HTMLButtonElement>;
292
+ onAnimationStart?: import("react").AnimationEventHandler<HTMLButtonElement>;
293
+ onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLButtonElement>;
294
+ onAnimationEnd?: import("react").AnimationEventHandler<HTMLButtonElement>;
295
+ onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLButtonElement>;
296
+ onAnimationIteration?: import("react").AnimationEventHandler<HTMLButtonElement>;
297
+ onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLButtonElement>;
298
+ onTransitionEnd?: import("react").TransitionEventHandler<HTMLButtonElement>;
299
+ onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement>;
300
+ ref?: import("react").Ref<HTMLButtonElement>;
301
+ key?: import("react").Key;
302
+ theme: import("@darajs/styled-components").DefaultTheme;
303
+ }, "form" | "slot" | "style" | "title" | "type" | "name" | "theme" | "ref" | "children" | "suppressHydrationWarning" | "className" | "color" | "id" | "lang" | "role" | "tabIndex" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "disabled" | "hidden" | "content" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "outline" | "download" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "loading" | "styling">;
304
+ export interface ComboBoxProps extends InteractiveComponentProps<Item> {
305
+ /** Whether to open the select dropdown on load or not, defaults to false */
306
+ initialIsOpen?: boolean;
307
+ /** The items to pick from the list. Each should have a label and a value */
308
+ items: Array<Item>;
309
+ /** An optional onSelect handler for listening to changes in the selected item */
310
+ onSelect?: (item: Item) => void | Promise<void>;
311
+ /** An optional placeholder for the input field to display when nothing is selected, defaults to '' */
312
+ placeholder?: string;
313
+ /** Set the selected value to a specific value, will put the component in controlled mode. Set to `null` to reset the value. */
314
+ selectedItem?: Item;
315
+ /** Font size in rem to show in the Select */
316
+ size?: number;
317
+ /** Pass through of style property to the root element */
318
+ style?: React.CSSProperties;
319
+ }
320
+ /**
321
+ * A single select combobox component, accepts a list of items to select from and an onSelect handler to listen for
322
+ * changes. Allows to search for item by typing in combo box.
323
+ *
324
+ * @param {ComboBoxProps} props - the component props
325
+ */
326
+ declare function ComboBox(props: ComboBoxProps): JSX.Element;
327
+ export default ComboBox;
328
+ //# sourceMappingURL=combo-box.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../src/combo-box/combo-box.tsx"],"names":[],"mappings":";AAyBA,OAAO,EAAE,yBAAyB,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAK3D,UAAU,YAAY;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,OAAO,2HAgCnB,CAAC;AAEF,UAAU,iBAAiB;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,YAAY,gIAsBxB,CAAC;AAEF,eAAO,MAAM,KAAK,mHAuBjB,CAAC;AAEF,eAAO,MAAM,YAAY,kHAYxB,CAAC;AAQF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;k5JAOzB,CAAC;AAEF,MAAM,WAAW,aAAc,SAAQ,yBAAyB,CAAC,IAAI,CAAC;IAClE,4EAA4E;IAC5E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4EAA4E;IAC5E,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACnB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,sGAAsG;IACtG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+HAA+H;IAC/H,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC/B;AAED;;;;;GAKG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAsKnD;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,213 @@
1
+ import { createElement as _createElement } from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * Copyright 2023 Impulse Innovations Limited
5
+ *
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ import { useCombobox } from 'downshift';
20
+ import { useEffect, useRef, useState } from 'react';
21
+ import ReactDOM from 'react-dom';
22
+ import { usePopper } from 'react-popper';
23
+ import styled from '@darajs/styled-components';
24
+ import Button from '../button/button';
25
+ import Tooltip from '../tooltip/tooltip';
26
+ import { Chevron, List, ListItem, sameWidthModifier } from '../utils';
27
+ const { stateChangeTypes } = useCombobox;
28
+ export const Wrapper = styled.div `
29
+ display: inline-flex;
30
+
31
+ width: 100%;
32
+ min-width: 4rem;
33
+ height: 2.5rem;
34
+
35
+ border-radius: ${(props) => (props.isOpen ? '0.25rem 0.25rem 0px 0px' : '0.25rem')};
36
+
37
+ ${(props) => {
38
+ if (props.isDisabled) {
39
+ return `
40
+ border: 1px solid ${props.theme.colors.grey2};
41
+
42
+ svg {
43
+ color: ${props.theme.colors.grey2};
44
+ }
45
+ `;
46
+ }
47
+ if (props.isErrored) {
48
+ return `border: 1px solid ${props.theme.colors.error};`;
49
+ }
50
+ return `
51
+ border: 1px solid ${props.isOpen ? props.theme.colors.grey3 : props.theme.colors.grey1};
52
+ :hover {
53
+ border: 1px solid ${props.theme.colors.grey3};
54
+
55
+ }
56
+ `;
57
+ }}
58
+ `;
59
+ export const InputWrapper = styled.div `
60
+ display: flex;
61
+ flex: 1 1 auto;
62
+ align-items: center;
63
+ justify-content: space-between;
64
+
65
+ width: calc(100% - 1rem);
66
+ height: 100%;
67
+ padding: 0 0.25rem 0 1rem;
68
+
69
+ color: ${(props) => (props.disabled ? props.theme.colors.grey2 : props.theme.colors.text)};
70
+
71
+ background-color: ${(props) => props.theme.colors.grey1};
72
+ border: none;
73
+ border-radius: ${(props) => (props.isOpen ? '0.25rem 0.25rem 0px 0px' : '0.25rem')};
74
+
75
+ :hover {
76
+ background-color: ${(props) => (props.disabled ? props.theme.colors.grey1 : props.theme.colors.grey2)};
77
+ }
78
+ svg {
79
+ height: 0.8rem;
80
+ }
81
+ `;
82
+ export const Input = styled.input `
83
+ overflow: hidden;
84
+ flex: 1 1 auto;
85
+
86
+ height: 100%;
87
+ margin-right: 0.5rem;
88
+ padding: 0rem;
89
+
90
+ font-size: ${(props) => (props.size ? `${props.size}rem` : props.theme.font.size)};
91
+ font-weight: 300;
92
+ color: ${(props) => props.theme.colors.text};
93
+ text-align: left;
94
+ text-overflow: ellipsis;
95
+ white-space: nowrap;
96
+
97
+ background-color: transparent;
98
+ border: none;
99
+ outline: 0;
100
+
101
+ :disabled {
102
+ cursor: not-allowed;
103
+ color: ${(props) => props.theme.colors.grey2};
104
+ }
105
+ `;
106
+ export const NoItemsLabel = styled.span `
107
+ display: flex;
108
+ flex: 1 1 auto;
109
+ align-items: center;
110
+ justify-content: center;
111
+
112
+ height: 2rem;
113
+
114
+ font-size: 1rem;
115
+ color: ${(props) => props.theme.colors.text};
116
+
117
+ background-color: ${(props) => props.theme.colors.blue1};
118
+ `;
119
+ const DropdownList = styled(List) `
120
+ margin-left: -1px;
121
+ border-radius: 0px 0px 0.25rem 0.25rem;
122
+ box-shadow: ${(props) => props.theme.shadow.light};
123
+ `;
124
+ export const ChevronButton = styled(Button).attrs((attrs) => (Object.assign(Object.assign({}, attrs), { styling: 'ghost' }))) `
125
+ min-width: 0;
126
+ height: auto;
127
+ margin: 0;
128
+ padding: 0 0.25rem;
129
+
130
+ background-color: transparent !important;
131
+ `;
132
+ /**
133
+ * A single select combobox component, accepts a list of items to select from and an onSelect handler to listen for
134
+ * changes. Allows to search for item by typing in combo box.
135
+ *
136
+ * @param {ComboBoxProps} props - the component props
137
+ */
138
+ function ComboBox(props) {
139
+ var _a, _b, _c, _d, _e, _f, _g;
140
+ const referenceElement = useRef(null);
141
+ const popperElement = useRef(null);
142
+ const { styles, attributes, update } = usePopper(referenceElement.current, popperElement.current, {
143
+ modifiers: [sameWidthModifier],
144
+ placement: 'bottom-start',
145
+ });
146
+ const [inputValue, setInputValue] = useState((_d = (_b = (_a = props.initialValue) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : (_c = props.selectedItem) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : '');
147
+ const [pendingHighlight, setPendingHighlight] = useState(null);
148
+ const filteredItems = props.items.filter((item) => { var _a; return inputValue ? (_a = item.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase()) : true; });
149
+ const { selectedItem, isOpen, getMenuProps, getInputProps, getToggleButtonProps, highlightedIndex, getItemProps, setHighlightedIndex, } = useCombobox(Object.assign({ initialIsOpen: props.initialIsOpen, initialSelectedItem: (_e = props.initialValue) !== null && _e !== void 0 ? _e : props.selectedItem, itemToString: (item) => (item ? item.label : ''), items: filteredItems, onInputValueChange: (change) => {
150
+ setInputValue(change.inputValue);
151
+ }, onSelectedItemChange: (changes) => {
152
+ var _a, _b;
153
+ if (props.onSelect) {
154
+ if ((props.selectedItem && ((_a = changes.selectedItem) === null || _a === void 0 ? void 0 : _a.value) !== ((_b = props.selectedItem) === null || _b === void 0 ? void 0 : _b.value)) ||
155
+ !props.selectedItem) {
156
+ props.onSelect(changes.selectedItem);
157
+ }
158
+ }
159
+ }, stateReducer: (state, { changes, type }) => {
160
+ var _a;
161
+ // This resets the input when the dropdown is opened
162
+ if (type === stateChangeTypes.InputFocus ||
163
+ (type === stateChangeTypes.ToggleButtonClick && changes.isOpen) ||
164
+ (type === stateChangeTypes.ControlledPropUpdatedSelectedItem && changes.isOpen)) {
165
+ // This is a hack to change the highlight in the next render cycle so filteredItems had time to update
166
+ setPendingHighlight(changes.selectedItem ? props.items.findIndex((i) => i.value === changes.selectedItem.value) : 0);
167
+ return Object.assign(Object.assign({}, changes), { inputValue: '' });
168
+ }
169
+ // This restores the input value when the dropdown is closed or an item is picked
170
+ if ([
171
+ stateChangeTypes.InputKeyDownEnter,
172
+ stateChangeTypes.ItemClick,
173
+ stateChangeTypes.InputBlur,
174
+ stateChangeTypes.InputKeyDownEscape,
175
+ stateChangeTypes.ToggleButtonClick,
176
+ ].includes(type)) {
177
+ return Object.assign(Object.assign({}, changes), { inputValue: ((_a = changes.selectedItem) === null || _a === void 0 ? void 0 : _a.label) || '' });
178
+ }
179
+ return changes;
180
+ } }, ('selectedItem' in props && { selectedItem: props.selectedItem })));
181
+ useEffect(() => {
182
+ if (isOpen && pendingHighlight !== null) {
183
+ setHighlightedIndex(pendingHighlight);
184
+ setPendingHighlight(null);
185
+ }
186
+ }, [isOpen, pendingHighlight, setHighlightedIndex]);
187
+ useEffect(() => {
188
+ if (props.selectedItem === null) {
189
+ setInputValue('');
190
+ }
191
+ }, [props.selectedItem]);
192
+ // After the dropdown is opened, trigger an update of it's position, so it positions correctly.
193
+ useEffect(() => {
194
+ if (isOpen && update) {
195
+ update();
196
+ }
197
+ }, [isOpen, update]);
198
+ // Both downshift and popper want a ref to the reference element and popper element, the following blocks combine
199
+ // these refs into a single function that can be applied to the elements
200
+ const menuProps = getMenuProps();
201
+ const setMenuRef = menuProps.ref;
202
+ delete menuProps.ref;
203
+ const setMenuReference = (value) => {
204
+ setMenuRef(value);
205
+ popperElement.current = value;
206
+ };
207
+ return (_jsx(Tooltip, { content: props.errorMsg, disabled: !props.errorMsg, styling: "error", children: _jsxs(Wrapper, { className: props.className, isDisabled: props.disabled, isErrored: !!props.errorMsg, isOpen: isOpen, style: props.style, children: [_jsxs(InputWrapper, { disabled: props.disabled, isOpen: isOpen, ref: referenceElement, children: [_jsx(Input, Object.assign({}, getInputProps({
208
+ disabled: props.disabled,
209
+ }), { placeholder: (_f = (selectedItem === null ? props.placeholder : selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.label)) !== null && _f !== void 0 ? _f : props.placeholder, size: props.size })), _jsx(ChevronButton, Object.assign({}, getToggleButtonProps(), { children: _jsx(Chevron, { disabled: props.disabled, isOpen: isOpen }) }))] }), ReactDOM.createPortal(_jsxs(DropdownList, Object.assign({}, menuProps, attributes.popper, { isOpen: isOpen, ref: setMenuReference, style: Object.assign(Object.assign({}, styles.popper), { width: parseFloat((_g = styles.popper) === null || _g === void 0 ? void 0 : _g.width) + 2, zIndex: 9999 }), children: [filteredItems.length > 0 &&
210
+ filteredItems.map((item, index) => (_createElement(ListItem, Object.assign({}, getItemProps({ index, item }), { hovered: index === highlightedIndex, key: `item-${index}`, size: props.size, title: item.label }), item.label))), filteredItems.length === 0 && _jsx(NoItemsLabel, { children: "No Items" })] })), document.body)] }) }));
211
+ }
212
+ export default ComboBox;
213
+ //# sourceMappingURL=combo-box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../src/combo-box/combo-box.tsx"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAuD,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAE/C,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEtE,MAAM,EAAE,gBAAgB,EAAE,GAAG,WAAW,CAAC;AAQzC,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAc;;;;;;;qBAO1B,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,SAAS,CAAC;;MAEhF,CAAC,KAAK,EAAE,EAAE;IACR,IAAI,KAAK,CAAC,UAAU,EAAE;QAClB,OAAO;oCACiB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;;;6BAG/B,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;;aAExC,CAAC;KACL;IAED,IAAI,KAAK,CAAC,SAAS,EAAE;QACjB,OAAO,qBAAqB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC;KAC3D;IAED,OAAO;gCACiB,KAAK,CAAC,M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K,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,KAAK,CAAC,mCAAI,KAAK,CAAC,WAAW,EAE1F,IAAI,EAAE,KAAK,CAAC,IAAI,IAClB,EACF,KAAC,aAAa,oBAAK,oBAAoB,EAAE,cACrC,KAAC,OAAO,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAI,IACzC,IACL,EACd,QAAQ,CAAC,YAAY,CAClB,MAAC,YAAY,oBACL,SAAS,EACT,UAAU,CAAC,MAAM,IACrB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,gBAAgB,EACrB,KAAK,kCACE,MAAM,CAAC,MAAM,KAEhB,KAAK,EAAE,UAAU,CAAC,MAAC,MAAM,CAAC,MAAc,0CAAE,KAAK,CAAC,GAAG,CAAC,EACpD,MAAM,EAAE,IAAI,gBAGf,aAAa,CAAC,MAAM,GAAG,CAAC;4BACrB,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC/B,eAAC,QAAQ,oBACD,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,IACjC,OAAO,EAAE,KAAK,KAAK,gBAAgB,EACnC,GAAG,EAAE,QAAQ,KAAK,EAAE,EACpB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,IAAI,CAAC,KAAK,KAEhB,IAAI,CAAC,KAAK,CACJ,CACd,CAAC,EACL,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,KAAC,YAAY,2BAAwB,KACzD,EACf,QAAQ,CAAC,IAAI,CAChB,IACK,GACJ,CACb,CAAC;AACN,CAAC;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { ComponentSelectItem } from '../types';
3
+ export interface ComponentSelectListProps {
4
+ /** Standard react className property */
5
+ className?: string;
6
+ /** The items to display, each should have a title, subtitle and component */
7
+ items: Array<ComponentSelectItem>;
8
+ /** An optional prop to specify the number of items per row, 3 by default */
9
+ itemsPerRow?: number;
10
+ /** An optional flag for allowing selecting multiple cards, false by default */
11
+ multiSelect?: boolean;
12
+ /** An optional onSelect handler for listening to changes in the selected items */
13
+ onSelect?: (items: Array<string>) => void | Promise<void>;
14
+ /** The optional selected items, can be an array of titles if multiSelect is true otherwise a title */
15
+ selectedItems?: Array<string>;
16
+ /** Pass through of style property to the root element */
17
+ style?: React.CSSProperties;
18
+ }
19
+ /**
20
+ * The ComponentSelectList component creates a list of card of selectable cards containing either images or plots.
21
+ * The plot should be passed as a JSX element.
22
+ *
23
+ * @param props the component props
24
+ */
25
+ declare function ComponentSelectList(props: ComponentSelectListProps): JSX.Element;
26
+ export default ComponentSelectList;
27
+ //# sourceMappingURL=component-select-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-select-list.d.ts","sourceRoot":"","sources":["../../src/component-select-list/component-select-list.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAKhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AA6G/C,MAAM,WAAW,wBAAwB;IACrC,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAClC,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,sGAAsG;IACtG,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,yDAAyD;IACzD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC/B;AAED;;;;;GAKG;AACH,iBAAS,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,GAAG,CAAC,OAAO,CAsCzE;AAED,eAAe,mBAAmB,CAAC"}