@elementor/editor-controls 3.33.0-139 → 3.33.0-141
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/index.d.mts +80 -55
- package/dist/index.d.ts +80 -55
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/bound-prop-context/prop-context.tsx +7 -5
- package/src/components/repeater.tsx +45 -9
- package/src/index.ts +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -146,12 +146,12 @@ declare const NumberControl: ControlComponent<({ placeholder: labelPlaceholder,
|
|
|
146
146
|
}) => React$1.JSX.Element>;
|
|
147
147
|
|
|
148
148
|
type MultiSizePropValue = Record<PropKey, SizePropValue>;
|
|
149
|
-
type Item
|
|
149
|
+
type Item = {
|
|
150
150
|
icon: ReactNode;
|
|
151
151
|
label: string;
|
|
152
152
|
bind: PropKey;
|
|
153
153
|
};
|
|
154
|
-
type EqualUnequalItems = [Item
|
|
154
|
+
type EqualUnequalItems = [Item, Item, Item, Item];
|
|
155
155
|
type Props$3<TMultiPropType extends string, TPropValue extends MultiSizePropValue> = {
|
|
156
156
|
label: string;
|
|
157
157
|
icon: ReactNode;
|
|
@@ -342,8 +342,58 @@ type ClearIconButtonProps = {
|
|
|
342
342
|
};
|
|
343
343
|
declare const ClearIconButton: ({ tooltipText, onClick, disabled, size }: ClearIconButtonProps) => React$1.JSX.Element;
|
|
344
344
|
|
|
345
|
+
type Action = {
|
|
346
|
+
type: string;
|
|
347
|
+
payload?: object;
|
|
348
|
+
};
|
|
349
|
+
type SetValueMeta<TAction = Action> = {
|
|
350
|
+
bind?: PropKey;
|
|
351
|
+
validation?: (value: PropValue) => boolean;
|
|
352
|
+
action?: TAction;
|
|
353
|
+
};
|
|
354
|
+
type SetValue<T> = (value: T, options?: CreateOptions, meta?: SetValueMeta) => void;
|
|
355
|
+
type PropContext<T extends PropValue, P extends PropType> = {
|
|
356
|
+
setValue: SetValue<T>;
|
|
357
|
+
value: T | null;
|
|
358
|
+
propType: P;
|
|
359
|
+
placeholder?: T;
|
|
360
|
+
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
361
|
+
};
|
|
362
|
+
declare const PropContext: React$1.Context<PropContext<PropValue, PropType> | null>;
|
|
363
|
+
type PropProviderProps<T extends PropValue, P extends PropType> = React$1.PropsWithChildren<PropContext<T, P>>;
|
|
364
|
+
declare const PropProvider: <T extends PropValue, P extends PropType>({ children, value, setValue, propType, placeholder, isDisabled, }: PropProviderProps<T, P>) => React$1.JSX.Element;
|
|
365
|
+
|
|
366
|
+
type PropKeyContextValue<T, P> = {
|
|
367
|
+
bind: PropKey;
|
|
368
|
+
setValue: SetValue<T>;
|
|
369
|
+
value: T;
|
|
370
|
+
propType: P;
|
|
371
|
+
placeholder?: T;
|
|
372
|
+
path: PropKey[];
|
|
373
|
+
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
374
|
+
disabled?: boolean;
|
|
375
|
+
};
|
|
376
|
+
type PropKeyProviderProps = React$1.PropsWithChildren<{
|
|
377
|
+
bind: PropKey;
|
|
378
|
+
}>;
|
|
379
|
+
declare const PropKeyProvider: ({ children, bind }: PropKeyProviderProps) => React$1.JSX.Element;
|
|
380
|
+
|
|
381
|
+
type UseBoundProp<TValue extends PropValue> = {
|
|
382
|
+
bind: PropKey;
|
|
383
|
+
setValue: SetValue<TValue | null>;
|
|
384
|
+
value: TValue;
|
|
385
|
+
propType: PropType;
|
|
386
|
+
placeholder?: TValue;
|
|
387
|
+
path: PropKey[];
|
|
388
|
+
restoreValue: () => void;
|
|
389
|
+
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
390
|
+
disabled?: boolean;
|
|
391
|
+
};
|
|
392
|
+
declare function useBoundProp<T extends PropValue = PropValue, P extends PropType = PropType>(): PropKeyContextValue<T, P>;
|
|
393
|
+
declare function useBoundProp<TKey extends string, TValue extends PropValue>(propTypeUtil: PropTypeUtil<TKey, TValue>): UseBoundProp<TValue>;
|
|
394
|
+
|
|
345
395
|
type AnchorEl = HTMLElement | null;
|
|
346
|
-
type
|
|
396
|
+
type RepeaterItem<T> = {
|
|
347
397
|
disabled?: boolean;
|
|
348
398
|
} & T;
|
|
349
399
|
type CollectionPropUtil<T> = PropTypeUtil<PropKey, T[]>;
|
|
@@ -354,12 +404,36 @@ type RepeaterItemContentProps<T> = {
|
|
|
354
404
|
collectionPropUtil?: CollectionPropUtil<T>;
|
|
355
405
|
};
|
|
356
406
|
type RepeaterItemContent<T> = React$1.ComponentType<RepeaterItemContentProps<T>>;
|
|
407
|
+
type ItemActionPayload<T> = Array<{
|
|
408
|
+
index: number;
|
|
409
|
+
item: T;
|
|
410
|
+
}>;
|
|
411
|
+
type AddItemMeta<T> = {
|
|
412
|
+
type: 'add';
|
|
413
|
+
payload: ItemActionPayload<T>;
|
|
414
|
+
};
|
|
415
|
+
type RemoveItemMeta<T> = {
|
|
416
|
+
type: 'remove';
|
|
417
|
+
payload: ItemActionPayload<T>;
|
|
418
|
+
};
|
|
419
|
+
type DuplicateItemMeta<T> = {
|
|
420
|
+
type: 'duplicate';
|
|
421
|
+
payload: ItemActionPayload<T>;
|
|
422
|
+
};
|
|
423
|
+
type ReorderItemMeta = {
|
|
424
|
+
type: 'reorder';
|
|
425
|
+
payload: {
|
|
426
|
+
from: number;
|
|
427
|
+
to: number;
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
type SetRepeaterValuesMeta<T> = SetValueMeta<AddItemMeta<T>> | SetValueMeta<RemoveItemMeta<T>> | SetValueMeta<DuplicateItemMeta<T>> | SetValueMeta<ReorderItemMeta>;
|
|
357
431
|
type RepeaterProps<T> = {
|
|
358
432
|
label: string;
|
|
359
433
|
values?: T[];
|
|
360
434
|
addToBottom?: boolean;
|
|
361
435
|
openOnAdd?: boolean;
|
|
362
|
-
setValues: (newValue: T[]) => void;
|
|
436
|
+
setValues: (newValue: T[], _: CreateOptions, meta?: SetRepeaterValuesMeta<T>) => void;
|
|
363
437
|
disabled?: boolean;
|
|
364
438
|
itemSettings: {
|
|
365
439
|
initialValues: T;
|
|
@@ -376,7 +450,7 @@ type RepeaterProps<T> = {
|
|
|
376
450
|
isSortable?: boolean;
|
|
377
451
|
collectionPropUtil?: CollectionPropUtil<T>;
|
|
378
452
|
};
|
|
379
|
-
declare const Repeater: <T>({ label, itemSettings, disabled, openOnAdd, addToBottom, values: repeaterValues, setValues: setRepeaterValues, showDuplicate, showToggle, isSortable, collectionPropUtil, }: RepeaterProps<
|
|
453
|
+
declare const Repeater: <T>({ label, itemSettings, disabled, openOnAdd, addToBottom, values: repeaterValues, setValues: setRepeaterValues, showDuplicate, showToggle, isSortable, collectionPropUtil, }: RepeaterProps<RepeaterItem<T>>) => React$1.JSX.Element;
|
|
380
454
|
|
|
381
455
|
declare function FloatingActionsBar({ actions, children }: PropsWithChildren<{
|
|
382
456
|
actions: ReactElement[];
|
|
@@ -404,55 +478,6 @@ type ControlActionsProviderProps = PropsWithChildren<ControlActionsContext>;
|
|
|
404
478
|
declare const ControlActionsProvider: ({ children, items }: ControlActionsProviderProps) => React$1.JSX.Element;
|
|
405
479
|
declare const useControlActions: () => ControlActionsContext;
|
|
406
480
|
|
|
407
|
-
type SetValueMeta = {
|
|
408
|
-
bind?: PropKey;
|
|
409
|
-
validation?: (value: PropValue) => boolean;
|
|
410
|
-
action?: {
|
|
411
|
-
type: string;
|
|
412
|
-
payload?: Record<string, unknown>;
|
|
413
|
-
};
|
|
414
|
-
};
|
|
415
|
-
type SetValue<T> = (value: T, options?: CreateOptions, meta?: SetValueMeta) => void;
|
|
416
|
-
type PropContext<T extends PropValue, P extends PropType> = {
|
|
417
|
-
setValue: SetValue<T>;
|
|
418
|
-
value: T | null;
|
|
419
|
-
propType: P;
|
|
420
|
-
placeholder?: T;
|
|
421
|
-
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
422
|
-
};
|
|
423
|
-
declare const PropContext: React$1.Context<PropContext<PropValue, PropType> | null>;
|
|
424
|
-
type PropProviderProps<T extends PropValue, P extends PropType> = React$1.PropsWithChildren<PropContext<T, P>>;
|
|
425
|
-
declare const PropProvider: <T extends PropValue, P extends PropType>({ children, value, setValue, propType, placeholder, isDisabled, }: PropProviderProps<T, P>) => React$1.JSX.Element;
|
|
426
|
-
|
|
427
|
-
type PropKeyContextValue<T, P> = {
|
|
428
|
-
bind: PropKey;
|
|
429
|
-
setValue: SetValue<T>;
|
|
430
|
-
value: T;
|
|
431
|
-
propType: P;
|
|
432
|
-
placeholder?: T;
|
|
433
|
-
path: PropKey[];
|
|
434
|
-
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
435
|
-
disabled?: boolean;
|
|
436
|
-
};
|
|
437
|
-
type PropKeyProviderProps = React$1.PropsWithChildren<{
|
|
438
|
-
bind: PropKey;
|
|
439
|
-
}>;
|
|
440
|
-
declare const PropKeyProvider: ({ children, bind }: PropKeyProviderProps) => React$1.JSX.Element;
|
|
441
|
-
|
|
442
|
-
type UseBoundProp<TValue extends PropValue> = {
|
|
443
|
-
bind: PropKey;
|
|
444
|
-
setValue: SetValue<TValue | null>;
|
|
445
|
-
value: TValue;
|
|
446
|
-
propType: PropType;
|
|
447
|
-
placeholder?: TValue;
|
|
448
|
-
path: PropKey[];
|
|
449
|
-
restoreValue: () => void;
|
|
450
|
-
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
451
|
-
disabled?: boolean;
|
|
452
|
-
};
|
|
453
|
-
declare function useBoundProp<T extends PropValue = PropValue, P extends PropType = PropType>(): PropKeyContextValue<T, P>;
|
|
454
|
-
declare function useBoundProp<TKey extends string, TValue extends PropValue>(propTypeUtil: PropTypeUtil<TKey, TValue>): UseBoundProp<TValue>;
|
|
455
|
-
|
|
456
481
|
type ControlReplacement = {
|
|
457
482
|
component: ComponentType;
|
|
458
483
|
condition: ({ value }: ConditionArgs) => boolean;
|
|
@@ -510,4 +535,4 @@ type UseInternalStateOptions<TValue> = {
|
|
|
510
535
|
};
|
|
511
536
|
declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue, options?: CreateOptions, meta?: SetValueMeta) => void];
|
|
512
537
|
|
|
513
|
-
export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, ImageControl, ItemSelector, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, TransformBaseControl, TransformRepeaterControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
|
|
538
|
+
export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, ImageControl, type ItemActionPayload, ItemSelector, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, TransformBaseControl, TransformRepeaterControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
|
package/dist/index.d.ts
CHANGED
|
@@ -146,12 +146,12 @@ declare const NumberControl: ControlComponent<({ placeholder: labelPlaceholder,
|
|
|
146
146
|
}) => React$1.JSX.Element>;
|
|
147
147
|
|
|
148
148
|
type MultiSizePropValue = Record<PropKey, SizePropValue>;
|
|
149
|
-
type Item
|
|
149
|
+
type Item = {
|
|
150
150
|
icon: ReactNode;
|
|
151
151
|
label: string;
|
|
152
152
|
bind: PropKey;
|
|
153
153
|
};
|
|
154
|
-
type EqualUnequalItems = [Item
|
|
154
|
+
type EqualUnequalItems = [Item, Item, Item, Item];
|
|
155
155
|
type Props$3<TMultiPropType extends string, TPropValue extends MultiSizePropValue> = {
|
|
156
156
|
label: string;
|
|
157
157
|
icon: ReactNode;
|
|
@@ -342,8 +342,58 @@ type ClearIconButtonProps = {
|
|
|
342
342
|
};
|
|
343
343
|
declare const ClearIconButton: ({ tooltipText, onClick, disabled, size }: ClearIconButtonProps) => React$1.JSX.Element;
|
|
344
344
|
|
|
345
|
+
type Action = {
|
|
346
|
+
type: string;
|
|
347
|
+
payload?: object;
|
|
348
|
+
};
|
|
349
|
+
type SetValueMeta<TAction = Action> = {
|
|
350
|
+
bind?: PropKey;
|
|
351
|
+
validation?: (value: PropValue) => boolean;
|
|
352
|
+
action?: TAction;
|
|
353
|
+
};
|
|
354
|
+
type SetValue<T> = (value: T, options?: CreateOptions, meta?: SetValueMeta) => void;
|
|
355
|
+
type PropContext<T extends PropValue, P extends PropType> = {
|
|
356
|
+
setValue: SetValue<T>;
|
|
357
|
+
value: T | null;
|
|
358
|
+
propType: P;
|
|
359
|
+
placeholder?: T;
|
|
360
|
+
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
361
|
+
};
|
|
362
|
+
declare const PropContext: React$1.Context<PropContext<PropValue, PropType> | null>;
|
|
363
|
+
type PropProviderProps<T extends PropValue, P extends PropType> = React$1.PropsWithChildren<PropContext<T, P>>;
|
|
364
|
+
declare const PropProvider: <T extends PropValue, P extends PropType>({ children, value, setValue, propType, placeholder, isDisabled, }: PropProviderProps<T, P>) => React$1.JSX.Element;
|
|
365
|
+
|
|
366
|
+
type PropKeyContextValue<T, P> = {
|
|
367
|
+
bind: PropKey;
|
|
368
|
+
setValue: SetValue<T>;
|
|
369
|
+
value: T;
|
|
370
|
+
propType: P;
|
|
371
|
+
placeholder?: T;
|
|
372
|
+
path: PropKey[];
|
|
373
|
+
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
374
|
+
disabled?: boolean;
|
|
375
|
+
};
|
|
376
|
+
type PropKeyProviderProps = React$1.PropsWithChildren<{
|
|
377
|
+
bind: PropKey;
|
|
378
|
+
}>;
|
|
379
|
+
declare const PropKeyProvider: ({ children, bind }: PropKeyProviderProps) => React$1.JSX.Element;
|
|
380
|
+
|
|
381
|
+
type UseBoundProp<TValue extends PropValue> = {
|
|
382
|
+
bind: PropKey;
|
|
383
|
+
setValue: SetValue<TValue | null>;
|
|
384
|
+
value: TValue;
|
|
385
|
+
propType: PropType;
|
|
386
|
+
placeholder?: TValue;
|
|
387
|
+
path: PropKey[];
|
|
388
|
+
restoreValue: () => void;
|
|
389
|
+
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
390
|
+
disabled?: boolean;
|
|
391
|
+
};
|
|
392
|
+
declare function useBoundProp<T extends PropValue = PropValue, P extends PropType = PropType>(): PropKeyContextValue<T, P>;
|
|
393
|
+
declare function useBoundProp<TKey extends string, TValue extends PropValue>(propTypeUtil: PropTypeUtil<TKey, TValue>): UseBoundProp<TValue>;
|
|
394
|
+
|
|
345
395
|
type AnchorEl = HTMLElement | null;
|
|
346
|
-
type
|
|
396
|
+
type RepeaterItem<T> = {
|
|
347
397
|
disabled?: boolean;
|
|
348
398
|
} & T;
|
|
349
399
|
type CollectionPropUtil<T> = PropTypeUtil<PropKey, T[]>;
|
|
@@ -354,12 +404,36 @@ type RepeaterItemContentProps<T> = {
|
|
|
354
404
|
collectionPropUtil?: CollectionPropUtil<T>;
|
|
355
405
|
};
|
|
356
406
|
type RepeaterItemContent<T> = React$1.ComponentType<RepeaterItemContentProps<T>>;
|
|
407
|
+
type ItemActionPayload<T> = Array<{
|
|
408
|
+
index: number;
|
|
409
|
+
item: T;
|
|
410
|
+
}>;
|
|
411
|
+
type AddItemMeta<T> = {
|
|
412
|
+
type: 'add';
|
|
413
|
+
payload: ItemActionPayload<T>;
|
|
414
|
+
};
|
|
415
|
+
type RemoveItemMeta<T> = {
|
|
416
|
+
type: 'remove';
|
|
417
|
+
payload: ItemActionPayload<T>;
|
|
418
|
+
};
|
|
419
|
+
type DuplicateItemMeta<T> = {
|
|
420
|
+
type: 'duplicate';
|
|
421
|
+
payload: ItemActionPayload<T>;
|
|
422
|
+
};
|
|
423
|
+
type ReorderItemMeta = {
|
|
424
|
+
type: 'reorder';
|
|
425
|
+
payload: {
|
|
426
|
+
from: number;
|
|
427
|
+
to: number;
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
type SetRepeaterValuesMeta<T> = SetValueMeta<AddItemMeta<T>> | SetValueMeta<RemoveItemMeta<T>> | SetValueMeta<DuplicateItemMeta<T>> | SetValueMeta<ReorderItemMeta>;
|
|
357
431
|
type RepeaterProps<T> = {
|
|
358
432
|
label: string;
|
|
359
433
|
values?: T[];
|
|
360
434
|
addToBottom?: boolean;
|
|
361
435
|
openOnAdd?: boolean;
|
|
362
|
-
setValues: (newValue: T[]) => void;
|
|
436
|
+
setValues: (newValue: T[], _: CreateOptions, meta?: SetRepeaterValuesMeta<T>) => void;
|
|
363
437
|
disabled?: boolean;
|
|
364
438
|
itemSettings: {
|
|
365
439
|
initialValues: T;
|
|
@@ -376,7 +450,7 @@ type RepeaterProps<T> = {
|
|
|
376
450
|
isSortable?: boolean;
|
|
377
451
|
collectionPropUtil?: CollectionPropUtil<T>;
|
|
378
452
|
};
|
|
379
|
-
declare const Repeater: <T>({ label, itemSettings, disabled, openOnAdd, addToBottom, values: repeaterValues, setValues: setRepeaterValues, showDuplicate, showToggle, isSortable, collectionPropUtil, }: RepeaterProps<
|
|
453
|
+
declare const Repeater: <T>({ label, itemSettings, disabled, openOnAdd, addToBottom, values: repeaterValues, setValues: setRepeaterValues, showDuplicate, showToggle, isSortable, collectionPropUtil, }: RepeaterProps<RepeaterItem<T>>) => React$1.JSX.Element;
|
|
380
454
|
|
|
381
455
|
declare function FloatingActionsBar({ actions, children }: PropsWithChildren<{
|
|
382
456
|
actions: ReactElement[];
|
|
@@ -404,55 +478,6 @@ type ControlActionsProviderProps = PropsWithChildren<ControlActionsContext>;
|
|
|
404
478
|
declare const ControlActionsProvider: ({ children, items }: ControlActionsProviderProps) => React$1.JSX.Element;
|
|
405
479
|
declare const useControlActions: () => ControlActionsContext;
|
|
406
480
|
|
|
407
|
-
type SetValueMeta = {
|
|
408
|
-
bind?: PropKey;
|
|
409
|
-
validation?: (value: PropValue) => boolean;
|
|
410
|
-
action?: {
|
|
411
|
-
type: string;
|
|
412
|
-
payload?: Record<string, unknown>;
|
|
413
|
-
};
|
|
414
|
-
};
|
|
415
|
-
type SetValue<T> = (value: T, options?: CreateOptions, meta?: SetValueMeta) => void;
|
|
416
|
-
type PropContext<T extends PropValue, P extends PropType> = {
|
|
417
|
-
setValue: SetValue<T>;
|
|
418
|
-
value: T | null;
|
|
419
|
-
propType: P;
|
|
420
|
-
placeholder?: T;
|
|
421
|
-
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
422
|
-
};
|
|
423
|
-
declare const PropContext: React$1.Context<PropContext<PropValue, PropType> | null>;
|
|
424
|
-
type PropProviderProps<T extends PropValue, P extends PropType> = React$1.PropsWithChildren<PropContext<T, P>>;
|
|
425
|
-
declare const PropProvider: <T extends PropValue, P extends PropType>({ children, value, setValue, propType, placeholder, isDisabled, }: PropProviderProps<T, P>) => React$1.JSX.Element;
|
|
426
|
-
|
|
427
|
-
type PropKeyContextValue<T, P> = {
|
|
428
|
-
bind: PropKey;
|
|
429
|
-
setValue: SetValue<T>;
|
|
430
|
-
value: T;
|
|
431
|
-
propType: P;
|
|
432
|
-
placeholder?: T;
|
|
433
|
-
path: PropKey[];
|
|
434
|
-
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
435
|
-
disabled?: boolean;
|
|
436
|
-
};
|
|
437
|
-
type PropKeyProviderProps = React$1.PropsWithChildren<{
|
|
438
|
-
bind: PropKey;
|
|
439
|
-
}>;
|
|
440
|
-
declare const PropKeyProvider: ({ children, bind }: PropKeyProviderProps) => React$1.JSX.Element;
|
|
441
|
-
|
|
442
|
-
type UseBoundProp<TValue extends PropValue> = {
|
|
443
|
-
bind: PropKey;
|
|
444
|
-
setValue: SetValue<TValue | null>;
|
|
445
|
-
value: TValue;
|
|
446
|
-
propType: PropType;
|
|
447
|
-
placeholder?: TValue;
|
|
448
|
-
path: PropKey[];
|
|
449
|
-
restoreValue: () => void;
|
|
450
|
-
isDisabled?: (propType: PropType) => boolean | undefined;
|
|
451
|
-
disabled?: boolean;
|
|
452
|
-
};
|
|
453
|
-
declare function useBoundProp<T extends PropValue = PropValue, P extends PropType = PropType>(): PropKeyContextValue<T, P>;
|
|
454
|
-
declare function useBoundProp<TKey extends string, TValue extends PropValue>(propTypeUtil: PropTypeUtil<TKey, TValue>): UseBoundProp<TValue>;
|
|
455
|
-
|
|
456
481
|
type ControlReplacement = {
|
|
457
482
|
component: ComponentType;
|
|
458
483
|
condition: ({ value }: ConditionArgs) => boolean;
|
|
@@ -510,4 +535,4 @@ type UseInternalStateOptions<TValue> = {
|
|
|
510
535
|
};
|
|
511
536
|
declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue, options?: CreateOptions, meta?: SetValueMeta) => void];
|
|
512
537
|
|
|
513
|
-
export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, ImageControl, ItemSelector, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, TransformBaseControl, TransformRepeaterControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
|
|
538
|
+
export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, ImageControl, type ItemActionPayload, ItemSelector, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, TransformBaseControl, TransformRepeaterControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
|
package/dist/index.js
CHANGED
|
@@ -5445,10 +5445,14 @@ var Repeater3 = ({
|
|
|
5445
5445
|
const newItem = structuredClone(itemSettings.initialValues);
|
|
5446
5446
|
const newKey = generateNextKey(uniqueKeys);
|
|
5447
5447
|
if (addToBottom) {
|
|
5448
|
-
setItems([...items2, newItem], void 0, {
|
|
5448
|
+
setItems([...items2, newItem], void 0, {
|
|
5449
|
+
action: { type: "add", payload: [{ index: items2.length, item: newItem }] }
|
|
5450
|
+
});
|
|
5449
5451
|
setUniqueKeys([...uniqueKeys, newKey]);
|
|
5450
5452
|
} else {
|
|
5451
|
-
setItems([newItem, ...items2], void 0, {
|
|
5453
|
+
setItems([newItem, ...items2], void 0, {
|
|
5454
|
+
action: { type: "add", payload: [{ index: 0, item: newItem }] }
|
|
5455
|
+
});
|
|
5452
5456
|
setUniqueKeys([newKey, ...uniqueKeys]);
|
|
5453
5457
|
}
|
|
5454
5458
|
if (openOnAdd) {
|
|
@@ -5460,7 +5464,7 @@ var Repeater3 = ({
|
|
|
5460
5464
|
const newKey = generateNextKey(uniqueKeys);
|
|
5461
5465
|
const atPosition = 1 + index;
|
|
5462
5466
|
setItems([...items2.slice(0, atPosition), newItem, ...items2.slice(atPosition)], void 0, {
|
|
5463
|
-
action: { type: "duplicate" }
|
|
5467
|
+
action: { type: "duplicate", payload: [{ index: atPosition, item: newItem }] }
|
|
5464
5468
|
});
|
|
5465
5469
|
setUniqueKeys([...uniqueKeys.slice(0, atPosition), newKey, ...uniqueKeys.slice(atPosition)]);
|
|
5466
5470
|
};
|
|
@@ -5470,12 +5474,13 @@ var Repeater3 = ({
|
|
|
5470
5474
|
return pos !== index;
|
|
5471
5475
|
})
|
|
5472
5476
|
);
|
|
5477
|
+
const removedItem = items2[index];
|
|
5473
5478
|
setItems(
|
|
5474
5479
|
items2.filter((_, pos) => {
|
|
5475
5480
|
return pos !== index;
|
|
5476
5481
|
}),
|
|
5477
5482
|
void 0,
|
|
5478
|
-
{ action: { type: "remove" } }
|
|
5483
|
+
{ action: { type: "remove", payload: [{ index, item: removedItem }] } }
|
|
5479
5484
|
);
|
|
5480
5485
|
};
|
|
5481
5486
|
const toggleDisableRepeaterItem = (index) => {
|