datocms-react-ui 1.0.1 → 1.1.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.
- package/dist/cjs/Button/index.js +5 -5
- package/dist/cjs/Button/index.js.map +1 -1
- package/dist/cjs/ButtonGroup/Button/index.js +1 -1
- package/dist/cjs/ButtonGroup/Button/index.js.map +1 -1
- package/dist/cjs/ButtonGroup/Group/index.js +1 -1
- package/dist/cjs/ButtonGroup/Group/index.js.map +1 -1
- package/dist/cjs/Canvas/index.js +3 -3
- package/dist/cjs/Canvas/index.js.map +1 -1
- package/dist/cjs/ContextInspector/index.js +34 -35
- package/dist/cjs/ContextInspector/index.js.map +1 -1
- package/dist/cjs/Dropdown/Dropdown.js +8 -30
- package/dist/cjs/Dropdown/Dropdown.js.map +1 -1
- package/dist/cjs/Dropdown/Group.js +2 -2
- package/dist/cjs/Dropdown/Group.js.map +1 -1
- package/dist/cjs/Dropdown/Menu.js +20 -18
- package/dist/cjs/Dropdown/Menu.js.map +1 -1
- package/dist/cjs/Dropdown/MenuContext.js.map +1 -1
- package/dist/cjs/Dropdown/Option.js +3 -3
- package/dist/cjs/Dropdown/Option.js.map +1 -1
- package/dist/cjs/Dropdown/OptionAction.js +1 -1
- package/dist/cjs/Dropdown/OptionAction.js.map +1 -1
- package/dist/cjs/Dropdown/Portal.js +6 -28
- package/dist/cjs/Dropdown/Portal.js.map +1 -1
- package/dist/cjs/Dropdown/Separator.js +1 -1
- package/dist/cjs/Dropdown/Separator.js.map +1 -1
- package/dist/cjs/Dropdown/Text.js +1 -1
- package/dist/cjs/Dropdown/Text.js.map +1 -1
- package/dist/cjs/Dropdown/index.js.map +1 -1
- package/dist/cjs/FieldError/index.js.map +1 -1
- package/dist/cjs/FieldGroup/index.js +1 -1
- package/dist/cjs/FieldGroup/index.js.map +1 -1
- package/dist/cjs/FieldHint/index.js.map +1 -1
- package/dist/cjs/FieldWrapper/index.js.map +1 -1
- package/dist/cjs/Form/index.js +1 -1
- package/dist/cjs/Form/index.js.map +1 -1
- package/dist/cjs/FormLabel/index.js +1 -1
- package/dist/cjs/FormLabel/index.js.map +1 -1
- package/dist/cjs/Section/index.js +6 -6
- package/dist/cjs/Section/index.js.map +1 -1
- package/dist/cjs/SelectField/index.js.map +1 -1
- package/dist/cjs/SelectInput/index.js.map +1 -1
- package/dist/cjs/SidebarPanel/index.js +5 -5
- package/dist/cjs/SidebarPanel/index.js.map +1 -1
- package/dist/cjs/Spinner/index.js +1 -1
- package/dist/cjs/Spinner/index.js.map +1 -1
- package/dist/cjs/SwitchField/index.js +1 -1
- package/dist/cjs/SwitchField/index.js.map +1 -1
- package/dist/cjs/SwitchInput/index.js +5 -5
- package/dist/cjs/SwitchInput/index.js.map +1 -1
- package/dist/cjs/TextField/index.js.map +1 -1
- package/dist/cjs/TextInput/index.js +4 -26
- package/dist/cjs/TextInput/index.js.map +1 -1
- package/dist/cjs/TextareaField/index.js.map +1 -1
- package/dist/cjs/TextareaInput/index.js +4 -26
- package/dist/cjs/TextareaInput/index.js.map +1 -1
- package/dist/cjs/Toolbar/Button/index.js +1 -1
- package/dist/cjs/Toolbar/Button/index.js.map +1 -1
- package/dist/cjs/Toolbar/Stack/index.js +1 -1
- package/dist/cjs/Toolbar/Stack/index.js.map +1 -1
- package/dist/cjs/Toolbar/Title/index.js +1 -1
- package/dist/cjs/Toolbar/Title/index.js.map +1 -1
- package/dist/cjs/Toolbar/Toolbar/index.js +1 -1
- package/dist/cjs/Toolbar/Toolbar/index.js.map +1 -1
- package/dist/cjs/generateStyleFromCtx/index.js +16 -10
- package/dist/cjs/generateStyleFromCtx/index.js.map +1 -1
- package/dist/cjs/icons.js.map +1 -1
- package/dist/cjs/mergeRefs/index.js +3 -2
- package/dist/cjs/mergeRefs/index.js.map +1 -1
- package/dist/cjs/useMediaQuery/index.js +14 -5
- package/dist/cjs/useMediaQuery/index.js.map +1 -1
- package/dist/esm/Button/index.d.ts +2 -1
- package/dist/esm/Button/index.js +5 -5
- package/dist/esm/Button/index.js.map +1 -1
- package/dist/esm/ButtonGroup/Button/index.d.ts +1 -1
- package/dist/esm/ButtonGroup/Button/index.js +1 -1
- package/dist/esm/ButtonGroup/Button/index.js.map +1 -1
- package/dist/esm/ButtonGroup/Group/index.d.ts +1 -1
- package/dist/esm/ButtonGroup/Group/index.js +1 -1
- package/dist/esm/ButtonGroup/Group/index.js.map +1 -1
- package/dist/esm/Canvas/index.d.ts +2 -2
- package/dist/esm/Canvas/index.js +4 -4
- package/dist/esm/Canvas/index.js.map +1 -1
- package/dist/esm/ContextInspector/index.js +34 -35
- package/dist/esm/ContextInspector/index.js.map +1 -1
- package/dist/esm/Dropdown/Dropdown.js +4 -3
- package/dist/esm/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/Dropdown/Group.d.ts +2 -1
- package/dist/esm/Dropdown/Group.js +2 -2
- package/dist/esm/Dropdown/Group.js.map +1 -1
- package/dist/esm/Dropdown/Menu.js +20 -18
- package/dist/esm/Dropdown/Menu.js.map +1 -1
- package/dist/esm/Dropdown/MenuContext.d.ts +1 -1
- package/dist/esm/Dropdown/MenuContext.js.map +1 -1
- package/dist/esm/Dropdown/Option.js +3 -3
- package/dist/esm/Dropdown/Option.js.map +1 -1
- package/dist/esm/Dropdown/OptionAction.d.ts +2 -1
- package/dist/esm/Dropdown/OptionAction.js +1 -1
- package/dist/esm/Dropdown/OptionAction.js.map +1 -1
- package/dist/esm/Dropdown/Portal.d.ts +2 -1
- package/dist/esm/Dropdown/Portal.js +4 -3
- package/dist/esm/Dropdown/Portal.js.map +1 -1
- package/dist/esm/Dropdown/Separator.js +1 -1
- package/dist/esm/Dropdown/Separator.js.map +1 -1
- package/dist/esm/Dropdown/Text.js +1 -1
- package/dist/esm/Dropdown/Text.js.map +1 -1
- package/dist/esm/Dropdown/index.d.ts +6 -6
- package/dist/esm/Dropdown/index.js.map +1 -1
- package/dist/esm/FieldError/index.d.ts +1 -1
- package/dist/esm/FieldError/index.js.map +1 -1
- package/dist/esm/FieldGroup/index.js +1 -1
- package/dist/esm/FieldGroup/index.js.map +1 -1
- package/dist/esm/FieldHint/index.d.ts +1 -1
- package/dist/esm/FieldHint/index.js.map +1 -1
- package/dist/esm/FieldWrapper/index.d.ts +2 -2
- package/dist/esm/FieldWrapper/index.js.map +1 -1
- package/dist/esm/Form/index.d.ts +1 -1
- package/dist/esm/Form/index.js +1 -1
- package/dist/esm/Form/index.js.map +1 -1
- package/dist/esm/FormLabel/index.js +1 -1
- package/dist/esm/FormLabel/index.js.map +1 -1
- package/dist/esm/Section/index.d.ts +1 -1
- package/dist/esm/Section/index.js +6 -6
- package/dist/esm/Section/index.js.map +1 -1
- package/dist/esm/SelectField/index.d.ts +3 -3
- package/dist/esm/SelectField/index.js.map +1 -1
- package/dist/esm/SelectInput/index.d.ts +4 -4
- package/dist/esm/SelectInput/index.js.map +1 -1
- package/dist/esm/SidebarPanel/index.d.ts +1 -1
- package/dist/esm/SidebarPanel/index.js +5 -5
- package/dist/esm/SidebarPanel/index.js.map +1 -1
- package/dist/esm/Spinner/index.js +1 -1
- package/dist/esm/Spinner/index.js.map +1 -1
- package/dist/esm/SwitchField/index.d.ts +2 -2
- package/dist/esm/SwitchField/index.js +1 -1
- package/dist/esm/SwitchField/index.js.map +1 -1
- package/dist/esm/SwitchInput/index.js +5 -5
- package/dist/esm/SwitchInput/index.js.map +1 -1
- package/dist/esm/TextField/index.d.ts +2 -2
- package/dist/esm/TextField/index.js +1 -1
- package/dist/esm/TextField/index.js.map +1 -1
- package/dist/esm/TextInput/index.d.ts +2 -1
- package/dist/esm/TextInput/index.js +3 -2
- package/dist/esm/TextInput/index.js.map +1 -1
- package/dist/esm/TextareaField/index.d.ts +2 -2
- package/dist/esm/TextareaField/index.js.map +1 -1
- package/dist/esm/TextareaInput/index.d.ts +2 -1
- package/dist/esm/TextareaInput/index.js +3 -2
- package/dist/esm/TextareaInput/index.js.map +1 -1
- package/dist/esm/Toolbar/Button/index.d.ts +1 -1
- package/dist/esm/Toolbar/Button/index.js +1 -1
- package/dist/esm/Toolbar/Button/index.js.map +1 -1
- package/dist/esm/Toolbar/Stack/index.d.ts +1 -1
- package/dist/esm/Toolbar/Stack/index.js +1 -1
- package/dist/esm/Toolbar/Stack/index.js.map +1 -1
- package/dist/esm/Toolbar/Title/index.d.ts +1 -1
- package/dist/esm/Toolbar/Title/index.js +1 -1
- package/dist/esm/Toolbar/Title/index.js.map +1 -1
- package/dist/esm/Toolbar/Toolbar/index.d.ts +1 -1
- package/dist/esm/Toolbar/Toolbar/index.js +1 -1
- package/dist/esm/Toolbar/Toolbar/index.js.map +1 -1
- package/dist/esm/generateStyleFromCtx/index.d.ts +3 -3
- package/dist/esm/generateStyleFromCtx/index.js +16 -10
- package/dist/esm/generateStyleFromCtx/index.js.map +1 -1
- package/dist/esm/icons.d.ts +1 -1
- package/dist/esm/icons.js.map +1 -1
- package/dist/esm/mergeRefs/index.js +3 -2
- package/dist/esm/mergeRefs/index.js.map +1 -1
- package/dist/esm/useMediaQuery/index.js +14 -5
- package/dist/esm/useMediaQuery/index.js.map +1 -1
- package/dist/types/Button/index.d.ts +2 -1
- package/dist/types/ButtonGroup/Button/index.d.ts +1 -1
- package/dist/types/ButtonGroup/Group/index.d.ts +1 -1
- package/dist/types/Canvas/index.d.ts +2 -2
- package/dist/types/Dropdown/Group.d.ts +2 -1
- package/dist/types/Dropdown/MenuContext.d.ts +1 -1
- package/dist/types/Dropdown/OptionAction.d.ts +2 -1
- package/dist/types/Dropdown/Portal.d.ts +2 -1
- package/dist/types/Dropdown/index.d.ts +6 -6
- package/dist/types/FieldError/index.d.ts +1 -1
- package/dist/types/FieldHint/index.d.ts +1 -1
- package/dist/types/FieldWrapper/index.d.ts +2 -2
- package/dist/types/Form/index.d.ts +1 -1
- package/dist/types/Section/index.d.ts +1 -1
- package/dist/types/SelectField/index.d.ts +3 -3
- package/dist/types/SelectInput/index.d.ts +4 -4
- package/dist/types/SidebarPanel/index.d.ts +1 -1
- package/dist/types/SwitchField/index.d.ts +2 -2
- package/dist/types/TextField/index.d.ts +2 -2
- package/dist/types/TextInput/index.d.ts +2 -1
- package/dist/types/TextareaField/index.d.ts +2 -2
- package/dist/types/TextareaInput/index.d.ts +2 -1
- package/dist/types/Toolbar/Button/index.d.ts +1 -1
- package/dist/types/Toolbar/Stack/index.d.ts +1 -1
- package/dist/types/Toolbar/Title/index.d.ts +1 -1
- package/dist/types/Toolbar/Toolbar/index.d.ts +1 -1
- package/dist/types/generateStyleFromCtx/index.d.ts +3 -3
- package/dist/types/icons.d.ts +1 -1
- package/package.json +3 -3
- package/src/Button/index.tsx +6 -9
- package/src/ButtonGroup/Button/index.tsx +6 -2
- package/src/ButtonGroup/Group/index.tsx +2 -2
- package/src/Canvas/index.tsx +10 -5
- package/src/ContextInspector/index.tsx +76 -80
- package/src/Dropdown/Dropdown.tsx +4 -3
- package/src/Dropdown/Group.tsx +4 -3
- package/src/Dropdown/Menu.tsx +25 -24
- package/src/Dropdown/MenuContext.tsx +1 -1
- package/src/Dropdown/Option.tsx +3 -3
- package/src/Dropdown/OptionAction.tsx +3 -2
- package/src/Dropdown/Portal.tsx +5 -4
- package/src/Dropdown/Separator.tsx +1 -1
- package/src/Dropdown/Text.tsx +1 -1
- package/src/Dropdown/index.tsx +6 -6
- package/src/FieldError/index.tsx +1 -1
- package/src/FieldGroup/index.tsx +1 -1
- package/src/FieldHint/index.tsx +1 -1
- package/src/FieldWrapper/index.tsx +2 -2
- package/src/Form/index.tsx +5 -5
- package/src/FormLabel/index.tsx +1 -1
- package/src/Section/index.tsx +6 -6
- package/src/SelectField/index.tsx +7 -7
- package/src/SelectInput/index.tsx +9 -7
- package/src/SidebarPanel/index.tsx +8 -8
- package/src/Spinner/index.tsx +1 -1
- package/src/SwitchField/index.tsx +4 -4
- package/src/SwitchInput/index.tsx +5 -5
- package/src/TextField/index.tsx +7 -2
- package/src/TextInput/index.tsx +3 -2
- package/src/TextareaField/index.tsx +3 -3
- package/src/TextareaInput/index.tsx +3 -2
- package/src/Toolbar/Button/index.tsx +6 -2
- package/src/Toolbar/Stack/index.tsx +2 -2
- package/src/Toolbar/Title/index.tsx +2 -2
- package/src/Toolbar/Toolbar/index.tsx +2 -2
- package/src/generateStyleFromCtx/index.ts +22 -18
- package/src/icons.tsx +4 -4
- package/src/mergeRefs/index.ts +4 -3
- package/src/useMediaQuery/index.ts +5 -3
- package/types.json +353 -353
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
3
4
|
import { DropdownContext } from './DropdownContext';
|
|
4
5
|
import s from './styles.module.css.json';
|
|
5
6
|
|
|
@@ -20,7 +21,7 @@ export const OptionAction = ({
|
|
|
20
21
|
{(context) => (
|
|
21
22
|
<button
|
|
22
23
|
type="button"
|
|
23
|
-
className={classNames(s
|
|
24
|
+
className={classNames(s.Dropdown__menu__option__icon, {
|
|
24
25
|
[s['Dropdown__menu__option__icon--delete']]: red,
|
|
25
26
|
})}
|
|
26
27
|
onClick={(e) => {
|
package/src/Dropdown/Portal.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type ReactNode, useEffect, useRef } from 'react';
|
|
1
4
|
import ReactDOM from 'react-dom';
|
|
2
|
-
import React, { ReactNode, useEffect, useRef } from 'react';
|
|
3
5
|
import { useCtx } from '..';
|
|
4
6
|
import s from '../Canvas/styles.module.css.json';
|
|
5
7
|
import { generateStyleFromCtx } from '../generateStyleFromCtx';
|
|
6
|
-
import classNames from 'classnames';
|
|
7
8
|
|
|
8
9
|
export function Portal({
|
|
9
10
|
children,
|
|
@@ -36,8 +37,8 @@ export function Portal({
|
|
|
36
37
|
|
|
37
38
|
return ReactDOM.createPortal(
|
|
38
39
|
<div
|
|
39
|
-
className={classNames(s
|
|
40
|
-
style={generateStyleFromCtx(ctx)}
|
|
40
|
+
className={classNames(s.themeVariables, s.canvas)}
|
|
41
|
+
style={generateStyleFromCtx(ctx, true)}
|
|
41
42
|
>
|
|
42
43
|
{children}
|
|
43
44
|
</div>,
|
package/src/Dropdown/Text.tsx
CHANGED
|
@@ -4,5 +4,5 @@ import s from './styles.module.css.json';
|
|
|
4
4
|
export type TextProps = { children: React.ReactNode };
|
|
5
5
|
|
|
6
6
|
export function Text({ children }: TextProps): JSX.Element {
|
|
7
|
-
return <div className={s
|
|
7
|
+
return <div className={s.Dropdown__menu__text}>{children}</div>;
|
|
8
8
|
}
|
package/src/Dropdown/index.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Dropdown, DropdownProps } from './Dropdown';
|
|
2
|
-
import { Group, GroupProps } from './Group';
|
|
3
|
-
import { Menu, MenuProps } from './Menu';
|
|
4
|
-
import { Option, OptionProps } from './Option';
|
|
5
|
-
import { OptionAction, OptionActionProps } from './OptionAction';
|
|
1
|
+
import { Dropdown, type DropdownProps } from './Dropdown';
|
|
2
|
+
import { Group, type GroupProps } from './Group';
|
|
3
|
+
import { Menu, type MenuProps } from './Menu';
|
|
4
|
+
import { Option, type OptionProps } from './Option';
|
|
5
|
+
import { OptionAction, type OptionActionProps } from './OptionAction';
|
|
6
6
|
import { Separator } from './Separator';
|
|
7
|
-
import { Text, TextProps } from './Text';
|
|
7
|
+
import { Text, type TextProps } from './Text';
|
|
8
8
|
|
|
9
9
|
export {
|
|
10
10
|
Dropdown,
|
package/src/FieldError/index.tsx
CHANGED
package/src/FieldGroup/index.tsx
CHANGED
package/src/FieldHint/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { FieldError, FieldHint, FormLabel, FormLabelProps } from '..';
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import { FieldError, FieldHint, FormLabel, type FormLabelProps } from '..';
|
|
3
3
|
|
|
4
4
|
type FieldWrapperProps = {
|
|
5
5
|
id: string;
|
package/src/Form/index.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
1
2
|
import React, {
|
|
2
3
|
Children,
|
|
3
4
|
useCallback,
|
|
4
|
-
CSSProperties,
|
|
5
|
-
FormEventHandler,
|
|
6
|
-
FormEvent,
|
|
7
|
-
ReactNode,
|
|
5
|
+
type CSSProperties,
|
|
6
|
+
type FormEventHandler,
|
|
7
|
+
type FormEvent,
|
|
8
|
+
type ReactNode,
|
|
8
9
|
} from 'react';
|
|
9
|
-
import cn from 'classnames';
|
|
10
10
|
import styles from './styles.module.css.json';
|
|
11
11
|
|
|
12
12
|
export interface FormProps {
|
package/src/FormLabel/index.tsx
CHANGED
package/src/Section/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
1
|
import cn from 'classnames';
|
|
2
|
+
import React, { type CSSProperties, type ReactNode } from 'react';
|
|
3
3
|
import s from './styles.module.css.json';
|
|
4
4
|
|
|
5
5
|
type SectionProps = {
|
|
@@ -72,15 +72,15 @@ export function Section({
|
|
|
72
72
|
}: SectionProps): JSX.Element {
|
|
73
73
|
return (
|
|
74
74
|
<div
|
|
75
|
-
className={cn(s
|
|
75
|
+
className={cn(s.Section, { [s['Section--highlighted']]: highlighted })}
|
|
76
76
|
>
|
|
77
77
|
<div
|
|
78
|
-
className={cn(s
|
|
78
|
+
className={cn(s.Section__header, headerClassName)}
|
|
79
79
|
style={headerStyle}
|
|
80
80
|
>
|
|
81
81
|
<div
|
|
82
82
|
className={cn(
|
|
83
|
-
s
|
|
83
|
+
s.Section__title,
|
|
84
84
|
|
|
85
85
|
titleClassName,
|
|
86
86
|
)}
|
|
@@ -89,13 +89,13 @@ export function Section({
|
|
|
89
89
|
{collapsible && (
|
|
90
90
|
<button
|
|
91
91
|
type="button"
|
|
92
|
-
className={cn(s
|
|
92
|
+
className={cn(s.Section__arrow, {
|
|
93
93
|
[s['Section__arrow--is-open']]: collapsible.isOpen,
|
|
94
94
|
})}
|
|
95
95
|
onClick={collapsible.onToggle}
|
|
96
96
|
/>
|
|
97
97
|
)}
|
|
98
|
-
<div className={s
|
|
98
|
+
<div className={s.Section__title__content}>{title}</div>
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
{(!collapsible || collapsible.isOpen) && children}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { GroupBase } from 'react-select';
|
|
2
3
|
import {
|
|
3
4
|
AsyncCreatableSelectInput,
|
|
4
|
-
AsyncCreatableSelectInputProps,
|
|
5
|
+
type AsyncCreatableSelectInputProps,
|
|
5
6
|
AsyncSelectInput,
|
|
6
|
-
AsyncSelectInputProps,
|
|
7
|
+
type AsyncSelectInputProps,
|
|
7
8
|
CreatableSelectInput,
|
|
8
|
-
CreatableSelectInputProps,
|
|
9
|
+
type CreatableSelectInputProps,
|
|
9
10
|
FieldWrapper,
|
|
10
|
-
FormLabelProps,
|
|
11
|
+
type FormLabelProps,
|
|
11
12
|
SelectInput,
|
|
12
|
-
SelectInputProps,
|
|
13
|
+
type SelectInputProps,
|
|
13
14
|
} from '..';
|
|
14
|
-
import { GroupBase } from 'react-select';
|
|
15
15
|
|
|
16
16
|
type SelectFieldProps<
|
|
17
17
|
Option,
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import RawSelect, {
|
|
3
|
-
Props as RawSelectProps,
|
|
4
|
-
GroupBase,
|
|
5
|
-
StylesConfig,
|
|
6
|
-
ThemeConfig,
|
|
3
|
+
type Props as RawSelectProps,
|
|
4
|
+
type GroupBase,
|
|
5
|
+
type StylesConfig,
|
|
6
|
+
type ThemeConfig,
|
|
7
7
|
} from 'react-select';
|
|
8
|
-
import RawAsyncSelect, { AsyncProps } from 'react-select/async';
|
|
8
|
+
import RawAsyncSelect, { type AsyncProps } from 'react-select/async';
|
|
9
9
|
import RawAsyncCreatableSelect, {
|
|
10
|
-
AsyncCreatableProps,
|
|
10
|
+
type AsyncCreatableProps,
|
|
11
11
|
} from 'react-select/async-creatable';
|
|
12
|
-
import RawCreatableSelect, {
|
|
12
|
+
import RawCreatableSelect, {
|
|
13
|
+
type CreatableProps,
|
|
14
|
+
} from 'react-select/creatable';
|
|
13
15
|
|
|
14
16
|
const themeConfig: ThemeConfig = (existing) => ({
|
|
15
17
|
...existing,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import React, { ReactNode, useState } from 'react';
|
|
2
|
+
import React, { type ReactNode, useState } from 'react';
|
|
3
3
|
import s from './styles.module.css.json';
|
|
4
4
|
|
|
5
5
|
function ChevronDownIcon() {
|
|
@@ -10,7 +10,7 @@ function ChevronDownIcon() {
|
|
|
10
10
|
width="1em"
|
|
11
11
|
height="1em"
|
|
12
12
|
>
|
|
13
|
-
<path d="M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"
|
|
13
|
+
<path d="M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" />
|
|
14
14
|
</svg>
|
|
15
15
|
);
|
|
16
16
|
}
|
|
@@ -23,7 +23,7 @@ function ChevronUpIcon() {
|
|
|
23
23
|
width="1em"
|
|
24
24
|
height="1em"
|
|
25
25
|
>
|
|
26
|
-
<path d="M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"
|
|
26
|
+
<path d="M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z" />
|
|
27
27
|
</svg>
|
|
28
28
|
);
|
|
29
29
|
}
|
|
@@ -83,22 +83,22 @@ export function SidebarPanel({
|
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
return (
|
|
86
|
-
<div className={s
|
|
86
|
+
<div className={s.SidebarPanel}>
|
|
87
87
|
{title && (
|
|
88
88
|
<button
|
|
89
89
|
type="button"
|
|
90
|
-
className={s
|
|
90
|
+
className={s.SidebarPanel__header}
|
|
91
91
|
onClick={handleToggle}
|
|
92
92
|
>
|
|
93
|
-
<div className={s
|
|
94
|
-
<div className={s
|
|
93
|
+
<div className={s.SidebarPanel__header__title}>{title}</div>
|
|
94
|
+
<div className={s.SidebarPanel__header__chevron}>
|
|
95
95
|
{open ? <ChevronDownIcon /> : <ChevronUpIcon />}
|
|
96
96
|
</div>
|
|
97
97
|
</button>
|
|
98
98
|
)}
|
|
99
99
|
{open && (
|
|
100
100
|
<div
|
|
101
|
-
className={classNames(s
|
|
101
|
+
className={classNames(s.SidebarPanel__content, {
|
|
102
102
|
[s['SidebarPanel__content--no-padding']]: noPadding,
|
|
103
103
|
})}
|
|
104
104
|
>
|
package/src/Spinner/index.tsx
CHANGED
|
@@ -38,7 +38,7 @@ export function Spinner({
|
|
|
38
38
|
const barStyle: React.CSSProperties = {};
|
|
39
39
|
barStyle.animationDelay = `${(i - 12) / 10}s`;
|
|
40
40
|
barStyle.transform = `rotate(${i * 30}deg) translate(146%)`;
|
|
41
|
-
bars.push(<div style={barStyle} className={s
|
|
41
|
+
bars.push(<div style={barStyle} className={s.Spinner__bar} key={i} />);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const style: React.CSSProperties = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import React, { type ReactNode } from 'react';
|
|
2
3
|
import {
|
|
3
4
|
FieldError,
|
|
4
5
|
FieldHint,
|
|
5
6
|
FormLabel,
|
|
6
|
-
FormLabelProps,
|
|
7
|
+
type FormLabelProps,
|
|
7
8
|
SwitchInput,
|
|
8
|
-
SwitchInputProps,
|
|
9
|
+
type SwitchInputProps,
|
|
9
10
|
} from '..';
|
|
10
|
-
import cn from 'classnames';
|
|
11
11
|
import s from './styles.module.css.json';
|
|
12
12
|
|
|
13
13
|
type SwitchFieldProps = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import cn from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import s from './styles.module.css.json';
|
|
4
4
|
|
|
5
5
|
export type SwitchInputChangeEventHandler = (
|
|
@@ -52,9 +52,9 @@ export function SwitchInput({
|
|
|
52
52
|
onClick?.(e);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const switchClassName = cn(s
|
|
56
|
-
[s
|
|
57
|
-
[s
|
|
55
|
+
const switchClassName = cn(s.switchInput, className, {
|
|
56
|
+
[s.switchInput__checked]: value,
|
|
57
|
+
[s.switchInput__disabled]: disabled,
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
return (
|
|
@@ -68,7 +68,7 @@ export function SwitchInput({
|
|
|
68
68
|
onKeyDown={onInternalKeyDown}
|
|
69
69
|
onClick={onInternalClick}
|
|
70
70
|
>
|
|
71
|
-
<span className={s
|
|
71
|
+
<span className={s.switchInput__inner} />
|
|
72
72
|
</button>
|
|
73
73
|
);
|
|
74
74
|
}
|
package/src/TextField/index.tsx
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
FieldWrapper,
|
|
4
|
+
type FormLabelProps,
|
|
5
|
+
TextInput,
|
|
6
|
+
type TextInputProps,
|
|
7
|
+
} from '..';
|
|
3
8
|
|
|
4
9
|
type TextFieldProps = {
|
|
5
10
|
id: string;
|
package/src/TextInput/index.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { useCallback, RefObject, ChangeEvent } from 'react';
|
|
2
1
|
import cn from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type ChangeEvent, type RefObject, useCallback } from 'react';
|
|
3
4
|
import s from './styles.module.css.json';
|
|
4
5
|
|
|
5
6
|
export type TextInputChangeEventHandler = (
|
|
@@ -54,7 +55,7 @@ export const TextInput = ({
|
|
|
54
55
|
[onChange],
|
|
55
56
|
);
|
|
56
57
|
|
|
57
|
-
const classNames = cn(s
|
|
58
|
+
const classNames = cn(s.TextInput, className, {
|
|
58
59
|
[s['TextInput--disabled']]: disabled,
|
|
59
60
|
[s['TextInput--error']]: error,
|
|
60
61
|
[s['TextInput--monospaced']]: monospaced,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
FieldWrapper,
|
|
4
|
-
FormLabelProps,
|
|
4
|
+
type FormLabelProps,
|
|
5
5
|
TextareaInput,
|
|
6
|
-
TextareaInputProps,
|
|
6
|
+
type TextareaInputProps,
|
|
7
7
|
} from '..';
|
|
8
8
|
|
|
9
9
|
type TextareaFieldProps = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { useCallback, RefObject, ChangeEvent } from 'react';
|
|
2
1
|
import cn from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type ChangeEvent, type RefObject, useCallback } from 'react';
|
|
3
4
|
import s from './styles.module.css.json';
|
|
4
5
|
|
|
5
6
|
export type TextareaInputChangeEventHandler = (
|
|
@@ -44,7 +45,7 @@ export const TextareaInput = ({
|
|
|
44
45
|
[onChange],
|
|
45
46
|
);
|
|
46
47
|
|
|
47
|
-
const classNames = cn(s
|
|
48
|
+
const classNames = cn(s.TextareaInput, className, {
|
|
48
49
|
[s['TextareaInput--disabled']]: disabled,
|
|
49
50
|
[s['TextareaInput--error']]: error,
|
|
50
51
|
[s['TextareaInput--monospaced']]: monospaced,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, {
|
|
3
|
+
type CSSProperties,
|
|
4
|
+
type MouseEventHandler,
|
|
5
|
+
type ReactNode,
|
|
6
|
+
} from 'react';
|
|
3
7
|
import s from './styles.module.css.json';
|
|
4
8
|
|
|
5
9
|
export type ButtonProps = {
|
|
@@ -20,7 +24,7 @@ export function Button({
|
|
|
20
24
|
type="button"
|
|
21
25
|
onClick={onClick}
|
|
22
26
|
className={classNames(
|
|
23
|
-
s
|
|
27
|
+
s.Button,
|
|
24
28
|
|
|
25
29
|
className,
|
|
26
30
|
)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import React, { type CSSProperties, type ReactNode } from 'react';
|
|
3
3
|
import s from './styles.module.css.json';
|
|
4
4
|
|
|
5
5
|
export type StackProps = {
|
|
@@ -18,7 +18,7 @@ export function Stack({
|
|
|
18
18
|
return (
|
|
19
19
|
<div
|
|
20
20
|
className={classNames(
|
|
21
|
-
s
|
|
21
|
+
s.Stack,
|
|
22
22
|
{
|
|
23
23
|
[s['Stack--s']]: stackSize === 's',
|
|
24
24
|
[s['Stack--l']]: stackSize === 'l',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import React, { type CSSProperties, type ReactNode } from 'react';
|
|
3
3
|
import s from './styles.module.css.json';
|
|
4
4
|
|
|
5
5
|
export type TitleProps = {
|
|
@@ -10,7 +10,7 @@ export type TitleProps = {
|
|
|
10
10
|
|
|
11
11
|
export function Title({ children, style, className }: TitleProps): JSX.Element {
|
|
12
12
|
return (
|
|
13
|
-
<div className={classNames(s
|
|
13
|
+
<div className={classNames(s.Title, className)} style={style}>
|
|
14
14
|
{children}
|
|
15
15
|
</div>
|
|
16
16
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import React, { type CSSProperties, type ReactNode } from 'react';
|
|
3
3
|
import s from './styles.module.css.json';
|
|
4
4
|
|
|
5
5
|
export type ToolbarProps = {
|
|
@@ -100,7 +100,7 @@ export function Toolbar({
|
|
|
100
100
|
return (
|
|
101
101
|
<div
|
|
102
102
|
className={classNames(
|
|
103
|
-
s
|
|
103
|
+
s.Toolbar,
|
|
104
104
|
|
|
105
105
|
className,
|
|
106
106
|
)}
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import { RenderProperties } from 'datocms-plugin-sdk';
|
|
2
|
-
import { CSSProperties } from 'react';
|
|
1
|
+
import type { RenderProperties } from 'datocms-plugin-sdk';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
3
|
|
|
4
4
|
function camelToDash(str: string) {
|
|
5
|
-
if (str
|
|
6
|
-
|
|
5
|
+
if (str === str.toLowerCase()) {
|
|
6
|
+
return str;
|
|
7
7
|
}
|
|
8
|
-
return str;
|
|
8
|
+
return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function generateStyleFromCtx(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
export function generateStyleFromCtx(
|
|
12
|
+
ctx: RenderProperties,
|
|
13
|
+
noBodyPadding = false,
|
|
14
|
+
): CSSProperties {
|
|
15
|
+
return {
|
|
16
|
+
padding: noBodyPadding
|
|
17
|
+
? undefined
|
|
18
|
+
: ctx.bodyPadding.map((p) => `${p}px`).join(' '),
|
|
19
|
+
...Object.fromEntries(
|
|
20
|
+
Object.entries(ctx.theme).flatMap(([k, v]) => [
|
|
21
|
+
[`--${camelToDash(k)}`, v],
|
|
22
|
+
[
|
|
23
|
+
`--${camelToDash(`${k}RgbComponents`)}`,
|
|
18
24
|
v.match(/rgb\((\d+, \d+, \d+)\)/)?.[1] || undefined,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
);
|
|
25
|
+
],
|
|
26
|
+
]),
|
|
27
|
+
),
|
|
28
|
+
};
|
|
25
29
|
}
|
package/src/icons.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
1
|
+
import React, { type CSSProperties } from 'react';
|
|
2
2
|
|
|
3
3
|
export type IconProps = {
|
|
4
4
|
width?: string | number;
|
|
@@ -22,7 +22,7 @@ export function BackIcon({
|
|
|
22
22
|
style={style}
|
|
23
23
|
className={className}
|
|
24
24
|
>
|
|
25
|
-
<path d="M238.475 475.535l7.071-7.07c4.686-4.686 4.686-12.284 0-16.971L50.053 256 245.546 60.506c4.686-4.686 4.686-12.284 0-16.971l-7.071-7.07c-4.686-4.686-12.284-4.686-16.97 0L10.454 247.515c-4.686 4.686-4.686 12.284 0 16.971l211.051 211.05c4.686 4.686 12.284 4.686 16.97-.001z"
|
|
25
|
+
<path d="M238.475 475.535l7.071-7.07c4.686-4.686 4.686-12.284 0-16.971L50.053 256 245.546 60.506c4.686-4.686 4.686-12.284 0-16.971l-7.071-7.07c-4.686-4.686-12.284-4.686-16.97 0L10.454 247.515c-4.686 4.686-4.686 12.284 0 16.971l211.051 211.05c4.686 4.686 12.284 4.686 16.97-.001z" />
|
|
26
26
|
</svg>
|
|
27
27
|
);
|
|
28
28
|
}
|
|
@@ -42,7 +42,7 @@ export function SidebarLeftArrowIcon({
|
|
|
42
42
|
style={style}
|
|
43
43
|
className={className}
|
|
44
44
|
>
|
|
45
|
-
<path d="M152 412.5L3.5 264.5c-4.7-4.7-4.7-12.3 0-17L152 99.5c4.7-4.7 12.3-4.7 17 0l7.1 7.1c4.7 4.7 4.7 12.3 0 17L60.1 239H372c6.6 0 12 5.4 12 12v10c0 6.6-5.4 12-12 12H60.1L176 388.4c4.7 4.7 4.7 12.3 0 17l-7.1 7.1c-4.6 4.7-12.2 4.7-16.9 0zM436 64h-8c-6.6 0-12 5.4-12 12v360c0 6.6 5.4 12 12 12h8c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12z"
|
|
45
|
+
<path d="M152 412.5L3.5 264.5c-4.7-4.7-4.7-12.3 0-17L152 99.5c4.7-4.7 12.3-4.7 17 0l7.1 7.1c4.7 4.7 4.7 12.3 0 17L60.1 239H372c6.6 0 12 5.4 12 12v10c0 6.6-5.4 12-12 12H60.1L176 388.4c4.7 4.7 4.7 12.3 0 17l-7.1 7.1c-4.6 4.7-12.2 4.7-16.9 0zM436 64h-8c-6.6 0-12 5.4-12 12v360c0 6.6 5.4 12 12 12h8c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12z" />
|
|
46
46
|
</svg>
|
|
47
47
|
);
|
|
48
48
|
}
|
|
@@ -62,7 +62,7 @@ export function SidebarRightArrowIcon({
|
|
|
62
62
|
style={style}
|
|
63
63
|
className={className}
|
|
64
64
|
>
|
|
65
|
-
<path d="M296 99.5l148.5 148c4.7 4.7 4.7 12.3 0 17L296 412.5c-4.7 4.7-12.3 4.7-17 0l-7.1-7.1c-4.7-4.7-4.7-12.3 0-17l116-115.4H76c-6.6 0-12-5.4-12-12v-10c0-6.6 5.4-12 12-12h311.9L272 123.6c-4.7-4.7-4.7-12.3 0-17l7.1-7.1c4.6-4.7 12.2-4.7 16.9 0zM12 448h8c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12h-8C5.4 64 0 69.4 0 76v360c0 6.6 5.4 12 12 12z"
|
|
65
|
+
<path d="M296 99.5l148.5 148c4.7 4.7 4.7 12.3 0 17L296 412.5c-4.7 4.7-12.3 4.7-17 0l-7.1-7.1c-4.7-4.7-4.7-12.3 0-17l116-115.4H76c-6.6 0-12-5.4-12-12v-10c0-6.6 5.4-12 12-12h311.9L272 123.6c-4.7-4.7-4.7-12.3 0-17l7.1-7.1c4.6-4.7 12.2-4.7 16.9 0zM12 448h8c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12h-8C5.4 64 0 69.4 0 76v360c0 6.6 5.4 12 12 12z" />
|
|
66
66
|
</svg>
|
|
67
67
|
);
|
|
68
68
|
}
|
package/src/mergeRefs/index.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export const mergeRefs =
|
|
2
2
|
<T>(...refs: React.Ref<T>[]): React.RefCallback<T> =>
|
|
3
|
-
(element: T) =>
|
|
4
|
-
|
|
3
|
+
(element: T) => {
|
|
4
|
+
for (const ref of refs) {
|
|
5
5
|
if (typeof ref === 'function') ref(element);
|
|
6
6
|
else if (ref && typeof ref === 'object')
|
|
7
7
|
(ref as React.MutableRefObject<T>).current = element;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
|
+
};
|
|
@@ -39,7 +39,9 @@ export function useMediaQuery(media: string): MediaQueryList {
|
|
|
39
39
|
listener: (mql) => {
|
|
40
40
|
const match = list[mql.media];
|
|
41
41
|
if (match) {
|
|
42
|
-
match.notifiers
|
|
42
|
+
for (const updateFn of match.notifiers) {
|
|
43
|
+
updateFn({});
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
};
|
|
@@ -106,7 +108,7 @@ function getResizeObserver(): ResizeObserver | undefined {
|
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
resizeObserver = new ResizeObserver((entries) => {
|
|
109
|
-
|
|
111
|
+
for (const entry of entries) {
|
|
110
112
|
const node = entry.target;
|
|
111
113
|
|
|
112
114
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -143,7 +145,7 @@ function getResizeObserver(): ResizeObserver | undefined {
|
|
|
143
145
|
}
|
|
144
146
|
return new DOMRect(0, 0, elRect.width, elRect.height);
|
|
145
147
|
});
|
|
146
|
-
}
|
|
148
|
+
}
|
|
147
149
|
});
|
|
148
150
|
|
|
149
151
|
return resizeObserver;
|