@measured/puck-plugin-heading-analyzer 0.14.0-canary.f975d87 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -31,4 +31,4 @@ export function Page() {
31
31
 
32
32
  ## License
33
33
 
34
- MIT © [Measured Co.](https://github.com/measuredco)
34
+ MIT © [Measured Corporation Ltd](https://measured.co)
package/dist/index.d.ts CHANGED
@@ -1,10 +1,18 @@
1
- import { ReactElement, ReactNode } from 'react';
1
+ import { ReactNode, ReactElement } from 'react';
2
2
 
3
3
  type ItemSelector = {
4
4
  index: number;
5
5
  zone?: string;
6
6
  };
7
7
 
8
+ type iconTypes = "Smartphone" | "Monitor" | "Tablet";
9
+ type Viewport = {
10
+ width: number;
11
+ height?: number | "auto";
12
+ label?: string;
13
+ icon?: iconTypes | ReactNode;
14
+ };
15
+
8
16
  type FieldOption = {
9
17
  label: string;
10
18
  value: string | number | boolean;
@@ -43,6 +51,8 @@ type ArrayField<Props extends {
43
51
  };
44
52
  defaultItemProps?: Props[0];
45
53
  getItemSummary?: (item: Props[0], index?: number) => string;
54
+ max?: number;
55
+ min?: number;
46
56
  };
47
57
  type ObjectField<Props extends {
48
58
  [key: string]: any;
@@ -51,7 +61,7 @@ type ObjectField<Props extends {
51
61
  }> = BaseField & {
52
62
  type: "object";
53
63
  objectFields: {
54
- [SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
64
+ [SubPropName in keyof Props]: Field<Props[SubPropName]>;
55
65
  };
56
66
  };
57
67
  type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
@@ -79,11 +89,15 @@ type ExternalField<Props extends {
79
89
  placeholder?: string;
80
90
  fetchList: (params: {
81
91
  query: string;
92
+ filters: Record<string, any>;
82
93
  }) => Promise<any[] | null>;
83
94
  mapProp?: (value: any) => Props;
84
- getItemSummary: (item: Props, index?: number) => string;
95
+ mapRow?: (value: any) => Record<string, string | number>;
96
+ getItemSummary?: (item: Props, index?: number) => string;
85
97
  showSearch?: boolean;
86
98
  initialQuery?: string;
99
+ filterFields?: Record<string, Field>;
100
+ initialFilters?: Record<string, any>;
87
101
  };
88
102
  type CustomField<Props extends {
89
103
  [key: string]: any;
@@ -124,6 +138,14 @@ type UiState = {
124
138
  expanded?: boolean;
125
139
  }>;
126
140
  isDragging: boolean;
141
+ viewports: {
142
+ current: {
143
+ width: number;
144
+ height: number | "auto";
145
+ };
146
+ controlsVisible: boolean;
147
+ options: Viewport[];
148
+ };
127
149
  };
128
150
 
129
151
  type InputProps<F = Field<any>> = {
@@ -141,7 +163,7 @@ type RenderFunc<Props extends {
141
163
  [key: string]: any;
142
164
  } = {
143
165
  children: ReactNode;
144
- }> = React.FunctionComponent<Props>;
166
+ }> = (props: Props) => ReactElement;
145
167
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
146
168
  type OverrideKey = (typeof overrideKeys)[number];
147
169
  type OverridesGeneric<Shape extends {
@@ -171,7 +193,10 @@ type Overrides = OverridesGeneric<{
171
193
  className?: string;
172
194
  }>;
173
195
  components: RenderFunc;
174
- componentItem: RenderFunc;
196
+ componentItem: RenderFunc<{
197
+ children: ReactNode;
198
+ name: string;
199
+ }>;
175
200
  outline: RenderFunc;
176
201
  puck: RenderFunc;
177
202
  }>;