react-science 19.2.0 → 19.3.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 (140) 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 +11 -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 +17 -0
  34. package/lib/components/form/components/input_groups/form.js.map +1 -0
  35. package/lib/components/form/components/input_groups/form_group.d.ts +25 -0
  36. package/lib/components/form/components/input_groups/form_group.d.ts.map +1 -0
  37. package/lib/components/form/components/input_groups/form_group.js +45 -0
  38. package/lib/components/form/components/input_groups/form_group.js.map +1 -0
  39. package/lib/components/form/components/input_groups/select.d.ts +3 -6
  40. package/lib/components/form/components/input_groups/select.d.ts.map +1 -1
  41. package/lib/components/form/components/input_groups/select.js +3 -6
  42. package/lib/components/form/components/input_groups/select.js.map +1 -1
  43. package/lib/components/form/components/layout/Section.d.ts +9 -0
  44. package/lib/components/form/components/layout/Section.d.ts.map +1 -0
  45. package/lib/components/form/components/layout/Section.js +38 -0
  46. package/lib/components/form/components/layout/Section.js.map +1 -0
  47. package/lib/components/form/context/use_ts_form.d.ts +4 -0
  48. package/lib/components/form/context/use_ts_form.d.ts.map +1 -1
  49. package/lib/components/form/context/use_ts_form.js +2 -0
  50. package/lib/components/form/context/use_ts_form.js.map +1 -1
  51. package/lib/components/index.d.ts +1 -0
  52. package/lib/components/index.d.ts.map +1 -1
  53. package/lib/components/index.js +1 -0
  54. package/lib/components/index.js.map +1 -1
  55. package/lib/components/info-panel/InfoPanel.d.ts.map +1 -1
  56. package/lib/components/info-panel/InfoPanel.js +3 -3
  57. package/lib/components/info-panel/InfoPanel.js.map +1 -1
  58. package/lib/components/input/radio-button-group/RadioButton.js +4 -4
  59. package/lib/components/input/radio-button-group/RadioButtonGroup.js +2 -2
  60. package/lib/components/root-layout/css-reset/customPreflight.js +1 -1
  61. package/lib/components/split_pane/use_split_pane_size.d.ts.map +1 -1
  62. package/lib/components/split_pane/use_split_pane_size.js +47 -46
  63. package/lib/components/split_pane/use_split_pane_size.js.map +1 -1
  64. package/lib/components/svg/index.d.ts +5 -0
  65. package/lib/components/svg/index.d.ts.map +1 -0
  66. package/lib/components/svg/index.js +5 -0
  67. package/lib/components/svg/index.js.map +1 -0
  68. package/lib/components/svg/styled/svg_styled_line.d.ts +6 -0
  69. package/lib/components/svg/styled/svg_styled_line.d.ts.map +1 -0
  70. package/lib/components/svg/styled/svg_styled_line.js +7 -0
  71. package/lib/components/svg/styled/svg_styled_line.js.map +1 -0
  72. package/lib/components/svg/styled/svg_styled_path.d.ts +6 -0
  73. package/lib/components/svg/styled/svg_styled_path.d.ts.map +1 -0
  74. package/lib/components/svg/styled/svg_styled_path.js +7 -0
  75. package/lib/components/svg/styled/svg_styled_path.js.map +1 -0
  76. package/lib/components/svg/styled/svg_styled_text.d.ts +6 -0
  77. package/lib/components/svg/styled/svg_styled_text.d.ts.map +1 -0
  78. package/lib/components/svg/styled/svg_styled_text.js +6 -0
  79. package/lib/components/svg/styled/svg_styled_text.js.map +1 -0
  80. package/lib/components/svg/styled/svg_styled_types.d.ts +56 -0
  81. package/lib/components/svg/styled/svg_styled_types.d.ts.map +1 -0
  82. package/lib/components/svg/styled/svg_styled_types.js +2 -0
  83. package/lib/components/svg/styled/svg_styled_types.js.map +1 -0
  84. package/lib/components/svg/styled/svg_styled_utils.d.ts +3 -0
  85. package/lib/components/svg/styled/svg_styled_utils.d.ts.map +1 -0
  86. package/lib/components/svg/styled/svg_styled_utils.js +10 -0
  87. package/lib/components/svg/styled/svg_styled_utils.js.map +1 -0
  88. package/lib/components/table/reorder_rows/use_drop_monitor.d.ts.map +1 -1
  89. package/lib/components/table/reorder_rows/use_drop_monitor.js +33 -32
  90. package/lib/components/table/reorder_rows/use_drop_monitor.js.map +1 -1
  91. package/lib/components/toolbar/PanelPreferencesToolbar.js +1 -1
  92. package/lib/components/toolbar/Toolbar.d.ts.map +1 -1
  93. package/lib/components/toolbar/Toolbar.js +5 -4
  94. package/lib/components/toolbar/Toolbar.js.map +1 -1
  95. package/lib/components/toolbar/TooltipHelpContent.js +3 -3
  96. package/package.json +36 -35
  97. package/src/components/accordion/accordion.tsx +1 -1
  98. package/src/components/color-picker/react-color/ColorPicker.tsx +8 -6
  99. package/src/components/doi/doi.tsx +2 -2
  100. package/src/components/doi/{Logo.tsx → doi_logo.tsx} +9 -5
  101. package/src/components/form/components/input/checkbox.tsx +23 -6
  102. package/src/components/form/components/input/input.tsx +35 -15
  103. package/src/components/form/components/input/numeric_input.tsx +30 -15
  104. package/src/components/form/components/input/select.tsx +24 -17
  105. package/src/components/form/components/input/switch.tsx +27 -5
  106. package/src/components/form/components/input_groups/form.tsx +32 -0
  107. package/src/components/form/components/input_groups/form_group.tsx +126 -0
  108. package/src/components/form/components/input_groups/select.tsx +25 -46
  109. package/src/components/form/components/layout/Section.tsx +57 -0
  110. package/src/components/form/context/use_ts_form.ts +2 -0
  111. package/src/components/index.ts +1 -0
  112. package/src/components/info-panel/InfoPanel.tsx +4 -3
  113. package/src/components/input/radio-button-group/RadioButton.tsx +4 -4
  114. package/src/components/input/radio-button-group/RadioButtonGroup.tsx +2 -2
  115. package/src/components/root-layout/css-reset/customPreflight.ts +1 -1
  116. package/src/components/split_pane/use_split_pane_size.tsx +54 -53
  117. package/src/components/svg/index.ts +4 -0
  118. package/src/components/svg/styled/svg_styled_line.tsx +27 -0
  119. package/src/components/svg/styled/svg_styled_path.tsx +29 -0
  120. package/src/components/svg/styled/svg_styled_text.tsx +12 -0
  121. package/src/components/svg/styled/svg_styled_types.ts +67 -0
  122. package/src/components/svg/styled/svg_styled_utils.ts +15 -0
  123. package/src/components/table/reorder_rows/use_drop_monitor.ts +41 -38
  124. package/src/components/toolbar/PanelPreferencesToolbar.tsx +1 -1
  125. package/src/components/toolbar/Toolbar.tsx +7 -4
  126. package/src/components/toolbar/TooltipHelpContent.tsx +3 -3
  127. package/lib/components/doi/Logo.d.ts +0 -6
  128. package/lib/components/doi/Logo.d.ts.map +0 -1
  129. package/lib/components/doi/Logo.js +0 -16
  130. package/lib/components/doi/Logo.js.map +0 -1
  131. package/lib/components/form/components/hooks/use_input_id.d.ts +0 -8
  132. package/lib/components/form/components/hooks/use_input_id.d.ts.map +0 -1
  133. package/lib/components/form/components/hooks/use_input_id.js +0 -15
  134. package/lib/components/form/components/hooks/use_input_id.js.map +0 -1
  135. package/lib/components/form/components/input_groups/input.d.ts +0 -20
  136. package/lib/components/form/components/input_groups/input.d.ts.map +0 -1
  137. package/lib/components/form/components/input_groups/input.js +0 -9
  138. package/lib/components/form/components/input_groups/input.js.map +0 -1
  139. package/src/components/form/components/hooks/use_input_id.ts +0 -19
  140. package/src/components/form/components/input_groups/input.tsx +0 -63
@@ -1,6 +1,8 @@
1
1
  import { useFieldContext } from '../../context/use_ts_form.js';
2
2
  import { getIntent } from '../../utils/use_intent.js';
3
- import { Select as FormGroupSelect } from '../input_groups/select.js';
3
+ import type { FormGroupInputProps } from '../input_groups/form_group.js';
4
+ import { FormGroup } from '../input_groups/form_group.js';
5
+ import { Select as SelectInput } from '../input_groups/select.js';
4
6
  import type { SelectId } from '../util/select.js';
5
7
 
6
8
  interface SelectOptionType {
@@ -8,14 +10,12 @@ interface SelectOptionType {
8
10
  value: string;
9
11
  }
10
12
 
11
- interface SelectProps {
12
- label?: string;
13
+ interface SelectProps extends Omit<FormGroupInputProps, 'placeholder'> {
13
14
  items: SelectOptionType[];
14
- required?: boolean;
15
15
  }
16
16
 
17
17
  export function Select(props: SelectProps) {
18
- const { label, items, required } = props;
18
+ const { label, items, required, helpText, layout, fullWidth } = props;
19
19
 
20
20
  const field = useFieldContext<SelectId>();
21
21
  const error = field
@@ -31,17 +31,24 @@ export function Select(props: SelectProps) {
31
31
  }
32
32
 
33
33
  return (
34
- <FormGroupSelect
35
- formGroupProps={{
36
- required,
37
- label,
38
- intent,
39
- helperText: error ?? undefined,
40
- }}
41
- items={items}
42
- onChange={onItemSelect}
43
- selected={field.state.value}
44
- onBlur={field.handleBlur}
45
- />
34
+ <FormGroup
35
+ name={field.name}
36
+ required={required}
37
+ label={label}
38
+ intent={intent}
39
+ helpText={helpText}
40
+ error={error}
41
+ layout={layout}
42
+ fullWidth={fullWidth}
43
+ >
44
+ <SelectInput
45
+ onBlur={field.handleBlur}
46
+ items={items}
47
+ selected={field.state.value}
48
+ onChange={onItemSelect}
49
+ intent={intent}
50
+ name={field.name}
51
+ />
52
+ </FormGroup>
46
53
  );
47
54
  }
@@ -1,14 +1,27 @@
1
- import { FormGroup, Switch as BPSwitch } from '@blueprintjs/core';
1
+ import { Switch as BPSwitch } from '@blueprintjs/core';
2
+ import styled from '@emotion/styled';
2
3
  import type { ChangeEvent } from 'react';
3
4
 
4
5
  import { useFieldContext } from '../../context/use_ts_form.js';
6
+ import type { Layout } from '../input_groups/form.js';
7
+ import { FormGroup } from '../input_groups/form_group.js';
5
8
 
6
9
  interface SwitchProps {
7
10
  label?: string;
11
+ helpText?: string;
12
+ fullWidth?: boolean;
13
+ layout?: Layout;
8
14
  }
9
15
 
16
+ const StyledSwitch = styled(BPSwitch)`
17
+ margin: 0 !important;
18
+ height: 30px;
19
+ display: flex;
20
+ align-items: center;
21
+ `;
22
+
10
23
  export function Switch(props: SwitchProps) {
11
- const { label } = props;
24
+ const { label, layout, helpText, fullWidth } = props;
12
25
 
13
26
  const field = useFieldContext<boolean>();
14
27
  const error = field
@@ -21,12 +34,21 @@ export function Switch(props: SwitchProps) {
21
34
  }
22
35
 
23
36
  return (
24
- <FormGroup helperText={error ?? undefined} intent="danger">
25
- <BPSwitch
37
+ <FormGroup
38
+ name={field.name}
39
+ error={error}
40
+ intent={error ? 'danger' : undefined}
41
+ label={label}
42
+ layout={layout}
43
+ helpText={helpText}
44
+ fullWidth={fullWidth}
45
+ >
46
+ <StyledSwitch
47
+ name={field.name}
48
+ id={field.name}
26
49
  checked={field.state.value}
27
50
  onChange={onChange}
28
51
  onBlur={field.handleBlur}
29
- labelElement={label}
30
52
  />
31
53
  </FormGroup>
32
54
  );
@@ -0,0 +1,32 @@
1
+ import type { FormHTMLAttributes, ReactNode } from 'react';
2
+ import { createContext, useContext, useMemo } from 'react';
3
+
4
+ export type Layout = 'inline' | 'stacked';
5
+
6
+ export interface FormProps extends FormHTMLAttributes<HTMLFormElement> {
7
+ children: ReactNode;
8
+ layout?: Layout;
9
+ }
10
+
11
+ const formContext = createContext<{ layout: Layout }>({
12
+ layout: 'stacked',
13
+ });
14
+
15
+ // eslint-disable-next-line react-refresh/only-export-components
16
+ export function useFormContext() {
17
+ return useContext(formContext);
18
+ }
19
+
20
+ export function Form(props: FormProps) {
21
+ const { children, layout = 'stacked', ...otherProps } = props;
22
+
23
+ const contextValue = useMemo(() => {
24
+ return { layout };
25
+ }, [layout]);
26
+
27
+ return (
28
+ <formContext.Provider value={contextValue}>
29
+ <form {...otherProps}>{children}</form>
30
+ </formContext.Provider>
31
+ );
32
+ }
@@ -0,0 +1,126 @@
1
+ import type { Intent } from '@blueprintjs/core';
2
+ import { Classes } from '@blueprintjs/core';
3
+ import styled from '@emotion/styled';
4
+ import type { ReactNode } from 'react';
5
+
6
+ import type { Layout } from './form.js';
7
+ import { useFormContext } from './form.js';
8
+
9
+ const INPUT_HEIGHT = 30;
10
+
11
+ const FormContainer = styled.div<{
12
+ layout?: Layout;
13
+ }>`
14
+ min-height: ${INPUT_HEIGHT}px;
15
+ width: 100%;
16
+ display: grid;
17
+ margin: 0;
18
+ grid-template-columns: ${(props) =>
19
+ props.layout === 'inline' ? '[label] 30% [input] 70%' : '1fr'};
20
+ grid-template-rows: ${(props) =>
21
+ props.layout === 'inline' ? 'auto auto' : 'auto'};
22
+ `;
23
+
24
+ const RequiredSpan = styled.span`
25
+ color: red;
26
+ `;
27
+
28
+ const ContainerElement = styled.div<{
29
+ height?: number | 'auto';
30
+ fullWidth?: boolean;
31
+ layout?: Layout;
32
+ }>`
33
+ display: inline-block;
34
+ grid-column: ${(props) =>
35
+ props.fullWidth
36
+ ? '1 / -1'
37
+ : props.layout === 'inline'
38
+ ? 'input'
39
+ : '1 / -1'};
40
+ height: ${(props) =>
41
+ props.height === 'auto' ? props.height : `${props.height}px`};
42
+ width: fit-content;
43
+ `;
44
+
45
+ const Label = styled.label<{ layout: Layout }>`
46
+ padding-top: calc(${INPUT_HEIGHT}px - 26px);
47
+ grid-column: ${(props) => (props.layout === 'inline' ? 'label' : '1 / -1')};
48
+ height: 30px;
49
+
50
+ @media (width < 48rem) {
51
+ padding: 0;
52
+ }
53
+ `;
54
+
55
+ const ErrorAndHelpText = styled.div`
56
+ display: flex;
57
+ flex-direction: column;
58
+ `;
59
+
60
+ export interface FormGroupInputProps {
61
+ label?: string;
62
+ required?: boolean;
63
+ placeholder?: string;
64
+ helpText?: string;
65
+ layout?: Layout;
66
+ fullWidth?: boolean;
67
+ }
68
+
69
+ interface FormGroupProps {
70
+ label?: string;
71
+ intent?: Intent;
72
+ name: string;
73
+ required?: boolean;
74
+ helpText?: string;
75
+ children?: ReactNode;
76
+ error?: string;
77
+ layout?: Layout;
78
+ fullWidth?: boolean;
79
+ }
80
+
81
+ export function FormGroup(props: FormGroupProps) {
82
+ const {
83
+ label,
84
+ intent,
85
+ name,
86
+ required,
87
+ children,
88
+ helpText,
89
+ error,
90
+ layout,
91
+ fullWidth = false,
92
+ } = props;
93
+
94
+ const { layout: formLayout } = useFormContext();
95
+
96
+ return (
97
+ <FormContainer
98
+ layout={layout || formLayout}
99
+ className={`${Classes.FORM_GROUP} ${Classes.intentClass(intent)}`}
100
+ >
101
+ {label && (
102
+ <Label
103
+ layout={layout || formLayout}
104
+ className={Classes.LABEL}
105
+ htmlFor={name}
106
+ >
107
+ {label}{' '}
108
+ {required && (
109
+ <RequiredSpan className={Classes.TEXT_MUTED}>*</RequiredSpan>
110
+ )}
111
+ </Label>
112
+ )}
113
+ <ContainerElement fullWidth={fullWidth} layout={layout || formLayout}>
114
+ {children}
115
+
116
+ <ErrorAndHelpText>
117
+ {helpText && (
118
+ <span className={Classes.FORM_HELPER_TEXT}>{helpText}</span>
119
+ )}
120
+
121
+ {error && <span className={Classes.FORM_HELPER_TEXT}>{error}</span>}
122
+ </ErrorAndHelpText>
123
+ </ContainerElement>
124
+ </FormContainer>
125
+ );
126
+ }
@@ -1,12 +1,10 @@
1
- import type { FormGroupProps } from '@blueprintjs/core';
2
- import { FormGroup } from '@blueprintjs/core';
1
+ import type { FormGroup, FormGroupProps } from '@blueprintjs/core';
3
2
  import type { SelectProps as BPSelectProps } from '@blueprintjs/select';
4
3
  import { Select as BPSelect } from '@blueprintjs/select';
5
4
  import type { ComponentProps, ReactElement, ReactNode } from 'react';
6
5
  import { useCallback, useMemo } from 'react';
7
6
 
8
7
  import { Button } from '../../../button/index.js';
9
- import { useInputId } from '../hooks/use_input_id.js';
10
8
  import type {
11
9
  GetOptionLabel,
12
10
  GetOptionValue,
@@ -94,7 +92,6 @@ export type SelectProps<OptionType, ID extends SelectId> = FieldGroupProps &
94
92
  interface RealSelectProps<OptionType, ID extends SelectId>
95
93
  extends Pick<BPSelectProps<OptionType>, 'filterable' | 'items'> {
96
94
  onBlur: () => void;
97
- id?: string;
98
95
  renderButton?: (
99
96
  state: SelectPropsRenderButtonState<OptionType>,
100
97
  onBlur: () => void,
@@ -104,12 +101,8 @@ interface RealSelectProps<OptionType, ID extends SelectId>
104
101
  onChange?: (selected: ID | undefined, option: OptionType | undefined) => void;
105
102
  getLabel?: GetOptionLabel<OptionType>;
106
103
  getValue?: GetOptionValue<OptionType, ID>;
107
- formGroupProps: Pick<
108
- ComponentProps<typeof FormGroup>,
109
- 'helperText' | 'intent' | 'label' | 'className' | 'inline'
110
- > & {
111
- required?: boolean;
112
- };
104
+ intent?: FormGroupProps['intent'];
105
+ name?: string;
113
106
  }
114
107
 
115
108
  export function Select<
@@ -118,17 +111,17 @@ export function Select<
118
111
  >(props: RealSelectProps<OptionType, ID>): ReactElement {
119
112
  const {
120
113
  renderButton,
121
- id,
122
114
  disabled,
123
115
  selected,
124
116
  getLabel: _getLabel,
125
117
  getValue: _getValue,
126
- formGroupProps: { className, helperText, inline, intent, label, required },
118
+ intent,
127
119
  // Weirdly, setting the filterable prop on BP's Select component activates the filter input
128
120
  filterable = false,
129
121
  items,
130
122
  onChange,
131
123
  onBlur,
124
+ name = null,
132
125
  } = props;
133
126
 
134
127
  const getValue: GetOptionValue<OptionType, ID> = _getValue ?? getSelectValue;
@@ -155,42 +148,28 @@ export function Select<
155
148
  [getValue, onChange],
156
149
  );
157
150
 
158
- const inputId = useInputId(id, null);
159
-
160
151
  return (
161
- <FormGroup
162
- label={label}
163
- labelFor={inputId}
164
- helperText={helperText}
165
- intent={intent}
166
- style={{ margin: 0, position: 'relative' }}
167
- className={className}
168
- inline={inline}
152
+ <BPSelect<OptionType>
153
+ filterable={filterable}
154
+ items={items}
155
+ onItemSelect={onItemSelect}
156
+ itemRenderer={itemRenderer}
169
157
  disabled={disabled}
170
- labelInfo={required && <span style={{ color: 'red' }}>*</span>}
171
158
  >
172
- <BPSelect<OptionType>
173
- filterable={filterable}
174
- items={items}
175
- onItemSelect={onItemSelect}
176
- itemRenderer={itemRenderer}
177
- disabled={disabled}
178
- >
179
- {renderButton ? (
180
- renderButton({ selectedOption, error: undefined }, onBlur)
181
- ) : (
182
- <Button
183
- id={inputId}
184
- text={getLabel(selectedOption) || 'Select ...'}
185
- endIcon="double-caret-vertical"
186
- variant="outlined"
187
- intent={intent}
188
- disabled={disabled}
189
- style={{ minWidth: 180 }}
190
- onBlur={onBlur}
191
- />
192
- )}
193
- </BPSelect>
194
- </FormGroup>
159
+ {renderButton ? (
160
+ renderButton({ selectedOption, error: undefined }, onBlur)
161
+ ) : (
162
+ <Button
163
+ id={name || undefined}
164
+ text={getLabel(selectedOption) || 'Select ...'}
165
+ endIcon="double-caret-vertical"
166
+ variant="outlined"
167
+ intent={intent}
168
+ disabled={disabled}
169
+ style={{ minWidth: 180 }}
170
+ onBlur={onBlur}
171
+ />
172
+ )}
173
+ </BPSelect>
195
174
  );
196
175
  }
@@ -0,0 +1,57 @@
1
+ import styled from '@emotion/styled';
2
+ import type { ReactNode } from 'react';
3
+
4
+ const ContainerInformation = styled.div`
5
+ display: flex;
6
+ flex-direction: column;
7
+
8
+ > h2 {
9
+ font-weight: 600;
10
+ font-size: 1rem;
11
+ line-height: 1.75rem;
12
+ }
13
+
14
+ > h3 {
15
+ color: #737373;
16
+ font-size: 0.875rem;
17
+ line-height: 1.5rem;
18
+ }
19
+ `;
20
+
21
+ const Container = styled.div`
22
+ margin-top: 15px;
23
+ gap: 5px;
24
+ display: flex;
25
+ flex-direction: column;
26
+ `;
27
+
28
+ const ContainerContent = styled.div`
29
+ outline: 1px solid rgb(17 24 39 / 5%);
30
+ box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%);
31
+ display: flex;
32
+ flex-direction: column;
33
+ gap: 2px;
34
+ border-radius: 0.75rem;
35
+ padding: 7px 10px 2px;
36
+ `;
37
+
38
+ interface SectionProps {
39
+ title: string;
40
+ description?: string;
41
+ children: ReactNode;
42
+ }
43
+
44
+ export function Section(props: SectionProps) {
45
+ const { title, description, children } = props;
46
+
47
+ return (
48
+ <Container>
49
+ <ContainerInformation>
50
+ <h2>{title}</h2>
51
+ <h3>{description}</h3>
52
+ </ContainerInformation>
53
+
54
+ <ContainerContent>{children}</ContainerContent>
55
+ </Container>
56
+ );
57
+ }
@@ -7,6 +7,7 @@ import { ResetButton } from '../components/input/reset_button.js';
7
7
  import { Select } from '../components/input/select.js';
8
8
  import { SubmitButton } from '../components/input/submit_button.js';
9
9
  import { Switch } from '../components/input/switch.js';
10
+ import { Section } from '../components/layout/Section.js';
10
11
 
11
12
  const { useFormContext, useFieldContext, formContext, fieldContext } =
12
13
  createFormHookContexts();
@@ -17,6 +18,7 @@ const { useAppForm, withForm } = createFormHook({
17
18
  formComponents: {
18
19
  SubmitButton,
19
20
  ResetButton,
21
+ Section,
20
22
  },
21
23
  fieldComponents: {
22
24
  Input,
@@ -19,4 +19,5 @@ export * from './activity_bar/index.js';
19
19
  export * from './activity_panel/index.js';
20
20
  export * from './utils/index.js';
21
21
  export * from './selected-total/index.js';
22
+ export * from './svg/index.js';
22
23
  export * as ValueRenderers from './value-renderers/index.js';
@@ -110,9 +110,10 @@ export function InfoPanel(props: InfoPanelProps) {
110
110
  const includes: InfoPanelDatum[] = [];
111
111
  const valueContains: InfoPanelDatum[] = [];
112
112
 
113
- for (const [parameter, value] of Object.entries(data).sort(([a], [b]) => {
114
- return a.localeCompare(b);
115
- })) {
113
+ const sortedDataEntries = Object.entries(data);
114
+ sortedDataEntries.sort(([a], [b]) => a.localeCompare(b));
115
+
116
+ for (const [parameter, value] of sortedDataEntries) {
116
117
  const lowerKey = parameter.toLowerCase();
117
118
  const lowerSearch = search.toLowerCase();
118
119
  if (lowerKey === lowerSearch) {
@@ -12,12 +12,12 @@ const HiddenInput = styled.input`
12
12
  padding: 0;
13
13
  margin: -1px;
14
14
  overflow: hidden;
15
- clip: rect(0, 0, 0, 0);
15
+ clip-path: inset(50%);
16
16
  white-space: nowrap;
17
17
  border-width: 0;
18
18
 
19
19
  /* Label associated with the checked input. */
20
- &:checked + label {
20
+ :checked + label {
21
21
  color: ${enabledColor};
22
22
  border-color: ${enabledColor};
23
23
  opacity: ${(props) => (props.disabled ? 0.25 : 1)};
@@ -25,7 +25,7 @@ const HiddenInput = styled.input`
25
25
  }
26
26
 
27
27
  /* Next label after the one that is checked. */
28
- &:checked + label + input + label {
28
+ :checked + label + input + label {
29
29
  border-left-width: 0;
30
30
  }
31
31
  `;
@@ -46,7 +46,7 @@ const Label = styled.label<{ size?: RadioProps['size']; disabled?: boolean }>`
46
46
  cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
47
47
  white-space: nowrap;
48
48
 
49
- &:hover {
49
+ :hover {
50
50
  color: ${enabledColor};
51
51
  }
52
52
  `;
@@ -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';