tinacms 3.0.0 → 3.0.2

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.
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { WidgetProps } from './color-input';
3
+ export declare const BlockWidget: React.FC<WidgetProps>;
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ export interface WidgetProps {
3
+ presetColors: string[];
4
+ color: string;
5
+ onChange: (color: string | null) => void;
6
+ width: string;
7
+ }
8
+ export declare const useHexInput: (color: string, onChange: (color: string | null) => void) => {
9
+ inputValue: string;
10
+ handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
11
+ handleFocus: () => void;
12
+ handleBlur: () => void;
13
+ handleSwatchClick: (c: string) => void;
14
+ };
15
+ export declare const SwatchButton: React.FC<{
16
+ color: string;
17
+ isSelected: boolean;
18
+ onClick: () => void;
19
+ }>;
20
+ export declare const ColorPreview: React.FC<{
21
+ color: string;
22
+ size?: 'sm' | 'lg';
23
+ }>;
24
+ export declare const HexInput: React.FC<{
25
+ value: string;
26
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
27
+ onFocus: () => void;
28
+ onBlur: () => void;
29
+ fullWidth?: boolean;
30
+ }>;
31
+ export declare const SwatchGrid: React.FC<{
32
+ colors: string[];
33
+ selectedColor: string;
34
+ onSelect: (color: string) => void;
35
+ }>;
@@ -1,11 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { ColorFormat } from './color-formatter';
3
- type WrappedFieldProps = any;
3
+ interface FieldInput {
4
+ value: string | null;
5
+ onChange: (value: string | null) => void;
6
+ }
4
7
  interface Props {
5
8
  colorFormat: ColorFormat;
6
9
  userColors: string[];
7
10
  widget?: 'sketch' | 'block';
8
- input: WrappedFieldProps['input'];
11
+ width?: string;
12
+ input: FieldInput;
9
13
  }
10
14
  export declare const ColorPicker: React.FC<Props>;
11
15
  export {};
@@ -0,0 +1,37 @@
1
+ export declare const TRANSPARENT = "transparent";
2
+ export declare const isValidHex: (value: string) => boolean;
3
+ export declare const expandHex: (hex: string) => string;
4
+ export declare const hexToRgb: (hex: string) => {
5
+ r: number;
6
+ g: number;
7
+ b: number;
8
+ } | null;
9
+ /**
10
+ * Converts RGB color values to a hex color string (e.g., "#FF0000" for red).
11
+ *
12
+ * How it works:
13
+ * We need to convert three numbers (r, g, b) each ranging 0-255 into a 6-digit hex string.
14
+ * For example: rgb(255, 128, 0) should become "#FF8000"
15
+ *
16
+ * The bit-shifting approach combines all three values into one number:
17
+ * - (1 << 24) = 16777216 (0x1000000) - This adds a leading '1' to guarantee we always
18
+ * get 7 hex digits, which we later remove. Without this, rgb(0, 0, 255) would give
19
+ * us "FF" instead of "0000FF".
20
+ * - (r << 16) shifts red left by 16 bits, placing it in positions for the first two hex digits
21
+ * - (g << 8) shifts green left by 8 bits, placing it in positions for the middle two hex digits
22
+ * - b stays as-is, occupying the last two hex digits
23
+ *
24
+ * Example with rgb(255, 128, 0):
25
+ * 16777216 + (255 << 16) + (128 << 8) + 0
26
+ * = 16777216 + 16711680 + 32768 + 0
27
+ * = 33521664
28
+ * = 0x1FF8000 (as hex string: "1FF8000")
29
+ * After slice(1): "FF8000"
30
+ * Final result: "#FF8000"
31
+ */
32
+ export declare const rgbToHex: (r: number, g: number, b: number) => string;
33
+ export declare const checkerboardStyle: (size?: number) => {
34
+ backgroundImage: string;
35
+ backgroundSize: string;
36
+ backgroundPosition: string;
37
+ };
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { WidgetProps } from './color-input';
3
+ export declare const SketchWidget: React.FC<WidgetProps>;
@@ -4,6 +4,7 @@ export interface ColorFieldProps {
4
4
  colorFormat: string;
5
5
  colors: string[];
6
6
  widget?: 'sketch' | 'block';
7
+ width?: string;
7
8
  }
8
9
  export declare const ColorField: (props: import("./wrap-field-with-meta").InputFieldType<InputProps, ColorFieldProps>) => React.JSX.Element;
9
10
  export declare const ColorFieldPlugin: {
@@ -11,7 +11,7 @@ export declare const EditorContainer: {
11
11
  declare const editorVariants: (props?: {
12
12
  disabled?: boolean;
13
13
  focused?: boolean;
14
- variant?: "default" | "select" | "none" | "comment" | "demo" | "ai" | "aiChat" | "fullWidth";
14
+ variant?: "default" | "select" | "none" | "fullWidth" | "comment" | "demo" | "ai" | "aiChat";
15
15
  } & import("class-variance-authority/types").ClassProp) => string;
16
16
  export type EditorProps = PlateContentProps & VariantProps<typeof editorVariants>;
17
17
  export declare const Editor: React.ForwardRefExoticComponent<Omit<import("@udecode/plate").EditableProps, "decorate"> & {
@@ -22,6 +22,6 @@ export declare const Editor: React.ForwardRefExoticComponent<Omit<import("@udeco
22
22
  } & VariantProps<(props?: {
23
23
  disabled?: boolean;
24
24
  focused?: boolean;
25
- variant?: "default" | "select" | "none" | "comment" | "demo" | "ai" | "aiChat" | "fullWidth";
25
+ variant?: "default" | "select" | "none" | "fullWidth" | "comment" | "demo" | "ai" | "aiChat";
26
26
  } & import("class-variance-authority/types").ClassProp) => string> & React.RefAttributes<HTMLDivElement>>;
27
27
  export {};
@@ -3,12 +3,12 @@ import { type VariantProps } from 'class-variance-authority';
3
3
  export declare const buttonVariants: (props?: {
4
4
  isMenu?: boolean;
5
5
  size?: "default" | "none" | "icon" | "sm" | "lg" | "sms" | "xs";
6
- variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink";
6
+ variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink" | "tinaPrimary";
7
7
  } & import("class-variance-authority/types").ClassProp) => string;
8
8
  export declare const Button: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
9
9
  asChild?: boolean;
10
10
  } & VariantProps<(props?: {
11
11
  isMenu?: boolean;
12
12
  size?: "default" | "none" | "icon" | "sm" | "lg" | "sms" | "xs";
13
- variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink";
13
+ variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink" | "tinaPrimary";
14
14
  } & import("class-variance-authority/types").ClassProp) => string> & React.RefAttributes<HTMLButtonElement>>;
@@ -6,7 +6,7 @@ export declare const Command: React.ForwardRefExoticComponent<Omit<Omit<{
6
6
  ref?: React.Ref<HTMLDivElement>;
7
7
  } & {
8
8
  asChild?: boolean;
9
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
9
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
10
10
  label?: string;
11
11
  shouldFilter?: boolean;
12
12
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -22,7 +22,7 @@ export declare const Command: React.ForwardRefExoticComponent<Omit<Omit<{
22
22
  ref?: React.Ref<HTMLDivElement>;
23
23
  } & {
24
24
  asChild?: boolean;
25
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
25
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
26
26
  label?: string;
27
27
  shouldFilter?: boolean;
28
28
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -68,7 +68,7 @@ export declare const CommandList: React.ForwardRefExoticComponent<Omit<{
68
68
  ref?: React.Ref<HTMLDivElement>;
69
69
  } & {
70
70
  asChild?: boolean;
71
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
71
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
72
72
  label?: string;
73
73
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
74
74
  export declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
@@ -77,14 +77,14 @@ export declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
77
77
  ref?: React.Ref<HTMLDivElement>;
78
78
  } & {
79
79
  asChild?: boolean;
80
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
80
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
81
81
  export declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
82
82
  children?: React.ReactNode;
83
83
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
84
84
  ref?: React.Ref<HTMLDivElement>;
85
85
  } & {
86
86
  asChild?: boolean;
87
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
87
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
88
88
  heading?: React.ReactNode;
89
89
  value?: string;
90
90
  forceMount?: boolean;
@@ -93,7 +93,7 @@ export declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick
93
93
  ref?: React.Ref<HTMLDivElement>;
94
94
  } & {
95
95
  asChild?: boolean;
96
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
96
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
97
97
  alwaysRender?: boolean;
98
98
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
99
99
  export declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
@@ -102,7 +102,7 @@ export declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
102
102
  ref?: React.Ref<HTMLDivElement>;
103
103
  } & {
104
104
  asChild?: boolean;
105
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "disabled" | "onSelect"> & {
105
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "disabled" | "onSelect"> & {
106
106
  disabled?: boolean;
107
107
  onSelect?: (value: string) => void;
108
108
  value?: string;
@@ -19,7 +19,7 @@ export type { TinaState } from './tina-state';
19
19
  export * from './forms';
20
20
  export * from './icons';
21
21
  export * from './react-dismissible';
22
- export { Nav, LocalWarning, BillingWarning, SyncStatusButton, } from './react-sidebar';
22
+ export { Nav, NavCloudLink, NavProvider, NavMenuTrigger, useNav, LocalWarning, BillingWarning, SyncStatusButton, } from './react-sidebar';
23
23
  export { useCMS } from './react-core';
24
24
  /**
25
25
  * Custom `tinacms` things
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface NavMenuTriggerProps {
3
+ className?: string;
4
+ label?: string;
5
+ }
6
+ /**
7
+ * A button component that triggers the navigation menu
8
+ * Can be used anywhere within the NavProvider hierarchy
9
+ */
10
+ export declare const NavMenuTrigger: React.FC<NavMenuTriggerProps>;
11
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { CloudConfigPlugin } from '../../react-cloud-config';
3
+ interface NavCloudLinkProps {
4
+ config: CloudConfigPlugin;
5
+ }
6
+ /**
7
+ * Shared component for rendering cloud configuration links
8
+ * Used across both admin and sidebar navigation
9
+ */
10
+ export declare const NavCloudLink: React.FC<NavCloudLinkProps>;
11
+ export {};
@@ -0,0 +1,15 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface NavContextValue {
3
+ menuIsOpen: boolean;
4
+ toggleMenu: () => void;
5
+ openMenu: () => void;
6
+ closeMenu: () => void;
7
+ }
8
+ export declare const NavContext: React.Context<NavContextValue>;
9
+ export declare const useNav: () => NavContextValue;
10
+ interface NavProviderProps {
11
+ children: ReactNode;
12
+ defaultOpen?: boolean;
13
+ }
14
+ export declare const NavProvider: React.FC<NavProviderProps>;
15
+ export {};
@@ -9,8 +9,8 @@ interface NavCollection {
9
9
  interface NavProps {
10
10
  isLocalMode: boolean;
11
11
  showHamburger?: boolean;
12
- menuIsOpen: boolean;
13
- toggleMenu: () => void;
12
+ menuIsOpen?: boolean;
13
+ toggleMenu?: () => void;
14
14
  children?: any;
15
15
  className?: string;
16
16
  userName?: string;
@@ -41,5 +41,5 @@ interface NavProps {
41
41
  };
42
42
  }>;
43
43
  }
44
- export declare const Nav: ({ isLocalMode, showHamburger, menuIsOpen, toggleMenu, className, children, showCollections, collectionsInfo, screens, cloudConfigs, contentCreators, sidebarWidth, RenderNavSite, RenderNavCloud, RenderNavCollection, AuthRenderNavCollection, ...props }: NavProps) => React.JSX.Element;
44
+ export declare const Nav: ({ isLocalMode, showHamburger, menuIsOpen: menuIsOpenProp, toggleMenu: toggleMenuProp, className, children, showCollections, collectionsInfo, screens, cloudConfigs, contentCreators, sidebarWidth, RenderNavSite, RenderNavCloud, RenderNavCollection, AuthRenderNavCollection, ...props }: NavProps) => React.JSX.Element;
45
45
  export {};
@@ -3,3 +3,6 @@ export { SidebarProvider } from './components/sidebar';
3
3
  export { Nav } from './components/nav';
4
4
  export { LocalWarning, BillingWarning } from './components/local-warning';
5
5
  export { SyncStatusButton } from './components/sync-status';
6
+ export { NavCloudLink } from './components/nav-components';
7
+ export { NavProvider, useNav } from './components/nav-context';
8
+ export { NavMenuTrigger } from './components/NavMenuTrigger';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tinacms",
3
3
  "type": "module",
4
4
  "typings": "dist/index.d.ts",
5
- "version": "3.0.0",
5
+ "version": "3.0.2",
6
6
  "main": "dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
@@ -105,7 +105,7 @@
105
105
  "monaco-editor": "0.31.0",
106
106
  "prism-react-renderer": "^2.4.1",
107
107
  "prop-types": "15.7.2",
108
- "react-color": "^2.19.3",
108
+ "react-colorful": "^5.6.1",
109
109
  "react-datetime": "^3.3.1",
110
110
  "react-day-picker": "^9.11.1",
111
111
  "react-dropzone": "14.2.3",
@@ -119,7 +119,7 @@
119
119
  "zod": "^3.24.2",
120
120
  "@tinacms/mdx": "2.0.0",
121
121
  "@tinacms/schema-tools": "2.0.0",
122
- "@tinacms/search": "1.1.4"
122
+ "@tinacms/search": "1.1.5"
123
123
  },
124
124
  "devDependencies": {
125
125
  "@graphql-tools/utils": "^10.8.1",
@@ -133,11 +133,9 @@
133
133
  "@types/node": "^22.13.1",
134
134
  "@types/prop-types": "^15.7.14",
135
135
  "@types/react": "^18.3.18",
136
- "@types/react-color": "^3.0.13",
137
136
  "@types/react-dom": "^18.3.5",
138
137
  "happy-dom": "15.10.2",
139
138
  "identity-obj-proxy": "^3.0.0",
140
- "isomorphic-fetch": "^3.0.0",
141
139
  "jest-file-snapshot": "^0.7.0",
142
140
  "lowlight": "^3.3.0",
143
141
  "next": "14.2.10",
@@ -149,7 +147,7 @@
149
147
  "typescript": "^5.7.3",
150
148
  "vite": "^5.4.14",
151
149
  "vitest": "^2.1.9",
152
- "@tinacms/scripts": "1.4.1"
150
+ "@tinacms/scripts": "1.4.2"
153
151
  },
154
152
  "peerDependencies": {
155
153
  "react": ">=16.14.0",