@plasmicapp/react-web 0.2.82 → 0.2.89
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/all.d.ts +92 -6
- package/dist/index.d.ts +2 -0
- package/dist/plume/button/index.d.ts +36 -0
- package/dist/plume/text-input/index.d.ts +36 -0
- package/dist/react-utils.d.ts +1 -1
- package/dist/react-web.cjs.development.js +248 -42
- package/dist/react-web.cjs.development.js.map +1 -1
- package/dist/react-web.cjs.production.min.js +1 -1
- package/dist/react-web.cjs.production.min.js.map +1 -1
- package/dist/react-web.esm.js +247 -43
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/PlasmicImg/index.d.ts +22 -4
- package/dist/stories/PlasmicImg.stories.d.ts +2 -2
- package/lib/plasmic.css +0 -3
- package/package.json +1 -1
- package/skinny/dist/collection-utils-3487dd27.js +238 -0
- package/skinny/dist/collection-utils-3487dd27.js.map +1 -0
- package/skinny/dist/index.d.ts +2 -0
- package/skinny/dist/plume/button/index.d.ts +36 -0
- package/skinny/dist/plume/button/index.js +27 -0
- package/skinny/dist/plume/button/index.js.map +1 -0
- package/skinny/dist/plume/checkbox/index.js +2 -1
- package/skinny/dist/plume/checkbox/index.js.map +1 -1
- package/skinny/dist/plume/menu/index.js +3 -2
- package/skinny/dist/plume/menu/index.js.map +1 -1
- package/skinny/dist/plume/menu-button/index.js +2 -1
- package/skinny/dist/plume/menu-button/index.js.map +1 -1
- package/skinny/dist/plume/select/index.js +3 -2
- package/skinny/dist/plume/select/index.js.map +1 -1
- package/skinny/dist/plume/switch/index.js +2 -1
- package/skinny/dist/plume/switch/index.js.map +1 -1
- package/skinny/dist/plume/text-input/index.d.ts +36 -0
- package/skinny/dist/plume/text-input/index.js +51 -0
- package/skinny/dist/plume/text-input/index.js.map +1 -0
- package/skinny/dist/plume/triggered-overlay/index.js +3 -3
- package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
- package/skinny/dist/plume-utils-27cd384f.js +35 -0
- package/skinny/dist/plume-utils-27cd384f.js.map +1 -0
- package/skinny/dist/props-utils-7c02c0a8.js +8 -0
- package/skinny/dist/props-utils-7c02c0a8.js.map +1 -0
- package/skinny/dist/react-utils-7c01e440.js.map +1 -1
- package/skinny/dist/react-utils.d.ts +1 -1
- package/skinny/dist/render/PlasmicImg/index.d.ts +22 -4
- package/skinny/dist/render/PlasmicImg/index.js +100 -27
- package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
- package/skinny/dist/stories/PlasmicImg.stories.d.ts +2 -2
package/dist/all.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ type ClassNamesExport = ClassNamesFn & { default: ClassNamesFn };
|
|
|
19
19
|
declare function pick<T>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
|
|
20
20
|
declare function omit<T>(obj: T, ...keys: (keyof T)[]): Partial<T>;
|
|
21
21
|
|
|
22
|
-
declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : "Unexpected extraneous props"
|
|
22
|
+
declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : Partial<"Unexpected extraneous props">;
|
|
23
23
|
declare type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<React__default.ComponentProps<T>["ref"], string>;
|
|
24
24
|
|
|
25
25
|
interface Variants {
|
|
@@ -110,6 +110,7 @@ interface PlasmicImgProps extends ImgTagProps {
|
|
|
110
110
|
src: string;
|
|
111
111
|
fullHeight: number;
|
|
112
112
|
fullWidth: number;
|
|
113
|
+
aspectRatio?: number;
|
|
113
114
|
};
|
|
114
115
|
/**
|
|
115
116
|
* className applied to the wrapper element if one is used.
|
|
@@ -123,6 +124,22 @@ interface PlasmicImgProps extends ImgTagProps {
|
|
|
123
124
|
* css height
|
|
124
125
|
*/
|
|
125
126
|
displayHeight?: number | string;
|
|
127
|
+
/**
|
|
128
|
+
* css min-width
|
|
129
|
+
*/
|
|
130
|
+
displayMinWidth?: number | string;
|
|
131
|
+
/**
|
|
132
|
+
* css min-height
|
|
133
|
+
*/
|
|
134
|
+
displayMinHeight?: number | string;
|
|
135
|
+
/**
|
|
136
|
+
* css max-width
|
|
137
|
+
*/
|
|
138
|
+
displayMaxWidth?: number | string;
|
|
139
|
+
/**
|
|
140
|
+
* css max-height
|
|
141
|
+
*/
|
|
142
|
+
displayMaxHeight?: number | string;
|
|
126
143
|
/**
|
|
127
144
|
* For variable quality formats like jpg, the quality from 0 to 100
|
|
128
145
|
*/
|
|
@@ -138,12 +155,13 @@ interface PlasmicImgProps extends ImgTagProps {
|
|
|
138
155
|
*/
|
|
139
156
|
style?: React__default.CSSProperties;
|
|
140
157
|
/**
|
|
141
|
-
* Ref for the
|
|
142
|
-
* prop gives
|
|
158
|
+
* Ref for the img element. The normal <PlasmicImg ref={...} />
|
|
159
|
+
* prop gives the root element instead, which may be the img element
|
|
160
|
+
* or a wrapper element
|
|
143
161
|
*/
|
|
144
|
-
|
|
162
|
+
imgRef?: React__default.Ref<HTMLImageElement>;
|
|
145
163
|
}
|
|
146
|
-
declare const PlasmicImg: React__default.ForwardRefExoticComponent<PlasmicImgProps & React__default.RefAttributes<
|
|
164
|
+
declare const PlasmicImg: React__default.ForwardRefExoticComponent<PlasmicImgProps & React__default.RefAttributes<HTMLElement>>;
|
|
147
165
|
|
|
148
166
|
declare function PlasmicLink(props: any): JSX.Element;
|
|
149
167
|
|
|
@@ -557,6 +575,40 @@ declare type PlasmicClassVariants<C extends AnyPlasmicClass> = C extends Plasmic
|
|
|
557
575
|
declare type PlasmicClassArgs<C extends AnyPlasmicClass> = C extends PlasmicClass<any, infer A, any> ? A : unknown;
|
|
558
576
|
declare type PlasmicClassOverrides<C extends AnyPlasmicClass> = C extends PlasmicClass<any, any, infer O> ? O : unknown;
|
|
559
577
|
|
|
578
|
+
interface CommonProps {
|
|
579
|
+
showStartIcon?: boolean;
|
|
580
|
+
showEndIcon?: boolean;
|
|
581
|
+
startIcon?: React.ReactNode;
|
|
582
|
+
endIcon?: React.ReactNode;
|
|
583
|
+
children?: React.ReactNode;
|
|
584
|
+
isDisabled?: boolean;
|
|
585
|
+
}
|
|
586
|
+
interface HtmlButtonProps extends Omit<React.ComponentProps<"button">, "ref" | "disabled"> {
|
|
587
|
+
}
|
|
588
|
+
interface HtmlAnchorProps extends Omit<React.ComponentProps<"a">, "ref" | "href"> {
|
|
589
|
+
link?: string;
|
|
590
|
+
}
|
|
591
|
+
declare type BaseButtonProps = CommonProps & HtmlButtonProps & HtmlAnchorProps;
|
|
592
|
+
declare type HtmlAnchorOnlyProps = Exclude<keyof HtmlAnchorProps, keyof HtmlButtonProps>;
|
|
593
|
+
declare type HtmlButtonOnlyProps = Exclude<keyof HtmlButtonProps, keyof HtmlAnchorProps>;
|
|
594
|
+
declare type ButtonRef = React.Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
595
|
+
interface ButtonConfig<C extends AnyPlasmicClass> {
|
|
596
|
+
showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
|
|
597
|
+
showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
598
|
+
isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
599
|
+
startIconSlot?: keyof PlasmicClassArgs<C>;
|
|
600
|
+
endIconSlot?: keyof PlasmicClassArgs<C>;
|
|
601
|
+
contentSlot: keyof PlasmicClassArgs<C>;
|
|
602
|
+
root: keyof PlasmicClassOverrides<C>;
|
|
603
|
+
}
|
|
604
|
+
declare function useButton<P extends BaseButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: ButtonConfig<C>, ref?: ButtonRef): {
|
|
605
|
+
plasmicProps: {
|
|
606
|
+
variants: PlasmicClassVariants<C>;
|
|
607
|
+
args: PlasmicClassArgs<C>;
|
|
608
|
+
overrides: PlasmicClassOverrides<C>;
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
|
|
560
612
|
interface StyleProps {
|
|
561
613
|
className?: string;
|
|
562
614
|
style?: React.CSSProperties;
|
|
@@ -1052,6 +1104,40 @@ declare function useSwitch<P extends SwitchProps, C extends AnyPlasmicClass>(pla
|
|
|
1052
1104
|
state: SwitchState;
|
|
1053
1105
|
};
|
|
1054
1106
|
|
|
1107
|
+
interface BaseTextInputProps extends Omit<React.ComponentProps<"input">, "type" | "disabled"> {
|
|
1108
|
+
showStartIcon?: boolean;
|
|
1109
|
+
showEndIcon?: boolean;
|
|
1110
|
+
startIcon?: React.ReactNode;
|
|
1111
|
+
endIcon?: React.ReactNode;
|
|
1112
|
+
isDisabled?: boolean;
|
|
1113
|
+
type?: "text" | "password" | "email" | "url";
|
|
1114
|
+
inputClassName?: string;
|
|
1115
|
+
inputStyle?: React.CSSProperties;
|
|
1116
|
+
}
|
|
1117
|
+
interface TextInputRefValue {
|
|
1118
|
+
focus: () => void;
|
|
1119
|
+
blur: () => void;
|
|
1120
|
+
getRoot: () => HTMLElement | null;
|
|
1121
|
+
getInput: () => HTMLInputElement | null;
|
|
1122
|
+
}
|
|
1123
|
+
declare type TextInputRef = React.Ref<TextInputRefValue>;
|
|
1124
|
+
interface TextInputConfig<C extends AnyPlasmicClass> {
|
|
1125
|
+
showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
|
|
1126
|
+
showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
1127
|
+
isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
1128
|
+
startIconSlot?: keyof PlasmicClassArgs<C>;
|
|
1129
|
+
endIconSlot?: keyof PlasmicClassArgs<C>;
|
|
1130
|
+
root: keyof PlasmicClassOverrides<C>;
|
|
1131
|
+
input: keyof PlasmicClassOverrides<C>;
|
|
1132
|
+
}
|
|
1133
|
+
declare function useTextInput<P extends BaseTextInputProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: TextInputConfig<C>, ref?: TextInputRef): {
|
|
1134
|
+
plasmicProps: {
|
|
1135
|
+
variants: PlasmicClassVariants<C>;
|
|
1136
|
+
args: PlasmicClassArgs<C>;
|
|
1137
|
+
overrides: PlasmicClassOverrides<C>;
|
|
1138
|
+
};
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1055
1141
|
interface BaseTriggeredOverlayProps extends StyleProps, DOMProps {
|
|
1056
1142
|
children?: React.ReactNode;
|
|
1057
1143
|
}
|
|
@@ -1073,4 +1159,4 @@ declare function useTriggeredOverlay<P extends BaseTriggeredOverlayProps, C exte
|
|
|
1073
1159
|
};
|
|
1074
1160
|
};
|
|
1075
1161
|
|
|
1076
|
-
export { BaseMenuButtonProps, BaseMenuGroupProps, BaseMenuItemProps, BaseMenuProps, BaseSelectOptionGroupProps, BaseSelectOptionProps, BaseSelectProps, BaseTriggeredOverlayProps, CheckboxProps, CheckboxRef, CheckboxRefValue, DropdownMenu, Flex, HTMLElementRefOf, MenuButtonRef, MenuButtonRefValue, MenuRef, MenuRefValue, MultiChoiceArg, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, SelectOptionRef, SelectRef, SelectRefValue, SingleBooleanChoiceArg, SingleChoiceArg, Stack, StrictProps, SwitchProps, SwitchRef, SwitchRefValue, TriggeredOverlayConfig, TriggeredOverlayRef, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, getDataProps, hasVariant, makeFragment, omit, pick, renderPlasmicSlot, setPlumeStrictMode, useCheckbox, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTrigger, useTriggeredOverlay, wrapWithClassName };
|
|
1162
|
+
export { BaseButtonProps, BaseMenuButtonProps, BaseMenuGroupProps, BaseMenuItemProps, BaseMenuProps, BaseSelectOptionGroupProps, BaseSelectOptionProps, BaseSelectProps, BaseTextInputProps, BaseTriggeredOverlayProps, ButtonRef, CheckboxProps, CheckboxRef, CheckboxRefValue, DropdownMenu, Flex, HTMLElementRefOf, HtmlAnchorOnlyProps, HtmlButtonOnlyProps, MenuButtonRef, MenuButtonRefValue, MenuRef, MenuRefValue, MultiChoiceArg, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, SelectOptionRef, SelectRef, SelectRefValue, SingleBooleanChoiceArg, SingleChoiceArg, Stack, StrictProps, SwitchProps, SwitchRef, SwitchRefValue, TextInputRef, TextInputRefValue, TriggeredOverlayConfig, TriggeredOverlayRef, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, getDataProps, hasVariant, makeFragment, omit, pick, renderPlasmicSlot, setPlumeStrictMode, useButton, useCheckbox, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./index-common";
|
|
2
|
+
export * from "./plume/button";
|
|
2
3
|
export * from "./plume/checkbox";
|
|
3
4
|
export * from "./plume/menu";
|
|
4
5
|
export * from "./plume/menu-button";
|
|
@@ -6,4 +7,5 @@ export { setPlumeStrictMode } from "./plume/plume-utils";
|
|
|
6
7
|
export { getDataProps } from "./plume/props-utils";
|
|
7
8
|
export * from "./plume/select";
|
|
8
9
|
export * from "./plume/switch";
|
|
10
|
+
export * from "./plume/text-input";
|
|
9
11
|
export * from "./plume/triggered-overlay";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AnyPlasmicClass, PlasmicClassArgs, PlasmicClassOverrides, PlasmicClassVariants, VariantDef } from "../plume-utils";
|
|
3
|
+
interface CommonProps {
|
|
4
|
+
showStartIcon?: boolean;
|
|
5
|
+
showEndIcon?: boolean;
|
|
6
|
+
startIcon?: React.ReactNode;
|
|
7
|
+
endIcon?: React.ReactNode;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface HtmlButtonProps extends Omit<React.ComponentProps<"button">, "ref" | "disabled"> {
|
|
12
|
+
}
|
|
13
|
+
interface HtmlAnchorProps extends Omit<React.ComponentProps<"a">, "ref" | "href"> {
|
|
14
|
+
link?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare type BaseButtonProps = CommonProps & HtmlButtonProps & HtmlAnchorProps;
|
|
17
|
+
export declare type HtmlAnchorOnlyProps = Exclude<keyof HtmlAnchorProps, keyof HtmlButtonProps>;
|
|
18
|
+
export declare type HtmlButtonOnlyProps = Exclude<keyof HtmlButtonProps, keyof HtmlAnchorProps>;
|
|
19
|
+
export declare type ButtonRef = React.Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
20
|
+
interface ButtonConfig<C extends AnyPlasmicClass> {
|
|
21
|
+
showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
|
|
22
|
+
showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
23
|
+
isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
24
|
+
startIconSlot?: keyof PlasmicClassArgs<C>;
|
|
25
|
+
endIconSlot?: keyof PlasmicClassArgs<C>;
|
|
26
|
+
contentSlot: keyof PlasmicClassArgs<C>;
|
|
27
|
+
root: keyof PlasmicClassOverrides<C>;
|
|
28
|
+
}
|
|
29
|
+
export declare function useButton<P extends BaseButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: ButtonConfig<C>, ref?: ButtonRef): {
|
|
30
|
+
plasmicProps: {
|
|
31
|
+
variants: PlasmicClassVariants<C>;
|
|
32
|
+
args: PlasmicClassArgs<C>;
|
|
33
|
+
overrides: PlasmicClassOverrides<C>;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AnyPlasmicClass, PlasmicClassArgs, PlasmicClassOverrides, PlasmicClassVariants, VariantDef } from "../plume-utils";
|
|
3
|
+
export interface BaseTextInputProps extends Omit<React.ComponentProps<"input">, "type" | "disabled"> {
|
|
4
|
+
showStartIcon?: boolean;
|
|
5
|
+
showEndIcon?: boolean;
|
|
6
|
+
startIcon?: React.ReactNode;
|
|
7
|
+
endIcon?: React.ReactNode;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
type?: "text" | "password" | "email" | "url";
|
|
10
|
+
inputClassName?: string;
|
|
11
|
+
inputStyle?: React.CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
export interface TextInputRefValue {
|
|
14
|
+
focus: () => void;
|
|
15
|
+
blur: () => void;
|
|
16
|
+
getRoot: () => HTMLElement | null;
|
|
17
|
+
getInput: () => HTMLInputElement | null;
|
|
18
|
+
}
|
|
19
|
+
export declare type TextInputRef = React.Ref<TextInputRefValue>;
|
|
20
|
+
interface TextInputConfig<C extends AnyPlasmicClass> {
|
|
21
|
+
showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
|
|
22
|
+
showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
23
|
+
isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
24
|
+
startIconSlot?: keyof PlasmicClassArgs<C>;
|
|
25
|
+
endIconSlot?: keyof PlasmicClassArgs<C>;
|
|
26
|
+
root: keyof PlasmicClassOverrides<C>;
|
|
27
|
+
input: keyof PlasmicClassOverrides<C>;
|
|
28
|
+
}
|
|
29
|
+
export declare function useTextInput<P extends BaseTextInputProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: TextInputConfig<C>, ref?: TextInputRef): {
|
|
30
|
+
plasmicProps: {
|
|
31
|
+
variants: PlasmicClassVariants<C>;
|
|
32
|
+
args: PlasmicClassArgs<C>;
|
|
33
|
+
overrides: PlasmicClassOverrides<C>;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {};
|
package/dist/react-utils.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function isReactText(child: React.ReactNode): child is React.Reac
|
|
|
13
13
|
export declare function isReactChild(child: React.ReactNode): child is React.ReactChild;
|
|
14
14
|
export declare function isReactFragment(child: React.ReactNode): child is React.ReactElement;
|
|
15
15
|
export declare function isReactNode(x: any): boolean;
|
|
16
|
-
export declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : "Unexpected extraneous props"
|
|
16
|
+
export declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : Partial<"Unexpected extraneous props">;
|
|
17
17
|
export declare type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<React.ComponentProps<T>["ref"], string>;
|
|
18
18
|
export declare function mergeProps(props: Record<string, any>, ...restProps: Record<string, any>[]): Record<string, any>;
|
|
19
19
|
export declare function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]): (value: T) => void;
|
|
@@ -807,77 +807,161 @@ function PlasmicIcon(props) {
|
|
|
807
807
|
var IMG_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
808
808
|
var DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
809
809
|
var ALL_SIZES = /*#__PURE__*/[].concat(IMG_SIZES, DEVICE_SIZES);
|
|
810
|
-
var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(props,
|
|
810
|
+
var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(props, outerRef) {
|
|
811
811
|
var src = props.src,
|
|
812
812
|
className = props.className,
|
|
813
813
|
displayWidth = props.displayWidth,
|
|
814
814
|
displayHeight = props.displayHeight,
|
|
815
|
+
displayMinWidth = props.displayMinWidth,
|
|
816
|
+
displayMinHeight = props.displayMinHeight,
|
|
817
|
+
displayMaxWidth = props.displayMaxWidth,
|
|
818
|
+
displayMaxHeight = props.displayMaxHeight,
|
|
815
819
|
quality = props.quality,
|
|
816
820
|
loader = props.loader,
|
|
817
|
-
|
|
821
|
+
imgRef = props.imgRef,
|
|
818
822
|
style = props.style,
|
|
819
|
-
|
|
823
|
+
loading = props.loading,
|
|
824
|
+
rest = _objectWithoutPropertiesLoose(props, ["src", "className", "displayWidth", "displayHeight", "displayMinWidth", "displayMinHeight", "displayMaxWidth", "displayMaxHeight", "quality", "loader", "imgRef", "style", "loading"]);
|
|
825
|
+
|
|
826
|
+
var imgProps = Object.assign({}, rest, {
|
|
827
|
+
// Default loading to "lazy" if not specified (which is different from the
|
|
828
|
+
// html img, which defaults to eager!)
|
|
829
|
+
loading: loading != null ? loading : "lazy"
|
|
830
|
+
});
|
|
820
831
|
|
|
821
832
|
var _ref = typeof src === "string" || !src ? {
|
|
822
833
|
fullWidth: undefined,
|
|
823
|
-
fullHeight: undefined
|
|
834
|
+
fullHeight: undefined,
|
|
835
|
+
aspectRatio: undefined
|
|
824
836
|
} : src,
|
|
825
837
|
fullWidth = _ref.fullWidth,
|
|
826
|
-
fullHeight = _ref.fullHeight
|
|
838
|
+
fullHeight = _ref.fullHeight,
|
|
839
|
+
aspectRatio = _ref.aspectRatio;
|
|
827
840
|
|
|
828
841
|
var srcStr = src ? typeof src === "string" ? src : src.src : ""; // Assume external image if either dimension is null and use usual <img>
|
|
829
|
-
// (or if the image is an SVG)
|
|
830
842
|
|
|
831
|
-
if (fullHeight == null || fullWidth == null
|
|
843
|
+
if (fullHeight == null || fullWidth == null) {
|
|
832
844
|
return React__default.createElement("img", Object.assign({
|
|
833
845
|
src: srcStr,
|
|
834
846
|
className: className,
|
|
835
847
|
style: style
|
|
836
|
-
},
|
|
837
|
-
|
|
848
|
+
}, imgProps, {
|
|
849
|
+
loading: loading,
|
|
850
|
+
ref: mergeRefs(imgRef, outerRef)
|
|
838
851
|
}));
|
|
839
852
|
}
|
|
840
853
|
|
|
854
|
+
if (isSvg(srcStr) && (displayHeight == null || displayHeight === "auto") && (displayWidth == null || displayWidth === "auto")) {
|
|
855
|
+
displayWidth = "100%";
|
|
856
|
+
}
|
|
857
|
+
|
|
841
858
|
if (fullWidth && fullHeight && (!displayWidth || displayWidth === "auto") && !!getPixelLength(displayHeight)) {
|
|
842
859
|
// If there's a pixel length specified for displayHeight but not displayWidth,
|
|
843
860
|
// then we can derive the pixel length for displayWidth. Having an explicit
|
|
844
861
|
// displayWidth makes this a fixed-size image, which makes it possible for us to
|
|
845
862
|
// generate better markup!
|
|
846
|
-
|
|
863
|
+
if (!isSvg(srcStr)) {
|
|
864
|
+
// We shouldn't do it for SVGs though, because `fullWidth` and
|
|
865
|
+
// `fullHeight` might have rounded values so the final
|
|
866
|
+
// `displayWidth` could differ by 1px or so.
|
|
867
|
+
displayWidth = getPixelLength(displayHeight) * fullWidth / fullHeight;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
var spacerWidth = fullWidth;
|
|
872
|
+
var spacerHeight = fullHeight;
|
|
873
|
+
|
|
874
|
+
if (aspectRatio && isFinite(aspectRatio) && isSvg(srcStr)) {
|
|
875
|
+
// For SVGs, fullWidth and fullHeight can be rounded values, which would
|
|
876
|
+
// cause some discrepancy between the actual aspect ratio and the aspect
|
|
877
|
+
// ratio from those values. So, for those cases, we set large width / height
|
|
878
|
+
// values to get a more precise ratio from the spacer.
|
|
879
|
+
spacerWidth = DEFAULT_SVG_WIDTH;
|
|
880
|
+
spacerHeight = Math.round(spacerWidth / aspectRatio);
|
|
847
881
|
}
|
|
848
882
|
|
|
849
|
-
var _getWidths = getWidths(displayWidth, fullWidth
|
|
883
|
+
var _getWidths = getWidths(displayWidth, fullWidth, {
|
|
884
|
+
minWidth: displayMinWidth
|
|
885
|
+
}),
|
|
850
886
|
sizes = _getWidths.sizes,
|
|
851
887
|
widthDescs = _getWidths.widthDescs;
|
|
852
888
|
|
|
853
889
|
var imageLoader = getImageLoader(loader);
|
|
854
|
-
var spacerSvg = "<svg width=\"" +
|
|
890
|
+
var spacerSvg = "<svg width=\"" + spacerWidth + "\" height=\"" + spacerHeight + "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"/>";
|
|
855
891
|
var spacerSvgBase64 = typeof window === "undefined" ? Buffer.from(spacerSvg).toString("base64") : window.btoa(spacerSvg);
|
|
892
|
+
|
|
893
|
+
var wrapperStyle = _extends({}, style || {});
|
|
894
|
+
|
|
895
|
+
var spacerStyle = pick(style || {}, "objectFit", "objectPosition");
|
|
896
|
+
|
|
897
|
+
if (displayWidth != null && displayWidth !== "auto") {
|
|
898
|
+
// If width is set, set it on the wrapper along with min/max width
|
|
899
|
+
// and just use `width: 100%` on the spacer
|
|
900
|
+
spacerStyle.width = "100%";
|
|
901
|
+
wrapperStyle.width = displayWidth;
|
|
902
|
+
wrapperStyle.minWidth = displayMinWidth;
|
|
903
|
+
wrapperStyle.maxWidth = displayMaxWidth;
|
|
904
|
+
} else {
|
|
905
|
+
// Otherwise, we want auto sizing from the spacer, so set width there.
|
|
906
|
+
//
|
|
907
|
+
// But if we have min/max width, it should be set in the wrapper and it
|
|
908
|
+
// can be percentage values (and we add corresponding min/max width to
|
|
909
|
+
// 100% in the spacer). In general it ends up with the correct effect,
|
|
910
|
+
// but some edge cases might make `min-width: 100%` shrink the image more
|
|
911
|
+
// than it should.
|
|
912
|
+
spacerStyle.width = displayWidth;
|
|
913
|
+
wrapperStyle.width = "auto";
|
|
914
|
+
|
|
915
|
+
if (displayMinWidth) {
|
|
916
|
+
spacerStyle.minWidth = "100%";
|
|
917
|
+
wrapperStyle.minWidth = displayMinWidth;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
if (displayMaxWidth != null && displayMaxWidth !== "none") {
|
|
921
|
+
spacerStyle.maxWidth = "100%";
|
|
922
|
+
wrapperStyle.maxWidth = displayMaxWidth;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
if (displayHeight != null && displayHeight !== "auto") {
|
|
927
|
+
spacerStyle.height = "100%";
|
|
928
|
+
wrapperStyle.height = displayHeight;
|
|
929
|
+
wrapperStyle.minHeight = displayMinHeight;
|
|
930
|
+
wrapperStyle.maxHeight = displayMaxHeight;
|
|
931
|
+
} else {
|
|
932
|
+
spacerStyle.height = displayHeight;
|
|
933
|
+
wrapperStyle.height = "auto";
|
|
934
|
+
|
|
935
|
+
if (displayMinHeight) {
|
|
936
|
+
spacerStyle.minHeight = "100%";
|
|
937
|
+
wrapperStyle.minHeight = displayMinHeight;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
if (displayMaxHeight != null && displayMaxHeight !== "none") {
|
|
941
|
+
spacerStyle.maxHeight = "100%";
|
|
942
|
+
wrapperStyle.maxHeight = displayMaxHeight;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
856
946
|
return React__default.createElement("div", {
|
|
857
947
|
className: classNames$1(className, "__wab_img-wrapper"),
|
|
858
|
-
ref:
|
|
859
|
-
style:
|
|
860
|
-
width: isPercentage(displayWidth) ? displayWidth : undefined,
|
|
861
|
-
height: isPercentage(displayHeight) ? displayHeight : undefined
|
|
862
|
-
})
|
|
948
|
+
ref: outerRef,
|
|
949
|
+
style: wrapperStyle
|
|
863
950
|
}, React__default.createElement("img", {
|
|
864
951
|
alt: "",
|
|
865
952
|
"aria-hidden": true,
|
|
866
953
|
className: "__wab_img-spacer-svg",
|
|
867
954
|
src: "data:image/svg+xml;base64," + spacerSvgBase64,
|
|
868
|
-
style:
|
|
869
|
-
width: isPercentage(displayWidth) ? "100%" : displayWidth,
|
|
870
|
-
height: isPercentage(displayHeight) ? "100%" : displayHeight
|
|
871
|
-
}, style ? pick(style, "objectFit", "objectPosition") : {})
|
|
955
|
+
style: spacerStyle
|
|
872
956
|
}), makePicture({
|
|
873
957
|
imageLoader: imageLoader,
|
|
874
958
|
widthDescs: widthDescs,
|
|
875
959
|
sizes: sizes,
|
|
876
960
|
src: srcStr,
|
|
877
961
|
quality: quality,
|
|
878
|
-
ref:
|
|
962
|
+
ref: imgRef,
|
|
879
963
|
style: style ? pick(style, "objectFit", "objectPosition") : undefined,
|
|
880
|
-
imgProps:
|
|
964
|
+
imgProps: imgProps,
|
|
881
965
|
className: "__wab_img"
|
|
882
966
|
}));
|
|
883
967
|
});
|
|
@@ -923,7 +1007,7 @@ function makePicture(opts) {
|
|
|
923
1007
|
width: wd.width
|
|
924
1008
|
}) + " " + wd.desc;
|
|
925
1009
|
}).join(", ") : undefined,
|
|
926
|
-
sizes: imageLoader ? sizes : undefined,
|
|
1010
|
+
sizes: imageLoader && imageLoader.supportsUrl(src) ? sizes : undefined,
|
|
927
1011
|
style: _extends({}, style ? pick(style, "objectFit", "objectPosition") : {}, {
|
|
928
1012
|
width: 0,
|
|
929
1013
|
height: 0
|
|
@@ -931,6 +1015,12 @@ function makePicture(opts) {
|
|
|
931
1015
|
})));
|
|
932
1016
|
}
|
|
933
1017
|
|
|
1018
|
+
var DEFAULT_SVG_WIDTH = 10000;
|
|
1019
|
+
|
|
1020
|
+
function isSvg(src) {
|
|
1021
|
+
return src.endsWith(".svg") || src.startsWith("data:image/svg");
|
|
1022
|
+
}
|
|
1023
|
+
|
|
934
1024
|
function getClosestPresetSize(width, fullWidth) {
|
|
935
1025
|
var _ALL_SIZES$findIndex;
|
|
936
1026
|
|
|
@@ -959,17 +1049,19 @@ function getClosestPresetSize(width, fullWidth) {
|
|
|
959
1049
|
*/
|
|
960
1050
|
|
|
961
1051
|
|
|
962
|
-
function getWidths(width, fullWidth) {
|
|
1052
|
+
function getWidths(width, fullWidth, extra) {
|
|
1053
|
+
var minWidth = extra == null ? void 0 : extra.minWidth;
|
|
963
1054
|
var pixelWidth = getPixelLength(width);
|
|
1055
|
+
var pixelMinWidth = getPixelLength(minWidth);
|
|
964
1056
|
|
|
965
|
-
if (pixelWidth != null) {
|
|
1057
|
+
if (pixelWidth != null && (!minWidth || pixelMinWidth != null)) {
|
|
966
1058
|
// If there's an exact width, then we just need to display it at 1x and 2x density
|
|
967
1059
|
return {
|
|
968
1060
|
widthDescs: [{
|
|
969
|
-
width: getClosestPresetSize(pixelWidth, fullWidth),
|
|
1061
|
+
width: getClosestPresetSize(Math.max(pixelWidth, pixelMinWidth != null ? pixelMinWidth : 0), fullWidth),
|
|
970
1062
|
desc: "1x"
|
|
971
1063
|
}, {
|
|
972
|
-
width: getClosestPresetSize(pixelWidth * 2, fullWidth),
|
|
1064
|
+
width: getClosestPresetSize(Math.max(pixelWidth, pixelMinWidth != null ? pixelMinWidth : 0) * 2, fullWidth),
|
|
973
1065
|
desc: "2x"
|
|
974
1066
|
}],
|
|
975
1067
|
sizes: undefined
|
|
@@ -1015,16 +1107,6 @@ function getWidths(width, fullWidth) {
|
|
|
1015
1107
|
};
|
|
1016
1108
|
}
|
|
1017
1109
|
|
|
1018
|
-
function isPercentage(width) {
|
|
1019
|
-
var _parseNumeric;
|
|
1020
|
-
|
|
1021
|
-
if (typeof width !== "string") {
|
|
1022
|
-
return false;
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
return ((_parseNumeric = parseNumeric(width)) == null ? void 0 : _parseNumeric.units) === "%";
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
1110
|
function getPixelLength(length) {
|
|
1029
1111
|
if (length == null || length == "") {
|
|
1030
1112
|
return undefined;
|
|
@@ -1071,7 +1153,7 @@ function getImageLoader(loader) {
|
|
|
1071
1153
|
|
|
1072
1154
|
var PLASMIC_IMAGE_LOADER = {
|
|
1073
1155
|
supportsUrl: function supportsUrl(src) {
|
|
1074
|
-
return src.startsWith("https://img.plasmic.app");
|
|
1156
|
+
return src.startsWith("https://img.plasmic.app") && !isSvg(src);
|
|
1075
1157
|
},
|
|
1076
1158
|
transformUrl: function transformUrl(opts) {
|
|
1077
1159
|
var _opts$quality;
|
|
@@ -1423,6 +1505,53 @@ function getPlumeType(child) {
|
|
|
1423
1505
|
return childType.__plumeType || (childType.getPlumeType == null ? void 0 : childType.getPlumeType(child.props));
|
|
1424
1506
|
}
|
|
1425
1507
|
|
|
1508
|
+
function useButton(plasmicClass, props, config, ref) {
|
|
1509
|
+
var _ref, _ref2, _extends2, _overrides;
|
|
1510
|
+
|
|
1511
|
+
if (ref === void 0) {
|
|
1512
|
+
ref = null;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
var link = props.link,
|
|
1516
|
+
isDisabled = props.isDisabled,
|
|
1517
|
+
startIcon = props.startIcon,
|
|
1518
|
+
endIcon = props.endIcon,
|
|
1519
|
+
showStartIcon = props.showStartIcon,
|
|
1520
|
+
showEndIcon = props.showEndIcon,
|
|
1521
|
+
children = props.children,
|
|
1522
|
+
rest = _objectWithoutPropertiesLoose(props, ["link", "isDisabled", "startIcon", "endIcon", "showStartIcon", "showEndIcon", "children"]);
|
|
1523
|
+
|
|
1524
|
+
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
1525
|
+
def: config.showStartIconVariant,
|
|
1526
|
+
active: showStartIcon
|
|
1527
|
+
}, {
|
|
1528
|
+
def: config.showEndIconVariant,
|
|
1529
|
+
active: showEndIcon
|
|
1530
|
+
}, {
|
|
1531
|
+
def: config.isDisabledVariant,
|
|
1532
|
+
active: isDisabled
|
|
1533
|
+
}));
|
|
1534
|
+
|
|
1535
|
+
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), config.startIconSlot && (_ref = {}, _ref[config.startIconSlot] = startIcon, _ref), config.endIconSlot && (_ref2 = {}, _ref2[config.endIconSlot] = endIcon, _ref2), (_extends2 = {}, _extends2[config.contentSlot] = children, _extends2));
|
|
1536
|
+
|
|
1537
|
+
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
1538
|
+
as: !!link ? "a" : "button",
|
|
1539
|
+
props: _extends({
|
|
1540
|
+
ref: ref,
|
|
1541
|
+
disabled: isDisabled
|
|
1542
|
+
}, !!link && {
|
|
1543
|
+
href: link
|
|
1544
|
+
}, rest)
|
|
1545
|
+
}, _overrides);
|
|
1546
|
+
return {
|
|
1547
|
+
plasmicProps: {
|
|
1548
|
+
variants: variants,
|
|
1549
|
+
args: args,
|
|
1550
|
+
overrides: overrides
|
|
1551
|
+
}
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1426
1555
|
function getStyleProps(props) {
|
|
1427
1556
|
return pick(props, "className", "style");
|
|
1428
1557
|
}
|
|
@@ -2680,6 +2809,83 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
2680
2809
|
};
|
|
2681
2810
|
}
|
|
2682
2811
|
|
|
2812
|
+
function useTextInput(plasmicClass, props, config, ref) {
|
|
2813
|
+
var _ref, _ref2, _overrides;
|
|
2814
|
+
|
|
2815
|
+
if (ref === void 0) {
|
|
2816
|
+
ref = null;
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
var isDisabled = props.isDisabled,
|
|
2820
|
+
startIcon = props.startIcon,
|
|
2821
|
+
endIcon = props.endIcon,
|
|
2822
|
+
showStartIcon = props.showStartIcon,
|
|
2823
|
+
showEndIcon = props.showEndIcon,
|
|
2824
|
+
className = props.className,
|
|
2825
|
+
style = props.style,
|
|
2826
|
+
inputClassName = props.inputClassName,
|
|
2827
|
+
inputStyle = props.inputStyle,
|
|
2828
|
+
rest = _objectWithoutPropertiesLoose(props, ["isDisabled", "startIcon", "endIcon", "showStartIcon", "showEndIcon", "className", "style", "inputClassName", "inputStyle"]);
|
|
2829
|
+
|
|
2830
|
+
var rootRef = React.useRef(null);
|
|
2831
|
+
var inputRef = React.useRef(null);
|
|
2832
|
+
React.useImperativeHandle(ref, function () {
|
|
2833
|
+
return {
|
|
2834
|
+
focus: function focus() {
|
|
2835
|
+
var _inputRef$current;
|
|
2836
|
+
|
|
2837
|
+
(_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
2838
|
+
},
|
|
2839
|
+
blur: function blur() {
|
|
2840
|
+
var _inputRef$current2;
|
|
2841
|
+
|
|
2842
|
+
(_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.blur();
|
|
2843
|
+
},
|
|
2844
|
+
getRoot: function getRoot() {
|
|
2845
|
+
return rootRef.current;
|
|
2846
|
+
},
|
|
2847
|
+
getInput: function getInput() {
|
|
2848
|
+
return inputRef.current;
|
|
2849
|
+
}
|
|
2850
|
+
};
|
|
2851
|
+
}, [rootRef, inputRef]);
|
|
2852
|
+
|
|
2853
|
+
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
2854
|
+
def: config.showStartIconVariant,
|
|
2855
|
+
active: showStartIcon
|
|
2856
|
+
}, {
|
|
2857
|
+
def: config.showEndIconVariant,
|
|
2858
|
+
active: showEndIcon
|
|
2859
|
+
}, {
|
|
2860
|
+
def: config.isDisabledVariant,
|
|
2861
|
+
active: isDisabled
|
|
2862
|
+
}));
|
|
2863
|
+
|
|
2864
|
+
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), config.startIconSlot && (_ref = {}, _ref[config.startIconSlot] = startIcon, _ref), config.endIconSlot && (_ref2 = {}, _ref2[config.endIconSlot] = endIcon, _ref2));
|
|
2865
|
+
|
|
2866
|
+
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2867
|
+
props: {
|
|
2868
|
+
ref: rootRef,
|
|
2869
|
+
className: className,
|
|
2870
|
+
style: style
|
|
2871
|
+
}
|
|
2872
|
+
}, _overrides[config.input] = {
|
|
2873
|
+
props: _extends({
|
|
2874
|
+
disabled: isDisabled,
|
|
2875
|
+
ref: inputRef,
|
|
2876
|
+
className: inputClassName,
|
|
2877
|
+
style: inputStyle
|
|
2878
|
+
}, rest)
|
|
2879
|
+
}, _overrides);
|
|
2880
|
+
return {
|
|
2881
|
+
plasmicProps: {
|
|
2882
|
+
variants: variants,
|
|
2883
|
+
args: args,
|
|
2884
|
+
overrides: overrides
|
|
2885
|
+
}
|
|
2886
|
+
};
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2683
2889
|
function useTriggeredOverlay(plasmicClass, props, config, outerRef) {
|
|
2684
2890
|
var _extends2, _overrides;
|
|
2685
2891
|
|
|
@@ -2779,9 +2985,7 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef) {
|
|
|
2779
2985
|
restoreFocus: true
|
|
2780
2986
|
}, React.createElement(reactAria.DismissButton, {
|
|
2781
2987
|
onDismiss: state.close
|
|
2782
|
-
}), children,
|
|
2783
|
-
onDismiss: state.close
|
|
2784
|
-
})), _extends2));
|
|
2988
|
+
}), children), _extends2));
|
|
2785
2989
|
|
|
2786
2990
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2787
2991
|
props: mergeProps(overlayProps, getStyleProps(props), {
|
|
@@ -2825,6 +3029,7 @@ exports.omit = omit;
|
|
|
2825
3029
|
exports.pick = pick;
|
|
2826
3030
|
exports.renderPlasmicSlot = renderPlasmicSlot;
|
|
2827
3031
|
exports.setPlumeStrictMode = setPlumeStrictMode;
|
|
3032
|
+
exports.useButton = useButton;
|
|
2828
3033
|
exports.useCheckbox = useCheckbox;
|
|
2829
3034
|
exports.useIsSSR = useIsSSR;
|
|
2830
3035
|
exports.useMenu = useMenu;
|
|
@@ -2835,6 +3040,7 @@ exports.useSelect = useSelect;
|
|
|
2835
3040
|
exports.useSelectOption = useSelectOption;
|
|
2836
3041
|
exports.useSelectOptionGroup = useSelectOptionGroup;
|
|
2837
3042
|
exports.useSwitch = useSwitch;
|
|
3043
|
+
exports.useTextInput = useTextInput;
|
|
2838
3044
|
exports.useTrigger = useTrigger;
|
|
2839
3045
|
exports.useTriggeredOverlay = useTriggeredOverlay;
|
|
2840
3046
|
exports.wrapWithClassName = wrapWithClassName;
|