@cloudscape-design/components 3.0.631 → 3.0.633

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.
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAIhE,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAejE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAWlF,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAEjG,QAAA,MAAM,mBAAmB,uGAyNvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAIhE,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAejE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAWlF,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAEjG,QAAA,MAAM,mBAAmB,uGAsOvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
@@ -80,9 +80,19 @@ const InternalAutosuggest = React.forwardRef((props, ref) => {
80
80
  fireCancelableEvent(onKeyDown, event.detail, event);
81
81
  };
82
82
  const handlePressArrowDown = () => {
83
+ if (autosuggestItemsState.items.length - 1 === autosuggestItemsState.highlightedIndex) {
84
+ autosuggestItemsHandlers.goHomeWithKeyboard();
85
+ return;
86
+ }
83
87
  autosuggestItemsHandlers.moveHighlightWithKeyboard(1);
84
88
  };
85
89
  const handlePressArrowUp = () => {
90
+ var _a;
91
+ if ((((_a = autosuggestItemsState.highlightedOption) === null || _a === void 0 ? void 0 : _a.type) === 'child' && autosuggestItemsState.highlightedIndex === 1) ||
92
+ autosuggestItemsState.highlightedIndex === 0) {
93
+ autosuggestItemsHandlers.goEndWithKeyboard();
94
+ return;
95
+ }
86
96
  autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);
87
97
  };
88
98
  const handlePressEnter = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAO,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAEL,mBAAmB,EACnB,sBAAsB,GAEvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAEjE,OAAO,sBAAsB,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,gBAAyC,MAAM,0CAA0C,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAIzE,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAA+B,EAAE,GAA8B,EAAE,EAAE;;IAC/G,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,MAA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AC,CAAC,CAAC,SAAS,GACrE,CACH,EAEH,cAAc,EACZ,cAAc,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAClD,oBAAC,cAAc,IACb,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,cAAc,CAAC,OAAO,EAC/B,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GACjD,CACH,CAAC,CAAC,CAAC,IAAI,EAEV,SAAS,EAAE,UAAU,KAAK,OAAO,IAAI,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,WAAW,EACpE,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,IAC9B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useAutosuggestItems } from './options-controller';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\n\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport DropdownFooter from '../internal/components/dropdown-footer';\n\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n NonCancelableCustomEvent,\n} from '../internal/events';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport AutosuggestOptionsList from './options-list';\nimport { useAutosuggestLoadMore } from './load-more-controller';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { useInternalI18n } from '../i18n/context';\n\nimport styles from './styles.css.js';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nexport interface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {}\n\nconst InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref<AutosuggestProps.Ref>) => {\n const {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n placeholder,\n clearAriaLabel,\n name,\n disabled,\n disableBrowserAutocorrect = false,\n autoFocus,\n readOnly,\n ariaLabel,\n ariaRequired,\n enteredTextLabel,\n filteringResultsText,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n onSelect,\n renderHighlightedAriaLive,\n __internalRootRef,\n ...restProps\n } = props;\n\n checkControlled('Autosuggest', 'value', value, 'onChange', onChange);\n checkOptionValueField('Autosuggest', 'options', options);\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n useImperativeHandle(\n ref,\n () => ({\n focus: () => autosuggestInputRef.current?.focus(),\n select: () => autosuggestInputRef.current?.select(),\n }),\n []\n );\n\n const i18n = useInternalI18n('autosuggest');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Autosuggest', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: value,\n filteringType,\n enteredTextLabel,\n hideEnteredTextLabel: false,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n fireNonCancelableEvent(onSelect, {\n value,\n selectedOption: option.type !== 'use-entered' ? option.option : undefined,\n });\n autosuggestInputRef.current?.close();\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.setShowAll(false);\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n autosuggestItemsHandlers.setShowAll(true);\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireNonCancelableEvent(onFocus, null);\n };\n\n const handleKeyUp = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyUp, event.detail, event);\n };\n\n const handleKeyDown = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, event.detail, event);\n };\n\n const handlePressArrowDown = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('input');\n const footerControlId = useUniqueId('footer');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionIdSource = useUniqueId();\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? highlightedOptionIdSource : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const isFiltered = !!value && value.length !== 0;\n const filteredText = isFiltered\n ? filteringResultsText?.(autosuggestItemsState.items.length, options?.length ?? 0)\n : undefined;\n const dropdownStatus = useDropdownStatus({\n ...props,\n isEmpty,\n isFiltered,\n recoveryText,\n errorIconAriaLabel,\n onRecoveryClick: handleRecoveryClick,\n filteringResultsText: filteredText,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const shouldRenderDropdownContent = !isEmpty || dropdownStatus.content;\n\n return (\n <AutosuggestInput\n {...restProps}\n className={clsx(styles.root, restProps.className)}\n ref={autosuggestInputRef}\n __internalRootRef={__internalRootRef}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n name={name}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n clearAriaLabel={clearAriaLabel}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={autosuggestItemsState.items.length > 1 || dropdownStatus.content !== null}\n dropdownContent={\n shouldRenderDropdownContent && (\n <AutosuggestOptionsList\n statusType={statusType}\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={value}\n listId={listId}\n controlId={controlId}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n selectedAriaLabel={selectedAriaLabel}\n renderHighlightedAriaLive={renderHighlightedAriaLive}\n listBottom={\n !dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} id={footerControlId} /> : null\n }\n ariaDescribedby={dropdownStatus.content ? footerControlId : undefined}\n />\n )\n }\n dropdownFooter={\n dropdownStatus.isSticky && dropdownStatus.content ? (\n <DropdownFooter\n id={footerControlId}\n content={dropdownStatus.content}\n hasItems={autosuggestItemsState.items.length >= 1}\n />\n ) : null\n }\n loopFocus={statusType === 'error' && !!recoveryText && !!onLoadItems}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n />\n );\n});\n\nexport default InternalAutosuggest;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAO,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAEL,mBAAmB,EACnB,sBAAsB,GAEvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAEjE,OAAO,sBAAsB,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,gBAAyC,MAAM,0CAA0C,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,MAAM,MAAM,iBAA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n\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useAutosuggestItems } from './options-controller';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\n\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport DropdownFooter from '../internal/components/dropdown-footer';\n\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n NonCancelableCustomEvent,\n} from '../internal/events';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport AutosuggestOptionsList from './options-list';\nimport { useAutosuggestLoadMore } from './load-more-controller';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { useInternalI18n } from '../i18n/context';\n\nimport styles from './styles.css.js';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nexport interface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {}\n\nconst InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref<AutosuggestProps.Ref>) => {\n const {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n placeholder,\n clearAriaLabel,\n name,\n disabled,\n disableBrowserAutocorrect = false,\n autoFocus,\n readOnly,\n ariaLabel,\n ariaRequired,\n enteredTextLabel,\n filteringResultsText,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n onSelect,\n renderHighlightedAriaLive,\n __internalRootRef,\n ...restProps\n } = props;\n\n checkControlled('Autosuggest', 'value', value, 'onChange', onChange);\n checkOptionValueField('Autosuggest', 'options', options);\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n useImperativeHandle(\n ref,\n () => ({\n focus: () => autosuggestInputRef.current?.focus(),\n select: () => autosuggestInputRef.current?.select(),\n }),\n []\n );\n\n const i18n = useInternalI18n('autosuggest');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Autosuggest', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: value,\n filteringType,\n enteredTextLabel,\n hideEnteredTextLabel: false,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n fireNonCancelableEvent(onSelect, {\n value,\n selectedOption: option.type !== 'use-entered' ? option.option : undefined,\n });\n autosuggestInputRef.current?.close();\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.setShowAll(false);\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n autosuggestItemsHandlers.setShowAll(true);\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireNonCancelableEvent(onFocus, null);\n };\n\n const handleKeyUp = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyUp, event.detail, event);\n };\n\n const handleKeyDown = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, event.detail, event);\n };\n\n const handlePressArrowDown = () => {\n if (autosuggestItemsState.items.length - 1 === autosuggestItemsState.highlightedIndex) {\n autosuggestItemsHandlers.goHomeWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n if (\n (autosuggestItemsState.highlightedOption?.type === 'child' && autosuggestItemsState.highlightedIndex === 1) ||\n autosuggestItemsState.highlightedIndex === 0\n ) {\n autosuggestItemsHandlers.goEndWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('input');\n const footerControlId = useUniqueId('footer');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionIdSource = useUniqueId();\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? highlightedOptionIdSource : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const isFiltered = !!value && value.length !== 0;\n const filteredText = isFiltered\n ? filteringResultsText?.(autosuggestItemsState.items.length, options?.length ?? 0)\n : undefined;\n const dropdownStatus = useDropdownStatus({\n ...props,\n isEmpty,\n isFiltered,\n recoveryText,\n errorIconAriaLabel,\n onRecoveryClick: handleRecoveryClick,\n filteringResultsText: filteredText,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const shouldRenderDropdownContent = !isEmpty || dropdownStatus.content;\n\n return (\n <AutosuggestInput\n {...restProps}\n className={clsx(styles.root, restProps.className)}\n ref={autosuggestInputRef}\n __internalRootRef={__internalRootRef}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n name={name}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n clearAriaLabel={clearAriaLabel}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={autosuggestItemsState.items.length > 1 || dropdownStatus.content !== null}\n dropdownContent={\n shouldRenderDropdownContent && (\n <AutosuggestOptionsList\n statusType={statusType}\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={value}\n listId={listId}\n controlId={controlId}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n selectedAriaLabel={selectedAriaLabel}\n renderHighlightedAriaLive={renderHighlightedAriaLive}\n listBottom={\n !dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} id={footerControlId} /> : null\n }\n ariaDescribedby={dropdownStatus.content ? footerControlId : undefined}\n />\n )\n }\n dropdownFooter={\n dropdownStatus.isSticky && dropdownStatus.content ? (\n <DropdownFooter\n id={footerControlId}\n content={dropdownStatus.content}\n hasItems={autosuggestItemsState.items.length >= 1}\n />\n ) : null\n }\n loopFocus={statusType === 'error' && !!recoveryText && !!onLoadItems}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n />\n );\n});\n\nexport default InternalAutosuggest;\n"]}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { CopyToClipboardProps } from './interfaces';
3
3
  export { CopyToClipboardProps };
4
- export default function CopyToClipboard({ variant, copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, ...restProps }: CopyToClipboardProps): JSX.Element;
4
+ export default function CopyToClipboard({ variant, ...restProps }: CopyToClipboardProps): JSX.Element;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAUpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,OAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,GAAG,SAAS,EACb,EAAE,oBAAoB,eAuEtB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAMpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,OAAkB,EAAE,GAAG,SAAS,EAAE,EAAE,oBAAoB,eAOjG"}
@@ -1,53 +1,18 @@
1
1
  import { __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import React, { useState } from 'react';
5
- import { getBaseProps } from '../internal/base-component';
4
+ import React from 'react';
6
5
  import { applyDisplayName } from '../internal/utils/apply-display-name';
7
6
  import useBaseComponent from '../internal/hooks/use-base-component';
8
- import InternalButton from '../button/internal';
9
- import InternalPopover from '../popover/internal';
10
- import InternalStatusIndicator from '../status-indicator/internal';
11
- import styles from './styles.css.js';
12
- import testStyles from './test-classes/styles.css.js';
13
- import clsx from 'clsx';
7
+ import InternalCopyToClipboard from './internal';
8
+ import { getExternalProps } from '../internal/utils/external-props';
14
9
  export default function CopyToClipboard(_a) {
15
- var { variant = 'button', copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy } = _a, restProps = __rest(_a, ["variant", "copyButtonAriaLabel", "copyButtonText", "copySuccessText", "copyErrorText", "textToCopy"]);
16
- const { __internalRootRef } = useBaseComponent('CopyToClipboard', {
10
+ var { variant = 'button' } = _a, restProps = __rest(_a, ["variant"]);
11
+ const baseProps = useBaseComponent('CopyToClipboard', {
17
12
  props: { variant },
18
13
  });
19
- const baseProps = getBaseProps(restProps);
20
- const copyButtonProps = variant === 'button'
21
- ? { children: copyButtonText, ariaLabel: copyButtonAriaLabel }
22
- : { ariaLabel: copyButtonAriaLabel !== null && copyButtonAriaLabel !== void 0 ? copyButtonAriaLabel : copyButtonText };
23
- const [status, setStatus] = useState('pending');
24
- const [statusText, setStatusText] = useState('');
25
- const onClick = () => {
26
- if (navigator.clipboard) {
27
- setStatus('pending');
28
- setStatusText('');
29
- navigator.clipboard
30
- .writeText(textToCopy)
31
- .then(() => {
32
- setStatus('success');
33
- setStatusText(copySuccessText);
34
- })
35
- .catch(() => {
36
- setStatus('error');
37
- setStatusText(copyErrorText);
38
- });
39
- }
40
- };
41
- const triggerVariant = {
42
- button: 'normal',
43
- icon: 'icon',
44
- inline: 'inline-icon',
45
- }[variant];
46
- const trigger = (React.createElement(InternalPopover, { size: "medium", position: "top", triggerType: "custom", dismissButton: false, renderWithPortal: true, content: React.createElement(InternalStatusIndicator, { type: status }, statusText) },
47
- React.createElement(InternalButton, Object.assign({}, copyButtonProps, { iconName: "copy", onClick: onClick, variant: triggerVariant, wrapText: false, formAction: "none" }))));
48
- return (React.createElement("span", Object.assign({ ref: __internalRootRef }, baseProps, { className: clsx(baseProps.className, styles.root, testStyles.root) }), variant === 'inline' ? (React.createElement("span", { className: styles['inline-container'] },
49
- React.createElement("span", { className: styles['inline-container-trigger'] }, trigger),
50
- React.createElement("span", { className: testStyles['text-to-copy'] }, textToCopy))) : (trigger)));
14
+ const filteredProps = getExternalProps(restProps);
15
+ return React.createElement(InternalCopyToClipboard, Object.assign({ variant: variant }, baseProps, filteredProps));
51
16
  }
52
17
  applyDisplayName(CopyToClipboard, 'CopyToClipboard');
53
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,8BAA8B,CAAC;AACtD,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAQjB;QARiB,EACtC,OAAO,GAAG,QAAQ,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,OAEW,EADlB,SAAS,cAP0B,sGAQvC,CADa;IAEZ,MAAM,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,iBAAiB,EAAE;QAChE,KAAK,EAAE,EAAE,OAAO,EAAE;KACnB,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAE1C,MAAM,eAAe,GACnB,OAAO,KAAK,QAAQ;QAClB,CAAC,CAAC,EAAE,QAAQ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EAChB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,KAAK,EACf,UAAU,EAAC,MAAM,IACjB,CACc,CACnB,CAAC;IAEF,OAAO,CACL,4CAAM,GAAG,EAAE,iBAAiB,IAAM,SAAS,IAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,KAC5G,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CACtB,8BAAM,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC;QACzC,8BAAM,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC,IAAG,OAAO,CAAQ;QACrE,8BAAM,SAAS,EAAE,UAAU,CAAC,cAAc,CAAC,IAAG,UAAU,CAAQ,CAC3D,CACR,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CACI,CACR,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { CopyToClipboardProps } from './interfaces';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport InternalButton from '../button/internal';\nimport InternalPopover from '../popover/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\nimport clsx from 'clsx';\n\nexport { CopyToClipboardProps };\n\nexport default function CopyToClipboard({\n variant = 'button',\n copyButtonAriaLabel,\n copyButtonText,\n copySuccessText,\n copyErrorText,\n textToCopy,\n ...restProps\n}: CopyToClipboardProps) {\n const { __internalRootRef } = useBaseComponent('CopyToClipboard', {\n props: { variant },\n });\n const baseProps = getBaseProps(restProps);\n\n const copyButtonProps =\n variant === 'button'\n ? { children: copyButtonText, ariaLabel: copyButtonAriaLabel }\n : { ariaLabel: copyButtonAriaLabel ?? copyButtonText };\n\n const [status, setStatus] = useState<'pending' | 'success' | 'error'>('pending');\n const [statusText, setStatusText] = useState('');\n\n const onClick = () => {\n if (navigator.clipboard) {\n setStatus('pending');\n setStatusText('');\n navigator.clipboard\n .writeText(textToCopy)\n .then(() => {\n setStatus('success');\n setStatusText(copySuccessText);\n })\n .catch(() => {\n setStatus('error');\n setStatusText(copyErrorText);\n });\n }\n };\n\n const triggerVariant = (\n {\n button: 'normal',\n icon: 'icon',\n inline: 'inline-icon',\n } as const\n )[variant];\n\n const trigger = (\n <InternalPopover\n size=\"medium\"\n position=\"top\"\n triggerType=\"custom\"\n dismissButton={false}\n renderWithPortal={true}\n content={<InternalStatusIndicator type={status}>{statusText}</InternalStatusIndicator>}\n >\n <InternalButton\n {...copyButtonProps}\n iconName=\"copy\"\n onClick={onClick}\n variant={triggerVariant}\n wrapText={false}\n formAction=\"none\"\n />\n </InternalPopover>\n );\n\n return (\n <span ref={__internalRootRef} {...baseProps} className={clsx(baseProps.className, styles.root, testStyles.root)}>\n {variant === 'inline' ? (\n <span className={styles['inline-container']}>\n <span className={styles['inline-container-trigger']}>{trigger}</span>\n <span className={testStyles['text-to-copy']}>{textToCopy}</span>\n </span>\n ) : (\n trigger\n )}\n </span>\n );\n}\n\napplyDisplayName(CopyToClipboard, 'CopyToClipboard');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,uBAAuB,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAIpE,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAA0D;QAA1D,EAAE,OAAO,GAAG,QAAQ,OAAsC,EAAjC,SAAS,cAAlC,WAAoC,CAAF;IACxE,MAAM,SAAS,GAAG,gBAAgB,CAAC,iBAAiB,EAAE;QACpD,KAAK,EAAE,EAAE,OAAO,EAAE;KACnB,CAAC,CAAC;IACH,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAElD,OAAO,oBAAC,uBAAuB,kBAAC,OAAO,EAAE,OAAO,IAAM,SAAS,EAAM,aAAa,EAAI,CAAC;AACzF,CAAC;AAED,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { CopyToClipboardProps } from './interfaces';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport InternalCopyToClipboard from './internal';\nimport { getExternalProps } from '../internal/utils/external-props';\n\nexport { CopyToClipboardProps };\n\nexport default function CopyToClipboard({ variant = 'button', ...restProps }: CopyToClipboardProps) {\n const baseProps = useBaseComponent('CopyToClipboard', {\n props: { variant },\n });\n const filteredProps = getExternalProps(restProps);\n\n return <InternalCopyToClipboard variant={variant} {...baseProps} {...filteredProps} />;\n}\n\napplyDisplayName(CopyToClipboard, 'CopyToClipboard');\n"]}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { CopyToClipboardProps } from './interfaces';
3
+ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
4
+ export interface InternalCopyToClipboardProps extends CopyToClipboardProps, InternalBaseComponentProps {
5
+ }
6
+ export default function InternalCopyToClipboard({ variant, copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, __internalRootRef, ...restProps }: InternalCopyToClipboardProps): JSX.Element;
7
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AASpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB,EAAE,0BAA0B;CAAG;AAEzG,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EAC9C,OAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,iBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,4BAA4B,eAgE9B"}
@@ -0,0 +1,44 @@
1
+ import { __rest } from "tslib";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ import React, { useState } from 'react';
5
+ import InternalButton from '../button/internal';
6
+ import InternalPopover from '../popover/internal';
7
+ import InternalStatusIndicator from '../status-indicator/internal';
8
+ import styles from './styles.css.js';
9
+ import testStyles from './test-classes/styles.css.js';
10
+ import clsx from 'clsx';
11
+ import { getBaseProps } from '../internal/base-component';
12
+ export default function InternalCopyToClipboard(_a) {
13
+ var { variant = 'button', copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, __internalRootRef = null } = _a, restProps = __rest(_a, ["variant", "copyButtonAriaLabel", "copyButtonText", "copySuccessText", "copyErrorText", "textToCopy", "__internalRootRef"]);
14
+ const [status, setStatus] = useState('pending');
15
+ const [statusText, setStatusText] = useState('');
16
+ const baseProps = getBaseProps(restProps);
17
+ const onClick = () => {
18
+ if (navigator.clipboard) {
19
+ setStatus('pending');
20
+ setStatusText('');
21
+ navigator.clipboard
22
+ .writeText(textToCopy)
23
+ .then(() => {
24
+ setStatus('success');
25
+ setStatusText(copySuccessText);
26
+ })
27
+ .catch(() => {
28
+ setStatus('error');
29
+ setStatusText(copyErrorText);
30
+ });
31
+ }
32
+ };
33
+ const triggerVariant = {
34
+ button: 'normal',
35
+ icon: 'icon',
36
+ inline: 'inline-icon',
37
+ }[variant];
38
+ const trigger = (React.createElement(InternalPopover, { size: "medium", position: "top", triggerType: "custom", dismissButton: false, renderWithPortal: true, content: React.createElement(InternalStatusIndicator, { type: status }, statusText) },
39
+ React.createElement(InternalButton, { ariaLabel: copyButtonAriaLabel !== null && copyButtonAriaLabel !== void 0 ? copyButtonAriaLabel : copyButtonText, iconName: "copy", onClick: onClick, variant: triggerVariant, wrapText: false, formAction: "none" }, copyButtonText)));
40
+ return (React.createElement("span", Object.assign({}, baseProps, { ref: __internalRootRef, className: clsx(baseProps.className, styles.root, testStyles.root) }), variant === 'inline' ? (React.createElement("span", { className: styles['inline-container'] },
41
+ React.createElement("span", { className: styles['inline-container-trigger'] }, trigger),
42
+ React.createElement("span", { className: testStyles['text-to-copy'] }, textToCopy))) : (trigger)));
43
+ }
44
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,8BAA8B,CAAC;AACtD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAK1D,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EASjB;QATiB,EAC9C,OAAO,GAAG,QAAQ,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,iBAAiB,GAAG,IAAI,OAEK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ChB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,KAAK,EACf,UAAU,EAAC,MAAM,IAEhB,cAAc,CACA,CACD,CACnB,CAAC;IAEF,OAAO,CACL,8CAAU,SAAS,IAAE,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,KAC5G,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CACtB,8BAAM,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC;QACzC,8BAAM,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC,IAAG,OAAO,CAAQ;QACrE,8BAAM,SAAS,EAAE,UAAU,CAAC,cAAc,CAAC,IAAG,UAAU,CAAQ,CAC3D,CACR,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CACI,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport { CopyToClipboardProps } from './interfaces';\nimport InternalButton from '../button/internal';\nimport InternalPopover from '../popover/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\n\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\nimport clsx from 'clsx';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface InternalCopyToClipboardProps extends CopyToClipboardProps, InternalBaseComponentProps {}\n\nexport default function InternalCopyToClipboard({\n variant = 'button',\n copyButtonAriaLabel,\n copyButtonText,\n copySuccessText,\n copyErrorText,\n textToCopy,\n __internalRootRef = null,\n ...restProps\n}: InternalCopyToClipboardProps) {\n const [status, setStatus] = useState<'pending' | 'success' | 'error'>('pending');\n const [statusText, setStatusText] = useState('');\n\n const baseProps = getBaseProps(restProps);\n const onClick = () => {\n if (navigator.clipboard) {\n setStatus('pending');\n setStatusText('');\n navigator.clipboard\n .writeText(textToCopy)\n .then(() => {\n setStatus('success');\n setStatusText(copySuccessText);\n })\n .catch(() => {\n setStatus('error');\n setStatusText(copyErrorText);\n });\n }\n };\n\n const triggerVariant = (\n {\n button: 'normal',\n icon: 'icon',\n inline: 'inline-icon',\n } as const\n )[variant];\n\n const trigger = (\n <InternalPopover\n size=\"medium\"\n position=\"top\"\n triggerType=\"custom\"\n dismissButton={false}\n renderWithPortal={true}\n content={<InternalStatusIndicator type={status}>{statusText}</InternalStatusIndicator>}\n >\n <InternalButton\n ariaLabel={copyButtonAriaLabel ?? copyButtonText}\n iconName=\"copy\"\n onClick={onClick}\n variant={triggerVariant}\n wrapText={false}\n formAction=\"none\"\n >\n {copyButtonText}\n </InternalButton>\n </InternalPopover>\n );\n\n return (\n <span {...baseProps} ref={__internalRootRef} className={clsx(baseProps.className, styles.root, testStyles.root)}>\n {variant === 'inline' ? (\n <span className={styles['inline-container']}>\n <span className={styles['inline-container-trigger']}>{trigger}</span>\n <span className={testStyles['text-to-copy']}>{textToCopy}</span>\n </span>\n ) : (\n trigger\n )}\n </span>\n );\n}\n"]}
@@ -1,28 +1,28 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_kp9ld_103",
5
- "warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_kp9ld_104",
6
- "awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_kp9ld_1",
7
- "error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_kp9ld_134",
8
- "warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_kp9ld_135",
9
- "awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_kp9ld_1",
10
- "warning": "awsui_warning_14mhv_kp9ld_104",
11
- "error": "awsui_error_14mhv_kp9ld_103",
12
- "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_kp9ld_1",
13
- "root": "awsui_root_14mhv_kp9ld_186",
14
- "label": "awsui_label_14mhv_kp9ld_222",
15
- "info": "awsui_info_14mhv_kp9ld_236",
16
- "description": "awsui_description_14mhv_kp9ld_241",
17
- "constraint": "awsui_constraint_14mhv_kp9ld_242",
18
- "hints": "awsui_hints_14mhv_kp9ld_249",
19
- "constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_kp9ld_250",
20
- "secondary-control": "awsui_secondary-control_14mhv_kp9ld_254",
21
- "controls": "awsui_controls_14mhv_kp9ld_258",
22
- "label-hidden": "awsui_label-hidden_14mhv_kp9ld_258",
23
- "control": "awsui_control_14mhv_kp9ld_258",
24
- "error__message": "awsui_error__message_14mhv_kp9ld_285",
25
- "warning__message": "awsui_warning__message_14mhv_kp9ld_286",
26
- "visually-hidden": "awsui_visually-hidden_14mhv_kp9ld_290"
4
+ "error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_3golc_103",
5
+ "warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_3golc_104",
6
+ "awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_3golc_1",
7
+ "error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_3golc_134",
8
+ "warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_3golc_135",
9
+ "awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_3golc_1",
10
+ "warning": "awsui_warning_14mhv_3golc_104",
11
+ "error": "awsui_error_14mhv_3golc_103",
12
+ "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_3golc_1",
13
+ "root": "awsui_root_14mhv_3golc_186",
14
+ "label": "awsui_label_14mhv_3golc_222",
15
+ "info": "awsui_info_14mhv_3golc_236",
16
+ "description": "awsui_description_14mhv_3golc_242",
17
+ "constraint": "awsui_constraint_14mhv_3golc_243",
18
+ "hints": "awsui_hints_14mhv_3golc_250",
19
+ "constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_3golc_251",
20
+ "secondary-control": "awsui_secondary-control_14mhv_3golc_255",
21
+ "controls": "awsui_controls_14mhv_3golc_259",
22
+ "label-hidden": "awsui_label-hidden_14mhv_3golc_259",
23
+ "control": "awsui_control_14mhv_3golc_259",
24
+ "error__message": "awsui_error__message_14mhv_3golc_286",
25
+ "warning__message": "awsui_warning__message_14mhv_3golc_287",
26
+ "visually-hidden": "awsui_visually-hidden_14mhv_3golc_291"
27
27
  };
28
28
 
@@ -100,11 +100,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
100
100
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
101
101
  SPDX-License-Identifier: Apache-2.0
102
102
  */
103
- .awsui_error-icon-shake-wrapper_14mhv_kp9ld_103:not(#\9),
104
- .awsui_warning-icon-shake-wrapper_14mhv_kp9ld_104:not(#\9) {
105
- animation: awsui_awsui-motion-shake-horizontally_14mhv_kp9ld_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms);
103
+ .awsui_error-icon-shake-wrapper_14mhv_3golc_103:not(#\9),
104
+ .awsui_warning-icon-shake-wrapper_14mhv_3golc_104:not(#\9) {
105
+ animation: awsui_awsui-motion-shake-horizontally_14mhv_3golc_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms);
106
106
  }
107
- @keyframes awsui_awsui-motion-shake-horizontally_14mhv_kp9ld_1 {
107
+ @keyframes awsui_awsui-motion-shake-horizontally_14mhv_3golc_1 {
108
108
  0% {
109
109
  transform: translateX(-5px);
110
110
  animation-timing-function: linear;
@@ -118,22 +118,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
118
118
  }
119
119
  }
120
120
  @media (prefers-reduced-motion: reduce) {
121
- .awsui_error-icon-shake-wrapper_14mhv_kp9ld_103:not(#\9),
122
- .awsui_warning-icon-shake-wrapper_14mhv_kp9ld_104:not(#\9) {
121
+ .awsui_error-icon-shake-wrapper_14mhv_3golc_103:not(#\9),
122
+ .awsui_warning-icon-shake-wrapper_14mhv_3golc_104:not(#\9) {
123
123
  animation: none;
124
124
  transition: none;
125
125
  }
126
126
  }
127
- .awsui-motion-disabled .awsui_error-icon-shake-wrapper_14mhv_kp9ld_103:not(#\9), .awsui-mode-entering .awsui_error-icon-shake-wrapper_14mhv_kp9ld_103:not(#\9), .awsui-motion-disabled .awsui_warning-icon-shake-wrapper_14mhv_kp9ld_104:not(#\9), .awsui-mode-entering .awsui_warning-icon-shake-wrapper_14mhv_kp9ld_104:not(#\9) {
127
+ .awsui-motion-disabled .awsui_error-icon-shake-wrapper_14mhv_3golc_103:not(#\9), .awsui-mode-entering .awsui_error-icon-shake-wrapper_14mhv_3golc_103:not(#\9), .awsui-motion-disabled .awsui_warning-icon-shake-wrapper_14mhv_3golc_104:not(#\9), .awsui-mode-entering .awsui_warning-icon-shake-wrapper_14mhv_3golc_104:not(#\9) {
128
128
  animation: none;
129
129
  transition: none;
130
130
  }
131
131
 
132
- .awsui_error-icon-scale-wrapper_14mhv_kp9ld_134:not(#\9),
133
- .awsui_warning-icon-scale-wrapper_14mhv_kp9ld_135:not(#\9) {
134
- animation: awsui_awsui-motion-scale-popup_14mhv_kp9ld_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms) var(--motion-easing-refresh-only-a-8flf9q, cubic-bezier(0, 0, 0, 1));
132
+ .awsui_error-icon-scale-wrapper_14mhv_3golc_134:not(#\9),
133
+ .awsui_warning-icon-scale-wrapper_14mhv_3golc_135:not(#\9) {
134
+ animation: awsui_awsui-motion-scale-popup_14mhv_3golc_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms) var(--motion-easing-refresh-only-a-8flf9q, cubic-bezier(0, 0, 0, 1));
135
135
  }
136
- @keyframes awsui_awsui-motion-scale-popup_14mhv_kp9ld_1 {
136
+ @keyframes awsui_awsui-motion-scale-popup_14mhv_3golc_1 {
137
137
  0% {
138
138
  transform: scale(0.95);
139
139
  }
@@ -142,22 +142,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
142
142
  }
143
143
  }
144
144
  @media (prefers-reduced-motion: reduce) {
145
- .awsui_error-icon-scale-wrapper_14mhv_kp9ld_134:not(#\9),
146
- .awsui_warning-icon-scale-wrapper_14mhv_kp9ld_135:not(#\9) {
145
+ .awsui_error-icon-scale-wrapper_14mhv_3golc_134:not(#\9),
146
+ .awsui_warning-icon-scale-wrapper_14mhv_3golc_135:not(#\9) {
147
147
  animation: none;
148
148
  transition: none;
149
149
  }
150
150
  }
151
- .awsui-motion-disabled .awsui_error-icon-scale-wrapper_14mhv_kp9ld_134:not(#\9), .awsui-mode-entering .awsui_error-icon-scale-wrapper_14mhv_kp9ld_134:not(#\9), .awsui-motion-disabled .awsui_warning-icon-scale-wrapper_14mhv_kp9ld_135:not(#\9), .awsui-mode-entering .awsui_warning-icon-scale-wrapper_14mhv_kp9ld_135:not(#\9) {
151
+ .awsui-motion-disabled .awsui_error-icon-scale-wrapper_14mhv_3golc_134:not(#\9), .awsui-mode-entering .awsui_error-icon-scale-wrapper_14mhv_3golc_134:not(#\9), .awsui-motion-disabled .awsui_warning-icon-scale-wrapper_14mhv_3golc_135:not(#\9), .awsui-mode-entering .awsui_warning-icon-scale-wrapper_14mhv_3golc_135:not(#\9) {
152
152
  animation: none;
153
153
  transition: none;
154
154
  }
155
155
 
156
- .awsui_warning_14mhv_kp9ld_104:not(#\9),
157
- .awsui_error_14mhv_kp9ld_103:not(#\9) {
158
- animation: awsui_awsui-motion-fade-in-0_14mhv_kp9ld_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms) var(--motion-easing-refresh-only-a-8flf9q, cubic-bezier(0, 0, 0, 1));
156
+ .awsui_warning_14mhv_3golc_104:not(#\9),
157
+ .awsui_error_14mhv_3golc_103:not(#\9) {
158
+ animation: awsui_awsui-motion-fade-in-0_14mhv_3golc_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms) var(--motion-easing-refresh-only-a-8flf9q, cubic-bezier(0, 0, 0, 1));
159
159
  }
160
- @keyframes awsui_awsui-motion-fade-in-0_14mhv_kp9ld_1 {
160
+ @keyframes awsui_awsui-motion-fade-in-0_14mhv_3golc_1 {
161
161
  from {
162
162
  opacity: 0;
163
163
  }
@@ -166,18 +166,18 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
166
166
  }
167
167
  }
168
168
  @media (prefers-reduced-motion: reduce) {
169
- .awsui_warning_14mhv_kp9ld_104:not(#\9),
170
- .awsui_error_14mhv_kp9ld_103:not(#\9) {
169
+ .awsui_warning_14mhv_3golc_104:not(#\9),
170
+ .awsui_error_14mhv_3golc_103:not(#\9) {
171
171
  animation: none;
172
172
  transition: none;
173
173
  }
174
174
  }
175
- .awsui-motion-disabled .awsui_warning_14mhv_kp9ld_104:not(#\9), .awsui-mode-entering .awsui_warning_14mhv_kp9ld_104:not(#\9), .awsui-motion-disabled .awsui_error_14mhv_kp9ld_103:not(#\9), .awsui-mode-entering .awsui_error_14mhv_kp9ld_103:not(#\9) {
175
+ .awsui-motion-disabled .awsui_warning_14mhv_3golc_104:not(#\9), .awsui-mode-entering .awsui_warning_14mhv_3golc_104:not(#\9), .awsui-motion-disabled .awsui_error_14mhv_3golc_103:not(#\9), .awsui-mode-entering .awsui_error_14mhv_3golc_103:not(#\9) {
176
176
  animation: none;
177
177
  transition: none;
178
178
  }
179
179
 
180
- .awsui_root_14mhv_kp9ld_186:not(#\9) {
180
+ .awsui_root_14mhv_3golc_186:not(#\9) {
181
181
  border-collapse: separate;
182
182
  border-spacing: 0;
183
183
  box-sizing: border-box;
@@ -214,7 +214,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
214
214
  box-sizing: border-box;
215
215
  }
216
216
 
217
- .awsui_label_14mhv_kp9ld_222:not(#\9) {
217
+ .awsui_label_14mhv_3golc_222:not(#\9) {
218
218
  box-sizing: border-box;
219
219
  color: var(--color-text-form-label-ktbzsd, #000716);
220
220
  display: inline;
@@ -223,43 +223,44 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
223
223
  font-weight: var(--font-display-label-weight-815ja9, 700);
224
224
  margin-inline-end: var(--space-xs-zb16t3, 8px);
225
225
  }
226
- .awsui_label_14mhv_kp9ld_222:not(#\9):only-child {
226
+ .awsui_label_14mhv_3golc_222:not(#\9):only-child {
227
227
  margin-block: 0;
228
228
  margin-inline: 0;
229
229
  }
230
230
 
231
- .awsui_info_14mhv_kp9ld_236:not(#\9) {
231
+ .awsui_info_14mhv_3golc_236:not(#\9) {
232
+ display: inline-flex;
232
233
  padding-inline-start: var(--space-xs-zb16t3, 8px);
233
234
  border-inline-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-divider-default-j74lyz, #b6bec9);
234
235
  }
235
236
 
236
- .awsui_description_14mhv_kp9ld_241:not(#\9),
237
- .awsui_constraint_14mhv_kp9ld_242:not(#\9) {
237
+ .awsui_description_14mhv_3golc_242:not(#\9),
238
+ .awsui_constraint_14mhv_3golc_243:not(#\9) {
238
239
  color: var(--color-text-form-secondary-dxc248, #5f6b7a);
239
240
  font-size: var(--font-size-body-s-asqx2i, 12px);
240
241
  line-height: var(--line-height-body-s-7zv1j5, 16px);
241
242
  letter-spacing: var(--letter-spacing-body-s-z9jkwp, 0.005em);
242
243
  }
243
244
 
244
- .awsui_hints_14mhv_kp9ld_249:not(#\9),
245
- .awsui_constraint-has-validation-text_14mhv_kp9ld_250:not(#\9) {
245
+ .awsui_hints_14mhv_3golc_250:not(#\9),
246
+ .awsui_constraint-has-validation-text_14mhv_3golc_251:not(#\9) {
246
247
  padding-block-start: var(--space-xxs-p8yyaw, 4px);
247
248
  }
248
249
 
249
- .awsui_secondary-control_14mhv_kp9ld_254:not(#\9) {
250
+ .awsui_secondary-control_14mhv_3golc_255:not(#\9) {
250
251
  /* used in test-utils */
251
252
  }
252
253
 
253
- .awsui_controls_14mhv_kp9ld_258:not(#\9):not(.awsui_label-hidden_14mhv_kp9ld_258) {
254
+ .awsui_controls_14mhv_3golc_259:not(#\9):not(.awsui_label-hidden_14mhv_3golc_259) {
254
255
  padding-block-start: var(--space-xxs-p8yyaw, 4px);
255
256
  }
256
257
 
257
- .awsui_control_14mhv_kp9ld_258:not(#\9) {
258
+ .awsui_control_14mhv_3golc_259:not(#\9) {
258
259
  min-inline-size: 0;
259
260
  word-break: break-word;
260
261
  }
261
262
 
262
- .awsui_error_14mhv_kp9ld_103:not(#\9) {
263
+ .awsui_error_14mhv_3golc_103:not(#\9) {
263
264
  color: var(--color-text-status-error-wdvepn, #d91515);
264
265
  font-size: var(--font-size-body-s-asqx2i, 12px);
265
266
  line-height: var(--line-height-body-s-7zv1j5, 16px);
@@ -268,7 +269,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
268
269
  align-items: flex-start;
269
270
  }
270
271
 
271
- .awsui_warning_14mhv_kp9ld_104:not(#\9) {
272
+ .awsui_warning_14mhv_3golc_104:not(#\9) {
272
273
  color: var(--color-text-status-warning-yik8vi, #8d6605);
273
274
  font-size: var(--font-size-body-s-asqx2i, 12px);
274
275
  line-height: var(--line-height-body-s-7zv1j5, 16px);
@@ -277,12 +278,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
277
278
  align-items: flex-start;
278
279
  }
279
280
 
280
- .awsui_error__message_14mhv_kp9ld_285:not(#\9),
281
- .awsui_warning__message_14mhv_kp9ld_286:not(#\9) {
281
+ .awsui_error__message_14mhv_3golc_286:not(#\9),
282
+ .awsui_warning__message_14mhv_3golc_287:not(#\9) {
282
283
  margin-inline-start: var(--space-xxs-p8yyaw, 4px);
283
284
  }
284
285
 
285
- .awsui_visually-hidden_14mhv_kp9ld_290:not(#\9) {
286
+ .awsui_visually-hidden_14mhv_3golc_291:not(#\9) {
286
287
  position: absolute !important;
287
288
  inset-block-start: -9999px !important;
288
289
  inset-inline-start: -9999px !important;
@@ -2,28 +2,28 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_kp9ld_103",
6
- "warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_kp9ld_104",
7
- "awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_kp9ld_1",
8
- "error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_kp9ld_134",
9
- "warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_kp9ld_135",
10
- "awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_kp9ld_1",
11
- "warning": "awsui_warning_14mhv_kp9ld_104",
12
- "error": "awsui_error_14mhv_kp9ld_103",
13
- "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_kp9ld_1",
14
- "root": "awsui_root_14mhv_kp9ld_186",
15
- "label": "awsui_label_14mhv_kp9ld_222",
16
- "info": "awsui_info_14mhv_kp9ld_236",
17
- "description": "awsui_description_14mhv_kp9ld_241",
18
- "constraint": "awsui_constraint_14mhv_kp9ld_242",
19
- "hints": "awsui_hints_14mhv_kp9ld_249",
20
- "constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_kp9ld_250",
21
- "secondary-control": "awsui_secondary-control_14mhv_kp9ld_254",
22
- "controls": "awsui_controls_14mhv_kp9ld_258",
23
- "label-hidden": "awsui_label-hidden_14mhv_kp9ld_258",
24
- "control": "awsui_control_14mhv_kp9ld_258",
25
- "error__message": "awsui_error__message_14mhv_kp9ld_285",
26
- "warning__message": "awsui_warning__message_14mhv_kp9ld_286",
27
- "visually-hidden": "awsui_visually-hidden_14mhv_kp9ld_290"
5
+ "error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_3golc_103",
6
+ "warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_3golc_104",
7
+ "awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_3golc_1",
8
+ "error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_3golc_134",
9
+ "warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_3golc_135",
10
+ "awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_3golc_1",
11
+ "warning": "awsui_warning_14mhv_3golc_104",
12
+ "error": "awsui_error_14mhv_3golc_103",
13
+ "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_3golc_1",
14
+ "root": "awsui_root_14mhv_3golc_186",
15
+ "label": "awsui_label_14mhv_3golc_222",
16
+ "info": "awsui_info_14mhv_3golc_236",
17
+ "description": "awsui_description_14mhv_3golc_242",
18
+ "constraint": "awsui_constraint_14mhv_3golc_243",
19
+ "hints": "awsui_hints_14mhv_3golc_250",
20
+ "constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_3golc_251",
21
+ "secondary-control": "awsui_secondary-control_14mhv_3golc_255",
22
+ "controls": "awsui_controls_14mhv_3golc_259",
23
+ "label-hidden": "awsui_label-hidden_14mhv_3golc_259",
24
+ "control": "awsui_control_14mhv_3golc_259",
25
+ "error__message": "awsui_error__message_14mhv_3golc_286",
26
+ "warning__message": "awsui_warning__message_14mhv_3golc_287",
27
+ "visually-hidden": "awsui_visually-hidden_14mhv_3golc_291"
28
28
  };
29
29
 
@@ -1,7 +1,8 @@
1
1
  import { BaseKeyDetail, CancelableEventHandler } from '../../../events';
2
2
  interface UseMenuKeyboard {
3
3
  (inputProps: {
4
- moveHighlight: (direction: -1 | 1, startIndex?: number) => void;
4
+ goUp: () => void;
5
+ goDown: () => void;
5
6
  selectOption: () => void;
6
7
  goHome: () => void;
7
8
  goEnd: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"use-keyboard.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/options-list/utils/use-keyboard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAKxE,UAAU,eAAe;IACvB,CAAC,UAAU,EAAE;QACX,aAAa,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;QAChE,YAAY,EAAE,MAAM,IAAI,CAAC;QACzB,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,KAAK,EAAE,MAAM,IAAI,CAAC;QAClB,aAAa,EAAE,MAAM,IAAI,CAAC;QAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;CAC3C;AAED,eAAO,MAAM,eAAe,EAAE,eA0C7B,CAAC;AAEF,UAAU,kBAAkB;IAC1B,CAAC,UAAU,EAAE;QAAE,YAAY,EAAE,MAAM,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;CACvG;AAED,eAAO,MAAM,kBAAkB,EAAE,kBAmBhC,CAAC"}
1
+ {"version":3,"file":"use-keyboard.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/options-list/utils/use-keyboard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAKxE,UAAU,eAAe;IACvB,CAAC,UAAU,EAAE;QACX,IAAI,EAAE,MAAM,IAAI,CAAC;QACjB,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,YAAY,EAAE,MAAM,IAAI,CAAC;QACzB,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,KAAK,EAAE,MAAM,IAAI,CAAC;QAClB,aAAa,EAAE,MAAM,IAAI,CAAC;QAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;CAC3C;AAED,eAAO,MAAM,eAAe,EAAE,eA2C7B,CAAC;AAEF,UAAU,kBAAkB;IAC1B,CAAC,UAAU,EAAE;QAAE,YAAY,EAAE,MAAM,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;CACvG;AAED,eAAO,MAAM,kBAAkB,EAAE,kBAmBhC,CAAC"}