@darajs/components 0.4.8

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 (302) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +37 -0
  3. package/dist/common/accordion/accordion.d.ts +17 -0
  4. package/dist/common/accordion/accordion.d.ts.map +1 -0
  5. package/dist/common/accordion/accordion.js +36 -0
  6. package/dist/common/accordion/accordion.js.map +1 -0
  7. package/dist/common/anchor/anchor.d.ts +17 -0
  8. package/dist/common/anchor/anchor.d.ts.map +1 -0
  9. package/dist/common/anchor/anchor.js +40 -0
  10. package/dist/common/anchor/anchor.js.map +1 -0
  11. package/dist/common/bullet-list/bullet_list.d.ts +16 -0
  12. package/dist/common/bullet-list/bullet_list.d.ts.map +1 -0
  13. package/dist/common/bullet-list/bullet_list.js +17 -0
  14. package/dist/common/bullet-list/bullet_list.js.map +1 -0
  15. package/dist/common/button/button.d.ts +27 -0
  16. package/dist/common/button/button.d.ts.map +1 -0
  17. package/dist/common/button/button.js +47 -0
  18. package/dist/common/button/button.js.map +1 -0
  19. package/dist/common/button-bar/button-bar.d.ts +22 -0
  20. package/dist/common/button-bar/button-bar.d.ts.map +1 -0
  21. package/dist/common/button-bar/button-bar.js +27 -0
  22. package/dist/common/button-bar/button-bar.js.map +1 -0
  23. package/dist/common/card/card.d.ts +24 -0
  24. package/dist/common/card/card.d.ts.map +1 -0
  25. package/dist/common/card/card.js +58 -0
  26. package/dist/common/card/card.js.map +1 -0
  27. package/dist/common/carousel/carousel.d.ts +27 -0
  28. package/dist/common/carousel/carousel.d.ts.map +1 -0
  29. package/dist/common/carousel/carousel.js +42 -0
  30. package/dist/common/carousel/carousel.js.map +1 -0
  31. package/dist/common/checkbox-group/checkbox-group.d.ts +24 -0
  32. package/dist/common/checkbox-group/checkbox-group.d.ts.map +1 -0
  33. package/dist/common/checkbox-group/checkbox-group.js +37 -0
  34. package/dist/common/checkbox-group/checkbox-group.js.map +1 -0
  35. package/dist/common/code/code.d.ts +12 -0
  36. package/dist/common/code/code.d.ts.map +1 -0
  37. package/dist/common/code/code.js +11 -0
  38. package/dist/common/code/code.js.map +1 -0
  39. package/dist/common/component-select-list/component-select-list.d.ts +23 -0
  40. package/dist/common/component-select-list/component-select-list.d.ts.map +1 -0
  41. package/dist/common/component-select-list/component-select-list.js +29 -0
  42. package/dist/common/component-select-list/component-select-list.js.map +1 -0
  43. package/dist/common/constants.d.ts +19 -0
  44. package/dist/common/constants.d.ts.map +1 -0
  45. package/dist/common/constants.js +21 -0
  46. package/dist/common/constants.js.map +1 -0
  47. package/dist/common/context/form-context.d.ts +20 -0
  48. package/dist/common/context/form-context.d.ts.map +1 -0
  49. package/dist/common/context/form-context.js +28 -0
  50. package/dist/common/context/form-context.js.map +1 -0
  51. package/dist/common/context/index.d.ts +2 -0
  52. package/dist/common/context/index.d.ts.map +1 -0
  53. package/dist/common/context/index.js +2 -0
  54. package/dist/common/context/index.js.map +1 -0
  55. package/dist/common/datepicker/datepicker.d.ts +31 -0
  56. package/dist/common/datepicker/datepicker.d.ts.map +1 -0
  57. package/dist/common/datepicker/datepicker.js +70 -0
  58. package/dist/common/datepicker/datepicker.js.map +1 -0
  59. package/dist/common/dropzone/dropzone.d.ts +21 -0
  60. package/dist/common/dropzone/dropzone.d.ts.map +1 -0
  61. package/dist/common/dropzone/dropzone.js +101 -0
  62. package/dist/common/dropzone/dropzone.js.map +1 -0
  63. package/dist/common/form/form.d.ts +11 -0
  64. package/dist/common/form/form.d.ts.map +1 -0
  65. package/dist/common/form/form.js +46 -0
  66. package/dist/common/form/form.js.map +1 -0
  67. package/dist/common/form-page/form-page.d.ts +12 -0
  68. package/dist/common/form-page/form-page.d.ts.map +1 -0
  69. package/dist/common/form-page/form-page.js +18 -0
  70. package/dist/common/form-page/form-page.js.map +1 -0
  71. package/dist/common/grid/column.d.ts +20 -0
  72. package/dist/common/grid/column.d.ts.map +1 -0
  73. package/dist/common/grid/column.js +22 -0
  74. package/dist/common/grid/column.js.map +1 -0
  75. package/dist/common/grid/grid.d.ts +18 -0
  76. package/dist/common/grid/grid.d.ts.map +1 -0
  77. package/dist/common/grid/grid.js +31 -0
  78. package/dist/common/grid/grid.js.map +1 -0
  79. package/dist/common/grid/row.d.ts +22 -0
  80. package/dist/common/grid/row.d.ts.map +1 -0
  81. package/dist/common/grid/row.js +236 -0
  82. package/dist/common/grid/row.js.map +1 -0
  83. package/dist/common/heading/heading.d.ts +9 -0
  84. package/dist/common/heading/heading.d.ts.map +1 -0
  85. package/dist/common/heading/heading.js +14 -0
  86. package/dist/common/heading/heading.js.map +1 -0
  87. package/dist/common/html-raw/html-raw.d.ts +15 -0
  88. package/dist/common/html-raw/html-raw.d.ts.map +1 -0
  89. package/dist/common/html-raw/html-raw.js +22 -0
  90. package/dist/common/html-raw/html-raw.js.map +1 -0
  91. package/dist/common/icon/icon.d.ts +8 -0
  92. package/dist/common/icon/icon.d.ts.map +1 -0
  93. package/dist/common/icon/icon.js +11 -0
  94. package/dist/common/icon/icon.js.map +1 -0
  95. package/dist/common/if/if.d.ts +27 -0
  96. package/dist/common/if/if.d.ts.map +1 -0
  97. package/dist/common/if/if.js +53 -0
  98. package/dist/common/if/if.js.map +1 -0
  99. package/dist/common/image/image.d.ts +15 -0
  100. package/dist/common/image/image.d.ts.map +1 -0
  101. package/dist/common/image/image.js +19 -0
  102. package/dist/common/image/image.js.map +1 -0
  103. package/dist/common/index.d.ts +43 -0
  104. package/dist/common/index.d.ts.map +1 -0
  105. package/dist/common/index.js +41 -0
  106. package/dist/common/index.js.map +1 -0
  107. package/dist/common/input/input.d.ts +20 -0
  108. package/dist/common/input/input.d.ts.map +1 -0
  109. package/dist/common/input/input.js +57 -0
  110. package/dist/common/input/input.js.map +1 -0
  111. package/dist/common/label/label.d.ts +21 -0
  112. package/dist/common/label/label.d.ts.map +1 -0
  113. package/dist/common/label/label.js +30 -0
  114. package/dist/common/label/label.js.map +1 -0
  115. package/dist/common/markdown/markdown.d.ts +17 -0
  116. package/dist/common/markdown/markdown.d.ts.map +1 -0
  117. package/dist/common/markdown/markdown.js +19 -0
  118. package/dist/common/markdown/markdown.js.map +1 -0
  119. package/dist/common/modal/modal.d.ts +15 -0
  120. package/dist/common/modal/modal.d.ts.map +1 -0
  121. package/dist/common/modal/modal.js +19 -0
  122. package/dist/common/modal/modal.js.map +1 -0
  123. package/dist/common/overlay/overlay.d.ts +16 -0
  124. package/dist/common/overlay/overlay.d.ts.map +1 -0
  125. package/dist/common/overlay/overlay.js +31 -0
  126. package/dist/common/overlay/overlay.js.map +1 -0
  127. package/dist/common/paragraph/paragraph.d.ts +9 -0
  128. package/dist/common/paragraph/paragraph.d.ts.map +1 -0
  129. package/dist/common/paragraph/paragraph.js +10 -0
  130. package/dist/common/paragraph/paragraph.js.map +1 -0
  131. package/dist/common/progress-bar/progress-bar.d.ts +17 -0
  132. package/dist/common/progress-bar/progress-bar.d.ts.map +1 -0
  133. package/dist/common/progress-bar/progress-bar.js +23 -0
  134. package/dist/common/progress-bar/progress-bar.js.map +1 -0
  135. package/dist/common/radio-group/radio-group.d.ts +21 -0
  136. package/dist/common/radio-group/radio-group.d.ts.map +1 -0
  137. package/dist/common/radio-group/radio-group.js +30 -0
  138. package/dist/common/radio-group/radio-group.js.map +1 -0
  139. package/dist/common/select/select.d.ts +31 -0
  140. package/dist/common/select/select.d.ts.map +1 -0
  141. package/dist/common/select/select.js +129 -0
  142. package/dist/common/select/select.js.map +1 -0
  143. package/dist/common/slider/slider.d.ts +29 -0
  144. package/dist/common/slider/slider.d.ts.map +1 -0
  145. package/dist/common/slider/slider.js +38 -0
  146. package/dist/common/slider/slider.js.map +1 -0
  147. package/dist/common/spacer/spacer.d.ts +10 -0
  148. package/dist/common/spacer/spacer.d.ts.map +1 -0
  149. package/dist/common/spacer/spacer.js +30 -0
  150. package/dist/common/spacer/spacer.js.map +1 -0
  151. package/dist/common/stack/stack.d.ts +12 -0
  152. package/dist/common/stack/stack.d.ts.map +1 -0
  153. package/dist/common/stack/stack.js +42 -0
  154. package/dist/common/stack/stack.js.map +1 -0
  155. package/dist/common/switch/switch.d.ts +14 -0
  156. package/dist/common/switch/switch.d.ts.map +1 -0
  157. package/dist/common/switch/switch.js +31 -0
  158. package/dist/common/switch/switch.js.map +1 -0
  159. package/dist/common/tabbed-card/tabbed-card.d.ts +24 -0
  160. package/dist/common/tabbed-card/tabbed-card.d.ts.map +1 -0
  161. package/dist/common/tabbed-card/tabbed-card.js +62 -0
  162. package/dist/common/tabbed-card/tabbed-card.js.map +1 -0
  163. package/dist/common/table/cells/adaptive-precision-cell.d.ts +9 -0
  164. package/dist/common/table/cells/adaptive-precision-cell.d.ts.map +1 -0
  165. package/dist/common/table/cells/adaptive-precision-cell.js +30 -0
  166. package/dist/common/table/cells/adaptive-precision-cell.js.map +1 -0
  167. package/dist/common/table/cells/badge-formatter-cell.d.ts +19 -0
  168. package/dist/common/table/cells/badge-formatter-cell.d.ts.map +1 -0
  169. package/dist/common/table/cells/badge-formatter-cell.js +18 -0
  170. package/dist/common/table/cells/badge-formatter-cell.js.map +1 -0
  171. package/dist/common/table/cells/code-cell.d.ts +12 -0
  172. package/dist/common/table/cells/code-cell.d.ts.map +1 -0
  173. package/dist/common/table/cells/code-cell.js +19 -0
  174. package/dist/common/table/cells/code-cell.js.map +1 -0
  175. package/dist/common/table/cells/compare-cell.d.ts +13 -0
  176. package/dist/common/table/cells/compare-cell.d.ts.map +1 -0
  177. package/dist/common/table/cells/compare-cell.js +34 -0
  178. package/dist/common/table/cells/compare-cell.js.map +1 -0
  179. package/dist/common/table/cells/formatted-text-cell.d.ts +9 -0
  180. package/dist/common/table/cells/formatted-text-cell.d.ts.map +1 -0
  181. package/dist/common/table/cells/formatted-text-cell.js +15 -0
  182. package/dist/common/table/cells/formatted-text-cell.js.map +1 -0
  183. package/dist/common/table/cells/index.d.ts +11 -0
  184. package/dist/common/table/cells/index.d.ts.map +1 -0
  185. package/dist/common/table/cells/index.js +11 -0
  186. package/dist/common/table/cells/index.js.map +1 -0
  187. package/dist/common/table/cells/link-cell.d.ts +10 -0
  188. package/dist/common/table/cells/link-cell.d.ts.map +1 -0
  189. package/dist/common/table/cells/link-cell.js +15 -0
  190. package/dist/common/table/cells/link-cell.js.map +1 -0
  191. package/dist/common/table/cells/number-cell.d.ts +11 -0
  192. package/dist/common/table/cells/number-cell.d.ts.map +1 -0
  193. package/dist/common/table/cells/number-cell.js +16 -0
  194. package/dist/common/table/cells/number-cell.js.map +1 -0
  195. package/dist/common/table/cells/number-intl-cell.d.ts +11 -0
  196. package/dist/common/table/cells/number-intl-cell.d.ts.map +1 -0
  197. package/dist/common/table/cells/number-intl-cell.js +16 -0
  198. package/dist/common/table/cells/number-intl-cell.js.map +1 -0
  199. package/dist/common/table/cells/percentage-cell.d.ts +11 -0
  200. package/dist/common/table/cells/percentage-cell.d.ts.map +1 -0
  201. package/dist/common/table/cells/percentage-cell.js +16 -0
  202. package/dist/common/table/cells/percentage-cell.js.map +1 -0
  203. package/dist/common/table/cells/threshold-formatted-cell.d.ts +15 -0
  204. package/dist/common/table/cells/threshold-formatted-cell.d.ts.map +1 -0
  205. package/dist/common/table/cells/threshold-formatted-cell.js +20 -0
  206. package/dist/common/table/cells/threshold-formatted-cell.js.map +1 -0
  207. package/dist/common/table/table.d.ts +60 -0
  208. package/dist/common/table/table.d.ts.map +1 -0
  209. package/dist/common/table/table.js +456 -0
  210. package/dist/common/table/table.js.map +1 -0
  211. package/dist/common/text/text.d.ts +12 -0
  212. package/dist/common/text/text.d.ts.map +1 -0
  213. package/dist/common/text/text.js +23 -0
  214. package/dist/common/text/text.js.map +1 -0
  215. package/dist/common/textarea/textarea.d.ts +19 -0
  216. package/dist/common/textarea/textarea.d.ts.map +1 -0
  217. package/dist/common/textarea/textarea.js +42 -0
  218. package/dist/common/textarea/textarea.js.map +1 -0
  219. package/dist/common/tooltip/tooltip.d.ts +18 -0
  220. package/dist/common/tooltip/tooltip.d.ts.map +1 -0
  221. package/dist/common/tooltip/tooltip.js +18 -0
  222. package/dist/common/tooltip/tooltip.js.map +1 -0
  223. package/dist/common/types.d.ts +26 -0
  224. package/dist/common/types.d.ts.map +1 -0
  225. package/dist/common/types.js +9 -0
  226. package/dist/common/types.js.map +1 -0
  227. package/dist/dara_components-0.4.8-py3-none-any.whl +0 -0
  228. package/dist/graphs/causal-graph-viewer.d.ts +55 -0
  229. package/dist/graphs/causal-graph-viewer.d.ts.map +1 -0
  230. package/dist/graphs/causal-graph-viewer.js +44 -0
  231. package/dist/graphs/causal-graph-viewer.js.map +1 -0
  232. package/dist/graphs/graph-layout.d.ts +65 -0
  233. package/dist/graphs/graph-layout.d.ts.map +1 -0
  234. package/dist/graphs/graph-layout.js +152 -0
  235. package/dist/graphs/graph-layout.js.map +1 -0
  236. package/dist/graphs/index.d.ts +8 -0
  237. package/dist/graphs/index.d.ts.map +1 -0
  238. package/dist/graphs/index.js +6 -0
  239. package/dist/graphs/index.js.map +1 -0
  240. package/dist/graphs/node-hierarchy-builder.d.ts +24 -0
  241. package/dist/graphs/node-hierarchy-builder.d.ts.map +1 -0
  242. package/dist/graphs/node-hierarchy-builder.js +40 -0
  243. package/dist/graphs/node-hierarchy-builder.js.map +1 -0
  244. package/dist/graphs/utils.d.ts +10 -0
  245. package/dist/graphs/utils.d.ts.map +1 -0
  246. package/dist/graphs/utils.js +31 -0
  247. package/dist/graphs/utils.js.map +1 -0
  248. package/dist/graphs/visual-edge-encoder.d.ts +38 -0
  249. package/dist/graphs/visual-edge-encoder.d.ts.map +1 -0
  250. package/dist/graphs/visual-edge-encoder.js +94 -0
  251. package/dist/graphs/visual-edge-encoder.js.map +1 -0
  252. package/dist/index.d.ts +5 -0
  253. package/dist/index.d.ts.map +1 -0
  254. package/dist/index.js +5 -0
  255. package/dist/index.js.map +1 -0
  256. package/dist/plotting/bokeh/bokeh.d.ts +28 -0
  257. package/dist/plotting/bokeh/bokeh.d.ts.map +1 -0
  258. package/dist/plotting/bokeh/bokeh.js +125 -0
  259. package/dist/plotting/bokeh/bokeh.js.map +1 -0
  260. package/dist/plotting/index.d.ts +4 -0
  261. package/dist/plotting/index.d.ts.map +1 -0
  262. package/dist/plotting/index.js +5 -0
  263. package/dist/plotting/index.js.map +1 -0
  264. package/dist/plotting/matplotlib/matplotlib.d.ts +12 -0
  265. package/dist/plotting/matplotlib/matplotlib.d.ts.map +1 -0
  266. package/dist/plotting/matplotlib/matplotlib.js +14 -0
  267. package/dist/plotting/matplotlib/matplotlib.js.map +1 -0
  268. package/dist/plotting/plotly/plotly.d.ts +60 -0
  269. package/dist/plotting/plotly/plotly.d.ts.map +1 -0
  270. package/dist/plotting/plotly/plotly.js +235 -0
  271. package/dist/plotting/plotly/plotly.js.map +1 -0
  272. package/dist/smart/chat/chat.d.ts +16 -0
  273. package/dist/smart/chat/chat.d.ts.map +1 -0
  274. package/dist/smart/chat/chat.js +174 -0
  275. package/dist/smart/chat/chat.js.map +1 -0
  276. package/dist/smart/code-editor.d.ts +12 -0
  277. package/dist/smart/code-editor.d.ts.map +1 -0
  278. package/dist/smart/code-editor.js +15 -0
  279. package/dist/smart/code-editor.js.map +1 -0
  280. package/dist/smart/data-slicer-filter/data-slicer-filter.d.ts +47 -0
  281. package/dist/smart/data-slicer-filter/data-slicer-filter.d.ts.map +1 -0
  282. package/dist/smart/data-slicer-filter/data-slicer-filter.js +124 -0
  283. package/dist/smart/data-slicer-filter/data-slicer-filter.js.map +1 -0
  284. package/dist/smart/filter-status-button/filter-status-button.d.ts +14 -0
  285. package/dist/smart/filter-status-button/filter-status-button.d.ts.map +1 -0
  286. package/dist/smart/filter-status-button/filter-status-button.js +49 -0
  287. package/dist/smart/filter-status-button/filter-status-button.js.map +1 -0
  288. package/dist/smart/hierarchy-selector/hierarchy-selector.d.ts +23 -0
  289. package/dist/smart/hierarchy-selector/hierarchy-selector.d.ts.map +1 -0
  290. package/dist/smart/hierarchy-selector/hierarchy-selector.js +17 -0
  291. package/dist/smart/hierarchy-selector/hierarchy-selector.js.map +1 -0
  292. package/dist/smart/hierarchy-viewer/hierarchy-viewer.d.ts +16 -0
  293. package/dist/smart/hierarchy-viewer/hierarchy-viewer.d.ts.map +1 -0
  294. package/dist/smart/hierarchy-viewer/hierarchy-viewer.js +17 -0
  295. package/dist/smart/hierarchy-viewer/hierarchy-viewer.js.map +1 -0
  296. package/dist/smart/index.d.ts +7 -0
  297. package/dist/smart/index.d.ts.map +1 -0
  298. package/dist/smart/index.js +8 -0
  299. package/dist/smart/index.js.map +1 -0
  300. package/dist/umd/dara.components.umd.js +387222 -0
  301. package/dist/umd/style.css +745 -0
  302. package/package.json +87 -0
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { DynamicComponent, injectCss, useComponentStyles, useVariable, } from '@darajs/core';
3
+ import styled from '@darajs/styled-components';
4
+ const OverlayWrapper = injectCss(styled.div `
5
+ position: absolute;
6
+ z-index: 2000;
7
+ inset: ${(props) => { var _a; return (((_a = props.position) === null || _a === void 0 ? void 0 : _a.includes('top')) ? '0' : null); }}
8
+ ${(props) => { var _a; return (((_a = props.position) === null || _a === void 0 ? void 0 : _a.includes('right')) ? '0' : null); }}
9
+ ${(props) => { var _a; return (((_a = props.position) === null || _a === void 0 ? void 0 : _a.includes('bottom')) ? '0' : null); }}
10
+ ${(props) => { var _a; return (((_a = props.position) === null || _a === void 0 ? void 0 : _a.includes('left')) ? '0' : null); }};
11
+
12
+ display: ${(props) => (props.render ? 'inline-flex' : 'none')};
13
+ flex-direction: column;
14
+
15
+ max-width: 100%;
16
+ max-height: 100%;
17
+ margin: ${(props) => props.margin};
18
+ padding: ${(props) => (props.padding ? props.padding : '1rem')};
19
+ `);
20
+ /**
21
+ * The overlay component accepts a set of children and renders them as an overlay depending on the value of the render flag.
22
+ *
23
+ * @param props the component props
24
+ */
25
+ function Overlay(props) {
26
+ const [styles, css] = useComponentStyles(props);
27
+ const [show] = useVariable(props.show || true);
28
+ return (_jsx(OverlayWrapper, { "$rawCss": css, margin: props.margin, padding: props.padding, position: props.position, render: show, style: styles, children: props.children.map((child, idx) => (_jsx(DynamicComponent, { component: child }, `overlay-${idx}-${child.uid}`))) }));
29
+ }
30
+ export default Overlay;
31
+ //# sourceMappingURL=overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.js","sourceRoot":"","sources":["../../../js/common/overlay/overlay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEH,gBAAgB,EAGhB,SAAS,EACT,kBAAkB,EAClB,WAAW,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAS/C,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAY;;;aAG1C,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,CAAC,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,QAAQ,CAAC,KAAK,CAAC,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,EAAA;UAC5D,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,CAAC,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,QAAQ,CAAC,OAAO,CAAC,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,EAAA;UAC3D,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,CAAC,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,QAAQ,CAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,EAAA;UAC5D,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,CAAC,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,QAAQ,CAAC,MAAM,CAAC,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,EAAA;;eAErD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;;;;;cAKnD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM;eACtB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;CACjE,CAAC,CAAC;AAgBH;;;;GAIG;AACH,SAAS,OAAO,CAAC,KAAmB;IAChC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;IAC/C,OAAO,CACH,KAAC,cAAc,eACF,GAAG,EACZ,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,MAAM,YAEZ,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,KAAC,gBAAgB,IAAC,SAAS,EAAE,KAAK,IAAO,WAAW,GAAG,IAAI,KAAK,CAAC,GAAG,EAAE,CAAI,CAC7E,CAAC,GACW,CACpB,CAAC;AACN,CAAC;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ComponentInstance, StyledComponentProps } from '@darajs/core';
2
+ interface ParagraphProps extends StyledComponentProps {
3
+ align: 'start' | 'end' | 'left' | 'right' | 'center' | 'justify' | 'match-parent';
4
+ children: Array<ComponentInstance>;
5
+ className: string;
6
+ }
7
+ declare function Paragraph(props: ParagraphProps): JSX.Element;
8
+ export default Paragraph;
9
+ //# sourceMappingURL=paragraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../js/common/paragraph/paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,EAGjB,oBAAoB,EAGvB,MAAM,cAAc,CAAC;AAItB,UAAU,cAAe,SAAQ,oBAAoB;IACjD,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,cAAc,CAAC;IAClF,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;CACrB;AAID,iBAAS,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CAWrD;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { DisplayCtx, DynamicComponent, injectCss, useComponentStyles, } from '@darajs/core';
3
+ import { ComponentType } from '../constants';
4
+ const StyledP = injectCss('p');
5
+ function Paragraph(props) {
6
+ const [style, css] = useComponentStyles(props);
7
+ return (_jsx(StyledP, { "$rawCss": css, className: props.className, style: Object.assign({ textAlign: props.align }, style), children: _jsx(DisplayCtx.Provider, { value: { component: ComponentType.PARAGRAPH, direction: 'horizontal' }, children: props.children.map((child, idx) => (_jsx(DynamicComponent, { component: child }, `stack-${idx}-${child.name}`))) }) }));
8
+ }
9
+ export default Paragraph;
10
+ //# sourceMappingURL=paragraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paragraph.js","sourceRoot":"","sources":["../../../js/common/paragraph/paragraph.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEH,UAAU,EACV,gBAAgB,EAEhB,SAAS,EACT,kBAAkB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAQ7C,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;AAE/B,SAAS,SAAS,CAAC,KAAqB;IACpC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,CACH,KAAC,OAAO,eAAU,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,kBAAI,SAAS,EAAE,KAAK,CAAC,KAAK,IAAK,KAAK,aACxF,KAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,YACtF,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,KAAC,gBAAgB,IAAC,SAAS,EAAE,KAAK,IAAO,SAAS,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,CAAI,CAC5E,CAAC,GACgB,GAChB,CACb,CAAC;AACN,CAAC;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { StyledComponentProps, Variable } from '@darajs/core';
2
+ interface ProgressBarProps extends StyledComponentProps {
3
+ /** Optional color prop for the progress bar, should be a hex code */
4
+ color?: string;
5
+ /** The current progress as a percentage */
6
+ progress: number | Variable<number>;
7
+ /** Set the progress bar to view as a smaller strip with no label */
8
+ small?: boolean;
9
+ }
10
+ /**
11
+ * A simple progress bar component, that displays the current progress to 100% as a bar with a small label
12
+ *
13
+ * @param props the component props
14
+ */
15
+ declare function ProgressBar(props: ProgressBarProps): JSX.Element;
16
+ export default ProgressBar;
17
+ //# sourceMappingURL=progress-bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-bar.d.ts","sourceRoot":"","sources":["../../../js/common/progress-bar/progress-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAA8C,MAAM,cAAc,CAAC;AAY1G,UAAU,gBAAiB,SAAQ,oBAAoB;IACnD,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpC,oEAAoE;IACpE,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAQzD;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { injectCss, useComponentStyles, useVariable } from '@darajs/core';
3
+ import styled from '@darajs/styled-components';
4
+ import { ProgressBar as UiProgressBar } from '@darajs/ui-components';
5
+ const ProgressBarWrapper = styled.div `
6
+ display: flex;
7
+ align-items: center;
8
+ width: 100%;
9
+ height: 100%;
10
+ `;
11
+ const StyledProgressBar = injectCss(ProgressBarWrapper);
12
+ /**
13
+ * A simple progress bar component, that displays the current progress to 100% as a bar with a small label
14
+ *
15
+ * @param props the component props
16
+ */
17
+ function ProgressBar(props) {
18
+ const [style, css] = useComponentStyles(props);
19
+ const [progress] = useVariable(props.progress);
20
+ return (_jsx(StyledProgressBar, { "$rawCss": css, style: style, children: _jsx(UiProgressBar, { color: props.color, progress: progress, small: props.small }) }));
21
+ }
22
+ export default ProgressBar;
23
+ //# sourceMappingURL=progress-bar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-bar.js","sourceRoot":"","sources":["../../../js/common/progress-bar/progress-bar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkC,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1G,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAErE,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAKpC,CAAC;AACF,MAAM,iBAAiB,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAAC;AAWxD;;;;GAIG;AACH,SAAS,WAAW,CAAC,KAAuB;IACxC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/C,OAAO,CACH,KAAC,iBAAiB,eAAU,GAAG,EAAE,KAAK,EAAE,KAAK,YACzC,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,GAC7D,CACvB,CAAC;AACN,CAAC;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Variable } from '@darajs/core';
2
+ import { Item } from '@darajs/ui-components';
3
+ import { FormComponentProps } from '../types';
4
+ interface RadioGroupProps extends FormComponentProps {
5
+ /** Pass through the className property */
6
+ className: string;
7
+ /** An optional value which determines the direction of the radio group components by default is vertical */
8
+ direction?: 'horizontal' | 'vertical';
9
+ /** The list of items to choose from */
10
+ items: Array<Item> | Variable<Item[]>;
11
+ /** Whether to show radio in list style */
12
+ list_styling?: boolean;
13
+ }
14
+ /**
15
+ * The RadioGroup component allows users to choose from a list of radio buttons.
16
+ *
17
+ * @param props the component props
18
+ */
19
+ declare function RadioGroup(props: RadioGroupProps): JSX.Element;
20
+ export default RadioGroup;
21
+ //# sourceMappingURL=radio-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../js/common/radio-group/radio-group.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAyD,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAyB,MAAM,uBAAuB,CAAC;AAGpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C,UAAU,eAAgB,SAAQ,kBAAkB;IAChD,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,4GAA4G;IAC5G,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,uCAAuC;IACvC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACtC,0CAA0C;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAID;;;;GAIG;AACH,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CA4BvD;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /* eslint-disable react-hooks/exhaustive-deps */
3
+ import { useCallback } from 'react';
4
+ import { injectCss, useAction, useComponentStyles, useVariable } from '@darajs/core';
5
+ import { RadioGroup as UiRadio } from '@darajs/ui-components';
6
+ import { useFormContext } from '../context';
7
+ const StyledRadio = injectCss(UiRadio);
8
+ // Disabling rules-of-hook as the assumption is that props changing the type of the select won't change
9
+ /* eslint-disable react-hooks/rules-of-hooks */
10
+ /**
11
+ * The RadioGroup component allows users to choose from a list of radio buttons.
12
+ *
13
+ * @param props the component props
14
+ */
15
+ function RadioGroup(props) {
16
+ var _a;
17
+ const formCtx = useFormContext(props);
18
+ const [items] = useVariable(props.items);
19
+ const [value, setValue] = useVariable(formCtx.resolveInitialValue([]));
20
+ const [style, css] = useComponentStyles(props);
21
+ const onChangeAction = useAction(props.onchange);
22
+ const onChange = useCallback((values) => {
23
+ setValue(values.value);
24
+ onChangeAction(values.value);
25
+ formCtx.updateForm(values.value);
26
+ }, [setValue]);
27
+ return (_jsx(StyledRadio, { "$rawCss": css, className: props.className, direction: props.direction, isListStyle: props.list_styling, items: items, onChange: onChange, style: style, value: (_a = items.find((item) => item.value === value)) !== null && _a !== void 0 ? _a : null }));
28
+ }
29
+ export default RadioGroup;
30
+ //# sourceMappingURL=radio-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio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EAC1B,WAAW,EAAE,KAAK,CAAC,YAAY,EAC/B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,MAAA,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,mCAAI,IAAI,GAC3D,CACL,CAAC;AACN,CAAC;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { SingleVariable, UrlVariable, Variable } from '@darajs/core';
2
+ import { Item, ListSection } from '@darajs/ui-components';
3
+ import { FormComponentProps } from '../types';
4
+ export declare function getMultiselectItems(values: Array<unknown>, items: Array<Item>): Array<Item>;
5
+ interface SelectProps extends FormComponentProps {
6
+ /** Pass through the className property */
7
+ className: string;
8
+ /** The list of items to choose from */
9
+ items: Array<Item> | Variable<Item[]> | Array<ListSection> | Variable<Array<ListSection>>;
10
+ /** Optional number of rows to display in multiselect mode */
11
+ max_rows?: number;
12
+ /** Select multiple list items if True */
13
+ multiselect: boolean;
14
+ /** Placeholder to show when select is empty */
15
+ placeholder?: string;
16
+ /** Searchable list if True */
17
+ searchable: boolean;
18
+ /** The selectedItem variable to read and update */
19
+ value?: SingleVariable<any> | UrlVariable<any>;
20
+ }
21
+ /**
22
+ * The select component accepts a value Variable from the backend and allows the user to view and edit that variable
23
+ * from a selection of items provided in another prop. The value shared with the rest of the system is the value field
24
+ * from the currently selected item. Also takes a multiselect and searchable options that, respectively, enable multiple
25
+ * items to be selected and the list to be searchable if true.
26
+ *
27
+ * @param props the component props
28
+ */
29
+ declare function Select(props: SelectProps): JSX.Element;
30
+ export default Select;
31
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../js/common/select/select.tsx"],"names":[],"mappings":"AAIA,OAAO,EACH,cAAc,EACd,WAAW,EACX,QAAQ,EAKX,MAAM,cAAc,CAAC;AACtB,OAAO,EAEH,IAAI,EAEJ,WAAW,EAId,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAW3F;AAmBD,UAAU,WAAY,SAAQ,kBAAkB;IAC5C,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1F,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,WAAW,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,mDAAmD;IAEnD,KAAK,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;CAClD;AAID;;;;;;;GAOG;AACH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAuJ/C;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,129 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /* eslint-disable react-hooks/exhaustive-deps */
3
+ import { isArray, isEmpty, isEqual } from 'lodash';
4
+ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
5
+ import { injectCss, useAction, useComponentStyles, useVariable, } from '@darajs/core';
6
+ import { ComboBox, MultiSelect, SectionedList, Select as UiSelect, } from '@darajs/ui-components';
7
+ import { useFormContext } from '../context';
8
+ export function getMultiselectItems(values, items) {
9
+ if (!values) {
10
+ return;
11
+ }
12
+ return items.reduce((acc, item) => {
13
+ const stringOfValues = values.map((value) => String(value));
14
+ if (stringOfValues.includes(String(item.value))) {
15
+ return [...acc, item];
16
+ }
17
+ return acc;
18
+ }, []);
19
+ }
20
+ const StyledSelect = injectCss(UiSelect);
21
+ const StyledMultiSelect = injectCss(MultiSelect);
22
+ const StyledComboBox = injectCss(ComboBox);
23
+ const StyledSectionedList = injectCss(SectionedList);
24
+ function hasListSection(items) {
25
+ return items.length > 0 && 'items' in items[0];
26
+ }
27
+ function isStringArray(value) {
28
+ return Array.isArray(value) && value.every((item) => typeof item === 'string');
29
+ }
30
+ /** Type guard to check if an object is an Item */
31
+ function isItem(obj) {
32
+ return obj && Object.prototype.hasOwnProperty.call(obj, 'value');
33
+ }
34
+ // Disabling rules-of-hook as the assumption is that props changing the type of the select won't change
35
+ /* eslint-disable react-hooks/rules-of-hooks */
36
+ /**
37
+ * The select component accepts a value Variable from the backend and allows the user to view and edit that variable
38
+ * from a selection of items provided in another prop. The value shared with the rest of the system is the value field
39
+ * from the currently selected item. Also takes a multiselect and searchable options that, respectively, enable multiple
40
+ * items to be selected and the list to be searchable if true.
41
+ *
42
+ * @param props the component props
43
+ */
44
+ function Select(props) {
45
+ const formCtx = useFormContext(props);
46
+ const [items] = useVariable(props.items);
47
+ const [style, css] = useComponentStyles(props);
48
+ const [value, setValue] = useVariable(formCtx.resolveInitialValue());
49
+ // Some combination of recoil state changes and downshift can cause an infinite loop when selecting a new value
50
+ // This prevents infinite rerenders by always using the latest value
51
+ const valueRef = useRef(value);
52
+ useLayoutEffect(() => {
53
+ valueRef.current = value;
54
+ }, [value]);
55
+ // In the case of a Variable or DerivedVariable we could end up with an array of strings instead of items, so we need to convert them if that happens
56
+ const formattedItems = useMemo(() => {
57
+ if (isStringArray(items)) {
58
+ return items.map((item) => ({ badge: null, image: null, label: item, value: item }));
59
+ }
60
+ return items;
61
+ }, [items]);
62
+ /**
63
+ * Converts a value to an Item, or finds a matching Item in formattedItems based on value.
64
+ * @param val - The value to be converted or matched.
65
+ */
66
+ const toItem = (val) => {
67
+ // Tries to get matching item based on value from formattedItems
68
+ const matchingItem = formattedItems.find((item) => isItem(item) && String(item.value) === String(val));
69
+ // If a matching Item is found return it
70
+ if (matchingItem) {
71
+ return matchingItem;
72
+ }
73
+ // Otherwise return the item as an Item type with the value as the label, so that select can still show a value even if not present in the list
74
+ return typeof val === 'string' || typeof val === 'number' ? { label: String(val), value } : val;
75
+ };
76
+ const onChangeAction = useAction(props.onchange);
77
+ // if someone were to update the component rule of Hooks could be broken if items switched from having sections to not, so we use a ref for this to be only run once
78
+ const itemHasListSection = useRef(null);
79
+ if (itemHasListSection.current === null) {
80
+ itemHasListSection.current = hasListSection(formattedItems);
81
+ }
82
+ // For multiselect we want to keep the initial value type consistent with later selections
83
+ useEffect(() => {
84
+ if (props.multiselect && value !== undefined && !Array.isArray(value)) {
85
+ throw new Error('Value for multiselect should be a Variable instance of an array');
86
+ }
87
+ }, []);
88
+ if (itemHasListSection.current) {
89
+ const onSelect = useCallback((item) => {
90
+ if (item && item.value !== valueRef.current) {
91
+ setValue(item.value);
92
+ }
93
+ }, [setValue]);
94
+ const selectedItem = useMemo(() => toItem(value), [value]);
95
+ return (_jsx(StyledSectionedList, { "$rawCss": css, items: formattedItems, onSelect: onSelect, selectedItem: selectedItem, style: style }));
96
+ }
97
+ // We need to redefine items as the type is not known at this point
98
+ const itemArray = formattedItems;
99
+ if (props.multiselect) {
100
+ const onSelect = useCallback((_items) => {
101
+ const currentSelection = _items.map((item) => item.value);
102
+ if (!isEqual(currentSelection, isArray(valueRef.current) ? valueRef.current : [valueRef.current])) {
103
+ setValue(currentSelection);
104
+ onChangeAction(currentSelection);
105
+ formCtx.updateForm(currentSelection);
106
+ }
107
+ }, [setValue]);
108
+ const selectedItems = useMemo(() => {
109
+ const found = getMultiselectItems(value, itemArray);
110
+ const explicitValues = isArray(value) ? value.map(toItem) : value;
111
+ return isEmpty(found) ? explicitValues !== null && explicitValues !== void 0 ? explicitValues : null : found;
112
+ }, [formattedItems, value]);
113
+ return (_jsx(StyledMultiSelect, { "$rawCss": css, className: props.className, items: itemArray, maxRows: props.max_rows, onSelect: onSelect, placeholder: props.placeholder, selectedItems: selectedItems, style: style }));
114
+ }
115
+ const selectedItem = useMemo(() => { var _a, _b; return (_b = (_a = itemArray.find((item) => String(item.value) === String(value))) !== null && _a !== void 0 ? _a : toItem(value)) !== null && _b !== void 0 ? _b : null; }, [value]);
116
+ const onSelect = useCallback((item) => {
117
+ if (item && item.value !== valueRef.current) {
118
+ setValue(item.value);
119
+ onChangeAction(item.value);
120
+ formCtx.updateForm(item.value);
121
+ }
122
+ }, [setValue, onChangeAction]);
123
+ if (props.searchable) {
124
+ return (_jsx(StyledComboBox, { "$rawCss": css, className: props.className, items: itemArray, onSelect: onSelect, placeholder: props.placeholder, selectedItem: selectedItem, style: style }));
125
+ }
126
+ return (_jsx(StyledSelect, { "$rawCss": css, className: props.className, items: itemArray, onSelect: onSelect, placeholder: props.placeholder, selectedItem: selectedItem, style: style }));
127
+ }
128
+ export default Select;
129
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../js/common/select/select.tsx"],"names":[],"mappings":";AAAA,gDAAgD;AAChD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAIH,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,WAAW,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,QAAQ,EAIR,WAAW,EACX,aAAa,EACb,MAAM,IAAI,QAAQ,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,cA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AAE,YAAY,EAC1B,KAAK,EAAE,KAAK,GACd,CACL,CAAC;IACN,CAAC;IAED,OAAO,CACH,KAAC,YAAY,eACA,GAAG,EACZ,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,GACd,CACL,CAAC;AACN,CAAC;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { Variable } from '@darajs/core';
2
+ import { FormComponentProps } from '../types';
3
+ interface SliderProps extends FormComponentProps {
4
+ /** An optional flag to disable the input alternative switch render, its false by default */
5
+ disable_input_alternative?: boolean;
6
+ /** The range of the slider */
7
+ domain: [number, number];
8
+ /** Draw track from leftmost handle to start */
9
+ rail_from_start?: boolean;
10
+ /** Track labels */
11
+ rail_labels?: Array<string>;
12
+ /** Draw track from rightmost handle to end */
13
+ rail_to_end: boolean;
14
+ /** Slider step size */
15
+ step?: number;
16
+ /** Slider tick positions */
17
+ ticks?: Array<number>;
18
+ /** Slider handle values - interactive */
19
+ value?: Variable<Array<number> | number>;
20
+ }
21
+ /**
22
+ * A component for rendering a slider bar with handles. This component is interactive, so the value of each handle
23
+ * is updated when they are moved.
24
+ *
25
+ * @param props - the component props
26
+ */
27
+ declare function Slider(props: SliderProps): JSX.Element;
28
+ export default Slider;
29
+ //# sourceMappingURL=slider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../js/common/slider/slider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAyD,MAAM,cAAc,CAAC;AAI/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAY,SAAQ,kBAAkB;IAC5C,4FAA4F;IAC5F,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,8BAA8B;IAC9B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,+CAA+C;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,8CAA8C;IAC9C,WAAW,EAAE,OAAO,CAAC;IACrB,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,yCAAyC;IAEzC,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;CAC5C;AAID;;;;;GAKG;AACH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CA2C/C;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import _debounce from 'lodash/debounce';
3
+ import { useMemo } from 'react';
4
+ import { injectCss, useAction, useComponentStyles, useVariable } from '@darajs/core';
5
+ import { Slider as UISlider } from '@darajs/ui-components';
6
+ import { useFormContext } from '../context';
7
+ const StyledSlider = injectCss(UISlider);
8
+ /**
9
+ * A component for rendering a slider bar with handles. This component is interactive, so the value of each handle
10
+ * is updated when they are moved.
11
+ *
12
+ * @param props - the component props
13
+ */
14
+ function Slider(props) {
15
+ const formCtx = useFormContext(props);
16
+ const [style, css] = useComponentStyles(props);
17
+ const [value, setValue] = useVariable(formCtx.resolveInitialValue(props.domain[0]));
18
+ const onTrack = useAction(props.onchange);
19
+ const debouncedSetValue = useMemo(() => _debounce(setValue, 300), [setValue]);
20
+ const debouncedOnTrack = useMemo(() => _debounce(onTrack, 300), [onTrack]);
21
+ const debouncedUpdateForm = useMemo(() => _debounce(formCtx.updateForm, 300), [formCtx.updateForm]);
22
+ const isOutputNumber = typeof value === 'number';
23
+ function onChange(values) {
24
+ let serialisedValues = values;
25
+ // if we're supposed to output a number, unwrap the array
26
+ if (isOutputNumber) {
27
+ [serialisedValues] = values;
28
+ }
29
+ debouncedSetValue(serialisedValues);
30
+ debouncedOnTrack === null || debouncedOnTrack === void 0 ? void 0 : debouncedOnTrack(serialisedValues);
31
+ debouncedUpdateForm(serialisedValues);
32
+ }
33
+ // Values passed to the UI component must always be an array
34
+ const parsedValues = isOutputNumber ? [value] : value;
35
+ return (_jsx(StyledSlider, { "$rawCss": css, disableInputAlternative: props.disable_input_alternative, domain: props.domain, onChange: onChange, step: props.step, style: style, ticks: props.ticks, trackLabels: props.rail_labels, trackToEnd: props.rail_to_end, trackToStart: props.rail_from_start, values: parsedValues }));
36
+ }
37
+ export default Slider;
38
+ //# sourceMappingURL=slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../js/common/slider/slider.tsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAY,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAuB5C,MAAM,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEzC;;;;;GAKG;AACH,SAAS,MAAM,CAAC,KAAkB;IAC9B,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,C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,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,UAAU,EAAE,KAAK,CAAC,WAAW,EAC7B,YAAY,EAAE,KAAK,CAAC,eAAe,EACnC,MAAM,EAAE,YAAY,GACtB,CACL,CAAC;AACN,CAAC;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { StyledComponentProps } from '@darajs/core';
2
+ interface SpacerProps extends StyledComponentProps {
3
+ className: string;
4
+ inset: string;
5
+ line: boolean;
6
+ size: string;
7
+ }
8
+ declare function Spacer(props: SpacerProps): JSX.Element;
9
+ export default Spacer;
10
+ //# sourceMappingURL=spacer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spacer.d.ts","sourceRoot":"","sources":["../../../js/common/spacer/spacer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,oBAAoB,EAAiC,MAAM,cAAc,CAAC;AAG/F,UAAU,WAAY,SAAQ,oBAAoB;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB;AAiCD,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAS/C;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useContext } from 'react';
3
+ import { DisplayCtx, injectCss, useComponentStyles } from '@darajs/core';
4
+ import styled from '@darajs/styled-components';
5
+ const StyledLine = styled.div `
6
+ flex: 0 0 auto;
7
+
8
+ width: ${(p) => (p.isHStack ? '1px' : `calc(100% - 2*${p.inset})`)};
9
+ height: ${(p) => (p.isHStack ? `calc(100% - 2*${p.inset})` : '1px')};
10
+ margin: ${(p) => (p.isHStack ? `${p.inset} 0` : `0 ${p.inset}`)};
11
+
12
+ background-color: ${(p) => p.theme.colors.grey3};
13
+ `;
14
+ const _StyledSpacer = styled.div `
15
+ display: flex;
16
+ flex: 0 0 auto !important;
17
+ align-items: center;
18
+
19
+ ${(p) => p.isHStack && 'flex-direction: column; align-self: stretch'};
20
+ ${(p) => (p.isHStack ? `width: ${p.size}` : `height:${p.size}`)};
21
+ `;
22
+ const StyledSpacer = injectCss(_StyledSpacer);
23
+ function Spacer(props) {
24
+ const [style, css] = useComponentStyles(props);
25
+ const displayCtx = useContext(DisplayCtx);
26
+ const isHStack = displayCtx.direction === 'horizontal';
27
+ return (_jsx(StyledSpacer, { "$rawCss": css, className: props.className, isHStack: isHStack, size: props.size, style: style, children: props.line && _jsx(StyledLine, { inset: props.inset, isHStack: isHStack }) }));
28
+ }
29
+ export default Spacer;
30
+ //# sourceMappingURL=spacer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spacer.js","sourceRoot":"","sources":["../../../js/common/spacer/spacer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,UAAU,EAAwB,SAAS,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAc/C,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAiB;;;aAGjC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,KAAK,GAAG,CAAC;cACxD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;cACzD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;;wBAE3C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;CAClD,CAAC;AAQF,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAoB;;;;;MAK9C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,6CAA6C;MAClE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;CAClE,CAAC;AACF,MAAM,YAAY,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC;AAE9C,SAAS,MAAM,CAAC,KAAkB;IAC9B,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,KAAK,YAAY,CAAC;IACvD,OAAO,CACH,KAAC,YAAY,eAAU,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,YACrG,KAAK,CAAC,IAAI,IAAI,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI,GAC1D,CAClB,CAAC;AACN,CAAC;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { ComponentInstance, LayoutComponentProps, Variable } from '@darajs/core';
2
+ interface StackProps extends LayoutComponentProps {
3
+ children: Array<ComponentInstance>;
4
+ className: string;
5
+ collapsed: Variable<boolean>;
6
+ direction: 'horizontal' | 'vertical';
7
+ hug?: boolean;
8
+ scroll: boolean;
9
+ }
10
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<StackProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
11
+ export default _default;
12
+ //# sourceMappingURL=stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../js/common/stack/stack.tsx"],"names":[],"mappings":"AAGA,OAAO,EACH,iBAAiB,EAGjB,oBAAoB,EACpB,QAAQ,EAIX,MAAM,cAAc,CAAC;AAKtB,UAAU,UAAW,SAAQ,oBAAoB;IAC7C,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC7B,SAAS,EAAE,YAAY,GAAG,UAAU,CAAC;IACrC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACnB;;AAqED,wBAAiC"}
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import AutoSizer from 'react-virtualized-auto-sizer';
4
+ import { DisplayCtx, DynamicComponent, injectCss, useComponentStyles, useVariable, } from '@darajs/core';
5
+ import styled from '@darajs/styled-components';
6
+ function getCollapseStyles(collapsed) {
7
+ if (collapsed) {
8
+ return {
9
+ display: 'none',
10
+ };
11
+ }
12
+ return {};
13
+ }
14
+ const StyledStack = injectCss(styled.div `
15
+ display: flex;
16
+ flex: 1 1 100%;
17
+ flex-direction: ${(props) => (props.direction === 'horizontal' ? 'row' : 'column')};
18
+ gap: 0.75rem;
19
+
20
+ width: ${(props) => (props.direction === 'horizontal' ? undefined : '100%')};
21
+ height: ${(props) => (props.direction === 'horizontal' ? '100%' : undefined)};
22
+ `);
23
+ function Stack(props, ref) {
24
+ const [collapsed] = useVariable(props.collapsed);
25
+ const [style, css] = useComponentStyles(props);
26
+ const stackContent = (_jsx(DisplayCtx.Provider, { value: { component: 'stack', direction: props.direction }, children: props.children.map((child, idx) => (_jsx(DynamicComponent, { component: child }, `stack-${idx}-${child.uid}`))) }));
27
+ return (_jsx(StyledStack, { "$rawCss": css, className: props.className, "data-type": "children-wrapper", direction: props.direction, ref: ref, style: Object.assign(Object.assign({ alignItems: props.align, justifyContent: props.justify }, getCollapseStyles(collapsed)), style), children: props.scroll ?
28
+ _jsx(AutoSizer, { children: ({ height, width }) => {
29
+ var _a;
30
+ return (_jsx("div", { style: {
31
+ display: 'flex',
32
+ flexDirection: props.direction === 'horizontal' ? 'row' : 'column',
33
+ gap: (_a = style.gap) !== null && _a !== void 0 ? _a : '0.75rem',
34
+ height,
35
+ overflow: 'auto',
36
+ width,
37
+ }, children: stackContent }));
38
+ } })
39
+ : stackContent }));
40
+ }
41
+ export default forwardRef(Stack);
42
+ //# sourceMappingURL=stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../js/common/stack/stack.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAgB,UAAU,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,SAAS,MAAM,8BAA8B,CAAC;AAErD,OAAO,EAEH,UAAU,EACV,gBAAgB,EAGhB,SAAS,EACT,kBAAkB,EAClB,WAAW,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAa/C,SAAS,iBAAiB,CAAC,SAAkB;IACzC,IAAI,SAAS,EAAE,CAAC;QACZ,OAAO;YACH,OAAO,EAAE,MAAM;SAClB,CAAC;IACN,CAAC;IACD,OAAO,EAAE,CAAC;AACd,CAAC;AAED,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAY;;;sBAG9B,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;;;aAGzE,CAAC,KAAK,EAAE,EAA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BACH,OAAO,EAAE,MAAM;4BACf,aAAa,EAAE,KAAK,CAAC,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;4BAClE,GAAG,EAAE,MAAA,KAAK,CAAC,GAAG,mCAAI,SAAS;4BAC3B,MAAM;4BACN,QAAQ,EAAE,MAAM;4BAChB,KAAK;yBACR,YAEA,YAAY,GACX,CACT,CAAA;iBAAA,GACO;YAChB,CAAC,CAAG,YAAY,GACN,CACjB,CAAC;AACN,CAAC;AAED,eAAe,UAAU,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Variable } from '@darajs/core';
2
+ import { FormComponentProps } from '../types';
3
+ interface SwitchProps extends FormComponentProps {
4
+ /** Switch position - interactive */
5
+ value?: Variable<boolean>;
6
+ }
7
+ /**
8
+ * A component for rendering a switch. Takes an optional label that will be rendered to its left.
9
+ *
10
+ * @param props - the component props
11
+ */
12
+ declare function Switch(props: SwitchProps): JSX.Element;
13
+ export default Switch;
14
+ //# sourceMappingURL=switch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../js/common/switch/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAyD,MAAM,cAAc,CAAC;AAK/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAU9C,UAAU,WAAY,SAAQ,kBAAkB;IAC5C,oCAAoC;IAEpC,KAAK,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;CAC7B;AACD;;;;GAIG;AACH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAiB/C;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { injectCss, useAction, useComponentStyles, useVariable } from '@darajs/core';
3
+ import styled from '@darajs/styled-components';
4
+ import { Switch as UISwitch } from '@darajs/ui-components';
5
+ import { useFormContext } from '../context';
6
+ const _SwitchDiv = styled.div `
7
+ display: flex;
8
+ flex-direction: row;
9
+ align-items: center;
10
+ margin: 0.5rem 0;
11
+ `;
12
+ const SwitchDiv = injectCss(_SwitchDiv);
13
+ /**
14
+ * A component for rendering a switch. Takes an optional label that will be rendered to its left.
15
+ *
16
+ * @param props - the component props
17
+ */
18
+ function Switch(props) {
19
+ const formCtx = useFormContext(props);
20
+ const [style, css] = useComponentStyles(props);
21
+ const [value, setValue] = useVariable(formCtx.resolveInitialValue());
22
+ const onChangeAction = useAction(props.onchange);
23
+ function onChange(enabled) {
24
+ setValue(enabled);
25
+ onChangeAction(enabled);
26
+ formCtx.updateForm(enabled);
27
+ }
28
+ return (_jsx(SwitchDiv, { "$rawCss": css, style: style, children: _jsx(UISwitch, { onChange: onChange, value: value }) }));
29
+ }
30
+ export default Switch;
31
+ //# sourceMappingURL=switch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../js/common/switch/switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAY,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAK5B,CAAC;AACF,MAAM,SAAS,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AAOxC;;;;GAIG;AACH,SAAS,MAAM,CAAC,KAAkB;IAC9B,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IACrE,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAEjD,SAAS,QAAQ,CAAC,OAAgB;QAC9B,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClB,cAAc,CAAC,OAAO,CAAC,CAAC;QACxB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,CACH,KAAC,SAAS,eAAU,GAAG,EAAE,KAAK,EAAE,KAAK,YACjC,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAI,GACtC,CACf,CAAC;AACN,CAAC;AAED,eAAe,MAAM,CAAC"}