@plasmicapp/react-web 0.2.388 → 0.2.390

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$2, AriaRole, CSSProperties as CSSProperties$1, FocusEvent, KeyboardEvent as KeyboardEvent$3, SyntheticEvent, ReactNode, ReactElement } from 'react';
3
+ import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties as CSSProperties$1, ReactNode, ReactElement, FocusEvent, KeyboardEvent as KeyboardEvent$2, SyntheticEvent } from 'react';
4
4
 
5
5
  declare global {
6
6
  interface Window {
@@ -11373,6 +11373,8 @@ interface CodeComponentElement<P> {
11373
11373
  }
11374
11374
  type PlasmicElement = ImageElement | TextElement | ContainerElement | ButtonElement | TextInputElement | CodeComponentElement<{}> | DefaultComponentElement<{}>;
11375
11375
 
11376
+ type Nullish<T> = T | null | undefined;
11377
+
11376
11378
  interface ActionProps<P> {
11377
11379
  componentProps: P;
11378
11380
  /**
@@ -12223,18 +12225,18 @@ interface CustomChoiceType<P, T> extends ChoiceTypeBase<P, T | T[]> {
12223
12225
  multiSelect: ContextDependentConfig<P, boolean>;
12224
12226
  }
12225
12227
  type ChoiceType<P, T> = SingleChoiceType<P, T> | MultiChoiceType<P, T> | CustomChoiceType<P, T>;
12226
- interface PlainStringType<T extends string = string> extends BaseParam {
12228
+ interface PlainStringType<T extends Nullish<string> = string> extends BaseParam {
12227
12229
  type: "string" | `'${T}'`;
12228
12230
  }
12229
- type StringType<P, T extends string = string> = "string" | PlainStringType<T> | ChoiceType<P, T> | AnyType;
12230
- interface PlainNumberType<T extends number = number> extends BaseParam {
12231
+ type StringType<P, T extends Nullish<string> = string> = "string" | PlainStringType<T> | ChoiceType<P, T> | AnyType;
12232
+ interface PlainNumberType<T extends Nullish<number> = number> extends BaseParam {
12231
12233
  type: "number" | `${number extends T ? number : T}`;
12232
12234
  }
12233
- type NumberType<P, T extends number = number> = PlainNumberType<T> | ChoiceType<P, T> | AnyType;
12234
- interface PlainBooleanType<T extends boolean = boolean> extends BaseParam {
12235
+ type NumberType<P, T extends Nullish<number> = number> = PlainNumberType<T> | ChoiceType<P, T> | AnyType;
12236
+ interface PlainBooleanType<T extends Nullish<boolean> = boolean> extends BaseParam {
12235
12237
  type: "boolean" | `${boolean extends T ? boolean : T}`;
12236
12238
  }
12237
- type BooleanType<P, T extends boolean = boolean> = PlainBooleanType<T> | ChoiceType<P, T> | AnyType;
12239
+ type BooleanType<P, T extends Nullish<boolean> = boolean> = PlainBooleanType<T> | ChoiceType<P, T> | AnyType;
12238
12240
  type GraphQLValue = {
12239
12241
  query: string;
12240
12242
  variables?: Record<string, any>;
@@ -12273,7 +12275,7 @@ type VoidType = PlainVoidType | AnyType;
12273
12275
  type IsAny<T> = 0 extends 1 & T ? true : false;
12274
12276
  type CommonType<P, T> = T extends GraphQLValue ? GraphQLType<P> : T extends null ? NullType : T extends undefined ? UndefinedType : T extends Array<any> ? ArrayType : T extends object ? ObjectType : AnyType;
12275
12277
  type AnyTyping<P, T> = T extends string ? StringType<P, T> : T extends number ? NumberType<P, T> : T extends boolean ? BooleanType<P, T> : CommonType<P, T>;
12276
- type RestrictedType<P, T> = IsAny<T> extends true ? AnyTyping<P, T> : [T] extends [string] ? StringType<P, T> : [T] extends [number] ? NumberType<P, T> : [T] extends [boolean] ? BooleanType<P, T> : CommonType<P, T>;
12278
+ type RestrictedType<P, T> = IsAny<T> extends true ? AnyTyping<P, T> : [T] extends [Nullish<string>] ? StringType<P, T> : [T] extends [Nullish<number>] ? NumberType<P, T> : [T] extends [Nullish<boolean>] ? BooleanType<P, T> : CommonType<P, T>;
12277
12279
  type ParamType<P, T> = RestrictedType<P, T>;
12278
12280
  type RequiredParam<P, T> = ParamType<P, T> & {
12279
12281
  isOptional?: false;
@@ -12950,189 +12952,7 @@ declare function Trans({ transKey, children }: TransProps): React__default.React
12950
12952
 
12951
12953
 
12952
12954
 
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 {
12955
+ interface AriaLabelingProps$1 {
13136
12956
  /**
13137
12957
  * Defines a string value that labels the current element.
13138
12958
  */
@@ -13164,14 +12984,14 @@ interface AriaValidationProps {
13164
12984
 
13165
12985
  // A set of common DOM props that are allowed on any component
13166
12986
  // Ensure this is synced with DOMPropNames in filterDOMProps
13167
- interface DOMProps$2 {
12987
+ interface DOMProps$1 {
13168
12988
  /**
13169
12989
  * The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
13170
12990
  */
13171
12991
  id?: string
13172
12992
  }
13173
12993
 
13174
- interface FocusableDOMProps$2 extends DOMProps$2 {
12994
+ interface FocusableDOMProps$1 extends DOMProps$1 {
13175
12995
  /**
13176
12996
  * Whether to exclude the element from the sequential tab order. If true,
13177
12997
  * the element will not be focusable via the keyboard by tabbing. This should
@@ -13181,13 +13001,25 @@ interface FocusableDOMProps$2 extends DOMProps$2 {
13181
13001
  excludeFromTabOrder?: boolean
13182
13002
  }
13183
13003
 
13184
- interface InputDOMProps$1 {
13004
+ interface InputDOMProps {
13185
13005
  /**
13186
13006
  * 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).
13187
13007
  */
13188
13008
  name?: string
13189
13009
  }
13190
13010
 
13011
+ /** Any focusable element, including both HTML and SVG elements. */
13012
+ interface FocusableElement extends Element, HTMLOrSVGElement {}
13013
+
13014
+ /** All DOM attributes supported across both HTML and SVG elements. */
13015
+ interface DOMAttributes<T = FocusableElement> extends AriaAttributes, DOMAttributes$1<T> {
13016
+ id?: string | undefined,
13017
+ role?: AriaRole | undefined,
13018
+ tabIndex?: number | undefined,
13019
+ style?: CSSProperties$1 | undefined,
13020
+ className?: string | undefined
13021
+ }
13022
+
13191
13023
  /*
13192
13024
  * Copyright 2020 Adobe. All rights reserved.
13193
13025
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -13229,7 +13061,7 @@ interface Validation<T = unknown> {
13229
13061
  validate?: (value: T) => ValidationError | true | null | undefined
13230
13062
  }
13231
13063
 
13232
- interface InputBase$2 {
13064
+ interface InputBase$1 {
13233
13065
  /** Whether the input is disabled. */
13234
13066
  isDisabled?: boolean,
13235
13067
  /** Whether the input can be selected but not changed by the user. */
@@ -13250,38 +13082,12 @@ interface InputBase$2 {
13250
13082
 
13251
13083
 
13252
13084
 
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
- }
13262
-
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
- }
13085
+ type SelectionMode = 'none' | 'single' | 'multiple';
13086
+ type SelectionBehavior = 'toggle' | 'replace';
13087
+ type Selection = 'all' | Set<Key>;
13280
13088
 
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
- }
13089
+ type FocusStrategy$1 = 'first' | 'last';
13090
+ type DisabledBehavior = 'selection' | 'all';
13285
13091
 
13286
13092
  /*
13287
13093
  * Copyright 2020 Adobe. All rights reserved.
@@ -13297,172 +13103,107 @@ interface FocusableProps$2<Target = Element> extends FocusEvents$2<Target>, Keyb
13297
13103
 
13298
13104
 
13299
13105
 
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
13106
+ interface Rect {
13107
+ x: number,
13108
+ y: number,
13109
+ width: number,
13110
+ height: number
13313
13111
  }
13314
13112
 
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
13113
+ interface Size {
13114
+ width: number,
13115
+ height: number
13324
13116
  }
13325
13117
 
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
- }
13332
-
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
13118
+ /** A LayoutDelegate provides layout information for collection items. */
13119
+ interface LayoutDelegate {
13120
+ /** Returns a rectangle for the item with the given key. */
13121
+ getItemRect(key: Key): Rect | null,
13122
+ /** Returns the visible rectangle of the collection. */
13123
+ getVisibleRect(): Rect,
13124
+ /** Returns the size of the scrollable content in the collection. */
13125
+ getContentSize(): Size,
13126
+ /** Returns a list of keys between `from` and `to`. */
13127
+ getKeyRange?(from: Key, to: Key): Key[]
13339
13128
  }
13340
13129
 
13341
- interface AriaCheckboxProps extends CheckboxProps$1, AriaToggleProps {}
13130
+ /**
13131
+ * A generic interface to access a readonly sequential
13132
+ * collection of unique keyed items.
13133
+ */
13134
+ interface Collection<T> extends Iterable<T> {
13135
+ /** The number of items in the collection. */
13136
+ readonly size: number,
13342
13137
 
13343
- interface StyleProps {
13344
- className?: string;
13345
- style?: React$1.CSSProperties;
13346
- }
13347
- declare function getDataProps(props: Record<string, any>): Partial<Record<string, any>>;
13138
+ /** Iterate over all keys in the collection. */
13139
+ getKeys(): Iterable<Key>,
13348
13140
 
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>;
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
- };
13141
+ /** Get an item by its key. */
13142
+ getItem(key: Key): T | null,
13391
13143
 
13392
- /*
13393
- * Copyright 2020 Adobe. All rights reserved.
13394
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13395
- * you may not use this file except in compliance with the License. You may obtain a copy
13396
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
13397
- *
13398
- * Unless required by applicable law or agreed to in writing, software distributed under
13399
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13400
- * OF ANY KIND, either express or implied. See the License for the specific language
13401
- * governing permissions and limitations under the License.
13402
- */
13144
+ /** Get an item by the index of its key. */
13145
+ at(idx: number): T | null,
13403
13146
 
13147
+ /** Get the key that comes before the given key in the collection. */
13148
+ getKeyBefore(key: Key): Key | null,
13404
13149
 
13150
+ /** Get the key that comes after the given key in the collection. */
13151
+ getKeyAfter(key: Key): Key | null,
13405
13152
 
13406
- interface AriaLabelingProps$1 {
13407
- /**
13408
- * Defines a string value that labels the current element.
13409
- */
13410
- 'aria-label'?: string,
13153
+ /** Get the first key in the collection. */
13154
+ getFirstKey(): Key | null,
13411
13155
 
13412
- /**
13413
- * Identifies the element (or elements) that labels the current element.
13414
- */
13415
- 'aria-labelledby'?: string,
13156
+ /** Get the last key in the collection. */
13157
+ getLastKey(): Key | null,
13416
13158
 
13417
- /**
13418
- * Identifies the element (or elements) that describes the object.
13419
- */
13420
- 'aria-describedby'?: string,
13159
+ /** Iterate over the child items of the given key. */
13160
+ getChildren?(key: Key): Iterable<T>,
13421
13161
 
13422
- /**
13423
- * Identifies the element (or elements) that provide a detailed, extended description for the object.
13424
- */
13425
- 'aria-details'?: string
13426
- }
13162
+ /** Returns a string representation of the item's contents. */
13163
+ getTextValue?(key: Key): string,
13427
13164
 
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
13165
+ /** Filters the collection using the given function. */
13166
+ UNSTABLE_filter?(filterFn: (nodeValue: string) => boolean): Collection<T>
13435
13167
  }
13436
13168
 
13437
- interface FocusableDOMProps$1 extends DOMProps$1 {
13169
+ interface Node<T> {
13170
+ /** The type of item this node represents. */
13171
+ type: string,
13172
+ /** A unique key for the node. */
13173
+ key: Key,
13174
+ /** The object value the node was created from. */
13175
+ value: T | null,
13176
+ /** The level of depth this node is at in the hierarchy. */
13177
+ level: number,
13178
+ /** Whether this item has children, even if not loaded yet. */
13179
+ hasChildNodes: boolean,
13438
13180
  /**
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.
13181
+ * The loaded children of this node.
13182
+ * @deprecated Use `collection.getChildren(node.key)` instead.
13443
13183
  */
13444
- excludeFromTabOrder?: boolean
13445
- }
13446
-
13447
- /*
13448
- * Copyright 2020 Adobe. All rights reserved.
13449
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13450
- * you may not use this file except in compliance with the License. You may obtain a copy
13451
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
13452
- *
13453
- * Unless required by applicable law or agreed to in writing, software distributed under
13454
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13455
- * OF ANY KIND, either express or implied. See the License for the specific language
13456
- * governing permissions and limitations under the License.
13457
- */
13458
-
13459
-
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
13184
+ childNodes: Iterable<Node<T>>,
13185
+ /** The rendered contents of this node (e.g. JSX). */
13186
+ rendered: ReactNode,
13187
+ /** A string value for this node, used for features like typeahead. */
13188
+ textValue: string,
13189
+ /** An accessibility label for this node. */
13190
+ 'aria-label'?: string,
13191
+ /** The index of this node within its parent. */
13192
+ index: number,
13193
+ /** A function that should be called to wrap the rendered node. */
13194
+ wrapper?: (element: ReactElement) => ReactElement,
13195
+ /** The key of the parent node. */
13196
+ parentKey?: Key | null,
13197
+ /** The key of the node before this node. */
13198
+ prevKey?: Key | null,
13199
+ /** The key of the node after this node. */
13200
+ nextKey?: Key | null,
13201
+ /** Additional properties specific to a particular node type. */
13202
+ props?: any,
13203
+ /** @private */
13204
+ shouldInvalidate?: (context: any) => boolean,
13205
+ /** A function that renders this node to a React Element in the DOM. */
13206
+ render?: (node: Node<any>) => ReactElement
13466
13207
  }
13467
13208
 
13468
13209
  /*
@@ -13479,22 +13220,6 @@ interface InputBase$1 {
13479
13220
 
13480
13221
 
13481
13222
 
13482
- type FocusStrategy$1 = 'first' | 'last';
13483
-
13484
- /*
13485
- * Copyright 2020 Adobe. All rights reserved.
13486
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13487
- * you may not use this file except in compliance with the License. You may obtain a copy
13488
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
13489
- *
13490
- * Unless required by applicable law or agreed to in writing, software distributed under
13491
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13492
- * OF ANY KIND, either express or implied. See the License for the specific language
13493
- * governing permissions and limitations under the License.
13494
- */
13495
-
13496
-
13497
-
13498
13223
  // Event bubbling can be problematic in real-world applications, so the default for React Spectrum components
13499
13224
  // is not to propagate. This can be overridden by calling continuePropagation() on the event.
13500
13225
  type BaseEvent$1<T extends SyntheticEvent> = T & {
@@ -13505,7 +13230,41 @@ type BaseEvent$1<T extends SyntheticEvent> = T & {
13505
13230
  continuePropagation(): void
13506
13231
  }
13507
13232
 
13508
- type KeyboardEvent$1 = BaseEvent$1<KeyboardEvent$3<any>>;
13233
+ type KeyboardEvent$1 = BaseEvent$1<KeyboardEvent$2<any>>;
13234
+
13235
+ type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';
13236
+
13237
+ interface PressEvent {
13238
+ /** The type of press event being fired. */
13239
+ type: 'pressstart' | 'pressend' | 'pressup' | 'press',
13240
+ /** The pointer type that triggered the press event. */
13241
+ pointerType: PointerType,
13242
+ /** The target element of the press event. */
13243
+ target: Element,
13244
+ /** Whether the shift keyboard modifier was held during the press event. */
13245
+ shiftKey: boolean,
13246
+ /** Whether the ctrl keyboard modifier was held during the press event. */
13247
+ ctrlKey: boolean,
13248
+ /** Whether the meta keyboard modifier was held during the press event. */
13249
+ metaKey: boolean,
13250
+ /** Whether the alt keyboard modifier was held during the press event. */
13251
+ altKey: boolean,
13252
+ /** X position relative to the target. */
13253
+ x: number,
13254
+ /** Y position relative to the target. */
13255
+ y: number,
13256
+ /**
13257
+ * By default, press events stop propagation to parent elements.
13258
+ * In cases where a handler decides not to handle a specific event,
13259
+ * it can call `continuePropagation()` to allow a parent to handle it.
13260
+ */
13261
+ continuePropagation(): void
13262
+ }
13263
+
13264
+ interface LongPressEvent extends Omit<PressEvent, 'type' | 'continuePropagation'> {
13265
+ /** The type of long press event being fired. */
13266
+ type: 'longpressstart' | 'longpressend' | 'longpress'
13267
+ }
13509
13268
 
13510
13269
  interface KeyboardEvents$1 {
13511
13270
  /** Handler that is called when a key is pressed. */
@@ -13528,199 +13287,8 @@ interface FocusableProps$1<Target = Element> extends FocusEvents$1<Target>, Keyb
13528
13287
  autoFocus?: boolean
13529
13288
  }
13530
13289
 
13531
- interface BaseMenuProps extends DOMProps$1, AriaLabelingProps$1, StyleProps {
13532
- /**
13533
- * List of `Menu.Item`s or `Menu.Group`s that make up the menu
13534
- */
13535
- children?: React$1.ReactNode;
13536
- /**
13537
- * Called with the value of a `Menu.Item` when it is selected.
13538
- */
13539
- onAction?: (value: string) => void;
13540
- }
13541
- type MenuRef = React$1.Ref<MenuRefValue>;
13542
- interface MenuRefValue extends MenuState {
13543
- getRoot: () => HTMLElement | null;
13544
- }
13545
- interface MenuConfig<C extends AnyPlasmicClass> {
13546
- isPlacedTopVariant?: VariantDef<PlasmicClassVariants<C>>;
13547
- isPlacedBottomVariant?: VariantDef<PlasmicClassVariants<C>>;
13548
- isPlacedLeftVariant?: VariantDef<PlasmicClassVariants<C>>;
13549
- isPlacedRightVariant?: VariantDef<PlasmicClassVariants<C>>;
13550
- itemsSlot: keyof PlasmicClassArgs<C>;
13551
- itemsContainer: keyof PlasmicClassOverrides<C>;
13552
- root: keyof PlasmicClassOverrides<C>;
13553
- }
13554
- interface MenuState {
13555
- getFocusedValue: () => string | null;
13556
- setFocusedValue: (value: string) => void;
13557
- }
13558
- declare function useMenu<P extends BaseMenuProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: MenuConfig<C>, ref?: MenuRef): {
13559
- plasmicProps: {
13560
- variants: PlasmicClassVariants<C>;
13561
- args: PlasmicClassArgs<C>;
13562
- overrides: PlasmicClassOverrides<C>;
13563
- };
13564
- state: MenuState;
13565
- };
13566
-
13567
- /**
13568
- * In general, we try not to expose react-aria's Collections API to Plume users.
13569
- * The Collections API is how react-aria users pass data about collections of
13570
- * things using the built-in Item and Section components, which are abstract,
13571
- * metadata-only components that don't render anything but only serve to specify
13572
- * data. For example, here's how you would use react-spectrum's Picker:
13573
- *
13574
- * <Picker>
13575
- * <Section title="Asia">
13576
- * <Item key="taiwan">Taiwan</Item>
13577
- * <Item key="japan">Japan</Item>
13578
- * <Item key="china">China</Item>
13579
- * </Section>
13580
- * <Section title="Europe">
13581
- * <Item key="germany">Germany</Item>
13582
- * <Item key="france">France</Item>
13583
- * </Section>
13584
- * </Picker>
13585
- *
13586
- * You would re-use this same Item/Section components to pass similar things to
13587
- * Menu, Tabs, etc.
13588
- *
13589
- * For Plasmic, this API is too abstract. The user has explicitly designed components
13590
- * like Select.Option and Select.OptionGroup, and it is weird that they don't actually
13591
- * use these components. It is more natural to do:
13592
- *
13593
- * <Select>
13594
- * <Select.OptionGroup title="Asia">
13595
- * <Select.Option key="taiwan">Taiwan</Select>
13596
- * </Select.OptionGroup>
13597
- * </Select>
13598
- *
13599
- * For Plume, we let users directly use the components they designed, both to collect
13600
- * information and to perform actual rendering. For example, for Plume,
13601
- * you'd use Select.Option instead of Item, and Select.OptionGroup instead of Section.
13602
- * This means that the Select.Option props will collect the same information Item
13603
- * does.
13604
- *
13605
- * A component like Select.Option then serves two purposes:
13606
- *
13607
- * 1. Allow users to specify the collection of data, like in the above example
13608
- * Here, we're mainly interested in the props in those ReactElements so
13609
- * we can pass the Item/Section data onto react-aria's APIs. We are not
13610
- * actually rendering these elements.
13611
- * 2. Once react-aria's Collections API has gone through them and built
13612
- * Collection "nodes", we then create cloned versions of these elements
13613
- * with the corresponding node passed in as a secret prop. These ReactElements
13614
- * are then actually used to _render_ the corresponding Option / OptionGroup.
13615
- *
13616
- * This file contains helper functions to help with implementing the above.
13617
- *
13618
- * Note also that most of the collections-based react-aria components expose
13619
- * a parallel API that accepts a list of "items" and a render prop, instead
13620
- * of list of Item/Section elements. This is for efficiency, but we are opting
13621
- * to only support the composite-component pattern for now for simplicity.
13622
- */
13623
-
13624
- /**
13625
- * Props for a Plume component that corresponds to an Item
13626
- */
13627
- interface ItemLikeProps {
13628
- /**
13629
- * value key corresponding to this item. Not required if you use the
13630
- * `key` prop instead.
13631
- */
13632
- value?: string | null;
13633
- /**
13634
- * The text string value corresponding to this item. Used to support
13635
- * keyboard type-ahead. If not specified, then will be derived from
13636
- * `children` if it is a string, or the `value` or `key`.
13637
- */
13638
- textValue?: string;
13639
- /**
13640
- * aria-label for this item.
13641
- */
13642
- "aria-label"?: string;
13643
- /**
13644
- * Primary content label for this item.
13645
- */
13646
- children?: React__default.ReactNode;
13647
- /**
13648
- * If true, this item will not be selectable.
13649
- */
13650
- isDisabled?: boolean;
13651
- }
13652
- /**
13653
- * Props for a Plume component that corresponds to a Section
13654
- */
13655
- interface SectionLikeProps {
13656
- /**
13657
- * Heading content of the title
13658
- */
13659
- title?: React__default.ReactNode;
13660
- /**
13661
- * aria-label for this section
13662
- */
13663
- "aria-label"?: string;
13664
- /**
13665
- * A list of items that belong in this group
13666
- */
13667
- children?: React__default.ReactNode;
13668
- }
13669
- type ItemJson = LeafItemJson | SectionJson;
13670
- type LeafItemJson = string | {
13671
- value: string;
13672
- label?: string;
13673
- textValue?: string;
13674
- isDisabled?: boolean;
13675
- };
13676
- interface SectionJson {
13677
- title: string;
13678
- children: ItemJson[];
13679
- }
13680
-
13681
- interface BaseMenuGroupProps extends SectionLikeProps, StyleProps {
13682
- }
13683
- interface MenuGroupConfig<C extends AnyPlasmicClass> {
13684
- noTitleVariant: PlasmicClassVariants<C>;
13685
- isFirstVariant: PlasmicClassVariants<C>;
13686
- itemsSlot: keyof PlasmicClassArgs<C>;
13687
- titleSlot: keyof PlasmicClassArgs<C>;
13688
- root: keyof PlasmicClassOverrides<C>;
13689
- separator: keyof PlasmicClassOverrides<C>;
13690
- titleContainer: keyof PlasmicClassOverrides<C>;
13691
- itemsContainer: keyof PlasmicClassOverrides<C>;
13692
- }
13693
- declare function useMenuGroup<P extends BaseMenuGroupProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: MenuGroupConfig<C>): {
13694
- plasmicProps: {
13695
- variants: PlasmicClassVariants<C>;
13696
- args: PlasmicClassArgs<C>;
13697
- overrides: PlasmicClassOverrides<C>;
13698
- };
13699
- };
13700
-
13701
- interface BaseMenuItemProps extends ItemLikeProps {
13702
- /**
13703
- * Called when this item is selected
13704
- */
13705
- onAction?: (key: string) => void;
13706
- }
13707
- interface MenuItemConfig<C extends AnyPlasmicClass> {
13708
- isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13709
- isHighlightedVariant?: VariantDef<PlasmicClassVariants<C>>;
13710
- labelSlot: keyof PlasmicClassArgs<C>;
13711
- root: keyof PlasmicClassOverrides<C>;
13712
- labelContainer: keyof PlasmicClassOverrides<C>;
13713
- }
13714
- declare function useMenuItem<P extends BaseMenuItemProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: MenuItemConfig<C>): {
13715
- plasmicProps: {
13716
- variants: PlasmicClassVariants<C>;
13717
- args: PlasmicClassArgs<C>;
13718
- overrides: PlasmicClassOverrides<C>;
13719
- };
13720
- };
13721
-
13722
13290
  /*
13723
- * Copyright 2020 Adobe. All rights reserved.
13291
+ * Copyright 2023 Adobe. All rights reserved.
13724
13292
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13725
13293
  * you may not use this file except in compliance with the License. You may obtain a copy
13726
13294
  * of the License at http://www.apache.org/licenses/LICENSE-2.0
@@ -13731,248 +13299,131 @@ declare function useMenuItem<P extends BaseMenuItemProps, C extends AnyPlasmicCl
13731
13299
  * governing permissions and limitations under the License.
13732
13300
  */
13733
13301
 
13302
+ type Key = string | number;
13734
13303
 
13304
+ interface PressResult {
13305
+ /** Whether the target is currently pressed. */
13306
+ isPressed: boolean;
13307
+ /** Props to spread on the target element. */
13308
+ pressProps: DOMAttributes;
13309
+ }
13310
+ interface HoverResult {
13311
+ /** Props to spread on the target element. */
13312
+ hoverProps: DOMAttributes;
13313
+ isHovered: boolean;
13314
+ }
13735
13315
 
13736
- type Placement = 'bottom' | 'bottom left' | 'bottom right' | 'bottom start' | 'bottom end' |
13737
- 'top' | 'top left' | 'top right' | 'top start' | 'top end' |
13738
- 'left' | 'left top' | 'left bottom' | 'start' | 'start top' | 'start bottom' |
13739
- 'right' | 'right top' | 'right bottom' | 'end' | 'end top' | 'end bottom';
13740
-
13741
- interface DropdownMenuProps {
13742
- /**
13743
- * A ReactElement that takes in a `ref` as well as the usual mouse and
13744
- * pointer events. The dropdown menu will be positioned relative to this
13745
- * trigger.
13746
- */
13747
- children: React$1.ReactElement;
13748
- /**
13749
- * The menu to show; must be either a ReactElement of Menu type, or
13750
- * a function that creates one if you prefer to delay creating it until
13751
- * the menu has been triggered.
13752
- */
13753
- menu: React$1.ReactElement<BaseMenuProps> | (() => React$1.ReactElement<BaseMenuProps>);
13754
- /**
13755
- * Where to place the menu relative to the trigger.
13756
- */
13757
- placement?: Placement;
13758
- /**
13759
- * Whether the menu is currently shown.
13760
- */
13761
- isOpen?: boolean;
13762
- /**
13763
- * Uncontrolled open state.
13764
- */
13765
- defaultOpen?: boolean;
13766
- /**
13767
- * Event handler fired when Menu's open state changes
13768
- */
13769
- onOpenChange?: (isOpen: boolean) => void;
13316
+ interface FocusRingAria {
13317
+ /** Whether the element is currently focused. */
13318
+ isFocused: boolean;
13319
+ /** Whether keyboard focus should be visible. */
13320
+ isFocusVisible: boolean;
13321
+ /** Props to apply to the container element with the focus ring. */
13322
+ focusProps: DOMAttributes;
13770
13323
  }
13771
- declare function DropdownMenu(props: DropdownMenuProps): React$1.JSX.Element;
13772
13324
 
13773
- interface BaseMenuButtonProps extends DOMProps$1, FocusableProps$1, StyleProps, Pick<React$1.ComponentProps<"button">, "title"> {
13774
- /**
13775
- * The menu to show; can either be a Menu instance, or a function that returns a Menu
13776
- * instance if you want to defer creating the instance till when it's opened.
13777
- */
13778
- menu: React$1.ReactElement<BaseMenuProps> | (() => React$1.ReactElement<BaseMenuProps>);
13779
- /**
13780
- * Whether the button is disabled
13781
- */
13782
- isDisabled?: boolean;
13783
- /**
13784
- * Whether the menu is currently shown.
13785
- */
13786
- isOpen?: boolean;
13787
- /**
13788
- * Uncontrolled open state
13789
- */
13790
- defaultOpen?: boolean;
13791
- /**
13792
- * Event handler fired when Menu's open state changes
13793
- */
13794
- onOpenChange?: (isOpen: boolean) => void;
13795
- /**
13796
- * Desired placement location of the Select dropdown
13797
- */
13798
- placement?: Placement;
13799
- /**
13800
- * If true, menu width will always match the trigger button width.
13801
- * If false, then menu width will have min-width matching the
13802
- * trigger button width.
13803
- */
13804
- menuMatchTriggerWidth?: boolean;
13805
- /**
13806
- * If set, menu width will be exactly this width, overriding
13807
- * menuMatchTriggerWidth.
13808
- */
13809
- menuWidth?: number;
13810
- }
13811
- interface MenuButtonConfig<C extends AnyPlasmicClass> {
13812
- isOpenVariant: VariantDef<PlasmicClassVariants<C>>;
13813
- isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13814
- menuSlot: keyof PlasmicClassArgs<C>;
13815
- root: keyof PlasmicClassOverrides<C>;
13816
- trigger: keyof PlasmicClassOverrides<C>;
13817
- }
13818
- interface MenuButtonState {
13819
- open: () => void;
13820
- close: () => void;
13821
- isOpen: () => boolean;
13822
- }
13823
- type MenuButtonRef = React$1.Ref<MenuButtonRefValue>;
13824
- interface MenuButtonRefValue extends MenuButtonState {
13825
- getRoot: () => HTMLElement | null;
13826
- getTrigger: () => HTMLElement | null;
13827
- focus: () => void;
13828
- blur: () => void;
13325
+ type FocusHookResult = [boolean, FocusRingAria["focusProps"]];
13326
+ type HoverHookResult = [boolean, HoverResult["hoverProps"]];
13327
+ type PressHookResult = [boolean, PressResult["pressProps"]];
13328
+ declare function useFocused(opts: {
13329
+ isTextInput?: boolean;
13330
+ }): FocusHookResult;
13331
+ declare function useFocusVisible(opts: {
13332
+ isTextInput?: boolean;
13333
+ }): FocusHookResult;
13334
+ declare function useFocusedWithin(opts: {
13335
+ isTextInput?: boolean;
13336
+ }): FocusHookResult;
13337
+ declare function useFocusVisibleWithin(opts: {
13338
+ isTextInput?: boolean;
13339
+ }): FocusHookResult;
13340
+ declare function useHover(): HoverHookResult;
13341
+ declare function usePressed(): PressHookResult;
13342
+ declare const TRIGGER_TO_HOOK: {
13343
+ readonly useHover: typeof useHover;
13344
+ readonly useFocused: typeof useFocused;
13345
+ readonly useFocusVisible: typeof useFocusVisible;
13346
+ readonly useFocusedWithin: typeof useFocusedWithin;
13347
+ readonly useFocusVisibleWithin: typeof useFocusVisibleWithin;
13348
+ readonly usePressed: typeof usePressed;
13349
+ };
13350
+ type TriggerType = keyof typeof TRIGGER_TO_HOOK;
13351
+ interface TriggerOpts {
13352
+ isTextInput?: boolean;
13829
13353
  }
13830
- declare function useMenuButton<P extends BaseMenuButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: MenuButtonConfig<C>, outerRef?: MenuButtonRef): {
13831
- plasmicProps: {
13832
- variants: PlasmicClassVariants<C>;
13833
- args: PlasmicClassArgs<C>;
13834
- overrides: PlasmicClassOverrides<C>;
13835
- };
13836
- state: MenuButtonState;
13354
+ /**
13355
+ * Installs argment trigger. All the useTrigger calls must use hardcoded `trigger` arg,
13356
+ * as it's not valid to install variable React hooks!
13357
+ */
13358
+ declare function useTrigger(trigger: TriggerType, opts: TriggerOpts): [boolean, React$1.HTMLAttributes<HTMLElement>];
13359
+
13360
+ declare const classNames: any;
13361
+
13362
+ declare function setPlumeStrictMode(mode: boolean): void;
13363
+ type VariantArgChoices<T> = T extends (infer M)[] ? M : T extends SingleChoiceArg<infer M> ? M : never;
13364
+ type VariantArgsChoices<V> = {
13365
+ [k in keyof V]-?: VariantArgChoices<V[k]>;
13366
+ };
13367
+ type DictValues<V extends Record<string, any>> = V[keyof V];
13368
+ type DictTuples<V extends Record<string, any>> = DictValues<{
13369
+ [K in keyof V]: [K, V[K]];
13370
+ }>;
13371
+ type VariantDefTuple<V> = DictTuples<VariantArgsChoices<V>>;
13372
+ type DistributeTuple<T> = T extends [infer T1, infer T2] ? {
13373
+ group: T1;
13374
+ variant: T2;
13375
+ } : never;
13376
+ type VariantDef<V> = DistributeTuple<VariantDefTuple<V>>;
13377
+ type PlasmicClass<V extends Record<string, any>, A extends Record<string, any>, O extends Record<string, any>> = {
13378
+ (props: {
13379
+ variants?: V;
13380
+ args?: A;
13381
+ overrides?: O;
13382
+ }): React$1.ReactNode;
13383
+ internalVariantProps: (keyof V)[];
13384
+ internalArgProps: (keyof A)[];
13837
13385
  };
13386
+ type AnyPlasmicClass = PlasmicClass<any, any, any>;
13387
+ type PlasmicClassVariants<C extends AnyPlasmicClass> = C extends PlasmicClass<infer V, any, any> ? V : unknown;
13388
+ type PlasmicClassArgs<C extends AnyPlasmicClass> = C extends PlasmicClass<any, infer A, any> ? A : unknown;
13389
+ type PlasmicClassOverrides<C extends AnyPlasmicClass> = C extends PlasmicClass<any, any, infer O> ? O : unknown;
13838
13390
 
13839
- interface BaseSelectProps extends DOMProps$1, AriaLabelingProps$1, FocusableDOMProps$1, InputBase$1, FocusableProps$1, StyleProps {
13840
- /**
13841
- * Key of the currently selected value
13842
- */
13843
- value?: string | null;
13844
- /**
13845
- * Event handler fired when currently selected value changes
13846
- */
13847
- onChange?: (value: string | null) => void;
13848
- /**
13849
- * Uncontrolled key of the default selected value
13850
- */
13851
- defaultValue?: string;
13852
- /**
13853
- * List of Select.Options
13854
- */
13391
+ interface PlumeCommonProps {
13392
+ showStartIcon?: boolean;
13393
+ showEndIcon?: boolean;
13394
+ startIcon?: React$1.ReactNode;
13395
+ endIcon?: React$1.ReactNode;
13855
13396
  children?: React$1.ReactNode;
13856
- /**
13857
- * List of options as an array, instead of using `children` prop. If this
13858
- * is passed in, then `children` is ignored.
13859
- *
13860
- * The options can be a list of strings, or a list of objects with
13861
- * fields `value` (for the value of the option), `label` (for what's rendered
13862
- * in the option), and `isDisabled` (if the option should be disabled).
13863
- */
13864
- options?: ItemJson[];
13865
- /**
13866
- * Whether the Select is currently open
13867
- */
13868
- isOpen?: boolean;
13869
- /**
13870
- * Event handler fired when Select's open state changes
13871
- */
13872
- onOpenChange?: (isOpen: boolean) => void;
13873
- /**
13874
- * Uncontrolled default open state
13875
- */
13876
- defaultOpen?: boolean;
13877
- /**
13878
- * Form name of the select element
13879
- */
13880
- name?: string;
13881
- /**
13882
- * By default, Select will render whatever is in Select.Option as the
13883
- * content in the trigger button when it is selected. You can override
13884
- * what content by passing in `selectedContent` here.
13885
- */
13886
- selectedContent?: React$1.ReactNode;
13887
- /**
13888
- * Desired placement location of the Select dropdown
13889
- */
13890
- placement?: Placement;
13891
- /**
13892
- * If true, menu width will always match the trigger button width.
13893
- * If false, then menu width will have min-width matching the
13894
- * trigger button width.
13895
- */
13896
- menuMatchTriggerWidth?: boolean;
13897
- /**
13898
- * If set, menu width will be exactly this width, overriding
13899
- * menuMatchTriggerWidth.
13900
- */
13901
- menuWidth?: number;
13902
- /**
13903
- * Content to display when nothing is selected.
13904
- */
13905
- placeholder?: React$1.ReactNode;
13397
+ isDisabled?: boolean;
13906
13398
  }
13907
- type SelectRef = React$1.Ref<SelectRefValue>;
13908
- interface SelectRefValue extends SelectState {
13909
- getTrigger: () => HTMLElement | null;
13910
- getRoot: () => HTMLElement | null;
13911
- focus: () => void;
13912
- blur: () => void;
13399
+ interface HtmlButtonProps extends Omit<React$1.ComponentProps<"button">, "ref" | "disabled"> {
13913
13400
  }
13914
- interface SelectConfig<C extends AnyPlasmicClass> {
13915
- placeholderVariant?: VariantDef<PlasmicClassVariants<C>>;
13916
- isOpenVariant: VariantDef<PlasmicClassVariants<C>>;
13917
- isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13918
- triggerContentSlot: keyof PlasmicClassArgs<C>;
13919
- optionsSlot: keyof PlasmicClassArgs<C>;
13920
- placeholderSlot: keyof PlasmicClassArgs<C>;
13921
- root: keyof PlasmicClassOverrides<C>;
13922
- trigger: keyof PlasmicClassOverrides<C>;
13923
- overlay: keyof PlasmicClassOverrides<C>;
13924
- optionsContainer: keyof PlasmicClassOverrides<C>;
13925
- OptionComponent?: React$1.ComponentType<ItemLikeProps>;
13926
- OptionGroupComponent?: React$1.ComponentType<SectionLikeProps>;
13401
+ interface HtmlAnchorProps extends Omit<React$1.ComponentProps<"a">, "ref" | "href" | "target"> {
13927
13402
  }
13928
- interface SelectState {
13929
- open: () => void;
13930
- close: () => void;
13931
- isOpen: () => boolean;
13932
- getSelectedValue: () => string | null;
13933
- setSelectedValue: (value: string | null) => void;
13403
+ interface PlumeActualButtonProps {
13404
+ submitsForm?: boolean;
13934
13405
  }
13935
- declare function useSelect<P extends BaseSelectProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: SelectConfig<C>, ref?: React$1.Ref<SelectRefValue>): {
13936
- plasmicProps: {
13937
- variants: PlasmicClassVariants<C>;
13938
- args: PlasmicClassArgs<C>;
13939
- overrides: PlasmicClassOverrides<C>;
13940
- };
13941
- state: SelectState;
13942
- };
13943
-
13944
- interface BaseSelectOptionProps extends ItemLikeProps, StyleProps {
13406
+ interface PlumeAnchorProps {
13407
+ link?: string;
13408
+ target?: React$1.ComponentProps<"a">["target"] | boolean;
13945
13409
  }
13946
- interface SelectOptionConfig<C extends AnyPlasmicClass> {
13947
- isSelectedVariant: VariantDef<PlasmicClassVariants<C>>;
13410
+ type PlumeButtonProps = PlumeCommonProps & PlumeActualButtonProps & PlumeAnchorProps;
13411
+ type BaseButtonProps = PlumeButtonProps & HtmlButtonProps & HtmlAnchorProps;
13412
+ type AllButtonProps = PlumeCommonProps & PlumeActualButtonProps & HtmlButtonProps;
13413
+ type AllAnchorProps = PlumeCommonProps & PlumeAnchorProps & HtmlAnchorProps;
13414
+ type HtmlAnchorOnlyProps = Exclude<keyof AllAnchorProps, keyof AllButtonProps>;
13415
+ type HtmlButtonOnlyProps = Exclude<keyof AllButtonProps, keyof AllAnchorProps>;
13416
+ type ButtonRef = React$1.Ref<HTMLButtonElement | HTMLAnchorElement>;
13417
+ interface ButtonConfig<C extends AnyPlasmicClass> {
13418
+ showStartIconVariant: VariantDef<PlasmicClassVariants<C>>;
13419
+ showEndIconVariant?: VariantDef<PlasmicClassVariants<C>>;
13948
13420
  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>;
13421
+ startIconSlot?: keyof PlasmicClassArgs<C>;
13422
+ endIconSlot?: keyof PlasmicClassArgs<C>;
13423
+ contentSlot: keyof PlasmicClassArgs<C>;
13970
13424
  root: keyof PlasmicClassOverrides<C>;
13971
- separator: keyof PlasmicClassOverrides<C>;
13972
- titleContainer: keyof PlasmicClassOverrides<C>;
13973
- optionsContainer: keyof PlasmicClassOverrides<C>;
13974
13425
  }
13975
- declare function useSelectOptionGroup<P extends BaseSelectOptionGroupProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: SelectOptionGroupConfig<C>): {
13426
+ declare function useButton<P extends PlumeButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: ButtonConfig<C>, ref?: ButtonRef): {
13976
13427
  plasmicProps: {
13977
13428
  variants: PlasmicClassVariants<C>;
13978
13429
  args: PlasmicClassArgs<C>;
@@ -13994,87 +13445,155 @@ declare function useSelectOptionGroup<P extends BaseSelectOptionGroupProps, C ex
13994
13445
 
13995
13446
 
13996
13447
 
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,
13448
+ interface ToggleStateOptions extends InputBase$1 {
13449
+ /**
13450
+ * Whether the element should be selected (uncontrolled).
13451
+ */
13452
+ defaultSelected?: boolean,
13453
+ /**
13454
+ * Whether the element should be selected (controlled).
13455
+ */
13456
+ isSelected?: boolean,
13457
+ /**
13458
+ * Handler that is called when the element's selection state changes.
13459
+ */
13460
+ onChange?: (isSelected: boolean) => void
13461
+ }
14004
13462
 
14005
- /** Iterate over all keys in the collection. */
14006
- getKeys(): Iterable<Key$1>,
13463
+ interface ToggleProps extends ToggleStateOptions, Validation<boolean>, FocusableProps$1 {
13464
+ /**
13465
+ * The label for the element.
13466
+ */
13467
+ children?: ReactNode,
13468
+ /**
13469
+ * 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).
13470
+ */
13471
+ value?: string
13472
+ }
14007
13473
 
14008
- /** Get an item by its key. */
14009
- getItem(key: Key$1): T | null,
13474
+ interface AriaToggleProps extends ToggleProps, FocusableDOMProps$1, AriaLabelingProps$1, AriaValidationProps, InputDOMProps {
13475
+ /**
13476
+ * Identifies the element (or elements) whose contents or presence are controlled by the current element.
13477
+ */
13478
+ 'aria-controls'?: string
13479
+ }
14010
13480
 
14011
- /** Get an item by the index of its key. */
14012
- at(idx: number): T | null,
13481
+ interface CheckboxProps$1 extends ToggleProps {
13482
+ /**
13483
+ * Indeterminism is presentational only.
13484
+ * The indeterminate visual representation remains regardless of user interaction.
13485
+ */
13486
+ isIndeterminate?: boolean
13487
+ }
14013
13488
 
14014
- /** Get the key that comes before the given key in the collection. */
14015
- getKeyBefore(key: Key$1): Key$1 | null,
13489
+ interface AriaCheckboxProps extends CheckboxProps$1, AriaToggleProps {}
14016
13490
 
14017
- /** Get the key that comes after the given key in the collection. */
14018
- getKeyAfter(key: Key$1): Key$1 | null,
13491
+ interface StyleProps {
13492
+ className?: string;
13493
+ style?: React$1.CSSProperties;
13494
+ }
13495
+ declare function getDataProps(props: Record<string, any>): Partial<Record<string, any>>;
14019
13496
 
14020
- /** Get the first key in the collection. */
14021
- getFirstKey(): Key$1 | null,
13497
+ type CheckboxRef = React$1.Ref<CheckboxRefValue>;
13498
+ interface CheckboxRefValue extends CheckboxState {
13499
+ getRoot: () => HTMLElement | null;
13500
+ focus: () => void;
13501
+ blur: () => void;
13502
+ }
13503
+ interface CheckboxState {
13504
+ setChecked: (checked: boolean) => void;
13505
+ }
13506
+ interface CheckboxProps extends Omit<AriaCheckboxProps, "isSelected" | "defaultSelected">, StyleProps {
13507
+ /**
13508
+ * Whether the Checkbox is checked or not; controlled
13509
+ */
13510
+ isChecked?: boolean;
13511
+ /**
13512
+ * Whether the Checkbox is checked by default; uncontrolled
13513
+ */
13514
+ defaultChecked?: boolean;
13515
+ /**
13516
+ * Whether the Checkbox is in an "indeterminate" state; this usually
13517
+ * refers to a "check all" that is used to check / uncheck many other
13518
+ * checkboxes, and is visually indeterminate if some of its controlled
13519
+ * checkboxes are checked and some are not.
13520
+ */
13521
+ isIndeterminate?: boolean;
13522
+ }
13523
+ interface CheckboxConfig<C extends AnyPlasmicClass> {
13524
+ isCheckedVariant: VariantDef<PlasmicClassVariants<C>>;
13525
+ isIndeterminateVariant?: VariantDef<PlasmicClassVariants<C>>;
13526
+ isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13527
+ noLabelVariant?: VariantDef<PlasmicClassVariants<C>>;
13528
+ labelSlot?: keyof PlasmicClassArgs<C>;
13529
+ root: keyof PlasmicClassOverrides<C>;
13530
+ }
13531
+ declare function useCheckbox<P extends CheckboxProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: CheckboxConfig<C>, ref?: CheckboxRef): {
13532
+ plasmicProps: {
13533
+ variants: PlasmicClassVariants<C>;
13534
+ overrides: PlasmicClassOverrides<C>;
13535
+ args: PlasmicClassArgs<C>;
13536
+ };
13537
+ state: CheckboxState;
13538
+ };
14022
13539
 
14023
- /** Get the last key in the collection. */
14024
- getLastKey(): Key$1 | null,
13540
+ /*
13541
+ * Copyright 2020 Adobe. All rights reserved.
13542
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13543
+ * you may not use this file except in compliance with the License. You may obtain a copy
13544
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
13545
+ *
13546
+ * Unless required by applicable law or agreed to in writing, software distributed under
13547
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13548
+ * OF ANY KIND, either express or implied. See the License for the specific language
13549
+ * governing permissions and limitations under the License.
13550
+ */
14025
13551
 
14026
- /** Iterate over the child items of the given key. */
14027
- getChildren?(key: Key$1): Iterable<T>,
14028
13552
 
14029
- /** Returns a string representation of the item's contents. */
14030
- getTextValue?(key: Key$1): string,
14031
13553
 
14032
- /** Filters the collection using the given function. */
14033
- UNSTABLE_filter?(filterFn: (nodeValue: string) => boolean): Collection$1<T>
13554
+ interface AriaLabelingProps {
13555
+ /**
13556
+ * Defines a string value that labels the current element.
13557
+ */
13558
+ 'aria-label'?: string,
13559
+
13560
+ /**
13561
+ * Identifies the element (or elements) that labels the current element.
13562
+ */
13563
+ 'aria-labelledby'?: string,
13564
+
13565
+ /**
13566
+ * Identifies the element (or elements) that describes the object.
13567
+ */
13568
+ 'aria-describedby'?: string,
13569
+
13570
+ /**
13571
+ * Identifies the element (or elements) that provide a detailed, extended description for the object.
13572
+ */
13573
+ 'aria-details'?: string
14034
13574
  }
14035
13575
 
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,
13576
+ // A set of common DOM props that are allowed on any component
13577
+ // Ensure this is synced with DOMPropNames in filterDOMProps
13578
+ interface DOMProps {
14047
13579
  /**
14048
- * The loaded children of this node.
14049
- * @deprecated Use `collection.getChildren(node.key)` instead.
13580
+ * The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
14050
13581
  */
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
13582
+ id?: string
13583
+ }
13584
+
13585
+ interface FocusableDOMProps extends DOMProps {
13586
+ /**
13587
+ * Whether to exclude the element from the sequential tab order. If true,
13588
+ * the element will not be focusable via the keyboard by tabbing. This should
13589
+ * be avoided except in rare scenarios where an alternative means of accessing
13590
+ * the element or its functionality via the keyboard is available.
13591
+ */
13592
+ excludeFromTabOrder?: boolean
14074
13593
  }
14075
13594
 
14076
13595
  /*
14077
- * Copyright 2023 Adobe. All rights reserved.
13596
+ * Copyright 2020 Adobe. All rights reserved.
14078
13597
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14079
13598
  * you may not use this file except in compliance with the License. You may obtain a copy
14080
13599
  * of the License at http://www.apache.org/licenses/LICENSE-2.0
@@ -14085,7 +13604,14 @@ interface Node$1<T> {
14085
13604
  * governing permissions and limitations under the License.
14086
13605
  */
14087
13606
 
14088
- type Key$1 = string | number;
13607
+
13608
+
13609
+ interface InputBase {
13610
+ /** Whether the input is disabled. */
13611
+ isDisabled?: boolean,
13612
+ /** Whether the input can be selected but not changed by the user. */
13613
+ isReadOnly?: boolean
13614
+ }
14089
13615
 
14090
13616
  /*
14091
13617
  * Copyright 2020 Adobe. All rights reserved.
@@ -14101,12 +13627,7 @@ type Key$1 = string | number;
14101
13627
 
14102
13628
 
14103
13629
 
14104
- type SelectionMode = 'none' | 'single' | 'multiple';
14105
- type SelectionBehavior = 'toggle' | 'replace';
14106
- type Selection = 'all' | Set<Key>;
14107
-
14108
13630
  type FocusStrategy = 'first' | 'last';
14109
- type DisabledBehavior = 'selection' | 'all';
14110
13631
 
14111
13632
  /*
14112
13633
  * Copyright 2020 Adobe. All rights reserved.
@@ -14122,170 +13643,490 @@ type DisabledBehavior = 'selection' | 'all';
14122
13643
 
14123
13644
 
14124
13645
 
14125
- interface Rect {
14126
- x: number,
14127
- y: number,
14128
- width: number,
14129
- height: number
13646
+ // Event bubbling can be problematic in real-world applications, so the default for React Spectrum components
13647
+ // is not to propagate. This can be overridden by calling continuePropagation() on the event.
13648
+ type BaseEvent<T extends SyntheticEvent> = T & {
13649
+ /**
13650
+ * Use continuePropagation.
13651
+ * @deprecated */
13652
+ stopPropagation(): void,
13653
+ continuePropagation(): void
14130
13654
  }
14131
13655
 
14132
- interface Size {
14133
- width: number,
14134
- height: number
14135
- }
13656
+ type KeyboardEvent = BaseEvent<KeyboardEvent$2<any>>;
14136
13657
 
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[]
13658
+ interface KeyboardEvents {
13659
+ /** Handler that is called when a key is pressed. */
13660
+ onKeyDown?: (e: KeyboardEvent) => void,
13661
+ /** Handler that is called when a key is released. */
13662
+ onKeyUp?: (e: KeyboardEvent) => void
14147
13663
  }
14148
13664
 
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,
13665
+ interface FocusEvents<Target = Element> {
13666
+ /** Handler that is called when the element receives focus. */
13667
+ onFocus?: (e: FocusEvent<Target>) => void,
13668
+ /** Handler that is called when the element loses focus. */
13669
+ onBlur?: (e: FocusEvent<Target>) => void,
13670
+ /** Handler that is called when the element's focus status changes. */
13671
+ onFocusChange?: (isFocused: boolean) => void
13672
+ }
14171
13673
 
14172
- /** Get the first key in the collection. */
14173
- getFirstKey(): Key | null,
13674
+ interface FocusableProps<Target = Element> extends FocusEvents<Target>, KeyboardEvents {
13675
+ /** Whether the element should receive focus on render. */
13676
+ autoFocus?: boolean
13677
+ }
14174
13678
 
14175
- /** Get the last key in the collection. */
14176
- getLastKey(): Key | null,
13679
+ interface BaseMenuProps extends DOMProps, AriaLabelingProps, StyleProps {
13680
+ /**
13681
+ * List of `Menu.Item`s or `Menu.Group`s that make up the menu
13682
+ */
13683
+ children?: React$1.ReactNode;
13684
+ /**
13685
+ * Called with the value of a `Menu.Item` when it is selected.
13686
+ */
13687
+ onAction?: (value: string) => void;
13688
+ }
13689
+ type MenuRef = React$1.Ref<MenuRefValue>;
13690
+ interface MenuRefValue extends MenuState {
13691
+ getRoot: () => HTMLElement | null;
13692
+ }
13693
+ interface MenuConfig<C extends AnyPlasmicClass> {
13694
+ isPlacedTopVariant?: VariantDef<PlasmicClassVariants<C>>;
13695
+ isPlacedBottomVariant?: VariantDef<PlasmicClassVariants<C>>;
13696
+ isPlacedLeftVariant?: VariantDef<PlasmicClassVariants<C>>;
13697
+ isPlacedRightVariant?: VariantDef<PlasmicClassVariants<C>>;
13698
+ itemsSlot: keyof PlasmicClassArgs<C>;
13699
+ itemsContainer: keyof PlasmicClassOverrides<C>;
13700
+ root: keyof PlasmicClassOverrides<C>;
13701
+ }
13702
+ interface MenuState {
13703
+ getFocusedValue: () => string | null;
13704
+ setFocusedValue: (value: string) => void;
13705
+ }
13706
+ declare function useMenu<P extends BaseMenuProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: MenuConfig<C>, ref?: MenuRef): {
13707
+ plasmicProps: {
13708
+ variants: PlasmicClassVariants<C>;
13709
+ args: PlasmicClassArgs<C>;
13710
+ overrides: PlasmicClassOverrides<C>;
13711
+ };
13712
+ state: MenuState;
13713
+ };
14177
13714
 
14178
- /** Iterate over the child items of the given key. */
14179
- getChildren?(key: Key): Iterable<T>,
13715
+ /**
13716
+ * In general, we try not to expose react-aria's Collections API to Plume users.
13717
+ * The Collections API is how react-aria users pass data about collections of
13718
+ * things using the built-in Item and Section components, which are abstract,
13719
+ * metadata-only components that don't render anything but only serve to specify
13720
+ * data. For example, here's how you would use react-spectrum's Picker:
13721
+ *
13722
+ * <Picker>
13723
+ * <Section title="Asia">
13724
+ * <Item key="taiwan">Taiwan</Item>
13725
+ * <Item key="japan">Japan</Item>
13726
+ * <Item key="china">China</Item>
13727
+ * </Section>
13728
+ * <Section title="Europe">
13729
+ * <Item key="germany">Germany</Item>
13730
+ * <Item key="france">France</Item>
13731
+ * </Section>
13732
+ * </Picker>
13733
+ *
13734
+ * You would re-use this same Item/Section components to pass similar things to
13735
+ * Menu, Tabs, etc.
13736
+ *
13737
+ * For Plasmic, this API is too abstract. The user has explicitly designed components
13738
+ * like Select.Option and Select.OptionGroup, and it is weird that they don't actually
13739
+ * use these components. It is more natural to do:
13740
+ *
13741
+ * <Select>
13742
+ * <Select.OptionGroup title="Asia">
13743
+ * <Select.Option key="taiwan">Taiwan</Select>
13744
+ * </Select.OptionGroup>
13745
+ * </Select>
13746
+ *
13747
+ * For Plume, we let users directly use the components they designed, both to collect
13748
+ * information and to perform actual rendering. For example, for Plume,
13749
+ * you'd use Select.Option instead of Item, and Select.OptionGroup instead of Section.
13750
+ * This means that the Select.Option props will collect the same information Item
13751
+ * does.
13752
+ *
13753
+ * A component like Select.Option then serves two purposes:
13754
+ *
13755
+ * 1. Allow users to specify the collection of data, like in the above example
13756
+ * Here, we're mainly interested in the props in those ReactElements so
13757
+ * we can pass the Item/Section data onto react-aria's APIs. We are not
13758
+ * actually rendering these elements.
13759
+ * 2. Once react-aria's Collections API has gone through them and built
13760
+ * Collection "nodes", we then create cloned versions of these elements
13761
+ * with the corresponding node passed in as a secret prop. These ReactElements
13762
+ * are then actually used to _render_ the corresponding Option / OptionGroup.
13763
+ *
13764
+ * This file contains helper functions to help with implementing the above.
13765
+ *
13766
+ * Note also that most of the collections-based react-aria components expose
13767
+ * a parallel API that accepts a list of "items" and a render prop, instead
13768
+ * of list of Item/Section elements. This is for efficiency, but we are opting
13769
+ * to only support the composite-component pattern for now for simplicity.
13770
+ */
14180
13771
 
14181
- /** Returns a string representation of the item's contents. */
14182
- getTextValue?(key: Key): string,
13772
+ /**
13773
+ * Props for a Plume component that corresponds to an Item
13774
+ */
13775
+ interface ItemLikeProps {
13776
+ /**
13777
+ * value key corresponding to this item. Not required if you use the
13778
+ * `key` prop instead.
13779
+ */
13780
+ value?: string | null;
13781
+ /**
13782
+ * The text string value corresponding to this item. Used to support
13783
+ * keyboard type-ahead. If not specified, then will be derived from
13784
+ * `children` if it is a string, or the `value` or `key`.
13785
+ */
13786
+ textValue?: string;
13787
+ /**
13788
+ * aria-label for this item.
13789
+ */
13790
+ "aria-label"?: string;
13791
+ /**
13792
+ * Primary content label for this item.
13793
+ */
13794
+ children?: React__default.ReactNode;
13795
+ /**
13796
+ * If true, this item will not be selectable.
13797
+ */
13798
+ isDisabled?: boolean;
13799
+ }
13800
+ /**
13801
+ * Props for a Plume component that corresponds to a Section
13802
+ */
13803
+ interface SectionLikeProps {
13804
+ /**
13805
+ * Heading content of the title
13806
+ */
13807
+ title?: React__default.ReactNode;
13808
+ /**
13809
+ * aria-label for this section
13810
+ */
13811
+ "aria-label"?: string;
13812
+ /**
13813
+ * A list of items that belong in this group
13814
+ */
13815
+ children?: React__default.ReactNode;
13816
+ }
13817
+ type ItemJson = LeafItemJson | SectionJson;
13818
+ type LeafItemJson = string | {
13819
+ value: string;
13820
+ label?: string;
13821
+ textValue?: string;
13822
+ isDisabled?: boolean;
13823
+ };
13824
+ interface SectionJson {
13825
+ title: string;
13826
+ children: ItemJson[];
13827
+ }
14183
13828
 
14184
- /** Filters the collection using the given function. */
14185
- UNSTABLE_filter?(filterFn: (nodeValue: string) => boolean): Collection<T>
13829
+ interface BaseMenuGroupProps extends SectionLikeProps, StyleProps {
14186
13830
  }
13831
+ interface MenuGroupConfig<C extends AnyPlasmicClass> {
13832
+ noTitleVariant: PlasmicClassVariants<C>;
13833
+ isFirstVariant: PlasmicClassVariants<C>;
13834
+ itemsSlot: keyof PlasmicClassArgs<C>;
13835
+ titleSlot: keyof PlasmicClassArgs<C>;
13836
+ root: keyof PlasmicClassOverrides<C>;
13837
+ separator: keyof PlasmicClassOverrides<C>;
13838
+ titleContainer: keyof PlasmicClassOverrides<C>;
13839
+ itemsContainer: keyof PlasmicClassOverrides<C>;
13840
+ }
13841
+ declare function useMenuGroup<P extends BaseMenuGroupProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: MenuGroupConfig<C>): {
13842
+ plasmicProps: {
13843
+ variants: PlasmicClassVariants<C>;
13844
+ args: PlasmicClassArgs<C>;
13845
+ overrides: PlasmicClassOverrides<C>;
13846
+ };
13847
+ };
14187
13848
 
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
13849
+ interface BaseMenuItemProps extends ItemLikeProps {
13850
+ /**
13851
+ * Called when this item is selected
13852
+ */
13853
+ onAction?: (key: string) => void;
13854
+ }
13855
+ interface MenuItemConfig<C extends AnyPlasmicClass> {
13856
+ isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13857
+ isHighlightedVariant?: VariantDef<PlasmicClassVariants<C>>;
13858
+ labelSlot: keyof PlasmicClassArgs<C>;
13859
+ root: keyof PlasmicClassOverrides<C>;
13860
+ labelContainer: keyof PlasmicClassOverrides<C>;
13861
+ }
13862
+ declare function useMenuItem<P extends BaseMenuItemProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: MenuItemConfig<C>): {
13863
+ plasmicProps: {
13864
+ variants: PlasmicClassVariants<C>;
13865
+ args: PlasmicClassArgs<C>;
13866
+ overrides: PlasmicClassOverrides<C>;
13867
+ };
13868
+ };
13869
+
13870
+ /*
13871
+ * Copyright 2020 Adobe. All rights reserved.
13872
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13873
+ * you may not use this file except in compliance with the License. You may obtain a copy
13874
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
13875
+ *
13876
+ * Unless required by applicable law or agreed to in writing, software distributed under
13877
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13878
+ * OF ANY KIND, either express or implied. See the License for the specific language
13879
+ * governing permissions and limitations under the License.
13880
+ */
13881
+
13882
+
13883
+
13884
+ type Placement = 'bottom' | 'bottom left' | 'bottom right' | 'bottom start' | 'bottom end' |
13885
+ 'top' | 'top left' | 'top right' | 'top start' | 'top end' |
13886
+ 'left' | 'left top' | 'left bottom' | 'start' | 'start top' | 'start bottom' |
13887
+ 'right' | 'right top' | 'right bottom' | 'end' | 'end top' | 'end bottom';
13888
+
13889
+ interface DropdownMenuProps {
13890
+ /**
13891
+ * A ReactElement that takes in a `ref` as well as the usual mouse and
13892
+ * pointer events. The dropdown menu will be positioned relative to this
13893
+ * trigger.
13894
+ */
13895
+ children: React$1.ReactElement;
13896
+ /**
13897
+ * The menu to show; must be either a ReactElement of Menu type, or
13898
+ * a function that creates one if you prefer to delay creating it until
13899
+ * the menu has been triggered.
13900
+ */
13901
+ menu: React$1.ReactElement<BaseMenuProps> | (() => React$1.ReactElement<BaseMenuProps>);
13902
+ /**
13903
+ * Where to place the menu relative to the trigger.
13904
+ */
13905
+ placement?: Placement;
13906
+ /**
13907
+ * Whether the menu is currently shown.
13908
+ */
13909
+ isOpen?: boolean;
13910
+ /**
13911
+ * Uncontrolled open state.
13912
+ */
13913
+ defaultOpen?: boolean;
13914
+ /**
13915
+ * Event handler fired when Menu's open state changes
13916
+ */
13917
+ onOpenChange?: (isOpen: boolean) => void;
13918
+ }
13919
+ declare function DropdownMenu(props: DropdownMenuProps): React$1.JSX.Element;
13920
+
13921
+ interface BaseMenuButtonProps extends DOMProps, FocusableProps, StyleProps, Pick<React$1.ComponentProps<"button">, "title"> {
13922
+ /**
13923
+ * The menu to show; can either be a Menu instance, or a function that returns a Menu
13924
+ * instance if you want to defer creating the instance till when it's opened.
13925
+ */
13926
+ menu: React$1.ReactElement<BaseMenuProps> | (() => React$1.ReactElement<BaseMenuProps>);
13927
+ /**
13928
+ * Whether the button is disabled
13929
+ */
13930
+ isDisabled?: boolean;
13931
+ /**
13932
+ * Whether the menu is currently shown.
13933
+ */
13934
+ isOpen?: boolean;
13935
+ /**
13936
+ * Uncontrolled open state
13937
+ */
13938
+ defaultOpen?: boolean;
13939
+ /**
13940
+ * Event handler fired when Menu's open state changes
13941
+ */
13942
+ onOpenChange?: (isOpen: boolean) => void;
13943
+ /**
13944
+ * Desired placement location of the Select dropdown
13945
+ */
13946
+ placement?: Placement;
13947
+ /**
13948
+ * If true, menu width will always match the trigger button width.
13949
+ * If false, then menu width will have min-width matching the
13950
+ * trigger button width.
13951
+ */
13952
+ menuMatchTriggerWidth?: boolean;
13953
+ /**
13954
+ * If set, menu width will be exactly this width, overriding
13955
+ * menuMatchTriggerWidth.
13956
+ */
13957
+ menuWidth?: number;
13958
+ }
13959
+ interface MenuButtonConfig<C extends AnyPlasmicClass> {
13960
+ isOpenVariant: VariantDef<PlasmicClassVariants<C>>;
13961
+ isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
13962
+ menuSlot: keyof PlasmicClassArgs<C>;
13963
+ root: keyof PlasmicClassOverrides<C>;
13964
+ trigger: keyof PlasmicClassOverrides<C>;
13965
+ }
13966
+ interface MenuButtonState {
13967
+ open: () => void;
13968
+ close: () => void;
13969
+ isOpen: () => boolean;
13970
+ }
13971
+ type MenuButtonRef = React$1.Ref<MenuButtonRefValue>;
13972
+ interface MenuButtonRefValue extends MenuButtonState {
13973
+ getRoot: () => HTMLElement | null;
13974
+ getTrigger: () => HTMLElement | null;
13975
+ focus: () => void;
13976
+ blur: () => void;
13977
+ }
13978
+ declare function useMenuButton<P extends BaseMenuButtonProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: MenuButtonConfig<C>, outerRef?: MenuButtonRef): {
13979
+ plasmicProps: {
13980
+ variants: PlasmicClassVariants<C>;
13981
+ args: PlasmicClassArgs<C>;
13982
+ overrides: PlasmicClassOverrides<C>;
13983
+ };
13984
+ state: MenuButtonState;
13985
+ };
13986
+
13987
+ interface BaseSelectProps extends DOMProps, AriaLabelingProps, FocusableDOMProps, InputBase, FocusableProps, StyleProps {
13988
+ /**
13989
+ * Key of the currently selected value
13990
+ */
13991
+ value?: string | null;
13992
+ /**
13993
+ * Event handler fired when currently selected value changes
13994
+ */
13995
+ onChange?: (value: string | null) => void;
13996
+ /**
13997
+ * Uncontrolled key of the default selected value
13998
+ */
13999
+ defaultValue?: string;
14000
+ /**
14001
+ * List of Select.Options
14002
+ */
14003
+ children?: React$1.ReactNode;
14004
+ /**
14005
+ * List of options as an array, instead of using `children` prop. If this
14006
+ * is passed in, then `children` is ignored.
14007
+ *
14008
+ * The options can be a list of strings, or a list of objects with
14009
+ * fields `value` (for the value of the option), `label` (for what's rendered
14010
+ * in the option), and `isDisabled` (if the option should be disabled).
14011
+ */
14012
+ options?: ItemJson[];
14013
+ /**
14014
+ * Whether the Select is currently open
14015
+ */
14016
+ isOpen?: boolean;
14017
+ /**
14018
+ * Event handler fired when Select's open state changes
14019
+ */
14020
+ onOpenChange?: (isOpen: boolean) => void;
14021
+ /**
14022
+ * Uncontrolled default open state
14023
+ */
14024
+ defaultOpen?: boolean;
14025
+ /**
14026
+ * Form name of the select element
14027
+ */
14028
+ name?: string;
14029
+ /**
14030
+ * By default, Select will render whatever is in Select.Option as the
14031
+ * content in the trigger button when it is selected. You can override
14032
+ * what content by passing in `selectedContent` here.
14033
+ */
14034
+ selectedContent?: React$1.ReactNode;
14035
+ /**
14036
+ * Desired placement location of the Select dropdown
14037
+ */
14038
+ placement?: Placement;
14039
+ /**
14040
+ * If true, menu width will always match the trigger button width.
14041
+ * If false, then menu width will have min-width matching the
14042
+ * trigger button width.
14043
+ */
14044
+ menuMatchTriggerWidth?: boolean;
14045
+ /**
14046
+ * If set, menu width will be exactly this width, overriding
14047
+ * menuMatchTriggerWidth.
14048
+ */
14049
+ menuWidth?: number;
14050
+ /**
14051
+ * Content to display when nothing is selected.
14052
+ */
14053
+ placeholder?: React$1.ReactNode;
14054
+ }
14055
+ type SelectRef = React$1.Ref<SelectRefValue>;
14056
+ interface SelectRefValue extends SelectState {
14057
+ getTrigger: () => HTMLElement | null;
14058
+ getRoot: () => HTMLElement | null;
14059
+ focus: () => void;
14060
+ blur: () => void;
14226
14061
  }
14227
-
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
14062
+ interface SelectConfig<C extends AnyPlasmicClass> {
14063
+ placeholderVariant?: VariantDef<PlasmicClassVariants<C>>;
14064
+ isOpenVariant: VariantDef<PlasmicClassVariants<C>>;
14065
+ isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
14066
+ triggerContentSlot: keyof PlasmicClassArgs<C>;
14067
+ optionsSlot: keyof PlasmicClassArgs<C>;
14068
+ placeholderSlot: keyof PlasmicClassArgs<C>;
14069
+ root: keyof PlasmicClassOverrides<C>;
14070
+ trigger: keyof PlasmicClassOverrides<C>;
14071
+ overlay: keyof PlasmicClassOverrides<C>;
14072
+ optionsContainer: keyof PlasmicClassOverrides<C>;
14073
+ OptionComponent?: React$1.ComponentType<ItemLikeProps>;
14074
+ OptionGroupComponent?: React$1.ComponentType<SectionLikeProps>;
14269
14075
  }
14270
-
14271
- interface LongPressEvent extends Omit<PressEvent, 'type' | 'continuePropagation'> {
14272
- /** The type of long press event being fired. */
14273
- type: 'longpressstart' | 'longpressend' | 'longpress'
14076
+ interface SelectState {
14077
+ open: () => void;
14078
+ close: () => void;
14079
+ isOpen: () => boolean;
14080
+ getSelectedValue: () => string | null;
14081
+ setSelectedValue: (value: string | null) => void;
14274
14082
  }
14083
+ declare function useSelect<P extends BaseSelectProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: SelectConfig<C>, ref?: React$1.Ref<SelectRefValue>): {
14084
+ plasmicProps: {
14085
+ variants: PlasmicClassVariants<C>;
14086
+ args: PlasmicClassArgs<C>;
14087
+ overrides: PlasmicClassOverrides<C>;
14088
+ };
14089
+ state: SelectState;
14090
+ };
14275
14091
 
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
- */
14092
+ interface BaseSelectOptionProps extends ItemLikeProps, StyleProps {
14093
+ }
14094
+ interface SelectOptionConfig<C extends AnyPlasmicClass> {
14095
+ isSelectedVariant: VariantDef<PlasmicClassVariants<C>>;
14096
+ isDisabledVariant?: VariantDef<PlasmicClassVariants<C>>;
14097
+ isHighlightedVariant?: VariantDef<PlasmicClassVariants<C>>;
14098
+ labelSlot: keyof PlasmicClassArgs<C>;
14099
+ root: keyof PlasmicClassOverrides<C>;
14100
+ labelContainer: keyof PlasmicClassOverrides<C>;
14101
+ }
14102
+ type SelectOptionRef = React$1.Ref<HTMLElement>;
14103
+ declare function useSelectOption<P extends BaseSelectOptionProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: SelectOptionConfig<C>, outerRef?: SelectOptionRef): {
14104
+ plasmicProps: {
14105
+ variants: PlasmicClassVariants<C>;
14106
+ args: PlasmicClassArgs<C>;
14107
+ overrides: PlasmicClassOverrides<C>;
14108
+ };
14109
+ };
14287
14110
 
14288
- type Key = string | number;
14111
+ interface BaseSelectOptionGroupProps extends SectionLikeProps, StyleProps {
14112
+ }
14113
+ interface SelectOptionGroupConfig<C extends AnyPlasmicClass> {
14114
+ noTitleVariant: VariantDef<PlasmicClassVariants<C>>;
14115
+ isFirstVariant: VariantDef<PlasmicClassVariants<C>>;
14116
+ optionsSlot: keyof PlasmicClassArgs<C>;
14117
+ titleSlot: keyof PlasmicClassArgs<C>;
14118
+ root: keyof PlasmicClassOverrides<C>;
14119
+ separator: keyof PlasmicClassOverrides<C>;
14120
+ titleContainer: keyof PlasmicClassOverrides<C>;
14121
+ optionsContainer: keyof PlasmicClassOverrides<C>;
14122
+ }
14123
+ declare function useSelectOptionGroup<P extends BaseSelectOptionGroupProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: SelectOptionGroupConfig<C>): {
14124
+ plasmicProps: {
14125
+ variants: PlasmicClassVariants<C>;
14126
+ args: PlasmicClassArgs<C>;
14127
+ overrides: PlasmicClassOverrides<C>;
14128
+ };
14129
+ };
14289
14130
 
14290
14131
  interface FocusState {
14291
14132
  /** Whether the collection is currently focused. */
@@ -14295,9 +14136,9 @@ interface FocusState {
14295
14136
  /** The current focused key in the collection. */
14296
14137
  readonly focusedKey: Key | null;
14297
14138
  /** Whether the first or last child of the focused key should receive focus. */
14298
- readonly childFocusStrategy: FocusStrategy | null;
14139
+ readonly childFocusStrategy: FocusStrategy$1 | null;
14299
14140
  /** Sets the focused key, and optionally, whether the first or last child of that key should receive focus. */
14300
- setFocusedKey(key: Key | null, child?: FocusStrategy): void;
14141
+ setFocusedKey(key: Key | null, child?: FocusStrategy$1): void;
14301
14142
  }
14302
14143
  interface MultipleSelectionState extends FocusState {
14303
14144
  /** The type of selection that is allowed in the collection. */
@@ -14413,11 +14254,11 @@ declare class SelectionManager implements MultipleSelectionManager {
14413
14254
  */
14414
14255
  get focusedKey(): Key | null;
14415
14256
  /** Whether the first or last child of the focused key should receive focus. */
14416
- get childFocusStrategy(): FocusStrategy | null;
14257
+ get childFocusStrategy(): FocusStrategy$1 | null;
14417
14258
  /**
14418
14259
  * Sets the focused key.
14419
14260
  */
14420
- setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void;
14261
+ setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy$1): void;
14421
14262
  /**
14422
14263
  * The currently selected keys in the collection.
14423
14264
  */
@@ -14485,9 +14326,9 @@ declare class SelectionManager implements MultipleSelectionManager {
14485
14326
 
14486
14327
  interface ListState<T> {
14487
14328
  /** A collection of items in the list. */
14488
- collection: Collection$1<Node$1<T>>;
14329
+ collection: Collection<Node<T>>;
14489
14330
  /** A set of items that are disabled. */
14490
- disabledKeys: Set<Key$1>;
14331
+ disabledKeys: Set<Key>;
14491
14332
  /** A selection manager to read and update multiple selection state. */
14492
14333
  selectionManager: SelectionManager;
14493
14334
  }
@@ -14508,137 +14349,7 @@ declare const SelectContext: React$1.Context<ListState<any> | undefined>;
14508
14349
 
14509
14350
 
14510
14351
 
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
-
14641
- interface SwitchBase extends InputBase, FocusableProps {
14352
+ interface SwitchBase extends InputBase$1, FocusableProps$1 {
14642
14353
  /**
14643
14354
  * The content to render as the Switch's label.
14644
14355
  */
@@ -14661,7 +14372,7 @@ interface SwitchBase extends InputBase, FocusableProps {
14661
14372
  value?: string
14662
14373
  }
14663
14374
  interface SwitchProps$1 extends SwitchBase {}
14664
- interface AriaSwitchBase extends SwitchBase, FocusableDOMProps, InputDOMProps, AriaLabelingProps {
14375
+ interface AriaSwitchBase extends SwitchBase, FocusableDOMProps$1, InputDOMProps, AriaLabelingProps$1 {
14665
14376
  /**
14666
14377
  * Identifies the element (or elements) whose contents or presence are controlled by the current element.
14667
14378
  */
@@ -14742,7 +14453,7 @@ declare function useTextInput<P extends PlumeTextInputProps, C extends AnyPlasmi
14742
14453
  };
14743
14454
  };
14744
14455
 
14745
- interface BaseTriggeredOverlayProps extends StyleProps, DOMProps$1 {
14456
+ interface BaseTriggeredOverlayProps extends StyleProps, DOMProps {
14746
14457
  children?: React$1.ReactNode;
14747
14458
  }
14748
14459
  interface TriggeredOverlayConfig<C extends AnyPlasmicClass> {
@@ -14778,7 +14489,7 @@ interface OverlayTriggerState {
14778
14489
  interface TriggeredOverlayContextValue {
14779
14490
  triggerRef: React$1.RefObject<HTMLElement>;
14780
14491
  state: OverlayTriggerState;
14781
- autoFocus?: boolean | FocusStrategy$1;
14492
+ autoFocus?: boolean | FocusStrategy;
14782
14493
  placement?: Placement;
14783
14494
  overlayMatchTriggerWidth?: boolean;
14784
14495
  overlayMinTriggerWidth?: boolean;