react-science 19.2.0 → 19.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/lib/components/accordion/accordion.js +1 -1
  2. package/lib/components/color-picker/react-color/ColorPicker.d.ts.map +1 -1
  3. package/lib/components/color-picker/react-color/ColorPicker.js +7 -5
  4. package/lib/components/color-picker/react-color/ColorPicker.js.map +1 -1
  5. package/lib/components/doi/doi.js +2 -2
  6. package/lib/components/doi/doi.js.map +1 -1
  7. package/lib/components/doi/doi_logo.d.ts +6 -0
  8. package/lib/components/doi/doi_logo.d.ts.map +1 -0
  9. package/lib/components/doi/doi_logo.js +16 -0
  10. package/lib/components/doi/doi_logo.js.map +1 -0
  11. package/lib/components/form/components/input/checkbox.d.ts +3 -1
  12. package/lib/components/form/components/input/checkbox.d.ts.map +1 -1
  13. package/lib/components/form/components/input/checkbox.js +10 -3
  14. package/lib/components/form/components/input/checkbox.js.map +1 -1
  15. package/lib/components/form/components/input/input.d.ts +3 -5
  16. package/lib/components/form/components/input/input.d.ts.map +1 -1
  17. package/lib/components/form/components/input/input.js +4 -3
  18. package/lib/components/form/components/input/input.js.map +1 -1
  19. package/lib/components/form/components/input/numeric_input.d.ts +5 -4
  20. package/lib/components/form/components/input/numeric_input.d.ts.map +1 -1
  21. package/lib/components/form/components/input/numeric_input.js +4 -5
  22. package/lib/components/form/components/input/numeric_input.js.map +1 -1
  23. package/lib/components/form/components/input/select.d.ts +2 -3
  24. package/lib/components/form/components/input/select.d.ts.map +1 -1
  25. package/lib/components/form/components/input/select.js +4 -8
  26. package/lib/components/form/components/input/select.js.map +1 -1
  27. package/lib/components/form/components/input/switch.d.ts +4 -0
  28. package/lib/components/form/components/input/switch.d.ts.map +1 -1
  29. package/lib/components/form/components/input/switch.js +11 -3
  30. package/lib/components/form/components/input/switch.js.map +1 -1
  31. package/lib/components/form/components/input_groups/form.d.ts +8 -0
  32. package/lib/components/form/components/input_groups/form.d.ts.map +1 -0
  33. package/lib/components/form/components/input_groups/form.js +11 -0
  34. package/lib/components/form/components/input_groups/form.js.map +1 -0
  35. package/lib/components/form/components/input_groups/form_context.d.ts +8 -0
  36. package/lib/components/form/components/input_groups/form_context.d.ts.map +1 -0
  37. package/lib/components/form/components/input_groups/form_context.js +8 -0
  38. package/lib/components/form/components/input_groups/form_context.js.map +1 -0
  39. package/lib/components/form/components/input_groups/form_group.d.ts +25 -0
  40. package/lib/components/form/components/input_groups/form_group.d.ts.map +1 -0
  41. package/lib/components/form/components/input_groups/form_group.js +47 -0
  42. package/lib/components/form/components/input_groups/form_group.js.map +1 -0
  43. package/lib/components/form/components/input_groups/select.d.ts +3 -6
  44. package/lib/components/form/components/input_groups/select.d.ts.map +1 -1
  45. package/lib/components/form/components/input_groups/select.js +3 -6
  46. package/lib/components/form/components/input_groups/select.js.map +1 -1
  47. package/lib/components/form/components/layout/Section.d.ts +9 -0
  48. package/lib/components/form/components/layout/Section.d.ts.map +1 -0
  49. package/lib/components/form/components/layout/Section.js +38 -0
  50. package/lib/components/form/components/layout/Section.js.map +1 -0
  51. package/lib/components/form/context/use_ts_form.d.ts +4 -0
  52. package/lib/components/form/context/use_ts_form.d.ts.map +1 -1
  53. package/lib/components/form/context/use_ts_form.js +2 -0
  54. package/lib/components/form/context/use_ts_form.js.map +1 -1
  55. package/lib/components/index.d.ts +1 -0
  56. package/lib/components/index.d.ts.map +1 -1
  57. package/lib/components/index.js +1 -0
  58. package/lib/components/index.js.map +1 -1
  59. package/lib/components/info-panel/InfoPanel.d.ts.map +1 -1
  60. package/lib/components/info-panel/InfoPanel.js +3 -3
  61. package/lib/components/info-panel/InfoPanel.js.map +1 -1
  62. package/lib/components/input/radio-button-group/RadioButton.js +4 -4
  63. package/lib/components/input/radio-button-group/RadioButtonGroup.js +2 -2
  64. package/lib/components/root-layout/css-reset/customPreflight.js +1 -1
  65. package/lib/components/split_pane/use_split_pane_size.d.ts.map +1 -1
  66. package/lib/components/split_pane/use_split_pane_size.js +47 -46
  67. package/lib/components/split_pane/use_split_pane_size.js.map +1 -1
  68. package/lib/components/svg/index.d.ts +5 -0
  69. package/lib/components/svg/index.d.ts.map +1 -0
  70. package/lib/components/svg/index.js +5 -0
  71. package/lib/components/svg/index.js.map +1 -0
  72. package/lib/components/svg/styled/svg_styled_line.d.ts +6 -0
  73. package/lib/components/svg/styled/svg_styled_line.d.ts.map +1 -0
  74. package/lib/components/svg/styled/svg_styled_line.js +7 -0
  75. package/lib/components/svg/styled/svg_styled_line.js.map +1 -0
  76. package/lib/components/svg/styled/svg_styled_path.d.ts +6 -0
  77. package/lib/components/svg/styled/svg_styled_path.d.ts.map +1 -0
  78. package/lib/components/svg/styled/svg_styled_path.js +7 -0
  79. package/lib/components/svg/styled/svg_styled_path.js.map +1 -0
  80. package/lib/components/svg/styled/svg_styled_text.d.ts +6 -0
  81. package/lib/components/svg/styled/svg_styled_text.d.ts.map +1 -0
  82. package/lib/components/svg/styled/svg_styled_text.js +6 -0
  83. package/lib/components/svg/styled/svg_styled_text.js.map +1 -0
  84. package/lib/components/svg/styled/svg_styled_types.d.ts +56 -0
  85. package/lib/components/svg/styled/svg_styled_types.d.ts.map +1 -0
  86. package/lib/components/svg/styled/svg_styled_types.js +2 -0
  87. package/lib/components/svg/styled/svg_styled_types.js.map +1 -0
  88. package/lib/components/svg/styled/svg_styled_utils.d.ts +3 -0
  89. package/lib/components/svg/styled/svg_styled_utils.d.ts.map +1 -0
  90. package/lib/components/svg/styled/svg_styled_utils.js +10 -0
  91. package/lib/components/svg/styled/svg_styled_utils.js.map +1 -0
  92. package/lib/components/table/reorder_rows/draggable_row_tr.js +1 -1
  93. package/lib/components/table/reorder_rows/draggable_row_tr.js.map +1 -1
  94. package/lib/components/table/reorder_rows/item_order_provider.d.ts.map +1 -1
  95. package/lib/components/table/reorder_rows/item_order_provider.js +1 -1
  96. package/lib/components/table/reorder_rows/item_order_provider.js.map +1 -1
  97. package/lib/components/table/reorder_rows/use_drop_monitor.d.ts.map +1 -1
  98. package/lib/components/table/reorder_rows/use_drop_monitor.js +34 -33
  99. package/lib/components/table/reorder_rows/use_drop_monitor.js.map +1 -1
  100. package/lib/components/toolbar/PanelPreferencesToolbar.js +1 -1
  101. package/lib/components/toolbar/Toolbar.d.ts.map +1 -1
  102. package/lib/components/toolbar/Toolbar.js +5 -4
  103. package/lib/components/toolbar/Toolbar.js.map +1 -1
  104. package/lib/components/toolbar/TooltipHelpContent.js +3 -3
  105. package/package.json +37 -35
  106. package/src/components/accordion/accordion.tsx +1 -1
  107. package/src/components/color-picker/react-color/ColorPicker.tsx +8 -6
  108. package/src/components/doi/doi.tsx +2 -2
  109. package/src/components/doi/{Logo.tsx → doi_logo.tsx} +9 -5
  110. package/src/components/form/components/input/checkbox.tsx +23 -6
  111. package/src/components/form/components/input/input.tsx +35 -15
  112. package/src/components/form/components/input/numeric_input.tsx +30 -15
  113. package/src/components/form/components/input/select.tsx +24 -17
  114. package/src/components/form/components/input/switch.tsx +27 -5
  115. package/src/components/form/components/input_groups/form.tsx +24 -0
  116. package/src/components/form/components/input_groups/form_context.ts +11 -0
  117. package/src/components/form/components/input_groups/form_group.tsx +129 -0
  118. package/src/components/form/components/input_groups/select.tsx +25 -46
  119. package/src/components/form/components/layout/Section.tsx +57 -0
  120. package/src/components/form/context/use_ts_form.ts +2 -0
  121. package/src/components/index.ts +1 -0
  122. package/src/components/info-panel/InfoPanel.tsx +4 -3
  123. package/src/components/input/radio-button-group/RadioButton.tsx +4 -4
  124. package/src/components/input/radio-button-group/RadioButtonGroup.tsx +2 -2
  125. package/src/components/root-layout/css-reset/customPreflight.ts +1 -1
  126. package/src/components/split_pane/use_split_pane_size.tsx +54 -53
  127. package/src/components/svg/index.ts +4 -0
  128. package/src/components/svg/styled/svg_styled_line.tsx +27 -0
  129. package/src/components/svg/styled/svg_styled_path.tsx +29 -0
  130. package/src/components/svg/styled/svg_styled_text.tsx +12 -0
  131. package/src/components/svg/styled/svg_styled_types.ts +67 -0
  132. package/src/components/svg/styled/svg_styled_utils.ts +15 -0
  133. package/src/components/table/reorder_rows/draggable_row_tr.tsx +4 -4
  134. package/src/components/table/reorder_rows/item_order_provider.tsx +1 -2
  135. package/src/components/table/reorder_rows/use_drop_monitor.ts +45 -42
  136. package/src/components/toolbar/PanelPreferencesToolbar.tsx +1 -1
  137. package/src/components/toolbar/Toolbar.tsx +7 -4
  138. package/src/components/toolbar/TooltipHelpContent.tsx +3 -3
  139. package/lib/components/doi/Logo.d.ts +0 -6
  140. package/lib/components/doi/Logo.d.ts.map +0 -1
  141. package/lib/components/doi/Logo.js +0 -16
  142. package/lib/components/doi/Logo.js.map +0 -1
  143. package/lib/components/form/components/hooks/use_input_id.d.ts +0 -8
  144. package/lib/components/form/components/hooks/use_input_id.d.ts.map +0 -1
  145. package/lib/components/form/components/hooks/use_input_id.js +0 -15
  146. package/lib/components/form/components/hooks/use_input_id.js.map +0 -1
  147. package/lib/components/form/components/input_groups/input.d.ts +0 -20
  148. package/lib/components/form/components/input_groups/input.d.ts.map +0 -1
  149. package/lib/components/form/components/input_groups/input.js +0 -9
  150. package/lib/components/form/components/input_groups/input.js.map +0 -1
  151. package/lib/components/pdnd.cjs +0 -29
  152. package/lib/components/pdnd.cjs.map +0 -1
  153. package/lib/components/pdnd.d.cts +0 -10
  154. package/lib/components/pdnd.d.cts.map +0 -1
  155. package/src/components/form/components/hooks/use_input_id.ts +0 -19
  156. package/src/components/form/components/input_groups/input.tsx +0 -63
  157. package/src/components/pdnd.cts +0 -20
@@ -12,14 +12,14 @@ export interface RadioButtonGroupProps extends RadioGroupProps {
12
12
  const RadioButtonContainer = styled.div<{ size?: RadioProps['size'] }>`
13
13
  display: flex;
14
14
 
15
- & label:first-of-type {
15
+ label:first-of-type {
16
16
  border-bottom-left-radius: ${(props) =>
17
17
  props.size === 'large' ? '6px' : '4px'};
18
18
  border-top-left-radius: ${(props) =>
19
19
  props.size === 'large' ? '6px' : '4px'};
20
20
  }
21
21
 
22
- & label:last-of-type {
22
+ label:last-of-type {
23
23
  border-right-width: 1px;
24
24
  border-bottom-right-radius: ${(props) =>
25
25
  props.size === 'large' ? '6px' : '4px'};
@@ -25,7 +25,7 @@ export const CustomDivPreflight = styled.div`
25
25
  height: 100%;
26
26
  position: relative;
27
27
 
28
- &:fullscreen::backdrop,
28
+ :fullscreen::backdrop,
29
29
  *:fullscreen::backdrop {
30
30
  /* Override user agent default */
31
31
  background-color: white;
@@ -42,63 +42,64 @@ export function useSplitPaneSize(options: UseSplitPaneSizeOptions) {
42
42
  }, [onResize, onSizeChange]);
43
43
 
44
44
  useEffect(() => {
45
- if (isResizing) {
46
- let lastSize: ParsedSplitPaneSize | null = null;
47
- function moveCallback(event: PointerEvent) {
48
- if (!splitterRef.current) return;
49
- const { clientX, clientY } = event;
50
- const parentDiv = splitterRef.current.parentElement as HTMLDivElement;
51
- const bounds = parentDiv.getBoundingClientRect();
52
- const parentDimension =
53
- direction === 'horizontal'
54
- ? parentDiv.clientWidth
55
- : parentDiv.clientHeight;
56
-
57
- const client =
58
- direction === 'horizontal'
59
- ? clientX - bounds.left
60
- : clientY - bounds.top;
61
-
62
- const centralizingValue =
63
- direction === 'horizontal'
64
- ? splitterRef.current.clientWidth / 2
65
- : splitterRef.current.clientHeight / 2;
66
-
67
- const value =
68
- controlledSide === 'start' ? client : parentDimension - client;
69
-
70
- if (sizeType === 'px') {
71
- const newSize = getValueFromSplitter(value - centralizingValue, {
72
- min: 0,
73
- max: parentDimension,
74
- });
75
- lastSize = { value: newSize, type: sizeType };
76
- onSizeChangeRef.current?.(lastSize);
77
- } else if (sizeType === '%') {
78
- const valueDiff = (value / parentDimension) * 100;
79
- const newSize = getValueFromSplitter(valueDiff, {
80
- min: 0,
81
- max: 100,
82
- });
83
- lastSize = { value: newSize, type: sizeType };
84
- onSizeChangeRef.current?.(lastSize);
85
- }
45
+ if (!isResizing) {
46
+ return;
47
+ }
48
+ let lastSize: ParsedSplitPaneSize | null = null;
49
+ function moveCallback(event: PointerEvent) {
50
+ if (!splitterRef.current) return;
51
+ const { clientX, clientY } = event;
52
+ const parentDiv = splitterRef.current.parentElement as HTMLDivElement;
53
+ const bounds = parentDiv.getBoundingClientRect();
54
+ const parentDimension =
55
+ direction === 'horizontal'
56
+ ? parentDiv.clientWidth
57
+ : parentDiv.clientHeight;
58
+
59
+ const client =
60
+ direction === 'horizontal'
61
+ ? clientX - bounds.left
62
+ : clientY - bounds.top;
63
+
64
+ const centralizingValue =
65
+ direction === 'horizontal'
66
+ ? splitterRef.current.clientWidth / 2
67
+ : splitterRef.current.clientHeight / 2;
68
+
69
+ const value =
70
+ controlledSide === 'start' ? client : parentDimension - client;
71
+
72
+ if (sizeType === 'px') {
73
+ const newSize = getValueFromSplitter(value - centralizingValue, {
74
+ min: 0,
75
+ max: parentDimension,
76
+ });
77
+ lastSize = { value: newSize, type: sizeType };
78
+ onSizeChangeRef.current?.(lastSize);
79
+ } else if (sizeType === '%') {
80
+ const valueDiff = (value / parentDimension) * 100;
81
+ const newSize = getValueFromSplitter(valueDiff, {
82
+ min: 0,
83
+ max: 100,
84
+ });
85
+ lastSize = { value: newSize, type: sizeType };
86
+ onSizeChangeRef.current?.(lastSize);
86
87
  }
87
- function upCallback() {
88
- setIsResizing(false);
89
- if (lastSize) {
90
- onResizeRef.current?.(serializeSize(lastSize));
91
- }
88
+ }
89
+ function upCallback() {
90
+ setIsResizing(false);
91
+ if (lastSize) {
92
+ onResizeRef.current?.(serializeSize(lastSize));
92
93
  }
94
+ }
93
95
 
94
- window.addEventListener('pointermove', moveCallback);
95
- window.addEventListener('pointerup', upCallback);
96
+ window.addEventListener('pointermove', moveCallback);
97
+ window.addEventListener('pointerup', upCallback);
96
98
 
97
- return () => {
98
- window.removeEventListener('pointermove', moveCallback);
99
- window.removeEventListener('pointerup', upCallback);
100
- };
101
- }
99
+ return () => {
100
+ window.removeEventListener('pointermove', moveCallback);
101
+ window.removeEventListener('pointerup', upCallback);
102
+ };
102
103
  }, [isResizing, controlledSide, direction, sizeType, splitterRef]);
103
104
 
104
105
  return {
@@ -0,0 +1,4 @@
1
+ export * from './styled/svg_styled_line.js';
2
+ export * from './styled/svg_styled_path.js';
3
+ export * from './styled/svg_styled_text.js';
4
+ export * from './styled/svg_styled_types.js';
@@ -0,0 +1,27 @@
1
+ import type { SVGProps } from 'react';
2
+
3
+ import type { SVGStyledLineUserConfig } from './svg_styled_types.js';
4
+ import { computeStrokeDasharray } from './svg_styled_utils.js';
5
+
6
+ export interface SVGStyledLineProps
7
+ extends Omit<SVGProps<SVGLineElement>, keyof SVGStyledLineUserConfig>,
8
+ SVGStyledLineUserConfig {}
9
+
10
+ export function SVGStyledLine(props: SVGStyledLineProps) {
11
+ const {
12
+ stroke = '#000000',
13
+ strokeOpacity = 1,
14
+ strokeWidth = 1,
15
+ strokeDasharray = 'solid',
16
+ ...otherProps
17
+ } = props;
18
+ return (
19
+ <line
20
+ {...otherProps}
21
+ stroke={stroke}
22
+ strokeOpacity={strokeOpacity}
23
+ strokeWidth={strokeWidth}
24
+ strokeDasharray={computeStrokeDasharray(strokeDasharray, strokeWidth)}
25
+ />
26
+ );
27
+ }
@@ -0,0 +1,29 @@
1
+ import type { SVGProps } from 'react';
2
+
3
+ import type { SVGStyledLineUserConfig } from './svg_styled_types.js';
4
+ import { computeStrokeDasharray } from './svg_styled_utils.js';
5
+
6
+ export interface SVGStyledPathProps
7
+ extends Omit<SVGProps<SVGPathElement>, keyof SVGStyledLineUserConfig>,
8
+ SVGStyledLineUserConfig {}
9
+
10
+ export function SVGStyledPath(props: SVGStyledPathProps) {
11
+ const {
12
+ fillOpacity = 0,
13
+ stroke = '#000000',
14
+ strokeOpacity = 1,
15
+ strokeWidth = 1,
16
+ strokeDasharray = 'solid',
17
+ ...otherProps
18
+ } = props;
19
+ return (
20
+ <path
21
+ {...otherProps}
22
+ fillOpacity={fillOpacity}
23
+ stroke={stroke}
24
+ strokeOpacity={strokeOpacity}
25
+ strokeWidth={strokeWidth}
26
+ strokeDasharray={computeStrokeDasharray(strokeDasharray, strokeWidth)}
27
+ />
28
+ );
29
+ }
@@ -0,0 +1,12 @@
1
+ import type { SVGProps } from 'react';
2
+
3
+ import type { SVGStyledTextUserConfig } from './svg_styled_types.js';
4
+
5
+ export interface SVGStyledTextProps
6
+ extends Omit<SVGProps<SVGTextElement>, keyof SVGStyledTextUserConfig>,
7
+ SVGStyledTextUserConfig {}
8
+
9
+ export function SVGStyledText(props: SVGStyledTextProps) {
10
+ const { fontWeight = 'normal', fontStyle = 'normal', ...otherProps } = props;
11
+ return <text {...otherProps} fontWeight={fontWeight} fontStyle={fontStyle} />;
12
+ }
@@ -0,0 +1,67 @@
1
+ export type SVGStyledLineStrokePattern =
2
+ | 'solid'
3
+ | 'dashed'
4
+ | 'dotted'
5
+ | 'dashed-dot';
6
+
7
+ /**
8
+ * SVG line styles that can be controlled by the user.
9
+ */
10
+ export interface SVGStyledLineUserConfig {
11
+ /**
12
+ * Line color.
13
+ * @default '#000000'
14
+ */
15
+ stroke?: string;
16
+
17
+ /**
18
+ * Line opacity.
19
+ * Range: [0, 1]
20
+ * @default 1
21
+ */
22
+ strokeOpacity?: number;
23
+
24
+ /**
25
+ * Line width.
26
+ * Range: [0, ∞)
27
+ * @default 1
28
+ */
29
+ strokeWidth?: number;
30
+
31
+ /**
32
+ * Line stroke pattern.
33
+ * The `stroke-dasharray` attribute is computed from it and `strokeWidth`
34
+ * @default 'solid'
35
+ */
36
+ strokeDasharray?: SVGStyledLineStrokePattern;
37
+ }
38
+
39
+ /**
40
+ * SVG text styles that can be controlled by the user.
41
+ */
42
+ export interface SVGStyledTextUserConfig {
43
+ /**
44
+ * Font color.
45
+ * @default inherit
46
+ */
47
+ fill?: string;
48
+
49
+ /**
50
+ * Font size.
51
+ * Range: [0, ∞)
52
+ * @default inherit
53
+ */
54
+ fontSize?: number;
55
+
56
+ /**
57
+ * Font weight.
58
+ * @default 'normal'
59
+ */
60
+ fontWeight?: 'normal' | 'bold';
61
+
62
+ /**
63
+ * Font style.
64
+ * @default 'normal'
65
+ */
66
+ fontStyle?: 'normal' | 'italic';
67
+ }
@@ -0,0 +1,15 @@
1
+ import { match } from 'ts-pattern';
2
+
3
+ import type { SVGStyledLineStrokePattern } from './svg_styled_types.js';
4
+
5
+ export function computeStrokeDasharray(
6
+ pattern: SVGStyledLineStrokePattern,
7
+ width: number,
8
+ ): string {
9
+ return match(pattern)
10
+ .with('solid', () => '')
11
+ .with('dashed', () => `${4 * width} ${4 * width}`)
12
+ .with('dotted', () => `${width} ${width}`)
13
+ .with('dashed-dot', () => `${4 * width} ${width} ${width} ${width}`)
14
+ .exhaustive();
15
+ }
@@ -1,8 +1,5 @@
1
1
  import type { ElementDragPayload } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
2
2
  import type { Row, RowData } from '@tanstack/react-table';
3
- import { useEffect, useMemo, useRef, useState } from 'react';
4
- import { createPortal } from 'react-dom';
5
-
6
3
  import {
7
4
  attachClosestEdge,
8
5
  combine,
@@ -11,7 +8,10 @@ import {
11
8
  extractClosestEdge,
12
9
  pointerOutsideOfPreview,
13
10
  setCustomNativeDragPreview,
14
- } from '../../pdnd.cjs';
11
+ } from '@zakodium/pdnd-esm';
12
+ import { useEffect, useMemo, useRef, useState } from 'react';
13
+ import { createPortal } from 'react-dom';
14
+
15
15
  import { assert } from '../../utils/index.js';
16
16
  import { useFlashRowEffect } from '../flash_row/use_flash_row_effect.js';
17
17
  import { PreviewTable } from '../preview_table.js';
@@ -1,9 +1,8 @@
1
1
  import type { Row } from '@tanstack/react-table';
2
+ import { getReorderDestinationIndex, reorder } from '@zakodium/pdnd-esm';
2
3
  import type { ReactNode } from 'react';
3
4
  import { useCallback, useMemo, useState } from 'react';
4
5
 
5
- import { getReorderDestinationIndex, reorder } from '../../pdnd.cjs';
6
-
7
6
  import type { ReorderItemCallback } from './item_order_context.js';
8
7
  import { itemOrderContext } from './item_order_context.js';
9
8
 
@@ -1,13 +1,13 @@
1
1
  import type { ElementDragPayload } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
2
- import type { RefObject } from 'react';
3
- import { useEffect } from 'react';
4
-
5
2
  import {
6
3
  autoScrollForElements,
7
4
  combine,
8
5
  extractClosestEdge,
9
6
  monitorForElements,
10
- } from '../../pdnd.cjs';
7
+ } from '@zakodium/pdnd-esm';
8
+ import type { RefObject } from 'react';
9
+ import { useEffect } from 'react';
10
+
11
11
  import { assert } from '../../utils/index.js';
12
12
  import { useFlashedRowContext } from '../flash_row/flashed_row_context.js';
13
13
 
@@ -27,50 +27,53 @@ export function useDropMonitor(
27
27
  const { reorderItem, items } = useItemOrder();
28
28
  const [, setFlashedRow] = useFlashedRowContext();
29
29
  useEffect(() => {
30
+ if (!enabled) {
31
+ return;
32
+ }
33
+
30
34
  const scrollContainer = scrollElementRef.current;
31
35
  assert(scrollContainer, 'Missing scroll container ref');
32
36
 
33
- if (enabled) {
34
- function canRespond({ source }: { source: ElementDragPayload }) {
35
- return isItemData(source.data);
36
- }
37
- return combine(
38
- monitorForElements({
39
- canMonitor: canRespond,
40
- onDrop({ location, source }) {
41
- const target = location.current.dropTargets[0];
42
- if (!target) {
43
- return;
44
- }
37
+ function canRespond({ source }: { source: ElementDragPayload }) {
38
+ return isItemData(source.data);
39
+ }
45
40
 
46
- const sourceData = source.data;
47
- const targetData = target.data;
48
- if (!isItemData(sourceData) || !isItemData(targetData)) {
49
- return;
50
- }
41
+ return combine(
42
+ monitorForElements({
43
+ canMonitor: canRespond,
44
+ onDrop({ location, source }) {
45
+ const target = location.current.dropTargets[0];
46
+ if (!target) {
47
+ return;
48
+ }
51
49
 
52
- const indexOfTarget = items.findIndex(
53
- (item) => item.id === targetData.id,
54
- );
55
- if (indexOfTarget === -1) {
56
- return;
57
- }
50
+ const sourceData = source.data;
51
+ const targetData = target.data;
52
+ if (!isItemData(sourceData) || !isItemData(targetData)) {
53
+ return;
54
+ }
58
55
 
59
- const closestEdgeOfTarget = extractClosestEdge(targetData);
56
+ const indexOfTarget = items.findIndex(
57
+ (item) => item.id === targetData.id,
58
+ );
59
+ if (indexOfTarget === -1) {
60
+ return;
61
+ }
60
62
 
61
- reorderItem({
62
- startIndex: sourceData.index,
63
- indexOfTarget,
64
- closestEdgeOfTarget,
65
- });
66
- setFlashedRow(sourceData.id);
67
- },
68
- }),
69
- autoScrollForElements({
70
- canScroll: canRespond,
71
- element: scrollContainer,
72
- }),
73
- );
74
- }
63
+ const closestEdgeOfTarget = extractClosestEdge(targetData);
64
+
65
+ reorderItem({
66
+ startIndex: sourceData.index,
67
+ indexOfTarget,
68
+ closestEdgeOfTarget,
69
+ });
70
+ setFlashedRow(sourceData.id);
71
+ },
72
+ }),
73
+ autoScrollForElements({
74
+ canScroll: canRespond,
75
+ element: scrollContainer,
76
+ }),
77
+ );
75
78
  }, [items, reorderItem, scrollElementRef, setFlashedRow, enabled]);
76
79
  }
@@ -27,7 +27,7 @@ const PanelPreferencesToolbarContent = styled.div`
27
27
  display: flex;
28
28
  flex-direction: row-reverse;
29
29
 
30
- & > button {
30
+ > button {
31
31
  padding: 0 0 0 9px;
32
32
  min-width: auto;
33
33
  }
@@ -98,6 +98,7 @@ export function Toolbar(props: ToolbarProps) {
98
98
  if (!vertical) {
99
99
  return;
100
100
  }
101
+
101
102
  function update() {
102
103
  const lastElement = ref.current?.lastElementChild;
103
104
  if (!lastElement) {
@@ -113,11 +114,13 @@ export function Toolbar(props: ToolbarProps) {
113
114
  }
114
115
 
115
116
  const element = ref.current;
116
- if (element) {
117
- const observer = new ResizeObserver(update);
118
- observer.observe(element);
119
- return () => observer.unobserve(element);
117
+ if (!element) {
118
+ return;
120
119
  }
120
+
121
+ const observer = new ResizeObserver(update);
122
+ observer.observe(element);
123
+ return () => observer.unobserve(element);
121
124
  }, [vertical]);
122
125
 
123
126
  return (
@@ -45,7 +45,7 @@ const SubTitleItem = styled.div`
45
45
  padding-left: 15px;
46
46
  box-sizing: border-box;
47
47
 
48
- &::before {
48
+ ::before {
49
49
  position: absolute;
50
50
  top: ${shortcutBoxSize / 2}rem;
51
51
  left: 0;
@@ -56,7 +56,7 @@ const SubTitleItem = styled.div`
56
56
  border-bottom: 1px solid;
57
57
  }
58
58
 
59
- &::after {
59
+ ::after {
60
60
  position: absolute;
61
61
  top: 0;
62
62
  bottom: 0;
@@ -67,7 +67,7 @@ const SubTitleItem = styled.div`
67
67
  border-left: 1px solid;
68
68
  }
69
69
 
70
- &:last-child::after {
70
+ :last-child::after {
71
71
  height: ${shortcutBoxSize / 2}rem;
72
72
  }
73
73
  `;
@@ -1,6 +0,0 @@
1
- interface LogoProps {
2
- size: string;
3
- }
4
- export declare function Logo(props: LogoProps): import("react/jsx-runtime").JSX.Element;
5
- export {};
6
- //# sourceMappingURL=Logo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Logo.d.ts","sourceRoot":"","sources":["../../../src/components/doi/Logo.tsx"],"names":[],"mappings":"AAYA,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,2CAgBpC"}
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import styled from '@emotion/styled';
3
- const Svg = styled.svg `
4
- display: inline-flex;
5
- ${(props) => {
6
- return `
7
- height: ${props.size};
8
- width: ${props.size};
9
- `;
10
- }}
11
- `;
12
- export function Logo(props) {
13
- const { size } = props;
14
- return (_jsxs(Svg, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 130 130", size: size, children: [_jsx("circle", { fill: "#fcb425", cx: "65", cy: "65", r: "64" }), _jsx("path", { fill: "##231f20", d: "m 49.819127,84.559148 -11.854304,0 0,-4.825665 c -1.203594,1.510894 -4.035515,3.051053 -5.264716,3.742483 -2.151101,1.203585 -5.072066,1.987225 -7.812161,1.987225 -4.430246,0 -8.373925,-1.399539 -11.831057,-4.446924 -4.1229464,-3.636389 -6.0602455,-9.19576 -6.0602455,-15.188113 0,-6.094791 2.1126913,-10.960381 6.3380645,-14.59676 3.354695,-2.893745 7.457089,-5.209795 11.810505,-5.209795 2.535231,0 5.661807,0.227363 7.889738,1.302913 1.280414,0.614601 3.572628,2.060721 4.929872,3.469179 l 0,-25.420177 11.854304,0 z m -12.1199,-18.692584 c 0,-2.253538 -0.618258,-4.951555 -2.205973,-6.513663 -1.587724,-1.587724 -4.474153,-2.996182 -6.727691,-2.996182 -2.509615,0 -4.834476,1.825511 -6.447807,3.720535 -1.306031,1.536501 -1.959041,3.905269 -1.959041,5.877114 0,1.971835 0.740815,4.165004 2.046836,5.701505 1.587714,1.895025 3.297985,3.193739 5.833216,3.193739 2.279145,0 4.989965,-0.956662 6.552083,-2.51877 1.587714,-1.562108 2.908377,-4.185134 2.908377,-6.464278 z" }), _jsx("path", { fill: "#fff", d: "m 105.42764,25.617918 c -1.97184,0 -3.64919,0.69142 -5.03204,2.074271 -1.357247,1.357245 -2.035864,3.021779 -2.035864,4.993633 0,1.971835 0.678617,3.649193 2.035864,5.032034 1.38285,1.382861 3.0602,2.074281 5.03204,2.074281 1.99744,0 3.67479,-0.678627 5.03203,-2.035861 1.38285,-1.382861 2.07428,-3.073012 2.07428,-5.070454 0,-1.971854 -0.69143,-3.636388 -2.07428,-4.993633 -1.38285,-1.382851 -3.0602,-2.074271 -5.03203,-2.074271 z M 74.219383,45.507921 c -7.323992,0 -12.970625,2.283009 -16.939921,6.848949 -3.277876,3.782438 -4.916803,8.118252 -4.916803,13.008406 0,5.430481 1.626124,10.009834 4.878383,13.738236 3.943689,4.538918 9.475093,6.808622 16.59421,6.808622 7.093512,0 12.612122,-2.269704 16.555801,-6.808622 3.252259,-3.728402 4.878393,-8.1993 4.878393,-13.413648 0,-5.160323 -1.638938,-9.604602 -4.916803,-13.332994 -4.020509,-4.56594 -9.398263,-6.848949 -16.13326,-6.848949 z m 24.908603,1.386686 0,37.634676 12.599304,0 0,-37.634676 -12.599304,0 z M 73.835252,56.975981 c 2.304752,0 4.263793,0.852337 5.877124,2.554426 1.638928,1.675076 2.458402,3.727881 2.458402,6.159457 0,2.458578 -0.806671,4.538022 -2.419992,6.240111 -1.613331,1.675086 -3.585175,2.514099 -5.915534,2.514099 -2.612051,0 -4.737546,-1.027366 -6.376474,-3.080682 -1.331637,-1.648053 -1.997451,-3.539154 -1.997451,-5.673528 0,-2.107362 0.665814,-3.985138 1.997451,-5.633201 1.638928,-2.053316 3.764423,-3.080682 6.376474,-3.080682 z" })] }));
15
- }
16
- //# sourceMappingURL=Logo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Logo.js","sourceRoot":"","sources":["../../../src/components/doi/Logo.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAkB;;IAEpC,CAAC,KAAK,EAAE,EAAE;IACV,OAAO;gBACK,KAAK,CAAC,IAAI;eACX,KAAK,CAAC,IAAI;KACpB,CAAC;AACJ,CAAC;CACF,CAAC;AAMF,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAEvB,OAAO,CACL,MAAC,GAAG,IAAC,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,aAAa,EAAC,IAAI,EAAE,IAAI,aACtE,iBAAQ,IAAI,EAAC,SAAS,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,GAAG,EAChD,eACE,IAAI,EAAC,UAAU,EACf,CAAC,EAAC,48BAA48B,GAC98B,EACF,eACE,IAAI,EAAC,MAAM,EACX,CAAC,EAAC,w4CAAw4C,GAC14C,IACE,CACP,CAAC;AACJ,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Generate an automatic id if needed, joined with name if truthy
3
- *
4
- * @param id
5
- * @param name
6
- */
7
- export declare function useInputId(id: string | null | undefined, name: string | null | undefined): string;
8
- //# sourceMappingURL=use_input_id.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use_input_id.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/hooks/use_input_id.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,UAQhC"}
@@ -1,15 +0,0 @@
1
- import { useId } from 'react';
2
- /**
3
- * Generate an automatic id if needed, joined with name if truthy
4
- *
5
- * @param id
6
- * @param name
7
- */
8
- export function useInputId(id, name) {
9
- const reactId = useId();
10
- // If id is defined, keep id as finalId for predictable behavior.
11
- // If name is defined, join name with reactId to simplify debug in devtools.
12
- // Else use reactId.
13
- return id ?? (name ? `${name}_${reactId}` : reactId);
14
- }
15
- //# sourceMappingURL=use_input_id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use_input_id.js","sourceRoot":"","sources":["../../../../../src/components/form/components/hooks/use_input_id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACxB,EAA6B,EAC7B,IAA+B;IAE/B,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IAExB,iEAAiE;IACjE,4EAA4E;IAC5E,oBAAoB;IACpB,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACvD,CAAC"}
@@ -1,20 +0,0 @@
1
- import type { ChangeEvent } from 'react';
2
- interface InputProps {
3
- error?: string;
4
- required?: boolean;
5
- id?: string;
6
- name: string;
7
- type?: string;
8
- onChange: (event: ChangeEvent<HTMLInputElement>) => void;
9
- onBlur: () => void;
10
- value: string;
11
- placeholder?: string;
12
- formGroupProps: {
13
- label?: string;
14
- className?: string;
15
- inline?: boolean;
16
- };
17
- }
18
- export declare function Input(props: InputProps): import("react/jsx-runtime").JSX.Element;
19
- export {};
20
- //# sourceMappingURL=input.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/input_groups/input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIzC,UAAU,UAAU;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACzD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,2CAwCtC"}
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FormGroup, InputGroup } from '@blueprintjs/core';
3
- import { useInputId } from '../hooks/use_input_id.js';
4
- export function Input(props) {
5
- const { id, required = false, error, formGroupProps: { className, inline = false, label }, name, onBlur, onChange, type = 'text', value, placeholder, } = props;
6
- const finalId = useInputId(id, name);
7
- return (_jsx(FormGroup, { helperText: error ?? undefined, label: label, labelFor: finalId, intent: "danger", style: { margin: 0, position: 'relative' }, className: className, inline: inline, labelInfo: required && _jsx("span", { style: { color: 'red' }, children: "*" }), children: _jsx(InputGroup, { id: finalId, name: name, required: required, type: type, onChange: onChange, onBlur: onBlur, intent: error ? 'danger' : 'none', value: value, placeholder: placeholder }) }));
8
- }
9
- //# sourceMappingURL=input.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../../src/components/form/components/input_groups/input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAmBtD,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,MAAM,EACJ,EAAE,EACF,QAAQ,GAAG,KAAK,EAChB,KAAK,EACL,cAAc,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK,EAAE,KAAK,EAAE,EACpD,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,IAAI,GAAG,MAAM,EACb,KAAK,EACL,WAAW,GACZ,GAAG,KAAK,CAAC;IAEV,MAAM,OAAO,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAErC,OAAO,CACL,KAAC,SAAS,IACR,UAAU,EAAE,KAAK,IAAI,SAAS,EAC9B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAC,QAAQ,EACf,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAC1C,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,QAAQ,IAAI,eAAM,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAU,YAE9D,KAAC,UAAU,IACT,EAAE,EAAE,OAAO,EACX,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EACjC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,GACxB,GACQ,CACb,CAAC;AACJ,CAAC"}