@plasmicapp/react-web 0.2.104 → 0.2.107

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 (77) hide show
  1. package/dist/all.d.ts +379 -3
  2. package/dist/index-common.d.ts +2 -1
  3. package/dist/plume/select/index.d.ts +1 -0
  4. package/dist/plume/triggered-overlay/index.d.ts +1 -0
  5. package/dist/plume/triggered-overlay/triggered-overlay.d.ts +1 -1
  6. package/dist/react-web.cjs.development.js +90 -3
  7. package/dist/react-web.cjs.development.js.map +1 -1
  8. package/dist/react-web.cjs.production.min.js +1 -1
  9. package/dist/react-web.cjs.production.min.js.map +1 -1
  10. package/dist/react-web.esm.js +88 -5
  11. package/dist/react-web.esm.js.map +1 -1
  12. package/dist/render/PlasmicHead.d.ts +35 -0
  13. package/dist/render/ssr.d.ts +2 -1
  14. package/package.json +1 -1
  15. package/skinny/dist/collection-utils-3487dd27.js +238 -0
  16. package/skinny/dist/collection-utils-3487dd27.js.map +1 -0
  17. package/skinny/dist/collection-utils-47e89cbe.js +238 -0
  18. package/skinny/dist/collection-utils-47e89cbe.js.map +1 -0
  19. package/skinny/dist/collection-utils-4dae6efa.js +292 -0
  20. package/skinny/dist/collection-utils-4dae6efa.js.map +1 -0
  21. package/skinny/dist/collection-utils-57ec40f9.js +292 -0
  22. package/skinny/dist/collection-utils-57ec40f9.js.map +1 -0
  23. package/skinny/dist/collection-utils-96cde83c.js +238 -0
  24. package/skinny/dist/collection-utils-96cde83c.js.map +1 -0
  25. package/skinny/dist/collection-utils-b0b8f30e.js +291 -0
  26. package/skinny/dist/collection-utils-b0b8f30e.js.map +1 -0
  27. package/skinny/dist/index-common.d.ts +2 -1
  28. package/skinny/dist/index.js +2 -2
  29. package/skinny/dist/index.js.map +1 -1
  30. package/skinny/dist/plume/checkbox/index.js +1 -1
  31. package/skinny/dist/plume/menu/index.js +1 -1
  32. package/skinny/dist/plume/menu-button/index.js +1 -1
  33. package/skinny/dist/plume/select/index.d.ts +1 -0
  34. package/skinny/dist/plume/select/index.js +2 -2
  35. package/skinny/dist/plume/select/index.js.map +1 -1
  36. package/skinny/dist/plume/switch/index.js +1 -1
  37. package/skinny/dist/plume/triggered-overlay/index.d.ts +1 -0
  38. package/skinny/dist/plume/triggered-overlay/index.js +4 -2
  39. package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
  40. package/skinny/dist/plume/triggered-overlay/triggered-overlay.d.ts +1 -1
  41. package/skinny/dist/plume-utils-5c413fd1.js +35 -0
  42. package/skinny/dist/plume-utils-5c413fd1.js.map +1 -0
  43. package/skinny/dist/props-utils-4633caf6.js +8 -0
  44. package/skinny/dist/props-utils-4633caf6.js.map +1 -0
  45. package/skinny/dist/props-utils-5c0ad25a.js +59 -0
  46. package/skinny/dist/props-utils-5c0ad25a.js.map +1 -0
  47. package/skinny/dist/props-utils-754f655a.js +39 -0
  48. package/skinny/dist/props-utils-754f655a.js.map +1 -0
  49. package/skinny/dist/props-utils-c632595f.js +59 -0
  50. package/skinny/dist/props-utils-c632595f.js.map +1 -0
  51. package/skinny/dist/props-utils-fd5f444e.js +59 -0
  52. package/skinny/dist/props-utils-fd5f444e.js.map +1 -0
  53. package/skinny/dist/react-utils-118d8539.js +190 -0
  54. package/skinny/dist/react-utils-118d8539.js.map +1 -0
  55. package/skinny/dist/react-utils-2a2fd6c9.js +339 -0
  56. package/skinny/dist/react-utils-2a2fd6c9.js.map +1 -0
  57. package/skinny/dist/react-utils-2d70bbbe.js +172 -0
  58. package/skinny/dist/react-utils-2d70bbbe.js.map +1 -0
  59. package/skinny/dist/react-utils-675565b4.js +334 -0
  60. package/skinny/dist/react-utils-675565b4.js.map +1 -0
  61. package/skinny/dist/render/PlasmicHead.d.ts +35 -0
  62. package/skinny/dist/render/PlasmicImg.d.ts +62 -0
  63. package/skinny/dist/render/ssr.d.ts +2 -1
  64. package/skinny/dist/ssr-64e38713.js +108 -0
  65. package/skinny/dist/ssr-64e38713.js.map +1 -0
  66. package/skinny/dist/ssr-902d1292.js +105 -0
  67. package/skinny/dist/ssr-902d1292.js.map +1 -0
  68. package/skinny/dist/ssr-9ebd98ed.js +158 -0
  69. package/skinny/dist/ssr-9ebd98ed.js.map +1 -0
  70. package/skinny/dist/ssr-a8081074.js +108 -0
  71. package/skinny/dist/ssr-a8081074.js.map +1 -0
  72. package/skinny/dist/ssr-d2fd94f2.js +31 -0
  73. package/skinny/dist/ssr-d2fd94f2.js.map +1 -0
  74. package/skinny/dist/tslib.es6-00014098.js +148 -0
  75. package/skinny/dist/tslib.es6-00014098.js.map +1 -0
  76. package/skinny/dist/tslib.es6-73236e8e.js +141 -0
  77. package/skinny/dist/tslib.es6-73236e8e.js.map +1 -0
package/dist/all.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties, FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent, ReactNode } from 'react';
2
+ import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties, Key, ReactNode, ReactElement, FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent } 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
@@ -82,6 +82,39 @@ declare function deriveRenderOpts(props: Record<string, any>, config: {
82
82
 
83
83
  declare function ensureGlobalVariants<T extends Record<string, any>>(globalVariantValues: T): T;
84
84
 
85
+ declare type PlasmicHeadProps = {
86
+ title?: string;
87
+ description?: string;
88
+ image?: string;
89
+ canonical?: string;
90
+ };
91
+ declare function PlasmicHead(props: PlasmicHeadProps): JSX.Element | null;
92
+ declare const plasmicHeadMeta: {
93
+ name: string;
94
+ displayName: string;
95
+ description: string;
96
+ importName: string;
97
+ importPath: string;
98
+ props: {
99
+ title: {
100
+ type: string;
101
+ displayName: string;
102
+ };
103
+ description: {
104
+ type: string;
105
+ displayName: string;
106
+ };
107
+ image: {
108
+ type: string;
109
+ displayName: string;
110
+ };
111
+ canonical: {
112
+ type: string;
113
+ displayName: string;
114
+ };
115
+ };
116
+ };
117
+
85
118
  declare function PlasmicIcon(props: React.ComponentProps<"svg"> & {
86
119
  PlasmicIconType: React.ComponentType;
87
120
  }): JSX.Element;
@@ -213,6 +246,7 @@ interface PlasmicRootProviderProps {
213
246
  platform?: "nextjs" | "gatsby";
214
247
  children?: React.ReactNode;
215
248
  translator?: PlasmicTranslator;
249
+ Head?: React.ComponentType<any>;
216
250
  }
217
251
  declare function PlasmicRootProvider(props: PlasmicRootProviderProps): JSX.Element;
218
252
  declare const useIsSSR: typeof useIsSSR$1;
@@ -386,6 +420,104 @@ interface InputBase {
386
420
  */
387
421
 
388
422
 
423
+ type SelectionMode = 'none' | 'single' | 'multiple';
424
+ type SelectionBehavior = 'toggle' | 'replace';
425
+ type Selection = 'all' | Set<Key>;
426
+
427
+ type FocusStrategy = 'first' | 'last';
428
+ type DisabledBehavior = 'selection' | 'all';
429
+
430
+ /*
431
+ * Copyright 2020 Adobe. All rights reserved.
432
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
433
+ * you may not use this file except in compliance with the License. You may obtain a copy
434
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
435
+ *
436
+ * Unless required by applicable law or agreed to in writing, software distributed under
437
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
438
+ * OF ANY KIND, either express or implied. See the License for the specific language
439
+ * governing permissions and limitations under the License.
440
+ */
441
+
442
+
443
+ /**
444
+ * A generic interface to access a readonly sequential
445
+ * collection of unique keyed items.
446
+ */
447
+ interface Collection<T> extends Iterable<T> {
448
+ /** The number of items in the collection. */
449
+ readonly size: number,
450
+
451
+ /** Iterate over all keys in the collection. */
452
+ getKeys(): Iterable<Key>,
453
+
454
+ /** Get an item by its key. */
455
+ getItem(key: Key): T,
456
+
457
+ /** Get an item by the index of its key. */
458
+ at(idx: number): T,
459
+
460
+ /** Get the key that comes before the given key in the collection. */
461
+ getKeyBefore(key: Key): Key | null,
462
+
463
+ /** Get the key that comes after the given key in the collection. */
464
+ getKeyAfter(key: Key): Key | null,
465
+
466
+ /** Get the first key in the collection. */
467
+ getFirstKey(): Key | null,
468
+
469
+ /** Get the last key in the collection. */
470
+ getLastKey(): Key | null
471
+ }
472
+
473
+ interface Node<T> {
474
+ /** The type of item this node represents. */
475
+ type: string,
476
+ /** A unique key for the node. */
477
+ key: Key,
478
+ /** The object value the node was created from. */
479
+ value: T,
480
+ /** The level of depth this node is at in the heirarchy. */
481
+ level: number,
482
+ /** Whether this item has children, even if not loaded yet. */
483
+ hasChildNodes: boolean,
484
+ /** The loaded children of this node. */
485
+ childNodes: Iterable<Node<T>>,
486
+ /** The rendered contents of this node (e.g. JSX). */
487
+ rendered: ReactNode,
488
+ /** A string value for this node, used for features like typeahead. */
489
+ textValue: string,
490
+ /** An accessibility label for this node. */
491
+ 'aria-label'?: string,
492
+ /** The index of this node within its parent. */
493
+ index?: number,
494
+ /** A function that should be called to wrap the rendered node. */
495
+ wrapper?: (element: ReactElement) => ReactElement,
496
+ /** The key of the parent node. */
497
+ parentKey?: Key,
498
+ /** The key of the node before this node. */
499
+ prevKey?: Key,
500
+ /** The key of the node after this node. */
501
+ nextKey?: Key,
502
+ /** Additional properties specific to a particular node type. */
503
+ props?: any,
504
+ /** @private */
505
+ shouldInvalidate?: (context: unknown) => boolean
506
+ }
507
+
508
+ /*
509
+ * Copyright 2020 Adobe. All rights reserved.
510
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
511
+ * you may not use this file except in compliance with the License. You may obtain a copy
512
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
513
+ *
514
+ * Unless required by applicable law or agreed to in writing, software distributed under
515
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
516
+ * OF ANY KIND, either express or implied. See the License for the specific language
517
+ * governing permissions and limitations under the License.
518
+ */
519
+
520
+
389
521
  // Event bubbling can be problematic in real-world applications, so the default for React Spectrum components
390
522
  // is not to propagate. This can be overridden by calling continuePropagation() on the event.
391
523
  type BaseEvent<T extends SyntheticEvent> = T & {
@@ -396,6 +528,30 @@ type BaseEvent<T extends SyntheticEvent> = T & {
396
528
 
397
529
  type KeyboardEvent = BaseEvent<KeyboardEvent$1<any>>;
398
530
 
531
+ type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';
532
+
533
+ interface PressEvent {
534
+ /** The type of press event being fired. */
535
+ type: 'pressstart' | 'pressend' | 'pressup' | 'press',
536
+ /** The pointer type that triggered the press event. */
537
+ pointerType: PointerType,
538
+ /** The target element of the press event. */
539
+ target: Element,
540
+ /** Whether the shift keyboard modifier was held during the press event. */
541
+ shiftKey: boolean,
542
+ /** Whether the ctrl keyboard modifier was held during the press event. */
543
+ ctrlKey: boolean,
544
+ /** Whether the meta keyboard modifier was held during the press event. */
545
+ metaKey: boolean,
546
+ /** Whether the alt keyboard modifier was held during the press event. */
547
+ altKey: boolean
548
+ }
549
+
550
+ interface LongPressEvent extends Omit<PressEvent, 'type'> {
551
+ /** The type of long press event being fired. */
552
+ type: 'longpressstart' | 'longpressend' | 'longpress'
553
+ }
554
+
399
555
  interface KeyboardEvents {
400
556
  /** Handler that is called when a key is pressed. */
401
557
  onKeyDown?: (e: KeyboardEvent) => void,
@@ -1055,6 +1211,202 @@ declare function useSelectOptionGroup<P extends BaseSelectOptionGroupProps, C ex
1055
1211
  };
1056
1212
  };
1057
1213
 
1214
+ interface FocusState {
1215
+ /** Whether the collection is currently focused. */
1216
+ readonly isFocused: boolean;
1217
+ /** Sets whether the collection is focused. */
1218
+ setFocused(isFocused: boolean): void;
1219
+ /** The current focused key in the collection. */
1220
+ readonly focusedKey: Key;
1221
+ /** Whether the first or last child of the focused key should receive focus. */
1222
+ readonly childFocusStrategy: FocusStrategy;
1223
+ /** Sets the focused key, and optionally, whether the first or last child of that key should receive focus. */
1224
+ setFocusedKey(key: Key, child?: FocusStrategy): void;
1225
+ }
1226
+ interface MultipleSelectionState extends FocusState {
1227
+ /** The type of selection that is allowed in the collection. */
1228
+ readonly selectionMode: SelectionMode;
1229
+ /** The selection behavior for the collection. */
1230
+ readonly selectionBehavior: SelectionBehavior;
1231
+ /** Sets the selection behavior for the collection. */
1232
+ setSelectionBehavior(selectionBehavior: SelectionBehavior): void;
1233
+ /** Whether the collection allows empty selection. */
1234
+ readonly disallowEmptySelection: boolean;
1235
+ /** The currently selected keys in the collection. */
1236
+ readonly selectedKeys: Selection;
1237
+ /** Sets the selected keys in the collection. */
1238
+ setSelectedKeys(keys: Selection): void;
1239
+ /** The currently disabled keys in the collection. */
1240
+ readonly disabledKeys: Set<Key>;
1241
+ /** Whether `disabledKeys` applies to selection, actions, or both. */
1242
+ readonly disabledBehavior: DisabledBehavior;
1243
+ }
1244
+ interface MultipleSelectionManager extends FocusState {
1245
+ /** The type of selection that is allowed in the collection. */
1246
+ readonly selectionMode: SelectionMode;
1247
+ /** The selection behavior for the collection. */
1248
+ readonly selectionBehavior: SelectionBehavior;
1249
+ /** Whether the collection allows empty selection. */
1250
+ readonly disallowEmptySelection?: boolean;
1251
+ /** The currently selected keys in the collection. */
1252
+ readonly selectedKeys: Set<Key>;
1253
+ /** Whether the selection is empty. */
1254
+ readonly isEmpty: boolean;
1255
+ /** Whether all items in the collection are selected. */
1256
+ readonly isSelectAll: boolean;
1257
+ /** The first selected key in the collection. */
1258
+ readonly firstSelectedKey: Key | null;
1259
+ /** The last selected key in the collection. */
1260
+ readonly lastSelectedKey: Key | null;
1261
+ /** The currently disabled keys in the collection. */
1262
+ readonly disabledKeys: Set<Key>;
1263
+ /** Whether `disabledKeys` applies to selection, actions, or both. */
1264
+ readonly disabledBehavior: DisabledBehavior;
1265
+ /** Returns whether a key is selected. */
1266
+ isSelected(key: Key): boolean;
1267
+ /** Returns whether the current selection is equal to the given selection. */
1268
+ isSelectionEqual(selection: Set<Key>): boolean;
1269
+ /** Extends the selection to the given key. */
1270
+ extendSelection(toKey: Key): void;
1271
+ /** Toggles whether the given key is selected. */
1272
+ toggleSelection(key: Key): void;
1273
+ /** Replaces the selection with only the given key. */
1274
+ replaceSelection(key: Key): void;
1275
+ /** Replaces the selection with the given keys. */
1276
+ setSelectedKeys(keys: Iterable<Key>): void;
1277
+ /** Selects all items in the collection. */
1278
+ selectAll(): void;
1279
+ /** Removes all keys from the selection. */
1280
+ clearSelection(): void;
1281
+ /** Toggles between select all and an empty selection. */
1282
+ toggleSelectAll(): void;
1283
+ /**
1284
+ * Toggles, replaces, or extends selection to the given key depending
1285
+ * on the pointer event and collection's selection mode.
1286
+ */
1287
+ select(key: Key, e?: PressEvent | LongPressEvent | PointerEvent): void;
1288
+ /** Returns whether the given key can be selected. */
1289
+ canSelectItem(key: Key): boolean;
1290
+ /** Returns whether the given key is non-interactive, i.e. both selection and actions are disabled. */
1291
+ isDisabled(key: Key): boolean;
1292
+ /** Sets the selection behavior for the collection. */
1293
+ setSelectionBehavior(selectionBehavior: SelectionBehavior): void;
1294
+ }
1295
+ interface SelectionManagerOptions {
1296
+ allowsCellSelection?: boolean;
1297
+ }
1298
+ /**
1299
+ * An interface for reading and updating multiple selection state.
1300
+ */
1301
+ declare class SelectionManager implements MultipleSelectionManager {
1302
+ constructor(collection: Collection<Node<unknown>>, state: MultipleSelectionState, options?: SelectionManagerOptions);
1303
+ /**
1304
+ * The type of selection that is allowed in the collection.
1305
+ */
1306
+ get selectionMode(): SelectionMode;
1307
+ /**
1308
+ * Whether the collection allows empty selection.
1309
+ */
1310
+ get disallowEmptySelection(): boolean;
1311
+ /**
1312
+ * The selection behavior for the collection.
1313
+ */
1314
+ get selectionBehavior(): SelectionBehavior;
1315
+ /**
1316
+ * Sets the selection behavior for the collection.
1317
+ */
1318
+ setSelectionBehavior(selectionBehavior: SelectionBehavior): void;
1319
+ /**
1320
+ * Whether the collection is currently focused.
1321
+ */
1322
+ get isFocused(): boolean;
1323
+ /**
1324
+ * Sets whether the collection is focused.
1325
+ */
1326
+ setFocused(isFocused: boolean): void;
1327
+ /**
1328
+ * The current focused key in the collection.
1329
+ */
1330
+ get focusedKey(): Key;
1331
+ /** Whether the first or last child of the focused key should receive focus. */
1332
+ get childFocusStrategy(): FocusStrategy;
1333
+ /**
1334
+ * Sets the focused key.
1335
+ */
1336
+ setFocusedKey(key: Key, childFocusStrategy?: FocusStrategy): void;
1337
+ /**
1338
+ * The currently selected keys in the collection.
1339
+ */
1340
+ get selectedKeys(): Set<Key>;
1341
+ /**
1342
+ * The raw selection value for the collection.
1343
+ * Either 'all' for select all, or a set of keys.
1344
+ */
1345
+ get rawSelection(): Selection;
1346
+ /**
1347
+ * Returns whether a key is selected.
1348
+ */
1349
+ isSelected(key: Key): boolean;
1350
+ /**
1351
+ * Whether the selection is empty.
1352
+ */
1353
+ get isEmpty(): boolean;
1354
+ /**
1355
+ * Whether all items in the collection are selected.
1356
+ */
1357
+ get isSelectAll(): boolean;
1358
+ get firstSelectedKey(): Key | null;
1359
+ get lastSelectedKey(): Key | null;
1360
+ get disabledKeys(): Set<Key>;
1361
+ get disabledBehavior(): DisabledBehavior;
1362
+ /**
1363
+ * Extends the selection to the given key.
1364
+ */
1365
+ extendSelection(toKey: Key): void;
1366
+ /**
1367
+ * Toggles whether the given key is selected.
1368
+ */
1369
+ toggleSelection(key: Key): void;
1370
+ /**
1371
+ * Replaces the selection with only the given key.
1372
+ */
1373
+ replaceSelection(key: Key): void;
1374
+ /**
1375
+ * Replaces the selection with the given keys.
1376
+ */
1377
+ setSelectedKeys(keys: Iterable<Key>): void;
1378
+ /**
1379
+ * Selects all items in the collection.
1380
+ */
1381
+ selectAll(): void;
1382
+ /**
1383
+ * Removes all keys from the selection.
1384
+ */
1385
+ clearSelection(): void;
1386
+ /**
1387
+ * Toggles between select all and an empty selection.
1388
+ */
1389
+ toggleSelectAll(): void;
1390
+ select(key: Key, e?: PressEvent | LongPressEvent | PointerEvent): void;
1391
+ /**
1392
+ * Returns whether the current selection is equal to the given selection.
1393
+ */
1394
+ isSelectionEqual(selection: Set<Key>): boolean;
1395
+ canSelectItem(key: Key): boolean;
1396
+ isDisabled(key: Key): boolean;
1397
+ }
1398
+
1399
+ interface ListState<T> {
1400
+ /** A collection of items in the list. */
1401
+ collection: Collection<Node<T>>;
1402
+ /** A set of items that are disabled. */
1403
+ disabledKeys: Set<Key>;
1404
+ /** A selection manager to read and update multiple selection state. */
1405
+ selectionManager: SelectionManager;
1406
+ }
1407
+
1408
+ declare const SelectContext: React.Context<ListState<any> | undefined>;
1409
+
1058
1410
  /*
1059
1411
  * Copyright 2020 Adobe. All rights reserved.
1060
1412
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1185,7 +1537,7 @@ interface TriggeredOverlayConfig<C extends AnyPlasmicClass> {
1185
1537
  contentContainer: keyof PlasmicClassOverrides<C>;
1186
1538
  }
1187
1539
  declare type TriggeredOverlayRef = React.Ref<HTMLElement>;
1188
- declare function useTriggeredOverlay<P extends BaseTriggeredOverlayProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: TriggeredOverlayConfig<C>, outerRef?: TriggeredOverlayRef): {
1540
+ declare function useTriggeredOverlay<P extends BaseTriggeredOverlayProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: TriggeredOverlayConfig<C>, outerRef?: TriggeredOverlayRef, isDismissable?: boolean): {
1189
1541
  plasmicProps: {
1190
1542
  variants: PlasmicClassVariants<C>;
1191
1543
  args: PlasmicClassArgs<C>;
@@ -1193,6 +1545,30 @@ declare function useTriggeredOverlay<P extends BaseTriggeredOverlayProps, C exte
1193
1545
  };
1194
1546
  };
1195
1547
 
1548
+ interface OverlayTriggerState {
1549
+ /** Whether the overlay is currently open. */
1550
+ readonly isOpen: boolean;
1551
+ /** Sets whether the overlay is open. */
1552
+ setOpen(isOpen: boolean): void;
1553
+ /** Opens the overlay. */
1554
+ open(): void;
1555
+ /** Closes the overlay. */
1556
+ close(): void;
1557
+ /** Toggles the overlay's visibility. */
1558
+ toggle(): void;
1559
+ }
1560
+
1561
+ interface TriggeredOverlayContextValue {
1562
+ triggerRef: React.RefObject<HTMLElement>;
1563
+ state: OverlayTriggerState;
1564
+ autoFocus?: boolean | FocusStrategy;
1565
+ placement?: Placement;
1566
+ overlayMatchTriggerWidth?: boolean;
1567
+ overlayMinTriggerWidth?: boolean;
1568
+ overlayWidth?: number;
1569
+ }
1570
+ declare const TriggeredOverlayContext: React.Context<TriggeredOverlayContextValue | undefined>;
1571
+
1196
1572
  declare type InitFunc<T> = ($props: Record<string, any>, $state: $State) => T;
1197
1573
  interface $State {
1198
1574
  [key: string]: any;
@@ -1217,4 +1593,4 @@ declare function generateStateOnChangeProp($state: $State, stateName: string, da
1217
1593
  */
1218
1594
  declare function generateStateValueProp($state: $State, path: (string | number)[]): any;
1219
1595
 
1220
- 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, Trans, TriggeredOverlayConfig, TriggeredOverlayRef, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, getDataProps, hasVariant, makeFragment, omit, pick, renderPlasmicSlot, setPlumeStrictMode, useButton, useCheckbox, useVanillaDollarState as useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
1596
+ 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, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, SelectContext, SelectOptionRef, SelectRef, SelectRefValue, SingleBooleanChoiceArg, SingleChoiceArg, Stack, StrictProps, SwitchProps, SwitchRef, SwitchRefValue, TextInputRef, TextInputRefValue, Trans, TriggeredOverlayConfig, TriggeredOverlayContext, TriggeredOverlayRef, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, getDataProps, hasVariant, makeFragment, omit, pick, plasmicHeadMeta, renderPlasmicSlot, setPlumeStrictMode, useButton, useCheckbox, useVanillaDollarState as useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
@@ -3,6 +3,7 @@ export { omit, pick } from "./common";
3
3
  export { HTMLElementRefOf, StrictProps } from "./react-utils";
4
4
  export { createPlasmicElementProxy, deriveRenderOpts, Flex, hasVariant, makeFragment, MultiChoiceArg, SingleBooleanChoiceArg, SingleChoiceArg, wrapWithClassName, } from "./render/elements";
5
5
  export { ensureGlobalVariants } from "./render/global-variants";
6
+ export { PlasmicHead, plasmicHeadMeta } from "./render/PlasmicHead";
6
7
  export { PlasmicIcon } from "./render/PlasmicIcon";
7
8
  export { PlasmicImg } from "./render/PlasmicImg";
8
9
  export { PlasmicLink } from "./render/PlasmicLink";
@@ -10,5 +11,5 @@ export { PlasmicSlot, renderPlasmicSlot } from "./render/PlasmicSlot";
10
11
  export { createUseScreenVariants } from "./render/screen-variants";
11
12
  export { PlasmicRootProvider, useIsSSR } from "./render/ssr";
12
13
  export { Stack } from "./render/Stack";
14
+ export { genTranslatableString, Trans } from "./render/translation";
13
15
  export { useTrigger } from "./render/triggers";
14
- export { Trans, genTranslatableString } from "./render/translation";
@@ -1,3 +1,4 @@
1
1
  export { BaseSelectProps, SelectRef, SelectRefValue, useSelect, } from "./select";
2
2
  export { BaseSelectOptionProps, SelectOptionRef, useSelectOption, } from "./select-option";
3
3
  export { BaseSelectOptionGroupProps, useSelectOptionGroup, } from "./select-option-group";
4
+ export { SelectContext } from "./context";
@@ -1 +1,2 @@
1
1
  export { BaseTriggeredOverlayProps, TriggeredOverlayConfig, TriggeredOverlayRef, useTriggeredOverlay, } from "./triggered-overlay";
2
+ export { TriggeredOverlayContext } from "./context";
@@ -15,7 +15,7 @@ export interface TriggeredOverlayConfig<C extends AnyPlasmicClass> {
15
15
  contentContainer: keyof PlasmicClassOverrides<C>;
16
16
  }
17
17
  export declare type TriggeredOverlayRef = React.Ref<HTMLElement>;
18
- export declare function useTriggeredOverlay<P extends BaseTriggeredOverlayProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: TriggeredOverlayConfig<C>, outerRef?: TriggeredOverlayRef): {
18
+ export declare function useTriggeredOverlay<P extends BaseTriggeredOverlayProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: TriggeredOverlayConfig<C>, outerRef?: TriggeredOverlayRef, isDismissable?: boolean): {
19
19
  plasmicProps: {
20
20
  variants: PlasmicClassVariants<C>;
21
21
  args: PlasmicClassArgs<C>;
@@ -811,6 +811,83 @@ function ensureGlobalVariants(globalVariantValues) {
811
811
  return globalVariantValues;
812
812
  }
813
813
 
814
+ var PlasmicHeadContext = /*#__PURE__*/React.createContext(undefined);
815
+ function PlasmicHead(props) {
816
+ var Head = React.useContext(PlasmicHeadContext);
817
+
818
+ if (!Head) {
819
+ console.warn("Plasmic: Head meta tags are being ignored. To make them work, pass a Head component into PlasmicRootProvider."); // TODO: Link to doc about Head.
820
+
821
+ return null;
822
+ }
823
+
824
+ return React.createElement(Head, null, props.image ? React.createElement(React.Fragment, null, React.createElement("meta", {
825
+ name: "twitter:card",
826
+ content: "summary_large_image"
827
+ }), React.createElement("meta", {
828
+ key: "og:image",
829
+ property: "og:image",
830
+ content: props.image
831
+ }), React.createElement("meta", {
832
+ key: "twitter:image",
833
+ name: "twitter:image",
834
+ content: props.image
835
+ })) : React.createElement("meta", {
836
+ name: "twitter:card",
837
+ content: "summary"
838
+ }), props.title && React.createElement(React.Fragment, null, React.createElement("title", {
839
+ key: "title"
840
+ }, props.title), React.createElement("meta", {
841
+ key: "og:title",
842
+ property: "og:title",
843
+ content: props.title
844
+ }), React.createElement("meta", {
845
+ key: "twitter:title",
846
+ property: "twitter:title",
847
+ content: props.title
848
+ })), props.description && React.createElement(React.Fragment, null, React.createElement("meta", {
849
+ key: "description",
850
+ name: "description",
851
+ content: props.description
852
+ }), React.createElement("meta", {
853
+ key: "og:description",
854
+ property: "og:description",
855
+ content: props.description
856
+ }), React.createElement("meta", {
857
+ key: "twitter:description",
858
+ name: "twitter:description",
859
+ content: props.description
860
+ })), props.canonical && React.createElement("link", {
861
+ ref: "canonical",
862
+ href: props.canonical
863
+ }));
864
+ }
865
+ var plasmicHeadMeta = {
866
+ name: "hostless-plasmic-head",
867
+ displayName: "Head",
868
+ description: "Used to add page metadata to HEAD tag",
869
+ importName: "PlasmicHead",
870
+ importPath: "@plasmicapp/react-web",
871
+ props: {
872
+ title: {
873
+ type: "string",
874
+ displayName: "Title"
875
+ },
876
+ description: {
877
+ type: "string",
878
+ displayName: "Description"
879
+ },
880
+ image: {
881
+ type: "imageUrl",
882
+ displayName: "Image"
883
+ },
884
+ canonical: {
885
+ type: "string",
886
+ displayName: "Canonical URL"
887
+ }
888
+ }
889
+ };
890
+
814
891
  function PlasmicIcon(props) {
815
892
  var PlasmicIconType = props.PlasmicIconType,
816
893
  rest = _objectWithoutPropertiesLoose(props, ["PlasmicIconType"]);
@@ -1464,7 +1541,9 @@ function PlasmicRootProvider(props) {
1464
1541
  value: context
1465
1542
  }, React.createElement(ssr.SSRProvider, null, React.createElement(PlasmicTranslatorContext.Provider, {
1466
1543
  value: props.translator
1467
- }, children)));
1544
+ }, React.createElement(PlasmicHeadContext.Provider, {
1545
+ value: props.Head
1546
+ }, children))));
1468
1547
  }
1469
1548
  var useIsSSR = ssr.useIsSSR;
1470
1549
  function useHasPlasmicRoot() {
@@ -3001,13 +3080,17 @@ function useTextInput(plasmicClass, props, config, ref) {
3001
3080
  };
3002
3081
  }
3003
3082
 
3004
- function useTriggeredOverlay(plasmicClass, props, config, outerRef) {
3083
+ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissable) {
3005
3084
  var _extends2, _overrides;
3006
3085
 
3007
3086
  if (outerRef === void 0) {
3008
3087
  outerRef = null;
3009
3088
  }
3010
3089
 
3090
+ if (isDismissable === void 0) {
3091
+ isDismissable = true;
3092
+ }
3093
+
3011
3094
  var overlayRef = React.useRef(null);
3012
3095
  var onOverlayRef = mergeRefs(overlayRef, outerRef);
3013
3096
  var context = React.useContext(TriggeredOverlayContext);
@@ -3045,7 +3128,7 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef) {
3045
3128
  var _useOverlay = overlays.useOverlay({
3046
3129
  isOpen: state.isOpen,
3047
3130
  onClose: state.close,
3048
- isDismissable: true,
3131
+ isDismissable: isDismissable,
3049
3132
  shouldCloseOnBlur: true
3050
3133
  }, overlayRef),
3051
3134
  overlayAriaProps = _useOverlay.overlayProps;
@@ -3595,13 +3678,16 @@ function fillUninitializedStateValues(specs, props, stateValues, states) {
3595
3678
  }
3596
3679
 
3597
3680
  exports.DropdownMenu = DropdownMenu;
3681
+ exports.PlasmicHead = PlasmicHead;
3598
3682
  exports.PlasmicIcon = PlasmicIcon;
3599
3683
  exports.PlasmicImg = PlasmicImg;
3600
3684
  exports.PlasmicLink = PlasmicLink;
3601
3685
  exports.PlasmicRootProvider = PlasmicRootProvider;
3602
3686
  exports.PlasmicSlot = PlasmicSlot;
3687
+ exports.SelectContext = SelectContext;
3603
3688
  exports.Stack = Stack;
3604
3689
  exports.Trans = Trans;
3690
+ exports.TriggeredOverlayContext = TriggeredOverlayContext;
3605
3691
  exports.classNames = classNames;
3606
3692
  exports.createPlasmicElementProxy = createPlasmicElementProxy;
3607
3693
  exports.createUseScreenVariants = createUseScreenVariants;
@@ -3615,6 +3701,7 @@ exports.hasVariant = hasVariant;
3615
3701
  exports.makeFragment = makeFragment;
3616
3702
  exports.omit = omit;
3617
3703
  exports.pick = pick;
3704
+ exports.plasmicHeadMeta = plasmicHeadMeta;
3618
3705
  exports.renderPlasmicSlot = renderPlasmicSlot;
3619
3706
  exports.setPlumeStrictMode = setPlumeStrictMode;
3620
3707
  exports.useButton = useButton;