react-science 11.2.0 → 12.0.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 (71) hide show
  1. package/lib/components/accordion/accordion.js +1 -0
  2. package/lib/components/accordion/accordion.js.map +1 -1
  3. package/lib/components/forms/index.d.ts +1 -1
  4. package/lib/components/forms/index.d.ts.map +1 -1
  5. package/lib/components/forms/index.js +1 -1
  6. package/lib/components/forms/index.js.map +1 -1
  7. package/lib/components/forms/radio-button-group/RadioButton.d.ts +4 -0
  8. package/lib/components/forms/radio-button-group/RadioButton.d.ts.map +1 -0
  9. package/lib/components/forms/radio-button-group/RadioButton.js +53 -0
  10. package/lib/components/forms/radio-button-group/RadioButton.js.map +1 -0
  11. package/lib/components/forms/radio-button-group/RadioButtonGroup.d.ts +7 -0
  12. package/lib/components/forms/radio-button-group/RadioButtonGroup.d.ts.map +1 -0
  13. package/lib/components/forms/radio-button-group/RadioButtonGroup.js +41 -0
  14. package/lib/components/forms/radio-button-group/RadioButtonGroup.js.map +1 -0
  15. package/lib/components/forms/radio-button-group/index.d.ts +3 -0
  16. package/lib/components/forms/radio-button-group/index.d.ts.map +1 -0
  17. package/lib/components/forms/radio-button-group/index.js +3 -0
  18. package/lib/components/forms/radio-button-group/index.js.map +1 -0
  19. package/lib/components/forms/utils/use_input_id.d.ts +2 -0
  20. package/lib/components/forms/utils/use_input_id.d.ts.map +1 -0
  21. package/lib/components/forms/utils/use_input_id.js +9 -0
  22. package/lib/components/forms/utils/use_input_id.js.map +1 -0
  23. package/lib/components/hooks/index.d.ts +0 -1
  24. package/lib/components/hooks/index.d.ts.map +1 -1
  25. package/lib/components/hooks/index.js +0 -1
  26. package/lib/components/hooks/index.js.map +1 -1
  27. package/lib/components/info-panel/InfoPanel.d.ts.map +1 -1
  28. package/lib/components/info-panel/InfoPanel.js +32 -43
  29. package/lib/components/info-panel/InfoPanel.js.map +1 -1
  30. package/lib/components/root-layout/root_layout.d.ts.map +1 -1
  31. package/lib/components/root-layout/root_layout.js +1 -3
  32. package/lib/components/root-layout/root_layout.js.map +1 -1
  33. package/lib/components/table/table_header_cell.d.ts.map +1 -1
  34. package/lib/components/table/table_header_cell.js +29 -13
  35. package/lib/components/table/table_header_cell.js.map +1 -1
  36. package/package.json +3 -6
  37. package/src/components/accordion/accordion.tsx +1 -0
  38. package/src/components/forms/index.ts +1 -1
  39. package/src/components/forms/radio-button-group/RadioButton.tsx +73 -0
  40. package/src/components/forms/radio-button-group/RadioButtonGroup.tsx +80 -0
  41. package/src/components/forms/radio-button-group/index.ts +2 -0
  42. package/src/components/forms/utils/use_input_id.ts +13 -0
  43. package/src/components/hooks/index.ts +0 -1
  44. package/src/components/info-panel/InfoPanel.tsx +51 -56
  45. package/src/components/root-layout/root_layout.tsx +1 -5
  46. package/src/components/table/table_header_cell.tsx +53 -23
  47. package/lib/components/forms/radio-group/ButtonRadioItem.d.ts +0 -3
  48. package/lib/components/forms/radio-group/ButtonRadioItem.d.ts.map +0 -1
  49. package/lib/components/forms/radio-group/ButtonRadioItem.js +0 -50
  50. package/lib/components/forms/radio-group/ButtonRadioItem.js.map +0 -1
  51. package/lib/components/forms/radio-group/RadioGroup.d.ts +0 -18
  52. package/lib/components/forms/radio-group/RadioGroup.d.ts.map +0 -1
  53. package/lib/components/forms/radio-group/RadioGroup.js +0 -38
  54. package/lib/components/forms/radio-group/RadioGroup.js.map +0 -1
  55. package/lib/components/forms/radio-group/index.d.ts +0 -2
  56. package/lib/components/forms/radio-group/index.d.ts.map +0 -1
  57. package/lib/components/forms/radio-group/index.js +0 -2
  58. package/lib/components/forms/radio-group/index.js.map +0 -1
  59. package/lib/components/hooks/useModifiedPopper.d.ts +0 -13
  60. package/lib/components/hooks/useModifiedPopper.d.ts.map +0 -1
  61. package/lib/components/hooks/useModifiedPopper.js +0 -48
  62. package/lib/components/hooks/useModifiedPopper.js.map +0 -1
  63. package/lib/components/root-layout/query_client.d.ts +0 -3
  64. package/lib/components/root-layout/query_client.d.ts.map +0 -1
  65. package/lib/components/root-layout/query_client.js +0 -11
  66. package/lib/components/root-layout/query_client.js.map +0 -1
  67. package/src/components/forms/radio-group/ButtonRadioItem.tsx +0 -78
  68. package/src/components/forms/radio-group/RadioGroup.tsx +0 -75
  69. package/src/components/forms/radio-group/index.ts +0 -1
  70. package/src/components/hooks/useModifiedPopper.ts +0 -77
  71. package/src/components/root-layout/query_client.ts +0 -11
@@ -1 +0,0 @@
1
- {"version":3,"file":"useModifiedPopper.js","sourceRoot":"","sources":["../../../src/components/hooks/useModifiedPopper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,iBAAiB,GAA0B;IAC/C,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,CAAC,eAAe,CAAC;IAC3B,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QAChB,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;IACjE,CAAC;IACD,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACpB,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,GAClC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,qBAAqB,EAAE,CAAC,KACnD,IAAI,CAAC;IACP,CAAC;CACF,CAAC;AAEF,SAAS,iBAAiB,CAAC,MAAc;IACvC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;SACpB;KACF,CAAC;AACJ,CAAC;AAWD,MAAM,UAAU,iBAAiB,CAG/B,OAID;IACC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAEjD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAW,IAAI,CAAC,CAAC;IACzE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAW,IAAI,CAAC,CAAC;IAEnE,MAAM,SAAS,GAA4C,EAAE,CAAC;IAE9D,IAAI,SAAS,EAAE,CAAC;QACd,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,gBAAgB,EAAE,aAAa,EAAE;QACxE,SAAS;QACT,QAAQ,EAAE,OAAO;QACjB,SAAS;KACV,CAAC,CAAC;IAEH,OAAO;QACL,mBAAmB;QACnB,gBAAgB;QAChB,WAAW,EAAE;YACX,KAAK,EAAE,MAAM,CAAC,MAAM;YACpB,GAAG,UAAU,CAAC,MAAM;SACrB;KACF,CAAC;AACJ,CAAC"}
@@ -1,3 +0,0 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
- export declare const queryClient: QueryClient;
3
- //# sourceMappingURL=query_client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query_client.d.ts","sourceRoot":"","sources":["../../../src/components/root-layout/query_client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,eAAO,MAAM,WAAW,aAQtB,CAAC"}
@@ -1,11 +0,0 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
- export const queryClient = new QueryClient({
3
- defaultOptions: {
4
- queries: {
5
- refetchOnMount: false,
6
- refetchOnReconnect: false,
7
- refetchOnWindowFocus: false,
8
- },
9
- },
10
- });
11
- //# sourceMappingURL=query_client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query_client.js","sourceRoot":"","sources":["../../../src/components/root-layout/query_client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC;IACzC,cAAc,EAAE;QACd,OAAO,EAAE;YACP,cAAc,EAAE,KAAK;YACrB,kBAAkB,EAAE,KAAK;YACzB,oBAAoB,EAAE,KAAK;SAC5B;KACF;CACF,CAAC,CAAC"}
@@ -1,78 +0,0 @@
1
- /** @jsxImportSource @emotion/react */
2
- import { css } from '@emotion/react';
3
- import * as RadioGroup from '@radix-ui/react-radio-group';
4
-
5
- import type { InputVariant } from '../styles.js';
6
- import { enabledColor } from '../styles.js';
7
-
8
- import type { RadioGroupProps, RadioOption } from './RadioGroup.js';
9
-
10
- const buttonStyles = {
11
- container: css({
12
- border: '1px solid rgba(0, 0, 0, 0.25)',
13
- borderRightWidth: 0,
14
- position: 'relative',
15
- }),
16
- item: (disabled: boolean, variant?: InputVariant) =>
17
- css({
18
- opacity: disabled ? 0.25 : 1,
19
- padding: variant === 'default' ? '0px 15px' : '0px 7px',
20
- width: '100%',
21
- height: '100%',
22
- cursor: 'pointer',
23
- ':hover': {
24
- '& > label': {
25
- color: disabled ? '' : enabledColor,
26
- },
27
- },
28
- }),
29
-
30
- indicator: css({
31
- position: 'absolute',
32
- top: -1,
33
- left: -1,
34
- right: -1,
35
- bottom: -1,
36
- zIndex: 10,
37
- border: '1px solid',
38
- borderColor: enabledColor,
39
-
40
- '& ~ label': {
41
- color: enabledColor,
42
- },
43
- }),
44
-
45
- label: (variant?: InputVariant) =>
46
- css({
47
- cursor: 'pointer',
48
- fontSize: variant === 'small' ? '1em' : '1.125em',
49
- lineHeight: variant === 'default' ? '30px' : '22px',
50
- }),
51
- };
52
-
53
- export function ButtonRadioItem(
54
- prop: RadioOption & Pick<RadioGroupProps, 'onSelect' | 'variant' | 'name'>,
55
- ) {
56
- const { value, label, disabled = false, onSelect, variant, name } = prop;
57
- return (
58
- <div css={buttonStyles.container}>
59
- <RadioGroup.Item
60
- css={buttonStyles.item(disabled, variant)}
61
- value={value}
62
- id={`${value}${name}`}
63
- onClick={() => {
64
- if (!disabled) onSelect?.(prop);
65
- }}
66
- >
67
- <RadioGroup.Indicator css={buttonStyles.indicator} />
68
- <label
69
- css={buttonStyles.label(variant)}
70
- htmlFor={`${value}${name}`}
71
- style={{}}
72
- >
73
- {label}
74
- </label>
75
- </RadioGroup.Item>
76
- </div>
77
- );
78
- }
@@ -1,75 +0,0 @@
1
- /** @jsxImportSource @emotion/react */
2
- import { css } from '@emotion/react';
3
- import * as RadioGroupRadix from '@radix-ui/react-radio-group';
4
- import type { ReactNode } from 'react';
5
-
6
- import type { InputVariant } from '../styles.js';
7
-
8
- import { ButtonRadioItem } from './ButtonRadioItem.js';
9
-
10
- export interface RadioOption {
11
- value: string;
12
- label: ReactNode;
13
- disabled?: boolean;
14
- }
15
- export interface RadioGroupProps {
16
- selected?: RadioOption;
17
- options?: RadioOption[];
18
- onSelect?: (option: RadioOption) => void;
19
- name?: string;
20
- disabled?: boolean;
21
- variant?: InputVariant;
22
- id?: string;
23
- }
24
- const rootStyles = {
25
- basic: css({
26
- display: 'flex',
27
- flexDirection: 'row',
28
- width: 'fit-content',
29
- }),
30
- button: (variant: InputVariant) =>
31
- css({
32
- ' & > *:first-of-type, & > *:first-of-type span': {
33
- borderRadius: variant === 'default' ? '6px 0 0 6px' : '4px 0 0 4px',
34
- },
35
- ' & > *:last-of-type, & > *:last-of-type span': {
36
- borderRightWidth: 1,
37
- borderRadius: variant === 'default' ? '0 6px 6px 0' : '0 4px 4px 0',
38
- },
39
- }),
40
- };
41
- export function RadioGroup(props: RadioGroupProps) {
42
- const {
43
- id,
44
- selected,
45
- disabled: groupDisabled = false,
46
- options = [],
47
- onSelect,
48
- name = '',
49
- variant = 'default',
50
- } = props;
51
- return (
52
- <RadioGroupRadix.Root
53
- id={id}
54
- css={[rootStyles.basic, rootStyles.button(variant)]}
55
- style={{
56
- gap: 0,
57
- }}
58
- value={selected?.value}
59
- name={name}
60
- disabled={groupDisabled}
61
- >
62
- {options?.map(({ value, label, disabled }) => {
63
- const childProps = {
64
- value,
65
- label,
66
- disabled: groupDisabled || disabled,
67
- onSelect,
68
- variant,
69
- name,
70
- };
71
- return <ButtonRadioItem key={value} {...childProps} />;
72
- })}
73
- </RadioGroupRadix.Root>
74
- );
75
- }
@@ -1 +0,0 @@
1
- export * from './RadioGroup.js';
@@ -1,77 +0,0 @@
1
- import type { Placement } from '@popperjs/core';
2
- import type { HTMLAttributes } from 'react';
3
- import { useState } from 'react';
4
- import type { Modifier } from 'react-popper';
5
- import { usePopper } from 'react-popper';
6
-
7
- const sameWidthModifier: Modifier<'sameWidth'> = {
8
- name: 'sameWidth',
9
- enabled: true,
10
- phase: 'beforeWrite',
11
- requires: ['computeStyles'],
12
- fn: ({ state }) => {
13
- state.styles.popper.width = `${state.rects.reference.width}px`;
14
- },
15
- effect: ({ state }) => {
16
- state.elements.popper.style.width = `${
17
- state.elements.reference.getBoundingClientRect().width
18
- }px`;
19
- },
20
- };
21
-
22
- function getOffsetModifier(offset: number): Modifier<'offset'> {
23
- return {
24
- name: 'offset',
25
- options: {
26
- offset: [0, offset],
27
- },
28
- };
29
- }
30
-
31
- export interface UseModifiedPopperReturn<
32
- R extends Element = HTMLDivElement,
33
- P extends HTMLElement = HTMLDivElement,
34
- > {
35
- setReferenceElement: (ref: R | null) => void;
36
- setPopperElement: (popper: P | null) => void;
37
- popperProps: HTMLAttributes<P>;
38
- }
39
-
40
- export function useModifiedPopper<
41
- R extends Element = HTMLDivElement,
42
- P extends HTMLElement = HTMLDivElement,
43
- >(options: {
44
- placement?: Placement;
45
- offset?: number;
46
- sameWidth?: boolean;
47
- }): UseModifiedPopperReturn<R, P> {
48
- const { offset, placement, sameWidth } = options;
49
-
50
- const [referenceElement, setReferenceElement] = useState<R | null>(null);
51
- const [popperElement, setPopperElement] = useState<P | null>(null);
52
-
53
- const modifiers: Array<Modifier<'sameWidth' | 'offset'>> = [];
54
-
55
- if (sameWidth) {
56
- modifiers.push(sameWidthModifier);
57
- }
58
-
59
- if (offset) {
60
- modifiers.push(getOffsetModifier(offset));
61
- }
62
-
63
- const { styles, attributes } = usePopper(referenceElement, popperElement, {
64
- placement,
65
- strategy: 'fixed',
66
- modifiers,
67
- });
68
-
69
- return {
70
- setReferenceElement,
71
- setPopperElement,
72
- popperProps: {
73
- style: styles.popper,
74
- ...attributes.popper,
75
- },
76
- };
77
- }
@@ -1,11 +0,0 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
-
3
- export const queryClient = new QueryClient({
4
- defaultOptions: {
5
- queries: {
6
- refetchOnMount: false,
7
- refetchOnReconnect: false,
8
- refetchOnWindowFocus: false,
9
- },
10
- },
11
- });