@plasmicapp/react-web 0.2.196 → 0.2.198

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.
Files changed (70) hide show
  1. package/dist/index.cjs.js +3715 -0
  2. package/dist/index.cjs.js.map +1 -0
  3. package/dist/plume/button/index.d.ts +4 -4
  4. package/dist/plume/checkbox/index.d.ts +1 -1
  5. package/dist/plume/collection-utils.d.ts +7 -7
  6. package/dist/plume/collection-utils.spec.d.ts +1 -0
  7. package/dist/plume/menu/menu.d.ts +1 -1
  8. package/dist/plume/menu-button/menu-button.d.ts +1 -1
  9. package/dist/plume/menu-button/menu-trigger.d.ts +1 -1
  10. package/dist/plume/plume-utils.d.ts +13 -13
  11. package/dist/plume/select/select-option.d.ts +1 -1
  12. package/dist/plume/select/select.d.ts +1 -1
  13. package/dist/plume/switch/index.d.ts +1 -1
  14. package/dist/plume/text-input/index.d.ts +1 -1
  15. package/dist/plume/triggered-overlay/triggered-overlay.d.ts +1 -1
  16. package/dist/react-utils.d.ts +3 -3
  17. package/dist/react-utils.spec.d.ts +1 -0
  18. package/dist/react-web.esm.js +3485 -4538
  19. package/dist/react-web.esm.js.map +1 -1
  20. package/dist/render/PlasmicHead/index.d.ts +2 -2
  21. package/dist/render/PlasmicImg/index.d.ts +1 -1
  22. package/dist/render/Stack.d.ts +1 -1
  23. package/dist/render/elements.d.ts +12 -12
  24. package/dist/render/screen-variants.d.ts +1 -1
  25. package/dist/render/translation.d.ts +2 -2
  26. package/dist/render/triggers.d.ts +1 -1
  27. package/dist/states/helpers.d.ts +1 -1
  28. package/dist/states/types.d.ts +6 -6
  29. package/dist/stories/PlasmicImg.stories.d.ts +3 -2
  30. package/dist/stories/UseDollarState.stories.d.ts +23 -22
  31. package/package.json +17 -44
  32. package/skinny/dist/{collection-utils-0967eaf0.js → collection-utils-33d43bc0.js} +5 -4
  33. package/skinny/dist/{collection-utils-0967eaf0.js.map → collection-utils-33d43bc0.js.map} +1 -1
  34. package/skinny/dist/common-dc5a84e8.js +135 -0
  35. package/skinny/dist/common-dc5a84e8.js.map +1 -0
  36. package/skinny/dist/index.js +4 -3
  37. package/skinny/dist/index.js.map +1 -1
  38. package/skinny/dist/plume/button/index.js +3 -2
  39. package/skinny/dist/plume/button/index.js.map +1 -1
  40. package/skinny/dist/plume/checkbox/index.js +5 -4
  41. package/skinny/dist/plume/checkbox/index.js.map +1 -1
  42. package/skinny/dist/plume/menu/index.js +6 -5
  43. package/skinny/dist/plume/menu/index.js.map +1 -1
  44. package/skinny/dist/plume/menu-button/index.js +5 -4
  45. package/skinny/dist/plume/menu-button/index.js.map +1 -1
  46. package/skinny/dist/plume/select/index.js +6 -5
  47. package/skinny/dist/plume/select/index.js.map +1 -1
  48. package/skinny/dist/plume/switch/index.js +5 -4
  49. package/skinny/dist/plume/switch/index.js.map +1 -1
  50. package/skinny/dist/plume/text-input/index.js +3 -2
  51. package/skinny/dist/plume/text-input/index.js.map +1 -1
  52. package/skinny/dist/plume/triggered-overlay/index.js +5 -4
  53. package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
  54. package/skinny/dist/{plume-utils-7d68bcc0.js → plume-utils-83879d02.js} +2 -2
  55. package/skinny/dist/{plume-utils-7d68bcc0.js.map → plume-utils-83879d02.js.map} +1 -1
  56. package/skinny/dist/props-utils-1c39261f.js +9 -0
  57. package/skinny/dist/{props-utils-9f9c761a.js.map → props-utils-1c39261f.js.map} +1 -1
  58. package/skinny/dist/{react-utils-ee4e03ba.js → react-utils-898d19d0.js} +2 -2
  59. package/skinny/dist/{react-utils-ee4e03ba.js.map → react-utils-898d19d0.js.map} +1 -1
  60. package/skinny/dist/render/PlasmicImg/index.js +3 -2
  61. package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
  62. package/dist/all.d.ts +0 -13357
  63. package/dist/index.js +0 -8
  64. package/dist/react-web.cjs.development.js +0 -4737
  65. package/dist/react-web.cjs.development.js.map +0 -1
  66. package/dist/react-web.cjs.production.min.js +0 -2
  67. package/dist/react-web.cjs.production.min.js.map +0 -1
  68. package/skinny/dist/common-9d6d348d.js +0 -264
  69. package/skinny/dist/common-9d6d348d.js.map +0 -1
  70. package/skinny/dist/props-utils-9f9c761a.js +0 -8
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
- export declare const PlasmicHeadContext: React.Context<React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined>;
3
- declare type PlasmicHeadProps = {
2
+ export declare const PlasmicHeadContext: React.Context<React.ComponentType<any> | undefined>;
3
+ type PlasmicHeadProps = {
4
4
  title?: string;
5
5
  description?: string;
6
6
  image?: string;
@@ -11,7 +11,7 @@ export interface ImageLoader {
11
11
  format?: "webp";
12
12
  }) => string;
13
13
  }
14
- declare type ImgTagProps = Omit<React.ComponentProps<"img">, "src" | "srcSet" | "ref" | "style">;
14
+ type ImgTagProps = Omit<React.ComponentProps<"img">, "src" | "srcSet" | "ref" | "style">;
15
15
  export interface PlasmicImgProps extends ImgTagProps {
16
16
  /**
17
17
  * Either an object with the src string, and its full width and height,
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- export declare const Stack: (<T extends "symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "menu" | "menuitem" | "meta" | "meter" | "nav" | "noindex" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "slot" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "template" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" = "div">(props: {
2
+ export declare const Stack: (<T extends keyof JSX.IntrinsicElements = "div">(props: {
3
3
  as?: T | undefined;
4
4
  hasGap?: boolean | undefined;
5
5
  } & React.ComponentProps<T>) => React.ReactElement) & {
@@ -3,33 +3,33 @@ import { $State } from "../states";
3
3
  interface Variants {
4
4
  [vg: string]: any;
5
5
  }
6
- export declare type MultiChoiceArg<M extends string> = M | M[] | {
6
+ export type MultiChoiceArg<M extends string> = M | M[] | {
7
7
  [v in M]?: boolean;
8
8
  };
9
- export declare type SingleChoiceArg<M extends string> = M;
10
- export declare type SingleBooleanChoiceArg<M extends string> = M | boolean;
9
+ export type SingleChoiceArg<M extends string> = M;
10
+ export type SingleBooleanChoiceArg<M extends string> = M | boolean;
11
11
  interface OverrideTwiddle {
12
12
  wrapChildren?: (children: React.ReactNode) => React.ReactNode;
13
13
  wrap?: (node: React.ReactNode) => React.ReactNode;
14
14
  }
15
- export declare type DefaultOverride<C extends React.ElementType> = {
15
+ export type DefaultOverride<C extends React.ElementType> = {
16
16
  type: "default";
17
17
  props?: Partial<React.ComponentProps<C>>;
18
18
  } & OverrideTwiddle;
19
- export declare type AsOverride<C extends React.ElementType> = {
19
+ export type AsOverride<C extends React.ElementType> = {
20
20
  type: "as";
21
21
  as: C;
22
22
  props?: Partial<React.ComponentProps<C>>;
23
23
  } & OverrideTwiddle;
24
- export declare type RenderOverride<C extends React.ElementType> = {
24
+ export type RenderOverride<C extends React.ElementType> = {
25
25
  type: "render";
26
26
  render: (props: React.ComponentProps<C>, Comp: C) => React.ReactNode;
27
27
  props?: Partial<React.ComponentProps<C>>;
28
28
  } & OverrideTwiddle;
29
- export declare type Override<DefaultElementType extends React.ElementType> = DefaultOverride<DefaultElementType> | AsOverride<any> | RenderOverride<DefaultElementType>;
30
- export declare type Overrides = Record<string, Flex<any>>;
31
- export declare type Args = Record<string, any>;
32
- export declare type Flex<DefaultElementType extends React.ElementType> = (Omit<DefaultOverride<DefaultElementType>, "type"> & {
29
+ export type Override<DefaultElementType extends React.ElementType> = DefaultOverride<DefaultElementType> | AsOverride<any> | RenderOverride<DefaultElementType>;
30
+ export type Overrides = Record<string, Flex<any>>;
31
+ export type Args = Record<string, any>;
32
+ export type Flex<DefaultElementType extends React.ElementType> = (Omit<DefaultOverride<DefaultElementType>, "type"> & {
33
33
  as?: never;
34
34
  render?: never;
35
35
  }) | Omit<AsOverride<any>, "type"> | (Omit<RenderOverride<DefaultElementType>, "type"> & {
@@ -45,13 +45,13 @@ export declare function hasVariant<V extends Variants>(variants: V | undefined,
45
45
  export declare function wrapFlexContainerChildren(children: React.ReactNode, hasGap: boolean): React.DetailedReactHTMLElement<{
46
46
  className: string;
47
47
  }, HTMLElement> | null;
48
- export declare function createPlasmicElementProxy<DefaultElementType extends React.ElementType>(defaultElement: DefaultElementType, props: Partial<React.ComponentProps<DefaultElementType>>, ...children: React.ReactNode[]): number | boolean | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactFragment | null | undefined;
48
+ export declare function createPlasmicElementProxy<DefaultElementType extends React.ElementType>(defaultElement: DefaultElementType, props: Partial<React.ComponentProps<DefaultElementType>>, ...children: React.ReactNode[]): React.ReactNode;
49
49
  export declare function makeFragment(...children: React.ReactNode[]): React.FunctionComponentElement<{
50
50
  children?: React.ReactNode;
51
51
  }>;
52
52
  export declare const UNSET: unique symbol;
53
53
  export declare function wrapWithClassName(element: React.ReactNode, className: string): React.DetailedReactHTMLElement<{
54
- key: string | number | undefined;
54
+ key: React.Key | undefined;
55
55
  className: string;
56
56
  style: {
57
57
  display: "grid";
@@ -1,4 +1,4 @@
1
- declare type Queries = {
1
+ type Queries = {
2
2
  [name: string]: string;
3
3
  };
4
4
  export declare function createUseScreenVariants(isMulti: boolean, screenQueries: Queries): () => string | string[] | undefined;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- export declare type PlasmicTranslator = (str: string, opts?: {
2
+ export type PlasmicTranslator = (str: string, opts?: {
3
3
  components?: {
4
4
  [key: string]: React.ReactElement;
5
5
  };
@@ -12,7 +12,7 @@ export interface TransProps {
12
12
  export declare function genTranslatableString(elt: React.ReactNode): {
13
13
  str: string;
14
14
  components: {
15
- [key: string]: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
15
+ [key: string]: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
16
16
  };
17
17
  componentsCount: number;
18
18
  };
@@ -27,7 +27,7 @@ declare const TRIGGER_TO_HOOK: {
27
27
  readonly useFocusVisibleWithin: typeof useFocusVisibleWithin;
28
28
  readonly usePressed: typeof usePressed;
29
29
  };
30
- declare type TriggerType = keyof typeof TRIGGER_TO_HOOK;
30
+ type TriggerType = keyof typeof TRIGGER_TO_HOOK;
31
31
  interface TriggerOpts {
32
32
  isTextInput?: boolean;
33
33
  }
@@ -33,7 +33,7 @@ export declare function shallowEqual<T>(a1: T[], a2: T[]): boolean;
33
33
  */
34
34
  export declare function arrayEq(xs: ReadonlyArray<any>, ys: ReadonlyArray<any>): boolean;
35
35
  export declare function isNum(value: string | number | symbol): value is number;
36
- declare type StringGen = string | (() => string);
36
+ type StringGen = string | (() => string);
37
37
  export declare function assert<T>(cond: T, msg?: StringGen): asserts cond;
38
38
  /**
39
39
  * Forked from https://github.com/lukeed/dset
@@ -1,17 +1,17 @@
1
1
  import { StateSpecNode } from "./graph";
2
- export declare type InitFuncEnv = {
2
+ export type InitFuncEnv = {
3
3
  $props: Record<string, any>;
4
4
  $state: Record<string, any>;
5
5
  $queries?: Record<string, any>;
6
6
  $ctx?: Record<string, any>;
7
7
  };
8
- export declare type DollarStateEnv = Omit<InitFuncEnv, "$state">;
9
- export declare type NoUndefinedField<T> = {
8
+ export type DollarStateEnv = Omit<InitFuncEnv, "$state">;
9
+ export type NoUndefinedField<T> = {
10
10
  [P in keyof T]-?: T[P];
11
11
  };
12
- export declare type InitFunc<T> = (env: NoUndefinedField<InitFuncEnv>) => T;
13
- export declare type DeprecatedInitFunc<T> = ($props: Record<string, any>, $state: $State, $ctx: Record<string, any>) => T;
14
- export declare type ObjectPath = (string | number)[];
12
+ export type InitFunc<T> = (env: NoUndefinedField<InitFuncEnv>) => T;
13
+ export type DeprecatedInitFunc<T> = ($props: Record<string, any>, $state: $State, $ctx: Record<string, any>) => T;
14
+ export type ObjectPath = (string | number)[];
15
15
  export interface $StateSpec<T> {
16
16
  path: string;
17
17
  initFunc?: InitFunc<T>;
@@ -1,5 +1,6 @@
1
+ import { ComponentMeta, ComponentStory } from "@storybook/react";
1
2
  import React from "react";
2
3
  import "../styles/plasmic.css";
3
- export declare const Base: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<HTMLElement>>;
4
- declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react").ReactFramework, import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<HTMLElement>>;
4
+ export declare const Base: ComponentStory<React.ForwardRefExoticComponent<import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<HTMLElement>>>;
5
+ declare const _default: ComponentMeta<React.ForwardRefExoticComponent<import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<HTMLElement>>>;
5
6
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { Story } from "@storybook/react";
1
2
  import React from "react";
2
3
  declare const _default: {
3
4
  title: string;
@@ -12,66 +13,66 @@ interface CounterArgs {
12
13
  "data-testid"?: string;
13
14
  title?: React.ReactNode;
14
15
  }
15
- export declare const PrivateCounter: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, CounterArgs>;
16
- export declare const ReadonlyCounter: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
16
+ export declare const PrivateCounter: Story<CounterArgs>;
17
+ export declare const ReadonlyCounter: Story<{
17
18
  counterStateType?: "readonly" | "writable" | undefined;
18
19
  }>;
19
- export declare const WritableCounter: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
20
+ export declare const WritableCounter: Story<{
20
21
  counterStateType?: "readonly" | "writable" | undefined;
21
22
  }>;
22
- export declare const DynamicInitCount: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>;
23
- export declare const ResetInput: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
23
+ export declare const DynamicInitCount: Story<import("@storybook/react").Args>;
24
+ export declare const ResetInput: Story<{
24
25
  peopleList: {
25
26
  firstName: string;
26
27
  lastName: string;
27
28
  }[];
28
29
  }>;
29
- export declare const RepeatedStates: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
30
+ export declare const RepeatedStates: Story<{
30
31
  size: number;
31
32
  }>;
32
- export declare const NestedRepeatedCounter: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>;
33
- export declare const MatrixRepeatedCounter: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>;
34
- export declare const InitFuncFromInternalContextData: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
33
+ export declare const NestedRepeatedCounter: Story<{}>;
34
+ export declare const MatrixRepeatedCounter: Story<{}>;
35
+ export declare const InitFuncFromInternalContextData: Story<{
35
36
  products: {
36
37
  price: number;
37
38
  name: string;
38
39
  }[];
39
40
  }>;
40
- export declare const InitFuncFromRootContextData: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
41
+ export declare const InitFuncFromRootContextData: Story<{
41
42
  products: {
42
43
  price: number;
43
44
  name: string;
44
45
  }[];
45
46
  }>;
46
- export declare const InitFuncFromInternalContextDataWithDelay: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
47
+ export declare const InitFuncFromInternalContextDataWithDelay: Story<{
47
48
  products: {
48
49
  price: number;
49
50
  name: string;
50
51
  }[];
51
52
  }>;
52
- export declare const RepeatedImplicitState: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>;
53
+ export declare const RepeatedImplicitState: Story<{}>;
53
54
  interface Person {
54
55
  firstName: string;
55
56
  lastName: string;
56
57
  nicknames: string[];
57
58
  }
58
- export declare const FormBuilder: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
59
+ export declare const FormBuilder: Story<{
59
60
  people: Person[];
60
61
  }>;
61
- export declare const FormBuilderImplicitStates: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
62
+ export declare const FormBuilderImplicitStates: Story<{
62
63
  people: Person[];
63
64
  }>;
64
- export declare const StateCellIsArray: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
65
+ export declare const StateCellIsArray: Story<{
65
66
  people: Person[];
66
67
  }>;
67
- export declare const StateCellIsMatrix: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
68
+ export declare const StateCellIsMatrix: Story<{
68
69
  board: number[][];
69
70
  }>;
70
- export declare const IsOnChangePropImmediatelyFired: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>;
71
- export declare const ImmutableStateCells: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
71
+ export declare const IsOnChangePropImmediatelyFired: Story<{}>;
72
+ export declare const ImmutableStateCells: Story<{
72
73
  people: Person[];
73
74
  }>;
74
- export declare const InCanvasDollarState: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>;
75
- export declare const AddDeleteSpecsInCanvas: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>;
76
- export declare const TodoApp: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>;
77
- export declare const CycleInStateInitialization: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>;
75
+ export declare const InCanvasDollarState: Story<{}>;
76
+ export declare const AddDeleteSpecsInCanvas: Story<{}>;
77
+ export declare const TodoApp: Story<{}>;
78
+ export declare const CycleInStateInitialization: Story<{}>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/react-web",
3
- "version": "0.2.196",
3
+ "version": "0.2.198",
4
4
  "description": "plasmic library for rendering in the presentational style",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,60 +20,33 @@
20
20
  }
21
21
  }
22
22
  },
23
- "size-limit": [
24
- {
25
- "path": "dist/react-web.cjs.production.min.js",
26
- "limit": "10 KB"
27
- },
28
- {
29
- "path": "dist/react-web.esm.js",
30
- "limit": "10 KB"
31
- }
32
- ],
33
23
  "exports": {
34
24
  ".": {
35
25
  "import": "./dist/react-web.esm.js",
36
- "require": "./dist/index.js"
26
+ "require": "./dist/index.cjs.js",
27
+ "types": "./dist/index.d.ts"
37
28
  },
38
29
  "./lib/host": {
39
30
  "import": "./lib/host/index.js",
40
- "require": "./lib/host/index.cjs.js"
31
+ "require": "./lib/host/index.cjs.js",
32
+ "types": "./lib/host/index.d.ts"
41
33
  },
42
34
  "./lib/data-sources": {
43
35
  "import": "./lib/data-sources/index.js",
44
- "require": "./lib/data-sources/index.cjs.js"
36
+ "require": "./lib/data-sources/index.cjs.js",
37
+ "types": "./lib/data-sources/index.d.ts"
45
38
  },
46
39
  "./lib/query": {
47
40
  "import": "./lib/query/index.js",
48
- "require": "./lib/query/index.cjs.js"
41
+ "require": "./lib/query/index.cjs.js",
42
+ "types": "./lib/query/index.d.ts"
49
43
  },
50
44
  "./lib/plasmic.css": "./lib/plasmic.css",
51
45
  "./skinny": {
52
46
  "import": "./skinny/dist/index.js"
53
47
  },
54
- "./skinny/dist/plume/button": {
55
- "import": "./skinny/dist/plume/button/index.js"
56
- },
57
- "./skinny/dist/plume/checkbox": {
58
- "import": "./skinny/dist/plume/checkbox/index.js"
59
- },
60
- "./skinny/dist/plume/menu": {
61
- "import": "./skinny/dist/plume/menu/index.js"
62
- },
63
- "./skinny/dist/plume/menu-button": {
64
- "import": "./skinny/dist/plume/menu-button/index.js"
65
- },
66
- "./skinny/dist/plume/select": {
67
- "import": "./skinny/dist/plume/select/index.js"
68
- },
69
- "./skinny/dist/plume/switch": {
70
- "import": "./skinny/dist/plume/switch/index.js"
71
- },
72
- "./skinny/dist/plume/text-input": {
73
- "import": "./skinny/dist/plume/text-input/index.js"
74
- },
75
- "./skinny/dist/plume/triggered-overlay": {
76
- "import": "./skinny/dist/plume/triggered-overlay/index.js"
48
+ "./skinny/dist/plume/*": {
49
+ "import": "./skinny/dist/plume/*/index.js"
77
50
  }
78
51
  },
79
52
  "files": [
@@ -82,7 +55,7 @@
82
55
  "skinny"
83
56
  ],
84
57
  "scripts": {
85
- "build": "tsdx build && rollup -c && mkdir -p lib && cp src/styles/plasmic.css lib/",
58
+ "build": "rollup -c && mkdir -p lib && cp src/styles/plasmic.css lib/",
86
59
  "start": "tsdx watch",
87
60
  "test": "tsdx test --passWithNoTests",
88
61
  "lint": "tsdx lint",
@@ -101,10 +74,10 @@
101
74
  },
102
75
  "prettier": {},
103
76
  "dependencies": {
104
- "@plasmicapp/data-sources": "0.1.66",
105
- "@plasmicapp/data-sources-context": "0.1.9",
106
- "@plasmicapp/host": "1.0.127",
107
- "@plasmicapp/query": "0.1.61",
77
+ "@plasmicapp/data-sources": "0.1.68",
78
+ "@plasmicapp/data-sources-context": "0.1.10",
79
+ "@plasmicapp/host": "1.0.129",
80
+ "@plasmicapp/query": "0.1.62",
108
81
  "@react-aria/checkbox": "^3.5.0",
109
82
  "@react-aria/focus": "^3.7.0",
110
83
  "@react-aria/interactions": "^3.10.0",
@@ -170,5 +143,5 @@
170
143
  "react": ">=16.8.0",
171
144
  "react-dom": ">=16.8.0"
172
145
  },
173
- "gitHead": "dfcc22b62558597db01eb8c4716fc1b56bc990e0"
146
+ "gitHead": "58e0dbd862668273e0fa3d4e4790e8c818935952"
174
147
  }
@@ -1,8 +1,9 @@
1
- import { b as __assign, l as isString } from './common-9d6d348d.js';
1
+ import { __assign } from 'tslib';
2
2
  import { Item, Section } from '@react-stately/collections';
3
3
  import React__default from 'react';
4
- import { t as toChildArray, g as getElementTypeName } from './react-utils-ee4e03ba.js';
5
- import { g as getPlumeType, P as PLUME_STRICT_MODE } from './plume-utils-7d68bcc0.js';
4
+ import { a as isString } from './common-dc5a84e8.js';
5
+ import { t as toChildArray, g as getElementTypeName } from './react-utils-898d19d0.js';
6
+ import { g as getPlumeType, P as PLUME_STRICT_MODE } from './plume-utils-83879d02.js';
6
7
 
7
8
  /**
8
9
  * In general, we try not to expose react-aria's Collections API to Plume users.
@@ -300,4 +301,4 @@ function cloneChild(child, props) {
300
301
  }
301
302
 
302
303
  export { renderAsCollectionChild as a, useDerivedItems as b, getChildProp as g, renderCollectionNode as r, useDerivedItemsFromChildren as u };
303
- //# sourceMappingURL=collection-utils-0967eaf0.js.map
304
+ //# sourceMappingURL=collection-utils-33d43bc0.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collection-utils-0967eaf0.js","sources":["../../src/plume/collection-utils.tsx"],"sourcesContent":["/**\n * In general, we try not to expose react-aria's Collections API to Plume users.\n * The Collections API is how react-aria users pass data about collections of\n * things using the built-in Item and Section components, which are abstract,\n * metadata-only components that don't render anything but only serve to specify\n * data. For example, here's how you would use react-spectrum's Picker:\n *\n * <Picker>\n * <Section title=\"Asia\">\n * <Item key=\"taiwan\">Taiwan</Item>\n * <Item key=\"japan\">Japan</Item>\n * <Item key=\"china\">China</Item>\n * </Section>\n * <Section title=\"Europe\">\n * <Item key=\"germany\">Germany</Item>\n * <Item key=\"france\">France</Item>\n * </Section>\n * </Picker>\n *\n * You would re-use this same Item/Section components to pass similar things to\n * Menu, Tabs, etc.\n *\n * For Plasmic, this API is too abstract. The user has explicitly designed components\n * like Select.Option and Select.OptionGroup, and it is weird that they don't actually\n * use these components. It is more natural to do:\n *\n * <Select>\n * <Select.OptionGroup title=\"Asia\">\n * <Select.Option key=\"taiwan\">Taiwan</Select>\n * </Select.OptionGroup>\n * </Select>\n *\n * For Plume, we let users directly use the components they designed, both to collect\n * information and to perform actual rendering. For example, for Plume,\n * you'd use Select.Option instead of Item, and Select.OptionGroup instead of Section.\n * This means that the Select.Option props will collect the same information Item\n * does.\n *\n * A component like Select.Option then serves two purposes:\n *\n * 1. Allow users to specify the collection of data, like in the above example\n * Here, we're mainly interested in the props in those ReactElements so\n * we can pass the Item/Section data onto react-aria's APIs. We are not\n * actually rendering these elements.\n * 2. Once react-aria's Collections API has gone through them and built\n * Collection \"nodes\", we then create cloned versions of these elements\n * with the corresponding node passed in as a secret prop. These ReactElements\n * are then actually used to _render_ the corresponding Option / OptionGroup.\n *\n * This file contains helper functions to help with implementing the above.\n *\n * Note also that most of the collections-based react-aria components expose\n * a parallel API that accepts a list of \"items\" and a render prop, instead\n * of list of Item/Section elements. This is for efficiency, but we are opting\n * to only support the composite-component pattern for now for simplicity.\n */\n\nimport { Item, Section } from \"@react-stately/collections\";\nimport { Node } from \"@react-types/shared\";\nimport React from \"react\";\nimport { isString } from \"../common\";\nimport { getElementTypeName, toChildArray } from \"../react-utils\";\nimport { getPlumeType, PLUME_STRICT_MODE } from \"./plume-utils\";\n\nexport interface PlasmicLoaderProps<T> {\n component: string;\n componentProps: T;\n}\n\n/**\n * Props for a Plume component that corresponds to an Item\n */\nexport interface ItemLikeProps {\n /**\n * value key corresponding to this item. Not required if you use the\n * `key` prop instead.\n */\n value?: string | null;\n\n /**\n * The text string value corresponding to this item. Used to support\n * keyboard type-ahead. If not specified, then will be derived from\n * `children` if it is a string, or the `value` or `key`.\n */\n textValue?: string;\n\n /**\n * aria-label for this item.\n */\n \"aria-label\"?: string;\n\n /**\n * Primary content label for this item.\n */\n children?: React.ReactNode;\n\n /**\n * If true, this item will not be selectable.\n */\n isDisabled?: boolean;\n}\n\ntype LoaderAwareItemLikeProps =\n | ItemLikeProps\n | PlasmicLoaderProps<ItemLikeProps>;\n\n/**\n * Props for a Plume component that corresponds to a Section\n */\nexport interface SectionLikeProps {\n /**\n * Heading content of the title\n */\n title?: React.ReactNode;\n\n /**\n * aria-label for this section\n */\n \"aria-label\"?: string;\n\n /**\n * A list of items that belong in this group\n */\n children?: React.ReactNode;\n}\n\ntype LoaderAwareSectionLikeProps =\n | SectionLikeProps\n | PlasmicLoaderProps<SectionLikeProps>;\n\nexport type ItemJson = LeafItemJson | SectionJson;\n\nexport type LeafItemJson =\n | string\n | {\n value: string;\n label?: string;\n textValue?: string;\n isDisabled?: boolean;\n };\n\nexport interface SectionJson {\n title: string;\n children: ItemJson[];\n}\n\nexport function deriveItemsFromProps(\n props: any,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n ItemComponent?: React.ComponentType<ItemLikeProps>;\n SectionComponent?: React.ComponentType<SectionLikeProps>;\n itemsProp?: string;\n }\n) {\n if (opts.itemsProp && opts.itemsProp in props) {\n if (!opts.ItemComponent || !opts.SectionComponent) {\n throw new Error(`You may need to re-generate your Plasmic* files`);\n }\n const items = props[opts.itemsProp] as ItemJson[] | undefined;\n return deriveItemsFromItemsProp(items, {\n ItemComponent: opts.ItemComponent,\n SectionComponent: opts.SectionComponent,\n });\n } else {\n return deriveItemsFromChildren(props.children as React.ReactNode, opts);\n }\n}\n\nfunction deriveItemsFromItemsProp(\n items: ItemJson[] | undefined,\n opts: {\n ItemComponent: React.ComponentType<ItemLikeProps>;\n SectionComponent: React.ComponentType<SectionLikeProps>;\n }\n) {\n const { ItemComponent, SectionComponent } = opts;\n const disabledKeys: string[] = [];\n const transform = (item: ItemJson) => {\n if (typeof item === \"string\") {\n return (\n <ItemComponent key={item} value={item}>\n {item}\n </ItemComponent>\n );\n } else if (\"children\" in item) {\n return (\n <SectionComponent key={item.title} title={item.title}>\n {item.children.map((x) => transform(x))}\n </SectionComponent>\n );\n } else {\n if (item.isDisabled) {\n disabledKeys.push(item.value);\n }\n return (\n <ItemComponent\n key={item.value}\n value={item.value}\n textValue={item.textValue}\n isDisabled={item.isDisabled}\n >\n {item.label ?? item.value}\n </ItemComponent>\n );\n }\n };\n return {\n items: items?.map((x) => transform(x)) ?? [],\n disabledKeys,\n };\n}\n\n/**\n * Given children of a component like Select or Menu, derive the items\n * that we will pass into the Collections API. These will be\n * ReactElement<ItemLikeProps|SectionLikeProps>[].\n *\n * Will also assign keys to items by their index in the collection,\n * and collect the keys of disabled items.\n */\nexport function deriveItemsFromChildren<T extends React.ReactElement>(\n children: React.ReactNode,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n }\n) {\n if (!children) {\n return {\n items: [] as T[],\n disabledKeys: [] as React.Key[],\n };\n }\n\n const { itemPlumeType, sectionPlumeType, invalidChildError } = opts;\n\n // For Plume items without an explicit key, we assign a key as the index\n // of the collection.\n let itemCount = 0;\n let sectionCount = 0;\n\n const ensureValue = (element: React.ReactElement) => {\n if (!propInChild(element, \"value\")) {\n if (opts.requireItemValue && PLUME_STRICT_MODE) {\n throw new Error(\n `Must specify a \"value\" prop for ${getElementTypeName(element)}`\n );\n } else {\n return cloneChild(element, { value: `${itemCount++}` });\n }\n } else {\n // Still increment count even if key is present, so that the\n // auto-assigned key really reflects the index\n itemCount++;\n return element;\n }\n };\n\n const disabledKeys: React.Key[] = [];\n\n const flattenedChildren = (\n children: React.ReactNode\n ): React.ReactElement[] => {\n return toChildArray(children).flatMap((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n return flattenedChildren(\n (child as React.ReactElement<{ children: React.ReactNode }>).props\n .children\n );\n }\n const type = getPlumeType(child);\n if (type === itemPlumeType) {\n child = ensureValue(child);\n const childKey = getItemLikeKey(child);\n if (getChildProp(child, \"isDisabled\") && !!childKey) {\n disabledKeys.push(childKey);\n }\n return [child];\n }\n if (type === sectionPlumeType) {\n return [\n cloneChild(child, {\n // key of section doesn't actually matter, just needs\n // to be unique\n key: child.key ?? `section-${sectionCount++}`,\n children: flattenedChildren(getChildProp(child, \"children\")),\n }),\n ];\n }\n }\n\n if (PLUME_STRICT_MODE) {\n throw new Error(invalidChildError ?? `Unexpected child`);\n } else {\n return [];\n }\n });\n };\n\n return { items: flattenedChildren(children) as T[], disabledKeys };\n}\n\nexport function useDerivedItems(\n props: any,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n ItemComponent?: React.ComponentType<ItemLikeProps>;\n SectionComponent?: React.ComponentType<SectionLikeProps>;\n itemsProp?: string;\n }\n) {\n const { children } = props;\n const {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ItemComponent,\n SectionComponent,\n itemsProp,\n } = opts;\n const items = itemsProp ? props[itemsProp] : undefined;\n return React.useMemo(() => {\n return deriveItemsFromProps(props, {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n itemsProp,\n ItemComponent,\n SectionComponent,\n });\n }, [\n children,\n items,\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ItemComponent,\n SectionComponent,\n ]);\n}\n\nexport function useDerivedItemsFromChildren<T extends React.ReactElement>(\n children: React.ReactNode,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n }\n) {\n const {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n } = opts;\n return React.useMemo(() => {\n return deriveItemsFromChildren<T>(children, {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n });\n }, [\n children,\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ]);\n}\n\n/**\n * Given a Collection node, create the React element that we should use\n * to render it.\n */\nexport function renderCollectionNode(node: Node<any>) {\n // node.rendered should already have our item-like or section-like Plume\n // component elements, so we just need to clone them with a secret\n // _node prop that we use to render.\n return cloneChild(node.rendered as React.ReactElement, {\n _node: node,\n key: node.key,\n });\n}\n\n/**\n * Renders a item-like or section-like Plume component element into an\n * Item or a Section element.\n */\nexport function renderAsCollectionChild<\n T extends React.ReactElement<\n LoaderAwareItemLikeProps | LoaderAwareSectionLikeProps\n >\n>(\n child: T,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n }\n) {\n const plumeType = getPlumeType(child);\n if (plumeType === opts.itemPlumeType) {\n const option = child as React.ReactElement<LoaderAwareItemLikeProps>;\n\n // We look at the children passed to the item-like element, and derive key\n // or textValue from it if it is a string\n const content = getChildProp(option, \"children\");\n\n // The children render prop needs to return an <Item/>\n return (\n <Item\n // We use ItemLike.value if the user explicitly specified a value,\n // and we fallback to key. If the user specified neither, then\n // the Collections API will generate a unique key for this item.\n key={getItemLikeKey(option)}\n // textValue is either explicitly specified by the user, or we\n // try to derive it if `content` is a string.\n textValue={\n getChildProp(option, \"textValue\") ??\n (isString(content)\n ? content\n : propInChild(option, \"value\")\n ? getChildProp(option, \"value\")\n : option.key)\n }\n aria-label={getChildProp(option, \"aria-label\")}\n >\n {\n // Note that what we setting the item-like element as the children\n // here, and not content; we want the entire item-like Plume element to\n // end up as Node.rendered.\n }\n {option}\n </Item>\n );\n } else {\n const group = child as React.ReactElement<LoaderAwareSectionLikeProps>;\n return (\n <Section\n // Note that we are using the whole section-like element as the title\n // here, and not group.props.title; we want the entire section-like\n // Plume element to end up as Node.rendered.\n title={group}\n aria-label={getChildProp(group, \"aria-label\")}\n // We are flattening and deriving the descendant Options as items here.\n // group.props.children should've already been cleaned up by\n // deriveItemsFromChildren()\n items={getChildProp(group, \"children\") as React.ReactElement[]}\n >\n {\n // We use the same render function to turn descendent Options into Items\n }\n {(c: React.ReactElement) => renderAsCollectionChild(c, opts)}\n </Section>\n );\n }\n}\n\nfunction getItemLikeKey(element: React.ReactElement<LoaderAwareItemLikeProps>) {\n return getChildProp(element, \"value\") ?? element.key;\n}\n\n// PlasmicLoader-aware function to get prop from child.\nexport function getChildProp(child: React.ReactElement, prop: string) {\n return \"componentProps\" in child.props\n ? child.props.componentProps[prop]\n : child.props[prop];\n}\n\n// PlasmicLoader-aware function to check `if (prop in element.props)`.\nfunction propInChild(child: React.ReactElement, prop: string): boolean {\n return \"componentProps\" in child.props\n ? prop in child.props.componentProps\n : prop in child.props;\n}\n\n// PlasmicLoader-aware function to clone React element.\nfunction cloneChild(child: React.ReactElement, props: Record<string, any>) {\n if ((child.type as any).getPlumeType) {\n // If React element has getPlumeType(), assume that it is PlasmicLoader,\n // so add nodeProps to componentProps instead of element props.\n return React.cloneElement(child, {\n componentProps: {\n ...child.props.componentProps,\n ...props,\n },\n ...(props.key ? { key: props.key } : {}),\n });\n }\n\n return React.cloneElement(child, props);\n}\n"],"names":["React"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAkJgB,oBAAoB,CAClC,KAAU,EACV,IAQC;IAED,IAAI,IAAI,CAAC,SAAS,IAAI,I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AAY;IAClE,OAAO,gBAAgB,IAAI,KAAK,CAAC,KAAK;UAClC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC;UAChC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED;AACA,SAAS,WAAW,CAAC,KAAyB,EAAE,IAAY;IAC1D,OAAO,gBAAgB,IAAI,KAAK,CAAC,KAAK;UAClC,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc;UAClC,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC;AAC1B,CAAC;AAED;AACA,SAAS,UAAU,CAAC,KAAyB,EAAE,KAA0B;IACvE,IAAK,KAAK,CAAC,IAAY,CAAC,YAAY,EAAE;;;QAGpC,OAAOA,cAAK,CAAC,YAAY,CAAC,KAAK,aAC7B,cAAc,wBACT,KAAK,CAAC,KAAK,CAAC,cAAc,GAC1B,KAAK,MAEN,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GACvC,CAAC;KACJ;IAED,OAAOA,cAAK,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC1C;;;;"}
1
+ {"version":3,"file":"collection-utils-33d43bc0.js","sources":["../../src/plume/collection-utils.tsx"],"sourcesContent":["/**\n * In general, we try not to expose react-aria's Collections API to Plume users.\n * The Collections API is how react-aria users pass data about collections of\n * things using the built-in Item and Section components, which are abstract,\n * metadata-only components that don't render anything but only serve to specify\n * data. For example, here's how you would use react-spectrum's Picker:\n *\n * <Picker>\n * <Section title=\"Asia\">\n * <Item key=\"taiwan\">Taiwan</Item>\n * <Item key=\"japan\">Japan</Item>\n * <Item key=\"china\">China</Item>\n * </Section>\n * <Section title=\"Europe\">\n * <Item key=\"germany\">Germany</Item>\n * <Item key=\"france\">France</Item>\n * </Section>\n * </Picker>\n *\n * You would re-use this same Item/Section components to pass similar things to\n * Menu, Tabs, etc.\n *\n * For Plasmic, this API is too abstract. The user has explicitly designed components\n * like Select.Option and Select.OptionGroup, and it is weird that they don't actually\n * use these components. It is more natural to do:\n *\n * <Select>\n * <Select.OptionGroup title=\"Asia\">\n * <Select.Option key=\"taiwan\">Taiwan</Select>\n * </Select.OptionGroup>\n * </Select>\n *\n * For Plume, we let users directly use the components they designed, both to collect\n * information and to perform actual rendering. For example, for Plume,\n * you'd use Select.Option instead of Item, and Select.OptionGroup instead of Section.\n * This means that the Select.Option props will collect the same information Item\n * does.\n *\n * A component like Select.Option then serves two purposes:\n *\n * 1. Allow users to specify the collection of data, like in the above example\n * Here, we're mainly interested in the props in those ReactElements so\n * we can pass the Item/Section data onto react-aria's APIs. We are not\n * actually rendering these elements.\n * 2. Once react-aria's Collections API has gone through them and built\n * Collection \"nodes\", we then create cloned versions of these elements\n * with the corresponding node passed in as a secret prop. These ReactElements\n * are then actually used to _render_ the corresponding Option / OptionGroup.\n *\n * This file contains helper functions to help with implementing the above.\n *\n * Note also that most of the collections-based react-aria components expose\n * a parallel API that accepts a list of \"items\" and a render prop, instead\n * of list of Item/Section elements. This is for efficiency, but we are opting\n * to only support the composite-component pattern for now for simplicity.\n */\n\nimport { Item, Section } from \"@react-stately/collections\";\nimport { Node } from \"@react-types/shared\";\nimport React from \"react\";\nimport { isString } from \"../common\";\nimport { getElementTypeName, toChildArray } from \"../react-utils\";\nimport { getPlumeType, PLUME_STRICT_MODE } from \"./plume-utils\";\n\nexport interface PlasmicLoaderProps<T> {\n component: string;\n componentProps: T;\n}\n\n/**\n * Props for a Plume component that corresponds to an Item\n */\nexport interface ItemLikeProps {\n /**\n * value key corresponding to this item. Not required if you use the\n * `key` prop instead.\n */\n value?: string | null;\n\n /**\n * The text string value corresponding to this item. Used to support\n * keyboard type-ahead. If not specified, then will be derived from\n * `children` if it is a string, or the `value` or `key`.\n */\n textValue?: string;\n\n /**\n * aria-label for this item.\n */\n \"aria-label\"?: string;\n\n /**\n * Primary content label for this item.\n */\n children?: React.ReactNode;\n\n /**\n * If true, this item will not be selectable.\n */\n isDisabled?: boolean;\n}\n\ntype LoaderAwareItemLikeProps =\n | ItemLikeProps\n | PlasmicLoaderProps<ItemLikeProps>;\n\n/**\n * Props for a Plume component that corresponds to a Section\n */\nexport interface SectionLikeProps {\n /**\n * Heading content of the title\n */\n title?: React.ReactNode;\n\n /**\n * aria-label for this section\n */\n \"aria-label\"?: string;\n\n /**\n * A list of items that belong in this group\n */\n children?: React.ReactNode;\n}\n\ntype LoaderAwareSectionLikeProps =\n | SectionLikeProps\n | PlasmicLoaderProps<SectionLikeProps>;\n\nexport type ItemJson = LeafItemJson | SectionJson;\n\nexport type LeafItemJson =\n | string\n | {\n value: string;\n label?: string;\n textValue?: string;\n isDisabled?: boolean;\n };\n\nexport interface SectionJson {\n title: string;\n children: ItemJson[];\n}\n\nexport function deriveItemsFromProps(\n props: any,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n ItemComponent?: React.ComponentType<ItemLikeProps>;\n SectionComponent?: React.ComponentType<SectionLikeProps>;\n itemsProp?: string;\n }\n) {\n if (opts.itemsProp && opts.itemsProp in props) {\n if (!opts.ItemComponent || !opts.SectionComponent) {\n throw new Error(`You may need to re-generate your Plasmic* files`);\n }\n const items = props[opts.itemsProp] as ItemJson[] | undefined;\n return deriveItemsFromItemsProp(items, {\n ItemComponent: opts.ItemComponent,\n SectionComponent: opts.SectionComponent,\n });\n } else {\n return deriveItemsFromChildren(props.children as React.ReactNode, opts);\n }\n}\n\nfunction deriveItemsFromItemsProp(\n items: ItemJson[] | undefined,\n opts: {\n ItemComponent: React.ComponentType<ItemLikeProps>;\n SectionComponent: React.ComponentType<SectionLikeProps>;\n }\n) {\n const { ItemComponent, SectionComponent } = opts;\n const disabledKeys: string[] = [];\n const transform = (item: ItemJson) => {\n if (typeof item === \"string\") {\n return (\n <ItemComponent key={item} value={item}>\n {item}\n </ItemComponent>\n );\n } else if (\"children\" in item) {\n return (\n <SectionComponent key={item.title} title={item.title}>\n {item.children.map((x) => transform(x))}\n </SectionComponent>\n );\n } else {\n if (item.isDisabled) {\n disabledKeys.push(item.value);\n }\n return (\n <ItemComponent\n key={item.value}\n value={item.value}\n textValue={item.textValue}\n isDisabled={item.isDisabled}\n >\n {item.label ?? item.value}\n </ItemComponent>\n );\n }\n };\n return {\n items: items?.map((x) => transform(x)) ?? [],\n disabledKeys,\n };\n}\n\n/**\n * Given children of a component like Select or Menu, derive the items\n * that we will pass into the Collections API. These will be\n * ReactElement<ItemLikeProps|SectionLikeProps>[].\n *\n * Will also assign keys to items by their index in the collection,\n * and collect the keys of disabled items.\n */\nexport function deriveItemsFromChildren<T extends React.ReactElement>(\n children: React.ReactNode,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n }\n) {\n if (!children) {\n return {\n items: [] as T[],\n disabledKeys: [] as React.Key[],\n };\n }\n\n const { itemPlumeType, sectionPlumeType, invalidChildError } = opts;\n\n // For Plume items without an explicit key, we assign a key as the index\n // of the collection.\n let itemCount = 0;\n let sectionCount = 0;\n\n const ensureValue = (element: React.ReactElement) => {\n if (!propInChild(element, \"value\")) {\n if (opts.requireItemValue && PLUME_STRICT_MODE) {\n throw new Error(\n `Must specify a \"value\" prop for ${getElementTypeName(element)}`\n );\n } else {\n return cloneChild(element, { value: `${itemCount++}` });\n }\n } else {\n // Still increment count even if key is present, so that the\n // auto-assigned key really reflects the index\n itemCount++;\n return element;\n }\n };\n\n const disabledKeys: React.Key[] = [];\n\n const flattenedChildren = (\n children: React.ReactNode\n ): React.ReactElement[] => {\n return toChildArray(children).flatMap((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n return flattenedChildren(\n (child as React.ReactElement<{ children: React.ReactNode }>).props\n .children\n );\n }\n const type = getPlumeType(child);\n if (type === itemPlumeType) {\n child = ensureValue(child);\n const childKey = getItemLikeKey(child);\n if (getChildProp(child, \"isDisabled\") && !!childKey) {\n disabledKeys.push(childKey);\n }\n return [child];\n }\n if (type === sectionPlumeType) {\n return [\n cloneChild(child, {\n // key of section doesn't actually matter, just needs\n // to be unique\n key: child.key ?? `section-${sectionCount++}`,\n children: flattenedChildren(getChildProp(child, \"children\")),\n }),\n ];\n }\n }\n\n if (PLUME_STRICT_MODE) {\n throw new Error(invalidChildError ?? `Unexpected child`);\n } else {\n return [];\n }\n });\n };\n\n return { items: flattenedChildren(children) as T[], disabledKeys };\n}\n\nexport function useDerivedItems(\n props: any,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n ItemComponent?: React.ComponentType<ItemLikeProps>;\n SectionComponent?: React.ComponentType<SectionLikeProps>;\n itemsProp?: string;\n }\n) {\n const { children } = props;\n const {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ItemComponent,\n SectionComponent,\n itemsProp,\n } = opts;\n const items = itemsProp ? props[itemsProp] : undefined;\n return React.useMemo(() => {\n return deriveItemsFromProps(props, {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n itemsProp,\n ItemComponent,\n SectionComponent,\n });\n }, [\n children,\n items,\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ItemComponent,\n SectionComponent,\n ]);\n}\n\nexport function useDerivedItemsFromChildren<T extends React.ReactElement>(\n children: React.ReactNode,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n }\n) {\n const {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n } = opts;\n return React.useMemo(() => {\n return deriveItemsFromChildren<T>(children, {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n });\n }, [\n children,\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ]);\n}\n\n/**\n * Given a Collection node, create the React element that we should use\n * to render it.\n */\nexport function renderCollectionNode(node: Node<any>) {\n // node.rendered should already have our item-like or section-like Plume\n // component elements, so we just need to clone them with a secret\n // _node prop that we use to render.\n return cloneChild(node.rendered as React.ReactElement, {\n _node: node,\n key: node.key,\n });\n}\n\n/**\n * Renders a item-like or section-like Plume component element into an\n * Item or a Section element.\n */\nexport function renderAsCollectionChild<\n T extends React.ReactElement<\n LoaderAwareItemLikeProps | LoaderAwareSectionLikeProps\n >\n>(\n child: T,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n }\n) {\n const plumeType = getPlumeType(child);\n if (plumeType === opts.itemPlumeType) {\n const option = child as React.ReactElement<LoaderAwareItemLikeProps>;\n\n // We look at the children passed to the item-like element, and derive key\n // or textValue from it if it is a string\n const content = getChildProp(option, \"children\");\n\n // The children render prop needs to return an <Item/>\n return (\n <Item\n // We use ItemLike.value if the user explicitly specified a value,\n // and we fallback to key. If the user specified neither, then\n // the Collections API will generate a unique key for this item.\n key={getItemLikeKey(option)}\n // textValue is either explicitly specified by the user, or we\n // try to derive it if `content` is a string.\n textValue={\n getChildProp(option, \"textValue\") ??\n (isString(content)\n ? content\n : propInChild(option, \"value\")\n ? getChildProp(option, \"value\")\n : option.key)\n }\n aria-label={getChildProp(option, \"aria-label\")}\n >\n {\n // Note that what we setting the item-like element as the children\n // here, and not content; we want the entire item-like Plume element to\n // end up as Node.rendered.\n }\n {option}\n </Item>\n );\n } else {\n const group = child as React.ReactElement<LoaderAwareSectionLikeProps>;\n return (\n <Section\n // Note that we are using the whole section-like element as the title\n // here, and not group.props.title; we want the entire section-like\n // Plume element to end up as Node.rendered.\n title={group}\n aria-label={getChildProp(group, \"aria-label\")}\n // We are flattening and deriving the descendant Options as items here.\n // group.props.children should've already been cleaned up by\n // deriveItemsFromChildren()\n items={getChildProp(group, \"children\") as React.ReactElement[]}\n >\n {\n // We use the same render function to turn descendent Options into Items\n }\n {(c: React.ReactElement) => renderAsCollectionChild(c, opts)}\n </Section>\n );\n }\n}\n\nfunction getItemLikeKey(element: React.ReactElement<LoaderAwareItemLikeProps>) {\n return getChildProp(element, \"value\") ?? element.key;\n}\n\n// PlasmicLoader-aware function to get prop from child.\nexport function getChildProp(child: React.ReactElement, prop: string) {\n return \"componentProps\" in child.props\n ? child.props.componentProps[prop]\n : child.props[prop];\n}\n\n// PlasmicLoader-aware function to check `if (prop in element.props)`.\nfunction propInChild(child: React.ReactElement, prop: string): boolean {\n return \"componentProps\" in child.props\n ? prop in child.props.componentProps\n : prop in child.props;\n}\n\n// PlasmicLoader-aware function to clone React element.\nfunction cloneChild(child: React.ReactElement, props: Record<string, any>) {\n if ((child.type as any).getPlumeType) {\n // If React element has getPlumeType(), assume that it is PlasmicLoader,\n // so add nodeProps to componentProps instead of element props.\n return React.cloneElement(child, {\n componentProps: {\n ...child.props.componentProps,\n ...props,\n },\n ...(props.key ? { key: props.key } : {}),\n });\n }\n\n return React.cloneElement(child, props);\n}\n"],"names":["React"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAkJgB,oBAAoB,CAClC,KAAU,EACV,IAQC;IAED,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,IAAI,KAAK,EAAE;QAC7C,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACjD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACpE;QACD,IAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAA2B,CAAC;QAC9D,OAAO,wBAAwB,CAAC,KAAK,EAAE;YACrC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;SACxC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,uBAAuB,CAAC,KAAK,CAAC,QAA2B,EAAE,IAAI,CAAC,CAAC;KACzE;AACH,CAAC;AAED,SAAS,wBAAwB,CAC/B,KAA6B,EAC7B,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