@coveord/plasma-mantine 48.9.1 → 48.10.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 (175) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +6 -6
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/__tests__/GlobalSetup.js.map +1 -1
  5. package/dist/cjs/__tests__/SetupAfterEnv.js.map +1 -1
  6. package/dist/cjs/__tests__/Utils.js.map +1 -1
  7. package/dist/cjs/components/blank-slate/BlankSlate.js +1 -1
  8. package/dist/cjs/components/blank-slate/BlankSlate.js.map +1 -1
  9. package/dist/cjs/components/blank-slate/index.js.map +1 -1
  10. package/dist/cjs/components/code-editor/CodeEditor.js +7 -7
  11. package/dist/cjs/components/code-editor/CodeEditor.js.map +1 -1
  12. package/dist/cjs/components/code-editor/__mocks__/@monaco-editor/react.js.map +1 -1
  13. package/dist/cjs/components/code-editor/__mocks__/monaco-editor.js.map +1 -1
  14. package/dist/cjs/components/code-editor/index.js.map +1 -1
  15. package/dist/cjs/components/collection/Collection.js +8 -8
  16. package/dist/cjs/components/collection/Collection.js.map +1 -1
  17. package/dist/cjs/components/collection/CollectionItem.js +7 -7
  18. package/dist/cjs/components/collection/CollectionItem.js.map +1 -1
  19. package/dist/cjs/components/collection/Colllection.styles.js.map +1 -1
  20. package/dist/cjs/components/collection/index.js.map +1 -1
  21. package/dist/cjs/components/date-range-picker/DateRangePickerInlineCalendar.js.map +1 -1
  22. package/dist/cjs/components/date-range-picker/DateRangePickerPopoverCalendar.js +5 -5
  23. package/dist/cjs/components/date-range-picker/DateRangePickerPopoverCalendar.js.map +1 -1
  24. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.js +2 -2
  25. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.js.map +1 -1
  26. package/dist/cjs/components/date-range-picker/EditableDateRangePicker.js +1 -1
  27. package/dist/cjs/components/date-range-picker/EditableDateRangePicker.js.map +1 -1
  28. package/dist/cjs/components/date-range-picker/index.js.map +1 -1
  29. package/dist/cjs/components/header/Header.js.map +1 -1
  30. package/dist/cjs/components/header/index.js.map +1 -1
  31. package/dist/cjs/components/index.js.map +1 -1
  32. package/dist/cjs/components/inline-confirm/InlineConfirm.js +1 -1
  33. package/dist/cjs/components/inline-confirm/InlineConfirm.js.map +1 -1
  34. package/dist/cjs/components/inline-confirm/InlineConfirmButton.js +2 -2
  35. package/dist/cjs/components/inline-confirm/InlineConfirmButton.js.map +1 -1
  36. package/dist/cjs/components/inline-confirm/InlineConfirmContext.js.map +1 -1
  37. package/dist/cjs/components/inline-confirm/InlineConfirmPrompt.js +2 -2
  38. package/dist/cjs/components/inline-confirm/InlineConfirmPrompt.js.map +1 -1
  39. package/dist/cjs/components/inline-confirm/index.js.map +1 -1
  40. package/dist/cjs/components/inline-confirm/useInlineConfirm.js.map +1 -1
  41. package/dist/cjs/components/modal-wizard/ModalWizard.js +5 -5
  42. package/dist/cjs/components/modal-wizard/ModalWizard.js.map +1 -1
  43. package/dist/cjs/components/modal-wizard/ModalWizardStep.js.map +1 -1
  44. package/dist/cjs/components/modal-wizard/index.js.map +1 -1
  45. package/dist/cjs/components/prompt/Prompt.js +1 -1
  46. package/dist/cjs/components/prompt/Prompt.js.map +1 -1
  47. package/dist/cjs/components/prompt/PromptFooter.js.map +1 -1
  48. package/dist/cjs/components/prompt/index.js.map +1 -1
  49. package/dist/cjs/components/sticky-footer/StickyFooter.js.map +1 -1
  50. package/dist/cjs/components/sticky-footer/index.js.map +1 -1
  51. package/dist/cjs/components/table/Table.js +14 -14
  52. package/dist/cjs/components/table/Table.js.map +1 -1
  53. package/dist/cjs/components/table/TableActions.js.map +1 -1
  54. package/dist/cjs/components/table/TableCollapsibleColumn.js.map +1 -1
  55. package/dist/cjs/components/table/TableContext.js.map +1 -1
  56. package/dist/cjs/components/table/TableDateRangePicker.js +2 -2
  57. package/dist/cjs/components/table/TableDateRangePicker.js.map +1 -1
  58. package/dist/cjs/components/table/TableFilter.js +3 -3
  59. package/dist/cjs/components/table/TableFilter.js.map +1 -1
  60. package/dist/cjs/components/table/TableFooter.js.map +1 -1
  61. package/dist/cjs/components/table/TableHeader.js.map +1 -1
  62. package/dist/cjs/components/table/TablePagination.js +1 -1
  63. package/dist/cjs/components/table/TablePagination.js.map +1 -1
  64. package/dist/cjs/components/table/TablePerPage.js +5 -5
  65. package/dist/cjs/components/table/TablePerPage.js.map +1 -1
  66. package/dist/cjs/components/table/TablePredicate.js +1 -1
  67. package/dist/cjs/components/table/TablePredicate.js.map +1 -1
  68. package/dist/cjs/components/table/Th.js.map +1 -1
  69. package/dist/cjs/components/table/index.js.map +1 -1
  70. package/dist/cjs/components/table/useTable.js.map +1 -1
  71. package/dist/cjs/hooks/index.js.map +1 -1
  72. package/dist/cjs/hooks/useControlledList.js +2 -2
  73. package/dist/cjs/hooks/useControlledList.js.map +1 -1
  74. package/dist/cjs/hooks/useParentHeight.js +6 -6
  75. package/dist/cjs/hooks/useParentHeight.js.map +1 -1
  76. package/dist/cjs/index.js.map +1 -1
  77. package/dist/cjs/theme/PlasmaColors.js.map +1 -1
  78. package/dist/cjs/theme/Plasmantine.js.map +1 -1
  79. package/dist/cjs/theme/Theme.js +6 -0
  80. package/dist/cjs/theme/Theme.js.map +1 -1
  81. package/dist/cjs/theme/index.js.map +1 -1
  82. package/dist/definitions/components/collection/Collection.d.ts +67 -1
  83. package/dist/definitions/components/collection/Collection.d.ts.map +1 -1
  84. package/dist/definitions/components/header/Header.d.ts +23 -2
  85. package/dist/definitions/components/header/Header.d.ts.map +1 -1
  86. package/dist/definitions/theme/Theme.d.ts.map +1 -1
  87. package/dist/esm/__tests__/GlobalSetup.js.map +1 -1
  88. package/dist/esm/__tests__/SetupAfterEnv.js.map +1 -1
  89. package/dist/esm/__tests__/Utils.js.map +1 -1
  90. package/dist/esm/components/blank-slate/BlankSlate.js +1 -1
  91. package/dist/esm/components/blank-slate/BlankSlate.js.map +1 -1
  92. package/dist/esm/components/blank-slate/index.js.map +1 -1
  93. package/dist/esm/components/code-editor/CodeEditor.js +7 -7
  94. package/dist/esm/components/code-editor/CodeEditor.js.map +1 -1
  95. package/dist/esm/components/code-editor/__mocks__/@monaco-editor/react.js.map +1 -1
  96. package/dist/esm/components/code-editor/__mocks__/monaco-editor.js.map +1 -1
  97. package/dist/esm/components/code-editor/index.js.map +1 -1
  98. package/dist/esm/components/collection/Collection.js +8 -8
  99. package/dist/esm/components/collection/Collection.js.map +1 -1
  100. package/dist/esm/components/collection/CollectionItem.js +7 -7
  101. package/dist/esm/components/collection/CollectionItem.js.map +1 -1
  102. package/dist/esm/components/collection/Colllection.styles.js.map +1 -1
  103. package/dist/esm/components/collection/index.js.map +1 -1
  104. package/dist/esm/components/date-range-picker/DateRangePickerInlineCalendar.js.map +1 -1
  105. package/dist/esm/components/date-range-picker/DateRangePickerPopoverCalendar.js +5 -5
  106. package/dist/esm/components/date-range-picker/DateRangePickerPopoverCalendar.js.map +1 -1
  107. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.js +2 -2
  108. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.js.map +1 -1
  109. package/dist/esm/components/date-range-picker/EditableDateRangePicker.js +1 -1
  110. package/dist/esm/components/date-range-picker/EditableDateRangePicker.js.map +1 -1
  111. package/dist/esm/components/date-range-picker/index.js.map +1 -1
  112. package/dist/esm/components/header/Header.js.map +1 -1
  113. package/dist/esm/components/header/index.js.map +1 -1
  114. package/dist/esm/components/index.js.map +1 -1
  115. package/dist/esm/components/inline-confirm/InlineConfirm.js +1 -1
  116. package/dist/esm/components/inline-confirm/InlineConfirm.js.map +1 -1
  117. package/dist/esm/components/inline-confirm/InlineConfirmButton.js +2 -2
  118. package/dist/esm/components/inline-confirm/InlineConfirmButton.js.map +1 -1
  119. package/dist/esm/components/inline-confirm/InlineConfirmContext.js.map +1 -1
  120. package/dist/esm/components/inline-confirm/InlineConfirmPrompt.js +2 -2
  121. package/dist/esm/components/inline-confirm/InlineConfirmPrompt.js.map +1 -1
  122. package/dist/esm/components/inline-confirm/index.js.map +1 -1
  123. package/dist/esm/components/inline-confirm/useInlineConfirm.js.map +1 -1
  124. package/dist/esm/components/modal-wizard/ModalWizard.js +5 -5
  125. package/dist/esm/components/modal-wizard/ModalWizard.js.map +1 -1
  126. package/dist/esm/components/modal-wizard/ModalWizardStep.js.map +1 -1
  127. package/dist/esm/components/modal-wizard/index.js.map +1 -1
  128. package/dist/esm/components/prompt/Prompt.js +1 -1
  129. package/dist/esm/components/prompt/Prompt.js.map +1 -1
  130. package/dist/esm/components/prompt/PromptFooter.js.map +1 -1
  131. package/dist/esm/components/prompt/index.js.map +1 -1
  132. package/dist/esm/components/sticky-footer/StickyFooter.js.map +1 -1
  133. package/dist/esm/components/sticky-footer/index.js.map +1 -1
  134. package/dist/esm/components/table/Table.js +14 -14
  135. package/dist/esm/components/table/Table.js.map +1 -1
  136. package/dist/esm/components/table/TableActions.js.map +1 -1
  137. package/dist/esm/components/table/TableCollapsibleColumn.js.map +1 -1
  138. package/dist/esm/components/table/TableContext.js.map +1 -1
  139. package/dist/esm/components/table/TableDateRangePicker.js +2 -2
  140. package/dist/esm/components/table/TableDateRangePicker.js.map +1 -1
  141. package/dist/esm/components/table/TableFilter.js +3 -3
  142. package/dist/esm/components/table/TableFilter.js.map +1 -1
  143. package/dist/esm/components/table/TableFooter.js.map +1 -1
  144. package/dist/esm/components/table/TableHeader.js.map +1 -1
  145. package/dist/esm/components/table/TablePagination.js +1 -1
  146. package/dist/esm/components/table/TablePagination.js.map +1 -1
  147. package/dist/esm/components/table/TablePerPage.js +5 -5
  148. package/dist/esm/components/table/TablePerPage.js.map +1 -1
  149. package/dist/esm/components/table/TablePredicate.js +1 -1
  150. package/dist/esm/components/table/TablePredicate.js.map +1 -1
  151. package/dist/esm/components/table/Th.js.map +1 -1
  152. package/dist/esm/components/table/index.js.map +1 -1
  153. package/dist/esm/components/table/useTable.js.map +1 -1
  154. package/dist/esm/hooks/index.js.map +1 -1
  155. package/dist/esm/hooks/useControlledList.js +2 -2
  156. package/dist/esm/hooks/useControlledList.js.map +1 -1
  157. package/dist/esm/hooks/useParentHeight.js +6 -6
  158. package/dist/esm/hooks/useParentHeight.js.map +1 -1
  159. package/dist/esm/index.js.map +1 -1
  160. package/dist/esm/theme/PlasmaColors.js.map +1 -1
  161. package/dist/esm/theme/Plasmantine.js.map +1 -1
  162. package/dist/esm/theme/Theme.js +6 -0
  163. package/dist/esm/theme/Theme.js.map +1 -1
  164. package/dist/esm/theme/index.js.map +1 -1
  165. package/package.json +7 -7
  166. package/src/components/collection/Collection.tsx +67 -1
  167. package/src/components/header/Header.tsx +23 -2
  168. package/src/theme/Theme.tsx +6 -0
  169. package/dist/cjs/components/code-editor/CodeEditor.example.js +0 -41
  170. package/dist/cjs/components/code-editor/CodeEditor.example.js.map +0 -1
  171. package/dist/definitions/components/code-editor/CodeEditor.example.d.ts +0 -4
  172. package/dist/definitions/components/code-editor/CodeEditor.example.d.ts.map +0 -1
  173. package/dist/esm/components/code-editor/CodeEditor.example.js +0 -31
  174. package/dist/esm/components/code-editor/CodeEditor.example.js.map +0 -1
  175. package/src/components/code-editor/CodeEditor.example.tsx +0 -32
@@ -2,19 +2,85 @@ import { DefaultProps, MantineNumberSize, Selectors } from '@mantine/core';
2
2
  import { ReactNode } from 'react';
3
3
  import useStyles from './Colllection.styles';
4
4
  interface CollectionProps<T> extends DefaultProps<Selectors<typeof useStyles>> {
5
+ /**
6
+ * The default value each new item should have
7
+ */
5
8
  newItem: T;
9
+ /**
10
+ * A render function called for each item passed in the `value` prop.
11
+ *
12
+ * @param item The current item's value
13
+ * @param index The current item's index
14
+ */
6
15
  children: (item: T, index: number) => ReactNode;
7
- defaultValue?: T[];
16
+ /**
17
+ * The list of items to display inside the collection
18
+ *
19
+ * @default []
20
+ */
8
21
  value?: T[];
22
+ /**
23
+ * The initial items of the collection (for uncontrolled usage only)
24
+ */
25
+ defaultValue?: T[];
26
+ /**
27
+ * Unused, has no effect
28
+ */
9
29
  onFocus?: () => void;
30
+ /**
31
+ * Function called whenever the value needs to be updated
32
+ *
33
+ * @param value The whole list of items after the change
34
+ */
10
35
  onChange?: (value: T[]) => void;
36
+ /**
37
+ * Function called after an item is removed from the collection using the remove button
38
+ *
39
+ * @param itemIndex The index of the item that was removed
40
+ */
11
41
  onRemoveItem?: (itemIndex: number) => void;
42
+ /**
43
+ * Whether the collection should have drag and drop behavior enabled
44
+ *
45
+ * @default false
46
+ */
12
47
  draggable?: boolean;
48
+ /**
49
+ * Whether the collection is disabled, or in other words in read only mode
50
+ *
51
+ * @default false
52
+ */
13
53
  disabled?: boolean;
54
+ /**
55
+ * Function that determines if the add item button should be enabled given the current items of the collection.
56
+ * The button is always enabled if this props remains undefined
57
+ *
58
+ * @param values The current items of the collection
59
+ */
14
60
  allowAdd?: (values: T[]) => boolean;
61
+ /**
62
+ * The label of the add item button
63
+ *
64
+ * @default "Add item"
65
+ */
15
66
  addLabel?: string;
67
+ /**
68
+ * The tooltip text displayed when hovering over the disabled add item button
69
+ *
70
+ * @default 'There is already an empty item'
71
+ */
16
72
  addDisabledTooltip?: string;
73
+ /**
74
+ * The spacing between the colleciton items
75
+ *
76
+ * @default 'xs'
77
+ */
17
78
  spacing?: MantineNumberSize;
79
+ /**
80
+ * Whether the collection is required. When required is true, the collection will hide the remove button if there is only one item
81
+ *
82
+ * @default false
83
+ */
18
84
  required?: boolean;
19
85
  }
20
86
  export declare const Collection: <T>(props: CollectionProps<T>) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../../../../src/components/collection/Collection.tsx"],"names":[],"mappings":"AACA,OAAO,EAGH,YAAY,EAEZ,iBAAiB,EACjB,SAAS,EAIZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAKhC,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAE7C,U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AAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IAChD;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACZ;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAChC;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAWD,eAAO,MAAM,UAAU,+CAyFtB,CAAC"}
@@ -1,12 +1,33 @@
1
1
  import { DefaultProps } from '@mantine/core';
2
- import { FunctionComponent, PropsWithChildren, ReactNode } from 'react';
2
+ import { FunctionComponent, ReactNode } from 'react';
3
3
  interface HeaderProps extends DefaultProps {
4
+ /**
5
+ * The description text displayed inside the header underneath the title
6
+ */
4
7
  description?: ReactNode;
8
+ /**
9
+ * Action buttons that can be displayed on the right of the header
10
+ */
5
11
  actions?: ReactNode;
12
+ /**
13
+ * Whether the header should have a border on the bottom
14
+ */
6
15
  borderBottom?: boolean;
16
+ /**
17
+ * A href pointing to documentation related to the current panel.
18
+ * When provided, an info icon is rendered next to the title as link to this documentation
19
+ */
7
20
  docLink?: string;
21
+ /**
22
+ * The tooltip text shown when hovering over the doc link icon
23
+ */
8
24
  docLinkTooltipLabel?: string;
25
+ /**
26
+ * The title of the header.
27
+ * If more than one children are provided, each of them act as parts of a breadcrumb
28
+ */
29
+ children: ReactNode;
9
30
  }
10
- export declare const Header: FunctionComponent<PropsWithChildren<HeaderProps>>;
31
+ export declare const Header: FunctionComponent<HeaderProps>;
11
32
  export {};
12
33
  //# sourceMappingURL=Header.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/components/header/Header.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,YAAY,EAA8C,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAEtE,UAAU,WAAY,SAAQ,YAAY;IACtC,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,WAAW,CAAC,CA8BpE,CAAC"}
1
+ {"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/components/header/Header.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,YAAY,EAA8C,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAEnD,UAAU,WAAY,SAAQ,YAAY;IACtC;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,CA8BjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../src/theme/Theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqB,oBAAoB,EAAoB,MAAM,eAAe,CAAC;AAI1F,eAAO,MAAM,WAAW,EAAE,oBAoJzB,CAAC"}
1
+ {"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../src/theme/Theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqB,oBAAoB,EAAoB,MAAM,eAAe,CAAC;AAI1F,eAAO,MAAM,WAAW,EAAE,oBA0JzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/__tests__/GlobalSetup.ts"],"sourcesContent":["// This file is executed once, before everything else.\nexport default () => {\n // @ts-ignore\n process.env.TZ = 'UTC';\n};\n"],"names":["process","env","TZ"],"mappings":"AAAA,sDAAsD;AACtD,eAAe,WAAM;IACjB,aAAa;IACbA,OAAO,CAACC,GAAG,CAACC,EAAE,GAAG,KAAK,CAAC;AAC3B,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/__tests__/GlobalSetup.ts"],"sourcesContent":["// This file is executed once, before everything else.\nexport default () => {\n // @ts-ignore\n process.env.TZ = 'UTC';\n};\n"],"names":["process","env","TZ"],"mappings":"AAAA,sDAAsD;AACtD,eAAe,WAAM;IACjB,aAAa;IACbA,QAAQC,GAAG,CAACC,EAAE,GAAG;AACrB,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/__tests__/SetupAfterEnv.ts"],"sourcesContent":["/**\n * This file is executed once per test file.\n * It is executed after executing Setup and Jest is initialised, but before the test code itself.\n */\n\nimport '@testing-library/jest-dom';\nimport '@testing-library/jest-dom/extend-expect';\n\nElement.prototype.scrollTo = jest.fn();\nwindow.ResizeObserver =\n window.ResizeObserver ||\n jest.fn().mockImplementation(() => ({\n disconnect: jest.fn(),\n observe: jest.fn(),\n unobserve: jest.fn(),\n }));\n"],"names":["Element","prototype","scrollTo","jest","fn","window","ResizeObserver","mockImplementation","disconnect","observe","unobserve"],"mappings":"AAAA;;;CAGC,GAED,OAAO,2BAA2B,CAAC;AACnC,OAAO,yCAAyC,CAAC;AAEjDA,OAAO,CAACC,SAAS,CAACC,QAAQ,GAAGC,IAAI,CAACC,EAAE,EAAE,CAAC;AACvCC,MAAM,CAACC,cAAc,GACjBD,MAAM,CAACC,cAAc,IACrBH,IAAI,CAACC,EAAE,EAAE,CAACG,kBAAkB,CAAC;WAAO;QAChCC,UAAU,EAAEL,IAAI,CAACC,EAAE,EAAE;QACrBK,OAAO,EAAEN,IAAI,CAACC,EAAE,EAAE;QAClBM,SAAS,EAAEP,IAAI,CAACC,EAAE,EAAE;KACvB;CAAC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/__tests__/SetupAfterEnv.ts"],"sourcesContent":["/**\n * This file is executed once per test file.\n * It is executed after executing Setup and Jest is initialised, but before the test code itself.\n */\n\nimport '@testing-library/jest-dom';\nimport '@testing-library/jest-dom/extend-expect';\n\nElement.prototype.scrollTo = jest.fn();\nwindow.ResizeObserver =\n window.ResizeObserver ||\n jest.fn().mockImplementation(() => ({\n disconnect: jest.fn(),\n observe: jest.fn(),\n unobserve: jest.fn(),\n }));\n"],"names":["Element","prototype","scrollTo","jest","fn","window","ResizeObserver","mockImplementation","disconnect","observe","unobserve"],"mappings":"AAAA;;;CAGC,GAED,OAAO,4BAA4B;AACnC,OAAO,0CAA0C;AAEjDA,QAAQC,SAAS,CAACC,QAAQ,GAAGC,KAAKC,EAAE;AACpCC,OAAOC,cAAc,GACjBD,OAAOC,cAAc,IACrBH,KAAKC,EAAE,GAAGG,kBAAkB,CAAC;WAAO;QAChCC,YAAYL,KAAKC,EAAE;QACnBK,SAASN,KAAKC,EAAE;QAChBM,WAAWP,KAAKC,EAAE;IACtB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/__tests__/Utils.tsx"],"sourcesContent":["import {render, RenderOptions, RenderResult} from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\nimport {Plasmantine} from '../theme';\n\nconst customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult => {\n const TestWrapper: FunctionComponent<PropsWithChildren> = ({children}) => <Plasmantine>{children}</Plasmantine>;\n\n return render(ui, {wrapper: TestWrapper, ...options});\n};\n\nexport {userEvent};\nexport * from '@testing-library/react';\nexport {customRender as render};\n"],"names":["render","userEvent","Plasmantine","customRender","ui","options","TestWrapper","children","wrapper"],"mappings":"AAAA;;AAAA,SAAQA,MAAM,QAAoC,wBAAwB,CAAC;AAC3E,OAAOC,SAAS,MAAM,6BAA6B,CAAC;AAGpD,SAAQC,WAAW,QAAO,UAAU,CAAC;AAErC,IAAMC,YAAY,GAAG,SAACC,EAAgB,EAAEC,OAAwC,EAAmB;IAC/F,IAAMC,WAAW,GAAyC;YAAEC,QAAQ,SAARA,QAAQ;6BAAM,KAACL,WAAW;sBAAEK,QAAQ;UAAe;KAAA,AAAC;IAEhH,OAAOP,MAAM,CAACI,EAAE,EAAE;QAACI,OAAO,EAAEF,WAAW;OAAKD,OAAO,CAAC,CAAC,CAAC;AAC1D,CAAC,AAAC;AAEF,SAAQJ,SAAS,GAAE;AACnB,cAAc,wBAAwB,CAAC;AACvC,SAAQE,YAAY,IAAIH,MAAM,GAAE"}
1
+ {"version":3,"sources":["../../../src/__tests__/Utils.tsx"],"sourcesContent":["import {render, RenderOptions, RenderResult} from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\nimport {Plasmantine} from '../theme';\n\nconst customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult => {\n const TestWrapper: FunctionComponent<PropsWithChildren> = ({children}) => <Plasmantine>{children}</Plasmantine>;\n\n return render(ui, {wrapper: TestWrapper, ...options});\n};\n\nexport {userEvent};\nexport * from '@testing-library/react';\nexport {customRender as render};\n"],"names":["render","userEvent","Plasmantine","customRender","ui","options","TestWrapper","children","wrapper"],"mappings":"AAAA;;AAAA,SAAQA,MAAM,QAAoC,yBAAyB;AAC3E,OAAOC,eAAe,8BAA8B;AAGpD,SAAQC,WAAW,QAAO,WAAW;AAErC,IAAMC,eAAe,SAACC,IAAkBC,SAA2D;IAC/F,IAAMC,cAAoD;YAAEC,iBAAAA;6BAAc,KAACL;sBAAaK;;;IAExF,OAAOP,OAAOI,IAAI;QAACI,SAASF;OAAgBD;AAChD;AAEA,SAAQJ,SAAS,GAAE;AACnB,cAAc,yBAAyB;AACvC,SAAQE,gBAAgBH,MAAM,GAAE"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Paper, Stack } from "@mantine/core";
3
3
  export var BlankSlate = function(param) {
4
- var children = param.children, _withBorder = param.withBorder, withBorder = _withBorder === void 0 ? true : _withBorder;
4
+ var children = param.children, _param_withBorder = param.withBorder, withBorder = _param_withBorder === void 0 ? true : _param_withBorder;
5
5
  return /*#__PURE__*/ _jsx(Paper, {
6
6
  shadow: withBorder && "xs",
7
7
  p: "xl",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/blank-slate/BlankSlate.tsx"],"sourcesContent":["import {Paper, Stack} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\ninterface BlankSlateProps {\n /**\n * Whether the Blankslate render with a border\n *\n * @default true\n */\n withBorder?: boolean;\n}\n\nexport const BlankSlate: FunctionComponent<PropsWithChildren<BlankSlateProps>> = ({children, withBorder = true}) => (\n <Paper shadow={withBorder && 'xs'} p=\"xl\" withBorder={withBorder}>\n <Stack align=\"center\">{children}</Stack>\n </Paper>\n);\n"],"names":["Paper","Stack","BlankSlate","children","withBorder","shadow","p","align"],"mappings":"AAAA;AAAA,SAAQA,KAAK,EAAEC,KAAK,QAAO,eAAe,CAAC;AAY3C,OAAO,IAAMC,UAAU,GAA0D;QAAEC,QAAQ,SAARA,QAAQ,sBAAEC,UAAU,EAAVA,UAAU,4BAAG,IAAI,cAAA;yBAC1G,KAACJ,KAAK;QAACK,MAAM,EAAED,UAAU,IAAI,IAAI;QAAEE,CAAC,EAAC,IAAI;QAACF,UAAU,EAAEA,UAAU;kBAC5D,cAAA,KAACH,KAAK;YAACM,KAAK,EAAC,QAAQ;sBAAEJ,QAAQ;UAAS;MACpC;CACX,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/blank-slate/BlankSlate.tsx"],"sourcesContent":["import {Paper, Stack} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\ninterface BlankSlateProps {\n /**\n * Whether the Blankslate render with a border\n *\n * @default true\n */\n withBorder?: boolean;\n}\n\nexport const BlankSlate: FunctionComponent<PropsWithChildren<BlankSlateProps>> = ({children, withBorder = true}) => (\n <Paper shadow={withBorder && 'xs'} p=\"xl\" withBorder={withBorder}>\n <Stack align=\"center\">{children}</Stack>\n </Paper>\n);\n"],"names":["Paper","Stack","BlankSlate","children","withBorder","shadow","p","align"],"mappings":"AAAA;AAAA,SAAQA,KAAK,EAAEC,KAAK,QAAO,gBAAgB;AAY3C,OAAO,IAAMC,aAAoE;QAAEC,iBAAAA,oCAAUC,YAAAA,4CAAa,IAAI;yBAC1G,KAACJ;QAAMK,QAAQD,cAAc;QAAME,GAAE;QAAKF,YAAYA;kBAClD,cAAA,KAACH;YAAMM,OAAM;sBAAUJ;;;EAE7B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/blank-slate/index.ts"],"sourcesContent":["export * from './BlankSlate';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/blank-slate/index.ts"],"sourcesContent":["export * from './BlankSlate';\n"],"names":[],"mappings":"AAAA,cAAc,eAAe"}
@@ -29,7 +29,7 @@ var defaultProps = {
29
29
  minHeight: 300
30
30
  };
31
31
  export var CodeEditor = function(props) {
32
- var _ref = useComponentDefaultProps("CodeEditor", defaultProps, props), language = _ref.language, defaultValue = _ref.defaultValue, onChange = _ref.onChange, onFocus = _ref.onFocus, value = _ref.value, label = _ref.label, required = _ref.required, labelProps = _ref.labelProps, error = _ref.error, errorProps = _ref.errorProps, description = _ref.description, descriptionProps = _ref.descriptionProps, minHeight = _ref.minHeight, maxHeight = _ref.maxHeight, disabled = _ref.disabled, monacoLoader = _ref.monacoLoader, others = _object_without_properties(_ref, [
32
+ var _useComponentDefaultProps = useComponentDefaultProps("CodeEditor", defaultProps, props), language = _useComponentDefaultProps.language, defaultValue = _useComponentDefaultProps.defaultValue, onChange = _useComponentDefaultProps.onChange, onFocus = _useComponentDefaultProps.onFocus, value = _useComponentDefaultProps.value, label = _useComponentDefaultProps.label, required = _useComponentDefaultProps.required, labelProps = _useComponentDefaultProps.labelProps, error = _useComponentDefaultProps.error, errorProps = _useComponentDefaultProps.errorProps, description = _useComponentDefaultProps.description, descriptionProps = _useComponentDefaultProps.descriptionProps, minHeight = _useComponentDefaultProps.minHeight, maxHeight = _useComponentDefaultProps.maxHeight, disabled = _useComponentDefaultProps.disabled, monacoLoader = _useComponentDefaultProps.monacoLoader, others = _object_without_properties(_useComponentDefaultProps, [
33
33
  "language",
34
34
  "defaultValue",
35
35
  "onChange",
@@ -47,15 +47,15 @@ export var CodeEditor = function(props) {
47
47
  "disabled",
48
48
  "monacoLoader"
49
49
  ]);
50
- var ref = _sliced_to_array(useState(false), 2), loaded = ref[0], setLoaded = ref[1];
51
- var ref1 = useStyles(), classes = ref1.classes, theme = ref1.theme;
52
- var ref2 = _sliced_to_array(useUncontrolled({
50
+ var _useState = _sliced_to_array(useState(false), 2), loaded = _useState[0], setLoaded = _useState[1];
51
+ var _useStyles = useStyles(), classes = _useStyles.classes, theme = _useStyles.theme;
52
+ var _useUncontrolled = _sliced_to_array(useUncontrolled({
53
53
  value: value,
54
54
  defaultValue: defaultValue,
55
55
  onChange: onChange,
56
56
  finalValue: ""
57
- }), 2), _value = ref2[0], handleChange = ref2[1];
58
- var ref3 = _sliced_to_array(useParentHeight(), 2), parentHeight = ref3[0], ref4 = ref3[1];
57
+ }), 2), _value = _useUncontrolled[0], handleChange = _useUncontrolled[1];
58
+ var _useParentHeight = _sliced_to_array(useParentHeight(), 2), parentHeight = _useParentHeight[0], ref = _useParentHeight[1];
59
59
  var loadLocalMonaco = function() {
60
60
  var _ref = _async_to_generator(function() {
61
61
  var monaco;
@@ -187,7 +187,7 @@ export var CodeEditor = function(props) {
187
187
  height: Math.max(parentHeight, minHeight),
188
188
  maxHeight: maxHeight
189
189
  },
190
- ref: ref4
190
+ ref: ref
191
191
  }, others), {
192
192
  children: [
193
193
  _header,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {CheckSize16Px, CopySize16Px} from '@coveord/plasma-react-icons';\nimport {\n ActionIcon,\n Box,\n Center,\n CopyButton,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Loader,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport Editor, {loader} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect, useState} from 'react';\n\nimport {useParentHeight} from '../../hooks';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n editor: {\n border: `1px solid ${theme.colors.gray[2]}`,\n borderRadius: theme.defaultRadius,\n backgroundColor: theme.colorScheme === 'light' ? theme.white : theme.black,\n height: '100%',\n },\n}));\n\ninterface CodeEditorProps\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The language syntax of the editor\n *\n * @default 'plaintext'\n */\n language?: 'plaintext' | 'json' | 'markdown' | 'python';\n /** Default value for uncontrolled input */\n defaultValue?: string;\n /** Value for controlled input */\n value?: string;\n /** onChange value for controlled input */\n onChange?(value: string): void;\n /** Called whenever the code editor gets the focus */\n onFocus?(): void;\n /**\n * The minimal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height is too short, it will use this value as minimum.\n *\n * @default 300\n */\n minHeight?: number;\n /**\n * The maximal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height would be too high for your liking, you can use this prop to set a maximum.\n */\n maxHeight?: number;\n disabled?: boolean;\n /**\n * Defines how the monaco editor files will be loaded.\n * Note that using `'local'` requires [some additional configuration](https://github.com/suren-atoyan/monaco-react#use-monaco-editor-as-an-npm-package).\n *\n * @default 'local'\n */\n monacoLoader?: 'cdn' | 'local';\n}\n\nconst defaultProps: Partial<CodeEditorProps> = {\n language: 'plaintext',\n monacoLoader: 'local',\n defaultValue: '',\n minHeight: 300,\n};\n\nexport const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {\n const {\n language,\n defaultValue,\n onChange,\n onFocus,\n value,\n label,\n required,\n labelProps,\n error,\n errorProps,\n description,\n descriptionProps,\n minHeight,\n maxHeight,\n disabled,\n monacoLoader,\n ...others\n } = useComponentDefaultProps('CodeEditor', defaultProps, props);\n const [loaded, setLoaded] = useState(false);\n const {classes, theme} = useStyles();\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n\n const loadLocalMonaco = async () => {\n const monaco = await import('monaco-editor');\n loader.config({monaco});\n setLoaded(true);\n };\n\n useEffect(() => {\n if (monacoLoader === 'local') {\n loadLocalMonaco();\n } else {\n setLoaded(true);\n }\n }, []);\n\n const _label = label ? (\n <Input.Label required={required} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description mt=\"xs\" {...descriptionProps}>\n {description}\n </Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : null;\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _copyButton = (\n <Group position=\"right\">\n <CopyButton value={_value} timeout={2000}>\n {({copied, copy}) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon color={copied ? 'lime' : 'gray'} onClick={copy}>\n {copied ? <CheckSize16Px height={16} /> : <CopySize16Px height={16} />}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Group>\n );\n\n const _editor = loaded ? (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n wrappingStrategy: 'advanced',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: theme.fontSizes.xs,\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor) => {\n editor.onDidFocusEditorText(onFocus);\n editor.onDidBlurEditorText(async () => {\n await editor.getAction('editor.action.formatDocument').run();\n });\n }}\n />\n </Box>\n ) : (\n <Center className={classes.editor}>\n <Loader />\n </Center>\n );\n\n return (\n <Stack\n justify=\"flex-start\"\n className={classes.root}\n spacing={0}\n sx={{height: Math.max(parentHeight, minHeight), maxHeight}}\n ref={ref}\n {...others}\n >\n {_header}\n {_copyButton}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["CheckSize16Px","CopySize16Px","ActionIcon","Box","Center","CopyButton","createStyles","Group","Input","Loader","Stack","Tooltip","useComponentDefaultProps","useUncontrolled","Editor","loader","useEffect","useState","useParentHeight","useStyles","theme","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","defaultProps","language","monacoLoader","defaultValue","minHeight","CodeEditor","props","onChange","onFocus","value","label","required","labelProps","error","errorProps","description","descriptionProps","maxHeight","disabled","others","loaded","setLoaded","classes","finalValue","_value","handleChange","parentHeight","ref","loadLocalMonaco","monaco","config","_label","Label","_description","Description","mt","_error","Error","_header","_copyButton","position","timeout","copied","copy","withArrow","color","onClick","_editor","p","pl","className","defaultLanguage","options","minimap","enabled","wordWrap","wrappingStrategy","scrollBeyondLastLine","formatOnPaste","fontSize","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","justify","spacing","sx","Math","max"],"mappings":"AAAA;;;;;;;AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,6BAA6B,CAAC;AACxE,SACIC,UAAU,EACVC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVC,YAAY,EAEZC,KAAK,EACLC,KAAK,EAELC,MAAM,EAENC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,eAAe,CAAC;AACvB,SAAQC,eAAe,QAAO,gBAAgB,CAAC;AAC/C,OAAOC,MAAM,IAAGC,MAAM,QAAO,sBAAsB,CAAC;AACpD,SAA2BC,SAAS,EAAEC,QAAQ,QAAO,OAAO,CAAC;AAE7D,SAAQC,eAAe,QAAO,aAAa,CAAC;AAE5C,IAAMC,SAAS,GAAGb,YAAY,CAAC,SAACc,KAAK;WAAM;QACvCC,IAAI,EAAE,EAAE;QACRC,MAAM,EAAE;YACJC,MAAM,EAAE,AAAC,YAAU,CAAuB,MAAA,CAArBH,KAAK,CAACI,MAAM,CAACC,IAAI,CAAC,CAAC,CAAC,CAAE;YAC3CC,YAAY,EAAEN,KAAK,CAACO,aAAa;YACjCC,eAAe,EAAER,KAAK,CAACS,WAAW,KAAK,OAAO,GAAGT,KAAK,CAACU,KAAK,GAAGV,KAAK,CAACW,KAAK;YAC1EC,MAAM,EAAE,MAAM;SACjB;KACJ;CAAC,CA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Q,OAAO;YACPX,MAAM;;OACH,CACV;AACN,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {CheckSize16Px, CopySize16Px} from '@coveord/plasma-react-icons';\nimport {\n ActionIcon,\n Box,\n Center,\n CopyButton,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Loader,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport Editor, {loader} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect, useState} from 'react';\n\nimport {useParentHeight} from '../../hooks';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n editor: {\n border: `1px solid ${theme.colors.gray[2]}`,\n borderRadius: theme.defaultRadius,\n backgroundColor: theme.colorScheme === 'light' ? theme.white : theme.black,\n height: '100%',\n },\n}));\n\ninterface CodeEditorProps\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The language syntax of the editor\n *\n * @default 'plaintext'\n */\n language?: 'plaintext' | 'json' | 'markdown' | 'python';\n /** Default value for uncontrolled input */\n defaultValue?: string;\n /** Value for controlled input */\n value?: string;\n /** onChange value for controlled input */\n onChange?(value: string): void;\n /** Called whenever the code editor gets the focus */\n onFocus?(): void;\n /**\n * The minimal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height is too short, it will use this value as minimum.\n *\n * @default 300\n */\n minHeight?: number;\n /**\n * The maximal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height would be too high for your liking, you can use this prop to set a maximum.\n */\n maxHeight?: number;\n disabled?: boolean;\n /**\n * Defines how the monaco editor files will be loaded.\n * Note that using `'local'` requires [some additional configuration](https://github.com/suren-atoyan/monaco-react#use-monaco-editor-as-an-npm-package).\n *\n * @default 'local'\n */\n monacoLoader?: 'cdn' | 'local';\n}\n\nconst defaultProps: Partial<CodeEditorProps> = {\n language: 'plaintext',\n monacoLoader: 'local',\n defaultValue: '',\n minHeight: 300,\n};\n\nexport const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {\n const {\n language,\n defaultValue,\n onChange,\n onFocus,\n value,\n label,\n required,\n labelProps,\n error,\n errorProps,\n description,\n descriptionProps,\n minHeight,\n maxHeight,\n disabled,\n monacoLoader,\n ...others\n } = useComponentDefaultProps('CodeEditor', defaultProps, props);\n const [loaded, setLoaded] = useState(false);\n const {classes, theme} = useStyles();\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n\n const loadLocalMonaco = async () => {\n const monaco = await import('monaco-editor');\n loader.config({monaco});\n setLoaded(true);\n };\n\n useEffect(() => {\n if (monacoLoader === 'local') {\n loadLocalMonaco();\n } else {\n setLoaded(true);\n }\n }, []);\n\n const _label = label ? (\n <Input.Label required={required} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description mt=\"xs\" {...descriptionProps}>\n {description}\n </Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : null;\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _copyButton = (\n <Group position=\"right\">\n <CopyButton value={_value} timeout={2000}>\n {({copied, copy}) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon color={copied ? 'lime' : 'gray'} onClick={copy}>\n {copied ? <CheckSize16Px height={16} /> : <CopySize16Px height={16} />}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Group>\n );\n\n const _editor = loaded ? (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n wrappingStrategy: 'advanced',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: theme.fontSizes.xs,\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor) => {\n editor.onDidFocusEditorText(onFocus);\n editor.onDidBlurEditorText(async () => {\n await editor.getAction('editor.action.formatDocument').run();\n });\n }}\n />\n </Box>\n ) : (\n <Center className={classes.editor}>\n <Loader />\n </Center>\n );\n\n return (\n <Stack\n justify=\"flex-start\"\n className={classes.root}\n spacing={0}\n sx={{height: Math.max(parentHeight, minHeight), maxHeight}}\n ref={ref}\n {...others}\n >\n {_header}\n {_copyButton}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["CheckSize16Px","CopySize16Px","ActionIcon","Box","Center","CopyButton","createStyles","Group","Input","Loader","Stack","Tooltip","useComponentDefaultProps","useUncontrolled","Editor","loader","useEffect","useState","useParentHeight","useStyles","theme","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","defaultProps","language","monacoLoader","defaultValue","minHeight","CodeEditor","props","onChange","onFocus","value","label","required","labelProps","error","errorProps","description","descriptionProps","maxHeight","disabled","others","loaded","setLoaded","classes","finalValue","_value","handleChange","parentHeight","ref","loadLocalMonaco","monaco","config","_label","Label","_description","Description","mt","_error","Error","_header","_copyButton","position","timeout","copied","copy","withArrow","color","onClick","_editor","p","pl","className","defaultLanguage","options","minimap","enabled","wordWrap","wrappingStrategy","scrollBeyondLastLine","formatOnPaste","fontSize","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","justify","spacing","sx","Math","max"],"mappings":"AAAA;;;;;;;AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,8BAA8B;AACxE,SACIC,UAAU,EACVC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVC,YAAY,EAEZC,KAAK,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BAAcgC,QAAQ;2CAAS,KAAC/B;4BAAa+B,QAAQ;0BAAM;;;;;;IAQ9F,IAAMgD,UAAU3B,uBACZ,KAAClD;QAAI8E,GAAE;QAAKC,IAAG;QAAKC,WAAW5B,QAAQjC,MAAM;kBACzC,cAAA,KAACR;YACGsE,iBAAiBlD;YACjBd,OAAOA,MAAMS,WAAW,KAAK,UAAU,UAAU,SAAS;YAC1DwD,SAAS;gBACLC,SAAS;oBAACC,SAAS,KAAK;gBAAA;gBACxBC,UAAU;gBACVC,kBAAkB;gBAClBC,sBAAsB,KAAK;gBAC3BC,eAAe,IAAI;gBACnBC,UAAUxE,MAAMyE,SAAS,CAACC,EAAE;gBAC5BC,UAAU5C;gBACV6C,SAAS;YACb;YACAtD,OAAOe;YACPjB,UAAUkB;YACVuC,SAAS,SAAC3E,QAAW;gBACjBA,OAAO4E,oBAAoB,CAACzD;gBAC5BnB,OAAO6E,mBAAmB,eAAC,oBAAA,WAAY;;;;gCACnC;;oCAAM7E,OAAO8E,SAAS,CAAC,gCAAgCC,GAAG;;;gCAA1D;;;;;;gBACJ;YACJ;;uBAIR,KAACjG;QAAO+E,WAAW5B,QAAQjC,MAAM;kBAC7B,cAAA,KAACb;MAER;IAED,qBACI,MAACC;QACG4F,SAAQ;QACRnB,WAAW5B,QAAQlC,IAAI;QACvBkF,SAAS;QACTC,IAAI;YAACxE,QAAQyE,KAAKC,GAAG,CAAC/C,cAActB;YAAYa,WAAAA;QAAS;QACzDU,KAAKA;OACDR;;YAEHmB;YACAC;YACAQ;YACAX;;;AAGb,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/code-editor/__mocks__/@monaco-editor/react.tsx"],"sourcesContent":["import {type EditorProps} from '@monaco-editor/react';\nimport {FunctionComponent} from 'react';\n\nconst MockedEditor: FunctionComponent<EditorProps> = (props) => <div data-testid=\"monaco-editor\" />;\n\nexport default MockedEditor;\n\nexport const loader = {\n config: jest.fn(),\n};\n"],"names":["MockedEditor","props","div","data-testid","loader","config","jest","fn"],"mappings":"AAAA;AAGA,IAAMA,YAAY,GAAmC,SAACC,KAAK;yBAAK,KAACC,KAAG;QAACC,aAAW,EAAC,eAAe;MAAG;CAAA,AAAC;AAEpG,eAAeH,YAAY,CAAC;AAE5B,OAAO,IAAMI,MAAM,GAAG;IAClBC,MAAM,EAAEC,IAAI,CAACC,EAAE,EAAE;CACpB,CAAC"}
1
+ {"version":3,"sources":["../../../../../../src/components/code-editor/__mocks__/@monaco-editor/react.tsx"],"sourcesContent":["import {type EditorProps} from '@monaco-editor/react';\nimport {FunctionComponent} from 'react';\n\nconst MockedEditor: FunctionComponent<EditorProps> = (props) => <div data-testid=\"monaco-editor\" />;\n\nexport default MockedEditor;\n\nexport const loader = {\n config: jest.fn(),\n};\n"],"names":["MockedEditor","props","div","data-testid","loader","config","jest","fn"],"mappings":"AAAA;AAGA,IAAMA,eAA+C,SAACC;yBAAU,KAACC;QAAIC,eAAY;;;AAEjF,eAAeH,aAAa;AAE5B,OAAO,IAAMI,SAAS;IAClBC,QAAQC,KAAKC,EAAE;AACnB,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/code-editor/__mocks__/monaco-editor.ts"],"sourcesContent":["const editor = {\n create: () => ({\n dispose: (): void => null,\n }),\n};\n\nexport const monaco = {\n editor,\n};\n"],"names":["editor","create","dispose","monaco"],"mappings":"AAAA,IAAMA,MAAM,GAAG;IACXC,MAAM,EAAE;eAAO;YACXC,OAAO,EAAE;uBAAY,IAAI;aAAA;SAC5B;KAAC;CACL,AAAC;AAEF,OAAO,IAAMC,MAAM,GAAG;IAClBH,MAAM,EAANA,MAAM;CACT,CAAC"}
1
+ {"version":3,"sources":["../../../../../src/components/code-editor/__mocks__/monaco-editor.ts"],"sourcesContent":["const editor = {\n create: () => ({\n dispose: (): void => null,\n }),\n};\n\nexport const monaco = {\n editor,\n};\n"],"names":["editor","create","dispose","monaco"],"mappings":"AAAA,IAAMA,SAAS;IACXC,QAAQ;eAAO;YACXC,SAAS;uBAAY,IAAI;;QAC7B;;AACJ;AAEA,OAAO,IAAMC,SAAS;IAClBH,QAAAA;AACJ,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/code-editor/index.ts"],"sourcesContent":["export * from './CodeEditor';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/code-editor/index.ts"],"sourcesContent":["export * from './CodeEditor';\n"],"names":[],"mappings":"AAAA,cAAc,eAAe"}
@@ -19,8 +19,8 @@ var defaultProps = {
19
19
  required: false
20
20
  };
21
21
  export var Collection = function(props) {
22
- var _ref = useComponentDefaultProps("Collection", defaultProps, props), value = _ref.value, defaultValue = _ref.defaultValue, onChange = _ref.onChange, onRemoveItem = _ref.onRemoveItem, disabled = _ref.disabled, draggable = _ref.draggable, children = _ref.children, spacing = _ref.spacing, required = _ref.required, newItem = _ref.newItem, addLabel = _ref.addLabel, addDisabledTooltip = _ref.addDisabledTooltip, allowAdd = _ref.allowAdd, // Style props
23
- classNames = _ref.classNames, className = _ref.className, styles = _ref.styles, unstyled = _ref.unstyled, others = _object_without_properties(_ref, [
22
+ var _useComponentDefaultProps = useComponentDefaultProps("Collection", defaultProps, props), value = _useComponentDefaultProps.value, defaultValue = _useComponentDefaultProps.defaultValue, onChange = _useComponentDefaultProps.onChange, onRemoveItem = _useComponentDefaultProps.onRemoveItem, disabled = _useComponentDefaultProps.disabled, draggable = _useComponentDefaultProps.draggable, children = _useComponentDefaultProps.children, spacing = _useComponentDefaultProps.spacing, required = _useComponentDefaultProps.required, newItem = _useComponentDefaultProps.newItem, addLabel = _useComponentDefaultProps.addLabel, addDisabledTooltip = _useComponentDefaultProps.addDisabledTooltip, allowAdd = _useComponentDefaultProps.allowAdd, // Style props
23
+ classNames = _useComponentDefaultProps.classNames, className = _useComponentDefaultProps.className, styles = _useComponentDefaultProps.styles, unstyled = _useComponentDefaultProps.unstyled, others = _object_without_properties(_useComponentDefaultProps, [
24
24
  "value",
25
25
  "defaultValue",
26
26
  "onChange",
@@ -39,18 +39,18 @@ export var Collection = function(props) {
39
39
  "styles",
40
40
  "unstyled"
41
41
  ]);
42
- var ref = useStyles(null, {
42
+ var _useStyles = useStyles(null, {
43
43
  classNames: classNames,
44
44
  name: "Collection",
45
45
  styles: styles,
46
46
  unstyled: unstyled
47
- }), classes = ref.classes, cx = ref.cx;
47
+ }), classes = _useStyles.classes, cx = _useStyles.cx;
48
48
  var collectionID = useId("dnd-droppable");
49
- var ref1 = _sliced_to_array(useControlledList({
49
+ var _useControlledList = _sliced_to_array(useControlledList({
50
50
  value: value,
51
51
  onChange: onChange,
52
52
  defaultValue: defaultValue
53
- }), 2), values = ref1[0], ref2 = ref1[1], append = ref2.append, remove = ref2.remove, reorder = ref2.reorder;
53
+ }), 2), values = _useControlledList[0], _useControlledList_ = _useControlledList[1], append = _useControlledList_.append, remove = _useControlledList_.remove, reorder = _useControlledList_.reorder;
54
54
  var hasOnlyOneItem = values.length === 1;
55
55
  var removeItem = function(index) {
56
56
  return function() {
@@ -69,8 +69,8 @@ export var Collection = function(props) {
69
69
  children: children(item, index)
70
70
  }, index);
71
71
  });
72
- var ref3;
73
- var addAllowed = (ref3 = allowAdd === null || allowAdd === void 0 ? void 0 : allowAdd(values)) !== null && ref3 !== void 0 ? ref3 : true;
72
+ var _ref;
73
+ var addAllowed = (_ref = allowAdd === null || allowAdd === void 0 ? void 0 : allowAdd(values)) !== null && _ref !== void 0 ? _ref : true;
74
74
  var _addButton = disabled ? null : /*#__PURE__*/ _jsx(Group, {
75
75
  children: /*#__PURE__*/ _jsx(Tooltip, {
76
76
  label: addDisabledTooltip,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/collection/Collection.tsx"],"sourcesContent":["import {AddSize16Px} from '@coveord/plasma-react-icons';\nimport {\n Box,\n Button,\n DefaultProps,\n Group,\n MantineNumberSize,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useId} from '@mantine/hooks';\nimport {ReactNode} from 'react';\nimport {DragDropContext, Droppable} from 'react-beautiful-dnd';\n\nimport {useControlledList} from '../../hooks';\nimport {CollectionItem} from './CollectionItem';\nimport useStyles from './Colllection.styles';\n\ninterface CollectionProps<T> extends DefaultProps<Selectors<typeof useStyles>> {\n newItem: T;\n children: (item: T, index: number) => ReactNode;\n defaultValue?: T[];\n value?: T[];\n onFocus?: () => void;\n onChange?: (value: T[]) => void;\n onRemoveItem?: (itemIndex: number) => void;\n draggable?: boolean;\n disabled?: boolean;\n allowAdd?: (values: T[]) => boolean;\n addLabel?: string;\n addDisabledTooltip?: string;\n spacing?: MantineNumberSize;\n required?: boolean;\n}\n\nconst defaultProps: Partial<CollectionProps<unknown>> = {\n draggable: false,\n addLabel: 'Add item',\n addDisabledTooltip: 'There is already an empty item',\n disabled: false,\n spacing: 'xs',\n required: false,\n};\n\nexport const Collection = <T,>(props: CollectionProps<T>) => {\n const {\n value,\n defaultValue,\n onChange,\n onRemoveItem,\n disabled,\n draggable,\n children,\n spacing,\n required,\n newItem,\n addLabel,\n addDisabledTooltip,\n allowAdd,\n\n // Style props\n classNames,\n className,\n styles,\n unstyled,\n\n ...others\n } = useComponentDefaultProps('Collection', defaultProps as CollectionProps<T>, props);\n const {classes, cx} = useStyles(null, {classNames, name: 'Collection', styles, unstyled});\n const collectionID = useId('dnd-droppable');\n\n const [values, {append, remove, reorder}] = useControlledList({value, onChange, defaultValue});\n const hasOnlyOneItem = values.length === 1;\n const removeItem = (index: number) => () => {\n remove(index);\n onRemoveItem?.(index);\n };\n\n const items = values.map((item, index) => (\n <CollectionItem\n key={index}\n disabled={disabled}\n draggable={draggable}\n index={index}\n onRemove={removeItem(index)}\n styles={styles}\n removable={!(required && hasOnlyOneItem)}\n >\n {children(item, index)}\n </CollectionItem>\n ));\n\n const addAllowed = allowAdd?.(values) ?? true;\n\n const _addButton = disabled ? null : (\n <Group>\n <Tooltip label={addDisabledTooltip} disabled={addAllowed}>\n <Box>\n <Button\n variant=\"subtle\"\n leftIcon={<AddSize16Px height={16} />}\n onClick={() => append(newItem)}\n disabled={!addAllowed}\n >\n {addLabel}\n </Button>\n </Box>\n </Tooltip>\n </Group>\n );\n\n return (\n <DragDropContext\n onDragEnd={({destination, source}) => reorder({from: source.index, to: destination?.index || 0})}\n >\n <Droppable direction=\"vertical\" droppableId={collectionID}>\n {(provided) => (\n <Box\n {...provided.droppableProps}\n ref={provided.innerRef}\n className={cx(classes.root, className)}\n {...others}\n >\n <Stack spacing={spacing}>\n {items}\n {provided.placeholder}\n {_addButton}\n </Stack>\n </Box>\n )}\n </Droppable>\n </DragDropContext>\n );\n};\n"],"names":["AddSize16Px","Box","Button","Group","Stack","Tooltip","useComponentDefaultProps","useId","DragDropContext","Droppable","useControlledList","CollectionItem","useStyles","defaultProps","draggable","addLabel","addDisabledTooltip","disabled","spacing","required","Collection","props","value","defaultValue","onChange","onRemoveItem","children","newItem","allowAdd","classNames","className","styles","unstyled","others","name","classes","cx","collectionID","values","append","remove","reorder","hasOnlyOneItem","length","removeItem","index","items","map","item","onRemove","removable","addAllowed","_addButton","label","variant","leftIcon","height","onClick","onDragEnd","destination","source","from","to","direction","droppableId","provided","droppableProps","ref","innerRef","root","placeholder"],"mappings":"AAAA;;;;;AAAA,SAAQA,WAAW,QAAO,6BAA6B,CAAC;AACxD,SACIC,GAAG,EACHC,MAAM,EAENC,KAAK,EAGLC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,eAAe,CAAC;AACvB,SAAQC,KAAK,QAAO,gBAAgB,CAAC;AAErC,SAAQC,eAAe,EAAEC,SAAS,QAAO,qBAAqB,CAAC;AAE/D,SAAQC,iBAAiB,QAAO,aAAa,CAAC;AAC9C,SAAQC,cAAc,QAAO,kBAAkB,CAAC;AAChD,OAAOC,SAAS,MAAM,sBAAsB,CAAC;AAmB7C,IAAMC,YAAY,GAAsC;IACpDC,SAAS,EAAE,KAAK;IAChBC,QAAQ,E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AACC,cAAc;oBAC3BC,GAAG,EAAEF,QAAQ,CAACG,QAAQ;oBACtBtC,SAAS,EAAEM,EAAE,CAACD,OAAO,CAACkC,IAAI,EAAEvC,SAAS,CAAC;oBAClCG,MAAM;8BAEV,cAAA,MAAC7B,KAAK;wBAACc,OAAO,EAAEA,OAAO;;4BAClB4B,KAAK;4BACLmB,QAAQ,CAACK,WAAW;4BACpBlB,UAAU;;sBACP;mBACN;aACT;UACO;MACE,CACpB;AACN,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/collection/Collection.tsx"],"sourcesContent":["import {AddSize16Px} from '@coveord/plasma-react-icons';\nimport {\n Box,\n Button,\n DefaultProps,\n Group,\n MantineNumberSize,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useId} from '@mantine/hooks';\nimport {ReactNode} from 'react';\nimport {DragDropContext, Droppable} from 'react-beautiful-dnd';\n\nimport {useControlledList} from '../../hooks';\nimport {CollectionItem} from './CollectionItem';\nimport useStyles from './Colllection.styles';\n\ninterface CollectionProps<T> extends DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The default value each new item should have\n */\n newItem: T;\n /**\n * A render function called for each item passed in the `value` prop.\n *\n * @param item The current item's value\n * @param index The current item's index\n */\n children: (item: T, index: number) => ReactNode;\n /**\n * The list of items to display inside the collection\n *\n * @default []\n */\n value?: T[];\n /**\n * The initial items of the collection (for uncontrolled usage only)\n */\n defaultValue?: T[];\n /**\n * Unused, has no effect\n */\n onFocus?: () => void;\n /**\n * Function called whenever the value needs to be updated\n *\n * @param value The whole list of items after the change\n */\n onChange?: (value: T[]) => void;\n /**\n * Function called after an item is removed from the collection using the remove button\n *\n * @param itemIndex The index of the item that was removed\n */\n onRemoveItem?: (itemIndex: number) => void;\n /**\n * Whether the collection should have drag and drop behavior enabled\n *\n * @default false\n */\n draggable?: boolean;\n /**\n * Whether the collection is disabled, or in other words in read only mode\n *\n * @default false\n */\n disabled?: boolean;\n /**\n * Function that determines if the add item button should be enabled given the current items of the collection.\n * The button is always enabled if this props remains undefined\n *\n * @param values The current items of the collection\n */\n allowAdd?: (values: T[]) => boolean;\n /**\n * The label of the add item button\n *\n * @default \"Add item\"\n */\n addLabel?: string;\n /**\n * The tooltip text displayed when hovering over the disabled add item button\n *\n * @default 'There is already an empty item'\n */\n addDisabledTooltip?: string;\n /**\n * The spacing between the colleciton items\n *\n * @default 'xs'\n */\n spacing?: MantineNumberSize;\n /**\n * Whether the collection is required. When required is true, the collection will hide the remove button if there is only one item\n *\n * @default false\n */\n required?: boolean;\n}\n\nconst defaultProps: Partial<CollectionProps<unknown>> = {\n draggable: false,\n addLabel: 'Add item',\n addDisabledTooltip: 'There is already an empty item',\n disabled: false,\n spacing: 'xs',\n required: false,\n};\n\nexport const Collection = <T,>(props: CollectionProps<T>) => {\n const {\n value,\n defaultValue,\n onChange,\n onRemoveItem,\n disabled,\n draggable,\n children,\n spacing,\n required,\n newItem,\n addLabel,\n addDisabledTooltip,\n allowAdd,\n\n // Style props\n classNames,\n className,\n styles,\n unstyled,\n\n ...others\n } = useComponentDefaultProps('Collection', defaultProps as CollectionProps<T>, props);\n const {classes, cx} = useStyles(null, {classNames, name: 'Collection', styles, unstyled});\n const collectionID = useId('dnd-droppable');\n\n const [values, {append, remove, reorder}] = useControlledList({value, onChange, defaultValue});\n const hasOnlyOneItem = values.length === 1;\n const removeItem = (index: number) => () => {\n remove(index);\n onRemoveItem?.(index);\n };\n\n const items = values.map((item, index) => (\n <CollectionItem\n key={index}\n disabled={disabled}\n draggable={draggable}\n index={index}\n onRemove={removeItem(index)}\n styles={styles}\n removable={!(required && hasOnlyOneItem)}\n >\n {children(item, index)}\n </CollectionItem>\n ));\n\n const addAllowed = allowAdd?.(values) ?? true;\n\n const _addButton = disabled ? null : (\n <Group>\n <Tooltip label={addDisabledTooltip} disabled={addAllowed}>\n <Box>\n <Button\n variant=\"subtle\"\n leftIcon={<AddSize16Px height={16} />}\n onClick={() => append(newItem)}\n disabled={!addAllowed}\n >\n {addLabel}\n </Button>\n </Box>\n </Tooltip>\n </Group>\n );\n\n return (\n <DragDropContext\n onDragEnd={({destination, source}) => reorder({from: source.index, to: destination?.index || 0})}\n >\n <Droppable direction=\"vertical\" droppableId={collectionID}>\n {(provided) => (\n <Box\n {...provided.droppableProps}\n ref={provided.innerRef}\n className={cx(classes.root, className)}\n {...others}\n >\n <Stack spacing={spacing}>\n {items}\n {provided.placeholder}\n {_addButton}\n </Stack>\n </Box>\n )}\n </Droppable>\n </DragDropContext>\n );\n};\n"],"names":["AddSize16Px","Box","Button","Group","Stack","Tooltip","useComponentDefaultProps","useId","DragDropContext","Droppable","useControlledList","CollectionItem","useStyles","defaultProps","draggable","addLabel","addDisabledTooltip","disabled","spacing","required","Collection","props","value","defaultValue","onChange","onRemoveItem","children","newItem","allowAdd","classNames","className","styles","unstyled","others","name","classes","cx","collectionID","values","append","remove","reorder","hasOnlyOneItem","length","removeItem","index","items","map","item","onRemove","removable","addAllowed","_addButton","label","variant","leftIcon","height","onClick","onDragEnd","destination","source","from","to","direction","droppableId","provided","droppableProps","ref","innerRef","root","placeholder"],"mappings":"AAAA;;;;;AAAA,SAAQA,WAAW,QAAO,8BAA8B;AACxD,SACIC,GAAG,EACHC,MAAM,EAENC,KAAK,EAGLC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,gBAAgB;AACvB,SAAQC,KAAK,QAAO,iBAAiB;AAErC,SAAQC,eAAe,EAAEC,SAAS,QAAO,sBAAsB;AAE/D,SAAQC,iBAAiB,QAAO,cAAc;AAC9C,SAAQC,cAAc,QAAO,mBAAmB;AAChD,OAAOC,eAAe,uBAAuB;AAqF7C,IAAMC,eAAkD;IACpDC,WAAW,KAAK;IAChBC,UAAU;IACVC,oBAAoB;IACpBC,UAAU,KAAK;IACfC,SAAS;IACTC,UAAU,KAAK;AACnB;AAEA,OAAO,IAAMC,aAAa,SAAKC,OAA8B;IACzD,IAsBIf,4BAAAA,yBAAyB,cAA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B,cAAa;sBAErChB,SAASsB,MAAMH;WARXA;;QAYMjB;IAAnB,IAAMuB,aAAavB,CAAAA,OAAAA,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAWU,qBAAXV,kBAAAA,OAAsB,IAAI;IAE7C,IAAMwB,aAAanC,WAAW,IAAI,iBAC9B,KAACd;kBACG,cAAA,KAACE;YAAQgD,OAAOrC;YAAoBC,UAAUkC;sBAC1C,cAAA,KAAClD;0BACG,cAAA,KAACC;oBACGoD,SAAQ;oBACRC,wBAAU,KAACvD;wBAAYwD,QAAQ;;oBAC/BC,SAAS;+BAAMlB,OAAOZ;;oBACtBV,UAAU,CAACkC;8BAEVpC;;;;MAKpB;IAED,qBACI,KAACP;QACGkD,WAAW;gBAAEC,oBAAAA,aAAaC,eAAAA;YAAYnB,OAAAA,QAAQ;gBAACoB,MAAMD,OAAOf,KAAK;gBAAEiB,IAAIH,CAAAA,wBAAAA,yBAAAA,KAAAA,IAAAA,YAAad,KAAK,AAAD,KAAK;YAAC;;kBAE9F,cAAA,KAACpC;YAAUsD,WAAU;YAAWC,aAAa3B;sBACxC,SAAC4B;qCACE,KAAChE,iFACOgE,SAASC,cAAc;oBAC3BC,KAAKF,SAASG,QAAQ;oBACtBtC,WAAWM,GAAGD,QAAQkC,IAAI,EAAEvC;oBACxBG;8BAEJ,cAAA,MAAC7B;wBAAMc,SAASA;;4BACX4B;4BACAmB,SAASK,WAAW;4BACpBlB;;;;;;;AAO7B,EAAE"}
@@ -26,11 +26,11 @@ var RemoveButtonPlaceholder = function() {
26
26
  });
27
27
  };
28
28
  var StaticCollectionItem = function(param) {
29
- var onRemove = param.onRemove, _removable = param.removable, removable = _removable === void 0 ? true : _removable, styles = param.styles, children = param.children;
30
- var ref = useStyles(null, {
29
+ var onRemove = param.onRemove, _param_removable = param.removable, removable = _param_removable === void 0 ? true : _param_removable, styles = param.styles, children = param.children;
30
+ var _useStyles = useStyles(null, {
31
31
  name: "Collection",
32
32
  styles: styles
33
- }), classes = ref.classes, cx = ref.cx;
33
+ }), classes = _useStyles.classes, cx = _useStyles.cx;
34
34
  var removeButton = removable && onRemove ? /*#__PURE__*/ _jsx(RemoveButton, {
35
35
  onClick: onRemove
36
36
  }) : /*#__PURE__*/ _jsx(RemoveButtonPlaceholder, {});
@@ -44,18 +44,18 @@ var StaticCollectionItem = function(param) {
44
44
  };
45
45
  var DisabledCollectionItem = function(param) {
46
46
  var children = param.children;
47
- var ref = useStyles(), classes = ref.classes, cx = ref.cx;
47
+ var _useStyles = useStyles(), classes = _useStyles.classes, cx = _useStyles.cx;
48
48
  return /*#__PURE__*/ _jsx(Group, {
49
49
  className: cx(classes.item),
50
50
  children: children
51
51
  });
52
52
  };
53
53
  var DraggableCollectionItem = function(param) {
54
- var index = param.index, onRemove = param.onRemove, _removable = param.removable, removable = _removable === void 0 ? true : _removable, styles = param.styles, children = param.children;
55
- var ref = useStyles(null, {
54
+ var index = param.index, onRemove = param.onRemove, _param_removable = param.removable, removable = _param_removable === void 0 ? true : _param_removable, styles = param.styles, children = param.children;
55
+ var _useStyles = useStyles(null, {
56
56
  name: "Collection",
57
57
  styles: styles
58
- }), classes = ref.classes, cx = ref.cx;
58
+ }), classes = _useStyles.classes, cx = _useStyles.cx;
59
59
  var removeButton = removable && onRemove ? /*#__PURE__*/ _jsx(RemoveButton, {
60
60
  onClick: onRemove
61
61
  }) : null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/collection/CollectionItem.tsx"],"sourcesContent":["import {DragAndDropSize16Px, RemoveSize16Px} from '@coveord/plasma-react-icons';\nimport {ActionIcon, DefaultProps, Group, Selectors} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\nimport {Draggable} from 'react-beautiful-dnd';\n\nimport useStyles from './Colllection.styles';\n\ninterface CollectionItemProps extends CollectionItemSharedProps {\n draggable?: boolean;\n disabled: boolean;\n}\n\ninterface CollectionItemSharedProps extends DefaultProps<Selectors<typeof useStyles>> {\n index: number;\n onRemove?: React.MouseEventHandler<HTMLButtonElement>;\n removable?: boolean;\n}\n\nconst RemoveButton: FunctionComponent<{\n onClick: React.MouseEventHandler<HTMLButtonElement>;\n}> = ({onClick}) => (\n <ActionIcon variant=\"subtle\" onClick={onClick} color=\"action\">\n <RemoveSize16Px height={16} />\n </ActionIcon>\n);\n\nconst RemoveButtonPlaceholder = () => <div style={{width: 28}} />;\n\nconst StaticCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({\n onRemove,\n removable = true,\n styles,\n children,\n}) => {\n const {classes, cx} = useStyles(null, {name: 'Collection', styles});\n const removeButton = removable && onRemove ? <RemoveButton onClick={onRemove} /> : <RemoveButtonPlaceholder />;\n\n return (\n <Group className={cx(classes.item)}>\n {children}\n {removeButton}\n </Group>\n );\n};\n\nconst DisabledCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({children}) => {\n const {classes, cx} = useStyles();\n return <Group className={cx(classes.item)}>{children}</Group>;\n};\n\nconst DraggableCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({\n index,\n onRemove,\n removable = true,\n styles,\n children,\n}) => {\n const {classes, cx} = useStyles(null, {name: 'Collection', styles});\n const removeButton = removable && onRemove ? <RemoveButton onClick={onRemove} /> : null;\n\n return (\n <Draggable index={index} draggableId={index.toString()}>\n {(provided, {isDragging}) => (\n <Group\n ref={provided.innerRef}\n {...provided.draggableProps}\n className={cx(classes.item, {[classes.itemDragging]: isDragging})}\n >\n <div {...provided.dragHandleProps}>\n <DragAndDropSize16Px height={16} />\n </div>\n {children}\n {removeButton}\n </Group>\n )}\n </Draggable>\n );\n};\n\nexport const CollectionItem: FunctionComponent<PropsWithChildren<CollectionItemProps>> = ({\n draggable,\n disabled,\n ...otherProps\n}) => {\n if (disabled) {\n return <DisabledCollectionItem {...otherProps} />;\n }\n if (draggable) {\n return <DraggableCollectionItem {...otherProps} />;\n }\n return <StaticCollectionItem {...otherProps} />;\n};\n"],"names":["DragAndDropSize16Px","RemoveSize16Px","ActionIcon","Group","Draggable","useStyles","RemoveButton","onClick","variant","color","height","RemoveButtonPlaceholder","div","style","width","StaticCollectionItem","onRemove","removable","styles","children","name","classes","cx","removeButton","className","item","DisabledCollectionItem","DraggableCollectionItem","index","draggableId","toString","provided","isDragging","ref","innerRef","draggableProps","itemDragging","dragHandleProps","CollectionItem","draggable","disabled","otherProps"],"mappings":"AAAA;;;;;AAAA,SAAQA,mBAAmB,EAAEC,cAAc,QAAO,6BAA6B,CAAC;AAChF,SAAQC,UAAU,EAAgBC,KAAK,QAAkB,eAAe,CAAC;AAEzE,SAAQC,SAAS,QAAO,qBAAqB,CAAC;AAE9C,OAAOC,SAAS,MAAM,sBAAsB,CAAC;AAa7C,IAAMC,YAAY,GAEb;QAAEC,OAAO,SAAPA,OAAO;yBACV,KAACL,UAAU;QAACM,OAAO,EAAC,QAAQ;QAACD,OAAO,EAAEA,OAAO;QAAEE,KAAK,EAAC,QAAQ;kBACzD,cAAA,KAACR,cAAc;YAACS,MAAM,EAAE,EAAE;UAAI;MACrB;CAChB,AAAC;AAEF,IAAMC,uBAAuB,GAAG;yBAAM,KAACC,KAAG;QAACC,KAAK,EAAE;YAACC,KAAK,EAAE,EAAE;SAAC;MAAI;CAAA,AAAC;AAElE,IAAMC,oBAAoB,GAAoE,gBAKxF;QAJFC,QAAQ,SAARA,QAAQ,qBACRC,SAAS,EAATA,SAAS,2BAAG,IAAI,aAAA,EAChBC,MAAM,SAANA,MAAM,EACNC,QAAQ,SAARA,QAAQ;IAER,IAAsBd,GAA6C,GAA7CA,SAAS,CAAC,IAAI,EAAE;QAACe,IAAI,EAAE,YAAY;QAAEF,MAAM,EAANA,MAAM;KAAC,CAAC,EAA5DG,OAAO,GAAQhB,GAA6C,CAA5DgB,OAAO,EAAEC,EAAE,GAAIjB,GAA6C,CAAnDiB,EAAE,AAAkD;IACpE,IAAMC,YAAY,GAAGN,SAAS,IAAID,QAAQ,iBAAG,KAACV,YAAY;QAACC,OAAO,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G,QAAQ;eAClBH,QAAQ,CAACI,cAAc;gBAC3BX,SAAS,EAAEF,EAAE,CAACD,OAAO,CAACI,IAAI,EAAG,qBAACJ,OAAO,CAACe,YAAY,EAAGJ,UAAU,CAAA,CAAE;;kCAEjE,KAACpB,KAAG,0CAAKmB,QAAQ,CAACM,eAAe;kCAC7B,cAAA,KAACrC,mBAAmB;4BAACU,MAAM,EAAE,EAAE;0BAAI;uBACjC;oBACLS,QAAQ;oBACRI,YAAY;;eACT;SACX;MACO,CACd;AACN,CAAC,AAAC;AAEF,OAAO,IAAMe,cAAc,GAA8D,iBAInF;QAHFC,SAAS,UAATA,SAAS,EACTC,QAAQ,UAARA,QAAQ,EACLC,UAAU;QAFbF,WAAS;QACTC,UAAQ;;IAGR,IAAIA,QAAQ,EAAE;QACV,qBAAO,KAACd,sBAAsB,qBAAKe,UAAU,EAAI,CAAC;IACtD,CAAC;IACD,IAAIF,SAAS,EAAE;QACX,qBAAO,KAACZ,uBAAuB,qBAAKc,UAAU,EAAI,CAAC;IACvD,CAAC;IACD,qBAAO,KAAC1B,oBAAoB,qBAAK0B,UAAU,EAAI,CAAC;AACpD,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/collection/CollectionItem.tsx"],"sourcesContent":["import {DragAndDropSize16Px, RemoveSize16Px} from '@coveord/plasma-react-icons';\nimport {ActionIcon, DefaultProps, Group, Selectors} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\nimport {Draggable} from 'react-beautiful-dnd';\n\nimport useStyles from './Colllection.styles';\n\ninterface CollectionItemProps extends CollectionItemSharedProps {\n draggable?: boolean;\n disabled: boolean;\n}\n\ninterface CollectionItemSharedProps extends DefaultProps<Selectors<typeof useStyles>> {\n index: number;\n onRemove?: React.MouseEventHandler<HTMLButtonElement>;\n removable?: boolean;\n}\n\nconst RemoveButton: FunctionComponent<{\n onClick: React.MouseEventHandler<HTMLButtonElement>;\n}> = ({onClick}) => (\n <ActionIcon variant=\"subtle\" onClick={onClick} color=\"action\">\n <RemoveSize16Px height={16} />\n </ActionIcon>\n);\n\nconst RemoveButtonPlaceholder = () => <div style={{width: 28}} />;\n\nconst StaticCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({\n onRemove,\n removable = true,\n styles,\n children,\n}) => {\n const {classes, cx} = useStyles(null, {name: 'Collection', styles});\n const removeButton = removable && onRemove ? <RemoveButton onClick={onRemove} /> : <RemoveButtonPlaceholder />;\n\n return (\n <Group className={cx(classes.item)}>\n {children}\n {removeButton}\n </Group>\n );\n};\n\nconst DisabledCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({children}) => {\n const {classes, cx} = useStyles();\n return <Group className={cx(classes.item)}>{children}</Group>;\n};\n\nconst DraggableCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({\n index,\n onRemove,\n removable = true,\n styles,\n children,\n}) => {\n const {classes, cx} = useStyles(null, {name: 'Collection', styles});\n const removeButton = removable && onRemove ? <RemoveButton onClick={onRemove} /> : null;\n\n return (\n <Draggable index={index} draggableId={index.toString()}>\n {(provided, {isDragging}) => (\n <Group\n ref={provided.innerRef}\n {...provided.draggableProps}\n className={cx(classes.item, {[classes.itemDragging]: isDragging})}\n >\n <div {...provided.dragHandleProps}>\n <DragAndDropSize16Px height={16} />\n </div>\n {children}\n {removeButton}\n </Group>\n )}\n </Draggable>\n );\n};\n\nexport const CollectionItem: FunctionComponent<PropsWithChildren<CollectionItemProps>> = ({\n draggable,\n disabled,\n ...otherProps\n}) => {\n if (disabled) {\n return <DisabledCollectionItem {...otherProps} />;\n }\n if (draggable) {\n return <DraggableCollectionItem {...otherProps} />;\n }\n return <StaticCollectionItem {...otherProps} />;\n};\n"],"names":["DragAndDropSize16Px","RemoveSize16Px","ActionIcon","Group","Draggable","useStyles","RemoveButton","onClick","variant","color","height","RemoveButtonPlaceholder","div","style","width","StaticCollectionItem","onRemove","removable","styles","children","name","classes","cx","removeButton","className","item","DisabledCollectionItem","DraggableCollectionItem","index","draggableId","toString","provided","isDragging","ref","innerRef","draggableProps","itemDragging","dragHandleProps","CollectionItem","draggable","disabled","otherProps"],"mappings":"AAAA;;;;;AAAA,SAAQA,mBAAmB,EAAEC,cAAc,QAAO,8BAA8B;AAChF,SAAQC,UAAU,EAAgBC,KAAK,QAAkB,gBAAgB;AAEzE,SAAQC,SAAS,QAAO,sBAAsB;AAE9C,OAAOC,eAAe,uBAAuB;AAa7C,IAAMC,eAED;QAAEC,gBAAAA;yBACH,KAACL;QAAWM,SAAQ;QAASD,SAASA;QAASE,OAAM;kBACjD,cAAA,KAACR;YAAeS,QAAQ;;;;AAIhC,IAAMC,0BAA0B;yBAAM,KAACC;QAAIC,OAAO;YAACC,OAAO;QAAE;;;AAE5D,IAAMC,uBAAwF,gBAKxF;QAJFC,iBAAAA,mCACAC,WAAAA,0CAAY,IAAI,qBAChBC,eAAAA,QACAC,iBAAAA;IAEA,IAAsBd,aAAAA,UAAU,IAAI,EAAE;QAACe,MAAM;QAAcF,QAAAA;IAAM,IAA1DG,UAAehB,WAAfgB,SAASC,KAAMjB,WAANiB;IAChB,IAAMC,eAAeN,aAAaD,yBAAW,KAACV;QAAaC,SAASS;uBAAe,KAACL,4BAA0B;IAE9G,qBACI,MAACR;QAAMqB,WAAWF,GAAGD,QAAQI,IAAI;;YAC5BN;YACAI;;;AAGb;AAEA,IAAMG,yBAA0F,gBAAgB;QAAdP,iBAAAA;IAC9F,IAAsBd,aAAAA,aAAfgB,UAAehB,WAAfgB,SAASC,KAAMjB,WAANiB;IAChB,qBAAO,KAACnB;QAAMqB,WAAWF,GAAGD,QAAQI,IAAI;kBAAIN;;AAChD;AAEA,IAAMQ,0BAA2F,gBAM3F;QALFC,cAAAA,OACAZ,iBAAAA,mCACAC,WAAAA,0CAAY,IAAI,qBAChBC,eAAAA,QACAC,iBAAAA;IAEA,IAAsBd,aAAAA,UAAU,IAAI,EAAE;QAACe,MAAM;QAAcF,QAAAA;IAAM,IAA1DG,UAAehB,WAAfgB,SAASC,KAAMjB,WAANiB;IAChB,IAAMC,eAAeN,aAAaD,yBAAW,KAACV;QAAaC,SAASS;SAAe,IAAI;IAEvF,qBACI,KAACZ;QAAUwB,OAAOA;QAAOC,aAAaD,MAAME,QAAQ;kBAC/C,SAACC;gBAAWC,mBAAAA;iCACT,MAAC7B;gBACG8B,KAAKF,SAASG,QAAQ;eAClBH,SAASI,cAAc;gBAC3BX,WAAWF,GAAGD,QAAQI,IAAI,EAAG,qBAACJ,QAAQe,YAAY,EAAGJ;;kCAErD,KAACpB,+CAAQmB,SAASM,eAAe;kCAC7B,cAAA,KAACrC;4BAAoBU,QAAQ;;;oBAEhCS;oBACAI;;;;;AAKrB;AAEA,OAAO,IAAMe,iBAA4E,iBAInF;QAHFC,mBAAAA,WACAC,kBAAAA,UACGC;QAFHF;QACAC;;IAGA,IAAIA,UAAU;QACV,qBAAO,KAACd,2CAA2Be;IACvC,CAAC;IACD,IAAIF,WAAW;QACX,qBAAO,KAACZ,4CAA4Bc;IACxC,CAAC;IACD,qBAAO,KAAC1B,yCAAyB0B;AACrC,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/collection/Colllection.styles.ts"],"sourcesContent":["import {createStyles} from '@mantine/core';\n\nexport interface CollectionStylesParams {}\n\nexport default createStyles((theme) => ({\n root: {},\n item: {\n backgroundColor: theme.colorScheme === 'light' ? theme.white : theme.black,\n alignItems: 'baseline',\n },\n itemDragging: {\n boxShadow: theme.shadows.sm,\n },\n}));\n"],"names":["createStyles","theme","root","item","backgroundColor","colorScheme","white","black","alignItems","itemDragging","boxShadow","shadows","sm"],"mappings":"AAAA,SAAQA,YAAY,QAAO,eAAe,CAAC;AAI3C,eAAeA,YAAY,CAAC,SAACC,KAAK;WAAM;QACpCC,IAAI,EAAE,EAAE;QACRC,IAAI,EAAE;YACFC,eAAe,EAAEH,KAAK,CAACI,WAAW,KAAK,OAAO,GAAGJ,KAAK,CAACK,KAAK,GAAGL,KAAK,CAACM,KAAK;YAC1EC,UAAU,EAAE,UAAU;SACzB;QACDC,YAAY,EAAE;YACVC,SAAS,EAAET,KAAK,CAACU,OAAO,CAACC,EAAE;SAC9B;KACJ;CAAC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/collection/Colllection.styles.ts"],"sourcesContent":["import {createStyles} from '@mantine/core';\n\nexport interface CollectionStylesParams {}\n\nexport default createStyles((theme) => ({\n root: {},\n item: {\n backgroundColor: theme.colorScheme === 'light' ? theme.white : theme.black,\n alignItems: 'baseline',\n },\n itemDragging: {\n boxShadow: theme.shadows.sm,\n },\n}));\n"],"names":["createStyles","theme","root","item","backgroundColor","colorScheme","white","black","alignItems","itemDragging","boxShadow","shadows","sm"],"mappings":"AAAA,SAAQA,YAAY,QAAO,gBAAgB;AAI3C,eAAeA,aAAa,SAACC;WAAW;QACpCC,MAAM,CAAC;QACPC,MAAM;YACFC,iBAAiBH,MAAMI,WAAW,KAAK,UAAUJ,MAAMK,KAAK,GAAGL,MAAMM,KAAK;YAC1EC,YAAY;QAChB;QACAC,cAAc;YACVC,WAAWT,MAAMU,OAAO,CAACC,EAAE;QAC/B;IACJ;GAAI"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/collection/index.ts"],"sourcesContent":["export * from './Collection';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/collection/index.ts"],"sourcesContent":["export * from './Collection';\n"],"names":[],"mappings":"AAAA,cAAc,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/date-range-picker/DateRangePickerInlineCalendar.tsx"],"sourcesContent":["import {Button, Center, Group, Space} from '@mantine/core';\nimport {DateRangePickerValue, RangeCalendar, RangeCalendarProps} from '@mantine/dates';\nimport {useForm} from '@mantine/form';\n\nimport {DateRangePickerPreset, DateRangePickerPresetSelect} from './DateRangePickerPresetSelect';\nimport {EditableDateRangePicker, EditableDateRangePickerProps} from './EditableDateRangePicker';\n\nexport interface DateRangePickerInlineCalendarProps\n extends Pick<EditableDateRangePickerProps, 'startProps' | 'endProps'> {\n /**\n * Initial selected range\n */\n initialRange: DateRangePickerValue;\n /**\n * Function called when the user applies the new date range\n *\n * @param range the newly selected dates\n */\n onApply: (range: DateRangePickerValue) => void;\n /**\n * Function called when the user click on the cancel button\n */\n onCancel: () => void;\n /**\n * The presets to display\n *\n * @default {}\n * @example\n * {\n * january: {label: 'January', range: [new Date(2022, 0, 1), new Date(2022, 0, 31)]},\n * february: {label: 'February', range: [new Date(2022, 1, 1), new Date(2022, 1, 28)]}\n * }\n */\n presets?: Record<string, DateRangePickerPreset>;\n /**\n * Props for RangeCalendar displayed in the popover\n */\n rangeCalendarProps?: Omit<RangeCalendarProps, 'value' | 'onChange'>;\n}\n\nexport const DateRangePickerInlineCalendar = ({\n initialRange,\n onApply,\n onCancel,\n presets,\n startProps,\n endProps,\n rangeCalendarProps,\n}: DateRangePickerInlineCalendarProps) => {\n const form = useForm({\n initialValues: {\n dates: initialRange,\n },\n });\n const calendarInputProps = form.getInputProps('dates');\n\n const onCalendarApply = () => {\n onApply(form.values.dates);\n };\n\n return (\n <>\n <Group\n align=\"center\"\n spacing=\"xs\"\n grow\n px=\"md\"\n py=\"sm\"\n sx={(theme) => ({\n borderBottom: `1px solid ${theme.colors.gray[2]}`,\n })}\n >\n <EditableDateRangePicker {...calendarInputProps} startProps={startProps} endProps={endProps} />\n {presets ? (\n <>\n <Space w=\"sm\" />\n <DateRangePickerPresetSelect presets={presets} {...calendarInputProps} />\n </>\n ) : null}\n </Group>\n\n <Center py=\"sm\" px=\"md\">\n <RangeCalendar\n amountOfMonths={2}\n styles={{cell: {textAlign: 'center'}}}\n firstDayOfWeek=\"sunday\"\n allowSingleDateInRange\n {...rangeCalendarProps}\n {...calendarInputProps}\n />\n </Center>\n\n <Group\n position=\"right\"\n spacing=\"xs\"\n px=\"md\"\n py=\"sm\"\n sx={(theme) => ({\n borderTop: `1px solid ${theme.colors.gray[2]}`,\n })}\n >\n <Button size=\"xs\" onClick={onCalendarApply}>\n Apply\n </Button>\n <Button variant=\"outline\" size=\"xs\" onClick={onCancel}>\n Cancel\n </Button>\n </Group>\n </>\n );\n};\n"],"names":["Button","Center","Group","Space","RangeCalendar","useForm","DateRangePickerPresetSelect","EditableDateRangePicker","DateRangePickerInlineCalendar","initialRange","onApply","onCancel","presets","startProps","endProps","rangeCalendarProps","form","initialValues","dates","calendarInputProps","getInputProps","onCalendarApply","values","align","spacing","grow","px","py","sx","theme","borderBottom","colors","gray","w","amountOfMonths","styles","cell","textAlign","firstDayOfWeek","allowSingleDateInRange","position","borderTop","size","onClick","variant"],"mappings":"AAAA;;;AAAA,SAAQA,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAEC,KAAK,QAAO,eAAe,CAAC;AAC3D,SAA8BC,aAAa,QAA2B,gBAAgB,CAAC;AACvF,SAAQC,OAAO,QAAO,eAAe,CAAC;AAEtC,SAA+BC,2BAA2B,QAAO,+BAA+B,CAAC;AACjG,SAAQC,uBAAuB,QAAqC,2BAA2B,CAAC;AAmChG,OAAO,IAAMC,6BAA6B,GAAG,gBAQH;QAPtCC,YAAY,SAAZA,YAAY,EACZC,OAAO,SAAPA,OAAO,EACPC,QAAQ,SAARA,QAAQ,EACRC,OAAO,SAAPA,OAAO,EACPC,UAAU,SAAVA,UAAU,EACVC,QAAQ,SAARA,QAAQ,EACRC,kBAAkB,SAAlBA,kBAAkB;IAElB,IAAMC,IAAI,GAAGX,OAAO,CAAC;QACjBY,aAAa,EAAE;YACXC,KAAK,EAAET,YAAY;SACtB;KACJ,CAAC,AAAC;IACH,IAAMU,kBAAkB,GAAGH,IAAI,CAACI,aAAa,CAAC,OAAO,CAAC,AAAC;IAEvD,IAAMC,eAAe,GAAG,WAAM;QAC1BX,OAAO,CAACM,IAAI,CAACM,MAAM,CAACJ,KAAK,CAAC,CAAC;IAC/B,CAAC,AAAC;IAEF,qBACI;;0BACI,MAAChB,KA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C;sBAAS;kCACT,KAACrB,MAAM;wBAAC4C,OAAO,EAAC,SAAS;wBAACF,IAAI,EAAC,IAAI;wBAACC,OAAO,EAAEhC,QAAQ;kCAAE,QAEvD;sBAAS;;cACL;;MACT,CACL;AACN,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/date-range-picker/DateRangePickerInlineCalendar.tsx"],"sourcesContent":["import {Button, Center, Group, Space} from '@mantine/core';\nimport {DateRangePickerValue, RangeCalendar, RangeCalendarProps} from '@mantine/dates';\nimport {useForm} from '@mantine/form';\n\nimport {DateRangePickerPreset, DateRangePickerPresetSelect} from './DateRangePickerPresetSelect';\nimport {EditableDateRangePicker, EditableDateRangePickerProps} from './EditableDateRangePicker';\n\nexport interface DateRangePickerInlineCalendarProps\n extends Pick<EditableDateRangePickerProps, 'startProps' | 'endProps'> {\n /**\n * Initial selected range\n */\n initialRange: DateRangePickerValue;\n /**\n * Function called when the user applies the new date range\n *\n * @param range the newly selected dates\n */\n onApply: (range: DateRangePickerValue) => void;\n /**\n * Function called when the user click on the cancel button\n */\n onCancel: () => void;\n /**\n * The presets to display\n *\n * @default {}\n * @example\n * {\n * january: {label: 'January', range: [new Date(2022, 0, 1), new Date(2022, 0, 31)]},\n * february: {label: 'February', range: [new Date(2022, 1, 1), new Date(2022, 1, 28)]}\n * }\n */\n presets?: Record<string, DateRangePickerPreset>;\n /**\n * Props for RangeCalendar displayed in the popover\n */\n rangeCalendarProps?: Omit<RangeCalendarProps, 'value' | 'onChange'>;\n}\n\nexport const DateRangePickerInlineCalendar = ({\n initialRange,\n onApply,\n onCancel,\n presets,\n startProps,\n endProps,\n rangeCalendarProps,\n}: DateRangePickerInlineCalendarProps) => {\n const form = useForm({\n initialValues: {\n dates: initialRange,\n },\n });\n const calendarInputProps = form.getInputProps('dates');\n\n const onCalendarApply = () => {\n onApply(form.values.dates);\n };\n\n return (\n <>\n <Group\n align=\"center\"\n spacing=\"xs\"\n grow\n px=\"md\"\n py=\"sm\"\n sx={(theme) => ({\n borderBottom: `1px solid ${theme.colors.gray[2]}`,\n })}\n >\n <EditableDateRangePicker {...calendarInputProps} startProps={startProps} endProps={endProps} />\n {presets ? (\n <>\n <Space w=\"sm\" />\n <DateRangePickerPresetSelect presets={presets} {...calendarInputProps} />\n </>\n ) : null}\n </Group>\n\n <Center py=\"sm\" px=\"md\">\n <RangeCalendar\n amountOfMonths={2}\n styles={{cell: {textAlign: 'center'}}}\n firstDayOfWeek=\"sunday\"\n allowSingleDateInRange\n {...rangeCalendarProps}\n {...calendarInputProps}\n />\n </Center>\n\n <Group\n position=\"right\"\n spacing=\"xs\"\n px=\"md\"\n py=\"sm\"\n sx={(theme) => ({\n borderTop: `1px solid ${theme.colors.gray[2]}`,\n })}\n >\n <Button size=\"xs\" onClick={onCalendarApply}>\n Apply\n </Button>\n <Button variant=\"outline\" size=\"xs\" onClick={onCancel}>\n Cancel\n </Button>\n </Group>\n </>\n );\n};\n"],"names":["Button","Center","Group","Space","RangeCalendar","useForm","DateRangePickerPresetSelect","EditableDateRangePicker","DateRangePickerInlineCalendar","initialRange","onApply","onCancel","presets","startProps","endProps","rangeCalendarProps","form","initialValues","dates","calendarInputProps","getInputProps","onCalendarApply","values","align","spacing","grow","px","py","sx","theme","borderBottom","colors","gray","w","amountOfMonths","styles","cell","textAlign","firstDayOfWeek","allowSingleDateInRange","position","borderTop","size","onClick","variant"],"mappings":"AAAA;;;AAAA,SAAQA,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAEC,KAAK,QAAO,gBAAgB;AAC3D,SAA8BC,aAAa,QAA2B,iBAAiB;AACvF,SAAQC,OAAO,QAAO,gBAAgB;AAEtC,SAA+BC,2BAA2B,QAAO,gCAAgC;AACjG,SAAQC,uBAAuB,QAAqC,4BAA4B;AAmChG,OAAO,IAAMC,gCAAgC,gBAQH;QAPtCC,qBAAAA,cACAC,gBAAAA,SACAC,iBAAAA,UACAC,gBAAAA,SACAC,mBAAAA,YACAC,iBAAAA,UACAC,2BAAAA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