@limetech/lime-elements 38.31.1 → 38.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/lime-elements.cjs.js +1 -1
  4. package/dist/cjs/limel-action-bar_2.cjs.entry.js +1 -1
  5. package/dist/cjs/limel-ai-avatar.cjs.entry.js +1 -1
  6. package/dist/cjs/limel-callout.cjs.entry.js +1 -1
  7. package/dist/cjs/limel-chart.cjs.entry.js +1 -1
  8. package/dist/cjs/limel-checkbox.cjs.entry.js.map +1 -1
  9. package/dist/cjs/limel-chip_2.cjs.entry.js +1 -1
  10. package/dist/cjs/limel-collapsible-section.cjs.entry.js +1 -1
  11. package/dist/cjs/limel-color-picker.cjs.entry.js.map +1 -1
  12. package/dist/cjs/limel-drag-handle.cjs.entry.js +34 -0
  13. package/dist/cjs/limel-drag-handle.cjs.entry.js.map +1 -0
  14. package/dist/cjs/limel-file-viewer.cjs.entry.js +1 -1
  15. package/dist/cjs/limel-file.cjs.entry.js +1 -1
  16. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
  17. package/dist/cjs/limel-form.cjs.entry.js +3227 -307
  18. package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
  19. package/dist/cjs/limel-info-tile.cjs.entry.js +1 -1
  20. package/dist/cjs/limel-info-tile.cjs.entry.js.map +1 -1
  21. package/dist/cjs/limel-linear-progress.cjs.entry.js +1 -1
  22. package/dist/cjs/limel-list-item.cjs.entry.js +1 -1
  23. package/dist/cjs/limel-portal_3.cjs.entry.js.map +1 -1
  24. package/dist/cjs/limel-profile-picture.cjs.entry.js +1 -1
  25. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
  26. package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
  27. package/dist/cjs/limel-snackbar.cjs.entry.js.map +1 -1
  28. package/dist/cjs/limel-switch.cjs.entry.js.map +1 -1
  29. package/dist/cjs/limel-table.cjs.entry.js +1 -1
  30. package/dist/cjs/loader.cjs.js +1 -1
  31. package/dist/cjs/{translations-d2be6dd7.js → translations-a42886f2.js} +17 -1
  32. package/dist/cjs/translations-a42886f2.js.map +1 -0
  33. package/dist/collection/collection-manifest.json +1 -0
  34. package/dist/collection/components/action-bar/action-bar-item/action-bar-item.css +3 -0
  35. package/dist/collection/components/action-bar/action-bar.css +3 -0
  36. package/dist/collection/components/badge/badge.css +3 -0
  37. package/dist/collection/components/breadcrumbs/breadcrumbs.css +3 -0
  38. package/dist/collection/components/button/button.css +3 -0
  39. package/dist/collection/components/button-group/button-group.css +3 -0
  40. package/dist/collection/components/card/card.css +3 -0
  41. package/dist/collection/components/chart/chart.css +6 -0
  42. package/dist/collection/components/checkbox/checkbox.css +3 -0
  43. package/dist/collection/components/checkbox/checkbox.js +1 -1
  44. package/dist/collection/components/checkbox/checkbox.js.map +1 -1
  45. package/dist/collection/components/chip/chip.css +3 -0
  46. package/dist/collection/components/chip-set/chip-set.css +6 -0
  47. package/dist/collection/components/circular-progress/circular-progress.css +3 -0
  48. package/dist/collection/components/code-editor/code-editor.css +3 -0
  49. package/dist/collection/components/collapsible-section/collapsible-section.css +3 -0
  50. package/dist/collection/components/color-picker/color-picker-palette.css +3 -0
  51. package/dist/collection/components/color-picker/color-picker.css +3 -0
  52. package/dist/collection/components/color-picker/color-picker.js +1 -1
  53. package/dist/collection/components/color-picker/color-picker.js.map +1 -1
  54. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.css +3 -0
  55. package/dist/collection/components/dialog/dialog.css +3 -0
  56. package/dist/collection/components/dock/dock-button/dock-button.css +3 -0
  57. package/dist/collection/components/dock/dock.css +3 -0
  58. package/dist/collection/components/drag-handle/drag-handle.css +174 -0
  59. package/dist/collection/components/drag-handle/drag-handle.js +125 -0
  60. package/dist/collection/components/drag-handle/drag-handle.js.map +1 -0
  61. package/dist/collection/components/file/file.css +3 -0
  62. package/dist/collection/components/file-viewer/file-viewer.css +3 -0
  63. package/dist/collection/components/form/form.css +147 -20
  64. package/dist/collection/components/form/row/row.js +4 -1
  65. package/dist/collection/components/form/row/row.js.map +1 -1
  66. package/dist/collection/components/form/templates/array-field-collapsible-item.js +13 -16
  67. package/dist/collection/components/form/templates/array-field-collapsible-item.js.map +1 -1
  68. package/dist/collection/components/form/templates/array-field-simple-item.js +16 -49
  69. package/dist/collection/components/form/templates/array-field-simple-item.js.map +1 -1
  70. package/dist/collection/components/form/templates/array-field.js +306 -19
  71. package/dist/collection/components/form/templates/array-field.js.map +1 -1
  72. package/dist/collection/components/form/templates/common.js +3 -1
  73. package/dist/collection/components/form/templates/common.js.map +1 -1
  74. package/dist/collection/components/header/header.css +3 -0
  75. package/dist/collection/components/help/help.css +3 -0
  76. package/dist/collection/components/help/limel-help-content.css +3 -0
  77. package/dist/collection/components/icon-button/icon-button.css +3 -0
  78. package/dist/collection/components/info-tile/info-tile.css +3 -0
  79. package/dist/collection/components/input-field/input-field.css +3 -0
  80. package/dist/collection/components/list/list.css +6 -0
  81. package/dist/collection/components/list-item/list-item.css +3 -0
  82. package/dist/collection/components/list-item/menu-item-meta/menu-item-meta.css +3 -0
  83. package/dist/collection/components/markdown/markdown.css +3 -0
  84. package/dist/collection/components/menu-list/menu-list.css +6 -0
  85. package/dist/collection/components/notched-outline/notched-outline.css +3 -0
  86. package/dist/collection/components/popover-surface/popover-surface.css +3 -0
  87. package/dist/collection/components/profile-picture/profile-picture.css +3 -0
  88. package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.css +3 -0
  89. package/dist/collection/components/radio-button-group/radio-button.css +3 -0
  90. package/dist/collection/components/select/select.css +6 -0
  91. package/dist/collection/components/shortcut/shortcut.css +3 -0
  92. package/dist/collection/components/slider/slider.css +3 -0
  93. package/dist/collection/components/snackbar/snackbar.js +2 -2
  94. package/dist/collection/components/snackbar/snackbar.js.map +1 -1
  95. package/dist/collection/components/split-button/split-button.css +3 -0
  96. package/dist/collection/components/switch/switch.css +3 -0
  97. package/dist/collection/components/switch/switch.js +1 -1
  98. package/dist/collection/components/switch/switch.js.map +1 -1
  99. package/dist/collection/components/tab-bar/tab-bar.css +3 -0
  100. package/dist/collection/components/table/table.css +12 -0
  101. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.css +3 -0
  102. package/dist/collection/components/text-editor/text-editor.css +3 -0
  103. package/dist/collection/components/tooltip/tooltip.js +2 -2
  104. package/dist/collection/components/tooltip/tooltip.js.map +1 -1
  105. package/dist/collection/style/mixins.scss +53 -0
  106. package/dist/collection/translations/da.js +2 -0
  107. package/dist/collection/translations/da.js.map +1 -1
  108. package/dist/collection/translations/de.js +2 -0
  109. package/dist/collection/translations/de.js.map +1 -1
  110. package/dist/collection/translations/en.js +2 -0
  111. package/dist/collection/translations/en.js.map +1 -1
  112. package/dist/collection/translations/fi.js +2 -0
  113. package/dist/collection/translations/fi.js.map +1 -1
  114. package/dist/collection/translations/fr.js +2 -0
  115. package/dist/collection/translations/fr.js.map +1 -1
  116. package/dist/collection/translations/nl.js +2 -0
  117. package/dist/collection/translations/nl.js.map +1 -1
  118. package/dist/collection/translations/no.js +2 -0
  119. package/dist/collection/translations/no.js.map +1 -1
  120. package/dist/collection/translations/sv.js +2 -0
  121. package/dist/collection/translations/sv.js.map +1 -1
  122. package/dist/esm/lime-elements.js +1 -1
  123. package/dist/esm/limel-action-bar_2.entry.js +1 -1
  124. package/dist/esm/limel-ai-avatar.entry.js +1 -1
  125. package/dist/esm/limel-callout.entry.js +1 -1
  126. package/dist/esm/limel-chart.entry.js +1 -1
  127. package/dist/esm/limel-checkbox.entry.js.map +1 -1
  128. package/dist/esm/limel-chip_2.entry.js +1 -1
  129. package/dist/esm/limel-collapsible-section.entry.js +1 -1
  130. package/dist/esm/limel-color-picker.entry.js.map +1 -1
  131. package/dist/esm/limel-drag-handle.entry.js +30 -0
  132. package/dist/esm/limel-drag-handle.entry.js.map +1 -0
  133. package/dist/esm/limel-file-viewer.entry.js +1 -1
  134. package/dist/esm/limel-file.entry.js +1 -1
  135. package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
  136. package/dist/esm/limel-form.entry.js +3221 -301
  137. package/dist/esm/limel-form.entry.js.map +1 -1
  138. package/dist/esm/limel-info-tile.entry.js +1 -1
  139. package/dist/esm/limel-info-tile.entry.js.map +1 -1
  140. package/dist/esm/limel-linear-progress.entry.js +1 -1
  141. package/dist/esm/limel-list-item.entry.js +1 -1
  142. package/dist/esm/limel-portal_3.entry.js.map +1 -1
  143. package/dist/esm/limel-profile-picture.entry.js +1 -1
  144. package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
  145. package/dist/esm/limel-snackbar.entry.js +1 -1
  146. package/dist/esm/limel-snackbar.entry.js.map +1 -1
  147. package/dist/esm/limel-switch.entry.js.map +1 -1
  148. package/dist/esm/limel-table.entry.js +1 -1
  149. package/dist/esm/loader.js +1 -1
  150. package/dist/esm/{translations-91c611da.js → translations-9bfde9f4.js} +17 -1
  151. package/dist/esm/translations-9bfde9f4.js.map +1 -0
  152. package/dist/lime-elements/lime-elements.esm.js +1 -1
  153. package/dist/lime-elements/lime-elements.esm.js.map +1 -1
  154. package/dist/lime-elements/p-309d0652.entry.js +2 -0
  155. package/dist/lime-elements/{p-e6245ef7.entry.js.map → p-309d0652.entry.js.map} +1 -1
  156. package/dist/lime-elements/{p-f507000e.entry.js → p-31f1cb08.entry.js} +2 -2
  157. package/dist/lime-elements/{p-cc7f4c81.entry.js → p-3311eaf3.entry.js} +2 -2
  158. package/dist/lime-elements/{p-aeba4aa4.entry.js → p-40542ccc.entry.js} +2 -2
  159. package/dist/lime-elements/p-40542ccc.entry.js.map +1 -0
  160. package/dist/lime-elements/{p-d349e355.entry.js → p-42e889d8.entry.js} +2 -2
  161. package/dist/lime-elements/p-489d7f63.entry.js.map +1 -1
  162. package/dist/lime-elements/p-51d475d8.entry.js.map +1 -1
  163. package/dist/lime-elements/p-5df2361b.js +2 -0
  164. package/dist/lime-elements/p-5df2361b.js.map +1 -0
  165. package/dist/lime-elements/{p-b5abf284.entry.js → p-5e976a59.entry.js} +2 -2
  166. package/dist/lime-elements/{p-6c60172e.entry.js → p-787be044.entry.js} +2 -2
  167. package/dist/lime-elements/p-8539647d.entry.js.map +1 -1
  168. package/dist/lime-elements/p-8ea3b80a.entry.js +2 -0
  169. package/dist/lime-elements/p-8ea3b80a.entry.js.map +1 -0
  170. package/dist/lime-elements/{p-d1aa44e1.entry.js → p-92aa9610.entry.js} +2 -2
  171. package/dist/lime-elements/p-a1a32893.entry.js +27 -0
  172. package/dist/lime-elements/p-a1a32893.entry.js.map +1 -0
  173. package/dist/lime-elements/{p-8e3c4418.entry.js → p-aa1e7319.entry.js} +2 -2
  174. package/dist/lime-elements/{p-ed04acfc.entry.js → p-b0acf522.entry.js} +2 -2
  175. package/dist/lime-elements/p-b5a96409.entry.js.map +1 -1
  176. package/dist/lime-elements/{p-f83ebd28.entry.js → p-b7bbb6a5.entry.js} +2 -2
  177. package/dist/lime-elements/{p-eb396630.entry.js → p-cd2f780a.entry.js} +2 -2
  178. package/dist/lime-elements/{p-aae161ef.entry.js → p-d79c85e2.entry.js} +2 -2
  179. package/dist/lime-elements/{p-1b036add.entry.js → p-e00465fa.entry.js} +2 -2
  180. package/dist/lime-elements/{p-29c2cdc6.entry.js → p-ee5c4112.entry.js} +2 -2
  181. package/dist/lime-elements/{p-e6bb4d1a.entry.js → p-fbac230b.entry.js} +2 -2
  182. package/dist/lime-elements/style/mixins.scss +53 -0
  183. package/dist/scss/mixins.scss +53 -0
  184. package/dist/types/components/checkbox/checkbox.d.ts +1 -1
  185. package/dist/types/components/color-picker/color-picker.d.ts +1 -1
  186. package/dist/types/components/drag-handle/drag-handle.d.ts +46 -0
  187. package/dist/types/components/form/templates/array-field-collapsible-item.d.ts +3 -1
  188. package/dist/types/components/form/templates/array-field-simple-item.d.ts +5 -9
  189. package/dist/types/components/form/templates/array-field.d.ts +35 -4
  190. package/dist/types/components/form/templates/common.d.ts +3 -3
  191. package/dist/types/components/snackbar/snackbar.d.ts +2 -2
  192. package/dist/types/components/switch/switch.d.ts +1 -1
  193. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  194. package/dist/types/components.d.ts +141 -28
  195. package/dist/types/translations/da.d.ts +2 -0
  196. package/dist/types/translations/de.d.ts +2 -0
  197. package/dist/types/translations/en.d.ts +2 -0
  198. package/dist/types/translations/fi.d.ts +2 -0
  199. package/dist/types/translations/fr.d.ts +2 -0
  200. package/dist/types/translations/nl.d.ts +2 -0
  201. package/dist/types/translations/no.d.ts +2 -0
  202. package/dist/types/translations/sv.d.ts +2 -0
  203. package/package.json +5 -2
  204. package/dist/cjs/translations-d2be6dd7.js.map +0 -1
  205. package/dist/esm/translations-91c611da.js.map +0 -1
  206. package/dist/lime-elements/p-4c88e5d3.js +0 -2
  207. package/dist/lime-elements/p-4c88e5d3.js.map +0 -1
  208. package/dist/lime-elements/p-aeba4aa4.entry.js.map +0 -1
  209. package/dist/lime-elements/p-d6d66daa.entry.js +0 -21
  210. package/dist/lime-elements/p-d6d66daa.entry.js.map +0 -1
  211. package/dist/lime-elements/p-e6245ef7.entry.js +0 -2
  212. /package/dist/lime-elements/{p-f507000e.entry.js.map → p-31f1cb08.entry.js.map} +0 -0
  213. /package/dist/lime-elements/{p-cc7f4c81.entry.js.map → p-3311eaf3.entry.js.map} +0 -0
  214. /package/dist/lime-elements/{p-d349e355.entry.js.map → p-42e889d8.entry.js.map} +0 -0
  215. /package/dist/lime-elements/{p-b5abf284.entry.js.map → p-5e976a59.entry.js.map} +0 -0
  216. /package/dist/lime-elements/{p-6c60172e.entry.js.map → p-787be044.entry.js.map} +0 -0
  217. /package/dist/lime-elements/{p-d1aa44e1.entry.js.map → p-92aa9610.entry.js.map} +0 -0
  218. /package/dist/lime-elements/{p-8e3c4418.entry.js.map → p-aa1e7319.entry.js.map} +0 -0
  219. /package/dist/lime-elements/{p-ed04acfc.entry.js.map → p-b0acf522.entry.js.map} +0 -0
  220. /package/dist/lime-elements/{p-f83ebd28.entry.js.map → p-b7bbb6a5.entry.js.map} +0 -0
  221. /package/dist/lime-elements/{p-eb396630.entry.js.map → p-cd2f780a.entry.js.map} +0 -0
  222. /package/dist/lime-elements/{p-aae161ef.entry.js.map → p-d79c85e2.entry.js.map} +0 -0
  223. /package/dist/lime-elements/{p-1b036add.entry.js.map → p-e00465fa.entry.js.map} +0 -0
  224. /package/dist/lime-elements/{p-29c2cdc6.entry.js.map → p-ee5c4112.entry.js.map} +0 -0
  225. /package/dist/lime-elements/{p-e6bb4d1a.entry.js.map → p-fbac230b.entry.js.map} +0 -0
@@ -0,0 +1,174 @@
1
+ @charset "UTF-8";
2
+ /**
3
+ * Note! This file is exported to `dist/scss/` in the published
4
+ * node module, for consumer projects to import.
5
+ * That means this file cannot import from any file that isn't
6
+ * also exported, keeping the same relative path.
7
+ *
8
+ * Or, just don't import anything, that works too.
9
+ */
10
+ /**
11
+ * This can be used on a trigger element that opens a dropdown menu or a popover.
12
+ */
13
+ /**
14
+ * This mixin will mask out the content that is close to
15
+ * the edges of a scrollable area.
16
+ * - If the scrollable content has `overflow-y`, use `vertically`
17
+ * as an argument for `$direction`.
18
+ - If the scrollable content has `overflow-x`, use `horizontally`
19
+ * as an argument for `$direction`.
20
+ *
21
+ * For the visual effect to work smoothly, we need to make sure that
22
+ * the size of the fade-out edge effect is the same as the
23
+ * internal paddings of the scrollable area. Otherwise, content of a
24
+ * scrollable area that does not have a padding will fade out before
25
+ * any scrolling has been done.
26
+ * This is why this mixin already adds paddings, which automatically
27
+ * default to the size of the fade-out effect.
28
+ * This size defaults to `1rem`, but to override the size use
29
+ * `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
30
+ * when `vertically` argument is set, and use
31
+ * `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
32
+ * when `horizontally` argument is set.
33
+ * Of course you can also programmatically increase and decrease the
34
+ * size of these variables for each edge, based on the amount of
35
+ * scrolling that has been done by the user. In this case, make sure
36
+ * to add a custom padding where the mixin is used, to override
37
+ * the paddings that are automatically added by the mixin in the
38
+ * compiled CSS code.
39
+ */
40
+ /**
41
+ * This mixin will add an animated underline to the bottom of an `a` elements.
42
+ * Note that you may need to add `all: unset;` –depending on your use case–
43
+ * before using this mixin.
44
+ */
45
+ /**
46
+ * This mixin creates a cross-browser font stack.
47
+ * - `sans-serif` can be used for the UI of the components.
48
+ * - `monospace` can be used for code.
49
+ *
50
+ * ⚠️ If we change the font stacks, we need to update
51
+ * 1. the consumer documentation in `README.md`, and
52
+ * 2. the CSS variables of `--kompendium-example-font-family`
53
+ * in the `<style>` tag of `index.html`.
54
+ */
55
+ /**
56
+ * This mixin is a hack, using old CSS syntax
57
+ * to enable you to truncate a piece of text,
58
+ * after a certain number of lines.
59
+ */
60
+ /**
61
+ * This mixin will add a chessboard background pattern,
62
+ * typically used to visualize transparency.
63
+ */
64
+ /**
65
+ * Make a container resizable by the user.
66
+ * This is used in the documentations and examples
67
+ * of some components, to demonstrate how the component
68
+ * behaves in a resizable container.
69
+ */
70
+ /**
71
+ * Drag to reorder mixins
72
+ */
73
+ /**
74
+ * The breakpoints below are used to create responsive designs
75
+ * in Lime's products. Therefore, they are here to get distributed
76
+ * to all components in other private repos, which rely on this `mixins`
77
+ * file, to create consistent styles.
78
+ *
79
+ * :::important
80
+ * In very rare cases you should used media queries!
81
+ * Nowadays, there are many better ways of achieving responsive design
82
+ * without media queries. For example, using CSS Grid, Flexbox, and their features.
83
+ * :::
84
+ */
85
+ /**
86
+ * Media query mixins for responsive design based on screen width.
87
+ * Note that these mixins do not detect the device type!
88
+ */
89
+ limel-drag-handle {
90
+ display: inline-flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+ }
94
+
95
+ button.limel-drag-handle {
96
+ all: unset;
97
+ transition: color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);
98
+ cursor: pointer;
99
+ color: var(--limel-theme-on-surface-color);
100
+ background-color: transparent;
101
+ touch-action: none;
102
+ cursor: grab;
103
+ display: inline-flex;
104
+ align-items: center;
105
+ justify-content: center;
106
+ border-radius: 0.4rem;
107
+ padding: 0.5rem;
108
+ max-height: 2.25rem;
109
+ max-width: 2.25rem;
110
+ color: rgb(var(--contrast-900));
111
+ }
112
+ button.limel-drag-handle:focus {
113
+ outline: none;
114
+ }
115
+ button.limel-drag-handle:focus-visible {
116
+ outline: none;
117
+ box-shadow: var(--shadow-depth-8-focused);
118
+ }
119
+ button.limel-drag-handle:hover, button.limel-drag-handle:focus, button.limel-drag-handle:focus-visible {
120
+ will-change: color, background-color, box-shadow, transform;
121
+ }
122
+ button.limel-drag-handle:hover, button.limel-drag-handle:focus-visible {
123
+ transform: translate3d(0, 0.01rem, 0);
124
+ color: var(--mdc-theme-primary);
125
+ background-color: transparent;
126
+ }
127
+ button.limel-drag-handle:hover {
128
+ box-shadow: var(--button-shadow-hovered);
129
+ }
130
+ button.limel-drag-handle:active {
131
+ --limel-clickable-transform-timing-function: cubic-bezier(
132
+ 0.83,
133
+ -0.15,
134
+ 0.49,
135
+ 1.16
136
+ );
137
+ transform: translate3d(0, 0.05rem, 0);
138
+ box-shadow: var(--button-shadow-pressed);
139
+ }
140
+ button.limel-drag-handle:hover, button.limel-drag-handle:active {
141
+ --limel-clickable-transition-speed: 0.2s;
142
+ --limel-clickable-transform-speed: 0.16s;
143
+ }
144
+ button.limel-drag-handle:active {
145
+ cursor: grabbing;
146
+ }
147
+ button.limel-drag-handle:active, button.limel-drag-handle:hover {
148
+ box-shadow: none !important;
149
+ }
150
+ button.limel-drag-handle .drag-icon {
151
+ display: grid;
152
+ grid-template-columns: 1fr 1fr 1fr;
153
+ gap: 0.2rem;
154
+ }
155
+ limel-drag-handle[drag-direction=horizontal] button.limel-drag-handle .drag-icon {
156
+ grid-template-columns: 1fr 1fr;
157
+ }
158
+ button.limel-drag-handle .drag-icon div {
159
+ transition: transform 0.2s ease, background-color 0.2s ease;
160
+ height: 0.125rem;
161
+ width: 0.125rem;
162
+ border-radius: 1rem;
163
+ background-color: currentColor;
164
+ transform: scale(1);
165
+ }
166
+
167
+ .is-being-dragged button.limel-drag-handle .drag-icon div,
168
+ button.limel-drag-handle:active .drag-icon div,
169
+ button.limel-drag-handle:focus .drag-icon div,
170
+ button.limel-drag-handle:hover .drag-icon div,
171
+ button.limel-drag-handle:focus-visible .drag-icon div {
172
+ background-color: var(--mdc-theme-primary);
173
+ transform: scale(1.5);
174
+ }
@@ -0,0 +1,125 @@
1
+ import { h, Host } from '@stencil/core';
2
+ import translate from '../../global/translations';
3
+ /**
4
+ * This component resembles a drag handle button, but is implemented
5
+ * as a `private` component to allow for easier styling and future extensions.
6
+ *
7
+ * :::important
8
+ * This component has its `shadow` set to `false` in order to
9
+ * integrate well with the drag-and-drop functionality, as well as
10
+ * providing a better accessibility.
11
+ *
12
+ * Keep in mind that its styles might be affected by the consumer
13
+ * component, due to its light dom.
14
+ * :::
15
+ *
16
+ * :::tip
17
+ * It's recommended to place the drag handle on the right side of
18
+ * the item it is meant to reorder, to ensure consistent layout
19
+ * design conventions.
20
+ * :::
21
+ *
22
+ * @exampleComponent limel-example-drag-handle-basic
23
+ * @exampleComponent limel-example-drag-handle-horizontal
24
+ *
25
+ * @private
26
+ */
27
+ export class DragHandleComponent {
28
+ constructor() {
29
+ this.dragHandleId = 'drag-handle-' + crypto.randomUUID();
30
+ this.handleClick = (event) => {
31
+ // Prevent bubbling so the parent item does not treat the pointer click as
32
+ // a toggle or reorder action.
33
+ event.preventDefault();
34
+ event.stopPropagation();
35
+ };
36
+ this.dragDirection = 'vertical';
37
+ this.tooltipOpenDirection = 'left';
38
+ this.language = 'en';
39
+ }
40
+ render() {
41
+ const tooltipLabel = translate.get('drag-handle.drag-to-reorder', this.language);
42
+ const ariaLabel = translate.get('drag-handle.drag-handle', this.language);
43
+ return (h(Host, null, h("button", { "data-drag-handle": true, type: "button", class: "limel-drag-handle", tabindex: -1, "aria-label": ariaLabel, id: this.dragHandleId, onClick: this.handleClick }, h("div", { class: "drag-icon", role: "presentation", "aria-hidden": "true" }, h("div", { key: "1" }), h("div", { key: "2" }), h("div", { key: "3" }), h("div", { key: "4" }), h("div", { key: "5" }), h("div", { key: "6" })), h("limel-tooltip", { openDirection: this.tooltipOpenDirection, elementId: this.dragHandleId, label: tooltipLabel }))));
44
+ }
45
+ static get is() { return "limel-drag-handle"; }
46
+ static get originalStyleUrls() {
47
+ return {
48
+ "$": ["drag-handle.scss"]
49
+ };
50
+ }
51
+ static get styleUrls() {
52
+ return {
53
+ "$": ["drag-handle.css"]
54
+ };
55
+ }
56
+ static get properties() {
57
+ return {
58
+ "dragDirection": {
59
+ "type": "string",
60
+ "mutable": false,
61
+ "complexType": {
62
+ "original": "'vertical' | 'horizontal'",
63
+ "resolved": "\"horizontal\" | \"vertical\"",
64
+ "references": {}
65
+ },
66
+ "required": false,
67
+ "optional": false,
68
+ "docs": {
69
+ "tags": [],
70
+ "text": "The direction in which the drag handle can be used to reorder items."
71
+ },
72
+ "attribute": "drag-direction",
73
+ "reflect": true,
74
+ "defaultValue": "'vertical'"
75
+ },
76
+ "tooltipOpenDirection": {
77
+ "type": "string",
78
+ "mutable": false,
79
+ "complexType": {
80
+ "original": "OpenDirection",
81
+ "resolved": "\"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
82
+ "references": {
83
+ "OpenDirection": {
84
+ "location": "import",
85
+ "path": "../menu/menu.types"
86
+ }
87
+ }
88
+ },
89
+ "required": false,
90
+ "optional": false,
91
+ "docs": {
92
+ "tags": [],
93
+ "text": "The preferred direction for the tooltip to open.\nDefaults to 'left', as our recommended placement for a drag handle\nin the UI is on the far right side of draggable elements."
94
+ },
95
+ "attribute": "tooltip-open-direction",
96
+ "reflect": true,
97
+ "defaultValue": "'left'"
98
+ },
99
+ "language": {
100
+ "type": "string",
101
+ "mutable": false,
102
+ "complexType": {
103
+ "original": "Languages",
104
+ "resolved": "\"da\" | \"de\" | \"en\" | \"fi\" | \"fr\" | \"nb\" | \"nl\" | \"no\" | \"sv\"",
105
+ "references": {
106
+ "Languages": {
107
+ "location": "import",
108
+ "path": "../date-picker/date.types"
109
+ }
110
+ }
111
+ },
112
+ "required": false,
113
+ "optional": false,
114
+ "docs": {
115
+ "tags": [],
116
+ "text": "Language to use for translations."
117
+ },
118
+ "attribute": "language",
119
+ "reflect": true,
120
+ "defaultValue": "'en'"
121
+ }
122
+ };
123
+ }
124
+ }
125
+ //# sourceMappingURL=drag-handle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drag-handle.js","sourceRoot":"","sources":["../../../src/components/drag-handle/drag-handle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAIlD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,MAAM,OAAO,mBAAmB;;IAqBX,iBAAY,GAAG,cAAc,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IA6CpD,gBAAW,GAAG,CAAC,KAAiB,EAAE,EAAE;MACjD,0EAA0E;MAC1E,8BAA8B;MAC9B,KAAK,CAAC,cAAc,EAAE,CAAC;MACvB,KAAK,CAAC,eAAe,EAAE,CAAC;IAC5B,CAAC,CAAC;yBAlEgD,UAAU;gCAQf,MAAM;oBAMtB,IAAI;;EAI1B,MAAM;IACT,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAC9B,6BAA6B,EAC7B,IAAI,CAAC,QAAQ,CAChB,CAAC;IACF,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAC3B,yBAAyB,EACzB,IAAI,CAAC,QAAQ,CAChB,CAAC;IAEF,OAAO,CACH,EAAC,IAAI;MACD,wCAEI,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,mBAAmB,EACzB,QAAQ,EAAE,CAAC,CAAC,gBACA,SAAS,EACrB,EAAE,EAAE,IAAI,CAAC,YAAY,EACrB,OAAO,EAAE,IAAI,CAAC,WAAW;QAEzB,WACI,KAAK,EAAC,WAAW,EACjB,IAAI,EAAC,cAAc,iBACP,MAAM;UAElB,WAAK,GAAG,EAAC,GAAG,GAAG;UACf,WAAK,GAAG,EAAC,GAAG,GAAG;UACf,WAAK,GAAG,EAAC,GAAG,GAAG;UACf,WAAK,GAAG,EAAC,GAAG,GAAG;UACf,WAAK,GAAG,EAAC,GAAG,GAAG;UACf,WAAK,GAAG,EAAC,GAAG,GAAG,CACb;QACN,qBACI,aAAa,EAAE,IAAI,CAAC,oBAAoB,EACxC,SAAS,EAAE,IAAI,CAAC,YAAY,EAC5B,KAAK,EAAE,YAAY,GACrB,CACG,CACN,CACV,CAAC;EACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQJ","sourcesContent":["import { Component, h, Host, Prop } from '@stencil/core';\nimport translate from '../../global/translations';\nimport { Languages } from '../date-picker/date.types';\nimport { OpenDirection } from '../menu/menu.types';\n\n/**\n * This component resembles a drag handle button, but is implemented\n * as a `private` component to allow for easier styling and future extensions.\n *\n * :::important\n * This component has its `shadow` set to `false` in order to\n * integrate well with the drag-and-drop functionality, as well as\n * providing a better accessibility.\n *\n * Keep in mind that its styles might be affected by the consumer\n * component, due to its light dom.\n * :::\n *\n * :::tip\n * It's recommended to place the drag handle on the right side of\n * the item it is meant to reorder, to ensure consistent layout\n * design conventions.\n * :::\n *\n * @exampleComponent limel-example-drag-handle-basic\n * @exampleComponent limel-example-drag-handle-horizontal\n *\n * @private\n */\n@Component({\n tag: 'limel-drag-handle',\n shadow: false,\n styleUrl: 'drag-handle.scss',\n})\nexport class DragHandleComponent {\n /**\n * The direction in which the drag handle can be used to reorder items.\n */\n @Prop({ reflect: true })\n public dragDirection: 'vertical' | 'horizontal' = 'vertical';\n\n /**\n * The preferred direction for the tooltip to open.\n * Defaults to 'left', as our recommended placement for a drag handle\n * in the UI is on the far right side of draggable elements.\n */\n @Prop({ reflect: true })\n public tooltipOpenDirection: OpenDirection = 'left';\n\n /**\n * Language to use for translations.\n */\n @Prop({ reflect: true })\n public language: Languages = 'en';\n\n private readonly dragHandleId = 'drag-handle-' + crypto.randomUUID();\n\n public render() {\n const tooltipLabel = translate.get(\n 'drag-handle.drag-to-reorder',\n this.language\n );\n const ariaLabel = translate.get(\n 'drag-handle.drag-handle',\n this.language\n );\n\n return (\n <Host>\n <button\n data-drag-handle\n type=\"button\"\n class=\"limel-drag-handle\"\n tabindex={-1}\n aria-label={ariaLabel}\n id={this.dragHandleId}\n onClick={this.handleClick}\n >\n <div\n class=\"drag-icon\"\n role=\"presentation\"\n aria-hidden=\"true\"\n >\n <div key=\"1\" />\n <div key=\"2\" />\n <div key=\"3\" />\n <div key=\"4\" />\n <div key=\"5\" />\n <div key=\"6\" />\n </div>\n <limel-tooltip\n openDirection={this.tooltipOpenDirection}\n elementId={this.dragHandleId}\n label={tooltipLabel}\n />\n </button>\n </Host>\n );\n }\n\n private readonly handleClick = (event: MouseEvent) => {\n // Prevent bubbling so the parent item does not treat the pointer click as\n // a toggle or reorder action.\n event.preventDefault();\n event.stopPropagation();\n };\n}\n"]}
@@ -67,6 +67,9 @@
67
67
  * of some components, to demonstrate how the component
68
68
  * behaves in a resizable container.
69
69
  */
70
+ /**
71
+ * Drag to reorder mixins
72
+ */
70
73
  /**
71
74
  * The breakpoints below are used to create responsive designs
72
75
  * in Lime's products. Therefore, they are here to get distributed
@@ -73,6 +73,9 @@
73
73
  * of some components, to demonstrate how the component
74
74
  * behaves in a resizable container.
75
75
  */
76
+ /**
77
+ * Drag to reorder mixins
78
+ */
76
79
  /**
77
80
  * The breakpoints below are used to create responsive designs
78
81
  * in Lime's products. Therefore, they are here to get distributed
@@ -1,4 +1,91 @@
1
1
  @charset "UTF-8";
2
+ /**
3
+ * Note! This file is exported to `dist/scss/` in the published
4
+ * node module, for consumer projects to import.
5
+ * That means this file cannot import from any file that isn't
6
+ * also exported, keeping the same relative path.
7
+ *
8
+ * Or, just don't import anything, that works too.
9
+ */
10
+ /**
11
+ * This can be used on a trigger element that opens a dropdown menu or a popover.
12
+ */
13
+ /**
14
+ * This mixin will mask out the content that is close to
15
+ * the edges of a scrollable area.
16
+ * - If the scrollable content has `overflow-y`, use `vertically`
17
+ * as an argument for `$direction`.
18
+ - If the scrollable content has `overflow-x`, use `horizontally`
19
+ * as an argument for `$direction`.
20
+ *
21
+ * For the visual effect to work smoothly, we need to make sure that
22
+ * the size of the fade-out edge effect is the same as the
23
+ * internal paddings of the scrollable area. Otherwise, content of a
24
+ * scrollable area that does not have a padding will fade out before
25
+ * any scrolling has been done.
26
+ * This is why this mixin already adds paddings, which automatically
27
+ * default to the size of the fade-out effect.
28
+ * This size defaults to `1rem`, but to override the size use
29
+ * `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
30
+ * when `vertically` argument is set, and use
31
+ * `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
32
+ * when `horizontally` argument is set.
33
+ * Of course you can also programmatically increase and decrease the
34
+ * size of these variables for each edge, based on the amount of
35
+ * scrolling that has been done by the user. In this case, make sure
36
+ * to add a custom padding where the mixin is used, to override
37
+ * the paddings that are automatically added by the mixin in the
38
+ * compiled CSS code.
39
+ */
40
+ /**
41
+ * This mixin will add an animated underline to the bottom of an `a` elements.
42
+ * Note that you may need to add `all: unset;` –depending on your use case–
43
+ * before using this mixin.
44
+ */
45
+ /**
46
+ * This mixin creates a cross-browser font stack.
47
+ * - `sans-serif` can be used for the UI of the components.
48
+ * - `monospace` can be used for code.
49
+ *
50
+ * ⚠️ If we change the font stacks, we need to update
51
+ * 1. the consumer documentation in `README.md`, and
52
+ * 2. the CSS variables of `--kompendium-example-font-family`
53
+ * in the `<style>` tag of `index.html`.
54
+ */
55
+ /**
56
+ * This mixin is a hack, using old CSS syntax
57
+ * to enable you to truncate a piece of text,
58
+ * after a certain number of lines.
59
+ */
60
+ /**
61
+ * This mixin will add a chessboard background pattern,
62
+ * typically used to visualize transparency.
63
+ */
64
+ /**
65
+ * Make a container resizable by the user.
66
+ * This is used in the documentations and examples
67
+ * of some components, to demonstrate how the component
68
+ * behaves in a resizable container.
69
+ */
70
+ /**
71
+ * Drag to reorder mixins
72
+ */
73
+ /**
74
+ * The breakpoints below are used to create responsive designs
75
+ * in Lime's products. Therefore, they are here to get distributed
76
+ * to all components in other private repos, which rely on this `mixins`
77
+ * file, to create consistent styles.
78
+ *
79
+ * :::important
80
+ * In very rare cases you should used media queries!
81
+ * Nowadays, there are many better ways of achieving responsive design
82
+ * without media queries. For example, using CSS Grid, Flexbox, and their features.
83
+ * :::
84
+ */
85
+ /**
86
+ * Media query mixins for responsive design based on screen width.
87
+ * Note that these mixins do not detect the device type!
88
+ */
2
89
  /*
3
90
  * This file is imported into every component!
4
91
  *
@@ -13,6 +100,12 @@
13
100
  * @prop --form-background-color-of-even-rows: Background of even rows in the form, when layout type is `row`. Defaults to `transparent`.
14
101
  * @prop --form-background-color-of-odd-rows:Background of odd rows in the form, when layout type is `row`. Defaults to `--contrast-200`.
15
102
  */
103
+ *,
104
+ *::after,
105
+ *::before {
106
+ box-sizing: border-box;
107
+ }
108
+
16
109
  .form-group {
17
110
  min-width: 0;
18
111
  }
@@ -20,18 +113,58 @@
20
113
  .limel-form-array-item--simple {
21
114
  display: flex;
22
115
  align-items: center;
23
- padding-bottom: var(--form-row-gap, 1rem);
116
+ padding: 0.25rem;
24
117
  }
25
- .limel-form-array-item--simple *:first-child {
26
- flex-grow: 1;
118
+ .limel-form-array-item--simple > *:first-child {
119
+ flex: 1;
120
+ min-width: 0;
121
+ }
122
+
123
+ .array-items {
124
+ isolation: isolate;
125
+ display: flex;
126
+ flex-direction: column;
127
+ row-gap: var(--form-row-gap, 0.5rem);
128
+ margin-top: 1rem;
129
+ }
130
+ .array-items.has-an-item-which-is-being-dragged limel-collapsible-section {
131
+ --limel-cs-grid-template-rows: 0fr;
132
+ --limel-cs-opacity-transition-speed: 0.2s;
133
+ --limel-cs-grid-template-rows-transition-speed: 0.2s;
134
+ --limel-cs-open-header-bottom-border-radius: 0.75rem;
27
135
  }
28
136
 
29
- limel-code-editor {
30
- margin-bottom: 0.75rem;
137
+ .array-item:has(limel-drag-handle:hover), .array-item:has(limel-drag-handle:focus-within), .array-item.is-elevated, .array-item.sortable-chosen {
138
+ will-change: transform, box-shadow, border-radius, background-color;
139
+ }
140
+ .array-item.sortable-ghost {
141
+ border-radius: 0.5rem;
142
+ box-shadow: var(--shadow-depth-64), 0 0.65rem 0.75rem -0.425rem rgb(var(--color-black), 0.3);
143
+ }
144
+ .array-item.sortable-chosen {
145
+ border-radius: 0.5rem;
146
+ background-color: var(--lime-elevated-surface-background-color);
147
+ }
148
+ .array-item.is-elevated[draggable=false] {
149
+ animation: sit-here 0.8s forwards;
150
+ }
151
+ @keyframes sit-here {
152
+ 0% {
153
+ border-radius: 0.5rem;
154
+ background-color: var(--lime-elevated-surface-background-color);
155
+ box-shadow: var(--shadow-depth-64), 0 0.65rem 0.75rem -0.425rem rgb(var(--color-black), 0.3);
156
+ }
157
+ 100% {
158
+ box-shadow: none;
159
+ }
31
160
  }
32
161
 
33
- .limel-form-array-item--object {
34
- margin-bottom: 0.25rem;
162
+ limel-drag-handle {
163
+ order: 10;
164
+ }
165
+
166
+ limel-collapsible-section.is-being-dragged {
167
+ border-radius: 0.75rem !important;
35
168
  }
36
169
 
37
170
  .limel-form-layout--default {
@@ -151,17 +284,9 @@ h1 {
151
284
  font-weight: 500;
152
285
  }
153
286
 
154
- p {
155
- margin-top: 0;
156
- margin-bottom: 0.75rem;
157
- font-size: var(--limel-theme-default-font-size);
158
- }
159
-
160
- p + limel-collapsible-section,
161
- p + .limel-form-array-item--simple,
162
- h1 + limel-collapsible-section,
163
- h1 + .limel-form-array-item--simple {
164
- margin-top: 1rem;
287
+ limel-markdown {
288
+ display: block;
289
+ margin-bottom: 0.5rem;
165
290
  }
166
291
 
167
292
  .form-group {
@@ -172,8 +297,7 @@ h1 + .limel-form-array-item--simple {
172
297
  top: calc(var(--form-row-gap, 1rem) * -0.5);
173
298
  left: calc(var(--form-column-gap, 1rem) * -0.5);
174
299
  }
175
- .form-group h1,
176
- .form-group p {
300
+ .form-group h1 {
177
301
  color: rgb(var(--contrast-1400), 0.8);
178
302
  }
179
303
  .form-group h1 {
@@ -292,6 +416,9 @@ h1 + .limel-form-array-item--simple {
292
416
  * of some components, to demonstrate how the component
293
417
  * behaves in a resizable container.
294
418
  */
419
+ /**
420
+ * Drag to reorder mixins
421
+ */
295
422
  /**
296
423
  * The breakpoints below are used to create responsive designs
297
424
  * in Lime's products. Therefore, they are here to get distributed
@@ -30,7 +30,10 @@ export class Row extends React.Component {
30
30
  renderDescription() {
31
31
  var _a;
32
32
  if ((_a = this.schema) === null || _a === void 0 ? void 0 : _a.description) {
33
- return React.createElement('p', { className: 'description' }, this.schema.description);
33
+ return React.createElement('limel-markdown', {
34
+ class: 'description',
35
+ value: this.schema.description,
36
+ });
34
37
  }
35
38
  }
36
39
  renderChildren() {
@@ -1 +1 @@
1
- {"version":3,"file":"row.js","sourceRoot":"","sources":["../../../../src/components/form/row/row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,OAAO,GAAI,SAAQ,KAAK,CAAC,SAAmB;EAC9C,YAAmB,KAAe;IAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAU;EAElC,CAAC;EAEM,MAAM;IACT,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACxB,IAAI,IAAI,CAAC,IAAI,EAAE;MACX,OAAO,CAA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AAM;IACd,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;EAC5C,CAAC;EAED,IAAY,IAAI;;IACZ,OAAO,MAAA,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,0CAAE,MAAM,0CAAE,IAAI,CAAC;EAC3C,CAAC;CACJ","sourcesContent":["import React from 'react';\nimport { RowProps } from '../templates/types';\n\nexport class Row extends React.Component<RowProps> {\n constructor(public props: RowProps) {\n super(props);\n }\n\n public render() {\n const classes = ['row'];\n if (this.icon) {\n classes.push('has-icon');\n }\n\n return React.createElement(\n 'div',\n {\n className: classes.join(' '),\n },\n this.renderMainInformation(),\n this.renderDescription()\n );\n }\n\n private renderIcon() {\n if (this.icon) {\n return React.createElement('limel-icon', {\n name: this.icon,\n });\n }\n }\n\n private renderMainInformation() {\n return React.createElement(\n 'div',\n { className: 'main-information' },\n this.renderIcon(),\n this.renderTitle(),\n this.renderChildren()\n );\n }\n private renderTitle() {\n return React.createElement(\n 'h1',\n { className: 'title' },\n this.schema?.title\n );\n }\n\n private renderDescription() {\n if (this.schema?.description) {\n return React.createElement(\n 'p',\n { className: 'description' },\n this.schema.description\n );\n }\n }\n\n private renderChildren() {\n const children = this.props.children;\n\n return {\n ...children,\n props: {\n ...children.props,\n schema: {\n ...children.props.schema,\n title: null,\n description: null,\n },\n },\n };\n }\n\n private get schema() {\n return this.props.children.props.schema;\n }\n\n private get icon() {\n return this.schema?.lime?.layout?.icon;\n }\n}\n"]}
1
+ {"version":3,"file":"row.js","sourceRoot":"","sources":["../../../../src/components/form/row/row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,OAAO,GAAI,SAAQ,KAAK,CAAC,SAAmB;EAC9C,YAAmB,KAAe;IAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAU;EAElC,CAAC;EAEM,MAAM;IACT,MAAM,OAAO,GA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K,CAAC,MAAM,KACxB,KAAK,EAAE,IAAI,EACX,WAAW,EAAE,IAAI,UAG3B;EACN,CAAC;EAED,IAAY,MAAM;IACd,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;EAC5C,CAAC;EAED,IAAY,IAAI;;IACZ,OAAO,MAAA,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,0CAAE,MAAM,0CAAE,IAAI,CAAC;EAC3C,CAAC;CACJ","sourcesContent":["import React from 'react';\nimport { RowProps } from '../templates/types';\n\nexport class Row extends React.Component<RowProps> {\n constructor(public props: RowProps) {\n super(props);\n }\n\n public render() {\n const classes = ['row'];\n if (this.icon) {\n classes.push('has-icon');\n }\n\n return React.createElement(\n 'div',\n {\n className: classes.join(' '),\n },\n this.renderMainInformation(),\n this.renderDescription()\n );\n }\n\n private renderIcon() {\n if (this.icon) {\n return React.createElement('limel-icon', {\n name: this.icon,\n });\n }\n }\n\n private renderMainInformation() {\n return React.createElement(\n 'div',\n { className: 'main-information' },\n this.renderIcon(),\n this.renderTitle(),\n this.renderChildren()\n );\n }\n private renderTitle() {\n return React.createElement(\n 'h1',\n { className: 'title' },\n this.schema?.title\n );\n }\n\n private renderDescription() {\n if (this.schema?.description) {\n return React.createElement('limel-markdown', {\n class: 'description',\n value: this.schema.description,\n });\n }\n }\n\n private renderChildren() {\n const children = this.props.children;\n\n return {\n ...children,\n props: {\n ...children.props,\n schema: {\n ...children.props.schema,\n title: null,\n description: null,\n },\n },\n };\n }\n\n private get schema() {\n return this.props.children.props.schema;\n }\n\n private get icon() {\n return this.schema?.lime?.layout?.icon;\n }\n}\n"]}
@@ -39,31 +39,28 @@ export class CollapsibleItemTemplate extends React.Component {
39
39
  if (this.state.isOpen) {
40
40
  children = this.props.item.children;
41
41
  }
42
+ const dragHandle = this.props.allowItemReorder
43
+ ? React.createElement('limel-drag-handle', {
44
+ slot: 'header',
45
+ class: 'drag-handle',
46
+ })
47
+ : null;
42
48
  return React.createElement('limel-collapsible-section', {
43
49
  header: findTitle(data, schema, formSchema) || 'New item',
44
- class: 'limel-form-array-item--object',
50
+ class: 'array-item limel-form-array-item--object',
45
51
  ref: (section) => {
46
52
  this.section = section;
47
53
  },
48
54
  'is-open': this.state.isOpen,
49
- }, children);
55
+ 'data-reorder-id': String(this.props.index),
56
+ 'data-reorderable': this.props.allowItemReorder
57
+ ? 'true'
58
+ : 'false',
59
+ }, dragHandle, children);
50
60
  }
51
61
  setActions(element) {
52
- const { item, index, allowItemRemoval, allowItemReorder } = this.props;
62
+ const { item, index, allowItemRemoval } = this.props;
53
63
  const actions = [];
54
- if (allowItemReorder) {
55
- actions.push({
56
- id: 'down',
57
- icon: 'down_arrow',
58
- disabled: !item.hasMoveDown,
59
- run: item.onReorderClick(index, index + 1),
60
- }, {
61
- id: 'up',
62
- icon: 'up_arrow',
63
- disabled: !item.hasMoveUp,
64
- run: item.onReorderClick(index, index - 1),
65
- });
66
- }
67
64
  if (allowItemRemoval) {
68
65
  actions.push({
69
66
  id: 'remove',
@@ -1 +1 @@
1
- {"version":3,"file":"array-field-collapsible-item.js","sourceRoot":"","sources":["../../../../src/components/form/templates/array-field-collapsible-item.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwCpC,MAAM,OAAO,uBAAwB,SAAQ,KAAK,CAAC,SAA+B;EAK9E,YAAmB,KAA2B;IAC1C,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAsB;IAJ9C,UAAK,GAAG;MACJ,MAAM,EAAE,KAAK;KAChB,CAAC;IA2FM,eAAU,GAAG,GAAG,EAAE;MACtB,IAAI,CAAC,QAAQ,CAAC;QACV,MAAM,EAAE,IAAI;OACf,CAAC,CAAC;IACP,CAAC,CAAC;IA3FE,IAAI,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,CAAC,IAAI;IACpB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;MAC1B,OAAO,KAAK,CAAC;KAChB;IAED,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;MACf,OAAO,IAAI,CAAC;KACf;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;EACvD,CAAC;CACJ","sourcesContent":["import { Action } from '../../collapsible-section/action';\nimport React from 'react';\nimport { findTitle } from './common';\nimport { ArrayFieldItem, Runnable } from './types';\nimport { isEmpty } from 'lodash-es';\nimport { JSONSchema7 } from 'json-schema';\n\ninterface CollapsibleItemProps {\n /**\n * Data from reach-jsonschema-form\n */\n item: ArrayFieldItem;\n\n /**\n * The index of the field in the array\n */\n index: number;\n\n /**\n * The value of the field\n */\n data: any;\n\n /**\n * Schema for the field\n */\n schema: JSONSchema7;\n\n /**\n * Schema for the entire form\n */\n formSchema: JSONSchema7;\n\n /**\n * Control whether items can be removed.\n */\n allowItemRemoval: boolean;\n\n /**\n * Control whether items can be reordered.\n */\n allowItemReorder: boolean;\n}\n\nexport class CollapsibleItemTemplate extends React.Component<CollapsibleItemProps> {\n state = {\n isOpen: false,\n };\n\n constructor(public props: CollapsibleItemProps) {\n super(props);\n this.handleAction = this.handleAction.bind(this);\n this.isDeepEmpty = this.isDeepEmpty.bind(this);\n\n this.state = {\n isOpen: this.isDeepEmpty(props.data),\n };\n }\n\n private section: HTMLLimelCollapsibleSectionElement;\n\n public componentDidMount() {\n const section = this.section;\n section.addEventListener('action', this.handleAction);\n section.addEventListener('open', this.handleOpen);\n\n this.setActions(section);\n }\n\n public componentDidUpdate() {\n this.setActions(this.section);\n }\n\n public componentWillUnmount() {\n const section = this.section;\n section.removeEventListener('action', this.handleAction);\n section.removeEventListener('open', this.handleOpen);\n }\n\n public render() {\n const { data, schema, formSchema } = this.props;\n let children: any;\n if (this.state.isOpen) {\n children = this.props.item.children;\n }\n\n return React.createElement(\n 'limel-collapsible-section',\n {\n header: findTitle(data, schema, formSchema) || 'New item',\n class: 'limel-form-array-item--object',\n ref: (section: HTMLLimelCollapsibleSectionElement) => {\n this.section = section;\n },\n 'is-open': this.state.isOpen,\n },\n children\n );\n }\n\n private setActions(element: HTMLLimelCollapsibleSectionElement) {\n const { item, index, allowItemRemoval, allowItemReorder } = this.props;\n const actions: Array<Action & Runnable> = [];\n\n if (allowItemReorder) {\n actions.push(\n {\n id: 'down',\n icon: 'down_arrow',\n disabled: !item.hasMoveDown,\n run: item.onReorderClick(index, index + 1),\n },\n {\n id: 'up',\n icon: 'up_arrow',\n disabled: !item.hasMoveUp,\n run: item.onReorderClick(index, index - 1),\n }\n );\n }\n\n if (allowItemRemoval) {\n actions.push({\n id: 'remove',\n icon: 'trash',\n disabled: !item.hasRemove,\n run: item.onDropIndexClick(index),\n });\n }\n\n element.actions = actions;\n }\n\n private handleAction(event: CustomEvent<Action & Runnable>) {\n event.stopPropagation();\n event.detail.run(event);\n }\n\n private handleOpen = () => {\n this.setState({\n isOpen: true,\n });\n };\n\n private isDeepEmpty(data) {\n if (typeof data !== 'object') {\n return false;\n }\n\n if (isEmpty(data)) {\n return true;\n }\n\n return Object.values(data).every(this.isDeepEmpty);\n }\n}\n"]}
1
+ {"version":3,"file":"array-field-collapsible-item.js","sourceRoot":"","sources":["../../../../src/components/form/templates/array-field-collapsible-item.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwCpC,MAAM,OAAO,uBAAwB,SAAQ,KAAK,CAAC,SAA+B;EAK9E,YAAmB,KAA2B;IAC1C,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAsB;IAJ9C,UAAK,GAAG;MACJ,MAAM,EAAE,KAAK;KAChB,CAAC;IAsFM,eAA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,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAQO,WAAW,CAAC,IAAI;IACpB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;MAC1B,OAAO,KAAK,CAAC;KAChB;IAED,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;MACf,OAAO,IAAI,CAAC;KACf;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;EACvD,CAAC;CACJ","sourcesContent":["import { Action } from '../../collapsible-section/action';\nimport React from 'react';\nimport { findTitle } from './common';\nimport { ArrayFieldItem, Runnable } from './types';\nimport { isEmpty } from 'lodash-es';\nimport { JSONSchema7 } from 'json-schema';\n\ninterface CollapsibleItemProps {\n /**\n * Data from reach-jsonschema-form\n */\n item: ArrayFieldItem;\n\n /**\n * The index of the field in the array\n */\n index: number;\n\n /**\n * The value of the field\n */\n data: any;\n\n /**\n * Schema for the field\n */\n schema: JSONSchema7;\n\n /**\n * Schema for the entire form\n */\n formSchema: JSONSchema7;\n\n /**\n * Control whether items can be removed.\n */\n allowItemRemoval: boolean;\n\n /**\n * Whether this particular item can be reordered.\n */\n allowItemReorder: boolean;\n}\n\nexport class CollapsibleItemTemplate extends React.Component<CollapsibleItemProps> {\n state = {\n isOpen: false,\n };\n\n constructor(public props: CollapsibleItemProps) {\n super(props);\n this.handleAction = this.handleAction.bind(this);\n this.isDeepEmpty = this.isDeepEmpty.bind(this);\n\n this.state = {\n isOpen: this.isDeepEmpty(props.data),\n };\n }\n\n private section: HTMLLimelCollapsibleSectionElement;\n\n public componentDidMount() {\n const section = this.section;\n section.addEventListener('action', this.handleAction);\n section.addEventListener('open', this.handleOpen);\n\n this.setActions(section);\n }\n\n public componentDidUpdate() {\n this.setActions(this.section);\n }\n\n public componentWillUnmount() {\n const section = this.section;\n section.removeEventListener('action', this.handleAction);\n section.removeEventListener('open', this.handleOpen);\n }\n\n public render() {\n const { data, schema, formSchema } = this.props;\n let children: any;\n if (this.state.isOpen) {\n children = this.props.item.children;\n }\n\n const dragHandle = this.props.allowItemReorder\n ? React.createElement('limel-drag-handle', {\n slot: 'header',\n class: 'drag-handle',\n })\n : null;\n\n return React.createElement(\n 'limel-collapsible-section',\n {\n header: findTitle(data, schema, formSchema) || 'New item',\n class: 'array-item limel-form-array-item--object',\n ref: (section: HTMLLimelCollapsibleSectionElement) => {\n this.section = section;\n },\n 'is-open': this.state.isOpen,\n 'data-reorder-id': String(this.props.index),\n 'data-reorderable': this.props.allowItemReorder\n ? 'true'\n : 'false',\n },\n dragHandle,\n children\n );\n }\n\n private setActions(element: HTMLLimelCollapsibleSectionElement) {\n const { item, index, allowItemRemoval } = this.props;\n const actions: Array<Action & Runnable> = [];\n\n if (allowItemRemoval) {\n actions.push({\n id: 'remove',\n icon: 'trash',\n disabled: !item.hasRemove,\n run: item.onDropIndexClick(index),\n });\n }\n\n element.actions = actions;\n }\n\n private handleAction(event: CustomEvent<Action & Runnable>) {\n event.stopPropagation();\n event.detail.run(event);\n }\n\n private handleOpen = () => {\n this.setState({\n isOpen: true,\n });\n };\n\n private isDeepEmpty(data) {\n if (typeof data !== 'object') {\n return false;\n }\n\n if (isEmpty(data)) {\n return true;\n }\n\n return Object.values(data).every(this.isDeepEmpty);\n }\n}\n"]}