@plasmicapp/react-web 0.2.103 → 0.2.104

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 (46) hide show
  1. package/dist/all.d.ts +118 -105
  2. package/dist/plume/menu-button/menu-trigger.d.ts +1 -1
  3. package/dist/react-web.cjs.development.js +218 -126
  4. package/dist/react-web.cjs.development.js.map +1 -1
  5. package/dist/react-web.cjs.production.min.js +1 -1
  6. package/dist/react-web.cjs.production.min.js.map +1 -1
  7. package/dist/react-web.esm.js +218 -126
  8. package/dist/react-web.esm.js.map +1 -1
  9. package/dist/render/triggers.d.ts +4 -4
  10. package/dist/states/index.d.ts +3 -1
  11. package/dist/stories/UseDollarState.stories.d.ts +7 -0
  12. package/package.json +20 -19
  13. package/skinny/dist/collection-utils-57c273dc.js +238 -0
  14. package/skinny/dist/collection-utils-57c273dc.js.map +1 -0
  15. package/skinny/dist/common-182a0b0c.js +201 -0
  16. package/skinny/dist/common-182a0b0c.js.map +1 -0
  17. package/skinny/dist/index.js +63 -43
  18. package/skinny/dist/index.js.map +1 -1
  19. package/skinny/dist/plume/button/index.js +5 -5
  20. package/skinny/dist/plume/button/index.js.map +1 -1
  21. package/skinny/dist/plume/checkbox/index.js +6 -6
  22. package/skinny/dist/plume/checkbox/index.js.map +1 -1
  23. package/skinny/dist/plume/menu/index.js +11 -11
  24. package/skinny/dist/plume/menu/index.js.map +1 -1
  25. package/skinny/dist/plume/menu-button/index.js +6 -6
  26. package/skinny/dist/plume/menu-button/index.js.map +1 -1
  27. package/skinny/dist/plume/menu-button/menu-trigger.d.ts +1 -1
  28. package/skinny/dist/plume/select/index.js +11 -11
  29. package/skinny/dist/plume/select/index.js.map +1 -1
  30. package/skinny/dist/plume/switch/index.js +6 -6
  31. package/skinny/dist/plume/switch/index.js.map +1 -1
  32. package/skinny/dist/plume/text-input/index.js +5 -5
  33. package/skinny/dist/plume/text-input/index.js.map +1 -1
  34. package/skinny/dist/plume/triggered-overlay/index.js +7 -7
  35. package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
  36. package/skinny/dist/plume-utils-623b91cc.js +35 -0
  37. package/skinny/dist/plume-utils-623b91cc.js.map +1 -0
  38. package/skinny/dist/props-utils-b2ad4997.js +8 -0
  39. package/skinny/dist/props-utils-b2ad4997.js.map +1 -0
  40. package/skinny/dist/react-utils-35cb2a4e.js +201 -0
  41. package/skinny/dist/react-utils-35cb2a4e.js.map +1 -0
  42. package/skinny/dist/render/PlasmicImg/index.js +3 -3
  43. package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
  44. package/skinny/dist/render/triggers.d.ts +4 -4
  45. package/skinny/dist/states/index.d.ts +3 -1
  46. package/skinny/dist/stories/UseDollarState.stories.d.ts +7 -0
package/dist/all.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent, ReactNode } from 'react';
2
+ import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties, FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent, ReactNode } from 'react';
3
3
 
4
4
  // This is the only way I found to break circular references between ClassArray and ClassValue
5
5
  // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
@@ -268,109 +268,6 @@ declare const Stack: (<T extends "symbol" | "object" | "a" | "abbr" | "address"
268
268
  }>;
269
269
  };
270
270
 
271
- declare function useFocused(opts: {
272
- isTextInput?: boolean;
273
- }): (boolean | React.HTMLAttributes<HTMLElement>)[];
274
- declare function useFocusVisible(opts: {
275
- isTextInput?: boolean;
276
- }): (boolean | React.HTMLAttributes<HTMLElement>)[];
277
- declare function useFocusedWithin(opts: {
278
- isTextInput?: boolean;
279
- }): (boolean | React.HTMLAttributes<HTMLElement>)[];
280
- declare function useFocusVisibleWithin(opts: {
281
- isTextInput?: boolean;
282
- }): (boolean | React.HTMLAttributes<HTMLElement>)[];
283
- declare function useHover(): (boolean | {
284
- onMouseEnter: () => void;
285
- onMouseLeave: () => void;
286
- })[];
287
- declare function usePressed(): (boolean | {
288
- onMouseDown: () => void;
289
- onMouseUp: () => void;
290
- })[];
291
- declare const TRIGGER_TO_HOOK: {
292
- readonly useHover: typeof useHover;
293
- readonly useFocused: typeof useFocused;
294
- readonly useFocusVisible: typeof useFocusVisible;
295
- readonly useFocusedWithin: typeof useFocusedWithin;
296
- readonly useFocusVisibleWithin: typeof useFocusVisibleWithin;
297
- readonly usePressed: typeof usePressed;
298
- };
299
- declare type TriggerType = keyof typeof TRIGGER_TO_HOOK;
300
- interface TriggerOpts {
301
- isTextInput?: boolean;
302
- }
303
- /**
304
- * Installs argment trigger. All the useTrigger calls must use hardcoded `trigger` arg,
305
- * as it's not valid to install variable React hooks!
306
- */
307
- declare function useTrigger(trigger: TriggerType, opts: TriggerOpts): [boolean, React.HTMLAttributes<HTMLElement>];
308
-
309
- declare const classNames: ClassNamesExport;
310
-
311
- declare function setPlumeStrictMode(mode: boolean): void;
312
- declare type VariantArgChoices<T> = T extends (infer M)[] ? M : T extends SingleChoiceArg<infer M> ? M : never;
313
- declare type VariantArgsChoices<V> = {
314
- [k in keyof V]-?: VariantArgChoices<V[k]>;
315
- };
316
- declare type DictValues<V extends Record<string, any>> = V[keyof V];
317
- declare type DictTuples<V extends Record<string, any>> = DictValues<{
318
- [K in keyof V]: [K, V[K]];
319
- }>;
320
- declare type VariantDefTuple<V> = DictTuples<VariantArgsChoices<V>>;
321
- declare type DistributeTuple<T> = T extends [infer T1, infer T2] ? {
322
- group: T1;
323
- variant: T2;
324
- } : never;
325
- declare type VariantDef<V> = DistributeTuple<VariantDefTuple<V>>;
326
- declare type PlasmicClass<V extends Record<string, any>, A extends Record<string, any>, O extends Record<string, any>> = {
327
- (props: {
328
- variants?: V;
329
- args?: A;
330
- overrides?: O;
331
- }): React.ReactElement | null;
332
- internalVariantProps: (keyof V)[];
333
- internalArgProps: (keyof A)[];
334
- };
335
- declare type AnyPlasmicClass = PlasmicClass<any, any, any>;
336
- declare type PlasmicClassVariants<C extends AnyPlasmicClass> = C extends PlasmicClass<infer V, any, any> ? V : unknown;
337
- declare type PlasmicClassArgs<C extends AnyPlasmicClass> = C extends PlasmicClass<any, infer A, any> ? A : unknown;
338
- declare type PlasmicClassOverrides<C extends AnyPlasmicClass> = C extends PlasmicClass<any, any, infer O> ? O : unknown;
339
-
340
- interface CommonProps {
341
- showStartIcon?: boolean;
342
- showEndIcon?: boolean;
343
- startIcon?: React.ReactNode;
344
- endIcon?: React.ReactNode;
345
- children?: React.ReactNode;
346
- isDisabled?: boolean;
347
- }
348
- interface HtmlButtonProps extends Omit<React.ComponentProps<"button">, "ref" | "disabled"> {
349
- }
350
- interface HtmlAnchorProps extends Omit<React.ComponentProps<"a">, "ref" | "href"> {
351
- link?: string;
352
- }
353
- declare type BaseButtonProps = CommonProps & HtmlButtonProps & HtmlAnchorProps;
354
- declare type HtmlAnchorOnlyProps = Exclude<keyof HtmlAnchorProps, keyof HtmlButtonProps>;
355
- declare type HtmlButtonOnlyProps = Exclude<keyof HtmlButtonProps, keyof HtmlAnchorProps>;
356
- declare type ButtonRef = React.Ref<HTMLButtonElement | HTMLAnchorElement>;
357
- interface ButtonConfig<C extends AnyPlasmicClass> {
358
- showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
359
- showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;
360
- isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
361
- startIconSlot?: keyof PlasmicClassArgs<C>;
362
- endIconSlot?: keyof PlasmicClassArgs<C>;
363
- contentSlot: keyof PlasmicClassArgs<C>;
364
- root: keyof PlasmicClassOverrides<C>;
365
- }
366
- declare function useButton<P extends BaseButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: ButtonConfig<C>, ref?: ButtonRef): {
367
- plasmicProps: {
368
- variants: PlasmicClassVariants<C>;
369
- args: PlasmicClassArgs<C>;
370
- overrides: PlasmicClassOverrides<C>;
371
- };
372
- };
373
-
374
271
  /*
375
272
  * Copyright 2020 Adobe. All rights reserved.
376
273
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -433,6 +330,17 @@ interface FocusableDOMProps extends DOMProps {
433
330
  excludeFromTabOrder?: boolean
434
331
  }
435
332
 
333
+ /** Any focusable element, including both HTML and SVG elements. */
334
+ interface FocusableElement extends Element, HTMLOrSVGElement {}
335
+
336
+ /** All DOM attributes supported across both HTML and SVG elements. */
337
+ interface DOMAttributes<T = FocusableElement> extends AriaAttributes, DOMAttributes$1<T> {
338
+ id?: string | undefined,
339
+ role?: AriaRole | undefined,
340
+ tabIndex?: number | undefined,
341
+ style?: CSSProperties | undefined
342
+ }
343
+
436
344
  /*
437
345
  * Copyright 2020 Adobe. All rights reserved.
438
346
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -509,6 +417,109 @@ interface FocusableProps extends FocusEvents, KeyboardEvents {
509
417
  autoFocus?: boolean
510
418
  }
511
419
 
420
+ declare function useFocused(opts: {
421
+ isTextInput?: boolean;
422
+ }): (boolean | DOMAttributes<FocusableElement>)[];
423
+ declare function useFocusVisible(opts: {
424
+ isTextInput?: boolean;
425
+ }): (boolean | DOMAttributes<FocusableElement>)[];
426
+ declare function useFocusedWithin(opts: {
427
+ isTextInput?: boolean;
428
+ }): (boolean | DOMAttributes<FocusableElement>)[];
429
+ declare function useFocusVisibleWithin(opts: {
430
+ isTextInput?: boolean;
431
+ }): (boolean | DOMAttributes<FocusableElement>)[];
432
+ declare function useHover(): (boolean | {
433
+ onMouseEnter: () => void;
434
+ onMouseLeave: () => void;
435
+ })[];
436
+ declare function usePressed(): (boolean | {
437
+ onMouseDown: () => void;
438
+ onMouseUp: () => void;
439
+ })[];
440
+ declare const TRIGGER_TO_HOOK: {
441
+ readonly useHover: typeof useHover;
442
+ readonly useFocused: typeof useFocused;
443
+ readonly useFocusVisible: typeof useFocusVisible;
444
+ readonly useFocusedWithin: typeof useFocusedWithin;
445
+ readonly useFocusVisibleWithin: typeof useFocusVisibleWithin;
446
+ readonly usePressed: typeof usePressed;
447
+ };
448
+ declare type TriggerType = keyof typeof TRIGGER_TO_HOOK;
449
+ interface TriggerOpts {
450
+ isTextInput?: boolean;
451
+ }
452
+ /**
453
+ * Installs argment trigger. All the useTrigger calls must use hardcoded `trigger` arg,
454
+ * as it's not valid to install variable React hooks!
455
+ */
456
+ declare function useTrigger(trigger: TriggerType, opts: TriggerOpts): [boolean, React.HTMLAttributes<HTMLElement>];
457
+
458
+ declare const classNames: ClassNamesExport;
459
+
460
+ declare function setPlumeStrictMode(mode: boolean): void;
461
+ declare type VariantArgChoices<T> = T extends (infer M)[] ? M : T extends SingleChoiceArg<infer M> ? M : never;
462
+ declare type VariantArgsChoices<V> = {
463
+ [k in keyof V]-?: VariantArgChoices<V[k]>;
464
+ };
465
+ declare type DictValues<V extends Record<string, any>> = V[keyof V];
466
+ declare type DictTuples<V extends Record<string, any>> = DictValues<{
467
+ [K in keyof V]: [K, V[K]];
468
+ }>;
469
+ declare type VariantDefTuple<V> = DictTuples<VariantArgsChoices<V>>;
470
+ declare type DistributeTuple<T> = T extends [infer T1, infer T2] ? {
471
+ group: T1;
472
+ variant: T2;
473
+ } : never;
474
+ declare type VariantDef<V> = DistributeTuple<VariantDefTuple<V>>;
475
+ declare type PlasmicClass<V extends Record<string, any>, A extends Record<string, any>, O extends Record<string, any>> = {
476
+ (props: {
477
+ variants?: V;
478
+ args?: A;
479
+ overrides?: O;
480
+ }): React.ReactElement | null;
481
+ internalVariantProps: (keyof V)[];
482
+ internalArgProps: (keyof A)[];
483
+ };
484
+ declare type AnyPlasmicClass = PlasmicClass<any, any, any>;
485
+ declare type PlasmicClassVariants<C extends AnyPlasmicClass> = C extends PlasmicClass<infer V, any, any> ? V : unknown;
486
+ declare type PlasmicClassArgs<C extends AnyPlasmicClass> = C extends PlasmicClass<any, infer A, any> ? A : unknown;
487
+ declare type PlasmicClassOverrides<C extends AnyPlasmicClass> = C extends PlasmicClass<any, any, infer O> ? O : unknown;
488
+
489
+ interface CommonProps {
490
+ showStartIcon?: boolean;
491
+ showEndIcon?: boolean;
492
+ startIcon?: React.ReactNode;
493
+ endIcon?: React.ReactNode;
494
+ children?: React.ReactNode;
495
+ isDisabled?: boolean;
496
+ }
497
+ interface HtmlButtonProps extends Omit<React.ComponentProps<"button">, "ref" | "disabled"> {
498
+ }
499
+ interface HtmlAnchorProps extends Omit<React.ComponentProps<"a">, "ref" | "href"> {
500
+ link?: string;
501
+ }
502
+ declare type BaseButtonProps = CommonProps & HtmlButtonProps & HtmlAnchorProps;
503
+ declare type HtmlAnchorOnlyProps = Exclude<keyof HtmlAnchorProps, keyof HtmlButtonProps>;
504
+ declare type HtmlButtonOnlyProps = Exclude<keyof HtmlButtonProps, keyof HtmlAnchorProps>;
505
+ declare type ButtonRef = React.Ref<HTMLButtonElement | HTMLAnchorElement>;
506
+ interface ButtonConfig<C extends AnyPlasmicClass> {
507
+ showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
508
+ showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;
509
+ isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
510
+ startIconSlot?: keyof PlasmicClassArgs<C>;
511
+ endIconSlot?: keyof PlasmicClassArgs<C>;
512
+ contentSlot: keyof PlasmicClassArgs<C>;
513
+ root: keyof PlasmicClassOverrides<C>;
514
+ }
515
+ declare function useButton<P extends BaseButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: ButtonConfig<C>, ref?: ButtonRef): {
516
+ plasmicProps: {
517
+ variants: PlasmicClassVariants<C>;
518
+ args: PlasmicClassArgs<C>;
519
+ overrides: PlasmicClassOverrides<C>;
520
+ };
521
+ };
522
+
512
523
  /*
513
524
  * Copyright 2020 Adobe. All rights reserved.
514
525
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1182,12 +1193,14 @@ declare function useTriggeredOverlay<P extends BaseTriggeredOverlayProps, C exte
1182
1193
  };
1183
1194
  };
1184
1195
 
1196
+ declare type InitFunc<T> = ($props: Record<string, any>, $state: $State) => T;
1185
1197
  interface $State {
1186
1198
  [key: string]: any;
1199
+ registerInitFunc: (path: string, f: InitFunc<any>) => any;
1187
1200
  }
1188
1201
  interface $StateSpec<T> {
1189
1202
  path: string;
1190
- initFunc?: ($props: Record<string, any>, $state: $State) => T;
1203
+ initFunc?: InitFunc<T>;
1191
1204
  initVal?: T;
1192
1205
  type: "private" | "readonly" | "writable";
1193
1206
  valueProp?: string;
@@ -15,7 +15,7 @@ export declare function useMenuTrigger(opts: {
15
15
  menuWidth?: number;
16
16
  menu: React.ReactElement<BaseMenuProps> | (() => React.ReactElement<BaseMenuProps>);
17
17
  }, state: MenuTriggerState): {
18
- triggerProps: React.HTMLAttributes<HTMLElement>;
18
+ triggerProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
19
19
  makeMenu: () => React.ReactElement<BaseMenuProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
20
20
  triggerContext: TriggeredOverlayContextValue;
21
21
  };