@plasmicapp/react-web 0.2.384 → 0.2.387

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/all.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import * as React$1 from 'react';
3
- import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties as CSSProperties$1, ReactNode, ReactElement, FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent } from 'react';
3
+ import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$2, AriaRole, CSSProperties as CSSProperties$1, FocusEvent, KeyboardEvent as KeyboardEvent$3, SyntheticEvent, ReactNode, ReactElement } from 'react';
4
4
 
5
5
  declare global {
6
6
  interface Window {
@@ -12183,7 +12183,11 @@ type ControlContext<P> = [
12183
12183
  /**
12184
12184
  * props
12185
12185
  */
12186
- P
12186
+ P,
12187
+ /**
12188
+ * context data
12189
+ */
12190
+ any
12187
12191
  ];
12188
12192
  /**
12189
12193
  * Config option that takes the context (e.g., props) of the function call
@@ -12356,6 +12360,18 @@ interface CustomFunctionMeta<F extends (...args: any[]) => any> {
12356
12360
  * not specified, it's considered `false`.
12357
12361
  */
12358
12362
  isDefaultExport?: boolean;
12363
+ /**
12364
+ * A function that takes the function arguments and returns a data key
12365
+ * and a fetcher function.
12366
+ * The data key is used to cache the result of the fetcher, and should only
12367
+ * include the arguments that are used to fetch the data.
12368
+ * The result of the fetcher will be used as the context of the function
12369
+ * in studio and should return a promise.
12370
+ */
12371
+ fnContext?: (...args: Partial<Parameters<F>>) => {
12372
+ dataKey: string;
12373
+ fetcher: () => Promise<any>;
12374
+ };
12359
12375
  }
12360
12376
  interface CustomFunctionRegistration {
12361
12377
  function: (...args: any[]) => any;
@@ -12934,7 +12950,189 @@ declare function Trans({ transKey, children }: TransProps): React__default.React
12934
12950
 
12935
12951
 
12936
12952
 
12937
- interface AriaLabelingProps {
12953
+ /** Any focusable element, including both HTML and SVG elements. */
12954
+ interface FocusableElement$1 extends Element, HTMLOrSVGElement {}
12955
+
12956
+ /** All DOM attributes supported across both HTML and SVG elements. */
12957
+ interface DOMAttributes$1<T = FocusableElement$1> extends AriaAttributes, DOMAttributes$2<T> {
12958
+ id?: string | undefined,
12959
+ role?: AriaRole | undefined,
12960
+ tabIndex?: number | undefined,
12961
+ style?: CSSProperties$1 | undefined,
12962
+ className?: string | undefined
12963
+ }
12964
+
12965
+ /*
12966
+ * Copyright 2020 Adobe. All rights reserved.
12967
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12968
+ * you may not use this file except in compliance with the License. You may obtain a copy
12969
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12970
+ *
12971
+ * Unless required by applicable law or agreed to in writing, software distributed under
12972
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12973
+ * OF ANY KIND, either express or implied. See the License for the specific language
12974
+ * governing permissions and limitations under the License.
12975
+ */
12976
+
12977
+
12978
+
12979
+ /** Any focusable element, including both HTML and SVG elements. */
12980
+ interface FocusableElement extends Element, HTMLOrSVGElement {}
12981
+
12982
+ /** All DOM attributes supported across both HTML and SVG elements. */
12983
+ interface DOMAttributes<T = FocusableElement> extends AriaAttributes, DOMAttributes$2<T> {
12984
+ id?: string | undefined,
12985
+ role?: AriaRole | undefined,
12986
+ tabIndex?: number | undefined,
12987
+ style?: CSSProperties$1 | undefined,
12988
+ className?: string | undefined
12989
+ }
12990
+
12991
+ interface PressResult {
12992
+ /** Whether the target is currently pressed. */
12993
+ isPressed: boolean;
12994
+ /** Props to spread on the target element. */
12995
+ pressProps: DOMAttributes;
12996
+ }
12997
+ interface HoverResult {
12998
+ /** Props to spread on the target element. */
12999
+ hoverProps: DOMAttributes;
13000
+ isHovered: boolean;
13001
+ }
13002
+
13003
+ interface FocusRingAria {
13004
+ /** Whether the element is currently focused. */
13005
+ isFocused: boolean;
13006
+ /** Whether keyboard focus should be visible. */
13007
+ isFocusVisible: boolean;
13008
+ /** Props to apply to the container element with the focus ring. */
13009
+ focusProps: DOMAttributes$1;
13010
+ }
13011
+
13012
+ type FocusHookResult = [boolean, FocusRingAria["focusProps"]];
13013
+ type HoverHookResult = [boolean, HoverResult["hoverProps"]];
13014
+ type PressHookResult = [boolean, PressResult["pressProps"]];
13015
+ declare function useFocused(opts: {
13016
+ isTextInput?: boolean;
13017
+ }): FocusHookResult;
13018
+ declare function useFocusVisible(opts: {
13019
+ isTextInput?: boolean;
13020
+ }): FocusHookResult;
13021
+ declare function useFocusedWithin(opts: {
13022
+ isTextInput?: boolean;
13023
+ }): FocusHookResult;
13024
+ declare function useFocusVisibleWithin(opts: {
13025
+ isTextInput?: boolean;
13026
+ }): FocusHookResult;
13027
+ declare function useHover(): HoverHookResult;
13028
+ declare function usePressed(): PressHookResult;
13029
+ declare const TRIGGER_TO_HOOK: {
13030
+ readonly useHover: typeof useHover;
13031
+ readonly useFocused: typeof useFocused;
13032
+ readonly useFocusVisible: typeof useFocusVisible;
13033
+ readonly useFocusedWithin: typeof useFocusedWithin;
13034
+ readonly useFocusVisibleWithin: typeof useFocusVisibleWithin;
13035
+ readonly usePressed: typeof usePressed;
13036
+ };
13037
+ type TriggerType = keyof typeof TRIGGER_TO_HOOK;
13038
+ interface TriggerOpts {
13039
+ isTextInput?: boolean;
13040
+ }
13041
+ /**
13042
+ * Installs argment trigger. All the useTrigger calls must use hardcoded `trigger` arg,
13043
+ * as it's not valid to install variable React hooks!
13044
+ */
13045
+ declare function useTrigger(trigger: TriggerType, opts: TriggerOpts): [boolean, React$1.HTMLAttributes<HTMLElement>];
13046
+
13047
+ declare const classNames: any;
13048
+
13049
+ declare function setPlumeStrictMode(mode: boolean): void;
13050
+ type VariantArgChoices<T> = T extends (infer M)[] ? M : T extends SingleChoiceArg<infer M> ? M : never;
13051
+ type VariantArgsChoices<V> = {
13052
+ [k in keyof V]-?: VariantArgChoices<V[k]>;
13053
+ };
13054
+ type DictValues<V extends Record<string, any>> = V[keyof V];
13055
+ type DictTuples<V extends Record<string, any>> = DictValues<{
13056
+ [K in keyof V]: [K, V[K]];
13057
+ }>;
13058
+ type VariantDefTuple<V> = DictTuples<VariantArgsChoices<V>>;
13059
+ type DistributeTuple<T> = T extends [infer T1, infer T2] ? {
13060
+ group: T1;
13061
+ variant: T2;
13062
+ } : never;
13063
+ type VariantDef<V> = DistributeTuple<VariantDefTuple<V>>;
13064
+ type PlasmicClass<V extends Record<string, any>, A extends Record<string, any>, O extends Record<string, any>> = {
13065
+ (props: {
13066
+ variants?: V;
13067
+ args?: A;
13068
+ overrides?: O;
13069
+ }): React$1.ReactNode;
13070
+ internalVariantProps: (keyof V)[];
13071
+ internalArgProps: (keyof A)[];
13072
+ };
13073
+ type AnyPlasmicClass = PlasmicClass<any, any, any>;
13074
+ type PlasmicClassVariants<C extends AnyPlasmicClass> = C extends PlasmicClass<infer V, any, any> ? V : unknown;
13075
+ type PlasmicClassArgs<C extends AnyPlasmicClass> = C extends PlasmicClass<any, infer A, any> ? A : unknown;
13076
+ type PlasmicClassOverrides<C extends AnyPlasmicClass> = C extends PlasmicClass<any, any, infer O> ? O : unknown;
13077
+
13078
+ interface PlumeCommonProps {
13079
+ showStartIcon?: boolean;
13080
+ showEndIcon?: boolean;
13081
+ startIcon?: React$1.ReactNode;
13082
+ endIcon?: React$1.ReactNode;
13083
+ children?: React$1.ReactNode;
13084
+ isDisabled?: boolean;
13085
+ }
13086
+ interface HtmlButtonProps extends Omit<React$1.ComponentProps<"button">, "ref" | "disabled"> {
13087
+ }
13088
+ interface HtmlAnchorProps extends Omit<React$1.ComponentProps<"a">, "ref" | "href" | "target"> {
13089
+ }
13090
+ interface PlumeActualButtonProps {
13091
+ submitsForm?: boolean;
13092
+ }
13093
+ interface PlumeAnchorProps {
13094
+ link?: string;
13095
+ target?: React$1.ComponentProps<"a">["target"] | boolean;
13096
+ }
13097
+ type PlumeButtonProps = PlumeCommonProps & PlumeActualButtonProps & PlumeAnchorProps;
13098
+ type BaseButtonProps = PlumeButtonProps & HtmlButtonProps & HtmlAnchorProps;
13099
+ type AllButtonProps = PlumeCommonProps & PlumeActualButtonProps & HtmlButtonProps;
13100
+ type AllAnchorProps = PlumeCommonProps & PlumeAnchorProps & HtmlAnchorProps;
13101
+ type HtmlAnchorOnlyProps = Exclude<keyof AllAnchorProps, keyof AllButtonProps>;
13102
+ type HtmlButtonOnlyProps = Exclude<keyof AllButtonProps, keyof AllAnchorProps>;
13103
+ type ButtonRef = React$1.Ref<HTMLButtonElement | HTMLAnchorElement>;
13104
+ interface ButtonConfig<C extends AnyPlasmicClass> {
13105
+ showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
13106
+ showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;
13107
+ isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13108
+ startIconSlot?: keyof PlasmicClassArgs<C>;
13109
+ endIconSlot?: keyof PlasmicClassArgs<C>;
13110
+ contentSlot: keyof PlasmicClassArgs<C>;
13111
+ root: keyof PlasmicClassOverrides<C>;
13112
+ }
13113
+ declare function useButton<P extends PlumeButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: ButtonConfig<C>, ref?: ButtonRef): {
13114
+ plasmicProps: {
13115
+ variants: PlasmicClassVariants<C>;
13116
+ args: PlasmicClassArgs<C>;
13117
+ overrides: PlasmicClassOverrides<C>;
13118
+ };
13119
+ };
13120
+
13121
+ /*
13122
+ * Copyright 2020 Adobe. All rights reserved.
13123
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13124
+ * you may not use this file except in compliance with the License. You may obtain a copy
13125
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
13126
+ *
13127
+ * Unless required by applicable law or agreed to in writing, software distributed under
13128
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13129
+ * OF ANY KIND, either express or implied. See the License for the specific language
13130
+ * governing permissions and limitations under the License.
13131
+ */
13132
+
13133
+
13134
+
13135
+ interface AriaLabelingProps$2 {
12938
13136
  /**
12939
13137
  * Defines a string value that labels the current element.
12940
13138
  */
@@ -12966,14 +13164,14 @@ interface AriaValidationProps {
12966
13164
 
12967
13165
  // A set of common DOM props that are allowed on any component
12968
13166
  // Ensure this is synced with DOMPropNames in filterDOMProps
12969
- interface DOMProps {
13167
+ interface DOMProps$2 {
12970
13168
  /**
12971
13169
  * The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
12972
13170
  */
12973
13171
  id?: string
12974
13172
  }
12975
13173
 
12976
- interface FocusableDOMProps extends DOMProps {
13174
+ interface FocusableDOMProps$2 extends DOMProps$2 {
12977
13175
  /**
12978
13176
  * Whether to exclude the element from the sequential tab order. If true,
12979
13177
  * the element will not be focusable via the keyboard by tabbing. This should
@@ -12983,25 +13181,13 @@ interface FocusableDOMProps extends DOMProps {
12983
13181
  excludeFromTabOrder?: boolean
12984
13182
  }
12985
13183
 
12986
- interface InputDOMProps {
13184
+ interface InputDOMProps$1 {
12987
13185
  /**
12988
13186
  * The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
12989
13187
  */
12990
13188
  name?: string
12991
13189
  }
12992
13190
 
12993
- /** Any focusable element, including both HTML and SVG elements. */
12994
- interface FocusableElement extends Element, HTMLOrSVGElement {}
12995
-
12996
- /** All DOM attributes supported across both HTML and SVG elements. */
12997
- interface DOMAttributes<T = FocusableElement> extends AriaAttributes, DOMAttributes$1<T> {
12998
- id?: string | undefined,
12999
- role?: AriaRole | undefined,
13000
- tabIndex?: number | undefined,
13001
- style?: CSSProperties$1 | undefined,
13002
- className?: string | undefined
13003
- }
13004
-
13005
13191
  /*
13006
13192
  * Copyright 2020 Adobe. All rights reserved.
13007
13193
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -13043,7 +13229,7 @@ interface Validation<T = unknown> {
13043
13229
  validate?: (value: T) => ValidationError | true | null | undefined
13044
13230
  }
13045
13231
 
13046
- interface InputBase {
13232
+ interface InputBase$2 {
13047
13233
  /** Whether the input is disabled. */
13048
13234
  isDisabled?: boolean,
13049
13235
  /** Whether the input can be selected but not changed by the user. */
@@ -13064,12 +13250,38 @@ interface InputBase {
13064
13250
 
13065
13251
 
13066
13252
 
13067
- type SelectionMode = 'none' | 'single' | 'multiple';
13068
- type SelectionBehavior = 'toggle' | 'replace';
13069
- type Selection = 'all' | Set<Key>;
13253
+ // Event bubbling can be problematic in real-world applications, so the default for React Spectrum components
13254
+ // is not to propagate. This can be overridden by calling continuePropagation() on the event.
13255
+ type BaseEvent$2<T extends SyntheticEvent> = T & {
13256
+ /**
13257
+ * Use continuePropagation.
13258
+ * @deprecated */
13259
+ stopPropagation(): void,
13260
+ continuePropagation(): void
13261
+ }
13070
13262
 
13071
- type FocusStrategy = 'first' | 'last';
13072
- type DisabledBehavior = 'selection' | 'all';
13263
+ type KeyboardEvent$2 = BaseEvent$2<KeyboardEvent$3<any>>;
13264
+
13265
+ interface KeyboardEvents$2 {
13266
+ /** Handler that is called when a key is pressed. */
13267
+ onKeyDown?: (e: KeyboardEvent$2) => void,
13268
+ /** Handler that is called when a key is released. */
13269
+ onKeyUp?: (e: KeyboardEvent$2) => void
13270
+ }
13271
+
13272
+ interface FocusEvents$2<Target = Element> {
13273
+ /** Handler that is called when the element receives focus. */
13274
+ onFocus?: (e: FocusEvent<Target>) => void,
13275
+ /** Handler that is called when the element loses focus. */
13276
+ onBlur?: (e: FocusEvent<Target>) => void,
13277
+ /** Handler that is called when the element's focus status changes. */
13278
+ onFocusChange?: (isFocused: boolean) => void
13279
+ }
13280
+
13281
+ interface FocusableProps$2<Target = Element> extends FocusEvents$2<Target>, KeyboardEvents$2 {
13282
+ /** Whether the element should receive focus on render. */
13283
+ autoFocus?: boolean
13284
+ }
13073
13285
 
13074
13286
  /*
13075
13287
  * Copyright 2020 Adobe. All rights reserved.
@@ -13085,79 +13297,97 @@ type DisabledBehavior = 'selection' | 'all';
13085
13297
 
13086
13298
 
13087
13299
 
13088
- /**
13089
- * A generic interface to access a readonly sequential
13090
- * collection of unique keyed items.
13091
- */
13092
- interface Collection<T> extends Iterable<T> {
13093
- /** The number of items in the collection. */
13094
- readonly size: number,
13300
+ interface ToggleStateOptions extends InputBase$2 {
13301
+ /**
13302
+ * Whether the element should be selected (uncontrolled).
13303
+ */
13304
+ defaultSelected?: boolean,
13305
+ /**
13306
+ * Whether the element should be selected (controlled).
13307
+ */
13308
+ isSelected?: boolean,
13309
+ /**
13310
+ * Handler that is called when the element's selection state changes.
13311
+ */
13312
+ onChange?: (isSelected: boolean) => void
13313
+ }
13095
13314
 
13096
- /** Iterate over all keys in the collection. */
13097
- getKeys(): Iterable<Key>,
13315
+ interface ToggleProps extends ToggleStateOptions, Validation<boolean>, FocusableProps$2 {
13316
+ /**
13317
+ * The label for the element.
13318
+ */
13319
+ children?: ReactNode,
13320
+ /**
13321
+ * The value of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue).
13322
+ */
13323
+ value?: string
13324
+ }
13098
13325
 
13099
- /** Get an item by its key. */
13100
- getItem(key: Key): T | null,
13326
+ interface AriaToggleProps extends ToggleProps, FocusableDOMProps$2, AriaLabelingProps$2, AriaValidationProps, InputDOMProps$1 {
13327
+ /**
13328
+ * Identifies the element (or elements) whose contents or presence are controlled by the current element.
13329
+ */
13330
+ 'aria-controls'?: string
13331
+ }
13101
13332
 
13102
- /** Get an item by the index of its key. */
13103
- at(idx: number): T | null,
13333
+ interface CheckboxProps$1 extends ToggleProps {
13334
+ /**
13335
+ * Indeterminism is presentational only.
13336
+ * The indeterminate visual representation remains regardless of user interaction.
13337
+ */
13338
+ isIndeterminate?: boolean
13339
+ }
13104
13340
 
13105
- /** Get the key that comes before the given key in the collection. */
13106
- getKeyBefore(key: Key): Key | null,
13341
+ interface AriaCheckboxProps extends CheckboxProps$1, AriaToggleProps {}
13107
13342
 
13108
- /** Get the key that comes after the given key in the collection. */
13109
- getKeyAfter(key: Key): Key | null,
13110
-
13111
- /** Get the first key in the collection. */
13112
- getFirstKey(): Key | null,
13113
-
13114
- /** Get the last key in the collection. */
13115
- getLastKey(): Key | null,
13116
-
13117
- /** Iterate over the child items of the given key. */
13118
- getChildren?(key: Key): Iterable<T>,
13119
-
13120
- /** Returns a string representation of the item's contents. */
13121
- getTextValue?(key: Key): string
13343
+ interface StyleProps {
13344
+ className?: string;
13345
+ style?: React$1.CSSProperties;
13122
13346
  }
13347
+ declare function getDataProps(props: Record<string, any>): Partial<Record<string, any>>;
13123
13348
 
13124
- interface Node<T> {
13125
- /** The type of item this node represents. */
13126
- type: string,
13127
- /** A unique key for the node. */
13128
- key: Key,
13129
- /** The object value the node was created from. */
13130
- value: T | null,
13131
- /** The level of depth this node is at in the hierarchy. */
13132
- level: number,
13133
- /** Whether this item has children, even if not loaded yet. */
13134
- hasChildNodes: boolean,
13135
- /**
13136
- * The loaded children of this node.
13137
- * @deprecated Use `collection.getChildren(node.key)` instead.
13138
- */
13139
- childNodes: Iterable<Node<T>>,
13140
- /** The rendered contents of this node (e.g. JSX). */
13141
- rendered: ReactNode,
13142
- /** A string value for this node, used for features like typeahead. */
13143
- textValue: string,
13144
- /** An accessibility label for this node. */
13145
- 'aria-label'?: string,
13146
- /** The index of this node within its parent. */
13147
- index?: number,
13148
- /** A function that should be called to wrap the rendered node. */
13149
- wrapper?: (element: ReactElement) => ReactElement,
13150
- /** The key of the parent node. */
13151
- parentKey?: Key | null,
13152
- /** The key of the node before this node. */
13153
- prevKey?: Key | null,
13154
- /** The key of the node after this node. */
13155
- nextKey?: Key | null,
13156
- /** Additional properties specific to a particular node type. */
13157
- props?: any,
13158
- /** @private */
13159
- shouldInvalidate?: (context: unknown) => boolean
13349
+ type CheckboxRef = React$1.Ref<CheckboxRefValue>;
13350
+ interface CheckboxRefValue extends CheckboxState {
13351
+ getRoot: () => HTMLElement | null;
13352
+ focus: () => void;
13353
+ blur: () => void;
13354
+ }
13355
+ interface CheckboxState {
13356
+ setChecked: (checked: boolean) => void;
13357
+ }
13358
+ interface CheckboxProps extends Omit<AriaCheckboxProps, "isSelected" | "defaultSelected">, StyleProps {
13359
+ /**
13360
+ * Whether the Checkbox is checked or not; controlled
13361
+ */
13362
+ isChecked?: boolean;
13363
+ /**
13364
+ * Whether the Checkbox is checked by default; uncontrolled
13365
+ */
13366
+ defaultChecked?: boolean;
13367
+ /**
13368
+ * Whether the Checkbox is in an "indeterminate" state; this usually
13369
+ * refers to a "check all" that is used to check / uncheck many other
13370
+ * checkboxes, and is visually indeterminate if some of its controlled
13371
+ * checkboxes are checked and some are not.
13372
+ */
13373
+ isIndeterminate?: boolean;
13374
+ }
13375
+ interface CheckboxConfig<C extends AnyPlasmicClass> {
13376
+ isCheckedVariant: VariantDef<PlasmicClassVariants<C>>;
13377
+ isIndeterminateVariant?: VariantDef<PlasmicClassVariants<C>>;
13378
+ isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13379
+ noLabelVariant?: VariantDef<PlasmicClassVariants<C>>;
13380
+ labelSlot?: keyof PlasmicClassArgs<C>;
13381
+ root: keyof PlasmicClassOverrides<C>;
13160
13382
  }
13383
+ declare function useCheckbox<P extends CheckboxProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: CheckboxConfig<C>, ref?: CheckboxRef): {
13384
+ plasmicProps: {
13385
+ variants: PlasmicClassVariants<C>;
13386
+ overrides: PlasmicClassOverrides<C>;
13387
+ args: PlasmicClassArgs<C>;
13388
+ };
13389
+ state: CheckboxState;
13390
+ };
13161
13391
 
13162
13392
  /*
13163
13393
  * Copyright 2020 Adobe. All rights reserved.
@@ -13173,71 +13403,49 @@ interface Node<T> {
13173
13403
 
13174
13404
 
13175
13405
 
13176
- // Event bubbling can be problematic in real-world applications, so the default for React Spectrum components
13177
- // is not to propagate. This can be overridden by calling continuePropagation() on the event.
13178
- type BaseEvent<T extends SyntheticEvent> = T & {
13406
+ interface AriaLabelingProps$1 {
13179
13407
  /**
13180
- * Use continuePropagation.
13181
- * @deprecated */
13182
- stopPropagation(): void,
13183
- continuePropagation(): void
13184
- }
13185
-
13186
- type KeyboardEvent = BaseEvent<KeyboardEvent$1<any>>;
13187
-
13188
- type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';
13408
+ * Defines a string value that labels the current element.
13409
+ */
13410
+ 'aria-label'?: string,
13189
13411
 
13190
- interface PressEvent {
13191
- /** The type of press event being fired. */
13192
- type: 'pressstart' | 'pressend' | 'pressup' | 'press',
13193
- /** The pointer type that triggered the press event. */
13194
- pointerType: PointerType,
13195
- /** The target element of the press event. */
13196
- target: Element,
13197
- /** Whether the shift keyboard modifier was held during the press event. */
13198
- shiftKey: boolean,
13199
- /** Whether the ctrl keyboard modifier was held during the press event. */
13200
- ctrlKey: boolean,
13201
- /** Whether the meta keyboard modifier was held during the press event. */
13202
- metaKey: boolean,
13203
- /** Whether the alt keyboard modifier was held during the press event. */
13204
- altKey: boolean,
13205
13412
  /**
13206
- * By default, press events stop propagation to parent elements.
13207
- * In cases where a handler decides not to handle a specific event,
13208
- * it can call `continuePropagation()` to allow a parent to handle it.
13413
+ * Identifies the element (or elements) that labels the current element.
13209
13414
  */
13210
- continuePropagation(): void
13211
- }
13415
+ 'aria-labelledby'?: string,
13212
13416
 
13213
- interface LongPressEvent extends Omit<PressEvent, 'type' | 'continuePropagation'> {
13214
- /** The type of long press event being fired. */
13215
- type: 'longpressstart' | 'longpressend' | 'longpress'
13216
- }
13417
+ /**
13418
+ * Identifies the element (or elements) that describes the object.
13419
+ */
13420
+ 'aria-describedby'?: string,
13217
13421
 
13218
- interface KeyboardEvents {
13219
- /** Handler that is called when a key is pressed. */
13220
- onKeyDown?: (e: KeyboardEvent) => void,
13221
- /** Handler that is called when a key is released. */
13222
- onKeyUp?: (e: KeyboardEvent) => void
13422
+ /**
13423
+ * Identifies the element (or elements) that provide a detailed, extended description for the object.
13424
+ */
13425
+ 'aria-details'?: string
13223
13426
  }
13224
13427
 
13225
- interface FocusEvents<Target = Element> {
13226
- /** Handler that is called when the element receives focus. */
13227
- onFocus?: (e: FocusEvent<Target>) => void,
13228
- /** Handler that is called when the element loses focus. */
13229
- onBlur?: (e: FocusEvent<Target>) => void,
13230
- /** Handler that is called when the element's focus status changes. */
13231
- onFocusChange?: (isFocused: boolean) => void
13428
+ // A set of common DOM props that are allowed on any component
13429
+ // Ensure this is synced with DOMPropNames in filterDOMProps
13430
+ interface DOMProps$1 {
13431
+ /**
13432
+ * The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
13433
+ */
13434
+ id?: string
13232
13435
  }
13233
13436
 
13234
- interface FocusableProps<Target = Element> extends FocusEvents<Target>, KeyboardEvents {
13235
- /** Whether the element should receive focus on render. */
13236
- autoFocus?: boolean
13437
+ interface FocusableDOMProps$1 extends DOMProps$1 {
13438
+ /**
13439
+ * Whether to exclude the element from the sequential tab order. If true,
13440
+ * the element will not be focusable via the keyboard by tabbing. This should
13441
+ * be avoided except in rare scenarios where an alternative means of accessing
13442
+ * the element or its functionality via the keyboard is available.
13443
+ */
13444
+ excludeFromTabOrder?: boolean
13237
13445
  }
13238
13446
 
13239
13447
  /*
13240
- * Copyright 2023 Adobe. All rights reserved.
13448
+ * Copyright 2020 Adobe. All rights reserved.
13241
13449
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13242
13450
  * you may not use this file except in compliance with the License. You may obtain a copy
13243
13451
  * of the License at http://www.apache.org/licenses/LICENSE-2.0
@@ -13248,119 +13456,30 @@ interface FocusableProps<Target = Element> extends FocusEvents<Target>, Keyboard
13248
13456
  * governing permissions and limitations under the License.
13249
13457
  */
13250
13458
 
13251
- type Key = string | number;
13252
13459
 
13253
- declare function useFocused(opts: {
13254
- isTextInput?: boolean;
13255
- }): (boolean | DOMAttributes<FocusableElement>)[];
13256
- declare function useFocusVisible(opts: {
13257
- isTextInput?: boolean;
13258
- }): (boolean | DOMAttributes<FocusableElement>)[];
13259
- declare function useFocusedWithin(opts: {
13260
- isTextInput?: boolean;
13261
- }): (boolean | DOMAttributes<FocusableElement>)[];
13262
- declare function useFocusVisibleWithin(opts: {
13263
- isTextInput?: boolean;
13264
- }): (boolean | DOMAttributes<FocusableElement>)[];
13265
- declare function useHover(): (boolean | {
13266
- onMouseEnter: () => void;
13267
- onMouseLeave: () => void;
13268
- })[];
13269
- declare function usePressed(): (boolean | {
13270
- onMouseDown: () => void;
13271
- onMouseUp: () => void;
13272
- })[];
13273
- declare const TRIGGER_TO_HOOK: {
13274
- readonly useHover: typeof useHover;
13275
- readonly useFocused: typeof useFocused;
13276
- readonly useFocusVisible: typeof useFocusVisible;
13277
- readonly useFocusedWithin: typeof useFocusedWithin;
13278
- readonly useFocusVisibleWithin: typeof useFocusVisibleWithin;
13279
- readonly usePressed: typeof usePressed;
13280
- };
13281
- type TriggerType = keyof typeof TRIGGER_TO_HOOK;
13282
- interface TriggerOpts {
13283
- isTextInput?: boolean;
13460
+
13461
+ interface InputBase$1 {
13462
+ /** Whether the input is disabled. */
13463
+ isDisabled?: boolean,
13464
+ /** Whether the input can be selected but not changed by the user. */
13465
+ isReadOnly?: boolean
13284
13466
  }
13285
- /**
13286
- * Installs argment trigger. All the useTrigger calls must use hardcoded `trigger` arg,
13287
- * as it's not valid to install variable React hooks!
13467
+
13468
+ /*
13469
+ * Copyright 2020 Adobe. All rights reserved.
13470
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13471
+ * you may not use this file except in compliance with the License. You may obtain a copy
13472
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
13473
+ *
13474
+ * Unless required by applicable law or agreed to in writing, software distributed under
13475
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13476
+ * OF ANY KIND, either express or implied. See the License for the specific language
13477
+ * governing permissions and limitations under the License.
13288
13478
  */
13289
- declare function useTrigger(trigger: TriggerType, opts: TriggerOpts): [boolean, React$1.HTMLAttributes<HTMLElement>];
13290
13479
 
13291
- declare const classNames: any;
13292
13480
 
13293
- declare function setPlumeStrictMode(mode: boolean): void;
13294
- type VariantArgChoices<T> = T extends (infer M)[] ? M : T extends SingleChoiceArg<infer M> ? M : never;
13295
- type VariantArgsChoices<V> = {
13296
- [k in keyof V]-?: VariantArgChoices<V[k]>;
13297
- };
13298
- type DictValues<V extends Record<string, any>> = V[keyof V];
13299
- type DictTuples<V extends Record<string, any>> = DictValues<{
13300
- [K in keyof V]: [K, V[K]];
13301
- }>;
13302
- type VariantDefTuple<V> = DictTuples<VariantArgsChoices<V>>;
13303
- type DistributeTuple<T> = T extends [infer T1, infer T2] ? {
13304
- group: T1;
13305
- variant: T2;
13306
- } : never;
13307
- type VariantDef<V> = DistributeTuple<VariantDefTuple<V>>;
13308
- type PlasmicClass<V extends Record<string, any>, A extends Record<string, any>, O extends Record<string, any>> = {
13309
- (props: {
13310
- variants?: V;
13311
- args?: A;
13312
- overrides?: O;
13313
- }): React$1.ReactNode;
13314
- internalVariantProps: (keyof V)[];
13315
- internalArgProps: (keyof A)[];
13316
- };
13317
- type AnyPlasmicClass = PlasmicClass<any, any, any>;
13318
- type PlasmicClassVariants<C extends AnyPlasmicClass> = C extends PlasmicClass<infer V, any, any> ? V : unknown;
13319
- type PlasmicClassArgs<C extends AnyPlasmicClass> = C extends PlasmicClass<any, infer A, any> ? A : unknown;
13320
- type PlasmicClassOverrides<C extends AnyPlasmicClass> = C extends PlasmicClass<any, any, infer O> ? O : unknown;
13321
13481
 
13322
- interface PlumeCommonProps {
13323
- showStartIcon?: boolean;
13324
- showEndIcon?: boolean;
13325
- startIcon?: React$1.ReactNode;
13326
- endIcon?: React$1.ReactNode;
13327
- children?: React$1.ReactNode;
13328
- isDisabled?: boolean;
13329
- }
13330
- interface HtmlButtonProps extends Omit<React$1.ComponentProps<"button">, "ref" | "disabled"> {
13331
- }
13332
- interface HtmlAnchorProps extends Omit<React$1.ComponentProps<"a">, "ref" | "href" | "target"> {
13333
- }
13334
- interface PlumeActualButtonProps {
13335
- submitsForm?: boolean;
13336
- }
13337
- interface PlumeAnchorProps {
13338
- link?: string;
13339
- target?: React$1.ComponentProps<"a">["target"] | boolean;
13340
- }
13341
- type PlumeButtonProps = PlumeCommonProps & PlumeActualButtonProps & PlumeAnchorProps;
13342
- type BaseButtonProps = PlumeButtonProps & HtmlButtonProps & HtmlAnchorProps;
13343
- type AllButtonProps = PlumeCommonProps & PlumeActualButtonProps & HtmlButtonProps;
13344
- type AllAnchorProps = PlumeCommonProps & PlumeAnchorProps & HtmlAnchorProps;
13345
- type HtmlAnchorOnlyProps = Exclude<keyof AllAnchorProps, keyof AllButtonProps>;
13346
- type HtmlButtonOnlyProps = Exclude<keyof AllButtonProps, keyof AllAnchorProps>;
13347
- type ButtonRef = React$1.Ref<HTMLButtonElement | HTMLAnchorElement>;
13348
- interface ButtonConfig<C extends AnyPlasmicClass> {
13349
- showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
13350
- showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;
13351
- isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13352
- startIconSlot?: keyof PlasmicClassArgs<C>;
13353
- endIconSlot?: keyof PlasmicClassArgs<C>;
13354
- contentSlot: keyof PlasmicClassArgs<C>;
13355
- root: keyof PlasmicClassOverrides<C>;
13356
- }
13357
- declare function useButton<P extends PlumeButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: ButtonConfig<C>, ref?: ButtonRef): {
13358
- plasmicProps: {
13359
- variants: PlasmicClassVariants<C>;
13360
- args: PlasmicClassArgs<C>;
13361
- overrides: PlasmicClassOverrides<C>;
13362
- };
13363
- };
13482
+ type FocusStrategy$1 = 'first' | 'last';
13364
13483
 
13365
13484
  /*
13366
13485
  * Copyright 2020 Adobe. All rights reserved.
@@ -13376,96 +13495,40 @@ declare function useButton<P extends PlumeButtonProps, C extends AnyPlasmicClass
13376
13495
 
13377
13496
 
13378
13497
 
13379
- interface ToggleProps extends InputBase, Validation<boolean>, FocusableProps {
13380
- /**
13381
- * The label for the element.
13382
- */
13383
- children?: ReactNode,
13384
- /**
13385
- * Whether the element should be selected (uncontrolled).
13386
- */
13387
- defaultSelected?: boolean,
13388
- /**
13389
- * Whether the element should be selected (controlled).
13390
- */
13391
- isSelected?: boolean,
13392
- /**
13393
- * Handler that is called when the element's selection state changes.
13394
- */
13395
- onChange?: (isSelected: boolean) => void,
13396
- /**
13397
- * The value of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue).
13398
- */
13399
- value?: string
13400
- }
13401
-
13402
- interface AriaToggleProps extends ToggleProps, FocusableDOMProps, AriaLabelingProps, AriaValidationProps, InputDOMProps {
13403
- /**
13404
- * Identifies the element (or elements) whose contents or presence are controlled by the current element.
13405
- */
13406
- 'aria-controls'?: string
13407
- }
13408
-
13409
- interface CheckboxProps$1 extends ToggleProps {
13410
- /**
13411
- * Indeterminism is presentational only.
13412
- * The indeterminate visual representation remains regardless of user interaction.
13413
- */
13414
- isIndeterminate?: boolean
13498
+ // Event bubbling can be problematic in real-world applications, so the default for React Spectrum components
13499
+ // is not to propagate. This can be overridden by calling continuePropagation() on the event.
13500
+ type BaseEvent$1<T extends SyntheticEvent> = T & {
13501
+ /**
13502
+ * Use continuePropagation.
13503
+ * @deprecated */
13504
+ stopPropagation(): void,
13505
+ continuePropagation(): void
13415
13506
  }
13416
13507
 
13417
- interface AriaCheckboxProps extends CheckboxProps$1, AriaToggleProps {}
13508
+ type KeyboardEvent$1 = BaseEvent$1<KeyboardEvent$3<any>>;
13418
13509
 
13419
- interface StyleProps {
13420
- className?: string;
13421
- style?: React$1.CSSProperties;
13510
+ interface KeyboardEvents$1 {
13511
+ /** Handler that is called when a key is pressed. */
13512
+ onKeyDown?: (e: KeyboardEvent$1) => void,
13513
+ /** Handler that is called when a key is released. */
13514
+ onKeyUp?: (e: KeyboardEvent$1) => void
13422
13515
  }
13423
- declare function getDataProps(props: Record<string, any>): Partial<Record<string, any>>;
13424
13516
 
13425
- type CheckboxRef = React$1.Ref<CheckboxRefValue>;
13426
- interface CheckboxRefValue extends CheckboxState {
13427
- getRoot: () => HTMLElement | null;
13428
- focus: () => void;
13429
- blur: () => void;
13430
- }
13431
- interface CheckboxState {
13432
- setChecked: (checked: boolean) => void;
13433
- }
13434
- interface CheckboxProps extends Omit<AriaCheckboxProps, "isSelected" | "defaultSelected">, StyleProps {
13435
- /**
13436
- * Whether the Checkbox is checked or not; controlled
13437
- */
13438
- isChecked?: boolean;
13439
- /**
13440
- * Whether the Checkbox is checked by default; uncontrolled
13441
- */
13442
- defaultChecked?: boolean;
13443
- /**
13444
- * Whether the Checkbox is in an "indeterminate" state; this usually
13445
- * refers to a "check all" that is used to check / uncheck many other
13446
- * checkboxes, and is visually indeterminate if some of its controlled
13447
- * checkboxes are checked and some are not.
13448
- */
13449
- isIndeterminate?: boolean;
13517
+ interface FocusEvents$1<Target = Element> {
13518
+ /** Handler that is called when the element receives focus. */
13519
+ onFocus?: (e: FocusEvent<Target>) => void,
13520
+ /** Handler that is called when the element loses focus. */
13521
+ onBlur?: (e: FocusEvent<Target>) => void,
13522
+ /** Handler that is called when the element's focus status changes. */
13523
+ onFocusChange?: (isFocused: boolean) => void
13450
13524
  }
13451
- interface CheckboxConfig<C extends AnyPlasmicClass> {
13452
- isCheckedVariant: VariantDef<PlasmicClassVariants<C>>;
13453
- isIndeterminateVariant?: VariantDef<PlasmicClassVariants<C>>;
13454
- isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13455
- noLabelVariant?: VariantDef<PlasmicClassVariants<C>>;
13456
- labelSlot?: keyof PlasmicClassArgs<C>;
13457
- root: keyof PlasmicClassOverrides<C>;
13525
+
13526
+ interface FocusableProps$1<Target = Element> extends FocusEvents$1<Target>, KeyboardEvents$1 {
13527
+ /** Whether the element should receive focus on render. */
13528
+ autoFocus?: boolean
13458
13529
  }
13459
- declare function useCheckbox<P extends CheckboxProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: CheckboxConfig<C>, ref?: CheckboxRef): {
13460
- plasmicProps: {
13461
- variants: PlasmicClassVariants<C>;
13462
- overrides: PlasmicClassOverrides<C>;
13463
- args: PlasmicClassArgs<C>;
13464
- };
13465
- state: CheckboxState;
13466
- };
13467
13530
 
13468
- interface BaseMenuProps extends DOMProps, AriaLabelingProps, StyleProps {
13531
+ interface BaseMenuProps extends DOMProps$1, AriaLabelingProps$1, StyleProps {
13469
13532
  /**
13470
13533
  * List of `Menu.Item`s or `Menu.Group`s that make up the menu
13471
13534
  */
@@ -13707,7 +13770,7 @@ interface DropdownMenuProps {
13707
13770
  }
13708
13771
  declare function DropdownMenu(props: DropdownMenuProps): React$1.JSX.Element;
13709
13772
 
13710
- interface BaseMenuButtonProps extends DOMProps, FocusableProps, StyleProps, Pick<React$1.ComponentProps<"button">, "title"> {
13773
+ interface BaseMenuButtonProps extends DOMProps$1, FocusableProps$1, StyleProps, Pick<React$1.ComponentProps<"button">, "title"> {
13711
13774
  /**
13712
13775
  * The menu to show; can either be a Menu instance, or a function that returns a Menu
13713
13776
  * instance if you want to defer creating the instance till when it's opened.
@@ -13773,7 +13836,7 @@ declare function useMenuButton<P extends BaseMenuButtonProps, C extends AnyPlasm
13773
13836
  state: MenuButtonState;
13774
13837
  };
13775
13838
 
13776
- interface BaseSelectProps extends DOMProps, AriaLabelingProps, FocusableDOMProps, InputBase, FocusableProps, StyleProps {
13839
+ interface BaseSelectProps extends DOMProps$1, AriaLabelingProps$1, FocusableDOMProps$1, InputBase$1, FocusableProps$1, StyleProps {
13777
13840
  /**
13778
13841
  * Key of the currently selected value
13779
13842
  */
@@ -13878,44 +13941,351 @@ declare function useSelect<P extends BaseSelectProps, C extends AnyPlasmicClass>
13878
13941
  state: SelectState;
13879
13942
  };
13880
13943
 
13881
- interface BaseSelectOptionProps extends ItemLikeProps, StyleProps {
13944
+ interface BaseSelectOptionProps extends ItemLikeProps, StyleProps {
13945
+ }
13946
+ interface SelectOptionConfig<C extends AnyPlasmicClass> {
13947
+ isSelectedVariant: VariantDef<PlasmicClassVariants<C>>;
13948
+ isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13949
+ isHighlightedVariant?: VariantDef<PlasmicClassVariants<C>>;
13950
+ labelSlot: keyof PlasmicClassArgs<C>;
13951
+ root: keyof PlasmicClassOverrides<C>;
13952
+ labelContainer: keyof PlasmicClassOverrides<C>;
13953
+ }
13954
+ type SelectOptionRef = React$1.Ref<HTMLElement>;
13955
+ declare function useSelectOption<P extends BaseSelectOptionProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: SelectOptionConfig<C>, outerRef?: SelectOptionRef): {
13956
+ plasmicProps: {
13957
+ variants: PlasmicClassVariants<C>;
13958
+ args: PlasmicClassArgs<C>;
13959
+ overrides: PlasmicClassOverrides<C>;
13960
+ };
13961
+ };
13962
+
13963
+ interface BaseSelectOptionGroupProps extends SectionLikeProps, StyleProps {
13964
+ }
13965
+ interface SelectOptionGroupConfig<C extends AnyPlasmicClass> {
13966
+ noTitleVariant: VariantDef<PlasmicClassVariants<C>>;
13967
+ isFirstVariant: VariantDef<PlasmicClassVariants<C>>;
13968
+ optionsSlot: keyof PlasmicClassArgs<C>;
13969
+ titleSlot: keyof PlasmicClassArgs<C>;
13970
+ root: keyof PlasmicClassOverrides<C>;
13971
+ separator: keyof PlasmicClassOverrides<C>;
13972
+ titleContainer: keyof PlasmicClassOverrides<C>;
13973
+ optionsContainer: keyof PlasmicClassOverrides<C>;
13974
+ }
13975
+ declare function useSelectOptionGroup<P extends BaseSelectOptionGroupProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: SelectOptionGroupConfig<C>): {
13976
+ plasmicProps: {
13977
+ variants: PlasmicClassVariants<C>;
13978
+ args: PlasmicClassArgs<C>;
13979
+ overrides: PlasmicClassOverrides<C>;
13980
+ };
13981
+ };
13982
+
13983
+ /*
13984
+ * Copyright 2020 Adobe. All rights reserved.
13985
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13986
+ * you may not use this file except in compliance with the License. You may obtain a copy
13987
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
13988
+ *
13989
+ * Unless required by applicable law or agreed to in writing, software distributed under
13990
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13991
+ * OF ANY KIND, either express or implied. See the License for the specific language
13992
+ * governing permissions and limitations under the License.
13993
+ */
13994
+
13995
+
13996
+
13997
+ /**
13998
+ * A generic interface to access a readonly sequential
13999
+ * collection of unique keyed items.
14000
+ */
14001
+ interface Collection$1<T> extends Iterable<T> {
14002
+ /** The number of items in the collection. */
14003
+ readonly size: number,
14004
+
14005
+ /** Iterate over all keys in the collection. */
14006
+ getKeys(): Iterable<Key$1>,
14007
+
14008
+ /** Get an item by its key. */
14009
+ getItem(key: Key$1): T | null,
14010
+
14011
+ /** Get an item by the index of its key. */
14012
+ at(idx: number): T | null,
14013
+
14014
+ /** Get the key that comes before the given key in the collection. */
14015
+ getKeyBefore(key: Key$1): Key$1 | null,
14016
+
14017
+ /** Get the key that comes after the given key in the collection. */
14018
+ getKeyAfter(key: Key$1): Key$1 | null,
14019
+
14020
+ /** Get the first key in the collection. */
14021
+ getFirstKey(): Key$1 | null,
14022
+
14023
+ /** Get the last key in the collection. */
14024
+ getLastKey(): Key$1 | null,
14025
+
14026
+ /** Iterate over the child items of the given key. */
14027
+ getChildren?(key: Key$1): Iterable<T>,
14028
+
14029
+ /** Returns a string representation of the item's contents. */
14030
+ getTextValue?(key: Key$1): string,
14031
+
14032
+ /** Filters the collection using the given function. */
14033
+ UNSTABLE_filter?(filterFn: (nodeValue: string) => boolean): Collection$1<T>
14034
+ }
14035
+
14036
+ interface Node$1<T> {
14037
+ /** The type of item this node represents. */
14038
+ type: string,
14039
+ /** A unique key for the node. */
14040
+ key: Key$1,
14041
+ /** The object value the node was created from. */
14042
+ value: T | null,
14043
+ /** The level of depth this node is at in the hierarchy. */
14044
+ level: number,
14045
+ /** Whether this item has children, even if not loaded yet. */
14046
+ hasChildNodes: boolean,
14047
+ /**
14048
+ * The loaded children of this node.
14049
+ * @deprecated Use `collection.getChildren(node.key)` instead.
14050
+ */
14051
+ childNodes: Iterable<Node$1<T>>,
14052
+ /** The rendered contents of this node (e.g. JSX). */
14053
+ rendered: ReactNode,
14054
+ /** A string value for this node, used for features like typeahead. */
14055
+ textValue: string,
14056
+ /** An accessibility label for this node. */
14057
+ 'aria-label'?: string,
14058
+ /** The index of this node within its parent. */
14059
+ index: number,
14060
+ /** A function that should be called to wrap the rendered node. */
14061
+ wrapper?: (element: ReactElement) => ReactElement,
14062
+ /** The key of the parent node. */
14063
+ parentKey?: Key$1 | null,
14064
+ /** The key of the node before this node. */
14065
+ prevKey?: Key$1 | null,
14066
+ /** The key of the node after this node. */
14067
+ nextKey?: Key$1 | null,
14068
+ /** Additional properties specific to a particular node type. */
14069
+ props?: any,
14070
+ /** @private */
14071
+ shouldInvalidate?: (context: any) => boolean,
14072
+ /** A function that renders this node to a React Element in the DOM. */
14073
+ render?: (node: Node$1<any>) => ReactElement
14074
+ }
14075
+
14076
+ /*
14077
+ * Copyright 2023 Adobe. All rights reserved.
14078
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14079
+ * you may not use this file except in compliance with the License. You may obtain a copy
14080
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14081
+ *
14082
+ * Unless required by applicable law or agreed to in writing, software distributed under
14083
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14084
+ * OF ANY KIND, either express or implied. See the License for the specific language
14085
+ * governing permissions and limitations under the License.
14086
+ */
14087
+
14088
+ type Key$1 = string | number;
14089
+
14090
+ /*
14091
+ * Copyright 2020 Adobe. All rights reserved.
14092
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14093
+ * you may not use this file except in compliance with the License. You may obtain a copy
14094
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14095
+ *
14096
+ * Unless required by applicable law or agreed to in writing, software distributed under
14097
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14098
+ * OF ANY KIND, either express or implied. See the License for the specific language
14099
+ * governing permissions and limitations under the License.
14100
+ */
14101
+
14102
+
14103
+
14104
+ type SelectionMode = 'none' | 'single' | 'multiple';
14105
+ type SelectionBehavior = 'toggle' | 'replace';
14106
+ type Selection = 'all' | Set<Key>;
14107
+
14108
+ type FocusStrategy = 'first' | 'last';
14109
+ type DisabledBehavior = 'selection' | 'all';
14110
+
14111
+ /*
14112
+ * Copyright 2020 Adobe. All rights reserved.
14113
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14114
+ * you may not use this file except in compliance with the License. You may obtain a copy
14115
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14116
+ *
14117
+ * Unless required by applicable law or agreed to in writing, software distributed under
14118
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14119
+ * OF ANY KIND, either express or implied. See the License for the specific language
14120
+ * governing permissions and limitations under the License.
14121
+ */
14122
+
14123
+
14124
+
14125
+ interface Rect {
14126
+ x: number,
14127
+ y: number,
14128
+ width: number,
14129
+ height: number
14130
+ }
14131
+
14132
+ interface Size {
14133
+ width: number,
14134
+ height: number
14135
+ }
14136
+
14137
+ /** A LayoutDelegate provides layout information for collection items. */
14138
+ interface LayoutDelegate {
14139
+ /** Returns a rectangle for the item with the given key. */
14140
+ getItemRect(key: Key): Rect | null,
14141
+ /** Returns the visible rectangle of the collection. */
14142
+ getVisibleRect(): Rect,
14143
+ /** Returns the size of the scrollable content in the collection. */
14144
+ getContentSize(): Size,
14145
+ /** Returns a list of keys between `from` and `to`. */
14146
+ getKeyRange?(from: Key, to: Key): Key[]
14147
+ }
14148
+
14149
+ /**
14150
+ * A generic interface to access a readonly sequential
14151
+ * collection of unique keyed items.
14152
+ */
14153
+ interface Collection<T> extends Iterable<T> {
14154
+ /** The number of items in the collection. */
14155
+ readonly size: number,
14156
+
14157
+ /** Iterate over all keys in the collection. */
14158
+ getKeys(): Iterable<Key>,
14159
+
14160
+ /** Get an item by its key. */
14161
+ getItem(key: Key): T | null,
14162
+
14163
+ /** Get an item by the index of its key. */
14164
+ at(idx: number): T | null,
14165
+
14166
+ /** Get the key that comes before the given key in the collection. */
14167
+ getKeyBefore(key: Key): Key | null,
14168
+
14169
+ /** Get the key that comes after the given key in the collection. */
14170
+ getKeyAfter(key: Key): Key | null,
14171
+
14172
+ /** Get the first key in the collection. */
14173
+ getFirstKey(): Key | null,
14174
+
14175
+ /** Get the last key in the collection. */
14176
+ getLastKey(): Key | null,
14177
+
14178
+ /** Iterate over the child items of the given key. */
14179
+ getChildren?(key: Key): Iterable<T>,
14180
+
14181
+ /** Returns a string representation of the item's contents. */
14182
+ getTextValue?(key: Key): string,
14183
+
14184
+ /** Filters the collection using the given function. */
14185
+ UNSTABLE_filter?(filterFn: (nodeValue: string) => boolean): Collection<T>
13882
14186
  }
13883
- interface SelectOptionConfig<C extends AnyPlasmicClass> {
13884
- isSelectedVariant: VariantDef<PlasmicClassVariants<C>>;
13885
- isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13886
- isHighlightedVariant?: VariantDef<PlasmicClassVariants<C>>;
13887
- labelSlot: keyof PlasmicClassArgs<C>;
13888
- root: keyof PlasmicClassOverrides<C>;
13889
- labelContainer: keyof PlasmicClassOverrides<C>;
14187
+
14188
+ interface Node<T> {
14189
+ /** The type of item this node represents. */
14190
+ type: string,
14191
+ /** A unique key for the node. */
14192
+ key: Key,
14193
+ /** The object value the node was created from. */
14194
+ value: T | null,
14195
+ /** The level of depth this node is at in the hierarchy. */
14196
+ level: number,
14197
+ /** Whether this item has children, even if not loaded yet. */
14198
+ hasChildNodes: boolean,
14199
+ /**
14200
+ * The loaded children of this node.
14201
+ * @deprecated Use `collection.getChildren(node.key)` instead.
14202
+ */
14203
+ childNodes: Iterable<Node<T>>,
14204
+ /** The rendered contents of this node (e.g. JSX). */
14205
+ rendered: ReactNode,
14206
+ /** A string value for this node, used for features like typeahead. */
14207
+ textValue: string,
14208
+ /** An accessibility label for this node. */
14209
+ 'aria-label'?: string,
14210
+ /** The index of this node within its parent. */
14211
+ index: number,
14212
+ /** A function that should be called to wrap the rendered node. */
14213
+ wrapper?: (element: ReactElement) => ReactElement,
14214
+ /** The key of the parent node. */
14215
+ parentKey?: Key | null,
14216
+ /** The key of the node before this node. */
14217
+ prevKey?: Key | null,
14218
+ /** The key of the node after this node. */
14219
+ nextKey?: Key | null,
14220
+ /** Additional properties specific to a particular node type. */
14221
+ props?: any,
14222
+ /** @private */
14223
+ shouldInvalidate?: (context: any) => boolean,
14224
+ /** A function that renders this node to a React Element in the DOM. */
14225
+ render?: (node: Node<any>) => ReactElement
13890
14226
  }
13891
- type SelectOptionRef = React$1.Ref<HTMLElement>;
13892
- declare function useSelectOption<P extends BaseSelectOptionProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: SelectOptionConfig<C>, outerRef?: SelectOptionRef): {
13893
- plasmicProps: {
13894
- variants: PlasmicClassVariants<C>;
13895
- args: PlasmicClassArgs<C>;
13896
- overrides: PlasmicClassOverrides<C>;
13897
- };
13898
- };
13899
14227
 
13900
- interface BaseSelectOptionGroupProps extends SectionLikeProps, StyleProps {
14228
+ /*
14229
+ * Copyright 2020 Adobe. All rights reserved.
14230
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14231
+ * you may not use this file except in compliance with the License. You may obtain a copy
14232
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14233
+ *
14234
+ * Unless required by applicable law or agreed to in writing, software distributed under
14235
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14236
+ * OF ANY KIND, either express or implied. See the License for the specific language
14237
+ * governing permissions and limitations under the License.
14238
+ */
14239
+
14240
+
14241
+
14242
+ type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';
14243
+
14244
+ interface PressEvent {
14245
+ /** The type of press event being fired. */
14246
+ type: 'pressstart' | 'pressend' | 'pressup' | 'press',
14247
+ /** The pointer type that triggered the press event. */
14248
+ pointerType: PointerType,
14249
+ /** The target element of the press event. */
14250
+ target: Element,
14251
+ /** Whether the shift keyboard modifier was held during the press event. */
14252
+ shiftKey: boolean,
14253
+ /** Whether the ctrl keyboard modifier was held during the press event. */
14254
+ ctrlKey: boolean,
14255
+ /** Whether the meta keyboard modifier was held during the press event. */
14256
+ metaKey: boolean,
14257
+ /** Whether the alt keyboard modifier was held during the press event. */
14258
+ altKey: boolean,
14259
+ /** X position relative to the target. */
14260
+ x: number,
14261
+ /** Y position relative to the target. */
14262
+ y: number,
14263
+ /**
14264
+ * By default, press events stop propagation to parent elements.
14265
+ * In cases where a handler decides not to handle a specific event,
14266
+ * it can call `continuePropagation()` to allow a parent to handle it.
14267
+ */
14268
+ continuePropagation(): void
13901
14269
  }
13902
- interface SelectOptionGroupConfig<C extends AnyPlasmicClass> {
13903
- noTitleVariant: VariantDef<PlasmicClassVariants<C>>;
13904
- isFirstVariant: VariantDef<PlasmicClassVariants<C>>;
13905
- optionsSlot: keyof PlasmicClassArgs<C>;
13906
- titleSlot: keyof PlasmicClassArgs<C>;
13907
- root: keyof PlasmicClassOverrides<C>;
13908
- separator: keyof PlasmicClassOverrides<C>;
13909
- titleContainer: keyof PlasmicClassOverrides<C>;
13910
- optionsContainer: keyof PlasmicClassOverrides<C>;
14270
+
14271
+ interface LongPressEvent extends Omit<PressEvent, 'type' | 'continuePropagation'> {
14272
+ /** The type of long press event being fired. */
14273
+ type: 'longpressstart' | 'longpressend' | 'longpress'
13911
14274
  }
13912
- declare function useSelectOptionGroup<P extends BaseSelectOptionGroupProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: SelectOptionGroupConfig<C>): {
13913
- plasmicProps: {
13914
- variants: PlasmicClassVariants<C>;
13915
- args: PlasmicClassArgs<C>;
13916
- overrides: PlasmicClassOverrides<C>;
13917
- };
13918
- };
14275
+
14276
+ /*
14277
+ * Copyright 2023 Adobe. All rights reserved.
14278
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14279
+ * you may not use this file except in compliance with the License. You may obtain a copy
14280
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14281
+ *
14282
+ * Unless required by applicable law or agreed to in writing, software distributed under
14283
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14284
+ * OF ANY KIND, either express or implied. See the License for the specific language
14285
+ * governing permissions and limitations under the License.
14286
+ */
14287
+
14288
+ type Key = string | number;
13919
14289
 
13920
14290
  interface FocusState {
13921
14291
  /** Whether the collection is currently focused. */
@@ -13923,11 +14293,11 @@ interface FocusState {
13923
14293
  /** Sets whether the collection is focused. */
13924
14294
  setFocused(isFocused: boolean): void;
13925
14295
  /** The current focused key in the collection. */
13926
- readonly focusedKey: Key;
14296
+ readonly focusedKey: Key | null;
13927
14297
  /** Whether the first or last child of the focused key should receive focus. */
13928
- readonly childFocusStrategy: FocusStrategy;
14298
+ readonly childFocusStrategy: FocusStrategy | null;
13929
14299
  /** Sets the focused key, and optionally, whether the first or last child of that key should receive focus. */
13930
- setFocusedKey(key: Key, child?: FocusStrategy): void;
14300
+ setFocusedKey(key: Key | null, child?: FocusStrategy): void;
13931
14301
  }
13932
14302
  interface MultipleSelectionState extends FocusState {
13933
14303
  /** The type of selection that is allowed in the collection. */
@@ -14001,14 +14371,18 @@ interface MultipleSelectionManager extends FocusState {
14001
14371
  isLink(key: Key): boolean;
14002
14372
  /** Returns the props for the given item. */
14003
14373
  getItemProps(key: Key): any;
14374
+ /** The collection of nodes that the selection manager handles. */
14375
+ collection: Collection<Node<unknown>>;
14004
14376
  }
14005
14377
  interface SelectionManagerOptions {
14006
14378
  allowsCellSelection?: boolean;
14379
+ layoutDelegate?: LayoutDelegate;
14007
14380
  }
14008
14381
  /**
14009
14382
  * An interface for reading and updating multiple selection state.
14010
14383
  */
14011
14384
  declare class SelectionManager implements MultipleSelectionManager {
14385
+ collection: Collection<Node<unknown>>;
14012
14386
  constructor(collection: Collection<Node<unknown>>, state: MultipleSelectionState, options?: SelectionManagerOptions);
14013
14387
  /**
14014
14388
  * The type of selection that is allowed in the collection.
@@ -14037,9 +14411,9 @@ declare class SelectionManager implements MultipleSelectionManager {
14037
14411
  /**
14038
14412
  * The current focused key in the collection.
14039
14413
  */
14040
- get focusedKey(): Key;
14414
+ get focusedKey(): Key | null;
14041
14415
  /** Whether the first or last child of the focused key should receive focus. */
14042
- get childFocusStrategy(): FocusStrategy;
14416
+ get childFocusStrategy(): FocusStrategy | null;
14043
14417
  /**
14044
14418
  * Sets the focused key.
14045
14419
  */
@@ -14106,13 +14480,14 @@ declare class SelectionManager implements MultipleSelectionManager {
14106
14480
  isDisabled(key: Key): boolean;
14107
14481
  isLink(key: Key): boolean;
14108
14482
  getItemProps(key: Key): any;
14483
+ withCollection(collection: Collection<Node<unknown>>): SelectionManager;
14109
14484
  }
14110
14485
 
14111
14486
  interface ListState<T> {
14112
14487
  /** A collection of items in the list. */
14113
- collection: Collection<Node<T>>;
14488
+ collection: Collection$1<Node$1<T>>;
14114
14489
  /** A set of items that are disabled. */
14115
- disabledKeys: Set<Key>;
14490
+ disabledKeys: Set<Key$1>;
14116
14491
  /** A selection manager to read and update multiple selection state. */
14117
14492
  selectionManager: SelectionManager;
14118
14493
  }
@@ -14133,6 +14508,136 @@ declare const SelectContext: React$1.Context<ListState<any> | undefined>;
14133
14508
 
14134
14509
 
14135
14510
 
14511
+ interface AriaLabelingProps {
14512
+ /**
14513
+ * Defines a string value that labels the current element.
14514
+ */
14515
+ 'aria-label'?: string,
14516
+
14517
+ /**
14518
+ * Identifies the element (or elements) that labels the current element.
14519
+ */
14520
+ 'aria-labelledby'?: string,
14521
+
14522
+ /**
14523
+ * Identifies the element (or elements) that describes the object.
14524
+ */
14525
+ 'aria-describedby'?: string,
14526
+
14527
+ /**
14528
+ * Identifies the element (or elements) that provide a detailed, extended description for the object.
14529
+ */
14530
+ 'aria-details'?: string
14531
+ }
14532
+
14533
+ // A set of common DOM props that are allowed on any component
14534
+ // Ensure this is synced with DOMPropNames in filterDOMProps
14535
+ interface DOMProps {
14536
+ /**
14537
+ * The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
14538
+ */
14539
+ id?: string
14540
+ }
14541
+
14542
+ interface FocusableDOMProps extends DOMProps {
14543
+ /**
14544
+ * Whether to exclude the element from the sequential tab order. If true,
14545
+ * the element will not be focusable via the keyboard by tabbing. This should
14546
+ * be avoided except in rare scenarios where an alternative means of accessing
14547
+ * the element or its functionality via the keyboard is available.
14548
+ */
14549
+ excludeFromTabOrder?: boolean
14550
+ }
14551
+
14552
+ interface InputDOMProps {
14553
+ /**
14554
+ * The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
14555
+ */
14556
+ name?: string
14557
+ }
14558
+
14559
+ /*
14560
+ * Copyright 2020 Adobe. All rights reserved.
14561
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14562
+ * you may not use this file except in compliance with the License. You may obtain a copy
14563
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14564
+ *
14565
+ * Unless required by applicable law or agreed to in writing, software distributed under
14566
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14567
+ * OF ANY KIND, either express or implied. See the License for the specific language
14568
+ * governing permissions and limitations under the License.
14569
+ */
14570
+
14571
+
14572
+
14573
+ interface InputBase {
14574
+ /** Whether the input is disabled. */
14575
+ isDisabled?: boolean,
14576
+ /** Whether the input can be selected but not changed by the user. */
14577
+ isReadOnly?: boolean
14578
+ }
14579
+
14580
+ /*
14581
+ * Copyright 2020 Adobe. All rights reserved.
14582
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14583
+ * you may not use this file except in compliance with the License. You may obtain a copy
14584
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14585
+ *
14586
+ * Unless required by applicable law or agreed to in writing, software distributed under
14587
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14588
+ * OF ANY KIND, either express or implied. See the License for the specific language
14589
+ * governing permissions and limitations under the License.
14590
+ */
14591
+
14592
+
14593
+
14594
+ // Event bubbling can be problematic in real-world applications, so the default for React Spectrum components
14595
+ // is not to propagate. This can be overridden by calling continuePropagation() on the event.
14596
+ type BaseEvent<T extends SyntheticEvent> = T & {
14597
+ /**
14598
+ * Use continuePropagation.
14599
+ * @deprecated */
14600
+ stopPropagation(): void,
14601
+ continuePropagation(): void
14602
+ }
14603
+
14604
+ type KeyboardEvent = BaseEvent<KeyboardEvent$3<any>>;
14605
+
14606
+ interface KeyboardEvents {
14607
+ /** Handler that is called when a key is pressed. */
14608
+ onKeyDown?: (e: KeyboardEvent) => void,
14609
+ /** Handler that is called when a key is released. */
14610
+ onKeyUp?: (e: KeyboardEvent) => void
14611
+ }
14612
+
14613
+ interface FocusEvents<Target = Element> {
14614
+ /** Handler that is called when the element receives focus. */
14615
+ onFocus?: (e: FocusEvent<Target>) => void,
14616
+ /** Handler that is called when the element loses focus. */
14617
+ onBlur?: (e: FocusEvent<Target>) => void,
14618
+ /** Handler that is called when the element's focus status changes. */
14619
+ onFocusChange?: (isFocused: boolean) => void
14620
+ }
14621
+
14622
+ interface FocusableProps<Target = Element> extends FocusEvents<Target>, KeyboardEvents {
14623
+ /** Whether the element should receive focus on render. */
14624
+ autoFocus?: boolean
14625
+ }
14626
+
14627
+ /*
14628
+ * Copyright 2020 Adobe. All rights reserved.
14629
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14630
+ * you may not use this file except in compliance with the License. You may obtain a copy
14631
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14632
+ *
14633
+ * Unless required by applicable law or agreed to in writing, software distributed under
14634
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14635
+ * OF ANY KIND, either express or implied. See the License for the specific language
14636
+ * governing permissions and limitations under the License.
14637
+ */
14638
+
14639
+
14640
+
14136
14641
  interface SwitchBase extends InputBase, FocusableProps {
14137
14642
  /**
14138
14643
  * The content to render as the Switch's label.
@@ -14237,7 +14742,7 @@ declare function useTextInput<P extends PlumeTextInputProps, C extends AnyPlasmi
14237
14742
  };
14238
14743
  };
14239
14744
 
14240
- interface BaseTriggeredOverlayProps extends StyleProps, DOMProps {
14745
+ interface BaseTriggeredOverlayProps extends StyleProps, DOMProps$1 {
14241
14746
  children?: React$1.ReactNode;
14242
14747
  }
14243
14748
  interface TriggeredOverlayConfig<C extends AnyPlasmicClass> {
@@ -14273,7 +14778,7 @@ interface OverlayTriggerState {
14273
14778
  interface TriggeredOverlayContextValue {
14274
14779
  triggerRef: React$1.RefObject<HTMLElement>;
14275
14780
  state: OverlayTriggerState;
14276
- autoFocus?: boolean | FocusStrategy;
14781
+ autoFocus?: boolean | FocusStrategy$1;
14277
14782
  placement?: Placement;
14278
14783
  overlayMatchTriggerWidth?: boolean;
14279
14784
  overlayMinTriggerWidth?: boolean;